aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-11-16 00:24:51 +0800
committerchai <chaifix@163.com>2018-11-16 00:24:51 +0800
commit831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 (patch)
treef91fccc7d2628d6e0a39886134b2bb174f5eede4
parent6dc75930fe5fe02f1af5489917752d315cf9e48f (diff)
*合并master到minimal分支
-rw-r--r--bin/Jin.exebin510464 -> 2263040 bytes
-rw-r--r--bin/SDL2.dllbin996352 -> 1242112 bytes
-rw-r--r--bin/font.pngbin2780 -> 0 bytes
-rw-r--r--bin/font.shader26
-rw-r--r--bin/font2.pngbin2758 -> 0 bytes
-rw-r--r--bin/game/0.pngbin0 -> 563072 bytes
-rw-r--r--bin/game/1.pngbin0 -> 73228 bytes
-rw-r--r--bin/game/SDL.jpgbin0 -> 6481 bytes
-rw-r--r--bin/game/config.lua5
-rw-r--r--bin/game/forest.oggbin0 -> 789109 bytes
-rw-r--r--bin/game/icon.icobin0 -> 85182 bytes
-rw-r--r--bin/game/main.lua102
-rw-r--r--bin/game/splash.pngbin0 -> 392 bytes
-rw-r--r--bin/img2.bmpbin12342 -> 0 bytes
-rw-r--r--bin/intro.oggbin1221422 -> 0 bytes
-rw-r--r--bin/intro_logo.wavbin685750 -> 0 bytes
-rw-r--r--bin/jin.exebin510464 -> 2263040 bytes
-rw-r--r--bin/lua51.dllbin364544 -> 0 bytes
-rw-r--r--bin/main.lua121
-rw-r--r--bin/music.oggbin2121836 -> 0 bytes
-rw-r--r--bin/text.txt1
-rw-r--r--build/vc++/3rdparty/GLee/GLee.vcxproj137
-rw-r--r--build/vc++/3rdparty/GLee/GLee.vcxproj.filters18
-rw-r--r--build/vc++/3rdparty/GLee/GLee.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/SDL2/SDL2.vcxproj462
-rw-r--r--build/vc++/3rdparty/SDL2/SDL2.vcxproj.filters486
-rw-r--r--build/vc++/3rdparty/SDL2/SDL2.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/SDL2main/SDL2main.vcxproj134
-rw-r--r--build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.filters22
-rw-r--r--build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/buildvm/buildvm-post.bat17
-rw-r--r--build/vc++/3rdparty/buildvm/buildvm.vcxproj150
-rw-r--r--build/vc++/3rdparty/buildvm/buildvm.vcxproj.filters30
-rw-r--r--build/vc++/3rdparty/buildvm/buildvm.vcxproj.user11
-rw-r--r--build/vc++/3rdparty/luajit/luajit.vcxproj298
-rw-r--r--build/vc++/3rdparty/luajit/luajit.vcxproj.filters396
-rw-r--r--build/vc++/3rdparty/luajit/luajit.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/minilua/minilua-post.bat6
-rw-r--r--build/vc++/3rdparty/minilua/minilua.vcxproj136
-rw-r--r--build/vc++/3rdparty/minilua/minilua.vcxproj.filters13
-rw-r--r--build/vc++/3rdparty/minilua/minilua.vcxproj.user13
-rw-r--r--build/vc++/3rdparty/ogl2d/ogl2d.vcxproj123
-rw-r--r--build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.filters13
-rw-r--r--build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/smount/smount.vcxproj138
-rw-r--r--build/vc++/3rdparty/smount/smount.vcxproj.filters21
-rw-r--r--build/vc++/3rdparty/smount/smount.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/stb/stb.vcxproj138
-rw-r--r--build/vc++/3rdparty/stb/stb.vcxproj.filters21
-rw-r--r--build/vc++/3rdparty/stb/stb.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/tekcos/tekcos.vcxproj137
-rw-r--r--build/vc++/3rdparty/tekcos/tekcos.vcxproj.filters18
-rw-r--r--build/vc++/3rdparty/tekcos/tekcos.vcxproj.user4
-rw-r--r--build/vc++/3rdparty/wav/wav.vcxproj137
-rw-r--r--build/vc++/3rdparty/wav/wav.vcxproj.filters18
-rw-r--r--build/vc++/3rdparty/wav/wav.vcxproj.user4
-rw-r--r--build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj143
-rw-r--r--build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.filters6
-rw-r--r--build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.user4
-rw-r--r--build/vc++/examples/StateMachine/StateMachine.vcxproj141
-rw-r--r--build/vc++/examples/StateMachine/StateMachine.vcxproj.filters6
-rw-r--r--build/vc++/examples/StateMachine/StateMachine.vcxproj.user4
-rw-r--r--build/vc++/jin.sln161
-rw-r--r--build/vc++/jin.vcxproj146
-rw-r--r--build/vc++/jin.vcxproj.filters373
-rw-r--r--build/vc++/jin/jin.vcxproj148
-rw-r--r--build/vc++/jin/jin.vcxproj.filters6
-rw-r--r--build/vc++/jin/jin.vcxproj.user15
-rw-r--r--build/vc++/libjin/libjin.vcxproj123
-rw-r--r--build/vc++/libjin/libjin.vcxproj.filters538
-rw-r--r--build/vc++/libs/LuaJIT-2.0.5/src/lua51.dllbin364544 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/BUGS.txt16
-rw-r--r--build/vc++/libs/SDL2-2.0.5/COPYING.txt20
-rw-r--r--build/vc++/libs/SDL2-2.0.5/README-SDL.txt13
-rw-r--r--build/vc++/libs/SDL2-2.0.5/README.txt21
-rw-r--r--build/vc++/libs/SDL2-2.0.5/WhatsNew.txt349
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-android.md484
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-cmake.md32
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-directfb.md107
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-dynapi.md130
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-emscripten.md35
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-gesture.md71
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-hg.md22
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-ios.md284
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-linux.md90
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-macosx.md240
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-nacl.md103
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-pandora.md17
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-platforms.md8
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-porting.md68
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-psp.md19
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-raspberrypi.md178
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-touch.md86
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-wince.md10
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-windows.md45
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README-winrt.md541
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/README.md63
-rw-r--r--build/vc++/libs/SDL2-2.0.5/docs/doxyfile1560
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL.h133
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL.h133
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_assert.h291
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_atomic.h274
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_audio.h825
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_bits.h112
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_blendmode.h120
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_clipboard.h71
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h234
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.cmake445
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.in389
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_android.h157
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_iphoneos.h166
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h197
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h.orig197
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_minimal.h82
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_pandora.h128
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_psp.h144
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_windows.h225
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_winrt.h215
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_wiz.h121
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_copying.h20
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_cpuinfo.h176
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_egl.h1673
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_endian.h260
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_error.h76
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_events.h754
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_filesystem.h136
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gamecontroller.h362
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gesture.h87
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_haptic.h1227
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_hints.h959
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_joystick.h382
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keyboard.h217
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keycode.h349
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_loadso.h81
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_log.h211
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_main.h161
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_messagebox.h144
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mouse.h302
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mutex.h251
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_name.h33
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl.h2183
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles.h39
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2.h52
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_pixels.h468
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_platform.h193
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_power.h75
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_quit.h58
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rect.h148
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_render.h910
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_revision.h2
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rwops.h254
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_scancode.h413
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_shape.h144
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_stdinc.h590
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_surface.h521
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_system.h216
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_syswm.h324
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test.h69
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_assert.h105
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_common.h188
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_compare.h69
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_crc32.h124
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_font.h81
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_fuzzer.h384
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_harness.h134
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_images.h78
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_log.h67
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_md5.h129
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_memory.h63
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_random.h115
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_thread.h308
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_timer.h115
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_touch.h86
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_types.h29
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_version.h162
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_video.h1247
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_vulkan.h257
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/begin_code.h167
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL2/close_code.h37
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_assert.h291
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_atomic.h274
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_audio.h825
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_bits.h112
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_blendmode.h120
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_clipboard.h71
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config.h234
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.cmake445
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.in389
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_android.h157
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_iphoneos.h166
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h197
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h.orig197
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_minimal.h82
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_pandora.h128
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_psp.h144
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_windows.h225
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_winrt.h215
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_config_wiz.h121
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_copying.h20
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_cpuinfo.h176
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_egl.h1673
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_endian.h260
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_error.h76
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_events.h754
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_filesystem.h136
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_gamecontroller.h362
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_gesture.h87
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_haptic.h1227
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_hints.h959
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_joystick.h382
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_keyboard.h217
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_keycode.h349
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_loadso.h81
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_log.h211
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_main.h161
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_messagebox.h144
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_mouse.h302
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_mutex.h251
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_name.h33
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_opengl.h2183
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_opengles.h39
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2.h52
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_pixels.h468
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_platform.h193
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_power.h75
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_quit.h58
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_rect.h148
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_render.h910
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_revision.h2
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_rwops.h254
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_scancode.h413
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_shape.h144
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_stdinc.h590
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_surface.h521
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_system.h216
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_syswm.h324
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test.h69
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_assert.h105
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_common.h188
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_compare.h69
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_crc32.h124
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_font.h81
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_fuzzer.h384
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_harness.h134
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_images.h78
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_log.h67
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_md5.h129
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_memory.h63
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_test_random.h115
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_thread.h308
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_timer.h115
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_touch.h86
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_types.h29
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_version.h162
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_video.h1247
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/SDL_vulkan.h257
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/begin_code.h167
-rw-r--r--build/vc++/libs/SDL2-2.0.5/include/close_code.h37
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.dllbin1220096 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.libbin130646 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2main.libbin45212 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2test.libbin940792 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.dllbin996352 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.libbin133714 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2main.libbin43794 -> 0 bytes
-rw-r--r--build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2test.libbin899966 -> 0 bytes
-rw-r--r--examples/particle_system/main.cpp103
-rw-r--r--examples/state_machine/main.cpp124
-rw-r--r--res/font.pngbin7577 -> 7626 bytes
-rw-r--r--src/3rdparty/GLee/GLee.c (renamed from src/libjin/3rdparty/GLee/GLee.c)0
-rw-r--r--src/3rdparty/GLee/GLee.h (renamed from src/libjin/3rdparty/GLee/GLee.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/.gitignore (renamed from build/vc++/libs/LuaJIT-2.0.5/.gitignore)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/COPYRIGHT (renamed from build/vc++/libs/LuaJIT-2.0.5/COPYRIGHT)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/Makefile (renamed from build/vc++/libs/LuaJIT-2.0.5/Makefile)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/README (renamed from build/vc++/libs/LuaJIT-2.0.5/README)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/bluequad-print.css (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/bluequad-print.css)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/bluequad.css (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/bluequad.css)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/changes.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/changes.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/contact.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/contact.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/ext_c_api.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/ext_c_api.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_api.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_api.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_semantics.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_semantics.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_tutorial.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_tutorial.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/ext_jit.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/ext_jit.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/extensions.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/extensions.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/faq.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/faq.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/img/contact.png (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/img/contact.png)bin1340 -> 1340 bytes
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/install.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/install.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/luajit.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/luajit.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/running.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/running.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/doc/status.html (renamed from build/vc++/libs/LuaJIT-2.0.5/doc/status.html)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_arm.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_arm.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_mips.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_mips.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_ppc.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_ppc.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_proto.h (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_proto.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x64.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x64.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x86.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x86.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/dynasm/dynasm.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/dynasm/dynasm.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/etc/luajit.1 (renamed from build/vc++/libs/LuaJIT-2.0.5/etc/luajit.1)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/etc/luajit.pc (renamed from build/vc++/libs/LuaJIT-2.0.5/etc/luajit.pc)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lauxlib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lauxlib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_alloc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_alloc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_arch.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_arch.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_bc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_bc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_bcdump.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_bcdump.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_carith.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_carith.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ccall.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ccall.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ccallback.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ccallback.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cconv.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cconv.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cdata.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cdata.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_char.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_char.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_clib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_clib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cparse.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cparse.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_crecord.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_crecord.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ctype.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ctype.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_debug.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_debug.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_def.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_def.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_dispatch.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_dispatch.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_err.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_err.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_errmsg.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_errmsg.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ff.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ff.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ffrecord.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ffrecord.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_frame.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_frame.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_func.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_func.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_gc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_gc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_gdbjit.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_gdbjit.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ir.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ir.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ircall.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ircall.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_iropt.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_iropt.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_jit.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_jit.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_lex.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_lex.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_lib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_lib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_mcode.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_mcode.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_meta.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_meta.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_obj.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_obj.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_parse.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_parse.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_record.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_record.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_snap.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_snap.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_state.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_state.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_str.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_str.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_tab.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_tab.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_trace.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_trace.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_traceerr.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_traceerr.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_udata.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_udata.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_vm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_vm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_vmevent.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_vmevent.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lua.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lua.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lua.hpp (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lua.hpp)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/luaconf.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/luaconf.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/luajit.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/luajit.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lualib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lualib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/.gitignore (renamed from build/vc++/libs/LuaJIT-2.0.5/src/.gitignore)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/Makefile (renamed from build/vc++/libs/LuaJIT-2.0.5/src/Makefile)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/Makefile.dep (renamed from build/vc++/libs/LuaJIT-2.0.5/src/Makefile.dep)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/buildvm.libbin0 -> 33996 bytes
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/buildvm_arch.h2144
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/.gitignore (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/.gitignore)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/README (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/README)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/buildvm.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/buildvm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_asm.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_asm.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_fold.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_fold.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_lib.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_lib.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_peobj.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_peobj.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/genminilua.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/genminilua.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/host/minilua.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/host/minilua.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/.gitignore (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/.gitignore)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/bc.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/bc.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/bcsave.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/bcsave.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dis_arm.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_arm.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dis_mips.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_mips.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dis_mipsel.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_mipsel.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dis_ppc.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_ppc.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dis_x64.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_x64.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dis_x86.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_x86.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/dump.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/dump.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/jit/v.lua (renamed from build/vc++/libs/LuaJIT-2.0.5/src/jit/v.lua)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lauxlib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lauxlib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_aux.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_aux.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_base.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_base.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_bit.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_bit.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_debug.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_debug.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_ffi.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_ffi.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_init.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_init.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_io.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_io.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_jit.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_jit.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_math.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_math.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_os.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_os.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_package.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_package.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_string.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_string.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lib_table.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lib_table.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj.supp (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj.supp)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_alloc.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_alloc.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_alloc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_alloc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_api.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_api.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_arch.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_arch.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_asm.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_asm.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_asm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_asm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_asm_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_asm_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_asm_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_asm_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_bc.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_bc.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_bc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_bc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_bcdump.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_bcdump.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_bcread.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_bcread.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_bcwrite.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_bcwrite.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_carith.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_carith.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_carith.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_carith.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ccall.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ccall.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ccall.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ccall.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ccallback.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ccallback.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ccallback.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ccallback.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_cconv.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_cconv.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_cconv.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_cconv.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_cdata.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_cdata.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_cdata.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_cdata.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_char.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_char.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_char.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_char.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_clib.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_clib.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_clib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_clib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_cparse.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_cparse.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_cparse.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_cparse.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_crecord.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_crecord.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_crecord.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_crecord.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ctype.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ctype.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ctype.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ctype.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_debug.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_debug.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_debug.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_debug.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_def.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_def.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_dispatch.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_dispatch.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_dispatch.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_dispatch.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_emit_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_emit_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_emit_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_emit_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_err.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_err.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_err.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_err.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_errmsg.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_errmsg.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ff.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ff.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ffrecord.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ffrecord.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ffrecord.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ffrecord.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_frame.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_frame.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_func.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_func.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_func.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_func.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_gc.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_gc.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_gc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_gc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_gdbjit.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_gdbjit.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_gdbjit.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_gdbjit.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ir.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ir.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ir.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ir.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_ircall.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_ircall.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_iropt.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_iropt.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_jit.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_jit.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_lex.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_lex.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_lex.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_lex.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_lib.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_lib.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_lib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_lib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_load.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_load.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_mcode.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_mcode.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_mcode.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_mcode.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_meta.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_meta.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_meta.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_meta.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_obj.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_obj.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_obj.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_obj.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_dce.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_dce.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_fold.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_fold.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_loop.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_loop.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_mem.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_mem.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_narrow.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_narrow.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_sink.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_sink.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_opt_split.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_split.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_parse.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_parse.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_parse.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_parse.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_record.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_record.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_record.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_record.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_snap.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_snap.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_snap.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_snap.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_state.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_state.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_state.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_state.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_str.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_str.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_str.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_str.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_strscan.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_strscan.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_strscan.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_strscan.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_tab.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_tab.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_tab.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_tab.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_target.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_target.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_target_arm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_target_arm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_target_mips.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_target_mips.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_target_ppc.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_target_ppc.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_target_x86.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_target_x86.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_trace.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_trace.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_trace.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_trace.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_traceerr.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_traceerr.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_udata.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_udata.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_udata.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_udata.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_vm.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_vm.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_vmevent.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_vmevent.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_vmevent.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_vmevent.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lj_vmmath.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lj_vmmath.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/ljamalg.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/ljamalg.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lua.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lua.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lua.hpp (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lua.hpp)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lua51.dllbin0 -> 364544 bytes
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lua51.lib (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib)bin59514 -> 59514 bytes
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/luaconf.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/luaconf.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/luajit.c (renamed from build/vc++/libs/LuaJIT-2.0.5/src/luajit.c)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/luajit.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/luajit.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/lualib.h (renamed from build/vc++/libs/LuaJIT-2.0.5/src/lualib.h)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/minilua.libbin0 -> 33996 bytes
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/msvcbuild.bat (renamed from build/vc++/libs/LuaJIT-2.0.5/src/msvcbuild.bat)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/ps4build.bat (renamed from build/vc++/libs/LuaJIT-2.0.5/src/ps4build.bat)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/psvitabuild.bat (renamed from build/vc++/libs/LuaJIT-2.0.5/src/psvitabuild.bat)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/vm_arm.dasc (renamed from build/vc++/libs/LuaJIT-2.0.5/src/vm_arm.dasc)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/vm_mips.dasc (renamed from build/vc++/libs/LuaJIT-2.0.5/src/vm_mips.dasc)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/vm_ppc.dasc (renamed from build/vc++/libs/LuaJIT-2.0.5/src/vm_ppc.dasc)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/vm_ppcspe.dasc (renamed from build/vc++/libs/LuaJIT-2.0.5/src/vm_ppcspe.dasc)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/vm_x86.dasc (renamed from build/vc++/libs/LuaJIT-2.0.5/src/vm_x86.dasc)0
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/vmdef.lua331
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/xedkbuild.bat (renamed from build/vc++/libs/LuaJIT-2.0.5/src/xedkbuild.bat)0
-rw-r--r--src/3rdparty/SDL2/include/SDL.h133
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL.h133
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_assert.h291
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_atomic.h277
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_audio.h825
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_bits.h112
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_blendmode.h120
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_clipboard.h71
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config.h53
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_android.h171
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_iphoneos.h191
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_macosx.h234
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_minimal.h82
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_pandora.h130
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_psp.h159
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_windows.h248
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_winrt.h230
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_config_wiz.h142
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_copying.h20
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_cpuinfo.h181
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_egl.h1673
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_endian.h260
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_error.h76
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_events.h754
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_filesystem.h136
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_gamecontroller.h362
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_gesture.h87
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_haptic.h1227
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_hints.h1022
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_joystick.h382
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_keyboard.h217
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_keycode.h349
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_loadso.h81
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_log.h211
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_main.h168
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_messagebox.h144
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_mouse.h302
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_mutex.h251
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_name.h33
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengl.h2183
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengl_glext.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl_glext.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengles.h39
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengles2.h52
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2ext.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2ext.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2platform.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2platform.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_opengles2_khrplatform.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_khrplatform.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_pixels.h470
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_platform.h198
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_power.h75
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_quit.h58
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_rect.h148
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_render.h931
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_revision.h2
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_rwops.h254
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_scancode.h413
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_shape.h144
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_stdinc.h605
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_surface.h546
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_system.h247
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_syswm.h324
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test.h69
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_assert.h105
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_common.h188
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_compare.h69
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_crc32.h124
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_font.h81
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_fuzzer.h384
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_harness.h134
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_images.h78
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_log.h67
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_md5.h129
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_memory.h63
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_test_random.h115
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_thread.h308
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_timer.h115
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_touch.h86
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_types.h29
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_version.h162
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_video.h1249
-rw-r--r--src/3rdparty/SDL2/include/SDL2/SDL_vulkan.h273
-rw-r--r--src/3rdparty/SDL2/include/SDL2/begin_code.h167
-rw-r--r--src/3rdparty/SDL2/include/SDL2/close_code.h37
-rw-r--r--src/3rdparty/SDL2/include/SDL_assert.h291
-rw-r--r--src/3rdparty/SDL2/include/SDL_atomic.h277
-rw-r--r--src/3rdparty/SDL2/include/SDL_audio.h825
-rw-r--r--src/3rdparty/SDL2/include/SDL_bits.h112
-rw-r--r--src/3rdparty/SDL2/include/SDL_blendmode.h120
-rw-r--r--src/3rdparty/SDL2/include/SDL_clipboard.h71
-rw-r--r--src/3rdparty/SDL2/include/SDL_config.h53
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_android.h171
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_iphoneos.h191
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_macosx.h234
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_minimal.h82
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_pandora.h130
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_psp.h159
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_windows.h248
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_winrt.h230
-rw-r--r--src/3rdparty/SDL2/include/SDL_config_wiz.h142
-rw-r--r--src/3rdparty/SDL2/include/SDL_copying.h20
-rw-r--r--src/3rdparty/SDL2/include/SDL_cpuinfo.h181
-rw-r--r--src/3rdparty/SDL2/include/SDL_egl.h1673
-rw-r--r--src/3rdparty/SDL2/include/SDL_endian.h260
-rw-r--r--src/3rdparty/SDL2/include/SDL_error.h76
-rw-r--r--src/3rdparty/SDL2/include/SDL_events.h754
-rw-r--r--src/3rdparty/SDL2/include/SDL_filesystem.h136
-rw-r--r--src/3rdparty/SDL2/include/SDL_gamecontroller.h362
-rw-r--r--src/3rdparty/SDL2/include/SDL_gesture.h87
-rw-r--r--src/3rdparty/SDL2/include/SDL_haptic.h1227
-rw-r--r--src/3rdparty/SDL2/include/SDL_hints.h1022
-rw-r--r--src/3rdparty/SDL2/include/SDL_joystick.h382
-rw-r--r--src/3rdparty/SDL2/include/SDL_keyboard.h217
-rw-r--r--src/3rdparty/SDL2/include/SDL_keycode.h349
-rw-r--r--src/3rdparty/SDL2/include/SDL_loadso.h81
-rw-r--r--src/3rdparty/SDL2/include/SDL_log.h211
-rw-r--r--src/3rdparty/SDL2/include/SDL_main.h168
-rw-r--r--src/3rdparty/SDL2/include/SDL_messagebox.h144
-rw-r--r--src/3rdparty/SDL2/include/SDL_mouse.h302
-rw-r--r--src/3rdparty/SDL2/include/SDL_mutex.h251
-rw-r--r--src/3rdparty/SDL2/include/SDL_name.h33
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengl.h2183
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengl_glext.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL_opengl_glext.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengles.h39
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengles2.h52
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengles2_gl2.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengles2_gl2ext.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2ext.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengles2_gl2platform.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2platform.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL_opengles2_khrplatform.h (renamed from build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_khrplatform.h)0
-rw-r--r--src/3rdparty/SDL2/include/SDL_pixels.h470
-rw-r--r--src/3rdparty/SDL2/include/SDL_platform.h198
-rw-r--r--src/3rdparty/SDL2/include/SDL_power.h75
-rw-r--r--src/3rdparty/SDL2/include/SDL_quit.h58
-rw-r--r--src/3rdparty/SDL2/include/SDL_rect.h148
-rw-r--r--src/3rdparty/SDL2/include/SDL_render.h931
-rw-r--r--src/3rdparty/SDL2/include/SDL_revision.h2
-rw-r--r--src/3rdparty/SDL2/include/SDL_rwops.h254
-rw-r--r--src/3rdparty/SDL2/include/SDL_scancode.h413
-rw-r--r--src/3rdparty/SDL2/include/SDL_shape.h144
-rw-r--r--src/3rdparty/SDL2/include/SDL_stdinc.h605
-rw-r--r--src/3rdparty/SDL2/include/SDL_surface.h546
-rw-r--r--src/3rdparty/SDL2/include/SDL_system.h247
-rw-r--r--src/3rdparty/SDL2/include/SDL_syswm.h324
-rw-r--r--src/3rdparty/SDL2/include/SDL_test.h69
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_assert.h105
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_common.h188
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_compare.h69
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_crc32.h124
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_font.h81
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_fuzzer.h384
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_harness.h134
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_images.h78
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_log.h67
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_md5.h129
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_memory.h63
-rw-r--r--src/3rdparty/SDL2/include/SDL_test_random.h115
-rw-r--r--src/3rdparty/SDL2/include/SDL_thread.h308
-rw-r--r--src/3rdparty/SDL2/include/SDL_timer.h115
-rw-r--r--src/3rdparty/SDL2/include/SDL_touch.h86
-rw-r--r--src/3rdparty/SDL2/include/SDL_types.h29
-rw-r--r--src/3rdparty/SDL2/include/SDL_version.h162
-rw-r--r--src/3rdparty/SDL2/include/SDL_video.h1249
-rw-r--r--src/3rdparty/SDL2/include/SDL_vulkan.h273
-rw-r--r--src/3rdparty/SDL2/include/begin_code.h167
-rw-r--r--src/3rdparty/SDL2/include/close_code.h37
-rw-r--r--src/3rdparty/SDL2/src/SDL.c476
-rw-r--r--src/3rdparty/SDL2/src/SDL_assert.c441
-rw-r--r--src/3rdparty/SDL2/src/SDL_assert_c.h24
-rw-r--r--src/3rdparty/SDL2/src/SDL_dataqueue.c339
-rw-r--r--src/3rdparty/SDL2/src/SDL_dataqueue.h55
-rw-r--r--src/3rdparty/SDL2/src/SDL_error.c319
-rw-r--r--src/3rdparty/SDL2/src/SDL_error_c.h65
-rw-r--r--src/3rdparty/SDL2/src/SDL_hints.c236
-rw-r--r--src/3rdparty/SDL2/src/SDL_internal.h52
-rw-r--r--src/3rdparty/SDL2/src/SDL_log.c450
-rw-r--r--src/3rdparty/SDL2/src/atomic/SDL_atomic.c303
-rw-r--r--src/3rdparty/SDL2/src/atomic/SDL_spinlock.c152
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_audio.c1635
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_audio_c.h79
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_audiocvt.c1673
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_audiodev.c124
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_audiodev_c.h38
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_audiotypecvt.c829
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_mixer.c369
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_sysaudio.h211
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_wave.c694
-rw-r--r--src/3rdparty/SDL2/src/audio/SDL_wave.h77
-rw-r--r--src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.c1030
-rw-r--r--src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.h48
-rw-r--r--src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.c226
-rw-r--r--src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.h42
-rw-r--r--src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.c365
-rw-r--r--src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.h53
-rw-r--r--src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.h68
-rw-r--r--src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.m891
-rw-r--r--src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.c604
-rw-r--r--src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.h47
-rw-r--r--src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.c207
-rw-r--r--src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.h41
-rw-r--r--src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.c320
-rw-r--r--src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.h43
-rw-r--r--src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.c65
-rw-r--r--src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.h41
-rw-r--r--src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c379
-rw-r--r--src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h38
-rw-r--r--src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.c335
-rw-r--r--src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.h51
-rw-r--r--src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.c328
-rw-r--r--src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.h50
-rw-r--r--src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.cc248
-rw-r--r--src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.h38
-rw-r--r--src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.c429
-rw-r--r--src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.h42
-rw-r--r--src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.c165
-rw-r--r--src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.h43
-rw-r--r--src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.c463
-rw-r--r--src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.h56
-rw-r--r--src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.c412
-rw-r--r--src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.h48
-rw-r--r--src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.c516
-rw-r--r--src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.h48
-rw-r--r--src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.c181
-rw-r--r--src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.h45
-rw-r--r--src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c782
-rw-r--r--src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h52
-rw-r--r--src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.c666
-rw-r--r--src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.h57
-rw-r--r--src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.c382
-rw-r--r--src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.h49
-rw-r--r--src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.c419
-rw-r--r--src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.h47
-rw-r--r--src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.c779
-rw-r--r--src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.h85
-rw-r--r--src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_win32.c417
-rw-r--r--src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp276
-rw-r--r--src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.c457
-rw-r--r--src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.h45
-rw-r--r--src/3rdparty/SDL2/src/core/android/SDL_android.c2171
-rw-r--r--src/3rdparty/SDL2/src/core/android/SDL_android.h112
-rw-r--r--src/3rdparty/SDL2/src/core/android/keyinfotable.h175
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_dbus.c335
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_dbus.h97
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_evdev.c698
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_evdev.h39
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.c677
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.h29
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h284
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h4763
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_fcitx.c373
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_fcitx.h40
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_ibus.c584
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_ibus.h58
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_ime.c152
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_ime.h40
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_udev.c553
-rw-r--r--src/3rdparty/SDL2/src/core/linux/SDL_udev.h121
-rw-r--r--src/3rdparty/SDL2/src/core/unix/SDL_poll.c87
-rw-r--r--src/3rdparty/SDL2/src/core/unix/SDL_poll.h34
-rw-r--r--src/3rdparty/SDL2/src/core/windows/SDL_directx.h111
-rw-r--r--src/3rdparty/SDL2/src/core/windows/SDL_windows.c230
-rw-r--r--src/3rdparty/SDL2/src/core/windows/SDL_windows.h75
-rw-r--r--src/3rdparty/SDL2/src/core/windows/SDL_xinput.c139
-rw-r--r--src/3rdparty/SDL2/src/core/windows/SDL_xinput.h177
-rw-r--r--src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.cpp66
-rw-r--r--src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.h31
-rw-r--r--src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp855
-rw-r--r--src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h92
-rw-r--r--src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp160
-rw-r--r--src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.h33
-rw-r--r--src/3rdparty/SDL2/src/cpuinfo/SDL_cpuinfo.c777
-rw-r--r--src/3rdparty/SDL2/src/dynapi/SDL_dynapi.c325
-rw-r--r--src/3rdparty/SDL2/src/dynapi/SDL_dynapi.h67
-rw-r--r--src/3rdparty/SDL2/src/dynapi/SDL_dynapi_overrides.h671
-rw-r--r--src/3rdparty/SDL2/src/dynapi/SDL_dynapi_procs.h709
-rw-r--r--src/3rdparty/SDL2/src/dynapi/gendynapi.pl141
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_clipboardevents.c46
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_clipboardevents_c.h30
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_dropevents.c98
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_dropevents_c.h32
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_events.c955
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_events_c.h49
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_gesture.c700
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_gesture_c.h35
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_keyboard.c1033
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_keyboard_c.h70
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_mouse.c1027
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_mouse_c.h141
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_quit.c152
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_sysevents.h36
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_touch.c375
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_touch_c.h61
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_windowevents.c228
-rw-r--r--src/3rdparty/SDL2/src/events/SDL_windowevents_c.h31
-rw-r--r--src/3rdparty/SDL2/src/events/blank_cursor.h33
-rw-r--r--src/3rdparty/SDL2/src/events/default_cursor.h114
-rw-r--r--src/3rdparty/SDL2/src/events/scancodes_darwin.h159
-rw-r--r--src/3rdparty/SDL2/src/events/scancodes_linux.h263
-rw-r--r--src/3rdparty/SDL2/src/events/scancodes_windows.h55
-rw-r--r--src/3rdparty/SDL2/src/events/scancodes_xfree86.h506
-rw-r--r--src/3rdparty/SDL2/src/file/SDL_rwops.c867
-rw-r--r--src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h30
-rw-r--r--src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m62
-rw-r--r--src/3rdparty/SDL2/src/filesystem/android/SDL_sysfilesystem.c62
-rw-r--r--src/3rdparty/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m117
-rw-r--r--src/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c47
-rw-r--r--src/3rdparty/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c81
-rw-r--r--src/3rdparty/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc110
-rw-r--r--src/3rdparty/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c43
-rw-r--r--src/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c250
-rw-r--r--src/3rdparty/SDL2/src/filesystem/windows/SDL_sysfilesystem.c192
-rw-r--r--src/3rdparty/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp233
-rw-r--r--src/3rdparty/SDL2/src/haptic/SDL_haptic.c849
-rw-r--r--src/3rdparty/SDL2/src/haptic/SDL_haptic_c.h25
-rw-r--r--src/3rdparty/SDL2/src/haptic/SDL_syshaptic.h208
-rw-r--r--src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic.c357
-rw-r--r--src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic_c.h12
-rw-r--r--src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic.c1417
-rw-r--r--src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic_c.h26
-rw-r--r--src/3rdparty/SDL2/src/haptic/dummy/SDL_syshaptic.c186
-rw-r--r--src/3rdparty/SDL2/src/haptic/linux/SDL_syshaptic.c1162
-rw-r--r--src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic.c1305
-rw-r--r--src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h47
-rw-r--r--src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic.c449
-rw-r--r--src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic_c.h88
-rw-r--r--src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic.c487
-rw-r--r--src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h47
-rw-r--r--src/3rdparty/SDL2/src/joystick/SDL_gamecontroller.c1871
-rw-r--r--src/3rdparty/SDL2/src/joystick/SDL_gamecontrollerdb.h232
-rw-r--r--src/3rdparty/SDL2/src/joystick/SDL_joystick.c1276
-rw-r--r--src/3rdparty/SDL2/src/joystick/SDL_joystick_c.h62
-rw-r--r--src/3rdparty/SDL2/src/joystick/SDL_sysjoystick.h136
-rw-r--r--src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick.c687
-rw-r--r--src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick_c.h61
-rw-r--r--src/3rdparty/SDL2/src/joystick/bsd/SDL_sysjoystick.c691
-rw-r--r--src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick.c837
-rw-r--r--src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h73
-rw-r--r--src/3rdparty/SDL2/src/joystick/dummy/SDL_sysjoystick.c127
-rw-r--r--src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick.c403
-rw-r--r--src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h52
-rw-r--r--src/3rdparty/SDL2/src/joystick/haiku/SDL_haikujoystick.cc266
-rw-r--r--src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m795
-rw-r--r--src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h59
-rw-r--r--src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick.c1049
-rw-r--r--src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick_c.h60
-rw-r--r--src/3rdparty/SDL2/src/joystick/psp/SDL_sysjoystick.c270
-rw-r--r--src/3rdparty/SDL2/src/joystick/sort_controllers.py66
-rw-r--r--src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.c52
-rw-r--r--src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.h33
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick.c992
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h30
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_mmjoystick.c461
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick.c548
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h93
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick.c522
-rw-r--r--src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h33
-rw-r--r--src/3rdparty/SDL2/src/libm/e_atan2.c134
-rw-r--r--src/3rdparty/SDL2/src/libm/e_fmod.c144
-rw-r--r--src/3rdparty/SDL2/src/libm/e_log.c152
-rw-r--r--src/3rdparty/SDL2/src/libm/e_log10.c106
-rw-r--r--src/3rdparty/SDL2/src/libm/e_pow.c343
-rw-r--r--src/3rdparty/SDL2/src/libm/e_rem_pio2.c161
-rw-r--r--src/3rdparty/SDL2/src/libm/e_sqrt.c457
-rw-r--r--src/3rdparty/SDL2/src/libm/k_cos.c82
-rw-r--r--src/3rdparty/SDL2/src/libm/k_rem_pio2.c299
-rw-r--r--src/3rdparty/SDL2/src/libm/k_sin.c65
-rw-r--r--src/3rdparty/SDL2/src/libm/k_tan.c118
-rw-r--r--src/3rdparty/SDL2/src/libm/math_libm.h40
-rw-r--r--src/3rdparty/SDL2/src/libm/math_private.h226
-rw-r--r--src/3rdparty/SDL2/src/libm/s_atan.c114
-rw-r--r--src/3rdparty/SDL2/src/libm/s_copysign.c29
-rw-r--r--src/3rdparty/SDL2/src/libm/s_cos.c73
-rw-r--r--src/3rdparty/SDL2/src/libm/s_fabs.c29
-rw-r--r--src/3rdparty/SDL2/src/libm/s_floor.c71
-rw-r--r--src/3rdparty/SDL2/src/libm/s_scalbn.c69
-rw-r--r--src/3rdparty/SDL2/src/libm/s_sin.c73
-rw-r--r--src/3rdparty/SDL2/src/libm/s_tan.c67
-rw-r--r--src/3rdparty/SDL2/src/loadso/dlopen/SDL_sysloadso.c88
-rw-r--r--src/3rdparty/SDL2/src/loadso/dummy/SDL_sysloadso.c54
-rw-r--r--src/3rdparty/SDL2/src/loadso/windows/SDL_sysloadso.c80
-rw-r--r--src/3rdparty/SDL2/src/main/android/SDL_android_main.c7
-rw-r--r--src/3rdparty/SDL2/src/main/dummy/SDL_dummy_main.c28
-rw-r--r--src/3rdparty/SDL2/src/main/haiku/SDL_BApp.h399
-rw-r--r--src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.cc157
-rw-r--r--src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.h38
-rw-r--r--src/3rdparty/SDL2/src/main/nacl/SDL_nacl_main.c93
-rw-r--r--src/3rdparty/SDL2/src/main/psp/SDL_psp_main.c70
-rw-r--r--src/3rdparty/SDL2/src/main/windows/SDL_windows_main.c207
-rw-r--r--src/3rdparty/SDL2/src/main/windows/version.rc38
-rw-r--r--src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResource_BlankCursor.curbin0 -> 326 bytes
-rw-r--r--src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResources.rc3
-rw-r--r--src/3rdparty/SDL2/src/main/winrt/SDL_winrt_main_NonXAML.cpp54
-rw-r--r--src/3rdparty/SDL2/src/power/SDL_power.c116
-rw-r--r--src/3rdparty/SDL2/src/power/SDL_syspower.h47
-rw-r--r--src/3rdparty/SDL2/src/power/android/SDL_syspower.c64
-rw-r--r--src/3rdparty/SDL2/src/power/emscripten/SDL_syspower.c62
-rw-r--r--src/3rdparty/SDL2/src/power/haiku/SDL_syspower.c128
-rw-r--r--src/3rdparty/SDL2/src/power/linux/SDL_syspower.c642
-rw-r--r--src/3rdparty/SDL2/src/power/macosx/SDL_syspower.c192
-rw-r--r--src/3rdparty/SDL2/src/power/psp/SDL_syspower.c68
-rw-r--r--src/3rdparty/SDL2/src/power/uikit/SDL_syspower.h32
-rw-r--r--src/3rdparty/SDL2/src/power/uikit/SDL_syspower.m113
-rw-r--r--src/3rdparty/SDL2/src/power/windows/SDL_syspower.c76
-rw-r--r--src/3rdparty/SDL2/src/power/winrt/SDL_syspower.cpp44
-rw-r--r--src/3rdparty/SDL2/src/render/SDL_d3dmath.c136
-rw-r--r--src/3rdparty/SDL2/src/render/SDL_d3dmath.h72
-rw-r--r--src/3rdparty/SDL2/src/render/SDL_render.c2234
-rw-r--r--src/3rdparty/SDL2/src/render/SDL_sysrender.h204
-rw-r--r--src/3rdparty/SDL2/src/render/SDL_yuv_sw.c414
-rw-r--r--src/3rdparty/SDL2/src/render/SDL_yuv_sw_c.h67
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d/SDL_render_d3d.c1825
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.c274
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.h34
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d11/SDL_render_d3d11.c2570
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.cpp116
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.h40
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c1957
-rw-r--r--src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h43
-rw-r--r--src/3rdparty/SDL2/src/render/metal/SDL_render_metal.m1429
-rw-r--r--src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal.metal109
-rw-r--r--src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_ios.h1899
-rw-r--r--src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_osx.h1903
-rw-r--r--src/3rdparty/SDL2/src/render/metal/build-metal-shaders.sh18
-rw-r--r--src/3rdparty/SDL2/src/render/opengl/SDL_glfuncs.h478
-rw-r--r--src/3rdparty/SDL2/src/render/opengl/SDL_render_gl.c1690
-rw-r--r--src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.c524
-rw-r--r--src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.h47
-rw-r--r--src/3rdparty/SDL2/src/render/opengles/SDL_glesfuncs.h65
-rw-r--r--src/3rdparty/SDL2/src/render/opengles/SDL_render_gles.c1290
-rw-r--r--src/3rdparty/SDL2/src/render/opengles2/SDL_gles2funcs.h80
-rw-r--r--src/3rdparty/SDL2/src/render/opengles2/SDL_render_gles2.c2258
-rw-r--r--src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.c569
-rw-r--r--src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.h70
-rw-r--r--src/3rdparty/SDL2/src/render/psp/SDL_render_psp.c1028
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.c336
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.h27
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_blendline.c777
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_blendline.h27
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_blendpoint.c341
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_blendpoint.h27
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_draw.h576
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_drawline.c209
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_drawline.h27
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_drawpoint.c114
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_drawpoint.h27
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_render_sw.c894
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_render_sw_c.h24
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_rotate.c530
-rw-r--r--src/3rdparty/SDL2/src/render/software/SDL_rotate.h28
-rw-r--r--src/3rdparty/SDL2/src/stdlib/SDL_getenv.c315
-rw-r--r--src/3rdparty/SDL2/src/stdlib/SDL_iconv.c934
-rw-r--r--src/3rdparty/SDL2/src/stdlib/SDL_malloc.c5376
-rw-r--r--src/3rdparty/SDL2/src/stdlib/SDL_qsort.c534
-rw-r--r--src/3rdparty/SDL2/src/stdlib/SDL_stdlib.c1131
-rw-r--r--src/3rdparty/SDL2/src/stdlib/SDL_string.c1715
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_assert.c152
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_common.c1783
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_compare.c117
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_crc32.c166
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_font.c3250
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_fuzzer.c534
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_harness.c680
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_imageBlit.c1559
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_imageBlitBlend.c2845
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_imageFace.c247
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_imagePrimitives.c514
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_imagePrimitivesBlend.c696
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_log.c118
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_md5.c338
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_memory.c274
-rw-r--r--src/3rdparty/SDL2/src/test/SDL_test_random.c96
-rw-r--r--src/3rdparty/SDL2/src/thread/SDL_systhread.h70
-rw-r--r--src/3rdparty/SDL2/src/thread/SDL_thread.c503
-rw-r--r--src/3rdparty/SDL2/src/thread/SDL_thread_c.h95
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_syscond.c220
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex.c165
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex_c.h22
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_syssem.c217
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_systhread.c71
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_systhread_c.h26
-rw-r--r--src/3rdparty/SDL2/src/thread/generic/SDL_systls.c38
-rw-r--r--src/3rdparty/SDL2/src/thread/psp/SDL_syscond.c224
-rw-r--r--src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex.c136
-rw-r--r--src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex_c.h22
-rw-r--r--src/3rdparty/SDL2/src/thread/psp/SDL_syssem.c161
-rw-r--r--src/3rdparty/SDL2/src/thread/psp/SDL_systhread.c112
-rw-r--r--src/3rdparty/SDL2/src/thread/psp/SDL_systhread_c.h24
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_syscond.c158
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex.c192
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex_c.h32
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_syssem.c209
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_systhread.c246
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_systhread_c.h27
-rw-r--r--src/3rdparty/SDL2/src/thread/pthread/SDL_systls.c70
-rw-r--r--src/3rdparty/SDL2/src/thread/stdcpp/SDL_syscond.cpp164
-rw-r--r--src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp111
-rw-r--r--src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h30
-rw-r--r--src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread.cpp168
-rw-r--r--src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread_c.h26
-rw-r--r--src/3rdparty/SDL2/src/thread/windows/SDL_sysmutex.c110
-rw-r--r--src/3rdparty/SDL2/src/thread/windows/SDL_syssem.c152
-rw-r--r--src/3rdparty/SDL2/src/thread/windows/SDL_systhread.c258
-rw-r--r--src/3rdparty/SDL2/src/thread/windows/SDL_systhread_c.h32
-rw-r--r--src/3rdparty/SDL2/src/thread/windows/SDL_systls.c72
-rw-r--r--src/3rdparty/SDL2/src/timer/SDL_timer.c373
-rw-r--r--src/3rdparty/SDL2/src/timer/SDL_timer_c.h34
-rw-r--r--src/3rdparty/SDL2/src/timer/dummy/SDL_systimer.c75
-rw-r--r--src/3rdparty/SDL2/src/timer/haiku/SDL_systimer.c80
-rw-r--r--src/3rdparty/SDL2/src/timer/psp/SDL_systimer.c91
-rw-r--r--src/3rdparty/SDL2/src/timer/unix/SDL_systimer.c232
-rw-r--r--src/3rdparty/SDL2/src/timer/windows/SDL_systimer.c200
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_RLEaccel.c1581
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_RLEaccel_c.h31
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit.c296
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit.h553
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_0.c483
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_1.c552
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_A.c1388
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_N.c2647
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_auto.c7419
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_auto.h30
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_copy.c162
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_copy.h24
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_slow.c164
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_blit_slow.h25
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_bmp.c702
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_clipboard.c90
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_egl.c838
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_egl_c.h149
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_fillrect.c343
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_pixels.c1125
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_pixels_c.h40
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_rect.c531
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_rect_c.h25
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_shape.c309
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_shape_internals.h69
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_stretch.c353
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_surface.c1232
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_sysvideo.h459
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_video.c4077
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_vulkan_internal.h91
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_vulkan_utils.c172
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_yuv.c1834
-rw-r--r--src/3rdparty/SDL2/src/video/SDL_yuv_c.h30
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.c48
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.h32
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidevents.c123
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidevents.h27
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidgl.c62
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidgl.h34
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.c391
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.h36
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.c37
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.h29
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidmouse.c117
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidmouse.h32
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidtouch.c151
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidtouch.h29
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidvideo.c254
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidvideo.h49
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.c175
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.h52
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidwindow.c152
-rw-r--r--src/3rdparty/SDL2/src/video/android/SDL_androidwindow.h45
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.h36
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.m103
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.h32
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.m483
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.h36
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.m720
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.h29
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.m145
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.h63
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.m135
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.h46
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.m490
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.h52
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.m467
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.h34
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.m279
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.h68
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.m428
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.h49
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.m132
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.h45
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.m113
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.h118
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.m253
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.h55
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.m231
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.h154
-rw-r--r--src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.m1877
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.c413
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.h56
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.c117
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.h41
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.c748
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.h34
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.c414
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.h59
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.c389
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.h44
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.c332
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.h64
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.c1335
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.h25
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.c131
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.h38
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.c418
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.h170
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.c565
-rw-r--r--src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.h82
-rw-r--r--src/3rdparty/SDL2/src/video/dummy/SDL_nullevents.c41
-rw-r--r--src/3rdparty/SDL2/src/video/dummy/SDL_nullevents_c.h27
-rw-r--r--src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer.c89
-rw-r--r--src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer_c.h27
-rw-r--r--src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.c144
-rw-r--r--src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.h30
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.c716
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.h40
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c178
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h32
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.c274
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.h42
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.c119
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.h49
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.c354
-rw-r--r--src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.h58
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_BWin.h679
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.cc95
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.h33
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bevents.cc41
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bevents.h39
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.cc259
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.h47
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.cc190
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.h44
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.cc333
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.h48
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.cc176
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.h55
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.cc178
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.h44
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.cc233
-rw-r--r--src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.h55
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/EGL/egl.h303
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/EGL/eglext.h1241
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/EGL/eglplatform.h132
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/GLES2/gl2.h675
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/GLES2/gl2ext.h3505
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/GLES2/gl2platform.h38
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/KHR/khrplatform.h284
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/vulkan/vk_platform.h120
-rw-r--r--src/3rdparty/SDL2/src/video/khronos/vulkan/vulkan.h6458
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c171
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h53
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c42
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h31
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c501
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h45
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c189
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h48
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h99
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c664
-rw-r--r--src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h124
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.c170
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.h53
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirevents.c321
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirevents.h37
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.c134
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.h47
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.c292
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.h37
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_miropengl.c78
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_miropengl.h53
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirsym.h143
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.c423
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.h49
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.c176
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.h52
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.c374
-rw-r--r--src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.h93
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclevents.c438
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclevents_c.h30
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclglue.c24
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.c174
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.h38
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.c183
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.h67
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.c79
-rw-r--r--src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.h32
-rw-r--r--src/3rdparty/SDL2/src/video/pandora/SDL_pandora.c838
-rw-r--r--src/3rdparty/SDL2/src/video/pandora/SDL_pandora.h101
-rw-r--r--src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.c38
-rw-r--r--src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.h25
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspevents.c290
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspevents_c.h31
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspgl.c210
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspgl_c.h54
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspmouse.c41
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspmouse_c.h24
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.c333
-rw-r--r--src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.h102
-rw-r--r--src/3rdparty/SDL2/src/video/qnx/gl.c285
-rw-r--r--src/3rdparty/SDL2/src/video/qnx/keyboard.c133
-rw-r--r--src/3rdparty/SDL2/src/video/qnx/sdl_qnx.h48
-rw-r--r--src/3rdparty/SDL2/src/video/qnx/video.c364
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents.c45
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents_c.h31
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.c386
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.h43
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.c71
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.h49
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.c442
-rw-r--r--src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.h104
-rw-r--r--src/3rdparty/SDL2/src/video/sdlgenblit.pl535
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.h47
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.m539
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.h35
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.m111
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.h30
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.m73
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.h31
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.m206
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.h58
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.m124
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.h50
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.m324
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.h40
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.m250
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.h60
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.m384
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.h46
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.m238
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.h41
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.m328
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.h91
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.m532
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.h54
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.m222
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.h56
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.m465
-rw-r--r--src/3rdparty/SDL2/src/video/uikit/keyinfotable.h174
-rw-r--r--src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.c47
-rw-r--r--src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.h48
-rw-r--r--src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.c54
-rw-r--r--src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.h47
-rw-r--r--src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.c409
-rw-r--r--src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.h91
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.c123
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.h32
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.c468
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.h103
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.c178
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.h107
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents.c1129
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents_c.h51
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.c396
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.h31
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.c93
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.h49
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandsym.h127
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.c265
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.h352
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.c499
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.h75
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.c176
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.h52
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.c552
-rw-r--r--src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.h78
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_msctf.h242
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_vkeys.h76
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.c160
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.h36
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.c1204
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.h36
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.c127
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.h27
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.c1579
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.h40
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.c496
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.h29
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.c407
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.h47
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.c322
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.h33
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.c895
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.h142
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.c131
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.h49
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.c110
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.h40
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.c441
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.h199
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.c176
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.h52
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.c970
-rw-r--r--src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.h84
-rw-r--r--src/3rdparty/SDL2/src/video/windows/wmmsg.h1052
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents.cpp154
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents_c.h82
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar.cpp196
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h35
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp430
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp112
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.h29
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse.cpp224
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse_c.h40
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.cpp203
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.h70
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp415
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo.cpp842
-rw-r--r--src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h106
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.c199
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.h33
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.c212
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.h111
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11events.c1500
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11events.h31
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.c257
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.h31
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.c549
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.h36
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.c853
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.h28
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11modes.c1112
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11modes.h85
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.c448
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.h31
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.c946
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.h84
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.c109
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.h56
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11shape.c115
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11shape.h39
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11sym.h337
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11touch.c54
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11touch.h32
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11video.c496
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11video.h156
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.c243
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.h48
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11window.c1609
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11window.h110
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.c313
-rw-r--r--src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.h42
-rw-r--r--src/3rdparty/SDL2/src/video/x11/edid-parse.c754
-rw-r--r--src/3rdparty/SDL2/src/video/x11/edid.h167
-rw-r--r--src/3rdparty/SDL2/src/video/x11/imKStoUCS.c350
-rw-r--r--src/3rdparty/SDL2/src/video/x11/imKStoUCS.h32
-rw-r--r--src/3rdparty/SDL2/src/video/yuv2rgb/LICENSE27
-rw-r--r--src/3rdparty/SDL2/src/video/yuv2rgb/README.md63
-rw-r--r--src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.c687
-rw-r--r--src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.h381
-rw-r--r--src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h498
-rw-r--r--src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h220
-rw-r--r--src/3rdparty/buildvm/buildvm-post.bat17
-rw-r--r--src/3rdparty/buildvm/buildvm.exebin0 -> 121856 bytes
-rw-r--r--src/3rdparty/minilua/minilua-post.bat6
-rw-r--r--src/3rdparty/minilua/minilua.exebin0 -> 209920 bytes
-rw-r--r--src/3rdparty/ogl/OpenGL.h184
-rw-r--r--src/3rdparty/smount/dirent.h (renamed from src/libjin/3rdparty/smount/dirent.h)0
-rw-r--r--src/3rdparty/smount/smount.c (renamed from src/libjin/3rdparty/smount/smount.c)0
-rw-r--r--src/3rdparty/smount/smount.h (renamed from src/libjin/3rdparty/smount/smount.h)0
-rw-r--r--src/3rdparty/stb/stb_image.h (renamed from src/libjin/3rdparty/stb/stb_image.h)0
-rw-r--r--src/3rdparty/stb/stb_truetype.h (renamed from src/libjin/3rdparty/stb/stb_truetype.h)0
-rw-r--r--src/3rdparty/stb/stb_vorbis.c (renamed from src/libjin/3rdparty/stb/stb_vorbis.c)0
-rw-r--r--src/3rdparty/tekcos/README (renamed from src/libjin/3rdparty/tekcos/README)0
-rw-r--r--src/3rdparty/tekcos/tekcos.c (renamed from src/libjin/3rdparty/tekcos/tekcos.c)0
-rw-r--r--src/3rdparty/tekcos/tekcos.h (renamed from src/libjin/3rdparty/tekcos/tekcos.h)0
-rw-r--r--src/3rdparty/wav/wav.c (renamed from src/libjin/3rdparty/wav/wav.c)0
-rw-r--r--src/3rdparty/wav/wav.h (renamed from src/libjin/3rdparty/wav/wav.h)0
-rw-r--r--src/jin/main.cpp107
-rw-r--r--src/libjin/3rdparty/base64/base64.h186
-rw-r--r--src/libjin/3rdparty/ogl/OpenGL.h520
-rw-r--r--src/libjin/Audio/SDL/je_sdl_audio.cpp251
-rw-r--r--src/libjin/Audio/SDL/je_sdl_audio.h237
-rw-r--r--src/libjin/Audio/SDL/je_sdl_source.cpp732
-rw-r--r--src/libjin/Audio/SDL/je_sdl_source.h487
-rw-r--r--src/libjin/Audio/je_audio_manager.h6
-rw-r--r--src/libjin/Audio/je_source.h6
-rw-r--r--src/libjin/Common/je_array.hpp4
-rw-r--r--src/libjin/Common/je_common.h5
-rw-r--r--src/libjin/Common/je_exception.cpp46
-rw-r--r--src/libjin/Common/je_exception.h35
-rw-r--r--src/libjin/Common/je_noncopyable.h4
-rw-r--r--src/libjin/Common/je_object.h6
-rw-r--r--src/libjin/Common/je_pool.hpp172
-rw-r--r--src/libjin/Common/je_singleton.hpp6
-rw-r--r--src/libjin/Common/je_stringmap.hpp4
-rw-r--r--src/libjin/Common/je_subsystem.hpp4
-rw-r--r--src/libjin/Common/je_temporary.h4
-rw-r--r--src/libjin/Common/je_types.h4
-rw-r--r--src/libjin/Common/je_utf8.h6
-rw-r--r--src/libjin/Filesystem/je_asset_database.cpp14
-rw-r--r--src/libjin/Filesystem/je_asset_database.h10
-rw-r--r--src/libjin/Filesystem/je_buffer.h4
-rw-r--r--src/libjin/Game/je_application.cpp79
-rw-r--r--src/libjin/Game/je_application.h88
-rw-r--r--src/libjin/Game/je_entity.cpp11
-rw-r--r--src/libjin/Game/je_entity.h64
-rw-r--r--src/libjin/Game/je_game.cpp79
-rw-r--r--src/libjin/Game/je_game.h88
-rw-r--r--src/libjin/Game/je_gameobject.cpp11
-rw-r--r--src/libjin/Game/je_gameobject.h86
-rw-r--r--src/libjin/Game/je_scene.h12
-rw-r--r--src/libjin/Graphics/Font/je_decoder.cpp93
-rw-r--r--src/libjin/Graphics/Font/je_decoder.h94
-rw-r--r--src/libjin/Graphics/Font/je_font.h100
-rw-r--r--src/libjin/Graphics/Font/je_page.h51
-rw-r--r--src/libjin/Graphics/Font/je_text.cpp154
-rw-r--r--src/libjin/Graphics/Font/je_text.h169
-rw-r--r--src/libjin/Graphics/Font/je_texture_font.cpp318
-rw-r--r--src/libjin/Graphics/Font/je_texture_font.h140
-rw-r--r--src/libjin/Graphics/Font/je_ttf.cpp463
-rw-r--r--src/libjin/Graphics/Font/je_ttf.h288
-rw-r--r--src/libjin/Graphics/Shader/je_base.shader.h88
-rw-r--r--src/libjin/Graphics/Shader/je_jsl_compiler.cpp54
-rw-r--r--src/libjin/Graphics/Shader/je_jsl_compiler.h42
-rw-r--r--src/libjin/Graphics/Shader/je_shader.cpp278
-rw-r--r--src/libjin/Graphics/Shader/je_shader.h200
-rw-r--r--src/libjin/Graphics/animation/je_animation.h20
-rw-r--r--src/libjin/Graphics/animation/je_clip.h20
-rw-r--r--src/libjin/Graphics/animations/je_animation.cpp14
-rw-r--r--src/libjin/Graphics/animations/je_animation.h64
-rw-r--r--src/libjin/Graphics/animations/je_animator.cpp14
-rw-r--r--src/libjin/Graphics/animations/je_animator.h50
-rw-r--r--src/libjin/Graphics/fonts/je_decoder.cpp96
-rw-r--r--src/libjin/Graphics/fonts/je_decoder.h97
-rw-r--r--src/libjin/Graphics/fonts/je_font.h109
-rw-r--r--src/libjin/Graphics/fonts/je_page.h54
-rw-r--r--src/libjin/Graphics/fonts/je_text.cpp157
-rw-r--r--src/libjin/Graphics/fonts/je_text.h172
-rw-r--r--src/libjin/Graphics/fonts/je_texture_font.cpp322
-rw-r--r--src/libjin/Graphics/fonts/je_texture_font.h144
-rw-r--r--src/libjin/Graphics/fonts/je_ttf.cpp468
-rw-r--r--src/libjin/Graphics/fonts/je_ttf.h292
-rw-r--r--src/libjin/Graphics/je_bitmap.cpp42
-rw-r--r--src/libjin/Graphics/je_bitmap.h21
-rw-r--r--src/libjin/Graphics/je_canvas.cpp15
-rw-r--r--src/libjin/Graphics/je_canvas.h9
-rw-r--r--src/libjin/Graphics/je_color.cpp5
-rw-r--r--src/libjin/Graphics/je_color.h32
-rw-r--r--src/libjin/Graphics/je_gl.cpp80
-rw-r--r--src/libjin/Graphics/je_gl.h46
-rw-r--r--src/libjin/Graphics/je_graphic.cpp96
-rw-r--r--src/libjin/Graphics/je_graphic.h52
-rw-r--r--src/libjin/Graphics/je_graphics.h30
-rw-r--r--src/libjin/Graphics/je_image.cpp3
-rw-r--r--src/libjin/Graphics/je_image.h7
-rw-r--r--src/libjin/Graphics/je_mesh.h12
-rw-r--r--src/libjin/Graphics/je_shapes.cpp32
-rw-r--r--src/libjin/Graphics/je_shapes.h10
-rw-r--r--src/libjin/Graphics/je_sprite.cpp145
-rw-r--r--src/libjin/Graphics/je_sprite.h73
-rw-r--r--src/libjin/Graphics/je_sprite_batch.cpp11
-rw-r--r--src/libjin/Graphics/je_sprite_batch.h9
-rw-r--r--src/libjin/Graphics/je_sprite_sheet.cpp22
-rw-r--r--src/libjin/Graphics/je_sprite_sheet.h33
-rw-r--r--src/libjin/Graphics/je_texture.h11
-rw-r--r--src/libjin/Graphics/je_window.cpp43
-rw-r--r--src/libjin/Graphics/je_window.h14
-rw-r--r--src/libjin/Graphics/particle/je_particle.h21
-rw-r--r--src/libjin/Graphics/particle/je_particle_batch.h20
-rw-r--r--src/libjin/Graphics/particle/je_particle_emitter.cpp11
-rw-r--r--src/libjin/Graphics/particle/je_particle_emitter.h23
-rw-r--r--src/libjin/Graphics/particles/je_particle.cpp26
-rw-r--r--src/libjin/Graphics/particles/je_particle.h178
-rw-r--r--src/libjin/Graphics/particles/je_particle_emitter.cpp42
-rw-r--r--src/libjin/Graphics/particles/je_particle_emitter.h112
-rw-r--r--src/libjin/Graphics/particles/je_particle_pool.h24
-rw-r--r--src/libjin/Graphics/particles/je_particle_system.cpp11
-rw-r--r--src/libjin/Graphics/particles/je_particle_system.h103
-rw-r--r--src/libjin/Graphics/shaders/built-in/je_default.shader.h (renamed from src/libjin/Graphics/Shader/je_default.shader.h)0
-rw-r--r--src/libjin/Graphics/shaders/built-in/je_font.shader.h (renamed from src/libjin/Graphics/Shader/je_font.shader.h)0
-rw-r--r--src/libjin/Graphics/shaders/built-in/je_texture.shader.h (renamed from src/libjin/Graphics/Shader/je_texture.shader.h)0
-rw-r--r--src/libjin/Graphics/shaders/je_base.shader.h89
-rw-r--r--src/libjin/Graphics/shaders/je_jsl_compiler.cpp57
-rw-r--r--src/libjin/Graphics/shaders/je_jsl_compiler.h45
-rw-r--r--src/libjin/Graphics/shaders/je_shader.cpp281
-rw-r--r--src/libjin/Graphics/shaders/je_shader.h201
-rw-r--r--src/libjin/Input/je_event.h6
-rw-r--r--src/libjin/Input/je_input.h4
-rw-r--r--src/libjin/Input/je_joypad.h6
-rw-r--r--src/libjin/Input/je_keyboard.h6
-rw-r--r--src/libjin/Input/je_mouse.h6
-rw-r--r--src/libjin/Math/je_bezier_curve.cpp (renamed from src/libjin/Graphics/animation/je_animation.cpp)0
-rw-r--r--src/libjin/Math/je_bezier_curve.h17
-rw-r--r--src/libjin/Math/je_constant.h4
-rw-r--r--src/libjin/Math/je_ellipse.cpp (renamed from src/libjin/Graphics/animation/je_clip.cpp)0
-rw-r--r--src/libjin/Math/je_ellipse.h (renamed from src/libjin/Graphics/particle/je_particle.cpp)0
-rw-r--r--src/libjin/Math/je_math.h12
-rw-r--r--src/libjin/Math/je_matrix.h6
-rw-r--r--src/libjin/Math/je_quad.h6
-rw-r--r--src/libjin/Math/je_random.cpp13
-rw-r--r--src/libjin/Math/je_random.h22
-rw-r--r--src/libjin/Math/je_vector2.hpp16
-rw-r--r--src/libjin/Math/je_vector3.hpp4
-rw-r--r--src/libjin/Math/je_vector4.hpp4
-rw-r--r--src/libjin/Net/je_net_manager.h6
-rw-r--r--src/libjin/Net/je_socket.h8
-rw-r--r--src/libjin/README.md4
-rw-r--r--src/libjin/Time/je_timer.cpp98
-rw-r--r--src/libjin/Time/je_timer.h88
-rw-r--r--src/libjin/Utils/je_log.cpp81
-rw-r--r--src/libjin/Utils/je_log.h106
-rw-r--r--src/libjin/Utils/je_macros.h4
-rw-r--r--src/libjin/Utils/je_utils.h4
-rw-r--r--src/libjin/ai/je_ai.h10
-rw-r--r--src/libjin/ai/je_behavior_tree.h45
-rw-r--r--src/libjin/ai/je_state_machine.cpp445
-rw-r--r--src/libjin/ai/je_state_machine.h401
-rw-r--r--src/libjin/core/je_configuration.h11
-rw-r--r--src/libjin/core/je_version.h6
-rw-r--r--src/libjin/jin.h11
-rw-r--r--src/libjin/multithread/je_thread.cpp301
-rw-r--r--src/libjin/multithread/je_thread.h167
-rw-r--r--src/libjin/threads/je_thread.cpp301
-rw-r--r--src/libjin/threads/je_thread.h167
-rw-r--r--src/lua/common/Proxy.h67
-rw-r--r--src/lua/common/Reference.hpp88
-rw-r--r--src/lua/common/common.h8
-rw-r--r--src/lua/common/constant.h1
-rw-r--r--src/lua/common/error.h28
-rw-r--r--src/lua/common/je_lua_callback.cpp43
-rw-r--r--src/lua/common/je_lua_callback.h67
-rw-r--r--src/lua/common/je_lua_common.h10
-rw-r--r--src/lua/common/je_lua_constant.h (renamed from src/libjin/Graphics/particle/je_particle_system.cpp)0
-rw-r--r--src/lua/common/je_lua_error.h28
-rw-r--r--src/lua/common/je_lua_function.cpp (renamed from src/libjin/Graphics/particle/je_particle_batch.cpp)0
-rw-r--r--src/lua/common/je_lua_function.h6
-rw-r--r--src/lua/common/je_lua_port.h8
-rw-r--r--src/lua/common/je_lua_proxy.h72
-rw-r--r--src/lua/common/je_lua_reference.cpp31
-rw-r--r--src/lua/common/je_lua_reference.h54
-rw-r--r--src/lua/common/je_lua_shared.hpp151
-rw-r--r--src/lua/embed/boot.lua.h175
-rw-r--r--src/lua/embed/embed.h46
-rw-r--r--src/lua/embed/graphics.lua.h46
-rw-r--r--src/lua/embed/keyboard.lua.h15
-rw-r--r--src/lua/embed/mouse.lua.h14
-rw-r--r--src/lua/embed/net.lua.h4
-rw-r--r--src/lua/embed/path.lua.h14
-rw-r--r--src/lua/embed/scripts/ai.lua.h26
-rw-r--r--src/lua/embed/scripts/boot.lua.h139
-rw-r--r--src/lua/embed/scripts/graphics.lua.h73
-rw-r--r--src/lua/embed/scripts/keyboard.lua.h17
-rw-r--r--src/lua/embed/scripts/mouse.lua.h16
-rw-r--r--src/lua/embed/scripts/net.lua.h7
-rw-r--r--src/lua/embed/scripts/path.lua.h16
-rw-r--r--src/lua/jin.cpp94
-rw-r--r--src/lua/jin.h5
-rw-r--r--src/lua/libraries/luax/luax.h26
-rw-r--r--src/lua/main.cpp44
-rw-r--r--src/lua/modules/ai/je_lua_ai.cpp13
-rw-r--r--src/lua/modules/ai/je_lua_ai.h7
-rw-r--r--src/lua/modules/ai/je_lua_behavior_tree.cpp11
-rw-r--r--src/lua/modules/ai/je_lua_behavior_tree.h14
-rw-r--r--src/lua/modules/ai/je_lua_state_machine.cpp25
-rw-r--r--src/lua/modules/ai/je_lua_state_machine.h14
-rw-r--r--src/lua/modules/audio/audio.cpp123
-rw-r--r--src/lua/modules/audio/je_lua_audio.cpp135
-rw-r--r--src/lua/modules/audio/je_lua_audio.h6
-rw-r--r--src/lua/modules/audio/je_lua_source.cpp117
-rw-r--r--src/lua/modules/audio/je_lua_source.h16
-rw-r--r--src/lua/modules/audio/source.cpp116
-rw-r--r--src/lua/modules/bit/bit.cpp84
-rw-r--r--src/lua/modules/bit/je_lua_bit.cpp87
-rw-r--r--src/lua/modules/bit/je_lua_bit.h (renamed from src/libjin/Graphics/particle/je_particle_system.h)0
-rw-r--r--src/lua/modules/core/core.cpp46
-rw-r--r--src/lua/modules/core/je_lua_core.cpp46
-rw-r--r--src/lua/modules/core/je_lua_core.h0
-rw-r--r--src/lua/modules/event/event.cpp130
-rw-r--r--src/lua/modules/event/je_lua_event.cpp130
-rw-r--r--src/lua/modules/event/je_lua_event.h0
-rw-r--r--src/lua/modules/filesystem/filesystem.cpp140
-rw-r--r--src/lua/modules/filesystem/je_lua_filesystem.cpp141
-rw-r--r--src/lua/modules/filesystem/je_lua_filesystem.h0
-rw-r--r--src/lua/modules/graphics/bitmap.cpp113
-rw-r--r--src/lua/modules/graphics/canvas.cpp65
-rw-r--r--src/lua/modules/graphics/graphics.cpp819
-rw-r--r--src/lua/modules/graphics/je_lua_bitmap.cpp114
-rw-r--r--src/lua/modules/graphics/je_lua_bitmap.h16
-rw-r--r--src/lua/modules/graphics/je_lua_canvas.cpp66
-rw-r--r--src/lua/modules/graphics/je_lua_canvas.h16
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp922
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.h0
-rw-r--r--src/lua/modules/graphics/je_lua_page.cpp69
-rw-r--r--src/lua/modules/graphics/je_lua_page.h22
-rw-r--r--src/lua/modules/graphics/je_lua_particle_system.cpp11
-rw-r--r--src/lua/modules/graphics/je_lua_particle_system.h0
-rw-r--r--src/lua/modules/graphics/je_lua_shader.cpp137
-rw-r--r--src/lua/modules/graphics/je_lua_shader.h16
-rw-r--r--src/lua/modules/graphics/je_lua_sprite.cpp262
-rw-r--r--src/lua/modules/graphics/je_lua_sprite.h24
-rw-r--r--src/lua/modules/graphics/je_lua_spritesheet.cpp54
-rw-r--r--src/lua/modules/graphics/je_lua_spritesheet.h21
-rw-r--r--src/lua/modules/graphics/je_lua_text.cpp32
-rw-r--r--src/lua/modules/graphics/je_lua_text.h16
-rw-r--r--src/lua/modules/graphics/je_lua_texture.cpp66
-rw-r--r--src/lua/modules/graphics/je_lua_texture.h16
-rw-r--r--src/lua/modules/graphics/je_lua_texture_font.cpp66
-rw-r--r--src/lua/modules/graphics/je_lua_texture_font.h16
-rw-r--r--src/lua/modules/graphics/je_lua_ttf.cpp66
-rw-r--r--src/lua/modules/graphics/je_lua_ttf.h16
-rw-r--r--src/lua/modules/graphics/je_lua_ttf_data.cpp52
-rw-r--r--src/lua/modules/graphics/je_lua_ttf_data.h21
-rw-r--r--src/lua/modules/graphics/page.cpp73
-rw-r--r--src/lua/modules/graphics/shader.cpp135
-rw-r--r--src/lua/modules/graphics/text.cpp32
-rw-r--r--src/lua/modules/graphics/texture.cpp65
-rw-r--r--src/lua/modules/graphics/texture_font.cpp67
-rw-r--r--src/lua/modules/graphics/ttf.cpp73
-rw-r--r--src/lua/modules/graphics/ttfData.cpp51
-rw-r--r--src/lua/modules/joypad/je_lua_joypad.cpp21
-rw-r--r--src/lua/modules/joypad/je_lua_joypad.h0
-rw-r--r--src/lua/modules/joypad/joypad.cpp21
-rw-r--r--src/lua/modules/keyboard/je_lua_keyboard.cpp17
-rw-r--r--src/lua/modules/keyboard/je_lua_keyboard.h0
-rw-r--r--src/lua/modules/keyboard/keyboard.cpp16
-rw-r--r--src/lua/modules/math/je_lua_math.cpp30
-rw-r--r--src/lua/modules/math/je_lua_math.h0
-rw-r--r--src/lua/modules/math/math.cpp30
-rw-r--r--src/lua/modules/mouse/je_lua_mouse.cpp42
-rw-r--r--src/lua/modules/mouse/je_lua_mouse.h0
-rw-r--r--src/lua/modules/mouse/mouse.cpp42
-rw-r--r--src/lua/modules/net/Buffer.cpp142
-rw-r--r--src/lua/modules/net/Buffer.h97
-rw-r--r--src/lua/modules/net/je_lua_buffer.cpp137
-rw-r--r--src/lua/modules/net/je_lua_buffer.h102
-rw-r--r--src/lua/modules/net/je_lua_net.cpp84
-rw-r--r--src/lua/modules/net/je_lua_net.h0
-rw-r--r--src/lua/modules/net/je_lua_socket.cpp129
-rw-r--r--src/lua/modules/net/je_lua_socket.h16
-rw-r--r--src/lua/modules/net/net.cpp86
-rw-r--r--src/lua/modules/net/socket.cpp129
-rw-r--r--src/lua/modules/thread/Thread.cpp252
-rw-r--r--src/lua/modules/thread/Thread.h94
-rw-r--r--src/lua/modules/thread/je_lua_thread.cpp248
-rw-r--r--src/lua/modules/thread/je_lua_thread.h93
-rw-r--r--src/lua/modules/time/je_lua_time.cpp71
-rw-r--r--src/lua/modules/time/je_lua_time.h0
-rw-r--r--src/lua/modules/time/je_lua_timer.cpp146
-rw-r--r--src/lua/modules/time/je_lua_timer.h20
-rw-r--r--src/lua/modules/time/time.cpp38
-rw-r--r--src/lua/modules/types.h25
-rw-r--r--src/lua/resources/font.ttfbin84564 -> 0 bytes
-rw-r--r--src/lua/resources/font.ttf.h714
1686 files changed, 295354 insertions, 60658 deletions
diff --git a/bin/Jin.exe b/bin/Jin.exe
index 1c7f23f..8251ee4 100644
--- a/bin/Jin.exe
+++ b/bin/Jin.exe
Binary files differ
diff --git a/bin/SDL2.dll b/bin/SDL2.dll
index c21f747..3aaf046 100644
--- a/bin/SDL2.dll
+++ b/bin/SDL2.dll
Binary files differ
diff --git a/bin/font.png b/bin/font.png
deleted file mode 100644
index 151b992..0000000
--- a/bin/font.png
+++ /dev/null
Binary files differ
diff --git a/bin/font.shader b/bin/font.shader
deleted file mode 100644
index 7b714db..0000000
--- a/bin/font.shader
+++ /dev/null
@@ -1,26 +0,0 @@
-#VERTEX_SHADER
-
-Vertex vert(Vertex v)
-{
- return v;
-}
-
-#END_VERTEX_SHADER
-
-#FRAGMENT_SHADER
-
-uniform float dt;
-
-Color frag(Color col, Texture tex, Vertex v)
-{
- Color c = texel(tex, v.uv);
- c.r *= sin(dt);
- c.g *= sin(dt / 3);
- c.a *= sin(dt / 2);
- return c;
-}
-//1.21 1.34
-
- asdas
-//stbi_write_png
-#END_FRAGMENT_SHADER \ No newline at end of file
diff --git a/bin/font2.png b/bin/font2.png
deleted file mode 100644
index 6083ab6..0000000
--- a/bin/font2.png
+++ /dev/null
Binary files differ
diff --git a/bin/game/0.png b/bin/game/0.png
new file mode 100644
index 0000000..fa62576
--- /dev/null
+++ b/bin/game/0.png
Binary files differ
diff --git a/bin/game/1.png b/bin/game/1.png
new file mode 100644
index 0000000..7e3fe49
--- /dev/null
+++ b/bin/game/1.png
Binary files differ
diff --git a/bin/game/SDL.jpg b/bin/game/SDL.jpg
new file mode 100644
index 0000000..dcd530a
--- /dev/null
+++ b/bin/game/SDL.jpg
Binary files differ
diff --git a/bin/game/config.lua b/bin/game/config.lua
new file mode 100644
index 0000000..380dd1b
--- /dev/null
+++ b/bin/game/config.lua
@@ -0,0 +1,5 @@
+return
+{
+ title = "window form",
+ icon = "splash.png",
+} \ No newline at end of file
diff --git a/bin/game/forest.ogg b/bin/game/forest.ogg
new file mode 100644
index 0000000..d3059e1
--- /dev/null
+++ b/bin/game/forest.ogg
Binary files differ
diff --git a/bin/game/icon.ico b/bin/game/icon.ico
new file mode 100644
index 0000000..3043332
--- /dev/null
+++ b/bin/game/icon.ico
Binary files differ
diff --git a/bin/game/main.lua b/bin/game/main.lua
new file mode 100644
index 0000000..ce22f46
--- /dev/null
+++ b/bin/game/main.lua
@@ -0,0 +1,102 @@
+io.stdout:setvbuf("no")
+local shader = [[
+#VERTEX_SHADER
+Vertex vert(Vertex v)
+{
+ return v;
+}
+#END_VERTEX_SHADER
+#FRAGMENT_SHADER
+Color frag(Color col, Texture tex, Vertex v)
+{
+ return col;
+}
+#END_FRAGMENT_SHADER
+]]
+
+local shader2 = [[
+#VERTEX_SHADER
+Vertex vert(Vertex v)
+{
+ return v;
+}
+#END_VERTEX_SHADER
+#FRAGMENT_SHADER
+Color frag(Color col, Texture tex, Vertex v)
+{
+ Color c = texel(tex, v.uv);
+ return c;
+}
+#END_FRAGMENT_SHADER
+]]
+music = nil
+local tex = nil
+local shader_program = nil
+local shader_program2 = nil
+local timer = nil
+local tb = {x = 1, y = 2}
+local t = 0
+local spr = nil
+local bitmap = nil
+function jin.core.onLoad()
+ bitmap = jin.graphics.newBitmap(128, 128, function(w, h, x, y)
+ return {255*math.sin(x/w),255 - 255*math.cos(y/w),0,255}
+ end)
+ shader_program = jin.graphics.newShader(shader)
+ shader_program2 = jin.graphics.newShader(shader2)
+ --tex = jin.graphics.newTexture("1.png")
+ tex = jin.graphics.newTexture(bitmap)
+ local ssheet = jin.graphics.newSpriteSheet(tex)
+ spr = ssheet:newSprite(50, 50, 50, 50)
+ spr:setPosition(0, 50)
+ spr:setShader(shader_program2)
+ tex = nil
+ spr:setScale(2, 2)
+ spr:setColor(100, 0, 100, 255)
+ spr:setOrigin(jin.graphics.SpriteOrigin.BOTTOMCENTER)
+ -- music = jin.audio.newSource("forest.ogg")
+ -- music:setVolume(0.5)
+ -- music:setLoop(true)
+ --music:play()
+ jin.graphics.clear()
+ jin.graphics.showWindow()
+ timer = jin.time.newTimer()
+ local h = timer:every(0.5, function(sp)
+ local x, y = spr:getPosition()
+ spr:move(5, 0)
+ end, spr)
+ timer:after(3, function(p)
+ --timer:cancel(h)
+ end, h)
+ jin.graphics.pushMatrix()
+ --jin.graphics.translate(100, 0)
+ jin.graphics.rotate(0.2)
+end
+local stop = false
+
+function jin.core.onEvent(e)
+ if e.type == "Quit" then
+ jin.core.stop()
+ end
+end
+
+function jin.core.onUpdate()
+ tb.x = t
+ t = t + jin.time.getDelta()
+end
+
+function jin.core.onDraw()
+ timer:update(jin.time.getDelta())
+ jin.graphics.useShader(shader_program)
+ jin.graphics.setColor(255, 0, 255, 255)
+ jin.graphics.rect(jin.graphics.RenderMode.FILL, 30, 50, 100, 200)
+ jin.graphics.setColor(255, 255, 255, 255)
+ jin.graphics.unuseShader()
+ spr:render()
+ --jin.graphics.useShader(shader_program2)
+ --jin.graphics.draw(tex, 0, 0,0.2, 0.2)
+ --jin.graphics.unuseShader()
+ if stop then
+ jin.graphics.print("Quit", 100, 300)
+ end
+end \ No newline at end of file
diff --git a/bin/game/splash.png b/bin/game/splash.png
new file mode 100644
index 0000000..b0c4256
--- /dev/null
+++ b/bin/game/splash.png
Binary files differ
diff --git a/bin/img2.bmp b/bin/img2.bmp
deleted file mode 100644
index dc9cf95..0000000
--- a/bin/img2.bmp
+++ /dev/null
Binary files differ
diff --git a/bin/intro.ogg b/bin/intro.ogg
deleted file mode 100644
index 9ba4905..0000000
--- a/bin/intro.ogg
+++ /dev/null
Binary files differ
diff --git a/bin/intro_logo.wav b/bin/intro_logo.wav
deleted file mode 100644
index 828c423..0000000
--- a/bin/intro_logo.wav
+++ /dev/null
Binary files differ
diff --git a/bin/jin.exe b/bin/jin.exe
index 1c7f23f..8251ee4 100644
--- a/bin/jin.exe
+++ b/bin/jin.exe
Binary files differ
diff --git a/bin/lua51.dll b/bin/lua51.dll
deleted file mode 100644
index dd93ee2..0000000
--- a/bin/lua51.dll
+++ /dev/null
Binary files differ
diff --git a/bin/main.lua b/bin/main.lua
deleted file mode 100644
index af78076..0000000
--- a/bin/main.lua
+++ /dev/null
@@ -1,121 +0,0 @@
-io.stdout:setvbuf("no")
-
-local shader
-local text
-local page
-local tf
-local sprites
-local ttf
-function jin.core.onLoad()
- shader = jin.graphics.newShaderf("font.shader")
- -- local bitmap = jin.graphics.newBitmap("defaultfont.png")
- -- local tfdata = jin.graphics.newTTFData("font.ttf")
- -- tf = tfdata:newTTF(13)
- -- page = tf:typeset("this is a test")
- jin.graphics.setClearColor(100, 100, 100, 255)
- sprites = jin.graphics.newTexture("sprites.png")
- -- local ttfdata = jin.graphics.newTTFData("font_pixel.ttf")
- -- ttf = ttfdata:newTTF(22);
- local bitmap = jin.graphics.newBitmap("font2.png")
- tf = jin.graphics.newTextureFont(bitmap, [[<=>?.'^@abcdefghijklmnopqrstuvwxyz|~[\]_]], {255, 0, 0, 255}, 16)
-end
-local value = 0
-function jin.core.onEvent(e)
- if e.type == "Quit" then
- jin.core.stop()
- end
- if e.type == "KeyDown" then
- if e.key == "Up" then
- value = value + 0.01
- end
- if e.key == "Down" then
- value = value - 0.01
- end
- end
-end
-local t = 0
-local fps = 0
-local f = 0
-function jin.core.onUpdate(dt)
- t = t + dt
- f = f + 1
- if t > 1 then
- fps = f
- f = 0
- t = t - 1
- end
-end
-
-function run()
- ---#if editor
-
- ---#endif
-end
-
-function jin.core.onDraw()
- jin.graphics.setColor(255, 255, 255)
- --jin.graphics.draw(sprites, 10, 10, 1, 1)
- -- jin.graphics.setFont(tf)
- jin.graphics.useShader(shader)
- shader:sendNumber("dt", t)
- jin.graphics.print(value)
- jin.graphics.print([[
-#VERTEX_SHADER
-
-Vertex vert(Vertex v)
-{
- return v;
-}
-
-#END_VERTEX_SHADER
-
-#FRAGMENT_SHADER
-
-uniform float dt;
-
-Color frag(Color col, Texture tex, Vertex v)
-{
- Color c = texel(tex, v.uv);
- if(c.a < 0.9f)
- {
- c.a /= 1.34;
- }
- return c;
-}
-//1.21 1.34
-
-//stbi_write_png
-#END_FRAGMENT_SHADER
-
- ]], 0, 20)
- jin.graphics.unuseShader()
- jin.graphics.print([[
-#VERTEX_SHADER
-
-Vertex vert(Vertex v)
-{
- return v;
-}
-
-#END_VERTEX_SHADER
-
-#FRAGMENT_SHADER
-
-uniform float dt;
-
-Color frag(Color col, Texture tex, Vertex v)
-{
- Color c = texel(tex, v.uv);
- if(c.a < 0.9f)
- {
- c.a /= 1.34;
- }
- return c;
-}
-//1.21 1.34
-
-//stbi_write_png
-#END_FRAGMENT_SHADER
-
- ]], 300, 20)
-end
diff --git a/bin/music.ogg b/bin/music.ogg
deleted file mode 100644
index 9d44af6..0000000
--- a/bin/music.ogg
+++ /dev/null
Binary files differ
diff --git a/bin/text.txt b/bin/text.txt
deleted file mode 100644
index 33c6055..0000000
--- a/bin/text.txt
+++ /dev/null
@@ -1 +0,0 @@
-开始 \ No newline at end of file
diff --git a/build/vc++/3rdparty/GLee/GLee.vcxproj b/build/vc++/3rdparty/GLee/GLee.vcxproj
new file mode 100644
index 0000000..7efcdd2
--- /dev/null
+++ b/build/vc++/3rdparty/GLee/GLee.vcxproj
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}</ProjectGuid>
+ <RootNamespace>GLee</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MinSpace</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\GLee\GLee.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\GLee\GLee.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/GLee/GLee.vcxproj.filters b/build/vc++/3rdparty/GLee/GLee.vcxproj.filters
new file mode 100644
index 0000000..2822148
--- /dev/null
+++ b/build/vc++/3rdparty/GLee/GLee.vcxproj.filters
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{eebe1ebb-f43f-4b31-9c61-4cd44565461e}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\GLee\GLee.c">
+ <Filter>source</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\GLee\GLee.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/GLee/GLee.vcxproj.user b/build/vc++/3rdparty/GLee/GLee.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/GLee/GLee.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/SDL2/SDL2.vcxproj b/build/vc++/3rdparty/SDL2/SDL2.vcxproj
new file mode 100644
index 0000000..cbd29bd
--- /dev/null
+++ b/build/vc++/3rdparty/SDL2/SDL2.vcxproj
@@ -0,0 +1,462 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{8658F91C-9AAE-4819-9005-77D09C61D97F}</ProjectGuid>
+ <RootNamespace>SDL2</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+ <OmitDefaultLibName>true</OmitDefaultLibName>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+ <OmitDefaultLibName>true</OmitDefaultLibName>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <SubSystem>Windows</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\begin_code.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\close_code.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_assert.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_atomic.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_audio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_bits.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_blendmode.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_clipboard.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_android.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_iphoneos.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_macosx.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_minimal.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_pandora.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_psp.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_windows.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_winrt.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_wiz.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_copying.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_cpuinfo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_egl.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_endian.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_error.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_events.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_filesystem.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_gamecontroller.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_gesture.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_haptic.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_hints.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_joystick.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_keyboard.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_keycode.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_loadso.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_log.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_main.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_messagebox.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_mouse.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_mutex.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_name.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengl.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_gl2.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_gl2ext.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_gl2platform.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_khrplatform.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengl_glext.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_pixels.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_platform.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_power.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_quit.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_rect.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_render.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_revision.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_rwops.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_scancode.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_shape.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_stdinc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_surface.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_system.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_syswm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_assert.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_common.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_compare.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_crc32.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_font.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_fuzzer.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_harness.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_images.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_log.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_md5.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_memory.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_random.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_thread.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_timer.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_touch.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_types.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_version.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_video.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_vulkan.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\directsound\SDL_directsound.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\disk\SDL_diskaudio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\dummy\SDL_dummyaudio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audio_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiodev_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_sysaudio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_wave.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\winmm\SDL_winmm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_directx.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_windows.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_xinput.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi_overrides.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi_procs.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\blank_cursor.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\default_cursor.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_clipboardevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_dropevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_events_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_gesture_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_keyboard_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_mouse_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_sysevents.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_touch_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_windowevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\SDL_syshaptic.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_dinputhaptic_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_windowshaptic_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_xinputhaptic_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_joystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_sysjoystick.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_dinputjoystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_windowsjoystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_xinputjoystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\libm\math_libm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\libm\math_private.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d11\SDL_shaders_d3d11.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d\SDL_shaders_d3d.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_glfuncs.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_shaders_gl.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengles\SDL_glesfuncs.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_d3dmath.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_sysrender.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_yuv_sw_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendfillrect.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendline.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendpoint.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_draw.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawline.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawpoint.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_render_sw_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_rotate.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_dataqueue.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_error_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\thread\SDL_systhread.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\thread\SDL_thread_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_systhread_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\timer\SDL_timer_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullframebuffer_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullvideo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_auto.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_copy.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_slow.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_pixels_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_rect_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_RLEaccel_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_shape_internals.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_sysvideo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_vulkan_internal.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_yuv_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_vkeys.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsclipboard.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsevents.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsframebuffer.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowskeyboard.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmessagebox.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmodes.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmouse.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsopengl.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsshape.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvideo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvulkan.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowswindow.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\wmmsg.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\yuv2rgb\yuv_rgb.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\atomic\SDL_atomic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\atomic\SDL_spinlock.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\directsound\SDL_directsound.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\disk\SDL_diskaudio.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\dummy\SDL_dummyaudio.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audio.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiocvt.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiodev.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiotypecvt.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_mixer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_wave.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\winmm\SDL_winmm.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi_win32.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_windows.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_xinput.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\cpuinfo\SDL_cpuinfo.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_clipboardevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_dropevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_events.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_gesture.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_keyboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_mouse.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_quit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_touch.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_windowevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\file\SDL_rwops.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\filesystem\windows\SDL_sysfilesystem.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\SDL_haptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_dinputhaptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_windowshaptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_xinputhaptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_gamecontroller.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_joystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_dinputjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_mmjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_windowsjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_xinputjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_atan2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_fmod.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_log.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_log10.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_pow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_rem_pio2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_sqrt.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_cos.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_rem_pio2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_sin.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_tan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_atan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_copysign.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_cos.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_fabs.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_floor.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_scalbn.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_sin.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_tan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\loadso\windows\SDL_sysloadso.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\power\SDL_power.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\power\windows\SDL_syspower.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d11\SDL_shaders_d3d11.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d\SDL_render_d3d.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d11\SDL_render_d3d11.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d\SDL_shaders_d3d.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_render_gl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_shaders_gl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengles2\SDL_render_gles2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengles2\SDL_shaders_gles2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_d3dmath.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_render.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_yuv_sw.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendfillrect.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendline.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendpoint.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawline.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawpoint.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_render_sw.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_rotate.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_assert.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_dataqueue.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_error.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_hints.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_log.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_getenv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_iconv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_malloc.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_qsort.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_stdlib.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_string.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\generic\SDL_syscond.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\SDL_thread.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_sysmutex.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_syssem.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_systhread.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_systls.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\timer\SDL_timer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\timer\windows\SDL_systimer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullframebuffer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullvideo.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_0.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_1.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_A.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_auto.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_copy.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_N.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_slow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_bmp.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_clipboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_egl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_fillrect.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_pixels.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_rect.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_RLEaccel.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_shape.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_stretch.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_surface.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_video.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_vulkan_utils.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_yuv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsclipboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsframebuffer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowskeyboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmessagebox.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmodes.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmouse.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsopengl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsopengles.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsshape.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvideo.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvulkan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowswindow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\yuv2rgb\yuv_rgb.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/SDL2/SDL2.vcxproj.filters b/build/vc++/3rdparty/SDL2/SDL2.vcxproj.filters
new file mode 100644
index 0000000..d422087
--- /dev/null
+++ b/build/vc++/3rdparty/SDL2/SDL2.vcxproj.filters
@@ -0,0 +1,486 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="include">
+ <UniqueIdentifier>{68cf214f-f5bc-4549-96e8-c44b37523bde}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\begin_code.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\close_code.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_assert.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_atomic.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_audio.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_bits.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_blendmode.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_clipboard.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_android.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_iphoneos.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_macosx.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_minimal.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_pandora.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_psp.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_windows.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_winrt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_config_wiz.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_copying.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_cpuinfo.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_egl.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_endian.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_error.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_events.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_filesystem.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_gamecontroller.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_gesture.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_haptic.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_hints.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_joystick.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_keyboard.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_keycode.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_loadso.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_log.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_main.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_messagebox.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_mouse.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_mutex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_name.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengl.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengl_glext.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_gl2.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_gl2ext.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_gl2platform.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_opengles2_khrplatform.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_pixels.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_platform.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_power.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_quit.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_rect.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_render.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_revision.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_rwops.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_scancode.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_shape.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_stdinc.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_surface.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_system.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_syswm.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_assert.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_common.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_compare.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_crc32.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_font.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_fuzzer.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_harness.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_images.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_log.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_md5.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_memory.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_test_random.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_thread.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_timer.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_touch.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_types.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_version.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_video.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\include\SDL_vulkan.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\directsound\SDL_directsound.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\disk\SDL_diskaudio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\dummy\SDL_dummyaudio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audio_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiodev_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_sysaudio.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_wave.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\audio\winmm\SDL_winmm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_directx.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_windows.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_xinput.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi_overrides.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi_procs.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\blank_cursor.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\default_cursor.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_clipboardevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_dropevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_events_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_gesture_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_keyboard_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_mouse_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_sysevents.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_touch_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_windowevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\SDL_syshaptic.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_dinputhaptic_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_windowshaptic_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_xinputhaptic_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_joystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_sysjoystick.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_dinputjoystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_windowsjoystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_xinputjoystick_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\libm\math_libm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\libm\math_private.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_glfuncs.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_shaders_gl.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengles\SDL_glesfuncs.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_d3dmath.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_sysrender.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_yuv_sw_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendfillrect.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendline.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendpoint.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_draw.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawline.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawpoint.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_render_sw_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_rotate.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_dataqueue.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_error_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\thread\SDL_systhread.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\thread\SDL_thread_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_systhread_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\timer\SDL_timer_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullevents_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullframebuffer_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullvideo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_auto.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_copy.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_slow.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_pixels_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_rect_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_RLEaccel_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_shape_internals.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_sysvideo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_vulkan_internal.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_vkeys.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsclipboard.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsevents.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsframebuffer.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowskeyboard.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmessagebox.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmodes.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmouse.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsopengl.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsshape.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvideo.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvulkan.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowswindow.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\wmmsg.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_yuv_c.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\video\yuv2rgb\yuv_rgb.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d11\SDL_shaders_d3d11.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d\SDL_shaders_d3d.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_atan2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_log.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_log10.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_pow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_rem_pio2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_sqrt.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_cos.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_rem_pio2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_sin.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\k_tan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_atan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_copysign.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_cos.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_fabs.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_floor.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_scalbn.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_sin.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\s_tan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_assert.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\atomic\SDL_atomic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audio.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiocvt.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiodev.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_audiotypecvt.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendfillrect.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendline.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_blendpoint.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_0.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_1.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_A.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_auto.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_copy.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_N.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_blit_slow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_bmp.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_clipboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_clipboardevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\cpuinfo\SDL_cpuinfo.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_d3dmath.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_dinputhaptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_dinputjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\directsound\SDL_directsound.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\disk\SDL_diskaudio.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawline.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_drawpoint.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_dropevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\dummy\SDL_dummyaudio.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\dynapi\SDL_dynapi.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_egl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_dataqueue.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_error.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_events.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_fillrect.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_gamecontroller.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_gesture.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_getenv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\SDL_haptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_hints.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_iconv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\SDL_joystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_keyboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\SDL_log.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_malloc.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_mixer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_mmjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_mouse.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullframebuffer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\dummy\SDL_nullvideo.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_pixels.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\power\SDL_power.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_qsort.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_quit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_rect.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_render.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d\SDL_render_d3d.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d11\SDL_render_d3d11.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_render_gl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengles2\SDL_render_gles2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_render_sw.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_RLEaccel.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\software\SDL_rotate.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\file\SDL_rwops.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengl\SDL_shaders_gl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\opengles2\SDL_shaders_gles2.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_shape.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\atomic\SDL_spinlock.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_stdlib.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_stretch.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\stdlib\SDL_string.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_surface.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\generic\SDL_syscond.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\filesystem\windows\SDL_sysfilesystem.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\loadso\windows\SDL_sysloadso.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_sysmutex.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\power\windows\SDL_syspower.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_syssem.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_systhread.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\timer\windows\SDL_systimer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\windows\SDL_systls.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\thread\SDL_thread.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\timer\SDL_timer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_touch.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_video.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\SDL_wave.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\events\SDL_windowevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_windows.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsclipboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsevents.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsframebuffer.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_windowshaptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_windowsjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowskeyboard.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmessagebox.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmodes.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsmouse.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsopengl.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsopengles.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsshape.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvideo.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowswindow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\winmm\SDL_winmm.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi_win32.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\core\windows\SDL_xinput.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\haptic\windows\SDL_xinputhaptic.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\joystick\windows\SDL_xinputjoystick.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\SDL_yuv_sw.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\audio\wasapi\SDL_wasapi.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_vulkan_utils.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\windows\SDL_windowsvulkan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\libm\e_fmod.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\SDL_yuv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\video\yuv2rgb\yuv_rgb.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d11\SDL_shaders_d3d11.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\render\direct3d\SDL_shaders_d3d.c" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/SDL2/SDL2.vcxproj.user b/build/vc++/3rdparty/SDL2/SDL2.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/SDL2/SDL2.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj b/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj
new file mode 100644
index 0000000..14d4711
--- /dev/null
+++ b/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}</ProjectGuid>
+ <RootNamespace>SDL2main</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <OmitDefaultLibName>true</OmitDefaultLibName>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <OmitDefaultLibName>true</OmitDefaultLibName>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\main\windows\SDL_windows_main.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.filters b/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.filters
new file mode 100644
index 0000000..ed203a9
--- /dev/null
+++ b/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.filters
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="源文件">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="头文件">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="资源文件">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\SDL2\src\main\windows\SDL_windows_main.c">
+ <Filter>源文件</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.user b/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/SDL2main/SDL2main.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/buildvm/buildvm-post.bat b/build/vc++/3rdparty/buildvm/buildvm-post.bat
new file mode 100644
index 0000000..e02d64f
--- /dev/null
+++ b/build/vc++/3rdparty/buildvm/buildvm-post.bat
@@ -0,0 +1,17 @@
+set buildvm=%1
+set outdir=%2
+
+if not exist %outdir% mkdir -p %outdir%
+
+set src=..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src
+
+set sources=%src%\lib_base.c %src%\lib_math.c %src%\lib_bit.c %src%\lib_string.c %src%\lib_table.c %src%\lib_io.c %src%\lib_os.c %src%\lib_package.c %src%\lib_debug.c %src%\lib_jit.c %src%\lib_ffi.c
+
+%buildvm% -m peobj -o %outdir%\lj_vm.obj %sources%
+%buildvm% -m bcdef -o %outdir%\lj_bcdef.h %sources%
+%buildvm% -m ffdef -o %outdir%\lj_ffdef.h %sources%
+%buildvm% -m libdef -o %outdir%\lj_libdef.h %sources%
+%buildvm% -m recdef -o %outdir%\lj_recdef.h %sources%
+%buildvm% -m vmdef -o %outdir%\vmdef.lua %sources%
+%buildvm% -m folddef -o %outdir%\lj_folddef.h %src%\lj_opt_fold.c
+
diff --git a/build/vc++/3rdparty/buildvm/buildvm.vcxproj b/build/vc++/3rdparty/buildvm/buildvm.vcxproj
new file mode 100644
index 0000000..faf0e65
--- /dev/null
+++ b/build/vc++/3rdparty/buildvm/buildvm.vcxproj
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}</ProjectGuid>
+ <RootNamespace>buildvm</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\src\3rdparty\buildvm</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\src\3rdparty\buildvm</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>buildvm-post.bat $(SolutionDir)..\..\src\3rdparty\buildvm\$(TargetName) $(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ <PostBuildEvent>
+ <Command>buildvm-post.bat $(SolutionDir)..\..\src\3rdparty\buildvm\$(TargetName) $(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_asm.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_fold.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_lib.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_peobj.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\minilua\minilua.vcxproj">
+ <Project>{c87c5b2f-4088-4bbc-8bee-c6a2bb22f9a0}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/buildvm/buildvm.vcxproj.filters b/build/vc++/3rdparty/buildvm/buildvm.vcxproj.filters
new file mode 100644
index 0000000..9e3cb58
--- /dev/null
+++ b/build/vc++/3rdparty/buildvm/buildvm.vcxproj.filters
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="src">
+ <UniqueIdentifier>{372ba491-5bba-40da-845a-a18b090d3a59}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_lib.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_peobj.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_asm.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm_fold.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\buildvm.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/buildvm/buildvm.vcxproj.user b/build/vc++/3rdparty/buildvm/buildvm.vcxproj.user
new file mode 100644
index 0000000..828e82f
--- /dev/null
+++ b/build/vc++/3rdparty/buildvm/buildvm.vcxproj.user
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\src\3rdparty\buildvm</LocalDebuggerWorkingDirectory>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\src\3rdparty\buildvm</LocalDebuggerWorkingDirectory>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/luajit/luajit.vcxproj b/build/vc++/3rdparty/luajit/luajit.vcxproj
new file mode 100644
index 0000000..2950a92
--- /dev/null
+++ b/build/vc++/3rdparty/luajit/luajit.vcxproj
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{80410A0C-5592-418E-848B-FEC61C432F53}</ProjectGuid>
+ <RootNamespace>luajit</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ <TargetName>$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ <TargetName>$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetName>lua51</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetName>lua51</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;D_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Lib>
+ <AdditionalDependencies>lj_vm.obj</AdditionalDependencies>
+ </Lib>
+ <Lib>
+ <AdditionalLibraryDirectories>$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalLibraryDirectories>$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>lj_vm.obj;%(AdditionalDependencies)</AdditionalDependencies>
+ <ModuleDefinitionFile>luajit.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <ModuleDefinitionFile>luajit.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;D_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalLibraryDirectories>$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>lj_vm.obj;%(AdditionalDependencies)</AdditionalDependencies>
+ <ModuleDefinitionFile>luajit.def</ModuleDefinitionFile>
+ </Link>
+ <Lib>
+ <AdditionalDependencies>lj_vm.obj</AdditionalDependencies>
+ </Lib>
+ <Lib>
+ <AdditionalLibraryDirectories>$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src</AdditionalLibraryDirectories>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <ModuleDefinitionFile>luajit.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lauxlib.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_alloc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_arch.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_arm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_mips.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_ppc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_x86.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bcdump.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_carith.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccall.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccallback.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cconv.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cdata.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_char.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_clib.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cparse.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_crecord.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ctype.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_debug.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_def.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_dispatch.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_arm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_mips.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_ppc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_x86.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_err.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_errmsg.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ff.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ffrecord.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_frame.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_func.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gdbjit.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ir.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ircall.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_iropt.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_jit.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lex.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lib.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_mcode.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_meta.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_obj.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_parse.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_record.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_snap.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_state.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_str.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_strscan.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_tab.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_arm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_mips.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_ppc.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_x86.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_trace.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_traceerr.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_udata.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vm.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vmevent.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lua.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lua.hpp" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\luaconf.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\luajit.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lualib.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_aux.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_base.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_bit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_debug.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_ffi.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_init.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_io.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_jit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_math.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_os.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_package.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_string.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_table.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_alloc.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_api.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bc.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bcread.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bcwrite.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_carith.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccall.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccallback.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cconv.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cdata.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_char.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_clib.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cparse.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_crecord.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ctype.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_debug.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_dispatch.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_err.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ffrecord.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_func.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gc.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gdbjit.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ir.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lex.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lib.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_load.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_mcode.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_meta.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_obj.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_dce.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_fold.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_loop.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_mem.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_narrow.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_sink.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_split.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_parse.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_record.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_snap.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_state.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_str.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_strscan.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_tab.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_trace.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_udata.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vmevent.c" />
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vmmath.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\buildvm\buildvm.vcxproj">
+ <Project>{8b1269cf-1aff-4aa3-9209-96ddba4fa17f}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="luajit.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/luajit/luajit.vcxproj.filters b/build/vc++/3rdparty/luajit/luajit.vcxproj.filters
new file mode 100644
index 0000000..9599ffc
--- /dev/null
+++ b/build/vc++/3rdparty/luajit/luajit.vcxproj.filters
@@ -0,0 +1,396 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="src">
+ <UniqueIdentifier>{81660f22-f79d-4743-8837-9e0c757a0bc3}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lua.hpp">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lualib.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\luajit.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\luaconf.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lua.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vmevent.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vm.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_udata.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_traceerr.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_trace.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_x86.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_ppc.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_mips.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target_arm.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_target.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_tab.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_strscan.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_str.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_state.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_snap.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_record.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_parse.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_obj.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_meta.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_mcode.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lib.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lex.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_jit.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_iropt.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ircall.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ir.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gdbjit.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gc.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_func.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_frame.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ffrecord.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ff.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_errmsg.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_err.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_x86.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_ppc.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_mips.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_emit_arm.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_dispatch.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_def.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_debug.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ctype.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_crecord.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cparse.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_clib.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_char.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cdata.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cconv.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccallback.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccall.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_carith.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bcdump.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bc.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_x86.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_ppc.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_mips.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm_arm.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_arch.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_alloc.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lauxlib.h">
+ <Filter>src</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vmmath.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_vmevent.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_udata.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_trace.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_tab.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_strscan.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_str.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_state.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_snap.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_record.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_parse.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_split.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_sink.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_narrow.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_mem.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_loop.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_fold.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_opt_dce.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_obj.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_meta.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_mcode.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_load.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lib.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_lex.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ir.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gdbjit.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_gc.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_func.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ffrecord.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_err.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_dispatch.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_debug.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ctype.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_crecord.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cparse.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_clib.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_char.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cdata.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_cconv.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccallback.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_ccall.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_carith.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bcwrite.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bcread.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_bc.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_asm.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_api.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lj_alloc.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_table.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_string.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_package.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_os.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_math.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_jit.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_io.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_init.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_ffi.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_debug.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_bit.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_base.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\lib_aux.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="luajit.def" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/luajit/luajit.vcxproj.user b/build/vc++/3rdparty/luajit/luajit.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/luajit/luajit.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/minilua/minilua-post.bat b/build/vc++/3rdparty/minilua/minilua-post.bat
new file mode 100644
index 0000000..cfdfecd
--- /dev/null
+++ b/build/vc++/3rdparty/minilua/minilua-post.bat
@@ -0,0 +1,6 @@
+set minilua=%1
+set outdir=%2
+set luajit=..\..\..\..\src\3rdparty\LuaJIT-2.0.5
+
+if not exist %outdir% mkdir -p %outdir%
+%minilua% %luajit%\dynasm\dynasm.lua -LN -D WIN -D JIT -D FFI -o %outdir%\buildvm_arch.h %luajit%\src\vm_x86.dasc
diff --git a/build/vc++/3rdparty/minilua/minilua.vcxproj b/build/vc++/3rdparty/minilua/minilua.vcxproj
new file mode 100644
index 0000000..e663cb1
--- /dev/null
+++ b/build/vc++/3rdparty/minilua/minilua.vcxproj
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}</ProjectGuid>
+ <RootNamespace>minilua</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\src\3rdparty\minilua</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\src\3rdparty\minilua</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>minilua-post.bat $(SolutionDir)..\..\src\3rdparty\minilua\$(TargetName) $(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ <PostBuildEvent>
+ <Command>minilua-post.bat $(SolutionDir)..\..\src\3rdparty\minilua\$(TargetName) $(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\src</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\minilua.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/minilua/minilua.vcxproj.filters b/build/vc++/3rdparty/minilua/minilua.vcxproj.filters
new file mode 100644
index 0000000..7f78b2c
--- /dev/null
+++ b/build/vc++/3rdparty/minilua/minilua.vcxproj.filters
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="src">
+ <UniqueIdentifier>{a2e8a60a-016f-4231-b0fb-040778ce3716}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\host\minilua.c">
+ <Filter>src</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/minilua/minilua.vcxproj.user b/build/vc++/3rdparty/minilua/minilua.vcxproj.user
new file mode 100644
index 0000000..f353c3c
--- /dev/null
+++ b/build/vc++/3rdparty/minilua/minilua.vcxproj.user
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\src\3rdparty\minilua</LocalDebuggerWorkingDirectory>
+ <LocalDebuggerAttach>false</LocalDebuggerAttach>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\src\3rdparty\minilua</LocalDebuggerWorkingDirectory>
+ <LocalDebuggerAttach>false</LocalDebuggerAttach>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj b/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj
new file mode 100644
index 0000000..546afbb
--- /dev/null
+++ b/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{D17F6928-AF98-4ED9-A2B9-1DC0B2765D4F}</ProjectGuid>
+ <RootNamespace>ogl2d</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\ogl\OpenGL.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.filters b/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.filters
new file mode 100644
index 0000000..74f0b2e
--- /dev/null
+++ b/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.filters
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{9eb6b640-ac80-4c15-b76c-2a7c5536ca5c}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\ogl\OpenGL.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.user b/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/ogl2d/ogl2d.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/smount/smount.vcxproj b/build/vc++/3rdparty/smount/smount.vcxproj
new file mode 100644
index 0000000..6b710f4
--- /dev/null
+++ b/build/vc++/3rdparty/smount/smount.vcxproj
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{3FC3E8B7-380E-41E6-91FF-82FA5E622D29}</ProjectGuid>
+ <RootNamespace>smount</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MinSpace</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\smount\dirent.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\smount\smount.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\smount\smount.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/smount/smount.vcxproj.filters b/build/vc++/3rdparty/smount/smount.vcxproj.filters
new file mode 100644
index 0000000..ad2b2c5
--- /dev/null
+++ b/build/vc++/3rdparty/smount/smount.vcxproj.filters
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{65960c95-e385-4c08-8b67-a7158e39289f}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\smount\dirent.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\smount\smount.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\smount\smount.c">
+ <Filter>source</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/smount/smount.vcxproj.user b/build/vc++/3rdparty/smount/smount.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/smount/smount.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/stb/stb.vcxproj b/build/vc++/3rdparty/stb/stb.vcxproj
new file mode 100644
index 0000000..e6abf2a
--- /dev/null
+++ b/build/vc++/3rdparty/stb/stb.vcxproj
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}</ProjectGuid>
+ <RootNamespace>stb</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MinSpace</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\stb\stb_image.h" />
+ <ClInclude Include="..\..\..\..\src\3rdparty\stb\stb_truetype.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\stb\stb_vorbis.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/stb/stb.vcxproj.filters b/build/vc++/3rdparty/stb/stb.vcxproj.filters
new file mode 100644
index 0000000..dba3009
--- /dev/null
+++ b/build/vc++/3rdparty/stb/stb.vcxproj.filters
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{2704930f-d8dd-4b99-8e27-6b5d8fdab710}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\stb\stb_image.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\..\src\3rdparty\stb\stb_truetype.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\stb\stb_vorbis.c">
+ <Filter>source</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/stb/stb.vcxproj.user b/build/vc++/3rdparty/stb/stb.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/stb/stb.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/tekcos/tekcos.vcxproj b/build/vc++/3rdparty/tekcos/tekcos.vcxproj
new file mode 100644
index 0000000..e8a5bd7
--- /dev/null
+++ b/build/vc++/3rdparty/tekcos/tekcos.vcxproj
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}</ProjectGuid>
+ <RootNamespace>tekcos</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MinSpace</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\tekcos\tekcos.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\tekcos\tekcos.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/tekcos/tekcos.vcxproj.filters b/build/vc++/3rdparty/tekcos/tekcos.vcxproj.filters
new file mode 100644
index 0000000..cccacab
--- /dev/null
+++ b/build/vc++/3rdparty/tekcos/tekcos.vcxproj.filters
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{2cee3ae8-b50d-4592-8545-5e489b1e3f2a}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\tekcos\tekcos.c">
+ <Filter>source</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\tekcos\tekcos.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/tekcos/tekcos.vcxproj.user b/build/vc++/3rdparty/tekcos/tekcos.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/tekcos/tekcos.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/wav/wav.vcxproj b/build/vc++/3rdparty/wav/wav.vcxproj
new file mode 100644
index 0000000..ff62736
--- /dev/null
+++ b/build/vc++/3rdparty/wav/wav.vcxproj
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}</ProjectGuid>
+ <RootNamespace>wav</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MinSpace</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <CompileAs>CompileAsCpp</CompileAs>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\wav\wav.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\wav\wav.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/wav/wav.vcxproj.filters b/build/vc++/3rdparty/wav/wav.vcxproj.filters
new file mode 100644
index 0000000..ac7d2a6
--- /dev/null
+++ b/build/vc++/3rdparty/wav/wav.vcxproj.filters
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="source">
+ <UniqueIdentifier>{b990a338-a227-4467-8414-90e49768bf59}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\src\3rdparty\wav\wav.c">
+ <Filter>source</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\..\src\3rdparty\wav\wav.h">
+ <Filter>source</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/3rdparty/wav/wav.vcxproj.user b/build/vc++/3rdparty/wav/wav.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/3rdparty/wav/wav.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj b/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj
new file mode 100644
index 0000000..ab310c9
--- /dev/null
+++ b/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{984764C1-0471-4A36-9B2B-BF846817C95F}</ProjectGuid>
+ <RootNamespace>ParticleSystem</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <SubSystem>Console</SubSystem>
+ <AdditionalLibraryDirectories>$(SolutionDir)libs\SDL2-2.0.5\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <AdditionalLibraryDirectories>$(SolutionDir)libs\SDL2-2.0.5\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\examples\particle_system\main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\libjin\libjin.vcxproj">
+ <Project>{9ee02090-c15e-4520-9c05-c435e45ef2fc}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.filters b/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.filters
new file mode 100644
index 0000000..fa43442
--- /dev/null
+++ b/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.filters
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\examples\particle_system\main.cpp" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.user b/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/examples/ParticleSystem/ParticleSystem.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/examples/StateMachine/StateMachine.vcxproj b/build/vc++/examples/StateMachine/StateMachine.vcxproj
new file mode 100644
index 0000000..90821de
--- /dev/null
+++ b/build/vc++/examples/StateMachine/StateMachine.vcxproj
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{C70BFD61-6462-49D2-9F54-F16D77FF434A}</ProjectGuid>
+ <RootNamespace>StateMachine</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <SubSystem>Console</SubSystem>
+ <AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\examples\state_machine\main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\libjin\libjin.vcxproj">
+ <Project>{9ee02090-c15e-4520-9c05-c435e45ef2fc}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/examples/StateMachine/StateMachine.vcxproj.filters b/build/vc++/examples/StateMachine/StateMachine.vcxproj.filters
new file mode 100644
index 0000000..3a52c98
--- /dev/null
+++ b/build/vc++/examples/StateMachine/StateMachine.vcxproj.filters
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="..\..\..\..\examples\state_machine\main.cpp" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/examples/StateMachine/StateMachine.vcxproj.user b/build/vc++/examples/StateMachine/StateMachine.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/build/vc++/examples/StateMachine/StateMachine.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project> \ No newline at end of file
diff --git a/build/vc++/jin.sln b/build/vc++/jin.sln
index ed8f37c..b15527a 100644
--- a/build/vc++/jin.sln
+++ b/build/vc++/jin.sln
@@ -7,6 +7,44 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jin", "jin.vcxproj", "{A3E3
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjin", "libjin\libjin.vcxproj", "{9EE02090-C15E-4520-9C05-C435E45EF2FC}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{6FC112F9-B317-4444-B4FB-2E0BF70328F1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ParticleSystem", "examples\ParticleSystem\ParticleSystem.vcxproj", "{984764C1-0471-4A36-9B2B-BF846817C95F}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rdParty", "3rdParty", "{65DFFFA6-F434-47FB-9DB2-DCF019060B92}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stb", "3rdparty\stb\stb.vcxproj", "{E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLee", "3rdparty\GLee\GLee.vcxproj", "{8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tekcos", "3rdparty\tekcos\tekcos.vcxproj", "{B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smount", "3rdparty\smount\smount.vcxproj", "{3FC3E8B7-380E-41E6-91FF-82FA5E622D29}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wav", "3rdparty\wav\wav.vcxproj", "{9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{60F334B9-B068-47CE-8CD9-431A356CB31B}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runner", "Runner", "{2D5BA0D9-04A7-43BB-BD30-000D39317B07}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "jin\jin.vcxproj", "{05128A0C-74E2-43EF-B5F4-B0DA70D47940}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "3rdparty\SDL2\SDL2.vcxproj", "{8658F91C-9AAE-4819-9005-77D09C61D97F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luajit", "3rdparty\luajit\luajit.vcxproj", "{80410A0C-5592-418E-848B-FEC61C432F53}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LuaJIT-2.0.5", "LuaJIT-2.0.5", "{2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buildvm", "3rdparty\buildvm\buildvm.vcxproj", "{8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minilua", "3rdparty\minilua\minilua.vcxproj", "{C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SDL", "SDL", "{CD378AC6-A4FE-48F7-984A-EB68C60A211B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "3rdparty\SDL2main\SDL2main.vcxproj", "{5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StateMachine", "examples\StateMachine\StateMachine.vcxproj", "{C70BFD61-6462-49D2-9F54-F16D77FF434A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -31,10 +69,133 @@ Global
{9EE02090-C15E-4520-9C05-C435E45EF2FC}.Release|x64.Build.0 = Release|x64
{9EE02090-C15E-4520-9C05-C435E45EF2FC}.Release|x86.ActiveCfg = Release|Win32
{9EE02090-C15E-4520-9C05-C435E45EF2FC}.Release|x86.Build.0 = Release|Win32
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Debug|x64.ActiveCfg = Debug|x64
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Debug|x64.Build.0 = Debug|x64
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Debug|x86.ActiveCfg = Debug|Win32
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Debug|x86.Build.0 = Debug|Win32
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Release|x64.ActiveCfg = Release|x64
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Release|x64.Build.0 = Release|x64
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Release|x86.ActiveCfg = Release|Win32
+ {984764C1-0471-4A36-9B2B-BF846817C95F}.Release|x86.Build.0 = Release|Win32
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Debug|x64.ActiveCfg = Debug|x64
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Debug|x64.Build.0 = Debug|x64
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Debug|x86.ActiveCfg = Debug|Win32
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Debug|x86.Build.0 = Debug|Win32
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Release|x64.ActiveCfg = Release|x64
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Release|x64.Build.0 = Release|x64
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Release|x86.ActiveCfg = Release|Win32
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}.Release|x86.Build.0 = Release|Win32
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Debug|x64.ActiveCfg = Debug|x64
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Debug|x64.Build.0 = Debug|x64
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Debug|x86.ActiveCfg = Debug|Win32
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Debug|x86.Build.0 = Debug|Win32
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Release|x64.ActiveCfg = Release|x64
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Release|x64.Build.0 = Release|x64
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Release|x86.ActiveCfg = Release|Win32
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A}.Release|x86.Build.0 = Release|Win32
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Debug|x64.ActiveCfg = Debug|x64
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Debug|x64.Build.0 = Debug|x64
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Debug|x86.ActiveCfg = Debug|Win32
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Debug|x86.Build.0 = Debug|Win32
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Release|x64.ActiveCfg = Release|x64
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Release|x64.Build.0 = Release|x64
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Release|x86.ActiveCfg = Release|Win32
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}.Release|x86.Build.0 = Release|Win32
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Debug|x64.ActiveCfg = Debug|x64
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Debug|x64.Build.0 = Debug|x64
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Debug|x86.ActiveCfg = Debug|Win32
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Debug|x86.Build.0 = Debug|Win32
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Release|x64.ActiveCfg = Release|x64
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Release|x64.Build.0 = Release|x64
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Release|x86.ActiveCfg = Release|Win32
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29}.Release|x86.Build.0 = Release|Win32
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Debug|x64.ActiveCfg = Debug|x64
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Debug|x64.Build.0 = Debug|x64
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Debug|x86.ActiveCfg = Debug|Win32
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Debug|x86.Build.0 = Debug|Win32
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Release|x64.ActiveCfg = Release|x64
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Release|x64.Build.0 = Release|x64
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Release|x86.ActiveCfg = Release|Win32
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}.Release|x86.Build.0 = Release|Win32
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Debug|x64.ActiveCfg = Debug|x64
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Debug|x64.Build.0 = Debug|x64
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Debug|x86.ActiveCfg = Debug|Win32
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Debug|x86.Build.0 = Debug|Win32
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Release|x64.ActiveCfg = Release|x64
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Release|x64.Build.0 = Release|x64
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Release|x86.ActiveCfg = Release|Win32
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940}.Release|x86.Build.0 = Release|Win32
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x64.ActiveCfg = Debug|x64
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x64.Build.0 = Debug|x64
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x86.ActiveCfg = Debug|Win32
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x86.Build.0 = Debug|Win32
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Release|x64.ActiveCfg = Release|x64
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Release|x64.Build.0 = Release|x64
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Release|x86.ActiveCfg = Release|Win32
+ {8658F91C-9AAE-4819-9005-77D09C61D97F}.Release|x86.Build.0 = Release|Win32
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Debug|x64.ActiveCfg = Debug|x64
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Debug|x64.Build.0 = Debug|x64
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Debug|x86.ActiveCfg = Debug|Win32
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Debug|x86.Build.0 = Debug|Win32
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Release|x64.ActiveCfg = Release|x64
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Release|x64.Build.0 = Release|x64
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Release|x86.ActiveCfg = Release|Win32
+ {80410A0C-5592-418E-848B-FEC61C432F53}.Release|x86.Build.0 = Release|Win32
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Debug|x64.ActiveCfg = Debug|x64
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Debug|x64.Build.0 = Debug|x64
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Debug|x86.ActiveCfg = Debug|Win32
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Debug|x86.Build.0 = Debug|Win32
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Release|x64.ActiveCfg = Release|x64
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Release|x64.Build.0 = Release|x64
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Release|x86.ActiveCfg = Release|Win32
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F}.Release|x86.Build.0 = Release|Win32
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Debug|x64.ActiveCfg = Debug|x64
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Debug|x64.Build.0 = Debug|x64
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Debug|x86.ActiveCfg = Debug|Win32
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Debug|x86.Build.0 = Debug|Win32
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Release|x64.ActiveCfg = Release|x64
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Release|x64.Build.0 = Release|x64
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Release|x86.ActiveCfg = Release|Win32
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0}.Release|x86.Build.0 = Release|Win32
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Debug|x64.ActiveCfg = Debug|x64
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Debug|x64.Build.0 = Debug|x64
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Debug|x86.ActiveCfg = Debug|Win32
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Debug|x86.Build.0 = Debug|Win32
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Release|x64.ActiveCfg = Release|x64
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Release|x64.Build.0 = Release|x64
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Release|x86.ActiveCfg = Release|Win32
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794}.Release|x86.Build.0 = Release|Win32
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Debug|x64.ActiveCfg = Debug|x64
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Debug|x64.Build.0 = Debug|x64
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Debug|x86.ActiveCfg = Debug|Win32
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Debug|x86.Build.0 = Debug|Win32
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Release|x64.ActiveCfg = Release|x64
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Release|x64.Build.0 = Release|x64
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Release|x86.ActiveCfg = Release|Win32
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {A3E35ECA-62EB-45CE-8152-674FBC7F7A3B} = {60F334B9-B068-47CE-8CD9-431A356CB31B}
+ {9EE02090-C15E-4520-9C05-C435E45EF2FC} = {60F334B9-B068-47CE-8CD9-431A356CB31B}
+ {984764C1-0471-4A36-9B2B-BF846817C95F} = {6FC112F9-B317-4444-B4FB-2E0BF70328F1}
+ {E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {8828F6B1-F167-4BC9-B7C7-7CC34CDDEE8A} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {B88DC691-FE8A-4C5E-8D57-EBCC6B13C744} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {3FC3E8B7-380E-41E6-91FF-82FA5E622D29} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {05128A0C-74E2-43EF-B5F4-B0DA70D47940} = {2D5BA0D9-04A7-43BB-BD30-000D39317B07}
+ {8658F91C-9AAE-4819-9005-77D09C61D97F} = {CD378AC6-A4FE-48F7-984A-EB68C60A211B}
+ {80410A0C-5592-418E-848B-FEC61C432F53} = {2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2}
+ {2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {8B1269CF-1AFF-4AA3-9209-96DDBA4FA17F} = {2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2}
+ {C87C5B2F-4088-4BBC-8BEE-C6A2BB22F9A0} = {2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2}
+ {CD378AC6-A4FE-48F7-984A-EB68C60A211B} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92}
+ {5522BDBA-3F18-4EDD-B6E4-CE6A70D9D794} = {CD378AC6-A4FE-48F7-984A-EB68C60A211B}
+ {C70BFD61-6462-49D2-9F54-F16D77FF434A} = {6FC112F9-B317-4444-B4FB-2E0BF70328F1}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {633D8D43-3349-43F7-8835-7D7F58BAD2A8}
EndGlobalSection
diff --git a/build/vc++/jin.vcxproj b/build/vc++/jin.vcxproj
index 540d03f..02bf7f0 100644
--- a/build/vc++/jin.vcxproj
+++ b/build/vc++/jin.vcxproj
@@ -22,17 +22,17 @@
<ProjectGuid>{A3E35ECA-62EB-45CE-8152-674FBC7F7A3B}</ProjectGuid>
<RootNamespace>jin</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
- <ProjectName>jin(min version)</ProjectName>
+ <ProjectName>libjin-lua</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
@@ -72,26 +72,27 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\..\bin</OutDir>
<ExtensionsToDeleteOnClean>*.cdf;*.cache;*.obj;*.obj.enc;*.ilk;*.ipdb;*.iobj;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.metagen;*.bi</ExtensionsToDeleteOnClean>
- <TargetName>Jin</TargetName>
+ <TargetName>$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\..\bin</OutDir>
<ExtensionsToDeleteOnClean>*.cdf;*.cache;*.obj;*.obj.enc;*.ilk;*.ipdb;*.iobj;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.metagen;*.bi</ExtensionsToDeleteOnClean>
- <TargetName>Jin</TargetName>
+ <TargetName>$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)libs\SDL2-2.0.5\include;$(SolutionDir)libs\LuaJIT-2.0.5\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<IntrinsicFunctions>true</IntrinsicFunctions>
+ <Optimization>Disabled</Optimization>
</ClCompile>
<Link>
- <AdditionalDependencies>opengl32.lib;glu32.lib;lua51.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>opengl32.lib;lua51.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)libs\SDL2-2.0.5\lib\x86;$(SolutionDir)libs\LuaJIT-2.0.5\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>
@@ -112,15 +113,16 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)libs\SDL2-2.0.5\include;$(SolutionDir)libs\LuaJIT-2.0.5\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <Optimization>MinSpace</Optimization>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>opengl32.lib;glu32.lib;lua51.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>opengl32.lib;lua51.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)libs\SDL2-2.0.5\lib\x86;$(SolutionDir)libs\LuaJIT-2.0.5\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>
@@ -141,54 +143,97 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\..\src\lua\common\je_lua_callback.cpp" />
+ <ClCompile Include="..\..\src\lua\common\je_lua_function.cpp" />
+ <ClCompile Include="..\..\src\lua\common\je_lua_port.h" />
+ <ClCompile Include="..\..\src\lua\common\je_lua_reference.cpp" />
<ClCompile Include="..\..\src\lua\jin.cpp" />
- <ClCompile Include="..\..\src\lua\main.cpp" />
- <ClCompile Include="..\..\src\lua\modules\audio\audio.cpp" />
- <ClCompile Include="..\..\src\lua\modules\audio\source.cpp" />
- <ClCompile Include="..\..\src\lua\modules\bit\bit.cpp" />
- <ClCompile Include="..\..\src\lua\modules\core\core.cpp" />
- <ClCompile Include="..\..\src\lua\modules\event\event.cpp" />
- <ClCompile Include="..\..\src\lua\modules\filesystem\filesystem.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\bitmap.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\canvas.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\text.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\texture_font.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\ttf.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\ttfData.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\graphics.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\page.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\texture.cpp" />
- <ClCompile Include="..\..\src\lua\modules\graphics\shader.cpp" />
- <ClCompile Include="..\..\src\lua\modules\joypad\joypad.cpp" />
- <ClCompile Include="..\..\src\lua\modules\keyboard\keyboard.cpp" />
- <ClCompile Include="..\..\src\lua\modules\math\math.cpp" />
- <ClCompile Include="..\..\src\lua\modules\mouse\mouse.cpp" />
- <ClCompile Include="..\..\src\lua\modules\net\buffer.cpp" />
- <ClCompile Include="..\..\src\lua\modules\net\net.cpp" />
- <ClCompile Include="..\..\src\lua\modules\net\socket.cpp" />
- <ClCompile Include="..\..\src\lua\modules\thread\thread.cpp" />
- <ClCompile Include="..\..\src\lua\modules\time\time.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\ai\je_lua_ai.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\ai\je_lua_behavior_tree.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\ai\je_lua_state_machine.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\audio\je_lua_audio.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\audio\je_lua_source.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\bit\je_lua_bit.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\core\je_lua_core.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\event\je_lua_event.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\filesystem\je_lua_filesystem.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_bitmap.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_canvas.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_particle_system.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_sprite.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_spritesheet.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_text.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_texture_font.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_ttf.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_ttf_data.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_graphics.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_page.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_texture.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_shader.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\joypad\je_lua_joypad.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\keyboard\je_lua_keyboard.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\math\je_lua_math.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\mouse\je_lua_mouse.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\net\je_lua_buffer.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\net\je_lua_net.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\net\je_lua_socket.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\thread\je_lua_thread.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\time\je_lua_time.cpp" />
+ <ClCompile Include="..\..\src\lua\modules\time\je_lua_timer.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\..\src\lua\common\common.h" />
- <ClInclude Include="..\..\src\lua\common\constant.h" />
- <ClInclude Include="..\..\src\lua\common\error.h" />
- <ClInclude Include="..\..\src\lua\common\Proxy.h" />
- <ClInclude Include="..\..\src\lua\common\Reference.hpp" />
- <ClInclude Include="..\..\src\lua\embed\boot.lua.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_common.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_constant.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_error.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_callback.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_function.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_proxy.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_reference.h" />
+ <ClInclude Include="..\..\src\lua\common\je_lua_shared.hpp" />
<ClInclude Include="..\..\src\lua\embed\embed.h" />
- <ClInclude Include="..\..\src\lua\embed\graphics.lua.h" />
- <ClInclude Include="..\..\src\lua\embed\keyboard.lua.h" />
- <ClInclude Include="..\..\src\lua\embed\mouse.lua.h" />
- <ClInclude Include="..\..\src\lua\embed\net.lua.h" />
- <ClInclude Include="..\..\src\lua\embed\path.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\ai.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\boot.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\graphics.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\keyboard.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\mouse.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\net.lua.h" />
+ <ClInclude Include="..\..\src\lua\embed\scripts\path.lua.h" />
<ClInclude Include="..\..\src\lua\jin.h" />
<ClInclude Include="..\..\src\lua\libraries\luax\luax.h" />
<ClInclude Include="..\..\src\lua\luax.h" />
+ <ClInclude Include="..\..\src\lua\modules\ai\je_lua_ai.h" />
+ <ClInclude Include="..\..\src\lua\modules\ai\je_lua_behavior_tree.h" />
+ <ClInclude Include="..\..\src\lua\modules\ai\je_lua_state_machine.h" />
+ <ClInclude Include="..\..\src\lua\modules\audio\je_lua_audio.h" />
+ <ClInclude Include="..\..\src\lua\modules\audio\je_lua_source.h" />
+ <ClInclude Include="..\..\src\lua\modules\bit\je_lua_bit.h" />
+ <ClInclude Include="..\..\src\lua\modules\core\je_lua_core.h" />
+ <ClInclude Include="..\..\src\lua\modules\event\je_lua_event.h" />
+ <ClInclude Include="..\..\src\lua\modules\filesystem\je_lua_filesystem.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_bitmap.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_canvas.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_graphics.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_page.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_particle_system.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_shader.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_sprite.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_spritesheet.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_text.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_texture.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_texture_font.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_ttf.h" />
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_ttf_data.h" />
+ <ClInclude Include="..\..\src\lua\modules\joypad\je_lua_joypad.h" />
+ <ClInclude Include="..\..\src\lua\modules\keyboard\je_lua_keyboard.h" />
<ClInclude Include="..\..\src\lua\modules\luax.h" />
- <ClInclude Include="..\..\src\lua\modules\net\buffer.h" />
- <ClInclude Include="..\..\src\lua\modules\thread\thread.h" />
- <ClInclude Include="..\..\src\lua\modules\types.h" />
+ <ClInclude Include="..\..\src\lua\modules\math\je_lua_math.h" />
+ <ClInclude Include="..\..\src\lua\modules\mouse\je_lua_mouse.h" />
+ <ClInclude Include="..\..\src\lua\modules\net\je_lua_buffer.h" />
+ <ClInclude Include="..\..\src\lua\modules\net\je_lua_net.h" />
+ <ClInclude Include="..\..\src\lua\modules\net\je_lua_socket.h" />
+ <ClInclude Include="..\..\src\lua\modules\thread\je_lua_thread.h" />
+ <ClInclude Include="..\..\src\lua\modules\time\je_lua_time.h" />
+ <ClInclude Include="..\..\src\lua\modules\time\je_lua_timer.h" />
<ClInclude Include="..\..\src\lua\resources\font.ttf.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
@@ -199,6 +244,9 @@
<Image Include="..\..\res\icon.ico" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="3rdparty\luajit\luajit.vcxproj">
+ <Project>{80410a0c-5592-418e-848b-fec61c432f53}</Project>
+ </ProjectReference>
<ProjectReference Include="libjin\libjin.vcxproj">
<Project>{9ee02090-c15e-4520-9c05-c435e45ef2fc}</Project>
</ProjectReference>
diff --git a/build/vc++/jin.vcxproj.filters b/build/vc++/jin.vcxproj.filters
index 1a17f85..1dba6ab 100644
--- a/build/vc++/jin.vcxproj.filters
+++ b/build/vc++/jin.vcxproj.filters
@@ -1,226 +1,361 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <Filter Include="src">
+ <Filter Include="source">
<UniqueIdentifier>{f3e85b81-1688-49e4-b85c-65d99ddafad9}</UniqueIdentifier>
</Filter>
- <Filter Include="res">
- <UniqueIdentifier>{579f12b8-5758-4be5-9cd7-e1fa62fdef74}</UniqueIdentifier>
- </Filter>
- <Filter Include="src\common">
+ <Filter Include="source\common">
<UniqueIdentifier>{2264d908-20ee-41c2-8bdc-bc1117959c4f}</UniqueIdentifier>
</Filter>
- <Filter Include="src\libraries">
+ <Filter Include="source\libraries">
<UniqueIdentifier>{269451af-b8e9-451f-940a-9b679e6116d3}</UniqueIdentifier>
</Filter>
- <Filter Include="src\libraries\luax">
+ <Filter Include="source\libraries\luax">
<UniqueIdentifier>{93b29ece-8318-4b20-a65d-2e79c1a2f816}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules">
+ <Filter Include="source\modules">
<UniqueIdentifier>{923b475a-00e2-4b8f-925a-ca1e5f9b4689}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\thread">
+ <Filter Include="source\modules\thread">
<UniqueIdentifier>{7957774a-4f34-4255-ab2e-8da9b6c71983}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\time">
+ <Filter Include="source\modules\time">
<UniqueIdentifier>{ee920041-8798-4827-be04-49f9342ba092}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\net">
+ <Filter Include="source\modules\net">
<UniqueIdentifier>{6b79b5bf-69c1-458c-81f3-b386b340d39b}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\audio">
+ <Filter Include="source\modules\audio">
<UniqueIdentifier>{4eb54d6d-e336-42f6-8670-d271a458eb56}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\bit">
+ <Filter Include="source\modules\bit">
<UniqueIdentifier>{b042ed61-32e5-4e86-b4f3-1a293de8918d}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\core">
+ <Filter Include="source\modules\core">
<UniqueIdentifier>{b13ee8dc-41fc-42b3-8b64-f9c261ebfc73}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\event">
+ <Filter Include="source\modules\event">
<UniqueIdentifier>{8a740640-925a-4cf6-94d5-89283824a141}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\filesystem">
+ <Filter Include="source\modules\filesystem">
<UniqueIdentifier>{563ed6fb-3d82-4905-b128-835f3818cc4f}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\graphics">
+ <Filter Include="source\modules\graphics">
<UniqueIdentifier>{1ed523c3-e203-487f-a13f-a35396f814f3}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\joypad">
+ <Filter Include="source\modules\joypad">
<UniqueIdentifier>{7fd81749-f776-4e5c-b6e2-33372a143560}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\keyboard">
+ <Filter Include="source\modules\keyboard">
<UniqueIdentifier>{2a701538-aeee-4f48-a285-0b848c9a3b81}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\math">
+ <Filter Include="source\modules\math">
<UniqueIdentifier>{98c4385b-893c-4d60-bb82-2a19ee5ff527}</UniqueIdentifier>
</Filter>
- <Filter Include="src\modules\mouse">
+ <Filter Include="source\modules\mouse">
<UniqueIdentifier>{5b69329e-0aa2-4c77-be52-69c09fdbac65}</UniqueIdentifier>
</Filter>
- <Filter Include="src\resources">
+ <Filter Include="source\resources">
<UniqueIdentifier>{0340fbad-0c07-4923-afd2-183424c70967}</UniqueIdentifier>
</Filter>
- <Filter Include="src\embed">
+ <Filter Include="source\embed">
<UniqueIdentifier>{9cf92f3f-bcc5-442b-aa92-c88eeb1c5e45}</UniqueIdentifier>
</Filter>
+ <Filter Include="resource">
+ <UniqueIdentifier>{579f12b8-5758-4be5-9cd7-e1fa62fdef74}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="source\modules\ai">
+ <UniqueIdentifier>{fc3fecf1-63e8-4d28-97a7-bf6a1817f57b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="source\embed\scripts">
+ <UniqueIdentifier>{352f5242-a96e-4cd1-a2e2-15777d354e42}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\src\lua\modules\audio\audio.cpp">
- <Filter>src\modules\audio</Filter>
+ <ClCompile Include="..\..\src\lua\jin.cpp">
+ <Filter>source</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\audio\source.cpp">
- <Filter>src\modules\audio</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_sprite.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\bit\bit.cpp">
- <Filter>src\modules\bit</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_graphics.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\core\core.cpp">
- <Filter>src\modules\core</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_page.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\event\event.cpp">
- <Filter>src\modules\event</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_shader.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\filesystem\filesystem.cpp">
- <Filter>src\modules\filesystem</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_text.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\canvas.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_texture.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\graphics.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_texture_font.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\joypad\joypad.cpp">
- <Filter>src\modules\joypad</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_ttf.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\keyboard\keyboard.cpp">
- <Filter>src\modules\keyboard</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_ttf_data.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\math\math.cpp">
- <Filter>src\modules\math</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_canvas.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\mouse\mouse.cpp">
- <Filter>src\modules\mouse</Filter>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_bitmap.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\net\net.cpp">
- <Filter>src\modules\net</Filter>
+ <ClCompile Include="..\..\src\lua\modules\audio\je_lua_audio.cpp">
+ <Filter>source\modules\audio</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\net\socket.cpp">
- <Filter>src\modules\net</Filter>
+ <ClCompile Include="..\..\src\lua\modules\audio\je_lua_source.cpp">
+ <Filter>source\modules\audio</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\thread\thread.cpp">
- <Filter>src\modules\thread</Filter>
+ <ClCompile Include="..\..\src\lua\modules\bit\je_lua_bit.cpp">
+ <Filter>source\modules\bit</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\time\time.cpp">
- <Filter>src\modules\time</Filter>
+ <ClCompile Include="..\..\src\lua\modules\core\je_lua_core.cpp">
+ <Filter>source\modules\core</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\texture.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\event\je_lua_event.cpp">
+ <Filter>source\modules\event</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\bitmap.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\filesystem\je_lua_filesystem.cpp">
+ <Filter>source\modules\filesystem</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\shader.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\joypad\je_lua_joypad.cpp">
+ <Filter>source\modules\joypad</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\jin.cpp">
- <Filter>src</Filter>
+ <ClCompile Include="..\..\src\lua\modules\keyboard\je_lua_keyboard.cpp">
+ <Filter>source\modules\keyboard</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\math\je_lua_math.cpp">
+ <Filter>source\modules\math</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\mouse\je_lua_mouse.cpp">
+ <Filter>source\modules\mouse</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\net\je_lua_buffer.cpp">
+ <Filter>source\modules\net</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\net\je_lua_net.cpp">
+ <Filter>source\modules\net</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\net\je_lua_socket.cpp">
+ <Filter>source\modules\net</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\thread\je_lua_thread.cpp">
+ <Filter>source\modules\thread</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\time\je_lua_time.cpp">
+ <Filter>source\modules\time</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_particle_system.cpp">
+ <Filter>source\modules\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\main.cpp">
- <Filter>src</Filter>
+ <ClCompile Include="..\..\src\lua\common\je_lua_port.h">
+ <Filter>source\common</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\page.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\ai\je_lua_behavior_tree.cpp">
+ <Filter>source\modules\ai</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\ttfData.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\ai\je_lua_ai.cpp">
+ <Filter>source\modules\ai</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\ttf.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\ai\je_lua_state_machine.cpp">
+ <Filter>source\modules\ai</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\text.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\modules\time\je_lua_timer.cpp">
+ <Filter>source\modules\time</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\graphics\texture_font.cpp">
- <Filter>src\modules\graphics</Filter>
+ <ClCompile Include="..\..\src\lua\common\je_lua_reference.cpp">
+ <Filter>source\common</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\lua\modules\net\buffer.cpp">
- <Filter>src\modules\net</Filter>
+ <ClCompile Include="..\..\src\lua\common\je_lua_callback.cpp">
+ <Filter>source\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\modules\graphics\je_lua_spritesheet.cpp">
+ <Filter>source\modules\graphics</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\lua\common\je_lua_function.cpp">
+ <Filter>source\common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
- <Filter>res</Filter>
+ <Filter>resource</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\common\Reference.hpp">
- <Filter>src\common</Filter>
+ <ClInclude Include="..\..\src\lua\libraries\luax\luax.h">
+ <Filter>source\libraries\luax</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\common\Proxy.h">
- <Filter>src\common</Filter>
+ <ClInclude Include="..\..\src\lua\resources\font.ttf.h">
+ <Filter>source\resources</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\common\common.h">
- <Filter>src\common</Filter>
+ <ClInclude Include="..\..\src\lua\modules\luax.h">
+ <Filter>source\modules</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\common\constant.h">
- <Filter>src\common</Filter>
+ <ClInclude Include="..\..\src\lua\jin.h">
+ <Filter>source</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\libraries\luax\luax.h">
- <Filter>src\libraries\luax</Filter>
+ <ClInclude Include="..\..\src\lua\luax.h">
+ <Filter>source</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\resources\font.ttf.h">
- <Filter>src\resources</Filter>
+ <ClInclude Include="..\..\src\lua\modules\net\je_lua_buffer.h">
+ <Filter>source\modules\net</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\modules\types.h">
- <Filter>src\modules</Filter>
+ <ClInclude Include="..\..\src\lua\modules\thread\je_lua_thread.h">
+ <Filter>source\modules\thread</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\modules\thread\thread.h">
- <Filter>src\modules\thread</Filter>
+ <ClInclude Include="..\..\src\lua\common\je_lua_common.h">
+ <Filter>source\common</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\common\error.h">
- <Filter>src\common</Filter>
+ <ClInclude Include="..\..\src\lua\common\je_lua_constant.h">
+ <Filter>source\common</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\modules\luax.h">
- <Filter>src\modules</Filter>
+ <ClInclude Include="..\..\src\lua\common\je_lua_error.h">
+ <Filter>source\common</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\embed\boot.lua.h">
- <Filter>src\embed</Filter>
+ <ClInclude Include="..\..\src\lua\common\je_lua_proxy.h">
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\lua\embed\embed.h">
- <Filter>src\embed</Filter>
+ <Filter>source\embed</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\embed\graphics.lua.h">
- <Filter>src\embed</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\boot.lua.h">
+ <Filter>source\embed\scripts</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\embed\keyboard.lua.h">
- <Filter>src\embed</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\graphics.lua.h">
+ <Filter>source\embed\scripts</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\embed\mouse.lua.h">
- <Filter>src\embed</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\keyboard.lua.h">
+ <Filter>source\embed\scripts</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\embed\net.lua.h">
- <Filter>src\embed</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\mouse.lua.h">
+ <Filter>source\embed\scripts</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\embed\path.lua.h">
- <Filter>src\embed</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\net.lua.h">
+ <Filter>source\embed\scripts</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\jin.h">
- <Filter>src</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\path.lua.h">
+ <Filter>source\embed\scripts</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\luax.h">
- <Filter>src</Filter>
+ <ClInclude Include="..\..\src\lua\embed\scripts\ai.lua.h">
+ <Filter>source\embed\scripts</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\time\je_lua_timer.h">
+ <Filter>source\modules\time</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\common\je_lua_shared.hpp">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\common\je_lua_reference.h">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\common\je_lua_callback.h">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_page.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_spritesheet.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_sprite.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_bitmap.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_canvas.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_graphics.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_particle_system.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_shader.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_text.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_texture.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_texture_font.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_ttf.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\graphics\je_lua_ttf_data.h">
+ <Filter>source\modules\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\ai\je_lua_ai.h">
+ <Filter>source\modules\ai</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\ai\je_lua_behavior_tree.h">
+ <Filter>source\modules\ai</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\ai\je_lua_state_machine.h">
+ <Filter>source\modules\ai</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\audio\je_lua_audio.h">
+ <Filter>source\modules\audio</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\audio\je_lua_source.h">
+ <Filter>source\modules\audio</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\bit\je_lua_bit.h">
+ <Filter>source\modules\bit</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\core\je_lua_core.h">
+ <Filter>source\modules\core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\event\je_lua_event.h">
+ <Filter>source\modules\event</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\filesystem\je_lua_filesystem.h">
+ <Filter>source\modules\filesystem</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\joypad\je_lua_joypad.h">
+ <Filter>source\modules\joypad</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\keyboard\je_lua_keyboard.h">
+ <Filter>source\modules\keyboard</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\math\je_lua_math.h">
+ <Filter>source\modules\math</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\mouse\je_lua_mouse.h">
+ <Filter>source\modules\mouse</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\net\je_lua_net.h">
+ <Filter>source\modules\net</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\net\je_lua_socket.h">
+ <Filter>source\modules\net</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\lua\modules\time\je_lua_time.h">
+ <Filter>source\modules\time</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\lua\modules\net\buffer.h">
- <Filter>src\modules\net</Filter>
+ <ClInclude Include="..\..\src\lua\common\je_lua_function.h">
+ <Filter>source\common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="jin.rc">
- <Filter>res</Filter>
+ <Filter>resource</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\res\icon.ico">
- <Filter>res</Filter>
+ <Filter>resource</Filter>
</Image>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/build/vc++/jin/jin.vcxproj b/build/vc++/jin/jin.vcxproj
new file mode 100644
index 0000000..7d6707d
--- /dev/null
+++ b/build/vc++/jin/jin.vcxproj
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{05128A0C-74E2-43EF-B5F4-B0DA70D47940}</ProjectGuid>
+ <RootNamespace>jin</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ <ProjectName>runner</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ <TargetName>$(SolutionName)</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)..\..\bin</OutDir>
+ <TargetName>$(SolutionName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <SubSystem>Windows</SubSystem>
+ <AdditionalLibraryDirectories>
+ </AdditionalLibraryDirectories>
+ <AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>false</ConformanceMode>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\;$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\LuaJIT-2.0.5\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <AdditionalLibraryDirectories>
+ </AdditionalLibraryDirectories>
+ <AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\src\jin\main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\jin.vcxproj">
+ <Project>{a3e35eca-62eb-45ce-8152-674fbc7f7a3b}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/jin/jin.vcxproj.filters b/build/vc++/jin/jin.vcxproj.filters
new file mode 100644
index 0000000..c17d229
--- /dev/null
+++ b/build/vc++/jin/jin.vcxproj.filters
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="..\..\..\src\jin\main.cpp" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/jin/jin.vcxproj.user b/build/vc++/jin/jin.vcxproj.user
new file mode 100644
index 0000000..5943b15
--- /dev/null
+++ b/build/vc++/jin/jin.vcxproj.user
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\bin</LocalDebuggerWorkingDirectory>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ <LocalDebuggerCommandArguments>
+ </LocalDebuggerCommandArguments>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(ProjectDir)..\..\..\bin</LocalDebuggerWorkingDirectory>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ <LocalDebuggerCommandArguments>
+ </LocalDebuggerCommandArguments>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/build/vc++/libjin/libjin.vcxproj b/build/vc++/libjin/libjin.vcxproj
index 385c4a2..a1bfa66 100644
--- a/build/vc++/libjin/libjin.vcxproj
+++ b/build/vc++/libjin/libjin.vcxproj
@@ -23,7 +23,7 @@
<ProjectGuid>{9EE02090-C15E-4520-9C05-C435E45EF2FC}</ProjectGuid>
<RootNamespace>libjin</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
- <ProjectName>libjin(min version)</ProjectName>
+ <ProjectName>libjin</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -86,7 +86,7 @@
<ConformanceMode>false</ConformanceMode>
<CompileAs>CompileAsCpp</CompileAs>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(SolutionDir)libs\SDL2-2.0.5\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
</ClCompile>
@@ -102,9 +102,10 @@
<SDLCheck>true</SDLCheck>
<ConformanceMode>false</ConformanceMode>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(SolutionDir)libs\SDL2-2.0.5\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\src\3rdparty\SDL2\include;$(SolutionDir)..\..\src\3rdparty\</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -130,15 +131,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\base64\base64.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\GLee\GLee.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\ogl\OpenGL.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\smount\dirent.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\smount\smount.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\stb\stb_image.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\stb\stb_truetype.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\tekcos\tekcos.h" />
- <ClInclude Include="..\..\..\src\libjin\3rdparty\wav\wav.h" />
+ <ClInclude Include="..\..\..\src\libjin\ai\je_ai.h" />
<ClInclude Include="..\..\..\src\libjin\ai\je_behavior_tree.h" />
<ClInclude Include="..\..\..\src\libjin\ai\je_state_machine.h" />
<ClInclude Include="..\..\..\src\libjin\Audio\je_audio_manager.h" />
@@ -161,47 +154,51 @@
<ClInclude Include="..\..\..\src\libjin\core\je_version.h" />
<ClInclude Include="..\..\..\src\libjin\Filesystem\je_buffer.h" />
<ClInclude Include="..\..\..\src\libjin\Filesystem\je_asset_database.h" />
- <ClInclude Include="..\..\..\src\libjin\Game\je_game.h" />
- <ClInclude Include="..\..\..\src\libjin\game\je_entity.h" />
+ <ClInclude Include="..\..\..\src\libjin\Game\je_entity.h" />
+ <ClInclude Include="..\..\..\src\libjin\Game\je_application.h" />
+ <ClInclude Include="..\..\..\src\libjin\Game\je_gameobject.h" />
<ClInclude Include="..\..\..\src\libjin\game\je_scene.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\animation\je_animation.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\animation\je_clip.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\animations\je_animation.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\animations\je_animator.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_decoder.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_font.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_page.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_text.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_texture_font.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_ttf.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_bitmap.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_canvas.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_color.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_graphic.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_decoder.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_font.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_page.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_text.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_texture_font.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_ttf.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_graphics.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_image.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_mesh.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_gl.h" />
<ClInclude Include="..\..\..\src\libjin\graphics\je_sprite_batch.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle_batch.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle_emitter.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle_system.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_base.shader.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_default.shader.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_font.shader.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_shader.h" />
- <ClInclude Include="..\..\..\src\libjin\graphics\shader\je_jsl_compiler.h" />
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_texture.shader.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\je_sprite_sheet.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_shapes.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_sprite.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_texture.h" />
<ClInclude Include="..\..\..\src\libjin\Graphics\je_window.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle_emitter.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle_pool.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle_system.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\built-in\je_default.shader.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\built-in\je_font.shader.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\built-in\je_texture.shader.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\je_base.shader.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\je_jsl_compiler.h" />
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\je_shader.h" />
<ClInclude Include="..\..\..\src\libjin\Input\je_event.h" />
<ClInclude Include="..\..\..\src\libjin\Input\je_input.h" />
<ClInclude Include="..\..\..\src\libjin\Input\je_joypad.h" />
<ClInclude Include="..\..\..\src\libjin\Input\je_keyboard.h" />
<ClInclude Include="..\..\..\src\libjin\Input\je_mouse.h" />
<ClInclude Include="..\..\..\src\libjin\jin.h" />
+ <ClInclude Include="..\..\..\src\libjin\math\je_bezier_curve.h" />
<ClInclude Include="..\..\..\src\libjin\Math\je_constant.h" />
+ <ClInclude Include="..\..\..\src\libjin\math\je_ellipse.h" />
<ClInclude Include="..\..\..\src\libjin\Math\je_math.h" />
<ClInclude Include="..\..\..\src\libjin\Math\je_matrix.h" />
<ClInclude Include="..\..\..\src\libjin\Math\je_quad.h" />
@@ -209,9 +206,9 @@
<ClInclude Include="..\..\..\src\libjin\Math\je_vector2.hpp" />
<ClInclude Include="..\..\..\src\libjin\Math\je_vector3.hpp" />
<ClInclude Include="..\..\..\src\libjin\Math\je_vector4.hpp" />
- <ClInclude Include="..\..\..\src\libjin\multithread\je_thread.h" />
<ClInclude Include="..\..\..\src\libjin\Net\je_net_manager.h" />
<ClInclude Include="..\..\..\src\libjin\Net\je_socket.h" />
+ <ClInclude Include="..\..\..\src\libjin\threads\je_thread.h" />
<ClInclude Include="..\..\..\src\libjin\Time\je_timer.h" />
<ClInclude Include="..\..\..\src\libjin\Utils\je_endian.h" />
<ClInclude Include="..\..\..\src\libjin\Utils\je_log.h" />
@@ -224,11 +221,6 @@
<None Include="..\..\..\src\libjin\README.md" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\..\src\libjin\3rdparty\GLee\GLee.c" />
- <ClCompile Include="..\..\..\src\libjin\3rdparty\smount\smount.c" />
- <ClCompile Include="..\..\..\src\libjin\3rdparty\stb\stb_vorbis.c" />
- <ClCompile Include="..\..\..\src\libjin\3rdparty\tekcos\tekcos.c" />
- <ClCompile Include="..\..\..\src\libjin\3rdparty\wav\wav.c" />
<ClCompile Include="..\..\..\src\libjin\ai\je_behavior_tree.cpp" />
<ClCompile Include="..\..\..\src\libjin\ai\je_state_machine.cpp" />
<ClCompile Include="..\..\..\src\libjin\Audio\je_audio_manager.cpp" />
@@ -239,44 +231,71 @@
<ClCompile Include="..\..\..\src\libjin\Common\je_utf8.cpp" />
<ClCompile Include="..\..\..\src\libjin\Filesystem\je_asset_database.cpp" />
<ClCompile Include="..\..\..\src\libjin\Game\je_entity.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Game\je_game.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\Game\je_gameobject.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\Game\je_application.cpp" />
<ClCompile Include="..\..\..\src\libjin\Game\je_scene.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\animation\je_animation.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\animation\je_clip.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\animations\je_animation.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\animations\je_animator.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_decoder.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_text.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_texture_font.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_ttf.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_bitmap.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_canvas.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_color.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_graphic.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_decoder.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_text.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_texture_font.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_ttf.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_image.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_mesh.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_gl.cpp" />
<ClCompile Include="..\..\..\src\libjin\graphics\je_sprite_batch.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle_batch.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle_emitter.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle_system.cpp" />
- <ClCompile Include="..\..\..\src\libjin\Graphics\Shader\je_shader.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\je_sprite_sheet.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_shapes.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_sprite.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_texture.cpp" />
<ClCompile Include="..\..\..\src\libjin\Graphics\je_window.cpp" />
- <ClCompile Include="..\..\..\src\libjin\graphics\shader\je_jsl_compiler.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\particles\je_particle.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\particles\je_particle_emitter.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\particles\je_particle_system.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\shaders\je_jsl_compiler.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\graphics\shaders\je_shader.cpp" />
<ClCompile Include="..\..\..\src\libjin\Input\je_event.cpp" />
<ClCompile Include="..\..\..\src\libjin\Input\je_joypad.cpp" />
<ClCompile Include="..\..\..\src\libjin\Input\je_keyboard.cpp" />
<ClCompile Include="..\..\..\src\libjin\Input\je_mouse.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\math\je_bezier_curve.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\math\je_ellipse.cpp" />
<ClCompile Include="..\..\..\src\libjin\Math\je_matrix.cpp" />
- <ClCompile Include="..\..\..\src\libjin\multithread\je_thread.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\math\je_random.cpp" />
<ClCompile Include="..\..\..\src\libjin\Net\je_net_manager.cpp" />
<ClCompile Include="..\..\..\src\libjin\Net\je_socket.cpp" />
+ <ClCompile Include="..\..\..\src\libjin\threads\je_thread.cpp" />
<ClCompile Include="..\..\..\src\libjin\Time\je_timer.cpp" />
<ClCompile Include="..\..\..\src\libjin\Utils\je_log.cpp" />
<ClCompile Include="..\..\..\src\libjin\Utils\je_unittest.cpp" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\3rdparty\GLee\GLee.vcxproj">
+ <Project>{8828f6b1-f167-4bc9-b7c7-7cc34cddee8a}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\3rdparty\SDL2main\SDL2main.vcxproj">
+ <Project>{5522bdba-3f18-4edd-b6e4-ce6a70d9d794}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\3rdparty\SDL2\SDL2.vcxproj">
+ <Project>{8658f91c-9aae-4819-9005-77d09c61d97f}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\3rdparty\smount\smount.vcxproj">
+ <Project>{3fc3e8b7-380e-41e6-91ff-82fa5e622d29}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\3rdparty\stb\stb.vcxproj">
+ <Project>{e9a7ecc9-1437-45a8-b970-e9e75bd1f8e0}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\3rdparty\tekcos\tekcos.vcxproj">
+ <Project>{b88dc691-fe8a-4c5e-8d57-ebcc6b13c744}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\3rdparty\wav\wav.vcxproj">
+ <Project>{9a0ead3f-5a23-41c8-8ffd-8f6b71f43342}</Project>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/build/vc++/libjin/libjin.vcxproj.filters b/build/vc++/libjin/libjin.vcxproj.filters
index 3221557..f68943f 100644
--- a/build/vc++/libjin/libjin.vcxproj.filters
+++ b/build/vc++/libjin/libjin.vcxproj.filters
@@ -1,518 +1,482 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <Filter Include="Source">
+ <Filter Include="source">
<UniqueIdentifier>{708c6303-1b76-4db4-bac5-be6fa9179e98}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\3rdparty">
- <UniqueIdentifier>{3634a892-8e97-442c-b855-80a26dff2143}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\GLee">
- <UniqueIdentifier>{230b5ce5-8893-4aed-8f96-576d5f0aa3a2}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\stb">
- <UniqueIdentifier>{d3f9b98c-e18c-4603-be4a-40cf5270c8a0}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\wav">
- <UniqueIdentifier>{6f4aa0ff-3d1b-40ff-8da9-ce7292ac83b2}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\tekcos">
- <UniqueIdentifier>{06d4dd93-7a6d-4b9e-a841-c7f8fbccafe0}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\smount">
- <UniqueIdentifier>{60deec03-f023-4417-a058-c955d23f01d4}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\ogl2d">
- <UniqueIdentifier>{c582e534-7e96-484c-ae1b-a9e7962ab6c2}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\3rdparty\base64">
- <UniqueIdentifier>{086e2fe7-2366-4d52-b059-212ada075da4}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\utils">
+ <Filter Include="source\utils">
<UniqueIdentifier>{6259760f-501a-4b52-b9a1-4abb4d788a99}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\time">
+ <Filter Include="source\time">
<UniqueIdentifier>{492364c7-464b-488e-aae0-15aca7824f32}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\net">
+ <Filter Include="source\net">
<UniqueIdentifier>{125ecddc-2a19-4da8-9e81-da40ccfb1be7}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\math">
+ <Filter Include="source\math">
<UniqueIdentifier>{17b71ceb-a8ff-4ec0-aa18-b51e265bec34}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\input">
+ <Filter Include="source\input">
<UniqueIdentifier>{e4d464ae-1cb5-47fd-b24a-fd35708aead0}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\graphics">
+ <Filter Include="source\graphics">
<UniqueIdentifier>{bb6c372a-520b-4de3-ab14-64839a6166d9}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\graphics\font">
- <UniqueIdentifier>{ce02dfa9-2afe-4295-b14f-c786d65456cd}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\graphics\shader">
- <UniqueIdentifier>{bed786b4-6d8a-4c8d-b04f-67eb0f7435b8}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source\game">
+ <Filter Include="source\game">
<UniqueIdentifier>{c002d452-c7a0-4161-a419-c10fd3d1c297}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\filesystem">
+ <Filter Include="source\filesystem">
<UniqueIdentifier>{3a98cf95-d45a-4a0e-b3fe-65b5accdb75f}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\common">
+ <Filter Include="source\common">
<UniqueIdentifier>{908f94da-1fc4-42db-abe9-8c8e17051f9d}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\audio">
+ <Filter Include="source\audio">
<UniqueIdentifier>{27146cd2-84fe-4eaf-a45b-641a463d381b}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\audio\sdl">
+ <Filter Include="source\audio\sdl">
<UniqueIdentifier>{2dc5e4ca-0904-4b49-8043-5d02db438008}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\core">
+ <Filter Include="source\core">
<UniqueIdentifier>{410ae074-3f19-4ca1-bbf4-380f2ba67500}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\multithread">
- <UniqueIdentifier>{5d5c96c3-1065-4e74-9521-f4d756d4057f}</UniqueIdentifier>
+ <Filter Include="source\ai">
+ <UniqueIdentifier>{caecef4f-a2c6-4d0a-8052-20e400378f3a}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\graphics\particle">
+ <Filter Include="source\graphics\animations">
+ <UniqueIdentifier>{75436e7f-5196-4981-a0f0-f2eaf5e97dce}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="source\graphics\fonts">
+ <UniqueIdentifier>{ce02dfa9-2afe-4295-b14f-c786d65456cd}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="source\graphics\particles">
<UniqueIdentifier>{6d44a7c8-3ed7-4377-920b-2d8c98f34435}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\ai">
- <UniqueIdentifier>{caecef4f-a2c6-4d0a-8052-20e400378f3a}</UniqueIdentifier>
+ <Filter Include="source\graphics\shaders">
+ <UniqueIdentifier>{bed786b4-6d8a-4c8d-b04f-67eb0f7435b8}</UniqueIdentifier>
</Filter>
- <Filter Include="Source\graphics\animation">
- <UniqueIdentifier>{75436e7f-5196-4981-a0f0-f2eaf5e97dce}</UniqueIdentifier>
+ <Filter Include="source\graphics\shaders\built-in">
+ <UniqueIdentifier>{9bb29b2f-9812-4a0b-ad27-fd57756c0717}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="source\threads">
+ <UniqueIdentifier>{5d5c96c3-1065-4e74-9521-f4d756d4057f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\GLee\GLee.h">
- <Filter>Source\3rdparty\GLee</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\stb\stb_image.h">
- <Filter>Source\3rdparty\stb</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\stb\stb_truetype.h">
- <Filter>Source\3rdparty\stb</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\wav\wav.h">
- <Filter>Source\3rdparty\wav</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\tekcos\tekcos.h">
- <Filter>Source\3rdparty\tekcos</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\smount\dirent.h">
- <Filter>Source\3rdparty\smount</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\smount\smount.h">
- <Filter>Source\3rdparty\smount</Filter>
- </ClInclude>
<ClInclude Include="..\..\..\src\libjin\jin.h">
- <Filter>Source</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\ogl\OpenGL.h">
- <Filter>Source\3rdparty\ogl2d</Filter>
+ <Filter>source</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_mesh.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_bitmap.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_window.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_texture.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_sprite.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_shapes.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_gl.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_image.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_graphics.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_color.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Graphics\je_canvas.h">
- <Filter>Source\graphics</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_shader.h">
- <Filter>Source\graphics\shader</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_base.shader.h">
- <Filter>Source\graphics\shader</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_default.shader.h">
- <Filter>Source\graphics\shader</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_font.shader.h">
- <Filter>Source\graphics\shader</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Shader\je_texture.shader.h">
- <Filter>Source\graphics\shader</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_decoder.h">
- <Filter>Source\graphics\font</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_font.h">
- <Filter>Source\graphics\font</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_page.h">
- <Filter>Source\graphics\font</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_text.h">
- <Filter>Source\graphics\font</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_texture_font.h">
- <Filter>Source\graphics\font</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\Font\je_ttf.h">
- <Filter>Source\graphics\font</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Utils\je_utils.h">
- <Filter>Source\utils</Filter>
+ <Filter>source\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Utils\je_macros.h">
- <Filter>Source\utils</Filter>
+ <Filter>source\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Utils\je_log.h">
- <Filter>Source\utils</Filter>
+ <Filter>source\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Utils\je_endian.h">
- <Filter>Source\utils</Filter>
+ <Filter>source\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Time\je_timer.h">
- <Filter>Source\time</Filter>
+ <Filter>source\time</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Net\je_socket.h">
- <Filter>Source\net</Filter>
+ <Filter>source\net</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_vector4.hpp">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_vector3.hpp">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_vector2.hpp">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_quad.h">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_matrix.h">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_math.h">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Math\je_constant.h">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Input\je_mouse.h">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Input\je_keyboard.h">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Input\je_joypad.h">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Input\je_input.h">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Input\je_event.h">
- <Filter>Source\input</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Game\je_game.h">
- <Filter>Source\game</Filter>
+ <Filter>source\input</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Filesystem\je_buffer.h">
- <Filter>Source\filesystem</Filter>
+ <Filter>source\filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_array.hpp">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_common.h">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_exception.h">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_singleton.hpp">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_stringmap.hpp">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_subsystem.hpp">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_types.h">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Common\je_utf8.h">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Audio\je_source.h">
- <Filter>Source\audio</Filter>
+ <Filter>source\audio</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Audio\SDL\je_sdl_source.h">
- <Filter>Source\audio\sdl</Filter>
+ <Filter>source\audio\sdl</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Audio\SDL\je_sdl_audio.h">
- <Filter>Source\audio\sdl</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\3rdparty\base64\base64.h">
- <Filter>Source\3rdparty\base64</Filter>
+ <Filter>source\audio\sdl</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\core\je_configuration.h">
- <Filter>Source\core</Filter>
+ <Filter>source\core</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Filesystem\je_asset_database.h">
- <Filter>Source\filesystem</Filter>
+ <Filter>source\filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Net\je_net_manager.h">
- <Filter>Source\net</Filter>
+ <Filter>source\net</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\Audio\je_audio_manager.h">
- <Filter>Source\audio</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\multithread\je_thread.h">
- <Filter>Source\multithread</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\shader\je_jsl_compiler.h">
- <Filter>Source\graphics\shader</Filter>
+ <Filter>source\audio</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\math\je_random.h">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\core\je_version.h">
- <Filter>Source\core</Filter>
+ <Filter>source\core</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\game\je_scene.h">
- <Filter>Source\game</Filter>
+ <Filter>source\game</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\ai\je_behavior_tree.h">
+ <Filter>source\ai</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\ai\je_state_machine.h">
+ <Filter>source\ai</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Common\je_object.h">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Common\je_noncopyable.h">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Common\je_temporary.h">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Common\je_pool.hpp">
+ <Filter>source\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Graphics\je_graphic.h">
+ <Filter>source\graphics</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Game\je_entity.h">
+ <Filter>source\game</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\Game\je_application.h">
+ <Filter>source\game</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\game\je_entity.h">
- <Filter>Source\game</Filter>
+ <ClInclude Include="..\..\..\src\libjin\Game\je_gameobject.h">
+ <Filter>source\game</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\libjin\graphics\je_sprite_batch.h">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle_emitter.h">
- <Filter>Source\graphics\particle</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\je_sprite_sheet.h">
+ <Filter>source\graphics</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle.h">
- <Filter>Source\graphics\particle</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\built-in\je_default.shader.h">
+ <Filter>source\graphics\shaders\built-in</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle_batch.h">
- <Filter>Source\graphics\particle</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\built-in\je_font.shader.h">
+ <Filter>source\graphics\shaders\built-in</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\particle\je_particle_system.h">
- <Filter>Source\graphics\particle</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\built-in\je_texture.shader.h">
+ <Filter>source\graphics\shaders\built-in</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\ai\je_behavior_tree.h">
- <Filter>Source\ai</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\je_base.shader.h">
+ <Filter>source\graphics\shaders</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\ai\je_state_machine.h">
- <Filter>Source\ai</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\je_jsl_compiler.h">
+ <Filter>source\graphics\shaders</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\animation\je_animation.h">
- <Filter>Source\graphics\animation</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\shaders\je_shader.h">
+ <Filter>source\graphics\shaders</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\graphics\animation\je_clip.h">
- <Filter>Source\graphics\animation</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle.h">
+ <Filter>source\graphics\particles</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Common\je_object.h">
- <Filter>Source\common</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle_emitter.h">
+ <Filter>source\graphics\particles</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Common\je_noncopyable.h">
- <Filter>Source\common</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle_pool.h">
+ <Filter>source\graphics\particles</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Common\je_temporary.h">
- <Filter>Source\common</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\particles\je_particle_system.h">
+ <Filter>source\graphics\particles</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Common\je_pool.hpp">
- <Filter>Source\common</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_decoder.h">
+ <Filter>source\graphics\fonts</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\src\libjin\Graphics\je_graphic.h">
- <Filter>Source\graphics</Filter>
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_font.h">
+ <Filter>source\graphics\fonts</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_page.h">
+ <Filter>source\graphics\fonts</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_text.h">
+ <Filter>source\graphics\fonts</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_texture_font.h">
+ <Filter>source\graphics\fonts</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\graphics\fonts\je_ttf.h">
+ <Filter>source\graphics\fonts</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\graphics\animations\je_animation.h">
+ <Filter>source\graphics\animations</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\graphics\animations\je_animator.h">
+ <Filter>source\graphics\animations</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\ai\je_ai.h">
+ <Filter>source\ai</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\threads\je_thread.h">
+ <Filter>source\threads</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\math\je_bezier_curve.h">
+ <Filter>source\math</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\src\libjin\math\je_ellipse.h">
+ <Filter>source\math</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\src\libjin\README.md">
- <Filter>Source</Filter>
+ <Filter>source</Filter>
</None>
<None Include="..\..\..\src\libjin\math\README.md">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</None>
<None Include="..\..\..\src\libjin\core\README.md">
- <Filter>Source\core</Filter>
+ <Filter>source\core</Filter>
</None>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\..\src\libjin\3rdparty\GLee\GLee.c">
- <Filter>Source\3rdparty\GLee</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\3rdparty\stb\stb_vorbis.c">
- <Filter>Source\3rdparty\stb</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\3rdparty\wav\wav.c">
- <Filter>Source\3rdparty\wav</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\3rdparty\tekcos\tekcos.c">
- <Filter>Source\3rdparty\tekcos</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\3rdparty\smount\smount.c">
- <Filter>Source\3rdparty\smount</Filter>
- </ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_mesh.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_bitmap.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_window.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_texture.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_sprite.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_shapes.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_gl.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_image.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_color.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Graphics\je_canvas.cpp">
- <Filter>Source\graphics</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\Shader\je_shader.cpp">
- <Filter>Source\graphics\shader</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_decoder.cpp">
- <Filter>Source\graphics\font</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_text.cpp">
- <Filter>Source\graphics\font</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_texture_font.cpp">
- <Filter>Source\graphics\font</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\Font\je_ttf.cpp">
- <Filter>Source\graphics\font</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Utils\je_unittest.cpp">
- <Filter>Source\utils</Filter>
+ <Filter>source\utils</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Utils\je_log.cpp">
- <Filter>Source\utils</Filter>
+ <Filter>source\utils</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Time\je_timer.cpp">
- <Filter>Source\time</Filter>
+ <Filter>source\time</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Net\je_socket.cpp">
- <Filter>Source\net</Filter>
+ <Filter>source\net</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Math\je_matrix.cpp">
- <Filter>Source\math</Filter>
+ <Filter>source\math</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Input\je_mouse.cpp">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Input\je_keyboard.cpp">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Input\je_joypad.cpp">
- <Filter>Source\input</Filter>
+ <Filter>source\input</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Input\je_event.cpp">
- <Filter>Source\input</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Game\je_game.cpp">
- <Filter>Source\game</Filter>
+ <Filter>source\input</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Common\je_exception.cpp">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Common\je_utf8.cpp">
- <Filter>Source\common</Filter>
+ <Filter>source\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Audio\je_source.cpp">
- <Filter>Source\audio</Filter>
+ <Filter>source\audio</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Audio\SDL\je_sdl_source.cpp">
- <Filter>Source\audio\sdl</Filter>
+ <Filter>source\audio\sdl</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Audio\SDL\je_sdl_audio.cpp">
- <Filter>Source\audio\sdl</Filter>
+ <Filter>source\audio\sdl</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Filesystem\je_asset_database.cpp">
- <Filter>Source\filesystem</Filter>
+ <Filter>source\filesystem</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Net\je_net_manager.cpp">
- <Filter>Source\net</Filter>
+ <Filter>source\net</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\Audio\je_audio_manager.cpp">
- <Filter>Source\audio</Filter>
+ <Filter>source\audio</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\multithread\je_thread.cpp">
- <Filter>Source\multithread</Filter>
+ <ClCompile Include="..\..\..\src\libjin\ai\je_behavior_tree.cpp">
+ <Filter>source\ai</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\ai\je_state_machine.cpp">
+ <Filter>source\ai</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\shader\je_jsl_compiler.cpp">
- <Filter>Source\graphics\shader</Filter>
+ <ClCompile Include="..\..\..\src\libjin\Game\je_scene.cpp">
+ <Filter>source\game</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\Graphics\je_graphic.cpp">
+ <Filter>source\graphics</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\Game\je_entity.cpp">
+ <Filter>source\game</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\Game\je_application.cpp">
+ <Filter>source\game</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\Game\je_gameobject.cpp">
+ <Filter>source\game</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\libjin\graphics\je_sprite_batch.cpp">
- <Filter>Source\graphics</Filter>
+ <Filter>source\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle_system.cpp">
- <Filter>Source\graphics\particle</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\je_sprite_sheet.cpp">
+ <Filter>source\graphics</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle_emitter.cpp">
- <Filter>Source\graphics\particle</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\shaders\je_jsl_compiler.cpp">
+ <Filter>source\graphics\shaders</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle.cpp">
- <Filter>Source\graphics\particle</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\shaders\je_shader.cpp">
+ <Filter>source\graphics\shaders</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\particle\je_particle_batch.cpp">
- <Filter>Source\graphics\particle</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\particles\je_particle.cpp">
+ <Filter>source\graphics\particles</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\ai\je_behavior_tree.cpp">
- <Filter>Source\ai</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\particles\je_particle_emitter.cpp">
+ <Filter>source\graphics\particles</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\ai\je_state_machine.cpp">
- <Filter>Source\ai</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\particles\je_particle_system.cpp">
+ <Filter>source\graphics\particles</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\animation\je_animation.cpp">
- <Filter>Source\graphics\animation</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_decoder.cpp">
+ <Filter>source\graphics\fonts</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\graphics\animation\je_clip.cpp">
- <Filter>Source\graphics\animation</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_text.cpp">
+ <Filter>source\graphics\fonts</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Game\je_entity.cpp">
- <Filter>Source\game</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_texture_font.cpp">
+ <Filter>source\graphics\fonts</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Game\je_scene.cpp">
- <Filter>Source\game</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\fonts\je_ttf.cpp">
+ <Filter>source\graphics\fonts</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\src\libjin\Graphics\je_graphic.cpp">
- <Filter>Source\graphics</Filter>
+ <ClCompile Include="..\..\..\src\libjin\graphics\animations\je_animation.cpp">
+ <Filter>source\graphics\animations</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\graphics\animations\je_animator.cpp">
+ <Filter>source\graphics\animations</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\threads\je_thread.cpp">
+ <Filter>source\threads</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\math\je_random.cpp">
+ <Filter>source\math</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\math\je_bezier_curve.cpp">
+ <Filter>source\math</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\src\libjin\math\je_ellipse.cpp">
+ <Filter>source\math</Filter>
</ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll b/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll
deleted file mode 100644
index 991a1ba..0000000
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/BUGS.txt b/build/vc++/libs/SDL2-2.0.5/BUGS.txt
deleted file mode 100644
index a8e6b95..0000000
--- a/build/vc++/libs/SDL2-2.0.5/BUGS.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-Bugs are now managed in the SDL bug tracker, here:
-
- https://bugzilla.libsdl.org/
-
-You may report bugs there, and search to see if a given issue has already
- been reported, discussed, and maybe even fixed.
-
-
-You may also find help at the SDL forums/mailing list:
-
- https://discourse.libsdl.org/
-
-Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
- bugs discussed on the mailing list may be forgotten or missed.
-
diff --git a/build/vc++/libs/SDL2-2.0.5/COPYING.txt b/build/vc++/libs/SDL2-2.0.5/COPYING.txt
deleted file mode 100644
index a1c8bbe..0000000
--- a/build/vc++/libs/SDL2-2.0.5/COPYING.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Simple DirectMedia Layer
-Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
diff --git a/build/vc++/libs/SDL2-2.0.5/README-SDL.txt b/build/vc++/libs/SDL2-2.0.5/README-SDL.txt
deleted file mode 100644
index 8d92955..0000000
--- a/build/vc++/libs/SDL2-2.0.5/README-SDL.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Please distribute this file with the SDL runtime environment:
-
-The Simple DirectMedia Layer (SDL for short) is a cross-platform library
-designed to make it easy to write multi-media software, such as games
-and emulators.
-
-The Simple DirectMedia Layer library source code is available from:
-https://www.libsdl.org/
-
-This library is distributed under the terms of the zlib license:
-http://www.zlib.net/zlib_license.html
-
diff --git a/build/vc++/libs/SDL2-2.0.5/README.txt b/build/vc++/libs/SDL2-2.0.5/README.txt
deleted file mode 100644
index 431ba0e..0000000
--- a/build/vc++/libs/SDL2-2.0.5/README.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-
- Simple DirectMedia Layer
-
- (SDL)
-
- Version 2.0
-
----
-https://www.libsdl.org/
-
-Simple DirectMedia Layer is a cross-platform development library designed
-to provide low level access to audio, keyboard, mouse, joystick, and graphics
-hardware via OpenGL and Direct3D. It is used by video playback software,
-emulators, and popular games including Valve's award winning catalog
-and many Humble Bundle games.
-
-More extensive documentation is available in the docs directory, starting
-with README.md
-
-Enjoy!
- Sam Lantinga (slouken@libsdl.org)
diff --git a/build/vc++/libs/SDL2-2.0.5/WhatsNew.txt b/build/vc++/libs/SDL2-2.0.5/WhatsNew.txt
deleted file mode 100644
index 9c8d538..0000000
--- a/build/vc++/libs/SDL2-2.0.5/WhatsNew.txt
+++ /dev/null
@@ -1,349 +0,0 @@
-
-This is a list of major changes in SDL's version history.
-
----------------------------------------------------------------------------
-2.0.7:
----------------------------------------------------------------------------
-
-General:
-* Added audio stream conversion functions:
- SDL_NewAudioStream
- SDL_AudioStreamPut
- SDL_AudioStreamGet
- SDL_AudioStreamAvailable
- SDL_AudioStreamFlush
- SDL_AudioStreamClear
- SDL_FreeAudioStream
-* Added functions to query and set the SDL memory allocation functions:
- SDL_GetMemoryFunctions()
- SDL_SetMemoryFunctions()
- SDL_GetNumAllocations()
-* Added locking functions for multi-threaded access to the joystick and game controller APIs:
- SDL_LockJoysticks()
- SDL_UnlockJoysticks()
-* The following functions are now thread-safe:
- SDL_SetEventFilter()
- SDL_GetEventFilter()
- SDL_AddEventWatch()
- SDL_DelEventWatch()
-
-
-General:
----------------------------------------------------------------------------
-2.0.6:
----------------------------------------------------------------------------
-
-General:
-* Added cross-platform Vulkan graphics support in SDL_vulkan.h
- SDL_Vulkan_LoadLibrary()
- SDL_Vulkan_GetVkGetInstanceProcAddr()
- SDL_Vulkan_GetInstanceExtensions()
- SDL_Vulkan_CreateSurface()
- SDL_Vulkan_GetDrawableSize()
- SDL_Vulkan_UnloadLibrary()
- This is all the platform-specific code you need to bring up Vulkan on all SDL platforms. You can look at an example in test/testvulkan.c
-* Added SDL_ComposeCustomBlendMode() to create custom blend modes for 2D rendering
-* Added SDL_HasNEON() which returns whether the CPU has NEON instruction support
-* Added support for many game controllers, including the Nintendo Switch Pro Controller
-* Added support for inverted axes and separate axis directions in game controller mappings
-* Added functions to return information about a joystick before it's opened:
- SDL_JoystickGetDeviceVendor()
- SDL_JoystickGetDeviceProduct()
- SDL_JoystickGetDeviceProductVersion()
- SDL_JoystickGetDeviceType()
- SDL_JoystickGetDeviceInstanceID()
-* Added functions to return information about an open joystick:
- SDL_JoystickGetVendor()
- SDL_JoystickGetProduct()
- SDL_JoystickGetProductVersion()
- SDL_JoystickGetType()
- SDL_JoystickGetAxisInitialState()
-* Added functions to return information about an open game controller:
- SDL_GameControllerGetVendor()
- SDL_GameControllerGetProduct()
- SDL_GameControllerGetProductVersion()
-* Added SDL_GameControllerNumMappings() and SDL_GameControllerMappingForIndex() to be able to enumerate the built-in game controller mappings
-* Added SDL_LoadFile() and SDL_LoadFile_RW() to load a file into memory
-* Added SDL_DuplicateSurface() to make a copy of a surface
-* Added an experimental JACK audio driver
-* Implemented non-power-of-two audio resampling, optionally using libsamplerate to perform the resampling
-* Added the hint SDL_HINT_AUDIO_RESAMPLING_MODE to control the quality of resampling
-* Added the hint SDL_HINT_RENDER_LOGICAL_SIZE_MODE to control the scaling policy for SDL_RenderSetLogicalSize():
- "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen (the default)
- "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
-* Added the hints SDL_HINT_MOUSE_NORMAL_SPEED_SCALE and SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE to scale the mouse speed when being read from raw mouse input
-* Added the hint SDL_HINT_TOUCH_MOUSE_EVENTS to control whether SDL will synthesize mouse events from touch events
-
-Windows:
-* The new default audio driver on Windows is WASAPI and supports hot-plugging devices and changing the default audio device
-* The old XAudio2 audio driver is deprecated and will be removed in the next release
-* Added hints SDL_HINT_WINDOWS_INTRESOURCE_ICON and SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL to specify a custom icon resource ID for SDL windows
-* The hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING is now on by default for compatibility with .NET languages and various Windows debuggers
-* Updated the GUID format for game controller mappings, older mappings will be automatically converted on load
-* Implemented the SDL_WINDOW_ALWAYS_ON_TOP flag on Windows
-
-Linux:
-* Added an experimental KMS/DRM video driver for embedded development
-
-iOS:
-* Added a hint SDL_HINT_AUDIO_CATEGORY to control the audio category, determining whether the phone mute switch affects the audio
-
----------------------------------------------------------------------------
-2.0.5:
----------------------------------------------------------------------------
-
-General:
-* Implemented audio capture support for some platforms
-* Added SDL_DequeueAudio() to retrieve audio when buffer queuing is turned on for audio capture
-* Added events for dragging and dropping text
-* Added events for dragging and dropping multiple items
-* By default the click raising a window will not be delivered to the SDL application. You can set the hint SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH to "1" to allow that click through to the window.
-* Saving a surface with an alpha channel as a BMP will use a newer BMP format that supports alpha information. You can set the hint SDL_HINT_BMP_SAVE_LEGACY_FORMAT to "1" to use the old format.
-* Added SDL_GetHintBoolean() to get the boolean value of a hint
-* Added SDL_RenderSetIntegerScale() to set whether to smoothly scale or use integral multiples of the viewport size when scaling the rendering output
-* Added SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() to create an SDL surface with a specific pixel format
-* Added SDL_GetDisplayUsableBounds() which returns the area usable for windows. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock.
-* Added SDL_GetWindowBordersSize() which returns the size of the window's borders around the client area
-* Added a window event SDL_WINDOWEVENT_HIT_TEST when a window had a hit test that wasn't SDL_HITTEST_NORMAL (e.g. in the title bar or window frame)
-* Added SDL_SetWindowResizable() to change whether a window is resizable
-* Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity() to affect the window transparency
-* Added SDL_SetWindowModalFor() to set a window as modal for another window
-* Added support for AUDIO_U16LSB and AUDIO_U16MSB to SDL_MixAudioFormat()
-* Fixed flipped images when reading back from target textures when using the OpenGL renderer
-* Fixed texture color modulation with SDL_BLENDMODE_NONE when using the OpenGL renderer
-* Fixed bug where the alpha value of colorkeys was ignored when blitting in some cases
-
-Windows:
-* Added a hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING to prevent SDL from raising a debugger exception to name threads. This exception can cause problems with .NET applications when running under a debugger.
-* The hint SDL_HINT_THREAD_STACK_SIZE is now supported on Windows
-* Fixed XBox controller triggers automatically being pulled at startup
-* The first icon from the executable is used as the default window icon at runtime
-* Fixed SDL log messages being printed twice if SDL was built with C library support
-* Reset dead keys when the SDL window loses focus, so dead keys pressed in SDL applications don't affect text input into other applications.
-
-Mac OS X:
-* Fixed selecting the dummy video driver
-* The caps lock key now generates a pressed event when pressed and a released event when released, instead of a press/release event pair when pressed.
-* Fixed mouse wheel events on Mac OS X 10.12
-* The audio driver has been updated to use AVFoundation for better compatibility with newer versions of Mac OS X
-
-Linux:
-* Added support for the Fcitx IME
-* Added a window event SDL_WINDOWEVENT_TAKE_FOCUS when a window manager asks the SDL window whether it wants to take focus.
-* Refresh rates are now rounded instead of truncated, e.g. 59.94 Hz is rounded up to 60 Hz instead of 59.
-* Added initial support for touchscreens on Raspberry Pi
-
-OpenBSD:
-* SDL_GetBasePath() is now implemented on OpenBSD
-
-iOS:
-* Added support for dynamically loaded objects on iOS 8 and newer
-
-tvOS:
-* Added support for Apple TV
-* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote.
-
-Android:
-* Fixed SDL not resizing window when Android screen resolution changes
-* Corrected the joystick Z axis reporting for the accelerometer
-
-Emscripten (running in a web browser):
-* Many bug fixes and improvements
-
-
----------------------------------------------------------------------------
-2.0.4:
----------------------------------------------------------------------------
-
-General:
-* Added support for web applications using Emscripten, see docs/README-emscripten.md for more information
-* Added support for web applications using Native Client (NaCl), see docs/README-nacl.md for more information
-* Added an API to queue audio instead of using the audio callback:
- SDL_QueueAudio(), SDL_GetQueuedAudioSize(), SDL_ClearQueuedAudio()
-* Added events for audio device hot plug support:
- SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED
-* Added SDL_PointInRect()
-* Added SDL_HasAVX2() to detect CPUs with AVX2 support
-* Added SDL_SetWindowHitTest() to let apps treat parts of their SDL window like traditional window decorations (drag areas, resize areas)
-* Added SDL_GetGrabbedWindow() to get the window that currently has input grab, if any
-* Added SDL_RenderIsClipEnabled() to tell whether clipping is currently enabled in a renderer
-* Added SDL_CaptureMouse() to capture the mouse to get events while the mouse is not in your window
-* Added SDL_WarpMouseGlobal() to warp the mouse cursor in global screen space
-* Added SDL_GetGlobalMouseState() to get the current mouse state outside of an SDL window
-* Added a direction field to mouse wheel events to tell whether they are flipped (natural) or not
-* Added GL_CONTEXT_RELEASE_BEHAVIOR GL attribute (maps to [WGL|GLX]_ARB_context_flush_control extension)
-* Added EGL_KHR_create_context support to allow OpenGL ES version selection on some platforms
-* Added NV12 and NV21 YUV texture support for OpenGL and OpenGL ES 2.0 renderers
-* Added a Vivante video driver that is used on various SoC platforms
-* Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers when the D3D device is lost, and from Android's event loop when the GLES context had to be recreated
-* Added a hint SDL_HINT_NO_SIGNAL_HANDLERS to disable SDL's built in signal handling
-* Added a hint SDL_HINT_THREAD_STACK_SIZE to set the stack size of SDL's threads
-* Added SDL_sqrtf(), SDL_tan(), and SDL_tanf() to the stdlib routines
-* Improved support for WAV and BMP files with unusual chunks in them
-* Renamed SDL_assert_data to SDL_AssertData and SDL_assert_state to SDL_AssertState
-* Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden
-* Added SDL_GetDisplayDPI() to get the DPI information for a display
-* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick
-* Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to.
-* Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to.
-
-Windows:
-* Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform)
-* Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint
-* SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds
-* Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage()
-* Added a hint SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP to control whether SDL_PumpEvents() processes the Windows message loop
-* You can distinguish between real mouse and touch events by looking for SDL_TOUCH_MOUSEID in the mouse event "which" field
-* SDL_SysWMinfo now contains the window HDC
-* Added support for Unicode command line options
-* Prevent beeping when Alt-key combos are pressed
-* SDL_SetTextInputRect() re-positions the OS-rendered IME
-* Added a hint SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 to prevent generating SDL_WINDOWEVENT_CLOSE events when Alt-F4 is pressed
-* Added a hint SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING to use the old axis and button mapping for XInput devices (deprecated)
-
-Mac OS X:
-* Implemented drag-and-drop support
-* Improved joystick hot-plug detection
-* The SDL_WINDOWEVENT_EXPOSED window event is triggered in the appropriate situations
-* Fixed relative mouse mode when the application loses/regains focus
-* Fixed bugs related to transitioning to and from Spaces-aware fullscreen-desktop mode
-* Fixed the refresh rate of display modes
-* SDL_SysWMInfo is now ARC-compatible
-* Added a hint SDL_HINT_MAC_BACKGROUND_APP to prevent forcing the application to become a foreground process
-
-Linux:
-* Enabled building with Mir and Wayland support by default.
-* Added IBus IME support
-* Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events
-* Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow()
-* Added support for multiple audio devices when using Pulseaudio
-* Fixed duplicate mouse events when using relative mouse motion
-
-iOS:
-* Added support for iOS 8
-* The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels
-* SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" / "screen coordinates" coordinate space rather than pixels (matches OS X behavior)
-* Added native resolution support for the iPhone 6 Plus
-* Added support for MFi game controllers
-* Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK
-* Added sRGB OpenGL ES context support on iOS 7+
-* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER
-* SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view
-* Fixed various rotation and orientation issues
-* Fixed memory leaks
-
-Android:
-* Added a hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH to prevent mouse events from being registered as touch events
-* Added hints SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION and SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION
-* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER
-* Added support for SDL_ShowMessageBox() and SDL_ShowSimpleMessageBox()
-
-Raspberry Pi:
-* Added support for the Raspberry Pi 2
-
-
----------------------------------------------------------------------------
-2.0.3:
----------------------------------------------------------------------------
-
-Mac OS X:
-* Fixed creating an OpenGL context by default on Mac OS X 10.6
-
-
----------------------------------------------------------------------------
-2.0.2:
----------------------------------------------------------------------------
-General:
-* Added SDL_GL_ResetAttributes() to reset OpenGL attributes to default values
-* Added an API to load a database of game controller mappings from a file:
- SDL_GameControllerAddMappingsFromFile(), SDL_GameControllerAddMappingsFromRW()
-* Added game controller mappings for the PS4 and OUYA controllers
-* Added SDL_GetDefaultAssertionHandler() and SDL_GetAssertionHandler()
-* Added SDL_DetachThread()
-* Added SDL_HasAVX() to determine if the CPU has AVX features
-* Added SDL_vsscanf(), SDL_acos(), and SDL_asin() to the stdlib routines
-* EGL can now create/manage OpenGL and OpenGL ES 1.x/2.x contexts, and share
- them using SDL_GL_SHARE_WITH_CURRENT_CONTEXT
-* Added a field "clicks" to the mouse button event which records whether the event is a single click, double click, etc.
-* The screensaver is now disabled by default, and there is a hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER that can change that behavior.
-* Added a hint SDL_HINT_MOUSE_RELATIVE_MODE_WARP to specify whether mouse relative mode should be emulated using mouse warping.
-* testgl2 does not need to link with libGL anymore
-* Added testgles2 test program to demonstrate working with OpenGL ES 2.0
-* Added controllermap test program to visually map a game controller
-
-Windows:
-* Support for OpenGL ES 2.x contexts using either WGL or EGL (natively via
- the driver or emulated through ANGLE)
-* Added a hint SDL_HINT_VIDEO_WIN_D3DCOMPILER to specify which D3D shader compiler to use for OpenGL ES 2 support through ANGLE
-* Added a hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that is useful when creating multiple windows that should share the same OpenGL context.
-* Added an event SDL_RENDER_TARGETS_RESET that is sent when D3D9 render targets are reset after the device has been restored.
-
-Mac OS X:
-* Added a hint SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK to control whether Ctrl+click should be treated as a right click on Mac OS X. This is off by default.
-
-Linux:
-* Fixed fullscreen and focused behavior when receiving NotifyGrab events
-* Added experimental Wayland and Mir support, disabled by default
-
-Android:
-* Joystick support (minimum SDK version required to build SDL is now 12,
- the required runtime version remains at 10, but on such devices joystick
- support won't be available).
-* Hotplugging support for joysticks
-* Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default.
-
-
----------------------------------------------------------------------------
-2.0.1:
----------------------------------------------------------------------------
-
-General:
-* Added an API to get common filesystem paths in SDL_filesystem.h:
- SDL_GetBasePath(), SDL_GetPrefPath()
-* Added an API to do optimized YV12 and IYUV texture updates:
- SDL_UpdateYUVTexture()
-* Added an API to get the amount of RAM on the system:
- SDL_GetSystemRAM()
-* Added a macro to perform timestamp comparisons with SDL_GetTicks():
- SDL_TICKS_PASSED()
-* Dramatically improved OpenGL ES 2.0 rendering performance
-* Added OpenGL attribute SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
-
-Windows:
-* Created a static library configuration for the Visual Studio 2010 project
-* Added a hint to create the Direct3D device with support for multi-threading:
- SDL_HINT_RENDER_DIRECT3D_THREADSAFE
-* Added a function to get the D3D9 adapter index for a display:
- SDL_Direct3D9GetAdapterIndex()
-* Added a function to get the D3D9 device for a D3D9 renderer:
- SDL_RenderGetD3D9Device()
-* Fixed building SDL with the mingw32 toolchain (mingw-w64 is preferred)
-* Fixed crash when using two XInput controllers at the same time
-* Fixed detecting a mixture of XInput and DirectInput controllers
-* Fixed clearing a D3D render target larger than the window
-* Improved support for format specifiers in SDL_snprintf()
-
-Mac OS X:
-* Added support for retina displays:
- Create your window with the SDL_WINDOW_ALLOW_HIGHDPI flag, and then use SDL_GL_GetDrawableSize() to find the actual drawable size. You are responsible for scaling mouse and drawing coordinates appropriately.
-* Fixed mouse warping in fullscreen mode
-* Right mouse click is emulated by holding the Ctrl key while left clicking
-
-Linux:
-* Fixed float audio support with the PulseAudio driver
-* Fixed missing line endpoints in the OpenGL renderer on some drivers
-* X11 symbols are no longer defined to avoid collisions when linking statically
-
-iOS:
-* Fixed status bar visibility on iOS 7
-* Flipped the accelerometer Y axis to match expected values
-
-Android:
-IMPORTANT: You MUST get the updated SDLActivity.java to match C code
-* Moved EGL initialization to native code
-* Fixed the accelerometer axis rotation relative to the device rotation
-* Fixed race conditions when handling the EGL context on pause/resume
-* Touch devices are available for enumeration immediately after init
-
-Raspberry Pi:
-* Added support for the Raspberry Pi, see README-raspberrypi.txt for details
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-android.md b/build/vc++/libs/SDL2-2.0.5/docs/README-android.md
deleted file mode 100644
index 62874f4..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-android.md
+++ /dev/null
@@ -1,484 +0,0 @@
-Android
-================================================================================
-
-Matt Styles wrote a tutorial on building SDL for Android with Visual Studio:
-http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html
-
-The rest of this README covers the old style build process.
-
-================================================================================
- Requirements
-================================================================================
-
-Android SDK (version 16 or later)
-https://developer.android.com/sdk/index.html
-
-Android NDK r7 or later
-https://developer.android.com/tools/sdk/ndk/index.html
-
-Minimum API level supported by SDL: 10 (Android 2.3.3)
-Joystick support is available for API level >= 12 devices.
-
-================================================================================
- How the port works
-================================================================================
-
-- Android applications are Java-based, optionally with parts written in C
-- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
- the SDL library
-- This means that your application C code must be placed inside an Android
- Java project, along with some C support code that communicates with Java
-- This eventually produces a standard Android .apk package
-
-The Android Java code implements an "Activity" and can be found in:
-android-project/src/org/libsdl/app/SDLActivity.java
-
-The Java code loads your game code, the SDL shared library, and
-dispatches to native functions implemented in the SDL library:
-src/core/android/SDL_android.c
-
-Your project must include some glue code that starts your main() routine:
-src/main/android/SDL_android_main.c
-
-
-================================================================================
- Building an app
-================================================================================
-
-For simple projects you can use the script located at build-scripts/androidbuild.sh
-
-There's two ways of using it:
-
- androidbuild.sh com.yourcompany.yourapp < sources.list
- androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
-
-sources.list should be a text file with a source file name in each line
-Filenames should be specified relative to the current directory, for example if
-you are in the build-scripts directory and want to create the testgles.c test, you'll
-run:
-
- ./androidbuild.sh org.libsdl.testgles ../test/testgles.c
-
-One limitation of this script is that all sources provided will be aggregated into
-a single directory, thus all your source files should have a unique name.
-
-Once the project is complete the script will tell you where the debug APK is located.
-If you want to create a signed release APK, you can use the project created by this
-utility to generate it.
-
-Finally, a word of caution: re running androidbuild.sh wipes any changes you may have
-done in the build directory for the app!
-
-
-For more complex projects, follow these instructions:
-
-1. Copy the android-project directory wherever you want to keep your projects
- and rename it to the name of your project.
-2. Move or symlink this SDL directory into the "<project>/jni" directory
-3. Edit "<project>/jni/src/Android.mk" to include your source files
-4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
-
-If you want to use the Eclipse IDE, skip to the Eclipse section below.
-
-5. Create "<project>/local.properties" and use that to point to the Android SDK directory, by writing a line with the following form:
-
- sdk.dir=PATH_TO_ANDROID_SDK
-
-6. Run 'ant debug' in android/project. This compiles the .java and eventually
- creates a .apk with the native code embedded
-7. 'ant debug install' will push the apk to the device or emulator (if connected)
-
-Here's an explanation of the files in the Android project, so you can customize them:
-
- android-project/
- AndroidManifest.xml - package manifest. Among others, it contains the class name
- of the main Activity and the package name of the application.
- build.properties - empty
- build.xml - build description file, used by ant. The actual application name
- is specified here.
- default.properties - holds the target ABI for the application, android-10 and up
- project.properties - holds the target ABI for the application, android-10 and up
- local.properties - holds the SDK path, you should change this to the path to your SDK
- jni/ - directory holding native code
- jni/Android.mk - Android makefile that can call recursively the Android.mk files
- in all subdirectories
- jni/SDL/ - (symlink to) directory holding the SDL library files
- jni/SDL/Android.mk - Android makefile for creating the SDL shared library
- jni/src/ - directory holding your C/C++ source
- jni/src/Android.mk - Android makefile that you should customize to include your
- source code and any library references
- res/ - directory holding resources for your application
- res/drawable-* - directories holding icons for different phone hardware. Could be
- one dir called "drawable".
- res/layout/main.xml - Usually contains a file main.xml, which declares the screen layout.
- We don't need it because we use the SDL video output.
- res/values/strings.xml - strings used in your application, including the application name
- shown on the phone.
- src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding
- to SDL. Be very careful changing this, as the SDL library relies
- on this implementation.
-
-
-================================================================================
- Build an app with static linking of libSDL
-================================================================================
-
-This build uses the Android NDK module system.
-
-Instructions:
-1. Copy the android-project directory wherever you want to keep your projects
- and rename it to the name of your project.
-2. Rename "<project>/jni/src/Android_static.mk" to "<project>/jni/src/Android.mk"
- (overwrite the existing one)
-3. Edit "<project>/jni/src/Android.mk" to include your source files
-4. create and export an environment variable named NDK_MODULE_PATH that points
- to the parent directory of this SDL directory. e.g.:
-
- export NDK_MODULE_PATH="$PWD"/..
-
-5. Edit "<project>/src/org/libsdl/app/SDLActivity.java" and remove the call to
- System.loadLibrary("SDL2").
-6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
-
-
-================================================================================
- Customizing your application name
-================================================================================
-
-To customize your application name, edit AndroidManifest.xml and replace
-"org.libsdl.app" with an identifier for your product package.
-
-Then create a Java class extending SDLActivity and place it in a directory
-under src matching your package, e.g.
-
- src/com/gamemaker/game/MyGame.java
-
-Here's an example of a minimal class file:
-
- --- MyGame.java --------------------------
- package com.gamemaker.game;
-
- import org.libsdl.app.SDLActivity;
-
- /**
- * A sample wrapper class that just calls SDLActivity
- */
-
- public class MyGame extends SDLActivity { }
-
- ------------------------------------------
-
-Then replace "SDLActivity" in AndroidManifest.xml with the name of your
-class, .e.g. "MyGame"
-
-================================================================================
- Customizing your application icon
-================================================================================
-
-Conceptually changing your icon is just replacing the "ic_launcher.png" files in
-the drawable directories under the res directory. There are four directories for
-different screen sizes. These can be replaced with one dir called "drawable",
-containing an icon file "ic_launcher.png" with dimensions 48x48 or 72x72.
-
-You may need to change the name of your icon in AndroidManifest.xml to match
-this icon filename.
-
-================================================================================
- Loading assets
-================================================================================
-
-Any files you put in the "assets" directory of your android-project directory
-will get bundled into the application package and you can load them using the
-standard functions in SDL_rwops.h.
-
-There are also a few Android specific functions that allow you to get other
-useful paths for saving and loading data:
-* SDL_AndroidGetInternalStoragePath()
-* SDL_AndroidGetExternalStorageState()
-* SDL_AndroidGetExternalStoragePath()
-
-See SDL_system.h for more details on these functions.
-
-The asset packaging system will, by default, compress certain file extensions.
-SDL includes two asset file access mechanisms, the preferred one is the so
-called "File Descriptor" method, which is faster and doesn't involve the Dalvik
-GC, but given this method does not work on compressed assets, there is also the
-"Input Stream" method, which is automatically used as a fall back by SDL. You
-may want to keep this fact in mind when building your APK, specially when large
-files are involved.
-For more information on which extensions get compressed by default and how to
-disable this behaviour, see for example:
-
-http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
-
-================================================================================
- Pause / Resume behaviour
-================================================================================
-
-If SDL is compiled with SDL_ANDROID_BLOCK_ON_PAUSE defined (the default),
-the event loop will block itself when the app is paused (ie, when the user
-returns to the main Android dashboard). Blocking is better in terms of battery
-use, and it allows your app to spring back to life instantaneously after resume
-(versus polling for a resume message).
-
-Upon resume, SDL will attempt to restore the GL context automatically.
-In modern devices (Android 3.0 and up) this will most likely succeed and your
-app can continue to operate as it was.
-
-However, there's a chance (on older hardware, or on systems under heavy load),
-where the GL context can not be restored. In that case you have to listen for
-a specific message, (which is not yet implemented!) and restore your textures
-manually or quit the app (which is actually the kind of behaviour you'll see
-under iOS, if the OS can not restore your GL context it will just kill your app)
-
-================================================================================
- Threads and the Java VM
-================================================================================
-
-For a quick tour on how Linux native threads interoperate with the Java VM, take
-a look here: https://developer.android.com/guide/practices/jni.html
-
-If you want to use threads in your SDL app, it's strongly recommended that you
-do so by creating them using SDL functions. This way, the required attach/detach
-handling is managed by SDL automagically. If you have threads created by other
-means and they make calls to SDL functions, make sure that you call
-Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
-your thread automatically anyway (when you make an SDL call), but it'll never
-detach it.
-
-================================================================================
- Using STL
-================================================================================
-
-You can use STL in your project by creating an Application.mk file in the jni
-folder and adding the following line:
-
- APP_STL := stlport_static
-
-For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
-
-================================================================================
- Additional documentation
-================================================================================
-
-The documentation in the NDK docs directory is very helpful in understanding the
-build process and how to work with native code on the Android platform.
-
-The best place to start is with docs/OVERVIEW.TXT
-
-
-================================================================================
- Using Eclipse
-================================================================================
-
-First make sure that you've installed Eclipse and the Android extensions as described here:
- https://developer.android.com/tools/sdk/eclipse-adt.html
-
-Once you've copied the SDL android project and customized it, you can create an Eclipse project from it:
- * File -> New -> Other
- * Select the Android -> Android Project wizard and click Next
- * Enter the name you'd like your project to have
- * Select "Create project from existing source" and browse for your project directory
- * Make sure the Build Target is set to Android 3.1 (API 12)
- * Click Finish
-
-
-================================================================================
- Using the emulator
-================================================================================
-
-There are some good tips and tricks for getting the most out of the
-emulator here: https://developer.android.com/tools/devices/emulator.html
-
-Especially useful is the info on setting up OpenGL ES 2.0 emulation.
-
-Notice that this software emulator is incredibly slow and needs a lot of disk space.
-Using a real device works better.
-
-================================================================================
- Troubleshooting
-================================================================================
-
-You can create and run an emulator from the Eclipse IDE:
- * Window -> Android SDK and AVD Manager
-
-You can see if adb can see any devices with the following command:
-
- adb devices
-
-You can see the output of log messages on the default device with:
-
- adb logcat
-
-You can push files to the device with:
-
- adb push local_file remote_path_and_file
-
-You can push files to the SD Card at /sdcard, for example:
-
- adb push moose.dat /sdcard/moose.dat
-
-You can see the files on the SD card with a shell command:
-
- adb shell ls /sdcard/
-
-You can start a command shell on the default device with:
-
- adb shell
-
-You can remove the library files of your project (and not the SDL lib files) with:
-
- ndk-build clean
-
-You can do a build with the following command:
-
- ndk-build
-
-You can see the complete command line that ndk-build is using by passing V=1 on the command line:
-
- ndk-build V=1
-
-If your application crashes in native code, you can use addr2line to convert the
-addresses in the stack trace to lines in your code.
-
-For example, if your crash looks like this:
-
- I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
- I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
- I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
- I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
- I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
- I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
- I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
- I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
- I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
-
-You can see that there's a crash in the C library being called from the main code.
-I run addr2line with the debug version of my code:
-
- arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
-
-and then paste in the number after "pc" in the call stack, from the line that I care about:
-000014bc
-
-I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
-
-You can add logging to your code to help show what's happening:
-
- #include <android/log.h>
-
- __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
-
-If you need to build without optimization turned on, you can create a file called
-"Application.mk" in the jni directory, with the following line in it:
-
- APP_OPTIM := debug
-
-
-================================================================================
- Memory debugging
-================================================================================
-
-The best (and slowest) way to debug memory issues on Android is valgrind.
-Valgrind has support for Android out of the box, just grab code using:
-
- svn co svn://svn.valgrind.org/valgrind/trunk valgrind
-
-... and follow the instructions in the file README.android to build it.
-
-One thing I needed to do on Mac OS X was change the path to the toolchain,
-and add ranlib to the environment variables:
-export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
-
-Once valgrind is built, you can create a wrapper script to launch your
-application with it, changing org.libsdl.app to your package identifier:
-
- --- start_valgrind_app -------------------
- #!/system/bin/sh
- export TMPDIR=/data/data/org.libsdl.app
- exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
- ------------------------------------------
-
-Then push it to the device:
-
- adb push start_valgrind_app /data/local
-
-and make it executable:
-
- adb shell chmod 755 /data/local/start_valgrind_app
-
-and tell Android to use the script to launch your application:
-
- adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
-
-If the setprop command says "could not set property", it's likely that
-your package name is too long and you should make it shorter by changing
-AndroidManifest.xml and the path to your class file in android-project/src
-
-You can then launch your application normally and waaaaaaaiiittt for it.
-You can monitor the startup process with the logcat command above, and
-when it's done (or even while it's running) you can grab the valgrind
-output file:
-
- adb pull /sdcard/valgrind.log
-
-When you're done instrumenting with valgrind, you can disable the wrapper:
-
- adb shell setprop wrap.org.libsdl.app ""
-
-================================================================================
- Graphics debugging
-================================================================================
-
-If you are developing on a compatible Tegra-based tablet, NVidia provides
-Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL
-and GLES libraries, you must follow their instructions for installing the
-interposer library on a rooted device. The non-rooted instructions are not
-compatible with applications that use SDL2 for video.
-
-The Tegra Graphics Debugger is available from NVidia here:
-https://developer.nvidia.com/tegra-graphics-debugger
-
-================================================================================
- Why is API level 10 the minimum required?
-================================================================================
-
-API level 10 is the minimum required level at runtime (that is, on the device)
-because SDL requires some functionality for running not
-available on older devices. Since the incorporation of joystick support into SDL,
-the minimum SDK required to *build* SDL is version 12. Devices running API levels
-10-11 are still supported, only with the joystick functionality disabled.
-
-Support for native OpenGL ES and ES2 applications was introduced in the NDK for
-API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which
-has since then been obsoleted, with the recommendation to developers to bump the
-required API level to 10.
-As of this writing, according to https://developer.android.com/about/dashboards/index.html
-about 90% of the Android devices accessing Google Play support API level 10 or
-higher (March 2013).
-
-================================================================================
- A note regarding the use of the "dirty rectangles" rendering technique
-================================================================================
-
-If your app uses a variation of the "dirty rectangles" rendering technique,
-where you only update a portion of the screen on each frame, you may notice a
-variety of visual glitches on Android, that are not present on other platforms.
-This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
-contexts, in particular the use of the eglSwapBuffers function. As stated in the
-documentation for the function "The contents of ancillary buffers are always
-undefined after calling eglSwapBuffers".
-Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
-is not possible for SDL as it requires EGL 1.4, available only on the API level
-17+, so the only workaround available on this platform is to redraw the entire
-screen each frame.
-
-Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
-
-================================================================================
- Known issues
-================================================================================
-
-- The number of buttons reported for each joystick is hardcoded to be 36, which
-is the current maximum number of buttons Android can report.
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-cmake.md b/build/vc++/libs/SDL2-2.0.5/docs/README-cmake.md
deleted file mode 100644
index db31860..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-cmake.md
+++ /dev/null
@@ -1,32 +0,0 @@
-CMake
-================================================================================
-(www.cmake.org)
-
-SDL's build system was traditionally based on autotools. Over time, this
-approach has suffered from several issues across the different supported
-platforms.
-To solve these problems, a new build system based on CMake is under development.
-It works in parallel to the legacy system, so users can experiment with it
-without complication.
-While still experimental, the build system should be usable on the following
-platforms:
-
-* FreeBSD
-* Linux
-* VS.NET 2010
-* MinGW and Msys
-* OS X with support for XCode
-
-
-================================================================================
-Usage
-================================================================================
-
-Assuming the source for SDL is located at ~/sdl
-
- cd ~
- mkdir build
- cd build
- cmake ../sdl
-
-This will build the static and dynamic versions of SDL in the ~/build directory.
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-directfb.md b/build/vc++/libs/SDL2-2.0.5/docs/README-directfb.md
deleted file mode 100644
index 67b64fb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-directfb.md
+++ /dev/null
@@ -1,107 +0,0 @@
-DirectFB
-========
-
-Supports:
-
-- Hardware YUV overlays
-- OpenGL - software only
-- 2D/3D accelerations (depends on directfb driver)
-- multiple displays
-- windows
-
-What you need:
-
-* DirectFB 1.0.1, 1.2.x, 1.3.0
-* Kernel-Framebuffer support: required: vesafb, radeonfb ....
-* Mesa 7.0.x - optional for OpenGL
-
-/etc/directfbrc
-
-This file should contain the following lines to make
-your joystick work and avoid crashes:
-------------------------
-disable-module=joystick
-disable-module=cle266
-disable-module=cyber5k
-no-linux-input-grab
-------------------------
-
-To disable to use x11 backend when DISPLAY variable is found use
-
-export SDL_DIRECTFB_X11_CHECK=0
-
-To disable the use of linux input devices, i.e. multimice/multikeyboard support,
-use
-
-export SDL_DIRECTFB_LINUX_INPUT=0
-
-To use hardware accelerated YUV-overlays for YUV-textures, use:
-
-export SDL_DIRECTFB_YUV_DIRECT=1
-
-This is disabled by default. It will only support one
-YUV texture, namely the first. Every other YUV texture will be
-rendered in software.
-
-In addition, you may use (directfb-1.2.x)
-
-export SDL_DIRECTFB_YUV_UNDERLAY=1
-
-to make the YUV texture an underlay. This will make the cursor to
-be shown.
-
-Simple Window Manager
-=====================
-
-The driver has support for a very, very basic window manager you may
-want to use when running with "wm=default". Use
-
-export SDL_DIRECTFB_WM=1
-
-to enable basic window borders. In order to have the window title rendered,
-you need to have the following font installed:
-
-/usr/share/fonts/truetype/freefont/FreeSans.ttf
-
-OpenGL Support
-==============
-
-The following instructions will give you *software* OpenGL. However this
-works at least on all directfb supported platforms.
-
-As of this writing 20100802 you need to pull Mesa from git and do the following:
-
-------------------------
-git clone git://anongit.freedesktop.org/git/mesa/mesa
-cd mesa
-git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
-------------------------
-
-Edit configs/linux-directfb so that the Directories-section looks like
-------------------------
-# Directories
-SRC_DIRS = mesa glu
-GLU_DIRS = sgi
-DRIVER_DIRS = directfb
-PROGRAM_DIRS =
-------------------------
-
-make linux-directfb
-make
-
-echo Installing - please enter sudo pw.
-
-sudo make install INSTALL_DIR=/usr/local/dfb_GL
-cd src/mesa/drivers/directfb
-make
-sudo make install INSTALL_DIR=/usr/local/dfb_GL
-------------------------
-
-To run the SDL - testprograms:
-
-export SDL_VIDEODRIVER=directfb
-export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
-export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
-
-./testgl
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-dynapi.md b/build/vc++/libs/SDL2-2.0.5/docs/README-dynapi.md
deleted file mode 100644
index bfaecb3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-dynapi.md
+++ /dev/null
@@ -1,130 +0,0 @@
-Dynamic API
-================================================================================
-Originally posted by Ryan at:
- https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U
-
-Background:
-
-- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
- but developers are shipping their own SDL2 with individual Steam games.
- These games might stop getting updates, but a newer SDL2 might be needed later.
- Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
- ever needed, and these fixes won't make it to a game shipping its own SDL.
-- Even if we replace the SDL2 in those games with a compatible one, that is to
- say, edit a developer's Steam depot (yuck!), there are developers that are
- statically linking SDL2 that we can't do this for. We can't even force the
- dynamic loader to ignore their SDL2 in this case, of course.
-- If you don't ship an SDL2 with the game in some form, people that disabled the
- Steam Runtime, or just tried to run the game from the command line instead of
- Steam might find themselves unable to run the game, due to a missing dependency.
-- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
- generic Linux boxes that may or may not have SDL2 installed, you have to ship
- the library or risk a total failure to launch. So now, you might have to have
- a non-Steam build plus a Steam build (that is, one with and one without SDL2
- included), which is inconvenient if you could have had one universal build
- that works everywhere.
-- We like the zlib license, but the biggest complaint from the open source
- community about the license change is the static linking. The LGPL forced this
- as a legal, not technical issue, but zlib doesn't care. Even those that aren't
- concerned about the GNU freedoms found themselves solving the same problems:
- swapping in a newer SDL to an older game often times can save the day.
- Static linking stops this dead.
-
-So here's what we did:
-
-SDL now has, internally, a table of function pointers. So, this is what SDL_Init
-now looks like:
-
- UInt32 SDL_Init(Uint32 flags)
- {
- return jump_table.SDL_Init(flags);
- }
-
-Except that is all done with a bunch of macro magic so we don't have to maintain
-every one of these.
-
-What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
-SDL_Init() that you've been calling all this time. But at startup, it looks more
-like this:
-
- Uint32 SDL_Init_DEFAULT(Uint32 flags)
- {
- SDL_InitDynamicAPI();
- return jump_table.SDL_Init(flags);
- }
-
-SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
-pointers, which means that this _DEFAULT function never gets called again.
-First call to any SDL function sets the whole thing up.
-
-So you might be asking, what was the value in that? Isn't this what the operating
-system's dynamic loader was supposed to do for us? Yes, but now we've got this
-level of indirection, we can do things like this:
-
- export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
- ./MyGameThatIsStaticallyLinkedToSDL2
-
-And now, this game that is staticallly linked to SDL, can still be overridden
-with a newer, or better, SDL. The statically linked one will only be used as
-far as calling into the jump table in this case. But in cases where no override
-is desired, the statically linked version will provide its own jump table,
-and everyone is happy.
-
-So now:
-- Developers can statically link SDL, and users can still replace it.
- (We'd still rather you ship a shared library, though!)
-- Developers can ship an SDL with their game, Valve can override it for, say,
- new features on SteamOS, or distros can override it for their own needs,
- but it'll also just work in the default case.
-- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
- and it'll do the right thing.
-- End users (and Valve) can update a game's SDL in almost any case,
- to keep abandoned games running on newer platforms.
-- Everyone develops with SDL exactly as they have been doing all along.
- Same headers, same ABI. Just get the latest version to enable this magic.
-
-
-A little more about SDL_InitDynamicAPI():
-
-Internally, InitAPI does some locking to make sure everything waits until a
-single thread initializes everything (although even SDL_CreateThread() goes
-through here before spinning a thread, too), and then decides if it should use
-an external SDL library. If not, it sets up the jump table using the current
-SDL's function pointers (which might be statically linked into a program, or in
-a shared library of its own). If so, it loads that library and looks for and
-calls a single function:
-
- SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
-
-That function takes a version number (more on that in a moment), the address of
-the jump table, and the size, in bytes, of the table.
-Now, we've got policy here: this table's layout never changes; new stuff gets
-added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
-the needed functions if tablesize <= sizeof its own jump table. If tablesize is
-bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
-if it's smaller, we know we can provide the entire API that the caller needs.
-
-The version variable is a failsafe switch.
-Right now it's always 1. This number changes when there are major API changes
-(so we know if the tablesize might be smaller, or entries in it have changed).
-Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
-inconceivable to have a small dispatch library that only supplies this one
-function and loads different, otherwise-incompatible SDL libraries and has the
-right one initialize the jump table based on the version. For something that
-must generically catch lots of different versions of SDL over time, like the
-Steam Client, this isn't a bad option.
-
-Finally, I'm sure some people are reading this and thinking,
-"I don't want that overhead in my project!"
-To which I would point out that the extra function call through the jump table
-probably wouldn't even show up in a profile, but lucky you: this can all be
-disabled. You can build SDL without this if you absolutely must, but we would
-encourage you not to do that. However, on heavily locked down platforms like
-iOS, or maybe when debugging, it makes sense to disable it. The way this is
-designed in SDL, you just have to change one #define, and the entire system
-vaporizes out, and SDL functions exactly like it always did. Most of it is
-macro magic, so the system is contained to one C file and a few headers.
-However, this is on by default and you have to edit a header file to turn it
-off. Our hopes is that if we make it easy to disable, but not too easy,
-everyone will ultimately be able to get what they want, but we've gently
-nudged everyone towards what we think is the best solution.
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-emscripten.md b/build/vc++/libs/SDL2-2.0.5/docs/README-emscripten.md
deleted file mode 100644
index 9712084..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-emscripten.md
+++ /dev/null
@@ -1,35 +0,0 @@
-Emscripten
-================================================================================
-
-Build:
-
- $ mkdir build
- $ cd build
- $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2"
- $ emmake make
-
-Or with cmake:
-
- $ mkdir build
- $ cd build
- $ emcmake cmake ..
- $ emmake make
-
-To build one of the tests:
-
- $ cd test/
- $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
-
-Uses GLES2 renderer or software
-
-Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
-
-SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/):
-
- $ EMCONFIGURE_JS=1 emconfigure ../configure
- build as usual...
-
-SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
-
- $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
- build as usual...
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-gesture.md b/build/vc++/libs/SDL2-2.0.5/docs/README-gesture.md
deleted file mode 100644
index 451afae..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-gesture.md
+++ /dev/null
@@ -1,71 +0,0 @@
-Dollar Gestures
-===========================================================================
-SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
-
-Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
-
-Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
-
-Recording:
-----------
-To begin recording on a touch device call:
-SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
-
-Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
-A SDL_DOLLARRECORD event is a dgesture with the following fields:
-
-* event.dgesture.touchId - the Id of the touch used to record the gesture.
-* event.dgesture.gestureId - the unique id of the recorded gesture.
-
-
-Performing:
------------
-As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
-
-* event.dgesture.touchId - the Id of the touch which performed the gesture.
-* event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
-* event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
-* event.dgesture.numFingers - the number of fingers used to draw the stroke.
-
-Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
-
-
-
-Saving:
--------
-To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
-
-To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
-
-Both functions return the number of gestures successfully saved.
-
-
-Loading:
---------
-To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
-
-SDL_LoadDollarTemplates returns the number of templates successfully loaded.
-
-
-
-===========================================================================
-Multi Gestures
-===========================================================================
-SDL provides simple support for pinch/rotate/swipe gestures.
-Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
-
-* event.mgesture.touchId - the Id of the touch on which the gesture was performed.
-* event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
-* event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
-* event.mgesture.dTheta - the amount that the fingers rotated during this motion.
-* event.mgesture.dDist - the amount that the fingers pinched during this motion.
-* event.mgesture.numFingers - the number of fingers used in the gesture.
-
-
-===========================================================================
-Notes
-===========================================================================
-For a complete example see test/testgesture.c
-
-Please direct questions/comments to:
- jim.tla+sdl_touch@gmail.com
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-hg.md b/build/vc++/libs/SDL2-2.0.5/docs/README-hg.md
deleted file mode 100644
index 2449d55..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-hg.md
+++ /dev/null
@@ -1,22 +0,0 @@
-Mercurial
-=========
-
-The latest development version of SDL is available via Mercurial.
-Mercurial allows you to get up-to-the-minute fixes and enhancements;
-as a developer works on a source tree, you can use "hg" to mirror that
-source tree instead of waiting for an official release. Please look
-at the Mercurial website ( https://www.mercurial-scm.org/ ) for more
-information on using hg, where you can also download software for
-Mac OS X, Windows, and Unix systems.
-
- hg clone http://hg.libsdl.org/SDL
-
-If you are building SDL via configure, you will need to run autogen.sh
-before running configure.
-
-There is a web interface to the subversion repository at:
- http://hg.libsdl.org/SDL/
-
-There is an RSS feed available at that URL, for those that want to
-track commits in real time.
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-ios.md b/build/vc++/libs/SDL2-2.0.5/docs/README-ios.md
deleted file mode 100644
index 7627a39..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-ios.md
+++ /dev/null
@@ -1,284 +0,0 @@
-iOS
-======
-
-==============================================================================
-Building the Simple DirectMedia Layer for iOS 5.1+
-==============================================================================
-
-Requirements: Mac OS X 10.8 or later and the iOS 7+ SDK.
-
-Instructions:
-
-1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in Xcode.
-2. Select your desired target, and hit build.
-
-There are three build targets:
-- libSDL.a:
- Build SDL as a statically linked library
-- testsdl:
- Build a test program (there are known test failures which are fine)
-- Template:
- Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers. The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen.
-
-
-==============================================================================
-Build SDL for iOS from the command line
-==============================================================================
-
-1. cd (PATH WHERE THE SDL CODE IS)/build-scripts
-2. ./iosbuild.sh
-
-If everything goes fine, you should see a build/ios directory, inside there's
-two directories "lib" and "include".
-"include" contains a copy of the SDL headers that you'll need for your project,
-make sure to configure XCode to look for headers there.
-"lib" contains find two files, libSDL2.a and libSDL2main.a, you have to add both
-to your XCode project. These libraries contain three architectures in them,
-armv6 for legacy devices, armv7, and i386 (for the simulator).
-By default, iosbuild.sh will autodetect the SDK version you have installed using
-xcodebuild -showsdks, and build for iOS >= 3.0, you can override this behaviour
-by setting the MIN_OS_VERSION variable, ie:
-
-MIN_OS_VERSION=4.2 ./iosbuild.sh
-
-==============================================================================
-Using the Simple DirectMedia Layer for iOS
-==============================================================================
-
-FIXME: This needs to be updated for the latest methods
-
-Here is the easiest method:
-1. Build the SDL library (libSDL2.a) and the iPhone SDL Application template.
-2. Install the iPhone SDL Application template by copying it to one of Xcode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/Xcode/Project Templates/" and placing it there.
-3. Start a new project using the template. The project should be immediately ready for use with SDL.
-
-Here is a more manual method:
-1. Create a new iOS view based application.
-2. Build the SDL static library (libSDL2.a) for iOS and include them in your project. Xcode will ignore the library that is not currently of the correct architecture, hence your app will work both on iOS and in the iOS Simulator.
-3. Include the SDL header files in your project.
-4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iOS provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iOS produces its user interface programmatically.
-5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell Xcode not to use the project prefix file, as it includes Objective-C code.
-
-==============================================================================
-Notes -- Retina / High-DPI and window sizes
-==============================================================================
-
-Window and display mode sizes in SDL are in "screen coordinates" (or "points",
-in Apple's terminology) rather than in pixels. On iOS this means that a window
-created on an iPhone 6 will have a size in screen coordinates of 375 x 667,
-rather than a size in pixels of 750 x 1334. All iOS apps are expected to
-size their content based on screen coordinates / points rather than pixels,
-as this allows different iOS devices to have different pixel densities
-(Retina versus non-Retina screens, etc.) without apps caring too much.
-
-By default SDL will not use the full pixel density of the screen on
-Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
-creating your window to enable high-dpi support.
-
-When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
-will still be in "screen coordinates" rather than pixels, but the window will
-have a much greater pixel density when the device supports it, and the
-SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
-whether raw OpenGL or the SDL_Render API is used) can be queried to determine
-the size in pixels of the drawable screen framebuffer.
-
-Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
-sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
-orthographic projection matrix using the size in screen coordinates
-(SDL_GetWindowSize()) can be used in order to display content at the same scale
-no matter whether a Retina device is used or not.
-
-==============================================================================
-Notes -- Application events
-==============================================================================
-
-On iOS the application goes through a fixed life cycle and you will get
-notifications of state changes via application events. When these events
-are delivered you must handle them in an event callback because the OS may
-not give you any processing time after the events are delivered.
-
-e.g.
-
- int HandleAppEvents(void *userdata, SDL_Event *event)
- {
- switch (event->type)
- {
- case SDL_APP_TERMINATING:
- /* Terminate the app.
- Shut everything down before returning from this function.
- */
- return 0;
- case SDL_APP_LOWMEMORY:
- /* You will get this when your app is paused and iOS wants more memory.
- Release as much memory as possible.
- */
- return 0;
- case SDL_APP_WILLENTERBACKGROUND:
- /* Prepare your app to go into the background. Stop loops, etc.
- This gets called when the user hits the home button, or gets a call.
- */
- return 0;
- case SDL_APP_DIDENTERBACKGROUND:
- /* This will get called if the user accepted whatever sent your app to the background.
- If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
- When you get this, you have 5 seconds to save all your state or the app will be terminated.
- Your app is NOT active at this point.
- */
- return 0;
- case SDL_APP_WILLENTERFOREGROUND:
- /* This call happens when your app is coming back to the foreground.
- Restore all your state here.
- */
- return 0;
- case SDL_APP_DIDENTERFOREGROUND:
- /* Restart your loops here.
- Your app is interactive and getting CPU again.
- */
- return 0;
- default:
- /* No special processing, add it to the event queue */
- return 1;
- }
- }
-
- int main(int argc, char *argv[])
- {
- SDL_SetEventFilter(HandleAppEvents, NULL);
-
- ... run your main loop
-
- return 0;
- }
-
-
-==============================================================================
-Notes -- Accelerometer as Joystick
-==============================================================================
-
-SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory.
-
-The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
-
-==============================================================================
-Notes -- OpenGL ES
-==============================================================================
-
-Your SDL application for iOS uses OpenGL ES for video by default.
-
-OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
-
-If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
-
-Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
-
-OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
-
-- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
-- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
-- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
-
-The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
-
-==============================================================================
-Notes -- Keyboard
-==============================================================================
-
-The SDL keyboard API has been extended to support on-screen keyboards:
-
-void SDL_StartTextInput()
- -- enables text events and reveals the onscreen keyboard.
-
-void SDL_StopTextInput()
- -- disables text events and hides the onscreen keyboard.
-
-SDL_bool SDL_IsTextInputActive()
- -- returns whether or not text events are enabled (and the onscreen keyboard is visible)
-
-
-==============================================================================
-Notes -- Reading and Writing files
-==============================================================================
-
-Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory.
-
-Once your application is installed its directory tree looks like:
-
- MySDLApp Home/
- MySDLApp.app
- Documents/
- Library/
- Preferences/
- tmp/
-
-When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
-
-More information on this subject is available here:
-http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
-
-==============================================================================
-Notes -- iPhone SDL limitations
-==============================================================================
-
-Windows:
- Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS).
-
-Textures:
- The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
-
-Loading Shared Objects:
- This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h.
-
-==============================================================================
-Game Center
-==============================================================================
-
-Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
-
- int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
-
-This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
-
-e.g.
-
- extern "C"
- void ShowFrame(void*)
- {
- ... do event handling, frame logic and rendering ...
- }
-
- int main(int argc, char *argv[])
- {
- ... initialize game ...
-
- #if __IPHONEOS__
- // Initialize the Game Center for scoring and matchmaking
- InitGameCenter();
-
- // Set up the game to run in the window animation callback on iOS
- // so that Game Center and so forth works correctly.
- SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
- #else
- while ( running ) {
- ShowFrame(0);
- DelayFrame();
- }
- #endif
- return 0;
- }
-
-==============================================================================
-Deploying to older versions of iOS
-==============================================================================
-
-SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 6.1
-
-In order to do that you need to download an older version of Xcode:
-https://developer.apple.com/download/more/?name=Xcode
-
-Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
-
-Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES
-
-Open your project and set your deployment target to the desired version of iOS
-
-Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-linux.md b/build/vc++/libs/SDL2-2.0.5/docs/README-linux.md
deleted file mode 100644
index 5274c60..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-linux.md
+++ /dev/null
@@ -1,90 +0,0 @@
-Linux
-================================================================================
-
-By default SDL will only link against glibc, the rest of the features will be
-enabled dynamically at runtime depending on the available features on the target
-system. So, for example if you built SDL with Xinerama support and the target
-system does not have the Xinerama libraries installed, it will be disabled
-at runtime, and you won't get a missing library error, at least with the
-default configuration parameters.
-
-
-================================================================================
-Build Dependencies
-================================================================================
-
-Ubuntu 13.04, all available features enabled:
-
-sudo apt-get install build-essential mercurial make cmake autoconf automake \
-libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
-libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
-libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
-libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
-fcitx-libs-dev libsamplerate0-dev libsndio-dev
-
-Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
-to that command line for Wayland support.
-
-Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command
-line for Mir support.
-
-NOTES:
-- This includes all the audio targets except arts, because Ubuntu pulled the
- artsc0-dev package, but in theory SDL still supports it.
-- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
- for higher-quality audio resampling. SDL will work without it if the library
- is missing, so it's safe to build in support even if the end user doesn't
- have this library installed.
-- DirectFB isn't included because the configure script (currently) fails to find
- it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
- configure script to include DirectFB support. Send patches. :)
-
-
-================================================================================
-Joystick does not work
-================================================================================
-
-If you compiled or are using a version of SDL with udev support (and you should!)
-there's a few issues that may cause SDL to fail to detect your joystick. To
-debug this, start by installing the evtest utility. On Ubuntu/Debian:
-
- sudo apt-get install evtest
-
-Then run:
-
- sudo evtest
-
-You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
-Now run:
-
- cat /dev/input/event/XX
-
-If you get a permission error, you need to set a udev rule to change the mode of
-your device (see below)
-
-Also, try:
-
- sudo udevadm info --query=all --name=input/eventXX
-
-If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
-you need to set up an udev rule to force this variable.
-
-A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
-like:
-
- SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
- SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
-
-You can set up similar rules for your device by changing the values listed in
-idProduct and idVendor. To obtain these values, try:
-
- sudo udevadm info -a --name=input/eventXX | grep idVendor
- sudo udevadm info -a --name=input/eventXX | grep idProduct
-
-If multiple values come up for each of these, the one you want is the first one of each.
-
-On other systems which ship with an older udev (such as CentOS), you may need
-to set up a rule such as:
-
- SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-macosx.md b/build/vc++/libs/SDL2-2.0.5/docs/README-macosx.md
deleted file mode 100644
index 18d3951..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-macosx.md
+++ /dev/null
@@ -1,240 +0,0 @@
-Mac OS X
-==============================================================================
-
-These instructions are for people using Apple's Mac OS X (pronounced
-"ten").
-
-From the developer's point of view, OS X is a sort of hybrid Mac and
-Unix system, and you have the option of using either traditional
-command line tools or Apple's IDE Xcode.
-
-Command Line Build
-==================
-
-To build SDL using the command line, use the standard configure and make
-process:
-
- ./configure
- make
- sudo make install
-
-You can also build SDL as a Universal library (a single binary for both
-32-bit and 64-bit Intel architectures), on Mac OS X 10.7 and newer, by using
-the gcc-fat.sh script in build-scripts:
-
- mkdir mybuild
- cd mybuild
- CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++-fat.sh ../configure
- make
- sudo make install
-
-This script builds SDL with 10.5 ABI compatibility on i386 and 10.6
-ABI compatibility on x86_64 architectures. For best compatibility you
-should compile your application the same way.
-
-Please note that building SDL requires at least Xcode 4.6 and the 10.7 SDK
-(even if you target back to 10.5 systems). PowerPC support for Mac OS X has
-been officially dropped as of SDL 2.0.2.
-
-To use the library once it's built, you essential have two possibilities:
-use the traditional autoconf/automake/make method, or use Xcode.
-
-==============================================================================
-Caveats for using SDL with Mac OS X
-==============================================================================
-
-Some things you have to be aware of when using SDL on Mac OS X:
-
-- If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
- SDL will not register its own. This means that SDL will not terminate using
- SDL_Quit if it receives a termination request, it will terminate like a
- normal app, and it will not send a SDL_DROPFILE when you request to open a
- file with the app. To solve these issues, put the following code in your
- NSApplicationDelegate implementation:
-
-
- - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
- {
- if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
- SDL_Event event;
- event.type = SDL_QUIT;
- SDL_PushEvent(&event);
- }
-
- return NSTerminateCancel;
- }
-
- - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
- {
- if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
- SDL_Event event;
- event.type = SDL_DROPFILE;
- event.drop.file = SDL_strdup([filename UTF8String]);
- return (SDL_PushEvent(&event) > 0);
- }
-
- return NO;
- }
-
-==============================================================================
-Using the Simple DirectMedia Layer with a traditional Makefile
-==============================================================================
-
-An existing autoconf/automake build system for your SDL app has good chances
-to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
-that you can distribute to users, you need to put the generated binary into a
-so called "bundle", which basically is a fancy folder with a name like
-"MyCoolGame.app".
-
-To get this build automatically, add something like the following rule to
-your Makefile.am:
-
- bundle_contents = APP_NAME.app/Contents
- APP_NAME_bundle: EXE_NAME
- mkdir -p $(bundle_contents)/MacOS
- mkdir -p $(bundle_contents)/Resources
- echo "APPL????" > $(bundle_contents)/PkgInfo
- $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
-
-You should replace EXE_NAME with the name of the executable. APP_NAME is what
-will be visible to the user in the Finder. Usually it will be the same
-as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME
-usually is "TestGame". You might also want to use `@PACKAGE@` to use the package
-name as specified in your configure.in file.
-
-If your project builds more than one application, you will have to do a bit
-more. For each of your target applications, you need a separate rule.
-
-If you want the created bundles to be installed, you may want to add this
-rule to your Makefile.am:
-
- install-exec-hook: APP_NAME_bundle
- rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
- mkdir -p $(DESTDIR)$(prefix)/Applications/
- cp -r $< /$(DESTDIR)$(prefix)Applications/
-
-This rule takes the Bundle created by the rule from step 3 and installs them
-into "$(DESTDIR)$(prefix)/Applications/".
-
-Again, if you want to install multiple applications, you will have to augment
-the make rule accordingly.
-
-
-But beware! That is only part of the story! With the above, you end up with
-a bare bone .app bundle, which is double clickable from the Finder. But
-there are some more things you should do before shipping your product...
-
-1) The bundle right now probably is dynamically linked against SDL. That
- means that when you copy it to another computer, *it will not run*,
- unless you also install SDL on that other computer. A good solution
- for this dilemma is to static link against SDL. On OS X, you can
- achieve that by linking against the libraries listed by
-
- sdl-config --static-libs
-
- instead of those listed by
-
- sdl-config --libs
-
- Depending on how exactly SDL is integrated into your build systems, the
- way to achieve that varies, so I won't describe it here in detail
-
-2) Add an 'Info.plist' to your application. That is a special XML file which
- contains some meta-information about your application (like some copyright
- information, the version of your app, the name of an optional icon file,
- and other things). Part of that information is displayed by the Finder
- when you click on the .app, or if you look at the "Get Info" window.
- More information about Info.plist files can be found on Apple's homepage.
-
-
-As a final remark, let me add that I use some of the techniques (and some
-variations of them) in Exult and ScummVM; both are available in source on
-the net, so feel free to take a peek at them for inspiration!
-
-
-==============================================================================
-Using the Simple DirectMedia Layer with Xcode
-==============================================================================
-
-These instructions are for using Apple's Xcode IDE to build SDL applications.
-
-- First steps
-
-The first thing to do is to unpack the Xcode.tar.gz archive in the
-top level SDL directory (where the Xcode.tar.gz archive resides).
-Because Stuffit Expander will unpack the archive into a subdirectory,
-you should unpack the archive manually from the command line:
-
- cd [path_to_SDL_source]
- tar zxf Xcode.tar.gz
-
-This will create a new folder called Xcode, which you can browse
-normally from the Finder.
-
-- Building the Framework
-
-The SDL Library is packaged as a framework bundle, an organized
-relocatable folder hierarchy of executable code, interface headers,
-and additional resources. For practical purposes, you can think of a
-framework as a more user and system-friendly shared library, whose library
-file behaves more or less like a standard UNIX shared library.
-
-To build the framework, simply open the framework project and build it.
-By default, the framework bundle "SDL.framework" is installed in
-/Library/Frameworks. Therefore, the testers and project stationary expect
-it to be located there. However, it will function the same in any of the
-following locations:
-
- ~/Library/Frameworks
- /Local/Library/Frameworks
- /System/Library/Frameworks
-
-- Build Options
- There are two "Build Styles" (See the "Targets" tab) for SDL.
- "Deployment" should be used if you aren't tweaking the SDL library.
- "Development" should be used to debug SDL apps or the library itself.
-
-- Building the Testers
- Open the SDLTest project and build away!
-
-- Using the Project Stationary
- Copy the stationary to the indicated folders to access it from
- the "New Project" and "Add target" menus. What could be easier?
-
-- Setting up a new project by hand
- Some of you won't want to use the Stationary so I'll give some tips:
- * Create a new "Cocoa Application"
- * Add src/main/macosx/SDLMain.m , .h and .nib to your project
- * Remove "main.c" from your project
- * Remove "MainMenu.nib" from your project
- * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
- * Add "$(HOME)/Library/Frameworks" to the frameworks search path
- * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
- * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
- * Add your files
- * Clean and build
-
-- Building from command line
- Use pbxbuild in the same directory as your .pbproj file
-
-- Running your app
- You can send command line args to your app by either invoking it from
- the command line (in *.app/Contents/MacOS) or by entering them in the
- "Executables" panel of the target settings.
-
-- Implementation Notes
- Some things that may be of interest about how it all works...
- * Working directory
- As defined in the SDL_main.m file, the working directory of your SDL app
- is by default set to its parent. You may wish to change this to better
- suit your needs.
- * You have a Cocoa App!
- Your SDL app is essentially a Cocoa application. When your app
- starts up and the libraries finish loading, a Cocoa procedure is called,
- which sets up the working directory and calls your main() method.
- You are free to modify your Cocoa app with generally no consequence
- to SDL. You cannot, however, easily change the SDL window itself.
- Functionality may be added in the future to help this.
-
-
-Known bugs are listed in the file "BUGS.txt".
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-nacl.md b/build/vc++/libs/SDL2-2.0.5/docs/README-nacl.md
deleted file mode 100644
index 4c9432b..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-nacl.md
+++ /dev/null
@@ -1,103 +0,0 @@
-Native Client
-================================================================================
-
-Requirements:
-
-* Native Client SDK (https://developer.chrome.com/native-client),
- (tested with Pepper version 33 or higher).
-
-The SDL backend for Chrome's Native Client has been tested only with the PNaCl
-toolchain, which generates binaries designed to run on ARM and x86_32/64
-platforms. This does not mean it won't work with the other toolchains!
-
-================================================================================
-Building SDL for NaCl
-================================================================================
-
-Set up the right environment variables (see naclbuild.sh), then configure SDL with:
-
- configure --host=pnacl --prefix some/install/destination
-
-Then "make".
-
-As an example of how to create a deployable app a Makefile project is provided
-in test/nacl/Makefile, which includes some monkey patching of the common.mk file
-provided by NaCl, without which linking properly to SDL won't work (the search
-path can't be modified externally, so the linker won't find SDL's binaries unless
-you dump them into the SDK path, which is inconvenient).
-Also provided in test/nacl is the required support file, such as index.html,
-manifest.json, etc.
-SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
-This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
-hiding the asynchronous nature of the browser behind the scenes...which is not the
-same as making it disappear!
-
-
-================================================================================
-Running tests
-================================================================================
-
-Due to the nature of NaCl programs, building and running SDL tests is not as
-straightforward as one would hope. The script naclbuild.sh in build-scripts
-automates the process and should serve as a guide for users of SDL trying to build
-their own applications.
-
-Basic usage:
-
- ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
-
-This will build testgles2.c by default.
-
-If you want to build a different test, for example testrendercopyex.c:
-
- SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
-
-Once the build finishes, you have to serve the contents with a web server (the
-script will give you instructions on how to do that with Python).
-
-================================================================================
-RWops and nacl_io
-================================================================================
-
-SDL_RWops work transparently with nacl_io. Two functions control the mount points:
-
- int mount(const char* source, const char* target,
- const char* filesystemtype,
- unsigned long mountflags, const void *data);
- int umount(const char *target);
-
- For convenience, SDL will by default mount an httpfs tree at / before calling
-the app's main function. Such setting can be overridden by calling:
-
- umount("/");
-
-And then mounting a different filesystem at /
-
-It's important to consider that the asynchronous nature of file operations on a
-browser is hidden from the application, effectively providing the developer with
-a set of blocking file operations just like you get in a regular desktop
-environment, which eases the job of porting to Native Client, but also introduces
-a set of challenges of its own, in particular when big file sizes and slow
-connections are involved.
-
-For more information on how nacl_io and mount points work, see:
-
- https://developer.chrome.com/native-client/devguide/coding/nacl_io
- https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
-
-To be able to save into the directory "/save/" (like backup of game) :
-
- mount("", "/save", "html5fs", 0, "type=PERSISTENT");
-
-And add to manifest.json :
-
- "permissions": [
- "unlimitedStorage"
- ]
-
-================================================================================
-TODO - Known Issues
-================================================================================
-* Testing of all systems with a real application (something other than SDL's tests)
-* Key events don't seem to work properly
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-pandora.md b/build/vc++/libs/SDL2-2.0.5/docs/README-pandora.md
deleted file mode 100644
index 511a054..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-pandora.md
+++ /dev/null
@@ -1,17 +0,0 @@
-Pandora
-=====================================================================
-
-( http://openpandora.org/ )
-- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
-support to work on the pandora under the framebuffer. This driver do not have
-input support for now, so if you use it you will have to add your own control code.
-The video driver name is "pandora" so if you have problem running it from
-the framebuffer, try to set the following variable before starting your application :
-"export SDL_VIDEODRIVER=pandora"
-
-- OpenGL ES support was added to the x11 driver, so it's working like the normal
-x11 driver one with OpenGLX support, with SDL input event's etc..
-
-
-David Carré (Cpasjuste)
-cpasjuste@gmail.com
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-platforms.md b/build/vc++/libs/SDL2-2.0.5/docs/README-platforms.md
deleted file mode 100644
index 14454ec..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-platforms.md
+++ /dev/null
@@ -1,8 +0,0 @@
-Platforms
-=========
-
-We maintain the list of supported platforms on our wiki now, and how to
-build and install SDL for those platforms:
-
- https://wiki.libsdl.org/Installation
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-porting.md b/build/vc++/libs/SDL2-2.0.5/docs/README-porting.md
deleted file mode 100644
index cf8ef39..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-porting.md
+++ /dev/null
@@ -1,68 +0,0 @@
-Porting
-=======
-
-* Porting To A New Platform
-
- The first thing you have to do when porting to a new platform, is look at
-include/SDL_platform.h and create an entry there for your operating system.
-The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
-Ideally SDL_platform.h will be able to auto-detect the system it's building
-on based on C preprocessor symbols.
-
-There are two basic ways of building SDL at the moment:
-
-1. The "UNIX" way: ./configure; make; make install
-
- If you have a GNUish system, then you might try this. Edit configure.in,
- take a look at the large section labelled:
-
- "Set up the configuration based on the host platform!"
-
- Add a section for your platform, and then re-run autogen.sh and build!
-
-2. Using an IDE:
-
- If you're using an IDE or other non-configure build system, you'll probably
- want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
- add a section for your platform, and create a custom SDL_config_{platform}.h,
- based on SDL_config_minimal.h and SDL_config.h.in
-
- Add the top level include directory to the header search path, and then add
- the following sources to the project:
-
- src/*.c
- src/atomic/*.c
- src/audio/*.c
- src/cpuinfo/*.c
- src/events/*.c
- src/file/*.c
- src/haptic/*.c
- src/joystick/*.c
- src/power/*.c
- src/render/*.c
- src/render/software/*.c
- src/stdlib/*.c
- src/thread/*.c
- src/timer/*.c
- src/video/*.c
- src/audio/disk/*.c
- src/audio/dummy/*.c
- src/filesystem/dummy/*.c
- src/video/dummy/*.c
- src/haptic/dummy/*.c
- src/joystick/dummy/*.c
- src/main/dummy/*.c
- src/thread/generic/*.c
- src/timer/dummy/*.c
- src/loadso/dummy/*.c
-
-
-Once you have a working library without any drivers, you can go back to each
-of the major subsystems and start implementing drivers for your platform.
-
-If you have any questions, don't hesitate to ask on the SDL mailing list:
- http://www.libsdl.org/mailing-list.php
-
-Enjoy!
- Sam Lantinga (slouken@libsdl.org)
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-psp.md b/build/vc++/libs/SDL2-2.0.5/docs/README-psp.md
deleted file mode 100644
index 0acc93d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-psp.md
+++ /dev/null
@@ -1,19 +0,0 @@
-PSP
-======
-SDL port for the Sony PSP contributed by
- Captian Lex
-
-Credit to
- Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
- Geecko for his PSP GU lib "Glib2d"
-
-Building
---------
-To build for the PSP, make sure psp-config is in the path and run:
- make -f Makefile.psp
-
-
-
-To Do
-------
-PSP Screen Keyboard
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-raspberrypi.md b/build/vc++/libs/SDL2-2.0.5/docs/README-raspberrypi.md
deleted file mode 100644
index d64e7cb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-raspberrypi.md
+++ /dev/null
@@ -1,178 +0,0 @@
-Raspberry Pi
-================================================================================
-
-Requirements:
-
-Raspbian (other Linux distros may work as well).
-
-================================================================================
- Features
-================================================================================
-
-* Works without X11
-* Hardware accelerated OpenGL ES 2.x
-* Sound via ALSA
-* Input (mouse/keyboard/joystick) via EVDEV
-* Hotplugging of input devices via UDEV
-
-
-================================================================================
- Raspbian Build Dependencies
-================================================================================
-
-sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
-
-You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
-OpenGL ES 2.x, it usually comes pre-installed, but in any case:
-
-sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
-
-================================================================================
- Cross compiling from x86 Linux
-================================================================================
-
-To cross compile SDL for Raspbian from your desktop machine, you'll need a
-Raspbian system root and the cross compilation tools. We'll assume these tools
-will be placed in /opt/rpi-tools
-
- sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
-
-You'll also need a Raspbian binary image.
-Get it from: http://downloads.raspberrypi.org/raspbian_latest
-After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
-Let's assume the sysroot will be built in /opt/rpi-sysroot.
-
- export SYSROOT=/opt/rpi-sysroot
- sudo kpartx -a -v <path_to_raspbian_image>.img
- sudo mount -o loop /dev/mapper/loop0p2 /mnt
- sudo cp -r /mnt $SYSROOT
- sudo apt-get install qemu binfmt-support qemu-user-static
- sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
- sudo mount --bind /dev $SYSROOT/dev
- sudo mount --bind /proc $SYSROOT/proc
- sudo mount --bind /sys $SYSROOT/sys
-
-Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
-edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
-
- sudo chroot $SYSROOT
- apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev
- exit
- sudo umount $SYSROOT/dev
- sudo umount $SYSROOT/proc
- sudo umount $SYSROOT/sys
- sudo umount /mnt
-
-There's one more fix required, as the libdl.so symlink uses an absolute path
-which doesn't quite work in our setup.
-
- sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
- sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
-
-The final step is compiling SDL itself.
-
- export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
- cd <SDL SOURCE>
- mkdir -p build;cd build
- LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
- make
- make install
-
-To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
-
- perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
-
-================================================================================
- Apps don't work or poor video/audio performance
-================================================================================
-
-If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
-update the RPi's firmware. Note that doing so will fix these problems, but it
-will also render the CMA - Dynamic Memory Split functionality useless.
-
-Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
-low in general, specially if a 1080p TV is hooked up.
-
-See here how to configure this setting: http://elinux.org/RPiconfig
-
-Using a fixed gpu_mem=128 is the best option (specially if you updated the
-firmware, using CMA probably won't work, at least it's the current case).
-
-================================================================================
- No input
-================================================================================
-
-Make sure you belong to the "input" group.
-
- sudo usermod -aG input `whoami`
-
-================================================================================
- No HDMI Audio
-================================================================================
-
-If you notice that ALSA works but there's no audio over HDMI, try adding:
-
- hdmi_drive=2
-
-to your config.txt file and reboot.
-
-Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
-
-================================================================================
- Text Input API support
-================================================================================
-
-The Text Input API is supported, with translation of scan codes done via the
-kernel symbol tables. For this to work, SDL needs access to a valid console.
-If you notice there's no SDL_TEXTINPUT message being emitted, double check that
-your app has read access to one of the following:
-
-* /proc/self/fd/0
-* /dev/tty
-* /dev/tty[0...6]
-* /dev/vc/0
-* /dev/console
-
-This is usually not a problem if you run from the physical terminal (as opposed
-to running from a pseudo terminal, such as via SSH). If running from a PTS, a
-quick workaround is to run your app as root or add yourself to the tty group,
-then re-login to the system.
-
- sudo usermod -aG tty `whoami`
-
-The keyboard layout used by SDL is the same as the one the kernel uses.
-To configure the layout on Raspbian:
-
- sudo dpkg-reconfigure keyboard-configuration
-
-To configure the locale, which controls which keys are interpreted as letters,
-this determining the CAPS LOCK behavior:
-
- sudo dpkg-reconfigure locales
-
-================================================================================
- OpenGL problems
-================================================================================
-
-If you have desktop OpenGL headers installed at build time in your RPi or cross
-compilation environment, support for it will be built in. However, the chipset
-does not actually have support for it, which causes issues in certain SDL apps
-since the presence of OpenGL support supersedes the ES/ES2 variants.
-The workaround is to disable OpenGL at configuration time:
-
- ./configure --disable-video-opengl
-
-Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
-environment variable:
-
- export SDL_RENDER_DRIVER=opengles2
-
-================================================================================
- Notes
-================================================================================
-
-* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
- leaking into the console only if it has root privileges. Launching apps locally
- does not suffer from this issue.
-
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-touch.md b/build/vc++/libs/SDL2-2.0.5/docs/README-touch.md
deleted file mode 100644
index b6745ac..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-touch.md
+++ /dev/null
@@ -1,86 +0,0 @@
-Touch
-===========================================================================
-System Specific Notes
-===========================================================================
-Linux:
-The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
-
-Mac:
-The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
-
-iPhone:
-Works out of box.
-
-Windows:
-Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
-
-===========================================================================
-Events
-===========================================================================
-SDL_FINGERDOWN:
-Sent when a finger (or stylus) is placed on a touch device.
-Fields:
-* event.tfinger.touchId - the Id of the touch device.
-* event.tfinger.fingerId - the Id of the finger which just went down.
-* event.tfinger.x - the x coordinate of the touch (0..1)
-* event.tfinger.y - the y coordinate of the touch (0..1)
-* event.tfinger.pressure - the pressure of the touch (0..1)
-
-SDL_FINGERMOTION:
-Sent when a finger (or stylus) is moved on the touch device.
-Fields:
-Same as SDL_FINGERDOWN but with additional:
-* event.tfinger.dx - change in x coordinate during this motion event.
-* event.tfinger.dy - change in y coordinate during this motion event.
-
-SDL_FINGERUP:
-Sent when a finger (or stylus) is lifted from the touch device.
-Fields:
-Same as SDL_FINGERDOWN.
-
-
-===========================================================================
-Functions
-===========================================================================
-SDL provides the ability to access the underlying SDL_Finger structures.
-These structures should _never_ be modified.
-
-The following functions are included from SDL_touch.h
-
-To get a SDL_TouchID call SDL_GetTouchDevice(int index).
-This returns a SDL_TouchID.
-IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
-
-The number of touch devices can be queried with SDL_GetNumTouchDevices().
-
-A SDL_TouchID may be used to get pointers to SDL_Finger.
-
-SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
-
-The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
-
- float x = event.tfinger.x;
- float y = event.tfinger.y;
-
-
-
-To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
-This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
-A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
-As a result, be very careful to check for NULL return values.
-
-A SDL_Finger has the following fields:
-* x, y:
- The current coordinates of the touch.
-* pressure:
- The pressure of the touch.
-
-
-===========================================================================
-Notes
-===========================================================================
-For a complete example see test/testgesture.c
-
-Please direct questions/comments to:
- jim.tla+sdl_touch@gmail.com
- (original author, API was changed since)
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-wince.md b/build/vc++/libs/SDL2-2.0.5/docs/README-wince.md
deleted file mode 100644
index 9fc6454..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-wince.md
+++ /dev/null
@@ -1,10 +0,0 @@
-WinCE
-=====
-
-Windows CE is no longer supported by SDL.
-
-We have left the CE support in SDL 1.2 for those that must have it, and we
-have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
-
---ryan.
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-windows.md b/build/vc++/libs/SDL2-2.0.5/docs/README-windows.md
deleted file mode 100644
index 71f968e..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-windows.md
+++ /dev/null
@@ -1,45 +0,0 @@
-Windows
-================================================================================
-
-================================================================================
-OpenGL ES 2.x support
-================================================================================
-
-SDL has support for OpenGL ES 2.x under Windows via two alternative
-implementations.
-The most straightforward method consists in running your app in a system with
-a graphic card paired with a relatively recent (as of November of 2013) driver
-which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
-to ship said extension on Windows currently include nVidia and Intel.
-
-The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
-If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
-extension is found, SDL will try to load the libEGL.dll library provided by
-ANGLE.
-To obtain the ANGLE binaries, you can either compile from source from
-https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
-a recent Chrome/Chromium install for Windows. The files you need are:
-
- * libEGL.dll
- * libGLESv2.dll
- * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
- or...
- * d3dcompiler_43.dll (supports Windows XP or later)
-
-If you compile ANGLE from source, you can configure it so it does not need the
-d3dcompiler_* DLL at all (for details on this, see their documentation).
-However, by default SDL will try to preload the d3dcompiler_46.dll to
-comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
-support Windows XP) or to skip this step at all, you can use the
-SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
-
-Known Bugs:
-
- * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
- that there's a bug in the library which prevents the window contents from
- refreshing if this is set to anything other than the default value.
-
-Vulkan Surface Support
-==============
-
-Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application.
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README-winrt.md b/build/vc++/libs/SDL2-2.0.5/docs/README-winrt.md
deleted file mode 100644
index 8e993b5..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README-winrt.md
+++ /dev/null
@@ -1,541 +0,0 @@
-WinRT
-=====
-
-This port allows SDL applications to run on Microsoft's platforms that require
-use of "Windows Runtime", aka. "WinRT", APIs. Microsoft may, in some cases,
-refer to them as either "Windows Store", or for Windows 10, "UWP" apps.
-
-Some of the operating systems that include WinRT, are:
-
-* Windows 10, via its Universal Windows Platform (UWP) APIs
-* Windows 8.x
-* Windows RT 8.x (aka. Windows 8.x for ARM processors)
-* Windows Phone 8.x
-
-
-Requirements
-------------
-
-* Microsoft Visual C++ (aka Visual Studio), either 2017, 2015, 2013, or 2012
- - Free, "Community" or "Express" editions may be used, so long as they
- include support for either "Windows Store" or "Windows Phone" apps.
- "Express" versions marked as supporting "Windows Desktop" development
- typically do not include support for creating WinRT apps, to note.
- (The "Community" editions of Visual C++ do, however, support both
- desktop/Win32 and WinRT development).
- - Visual Studio 2017 can be used, however it is recommented that you install
- the Visual C++ 2015 build tools. These build tools can be installed
- using VS 2017's installer. Be sure to also install the workload for
- "Universal Windows Platform development", its optional component, the
- "C++ Universal Windows Platform tools", and for UWP / Windows 10
- development, the "Windows 10 SDK (10.0.10240.0)". Please note that
- targeting UWP / Windows 10 apps from development machine(s) running
- earlier versions of Windows, such as Windows 7, is not always supported
- by Visual Studio, and you may get error(s) when attempting to do so.
- - Visual C++ 2012 can only build apps that target versions 8.0 of Windows,
- or Windows Phone. 8.0-targetted apps will run on devices running 8.1
- editions of Windows, however they will not be able to take advantage of
- 8.1-specific features.
- - Visual C++ 2013 cannot create app projects that target Windows 8.0.
- Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0,
- Windows Phone 8.1, and Windows 8.1, but not Windows 8.0. An optional
- Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8",
- allows Visual C++ 2013 to load and build Windows 8.0 projects that were
- created with Visual C++ 2012, so long as Visual C++ 2012 is installed
- on the same machine. More details on targeting different versions of
- Windows can found at the following web pages:
- - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx)
- - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools)
-* A valid Microsoft account - This requirement is not imposed by SDL, but
- rather by Microsoft's Visual C++ toolchain. This is required to launch or
- debug apps.
-
-
-Status
-------
-
-Here is a rough list of what works, and what doens't:
-
-* What works:
- * compilation via Visual C++ 2012 through 2015
- * compile-time platform detection for SDL programs. The C/C++ #define,
- `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
- * GPU-accelerated 2D rendering, via SDL_Renderer.
- * OpenGL ES 2, via the ANGLE library (included separately from SDL)
- * software rendering, via either SDL_Surface (optionally in conjunction with
- SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the
- SDL_Renderer APIs
- * threads
- * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
- SDL_GetPerformanceFrequency(), etc.)
- * file I/O via SDL_RWops
- * mouse input (unsupported on Windows Phone)
- * audio, via a modified version of SDL's XAudio2 backend
- * .DLL file loading. Libraries *MUST* be packaged inside applications. Loading
- anything outside of the app is not supported.
- * system path retrieval via SDL's filesystem APIs
- * game controllers. Support is provided via the SDL_Joystick and
- SDL_GameController APIs, and is backed by Microsoft's XInput API. Please
- note, however, that Windows limits game-controller support in UWP apps to,
- "Xbox compatible controllers" (many controllers that work in Win32 apps,
- do not work in UWP, due to restrictions in UWP itself.)
- * multi-touch input
- * app events. SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
- appropriate.
- * window events
- * using Direct3D 11.x APIs outside of SDL. Non-XAML / Direct3D-only apps can
- choose to render content directly via Direct3D, using SDL to manage the
- internal WinRT window, as well as input and audio. (Use
- SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into
- IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)
-
-* What partially works:
- * keyboard input. Most of WinRT's documented virtual keys are supported, as
- well as many keys with documented hardware scancodes. Converting
- SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs
- (MapVirtualKey()) in Microsoft's Windows Store / UWP APIs.
- * SDLmain. WinRT uses a different signature for each app's main() function.
- SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
- (in `SDL\src\main\winrt\`) directly in order for their C-style main()
- functions to be called.
-
-* What doesn't work:
- * compilation with anything other than Visual C++
- * programmatically-created custom cursors. These don't appear to be supported
- by WinRT. Different OS-provided cursors can, however, be created via
- SDL_CreateSystemCursor() (unsupported on Windows Phone)
- * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal(). This are not currently
- supported by WinRT itself.
- * joysticks and game controllers that either are not supported by
- Microsoft's XInput API, or are not supported within UWP apps (many
- controllers that work in Win32, do not work in UWP, due to restrictions in
- UWP itself).
- * turning off VSync when rendering on Windows Phone. Attempts to turn VSync
- off on Windows Phone result either in Direct3D not drawing anything, or it
- forcing VSync back on. As such, SDL_RENDERER_PRESENTVSYNC will always get
- turned-on on Windows Phone. This limitation is not present in non-Phone
- WinRT (such as Windows 8.x), where turning off VSync appears to work.
- * probably anything else that's not listed as supported
-
-
-
-Upgrade Notes
--------------
-
-#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3
-
-SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath().
-The fixes may affect older, SDL 2.0.3-based apps' save data. Please note
-that these changes only apply to SDL-based WinRT apps, and not to apps for
-any other platform.
-
-1. SDL_GetPrefPath() would return an invalid path, one in which the path's
- directory had not been created. Attempts to create files there
- (via fopen(), for example), would fail, unless that directory was
- explicitly created beforehand.
-
-2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside
- a WinRT 'Roaming' folder, the contents of which get automatically
- synchronized across multiple devices. This process can occur while an
- application runs, and can cause existing save-data to be overwritten
- at unexpected times, with data from other devices. (Windows Phone apps
- written with SDL 2.0.3 did not utilize a Roaming folder, due to API
- restrictions in Windows Phone 8.0).
-
-
-SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:
-
-1. making sure that SDL_GetPrefPath() returns a directory in which data
- can be written to immediately, without first needing to create directories.
-
-2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the
- contents of which do not automatically get synchronized across devices
- (and which require less work to use safely, in terms of data integrity).
-
-Apps that wish to get their Roaming folder's path can do so either by using
-SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a
-UCS-2/wide-char string), or directly through the WinRT class,
-Windows.Storage.ApplicationData.
-
-
-
-Setup, High-Level Steps
------------------------
-
-The steps for setting up a project for an SDL/WinRT app looks like the
-following, at a high-level:
-
-1. create a new Visual C++ project using Microsoft's template for a,
- "Direct3D App".
-2. remove most of the files from the project.
-3. make your app's project directly reference SDL/WinRT's own Visual C++
- project file, via use of Visual C++'s "References" dialog. This will setup
- the linker, and will copy SDL's .dll files to your app's final output.
-4. adjust your app's build settings, at minimum, telling it where to find SDL's
- header files.
-5. add files that contains a WinRT-appropriate main function, along with some
- data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls)
- work properly.
-6. add SDL-specific app code.
-7. build and run your app.
-
-
-Setup, Detailed Steps
----------------------
-
-### 1. Create a new project ###
-
-Create a new project using one of Visual C++'s templates for a plain, non-XAML,
-"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use). If you
-don't see one of these templates, in Visual C++'s 'New Project' dialog, try
-using the textbox titled, 'Search Installed Templates' to look for one.
-
-
-### 2. Remove unneeded files from the project ###
-
-In the new project, delete any file that has one of the following extensions:
-
-- .cpp
-- .h
-- .hlsl
-
-When you are done, you should be left with a few files, each of which will be a
-necessary part of your app's project. These files will consist of:
-
-- an .appxmanifest file, which contains metadata on your WinRT app. This is
- similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android.
-- a few .png files, one of which is a splash screen (displayed when your app
- launches), others are app icons.
-- a .pfx file, used for code signing purposes.
-
-
-### 3. Add references to SDL's project files ###
-
-SDL/WinRT can be built in multiple variations, spanning across three different
-CPU architectures (x86, x64, and ARM) and two different configurations
-(Debug and Release). WinRT and Visual C++ do not currently provide a means
-for combining multiple variations of one library into a single file.
-Furthermore, it does not provide an easy means for copying pre-built .dll files
-into your app's final output (via Post-Build steps, for example). It does,
-however, provide a system whereby an app can reference the MSVC projects of
-libraries such that, when the app is built:
-
-1. each library gets built for the appropriate CPU architecture(s) and WinRT
- platform(s).
-2. each library's output, such as .dll files, get copied to the app's build
- output.
-
-To set this up for SDL/WinRT, you'll need to run through the following steps:
-
-1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then
- "Solution Explorer")
-2. right click on your app's solution.
-3. navigate to "Add", then to "Existing Project..."
-4. find SDL/WinRT's Visual C++ project file and open it. Different project
- files exist for different WinRT platforms. All of them are in SDL's
- source distribution, in the following directories:
- * `VisualC-WinRT/UWP_VS2015/` - for Windows 10 / UWP apps
- * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps
- * `VisualC-WinRT/WinRT80_VS2012/` - for Windows 8.0 apps
- * `VisualC-WinRT/WinRT81_VS2013/` - for Windows 8.1 apps
-5. once the project has been added, right-click on your app's project and
- select, "References..."
-6. click on the button titled, "Add New Reference..."
-7. check the box next to SDL
-8. click OK to close the dialog
-9. SDL will now show up in the list of references. Click OK to close that
- dialog.
-
-Your project is now linked to SDL's project, insofar that when the app is
-built, SDL will be built as well, with its build output getting included with
-your app.
-
-
-### 4. Adjust Your App's Build Settings ###
-
-Some build settings need to be changed in your app's project. This guide will
-outline the following:
-
-- making sure that the compiler knows where to find SDL's header files
-- **Optional for C++, but NECESSARY for compiling C code:** telling the
- compiler not to use Microsoft's C++ extensions for WinRT development.
-- **Optional:** telling the compiler not generate errors due to missing
- precompiled header files.
-
-To change these settings:
-
-1. right-click on the project
-2. choose "Properties"
-3. in the drop-down box next to "Configuration", choose, "All Configurations"
-4. in the drop-down box next to "Platform", choose, "All Platforms"
-5. in the left-hand list, expand the "C/C++" section
-6. select "General"
-7. edit the "Additional Include Directories" setting, and add a path to SDL's
- "include" directory
-8. **Optional: to enable compilation of C code:** change the setting for
- "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No". If you're
- working with a completely C++ based project, this step can usually be
- omitted.
-9. **Optional: to disable precompiled headers (which can produce
- 'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand
- list, select "Precompiled Headers", then change the setting for "Precompiled
- Header" from "Use (/Yu)" to "Not Using Precompiled Headers".
-10. close the dialog, saving settings, by clicking the "OK" button
-
-
-### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ###
-
-A few files should be included directly in your app's MSVC project, specifically:
-1. a WinRT-appropriate main function (which is different than main() functions on
- other platforms)
-2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor
- (if and when the app needs to do so). *If this cursor resource is not
- included, mouse-position reporting may fail if and when the cursor is
- hidden, due to possible bugs/design-oddities in Windows itself.*
-
-To include these files:
-
-1. right-click on your project (again, in Visual C++'s Solution Explorer),
- navigate to "Add", then choose "Existing Item...".
-2. navigate to the directory containing SDL's source code, then into its
- subdirectory, 'src/main/winrt/'. Select, then add, the following files:
- - `SDL_winrt_main_NonXAML.cpp`
- - `SDL2-WinRTResources.rc`
- - `SDL2-WinRTResource_BlankCursor.cur`
-3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your
- project), then click on "Properties...".
-4. in the drop-down box next to "Configuration", choose, "All Configurations"
-5. in the drop-down box next to "Platform", choose, "All Platforms"
-6. in the left-hand list, click on "C/C++"
-7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
-8. click the OK button. This will close the dialog.
-
-
-**NOTE: C++/CX compilation is currently required in at least one file of your
-app's project. This is to make sure that Visual C++'s linker builds a 'Windows
-Metadata' file (.winmd) for your app. Not doing so can lead to build errors.**
-
-
-### 6. Add app code and assets ###
-
-At this point, you can add in SDL-specific source code. Be sure to include a
-C-style main function (ie: `int main(int argc, char *argv[])`). From there you
-should be able to create a single `SDL_Window` (WinRT apps can only have one
-window, at present), as well as an `SDL_Renderer`. Direct3D will be used to
-draw content. Events are received via SDL's usual event functions
-(`SDL_PollEvent`, etc.) If you have a set of existing source files and assets,
-you can start adding them to the project now. If not, or if you would like to
-make sure that you're setup correctly, some short and simple sample code is
-provided below.
-
-
-#### 6.A. ... when creating a new app ####
-
-If you are creating a new app (rather than porting an existing SDL-based app),
-or if you would just like a simple app to test SDL/WinRT with before trying to
-get existing code working, some working SDL/WinRT code is provided below. To
-set this up:
-
-1. right click on your app's project
-2. select Add, then New Item. An "Add New Item" dialog will show up.
-3. from the left-hand list, choose "Visual C++"
-4. from the middle/main list, choose "C++ File (.cpp)"
-5. near the bottom of the dialog, next to "Name:", type in a name for your
-source file, such as, "main.cpp".
-6. click on the Add button. This will close the dialog, add the new file to
-your project, and open the file in Visual C++'s text editor.
-7. Copy and paste the following code into the new file, then save it.
-
-
- #include <SDL.h>
-
- int main(int argc, char **argv)
- {
- SDL_DisplayMode mode;
- SDL_Window * window = NULL;
- SDL_Renderer * renderer = NULL;
- SDL_Event evt;
-
- if (SDL_Init(SDL_INIT_VIDEO) != 0) {
- return 1;
- }
-
- if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
- return 1;
- }
-
- if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
- return 1;
- }
-
- while (1) {
- while (SDL_PollEvent(&evt)) {
- }
-
- SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
- SDL_RenderClear(renderer);
- SDL_RenderPresent(renderer);
- }
- }
-
-
-#### 6.B. Adding code and assets ####
-
-If you have existing code and assets that you'd like to add, you should be able
-to add them now. The process for adding a set of files is as such.
-
-1. right click on the app's project
-2. select Add, then click on "New Item..."
-3. open any source, header, or asset files as appropriate. Support for C and
-C++ is available.
-
-Do note that WinRT only supports a subset of the APIs that are available to
-Win32-based apps. Many portions of the Win32 API and the C runtime are not
-available.
-
-A list of unsupported C APIs can be found at
-<http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
-
-General information on using the C runtime in WinRT can be found at
-<https://msdn.microsoft.com/en-us/library/hh972425.aspx>
-
-A list of supported Win32 APIs for WinRT apps can be found at
-<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>. To note,
-the list of supported Win32 APIs for Windows Phone 8.0 is different.
-That list can be found at
-<http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
-
-
-### 7. Build and run your app ###
-
-Your app project should now be setup, and you should be ready to build your app.
-To run it on the local machine, open the Debug menu and choose "Start
-Debugging". This will build your app, then run your app full-screen. To switch
-out of your app, press the Windows key. Alternatively, you can choose to run
-your app in a window. To do this, before building and running your app, find
-the drop-down menu in Visual C++'s toolbar that says, "Local Machine". Expand
-this by clicking on the arrow on the right side of the list, then click on
-Simulator. Once you do that, any time you build and run the app, the app will
-launch in window, rather than full-screen.
-
-
-#### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####
-
-**These instructions do not include Windows Phone, despite Windows Phone
-typically running on ARM processors.** They are specifically for devices
-that use the "Windows RT" operating system, which was a modified version of
-Windows 8.x that ran primarily on ARM-based tablet computers.
-
-To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
-
-- install Microsoft's "Remote Debugger" on the device. Visual C++ installs and
- debugs ARM-based apps via IP networks.
-- change a few options on the development machine, both to make sure it builds
- for ARM (rather than x86 or x64), and to make sure it knows how to find the
- Windows RT device (on the network).
-
-Microsoft's Remote Debugger can be found at
-<https://msdn.microsoft.com/en-us/library/hh441469.aspx>. Please note
-that separate versions of this debugger exist for different versions of Visual
-C++, one each for MSVC 2015, 2013, and 2012.
-
-To setup Visual C++ to launch your app on an ARM device:
-
-1. make sure the Remote Debugger is running on your ARM device, and that it's on
- the same IP network as your development machine.
-2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32". Click
- it, then change the value to "ARM".
-3. make sure Visual C++ knows the hostname or IP address of the ARM device. To
- do this:
- 1. open the app project's properties
- 2. select "Debugging"
- 3. next to "Machine Name", enter the hostname or IP address of the ARM
- device
- 4. if, and only if, you've turned off authentication in the Remote Debugger,
- then change the setting for "Require Authentication" to No
- 5. click "OK"
-4. build and run the app (from Visual C++). The first time you do this, a
- prompt will show up on the ARM device, asking for a Microsoft Account. You
- do, unfortunately, need to log in here, and will need to follow the
- subsequent registration steps in order to launch the app. After you do so,
- if the app didn't already launch, try relaunching it again from within Visual
- C++.
-
-
-Troubleshooting
----------------
-
-#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'"
-
-Try adding the following to your linker flags. In MSVC, this can be done by
-right-clicking on the app project, navigating to Configuration Properties ->
-Linker -> Command Line, then adding them to the Additional Options
-section.
-
-* For Release builds / MSVC-Configurations, add:
-
- /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib
-
-* For Debug builds / MSVC-Configurations, add:
-
- /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib
-
-
-#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values
-
-This may be caused by a bug in Windows itself, whereby hiding the mouse
-cursor can cause mouse-position reporting to fail.
-
-SDL provides a workaround for this, but it requires that an app links to a
-set of Win32-style cursor image-resource files. A copy of suitable resource
-files can be found in `src/main/winrt/`. Adding them to an app's Visual C++
-project file should be sufficient to get the app to use them.
-
-
-#### SDL's Visual Studio project file fails to open, with message, "The system can't find the file specified."
-
-This can be caused for any one of a few reasons, which Visual Studio can
-report, but won't always do so in an up-front manner.
-
-To help determine why this error comes up:
-
-1. open a copy of Visual Studio without opening a project file. This can be
- accomplished via Windows' Start Menu, among other means.
-2. show Visual Studio's Output window. This can be done by going to VS'
- menu bar, then to View, and then to Output.
-3. try opening the SDL project file directly by going to VS' menu bar, then
- to File, then to Open, then to Project/Solution. When a File-Open dialog
- appears, open the SDL project (such as the one in SDL's source code, in its
- directory, VisualC-WinRT/UWP_VS2015/).
-4. after attempting to open SDL's Visual Studio project file, additional error
- information will be output to the Output window.
-
-If Visual Studio reports (via its Output window) that the project:
-
-"could not be loaded because it's missing install components. To fix this launch Visual Studio setup with the following selections:
-Microsoft.VisualStudio.ComponentGroup.UWP.VC"
-
-... then you will need to re-launch Visual Studio's installer, and make sure that
-the workflow for "Universal Windows Platform development" is checked, and that its
-optional component, "C++ Universal Windows Platform tools" is also checked. While
-you are there, if you are planning on targeting UWP / Windows 10, also make sure
-that you check the optional component, "Windows 10 SDK (10.0.10240.0)". After
-making sure these items are checked as-appropriate, install them.
-
-Once you install these components, try re-launching Visual Studio, and re-opening
-the SDL project file. If you still get the error dialog, try using the Output
-window, again, seeing what Visual Studio says about it.
-
-
-#### Game controllers / joysticks aren't working!
-
-Windows only permits certain game controllers and joysticks to work within
-WinRT / UWP apps. Even if a game controller or joystick works in a Win32
-app, that device is not guaranteed to work inside a WinRT / UWP app.
-
-According to Microsoft, "Xbox compatible controllers" should work inside
-UWP apps, potentially with more working in the future. This includes, but
-may not be limited to, Microsoft-made Xbox controllers and USB adapters.
-(Source: https://social.msdn.microsoft.com/Forums/en-US/9064838b-e8c3-4c18-8a83-19bf0dfe150d/xinput-fails-to-detect-game-controllers?forum=wpdevelop)
-
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/README.md b/build/vc++/libs/SDL2-2.0.5/docs/README.md
deleted file mode 100644
index f348113..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/README.md
+++ /dev/null
@@ -1,63 +0,0 @@
-Simple DirectMedia Layer {#mainpage}
-========================
-
- (SDL)
-
- Version 2.0
-
----
-http://www.libsdl.org/
-
-Simple DirectMedia Layer is a cross-platform development library designed
-to provide low level access to audio, keyboard, mouse, joystick, and graphics
-hardware via OpenGL and Direct3D. It is used by video playback software,
-emulators, and popular games including Valve's award winning catalog
-and many Humble Bundle games.
-
-SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
-Support for other platforms may be found in the source code.
-
-SDL is written in C, works natively with C++, and there are bindings
-available for several other languages, including C# and Python.
-
-This library is distributed under the zlib license, which can be found
-in the file "COPYING.txt".
-
-The best way to learn how to use SDL is to check out the header files in
-the "include" subdirectory and the programs in the "test" subdirectory.
-The header files and test programs are well commented and always up to date.
-
-More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
-
-- [Android](README-android.md)
-- [CMake](README-cmake.md)
-- [DirectFB](README-directfb.md)
-- [DynAPI](README-dynapi.md)
-- [Emscripten](README-emscripten.md)
-- [Gesture](README-gesture.md)
-- [Mercurial](README-hg.md)
-- [iOS](README-ios.md)
-- [Linux](README-linux.md)
-- [OS X](README-macosx.md)
-- [Native Client](README-nacl.md)
-- [Pandora](README-pandora.md)
-- [Supported Platforms](README-platforms.md)
-- [Porting information](README-porting.md)
-- [PSP](README-psp.md)
-- [Raspberry Pi](README-raspberrypi.md)
-- [Touch](README-touch.md)
-- [WinCE](README-wince.md)
-- [Windows](README-windows.md)
-- [WinRT](README-winrt.md)
-
-If you need help with the library, or just want to discuss SDL related
-issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php)
-
-If you want to report bugs or contribute patches, please submit them to
-[bugzilla](https://bugzilla.libsdl.org/)
-
-Enjoy!
-
-
-Sam Lantinga <mailto:slouken@libsdl.org>
-
diff --git a/build/vc++/libs/SDL2-2.0.5/docs/doxyfile b/build/vc++/libs/SDL2-2.0.5/docs/doxyfile
deleted file mode 100644
index baf1c98..0000000
--- a/build/vc++/libs/SDL2-2.0.5/docs/doxyfile
+++ /dev/null
@@ -1,1560 +0,0 @@
-# Doxyfile 1.5.9
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = SDL
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 2.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./output
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = YES
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = YES
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES = "defined=\"\def\"" \
- "discussion=\"\par Discussion:\n\""
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set
-# FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = YES
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = YES
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = YES
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page. This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE = ./doxygen_warn.txt
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = . ../include
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.mm \
- *.dox \
- *.py \
- *.f90 \
- *.f \
- *.vhd \
- *.vhdl \
- *.h.in \
- *.h.default \
- *.md
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = ../include/SDL_opengles2_gl2ext.h \
- ../include/SDL_opengles2_gl2platform.h \
- ../include/SDL_opengles2_khrplatform.h \
- ../include/SDL_opengl_glext.h \
- ../include/SDL_opengles2_gl2.h \
- ../include/SDL_opengles2.h \
- ../include/SDL_opengles.h \
- ../include/SDL_opengl.h \
- ../include/SDL_egl.h \
-
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = YES
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = YES
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = NO
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX = SDL_ \
- SDL
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "SDL 2.0 Doxygen"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.libsdl.sdl20
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE = ./sdl20.chm
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE =
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 1
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to FRAME, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature. Other possible values
-# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list;
-# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
-# disables this behavior completely. For backwards compatibility with previous
-# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
-# respectively.
-
-GENERATE_TREEVIEW = ALL
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \
- DECLSPEC= \
- SDLCALL= \
- _WIN32=1
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE = ./SDL.tag
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = c:\Perl\bin\perl.exe
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = YES
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 60
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 2
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = YES
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Options related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL.h b/build/vc++/libs/SDL2-2.0.5/include/SDL.h
deleted file mode 100644
index 366d50f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL.h
- *
- * Main include header for the SDL library
- */
-
-
-#ifndef SDL_h_
-#define SDL_h_
-
-#include "SDL_main.h"
-#include "SDL_stdinc.h"
-#include "SDL_assert.h"
-#include "SDL_atomic.h"
-#include "SDL_audio.h"
-#include "SDL_clipboard.h"
-#include "SDL_cpuinfo.h"
-#include "SDL_endian.h"
-#include "SDL_error.h"
-#include "SDL_events.h"
-#include "SDL_filesystem.h"
-#include "SDL_gamecontroller.h"
-#include "SDL_haptic.h"
-#include "SDL_hints.h"
-#include "SDL_joystick.h"
-#include "SDL_loadso.h"
-#include "SDL_log.h"
-#include "SDL_messagebox.h"
-#include "SDL_mutex.h"
-#include "SDL_power.h"
-#include "SDL_render.h"
-#include "SDL_rwops.h"
-#include "SDL_shape.h"
-#include "SDL_system.h"
-#include "SDL_thread.h"
-#include "SDL_timer.h"
-#include "SDL_version.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* As of version 0.5, SDL is loaded dynamically into the application */
-
-/**
- * \name SDL_INIT_*
- *
- * These are the flags which may be passed to SDL_Init(). You should
- * specify the subsystems which you will be using in your application.
- */
-/* @{ */
-#define SDL_INIT_TIMER 0x00000001u
-#define SDL_INIT_AUDIO 0x00000010u
-#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
-#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
-#define SDL_INIT_HAPTIC 0x00001000u
-#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
-#define SDL_INIT_EVENTS 0x00004000u
-#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
-#define SDL_INIT_EVERYTHING ( \
- SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
- SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
- )
-/* @} */
-
-/**
- * This function initializes the subsystems specified by \c flags
- */
-extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
-
-/**
- * This function initializes specific SDL subsystems
- *
- * Subsystem initialization is ref-counted, you must call
- * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
- * shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
- * If a subsystem is already loaded then this call will
- * increase the ref-count and return.
- */
-extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
-
-/**
- * This function cleans up specific SDL subsystems
- */
-extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
-
-/**
- * This function returns a mask of the specified subsystems which have
- * previously been initialized.
- *
- * If \c flags is 0, it returns a mask of all initialized subsystems.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
-
-/**
- * This function cleans up all initialized subsystems. You should
- * call it upon all exit conditions.
- */
-extern DECLSPEC void SDLCALL SDL_Quit(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL.h
deleted file mode 100644
index 366d50f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL.h
- *
- * Main include header for the SDL library
- */
-
-
-#ifndef SDL_h_
-#define SDL_h_
-
-#include "SDL_main.h"
-#include "SDL_stdinc.h"
-#include "SDL_assert.h"
-#include "SDL_atomic.h"
-#include "SDL_audio.h"
-#include "SDL_clipboard.h"
-#include "SDL_cpuinfo.h"
-#include "SDL_endian.h"
-#include "SDL_error.h"
-#include "SDL_events.h"
-#include "SDL_filesystem.h"
-#include "SDL_gamecontroller.h"
-#include "SDL_haptic.h"
-#include "SDL_hints.h"
-#include "SDL_joystick.h"
-#include "SDL_loadso.h"
-#include "SDL_log.h"
-#include "SDL_messagebox.h"
-#include "SDL_mutex.h"
-#include "SDL_power.h"
-#include "SDL_render.h"
-#include "SDL_rwops.h"
-#include "SDL_shape.h"
-#include "SDL_system.h"
-#include "SDL_thread.h"
-#include "SDL_timer.h"
-#include "SDL_version.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* As of version 0.5, SDL is loaded dynamically into the application */
-
-/**
- * \name SDL_INIT_*
- *
- * These are the flags which may be passed to SDL_Init(). You should
- * specify the subsystems which you will be using in your application.
- */
-/* @{ */
-#define SDL_INIT_TIMER 0x00000001u
-#define SDL_INIT_AUDIO 0x00000010u
-#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
-#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
-#define SDL_INIT_HAPTIC 0x00001000u
-#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
-#define SDL_INIT_EVENTS 0x00004000u
-#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
-#define SDL_INIT_EVERYTHING ( \
- SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
- SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
- )
-/* @} */
-
-/**
- * This function initializes the subsystems specified by \c flags
- */
-extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
-
-/**
- * This function initializes specific SDL subsystems
- *
- * Subsystem initialization is ref-counted, you must call
- * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
- * shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
- * If a subsystem is already loaded then this call will
- * increase the ref-count and return.
- */
-extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
-
-/**
- * This function cleans up specific SDL subsystems
- */
-extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
-
-/**
- * This function returns a mask of the specified subsystems which have
- * previously been initialized.
- *
- * If \c flags is 0, it returns a mask of all initialized subsystems.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
-
-/**
- * This function cleans up all initialized subsystems. You should
- * call it upon all exit conditions.
- */
-extern DECLSPEC void SDLCALL SDL_Quit(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_assert.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_assert.h
deleted file mode 100644
index 90abbe3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_assert.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_assert_h_
-#define SDL_assert_h_
-
-#include "SDL_config.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SDL_ASSERT_LEVEL
-#ifdef SDL_DEFAULT_ASSERT_LEVEL
-#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
-#elif defined(_DEBUG) || defined(DEBUG) || \
- (defined(__GNUC__) && !defined(__OPTIMIZE__))
-#define SDL_ASSERT_LEVEL 2
-#else
-#define SDL_ASSERT_LEVEL 1
-#endif
-#endif /* SDL_ASSERT_LEVEL */
-
-/*
-These are macros and not first class functions so that the debugger breaks
-on the assertion line and not in some random guts of SDL, and so each
-assert can have unique static variables associated with it.
-*/
-
-#if defined(_MSC_VER)
-/* Don't include intrin.h here because it contains C++ code */
- extern void __cdecl __debugbreak(void);
- #define SDL_TriggerBreakpoint() __debugbreak()
-#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
- #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(__386__) && defined(__WATCOMC__)
- #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
-#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
- #include <signal.h>
- #define SDL_TriggerBreakpoint() raise(SIGTRAP)
-#else
- /* How do we trigger breakpoints on this platform? */
- #define SDL_TriggerBreakpoint()
-#endif
-
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
-# define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
-# define SDL_FUNCTION __FUNCTION__
-#else
-# define SDL_FUNCTION "???"
-#endif
-#define SDL_FILE __FILE__
-#define SDL_LINE __LINE__
-
-/*
-sizeof (x) makes the compiler still parse the expression even without
-assertions enabled, so the code is always checked at compile time, but
-doesn't actually generate code for it, so there are no side effects or
-expensive checks at run time, just the constant size of what x WOULD be,
-which presumably gets optimized out as unused.
-This also solves the problem of...
-
- int somevalue = blah();
- SDL_assert(somevalue == 1);
-
-...which would cause compiles to complain that somevalue is unused if we
-disable assertions.
-*/
-
-/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
- this condition isn't constant. And looks like an owl's face! */
-#ifdef _MSC_VER /* stupid /W4 warnings. */
-#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
-#else
-#define SDL_NULL_WHILE_LOOP_CONDITION (0)
-#endif
-
-#define SDL_disabled_assert(condition) \
- do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
-
-typedef enum
-{
- SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
- SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
- SDL_ASSERTION_ABORT, /**< Terminate the program. */
- SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
- SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
-} SDL_AssertState;
-
-typedef struct SDL_AssertData
-{
- int always_ignore;
- unsigned int trigger_count;
- const char *condition;
- const char *filename;
- int linenum;
- const char *function;
- const struct SDL_AssertData *next;
-} SDL_AssertData;
-
-#if (SDL_ASSERT_LEVEL > 0)
-
-/* Never call this directly. Use the SDL_assert* macros. */
-extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
- const char *,
- const char *, int)
-#if defined(__clang__)
-#if __has_feature(attribute_analyzer_noreturn)
-/* this tells Clang's static analysis that we're a custom assert function,
- and that the analyzer should assume the condition was always true past this
- SDL_assert test. */
- __attribute__((analyzer_noreturn))
-#endif
-#endif
-;
-
-/* the do {} while(0) avoids dangling else problems:
- if (x) SDL_assert(y); else blah();
- ... without the do/while, the "else" could attach to this macro's "if".
- We try to handle just the minimum we need here in a macro...the loop,
- the static vars, and break points. The heavy lifting is handled in
- SDL_ReportAssertion(), in SDL_assert.c.
-*/
-#define SDL_enabled_assert(condition) \
- do { \
- while ( !(condition) ) { \
- static struct SDL_AssertData sdl_assert_data = { \
- 0, 0, #condition, 0, 0, 0, 0 \
- }; \
- const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
- if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
- continue; /* go again. */ \
- } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
- SDL_TriggerBreakpoint(); \
- } \
- break; /* not retrying. */ \
- } \
- } while (SDL_NULL_WHILE_LOOP_CONDITION)
-
-#endif /* enabled assertions support code */
-
-/* Enable various levels of assertions. */
-#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
-# define SDL_assert(condition) SDL_disabled_assert(condition)
-# define SDL_assert_release(condition) SDL_disabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
-#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
-# define SDL_assert(condition) SDL_disabled_assert(condition)
-# define SDL_assert_release(condition) SDL_enabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
-#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
-# define SDL_assert(condition) SDL_enabled_assert(condition)
-# define SDL_assert_release(condition) SDL_enabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
-#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
-# define SDL_assert(condition) SDL_enabled_assert(condition)
-# define SDL_assert_release(condition) SDL_enabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
-#else
-# error Unknown assertion level.
-#endif
-
-/* this assertion is never disabled at any level. */
-#define SDL_assert_always(condition) SDL_enabled_assert(condition)
-
-
-typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
- const SDL_AssertData* data, void* userdata);
-
-/**
- * \brief Set an application-defined assertion handler.
- *
- * This allows an app to show its own assertion UI and/or force the
- * response to an assertion failure. If the app doesn't provide this, SDL
- * will try to do the right thing, popping up a system-specific GUI dialog,
- * and probably minimizing any fullscreen windows.
- *
- * This callback may fire from any thread, but it runs wrapped in a mutex, so
- * it will only fire from one thread at a time.
- *
- * Setting the callback to NULL restores SDL's original internal handler.
- *
- * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
- *
- * Return SDL_AssertState value of how to handle the assertion failure.
- *
- * \param handler Callback function, called when an assertion fails.
- * \param userdata A pointer passed to the callback as-is.
- */
-extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
- SDL_AssertionHandler handler,
- void *userdata);
-
-/**
- * \brief Get the default assertion handler.
- *
- * This returns the function pointer that is called by default when an
- * assertion is triggered. This is an internal function provided by SDL,
- * that is used for assertions when SDL_SetAssertionHandler() hasn't been
- * used to provide a different function.
- *
- * \return The default SDL_AssertionHandler that is called when an assert triggers.
- */
-extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
-
-/**
- * \brief Get the current assertion handler.
- *
- * This returns the function pointer that is called when an assertion is
- * triggered. This is either the value last passed to
- * SDL_SetAssertionHandler(), or if no application-specified function is
- * set, is equivalent to calling SDL_GetDefaultAssertionHandler().
- *
- * \param puserdata Pointer to a void*, which will store the "userdata"
- * pointer that was passed to SDL_SetAssertionHandler().
- * This value will always be NULL for the default handler.
- * If you don't care about this data, it is safe to pass
- * a NULL pointer to this function to ignore it.
- * \return The SDL_AssertionHandler that is called when an assert triggers.
- */
-extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
-
-/**
- * \brief Get a list of all assertion failures.
- *
- * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
- * or the start of the program.
- *
- * The proper way to examine this data looks something like this:
- *
- * <code>
- * const SDL_AssertData *item = SDL_GetAssertionReport();
- * while (item) {
- * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
- * item->condition, item->function, item->filename,
- * item->linenum, item->trigger_count,
- * item->always_ignore ? "yes" : "no");
- * item = item->next;
- * }
- * </code>
- *
- * \return List of all assertions.
- * \sa SDL_ResetAssertionReport
- */
-extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
-
-/**
- * \brief Reset the list of all assertion failures.
- *
- * Reset list of all assertions triggered.
- *
- * \sa SDL_GetAssertionReport
- */
-extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
-
-
-/* these had wrong naming conventions until 2.0.4. Please update your app! */
-#define SDL_assert_state SDL_AssertState
-#define SDL_assert_data SDL_AssertData
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_assert_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_atomic.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_atomic.h
deleted file mode 100644
index 36e37f3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_atomic.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_atomic.h
- *
- * Atomic operations.
- *
- * IMPORTANT:
- * If you are not an expert in concurrent lockless programming, you should
- * only be using the atomic lock and reference counting functions in this
- * file. In all other cases you should be protecting your data structures
- * with full mutexes.
- *
- * The list of "safe" functions to use are:
- * SDL_AtomicLock()
- * SDL_AtomicUnlock()
- * SDL_AtomicIncRef()
- * SDL_AtomicDecRef()
- *
- * Seriously, here be dragons!
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- *
- * You can find out a little more about lockless programming and the
- * subtle issues that can arise here:
- * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
- *
- * There's also lots of good information here:
- * http://www.1024cores.net/home/lock-free-algorithms
- * http://preshing.com/
- *
- * These operations may or may not actually be implemented using
- * processor specific atomic operations. When possible they are
- * implemented as true processor specific atomic operations. When that
- * is not possible the are implemented using locks that *do* use the
- * available atomic operations.
- *
- * All of the atomic operations that modify memory are full memory barriers.
- */
-
-#ifndef SDL_atomic_h_
-#define SDL_atomic_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_platform.h"
-
-#include "begin_code.h"
-
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name SDL AtomicLock
- *
- * The atomic locks are efficient spinlocks using CPU instructions,
- * but are vulnerable to starvation and can spin forever if a thread
- * holding a lock has been terminated. For this reason you should
- * minimize the code executed inside an atomic lock and never do
- * expensive things like API or system calls while holding them.
- *
- * The atomic locks are not safe to lock recursively.
- *
- * Porting Note:
- * The spin lock functions and type are required and can not be
- * emulated because they are used in the atomic emulation code.
- */
-/* @{ */
-
-typedef int SDL_SpinLock;
-
-/**
- * \brief Try to lock a spin lock by setting it to a non-zero value.
- *
- * \param lock Points to the lock.
- *
- * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
-
-/**
- * \brief Lock a spin lock by setting it to a non-zero value.
- *
- * \param lock Points to the lock.
- */
-extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
-
-/**
- * \brief Unlock a spin lock by setting it to 0. Always returns immediately
- *
- * \param lock Points to the lock.
- */
-extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
-
-/* @} *//* SDL AtomicLock */
-
-
-/**
- * The compiler barrier prevents the compiler from reordering
- * reads and writes to globally visible variables across the call.
- */
-#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
-void _ReadWriteBarrier(void);
-#pragma intrinsic(_ReadWriteBarrier)
-#define SDL_CompilerBarrier() _ReadWriteBarrier()
-#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
-/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
-#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
-#elif defined(__WATCOMC__)
-extern _inline void SDL_CompilerBarrier (void);
-#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
-#else
-#define SDL_CompilerBarrier() \
-{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
-#endif
-
-/**
- * Memory barriers are designed to prevent reads and writes from being
- * reordered by the compiler and being seen out of order on multi-core CPUs.
- *
- * A typical pattern would be for thread A to write some data and a flag,
- * and for thread B to read the flag and get the data. In this case you
- * would insert a release barrier between writing the data and the flag,
- * guaranteeing that the data write completes no later than the flag is
- * written, and you would insert an acquire barrier between reading the
- * flag and reading the data, to ensure that all the reads associated
- * with the flag have completed.
- *
- * In this pattern you should always see a release barrier paired with
- * an acquire barrier and you should gate the data reads/writes with a
- * single flag variable.
- *
- * For more information on these semantics, take a look at the blog post:
- * http://preshing.com/20120913/acquire-and-release-semantics
- */
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
-
-#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
-#elif defined(__GNUC__) && defined(__arm__)
-#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
-#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
-#ifdef __thumb__
-/* The mcr instruction isn't available in thumb mode, use real functions */
-#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
-#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
-#else
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
-#endif /* __thumb__ */
-#else
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
-#endif /* __GNUC__ && __arm__ */
-#else
-#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
-/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
-#include <mbarrier.h>
-#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
-#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
-#else
-/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
-#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
-#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
-#endif
-#endif
-
-/**
- * \brief A type representing an atomic integer value. It is a struct
- * so people don't accidentally use numeric operations on it.
- */
-typedef struct { int value; } SDL_atomic_t;
-
-/**
- * \brief Set an atomic variable to a new value if it is currently an old value.
- *
- * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
- *
- * \note If you don't know what this function is for, you shouldn't use it!
-*/
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
-
-/**
- * \brief Set an atomic variable to a value.
- *
- * \return The previous value of the atomic variable.
- */
-extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
-
-/**
- * \brief Get the value of an atomic variable
- */
-extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
-
-/**
- * \brief Add to an atomic variable.
- *
- * \return The previous value of the atomic variable.
- *
- * \note This same style can be used for any number operation
- */
-extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
-
-/**
- * \brief Increment an atomic variable used as a reference count.
- */
-#ifndef SDL_AtomicIncRef
-#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
-#endif
-
-/**
- * \brief Decrement an atomic variable used as a reference count.
- *
- * \return SDL_TRUE if the variable reached zero after decrementing,
- * SDL_FALSE otherwise
- */
-#ifndef SDL_AtomicDecRef
-#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
-#endif
-
-/**
- * \brief Set a pointer to a new value if it is currently an old value.
- *
- * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
- *
- * \note If you don't know what this function is for, you shouldn't use it!
-*/
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
-
-/**
- * \brief Set a pointer to a value atomically.
- *
- * \return The previous value of the pointer.
- */
-extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
-
-/**
- * \brief Get the value of a pointer atomically.
- */
-extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-
-#include "close_code.h"
-
-#endif /* SDL_atomic_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_audio.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_audio.h
deleted file mode 100644
index f119c2b..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_audio.h
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_audio.h
- *
- * Access to the raw audio mixing buffer for the SDL library.
- */
-
-#ifndef SDL_audio_h_
-#define SDL_audio_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_endian.h"
-#include "SDL_mutex.h"
-#include "SDL_thread.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Audio format flags.
- *
- * These are what the 16 bits in SDL_AudioFormat currently mean...
- * (Unspecified bits are always zero).
- *
- * \verbatim
- ++-----------------------sample is signed if set
- ||
- || ++-----------sample is bigendian if set
- || ||
- || || ++---sample is float if set
- || || ||
- || || || +---sample bit size---+
- || || || | |
- 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
- \endverbatim
- *
- * There are macros in SDL 2.0 and later to query these bits.
- */
-typedef Uint16 SDL_AudioFormat;
-
-/**
- * \name Audio flags
- */
-/* @{ */
-
-#define SDL_AUDIO_MASK_BITSIZE (0xFF)
-#define SDL_AUDIO_MASK_DATATYPE (1<<8)
-#define SDL_AUDIO_MASK_ENDIAN (1<<12)
-#define SDL_AUDIO_MASK_SIGNED (1<<15)
-#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
-#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
-#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
-#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
-#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
-#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
-#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
-
-/**
- * \name Audio format flags
- *
- * Defaults to LSB byte order.
- */
-/* @{ */
-#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
-#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
-#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
-#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
-#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
-#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
-#define AUDIO_U16 AUDIO_U16LSB
-#define AUDIO_S16 AUDIO_S16LSB
-/* @} */
-
-/**
- * \name int32 support
- */
-/* @{ */
-#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
-#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
-#define AUDIO_S32 AUDIO_S32LSB
-/* @} */
-
-/**
- * \name float32 support
- */
-/* @{ */
-#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
-#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
-#define AUDIO_F32 AUDIO_F32LSB
-/* @} */
-
-/**
- * \name Native audio byte ordering
- */
-/* @{ */
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define AUDIO_U16SYS AUDIO_U16LSB
-#define AUDIO_S16SYS AUDIO_S16LSB
-#define AUDIO_S32SYS AUDIO_S32LSB
-#define AUDIO_F32SYS AUDIO_F32LSB
-#else
-#define AUDIO_U16SYS AUDIO_U16MSB
-#define AUDIO_S16SYS AUDIO_S16MSB
-#define AUDIO_S32SYS AUDIO_S32MSB
-#define AUDIO_F32SYS AUDIO_F32MSB
-#endif
-/* @} */
-
-/**
- * \name Allow change flags
- *
- * Which audio format changes are allowed when opening a device.
- */
-/* @{ */
-#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
-#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
-#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
-#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
-/* @} */
-
-/* @} *//* Audio flags */
-
-/**
- * This function is called when the audio device needs more data.
- *
- * \param userdata An application-specific parameter saved in
- * the SDL_AudioSpec structure
- * \param stream A pointer to the audio data buffer.
- * \param len The length of that buffer in bytes.
- *
- * Once the callback returns, the buffer will no longer be valid.
- * Stereo samples are stored in a LRLRLR ordering.
- *
- * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
- * you like. Just open your audio device with a NULL callback.
- */
-typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
- int len);
-
-/**
- * The calculated values in this structure are calculated by SDL_OpenAudio().
- *
- * For multi-channel audio, the default SDL channel mapping is:
- * 2: FL FR (stereo)
- * 3: FL FR LFE (2.1 surround)
- * 4: FL FR BL BR (quad)
- * 5: FL FR FC BL BR (quad + center)
- * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
- * 7: FL FR FC LFE BC SL SR (6.1 surround)
- * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
- */
-typedef struct SDL_AudioSpec
-{
- int freq; /**< DSP frequency -- samples per second */
- SDL_AudioFormat format; /**< Audio data format */
- Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
- Uint8 silence; /**< Audio buffer silence value (calculated) */
- Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
- Uint16 padding; /**< Necessary for some compile environments */
- Uint32 size; /**< Audio buffer size in bytes (calculated) */
- SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
- void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
-} SDL_AudioSpec;
-
-
-struct SDL_AudioCVT;
-typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
- SDL_AudioFormat format);
-
-/**
- * \brief Upper limit of filters in SDL_AudioCVT
- *
- * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
- * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
- * one of which is the terminating NULL pointer.
- */
-#define SDL_AUDIOCVT_MAX_FILTERS 9
-
-/**
- * \struct SDL_AudioCVT
- * \brief A structure to hold a set of audio conversion filters and buffers.
- *
- * Note that various parts of the conversion pipeline can take advantage
- * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
- * you to pass it aligned data, but can possibly run much faster if you
- * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
- * (len) field to something that's a multiple of 16, if possible.
- */
-#ifdef __GNUC__
-/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
- pad it out to 88 bytes to guarantee ABI compatibility between compilers.
- vvv
- The next time we rev the ABI, make sure to size the ints and add padding.
-*/
-#define SDL_AUDIOCVT_PACKED __attribute__((packed))
-#else
-#define SDL_AUDIOCVT_PACKED
-#endif
-/* */
-typedef struct SDL_AudioCVT
-{
- int needed; /**< Set to 1 if conversion possible */
- SDL_AudioFormat src_format; /**< Source audio format */
- SDL_AudioFormat dst_format; /**< Target audio format */
- double rate_incr; /**< Rate conversion increment */
- Uint8 *buf; /**< Buffer to hold entire audio data */
- int len; /**< Length of original audio buffer */
- int len_cvt; /**< Length of converted audio buffer */
- int len_mult; /**< buffer must be len*len_mult big */
- double len_ratio; /**< Given len, final size is len*len_ratio */
- SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
- int filter_index; /**< Current audio conversion function */
-} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
-
-
-/* Function prototypes */
-
-/**
- * \name Driver discovery functions
- *
- * These functions return the list of built in audio drivers, in the
- * order that they are normally initialized by default.
- */
-/* @{ */
-extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
-extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
-/* @} */
-
-/**
- * \name Initialization and cleanup
- *
- * \internal These functions are used internally, and should not be used unless
- * you have a specific need to specify the audio driver you want to
- * use. You should normally use SDL_Init() or SDL_InitSubSystem().
- */
-/* @{ */
-extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
-extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
-/* @} */
-
-/**
- * This function returns the name of the current audio driver, or NULL
- * if no driver has been initialized.
- */
-extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
-
-/**
- * This function opens the audio device with the desired parameters, and
- * returns 0 if successful, placing the actual hardware parameters in the
- * structure pointed to by \c obtained. If \c obtained is NULL, the audio
- * data passed to the callback function will be guaranteed to be in the
- * requested format, and will be automatically converted to the hardware
- * audio format if necessary. This function returns -1 if it failed
- * to open the audio device, or couldn't set up the audio thread.
- *
- * When filling in the desired audio spec structure,
- * - \c desired->freq should be the desired audio frequency in samples-per-
- * second.
- * - \c desired->format should be the desired audio format.
- * - \c desired->samples is the desired size of the audio buffer, in
- * samples. This number should be a power of two, and may be adjusted by
- * the audio driver to a value more suitable for the hardware. Good values
- * seem to range between 512 and 8096 inclusive, depending on the
- * application and CPU speed. Smaller values yield faster response time,
- * but can lead to underflow if the application is doing heavy processing
- * and cannot fill the audio buffer in time. A stereo sample consists of
- * both right and left channels in LR ordering.
- * Note that the number of samples is directly related to time by the
- * following formula: \code ms = (samples*1000)/freq \endcode
- * - \c desired->size is the size in bytes of the audio buffer, and is
- * calculated by SDL_OpenAudio().
- * - \c desired->silence is the value used to set the buffer to silence,
- * and is calculated by SDL_OpenAudio().
- * - \c desired->callback should be set to a function that will be called
- * when the audio device is ready for more data. It is passed a pointer
- * to the audio buffer, and the length in bytes of the audio buffer.
- * This function usually runs in a separate thread, and so you should
- * protect data structures that it accesses by calling SDL_LockAudio()
- * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
- * pointer here, and call SDL_QueueAudio() with some frequency, to queue
- * more audio samples to be played (or for capture devices, call
- * SDL_DequeueAudio() with some frequency, to obtain audio samples).
- * - \c desired->userdata is passed as the first parameter to your callback
- * function. If you passed a NULL callback, this value is ignored.
- *
- * The audio device starts out playing silence when it's opened, and should
- * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
- * for your audio callback function to be called. Since the audio driver
- * may modify the requested size of the audio buffer, you should allocate
- * any local mixing buffers after you open the audio device.
- */
-extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
- SDL_AudioSpec * obtained);
-
-/**
- * SDL Audio Device IDs.
- *
- * A successful call to SDL_OpenAudio() is always device id 1, and legacy
- * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
- * always returns devices >= 2 on success. The legacy calls are good both
- * for backwards compatibility and when you don't care about multiple,
- * specific, or capture devices.
- */
-typedef Uint32 SDL_AudioDeviceID;
-
-/**
- * Get the number of available devices exposed by the current driver.
- * Only valid after a successfully initializing the audio subsystem.
- * Returns -1 if an explicit list of devices can't be determined; this is
- * not an error. For example, if SDL is set up to talk to a remote audio
- * server, it can't list every one available on the Internet, but it will
- * still allow a specific host to be specified to SDL_OpenAudioDevice().
- *
- * In many common cases, when this function returns a value <= 0, it can still
- * successfully open the default device (NULL for first argument of
- * SDL_OpenAudioDevice()).
- */
-extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
-
-/**
- * Get the human-readable name of a specific audio device.
- * Must be a value between 0 and (number of audio devices-1).
- * Only valid after a successfully initializing the audio subsystem.
- * The values returned by this function reflect the latest call to
- * SDL_GetNumAudioDevices(); recall that function to redetect available
- * hardware.
- *
- * The string returned by this function is UTF-8 encoded, read-only, and
- * managed internally. You are not to free it. If you need to keep the
- * string for any length of time, you should make your own copy of it, as it
- * will be invalid next time any of several other SDL functions is called.
- */
-extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
- int iscapture);
-
-
-/**
- * Open a specific audio device. Passing in a device name of NULL requests
- * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
- *
- * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
- * some drivers allow arbitrary and driver-specific strings, such as a
- * hostname/IP address for a remote audio server, or a filename in the
- * diskaudio driver.
- *
- * \return 0 on error, a valid device ID that is >= 2 on success.
- *
- * SDL_OpenAudio(), unlike this function, always acts on device ID 1.
- */
-extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
- *device,
- int iscapture,
- const
- SDL_AudioSpec *
- desired,
- SDL_AudioSpec *
- obtained,
- int
- allowed_changes);
-
-
-
-/**
- * \name Audio state
- *
- * Get the current audio state.
- */
-/* @{ */
-typedef enum
-{
- SDL_AUDIO_STOPPED = 0,
- SDL_AUDIO_PLAYING,
- SDL_AUDIO_PAUSED
-} SDL_AudioStatus;
-extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
-
-extern DECLSPEC SDL_AudioStatus SDLCALL
-SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
-/* @} *//* Audio State */
-
-/**
- * \name Pause audio functions
- *
- * These functions pause and unpause the audio callback processing.
- * They should be called with a parameter of 0 after opening the audio
- * device to start playing sound. This is so you can safely initialize
- * data for your callback function after opening the audio device.
- * Silence will be written to the audio device during the pause.
- */
-/* @{ */
-extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
-extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
- int pause_on);
-/* @} *//* Pause audio functions */
-
-/**
- * This function loads a WAVE from the data source, automatically freeing
- * that source if \c freesrc is non-zero. For example, to load a WAVE file,
- * you could do:
- * \code
- * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
- * \endcode
- *
- * If this function succeeds, it returns the given SDL_AudioSpec,
- * filled with the audio data format of the wave data, and sets
- * \c *audio_buf to a malloc()'d buffer containing the audio data,
- * and sets \c *audio_len to the length of that audio buffer, in bytes.
- * You need to free the audio buffer with SDL_FreeWAV() when you are
- * done with it.
- *
- * This function returns NULL and sets the SDL error message if the
- * wave file cannot be opened, uses an unknown data format, or is
- * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
- */
-extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
- int freesrc,
- SDL_AudioSpec * spec,
- Uint8 ** audio_buf,
- Uint32 * audio_len);
-
-/**
- * Loads a WAV from a file.
- * Compatibility convenience function.
- */
-#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
- SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
-
-/**
- * This function frees data previously allocated with SDL_LoadWAV_RW()
- */
-extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
-
-/**
- * This function takes a source format and rate and a destination format
- * and rate, and initializes the \c cvt structure with information needed
- * by SDL_ConvertAudio() to convert a buffer of audio data from one format
- * to the other. An unsupported format causes an error and -1 will be returned.
- *
- * \return 0 if no conversion is needed, 1 if the audio filter is set up,
- * or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
- SDL_AudioFormat src_format,
- Uint8 src_channels,
- int src_rate,
- SDL_AudioFormat dst_format,
- Uint8 dst_channels,
- int dst_rate);
-
-/**
- * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
- * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
- * audio data in the source format, this function will convert it in-place
- * to the desired format.
- *
- * The data conversion may expand the size of the audio data, so the buffer
- * \c cvt->buf should be allocated after the \c cvt structure is initialized by
- * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
- *
- * \return 0 on success or -1 if \c cvt->buf is NULL.
- */
-extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
-
-/* SDL_AudioStream is a new audio conversion interface.
- The benefits vs SDL_AudioCVT:
- - it can handle resampling data in chunks without generating
- artifacts, when it doesn't have the complete buffer available.
- - it can handle incoming data in any variable size.
- - You push data as you have it, and pull it when you need it
- */
-/* this is opaque to the outside world. */
-struct _SDL_AudioStream;
-typedef struct _SDL_AudioStream SDL_AudioStream;
-
-/**
- * Create a new audio stream
- *
- * \param src_format The format of the source audio
- * \param src_channels The number of channels of the source audio
- * \param src_rate The sampling rate of the source audio
- * \param dst_format The format of the desired audio output
- * \param dst_channels The number of channels of the desired audio output
- * \param dst_rate The sampling rate of the desired audio output
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
- const Uint8 src_channels,
- const int src_rate,
- const SDL_AudioFormat dst_format,
- const Uint8 dst_channels,
- const int dst_rate);
-
-/**
- * Add data to be converted/resampled to the stream
- *
- * \param stream The stream the audio data is being added to
- * \param buf A pointer to the audio data to add
- * \param int The number of bytes to write to the stream
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
-
-/**
- * Get converted/resampled data from the stream
- *
- * \param stream The stream the audio is being requested from
- * \param buf A buffer to fill with audio data
- * \param len The maximum number of bytes to fill
- * \return The number of bytes read from the stream, or -1 on error
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
-
-/**
- * Get the number of converted/resampled bytes available. The stream may be
- * buffering data behind the scenes until it has enough to resample
- * correctly, so this number might be lower than what you expect, or even
- * be zero. Add more data or flush the stream if you need the data now.
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
-
-/**
- * Tell the stream that you're done sending data, and anything being buffered
- * should be converted/resampled and made available immediately.
- *
- * It is legal to add more data to a stream after flushing, but there will
- * be audio gaps in the output. Generally this is intended to signal the
- * end of input, so the complete output becomes available.
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
-
-/**
- * Clear any pending data in the stream without converting it
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
-
-/**
- * Free an audio stream
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- */
-extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
-
-#define SDL_MIX_MAXVOLUME 128
-/**
- * This takes two audio buffers of the playing audio format and mixes
- * them, performing addition, volume adjustment, and overflow clipping.
- * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
- * for full audio volume. Note this does not change hardware volume.
- * This is provided for convenience -- you can mix your own audio data.
- */
-extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
- Uint32 len, int volume);
-
-/**
- * This works like SDL_MixAudio(), but you specify the audio format instead of
- * using the format of audio device 1. Thus it can be used when no audio
- * device is open at all.
- */
-extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
- const Uint8 * src,
- SDL_AudioFormat format,
- Uint32 len, int volume);
-
-/**
- * Queue more audio on non-callback devices.
- *
- * (If you are looking to retrieve queued audio from a non-callback capture
- * device, you want SDL_DequeueAudio() instead. This will return -1 to
- * signify an error if you use it with capture devices.)
- *
- * SDL offers two ways to feed audio to the device: you can either supply a
- * callback that SDL triggers with some frequency to obtain more audio
- * (pull method), or you can supply no callback, and then SDL will expect
- * you to supply data at regular intervals (push method) with this function.
- *
- * There are no limits on the amount of data you can queue, short of
- * exhaustion of address space. Queued data will drain to the device as
- * necessary without further intervention from you. If the device needs
- * audio but there is not enough queued, it will play silence to make up
- * the difference. This means you will have skips in your audio playback
- * if you aren't routinely queueing sufficient data.
- *
- * This function copies the supplied data, so you are safe to free it when
- * the function returns. This function is thread-safe, but queueing to the
- * same device from two threads at once does not promise which buffer will
- * be queued first.
- *
- * You may not queue audio on a device that is using an application-supplied
- * callback; doing so returns an error. You have to use the audio callback
- * or queue audio with this function, but not both.
- *
- * You should not call SDL_LockAudio() on the device before queueing; SDL
- * handles locking internally for this function.
- *
- * \param dev The device ID to which we will queue audio.
- * \param data The data to queue to the device for later playback.
- * \param len The number of bytes (not samples!) to which (data) points.
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_GetQueuedAudioSize
- * \sa SDL_ClearQueuedAudio
- */
-extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
-
-/**
- * Dequeue more audio on non-callback devices.
- *
- * (If you are looking to queue audio for output on a non-callback playback
- * device, you want SDL_QueueAudio() instead. This will always return 0
- * if you use it with playback devices.)
- *
- * SDL offers two ways to retrieve audio from a capture device: you can
- * either supply a callback that SDL triggers with some frequency as the
- * device records more audio data, (push method), or you can supply no
- * callback, and then SDL will expect you to retrieve data at regular
- * intervals (pull method) with this function.
- *
- * There are no limits on the amount of data you can queue, short of
- * exhaustion of address space. Data from the device will keep queuing as
- * necessary without further intervention from you. This means you will
- * eventually run out of memory if you aren't routinely dequeueing data.
- *
- * Capture devices will not queue data when paused; if you are expecting
- * to not need captured audio for some length of time, use
- * SDL_PauseAudioDevice() to stop the capture device from queueing more
- * data. This can be useful during, say, level loading times. When
- * unpaused, capture devices will start queueing data from that point,
- * having flushed any capturable data available while paused.
- *
- * This function is thread-safe, but dequeueing from the same device from
- * two threads at once does not promise which thread will dequeued data
- * first.
- *
- * You may not dequeue audio from a device that is using an
- * application-supplied callback; doing so returns an error. You have to use
- * the audio callback, or dequeue audio with this function, but not both.
- *
- * You should not call SDL_LockAudio() on the device before queueing; SDL
- * handles locking internally for this function.
- *
- * \param dev The device ID from which we will dequeue audio.
- * \param data A pointer into where audio data should be copied.
- * \param len The number of bytes (not samples!) to which (data) points.
- * \return number of bytes dequeued, which could be less than requested.
- *
- * \sa SDL_GetQueuedAudioSize
- * \sa SDL_ClearQueuedAudio
- */
-extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len);
-
-/**
- * Get the number of bytes of still-queued audio.
- *
- * For playback device:
- *
- * This is the number of bytes that have been queued for playback with
- * SDL_QueueAudio(), but have not yet been sent to the hardware. This
- * number may shrink at any time, so this only informs of pending data.
- *
- * Once we've sent it to the hardware, this function can not decide the
- * exact byte boundary of what has been played. It's possible that we just
- * gave the hardware several kilobytes right before you called this
- * function, but it hasn't played any of it yet, or maybe half of it, etc.
- *
- * For capture devices:
- *
- * This is the number of bytes that have been captured by the device and
- * are waiting for you to dequeue. This number may grow at any time, so
- * this only informs of the lower-bound of available data.
- *
- * You may not queue audio on a device that is using an application-supplied
- * callback; calling this function on such a device always returns 0.
- * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
- * the audio callback, but not both.
- *
- * You should not call SDL_LockAudio() on the device before querying; SDL
- * handles locking internally for this function.
- *
- * \param dev The device ID of which we will query queued audio size.
- * \return Number of bytes (not samples!) of queued audio.
- *
- * \sa SDL_QueueAudio
- * \sa SDL_ClearQueuedAudio
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
-
-/**
- * Drop any queued audio data. For playback devices, this is any queued data
- * still waiting to be submitted to the hardware. For capture devices, this
- * is any data that was queued by the device that hasn't yet been dequeued by
- * the application.
- *
- * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For
- * playback devices, the hardware will start playing silence if more audio
- * isn't queued. Unpaused capture devices will start filling the queue again
- * as soon as they have more data available (which, depending on the state
- * of the hardware and the thread, could be before this function call
- * returns!).
- *
- * This will not prevent playback of queued audio that's already been sent
- * to the hardware, as we can not undo that, so expect there to be some
- * fraction of a second of audio that might still be heard. This can be
- * useful if you want to, say, drop any pending music during a level change
- * in your game.
- *
- * You may not queue audio on a device that is using an application-supplied
- * callback; calling this function on such a device is always a no-op.
- * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
- * the audio callback, but not both.
- *
- * You should not call SDL_LockAudio() on the device before clearing the
- * queue; SDL handles locking internally for this function.
- *
- * This function always succeeds and thus returns void.
- *
- * \param dev The device ID of which to clear the audio queue.
- *
- * \sa SDL_QueueAudio
- * \sa SDL_GetQueuedAudioSize
- */
-extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
-
-
-/**
- * \name Audio lock functions
- *
- * The lock manipulated by these functions protects the callback function.
- * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
- * the callback function is not running. Do not call these from the callback
- * function or you will cause deadlock.
- */
-/* @{ */
-extern DECLSPEC void SDLCALL SDL_LockAudio(void);
-extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
-extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
-extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
-/* @} *//* Audio lock functions */
-
-/**
- * This function shuts down audio processing and closes the audio device.
- */
-extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
-extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_audio_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_bits.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_bits.h
deleted file mode 100644
index bc28572..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_bits.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_bits.h
- *
- * Functions for fiddling with bits and bitmasks.
- */
-
-#ifndef SDL_bits_h_
-#define SDL_bits_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_bits.h
- */
-
-/**
- * Get the index of the most significant bit. Result is undefined when called
- * with 0. This operation can also be stated as "count leading zeroes" and
- * "log base 2".
- *
- * \return Index of the most significant bit, or -1 if the value is 0.
- */
-#if defined(__WATCOMC__) && defined(__386__)
-extern _inline int _SDL_clz_watcom (Uint32);
-#pragma aux _SDL_clz_watcom = \
- "bsr eax, eax" \
- "xor eax, 31" \
- parm [eax] nomemory \
- value [eax] \
- modify exact [eax] nomemory;
-#endif
-
-SDL_FORCE_INLINE int
-SDL_MostSignificantBitIndex32(Uint32 x)
-{
-#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
- /* Count Leading Zeroes builtin in GCC.
- * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
- */
- if (x == 0) {
- return -1;
- }
- return 31 - __builtin_clz(x);
-#elif defined(__WATCOMC__) && defined(__386__)
- if (x == 0) {
- return -1;
- }
- return 31 - _SDL_clz_watcom(x);
-#else
- /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
- * <seander@cs.stanford.edu>, released in the public domain.
- * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
- */
- const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
- const int S[] = {1, 2, 4, 8, 16};
-
- int msbIndex = 0;
- int i;
-
- if (x == 0) {
- return -1;
- }
-
- for (i = 4; i >= 0; i--)
- {
- if (x & b[i])
- {
- x >>= S[i];
- msbIndex |= S[i];
- }
- }
-
- return msbIndex;
-#endif
-}
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_bits_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_blendmode.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_blendmode.h
deleted file mode 100644
index 9abd0bd..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_blendmode.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_blendmode.h
- *
- * Header file declaring the SDL_BlendMode enumeration
- */
-
-#ifndef SDL_blendmode_h_
-#define SDL_blendmode_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
- */
-typedef enum
-{
- SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
- dstRGBA = srcRGBA */
- SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
- dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
- dstA = srcA + (dstA * (1-srcA)) */
- SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
- dstRGB = (srcRGB * srcA) + dstRGB
- dstA = dstA */
- SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
- dstRGB = srcRGB * dstRGB
- dstA = dstA */
- SDL_BLENDMODE_INVALID = 0x7FFFFFFF
-
- /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
-
-} SDL_BlendMode;
-
-/**
- * \brief The blend operation used when combining source and destination pixel components
- */
-typedef enum
-{
- SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
- SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
- SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
- SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
- SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
-
-} SDL_BlendOperation;
-
-/**
- * \brief The normalized factor used to multiply pixel components
- */
-typedef enum
-{
- SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
- SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
- SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
- SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
- SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
- SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
- SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
- SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
- SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
- SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
-
-} SDL_BlendFactor;
-
-/**
- * \brief Create a custom blend mode, which may or may not be supported by a given renderer
- *
- * \param srcColorFactor
- * \param dstColorFactor
- * \param colorOperation
- * \param srcAlphaFactor
- * \param dstAlphaFactor
- * \param alphaOperation
- *
- * The result of the blend mode operation will be:
- * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
- * and
- * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
- */
-extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
- SDL_BlendFactor dstColorFactor,
- SDL_BlendOperation colorOperation,
- SDL_BlendFactor srcAlphaFactor,
- SDL_BlendFactor dstAlphaFactor,
- SDL_BlendOperation alphaOperation);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_blendmode_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_clipboard.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_clipboard.h
deleted file mode 100644
index 341f4ba..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_clipboard.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_clipboard.h
- *
- * Include file for SDL clipboard handling
- */
-
-#ifndef SDL_clipboard_h_
-#define SDL_clipboard_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function prototypes */
-
-/**
- * \brief Put UTF-8 text into the clipboard
- *
- * \sa SDL_GetClipboardText()
- */
-extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
-
-/**
- * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
- *
- * \sa SDL_SetClipboardText()
- */
-extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
-
-/**
- * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
- *
- * \sa SDL_GetClipboardText()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_clipboard_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h
deleted file mode 100644
index 1bbb838..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_windows_h_
-#define SDL_config_windows_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
-#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-#endif
-#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
-#define HAVE_DDRAW_H 1
-#define HAVE_DINPUT_H 1
-#define HAVE_DSOUND_H 1
-#define HAVE_DXGI_H 1
-#define HAVE_XINPUT_H 1
-
-/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
-#ifdef HAVE_LIBC
-/* Useful headers */
-#define STDC_HEADERS 1
-#define HAVE_CTYPE_H 1
-#define HAVE_FLOAT_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_STDIO_H 1
-#define HAVE_STRING_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE__COPYSIGN 1
-#if defined(_MSC_VER)
-/* These functions were added with the VC++ 2013 C runtime library */
-#if _MSC_VER >= 1800
-#define HAVE_STRTOLL 1
-#define HAVE_VSSCANF 1
-#define HAVE_SCALBN 1
-#endif
-/* This function is available with at least the VC++ 2008 C runtime library */
-#if _MSC_VER >= 1400
-#define HAVE__FSEEKI64 1
-#endif
-#endif
-#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
-#define HAVE_M_PI 1
-#endif
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#endif
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_WASAPI 1
-#define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_XAUDIO2 0
-#define SDL_AUDIO_DRIVER_WINMM 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_DINPUT 1
-#define SDL_JOYSTICK_XINPUT 1
-#define SDL_HAPTIC_DINPUT 1
-#define SDL_HAPTIC_XINPUT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_WINDOWS 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_WINDOWS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDOWS 1
-
-#ifndef SDL_VIDEO_RENDER_D3D
-#define SDL_VIDEO_RENDER_D3D 1
-#endif
-#ifndef SDL_VIDEO_RENDER_D3D11
-#define SDL_VIDEO_RENDER_D3D11 0
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_WGL
-#define SDL_VIDEO_OPENGL_WGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_OPENGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_EGL
-#define SDL_VIDEO_OPENGL_EGL 1
-#endif
-
-/* Enable Vulkan support */
-#define SDL_VIDEO_VULKAN 1
-
-/* Enable system power support */
-#define SDL_POWER_WINDOWS 1
-
-/* Enable filesystem support */
-#define SDL_FILESYSTEM_WINDOWS 1
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* SDL_config_windows_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.cmake b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.cmake
deleted file mode 100644
index c57266c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.cmake
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_h_
-#define SDL_config_h_
-
-/**
- * \file SDL_config.h.in
- *
- * This is a set of defines to configure the SDL features
- */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-/* C language features */
-#cmakedefine const @HAVE_CONST@
-#cmakedefine inline @HAVE_INLINE@
-#cmakedefine volatile @HAVE_VOLATILE@
-
-/* C datatypes */
-/* Define SIZEOF_VOIDP for 64/32 architectures */
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
-#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
-#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
-
-#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
-#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
-#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
-#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
-#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
-#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@
-#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
-#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
-#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
-#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
-
-/* Comment this if you want to build without any C library requirements */
-#cmakedefine HAVE_LIBC 1
-#if HAVE_LIBC
-
-/* Useful headers */
-#cmakedefine HAVE_ALLOCA_H 1
-#cmakedefine HAVE_SYS_TYPES_H 1
-#cmakedefine HAVE_STDIO_H 1
-#cmakedefine STDC_HEADERS 1
-#cmakedefine HAVE_STDLIB_H 1
-#cmakedefine HAVE_STDARG_H 1
-#cmakedefine HAVE_MALLOC_H 1
-#cmakedefine HAVE_MEMORY_H 1
-#cmakedefine HAVE_STRING_H 1
-#cmakedefine HAVE_STRINGS_H 1
-#cmakedefine HAVE_WCHAR_H 1
-#cmakedefine HAVE_INTTYPES_H 1
-#cmakedefine HAVE_STDINT_H 1
-#cmakedefine HAVE_CTYPE_H 1
-#cmakedefine HAVE_MATH_H 1
-#cmakedefine HAVE_ICONV_H 1
-#cmakedefine HAVE_SIGNAL_H 1
-#cmakedefine HAVE_ALTIVEC_H 1
-#cmakedefine HAVE_PTHREAD_NP_H 1
-#cmakedefine HAVE_LIBUDEV_H 1
-#cmakedefine HAVE_DBUS_DBUS_H 1
-#cmakedefine HAVE_IBUS_IBUS_H 1
-#cmakedefine HAVE_FCITX_FRONTEND_H 1
-#cmakedefine HAVE_LIBSAMPLERATE_H 1
-
-/* C library functions */
-#cmakedefine HAVE_MALLOC 1
-#cmakedefine HAVE_CALLOC 1
-#cmakedefine HAVE_REALLOC 1
-#cmakedefine HAVE_FREE 1
-#cmakedefine HAVE_ALLOCA 1
-#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
-#cmakedefine HAVE_GETENV 1
-#cmakedefine HAVE_SETENV 1
-#cmakedefine HAVE_PUTENV 1
-#cmakedefine HAVE_UNSETENV 1
-#endif
-#cmakedefine HAVE_QSORT 1
-#cmakedefine HAVE_ABS 1
-#cmakedefine HAVE_BCOPY 1
-#cmakedefine HAVE_MEMSET 1
-#cmakedefine HAVE_MEMCPY 1
-#cmakedefine HAVE_MEMMOVE 1
-#cmakedefine HAVE_MEMCMP 1
-#cmakedefine HAVE_WCSLEN 1
-#cmakedefine HAVE_WCSLCPY 1
-#cmakedefine HAVE_WCSLCAT 1
-#cmakedefine HAVE_WCSCMP 1
-#cmakedefine HAVE_STRLEN 1
-#cmakedefine HAVE_STRLCPY 1
-#cmakedefine HAVE_STRLCAT 1
-#cmakedefine HAVE_STRDUP 1
-#cmakedefine HAVE__STRREV 1
-#cmakedefine HAVE__STRUPR 1
-#cmakedefine HAVE__STRLWR 1
-#cmakedefine HAVE_INDEX 1
-#cmakedefine HAVE_RINDEX 1
-#cmakedefine HAVE_STRCHR 1
-#cmakedefine HAVE_STRRCHR 1
-#cmakedefine HAVE_STRSTR 1
-#cmakedefine HAVE_ITOA 1
-#cmakedefine HAVE__LTOA 1
-#cmakedefine HAVE__UITOA 1
-#cmakedefine HAVE__ULTOA 1
-#cmakedefine HAVE_STRTOL 1
-#cmakedefine HAVE_STRTOUL 1
-#cmakedefine HAVE__I64TOA 1
-#cmakedefine HAVE__UI64TOA 1
-#cmakedefine HAVE_STRTOLL 1
-#cmakedefine HAVE_STRTOULL 1
-#cmakedefine HAVE_STRTOD 1
-#cmakedefine HAVE_ATOI 1
-#cmakedefine HAVE_ATOF 1
-#cmakedefine HAVE_STRCMP 1
-#cmakedefine HAVE_STRNCMP 1
-#cmakedefine HAVE__STRICMP 1
-#cmakedefine HAVE_STRCASECMP 1
-#cmakedefine HAVE__STRNICMP 1
-#cmakedefine HAVE_STRNCASECMP 1
-#cmakedefine HAVE_VSSCANF 1
-#cmakedefine HAVE_VSNPRINTF 1
-#cmakedefine HAVE_M_PI 1
-#cmakedefine HAVE_ATAN 1
-#cmakedefine HAVE_ATAN2 1
-#cmakedefine HAVE_ACOS 1
-#cmakedefine HAVE_ASIN 1
-#cmakedefine HAVE_CEIL 1
-#cmakedefine HAVE_COPYSIGN 1
-#cmakedefine HAVE_COS 1
-#cmakedefine HAVE_COSF 1
-#cmakedefine HAVE_FABS 1
-#cmakedefine HAVE_FLOOR 1
-#cmakedefine HAVE_LOG 1
-#cmakedefine HAVE_POW 1
-#cmakedefine HAVE_SCALBN 1
-#cmakedefine HAVE_SIN 1
-#cmakedefine HAVE_SINF 1
-#cmakedefine HAVE_SQRT 1
-#cmakedefine HAVE_SQRTF 1
-#cmakedefine HAVE_TAN 1
-#cmakedefine HAVE_TANF 1
-#cmakedefine HAVE_FOPEN64 1
-#cmakedefine HAVE_FSEEKO 1
-#cmakedefine HAVE_FSEEKO64 1
-#cmakedefine HAVE_SIGACTION 1
-#cmakedefine HAVE_SA_SIGACTION 1
-#cmakedefine HAVE_SETJMP 1
-#cmakedefine HAVE_NANOSLEEP 1
-#cmakedefine HAVE_SYSCONF 1
-#cmakedefine HAVE_SYSCTLBYNAME 1
-#cmakedefine HAVE_CLOCK_GETTIME 1
-#cmakedefine HAVE_GETPAGESIZE 1
-#cmakedefine HAVE_MPROTECT 1
-#cmakedefine HAVE_ICONV 1
-#cmakedefine HAVE_PTHREAD_SETNAME_NP 1
-#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
-#cmakedefine HAVE_SEM_TIMEDWAIT 1
-#cmakedefine HAVE_GETAUXVAL 1
-#cmakedefine HAVE_POLL 1
-
-#elif __WIN32__
-#cmakedefine HAVE_STDARG_H 1
-#cmakedefine HAVE_STDDEF_H 1
-#else
-/* We may need some replacement for stdarg.h here */
-#include <stdarg.h>
-#endif /* HAVE_LIBC */
-
-/* SDL internal assertion support */
-#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
-
-/* Allow disabling of core subsystems */
-#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@
-#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@
-#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@
-#cmakedefine SDL_EVENTS_DISABLED @SDL_EVENTS_DISABLED@
-#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
-#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
-#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
-#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
-#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
-#cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@
-#cmakedefine SDL_TIMERS_DISABLED @SDL_TIMERS_DISABLED@
-#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@
-#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@
-#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
-
-/* Enable various audio drivers */
-#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
-#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
-#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
-#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@
-#cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@
-#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
-#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
-#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@
-#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
-#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@
-#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
-#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@
-#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
-#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
-#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
-#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
-#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@
-
-/* Enable various input drivers */
-#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
-#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
-#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
-#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
-#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
-#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
-#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
-#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
-#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
-#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@
-#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
-#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
-#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
-#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
-#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@
-#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@
-#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@
-#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
-#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
-#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
-#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
-
-/* Enable various shared object loading systems */
-#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
-#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
-#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
-#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@
-
-/* Enable various threading systems */
-#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
-#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
-#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
-#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@
-
-/* Enable various timer systems */
-#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@
-#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@
-#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
-#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
-#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
-
-/* Enable various video drivers */
-#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
-#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
-#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
-#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
-#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
-#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
-#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
-#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
-#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
-
-#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@
-#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@
-
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
-
-#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
-#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@
-#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@
-#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
-#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
-#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
-
-#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@
-#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@
-#cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@
-#cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
-#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
-#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
-
-/* Enable OpenGL support */
-#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
-#cmakedefine SDL_VIDEO_OPENGL_ES @SDL_VIDEO_OPENGL_ES@
-#cmakedefine SDL_VIDEO_OPENGL_ES2 @SDL_VIDEO_OPENGL_ES2@
-#cmakedefine SDL_VIDEO_OPENGL_BGL @SDL_VIDEO_OPENGL_BGL@
-#cmakedefine SDL_VIDEO_OPENGL_CGL @SDL_VIDEO_OPENGL_CGL@
-#cmakedefine SDL_VIDEO_OPENGL_GLX @SDL_VIDEO_OPENGL_GLX@
-#cmakedefine SDL_VIDEO_OPENGL_WGL @SDL_VIDEO_OPENGL_WGL@
-#cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@
-#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
-#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
-
-/* Enable Vulkan support */
-#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
-
-/* Enable system power support */
-#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
-#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
-#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
-#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
-#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
-#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
-#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
-
-/* Enable system filesystem support */
-#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
-#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@
-#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@
-#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@
-#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@
-#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@
-#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@
-
-/* Enable assembly routines */
-#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
-#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
-
-/* Enable dynamic libsamplerate support */
-#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
-
-/* Platform specific definitions */
-#if !defined(__WIN32__)
-# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
-typedef unsigned int size_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-# endif /* if (stdint.h isn't available) */
-#else /* __WIN32__ */
-# if !defined(_STDINT_H_) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
-# if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-# elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-# ifndef _UINTPTR_T_DEFINED
-# ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-# else
-typedef unsigned int uintptr_t;
-# endif
-#define _UINTPTR_T_DEFINED
-# endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-# if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-# endif
-# if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-# endif
-# else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-# ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-# endif
-typedef unsigned int uintptr_t;
-# endif /* __GNUC__ || _MSC_VER */
-# endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-#endif /* __WIN32__ */
-
-#endif /* SDL_config_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.in b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.in
deleted file mode 100644
index 8b3d208..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config.h.in
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_h_
-#define SDL_config_h_
-
-/**
- * \file SDL_config.h.in
- *
- * This is a set of defines to configure the SDL features
- */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-/* Make sure that this isn't included by Visual C++ */
-#ifdef _MSC_VER
-#error You should run hg revert SDL_config.h
-#endif
-
-/* C language features */
-#undef const
-#undef inline
-#undef volatile
-
-/* C datatypes */
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-#undef HAVE_GCC_ATOMICS
-#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
-
-#undef HAVE_DDRAW_H
-#undef HAVE_DINPUT_H
-#undef HAVE_DSOUND_H
-#undef HAVE_DXGI_H
-#undef HAVE_XINPUT_H
-#undef HAVE_XINPUT_GAMEPAD_EX
-#undef HAVE_XINPUT_STATE_EX
-
-/* Comment this if you want to build without any C library requirements */
-#undef HAVE_LIBC
-#if HAVE_LIBC
-
-/* Useful headers */
-#undef HAVE_ALLOCA_H
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_STDIO_H
-#undef STDC_HEADERS
-#undef HAVE_STDLIB_H
-#undef HAVE_STDARG_H
-#undef HAVE_MALLOC_H
-#undef HAVE_MEMORY_H
-#undef HAVE_STRING_H
-#undef HAVE_STRINGS_H
-#undef HAVE_WCHAR_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_STDINT_H
-#undef HAVE_CTYPE_H
-#undef HAVE_MATH_H
-#undef HAVE_ICONV_H
-#undef HAVE_SIGNAL_H
-#undef HAVE_ALTIVEC_H
-#undef HAVE_PTHREAD_NP_H
-#undef HAVE_LIBUDEV_H
-#undef HAVE_DBUS_DBUS_H
-#undef HAVE_IBUS_IBUS_H
-#undef HAVE_FCITX_FRONTEND_H
-#undef HAVE_LIBSAMPLERATE_H
-
-/* C library functions */
-#undef HAVE_MALLOC
-#undef HAVE_CALLOC
-#undef HAVE_REALLOC
-#undef HAVE_FREE
-#undef HAVE_ALLOCA
-#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
-#undef HAVE_GETENV
-#undef HAVE_SETENV
-#undef HAVE_PUTENV
-#undef HAVE_UNSETENV
-#endif
-#undef HAVE_QSORT
-#undef HAVE_ABS
-#undef HAVE_BCOPY
-#undef HAVE_MEMSET
-#undef HAVE_MEMCPY
-#undef HAVE_MEMMOVE
-#undef HAVE_MEMCMP
-#undef HAVE_WCSLEN
-#undef HAVE_WCSLCPY
-#undef HAVE_WCSLCAT
-#undef HAVE_WCSCMP
-#undef HAVE_STRLEN
-#undef HAVE_STRLCPY
-#undef HAVE_STRLCAT
-#undef HAVE_STRDUP
-#undef HAVE__STRREV
-#undef HAVE__STRUPR
-#undef HAVE__STRLWR
-#undef HAVE_INDEX
-#undef HAVE_RINDEX
-#undef HAVE_STRCHR
-#undef HAVE_STRRCHR
-#undef HAVE_STRSTR
-#undef HAVE_ITOA
-#undef HAVE__LTOA
-#undef HAVE__UITOA
-#undef HAVE__ULTOA
-#undef HAVE_STRTOL
-#undef HAVE_STRTOUL
-#undef HAVE__I64TOA
-#undef HAVE__UI64TOA
-#undef HAVE_STRTOLL
-#undef HAVE_STRTOULL
-#undef HAVE_STRTOD
-#undef HAVE_ATOI
-#undef HAVE_ATOF
-#undef HAVE_STRCMP
-#undef HAVE_STRNCMP
-#undef HAVE__STRICMP
-#undef HAVE_STRCASECMP
-#undef HAVE__STRNICMP
-#undef HAVE_STRNCASECMP
-#undef HAVE_SSCANF
-#undef HAVE_VSSCANF
-#undef HAVE_SNPRINTF
-#undef HAVE_VSNPRINTF
-#undef HAVE_M_PI
-#undef HAVE_ATAN
-#undef HAVE_ATAN2
-#undef HAVE_ACOS
-#undef HAVE_ASIN
-#undef HAVE_CEIL
-#undef HAVE_COPYSIGN
-#undef HAVE_COS
-#undef HAVE_COSF
-#undef HAVE_FABS
-#undef HAVE_FLOOR
-#undef HAVE_LOG
-#undef HAVE_POW
-#undef HAVE_SCALBN
-#undef HAVE_SIN
-#undef HAVE_SINF
-#undef HAVE_SQRT
-#undef HAVE_SQRTF
-#undef HAVE_TAN
-#undef HAVE_TANF
-#undef HAVE_FOPEN64
-#undef HAVE_FSEEKO
-#undef HAVE_FSEEKO64
-#undef HAVE_SIGACTION
-#undef HAVE_SA_SIGACTION
-#undef HAVE_SETJMP
-#undef HAVE_NANOSLEEP
-#undef HAVE_SYSCONF
-#undef HAVE_SYSCTLBYNAME
-#undef HAVE_CLOCK_GETTIME
-#undef HAVE_GETPAGESIZE
-#undef HAVE_MPROTECT
-#undef HAVE_ICONV
-#undef HAVE_PTHREAD_SETNAME_NP
-#undef HAVE_PTHREAD_SET_NAME_NP
-#undef HAVE_SEM_TIMEDWAIT
-#undef HAVE_GETAUXVAL
-#undef HAVE_POLL
-
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#define HAVE_STDINT_H 1
-#endif /* HAVE_LIBC */
-
-/* SDL internal assertion support */
-#undef SDL_DEFAULT_ASSERT_LEVEL
-
-/* Allow disabling of core subsystems */
-#undef SDL_ATOMIC_DISABLED
-#undef SDL_AUDIO_DISABLED
-#undef SDL_CPUINFO_DISABLED
-#undef SDL_EVENTS_DISABLED
-#undef SDL_FILE_DISABLED
-#undef SDL_JOYSTICK_DISABLED
-#undef SDL_HAPTIC_DISABLED
-#undef SDL_LOADSO_DISABLED
-#undef SDL_RENDER_DISABLED
-#undef SDL_THREADS_DISABLED
-#undef SDL_TIMERS_DISABLED
-#undef SDL_VIDEO_DISABLED
-#undef SDL_POWER_DISABLED
-#undef SDL_FILESYSTEM_DISABLED
-
-/* Enable various audio drivers */
-#undef SDL_AUDIO_DRIVER_ALSA
-#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
-#undef SDL_AUDIO_DRIVER_ANDROID
-#undef SDL_AUDIO_DRIVER_ARTS
-#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_COREAUDIO
-#undef SDL_AUDIO_DRIVER_DISK
-#undef SDL_AUDIO_DRIVER_DSOUND
-#undef SDL_AUDIO_DRIVER_DUMMY
-#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
-#undef SDL_AUDIO_DRIVER_ESD
-#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
-#undef SDL_AUDIO_DRIVER_HAIKU
-#undef SDL_AUDIO_DRIVER_JACK
-#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC
-#undef SDL_AUDIO_DRIVER_NACL
-#undef SDL_AUDIO_DRIVER_NAS
-#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_NETBSD
-#undef SDL_AUDIO_DRIVER_OSS
-#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
-#undef SDL_AUDIO_DRIVER_PAUDIO
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
-#undef SDL_AUDIO_DRIVER_QSA
-#undef SDL_AUDIO_DRIVER_SNDIO
-#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
-#undef SDL_AUDIO_DRIVER_SUNAUDIO
-#undef SDL_AUDIO_DRIVER_WASAPI
-#undef SDL_AUDIO_DRIVER_WINMM
-#undef SDL_AUDIO_DRIVER_XAUDIO2
-
-/* Enable various input drivers */
-#undef SDL_INPUT_LINUXEV
-#undef SDL_INPUT_LINUXKD
-#undef SDL_INPUT_TSLIB
-#undef SDL_JOYSTICK_HAIKU
-#undef SDL_JOYSTICK_DINPUT
-#undef SDL_JOYSTICK_XINPUT
-#undef SDL_JOYSTICK_DUMMY
-#undef SDL_JOYSTICK_IOKIT
-#undef SDL_JOYSTICK_LINUX
-#undef SDL_JOYSTICK_ANDROID
-#undef SDL_JOYSTICK_WINMM
-#undef SDL_JOYSTICK_USBHID
-#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
-#undef SDL_JOYSTICK_EMSCRIPTEN
-#undef SDL_HAPTIC_DUMMY
-#undef SDL_HAPTIC_LINUX
-#undef SDL_HAPTIC_IOKIT
-#undef SDL_HAPTIC_DINPUT
-#undef SDL_HAPTIC_XINPUT
-
-/* Enable various shared object loading systems */
-#undef SDL_LOADSO_DLOPEN
-#undef SDL_LOADSO_DUMMY
-#undef SDL_LOADSO_LDG
-#undef SDL_LOADSO_WINDOWS
-
-/* Enable various threading systems */
-#undef SDL_THREAD_PTHREAD
-#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
-#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
-#undef SDL_THREAD_WINDOWS
-
-/* Enable various timer systems */
-#undef SDL_TIMER_HAIKU
-#undef SDL_TIMER_DUMMY
-#undef SDL_TIMER_UNIX
-#undef SDL_TIMER_WINDOWS
-
-/* Enable various video drivers */
-#undef SDL_VIDEO_DRIVER_HAIKU
-#undef SDL_VIDEO_DRIVER_COCOA
-#undef SDL_VIDEO_DRIVER_DIRECTFB
-#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
-#undef SDL_VIDEO_DRIVER_DUMMY
-#undef SDL_VIDEO_DRIVER_WINDOWS
-#undef SDL_VIDEO_DRIVER_WAYLAND
-#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
-#undef SDL_VIDEO_DRIVER_MIR
-#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC
-#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
-#undef SDL_VIDEO_DRIVER_X11
-#undef SDL_VIDEO_DRIVER_RPI
-#undef SDL_VIDEO_DRIVER_KMSDRM
-#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
-#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
-#undef SDL_VIDEO_DRIVER_ANDROID
-#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
-#undef SDL_VIDEO_DRIVER_X11_XCURSOR
-#undef SDL_VIDEO_DRIVER_X11_XDBE
-#undef SDL_VIDEO_DRIVER_X11_XINERAMA
-#undef SDL_VIDEO_DRIVER_X11_XINPUT2
-#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
-#undef SDL_VIDEO_DRIVER_X11_XRANDR
-#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
-#undef SDL_VIDEO_DRIVER_X11_XSHAPE
-#undef SDL_VIDEO_DRIVER_X11_XVIDMODE
-#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
-#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
-#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
-#undef SDL_VIDEO_DRIVER_NACL
-#undef SDL_VIDEO_DRIVER_VIVANTE
-#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
-#undef SDL_VIDEO_DRIVER_QNX
-
-#undef SDL_VIDEO_RENDER_D3D
-#undef SDL_VIDEO_RENDER_D3D11
-#undef SDL_VIDEO_RENDER_OGL
-#undef SDL_VIDEO_RENDER_OGL_ES
-#undef SDL_VIDEO_RENDER_OGL_ES2
-#undef SDL_VIDEO_RENDER_DIRECTFB
-
-/* Enable OpenGL support */
-#undef SDL_VIDEO_OPENGL
-#undef SDL_VIDEO_OPENGL_ES
-#undef SDL_VIDEO_OPENGL_ES2
-#undef SDL_VIDEO_OPENGL_BGL
-#undef SDL_VIDEO_OPENGL_CGL
-#undef SDL_VIDEO_OPENGL_EGL
-#undef SDL_VIDEO_OPENGL_GLX
-#undef SDL_VIDEO_OPENGL_WGL
-#undef SDL_VIDEO_OPENGL_OSMESA
-#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
-
-/* Enable Vulkan support */
-#undef SDL_VIDEO_VULKAN
-
-/* Enable system power support */
-#undef SDL_POWER_LINUX
-#undef SDL_POWER_WINDOWS
-#undef SDL_POWER_MACOSX
-#undef SDL_POWER_HAIKU
-#undef SDL_POWER_ANDROID
-#undef SDL_POWER_EMSCRIPTEN
-#undef SDL_POWER_HARDWIRED
-
-/* Enable system filesystem support */
-#undef SDL_FILESYSTEM_HAIKU
-#undef SDL_FILESYSTEM_COCOA
-#undef SDL_FILESYSTEM_DUMMY
-#undef SDL_FILESYSTEM_UNIX
-#undef SDL_FILESYSTEM_WINDOWS
-#undef SDL_FILESYSTEM_NACL
-#undef SDL_FILESYSTEM_ANDROID
-#undef SDL_FILESYSTEM_EMSCRIPTEN
-
-/* Enable assembly routines */
-#undef SDL_ASSEMBLY_ROUTINES
-#undef SDL_ALTIVEC_BLITTERS
-
-/* Enable ime support */
-#undef SDL_USE_IME
-
-/* Enable dynamic udev support */
-#undef SDL_UDEV_DYNAMIC
-
-/* Enable dynamic libsamplerate support */
-#undef SDL_LIBSAMPLERATE_DYNAMIC
-
-#endif /* SDL_config_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_android.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_android.h
deleted file mode 100644
index 361bad8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_android.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_android_h_
-#define SDL_config_android_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/**
- * \file SDL_config_android.h
- *
- * This is a configuration that can be used to build SDL for Android
- */
-
-#include <stdarg.h>
-
-#define HAVE_GCC_ATOMICS 1
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_SETENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_CLOCK_GETTIME 1
-
-#define SIZEOF_VOIDP 4
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_ANDROID 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_ANDROID 1
-#define SDL_HAPTIC_ANDROID 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_ANDROID 1
-
-/* Enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES 1
-#define SDL_VIDEO_OPENGL_ES2 1
-#define SDL_VIDEO_OPENGL_EGL 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-
-/* Enable Vulkan support */
-/* Android does not support Vulkan in native code using the "armeabi" ABI. */
-#if defined(__ARM_ARCH) && __ARM_ARCH < 7
-#define SDL_VIDEO_VULKAN 0
-#else
-#define SDL_VIDEO_VULKAN 1
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_ANDROID 1
-
-/* Enable the filesystem driver */
-#define SDL_FILESYSTEM_ANDROID 1
-
-#endif /* SDL_config_android_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_iphoneos.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_iphoneos.h
deleted file mode 100644
index deea030..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_iphoneos.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_iphoneos_h_
-#define SDL_config_iphoneos_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
-#define HAVE_GCC_ATOMICS 1
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_SETENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_SYSCTLBYNAME 1
-
-/* enable iPhone version of Core Audio driver */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DUMMY 1
-
-/* Enable MFi joystick support */
-#define SDL_JOYSTICK_MFI 1
-
-/* Enable Unix style SO loading */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Supported video drivers */
-#define SDL_VIDEO_DRIVER_UIKIT 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES2 1
-#define SDL_VIDEO_OPENGL_ES 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-
-/* Enable Vulkan support */
-#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal
-#define SDL_VIDEO_VULKAN 1
-#else
-#define SDL_VIDEO_VULKAN 0
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_UIKIT 1
-
-/* enable iPhone keyboard support */
-#define SDL_IPHONE_KEYBOARD 1
-
-/* enable iOS extended launch screen */
-#define SDL_IPHONE_LAUNCHSCREEN 1
-
-/* Set max recognized G-force from accelerometer
- See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
- */
-#define SDL_IPHONE_MAX_GFORCE 5.0
-
-/* enable filesystem support */
-#define SDL_FILESYSTEM_COCOA 1
-
-#endif /* SDL_config_iphoneos_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h
deleted file mode 100644
index 9b09899..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_macosx_h_
-#define SDL_config_macosx_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
-#include <AvailabilityMacros.h>
-
-/* This is a set of defines to configure the SDL features */
-
-#ifdef __LP64__
- #define SIZEOF_VOIDP 8
-#else
- #define SIZEOF_VOIDP 4
-#endif
-
-/* Useful headers */
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_IOKIT 1
-#define SDL_HAPTIC_IOKIT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_COCOA 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#undef SDL_VIDEO_DRIVER_X11
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_XDBE 1
-#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
-#define SDL_VIDEO_DRIVER_X11_XRANDR 1
-#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
-#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
-#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
-#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
-
-#ifdef MAC_OS_X_VERSION_10_8
-/*
- * No matter the versions targeted, this is the 10.8 or later SDK, so you have
- * to use the external Xquartz, which is a more modern Xlib. Previous SDKs
- * used an older Xlib.
- */
-#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
-#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
-#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
-#endif
-
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_CGL
-#define SDL_VIDEO_OPENGL_CGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_GLX
-#define SDL_VIDEO_OPENGL_GLX 1
-#endif
-
-/* Enable Vulkan support */
-/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
-#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
-#define SDL_VIDEO_VULKAN 1
-#else
-#define SDL_VIDEO_VULKAN 0
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_MACOSX 1
-
-/* enable filesystem support */
-#define SDL_FILESYSTEM_COCOA 1
-
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-#ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS 1
-#endif
-
-#endif /* SDL_config_macosx_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h.orig b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h.orig
deleted file mode 100644
index f03f1ae..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_macosx.h.orig
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_macosx_h_
-#define SDL_config_macosx_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
-#include <AvailabilityMacros.h>
-
-/* This is a set of defines to configure the SDL features */
-
-#ifdef __LP64__
- #define SIZEOF_VOIDP 8
-#else
- #define SIZEOF_VOIDP 4
-#endif
-
-/* Useful headers */
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_IOKIT 1
-#define SDL_HAPTIC_IOKIT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_COCOA 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#undef SDL_VIDEO_DRIVER_X11
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_XDBE 1
-#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
-#define SDL_VIDEO_DRIVER_X11_XRANDR 1
-#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
-#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
-#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
-#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
-
-#ifdef MAC_OS_X_VERSION_10_8
-/*
- * No matter the versions targeted, this is the 10.8 or later SDK, so you have
- * to use the external Xquartz, which is a more modern Xlib. Previous SDKs
- * used an older Xlib.
- */
-#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
-#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
-#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
-#endif
-
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_CGL
-#define SDL_VIDEO_OPENGL_CGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_GLX
-#define SDL_VIDEO_OPENGL_GLX 1
-#endif
-
-/* Enable Vulkan support */
-/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures and 10.11+ */
-#if TARGET_CPU_X86_64
-#define SDL_VIDEO_VULKAN 1
-#else
-#define SDL_VIDEO_VULKAN 0
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_MACOSX 1
-
-/* enable filesystem support */
-#define SDL_FILESYSTEM_COCOA 1
-
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-#ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS 1
-#endif
-
-#endif /* SDL_config_macosx_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_minimal.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_minimal.h
deleted file mode 100644
index 3112700..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_minimal.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_minimal_h_
-#define SDL_config_minimal_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/**
- * \file SDL_config_minimal.h
- *
- * This is the minimal configuration that can be used to build SDL.
- */
-
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-
-/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
-#if defined(_MSC_VER) && (_MSC_VER < 1600)
-/* Here are some reasonable defaults */
-typedef unsigned int size_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-#else
-#define HAVE_STDINT_H 1
-#endif /* Visual Studio 2008 */
-
-#ifdef __GNUC__
-#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
-#endif
-
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED 1
-
-/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED 1
-
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
-
-/* Enable the stub thread support (src/thread/generic/\*.c) */
-#define SDL_THREADS_DISABLED 1
-
-/* Enable the stub timer support (src/timer/dummy/\*.c) */
-#define SDL_TIMERS_DISABLED 1
-
-/* Enable the dummy video driver (src/video/dummy/\*.c) */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
-#define SDL_FILESYSTEM_DUMMY 1
-
-#endif /* SDL_config_minimal_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_pandora.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_pandora.h
deleted file mode 100644
index ea62fe5..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_pandora.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_pandora_h_
-#define SDL_config_pandora_h_
-#define SDL_config_h_
-
-/* This is a set of defines to configure the SDL features */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
-#define SDL_BYTEORDER 1234
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_ICONV_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-
-#define SDL_AUDIO_DRIVER_DUMMY 1
-#define SDL_AUDIO_DRIVER_OSS 1
-
-#define SDL_INPUT_LINUXEV 1
-#define SDL_INPUT_TSLIB 1
-#define SDL_JOYSTICK_LINUX 1
-#define SDL_HAPTIC_LINUX 1
-
-#define SDL_LOADSO_DLOPEN 1
-
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
-
-#define SDL_TIMER_UNIX 1
-#define SDL_FILESYSTEM_UNIX 1
-
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_X11 1
-#define SDL_VIDEO_DRIVER_PANDORA 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_OPENGL_ES 1
-
-#endif /* SDL_config_pandora_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_psp.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_psp.h
deleted file mode 100644
index 28efb4c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_psp.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_psp_h_
-#define SDL_config_psp_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-
-
-#ifdef __GNUC__
-#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
-#endif
-
-#define HAVE_GCC_ATOMICS 1
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_SETENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-/* #define HAVE_SYSCONF 1 */
-/* #define HAVE_SIGACTION 1 */
-
-
-/* PSP isn't that sophisticated */
-#define LACKS_SYS_MMAN_H 1
-
-/* Enable the stub thread support (src/thread/psp/\*.c) */
-#define SDL_THREAD_PSP 1
-
-/* Enable the stub timer support (src/timer/psp/\*.c) */
-#define SDL_TIMERS_PSP 1
-
-/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
-#define SDL_JOYSTICK_PSP 1
-
-/* Enable the stub audio driver (src/audio/psp/\*.c) */
-#define SDL_AUDIO_DRIVER_PSP 1
-
-/* PSP video dirver */
-#define SDL_VIDEO_DRIVER_PSP 1
-
-/* PSP render dirver */
-#define SDL_VIDEO_RENDER_PSP 1
-
-#define SDL_POWER_PSP 1
-
-/* !!! FIXME: what does PSP do for filesystem stuff? */
-#define SDL_FILESYSTEM_DUMMY 1
-
-/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED 1
-
-/* PSP can't load shared object (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
-
-
-#endif /* SDL_config_psp_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_windows.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_windows.h
deleted file mode 100644
index 2456c84..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_windows.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_windows_h_
-#define SDL_config_windows_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
-#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-#endif
-#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
-#define HAVE_DDRAW_H 1
-#define HAVE_DINPUT_H 1
-#define HAVE_DSOUND_H 1
-#define HAVE_DXGI_H 1
-#define HAVE_XINPUT_H 1
-
-/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
-#ifdef HAVE_LIBC
-/* Useful headers */
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#if _MSC_VER >= 1800
-#define HAVE_STRTOLL 1
-#define HAVE_VSSCANF 1
-#define HAVE_COPYSIGN 1
-#define HAVE_SCALBN 1
-#endif
-#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
-#define HAVE_M_PI 1
-#endif
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#endif
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_WASAPI 1
-#define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_XAUDIO2 0
-#define SDL_AUDIO_DRIVER_WINMM 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_DINPUT 1
-#define SDL_JOYSTICK_XINPUT 1
-#define SDL_HAPTIC_DINPUT 1
-#define SDL_HAPTIC_XINPUT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_WINDOWS 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_WINDOWS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDOWS 1
-
-#ifndef SDL_VIDEO_RENDER_D3D
-#define SDL_VIDEO_RENDER_D3D 1
-#endif
-#ifndef SDL_VIDEO_RENDER_D3D11
-#define SDL_VIDEO_RENDER_D3D11 0
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_WGL
-#define SDL_VIDEO_OPENGL_WGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_OPENGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_EGL
-#define SDL_VIDEO_OPENGL_EGL 1
-#endif
-
-/* Enable Vulkan support */
-#define SDL_VIDEO_VULKAN 1
-
-/* Enable system power support */
-#define SDL_POWER_WINDOWS 1
-
-/* Enable filesystem support */
-#define SDL_FILESYSTEM_WINDOWS 1
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* SDL_config_windows_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_winrt.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_winrt.h
deleted file mode 100644
index 24f9e17..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_winrt.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_winrt_h_
-#define SDL_config_winrt_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used
- by SDL to determine which version of the Windows SDK is being used.
-*/
-#include <sdkddkver.h>
-
-/* Define possibly-undefined NTDDI values (used when compiling SDL against
- older versions of the Windows SDK.
-*/
-#ifndef NTDDI_WINBLUE
-#define NTDDI_WINBLUE 0x06030000
-#endif
-#ifndef NTDDI_WIN10
-#define NTDDI_WIN10 0x0A000000
-#endif
-
-/* This is a set of defines to configure the SDL features */
-
-#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
-#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-#endif
-#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
-/* Useful headers */
-#define HAVE_DXGI_H 1
-#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
-#define HAVE_XINPUT_H 1
-#endif
-#define HAVE_LIBC 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_FLOAT_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
-//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
-//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-//#define HAVE_STRTOLL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_VSNPRINTF 1
-//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_CEIL 1
-#define HAVE__COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-//#define HAVE_SCALBN 1
-#define HAVE__SCALB 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE__FSEEKI64 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_XAUDIO2 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
-#define SDL_JOYSTICK_DISABLED 1
-#define SDL_HAPTIC_DISABLED 1
-#else
-#define SDL_JOYSTICK_XINPUT 1
-#define SDL_HAPTIC_XINPUT 1
-#endif
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS 1
-
-/* Enable various threading systems */
-#if (NTDDI_VERSION >= NTDDI_WINBLUE)
-#define SDL_THREAD_WINDOWS 1
-#else
-/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
-#define SDL_THREAD_STDCPP 1
-#endif
-
-/* Enable various timer systems */
-#define SDL_TIMER_WINDOWS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_WINRT 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
-#define SDL_VIDEO_OPENGL_ES2 1
-#define SDL_VIDEO_OPENGL_EGL 1
-
-/* Enable appropriate renderer(s) */
-#define SDL_VIDEO_RENDER_D3D11 1
-
-#if SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_WINRT 1
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* SDL_config_winrt_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_wiz.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_wiz.h
deleted file mode 100644
index 5bb845a..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_config_wiz.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_wiz_h_
-#define SDL_config_wiz_h_
-#define SDL_config_h_
-
-/* This is a set of defines to configure the SDL features */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-#define SDL_BYTEORDER 1234
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_ICONV_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_POW 1
-
-#define SDL_AUDIO_DRIVER_DUMMY 1
-#define SDL_AUDIO_DRIVER_OSS 1
-
-#define SDL_INPUT_LINUXEV 1
-#define SDL_INPUT_TSLIB 1
-#define SDL_JOYSTICK_LINUX 1
-#define SDL_HAPTIC_LINUX 1
-
-#define SDL_LOADSO_DLOPEN 1
-
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
-
-#define SDL_TIMER_UNIX 1
-
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_PANDORA 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_OPENGL_ES 1
-
-#endif /* SDL_config_wiz_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_copying.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_copying.h
deleted file mode 100644
index 8f60af6..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_copying.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_cpuinfo.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_cpuinfo.h
deleted file mode 100644
index 94b64b0..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_cpuinfo.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_cpuinfo.h
- *
- * CPU feature detection for SDL.
- */
-
-#ifndef SDL_cpuinfo_h_
-#define SDL_cpuinfo_h_
-
-#include "SDL_stdinc.h"
-
-/* Need to do this here because intrin.h has C++ code in it */
-/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
-#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
-#ifdef __clang__
-/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
-#undef __MMX__
-#undef __SSE__
-#undef __SSE2__
-#else
-#include <intrin.h>
-#ifndef _WIN64
-#define __MMX__
-#define __3dNOW__
-#endif
-#define __SSE__
-#define __SSE2__
-#endif /* __clang__ */
-#elif defined(__MINGW64_VERSION_MAJOR)
-#include <intrin.h>
-#else
-#ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
-#include <altivec.h>
-#undef pixel
-#endif
-#endif
-#ifdef __MMX__
-#include <mmintrin.h>
-#endif
-#ifdef __3dNOW__
-#include <mm3dnow.h>
-#endif
-#ifdef __SSE__
-#include <xmmintrin.h>
-#endif
-#ifdef __SSE2__
-#include <emmintrin.h>
-#endif
-#ifdef __SSE3__
-#include <pmmintrin.h>
-#endif
-#endif
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This is a guess for the cacheline size used for padding.
- * Most x86 processors have a 64 byte cache line.
- * The 64-bit PowerPC processors have a 128 byte cache line.
- * We'll use the larger value to be generally safe.
- */
-#define SDL_CACHELINE_SIZE 128
-
-/**
- * This function returns the number of CPU cores available.
- */
-extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
-
-/**
- * This function returns the L1 cache line size of the CPU
- *
- * This is useful for determining multi-threaded structure padding
- * or SIMD prefetch sizes.
- */
-extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
-
-/**
- * This function returns true if the CPU has the RDTSC instruction.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
-
-/**
- * This function returns true if the CPU has AltiVec features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
-
-/**
- * This function returns true if the CPU has MMX features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
-
-/**
- * This function returns true if the CPU has 3DNow! features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
-
-/**
- * This function returns true if the CPU has SSE features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
-
-/**
- * This function returns true if the CPU has SSE2 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
-
-/**
- * This function returns true if the CPU has SSE3 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
-
-/**
- * This function returns true if the CPU has SSE4.1 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
-
-/**
- * This function returns true if the CPU has SSE4.2 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
-
-/**
- * This function returns true if the CPU has AVX features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
-
-/**
- * This function returns true if the CPU has AVX2 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
-
-/**
- * This function returns true if the CPU has NEON (ARM SIMD) features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
-
-/**
- * This function returns the amount of RAM configured in the system, in MB.
- */
-extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_cpuinfo_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_egl.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_egl.h
deleted file mode 100644
index e47fbe8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_egl.h
+++ /dev/null
@@ -1,1673 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_egl.h
- *
- * This is a simple file to encapsulate the EGL API headers.
- */
-#ifndef _MSC_VER
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#else /* _MSC_VER */
-
-/* EGL headers for Visual Studio */
-
-#ifndef __khrplatform_h_
-#define __khrplatform_h_
-
-/*
-** Copyright (c) 2008-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Khronos platform-specific types and definitions.
-*
-* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
-*
-* Adopters may modify this file to suit their platform. Adopters are
-* encouraged to submit platform specific modifications to the Khronos
-* group so that they can be included in future versions of this file.
-* Please submit changes by sending them to the public Khronos Bugzilla
-* (http://khronos.org/bugzilla) by filing a bug against product
-* "Khronos (general)" component "Registry".
-*
-* A predefined template which fills in some of the bug fields can be
-* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
-* must create a Bugzilla login first.
-*
-*
-* See the Implementer's Guidelines for information about where this file
-* should be located on your system and for more details of its use:
-* http://www.khronos.org/registry/implementers_guide.pdf
-*
-* This file should be included as
-* #include <KHR/khrplatform.h>
-* by Khronos client API header files that use its types and defines.
-*
-* The types in khrplatform.h should only be used to define API-specific types.
-*
-* Types defined in khrplatform.h:
-* khronos_int8_t signed 8 bit
-* khronos_uint8_t unsigned 8 bit
-* khronos_int16_t signed 16 bit
-* khronos_uint16_t unsigned 16 bit
-* khronos_int32_t signed 32 bit
-* khronos_uint32_t unsigned 32 bit
-* khronos_int64_t signed 64 bit
-* khronos_uint64_t unsigned 64 bit
-* khronos_intptr_t signed same number of bits as a pointer
-* khronos_uintptr_t unsigned same number of bits as a pointer
-* khronos_ssize_t signed size
-* khronos_usize_t unsigned size
-* khronos_float_t signed 32 bit floating point
-* khronos_time_ns_t unsigned 64 bit time in nanoseconds
-* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
-* nanoseconds
-* khronos_stime_nanoseconds_t signed time interval in nanoseconds
-* khronos_boolean_enum_t enumerated boolean type. This should
-* only be used as a base type when a client API's boolean type is
-* an enum. Client APIs which use an integer or other type for
-* booleans cannot use this as the base type for their boolean.
-*
-* Tokens defined in khrplatform.h:
-*
-* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
-*
-* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
-* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
-*
-* Calling convention macros defined in this file:
-* KHRONOS_APICALL
-* KHRONOS_APIENTRY
-* KHRONOS_APIATTRIBUTES
-*
-* These may be used in function prototypes as:
-*
-* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
-* int arg1,
-* int arg2) KHRONOS_APIATTRIBUTES;
-*/
-
-/*-------------------------------------------------------------------------
-* Definition of KHRONOS_APICALL
-*-------------------------------------------------------------------------
-* This precedes the return type of the function in the function prototype.
-*/
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
-# define KHRONOS_APICALL __declspec(dllimport)
-#elif defined (__SYMBIAN32__)
-# define KHRONOS_APICALL IMPORT_C
-#else
-# define KHRONOS_APICALL
-#endif
-
-/*-------------------------------------------------------------------------
-* Definition of KHRONOS_APIENTRY
-*-------------------------------------------------------------------------
-* This follows the return type of the function and precedes the function
-* name in the function prototype.
-*/
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
-/* Win32 but not WinCE */
-# define KHRONOS_APIENTRY __stdcall
-#else
-# define KHRONOS_APIENTRY
-#endif
-
-/*-------------------------------------------------------------------------
-* Definition of KHRONOS_APIATTRIBUTES
-*-------------------------------------------------------------------------
-* This follows the closing parenthesis of the function prototype arguments.
-*/
-#if defined (__ARMCC_2__)
-#define KHRONOS_APIATTRIBUTES __softfp
-#else
-#define KHRONOS_APIATTRIBUTES
-#endif
-
-/*-------------------------------------------------------------------------
-* basic type definitions
-*-----------------------------------------------------------------------*/
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
-
-
-/*
-* Using <stdint.h>
-*/
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__VMS ) || defined(__sgi)
-
-/*
-* Using <inttypes.h>
-*/
-#include <inttypes.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
-
-/*
-* Win32
-*/
-typedef __int32 khronos_int32_t;
-typedef unsigned __int32 khronos_uint32_t;
-typedef __int64 khronos_int64_t;
-typedef unsigned __int64 khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__sun__) || defined(__digital__)
-
-/*
-* Sun or Digital
-*/
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#if defined(__arch64__) || defined(_LP64)
-typedef long int khronos_int64_t;
-typedef unsigned long int khronos_uint64_t;
-#else
-typedef long long int khronos_int64_t;
-typedef unsigned long long int khronos_uint64_t;
-#endif /* __arch64__ */
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif 0
-
-/*
-* Hypothetical platform with no float or int64 support
-*/
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#define KHRONOS_SUPPORT_INT64 0
-#define KHRONOS_SUPPORT_FLOAT 0
-
-#else
-
-/*
-* Generic fallback
-*/
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#endif
-
-
-/*
-* Types that are (so far) the same on all platforms
-*/
-typedef signed char khronos_int8_t;
-typedef unsigned char khronos_uint8_t;
-typedef signed short int khronos_int16_t;
-typedef unsigned short int khronos_uint16_t;
-
-/*
-* Types that differ between LLP64 and LP64 architectures - in LLP64,
-* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
-* to be the only LLP64 architecture in current use.
-*/
-#ifdef _WIN64
-typedef signed long long int khronos_intptr_t;
-typedef unsigned long long int khronos_uintptr_t;
-typedef signed long long int khronos_ssize_t;
-typedef unsigned long long int khronos_usize_t;
-#else
-typedef signed long int khronos_intptr_t;
-typedef unsigned long int khronos_uintptr_t;
-typedef signed long int khronos_ssize_t;
-typedef unsigned long int khronos_usize_t;
-#endif
-
-#if KHRONOS_SUPPORT_FLOAT
-/*
-* Float type
-*/
-typedef float khronos_float_t;
-#endif
-
-#if KHRONOS_SUPPORT_INT64
-/* Time types
-*
-* These types can be used to represent a time interval in nanoseconds or
-* an absolute Unadjusted System Time. Unadjusted System Time is the number
-* of nanoseconds since some arbitrary system event (e.g. since the last
-* time the system booted). The Unadjusted System Time is an unsigned
-* 64 bit value that wraps back to 0 every 584 years. Time intervals
-* may be either signed or unsigned.
-*/
-typedef khronos_uint64_t khronos_utime_nanoseconds_t;
-typedef khronos_int64_t khronos_stime_nanoseconds_t;
-#endif
-
-/*
-* Dummy value used to pad enum types to 32 bits.
-*/
-#ifndef KHRONOS_MAX_ENUM
-#define KHRONOS_MAX_ENUM 0x7FFFFFFF
-#endif
-
-/*
-* Enumerated boolean type
-*
-* Values other than zero should be considered to be true. Therefore
-* comparisons should not be made against KHRONOS_TRUE.
-*/
-typedef enum {
- KHRONOS_FALSE = 0,
- KHRONOS_TRUE = 1,
- KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
-} khronos_boolean_enum_t;
-
-#endif /* __khrplatform_h_ */
-
-
-#ifndef __eglplatform_h_
-#define __eglplatform_h_
-
-/*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Platform-specific types and definitions for egl.h
-* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
-*
-* Adopters may modify khrplatform.h and this file to suit their platform.
-* You are encouraged to submit all modifications to the Khronos group so that
-* they can be included in future versions of this file. Please submit changes
-* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
-* by filing a bug against product "EGL" component "Registry".
-*/
-
-/*#include <KHR/khrplatform.h>*/
-
-/* Macros used in EGL function prototype declarations.
-*
-* EGL functions should be prototyped as:
-*
-* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
-* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
-*
-* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
-*/
-
-#ifndef EGLAPI
-#define EGLAPI KHRONOS_APICALL
-#endif
-
-#ifndef EGLAPIENTRY
-#define EGLAPIENTRY KHRONOS_APIENTRY
-#endif
-#define EGLAPIENTRYP EGLAPIENTRY*
-
-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
-* are aliases of window-system-dependent types, such as X Display * or
-* Windows Device Context. They must be defined in platform-specific
-* code below. The EGL-prefixed versions of Native*Type are the same
-* types, renamed in EGL 1.3 so all types in the API start with "EGL".
-*
-* Khronos STRONGLY RECOMMENDS that you use the default definitions
-* provided below, since these changes affect both binary and source
-* portability of applications using EGL running on different EGL
-* implementations.
-*/
-
-#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-
-#if __WINRT__
-#include <Unknwn.h>
-typedef IUnknown * EGLNativeWindowType;
-typedef IUnknown * EGLNativePixmapType;
-typedef IUnknown * EGLNativeDisplayType;
-#else
-typedef HDC EGLNativeDisplayType;
-typedef HBITMAP EGLNativePixmapType;
-typedef HWND EGLNativeWindowType;
-#endif
-
-#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
-
-typedef int EGLNativeDisplayType;
-typedef void *EGLNativeWindowType;
-typedef void *EGLNativePixmapType;
-
-#elif defined(WL_EGL_PLATFORM)
-
-typedef struct wl_display *EGLNativeDisplayType;
-typedef struct wl_egl_pixmap *EGLNativePixmapType;
-typedef struct wl_egl_window *EGLNativeWindowType;
-
-#elif defined(__GBM__)
-
-typedef struct gbm_device *EGLNativeDisplayType;
-typedef struct gbm_bo *EGLNativePixmapType;
-typedef void *EGLNativeWindowType;
-
-#elif defined(__ANDROID__) /* Android */
-
-struct ANativeWindow;
-struct egl_native_pixmap_t;
-
-typedef struct ANativeWindow *EGLNativeWindowType;
-typedef struct egl_native_pixmap_t *EGLNativePixmapType;
-typedef void *EGLNativeDisplayType;
-
-#elif defined(MIR_EGL_PLATFORM)
-
-#include <mir_toolkit/mir_client_library.h>
-typedef MirEGLNativeDisplayType EGLNativeDisplayType;
-typedef void *EGLNativePixmapType;
-typedef MirEGLNativeWindowType EGLNativeWindowType;
-
-#elif defined(__unix__)
-
-#ifdef MESA_EGL_NO_X11_HEADERS
-
-typedef void *EGLNativeDisplayType;
-typedef khronos_uintptr_t EGLNativePixmapType;
-typedef khronos_uintptr_t EGLNativeWindowType;
-
-#else
-
-/* X11 (tentative) */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap EGLNativePixmapType;
-typedef Window EGLNativeWindowType;
-
-#endif /* MESA_EGL_NO_X11_HEADERS */
-
-#else
-#error "Platform not recognized"
-#endif
-
-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
-typedef EGLNativeDisplayType NativeDisplayType;
-typedef EGLNativePixmapType NativePixmapType;
-typedef EGLNativeWindowType NativeWindowType;
-
-
-/* Define EGLint. This must be a signed integral type large enough to contain
-* all legal attribute names and values passed into and out of EGL, whether
-* their type is boolean, bitmask, enumerant (symbolic constant), integer,
-* handle, or other. While in general a 32-bit integer will suffice, if
-* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
-* integer type.
-*/
-typedef khronos_int32_t EGLint;
-
-#endif /* __eglplatform_h */
-
-#ifndef __egl_h_
-#define __egl_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2015 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
-*/
-
-/*#include <EGL/eglplatform.h>*/
-
-/* Generated on date 20150623 */
-
-/* Generated C header for:
- * API: egl
- * Versions considered: .*
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef EGL_VERSION_1_0
-#define EGL_VERSION_1_0 1
-typedef unsigned int EGLBoolean;
-typedef void *EGLDisplay;
-typedef void *EGLConfig;
-typedef void *EGLSurface;
-typedef void *EGLContext;
-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_DONT_CARE ((EGLint)-1)
-#define EGL_DRAW 0x3059
-#define EGL_EXTENSIONS 0x3055
-#define EGL_FALSE 0
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_HEIGHT 0x3056
-#define EGL_LARGEST_PBUFFER 0x3058
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-#define EGL_NONE 0x3038
-#define EGL_NON_CONFORMANT_CONFIG 0x3051
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
-#define EGL_PBUFFER_BIT 0x0001
-#define EGL_PIXMAP_BIT 0x0002
-#define EGL_READ 0x305A
-#define EGL_RED_SIZE 0x3024
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SLOW_CONFIG 0x3050
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_SUCCESS 0x3000
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-#define EGL_TRANSPARENT_RGB 0x3052
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRUE 1
-#define EGL_VENDOR 0x3053
-#define EGL_VERSION 0x3054
-#define EGL_WIDTH 0x3057
-#define EGL_WINDOW_BIT 0x0004
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
-EGLAPI EGLint EGLAPIENTRY eglGetError (void);
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
-#endif /* EGL_VERSION_1_0 */
-
-#ifndef EGL_VERSION_1_1
-#define EGL_VERSION_1_1 1
-#define EGL_BACK_BUFFER 0x3084
-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
-#define EGL_CONTEXT_LOST 0x300E
-#define EGL_MIN_SWAP_INTERVAL 0x303B
-#define EGL_MAX_SWAP_INTERVAL 0x303C
-#define EGL_MIPMAP_TEXTURE 0x3082
-#define EGL_MIPMAP_LEVEL 0x3083
-#define EGL_NO_TEXTURE 0x305C
-#define EGL_TEXTURE_2D 0x305F
-#define EGL_TEXTURE_FORMAT 0x3080
-#define EGL_TEXTURE_RGB 0x305D
-#define EGL_TEXTURE_RGBA 0x305E
-#define EGL_TEXTURE_TARGET 0x3081
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
-#endif /* EGL_VERSION_1_1 */
-
-#ifndef EGL_VERSION_1_2
-#define EGL_VERSION_1_2 1
-typedef unsigned int EGLenum;
-typedef void *EGLClientBuffer;
-#define EGL_ALPHA_FORMAT 0x3088
-#define EGL_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_ALPHA_FORMAT_PRE 0x308C
-#define EGL_ALPHA_MASK_SIZE 0x303E
-#define EGL_BUFFER_PRESERVED 0x3094
-#define EGL_BUFFER_DESTROYED 0x3095
-#define EGL_CLIENT_APIS 0x308D
-#define EGL_COLORSPACE 0x3087
-#define EGL_COLORSPACE_sRGB 0x3089
-#define EGL_COLORSPACE_LINEAR 0x308A
-#define EGL_COLOR_BUFFER_TYPE 0x303F
-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
-#define EGL_DISPLAY_SCALING 10000
-#define EGL_HORIZONTAL_RESOLUTION 0x3090
-#define EGL_LUMINANCE_BUFFER 0x308F
-#define EGL_LUMINANCE_SIZE 0x303D
-#define EGL_OPENGL_ES_BIT 0x0001
-#define EGL_OPENVG_BIT 0x0002
-#define EGL_OPENGL_ES_API 0x30A0
-#define EGL_OPENVG_API 0x30A1
-#define EGL_OPENVG_IMAGE 0x3096
-#define EGL_PIXEL_ASPECT_RATIO 0x3092
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_RGB_BUFFER 0x308E
-#define EGL_SINGLE_BUFFER 0x3085
-#define EGL_SWAP_BEHAVIOR 0x3093
-#define EGL_UNKNOWN ((EGLint)-1)
-#define EGL_VERTICAL_RESOLUTION 0x3091
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
-#endif /* EGL_VERSION_1_2 */
-
-#ifndef EGL_VERSION_1_3
-#define EGL_VERSION_1_3 1
-#define EGL_CONFORMANT 0x3042
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
-#define EGL_MATCH_NATIVE_PIXMAP 0x3041
-#define EGL_OPENGL_ES2_BIT 0x0004
-#define EGL_VG_ALPHA_FORMAT 0x3088
-#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
-#define EGL_VG_COLORSPACE 0x3087
-#define EGL_VG_COLORSPACE_sRGB 0x3089
-#define EGL_VG_COLORSPACE_LINEAR 0x308A
-#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
-#endif /* EGL_VERSION_1_3 */
-
-#ifndef EGL_VERSION_1_4
-#define EGL_VERSION_1_4 1
-#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
-#define EGL_MULTISAMPLE_RESOLVE 0x3099
-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
-#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
-#define EGL_OPENGL_API 0x30A2
-#define EGL_OPENGL_BIT 0x0008
-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
-#endif /* EGL_VERSION_1_4 */
-
-#ifndef EGL_VERSION_1_5
-#define EGL_VERSION_1_5 1
-typedef void *EGLSync;
-typedef intptr_t EGLAttrib;
-typedef khronos_utime_nanoseconds_t EGLTime;
-typedef void *EGLImage;
-#define EGL_CONTEXT_MAJOR_VERSION 0x3098
-#define EGL_CONTEXT_MINOR_VERSION 0x30FB
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
-#define EGL_NO_RESET_NOTIFICATION 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
-#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
-#define EGL_OPENGL_ES3_BIT 0x00000040
-#define EGL_CL_EVENT_HANDLE 0x309C
-#define EGL_SYNC_CL_EVENT 0x30FE
-#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
-#define EGL_SYNC_TYPE 0x30F7
-#define EGL_SYNC_STATUS 0x30F1
-#define EGL_SYNC_CONDITION 0x30F8
-#define EGL_SIGNALED 0x30F2
-#define EGL_UNSIGNALED 0x30F3
-#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
-#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
-#define EGL_TIMEOUT_EXPIRED 0x30F5
-#define EGL_CONDITION_SATISFIED 0x30F6
-#define EGL_NO_SYNC ((EGLSync)0)
-#define EGL_SYNC_FENCE 0x30F9
-#define EGL_GL_COLORSPACE 0x309D
-#define EGL_GL_COLORSPACE_SRGB 0x3089
-#define EGL_GL_COLORSPACE_LINEAR 0x308A
-#define EGL_GL_RENDERBUFFER 0x30B9
-#define EGL_GL_TEXTURE_2D 0x30B1
-#define EGL_GL_TEXTURE_LEVEL 0x30BC
-#define EGL_GL_TEXTURE_3D 0x30B2
-#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
-#define EGL_IMAGE_PRESERVED 0x30D2
-#define EGL_NO_IMAGE ((EGLImage)0)
-EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
-EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
-#endif /* EGL_VERSION_1_5 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __egl_h_ */
-
-
-
-#ifndef __eglext_h_
-#define __eglext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2015 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
-*/
-
-/*#include <EGL/eglplatform.h>*/
-
-#define EGL_EGLEXT_VERSION 20150623
-
-/* Generated C header for:
- * API: egl
- * Versions considered: .*
- * Versions emitted: _nomatch_^
- * Default extensions included: egl
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef EGL_KHR_cl_event
-#define EGL_KHR_cl_event 1
-#define EGL_CL_EVENT_HANDLE_KHR 0x309C
-#define EGL_SYNC_CL_EVENT_KHR 0x30FE
-#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
-#endif /* EGL_KHR_cl_event */
-
-#ifndef EGL_KHR_cl_event2
-#define EGL_KHR_cl_event2 1
-typedef void *EGLSyncKHR;
-typedef intptr_t EGLAttribKHR;
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
-#endif
-#endif /* EGL_KHR_cl_event2 */
-
-#ifndef EGL_KHR_client_get_all_proc_addresses
-#define EGL_KHR_client_get_all_proc_addresses 1
-#endif /* EGL_KHR_client_get_all_proc_addresses */
-
-#ifndef EGL_KHR_config_attribs
-#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR 0x3042
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
-#endif /* EGL_KHR_config_attribs */
-
-#ifndef EGL_KHR_create_context
-#define EGL_KHR_create_context 1
-#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
-#define EGL_CONTEXT_FLAGS_KHR 0x30FC
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
-#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
-#endif /* EGL_KHR_create_context */
-
-#ifndef EGL_KHR_create_context_no_error
-#define EGL_KHR_create_context_no_error 1
-#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
-#endif /* EGL_KHR_create_context_no_error */
-
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
-#define EGL_SYNC_CONDITION_KHR 0x30F8
-#define EGL_SYNC_FENCE_KHR 0x30F9
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_fence_sync */
-
-#ifndef EGL_KHR_get_all_proc_addresses
-#define EGL_KHR_get_all_proc_addresses 1
-#endif /* EGL_KHR_get_all_proc_addresses */
-
-#ifndef EGL_KHR_gl_colorspace
-#define EGL_KHR_gl_colorspace 1
-#define EGL_GL_COLORSPACE_KHR 0x309D
-#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
-#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
-#endif /* EGL_KHR_gl_colorspace */
-
-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR 0x30B9
-#endif /* EGL_KHR_gl_renderbuffer_image */
-
-#ifndef EGL_KHR_gl_texture_2D_image
-#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR 0x30B1
-#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
-#endif /* EGL_KHR_gl_texture_2D_image */
-
-#ifndef EGL_KHR_gl_texture_3D_image
-#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR 0x30B2
-#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
-#endif /* EGL_KHR_gl_texture_3D_image */
-
-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
-#endif /* EGL_KHR_gl_texture_cubemap_image */
-
-#ifndef EGL_KHR_image
-#define EGL_KHR_image 1
-typedef void *EGLImageKHR;
-#define EGL_NATIVE_PIXMAP_KHR 0x30B0
-#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
-#endif
-#endif /* EGL_KHR_image */
-
-#ifndef EGL_KHR_image_base
-#define EGL_KHR_image_base 1
-#define EGL_IMAGE_PRESERVED_KHR 0x30D2
-#endif /* EGL_KHR_image_base */
-
-#ifndef EGL_KHR_image_pixmap
-#define EGL_KHR_image_pixmap 1
-#endif /* EGL_KHR_image_pixmap */
-
-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR 0x0001
-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
-#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
-#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
-#define EGL_MATCH_FORMAT_KHR 0x3043
-#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
-#define EGL_FORMAT_RGB_565_KHR 0x30C1
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
-#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
-#define EGL_BITMAP_POINTER_KHR 0x30C6
-#define EGL_BITMAP_PITCH_KHR 0x30C7
-#define EGL_BITMAP_ORIGIN_KHR 0x30C8
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
-#define EGL_LOWER_LEFT_KHR 0x30CE
-#define EGL_UPPER_LEFT_KHR 0x30CF
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
-#endif
-#endif /* EGL_KHR_lock_surface */
-
-#ifndef EGL_KHR_lock_surface2
-#define EGL_KHR_lock_surface2 1
-#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
-#endif /* EGL_KHR_lock_surface2 */
-
-#ifndef EGL_KHR_lock_surface3
-#define EGL_KHR_lock_surface3 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
-#endif
-#endif /* EGL_KHR_lock_surface3 */
-
-#ifndef EGL_KHR_partial_update
-#define EGL_KHR_partial_update 1
-#define EGL_BUFFER_AGE_KHR 0x313D
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_KHR_partial_update */
-
-#ifndef EGL_KHR_platform_android
-#define EGL_KHR_platform_android 1
-#define EGL_PLATFORM_ANDROID_KHR 0x3141
-#endif /* EGL_KHR_platform_android */
-
-#ifndef EGL_KHR_platform_gbm
-#define EGL_KHR_platform_gbm 1
-#define EGL_PLATFORM_GBM_KHR 0x31D7
-#endif /* EGL_KHR_platform_gbm */
-
-#ifndef EGL_KHR_platform_wayland
-#define EGL_KHR_platform_wayland 1
-#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
-#endif /* EGL_KHR_platform_wayland */
-
-#ifndef EGL_KHR_platform_x11
-#define EGL_KHR_platform_x11 1
-#define EGL_PLATFORM_X11_KHR 0x31D5
-#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
-#endif /* EGL_KHR_platform_x11 */
-
-#ifndef EGL_KHR_reusable_sync
-#define EGL_KHR_reusable_sync 1
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_STATUS_KHR 0x30F1
-#define EGL_SIGNALED_KHR 0x30F2
-#define EGL_UNSIGNALED_KHR 0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
-#define EGL_SYNC_TYPE_KHR 0x30F7
-#define EGL_SYNC_REUSABLE_KHR 0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_reusable_sync */
-
-#ifndef EGL_KHR_stream
-#define EGL_KHR_stream 1
-typedef void *EGLStreamKHR;
-typedef khronos_uint64_t EGLuint64KHR;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
-#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
-#define EGL_PRODUCER_FRAME_KHR 0x3212
-#define EGL_CONSUMER_FRAME_KHR 0x3213
-#define EGL_STREAM_STATE_KHR 0x3214
-#define EGL_STREAM_STATE_CREATED_KHR 0x3215
-#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
-#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
-#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
-#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
-#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
-#define EGL_BAD_STREAM_KHR 0x321B
-#define EGL_BAD_STATE_KHR 0x321C
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_stream */
-
-#ifndef EGL_KHR_stream_consumer_gltexture
-#define EGL_KHR_stream_consumer_gltexture 1
-#ifdef EGL_KHR_stream
-#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_consumer_gltexture */
-
-#ifndef EGL_KHR_stream_cross_process_fd
-#define EGL_KHR_stream_cross_process_fd 1
-typedef int EGLNativeFileDescriptorKHR;
-#ifdef EGL_KHR_stream
-#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
-typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_cross_process_fd */
-
-#ifndef EGL_KHR_stream_fifo
-#define EGL_KHR_stream_fifo 1
-#ifdef EGL_KHR_stream
-#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
-#define EGL_STREAM_TIME_NOW_KHR 0x31FD
-#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
-#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_fifo */
-
-#ifndef EGL_KHR_stream_producer_aldatalocator
-#define EGL_KHR_stream_producer_aldatalocator 1
-#ifdef EGL_KHR_stream
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_producer_aldatalocator */
-
-#ifndef EGL_KHR_stream_producer_eglsurface
-#define EGL_KHR_stream_producer_eglsurface 1
-#ifdef EGL_KHR_stream
-#define EGL_STREAM_BIT_KHR 0x0800
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_producer_eglsurface */
-
-#ifndef EGL_KHR_surfaceless_context
-#define EGL_KHR_surfaceless_context 1
-#endif /* EGL_KHR_surfaceless_context */
-
-#ifndef EGL_KHR_swap_buffers_with_damage
-#define EGL_KHR_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_KHR_swap_buffers_with_damage */
-
-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
-#endif /* EGL_KHR_vg_parent_image */
-
-#ifndef EGL_KHR_wait_sync
-#define EGL_KHR_wait_sync 1
-typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#endif
-#endif /* EGL_KHR_wait_sync */
-
-#ifndef EGL_ANDROID_blob_cache
-#define EGL_ANDROID_blob_cache 1
-typedef khronos_ssize_t EGLsizeiANDROID;
-typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
-typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif
-#endif /* EGL_ANDROID_blob_cache */
-
-#ifndef EGL_ANDROID_framebuffer_target
-#define EGL_ANDROID_framebuffer_target 1
-#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
-#endif /* EGL_ANDROID_framebuffer_target */
-
-#ifndef EGL_ANDROID_image_native_buffer
-#define EGL_ANDROID_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_ANDROID 0x3140
-#endif /* EGL_ANDROID_image_native_buffer */
-
-#ifndef EGL_ANDROID_native_fence_sync
-#define EGL_ANDROID_native_fence_sync 1
-#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
-#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
-#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
-#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
-typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
-#endif
-#endif /* EGL_ANDROID_native_fence_sync */
-
-#ifndef EGL_ANDROID_recordable
-#define EGL_ANDROID_recordable 1
-#define EGL_RECORDABLE_ANDROID 0x3142
-#endif /* EGL_ANDROID_recordable */
-
-#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
-#define EGL_ANGLE_d3d_share_handle_client_buffer 1
-#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
-#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
-
-#ifndef EGL_ANGLE_device_d3d
-#define EGL_ANGLE_device_d3d 1
-#define EGL_D3D9_DEVICE_ANGLE 0x33A0
-#define EGL_D3D11_DEVICE_ANGLE 0x33A1
-#endif /* EGL_ANGLE_device_d3d */
-
-#ifndef EGL_ANGLE_query_surface_pointer
-#define EGL_ANGLE_query_surface_pointer 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#endif
-#endif /* EGL_ANGLE_query_surface_pointer */
-
-#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
-#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
-#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
-
-#ifndef EGL_ANGLE_window_fixed_size
-#define EGL_ANGLE_window_fixed_size 1
-#define EGL_FIXED_SIZE_ANGLE 0x3201
-#endif /* EGL_ANGLE_window_fixed_size */
-
-#ifndef EGL_ARM_pixmap_multisample_discard
-#define EGL_ARM_pixmap_multisample_discard 1
-#define EGL_DISCARD_SAMPLES_ARM 0x3286
-#endif /* EGL_ARM_pixmap_multisample_discard */
-
-#ifndef EGL_EXT_buffer_age
-#define EGL_EXT_buffer_age 1
-#define EGL_BUFFER_AGE_EXT 0x313D
-#endif /* EGL_EXT_buffer_age */
-
-#ifndef EGL_EXT_client_extensions
-#define EGL_EXT_client_extensions 1
-#endif /* EGL_EXT_client_extensions */
-
-#ifndef EGL_EXT_create_context_robustness
-#define EGL_EXT_create_context_robustness 1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
-#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
-#endif /* EGL_EXT_create_context_robustness */
-
-#ifndef EGL_EXT_device_base
-#define EGL_EXT_device_base 1
-typedef void *EGLDeviceEXT;
-#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
-#define EGL_BAD_DEVICE_EXT 0x322B
-#define EGL_DEVICE_EXT 0x322C
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-#endif
-#endif /* EGL_EXT_device_base */
-
-#ifndef EGL_EXT_device_drm
-#define EGL_EXT_device_drm 1
-#define EGL_DRM_DEVICE_FILE_EXT 0x3233
-#endif /* EGL_EXT_device_drm */
-
-#ifndef EGL_EXT_device_enumeration
-#define EGL_EXT_device_enumeration 1
-#endif /* EGL_EXT_device_enumeration */
-
-#ifndef EGL_EXT_device_openwf
-#define EGL_EXT_device_openwf 1
-#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
-#endif /* EGL_EXT_device_openwf */
-
-#ifndef EGL_EXT_device_query
-#define EGL_EXT_device_query 1
-#endif /* EGL_EXT_device_query */
-
-#ifndef EGL_EXT_image_dma_buf_import
-#define EGL_EXT_image_dma_buf_import 1
-#define EGL_LINUX_DMA_BUF_EXT 0x3270
-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
-#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
-#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
-#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
-#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
-#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
-#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
-#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
-#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
-#define EGL_ITU_REC601_EXT 0x327F
-#define EGL_ITU_REC709_EXT 0x3280
-#define EGL_ITU_REC2020_EXT 0x3281
-#define EGL_YUV_FULL_RANGE_EXT 0x3282
-#define EGL_YUV_NARROW_RANGE_EXT 0x3283
-#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
-#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
-#endif /* EGL_EXT_image_dma_buf_import */
-
-#ifndef EGL_EXT_multiview_window
-#define EGL_EXT_multiview_window 1
-#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
-#endif /* EGL_EXT_multiview_window */
-
-#ifndef EGL_EXT_output_base
-#define EGL_EXT_output_base 1
-typedef void *EGLOutputLayerEXT;
-typedef void *EGLOutputPortEXT;
-#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
-#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0)
-#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
-#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
-#define EGL_SWAP_INTERVAL_EXT 0x322F
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
-EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
-#endif
-#endif /* EGL_EXT_output_base */
-
-#ifndef EGL_EXT_output_drm
-#define EGL_EXT_output_drm 1
-#define EGL_DRM_CRTC_EXT 0x3234
-#define EGL_DRM_PLANE_EXT 0x3235
-#define EGL_DRM_CONNECTOR_EXT 0x3236
-#endif /* EGL_EXT_output_drm */
-
-#ifndef EGL_EXT_output_openwf
-#define EGL_EXT_output_openwf 1
-#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
-#define EGL_OPENWF_PORT_ID_EXT 0x3239
-#endif /* EGL_EXT_output_openwf */
-
-#ifndef EGL_EXT_platform_base
-#define EGL_EXT_platform_base 1
-typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-#endif
-#endif /* EGL_EXT_platform_base */
-
-#ifndef EGL_EXT_platform_device
-#define EGL_EXT_platform_device 1
-#define EGL_PLATFORM_DEVICE_EXT 0x313F
-#endif /* EGL_EXT_platform_device */
-
-#ifndef EGL_EXT_platform_wayland
-#define EGL_EXT_platform_wayland 1
-#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
-#endif /* EGL_EXT_platform_wayland */
-
-#ifndef EGL_EXT_platform_x11
-#define EGL_EXT_platform_x11 1
-#define EGL_PLATFORM_X11_EXT 0x31D5
-#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
-#endif /* EGL_EXT_platform_x11 */
-
-#ifndef EGL_EXT_protected_surface
-#define EGL_EXT_protected_surface 1
-#define EGL_PROTECTED_CONTENT_EXT 0x32C0
-#endif /* EGL_EXT_protected_surface */
-
-#ifndef EGL_EXT_stream_consumer_egloutput
-#define EGL_EXT_stream_consumer_egloutput 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
-#endif
-#endif /* EGL_EXT_stream_consumer_egloutput */
-
-#ifndef EGL_EXT_swap_buffers_with_damage
-#define EGL_EXT_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_EXT_swap_buffers_with_damage */
-
-#ifndef EGL_EXT_yuv_surface
-#define EGL_EXT_yuv_surface 1
-#define EGL_YUV_ORDER_EXT 0x3301
-#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
-#define EGL_YUV_SUBSAMPLE_EXT 0x3312
-#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
-#define EGL_YUV_CSC_STANDARD_EXT 0x330A
-#define EGL_YUV_PLANE_BPP_EXT 0x331A
-#define EGL_YUV_BUFFER_EXT 0x3300
-#define EGL_YUV_ORDER_YUV_EXT 0x3302
-#define EGL_YUV_ORDER_YVU_EXT 0x3303
-#define EGL_YUV_ORDER_YUYV_EXT 0x3304
-#define EGL_YUV_ORDER_UYVY_EXT 0x3305
-#define EGL_YUV_ORDER_YVYU_EXT 0x3306
-#define EGL_YUV_ORDER_VYUY_EXT 0x3307
-#define EGL_YUV_ORDER_AYUV_EXT 0x3308
-#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
-#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
-#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
-#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
-#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
-#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
-#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
-#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
-#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
-#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
-#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
-#endif /* EGL_EXT_yuv_surface */
-
-#ifndef EGL_HI_clientpixmap
-#define EGL_HI_clientpixmap 1
-struct EGLClientPixmapHI {
- void *pData;
- EGLint iWidth;
- EGLint iHeight;
- EGLint iStride;
-};
-#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
-#endif
-#endif /* EGL_HI_clientpixmap */
-
-#ifndef EGL_HI_colorformats
-#define EGL_HI_colorformats 1
-#define EGL_COLOR_FORMAT_HI 0x8F70
-#define EGL_COLOR_RGB_HI 0x8F71
-#define EGL_COLOR_RGBA_HI 0x8F72
-#define EGL_COLOR_ARGB_HI 0x8F73
-#endif /* EGL_HI_colorformats */
-
-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
-#endif /* EGL_IMG_context_priority */
-
-#ifndef EGL_MESA_drm_image
-#define EGL_MESA_drm_image 1
-#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
-#define EGL_DRM_BUFFER_USE_MESA 0x31D1
-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
-#define EGL_DRM_BUFFER_MESA 0x31D3
-#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
-#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif
-#endif /* EGL_MESA_drm_image */
-
-#ifndef EGL_MESA_image_dma_buf_export
-#define EGL_MESA_image_dma_buf_export 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
-#endif
-#endif /* EGL_MESA_image_dma_buf_export */
-
-#ifndef EGL_MESA_platform_gbm
-#define EGL_MESA_platform_gbm 1
-#define EGL_PLATFORM_GBM_MESA 0x31D7
-#endif /* EGL_MESA_platform_gbm */
-
-#ifndef EGL_NOK_swap_region
-#define EGL_NOK_swap_region 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#endif
-#endif /* EGL_NOK_swap_region */
-
-#ifndef EGL_NOK_swap_region2
-#define EGL_NOK_swap_region2 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#endif
-#endif /* EGL_NOK_swap_region2 */
-
-#ifndef EGL_NOK_texture_from_pixmap
-#define EGL_NOK_texture_from_pixmap 1
-#define EGL_Y_INVERTED_NOK 0x307F
-#endif /* EGL_NOK_texture_from_pixmap */
-
-#ifndef EGL_NV_3dvision_surface
-#define EGL_NV_3dvision_surface 1
-#define EGL_AUTO_STEREO_NV 0x3136
-#endif /* EGL_NV_3dvision_surface */
-
-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
-#endif /* EGL_NV_coverage_sample */
-
-#ifndef EGL_NV_coverage_sample_resolve
-#define EGL_NV_coverage_sample_resolve 1
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
-#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
-#endif /* EGL_NV_coverage_sample_resolve */
-
-#ifndef EGL_NV_cuda_event
-#define EGL_NV_cuda_event 1
-#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
-#define EGL_SYNC_CUDA_EVENT_NV 0x323C
-#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
-#endif /* EGL_NV_cuda_event */
-
-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
-#endif /* EGL_NV_depth_nonlinear */
-
-#ifndef EGL_NV_device_cuda
-#define EGL_NV_device_cuda 1
-#define EGL_CUDA_DEVICE_NV 0x323A
-#endif /* EGL_NV_device_cuda */
-
-#ifndef EGL_NV_native_query
-#define EGL_NV_native_query 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#endif
-#endif /* EGL_NV_native_query */
-
-#ifndef EGL_NV_post_convert_rounding
-#define EGL_NV_post_convert_rounding 1
-#endif /* EGL_NV_post_convert_rounding */
-
-#ifndef EGL_NV_post_sub_buffer
-#define EGL_NV_post_sub_buffer 1
-#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#endif
-#endif /* EGL_NV_post_sub_buffer */
-
-#ifndef EGL_NV_stream_sync
-#define EGL_NV_stream_sync 1
-#define EGL_SYNC_NEW_FRAME_NV 0x321F
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
-#endif
-#endif /* EGL_NV_stream_sync */
-
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-typedef void *EGLSyncNV;
-typedef khronos_utime_nanoseconds_t EGLTimeNV;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
-#define EGL_SYNC_STATUS_NV 0x30E7
-#define EGL_SIGNALED_NV 0x30E8
-#define EGL_UNSIGNALED_NV 0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
-#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV 0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
-#define EGL_CONDITION_SATISFIED_NV 0x30EC
-#define EGL_SYNC_TYPE_NV 0x30ED
-#define EGL_SYNC_CONDITION_NV 0x30EE
-#define EGL_SYNC_FENCE_NV 0x30EF
-#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
-EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_NV_sync */
-
-#ifndef EGL_NV_system_time
-#define EGL_NV_system_time 1
-typedef khronos_utime_nanoseconds_t EGLuint64NV;
-#ifdef KHRONOS_SUPPORT_INT64
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_NV_system_time */
-
-#ifndef EGL_TIZEN_image_native_buffer
-#define EGL_TIZEN_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
-#endif /* EGL_TIZEN_image_native_buffer */
-
-#ifndef EGL_TIZEN_image_native_surface
-#define EGL_TIZEN_image_native_surface 1
-#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
-#endif /* EGL_TIZEN_image_native_surface */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __eglext_h_ */
-
-
-#endif /* _MSC_VER */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_endian.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_endian.h
deleted file mode 100644
index 3eda7f2..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_endian.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_endian.h
- *
- * Functions for reading and writing endian-specific values
- */
-
-#ifndef SDL_endian_h_
-#define SDL_endian_h_
-
-#include "SDL_stdinc.h"
-
-/**
- * \name The two types of endianness
- */
-/* @{ */
-#define SDL_LIL_ENDIAN 1234
-#define SDL_BIG_ENDIAN 4321
-/* @} */
-
-#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
-#ifdef __linux__
-#include <endian.h>
-#define SDL_BYTEORDER __BYTE_ORDER
-#else /* __linux__ */
-#if defined(__hppa__) || \
- defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
- (defined(__MIPS__) && defined(__MISPEB__)) || \
- defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
- defined(__sparc__)
-#define SDL_BYTEORDER SDL_BIG_ENDIAN
-#else
-#define SDL_BYTEORDER SDL_LIL_ENDIAN
-#endif
-#endif /* __linux__ */
-#endif /* !SDL_BYTEORDER */
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_endian.h
- */
-#if defined(__GNUC__) && defined(__i386__) && \
- !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- int result;
-
- __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
- return (Uint16)result;
-}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
- return x;
-}
-#elif defined(__WATCOMC__) && defined(__386__)
-extern _inline Uint16 SDL_Swap16(Uint16);
-#pragma aux SDL_Swap16 = \
- "xchg al, ah" \
- parm [ax] \
- modify [ax];
-#else
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
-}
-#endif
-
-#if defined(__GNUC__) && defined(__i386__)
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- __asm__("bswap %0": "=r"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- __asm__("bswapl %0": "=r"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- Uint32 result;
-
- __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
- __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
- __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
- return result;
-}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
- return x;
-}
-#elif defined(__WATCOMC__) && defined(__386__)
-extern _inline Uint32 SDL_Swap32(Uint32);
-#ifndef __SW_3 /* 486+ */
-#pragma aux SDL_Swap32 = \
- "bswap eax" \
- parm [eax] \
- modify [eax];
-#else /* 386-only */
-#pragma aux SDL_Swap32 = \
- "xchg al, ah" \
- "ror eax, 16" \
- "xchg al, ah" \
- parm [eax] \
- modify [eax];
-#endif
-#else
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
- ((x >> 8) & 0x0000FF00) | (x >> 24)));
-}
-#endif
-
-#if defined(__GNUC__) && defined(__i386__)
-SDL_FORCE_INLINE Uint64
-SDL_Swap64(Uint64 x)
-{
- union
- {
- struct
- {
- Uint32 a, b;
- } s;
- Uint64 u;
- } v;
- v.u = x;
- __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
- "1"(v.s.
- b));
- return v.u;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-SDL_FORCE_INLINE Uint64
-SDL_Swap64(Uint64 x)
-{
- __asm__("bswapq %0": "=r"(x):"0"(x));
- return x;
-}
-#else
-SDL_FORCE_INLINE Uint64
-SDL_Swap64(Uint64 x)
-{
- Uint32 hi, lo;
-
- /* Separate into high and low 32-bit values and swap them */
- lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
- x >>= 32;
- hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
- x = SDL_Swap32(lo);
- x <<= 32;
- x |= SDL_Swap32(hi);
- return (x);
-}
-#endif
-
-
-SDL_FORCE_INLINE float
-SDL_SwapFloat(float x)
-{
- union
- {
- float f;
- Uint32 ui32;
- } swapper;
- swapper.f = x;
- swapper.ui32 = SDL_Swap32(swapper.ui32);
- return swapper.f;
-}
-
-
-/**
- * \name Swap to native
- * Byteswap item from the specified endianness to the native endianness.
- */
-/* @{ */
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_SwapLE16(X) (X)
-#define SDL_SwapLE32(X) (X)
-#define SDL_SwapLE64(X) (X)
-#define SDL_SwapFloatLE(X) (X)
-#define SDL_SwapBE16(X) SDL_Swap16(X)
-#define SDL_SwapBE32(X) SDL_Swap32(X)
-#define SDL_SwapBE64(X) SDL_Swap64(X)
-#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
-#else
-#define SDL_SwapLE16(X) SDL_Swap16(X)
-#define SDL_SwapLE32(X) SDL_Swap32(X)
-#define SDL_SwapLE64(X) SDL_Swap64(X)
-#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
-#define SDL_SwapBE16(X) (X)
-#define SDL_SwapBE32(X) (X)
-#define SDL_SwapBE64(X) (X)
-#define SDL_SwapFloatBE(X) (X)
-#endif
-/* @} *//* Swap to native */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_endian_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_error.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_error.h
deleted file mode 100644
index 49be982..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_error.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_error.h
- *
- * Simple error message routines for SDL.
- */
-
-#ifndef SDL_error_h_
-#define SDL_error_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Public functions */
-/* SDL_SetError() unconditionally returns -1. */
-extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-extern DECLSPEC const char *SDLCALL SDL_GetError(void);
-extern DECLSPEC void SDLCALL SDL_ClearError(void);
-
-/**
- * \name Internal error functions
- *
- * \internal
- * Private error reporting function - used internally.
- */
-/* @{ */
-#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
-#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
-#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
-typedef enum
-{
- SDL_ENOMEM,
- SDL_EFREAD,
- SDL_EFWRITE,
- SDL_EFSEEK,
- SDL_UNSUPPORTED,
- SDL_LASTERROR
-} SDL_errorcode;
-/* SDL_Error() unconditionally returns -1. */
-extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
-/* @} *//* Internal error functions */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_error_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_events.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_events.h
deleted file mode 100644
index 0fc09bc..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_events.h
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_events.h
- *
- * Include file for SDL event handling.
- */
-
-#ifndef SDL_events_h_
-#define SDL_events_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-#include "SDL_keyboard.h"
-#include "SDL_mouse.h"
-#include "SDL_joystick.h"
-#include "SDL_gamecontroller.h"
-#include "SDL_quit.h"
-#include "SDL_gesture.h"
-#include "SDL_touch.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* General keyboard/mouse state definitions */
-#define SDL_RELEASED 0
-#define SDL_PRESSED 1
-
-/**
- * \brief The types of events that can be delivered.
- */
-typedef enum
-{
- SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
-
- /* Application events */
- SDL_QUIT = 0x100, /**< User-requested quit */
-
- /* These application events have special meaning on iOS, see README-ios.md for details */
- SDL_APP_TERMINATING, /**< The application is being terminated by the OS
- Called on iOS in applicationWillTerminate()
- Called on Android in onDestroy()
- */
- SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
- Called on iOS in applicationDidReceiveMemoryWarning()
- Called on Android in onLowMemory()
- */
- SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
- Called on iOS in applicationWillResignActive()
- Called on Android in onPause()
- */
- SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
- Called on iOS in applicationDidEnterBackground()
- Called on Android in onPause()
- */
- SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
- Called on iOS in applicationWillEnterForeground()
- Called on Android in onResume()
- */
- SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
- Called on iOS in applicationDidBecomeActive()
- Called on Android in onResume()
- */
-
- /* Window events */
- SDL_WINDOWEVENT = 0x200, /**< Window state change */
- SDL_SYSWMEVENT, /**< System specific event */
-
- /* Keyboard events */
- SDL_KEYDOWN = 0x300, /**< Key pressed */
- SDL_KEYUP, /**< Key released */
- SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
- SDL_TEXTINPUT, /**< Keyboard text input */
- SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
- input language or keyboard layout change.
- */
-
- /* Mouse events */
- SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
- SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
- SDL_MOUSEBUTTONUP, /**< Mouse button released */
- SDL_MOUSEWHEEL, /**< Mouse wheel motion */
-
- /* Joystick events */
- SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
- SDL_JOYBALLMOTION, /**< Joystick trackball motion */
- SDL_JOYHATMOTION, /**< Joystick hat position change */
- SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
- SDL_JOYBUTTONUP, /**< Joystick button released */
- SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
- SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
-
- /* Game controller events */
- SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
- SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
- SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
- SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
- SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
- SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
-
- /* Touch events */
- SDL_FINGERDOWN = 0x700,
- SDL_FINGERUP,
- SDL_FINGERMOTION,
-
- /* Gesture events */
- SDL_DOLLARGESTURE = 0x800,
- SDL_DOLLARRECORD,
- SDL_MULTIGESTURE,
-
- /* Clipboard events */
- SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
-
- /* Drag and drop events */
- SDL_DROPFILE = 0x1000, /**< The system requests a file open */
- SDL_DROPTEXT, /**< text/plain drag-and-drop event */
- SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
- SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
-
- /* Audio hotplug events */
- SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
- SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
-
- /* Render events */
- SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
- SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
-
- /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
- * and should be allocated with SDL_RegisterEvents()
- */
- SDL_USEREVENT = 0x8000,
-
- /**
- * This last event is only for bounding internal arrays
- */
- SDL_LASTEVENT = 0xFFFF
-} SDL_EventType;
-
-/**
- * \brief Fields shared by every event
- */
-typedef struct SDL_CommonEvent
-{
- Uint32 type;
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
-} SDL_CommonEvent;
-
-/**
- * \brief Window state change event data (event.window.*)
- */
-typedef struct SDL_WindowEvent
-{
- Uint32 type; /**< ::SDL_WINDOWEVENT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The associated window */
- Uint8 event; /**< ::SDL_WindowEventID */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint32 data1; /**< event dependent data */
- Sint32 data2; /**< event dependent data */
-} SDL_WindowEvent;
-
-/**
- * \brief Keyboard button event structure (event.key.*)
- */
-typedef struct SDL_KeyboardEvent
-{
- Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with keyboard focus, if any */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 repeat; /**< Non-zero if this is a key repeat */
- Uint8 padding2;
- Uint8 padding3;
- SDL_Keysym keysym; /**< The key that was pressed or released */
-} SDL_KeyboardEvent;
-
-#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
-/**
- * \brief Keyboard text editing event structure (event.edit.*)
- */
-typedef struct SDL_TextEditingEvent
-{
- Uint32 type; /**< ::SDL_TEXTEDITING */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with keyboard focus, if any */
- char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
- Sint32 start; /**< The start cursor of selected editing text */
- Sint32 length; /**< The length of selected editing text */
-} SDL_TextEditingEvent;
-
-
-#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
-/**
- * \brief Keyboard text input event structure (event.text.*)
- */
-typedef struct SDL_TextInputEvent
-{
- Uint32 type; /**< ::SDL_TEXTINPUT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with keyboard focus, if any */
- char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
-} SDL_TextInputEvent;
-
-/**
- * \brief Mouse motion event structure (event.motion.*)
- */
-typedef struct SDL_MouseMotionEvent
-{
- Uint32 type; /**< ::SDL_MOUSEMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
- Uint32 state; /**< The current button state */
- Sint32 x; /**< X coordinate, relative to window */
- Sint32 y; /**< Y coordinate, relative to window */
- Sint32 xrel; /**< The relative motion in the X direction */
- Sint32 yrel; /**< The relative motion in the Y direction */
-} SDL_MouseMotionEvent;
-
-/**
- * \brief Mouse button event structure (event.button.*)
- */
-typedef struct SDL_MouseButtonEvent
-{
- Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
- Uint8 button; /**< The mouse button index */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
- Uint8 padding1;
- Sint32 x; /**< X coordinate, relative to window */
- Sint32 y; /**< Y coordinate, relative to window */
-} SDL_MouseButtonEvent;
-
-/**
- * \brief Mouse wheel event structure (event.wheel.*)
- */
-typedef struct SDL_MouseWheelEvent
-{
- Uint32 type; /**< ::SDL_MOUSEWHEEL */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
- Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
- Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
- Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
-} SDL_MouseWheelEvent;
-
-/**
- * \brief Joystick axis motion event structure (event.jaxis.*)
- */
-typedef struct SDL_JoyAxisEvent
-{
- Uint32 type; /**< ::SDL_JOYAXISMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 axis; /**< The joystick axis index */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint16 value; /**< The axis value (range: -32768 to 32767) */
- Uint16 padding4;
-} SDL_JoyAxisEvent;
-
-/**
- * \brief Joystick trackball motion event structure (event.jball.*)
- */
-typedef struct SDL_JoyBallEvent
-{
- Uint32 type; /**< ::SDL_JOYBALLMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 ball; /**< The joystick trackball index */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint16 xrel; /**< The relative motion in the X direction */
- Sint16 yrel; /**< The relative motion in the Y direction */
-} SDL_JoyBallEvent;
-
-/**
- * \brief Joystick hat position change event structure (event.jhat.*)
- */
-typedef struct SDL_JoyHatEvent
-{
- Uint32 type; /**< ::SDL_JOYHATMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 hat; /**< The joystick hat index */
- Uint8 value; /**< The hat position value.
- * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
- * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
- * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
- *
- * Note that zero means the POV is centered.
- */
- Uint8 padding1;
- Uint8 padding2;
-} SDL_JoyHatEvent;
-
-/**
- * \brief Joystick button event structure (event.jbutton.*)
- */
-typedef struct SDL_JoyButtonEvent
-{
- Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 button; /**< The joystick button index */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 padding1;
- Uint8 padding2;
-} SDL_JoyButtonEvent;
-
-/**
- * \brief Joystick device event structure (event.jdevice.*)
- */
-typedef struct SDL_JoyDeviceEvent
-{
- Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
-} SDL_JoyDeviceEvent;
-
-
-/**
- * \brief Game controller axis motion event structure (event.caxis.*)
- */
-typedef struct SDL_ControllerAxisEvent
-{
- Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint16 value; /**< The axis value (range: -32768 to 32767) */
- Uint16 padding4;
-} SDL_ControllerAxisEvent;
-
-
-/**
- * \brief Game controller button event structure (event.cbutton.*)
- */
-typedef struct SDL_ControllerButtonEvent
-{
- Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 button; /**< The controller button (SDL_GameControllerButton) */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 padding1;
- Uint8 padding2;
-} SDL_ControllerButtonEvent;
-
-
-/**
- * \brief Controller device event structure (event.cdevice.*)
- */
-typedef struct SDL_ControllerDeviceEvent
-{
- Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
-} SDL_ControllerDeviceEvent;
-
-/**
- * \brief Audio device event structure (event.adevice.*)
- */
-typedef struct SDL_AudioDeviceEvent
-{
- Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
- Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
-} SDL_AudioDeviceEvent;
-
-
-/**
- * \brief Touch finger event structure (event.tfinger.*)
- */
-typedef struct SDL_TouchFingerEvent
-{
- Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_TouchID touchId; /**< The touch device id */
- SDL_FingerID fingerId;
- float x; /**< Normalized in the range 0...1 */
- float y; /**< Normalized in the range 0...1 */
- float dx; /**< Normalized in the range -1...1 */
- float dy; /**< Normalized in the range -1...1 */
- float pressure; /**< Normalized in the range 0...1 */
-} SDL_TouchFingerEvent;
-
-
-/**
- * \brief Multiple Finger Gesture Event (event.mgesture.*)
- */
-typedef struct SDL_MultiGestureEvent
-{
- Uint32 type; /**< ::SDL_MULTIGESTURE */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_TouchID touchId; /**< The touch device id */
- float dTheta;
- float dDist;
- float x;
- float y;
- Uint16 numFingers;
- Uint16 padding;
-} SDL_MultiGestureEvent;
-
-
-/**
- * \brief Dollar Gesture Event (event.dgesture.*)
- */
-typedef struct SDL_DollarGestureEvent
-{
- Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_TouchID touchId; /**< The touch device id */
- SDL_GestureID gestureId;
- Uint32 numFingers;
- float error;
- float x; /**< Normalized center of gesture */
- float y; /**< Normalized center of gesture */
-} SDL_DollarGestureEvent;
-
-
-/**
- * \brief An event used to request a file open by the system (event.drop.*)
- * This event is enabled by default, you can disable it with SDL_EventState().
- * \note If this event is enabled, you must free the filename in the event.
- */
-typedef struct SDL_DropEvent
-{
- Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
- Uint32 windowID; /**< The window that was dropped on, if any */
-} SDL_DropEvent;
-
-
-/**
- * \brief The "quit requested" event
- */
-typedef struct SDL_QuitEvent
-{
- Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
-} SDL_QuitEvent;
-
-/**
- * \brief OS Specific event
- */
-typedef struct SDL_OSEvent
-{
- Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
-} SDL_OSEvent;
-
-/**
- * \brief A user-defined event type (event.user.*)
- */
-typedef struct SDL_UserEvent
-{
- Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The associated window if any */
- Sint32 code; /**< User defined event code */
- void *data1; /**< User defined data pointer */
- void *data2; /**< User defined data pointer */
-} SDL_UserEvent;
-
-
-struct SDL_SysWMmsg;
-typedef struct SDL_SysWMmsg SDL_SysWMmsg;
-
-/**
- * \brief A video driver dependent system event (event.syswm.*)
- * This event is disabled by default, you can enable it with SDL_EventState()
- *
- * \note If you want to use this event, you should include SDL_syswm.h.
- */
-typedef struct SDL_SysWMEvent
-{
- Uint32 type; /**< ::SDL_SYSWMEVENT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
-} SDL_SysWMEvent;
-
-/**
- * \brief General event structure
- */
-typedef union SDL_Event
-{
- Uint32 type; /**< Event type, shared with all events */
- SDL_CommonEvent common; /**< Common event data */
- SDL_WindowEvent window; /**< Window event data */
- SDL_KeyboardEvent key; /**< Keyboard event data */
- SDL_TextEditingEvent edit; /**< Text editing event data */
- SDL_TextInputEvent text; /**< Text input event data */
- SDL_MouseMotionEvent motion; /**< Mouse motion event data */
- SDL_MouseButtonEvent button; /**< Mouse button event data */
- SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
- SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
- SDL_JoyBallEvent jball; /**< Joystick ball event data */
- SDL_JoyHatEvent jhat; /**< Joystick hat event data */
- SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
- SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
- SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
- SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
- SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
- SDL_AudioDeviceEvent adevice; /**< Audio device event data */
- SDL_QuitEvent quit; /**< Quit request event data */
- SDL_UserEvent user; /**< Custom event data */
- SDL_SysWMEvent syswm; /**< System dependent window event data */
- SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
- SDL_MultiGestureEvent mgesture; /**< Gesture event data */
- SDL_DollarGestureEvent dgesture; /**< Gesture event data */
- SDL_DropEvent drop; /**< Drag and drop event data */
-
- /* This is necessary for ABI compatibility between Visual C++ and GCC
- Visual C++ will respect the push pack pragma and use 52 bytes for
- this structure, and GCC will use the alignment of the largest datatype
- within the union, which is 8 bytes.
-
- So... we'll add padding to force the size to be 56 bytes for both.
- */
- Uint8 padding[56];
-} SDL_Event;
-
-
-/* Function prototypes */
-
-/**
- * Pumps the event loop, gathering events from the input devices.
- *
- * This function updates the event queue and internal input device state.
- *
- * This should only be run in the thread that sets the video mode.
- */
-extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
-
-/* @{ */
-typedef enum
-{
- SDL_ADDEVENT,
- SDL_PEEKEVENT,
- SDL_GETEVENT
-} SDL_eventaction;
-
-/**
- * Checks the event queue for messages and optionally returns them.
- *
- * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
- * the back of the event queue.
- *
- * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
- * of the event queue, within the specified minimum and maximum type,
- * will be returned and will not be removed from the queue.
- *
- * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
- * of the event queue, within the specified minimum and maximum type,
- * will be returned and will be removed from the queue.
- *
- * \return The number of events actually stored, or -1 if there was an error.
- *
- * This function is thread-safe.
- */
-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
- SDL_eventaction action,
- Uint32 minType, Uint32 maxType);
-/* @} */
-
-/**
- * Checks to see if certain event types are in the event queue.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
-
-/**
- * This function clears events from the event queue
- * This function only affects currently queued events. If you want to make
- * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
- * on the main thread immediately before the flush call.
- */
-extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
-extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
-
-/**
- * \brief Polls for currently pending events.
- *
- * \return 1 if there are any pending events, or 0 if there are none available.
- *
- * \param event If not NULL, the next event is removed from the queue and
- * stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
-
-/**
- * \brief Waits indefinitely for the next available event.
- *
- * \return 1, or 0 if there was an error while waiting for events.
- *
- * \param event If not NULL, the next event is removed from the queue and
- * stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
-
-/**
- * \brief Waits until the specified timeout (in milliseconds) for the next
- * available event.
- *
- * \return 1, or 0 if there was an error while waiting for events.
- *
- * \param event If not NULL, the next event is removed from the queue and
- * stored in that area.
- * \param timeout The timeout (in milliseconds) to wait for next event.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
- int timeout);
-
-/**
- * \brief Add an event to the event queue.
- *
- * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
- * was full or there was some other error.
- */
-extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
-
-typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
-
-/**
- * Sets up a filter to process all events before they change internal state and
- * are posted to the internal event queue.
- *
- * The filter is prototyped as:
- * \code
- * int SDL_EventFilter(void *userdata, SDL_Event * event);
- * \endcode
- *
- * If the filter returns 1, then the event will be added to the internal queue.
- * If it returns 0, then the event will be dropped from the queue, but the
- * internal state will still be updated. This allows selective filtering of
- * dynamically arriving events.
- *
- * \warning Be very careful of what you do in the event filter function, as
- * it may run in a different thread!
- *
- * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
- * event filter is only called when the window manager desires to close the
- * application window. If the event filter returns 1, then the window will
- * be closed, otherwise the window will remain open if possible.
- *
- * If the quit event is generated by an interrupt signal, it will bypass the
- * internal queue and be delivered to the application at the next event poll.
- */
-extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
- void *userdata);
-
-/**
- * Return the current event filter - can be used to "chain" filters.
- * If there is no event filter set, this function returns SDL_FALSE.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
- void **userdata);
-
-/**
- * Add a function which is called when an event is added to the queue.
- */
-extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
- void *userdata);
-
-/**
- * Remove an event watch function added with SDL_AddEventWatch()
- */
-extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
- void *userdata);
-
-/**
- * Run the filter function on the current event queue, removing any
- * events for which the filter returns 0.
- */
-extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
- void *userdata);
-
-/* @{ */
-#define SDL_QUERY -1
-#define SDL_IGNORE 0
-#define SDL_DISABLE 0
-#define SDL_ENABLE 1
-
-/**
- * This function allows you to set the state of processing certain events.
- * - If \c state is set to ::SDL_IGNORE, that event will be automatically
- * dropped from the event queue and will not be filtered.
- * - If \c state is set to ::SDL_ENABLE, that event will be processed
- * normally.
- * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
- * current processing state of the specified event.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
-/* @} */
-#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
-
-/**
- * This function allocates a set of user-defined events, and returns
- * the beginning event number for that set of events.
- *
- * If there aren't enough user-defined events left, this function
- * returns (Uint32)-1
- */
-extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_events_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_filesystem.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_filesystem.h
deleted file mode 100644
index a1c846a..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_filesystem.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_filesystem.h
- *
- * \brief Include file for filesystem SDL API functions
- */
-
-#ifndef SDL_filesystem_h_
-#define SDL_filesystem_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Get the path where the application resides.
- *
- * Get the "base path". This is the directory where the application was run
- * from, which is probably the installation directory, and may or may not
- * be the process's current working directory.
- *
- * This returns an absolute path in UTF-8 encoding, and is guaranteed to
- * end with a path separator ('\\' on Windows, '/' most other places).
- *
- * The pointer returned by this function is owned by you. Please call
- * SDL_free() on the pointer when you are done with it, or it will be a
- * memory leak. This is not necessarily a fast call, though, so you should
- * call this once near startup and save the string if you need it.
- *
- * Some platforms can't determine the application's path, and on other
- * platforms, this might be meaningless. In such cases, this function will
- * return NULL.
- *
- * \return String of base dir in UTF-8 encoding, or NULL on error.
- *
- * \sa SDL_GetPrefPath
- */
-extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
-
-/**
- * \brief Get the user-and-app-specific path where files can be written.
- *
- * Get the "pref dir". This is meant to be where users can write personal
- * files (preferences and save games, etc) that are specific to your
- * application. This directory is unique per user, per application.
- *
- * This function will decide the appropriate location in the native filesystem,
- * create the directory if necessary, and return a string of the absolute
- * path to the directory in UTF-8 encoding.
- *
- * On Windows, the string might look like:
- * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
- *
- * On Linux, the string might look like:
- * "/home/bob/.local/share/My Program Name/"
- *
- * On Mac OS X, the string might look like:
- * "/Users/bob/Library/Application Support/My Program Name/"
- *
- * (etc.)
- *
- * You specify the name of your organization (if it's not a real organization,
- * your name or an Internet domain you own might do) and the name of your
- * application. These should be untranslated proper names.
- *
- * Both the org and app strings may become part of a directory name, so
- * please follow these rules:
- *
- * - Try to use the same org string (including case-sensitivity) for
- * all your applications that use this function.
- * - Always use a unique app string for each one, and make sure it never
- * changes for an app once you've decided on it.
- * - Unicode characters are legal, as long as it's UTF-8 encoded, but...
- * - ...only use letters, numbers, and spaces. Avoid punctuation like
- * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
- *
- * This returns an absolute path in UTF-8 encoding, and is guaranteed to
- * end with a path separator ('\\' on Windows, '/' most other places).
- *
- * The pointer returned by this function is owned by you. Please call
- * SDL_free() on the pointer when you are done with it, or it will be a
- * memory leak. This is not necessarily a fast call, though, so you should
- * call this once near startup and save the string if you need it.
- *
- * You should assume the path returned by this function is the only safe
- * place to write files (and that SDL_GetBasePath(), while it might be
- * writable, or even the parent of the returned path, aren't where you
- * should be writing things).
- *
- * Some platforms can't determine the pref path, and on other
- * platforms, this might be meaningless. In such cases, this function will
- * return NULL.
- *
- * \param org The name of your organization.
- * \param app The name of your application.
- * \return UTF-8 string of user dir in platform-dependent notation. NULL
- * if there's a problem (creating directory failed, etc).
- *
- * \sa SDL_GetBasePath
- */
-extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_filesystem_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gamecontroller.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gamecontroller.h
deleted file mode 100644
index c921513..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gamecontroller.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_gamecontroller.h
- *
- * Include file for SDL game controller event handling
- */
-
-#ifndef SDL_gamecontroller_h_
-#define SDL_gamecontroller_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_rwops.h"
-#include "SDL_joystick.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_gamecontroller.h
- *
- * In order to use these functions, SDL_Init() must have been called
- * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
- * for game controllers, and load appropriate drivers.
- *
- * If you would like to receive controller updates while the application
- * is in the background, you should set the following hint before calling
- * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
- */
-
-/**
- * The gamecontroller structure used to identify an SDL game controller
- */
-struct _SDL_GameController;
-typedef struct _SDL_GameController SDL_GameController;
-
-
-typedef enum
-{
- SDL_CONTROLLER_BINDTYPE_NONE = 0,
- SDL_CONTROLLER_BINDTYPE_BUTTON,
- SDL_CONTROLLER_BINDTYPE_AXIS,
- SDL_CONTROLLER_BINDTYPE_HAT
-} SDL_GameControllerBindType;
-
-/**
- * Get the SDL joystick layer binding for this controller button/axis mapping
- */
-typedef struct SDL_GameControllerButtonBind
-{
- SDL_GameControllerBindType bindType;
- union
- {
- int button;
- int axis;
- struct {
- int hat;
- int hat_mask;
- } hat;
- } value;
-
-} SDL_GameControllerButtonBind;
-
-
-/**
- * To count the number of game controllers in the system for the following:
- * int nJoysticks = SDL_NumJoysticks();
- * int nGameControllers = 0;
- * for (int i = 0; i < nJoysticks; i++) {
- * if (SDL_IsGameController(i)) {
- * nGameControllers++;
- * }
- * }
- *
- * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
- * guid,name,mappings
- *
- * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
- * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
- * The mapping format for joystick is:
- * bX - a joystick button, index X
- * hX.Y - hat X with value Y
- * aX - axis X of the joystick
- * Buttons can be used as a controller axis and vice versa.
- *
- * This string shows an example of a valid mapping for a controller
- * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
- *
- */
-
-/**
- * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform()
- * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
- *
- * If \c freerw is non-zero, the stream will be closed after being read.
- *
- * \return number of mappings added, -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
-
-/**
- * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
- *
- * Convenience macro.
- */
-#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
-
-/**
- * Add or update an existing mapping configuration
- *
- * \return 1 if mapping is added, 0 if updated, -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
-
-/**
- * Get the number of mappings installed
- *
- * \return the number of mappings
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
-
-/**
- * Get the mapping at a particular index.
- *
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
- */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
-
-/**
- * Get a mapping string for a GUID
- *
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
- */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
-
-/**
- * Get a mapping string for an open GameController
- *
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
- */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
-
-/**
- * Is the joystick on this index supported by the game controller interface?
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
-
-/**
- * Get the implementation dependent name of a game controller.
- * This can be called before any controllers are opened.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
-
-/**
- * Open a game controller for use.
- * The index passed as an argument refers to the N'th game controller on the system.
- * This index is not the value which will identify this controller in future
- * controller events. The joystick's instance id (::SDL_JoystickID) will be
- * used there instead.
- *
- * \return A controller identifier, or NULL if an error occurred.
- */
-extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
-
-/**
- * Return the SDL_GameController associated with an instance id.
- */
-extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
-
-/**
- * Return the name for this currently opened controller
- */
-extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
-
-/**
- * Get the USB vendor ID of an opened controller, if available.
- * If the vendor ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
-
-/**
- * Get the USB product ID of an opened controller, if available.
- * If the product ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
-
-/**
- * Get the product version of an opened controller, if available.
- * If the product version isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
-
-/**
- * Returns SDL_TRUE if the controller has been opened and currently connected,
- * or SDL_FALSE if it has not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
-
-/**
- * Get the underlying joystick object used by a controller
- */
-extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
-
-/**
- * Enable/disable controller event polling.
- *
- * If controller events are disabled, you must call SDL_GameControllerUpdate()
- * yourself and check the state of the controller when you want controller
- * information.
- *
- * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
-
-/**
- * Update the current state of the open game controllers.
- *
- * This is called automatically by the event loop if any game controller
- * events are enabled.
- */
-extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
-
-
-/**
- * The list of axes available from a controller
- *
- * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
- * and are centered within ~8000 of zero, though advanced UI will allow users to set
- * or autodetect the dead zone, which varies between controllers.
- *
- * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
- */
-typedef enum
-{
- SDL_CONTROLLER_AXIS_INVALID = -1,
- SDL_CONTROLLER_AXIS_LEFTX,
- SDL_CONTROLLER_AXIS_LEFTY,
- SDL_CONTROLLER_AXIS_RIGHTX,
- SDL_CONTROLLER_AXIS_RIGHTY,
- SDL_CONTROLLER_AXIS_TRIGGERLEFT,
- SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
- SDL_CONTROLLER_AXIS_MAX
-} SDL_GameControllerAxis;
-
-/**
- * turn this string into a axis mapping
- */
-extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
-
-/**
- * turn this axis enum into a string mapping
- */
-extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
-
-/**
- * Get the SDL joystick layer binding for this controller button mapping
- */
-extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
-SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
- SDL_GameControllerAxis axis);
-
-/**
- * Get the current state of an axis control on a game controller.
- *
- * The state is a value ranging from -32768 to 32767 (except for the triggers,
- * which range from 0 to 32767).
- *
- * The axis indices start at index 0.
- */
-extern DECLSPEC Sint16 SDLCALL
-SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
- SDL_GameControllerAxis axis);
-
-/**
- * The list of buttons available from a controller
- */
-typedef enum
-{
- SDL_CONTROLLER_BUTTON_INVALID = -1,
- SDL_CONTROLLER_BUTTON_A,
- SDL_CONTROLLER_BUTTON_B,
- SDL_CONTROLLER_BUTTON_X,
- SDL_CONTROLLER_BUTTON_Y,
- SDL_CONTROLLER_BUTTON_BACK,
- SDL_CONTROLLER_BUTTON_GUIDE,
- SDL_CONTROLLER_BUTTON_START,
- SDL_CONTROLLER_BUTTON_LEFTSTICK,
- SDL_CONTROLLER_BUTTON_RIGHTSTICK,
- SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
- SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
- SDL_CONTROLLER_BUTTON_DPAD_UP,
- SDL_CONTROLLER_BUTTON_DPAD_DOWN,
- SDL_CONTROLLER_BUTTON_DPAD_LEFT,
- SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
- SDL_CONTROLLER_BUTTON_MAX
-} SDL_GameControllerButton;
-
-/**
- * turn this string into a button mapping
- */
-extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
-
-/**
- * turn this button enum into a string mapping
- */
-extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
-
-/**
- * Get the SDL joystick layer binding for this controller button mapping
- */
-extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
-SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
- SDL_GameControllerButton button);
-
-
-/**
- * Get the current state of a button on a game controller.
- *
- * The button indices start at index 0.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
- SDL_GameControllerButton button);
-
-/**
- * Close a controller previously opened with SDL_GameControllerOpen().
- */
-extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_gamecontroller_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gesture.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gesture.h
deleted file mode 100644
index 2bba6a7..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_gesture.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_gesture.h
- *
- * Include file for SDL gesture event handling.
- */
-
-#ifndef SDL_gesture_h_
-#define SDL_gesture_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "SDL_touch.h"
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef Sint64 SDL_GestureID;
-
-/* Function prototypes */
-
-/**
- * \brief Begin Recording a gesture on the specified touch, or all touches (-1)
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
-
-
-/**
- * \brief Save all currently loaded Dollar Gesture templates
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
-
-/**
- * \brief Save a currently loaded Dollar Gesture template
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
-
-
-/**
- * \brief Load Dollar Gesture templates from a file
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_gesture_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_haptic.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_haptic.h
deleted file mode 100644
index 60daefa..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_haptic.h
+++ /dev/null
@@ -1,1227 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_haptic.h
- *
- * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
- * devices.
- *
- * The basic usage is as follows:
- * - Initialize the subsystem (::SDL_INIT_HAPTIC).
- * - Open a haptic device.
- * - SDL_HapticOpen() to open from index.
- * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
- * - Create an effect (::SDL_HapticEffect).
- * - Upload the effect with SDL_HapticNewEffect().
- * - Run the effect with SDL_HapticRunEffect().
- * - (optional) Free the effect with SDL_HapticDestroyEffect().
- * - Close the haptic device with SDL_HapticClose().
- *
- * \par Simple rumble example:
- * \code
- * SDL_Haptic *haptic;
- *
- * // Open the device
- * haptic = SDL_HapticOpen( 0 );
- * if (haptic == NULL)
- * return -1;
- *
- * // Initialize simple rumble
- * if (SDL_HapticRumbleInit( haptic ) != 0)
- * return -1;
- *
- * // Play effect at 50% strength for 2 seconds
- * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
- * return -1;
- * SDL_Delay( 2000 );
- *
- * // Clean up
- * SDL_HapticClose( haptic );
- * \endcode
- *
- * \par Complete example:
- * \code
- * int test_haptic( SDL_Joystick * joystick ) {
- * SDL_Haptic *haptic;
- * SDL_HapticEffect effect;
- * int effect_id;
- *
- * // Open the device
- * haptic = SDL_HapticOpenFromJoystick( joystick );
- * if (haptic == NULL) return -1; // Most likely joystick isn't haptic
- *
- * // See if it can do sine waves
- * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
- * SDL_HapticClose(haptic); // No sine effect
- * return -1;
- * }
- *
- * // Create the effect
- * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
- * effect.type = SDL_HAPTIC_SINE;
- * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
- * effect.periodic.direction.dir[0] = 18000; // Force comes from south
- * effect.periodic.period = 1000; // 1000 ms
- * effect.periodic.magnitude = 20000; // 20000/32767 strength
- * effect.periodic.length = 5000; // 5 seconds long
- * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
- * effect.periodic.fade_length = 1000; // Takes 1 second to fade away
- *
- * // Upload the effect
- * effect_id = SDL_HapticNewEffect( haptic, &effect );
- *
- * // Test the effect
- * SDL_HapticRunEffect( haptic, effect_id, 1 );
- * SDL_Delay( 5000); // Wait for the effect to finish
- *
- * // We destroy the effect, although closing the device also does this
- * SDL_HapticDestroyEffect( haptic, effect_id );
- *
- * // Close the device
- * SDL_HapticClose(haptic);
- *
- * return 0; // Success
- * }
- * \endcode
- */
-
-#ifndef SDL_haptic_h_
-#define SDL_haptic_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_joystick.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * \typedef SDL_Haptic
- *
- * \brief The haptic structure used to identify an SDL haptic.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticOpenFromJoystick
- * \sa SDL_HapticClose
- */
-struct _SDL_Haptic;
-typedef struct _SDL_Haptic SDL_Haptic;
-
-
-/**
- * \name Haptic features
- *
- * Different haptic features a device can have.
- */
-/* @{ */
-
-/**
- * \name Haptic effects
- */
-/* @{ */
-
-/**
- * \brief Constant effect supported.
- *
- * Constant haptic effect.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_CONSTANT (1u<<0)
-
-/**
- * \brief Sine wave effect supported.
- *
- * Periodic haptic effect that simulates sine waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_SINE (1u<<1)
-
-/**
- * \brief Left/Right effect supported.
- *
- * Haptic effect for direct control over high/low frequency motors.
- *
- * \sa SDL_HapticLeftRight
- * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
- * we ran out of bits, and this is important for XInput devices.
- */
-#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
-
-/* !!! FIXME: put this back when we have more bits in 2.1 */
-/* #define SDL_HAPTIC_SQUARE (1<<2) */
-
-/**
- * \brief Triangle wave effect supported.
- *
- * Periodic haptic effect that simulates triangular waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_TRIANGLE (1u<<3)
-
-/**
- * \brief Sawtoothup wave effect supported.
- *
- * Periodic haptic effect that simulates saw tooth up waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
-
-/**
- * \brief Sawtoothdown wave effect supported.
- *
- * Periodic haptic effect that simulates saw tooth down waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
-
-/**
- * \brief Ramp effect supported.
- *
- * Ramp haptic effect.
- *
- * \sa SDL_HapticRamp
- */
-#define SDL_HAPTIC_RAMP (1u<<6)
-
-/**
- * \brief Spring effect supported - uses axes position.
- *
- * Condition haptic effect that simulates a spring. Effect is based on the
- * axes position.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_SPRING (1u<<7)
-
-/**
- * \brief Damper effect supported - uses axes velocity.
- *
- * Condition haptic effect that simulates dampening. Effect is based on the
- * axes velocity.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_DAMPER (1u<<8)
-
-/**
- * \brief Inertia effect supported - uses axes acceleration.
- *
- * Condition haptic effect that simulates inertia. Effect is based on the axes
- * acceleration.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_INERTIA (1u<<9)
-
-/**
- * \brief Friction effect supported - uses axes movement.
- *
- * Condition haptic effect that simulates friction. Effect is based on the
- * axes movement.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_FRICTION (1u<<10)
-
-/**
- * \brief Custom effect is supported.
- *
- * User defined custom haptic effect.
- */
-#define SDL_HAPTIC_CUSTOM (1u<<11)
-
-/* @} *//* Haptic effects */
-
-/* These last few are features the device has, not effects */
-
-/**
- * \brief Device can set global gain.
- *
- * Device supports setting the global gain.
- *
- * \sa SDL_HapticSetGain
- */
-#define SDL_HAPTIC_GAIN (1u<<12)
-
-/**
- * \brief Device can set autocenter.
- *
- * Device supports setting autocenter.
- *
- * \sa SDL_HapticSetAutocenter
- */
-#define SDL_HAPTIC_AUTOCENTER (1u<<13)
-
-/**
- * \brief Device can be queried for effect status.
- *
- * Device supports querying effect status.
- *
- * \sa SDL_HapticGetEffectStatus
- */
-#define SDL_HAPTIC_STATUS (1u<<14)
-
-/**
- * \brief Device can be paused.
- *
- * Devices supports being paused.
- *
- * \sa SDL_HapticPause
- * \sa SDL_HapticUnpause
- */
-#define SDL_HAPTIC_PAUSE (1u<<15)
-
-
-/**
- * \name Direction encodings
- */
-/* @{ */
-
-/**
- * \brief Uses polar coordinates for the direction.
- *
- * \sa SDL_HapticDirection
- */
-#define SDL_HAPTIC_POLAR 0
-
-/**
- * \brief Uses cartesian coordinates for the direction.
- *
- * \sa SDL_HapticDirection
- */
-#define SDL_HAPTIC_CARTESIAN 1
-
-/**
- * \brief Uses spherical coordinates for the direction.
- *
- * \sa SDL_HapticDirection
- */
-#define SDL_HAPTIC_SPHERICAL 2
-
-/* @} *//* Direction encodings */
-
-/* @} *//* Haptic features */
-
-/*
- * Misc defines.
- */
-
-/**
- * \brief Used to play a device an infinite number of times.
- *
- * \sa SDL_HapticRunEffect
- */
-#define SDL_HAPTIC_INFINITY 4294967295U
-
-
-/**
- * \brief Structure that represents a haptic direction.
- *
- * This is the direction where the force comes from,
- * instead of the direction in which the force is exerted.
- *
- * Directions can be specified by:
- * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
- * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
- * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
- *
- * Cardinal directions of the haptic device are relative to the positioning
- * of the device. North is considered to be away from the user.
- *
- * The following diagram represents the cardinal directions:
- * \verbatim
- .--.
- |__| .-------.
- |=.| |.-----.|
- |--| || ||
- | | |'-----'|
- |__|~')_____('
- [ COMPUTER ]
-
-
- North (0,-1)
- ^
- |
- |
- (-1,0) West <----[ HAPTIC ]----> East (1,0)
- |
- |
- v
- South (0,1)
-
-
- [ USER ]
- \|||/
- (o o)
- ---ooO-(_)-Ooo---
- \endverbatim
- *
- * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
- * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
- * the first \c dir parameter. The cardinal directions would be:
- * - North: 0 (0 degrees)
- * - East: 9000 (90 degrees)
- * - South: 18000 (180 degrees)
- * - West: 27000 (270 degrees)
- *
- * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
- * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
- * the first three \c dir parameters. The cardinal directions would be:
- * - North: 0,-1, 0
- * - East: 1, 0, 0
- * - South: 0, 1, 0
- * - West: -1, 0, 0
- *
- * The Z axis represents the height of the effect if supported, otherwise
- * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
- * can use any multiple you want, only the direction matters.
- *
- * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
- * The first two \c dir parameters are used. The \c dir parameters are as
- * follows (all values are in hundredths of degrees):
- * - Degrees from (1, 0) rotated towards (0, 1).
- * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
- *
- *
- * Example of force coming from the south with all encodings (force coming
- * from the south means the user will have to pull the stick to counteract):
- * \code
- * SDL_HapticDirection direction;
- *
- * // Cartesian directions
- * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
- * direction.dir[0] = 0; // X position
- * direction.dir[1] = 1; // Y position
- * // Assuming the device has 2 axes, we don't need to specify third parameter.
- *
- * // Polar directions
- * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
- * direction.dir[0] = 18000; // Polar only uses first parameter
- *
- * // Spherical coordinates
- * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
- * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
- * \endcode
- *
- * \sa SDL_HAPTIC_POLAR
- * \sa SDL_HAPTIC_CARTESIAN
- * \sa SDL_HAPTIC_SPHERICAL
- * \sa SDL_HapticEffect
- * \sa SDL_HapticNumAxes
- */
-typedef struct SDL_HapticDirection
-{
- Uint8 type; /**< The type of encoding. */
- Sint32 dir[3]; /**< The encoded direction. */
-} SDL_HapticDirection;
-
-
-/**
- * \brief A structure containing a template for a Constant effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
- *
- * A constant effect applies a constant force in the specified direction
- * to the joystick.
- *
- * \sa SDL_HAPTIC_CONSTANT
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticConstant
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Constant */
- Sint16 level; /**< Strength of the constant effect. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticConstant;
-
-/**
- * \brief A structure containing a template for a Periodic effect.
- *
- * The struct handles the following effects:
- * - ::SDL_HAPTIC_SINE
- * - ::SDL_HAPTIC_LEFTRIGHT
- * - ::SDL_HAPTIC_TRIANGLE
- * - ::SDL_HAPTIC_SAWTOOTHUP
- * - ::SDL_HAPTIC_SAWTOOTHDOWN
- *
- * A periodic effect consists in a wave-shaped effect that repeats itself
- * over time. The type determines the shape of the wave and the parameters
- * determine the dimensions of the wave.
- *
- * Phase is given by hundredth of a degree meaning that giving the phase a value
- * of 9000 will displace it 25% of its period. Here are sample values:
- * - 0: No phase displacement.
- * - 9000: Displaced 25% of its period.
- * - 18000: Displaced 50% of its period.
- * - 27000: Displaced 75% of its period.
- * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
- *
- * Examples:
- * \verbatim
- SDL_HAPTIC_SINE
- __ __ __ __
- / \ / \ / \ /
- / \__/ \__/ \__/
-
- SDL_HAPTIC_SQUARE
- __ __ __ __ __
- | | | | | | | | | |
- | |__| |__| |__| |__| |
-
- SDL_HAPTIC_TRIANGLE
- /\ /\ /\ /\ /\
- / \ / \ / \ / \ /
- / \/ \/ \/ \/
-
- SDL_HAPTIC_SAWTOOTHUP
- /| /| /| /| /| /| /|
- / | / | / | / | / | / | / |
- / |/ |/ |/ |/ |/ |/ |
-
- SDL_HAPTIC_SAWTOOTHDOWN
- \ |\ |\ |\ |\ |\ |\ |
- \ | \ | \ | \ | \ | \ | \ |
- \| \| \| \| \| \| \|
- \endverbatim
- *
- * \sa SDL_HAPTIC_SINE
- * \sa SDL_HAPTIC_LEFTRIGHT
- * \sa SDL_HAPTIC_TRIANGLE
- * \sa SDL_HAPTIC_SAWTOOTHUP
- * \sa SDL_HAPTIC_SAWTOOTHDOWN
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticPeriodic
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
- ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
- ::SDL_HAPTIC_SAWTOOTHDOWN */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Periodic */
- Uint16 period; /**< Period of the wave. */
- Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
- Sint16 offset; /**< Mean value of the wave. */
- Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticPeriodic;
-
-/**
- * \brief A structure containing a template for a Condition effect.
- *
- * The struct handles the following effects:
- * - ::SDL_HAPTIC_SPRING: Effect based on axes position.
- * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
- * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
- * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
- *
- * Direction is handled by condition internals instead of a direction member.
- * The condition effect specific members have three parameters. The first
- * refers to the X axis, the second refers to the Y axis and the third
- * refers to the Z axis. The right terms refer to the positive side of the
- * axis and the left terms refer to the negative side of the axis. Please
- * refer to the ::SDL_HapticDirection diagram for which side is positive and
- * which is negative.
- *
- * \sa SDL_HapticDirection
- * \sa SDL_HAPTIC_SPRING
- * \sa SDL_HAPTIC_DAMPER
- * \sa SDL_HAPTIC_INERTIA
- * \sa SDL_HAPTIC_FRICTION
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticCondition
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
- ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
- SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Condition */
- Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */
- Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */
- Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
- Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
- Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
- Sint16 center[3]; /**< Position of the dead zone. */
-} SDL_HapticCondition;
-
-/**
- * \brief A structure containing a template for a Ramp effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
- *
- * The ramp effect starts at start strength and ends at end strength.
- * It augments in linear fashion. If you use attack and fade with a ramp
- * the effects get added to the ramp effect making the effect become
- * quadratic instead of linear.
- *
- * \sa SDL_HAPTIC_RAMP
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticRamp
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_RAMP */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Ramp */
- Sint16 start; /**< Beginning strength level. */
- Sint16 end; /**< Ending strength level. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticRamp;
-
-/**
- * \brief A structure containing a template for a Left/Right effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
- *
- * The Left/Right effect is used to explicitly control the large and small
- * motors, commonly found in modern game controllers. One motor is high
- * frequency, the other is low frequency.
- *
- * \sa SDL_HAPTIC_LEFTRIGHT
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticLeftRight
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
-
- /* Rumble */
- Uint16 large_magnitude; /**< Control of the large controller motor. */
- Uint16 small_magnitude; /**< Control of the small controller motor. */
-} SDL_HapticLeftRight;
-
-/**
- * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
- *
- * A custom force feedback effect is much like a periodic effect, where the
- * application can define its exact shape. You will have to allocate the
- * data yourself. Data should consist of channels * samples Uint16 samples.
- *
- * If channels is one, the effect is rotated using the defined direction.
- * Otherwise it uses the samples in data for the different axes.
- *
- * \sa SDL_HAPTIC_CUSTOM
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticCustom
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Custom */
- Uint8 channels; /**< Axes to use, minimum of one. */
- Uint16 period; /**< Sample periods. */
- Uint16 samples; /**< Amount of samples. */
- Uint16 *data; /**< Should contain channels*samples items. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticCustom;
-
-/**
- * \brief The generic template for any haptic effect.
- *
- * All values max at 32767 (0x7FFF). Signed values also can be negative.
- * Time values unless specified otherwise are in milliseconds.
- *
- * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
- * value. Neither delay, interval, attack_length nor fade_length support
- * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
- *
- * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
- * ::SDL_HAPTIC_INFINITY.
- *
- * Button triggers may not be supported on all devices, it is advised to not
- * use them if possible. Buttons start at index 1 instead of index 0 like
- * the joystick.
- *
- * If both attack_length and fade_level are 0, the envelope is not used,
- * otherwise both values are used.
- *
- * Common parts:
- * \code
- * // Replay - All effects have this
- * Uint32 length; // Duration of effect (ms).
- * Uint16 delay; // Delay before starting effect.
- *
- * // Trigger - All effects have this
- * Uint16 button; // Button that triggers effect.
- * Uint16 interval; // How soon before effect can be triggered again.
- *
- * // Envelope - All effects except condition effects have this
- * Uint16 attack_length; // Duration of the attack (ms).
- * Uint16 attack_level; // Level at the start of the attack.
- * Uint16 fade_length; // Duration of the fade out (ms).
- * Uint16 fade_level; // Level at the end of the fade.
- * \endcode
- *
- *
- * Here we have an example of a constant effect evolution in time:
- * \verbatim
- Strength
- ^
- |
- | effect level --> _________________
- | / \
- | / \
- | / \
- | / \
- | attack_level --> | \
- | | | <--- fade_level
- |
- +--------------------------------------------------> Time
- [--] [---]
- attack_length fade_length
-
- [------------------][-----------------------]
- delay length
- \endverbatim
- *
- * Note either the attack_level or the fade_level may be above the actual
- * effect level.
- *
- * \sa SDL_HapticConstant
- * \sa SDL_HapticPeriodic
- * \sa SDL_HapticCondition
- * \sa SDL_HapticRamp
- * \sa SDL_HapticLeftRight
- * \sa SDL_HapticCustom
- */
-typedef union SDL_HapticEffect
-{
- /* Common for all force feedback effects */
- Uint16 type; /**< Effect type. */
- SDL_HapticConstant constant; /**< Constant effect. */
- SDL_HapticPeriodic periodic; /**< Periodic effect. */
- SDL_HapticCondition condition; /**< Condition effect. */
- SDL_HapticRamp ramp; /**< Ramp effect. */
- SDL_HapticLeftRight leftright; /**< Left/Right effect. */
- SDL_HapticCustom custom; /**< Custom effect. */
-} SDL_HapticEffect;
-
-
-/* Function prototypes */
-/**
- * \brief Count the number of haptic devices attached to the system.
- *
- * \return Number of haptic devices detected on the system.
- */
-extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
-
-/**
- * \brief Get the implementation dependent name of a haptic device.
- *
- * This can be called before any joysticks are opened.
- * If no name can be found, this function returns NULL.
- *
- * \param device_index Index of the device to get its name.
- * \return Name of the device or NULL on error.
- *
- * \sa SDL_NumHaptics
- */
-extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
-
-/**
- * \brief Opens a haptic device for use.
- *
- * The index passed as an argument refers to the N'th haptic device on this
- * system.
- *
- * When opening a haptic device, its gain will be set to maximum and
- * autocenter will be disabled. To modify these values use
- * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
- *
- * \param device_index Index of the device to open.
- * \return Device identifier or NULL on error.
- *
- * \sa SDL_HapticIndex
- * \sa SDL_HapticOpenFromMouse
- * \sa SDL_HapticOpenFromJoystick
- * \sa SDL_HapticClose
- * \sa SDL_HapticSetGain
- * \sa SDL_HapticSetAutocenter
- * \sa SDL_HapticPause
- * \sa SDL_HapticStopAll
- */
-extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
-
-/**
- * \brief Checks if the haptic device at index has been opened.
- *
- * \param device_index Index to check to see if it has been opened.
- * \return 1 if it has been opened or 0 if it hasn't.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticIndex
- */
-extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
-
-/**
- * \brief Gets the index of a haptic device.
- *
- * \param haptic Haptic device to get the index of.
- * \return The index of the haptic device or -1 on error.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticOpened
- */
-extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
-
-/**
- * \brief Gets whether or not the current mouse has haptic capabilities.
- *
- * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
- *
- * \sa SDL_HapticOpenFromMouse
- */
-extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
-
-/**
- * \brief Tries to open a haptic device from the current mouse.
- *
- * \return The haptic device identifier or NULL on error.
- *
- * \sa SDL_MouseIsHaptic
- * \sa SDL_HapticOpen
- */
-extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
-
-/**
- * \brief Checks to see if a joystick has haptic features.
- *
- * \param joystick Joystick to test for haptic capabilities.
- * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
- * or -1 if an error occurred.
- *
- * \sa SDL_HapticOpenFromJoystick
- */
-extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
-
-/**
- * \brief Opens a haptic device for use from a joystick device.
- *
- * You must still close the haptic device separately. It will not be closed
- * with the joystick.
- *
- * When opening from a joystick you should first close the haptic device before
- * closing the joystick device. If not, on some implementations the haptic
- * device will also get unallocated and you'll be unable to use force feedback
- * on that device.
- *
- * \param joystick Joystick to create a haptic device from.
- * \return A valid haptic device identifier on success or NULL on error.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticClose
- */
-extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
- joystick);
-
-/**
- * \brief Closes a haptic device previously opened with SDL_HapticOpen().
- *
- * \param haptic Haptic device to close.
- */
-extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
-
-/**
- * \brief Returns the number of effects a haptic device can store.
- *
- * On some platforms this isn't fully supported, and therefore is an
- * approximation. Always check to see if your created effect was actually
- * created and do not rely solely on SDL_HapticNumEffects().
- *
- * \param haptic The haptic device to query effect max.
- * \return The number of effects the haptic device can store or
- * -1 on error.
- *
- * \sa SDL_HapticNumEffectsPlaying
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
-
-/**
- * \brief Returns the number of effects a haptic device can play at the same
- * time.
- *
- * This is not supported on all platforms, but will always return a value.
- * Added here for the sake of completeness.
- *
- * \param haptic The haptic device to query maximum playing effects.
- * \return The number of effects the haptic device can play at the same time
- * or -1 on error.
- *
- * \sa SDL_HapticNumEffects
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
-
-/**
- * \brief Gets the haptic device's supported features in bitwise manner.
- *
- * Example:
- * \code
- * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- * printf("We have constant haptic effect!\n");
- * }
- * \endcode
- *
- * \param haptic The haptic device to query.
- * \return Haptic features in bitwise manner (OR'd).
- *
- * \sa SDL_HapticNumEffects
- * \sa SDL_HapticEffectSupported
- */
-extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
-
-
-/**
- * \brief Gets the number of haptic axes the device has.
- *
- * \sa SDL_HapticDirection
- */
-extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
-
-/**
- * \brief Checks to see if effect is supported by haptic.
- *
- * \param haptic Haptic device to check on.
- * \param effect Effect to check to see if it is supported.
- * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
- *
- * \sa SDL_HapticQuery
- * \sa SDL_HapticNewEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
- SDL_HapticEffect *
- effect);
-
-/**
- * \brief Creates a new haptic effect on the device.
- *
- * \param haptic Haptic device to create the effect on.
- * \param effect Properties of the effect to create.
- * \return The identifier of the effect on success or -1 on error.
- *
- * \sa SDL_HapticUpdateEffect
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticDestroyEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
- SDL_HapticEffect * effect);
-
-/**
- * \brief Updates the properties of an effect.
- *
- * Can be used dynamically, although behavior when dynamically changing
- * direction may be strange. Specifically the effect may reupload itself
- * and start playing from the start. You cannot change the type either when
- * running SDL_HapticUpdateEffect().
- *
- * \param haptic Haptic device that has the effect.
- * \param effect Identifier of the effect to update.
- * \param data New effect properties to use.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticNewEffect
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticDestroyEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
- int effect,
- SDL_HapticEffect * data);
-
-/**
- * \brief Runs the haptic effect on its associated haptic device.
- *
- * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
- * repeating the envelope (attack and fade) every time. If you only want the
- * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
- * parameter.
- *
- * \param haptic Haptic device to run the effect on.
- * \param effect Identifier of the haptic effect to run.
- * \param iterations Number of iterations to run the effect. Use
- * ::SDL_HAPTIC_INFINITY for infinity.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticStopEffect
- * \sa SDL_HapticDestroyEffect
- * \sa SDL_HapticGetEffectStatus
- */
-extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
- int effect,
- Uint32 iterations);
-
-/**
- * \brief Stops the haptic effect on its associated haptic device.
- *
- * \param haptic Haptic device to stop the effect on.
- * \param effect Identifier of the effect to stop.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticDestroyEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
- int effect);
-
-/**
- * \brief Destroys a haptic effect on the device.
- *
- * This will stop the effect if it's running. Effects are automatically
- * destroyed when the device is closed.
- *
- * \param haptic Device to destroy the effect on.
- * \param effect Identifier of the effect to destroy.
- *
- * \sa SDL_HapticNewEffect
- */
-extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
- int effect);
-
-/**
- * \brief Gets the status of the current effect on the haptic device.
- *
- * Device must support the ::SDL_HAPTIC_STATUS feature.
- *
- * \param haptic Haptic device to query the effect status on.
- * \param effect Identifier of the effect to query its status.
- * \return 0 if it isn't playing, 1 if it is playing or -1 on error.
- *
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticStopEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
- int effect);
-
-/**
- * \brief Sets the global gain of the device.
- *
- * Device must support the ::SDL_HAPTIC_GAIN feature.
- *
- * The user may specify the maximum gain by setting the environment variable
- * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
- * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
- * maximum.
- *
- * \param haptic Haptic device to set the gain on.
- * \param gain Value to set the gain to, should be between 0 and 100.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
-
-/**
- * \brief Sets the global autocenter of the device.
- *
- * Autocenter should be between 0 and 100. Setting it to 0 will disable
- * autocentering.
- *
- * Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
- *
- * \param haptic Haptic device to set autocentering on.
- * \param autocenter Value to set autocenter to, 0 disables autocentering.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
- int autocenter);
-
-/**
- * \brief Pauses a haptic device.
- *
- * Device must support the ::SDL_HAPTIC_PAUSE feature. Call
- * SDL_HapticUnpause() to resume playback.
- *
- * Do not modify the effects nor add new ones while the device is paused.
- * That can cause all sorts of weird errors.
- *
- * \param haptic Haptic device to pause.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticUnpause
- */
-extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
-
-/**
- * \brief Unpauses a haptic device.
- *
- * Call to unpause after SDL_HapticPause().
- *
- * \param haptic Haptic device to unpause.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticPause
- */
-extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
-
-/**
- * \brief Stops all the currently playing effects on a haptic device.
- *
- * \param haptic Haptic device to stop.
- * \return 0 on success or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
-
-/**
- * \brief Checks to see if rumble is supported on a haptic device.
- *
- * \param haptic Haptic device to check to see if it supports rumble.
- * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
- *
- * \sa SDL_HapticRumbleInit
- * \sa SDL_HapticRumblePlay
- * \sa SDL_HapticRumbleStop
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
-
-/**
- * \brief Initializes the haptic device for simple rumble playback.
- *
- * \param haptic Haptic device to initialize for simple rumble playback.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticRumbleSupported
- * \sa SDL_HapticRumblePlay
- * \sa SDL_HapticRumbleStop
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
-
-/**
- * \brief Runs simple rumble on a haptic device
- *
- * \param haptic Haptic device to play rumble effect on.
- * \param strength Strength of the rumble to play as a 0-1 float value.
- * \param length Length of the rumble to play in milliseconds.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticRumbleSupported
- * \sa SDL_HapticRumbleInit
- * \sa SDL_HapticRumbleStop
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
-
-/**
- * \brief Stops the simple rumble on a haptic device.
- *
- * \param haptic Haptic to stop the rumble on.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticRumbleSupported
- * \sa SDL_HapticRumbleInit
- * \sa SDL_HapticRumblePlay
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_haptic_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_hints.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_hints.h
deleted file mode 100644
index 007a4be..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_hints.h
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_hints.h
- *
- * Official documentation for SDL configuration variables
- *
- * This file contains functions to set and get configuration hints,
- * as well as listing each of them alphabetically.
- *
- * The convention for naming hints is SDL_HINT_X, where "SDL_X" is
- * the environment variable that can be used to override the default.
- *
- * In general these hints are just that - they may or may not be
- * supported or applicable on any given platform, but they provide
- * a way for an application or user to give the library a hint as
- * to how they would like the library to work.
- */
-
-#ifndef SDL_hints_h_
-#define SDL_hints_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
- *
- * SDL can try to accelerate the SDL screen surface by using streaming
- * textures with a 3D rendering engine. This variable controls whether and
- * how this is done.
- *
- * This variable can be set to the following values:
- * "0" - Disable 3D acceleration
- * "1" - Enable 3D acceleration, using the default renderer.
- * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
- *
- * By default SDL tries to make a best guess for each platform whether
- * to use acceleration or not.
- */
-#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
-
-/**
- * \brief A variable specifying which render driver to use.
- *
- * If the application doesn't pick a specific renderer to use, this variable
- * specifies the name of the preferred renderer. If the preferred renderer
- * can't be initialized, the normal default renderer is used.
- *
- * This variable is case insensitive and can be set to the following values:
- * "direct3d"
- * "opengl"
- * "opengles2"
- * "opengles"
- * "software"
- *
- * The default varies by platform, but it's the first one in the list that
- * is available on the current platform.
- */
-#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
-
-/**
- * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
- *
- * This variable can be set to the following values:
- * "0" - Disable shaders
- * "1" - Enable shaders
- *
- * By default shaders are used if OpenGL supports them.
- */
-#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
-
-/**
- * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations.
- *
- * This variable can be set to the following values:
- * "0" - Thread-safety is not enabled (faster)
- * "1" - Thread-safety is enabled
- *
- * By default the Direct3D device is created with thread-safety disabled.
- */
-#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
-
-/**
- * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer.
- *
- * This variable does not have any effect on the Direct3D 9 based renderer.
- *
- * This variable can be set to the following values:
- * "0" - Disable Debug Layer use
- * "1" - Enable Debug Layer use
- *
- * By default, SDL does not use Direct3D Debug Layer.
- */
-#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
-
-/**
- * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
- *
- * This variable can be set to the following values:
- * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
- * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
- *
- * By default letterbox is used
- */
-#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
-
-/**
- * \brief A variable controlling the scaling quality
- *
- * This variable can be set to the following values:
- * "0" or "nearest" - Nearest pixel sampling
- * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
- * "2" or "best" - Currently this is the same as "linear"
- *
- * By default nearest pixel sampling is used
- */
-#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
-
-/**
- * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
- *
- * This variable can be set to the following values:
- * "0" - Disable vsync
- * "1" - Enable vsync
- *
- * By default SDL does not sync screen surface updates with vertical refresh.
- */
-#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
-
-/**
- * \brief A variable controlling whether the screensaver is enabled.
- *
- * This variable can be set to the following values:
- * "0" - Disable screensaver
- * "1" - Enable screensaver
- *
- * By default SDL will disable the screensaver.
- */
-#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
-
-/**
- * \brief A variable controlling whether the X11 VidMode extension should be used.
- *
- * This variable can be set to the following values:
- * "0" - Disable XVidMode
- * "1" - Enable XVidMode
- *
- * By default SDL will use XVidMode if it is available.
- */
-#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE"
-
-/**
- * \brief A variable controlling whether the X11 Xinerama extension should be used.
- *
- * This variable can be set to the following values:
- * "0" - Disable Xinerama
- * "1" - Enable Xinerama
- *
- * By default SDL will use Xinerama if it is available.
- */
-#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA"
-
-/**
- * \brief A variable controlling whether the X11 XRandR extension should be used.
- *
- * This variable can be set to the following values:
- * "0" - Disable XRandR
- * "1" - Enable XRandR
- *
- * By default SDL will not use XRandR because of window manager issues.
- */
-#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
-
-/**
- * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
- *
- * This variable can be set to the following values:
- * "0" - Disable _NET_WM_PING
- * "1" - Enable _NET_WM_PING
- *
- * By default SDL will use _NET_WM_PING, but for applications that know they
- * will not always be able to respond to ping requests in a timely manner they can
- * turn it off to avoid the window manager thinking the app is hung.
- * The hint is checked in CreateWindow.
- */
-#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
-
-/**
- * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
- *
- * This variable can be set to the following values:
- * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
- * "1" - The window frame is interactive when the cursor is hidden
- *
- * By default SDL will allow interaction with the window frame when the cursor is hidden
- */
-#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
-
-/**
- * \brief A variable to specify custom icon resource id from RC file on Windows platform
- */
-#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
-#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
-
-/**
- * \brief A variable controlling whether the windows message loop is processed by SDL
- *
- * This variable can be set to the following values:
- * "0" - The window message loop is not run
- * "1" - The window message loop is processed in SDL_PumpEvents()
- *
- * By default SDL will process the windows message loop
- */
-#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP"
-
-/**
- * \brief A variable controlling whether grabbing input grabs the keyboard
- *
- * This variable can be set to the following values:
- * "0" - Grab will affect only the mouse
- * "1" - Grab will affect mouse and keyboard
- *
- * By default SDL will not grab the keyboard so system shortcuts still work.
- */
-#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
-
-/**
- * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
- */
-#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
-
-/**
- * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
- */
-#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
-
-/**
- * \brief A variable controlling whether relative mouse mode is implemented using mouse warping
- *
- * This variable can be set to the following values:
- * "0" - Relative mouse mode uses raw input
- * "1" - Relative mouse mode uses mouse warping
- *
- * By default SDL will use raw input for relative mouse mode
- */
-#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP"
-
-/**
- * \brief Allow mouse click events when clicking to focus an SDL window
- *
- * This variable can be set to the following values:
- * "0" - Ignore mouse clicks that activate a window
- * "1" - Generate events for mouse clicks that activate a window
- *
- * By default SDL will ignore mouse clicks that activate a window
- */
-#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
-
-/**
- * \brief A variable controlling whether touch events should generate synthetic mouse events
- *
- * This variable can be set to the following values:
- * "0" - Touch events will not generate mouse events
- * "1" - Touch events will generate mouse events
- *
- * By default SDL will generate mouse events for touch events
- */
-#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
-
-/**
- * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
- *
- */
-#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
-
-/**
- * \brief A variable controlling whether the idle timer is disabled on iOS.
- *
- * When an iOS app does not receive touches for some time, the screen is
- * dimmed automatically. For games where the accelerometer is the only input
- * this is problematic. This functionality can be disabled by setting this
- * hint.
- *
- * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver()
- * accomplish the same thing on iOS. They should be preferred over this hint.
- *
- * This variable can be set to the following values:
- * "0" - Enable idle timer
- * "1" - Disable idle timer
- */
-#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
-
-/**
- * \brief A variable controlling which orientations are allowed on iOS.
- *
- * In some circumstances it is necessary to be able to explicitly control
- * which UI orientations are allowed.
- *
- * This variable is a space delimited list of the following values:
- * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
- */
-#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
-
-/**
- * \brief A variable controlling whether controllers used with the Apple TV
- * generate UI events.
- *
- * When UI events are generated by controller input, the app will be
- * backgrounded when the Apple TV remote's menu button is pressed, and when the
- * pause or B buttons on gamepads are pressed.
- *
- * More information about properly making use of controllers for the Apple TV
- * can be found here:
- * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/
- *
- * This variable can be set to the following values:
- * "0" - Controller input does not generate UI events (the default).
- * "1" - Controller input generates UI events.
- */
-#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"
-
-/**
- * \brief A variable controlling whether the Apple TV remote's joystick axes
- * will automatically match the rotation of the remote.
- *
- * This variable can be set to the following values:
- * "0" - Remote orientation does not affect joystick axes (the default).
- * "1" - Joystick axes are based on the orientation of the remote.
- */
-#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
-
-/**
- * \brief A variable controlling whether the Android / iOS built-in
- * accelerometer should be listed as a joystick device, rather than listing
- * actual joysticks only.
- *
- * This variable can be set to the following values:
- * "0" - List only real joysticks and accept input from them
- * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
- */
-#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
-
-/**
- * \brief A variable that lets you disable the detection and use of Xinput gamepad devices
- *
- * The variable can be set to the following values:
- * "0" - Disable XInput detection (only uses direct input)
- * "1" - Enable XInput detection (the default)
- */
-#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
-
-/**
- * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
- *
- * This hint is for backwards compatibility only and will be removed in SDL 2.1
- *
- * The default value is "0". This hint must be set before SDL_Init()
- */
-#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
-
-/**
- * \brief A variable that lets you manually hint extra gamecontroller db entries.
- *
- * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
- *
- * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
- * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
- */
-#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
-
-/**
- * \brief A variable containing a list of devices to skip when scanning for game controllers.
- *
- * The format of the string is a comma separated list of USB VID/PID pairs
- * in hexadecimal form, e.g.
- *
- * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
- *
- * The variable can also take the form of @file, in which case the named
- * file will be loaded and interpreted as the value of the variable.
- */
-#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
-
-/**
- * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
- *
- * The format of the string is a comma separated list of USB VID/PID pairs
- * in hexadecimal form, e.g.
- *
- * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
- *
- * The variable can also take the form of @file, in which case the named
- * file will be loaded and interpreted as the value of the variable.
- */
-#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
-
-/**
- * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
- *
- * The variable can be set to the following values:
- * "0" - Disable joystick & gamecontroller input events when the
- * application is in the background.
- * "1" - Enable joystick & gamecontroller input events when the
- * application is in the background.
- *
- * The default value is "0". This hint may be set at any time.
- */
-#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
-
-/**
- * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
- * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
- *
- * This variable can be set to the following values:
- * "0" - don't allow topmost
- * "1" - allow topmost
- */
-#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
-
-/**
- * \brief A variable that controls the timer resolution, in milliseconds.
- *
- * The higher resolution the timer, the more frequently the CPU services
- * timer interrupts, and the more precise delays are, but this takes up
- * power and CPU time. This hint is only used on Windows 7 and earlier.
- *
- * See this blog post for more information:
- * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
- *
- * If this variable is set to "0", the system timer resolution is not set.
- *
- * The default value is "1". This hint may be set at any time.
- */
-#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
-
-
-/**
- * \brief A variable describing the content orientation on QtWayland-based platforms.
- *
- * On QtWayland platforms, windows are rotated client-side to allow for custom
- * transitions. In order to correctly position overlays (e.g. volume bar) and
- * gestures (e.g. events view, close/minimize gestures), the system needs to
- * know in which orientation the application is currently drawing its contents.
- *
- * This does not cause the window to be rotated or resized, the application
- * needs to take care of drawing the content in the right orientation (the
- * framebuffer is always in portrait mode).
- *
- * This variable can be one of the following values:
- * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
- */
-#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
-
-/**
- * \brief Flags to set on QtWayland windows to integrate with the native window manager.
- *
- * On QtWayland platforms, this hint controls the flags to set on the windows.
- * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
- *
- * This variable is a space-separated list of the following values (empty = no flags):
- * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
- */
-#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
-
-/**
-* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
-*
-* Use this hint in case you need to set SDL's threads stack size to other than the default.
-* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
-* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
-* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
-*/
-#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
-
-/**
- * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
- */
-#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
-
-/**
- * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac
- *
- * If present, holding ctrl while left clicking will generate a right click
- * event when on Mac.
- */
-#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
-
-/**
-* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
-*
-* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It
-* can use two different sets of binaries, those compiled by the user from source
-* or those provided by the Chrome browser. In the later case, these binaries require
-* that SDL loads a DLL providing the shader compiler.
-*
-* This variable can be set to the following values:
-* "d3dcompiler_46.dll" - default, best for Vista or later.
-* "d3dcompiler_43.dll" - for XP support.
-* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.
-*
-*/
-#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER"
-
-/**
-* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
-*
-* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
-* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
-* created SDL_Window:
-*
-* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
-* needed for example when sharing an OpenGL context across multiple windows.
-*
-* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for
-* OpenGL rendering.
-*
-* This variable can be set to the following values:
-* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should
-* share a pixel format with.
-*/
-#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
-
-/**
- * \brief A URL to a WinRT app's privacy policy
- *
- * All network-enabled WinRT apps must make a privacy policy available to its
- * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
- * be available in the Windows Settings charm, as accessed from within the app.
- * SDL provides code to add a URL-based link there, which can point to the app's
- * privacy policy.
- *
- * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
- * before calling any SDL_Init() functions. The contents of the hint should
- * be a valid URL. For example, "http://www.example.com".
- *
- * The default value is "", which will prevent SDL from adding a privacy policy
- * link to the Settings charm. This hint should only be set during app init.
- *
- * The label text of an app's "Privacy Policy" link may be customized via another
- * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
- *
- * Please note that on Windows Phone, Microsoft does not provide standard UI
- * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
- * will not get used on that platform. Network-enabled phone apps should display
- * their privacy policy through some other, in-app means.
- */
-#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
-
-/** \brief Label text for a WinRT app's privacy policy link
- *
- * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
- * Microsoft mandates that this policy be available via the Windows Settings charm.
- * SDL provides code to add a link there, with its label text being set via the
- * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
- *
- * Please note that a privacy policy's contents are not set via this hint. A separate
- * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
- * policy.
- *
- * The contents of this hint should be encoded as a UTF8 string.
- *
- * The default value is "Privacy Policy". This hint should only be set during app
- * initialization, preferably before any calls to SDL_Init().
- *
- * For additional information on linking to a privacy policy, see the documentation for
- * SDL_HINT_WINRT_PRIVACY_POLICY_URL.
- */
-#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
-
-/** \brief Allows back-button-press events on Windows Phone to be marked as handled
- *
- * Windows Phone devices typically feature a Back button. When pressed,
- * the OS will emit back-button-press events, which apps are expected to
- * handle in an appropriate manner. If apps do not explicitly mark these
- * events as 'Handled', then the OS will invoke its default behavior for
- * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
- * terminate the app (and attempt to switch to the previous app, or to the
- * device's home screen).
- *
- * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
- * to mark back-button-press events as Handled, if and when one is sent to
- * the app.
- *
- * Internally, Windows Phone sends back button events as parameters to
- * special back-button-press callback functions. Apps that need to respond
- * to back-button-press events are expected to register one or more
- * callback functions for such, shortly after being launched (during the
- * app's initialization phase). After the back button is pressed, the OS
- * will invoke these callbacks. If the app's callback(s) do not explicitly
- * mark the event as handled by the time they return, or if the app never
- * registers one of these callback, the OS will consider the event
- * un-handled, and it will apply its default back button behavior (terminate
- * the app).
- *
- * SDL registers its own back-button-press callback with the Windows Phone
- * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
- * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
- * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
- * If the hint's value is set to "1", the back button event's Handled
- * property will get set to 'true'. If the hint's value is set to something
- * else, or if it is unset, SDL will leave the event's Handled property
- * alone. (By default, the OS sets this property to 'false', to note.)
- *
- * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
- * back button is pressed, or can set it in direct-response to a back button
- * being pressed.
- *
- * In order to get notified when a back button is pressed, SDL apps should
- * register a callback function with SDL_AddEventWatch(), and have it listen
- * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
- * (Alternatively, SDL_KEYUP events can be listened-for. Listening for
- * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
- * set by such a callback, will be applied to the OS' current
- * back-button-press event.
- *
- * More details on back button behavior in Windows Phone apps can be found
- * at the following page, on Microsoft's developer site:
- * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
- */
-#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
-
-/**
- * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X.
- *
- * This hint only applies to Mac OS X.
- *
- * The variable can be set to the following values:
- * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and
- * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen"
- * button on their titlebars).
- * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and
- * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
- * button on their titlebars).
- *
- * The default value is "1". Spaces are disabled regardless of this hint if
- * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
- * any windows are created.
- */
-#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
-
-/**
-* \brief When set don't force the SDL app to become a foreground process
-*
-* This hint only applies to Mac OS X.
-*
-*/
-#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
-
-/**
- * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
- *
- * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
- *
- * If both hints were set then SDL_RWFromFile() will look into expansion files
- * after a given relative path was not found in the internal storage and assets.
- *
- * By default this hint is not set and the APK expansion files are not searched.
- */
-#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
-
-/**
- * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
- *
- * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
- *
- * If both hints were set then SDL_RWFromFile() will look into expansion files
- * after a given relative path was not found in the internal storage and assets.
- *
- * By default this hint is not set and the APK expansion files are not searched.
- */
-#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
-
-/**
- * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
- *
- * The variable can be set to the following values:
- * "0" - SDL_TEXTEDITING events are sent, and it is the application's
- * responsibility to render the text from these events and
- * differentiate it somehow from committed text. (default)
- * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
- * and text that is being composed will be rendered in its own UI.
- */
-#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
-
- /**
- * \brief A variable to control whether mouse and touch events are to be treated together or separately
- *
- * The variable can be set to the following values:
- * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
- * events. This is the behaviour of SDL <= 2.0.3. (default)
- * "1" - Mouse events will be handled separately from pure touch events.
- *
- * The value of this hint is used at runtime, so it can be changed at any time.
- */
-#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
-
-/**
- * \brief override the binding element for keyboard inputs for Emscripten builds
- *
- * This hint only applies to the emscripten platform
- *
- * The variable can be one of
- * "#window" - The javascript window object (this is the default)
- * "#document" - The javascript document object
- * "#screen" - the javascript window.screen object
- * "#canvas" - the WebGL canvas element
- * any other string without a leading # sign applies to the element on the page with that ID.
- */
-#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
-
-/**
- * \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
- *
- * This hint only applies to Unix-like platforms.
- *
- * The variable can be set to the following values:
- * "0" - SDL will install a SIGINT and SIGTERM handler, and when it
- * catches a signal, convert it into an SDL_QUIT event.
- * "1" - SDL will not install a signal handler at all.
- */
-#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
-
-/**
- * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
- *
- * The variable can be set to the following values:
- * "0" - SDL will generate a window-close event when it sees Alt+F4.
- * "1" - SDL will only do normal key handling for Alt+F4.
- */
-#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
-
-/**
- * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
- *
- * The bitmap header version 4 is required for proper alpha channel support and
- * SDL will use it when required. Should this not be desired, this hint can
- * force the use of the 40 byte header version which is supported everywhere.
- *
- * The variable can be set to the following values:
- * "0" - Surfaces with a colorkey or an alpha channel are saved to a
- * 32-bit BMP file with an alpha mask. SDL will use the bitmap
- * header version 4 and set the alpha mask accordingly.
- * "1" - Surfaces with a colorkey or an alpha channel are saved to a
- * 32-bit BMP file without an alpha mask. The alpha channel data
- * will be in the file, but applications are going to ignore it.
- *
- * The default value is "0".
- */
-#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
-
-/**
- * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
- * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
- * thread's name, but it tends to cause problems with other debuggers,
- * and the .NET runtime. Note that SDL 2.0.6 and later will still use
- * the (safer) SetThreadDescription API, introduced in the Windows 10
- * Creators Update, if available.
- *
- * The variable can be set to the following values:
- * "0" - SDL will raise the 0x406D1388 Exception to name threads.
- * This is the default behavior of SDL <= 2.0.4.
- * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
- * This is necessary with .NET languages or debuggers that aren't Visual Studio.
- */
-#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
-
-/**
- * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI
- *
- * Also known as Z-order. The variable can take a negative or positive value.
- * The default is 10000.
- */
-#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
-
-/**
- * \brief A variable controlling what driver to use for OpenGL ES contexts.
- *
- * On some platforms, currently Windows and X11, OpenGL drivers may support
- * creating contexts with an OpenGL ES profile. By default SDL uses these
- * profiles, when available, otherwise it attempts to load an OpenGL ES
- * library, e.g. that provided by the ANGLE project. This variable controls
- * whether SDL follows this default behaviour or will always load an
- * OpenGL ES library.
- *
- * Circumstances where this is useful include
- * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
- * or emulator, e.g. those from ARM, Imagination or Qualcomm.
- * - Resolving OpenGL ES function addresses at link time by linking with
- * the OpenGL ES library instead of querying them at run time with
- * SDL_GL_GetProcAddress().
- *
- * Caution: for an application to work with the default behaviour across
- * different OpenGL drivers it must query the OpenGL ES function
- * addresses at run time using SDL_GL_GetProcAddress().
- *
- * This variable is ignored on most platforms because OpenGL ES is native
- * or not supported.
- *
- * This variable can be set to the following values:
- * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
- * "1" - Load OpenGL ES library using the default library names.
- *
- */
-#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
-
-/**
- * \brief A variable controlling speed/quality tradeoff of audio resampling.
- *
- * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
- * to handle audio resampling. There are different resampling modes available
- * that produce different levels of quality, using more CPU.
- *
- * If this hint isn't specified to a valid setting, or libsamplerate isn't
- * available, SDL will use the default, internal resampling algorithm.
- *
- * Note that this is currently only applicable to resampling audio that is
- * being written to a device for playback or audio being read from a device
- * for capture. SDL_AudioCVT always uses the default resampler (although this
- * might change for SDL 2.1).
- *
- * This hint is currently only checked at audio subsystem initialization.
- *
- * This variable can be set to the following values:
- *
- * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
- * "1" or "fast" - Use fast, slightly higher quality resampling, if available
- * "2" or "medium" - Use medium quality resampling, if available
- * "3" or "best" - Use high quality resampling, if available
- */
-#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
-
-/**
- * \brief A variable controlling the audio category on iOS and Mac OS X
- *
- * This variable can be set to the following values:
- *
- * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
- * "playback" - Use the AVAudioSessionCategoryPlayback category
- *
- * For more information, see Apple's documentation:
- * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
- */
-#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
-
-/**
- * \brief An enumeration of hint priorities
- */
-typedef enum
-{
- SDL_HINT_DEFAULT,
- SDL_HINT_NORMAL,
- SDL_HINT_OVERRIDE
-} SDL_HintPriority;
-
-
-/**
- * \brief Set a hint with a specific priority
- *
- * The priority controls the behavior when setting a hint that already
- * has a value. Hints will replace existing hints of their priority and
- * lower. Environment variables are considered to have override priority.
- *
- * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
- const char *value,
- SDL_HintPriority priority);
-
-/**
- * \brief Set a hint with normal priority
- *
- * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
- const char *value);
-
-/**
- * \brief Get a hint
- *
- * \return The string value of a hint variable.
- */
-extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
-
-/**
- * \brief Get a hint
- *
- * \return The boolean value of a hint variable.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
-
-/**
- * \brief type definition of the hint callback function.
- */
-typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
-
-/**
- * \brief Add a function to watch a particular hint
- *
- * \param name The hint to watch
- * \param callback The function to call when the hint value changes
- * \param userdata A pointer to pass to the callback function
- */
-extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
- SDL_HintCallback callback,
- void *userdata);
-
-/**
- * \brief Remove a function watching a particular hint
- *
- * \param name The hint being watched
- * \param callback The function being called when the hint value changes
- * \param userdata A pointer being passed to the callback function
- */
-extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
- SDL_HintCallback callback,
- void *userdata);
-
-/**
- * \brief Clear all hints
- *
- * This function is called during SDL_Quit() to free stored hints.
- */
-extern DECLSPEC void SDLCALL SDL_ClearHints(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_hints_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_joystick.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_joystick.h
deleted file mode 100644
index f598dc8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_joystick.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_joystick.h
- *
- * Include file for SDL joystick event handling
- *
- * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
- * behind a device_index changing as joysticks are plugged and unplugged.
- *
- * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
- * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
- *
- * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
- * the device (a X360 wired controller for example). This identifier is platform dependent.
- *
- *
- */
-
-#ifndef SDL_joystick_h_
-#define SDL_joystick_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_joystick.h
- *
- * In order to use these functions, SDL_Init() must have been called
- * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
- * for joysticks, and load appropriate drivers.
- *
- * If you would like to receive joystick updates while the application
- * is in the background, you should set the following hint before calling
- * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
- */
-
-/**
- * The joystick structure used to identify an SDL joystick
- */
-struct _SDL_Joystick;
-typedef struct _SDL_Joystick SDL_Joystick;
-
-/* A structure that encodes the stable unique id for a joystick device */
-typedef struct {
- Uint8 data[16];
-} SDL_JoystickGUID;
-
-/**
- * This is a unique ID for a joystick for the time it is connected to the system,
- * and is never reused for the lifetime of the application. If the joystick is
- * disconnected and reconnected, it will get a new ID.
- *
- * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
- */
-typedef Sint32 SDL_JoystickID;
-
-typedef enum
-{
- SDL_JOYSTICK_TYPE_UNKNOWN,
- SDL_JOYSTICK_TYPE_GAMECONTROLLER,
- SDL_JOYSTICK_TYPE_WHEEL,
- SDL_JOYSTICK_TYPE_ARCADE_STICK,
- SDL_JOYSTICK_TYPE_FLIGHT_STICK,
- SDL_JOYSTICK_TYPE_DANCE_PAD,
- SDL_JOYSTICK_TYPE_GUITAR,
- SDL_JOYSTICK_TYPE_DRUM_KIT,
- SDL_JOYSTICK_TYPE_ARCADE_PAD,
- SDL_JOYSTICK_TYPE_THROTTLE
-} SDL_JoystickType;
-
-typedef enum
-{
- SDL_JOYSTICK_POWER_UNKNOWN = -1,
- SDL_JOYSTICK_POWER_EMPTY,
- SDL_JOYSTICK_POWER_LOW,
- SDL_JOYSTICK_POWER_MEDIUM,
- SDL_JOYSTICK_POWER_FULL,
- SDL_JOYSTICK_POWER_WIRED,
- SDL_JOYSTICK_POWER_MAX
-} SDL_JoystickPowerLevel;
-
-/* Function prototypes */
-
-/**
- * Locking for multi-threaded access to the joystick API
- *
- * If you are using the joystick API or handling events from multiple threads
- * you should use these locking functions to protect access to the joysticks.
- *
- * In particular, you are guaranteed that the joystick list won't change, so
- * the API functions that take a joystick index will be valid, and joystick
- * and game controller events will not be delivered.
- */
-extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
-extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
-
-/**
- * Count the number of joysticks attached to the system right now
- */
-extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
-
-/**
- * Get the implementation dependent name of a joystick.
- * This can be called before any joysticks are opened.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
-
-/**
- * Return the GUID for the joystick at this index
- * This can be called before any joysticks are opened.
- */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
-
-/**
- * Get the USB vendor ID of a joystick, if available.
- * This can be called before any joysticks are opened.
- * If the vendor ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
-
-/**
- * Get the USB product ID of a joystick, if available.
- * This can be called before any joysticks are opened.
- * If the product ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
-
-/**
- * Get the product version of a joystick, if available.
- * This can be called before any joysticks are opened.
- * If the product version isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
-
-/**
- * Get the type of a joystick, if available.
- * This can be called before any joysticks are opened.
- */
-extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
-
-/**
- * Get the instance ID of a joystick.
- * This can be called before any joysticks are opened.
- * If the index is out of range, this function will return -1.
- */
-extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
-
-/**
- * Open a joystick for use.
- * The index passed as an argument refers to the N'th joystick on the system.
- * This index is not the value which will identify this joystick in future
- * joystick events. The joystick's instance id (::SDL_JoystickID) will be used
- * there instead.
- *
- * \return A joystick identifier, or NULL if an error occurred.
- */
-extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
-
-/**
- * Return the SDL_Joystick associated with an instance id.
- */
-extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
-
-/**
- * Return the name for this currently opened joystick.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
-
-/**
- * Return the GUID for this opened joystick
- */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
-
-/**
- * Get the USB vendor ID of an opened joystick, if available.
- * If the vendor ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
-
-/**
- * Get the USB product ID of an opened joystick, if available.
- * If the product ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
-
-/**
- * Get the product version of an opened joystick, if available.
- * If the product version isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
-
-/**
- * Get the type of an opened joystick.
- */
-extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
-
-/**
- * Return a string representation for this guid. pszGUID must point to at least 33 bytes
- * (32 for the string plus a NULL terminator).
- */
-extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
-
-/**
- * Convert a string into a joystick guid
- */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
-
-/**
- * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
-
-/**
- * Get the instance ID of an opened joystick or -1 if the joystick is invalid.
- */
-extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
-
-/**
- * Get the number of general axis controls on a joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
-
-/**
- * Get the number of trackballs on a joystick.
- *
- * Joystick trackballs have only relative motion events associated
- * with them and their state cannot be polled.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
-
-/**
- * Get the number of POV hats on a joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
-
-/**
- * Get the number of buttons on a joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
-
-/**
- * Update the current state of the open joysticks.
- *
- * This is called automatically by the event loop if any joystick
- * events are enabled.
- */
-extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
-
-/**
- * Enable/disable joystick event polling.
- *
- * If joystick events are disabled, you must call SDL_JoystickUpdate()
- * yourself and check the state of the joystick when you want joystick
- * information.
- *
- * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
-
-#define SDL_JOYSTICK_AXIS_MAX 32767
-#define SDL_JOYSTICK_AXIS_MIN -32768
-/**
- * Get the current state of an axis control on a joystick.
- *
- * The state is a value ranging from -32768 to 32767.
- *
- * The axis indices start at index 0.
- */
-extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
- int axis);
-
-/**
- * Get the initial state of an axis control on a joystick.
- *
- * The state is a value ranging from -32768 to 32767.
- *
- * The axis indices start at index 0.
- *
- * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
- int axis, Sint16 *state);
-
-/**
- * \name Hat positions
- */
-/* @{ */
-#define SDL_HAT_CENTERED 0x00
-#define SDL_HAT_UP 0x01
-#define SDL_HAT_RIGHT 0x02
-#define SDL_HAT_DOWN 0x04
-#define SDL_HAT_LEFT 0x08
-#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
-#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
-#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
-#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
-/* @} */
-
-/**
- * Get the current state of a POV hat on a joystick.
- *
- * The hat indices start at index 0.
- *
- * \return The return value is one of the following positions:
- * - ::SDL_HAT_CENTERED
- * - ::SDL_HAT_UP
- * - ::SDL_HAT_RIGHT
- * - ::SDL_HAT_DOWN
- * - ::SDL_HAT_LEFT
- * - ::SDL_HAT_RIGHTUP
- * - ::SDL_HAT_RIGHTDOWN
- * - ::SDL_HAT_LEFTUP
- * - ::SDL_HAT_LEFTDOWN
- */
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
- int hat);
-
-/**
- * Get the ball axis change since the last poll.
- *
- * \return 0, or -1 if you passed it invalid parameters.
- *
- * The ball indices start at index 0.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
- int ball, int *dx, int *dy);
-
-/**
- * Get the current state of a button on a joystick.
- *
- * The button indices start at index 0.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
- int button);
-
-/**
- * Close a joystick previously opened with SDL_JoystickOpen().
- */
-extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
-
-/**
- * Return the battery level of this joystick
- */
-extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_joystick_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keyboard.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keyboard.h
deleted file mode 100644
index e78ca46..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keyboard.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_keyboard.h
- *
- * Include file for SDL keyboard event handling
- */
-
-#ifndef SDL_keyboard_h_
-#define SDL_keyboard_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_keycode.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The SDL keysym structure, used in key events.
- *
- * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
- */
-typedef struct SDL_Keysym
-{
- SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
- SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
- Uint16 mod; /**< current key modifiers */
- Uint32 unused;
-} SDL_Keysym;
-
-/* Function prototypes */
-
-/**
- * \brief Get the window which currently has keyboard focus.
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
-
-/**
- * \brief Get a snapshot of the current state of the keyboard.
- *
- * \param numkeys if non-NULL, receives the length of the returned array.
- *
- * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
- *
- * \b Example:
- * \code
- * const Uint8 *state = SDL_GetKeyboardState(NULL);
- * if ( state[SDL_SCANCODE_RETURN] ) {
- * printf("<RETURN> is pressed.\n");
- * }
- * \endcode
- */
-extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
-
-/**
- * \brief Get the current key modifier state for the keyboard.
- */
-extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
-
-/**
- * \brief Set the current key modifier state for the keyboard.
- *
- * \note This does not change the keyboard state, only the key modifier flags.
- */
-extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
-
-/**
- * \brief Get the key code corresponding to the given scancode according
- * to the current keyboard layout.
- *
- * See ::SDL_Keycode for details.
- *
- * \sa SDL_GetKeyName()
- */
-extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
-
-/**
- * \brief Get the scancode corresponding to the given key code according to the
- * current keyboard layout.
- *
- * See ::SDL_Scancode for details.
- *
- * \sa SDL_GetScancodeName()
- */
-extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
-
-/**
- * \brief Get a human-readable name for a scancode.
- *
- * \return A pointer to the name for the scancode.
- * If the scancode doesn't have a name, this function returns
- * an empty string ("").
- *
- * \sa SDL_Scancode
- */
-extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
-
-/**
- * \brief Get a scancode from a human-readable name
- *
- * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
- *
- * \sa SDL_Scancode
- */
-extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
-
-/**
- * \brief Get a human-readable name for a key.
- *
- * \return A pointer to a UTF-8 string that stays valid at least until the next
- * call to this function. If you need it around any longer, you must
- * copy it. If the key doesn't have a name, this function returns an
- * empty string ("").
- *
- * \sa SDL_Keycode
- */
-extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
-
-/**
- * \brief Get a key code from a human-readable name
- *
- * \return key code, or SDLK_UNKNOWN if the name wasn't recognized
- *
- * \sa SDL_Keycode
- */
-extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
-
-/**
- * \brief Start accepting Unicode text input events.
- * This function will show the on-screen keyboard if supported.
- *
- * \sa SDL_StopTextInput()
- * \sa SDL_SetTextInputRect()
- * \sa SDL_HasScreenKeyboardSupport()
- */
-extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
-
-/**
- * \brief Return whether or not Unicode text input events are enabled.
- *
- * \sa SDL_StartTextInput()
- * \sa SDL_StopTextInput()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
-
-/**
- * \brief Stop receiving any text input events.
- * This function will hide the on-screen keyboard if supported.
- *
- * \sa SDL_StartTextInput()
- * \sa SDL_HasScreenKeyboardSupport()
- */
-extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
-
-/**
- * \brief Set the rectangle used to type Unicode text inputs.
- * This is used as a hint for IME and on-screen keyboard placement.
- *
- * \sa SDL_StartTextInput()
- */
-extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
-
-/**
- * \brief Returns whether the platform has some screen keyboard support.
- *
- * \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
- *
- * \note Not all screen keyboard functions are supported on all platforms.
- *
- * \sa SDL_IsScreenKeyboardShown()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
-
-/**
- * \brief Returns whether the screen keyboard is shown for given window.
- *
- * \param window The window for which screen keyboard should be queried.
- *
- * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
- *
- * \sa SDL_HasScreenKeyboardSupport()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_keyboard_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keycode.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keycode.h
deleted file mode 100644
index c41e45f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_keycode.h
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_keycode.h
- *
- * Defines constants which identify keyboard keys and modifiers.
- */
-
-#ifndef SDL_keycode_h_
-#define SDL_keycode_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_scancode.h"
-
-/**
- * \brief The SDL virtual key representation.
- *
- * Values of this type are used to represent keyboard keys using the current
- * layout of the keyboard. These values include Unicode values representing
- * the unmodified character that would be generated by pressing the key, or
- * an SDLK_* constant for those keys that do not generate characters.
- *
- * A special exception is the number keys at the top of the keyboard which
- * always map to SDLK_0...SDLK_9, regardless of layout.
- */
-typedef Sint32 SDL_Keycode;
-
-#define SDLK_SCANCODE_MASK (1<<30)
-#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
-
-enum
-{
- SDLK_UNKNOWN = 0,
-
- SDLK_RETURN = '\r',
- SDLK_ESCAPE = '\033',
- SDLK_BACKSPACE = '\b',
- SDLK_TAB = '\t',
- SDLK_SPACE = ' ',
- SDLK_EXCLAIM = '!',
- SDLK_QUOTEDBL = '"',
- SDLK_HASH = '#',
- SDLK_PERCENT = '%',
- SDLK_DOLLAR = '$',
- SDLK_AMPERSAND = '&',
- SDLK_QUOTE = '\'',
- SDLK_LEFTPAREN = '(',
- SDLK_RIGHTPAREN = ')',
- SDLK_ASTERISK = '*',
- SDLK_PLUS = '+',
- SDLK_COMMA = ',',
- SDLK_MINUS = '-',
- SDLK_PERIOD = '.',
- SDLK_SLASH = '/',
- SDLK_0 = '0',
- SDLK_1 = '1',
- SDLK_2 = '2',
- SDLK_3 = '3',
- SDLK_4 = '4',
- SDLK_5 = '5',
- SDLK_6 = '6',
- SDLK_7 = '7',
- SDLK_8 = '8',
- SDLK_9 = '9',
- SDLK_COLON = ':',
- SDLK_SEMICOLON = ';',
- SDLK_LESS = '<',
- SDLK_EQUALS = '=',
- SDLK_GREATER = '>',
- SDLK_QUESTION = '?',
- SDLK_AT = '@',
- /*
- Skip uppercase letters
- */
- SDLK_LEFTBRACKET = '[',
- SDLK_BACKSLASH = '\\',
- SDLK_RIGHTBRACKET = ']',
- SDLK_CARET = '^',
- SDLK_UNDERSCORE = '_',
- SDLK_BACKQUOTE = '`',
- SDLK_a = 'a',
- SDLK_b = 'b',
- SDLK_c = 'c',
- SDLK_d = 'd',
- SDLK_e = 'e',
- SDLK_f = 'f',
- SDLK_g = 'g',
- SDLK_h = 'h',
- SDLK_i = 'i',
- SDLK_j = 'j',
- SDLK_k = 'k',
- SDLK_l = 'l',
- SDLK_m = 'm',
- SDLK_n = 'n',
- SDLK_o = 'o',
- SDLK_p = 'p',
- SDLK_q = 'q',
- SDLK_r = 'r',
- SDLK_s = 's',
- SDLK_t = 't',
- SDLK_u = 'u',
- SDLK_v = 'v',
- SDLK_w = 'w',
- SDLK_x = 'x',
- SDLK_y = 'y',
- SDLK_z = 'z',
-
- SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
-
- SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
- SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
- SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
- SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
- SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
- SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
- SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
- SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
- SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
- SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
- SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
- SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
-
- SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
- SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
- SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
- SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
- SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
- SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
- SDLK_DELETE = '\177',
- SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
- SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
- SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
- SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
- SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
- SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
-
- SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
- SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
- SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
- SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
- SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
- SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
- SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
- SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
- SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
- SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
- SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
- SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
- SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
- SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
- SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
- SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
- SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
-
- SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
- SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
- SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
- SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
- SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
- SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
- SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
- SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
- SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
- SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
- SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
- SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
- SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
- SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
- SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
- SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
- SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
- SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
- SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
- SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
- SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
- SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
- SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
- SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
- SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
- SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
- SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
- SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
- SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
- SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
- SDLK_KP_EQUALSAS400 =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
-
- SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
- SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
- SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
- SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
- SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
- SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
- SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
- SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
- SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
- SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
- SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
- SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
-
- SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
- SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
- SDLK_THOUSANDSSEPARATOR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
- SDLK_DECIMALSEPARATOR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
- SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
- SDLK_CURRENCYSUBUNIT =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
- SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
- SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
- SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
- SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
- SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
- SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
- SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
- SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
- SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
- SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
- SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
- SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
- SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
- SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
- SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
- SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
- SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
- SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
- SDLK_KP_DBLAMPERSAND =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
- SDLK_KP_VERTICALBAR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
- SDLK_KP_DBLVERTICALBAR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
- SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
- SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
- SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
- SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
- SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
- SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
- SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
- SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
- SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
- SDLK_KP_MEMSUBTRACT =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
- SDLK_KP_MEMMULTIPLY =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
- SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
- SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
- SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
- SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
- SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
- SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
- SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
- SDLK_KP_HEXADECIMAL =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
-
- SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
- SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
- SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
- SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
- SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
- SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
- SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
- SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
-
- SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
-
- SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
- SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
- SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
- SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
- SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
- SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
- SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
- SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
- SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
- SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
- SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
- SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
- SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
- SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
- SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
- SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
- SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
-
- SDLK_BRIGHTNESSDOWN =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
- SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
- SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
- SDLK_KBDILLUMTOGGLE =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
- SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
- SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
- SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
- SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
- SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
- SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
-
- SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
- SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
-};
-
-/**
- * \brief Enumeration of valid key mods (possibly OR'd together).
- */
-typedef enum
-{
- KMOD_NONE = 0x0000,
- KMOD_LSHIFT = 0x0001,
- KMOD_RSHIFT = 0x0002,
- KMOD_LCTRL = 0x0040,
- KMOD_RCTRL = 0x0080,
- KMOD_LALT = 0x0100,
- KMOD_RALT = 0x0200,
- KMOD_LGUI = 0x0400,
- KMOD_RGUI = 0x0800,
- KMOD_NUM = 0x1000,
- KMOD_CAPS = 0x2000,
- KMOD_MODE = 0x4000,
- KMOD_RESERVED = 0x8000
-} SDL_Keymod;
-
-#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
-#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
-#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
-#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
-
-#endif /* SDL_keycode_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_loadso.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_loadso.h
deleted file mode 100644
index 6ea256c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_loadso.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_loadso.h
- *
- * System dependent library loading routines
- *
- * Some things to keep in mind:
- * \li These functions only work on C function names. Other languages may
- * have name mangling and intrinsic language support that varies from
- * compiler to compiler.
- * \li Make sure you declare your function pointers with the same calling
- * convention as the actual library function. Your code will crash
- * mysteriously if you do not do this.
- * \li Avoid namespace collisions. If you load a symbol from the library,
- * it is not defined whether or not it goes into the global symbol
- * namespace for the application. If it does and it conflicts with
- * symbols in your code or other shared libraries, you will not get
- * the results you expect. :)
- */
-
-#ifndef SDL_loadso_h_
-#define SDL_loadso_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This function dynamically loads a shared object and returns a pointer
- * to the object handle (or NULL if there was an error).
- * The 'sofile' parameter is a system dependent name of the object file.
- */
-extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
-
-/**
- * Given an object handle, this function looks up the address of the
- * named function in the shared object and returns it. This address
- * is no longer valid after calling SDL_UnloadObject().
- */
-extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
- const char *name);
-
-/**
- * Unload a shared object from memory.
- */
-extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_loadso_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_log.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_log.h
deleted file mode 100644
index 356d0e1..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_log.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_log.h
- *
- * Simple log messages with categories and priorities.
- *
- * By default logs are quiet, but if you're debugging SDL you might want:
- *
- * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
- *
- * Here's where the messages go on different platforms:
- * Windows: debug output stream
- * Android: log output
- * Others: standard error output (stderr)
- */
-
-#ifndef SDL_log_h_
-#define SDL_log_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * \brief The maximum size of a log message
- *
- * Messages longer than the maximum size will be truncated
- */
-#define SDL_MAX_LOG_MESSAGE 4096
-
-/**
- * \brief The predefined log categories
- *
- * By default the application category is enabled at the INFO level,
- * the assert category is enabled at the WARN level, test is enabled
- * at the VERBOSE level and all other categories are enabled at the
- * CRITICAL level.
- */
-enum
-{
- SDL_LOG_CATEGORY_APPLICATION,
- SDL_LOG_CATEGORY_ERROR,
- SDL_LOG_CATEGORY_ASSERT,
- SDL_LOG_CATEGORY_SYSTEM,
- SDL_LOG_CATEGORY_AUDIO,
- SDL_LOG_CATEGORY_VIDEO,
- SDL_LOG_CATEGORY_RENDER,
- SDL_LOG_CATEGORY_INPUT,
- SDL_LOG_CATEGORY_TEST,
-
- /* Reserved for future SDL library use */
- SDL_LOG_CATEGORY_RESERVED1,
- SDL_LOG_CATEGORY_RESERVED2,
- SDL_LOG_CATEGORY_RESERVED3,
- SDL_LOG_CATEGORY_RESERVED4,
- SDL_LOG_CATEGORY_RESERVED5,
- SDL_LOG_CATEGORY_RESERVED6,
- SDL_LOG_CATEGORY_RESERVED7,
- SDL_LOG_CATEGORY_RESERVED8,
- SDL_LOG_CATEGORY_RESERVED9,
- SDL_LOG_CATEGORY_RESERVED10,
-
- /* Beyond this point is reserved for application use, e.g.
- enum {
- MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
- MYAPP_CATEGORY_AWESOME2,
- MYAPP_CATEGORY_AWESOME3,
- ...
- };
- */
- SDL_LOG_CATEGORY_CUSTOM
-};
-
-/**
- * \brief The predefined log priorities
- */
-typedef enum
-{
- SDL_LOG_PRIORITY_VERBOSE = 1,
- SDL_LOG_PRIORITY_DEBUG,
- SDL_LOG_PRIORITY_INFO,
- SDL_LOG_PRIORITY_WARN,
- SDL_LOG_PRIORITY_ERROR,
- SDL_LOG_PRIORITY_CRITICAL,
- SDL_NUM_LOG_PRIORITIES
-} SDL_LogPriority;
-
-
-/**
- * \brief Set the priority of all log categories
- */
-extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
-
-/**
- * \brief Set the priority of a particular log category
- */
-extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
- SDL_LogPriority priority);
-
-/**
- * \brief Get the priority of a particular log category
- */
-extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
-
-/**
- * \brief Reset all priorities to default.
- *
- * \note This is called in SDL_Quit().
- */
-extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
-
-/**
- * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
- */
-extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
- */
-extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
- */
-extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_INFO
- */
-extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_WARN
- */
-extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_ERROR
- */
-extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
- */
-extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with the specified category and priority.
- */
-extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
- SDL_LogPriority priority,
- SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
-
-/**
- * \brief Log a message with the specified category and priority.
- */
-extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
- SDL_LogPriority priority,
- const char *fmt, va_list ap);
-
-/**
- * \brief The prototype for the log output function
- */
-typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
-
-/**
- * \brief Get the current log output function.
- */
-extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
-
-/**
- * \brief This function allows you to replace the default log output
- * function with one of your own.
- */
-extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_log_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_main.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_main.h
deleted file mode 100644
index 2af3236..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_main.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_main_h_
-#define SDL_main_h_
-
-#include "SDL_stdinc.h"
-
-/**
- * \file SDL_main.h
- *
- * Redefine main() on some platforms so that it is called by SDL.
- */
-
-#ifndef SDL_MAIN_HANDLED
-#if defined(__WIN32__)
-/* On Windows SDL provides WinMain(), which parses the command line and passes
- the arguments to your main function.
-
- If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
- */
-#define SDL_MAIN_AVAILABLE
-
-#elif defined(__WINRT__)
-/* On WinRT, SDL provides a main function that initializes CoreApplication,
- creating an instance of IFrameworkView in the process.
-
- Please note that #include'ing SDL_main.h is not enough to get a main()
- function working. In non-XAML apps, the file,
- src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
- into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
- called, with a pointer to the Direct3D-hosted XAML control passed in.
-*/
-#define SDL_MAIN_NEEDED
-
-#elif defined(__IPHONEOS__)
-/* On iOS SDL provides a main function that creates an application delegate
- and starts the iOS application run loop.
-
- See src/video/uikit/SDL_uikitappdelegate.m for more details.
- */
-#define SDL_MAIN_NEEDED
-
-#elif defined(__ANDROID__)
-/* On Android SDL provides a Java class in SDLActivity.java that is the
- main activity entry point.
-
- See README-android.md for more details on extending that class.
- */
-#define SDL_MAIN_NEEDED
-
-#elif defined(__NACL__)
-/* On NACL we use ppapi_simple to set up the application helper code,
- then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
- starting the user main function.
- All user code is run in a separate thread by ppapi_simple, thus
- allowing for blocking io to take place via nacl_io
-*/
-#define SDL_MAIN_NEEDED
-
-#endif
-#endif /* SDL_MAIN_HANDLED */
-
-#ifdef __cplusplus
-#define C_LINKAGE "C"
-#else
-#define C_LINKAGE
-#endif /* __cplusplus */
-
-/**
- * \file SDL_main.h
- *
- * The application's main() function must be called with C linkage,
- * and should be declared like this:
- * \code
- * #ifdef __cplusplus
- * extern "C"
- * #endif
- * int main(int argc, char *argv[])
- * {
- * }
- * \endcode
- */
-
-#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
-#define main SDL_main
-#endif
-
-/**
- * The prototype for the application's main() function
- */
-extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
-
-
-#include "begin_code.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This is called by the real SDL main function to let the rest of the
- * library know that initialization was done properly.
- *
- * Calling this yourself without knowing what you're doing can cause
- * crashes and hard to diagnose problems with your application.
- */
-extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
-
-#ifdef __WIN32__
-
-/**
- * This can be called to set the application class at startup
- */
-extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
- void *hInst);
-extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
-
-#endif /* __WIN32__ */
-
-
-#ifdef __WINRT__
-
-/**
- * \brief Initializes and launches an SDL/WinRT application.
- *
- * \param mainFunction The SDL app's C-style main().
- * \param reserved Reserved for future use; should be NULL
- * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
- * information on the failure.
- */
-extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
-
-#endif /* __WINRT__ */
-
-
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_main_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_messagebox.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_messagebox.h
deleted file mode 100644
index c326d8f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_messagebox.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_messagebox_h_
-#define SDL_messagebox_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_video.h" /* For SDL_Window */
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
- */
-typedef enum
-{
- SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
- SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
- SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
-} SDL_MessageBoxFlags;
-
-/**
- * \brief Flags for SDL_MessageBoxButtonData.
- */
-typedef enum
-{
- SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
- SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
-} SDL_MessageBoxButtonFlags;
-
-/**
- * \brief Individual button data.
- */
-typedef struct
-{
- Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
- int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
- const char * text; /**< The UTF-8 button text */
-} SDL_MessageBoxButtonData;
-
-/**
- * \brief RGB value used in a message box color scheme
- */
-typedef struct
-{
- Uint8 r, g, b;
-} SDL_MessageBoxColor;
-
-typedef enum
-{
- SDL_MESSAGEBOX_COLOR_BACKGROUND,
- SDL_MESSAGEBOX_COLOR_TEXT,
- SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
- SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
- SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
- SDL_MESSAGEBOX_COLOR_MAX
-} SDL_MessageBoxColorType;
-
-/**
- * \brief A set of colors to use for message box dialogs
- */
-typedef struct
-{
- SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
-} SDL_MessageBoxColorScheme;
-
-/**
- * \brief MessageBox structure containing title, text, window, etc.
- */
-typedef struct
-{
- Uint32 flags; /**< ::SDL_MessageBoxFlags */
- SDL_Window *window; /**< Parent window, can be NULL */
- const char *title; /**< UTF-8 title */
- const char *message; /**< UTF-8 message text */
-
- int numbuttons;
- const SDL_MessageBoxButtonData *buttons;
-
- const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
-} SDL_MessageBoxData;
-
-/**
- * \brief Create a modal message box.
- *
- * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
- * \param buttonid The pointer to which user id of hit button should be copied.
- *
- * \return -1 on error, otherwise 0 and buttonid contains user id of button
- * hit or -1 if dialog was closed.
- *
- * \note This function should be called on the thread that created the parent
- * window, or on the main thread if the messagebox has no parent. It will
- * block execution of that thread until the user clicks a button or
- * closes the messagebox.
- */
-extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
-
-/**
- * \brief Create a simple modal message box
- *
- * \param flags ::SDL_MessageBoxFlags
- * \param title UTF-8 title text
- * \param message UTF-8 message text
- * \param window The parent window, or NULL for no parent
- *
- * \return 0 on success, -1 on error
- *
- * \sa SDL_ShowMessageBox
- */
-extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_messagebox_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mouse.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mouse.h
deleted file mode 100644
index 6001bd4..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mouse.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_mouse.h
- *
- * Include file for SDL mouse event handling.
- */
-
-#ifndef SDL_mouse_h_
-#define SDL_mouse_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
-
-/**
- * \brief Cursor types for SDL_CreateSystemCursor().
- */
-typedef enum
-{
- SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
- SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
- SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
- SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
- SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
- SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
- SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
- SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
- SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
- SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
- SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
- SDL_SYSTEM_CURSOR_HAND, /**< Hand */
- SDL_NUM_SYSTEM_CURSORS
-} SDL_SystemCursor;
-
-/**
- * \brief Scroll direction types for the Scroll event
- */
-typedef enum
-{
- SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
- SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
-} SDL_MouseWheelDirection;
-
-/* Function prototypes */
-
-/**
- * \brief Get the window which currently has mouse focus.
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
-
-/**
- * \brief Retrieve the current state of the mouse.
- *
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * mouse cursor position relative to the focus window for the currently
- * selected mouse. You can pass NULL for either x or y.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
-
-/**
- * \brief Get the current state of the mouse, in relation to the desktop
- *
- * This works just like SDL_GetMouseState(), but the coordinates will be
- * reported relative to the top-left of the desktop. This can be useful if
- * you need to track the mouse outside of a specific window and
- * SDL_CaptureMouse() doesn't fit your needs. For example, it could be
- * useful if you need to track the mouse while dragging a window, where
- * coordinates relative to a window might not be in sync at all times.
- *
- * \note SDL_GetMouseState() returns the mouse position as SDL understands
- * it from the last pump of the event queue. This function, however,
- * queries the OS for the current mouse position, and as such, might
- * be a slightly less efficient function. Unless you know what you're
- * doing and have a good reason to use this function, you probably want
- * SDL_GetMouseState() instead.
- *
- * \param x Returns the current X coord, relative to the desktop. Can be NULL.
- * \param y Returns the current Y coord, relative to the desktop. Can be NULL.
- * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
- *
- * \sa SDL_GetMouseState
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
-
-/**
- * \brief Retrieve the relative state of the mouse.
- *
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * mouse deltas since the last call to SDL_GetRelativeMouseState().
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
-
-/**
- * \brief Moves the mouse to the given position within the window.
- *
- * \param window The window to move the mouse into, or NULL for the current mouse focus
- * \param x The x coordinate within the window
- * \param y The y coordinate within the window
- *
- * \note This function generates a mouse motion event
- */
-extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
- int x, int y);
-
-/**
- * \brief Moves the mouse to the given position in global screen space.
- *
- * \param x The x coordinate
- * \param y The y coordinate
- * \return 0 on success, -1 on error (usually: unsupported by a platform).
- *
- * \note This function generates a mouse motion event
- */
-extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
-
-/**
- * \brief Set relative mouse mode.
- *
- * \param enabled Whether or not to enable relative mode
- *
- * \return 0 on success, or -1 if relative mode is not supported.
- *
- * While the mouse is in relative mode, the cursor is hidden, and the
- * driver will try to report continuous motion in the current window.
- * Only relative motion events will be delivered, the mouse position
- * will not change.
- *
- * \note This function will flush any pending mouse motion.
- *
- * \sa SDL_GetRelativeMouseMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
-
-/**
- * \brief Capture the mouse, to track input outside an SDL window.
- *
- * \param enabled Whether or not to enable capturing
- *
- * Capturing enables your app to obtain mouse events globally, instead of
- * just within your window. Not all video targets support this function.
- * When capturing is enabled, the current window will get all mouse events,
- * but unlike relative mode, no change is made to the cursor and it is
- * not restrained to your window.
- *
- * This function may also deny mouse input to other windows--both those in
- * your application and others on the system--so you should use this
- * function sparingly, and in small bursts. For example, you might want to
- * track the mouse while the user is dragging something, until the user
- * releases a mouse button. It is not recommended that you capture the mouse
- * for long periods of time, such as the entire time your app is running.
- *
- * While captured, mouse events still report coordinates relative to the
- * current (foreground) window, but those coordinates may be outside the
- * bounds of the window (including negative values). Capturing is only
- * allowed for the foreground window. If the window loses focus while
- * capturing, the capture will be disabled automatically.
- *
- * While capturing is enabled, the current window will have the
- * SDL_WINDOW_MOUSE_CAPTURE flag set.
- *
- * \return 0 on success, or -1 if not supported.
- */
-extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
-
-/**
- * \brief Query whether relative mouse mode is enabled.
- *
- * \sa SDL_SetRelativeMouseMode()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
-
-/**
- * \brief Create a cursor, using the specified bitmap data and
- * mask (in MSB format).
- *
- * The cursor width must be a multiple of 8 bits.
- *
- * The cursor is created in black and white according to the following:
- * <table>
- * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
- * <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
- * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
- * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
- * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
- * if not. </td></tr>
- * </table>
- *
- * \sa SDL_FreeCursor()
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
- const Uint8 * mask,
- int w, int h, int hot_x,
- int hot_y);
-
-/**
- * \brief Create a color cursor.
- *
- * \sa SDL_FreeCursor()
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
- int hot_x,
- int hot_y);
-
-/**
- * \brief Create a system cursor.
- *
- * \sa SDL_FreeCursor()
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
-
-/**
- * \brief Set the active cursor.
- */
-extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
-
-/**
- * \brief Return the active cursor.
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
-
-/**
- * \brief Return the default cursor.
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
-
-/**
- * \brief Frees a cursor created with SDL_CreateCursor() or similar functions.
- *
- * \sa SDL_CreateCursor()
- * \sa SDL_CreateColorCursor()
- * \sa SDL_CreateSystemCursor()
- */
-extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
-
-/**
- * \brief Toggle whether or not the cursor is shown.
- *
- * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
- * state.
- *
- * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
- */
-extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
-
-/**
- * Used as a mask when testing buttons in buttonstate.
- * - Button 1: Left mouse button
- * - Button 2: Middle mouse button
- * - Button 3: Right mouse button
- */
-#define SDL_BUTTON(X) (1 << ((X)-1))
-#define SDL_BUTTON_LEFT 1
-#define SDL_BUTTON_MIDDLE 2
-#define SDL_BUTTON_RIGHT 3
-#define SDL_BUTTON_X1 4
-#define SDL_BUTTON_X2 5
-#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
-#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
-#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
-#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
-#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_mouse_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mutex.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mutex.h
deleted file mode 100644
index 0272379..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_mutex.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_mutex_h_
-#define SDL_mutex_h_
-
-/**
- * \file SDL_mutex.h
- *
- * Functions to provide thread synchronization primitives.
- */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Synchronization functions which can time out return this value
- * if they time out.
- */
-#define SDL_MUTEX_TIMEDOUT 1
-
-/**
- * This is the timeout value which corresponds to never time out.
- */
-#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
-
-
-/**
- * \name Mutex functions
- */
-/* @{ */
-
-/* The SDL mutex structure, defined in SDL_sysmutex.c */
-struct SDL_mutex;
-typedef struct SDL_mutex SDL_mutex;
-
-/**
- * Create a mutex, initialized unlocked.
- */
-extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
-
-/**
- * Lock the mutex.
- *
- * \return 0, or -1 on error.
- */
-#define SDL_mutexP(m) SDL_LockMutex(m)
-extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
-
-/**
- * Try to lock the mutex
- *
- * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
-
-/**
- * Unlock the mutex.
- *
- * \return 0, or -1 on error.
- *
- * \warning It is an error to unlock a mutex that has not been locked by
- * the current thread, and doing so results in undefined behavior.
- */
-#define SDL_mutexV(m) SDL_UnlockMutex(m)
-extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
-
-/**
- * Destroy a mutex.
- */
-extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
-
-/* @} *//* Mutex functions */
-
-
-/**
- * \name Semaphore functions
- */
-/* @{ */
-
-/* The SDL semaphore structure, defined in SDL_syssem.c */
-struct SDL_semaphore;
-typedef struct SDL_semaphore SDL_sem;
-
-/**
- * Create a semaphore, initialized with value, returns NULL on failure.
- */
-extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
-
-/**
- * Destroy a semaphore.
- */
-extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
-
-/**
- * This function suspends the calling thread until the semaphore pointed
- * to by \c sem has a positive count. It then atomically decreases the
- * semaphore count.
- */
-extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
-
-/**
- * Non-blocking variant of SDL_SemWait().
- *
- * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
- * block, and -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
-
-/**
- * Variant of SDL_SemWait() with a timeout in milliseconds.
- *
- * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
- * succeed in the allotted time, and -1 on error.
- *
- * \warning On some platforms this function is implemented by looping with a
- * delay of 1 ms, and so should be avoided if possible.
- */
-extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
-
-/**
- * Atomically increases the semaphore's count (not blocking).
- *
- * \return 0, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
-
-/**
- * Returns the current count of the semaphore.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
-
-/* @} *//* Semaphore functions */
-
-
-/**
- * \name Condition variable functions
- */
-/* @{ */
-
-/* The SDL condition variable structure, defined in SDL_syscond.c */
-struct SDL_cond;
-typedef struct SDL_cond SDL_cond;
-
-/**
- * Create a condition variable.
- *
- * Typical use of condition variables:
- *
- * Thread A:
- * SDL_LockMutex(lock);
- * while ( ! condition ) {
- * SDL_CondWait(cond, lock);
- * }
- * SDL_UnlockMutex(lock);
- *
- * Thread B:
- * SDL_LockMutex(lock);
- * ...
- * condition = true;
- * ...
- * SDL_CondSignal(cond);
- * SDL_UnlockMutex(lock);
- *
- * There is some discussion whether to signal the condition variable
- * with the mutex locked or not. There is some potential performance
- * benefit to unlocking first on some platforms, but there are some
- * potential race conditions depending on how your code is structured.
- *
- * In general it's safer to signal the condition variable while the
- * mutex is locked.
- */
-extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
-
-/**
- * Destroy a condition variable.
- */
-extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
-
-/**
- * Restart one of the threads that are waiting on the condition variable.
- *
- * \return 0 or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
-
-/**
- * Restart all threads that are waiting on the condition variable.
- *
- * \return 0 or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
-
-/**
- * Wait on the condition variable, unlocking the provided mutex.
- *
- * \warning The mutex must be locked before entering this function!
- *
- * The mutex is re-locked once the condition variable is signaled.
- *
- * \return 0 when it is signaled, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
-
-/**
- * Waits for at most \c ms milliseconds, and returns 0 if the condition
- * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
- * signaled in the allotted time, and -1 on error.
- *
- * \warning On some platforms this function is implemented by looping with a
- * delay of 1 ms, and so should be avoided if possible.
- */
-extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
- SDL_mutex * mutex, Uint32 ms);
-
-/* @} *//* Condition variable functions */
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_mutex_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_name.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_name.h
deleted file mode 100644
index 8095ed3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_name.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDLname_h_
-#define SDLname_h_
-
-#if defined(__STDC__) || defined(__cplusplus)
-#define NeedFunctionPrototypes 1
-#endif
-
-#define SDL_NAME(X) SDL_##X
-
-#endif /* SDLname_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl.h
deleted file mode 100644
index 314dd57..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl.h
+++ /dev/null
@@ -1,2183 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_opengl.h
- *
- * This is a simple file to encapsulate the OpenGL API headers.
- */
-
-/**
- * \def NO_SDL_GLEXT
- *
- * Define this if you have your own version of glext.h and want to disable the
- * version included in SDL_opengl.h.
- */
-
-#ifndef SDL_opengl_h_
-#define SDL_opengl_h_
-
-#include "SDL_config.h"
-
-#ifndef __IPHONEOS__ /* No OpenGL on iOS. */
-
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef __gl_h_
-#define __gl_h_
-
-#if defined(USE_MGL_NAMESPACE)
-#include "gl_mangle.h"
-#endif
-
-
-/**********************************************************************
- * Begin system-specific stuff.
- */
-
-#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
-#define __WIN32__
-#endif
-
-#if defined(__WIN32__) && !defined(__CYGWIN__)
-# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
-# define GLAPI __declspec(dllexport)
-# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
-# define GLAPI __declspec(dllimport)
-# else /* for use with static link lib build of Win32 edition only */
-# define GLAPI extern
-# endif /* _STATIC_MESA support */
-# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
-# define GLAPIENTRY
-# else
-# define GLAPIENTRY __stdcall
-# endif
-#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
-# define GLAPI extern
-# define GLAPIENTRY __stdcall
-#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
-# define GLAPI extern
-# define GLAPIENTRY _System
-# define APIENTRY _System
-# if defined(__GNUC__) && !defined(_System)
-# define _System
-# endif
-#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-# define GLAPI __attribute__((visibility("default")))
-# define GLAPIENTRY
-#endif /* WIN32 && !CYGWIN */
-
-/*
- * WINDOWS: Include windows.h here to define APIENTRY.
- * It is also useful when applications include this file by
- * including only glut.h, since glut.h depends on windows.h.
- * Applications needing to include windows.h with parms other
- * than "WIN32_LEAN_AND_MEAN" may include windows.h before
- * glut.h or gl.h.
- */
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#ifndef NOMINMAX /* don't define min() and max(). */
-#define NOMINMAX
-#endif
-#include <windows.h>
-#endif
-
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-#ifndef GLAPIENTRY
-#define GLAPIENTRY
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY GLAPIENTRY
-#endif
-
-/* "P" suffix to be used for a pointer to a function */
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-
-#ifndef GLAPIENTRYP
-#define GLAPIENTRYP GLAPIENTRY *
-#endif
-
-#if defined(PRAGMA_EXPORT_SUPPORTED)
-#pragma export on
-#endif
-
-/*
- * End system-specific stuff.
- **********************************************************************/
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-#define GL_VERSION_1_1 1
-#define GL_VERSION_1_2 1
-#define GL_VERSION_1_3 1
-#define GL_ARB_imaging 1
-
-
-/*
- * Datatypes
- */
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef void GLvoid;
-typedef signed char GLbyte; /* 1-byte signed */
-typedef short GLshort; /* 2-byte signed */
-typedef int GLint; /* 4-byte signed */
-typedef unsigned char GLubyte; /* 1-byte unsigned */
-typedef unsigned short GLushort; /* 2-byte unsigned */
-typedef unsigned int GLuint; /* 4-byte unsigned */
-typedef int GLsizei; /* 4-byte signed */
-typedef float GLfloat; /* single precision float */
-typedef float GLclampf; /* single precision float in [0,1] */
-typedef double GLdouble; /* double precision float */
-typedef double GLclampd; /* double precision float in [0,1] */
-
-
-
-/*
- * Constants
- */
-
-/* Boolean values */
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/* Data types */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_2_BYTES 0x1407
-#define GL_3_BYTES 0x1408
-#define GL_4_BYTES 0x1409
-#define GL_DOUBLE 0x140A
-
-/* Primitives */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_QUADS 0x0007
-#define GL_QUAD_STRIP 0x0008
-#define GL_POLYGON 0x0009
-
-/* Vertex Arrays */
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_INDEX_ARRAY 0x8077
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_EDGE_FLAG_ARRAY 0x8079
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_INDEX_ARRAY_TYPE 0x8085
-#define GL_INDEX_ARRAY_STRIDE 0x8086
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_INDEX_ARRAY_POINTER 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
-#define GL_V2F 0x2A20
-#define GL_V3F 0x2A21
-#define GL_C4UB_V2F 0x2A22
-#define GL_C4UB_V3F 0x2A23
-#define GL_C3F_V3F 0x2A24
-#define GL_N3F_V3F 0x2A25
-#define GL_C4F_N3F_V3F 0x2A26
-#define GL_T2F_V3F 0x2A27
-#define GL_T4F_V4F 0x2A28
-#define GL_T2F_C4UB_V3F 0x2A29
-#define GL_T2F_C3F_V3F 0x2A2A
-#define GL_T2F_N3F_V3F 0x2A2B
-#define GL_T2F_C4F_N3F_V3F 0x2A2C
-#define GL_T4F_C4F_N3F_V4F 0x2A2D
-
-/* Matrix Mode */
-#define GL_MATRIX_MODE 0x0BA0
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-
-/* Points */
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_POINT_SIZE_RANGE 0x0B12
-
-/* Lines */
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_LINE_STIPPLE 0x0B24
-#define GL_LINE_STIPPLE_PATTERN 0x0B25
-#define GL_LINE_STIPPLE_REPEAT 0x0B26
-#define GL_LINE_WIDTH 0x0B21
-#define GL_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_LINE_WIDTH_RANGE 0x0B22
-
-/* Polygons */
-#define GL_POINT 0x1B00
-#define GL_LINE 0x1B01
-#define GL_FILL 0x1B02
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_POLYGON_MODE 0x0B40
-#define GL_POLYGON_SMOOTH 0x0B41
-#define GL_POLYGON_STIPPLE 0x0B42
-#define GL_EDGE_FLAG 0x0B43
-#define GL_CULL_FACE 0x0B44
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_POINT 0x2A01
-#define GL_POLYGON_OFFSET_LINE 0x2A02
-#define GL_POLYGON_OFFSET_FILL 0x8037
-
-/* Display Lists */
-#define GL_COMPILE 0x1300
-#define GL_COMPILE_AND_EXECUTE 0x1301
-#define GL_LIST_BASE 0x0B32
-#define GL_LIST_INDEX 0x0B33
-#define GL_LIST_MODE 0x0B30
-
-/* Depth buffer */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_DEPTH_TEST 0x0B71
-#define GL_DEPTH_BITS 0x0D56
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_COMPONENT 0x1902
-
-/* Lighting */
-#define GL_LIGHTING 0x0B50
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_SHININESS 0x1601
-#define GL_EMISSION 0x1600
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-#define GL_COLOR_INDEXES 0x1603
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_SHADE_MODEL 0x0B54
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_COLOR_MATERIAL_FACE 0x0B55
-#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
-#define GL_NORMALIZE 0x0BA1
-
-/* User clipping planes */
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-
-/* Accumulation buffer */
-#define GL_ACCUM_RED_BITS 0x0D58
-#define GL_ACCUM_GREEN_BITS 0x0D59
-#define GL_ACCUM_BLUE_BITS 0x0D5A
-#define GL_ACCUM_ALPHA_BITS 0x0D5B
-#define GL_ACCUM_CLEAR_VALUE 0x0B80
-#define GL_ACCUM 0x0100
-#define GL_ADD 0x0104
-#define GL_LOAD 0x0101
-#define GL_MULT 0x0103
-#define GL_RETURN 0x0102
-
-/* Alpha testing */
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_ALPHA_TEST_FUNC 0x0BC1
-
-/* Blending */
-#define GL_BLEND 0x0BE2
-#define GL_BLEND_SRC 0x0BE1
-#define GL_BLEND_DST 0x0BE0
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-
-/* Render Mode */
-#define GL_FEEDBACK 0x1C01
-#define GL_RENDER 0x1C00
-#define GL_SELECT 0x1C02
-
-/* Feedback */
-#define GL_2D 0x0600
-#define GL_3D 0x0601
-#define GL_3D_COLOR 0x0602
-#define GL_3D_COLOR_TEXTURE 0x0603
-#define GL_4D_COLOR_TEXTURE 0x0604
-#define GL_POINT_TOKEN 0x0701
-#define GL_LINE_TOKEN 0x0702
-#define GL_LINE_RESET_TOKEN 0x0707
-#define GL_POLYGON_TOKEN 0x0703
-#define GL_BITMAP_TOKEN 0x0704
-#define GL_DRAW_PIXEL_TOKEN 0x0705
-#define GL_COPY_PIXEL_TOKEN 0x0706
-#define GL_PASS_THROUGH_TOKEN 0x0700
-#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
-#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
-#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
-
-/* Selection */
-#define GL_SELECTION_BUFFER_POINTER 0x0DF3
-#define GL_SELECTION_BUFFER_SIZE 0x0DF4
-
-/* Fog */
-#define GL_FOG 0x0B60
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_COLOR 0x0B66
-#define GL_FOG_INDEX 0x0B61
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_LINEAR 0x2601
-#define GL_EXP 0x0800
-#define GL_EXP2 0x0801
-
-/* Logic Ops */
-#define GL_LOGIC_OP 0x0BF1
-#define GL_INDEX_LOGIC_OP 0x0BF1
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_CLEAR 0x1500
-#define GL_SET 0x150F
-#define GL_COPY 0x1503
-#define GL_COPY_INVERTED 0x150C
-#define GL_NOOP 0x1505
-#define GL_INVERT 0x150A
-#define GL_AND 0x1501
-#define GL_NAND 0x150E
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_XOR 0x1506
-#define GL_EQUIV 0x1509
-#define GL_AND_REVERSE 0x1502
-#define GL_AND_INVERTED 0x1504
-#define GL_OR_REVERSE 0x150B
-#define GL_OR_INVERTED 0x150D
-
-/* Stencil */
-#define GL_STENCIL_BITS 0x0D57
-#define GL_STENCIL_TEST 0x0B90
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_INDEX 0x1901
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-
-/* Buffers, Pixel Drawing/Reading */
-#define GL_NONE 0
-#define GL_LEFT 0x0406
-#define GL_RIGHT 0x0407
-/*GL_FRONT 0x0404 */
-/*GL_BACK 0x0405 */
-/*GL_FRONT_AND_BACK 0x0408 */
-#define GL_FRONT_LEFT 0x0400
-#define GL_FRONT_RIGHT 0x0401
-#define GL_BACK_LEFT 0x0402
-#define GL_BACK_RIGHT 0x0403
-#define GL_AUX0 0x0409
-#define GL_AUX1 0x040A
-#define GL_AUX2 0x040B
-#define GL_AUX3 0x040C
-#define GL_COLOR_INDEX 0x1900
-#define GL_RED 0x1903
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_ALPHA 0x1906
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-#define GL_ALPHA_BITS 0x0D55
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_INDEX_BITS 0x0D51
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_AUX_BUFFERS 0x0C00
-#define GL_READ_BUFFER 0x0C02
-#define GL_DRAW_BUFFER 0x0C01
-#define GL_DOUBLEBUFFER 0x0C32
-#define GL_STEREO 0x0C33
-#define GL_BITMAP 0x1A00
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_DITHER 0x0BD0
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-
-/* Implementation limits */
-#define GL_MAX_LIST_NESTING 0x0B31
-#define GL_MAX_EVAL_ORDER 0x0D30
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
-#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_NAME_STACK_DEPTH 0x0D37
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
-
-/* Gets */
-#define GL_ATTRIB_STACK_DEPTH 0x0BB0
-#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_CURRENT_INDEX 0x0B01
-#define GL_CURRENT_COLOR 0x0B00
-#define GL_CURRENT_NORMAL 0x0B02
-#define GL_CURRENT_RASTER_COLOR 0x0B04
-#define GL_CURRENT_RASTER_DISTANCE 0x0B09
-#define GL_CURRENT_RASTER_INDEX 0x0B05
-#define GL_CURRENT_RASTER_POSITION 0x0B07
-#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
-#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
-#define GL_CURRENT_TEXTURE_COORDS 0x0B03
-#define GL_INDEX_CLEAR_VALUE 0x0C20
-#define GL_INDEX_MODE 0x0C30
-#define GL_INDEX_WRITEMASK 0x0C21
-#define GL_MODELVIEW_MATRIX 0x0BA6
-#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
-#define GL_NAME_STACK_DEPTH 0x0D70
-#define GL_PROJECTION_MATRIX 0x0BA7
-#define GL_PROJECTION_STACK_DEPTH 0x0BA4
-#define GL_RENDER_MODE 0x0C40
-#define GL_RGBA_MODE 0x0C31
-#define GL_TEXTURE_MATRIX 0x0BA8
-#define GL_TEXTURE_STACK_DEPTH 0x0BA5
-#define GL_VIEWPORT 0x0BA2
-
-/* Evaluators */
-#define GL_AUTO_NORMAL 0x0D80
-#define GL_MAP1_COLOR_4 0x0D90
-#define GL_MAP1_INDEX 0x0D91
-#define GL_MAP1_NORMAL 0x0D92
-#define GL_MAP1_TEXTURE_COORD_1 0x0D93
-#define GL_MAP1_TEXTURE_COORD_2 0x0D94
-#define GL_MAP1_TEXTURE_COORD_3 0x0D95
-#define GL_MAP1_TEXTURE_COORD_4 0x0D96
-#define GL_MAP1_VERTEX_3 0x0D97
-#define GL_MAP1_VERTEX_4 0x0D98
-#define GL_MAP2_COLOR_4 0x0DB0
-#define GL_MAP2_INDEX 0x0DB1
-#define GL_MAP2_NORMAL 0x0DB2
-#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
-#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
-#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
-#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
-#define GL_MAP2_VERTEX_3 0x0DB7
-#define GL_MAP2_VERTEX_4 0x0DB8
-#define GL_MAP1_GRID_DOMAIN 0x0DD0
-#define GL_MAP1_GRID_SEGMENTS 0x0DD1
-#define GL_MAP2_GRID_DOMAIN 0x0DD2
-#define GL_MAP2_GRID_SEGMENTS 0x0DD3
-#define GL_COEFF 0x0A00
-#define GL_ORDER 0x0A01
-#define GL_DOMAIN 0x0A02
-
-/* Hints */
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_POLYGON_SMOOTH_HINT 0x0C53
-#define GL_FOG_HINT 0x0C54
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* Scissor box */
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-
-/* Pixel Mode / Transfer */
-#define GL_MAP_COLOR 0x0D10
-#define GL_MAP_STENCIL 0x0D11
-#define GL_INDEX_SHIFT 0x0D12
-#define GL_INDEX_OFFSET 0x0D13
-#define GL_RED_SCALE 0x0D14
-#define GL_RED_BIAS 0x0D15
-#define GL_GREEN_SCALE 0x0D18
-#define GL_GREEN_BIAS 0x0D19
-#define GL_BLUE_SCALE 0x0D1A
-#define GL_BLUE_BIAS 0x0D1B
-#define GL_ALPHA_SCALE 0x0D1C
-#define GL_ALPHA_BIAS 0x0D1D
-#define GL_DEPTH_SCALE 0x0D1E
-#define GL_DEPTH_BIAS 0x0D1F
-#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
-#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
-#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
-#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
-#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
-#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
-#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
-#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
-#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
-#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
-#define GL_PIXEL_MAP_S_TO_S 0x0C71
-#define GL_PIXEL_MAP_I_TO_I 0x0C70
-#define GL_PIXEL_MAP_I_TO_R 0x0C72
-#define GL_PIXEL_MAP_I_TO_G 0x0C73
-#define GL_PIXEL_MAP_I_TO_B 0x0C74
-#define GL_PIXEL_MAP_I_TO_A 0x0C75
-#define GL_PIXEL_MAP_R_TO_R 0x0C76
-#define GL_PIXEL_MAP_G_TO_G 0x0C77
-#define GL_PIXEL_MAP_B_TO_B 0x0C78
-#define GL_PIXEL_MAP_A_TO_A 0x0C79
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_PACK_LSB_FIRST 0x0D01
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SWAP_BYTES 0x0D00
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_UNPACK_LSB_FIRST 0x0CF1
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SWAP_BYTES 0x0CF0
-#define GL_ZOOM_X 0x0D16
-#define GL_ZOOM_Y 0x0D17
-
-/* Texture mapping */
-#define GL_TEXTURE_ENV 0x2300
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_ENV_COLOR 0x2201
-#define GL_TEXTURE_GEN_S 0x0C60
-#define GL_TEXTURE_GEN_T 0x0C61
-#define GL_TEXTURE_GEN_R 0x0C62
-#define GL_TEXTURE_GEN_Q 0x0C63
-#define GL_TEXTURE_GEN_MODE 0x2500
-#define GL_TEXTURE_BORDER_COLOR 0x1004
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_BORDER 0x1005
-#define GL_TEXTURE_COMPONENTS 0x1003
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE 0x8061
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_OBJECT_LINEAR 0x2401
-#define GL_OBJECT_PLANE 0x2501
-#define GL_EYE_LINEAR 0x2400
-#define GL_EYE_PLANE 0x2502
-#define GL_SPHERE_MAP 0x2402
-#define GL_DECAL 0x2101
-#define GL_MODULATE 0x2100
-#define GL_NEAREST 0x2600
-#define GL_REPEAT 0x2901
-#define GL_CLAMP 0x2900
-#define GL_S 0x2000
-#define GL_T 0x2001
-#define GL_R 0x2002
-#define GL_Q 0x2003
-
-/* Utility */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* Errors */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* glPush/PopAttrib bits */
-#define GL_CURRENT_BIT 0x00000001
-#define GL_POINT_BIT 0x00000002
-#define GL_LINE_BIT 0x00000004
-#define GL_POLYGON_BIT 0x00000008
-#define GL_POLYGON_STIPPLE_BIT 0x00000010
-#define GL_PIXEL_MODE_BIT 0x00000020
-#define GL_LIGHTING_BIT 0x00000040
-#define GL_FOG_BIT 0x00000080
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_ACCUM_BUFFER_BIT 0x00000200
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_VIEWPORT_BIT 0x00000800
-#define GL_TRANSFORM_BIT 0x00001000
-#define GL_ENABLE_BIT 0x00002000
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_HINT_BIT 0x00008000
-#define GL_EVAL_BIT 0x00010000
-#define GL_LIST_BIT 0x00020000
-#define GL_TEXTURE_BIT 0x00040000
-#define GL_SCISSOR_BIT 0x00080000
-#define GL_ALL_ATTRIB_BITS 0x000FFFFF
-
-
-/* OpenGL 1.1 */
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
-#define GL_TEXTURE_PRIORITY 0x8066
-#define GL_TEXTURE_RESIDENT 0x8067
-#define GL_TEXTURE_BINDING_1D 0x8068
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
-#define GL_ALPHA4 0x803B
-#define GL_ALPHA8 0x803C
-#define GL_ALPHA12 0x803D
-#define GL_ALPHA16 0x803E
-#define GL_LUMINANCE4 0x803F
-#define GL_LUMINANCE8 0x8040
-#define GL_LUMINANCE12 0x8041
-#define GL_LUMINANCE16 0x8042
-#define GL_LUMINANCE4_ALPHA4 0x8043
-#define GL_LUMINANCE6_ALPHA2 0x8044
-#define GL_LUMINANCE8_ALPHA8 0x8045
-#define GL_LUMINANCE12_ALPHA4 0x8046
-#define GL_LUMINANCE12_ALPHA12 0x8047
-#define GL_LUMINANCE16_ALPHA16 0x8048
-#define GL_INTENSITY 0x8049
-#define GL_INTENSITY4 0x804A
-#define GL_INTENSITY8 0x804B
-#define GL_INTENSITY12 0x804C
-#define GL_INTENSITY16 0x804D
-#define GL_R3_G3_B2 0x2A10
-#define GL_RGB4 0x804F
-#define GL_RGB5 0x8050
-#define GL_RGB8 0x8051
-#define GL_RGB10 0x8052
-#define GL_RGB12 0x8053
-#define GL_RGB16 0x8054
-#define GL_RGBA2 0x8055
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
-#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
-#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
-#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
-
-
-
-/*
- * Miscellaneous
- */
-
-GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
-
-GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
-
-GLAPI void GLAPIENTRY glClear( GLbitfield mask );
-
-GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
-
-GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
-
-GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
-
-GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
-
-GLAPI void GLAPIENTRY glLogicOp( GLenum opcode );
-
-GLAPI void GLAPIENTRY glCullFace( GLenum mode );
-
-GLAPI void GLAPIENTRY glFrontFace( GLenum mode );
-
-GLAPI void GLAPIENTRY glPointSize( GLfloat size );
-
-GLAPI void GLAPIENTRY glLineWidth( GLfloat width );
-
-GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern );
-
-GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode );
-
-GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
-
-GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask );
-
-GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask );
-
-GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
-
-GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
-
-GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
-
-GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
-
-GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation );
-
-GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode );
-
-GLAPI void GLAPIENTRY glReadBuffer( GLenum mode );
-
-GLAPI void GLAPIENTRY glEnable( GLenum cap );
-
-GLAPI void GLAPIENTRY glDisable( GLenum cap );
-
-GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap );
-
-
-GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */
-
-
-GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params );
-
-GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params );
-
-GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask );
-
-GLAPI void GLAPIENTRY glPopAttrib( void );
-
-
-GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */
-
-
-GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode );
-
-GLAPI GLenum GLAPIENTRY glGetError( void );
-
-GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name );
-
-GLAPI void GLAPIENTRY glFinish( void );
-
-GLAPI void GLAPIENTRY glFlush( void );
-
-GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode );
-
-
-/*
- * Depth Buffer
- */
-
-GLAPI void GLAPIENTRY glClearDepth( GLclampd depth );
-
-GLAPI void GLAPIENTRY glDepthFunc( GLenum func );
-
-GLAPI void GLAPIENTRY glDepthMask( GLboolean flag );
-
-GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
-
-
-/*
- * Accumulation Buffer
- */
-
-GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
-
-GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
-
-
-/*
- * Transformation
- */
-
-GLAPI void GLAPIENTRY glMatrixMode( GLenum mode );
-
-GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble near_val, GLdouble far_val );
-
-GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble near_val, GLdouble far_val );
-
-GLAPI void GLAPIENTRY glViewport( GLint x, GLint y,
- GLsizei width, GLsizei height );
-
-GLAPI void GLAPIENTRY glPushMatrix( void );
-
-GLAPI void GLAPIENTRY glPopMatrix( void );
-
-GLAPI void GLAPIENTRY glLoadIdentity( void );
-
-GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m );
-GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m );
-
-GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m );
-GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m );
-
-GLAPI void GLAPIENTRY glRotated( GLdouble angle,
- GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glRotatef( GLfloat angle,
- GLfloat x, GLfloat y, GLfloat z );
-
-GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
-
-GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z );
-
-
-/*
- * Display Lists
- */
-
-GLAPI GLboolean GLAPIENTRY glIsList( GLuint list );
-
-GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range );
-
-GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range );
-
-GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode );
-
-GLAPI void GLAPIENTRY glEndList( void );
-
-GLAPI void GLAPIENTRY glCallList( GLuint list );
-
-GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type,
- const GLvoid *lists );
-
-GLAPI void GLAPIENTRY glListBase( GLuint base );
-
-
-/*
- * Drawing Functions
- */
-
-GLAPI void GLAPIENTRY glBegin( GLenum mode );
-
-GLAPI void GLAPIENTRY glEnd( void );
-
-
-GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y );
-GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y );
-GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y );
-GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y );
-
-GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z );
-GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z );
-GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z );
-
-GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w );
-GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
-
-GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glVertex2iv( const GLint *v );
-GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glVertex3iv( const GLint *v );
-GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glVertex4iv( const GLint *v );
-GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
-GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
-GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
-GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz );
-GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz );
-
-GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
-GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glNormal3iv( const GLint *v );
-GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glIndexd( GLdouble c );
-GLAPI void GLAPIENTRY glIndexf( GLfloat c );
-GLAPI void GLAPIENTRY glIndexi( GLint c );
-GLAPI void GLAPIENTRY glIndexs( GLshort c );
-GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c );
-GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c );
-GLAPI void GLAPIENTRY glIndexiv( const GLint *c );
-GLAPI void GLAPIENTRY glIndexsv( const GLshort *c );
-GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue );
-GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue );
-GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue );
-GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue );
-GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue );
-GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
-GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue );
-GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue );
-
-GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green,
- GLbyte blue, GLbyte alpha );
-GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green,
- GLdouble blue, GLdouble alpha );
-GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green,
- GLfloat blue, GLfloat alpha );
-GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green,
- GLint blue, GLint alpha );
-GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green,
- GLshort blue, GLshort alpha );
-GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha );
-GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green,
- GLuint blue, GLuint alpha );
-GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green,
- GLushort blue, GLushort alpha );
-
-
-GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v );
-GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glColor3iv( const GLint *v );
-GLAPI void GLAPIENTRY glColor3sv( const GLshort *v );
-GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v );
-GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v );
-GLAPI void GLAPIENTRY glColor3usv( const GLushort *v );
-
-GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v );
-GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glColor4iv( const GLint *v );
-GLAPI void GLAPIENTRY glColor4sv( const GLshort *v );
-GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v );
-GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v );
-GLAPI void GLAPIENTRY glColor4usv( const GLushort *v );
-
-
-GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s );
-GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s );
-GLAPI void GLAPIENTRY glTexCoord1i( GLint s );
-GLAPI void GLAPIENTRY glTexCoord1s( GLshort s );
-
-GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t );
-GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t );
-GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t );
-GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t );
-
-GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
-GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
-GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r );
-GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r );
-
-GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
-GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q );
-GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
-
-GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y );
-GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y );
-GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y );
-GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y );
-
-GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
-GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z );
-GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z );
-
-GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w );
-GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
-
-GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v );
-GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v );
-GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v );
-GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
-GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
-GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
-GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
-
-
-GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 );
-GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 );
-GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 );
-GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 );
-
-
-/*
- * Vertex Arrays (1.1)
- */
-
-GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride,
- const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride,
- const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params );
-
-GLAPI void GLAPIENTRY glArrayElement( GLint i );
-
-GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
-
-GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count,
- GLenum type, const GLvoid *indices );
-
-GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride,
- const GLvoid *pointer );
-
-/*
- * Lighting
- */
-
-GLAPI void GLAPIENTRY glShadeModel( GLenum mode );
-
-GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param );
-GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname,
- const GLfloat *params );
-GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname,
- const GLint *params );
-
-GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname,
- GLfloat *params );
-GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param );
-GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param );
-GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params );
-
-GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode );
-
-
-/*
- * Raster functions
- */
-
-GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor );
-
-GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize,
- const GLfloat *values );
-GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize,
- const GLuint *values );
-GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize,
- const GLushort *values );
-
-GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values );
-GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values );
-GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values );
-
-GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height,
- GLfloat xorig, GLfloat yorig,
- GLfloat xmove, GLfloat ymove,
- const GLubyte *bitmap );
-
-GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum type );
-
-/*
- * Stenciling
- */
-
-GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask );
-
-GLAPI void GLAPIENTRY glStencilMask( GLuint mask );
-
-GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
-
-GLAPI void GLAPIENTRY glClearStencil( GLint s );
-
-
-
-/*
- * Texture mapping
- */
-
-GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param );
-GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params );
-GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
-GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname,
- const GLfloat *params );
-GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname,
- const GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target,
- GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target,
- GLenum pname, GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level,
- GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level,
- GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level,
- GLenum format, GLenum type,
- GLvoid *pixels );
-
-
-/* 1.1 functions */
-
-GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures );
-
-GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures);
-
-GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture );
-
-GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n,
- const GLuint *textures,
- const GLclampf *priorities );
-
-GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n,
- const GLuint *textures,
- GLboolean *residences );
-
-GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture );
-
-
-GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level,
- GLint xoffset,
- GLsizei width, GLenum format,
- GLenum type, const GLvoid *pixels );
-
-
-GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-
-GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y,
- GLsizei width, GLint border );
-
-
-GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLint border );
-
-
-GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y,
- GLsizei width );
-
-
-GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
-
-
-/*
- * Evaluators
- */
-
-GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2,
- GLint stride,
- GLint order, const GLdouble *points );
-GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2,
- GLint stride,
- GLint order, const GLfloat *points );
-
-GLAPI void GLAPIENTRY glMap2d( GLenum target,
- GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
- GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
- const GLdouble *points );
-GLAPI void GLAPIENTRY glMap2f( GLenum target,
- GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
- GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
- const GLfloat *points );
-
-GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v );
-GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v );
-GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v );
-
-GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u );
-GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u );
-
-GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u );
-GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u );
-
-GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v );
-GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v );
-
-GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u );
-GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u );
-
-GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
-GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
-
-GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2,
- GLint vn, GLdouble v1, GLdouble v2 );
-GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2,
- GLint vn, GLfloat v1, GLfloat v2 );
-
-GLAPI void GLAPIENTRY glEvalPoint1( GLint i );
-
-GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j );
-
-GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 );
-
-GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
-
-
-/*
- * Fog
- */
-
-GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param );
-
-GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params );
-
-GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params );
-
-
-/*
- * Selection and Feedback
- */
-
-GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
-
-GLAPI void GLAPIENTRY glPassThrough( GLfloat token );
-
-GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer );
-
-GLAPI void GLAPIENTRY glInitNames( void );
-
-GLAPI void GLAPIENTRY glLoadName( GLuint name );
-
-GLAPI void GLAPIENTRY glPushName( GLuint name );
-
-GLAPI void GLAPIENTRY glPopName( void );
-
-
-
-/*
- * OpenGL 1.2
- */
-
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_INT_8_8_8_8 0x8035
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_PACK_SKIP_IMAGES 0x806B
-#define GL_PACK_IMAGE_HEIGHT 0x806C
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_PROXY_TEXTURE_3D 0x8070
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_TEXTURE_BINDING_3D 0x806A
-
-GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start,
- GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
-
-GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLsizei height,
- GLsizei depth, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth,
- GLenum format,
- GLenum type, const GLvoid *pixels);
-
-GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint zoffset, GLint x,
- GLint y, GLsizei width,
- GLsizei height );
-
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-
-
-/*
- * GL_ARB_imaging
- */
-
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_COLOR_TABLE 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
-#define GL_PROXY_COLOR_TABLE 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
-#define GL_COLOR_TABLE_SCALE 0x80D6
-#define GL_COLOR_TABLE_BIAS 0x80D7
-#define GL_COLOR_TABLE_FORMAT 0x80D8
-#define GL_COLOR_TABLE_WIDTH 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
-#define GL_CONVOLUTION_1D 0x8010
-#define GL_CONVOLUTION_2D 0x8011
-#define GL_SEPARABLE_2D 0x8012
-#define GL_CONVOLUTION_BORDER_MODE 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS 0x8015
-#define GL_REDUCE 0x8016
-#define GL_CONVOLUTION_FORMAT 0x8017
-#define GL_CONVOLUTION_WIDTH 0x8018
-#define GL_CONVOLUTION_HEIGHT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
-#define GL_CONSTANT_BORDER 0x8151
-#define GL_REPLICATE_BORDER 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR 0x8154
-#define GL_COLOR_MATRIX 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
-#define GL_HISTOGRAM 0x8024
-#define GL_PROXY_HISTOGRAM 0x8025
-#define GL_HISTOGRAM_WIDTH 0x8026
-#define GL_HISTOGRAM_FORMAT 0x8027
-#define GL_HISTOGRAM_RED_SIZE 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
-#define GL_HISTOGRAM_SINK 0x802D
-#define GL_MINMAX 0x802E
-#define GL_MINMAX_FORMAT 0x802F
-#define GL_MINMAX_SINK 0x8030
-#define GL_TABLE_TOO_LARGE 0x8031
-#define GL_BLEND_EQUATION 0x8009
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_FUNC_ADD 0x8006
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_BLEND_COLOR 0x8005
-
-
-GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
- GLsizei width, GLenum format,
- GLenum type, const GLvoid *table );
-
-GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
- GLsizei start, GLsizei count,
- GLenum format, GLenum type,
- const GLvoid *data );
-
-GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
- const GLint *params);
-
-GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
- const GLfloat *params);
-
-GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
- GLint x, GLint y, GLsizei width );
-
-GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
- GLint x, GLint y, GLsizei width );
-
-GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
- GLenum type, GLvoid *table );
-
-GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
-
-GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
- GLclampf blue, GLclampf alpha );
-
-GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
- GLenum internalformat, GLboolean sink );
-
-GLAPI void GLAPIENTRY glResetHistogram( GLenum target );
-
-GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
- GLenum format, GLenum type,
- GLvoid *values );
-
-GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
- GLboolean sink );
-
-GLAPI void GLAPIENTRY glResetMinmax( GLenum target );
-
-GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
- GLenum format, GLenum types,
- GLvoid *values );
-
-GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
- GLenum internalformat, GLsizei width, GLenum format, GLenum type,
- const GLvoid *image );
-
-GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
- GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *image );
-
-GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
- GLfloat params );
-
-GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
- const GLfloat *params );
-
-GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
- GLint params );
-
-GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
- const GLint *params );
-
-GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
- GLenum internalformat, GLint x, GLint y, GLsizei width );
-
-GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
- GLenum internalformat, GLint x, GLint y, GLsizei width,
- GLsizei height);
-
-GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
- GLenum type, GLvoid *image );
-
-GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
- GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *row, const GLvoid *column );
-
-GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
- GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
-
-
-
-
-/*
- * OpenGL 1.3
- */
-
-/* multitexture */
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-/* texture_cube_map */
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-/* texture_compression */
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
-#define GL_COMPRESSED_RGB 0x84ED
-#define GL_COMPRESSED_RGBA 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-/* multisample */
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_MULTISAMPLE_BIT 0x20000000
-/* transpose_matrix */
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
-/* texture_env_combine */
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_SOURCE0_RGB 0x8580
-#define GL_SOURCE1_RGB 0x8581
-#define GL_SOURCE2_RGB 0x8582
-#define GL_SOURCE0_ALPHA 0x8588
-#define GL_SOURCE1_ALPHA 0x8589
-#define GL_SOURCE2_ALPHA 0x858A
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_SUBTRACT 0x84E7
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-/* texture_env_dot3 */
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-/* texture_border_clamp */
-#define GL_CLAMP_TO_BORDER 0x812D
-
-GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
-
-GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
-
-GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
-
-GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
-
-GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
-
-GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
-
-GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
-
-
-typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
-
-
-
-/*
- * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
- */
-#ifndef GL_ARB_multitexture
-#define GL_ARB_multitexture 1
-
-#define GL_TEXTURE0_ARB 0x84C0
-#define GL_TEXTURE1_ARB 0x84C1
-#define GL_TEXTURE2_ARB 0x84C2
-#define GL_TEXTURE3_ARB 0x84C3
-#define GL_TEXTURE4_ARB 0x84C4
-#define GL_TEXTURE5_ARB 0x84C5
-#define GL_TEXTURE6_ARB 0x84C6
-#define GL_TEXTURE7_ARB 0x84C7
-#define GL_TEXTURE8_ARB 0x84C8
-#define GL_TEXTURE9_ARB 0x84C9
-#define GL_TEXTURE10_ARB 0x84CA
-#define GL_TEXTURE11_ARB 0x84CB
-#define GL_TEXTURE12_ARB 0x84CC
-#define GL_TEXTURE13_ARB 0x84CD
-#define GL_TEXTURE14_ARB 0x84CE
-#define GL_TEXTURE15_ARB 0x84CF
-#define GL_TEXTURE16_ARB 0x84D0
-#define GL_TEXTURE17_ARB 0x84D1
-#define GL_TEXTURE18_ARB 0x84D2
-#define GL_TEXTURE19_ARB 0x84D3
-#define GL_TEXTURE20_ARB 0x84D4
-#define GL_TEXTURE21_ARB 0x84D5
-#define GL_TEXTURE22_ARB 0x84D6
-#define GL_TEXTURE23_ARB 0x84D7
-#define GL_TEXTURE24_ARB 0x84D8
-#define GL_TEXTURE25_ARB 0x84D9
-#define GL_TEXTURE26_ARB 0x84DA
-#define GL_TEXTURE27_ARB 0x84DB
-#define GL_TEXTURE28_ARB 0x84DC
-#define GL_TEXTURE29_ARB 0x84DD
-#define GL_TEXTURE30_ARB 0x84DE
-#define GL_TEXTURE31_ARB 0x84DF
-#define GL_ACTIVE_TEXTURE_ARB 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
-#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
-
-GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
-GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture);
-GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s);
-GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s);
-GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s);
-GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s);
-GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
-GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
-GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
-GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
-GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
-GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
-GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
-GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
-GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
-GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
-
-typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
-
-#endif /* GL_ARB_multitexture */
-
-
-
-/*
- * Define this token if you want "old-style" header file behaviour (extensions
- * defined in gl.h). Otherwise, extensions will be included from glext.h.
- */
-#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
-#include "SDL_opengl_glext.h"
-#endif /* GL_GLEXT_LEGACY */
-
-
-
-/*
- * ???. GL_MESA_packed_depth_stencil
- * XXX obsolete
- */
-#ifndef GL_MESA_packed_depth_stencil
-#define GL_MESA_packed_depth_stencil 1
-
-#define GL_DEPTH_STENCIL_MESA 0x8750
-#define GL_UNSIGNED_INT_24_8_MESA 0x8751
-#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
-#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753
-#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
-
-#endif /* GL_MESA_packed_depth_stencil */
-
-
-#ifndef GL_ATI_blend_equation_separate
-#define GL_ATI_blend_equation_separate 1
-
-#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D
-
-GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA );
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA);
-
-#endif /* GL_ATI_blend_equation_separate */
-
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-typedef void* GLeglImageOES;
-#endif
-
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#endif
-
-
-/**
- ** NOTE!!!!! If you add new functions to this file, or update
- ** glext.h be sure to regenerate the gl_mangle.h file. See comments
- ** in that file for details.
- **/
-
-
-
-/**********************************************************************
- * Begin system-specific stuff
- */
-#if defined(PRAGMA_EXPORT_SUPPORTED)
-#pragma export off
-#endif
-
-/*
- * End system-specific stuff
- **********************************************************************/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl_h_ */
-
-#endif /* !__IPHONEOS__ */
-
-#endif /* SDL_opengl_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles.h
deleted file mode 100644
index 800c593..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_opengles.h
- *
- * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
- */
-#include "SDL_config.h"
-
-#ifdef __IPHONEOS__
-#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES1/glext.h>
-#else
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2.h
deleted file mode 100644
index 102f2f3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_opengles2.h
- *
- * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
- */
-#include "SDL_config.h"
-
-#ifndef _MSC_VER
-
-#ifdef __IPHONEOS__
-#include <OpenGLES/ES2/gl.h>
-#include <OpenGLES/ES2/glext.h>
-#else
-#include <GLES2/gl2platform.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#endif
-
-#else /* _MSC_VER */
-
-/* OpenGL ES2 headers for Visual Studio */
-#include "SDL_opengles2_khrplatform.h"
-#include "SDL_opengles2_gl2platform.h"
-#include "SDL_opengles2_gl2.h"
-#include "SDL_opengles2_gl2ext.h"
-
-#endif /* _MSC_VER */
-
-#ifndef APIENTRY
-#define APIENTRY GL_APIENTRY
-#endif
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_pixels.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_pixels.h
deleted file mode 100644
index 0424668..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_pixels.h
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_pixels.h
- *
- * Header for the enumerated pixel format definitions.
- */
-
-#ifndef SDL_pixels_h_
-#define SDL_pixels_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_endian.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name Transparency definitions
- *
- * These define alpha as the opacity of a surface.
- */
-/* @{ */
-#define SDL_ALPHA_OPAQUE 255
-#define SDL_ALPHA_TRANSPARENT 0
-/* @} */
-
-/** Pixel type. */
-enum
-{
- SDL_PIXELTYPE_UNKNOWN,
- SDL_PIXELTYPE_INDEX1,
- SDL_PIXELTYPE_INDEX4,
- SDL_PIXELTYPE_INDEX8,
- SDL_PIXELTYPE_PACKED8,
- SDL_PIXELTYPE_PACKED16,
- SDL_PIXELTYPE_PACKED32,
- SDL_PIXELTYPE_ARRAYU8,
- SDL_PIXELTYPE_ARRAYU16,
- SDL_PIXELTYPE_ARRAYU32,
- SDL_PIXELTYPE_ARRAYF16,
- SDL_PIXELTYPE_ARRAYF32
-};
-
-/** Bitmap pixel order, high bit -> low bit. */
-enum
-{
- SDL_BITMAPORDER_NONE,
- SDL_BITMAPORDER_4321,
- SDL_BITMAPORDER_1234
-};
-
-/** Packed component order, high bit -> low bit. */
-enum
-{
- SDL_PACKEDORDER_NONE,
- SDL_PACKEDORDER_XRGB,
- SDL_PACKEDORDER_RGBX,
- SDL_PACKEDORDER_ARGB,
- SDL_PACKEDORDER_RGBA,
- SDL_PACKEDORDER_XBGR,
- SDL_PACKEDORDER_BGRX,
- SDL_PACKEDORDER_ABGR,
- SDL_PACKEDORDER_BGRA
-};
-
-/** Array component order, low byte -> high byte. */
-/* !!! FIXME: in 2.1, make these not overlap differently with
- !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
-enum
-{
- SDL_ARRAYORDER_NONE,
- SDL_ARRAYORDER_RGB,
- SDL_ARRAYORDER_RGBA,
- SDL_ARRAYORDER_ARGB,
- SDL_ARRAYORDER_BGR,
- SDL_ARRAYORDER_BGRA,
- SDL_ARRAYORDER_ABGR
-};
-
-/** Packed component layout. */
-enum
-{
- SDL_PACKEDLAYOUT_NONE,
- SDL_PACKEDLAYOUT_332,
- SDL_PACKEDLAYOUT_4444,
- SDL_PACKEDLAYOUT_1555,
- SDL_PACKEDLAYOUT_5551,
- SDL_PACKEDLAYOUT_565,
- SDL_PACKEDLAYOUT_8888,
- SDL_PACKEDLAYOUT_2101010,
- SDL_PACKEDLAYOUT_1010102
-};
-
-#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
-
-#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
- ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
- ((bits) << 8) | ((bytes) << 0))
-
-#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
-#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
-#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
-#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
-#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
-#define SDL_BYTESPERPIXEL(X) \
- (SDL_ISPIXELFORMAT_FOURCC(X) ? \
- ((((X) == SDL_PIXELFORMAT_YUY2) || \
- ((X) == SDL_PIXELFORMAT_UYVY) || \
- ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
-
-#define SDL_ISPIXELFORMAT_INDEXED(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
-
-#define SDL_ISPIXELFORMAT_PACKED(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
-
-#define SDL_ISPIXELFORMAT_ARRAY(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
-
-#define SDL_ISPIXELFORMAT_ALPHA(format) \
- ((SDL_ISPIXELFORMAT_PACKED(format) && \
- ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
- (SDL_ISPIXELFORMAT_ARRAY(format) && \
- ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
- (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
- (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
- (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
-
-/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
-#define SDL_ISPIXELFORMAT_FOURCC(format) \
- ((format) && (SDL_PIXELFLAG(format) != 1))
-
-/* Note: If you modify this list, update SDL_GetPixelFormatName() */
-enum
-{
- SDL_PIXELFORMAT_UNKNOWN,
- SDL_PIXELFORMAT_INDEX1LSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
- 1, 0),
- SDL_PIXELFORMAT_INDEX1MSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
- 1, 0),
- SDL_PIXELFORMAT_INDEX4LSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
- 4, 0),
- SDL_PIXELFORMAT_INDEX4MSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
- 4, 0),
- SDL_PIXELFORMAT_INDEX8 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
- SDL_PIXELFORMAT_RGB332 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_332, 8, 1),
- SDL_PIXELFORMAT_RGB444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_4444, 12, 2),
- SDL_PIXELFORMAT_RGB555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_1555, 15, 2),
- SDL_PIXELFORMAT_BGR555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_1555, 15, 2),
- SDL_PIXELFORMAT_ARGB4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_RGBA4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_ABGR4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_BGRA4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_ARGB1555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_1555, 16, 2),
- SDL_PIXELFORMAT_RGBA5551 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
- SDL_PACKEDLAYOUT_5551, 16, 2),
- SDL_PIXELFORMAT_ABGR1555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
- SDL_PACKEDLAYOUT_1555, 16, 2),
- SDL_PIXELFORMAT_BGRA5551 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
- SDL_PACKEDLAYOUT_5551, 16, 2),
- SDL_PIXELFORMAT_RGB565 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_565, 16, 2),
- SDL_PIXELFORMAT_BGR565 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_565, 16, 2),
- SDL_PIXELFORMAT_RGB24 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
- 24, 3),
- SDL_PIXELFORMAT_BGR24 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
- 24, 3),
- SDL_PIXELFORMAT_RGB888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_RGBX8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_BGR888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_BGRX8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_ARGB8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_RGBA8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_ABGR8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_BGRA8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_ARGB2101010 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_2101010, 32, 4),
-
- /* Aliases for RGBA byte arrays of color data, for the current platform */
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
- SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
- SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
- SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
-#else
- SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
- SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
- SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
- SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
-#endif
-
- SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
- SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
- SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
- SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
- SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
- SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
- SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
- SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
- SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
- SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
- SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
- SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
-};
-
-typedef struct SDL_Color
-{
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 a;
-} SDL_Color;
-#define SDL_Colour SDL_Color
-
-typedef struct SDL_Palette
-{
- int ncolors;
- SDL_Color *colors;
- Uint32 version;
- int refcount;
-} SDL_Palette;
-
-/**
- * \note Everything in the pixel format structure is read-only.
- */
-typedef struct SDL_PixelFormat
-{
- Uint32 format;
- SDL_Palette *palette;
- Uint8 BitsPerPixel;
- Uint8 BytesPerPixel;
- Uint8 padding[2];
- Uint32 Rmask;
- Uint32 Gmask;
- Uint32 Bmask;
- Uint32 Amask;
- Uint8 Rloss;
- Uint8 Gloss;
- Uint8 Bloss;
- Uint8 Aloss;
- Uint8 Rshift;
- Uint8 Gshift;
- Uint8 Bshift;
- Uint8 Ashift;
- int refcount;
- struct SDL_PixelFormat *next;
-} SDL_PixelFormat;
-
-/**
- * \brief Get the human readable name of a pixel format
- */
-extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
-
-/**
- * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
- *
- * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
- *
- * \sa SDL_MasksToPixelFormatEnum()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
- int *bpp,
- Uint32 * Rmask,
- Uint32 * Gmask,
- Uint32 * Bmask,
- Uint32 * Amask);
-
-/**
- * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
- *
- * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
- * wasn't possible.
- *
- * \sa SDL_PixelFormatEnumToMasks()
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
- Uint32 Rmask,
- Uint32 Gmask,
- Uint32 Bmask,
- Uint32 Amask);
-
-/**
- * \brief Create an SDL_PixelFormat structure from a pixel format enum.
- */
-extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
-
-/**
- * \brief Free an SDL_PixelFormat structure.
- */
-extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
-
-/**
- * \brief Create a palette structure with the specified number of color
- * entries.
- *
- * \return A new palette, or NULL if there wasn't enough memory.
- *
- * \note The palette entries are initialized to white.
- *
- * \sa SDL_FreePalette()
- */
-extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
-
-/**
- * \brief Set the palette for a pixel format structure.
- */
-extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
- SDL_Palette *palette);
-
-/**
- * \brief Set a range of colors in a palette.
- *
- * \param palette The palette to modify.
- * \param colors An array of colors to copy into the palette.
- * \param firstcolor The index of the first palette entry to modify.
- * \param ncolors The number of entries to modify.
- *
- * \return 0 on success, or -1 if not all of the colors could be set.
- */
-extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
- const SDL_Color * colors,
- int firstcolor, int ncolors);
-
-/**
- * \brief Free a palette created with SDL_AllocPalette().
- *
- * \sa SDL_AllocPalette()
- */
-extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
-
-/**
- * \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
- *
- * \sa SDL_MapRGBA
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
- Uint8 r, Uint8 g, Uint8 b);
-
-/**
- * \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
- *
- * \sa SDL_MapRGB
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
- Uint8 r, Uint8 g, Uint8 b,
- Uint8 a);
-
-/**
- * \brief Get the RGB components from a pixel of the specified format.
- *
- * \sa SDL_GetRGBA
- */
-extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
- const SDL_PixelFormat * format,
- Uint8 * r, Uint8 * g, Uint8 * b);
-
-/**
- * \brief Get the RGBA components from a pixel of the specified format.
- *
- * \sa SDL_GetRGB
- */
-extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
- const SDL_PixelFormat * format,
- Uint8 * r, Uint8 * g, Uint8 * b,
- Uint8 * a);
-
-/**
- * \brief Calculate a 256 entry gamma ramp for a gamma value.
- */
-extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_pixels_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_platform.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_platform.h
deleted file mode 100644
index 9dde385..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_platform.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_platform.h
- *
- * Try to get a standard set of platform defines.
- */
-
-#ifndef SDL_platform_h_
-#define SDL_platform_h_
-
-#if defined(_AIX)
-#undef __AIX__
-#define __AIX__ 1
-#endif
-#if defined(__HAIKU__)
-#undef __HAIKU__
-#define __HAIKU__ 1
-#endif
-#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
-#undef __BSDI__
-#define __BSDI__ 1
-#endif
-#if defined(_arch_dreamcast)
-#undef __DREAMCAST__
-#define __DREAMCAST__ 1
-#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#undef __FREEBSD__
-#define __FREEBSD__ 1
-#endif
-#if defined(hpux) || defined(__hpux) || defined(__hpux__)
-#undef __HPUX__
-#define __HPUX__ 1
-#endif
-#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
-#undef __IRIX__
-#define __IRIX__ 1
-#endif
-#if (defined(linux) || defined(__linux) || defined(__linux__))
-#undef __LINUX__
-#define __LINUX__ 1
-#endif
-#if defined(ANDROID) || defined(__ANDROID__)
-#undef __ANDROID__
-#undef __LINUX__ /* do we need to do this? */
-#define __ANDROID__ 1
-#endif
-
-#if defined(__APPLE__)
-/* lets us know what version of Mac OS X we're compiling on */
-#include "AvailabilityMacros.h"
-#include "TargetConditionals.h"
-#if TARGET_OS_TV
-#undef __TVOS__
-#define __TVOS__ 1
-#endif
-#if TARGET_OS_IPHONE
-/* if compiling for iOS */
-#undef __IPHONEOS__
-#define __IPHONEOS__ 1
-#undef __MACOSX__
-#else
-/* if not compiling for iOS */
-#undef __MACOSX__
-#define __MACOSX__ 1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
-# error SDL for Mac OS X only supports deploying on 10.6 and above.
-#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
-#endif /* TARGET_OS_IPHONE */
-#endif /* defined(__APPLE__) */
-
-#if defined(__NetBSD__)
-#undef __NETBSD__
-#define __NETBSD__ 1
-#endif
-#if defined(__OpenBSD__)
-#undef __OPENBSD__
-#define __OPENBSD__ 1
-#endif
-#if defined(__OS2__) || defined(__EMX__)
-#undef __OS2__
-#define __OS2__ 1
-#endif
-#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
-#undef __OSF__
-#define __OSF__ 1
-#endif
-#if defined(__QNXNTO__)
-#undef __QNXNTO__
-#define __QNXNTO__ 1
-#endif
-#if defined(riscos) || defined(__riscos) || defined(__riscos__)
-#undef __RISCOS__
-#define __RISCOS__ 1
-#endif
-#if defined(__sun) && defined(__SVR4)
-#undef __SOLARIS__
-#define __SOLARIS__ 1
-#endif
-
-#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
-/* Try to find out if we're compiling for WinRT or non-WinRT */
-#if defined(_MSC_VER) && defined(__has_include)
-#define HAVE_WINAPIFAMILY_H __has_include(<winapifamily.h>)
-/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
-#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
-#define HAVE_WINAPIFAMILY_H 1
-#else
-#define HAVE_WINAPIFAMILY_H 0
-#endif
-
-#if HAVE_WINAPIFAMILY_H
-#include <winapifamily.h>
-#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
-#else
-#define WINAPI_FAMILY_WINRT 0
-#endif /* HAVE_WINAPIFAMILY_H */
-
-#if WINAPI_FAMILY_WINRT
-#undef __WINRT__
-#define __WINRT__ 1
-#else
-#undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif
-#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
-
-#if defined(__WINDOWS__)
-#undef __WIN32__
-#define __WIN32__ 1
-#endif
-#if defined(__PSP__)
-#undef __PSP__
-#define __PSP__ 1
-#endif
-
-/* The NACL compiler defines __native_client__ and __pnacl__
- * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
- */
-#if defined(__native_client__)
-#undef __LINUX__
-#undef __NACL__
-#define __NACL__ 1
-#endif
-#if defined(__pnacl__)
-#undef __LINUX__
-#undef __PNACL__
-#define __PNACL__ 1
-/* PNACL with newlib supports static linking only */
-#define __SDL_NOGETPROCADDR__
-#endif
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Gets the name of the platform.
- */
-extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_platform_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_power.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_power.h
deleted file mode 100644
index d48e8a3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_power.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_power_h_
-#define SDL_power_h_
-
-/**
- * \file SDL_power.h
- *
- * Header for the SDL power management routines.
- */
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The basic state for the system's power supply.
- */
-typedef enum
-{
- SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
- SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
- SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
- SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
- SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
-} SDL_PowerState;
-
-
-/**
- * \brief Get the current power supply details.
- *
- * \param secs Seconds of battery life left. You can pass a NULL here if
- * you don't care. Will return -1 if we can't determine a
- * value, or we're not running on a battery.
- *
- * \param pct Percentage of battery life left, between 0 and 100. You can
- * pass a NULL here if you don't care. Will return -1 if we
- * can't determine a value, or we're not running on a battery.
- *
- * \return The state of the battery (if any).
- */
-extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_power_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_quit.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_quit.h
deleted file mode 100644
index 9283c38..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_quit.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_quit.h
- *
- * Include file for SDL quit event handling.
- */
-
-#ifndef SDL_quit_h_
-#define SDL_quit_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-/**
- * \file SDL_quit.h
- *
- * An ::SDL_QUIT event is generated when the user tries to close the application
- * window. If it is ignored or filtered out, the window will remain open.
- * If it is not ignored or filtered, it is queued normally and the window
- * is allowed to close. When the window is closed, screen updates will
- * complete, but have no effect.
- *
- * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
- * and SIGTERM (system termination request), if handlers do not already
- * exist, that generate ::SDL_QUIT events as well. There is no way
- * to determine the cause of an ::SDL_QUIT event, but setting a signal
- * handler in your application will override the default generation of
- * quit events for that signal.
- *
- * \sa SDL_Quit()
- */
-
-/* There are no functions directly affecting the quit event */
-
-#define SDL_QuitRequested() \
- (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
-
-#endif /* SDL_quit_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rect.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rect.h
deleted file mode 100644
index c4f6d74..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rect.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_rect.h
- *
- * Header file for SDL_rect definition and management functions.
- */
-
-#ifndef SDL_rect_h_
-#define SDL_rect_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_pixels.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The structure that defines a point
- *
- * \sa SDL_EnclosePoints
- * \sa SDL_PointInRect
- */
-typedef struct SDL_Point
-{
- int x;
- int y;
-} SDL_Point;
-
-/**
- * \brief A rectangle, with the origin at the upper left.
- *
- * \sa SDL_RectEmpty
- * \sa SDL_RectEquals
- * \sa SDL_HasIntersection
- * \sa SDL_IntersectRect
- * \sa SDL_UnionRect
- * \sa SDL_EnclosePoints
- */
-typedef struct SDL_Rect
-{
- int x, y;
- int w, h;
-} SDL_Rect;
-
-/**
- * \brief Returns true if point resides inside a rectangle.
- */
-SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
-{
- return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
- (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
-}
-
-/**
- * \brief Returns true if the rectangle has no area.
- */
-SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
-{
- return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
-}
-
-/**
- * \brief Returns true if the two rectangles are equal.
- */
-SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
-{
- return (a && b && (a->x == b->x) && (a->y == b->y) &&
- (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
-}
-
-/**
- * \brief Determine whether two rectangles intersect.
- *
- * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
- const SDL_Rect * B);
-
-/**
- * \brief Calculate the intersection of two rectangles.
- *
- * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
- const SDL_Rect * B,
- SDL_Rect * result);
-
-/**
- * \brief Calculate the union of two rectangles.
- */
-extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
- const SDL_Rect * B,
- SDL_Rect * result);
-
-/**
- * \brief Calculate a minimal rectangle enclosing a set of points
- *
- * \return SDL_TRUE if any points were within the clipping rect
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
- int count,
- const SDL_Rect * clip,
- SDL_Rect * result);
-
-/**
- * \brief Calculate the intersection of a rectangle and line segment.
- *
- * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
- rect, int *X1,
- int *Y1, int *X2,
- int *Y2);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_rect_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_render.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_render.h
deleted file mode 100644
index ea6ef9f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_render.h
+++ /dev/null
@@ -1,910 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_render.h
- *
- * Header file for SDL 2D rendering functions.
- *
- * This API supports the following features:
- * * single pixel points
- * * single pixel lines
- * * filled rectangles
- * * texture images
- *
- * The primitives may be drawn in opaque, blended, or additive modes.
- *
- * The texture images may be drawn in opaque, blended, or additive modes.
- * They can have an additional color tint or alpha modulation applied to
- * them, and may also be stretched with linear interpolation.
- *
- * This API is designed to accelerate simple 2D operations. You may
- * want more functionality such as polygons and particle effects and
- * in that case you should use SDL's OpenGL/Direct3D support or one
- * of the many good 3D engines.
- *
- * These functions must be called from the main thread.
- * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
- */
-
-#ifndef SDL_render_h_
-#define SDL_render_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_rect.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Flags used when creating a rendering context
- */
-typedef enum
-{
- SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
- SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
- acceleration */
- SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
- with the refresh rate */
- SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
- rendering to texture */
-} SDL_RendererFlags;
-
-/**
- * \brief Information on the capabilities of a render driver or context.
- */
-typedef struct SDL_RendererInfo
-{
- const char *name; /**< The name of the renderer */
- Uint32 flags; /**< Supported ::SDL_RendererFlags */
- Uint32 num_texture_formats; /**< The number of available texture formats */
- Uint32 texture_formats[16]; /**< The available texture formats */
- int max_texture_width; /**< The maximum texture width */
- int max_texture_height; /**< The maximum texture height */
-} SDL_RendererInfo;
-
-/**
- * \brief The access pattern allowed for a texture.
- */
-typedef enum
-{
- SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
- SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
- SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
-} SDL_TextureAccess;
-
-/**
- * \brief The texture channel modulation used in SDL_RenderCopy().
- */
-typedef enum
-{
- SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
- SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
- SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
-} SDL_TextureModulate;
-
-/**
- * \brief Flip constants for SDL_RenderCopyEx
- */
-typedef enum
-{
- SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
- SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
- SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
-} SDL_RendererFlip;
-
-/**
- * \brief A structure representing rendering state
- */
-struct SDL_Renderer;
-typedef struct SDL_Renderer SDL_Renderer;
-
-/**
- * \brief An efficient driver-specific representation of pixel data
- */
-struct SDL_Texture;
-typedef struct SDL_Texture SDL_Texture;
-
-
-/* Function prototypes */
-
-/**
- * \brief Get the number of 2D rendering drivers available for the current
- * display.
- *
- * A render driver is a set of code that handles rendering and texture
- * management on a particular display. Normally there is only one, but
- * some drivers may have several available with different capabilities.
- *
- * \sa SDL_GetRenderDriverInfo()
- * \sa SDL_CreateRenderer()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
-
-/**
- * \brief Get information about a specific 2D rendering driver for the current
- * display.
- *
- * \param index The index of the driver to query information about.
- * \param info A pointer to an SDL_RendererInfo struct to be filled with
- * information on the rendering driver.
- *
- * \return 0 on success, -1 if the index was out of range.
- *
- * \sa SDL_CreateRenderer()
- */
-extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
- SDL_RendererInfo * info);
-
-/**
- * \brief Create a window and default renderer
- *
- * \param width The width of the window
- * \param height The height of the window
- * \param window_flags The flags used to create the window
- * \param window A pointer filled with the window, or NULL on error
- * \param renderer A pointer filled with the renderer, or NULL on error
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
- int width, int height, Uint32 window_flags,
- SDL_Window **window, SDL_Renderer **renderer);
-
-
-/**
- * \brief Create a 2D rendering context for a window.
- *
- * \param window The window where rendering is displayed.
- * \param index The index of the rendering driver to initialize, or -1 to
- * initialize the first one supporting the requested flags.
- * \param flags ::SDL_RendererFlags.
- *
- * \return A valid rendering context or NULL if there was an error.
- *
- * \sa SDL_CreateSoftwareRenderer()
- * \sa SDL_GetRendererInfo()
- * \sa SDL_DestroyRenderer()
- */
-extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
- int index, Uint32 flags);
-
-/**
- * \brief Create a 2D software rendering context for a surface.
- *
- * \param surface The surface where rendering is done.
- *
- * \return A valid rendering context or NULL if there was an error.
- *
- * \sa SDL_CreateRenderer()
- * \sa SDL_DestroyRenderer()
- */
-extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
-
-/**
- * \brief Get the renderer associated with a window.
- */
-extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
-
-/**
- * \brief Get information about a rendering context.
- */
-extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
- SDL_RendererInfo * info);
-
-/**
- * \brief Get the output size in pixels of a rendering context.
- */
-extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
- int *w, int *h);
-
-/**
- * \brief Create a texture for a rendering context.
- *
- * \param renderer The renderer.
- * \param format The format of the texture.
- * \param access One of the enumerated values in ::SDL_TextureAccess.
- * \param w The width of the texture in pixels.
- * \param h The height of the texture in pixels.
- *
- * \return The created texture is returned, or NULL if no rendering context was
- * active, the format was unsupported, or the width or height were out
- * of range.
- *
- * \note The contents of the texture are not defined at creation.
- *
- * \sa SDL_QueryTexture()
- * \sa SDL_UpdateTexture()
- * \sa SDL_DestroyTexture()
- */
-extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
- Uint32 format,
- int access, int w,
- int h);
-
-/**
- * \brief Create a texture from an existing surface.
- *
- * \param renderer The renderer.
- * \param surface The surface containing pixel data used to fill the texture.
- *
- * \return The created texture is returned, or NULL on error.
- *
- * \note The surface is not modified or freed by this function.
- *
- * \sa SDL_QueryTexture()
- * \sa SDL_DestroyTexture()
- */
-extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
-
-/**
- * \brief Query the attributes of a texture
- *
- * \param texture A texture to be queried.
- * \param format A pointer filled in with the raw format of the texture. The
- * actual format may differ, but pixel transfers will use this
- * format.
- * \param access A pointer filled in with the actual access to the texture.
- * \param w A pointer filled in with the width of the texture in pixels.
- * \param h A pointer filled in with the height of the texture in pixels.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- */
-extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
- Uint32 * format, int *access,
- int *w, int *h);
-
-/**
- * \brief Set an additional color value used in render copy operations.
- *
- * \param texture The texture to update.
- * \param r The red color value multiplied into copy operations.
- * \param g The green color value multiplied into copy operations.
- * \param b The blue color value multiplied into copy operations.
- *
- * \return 0 on success, or -1 if the texture is not valid or color modulation
- * is not supported.
- *
- * \sa SDL_GetTextureColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
- Uint8 r, Uint8 g, Uint8 b);
-
-
-/**
- * \brief Get the additional color value used in render copy operations.
- *
- * \param texture The texture to query.
- * \param r A pointer filled in with the current red color value.
- * \param g A pointer filled in with the current green color value.
- * \param b A pointer filled in with the current blue color value.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \sa SDL_SetTextureColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
- Uint8 * r, Uint8 * g,
- Uint8 * b);
-
-/**
- * \brief Set an additional alpha value used in render copy operations.
- *
- * \param texture The texture to update.
- * \param alpha The alpha value multiplied into copy operations.
- *
- * \return 0 on success, or -1 if the texture is not valid or alpha modulation
- * is not supported.
- *
- * \sa SDL_GetTextureAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
- Uint8 alpha);
-
-/**
- * \brief Get the additional alpha value used in render copy operations.
- *
- * \param texture The texture to query.
- * \param alpha A pointer filled in with the current alpha value.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \sa SDL_SetTextureAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
- Uint8 * alpha);
-
-/**
- * \brief Set the blend mode used for texture copy operations.
- *
- * \param texture The texture to update.
- * \param blendMode ::SDL_BlendMode to use for texture blending.
- *
- * \return 0 on success, or -1 if the texture is not valid or the blend mode is
- * not supported.
- *
- * \note If the blend mode is not supported, the closest supported mode is
- * chosen.
- *
- * \sa SDL_GetTextureBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
- SDL_BlendMode blendMode);
-
-/**
- * \brief Get the blend mode used for texture copy operations.
- *
- * \param texture The texture to query.
- * \param blendMode A pointer filled in with the current blend mode.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \sa SDL_SetTextureBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
- SDL_BlendMode *blendMode);
-
-/**
- * \brief Update the given texture rectangle with new pixel data.
- *
- * \param texture The texture to update
- * \param rect A pointer to the rectangle of pixels to update, or NULL to
- * update the entire texture.
- * \param pixels The raw pixel data in the format of the texture.
- * \param pitch The number of bytes in a row of pixel data, including padding between lines.
- *
- * The pixel data must be in the format of the texture. The pixel format can be
- * queried with SDL_QueryTexture.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \note This is a fairly slow function.
- */
-extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
- const SDL_Rect * rect,
- const void *pixels, int pitch);
-
-/**
- * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
- *
- * \param texture The texture to update
- * \param rect A pointer to the rectangle of pixels to update, or NULL to
- * update the entire texture.
- * \param Yplane The raw pixel data for the Y plane.
- * \param Ypitch The number of bytes between rows of pixel data for the Y plane.
- * \param Uplane The raw pixel data for the U plane.
- * \param Upitch The number of bytes between rows of pixel data for the U plane.
- * \param Vplane The raw pixel data for the V plane.
- * \param Vpitch The number of bytes between rows of pixel data for the V plane.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \note You can use SDL_UpdateTexture() as long as your pixel data is
- * a contiguous block of Y and U/V planes in the proper order, but
- * this function is available if your pixel data is not contiguous.
- */
-extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
- const SDL_Rect * rect,
- const Uint8 *Yplane, int Ypitch,
- const Uint8 *Uplane, int Upitch,
- const Uint8 *Vplane, int Vpitch);
-
-/**
- * \brief Lock a portion of the texture for write-only pixel access.
- *
- * \param texture The texture to lock for access, which was created with
- * ::SDL_TEXTUREACCESS_STREAMING.
- * \param rect A pointer to the rectangle to lock for access. If the rect
- * is NULL, the entire texture will be locked.
- * \param pixels This is filled in with a pointer to the locked pixels,
- * appropriately offset by the locked area.
- * \param pitch This is filled in with the pitch of the locked pixels.
- *
- * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
- *
- * \sa SDL_UnlockTexture()
- */
-extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
- const SDL_Rect * rect,
- void **pixels, int *pitch);
-
-/**
- * \brief Unlock a texture, uploading the changes to video memory, if needed.
- *
- * \sa SDL_LockTexture()
- */
-extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
-
-/**
- * \brief Determines whether a window supports the use of render targets
- *
- * \param renderer The renderer that will be checked
- *
- * \return SDL_TRUE if supported, SDL_FALSE if not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
-
-/**
- * \brief Set a texture as the current rendering target.
- *
- * \param renderer The renderer.
- * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
- *
- * \return 0 on success, or -1 on error
- *
- * \sa SDL_GetRenderTarget()
- */
-extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
- SDL_Texture *texture);
-
-/**
- * \brief Get the current render target or NULL for the default render target.
- *
- * \return The current render target
- *
- * \sa SDL_SetRenderTarget()
- */
-extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
-
-/**
- * \brief Set device independent resolution for rendering
- *
- * \param renderer The renderer for which resolution should be set.
- * \param w The width of the logical resolution
- * \param h The height of the logical resolution
- *
- * This function uses the viewport and scaling functionality to allow a fixed logical
- * resolution for rendering, regardless of the actual output resolution. If the actual
- * output resolution doesn't have the same aspect ratio the output rendering will be
- * centered within the output display.
- *
- * If the output display is a window, mouse events in the window will be filtered
- * and scaled so they seem to arrive within the logical resolution.
- *
- * \note If this function results in scaling or subpixel drawing by the
- * rendering backend, it will be handled using the appropriate
- * quality hints.
- *
- * \sa SDL_RenderGetLogicalSize()
- * \sa SDL_RenderSetScale()
- * \sa SDL_RenderSetViewport()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
-
-/**
- * \brief Get device independent resolution for rendering
- *
- * \param renderer The renderer from which resolution should be queried.
- * \param w A pointer filled with the width of the logical resolution
- * \param h A pointer filled with the height of the logical resolution
- *
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
-
-/**
- * \brief Set whether to force integer scales for resolution-independent rendering
- *
- * \param renderer The renderer for which integer scaling should be set.
- * \param enable Enable or disable integer scaling
- *
- * This function restricts the logical viewport to integer values - that is, when
- * a resolution is between two multiples of a logical size, the viewport size is
- * rounded down to the lower multiple.
- *
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer,
- SDL_bool enable);
-
-/**
- * \brief Get whether integer scales are forced for resolution-independent rendering
- *
- * \param renderer The renderer from which integer scaling should be queried.
- *
- * \sa SDL_RenderSetIntegerScale()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer);
-
-/**
- * \brief Set the drawing area for rendering on the current target.
- *
- * \param renderer The renderer for which the drawing area should be set.
- * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
- *
- * The x,y of the viewport rect represents the origin for rendering.
- *
- * \return 0 on success, or -1 on error
- *
- * \note If the window associated with the renderer is resized, the viewport is automatically reset.
- *
- * \sa SDL_RenderGetViewport()
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Get the drawing area for the current target.
- *
- * \sa SDL_RenderSetViewport()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
- SDL_Rect * rect);
-
-/**
- * \brief Set the clip rectangle for the current target.
- *
- * \param renderer The renderer for which clip rectangle should be set.
- * \param rect A pointer to the rectangle to set as the clip rectangle, or
- * NULL to disable clipping.
- *
- * \return 0 on success, or -1 on error
- *
- * \sa SDL_RenderGetClipRect()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Get the clip rectangle for the current target.
- *
- * \param renderer The renderer from which clip rectangle should be queried.
- * \param rect A pointer filled in with the current clip rectangle, or
- * an empty rectangle if clipping is disabled.
- *
- * \sa SDL_RenderSetClipRect()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
- SDL_Rect * rect);
-
-/**
- * \brief Get whether clipping is enabled on the given renderer.
- *
- * \param renderer The renderer from which clip state should be queried.
- *
- * \sa SDL_RenderGetClipRect()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer);
-
-
-/**
- * \brief Set the drawing scale for rendering on the current target.
- *
- * \param renderer The renderer for which the drawing scale should be set.
- * \param scaleX The horizontal scaling factor
- * \param scaleY The vertical scaling factor
- *
- * The drawing coordinates are scaled by the x/y scaling factors
- * before they are used by the renderer. This allows resolution
- * independent drawing with a single coordinate system.
- *
- * \note If this results in scaling or subpixel drawing by the
- * rendering backend, it will be handled using the appropriate
- * quality hints. For best results use integer scaling factors.
- *
- * \sa SDL_RenderGetScale()
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
- float scaleX, float scaleY);
-
-/**
- * \brief Get the drawing scale for the current target.
- *
- * \param renderer The renderer from which drawing scale should be queried.
- * \param scaleX A pointer filled in with the horizontal scaling factor
- * \param scaleY A pointer filled in with the vertical scaling factor
- *
- * \sa SDL_RenderSetScale()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
- float *scaleX, float *scaleY);
-
-/**
- * \brief Set the color used for drawing operations (Rect, Line and Clear).
- *
- * \param renderer The renderer for which drawing color should be set.
- * \param r The red value used to draw on the rendering target.
- * \param g The green value used to draw on the rendering target.
- * \param b The blue value used to draw on the rendering target.
- * \param a The alpha value used to draw on the rendering target, usually
- * ::SDL_ALPHA_OPAQUE (255).
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
- Uint8 r, Uint8 g, Uint8 b,
- Uint8 a);
-
-/**
- * \brief Get the color used for drawing operations (Rect, Line and Clear).
- *
- * \param renderer The renderer from which drawing color should be queried.
- * \param r A pointer to the red value used to draw on the rendering target.
- * \param g A pointer to the green value used to draw on the rendering target.
- * \param b A pointer to the blue value used to draw on the rendering target.
- * \param a A pointer to the alpha value used to draw on the rendering target,
- * usually ::SDL_ALPHA_OPAQUE (255).
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
- Uint8 * r, Uint8 * g, Uint8 * b,
- Uint8 * a);
-
-/**
- * \brief Set the blend mode used for drawing operations (Fill and Line).
- *
- * \param renderer The renderer for which blend mode should be set.
- * \param blendMode ::SDL_BlendMode to use for blending.
- *
- * \return 0 on success, or -1 on error
- *
- * \note If the blend mode is not supported, the closest supported mode is
- * chosen.
- *
- * \sa SDL_GetRenderDrawBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
- SDL_BlendMode blendMode);
-
-/**
- * \brief Get the blend mode used for drawing operations.
- *
- * \param renderer The renderer from which blend mode should be queried.
- * \param blendMode A pointer filled in with the current blend mode.
- *
- * \return 0 on success, or -1 on error
- *
- * \sa SDL_SetRenderDrawBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
- SDL_BlendMode *blendMode);
-
-/**
- * \brief Clear the current rendering target with the drawing color
- *
- * This function clears the entire rendering target, ignoring the viewport and
- * the clip rectangle.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
-
-/**
- * \brief Draw a point on the current rendering target.
- *
- * \param renderer The renderer which should draw a point.
- * \param x The x coordinate of the point.
- * \param y The y coordinate of the point.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
- int x, int y);
-
-/**
- * \brief Draw multiple points on the current rendering target.
- *
- * \param renderer The renderer which should draw multiple points.
- * \param points The points to draw
- * \param count The number of points to draw
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
- const SDL_Point * points,
- int count);
-
-/**
- * \brief Draw a line on the current rendering target.
- *
- * \param renderer The renderer which should draw a line.
- * \param x1 The x coordinate of the start point.
- * \param y1 The y coordinate of the start point.
- * \param x2 The x coordinate of the end point.
- * \param y2 The y coordinate of the end point.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
- int x1, int y1, int x2, int y2);
-
-/**
- * \brief Draw a series of connected lines on the current rendering target.
- *
- * \param renderer The renderer which should draw multiple lines.
- * \param points The points along the lines
- * \param count The number of points, drawing count-1 lines
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
- const SDL_Point * points,
- int count);
-
-/**
- * \brief Draw a rectangle on the current rendering target.
- *
- * \param renderer The renderer which should draw a rectangle.
- * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Draw some number of rectangles on the current rendering target.
- *
- * \param renderer The renderer which should draw multiple rectangles.
- * \param rects A pointer to an array of destination rectangles.
- * \param count The number of rectangles.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
- const SDL_Rect * rects,
- int count);
-
-/**
- * \brief Fill a rectangle on the current rendering target with the drawing color.
- *
- * \param renderer The renderer which should fill a rectangle.
- * \param rect A pointer to the destination rectangle, or NULL for the entire
- * rendering target.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Fill some number of rectangles on the current rendering target with the drawing color.
- *
- * \param renderer The renderer which should fill multiple rectangles.
- * \param rects A pointer to an array of destination rectangles.
- * \param count The number of rectangles.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
- const SDL_Rect * rects,
- int count);
-
-/**
- * \brief Copy a portion of the texture to the current rendering target.
- *
- * \param renderer The renderer which should copy parts of a texture.
- * \param texture The source texture.
- * \param srcrect A pointer to the source rectangle, or NULL for the entire
- * texture.
- * \param dstrect A pointer to the destination rectangle, or NULL for the
- * entire rendering target.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
- SDL_Texture * texture,
- const SDL_Rect * srcrect,
- const SDL_Rect * dstrect);
-
-/**
- * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
- *
- * \param renderer The renderer which should copy parts of a texture.
- * \param texture The source texture.
- * \param srcrect A pointer to the source rectangle, or NULL for the entire
- * texture.
- * \param dstrect A pointer to the destination rectangle, or NULL for the
- * entire rendering target.
- * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
- * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
- * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
- SDL_Texture * texture,
- const SDL_Rect * srcrect,
- const SDL_Rect * dstrect,
- const double angle,
- const SDL_Point *center,
- const SDL_RendererFlip flip);
-
-/**
- * \brief Read pixels from the current rendering target.
- *
- * \param renderer The renderer from which pixels should be read.
- * \param rect A pointer to the rectangle to read, or NULL for the entire
- * render target.
- * \param format The desired format of the pixel data, or 0 to use the format
- * of the rendering target
- * \param pixels A pointer to be filled in with the pixel data
- * \param pitch The pitch of the pixels parameter.
- *
- * \return 0 on success, or -1 if pixel reading is not supported.
- *
- * \warning This is a very slow operation, and should not be used frequently.
- */
-extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
- const SDL_Rect * rect,
- Uint32 format,
- void *pixels, int pitch);
-
-/**
- * \brief Update the screen with rendering performed.
- */
-extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
-
-/**
- * \brief Destroy the specified texture.
- *
- * \sa SDL_CreateTexture()
- * \sa SDL_CreateTextureFromSurface()
- */
-extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
-
-/**
- * \brief Destroy the rendering context for a window and free associated
- * textures.
- *
- * \sa SDL_CreateRenderer()
- */
-extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
-
-
-/**
- * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
- * OpenGL instructions.
- *
- * \param texture The SDL texture to bind
- * \param texw A pointer to a float that will be filled with the texture width
- * \param texh A pointer to a float that will be filled with the texture height
- *
- * \return 0 on success, or -1 if the operation is not supported
- */
-extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
-
-/**
- * \brief Unbind a texture from the current OpenGL/ES/ES2 context.
- *
- * \param texture The SDL texture to unbind
- *
- * \return 0 on success, or -1 if the operation is not supported
- */
-extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_render_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_revision.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_revision.h
deleted file mode 100644
index 9376093..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_revision.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define SDL_REVISION "hg-11645:2088cd828335"
-#define SDL_REVISION_NUMBER 11645
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rwops.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rwops.h
deleted file mode 100644
index 7f0cbdf..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_rwops.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_rwops.h
- *
- * This file provides a general interface for SDL to read and write
- * data streams. It can easily be extended to files, memory, etc.
- */
-
-#ifndef SDL_rwops_h_
-#define SDL_rwops_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* RWops Types */
-#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
-#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
-#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
-#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
-#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
-
-/**
- * This is the read/write operation structure -- very basic.
- */
-typedef struct SDL_RWops
-{
- /**
- * Return the size of the file in this rwops, or -1 if unknown
- */
- Sint64 (SDLCALL * size) (struct SDL_RWops * context);
-
- /**
- * Seek to \c offset relative to \c whence, one of stdio's whence values:
- * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
- *
- * \return the final offset in the data stream, or -1 on error.
- */
- Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
- int whence);
-
- /**
- * Read up to \c maxnum objects each of size \c size from the data
- * stream to the area pointed at by \c ptr.
- *
- * \return the number of objects read, or 0 at error or end of file.
- */
- size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
- size_t size, size_t maxnum);
-
- /**
- * Write exactly \c num objects each of size \c size from the area
- * pointed at by \c ptr to data stream.
- *
- * \return the number of objects written, or 0 at error or end of file.
- */
- size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
- size_t size, size_t num);
-
- /**
- * Close and free an allocated SDL_RWops structure.
- *
- * \return 0 if successful or -1 on write error when flushing data.
- */
- int (SDLCALL * close) (struct SDL_RWops * context);
-
- Uint32 type;
- union
- {
-#if defined(__ANDROID__)
- struct
- {
- void *fileNameRef;
- void *inputStreamRef;
- void *readableByteChannelRef;
- void *readMethod;
- void *assetFileDescriptorRef;
- long position;
- long size;
- long offset;
- int fd;
- } androidio;
-#elif defined(__WIN32__)
- struct
- {
- SDL_bool append;
- void *h;
- struct
- {
- void *data;
- size_t size;
- size_t left;
- } buffer;
- } windowsio;
-#endif
-
-#ifdef HAVE_STDIO_H
- struct
- {
- SDL_bool autoclose;
- FILE *fp;
- } stdio;
-#endif
- struct
- {
- Uint8 *base;
- Uint8 *here;
- Uint8 *stop;
- } mem;
- struct
- {
- void *data1;
- void *data2;
- } unknown;
- } hidden;
-
-} SDL_RWops;
-
-
-/**
- * \name RWFrom functions
- *
- * Functions to create SDL_RWops structures from various data streams.
- */
-/* @{ */
-
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
- const char *mode);
-
-#ifdef HAVE_STDIO_H
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
- SDL_bool autoclose);
-#else
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
- SDL_bool autoclose);
-#endif
-
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
- int size);
-
-/* @} *//* RWFrom functions */
-
-
-extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
-extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
-
-#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
-#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
-#define RW_SEEK_END 2 /**< Seek relative to the end of data */
-
-/**
- * \name Read/write macros
- *
- * Macros to easily read and write from an SDL_RWops structure.
- */
-/* @{ */
-#define SDL_RWsize(ctx) (ctx)->size(ctx)
-#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx) (ctx)->close(ctx)
-/* @} *//* Read/write macros */
-
-
-/**
- * Load all the data from an SDL data stream.
- *
- * The data is allocated with a zero byte at the end (null terminated)
- *
- * If \c datasize is not NULL, it is filled with the size of the data read.
- *
- * If \c freesrc is non-zero, the stream will be closed after being read.
- *
- * The data should be freed with SDL_free().
- *
- * \return the data, or NULL if there was an error.
- */
-extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
- int freesrc);
-
-/**
- * Load an entire file.
- *
- * Convenience macro.
- */
-#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
-
-/**
- * \name Read endian functions
- *
- * Read an item of the specified endianness and return in native format.
- */
-/* @{ */
-extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
-extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
-extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
-/* @} *//* Read endian functions */
-
-/**
- * \name Write endian functions
- *
- * Write an item of native format to the specified endianness.
- */
-/* @{ */
-extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
-/* @} *//* Write endian functions */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_rwops_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_scancode.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_scancode.h
deleted file mode 100644
index 1d55212..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_scancode.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_scancode.h
- *
- * Defines keyboard scancodes.
- */
-
-#ifndef SDL_scancode_h_
-#define SDL_scancode_h_
-
-#include "SDL_stdinc.h"
-
-/**
- * \brief The SDL keyboard scancode representation.
- *
- * Values of this type are used to represent keyboard keys, among other places
- * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
- * SDL_Event structure.
- *
- * The values in this enumeration are based on the USB usage page standard:
- * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
- */
-typedef enum
-{
- SDL_SCANCODE_UNKNOWN = 0,
-
- /**
- * \name Usage page 0x07
- *
- * These values are from usage page 0x07 (USB keyboard page).
- */
- /* @{ */
-
- SDL_SCANCODE_A = 4,
- SDL_SCANCODE_B = 5,
- SDL_SCANCODE_C = 6,
- SDL_SCANCODE_D = 7,
- SDL_SCANCODE_E = 8,
- SDL_SCANCODE_F = 9,
- SDL_SCANCODE_G = 10,
- SDL_SCANCODE_H = 11,
- SDL_SCANCODE_I = 12,
- SDL_SCANCODE_J = 13,
- SDL_SCANCODE_K = 14,
- SDL_SCANCODE_L = 15,
- SDL_SCANCODE_M = 16,
- SDL_SCANCODE_N = 17,
- SDL_SCANCODE_O = 18,
- SDL_SCANCODE_P = 19,
- SDL_SCANCODE_Q = 20,
- SDL_SCANCODE_R = 21,
- SDL_SCANCODE_S = 22,
- SDL_SCANCODE_T = 23,
- SDL_SCANCODE_U = 24,
- SDL_SCANCODE_V = 25,
- SDL_SCANCODE_W = 26,
- SDL_SCANCODE_X = 27,
- SDL_SCANCODE_Y = 28,
- SDL_SCANCODE_Z = 29,
-
- SDL_SCANCODE_1 = 30,
- SDL_SCANCODE_2 = 31,
- SDL_SCANCODE_3 = 32,
- SDL_SCANCODE_4 = 33,
- SDL_SCANCODE_5 = 34,
- SDL_SCANCODE_6 = 35,
- SDL_SCANCODE_7 = 36,
- SDL_SCANCODE_8 = 37,
- SDL_SCANCODE_9 = 38,
- SDL_SCANCODE_0 = 39,
-
- SDL_SCANCODE_RETURN = 40,
- SDL_SCANCODE_ESCAPE = 41,
- SDL_SCANCODE_BACKSPACE = 42,
- SDL_SCANCODE_TAB = 43,
- SDL_SCANCODE_SPACE = 44,
-
- SDL_SCANCODE_MINUS = 45,
- SDL_SCANCODE_EQUALS = 46,
- SDL_SCANCODE_LEFTBRACKET = 47,
- SDL_SCANCODE_RIGHTBRACKET = 48,
- SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
- * key on ISO keyboards and at the right end
- * of the QWERTY row on ANSI keyboards.
- * Produces REVERSE SOLIDUS (backslash) and
- * VERTICAL LINE in a US layout, REVERSE
- * SOLIDUS and VERTICAL LINE in a UK Mac
- * layout, NUMBER SIGN and TILDE in a UK
- * Windows layout, DOLLAR SIGN and POUND SIGN
- * in a Swiss German layout, NUMBER SIGN and
- * APOSTROPHE in a German layout, GRAVE
- * ACCENT and POUND SIGN in a French Mac
- * layout, and ASTERISK and MICRO SIGN in a
- * French Windows layout.
- */
- SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
- * instead of 49 for the same key, but all
- * OSes I've seen treat the two codes
- * identically. So, as an implementor, unless
- * your keyboard generates both of those
- * codes and your OS treats them differently,
- * you should generate SDL_SCANCODE_BACKSLASH
- * instead of this code. As a user, you
- * should not rely on this code because SDL
- * will never generate it with most (all?)
- * keyboards.
- */
- SDL_SCANCODE_SEMICOLON = 51,
- SDL_SCANCODE_APOSTROPHE = 52,
- SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
- * and ISO keyboards). Produces GRAVE ACCENT and
- * TILDE in a US Windows layout and in US and UK
- * Mac layouts on ANSI keyboards, GRAVE ACCENT
- * and NOT SIGN in a UK Windows layout, SECTION
- * SIGN and PLUS-MINUS SIGN in US and UK Mac
- * layouts on ISO keyboards, SECTION SIGN and
- * DEGREE SIGN in a Swiss German layout (Mac:
- * only on ISO keyboards), CIRCUMFLEX ACCENT and
- * DEGREE SIGN in a German layout (Mac: only on
- * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
- * French Windows layout, COMMERCIAL AT and
- * NUMBER SIGN in a French Mac layout on ISO
- * keyboards, and LESS-THAN SIGN and GREATER-THAN
- * SIGN in a Swiss German, German, or French Mac
- * layout on ANSI keyboards.
- */
- SDL_SCANCODE_COMMA = 54,
- SDL_SCANCODE_PERIOD = 55,
- SDL_SCANCODE_SLASH = 56,
-
- SDL_SCANCODE_CAPSLOCK = 57,
-
- SDL_SCANCODE_F1 = 58,
- SDL_SCANCODE_F2 = 59,
- SDL_SCANCODE_F3 = 60,
- SDL_SCANCODE_F4 = 61,
- SDL_SCANCODE_F5 = 62,
- SDL_SCANCODE_F6 = 63,
- SDL_SCANCODE_F7 = 64,
- SDL_SCANCODE_F8 = 65,
- SDL_SCANCODE_F9 = 66,
- SDL_SCANCODE_F10 = 67,
- SDL_SCANCODE_F11 = 68,
- SDL_SCANCODE_F12 = 69,
-
- SDL_SCANCODE_PRINTSCREEN = 70,
- SDL_SCANCODE_SCROLLLOCK = 71,
- SDL_SCANCODE_PAUSE = 72,
- SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
- does send code 73, not 117) */
- SDL_SCANCODE_HOME = 74,
- SDL_SCANCODE_PAGEUP = 75,
- SDL_SCANCODE_DELETE = 76,
- SDL_SCANCODE_END = 77,
- SDL_SCANCODE_PAGEDOWN = 78,
- SDL_SCANCODE_RIGHT = 79,
- SDL_SCANCODE_LEFT = 80,
- SDL_SCANCODE_DOWN = 81,
- SDL_SCANCODE_UP = 82,
-
- SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
- */
- SDL_SCANCODE_KP_DIVIDE = 84,
- SDL_SCANCODE_KP_MULTIPLY = 85,
- SDL_SCANCODE_KP_MINUS = 86,
- SDL_SCANCODE_KP_PLUS = 87,
- SDL_SCANCODE_KP_ENTER = 88,
- SDL_SCANCODE_KP_1 = 89,
- SDL_SCANCODE_KP_2 = 90,
- SDL_SCANCODE_KP_3 = 91,
- SDL_SCANCODE_KP_4 = 92,
- SDL_SCANCODE_KP_5 = 93,
- SDL_SCANCODE_KP_6 = 94,
- SDL_SCANCODE_KP_7 = 95,
- SDL_SCANCODE_KP_8 = 96,
- SDL_SCANCODE_KP_9 = 97,
- SDL_SCANCODE_KP_0 = 98,
- SDL_SCANCODE_KP_PERIOD = 99,
-
- SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
- * keyboards have over ANSI ones,
- * located between left shift and Y.
- * Produces GRAVE ACCENT and TILDE in a
- * US or UK Mac layout, REVERSE SOLIDUS
- * (backslash) and VERTICAL LINE in a
- * US or UK Windows layout, and
- * LESS-THAN SIGN and GREATER-THAN SIGN
- * in a Swiss German, German, or French
- * layout. */
- SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
- SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
- * not a physical key - but some Mac keyboards
- * do have a power key. */
- SDL_SCANCODE_KP_EQUALS = 103,
- SDL_SCANCODE_F13 = 104,
- SDL_SCANCODE_F14 = 105,
- SDL_SCANCODE_F15 = 106,
- SDL_SCANCODE_F16 = 107,
- SDL_SCANCODE_F17 = 108,
- SDL_SCANCODE_F18 = 109,
- SDL_SCANCODE_F19 = 110,
- SDL_SCANCODE_F20 = 111,
- SDL_SCANCODE_F21 = 112,
- SDL_SCANCODE_F22 = 113,
- SDL_SCANCODE_F23 = 114,
- SDL_SCANCODE_F24 = 115,
- SDL_SCANCODE_EXECUTE = 116,
- SDL_SCANCODE_HELP = 117,
- SDL_SCANCODE_MENU = 118,
- SDL_SCANCODE_SELECT = 119,
- SDL_SCANCODE_STOP = 120,
- SDL_SCANCODE_AGAIN = 121, /**< redo */
- SDL_SCANCODE_UNDO = 122,
- SDL_SCANCODE_CUT = 123,
- SDL_SCANCODE_COPY = 124,
- SDL_SCANCODE_PASTE = 125,
- SDL_SCANCODE_FIND = 126,
- SDL_SCANCODE_MUTE = 127,
- SDL_SCANCODE_VOLUMEUP = 128,
- SDL_SCANCODE_VOLUMEDOWN = 129,
-/* not sure whether there's a reason to enable these */
-/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
-/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
-/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
- SDL_SCANCODE_KP_COMMA = 133,
- SDL_SCANCODE_KP_EQUALSAS400 = 134,
-
- SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
- footnotes in USB doc */
- SDL_SCANCODE_INTERNATIONAL2 = 136,
- SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
- SDL_SCANCODE_INTERNATIONAL4 = 138,
- SDL_SCANCODE_INTERNATIONAL5 = 139,
- SDL_SCANCODE_INTERNATIONAL6 = 140,
- SDL_SCANCODE_INTERNATIONAL7 = 141,
- SDL_SCANCODE_INTERNATIONAL8 = 142,
- SDL_SCANCODE_INTERNATIONAL9 = 143,
- SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
- SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
- SDL_SCANCODE_LANG3 = 146, /**< Katakana */
- SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
- SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
- SDL_SCANCODE_LANG6 = 149, /**< reserved */
- SDL_SCANCODE_LANG7 = 150, /**< reserved */
- SDL_SCANCODE_LANG8 = 151, /**< reserved */
- SDL_SCANCODE_LANG9 = 152, /**< reserved */
-
- SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
- SDL_SCANCODE_SYSREQ = 154,
- SDL_SCANCODE_CANCEL = 155,
- SDL_SCANCODE_CLEAR = 156,
- SDL_SCANCODE_PRIOR = 157,
- SDL_SCANCODE_RETURN2 = 158,
- SDL_SCANCODE_SEPARATOR = 159,
- SDL_SCANCODE_OUT = 160,
- SDL_SCANCODE_OPER = 161,
- SDL_SCANCODE_CLEARAGAIN = 162,
- SDL_SCANCODE_CRSEL = 163,
- SDL_SCANCODE_EXSEL = 164,
-
- SDL_SCANCODE_KP_00 = 176,
- SDL_SCANCODE_KP_000 = 177,
- SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
- SDL_SCANCODE_DECIMALSEPARATOR = 179,
- SDL_SCANCODE_CURRENCYUNIT = 180,
- SDL_SCANCODE_CURRENCYSUBUNIT = 181,
- SDL_SCANCODE_KP_LEFTPAREN = 182,
- SDL_SCANCODE_KP_RIGHTPAREN = 183,
- SDL_SCANCODE_KP_LEFTBRACE = 184,
- SDL_SCANCODE_KP_RIGHTBRACE = 185,
- SDL_SCANCODE_KP_TAB = 186,
- SDL_SCANCODE_KP_BACKSPACE = 187,
- SDL_SCANCODE_KP_A = 188,
- SDL_SCANCODE_KP_B = 189,
- SDL_SCANCODE_KP_C = 190,
- SDL_SCANCODE_KP_D = 191,
- SDL_SCANCODE_KP_E = 192,
- SDL_SCANCODE_KP_F = 193,
- SDL_SCANCODE_KP_XOR = 194,
- SDL_SCANCODE_KP_POWER = 195,
- SDL_SCANCODE_KP_PERCENT = 196,
- SDL_SCANCODE_KP_LESS = 197,
- SDL_SCANCODE_KP_GREATER = 198,
- SDL_SCANCODE_KP_AMPERSAND = 199,
- SDL_SCANCODE_KP_DBLAMPERSAND = 200,
- SDL_SCANCODE_KP_VERTICALBAR = 201,
- SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
- SDL_SCANCODE_KP_COLON = 203,
- SDL_SCANCODE_KP_HASH = 204,
- SDL_SCANCODE_KP_SPACE = 205,
- SDL_SCANCODE_KP_AT = 206,
- SDL_SCANCODE_KP_EXCLAM = 207,
- SDL_SCANCODE_KP_MEMSTORE = 208,
- SDL_SCANCODE_KP_MEMRECALL = 209,
- SDL_SCANCODE_KP_MEMCLEAR = 210,
- SDL_SCANCODE_KP_MEMADD = 211,
- SDL_SCANCODE_KP_MEMSUBTRACT = 212,
- SDL_SCANCODE_KP_MEMMULTIPLY = 213,
- SDL_SCANCODE_KP_MEMDIVIDE = 214,
- SDL_SCANCODE_KP_PLUSMINUS = 215,
- SDL_SCANCODE_KP_CLEAR = 216,
- SDL_SCANCODE_KP_CLEARENTRY = 217,
- SDL_SCANCODE_KP_BINARY = 218,
- SDL_SCANCODE_KP_OCTAL = 219,
- SDL_SCANCODE_KP_DECIMAL = 220,
- SDL_SCANCODE_KP_HEXADECIMAL = 221,
-
- SDL_SCANCODE_LCTRL = 224,
- SDL_SCANCODE_LSHIFT = 225,
- SDL_SCANCODE_LALT = 226, /**< alt, option */
- SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
- SDL_SCANCODE_RCTRL = 228,
- SDL_SCANCODE_RSHIFT = 229,
- SDL_SCANCODE_RALT = 230, /**< alt gr, option */
- SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
-
- SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
- * by any of the above, but since there's a
- * special KMOD_MODE for it I'm adding it here
- */
-
- /* @} *//* Usage page 0x07 */
-
- /**
- * \name Usage page 0x0C
- *
- * These values are mapped from usage page 0x0C (USB consumer page).
- */
- /* @{ */
-
- SDL_SCANCODE_AUDIONEXT = 258,
- SDL_SCANCODE_AUDIOPREV = 259,
- SDL_SCANCODE_AUDIOSTOP = 260,
- SDL_SCANCODE_AUDIOPLAY = 261,
- SDL_SCANCODE_AUDIOMUTE = 262,
- SDL_SCANCODE_MEDIASELECT = 263,
- SDL_SCANCODE_WWW = 264,
- SDL_SCANCODE_MAIL = 265,
- SDL_SCANCODE_CALCULATOR = 266,
- SDL_SCANCODE_COMPUTER = 267,
- SDL_SCANCODE_AC_SEARCH = 268,
- SDL_SCANCODE_AC_HOME = 269,
- SDL_SCANCODE_AC_BACK = 270,
- SDL_SCANCODE_AC_FORWARD = 271,
- SDL_SCANCODE_AC_STOP = 272,
- SDL_SCANCODE_AC_REFRESH = 273,
- SDL_SCANCODE_AC_BOOKMARKS = 274,
-
- /* @} *//* Usage page 0x0C */
-
- /**
- * \name Walther keys
- *
- * These are values that Christian Walther added (for mac keyboard?).
- */
- /* @{ */
-
- SDL_SCANCODE_BRIGHTNESSDOWN = 275,
- SDL_SCANCODE_BRIGHTNESSUP = 276,
- SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
- switch, video mode switch */
- SDL_SCANCODE_KBDILLUMTOGGLE = 278,
- SDL_SCANCODE_KBDILLUMDOWN = 279,
- SDL_SCANCODE_KBDILLUMUP = 280,
- SDL_SCANCODE_EJECT = 281,
- SDL_SCANCODE_SLEEP = 282,
-
- SDL_SCANCODE_APP1 = 283,
- SDL_SCANCODE_APP2 = 284,
-
- /* @} *//* Walther keys */
-
- /**
- * \name Usage page 0x0C (additional media keys)
- *
- * These values are mapped from usage page 0x0C (USB consumer page).
- */
- /* @{ */
-
- SDL_SCANCODE_AUDIOREWIND = 285,
- SDL_SCANCODE_AUDIOFASTFORWARD = 286,
-
- /* @} *//* Usage page 0x0C (additional media keys) */
-
- /* Add any other keys here. */
-
- SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
- for array bounds */
-} SDL_Scancode;
-
-#endif /* SDL_scancode_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_shape.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_shape.h
deleted file mode 100644
index 9e492d9..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_shape.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_shape_h_
-#define SDL_shape_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_pixels.h"
-#include "SDL_rect.h"
-#include "SDL_surface.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \file SDL_shape.h
- *
- * Header file for the shaped window API.
- */
-
-#define SDL_NONSHAPEABLE_WINDOW -1
-#define SDL_INVALID_SHAPE_ARGUMENT -2
-#define SDL_WINDOW_LACKS_SHAPE -3
-
-/**
- * \brief Create a window that can be shaped with the specified position, dimensions, and flags.
- *
- * \param title The title of the window, in UTF-8 encoding.
- * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param w The width of the window.
- * \param h The height of the window.
- * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
- * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
- * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
- * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
- *
- * \return The window created, or NULL if window creation failed.
- *
- * \sa SDL_DestroyWindow()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
-
-/**
- * \brief Return whether the given window is a shaped window.
- *
- * \param window The window to query for being shaped.
- *
- * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
- *
- * \sa SDL_CreateShapedWindow
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
-
-/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
-typedef enum {
- /** \brief The default mode, a binarized alpha cutoff of 1. */
- ShapeModeDefault,
- /** \brief A binarized alpha cutoff with a given integer value. */
- ShapeModeBinarizeAlpha,
- /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
- ShapeModeReverseBinarizeAlpha,
- /** \brief A color key is applied. */
- ShapeModeColorKey
-} WindowShapeMode;
-
-#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
-
-/** \brief A union containing parameters for shaped windows. */
-typedef union {
- /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
- Uint8 binarizationCutoff;
- SDL_Color colorKey;
-} SDL_WindowShapeParams;
-
-/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
-typedef struct SDL_WindowShapeMode {
- /** \brief The mode of these window-shape parameters. */
- WindowShapeMode mode;
- /** \brief Window-shape parameters. */
- SDL_WindowShapeParams parameters;
-} SDL_WindowShapeMode;
-
-/**
- * \brief Set the shape and parameters of a shaped window.
- *
- * \param window The shaped window whose parameters should be set.
- * \param shape A surface encoding the desired shape for the window.
- * \param shape_mode The parameters to set for the shaped window.
- *
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- * if the SDL_Window given does not reference a valid shaped window.
- *
- * \sa SDL_WindowShapeMode
- * \sa SDL_GetShapedWindowMode.
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
-
-/**
- * \brief Get the shape parameters of a shaped window.
- *
- * \param window The shaped window whose parameters should be retrieved.
- * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
- *
- * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
- * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- * the SDL_Window given is a shapeable window currently lacking a shape.
- *
- * \sa SDL_WindowShapeMode
- * \sa SDL_SetWindowShape
- */
-extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_shape_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_stdinc.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_stdinc.h
deleted file mode 100644
index 7240229..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_stdinc.h
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_stdinc.h
- *
- * This is a general header that includes C language support.
- */
-
-#ifndef SDL_stdinc_h_
-#define SDL_stdinc_h_
-
-#include "SDL_config.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if defined(STDC_HEADERS)
-# include <stdlib.h>
-# include <stddef.h>
-# include <stdarg.h>
-#else
-# if defined(HAVE_STDLIB_H)
-# include <stdlib.h>
-# elif defined(HAVE_MALLOC_H)
-# include <malloc.h>
-# endif
-# if defined(HAVE_STDDEF_H)
-# include <stddef.h>
-# endif
-# if defined(HAVE_STDARG_H)
-# include <stdarg.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-#if defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-#elif defined(HAVE_STDINT_H)
-# include <stdint.h>
-#endif
-#ifdef HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-#ifdef HAVE_MATH_H
-# if defined(__WINRT__)
-/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
- WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
- for more information.
-*/
-# define _USE_MATH_DEFINES
-# endif
-# include <math.h>
-#endif
-#ifdef HAVE_FLOAT_H
-# include <float.h>
-#endif
-
-/**
- * The number of elements in an array.
- */
-#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
-#define SDL_TABLESIZE(table) SDL_arraysize(table)
-
-/**
- * Macro useful for building other macros with strings in them
- *
- * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
- */
-#define SDL_STRINGIFY_ARG(arg) #arg
-
-/**
- * \name Cast operators
- *
- * Use proper C++ casts when compiled as C++ to be compatible with the option
- * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
- */
-/* @{ */
-#ifdef __cplusplus
-#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
-#define SDL_static_cast(type, expression) static_cast<type>(expression)
-#define SDL_const_cast(type, expression) const_cast<type>(expression)
-#else
-#define SDL_reinterpret_cast(type, expression) ((type)(expression))
-#define SDL_static_cast(type, expression) ((type)(expression))
-#define SDL_const_cast(type, expression) ((type)(expression))
-#endif
-/* @} *//* Cast operators */
-
-/* Define a four character code as a Uint32 */
-#define SDL_FOURCC(A, B, C, D) \
- ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
- (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
- (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
- (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
-
-/**
- * \name Basic data types
- */
-/* @{ */
-
-#ifdef __CC_ARM
-/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
-#define SDL_FALSE 0
-#define SDL_TRUE 1
-typedef int SDL_bool;
-#else
-typedef enum
-{
- SDL_FALSE = 0,
- SDL_TRUE = 1
-} SDL_bool;
-#endif
-
-/**
- * \brief A signed 8-bit integer type.
- */
-#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
-#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
-typedef int8_t Sint8;
-/**
- * \brief An unsigned 8-bit integer type.
- */
-#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
-#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
-typedef uint8_t Uint8;
-/**
- * \brief A signed 16-bit integer type.
- */
-#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
-#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
-typedef int16_t Sint16;
-/**
- * \brief An unsigned 16-bit integer type.
- */
-#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
-#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
-typedef uint16_t Uint16;
-/**
- * \brief A signed 32-bit integer type.
- */
-#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
-#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
-typedef int32_t Sint32;
-/**
- * \brief An unsigned 32-bit integer type.
- */
-#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
-#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
-typedef uint32_t Uint32;
-
-/**
- * \brief A signed 64-bit integer type.
- */
-#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
-#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
-typedef int64_t Sint64;
-/**
- * \brief An unsigned 64-bit integer type.
- */
-#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
-#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
-typedef uint64_t Uint64;
-
-/* @} *//* Basic data types */
-
-/* Make sure we have macros for printing 64 bit values.
- * <stdint.h> should define these but this is not true all platforms.
- * (for example win32) */
-#ifndef SDL_PRIs64
-#ifdef PRIs64
-#define SDL_PRIs64 PRIs64
-#elif defined(__WIN32__)
-#define SDL_PRIs64 "I64d"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIs64 "ld"
-#else
-#define SDL_PRIs64 "lld"
-#endif
-#endif
-#ifndef SDL_PRIu64
-#ifdef PRIu64
-#define SDL_PRIu64 PRIu64
-#elif defined(__WIN32__)
-#define SDL_PRIu64 "I64u"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIu64 "lu"
-#else
-#define SDL_PRIu64 "llu"
-#endif
-#endif
-#ifndef SDL_PRIx64
-#ifdef PRIx64
-#define SDL_PRIx64 PRIx64
-#elif defined(__WIN32__)
-#define SDL_PRIx64 "I64x"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIx64 "lx"
-#else
-#define SDL_PRIx64 "llx"
-#endif
-#endif
-#ifndef SDL_PRIX64
-#ifdef PRIX64
-#define SDL_PRIX64 PRIX64
-#elif defined(__WIN32__)
-#define SDL_PRIX64 "I64X"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIX64 "lX"
-#else
-#define SDL_PRIX64 "llX"
-#endif
-#endif
-
-/* Annotations to help code analysis tools */
-#ifdef SDL_DISABLE_ANALYZE_MACROS
-#define SDL_IN_BYTECAP(x)
-#define SDL_INOUT_Z_CAP(x)
-#define SDL_OUT_Z_CAP(x)
-#define SDL_OUT_CAP(x)
-#define SDL_OUT_BYTECAP(x)
-#define SDL_OUT_Z_BYTECAP(x)
-#define SDL_PRINTF_FORMAT_STRING
-#define SDL_SCANF_FORMAT_STRING
-#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
-#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
-#else
-#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
-#include <sal.h>
-
-#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
-#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
-#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
-#define SDL_OUT_CAP(x) _Out_cap_(x)
-#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
-#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
-
-#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
-#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
-#else
-#define SDL_IN_BYTECAP(x)
-#define SDL_INOUT_Z_CAP(x)
-#define SDL_OUT_Z_CAP(x)
-#define SDL_OUT_CAP(x)
-#define SDL_OUT_BYTECAP(x)
-#define SDL_OUT_Z_BYTECAP(x)
-#define SDL_PRINTF_FORMAT_STRING
-#define SDL_SCANF_FORMAT_STRING
-#endif
-#if defined(__GNUC__)
-#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
-#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
-#else
-#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
-#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
-#endif
-#endif /* SDL_DISABLE_ANALYZE_MACROS */
-
-#define SDL_COMPILE_TIME_ASSERT(name, x) \
- typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
-/** \cond */
-#ifndef DOXYGEN_SHOULD_IGNORE_THIS
-SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
-SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
-SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
-SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
-SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
-SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
-SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
-SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
-#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
-/** \endcond */
-
-/* Check to make sure enums are the size of ints, for structure packing.
- For both Watcom C/C++ and Borland C/C++ the compiler option that makes
- enums having the size of an int must be enabled.
- This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
-*/
-
-/** \cond */
-#ifndef DOXYGEN_SHOULD_IGNORE_THIS
-#if !defined(__ANDROID__)
- /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
-typedef enum
-{
- DUMMY_ENUM_VALUE
-} SDL_DUMMY_ENUM;
-
-SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
-#endif
-#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
-/** \endcond */
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(HAVE_ALLOCA) && !defined(alloca)
-# if defined(HAVE_ALLOCA_H)
-# include <alloca.h>
-# elif defined(__GNUC__)
-# define alloca __builtin_alloca
-# elif defined(_MSC_VER)
-# include <malloc.h>
-# define alloca _alloca
-# elif defined(__WATCOMC__)
-# include <malloc.h>
-# elif defined(__BORLANDC__)
-# include <malloc.h>
-# elif defined(__DMC__)
-# include <stdlib.h>
-# elif defined(__AIX__)
-#pragma alloca
-# elif defined(__MRC__)
-void *alloca(unsigned);
-# else
-char *alloca();
-# endif
-#endif
-#ifdef HAVE_ALLOCA
-#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
-#define SDL_stack_free(data)
-#else
-#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
-#define SDL_stack_free(data) SDL_free(data)
-#endif
-
-extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
-extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
-extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
-extern DECLSPEC void SDLCALL SDL_free(void *mem);
-
-typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
-typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
-typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
-typedef void (SDLCALL *SDL_free_func)(void *mem);
-
-/**
- * \brief Get the current set of SDL memory functions
- */
-extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
- SDL_calloc_func *calloc_func,
- SDL_realloc_func *realloc_func,
- SDL_free_func *free_func);
-
-/**
- * \brief Replace SDL's memory allocation functions with a custom set
- *
- * \note If you are replacing SDL's memory functions, you should call
- * SDL_GetNumAllocations() and be very careful if it returns non-zero.
- * That means that your free function will be called with memory
- * allocated by the previous memory allocation functions.
- */
-extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
- SDL_calloc_func calloc_func,
- SDL_realloc_func realloc_func,
- SDL_free_func free_func);
-
-/**
- * \brief Get the number of outstanding (unfreed) allocations
- */
-extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
-
-extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
-extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
-
-extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
-
-extern DECLSPEC int SDLCALL SDL_abs(int x);
-
-/* !!! FIXME: these have side effects. You probably shouldn't use them. */
-/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
-#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
-#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
-
-extern DECLSPEC int SDLCALL SDL_isdigit(int x);
-extern DECLSPEC int SDLCALL SDL_isspace(int x);
-extern DECLSPEC int SDLCALL SDL_toupper(int x);
-extern DECLSPEC int SDLCALL SDL_tolower(int x);
-
-extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
-
-#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
-#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
-
-/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
-SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
-{
-#if defined(__GNUC__) && defined(i386)
- int u0, u1, u2;
- __asm__ __volatile__ (
- "cld \n\t"
- "rep ; stosl \n\t"
- : "=&D" (u0), "=&a" (u1), "=&c" (u2)
- : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
- : "memory"
- );
-#else
- size_t _n = (dwords + 3) / 4;
- Uint32 *_p = SDL_static_cast(Uint32 *, dst);
- Uint32 _val = (val);
- if (dwords == 0)
- return;
- switch (dwords % 4)
- {
- case 0: do { *_p++ = _val; /* fallthrough */
- case 3: *_p++ = _val; /* fallthrough */
- case 2: *_p++ = _val; /* fallthrough */
- case 1: *_p++ = _val; /* fallthrough */
- } while ( --_n );
- }
-#endif
-}
-
-
-extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
-
-extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
-extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
-
-extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
-extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
-extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
-extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
-
-extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
-extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
-extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
-extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
-extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
-extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
-extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
-extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
-extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
-extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
-extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
-extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
-
-extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
-
-extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
-extern DECLSPEC double SDLCALL SDL_atof(const char *str);
-extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
-extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
-extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
-extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
-extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
-
-extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
-extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
-extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
-extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
-
-extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
-extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
-extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
-extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
-
-#ifndef HAVE_M_PI
-#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327950288 /**< pi */
-#endif
-#endif
-
-extern DECLSPEC double SDLCALL SDL_acos(double x);
-extern DECLSPEC double SDLCALL SDL_asin(double x);
-extern DECLSPEC double SDLCALL SDL_atan(double x);
-extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
-extern DECLSPEC double SDLCALL SDL_ceil(double x);
-extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
-extern DECLSPEC double SDLCALL SDL_cos(double x);
-extern DECLSPEC float SDLCALL SDL_cosf(float x);
-extern DECLSPEC double SDLCALL SDL_fabs(double x);
-extern DECLSPEC double SDLCALL SDL_floor(double x);
-extern DECLSPEC double SDLCALL SDL_log(double x);
-extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
-extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
-extern DECLSPEC double SDLCALL SDL_sin(double x);
-extern DECLSPEC float SDLCALL SDL_sinf(float x);
-extern DECLSPEC double SDLCALL SDL_sqrt(double x);
-extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
-extern DECLSPEC double SDLCALL SDL_tan(double x);
-extern DECLSPEC float SDLCALL SDL_tanf(float x);
-
-/* The SDL implementation of iconv() returns these error codes */
-#define SDL_ICONV_ERROR (size_t)-1
-#define SDL_ICONV_E2BIG (size_t)-2
-#define SDL_ICONV_EILSEQ (size_t)-3
-#define SDL_ICONV_EINVAL (size_t)-4
-
-/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
-typedef struct _SDL_iconv_t *SDL_iconv_t;
-extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
- const char *fromcode);
-extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
-extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
- size_t * inbytesleft, char **outbuf,
- size_t * outbytesleft);
-/**
- * This function converts a string between encodings in one pass, returning a
- * string that must be freed with SDL_free() or NULL on error.
- */
-extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
- const char *fromcode,
- const char *inbuf,
- size_t inbytesleft);
-#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
-
-/* force builds using Clang's static analysis tools to use literal C runtime
- here, since there are possibly tests that are ineffective otherwise. */
-#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
-#define SDL_malloc malloc
-#define SDL_calloc calloc
-#define SDL_realloc realloc
-#define SDL_free free
-#define SDL_memset memset
-#define SDL_memcpy memcpy
-#define SDL_memmove memmove
-#define SDL_memcmp memcmp
-#define SDL_strlen strlen
-#define SDL_strlcpy strlcpy
-#define SDL_strlcat strlcat
-#define SDL_strdup strdup
-#define SDL_strchr strchr
-#define SDL_strrchr strrchr
-#define SDL_strstr strstr
-#define SDL_strcmp strcmp
-#define SDL_strncmp strncmp
-#define SDL_strcasecmp strcasecmp
-#define SDL_strncasecmp strncasecmp
-#define SDL_sscanf sscanf
-#define SDL_vsscanf vsscanf
-#define SDL_snprintf snprintf
-#define SDL_vsnprintf vsnprintf
-#endif
-
-SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
-{
- return SDL_memcpy(dst, src, dwords * 4);
-}
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_stdinc_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_surface.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_surface.h
deleted file mode 100644
index 510690c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_surface.h
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_surface.h
- *
- * Header file for ::SDL_Surface definition and management functions.
- */
-
-#ifndef SDL_surface_h_
-#define SDL_surface_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_pixels.h"
-#include "SDL_rect.h"
-#include "SDL_blendmode.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name Surface flags
- *
- * These are the currently supported flags for the ::SDL_Surface.
- *
- * \internal
- * Used internally (read-only).
- */
-/* @{ */
-#define SDL_SWSURFACE 0 /**< Just here for compatibility */
-#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
-#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
-#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
-/* @} *//* Surface flags */
-
-/**
- * Evaluates to true if the surface needs to be locked before access.
- */
-#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
-
-/**
- * \brief A collection of pixels used in software blitting.
- *
- * \note This structure should be treated as read-only, except for \c pixels,
- * which, if not NULL, contains the raw pixel data for the surface.
- */
-typedef struct SDL_Surface
-{
- Uint32 flags; /**< Read-only */
- SDL_PixelFormat *format; /**< Read-only */
- int w, h; /**< Read-only */
- int pitch; /**< Read-only */
- void *pixels; /**< Read-write */
-
- /** Application data associated with the surface */
- void *userdata; /**< Read-write */
-
- /** information needed for surfaces requiring locks */
- int locked; /**< Read-only */
- void *lock_data; /**< Read-only */
-
- /** clipping information */
- SDL_Rect clip_rect; /**< Read-only */
-
- /** info for fast blit mapping to other surfaces */
- struct SDL_BlitMap *map; /**< Private */
-
- /** Reference count -- used when freeing surface */
- int refcount; /**< Read-mostly */
-} SDL_Surface;
-
-/**
- * \brief The type of function used for surface blitting functions.
- */
-typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
- struct SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * Allocate and free an RGB surface.
- *
- * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
- * If the depth is greater than 8 bits, the pixel format is set using the
- * flags '[RGB]mask'.
- *
- * If the function runs out of memory, it will return NULL.
- *
- * \param flags The \c flags are obsolete and should be set to 0.
- * \param width The width in pixels of the surface to create.
- * \param height The height in pixels of the surface to create.
- * \param depth The depth in bits of the surface to create.
- * \param Rmask The red mask of the surface to create.
- * \param Gmask The green mask of the surface to create.
- * \param Bmask The blue mask of the surface to create.
- * \param Amask The alpha mask of the surface to create.
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
- (Uint32 flags, int width, int height, int depth,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
-
-/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
- (Uint32 flags, int width, int height, int depth, Uint32 format);
-
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
- int width,
- int height,
- int depth,
- int pitch,
- Uint32 Rmask,
- Uint32 Gmask,
- Uint32 Bmask,
- Uint32 Amask);
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
- (void *pixels, int width, int height, int depth, int pitch, Uint32 format);
-extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
-
-/**
- * \brief Set the palette used by a surface.
- *
- * \return 0, or -1 if the surface format doesn't use a palette.
- *
- * \note A single palette can be shared with many surfaces.
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
- SDL_Palette * palette);
-
-/**
- * \brief Sets up a surface for directly accessing the pixels.
- *
- * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
- * to and read from \c surface->pixels, using the pixel format stored in
- * \c surface->format. Once you are done accessing the surface, you should
- * use SDL_UnlockSurface() to release it.
- *
- * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
- * to 0, then you can read and write to the surface at any time, and the
- * pixel format of the surface will not change.
- *
- * No operating system or library calls should be made between lock/unlock
- * pairs, as critical system locks may be held during this time.
- *
- * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
- *
- * \sa SDL_UnlockSurface()
- */
-extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
-/** \sa SDL_LockSurface() */
-extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
-
-/**
- * Load a surface from a seekable SDL data stream (memory or file).
- *
- * If \c freesrc is non-zero, the stream will be closed after being read.
- *
- * The new surface should be freed with SDL_FreeSurface().
- *
- * \return the new surface, or NULL if there was an error.
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
- int freesrc);
-
-/**
- * Load a surface from a file.
- *
- * Convenience macro.
- */
-#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
-
-/**
- * Save a surface to a seekable SDL data stream (memory or file).
- *
- * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
- * BMP directly. Other RGB formats with 8-bit or higher get converted to a
- * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
- * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
- * not supported.
- *
- * If \c freedst is non-zero, the stream will be closed after being written.
- *
- * \return 0 if successful or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
- (SDL_Surface * surface, SDL_RWops * dst, int freedst);
-
-/**
- * Save a surface to a file.
- *
- * Convenience macro.
- */
-#define SDL_SaveBMP(surface, file) \
- SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
-
-/**
- * \brief Sets the RLE acceleration hint for a surface.
- *
- * \return 0 on success, or -1 if the surface is not valid
- *
- * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
- * but the surface must be locked before directly accessing the pixels.
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
- int flag);
-
-/**
- * \brief Sets the color key (transparent pixel) in a blittable surface.
- *
- * \param surface The surface to update
- * \param flag Non-zero to enable colorkey and 0 to disable colorkey
- * \param key The transparent pixel in the native surface format
- *
- * \return 0 on success, or -1 if the surface is not valid
- *
- * You can pass SDL_RLEACCEL to enable RLE accelerated blits.
- */
-extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
- int flag, Uint32 key);
-
-/**
- * \brief Gets the color key (transparent pixel) in a blittable surface.
- *
- * \param surface The surface to update
- * \param key A pointer filled in with the transparent pixel in the native
- * surface format
- *
- * \return 0 on success, or -1 if the surface is not valid or colorkey is not
- * enabled.
- */
-extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
- Uint32 * key);
-
-/**
- * \brief Set an additional color value used in blit operations.
- *
- * \param surface The surface to update.
- * \param r The red color value multiplied into blit operations.
- * \param g The green color value multiplied into blit operations.
- * \param b The blue color value multiplied into blit operations.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_GetSurfaceColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
- Uint8 r, Uint8 g, Uint8 b);
-
-
-/**
- * \brief Get the additional color value used in blit operations.
- *
- * \param surface The surface to query.
- * \param r A pointer filled in with the current red color value.
- * \param g A pointer filled in with the current green color value.
- * \param b A pointer filled in with the current blue color value.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_SetSurfaceColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
- Uint8 * r, Uint8 * g,
- Uint8 * b);
-
-/**
- * \brief Set an additional alpha value used in blit operations.
- *
- * \param surface The surface to update.
- * \param alpha The alpha value multiplied into blit operations.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_GetSurfaceAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
- Uint8 alpha);
-
-/**
- * \brief Get the additional alpha value used in blit operations.
- *
- * \param surface The surface to query.
- * \param alpha A pointer filled in with the current alpha value.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_SetSurfaceAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
- Uint8 * alpha);
-
-/**
- * \brief Set the blend mode used for blit operations.
- *
- * \param surface The surface to update.
- * \param blendMode ::SDL_BlendMode to use for blit blending.
- *
- * \return 0 on success, or -1 if the parameters are not valid.
- *
- * \sa SDL_GetSurfaceBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
- SDL_BlendMode blendMode);
-
-/**
- * \brief Get the blend mode used for blit operations.
- *
- * \param surface The surface to query.
- * \param blendMode A pointer filled in with the current blend mode.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_SetSurfaceBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
- SDL_BlendMode *blendMode);
-
-/**
- * Sets the clipping rectangle for the destination surface in a blit.
- *
- * If the clip rectangle is NULL, clipping will be disabled.
- *
- * If the clip rectangle doesn't intersect the surface, the function will
- * return SDL_FALSE and blits will be completely clipped. Otherwise the
- * function returns SDL_TRUE and blits to the surface will be clipped to
- * the intersection of the surface area and the clipping rectangle.
- *
- * Note that blits are automatically clipped to the edges of the source
- * and destination surfaces.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
- const SDL_Rect * rect);
-
-/**
- * Gets the clipping rectangle for the destination surface in a blit.
- *
- * \c rect must be a pointer to a valid rectangle which will be filled
- * with the correct values.
- */
-extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
- SDL_Rect * rect);
-
-/*
- * Creates a new surface identical to the existing surface
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
-
-/**
- * Creates a new surface of the specified format, and then copies and maps
- * the given surface to it so the blit of the converted surface will be as
- * fast as possible. If this function fails, it returns NULL.
- *
- * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
- * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and
- * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
- * surface.
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
- (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags);
-extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
- (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
-
-/**
- * \brief Copy a block of pixels of one format to another format
- *
- * \return 0 on success, or -1 if there was an error
- */
-extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
- Uint32 src_format,
- const void * src, int src_pitch,
- Uint32 dst_format,
- void * dst, int dst_pitch);
-
-/**
- * Performs a fast fill of the given rectangle with \c color.
- *
- * If \c rect is NULL, the whole surface will be filled with \c color.
- *
- * The color should be a pixel of the format used by the surface, and
- * can be generated by the SDL_MapRGB() function.
- *
- * \return 0 on success, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_FillRect
- (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
-extern DECLSPEC int SDLCALL SDL_FillRects
- (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
-
-/**
- * Performs a fast blit from the source surface to the destination surface.
- *
- * This assumes that the source and destination rectangles are
- * the same size. If either \c srcrect or \c dstrect are NULL, the entire
- * surface (\c src or \c dst) is copied. The final blit rectangles are saved
- * in \c srcrect and \c dstrect after all clipping is performed.
- *
- * \return If the blit is successful, it returns 0, otherwise it returns -1.
- *
- * The blit function should not be called on a locked surface.
- *
- * The blit semantics for surfaces with and without blending and colorkey
- * are defined as follows:
- * \verbatim
- RGBA->RGB:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source alpha-channel and per-surface alpha)
- SDL_SRCCOLORKEY ignored.
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB.
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- RGB values of the source color key, ignoring alpha in the
- comparison.
-
- RGB->RGBA:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source per-surface alpha)
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB, set destination alpha to source per-surface alpha value.
- both:
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- source color key.
-
- RGBA->RGBA:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source alpha-channel and per-surface alpha)
- SDL_SRCCOLORKEY ignored.
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy all of RGBA to the destination.
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- RGB values of the source color key, ignoring alpha in the
- comparison.
-
- RGB->RGB:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source per-surface alpha)
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB.
- both:
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- source color key.
- \endverbatim
- *
- * You should call SDL_BlitSurface() unless you know exactly how SDL
- * blitting works internally and how to use the other blit functions.
- */
-#define SDL_BlitSurface SDL_UpperBlit
-
-/**
- * This is the public blit function, SDL_BlitSurface(), and it performs
- * rectangle validation and clipping before passing it to SDL_LowerBlit()
- */
-extern DECLSPEC int SDLCALL SDL_UpperBlit
- (SDL_Surface * src, const SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * This is a semi-private blit function and it performs low-level surface
- * blitting only.
- */
-extern DECLSPEC int SDLCALL SDL_LowerBlit
- (SDL_Surface * src, SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * \brief Perform a fast, low quality, stretch blit between two surfaces of the
- * same pixel format.
- *
- * \note This function uses a static buffer, and is not thread-safe.
- */
-extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
- const SDL_Rect * srcrect,
- SDL_Surface * dst,
- const SDL_Rect * dstrect);
-
-#define SDL_BlitScaled SDL_UpperBlitScaled
-
-/**
- * This is the public scaled blit function, SDL_BlitScaled(), and it performs
- * rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
- */
-extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
- (SDL_Surface * src, const SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * This is a semi-private blit function and it performs low-level surface
- * scaled blitting only.
- */
-extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
- (SDL_Surface * src, SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_surface_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_system.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_system.h
deleted file mode 100644
index eb069b3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_system.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_system.h
- *
- * Include file for platform specific SDL API functions
- */
-
-#ifndef SDL_system_h_
-#define SDL_system_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_keyboard.h"
-#include "SDL_render.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Platform specific functions for Windows */
-#ifdef __WIN32__
-
-/**
- \brief Set a function that is called for every windows message, before TranslateMessage()
-*/
-typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
-extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
-
-/**
- \brief Returns the D3D9 adapter index that matches the specified display index.
-
- This adapter index can be passed to IDirect3D9::CreateDevice and controls
- on which monitor a full screen application will appear.
-*/
-extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
-
-typedef struct IDirect3DDevice9 IDirect3DDevice9;
-/**
- \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer.
-
- Once you are done using the device, you should release it to avoid a resource leak.
- */
-extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
-
-/**
- \brief Returns the DXGI Adapter and Output indices for the specified display index.
-
- These can be passed to EnumAdapters and EnumOutputs respectively to get the objects
- required to create a DX10 or DX11 device and swap chain.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
-
-#endif /* __WIN32__ */
-
-
-/* Platform specific functions for iOS */
-#if defined(__IPHONEOS__) && __IPHONEOS__
-
-#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
-extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
-
-#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
-extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
-
-#endif /* __IPHONEOS__ */
-
-
-/* Platform specific functions for Android */
-#if defined(__ANDROID__) && __ANDROID__
-
-/**
- \brief Get the JNI environment for the current thread
-
- This returns JNIEnv*, but the prototype is void* so we don't need jni.h
- */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
-
-/**
- \brief Get the SDL Activity object for the application
-
- This returns jobject, but the prototype is void* so we don't need jni.h
- The jobject returned by SDL_AndroidGetActivity is a local reference.
- It is the caller's responsibility to properly release it
- (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
- */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
-
-/**
- See the official Android developer guide for more information:
- http://developer.android.com/guide/topics/data/data-storage.html
-*/
-#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
-#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
-
-/**
- \brief Get the path used for internal storage for this application.
-
- This path is unique to your application and cannot be written to
- by other applications.
- */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
-
-/**
- \brief Get the current state of external storage, a bitmask of these values:
- SDL_ANDROID_EXTERNAL_STORAGE_READ
- SDL_ANDROID_EXTERNAL_STORAGE_WRITE
-
- If external storage is currently unavailable, this will return 0.
-*/
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
-
-/**
- \brief Get the path used for external storage for this application.
-
- This path is unique to your application, but is public and can be
- written to by other applications.
- */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
-
-#endif /* __ANDROID__ */
-
-/* Platform specific functions for WinRT */
-#if defined(__WINRT__) && __WINRT__
-
-/**
- * \brief WinRT / Windows Phone path types
- */
-typedef enum
-{
- /** \brief The installed app's root directory.
- Files here are likely to be read-only. */
- SDL_WINRT_PATH_INSTALLED_LOCATION,
-
- /** \brief The app's local data store. Files may be written here */
- SDL_WINRT_PATH_LOCAL_FOLDER,
-
- /** \brief The app's roaming data store. Unsupported on Windows Phone.
- Files written here may be copied to other machines via a network
- connection.
- */
- SDL_WINRT_PATH_ROAMING_FOLDER,
-
- /** \brief The app's temporary data store. Unsupported on Windows Phone.
- Files written here may be deleted at any time. */
- SDL_WINRT_PATH_TEMP_FOLDER
-} SDL_WinRT_Path;
-
-
-/**
- * \brief Retrieves a WinRT defined path on the local file system
- *
- * \note Documentation on most app-specific path types on WinRT
- * can be found on MSDN, at the URL:
- * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
- *
- * \param pathType The type of path to retrieve.
- * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
- * if the path is not available for any reason. Not all paths are
- * available on all versions of Windows. This is especially true on
- * Windows Phone. Check the documentation for the given
- * SDL_WinRT_Path for more information on which path types are
- * supported where.
- */
-extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
-
-/**
- * \brief Retrieves a WinRT defined path on the local file system
- *
- * \note Documentation on most app-specific path types on WinRT
- * can be found on MSDN, at the URL:
- * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
- *
- * \param pathType The type of path to retrieve.
- * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
- * if the path is not available for any reason. Not all paths are
- * available on all versions of Windows. This is especially true on
- * Windows Phone. Check the documentation for the given
- * SDL_WinRT_Path for more information on which path types are
- * supported where.
- */
-extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
-
-#endif /* __WINRT__ */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_system_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_syswm.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_syswm.h
deleted file mode 100644
index 2d18afb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_syswm.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_syswm.h
- *
- * Include file for SDL custom system window manager hooks.
- */
-
-#ifndef SDL_syswm_h_
-#define SDL_syswm_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-#include "SDL_version.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_syswm.h
- *
- * Your application has access to a special type of event ::SDL_SYSWMEVENT,
- * which contains window-manager specific information and arrives whenever
- * an unhandled window event occurs. This event is ignored by default, but
- * you can enable it with SDL_EventState().
- */
-#ifdef SDL_PROTOTYPES_ONLY
-struct SDL_SysWMinfo;
-#else
-
-#if defined(SDL_VIDEO_DRIVER_WINDOWS)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_WINRT)
-#include <Inspectable.h>
-#endif
-
-/* This is the structure for custom window manager events */
-#if defined(SDL_VIDEO_DRIVER_X11)
-#if defined(__APPLE__) && defined(__MACH__)
-/* conflicts with Quickdraw.h */
-#define Cursor X11Cursor
-#endif
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#if defined(__APPLE__) && defined(__MACH__)
-/* matches the re-define above */
-#undef Cursor
-#endif
-
-#endif /* defined(SDL_VIDEO_DRIVER_X11) */
-
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
-#include <directfb.h>
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_COCOA)
-#ifdef __OBJC__
-@class NSWindow;
-#else
-typedef struct _NSWindow NSWindow;
-#endif
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_UIKIT)
-#ifdef __OBJC__
-#include <UIKit/UIKit.h>
-#else
-typedef struct _UIWindow UIWindow;
-typedef struct _UIViewController UIViewController;
-#endif
-typedef Uint32 GLuint;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_ANDROID)
-typedef struct ANativeWindow ANativeWindow;
-typedef void *EGLSurface;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_VIVANTE)
-#include "SDL_egl.h"
-#endif
-
-/**
- * These are the various supported windowing subsystems
- */
-typedef enum
-{
- SDL_SYSWM_UNKNOWN,
- SDL_SYSWM_WINDOWS,
- SDL_SYSWM_X11,
- SDL_SYSWM_DIRECTFB,
- SDL_SYSWM_COCOA,
- SDL_SYSWM_UIKIT,
- SDL_SYSWM_WAYLAND,
- SDL_SYSWM_MIR,
- SDL_SYSWM_WINRT,
- SDL_SYSWM_ANDROID,
- SDL_SYSWM_VIVANTE,
- SDL_SYSWM_OS2
-} SDL_SYSWM_TYPE;
-
-/**
- * The custom event structure.
- */
-struct SDL_SysWMmsg
-{
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union
- {
-#if defined(SDL_VIDEO_DRIVER_WINDOWS)
- struct {
- HWND hwnd; /**< The window for the message */
- UINT msg; /**< The type of message */
- WPARAM wParam; /**< WORD message parameter */
- LPARAM lParam; /**< LONG message parameter */
- } win;
-#endif
-#if defined(SDL_VIDEO_DRIVER_X11)
- struct {
- XEvent event;
- } x11;
-#endif
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
- struct {
- DFBEvent event;
- } dfb;
-#endif
-#if defined(SDL_VIDEO_DRIVER_COCOA)
- struct
- {
- /* Latest version of Xcode clang complains about empty structs in C v. C++:
- error: empty struct has size 0 in C, size 1 in C++
- */
- int dummy;
- /* No Cocoa window events yet */
- } cocoa;
-#endif
-#if defined(SDL_VIDEO_DRIVER_UIKIT)
- struct
- {
- int dummy;
- /* No UIKit window events yet */
- } uikit;
-#endif
-#if defined(SDL_VIDEO_DRIVER_VIVANTE)
- struct
- {
- int dummy;
- /* No Vivante window events yet */
- } vivante;
-#endif
- /* Can't have an empty union */
- int dummy;
- } msg;
-};
-
-/**
- * The custom window manager information structure.
- *
- * When this structure is returned, it holds information about which
- * low level system it is using, and will be one of SDL_SYSWM_TYPE.
- */
-struct SDL_SysWMinfo
-{
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union
- {
-#if defined(SDL_VIDEO_DRIVER_WINDOWS)
- struct
- {
- HWND window; /**< The window handle */
- HDC hdc; /**< The window device context */
- HINSTANCE hinstance; /**< The instance handle */
- } win;
-#endif
-#if defined(SDL_VIDEO_DRIVER_WINRT)
- struct
- {
- IInspectable * window; /**< The WinRT CoreWindow */
- } winrt;
-#endif
-#if defined(SDL_VIDEO_DRIVER_X11)
- struct
- {
- Display *display; /**< The X11 display */
- Window window; /**< The X11 window */
- } x11;
-#endif
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
- struct
- {
- IDirectFB *dfb; /**< The directfb main interface */
- IDirectFBWindow *window; /**< The directfb window handle */
- IDirectFBSurface *surface; /**< The directfb client surface */
- } dfb;
-#endif
-#if defined(SDL_VIDEO_DRIVER_COCOA)
- struct
- {
-#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- NSWindow __unsafe_unretained *window; /**< The Cocoa window */
-#else
- NSWindow *window; /**< The Cocoa window */
-#endif
- } cocoa;
-#endif
-#if defined(SDL_VIDEO_DRIVER_UIKIT)
- struct
- {
-#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- UIWindow __unsafe_unretained *window; /**< The UIKit window */
-#else
- UIWindow *window; /**< The UIKit window */
-#endif
- GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
- GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
- GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
- } uikit;
-#endif
-#if defined(SDL_VIDEO_DRIVER_WAYLAND)
- struct
- {
- struct wl_display *display; /**< Wayland display */
- struct wl_surface *surface; /**< Wayland surface */
- struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
- } wl;
-#endif
-#if defined(SDL_VIDEO_DRIVER_MIR)
- struct
- {
- struct MirConnection *connection; /**< Mir display server connection */
- struct MirSurface *surface; /**< Mir surface */
- } mir;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_ANDROID)
- struct
- {
- ANativeWindow *window;
- EGLSurface surface;
- } android;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_VIVANTE)
- struct
- {
- EGLNativeDisplayType display;
- EGLNativeWindowType window;
- } vivante;
-#endif
-
- /* Make sure this union is always 64 bytes (8 64-bit pointers). */
- /* Be careful not to overflow this if you add a new target! */
- Uint8 dummy[64];
- } info;
-};
-
-#endif /* SDL_PROTOTYPES_ONLY */
-
-typedef struct SDL_SysWMinfo SDL_SysWMinfo;
-
-/* Function prototypes */
-/**
- * \brief This function allows access to driver-dependent window information.
- *
- * \param window The window about which information is being requested
- * \param info This structure must be initialized with the SDL version, and is
- * then filled in with information about the given window.
- *
- * \return SDL_TRUE if the function is implemented and the version member of
- * the \c info struct is valid, SDL_FALSE otherwise.
- *
- * You typically use this function like this:
- * \code
- * SDL_SysWMinfo info;
- * SDL_VERSION(&info.version);
- * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
- * \endcode
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
- SDL_SysWMinfo * info);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_syswm_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test.h
deleted file mode 100644
index f55afcb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-#ifndef SDL_test_h_
-#define SDL_test_h_
-
-#include "SDL.h"
-#include "SDL_test_assert.h"
-#include "SDL_test_common.h"
-#include "SDL_test_compare.h"
-#include "SDL_test_crc32.h"
-#include "SDL_test_font.h"
-#include "SDL_test_fuzzer.h"
-#include "SDL_test_harness.h"
-#include "SDL_test_images.h"
-#include "SDL_test_log.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_memory.h"
-#include "SDL_test_random.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Global definitions */
-
-/*
- * Note: Maximum size of SDLTest log message is less than SDL's limit
- * to ensure we can fit additional information such as the timestamp.
- */
-#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_assert.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_assert.h
deleted file mode 100644
index 11d8363..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_assert.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_assert.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- *
- * Assert API for test code and test cases
- *
- */
-
-#ifndef SDL_test_assert_h_
-#define SDL_test_assert_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Fails the assert.
- */
-#define ASSERT_FAIL 0
-
-/**
- * \brief Passes the assert.
- */
-#define ASSERT_PASS 1
-
-/**
- * \brief Assert that logs and break execution flow on failures.
- *
- * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
- * \param assertDescription Message to log with the assert describing it.
- */
-void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
- *
- * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
- * \param assertDescription Message to log with the assert describing it.
- *
- * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
- */
-int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
- *
- * \param assertDescription Message to log with the assert describing it.
- */
-void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/**
- * \brief Resets the assert summary counters to zero.
- */
-void SDLTest_ResetAssertSummary(void);
-
-/**
- * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
- */
-void SDLTest_LogAssertSummary(void);
-
-
-/**
- * \brief Converts the current assert summary state to a test result.
- *
- * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
- */
-int SDLTest_AssertSummaryToTestResult(void);
-
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_assert_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_common.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_common.h
deleted file mode 100644
index 24eeb32..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_common.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_common.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/* Ported from original test\common.h file. */
-
-#ifndef SDL_test_common_h_
-#define SDL_test_common_h_
-
-#include "SDL.h"
-
-#if defined(__PSP__)
-#define DEFAULT_WINDOW_WIDTH 480
-#define DEFAULT_WINDOW_HEIGHT 272
-#else
-#define DEFAULT_WINDOW_WIDTH 640
-#define DEFAULT_WINDOW_HEIGHT 480
-#endif
-
-#define VERBOSE_VIDEO 0x00000001
-#define VERBOSE_MODES 0x00000002
-#define VERBOSE_RENDER 0x00000004
-#define VERBOSE_EVENT 0x00000008
-#define VERBOSE_AUDIO 0x00000010
-
-typedef struct
-{
- /* SDL init flags */
- char **argv;
- Uint32 flags;
- Uint32 verbose;
-
- /* Video info */
- const char *videodriver;
- int display;
- const char *window_title;
- const char *window_icon;
- Uint32 window_flags;
- int window_x;
- int window_y;
- int window_w;
- int window_h;
- int window_minW;
- int window_minH;
- int window_maxW;
- int window_maxH;
- int logical_w;
- int logical_h;
- float scale;
- int depth;
- int refresh_rate;
- int num_windows;
- SDL_Window **windows;
-
- /* Renderer info */
- const char *renderdriver;
- Uint32 render_flags;
- SDL_bool skip_renderer;
- SDL_Renderer **renderers;
- SDL_Texture **targets;
-
- /* Audio info */
- const char *audiodriver;
- SDL_AudioSpec audiospec;
-
- /* GL settings */
- int gl_red_size;
- int gl_green_size;
- int gl_blue_size;
- int gl_alpha_size;
- int gl_buffer_size;
- int gl_depth_size;
- int gl_stencil_size;
- int gl_double_buffer;
- int gl_accum_red_size;
- int gl_accum_green_size;
- int gl_accum_blue_size;
- int gl_accum_alpha_size;
- int gl_stereo;
- int gl_multisamplebuffers;
- int gl_multisamplesamples;
- int gl_retained_backing;
- int gl_accelerated;
- int gl_major_version;
- int gl_minor_version;
- int gl_debug;
- int gl_profile_mask;
-} SDLTest_CommonState;
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function prototypes */
-
-/**
- * \brief Parse command line parameters and create common state.
- *
- * \param argv Array of command line parameters
- * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
- *
- * \returns Returns a newly allocated common state object.
- */
-SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
-
-/**
- * \brief Process one common argument.
- *
- * \param state The common state describing the test window to create.
- * \param index The index of the argument to process in argv[].
- *
- * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
- */
-int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
-
-/**
- * \brief Returns common usage information
- *
- * \param state The common state describing the test window to create.
- *
- * \returns String with usage information
- */
-const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
-
-/**
- * \brief Open test window.
- *
- * \param state The common state describing the test window to create.
- *
- * \returns True if initialization succeeded, false otherwise
- */
-SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
-
-/**
- * \brief Common event handler for test windows.
- *
- * \param state The common state used to create test window.
- * \param event The event to handle.
- * \param done Flag indicating we are done.
- *
- */
-void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
-
-/**
- * \brief Close test window.
- *
- * \param state The common state used to create test window.
- *
- */
-void SDLTest_CommonQuit(SDLTest_CommonState * state);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_common_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_compare.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_compare.h
deleted file mode 100644
index 9f4c458..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_compare.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_compare.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Defines comparison functions (i.e. for surfaces).
-
-*/
-
-#ifndef SDL_test_compare_h_
-#define SDL_test_compare_h_
-
-#include "SDL.h"
-
-#include "SDL_test_images.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Compares a surface and with reference image data for equality
- *
- * \param surface Surface used in comparison
- * \param referenceSurface Test Surface used in comparison
- * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
- *
- * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
- */
-int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_compare_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_crc32.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_crc32.h
deleted file mode 100644
index add480c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_crc32.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_crc32.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Implements CRC32 calculations (default output is Perl String::CRC32 compatible).
-
-*/
-
-#ifndef SDL_test_crc32_h_
-#define SDL_test_crc32_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* ------------ Definitions --------- */
-
-/* Definition shared by all CRC routines */
-
-#ifndef CrcUint32
- #define CrcUint32 unsigned int
-#endif
-#ifndef CrcUint8
- #define CrcUint8 unsigned char
-#endif
-
-#ifdef ORIGINAL_METHOD
- #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
-#else
- #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
-#endif
-
-/**
- * Data structure for CRC32 (checksum) computation
- */
- typedef struct {
- CrcUint32 crc32_table[256]; /* CRC table */
- } SDLTest_Crc32Context;
-
-/* ---------- Function Prototypes ------------- */
-
-/**
- * \brief Initialize the CRC context
- *
- * Note: The function initializes the crc table required for all crc calculations.
- *
- * \param crcContext pointer to context variable
- *
- * \returns 0 for OK, -1 on error
- *
- */
- int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
-
-
-/**
- * \brief calculate a crc32 from a data block
- *
- * \param crcContext pointer to context variable
- * \param inBuf input buffer to checksum
- * \param inLen length of input buffer
- * \param crc32 pointer to Uint32 to store the final CRC into
- *
- * \returns 0 for OK, -1 on error
- *
- */
-int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
-
-/* Same routine broken down into three steps */
-int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
-int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
-int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
-
-
-/**
- * \brief clean up CRC context
- *
- * \param crcContext pointer to context variable
- *
- * \returns 0 for OK, -1 on error
- *
-*/
-
-int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_crc32_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_font.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_font.h
deleted file mode 100644
index 58c9f9d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_font.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_font.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-#ifndef SDL_test_font_h_
-#define SDL_test_font_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function prototypes */
-
-#define FONT_CHARACTER_SIZE 8
-
-/**
- * \brief Draw a string in the currently set font.
- *
- * \param renderer The renderer to draw on.
- * \param x The X coordinate of the upper left corner of the character.
- * \param y The Y coordinate of the upper left corner of the character.
- * \param c The character to draw.
- *
- * \returns Returns 0 on success, -1 on failure.
- */
-int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
-
-/**
- * \brief Draw a string in the currently set font.
- *
- * \param renderer The renderer to draw on.
- * \param x The X coordinate of the upper left corner of the string.
- * \param y The Y coordinate of the upper left corner of the string.
- * \param s The string to draw.
- *
- * \returns Returns 0 on success, -1 on failure.
- */
-int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
-
-
-/**
- * \brief Cleanup textures used by font drawing functions.
- */
-void SDLTest_CleanupTextDrawing(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_font_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_fuzzer.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_fuzzer.h
deleted file mode 100644
index 6cf0574..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_fuzzer.h
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_fuzzer.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Data generators for fuzzing test data in a reproducible way.
-
-*/
-
-#ifndef SDL_test_fuzzer_h_
-#define SDL_test_fuzzer_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- Based on GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
-*/
-
-
-/**
- * \file
- * Note: The fuzzer implementation uses a static instance of random context
- * internally which makes it thread-UNsafe.
- */
-
-/**
- * Initializes the fuzzer for a test
- *
- * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
- *
- */
-void SDLTest_FuzzerInit(Uint64 execKey);
-
-
-/**
- * Returns a random Uint8
- *
- * \returns Generated integer
- */
-Uint8 SDLTest_RandomUint8(void);
-
-/**
- * Returns a random Sint8
- *
- * \returns Generated signed integer
- */
-Sint8 SDLTest_RandomSint8(void);
-
-
-/**
- * Returns a random Uint16
- *
- * \returns Generated integer
- */
-Uint16 SDLTest_RandomUint16(void);
-
-/**
- * Returns a random Sint16
- *
- * \returns Generated signed integer
- */
-Sint16 SDLTest_RandomSint16(void);
-
-
-/**
- * Returns a random integer
- *
- * \returns Generated integer
- */
-Sint32 SDLTest_RandomSint32(void);
-
-
-/**
- * Returns a random positive integer
- *
- * \returns Generated integer
- */
-Uint32 SDLTest_RandomUint32(void);
-
-/**
- * Returns random Uint64.
- *
- * \returns Generated integer
- */
-Uint64 SDLTest_RandomUint64(void);
-
-
-/**
- * Returns random Sint64.
- *
- * \returns Generated signed integer
- */
-Sint64 SDLTest_RandomSint64(void);
-
-/**
- * \returns random float in range [0.0 - 1.0[
- */
-float SDLTest_RandomUnitFloat(void);
-
-/**
- * \returns random double in range [0.0 - 1.0[
- */
-double SDLTest_RandomUnitDouble(void);
-
-/**
- * \returns random float.
- *
- */
-float SDLTest_RandomFloat(void);
-
-/**
- * \returns random double.
- *
- */
-double SDLTest_RandomDouble(void);
-
-/**
- * Returns a random boundary value for Uint8 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Uint16 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Uint32 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Uint64 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Sint8 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
- * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
- */
-Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
-
-
-/**
- * Returns a random boundary value for Sint16 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
- * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
- */
-Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Sint32 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100
- * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
- */
-Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Sint64 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
- * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
- */
-Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
-
-
-/**
- * Returns integer in range [min, max] (inclusive).
- * Min and max values can be negative values.
- * If Max in smaller than min, then the values are swapped.
- * Min and max are the same value, that value will be returned.
- *
- * \param min Minimum inclusive value of returned random number
- * \param max Maximum inclusive value of returned random number
- *
- * \returns Generated random integer in range
- */
-Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
-
-
-/**
- * Generates random null-terminated string. The minimum length for
- * the string is 1 character, maximum length for the string is 255
- * characters and it can contain ASCII characters from 32 to 126.
- *
- * Note: Returned string needs to be deallocated.
- *
- * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
- */
-char * SDLTest_RandomAsciiString(void);
-
-
-/**
- * Generates random null-terminated string. The maximum length for
- * the string is defined by the maxLength parameter.
- * String can contain ASCII characters from 32 to 126.
- *
- * Note: Returned string needs to be deallocated.
- *
- * \param maxLength The maximum length of the generated string.
- *
- * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
- */
-char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
-
-
-/**
- * Generates random null-terminated string. The length for
- * the string is defined by the size parameter.
- * String can contain ASCII characters from 32 to 126.
- *
- * Note: Returned string needs to be deallocated.
- *
- * \param size The length of the generated string
- *
- * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated.
- */
-char * SDLTest_RandomAsciiStringOfSize(int size);
-
-/**
- * Returns the invocation count for the fuzzer since last ...FuzzerInit.
- */
-int SDLTest_GetFuzzerInvocationCount(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_fuzzer_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_harness.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_harness.h
deleted file mode 100644
index 68c4bcb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_harness.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_harness.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- Defines types for test case definitions and the test execution harness API.
-
- Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
-*/
-
-#ifndef SDL_test_h_arness_h
-#define SDL_test_h_arness_h
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* ! Definitions for test case structures */
-#define TEST_ENABLED 1
-#define TEST_DISABLED 0
-
-/* ! Definition of all the possible test return values of the test case method */
-#define TEST_ABORTED -1
-#define TEST_STARTED 0
-#define TEST_COMPLETED 1
-#define TEST_SKIPPED 2
-
-/* ! Definition of all the possible test results for the harness */
-#define TEST_RESULT_PASSED 0
-#define TEST_RESULT_FAILED 1
-#define TEST_RESULT_NO_ASSERT 2
-#define TEST_RESULT_SKIPPED 3
-#define TEST_RESULT_SETUP_FAILURE 4
-
-/* !< Function pointer to a test case setup function (run before every test) */
-typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
-
-/* !< Function pointer to a test case function */
-typedef int (*SDLTest_TestCaseFp)(void *arg);
-
-/* !< Function pointer to a test case teardown function (run after every test) */
-typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
-
-/**
- * Holds information about a single test case.
- */
-typedef struct SDLTest_TestCaseReference {
- /* !< Func2Stress */
- SDLTest_TestCaseFp testCase;
- /* !< Short name (or function name) "Func2Stress" */
- char *name;
- /* !< Long name or full description "This test pushes func2() to the limit." */
- char *description;
- /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
- int enabled;
-} SDLTest_TestCaseReference;
-
-/**
- * Holds information about a test suite (multiple test cases).
- */
-typedef struct SDLTest_TestSuiteReference {
- /* !< "PlatformSuite" */
- char *name;
- /* !< The function that is run before each test. NULL skips. */
- SDLTest_TestCaseSetUpFp testSetUp;
- /* !< The test cases that are run as part of the suite. Last item should be NULL. */
- const SDLTest_TestCaseReference **testCases;
- /* !< The function that is run after each test. NULL skips. */
- SDLTest_TestCaseTearDownFp testTearDown;
-} SDLTest_TestSuiteReference;
-
-
-/**
- * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
- *
- * Note: The returned string needs to be deallocated by the caller.
- *
- * \param length The length of the seed string to generate
- *
- * \returns The generated seed string
- */
-char *SDLTest_GenerateRunSeed(const int length);
-
-/**
- * \brief Execute a test suite using the given run seed and execution key.
- *
- * \param testSuites Suites containing the test case.
- * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
- * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
- * \param filter Filter specification. NULL disables. Case sensitive.
- * \param testIterations Number of iterations to run each test case.
- *
- * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
- */
-int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_h_arness_h */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_images.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_images.h
deleted file mode 100644
index 683d2f8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_images.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_images.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Defines some images for tests.
-
-*/
-
-#ifndef SDL_test_images_h_
-#define SDL_test_images_h_
-
-#include "SDL.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- *Type for test images.
- */
-typedef struct SDLTest_SurfaceImage_s {
- int width;
- int height;
- unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
- const char *pixel_data;
-} SDLTest_SurfaceImage_t;
-
-/* Test images */
-SDL_Surface *SDLTest_ImageBlit(void);
-SDL_Surface *SDLTest_ImageBlitColor(void);
-SDL_Surface *SDLTest_ImageBlitAlpha(void);
-SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
-SDL_Surface *SDLTest_ImageBlitBlend(void);
-SDL_Surface *SDLTest_ImageBlitBlendMod(void);
-SDL_Surface *SDLTest_ImageBlitBlendNone(void);
-SDL_Surface *SDLTest_ImageBlitBlendAll(void);
-SDL_Surface *SDLTest_ImageFace(void);
-SDL_Surface *SDLTest_ImagePrimitives(void);
-SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_images_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_log.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_log.h
deleted file mode 100644
index 9f993fb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_log.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_log.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- *
- * Wrapper to log in the TEST category
- *
- */
-
-#ifndef SDL_test_log_h_
-#define SDL_test_log_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Prints given message with a timestamp in the TEST category and INFO priority.
- *
- * \param fmt Message to be logged
- */
-void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/**
- * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
- *
- * \param fmt Message to be logged
- */
-void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_log_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_md5.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_md5.h
deleted file mode 100644
index 67ca7d1..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_md5.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_md5.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- ***********************************************************************
- ** Header file for implementation of MD5 **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
- ** Created: 2/17/90 RLR **
- ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
- ** Revised (for MD5): RLR 4/27/91 **
- ** -- G modified to have y&~z instead of y&z **
- ** -- FF, GG, HH modified to add in last register done **
- ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
- ** -- distinct additive constant for each step **
- ** -- round 4 added, working mod 7 **
- ***********************************************************************
-*/
-
-/*
- ***********************************************************************
- ** Message-digest routines: **
- ** To form the message digest for a message M **
- ** (1) Initialize a context buffer mdContext using MD5Init **
- ** (2) Call MD5Update on mdContext and M **
- ** (3) Call MD5Final on mdContext **
- ** The message digest is now in mdContext->digest[0...15] **
- ***********************************************************************
-*/
-
-#ifndef SDL_test_md5_h_
-#define SDL_test_md5_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ------------ Definitions --------- */
-
-/* typedef a 32-bit type */
- typedef unsigned long int MD5UINT4;
-
-/* Data structure for MD5 (Message-Digest) computation */
- typedef struct {
- MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
- MD5UINT4 buf[4]; /* scratch buffer */
- unsigned char in[64]; /* input buffer */
- unsigned char digest[16]; /* actual digest after Md5Final call */
- } SDLTest_Md5Context;
-
-/* ---------- Function Prototypes ------------- */
-
-/**
- * \brief initialize the context
- *
- * \param mdContext pointer to context variable
- *
- * Note: The function initializes the message-digest context
- * mdContext. Call before each new use of the context -
- * all fields are set to zero.
- */
- void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
-
-
-/**
- * \brief update digest from variable length data
- *
- * \param mdContext pointer to context variable
- * \param inBuf pointer to data array/string
- * \param inLen length of data array/string
- *
- * Note: The function updates the message-digest context to account
- * for the presence of each of the characters inBuf[0..inLen-1]
- * in the message whose digest is being computed.
-*/
-
- void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
- unsigned int inLen);
-
-
-/**
- * \brief complete digest computation
- *
- * \param mdContext pointer to context variable
- *
- * Note: The function terminates the message-digest computation and
- * ends with the desired message digest in mdContext.digest[0..15].
- * Always call before using the digest[] variable.
-*/
-
- void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_md5_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_memory.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_memory.h
deleted file mode 100644
index 43b67f5..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_memory.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_memory.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-#ifndef SDL_test_memory_h_
-#define SDL_test_memory_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * \brief Start tracking SDL memory allocations
- *
- * \note This should be called before any other SDL functions for complete tracking coverage
- */
-int SDLTest_TrackAllocations();
-
-/**
- * \brief Print a log of any outstanding allocations
- *
- * \note This can be called after SDL_Quit()
- */
-void SDLTest_LogAllocations();
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_memory_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_random.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_random.h
deleted file mode 100644
index 2b01922..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_test_random.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_random.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- A "32-bit Multiply with carry random number generator. Very fast.
- Includes a list of recommended multipliers.
-
- multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32.
- period: (a*2^31)-1
-
-*/
-
-#ifndef SDL_test_random_h_
-#define SDL_test_random_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* --- Definitions */
-
-/*
- * Macros that return a random number in a specific format.
- */
-#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c))
-
-/*
- * Context structure for the random number generator state.
- */
- typedef struct {
- unsigned int a;
- unsigned int x;
- unsigned int c;
- unsigned int ah;
- unsigned int al;
- } SDLTest_RandomContext;
-
-
-/* --- Function prototypes */
-
-/**
- * \brief Initialize random number generator with two integers.
- *
- * Note: The random sequence of numbers returned by ...Random() is the
- * same for the same two integers and has a period of 2^31.
- *
- * \param rndContext pointer to context structure
- * \param xi integer that defines the random sequence
- * \param ci integer that defines the random sequence
- *
- */
- void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
- unsigned int ci);
-
-/**
- * \brief Initialize random number generator based on current system time.
- *
- * \param rndContext pointer to context structure
- *
- */
- void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
-
-
-/**
- * \brief Initialize random number generator based on current system time.
- *
- * Note: ...RandomInit() or ...RandomInitTime() must have been called
- * before using this function.
- *
- * \param rndContext pointer to context structure
- *
- * \returns A random number (32bit unsigned integer)
- *
- */
- unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_random_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_thread.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_thread.h
deleted file mode 100644
index d0f6575..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_thread.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_thread_h_
-#define SDL_thread_h_
-
-/**
- * \file SDL_thread.h
- *
- * Header for the SDL thread management routines.
- */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-/* Thread synchronization primitives */
-#include "SDL_atomic.h"
-#include "SDL_mutex.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The SDL thread structure, defined in SDL_thread.c */
-struct SDL_Thread;
-typedef struct SDL_Thread SDL_Thread;
-
-/* The SDL thread ID */
-typedef unsigned long SDL_threadID;
-
-/* Thread local storage ID, 0 is the invalid ID */
-typedef unsigned int SDL_TLSID;
-
-/**
- * The SDL thread priority.
- *
- * \note On many systems you require special privileges to set high priority.
- */
-typedef enum {
- SDL_THREAD_PRIORITY_LOW,
- SDL_THREAD_PRIORITY_NORMAL,
- SDL_THREAD_PRIORITY_HIGH
-} SDL_ThreadPriority;
-
-/**
- * The function passed to SDL_CreateThread().
- * It is passed a void* user context parameter and returns an int.
- */
-typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
-
-#if defined(__WIN32__) && !defined(HAVE_LIBC)
-/**
- * \file SDL_thread.h
- *
- * We compile SDL into a DLL. This means, that it's the DLL which
- * creates a new thread for the calling process with the SDL_CreateThread()
- * API. There is a problem with this, that only the RTL of the SDL2.DLL will
- * be initialized for those threads, and not the RTL of the calling
- * application!
- *
- * To solve this, we make a little hack here.
- *
- * We'll always use the caller's _beginthread() and _endthread() APIs to
- * start a new thread. This way, if it's the SDL2.DLL which uses this API,
- * then the RTL of SDL2.DLL will be used to create the new thread, and if it's
- * the application, then the RTL of the application will be used.
- *
- * So, in short:
- * Always use the _beginthread() and _endthread() of the calling runtime
- * library!
- */
-#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* _beginthreadex() and _endthreadex() */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
- (void *, unsigned, unsigned (__stdcall *func)(void *),
- void * /*arg*/, unsigned, unsigned * /* threadID */);
-typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
-
-/**
- * Create a thread.
- */
-extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
- pfnSDL_CurrentBeginThread pfnBeginThread,
- pfnSDL_CurrentEndThread pfnEndThread);
-
-/**
- * Create a thread.
- */
-#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
-#undef SDL_CreateThread
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
-#else
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
-#endif
-
-#elif defined(__OS2__)
-/*
- * just like the windows case above: We compile SDL2
- * into a dll with Watcom's runtime statically linked.
- */
-#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#ifndef __EMX__
-#include <process.h>
-#else
-#include <stdlib.h>
-#endif
-typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
-typedef void (*pfnSDL_CurrentEndThread)(void);
-extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
- pfnSDL_CurrentBeginThread pfnBeginThread,
- pfnSDL_CurrentEndThread pfnEndThread);
-#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
-#undef SDL_CreateThread
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
-#else
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
-#endif
-
-#else
-
-/**
- * Create a thread.
- *
- * Thread naming is a little complicated: Most systems have very small
- * limits for the string length (Haiku has 32 bytes, Linux currently has 16,
- * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
- * have to see what happens with your system's debugger. The name should be
- * UTF-8 (but using the naming limits of C identifiers is a better bet).
- * There are no requirements for thread naming conventions, so long as the
- * string is null-terminated UTF-8, but these guidelines are helpful in
- * choosing a name:
- *
- * http://stackoverflow.com/questions/149932/naming-conventions-for-threads
- *
- * If a system imposes requirements, SDL will try to munge the string for
- * it (truncate, etc), but the original string contents will be available
- * from SDL_GetThreadName().
- */
-extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
-
-#endif
-
-/**
- * Get the thread name, as it was specified in SDL_CreateThread().
- * This function returns a pointer to a UTF-8 string that names the
- * specified thread, or NULL if it doesn't have a name. This is internal
- * memory, not to be free()'d by the caller, and remains valid until the
- * specified thread is cleaned up by SDL_WaitThread().
- */
-extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
-
-/**
- * Get the thread identifier for the current thread.
- */
-extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
-
-/**
- * Get the thread identifier for the specified thread.
- *
- * Equivalent to SDL_ThreadID() if the specified thread is NULL.
- */
-extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
-
-/**
- * Set the priority for the current thread
- */
-extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
-
-/**
- * Wait for a thread to finish. Threads that haven't been detached will
- * remain (as a "zombie") until this function cleans them up. Not doing so
- * is a resource leak.
- *
- * Once a thread has been cleaned up through this function, the SDL_Thread
- * that references it becomes invalid and should not be referenced again.
- * As such, only one thread may call SDL_WaitThread() on another.
- *
- * The return code for the thread function is placed in the area
- * pointed to by \c status, if \c status is not NULL.
- *
- * You may not wait on a thread that has been used in a call to
- * SDL_DetachThread(). Use either that function or this one, but not
- * both, or behavior is undefined.
- *
- * It is safe to pass NULL to this function; it is a no-op.
- */
-extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
-
-/**
- * A thread may be "detached" to signify that it should not remain until
- * another thread has called SDL_WaitThread() on it. Detaching a thread
- * is useful for long-running threads that nothing needs to synchronize
- * with or further manage. When a detached thread is done, it simply
- * goes away.
- *
- * There is no way to recover the return code of a detached thread. If you
- * need this, don't detach the thread and instead use SDL_WaitThread().
- *
- * Once a thread is detached, you should usually assume the SDL_Thread isn't
- * safe to reference again, as it will become invalid immediately upon
- * the detached thread's exit, instead of remaining until someone has called
- * SDL_WaitThread() to finally clean it up. As such, don't detach the same
- * thread more than once.
- *
- * If a thread has already exited when passed to SDL_DetachThread(), it will
- * stop waiting for a call to SDL_WaitThread() and clean up immediately.
- * It is not safe to detach a thread that might be used with SDL_WaitThread().
- *
- * You may not call SDL_WaitThread() on a thread that has been detached.
- * Use either that function or this one, but not both, or behavior is
- * undefined.
- *
- * It is safe to pass NULL to this function; it is a no-op.
- */
-extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread);
-
-/**
- * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
- *
- * \return The newly created thread local storage identifier, or 0 on error
- *
- * \code
- * static SDL_SpinLock tls_lock;
- * static SDL_TLSID thread_local_storage;
- *
- * void SetMyThreadData(void *value)
- * {
- * if (!thread_local_storage) {
- * SDL_AtomicLock(&tls_lock);
- * if (!thread_local_storage) {
- * thread_local_storage = SDL_TLSCreate();
- * }
- * SDL_AtomicUnlock(&tls_lock);
- * }
- * SDL_TLSSet(thread_local_storage, value, 0);
- * }
- *
- * void *GetMyThreadData(void)
- * {
- * return SDL_TLSGet(thread_local_storage);
- * }
- * \endcode
- *
- * \sa SDL_TLSGet()
- * \sa SDL_TLSSet()
- */
-extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
-
-/**
- * \brief Get the value associated with a thread local storage ID for the current thread.
- *
- * \param id The thread local storage ID
- *
- * \return The value associated with the ID for the current thread, or NULL if no value has been set.
- *
- * \sa SDL_TLSCreate()
- * \sa SDL_TLSSet()
- */
-extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
-
-/**
- * \brief Set the value associated with a thread local storage ID for the current thread.
- *
- * \param id The thread local storage ID
- * \param value The value to associate with the ID for the current thread
- * \param destructor A function called when the thread exits, to free the value.
- *
- * \return 0 on success, -1 on error
- *
- * \sa SDL_TLSCreate()
- * \sa SDL_TLSGet()
- */
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_thread_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_timer.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_timer.h
deleted file mode 100644
index 282625d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_timer.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_timer_h_
-#define SDL_timer_h_
-
-/**
- * \file SDL_timer.h
- *
- * Header for the SDL time management routines.
- */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Get the number of milliseconds since the SDL library initialization.
- *
- * \note This value wraps if the program runs for more than ~49 days.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
-
-/**
- * \brief Compare SDL ticks values, and return true if A has passed B
- *
- * e.g. if you want to wait 100 ms, you could do this:
- * Uint32 timeout = SDL_GetTicks() + 100;
- * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
- * ... do work until timeout has elapsed
- * }
- */
-#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
-
-/**
- * \brief Get the current value of the high resolution counter
- */
-extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
-
-/**
- * \brief Get the count per second of the high resolution counter
- */
-extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
-
-/**
- * \brief Wait a specified number of milliseconds before returning.
- */
-extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
-
-/**
- * Function prototype for the timer callback function.
- *
- * The callback function is passed the current timer interval and returns
- * the next timer interval. If the returned value is the same as the one
- * passed in, the periodic alarm continues, otherwise a new alarm is
- * scheduled. If the callback returns 0, the periodic alarm is cancelled.
- */
-typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
-
-/**
- * Definition of the timer ID type.
- */
-typedef int SDL_TimerID;
-
-/**
- * \brief Add a new timer to the pool of timers already running.
- *
- * \return A timer ID, or 0 when an error occurs.
- */
-extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
- SDL_TimerCallback callback,
- void *param);
-
-/**
- * \brief Remove a timer knowing its ID.
- *
- * \return A boolean value indicating success or failure.
- *
- * \warning It is not safe to remove a timer multiple times.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_timer_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_touch.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_touch.h
deleted file mode 100644
index db9e25e..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_touch.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_touch.h
- *
- * Include file for SDL touch event handling.
- */
-
-#ifndef SDL_touch_h_
-#define SDL_touch_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef Sint64 SDL_TouchID;
-typedef Sint64 SDL_FingerID;
-
-typedef struct SDL_Finger
-{
- SDL_FingerID id;
- float x;
- float y;
- float pressure;
-} SDL_Finger;
-
-/* Used as the device ID for mouse events simulated with touch input */
-#define SDL_TOUCH_MOUSEID ((Uint32)-1)
-
-
-/* Function prototypes */
-
-/**
- * \brief Get the number of registered touch devices.
- */
-extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
-
-/**
- * \brief Get the touch ID with the given index, or 0 if the index is invalid.
- */
-extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
-
-/**
- * \brief Get the number of active fingers for a given touch device.
- */
-extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
-
-/**
- * \brief Get the finger object of the given touch, with the given index.
- */
-extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_touch_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_types.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_types.h
deleted file mode 100644
index 06ee80c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_types.h
- *
- * \deprecated
- */
-
-/* DEPRECATED */
-#include "SDL_stdinc.h"
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_version.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_version.h
deleted file mode 100644
index 5b4c402..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_version.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_version.h
- *
- * This header defines the current SDL version.
- */
-
-#ifndef SDL_version_h_
-#define SDL_version_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Information the version of SDL in use.
- *
- * Represents the library's version as three levels: major revision
- * (increments with massive changes, additions, and enhancements),
- * minor revision (increments with backwards-compatible changes to the
- * major revision), and patchlevel (increments with fixes to the minor
- * revision).
- *
- * \sa SDL_VERSION
- * \sa SDL_GetVersion
- */
-typedef struct SDL_version
-{
- Uint8 major; /**< major version */
- Uint8 minor; /**< minor version */
- Uint8 patch; /**< update version */
-} SDL_version;
-
-/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
-*/
-#define SDL_MAJOR_VERSION 2
-#define SDL_MINOR_VERSION 0
-#define SDL_PATCHLEVEL 7
-
-/**
- * \brief Macro to determine SDL version program was compiled against.
- *
- * This macro fills in a SDL_version structure with the version of the
- * library you compiled against. This is determined by what header the
- * compiler uses. Note that if you dynamically linked the library, you might
- * have a slightly newer or older version at runtime. That version can be
- * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
- * is not a macro.
- *
- * \param x A pointer to a SDL_version struct to initialize.
- *
- * \sa SDL_version
- * \sa SDL_GetVersion
- */
-#define SDL_VERSION(x) \
-{ \
- (x)->major = SDL_MAJOR_VERSION; \
- (x)->minor = SDL_MINOR_VERSION; \
- (x)->patch = SDL_PATCHLEVEL; \
-}
-
-/**
- * This macro turns the version numbers into a numeric value:
- * \verbatim
- (1,2,3) -> (1203)
- \endverbatim
- *
- * This assumes that there will never be more than 100 patchlevels.
- */
-#define SDL_VERSIONNUM(X, Y, Z) \
- ((X)*1000 + (Y)*100 + (Z))
-
-/**
- * This is the version number macro for the current SDL version.
- */
-#define SDL_COMPILEDVERSION \
- SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
-
-/**
- * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
- */
-#define SDL_VERSION_ATLEAST(X, Y, Z) \
- (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-
-/**
- * \brief Get the version of SDL that is linked against your program.
- *
- * If you are linking to SDL dynamically, then it is possible that the
- * current version will be different than the version you compiled against.
- * This function returns the current version, while SDL_VERSION() is a
- * macro that tells you what version you compiled with.
- *
- * \code
- * SDL_version compiled;
- * SDL_version linked;
- *
- * SDL_VERSION(&compiled);
- * SDL_GetVersion(&linked);
- * printf("We compiled against SDL version %d.%d.%d ...\n",
- * compiled.major, compiled.minor, compiled.patch);
- * printf("But we linked against SDL version %d.%d.%d.\n",
- * linked.major, linked.minor, linked.patch);
- * \endcode
- *
- * This function may be called safely at any time, even before SDL_Init().
- *
- * \sa SDL_VERSION
- */
-extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
-
-/**
- * \brief Get the code revision of SDL that is linked against your program.
- *
- * Returns an arbitrary string (a hash value) uniquely identifying the
- * exact revision of the SDL library in use, and is only useful in comparing
- * against other revisions. It is NOT an incrementing number.
- */
-extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
-
-/**
- * \brief Get the revision number of SDL that is linked against your program.
- *
- * Returns a number uniquely identifying the exact revision of the SDL
- * library in use. It is an incrementing number based on commits to
- * hg.libsdl.org.
- */
-extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_version_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_video.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_video.h
deleted file mode 100644
index 6f6cda8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_video.h
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_video.h
- *
- * Header file for SDL video functions.
- */
-
-#ifndef SDL_video_h_
-#define SDL_video_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_pixels.h"
-#include "SDL_rect.h"
-#include "SDL_surface.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The structure that defines a display mode
- *
- * \sa SDL_GetNumDisplayModes()
- * \sa SDL_GetDisplayMode()
- * \sa SDL_GetDesktopDisplayMode()
- * \sa SDL_GetCurrentDisplayMode()
- * \sa SDL_GetClosestDisplayMode()
- * \sa SDL_SetWindowDisplayMode()
- * \sa SDL_GetWindowDisplayMode()
- */
-typedef struct
-{
- Uint32 format; /**< pixel format */
- int w; /**< width, in screen coordinates */
- int h; /**< height, in screen coordinates */
- int refresh_rate; /**< refresh rate (or zero for unspecified) */
- void *driverdata; /**< driver-specific data, initialize to 0 */
-} SDL_DisplayMode;
-
-/**
- * \brief The type used to identify a window
- *
- * \sa SDL_CreateWindow()
- * \sa SDL_CreateWindowFrom()
- * \sa SDL_DestroyWindow()
- * \sa SDL_GetWindowData()
- * \sa SDL_GetWindowFlags()
- * \sa SDL_GetWindowGrab()
- * \sa SDL_GetWindowPosition()
- * \sa SDL_GetWindowSize()
- * \sa SDL_GetWindowTitle()
- * \sa SDL_HideWindow()
- * \sa SDL_MaximizeWindow()
- * \sa SDL_MinimizeWindow()
- * \sa SDL_RaiseWindow()
- * \sa SDL_RestoreWindow()
- * \sa SDL_SetWindowData()
- * \sa SDL_SetWindowFullscreen()
- * \sa SDL_SetWindowGrab()
- * \sa SDL_SetWindowIcon()
- * \sa SDL_SetWindowPosition()
- * \sa SDL_SetWindowSize()
- * \sa SDL_SetWindowBordered()
- * \sa SDL_SetWindowResizable()
- * \sa SDL_SetWindowTitle()
- * \sa SDL_ShowWindow()
- */
-typedef struct SDL_Window SDL_Window;
-
-/**
- * \brief The flags on a window
- *
- * \sa SDL_GetWindowFlags()
- */
-typedef enum
-{
- /* !!! FIXME: change this to name = (1<<x). */
- SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
- SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
- SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
- SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
- SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
- SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
- SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
- SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
- SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
- SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
- SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
- SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
- SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
- SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
- SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
- SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
- SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
- SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
- SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
- SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
- SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
-} SDL_WindowFlags;
-
-/**
- * \brief Used to indicate that you don't care what the window position is.
- */
-#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
-#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
-#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
-#define SDL_WINDOWPOS_ISUNDEFINED(X) \
- (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
-
-/**
- * \brief Used to indicate that the window position should be centered.
- */
-#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
-#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
-#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
-#define SDL_WINDOWPOS_ISCENTERED(X) \
- (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
-
-/**
- * \brief Event subtype for window events
- */
-typedef enum
-{
- SDL_WINDOWEVENT_NONE, /**< Never used */
- SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
- SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
- SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
- redrawn */
- SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
- */
- SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
- SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
- a result of an API call or through the
- system or user changing the window size. */
- SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
- SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
- SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
- and position */
- SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
- SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
- SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
- SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
- SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
- SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
- SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
-} SDL_WindowEventID;
-
-/**
- * \brief An opaque handle to an OpenGL context.
- */
-typedef void *SDL_GLContext;
-
-/**
- * \brief OpenGL configuration attributes
- */
-typedef enum
-{
- SDL_GL_RED_SIZE,
- SDL_GL_GREEN_SIZE,
- SDL_GL_BLUE_SIZE,
- SDL_GL_ALPHA_SIZE,
- SDL_GL_BUFFER_SIZE,
- SDL_GL_DOUBLEBUFFER,
- SDL_GL_DEPTH_SIZE,
- SDL_GL_STENCIL_SIZE,
- SDL_GL_ACCUM_RED_SIZE,
- SDL_GL_ACCUM_GREEN_SIZE,
- SDL_GL_ACCUM_BLUE_SIZE,
- SDL_GL_ACCUM_ALPHA_SIZE,
- SDL_GL_STEREO,
- SDL_GL_MULTISAMPLEBUFFERS,
- SDL_GL_MULTISAMPLESAMPLES,
- SDL_GL_ACCELERATED_VISUAL,
- SDL_GL_RETAINED_BACKING,
- SDL_GL_CONTEXT_MAJOR_VERSION,
- SDL_GL_CONTEXT_MINOR_VERSION,
- SDL_GL_CONTEXT_EGL,
- SDL_GL_CONTEXT_FLAGS,
- SDL_GL_CONTEXT_PROFILE_MASK,
- SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
- SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
- SDL_GL_CONTEXT_RESET_NOTIFICATION,
- SDL_GL_CONTEXT_NO_ERROR
-} SDL_GLattr;
-
-typedef enum
-{
- SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
- SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
- SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
-} SDL_GLprofile;
-
-typedef enum
-{
- SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
- SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
- SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
- SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
-} SDL_GLcontextFlag;
-
-typedef enum
-{
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
-} SDL_GLcontextReleaseFlag;
-
-typedef enum
-{
- SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
- SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
-} SDL_GLContextResetNotification;
-
-/* Function prototypes */
-
-/**
- * \brief Get the number of video drivers compiled into SDL
- *
- * \sa SDL_GetVideoDriver()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
-
-/**
- * \brief Get the name of a built in video driver.
- *
- * \note The video drivers are presented in the order in which they are
- * normally checked during initialization.
- *
- * \sa SDL_GetNumVideoDrivers()
- */
-extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
-
-/**
- * \brief Initialize the video subsystem, optionally specifying a video driver.
- *
- * \param driver_name Initialize a specific driver by name, or NULL for the
- * default video driver.
- *
- * \return 0 on success, -1 on error
- *
- * This function initializes the video subsystem; setting up a connection
- * to the window manager, etc, and determines the available display modes
- * and pixel formats, but does not initialize a window or graphics mode.
- *
- * \sa SDL_VideoQuit()
- */
-extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
-
-/**
- * \brief Shuts down the video subsystem.
- *
- * This function closes all windows, and restores the original video mode.
- *
- * \sa SDL_VideoInit()
- */
-extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
-
-/**
- * \brief Returns the name of the currently initialized video driver.
- *
- * \return The name of the current video driver or NULL if no driver
- * has been initialized
- *
- * \sa SDL_GetNumVideoDrivers()
- * \sa SDL_GetVideoDriver()
- */
-extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
-
-/**
- * \brief Returns the number of available video displays.
- *
- * \sa SDL_GetDisplayBounds()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
-
-/**
- * \brief Get the name of a display in UTF-8 encoding
- *
- * \return The name of a display, or NULL for an invalid display index.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
-
-/**
- * \brief Get the desktop area represented by a display, with the primary
- * display located at 0,0
- *
- * \return 0 on success, or -1 if the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
-
-/**
- * \brief Get the dots/pixels-per-inch for a display
- *
- * \note Diagonal, horizontal and vertical DPI can all be optionally
- * returned if the parameter is non-NULL.
- *
- * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
-
-/**
- * \brief Get the usable desktop area represented by a display, with the
- * primary display located at 0,0
- *
- * This is the same area as SDL_GetDisplayBounds() reports, but with portions
- * reserved by the system removed. For example, on Mac OS X, this subtracts
- * the area occupied by the menu bar and dock.
- *
- * Setting a window to be fullscreen generally bypasses these unusable areas,
- * so these are good guidelines for the maximum space available to a
- * non-fullscreen window.
- *
- * \return 0 on success, or -1 if the index is out of range.
- *
- * \sa SDL_GetDisplayBounds()
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
-
-/**
- * \brief Returns the number of available display modes.
- *
- * \sa SDL_GetDisplayMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
-
-/**
- * \brief Fill in information about a specific display mode.
- *
- * \note The display modes are sorted in this priority:
- * \li bits per pixel -> more colors to fewer colors
- * \li width -> largest to smallest
- * \li height -> largest to smallest
- * \li refresh rate -> highest to lowest
- *
- * \sa SDL_GetNumDisplayModes()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
- SDL_DisplayMode * mode);
-
-/**
- * \brief Fill in information about the desktop display mode.
- */
-extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
-
-/**
- * \brief Fill in information about the current display mode.
- */
-extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
-
-
-/**
- * \brief Get the closest match to the requested display mode.
- *
- * \param displayIndex The index of display from which mode should be queried.
- * \param mode The desired display mode
- * \param closest A pointer to a display mode to be filled in with the closest
- * match of the available display modes.
- *
- * \return The passed in value \c closest, or NULL if no matching video mode
- * was available.
- *
- * The available display modes are scanned, and \c closest is filled in with the
- * closest mode matching the requested mode and returned. The mode format and
- * refresh_rate default to the desktop mode if they are 0. The modes are
- * scanned with size being first priority, format being second priority, and
- * finally checking the refresh_rate. If all the available modes are too
- * small, then NULL is returned.
- *
- * \sa SDL_GetNumDisplayModes()
- * \sa SDL_GetDisplayMode()
- */
-extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
-
-/**
- * \brief Get the display index associated with a window.
- *
- * \return the display index of the display containing the center of the
- * window, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
-
-/**
- * \brief Set the display mode used when a fullscreen window is visible.
- *
- * By default the window's dimensions and the desktop format and refresh rate
- * are used.
- *
- * \param window The window for which the display mode should be set.
- * \param mode The mode to use, or NULL for the default mode.
- *
- * \return 0 on success, or -1 if setting the display mode failed.
- *
- * \sa SDL_GetWindowDisplayMode()
- * \sa SDL_SetWindowFullscreen()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
- const SDL_DisplayMode
- * mode);
-
-/**
- * \brief Fill in information about the display mode used when a fullscreen
- * window is visible.
- *
- * \sa SDL_SetWindowDisplayMode()
- * \sa SDL_SetWindowFullscreen()
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
- SDL_DisplayMode * mode);
-
-/**
- * \brief Get the pixel format associated with the window.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
-
-/**
- * \brief Create a window with the specified position, dimensions, and flags.
- *
- * \param title The title of the window, in UTF-8 encoding.
- * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param w The width of the window, in screen coordinates.
- * \param h The height of the window, in screen coordinates.
- * \param flags The flags for the window, a mask of any of the following:
- * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
- * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
- * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
- * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
- *
- * \return The created window, or NULL if window creation failed.
- *
- * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
- * in pixels may differ from its size in screen coordinates on platforms with
- * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
- * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
- * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
- * drawable size in pixels.
- *
- * If the window is created with any of the SDL_WINDOW_OPENGL or
- * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
- * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
- * corrensponding UnloadLibrary function is called by SDL_DestroyWindow().
- *
- * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
- * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
- *
- * \note On non-Apple devices, SDL requires you to either not link to the
- * Vulkan loader or link to a dynamic library version. This limitation
- * may be removed in a future version of SDL.
- *
- * \sa SDL_DestroyWindow()
- * \sa SDL_GL_LoadLibrary()
- * \sa SDL_Vulkan_LoadLibrary()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
- int x, int y, int w,
- int h, Uint32 flags);
-
-/**
- * \brief Create an SDL window from an existing native window.
- *
- * \param data A pointer to driver-dependent window creation data
- *
- * \return The created window, or NULL if window creation failed.
- *
- * \sa SDL_DestroyWindow()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
-
-/**
- * \brief Get the numeric ID of a window, for logging purposes.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
-
-/**
- * \brief Get a window from a stored ID, or NULL if it doesn't exist.
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
-
-/**
- * \brief Get the window flags.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
-
-/**
- * \brief Set the title of a window, in UTF-8 format.
- *
- * \sa SDL_GetWindowTitle()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
- const char *title);
-
-/**
- * \brief Get the title of a window, in UTF-8 format.
- *
- * \sa SDL_SetWindowTitle()
- */
-extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
-
-/**
- * \brief Set the icon for a window.
- *
- * \param window The window for which the icon should be set.
- * \param icon The icon for the window.
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
- SDL_Surface * icon);
-
-/**
- * \brief Associate an arbitrary named pointer with a window.
- *
- * \param window The window to associate with the pointer.
- * \param name The name of the pointer.
- * \param userdata The associated pointer.
- *
- * \return The previous value associated with 'name'
- *
- * \note The name is case-sensitive.
- *
- * \sa SDL_GetWindowData()
- */
-extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
- const char *name,
- void *userdata);
-
-/**
- * \brief Retrieve the data pointer associated with a window.
- *
- * \param window The window to query.
- * \param name The name of the pointer.
- *
- * \return The value associated with 'name'
- *
- * \sa SDL_SetWindowData()
- */
-extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
- const char *name);
-
-/**
- * \brief Set the position of a window.
- *
- * \param window The window to reposition.
- * \param x The x coordinate of the window in screen coordinates, or
- * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y coordinate of the window in screen coordinates, or
- * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
- *
- * \note The window coordinate origin is the upper left of the display.
- *
- * \sa SDL_GetWindowPosition()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
- int x, int y);
-
-/**
- * \brief Get the position of a window.
- *
- * \param window The window to query.
- * \param x Pointer to variable for storing the x position, in screen
- * coordinates. May be NULL.
- * \param y Pointer to variable for storing the y position, in screen
- * coordinates. May be NULL.
- *
- * \sa SDL_SetWindowPosition()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
- int *x, int *y);
-
-/**
- * \brief Set the size of a window's client area.
- *
- * \param window The window to resize.
- * \param w The width of the window, in screen coordinates. Must be >0.
- * \param h The height of the window, in screen coordinates. Must be >0.
- *
- * \note Fullscreen windows automatically match the size of the display mode,
- * and you should use SDL_SetWindowDisplayMode() to change their size.
- *
- * The window size in screen coordinates may differ from the size in pixels, if
- * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
- * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
- * SDL_GetRendererOutputSize() to get the real client area size in pixels.
- *
- * \sa SDL_GetWindowSize()
- * \sa SDL_SetWindowDisplayMode()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
- int h);
-
-/**
- * \brief Get the size of a window's client area.
- *
- * \param window The window to query.
- * \param w Pointer to variable for storing the width, in screen
- * coordinates. May be NULL.
- * \param h Pointer to variable for storing the height, in screen
- * coordinates. May be NULL.
- *
- * The window size in screen coordinates may differ from the size in pixels, if
- * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
- * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
- * SDL_GetRendererOutputSize() to get the real client area size in pixels.
- *
- * \sa SDL_SetWindowSize()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
- int *h);
-
-/**
- * \brief Get the size of a window's borders (decorations) around the client area.
- *
- * \param window The window to query.
- * \param top Pointer to variable for storing the size of the top border. NULL is permitted.
- * \param left Pointer to variable for storing the size of the left border. NULL is permitted.
- * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted.
- * \param right Pointer to variable for storing the size of the right border. NULL is permitted.
- *
- * \return 0 on success, or -1 if getting this information is not supported.
- *
- * \note if this function fails (returns -1), the size values will be
- * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as
- * if the window in question was borderless.
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
- int *top, int *left,
- int *bottom, int *right);
-
-/**
- * \brief Set the minimum size of a window's client area.
- *
- * \param window The window to set a new minimum size.
- * \param min_w The minimum width of the window, must be >0
- * \param min_h The minimum height of the window, must be >0
- *
- * \note You can't change the minimum size of a fullscreen window, it
- * automatically matches the size of the display mode.
- *
- * \sa SDL_GetWindowMinimumSize()
- * \sa SDL_SetWindowMaximumSize()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
- int min_w, int min_h);
-
-/**
- * \brief Get the minimum size of a window's client area.
- *
- * \param window The window to query.
- * \param w Pointer to variable for storing the minimum width, may be NULL
- * \param h Pointer to variable for storing the minimum height, may be NULL
- *
- * \sa SDL_GetWindowMaximumSize()
- * \sa SDL_SetWindowMinimumSize()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
- int *w, int *h);
-
-/**
- * \brief Set the maximum size of a window's client area.
- *
- * \param window The window to set a new maximum size.
- * \param max_w The maximum width of the window, must be >0
- * \param max_h The maximum height of the window, must be >0
- *
- * \note You can't change the maximum size of a fullscreen window, it
- * automatically matches the size of the display mode.
- *
- * \sa SDL_GetWindowMaximumSize()
- * \sa SDL_SetWindowMinimumSize()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
- int max_w, int max_h);
-
-/**
- * \brief Get the maximum size of a window's client area.
- *
- * \param window The window to query.
- * \param w Pointer to variable for storing the maximum width, may be NULL
- * \param h Pointer to variable for storing the maximum height, may be NULL
- *
- * \sa SDL_GetWindowMinimumSize()
- * \sa SDL_SetWindowMaximumSize()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
- int *w, int *h);
-
-/**
- * \brief Set the border state of a window.
- *
- * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
- * add or remove the border from the actual window. This is a no-op if the
- * window's border already matches the requested state.
- *
- * \param window The window of which to change the border state.
- * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
- *
- * \note You can't change the border state of a fullscreen window.
- *
- * \sa SDL_GetWindowFlags()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
- SDL_bool bordered);
-
-/**
- * \brief Set the user-resizable state of a window.
- *
- * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and
- * allow/disallow user resizing of the window. This is a no-op if the
- * window's resizable state already matches the requested state.
- *
- * \param window The window of which to change the resizable state.
- * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.
- *
- * \note You can't change the resizable state of a fullscreen window.
- *
- * \sa SDL_GetWindowFlags()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
- SDL_bool resizable);
-
-/**
- * \brief Show a window.
- *
- * \sa SDL_HideWindow()
- */
-extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
-
-/**
- * \brief Hide a window.
- *
- * \sa SDL_ShowWindow()
- */
-extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
-
-/**
- * \brief Raise a window above other windows and set the input focus.
- */
-extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
-
-/**
- * \brief Make a window as large as possible.
- *
- * \sa SDL_RestoreWindow()
- */
-extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
-
-/**
- * \brief Minimize a window to an iconic representation.
- *
- * \sa SDL_RestoreWindow()
- */
-extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
-
-/**
- * \brief Restore the size and position of a minimized or maximized window.
- *
- * \sa SDL_MaximizeWindow()
- * \sa SDL_MinimizeWindow()
- */
-extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
-
-/**
- * \brief Set a window's fullscreen state.
- *
- * \return 0 on success, or -1 if setting the display mode failed.
- *
- * \sa SDL_SetWindowDisplayMode()
- * \sa SDL_GetWindowDisplayMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
- Uint32 flags);
-
-/**
- * \brief Get the SDL surface associated with the window.
- *
- * \return The window's framebuffer surface, or NULL on error.
- *
- * A new surface will be created with the optimal format for the window,
- * if necessary. This surface will be freed when the window is destroyed.
- *
- * \note You may not combine this with 3D or the rendering API on this window.
- *
- * \sa SDL_UpdateWindowSurface()
- * \sa SDL_UpdateWindowSurfaceRects()
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
-
-/**
- * \brief Copy the window surface to the screen.
- *
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_GetWindowSurface()
- * \sa SDL_UpdateWindowSurfaceRects()
- */
-extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
-
-/**
- * \brief Copy a number of rectangles on the window surface to the screen.
- *
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_GetWindowSurface()
- * \sa SDL_UpdateWindowSurface()
- */
-extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
- const SDL_Rect * rects,
- int numrects);
-
-/**
- * \brief Set a window's input grab mode.
- *
- * \param window The window for which the input grab mode should be set.
- * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
- *
- * If the caller enables a grab while another window is currently grabbed,
- * the other window loses its grab in favor of the caller's window.
- *
- * \sa SDL_GetWindowGrab()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
- SDL_bool grabbed);
-
-/**
- * \brief Get a window's input grab mode.
- *
- * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
- *
- * \sa SDL_SetWindowGrab()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
-
-/**
- * \brief Get the window that currently has an input grab enabled.
- *
- * \return This returns the window if input is grabbed, and NULL otherwise.
- *
- * \sa SDL_SetWindowGrab()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
-
-/**
- * \brief Set the brightness (gamma correction) for a window.
- *
- * \return 0 on success, or -1 if setting the brightness isn't supported.
- *
- * \sa SDL_GetWindowBrightness()
- * \sa SDL_SetWindowGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
-
-/**
- * \brief Get the brightness (gamma correction) for a window.
- *
- * \return The last brightness value passed to SDL_SetWindowBrightness()
- *
- * \sa SDL_SetWindowBrightness()
- */
-extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
-
-/**
- * \brief Set the opacity for a window
- *
- * \param window The window which will be made transparent or opaque
- * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
- * clamped internally between 0.0f and 1.0f.
- *
- * \return 0 on success, or -1 if setting the opacity isn't supported.
- *
- * \sa SDL_GetWindowOpacity()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
-
-/**
- * \brief Get the opacity of a window.
- *
- * If transparency isn't supported on this platform, opacity will be reported
- * as 1.0f without error.
- *
- * \param window The window in question.
- * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)
- *
- * \return 0 on success, or -1 on error (invalid window, etc).
- *
- * \sa SDL_SetWindowOpacity()
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
-
-/**
- * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
- *
- * \param modal_window The window that should be modal
- * \param parent_window The parent window
- *
- * \return 0 on success, or -1 otherwise.
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
-
-/**
- * \brief Explicitly sets input focus to the window.
- *
- * You almost certainly want SDL_RaiseWindow() instead of this function. Use
- * this with caution, as you might give focus to a window that's completely
- * obscured by other windows.
- *
- * \param window The window that should get the input focus
- *
- * \return 0 on success, or -1 otherwise.
- * \sa SDL_RaiseWindow()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
-
-/**
- * \brief Set the gamma ramp for a window.
- *
- * \param window The window for which the gamma ramp should be set.
- * \param red The translation table for the red channel, or NULL.
- * \param green The translation table for the green channel, or NULL.
- * \param blue The translation table for the blue channel, or NULL.
- *
- * \return 0 on success, or -1 if gamma ramps are unsupported.
- *
- * Set the gamma translation table for the red, green, and blue channels
- * of the video hardware. Each table is an array of 256 16-bit quantities,
- * representing a mapping between the input and output for that channel.
- * The input is the index into the array, and the output is the 16-bit
- * gamma value at that index, scaled to the output color precision.
- *
- * \sa SDL_GetWindowGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
- const Uint16 * red,
- const Uint16 * green,
- const Uint16 * blue);
-
-/**
- * \brief Get the gamma ramp for a window.
- *
- * \param window The window from which the gamma ramp should be queried.
- * \param red A pointer to a 256 element array of 16-bit quantities to hold
- * the translation table for the red channel, or NULL.
- * \param green A pointer to a 256 element array of 16-bit quantities to hold
- * the translation table for the green channel, or NULL.
- * \param blue A pointer to a 256 element array of 16-bit quantities to hold
- * the translation table for the blue channel, or NULL.
- *
- * \return 0 on success, or -1 if gamma ramps are unsupported.
- *
- * \sa SDL_SetWindowGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
- Uint16 * red,
- Uint16 * green,
- Uint16 * blue);
-
-/**
- * \brief Possible return values from the SDL_HitTest callback.
- *
- * \sa SDL_HitTest
- */
-typedef enum
-{
- SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
- SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
- SDL_HITTEST_RESIZE_TOPLEFT,
- SDL_HITTEST_RESIZE_TOP,
- SDL_HITTEST_RESIZE_TOPRIGHT,
- SDL_HITTEST_RESIZE_RIGHT,
- SDL_HITTEST_RESIZE_BOTTOMRIGHT,
- SDL_HITTEST_RESIZE_BOTTOM,
- SDL_HITTEST_RESIZE_BOTTOMLEFT,
- SDL_HITTEST_RESIZE_LEFT
-} SDL_HitTestResult;
-
-/**
- * \brief Callback used for hit-testing.
- *
- * \sa SDL_SetWindowHitTest
- */
-typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
- const SDL_Point *area,
- void *data);
-
-/**
- * \brief Provide a callback that decides if a window region has special properties.
- *
- * Normally windows are dragged and resized by decorations provided by the
- * system window manager (a title bar, borders, etc), but for some apps, it
- * makes sense to drag them from somewhere else inside the window itself; for
- * example, one might have a borderless window that wants to be draggable
- * from any part, or simulate its own title bar, etc.
- *
- * This function lets the app provide a callback that designates pieces of
- * a given window as special. This callback is run during event processing
- * if we need to tell the OS to treat a region of the window specially; the
- * use of this callback is known as "hit testing."
- *
- * Mouse input may not be delivered to your application if it is within
- * a special area; the OS will often apply that input to moving the window or
- * resizing the window and not deliver it to the application.
- *
- * Specifying NULL for a callback disables hit-testing. Hit-testing is
- * disabled by default.
- *
- * Platforms that don't support this functionality will return -1
- * unconditionally, even if you're attempting to disable hit-testing.
- *
- * Your callback may fire at any time, and its firing does not indicate any
- * specific behavior (for example, on Windows, this certainly might fire
- * when the OS is deciding whether to drag your window, but it fires for lots
- * of other reasons, too, some unrelated to anything you probably care about
- * _and when the mouse isn't actually at the location it is testing_).
- * Since this can fire at any time, you should try to keep your callback
- * efficient, devoid of allocations, etc.
- *
- * \param window The window to set hit-testing on.
- * \param callback The callback to call when doing a hit-test.
- * \param callback_data An app-defined void pointer passed to the callback.
- * \return 0 on success, -1 on error (including unsupported).
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
- SDL_HitTest callback,
- void *callback_data);
-
-/**
- * \brief Destroy a window.
- */
-extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
-
-
-/**
- * \brief Returns whether the screensaver is currently enabled (default off).
- *
- * \sa SDL_EnableScreenSaver()
- * \sa SDL_DisableScreenSaver()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
-
-/**
- * \brief Allow the screen to be blanked by a screensaver
- *
- * \sa SDL_IsScreenSaverEnabled()
- * \sa SDL_DisableScreenSaver()
- */
-extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
-
-/**
- * \brief Prevent the screen from being blanked by a screensaver
- *
- * \sa SDL_IsScreenSaverEnabled()
- * \sa SDL_EnableScreenSaver()
- */
-extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
-
-
-/**
- * \name OpenGL support functions
- */
-/* @{ */
-
-/**
- * \brief Dynamically load an OpenGL library.
- *
- * \param path The platform dependent OpenGL library name, or NULL to open the
- * default OpenGL library.
- *
- * \return 0 on success, or -1 if the library couldn't be loaded.
- *
- * This should be done after initializing the video driver, but before
- * creating any OpenGL windows. If no OpenGL library is loaded, the default
- * library will be loaded upon creation of the first OpenGL window.
- *
- * \note If you do this, you need to retrieve all of the GL functions used in
- * your program from the dynamic library using SDL_GL_GetProcAddress().
- *
- * \sa SDL_GL_GetProcAddress()
- * \sa SDL_GL_UnloadLibrary()
- */
-extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
-
-/**
- * \brief Get the address of an OpenGL function.
- */
-extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
-
-/**
- * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
- *
- * \sa SDL_GL_LoadLibrary()
- */
-extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
-
-/**
- * \brief Return true if an OpenGL extension is supported for the current
- * context.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
- *extension);
-
-/**
- * \brief Reset all previously set OpenGL context attributes to their default values
- */
-extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
-
-/**
- * \brief Set an OpenGL window attribute before window creation.
- *
- * \return 0 on success, or -1 if the attribute could not be set.
- */
-extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
-
-/**
- * \brief Get the actual value for an attribute from the current context.
- *
- * \return 0 on success, or -1 if the attribute could not be retrieved.
- * The integer at \c value will be modified in either case.
- */
-extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
-
-/**
- * \brief Create an OpenGL context for use with an OpenGL window, and make it
- * current.
- *
- * \sa SDL_GL_DeleteContext()
- */
-extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
- window);
-
-/**
- * \brief Set up an OpenGL context for rendering into an OpenGL window.
- *
- * \note The context must have been created with a compatible window.
- */
-extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
- SDL_GLContext context);
-
-/**
- * \brief Get the currently active OpenGL window.
- */
-extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
-
-/**
- * \brief Get the currently active OpenGL context.
- */
-extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
-
-/**
- * \brief Get the size of a window's underlying drawable in pixels (for use
- * with glViewport).
- *
- * \param window Window from which the drawable size should be queried
- * \param w Pointer to variable for storing the width in pixels, may be NULL
- * \param h Pointer to variable for storing the height in pixels, may be NULL
- *
- * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
- * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
- * platform with high-DPI support (Apple calls this "Retina"), and not disabled
- * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
- *
- * \sa SDL_GetWindowSize()
- * \sa SDL_CreateWindow()
- */
-extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
- int *h);
-
-/**
- * \brief Set the swap interval for the current OpenGL context.
- *
- * \param interval 0 for immediate updates, 1 for updates synchronized with the
- * vertical retrace. If the system supports it, you may
- * specify -1 to allow late swaps to happen immediately
- * instead of waiting for the next retrace.
- *
- * \return 0 on success, or -1 if setting the swap interval is not supported.
- *
- * \sa SDL_GL_GetSwapInterval()
- */
-extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
-
-/**
- * \brief Get the swap interval for the current OpenGL context.
- *
- * \return 0 if there is no vertical retrace synchronization, 1 if the buffer
- * swap is synchronized with the vertical retrace, and -1 if late
- * swaps happen immediately instead of waiting for the next retrace.
- * If the system can't determine the swap interval, or there isn't a
- * valid current context, this will return 0 as a safe default.
- *
- * \sa SDL_GL_SetSwapInterval()
- */
-extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
-
-/**
- * \brief Swap the OpenGL buffers for a window, if double-buffering is
- * supported.
- */
-extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
-
-/**
- * \brief Delete an OpenGL context.
- *
- * \sa SDL_GL_CreateContext()
- */
-extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
-
-/* @} *//* OpenGL support functions */
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_video_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_vulkan.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_vulkan.h
deleted file mode 100644
index 803b5fe..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_vulkan.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 2017, Mark Callow
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_vulkan.h
- *
- * Header file for functions to creating Vulkan surfaces on SDL windows.
- */
-
-#ifndef SDL_vulkan_h_
-#define SDL_vulkan_h_
-
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Avoid including vulkan.h, don't define VkInstance if it's already included */
-#ifdef VULKAN_H_
-#define NO_SDL_VULKAN_TYPEDEFS
-#endif
-#ifndef NO_SDL_VULKAN_TYPEDEFS
-#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
-
-#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
-#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
-#else
-#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
-#endif
-
-VK_DEFINE_HANDLE(VkInstance)
-VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
-
-#endif /* !NO_SDL_VULKAN_TYPEDEFS */
-
-typedef VkInstance SDL_vulkanInstance;
-typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
-
-/**
- * \name Vulkan support functions
- *
- * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
- * is compatable with Tizen's implementation of Vulkan in SDL.
- */
-/* @{ */
-
-/**
- * \brief Dynamically load a Vulkan loader library.
- *
- * \param [in] path The platform dependent Vulkan loader library name, or
- * \c NULL to open the default Vulkan loader library.
- *
- * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
- *
- * This should be done after initializing the video driver, but before
- * creating any Vulkan windows. If no Vulkan loader library is loaded, the
- * default library will be loaded upon creation of the first Vulkan window.
- *
- * \note If you specify a non-NULL \a path, you should retrieve all of the
- * Vulkan functions used in your program from the dynamic library using
- * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
- * \a path points to the same vulkan loader library that you linked to.
- *
- * \note On Apple devices, if \a path is NULL, SDL will attempt to find
- * the vkGetInstanceProcAddr address within all the mach-o images of
- * the current process. This is because the currently (v0.17.0)
- * recommended MoltenVK (Vulkan on Metal) usage is as a static library.
- * If it is not found then SDL will attempt to load \c libMoltenVK.dylib.
- * Applications using the dylib alternative therefore do not need to do
- * anything special when calling SDL.
- *
- * \note On non-Apple devices, SDL requires you to either not link to the
- * Vulkan loader or link to a dynamic library version. This limitation
- * may be removed in a future version of SDL.
- *
- * \note This function will fail if there are no working Vulkan drivers
- * installed.
- *
- * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
- * \sa SDL_Vulkan_UnloadLibrary()
- */
-extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
-
-/**
- * \brief Get the address of the \c vkGetInstanceProcAddr function.
- *
- * \note This should be called after either calling SDL_Vulkan_LoadLibrary
- * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
- */
-extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
-
-/**
- * \brief Unload the Vulkan loader library previously loaded by
- * \c SDL_Vulkan_LoadLibrary().
- *
- * \sa SDL_Vulkan_LoadLibrary()
- */
-extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
-
-/**
- * \brief Get the names of the Vulkan instance extensions needed to create
- * a surface with \c SDL_Vulkan_CreateSurface().
- *
- * \param [in] window Window for which the required Vulkan instance
- * extensions should be retrieved
- * \param [in,out] count pointer to an \c unsigned related to the number of
- * required Vulkan instance extensions
- * \param [out] names \c NULL or a pointer to an array to be filled with the
- * required Vulkan instance extensions
- *
- * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
- *
- * If \a pNames is \c NULL, then the number of required Vulkan instance
- * extensions is returned in pCount. Otherwise, \a pCount must point to a
- * variable set to the number of elements in the \a pNames array, and on
- * return the variable is overwritten with the number of names actually
- * written to \a pNames. If \a pCount is less than the number of required
- * extensions, at most \a pCount structures will be written. If \a pCount
- * is smaller than the number of required extensions, \c SDL_FALSE will be
- * returned instead of \c SDL_TRUE, to indicate that not all the required
- * extensions were returned.
- *
- * \note The returned list of extensions will contain \c VK_KHR_surface
- * and zero or more platform specific extensions
- *
- * \note The extension names queried here must be enabled when calling
- * VkCreateInstance, otherwise surface creation will fail.
- *
- * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag.
- *
- * \code
- * unsigned int count;
- * // get count of required extensions
- * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL))
- * handle_error();
- *
- * static const char *const additionalExtensions[] =
- * {
- * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
- * };
- * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
- * size_t extensionCount = count + additionalExtensionsCount;
- * const char **names = malloc(sizeof(const char *) * extensionCount);
- * if(!names)
- * handle_error();
- *
- * // get names of required extensions
- * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names))
- * handle_error();
- *
- * // copy additional extensions after required extensions
- * for(size_t i = 0; i < additionalExtensionsCount; i++)
- * names[i + count] = additionalExtensions[i];
- *
- * VkInstanceCreateInfo instanceCreateInfo = {};
- * instanceCreateInfo.enabledExtensionCount = extensionCount;
- * instanceCreateInfo.ppEnabledExtensionNames = names;
- * // fill in rest of instanceCreateInfo
- *
- * VkInstance instance;
- * // create the Vulkan instance
- * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
- * free(names);
- * \endcode
- *
- * \sa SDL_Vulkan_CreateSurface()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
- SDL_Window *window,
- unsigned int *pCount,
- const char **pNames);
-
-/**
- * \brief Create a Vulkan rendering surface for a window.
- *
- * \param [in] window SDL_Window to which to attach the rendering surface.
- * \param [in] instance handle to the Vulkan instance to use.
- * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
- * handle of the newly created surface.
- *
- * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
- *
- * \code
- * VkInstance instance;
- * SDL_Window *window;
- *
- * // create instance and window
- *
- * // create the Vulkan surface
- * VkSurfaceKHR surface;
- * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
- * handle_error();
- * \endcode
- *
- * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
- *
- * \note \a instance should have been created with the extensions returned
- * by \c SDL_Vulkan_CreateSurface() enabled.
- *
- * \sa SDL_Vulkan_GetInstanceExtensions()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
- SDL_Window *window,
- VkInstance instance,
- VkSurfaceKHR* surface);
-
-/**
- * \brief Get the size of a window's underlying drawable in pixels (for use
- * with setting viewport, scissor & etc).
- *
- * \param window SDL_Window from which the drawable size should be queried
- * \param w Pointer to variable for storing the width in pixels,
- * may be NULL
- * \param h Pointer to variable for storing the height in pixels,
- * may be NULL
- *
- * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
- * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
- * platform with high-DPI support (Apple calls this "Retina"), and not disabled
- * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
- *
- * \sa SDL_GetWindowSize()
- * \sa SDL_CreateWindow()
- */
-extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
- int *w, int *h);
-
-/* @} *//* Vulkan support functions */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_vulkan_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/begin_code.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/begin_code.h
deleted file mode 100644
index 5372d6f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/begin_code.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file begin_code.h
- *
- * This file sets things up for C dynamic library function definitions,
- * static inlined functions, and structures aligned at 4-byte alignment.
- * If you don't like ugly C preprocessor code, don't look at this file. :)
- */
-
-/* This shouldn't be nested -- included it around code only. */
-#ifdef _begin_code_h
-#error Nested inclusion of begin_code.h
-#endif
-#define _begin_code_h
-
-#ifndef SDL_DEPRECATED
-# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
-# define SDL_DEPRECATED __attribute__((deprecated))
-# else
-# define SDL_DEPRECATED
-# endif
-#endif
-
-#ifndef SDL_UNUSED
-# ifdef __GNUC__
-# define SDL_UNUSED __attribute__((unused))
-# else
-# define SDL_UNUSED
-# endif
-#endif
-
-/* Some compilers use a special export keyword */
-#ifndef DECLSPEC
-# if defined(__WIN32__) || defined(__WINRT__)
-# ifdef __BORLANDC__
-# ifdef BUILD_SDL
-# define DECLSPEC
-# else
-# define DECLSPEC __declspec(dllimport)
-# endif
-# else
-# define DECLSPEC __declspec(dllexport)
-# endif
-# elif defined(__OS2__)
-# ifdef BUILD_SDL
-# define DECLSPEC __declspec(dllexport)
-# else
-# define DECLSPEC
-# endif
-# else
-# if defined(__GNUC__) && __GNUC__ >= 4
-# define DECLSPEC __attribute__ ((visibility("default")))
-# else
-# define DECLSPEC
-# endif
-# endif
-#endif
-
-/* By default SDL uses the C calling convention */
-#ifndef SDLCALL
-#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
-#define SDLCALL __cdecl
-#elif defined(__OS2__) || defined(__EMX__)
-#define SDLCALL _System
-# if defined (__GNUC__) && !defined(_System)
-# define _System /* for old EMX/GCC compat. */
-# endif
-#else
-#define SDLCALL
-#endif
-#endif /* SDLCALL */
-
-/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
-#ifdef __SYMBIAN32__
-#undef DECLSPEC
-#define DECLSPEC
-#endif /* __SYMBIAN32__ */
-
-/* Force structure packing at 4 byte alignment.
- This is necessary if the header is included in code which has structure
- packing set to an alternate value, say for loading structures from disk.
- The packing is reset to the previous value in close_code.h
- */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
-#ifdef _MSC_VER
-#pragma warning(disable: 4103)
-#endif
-#ifdef __BORLANDC__
-#pragma nopackwarning
-#endif
-#ifdef _M_X64
-/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
-#pragma pack(push,8)
-#else
-#pragma pack(push,4)
-#endif
-#endif /* Compiler needs structure packing set */
-
-#ifndef SDL_INLINE
-#if defined(__GNUC__)
-#define SDL_INLINE __inline__
-#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
- defined(__DMC__) || defined(__SC__) || \
- defined(__WATCOMC__) || defined(__LCC__) || \
- defined(__DECC) || defined(__CC_ARM)
-#define SDL_INLINE __inline
-#ifndef __inline__
-#define __inline__ __inline
-#endif
-#else
-#define SDL_INLINE inline
-#ifndef __inline__
-#define __inline__ inline
-#endif
-#endif
-#endif /* SDL_INLINE not defined */
-
-#ifndef SDL_FORCE_INLINE
-#if defined(_MSC_VER)
-#define SDL_FORCE_INLINE __forceinline
-#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
-#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
-#else
-#define SDL_FORCE_INLINE static SDL_INLINE
-#endif
-#endif /* SDL_FORCE_INLINE not defined */
-
-#ifndef SDL_NORETURN
-#if defined(__GNUC__)
-#define SDL_NORETURN __attribute__((noreturn))
-#elif defined(_MSC_VER)
-#define SDL_NORETURN __declspec(noreturn)
-#else
-#define SDL_NORETURN
-#endif
-#endif /* SDL_NORETURN not defined */
-
-/* Apparently this is needed by several Windows compilers */
-#if !defined(__MACH__)
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif /* NULL */
-#endif /* ! Mac OS X - breaks precompiled headers */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/close_code.h b/build/vc++/libs/SDL2-2.0.5/include/SDL2/close_code.h
deleted file mode 100644
index 2a352db..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/close_code.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file close_code.h
- *
- * This file reverses the effects of begin_code.h and should be included
- * after you finish any function and structure declarations in your headers
- */
-
-#undef _begin_code_h
-
-/* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
-#ifdef __BORLANDC__
-#pragma nopackwarning
-#endif
-#pragma pack(pop)
-#endif /* Compiler needs structure packing set */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_assert.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_assert.h
deleted file mode 100644
index 90abbe3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_assert.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_assert_h_
-#define SDL_assert_h_
-
-#include "SDL_config.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SDL_ASSERT_LEVEL
-#ifdef SDL_DEFAULT_ASSERT_LEVEL
-#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
-#elif defined(_DEBUG) || defined(DEBUG) || \
- (defined(__GNUC__) && !defined(__OPTIMIZE__))
-#define SDL_ASSERT_LEVEL 2
-#else
-#define SDL_ASSERT_LEVEL 1
-#endif
-#endif /* SDL_ASSERT_LEVEL */
-
-/*
-These are macros and not first class functions so that the debugger breaks
-on the assertion line and not in some random guts of SDL, and so each
-assert can have unique static variables associated with it.
-*/
-
-#if defined(_MSC_VER)
-/* Don't include intrin.h here because it contains C++ code */
- extern void __cdecl __debugbreak(void);
- #define SDL_TriggerBreakpoint() __debugbreak()
-#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
- #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(__386__) && defined(__WATCOMC__)
- #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
-#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
- #include <signal.h>
- #define SDL_TriggerBreakpoint() raise(SIGTRAP)
-#else
- /* How do we trigger breakpoints on this platform? */
- #define SDL_TriggerBreakpoint()
-#endif
-
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
-# define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
-# define SDL_FUNCTION __FUNCTION__
-#else
-# define SDL_FUNCTION "???"
-#endif
-#define SDL_FILE __FILE__
-#define SDL_LINE __LINE__
-
-/*
-sizeof (x) makes the compiler still parse the expression even without
-assertions enabled, so the code is always checked at compile time, but
-doesn't actually generate code for it, so there are no side effects or
-expensive checks at run time, just the constant size of what x WOULD be,
-which presumably gets optimized out as unused.
-This also solves the problem of...
-
- int somevalue = blah();
- SDL_assert(somevalue == 1);
-
-...which would cause compiles to complain that somevalue is unused if we
-disable assertions.
-*/
-
-/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
- this condition isn't constant. And looks like an owl's face! */
-#ifdef _MSC_VER /* stupid /W4 warnings. */
-#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
-#else
-#define SDL_NULL_WHILE_LOOP_CONDITION (0)
-#endif
-
-#define SDL_disabled_assert(condition) \
- do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
-
-typedef enum
-{
- SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
- SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
- SDL_ASSERTION_ABORT, /**< Terminate the program. */
- SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
- SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
-} SDL_AssertState;
-
-typedef struct SDL_AssertData
-{
- int always_ignore;
- unsigned int trigger_count;
- const char *condition;
- const char *filename;
- int linenum;
- const char *function;
- const struct SDL_AssertData *next;
-} SDL_AssertData;
-
-#if (SDL_ASSERT_LEVEL > 0)
-
-/* Never call this directly. Use the SDL_assert* macros. */
-extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
- const char *,
- const char *, int)
-#if defined(__clang__)
-#if __has_feature(attribute_analyzer_noreturn)
-/* this tells Clang's static analysis that we're a custom assert function,
- and that the analyzer should assume the condition was always true past this
- SDL_assert test. */
- __attribute__((analyzer_noreturn))
-#endif
-#endif
-;
-
-/* the do {} while(0) avoids dangling else problems:
- if (x) SDL_assert(y); else blah();
- ... without the do/while, the "else" could attach to this macro's "if".
- We try to handle just the minimum we need here in a macro...the loop,
- the static vars, and break points. The heavy lifting is handled in
- SDL_ReportAssertion(), in SDL_assert.c.
-*/
-#define SDL_enabled_assert(condition) \
- do { \
- while ( !(condition) ) { \
- static struct SDL_AssertData sdl_assert_data = { \
- 0, 0, #condition, 0, 0, 0, 0 \
- }; \
- const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
- if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
- continue; /* go again. */ \
- } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
- SDL_TriggerBreakpoint(); \
- } \
- break; /* not retrying. */ \
- } \
- } while (SDL_NULL_WHILE_LOOP_CONDITION)
-
-#endif /* enabled assertions support code */
-
-/* Enable various levels of assertions. */
-#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
-# define SDL_assert(condition) SDL_disabled_assert(condition)
-# define SDL_assert_release(condition) SDL_disabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
-#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
-# define SDL_assert(condition) SDL_disabled_assert(condition)
-# define SDL_assert_release(condition) SDL_enabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
-#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
-# define SDL_assert(condition) SDL_enabled_assert(condition)
-# define SDL_assert_release(condition) SDL_enabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
-#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
-# define SDL_assert(condition) SDL_enabled_assert(condition)
-# define SDL_assert_release(condition) SDL_enabled_assert(condition)
-# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
-#else
-# error Unknown assertion level.
-#endif
-
-/* this assertion is never disabled at any level. */
-#define SDL_assert_always(condition) SDL_enabled_assert(condition)
-
-
-typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
- const SDL_AssertData* data, void* userdata);
-
-/**
- * \brief Set an application-defined assertion handler.
- *
- * This allows an app to show its own assertion UI and/or force the
- * response to an assertion failure. If the app doesn't provide this, SDL
- * will try to do the right thing, popping up a system-specific GUI dialog,
- * and probably minimizing any fullscreen windows.
- *
- * This callback may fire from any thread, but it runs wrapped in a mutex, so
- * it will only fire from one thread at a time.
- *
- * Setting the callback to NULL restores SDL's original internal handler.
- *
- * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
- *
- * Return SDL_AssertState value of how to handle the assertion failure.
- *
- * \param handler Callback function, called when an assertion fails.
- * \param userdata A pointer passed to the callback as-is.
- */
-extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
- SDL_AssertionHandler handler,
- void *userdata);
-
-/**
- * \brief Get the default assertion handler.
- *
- * This returns the function pointer that is called by default when an
- * assertion is triggered. This is an internal function provided by SDL,
- * that is used for assertions when SDL_SetAssertionHandler() hasn't been
- * used to provide a different function.
- *
- * \return The default SDL_AssertionHandler that is called when an assert triggers.
- */
-extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
-
-/**
- * \brief Get the current assertion handler.
- *
- * This returns the function pointer that is called when an assertion is
- * triggered. This is either the value last passed to
- * SDL_SetAssertionHandler(), or if no application-specified function is
- * set, is equivalent to calling SDL_GetDefaultAssertionHandler().
- *
- * \param puserdata Pointer to a void*, which will store the "userdata"
- * pointer that was passed to SDL_SetAssertionHandler().
- * This value will always be NULL for the default handler.
- * If you don't care about this data, it is safe to pass
- * a NULL pointer to this function to ignore it.
- * \return The SDL_AssertionHandler that is called when an assert triggers.
- */
-extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
-
-/**
- * \brief Get a list of all assertion failures.
- *
- * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
- * or the start of the program.
- *
- * The proper way to examine this data looks something like this:
- *
- * <code>
- * const SDL_AssertData *item = SDL_GetAssertionReport();
- * while (item) {
- * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
- * item->condition, item->function, item->filename,
- * item->linenum, item->trigger_count,
- * item->always_ignore ? "yes" : "no");
- * item = item->next;
- * }
- * </code>
- *
- * \return List of all assertions.
- * \sa SDL_ResetAssertionReport
- */
-extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
-
-/**
- * \brief Reset the list of all assertion failures.
- *
- * Reset list of all assertions triggered.
- *
- * \sa SDL_GetAssertionReport
- */
-extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
-
-
-/* these had wrong naming conventions until 2.0.4. Please update your app! */
-#define SDL_assert_state SDL_AssertState
-#define SDL_assert_data SDL_AssertData
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_assert_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_atomic.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_atomic.h
deleted file mode 100644
index 36e37f3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_atomic.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_atomic.h
- *
- * Atomic operations.
- *
- * IMPORTANT:
- * If you are not an expert in concurrent lockless programming, you should
- * only be using the atomic lock and reference counting functions in this
- * file. In all other cases you should be protecting your data structures
- * with full mutexes.
- *
- * The list of "safe" functions to use are:
- * SDL_AtomicLock()
- * SDL_AtomicUnlock()
- * SDL_AtomicIncRef()
- * SDL_AtomicDecRef()
- *
- * Seriously, here be dragons!
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- *
- * You can find out a little more about lockless programming and the
- * subtle issues that can arise here:
- * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
- *
- * There's also lots of good information here:
- * http://www.1024cores.net/home/lock-free-algorithms
- * http://preshing.com/
- *
- * These operations may or may not actually be implemented using
- * processor specific atomic operations. When possible they are
- * implemented as true processor specific atomic operations. When that
- * is not possible the are implemented using locks that *do* use the
- * available atomic operations.
- *
- * All of the atomic operations that modify memory are full memory barriers.
- */
-
-#ifndef SDL_atomic_h_
-#define SDL_atomic_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_platform.h"
-
-#include "begin_code.h"
-
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name SDL AtomicLock
- *
- * The atomic locks are efficient spinlocks using CPU instructions,
- * but are vulnerable to starvation and can spin forever if a thread
- * holding a lock has been terminated. For this reason you should
- * minimize the code executed inside an atomic lock and never do
- * expensive things like API or system calls while holding them.
- *
- * The atomic locks are not safe to lock recursively.
- *
- * Porting Note:
- * The spin lock functions and type are required and can not be
- * emulated because they are used in the atomic emulation code.
- */
-/* @{ */
-
-typedef int SDL_SpinLock;
-
-/**
- * \brief Try to lock a spin lock by setting it to a non-zero value.
- *
- * \param lock Points to the lock.
- *
- * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
-
-/**
- * \brief Lock a spin lock by setting it to a non-zero value.
- *
- * \param lock Points to the lock.
- */
-extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
-
-/**
- * \brief Unlock a spin lock by setting it to 0. Always returns immediately
- *
- * \param lock Points to the lock.
- */
-extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
-
-/* @} *//* SDL AtomicLock */
-
-
-/**
- * The compiler barrier prevents the compiler from reordering
- * reads and writes to globally visible variables across the call.
- */
-#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
-void _ReadWriteBarrier(void);
-#pragma intrinsic(_ReadWriteBarrier)
-#define SDL_CompilerBarrier() _ReadWriteBarrier()
-#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
-/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
-#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
-#elif defined(__WATCOMC__)
-extern _inline void SDL_CompilerBarrier (void);
-#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
-#else
-#define SDL_CompilerBarrier() \
-{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
-#endif
-
-/**
- * Memory barriers are designed to prevent reads and writes from being
- * reordered by the compiler and being seen out of order on multi-core CPUs.
- *
- * A typical pattern would be for thread A to write some data and a flag,
- * and for thread B to read the flag and get the data. In this case you
- * would insert a release barrier between writing the data and the flag,
- * guaranteeing that the data write completes no later than the flag is
- * written, and you would insert an acquire barrier between reading the
- * flag and reading the data, to ensure that all the reads associated
- * with the flag have completed.
- *
- * In this pattern you should always see a release barrier paired with
- * an acquire barrier and you should gate the data reads/writes with a
- * single flag variable.
- *
- * For more information on these semantics, take a look at the blog post:
- * http://preshing.com/20120913/acquire-and-release-semantics
- */
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
-
-#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
-#elif defined(__GNUC__) && defined(__arm__)
-#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
-#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
-#ifdef __thumb__
-/* The mcr instruction isn't available in thumb mode, use real functions */
-#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
-#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
-#else
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
-#endif /* __thumb__ */
-#else
-#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
-#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
-#endif /* __GNUC__ && __arm__ */
-#else
-#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
-/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
-#include <mbarrier.h>
-#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
-#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
-#else
-/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
-#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
-#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
-#endif
-#endif
-
-/**
- * \brief A type representing an atomic integer value. It is a struct
- * so people don't accidentally use numeric operations on it.
- */
-typedef struct { int value; } SDL_atomic_t;
-
-/**
- * \brief Set an atomic variable to a new value if it is currently an old value.
- *
- * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
- *
- * \note If you don't know what this function is for, you shouldn't use it!
-*/
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
-
-/**
- * \brief Set an atomic variable to a value.
- *
- * \return The previous value of the atomic variable.
- */
-extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
-
-/**
- * \brief Get the value of an atomic variable
- */
-extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
-
-/**
- * \brief Add to an atomic variable.
- *
- * \return The previous value of the atomic variable.
- *
- * \note This same style can be used for any number operation
- */
-extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
-
-/**
- * \brief Increment an atomic variable used as a reference count.
- */
-#ifndef SDL_AtomicIncRef
-#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
-#endif
-
-/**
- * \brief Decrement an atomic variable used as a reference count.
- *
- * \return SDL_TRUE if the variable reached zero after decrementing,
- * SDL_FALSE otherwise
- */
-#ifndef SDL_AtomicDecRef
-#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
-#endif
-
-/**
- * \brief Set a pointer to a new value if it is currently an old value.
- *
- * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
- *
- * \note If you don't know what this function is for, you shouldn't use it!
-*/
-extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
-
-/**
- * \brief Set a pointer to a value atomically.
- *
- * \return The previous value of the pointer.
- */
-extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
-
-/**
- * \brief Get the value of a pointer atomically.
- */
-extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-
-#include "close_code.h"
-
-#endif /* SDL_atomic_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_audio.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_audio.h
deleted file mode 100644
index f119c2b..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_audio.h
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_audio.h
- *
- * Access to the raw audio mixing buffer for the SDL library.
- */
-
-#ifndef SDL_audio_h_
-#define SDL_audio_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_endian.h"
-#include "SDL_mutex.h"
-#include "SDL_thread.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Audio format flags.
- *
- * These are what the 16 bits in SDL_AudioFormat currently mean...
- * (Unspecified bits are always zero).
- *
- * \verbatim
- ++-----------------------sample is signed if set
- ||
- || ++-----------sample is bigendian if set
- || ||
- || || ++---sample is float if set
- || || ||
- || || || +---sample bit size---+
- || || || | |
- 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
- \endverbatim
- *
- * There are macros in SDL 2.0 and later to query these bits.
- */
-typedef Uint16 SDL_AudioFormat;
-
-/**
- * \name Audio flags
- */
-/* @{ */
-
-#define SDL_AUDIO_MASK_BITSIZE (0xFF)
-#define SDL_AUDIO_MASK_DATATYPE (1<<8)
-#define SDL_AUDIO_MASK_ENDIAN (1<<12)
-#define SDL_AUDIO_MASK_SIGNED (1<<15)
-#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
-#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
-#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
-#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
-#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
-#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
-#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
-
-/**
- * \name Audio format flags
- *
- * Defaults to LSB byte order.
- */
-/* @{ */
-#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
-#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
-#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
-#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
-#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
-#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
-#define AUDIO_U16 AUDIO_U16LSB
-#define AUDIO_S16 AUDIO_S16LSB
-/* @} */
-
-/**
- * \name int32 support
- */
-/* @{ */
-#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
-#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
-#define AUDIO_S32 AUDIO_S32LSB
-/* @} */
-
-/**
- * \name float32 support
- */
-/* @{ */
-#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
-#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
-#define AUDIO_F32 AUDIO_F32LSB
-/* @} */
-
-/**
- * \name Native audio byte ordering
- */
-/* @{ */
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define AUDIO_U16SYS AUDIO_U16LSB
-#define AUDIO_S16SYS AUDIO_S16LSB
-#define AUDIO_S32SYS AUDIO_S32LSB
-#define AUDIO_F32SYS AUDIO_F32LSB
-#else
-#define AUDIO_U16SYS AUDIO_U16MSB
-#define AUDIO_S16SYS AUDIO_S16MSB
-#define AUDIO_S32SYS AUDIO_S32MSB
-#define AUDIO_F32SYS AUDIO_F32MSB
-#endif
-/* @} */
-
-/**
- * \name Allow change flags
- *
- * Which audio format changes are allowed when opening a device.
- */
-/* @{ */
-#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
-#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
-#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
-#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
-/* @} */
-
-/* @} *//* Audio flags */
-
-/**
- * This function is called when the audio device needs more data.
- *
- * \param userdata An application-specific parameter saved in
- * the SDL_AudioSpec structure
- * \param stream A pointer to the audio data buffer.
- * \param len The length of that buffer in bytes.
- *
- * Once the callback returns, the buffer will no longer be valid.
- * Stereo samples are stored in a LRLRLR ordering.
- *
- * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
- * you like. Just open your audio device with a NULL callback.
- */
-typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
- int len);
-
-/**
- * The calculated values in this structure are calculated by SDL_OpenAudio().
- *
- * For multi-channel audio, the default SDL channel mapping is:
- * 2: FL FR (stereo)
- * 3: FL FR LFE (2.1 surround)
- * 4: FL FR BL BR (quad)
- * 5: FL FR FC BL BR (quad + center)
- * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
- * 7: FL FR FC LFE BC SL SR (6.1 surround)
- * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
- */
-typedef struct SDL_AudioSpec
-{
- int freq; /**< DSP frequency -- samples per second */
- SDL_AudioFormat format; /**< Audio data format */
- Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
- Uint8 silence; /**< Audio buffer silence value (calculated) */
- Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
- Uint16 padding; /**< Necessary for some compile environments */
- Uint32 size; /**< Audio buffer size in bytes (calculated) */
- SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
- void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
-} SDL_AudioSpec;
-
-
-struct SDL_AudioCVT;
-typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
- SDL_AudioFormat format);
-
-/**
- * \brief Upper limit of filters in SDL_AudioCVT
- *
- * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
- * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
- * one of which is the terminating NULL pointer.
- */
-#define SDL_AUDIOCVT_MAX_FILTERS 9
-
-/**
- * \struct SDL_AudioCVT
- * \brief A structure to hold a set of audio conversion filters and buffers.
- *
- * Note that various parts of the conversion pipeline can take advantage
- * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
- * you to pass it aligned data, but can possibly run much faster if you
- * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
- * (len) field to something that's a multiple of 16, if possible.
- */
-#ifdef __GNUC__
-/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
- pad it out to 88 bytes to guarantee ABI compatibility between compilers.
- vvv
- The next time we rev the ABI, make sure to size the ints and add padding.
-*/
-#define SDL_AUDIOCVT_PACKED __attribute__((packed))
-#else
-#define SDL_AUDIOCVT_PACKED
-#endif
-/* */
-typedef struct SDL_AudioCVT
-{
- int needed; /**< Set to 1 if conversion possible */
- SDL_AudioFormat src_format; /**< Source audio format */
- SDL_AudioFormat dst_format; /**< Target audio format */
- double rate_incr; /**< Rate conversion increment */
- Uint8 *buf; /**< Buffer to hold entire audio data */
- int len; /**< Length of original audio buffer */
- int len_cvt; /**< Length of converted audio buffer */
- int len_mult; /**< buffer must be len*len_mult big */
- double len_ratio; /**< Given len, final size is len*len_ratio */
- SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
- int filter_index; /**< Current audio conversion function */
-} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
-
-
-/* Function prototypes */
-
-/**
- * \name Driver discovery functions
- *
- * These functions return the list of built in audio drivers, in the
- * order that they are normally initialized by default.
- */
-/* @{ */
-extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
-extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
-/* @} */
-
-/**
- * \name Initialization and cleanup
- *
- * \internal These functions are used internally, and should not be used unless
- * you have a specific need to specify the audio driver you want to
- * use. You should normally use SDL_Init() or SDL_InitSubSystem().
- */
-/* @{ */
-extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
-extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
-/* @} */
-
-/**
- * This function returns the name of the current audio driver, or NULL
- * if no driver has been initialized.
- */
-extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
-
-/**
- * This function opens the audio device with the desired parameters, and
- * returns 0 if successful, placing the actual hardware parameters in the
- * structure pointed to by \c obtained. If \c obtained is NULL, the audio
- * data passed to the callback function will be guaranteed to be in the
- * requested format, and will be automatically converted to the hardware
- * audio format if necessary. This function returns -1 if it failed
- * to open the audio device, or couldn't set up the audio thread.
- *
- * When filling in the desired audio spec structure,
- * - \c desired->freq should be the desired audio frequency in samples-per-
- * second.
- * - \c desired->format should be the desired audio format.
- * - \c desired->samples is the desired size of the audio buffer, in
- * samples. This number should be a power of two, and may be adjusted by
- * the audio driver to a value more suitable for the hardware. Good values
- * seem to range between 512 and 8096 inclusive, depending on the
- * application and CPU speed. Smaller values yield faster response time,
- * but can lead to underflow if the application is doing heavy processing
- * and cannot fill the audio buffer in time. A stereo sample consists of
- * both right and left channels in LR ordering.
- * Note that the number of samples is directly related to time by the
- * following formula: \code ms = (samples*1000)/freq \endcode
- * - \c desired->size is the size in bytes of the audio buffer, and is
- * calculated by SDL_OpenAudio().
- * - \c desired->silence is the value used to set the buffer to silence,
- * and is calculated by SDL_OpenAudio().
- * - \c desired->callback should be set to a function that will be called
- * when the audio device is ready for more data. It is passed a pointer
- * to the audio buffer, and the length in bytes of the audio buffer.
- * This function usually runs in a separate thread, and so you should
- * protect data structures that it accesses by calling SDL_LockAudio()
- * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
- * pointer here, and call SDL_QueueAudio() with some frequency, to queue
- * more audio samples to be played (or for capture devices, call
- * SDL_DequeueAudio() with some frequency, to obtain audio samples).
- * - \c desired->userdata is passed as the first parameter to your callback
- * function. If you passed a NULL callback, this value is ignored.
- *
- * The audio device starts out playing silence when it's opened, and should
- * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
- * for your audio callback function to be called. Since the audio driver
- * may modify the requested size of the audio buffer, you should allocate
- * any local mixing buffers after you open the audio device.
- */
-extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
- SDL_AudioSpec * obtained);
-
-/**
- * SDL Audio Device IDs.
- *
- * A successful call to SDL_OpenAudio() is always device id 1, and legacy
- * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
- * always returns devices >= 2 on success. The legacy calls are good both
- * for backwards compatibility and when you don't care about multiple,
- * specific, or capture devices.
- */
-typedef Uint32 SDL_AudioDeviceID;
-
-/**
- * Get the number of available devices exposed by the current driver.
- * Only valid after a successfully initializing the audio subsystem.
- * Returns -1 if an explicit list of devices can't be determined; this is
- * not an error. For example, if SDL is set up to talk to a remote audio
- * server, it can't list every one available on the Internet, but it will
- * still allow a specific host to be specified to SDL_OpenAudioDevice().
- *
- * In many common cases, when this function returns a value <= 0, it can still
- * successfully open the default device (NULL for first argument of
- * SDL_OpenAudioDevice()).
- */
-extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
-
-/**
- * Get the human-readable name of a specific audio device.
- * Must be a value between 0 and (number of audio devices-1).
- * Only valid after a successfully initializing the audio subsystem.
- * The values returned by this function reflect the latest call to
- * SDL_GetNumAudioDevices(); recall that function to redetect available
- * hardware.
- *
- * The string returned by this function is UTF-8 encoded, read-only, and
- * managed internally. You are not to free it. If you need to keep the
- * string for any length of time, you should make your own copy of it, as it
- * will be invalid next time any of several other SDL functions is called.
- */
-extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
- int iscapture);
-
-
-/**
- * Open a specific audio device. Passing in a device name of NULL requests
- * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
- *
- * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
- * some drivers allow arbitrary and driver-specific strings, such as a
- * hostname/IP address for a remote audio server, or a filename in the
- * diskaudio driver.
- *
- * \return 0 on error, a valid device ID that is >= 2 on success.
- *
- * SDL_OpenAudio(), unlike this function, always acts on device ID 1.
- */
-extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
- *device,
- int iscapture,
- const
- SDL_AudioSpec *
- desired,
- SDL_AudioSpec *
- obtained,
- int
- allowed_changes);
-
-
-
-/**
- * \name Audio state
- *
- * Get the current audio state.
- */
-/* @{ */
-typedef enum
-{
- SDL_AUDIO_STOPPED = 0,
- SDL_AUDIO_PLAYING,
- SDL_AUDIO_PAUSED
-} SDL_AudioStatus;
-extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
-
-extern DECLSPEC SDL_AudioStatus SDLCALL
-SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
-/* @} *//* Audio State */
-
-/**
- * \name Pause audio functions
- *
- * These functions pause and unpause the audio callback processing.
- * They should be called with a parameter of 0 after opening the audio
- * device to start playing sound. This is so you can safely initialize
- * data for your callback function after opening the audio device.
- * Silence will be written to the audio device during the pause.
- */
-/* @{ */
-extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
-extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
- int pause_on);
-/* @} *//* Pause audio functions */
-
-/**
- * This function loads a WAVE from the data source, automatically freeing
- * that source if \c freesrc is non-zero. For example, to load a WAVE file,
- * you could do:
- * \code
- * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
- * \endcode
- *
- * If this function succeeds, it returns the given SDL_AudioSpec,
- * filled with the audio data format of the wave data, and sets
- * \c *audio_buf to a malloc()'d buffer containing the audio data,
- * and sets \c *audio_len to the length of that audio buffer, in bytes.
- * You need to free the audio buffer with SDL_FreeWAV() when you are
- * done with it.
- *
- * This function returns NULL and sets the SDL error message if the
- * wave file cannot be opened, uses an unknown data format, or is
- * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
- */
-extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
- int freesrc,
- SDL_AudioSpec * spec,
- Uint8 ** audio_buf,
- Uint32 * audio_len);
-
-/**
- * Loads a WAV from a file.
- * Compatibility convenience function.
- */
-#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
- SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
-
-/**
- * This function frees data previously allocated with SDL_LoadWAV_RW()
- */
-extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
-
-/**
- * This function takes a source format and rate and a destination format
- * and rate, and initializes the \c cvt structure with information needed
- * by SDL_ConvertAudio() to convert a buffer of audio data from one format
- * to the other. An unsupported format causes an error and -1 will be returned.
- *
- * \return 0 if no conversion is needed, 1 if the audio filter is set up,
- * or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
- SDL_AudioFormat src_format,
- Uint8 src_channels,
- int src_rate,
- SDL_AudioFormat dst_format,
- Uint8 dst_channels,
- int dst_rate);
-
-/**
- * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
- * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
- * audio data in the source format, this function will convert it in-place
- * to the desired format.
- *
- * The data conversion may expand the size of the audio data, so the buffer
- * \c cvt->buf should be allocated after the \c cvt structure is initialized by
- * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
- *
- * \return 0 on success or -1 if \c cvt->buf is NULL.
- */
-extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
-
-/* SDL_AudioStream is a new audio conversion interface.
- The benefits vs SDL_AudioCVT:
- - it can handle resampling data in chunks without generating
- artifacts, when it doesn't have the complete buffer available.
- - it can handle incoming data in any variable size.
- - You push data as you have it, and pull it when you need it
- */
-/* this is opaque to the outside world. */
-struct _SDL_AudioStream;
-typedef struct _SDL_AudioStream SDL_AudioStream;
-
-/**
- * Create a new audio stream
- *
- * \param src_format The format of the source audio
- * \param src_channels The number of channels of the source audio
- * \param src_rate The sampling rate of the source audio
- * \param dst_format The format of the desired audio output
- * \param dst_channels The number of channels of the desired audio output
- * \param dst_rate The sampling rate of the desired audio output
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
- const Uint8 src_channels,
- const int src_rate,
- const SDL_AudioFormat dst_format,
- const Uint8 dst_channels,
- const int dst_rate);
-
-/**
- * Add data to be converted/resampled to the stream
- *
- * \param stream The stream the audio data is being added to
- * \param buf A pointer to the audio data to add
- * \param int The number of bytes to write to the stream
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
-
-/**
- * Get converted/resampled data from the stream
- *
- * \param stream The stream the audio is being requested from
- * \param buf A buffer to fill with audio data
- * \param len The maximum number of bytes to fill
- * \return The number of bytes read from the stream, or -1 on error
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
-
-/**
- * Get the number of converted/resampled bytes available. The stream may be
- * buffering data behind the scenes until it has enough to resample
- * correctly, so this number might be lower than what you expect, or even
- * be zero. Add more data or flush the stream if you need the data now.
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
-
-/**
- * Tell the stream that you're done sending data, and anything being buffered
- * should be converted/resampled and made available immediately.
- *
- * It is legal to add more data to a stream after flushing, but there will
- * be audio gaps in the output. Generally this is intended to signal the
- * end of input, so the complete output becomes available.
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamClear
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
-
-/**
- * Clear any pending data in the stream without converting it
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_FreeAudioStream
- */
-extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
-
-/**
- * Free an audio stream
- *
- * \sa SDL_NewAudioStream
- * \sa SDL_AudioStreamPut
- * \sa SDL_AudioStreamGet
- * \sa SDL_AudioStreamAvailable
- * \sa SDL_AudioStreamFlush
- * \sa SDL_AudioStreamClear
- */
-extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
-
-#define SDL_MIX_MAXVOLUME 128
-/**
- * This takes two audio buffers of the playing audio format and mixes
- * them, performing addition, volume adjustment, and overflow clipping.
- * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
- * for full audio volume. Note this does not change hardware volume.
- * This is provided for convenience -- you can mix your own audio data.
- */
-extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
- Uint32 len, int volume);
-
-/**
- * This works like SDL_MixAudio(), but you specify the audio format instead of
- * using the format of audio device 1. Thus it can be used when no audio
- * device is open at all.
- */
-extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
- const Uint8 * src,
- SDL_AudioFormat format,
- Uint32 len, int volume);
-
-/**
- * Queue more audio on non-callback devices.
- *
- * (If you are looking to retrieve queued audio from a non-callback capture
- * device, you want SDL_DequeueAudio() instead. This will return -1 to
- * signify an error if you use it with capture devices.)
- *
- * SDL offers two ways to feed audio to the device: you can either supply a
- * callback that SDL triggers with some frequency to obtain more audio
- * (pull method), or you can supply no callback, and then SDL will expect
- * you to supply data at regular intervals (push method) with this function.
- *
- * There are no limits on the amount of data you can queue, short of
- * exhaustion of address space. Queued data will drain to the device as
- * necessary without further intervention from you. If the device needs
- * audio but there is not enough queued, it will play silence to make up
- * the difference. This means you will have skips in your audio playback
- * if you aren't routinely queueing sufficient data.
- *
- * This function copies the supplied data, so you are safe to free it when
- * the function returns. This function is thread-safe, but queueing to the
- * same device from two threads at once does not promise which buffer will
- * be queued first.
- *
- * You may not queue audio on a device that is using an application-supplied
- * callback; doing so returns an error. You have to use the audio callback
- * or queue audio with this function, but not both.
- *
- * You should not call SDL_LockAudio() on the device before queueing; SDL
- * handles locking internally for this function.
- *
- * \param dev The device ID to which we will queue audio.
- * \param data The data to queue to the device for later playback.
- * \param len The number of bytes (not samples!) to which (data) points.
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_GetQueuedAudioSize
- * \sa SDL_ClearQueuedAudio
- */
-extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
-
-/**
- * Dequeue more audio on non-callback devices.
- *
- * (If you are looking to queue audio for output on a non-callback playback
- * device, you want SDL_QueueAudio() instead. This will always return 0
- * if you use it with playback devices.)
- *
- * SDL offers two ways to retrieve audio from a capture device: you can
- * either supply a callback that SDL triggers with some frequency as the
- * device records more audio data, (push method), or you can supply no
- * callback, and then SDL will expect you to retrieve data at regular
- * intervals (pull method) with this function.
- *
- * There are no limits on the amount of data you can queue, short of
- * exhaustion of address space. Data from the device will keep queuing as
- * necessary without further intervention from you. This means you will
- * eventually run out of memory if you aren't routinely dequeueing data.
- *
- * Capture devices will not queue data when paused; if you are expecting
- * to not need captured audio for some length of time, use
- * SDL_PauseAudioDevice() to stop the capture device from queueing more
- * data. This can be useful during, say, level loading times. When
- * unpaused, capture devices will start queueing data from that point,
- * having flushed any capturable data available while paused.
- *
- * This function is thread-safe, but dequeueing from the same device from
- * two threads at once does not promise which thread will dequeued data
- * first.
- *
- * You may not dequeue audio from a device that is using an
- * application-supplied callback; doing so returns an error. You have to use
- * the audio callback, or dequeue audio with this function, but not both.
- *
- * You should not call SDL_LockAudio() on the device before queueing; SDL
- * handles locking internally for this function.
- *
- * \param dev The device ID from which we will dequeue audio.
- * \param data A pointer into where audio data should be copied.
- * \param len The number of bytes (not samples!) to which (data) points.
- * \return number of bytes dequeued, which could be less than requested.
- *
- * \sa SDL_GetQueuedAudioSize
- * \sa SDL_ClearQueuedAudio
- */
-extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len);
-
-/**
- * Get the number of bytes of still-queued audio.
- *
- * For playback device:
- *
- * This is the number of bytes that have been queued for playback with
- * SDL_QueueAudio(), but have not yet been sent to the hardware. This
- * number may shrink at any time, so this only informs of pending data.
- *
- * Once we've sent it to the hardware, this function can not decide the
- * exact byte boundary of what has been played. It's possible that we just
- * gave the hardware several kilobytes right before you called this
- * function, but it hasn't played any of it yet, or maybe half of it, etc.
- *
- * For capture devices:
- *
- * This is the number of bytes that have been captured by the device and
- * are waiting for you to dequeue. This number may grow at any time, so
- * this only informs of the lower-bound of available data.
- *
- * You may not queue audio on a device that is using an application-supplied
- * callback; calling this function on such a device always returns 0.
- * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
- * the audio callback, but not both.
- *
- * You should not call SDL_LockAudio() on the device before querying; SDL
- * handles locking internally for this function.
- *
- * \param dev The device ID of which we will query queued audio size.
- * \return Number of bytes (not samples!) of queued audio.
- *
- * \sa SDL_QueueAudio
- * \sa SDL_ClearQueuedAudio
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
-
-/**
- * Drop any queued audio data. For playback devices, this is any queued data
- * still waiting to be submitted to the hardware. For capture devices, this
- * is any data that was queued by the device that hasn't yet been dequeued by
- * the application.
- *
- * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For
- * playback devices, the hardware will start playing silence if more audio
- * isn't queued. Unpaused capture devices will start filling the queue again
- * as soon as they have more data available (which, depending on the state
- * of the hardware and the thread, could be before this function call
- * returns!).
- *
- * This will not prevent playback of queued audio that's already been sent
- * to the hardware, as we can not undo that, so expect there to be some
- * fraction of a second of audio that might still be heard. This can be
- * useful if you want to, say, drop any pending music during a level change
- * in your game.
- *
- * You may not queue audio on a device that is using an application-supplied
- * callback; calling this function on such a device is always a no-op.
- * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
- * the audio callback, but not both.
- *
- * You should not call SDL_LockAudio() on the device before clearing the
- * queue; SDL handles locking internally for this function.
- *
- * This function always succeeds and thus returns void.
- *
- * \param dev The device ID of which to clear the audio queue.
- *
- * \sa SDL_QueueAudio
- * \sa SDL_GetQueuedAudioSize
- */
-extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
-
-
-/**
- * \name Audio lock functions
- *
- * The lock manipulated by these functions protects the callback function.
- * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
- * the callback function is not running. Do not call these from the callback
- * function or you will cause deadlock.
- */
-/* @{ */
-extern DECLSPEC void SDLCALL SDL_LockAudio(void);
-extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
-extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
-extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
-/* @} *//* Audio lock functions */
-
-/**
- * This function shuts down audio processing and closes the audio device.
- */
-extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
-extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_audio_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_bits.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_bits.h
deleted file mode 100644
index bc28572..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_bits.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_bits.h
- *
- * Functions for fiddling with bits and bitmasks.
- */
-
-#ifndef SDL_bits_h_
-#define SDL_bits_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_bits.h
- */
-
-/**
- * Get the index of the most significant bit. Result is undefined when called
- * with 0. This operation can also be stated as "count leading zeroes" and
- * "log base 2".
- *
- * \return Index of the most significant bit, or -1 if the value is 0.
- */
-#if defined(__WATCOMC__) && defined(__386__)
-extern _inline int _SDL_clz_watcom (Uint32);
-#pragma aux _SDL_clz_watcom = \
- "bsr eax, eax" \
- "xor eax, 31" \
- parm [eax] nomemory \
- value [eax] \
- modify exact [eax] nomemory;
-#endif
-
-SDL_FORCE_INLINE int
-SDL_MostSignificantBitIndex32(Uint32 x)
-{
-#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
- /* Count Leading Zeroes builtin in GCC.
- * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
- */
- if (x == 0) {
- return -1;
- }
- return 31 - __builtin_clz(x);
-#elif defined(__WATCOMC__) && defined(__386__)
- if (x == 0) {
- return -1;
- }
- return 31 - _SDL_clz_watcom(x);
-#else
- /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
- * <seander@cs.stanford.edu>, released in the public domain.
- * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
- */
- const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
- const int S[] = {1, 2, 4, 8, 16};
-
- int msbIndex = 0;
- int i;
-
- if (x == 0) {
- return -1;
- }
-
- for (i = 4; i >= 0; i--)
- {
- if (x & b[i])
- {
- x >>= S[i];
- msbIndex |= S[i];
- }
- }
-
- return msbIndex;
-#endif
-}
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_bits_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_blendmode.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_blendmode.h
deleted file mode 100644
index 9abd0bd..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_blendmode.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_blendmode.h
- *
- * Header file declaring the SDL_BlendMode enumeration
- */
-
-#ifndef SDL_blendmode_h_
-#define SDL_blendmode_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
- */
-typedef enum
-{
- SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
- dstRGBA = srcRGBA */
- SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
- dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
- dstA = srcA + (dstA * (1-srcA)) */
- SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
- dstRGB = (srcRGB * srcA) + dstRGB
- dstA = dstA */
- SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
- dstRGB = srcRGB * dstRGB
- dstA = dstA */
- SDL_BLENDMODE_INVALID = 0x7FFFFFFF
-
- /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
-
-} SDL_BlendMode;
-
-/**
- * \brief The blend operation used when combining source and destination pixel components
- */
-typedef enum
-{
- SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
- SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
- SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
- SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
- SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
-
-} SDL_BlendOperation;
-
-/**
- * \brief The normalized factor used to multiply pixel components
- */
-typedef enum
-{
- SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
- SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
- SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
- SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
- SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
- SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
- SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
- SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
- SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
- SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
-
-} SDL_BlendFactor;
-
-/**
- * \brief Create a custom blend mode, which may or may not be supported by a given renderer
- *
- * \param srcColorFactor
- * \param dstColorFactor
- * \param colorOperation
- * \param srcAlphaFactor
- * \param dstAlphaFactor
- * \param alphaOperation
- *
- * The result of the blend mode operation will be:
- * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
- * and
- * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
- */
-extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
- SDL_BlendFactor dstColorFactor,
- SDL_BlendOperation colorOperation,
- SDL_BlendFactor srcAlphaFactor,
- SDL_BlendFactor dstAlphaFactor,
- SDL_BlendOperation alphaOperation);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_blendmode_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_clipboard.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_clipboard.h
deleted file mode 100644
index 341f4ba..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_clipboard.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_clipboard.h
- *
- * Include file for SDL clipboard handling
- */
-
-#ifndef SDL_clipboard_h_
-#define SDL_clipboard_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function prototypes */
-
-/**
- * \brief Put UTF-8 text into the clipboard
- *
- * \sa SDL_GetClipboardText()
- */
-extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
-
-/**
- * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
- *
- * \sa SDL_SetClipboardText()
- */
-extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
-
-/**
- * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
- *
- * \sa SDL_GetClipboardText()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_clipboard_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h
deleted file mode 100644
index 1bbb838..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_windows_h_
-#define SDL_config_windows_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
-#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-#endif
-#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
-#define HAVE_DDRAW_H 1
-#define HAVE_DINPUT_H 1
-#define HAVE_DSOUND_H 1
-#define HAVE_DXGI_H 1
-#define HAVE_XINPUT_H 1
-
-/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
-#ifdef HAVE_LIBC
-/* Useful headers */
-#define STDC_HEADERS 1
-#define HAVE_CTYPE_H 1
-#define HAVE_FLOAT_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_STDIO_H 1
-#define HAVE_STRING_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE__COPYSIGN 1
-#if defined(_MSC_VER)
-/* These functions were added with the VC++ 2013 C runtime library */
-#if _MSC_VER >= 1800
-#define HAVE_STRTOLL 1
-#define HAVE_VSSCANF 1
-#define HAVE_SCALBN 1
-#endif
-/* This function is available with at least the VC++ 2008 C runtime library */
-#if _MSC_VER >= 1400
-#define HAVE__FSEEKI64 1
-#endif
-#endif
-#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
-#define HAVE_M_PI 1
-#endif
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#endif
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_WASAPI 1
-#define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_XAUDIO2 0
-#define SDL_AUDIO_DRIVER_WINMM 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_DINPUT 1
-#define SDL_JOYSTICK_XINPUT 1
-#define SDL_HAPTIC_DINPUT 1
-#define SDL_HAPTIC_XINPUT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_WINDOWS 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_WINDOWS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDOWS 1
-
-#ifndef SDL_VIDEO_RENDER_D3D
-#define SDL_VIDEO_RENDER_D3D 1
-#endif
-#ifndef SDL_VIDEO_RENDER_D3D11
-#define SDL_VIDEO_RENDER_D3D11 0
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_WGL
-#define SDL_VIDEO_OPENGL_WGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_OPENGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_EGL
-#define SDL_VIDEO_OPENGL_EGL 1
-#endif
-
-/* Enable Vulkan support */
-#define SDL_VIDEO_VULKAN 1
-
-/* Enable system power support */
-#define SDL_POWER_WINDOWS 1
-
-/* Enable filesystem support */
-#define SDL_FILESYSTEM_WINDOWS 1
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* SDL_config_windows_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.cmake b/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.cmake
deleted file mode 100644
index c57266c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.cmake
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_h_
-#define SDL_config_h_
-
-/**
- * \file SDL_config.h.in
- *
- * This is a set of defines to configure the SDL features
- */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-/* C language features */
-#cmakedefine const @HAVE_CONST@
-#cmakedefine inline @HAVE_INLINE@
-#cmakedefine volatile @HAVE_VOLATILE@
-
-/* C datatypes */
-/* Define SIZEOF_VOIDP for 64/32 architectures */
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
-#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
-#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
-
-#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
-#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
-#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
-#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
-#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
-#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@
-#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
-#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
-#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
-#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
-
-/* Comment this if you want to build without any C library requirements */
-#cmakedefine HAVE_LIBC 1
-#if HAVE_LIBC
-
-/* Useful headers */
-#cmakedefine HAVE_ALLOCA_H 1
-#cmakedefine HAVE_SYS_TYPES_H 1
-#cmakedefine HAVE_STDIO_H 1
-#cmakedefine STDC_HEADERS 1
-#cmakedefine HAVE_STDLIB_H 1
-#cmakedefine HAVE_STDARG_H 1
-#cmakedefine HAVE_MALLOC_H 1
-#cmakedefine HAVE_MEMORY_H 1
-#cmakedefine HAVE_STRING_H 1
-#cmakedefine HAVE_STRINGS_H 1
-#cmakedefine HAVE_WCHAR_H 1
-#cmakedefine HAVE_INTTYPES_H 1
-#cmakedefine HAVE_STDINT_H 1
-#cmakedefine HAVE_CTYPE_H 1
-#cmakedefine HAVE_MATH_H 1
-#cmakedefine HAVE_ICONV_H 1
-#cmakedefine HAVE_SIGNAL_H 1
-#cmakedefine HAVE_ALTIVEC_H 1
-#cmakedefine HAVE_PTHREAD_NP_H 1
-#cmakedefine HAVE_LIBUDEV_H 1
-#cmakedefine HAVE_DBUS_DBUS_H 1
-#cmakedefine HAVE_IBUS_IBUS_H 1
-#cmakedefine HAVE_FCITX_FRONTEND_H 1
-#cmakedefine HAVE_LIBSAMPLERATE_H 1
-
-/* C library functions */
-#cmakedefine HAVE_MALLOC 1
-#cmakedefine HAVE_CALLOC 1
-#cmakedefine HAVE_REALLOC 1
-#cmakedefine HAVE_FREE 1
-#cmakedefine HAVE_ALLOCA 1
-#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
-#cmakedefine HAVE_GETENV 1
-#cmakedefine HAVE_SETENV 1
-#cmakedefine HAVE_PUTENV 1
-#cmakedefine HAVE_UNSETENV 1
-#endif
-#cmakedefine HAVE_QSORT 1
-#cmakedefine HAVE_ABS 1
-#cmakedefine HAVE_BCOPY 1
-#cmakedefine HAVE_MEMSET 1
-#cmakedefine HAVE_MEMCPY 1
-#cmakedefine HAVE_MEMMOVE 1
-#cmakedefine HAVE_MEMCMP 1
-#cmakedefine HAVE_WCSLEN 1
-#cmakedefine HAVE_WCSLCPY 1
-#cmakedefine HAVE_WCSLCAT 1
-#cmakedefine HAVE_WCSCMP 1
-#cmakedefine HAVE_STRLEN 1
-#cmakedefine HAVE_STRLCPY 1
-#cmakedefine HAVE_STRLCAT 1
-#cmakedefine HAVE_STRDUP 1
-#cmakedefine HAVE__STRREV 1
-#cmakedefine HAVE__STRUPR 1
-#cmakedefine HAVE__STRLWR 1
-#cmakedefine HAVE_INDEX 1
-#cmakedefine HAVE_RINDEX 1
-#cmakedefine HAVE_STRCHR 1
-#cmakedefine HAVE_STRRCHR 1
-#cmakedefine HAVE_STRSTR 1
-#cmakedefine HAVE_ITOA 1
-#cmakedefine HAVE__LTOA 1
-#cmakedefine HAVE__UITOA 1
-#cmakedefine HAVE__ULTOA 1
-#cmakedefine HAVE_STRTOL 1
-#cmakedefine HAVE_STRTOUL 1
-#cmakedefine HAVE__I64TOA 1
-#cmakedefine HAVE__UI64TOA 1
-#cmakedefine HAVE_STRTOLL 1
-#cmakedefine HAVE_STRTOULL 1
-#cmakedefine HAVE_STRTOD 1
-#cmakedefine HAVE_ATOI 1
-#cmakedefine HAVE_ATOF 1
-#cmakedefine HAVE_STRCMP 1
-#cmakedefine HAVE_STRNCMP 1
-#cmakedefine HAVE__STRICMP 1
-#cmakedefine HAVE_STRCASECMP 1
-#cmakedefine HAVE__STRNICMP 1
-#cmakedefine HAVE_STRNCASECMP 1
-#cmakedefine HAVE_VSSCANF 1
-#cmakedefine HAVE_VSNPRINTF 1
-#cmakedefine HAVE_M_PI 1
-#cmakedefine HAVE_ATAN 1
-#cmakedefine HAVE_ATAN2 1
-#cmakedefine HAVE_ACOS 1
-#cmakedefine HAVE_ASIN 1
-#cmakedefine HAVE_CEIL 1
-#cmakedefine HAVE_COPYSIGN 1
-#cmakedefine HAVE_COS 1
-#cmakedefine HAVE_COSF 1
-#cmakedefine HAVE_FABS 1
-#cmakedefine HAVE_FLOOR 1
-#cmakedefine HAVE_LOG 1
-#cmakedefine HAVE_POW 1
-#cmakedefine HAVE_SCALBN 1
-#cmakedefine HAVE_SIN 1
-#cmakedefine HAVE_SINF 1
-#cmakedefine HAVE_SQRT 1
-#cmakedefine HAVE_SQRTF 1
-#cmakedefine HAVE_TAN 1
-#cmakedefine HAVE_TANF 1
-#cmakedefine HAVE_FOPEN64 1
-#cmakedefine HAVE_FSEEKO 1
-#cmakedefine HAVE_FSEEKO64 1
-#cmakedefine HAVE_SIGACTION 1
-#cmakedefine HAVE_SA_SIGACTION 1
-#cmakedefine HAVE_SETJMP 1
-#cmakedefine HAVE_NANOSLEEP 1
-#cmakedefine HAVE_SYSCONF 1
-#cmakedefine HAVE_SYSCTLBYNAME 1
-#cmakedefine HAVE_CLOCK_GETTIME 1
-#cmakedefine HAVE_GETPAGESIZE 1
-#cmakedefine HAVE_MPROTECT 1
-#cmakedefine HAVE_ICONV 1
-#cmakedefine HAVE_PTHREAD_SETNAME_NP 1
-#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
-#cmakedefine HAVE_SEM_TIMEDWAIT 1
-#cmakedefine HAVE_GETAUXVAL 1
-#cmakedefine HAVE_POLL 1
-
-#elif __WIN32__
-#cmakedefine HAVE_STDARG_H 1
-#cmakedefine HAVE_STDDEF_H 1
-#else
-/* We may need some replacement for stdarg.h here */
-#include <stdarg.h>
-#endif /* HAVE_LIBC */
-
-/* SDL internal assertion support */
-#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
-
-/* Allow disabling of core subsystems */
-#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@
-#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@
-#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@
-#cmakedefine SDL_EVENTS_DISABLED @SDL_EVENTS_DISABLED@
-#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
-#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
-#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
-#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
-#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
-#cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@
-#cmakedefine SDL_TIMERS_DISABLED @SDL_TIMERS_DISABLED@
-#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@
-#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@
-#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
-
-/* Enable various audio drivers */
-#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
-#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
-#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
-#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@
-#cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@
-#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
-#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
-#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@
-#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
-#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@
-#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
-#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@
-#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
-#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
-#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
-#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
-#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@
-
-/* Enable various input drivers */
-#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
-#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
-#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
-#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
-#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
-#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
-#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
-#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
-#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
-#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@
-#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
-#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
-#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
-#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
-#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@
-#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@
-#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@
-#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
-#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
-#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
-#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
-
-/* Enable various shared object loading systems */
-#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
-#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
-#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
-#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@
-
-/* Enable various threading systems */
-#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
-#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
-#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
-#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@
-
-/* Enable various timer systems */
-#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@
-#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@
-#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
-#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
-#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
-
-/* Enable various video drivers */
-#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
-#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
-#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
-#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
-#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
-#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
-#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
-#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
-#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
-
-#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@
-#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@
-
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@
-#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
-
-#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
-#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@
-#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@
-#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@
-#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
-#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
-#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
-#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
-
-#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@
-#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@
-#cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@
-#cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
-#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
-#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
-
-/* Enable OpenGL support */
-#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
-#cmakedefine SDL_VIDEO_OPENGL_ES @SDL_VIDEO_OPENGL_ES@
-#cmakedefine SDL_VIDEO_OPENGL_ES2 @SDL_VIDEO_OPENGL_ES2@
-#cmakedefine SDL_VIDEO_OPENGL_BGL @SDL_VIDEO_OPENGL_BGL@
-#cmakedefine SDL_VIDEO_OPENGL_CGL @SDL_VIDEO_OPENGL_CGL@
-#cmakedefine SDL_VIDEO_OPENGL_GLX @SDL_VIDEO_OPENGL_GLX@
-#cmakedefine SDL_VIDEO_OPENGL_WGL @SDL_VIDEO_OPENGL_WGL@
-#cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@
-#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
-#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
-
-/* Enable Vulkan support */
-#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
-
-/* Enable system power support */
-#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
-#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
-#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
-#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
-#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
-#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
-#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
-
-/* Enable system filesystem support */
-#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
-#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@
-#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@
-#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@
-#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@
-#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@
-#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@
-
-/* Enable assembly routines */
-#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
-#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
-
-/* Enable dynamic libsamplerate support */
-#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
-
-/* Platform specific definitions */
-#if !defined(__WIN32__)
-# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
-typedef unsigned int size_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-# endif /* if (stdint.h isn't available) */
-#else /* __WIN32__ */
-# if !defined(_STDINT_H_) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
-# if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-# elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-# ifndef _UINTPTR_T_DEFINED
-# ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-# else
-typedef unsigned int uintptr_t;
-# endif
-#define _UINTPTR_T_DEFINED
-# endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-# if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-# endif
-# if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-# endif
-# else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-# ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-# endif
-typedef unsigned int uintptr_t;
-# endif /* __GNUC__ || _MSC_VER */
-# endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-#endif /* __WIN32__ */
-
-#endif /* SDL_config_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.in b/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.in
deleted file mode 100644
index 8b3d208..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config.h.in
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_h_
-#define SDL_config_h_
-
-/**
- * \file SDL_config.h.in
- *
- * This is a set of defines to configure the SDL features
- */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-/* Make sure that this isn't included by Visual C++ */
-#ifdef _MSC_VER
-#error You should run hg revert SDL_config.h
-#endif
-
-/* C language features */
-#undef const
-#undef inline
-#undef volatile
-
-/* C datatypes */
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-#undef HAVE_GCC_ATOMICS
-#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
-
-#undef HAVE_DDRAW_H
-#undef HAVE_DINPUT_H
-#undef HAVE_DSOUND_H
-#undef HAVE_DXGI_H
-#undef HAVE_XINPUT_H
-#undef HAVE_XINPUT_GAMEPAD_EX
-#undef HAVE_XINPUT_STATE_EX
-
-/* Comment this if you want to build without any C library requirements */
-#undef HAVE_LIBC
-#if HAVE_LIBC
-
-/* Useful headers */
-#undef HAVE_ALLOCA_H
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_STDIO_H
-#undef STDC_HEADERS
-#undef HAVE_STDLIB_H
-#undef HAVE_STDARG_H
-#undef HAVE_MALLOC_H
-#undef HAVE_MEMORY_H
-#undef HAVE_STRING_H
-#undef HAVE_STRINGS_H
-#undef HAVE_WCHAR_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_STDINT_H
-#undef HAVE_CTYPE_H
-#undef HAVE_MATH_H
-#undef HAVE_ICONV_H
-#undef HAVE_SIGNAL_H
-#undef HAVE_ALTIVEC_H
-#undef HAVE_PTHREAD_NP_H
-#undef HAVE_LIBUDEV_H
-#undef HAVE_DBUS_DBUS_H
-#undef HAVE_IBUS_IBUS_H
-#undef HAVE_FCITX_FRONTEND_H
-#undef HAVE_LIBSAMPLERATE_H
-
-/* C library functions */
-#undef HAVE_MALLOC
-#undef HAVE_CALLOC
-#undef HAVE_REALLOC
-#undef HAVE_FREE
-#undef HAVE_ALLOCA
-#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
-#undef HAVE_GETENV
-#undef HAVE_SETENV
-#undef HAVE_PUTENV
-#undef HAVE_UNSETENV
-#endif
-#undef HAVE_QSORT
-#undef HAVE_ABS
-#undef HAVE_BCOPY
-#undef HAVE_MEMSET
-#undef HAVE_MEMCPY
-#undef HAVE_MEMMOVE
-#undef HAVE_MEMCMP
-#undef HAVE_WCSLEN
-#undef HAVE_WCSLCPY
-#undef HAVE_WCSLCAT
-#undef HAVE_WCSCMP
-#undef HAVE_STRLEN
-#undef HAVE_STRLCPY
-#undef HAVE_STRLCAT
-#undef HAVE_STRDUP
-#undef HAVE__STRREV
-#undef HAVE__STRUPR
-#undef HAVE__STRLWR
-#undef HAVE_INDEX
-#undef HAVE_RINDEX
-#undef HAVE_STRCHR
-#undef HAVE_STRRCHR
-#undef HAVE_STRSTR
-#undef HAVE_ITOA
-#undef HAVE__LTOA
-#undef HAVE__UITOA
-#undef HAVE__ULTOA
-#undef HAVE_STRTOL
-#undef HAVE_STRTOUL
-#undef HAVE__I64TOA
-#undef HAVE__UI64TOA
-#undef HAVE_STRTOLL
-#undef HAVE_STRTOULL
-#undef HAVE_STRTOD
-#undef HAVE_ATOI
-#undef HAVE_ATOF
-#undef HAVE_STRCMP
-#undef HAVE_STRNCMP
-#undef HAVE__STRICMP
-#undef HAVE_STRCASECMP
-#undef HAVE__STRNICMP
-#undef HAVE_STRNCASECMP
-#undef HAVE_SSCANF
-#undef HAVE_VSSCANF
-#undef HAVE_SNPRINTF
-#undef HAVE_VSNPRINTF
-#undef HAVE_M_PI
-#undef HAVE_ATAN
-#undef HAVE_ATAN2
-#undef HAVE_ACOS
-#undef HAVE_ASIN
-#undef HAVE_CEIL
-#undef HAVE_COPYSIGN
-#undef HAVE_COS
-#undef HAVE_COSF
-#undef HAVE_FABS
-#undef HAVE_FLOOR
-#undef HAVE_LOG
-#undef HAVE_POW
-#undef HAVE_SCALBN
-#undef HAVE_SIN
-#undef HAVE_SINF
-#undef HAVE_SQRT
-#undef HAVE_SQRTF
-#undef HAVE_TAN
-#undef HAVE_TANF
-#undef HAVE_FOPEN64
-#undef HAVE_FSEEKO
-#undef HAVE_FSEEKO64
-#undef HAVE_SIGACTION
-#undef HAVE_SA_SIGACTION
-#undef HAVE_SETJMP
-#undef HAVE_NANOSLEEP
-#undef HAVE_SYSCONF
-#undef HAVE_SYSCTLBYNAME
-#undef HAVE_CLOCK_GETTIME
-#undef HAVE_GETPAGESIZE
-#undef HAVE_MPROTECT
-#undef HAVE_ICONV
-#undef HAVE_PTHREAD_SETNAME_NP
-#undef HAVE_PTHREAD_SET_NAME_NP
-#undef HAVE_SEM_TIMEDWAIT
-#undef HAVE_GETAUXVAL
-#undef HAVE_POLL
-
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#define HAVE_STDINT_H 1
-#endif /* HAVE_LIBC */
-
-/* SDL internal assertion support */
-#undef SDL_DEFAULT_ASSERT_LEVEL
-
-/* Allow disabling of core subsystems */
-#undef SDL_ATOMIC_DISABLED
-#undef SDL_AUDIO_DISABLED
-#undef SDL_CPUINFO_DISABLED
-#undef SDL_EVENTS_DISABLED
-#undef SDL_FILE_DISABLED
-#undef SDL_JOYSTICK_DISABLED
-#undef SDL_HAPTIC_DISABLED
-#undef SDL_LOADSO_DISABLED
-#undef SDL_RENDER_DISABLED
-#undef SDL_THREADS_DISABLED
-#undef SDL_TIMERS_DISABLED
-#undef SDL_VIDEO_DISABLED
-#undef SDL_POWER_DISABLED
-#undef SDL_FILESYSTEM_DISABLED
-
-/* Enable various audio drivers */
-#undef SDL_AUDIO_DRIVER_ALSA
-#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
-#undef SDL_AUDIO_DRIVER_ANDROID
-#undef SDL_AUDIO_DRIVER_ARTS
-#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_COREAUDIO
-#undef SDL_AUDIO_DRIVER_DISK
-#undef SDL_AUDIO_DRIVER_DSOUND
-#undef SDL_AUDIO_DRIVER_DUMMY
-#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
-#undef SDL_AUDIO_DRIVER_ESD
-#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
-#undef SDL_AUDIO_DRIVER_HAIKU
-#undef SDL_AUDIO_DRIVER_JACK
-#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC
-#undef SDL_AUDIO_DRIVER_NACL
-#undef SDL_AUDIO_DRIVER_NAS
-#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_NETBSD
-#undef SDL_AUDIO_DRIVER_OSS
-#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
-#undef SDL_AUDIO_DRIVER_PAUDIO
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
-#undef SDL_AUDIO_DRIVER_QSA
-#undef SDL_AUDIO_DRIVER_SNDIO
-#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
-#undef SDL_AUDIO_DRIVER_SUNAUDIO
-#undef SDL_AUDIO_DRIVER_WASAPI
-#undef SDL_AUDIO_DRIVER_WINMM
-#undef SDL_AUDIO_DRIVER_XAUDIO2
-
-/* Enable various input drivers */
-#undef SDL_INPUT_LINUXEV
-#undef SDL_INPUT_LINUXKD
-#undef SDL_INPUT_TSLIB
-#undef SDL_JOYSTICK_HAIKU
-#undef SDL_JOYSTICK_DINPUT
-#undef SDL_JOYSTICK_XINPUT
-#undef SDL_JOYSTICK_DUMMY
-#undef SDL_JOYSTICK_IOKIT
-#undef SDL_JOYSTICK_LINUX
-#undef SDL_JOYSTICK_ANDROID
-#undef SDL_JOYSTICK_WINMM
-#undef SDL_JOYSTICK_USBHID
-#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
-#undef SDL_JOYSTICK_EMSCRIPTEN
-#undef SDL_HAPTIC_DUMMY
-#undef SDL_HAPTIC_LINUX
-#undef SDL_HAPTIC_IOKIT
-#undef SDL_HAPTIC_DINPUT
-#undef SDL_HAPTIC_XINPUT
-
-/* Enable various shared object loading systems */
-#undef SDL_LOADSO_DLOPEN
-#undef SDL_LOADSO_DUMMY
-#undef SDL_LOADSO_LDG
-#undef SDL_LOADSO_WINDOWS
-
-/* Enable various threading systems */
-#undef SDL_THREAD_PTHREAD
-#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
-#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
-#undef SDL_THREAD_WINDOWS
-
-/* Enable various timer systems */
-#undef SDL_TIMER_HAIKU
-#undef SDL_TIMER_DUMMY
-#undef SDL_TIMER_UNIX
-#undef SDL_TIMER_WINDOWS
-
-/* Enable various video drivers */
-#undef SDL_VIDEO_DRIVER_HAIKU
-#undef SDL_VIDEO_DRIVER_COCOA
-#undef SDL_VIDEO_DRIVER_DIRECTFB
-#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
-#undef SDL_VIDEO_DRIVER_DUMMY
-#undef SDL_VIDEO_DRIVER_WINDOWS
-#undef SDL_VIDEO_DRIVER_WAYLAND
-#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
-#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
-#undef SDL_VIDEO_DRIVER_MIR
-#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC
-#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
-#undef SDL_VIDEO_DRIVER_X11
-#undef SDL_VIDEO_DRIVER_RPI
-#undef SDL_VIDEO_DRIVER_KMSDRM
-#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
-#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
-#undef SDL_VIDEO_DRIVER_ANDROID
-#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
-#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
-#undef SDL_VIDEO_DRIVER_X11_XCURSOR
-#undef SDL_VIDEO_DRIVER_X11_XDBE
-#undef SDL_VIDEO_DRIVER_X11_XINERAMA
-#undef SDL_VIDEO_DRIVER_X11_XINPUT2
-#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
-#undef SDL_VIDEO_DRIVER_X11_XRANDR
-#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
-#undef SDL_VIDEO_DRIVER_X11_XSHAPE
-#undef SDL_VIDEO_DRIVER_X11_XVIDMODE
-#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
-#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
-#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
-#undef SDL_VIDEO_DRIVER_NACL
-#undef SDL_VIDEO_DRIVER_VIVANTE
-#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
-#undef SDL_VIDEO_DRIVER_QNX
-
-#undef SDL_VIDEO_RENDER_D3D
-#undef SDL_VIDEO_RENDER_D3D11
-#undef SDL_VIDEO_RENDER_OGL
-#undef SDL_VIDEO_RENDER_OGL_ES
-#undef SDL_VIDEO_RENDER_OGL_ES2
-#undef SDL_VIDEO_RENDER_DIRECTFB
-
-/* Enable OpenGL support */
-#undef SDL_VIDEO_OPENGL
-#undef SDL_VIDEO_OPENGL_ES
-#undef SDL_VIDEO_OPENGL_ES2
-#undef SDL_VIDEO_OPENGL_BGL
-#undef SDL_VIDEO_OPENGL_CGL
-#undef SDL_VIDEO_OPENGL_EGL
-#undef SDL_VIDEO_OPENGL_GLX
-#undef SDL_VIDEO_OPENGL_WGL
-#undef SDL_VIDEO_OPENGL_OSMESA
-#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
-
-/* Enable Vulkan support */
-#undef SDL_VIDEO_VULKAN
-
-/* Enable system power support */
-#undef SDL_POWER_LINUX
-#undef SDL_POWER_WINDOWS
-#undef SDL_POWER_MACOSX
-#undef SDL_POWER_HAIKU
-#undef SDL_POWER_ANDROID
-#undef SDL_POWER_EMSCRIPTEN
-#undef SDL_POWER_HARDWIRED
-
-/* Enable system filesystem support */
-#undef SDL_FILESYSTEM_HAIKU
-#undef SDL_FILESYSTEM_COCOA
-#undef SDL_FILESYSTEM_DUMMY
-#undef SDL_FILESYSTEM_UNIX
-#undef SDL_FILESYSTEM_WINDOWS
-#undef SDL_FILESYSTEM_NACL
-#undef SDL_FILESYSTEM_ANDROID
-#undef SDL_FILESYSTEM_EMSCRIPTEN
-
-/* Enable assembly routines */
-#undef SDL_ASSEMBLY_ROUTINES
-#undef SDL_ALTIVEC_BLITTERS
-
-/* Enable ime support */
-#undef SDL_USE_IME
-
-/* Enable dynamic udev support */
-#undef SDL_UDEV_DYNAMIC
-
-/* Enable dynamic libsamplerate support */
-#undef SDL_LIBSAMPLERATE_DYNAMIC
-
-#endif /* SDL_config_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_android.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_android.h
deleted file mode 100644
index 361bad8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_android.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_android_h_
-#define SDL_config_android_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/**
- * \file SDL_config_android.h
- *
- * This is a configuration that can be used to build SDL for Android
- */
-
-#include <stdarg.h>
-
-#define HAVE_GCC_ATOMICS 1
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_SETENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_CLOCK_GETTIME 1
-
-#define SIZEOF_VOIDP 4
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_ANDROID 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_ANDROID 1
-#define SDL_HAPTIC_ANDROID 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_ANDROID 1
-
-/* Enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES 1
-#define SDL_VIDEO_OPENGL_ES2 1
-#define SDL_VIDEO_OPENGL_EGL 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-
-/* Enable Vulkan support */
-/* Android does not support Vulkan in native code using the "armeabi" ABI. */
-#if defined(__ARM_ARCH) && __ARM_ARCH < 7
-#define SDL_VIDEO_VULKAN 0
-#else
-#define SDL_VIDEO_VULKAN 1
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_ANDROID 1
-
-/* Enable the filesystem driver */
-#define SDL_FILESYSTEM_ANDROID 1
-
-#endif /* SDL_config_android_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_iphoneos.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_iphoneos.h
deleted file mode 100644
index deea030..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_iphoneos.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_iphoneos_h_
-#define SDL_config_iphoneos_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
-#define HAVE_GCC_ATOMICS 1
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_SETENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_SYSCTLBYNAME 1
-
-/* enable iPhone version of Core Audio driver */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DUMMY 1
-
-/* Enable MFi joystick support */
-#define SDL_JOYSTICK_MFI 1
-
-/* Enable Unix style SO loading */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Supported video drivers */
-#define SDL_VIDEO_DRIVER_UIKIT 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES2 1
-#define SDL_VIDEO_OPENGL_ES 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-
-/* Enable Vulkan support */
-#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal
-#define SDL_VIDEO_VULKAN 1
-#else
-#define SDL_VIDEO_VULKAN 0
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_UIKIT 1
-
-/* enable iPhone keyboard support */
-#define SDL_IPHONE_KEYBOARD 1
-
-/* enable iOS extended launch screen */
-#define SDL_IPHONE_LAUNCHSCREEN 1
-
-/* Set max recognized G-force from accelerometer
- See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
- */
-#define SDL_IPHONE_MAX_GFORCE 5.0
-
-/* enable filesystem support */
-#define SDL_FILESYSTEM_COCOA 1
-
-#endif /* SDL_config_iphoneos_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h
deleted file mode 100644
index 9b09899..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_macosx_h_
-#define SDL_config_macosx_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
-#include <AvailabilityMacros.h>
-
-/* This is a set of defines to configure the SDL features */
-
-#ifdef __LP64__
- #define SIZEOF_VOIDP 8
-#else
- #define SIZEOF_VOIDP 4
-#endif
-
-/* Useful headers */
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_IOKIT 1
-#define SDL_HAPTIC_IOKIT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_COCOA 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#undef SDL_VIDEO_DRIVER_X11
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_XDBE 1
-#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
-#define SDL_VIDEO_DRIVER_X11_XRANDR 1
-#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
-#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
-#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
-#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
-
-#ifdef MAC_OS_X_VERSION_10_8
-/*
- * No matter the versions targeted, this is the 10.8 or later SDK, so you have
- * to use the external Xquartz, which is a more modern Xlib. Previous SDKs
- * used an older Xlib.
- */
-#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
-#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
-#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
-#endif
-
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_CGL
-#define SDL_VIDEO_OPENGL_CGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_GLX
-#define SDL_VIDEO_OPENGL_GLX 1
-#endif
-
-/* Enable Vulkan support */
-/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
-#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
-#define SDL_VIDEO_VULKAN 1
-#else
-#define SDL_VIDEO_VULKAN 0
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_MACOSX 1
-
-/* enable filesystem support */
-#define SDL_FILESYSTEM_COCOA 1
-
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-#ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS 1
-#endif
-
-#endif /* SDL_config_macosx_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h.orig b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h.orig
deleted file mode 100644
index f03f1ae..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_macosx.h.orig
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_macosx_h_
-#define SDL_config_macosx_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
-#include <AvailabilityMacros.h>
-
-/* This is a set of defines to configure the SDL features */
-
-#ifdef __LP64__
- #define SIZEOF_VOIDP 8
-#else
- #define SIZEOF_VOIDP 4
-#endif
-
-/* Useful headers */
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_SYSCONF 1
-#define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_IOKIT 1
-#define SDL_HAPTIC_IOKIT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DLOPEN 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_COCOA 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#undef SDL_VIDEO_DRIVER_X11
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_XDBE 1
-#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
-#define SDL_VIDEO_DRIVER_X11_XRANDR 1
-#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
-#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
-#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
-#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
-
-#ifdef MAC_OS_X_VERSION_10_8
-/*
- * No matter the versions targeted, this is the 10.8 or later SDK, so you have
- * to use the external Xquartz, which is a more modern Xlib. Previous SDKs
- * used an older Xlib.
- */
-#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
-#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
-#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
-#endif
-
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_CGL
-#define SDL_VIDEO_OPENGL_CGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_GLX
-#define SDL_VIDEO_OPENGL_GLX 1
-#endif
-
-/* Enable Vulkan support */
-/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures and 10.11+ */
-#if TARGET_CPU_X86_64
-#define SDL_VIDEO_VULKAN 1
-#else
-#define SDL_VIDEO_VULKAN 0
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_MACOSX 1
-
-/* enable filesystem support */
-#define SDL_FILESYSTEM_COCOA 1
-
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-#ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS 1
-#endif
-
-#endif /* SDL_config_macosx_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_minimal.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_minimal.h
deleted file mode 100644
index 3112700..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_minimal.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_minimal_h_
-#define SDL_config_minimal_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/**
- * \file SDL_config_minimal.h
- *
- * This is the minimal configuration that can be used to build SDL.
- */
-
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-
-/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
-#if defined(_MSC_VER) && (_MSC_VER < 1600)
-/* Here are some reasonable defaults */
-typedef unsigned int size_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-#else
-#define HAVE_STDINT_H 1
-#endif /* Visual Studio 2008 */
-
-#ifdef __GNUC__
-#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
-#endif
-
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED 1
-
-/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED 1
-
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
-
-/* Enable the stub thread support (src/thread/generic/\*.c) */
-#define SDL_THREADS_DISABLED 1
-
-/* Enable the stub timer support (src/timer/dummy/\*.c) */
-#define SDL_TIMERS_DISABLED 1
-
-/* Enable the dummy video driver (src/video/dummy/\*.c) */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
-#define SDL_FILESYSTEM_DUMMY 1
-
-#endif /* SDL_config_minimal_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_pandora.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_pandora.h
deleted file mode 100644
index ea62fe5..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_pandora.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_pandora_h_
-#define SDL_config_pandora_h_
-#define SDL_config_h_
-
-/* This is a set of defines to configure the SDL features */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
-#define SDL_BYTEORDER 1234
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_ICONV_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-
-#define SDL_AUDIO_DRIVER_DUMMY 1
-#define SDL_AUDIO_DRIVER_OSS 1
-
-#define SDL_INPUT_LINUXEV 1
-#define SDL_INPUT_TSLIB 1
-#define SDL_JOYSTICK_LINUX 1
-#define SDL_HAPTIC_LINUX 1
-
-#define SDL_LOADSO_DLOPEN 1
-
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
-
-#define SDL_TIMER_UNIX 1
-#define SDL_FILESYSTEM_UNIX 1
-
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_X11 1
-#define SDL_VIDEO_DRIVER_PANDORA 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_OPENGL_ES 1
-
-#endif /* SDL_config_pandora_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_psp.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_psp.h
deleted file mode 100644
index 28efb4c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_psp.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_psp_h_
-#define SDL_config_psp_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-
-
-#ifdef __GNUC__
-#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
-#endif
-
-#define HAVE_GCC_ATOMICS 1
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_SETENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-/* #define HAVE_SYSCONF 1 */
-/* #define HAVE_SIGACTION 1 */
-
-
-/* PSP isn't that sophisticated */
-#define LACKS_SYS_MMAN_H 1
-
-/* Enable the stub thread support (src/thread/psp/\*.c) */
-#define SDL_THREAD_PSP 1
-
-/* Enable the stub timer support (src/timer/psp/\*.c) */
-#define SDL_TIMERS_PSP 1
-
-/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
-#define SDL_JOYSTICK_PSP 1
-
-/* Enable the stub audio driver (src/audio/psp/\*.c) */
-#define SDL_AUDIO_DRIVER_PSP 1
-
-/* PSP video dirver */
-#define SDL_VIDEO_DRIVER_PSP 1
-
-/* PSP render dirver */
-#define SDL_VIDEO_RENDER_PSP 1
-
-#define SDL_POWER_PSP 1
-
-/* !!! FIXME: what does PSP do for filesystem stuff? */
-#define SDL_FILESYSTEM_DUMMY 1
-
-/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED 1
-
-/* PSP can't load shared object (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
-
-
-#endif /* SDL_config_psp_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_windows.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_windows.h
deleted file mode 100644
index 2456c84..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_windows.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_windows_h_
-#define SDL_config_windows_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
-#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-#endif
-#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
-#define HAVE_DDRAW_H 1
-#define HAVE_DINPUT_H 1
-#define HAVE_DSOUND_H 1
-#define HAVE_DXGI_H 1
-#define HAVE_XINPUT_H 1
-
-/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
-#ifdef HAVE_LIBC
-/* Useful headers */
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#if _MSC_VER >= 1800
-#define HAVE_STRTOLL 1
-#define HAVE_VSSCANF 1
-#define HAVE_COPYSIGN 1
-#define HAVE_SCALBN 1
-#endif
-#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
-#define HAVE_M_PI 1
-#endif
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#endif
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_WASAPI 1
-#define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_XAUDIO2 0
-#define SDL_AUDIO_DRIVER_WINMM 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_DINPUT 1
-#define SDL_JOYSTICK_XINPUT 1
-#define SDL_HAPTIC_DINPUT 1
-#define SDL_HAPTIC_XINPUT 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_WINDOWS 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_WINDOWS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDOWS 1
-
-#ifndef SDL_VIDEO_RENDER_D3D
-#define SDL_VIDEO_RENDER_D3D 1
-#endif
-#ifndef SDL_VIDEO_RENDER_D3D11
-#define SDL_VIDEO_RENDER_D3D11 0
-#endif
-
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_WGL
-#define SDL_VIDEO_OPENGL_WGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL 1
-#endif
-#ifndef SDL_VIDEO_RENDER_OGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_OPENGL_ES2 1
-#endif
-#ifndef SDL_VIDEO_OPENGL_EGL
-#define SDL_VIDEO_OPENGL_EGL 1
-#endif
-
-/* Enable Vulkan support */
-#define SDL_VIDEO_VULKAN 1
-
-/* Enable system power support */
-#define SDL_POWER_WINDOWS 1
-
-/* Enable filesystem support */
-#define SDL_FILESYSTEM_WINDOWS 1
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* SDL_config_windows_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_winrt.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_winrt.h
deleted file mode 100644
index 24f9e17..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_winrt.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_winrt_h_
-#define SDL_config_winrt_h_
-#define SDL_config_h_
-
-#include "SDL_platform.h"
-
-/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used
- by SDL to determine which version of the Windows SDK is being used.
-*/
-#include <sdkddkver.h>
-
-/* Define possibly-undefined NTDDI values (used when compiling SDL against
- older versions of the Windows SDK.
-*/
-#ifndef NTDDI_WINBLUE
-#define NTDDI_WINBLUE 0x06030000
-#endif
-#ifndef NTDDI_WIN10
-#define NTDDI_WIN10 0x0A000000
-#endif
-
-/* This is a set of defines to configure the SDL features */
-
-#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
-#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
-#define DWORD_PTR DWORD
-#endif
-#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
-#define LONG_PTR LONG
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
-/* Useful headers */
-#define HAVE_DXGI_H 1
-#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
-#define HAVE_XINPUT_H 1
-#endif
-#define HAVE_LIBC 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_FLOAT_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
-//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
-//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-//#define HAVE_STRTOLL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_VSNPRINTF 1
-//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
-#define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_CEIL 1
-#define HAVE__COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-//#define HAVE_SCALBN 1
-#define HAVE__SCALB 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE__FSEEKI64 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_XAUDIO2 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various input drivers */
-#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
-#define SDL_JOYSTICK_DISABLED 1
-#define SDL_HAPTIC_DISABLED 1
-#else
-#define SDL_JOYSTICK_XINPUT 1
-#define SDL_HAPTIC_XINPUT 1
-#endif
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS 1
-
-/* Enable various threading systems */
-#if (NTDDI_VERSION >= NTDDI_WINBLUE)
-#define SDL_THREAD_WINDOWS 1
-#else
-/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
-#define SDL_THREAD_STDCPP 1
-#endif
-
-/* Enable various timer systems */
-#define SDL_TIMER_WINDOWS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_WINRT 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
-#define SDL_VIDEO_OPENGL_ES2 1
-#define SDL_VIDEO_OPENGL_EGL 1
-
-/* Enable appropriate renderer(s) */
-#define SDL_VIDEO_RENDER_D3D11 1
-
-#if SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2 1
-#endif
-
-/* Enable system power support */
-#define SDL_POWER_WINRT 1
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* SDL_config_winrt_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_wiz.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_config_wiz.h
deleted file mode 100644
index 5bb845a..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_config_wiz.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_config_wiz_h_
-#define SDL_config_wiz_h_
-#define SDL_config_h_
-
-/* This is a set of defines to configure the SDL features */
-
-/* General platform specific identifiers */
-#include "SDL_platform.h"
-
-#define SDL_BYTEORDER 1234
-
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_ICONV_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_SETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_VSSCANF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_POW 1
-
-#define SDL_AUDIO_DRIVER_DUMMY 1
-#define SDL_AUDIO_DRIVER_OSS 1
-
-#define SDL_INPUT_LINUXEV 1
-#define SDL_INPUT_TSLIB 1
-#define SDL_JOYSTICK_LINUX 1
-#define SDL_HAPTIC_LINUX 1
-
-#define SDL_LOADSO_DLOPEN 1
-
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
-
-#define SDL_TIMER_UNIX 1
-
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_PANDORA 1
-#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_VIDEO_OPENGL_ES 1
-
-#endif /* SDL_config_wiz_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_copying.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_copying.h
deleted file mode 100644
index 8f60af6..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_copying.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_cpuinfo.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_cpuinfo.h
deleted file mode 100644
index 94b64b0..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_cpuinfo.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_cpuinfo.h
- *
- * CPU feature detection for SDL.
- */
-
-#ifndef SDL_cpuinfo_h_
-#define SDL_cpuinfo_h_
-
-#include "SDL_stdinc.h"
-
-/* Need to do this here because intrin.h has C++ code in it */
-/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
-#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
-#ifdef __clang__
-/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
-#undef __MMX__
-#undef __SSE__
-#undef __SSE2__
-#else
-#include <intrin.h>
-#ifndef _WIN64
-#define __MMX__
-#define __3dNOW__
-#endif
-#define __SSE__
-#define __SSE2__
-#endif /* __clang__ */
-#elif defined(__MINGW64_VERSION_MAJOR)
-#include <intrin.h>
-#else
-#ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
-#include <altivec.h>
-#undef pixel
-#endif
-#endif
-#ifdef __MMX__
-#include <mmintrin.h>
-#endif
-#ifdef __3dNOW__
-#include <mm3dnow.h>
-#endif
-#ifdef __SSE__
-#include <xmmintrin.h>
-#endif
-#ifdef __SSE2__
-#include <emmintrin.h>
-#endif
-#ifdef __SSE3__
-#include <pmmintrin.h>
-#endif
-#endif
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This is a guess for the cacheline size used for padding.
- * Most x86 processors have a 64 byte cache line.
- * The 64-bit PowerPC processors have a 128 byte cache line.
- * We'll use the larger value to be generally safe.
- */
-#define SDL_CACHELINE_SIZE 128
-
-/**
- * This function returns the number of CPU cores available.
- */
-extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
-
-/**
- * This function returns the L1 cache line size of the CPU
- *
- * This is useful for determining multi-threaded structure padding
- * or SIMD prefetch sizes.
- */
-extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
-
-/**
- * This function returns true if the CPU has the RDTSC instruction.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
-
-/**
- * This function returns true if the CPU has AltiVec features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
-
-/**
- * This function returns true if the CPU has MMX features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
-
-/**
- * This function returns true if the CPU has 3DNow! features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
-
-/**
- * This function returns true if the CPU has SSE features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
-
-/**
- * This function returns true if the CPU has SSE2 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
-
-/**
- * This function returns true if the CPU has SSE3 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
-
-/**
- * This function returns true if the CPU has SSE4.1 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
-
-/**
- * This function returns true if the CPU has SSE4.2 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
-
-/**
- * This function returns true if the CPU has AVX features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
-
-/**
- * This function returns true if the CPU has AVX2 features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
-
-/**
- * This function returns true if the CPU has NEON (ARM SIMD) features.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
-
-/**
- * This function returns the amount of RAM configured in the system, in MB.
- */
-extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_cpuinfo_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_egl.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_egl.h
deleted file mode 100644
index e47fbe8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_egl.h
+++ /dev/null
@@ -1,1673 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_egl.h
- *
- * This is a simple file to encapsulate the EGL API headers.
- */
-#ifndef _MSC_VER
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#else /* _MSC_VER */
-
-/* EGL headers for Visual Studio */
-
-#ifndef __khrplatform_h_
-#define __khrplatform_h_
-
-/*
-** Copyright (c) 2008-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Khronos platform-specific types and definitions.
-*
-* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
-*
-* Adopters may modify this file to suit their platform. Adopters are
-* encouraged to submit platform specific modifications to the Khronos
-* group so that they can be included in future versions of this file.
-* Please submit changes by sending them to the public Khronos Bugzilla
-* (http://khronos.org/bugzilla) by filing a bug against product
-* "Khronos (general)" component "Registry".
-*
-* A predefined template which fills in some of the bug fields can be
-* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
-* must create a Bugzilla login first.
-*
-*
-* See the Implementer's Guidelines for information about where this file
-* should be located on your system and for more details of its use:
-* http://www.khronos.org/registry/implementers_guide.pdf
-*
-* This file should be included as
-* #include <KHR/khrplatform.h>
-* by Khronos client API header files that use its types and defines.
-*
-* The types in khrplatform.h should only be used to define API-specific types.
-*
-* Types defined in khrplatform.h:
-* khronos_int8_t signed 8 bit
-* khronos_uint8_t unsigned 8 bit
-* khronos_int16_t signed 16 bit
-* khronos_uint16_t unsigned 16 bit
-* khronos_int32_t signed 32 bit
-* khronos_uint32_t unsigned 32 bit
-* khronos_int64_t signed 64 bit
-* khronos_uint64_t unsigned 64 bit
-* khronos_intptr_t signed same number of bits as a pointer
-* khronos_uintptr_t unsigned same number of bits as a pointer
-* khronos_ssize_t signed size
-* khronos_usize_t unsigned size
-* khronos_float_t signed 32 bit floating point
-* khronos_time_ns_t unsigned 64 bit time in nanoseconds
-* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
-* nanoseconds
-* khronos_stime_nanoseconds_t signed time interval in nanoseconds
-* khronos_boolean_enum_t enumerated boolean type. This should
-* only be used as a base type when a client API's boolean type is
-* an enum. Client APIs which use an integer or other type for
-* booleans cannot use this as the base type for their boolean.
-*
-* Tokens defined in khrplatform.h:
-*
-* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
-*
-* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
-* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
-*
-* Calling convention macros defined in this file:
-* KHRONOS_APICALL
-* KHRONOS_APIENTRY
-* KHRONOS_APIATTRIBUTES
-*
-* These may be used in function prototypes as:
-*
-* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
-* int arg1,
-* int arg2) KHRONOS_APIATTRIBUTES;
-*/
-
-/*-------------------------------------------------------------------------
-* Definition of KHRONOS_APICALL
-*-------------------------------------------------------------------------
-* This precedes the return type of the function in the function prototype.
-*/
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
-# define KHRONOS_APICALL __declspec(dllimport)
-#elif defined (__SYMBIAN32__)
-# define KHRONOS_APICALL IMPORT_C
-#else
-# define KHRONOS_APICALL
-#endif
-
-/*-------------------------------------------------------------------------
-* Definition of KHRONOS_APIENTRY
-*-------------------------------------------------------------------------
-* This follows the return type of the function and precedes the function
-* name in the function prototype.
-*/
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
-/* Win32 but not WinCE */
-# define KHRONOS_APIENTRY __stdcall
-#else
-# define KHRONOS_APIENTRY
-#endif
-
-/*-------------------------------------------------------------------------
-* Definition of KHRONOS_APIATTRIBUTES
-*-------------------------------------------------------------------------
-* This follows the closing parenthesis of the function prototype arguments.
-*/
-#if defined (__ARMCC_2__)
-#define KHRONOS_APIATTRIBUTES __softfp
-#else
-#define KHRONOS_APIATTRIBUTES
-#endif
-
-/*-------------------------------------------------------------------------
-* basic type definitions
-*-----------------------------------------------------------------------*/
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
-
-
-/*
-* Using <stdint.h>
-*/
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__VMS ) || defined(__sgi)
-
-/*
-* Using <inttypes.h>
-*/
-#include <inttypes.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
-
-/*
-* Win32
-*/
-typedef __int32 khronos_int32_t;
-typedef unsigned __int32 khronos_uint32_t;
-typedef __int64 khronos_int64_t;
-typedef unsigned __int64 khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__sun__) || defined(__digital__)
-
-/*
-* Sun or Digital
-*/
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#if defined(__arch64__) || defined(_LP64)
-typedef long int khronos_int64_t;
-typedef unsigned long int khronos_uint64_t;
-#else
-typedef long long int khronos_int64_t;
-typedef unsigned long long int khronos_uint64_t;
-#endif /* __arch64__ */
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif 0
-
-/*
-* Hypothetical platform with no float or int64 support
-*/
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#define KHRONOS_SUPPORT_INT64 0
-#define KHRONOS_SUPPORT_FLOAT 0
-
-#else
-
-/*
-* Generic fallback
-*/
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#endif
-
-
-/*
-* Types that are (so far) the same on all platforms
-*/
-typedef signed char khronos_int8_t;
-typedef unsigned char khronos_uint8_t;
-typedef signed short int khronos_int16_t;
-typedef unsigned short int khronos_uint16_t;
-
-/*
-* Types that differ between LLP64 and LP64 architectures - in LLP64,
-* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
-* to be the only LLP64 architecture in current use.
-*/
-#ifdef _WIN64
-typedef signed long long int khronos_intptr_t;
-typedef unsigned long long int khronos_uintptr_t;
-typedef signed long long int khronos_ssize_t;
-typedef unsigned long long int khronos_usize_t;
-#else
-typedef signed long int khronos_intptr_t;
-typedef unsigned long int khronos_uintptr_t;
-typedef signed long int khronos_ssize_t;
-typedef unsigned long int khronos_usize_t;
-#endif
-
-#if KHRONOS_SUPPORT_FLOAT
-/*
-* Float type
-*/
-typedef float khronos_float_t;
-#endif
-
-#if KHRONOS_SUPPORT_INT64
-/* Time types
-*
-* These types can be used to represent a time interval in nanoseconds or
-* an absolute Unadjusted System Time. Unadjusted System Time is the number
-* of nanoseconds since some arbitrary system event (e.g. since the last
-* time the system booted). The Unadjusted System Time is an unsigned
-* 64 bit value that wraps back to 0 every 584 years. Time intervals
-* may be either signed or unsigned.
-*/
-typedef khronos_uint64_t khronos_utime_nanoseconds_t;
-typedef khronos_int64_t khronos_stime_nanoseconds_t;
-#endif
-
-/*
-* Dummy value used to pad enum types to 32 bits.
-*/
-#ifndef KHRONOS_MAX_ENUM
-#define KHRONOS_MAX_ENUM 0x7FFFFFFF
-#endif
-
-/*
-* Enumerated boolean type
-*
-* Values other than zero should be considered to be true. Therefore
-* comparisons should not be made against KHRONOS_TRUE.
-*/
-typedef enum {
- KHRONOS_FALSE = 0,
- KHRONOS_TRUE = 1,
- KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
-} khronos_boolean_enum_t;
-
-#endif /* __khrplatform_h_ */
-
-
-#ifndef __eglplatform_h_
-#define __eglplatform_h_
-
-/*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Platform-specific types and definitions for egl.h
-* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
-*
-* Adopters may modify khrplatform.h and this file to suit their platform.
-* You are encouraged to submit all modifications to the Khronos group so that
-* they can be included in future versions of this file. Please submit changes
-* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
-* by filing a bug against product "EGL" component "Registry".
-*/
-
-/*#include <KHR/khrplatform.h>*/
-
-/* Macros used in EGL function prototype declarations.
-*
-* EGL functions should be prototyped as:
-*
-* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
-* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
-*
-* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
-*/
-
-#ifndef EGLAPI
-#define EGLAPI KHRONOS_APICALL
-#endif
-
-#ifndef EGLAPIENTRY
-#define EGLAPIENTRY KHRONOS_APIENTRY
-#endif
-#define EGLAPIENTRYP EGLAPIENTRY*
-
-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
-* are aliases of window-system-dependent types, such as X Display * or
-* Windows Device Context. They must be defined in platform-specific
-* code below. The EGL-prefixed versions of Native*Type are the same
-* types, renamed in EGL 1.3 so all types in the API start with "EGL".
-*
-* Khronos STRONGLY RECOMMENDS that you use the default definitions
-* provided below, since these changes affect both binary and source
-* portability of applications using EGL running on different EGL
-* implementations.
-*/
-
-#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-
-#if __WINRT__
-#include <Unknwn.h>
-typedef IUnknown * EGLNativeWindowType;
-typedef IUnknown * EGLNativePixmapType;
-typedef IUnknown * EGLNativeDisplayType;
-#else
-typedef HDC EGLNativeDisplayType;
-typedef HBITMAP EGLNativePixmapType;
-typedef HWND EGLNativeWindowType;
-#endif
-
-#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
-
-typedef int EGLNativeDisplayType;
-typedef void *EGLNativeWindowType;
-typedef void *EGLNativePixmapType;
-
-#elif defined(WL_EGL_PLATFORM)
-
-typedef struct wl_display *EGLNativeDisplayType;
-typedef struct wl_egl_pixmap *EGLNativePixmapType;
-typedef struct wl_egl_window *EGLNativeWindowType;
-
-#elif defined(__GBM__)
-
-typedef struct gbm_device *EGLNativeDisplayType;
-typedef struct gbm_bo *EGLNativePixmapType;
-typedef void *EGLNativeWindowType;
-
-#elif defined(__ANDROID__) /* Android */
-
-struct ANativeWindow;
-struct egl_native_pixmap_t;
-
-typedef struct ANativeWindow *EGLNativeWindowType;
-typedef struct egl_native_pixmap_t *EGLNativePixmapType;
-typedef void *EGLNativeDisplayType;
-
-#elif defined(MIR_EGL_PLATFORM)
-
-#include <mir_toolkit/mir_client_library.h>
-typedef MirEGLNativeDisplayType EGLNativeDisplayType;
-typedef void *EGLNativePixmapType;
-typedef MirEGLNativeWindowType EGLNativeWindowType;
-
-#elif defined(__unix__)
-
-#ifdef MESA_EGL_NO_X11_HEADERS
-
-typedef void *EGLNativeDisplayType;
-typedef khronos_uintptr_t EGLNativePixmapType;
-typedef khronos_uintptr_t EGLNativeWindowType;
-
-#else
-
-/* X11 (tentative) */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap EGLNativePixmapType;
-typedef Window EGLNativeWindowType;
-
-#endif /* MESA_EGL_NO_X11_HEADERS */
-
-#else
-#error "Platform not recognized"
-#endif
-
-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
-typedef EGLNativeDisplayType NativeDisplayType;
-typedef EGLNativePixmapType NativePixmapType;
-typedef EGLNativeWindowType NativeWindowType;
-
-
-/* Define EGLint. This must be a signed integral type large enough to contain
-* all legal attribute names and values passed into and out of EGL, whether
-* their type is boolean, bitmask, enumerant (symbolic constant), integer,
-* handle, or other. While in general a 32-bit integer will suffice, if
-* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
-* integer type.
-*/
-typedef khronos_int32_t EGLint;
-
-#endif /* __eglplatform_h */
-
-#ifndef __egl_h_
-#define __egl_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2015 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
-*/
-
-/*#include <EGL/eglplatform.h>*/
-
-/* Generated on date 20150623 */
-
-/* Generated C header for:
- * API: egl
- * Versions considered: .*
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef EGL_VERSION_1_0
-#define EGL_VERSION_1_0 1
-typedef unsigned int EGLBoolean;
-typedef void *EGLDisplay;
-typedef void *EGLConfig;
-typedef void *EGLSurface;
-typedef void *EGLContext;
-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_DONT_CARE ((EGLint)-1)
-#define EGL_DRAW 0x3059
-#define EGL_EXTENSIONS 0x3055
-#define EGL_FALSE 0
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_HEIGHT 0x3056
-#define EGL_LARGEST_PBUFFER 0x3058
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-#define EGL_NONE 0x3038
-#define EGL_NON_CONFORMANT_CONFIG 0x3051
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
-#define EGL_PBUFFER_BIT 0x0001
-#define EGL_PIXMAP_BIT 0x0002
-#define EGL_READ 0x305A
-#define EGL_RED_SIZE 0x3024
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SLOW_CONFIG 0x3050
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_SUCCESS 0x3000
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-#define EGL_TRANSPARENT_RGB 0x3052
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRUE 1
-#define EGL_VENDOR 0x3053
-#define EGL_VERSION 0x3054
-#define EGL_WIDTH 0x3057
-#define EGL_WINDOW_BIT 0x0004
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
-EGLAPI EGLint EGLAPIENTRY eglGetError (void);
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
-#endif /* EGL_VERSION_1_0 */
-
-#ifndef EGL_VERSION_1_1
-#define EGL_VERSION_1_1 1
-#define EGL_BACK_BUFFER 0x3084
-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
-#define EGL_CONTEXT_LOST 0x300E
-#define EGL_MIN_SWAP_INTERVAL 0x303B
-#define EGL_MAX_SWAP_INTERVAL 0x303C
-#define EGL_MIPMAP_TEXTURE 0x3082
-#define EGL_MIPMAP_LEVEL 0x3083
-#define EGL_NO_TEXTURE 0x305C
-#define EGL_TEXTURE_2D 0x305F
-#define EGL_TEXTURE_FORMAT 0x3080
-#define EGL_TEXTURE_RGB 0x305D
-#define EGL_TEXTURE_RGBA 0x305E
-#define EGL_TEXTURE_TARGET 0x3081
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
-#endif /* EGL_VERSION_1_1 */
-
-#ifndef EGL_VERSION_1_2
-#define EGL_VERSION_1_2 1
-typedef unsigned int EGLenum;
-typedef void *EGLClientBuffer;
-#define EGL_ALPHA_FORMAT 0x3088
-#define EGL_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_ALPHA_FORMAT_PRE 0x308C
-#define EGL_ALPHA_MASK_SIZE 0x303E
-#define EGL_BUFFER_PRESERVED 0x3094
-#define EGL_BUFFER_DESTROYED 0x3095
-#define EGL_CLIENT_APIS 0x308D
-#define EGL_COLORSPACE 0x3087
-#define EGL_COLORSPACE_sRGB 0x3089
-#define EGL_COLORSPACE_LINEAR 0x308A
-#define EGL_COLOR_BUFFER_TYPE 0x303F
-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
-#define EGL_DISPLAY_SCALING 10000
-#define EGL_HORIZONTAL_RESOLUTION 0x3090
-#define EGL_LUMINANCE_BUFFER 0x308F
-#define EGL_LUMINANCE_SIZE 0x303D
-#define EGL_OPENGL_ES_BIT 0x0001
-#define EGL_OPENVG_BIT 0x0002
-#define EGL_OPENGL_ES_API 0x30A0
-#define EGL_OPENVG_API 0x30A1
-#define EGL_OPENVG_IMAGE 0x3096
-#define EGL_PIXEL_ASPECT_RATIO 0x3092
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_RGB_BUFFER 0x308E
-#define EGL_SINGLE_BUFFER 0x3085
-#define EGL_SWAP_BEHAVIOR 0x3093
-#define EGL_UNKNOWN ((EGLint)-1)
-#define EGL_VERTICAL_RESOLUTION 0x3091
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
-#endif /* EGL_VERSION_1_2 */
-
-#ifndef EGL_VERSION_1_3
-#define EGL_VERSION_1_3 1
-#define EGL_CONFORMANT 0x3042
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
-#define EGL_MATCH_NATIVE_PIXMAP 0x3041
-#define EGL_OPENGL_ES2_BIT 0x0004
-#define EGL_VG_ALPHA_FORMAT 0x3088
-#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
-#define EGL_VG_COLORSPACE 0x3087
-#define EGL_VG_COLORSPACE_sRGB 0x3089
-#define EGL_VG_COLORSPACE_LINEAR 0x308A
-#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
-#endif /* EGL_VERSION_1_3 */
-
-#ifndef EGL_VERSION_1_4
-#define EGL_VERSION_1_4 1
-#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
-#define EGL_MULTISAMPLE_RESOLVE 0x3099
-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
-#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
-#define EGL_OPENGL_API 0x30A2
-#define EGL_OPENGL_BIT 0x0008
-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
-#endif /* EGL_VERSION_1_4 */
-
-#ifndef EGL_VERSION_1_5
-#define EGL_VERSION_1_5 1
-typedef void *EGLSync;
-typedef intptr_t EGLAttrib;
-typedef khronos_utime_nanoseconds_t EGLTime;
-typedef void *EGLImage;
-#define EGL_CONTEXT_MAJOR_VERSION 0x3098
-#define EGL_CONTEXT_MINOR_VERSION 0x30FB
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
-#define EGL_NO_RESET_NOTIFICATION 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
-#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
-#define EGL_OPENGL_ES3_BIT 0x00000040
-#define EGL_CL_EVENT_HANDLE 0x309C
-#define EGL_SYNC_CL_EVENT 0x30FE
-#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
-#define EGL_SYNC_TYPE 0x30F7
-#define EGL_SYNC_STATUS 0x30F1
-#define EGL_SYNC_CONDITION 0x30F8
-#define EGL_SIGNALED 0x30F2
-#define EGL_UNSIGNALED 0x30F3
-#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
-#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
-#define EGL_TIMEOUT_EXPIRED 0x30F5
-#define EGL_CONDITION_SATISFIED 0x30F6
-#define EGL_NO_SYNC ((EGLSync)0)
-#define EGL_SYNC_FENCE 0x30F9
-#define EGL_GL_COLORSPACE 0x309D
-#define EGL_GL_COLORSPACE_SRGB 0x3089
-#define EGL_GL_COLORSPACE_LINEAR 0x308A
-#define EGL_GL_RENDERBUFFER 0x30B9
-#define EGL_GL_TEXTURE_2D 0x30B1
-#define EGL_GL_TEXTURE_LEVEL 0x30BC
-#define EGL_GL_TEXTURE_3D 0x30B2
-#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
-#define EGL_IMAGE_PRESERVED 0x30D2
-#define EGL_NO_IMAGE ((EGLImage)0)
-EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
-EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
-#endif /* EGL_VERSION_1_5 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __egl_h_ */
-
-
-
-#ifndef __eglext_h_
-#define __eglext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2015 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
-*/
-
-/*#include <EGL/eglplatform.h>*/
-
-#define EGL_EGLEXT_VERSION 20150623
-
-/* Generated C header for:
- * API: egl
- * Versions considered: .*
- * Versions emitted: _nomatch_^
- * Default extensions included: egl
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef EGL_KHR_cl_event
-#define EGL_KHR_cl_event 1
-#define EGL_CL_EVENT_HANDLE_KHR 0x309C
-#define EGL_SYNC_CL_EVENT_KHR 0x30FE
-#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
-#endif /* EGL_KHR_cl_event */
-
-#ifndef EGL_KHR_cl_event2
-#define EGL_KHR_cl_event2 1
-typedef void *EGLSyncKHR;
-typedef intptr_t EGLAttribKHR;
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
-#endif
-#endif /* EGL_KHR_cl_event2 */
-
-#ifndef EGL_KHR_client_get_all_proc_addresses
-#define EGL_KHR_client_get_all_proc_addresses 1
-#endif /* EGL_KHR_client_get_all_proc_addresses */
-
-#ifndef EGL_KHR_config_attribs
-#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR 0x3042
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
-#endif /* EGL_KHR_config_attribs */
-
-#ifndef EGL_KHR_create_context
-#define EGL_KHR_create_context 1
-#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
-#define EGL_CONTEXT_FLAGS_KHR 0x30FC
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
-#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
-#endif /* EGL_KHR_create_context */
-
-#ifndef EGL_KHR_create_context_no_error
-#define EGL_KHR_create_context_no_error 1
-#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
-#endif /* EGL_KHR_create_context_no_error */
-
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
-#define EGL_SYNC_CONDITION_KHR 0x30F8
-#define EGL_SYNC_FENCE_KHR 0x30F9
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_fence_sync */
-
-#ifndef EGL_KHR_get_all_proc_addresses
-#define EGL_KHR_get_all_proc_addresses 1
-#endif /* EGL_KHR_get_all_proc_addresses */
-
-#ifndef EGL_KHR_gl_colorspace
-#define EGL_KHR_gl_colorspace 1
-#define EGL_GL_COLORSPACE_KHR 0x309D
-#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
-#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
-#endif /* EGL_KHR_gl_colorspace */
-
-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR 0x30B9
-#endif /* EGL_KHR_gl_renderbuffer_image */
-
-#ifndef EGL_KHR_gl_texture_2D_image
-#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR 0x30B1
-#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
-#endif /* EGL_KHR_gl_texture_2D_image */
-
-#ifndef EGL_KHR_gl_texture_3D_image
-#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR 0x30B2
-#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
-#endif /* EGL_KHR_gl_texture_3D_image */
-
-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
-#endif /* EGL_KHR_gl_texture_cubemap_image */
-
-#ifndef EGL_KHR_image
-#define EGL_KHR_image 1
-typedef void *EGLImageKHR;
-#define EGL_NATIVE_PIXMAP_KHR 0x30B0
-#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
-#endif
-#endif /* EGL_KHR_image */
-
-#ifndef EGL_KHR_image_base
-#define EGL_KHR_image_base 1
-#define EGL_IMAGE_PRESERVED_KHR 0x30D2
-#endif /* EGL_KHR_image_base */
-
-#ifndef EGL_KHR_image_pixmap
-#define EGL_KHR_image_pixmap 1
-#endif /* EGL_KHR_image_pixmap */
-
-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR 0x0001
-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
-#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
-#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
-#define EGL_MATCH_FORMAT_KHR 0x3043
-#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
-#define EGL_FORMAT_RGB_565_KHR 0x30C1
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
-#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
-#define EGL_BITMAP_POINTER_KHR 0x30C6
-#define EGL_BITMAP_PITCH_KHR 0x30C7
-#define EGL_BITMAP_ORIGIN_KHR 0x30C8
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
-#define EGL_LOWER_LEFT_KHR 0x30CE
-#define EGL_UPPER_LEFT_KHR 0x30CF
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
-#endif
-#endif /* EGL_KHR_lock_surface */
-
-#ifndef EGL_KHR_lock_surface2
-#define EGL_KHR_lock_surface2 1
-#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
-#endif /* EGL_KHR_lock_surface2 */
-
-#ifndef EGL_KHR_lock_surface3
-#define EGL_KHR_lock_surface3 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
-#endif
-#endif /* EGL_KHR_lock_surface3 */
-
-#ifndef EGL_KHR_partial_update
-#define EGL_KHR_partial_update 1
-#define EGL_BUFFER_AGE_KHR 0x313D
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_KHR_partial_update */
-
-#ifndef EGL_KHR_platform_android
-#define EGL_KHR_platform_android 1
-#define EGL_PLATFORM_ANDROID_KHR 0x3141
-#endif /* EGL_KHR_platform_android */
-
-#ifndef EGL_KHR_platform_gbm
-#define EGL_KHR_platform_gbm 1
-#define EGL_PLATFORM_GBM_KHR 0x31D7
-#endif /* EGL_KHR_platform_gbm */
-
-#ifndef EGL_KHR_platform_wayland
-#define EGL_KHR_platform_wayland 1
-#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
-#endif /* EGL_KHR_platform_wayland */
-
-#ifndef EGL_KHR_platform_x11
-#define EGL_KHR_platform_x11 1
-#define EGL_PLATFORM_X11_KHR 0x31D5
-#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
-#endif /* EGL_KHR_platform_x11 */
-
-#ifndef EGL_KHR_reusable_sync
-#define EGL_KHR_reusable_sync 1
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_STATUS_KHR 0x30F1
-#define EGL_SIGNALED_KHR 0x30F2
-#define EGL_UNSIGNALED_KHR 0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
-#define EGL_SYNC_TYPE_KHR 0x30F7
-#define EGL_SYNC_REUSABLE_KHR 0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_reusable_sync */
-
-#ifndef EGL_KHR_stream
-#define EGL_KHR_stream 1
-typedef void *EGLStreamKHR;
-typedef khronos_uint64_t EGLuint64KHR;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
-#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
-#define EGL_PRODUCER_FRAME_KHR 0x3212
-#define EGL_CONSUMER_FRAME_KHR 0x3213
-#define EGL_STREAM_STATE_KHR 0x3214
-#define EGL_STREAM_STATE_CREATED_KHR 0x3215
-#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
-#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
-#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
-#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
-#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
-#define EGL_BAD_STREAM_KHR 0x321B
-#define EGL_BAD_STATE_KHR 0x321C
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_stream */
-
-#ifndef EGL_KHR_stream_consumer_gltexture
-#define EGL_KHR_stream_consumer_gltexture 1
-#ifdef EGL_KHR_stream
-#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_consumer_gltexture */
-
-#ifndef EGL_KHR_stream_cross_process_fd
-#define EGL_KHR_stream_cross_process_fd 1
-typedef int EGLNativeFileDescriptorKHR;
-#ifdef EGL_KHR_stream
-#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
-typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_cross_process_fd */
-
-#ifndef EGL_KHR_stream_fifo
-#define EGL_KHR_stream_fifo 1
-#ifdef EGL_KHR_stream
-#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
-#define EGL_STREAM_TIME_NOW_KHR 0x31FD
-#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
-#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_fifo */
-
-#ifndef EGL_KHR_stream_producer_aldatalocator
-#define EGL_KHR_stream_producer_aldatalocator 1
-#ifdef EGL_KHR_stream
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_producer_aldatalocator */
-
-#ifndef EGL_KHR_stream_producer_eglsurface
-#define EGL_KHR_stream_producer_eglsurface 1
-#ifdef EGL_KHR_stream
-#define EGL_STREAM_BIT_KHR 0x0800
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_producer_eglsurface */
-
-#ifndef EGL_KHR_surfaceless_context
-#define EGL_KHR_surfaceless_context 1
-#endif /* EGL_KHR_surfaceless_context */
-
-#ifndef EGL_KHR_swap_buffers_with_damage
-#define EGL_KHR_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_KHR_swap_buffers_with_damage */
-
-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
-#endif /* EGL_KHR_vg_parent_image */
-
-#ifndef EGL_KHR_wait_sync
-#define EGL_KHR_wait_sync 1
-typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#endif
-#endif /* EGL_KHR_wait_sync */
-
-#ifndef EGL_ANDROID_blob_cache
-#define EGL_ANDROID_blob_cache 1
-typedef khronos_ssize_t EGLsizeiANDROID;
-typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
-typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif
-#endif /* EGL_ANDROID_blob_cache */
-
-#ifndef EGL_ANDROID_framebuffer_target
-#define EGL_ANDROID_framebuffer_target 1
-#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
-#endif /* EGL_ANDROID_framebuffer_target */
-
-#ifndef EGL_ANDROID_image_native_buffer
-#define EGL_ANDROID_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_ANDROID 0x3140
-#endif /* EGL_ANDROID_image_native_buffer */
-
-#ifndef EGL_ANDROID_native_fence_sync
-#define EGL_ANDROID_native_fence_sync 1
-#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
-#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
-#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
-#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
-typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
-#endif
-#endif /* EGL_ANDROID_native_fence_sync */
-
-#ifndef EGL_ANDROID_recordable
-#define EGL_ANDROID_recordable 1
-#define EGL_RECORDABLE_ANDROID 0x3142
-#endif /* EGL_ANDROID_recordable */
-
-#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
-#define EGL_ANGLE_d3d_share_handle_client_buffer 1
-#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
-#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
-
-#ifndef EGL_ANGLE_device_d3d
-#define EGL_ANGLE_device_d3d 1
-#define EGL_D3D9_DEVICE_ANGLE 0x33A0
-#define EGL_D3D11_DEVICE_ANGLE 0x33A1
-#endif /* EGL_ANGLE_device_d3d */
-
-#ifndef EGL_ANGLE_query_surface_pointer
-#define EGL_ANGLE_query_surface_pointer 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#endif
-#endif /* EGL_ANGLE_query_surface_pointer */
-
-#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
-#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
-#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
-
-#ifndef EGL_ANGLE_window_fixed_size
-#define EGL_ANGLE_window_fixed_size 1
-#define EGL_FIXED_SIZE_ANGLE 0x3201
-#endif /* EGL_ANGLE_window_fixed_size */
-
-#ifndef EGL_ARM_pixmap_multisample_discard
-#define EGL_ARM_pixmap_multisample_discard 1
-#define EGL_DISCARD_SAMPLES_ARM 0x3286
-#endif /* EGL_ARM_pixmap_multisample_discard */
-
-#ifndef EGL_EXT_buffer_age
-#define EGL_EXT_buffer_age 1
-#define EGL_BUFFER_AGE_EXT 0x313D
-#endif /* EGL_EXT_buffer_age */
-
-#ifndef EGL_EXT_client_extensions
-#define EGL_EXT_client_extensions 1
-#endif /* EGL_EXT_client_extensions */
-
-#ifndef EGL_EXT_create_context_robustness
-#define EGL_EXT_create_context_robustness 1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
-#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
-#endif /* EGL_EXT_create_context_robustness */
-
-#ifndef EGL_EXT_device_base
-#define EGL_EXT_device_base 1
-typedef void *EGLDeviceEXT;
-#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
-#define EGL_BAD_DEVICE_EXT 0x322B
-#define EGL_DEVICE_EXT 0x322C
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-#endif
-#endif /* EGL_EXT_device_base */
-
-#ifndef EGL_EXT_device_drm
-#define EGL_EXT_device_drm 1
-#define EGL_DRM_DEVICE_FILE_EXT 0x3233
-#endif /* EGL_EXT_device_drm */
-
-#ifndef EGL_EXT_device_enumeration
-#define EGL_EXT_device_enumeration 1
-#endif /* EGL_EXT_device_enumeration */
-
-#ifndef EGL_EXT_device_openwf
-#define EGL_EXT_device_openwf 1
-#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
-#endif /* EGL_EXT_device_openwf */
-
-#ifndef EGL_EXT_device_query
-#define EGL_EXT_device_query 1
-#endif /* EGL_EXT_device_query */
-
-#ifndef EGL_EXT_image_dma_buf_import
-#define EGL_EXT_image_dma_buf_import 1
-#define EGL_LINUX_DMA_BUF_EXT 0x3270
-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
-#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
-#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
-#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
-#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
-#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
-#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
-#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
-#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
-#define EGL_ITU_REC601_EXT 0x327F
-#define EGL_ITU_REC709_EXT 0x3280
-#define EGL_ITU_REC2020_EXT 0x3281
-#define EGL_YUV_FULL_RANGE_EXT 0x3282
-#define EGL_YUV_NARROW_RANGE_EXT 0x3283
-#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
-#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
-#endif /* EGL_EXT_image_dma_buf_import */
-
-#ifndef EGL_EXT_multiview_window
-#define EGL_EXT_multiview_window 1
-#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
-#endif /* EGL_EXT_multiview_window */
-
-#ifndef EGL_EXT_output_base
-#define EGL_EXT_output_base 1
-typedef void *EGLOutputLayerEXT;
-typedef void *EGLOutputPortEXT;
-#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
-#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0)
-#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
-#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
-#define EGL_SWAP_INTERVAL_EXT 0x322F
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
-EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
-#endif
-#endif /* EGL_EXT_output_base */
-
-#ifndef EGL_EXT_output_drm
-#define EGL_EXT_output_drm 1
-#define EGL_DRM_CRTC_EXT 0x3234
-#define EGL_DRM_PLANE_EXT 0x3235
-#define EGL_DRM_CONNECTOR_EXT 0x3236
-#endif /* EGL_EXT_output_drm */
-
-#ifndef EGL_EXT_output_openwf
-#define EGL_EXT_output_openwf 1
-#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
-#define EGL_OPENWF_PORT_ID_EXT 0x3239
-#endif /* EGL_EXT_output_openwf */
-
-#ifndef EGL_EXT_platform_base
-#define EGL_EXT_platform_base 1
-typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-#endif
-#endif /* EGL_EXT_platform_base */
-
-#ifndef EGL_EXT_platform_device
-#define EGL_EXT_platform_device 1
-#define EGL_PLATFORM_DEVICE_EXT 0x313F
-#endif /* EGL_EXT_platform_device */
-
-#ifndef EGL_EXT_platform_wayland
-#define EGL_EXT_platform_wayland 1
-#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
-#endif /* EGL_EXT_platform_wayland */
-
-#ifndef EGL_EXT_platform_x11
-#define EGL_EXT_platform_x11 1
-#define EGL_PLATFORM_X11_EXT 0x31D5
-#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
-#endif /* EGL_EXT_platform_x11 */
-
-#ifndef EGL_EXT_protected_surface
-#define EGL_EXT_protected_surface 1
-#define EGL_PROTECTED_CONTENT_EXT 0x32C0
-#endif /* EGL_EXT_protected_surface */
-
-#ifndef EGL_EXT_stream_consumer_egloutput
-#define EGL_EXT_stream_consumer_egloutput 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
-#endif
-#endif /* EGL_EXT_stream_consumer_egloutput */
-
-#ifndef EGL_EXT_swap_buffers_with_damage
-#define EGL_EXT_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_EXT_swap_buffers_with_damage */
-
-#ifndef EGL_EXT_yuv_surface
-#define EGL_EXT_yuv_surface 1
-#define EGL_YUV_ORDER_EXT 0x3301
-#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
-#define EGL_YUV_SUBSAMPLE_EXT 0x3312
-#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
-#define EGL_YUV_CSC_STANDARD_EXT 0x330A
-#define EGL_YUV_PLANE_BPP_EXT 0x331A
-#define EGL_YUV_BUFFER_EXT 0x3300
-#define EGL_YUV_ORDER_YUV_EXT 0x3302
-#define EGL_YUV_ORDER_YVU_EXT 0x3303
-#define EGL_YUV_ORDER_YUYV_EXT 0x3304
-#define EGL_YUV_ORDER_UYVY_EXT 0x3305
-#define EGL_YUV_ORDER_YVYU_EXT 0x3306
-#define EGL_YUV_ORDER_VYUY_EXT 0x3307
-#define EGL_YUV_ORDER_AYUV_EXT 0x3308
-#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
-#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
-#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
-#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
-#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
-#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
-#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
-#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
-#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
-#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
-#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
-#endif /* EGL_EXT_yuv_surface */
-
-#ifndef EGL_HI_clientpixmap
-#define EGL_HI_clientpixmap 1
-struct EGLClientPixmapHI {
- void *pData;
- EGLint iWidth;
- EGLint iHeight;
- EGLint iStride;
-};
-#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
-#endif
-#endif /* EGL_HI_clientpixmap */
-
-#ifndef EGL_HI_colorformats
-#define EGL_HI_colorformats 1
-#define EGL_COLOR_FORMAT_HI 0x8F70
-#define EGL_COLOR_RGB_HI 0x8F71
-#define EGL_COLOR_RGBA_HI 0x8F72
-#define EGL_COLOR_ARGB_HI 0x8F73
-#endif /* EGL_HI_colorformats */
-
-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
-#endif /* EGL_IMG_context_priority */
-
-#ifndef EGL_MESA_drm_image
-#define EGL_MESA_drm_image 1
-#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
-#define EGL_DRM_BUFFER_USE_MESA 0x31D1
-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
-#define EGL_DRM_BUFFER_MESA 0x31D3
-#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
-#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif
-#endif /* EGL_MESA_drm_image */
-
-#ifndef EGL_MESA_image_dma_buf_export
-#define EGL_MESA_image_dma_buf_export 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
-#endif
-#endif /* EGL_MESA_image_dma_buf_export */
-
-#ifndef EGL_MESA_platform_gbm
-#define EGL_MESA_platform_gbm 1
-#define EGL_PLATFORM_GBM_MESA 0x31D7
-#endif /* EGL_MESA_platform_gbm */
-
-#ifndef EGL_NOK_swap_region
-#define EGL_NOK_swap_region 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#endif
-#endif /* EGL_NOK_swap_region */
-
-#ifndef EGL_NOK_swap_region2
-#define EGL_NOK_swap_region2 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#endif
-#endif /* EGL_NOK_swap_region2 */
-
-#ifndef EGL_NOK_texture_from_pixmap
-#define EGL_NOK_texture_from_pixmap 1
-#define EGL_Y_INVERTED_NOK 0x307F
-#endif /* EGL_NOK_texture_from_pixmap */
-
-#ifndef EGL_NV_3dvision_surface
-#define EGL_NV_3dvision_surface 1
-#define EGL_AUTO_STEREO_NV 0x3136
-#endif /* EGL_NV_3dvision_surface */
-
-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
-#endif /* EGL_NV_coverage_sample */
-
-#ifndef EGL_NV_coverage_sample_resolve
-#define EGL_NV_coverage_sample_resolve 1
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
-#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
-#endif /* EGL_NV_coverage_sample_resolve */
-
-#ifndef EGL_NV_cuda_event
-#define EGL_NV_cuda_event 1
-#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
-#define EGL_SYNC_CUDA_EVENT_NV 0x323C
-#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
-#endif /* EGL_NV_cuda_event */
-
-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
-#endif /* EGL_NV_depth_nonlinear */
-
-#ifndef EGL_NV_device_cuda
-#define EGL_NV_device_cuda 1
-#define EGL_CUDA_DEVICE_NV 0x323A
-#endif /* EGL_NV_device_cuda */
-
-#ifndef EGL_NV_native_query
-#define EGL_NV_native_query 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#endif
-#endif /* EGL_NV_native_query */
-
-#ifndef EGL_NV_post_convert_rounding
-#define EGL_NV_post_convert_rounding 1
-#endif /* EGL_NV_post_convert_rounding */
-
-#ifndef EGL_NV_post_sub_buffer
-#define EGL_NV_post_sub_buffer 1
-#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#endif
-#endif /* EGL_NV_post_sub_buffer */
-
-#ifndef EGL_NV_stream_sync
-#define EGL_NV_stream_sync 1
-#define EGL_SYNC_NEW_FRAME_NV 0x321F
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
-#endif
-#endif /* EGL_NV_stream_sync */
-
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-typedef void *EGLSyncNV;
-typedef khronos_utime_nanoseconds_t EGLTimeNV;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
-#define EGL_SYNC_STATUS_NV 0x30E7
-#define EGL_SIGNALED_NV 0x30E8
-#define EGL_UNSIGNALED_NV 0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
-#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV 0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
-#define EGL_CONDITION_SATISFIED_NV 0x30EC
-#define EGL_SYNC_TYPE_NV 0x30ED
-#define EGL_SYNC_CONDITION_NV 0x30EE
-#define EGL_SYNC_FENCE_NV 0x30EF
-#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
-EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_NV_sync */
-
-#ifndef EGL_NV_system_time
-#define EGL_NV_system_time 1
-typedef khronos_utime_nanoseconds_t EGLuint64NV;
-#ifdef KHRONOS_SUPPORT_INT64
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_NV_system_time */
-
-#ifndef EGL_TIZEN_image_native_buffer
-#define EGL_TIZEN_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
-#endif /* EGL_TIZEN_image_native_buffer */
-
-#ifndef EGL_TIZEN_image_native_surface
-#define EGL_TIZEN_image_native_surface 1
-#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
-#endif /* EGL_TIZEN_image_native_surface */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __eglext_h_ */
-
-
-#endif /* _MSC_VER */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_endian.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_endian.h
deleted file mode 100644
index 3eda7f2..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_endian.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_endian.h
- *
- * Functions for reading and writing endian-specific values
- */
-
-#ifndef SDL_endian_h_
-#define SDL_endian_h_
-
-#include "SDL_stdinc.h"
-
-/**
- * \name The two types of endianness
- */
-/* @{ */
-#define SDL_LIL_ENDIAN 1234
-#define SDL_BIG_ENDIAN 4321
-/* @} */
-
-#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
-#ifdef __linux__
-#include <endian.h>
-#define SDL_BYTEORDER __BYTE_ORDER
-#else /* __linux__ */
-#if defined(__hppa__) || \
- defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
- (defined(__MIPS__) && defined(__MISPEB__)) || \
- defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
- defined(__sparc__)
-#define SDL_BYTEORDER SDL_BIG_ENDIAN
-#else
-#define SDL_BYTEORDER SDL_LIL_ENDIAN
-#endif
-#endif /* __linux__ */
-#endif /* !SDL_BYTEORDER */
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_endian.h
- */
-#if defined(__GNUC__) && defined(__i386__) && \
- !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- int result;
-
- __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
- return (Uint16)result;
-}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
- return x;
-}
-#elif defined(__WATCOMC__) && defined(__386__)
-extern _inline Uint16 SDL_Swap16(Uint16);
-#pragma aux SDL_Swap16 = \
- "xchg al, ah" \
- parm [ax] \
- modify [ax];
-#else
-SDL_FORCE_INLINE Uint16
-SDL_Swap16(Uint16 x)
-{
- return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
-}
-#endif
-
-#if defined(__GNUC__) && defined(__i386__)
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- __asm__("bswap %0": "=r"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- __asm__("bswapl %0": "=r"(x):"0"(x));
- return x;
-}
-#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- Uint32 result;
-
- __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
- __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
- __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
- return result;
-}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
- return x;
-}
-#elif defined(__WATCOMC__) && defined(__386__)
-extern _inline Uint32 SDL_Swap32(Uint32);
-#ifndef __SW_3 /* 486+ */
-#pragma aux SDL_Swap32 = \
- "bswap eax" \
- parm [eax] \
- modify [eax];
-#else /* 386-only */
-#pragma aux SDL_Swap32 = \
- "xchg al, ah" \
- "ror eax, 16" \
- "xchg al, ah" \
- parm [eax] \
- modify [eax];
-#endif
-#else
-SDL_FORCE_INLINE Uint32
-SDL_Swap32(Uint32 x)
-{
- return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
- ((x >> 8) & 0x0000FF00) | (x >> 24)));
-}
-#endif
-
-#if defined(__GNUC__) && defined(__i386__)
-SDL_FORCE_INLINE Uint64
-SDL_Swap64(Uint64 x)
-{
- union
- {
- struct
- {
- Uint32 a, b;
- } s;
- Uint64 u;
- } v;
- v.u = x;
- __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
- "1"(v.s.
- b));
- return v.u;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-SDL_FORCE_INLINE Uint64
-SDL_Swap64(Uint64 x)
-{
- __asm__("bswapq %0": "=r"(x):"0"(x));
- return x;
-}
-#else
-SDL_FORCE_INLINE Uint64
-SDL_Swap64(Uint64 x)
-{
- Uint32 hi, lo;
-
- /* Separate into high and low 32-bit values and swap them */
- lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
- x >>= 32;
- hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
- x = SDL_Swap32(lo);
- x <<= 32;
- x |= SDL_Swap32(hi);
- return (x);
-}
-#endif
-
-
-SDL_FORCE_INLINE float
-SDL_SwapFloat(float x)
-{
- union
- {
- float f;
- Uint32 ui32;
- } swapper;
- swapper.f = x;
- swapper.ui32 = SDL_Swap32(swapper.ui32);
- return swapper.f;
-}
-
-
-/**
- * \name Swap to native
- * Byteswap item from the specified endianness to the native endianness.
- */
-/* @{ */
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_SwapLE16(X) (X)
-#define SDL_SwapLE32(X) (X)
-#define SDL_SwapLE64(X) (X)
-#define SDL_SwapFloatLE(X) (X)
-#define SDL_SwapBE16(X) SDL_Swap16(X)
-#define SDL_SwapBE32(X) SDL_Swap32(X)
-#define SDL_SwapBE64(X) SDL_Swap64(X)
-#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
-#else
-#define SDL_SwapLE16(X) SDL_Swap16(X)
-#define SDL_SwapLE32(X) SDL_Swap32(X)
-#define SDL_SwapLE64(X) SDL_Swap64(X)
-#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
-#define SDL_SwapBE16(X) (X)
-#define SDL_SwapBE32(X) (X)
-#define SDL_SwapBE64(X) (X)
-#define SDL_SwapFloatBE(X) (X)
-#endif
-/* @} *//* Swap to native */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_endian_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_error.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_error.h
deleted file mode 100644
index 49be982..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_error.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_error.h
- *
- * Simple error message routines for SDL.
- */
-
-#ifndef SDL_error_h_
-#define SDL_error_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Public functions */
-/* SDL_SetError() unconditionally returns -1. */
-extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-extern DECLSPEC const char *SDLCALL SDL_GetError(void);
-extern DECLSPEC void SDLCALL SDL_ClearError(void);
-
-/**
- * \name Internal error functions
- *
- * \internal
- * Private error reporting function - used internally.
- */
-/* @{ */
-#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
-#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
-#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
-typedef enum
-{
- SDL_ENOMEM,
- SDL_EFREAD,
- SDL_EFWRITE,
- SDL_EFSEEK,
- SDL_UNSUPPORTED,
- SDL_LASTERROR
-} SDL_errorcode;
-/* SDL_Error() unconditionally returns -1. */
-extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
-/* @} *//* Internal error functions */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_error_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_events.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_events.h
deleted file mode 100644
index 0fc09bc..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_events.h
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_events.h
- *
- * Include file for SDL event handling.
- */
-
-#ifndef SDL_events_h_
-#define SDL_events_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-#include "SDL_keyboard.h"
-#include "SDL_mouse.h"
-#include "SDL_joystick.h"
-#include "SDL_gamecontroller.h"
-#include "SDL_quit.h"
-#include "SDL_gesture.h"
-#include "SDL_touch.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* General keyboard/mouse state definitions */
-#define SDL_RELEASED 0
-#define SDL_PRESSED 1
-
-/**
- * \brief The types of events that can be delivered.
- */
-typedef enum
-{
- SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
-
- /* Application events */
- SDL_QUIT = 0x100, /**< User-requested quit */
-
- /* These application events have special meaning on iOS, see README-ios.md for details */
- SDL_APP_TERMINATING, /**< The application is being terminated by the OS
- Called on iOS in applicationWillTerminate()
- Called on Android in onDestroy()
- */
- SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
- Called on iOS in applicationDidReceiveMemoryWarning()
- Called on Android in onLowMemory()
- */
- SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
- Called on iOS in applicationWillResignActive()
- Called on Android in onPause()
- */
- SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
- Called on iOS in applicationDidEnterBackground()
- Called on Android in onPause()
- */
- SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
- Called on iOS in applicationWillEnterForeground()
- Called on Android in onResume()
- */
- SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
- Called on iOS in applicationDidBecomeActive()
- Called on Android in onResume()
- */
-
- /* Window events */
- SDL_WINDOWEVENT = 0x200, /**< Window state change */
- SDL_SYSWMEVENT, /**< System specific event */
-
- /* Keyboard events */
- SDL_KEYDOWN = 0x300, /**< Key pressed */
- SDL_KEYUP, /**< Key released */
- SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
- SDL_TEXTINPUT, /**< Keyboard text input */
- SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
- input language or keyboard layout change.
- */
-
- /* Mouse events */
- SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
- SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
- SDL_MOUSEBUTTONUP, /**< Mouse button released */
- SDL_MOUSEWHEEL, /**< Mouse wheel motion */
-
- /* Joystick events */
- SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
- SDL_JOYBALLMOTION, /**< Joystick trackball motion */
- SDL_JOYHATMOTION, /**< Joystick hat position change */
- SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
- SDL_JOYBUTTONUP, /**< Joystick button released */
- SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
- SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
-
- /* Game controller events */
- SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
- SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
- SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
- SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
- SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
- SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
-
- /* Touch events */
- SDL_FINGERDOWN = 0x700,
- SDL_FINGERUP,
- SDL_FINGERMOTION,
-
- /* Gesture events */
- SDL_DOLLARGESTURE = 0x800,
- SDL_DOLLARRECORD,
- SDL_MULTIGESTURE,
-
- /* Clipboard events */
- SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
-
- /* Drag and drop events */
- SDL_DROPFILE = 0x1000, /**< The system requests a file open */
- SDL_DROPTEXT, /**< text/plain drag-and-drop event */
- SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
- SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
-
- /* Audio hotplug events */
- SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
- SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
-
- /* Render events */
- SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
- SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
-
- /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
- * and should be allocated with SDL_RegisterEvents()
- */
- SDL_USEREVENT = 0x8000,
-
- /**
- * This last event is only for bounding internal arrays
- */
- SDL_LASTEVENT = 0xFFFF
-} SDL_EventType;
-
-/**
- * \brief Fields shared by every event
- */
-typedef struct SDL_CommonEvent
-{
- Uint32 type;
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
-} SDL_CommonEvent;
-
-/**
- * \brief Window state change event data (event.window.*)
- */
-typedef struct SDL_WindowEvent
-{
- Uint32 type; /**< ::SDL_WINDOWEVENT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The associated window */
- Uint8 event; /**< ::SDL_WindowEventID */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint32 data1; /**< event dependent data */
- Sint32 data2; /**< event dependent data */
-} SDL_WindowEvent;
-
-/**
- * \brief Keyboard button event structure (event.key.*)
- */
-typedef struct SDL_KeyboardEvent
-{
- Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with keyboard focus, if any */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 repeat; /**< Non-zero if this is a key repeat */
- Uint8 padding2;
- Uint8 padding3;
- SDL_Keysym keysym; /**< The key that was pressed or released */
-} SDL_KeyboardEvent;
-
-#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
-/**
- * \brief Keyboard text editing event structure (event.edit.*)
- */
-typedef struct SDL_TextEditingEvent
-{
- Uint32 type; /**< ::SDL_TEXTEDITING */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with keyboard focus, if any */
- char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
- Sint32 start; /**< The start cursor of selected editing text */
- Sint32 length; /**< The length of selected editing text */
-} SDL_TextEditingEvent;
-
-
-#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
-/**
- * \brief Keyboard text input event structure (event.text.*)
- */
-typedef struct SDL_TextInputEvent
-{
- Uint32 type; /**< ::SDL_TEXTINPUT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with keyboard focus, if any */
- char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
-} SDL_TextInputEvent;
-
-/**
- * \brief Mouse motion event structure (event.motion.*)
- */
-typedef struct SDL_MouseMotionEvent
-{
- Uint32 type; /**< ::SDL_MOUSEMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
- Uint32 state; /**< The current button state */
- Sint32 x; /**< X coordinate, relative to window */
- Sint32 y; /**< Y coordinate, relative to window */
- Sint32 xrel; /**< The relative motion in the X direction */
- Sint32 yrel; /**< The relative motion in the Y direction */
-} SDL_MouseMotionEvent;
-
-/**
- * \brief Mouse button event structure (event.button.*)
- */
-typedef struct SDL_MouseButtonEvent
-{
- Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
- Uint8 button; /**< The mouse button index */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
- Uint8 padding1;
- Sint32 x; /**< X coordinate, relative to window */
- Sint32 y; /**< Y coordinate, relative to window */
-} SDL_MouseButtonEvent;
-
-/**
- * \brief Mouse wheel event structure (event.wheel.*)
- */
-typedef struct SDL_MouseWheelEvent
-{
- Uint32 type; /**< ::SDL_MOUSEWHEEL */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
- Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
- Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
- Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
-} SDL_MouseWheelEvent;
-
-/**
- * \brief Joystick axis motion event structure (event.jaxis.*)
- */
-typedef struct SDL_JoyAxisEvent
-{
- Uint32 type; /**< ::SDL_JOYAXISMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 axis; /**< The joystick axis index */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint16 value; /**< The axis value (range: -32768 to 32767) */
- Uint16 padding4;
-} SDL_JoyAxisEvent;
-
-/**
- * \brief Joystick trackball motion event structure (event.jball.*)
- */
-typedef struct SDL_JoyBallEvent
-{
- Uint32 type; /**< ::SDL_JOYBALLMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 ball; /**< The joystick trackball index */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint16 xrel; /**< The relative motion in the X direction */
- Sint16 yrel; /**< The relative motion in the Y direction */
-} SDL_JoyBallEvent;
-
-/**
- * \brief Joystick hat position change event structure (event.jhat.*)
- */
-typedef struct SDL_JoyHatEvent
-{
- Uint32 type; /**< ::SDL_JOYHATMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 hat; /**< The joystick hat index */
- Uint8 value; /**< The hat position value.
- * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
- * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
- * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
- *
- * Note that zero means the POV is centered.
- */
- Uint8 padding1;
- Uint8 padding2;
-} SDL_JoyHatEvent;
-
-/**
- * \brief Joystick button event structure (event.jbutton.*)
- */
-typedef struct SDL_JoyButtonEvent
-{
- Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 button; /**< The joystick button index */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 padding1;
- Uint8 padding2;
-} SDL_JoyButtonEvent;
-
-/**
- * \brief Joystick device event structure (event.jdevice.*)
- */
-typedef struct SDL_JoyDeviceEvent
-{
- Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
-} SDL_JoyDeviceEvent;
-
-
-/**
- * \brief Game controller axis motion event structure (event.caxis.*)
- */
-typedef struct SDL_ControllerAxisEvent
-{
- Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Sint16 value; /**< The axis value (range: -32768 to 32767) */
- Uint16 padding4;
-} SDL_ControllerAxisEvent;
-
-
-/**
- * \brief Game controller button event structure (event.cbutton.*)
- */
-typedef struct SDL_ControllerButtonEvent
-{
- Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_JoystickID which; /**< The joystick instance id */
- Uint8 button; /**< The controller button (SDL_GameControllerButton) */
- Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
- Uint8 padding1;
- Uint8 padding2;
-} SDL_ControllerButtonEvent;
-
-
-/**
- * \brief Controller device event structure (event.cdevice.*)
- */
-typedef struct SDL_ControllerDeviceEvent
-{
- Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
-} SDL_ControllerDeviceEvent;
-
-/**
- * \brief Audio device event structure (event.adevice.*)
- */
-typedef struct SDL_AudioDeviceEvent
-{
- Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
- Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
-} SDL_AudioDeviceEvent;
-
-
-/**
- * \brief Touch finger event structure (event.tfinger.*)
- */
-typedef struct SDL_TouchFingerEvent
-{
- Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_TouchID touchId; /**< The touch device id */
- SDL_FingerID fingerId;
- float x; /**< Normalized in the range 0...1 */
- float y; /**< Normalized in the range 0...1 */
- float dx; /**< Normalized in the range -1...1 */
- float dy; /**< Normalized in the range -1...1 */
- float pressure; /**< Normalized in the range 0...1 */
-} SDL_TouchFingerEvent;
-
-
-/**
- * \brief Multiple Finger Gesture Event (event.mgesture.*)
- */
-typedef struct SDL_MultiGestureEvent
-{
- Uint32 type; /**< ::SDL_MULTIGESTURE */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_TouchID touchId; /**< The touch device id */
- float dTheta;
- float dDist;
- float x;
- float y;
- Uint16 numFingers;
- Uint16 padding;
-} SDL_MultiGestureEvent;
-
-
-/**
- * \brief Dollar Gesture Event (event.dgesture.*)
- */
-typedef struct SDL_DollarGestureEvent
-{
- Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_TouchID touchId; /**< The touch device id */
- SDL_GestureID gestureId;
- Uint32 numFingers;
- float error;
- float x; /**< Normalized center of gesture */
- float y; /**< Normalized center of gesture */
-} SDL_DollarGestureEvent;
-
-
-/**
- * \brief An event used to request a file open by the system (event.drop.*)
- * This event is enabled by default, you can disable it with SDL_EventState().
- * \note If this event is enabled, you must free the filename in the event.
- */
-typedef struct SDL_DropEvent
-{
- Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
- Uint32 windowID; /**< The window that was dropped on, if any */
-} SDL_DropEvent;
-
-
-/**
- * \brief The "quit requested" event
- */
-typedef struct SDL_QuitEvent
-{
- Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
-} SDL_QuitEvent;
-
-/**
- * \brief OS Specific event
- */
-typedef struct SDL_OSEvent
-{
- Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
-} SDL_OSEvent;
-
-/**
- * \brief A user-defined event type (event.user.*)
- */
-typedef struct SDL_UserEvent
-{
- Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Uint32 windowID; /**< The associated window if any */
- Sint32 code; /**< User defined event code */
- void *data1; /**< User defined data pointer */
- void *data2; /**< User defined data pointer */
-} SDL_UserEvent;
-
-
-struct SDL_SysWMmsg;
-typedef struct SDL_SysWMmsg SDL_SysWMmsg;
-
-/**
- * \brief A video driver dependent system event (event.syswm.*)
- * This event is disabled by default, you can enable it with SDL_EventState()
- *
- * \note If you want to use this event, you should include SDL_syswm.h.
- */
-typedef struct SDL_SysWMEvent
-{
- Uint32 type; /**< ::SDL_SYSWMEVENT */
- Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
-} SDL_SysWMEvent;
-
-/**
- * \brief General event structure
- */
-typedef union SDL_Event
-{
- Uint32 type; /**< Event type, shared with all events */
- SDL_CommonEvent common; /**< Common event data */
- SDL_WindowEvent window; /**< Window event data */
- SDL_KeyboardEvent key; /**< Keyboard event data */
- SDL_TextEditingEvent edit; /**< Text editing event data */
- SDL_TextInputEvent text; /**< Text input event data */
- SDL_MouseMotionEvent motion; /**< Mouse motion event data */
- SDL_MouseButtonEvent button; /**< Mouse button event data */
- SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
- SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
- SDL_JoyBallEvent jball; /**< Joystick ball event data */
- SDL_JoyHatEvent jhat; /**< Joystick hat event data */
- SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
- SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
- SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
- SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
- SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
- SDL_AudioDeviceEvent adevice; /**< Audio device event data */
- SDL_QuitEvent quit; /**< Quit request event data */
- SDL_UserEvent user; /**< Custom event data */
- SDL_SysWMEvent syswm; /**< System dependent window event data */
- SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
- SDL_MultiGestureEvent mgesture; /**< Gesture event data */
- SDL_DollarGestureEvent dgesture; /**< Gesture event data */
- SDL_DropEvent drop; /**< Drag and drop event data */
-
- /* This is necessary for ABI compatibility between Visual C++ and GCC
- Visual C++ will respect the push pack pragma and use 52 bytes for
- this structure, and GCC will use the alignment of the largest datatype
- within the union, which is 8 bytes.
-
- So... we'll add padding to force the size to be 56 bytes for both.
- */
- Uint8 padding[56];
-} SDL_Event;
-
-
-/* Function prototypes */
-
-/**
- * Pumps the event loop, gathering events from the input devices.
- *
- * This function updates the event queue and internal input device state.
- *
- * This should only be run in the thread that sets the video mode.
- */
-extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
-
-/* @{ */
-typedef enum
-{
- SDL_ADDEVENT,
- SDL_PEEKEVENT,
- SDL_GETEVENT
-} SDL_eventaction;
-
-/**
- * Checks the event queue for messages and optionally returns them.
- *
- * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
- * the back of the event queue.
- *
- * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
- * of the event queue, within the specified minimum and maximum type,
- * will be returned and will not be removed from the queue.
- *
- * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
- * of the event queue, within the specified minimum and maximum type,
- * will be returned and will be removed from the queue.
- *
- * \return The number of events actually stored, or -1 if there was an error.
- *
- * This function is thread-safe.
- */
-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
- SDL_eventaction action,
- Uint32 minType, Uint32 maxType);
-/* @} */
-
-/**
- * Checks to see if certain event types are in the event queue.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
-extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
-
-/**
- * This function clears events from the event queue
- * This function only affects currently queued events. If you want to make
- * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
- * on the main thread immediately before the flush call.
- */
-extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
-extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
-
-/**
- * \brief Polls for currently pending events.
- *
- * \return 1 if there are any pending events, or 0 if there are none available.
- *
- * \param event If not NULL, the next event is removed from the queue and
- * stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
-
-/**
- * \brief Waits indefinitely for the next available event.
- *
- * \return 1, or 0 if there was an error while waiting for events.
- *
- * \param event If not NULL, the next event is removed from the queue and
- * stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
-
-/**
- * \brief Waits until the specified timeout (in milliseconds) for the next
- * available event.
- *
- * \return 1, or 0 if there was an error while waiting for events.
- *
- * \param event If not NULL, the next event is removed from the queue and
- * stored in that area.
- * \param timeout The timeout (in milliseconds) to wait for next event.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
- int timeout);
-
-/**
- * \brief Add an event to the event queue.
- *
- * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
- * was full or there was some other error.
- */
-extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
-
-typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
-
-/**
- * Sets up a filter to process all events before they change internal state and
- * are posted to the internal event queue.
- *
- * The filter is prototyped as:
- * \code
- * int SDL_EventFilter(void *userdata, SDL_Event * event);
- * \endcode
- *
- * If the filter returns 1, then the event will be added to the internal queue.
- * If it returns 0, then the event will be dropped from the queue, but the
- * internal state will still be updated. This allows selective filtering of
- * dynamically arriving events.
- *
- * \warning Be very careful of what you do in the event filter function, as
- * it may run in a different thread!
- *
- * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
- * event filter is only called when the window manager desires to close the
- * application window. If the event filter returns 1, then the window will
- * be closed, otherwise the window will remain open if possible.
- *
- * If the quit event is generated by an interrupt signal, it will bypass the
- * internal queue and be delivered to the application at the next event poll.
- */
-extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
- void *userdata);
-
-/**
- * Return the current event filter - can be used to "chain" filters.
- * If there is no event filter set, this function returns SDL_FALSE.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
- void **userdata);
-
-/**
- * Add a function which is called when an event is added to the queue.
- */
-extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
- void *userdata);
-
-/**
- * Remove an event watch function added with SDL_AddEventWatch()
- */
-extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
- void *userdata);
-
-/**
- * Run the filter function on the current event queue, removing any
- * events for which the filter returns 0.
- */
-extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
- void *userdata);
-
-/* @{ */
-#define SDL_QUERY -1
-#define SDL_IGNORE 0
-#define SDL_DISABLE 0
-#define SDL_ENABLE 1
-
-/**
- * This function allows you to set the state of processing certain events.
- * - If \c state is set to ::SDL_IGNORE, that event will be automatically
- * dropped from the event queue and will not be filtered.
- * - If \c state is set to ::SDL_ENABLE, that event will be processed
- * normally.
- * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
- * current processing state of the specified event.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
-/* @} */
-#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
-
-/**
- * This function allocates a set of user-defined events, and returns
- * the beginning event number for that set of events.
- *
- * If there aren't enough user-defined events left, this function
- * returns (Uint32)-1
- */
-extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_events_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_filesystem.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_filesystem.h
deleted file mode 100644
index a1c846a..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_filesystem.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_filesystem.h
- *
- * \brief Include file for filesystem SDL API functions
- */
-
-#ifndef SDL_filesystem_h_
-#define SDL_filesystem_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Get the path where the application resides.
- *
- * Get the "base path". This is the directory where the application was run
- * from, which is probably the installation directory, and may or may not
- * be the process's current working directory.
- *
- * This returns an absolute path in UTF-8 encoding, and is guaranteed to
- * end with a path separator ('\\' on Windows, '/' most other places).
- *
- * The pointer returned by this function is owned by you. Please call
- * SDL_free() on the pointer when you are done with it, or it will be a
- * memory leak. This is not necessarily a fast call, though, so you should
- * call this once near startup and save the string if you need it.
- *
- * Some platforms can't determine the application's path, and on other
- * platforms, this might be meaningless. In such cases, this function will
- * return NULL.
- *
- * \return String of base dir in UTF-8 encoding, or NULL on error.
- *
- * \sa SDL_GetPrefPath
- */
-extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
-
-/**
- * \brief Get the user-and-app-specific path where files can be written.
- *
- * Get the "pref dir". This is meant to be where users can write personal
- * files (preferences and save games, etc) that are specific to your
- * application. This directory is unique per user, per application.
- *
- * This function will decide the appropriate location in the native filesystem,
- * create the directory if necessary, and return a string of the absolute
- * path to the directory in UTF-8 encoding.
- *
- * On Windows, the string might look like:
- * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
- *
- * On Linux, the string might look like:
- * "/home/bob/.local/share/My Program Name/"
- *
- * On Mac OS X, the string might look like:
- * "/Users/bob/Library/Application Support/My Program Name/"
- *
- * (etc.)
- *
- * You specify the name of your organization (if it's not a real organization,
- * your name or an Internet domain you own might do) and the name of your
- * application. These should be untranslated proper names.
- *
- * Both the org and app strings may become part of a directory name, so
- * please follow these rules:
- *
- * - Try to use the same org string (including case-sensitivity) for
- * all your applications that use this function.
- * - Always use a unique app string for each one, and make sure it never
- * changes for an app once you've decided on it.
- * - Unicode characters are legal, as long as it's UTF-8 encoded, but...
- * - ...only use letters, numbers, and spaces. Avoid punctuation like
- * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
- *
- * This returns an absolute path in UTF-8 encoding, and is guaranteed to
- * end with a path separator ('\\' on Windows, '/' most other places).
- *
- * The pointer returned by this function is owned by you. Please call
- * SDL_free() on the pointer when you are done with it, or it will be a
- * memory leak. This is not necessarily a fast call, though, so you should
- * call this once near startup and save the string if you need it.
- *
- * You should assume the path returned by this function is the only safe
- * place to write files (and that SDL_GetBasePath(), while it might be
- * writable, or even the parent of the returned path, aren't where you
- * should be writing things).
- *
- * Some platforms can't determine the pref path, and on other
- * platforms, this might be meaningless. In such cases, this function will
- * return NULL.
- *
- * \param org The name of your organization.
- * \param app The name of your application.
- * \return UTF-8 string of user dir in platform-dependent notation. NULL
- * if there's a problem (creating directory failed, etc).
- *
- * \sa SDL_GetBasePath
- */
-extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_filesystem_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_gamecontroller.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_gamecontroller.h
deleted file mode 100644
index c921513..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_gamecontroller.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_gamecontroller.h
- *
- * Include file for SDL game controller event handling
- */
-
-#ifndef SDL_gamecontroller_h_
-#define SDL_gamecontroller_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_rwops.h"
-#include "SDL_joystick.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_gamecontroller.h
- *
- * In order to use these functions, SDL_Init() must have been called
- * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
- * for game controllers, and load appropriate drivers.
- *
- * If you would like to receive controller updates while the application
- * is in the background, you should set the following hint before calling
- * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
- */
-
-/**
- * The gamecontroller structure used to identify an SDL game controller
- */
-struct _SDL_GameController;
-typedef struct _SDL_GameController SDL_GameController;
-
-
-typedef enum
-{
- SDL_CONTROLLER_BINDTYPE_NONE = 0,
- SDL_CONTROLLER_BINDTYPE_BUTTON,
- SDL_CONTROLLER_BINDTYPE_AXIS,
- SDL_CONTROLLER_BINDTYPE_HAT
-} SDL_GameControllerBindType;
-
-/**
- * Get the SDL joystick layer binding for this controller button/axis mapping
- */
-typedef struct SDL_GameControllerButtonBind
-{
- SDL_GameControllerBindType bindType;
- union
- {
- int button;
- int axis;
- struct {
- int hat;
- int hat_mask;
- } hat;
- } value;
-
-} SDL_GameControllerButtonBind;
-
-
-/**
- * To count the number of game controllers in the system for the following:
- * int nJoysticks = SDL_NumJoysticks();
- * int nGameControllers = 0;
- * for (int i = 0; i < nJoysticks; i++) {
- * if (SDL_IsGameController(i)) {
- * nGameControllers++;
- * }
- * }
- *
- * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
- * guid,name,mappings
- *
- * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
- * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
- * The mapping format for joystick is:
- * bX - a joystick button, index X
- * hX.Y - hat X with value Y
- * aX - axis X of the joystick
- * Buttons can be used as a controller axis and vice versa.
- *
- * This string shows an example of a valid mapping for a controller
- * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
- *
- */
-
-/**
- * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform()
- * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
- *
- * If \c freerw is non-zero, the stream will be closed after being read.
- *
- * \return number of mappings added, -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
-
-/**
- * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
- *
- * Convenience macro.
- */
-#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
-
-/**
- * Add or update an existing mapping configuration
- *
- * \return 1 if mapping is added, 0 if updated, -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
-
-/**
- * Get the number of mappings installed
- *
- * \return the number of mappings
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
-
-/**
- * Get the mapping at a particular index.
- *
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
- */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
-
-/**
- * Get a mapping string for a GUID
- *
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
- */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
-
-/**
- * Get a mapping string for an open GameController
- *
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
- */
-extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
-
-/**
- * Is the joystick on this index supported by the game controller interface?
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
-
-/**
- * Get the implementation dependent name of a game controller.
- * This can be called before any controllers are opened.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
-
-/**
- * Open a game controller for use.
- * The index passed as an argument refers to the N'th game controller on the system.
- * This index is not the value which will identify this controller in future
- * controller events. The joystick's instance id (::SDL_JoystickID) will be
- * used there instead.
- *
- * \return A controller identifier, or NULL if an error occurred.
- */
-extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
-
-/**
- * Return the SDL_GameController associated with an instance id.
- */
-extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
-
-/**
- * Return the name for this currently opened controller
- */
-extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
-
-/**
- * Get the USB vendor ID of an opened controller, if available.
- * If the vendor ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
-
-/**
- * Get the USB product ID of an opened controller, if available.
- * If the product ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
-
-/**
- * Get the product version of an opened controller, if available.
- * If the product version isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
-
-/**
- * Returns SDL_TRUE if the controller has been opened and currently connected,
- * or SDL_FALSE if it has not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
-
-/**
- * Get the underlying joystick object used by a controller
- */
-extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
-
-/**
- * Enable/disable controller event polling.
- *
- * If controller events are disabled, you must call SDL_GameControllerUpdate()
- * yourself and check the state of the controller when you want controller
- * information.
- *
- * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
- */
-extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
-
-/**
- * Update the current state of the open game controllers.
- *
- * This is called automatically by the event loop if any game controller
- * events are enabled.
- */
-extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
-
-
-/**
- * The list of axes available from a controller
- *
- * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
- * and are centered within ~8000 of zero, though advanced UI will allow users to set
- * or autodetect the dead zone, which varies between controllers.
- *
- * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
- */
-typedef enum
-{
- SDL_CONTROLLER_AXIS_INVALID = -1,
- SDL_CONTROLLER_AXIS_LEFTX,
- SDL_CONTROLLER_AXIS_LEFTY,
- SDL_CONTROLLER_AXIS_RIGHTX,
- SDL_CONTROLLER_AXIS_RIGHTY,
- SDL_CONTROLLER_AXIS_TRIGGERLEFT,
- SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
- SDL_CONTROLLER_AXIS_MAX
-} SDL_GameControllerAxis;
-
-/**
- * turn this string into a axis mapping
- */
-extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
-
-/**
- * turn this axis enum into a string mapping
- */
-extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
-
-/**
- * Get the SDL joystick layer binding for this controller button mapping
- */
-extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
-SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
- SDL_GameControllerAxis axis);
-
-/**
- * Get the current state of an axis control on a game controller.
- *
- * The state is a value ranging from -32768 to 32767 (except for the triggers,
- * which range from 0 to 32767).
- *
- * The axis indices start at index 0.
- */
-extern DECLSPEC Sint16 SDLCALL
-SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
- SDL_GameControllerAxis axis);
-
-/**
- * The list of buttons available from a controller
- */
-typedef enum
-{
- SDL_CONTROLLER_BUTTON_INVALID = -1,
- SDL_CONTROLLER_BUTTON_A,
- SDL_CONTROLLER_BUTTON_B,
- SDL_CONTROLLER_BUTTON_X,
- SDL_CONTROLLER_BUTTON_Y,
- SDL_CONTROLLER_BUTTON_BACK,
- SDL_CONTROLLER_BUTTON_GUIDE,
- SDL_CONTROLLER_BUTTON_START,
- SDL_CONTROLLER_BUTTON_LEFTSTICK,
- SDL_CONTROLLER_BUTTON_RIGHTSTICK,
- SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
- SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
- SDL_CONTROLLER_BUTTON_DPAD_UP,
- SDL_CONTROLLER_BUTTON_DPAD_DOWN,
- SDL_CONTROLLER_BUTTON_DPAD_LEFT,
- SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
- SDL_CONTROLLER_BUTTON_MAX
-} SDL_GameControllerButton;
-
-/**
- * turn this string into a button mapping
- */
-extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
-
-/**
- * turn this button enum into a string mapping
- */
-extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
-
-/**
- * Get the SDL joystick layer binding for this controller button mapping
- */
-extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
-SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
- SDL_GameControllerButton button);
-
-
-/**
- * Get the current state of a button on a game controller.
- *
- * The button indices start at index 0.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
- SDL_GameControllerButton button);
-
-/**
- * Close a controller previously opened with SDL_GameControllerOpen().
- */
-extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_gamecontroller_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_gesture.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_gesture.h
deleted file mode 100644
index 2bba6a7..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_gesture.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_gesture.h
- *
- * Include file for SDL gesture event handling.
- */
-
-#ifndef SDL_gesture_h_
-#define SDL_gesture_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "SDL_touch.h"
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef Sint64 SDL_GestureID;
-
-/* Function prototypes */
-
-/**
- * \brief Begin Recording a gesture on the specified touch, or all touches (-1)
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
-
-
-/**
- * \brief Save all currently loaded Dollar Gesture templates
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
-
-/**
- * \brief Save a currently loaded Dollar Gesture template
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
-
-
-/**
- * \brief Load Dollar Gesture templates from a file
- *
- *
- */
-extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_gesture_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_haptic.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_haptic.h
deleted file mode 100644
index 60daefa..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_haptic.h
+++ /dev/null
@@ -1,1227 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_haptic.h
- *
- * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
- * devices.
- *
- * The basic usage is as follows:
- * - Initialize the subsystem (::SDL_INIT_HAPTIC).
- * - Open a haptic device.
- * - SDL_HapticOpen() to open from index.
- * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
- * - Create an effect (::SDL_HapticEffect).
- * - Upload the effect with SDL_HapticNewEffect().
- * - Run the effect with SDL_HapticRunEffect().
- * - (optional) Free the effect with SDL_HapticDestroyEffect().
- * - Close the haptic device with SDL_HapticClose().
- *
- * \par Simple rumble example:
- * \code
- * SDL_Haptic *haptic;
- *
- * // Open the device
- * haptic = SDL_HapticOpen( 0 );
- * if (haptic == NULL)
- * return -1;
- *
- * // Initialize simple rumble
- * if (SDL_HapticRumbleInit( haptic ) != 0)
- * return -1;
- *
- * // Play effect at 50% strength for 2 seconds
- * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
- * return -1;
- * SDL_Delay( 2000 );
- *
- * // Clean up
- * SDL_HapticClose( haptic );
- * \endcode
- *
- * \par Complete example:
- * \code
- * int test_haptic( SDL_Joystick * joystick ) {
- * SDL_Haptic *haptic;
- * SDL_HapticEffect effect;
- * int effect_id;
- *
- * // Open the device
- * haptic = SDL_HapticOpenFromJoystick( joystick );
- * if (haptic == NULL) return -1; // Most likely joystick isn't haptic
- *
- * // See if it can do sine waves
- * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
- * SDL_HapticClose(haptic); // No sine effect
- * return -1;
- * }
- *
- * // Create the effect
- * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
- * effect.type = SDL_HAPTIC_SINE;
- * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
- * effect.periodic.direction.dir[0] = 18000; // Force comes from south
- * effect.periodic.period = 1000; // 1000 ms
- * effect.periodic.magnitude = 20000; // 20000/32767 strength
- * effect.periodic.length = 5000; // 5 seconds long
- * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
- * effect.periodic.fade_length = 1000; // Takes 1 second to fade away
- *
- * // Upload the effect
- * effect_id = SDL_HapticNewEffect( haptic, &effect );
- *
- * // Test the effect
- * SDL_HapticRunEffect( haptic, effect_id, 1 );
- * SDL_Delay( 5000); // Wait for the effect to finish
- *
- * // We destroy the effect, although closing the device also does this
- * SDL_HapticDestroyEffect( haptic, effect_id );
- *
- * // Close the device
- * SDL_HapticClose(haptic);
- *
- * return 0; // Success
- * }
- * \endcode
- */
-
-#ifndef SDL_haptic_h_
-#define SDL_haptic_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_joystick.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * \typedef SDL_Haptic
- *
- * \brief The haptic structure used to identify an SDL haptic.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticOpenFromJoystick
- * \sa SDL_HapticClose
- */
-struct _SDL_Haptic;
-typedef struct _SDL_Haptic SDL_Haptic;
-
-
-/**
- * \name Haptic features
- *
- * Different haptic features a device can have.
- */
-/* @{ */
-
-/**
- * \name Haptic effects
- */
-/* @{ */
-
-/**
- * \brief Constant effect supported.
- *
- * Constant haptic effect.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_CONSTANT (1u<<0)
-
-/**
- * \brief Sine wave effect supported.
- *
- * Periodic haptic effect that simulates sine waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_SINE (1u<<1)
-
-/**
- * \brief Left/Right effect supported.
- *
- * Haptic effect for direct control over high/low frequency motors.
- *
- * \sa SDL_HapticLeftRight
- * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
- * we ran out of bits, and this is important for XInput devices.
- */
-#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
-
-/* !!! FIXME: put this back when we have more bits in 2.1 */
-/* #define SDL_HAPTIC_SQUARE (1<<2) */
-
-/**
- * \brief Triangle wave effect supported.
- *
- * Periodic haptic effect that simulates triangular waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_TRIANGLE (1u<<3)
-
-/**
- * \brief Sawtoothup wave effect supported.
- *
- * Periodic haptic effect that simulates saw tooth up waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
-
-/**
- * \brief Sawtoothdown wave effect supported.
- *
- * Periodic haptic effect that simulates saw tooth down waves.
- *
- * \sa SDL_HapticPeriodic
- */
-#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
-
-/**
- * \brief Ramp effect supported.
- *
- * Ramp haptic effect.
- *
- * \sa SDL_HapticRamp
- */
-#define SDL_HAPTIC_RAMP (1u<<6)
-
-/**
- * \brief Spring effect supported - uses axes position.
- *
- * Condition haptic effect that simulates a spring. Effect is based on the
- * axes position.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_SPRING (1u<<7)
-
-/**
- * \brief Damper effect supported - uses axes velocity.
- *
- * Condition haptic effect that simulates dampening. Effect is based on the
- * axes velocity.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_DAMPER (1u<<8)
-
-/**
- * \brief Inertia effect supported - uses axes acceleration.
- *
- * Condition haptic effect that simulates inertia. Effect is based on the axes
- * acceleration.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_INERTIA (1u<<9)
-
-/**
- * \brief Friction effect supported - uses axes movement.
- *
- * Condition haptic effect that simulates friction. Effect is based on the
- * axes movement.
- *
- * \sa SDL_HapticCondition
- */
-#define SDL_HAPTIC_FRICTION (1u<<10)
-
-/**
- * \brief Custom effect is supported.
- *
- * User defined custom haptic effect.
- */
-#define SDL_HAPTIC_CUSTOM (1u<<11)
-
-/* @} *//* Haptic effects */
-
-/* These last few are features the device has, not effects */
-
-/**
- * \brief Device can set global gain.
- *
- * Device supports setting the global gain.
- *
- * \sa SDL_HapticSetGain
- */
-#define SDL_HAPTIC_GAIN (1u<<12)
-
-/**
- * \brief Device can set autocenter.
- *
- * Device supports setting autocenter.
- *
- * \sa SDL_HapticSetAutocenter
- */
-#define SDL_HAPTIC_AUTOCENTER (1u<<13)
-
-/**
- * \brief Device can be queried for effect status.
- *
- * Device supports querying effect status.
- *
- * \sa SDL_HapticGetEffectStatus
- */
-#define SDL_HAPTIC_STATUS (1u<<14)
-
-/**
- * \brief Device can be paused.
- *
- * Devices supports being paused.
- *
- * \sa SDL_HapticPause
- * \sa SDL_HapticUnpause
- */
-#define SDL_HAPTIC_PAUSE (1u<<15)
-
-
-/**
- * \name Direction encodings
- */
-/* @{ */
-
-/**
- * \brief Uses polar coordinates for the direction.
- *
- * \sa SDL_HapticDirection
- */
-#define SDL_HAPTIC_POLAR 0
-
-/**
- * \brief Uses cartesian coordinates for the direction.
- *
- * \sa SDL_HapticDirection
- */
-#define SDL_HAPTIC_CARTESIAN 1
-
-/**
- * \brief Uses spherical coordinates for the direction.
- *
- * \sa SDL_HapticDirection
- */
-#define SDL_HAPTIC_SPHERICAL 2
-
-/* @} *//* Direction encodings */
-
-/* @} *//* Haptic features */
-
-/*
- * Misc defines.
- */
-
-/**
- * \brief Used to play a device an infinite number of times.
- *
- * \sa SDL_HapticRunEffect
- */
-#define SDL_HAPTIC_INFINITY 4294967295U
-
-
-/**
- * \brief Structure that represents a haptic direction.
- *
- * This is the direction where the force comes from,
- * instead of the direction in which the force is exerted.
- *
- * Directions can be specified by:
- * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
- * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
- * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
- *
- * Cardinal directions of the haptic device are relative to the positioning
- * of the device. North is considered to be away from the user.
- *
- * The following diagram represents the cardinal directions:
- * \verbatim
- .--.
- |__| .-------.
- |=.| |.-----.|
- |--| || ||
- | | |'-----'|
- |__|~')_____('
- [ COMPUTER ]
-
-
- North (0,-1)
- ^
- |
- |
- (-1,0) West <----[ HAPTIC ]----> East (1,0)
- |
- |
- v
- South (0,1)
-
-
- [ USER ]
- \|||/
- (o o)
- ---ooO-(_)-Ooo---
- \endverbatim
- *
- * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
- * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
- * the first \c dir parameter. The cardinal directions would be:
- * - North: 0 (0 degrees)
- * - East: 9000 (90 degrees)
- * - South: 18000 (180 degrees)
- * - West: 27000 (270 degrees)
- *
- * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
- * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
- * the first three \c dir parameters. The cardinal directions would be:
- * - North: 0,-1, 0
- * - East: 1, 0, 0
- * - South: 0, 1, 0
- * - West: -1, 0, 0
- *
- * The Z axis represents the height of the effect if supported, otherwise
- * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
- * can use any multiple you want, only the direction matters.
- *
- * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
- * The first two \c dir parameters are used. The \c dir parameters are as
- * follows (all values are in hundredths of degrees):
- * - Degrees from (1, 0) rotated towards (0, 1).
- * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
- *
- *
- * Example of force coming from the south with all encodings (force coming
- * from the south means the user will have to pull the stick to counteract):
- * \code
- * SDL_HapticDirection direction;
- *
- * // Cartesian directions
- * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
- * direction.dir[0] = 0; // X position
- * direction.dir[1] = 1; // Y position
- * // Assuming the device has 2 axes, we don't need to specify third parameter.
- *
- * // Polar directions
- * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
- * direction.dir[0] = 18000; // Polar only uses first parameter
- *
- * // Spherical coordinates
- * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
- * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
- * \endcode
- *
- * \sa SDL_HAPTIC_POLAR
- * \sa SDL_HAPTIC_CARTESIAN
- * \sa SDL_HAPTIC_SPHERICAL
- * \sa SDL_HapticEffect
- * \sa SDL_HapticNumAxes
- */
-typedef struct SDL_HapticDirection
-{
- Uint8 type; /**< The type of encoding. */
- Sint32 dir[3]; /**< The encoded direction. */
-} SDL_HapticDirection;
-
-
-/**
- * \brief A structure containing a template for a Constant effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
- *
- * A constant effect applies a constant force in the specified direction
- * to the joystick.
- *
- * \sa SDL_HAPTIC_CONSTANT
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticConstant
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Constant */
- Sint16 level; /**< Strength of the constant effect. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticConstant;
-
-/**
- * \brief A structure containing a template for a Periodic effect.
- *
- * The struct handles the following effects:
- * - ::SDL_HAPTIC_SINE
- * - ::SDL_HAPTIC_LEFTRIGHT
- * - ::SDL_HAPTIC_TRIANGLE
- * - ::SDL_HAPTIC_SAWTOOTHUP
- * - ::SDL_HAPTIC_SAWTOOTHDOWN
- *
- * A periodic effect consists in a wave-shaped effect that repeats itself
- * over time. The type determines the shape of the wave and the parameters
- * determine the dimensions of the wave.
- *
- * Phase is given by hundredth of a degree meaning that giving the phase a value
- * of 9000 will displace it 25% of its period. Here are sample values:
- * - 0: No phase displacement.
- * - 9000: Displaced 25% of its period.
- * - 18000: Displaced 50% of its period.
- * - 27000: Displaced 75% of its period.
- * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
- *
- * Examples:
- * \verbatim
- SDL_HAPTIC_SINE
- __ __ __ __
- / \ / \ / \ /
- / \__/ \__/ \__/
-
- SDL_HAPTIC_SQUARE
- __ __ __ __ __
- | | | | | | | | | |
- | |__| |__| |__| |__| |
-
- SDL_HAPTIC_TRIANGLE
- /\ /\ /\ /\ /\
- / \ / \ / \ / \ /
- / \/ \/ \/ \/
-
- SDL_HAPTIC_SAWTOOTHUP
- /| /| /| /| /| /| /|
- / | / | / | / | / | / | / |
- / |/ |/ |/ |/ |/ |/ |
-
- SDL_HAPTIC_SAWTOOTHDOWN
- \ |\ |\ |\ |\ |\ |\ |
- \ | \ | \ | \ | \ | \ | \ |
- \| \| \| \| \| \| \|
- \endverbatim
- *
- * \sa SDL_HAPTIC_SINE
- * \sa SDL_HAPTIC_LEFTRIGHT
- * \sa SDL_HAPTIC_TRIANGLE
- * \sa SDL_HAPTIC_SAWTOOTHUP
- * \sa SDL_HAPTIC_SAWTOOTHDOWN
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticPeriodic
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
- ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
- ::SDL_HAPTIC_SAWTOOTHDOWN */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Periodic */
- Uint16 period; /**< Period of the wave. */
- Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
- Sint16 offset; /**< Mean value of the wave. */
- Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticPeriodic;
-
-/**
- * \brief A structure containing a template for a Condition effect.
- *
- * The struct handles the following effects:
- * - ::SDL_HAPTIC_SPRING: Effect based on axes position.
- * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
- * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
- * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
- *
- * Direction is handled by condition internals instead of a direction member.
- * The condition effect specific members have three parameters. The first
- * refers to the X axis, the second refers to the Y axis and the third
- * refers to the Z axis. The right terms refer to the positive side of the
- * axis and the left terms refer to the negative side of the axis. Please
- * refer to the ::SDL_HapticDirection diagram for which side is positive and
- * which is negative.
- *
- * \sa SDL_HapticDirection
- * \sa SDL_HAPTIC_SPRING
- * \sa SDL_HAPTIC_DAMPER
- * \sa SDL_HAPTIC_INERTIA
- * \sa SDL_HAPTIC_FRICTION
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticCondition
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
- ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
- SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Condition */
- Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */
- Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */
- Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
- Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
- Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
- Sint16 center[3]; /**< Position of the dead zone. */
-} SDL_HapticCondition;
-
-/**
- * \brief A structure containing a template for a Ramp effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
- *
- * The ramp effect starts at start strength and ends at end strength.
- * It augments in linear fashion. If you use attack and fade with a ramp
- * the effects get added to the ramp effect making the effect become
- * quadratic instead of linear.
- *
- * \sa SDL_HAPTIC_RAMP
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticRamp
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_RAMP */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Ramp */
- Sint16 start; /**< Beginning strength level. */
- Sint16 end; /**< Ending strength level. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticRamp;
-
-/**
- * \brief A structure containing a template for a Left/Right effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
- *
- * The Left/Right effect is used to explicitly control the large and small
- * motors, commonly found in modern game controllers. One motor is high
- * frequency, the other is low frequency.
- *
- * \sa SDL_HAPTIC_LEFTRIGHT
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticLeftRight
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
-
- /* Rumble */
- Uint16 large_magnitude; /**< Control of the large controller motor. */
- Uint16 small_magnitude; /**< Control of the small controller motor. */
-} SDL_HapticLeftRight;
-
-/**
- * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
- *
- * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
- *
- * A custom force feedback effect is much like a periodic effect, where the
- * application can define its exact shape. You will have to allocate the
- * data yourself. Data should consist of channels * samples Uint16 samples.
- *
- * If channels is one, the effect is rotated using the defined direction.
- * Otherwise it uses the samples in data for the different axes.
- *
- * \sa SDL_HAPTIC_CUSTOM
- * \sa SDL_HapticEffect
- */
-typedef struct SDL_HapticCustom
-{
- /* Header */
- Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
- SDL_HapticDirection direction; /**< Direction of the effect. */
-
- /* Replay */
- Uint32 length; /**< Duration of the effect. */
- Uint16 delay; /**< Delay before starting the effect. */
-
- /* Trigger */
- Uint16 button; /**< Button that triggers the effect. */
- Uint16 interval; /**< How soon it can be triggered again after button. */
-
- /* Custom */
- Uint8 channels; /**< Axes to use, minimum of one. */
- Uint16 period; /**< Sample periods. */
- Uint16 samples; /**< Amount of samples. */
- Uint16 *data; /**< Should contain channels*samples items. */
-
- /* Envelope */
- Uint16 attack_length; /**< Duration of the attack. */
- Uint16 attack_level; /**< Level at the start of the attack. */
- Uint16 fade_length; /**< Duration of the fade. */
- Uint16 fade_level; /**< Level at the end of the fade. */
-} SDL_HapticCustom;
-
-/**
- * \brief The generic template for any haptic effect.
- *
- * All values max at 32767 (0x7FFF). Signed values also can be negative.
- * Time values unless specified otherwise are in milliseconds.
- *
- * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
- * value. Neither delay, interval, attack_length nor fade_length support
- * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
- *
- * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
- * ::SDL_HAPTIC_INFINITY.
- *
- * Button triggers may not be supported on all devices, it is advised to not
- * use them if possible. Buttons start at index 1 instead of index 0 like
- * the joystick.
- *
- * If both attack_length and fade_level are 0, the envelope is not used,
- * otherwise both values are used.
- *
- * Common parts:
- * \code
- * // Replay - All effects have this
- * Uint32 length; // Duration of effect (ms).
- * Uint16 delay; // Delay before starting effect.
- *
- * // Trigger - All effects have this
- * Uint16 button; // Button that triggers effect.
- * Uint16 interval; // How soon before effect can be triggered again.
- *
- * // Envelope - All effects except condition effects have this
- * Uint16 attack_length; // Duration of the attack (ms).
- * Uint16 attack_level; // Level at the start of the attack.
- * Uint16 fade_length; // Duration of the fade out (ms).
- * Uint16 fade_level; // Level at the end of the fade.
- * \endcode
- *
- *
- * Here we have an example of a constant effect evolution in time:
- * \verbatim
- Strength
- ^
- |
- | effect level --> _________________
- | / \
- | / \
- | / \
- | / \
- | attack_level --> | \
- | | | <--- fade_level
- |
- +--------------------------------------------------> Time
- [--] [---]
- attack_length fade_length
-
- [------------------][-----------------------]
- delay length
- \endverbatim
- *
- * Note either the attack_level or the fade_level may be above the actual
- * effect level.
- *
- * \sa SDL_HapticConstant
- * \sa SDL_HapticPeriodic
- * \sa SDL_HapticCondition
- * \sa SDL_HapticRamp
- * \sa SDL_HapticLeftRight
- * \sa SDL_HapticCustom
- */
-typedef union SDL_HapticEffect
-{
- /* Common for all force feedback effects */
- Uint16 type; /**< Effect type. */
- SDL_HapticConstant constant; /**< Constant effect. */
- SDL_HapticPeriodic periodic; /**< Periodic effect. */
- SDL_HapticCondition condition; /**< Condition effect. */
- SDL_HapticRamp ramp; /**< Ramp effect. */
- SDL_HapticLeftRight leftright; /**< Left/Right effect. */
- SDL_HapticCustom custom; /**< Custom effect. */
-} SDL_HapticEffect;
-
-
-/* Function prototypes */
-/**
- * \brief Count the number of haptic devices attached to the system.
- *
- * \return Number of haptic devices detected on the system.
- */
-extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
-
-/**
- * \brief Get the implementation dependent name of a haptic device.
- *
- * This can be called before any joysticks are opened.
- * If no name can be found, this function returns NULL.
- *
- * \param device_index Index of the device to get its name.
- * \return Name of the device or NULL on error.
- *
- * \sa SDL_NumHaptics
- */
-extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
-
-/**
- * \brief Opens a haptic device for use.
- *
- * The index passed as an argument refers to the N'th haptic device on this
- * system.
- *
- * When opening a haptic device, its gain will be set to maximum and
- * autocenter will be disabled. To modify these values use
- * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
- *
- * \param device_index Index of the device to open.
- * \return Device identifier or NULL on error.
- *
- * \sa SDL_HapticIndex
- * \sa SDL_HapticOpenFromMouse
- * \sa SDL_HapticOpenFromJoystick
- * \sa SDL_HapticClose
- * \sa SDL_HapticSetGain
- * \sa SDL_HapticSetAutocenter
- * \sa SDL_HapticPause
- * \sa SDL_HapticStopAll
- */
-extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
-
-/**
- * \brief Checks if the haptic device at index has been opened.
- *
- * \param device_index Index to check to see if it has been opened.
- * \return 1 if it has been opened or 0 if it hasn't.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticIndex
- */
-extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
-
-/**
- * \brief Gets the index of a haptic device.
- *
- * \param haptic Haptic device to get the index of.
- * \return The index of the haptic device or -1 on error.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticOpened
- */
-extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
-
-/**
- * \brief Gets whether or not the current mouse has haptic capabilities.
- *
- * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
- *
- * \sa SDL_HapticOpenFromMouse
- */
-extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
-
-/**
- * \brief Tries to open a haptic device from the current mouse.
- *
- * \return The haptic device identifier or NULL on error.
- *
- * \sa SDL_MouseIsHaptic
- * \sa SDL_HapticOpen
- */
-extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
-
-/**
- * \brief Checks to see if a joystick has haptic features.
- *
- * \param joystick Joystick to test for haptic capabilities.
- * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
- * or -1 if an error occurred.
- *
- * \sa SDL_HapticOpenFromJoystick
- */
-extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
-
-/**
- * \brief Opens a haptic device for use from a joystick device.
- *
- * You must still close the haptic device separately. It will not be closed
- * with the joystick.
- *
- * When opening from a joystick you should first close the haptic device before
- * closing the joystick device. If not, on some implementations the haptic
- * device will also get unallocated and you'll be unable to use force feedback
- * on that device.
- *
- * \param joystick Joystick to create a haptic device from.
- * \return A valid haptic device identifier on success or NULL on error.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticClose
- */
-extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
- joystick);
-
-/**
- * \brief Closes a haptic device previously opened with SDL_HapticOpen().
- *
- * \param haptic Haptic device to close.
- */
-extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
-
-/**
- * \brief Returns the number of effects a haptic device can store.
- *
- * On some platforms this isn't fully supported, and therefore is an
- * approximation. Always check to see if your created effect was actually
- * created and do not rely solely on SDL_HapticNumEffects().
- *
- * \param haptic The haptic device to query effect max.
- * \return The number of effects the haptic device can store or
- * -1 on error.
- *
- * \sa SDL_HapticNumEffectsPlaying
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
-
-/**
- * \brief Returns the number of effects a haptic device can play at the same
- * time.
- *
- * This is not supported on all platforms, but will always return a value.
- * Added here for the sake of completeness.
- *
- * \param haptic The haptic device to query maximum playing effects.
- * \return The number of effects the haptic device can play at the same time
- * or -1 on error.
- *
- * \sa SDL_HapticNumEffects
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
-
-/**
- * \brief Gets the haptic device's supported features in bitwise manner.
- *
- * Example:
- * \code
- * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- * printf("We have constant haptic effect!\n");
- * }
- * \endcode
- *
- * \param haptic The haptic device to query.
- * \return Haptic features in bitwise manner (OR'd).
- *
- * \sa SDL_HapticNumEffects
- * \sa SDL_HapticEffectSupported
- */
-extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
-
-
-/**
- * \brief Gets the number of haptic axes the device has.
- *
- * \sa SDL_HapticDirection
- */
-extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
-
-/**
- * \brief Checks to see if effect is supported by haptic.
- *
- * \param haptic Haptic device to check on.
- * \param effect Effect to check to see if it is supported.
- * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
- *
- * \sa SDL_HapticQuery
- * \sa SDL_HapticNewEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
- SDL_HapticEffect *
- effect);
-
-/**
- * \brief Creates a new haptic effect on the device.
- *
- * \param haptic Haptic device to create the effect on.
- * \param effect Properties of the effect to create.
- * \return The identifier of the effect on success or -1 on error.
- *
- * \sa SDL_HapticUpdateEffect
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticDestroyEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
- SDL_HapticEffect * effect);
-
-/**
- * \brief Updates the properties of an effect.
- *
- * Can be used dynamically, although behavior when dynamically changing
- * direction may be strange. Specifically the effect may reupload itself
- * and start playing from the start. You cannot change the type either when
- * running SDL_HapticUpdateEffect().
- *
- * \param haptic Haptic device that has the effect.
- * \param effect Identifier of the effect to update.
- * \param data New effect properties to use.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticNewEffect
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticDestroyEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
- int effect,
- SDL_HapticEffect * data);
-
-/**
- * \brief Runs the haptic effect on its associated haptic device.
- *
- * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
- * repeating the envelope (attack and fade) every time. If you only want the
- * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
- * parameter.
- *
- * \param haptic Haptic device to run the effect on.
- * \param effect Identifier of the haptic effect to run.
- * \param iterations Number of iterations to run the effect. Use
- * ::SDL_HAPTIC_INFINITY for infinity.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticStopEffect
- * \sa SDL_HapticDestroyEffect
- * \sa SDL_HapticGetEffectStatus
- */
-extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
- int effect,
- Uint32 iterations);
-
-/**
- * \brief Stops the haptic effect on its associated haptic device.
- *
- * \param haptic Haptic device to stop the effect on.
- * \param effect Identifier of the effect to stop.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticDestroyEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
- int effect);
-
-/**
- * \brief Destroys a haptic effect on the device.
- *
- * This will stop the effect if it's running. Effects are automatically
- * destroyed when the device is closed.
- *
- * \param haptic Device to destroy the effect on.
- * \param effect Identifier of the effect to destroy.
- *
- * \sa SDL_HapticNewEffect
- */
-extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
- int effect);
-
-/**
- * \brief Gets the status of the current effect on the haptic device.
- *
- * Device must support the ::SDL_HAPTIC_STATUS feature.
- *
- * \param haptic Haptic device to query the effect status on.
- * \param effect Identifier of the effect to query its status.
- * \return 0 if it isn't playing, 1 if it is playing or -1 on error.
- *
- * \sa SDL_HapticRunEffect
- * \sa SDL_HapticStopEffect
- */
-extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
- int effect);
-
-/**
- * \brief Sets the global gain of the device.
- *
- * Device must support the ::SDL_HAPTIC_GAIN feature.
- *
- * The user may specify the maximum gain by setting the environment variable
- * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
- * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
- * maximum.
- *
- * \param haptic Haptic device to set the gain on.
- * \param gain Value to set the gain to, should be between 0 and 100.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
-
-/**
- * \brief Sets the global autocenter of the device.
- *
- * Autocenter should be between 0 and 100. Setting it to 0 will disable
- * autocentering.
- *
- * Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
- *
- * \param haptic Haptic device to set autocentering on.
- * \param autocenter Value to set autocenter to, 0 disables autocentering.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticQuery
- */
-extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
- int autocenter);
-
-/**
- * \brief Pauses a haptic device.
- *
- * Device must support the ::SDL_HAPTIC_PAUSE feature. Call
- * SDL_HapticUnpause() to resume playback.
- *
- * Do not modify the effects nor add new ones while the device is paused.
- * That can cause all sorts of weird errors.
- *
- * \param haptic Haptic device to pause.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticUnpause
- */
-extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
-
-/**
- * \brief Unpauses a haptic device.
- *
- * Call to unpause after SDL_HapticPause().
- *
- * \param haptic Haptic device to unpause.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticPause
- */
-extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
-
-/**
- * \brief Stops all the currently playing effects on a haptic device.
- *
- * \param haptic Haptic device to stop.
- * \return 0 on success or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
-
-/**
- * \brief Checks to see if rumble is supported on a haptic device.
- *
- * \param haptic Haptic device to check to see if it supports rumble.
- * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
- *
- * \sa SDL_HapticRumbleInit
- * \sa SDL_HapticRumblePlay
- * \sa SDL_HapticRumbleStop
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
-
-/**
- * \brief Initializes the haptic device for simple rumble playback.
- *
- * \param haptic Haptic device to initialize for simple rumble playback.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticOpen
- * \sa SDL_HapticRumbleSupported
- * \sa SDL_HapticRumblePlay
- * \sa SDL_HapticRumbleStop
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
-
-/**
- * \brief Runs simple rumble on a haptic device
- *
- * \param haptic Haptic device to play rumble effect on.
- * \param strength Strength of the rumble to play as a 0-1 float value.
- * \param length Length of the rumble to play in milliseconds.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticRumbleSupported
- * \sa SDL_HapticRumbleInit
- * \sa SDL_HapticRumbleStop
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
-
-/**
- * \brief Stops the simple rumble on a haptic device.
- *
- * \param haptic Haptic to stop the rumble on.
- * \return 0 on success or -1 on error.
- *
- * \sa SDL_HapticRumbleSupported
- * \sa SDL_HapticRumbleInit
- * \sa SDL_HapticRumblePlay
- */
-extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_haptic_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_hints.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_hints.h
deleted file mode 100644
index 007a4be..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_hints.h
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_hints.h
- *
- * Official documentation for SDL configuration variables
- *
- * This file contains functions to set and get configuration hints,
- * as well as listing each of them alphabetically.
- *
- * The convention for naming hints is SDL_HINT_X, where "SDL_X" is
- * the environment variable that can be used to override the default.
- *
- * In general these hints are just that - they may or may not be
- * supported or applicable on any given platform, but they provide
- * a way for an application or user to give the library a hint as
- * to how they would like the library to work.
- */
-
-#ifndef SDL_hints_h_
-#define SDL_hints_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
- *
- * SDL can try to accelerate the SDL screen surface by using streaming
- * textures with a 3D rendering engine. This variable controls whether and
- * how this is done.
- *
- * This variable can be set to the following values:
- * "0" - Disable 3D acceleration
- * "1" - Enable 3D acceleration, using the default renderer.
- * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
- *
- * By default SDL tries to make a best guess for each platform whether
- * to use acceleration or not.
- */
-#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
-
-/**
- * \brief A variable specifying which render driver to use.
- *
- * If the application doesn't pick a specific renderer to use, this variable
- * specifies the name of the preferred renderer. If the preferred renderer
- * can't be initialized, the normal default renderer is used.
- *
- * This variable is case insensitive and can be set to the following values:
- * "direct3d"
- * "opengl"
- * "opengles2"
- * "opengles"
- * "software"
- *
- * The default varies by platform, but it's the first one in the list that
- * is available on the current platform.
- */
-#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
-
-/**
- * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
- *
- * This variable can be set to the following values:
- * "0" - Disable shaders
- * "1" - Enable shaders
- *
- * By default shaders are used if OpenGL supports them.
- */
-#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
-
-/**
- * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations.
- *
- * This variable can be set to the following values:
- * "0" - Thread-safety is not enabled (faster)
- * "1" - Thread-safety is enabled
- *
- * By default the Direct3D device is created with thread-safety disabled.
- */
-#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
-
-/**
- * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer.
- *
- * This variable does not have any effect on the Direct3D 9 based renderer.
- *
- * This variable can be set to the following values:
- * "0" - Disable Debug Layer use
- * "1" - Enable Debug Layer use
- *
- * By default, SDL does not use Direct3D Debug Layer.
- */
-#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
-
-/**
- * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
- *
- * This variable can be set to the following values:
- * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
- * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
- *
- * By default letterbox is used
- */
-#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
-
-/**
- * \brief A variable controlling the scaling quality
- *
- * This variable can be set to the following values:
- * "0" or "nearest" - Nearest pixel sampling
- * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
- * "2" or "best" - Currently this is the same as "linear"
- *
- * By default nearest pixel sampling is used
- */
-#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
-
-/**
- * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
- *
- * This variable can be set to the following values:
- * "0" - Disable vsync
- * "1" - Enable vsync
- *
- * By default SDL does not sync screen surface updates with vertical refresh.
- */
-#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
-
-/**
- * \brief A variable controlling whether the screensaver is enabled.
- *
- * This variable can be set to the following values:
- * "0" - Disable screensaver
- * "1" - Enable screensaver
- *
- * By default SDL will disable the screensaver.
- */
-#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
-
-/**
- * \brief A variable controlling whether the X11 VidMode extension should be used.
- *
- * This variable can be set to the following values:
- * "0" - Disable XVidMode
- * "1" - Enable XVidMode
- *
- * By default SDL will use XVidMode if it is available.
- */
-#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE"
-
-/**
- * \brief A variable controlling whether the X11 Xinerama extension should be used.
- *
- * This variable can be set to the following values:
- * "0" - Disable Xinerama
- * "1" - Enable Xinerama
- *
- * By default SDL will use Xinerama if it is available.
- */
-#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA"
-
-/**
- * \brief A variable controlling whether the X11 XRandR extension should be used.
- *
- * This variable can be set to the following values:
- * "0" - Disable XRandR
- * "1" - Enable XRandR
- *
- * By default SDL will not use XRandR because of window manager issues.
- */
-#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
-
-/**
- * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
- *
- * This variable can be set to the following values:
- * "0" - Disable _NET_WM_PING
- * "1" - Enable _NET_WM_PING
- *
- * By default SDL will use _NET_WM_PING, but for applications that know they
- * will not always be able to respond to ping requests in a timely manner they can
- * turn it off to avoid the window manager thinking the app is hung.
- * The hint is checked in CreateWindow.
- */
-#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
-
-/**
- * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
- *
- * This variable can be set to the following values:
- * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
- * "1" - The window frame is interactive when the cursor is hidden
- *
- * By default SDL will allow interaction with the window frame when the cursor is hidden
- */
-#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
-
-/**
- * \brief A variable to specify custom icon resource id from RC file on Windows platform
- */
-#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
-#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
-
-/**
- * \brief A variable controlling whether the windows message loop is processed by SDL
- *
- * This variable can be set to the following values:
- * "0" - The window message loop is not run
- * "1" - The window message loop is processed in SDL_PumpEvents()
- *
- * By default SDL will process the windows message loop
- */
-#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP"
-
-/**
- * \brief A variable controlling whether grabbing input grabs the keyboard
- *
- * This variable can be set to the following values:
- * "0" - Grab will affect only the mouse
- * "1" - Grab will affect mouse and keyboard
- *
- * By default SDL will not grab the keyboard so system shortcuts still work.
- */
-#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
-
-/**
- * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
- */
-#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
-
-/**
- * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
- */
-#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
-
-/**
- * \brief A variable controlling whether relative mouse mode is implemented using mouse warping
- *
- * This variable can be set to the following values:
- * "0" - Relative mouse mode uses raw input
- * "1" - Relative mouse mode uses mouse warping
- *
- * By default SDL will use raw input for relative mouse mode
- */
-#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP"
-
-/**
- * \brief Allow mouse click events when clicking to focus an SDL window
- *
- * This variable can be set to the following values:
- * "0" - Ignore mouse clicks that activate a window
- * "1" - Generate events for mouse clicks that activate a window
- *
- * By default SDL will ignore mouse clicks that activate a window
- */
-#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
-
-/**
- * \brief A variable controlling whether touch events should generate synthetic mouse events
- *
- * This variable can be set to the following values:
- * "0" - Touch events will not generate mouse events
- * "1" - Touch events will generate mouse events
- *
- * By default SDL will generate mouse events for touch events
- */
-#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
-
-/**
- * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
- *
- */
-#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
-
-/**
- * \brief A variable controlling whether the idle timer is disabled on iOS.
- *
- * When an iOS app does not receive touches for some time, the screen is
- * dimmed automatically. For games where the accelerometer is the only input
- * this is problematic. This functionality can be disabled by setting this
- * hint.
- *
- * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver()
- * accomplish the same thing on iOS. They should be preferred over this hint.
- *
- * This variable can be set to the following values:
- * "0" - Enable idle timer
- * "1" - Disable idle timer
- */
-#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
-
-/**
- * \brief A variable controlling which orientations are allowed on iOS.
- *
- * In some circumstances it is necessary to be able to explicitly control
- * which UI orientations are allowed.
- *
- * This variable is a space delimited list of the following values:
- * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
- */
-#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
-
-/**
- * \brief A variable controlling whether controllers used with the Apple TV
- * generate UI events.
- *
- * When UI events are generated by controller input, the app will be
- * backgrounded when the Apple TV remote's menu button is pressed, and when the
- * pause or B buttons on gamepads are pressed.
- *
- * More information about properly making use of controllers for the Apple TV
- * can be found here:
- * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/
- *
- * This variable can be set to the following values:
- * "0" - Controller input does not generate UI events (the default).
- * "1" - Controller input generates UI events.
- */
-#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"
-
-/**
- * \brief A variable controlling whether the Apple TV remote's joystick axes
- * will automatically match the rotation of the remote.
- *
- * This variable can be set to the following values:
- * "0" - Remote orientation does not affect joystick axes (the default).
- * "1" - Joystick axes are based on the orientation of the remote.
- */
-#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
-
-/**
- * \brief A variable controlling whether the Android / iOS built-in
- * accelerometer should be listed as a joystick device, rather than listing
- * actual joysticks only.
- *
- * This variable can be set to the following values:
- * "0" - List only real joysticks and accept input from them
- * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
- */
-#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
-
-/**
- * \brief A variable that lets you disable the detection and use of Xinput gamepad devices
- *
- * The variable can be set to the following values:
- * "0" - Disable XInput detection (only uses direct input)
- * "1" - Enable XInput detection (the default)
- */
-#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
-
-/**
- * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
- *
- * This hint is for backwards compatibility only and will be removed in SDL 2.1
- *
- * The default value is "0". This hint must be set before SDL_Init()
- */
-#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
-
-/**
- * \brief A variable that lets you manually hint extra gamecontroller db entries.
- *
- * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
- *
- * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
- * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
- */
-#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
-
-/**
- * \brief A variable containing a list of devices to skip when scanning for game controllers.
- *
- * The format of the string is a comma separated list of USB VID/PID pairs
- * in hexadecimal form, e.g.
- *
- * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
- *
- * The variable can also take the form of @file, in which case the named
- * file will be loaded and interpreted as the value of the variable.
- */
-#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
-
-/**
- * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
- *
- * The format of the string is a comma separated list of USB VID/PID pairs
- * in hexadecimal form, e.g.
- *
- * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
- *
- * The variable can also take the form of @file, in which case the named
- * file will be loaded and interpreted as the value of the variable.
- */
-#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
-
-/**
- * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
- *
- * The variable can be set to the following values:
- * "0" - Disable joystick & gamecontroller input events when the
- * application is in the background.
- * "1" - Enable joystick & gamecontroller input events when the
- * application is in the background.
- *
- * The default value is "0". This hint may be set at any time.
- */
-#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
-
-/**
- * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
- * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
- *
- * This variable can be set to the following values:
- * "0" - don't allow topmost
- * "1" - allow topmost
- */
-#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
-
-/**
- * \brief A variable that controls the timer resolution, in milliseconds.
- *
- * The higher resolution the timer, the more frequently the CPU services
- * timer interrupts, and the more precise delays are, but this takes up
- * power and CPU time. This hint is only used on Windows 7 and earlier.
- *
- * See this blog post for more information:
- * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
- *
- * If this variable is set to "0", the system timer resolution is not set.
- *
- * The default value is "1". This hint may be set at any time.
- */
-#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
-
-
-/**
- * \brief A variable describing the content orientation on QtWayland-based platforms.
- *
- * On QtWayland platforms, windows are rotated client-side to allow for custom
- * transitions. In order to correctly position overlays (e.g. volume bar) and
- * gestures (e.g. events view, close/minimize gestures), the system needs to
- * know in which orientation the application is currently drawing its contents.
- *
- * This does not cause the window to be rotated or resized, the application
- * needs to take care of drawing the content in the right orientation (the
- * framebuffer is always in portrait mode).
- *
- * This variable can be one of the following values:
- * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
- */
-#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
-
-/**
- * \brief Flags to set on QtWayland windows to integrate with the native window manager.
- *
- * On QtWayland platforms, this hint controls the flags to set on the windows.
- * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
- *
- * This variable is a space-separated list of the following values (empty = no flags):
- * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
- */
-#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
-
-/**
-* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
-*
-* Use this hint in case you need to set SDL's threads stack size to other than the default.
-* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
-* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
-* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
-*/
-#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
-
-/**
- * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
- */
-#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
-
-/**
- * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac
- *
- * If present, holding ctrl while left clicking will generate a right click
- * event when on Mac.
- */
-#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
-
-/**
-* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
-*
-* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It
-* can use two different sets of binaries, those compiled by the user from source
-* or those provided by the Chrome browser. In the later case, these binaries require
-* that SDL loads a DLL providing the shader compiler.
-*
-* This variable can be set to the following values:
-* "d3dcompiler_46.dll" - default, best for Vista or later.
-* "d3dcompiler_43.dll" - for XP support.
-* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.
-*
-*/
-#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER"
-
-/**
-* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
-*
-* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
-* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
-* created SDL_Window:
-*
-* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
-* needed for example when sharing an OpenGL context across multiple windows.
-*
-* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for
-* OpenGL rendering.
-*
-* This variable can be set to the following values:
-* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should
-* share a pixel format with.
-*/
-#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
-
-/**
- * \brief A URL to a WinRT app's privacy policy
- *
- * All network-enabled WinRT apps must make a privacy policy available to its
- * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
- * be available in the Windows Settings charm, as accessed from within the app.
- * SDL provides code to add a URL-based link there, which can point to the app's
- * privacy policy.
- *
- * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
- * before calling any SDL_Init() functions. The contents of the hint should
- * be a valid URL. For example, "http://www.example.com".
- *
- * The default value is "", which will prevent SDL from adding a privacy policy
- * link to the Settings charm. This hint should only be set during app init.
- *
- * The label text of an app's "Privacy Policy" link may be customized via another
- * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
- *
- * Please note that on Windows Phone, Microsoft does not provide standard UI
- * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
- * will not get used on that platform. Network-enabled phone apps should display
- * their privacy policy through some other, in-app means.
- */
-#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
-
-/** \brief Label text for a WinRT app's privacy policy link
- *
- * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
- * Microsoft mandates that this policy be available via the Windows Settings charm.
- * SDL provides code to add a link there, with its label text being set via the
- * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
- *
- * Please note that a privacy policy's contents are not set via this hint. A separate
- * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
- * policy.
- *
- * The contents of this hint should be encoded as a UTF8 string.
- *
- * The default value is "Privacy Policy". This hint should only be set during app
- * initialization, preferably before any calls to SDL_Init().
- *
- * For additional information on linking to a privacy policy, see the documentation for
- * SDL_HINT_WINRT_PRIVACY_POLICY_URL.
- */
-#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
-
-/** \brief Allows back-button-press events on Windows Phone to be marked as handled
- *
- * Windows Phone devices typically feature a Back button. When pressed,
- * the OS will emit back-button-press events, which apps are expected to
- * handle in an appropriate manner. If apps do not explicitly mark these
- * events as 'Handled', then the OS will invoke its default behavior for
- * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
- * terminate the app (and attempt to switch to the previous app, or to the
- * device's home screen).
- *
- * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
- * to mark back-button-press events as Handled, if and when one is sent to
- * the app.
- *
- * Internally, Windows Phone sends back button events as parameters to
- * special back-button-press callback functions. Apps that need to respond
- * to back-button-press events are expected to register one or more
- * callback functions for such, shortly after being launched (during the
- * app's initialization phase). After the back button is pressed, the OS
- * will invoke these callbacks. If the app's callback(s) do not explicitly
- * mark the event as handled by the time they return, or if the app never
- * registers one of these callback, the OS will consider the event
- * un-handled, and it will apply its default back button behavior (terminate
- * the app).
- *
- * SDL registers its own back-button-press callback with the Windows Phone
- * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
- * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
- * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
- * If the hint's value is set to "1", the back button event's Handled
- * property will get set to 'true'. If the hint's value is set to something
- * else, or if it is unset, SDL will leave the event's Handled property
- * alone. (By default, the OS sets this property to 'false', to note.)
- *
- * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
- * back button is pressed, or can set it in direct-response to a back button
- * being pressed.
- *
- * In order to get notified when a back button is pressed, SDL apps should
- * register a callback function with SDL_AddEventWatch(), and have it listen
- * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
- * (Alternatively, SDL_KEYUP events can be listened-for. Listening for
- * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
- * set by such a callback, will be applied to the OS' current
- * back-button-press event.
- *
- * More details on back button behavior in Windows Phone apps can be found
- * at the following page, on Microsoft's developer site:
- * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
- */
-#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
-
-/**
- * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X.
- *
- * This hint only applies to Mac OS X.
- *
- * The variable can be set to the following values:
- * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and
- * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen"
- * button on their titlebars).
- * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and
- * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
- * button on their titlebars).
- *
- * The default value is "1". Spaces are disabled regardless of this hint if
- * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
- * any windows are created.
- */
-#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
-
-/**
-* \brief When set don't force the SDL app to become a foreground process
-*
-* This hint only applies to Mac OS X.
-*
-*/
-#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
-
-/**
- * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
- *
- * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
- *
- * If both hints were set then SDL_RWFromFile() will look into expansion files
- * after a given relative path was not found in the internal storage and assets.
- *
- * By default this hint is not set and the APK expansion files are not searched.
- */
-#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
-
-/**
- * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
- *
- * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
- *
- * If both hints were set then SDL_RWFromFile() will look into expansion files
- * after a given relative path was not found in the internal storage and assets.
- *
- * By default this hint is not set and the APK expansion files are not searched.
- */
-#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
-
-/**
- * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
- *
- * The variable can be set to the following values:
- * "0" - SDL_TEXTEDITING events are sent, and it is the application's
- * responsibility to render the text from these events and
- * differentiate it somehow from committed text. (default)
- * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
- * and text that is being composed will be rendered in its own UI.
- */
-#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
-
- /**
- * \brief A variable to control whether mouse and touch events are to be treated together or separately
- *
- * The variable can be set to the following values:
- * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
- * events. This is the behaviour of SDL <= 2.0.3. (default)
- * "1" - Mouse events will be handled separately from pure touch events.
- *
- * The value of this hint is used at runtime, so it can be changed at any time.
- */
-#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
-
-/**
- * \brief override the binding element for keyboard inputs for Emscripten builds
- *
- * This hint only applies to the emscripten platform
- *
- * The variable can be one of
- * "#window" - The javascript window object (this is the default)
- * "#document" - The javascript document object
- * "#screen" - the javascript window.screen object
- * "#canvas" - the WebGL canvas element
- * any other string without a leading # sign applies to the element on the page with that ID.
- */
-#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
-
-/**
- * \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
- *
- * This hint only applies to Unix-like platforms.
- *
- * The variable can be set to the following values:
- * "0" - SDL will install a SIGINT and SIGTERM handler, and when it
- * catches a signal, convert it into an SDL_QUIT event.
- * "1" - SDL will not install a signal handler at all.
- */
-#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
-
-/**
- * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
- *
- * The variable can be set to the following values:
- * "0" - SDL will generate a window-close event when it sees Alt+F4.
- * "1" - SDL will only do normal key handling for Alt+F4.
- */
-#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
-
-/**
- * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
- *
- * The bitmap header version 4 is required for proper alpha channel support and
- * SDL will use it when required. Should this not be desired, this hint can
- * force the use of the 40 byte header version which is supported everywhere.
- *
- * The variable can be set to the following values:
- * "0" - Surfaces with a colorkey or an alpha channel are saved to a
- * 32-bit BMP file with an alpha mask. SDL will use the bitmap
- * header version 4 and set the alpha mask accordingly.
- * "1" - Surfaces with a colorkey or an alpha channel are saved to a
- * 32-bit BMP file without an alpha mask. The alpha channel data
- * will be in the file, but applications are going to ignore it.
- *
- * The default value is "0".
- */
-#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
-
-/**
- * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
- * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
- * thread's name, but it tends to cause problems with other debuggers,
- * and the .NET runtime. Note that SDL 2.0.6 and later will still use
- * the (safer) SetThreadDescription API, introduced in the Windows 10
- * Creators Update, if available.
- *
- * The variable can be set to the following values:
- * "0" - SDL will raise the 0x406D1388 Exception to name threads.
- * This is the default behavior of SDL <= 2.0.4.
- * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
- * This is necessary with .NET languages or debuggers that aren't Visual Studio.
- */
-#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
-
-/**
- * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI
- *
- * Also known as Z-order. The variable can take a negative or positive value.
- * The default is 10000.
- */
-#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
-
-/**
- * \brief A variable controlling what driver to use for OpenGL ES contexts.
- *
- * On some platforms, currently Windows and X11, OpenGL drivers may support
- * creating contexts with an OpenGL ES profile. By default SDL uses these
- * profiles, when available, otherwise it attempts to load an OpenGL ES
- * library, e.g. that provided by the ANGLE project. This variable controls
- * whether SDL follows this default behaviour or will always load an
- * OpenGL ES library.
- *
- * Circumstances where this is useful include
- * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
- * or emulator, e.g. those from ARM, Imagination or Qualcomm.
- * - Resolving OpenGL ES function addresses at link time by linking with
- * the OpenGL ES library instead of querying them at run time with
- * SDL_GL_GetProcAddress().
- *
- * Caution: for an application to work with the default behaviour across
- * different OpenGL drivers it must query the OpenGL ES function
- * addresses at run time using SDL_GL_GetProcAddress().
- *
- * This variable is ignored on most platforms because OpenGL ES is native
- * or not supported.
- *
- * This variable can be set to the following values:
- * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
- * "1" - Load OpenGL ES library using the default library names.
- *
- */
-#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
-
-/**
- * \brief A variable controlling speed/quality tradeoff of audio resampling.
- *
- * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
- * to handle audio resampling. There are different resampling modes available
- * that produce different levels of quality, using more CPU.
- *
- * If this hint isn't specified to a valid setting, or libsamplerate isn't
- * available, SDL will use the default, internal resampling algorithm.
- *
- * Note that this is currently only applicable to resampling audio that is
- * being written to a device for playback or audio being read from a device
- * for capture. SDL_AudioCVT always uses the default resampler (although this
- * might change for SDL 2.1).
- *
- * This hint is currently only checked at audio subsystem initialization.
- *
- * This variable can be set to the following values:
- *
- * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
- * "1" or "fast" - Use fast, slightly higher quality resampling, if available
- * "2" or "medium" - Use medium quality resampling, if available
- * "3" or "best" - Use high quality resampling, if available
- */
-#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
-
-/**
- * \brief A variable controlling the audio category on iOS and Mac OS X
- *
- * This variable can be set to the following values:
- *
- * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
- * "playback" - Use the AVAudioSessionCategoryPlayback category
- *
- * For more information, see Apple's documentation:
- * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
- */
-#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
-
-/**
- * \brief An enumeration of hint priorities
- */
-typedef enum
-{
- SDL_HINT_DEFAULT,
- SDL_HINT_NORMAL,
- SDL_HINT_OVERRIDE
-} SDL_HintPriority;
-
-
-/**
- * \brief Set a hint with a specific priority
- *
- * The priority controls the behavior when setting a hint that already
- * has a value. Hints will replace existing hints of their priority and
- * lower. Environment variables are considered to have override priority.
- *
- * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
- const char *value,
- SDL_HintPriority priority);
-
-/**
- * \brief Set a hint with normal priority
- *
- * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
- const char *value);
-
-/**
- * \brief Get a hint
- *
- * \return The string value of a hint variable.
- */
-extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
-
-/**
- * \brief Get a hint
- *
- * \return The boolean value of a hint variable.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
-
-/**
- * \brief type definition of the hint callback function.
- */
-typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
-
-/**
- * \brief Add a function to watch a particular hint
- *
- * \param name The hint to watch
- * \param callback The function to call when the hint value changes
- * \param userdata A pointer to pass to the callback function
- */
-extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
- SDL_HintCallback callback,
- void *userdata);
-
-/**
- * \brief Remove a function watching a particular hint
- *
- * \param name The hint being watched
- * \param callback The function being called when the hint value changes
- * \param userdata A pointer being passed to the callback function
- */
-extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
- SDL_HintCallback callback,
- void *userdata);
-
-/**
- * \brief Clear all hints
- *
- * This function is called during SDL_Quit() to free stored hints.
- */
-extern DECLSPEC void SDLCALL SDL_ClearHints(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_hints_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_joystick.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_joystick.h
deleted file mode 100644
index f598dc8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_joystick.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_joystick.h
- *
- * Include file for SDL joystick event handling
- *
- * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
- * behind a device_index changing as joysticks are plugged and unplugged.
- *
- * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
- * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
- *
- * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
- * the device (a X360 wired controller for example). This identifier is platform dependent.
- *
- *
- */
-
-#ifndef SDL_joystick_h_
-#define SDL_joystick_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_joystick.h
- *
- * In order to use these functions, SDL_Init() must have been called
- * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
- * for joysticks, and load appropriate drivers.
- *
- * If you would like to receive joystick updates while the application
- * is in the background, you should set the following hint before calling
- * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
- */
-
-/**
- * The joystick structure used to identify an SDL joystick
- */
-struct _SDL_Joystick;
-typedef struct _SDL_Joystick SDL_Joystick;
-
-/* A structure that encodes the stable unique id for a joystick device */
-typedef struct {
- Uint8 data[16];
-} SDL_JoystickGUID;
-
-/**
- * This is a unique ID for a joystick for the time it is connected to the system,
- * and is never reused for the lifetime of the application. If the joystick is
- * disconnected and reconnected, it will get a new ID.
- *
- * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
- */
-typedef Sint32 SDL_JoystickID;
-
-typedef enum
-{
- SDL_JOYSTICK_TYPE_UNKNOWN,
- SDL_JOYSTICK_TYPE_GAMECONTROLLER,
- SDL_JOYSTICK_TYPE_WHEEL,
- SDL_JOYSTICK_TYPE_ARCADE_STICK,
- SDL_JOYSTICK_TYPE_FLIGHT_STICK,
- SDL_JOYSTICK_TYPE_DANCE_PAD,
- SDL_JOYSTICK_TYPE_GUITAR,
- SDL_JOYSTICK_TYPE_DRUM_KIT,
- SDL_JOYSTICK_TYPE_ARCADE_PAD,
- SDL_JOYSTICK_TYPE_THROTTLE
-} SDL_JoystickType;
-
-typedef enum
-{
- SDL_JOYSTICK_POWER_UNKNOWN = -1,
- SDL_JOYSTICK_POWER_EMPTY,
- SDL_JOYSTICK_POWER_LOW,
- SDL_JOYSTICK_POWER_MEDIUM,
- SDL_JOYSTICK_POWER_FULL,
- SDL_JOYSTICK_POWER_WIRED,
- SDL_JOYSTICK_POWER_MAX
-} SDL_JoystickPowerLevel;
-
-/* Function prototypes */
-
-/**
- * Locking for multi-threaded access to the joystick API
- *
- * If you are using the joystick API or handling events from multiple threads
- * you should use these locking functions to protect access to the joysticks.
- *
- * In particular, you are guaranteed that the joystick list won't change, so
- * the API functions that take a joystick index will be valid, and joystick
- * and game controller events will not be delivered.
- */
-extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
-extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
-
-/**
- * Count the number of joysticks attached to the system right now
- */
-extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
-
-/**
- * Get the implementation dependent name of a joystick.
- * This can be called before any joysticks are opened.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
-
-/**
- * Return the GUID for the joystick at this index
- * This can be called before any joysticks are opened.
- */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
-
-/**
- * Get the USB vendor ID of a joystick, if available.
- * This can be called before any joysticks are opened.
- * If the vendor ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
-
-/**
- * Get the USB product ID of a joystick, if available.
- * This can be called before any joysticks are opened.
- * If the product ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
-
-/**
- * Get the product version of a joystick, if available.
- * This can be called before any joysticks are opened.
- * If the product version isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
-
-/**
- * Get the type of a joystick, if available.
- * This can be called before any joysticks are opened.
- */
-extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
-
-/**
- * Get the instance ID of a joystick.
- * This can be called before any joysticks are opened.
- * If the index is out of range, this function will return -1.
- */
-extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
-
-/**
- * Open a joystick for use.
- * The index passed as an argument refers to the N'th joystick on the system.
- * This index is not the value which will identify this joystick in future
- * joystick events. The joystick's instance id (::SDL_JoystickID) will be used
- * there instead.
- *
- * \return A joystick identifier, or NULL if an error occurred.
- */
-extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
-
-/**
- * Return the SDL_Joystick associated with an instance id.
- */
-extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
-
-/**
- * Return the name for this currently opened joystick.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
-
-/**
- * Return the GUID for this opened joystick
- */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
-
-/**
- * Get the USB vendor ID of an opened joystick, if available.
- * If the vendor ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
-
-/**
- * Get the USB product ID of an opened joystick, if available.
- * If the product ID isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
-
-/**
- * Get the product version of an opened joystick, if available.
- * If the product version isn't available this function returns 0.
- */
-extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
-
-/**
- * Get the type of an opened joystick.
- */
-extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
-
-/**
- * Return a string representation for this guid. pszGUID must point to at least 33 bytes
- * (32 for the string plus a NULL terminator).
- */
-extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
-
-/**
- * Convert a string into a joystick guid
- */
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
-
-/**
- * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
-
-/**
- * Get the instance ID of an opened joystick or -1 if the joystick is invalid.
- */
-extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
-
-/**
- * Get the number of general axis controls on a joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
-
-/**
- * Get the number of trackballs on a joystick.
- *
- * Joystick trackballs have only relative motion events associated
- * with them and their state cannot be polled.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
-
-/**
- * Get the number of POV hats on a joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
-
-/**
- * Get the number of buttons on a joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
-
-/**
- * Update the current state of the open joysticks.
- *
- * This is called automatically by the event loop if any joystick
- * events are enabled.
- */
-extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
-
-/**
- * Enable/disable joystick event polling.
- *
- * If joystick events are disabled, you must call SDL_JoystickUpdate()
- * yourself and check the state of the joystick when you want joystick
- * information.
- *
- * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
-
-#define SDL_JOYSTICK_AXIS_MAX 32767
-#define SDL_JOYSTICK_AXIS_MIN -32768
-/**
- * Get the current state of an axis control on a joystick.
- *
- * The state is a value ranging from -32768 to 32767.
- *
- * The axis indices start at index 0.
- */
-extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
- int axis);
-
-/**
- * Get the initial state of an axis control on a joystick.
- *
- * The state is a value ranging from -32768 to 32767.
- *
- * The axis indices start at index 0.
- *
- * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
- int axis, Sint16 *state);
-
-/**
- * \name Hat positions
- */
-/* @{ */
-#define SDL_HAT_CENTERED 0x00
-#define SDL_HAT_UP 0x01
-#define SDL_HAT_RIGHT 0x02
-#define SDL_HAT_DOWN 0x04
-#define SDL_HAT_LEFT 0x08
-#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
-#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
-#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
-#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
-/* @} */
-
-/**
- * Get the current state of a POV hat on a joystick.
- *
- * The hat indices start at index 0.
- *
- * \return The return value is one of the following positions:
- * - ::SDL_HAT_CENTERED
- * - ::SDL_HAT_UP
- * - ::SDL_HAT_RIGHT
- * - ::SDL_HAT_DOWN
- * - ::SDL_HAT_LEFT
- * - ::SDL_HAT_RIGHTUP
- * - ::SDL_HAT_RIGHTDOWN
- * - ::SDL_HAT_LEFTUP
- * - ::SDL_HAT_LEFTDOWN
- */
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
- int hat);
-
-/**
- * Get the ball axis change since the last poll.
- *
- * \return 0, or -1 if you passed it invalid parameters.
- *
- * The ball indices start at index 0.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
- int ball, int *dx, int *dy);
-
-/**
- * Get the current state of a button on a joystick.
- *
- * The button indices start at index 0.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
- int button);
-
-/**
- * Close a joystick previously opened with SDL_JoystickOpen().
- */
-extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
-
-/**
- * Return the battery level of this joystick
- */
-extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_joystick_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_keyboard.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_keyboard.h
deleted file mode 100644
index e78ca46..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_keyboard.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_keyboard.h
- *
- * Include file for SDL keyboard event handling
- */
-
-#ifndef SDL_keyboard_h_
-#define SDL_keyboard_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_keycode.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The SDL keysym structure, used in key events.
- *
- * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
- */
-typedef struct SDL_Keysym
-{
- SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
- SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
- Uint16 mod; /**< current key modifiers */
- Uint32 unused;
-} SDL_Keysym;
-
-/* Function prototypes */
-
-/**
- * \brief Get the window which currently has keyboard focus.
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
-
-/**
- * \brief Get a snapshot of the current state of the keyboard.
- *
- * \param numkeys if non-NULL, receives the length of the returned array.
- *
- * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
- *
- * \b Example:
- * \code
- * const Uint8 *state = SDL_GetKeyboardState(NULL);
- * if ( state[SDL_SCANCODE_RETURN] ) {
- * printf("<RETURN> is pressed.\n");
- * }
- * \endcode
- */
-extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
-
-/**
- * \brief Get the current key modifier state for the keyboard.
- */
-extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
-
-/**
- * \brief Set the current key modifier state for the keyboard.
- *
- * \note This does not change the keyboard state, only the key modifier flags.
- */
-extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
-
-/**
- * \brief Get the key code corresponding to the given scancode according
- * to the current keyboard layout.
- *
- * See ::SDL_Keycode for details.
- *
- * \sa SDL_GetKeyName()
- */
-extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
-
-/**
- * \brief Get the scancode corresponding to the given key code according to the
- * current keyboard layout.
- *
- * See ::SDL_Scancode for details.
- *
- * \sa SDL_GetScancodeName()
- */
-extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
-
-/**
- * \brief Get a human-readable name for a scancode.
- *
- * \return A pointer to the name for the scancode.
- * If the scancode doesn't have a name, this function returns
- * an empty string ("").
- *
- * \sa SDL_Scancode
- */
-extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
-
-/**
- * \brief Get a scancode from a human-readable name
- *
- * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
- *
- * \sa SDL_Scancode
- */
-extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
-
-/**
- * \brief Get a human-readable name for a key.
- *
- * \return A pointer to a UTF-8 string that stays valid at least until the next
- * call to this function. If you need it around any longer, you must
- * copy it. If the key doesn't have a name, this function returns an
- * empty string ("").
- *
- * \sa SDL_Keycode
- */
-extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
-
-/**
- * \brief Get a key code from a human-readable name
- *
- * \return key code, or SDLK_UNKNOWN if the name wasn't recognized
- *
- * \sa SDL_Keycode
- */
-extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
-
-/**
- * \brief Start accepting Unicode text input events.
- * This function will show the on-screen keyboard if supported.
- *
- * \sa SDL_StopTextInput()
- * \sa SDL_SetTextInputRect()
- * \sa SDL_HasScreenKeyboardSupport()
- */
-extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
-
-/**
- * \brief Return whether or not Unicode text input events are enabled.
- *
- * \sa SDL_StartTextInput()
- * \sa SDL_StopTextInput()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
-
-/**
- * \brief Stop receiving any text input events.
- * This function will hide the on-screen keyboard if supported.
- *
- * \sa SDL_StartTextInput()
- * \sa SDL_HasScreenKeyboardSupport()
- */
-extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
-
-/**
- * \brief Set the rectangle used to type Unicode text inputs.
- * This is used as a hint for IME and on-screen keyboard placement.
- *
- * \sa SDL_StartTextInput()
- */
-extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
-
-/**
- * \brief Returns whether the platform has some screen keyboard support.
- *
- * \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
- *
- * \note Not all screen keyboard functions are supported on all platforms.
- *
- * \sa SDL_IsScreenKeyboardShown()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
-
-/**
- * \brief Returns whether the screen keyboard is shown for given window.
- *
- * \param window The window for which screen keyboard should be queried.
- *
- * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
- *
- * \sa SDL_HasScreenKeyboardSupport()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_keyboard_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_keycode.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_keycode.h
deleted file mode 100644
index c41e45f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_keycode.h
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_keycode.h
- *
- * Defines constants which identify keyboard keys and modifiers.
- */
-
-#ifndef SDL_keycode_h_
-#define SDL_keycode_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_scancode.h"
-
-/**
- * \brief The SDL virtual key representation.
- *
- * Values of this type are used to represent keyboard keys using the current
- * layout of the keyboard. These values include Unicode values representing
- * the unmodified character that would be generated by pressing the key, or
- * an SDLK_* constant for those keys that do not generate characters.
- *
- * A special exception is the number keys at the top of the keyboard which
- * always map to SDLK_0...SDLK_9, regardless of layout.
- */
-typedef Sint32 SDL_Keycode;
-
-#define SDLK_SCANCODE_MASK (1<<30)
-#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
-
-enum
-{
- SDLK_UNKNOWN = 0,
-
- SDLK_RETURN = '\r',
- SDLK_ESCAPE = '\033',
- SDLK_BACKSPACE = '\b',
- SDLK_TAB = '\t',
- SDLK_SPACE = ' ',
- SDLK_EXCLAIM = '!',
- SDLK_QUOTEDBL = '"',
- SDLK_HASH = '#',
- SDLK_PERCENT = '%',
- SDLK_DOLLAR = '$',
- SDLK_AMPERSAND = '&',
- SDLK_QUOTE = '\'',
- SDLK_LEFTPAREN = '(',
- SDLK_RIGHTPAREN = ')',
- SDLK_ASTERISK = '*',
- SDLK_PLUS = '+',
- SDLK_COMMA = ',',
- SDLK_MINUS = '-',
- SDLK_PERIOD = '.',
- SDLK_SLASH = '/',
- SDLK_0 = '0',
- SDLK_1 = '1',
- SDLK_2 = '2',
- SDLK_3 = '3',
- SDLK_4 = '4',
- SDLK_5 = '5',
- SDLK_6 = '6',
- SDLK_7 = '7',
- SDLK_8 = '8',
- SDLK_9 = '9',
- SDLK_COLON = ':',
- SDLK_SEMICOLON = ';',
- SDLK_LESS = '<',
- SDLK_EQUALS = '=',
- SDLK_GREATER = '>',
- SDLK_QUESTION = '?',
- SDLK_AT = '@',
- /*
- Skip uppercase letters
- */
- SDLK_LEFTBRACKET = '[',
- SDLK_BACKSLASH = '\\',
- SDLK_RIGHTBRACKET = ']',
- SDLK_CARET = '^',
- SDLK_UNDERSCORE = '_',
- SDLK_BACKQUOTE = '`',
- SDLK_a = 'a',
- SDLK_b = 'b',
- SDLK_c = 'c',
- SDLK_d = 'd',
- SDLK_e = 'e',
- SDLK_f = 'f',
- SDLK_g = 'g',
- SDLK_h = 'h',
- SDLK_i = 'i',
- SDLK_j = 'j',
- SDLK_k = 'k',
- SDLK_l = 'l',
- SDLK_m = 'm',
- SDLK_n = 'n',
- SDLK_o = 'o',
- SDLK_p = 'p',
- SDLK_q = 'q',
- SDLK_r = 'r',
- SDLK_s = 's',
- SDLK_t = 't',
- SDLK_u = 'u',
- SDLK_v = 'v',
- SDLK_w = 'w',
- SDLK_x = 'x',
- SDLK_y = 'y',
- SDLK_z = 'z',
-
- SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
-
- SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
- SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
- SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
- SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
- SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
- SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
- SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
- SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
- SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
- SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
- SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
- SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
-
- SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
- SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
- SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
- SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
- SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
- SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
- SDLK_DELETE = '\177',
- SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
- SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
- SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
- SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
- SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
- SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
-
- SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
- SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
- SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
- SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
- SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
- SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
- SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
- SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
- SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
- SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
- SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
- SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
- SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
- SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
- SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
- SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
- SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
-
- SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
- SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
- SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
- SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
- SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
- SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
- SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
- SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
- SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
- SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
- SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
- SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
- SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
- SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
- SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
- SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
- SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
- SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
- SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
- SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
- SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
- SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
- SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
- SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
- SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
- SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
- SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
- SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
- SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
- SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
- SDLK_KP_EQUALSAS400 =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
-
- SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
- SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
- SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
- SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
- SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
- SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
- SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
- SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
- SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
- SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
- SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
- SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
-
- SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
- SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
- SDLK_THOUSANDSSEPARATOR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
- SDLK_DECIMALSEPARATOR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
- SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
- SDLK_CURRENCYSUBUNIT =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
- SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
- SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
- SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
- SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
- SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
- SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
- SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
- SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
- SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
- SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
- SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
- SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
- SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
- SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
- SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
- SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
- SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
- SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
- SDLK_KP_DBLAMPERSAND =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
- SDLK_KP_VERTICALBAR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
- SDLK_KP_DBLVERTICALBAR =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
- SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
- SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
- SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
- SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
- SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
- SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
- SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
- SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
- SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
- SDLK_KP_MEMSUBTRACT =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
- SDLK_KP_MEMMULTIPLY =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
- SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
- SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
- SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
- SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
- SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
- SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
- SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
- SDLK_KP_HEXADECIMAL =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
-
- SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
- SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
- SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
- SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
- SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
- SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
- SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
- SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
-
- SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
-
- SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
- SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
- SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
- SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
- SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
- SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
- SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
- SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
- SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
- SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
- SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
- SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
- SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
- SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
- SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
- SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
- SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
-
- SDLK_BRIGHTNESSDOWN =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
- SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
- SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
- SDLK_KBDILLUMTOGGLE =
- SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
- SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
- SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
- SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
- SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
- SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
- SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
-
- SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
- SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
-};
-
-/**
- * \brief Enumeration of valid key mods (possibly OR'd together).
- */
-typedef enum
-{
- KMOD_NONE = 0x0000,
- KMOD_LSHIFT = 0x0001,
- KMOD_RSHIFT = 0x0002,
- KMOD_LCTRL = 0x0040,
- KMOD_RCTRL = 0x0080,
- KMOD_LALT = 0x0100,
- KMOD_RALT = 0x0200,
- KMOD_LGUI = 0x0400,
- KMOD_RGUI = 0x0800,
- KMOD_NUM = 0x1000,
- KMOD_CAPS = 0x2000,
- KMOD_MODE = 0x4000,
- KMOD_RESERVED = 0x8000
-} SDL_Keymod;
-
-#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
-#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
-#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
-#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
-
-#endif /* SDL_keycode_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_loadso.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_loadso.h
deleted file mode 100644
index 6ea256c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_loadso.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_loadso.h
- *
- * System dependent library loading routines
- *
- * Some things to keep in mind:
- * \li These functions only work on C function names. Other languages may
- * have name mangling and intrinsic language support that varies from
- * compiler to compiler.
- * \li Make sure you declare your function pointers with the same calling
- * convention as the actual library function. Your code will crash
- * mysteriously if you do not do this.
- * \li Avoid namespace collisions. If you load a symbol from the library,
- * it is not defined whether or not it goes into the global symbol
- * namespace for the application. If it does and it conflicts with
- * symbols in your code or other shared libraries, you will not get
- * the results you expect. :)
- */
-
-#ifndef SDL_loadso_h_
-#define SDL_loadso_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This function dynamically loads a shared object and returns a pointer
- * to the object handle (or NULL if there was an error).
- * The 'sofile' parameter is a system dependent name of the object file.
- */
-extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
-
-/**
- * Given an object handle, this function looks up the address of the
- * named function in the shared object and returns it. This address
- * is no longer valid after calling SDL_UnloadObject().
- */
-extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
- const char *name);
-
-/**
- * Unload a shared object from memory.
- */
-extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_loadso_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_log.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_log.h
deleted file mode 100644
index 356d0e1..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_log.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_log.h
- *
- * Simple log messages with categories and priorities.
- *
- * By default logs are quiet, but if you're debugging SDL you might want:
- *
- * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
- *
- * Here's where the messages go on different platforms:
- * Windows: debug output stream
- * Android: log output
- * Others: standard error output (stderr)
- */
-
-#ifndef SDL_log_h_
-#define SDL_log_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * \brief The maximum size of a log message
- *
- * Messages longer than the maximum size will be truncated
- */
-#define SDL_MAX_LOG_MESSAGE 4096
-
-/**
- * \brief The predefined log categories
- *
- * By default the application category is enabled at the INFO level,
- * the assert category is enabled at the WARN level, test is enabled
- * at the VERBOSE level and all other categories are enabled at the
- * CRITICAL level.
- */
-enum
-{
- SDL_LOG_CATEGORY_APPLICATION,
- SDL_LOG_CATEGORY_ERROR,
- SDL_LOG_CATEGORY_ASSERT,
- SDL_LOG_CATEGORY_SYSTEM,
- SDL_LOG_CATEGORY_AUDIO,
- SDL_LOG_CATEGORY_VIDEO,
- SDL_LOG_CATEGORY_RENDER,
- SDL_LOG_CATEGORY_INPUT,
- SDL_LOG_CATEGORY_TEST,
-
- /* Reserved for future SDL library use */
- SDL_LOG_CATEGORY_RESERVED1,
- SDL_LOG_CATEGORY_RESERVED2,
- SDL_LOG_CATEGORY_RESERVED3,
- SDL_LOG_CATEGORY_RESERVED4,
- SDL_LOG_CATEGORY_RESERVED5,
- SDL_LOG_CATEGORY_RESERVED6,
- SDL_LOG_CATEGORY_RESERVED7,
- SDL_LOG_CATEGORY_RESERVED8,
- SDL_LOG_CATEGORY_RESERVED9,
- SDL_LOG_CATEGORY_RESERVED10,
-
- /* Beyond this point is reserved for application use, e.g.
- enum {
- MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
- MYAPP_CATEGORY_AWESOME2,
- MYAPP_CATEGORY_AWESOME3,
- ...
- };
- */
- SDL_LOG_CATEGORY_CUSTOM
-};
-
-/**
- * \brief The predefined log priorities
- */
-typedef enum
-{
- SDL_LOG_PRIORITY_VERBOSE = 1,
- SDL_LOG_PRIORITY_DEBUG,
- SDL_LOG_PRIORITY_INFO,
- SDL_LOG_PRIORITY_WARN,
- SDL_LOG_PRIORITY_ERROR,
- SDL_LOG_PRIORITY_CRITICAL,
- SDL_NUM_LOG_PRIORITIES
-} SDL_LogPriority;
-
-
-/**
- * \brief Set the priority of all log categories
- */
-extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
-
-/**
- * \brief Set the priority of a particular log category
- */
-extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
- SDL_LogPriority priority);
-
-/**
- * \brief Get the priority of a particular log category
- */
-extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
-
-/**
- * \brief Reset all priorities to default.
- *
- * \note This is called in SDL_Quit().
- */
-extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
-
-/**
- * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
- */
-extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
- */
-extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
- */
-extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_INFO
- */
-extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_WARN
- */
-extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_ERROR
- */
-extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
- */
-extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Log a message with the specified category and priority.
- */
-extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
- SDL_LogPriority priority,
- SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
-
-/**
- * \brief Log a message with the specified category and priority.
- */
-extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
- SDL_LogPriority priority,
- const char *fmt, va_list ap);
-
-/**
- * \brief The prototype for the log output function
- */
-typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
-
-/**
- * \brief Get the current log output function.
- */
-extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
-
-/**
- * \brief This function allows you to replace the default log output
- * function with one of your own.
- */
-extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_log_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_main.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_main.h
deleted file mode 100644
index 2af3236..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_main.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_main_h_
-#define SDL_main_h_
-
-#include "SDL_stdinc.h"
-
-/**
- * \file SDL_main.h
- *
- * Redefine main() on some platforms so that it is called by SDL.
- */
-
-#ifndef SDL_MAIN_HANDLED
-#if defined(__WIN32__)
-/* On Windows SDL provides WinMain(), which parses the command line and passes
- the arguments to your main function.
-
- If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
- */
-#define SDL_MAIN_AVAILABLE
-
-#elif defined(__WINRT__)
-/* On WinRT, SDL provides a main function that initializes CoreApplication,
- creating an instance of IFrameworkView in the process.
-
- Please note that #include'ing SDL_main.h is not enough to get a main()
- function working. In non-XAML apps, the file,
- src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
- into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
- called, with a pointer to the Direct3D-hosted XAML control passed in.
-*/
-#define SDL_MAIN_NEEDED
-
-#elif defined(__IPHONEOS__)
-/* On iOS SDL provides a main function that creates an application delegate
- and starts the iOS application run loop.
-
- See src/video/uikit/SDL_uikitappdelegate.m for more details.
- */
-#define SDL_MAIN_NEEDED
-
-#elif defined(__ANDROID__)
-/* On Android SDL provides a Java class in SDLActivity.java that is the
- main activity entry point.
-
- See README-android.md for more details on extending that class.
- */
-#define SDL_MAIN_NEEDED
-
-#elif defined(__NACL__)
-/* On NACL we use ppapi_simple to set up the application helper code,
- then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
- starting the user main function.
- All user code is run in a separate thread by ppapi_simple, thus
- allowing for blocking io to take place via nacl_io
-*/
-#define SDL_MAIN_NEEDED
-
-#endif
-#endif /* SDL_MAIN_HANDLED */
-
-#ifdef __cplusplus
-#define C_LINKAGE "C"
-#else
-#define C_LINKAGE
-#endif /* __cplusplus */
-
-/**
- * \file SDL_main.h
- *
- * The application's main() function must be called with C linkage,
- * and should be declared like this:
- * \code
- * #ifdef __cplusplus
- * extern "C"
- * #endif
- * int main(int argc, char *argv[])
- * {
- * }
- * \endcode
- */
-
-#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
-#define main SDL_main
-#endif
-
-/**
- * The prototype for the application's main() function
- */
-extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
-
-
-#include "begin_code.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This is called by the real SDL main function to let the rest of the
- * library know that initialization was done properly.
- *
- * Calling this yourself without knowing what you're doing can cause
- * crashes and hard to diagnose problems with your application.
- */
-extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
-
-#ifdef __WIN32__
-
-/**
- * This can be called to set the application class at startup
- */
-extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
- void *hInst);
-extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
-
-#endif /* __WIN32__ */
-
-
-#ifdef __WINRT__
-
-/**
- * \brief Initializes and launches an SDL/WinRT application.
- *
- * \param mainFunction The SDL app's C-style main().
- * \param reserved Reserved for future use; should be NULL
- * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
- * information on the failure.
- */
-extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
-
-#endif /* __WINRT__ */
-
-
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_main_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_messagebox.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_messagebox.h
deleted file mode 100644
index c326d8f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_messagebox.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_messagebox_h_
-#define SDL_messagebox_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_video.h" /* For SDL_Window */
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
- */
-typedef enum
-{
- SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
- SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
- SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
-} SDL_MessageBoxFlags;
-
-/**
- * \brief Flags for SDL_MessageBoxButtonData.
- */
-typedef enum
-{
- SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
- SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
-} SDL_MessageBoxButtonFlags;
-
-/**
- * \brief Individual button data.
- */
-typedef struct
-{
- Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
- int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
- const char * text; /**< The UTF-8 button text */
-} SDL_MessageBoxButtonData;
-
-/**
- * \brief RGB value used in a message box color scheme
- */
-typedef struct
-{
- Uint8 r, g, b;
-} SDL_MessageBoxColor;
-
-typedef enum
-{
- SDL_MESSAGEBOX_COLOR_BACKGROUND,
- SDL_MESSAGEBOX_COLOR_TEXT,
- SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
- SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
- SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
- SDL_MESSAGEBOX_COLOR_MAX
-} SDL_MessageBoxColorType;
-
-/**
- * \brief A set of colors to use for message box dialogs
- */
-typedef struct
-{
- SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
-} SDL_MessageBoxColorScheme;
-
-/**
- * \brief MessageBox structure containing title, text, window, etc.
- */
-typedef struct
-{
- Uint32 flags; /**< ::SDL_MessageBoxFlags */
- SDL_Window *window; /**< Parent window, can be NULL */
- const char *title; /**< UTF-8 title */
- const char *message; /**< UTF-8 message text */
-
- int numbuttons;
- const SDL_MessageBoxButtonData *buttons;
-
- const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
-} SDL_MessageBoxData;
-
-/**
- * \brief Create a modal message box.
- *
- * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
- * \param buttonid The pointer to which user id of hit button should be copied.
- *
- * \return -1 on error, otherwise 0 and buttonid contains user id of button
- * hit or -1 if dialog was closed.
- *
- * \note This function should be called on the thread that created the parent
- * window, or on the main thread if the messagebox has no parent. It will
- * block execution of that thread until the user clicks a button or
- * closes the messagebox.
- */
-extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
-
-/**
- * \brief Create a simple modal message box
- *
- * \param flags ::SDL_MessageBoxFlags
- * \param title UTF-8 title text
- * \param message UTF-8 message text
- * \param window The parent window, or NULL for no parent
- *
- * \return 0 on success, -1 on error
- *
- * \sa SDL_ShowMessageBox
- */
-extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_messagebox_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_mouse.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_mouse.h
deleted file mode 100644
index 6001bd4..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_mouse.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_mouse.h
- *
- * Include file for SDL mouse event handling.
- */
-
-#ifndef SDL_mouse_h_
-#define SDL_mouse_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
-
-/**
- * \brief Cursor types for SDL_CreateSystemCursor().
- */
-typedef enum
-{
- SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
- SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
- SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
- SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
- SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
- SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
- SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
- SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
- SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
- SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
- SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
- SDL_SYSTEM_CURSOR_HAND, /**< Hand */
- SDL_NUM_SYSTEM_CURSORS
-} SDL_SystemCursor;
-
-/**
- * \brief Scroll direction types for the Scroll event
- */
-typedef enum
-{
- SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
- SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
-} SDL_MouseWheelDirection;
-
-/* Function prototypes */
-
-/**
- * \brief Get the window which currently has mouse focus.
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
-
-/**
- * \brief Retrieve the current state of the mouse.
- *
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * mouse cursor position relative to the focus window for the currently
- * selected mouse. You can pass NULL for either x or y.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
-
-/**
- * \brief Get the current state of the mouse, in relation to the desktop
- *
- * This works just like SDL_GetMouseState(), but the coordinates will be
- * reported relative to the top-left of the desktop. This can be useful if
- * you need to track the mouse outside of a specific window and
- * SDL_CaptureMouse() doesn't fit your needs. For example, it could be
- * useful if you need to track the mouse while dragging a window, where
- * coordinates relative to a window might not be in sync at all times.
- *
- * \note SDL_GetMouseState() returns the mouse position as SDL understands
- * it from the last pump of the event queue. This function, however,
- * queries the OS for the current mouse position, and as such, might
- * be a slightly less efficient function. Unless you know what you're
- * doing and have a good reason to use this function, you probably want
- * SDL_GetMouseState() instead.
- *
- * \param x Returns the current X coord, relative to the desktop. Can be NULL.
- * \param y Returns the current Y coord, relative to the desktop. Can be NULL.
- * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
- *
- * \sa SDL_GetMouseState
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
-
-/**
- * \brief Retrieve the relative state of the mouse.
- *
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * mouse deltas since the last call to SDL_GetRelativeMouseState().
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
-
-/**
- * \brief Moves the mouse to the given position within the window.
- *
- * \param window The window to move the mouse into, or NULL for the current mouse focus
- * \param x The x coordinate within the window
- * \param y The y coordinate within the window
- *
- * \note This function generates a mouse motion event
- */
-extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
- int x, int y);
-
-/**
- * \brief Moves the mouse to the given position in global screen space.
- *
- * \param x The x coordinate
- * \param y The y coordinate
- * \return 0 on success, -1 on error (usually: unsupported by a platform).
- *
- * \note This function generates a mouse motion event
- */
-extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
-
-/**
- * \brief Set relative mouse mode.
- *
- * \param enabled Whether or not to enable relative mode
- *
- * \return 0 on success, or -1 if relative mode is not supported.
- *
- * While the mouse is in relative mode, the cursor is hidden, and the
- * driver will try to report continuous motion in the current window.
- * Only relative motion events will be delivered, the mouse position
- * will not change.
- *
- * \note This function will flush any pending mouse motion.
- *
- * \sa SDL_GetRelativeMouseMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
-
-/**
- * \brief Capture the mouse, to track input outside an SDL window.
- *
- * \param enabled Whether or not to enable capturing
- *
- * Capturing enables your app to obtain mouse events globally, instead of
- * just within your window. Not all video targets support this function.
- * When capturing is enabled, the current window will get all mouse events,
- * but unlike relative mode, no change is made to the cursor and it is
- * not restrained to your window.
- *
- * This function may also deny mouse input to other windows--both those in
- * your application and others on the system--so you should use this
- * function sparingly, and in small bursts. For example, you might want to
- * track the mouse while the user is dragging something, until the user
- * releases a mouse button. It is not recommended that you capture the mouse
- * for long periods of time, such as the entire time your app is running.
- *
- * While captured, mouse events still report coordinates relative to the
- * current (foreground) window, but those coordinates may be outside the
- * bounds of the window (including negative values). Capturing is only
- * allowed for the foreground window. If the window loses focus while
- * capturing, the capture will be disabled automatically.
- *
- * While capturing is enabled, the current window will have the
- * SDL_WINDOW_MOUSE_CAPTURE flag set.
- *
- * \return 0 on success, or -1 if not supported.
- */
-extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
-
-/**
- * \brief Query whether relative mouse mode is enabled.
- *
- * \sa SDL_SetRelativeMouseMode()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
-
-/**
- * \brief Create a cursor, using the specified bitmap data and
- * mask (in MSB format).
- *
- * The cursor width must be a multiple of 8 bits.
- *
- * The cursor is created in black and white according to the following:
- * <table>
- * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
- * <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
- * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
- * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
- * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
- * if not. </td></tr>
- * </table>
- *
- * \sa SDL_FreeCursor()
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
- const Uint8 * mask,
- int w, int h, int hot_x,
- int hot_y);
-
-/**
- * \brief Create a color cursor.
- *
- * \sa SDL_FreeCursor()
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
- int hot_x,
- int hot_y);
-
-/**
- * \brief Create a system cursor.
- *
- * \sa SDL_FreeCursor()
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
-
-/**
- * \brief Set the active cursor.
- */
-extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
-
-/**
- * \brief Return the active cursor.
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
-
-/**
- * \brief Return the default cursor.
- */
-extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
-
-/**
- * \brief Frees a cursor created with SDL_CreateCursor() or similar functions.
- *
- * \sa SDL_CreateCursor()
- * \sa SDL_CreateColorCursor()
- * \sa SDL_CreateSystemCursor()
- */
-extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
-
-/**
- * \brief Toggle whether or not the cursor is shown.
- *
- * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
- * state.
- *
- * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
- */
-extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
-
-/**
- * Used as a mask when testing buttons in buttonstate.
- * - Button 1: Left mouse button
- * - Button 2: Middle mouse button
- * - Button 3: Right mouse button
- */
-#define SDL_BUTTON(X) (1 << ((X)-1))
-#define SDL_BUTTON_LEFT 1
-#define SDL_BUTTON_MIDDLE 2
-#define SDL_BUTTON_RIGHT 3
-#define SDL_BUTTON_X1 4
-#define SDL_BUTTON_X2 5
-#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
-#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
-#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
-#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
-#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_mouse_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_mutex.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_mutex.h
deleted file mode 100644
index 0272379..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_mutex.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_mutex_h_
-#define SDL_mutex_h_
-
-/**
- * \file SDL_mutex.h
- *
- * Functions to provide thread synchronization primitives.
- */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Synchronization functions which can time out return this value
- * if they time out.
- */
-#define SDL_MUTEX_TIMEDOUT 1
-
-/**
- * This is the timeout value which corresponds to never time out.
- */
-#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
-
-
-/**
- * \name Mutex functions
- */
-/* @{ */
-
-/* The SDL mutex structure, defined in SDL_sysmutex.c */
-struct SDL_mutex;
-typedef struct SDL_mutex SDL_mutex;
-
-/**
- * Create a mutex, initialized unlocked.
- */
-extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
-
-/**
- * Lock the mutex.
- *
- * \return 0, or -1 on error.
- */
-#define SDL_mutexP(m) SDL_LockMutex(m)
-extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
-
-/**
- * Try to lock the mutex
- *
- * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
-
-/**
- * Unlock the mutex.
- *
- * \return 0, or -1 on error.
- *
- * \warning It is an error to unlock a mutex that has not been locked by
- * the current thread, and doing so results in undefined behavior.
- */
-#define SDL_mutexV(m) SDL_UnlockMutex(m)
-extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
-
-/**
- * Destroy a mutex.
- */
-extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
-
-/* @} *//* Mutex functions */
-
-
-/**
- * \name Semaphore functions
- */
-/* @{ */
-
-/* The SDL semaphore structure, defined in SDL_syssem.c */
-struct SDL_semaphore;
-typedef struct SDL_semaphore SDL_sem;
-
-/**
- * Create a semaphore, initialized with value, returns NULL on failure.
- */
-extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
-
-/**
- * Destroy a semaphore.
- */
-extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
-
-/**
- * This function suspends the calling thread until the semaphore pointed
- * to by \c sem has a positive count. It then atomically decreases the
- * semaphore count.
- */
-extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
-
-/**
- * Non-blocking variant of SDL_SemWait().
- *
- * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
- * block, and -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
-
-/**
- * Variant of SDL_SemWait() with a timeout in milliseconds.
- *
- * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
- * succeed in the allotted time, and -1 on error.
- *
- * \warning On some platforms this function is implemented by looping with a
- * delay of 1 ms, and so should be avoided if possible.
- */
-extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
-
-/**
- * Atomically increases the semaphore's count (not blocking).
- *
- * \return 0, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
-
-/**
- * Returns the current count of the semaphore.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
-
-/* @} *//* Semaphore functions */
-
-
-/**
- * \name Condition variable functions
- */
-/* @{ */
-
-/* The SDL condition variable structure, defined in SDL_syscond.c */
-struct SDL_cond;
-typedef struct SDL_cond SDL_cond;
-
-/**
- * Create a condition variable.
- *
- * Typical use of condition variables:
- *
- * Thread A:
- * SDL_LockMutex(lock);
- * while ( ! condition ) {
- * SDL_CondWait(cond, lock);
- * }
- * SDL_UnlockMutex(lock);
- *
- * Thread B:
- * SDL_LockMutex(lock);
- * ...
- * condition = true;
- * ...
- * SDL_CondSignal(cond);
- * SDL_UnlockMutex(lock);
- *
- * There is some discussion whether to signal the condition variable
- * with the mutex locked or not. There is some potential performance
- * benefit to unlocking first on some platforms, but there are some
- * potential race conditions depending on how your code is structured.
- *
- * In general it's safer to signal the condition variable while the
- * mutex is locked.
- */
-extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
-
-/**
- * Destroy a condition variable.
- */
-extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
-
-/**
- * Restart one of the threads that are waiting on the condition variable.
- *
- * \return 0 or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
-
-/**
- * Restart all threads that are waiting on the condition variable.
- *
- * \return 0 or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
-
-/**
- * Wait on the condition variable, unlocking the provided mutex.
- *
- * \warning The mutex must be locked before entering this function!
- *
- * The mutex is re-locked once the condition variable is signaled.
- *
- * \return 0 when it is signaled, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
-
-/**
- * Waits for at most \c ms milliseconds, and returns 0 if the condition
- * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
- * signaled in the allotted time, and -1 on error.
- *
- * \warning On some platforms this function is implemented by looping with a
- * delay of 1 ms, and so should be avoided if possible.
- */
-extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
- SDL_mutex * mutex, Uint32 ms);
-
-/* @} *//* Condition variable functions */
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_mutex_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_name.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_name.h
deleted file mode 100644
index 8095ed3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_name.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDLname_h_
-#define SDLname_h_
-
-#if defined(__STDC__) || defined(__cplusplus)
-#define NeedFunctionPrototypes 1
-#endif
-
-#define SDL_NAME(X) SDL_##X
-
-#endif /* SDLname_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengl.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_opengl.h
deleted file mode 100644
index 314dd57..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengl.h
+++ /dev/null
@@ -1,2183 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_opengl.h
- *
- * This is a simple file to encapsulate the OpenGL API headers.
- */
-
-/**
- * \def NO_SDL_GLEXT
- *
- * Define this if you have your own version of glext.h and want to disable the
- * version included in SDL_opengl.h.
- */
-
-#ifndef SDL_opengl_h_
-#define SDL_opengl_h_
-
-#include "SDL_config.h"
-
-#ifndef __IPHONEOS__ /* No OpenGL on iOS. */
-
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef __gl_h_
-#define __gl_h_
-
-#if defined(USE_MGL_NAMESPACE)
-#include "gl_mangle.h"
-#endif
-
-
-/**********************************************************************
- * Begin system-specific stuff.
- */
-
-#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
-#define __WIN32__
-#endif
-
-#if defined(__WIN32__) && !defined(__CYGWIN__)
-# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
-# define GLAPI __declspec(dllexport)
-# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
-# define GLAPI __declspec(dllimport)
-# else /* for use with static link lib build of Win32 edition only */
-# define GLAPI extern
-# endif /* _STATIC_MESA support */
-# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
-# define GLAPIENTRY
-# else
-# define GLAPIENTRY __stdcall
-# endif
-#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
-# define GLAPI extern
-# define GLAPIENTRY __stdcall
-#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
-# define GLAPI extern
-# define GLAPIENTRY _System
-# define APIENTRY _System
-# if defined(__GNUC__) && !defined(_System)
-# define _System
-# endif
-#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-# define GLAPI __attribute__((visibility("default")))
-# define GLAPIENTRY
-#endif /* WIN32 && !CYGWIN */
-
-/*
- * WINDOWS: Include windows.h here to define APIENTRY.
- * It is also useful when applications include this file by
- * including only glut.h, since glut.h depends on windows.h.
- * Applications needing to include windows.h with parms other
- * than "WIN32_LEAN_AND_MEAN" may include windows.h before
- * glut.h or gl.h.
- */
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#ifndef NOMINMAX /* don't define min() and max(). */
-#define NOMINMAX
-#endif
-#include <windows.h>
-#endif
-
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-#ifndef GLAPIENTRY
-#define GLAPIENTRY
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY GLAPIENTRY
-#endif
-
-/* "P" suffix to be used for a pointer to a function */
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-
-#ifndef GLAPIENTRYP
-#define GLAPIENTRYP GLAPIENTRY *
-#endif
-
-#if defined(PRAGMA_EXPORT_SUPPORTED)
-#pragma export on
-#endif
-
-/*
- * End system-specific stuff.
- **********************************************************************/
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-#define GL_VERSION_1_1 1
-#define GL_VERSION_1_2 1
-#define GL_VERSION_1_3 1
-#define GL_ARB_imaging 1
-
-
-/*
- * Datatypes
- */
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef void GLvoid;
-typedef signed char GLbyte; /* 1-byte signed */
-typedef short GLshort; /* 2-byte signed */
-typedef int GLint; /* 4-byte signed */
-typedef unsigned char GLubyte; /* 1-byte unsigned */
-typedef unsigned short GLushort; /* 2-byte unsigned */
-typedef unsigned int GLuint; /* 4-byte unsigned */
-typedef int GLsizei; /* 4-byte signed */
-typedef float GLfloat; /* single precision float */
-typedef float GLclampf; /* single precision float in [0,1] */
-typedef double GLdouble; /* double precision float */
-typedef double GLclampd; /* double precision float in [0,1] */
-
-
-
-/*
- * Constants
- */
-
-/* Boolean values */
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/* Data types */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_2_BYTES 0x1407
-#define GL_3_BYTES 0x1408
-#define GL_4_BYTES 0x1409
-#define GL_DOUBLE 0x140A
-
-/* Primitives */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_QUADS 0x0007
-#define GL_QUAD_STRIP 0x0008
-#define GL_POLYGON 0x0009
-
-/* Vertex Arrays */
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_INDEX_ARRAY 0x8077
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_EDGE_FLAG_ARRAY 0x8079
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_INDEX_ARRAY_TYPE 0x8085
-#define GL_INDEX_ARRAY_STRIDE 0x8086
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_INDEX_ARRAY_POINTER 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
-#define GL_V2F 0x2A20
-#define GL_V3F 0x2A21
-#define GL_C4UB_V2F 0x2A22
-#define GL_C4UB_V3F 0x2A23
-#define GL_C3F_V3F 0x2A24
-#define GL_N3F_V3F 0x2A25
-#define GL_C4F_N3F_V3F 0x2A26
-#define GL_T2F_V3F 0x2A27
-#define GL_T4F_V4F 0x2A28
-#define GL_T2F_C4UB_V3F 0x2A29
-#define GL_T2F_C3F_V3F 0x2A2A
-#define GL_T2F_N3F_V3F 0x2A2B
-#define GL_T2F_C4F_N3F_V3F 0x2A2C
-#define GL_T4F_C4F_N3F_V4F 0x2A2D
-
-/* Matrix Mode */
-#define GL_MATRIX_MODE 0x0BA0
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-
-/* Points */
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_POINT_SIZE_RANGE 0x0B12
-
-/* Lines */
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_LINE_STIPPLE 0x0B24
-#define GL_LINE_STIPPLE_PATTERN 0x0B25
-#define GL_LINE_STIPPLE_REPEAT 0x0B26
-#define GL_LINE_WIDTH 0x0B21
-#define GL_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_LINE_WIDTH_RANGE 0x0B22
-
-/* Polygons */
-#define GL_POINT 0x1B00
-#define GL_LINE 0x1B01
-#define GL_FILL 0x1B02
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_POLYGON_MODE 0x0B40
-#define GL_POLYGON_SMOOTH 0x0B41
-#define GL_POLYGON_STIPPLE 0x0B42
-#define GL_EDGE_FLAG 0x0B43
-#define GL_CULL_FACE 0x0B44
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_POINT 0x2A01
-#define GL_POLYGON_OFFSET_LINE 0x2A02
-#define GL_POLYGON_OFFSET_FILL 0x8037
-
-/* Display Lists */
-#define GL_COMPILE 0x1300
-#define GL_COMPILE_AND_EXECUTE 0x1301
-#define GL_LIST_BASE 0x0B32
-#define GL_LIST_INDEX 0x0B33
-#define GL_LIST_MODE 0x0B30
-
-/* Depth buffer */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_DEPTH_TEST 0x0B71
-#define GL_DEPTH_BITS 0x0D56
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_COMPONENT 0x1902
-
-/* Lighting */
-#define GL_LIGHTING 0x0B50
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_SHININESS 0x1601
-#define GL_EMISSION 0x1600
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-#define GL_COLOR_INDEXES 0x1603
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_SHADE_MODEL 0x0B54
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_COLOR_MATERIAL_FACE 0x0B55
-#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
-#define GL_NORMALIZE 0x0BA1
-
-/* User clipping planes */
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-
-/* Accumulation buffer */
-#define GL_ACCUM_RED_BITS 0x0D58
-#define GL_ACCUM_GREEN_BITS 0x0D59
-#define GL_ACCUM_BLUE_BITS 0x0D5A
-#define GL_ACCUM_ALPHA_BITS 0x0D5B
-#define GL_ACCUM_CLEAR_VALUE 0x0B80
-#define GL_ACCUM 0x0100
-#define GL_ADD 0x0104
-#define GL_LOAD 0x0101
-#define GL_MULT 0x0103
-#define GL_RETURN 0x0102
-
-/* Alpha testing */
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_ALPHA_TEST_FUNC 0x0BC1
-
-/* Blending */
-#define GL_BLEND 0x0BE2
-#define GL_BLEND_SRC 0x0BE1
-#define GL_BLEND_DST 0x0BE0
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-
-/* Render Mode */
-#define GL_FEEDBACK 0x1C01
-#define GL_RENDER 0x1C00
-#define GL_SELECT 0x1C02
-
-/* Feedback */
-#define GL_2D 0x0600
-#define GL_3D 0x0601
-#define GL_3D_COLOR 0x0602
-#define GL_3D_COLOR_TEXTURE 0x0603
-#define GL_4D_COLOR_TEXTURE 0x0604
-#define GL_POINT_TOKEN 0x0701
-#define GL_LINE_TOKEN 0x0702
-#define GL_LINE_RESET_TOKEN 0x0707
-#define GL_POLYGON_TOKEN 0x0703
-#define GL_BITMAP_TOKEN 0x0704
-#define GL_DRAW_PIXEL_TOKEN 0x0705
-#define GL_COPY_PIXEL_TOKEN 0x0706
-#define GL_PASS_THROUGH_TOKEN 0x0700
-#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
-#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
-#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
-
-/* Selection */
-#define GL_SELECTION_BUFFER_POINTER 0x0DF3
-#define GL_SELECTION_BUFFER_SIZE 0x0DF4
-
-/* Fog */
-#define GL_FOG 0x0B60
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_COLOR 0x0B66
-#define GL_FOG_INDEX 0x0B61
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_LINEAR 0x2601
-#define GL_EXP 0x0800
-#define GL_EXP2 0x0801
-
-/* Logic Ops */
-#define GL_LOGIC_OP 0x0BF1
-#define GL_INDEX_LOGIC_OP 0x0BF1
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_CLEAR 0x1500
-#define GL_SET 0x150F
-#define GL_COPY 0x1503
-#define GL_COPY_INVERTED 0x150C
-#define GL_NOOP 0x1505
-#define GL_INVERT 0x150A
-#define GL_AND 0x1501
-#define GL_NAND 0x150E
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_XOR 0x1506
-#define GL_EQUIV 0x1509
-#define GL_AND_REVERSE 0x1502
-#define GL_AND_INVERTED 0x1504
-#define GL_OR_REVERSE 0x150B
-#define GL_OR_INVERTED 0x150D
-
-/* Stencil */
-#define GL_STENCIL_BITS 0x0D57
-#define GL_STENCIL_TEST 0x0B90
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_INDEX 0x1901
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-
-/* Buffers, Pixel Drawing/Reading */
-#define GL_NONE 0
-#define GL_LEFT 0x0406
-#define GL_RIGHT 0x0407
-/*GL_FRONT 0x0404 */
-/*GL_BACK 0x0405 */
-/*GL_FRONT_AND_BACK 0x0408 */
-#define GL_FRONT_LEFT 0x0400
-#define GL_FRONT_RIGHT 0x0401
-#define GL_BACK_LEFT 0x0402
-#define GL_BACK_RIGHT 0x0403
-#define GL_AUX0 0x0409
-#define GL_AUX1 0x040A
-#define GL_AUX2 0x040B
-#define GL_AUX3 0x040C
-#define GL_COLOR_INDEX 0x1900
-#define GL_RED 0x1903
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_ALPHA 0x1906
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-#define GL_ALPHA_BITS 0x0D55
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_INDEX_BITS 0x0D51
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_AUX_BUFFERS 0x0C00
-#define GL_READ_BUFFER 0x0C02
-#define GL_DRAW_BUFFER 0x0C01
-#define GL_DOUBLEBUFFER 0x0C32
-#define GL_STEREO 0x0C33
-#define GL_BITMAP 0x1A00
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_DITHER 0x0BD0
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-
-/* Implementation limits */
-#define GL_MAX_LIST_NESTING 0x0B31
-#define GL_MAX_EVAL_ORDER 0x0D30
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
-#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_NAME_STACK_DEPTH 0x0D37
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
-
-/* Gets */
-#define GL_ATTRIB_STACK_DEPTH 0x0BB0
-#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_CURRENT_INDEX 0x0B01
-#define GL_CURRENT_COLOR 0x0B00
-#define GL_CURRENT_NORMAL 0x0B02
-#define GL_CURRENT_RASTER_COLOR 0x0B04
-#define GL_CURRENT_RASTER_DISTANCE 0x0B09
-#define GL_CURRENT_RASTER_INDEX 0x0B05
-#define GL_CURRENT_RASTER_POSITION 0x0B07
-#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
-#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
-#define GL_CURRENT_TEXTURE_COORDS 0x0B03
-#define GL_INDEX_CLEAR_VALUE 0x0C20
-#define GL_INDEX_MODE 0x0C30
-#define GL_INDEX_WRITEMASK 0x0C21
-#define GL_MODELVIEW_MATRIX 0x0BA6
-#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
-#define GL_NAME_STACK_DEPTH 0x0D70
-#define GL_PROJECTION_MATRIX 0x0BA7
-#define GL_PROJECTION_STACK_DEPTH 0x0BA4
-#define GL_RENDER_MODE 0x0C40
-#define GL_RGBA_MODE 0x0C31
-#define GL_TEXTURE_MATRIX 0x0BA8
-#define GL_TEXTURE_STACK_DEPTH 0x0BA5
-#define GL_VIEWPORT 0x0BA2
-
-/* Evaluators */
-#define GL_AUTO_NORMAL 0x0D80
-#define GL_MAP1_COLOR_4 0x0D90
-#define GL_MAP1_INDEX 0x0D91
-#define GL_MAP1_NORMAL 0x0D92
-#define GL_MAP1_TEXTURE_COORD_1 0x0D93
-#define GL_MAP1_TEXTURE_COORD_2 0x0D94
-#define GL_MAP1_TEXTURE_COORD_3 0x0D95
-#define GL_MAP1_TEXTURE_COORD_4 0x0D96
-#define GL_MAP1_VERTEX_3 0x0D97
-#define GL_MAP1_VERTEX_4 0x0D98
-#define GL_MAP2_COLOR_4 0x0DB0
-#define GL_MAP2_INDEX 0x0DB1
-#define GL_MAP2_NORMAL 0x0DB2
-#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
-#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
-#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
-#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
-#define GL_MAP2_VERTEX_3 0x0DB7
-#define GL_MAP2_VERTEX_4 0x0DB8
-#define GL_MAP1_GRID_DOMAIN 0x0DD0
-#define GL_MAP1_GRID_SEGMENTS 0x0DD1
-#define GL_MAP2_GRID_DOMAIN 0x0DD2
-#define GL_MAP2_GRID_SEGMENTS 0x0DD3
-#define GL_COEFF 0x0A00
-#define GL_ORDER 0x0A01
-#define GL_DOMAIN 0x0A02
-
-/* Hints */
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_POLYGON_SMOOTH_HINT 0x0C53
-#define GL_FOG_HINT 0x0C54
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* Scissor box */
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-
-/* Pixel Mode / Transfer */
-#define GL_MAP_COLOR 0x0D10
-#define GL_MAP_STENCIL 0x0D11
-#define GL_INDEX_SHIFT 0x0D12
-#define GL_INDEX_OFFSET 0x0D13
-#define GL_RED_SCALE 0x0D14
-#define GL_RED_BIAS 0x0D15
-#define GL_GREEN_SCALE 0x0D18
-#define GL_GREEN_BIAS 0x0D19
-#define GL_BLUE_SCALE 0x0D1A
-#define GL_BLUE_BIAS 0x0D1B
-#define GL_ALPHA_SCALE 0x0D1C
-#define GL_ALPHA_BIAS 0x0D1D
-#define GL_DEPTH_SCALE 0x0D1E
-#define GL_DEPTH_BIAS 0x0D1F
-#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
-#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
-#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
-#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
-#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
-#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
-#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
-#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
-#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
-#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
-#define GL_PIXEL_MAP_S_TO_S 0x0C71
-#define GL_PIXEL_MAP_I_TO_I 0x0C70
-#define GL_PIXEL_MAP_I_TO_R 0x0C72
-#define GL_PIXEL_MAP_I_TO_G 0x0C73
-#define GL_PIXEL_MAP_I_TO_B 0x0C74
-#define GL_PIXEL_MAP_I_TO_A 0x0C75
-#define GL_PIXEL_MAP_R_TO_R 0x0C76
-#define GL_PIXEL_MAP_G_TO_G 0x0C77
-#define GL_PIXEL_MAP_B_TO_B 0x0C78
-#define GL_PIXEL_MAP_A_TO_A 0x0C79
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_PACK_LSB_FIRST 0x0D01
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SWAP_BYTES 0x0D00
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_UNPACK_LSB_FIRST 0x0CF1
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SWAP_BYTES 0x0CF0
-#define GL_ZOOM_X 0x0D16
-#define GL_ZOOM_Y 0x0D17
-
-/* Texture mapping */
-#define GL_TEXTURE_ENV 0x2300
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_ENV_COLOR 0x2201
-#define GL_TEXTURE_GEN_S 0x0C60
-#define GL_TEXTURE_GEN_T 0x0C61
-#define GL_TEXTURE_GEN_R 0x0C62
-#define GL_TEXTURE_GEN_Q 0x0C63
-#define GL_TEXTURE_GEN_MODE 0x2500
-#define GL_TEXTURE_BORDER_COLOR 0x1004
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_BORDER 0x1005
-#define GL_TEXTURE_COMPONENTS 0x1003
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE 0x8061
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_OBJECT_LINEAR 0x2401
-#define GL_OBJECT_PLANE 0x2501
-#define GL_EYE_LINEAR 0x2400
-#define GL_EYE_PLANE 0x2502
-#define GL_SPHERE_MAP 0x2402
-#define GL_DECAL 0x2101
-#define GL_MODULATE 0x2100
-#define GL_NEAREST 0x2600
-#define GL_REPEAT 0x2901
-#define GL_CLAMP 0x2900
-#define GL_S 0x2000
-#define GL_T 0x2001
-#define GL_R 0x2002
-#define GL_Q 0x2003
-
-/* Utility */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* Errors */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* glPush/PopAttrib bits */
-#define GL_CURRENT_BIT 0x00000001
-#define GL_POINT_BIT 0x00000002
-#define GL_LINE_BIT 0x00000004
-#define GL_POLYGON_BIT 0x00000008
-#define GL_POLYGON_STIPPLE_BIT 0x00000010
-#define GL_PIXEL_MODE_BIT 0x00000020
-#define GL_LIGHTING_BIT 0x00000040
-#define GL_FOG_BIT 0x00000080
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_ACCUM_BUFFER_BIT 0x00000200
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_VIEWPORT_BIT 0x00000800
-#define GL_TRANSFORM_BIT 0x00001000
-#define GL_ENABLE_BIT 0x00002000
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_HINT_BIT 0x00008000
-#define GL_EVAL_BIT 0x00010000
-#define GL_LIST_BIT 0x00020000
-#define GL_TEXTURE_BIT 0x00040000
-#define GL_SCISSOR_BIT 0x00080000
-#define GL_ALL_ATTRIB_BITS 0x000FFFFF
-
-
-/* OpenGL 1.1 */
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
-#define GL_TEXTURE_PRIORITY 0x8066
-#define GL_TEXTURE_RESIDENT 0x8067
-#define GL_TEXTURE_BINDING_1D 0x8068
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
-#define GL_ALPHA4 0x803B
-#define GL_ALPHA8 0x803C
-#define GL_ALPHA12 0x803D
-#define GL_ALPHA16 0x803E
-#define GL_LUMINANCE4 0x803F
-#define GL_LUMINANCE8 0x8040
-#define GL_LUMINANCE12 0x8041
-#define GL_LUMINANCE16 0x8042
-#define GL_LUMINANCE4_ALPHA4 0x8043
-#define GL_LUMINANCE6_ALPHA2 0x8044
-#define GL_LUMINANCE8_ALPHA8 0x8045
-#define GL_LUMINANCE12_ALPHA4 0x8046
-#define GL_LUMINANCE12_ALPHA12 0x8047
-#define GL_LUMINANCE16_ALPHA16 0x8048
-#define GL_INTENSITY 0x8049
-#define GL_INTENSITY4 0x804A
-#define GL_INTENSITY8 0x804B
-#define GL_INTENSITY12 0x804C
-#define GL_INTENSITY16 0x804D
-#define GL_R3_G3_B2 0x2A10
-#define GL_RGB4 0x804F
-#define GL_RGB5 0x8050
-#define GL_RGB8 0x8051
-#define GL_RGB10 0x8052
-#define GL_RGB12 0x8053
-#define GL_RGB16 0x8054
-#define GL_RGBA2 0x8055
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
-#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
-#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
-#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
-
-
-
-/*
- * Miscellaneous
- */
-
-GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
-
-GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
-
-GLAPI void GLAPIENTRY glClear( GLbitfield mask );
-
-GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
-
-GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
-
-GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
-
-GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
-
-GLAPI void GLAPIENTRY glLogicOp( GLenum opcode );
-
-GLAPI void GLAPIENTRY glCullFace( GLenum mode );
-
-GLAPI void GLAPIENTRY glFrontFace( GLenum mode );
-
-GLAPI void GLAPIENTRY glPointSize( GLfloat size );
-
-GLAPI void GLAPIENTRY glLineWidth( GLfloat width );
-
-GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern );
-
-GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode );
-
-GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
-
-GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask );
-
-GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask );
-
-GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
-
-GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
-
-GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
-
-GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
-
-GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation );
-
-GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode );
-
-GLAPI void GLAPIENTRY glReadBuffer( GLenum mode );
-
-GLAPI void GLAPIENTRY glEnable( GLenum cap );
-
-GLAPI void GLAPIENTRY glDisable( GLenum cap );
-
-GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap );
-
-
-GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */
-
-
-GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params );
-
-GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params );
-
-GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask );
-
-GLAPI void GLAPIENTRY glPopAttrib( void );
-
-
-GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */
-
-
-GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode );
-
-GLAPI GLenum GLAPIENTRY glGetError( void );
-
-GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name );
-
-GLAPI void GLAPIENTRY glFinish( void );
-
-GLAPI void GLAPIENTRY glFlush( void );
-
-GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode );
-
-
-/*
- * Depth Buffer
- */
-
-GLAPI void GLAPIENTRY glClearDepth( GLclampd depth );
-
-GLAPI void GLAPIENTRY glDepthFunc( GLenum func );
-
-GLAPI void GLAPIENTRY glDepthMask( GLboolean flag );
-
-GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
-
-
-/*
- * Accumulation Buffer
- */
-
-GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
-
-GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
-
-
-/*
- * Transformation
- */
-
-GLAPI void GLAPIENTRY glMatrixMode( GLenum mode );
-
-GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble near_val, GLdouble far_val );
-
-GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble near_val, GLdouble far_val );
-
-GLAPI void GLAPIENTRY glViewport( GLint x, GLint y,
- GLsizei width, GLsizei height );
-
-GLAPI void GLAPIENTRY glPushMatrix( void );
-
-GLAPI void GLAPIENTRY glPopMatrix( void );
-
-GLAPI void GLAPIENTRY glLoadIdentity( void );
-
-GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m );
-GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m );
-
-GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m );
-GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m );
-
-GLAPI void GLAPIENTRY glRotated( GLdouble angle,
- GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glRotatef( GLfloat angle,
- GLfloat x, GLfloat y, GLfloat z );
-
-GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
-
-GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z );
-
-
-/*
- * Display Lists
- */
-
-GLAPI GLboolean GLAPIENTRY glIsList( GLuint list );
-
-GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range );
-
-GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range );
-
-GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode );
-
-GLAPI void GLAPIENTRY glEndList( void );
-
-GLAPI void GLAPIENTRY glCallList( GLuint list );
-
-GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type,
- const GLvoid *lists );
-
-GLAPI void GLAPIENTRY glListBase( GLuint base );
-
-
-/*
- * Drawing Functions
- */
-
-GLAPI void GLAPIENTRY glBegin( GLenum mode );
-
-GLAPI void GLAPIENTRY glEnd( void );
-
-
-GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y );
-GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y );
-GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y );
-GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y );
-
-GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z );
-GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z );
-GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z );
-
-GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w );
-GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
-
-GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glVertex2iv( const GLint *v );
-GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glVertex3iv( const GLint *v );
-GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glVertex4iv( const GLint *v );
-GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
-GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
-GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
-GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz );
-GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz );
-
-GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
-GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glNormal3iv( const GLint *v );
-GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glIndexd( GLdouble c );
-GLAPI void GLAPIENTRY glIndexf( GLfloat c );
-GLAPI void GLAPIENTRY glIndexi( GLint c );
-GLAPI void GLAPIENTRY glIndexs( GLshort c );
-GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c );
-GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c );
-GLAPI void GLAPIENTRY glIndexiv( const GLint *c );
-GLAPI void GLAPIENTRY glIndexsv( const GLshort *c );
-GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */
-
-GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue );
-GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue );
-GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue );
-GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue );
-GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue );
-GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
-GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue );
-GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue );
-
-GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green,
- GLbyte blue, GLbyte alpha );
-GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green,
- GLdouble blue, GLdouble alpha );
-GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green,
- GLfloat blue, GLfloat alpha );
-GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green,
- GLint blue, GLint alpha );
-GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green,
- GLshort blue, GLshort alpha );
-GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha );
-GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green,
- GLuint blue, GLuint alpha );
-GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green,
- GLushort blue, GLushort alpha );
-
-
-GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v );
-GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glColor3iv( const GLint *v );
-GLAPI void GLAPIENTRY glColor3sv( const GLshort *v );
-GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v );
-GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v );
-GLAPI void GLAPIENTRY glColor3usv( const GLushort *v );
-
-GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v );
-GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glColor4iv( const GLint *v );
-GLAPI void GLAPIENTRY glColor4sv( const GLshort *v );
-GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v );
-GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v );
-GLAPI void GLAPIENTRY glColor4usv( const GLushort *v );
-
-
-GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s );
-GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s );
-GLAPI void GLAPIENTRY glTexCoord1i( GLint s );
-GLAPI void GLAPIENTRY glTexCoord1s( GLshort s );
-
-GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t );
-GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t );
-GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t );
-GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t );
-
-GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
-GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
-GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r );
-GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r );
-
-GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
-GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q );
-GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
-
-GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v );
-GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y );
-GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y );
-GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y );
-GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y );
-
-GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
-GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
-GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z );
-GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z );
-
-GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w );
-GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
-
-GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v );
-GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v );
-GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v );
-
-GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v );
-GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v );
-GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v );
-GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
-GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
-GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
-GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
-
-
-GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 );
-GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 );
-GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 );
-GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 );
-
-
-/*
- * Vertex Arrays (1.1)
- */
-
-GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride,
- const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride,
- const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr );
-
-GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params );
-
-GLAPI void GLAPIENTRY glArrayElement( GLint i );
-
-GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
-
-GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count,
- GLenum type, const GLvoid *indices );
-
-GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride,
- const GLvoid *pointer );
-
-/*
- * Lighting
- */
-
-GLAPI void GLAPIENTRY glShadeModel( GLenum mode );
-
-GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param );
-GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname,
- const GLfloat *params );
-GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname,
- const GLint *params );
-
-GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname,
- GLfloat *params );
-GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param );
-GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param );
-GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params );
-
-GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode );
-
-
-/*
- * Raster functions
- */
-
-GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor );
-
-GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize,
- const GLfloat *values );
-GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize,
- const GLuint *values );
-GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize,
- const GLushort *values );
-
-GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values );
-GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values );
-GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values );
-
-GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height,
- GLfloat xorig, GLfloat yorig,
- GLfloat xmove, GLfloat ymove,
- const GLubyte *bitmap );
-
-GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum type );
-
-/*
- * Stenciling
- */
-
-GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask );
-
-GLAPI void GLAPIENTRY glStencilMask( GLuint mask );
-
-GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
-
-GLAPI void GLAPIENTRY glClearStencil( GLint s );
-
-
-
-/*
- * Texture mapping
- */
-
-GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param );
-GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params );
-GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
-GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
-GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param );
-GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname,
- const GLfloat *params );
-GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname,
- const GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target,
- GLenum pname, GLfloat *params);
-GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target,
- GLenum pname, GLint *params );
-
-GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level,
- GLenum pname, GLfloat *params );
-GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level,
- GLenum pname, GLint *params );
-
-
-GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level,
- GLenum format, GLenum type,
- GLvoid *pixels );
-
-
-/* 1.1 functions */
-
-GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures );
-
-GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures);
-
-GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture );
-
-GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n,
- const GLuint *textures,
- const GLclampf *priorities );
-
-GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n,
- const GLuint *textures,
- GLboolean *residences );
-
-GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture );
-
-
-GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level,
- GLint xoffset,
- GLsizei width, GLenum format,
- GLenum type, const GLvoid *pixels );
-
-
-GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-
-GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y,
- GLsizei width, GLint border );
-
-
-GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level,
- GLenum internalformat,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLint border );
-
-
-GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y,
- GLsizei width );
-
-
-GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
-
-
-/*
- * Evaluators
- */
-
-GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2,
- GLint stride,
- GLint order, const GLdouble *points );
-GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2,
- GLint stride,
- GLint order, const GLfloat *points );
-
-GLAPI void GLAPIENTRY glMap2d( GLenum target,
- GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
- GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
- const GLdouble *points );
-GLAPI void GLAPIENTRY glMap2f( GLenum target,
- GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
- GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
- const GLfloat *points );
-
-GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v );
-GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v );
-GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v );
-
-GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u );
-GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u );
-
-GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u );
-GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u );
-
-GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v );
-GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v );
-
-GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u );
-GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u );
-
-GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
-GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
-
-GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2,
- GLint vn, GLdouble v1, GLdouble v2 );
-GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2,
- GLint vn, GLfloat v1, GLfloat v2 );
-
-GLAPI void GLAPIENTRY glEvalPoint1( GLint i );
-
-GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j );
-
-GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 );
-
-GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
-
-
-/*
- * Fog
- */
-
-GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param );
-
-GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param );
-
-GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params );
-
-GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params );
-
-
-/*
- * Selection and Feedback
- */
-
-GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
-
-GLAPI void GLAPIENTRY glPassThrough( GLfloat token );
-
-GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer );
-
-GLAPI void GLAPIENTRY glInitNames( void );
-
-GLAPI void GLAPIENTRY glLoadName( GLuint name );
-
-GLAPI void GLAPIENTRY glPushName( GLuint name );
-
-GLAPI void GLAPIENTRY glPopName( void );
-
-
-
-/*
- * OpenGL 1.2
- */
-
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_INT_8_8_8_8 0x8035
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_PACK_SKIP_IMAGES 0x806B
-#define GL_PACK_IMAGE_HEIGHT 0x806C
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_PROXY_TEXTURE_3D 0x8070
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_TEXTURE_BINDING_3D 0x806A
-
-GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start,
- GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
-
-GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLsizei height,
- GLsizei depth, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels );
-
-GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth,
- GLenum format,
- GLenum type, const GLvoid *pixels);
-
-GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint zoffset, GLint x,
- GLint y, GLsizei width,
- GLsizei height );
-
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-
-
-/*
- * GL_ARB_imaging
- */
-
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_COLOR_TABLE 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
-#define GL_PROXY_COLOR_TABLE 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
-#define GL_COLOR_TABLE_SCALE 0x80D6
-#define GL_COLOR_TABLE_BIAS 0x80D7
-#define GL_COLOR_TABLE_FORMAT 0x80D8
-#define GL_COLOR_TABLE_WIDTH 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
-#define GL_CONVOLUTION_1D 0x8010
-#define GL_CONVOLUTION_2D 0x8011
-#define GL_SEPARABLE_2D 0x8012
-#define GL_CONVOLUTION_BORDER_MODE 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS 0x8015
-#define GL_REDUCE 0x8016
-#define GL_CONVOLUTION_FORMAT 0x8017
-#define GL_CONVOLUTION_WIDTH 0x8018
-#define GL_CONVOLUTION_HEIGHT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
-#define GL_CONSTANT_BORDER 0x8151
-#define GL_REPLICATE_BORDER 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR 0x8154
-#define GL_COLOR_MATRIX 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
-#define GL_HISTOGRAM 0x8024
-#define GL_PROXY_HISTOGRAM 0x8025
-#define GL_HISTOGRAM_WIDTH 0x8026
-#define GL_HISTOGRAM_FORMAT 0x8027
-#define GL_HISTOGRAM_RED_SIZE 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
-#define GL_HISTOGRAM_SINK 0x802D
-#define GL_MINMAX 0x802E
-#define GL_MINMAX_FORMAT 0x802F
-#define GL_MINMAX_SINK 0x8030
-#define GL_TABLE_TOO_LARGE 0x8031
-#define GL_BLEND_EQUATION 0x8009
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_FUNC_ADD 0x8006
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_BLEND_COLOR 0x8005
-
-
-GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
- GLsizei width, GLenum format,
- GLenum type, const GLvoid *table );
-
-GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
- GLsizei start, GLsizei count,
- GLenum format, GLenum type,
- const GLvoid *data );
-
-GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
- const GLint *params);
-
-GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
- const GLfloat *params);
-
-GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
- GLint x, GLint y, GLsizei width );
-
-GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
- GLint x, GLint y, GLsizei width );
-
-GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
- GLenum type, GLvoid *table );
-
-GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
-
-GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
- GLclampf blue, GLclampf alpha );
-
-GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
- GLenum internalformat, GLboolean sink );
-
-GLAPI void GLAPIENTRY glResetHistogram( GLenum target );
-
-GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
- GLenum format, GLenum type,
- GLvoid *values );
-
-GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
- GLboolean sink );
-
-GLAPI void GLAPIENTRY glResetMinmax( GLenum target );
-
-GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
- GLenum format, GLenum types,
- GLvoid *values );
-
-GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
- GLenum internalformat, GLsizei width, GLenum format, GLenum type,
- const GLvoid *image );
-
-GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
- GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *image );
-
-GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
- GLfloat params );
-
-GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
- const GLfloat *params );
-
-GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
- GLint params );
-
-GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
- const GLint *params );
-
-GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
- GLenum internalformat, GLint x, GLint y, GLsizei width );
-
-GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
- GLenum internalformat, GLint x, GLint y, GLsizei width,
- GLsizei height);
-
-GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
- GLenum type, GLvoid *image );
-
-GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
- GLfloat *params );
-
-GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
- GLint *params );
-
-GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
- GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *row, const GLvoid *column );
-
-GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
- GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
-
-
-
-
-/*
- * OpenGL 1.3
- */
-
-/* multitexture */
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-/* texture_cube_map */
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-/* texture_compression */
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
-#define GL_COMPRESSED_RGB 0x84ED
-#define GL_COMPRESSED_RGBA 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-/* multisample */
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_MULTISAMPLE_BIT 0x20000000
-/* transpose_matrix */
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
-/* texture_env_combine */
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_SOURCE0_RGB 0x8580
-#define GL_SOURCE1_RGB 0x8581
-#define GL_SOURCE2_RGB 0x8582
-#define GL_SOURCE0_ALPHA 0x8588
-#define GL_SOURCE1_ALPHA 0x8589
-#define GL_SOURCE2_ALPHA 0x858A
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_SUBTRACT 0x84E7
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-/* texture_env_dot3 */
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-/* texture_border_clamp */
-#define GL_CLAMP_TO_BORDER 0x812D
-
-GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
-
-GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
-
-GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
-
-GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
-
-GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
-
-GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
-
-GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
-
-GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
-
-
-GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
-
-GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
-
-GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
-
-GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
-
-GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
-
-
-typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
-
-
-
-/*
- * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
- */
-#ifndef GL_ARB_multitexture
-#define GL_ARB_multitexture 1
-
-#define GL_TEXTURE0_ARB 0x84C0
-#define GL_TEXTURE1_ARB 0x84C1
-#define GL_TEXTURE2_ARB 0x84C2
-#define GL_TEXTURE3_ARB 0x84C3
-#define GL_TEXTURE4_ARB 0x84C4
-#define GL_TEXTURE5_ARB 0x84C5
-#define GL_TEXTURE6_ARB 0x84C6
-#define GL_TEXTURE7_ARB 0x84C7
-#define GL_TEXTURE8_ARB 0x84C8
-#define GL_TEXTURE9_ARB 0x84C9
-#define GL_TEXTURE10_ARB 0x84CA
-#define GL_TEXTURE11_ARB 0x84CB
-#define GL_TEXTURE12_ARB 0x84CC
-#define GL_TEXTURE13_ARB 0x84CD
-#define GL_TEXTURE14_ARB 0x84CE
-#define GL_TEXTURE15_ARB 0x84CF
-#define GL_TEXTURE16_ARB 0x84D0
-#define GL_TEXTURE17_ARB 0x84D1
-#define GL_TEXTURE18_ARB 0x84D2
-#define GL_TEXTURE19_ARB 0x84D3
-#define GL_TEXTURE20_ARB 0x84D4
-#define GL_TEXTURE21_ARB 0x84D5
-#define GL_TEXTURE22_ARB 0x84D6
-#define GL_TEXTURE23_ARB 0x84D7
-#define GL_TEXTURE24_ARB 0x84D8
-#define GL_TEXTURE25_ARB 0x84D9
-#define GL_TEXTURE26_ARB 0x84DA
-#define GL_TEXTURE27_ARB 0x84DB
-#define GL_TEXTURE28_ARB 0x84DC
-#define GL_TEXTURE29_ARB 0x84DD
-#define GL_TEXTURE30_ARB 0x84DE
-#define GL_TEXTURE31_ARB 0x84DF
-#define GL_ACTIVE_TEXTURE_ARB 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
-#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
-
-GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
-GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture);
-GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s);
-GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s);
-GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s);
-GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s);
-GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
-GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
-GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
-GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
-GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
-GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
-GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
-GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
-GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
-GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
-GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
-
-typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
-
-#endif /* GL_ARB_multitexture */
-
-
-
-/*
- * Define this token if you want "old-style" header file behaviour (extensions
- * defined in gl.h). Otherwise, extensions will be included from glext.h.
- */
-#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
-#include "SDL_opengl_glext.h"
-#endif /* GL_GLEXT_LEGACY */
-
-
-
-/*
- * ???. GL_MESA_packed_depth_stencil
- * XXX obsolete
- */
-#ifndef GL_MESA_packed_depth_stencil
-#define GL_MESA_packed_depth_stencil 1
-
-#define GL_DEPTH_STENCIL_MESA 0x8750
-#define GL_UNSIGNED_INT_24_8_MESA 0x8751
-#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
-#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753
-#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
-
-#endif /* GL_MESA_packed_depth_stencil */
-
-
-#ifndef GL_ATI_blend_equation_separate
-#define GL_ATI_blend_equation_separate 1
-
-#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D
-
-GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA );
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA);
-
-#endif /* GL_ATI_blend_equation_separate */
-
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-typedef void* GLeglImageOES;
-#endif
-
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#endif
-
-
-/**
- ** NOTE!!!!! If you add new functions to this file, or update
- ** glext.h be sure to regenerate the gl_mangle.h file. See comments
- ** in that file for details.
- **/
-
-
-
-/**********************************************************************
- * Begin system-specific stuff
- */
-#if defined(PRAGMA_EXPORT_SUPPORTED)
-#pragma export off
-#endif
-
-/*
- * End system-specific stuff
- **********************************************************************/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl_h_ */
-
-#endif /* !__IPHONEOS__ */
-
-#endif /* SDL_opengl_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles.h
deleted file mode 100644
index 800c593..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_opengles.h
- *
- * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
- */
-#include "SDL_config.h"
-
-#ifdef __IPHONEOS__
-#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES1/glext.h>
-#else
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2.h
deleted file mode 100644
index 102f2f3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_opengles2.h
- *
- * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
- */
-#include "SDL_config.h"
-
-#ifndef _MSC_VER
-
-#ifdef __IPHONEOS__
-#include <OpenGLES/ES2/gl.h>
-#include <OpenGLES/ES2/glext.h>
-#else
-#include <GLES2/gl2platform.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#endif
-
-#else /* _MSC_VER */
-
-/* OpenGL ES2 headers for Visual Studio */
-#include "SDL_opengles2_khrplatform.h"
-#include "SDL_opengles2_gl2platform.h"
-#include "SDL_opengles2_gl2.h"
-#include "SDL_opengles2_gl2ext.h"
-
-#endif /* _MSC_VER */
-
-#ifndef APIENTRY
-#define APIENTRY GL_APIENTRY
-#endif
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_pixels.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_pixels.h
deleted file mode 100644
index 0424668..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_pixels.h
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_pixels.h
- *
- * Header for the enumerated pixel format definitions.
- */
-
-#ifndef SDL_pixels_h_
-#define SDL_pixels_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_endian.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name Transparency definitions
- *
- * These define alpha as the opacity of a surface.
- */
-/* @{ */
-#define SDL_ALPHA_OPAQUE 255
-#define SDL_ALPHA_TRANSPARENT 0
-/* @} */
-
-/** Pixel type. */
-enum
-{
- SDL_PIXELTYPE_UNKNOWN,
- SDL_PIXELTYPE_INDEX1,
- SDL_PIXELTYPE_INDEX4,
- SDL_PIXELTYPE_INDEX8,
- SDL_PIXELTYPE_PACKED8,
- SDL_PIXELTYPE_PACKED16,
- SDL_PIXELTYPE_PACKED32,
- SDL_PIXELTYPE_ARRAYU8,
- SDL_PIXELTYPE_ARRAYU16,
- SDL_PIXELTYPE_ARRAYU32,
- SDL_PIXELTYPE_ARRAYF16,
- SDL_PIXELTYPE_ARRAYF32
-};
-
-/** Bitmap pixel order, high bit -> low bit. */
-enum
-{
- SDL_BITMAPORDER_NONE,
- SDL_BITMAPORDER_4321,
- SDL_BITMAPORDER_1234
-};
-
-/** Packed component order, high bit -> low bit. */
-enum
-{
- SDL_PACKEDORDER_NONE,
- SDL_PACKEDORDER_XRGB,
- SDL_PACKEDORDER_RGBX,
- SDL_PACKEDORDER_ARGB,
- SDL_PACKEDORDER_RGBA,
- SDL_PACKEDORDER_XBGR,
- SDL_PACKEDORDER_BGRX,
- SDL_PACKEDORDER_ABGR,
- SDL_PACKEDORDER_BGRA
-};
-
-/** Array component order, low byte -> high byte. */
-/* !!! FIXME: in 2.1, make these not overlap differently with
- !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
-enum
-{
- SDL_ARRAYORDER_NONE,
- SDL_ARRAYORDER_RGB,
- SDL_ARRAYORDER_RGBA,
- SDL_ARRAYORDER_ARGB,
- SDL_ARRAYORDER_BGR,
- SDL_ARRAYORDER_BGRA,
- SDL_ARRAYORDER_ABGR
-};
-
-/** Packed component layout. */
-enum
-{
- SDL_PACKEDLAYOUT_NONE,
- SDL_PACKEDLAYOUT_332,
- SDL_PACKEDLAYOUT_4444,
- SDL_PACKEDLAYOUT_1555,
- SDL_PACKEDLAYOUT_5551,
- SDL_PACKEDLAYOUT_565,
- SDL_PACKEDLAYOUT_8888,
- SDL_PACKEDLAYOUT_2101010,
- SDL_PACKEDLAYOUT_1010102
-};
-
-#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
-
-#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
- ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
- ((bits) << 8) | ((bytes) << 0))
-
-#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
-#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
-#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
-#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
-#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
-#define SDL_BYTESPERPIXEL(X) \
- (SDL_ISPIXELFORMAT_FOURCC(X) ? \
- ((((X) == SDL_PIXELFORMAT_YUY2) || \
- ((X) == SDL_PIXELFORMAT_UYVY) || \
- ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
-
-#define SDL_ISPIXELFORMAT_INDEXED(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
-
-#define SDL_ISPIXELFORMAT_PACKED(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
-
-#define SDL_ISPIXELFORMAT_ARRAY(format) \
- (!SDL_ISPIXELFORMAT_FOURCC(format) && \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
-
-#define SDL_ISPIXELFORMAT_ALPHA(format) \
- ((SDL_ISPIXELFORMAT_PACKED(format) && \
- ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
- (SDL_ISPIXELFORMAT_ARRAY(format) && \
- ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
- (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
- (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
- (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
-
-/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
-#define SDL_ISPIXELFORMAT_FOURCC(format) \
- ((format) && (SDL_PIXELFLAG(format) != 1))
-
-/* Note: If you modify this list, update SDL_GetPixelFormatName() */
-enum
-{
- SDL_PIXELFORMAT_UNKNOWN,
- SDL_PIXELFORMAT_INDEX1LSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
- 1, 0),
- SDL_PIXELFORMAT_INDEX1MSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
- 1, 0),
- SDL_PIXELFORMAT_INDEX4LSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
- 4, 0),
- SDL_PIXELFORMAT_INDEX4MSB =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
- 4, 0),
- SDL_PIXELFORMAT_INDEX8 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
- SDL_PIXELFORMAT_RGB332 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_332, 8, 1),
- SDL_PIXELFORMAT_RGB444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_4444, 12, 2),
- SDL_PIXELFORMAT_RGB555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_1555, 15, 2),
- SDL_PIXELFORMAT_BGR555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_1555, 15, 2),
- SDL_PIXELFORMAT_ARGB4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_RGBA4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_ABGR4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_BGRA4444 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
- SDL_PACKEDLAYOUT_4444, 16, 2),
- SDL_PIXELFORMAT_ARGB1555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_1555, 16, 2),
- SDL_PIXELFORMAT_RGBA5551 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
- SDL_PACKEDLAYOUT_5551, 16, 2),
- SDL_PIXELFORMAT_ABGR1555 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
- SDL_PACKEDLAYOUT_1555, 16, 2),
- SDL_PIXELFORMAT_BGRA5551 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
- SDL_PACKEDLAYOUT_5551, 16, 2),
- SDL_PIXELFORMAT_RGB565 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_565, 16, 2),
- SDL_PIXELFORMAT_BGR565 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_565, 16, 2),
- SDL_PIXELFORMAT_RGB24 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
- 24, 3),
- SDL_PIXELFORMAT_BGR24 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
- 24, 3),
- SDL_PIXELFORMAT_RGB888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_RGBX8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_BGR888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_BGRX8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
- SDL_PACKEDLAYOUT_8888, 24, 4),
- SDL_PIXELFORMAT_ARGB8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_RGBA8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_ABGR8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_BGRA8888 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
- SDL_PACKEDLAYOUT_8888, 32, 4),
- SDL_PIXELFORMAT_ARGB2101010 =
- SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
- SDL_PACKEDLAYOUT_2101010, 32, 4),
-
- /* Aliases for RGBA byte arrays of color data, for the current platform */
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
- SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
- SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
- SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
-#else
- SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
- SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
- SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
- SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
-#endif
-
- SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
- SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
- SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
- SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
- SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
- SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
- SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
- SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
- SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
- SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
- SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
- SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
-};
-
-typedef struct SDL_Color
-{
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 a;
-} SDL_Color;
-#define SDL_Colour SDL_Color
-
-typedef struct SDL_Palette
-{
- int ncolors;
- SDL_Color *colors;
- Uint32 version;
- int refcount;
-} SDL_Palette;
-
-/**
- * \note Everything in the pixel format structure is read-only.
- */
-typedef struct SDL_PixelFormat
-{
- Uint32 format;
- SDL_Palette *palette;
- Uint8 BitsPerPixel;
- Uint8 BytesPerPixel;
- Uint8 padding[2];
- Uint32 Rmask;
- Uint32 Gmask;
- Uint32 Bmask;
- Uint32 Amask;
- Uint8 Rloss;
- Uint8 Gloss;
- Uint8 Bloss;
- Uint8 Aloss;
- Uint8 Rshift;
- Uint8 Gshift;
- Uint8 Bshift;
- Uint8 Ashift;
- int refcount;
- struct SDL_PixelFormat *next;
-} SDL_PixelFormat;
-
-/**
- * \brief Get the human readable name of a pixel format
- */
-extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
-
-/**
- * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
- *
- * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
- *
- * \sa SDL_MasksToPixelFormatEnum()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
- int *bpp,
- Uint32 * Rmask,
- Uint32 * Gmask,
- Uint32 * Bmask,
- Uint32 * Amask);
-
-/**
- * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
- *
- * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
- * wasn't possible.
- *
- * \sa SDL_PixelFormatEnumToMasks()
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
- Uint32 Rmask,
- Uint32 Gmask,
- Uint32 Bmask,
- Uint32 Amask);
-
-/**
- * \brief Create an SDL_PixelFormat structure from a pixel format enum.
- */
-extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
-
-/**
- * \brief Free an SDL_PixelFormat structure.
- */
-extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
-
-/**
- * \brief Create a palette structure with the specified number of color
- * entries.
- *
- * \return A new palette, or NULL if there wasn't enough memory.
- *
- * \note The palette entries are initialized to white.
- *
- * \sa SDL_FreePalette()
- */
-extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
-
-/**
- * \brief Set the palette for a pixel format structure.
- */
-extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
- SDL_Palette *palette);
-
-/**
- * \brief Set a range of colors in a palette.
- *
- * \param palette The palette to modify.
- * \param colors An array of colors to copy into the palette.
- * \param firstcolor The index of the first palette entry to modify.
- * \param ncolors The number of entries to modify.
- *
- * \return 0 on success, or -1 if not all of the colors could be set.
- */
-extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
- const SDL_Color * colors,
- int firstcolor, int ncolors);
-
-/**
- * \brief Free a palette created with SDL_AllocPalette().
- *
- * \sa SDL_AllocPalette()
- */
-extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
-
-/**
- * \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
- *
- * \sa SDL_MapRGBA
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
- Uint8 r, Uint8 g, Uint8 b);
-
-/**
- * \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
- *
- * \sa SDL_MapRGB
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
- Uint8 r, Uint8 g, Uint8 b,
- Uint8 a);
-
-/**
- * \brief Get the RGB components from a pixel of the specified format.
- *
- * \sa SDL_GetRGBA
- */
-extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
- const SDL_PixelFormat * format,
- Uint8 * r, Uint8 * g, Uint8 * b);
-
-/**
- * \brief Get the RGBA components from a pixel of the specified format.
- *
- * \sa SDL_GetRGB
- */
-extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
- const SDL_PixelFormat * format,
- Uint8 * r, Uint8 * g, Uint8 * b,
- Uint8 * a);
-
-/**
- * \brief Calculate a 256 entry gamma ramp for a gamma value.
- */
-extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_pixels_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_platform.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_platform.h
deleted file mode 100644
index 9dde385..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_platform.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_platform.h
- *
- * Try to get a standard set of platform defines.
- */
-
-#ifndef SDL_platform_h_
-#define SDL_platform_h_
-
-#if defined(_AIX)
-#undef __AIX__
-#define __AIX__ 1
-#endif
-#if defined(__HAIKU__)
-#undef __HAIKU__
-#define __HAIKU__ 1
-#endif
-#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
-#undef __BSDI__
-#define __BSDI__ 1
-#endif
-#if defined(_arch_dreamcast)
-#undef __DREAMCAST__
-#define __DREAMCAST__ 1
-#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#undef __FREEBSD__
-#define __FREEBSD__ 1
-#endif
-#if defined(hpux) || defined(__hpux) || defined(__hpux__)
-#undef __HPUX__
-#define __HPUX__ 1
-#endif
-#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
-#undef __IRIX__
-#define __IRIX__ 1
-#endif
-#if (defined(linux) || defined(__linux) || defined(__linux__))
-#undef __LINUX__
-#define __LINUX__ 1
-#endif
-#if defined(ANDROID) || defined(__ANDROID__)
-#undef __ANDROID__
-#undef __LINUX__ /* do we need to do this? */
-#define __ANDROID__ 1
-#endif
-
-#if defined(__APPLE__)
-/* lets us know what version of Mac OS X we're compiling on */
-#include "AvailabilityMacros.h"
-#include "TargetConditionals.h"
-#if TARGET_OS_TV
-#undef __TVOS__
-#define __TVOS__ 1
-#endif
-#if TARGET_OS_IPHONE
-/* if compiling for iOS */
-#undef __IPHONEOS__
-#define __IPHONEOS__ 1
-#undef __MACOSX__
-#else
-/* if not compiling for iOS */
-#undef __MACOSX__
-#define __MACOSX__ 1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
-# error SDL for Mac OS X only supports deploying on 10.6 and above.
-#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
-#endif /* TARGET_OS_IPHONE */
-#endif /* defined(__APPLE__) */
-
-#if defined(__NetBSD__)
-#undef __NETBSD__
-#define __NETBSD__ 1
-#endif
-#if defined(__OpenBSD__)
-#undef __OPENBSD__
-#define __OPENBSD__ 1
-#endif
-#if defined(__OS2__) || defined(__EMX__)
-#undef __OS2__
-#define __OS2__ 1
-#endif
-#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
-#undef __OSF__
-#define __OSF__ 1
-#endif
-#if defined(__QNXNTO__)
-#undef __QNXNTO__
-#define __QNXNTO__ 1
-#endif
-#if defined(riscos) || defined(__riscos) || defined(__riscos__)
-#undef __RISCOS__
-#define __RISCOS__ 1
-#endif
-#if defined(__sun) && defined(__SVR4)
-#undef __SOLARIS__
-#define __SOLARIS__ 1
-#endif
-
-#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
-/* Try to find out if we're compiling for WinRT or non-WinRT */
-#if defined(_MSC_VER) && defined(__has_include)
-#define HAVE_WINAPIFAMILY_H __has_include(<winapifamily.h>)
-/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
-#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
-#define HAVE_WINAPIFAMILY_H 1
-#else
-#define HAVE_WINAPIFAMILY_H 0
-#endif
-
-#if HAVE_WINAPIFAMILY_H
-#include <winapifamily.h>
-#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
-#else
-#define WINAPI_FAMILY_WINRT 0
-#endif /* HAVE_WINAPIFAMILY_H */
-
-#if WINAPI_FAMILY_WINRT
-#undef __WINRT__
-#define __WINRT__ 1
-#else
-#undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif
-#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
-
-#if defined(__WINDOWS__)
-#undef __WIN32__
-#define __WIN32__ 1
-#endif
-#if defined(__PSP__)
-#undef __PSP__
-#define __PSP__ 1
-#endif
-
-/* The NACL compiler defines __native_client__ and __pnacl__
- * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
- */
-#if defined(__native_client__)
-#undef __LINUX__
-#undef __NACL__
-#define __NACL__ 1
-#endif
-#if defined(__pnacl__)
-#undef __LINUX__
-#undef __PNACL__
-#define __PNACL__ 1
-/* PNACL with newlib supports static linking only */
-#define __SDL_NOGETPROCADDR__
-#endif
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Gets the name of the platform.
- */
-extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_platform_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_power.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_power.h
deleted file mode 100644
index d48e8a3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_power.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_power_h_
-#define SDL_power_h_
-
-/**
- * \file SDL_power.h
- *
- * Header for the SDL power management routines.
- */
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The basic state for the system's power supply.
- */
-typedef enum
-{
- SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
- SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
- SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
- SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
- SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
-} SDL_PowerState;
-
-
-/**
- * \brief Get the current power supply details.
- *
- * \param secs Seconds of battery life left. You can pass a NULL here if
- * you don't care. Will return -1 if we can't determine a
- * value, or we're not running on a battery.
- *
- * \param pct Percentage of battery life left, between 0 and 100. You can
- * pass a NULL here if you don't care. Will return -1 if we
- * can't determine a value, or we're not running on a battery.
- *
- * \return The state of the battery (if any).
- */
-extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_power_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_quit.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_quit.h
deleted file mode 100644
index 9283c38..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_quit.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_quit.h
- *
- * Include file for SDL quit event handling.
- */
-
-#ifndef SDL_quit_h_
-#define SDL_quit_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-/**
- * \file SDL_quit.h
- *
- * An ::SDL_QUIT event is generated when the user tries to close the application
- * window. If it is ignored or filtered out, the window will remain open.
- * If it is not ignored or filtered, it is queued normally and the window
- * is allowed to close. When the window is closed, screen updates will
- * complete, but have no effect.
- *
- * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
- * and SIGTERM (system termination request), if handlers do not already
- * exist, that generate ::SDL_QUIT events as well. There is no way
- * to determine the cause of an ::SDL_QUIT event, but setting a signal
- * handler in your application will override the default generation of
- * quit events for that signal.
- *
- * \sa SDL_Quit()
- */
-
-/* There are no functions directly affecting the quit event */
-
-#define SDL_QuitRequested() \
- (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
-
-#endif /* SDL_quit_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_rect.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_rect.h
deleted file mode 100644
index c4f6d74..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_rect.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_rect.h
- *
- * Header file for SDL_rect definition and management functions.
- */
-
-#ifndef SDL_rect_h_
-#define SDL_rect_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_pixels.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The structure that defines a point
- *
- * \sa SDL_EnclosePoints
- * \sa SDL_PointInRect
- */
-typedef struct SDL_Point
-{
- int x;
- int y;
-} SDL_Point;
-
-/**
- * \brief A rectangle, with the origin at the upper left.
- *
- * \sa SDL_RectEmpty
- * \sa SDL_RectEquals
- * \sa SDL_HasIntersection
- * \sa SDL_IntersectRect
- * \sa SDL_UnionRect
- * \sa SDL_EnclosePoints
- */
-typedef struct SDL_Rect
-{
- int x, y;
- int w, h;
-} SDL_Rect;
-
-/**
- * \brief Returns true if point resides inside a rectangle.
- */
-SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
-{
- return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
- (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
-}
-
-/**
- * \brief Returns true if the rectangle has no area.
- */
-SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
-{
- return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
-}
-
-/**
- * \brief Returns true if the two rectangles are equal.
- */
-SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
-{
- return (a && b && (a->x == b->x) && (a->y == b->y) &&
- (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
-}
-
-/**
- * \brief Determine whether two rectangles intersect.
- *
- * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
- const SDL_Rect * B);
-
-/**
- * \brief Calculate the intersection of two rectangles.
- *
- * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
- const SDL_Rect * B,
- SDL_Rect * result);
-
-/**
- * \brief Calculate the union of two rectangles.
- */
-extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
- const SDL_Rect * B,
- SDL_Rect * result);
-
-/**
- * \brief Calculate a minimal rectangle enclosing a set of points
- *
- * \return SDL_TRUE if any points were within the clipping rect
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
- int count,
- const SDL_Rect * clip,
- SDL_Rect * result);
-
-/**
- * \brief Calculate the intersection of a rectangle and line segment.
- *
- * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
- rect, int *X1,
- int *Y1, int *X2,
- int *Y2);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_rect_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_render.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_render.h
deleted file mode 100644
index ea6ef9f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_render.h
+++ /dev/null
@@ -1,910 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_render.h
- *
- * Header file for SDL 2D rendering functions.
- *
- * This API supports the following features:
- * * single pixel points
- * * single pixel lines
- * * filled rectangles
- * * texture images
- *
- * The primitives may be drawn in opaque, blended, or additive modes.
- *
- * The texture images may be drawn in opaque, blended, or additive modes.
- * They can have an additional color tint or alpha modulation applied to
- * them, and may also be stretched with linear interpolation.
- *
- * This API is designed to accelerate simple 2D operations. You may
- * want more functionality such as polygons and particle effects and
- * in that case you should use SDL's OpenGL/Direct3D support or one
- * of the many good 3D engines.
- *
- * These functions must be called from the main thread.
- * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
- */
-
-#ifndef SDL_render_h_
-#define SDL_render_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_rect.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Flags used when creating a rendering context
- */
-typedef enum
-{
- SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
- SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
- acceleration */
- SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
- with the refresh rate */
- SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
- rendering to texture */
-} SDL_RendererFlags;
-
-/**
- * \brief Information on the capabilities of a render driver or context.
- */
-typedef struct SDL_RendererInfo
-{
- const char *name; /**< The name of the renderer */
- Uint32 flags; /**< Supported ::SDL_RendererFlags */
- Uint32 num_texture_formats; /**< The number of available texture formats */
- Uint32 texture_formats[16]; /**< The available texture formats */
- int max_texture_width; /**< The maximum texture width */
- int max_texture_height; /**< The maximum texture height */
-} SDL_RendererInfo;
-
-/**
- * \brief The access pattern allowed for a texture.
- */
-typedef enum
-{
- SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
- SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
- SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
-} SDL_TextureAccess;
-
-/**
- * \brief The texture channel modulation used in SDL_RenderCopy().
- */
-typedef enum
-{
- SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
- SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
- SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
-} SDL_TextureModulate;
-
-/**
- * \brief Flip constants for SDL_RenderCopyEx
- */
-typedef enum
-{
- SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
- SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
- SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
-} SDL_RendererFlip;
-
-/**
- * \brief A structure representing rendering state
- */
-struct SDL_Renderer;
-typedef struct SDL_Renderer SDL_Renderer;
-
-/**
- * \brief An efficient driver-specific representation of pixel data
- */
-struct SDL_Texture;
-typedef struct SDL_Texture SDL_Texture;
-
-
-/* Function prototypes */
-
-/**
- * \brief Get the number of 2D rendering drivers available for the current
- * display.
- *
- * A render driver is a set of code that handles rendering and texture
- * management on a particular display. Normally there is only one, but
- * some drivers may have several available with different capabilities.
- *
- * \sa SDL_GetRenderDriverInfo()
- * \sa SDL_CreateRenderer()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
-
-/**
- * \brief Get information about a specific 2D rendering driver for the current
- * display.
- *
- * \param index The index of the driver to query information about.
- * \param info A pointer to an SDL_RendererInfo struct to be filled with
- * information on the rendering driver.
- *
- * \return 0 on success, -1 if the index was out of range.
- *
- * \sa SDL_CreateRenderer()
- */
-extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
- SDL_RendererInfo * info);
-
-/**
- * \brief Create a window and default renderer
- *
- * \param width The width of the window
- * \param height The height of the window
- * \param window_flags The flags used to create the window
- * \param window A pointer filled with the window, or NULL on error
- * \param renderer A pointer filled with the renderer, or NULL on error
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
- int width, int height, Uint32 window_flags,
- SDL_Window **window, SDL_Renderer **renderer);
-
-
-/**
- * \brief Create a 2D rendering context for a window.
- *
- * \param window The window where rendering is displayed.
- * \param index The index of the rendering driver to initialize, or -1 to
- * initialize the first one supporting the requested flags.
- * \param flags ::SDL_RendererFlags.
- *
- * \return A valid rendering context or NULL if there was an error.
- *
- * \sa SDL_CreateSoftwareRenderer()
- * \sa SDL_GetRendererInfo()
- * \sa SDL_DestroyRenderer()
- */
-extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
- int index, Uint32 flags);
-
-/**
- * \brief Create a 2D software rendering context for a surface.
- *
- * \param surface The surface where rendering is done.
- *
- * \return A valid rendering context or NULL if there was an error.
- *
- * \sa SDL_CreateRenderer()
- * \sa SDL_DestroyRenderer()
- */
-extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
-
-/**
- * \brief Get the renderer associated with a window.
- */
-extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
-
-/**
- * \brief Get information about a rendering context.
- */
-extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
- SDL_RendererInfo * info);
-
-/**
- * \brief Get the output size in pixels of a rendering context.
- */
-extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
- int *w, int *h);
-
-/**
- * \brief Create a texture for a rendering context.
- *
- * \param renderer The renderer.
- * \param format The format of the texture.
- * \param access One of the enumerated values in ::SDL_TextureAccess.
- * \param w The width of the texture in pixels.
- * \param h The height of the texture in pixels.
- *
- * \return The created texture is returned, or NULL if no rendering context was
- * active, the format was unsupported, or the width or height were out
- * of range.
- *
- * \note The contents of the texture are not defined at creation.
- *
- * \sa SDL_QueryTexture()
- * \sa SDL_UpdateTexture()
- * \sa SDL_DestroyTexture()
- */
-extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
- Uint32 format,
- int access, int w,
- int h);
-
-/**
- * \brief Create a texture from an existing surface.
- *
- * \param renderer The renderer.
- * \param surface The surface containing pixel data used to fill the texture.
- *
- * \return The created texture is returned, or NULL on error.
- *
- * \note The surface is not modified or freed by this function.
- *
- * \sa SDL_QueryTexture()
- * \sa SDL_DestroyTexture()
- */
-extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
-
-/**
- * \brief Query the attributes of a texture
- *
- * \param texture A texture to be queried.
- * \param format A pointer filled in with the raw format of the texture. The
- * actual format may differ, but pixel transfers will use this
- * format.
- * \param access A pointer filled in with the actual access to the texture.
- * \param w A pointer filled in with the width of the texture in pixels.
- * \param h A pointer filled in with the height of the texture in pixels.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- */
-extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
- Uint32 * format, int *access,
- int *w, int *h);
-
-/**
- * \brief Set an additional color value used in render copy operations.
- *
- * \param texture The texture to update.
- * \param r The red color value multiplied into copy operations.
- * \param g The green color value multiplied into copy operations.
- * \param b The blue color value multiplied into copy operations.
- *
- * \return 0 on success, or -1 if the texture is not valid or color modulation
- * is not supported.
- *
- * \sa SDL_GetTextureColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
- Uint8 r, Uint8 g, Uint8 b);
-
-
-/**
- * \brief Get the additional color value used in render copy operations.
- *
- * \param texture The texture to query.
- * \param r A pointer filled in with the current red color value.
- * \param g A pointer filled in with the current green color value.
- * \param b A pointer filled in with the current blue color value.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \sa SDL_SetTextureColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
- Uint8 * r, Uint8 * g,
- Uint8 * b);
-
-/**
- * \brief Set an additional alpha value used in render copy operations.
- *
- * \param texture The texture to update.
- * \param alpha The alpha value multiplied into copy operations.
- *
- * \return 0 on success, or -1 if the texture is not valid or alpha modulation
- * is not supported.
- *
- * \sa SDL_GetTextureAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
- Uint8 alpha);
-
-/**
- * \brief Get the additional alpha value used in render copy operations.
- *
- * \param texture The texture to query.
- * \param alpha A pointer filled in with the current alpha value.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \sa SDL_SetTextureAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
- Uint8 * alpha);
-
-/**
- * \brief Set the blend mode used for texture copy operations.
- *
- * \param texture The texture to update.
- * \param blendMode ::SDL_BlendMode to use for texture blending.
- *
- * \return 0 on success, or -1 if the texture is not valid or the blend mode is
- * not supported.
- *
- * \note If the blend mode is not supported, the closest supported mode is
- * chosen.
- *
- * \sa SDL_GetTextureBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
- SDL_BlendMode blendMode);
-
-/**
- * \brief Get the blend mode used for texture copy operations.
- *
- * \param texture The texture to query.
- * \param blendMode A pointer filled in with the current blend mode.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \sa SDL_SetTextureBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
- SDL_BlendMode *blendMode);
-
-/**
- * \brief Update the given texture rectangle with new pixel data.
- *
- * \param texture The texture to update
- * \param rect A pointer to the rectangle of pixels to update, or NULL to
- * update the entire texture.
- * \param pixels The raw pixel data in the format of the texture.
- * \param pitch The number of bytes in a row of pixel data, including padding between lines.
- *
- * The pixel data must be in the format of the texture. The pixel format can be
- * queried with SDL_QueryTexture.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \note This is a fairly slow function.
- */
-extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
- const SDL_Rect * rect,
- const void *pixels, int pitch);
-
-/**
- * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
- *
- * \param texture The texture to update
- * \param rect A pointer to the rectangle of pixels to update, or NULL to
- * update the entire texture.
- * \param Yplane The raw pixel data for the Y plane.
- * \param Ypitch The number of bytes between rows of pixel data for the Y plane.
- * \param Uplane The raw pixel data for the U plane.
- * \param Upitch The number of bytes between rows of pixel data for the U plane.
- * \param Vplane The raw pixel data for the V plane.
- * \param Vpitch The number of bytes between rows of pixel data for the V plane.
- *
- * \return 0 on success, or -1 if the texture is not valid.
- *
- * \note You can use SDL_UpdateTexture() as long as your pixel data is
- * a contiguous block of Y and U/V planes in the proper order, but
- * this function is available if your pixel data is not contiguous.
- */
-extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
- const SDL_Rect * rect,
- const Uint8 *Yplane, int Ypitch,
- const Uint8 *Uplane, int Upitch,
- const Uint8 *Vplane, int Vpitch);
-
-/**
- * \brief Lock a portion of the texture for write-only pixel access.
- *
- * \param texture The texture to lock for access, which was created with
- * ::SDL_TEXTUREACCESS_STREAMING.
- * \param rect A pointer to the rectangle to lock for access. If the rect
- * is NULL, the entire texture will be locked.
- * \param pixels This is filled in with a pointer to the locked pixels,
- * appropriately offset by the locked area.
- * \param pitch This is filled in with the pitch of the locked pixels.
- *
- * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
- *
- * \sa SDL_UnlockTexture()
- */
-extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
- const SDL_Rect * rect,
- void **pixels, int *pitch);
-
-/**
- * \brief Unlock a texture, uploading the changes to video memory, if needed.
- *
- * \sa SDL_LockTexture()
- */
-extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
-
-/**
- * \brief Determines whether a window supports the use of render targets
- *
- * \param renderer The renderer that will be checked
- *
- * \return SDL_TRUE if supported, SDL_FALSE if not.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
-
-/**
- * \brief Set a texture as the current rendering target.
- *
- * \param renderer The renderer.
- * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
- *
- * \return 0 on success, or -1 on error
- *
- * \sa SDL_GetRenderTarget()
- */
-extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
- SDL_Texture *texture);
-
-/**
- * \brief Get the current render target or NULL for the default render target.
- *
- * \return The current render target
- *
- * \sa SDL_SetRenderTarget()
- */
-extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
-
-/**
- * \brief Set device independent resolution for rendering
- *
- * \param renderer The renderer for which resolution should be set.
- * \param w The width of the logical resolution
- * \param h The height of the logical resolution
- *
- * This function uses the viewport and scaling functionality to allow a fixed logical
- * resolution for rendering, regardless of the actual output resolution. If the actual
- * output resolution doesn't have the same aspect ratio the output rendering will be
- * centered within the output display.
- *
- * If the output display is a window, mouse events in the window will be filtered
- * and scaled so they seem to arrive within the logical resolution.
- *
- * \note If this function results in scaling or subpixel drawing by the
- * rendering backend, it will be handled using the appropriate
- * quality hints.
- *
- * \sa SDL_RenderGetLogicalSize()
- * \sa SDL_RenderSetScale()
- * \sa SDL_RenderSetViewport()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
-
-/**
- * \brief Get device independent resolution for rendering
- *
- * \param renderer The renderer from which resolution should be queried.
- * \param w A pointer filled with the width of the logical resolution
- * \param h A pointer filled with the height of the logical resolution
- *
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
-
-/**
- * \brief Set whether to force integer scales for resolution-independent rendering
- *
- * \param renderer The renderer for which integer scaling should be set.
- * \param enable Enable or disable integer scaling
- *
- * This function restricts the logical viewport to integer values - that is, when
- * a resolution is between two multiples of a logical size, the viewport size is
- * rounded down to the lower multiple.
- *
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer,
- SDL_bool enable);
-
-/**
- * \brief Get whether integer scales are forced for resolution-independent rendering
- *
- * \param renderer The renderer from which integer scaling should be queried.
- *
- * \sa SDL_RenderSetIntegerScale()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer);
-
-/**
- * \brief Set the drawing area for rendering on the current target.
- *
- * \param renderer The renderer for which the drawing area should be set.
- * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
- *
- * The x,y of the viewport rect represents the origin for rendering.
- *
- * \return 0 on success, or -1 on error
- *
- * \note If the window associated with the renderer is resized, the viewport is automatically reset.
- *
- * \sa SDL_RenderGetViewport()
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Get the drawing area for the current target.
- *
- * \sa SDL_RenderSetViewport()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
- SDL_Rect * rect);
-
-/**
- * \brief Set the clip rectangle for the current target.
- *
- * \param renderer The renderer for which clip rectangle should be set.
- * \param rect A pointer to the rectangle to set as the clip rectangle, or
- * NULL to disable clipping.
- *
- * \return 0 on success, or -1 on error
- *
- * \sa SDL_RenderGetClipRect()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Get the clip rectangle for the current target.
- *
- * \param renderer The renderer from which clip rectangle should be queried.
- * \param rect A pointer filled in with the current clip rectangle, or
- * an empty rectangle if clipping is disabled.
- *
- * \sa SDL_RenderSetClipRect()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
- SDL_Rect * rect);
-
-/**
- * \brief Get whether clipping is enabled on the given renderer.
- *
- * \param renderer The renderer from which clip state should be queried.
- *
- * \sa SDL_RenderGetClipRect()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer);
-
-
-/**
- * \brief Set the drawing scale for rendering on the current target.
- *
- * \param renderer The renderer for which the drawing scale should be set.
- * \param scaleX The horizontal scaling factor
- * \param scaleY The vertical scaling factor
- *
- * The drawing coordinates are scaled by the x/y scaling factors
- * before they are used by the renderer. This allows resolution
- * independent drawing with a single coordinate system.
- *
- * \note If this results in scaling or subpixel drawing by the
- * rendering backend, it will be handled using the appropriate
- * quality hints. For best results use integer scaling factors.
- *
- * \sa SDL_RenderGetScale()
- * \sa SDL_RenderSetLogicalSize()
- */
-extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
- float scaleX, float scaleY);
-
-/**
- * \brief Get the drawing scale for the current target.
- *
- * \param renderer The renderer from which drawing scale should be queried.
- * \param scaleX A pointer filled in with the horizontal scaling factor
- * \param scaleY A pointer filled in with the vertical scaling factor
- *
- * \sa SDL_RenderSetScale()
- */
-extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
- float *scaleX, float *scaleY);
-
-/**
- * \brief Set the color used for drawing operations (Rect, Line and Clear).
- *
- * \param renderer The renderer for which drawing color should be set.
- * \param r The red value used to draw on the rendering target.
- * \param g The green value used to draw on the rendering target.
- * \param b The blue value used to draw on the rendering target.
- * \param a The alpha value used to draw on the rendering target, usually
- * ::SDL_ALPHA_OPAQUE (255).
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
- Uint8 r, Uint8 g, Uint8 b,
- Uint8 a);
-
-/**
- * \brief Get the color used for drawing operations (Rect, Line and Clear).
- *
- * \param renderer The renderer from which drawing color should be queried.
- * \param r A pointer to the red value used to draw on the rendering target.
- * \param g A pointer to the green value used to draw on the rendering target.
- * \param b A pointer to the blue value used to draw on the rendering target.
- * \param a A pointer to the alpha value used to draw on the rendering target,
- * usually ::SDL_ALPHA_OPAQUE (255).
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
- Uint8 * r, Uint8 * g, Uint8 * b,
- Uint8 * a);
-
-/**
- * \brief Set the blend mode used for drawing operations (Fill and Line).
- *
- * \param renderer The renderer for which blend mode should be set.
- * \param blendMode ::SDL_BlendMode to use for blending.
- *
- * \return 0 on success, or -1 on error
- *
- * \note If the blend mode is not supported, the closest supported mode is
- * chosen.
- *
- * \sa SDL_GetRenderDrawBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
- SDL_BlendMode blendMode);
-
-/**
- * \brief Get the blend mode used for drawing operations.
- *
- * \param renderer The renderer from which blend mode should be queried.
- * \param blendMode A pointer filled in with the current blend mode.
- *
- * \return 0 on success, or -1 on error
- *
- * \sa SDL_SetRenderDrawBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
- SDL_BlendMode *blendMode);
-
-/**
- * \brief Clear the current rendering target with the drawing color
- *
- * This function clears the entire rendering target, ignoring the viewport and
- * the clip rectangle.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
-
-/**
- * \brief Draw a point on the current rendering target.
- *
- * \param renderer The renderer which should draw a point.
- * \param x The x coordinate of the point.
- * \param y The y coordinate of the point.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
- int x, int y);
-
-/**
- * \brief Draw multiple points on the current rendering target.
- *
- * \param renderer The renderer which should draw multiple points.
- * \param points The points to draw
- * \param count The number of points to draw
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
- const SDL_Point * points,
- int count);
-
-/**
- * \brief Draw a line on the current rendering target.
- *
- * \param renderer The renderer which should draw a line.
- * \param x1 The x coordinate of the start point.
- * \param y1 The y coordinate of the start point.
- * \param x2 The x coordinate of the end point.
- * \param y2 The y coordinate of the end point.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
- int x1, int y1, int x2, int y2);
-
-/**
- * \brief Draw a series of connected lines on the current rendering target.
- *
- * \param renderer The renderer which should draw multiple lines.
- * \param points The points along the lines
- * \param count The number of points, drawing count-1 lines
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
- const SDL_Point * points,
- int count);
-
-/**
- * \brief Draw a rectangle on the current rendering target.
- *
- * \param renderer The renderer which should draw a rectangle.
- * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Draw some number of rectangles on the current rendering target.
- *
- * \param renderer The renderer which should draw multiple rectangles.
- * \param rects A pointer to an array of destination rectangles.
- * \param count The number of rectangles.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
- const SDL_Rect * rects,
- int count);
-
-/**
- * \brief Fill a rectangle on the current rendering target with the drawing color.
- *
- * \param renderer The renderer which should fill a rectangle.
- * \param rect A pointer to the destination rectangle, or NULL for the entire
- * rendering target.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
- const SDL_Rect * rect);
-
-/**
- * \brief Fill some number of rectangles on the current rendering target with the drawing color.
- *
- * \param renderer The renderer which should fill multiple rectangles.
- * \param rects A pointer to an array of destination rectangles.
- * \param count The number of rectangles.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
- const SDL_Rect * rects,
- int count);
-
-/**
- * \brief Copy a portion of the texture to the current rendering target.
- *
- * \param renderer The renderer which should copy parts of a texture.
- * \param texture The source texture.
- * \param srcrect A pointer to the source rectangle, or NULL for the entire
- * texture.
- * \param dstrect A pointer to the destination rectangle, or NULL for the
- * entire rendering target.
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
- SDL_Texture * texture,
- const SDL_Rect * srcrect,
- const SDL_Rect * dstrect);
-
-/**
- * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
- *
- * \param renderer The renderer which should copy parts of a texture.
- * \param texture The source texture.
- * \param srcrect A pointer to the source rectangle, or NULL for the entire
- * texture.
- * \param dstrect A pointer to the destination rectangle, or NULL for the
- * entire rendering target.
- * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
- * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
- * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
- *
- * \return 0 on success, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
- SDL_Texture * texture,
- const SDL_Rect * srcrect,
- const SDL_Rect * dstrect,
- const double angle,
- const SDL_Point *center,
- const SDL_RendererFlip flip);
-
-/**
- * \brief Read pixels from the current rendering target.
- *
- * \param renderer The renderer from which pixels should be read.
- * \param rect A pointer to the rectangle to read, or NULL for the entire
- * render target.
- * \param format The desired format of the pixel data, or 0 to use the format
- * of the rendering target
- * \param pixels A pointer to be filled in with the pixel data
- * \param pitch The pitch of the pixels parameter.
- *
- * \return 0 on success, or -1 if pixel reading is not supported.
- *
- * \warning This is a very slow operation, and should not be used frequently.
- */
-extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
- const SDL_Rect * rect,
- Uint32 format,
- void *pixels, int pitch);
-
-/**
- * \brief Update the screen with rendering performed.
- */
-extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
-
-/**
- * \brief Destroy the specified texture.
- *
- * \sa SDL_CreateTexture()
- * \sa SDL_CreateTextureFromSurface()
- */
-extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
-
-/**
- * \brief Destroy the rendering context for a window and free associated
- * textures.
- *
- * \sa SDL_CreateRenderer()
- */
-extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
-
-
-/**
- * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
- * OpenGL instructions.
- *
- * \param texture The SDL texture to bind
- * \param texw A pointer to a float that will be filled with the texture width
- * \param texh A pointer to a float that will be filled with the texture height
- *
- * \return 0 on success, or -1 if the operation is not supported
- */
-extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
-
-/**
- * \brief Unbind a texture from the current OpenGL/ES/ES2 context.
- *
- * \param texture The SDL texture to unbind
- *
- * \return 0 on success, or -1 if the operation is not supported
- */
-extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_render_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_revision.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_revision.h
deleted file mode 100644
index 9376093..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_revision.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define SDL_REVISION "hg-11645:2088cd828335"
-#define SDL_REVISION_NUMBER 11645
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_rwops.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_rwops.h
deleted file mode 100644
index 7f0cbdf..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_rwops.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_rwops.h
- *
- * This file provides a general interface for SDL to read and write
- * data streams. It can easily be extended to files, memory, etc.
- */
-
-#ifndef SDL_rwops_h_
-#define SDL_rwops_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* RWops Types */
-#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
-#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
-#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
-#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
-#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
-
-/**
- * This is the read/write operation structure -- very basic.
- */
-typedef struct SDL_RWops
-{
- /**
- * Return the size of the file in this rwops, or -1 if unknown
- */
- Sint64 (SDLCALL * size) (struct SDL_RWops * context);
-
- /**
- * Seek to \c offset relative to \c whence, one of stdio's whence values:
- * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
- *
- * \return the final offset in the data stream, or -1 on error.
- */
- Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
- int whence);
-
- /**
- * Read up to \c maxnum objects each of size \c size from the data
- * stream to the area pointed at by \c ptr.
- *
- * \return the number of objects read, or 0 at error or end of file.
- */
- size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
- size_t size, size_t maxnum);
-
- /**
- * Write exactly \c num objects each of size \c size from the area
- * pointed at by \c ptr to data stream.
- *
- * \return the number of objects written, or 0 at error or end of file.
- */
- size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
- size_t size, size_t num);
-
- /**
- * Close and free an allocated SDL_RWops structure.
- *
- * \return 0 if successful or -1 on write error when flushing data.
- */
- int (SDLCALL * close) (struct SDL_RWops * context);
-
- Uint32 type;
- union
- {
-#if defined(__ANDROID__)
- struct
- {
- void *fileNameRef;
- void *inputStreamRef;
- void *readableByteChannelRef;
- void *readMethod;
- void *assetFileDescriptorRef;
- long position;
- long size;
- long offset;
- int fd;
- } androidio;
-#elif defined(__WIN32__)
- struct
- {
- SDL_bool append;
- void *h;
- struct
- {
- void *data;
- size_t size;
- size_t left;
- } buffer;
- } windowsio;
-#endif
-
-#ifdef HAVE_STDIO_H
- struct
- {
- SDL_bool autoclose;
- FILE *fp;
- } stdio;
-#endif
- struct
- {
- Uint8 *base;
- Uint8 *here;
- Uint8 *stop;
- } mem;
- struct
- {
- void *data1;
- void *data2;
- } unknown;
- } hidden;
-
-} SDL_RWops;
-
-
-/**
- * \name RWFrom functions
- *
- * Functions to create SDL_RWops structures from various data streams.
- */
-/* @{ */
-
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
- const char *mode);
-
-#ifdef HAVE_STDIO_H
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
- SDL_bool autoclose);
-#else
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
- SDL_bool autoclose);
-#endif
-
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
-extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
- int size);
-
-/* @} *//* RWFrom functions */
-
-
-extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
-extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
-
-#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
-#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
-#define RW_SEEK_END 2 /**< Seek relative to the end of data */
-
-/**
- * \name Read/write macros
- *
- * Macros to easily read and write from an SDL_RWops structure.
- */
-/* @{ */
-#define SDL_RWsize(ctx) (ctx)->size(ctx)
-#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx) (ctx)->close(ctx)
-/* @} *//* Read/write macros */
-
-
-/**
- * Load all the data from an SDL data stream.
- *
- * The data is allocated with a zero byte at the end (null terminated)
- *
- * If \c datasize is not NULL, it is filled with the size of the data read.
- *
- * If \c freesrc is non-zero, the stream will be closed after being read.
- *
- * The data should be freed with SDL_free().
- *
- * \return the data, or NULL if there was an error.
- */
-extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
- int freesrc);
-
-/**
- * Load an entire file.
- *
- * Convenience macro.
- */
-#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
-
-/**
- * \name Read endian functions
- *
- * Read an item of the specified endianness and return in native format.
- */
-/* @{ */
-extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
-extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
-extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
-/* @} *//* Read endian functions */
-
-/**
- * \name Write endian functions
- *
- * Write an item of native format to the specified endianness.
- */
-/* @{ */
-extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
-extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
-/* @} *//* Write endian functions */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_rwops_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_scancode.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_scancode.h
deleted file mode 100644
index 1d55212..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_scancode.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_scancode.h
- *
- * Defines keyboard scancodes.
- */
-
-#ifndef SDL_scancode_h_
-#define SDL_scancode_h_
-
-#include "SDL_stdinc.h"
-
-/**
- * \brief The SDL keyboard scancode representation.
- *
- * Values of this type are used to represent keyboard keys, among other places
- * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
- * SDL_Event structure.
- *
- * The values in this enumeration are based on the USB usage page standard:
- * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
- */
-typedef enum
-{
- SDL_SCANCODE_UNKNOWN = 0,
-
- /**
- * \name Usage page 0x07
- *
- * These values are from usage page 0x07 (USB keyboard page).
- */
- /* @{ */
-
- SDL_SCANCODE_A = 4,
- SDL_SCANCODE_B = 5,
- SDL_SCANCODE_C = 6,
- SDL_SCANCODE_D = 7,
- SDL_SCANCODE_E = 8,
- SDL_SCANCODE_F = 9,
- SDL_SCANCODE_G = 10,
- SDL_SCANCODE_H = 11,
- SDL_SCANCODE_I = 12,
- SDL_SCANCODE_J = 13,
- SDL_SCANCODE_K = 14,
- SDL_SCANCODE_L = 15,
- SDL_SCANCODE_M = 16,
- SDL_SCANCODE_N = 17,
- SDL_SCANCODE_O = 18,
- SDL_SCANCODE_P = 19,
- SDL_SCANCODE_Q = 20,
- SDL_SCANCODE_R = 21,
- SDL_SCANCODE_S = 22,
- SDL_SCANCODE_T = 23,
- SDL_SCANCODE_U = 24,
- SDL_SCANCODE_V = 25,
- SDL_SCANCODE_W = 26,
- SDL_SCANCODE_X = 27,
- SDL_SCANCODE_Y = 28,
- SDL_SCANCODE_Z = 29,
-
- SDL_SCANCODE_1 = 30,
- SDL_SCANCODE_2 = 31,
- SDL_SCANCODE_3 = 32,
- SDL_SCANCODE_4 = 33,
- SDL_SCANCODE_5 = 34,
- SDL_SCANCODE_6 = 35,
- SDL_SCANCODE_7 = 36,
- SDL_SCANCODE_8 = 37,
- SDL_SCANCODE_9 = 38,
- SDL_SCANCODE_0 = 39,
-
- SDL_SCANCODE_RETURN = 40,
- SDL_SCANCODE_ESCAPE = 41,
- SDL_SCANCODE_BACKSPACE = 42,
- SDL_SCANCODE_TAB = 43,
- SDL_SCANCODE_SPACE = 44,
-
- SDL_SCANCODE_MINUS = 45,
- SDL_SCANCODE_EQUALS = 46,
- SDL_SCANCODE_LEFTBRACKET = 47,
- SDL_SCANCODE_RIGHTBRACKET = 48,
- SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
- * key on ISO keyboards and at the right end
- * of the QWERTY row on ANSI keyboards.
- * Produces REVERSE SOLIDUS (backslash) and
- * VERTICAL LINE in a US layout, REVERSE
- * SOLIDUS and VERTICAL LINE in a UK Mac
- * layout, NUMBER SIGN and TILDE in a UK
- * Windows layout, DOLLAR SIGN and POUND SIGN
- * in a Swiss German layout, NUMBER SIGN and
- * APOSTROPHE in a German layout, GRAVE
- * ACCENT and POUND SIGN in a French Mac
- * layout, and ASTERISK and MICRO SIGN in a
- * French Windows layout.
- */
- SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
- * instead of 49 for the same key, but all
- * OSes I've seen treat the two codes
- * identically. So, as an implementor, unless
- * your keyboard generates both of those
- * codes and your OS treats them differently,
- * you should generate SDL_SCANCODE_BACKSLASH
- * instead of this code. As a user, you
- * should not rely on this code because SDL
- * will never generate it with most (all?)
- * keyboards.
- */
- SDL_SCANCODE_SEMICOLON = 51,
- SDL_SCANCODE_APOSTROPHE = 52,
- SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
- * and ISO keyboards). Produces GRAVE ACCENT and
- * TILDE in a US Windows layout and in US and UK
- * Mac layouts on ANSI keyboards, GRAVE ACCENT
- * and NOT SIGN in a UK Windows layout, SECTION
- * SIGN and PLUS-MINUS SIGN in US and UK Mac
- * layouts on ISO keyboards, SECTION SIGN and
- * DEGREE SIGN in a Swiss German layout (Mac:
- * only on ISO keyboards), CIRCUMFLEX ACCENT and
- * DEGREE SIGN in a German layout (Mac: only on
- * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
- * French Windows layout, COMMERCIAL AT and
- * NUMBER SIGN in a French Mac layout on ISO
- * keyboards, and LESS-THAN SIGN and GREATER-THAN
- * SIGN in a Swiss German, German, or French Mac
- * layout on ANSI keyboards.
- */
- SDL_SCANCODE_COMMA = 54,
- SDL_SCANCODE_PERIOD = 55,
- SDL_SCANCODE_SLASH = 56,
-
- SDL_SCANCODE_CAPSLOCK = 57,
-
- SDL_SCANCODE_F1 = 58,
- SDL_SCANCODE_F2 = 59,
- SDL_SCANCODE_F3 = 60,
- SDL_SCANCODE_F4 = 61,
- SDL_SCANCODE_F5 = 62,
- SDL_SCANCODE_F6 = 63,
- SDL_SCANCODE_F7 = 64,
- SDL_SCANCODE_F8 = 65,
- SDL_SCANCODE_F9 = 66,
- SDL_SCANCODE_F10 = 67,
- SDL_SCANCODE_F11 = 68,
- SDL_SCANCODE_F12 = 69,
-
- SDL_SCANCODE_PRINTSCREEN = 70,
- SDL_SCANCODE_SCROLLLOCK = 71,
- SDL_SCANCODE_PAUSE = 72,
- SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
- does send code 73, not 117) */
- SDL_SCANCODE_HOME = 74,
- SDL_SCANCODE_PAGEUP = 75,
- SDL_SCANCODE_DELETE = 76,
- SDL_SCANCODE_END = 77,
- SDL_SCANCODE_PAGEDOWN = 78,
- SDL_SCANCODE_RIGHT = 79,
- SDL_SCANCODE_LEFT = 80,
- SDL_SCANCODE_DOWN = 81,
- SDL_SCANCODE_UP = 82,
-
- SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
- */
- SDL_SCANCODE_KP_DIVIDE = 84,
- SDL_SCANCODE_KP_MULTIPLY = 85,
- SDL_SCANCODE_KP_MINUS = 86,
- SDL_SCANCODE_KP_PLUS = 87,
- SDL_SCANCODE_KP_ENTER = 88,
- SDL_SCANCODE_KP_1 = 89,
- SDL_SCANCODE_KP_2 = 90,
- SDL_SCANCODE_KP_3 = 91,
- SDL_SCANCODE_KP_4 = 92,
- SDL_SCANCODE_KP_5 = 93,
- SDL_SCANCODE_KP_6 = 94,
- SDL_SCANCODE_KP_7 = 95,
- SDL_SCANCODE_KP_8 = 96,
- SDL_SCANCODE_KP_9 = 97,
- SDL_SCANCODE_KP_0 = 98,
- SDL_SCANCODE_KP_PERIOD = 99,
-
- SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
- * keyboards have over ANSI ones,
- * located between left shift and Y.
- * Produces GRAVE ACCENT and TILDE in a
- * US or UK Mac layout, REVERSE SOLIDUS
- * (backslash) and VERTICAL LINE in a
- * US or UK Windows layout, and
- * LESS-THAN SIGN and GREATER-THAN SIGN
- * in a Swiss German, German, or French
- * layout. */
- SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
- SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
- * not a physical key - but some Mac keyboards
- * do have a power key. */
- SDL_SCANCODE_KP_EQUALS = 103,
- SDL_SCANCODE_F13 = 104,
- SDL_SCANCODE_F14 = 105,
- SDL_SCANCODE_F15 = 106,
- SDL_SCANCODE_F16 = 107,
- SDL_SCANCODE_F17 = 108,
- SDL_SCANCODE_F18 = 109,
- SDL_SCANCODE_F19 = 110,
- SDL_SCANCODE_F20 = 111,
- SDL_SCANCODE_F21 = 112,
- SDL_SCANCODE_F22 = 113,
- SDL_SCANCODE_F23 = 114,
- SDL_SCANCODE_F24 = 115,
- SDL_SCANCODE_EXECUTE = 116,
- SDL_SCANCODE_HELP = 117,
- SDL_SCANCODE_MENU = 118,
- SDL_SCANCODE_SELECT = 119,
- SDL_SCANCODE_STOP = 120,
- SDL_SCANCODE_AGAIN = 121, /**< redo */
- SDL_SCANCODE_UNDO = 122,
- SDL_SCANCODE_CUT = 123,
- SDL_SCANCODE_COPY = 124,
- SDL_SCANCODE_PASTE = 125,
- SDL_SCANCODE_FIND = 126,
- SDL_SCANCODE_MUTE = 127,
- SDL_SCANCODE_VOLUMEUP = 128,
- SDL_SCANCODE_VOLUMEDOWN = 129,
-/* not sure whether there's a reason to enable these */
-/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
-/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
-/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
- SDL_SCANCODE_KP_COMMA = 133,
- SDL_SCANCODE_KP_EQUALSAS400 = 134,
-
- SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
- footnotes in USB doc */
- SDL_SCANCODE_INTERNATIONAL2 = 136,
- SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
- SDL_SCANCODE_INTERNATIONAL4 = 138,
- SDL_SCANCODE_INTERNATIONAL5 = 139,
- SDL_SCANCODE_INTERNATIONAL6 = 140,
- SDL_SCANCODE_INTERNATIONAL7 = 141,
- SDL_SCANCODE_INTERNATIONAL8 = 142,
- SDL_SCANCODE_INTERNATIONAL9 = 143,
- SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
- SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
- SDL_SCANCODE_LANG3 = 146, /**< Katakana */
- SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
- SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
- SDL_SCANCODE_LANG6 = 149, /**< reserved */
- SDL_SCANCODE_LANG7 = 150, /**< reserved */
- SDL_SCANCODE_LANG8 = 151, /**< reserved */
- SDL_SCANCODE_LANG9 = 152, /**< reserved */
-
- SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
- SDL_SCANCODE_SYSREQ = 154,
- SDL_SCANCODE_CANCEL = 155,
- SDL_SCANCODE_CLEAR = 156,
- SDL_SCANCODE_PRIOR = 157,
- SDL_SCANCODE_RETURN2 = 158,
- SDL_SCANCODE_SEPARATOR = 159,
- SDL_SCANCODE_OUT = 160,
- SDL_SCANCODE_OPER = 161,
- SDL_SCANCODE_CLEARAGAIN = 162,
- SDL_SCANCODE_CRSEL = 163,
- SDL_SCANCODE_EXSEL = 164,
-
- SDL_SCANCODE_KP_00 = 176,
- SDL_SCANCODE_KP_000 = 177,
- SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
- SDL_SCANCODE_DECIMALSEPARATOR = 179,
- SDL_SCANCODE_CURRENCYUNIT = 180,
- SDL_SCANCODE_CURRENCYSUBUNIT = 181,
- SDL_SCANCODE_KP_LEFTPAREN = 182,
- SDL_SCANCODE_KP_RIGHTPAREN = 183,
- SDL_SCANCODE_KP_LEFTBRACE = 184,
- SDL_SCANCODE_KP_RIGHTBRACE = 185,
- SDL_SCANCODE_KP_TAB = 186,
- SDL_SCANCODE_KP_BACKSPACE = 187,
- SDL_SCANCODE_KP_A = 188,
- SDL_SCANCODE_KP_B = 189,
- SDL_SCANCODE_KP_C = 190,
- SDL_SCANCODE_KP_D = 191,
- SDL_SCANCODE_KP_E = 192,
- SDL_SCANCODE_KP_F = 193,
- SDL_SCANCODE_KP_XOR = 194,
- SDL_SCANCODE_KP_POWER = 195,
- SDL_SCANCODE_KP_PERCENT = 196,
- SDL_SCANCODE_KP_LESS = 197,
- SDL_SCANCODE_KP_GREATER = 198,
- SDL_SCANCODE_KP_AMPERSAND = 199,
- SDL_SCANCODE_KP_DBLAMPERSAND = 200,
- SDL_SCANCODE_KP_VERTICALBAR = 201,
- SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
- SDL_SCANCODE_KP_COLON = 203,
- SDL_SCANCODE_KP_HASH = 204,
- SDL_SCANCODE_KP_SPACE = 205,
- SDL_SCANCODE_KP_AT = 206,
- SDL_SCANCODE_KP_EXCLAM = 207,
- SDL_SCANCODE_KP_MEMSTORE = 208,
- SDL_SCANCODE_KP_MEMRECALL = 209,
- SDL_SCANCODE_KP_MEMCLEAR = 210,
- SDL_SCANCODE_KP_MEMADD = 211,
- SDL_SCANCODE_KP_MEMSUBTRACT = 212,
- SDL_SCANCODE_KP_MEMMULTIPLY = 213,
- SDL_SCANCODE_KP_MEMDIVIDE = 214,
- SDL_SCANCODE_KP_PLUSMINUS = 215,
- SDL_SCANCODE_KP_CLEAR = 216,
- SDL_SCANCODE_KP_CLEARENTRY = 217,
- SDL_SCANCODE_KP_BINARY = 218,
- SDL_SCANCODE_KP_OCTAL = 219,
- SDL_SCANCODE_KP_DECIMAL = 220,
- SDL_SCANCODE_KP_HEXADECIMAL = 221,
-
- SDL_SCANCODE_LCTRL = 224,
- SDL_SCANCODE_LSHIFT = 225,
- SDL_SCANCODE_LALT = 226, /**< alt, option */
- SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
- SDL_SCANCODE_RCTRL = 228,
- SDL_SCANCODE_RSHIFT = 229,
- SDL_SCANCODE_RALT = 230, /**< alt gr, option */
- SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
-
- SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
- * by any of the above, but since there's a
- * special KMOD_MODE for it I'm adding it here
- */
-
- /* @} *//* Usage page 0x07 */
-
- /**
- * \name Usage page 0x0C
- *
- * These values are mapped from usage page 0x0C (USB consumer page).
- */
- /* @{ */
-
- SDL_SCANCODE_AUDIONEXT = 258,
- SDL_SCANCODE_AUDIOPREV = 259,
- SDL_SCANCODE_AUDIOSTOP = 260,
- SDL_SCANCODE_AUDIOPLAY = 261,
- SDL_SCANCODE_AUDIOMUTE = 262,
- SDL_SCANCODE_MEDIASELECT = 263,
- SDL_SCANCODE_WWW = 264,
- SDL_SCANCODE_MAIL = 265,
- SDL_SCANCODE_CALCULATOR = 266,
- SDL_SCANCODE_COMPUTER = 267,
- SDL_SCANCODE_AC_SEARCH = 268,
- SDL_SCANCODE_AC_HOME = 269,
- SDL_SCANCODE_AC_BACK = 270,
- SDL_SCANCODE_AC_FORWARD = 271,
- SDL_SCANCODE_AC_STOP = 272,
- SDL_SCANCODE_AC_REFRESH = 273,
- SDL_SCANCODE_AC_BOOKMARKS = 274,
-
- /* @} *//* Usage page 0x0C */
-
- /**
- * \name Walther keys
- *
- * These are values that Christian Walther added (for mac keyboard?).
- */
- /* @{ */
-
- SDL_SCANCODE_BRIGHTNESSDOWN = 275,
- SDL_SCANCODE_BRIGHTNESSUP = 276,
- SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
- switch, video mode switch */
- SDL_SCANCODE_KBDILLUMTOGGLE = 278,
- SDL_SCANCODE_KBDILLUMDOWN = 279,
- SDL_SCANCODE_KBDILLUMUP = 280,
- SDL_SCANCODE_EJECT = 281,
- SDL_SCANCODE_SLEEP = 282,
-
- SDL_SCANCODE_APP1 = 283,
- SDL_SCANCODE_APP2 = 284,
-
- /* @} *//* Walther keys */
-
- /**
- * \name Usage page 0x0C (additional media keys)
- *
- * These values are mapped from usage page 0x0C (USB consumer page).
- */
- /* @{ */
-
- SDL_SCANCODE_AUDIOREWIND = 285,
- SDL_SCANCODE_AUDIOFASTFORWARD = 286,
-
- /* @} *//* Usage page 0x0C (additional media keys) */
-
- /* Add any other keys here. */
-
- SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
- for array bounds */
-} SDL_Scancode;
-
-#endif /* SDL_scancode_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_shape.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_shape.h
deleted file mode 100644
index 9e492d9..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_shape.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_shape_h_
-#define SDL_shape_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_pixels.h"
-#include "SDL_rect.h"
-#include "SDL_surface.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \file SDL_shape.h
- *
- * Header file for the shaped window API.
- */
-
-#define SDL_NONSHAPEABLE_WINDOW -1
-#define SDL_INVALID_SHAPE_ARGUMENT -2
-#define SDL_WINDOW_LACKS_SHAPE -3
-
-/**
- * \brief Create a window that can be shaped with the specified position, dimensions, and flags.
- *
- * \param title The title of the window, in UTF-8 encoding.
- * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param w The width of the window.
- * \param h The height of the window.
- * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
- * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
- * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
- * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
- *
- * \return The window created, or NULL if window creation failed.
- *
- * \sa SDL_DestroyWindow()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
-
-/**
- * \brief Return whether the given window is a shaped window.
- *
- * \param window The window to query for being shaped.
- *
- * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
- *
- * \sa SDL_CreateShapedWindow
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
-
-/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
-typedef enum {
- /** \brief The default mode, a binarized alpha cutoff of 1. */
- ShapeModeDefault,
- /** \brief A binarized alpha cutoff with a given integer value. */
- ShapeModeBinarizeAlpha,
- /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
- ShapeModeReverseBinarizeAlpha,
- /** \brief A color key is applied. */
- ShapeModeColorKey
-} WindowShapeMode;
-
-#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
-
-/** \brief A union containing parameters for shaped windows. */
-typedef union {
- /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
- Uint8 binarizationCutoff;
- SDL_Color colorKey;
-} SDL_WindowShapeParams;
-
-/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
-typedef struct SDL_WindowShapeMode {
- /** \brief The mode of these window-shape parameters. */
- WindowShapeMode mode;
- /** \brief Window-shape parameters. */
- SDL_WindowShapeParams parameters;
-} SDL_WindowShapeMode;
-
-/**
- * \brief Set the shape and parameters of a shaped window.
- *
- * \param window The shaped window whose parameters should be set.
- * \param shape A surface encoding the desired shape for the window.
- * \param shape_mode The parameters to set for the shaped window.
- *
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- * if the SDL_Window given does not reference a valid shaped window.
- *
- * \sa SDL_WindowShapeMode
- * \sa SDL_GetShapedWindowMode.
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
-
-/**
- * \brief Get the shape parameters of a shaped window.
- *
- * \param window The shaped window whose parameters should be retrieved.
- * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
- *
- * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
- * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- * the SDL_Window given is a shapeable window currently lacking a shape.
- *
- * \sa SDL_WindowShapeMode
- * \sa SDL_SetWindowShape
- */
-extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_shape_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_stdinc.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_stdinc.h
deleted file mode 100644
index 7240229..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_stdinc.h
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_stdinc.h
- *
- * This is a general header that includes C language support.
- */
-
-#ifndef SDL_stdinc_h_
-#define SDL_stdinc_h_
-
-#include "SDL_config.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if defined(STDC_HEADERS)
-# include <stdlib.h>
-# include <stddef.h>
-# include <stdarg.h>
-#else
-# if defined(HAVE_STDLIB_H)
-# include <stdlib.h>
-# elif defined(HAVE_MALLOC_H)
-# include <malloc.h>
-# endif
-# if defined(HAVE_STDDEF_H)
-# include <stddef.h>
-# endif
-# if defined(HAVE_STDARG_H)
-# include <stdarg.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-#if defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-#elif defined(HAVE_STDINT_H)
-# include <stdint.h>
-#endif
-#ifdef HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-#ifdef HAVE_MATH_H
-# if defined(__WINRT__)
-/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
- WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
- for more information.
-*/
-# define _USE_MATH_DEFINES
-# endif
-# include <math.h>
-#endif
-#ifdef HAVE_FLOAT_H
-# include <float.h>
-#endif
-
-/**
- * The number of elements in an array.
- */
-#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
-#define SDL_TABLESIZE(table) SDL_arraysize(table)
-
-/**
- * Macro useful for building other macros with strings in them
- *
- * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
- */
-#define SDL_STRINGIFY_ARG(arg) #arg
-
-/**
- * \name Cast operators
- *
- * Use proper C++ casts when compiled as C++ to be compatible with the option
- * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
- */
-/* @{ */
-#ifdef __cplusplus
-#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
-#define SDL_static_cast(type, expression) static_cast<type>(expression)
-#define SDL_const_cast(type, expression) const_cast<type>(expression)
-#else
-#define SDL_reinterpret_cast(type, expression) ((type)(expression))
-#define SDL_static_cast(type, expression) ((type)(expression))
-#define SDL_const_cast(type, expression) ((type)(expression))
-#endif
-/* @} *//* Cast operators */
-
-/* Define a four character code as a Uint32 */
-#define SDL_FOURCC(A, B, C, D) \
- ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
- (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
- (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
- (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
-
-/**
- * \name Basic data types
- */
-/* @{ */
-
-#ifdef __CC_ARM
-/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
-#define SDL_FALSE 0
-#define SDL_TRUE 1
-typedef int SDL_bool;
-#else
-typedef enum
-{
- SDL_FALSE = 0,
- SDL_TRUE = 1
-} SDL_bool;
-#endif
-
-/**
- * \brief A signed 8-bit integer type.
- */
-#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
-#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
-typedef int8_t Sint8;
-/**
- * \brief An unsigned 8-bit integer type.
- */
-#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
-#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
-typedef uint8_t Uint8;
-/**
- * \brief A signed 16-bit integer type.
- */
-#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
-#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
-typedef int16_t Sint16;
-/**
- * \brief An unsigned 16-bit integer type.
- */
-#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
-#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
-typedef uint16_t Uint16;
-/**
- * \brief A signed 32-bit integer type.
- */
-#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
-#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
-typedef int32_t Sint32;
-/**
- * \brief An unsigned 32-bit integer type.
- */
-#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
-#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
-typedef uint32_t Uint32;
-
-/**
- * \brief A signed 64-bit integer type.
- */
-#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
-#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
-typedef int64_t Sint64;
-/**
- * \brief An unsigned 64-bit integer type.
- */
-#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
-#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
-typedef uint64_t Uint64;
-
-/* @} *//* Basic data types */
-
-/* Make sure we have macros for printing 64 bit values.
- * <stdint.h> should define these but this is not true all platforms.
- * (for example win32) */
-#ifndef SDL_PRIs64
-#ifdef PRIs64
-#define SDL_PRIs64 PRIs64
-#elif defined(__WIN32__)
-#define SDL_PRIs64 "I64d"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIs64 "ld"
-#else
-#define SDL_PRIs64 "lld"
-#endif
-#endif
-#ifndef SDL_PRIu64
-#ifdef PRIu64
-#define SDL_PRIu64 PRIu64
-#elif defined(__WIN32__)
-#define SDL_PRIu64 "I64u"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIu64 "lu"
-#else
-#define SDL_PRIu64 "llu"
-#endif
-#endif
-#ifndef SDL_PRIx64
-#ifdef PRIx64
-#define SDL_PRIx64 PRIx64
-#elif defined(__WIN32__)
-#define SDL_PRIx64 "I64x"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIx64 "lx"
-#else
-#define SDL_PRIx64 "llx"
-#endif
-#endif
-#ifndef SDL_PRIX64
-#ifdef PRIX64
-#define SDL_PRIX64 PRIX64
-#elif defined(__WIN32__)
-#define SDL_PRIX64 "I64X"
-#elif defined(__LINUX__) && defined(__LP64__)
-#define SDL_PRIX64 "lX"
-#else
-#define SDL_PRIX64 "llX"
-#endif
-#endif
-
-/* Annotations to help code analysis tools */
-#ifdef SDL_DISABLE_ANALYZE_MACROS
-#define SDL_IN_BYTECAP(x)
-#define SDL_INOUT_Z_CAP(x)
-#define SDL_OUT_Z_CAP(x)
-#define SDL_OUT_CAP(x)
-#define SDL_OUT_BYTECAP(x)
-#define SDL_OUT_Z_BYTECAP(x)
-#define SDL_PRINTF_FORMAT_STRING
-#define SDL_SCANF_FORMAT_STRING
-#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
-#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
-#else
-#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
-#include <sal.h>
-
-#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
-#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
-#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
-#define SDL_OUT_CAP(x) _Out_cap_(x)
-#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
-#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
-
-#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
-#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
-#else
-#define SDL_IN_BYTECAP(x)
-#define SDL_INOUT_Z_CAP(x)
-#define SDL_OUT_Z_CAP(x)
-#define SDL_OUT_CAP(x)
-#define SDL_OUT_BYTECAP(x)
-#define SDL_OUT_Z_BYTECAP(x)
-#define SDL_PRINTF_FORMAT_STRING
-#define SDL_SCANF_FORMAT_STRING
-#endif
-#if defined(__GNUC__)
-#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
-#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
-#else
-#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
-#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
-#endif
-#endif /* SDL_DISABLE_ANALYZE_MACROS */
-
-#define SDL_COMPILE_TIME_ASSERT(name, x) \
- typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
-/** \cond */
-#ifndef DOXYGEN_SHOULD_IGNORE_THIS
-SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
-SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
-SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
-SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
-SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
-SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
-SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
-SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
-#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
-/** \endcond */
-
-/* Check to make sure enums are the size of ints, for structure packing.
- For both Watcom C/C++ and Borland C/C++ the compiler option that makes
- enums having the size of an int must be enabled.
- This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
-*/
-
-/** \cond */
-#ifndef DOXYGEN_SHOULD_IGNORE_THIS
-#if !defined(__ANDROID__)
- /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
-typedef enum
-{
- DUMMY_ENUM_VALUE
-} SDL_DUMMY_ENUM;
-
-SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
-#endif
-#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
-/** \endcond */
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(HAVE_ALLOCA) && !defined(alloca)
-# if defined(HAVE_ALLOCA_H)
-# include <alloca.h>
-# elif defined(__GNUC__)
-# define alloca __builtin_alloca
-# elif defined(_MSC_VER)
-# include <malloc.h>
-# define alloca _alloca
-# elif defined(__WATCOMC__)
-# include <malloc.h>
-# elif defined(__BORLANDC__)
-# include <malloc.h>
-# elif defined(__DMC__)
-# include <stdlib.h>
-# elif defined(__AIX__)
-#pragma alloca
-# elif defined(__MRC__)
-void *alloca(unsigned);
-# else
-char *alloca();
-# endif
-#endif
-#ifdef HAVE_ALLOCA
-#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
-#define SDL_stack_free(data)
-#else
-#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
-#define SDL_stack_free(data) SDL_free(data)
-#endif
-
-extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
-extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
-extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
-extern DECLSPEC void SDLCALL SDL_free(void *mem);
-
-typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
-typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
-typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
-typedef void (SDLCALL *SDL_free_func)(void *mem);
-
-/**
- * \brief Get the current set of SDL memory functions
- */
-extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
- SDL_calloc_func *calloc_func,
- SDL_realloc_func *realloc_func,
- SDL_free_func *free_func);
-
-/**
- * \brief Replace SDL's memory allocation functions with a custom set
- *
- * \note If you are replacing SDL's memory functions, you should call
- * SDL_GetNumAllocations() and be very careful if it returns non-zero.
- * That means that your free function will be called with memory
- * allocated by the previous memory allocation functions.
- */
-extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
- SDL_calloc_func calloc_func,
- SDL_realloc_func realloc_func,
- SDL_free_func free_func);
-
-/**
- * \brief Get the number of outstanding (unfreed) allocations
- */
-extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
-
-extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
-extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
-
-extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
-
-extern DECLSPEC int SDLCALL SDL_abs(int x);
-
-/* !!! FIXME: these have side effects. You probably shouldn't use them. */
-/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
-#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
-#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
-
-extern DECLSPEC int SDLCALL SDL_isdigit(int x);
-extern DECLSPEC int SDLCALL SDL_isspace(int x);
-extern DECLSPEC int SDLCALL SDL_toupper(int x);
-extern DECLSPEC int SDLCALL SDL_tolower(int x);
-
-extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
-
-#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
-#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
-
-/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
-SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
-{
-#if defined(__GNUC__) && defined(i386)
- int u0, u1, u2;
- __asm__ __volatile__ (
- "cld \n\t"
- "rep ; stosl \n\t"
- : "=&D" (u0), "=&a" (u1), "=&c" (u2)
- : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
- : "memory"
- );
-#else
- size_t _n = (dwords + 3) / 4;
- Uint32 *_p = SDL_static_cast(Uint32 *, dst);
- Uint32 _val = (val);
- if (dwords == 0)
- return;
- switch (dwords % 4)
- {
- case 0: do { *_p++ = _val; /* fallthrough */
- case 3: *_p++ = _val; /* fallthrough */
- case 2: *_p++ = _val; /* fallthrough */
- case 1: *_p++ = _val; /* fallthrough */
- } while ( --_n );
- }
-#endif
-}
-
-
-extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
-
-extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
-extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
-
-extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
-extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
-extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
-extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
-
-extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
-extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
-extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
-extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
-extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
-extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
-extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
-extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
-extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
-extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
-extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
-extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
-
-extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
-extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
-
-extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
-extern DECLSPEC double SDLCALL SDL_atof(const char *str);
-extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
-extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
-extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
-extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
-extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
-
-extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
-extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
-extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
-extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
-
-extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
-extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
-extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
-extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
-
-#ifndef HAVE_M_PI
-#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327950288 /**< pi */
-#endif
-#endif
-
-extern DECLSPEC double SDLCALL SDL_acos(double x);
-extern DECLSPEC double SDLCALL SDL_asin(double x);
-extern DECLSPEC double SDLCALL SDL_atan(double x);
-extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
-extern DECLSPEC double SDLCALL SDL_ceil(double x);
-extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
-extern DECLSPEC double SDLCALL SDL_cos(double x);
-extern DECLSPEC float SDLCALL SDL_cosf(float x);
-extern DECLSPEC double SDLCALL SDL_fabs(double x);
-extern DECLSPEC double SDLCALL SDL_floor(double x);
-extern DECLSPEC double SDLCALL SDL_log(double x);
-extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
-extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
-extern DECLSPEC double SDLCALL SDL_sin(double x);
-extern DECLSPEC float SDLCALL SDL_sinf(float x);
-extern DECLSPEC double SDLCALL SDL_sqrt(double x);
-extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
-extern DECLSPEC double SDLCALL SDL_tan(double x);
-extern DECLSPEC float SDLCALL SDL_tanf(float x);
-
-/* The SDL implementation of iconv() returns these error codes */
-#define SDL_ICONV_ERROR (size_t)-1
-#define SDL_ICONV_E2BIG (size_t)-2
-#define SDL_ICONV_EILSEQ (size_t)-3
-#define SDL_ICONV_EINVAL (size_t)-4
-
-/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
-typedef struct _SDL_iconv_t *SDL_iconv_t;
-extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
- const char *fromcode);
-extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
-extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
- size_t * inbytesleft, char **outbuf,
- size_t * outbytesleft);
-/**
- * This function converts a string between encodings in one pass, returning a
- * string that must be freed with SDL_free() or NULL on error.
- */
-extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
- const char *fromcode,
- const char *inbuf,
- size_t inbytesleft);
-#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
-
-/* force builds using Clang's static analysis tools to use literal C runtime
- here, since there are possibly tests that are ineffective otherwise. */
-#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
-#define SDL_malloc malloc
-#define SDL_calloc calloc
-#define SDL_realloc realloc
-#define SDL_free free
-#define SDL_memset memset
-#define SDL_memcpy memcpy
-#define SDL_memmove memmove
-#define SDL_memcmp memcmp
-#define SDL_strlen strlen
-#define SDL_strlcpy strlcpy
-#define SDL_strlcat strlcat
-#define SDL_strdup strdup
-#define SDL_strchr strchr
-#define SDL_strrchr strrchr
-#define SDL_strstr strstr
-#define SDL_strcmp strcmp
-#define SDL_strncmp strncmp
-#define SDL_strcasecmp strcasecmp
-#define SDL_strncasecmp strncasecmp
-#define SDL_sscanf sscanf
-#define SDL_vsscanf vsscanf
-#define SDL_snprintf snprintf
-#define SDL_vsnprintf vsnprintf
-#endif
-
-SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
-{
- return SDL_memcpy(dst, src, dwords * 4);
-}
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_stdinc_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_surface.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_surface.h
deleted file mode 100644
index 510690c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_surface.h
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_surface.h
- *
- * Header file for ::SDL_Surface definition and management functions.
- */
-
-#ifndef SDL_surface_h_
-#define SDL_surface_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_pixels.h"
-#include "SDL_rect.h"
-#include "SDL_blendmode.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name Surface flags
- *
- * These are the currently supported flags for the ::SDL_Surface.
- *
- * \internal
- * Used internally (read-only).
- */
-/* @{ */
-#define SDL_SWSURFACE 0 /**< Just here for compatibility */
-#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
-#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
-#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
-/* @} *//* Surface flags */
-
-/**
- * Evaluates to true if the surface needs to be locked before access.
- */
-#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
-
-/**
- * \brief A collection of pixels used in software blitting.
- *
- * \note This structure should be treated as read-only, except for \c pixels,
- * which, if not NULL, contains the raw pixel data for the surface.
- */
-typedef struct SDL_Surface
-{
- Uint32 flags; /**< Read-only */
- SDL_PixelFormat *format; /**< Read-only */
- int w, h; /**< Read-only */
- int pitch; /**< Read-only */
- void *pixels; /**< Read-write */
-
- /** Application data associated with the surface */
- void *userdata; /**< Read-write */
-
- /** information needed for surfaces requiring locks */
- int locked; /**< Read-only */
- void *lock_data; /**< Read-only */
-
- /** clipping information */
- SDL_Rect clip_rect; /**< Read-only */
-
- /** info for fast blit mapping to other surfaces */
- struct SDL_BlitMap *map; /**< Private */
-
- /** Reference count -- used when freeing surface */
- int refcount; /**< Read-mostly */
-} SDL_Surface;
-
-/**
- * \brief The type of function used for surface blitting functions.
- */
-typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
- struct SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * Allocate and free an RGB surface.
- *
- * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
- * If the depth is greater than 8 bits, the pixel format is set using the
- * flags '[RGB]mask'.
- *
- * If the function runs out of memory, it will return NULL.
- *
- * \param flags The \c flags are obsolete and should be set to 0.
- * \param width The width in pixels of the surface to create.
- * \param height The height in pixels of the surface to create.
- * \param depth The depth in bits of the surface to create.
- * \param Rmask The red mask of the surface to create.
- * \param Gmask The green mask of the surface to create.
- * \param Bmask The blue mask of the surface to create.
- * \param Amask The alpha mask of the surface to create.
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
- (Uint32 flags, int width, int height, int depth,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
-
-/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
- (Uint32 flags, int width, int height, int depth, Uint32 format);
-
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
- int width,
- int height,
- int depth,
- int pitch,
- Uint32 Rmask,
- Uint32 Gmask,
- Uint32 Bmask,
- Uint32 Amask);
-extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
- (void *pixels, int width, int height, int depth, int pitch, Uint32 format);
-extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
-
-/**
- * \brief Set the palette used by a surface.
- *
- * \return 0, or -1 if the surface format doesn't use a palette.
- *
- * \note A single palette can be shared with many surfaces.
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
- SDL_Palette * palette);
-
-/**
- * \brief Sets up a surface for directly accessing the pixels.
- *
- * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
- * to and read from \c surface->pixels, using the pixel format stored in
- * \c surface->format. Once you are done accessing the surface, you should
- * use SDL_UnlockSurface() to release it.
- *
- * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
- * to 0, then you can read and write to the surface at any time, and the
- * pixel format of the surface will not change.
- *
- * No operating system or library calls should be made between lock/unlock
- * pairs, as critical system locks may be held during this time.
- *
- * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
- *
- * \sa SDL_UnlockSurface()
- */
-extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
-/** \sa SDL_LockSurface() */
-extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
-
-/**
- * Load a surface from a seekable SDL data stream (memory or file).
- *
- * If \c freesrc is non-zero, the stream will be closed after being read.
- *
- * The new surface should be freed with SDL_FreeSurface().
- *
- * \return the new surface, or NULL if there was an error.
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
- int freesrc);
-
-/**
- * Load a surface from a file.
- *
- * Convenience macro.
- */
-#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
-
-/**
- * Save a surface to a seekable SDL data stream (memory or file).
- *
- * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
- * BMP directly. Other RGB formats with 8-bit or higher get converted to a
- * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
- * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
- * not supported.
- *
- * If \c freedst is non-zero, the stream will be closed after being written.
- *
- * \return 0 if successful or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
- (SDL_Surface * surface, SDL_RWops * dst, int freedst);
-
-/**
- * Save a surface to a file.
- *
- * Convenience macro.
- */
-#define SDL_SaveBMP(surface, file) \
- SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
-
-/**
- * \brief Sets the RLE acceleration hint for a surface.
- *
- * \return 0 on success, or -1 if the surface is not valid
- *
- * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
- * but the surface must be locked before directly accessing the pixels.
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
- int flag);
-
-/**
- * \brief Sets the color key (transparent pixel) in a blittable surface.
- *
- * \param surface The surface to update
- * \param flag Non-zero to enable colorkey and 0 to disable colorkey
- * \param key The transparent pixel in the native surface format
- *
- * \return 0 on success, or -1 if the surface is not valid
- *
- * You can pass SDL_RLEACCEL to enable RLE accelerated blits.
- */
-extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
- int flag, Uint32 key);
-
-/**
- * \brief Gets the color key (transparent pixel) in a blittable surface.
- *
- * \param surface The surface to update
- * \param key A pointer filled in with the transparent pixel in the native
- * surface format
- *
- * \return 0 on success, or -1 if the surface is not valid or colorkey is not
- * enabled.
- */
-extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
- Uint32 * key);
-
-/**
- * \brief Set an additional color value used in blit operations.
- *
- * \param surface The surface to update.
- * \param r The red color value multiplied into blit operations.
- * \param g The green color value multiplied into blit operations.
- * \param b The blue color value multiplied into blit operations.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_GetSurfaceColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
- Uint8 r, Uint8 g, Uint8 b);
-
-
-/**
- * \brief Get the additional color value used in blit operations.
- *
- * \param surface The surface to query.
- * \param r A pointer filled in with the current red color value.
- * \param g A pointer filled in with the current green color value.
- * \param b A pointer filled in with the current blue color value.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_SetSurfaceColorMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
- Uint8 * r, Uint8 * g,
- Uint8 * b);
-
-/**
- * \brief Set an additional alpha value used in blit operations.
- *
- * \param surface The surface to update.
- * \param alpha The alpha value multiplied into blit operations.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_GetSurfaceAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
- Uint8 alpha);
-
-/**
- * \brief Get the additional alpha value used in blit operations.
- *
- * \param surface The surface to query.
- * \param alpha A pointer filled in with the current alpha value.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_SetSurfaceAlphaMod()
- */
-extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
- Uint8 * alpha);
-
-/**
- * \brief Set the blend mode used for blit operations.
- *
- * \param surface The surface to update.
- * \param blendMode ::SDL_BlendMode to use for blit blending.
- *
- * \return 0 on success, or -1 if the parameters are not valid.
- *
- * \sa SDL_GetSurfaceBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
- SDL_BlendMode blendMode);
-
-/**
- * \brief Get the blend mode used for blit operations.
- *
- * \param surface The surface to query.
- * \param blendMode A pointer filled in with the current blend mode.
- *
- * \return 0 on success, or -1 if the surface is not valid.
- *
- * \sa SDL_SetSurfaceBlendMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
- SDL_BlendMode *blendMode);
-
-/**
- * Sets the clipping rectangle for the destination surface in a blit.
- *
- * If the clip rectangle is NULL, clipping will be disabled.
- *
- * If the clip rectangle doesn't intersect the surface, the function will
- * return SDL_FALSE and blits will be completely clipped. Otherwise the
- * function returns SDL_TRUE and blits to the surface will be clipped to
- * the intersection of the surface area and the clipping rectangle.
- *
- * Note that blits are automatically clipped to the edges of the source
- * and destination surfaces.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
- const SDL_Rect * rect);
-
-/**
- * Gets the clipping rectangle for the destination surface in a blit.
- *
- * \c rect must be a pointer to a valid rectangle which will be filled
- * with the correct values.
- */
-extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
- SDL_Rect * rect);
-
-/*
- * Creates a new surface identical to the existing surface
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
-
-/**
- * Creates a new surface of the specified format, and then copies and maps
- * the given surface to it so the blit of the converted surface will be as
- * fast as possible. If this function fails, it returns NULL.
- *
- * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
- * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and
- * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
- * surface.
- */
-extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
- (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags);
-extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
- (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
-
-/**
- * \brief Copy a block of pixels of one format to another format
- *
- * \return 0 on success, or -1 if there was an error
- */
-extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
- Uint32 src_format,
- const void * src, int src_pitch,
- Uint32 dst_format,
- void * dst, int dst_pitch);
-
-/**
- * Performs a fast fill of the given rectangle with \c color.
- *
- * If \c rect is NULL, the whole surface will be filled with \c color.
- *
- * The color should be a pixel of the format used by the surface, and
- * can be generated by the SDL_MapRGB() function.
- *
- * \return 0 on success, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_FillRect
- (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
-extern DECLSPEC int SDLCALL SDL_FillRects
- (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
-
-/**
- * Performs a fast blit from the source surface to the destination surface.
- *
- * This assumes that the source and destination rectangles are
- * the same size. If either \c srcrect or \c dstrect are NULL, the entire
- * surface (\c src or \c dst) is copied. The final blit rectangles are saved
- * in \c srcrect and \c dstrect after all clipping is performed.
- *
- * \return If the blit is successful, it returns 0, otherwise it returns -1.
- *
- * The blit function should not be called on a locked surface.
- *
- * The blit semantics for surfaces with and without blending and colorkey
- * are defined as follows:
- * \verbatim
- RGBA->RGB:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source alpha-channel and per-surface alpha)
- SDL_SRCCOLORKEY ignored.
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB.
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- RGB values of the source color key, ignoring alpha in the
- comparison.
-
- RGB->RGBA:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source per-surface alpha)
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB, set destination alpha to source per-surface alpha value.
- both:
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- source color key.
-
- RGBA->RGBA:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source alpha-channel and per-surface alpha)
- SDL_SRCCOLORKEY ignored.
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy all of RGBA to the destination.
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- RGB values of the source color key, ignoring alpha in the
- comparison.
-
- RGB->RGB:
- Source surface blend mode set to SDL_BLENDMODE_BLEND:
- alpha-blend (using the source per-surface alpha)
- Source surface blend mode set to SDL_BLENDMODE_NONE:
- copy RGB.
- both:
- if SDL_SRCCOLORKEY set, only copy the pixels matching the
- source color key.
- \endverbatim
- *
- * You should call SDL_BlitSurface() unless you know exactly how SDL
- * blitting works internally and how to use the other blit functions.
- */
-#define SDL_BlitSurface SDL_UpperBlit
-
-/**
- * This is the public blit function, SDL_BlitSurface(), and it performs
- * rectangle validation and clipping before passing it to SDL_LowerBlit()
- */
-extern DECLSPEC int SDLCALL SDL_UpperBlit
- (SDL_Surface * src, const SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * This is a semi-private blit function and it performs low-level surface
- * blitting only.
- */
-extern DECLSPEC int SDLCALL SDL_LowerBlit
- (SDL_Surface * src, SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * \brief Perform a fast, low quality, stretch blit between two surfaces of the
- * same pixel format.
- *
- * \note This function uses a static buffer, and is not thread-safe.
- */
-extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
- const SDL_Rect * srcrect,
- SDL_Surface * dst,
- const SDL_Rect * dstrect);
-
-#define SDL_BlitScaled SDL_UpperBlitScaled
-
-/**
- * This is the public scaled blit function, SDL_BlitScaled(), and it performs
- * rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
- */
-extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
- (SDL_Surface * src, const SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-/**
- * This is a semi-private blit function and it performs low-level surface
- * scaled blitting only.
- */
-extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
- (SDL_Surface * src, SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_surface_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_system.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_system.h
deleted file mode 100644
index eb069b3..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_system.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_system.h
- *
- * Include file for platform specific SDL API functions
- */
-
-#ifndef SDL_system_h_
-#define SDL_system_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_keyboard.h"
-#include "SDL_render.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Platform specific functions for Windows */
-#ifdef __WIN32__
-
-/**
- \brief Set a function that is called for every windows message, before TranslateMessage()
-*/
-typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
-extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
-
-/**
- \brief Returns the D3D9 adapter index that matches the specified display index.
-
- This adapter index can be passed to IDirect3D9::CreateDevice and controls
- on which monitor a full screen application will appear.
-*/
-extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
-
-typedef struct IDirect3DDevice9 IDirect3DDevice9;
-/**
- \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer.
-
- Once you are done using the device, you should release it to avoid a resource leak.
- */
-extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
-
-/**
- \brief Returns the DXGI Adapter and Output indices for the specified display index.
-
- These can be passed to EnumAdapters and EnumOutputs respectively to get the objects
- required to create a DX10 or DX11 device and swap chain.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
-
-#endif /* __WIN32__ */
-
-
-/* Platform specific functions for iOS */
-#if defined(__IPHONEOS__) && __IPHONEOS__
-
-#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
-extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
-
-#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
-extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
-
-#endif /* __IPHONEOS__ */
-
-
-/* Platform specific functions for Android */
-#if defined(__ANDROID__) && __ANDROID__
-
-/**
- \brief Get the JNI environment for the current thread
-
- This returns JNIEnv*, but the prototype is void* so we don't need jni.h
- */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
-
-/**
- \brief Get the SDL Activity object for the application
-
- This returns jobject, but the prototype is void* so we don't need jni.h
- The jobject returned by SDL_AndroidGetActivity is a local reference.
- It is the caller's responsibility to properly release it
- (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
- */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
-
-/**
- See the official Android developer guide for more information:
- http://developer.android.com/guide/topics/data/data-storage.html
-*/
-#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
-#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
-
-/**
- \brief Get the path used for internal storage for this application.
-
- This path is unique to your application and cannot be written to
- by other applications.
- */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
-
-/**
- \brief Get the current state of external storage, a bitmask of these values:
- SDL_ANDROID_EXTERNAL_STORAGE_READ
- SDL_ANDROID_EXTERNAL_STORAGE_WRITE
-
- If external storage is currently unavailable, this will return 0.
-*/
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
-
-/**
- \brief Get the path used for external storage for this application.
-
- This path is unique to your application, but is public and can be
- written to by other applications.
- */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
-
-#endif /* __ANDROID__ */
-
-/* Platform specific functions for WinRT */
-#if defined(__WINRT__) && __WINRT__
-
-/**
- * \brief WinRT / Windows Phone path types
- */
-typedef enum
-{
- /** \brief The installed app's root directory.
- Files here are likely to be read-only. */
- SDL_WINRT_PATH_INSTALLED_LOCATION,
-
- /** \brief The app's local data store. Files may be written here */
- SDL_WINRT_PATH_LOCAL_FOLDER,
-
- /** \brief The app's roaming data store. Unsupported on Windows Phone.
- Files written here may be copied to other machines via a network
- connection.
- */
- SDL_WINRT_PATH_ROAMING_FOLDER,
-
- /** \brief The app's temporary data store. Unsupported on Windows Phone.
- Files written here may be deleted at any time. */
- SDL_WINRT_PATH_TEMP_FOLDER
-} SDL_WinRT_Path;
-
-
-/**
- * \brief Retrieves a WinRT defined path on the local file system
- *
- * \note Documentation on most app-specific path types on WinRT
- * can be found on MSDN, at the URL:
- * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
- *
- * \param pathType The type of path to retrieve.
- * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
- * if the path is not available for any reason. Not all paths are
- * available on all versions of Windows. This is especially true on
- * Windows Phone. Check the documentation for the given
- * SDL_WinRT_Path for more information on which path types are
- * supported where.
- */
-extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
-
-/**
- * \brief Retrieves a WinRT defined path on the local file system
- *
- * \note Documentation on most app-specific path types on WinRT
- * can be found on MSDN, at the URL:
- * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
- *
- * \param pathType The type of path to retrieve.
- * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
- * if the path is not available for any reason. Not all paths are
- * available on all versions of Windows. This is especially true on
- * Windows Phone. Check the documentation for the given
- * SDL_WinRT_Path for more information on which path types are
- * supported where.
- */
-extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
-
-#endif /* __WINRT__ */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_system_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_syswm.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_syswm.h
deleted file mode 100644
index 2d18afb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_syswm.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_syswm.h
- *
- * Include file for SDL custom system window manager hooks.
- */
-
-#ifndef SDL_syswm_h_
-#define SDL_syswm_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-#include "SDL_version.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \file SDL_syswm.h
- *
- * Your application has access to a special type of event ::SDL_SYSWMEVENT,
- * which contains window-manager specific information and arrives whenever
- * an unhandled window event occurs. This event is ignored by default, but
- * you can enable it with SDL_EventState().
- */
-#ifdef SDL_PROTOTYPES_ONLY
-struct SDL_SysWMinfo;
-#else
-
-#if defined(SDL_VIDEO_DRIVER_WINDOWS)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_WINRT)
-#include <Inspectable.h>
-#endif
-
-/* This is the structure for custom window manager events */
-#if defined(SDL_VIDEO_DRIVER_X11)
-#if defined(__APPLE__) && defined(__MACH__)
-/* conflicts with Quickdraw.h */
-#define Cursor X11Cursor
-#endif
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#if defined(__APPLE__) && defined(__MACH__)
-/* matches the re-define above */
-#undef Cursor
-#endif
-
-#endif /* defined(SDL_VIDEO_DRIVER_X11) */
-
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
-#include <directfb.h>
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_COCOA)
-#ifdef __OBJC__
-@class NSWindow;
-#else
-typedef struct _NSWindow NSWindow;
-#endif
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_UIKIT)
-#ifdef __OBJC__
-#include <UIKit/UIKit.h>
-#else
-typedef struct _UIWindow UIWindow;
-typedef struct _UIViewController UIViewController;
-#endif
-typedef Uint32 GLuint;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_ANDROID)
-typedef struct ANativeWindow ANativeWindow;
-typedef void *EGLSurface;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_VIVANTE)
-#include "SDL_egl.h"
-#endif
-
-/**
- * These are the various supported windowing subsystems
- */
-typedef enum
-{
- SDL_SYSWM_UNKNOWN,
- SDL_SYSWM_WINDOWS,
- SDL_SYSWM_X11,
- SDL_SYSWM_DIRECTFB,
- SDL_SYSWM_COCOA,
- SDL_SYSWM_UIKIT,
- SDL_SYSWM_WAYLAND,
- SDL_SYSWM_MIR,
- SDL_SYSWM_WINRT,
- SDL_SYSWM_ANDROID,
- SDL_SYSWM_VIVANTE,
- SDL_SYSWM_OS2
-} SDL_SYSWM_TYPE;
-
-/**
- * The custom event structure.
- */
-struct SDL_SysWMmsg
-{
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union
- {
-#if defined(SDL_VIDEO_DRIVER_WINDOWS)
- struct {
- HWND hwnd; /**< The window for the message */
- UINT msg; /**< The type of message */
- WPARAM wParam; /**< WORD message parameter */
- LPARAM lParam; /**< LONG message parameter */
- } win;
-#endif
-#if defined(SDL_VIDEO_DRIVER_X11)
- struct {
- XEvent event;
- } x11;
-#endif
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
- struct {
- DFBEvent event;
- } dfb;
-#endif
-#if defined(SDL_VIDEO_DRIVER_COCOA)
- struct
- {
- /* Latest version of Xcode clang complains about empty structs in C v. C++:
- error: empty struct has size 0 in C, size 1 in C++
- */
- int dummy;
- /* No Cocoa window events yet */
- } cocoa;
-#endif
-#if defined(SDL_VIDEO_DRIVER_UIKIT)
- struct
- {
- int dummy;
- /* No UIKit window events yet */
- } uikit;
-#endif
-#if defined(SDL_VIDEO_DRIVER_VIVANTE)
- struct
- {
- int dummy;
- /* No Vivante window events yet */
- } vivante;
-#endif
- /* Can't have an empty union */
- int dummy;
- } msg;
-};
-
-/**
- * The custom window manager information structure.
- *
- * When this structure is returned, it holds information about which
- * low level system it is using, and will be one of SDL_SYSWM_TYPE.
- */
-struct SDL_SysWMinfo
-{
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union
- {
-#if defined(SDL_VIDEO_DRIVER_WINDOWS)
- struct
- {
- HWND window; /**< The window handle */
- HDC hdc; /**< The window device context */
- HINSTANCE hinstance; /**< The instance handle */
- } win;
-#endif
-#if defined(SDL_VIDEO_DRIVER_WINRT)
- struct
- {
- IInspectable * window; /**< The WinRT CoreWindow */
- } winrt;
-#endif
-#if defined(SDL_VIDEO_DRIVER_X11)
- struct
- {
- Display *display; /**< The X11 display */
- Window window; /**< The X11 window */
- } x11;
-#endif
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
- struct
- {
- IDirectFB *dfb; /**< The directfb main interface */
- IDirectFBWindow *window; /**< The directfb window handle */
- IDirectFBSurface *surface; /**< The directfb client surface */
- } dfb;
-#endif
-#if defined(SDL_VIDEO_DRIVER_COCOA)
- struct
- {
-#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- NSWindow __unsafe_unretained *window; /**< The Cocoa window */
-#else
- NSWindow *window; /**< The Cocoa window */
-#endif
- } cocoa;
-#endif
-#if defined(SDL_VIDEO_DRIVER_UIKIT)
- struct
- {
-#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- UIWindow __unsafe_unretained *window; /**< The UIKit window */
-#else
- UIWindow *window; /**< The UIKit window */
-#endif
- GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
- GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
- GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
- } uikit;
-#endif
-#if defined(SDL_VIDEO_DRIVER_WAYLAND)
- struct
- {
- struct wl_display *display; /**< Wayland display */
- struct wl_surface *surface; /**< Wayland surface */
- struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
- } wl;
-#endif
-#if defined(SDL_VIDEO_DRIVER_MIR)
- struct
- {
- struct MirConnection *connection; /**< Mir display server connection */
- struct MirSurface *surface; /**< Mir surface */
- } mir;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_ANDROID)
- struct
- {
- ANativeWindow *window;
- EGLSurface surface;
- } android;
-#endif
-
-#if defined(SDL_VIDEO_DRIVER_VIVANTE)
- struct
- {
- EGLNativeDisplayType display;
- EGLNativeWindowType window;
- } vivante;
-#endif
-
- /* Make sure this union is always 64 bytes (8 64-bit pointers). */
- /* Be careful not to overflow this if you add a new target! */
- Uint8 dummy[64];
- } info;
-};
-
-#endif /* SDL_PROTOTYPES_ONLY */
-
-typedef struct SDL_SysWMinfo SDL_SysWMinfo;
-
-/* Function prototypes */
-/**
- * \brief This function allows access to driver-dependent window information.
- *
- * \param window The window about which information is being requested
- * \param info This structure must be initialized with the SDL version, and is
- * then filled in with information about the given window.
- *
- * \return SDL_TRUE if the function is implemented and the version member of
- * the \c info struct is valid, SDL_FALSE otherwise.
- *
- * You typically use this function like this:
- * \code
- * SDL_SysWMinfo info;
- * SDL_VERSION(&info.version);
- * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
- * \endcode
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
- SDL_SysWMinfo * info);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_syswm_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test.h
deleted file mode 100644
index f55afcb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-#ifndef SDL_test_h_
-#define SDL_test_h_
-
-#include "SDL.h"
-#include "SDL_test_assert.h"
-#include "SDL_test_common.h"
-#include "SDL_test_compare.h"
-#include "SDL_test_crc32.h"
-#include "SDL_test_font.h"
-#include "SDL_test_fuzzer.h"
-#include "SDL_test_harness.h"
-#include "SDL_test_images.h"
-#include "SDL_test_log.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_memory.h"
-#include "SDL_test_random.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Global definitions */
-
-/*
- * Note: Maximum size of SDLTest log message is less than SDL's limit
- * to ensure we can fit additional information such as the timestamp.
- */
-#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_assert.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_assert.h
deleted file mode 100644
index 11d8363..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_assert.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_assert.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- *
- * Assert API for test code and test cases
- *
- */
-
-#ifndef SDL_test_assert_h_
-#define SDL_test_assert_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Fails the assert.
- */
-#define ASSERT_FAIL 0
-
-/**
- * \brief Passes the assert.
- */
-#define ASSERT_PASS 1
-
-/**
- * \brief Assert that logs and break execution flow on failures.
- *
- * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
- * \param assertDescription Message to log with the assert describing it.
- */
-void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
- *
- * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
- * \param assertDescription Message to log with the assert describing it.
- *
- * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
- */
-int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
-
-/**
- * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
- *
- * \param assertDescription Message to log with the assert describing it.
- */
-void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/**
- * \brief Resets the assert summary counters to zero.
- */
-void SDLTest_ResetAssertSummary(void);
-
-/**
- * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
- */
-void SDLTest_LogAssertSummary(void);
-
-
-/**
- * \brief Converts the current assert summary state to a test result.
- *
- * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
- */
-int SDLTest_AssertSummaryToTestResult(void);
-
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_assert_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_common.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_common.h
deleted file mode 100644
index 24eeb32..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_common.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_common.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/* Ported from original test\common.h file. */
-
-#ifndef SDL_test_common_h_
-#define SDL_test_common_h_
-
-#include "SDL.h"
-
-#if defined(__PSP__)
-#define DEFAULT_WINDOW_WIDTH 480
-#define DEFAULT_WINDOW_HEIGHT 272
-#else
-#define DEFAULT_WINDOW_WIDTH 640
-#define DEFAULT_WINDOW_HEIGHT 480
-#endif
-
-#define VERBOSE_VIDEO 0x00000001
-#define VERBOSE_MODES 0x00000002
-#define VERBOSE_RENDER 0x00000004
-#define VERBOSE_EVENT 0x00000008
-#define VERBOSE_AUDIO 0x00000010
-
-typedef struct
-{
- /* SDL init flags */
- char **argv;
- Uint32 flags;
- Uint32 verbose;
-
- /* Video info */
- const char *videodriver;
- int display;
- const char *window_title;
- const char *window_icon;
- Uint32 window_flags;
- int window_x;
- int window_y;
- int window_w;
- int window_h;
- int window_minW;
- int window_minH;
- int window_maxW;
- int window_maxH;
- int logical_w;
- int logical_h;
- float scale;
- int depth;
- int refresh_rate;
- int num_windows;
- SDL_Window **windows;
-
- /* Renderer info */
- const char *renderdriver;
- Uint32 render_flags;
- SDL_bool skip_renderer;
- SDL_Renderer **renderers;
- SDL_Texture **targets;
-
- /* Audio info */
- const char *audiodriver;
- SDL_AudioSpec audiospec;
-
- /* GL settings */
- int gl_red_size;
- int gl_green_size;
- int gl_blue_size;
- int gl_alpha_size;
- int gl_buffer_size;
- int gl_depth_size;
- int gl_stencil_size;
- int gl_double_buffer;
- int gl_accum_red_size;
- int gl_accum_green_size;
- int gl_accum_blue_size;
- int gl_accum_alpha_size;
- int gl_stereo;
- int gl_multisamplebuffers;
- int gl_multisamplesamples;
- int gl_retained_backing;
- int gl_accelerated;
- int gl_major_version;
- int gl_minor_version;
- int gl_debug;
- int gl_profile_mask;
-} SDLTest_CommonState;
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function prototypes */
-
-/**
- * \brief Parse command line parameters and create common state.
- *
- * \param argv Array of command line parameters
- * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
- *
- * \returns Returns a newly allocated common state object.
- */
-SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
-
-/**
- * \brief Process one common argument.
- *
- * \param state The common state describing the test window to create.
- * \param index The index of the argument to process in argv[].
- *
- * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
- */
-int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
-
-/**
- * \brief Returns common usage information
- *
- * \param state The common state describing the test window to create.
- *
- * \returns String with usage information
- */
-const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
-
-/**
- * \brief Open test window.
- *
- * \param state The common state describing the test window to create.
- *
- * \returns True if initialization succeeded, false otherwise
- */
-SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
-
-/**
- * \brief Common event handler for test windows.
- *
- * \param state The common state used to create test window.
- * \param event The event to handle.
- * \param done Flag indicating we are done.
- *
- */
-void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
-
-/**
- * \brief Close test window.
- *
- * \param state The common state used to create test window.
- *
- */
-void SDLTest_CommonQuit(SDLTest_CommonState * state);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_common_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_compare.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_compare.h
deleted file mode 100644
index 9f4c458..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_compare.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_compare.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Defines comparison functions (i.e. for surfaces).
-
-*/
-
-#ifndef SDL_test_compare_h_
-#define SDL_test_compare_h_
-
-#include "SDL.h"
-
-#include "SDL_test_images.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Compares a surface and with reference image data for equality
- *
- * \param surface Surface used in comparison
- * \param referenceSurface Test Surface used in comparison
- * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
- *
- * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
- */
-int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_compare_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_crc32.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_crc32.h
deleted file mode 100644
index add480c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_crc32.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_crc32.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Implements CRC32 calculations (default output is Perl String::CRC32 compatible).
-
-*/
-
-#ifndef SDL_test_crc32_h_
-#define SDL_test_crc32_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* ------------ Definitions --------- */
-
-/* Definition shared by all CRC routines */
-
-#ifndef CrcUint32
- #define CrcUint32 unsigned int
-#endif
-#ifndef CrcUint8
- #define CrcUint8 unsigned char
-#endif
-
-#ifdef ORIGINAL_METHOD
- #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
-#else
- #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
-#endif
-
-/**
- * Data structure for CRC32 (checksum) computation
- */
- typedef struct {
- CrcUint32 crc32_table[256]; /* CRC table */
- } SDLTest_Crc32Context;
-
-/* ---------- Function Prototypes ------------- */
-
-/**
- * \brief Initialize the CRC context
- *
- * Note: The function initializes the crc table required for all crc calculations.
- *
- * \param crcContext pointer to context variable
- *
- * \returns 0 for OK, -1 on error
- *
- */
- int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
-
-
-/**
- * \brief calculate a crc32 from a data block
- *
- * \param crcContext pointer to context variable
- * \param inBuf input buffer to checksum
- * \param inLen length of input buffer
- * \param crc32 pointer to Uint32 to store the final CRC into
- *
- * \returns 0 for OK, -1 on error
- *
- */
-int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
-
-/* Same routine broken down into three steps */
-int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
-int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
-int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
-
-
-/**
- * \brief clean up CRC context
- *
- * \param crcContext pointer to context variable
- *
- * \returns 0 for OK, -1 on error
- *
-*/
-
-int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_crc32_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_font.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_font.h
deleted file mode 100644
index 58c9f9d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_font.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_font.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-#ifndef SDL_test_font_h_
-#define SDL_test_font_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function prototypes */
-
-#define FONT_CHARACTER_SIZE 8
-
-/**
- * \brief Draw a string in the currently set font.
- *
- * \param renderer The renderer to draw on.
- * \param x The X coordinate of the upper left corner of the character.
- * \param y The Y coordinate of the upper left corner of the character.
- * \param c The character to draw.
- *
- * \returns Returns 0 on success, -1 on failure.
- */
-int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
-
-/**
- * \brief Draw a string in the currently set font.
- *
- * \param renderer The renderer to draw on.
- * \param x The X coordinate of the upper left corner of the string.
- * \param y The Y coordinate of the upper left corner of the string.
- * \param s The string to draw.
- *
- * \returns Returns 0 on success, -1 on failure.
- */
-int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
-
-
-/**
- * \brief Cleanup textures used by font drawing functions.
- */
-void SDLTest_CleanupTextDrawing(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_font_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_fuzzer.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_fuzzer.h
deleted file mode 100644
index 6cf0574..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_fuzzer.h
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_fuzzer.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Data generators for fuzzing test data in a reproducible way.
-
-*/
-
-#ifndef SDL_test_fuzzer_h_
-#define SDL_test_fuzzer_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- Based on GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
-*/
-
-
-/**
- * \file
- * Note: The fuzzer implementation uses a static instance of random context
- * internally which makes it thread-UNsafe.
- */
-
-/**
- * Initializes the fuzzer for a test
- *
- * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
- *
- */
-void SDLTest_FuzzerInit(Uint64 execKey);
-
-
-/**
- * Returns a random Uint8
- *
- * \returns Generated integer
- */
-Uint8 SDLTest_RandomUint8(void);
-
-/**
- * Returns a random Sint8
- *
- * \returns Generated signed integer
- */
-Sint8 SDLTest_RandomSint8(void);
-
-
-/**
- * Returns a random Uint16
- *
- * \returns Generated integer
- */
-Uint16 SDLTest_RandomUint16(void);
-
-/**
- * Returns a random Sint16
- *
- * \returns Generated signed integer
- */
-Sint16 SDLTest_RandomSint16(void);
-
-
-/**
- * Returns a random integer
- *
- * \returns Generated integer
- */
-Sint32 SDLTest_RandomSint32(void);
-
-
-/**
- * Returns a random positive integer
- *
- * \returns Generated integer
- */
-Uint32 SDLTest_RandomUint32(void);
-
-/**
- * Returns random Uint64.
- *
- * \returns Generated integer
- */
-Uint64 SDLTest_RandomUint64(void);
-
-
-/**
- * Returns random Sint64.
- *
- * \returns Generated signed integer
- */
-Sint64 SDLTest_RandomSint64(void);
-
-/**
- * \returns random float in range [0.0 - 1.0[
- */
-float SDLTest_RandomUnitFloat(void);
-
-/**
- * \returns random double in range [0.0 - 1.0[
- */
-double SDLTest_RandomUnitDouble(void);
-
-/**
- * \returns random float.
- *
- */
-float SDLTest_RandomFloat(void);
-
-/**
- * \returns random double.
- *
- */
-double SDLTest_RandomDouble(void);
-
-/**
- * Returns a random boundary value for Uint8 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Uint16 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Uint32 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Uint64 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
- * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
- * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
- * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or 0 with error set
- */
-Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Sint8 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
- * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
- */
-Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
-
-
-/**
- * Returns a random boundary value for Sint16 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
- * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
- */
-Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Sint32 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100
- * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value)
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
- */
-Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
-
-/**
- * Returns a random boundary value for Sint64 within the given boundaries.
- * Boundaries are inclusive, see the usage examples below. If validDomain
- * is true, the function will only return valid boundaries, otherwise non-valid
- * boundaries are also possible.
- * If boundary1 > boundary2, the values are swapped
- *
- * Usage examples:
- * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
- * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
- * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
- * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
- *
- * \param boundary1 Lower boundary limit
- * \param boundary2 Upper boundary limit
- * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
- *
- * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
- */
-Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
-
-
-/**
- * Returns integer in range [min, max] (inclusive).
- * Min and max values can be negative values.
- * If Max in smaller than min, then the values are swapped.
- * Min and max are the same value, that value will be returned.
- *
- * \param min Minimum inclusive value of returned random number
- * \param max Maximum inclusive value of returned random number
- *
- * \returns Generated random integer in range
- */
-Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
-
-
-/**
- * Generates random null-terminated string. The minimum length for
- * the string is 1 character, maximum length for the string is 255
- * characters and it can contain ASCII characters from 32 to 126.
- *
- * Note: Returned string needs to be deallocated.
- *
- * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
- */
-char * SDLTest_RandomAsciiString(void);
-
-
-/**
- * Generates random null-terminated string. The maximum length for
- * the string is defined by the maxLength parameter.
- * String can contain ASCII characters from 32 to 126.
- *
- * Note: Returned string needs to be deallocated.
- *
- * \param maxLength The maximum length of the generated string.
- *
- * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
- */
-char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
-
-
-/**
- * Generates random null-terminated string. The length for
- * the string is defined by the size parameter.
- * String can contain ASCII characters from 32 to 126.
- *
- * Note: Returned string needs to be deallocated.
- *
- * \param size The length of the generated string
- *
- * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated.
- */
-char * SDLTest_RandomAsciiStringOfSize(int size);
-
-/**
- * Returns the invocation count for the fuzzer since last ...FuzzerInit.
- */
-int SDLTest_GetFuzzerInvocationCount(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_fuzzer_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_harness.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_harness.h
deleted file mode 100644
index 68c4bcb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_harness.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_harness.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- Defines types for test case definitions and the test execution harness API.
-
- Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
-*/
-
-#ifndef SDL_test_h_arness_h
-#define SDL_test_h_arness_h
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* ! Definitions for test case structures */
-#define TEST_ENABLED 1
-#define TEST_DISABLED 0
-
-/* ! Definition of all the possible test return values of the test case method */
-#define TEST_ABORTED -1
-#define TEST_STARTED 0
-#define TEST_COMPLETED 1
-#define TEST_SKIPPED 2
-
-/* ! Definition of all the possible test results for the harness */
-#define TEST_RESULT_PASSED 0
-#define TEST_RESULT_FAILED 1
-#define TEST_RESULT_NO_ASSERT 2
-#define TEST_RESULT_SKIPPED 3
-#define TEST_RESULT_SETUP_FAILURE 4
-
-/* !< Function pointer to a test case setup function (run before every test) */
-typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
-
-/* !< Function pointer to a test case function */
-typedef int (*SDLTest_TestCaseFp)(void *arg);
-
-/* !< Function pointer to a test case teardown function (run after every test) */
-typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
-
-/**
- * Holds information about a single test case.
- */
-typedef struct SDLTest_TestCaseReference {
- /* !< Func2Stress */
- SDLTest_TestCaseFp testCase;
- /* !< Short name (or function name) "Func2Stress" */
- char *name;
- /* !< Long name or full description "This test pushes func2() to the limit." */
- char *description;
- /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
- int enabled;
-} SDLTest_TestCaseReference;
-
-/**
- * Holds information about a test suite (multiple test cases).
- */
-typedef struct SDLTest_TestSuiteReference {
- /* !< "PlatformSuite" */
- char *name;
- /* !< The function that is run before each test. NULL skips. */
- SDLTest_TestCaseSetUpFp testSetUp;
- /* !< The test cases that are run as part of the suite. Last item should be NULL. */
- const SDLTest_TestCaseReference **testCases;
- /* !< The function that is run after each test. NULL skips. */
- SDLTest_TestCaseTearDownFp testTearDown;
-} SDLTest_TestSuiteReference;
-
-
-/**
- * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
- *
- * Note: The returned string needs to be deallocated by the caller.
- *
- * \param length The length of the seed string to generate
- *
- * \returns The generated seed string
- */
-char *SDLTest_GenerateRunSeed(const int length);
-
-/**
- * \brief Execute a test suite using the given run seed and execution key.
- *
- * \param testSuites Suites containing the test case.
- * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
- * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
- * \param filter Filter specification. NULL disables. Case sensitive.
- * \param testIterations Number of iterations to run each test case.
- *
- * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
- */
-int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_h_arness_h */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_images.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_images.h
deleted file mode 100644
index 683d2f8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_images.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_images.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- Defines some images for tests.
-
-*/
-
-#ifndef SDL_test_images_h_
-#define SDL_test_images_h_
-
-#include "SDL.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- *Type for test images.
- */
-typedef struct SDLTest_SurfaceImage_s {
- int width;
- int height;
- unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
- const char *pixel_data;
-} SDLTest_SurfaceImage_t;
-
-/* Test images */
-SDL_Surface *SDLTest_ImageBlit(void);
-SDL_Surface *SDLTest_ImageBlitColor(void);
-SDL_Surface *SDLTest_ImageBlitAlpha(void);
-SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
-SDL_Surface *SDLTest_ImageBlitBlend(void);
-SDL_Surface *SDLTest_ImageBlitBlendMod(void);
-SDL_Surface *SDLTest_ImageBlitBlendNone(void);
-SDL_Surface *SDLTest_ImageBlitBlendAll(void);
-SDL_Surface *SDLTest_ImageFace(void);
-SDL_Surface *SDLTest_ImagePrimitives(void);
-SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_images_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_log.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_log.h
deleted file mode 100644
index 9f993fb..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_log.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_log.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- *
- * Wrapper to log in the TEST category
- *
- */
-
-#ifndef SDL_test_log_h_
-#define SDL_test_log_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Prints given message with a timestamp in the TEST category and INFO priority.
- *
- * \param fmt Message to be logged
- */
-void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/**
- * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
- *
- * \param fmt Message to be logged
- */
-void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_log_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_md5.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_md5.h
deleted file mode 100644
index 67ca7d1..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_md5.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_md5.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
- ***********************************************************************
- ** Header file for implementation of MD5 **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
- ** Created: 2/17/90 RLR **
- ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
- ** Revised (for MD5): RLR 4/27/91 **
- ** -- G modified to have y&~z instead of y&z **
- ** -- FF, GG, HH modified to add in last register done **
- ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
- ** -- distinct additive constant for each step **
- ** -- round 4 added, working mod 7 **
- ***********************************************************************
-*/
-
-/*
- ***********************************************************************
- ** Message-digest routines: **
- ** To form the message digest for a message M **
- ** (1) Initialize a context buffer mdContext using MD5Init **
- ** (2) Call MD5Update on mdContext and M **
- ** (3) Call MD5Final on mdContext **
- ** The message digest is now in mdContext->digest[0...15] **
- ***********************************************************************
-*/
-
-#ifndef SDL_test_md5_h_
-#define SDL_test_md5_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ------------ Definitions --------- */
-
-/* typedef a 32-bit type */
- typedef unsigned long int MD5UINT4;
-
-/* Data structure for MD5 (Message-Digest) computation */
- typedef struct {
- MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
- MD5UINT4 buf[4]; /* scratch buffer */
- unsigned char in[64]; /* input buffer */
- unsigned char digest[16]; /* actual digest after Md5Final call */
- } SDLTest_Md5Context;
-
-/* ---------- Function Prototypes ------------- */
-
-/**
- * \brief initialize the context
- *
- * \param mdContext pointer to context variable
- *
- * Note: The function initializes the message-digest context
- * mdContext. Call before each new use of the context -
- * all fields are set to zero.
- */
- void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
-
-
-/**
- * \brief update digest from variable length data
- *
- * \param mdContext pointer to context variable
- * \param inBuf pointer to data array/string
- * \param inLen length of data array/string
- *
- * Note: The function updates the message-digest context to account
- * for the presence of each of the characters inBuf[0..inLen-1]
- * in the message whose digest is being computed.
-*/
-
- void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
- unsigned int inLen);
-
-
-/**
- * \brief complete digest computation
- *
- * \param mdContext pointer to context variable
- *
- * Note: The function terminates the message-digest computation and
- * ends with the desired message digest in mdContext.digest[0..15].
- * Always call before using the digest[] variable.
-*/
-
- void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_md5_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_memory.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_memory.h
deleted file mode 100644
index 43b67f5..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_memory.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_memory.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-#ifndef SDL_test_memory_h_
-#define SDL_test_memory_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * \brief Start tracking SDL memory allocations
- *
- * \note This should be called before any other SDL functions for complete tracking coverage
- */
-int SDLTest_TrackAllocations();
-
-/**
- * \brief Print a log of any outstanding allocations
- *
- * \note This can be called after SDL_Quit()
- */
-void SDLTest_LogAllocations();
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_memory_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_random.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_test_random.h
deleted file mode 100644
index 2b01922..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_test_random.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_test_random.h
- *
- * Include file for SDL test framework.
- *
- * This code is a part of the SDL2_test library, not the main SDL library.
- */
-
-/*
-
- A "32-bit Multiply with carry random number generator. Very fast.
- Includes a list of recommended multipliers.
-
- multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32.
- period: (a*2^31)-1
-
-*/
-
-#ifndef SDL_test_random_h_
-#define SDL_test_random_h_
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* --- Definitions */
-
-/*
- * Macros that return a random number in a specific format.
- */
-#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c))
-
-/*
- * Context structure for the random number generator state.
- */
- typedef struct {
- unsigned int a;
- unsigned int x;
- unsigned int c;
- unsigned int ah;
- unsigned int al;
- } SDLTest_RandomContext;
-
-
-/* --- Function prototypes */
-
-/**
- * \brief Initialize random number generator with two integers.
- *
- * Note: The random sequence of numbers returned by ...Random() is the
- * same for the same two integers and has a period of 2^31.
- *
- * \param rndContext pointer to context structure
- * \param xi integer that defines the random sequence
- * \param ci integer that defines the random sequence
- *
- */
- void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
- unsigned int ci);
-
-/**
- * \brief Initialize random number generator based on current system time.
- *
- * \param rndContext pointer to context structure
- *
- */
- void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
-
-
-/**
- * \brief Initialize random number generator based on current system time.
- *
- * Note: ...RandomInit() or ...RandomInitTime() must have been called
- * before using this function.
- *
- * \param rndContext pointer to context structure
- *
- * \returns A random number (32bit unsigned integer)
- *
- */
- unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_test_random_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_thread.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_thread.h
deleted file mode 100644
index d0f6575..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_thread.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_thread_h_
-#define SDL_thread_h_
-
-/**
- * \file SDL_thread.h
- *
- * Header for the SDL thread management routines.
- */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-/* Thread synchronization primitives */
-#include "SDL_atomic.h"
-#include "SDL_mutex.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The SDL thread structure, defined in SDL_thread.c */
-struct SDL_Thread;
-typedef struct SDL_Thread SDL_Thread;
-
-/* The SDL thread ID */
-typedef unsigned long SDL_threadID;
-
-/* Thread local storage ID, 0 is the invalid ID */
-typedef unsigned int SDL_TLSID;
-
-/**
- * The SDL thread priority.
- *
- * \note On many systems you require special privileges to set high priority.
- */
-typedef enum {
- SDL_THREAD_PRIORITY_LOW,
- SDL_THREAD_PRIORITY_NORMAL,
- SDL_THREAD_PRIORITY_HIGH
-} SDL_ThreadPriority;
-
-/**
- * The function passed to SDL_CreateThread().
- * It is passed a void* user context parameter and returns an int.
- */
-typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
-
-#if defined(__WIN32__) && !defined(HAVE_LIBC)
-/**
- * \file SDL_thread.h
- *
- * We compile SDL into a DLL. This means, that it's the DLL which
- * creates a new thread for the calling process with the SDL_CreateThread()
- * API. There is a problem with this, that only the RTL of the SDL2.DLL will
- * be initialized for those threads, and not the RTL of the calling
- * application!
- *
- * To solve this, we make a little hack here.
- *
- * We'll always use the caller's _beginthread() and _endthread() APIs to
- * start a new thread. This way, if it's the SDL2.DLL which uses this API,
- * then the RTL of SDL2.DLL will be used to create the new thread, and if it's
- * the application, then the RTL of the application will be used.
- *
- * So, in short:
- * Always use the _beginthread() and _endthread() of the calling runtime
- * library!
- */
-#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* _beginthreadex() and _endthreadex() */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
- (void *, unsigned, unsigned (__stdcall *func)(void *),
- void * /*arg*/, unsigned, unsigned * /* threadID */);
-typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
-
-/**
- * Create a thread.
- */
-extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
- pfnSDL_CurrentBeginThread pfnBeginThread,
- pfnSDL_CurrentEndThread pfnEndThread);
-
-/**
- * Create a thread.
- */
-#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
-#undef SDL_CreateThread
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
-#else
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
-#endif
-
-#elif defined(__OS2__)
-/*
- * just like the windows case above: We compile SDL2
- * into a dll with Watcom's runtime statically linked.
- */
-#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#ifndef __EMX__
-#include <process.h>
-#else
-#include <stdlib.h>
-#endif
-typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
-typedef void (*pfnSDL_CurrentEndThread)(void);
-extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
- pfnSDL_CurrentBeginThread pfnBeginThread,
- pfnSDL_CurrentEndThread pfnEndThread);
-#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
-#undef SDL_CreateThread
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
-#else
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
-#endif
-
-#else
-
-/**
- * Create a thread.
- *
- * Thread naming is a little complicated: Most systems have very small
- * limits for the string length (Haiku has 32 bytes, Linux currently has 16,
- * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
- * have to see what happens with your system's debugger. The name should be
- * UTF-8 (but using the naming limits of C identifiers is a better bet).
- * There are no requirements for thread naming conventions, so long as the
- * string is null-terminated UTF-8, but these guidelines are helpful in
- * choosing a name:
- *
- * http://stackoverflow.com/questions/149932/naming-conventions-for-threads
- *
- * If a system imposes requirements, SDL will try to munge the string for
- * it (truncate, etc), but the original string contents will be available
- * from SDL_GetThreadName().
- */
-extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
-
-#endif
-
-/**
- * Get the thread name, as it was specified in SDL_CreateThread().
- * This function returns a pointer to a UTF-8 string that names the
- * specified thread, or NULL if it doesn't have a name. This is internal
- * memory, not to be free()'d by the caller, and remains valid until the
- * specified thread is cleaned up by SDL_WaitThread().
- */
-extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
-
-/**
- * Get the thread identifier for the current thread.
- */
-extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
-
-/**
- * Get the thread identifier for the specified thread.
- *
- * Equivalent to SDL_ThreadID() if the specified thread is NULL.
- */
-extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
-
-/**
- * Set the priority for the current thread
- */
-extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
-
-/**
- * Wait for a thread to finish. Threads that haven't been detached will
- * remain (as a "zombie") until this function cleans them up. Not doing so
- * is a resource leak.
- *
- * Once a thread has been cleaned up through this function, the SDL_Thread
- * that references it becomes invalid and should not be referenced again.
- * As such, only one thread may call SDL_WaitThread() on another.
- *
- * The return code for the thread function is placed in the area
- * pointed to by \c status, if \c status is not NULL.
- *
- * You may not wait on a thread that has been used in a call to
- * SDL_DetachThread(). Use either that function or this one, but not
- * both, or behavior is undefined.
- *
- * It is safe to pass NULL to this function; it is a no-op.
- */
-extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
-
-/**
- * A thread may be "detached" to signify that it should not remain until
- * another thread has called SDL_WaitThread() on it. Detaching a thread
- * is useful for long-running threads that nothing needs to synchronize
- * with or further manage. When a detached thread is done, it simply
- * goes away.
- *
- * There is no way to recover the return code of a detached thread. If you
- * need this, don't detach the thread and instead use SDL_WaitThread().
- *
- * Once a thread is detached, you should usually assume the SDL_Thread isn't
- * safe to reference again, as it will become invalid immediately upon
- * the detached thread's exit, instead of remaining until someone has called
- * SDL_WaitThread() to finally clean it up. As such, don't detach the same
- * thread more than once.
- *
- * If a thread has already exited when passed to SDL_DetachThread(), it will
- * stop waiting for a call to SDL_WaitThread() and clean up immediately.
- * It is not safe to detach a thread that might be used with SDL_WaitThread().
- *
- * You may not call SDL_WaitThread() on a thread that has been detached.
- * Use either that function or this one, but not both, or behavior is
- * undefined.
- *
- * It is safe to pass NULL to this function; it is a no-op.
- */
-extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread);
-
-/**
- * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
- *
- * \return The newly created thread local storage identifier, or 0 on error
- *
- * \code
- * static SDL_SpinLock tls_lock;
- * static SDL_TLSID thread_local_storage;
- *
- * void SetMyThreadData(void *value)
- * {
- * if (!thread_local_storage) {
- * SDL_AtomicLock(&tls_lock);
- * if (!thread_local_storage) {
- * thread_local_storage = SDL_TLSCreate();
- * }
- * SDL_AtomicUnlock(&tls_lock);
- * }
- * SDL_TLSSet(thread_local_storage, value, 0);
- * }
- *
- * void *GetMyThreadData(void)
- * {
- * return SDL_TLSGet(thread_local_storage);
- * }
- * \endcode
- *
- * \sa SDL_TLSGet()
- * \sa SDL_TLSSet()
- */
-extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
-
-/**
- * \brief Get the value associated with a thread local storage ID for the current thread.
- *
- * \param id The thread local storage ID
- *
- * \return The value associated with the ID for the current thread, or NULL if no value has been set.
- *
- * \sa SDL_TLSCreate()
- * \sa SDL_TLSSet()
- */
-extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
-
-/**
- * \brief Set the value associated with a thread local storage ID for the current thread.
- *
- * \param id The thread local storage ID
- * \param value The value to associate with the ID for the current thread
- * \param destructor A function called when the thread exits, to free the value.
- *
- * \return 0 on success, -1 on error
- *
- * \sa SDL_TLSCreate()
- * \sa SDL_TLSGet()
- */
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_thread_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_timer.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_timer.h
deleted file mode 100644
index 282625d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_timer.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_timer_h_
-#define SDL_timer_h_
-
-/**
- * \file SDL_timer.h
- *
- * Header for the SDL time management routines.
- */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Get the number of milliseconds since the SDL library initialization.
- *
- * \note This value wraps if the program runs for more than ~49 days.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
-
-/**
- * \brief Compare SDL ticks values, and return true if A has passed B
- *
- * e.g. if you want to wait 100 ms, you could do this:
- * Uint32 timeout = SDL_GetTicks() + 100;
- * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
- * ... do work until timeout has elapsed
- * }
- */
-#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
-
-/**
- * \brief Get the current value of the high resolution counter
- */
-extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
-
-/**
- * \brief Get the count per second of the high resolution counter
- */
-extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
-
-/**
- * \brief Wait a specified number of milliseconds before returning.
- */
-extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
-
-/**
- * Function prototype for the timer callback function.
- *
- * The callback function is passed the current timer interval and returns
- * the next timer interval. If the returned value is the same as the one
- * passed in, the periodic alarm continues, otherwise a new alarm is
- * scheduled. If the callback returns 0, the periodic alarm is cancelled.
- */
-typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
-
-/**
- * Definition of the timer ID type.
- */
-typedef int SDL_TimerID;
-
-/**
- * \brief Add a new timer to the pool of timers already running.
- *
- * \return A timer ID, or 0 when an error occurs.
- */
-extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
- SDL_TimerCallback callback,
- void *param);
-
-/**
- * \brief Remove a timer knowing its ID.
- *
- * \return A boolean value indicating success or failure.
- *
- * \warning It is not safe to remove a timer multiple times.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_timer_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_touch.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_touch.h
deleted file mode 100644
index db9e25e..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_touch.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_touch.h
- *
- * Include file for SDL touch event handling.
- */
-
-#ifndef SDL_touch_h_
-#define SDL_touch_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef Sint64 SDL_TouchID;
-typedef Sint64 SDL_FingerID;
-
-typedef struct SDL_Finger
-{
- SDL_FingerID id;
- float x;
- float y;
- float pressure;
-} SDL_Finger;
-
-/* Used as the device ID for mouse events simulated with touch input */
-#define SDL_TOUCH_MOUSEID ((Uint32)-1)
-
-
-/* Function prototypes */
-
-/**
- * \brief Get the number of registered touch devices.
- */
-extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
-
-/**
- * \brief Get the touch ID with the given index, or 0 if the index is invalid.
- */
-extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
-
-/**
- * \brief Get the number of active fingers for a given touch device.
- */
-extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
-
-/**
- * \brief Get the finger object of the given touch, with the given index.
- */
-extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_touch_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_types.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_types.h
deleted file mode 100644
index 06ee80c..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_types.h
- *
- * \deprecated
- */
-
-/* DEPRECATED */
-#include "SDL_stdinc.h"
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_version.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_version.h
deleted file mode 100644
index 5b4c402..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_version.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_version.h
- *
- * This header defines the current SDL version.
- */
-
-#ifndef SDL_version_h_
-#define SDL_version_h_
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Information the version of SDL in use.
- *
- * Represents the library's version as three levels: major revision
- * (increments with massive changes, additions, and enhancements),
- * minor revision (increments with backwards-compatible changes to the
- * major revision), and patchlevel (increments with fixes to the minor
- * revision).
- *
- * \sa SDL_VERSION
- * \sa SDL_GetVersion
- */
-typedef struct SDL_version
-{
- Uint8 major; /**< major version */
- Uint8 minor; /**< minor version */
- Uint8 patch; /**< update version */
-} SDL_version;
-
-/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
-*/
-#define SDL_MAJOR_VERSION 2
-#define SDL_MINOR_VERSION 0
-#define SDL_PATCHLEVEL 7
-
-/**
- * \brief Macro to determine SDL version program was compiled against.
- *
- * This macro fills in a SDL_version structure with the version of the
- * library you compiled against. This is determined by what header the
- * compiler uses. Note that if you dynamically linked the library, you might
- * have a slightly newer or older version at runtime. That version can be
- * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
- * is not a macro.
- *
- * \param x A pointer to a SDL_version struct to initialize.
- *
- * \sa SDL_version
- * \sa SDL_GetVersion
- */
-#define SDL_VERSION(x) \
-{ \
- (x)->major = SDL_MAJOR_VERSION; \
- (x)->minor = SDL_MINOR_VERSION; \
- (x)->patch = SDL_PATCHLEVEL; \
-}
-
-/**
- * This macro turns the version numbers into a numeric value:
- * \verbatim
- (1,2,3) -> (1203)
- \endverbatim
- *
- * This assumes that there will never be more than 100 patchlevels.
- */
-#define SDL_VERSIONNUM(X, Y, Z) \
- ((X)*1000 + (Y)*100 + (Z))
-
-/**
- * This is the version number macro for the current SDL version.
- */
-#define SDL_COMPILEDVERSION \
- SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
-
-/**
- * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
- */
-#define SDL_VERSION_ATLEAST(X, Y, Z) \
- (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-
-/**
- * \brief Get the version of SDL that is linked against your program.
- *
- * If you are linking to SDL dynamically, then it is possible that the
- * current version will be different than the version you compiled against.
- * This function returns the current version, while SDL_VERSION() is a
- * macro that tells you what version you compiled with.
- *
- * \code
- * SDL_version compiled;
- * SDL_version linked;
- *
- * SDL_VERSION(&compiled);
- * SDL_GetVersion(&linked);
- * printf("We compiled against SDL version %d.%d.%d ...\n",
- * compiled.major, compiled.minor, compiled.patch);
- * printf("But we linked against SDL version %d.%d.%d.\n",
- * linked.major, linked.minor, linked.patch);
- * \endcode
- *
- * This function may be called safely at any time, even before SDL_Init().
- *
- * \sa SDL_VERSION
- */
-extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
-
-/**
- * \brief Get the code revision of SDL that is linked against your program.
- *
- * Returns an arbitrary string (a hash value) uniquely identifying the
- * exact revision of the SDL library in use, and is only useful in comparing
- * against other revisions. It is NOT an incrementing number.
- */
-extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
-
-/**
- * \brief Get the revision number of SDL that is linked against your program.
- *
- * Returns a number uniquely identifying the exact revision of the SDL
- * library in use. It is an incrementing number based on commits to
- * hg.libsdl.org.
- */
-extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_version_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_video.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_video.h
deleted file mode 100644
index 6f6cda8..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_video.h
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_video.h
- *
- * Header file for SDL video functions.
- */
-
-#ifndef SDL_video_h_
-#define SDL_video_h_
-
-#include "SDL_stdinc.h"
-#include "SDL_pixels.h"
-#include "SDL_rect.h"
-#include "SDL_surface.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief The structure that defines a display mode
- *
- * \sa SDL_GetNumDisplayModes()
- * \sa SDL_GetDisplayMode()
- * \sa SDL_GetDesktopDisplayMode()
- * \sa SDL_GetCurrentDisplayMode()
- * \sa SDL_GetClosestDisplayMode()
- * \sa SDL_SetWindowDisplayMode()
- * \sa SDL_GetWindowDisplayMode()
- */
-typedef struct
-{
- Uint32 format; /**< pixel format */
- int w; /**< width, in screen coordinates */
- int h; /**< height, in screen coordinates */
- int refresh_rate; /**< refresh rate (or zero for unspecified) */
- void *driverdata; /**< driver-specific data, initialize to 0 */
-} SDL_DisplayMode;
-
-/**
- * \brief The type used to identify a window
- *
- * \sa SDL_CreateWindow()
- * \sa SDL_CreateWindowFrom()
- * \sa SDL_DestroyWindow()
- * \sa SDL_GetWindowData()
- * \sa SDL_GetWindowFlags()
- * \sa SDL_GetWindowGrab()
- * \sa SDL_GetWindowPosition()
- * \sa SDL_GetWindowSize()
- * \sa SDL_GetWindowTitle()
- * \sa SDL_HideWindow()
- * \sa SDL_MaximizeWindow()
- * \sa SDL_MinimizeWindow()
- * \sa SDL_RaiseWindow()
- * \sa SDL_RestoreWindow()
- * \sa SDL_SetWindowData()
- * \sa SDL_SetWindowFullscreen()
- * \sa SDL_SetWindowGrab()
- * \sa SDL_SetWindowIcon()
- * \sa SDL_SetWindowPosition()
- * \sa SDL_SetWindowSize()
- * \sa SDL_SetWindowBordered()
- * \sa SDL_SetWindowResizable()
- * \sa SDL_SetWindowTitle()
- * \sa SDL_ShowWindow()
- */
-typedef struct SDL_Window SDL_Window;
-
-/**
- * \brief The flags on a window
- *
- * \sa SDL_GetWindowFlags()
- */
-typedef enum
-{
- /* !!! FIXME: change this to name = (1<<x). */
- SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
- SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
- SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
- SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
- SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
- SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
- SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
- SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
- SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
- SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
- SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
- SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
- SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
- SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
- SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
- SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
- SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
- SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
- SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
- SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
- SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
-} SDL_WindowFlags;
-
-/**
- * \brief Used to indicate that you don't care what the window position is.
- */
-#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
-#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
-#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
-#define SDL_WINDOWPOS_ISUNDEFINED(X) \
- (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
-
-/**
- * \brief Used to indicate that the window position should be centered.
- */
-#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
-#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
-#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
-#define SDL_WINDOWPOS_ISCENTERED(X) \
- (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
-
-/**
- * \brief Event subtype for window events
- */
-typedef enum
-{
- SDL_WINDOWEVENT_NONE, /**< Never used */
- SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
- SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
- SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
- redrawn */
- SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
- */
- SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
- SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
- a result of an API call or through the
- system or user changing the window size. */
- SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
- SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
- SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
- and position */
- SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
- SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
- SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
- SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
- SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
- SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
- SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
-} SDL_WindowEventID;
-
-/**
- * \brief An opaque handle to an OpenGL context.
- */
-typedef void *SDL_GLContext;
-
-/**
- * \brief OpenGL configuration attributes
- */
-typedef enum
-{
- SDL_GL_RED_SIZE,
- SDL_GL_GREEN_SIZE,
- SDL_GL_BLUE_SIZE,
- SDL_GL_ALPHA_SIZE,
- SDL_GL_BUFFER_SIZE,
- SDL_GL_DOUBLEBUFFER,
- SDL_GL_DEPTH_SIZE,
- SDL_GL_STENCIL_SIZE,
- SDL_GL_ACCUM_RED_SIZE,
- SDL_GL_ACCUM_GREEN_SIZE,
- SDL_GL_ACCUM_BLUE_SIZE,
- SDL_GL_ACCUM_ALPHA_SIZE,
- SDL_GL_STEREO,
- SDL_GL_MULTISAMPLEBUFFERS,
- SDL_GL_MULTISAMPLESAMPLES,
- SDL_GL_ACCELERATED_VISUAL,
- SDL_GL_RETAINED_BACKING,
- SDL_GL_CONTEXT_MAJOR_VERSION,
- SDL_GL_CONTEXT_MINOR_VERSION,
- SDL_GL_CONTEXT_EGL,
- SDL_GL_CONTEXT_FLAGS,
- SDL_GL_CONTEXT_PROFILE_MASK,
- SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
- SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
- SDL_GL_CONTEXT_RESET_NOTIFICATION,
- SDL_GL_CONTEXT_NO_ERROR
-} SDL_GLattr;
-
-typedef enum
-{
- SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
- SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
- SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
-} SDL_GLprofile;
-
-typedef enum
-{
- SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
- SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
- SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
- SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
-} SDL_GLcontextFlag;
-
-typedef enum
-{
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
-} SDL_GLcontextReleaseFlag;
-
-typedef enum
-{
- SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
- SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
-} SDL_GLContextResetNotification;
-
-/* Function prototypes */
-
-/**
- * \brief Get the number of video drivers compiled into SDL
- *
- * \sa SDL_GetVideoDriver()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
-
-/**
- * \brief Get the name of a built in video driver.
- *
- * \note The video drivers are presented in the order in which they are
- * normally checked during initialization.
- *
- * \sa SDL_GetNumVideoDrivers()
- */
-extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
-
-/**
- * \brief Initialize the video subsystem, optionally specifying a video driver.
- *
- * \param driver_name Initialize a specific driver by name, or NULL for the
- * default video driver.
- *
- * \return 0 on success, -1 on error
- *
- * This function initializes the video subsystem; setting up a connection
- * to the window manager, etc, and determines the available display modes
- * and pixel formats, but does not initialize a window or graphics mode.
- *
- * \sa SDL_VideoQuit()
- */
-extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
-
-/**
- * \brief Shuts down the video subsystem.
- *
- * This function closes all windows, and restores the original video mode.
- *
- * \sa SDL_VideoInit()
- */
-extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
-
-/**
- * \brief Returns the name of the currently initialized video driver.
- *
- * \return The name of the current video driver or NULL if no driver
- * has been initialized
- *
- * \sa SDL_GetNumVideoDrivers()
- * \sa SDL_GetVideoDriver()
- */
-extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
-
-/**
- * \brief Returns the number of available video displays.
- *
- * \sa SDL_GetDisplayBounds()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
-
-/**
- * \brief Get the name of a display in UTF-8 encoding
- *
- * \return The name of a display, or NULL for an invalid display index.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
-
-/**
- * \brief Get the desktop area represented by a display, with the primary
- * display located at 0,0
- *
- * \return 0 on success, or -1 if the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
-
-/**
- * \brief Get the dots/pixels-per-inch for a display
- *
- * \note Diagonal, horizontal and vertical DPI can all be optionally
- * returned if the parameter is non-NULL.
- *
- * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
-
-/**
- * \brief Get the usable desktop area represented by a display, with the
- * primary display located at 0,0
- *
- * This is the same area as SDL_GetDisplayBounds() reports, but with portions
- * reserved by the system removed. For example, on Mac OS X, this subtracts
- * the area occupied by the menu bar and dock.
- *
- * Setting a window to be fullscreen generally bypasses these unusable areas,
- * so these are good guidelines for the maximum space available to a
- * non-fullscreen window.
- *
- * \return 0 on success, or -1 if the index is out of range.
- *
- * \sa SDL_GetDisplayBounds()
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
-
-/**
- * \brief Returns the number of available display modes.
- *
- * \sa SDL_GetDisplayMode()
- */
-extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
-
-/**
- * \brief Fill in information about a specific display mode.
- *
- * \note The display modes are sorted in this priority:
- * \li bits per pixel -> more colors to fewer colors
- * \li width -> largest to smallest
- * \li height -> largest to smallest
- * \li refresh rate -> highest to lowest
- *
- * \sa SDL_GetNumDisplayModes()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
- SDL_DisplayMode * mode);
-
-/**
- * \brief Fill in information about the desktop display mode.
- */
-extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
-
-/**
- * \brief Fill in information about the current display mode.
- */
-extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
-
-
-/**
- * \brief Get the closest match to the requested display mode.
- *
- * \param displayIndex The index of display from which mode should be queried.
- * \param mode The desired display mode
- * \param closest A pointer to a display mode to be filled in with the closest
- * match of the available display modes.
- *
- * \return The passed in value \c closest, or NULL if no matching video mode
- * was available.
- *
- * The available display modes are scanned, and \c closest is filled in with the
- * closest mode matching the requested mode and returned. The mode format and
- * refresh_rate default to the desktop mode if they are 0. The modes are
- * scanned with size being first priority, format being second priority, and
- * finally checking the refresh_rate. If all the available modes are too
- * small, then NULL is returned.
- *
- * \sa SDL_GetNumDisplayModes()
- * \sa SDL_GetDisplayMode()
- */
-extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
-
-/**
- * \brief Get the display index associated with a window.
- *
- * \return the display index of the display containing the center of the
- * window, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
-
-/**
- * \brief Set the display mode used when a fullscreen window is visible.
- *
- * By default the window's dimensions and the desktop format and refresh rate
- * are used.
- *
- * \param window The window for which the display mode should be set.
- * \param mode The mode to use, or NULL for the default mode.
- *
- * \return 0 on success, or -1 if setting the display mode failed.
- *
- * \sa SDL_GetWindowDisplayMode()
- * \sa SDL_SetWindowFullscreen()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
- const SDL_DisplayMode
- * mode);
-
-/**
- * \brief Fill in information about the display mode used when a fullscreen
- * window is visible.
- *
- * \sa SDL_SetWindowDisplayMode()
- * \sa SDL_SetWindowFullscreen()
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
- SDL_DisplayMode * mode);
-
-/**
- * \brief Get the pixel format associated with the window.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
-
-/**
- * \brief Create a window with the specified position, dimensions, and flags.
- *
- * \param title The title of the window, in UTF-8 encoding.
- * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
- * ::SDL_WINDOWPOS_UNDEFINED.
- * \param w The width of the window, in screen coordinates.
- * \param h The height of the window, in screen coordinates.
- * \param flags The flags for the window, a mask of any of the following:
- * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
- * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
- * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
- * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
- *
- * \return The created window, or NULL if window creation failed.
- *
- * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
- * in pixels may differ from its size in screen coordinates on platforms with
- * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
- * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
- * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
- * drawable size in pixels.
- *
- * If the window is created with any of the SDL_WINDOW_OPENGL or
- * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
- * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
- * corrensponding UnloadLibrary function is called by SDL_DestroyWindow().
- *
- * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
- * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
- *
- * \note On non-Apple devices, SDL requires you to either not link to the
- * Vulkan loader or link to a dynamic library version. This limitation
- * may be removed in a future version of SDL.
- *
- * \sa SDL_DestroyWindow()
- * \sa SDL_GL_LoadLibrary()
- * \sa SDL_Vulkan_LoadLibrary()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
- int x, int y, int w,
- int h, Uint32 flags);
-
-/**
- * \brief Create an SDL window from an existing native window.
- *
- * \param data A pointer to driver-dependent window creation data
- *
- * \return The created window, or NULL if window creation failed.
- *
- * \sa SDL_DestroyWindow()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
-
-/**
- * \brief Get the numeric ID of a window, for logging purposes.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
-
-/**
- * \brief Get a window from a stored ID, or NULL if it doesn't exist.
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
-
-/**
- * \brief Get the window flags.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
-
-/**
- * \brief Set the title of a window, in UTF-8 format.
- *
- * \sa SDL_GetWindowTitle()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
- const char *title);
-
-/**
- * \brief Get the title of a window, in UTF-8 format.
- *
- * \sa SDL_SetWindowTitle()
- */
-extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
-
-/**
- * \brief Set the icon for a window.
- *
- * \param window The window for which the icon should be set.
- * \param icon The icon for the window.
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
- SDL_Surface * icon);
-
-/**
- * \brief Associate an arbitrary named pointer with a window.
- *
- * \param window The window to associate with the pointer.
- * \param name The name of the pointer.
- * \param userdata The associated pointer.
- *
- * \return The previous value associated with 'name'
- *
- * \note The name is case-sensitive.
- *
- * \sa SDL_GetWindowData()
- */
-extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
- const char *name,
- void *userdata);
-
-/**
- * \brief Retrieve the data pointer associated with a window.
- *
- * \param window The window to query.
- * \param name The name of the pointer.
- *
- * \return The value associated with 'name'
- *
- * \sa SDL_SetWindowData()
- */
-extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
- const char *name);
-
-/**
- * \brief Set the position of a window.
- *
- * \param window The window to reposition.
- * \param x The x coordinate of the window in screen coordinates, or
- * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
- * \param y The y coordinate of the window in screen coordinates, or
- * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
- *
- * \note The window coordinate origin is the upper left of the display.
- *
- * \sa SDL_GetWindowPosition()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
- int x, int y);
-
-/**
- * \brief Get the position of a window.
- *
- * \param window The window to query.
- * \param x Pointer to variable for storing the x position, in screen
- * coordinates. May be NULL.
- * \param y Pointer to variable for storing the y position, in screen
- * coordinates. May be NULL.
- *
- * \sa SDL_SetWindowPosition()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
- int *x, int *y);
-
-/**
- * \brief Set the size of a window's client area.
- *
- * \param window The window to resize.
- * \param w The width of the window, in screen coordinates. Must be >0.
- * \param h The height of the window, in screen coordinates. Must be >0.
- *
- * \note Fullscreen windows automatically match the size of the display mode,
- * and you should use SDL_SetWindowDisplayMode() to change their size.
- *
- * The window size in screen coordinates may differ from the size in pixels, if
- * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
- * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
- * SDL_GetRendererOutputSize() to get the real client area size in pixels.
- *
- * \sa SDL_GetWindowSize()
- * \sa SDL_SetWindowDisplayMode()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
- int h);
-
-/**
- * \brief Get the size of a window's client area.
- *
- * \param window The window to query.
- * \param w Pointer to variable for storing the width, in screen
- * coordinates. May be NULL.
- * \param h Pointer to variable for storing the height, in screen
- * coordinates. May be NULL.
- *
- * The window size in screen coordinates may differ from the size in pixels, if
- * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
- * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
- * SDL_GetRendererOutputSize() to get the real client area size in pixels.
- *
- * \sa SDL_SetWindowSize()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
- int *h);
-
-/**
- * \brief Get the size of a window's borders (decorations) around the client area.
- *
- * \param window The window to query.
- * \param top Pointer to variable for storing the size of the top border. NULL is permitted.
- * \param left Pointer to variable for storing the size of the left border. NULL is permitted.
- * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted.
- * \param right Pointer to variable for storing the size of the right border. NULL is permitted.
- *
- * \return 0 on success, or -1 if getting this information is not supported.
- *
- * \note if this function fails (returns -1), the size values will be
- * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as
- * if the window in question was borderless.
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
- int *top, int *left,
- int *bottom, int *right);
-
-/**
- * \brief Set the minimum size of a window's client area.
- *
- * \param window The window to set a new minimum size.
- * \param min_w The minimum width of the window, must be >0
- * \param min_h The minimum height of the window, must be >0
- *
- * \note You can't change the minimum size of a fullscreen window, it
- * automatically matches the size of the display mode.
- *
- * \sa SDL_GetWindowMinimumSize()
- * \sa SDL_SetWindowMaximumSize()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
- int min_w, int min_h);
-
-/**
- * \brief Get the minimum size of a window's client area.
- *
- * \param window The window to query.
- * \param w Pointer to variable for storing the minimum width, may be NULL
- * \param h Pointer to variable for storing the minimum height, may be NULL
- *
- * \sa SDL_GetWindowMaximumSize()
- * \sa SDL_SetWindowMinimumSize()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
- int *w, int *h);
-
-/**
- * \brief Set the maximum size of a window's client area.
- *
- * \param window The window to set a new maximum size.
- * \param max_w The maximum width of the window, must be >0
- * \param max_h The maximum height of the window, must be >0
- *
- * \note You can't change the maximum size of a fullscreen window, it
- * automatically matches the size of the display mode.
- *
- * \sa SDL_GetWindowMaximumSize()
- * \sa SDL_SetWindowMinimumSize()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
- int max_w, int max_h);
-
-/**
- * \brief Get the maximum size of a window's client area.
- *
- * \param window The window to query.
- * \param w Pointer to variable for storing the maximum width, may be NULL
- * \param h Pointer to variable for storing the maximum height, may be NULL
- *
- * \sa SDL_GetWindowMinimumSize()
- * \sa SDL_SetWindowMaximumSize()
- */
-extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
- int *w, int *h);
-
-/**
- * \brief Set the border state of a window.
- *
- * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
- * add or remove the border from the actual window. This is a no-op if the
- * window's border already matches the requested state.
- *
- * \param window The window of which to change the border state.
- * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
- *
- * \note You can't change the border state of a fullscreen window.
- *
- * \sa SDL_GetWindowFlags()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
- SDL_bool bordered);
-
-/**
- * \brief Set the user-resizable state of a window.
- *
- * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and
- * allow/disallow user resizing of the window. This is a no-op if the
- * window's resizable state already matches the requested state.
- *
- * \param window The window of which to change the resizable state.
- * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.
- *
- * \note You can't change the resizable state of a fullscreen window.
- *
- * \sa SDL_GetWindowFlags()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
- SDL_bool resizable);
-
-/**
- * \brief Show a window.
- *
- * \sa SDL_HideWindow()
- */
-extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
-
-/**
- * \brief Hide a window.
- *
- * \sa SDL_ShowWindow()
- */
-extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
-
-/**
- * \brief Raise a window above other windows and set the input focus.
- */
-extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
-
-/**
- * \brief Make a window as large as possible.
- *
- * \sa SDL_RestoreWindow()
- */
-extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
-
-/**
- * \brief Minimize a window to an iconic representation.
- *
- * \sa SDL_RestoreWindow()
- */
-extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
-
-/**
- * \brief Restore the size and position of a minimized or maximized window.
- *
- * \sa SDL_MaximizeWindow()
- * \sa SDL_MinimizeWindow()
- */
-extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
-
-/**
- * \brief Set a window's fullscreen state.
- *
- * \return 0 on success, or -1 if setting the display mode failed.
- *
- * \sa SDL_SetWindowDisplayMode()
- * \sa SDL_GetWindowDisplayMode()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
- Uint32 flags);
-
-/**
- * \brief Get the SDL surface associated with the window.
- *
- * \return The window's framebuffer surface, or NULL on error.
- *
- * A new surface will be created with the optimal format for the window,
- * if necessary. This surface will be freed when the window is destroyed.
- *
- * \note You may not combine this with 3D or the rendering API on this window.
- *
- * \sa SDL_UpdateWindowSurface()
- * \sa SDL_UpdateWindowSurfaceRects()
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
-
-/**
- * \brief Copy the window surface to the screen.
- *
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_GetWindowSurface()
- * \sa SDL_UpdateWindowSurfaceRects()
- */
-extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
-
-/**
- * \brief Copy a number of rectangles on the window surface to the screen.
- *
- * \return 0 on success, or -1 on error.
- *
- * \sa SDL_GetWindowSurface()
- * \sa SDL_UpdateWindowSurface()
- */
-extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
- const SDL_Rect * rects,
- int numrects);
-
-/**
- * \brief Set a window's input grab mode.
- *
- * \param window The window for which the input grab mode should be set.
- * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
- *
- * If the caller enables a grab while another window is currently grabbed,
- * the other window loses its grab in favor of the caller's window.
- *
- * \sa SDL_GetWindowGrab()
- */
-extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
- SDL_bool grabbed);
-
-/**
- * \brief Get a window's input grab mode.
- *
- * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
- *
- * \sa SDL_SetWindowGrab()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
-
-/**
- * \brief Get the window that currently has an input grab enabled.
- *
- * \return This returns the window if input is grabbed, and NULL otherwise.
- *
- * \sa SDL_SetWindowGrab()
- */
-extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
-
-/**
- * \brief Set the brightness (gamma correction) for a window.
- *
- * \return 0 on success, or -1 if setting the brightness isn't supported.
- *
- * \sa SDL_GetWindowBrightness()
- * \sa SDL_SetWindowGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
-
-/**
- * \brief Get the brightness (gamma correction) for a window.
- *
- * \return The last brightness value passed to SDL_SetWindowBrightness()
- *
- * \sa SDL_SetWindowBrightness()
- */
-extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
-
-/**
- * \brief Set the opacity for a window
- *
- * \param window The window which will be made transparent or opaque
- * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
- * clamped internally between 0.0f and 1.0f.
- *
- * \return 0 on success, or -1 if setting the opacity isn't supported.
- *
- * \sa SDL_GetWindowOpacity()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
-
-/**
- * \brief Get the opacity of a window.
- *
- * If transparency isn't supported on this platform, opacity will be reported
- * as 1.0f without error.
- *
- * \param window The window in question.
- * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)
- *
- * \return 0 on success, or -1 on error (invalid window, etc).
- *
- * \sa SDL_SetWindowOpacity()
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
-
-/**
- * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
- *
- * \param modal_window The window that should be modal
- * \param parent_window The parent window
- *
- * \return 0 on success, or -1 otherwise.
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
-
-/**
- * \brief Explicitly sets input focus to the window.
- *
- * You almost certainly want SDL_RaiseWindow() instead of this function. Use
- * this with caution, as you might give focus to a window that's completely
- * obscured by other windows.
- *
- * \param window The window that should get the input focus
- *
- * \return 0 on success, or -1 otherwise.
- * \sa SDL_RaiseWindow()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
-
-/**
- * \brief Set the gamma ramp for a window.
- *
- * \param window The window for which the gamma ramp should be set.
- * \param red The translation table for the red channel, or NULL.
- * \param green The translation table for the green channel, or NULL.
- * \param blue The translation table for the blue channel, or NULL.
- *
- * \return 0 on success, or -1 if gamma ramps are unsupported.
- *
- * Set the gamma translation table for the red, green, and blue channels
- * of the video hardware. Each table is an array of 256 16-bit quantities,
- * representing a mapping between the input and output for that channel.
- * The input is the index into the array, and the output is the 16-bit
- * gamma value at that index, scaled to the output color precision.
- *
- * \sa SDL_GetWindowGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
- const Uint16 * red,
- const Uint16 * green,
- const Uint16 * blue);
-
-/**
- * \brief Get the gamma ramp for a window.
- *
- * \param window The window from which the gamma ramp should be queried.
- * \param red A pointer to a 256 element array of 16-bit quantities to hold
- * the translation table for the red channel, or NULL.
- * \param green A pointer to a 256 element array of 16-bit quantities to hold
- * the translation table for the green channel, or NULL.
- * \param blue A pointer to a 256 element array of 16-bit quantities to hold
- * the translation table for the blue channel, or NULL.
- *
- * \return 0 on success, or -1 if gamma ramps are unsupported.
- *
- * \sa SDL_SetWindowGammaRamp()
- */
-extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
- Uint16 * red,
- Uint16 * green,
- Uint16 * blue);
-
-/**
- * \brief Possible return values from the SDL_HitTest callback.
- *
- * \sa SDL_HitTest
- */
-typedef enum
-{
- SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
- SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
- SDL_HITTEST_RESIZE_TOPLEFT,
- SDL_HITTEST_RESIZE_TOP,
- SDL_HITTEST_RESIZE_TOPRIGHT,
- SDL_HITTEST_RESIZE_RIGHT,
- SDL_HITTEST_RESIZE_BOTTOMRIGHT,
- SDL_HITTEST_RESIZE_BOTTOM,
- SDL_HITTEST_RESIZE_BOTTOMLEFT,
- SDL_HITTEST_RESIZE_LEFT
-} SDL_HitTestResult;
-
-/**
- * \brief Callback used for hit-testing.
- *
- * \sa SDL_SetWindowHitTest
- */
-typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
- const SDL_Point *area,
- void *data);
-
-/**
- * \brief Provide a callback that decides if a window region has special properties.
- *
- * Normally windows are dragged and resized by decorations provided by the
- * system window manager (a title bar, borders, etc), but for some apps, it
- * makes sense to drag them from somewhere else inside the window itself; for
- * example, one might have a borderless window that wants to be draggable
- * from any part, or simulate its own title bar, etc.
- *
- * This function lets the app provide a callback that designates pieces of
- * a given window as special. This callback is run during event processing
- * if we need to tell the OS to treat a region of the window specially; the
- * use of this callback is known as "hit testing."
- *
- * Mouse input may not be delivered to your application if it is within
- * a special area; the OS will often apply that input to moving the window or
- * resizing the window and not deliver it to the application.
- *
- * Specifying NULL for a callback disables hit-testing. Hit-testing is
- * disabled by default.
- *
- * Platforms that don't support this functionality will return -1
- * unconditionally, even if you're attempting to disable hit-testing.
- *
- * Your callback may fire at any time, and its firing does not indicate any
- * specific behavior (for example, on Windows, this certainly might fire
- * when the OS is deciding whether to drag your window, but it fires for lots
- * of other reasons, too, some unrelated to anything you probably care about
- * _and when the mouse isn't actually at the location it is testing_).
- * Since this can fire at any time, you should try to keep your callback
- * efficient, devoid of allocations, etc.
- *
- * \param window The window to set hit-testing on.
- * \param callback The callback to call when doing a hit-test.
- * \param callback_data An app-defined void pointer passed to the callback.
- * \return 0 on success, -1 on error (including unsupported).
- */
-extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
- SDL_HitTest callback,
- void *callback_data);
-
-/**
- * \brief Destroy a window.
- */
-extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
-
-
-/**
- * \brief Returns whether the screensaver is currently enabled (default off).
- *
- * \sa SDL_EnableScreenSaver()
- * \sa SDL_DisableScreenSaver()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
-
-/**
- * \brief Allow the screen to be blanked by a screensaver
- *
- * \sa SDL_IsScreenSaverEnabled()
- * \sa SDL_DisableScreenSaver()
- */
-extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
-
-/**
- * \brief Prevent the screen from being blanked by a screensaver
- *
- * \sa SDL_IsScreenSaverEnabled()
- * \sa SDL_EnableScreenSaver()
- */
-extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
-
-
-/**
- * \name OpenGL support functions
- */
-/* @{ */
-
-/**
- * \brief Dynamically load an OpenGL library.
- *
- * \param path The platform dependent OpenGL library name, or NULL to open the
- * default OpenGL library.
- *
- * \return 0 on success, or -1 if the library couldn't be loaded.
- *
- * This should be done after initializing the video driver, but before
- * creating any OpenGL windows. If no OpenGL library is loaded, the default
- * library will be loaded upon creation of the first OpenGL window.
- *
- * \note If you do this, you need to retrieve all of the GL functions used in
- * your program from the dynamic library using SDL_GL_GetProcAddress().
- *
- * \sa SDL_GL_GetProcAddress()
- * \sa SDL_GL_UnloadLibrary()
- */
-extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
-
-/**
- * \brief Get the address of an OpenGL function.
- */
-extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
-
-/**
- * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
- *
- * \sa SDL_GL_LoadLibrary()
- */
-extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
-
-/**
- * \brief Return true if an OpenGL extension is supported for the current
- * context.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
- *extension);
-
-/**
- * \brief Reset all previously set OpenGL context attributes to their default values
- */
-extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
-
-/**
- * \brief Set an OpenGL window attribute before window creation.
- *
- * \return 0 on success, or -1 if the attribute could not be set.
- */
-extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
-
-/**
- * \brief Get the actual value for an attribute from the current context.
- *
- * \return 0 on success, or -1 if the attribute could not be retrieved.
- * The integer at \c value will be modified in either case.
- */
-extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
-
-/**
- * \brief Create an OpenGL context for use with an OpenGL window, and make it
- * current.
- *
- * \sa SDL_GL_DeleteContext()
- */
-extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
- window);
-
-/**
- * \brief Set up an OpenGL context for rendering into an OpenGL window.
- *
- * \note The context must have been created with a compatible window.
- */
-extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
- SDL_GLContext context);
-
-/**
- * \brief Get the currently active OpenGL window.
- */
-extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
-
-/**
- * \brief Get the currently active OpenGL context.
- */
-extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
-
-/**
- * \brief Get the size of a window's underlying drawable in pixels (for use
- * with glViewport).
- *
- * \param window Window from which the drawable size should be queried
- * \param w Pointer to variable for storing the width in pixels, may be NULL
- * \param h Pointer to variable for storing the height in pixels, may be NULL
- *
- * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
- * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
- * platform with high-DPI support (Apple calls this "Retina"), and not disabled
- * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
- *
- * \sa SDL_GetWindowSize()
- * \sa SDL_CreateWindow()
- */
-extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
- int *h);
-
-/**
- * \brief Set the swap interval for the current OpenGL context.
- *
- * \param interval 0 for immediate updates, 1 for updates synchronized with the
- * vertical retrace. If the system supports it, you may
- * specify -1 to allow late swaps to happen immediately
- * instead of waiting for the next retrace.
- *
- * \return 0 on success, or -1 if setting the swap interval is not supported.
- *
- * \sa SDL_GL_GetSwapInterval()
- */
-extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
-
-/**
- * \brief Get the swap interval for the current OpenGL context.
- *
- * \return 0 if there is no vertical retrace synchronization, 1 if the buffer
- * swap is synchronized with the vertical retrace, and -1 if late
- * swaps happen immediately instead of waiting for the next retrace.
- * If the system can't determine the swap interval, or there isn't a
- * valid current context, this will return 0 as a safe default.
- *
- * \sa SDL_GL_SetSwapInterval()
- */
-extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
-
-/**
- * \brief Swap the OpenGL buffers for a window, if double-buffering is
- * supported.
- */
-extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
-
-/**
- * \brief Delete an OpenGL context.
- *
- * \sa SDL_GL_CreateContext()
- */
-extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
-
-/* @} *//* OpenGL support functions */
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_video_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_vulkan.h b/build/vc++/libs/SDL2-2.0.5/include/SDL_vulkan.h
deleted file mode 100644
index 803b5fe..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_vulkan.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 2017, Mark Callow
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file SDL_vulkan.h
- *
- * Header file for functions to creating Vulkan surfaces on SDL windows.
- */
-
-#ifndef SDL_vulkan_h_
-#define SDL_vulkan_h_
-
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Avoid including vulkan.h, don't define VkInstance if it's already included */
-#ifdef VULKAN_H_
-#define NO_SDL_VULKAN_TYPEDEFS
-#endif
-#ifndef NO_SDL_VULKAN_TYPEDEFS
-#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
-
-#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
-#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
-#else
-#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
-#endif
-
-VK_DEFINE_HANDLE(VkInstance)
-VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
-
-#endif /* !NO_SDL_VULKAN_TYPEDEFS */
-
-typedef VkInstance SDL_vulkanInstance;
-typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
-
-/**
- * \name Vulkan support functions
- *
- * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
- * is compatable with Tizen's implementation of Vulkan in SDL.
- */
-/* @{ */
-
-/**
- * \brief Dynamically load a Vulkan loader library.
- *
- * \param [in] path The platform dependent Vulkan loader library name, or
- * \c NULL to open the default Vulkan loader library.
- *
- * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
- *
- * This should be done after initializing the video driver, but before
- * creating any Vulkan windows. If no Vulkan loader library is loaded, the
- * default library will be loaded upon creation of the first Vulkan window.
- *
- * \note If you specify a non-NULL \a path, you should retrieve all of the
- * Vulkan functions used in your program from the dynamic library using
- * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
- * \a path points to the same vulkan loader library that you linked to.
- *
- * \note On Apple devices, if \a path is NULL, SDL will attempt to find
- * the vkGetInstanceProcAddr address within all the mach-o images of
- * the current process. This is because the currently (v0.17.0)
- * recommended MoltenVK (Vulkan on Metal) usage is as a static library.
- * If it is not found then SDL will attempt to load \c libMoltenVK.dylib.
- * Applications using the dylib alternative therefore do not need to do
- * anything special when calling SDL.
- *
- * \note On non-Apple devices, SDL requires you to either not link to the
- * Vulkan loader or link to a dynamic library version. This limitation
- * may be removed in a future version of SDL.
- *
- * \note This function will fail if there are no working Vulkan drivers
- * installed.
- *
- * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
- * \sa SDL_Vulkan_UnloadLibrary()
- */
-extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
-
-/**
- * \brief Get the address of the \c vkGetInstanceProcAddr function.
- *
- * \note This should be called after either calling SDL_Vulkan_LoadLibrary
- * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
- */
-extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
-
-/**
- * \brief Unload the Vulkan loader library previously loaded by
- * \c SDL_Vulkan_LoadLibrary().
- *
- * \sa SDL_Vulkan_LoadLibrary()
- */
-extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
-
-/**
- * \brief Get the names of the Vulkan instance extensions needed to create
- * a surface with \c SDL_Vulkan_CreateSurface().
- *
- * \param [in] window Window for which the required Vulkan instance
- * extensions should be retrieved
- * \param [in,out] count pointer to an \c unsigned related to the number of
- * required Vulkan instance extensions
- * \param [out] names \c NULL or a pointer to an array to be filled with the
- * required Vulkan instance extensions
- *
- * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
- *
- * If \a pNames is \c NULL, then the number of required Vulkan instance
- * extensions is returned in pCount. Otherwise, \a pCount must point to a
- * variable set to the number of elements in the \a pNames array, and on
- * return the variable is overwritten with the number of names actually
- * written to \a pNames. If \a pCount is less than the number of required
- * extensions, at most \a pCount structures will be written. If \a pCount
- * is smaller than the number of required extensions, \c SDL_FALSE will be
- * returned instead of \c SDL_TRUE, to indicate that not all the required
- * extensions were returned.
- *
- * \note The returned list of extensions will contain \c VK_KHR_surface
- * and zero or more platform specific extensions
- *
- * \note The extension names queried here must be enabled when calling
- * VkCreateInstance, otherwise surface creation will fail.
- *
- * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag.
- *
- * \code
- * unsigned int count;
- * // get count of required extensions
- * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL))
- * handle_error();
- *
- * static const char *const additionalExtensions[] =
- * {
- * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
- * };
- * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
- * size_t extensionCount = count + additionalExtensionsCount;
- * const char **names = malloc(sizeof(const char *) * extensionCount);
- * if(!names)
- * handle_error();
- *
- * // get names of required extensions
- * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names))
- * handle_error();
- *
- * // copy additional extensions after required extensions
- * for(size_t i = 0; i < additionalExtensionsCount; i++)
- * names[i + count] = additionalExtensions[i];
- *
- * VkInstanceCreateInfo instanceCreateInfo = {};
- * instanceCreateInfo.enabledExtensionCount = extensionCount;
- * instanceCreateInfo.ppEnabledExtensionNames = names;
- * // fill in rest of instanceCreateInfo
- *
- * VkInstance instance;
- * // create the Vulkan instance
- * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
- * free(names);
- * \endcode
- *
- * \sa SDL_Vulkan_CreateSurface()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
- SDL_Window *window,
- unsigned int *pCount,
- const char **pNames);
-
-/**
- * \brief Create a Vulkan rendering surface for a window.
- *
- * \param [in] window SDL_Window to which to attach the rendering surface.
- * \param [in] instance handle to the Vulkan instance to use.
- * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
- * handle of the newly created surface.
- *
- * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
- *
- * \code
- * VkInstance instance;
- * SDL_Window *window;
- *
- * // create instance and window
- *
- * // create the Vulkan surface
- * VkSurfaceKHR surface;
- * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
- * handle_error();
- * \endcode
- *
- * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
- *
- * \note \a instance should have been created with the extensions returned
- * by \c SDL_Vulkan_CreateSurface() enabled.
- *
- * \sa SDL_Vulkan_GetInstanceExtensions()
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
- SDL_Window *window,
- VkInstance instance,
- VkSurfaceKHR* surface);
-
-/**
- * \brief Get the size of a window's underlying drawable in pixels (for use
- * with setting viewport, scissor & etc).
- *
- * \param window SDL_Window from which the drawable size should be queried
- * \param w Pointer to variable for storing the width in pixels,
- * may be NULL
- * \param h Pointer to variable for storing the height in pixels,
- * may be NULL
- *
- * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
- * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
- * platform with high-DPI support (Apple calls this "Retina"), and not disabled
- * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
- *
- * \sa SDL_GetWindowSize()
- * \sa SDL_CreateWindow()
- */
-extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
- int *w, int *h);
-
-/* @} *//* Vulkan support functions */
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* SDL_vulkan_h_ */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/begin_code.h b/build/vc++/libs/SDL2-2.0.5/include/begin_code.h
deleted file mode 100644
index 5372d6f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/begin_code.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file begin_code.h
- *
- * This file sets things up for C dynamic library function definitions,
- * static inlined functions, and structures aligned at 4-byte alignment.
- * If you don't like ugly C preprocessor code, don't look at this file. :)
- */
-
-/* This shouldn't be nested -- included it around code only. */
-#ifdef _begin_code_h
-#error Nested inclusion of begin_code.h
-#endif
-#define _begin_code_h
-
-#ifndef SDL_DEPRECATED
-# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
-# define SDL_DEPRECATED __attribute__((deprecated))
-# else
-# define SDL_DEPRECATED
-# endif
-#endif
-
-#ifndef SDL_UNUSED
-# ifdef __GNUC__
-# define SDL_UNUSED __attribute__((unused))
-# else
-# define SDL_UNUSED
-# endif
-#endif
-
-/* Some compilers use a special export keyword */
-#ifndef DECLSPEC
-# if defined(__WIN32__) || defined(__WINRT__)
-# ifdef __BORLANDC__
-# ifdef BUILD_SDL
-# define DECLSPEC
-# else
-# define DECLSPEC __declspec(dllimport)
-# endif
-# else
-# define DECLSPEC __declspec(dllexport)
-# endif
-# elif defined(__OS2__)
-# ifdef BUILD_SDL
-# define DECLSPEC __declspec(dllexport)
-# else
-# define DECLSPEC
-# endif
-# else
-# if defined(__GNUC__) && __GNUC__ >= 4
-# define DECLSPEC __attribute__ ((visibility("default")))
-# else
-# define DECLSPEC
-# endif
-# endif
-#endif
-
-/* By default SDL uses the C calling convention */
-#ifndef SDLCALL
-#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
-#define SDLCALL __cdecl
-#elif defined(__OS2__) || defined(__EMX__)
-#define SDLCALL _System
-# if defined (__GNUC__) && !defined(_System)
-# define _System /* for old EMX/GCC compat. */
-# endif
-#else
-#define SDLCALL
-#endif
-#endif /* SDLCALL */
-
-/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
-#ifdef __SYMBIAN32__
-#undef DECLSPEC
-#define DECLSPEC
-#endif /* __SYMBIAN32__ */
-
-/* Force structure packing at 4 byte alignment.
- This is necessary if the header is included in code which has structure
- packing set to an alternate value, say for loading structures from disk.
- The packing is reset to the previous value in close_code.h
- */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
-#ifdef _MSC_VER
-#pragma warning(disable: 4103)
-#endif
-#ifdef __BORLANDC__
-#pragma nopackwarning
-#endif
-#ifdef _M_X64
-/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
-#pragma pack(push,8)
-#else
-#pragma pack(push,4)
-#endif
-#endif /* Compiler needs structure packing set */
-
-#ifndef SDL_INLINE
-#if defined(__GNUC__)
-#define SDL_INLINE __inline__
-#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
- defined(__DMC__) || defined(__SC__) || \
- defined(__WATCOMC__) || defined(__LCC__) || \
- defined(__DECC) || defined(__CC_ARM)
-#define SDL_INLINE __inline
-#ifndef __inline__
-#define __inline__ __inline
-#endif
-#else
-#define SDL_INLINE inline
-#ifndef __inline__
-#define __inline__ inline
-#endif
-#endif
-#endif /* SDL_INLINE not defined */
-
-#ifndef SDL_FORCE_INLINE
-#if defined(_MSC_VER)
-#define SDL_FORCE_INLINE __forceinline
-#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
-#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
-#else
-#define SDL_FORCE_INLINE static SDL_INLINE
-#endif
-#endif /* SDL_FORCE_INLINE not defined */
-
-#ifndef SDL_NORETURN
-#if defined(__GNUC__)
-#define SDL_NORETURN __attribute__((noreturn))
-#elif defined(_MSC_VER)
-#define SDL_NORETURN __declspec(noreturn)
-#else
-#define SDL_NORETURN
-#endif
-#endif /* SDL_NORETURN not defined */
-
-/* Apparently this is needed by several Windows compilers */
-#if !defined(__MACH__)
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif /* NULL */
-#endif /* ! Mac OS X - breaks precompiled headers */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/close_code.h b/build/vc++/libs/SDL2-2.0.5/include/close_code.h
deleted file mode 100644
index 2a352db..0000000
--- a/build/vc++/libs/SDL2-2.0.5/include/close_code.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-/**
- * \file close_code.h
- *
- * This file reverses the effects of begin_code.h and should be included
- * after you finish any function and structure declarations in your headers
- */
-
-#undef _begin_code_h
-
-/* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
-#ifdef __BORLANDC__
-#pragma nopackwarning
-#endif
-#pragma pack(pop)
-#endif /* Compiler needs structure packing set */
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.dll b/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.dll
deleted file mode 100644
index 6776cdd..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.dll
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.lib b/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.lib
deleted file mode 100644
index 42e5ee7..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2.lib
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2main.lib b/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2main.lib
deleted file mode 100644
index 1f409a2..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2main.lib
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2test.lib b/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2test.lib
deleted file mode 100644
index b54347d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x64/SDL2test.lib
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.dll b/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.dll
deleted file mode 100644
index c21f747..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.dll
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.lib b/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.lib
deleted file mode 100644
index a36fab5..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2.lib
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2main.lib b/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2main.lib
deleted file mode 100644
index 2080d5d..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2main.lib
+++ /dev/null
Binary files differ
diff --git a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2test.lib b/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2test.lib
deleted file mode 100644
index c26c50f..0000000
--- a/build/vc++/libs/SDL2-2.0.5/lib/x86/SDL2test.lib
+++ /dev/null
Binary files differ
diff --git a/examples/particle_system/main.cpp b/examples/particle_system/main.cpp
new file mode 100644
index 0000000..f37027b
--- /dev/null
+++ b/examples/particle_system/main.cpp
@@ -0,0 +1,103 @@
+#include <iostream>
+
+#include "libjin/jin.h"
+
+using namespace std;
+using namespace JinEngine::AI;
+using namespace JinEngine::Game;
+using namespace JinEngine::Input;
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Particles;
+using namespace JinEngine::Filesystem;
+using namespace JinEngine::Time;
+
+ParticleSystem* p;
+StateMachine sm;
+Timer timer;
+Timer::Handler* hnd;
+void onLoad()
+{
+ sm.addState("Run");
+ sm.addState("Idle");
+ sm.addState("Sleep");
+ sm.addState("Jump");
+ sm.addParametert("run");
+ sm.addParameterb("idle");
+ /*sm.addTransitionb("Empty", "Idle", "run", StateMachine::BOOL_IS, true);
+ sm.addTransitionb("Idle", "Run", "run", StateMachine::BOOL_IS, false);
+ */
+ sm.addTransition("Run", "Idle", StateMachine::Conditions().andf());
+ sm.addTransitiont("Empty", "Idle", "run");
+ sm.addTransitiont("Idle", "Run", "run");
+ sm.setEnterListener([](const string& state, void* p) {
+ cout << "Enter: " << state << endl;
+ });
+ sm.addEnterListener("Run", [](void* p) {
+ cout << "A Run state enter callback" << endl;
+ });
+ sm.addTranslateListener("Idle", "Run", [](void* p) {
+ cout << "From Idle to Run" << endl;
+ });
+ Window::get()->show();
+ hnd = timer.every(500, [](void*) {
+ cout << sm.getCurrentState() << endl;
+ }, NULL);
+ timer.after(2500, [](void*) {
+ //sm.setParameterb("run", true);
+ sm.setParametert("run");
+ //timer.cancel(hnd);
+ }, NULL);
+ timer.after(5000, [](void*) {
+ sm.setParametert("run");
+ //sm.setParameterb("run", false);
+ }, NULL);
+}
+
+void onEvent(Event* e)
+{
+ static Application* Application = Application::get();
+ if (e->type == EventType::QUIT)
+ Application->stop();
+}
+
+void onUpdate(int ms)
+{
+ timer.update(ms);
+ sm.update();
+}
+
+void onDraw()
+{
+}
+
+int main(int argc, char* argv[])
+{
+ Application* Application = Application::get();
+ Application::Setting setting;
+ setting.loader = onLoad;
+ setting.eventHandler = onEvent;
+ setting.updater = onUpdate;
+ setting.drawer = onDraw;
+ Application->init(&setting);
+
+ AssetDatabase::get()->mount(".");
+
+ Window* wnd = Window::get();
+ Window::Setting wndSetting;
+ wndSetting.width = 600;
+ wndSetting.height = 512;
+ wndSetting.title = "Jin v0.1.1";
+ wndSetting.fps = 60;
+ wndSetting.vsync = false;
+ wndSetting.fullscreen = false;
+ wndSetting.resizable = false;
+ wndSetting.icon = ".";
+ wnd->init(&wndSetting);
+
+ Application->run();
+
+ Application->quit();
+ wnd->quit();
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/state_machine/main.cpp b/examples/state_machine/main.cpp
new file mode 100644
index 0000000..c061a81
--- /dev/null
+++ b/examples/state_machine/main.cpp
@@ -0,0 +1,124 @@
+#include <iostream>
+
+#include "libjin/jin.h"
+
+using namespace std;
+using namespace JinEngine::AI;
+using namespace JinEngine::Game;
+using namespace JinEngine::Input;
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Particles;
+using namespace JinEngine::Filesystem;
+using namespace JinEngine::Time;
+
+ParticleSystem* p;
+StateMachine sm;
+Timer timer;
+enum
+{
+ STATE_EMPTY = 0,
+ STATE_RUN,
+ STATE_IDLE,
+ STATE_SLEEP,
+ STATE_JUMP
+};
+
+enum
+{
+ PARAM_RUN = 1,
+ PARAM_IDLE = 2,
+ PARAM_IDLE2 = 3,
+ PARAM_RUN = 4
+};
+
+void onLoad()
+{
+ sm.addState(STATE_RUN);
+ sm.addState(STATE_IDLE);
+ sm.addState(STATE_SLEEP);
+ sm.addState(STATE_JUMP);
+ sm.addParametert(PARAM_RUN);
+ sm.addParameterb(PARAM_IDLE);
+ sm.addParameterb(PARAM_IDLE2);
+ sm.addTransition(STATE_EMPTY, STATE_IDLE, StateMachine::Conditions().andt(PARAM_RUN));
+ sm.addTransition("Idle", "Run", StateMachine::Conditions().andb("idle", StateMachine::BOOL_IS, true).andb("idle2", StateMachine::BOOL_IS, true));
+ sm.setEnterListener([](const string& state, void* p) {
+ cout << "Enter: " << state << endl;
+ });
+ sm.addEnterListener("Run", [](void* p) {
+ cout << "A Run state enter callback" << endl;
+ });
+ sm.addTranslateListener("Idle", "Run", [](void* p) {
+ cout << "From Idle to Run" << endl;
+ });
+ sm.addUpdateListener("Run", [](void* p) {
+ cout << "run" << endl;
+ });
+ Window::get()->show();
+ Timer::Handler* hnd = timer.every(500, [](void*) {
+ cout << sm.getCurrentState() << endl;
+ }, NULL);
+ timer.after(2500, [](void*) {
+ //sm.setParameterb("run", true);
+ sm.setParametert("run");
+ }, NULL);
+ timer.after(5000, [=](void*) {
+ sm.setParameterb("idle", true);
+ sm.setParametert("run");
+ timer.cancel(hnd);
+ //sm.setParameterb("run", false);
+ }, NULL);
+ timer.after(8000, [](void*) {
+ sm.setParameterb("idle2", true);
+ //sm.setParameterb("run", false);
+ }, NULL);
+}
+
+void onEvent(Event* e)
+{
+ static Application* Application = Application::get();
+ if (e->type == EventType::QUIT)
+ Application->stop();
+}
+
+void onUpdate(int ms)
+{
+ timer.update(ms);
+ sm.update();
+}
+
+void onDraw()
+{
+}
+
+int main(int argc, char* argv[])
+{
+ Application* Application = Application::get();
+ Application::Setting setting;
+ setting.loader = onLoad;
+ setting.eventHandler = onEvent;
+ setting.updater = onUpdate;
+ setting.drawer = onDraw;
+ Application->init(&setting);
+
+ AssetDatabase::get()->mount(".");
+
+ Window* wnd = Window::get();
+ Window::Setting wndSetting;
+ wndSetting.width = 600;
+ wndSetting.height = 512;
+ wndSetting.title = "Jin v0.1.1";
+ wndSetting.fps = 60;
+ wndSetting.vsync = false;
+ wndSetting.fullscreen = false;
+ wndSetting.resizable = false;
+ wndSetting.icon = ".";
+ wnd->init(&wndSetting);
+
+ Application->run();
+
+ Application->quit();
+ wnd->quit();
+
+ return 0;
+} \ No newline at end of file
diff --git a/res/font.png b/res/font.png
index 6beeb64..15c98a5 100644
--- a/res/font.png
+++ b/res/font.png
Binary files differ
diff --git a/src/libjin/3rdparty/GLee/GLee.c b/src/3rdparty/GLee/GLee.c
index 0f32273..0f32273 100644
--- a/src/libjin/3rdparty/GLee/GLee.c
+++ b/src/3rdparty/GLee/GLee.c
diff --git a/src/libjin/3rdparty/GLee/GLee.h b/src/3rdparty/GLee/GLee.h
index 1e9a297..1e9a297 100644
--- a/src/libjin/3rdparty/GLee/GLee.h
+++ b/src/3rdparty/GLee/GLee.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/.gitignore b/src/3rdparty/LuaJIT-2.0.5/.gitignore
index 1a8e376..1a8e376 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/.gitignore
+++ b/src/3rdparty/LuaJIT-2.0.5/.gitignore
diff --git a/build/vc++/libs/LuaJIT-2.0.5/COPYRIGHT b/src/3rdparty/LuaJIT-2.0.5/COPYRIGHT
index 6ed4002..6ed4002 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/COPYRIGHT
+++ b/src/3rdparty/LuaJIT-2.0.5/COPYRIGHT
diff --git a/build/vc++/libs/LuaJIT-2.0.5/Makefile b/src/3rdparty/LuaJIT-2.0.5/Makefile
index ecce9ec..ecce9ec 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/Makefile
+++ b/src/3rdparty/LuaJIT-2.0.5/Makefile
diff --git a/build/vc++/libs/LuaJIT-2.0.5/README b/src/3rdparty/LuaJIT-2.0.5/README
index 6cb7ceb..6cb7ceb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/README
+++ b/src/3rdparty/LuaJIT-2.0.5/README
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/bluequad-print.css b/src/3rdparty/LuaJIT-2.0.5/doc/bluequad-print.css
index d5a3ea3..d5a3ea3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/bluequad-print.css
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/bluequad-print.css
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/bluequad.css b/src/3rdparty/LuaJIT-2.0.5/doc/bluequad.css
index cfc889a..cfc889a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/bluequad.css
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/bluequad.css
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/changes.html b/src/3rdparty/LuaJIT-2.0.5/doc/changes.html
index c1848e8..c1848e8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/changes.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/changes.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/contact.html b/src/3rdparty/LuaJIT-2.0.5/doc/contact.html
index 54ddf74..54ddf74 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/contact.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/contact.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_c_api.html b/src/3rdparty/LuaJIT-2.0.5/doc/ext_c_api.html
index 3825956..3825956 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_c_api.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/ext_c_api.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi.html b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi.html
index 74ca294..74ca294 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_api.html b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_api.html
index 10f2d02..10f2d02 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_api.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_api.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_semantics.html b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_semantics.html
index 218049d..218049d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_semantics.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_semantics.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_tutorial.html b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_tutorial.html
index cd455cf..cd455cf 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_ffi_tutorial.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/ext_ffi_tutorial.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_jit.html b/src/3rdparty/LuaJIT-2.0.5/doc/ext_jit.html
index ce6dcd6..ce6dcd6 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/ext_jit.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/ext_jit.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/extensions.html b/src/3rdparty/LuaJIT-2.0.5/doc/extensions.html
index fa412e0..fa412e0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/extensions.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/extensions.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/faq.html b/src/3rdparty/LuaJIT-2.0.5/doc/faq.html
index 9338be4..9338be4 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/faq.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/faq.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/img/contact.png b/src/3rdparty/LuaJIT-2.0.5/doc/img/contact.png
index 9c73dc5..9c73dc5 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/img/contact.png
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/img/contact.png
Binary files differ
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/install.html b/src/3rdparty/LuaJIT-2.0.5/doc/install.html
index befffa7..befffa7 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/install.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/install.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/luajit.html b/src/3rdparty/LuaJIT-2.0.5/doc/luajit.html
index d8f531d..d8f531d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/luajit.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/luajit.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/running.html b/src/3rdparty/LuaJIT-2.0.5/doc/running.html
index 08d7f71..08d7f71 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/running.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/running.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/doc/status.html b/src/3rdparty/LuaJIT-2.0.5/doc/status.html
index ea61db1..ea61db1 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/doc/status.html
+++ b/src/3rdparty/LuaJIT-2.0.5/doc/status.html
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_arm.h b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_arm.h
index 1d404cc..1d404cc 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_arm.lua b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_arm.lua
index 9ece1d7..9ece1d7 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_arm.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_arm.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_mips.h b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_mips.h
index 46af034..46af034 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_mips.lua b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_mips.lua
index 8e250ce..8e250ce 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_mips.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_mips.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_ppc.h b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_ppc.h
index 81b9a76..81b9a76 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_ppc.lua b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_ppc.lua
index 4e1656e..4e1656e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_ppc.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_ppc.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_proto.h b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_proto.h
index f5e79c7..f5e79c7 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_proto.h
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_proto.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x64.lua b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x64.lua
index e8bdeb3..e8bdeb3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x64.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x64.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x86.h b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x86.h
index 8ae911d..8ae911d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x86.lua b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x86.lua
index 21c2086..21c2086 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dasm_x86.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dasm_x86.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dynasm.lua b/src/3rdparty/LuaJIT-2.0.5/dynasm/dynasm.lua
index c46e956..c46e956 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/dynasm/dynasm.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/dynasm/dynasm.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/etc/luajit.1 b/src/3rdparty/LuaJIT-2.0.5/etc/luajit.1
index 0d263db..0d263db 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/etc/luajit.1
+++ b/src/3rdparty/LuaJIT-2.0.5/etc/luajit.1
diff --git a/build/vc++/libs/LuaJIT-2.0.5/etc/luajit.pc b/src/3rdparty/LuaJIT-2.0.5/etc/luajit.pc
index 36840ab..36840ab 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/etc/luajit.pc
+++ b/src/3rdparty/LuaJIT-2.0.5/etc/luajit.pc
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lauxlib.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lauxlib.h
index fed1491..fed1491 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lauxlib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lauxlib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_alloc.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_alloc.h
index f87a7cf..f87a7cf 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_alloc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_alloc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_arch.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_arch.h
index 5f7e445..5f7e445 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_arch.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_arch.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm.h
index 2819481..2819481 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_arm.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_arm.h
index 961f7e3..961f7e3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_mips.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_mips.h
index 7631190..7631190 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_ppc.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_ppc.h
index d8a14c8..d8a14c8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_x86.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_x86.h
index 10468bb..10468bb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_asm_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_asm_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_bc.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_bc.h
index 108c10f..108c10f 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_bc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_bc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_bcdump.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_bcdump.h
index ba53c0a..ba53c0a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_bcdump.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_bcdump.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_carith.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_carith.h
index 82fc824..82fc824 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_carith.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_carith.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ccall.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ccall.h
index 9089e6c..9089e6c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ccall.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ccall.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ccallback.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ccallback.h
index a8cdad3..a8cdad3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ccallback.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ccallback.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cconv.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cconv.h
index 0a0b66c..0a0b66c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cconv.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cconv.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cdata.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cdata.h
index 4bb65db..4bb65db 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cdata.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cdata.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_char.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_char.h
index c3c86d3..c3c86d3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_char.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_char.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_clib.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_clib.h
index fcc9dac..fcc9dac 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_clib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_clib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cparse.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cparse.h
index bad1060..bad1060 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_cparse.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_cparse.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_crecord.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_crecord.h
index 8e0afd1..8e0afd1 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_crecord.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_crecord.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ctype.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ctype.h
index 2aefd3b..2aefd3b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ctype.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ctype.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_debug.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_debug.h
index d10d0da..d10d0da 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_debug.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_debug.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_def.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_def.h
index 21cc59a..21cc59a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_def.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_def.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_dispatch.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_dispatch.h
index e46a0ee..e46a0ee 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_dispatch.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_dispatch.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_arm.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_arm.h
index 285c98d..285c98d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_mips.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_mips.h
index ed62608..ed62608 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_ppc.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_ppc.h
index 1409930..1409930 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_x86.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_x86.h
index 9c371a9..9c371a9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_emit_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_emit_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_err.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_err.h
index cba5fb7..cba5fb7 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_err.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_err.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_errmsg.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_errmsg.h
index ac552f4..ac552f4 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_errmsg.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_errmsg.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ff.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ff.h
index 31d65a0..31d65a0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ff.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ff.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ffrecord.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ffrecord.h
index 3b40745..3b40745 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ffrecord.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ffrecord.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_frame.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_frame.h
index eb5df30..eb5df30 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_frame.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_frame.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_func.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_func.h
index 901751b..901751b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_func.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_func.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_gc.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_gc.h
index 57ac714..57ac714 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_gc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_gc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_gdbjit.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_gdbjit.h
index bbaa156..bbaa156 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_gdbjit.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_gdbjit.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ir.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ir.h
index ded3e0e..ded3e0e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ir.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ir.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ircall.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ircall.h
index 44afde3..44afde3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_ircall.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_ircall.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_iropt.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_iropt.h
index b5081e0..b5081e0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_iropt.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_iropt.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_jit.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_jit.h
index 3f38d28..3f38d28 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_jit.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_jit.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_lex.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_lex.h
index 41c03f9..41c03f9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_lex.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_lex.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_lib.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_lib.h
index aa87407..aa87407 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_lib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_lib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_mcode.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_mcode.h
index f0847e9..f0847e9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_mcode.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_mcode.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_meta.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_meta.h
index e061d99..e061d99 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_meta.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_meta.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_obj.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_obj.h
index 2ee526c..2ee526c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_obj.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_obj.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_parse.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_parse.h
index ceeab69..ceeab69 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_parse.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_parse.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_record.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_record.h
index 2bbbde5..2bbbde5 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_record.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_record.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_snap.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_snap.h
index 2c9ae3d..2c9ae3d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_snap.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_snap.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_state.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_state.h
index d5b476b..d5b476b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_state.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_state.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_str.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_str.h
index be04a97..be04a97 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_str.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_str.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h
index 6fb0dda..6fb0dda 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_strscan.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_tab.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_tab.h
index 36ce7cd..36ce7cd 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_tab.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_tab.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target.h
index 53bfa6b..53bfa6b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_arm.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_arm.h
index d02cbf8..d02cbf8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_mips.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_mips.h
index bed174b..bed174b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_ppc.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_ppc.h
index e57e27d..e57e27d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_x86.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_x86.h
index 4426cc8..4426cc8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_target_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_target_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_trace.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_trace.h
index edc7af0..edc7af0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_trace.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_trace.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_traceerr.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_traceerr.h
index f920e5e..f920e5e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_traceerr.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_traceerr.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_udata.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_udata.h
index f271a42..f271a42 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_udata.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_udata.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_vm.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_vm.h
index 3ffa76b..3ffa76b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_vm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_vm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_vmevent.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_vmevent.h
index 050fb4d..050fb4d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lj_vmevent.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lj_vmevent.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lua.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lua.h
index c83fd3b..c83fd3b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lua.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lua.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lua.hpp b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lua.hpp
index 07e9002..07e9002 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lua.hpp
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lua.hpp
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/luaconf.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/luaconf.h
index b33e91b..b33e91b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/luaconf.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/luaconf.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/luajit.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/luajit.h
index c5ff3ac..c5ff3ac 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/luajit.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/luajit.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lualib.h b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lualib.h
index bfc130a..bfc130a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/include/LuaJIT/lualib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/include/LuaJIT/lualib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/.gitignore b/src/3rdparty/LuaJIT-2.0.5/src/.gitignore
index fc94e82..fc94e82 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/.gitignore
+++ b/src/3rdparty/LuaJIT-2.0.5/src/.gitignore
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/Makefile b/src/3rdparty/LuaJIT-2.0.5/src/Makefile
index 24e8c0e..24e8c0e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/Makefile
+++ b/src/3rdparty/LuaJIT-2.0.5/src/Makefile
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/Makefile.dep b/src/3rdparty/LuaJIT-2.0.5/src/Makefile.dep
index 9e14d61..9e14d61 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/Makefile.dep
+++ b/src/3rdparty/LuaJIT-2.0.5/src/Makefile.dep
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib b/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib
new file mode 100644
index 0000000..c7be727
--- /dev/null
+++ b/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib
Binary files differ
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/buildvm_arch.h b/src/3rdparty/LuaJIT-2.0.5/src/buildvm_arch.h
new file mode 100644
index 0000000..47a4ac9
--- /dev/null
+++ b/src/3rdparty/LuaJIT-2.0.5/src/buildvm_arch.h
@@ -0,0 +1,2144 @@
+/*
+** This file has been pre-processed with DynASM.
+** http://luajit.org/dynasm.html
+** DynASM version 1.3.0, DynASM x86 version 1.3.0
+** DO NOT EDIT! The original file is in "..\..\..\..\src\3rdparty\LuaJIT-2.0.5\src\vm_x86.dasc".
+*/
+
+#if DASM_VERSION != 10300
+#error "Version mismatch between DynASM and included encoding engine"
+#endif
+#define DASM_SECTION_CODE_OP 0
+#define DASM_SECTION_CODE_SUB 1
+#define DASM_MAXSECTION 2
+static const unsigned char build_actionlist[14067] = {
+ 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,141,
+ 76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,15,132,244,
+ 13,137,68,36,20,252,247,198,237,15,132,244,14,248,15,129,252,246,239,252,
+ 247,198,237,15,133,244,10,199,131,233,237,131,230,252,248,41,214,252,247,
+ 222,131,232,1,15,132,244,248,248,1,255,139,44,10,137,106,252,248,139,108,
+ 10,4,137,106,252,252,131,194,8,131,232,1,15,133,244,1,248,2,139,108,36,48,
+ 137,181,233,248,3,139,68,36,20,139,76,36,56,248,4,57,193,15,133,244,252,248,
+ 5,131,252,234,8,137,149,233,248,16,139,76,36,52,137,141,233,49,192,248,17,
+ 131,196,28,91,94,95,93,195,248,6,15,130,244,253,59,149,233,15,135,244,254,
+ 199,66,252,252,237,255,131,194,8,131,192,1,252,233,244,4,248,7,133,201,15,
+ 132,244,5,41,193,141,20,202,252,233,244,5,248,8,137,149,233,137,68,36,20,
+ 137,202,137,252,233,232,251,1,0,139,149,233,252,233,244,3,248,13,176,235,
+ 252,233,244,18,248,19,137,208,137,204,248,18,139,108,36,48,139,173,233,199,
+ 133,233,237,255,252,233,244,17,248,20,248,21,129,225,239,137,204,248,22,139,
+ 108,36,48,185,252,248,252,255,252,255,252,255,184,237,139,149,233,139,157,
+ 233,129,195,239,139,114,252,252,199,66,252,252,237,199,131,233,237,252,233,
+ 244,12,248,23,186,237,252,233,244,248,248,24,255,131,232,8,252,233,244,247,
+ 248,25,141,68,194,252,248,248,1,15,182,142,233,131,198,4,137,149,233,137,
+ 133,233,137,116,36,24,137,202,248,2,137,252,233,232,251,1,0,139,149,233,139,
+ 133,233,139,106,252,248,41,208,193,232,3,131,192,1,139,181,233,139,14,15,
+ 182,252,233,15,182,205,131,198,4,252,255,36,171,248,26,85,87,86,83,131,252,
+ 236,28,139,108,36,48,139,76,36,52,190,237,49,192,141,188,253,36,233,139,157,
+ 233,129,195,239,137,189,233,137,68,36,24,137,68,36,52,56,133,233,15,132,244,
+ 249,255,199,131,233,237,136,133,233,139,149,233,139,133,233,41,200,193,232,
+ 3,131,192,1,41,209,139,114,252,252,137,68,36,20,252,247,198,237,15,132,244,
+ 14,252,233,244,15,248,27,85,87,86,83,131,252,236,28,190,237,252,233,244,247,
+ 248,28,85,87,86,83,131,252,236,28,190,237,248,1,139,108,36,48,139,76,36,52,
+ 139,189,233,137,124,36,52,137,108,36,24,137,165,233,248,2,255,139,157,233,
+ 129,195,239,248,3,199,131,233,237,139,149,233,1,206,41,214,139,133,233,41,
+ 200,193,232,3,131,192,1,248,29,139,105,252,248,129,121,253,252,252,239,15,
+ 133,244,30,248,31,137,202,137,114,252,252,139,181,233,139,14,15,182,252,233,
+ 15,182,205,131,198,4,252,255,36,171,248,32,85,87,86,83,131,252,236,28,139,
+ 108,36,48,139,68,36,56,139,76,36,52,139,84,36,60,137,108,36,24,139,189,233,
+ 43,189,233,199,68,36,60,0,0,0,0,137,124,36,56,137,68,36,8,137,76,36,4,137,
+ 44,36,139,189,233,137,124,36,52,137,165,233,252,255,210,133,192,15,132,244,
+ 16,255,137,193,190,237,252,233,244,2,248,11,1,209,131,230,252,248,137,213,
+ 41,252,242,199,68,193,252,252,237,137,200,139,117,252,244,139,77,252,240,
+ 131,252,249,1,15,134,244,247,139,122,252,248,139,191,233,139,191,233,252,
+ 255,225,248,1,15,132,244,33,41,213,193,252,237,3,141,69,252,255,252,233,244,
+ 34,248,35,15,182,78,252,255,131,252,237,16,141,12,202,41,252,233,15,132,244,
+ 36,252,247,217,193,252,233,3,137,76,36,8,139,72,4,139,0,137,77,4,137,69,0,
+ 137,108,36,4,252,233,244,37,248,38,255,137,68,36,16,199,68,36,20,237,141,
+ 68,36,16,128,126,252,252,235,15,133,244,247,141,139,233,137,41,199,65,4,237,
+ 137,205,252,233,244,248,248,39,15,182,70,252,254,137,68,36,12,219,68,36,12,
+ 221,92,36,16,141,68,36,16,252,233,244,247,248,40,15,182,70,252,254,141,4,
+ 194,248,1,15,182,110,252,255,141,44,252,234,248,2,137,108,36,4,139,108,36,
+ 48,137,68,36,8,137,44,36,137,149,233,137,116,36,24,232,251,1,1,139,149,233,
+ 133,192,15,132,244,249,248,36,15,182,78,252,253,139,104,4,139,0,137,108,202,
+ 4,137,4,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,
+ 248,3,255,139,141,233,137,113,252,244,141,177,233,41,214,139,105,252,248,
+ 184,237,252,233,244,31,248,41,137,68,36,16,199,68,36,20,237,141,68,36,16,
+ 128,126,252,252,235,15,133,244,247,141,139,233,137,41,199,65,4,237,137,205,
+ 252,233,244,248,248,42,15,182,70,252,254,137,68,36,12,219,68,36,12,221,92,
+ 36,16,141,68,36,16,252,233,244,247,248,43,15,182,70,252,254,141,4,194,248,
+ 1,15,182,110,252,255,141,44,252,234,248,2,255,137,108,36,4,139,108,36,48,
+ 137,68,36,8,137,44,36,137,149,233,137,116,36,24,232,251,1,2,139,149,233,133,
+ 192,15,132,244,249,15,182,78,252,253,139,108,202,4,139,12,202,137,104,4,137,
+ 8,248,44,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,
+ 248,3,139,141,233,137,113,252,244,15,182,70,252,253,139,108,194,4,139,4,194,
+ 137,105,20,137,65,16,141,177,233,41,214,139,105,252,248,184,237,252,233,244,
+ 31,248,45,15,182,110,252,252,141,4,194,141,12,202,137,108,36,12,139,108,36,
+ 48,137,68,36,8,137,76,36,4,137,44,36,137,149,233,137,116,36,24,232,251,1,
+ 3,248,3,139,149,233,131,252,248,1,15,135,244,46,248,4,141,118,4,15,130,244,
+ 252,248,5,255,15,183,70,252,254,141,180,253,134,233,248,6,139,6,15,182,204,
+ 15,182,232,131,198,4,193,232,16,252,255,36,171,248,47,131,198,4,129,120,253,
+ 4,239,15,130,244,5,252,233,244,6,248,48,129,120,253,4,239,252,233,244,4,248,
+ 49,131,252,238,4,137,108,36,12,139,108,36,48,137,68,36,8,137,76,36,4,137,
+ 44,36,137,149,233,137,116,36,24,232,251,1,4,252,233,244,3,248,50,131,252,
+ 238,4,139,108,36,48,137,149,233,137,252,233,139,86,252,252,137,116,36,24,
+ 232,251,1,5,252,233,244,3,248,51,248,52,255,141,4,199,252,233,244,247,248,
+ 53,248,54,141,4,199,141,44,252,234,149,252,233,244,248,248,55,141,4,194,137,
+ 197,252,233,244,248,248,56,248,57,141,4,194,248,1,141,44,252,234,248,2,141,
+ 12,202,137,108,36,8,139,108,36,48,137,68,36,12,15,182,70,252,252,137,76,36,
+ 4,137,68,36,16,137,44,36,137,149,233,137,116,36,24,232,251,1,6,139,149,233,
+ 133,192,15,132,244,44,248,46,137,193,41,208,137,113,252,244,141,176,233,184,
+ 237,255,252,233,244,29,248,58,139,108,36,48,137,149,233,141,20,194,137,252,
+ 233,137,116,36,24,232,251,1,7,139,149,233,255,133,192,15,133,244,46,15,183,
+ 70,252,254,139,12,194,252,233,244,59,255,252,233,244,46,255,248,60,141,76,
+ 202,8,248,30,137,76,36,20,137,68,36,16,131,252,233,8,141,4,193,139,108,36,
+ 48,137,76,36,4,137,68,36,8,137,44,36,137,149,233,137,116,36,24,232,251,1,
+ 8,139,149,233,139,76,36,20,139,68,36,16,139,105,252,248,131,192,1,57,215,
+ 15,132,244,61,137,202,137,114,252,252,139,181,233,139,14,15,182,252,233,15,
+ 182,205,131,198,4,252,255,36,171,248,62,139,108,36,48,137,149,233,137,202,
+ 137,252,233,137,116,36,24,232,251,1,9,139,149,233,139,70,252,252,15,182,204,
+ 15,182,232,193,232,16,252,255,164,253,171,233,248,63,129,252,248,239,15,130,
+ 244,64,139,106,4,129,252,253,239,15,131,244,64,139,114,252,252,137,68,36,
+ 20,137,106,252,252,139,42,137,106,252,248,131,232,2,15,132,244,248,255,137,
+ 209,248,1,131,193,8,139,105,4,137,105,252,252,139,41,137,105,252,248,131,
+ 232,1,15,133,244,1,248,2,139,68,36,20,252,233,244,65,248,66,129,252,248,239,
+ 15,130,244,64,139,106,4,184,237,252,247,213,57,232,15,71,197,248,2,139,106,
+ 252,248,139,132,253,197,233,139,114,252,252,199,66,252,252,237,137,66,252,
+ 248,252,233,244,67,248,68,129,252,248,239,15,130,244,64,255,139,106,4,139,
+ 114,252,252,129,252,253,239,15,133,244,252,248,1,139,42,139,173,233,248,2,
+ 133,252,237,199,66,252,252,237,15,132,244,67,139,131,233,199,66,252,252,237,
+ 137,106,252,248,139,141,233,35,136,233,105,201,239,3,141,233,248,3,129,185,
+ 233,239,15,133,244,250,255,57,129,233,15,132,244,251,248,4,139,137,233,133,
+ 201,15,133,244,3,252,233,244,67,248,5,139,105,4,129,252,253,239,15,132,244,
+ 67,139,1,137,106,252,252,137,66,252,248,252,233,244,67,248,6,129,252,253,
+ 239,15,132,244,1,129,252,253,239,255,15,135,244,254,189,237,248,8,252,247,
+ 213,139,172,253,171,233,252,233,244,2,248,69,129,252,248,239,15,130,244,64,
+ 129,122,253,4,239,15,133,244,64,139,42,131,189,233,0,15,133,244,64,129,122,
+ 253,12,239,15,133,244,64,255,139,66,8,137,133,233,139,114,252,252,199,66,
+ 252,252,237,137,106,252,248,252,246,133,233,235,15,132,244,247,128,165,233,
+ 235,139,131,233,137,171,233,137,133,233,248,1,252,233,244,67,248,70,129,252,
+ 248,239,15,130,244,64,129,122,253,4,239,15,133,244,64,255,139,2,139,108,36,
+ 48,137,68,36,4,137,44,36,137,213,131,194,8,137,84,36,8,232,251,1,10,137,252,
+ 234,139,40,139,64,4,139,114,252,252,137,106,252,248,137,66,252,252,252,233,
+ 244,67,248,71,129,252,248,239,15,133,244,64,129,122,253,4,239,15,131,244,
+ 64,221,2,252,233,244,72,248,73,129,252,248,239,15,130,244,64,139,114,252,
+ 252,129,122,253,4,239,15,133,244,249,139,2,248,2,199,66,252,252,237,255,137,
+ 66,252,248,252,233,244,67,248,3,129,122,253,4,239,15,135,244,64,131,187,233,
+ 0,15,133,244,64,139,171,233,59,171,233,15,130,244,247,232,244,74,248,1,139,
+ 108,36,48,137,149,233,137,116,36,24,137,252,233,232,251,1,11,139,149,233,
+ 252,233,244,2,248,75,255,129,252,248,239,15,130,244,64,15,132,244,248,248,
+ 1,129,122,253,4,239,15,133,244,64,139,108,36,48,137,149,233,137,149,233,139,
+ 114,252,252,139,2,137,68,36,4,137,44,36,131,194,8,137,84,36,8,137,116,36,
+ 24,232,251,1,12,139,149,233,133,192,15,132,244,249,139,106,8,139,66,12,137,
+ 106,252,248,137,66,252,252,139,106,16,139,66,20,137,42,137,66,4,248,76,184,
+ 237,252,233,244,77,248,2,199,66,12,237,255,252,233,244,1,248,3,199,66,252,
+ 252,237,252,233,244,67,248,78,129,252,248,239,15,130,244,64,139,42,129,122,
+ 253,4,239,15,133,244,64,255,131,189,233,0,15,133,244,64,255,139,106,252,248,
+ 139,133,233,139,114,252,252,199,66,252,252,237,137,66,252,248,199,66,12,237,
+ 184,237,252,233,244,77,248,79,129,252,248,239,15,130,244,64,129,122,253,4,
+ 239,15,133,244,64,129,122,253,12,239,15,131,244,64,139,114,252,252,221,66,
+ 8,217,232,222,193,219,20,36,221,90,252,248,139,4,36,139,42,59,133,233,15,
+ 131,244,248,193,224,3,3,133,233,248,1,255,129,120,253,4,239,15,132,244,80,
+ 139,40,139,64,4,137,42,137,66,4,252,233,244,76,248,2,131,189,233,0,15,132,
+ 244,80,137,252,233,137,213,137,194,232,251,1,13,137,252,234,133,192,15,133,
+ 244,1,248,80,184,237,252,233,244,77,248,81,129,252,248,239,15,130,244,64,
+ 139,42,129,122,253,4,239,255,139,106,252,248,139,133,233,139,114,252,252,
+ 199,66,252,252,237,137,66,252,248,217,252,238,221,90,8,184,237,252,233,244,
+ 77,248,82,129,252,248,239,15,130,244,64,141,74,8,131,232,1,190,237,248,1,
+ 15,182,171,233,193,252,237,235,131,229,1,1,252,238,252,233,244,29,248,83,
+ 129,252,248,239,15,130,244,64,129,122,253,12,239,255,15,133,244,64,139,106,
+ 4,137,106,12,199,66,4,237,139,42,139,114,8,137,106,8,137,50,141,74,16,131,
+ 232,2,190,237,252,233,244,1,248,84,129,252,248,239,15,130,244,64,139,42,139,
+ 114,252,252,137,116,36,24,137,44,36,129,122,253,4,239,15,133,244,64,131,189,
+ 233,0,15,133,244,64,128,189,233,235,15,135,244,64,255,139,141,233,15,132,
+ 244,247,59,141,233,15,132,244,64,248,1,141,116,193,252,240,59,181,233,15,
+ 135,244,64,137,181,233,139,108,36,48,137,149,233,131,194,8,137,149,233,141,
+ 108,194,232,41,252,245,57,206,15,132,244,249,248,2,139,68,46,4,137,70,252,
+ 252,139,4,46,137,70,252,248,131,252,238,8,57,206,15,133,244,2,248,3,137,76,
+ 36,4,49,201,137,76,36,12,137,76,36,8,232,244,26,255,199,131,233,237,139,108,
+ 36,48,139,52,36,139,149,233,129,252,248,239,15,135,244,254,248,4,139,142,
+ 233,139,190,233,137,142,233,137,252,254,41,206,15,132,244,252,141,4,50,193,
+ 252,238,3,59,133,233,15,135,244,255,137,213,41,205,248,5,139,1,137,4,41,139,
+ 65,4,137,68,41,4,131,193,8,57,252,249,15,133,244,5,248,6,141,70,2,199,66,
+ 252,252,237,248,7,255,139,116,36,24,137,68,36,20,185,252,248,252,255,252,
+ 255,252,255,252,247,198,237,15,132,244,14,252,233,244,15,248,8,199,66,252,
+ 252,237,139,142,233,131,252,233,8,137,142,233,139,1,137,2,139,65,4,137,66,
+ 4,184,237,252,233,244,7,248,9,139,12,36,137,185,233,137,252,242,137,252,233,
+ 232,251,1,0,139,52,36,139,149,233,252,233,244,4,248,85,139,106,252,248,139,
+ 173,233,139,114,252,252,137,116,36,24,137,44,36,131,189,233,0,255,15,133,
+ 244,64,128,189,233,235,15,135,244,64,139,141,233,15,132,244,247,59,141,233,
+ 15,132,244,64,248,1,141,116,193,252,248,59,181,233,15,135,244,64,137,181,
+ 233,139,108,36,48,137,149,233,137,149,233,141,108,194,252,240,41,252,245,
+ 57,206,15,132,244,249,248,2,255,139,68,46,4,137,70,252,252,139,4,46,137,70,
+ 252,248,131,252,238,8,57,206,15,133,244,2,248,3,137,76,36,4,49,201,137,76,
+ 36,12,137,76,36,8,232,244,26,199,131,233,237,139,108,36,48,139,52,36,139,
+ 149,233,129,252,248,239,15,135,244,254,248,4,139,142,233,139,190,233,137,
+ 142,233,137,252,254,41,206,15,132,244,252,141,4,50,193,252,238,3,59,133,233,
+ 15,135,244,255,255,137,213,41,205,248,5,139,1,137,4,41,139,65,4,137,68,41,
+ 4,131,193,8,57,252,249,15,133,244,5,248,6,141,70,1,248,7,139,116,36,24,137,
+ 68,36,20,49,201,252,247,198,237,15,132,244,14,252,233,244,15,248,8,137,252,
+ 242,137,252,233,232,251,1,14,248,9,139,12,36,137,185,233,137,252,242,137,
+ 252,233,232,251,1,0,139,52,36,139,149,233,252,233,244,4,248,86,139,108,36,
+ 48,252,247,133,233,237,15,132,244,64,255,137,149,233,141,68,194,252,248,137,
+ 133,233,49,192,137,133,233,176,235,136,133,233,252,233,244,17,248,87,248,
+ 88,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,221,2,217,
+ 225,248,89,248,72,139,114,252,252,221,90,252,248,248,67,184,237,248,77,255,
+ 137,68,36,20,248,65,252,247,198,237,15,133,244,253,248,5,56,70,252,255,15,
+ 135,244,252,15,182,78,252,253,252,247,209,141,20,202,139,6,15,182,204,15,
+ 182,232,131,198,4,193,232,16,252,255,36,171,248,6,199,68,194,252,244,237,
+ 131,192,1,252,233,244,5,248,7,185,252,248,252,255,252,255,252,255,252,233,
+ 244,15,248,90,129,122,253,4,239,15,131,244,64,221,2,232,244,91,255,252,233,
+ 244,72,248,92,129,122,253,4,239,15,131,244,64,221,2,232,244,93,252,233,244,
+ 72,248,94,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,221,
+ 2,217,252,250,252,233,244,72,248,95,255,129,252,248,239,15,133,244,64,129,
+ 122,253,4,239,15,131,244,64,217,252,237,221,2,217,252,241,252,233,244,72,
+ 248,96,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,217,
+ 252,236,221,2,217,252,241,252,233,244,72,248,97,129,252,248,239,15,130,244,
+ 64,255,129,122,253,4,239,15,131,244,64,221,2,232,244,98,252,233,244,72,248,
+ 99,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,221,2,217,
+ 252,254,252,233,244,72,248,100,129,252,248,239,15,130,244,64,255,129,122,
+ 253,4,239,15,131,244,64,221,2,217,252,255,252,233,244,72,248,101,129,252,
+ 248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,221,2,217,252,242,221,
+ 216,252,233,244,72,248,102,129,252,248,239,15,130,244,64,129,122,253,4,239,
+ 15,131,244,64,255,221,2,217,192,216,200,217,232,222,225,217,252,250,217,252,
+ 243,252,233,244,72,248,103,129,252,248,239,15,130,244,64,129,122,253,4,239,
+ 15,131,244,64,221,2,217,192,216,200,217,232,222,225,217,252,250,217,201,217,
+ 252,243,252,233,244,72,248,104,129,252,248,239,15,130,244,64,129,122,253,
+ 4,239,15,131,244,64,221,2,217,232,217,252,243,252,233,244,72,248,105,255,
+ 129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,221,2,221,28,
+ 36,137,213,232,251,1,15,137,252,234,252,233,244,72,248,106,129,252,248,239,
+ 15,130,244,64,129,122,253,4,239,15,131,244,64,221,2,221,28,36,137,213,232,
+ 251,1,16,137,252,234,252,233,244,72,248,107,129,252,248,239,15,130,244,64,
+ 255,129,122,253,4,239,15,131,244,64,221,2,221,28,36,137,213,232,251,1,17,
+ 137,252,234,252,233,244,72,248,108,248,109,129,252,248,239,15,130,244,64,
+ 129,122,253,4,239,15,131,244,64,221,2,139,106,252,248,220,141,233,252,233,
+ 244,72,248,110,129,252,248,239,15,130,244,64,255,129,122,253,4,239,15,131,
+ 244,64,129,122,253,12,239,15,131,244,64,221,2,221,66,8,217,252,243,252,233,
+ 244,72,248,111,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,
+ 64,129,122,253,12,239,15,131,244,64,221,66,8,221,2,217,252,253,221,217,252,
+ 233,244,72,248,112,255,129,252,248,239,15,130,244,64,139,106,4,129,252,253,
+ 239,15,131,244,64,139,114,252,252,139,2,137,106,252,252,137,66,252,248,209,
+ 229,129,252,253,0,0,224,252,255,15,131,244,249,9,232,15,132,244,249,184,252,
+ 254,3,0,0,129,252,253,0,0,32,0,15,130,244,250,248,1,193,252,237,21,41,197,
+ 137,108,36,16,219,68,36,16,139,106,252,252,129,229,252,255,252,255,15,128,
+ 129,205,0,0,224,63,137,106,252,252,248,2,221,26,184,237,252,233,244,77,248,
+ 3,217,252,238,252,233,244,2,248,4,255,221,2,199,68,36,16,0,0,128,90,216,76,
+ 36,16,221,90,252,248,139,106,252,252,184,52,4,0,0,209,229,252,233,244,1,248,
+ 113,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,221,2,139,
+ 106,4,139,114,252,252,209,229,129,252,253,0,0,224,252,255,15,132,244,250,
+ 217,192,232,244,114,220,252,233,248,1,221,90,252,248,221,26,139,66,252,252,
+ 139,106,4,49,232,15,136,244,249,248,2,184,237,252,233,244,77,248,3,255,129,
+ 252,245,0,0,0,128,137,106,4,252,233,244,2,248,4,217,252,238,217,201,252,233,
+ 244,1,248,115,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,
+ 64,129,122,253,12,239,15,131,244,64,221,66,8,221,2,248,1,217,252,248,223,
+ 224,102,37,0,4,15,133,244,1,221,217,252,233,244,72,248,116,255,129,252,248,
+ 239,15,130,244,64,129,122,253,4,239,15,131,244,64,129,122,253,12,239,15,131,
+ 244,64,221,2,221,66,8,232,244,117,252,233,244,72,248,118,185,2,0,0,0,129,
+ 122,253,4,239,15,131,244,64,221,2,248,5,57,193,15,131,244,72,255,129,124,
+ 253,202,252,252,239,15,131,244,255,248,6,221,68,202,252,248,248,7,219,252,
+ 233,219,209,221,217,131,193,1,252,233,244,5,248,119,185,2,0,0,0,129,122,253,
+ 4,239,15,131,244,64,221,2,248,5,57,193,15,131,244,72,129,124,253,202,252,
+ 252,239,15,131,244,255,248,6,221,68,202,252,248,248,7,219,252,233,218,209,
+ 221,217,131,193,1,252,233,244,5,248,9,255,221,216,252,233,244,64,248,120,
+ 129,252,248,239,15,130,244,64,129,122,253,4,239,15,133,244,64,139,42,219,
+ 133,233,252,233,244,72,248,121,129,252,248,239,15,133,244,64,129,122,253,
+ 4,239,15,133,244,64,139,42,139,114,252,252,131,189,233,1,255,15,130,244,80,
+ 15,182,173,233,137,108,36,16,219,68,36,16,252,233,244,72,248,122,139,171,
+ 233,59,171,233,15,130,244,247,232,244,74,248,1,129,252,248,239,15,133,244,
+ 64,129,122,253,4,239,15,131,244,64,221,2,219,92,36,20,129,124,36,20,252,255,
+ 0,0,0,15,135,244,64,255,199,68,36,8,1,0,0,0,141,68,36,20,248,123,139,108,
+ 36,48,137,149,233,137,68,36,4,137,44,36,137,116,36,24,232,251,1,18,139,149,
+ 233,139,114,252,252,199,66,252,252,237,137,66,252,248,252,233,244,67,248,
+ 124,139,171,233,59,171,233,15,130,244,247,232,244,74,248,1,199,68,36,20,252,
+ 255,252,255,252,255,252,255,129,252,248,239,15,130,244,64,15,134,244,247,
+ 129,122,253,20,239,255,15,131,244,64,221,66,16,219,92,36,20,248,1,129,122,
+ 253,4,239,15,133,244,64,129,122,253,12,239,15,131,244,64,139,42,137,108,36,
+ 12,139,173,233,221,66,8,219,92,36,8,139,76,36,8,139,68,36,20,57,197,15,130,
+ 244,251,248,2,133,201,15,142,244,253,248,3,139,108,36,12,41,200,15,140,244,
+ 125,141,172,253,13,233,131,192,1,248,4,255,137,68,36,8,137,232,252,233,244,
+ 123,248,5,15,140,244,252,141,68,40,1,252,233,244,2,248,6,137,232,252,233,
+ 244,2,248,7,15,132,244,254,1,252,233,131,193,1,15,143,244,3,248,8,185,1,0,
+ 0,0,252,233,244,3,248,125,49,192,252,233,244,4,248,126,255,139,171,233,59,
+ 171,233,15,130,244,247,232,244,74,248,1,129,252,248,239,15,133,244,64,129,
+ 122,253,4,239,15,133,244,64,129,122,253,12,239,139,42,15,131,244,64,221,66,
+ 8,219,92,36,20,139,68,36,20,133,192,15,142,244,125,131,189,233,1,15,130,244,
+ 125,255,15,133,244,127,57,131,233,15,130,244,127,15,182,141,233,139,171,233,
+ 137,68,36,8,248,1,136,77,0,131,197,1,131,232,1,15,133,244,1,139,131,233,252,
+ 233,244,123,248,128,129,252,248,239,15,130,244,64,139,171,233,59,171,233,
+ 15,130,244,247,255,232,244,74,248,1,129,122,253,4,239,15,133,244,64,139,42,
+ 139,133,233,133,192,15,132,244,125,57,131,233,15,130,244,129,129,197,239,
+ 137,116,36,20,137,68,36,8,139,179,233,248,1,15,182,77,0,131,197,1,131,232,
+ 1,136,12,6,15,133,244,1,137,252,240,139,116,36,20,252,233,244,123,248,130,
+ 255,129,252,248,239,15,130,244,64,139,171,233,59,171,233,15,130,244,247,232,
+ 244,74,248,1,129,122,253,4,239,15,133,244,64,139,42,139,133,233,57,131,233,
+ 15,130,244,129,129,197,239,137,116,36,20,137,68,36,8,139,179,233,252,233,
+ 244,249,248,1,255,15,182,76,5,0,131,252,249,65,15,130,244,248,131,252,249,
+ 90,15,135,244,248,131,252,241,32,248,2,136,12,6,248,3,131,232,1,15,137,244,
+ 1,137,252,240,139,116,36,20,252,233,244,123,248,131,129,252,248,239,15,130,
+ 244,64,139,171,233,59,171,233,15,130,244,247,232,244,74,248,1,255,129,122,
+ 253,4,239,15,133,244,64,139,42,139,133,233,57,131,233,15,130,244,129,129,
+ 197,239,137,116,36,20,137,68,36,8,139,179,233,252,233,244,249,248,1,15,182,
+ 76,5,0,131,252,249,97,15,130,244,248,131,252,249,122,15,135,244,248,131,252,
+ 241,32,248,2,136,12,6,248,3,131,232,1,15,137,244,1,255,137,252,240,139,116,
+ 36,20,252,233,244,123,248,132,129,252,248,239,15,130,244,64,129,122,253,4,
+ 239,15,133,244,64,137,213,139,10,232,251,1,19,137,252,234,137,4,36,219,4,
+ 36,252,233,244,72,248,133,129,252,248,239,15,130,244,64,129,122,253,4,239,
+ 15,131,244,64,221,2,199,68,36,16,0,0,192,89,216,68,36,16,221,28,36,248,2,
+ 219,4,36,252,233,244,72,248,134,255,129,252,248,239,15,130,244,64,199,68,
+ 36,16,0,0,192,89,129,122,253,4,239,15,131,244,64,221,2,216,68,36,16,221,28,
+ 36,139,44,36,248,2,137,68,36,20,141,68,194,252,240,248,1,57,208,15,134,244,
+ 135,129,120,253,4,239,15,131,244,136,221,0,216,68,36,16,221,28,36,35,44,36,
+ 131,232,8,252,233,244,1,248,137,129,252,248,239,15,130,244,64,199,68,36,16,
+ 0,0,192,89,129,122,253,4,239,255,15,131,244,64,221,2,216,68,36,16,221,28,
+ 36,139,44,36,248,2,137,68,36,20,141,68,194,252,240,248,1,57,208,15,134,244,
+ 135,129,120,253,4,239,15,131,244,136,221,0,216,68,36,16,221,28,36,11,44,36,
+ 131,232,8,252,233,244,1,248,138,129,252,248,239,15,130,244,64,199,68,36,16,
+ 0,0,192,89,129,122,253,4,239,15,131,244,64,221,2,216,68,36,16,221,28,36,139,
+ 44,36,248,2,137,68,36,20,141,68,194,252,240,248,1,255,57,208,15,134,244,135,
+ 129,120,253,4,239,15,131,244,136,221,0,216,68,36,16,221,28,36,51,44,36,131,
+ 232,8,252,233,244,1,248,139,129,252,248,239,15,130,244,64,129,122,253,4,239,
+ 15,131,244,64,221,2,199,68,36,16,0,0,192,89,216,68,36,16,221,28,36,139,44,
+ 36,248,2,15,205,252,233,244,135,248,140,129,252,248,239,15,130,244,64,255,
+ 129,122,253,4,239,15,131,244,64,221,2,199,68,36,16,0,0,192,89,216,68,36,16,
+ 221,28,36,139,44,36,248,2,252,247,213,248,135,137,44,36,219,4,36,252,233,
+ 244,72,248,136,139,68,36,20,252,233,244,64,248,141,129,252,248,239,15,130,
+ 244,64,129,122,253,4,239,15,131,244,64,129,122,253,12,239,15,131,244,64,255,
+ 221,2,221,66,8,199,68,36,16,0,0,192,89,216,68,36,16,221,92,36,8,216,68,36,
+ 16,221,28,36,139,76,36,8,139,44,36,211,229,252,233,244,135,248,142,129,252,
+ 248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,129,122,253,12,239,
+ 15,131,244,64,221,2,221,66,8,199,68,36,16,0,0,192,89,216,68,36,16,221,92,
+ 36,8,216,68,36,16,221,28,36,139,76,36,8,139,44,36,211,252,237,252,233,244,
+ 135,248,143,129,252,248,239,15,130,244,64,129,122,253,4,239,15,131,244,64,
+ 255,129,122,253,12,239,15,131,244,64,221,2,221,66,8,199,68,36,16,0,0,192,
+ 89,216,68,36,16,221,92,36,8,216,68,36,16,221,28,36,139,76,36,8,139,44,36,
+ 211,252,253,252,233,244,135,248,144,129,252,248,239,15,130,244,64,129,122,
+ 253,4,239,15,131,244,64,129,122,253,12,239,15,131,244,64,221,2,221,66,8,199,
+ 68,36,16,0,0,192,89,216,68,36,16,221,92,36,8,216,68,36,16,221,28,36,139,76,
+ 36,8,139,44,36,211,197,252,233,244,135,248,145,129,252,248,239,15,130,244,
+ 64,255,129,122,253,4,239,15,131,244,64,129,122,253,12,239,15,131,244,64,221,
+ 2,221,66,8,199,68,36,16,0,0,192,89,216,68,36,16,221,92,36,8,216,68,36,16,
+ 221,28,36,139,76,36,8,139,44,36,211,205,252,233,244,135,248,127,184,237,252,
+ 233,244,64,248,129,184,237,248,64,139,108,36,48,139,114,252,252,137,116,36,
+ 24,137,149,233,141,68,194,252,248,141,136,233,137,133,233,139,66,252,248,
+ 59,141,233,15,135,244,251,255,137,44,36,252,255,144,233,139,149,233,133,192,
+ 15,143,244,77,248,1,139,141,233,41,209,193,252,233,3,133,192,141,65,1,139,
+ 106,252,248,15,133,244,34,139,181,233,139,14,15,182,252,233,15,182,205,131,
+ 198,4,252,255,36,171,248,34,137,209,252,247,198,237,15,133,244,249,15,182,
+ 110,252,253,252,247,213,141,20,252,234,252,233,244,29,248,3,137,252,245,131,
+ 229,252,248,41,252,234,252,233,244,29,248,5,186,237,255,137,252,233,232,251,
+ 1,0,139,149,233,49,192,252,233,244,1,248,74,93,137,108,36,16,139,108,36,48,
+ 137,116,36,24,137,149,233,141,68,194,252,248,137,252,233,137,133,233,232,
+ 251,1,20,139,149,233,139,133,233,41,208,193,232,3,131,192,1,139,108,36,16,
+ 85,195,248,146,15,182,131,233,168,235,15,133,244,251,168,235,15,133,244,247,
+ 168,235,15,132,244,247,252,255,139,233,255,252,233,244,247,248,147,15,182,
+ 131,233,168,235,15,133,244,251,252,233,244,247,248,148,15,182,131,233,168,
+ 235,15,133,244,251,168,235,15,132,244,251,252,255,139,233,15,132,244,247,
+ 255,168,235,15,132,244,251,248,1,139,108,36,48,137,149,233,137,252,242,137,
+ 252,233,232,251,1,21,248,3,139,149,233,248,4,15,182,78,252,253,248,5,15,182,
+ 110,252,252,15,183,70,252,254,252,255,164,253,171,233,248,149,131,198,4,139,
+ 77,232,137,76,36,20,252,233,244,4,248,150,139,106,252,248,139,173,233,15,
+ 182,133,233,141,4,194,139,108,36,48,137,149,233,137,133,233,137,252,242,141,
+ 139,233,137,171,233,255,137,116,36,24,232,251,1,22,252,233,244,3,248,151,
+ 137,116,36,24,252,233,244,247,248,152,137,116,36,24,131,206,1,248,1,141,68,
+ 194,252,248,139,108,36,48,137,149,233,137,133,233,137,252,242,137,252,233,
+ 232,251,1,23,199,68,36,24,0,0,0,0,131,230,252,254,139,149,233,137,193,139,
+ 133,233,41,208,137,205,15,182,78,252,253,193,232,3,131,192,1,252,255,229,
+ 248,153,85,141,108,36,12,85,83,82,81,80,15,182,69,252,252,138,101,252,248,
+ 137,125,252,252,137,117,252,248,139,93,0,139,139,233,199,131,233,237,137,
+ 131,233,137,139,233,129,252,236,239,252,242,15,17,125,216,252,242,15,17,117,
+ 208,252,242,15,17,109,200,252,242,15,17,101,192,252,242,15,17,93,184,252,
+ 242,15,17,85,176,252,242,15,17,77,168,252,242,15,17,69,160,139,171,233,139,
+ 147,233,255,137,171,233,199,131,233,0,0,0,0,137,149,233,141,84,36,16,141,
+ 139,233,232,251,1,24,139,141,233,129,225,239,137,204,137,169,233,139,149,
+ 233,139,177,233,248,154,133,192,15,136,244,249,137,68,36,20,139,122,252,248,
+ 139,191,233,139,191,233,199,131,233,0,0,0,0,199,131,233,237,139,6,15,182,
+ 204,15,182,232,131,198,4,193,232,16,129,252,253,239,15,130,244,248,255,139,
+ 68,36,20,248,2,252,255,36,171,248,3,252,247,216,137,252,233,137,194,232,251,
+ 1,25,248,91,217,124,36,4,137,68,36,8,102,184,0,4,102,11,68,36,4,102,37,252,
+ 255,252,247,102,137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,139,68,
+ 36,8,195,248,155,102,15,252,239,210,102,15,118,210,102,15,115,210,1,184,0,
+ 0,48,67,102,15,110,216,102,15,112,219,81,15,40,200,102,15,84,202,102,15,46,
+ 217,15,134,244,247,102,15,85,208,252,242,15,88,203,252,242,15,92,203,102,
+ 15,86,202,184,0,0,252,240,63,102,15,110,208,102,15,112,210,81,252,242,15,
+ 194,193,1,102,15,84,194,252,242,15,92,200,15,40,193,248,1,195,248,93,217,
+ 124,36,4,137,68,36,8,102,184,0,8,102,11,68,36,4,102,37,252,255,252,251,102,
+ 137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,139,68,36,8,195,248,156,
+ 102,15,252,239,210,102,15,118,210,102,15,115,210,1,184,0,0,48,67,102,15,110,
+ 216,102,15,112,219,81,15,40,200,102,15,84,202,102,15,46,217,15,134,244,247,
+ 102,15,85,208,252,242,15,88,203,252,242,15,92,203,102,15,86,202,184,0,0,252,
+ 240,191,102,15,110,208,102,15,112,210,81,252,242,15,194,193,6,102,15,84,194,
+ 252,242,15,92,200,15,40,193,248,1,195,248,114,217,124,36,4,137,68,36,8,102,
+ 184,0,12,102,11,68,36,4,102,137,68,36,6,217,108,36,6,217,252,252,217,108,
+ 36,4,139,68,36,8,195,248,157,102,15,252,239,210,102,15,118,210,102,15,115,
+ 210,1,184,0,0,48,67,102,15,110,216,102,15,112,219,81,15,40,200,102,15,84,
+ 202,102,15,46,217,15,134,244,247,102,15,85,208,15,40,193,252,242,15,88,203,
+ 252,242,15,92,203,184,0,0,252,240,63,102,15,110,216,102,15,112,219,81,252,
+ 242,15,194,193,1,102,15,84,195,252,242,15,92,200,102,15,86,202,15,40,193,
+ 248,1,195,248,158,217,193,216,252,241,217,124,36,4,102,184,0,4,102,11,68,
+ 36,4,102,37,252,255,252,247,102,137,68,36,6,217,108,36,6,217,252,252,217,
+ 108,36,4,222,201,222,252,233,195,248,159,217,232,221,68,36,4,217,252,241,
+ 195,248,98,255,217,252,234,222,201,248,160,217,84,36,4,129,124,36,4,0,0,128,
+ 127,15,132,244,247,129,124,36,4,0,0,128,252,255,15,132,244,248,248,161,217,
+ 192,217,252,252,220,252,233,217,201,217,252,240,217,232,222,193,217,252,253,
+ 221,217,248,1,195,248,2,221,216,217,252,238,195,248,117,219,84,36,4,219,68,
+ 36,4,223,252,233,15,133,244,254,15,138,244,255,221,216,139,68,36,4,131,252,
+ 248,1,15,142,244,252,248,1,169,1,0,0,0,15,133,244,248,216,200,209,232,252,
+ 233,244,1,248,2,255,209,232,15,132,244,251,217,192,248,3,216,200,209,232,
+ 15,132,244,250,15,131,244,3,220,201,252,233,244,3,248,4,222,201,248,5,195,
+ 248,6,15,132,244,5,15,130,244,253,217,232,222,252,241,252,247,216,131,252,
+ 248,1,15,132,244,5,252,233,244,1,248,7,255,221,216,217,232,195,248,8,217,
+ 84,36,4,217,201,217,84,36,8,139,68,36,4,209,224,61,0,0,0,252,255,15,132,244,
+ 248,139,68,36,8,209,224,15,132,244,250,61,0,0,0,252,255,15,132,244,250,217,
+ 252,241,252,233,244,161,248,9,217,232,223,252,234,15,132,244,247,217,201,
+ 248,1,221,216,195,248,2,217,225,217,232,223,252,233,15,132,244,249,221,216,
+ 217,225,217,252,238,184,0,0,0,0,15,146,208,209,200,51,68,36,4,15,137,244,
+ 249,217,201,248,3,221,217,217,225,195,248,4,255,131,124,36,4,0,15,141,244,
+ 3,221,216,221,216,133,192,15,132,244,251,217,252,238,195,248,5,199,68,36,
+ 4,0,0,128,127,217,68,36,4,195,248,162,252,242,15,45,193,252,242,15,42,208,
+ 102,15,46,202,15,133,244,254,15,138,244,255,248,163,131,252,248,1,15,142,
+ 244,252,248,1,169,1,0,0,0,15,133,244,248,252,242,15,89,192,209,232,252,233,
+ 244,1,248,2,209,232,15,132,244,251,255,15,40,200,248,3,252,242,15,89,192,
+ 209,232,15,132,244,250,15,131,244,3,252,242,15,89,200,252,233,244,3,248,4,
+ 252,242,15,89,193,248,5,195,248,6,15,132,244,5,15,130,244,253,252,247,216,
+ 232,244,1,184,0,0,252,240,63,102,15,110,200,102,15,112,201,81,252,242,15,
+ 94,200,15,40,193,195,248,7,184,0,0,252,240,63,102,15,110,192,102,15,112,192,
+ 81,195,248,8,252,242,15,17,76,36,12,252,242,15,17,68,36,4,131,124,36,12,0,
+ 15,133,244,247,255,139,68,36,16,209,224,61,0,0,224,252,255,15,132,244,248,
+ 248,1,131,124,36,4,0,15,133,244,247,139,68,36,8,209,224,15,132,244,250,61,
+ 0,0,224,252,255,15,132,244,251,248,1,221,68,36,12,221,68,36,4,217,252,241,
+ 217,192,217,252,252,220,252,233,217,201,217,252,240,217,232,222,193,217,252,
+ 253,221,217,221,92,36,4,252,242,15,16,68,36,4,195,248,9,184,0,0,252,240,63,
+ 102,15,110,208,102,15,112,210,81,102,15,46,194,15,132,244,247,15,40,193,248,
+ 1,195,248,2,102,15,252,239,210,102,15,118,210,102,15,115,210,1,102,15,84,
+ 194,184,0,0,252,240,63,102,15,110,208,102,15,112,210,81,102,15,46,194,15,
+ 132,244,1,102,15,80,193,15,87,192,136,196,15,146,208,48,224,15,133,244,1,
+ 248,3,255,184,0,0,252,240,127,102,15,110,192,102,15,112,192,81,195,248,4,
+ 102,15,80,193,133,192,15,133,244,3,15,87,192,195,248,5,102,15,80,193,133,
+ 192,15,132,244,3,15,87,192,195,248,164,139,68,36,12,221,68,36,4,131,252,248,
+ 1,15,130,244,91,15,132,244,93,131,252,248,3,15,130,244,114,15,135,244,248,
+ 217,252,250,195,248,2,131,252,248,5,15,130,244,98,15,132,244,160,255,131,
+ 252,248,7,15,132,244,247,15,135,244,248,217,252,237,217,201,217,252,241,195,
+ 248,1,217,232,217,201,217,252,241,195,248,2,131,252,248,9,15,132,244,247,
+ 15,135,244,248,217,252,236,217,201,217,252,241,195,248,1,217,252,254,195,
+ 248,2,131,252,248,11,15,132,244,247,15,135,244,255,217,252,255,195,248,1,
+ 217,252,242,221,216,195,248,9,204,248,165,139,68,36,20,221,68,36,4,221,68,
+ 36,12,131,252,248,1,15,132,244,247,255,15,135,244,248,222,193,195,248,1,222,
+ 252,233,195,248,2,131,252,248,3,15,132,244,247,15,135,244,248,222,201,195,
+ 248,1,222,252,249,195,248,2,131,252,248,5,15,130,244,158,15,132,244,117,131,
+ 252,248,7,15,132,244,247,15,135,244,248,221,216,217,224,195,248,1,221,216,
+ 217,225,195,248,2,255,131,252,248,9,15,132,244,247,15,135,244,248,217,252,
+ 243,195,248,1,217,201,217,252,253,221,217,195,248,2,131,252,248,11,15,132,
+ 244,247,15,135,244,255,219,252,233,219,209,221,217,195,248,1,219,252,233,
+ 218,209,221,217,195,248,9,204,248,166,156,90,137,209,129,252,242,0,0,32,0,
+ 82,157,156,90,49,192,57,209,15,132,244,247,139,68,36,4,87,83,15,162,139,124,
+ 36,16,137,7,137,95,4,137,79,8,137,87,12,91,95,248,1,195,248,167,255,204,255,
+ 204,248,168,131,252,236,16,87,86,83,131,252,236,28,141,157,233,139,181,233,
+ 15,183,192,137,134,233,141,132,253,36,233,137,142,233,137,150,233,137,134,
+ 233,139,140,253,36,233,139,148,253,36,233,137,76,36,44,137,84,36,40,137,226,
+ 137,116,36,24,137,252,241,232,251,1,26,199,131,233,237,139,144,233,139,128,
+ 233,41,208,139,106,252,248,193,232,3,131,192,1,139,181,233,139,14,15,182,
+ 252,233,15,182,205,131,198,4,252,255,36,171,248,33,139,76,36,48,139,179,233,
+ 137,142,233,137,145,233,137,169,233,255,137,252,241,137,194,232,251,1,27,
+ 139,108,36,48,139,134,233,139,150,233,131,190,233,1,15,130,244,253,15,132,
+ 244,252,221,134,233,252,233,244,253,248,6,217,134,233,248,7,139,141,233,15,
+ 183,73,6,137,76,36,48,131,196,28,91,94,95,93,89,3,36,36,131,196,16,81,195,
+ 248,169,85,137,229,83,137,203,43,163,233,137,163,233,15,182,139,233,131,252,
+ 233,1,15,136,244,248,248,1,255,139,132,253,139,233,137,4,140,131,252,233,
+ 1,15,137,244,1,248,2,139,139,233,139,147,233,252,255,147,233,137,131,233,
+ 137,147,233,128,187,233,1,15,130,244,253,15,132,244,252,221,155,233,252,233,
+ 244,253,248,6,217,155,233,248,7,255,41,163,233,139,93,252,252,201,195,255,
+ 129,124,253,202,4,239,15,131,244,45,129,124,253,194,4,239,15,131,244,45,248,
+ 1,221,4,202,248,2,221,4,194,248,3,131,198,4,223,252,233,221,216,255,15,134,
+ 244,247,255,15,135,244,247,255,15,131,244,247,255,15,183,70,252,254,141,180,
+ 253,134,233,248,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
+ 36,171,255,139,108,194,4,131,198,4,255,129,252,253,239,15,131,244,251,129,
+ 124,253,202,4,239,15,131,244,251,248,1,221,4,202,248,2,221,4,194,248,4,223,
+ 252,233,221,216,255,15,138,244,248,15,133,244,248,255,15,138,244,248,15,132,
+ 244,247,255,248,1,15,183,70,252,254,141,180,253,134,233,248,2,255,248,2,15,
+ 183,70,252,254,141,180,253,134,233,248,1,255,252,233,244,9,255,248,5,129,
+ 252,253,239,15,132,244,50,129,124,253,202,4,239,15,132,244,50,57,108,202,
+ 4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,57,193,15,
+ 132,244,1,129,252,253,239,15,135,244,2,139,169,233,133,252,237,15,132,244,
+ 2,255,252,246,133,233,235,15,133,244,2,255,49,252,237,255,189,1,0,0,0,255,
+ 252,233,244,49,255,248,3,129,252,253,239,255,15,133,244,9,255,252,233,244,
+ 50,255,252,247,208,139,108,202,4,131,198,4,129,252,253,239,15,133,244,249,
+ 139,12,202,59,12,135,255,139,108,202,4,131,198,4,255,129,252,253,239,15,131,
+ 244,249,248,1,221,4,199,248,2,221,4,202,248,4,223,252,233,221,216,255,252,
+ 247,208,139,108,202,4,131,198,4,57,197,255,15,133,244,249,15,183,70,252,254,
+ 141,180,253,134,233,248,2,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
+ 252,255,36,171,248,3,129,252,253,239,15,133,244,2,252,233,244,50,255,15,132,
+ 244,248,129,252,253,239,15,132,244,50,15,183,70,252,254,141,180,253,134,233,
+ 248,2,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,
+ 139,108,194,4,131,198,4,129,252,253,239,255,137,108,202,4,139,44,194,137,
+ 44,202,255,139,108,194,4,139,4,194,137,108,202,4,137,4,202,139,6,15,182,204,
+ 15,182,232,131,198,4,193,232,16,252,255,36,171,255,49,252,237,129,124,253,
+ 194,4,239,129,213,239,137,108,202,4,139,6,15,182,204,15,182,232,131,198,4,
+ 193,232,16,252,255,36,171,255,129,124,253,194,4,239,15,131,244,55,221,4,194,
+ 217,224,221,28,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
+ 36,171,255,129,124,253,194,4,239,15,133,244,248,139,4,194,219,128,233,248,
+ 1,221,28,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,
+ 171,248,2,129,124,253,194,4,239,15,133,244,58,139,12,194,255,139,169,233,
+ 131,252,253,0,15,133,244,255,248,3,255,248,59,137,213,232,251,1,19,137,4,
+ 36,219,4,36,137,252,234,15,182,78,252,253,252,233,244,1,255,248,9,252,246,
+ 133,233,235,15,133,244,3,252,233,244,58,255,15,182,252,236,15,182,192,255,
+ 129,124,253,252,234,4,239,15,131,244,52,221,4,252,234,220,4,199,255,129,124,
+ 253,252,234,4,239,15,131,244,54,221,4,199,220,4,252,234,255,129,124,253,252,
+ 234,4,239,15,131,244,57,129,124,253,194,4,239,15,131,244,57,221,4,252,234,
+ 220,4,194,255,129,124,253,252,234,4,239,15,131,244,52,221,4,252,234,220,36,
+ 199,255,129,124,253,252,234,4,239,15,131,244,54,221,4,199,220,36,252,234,
+ 255,129,124,253,252,234,4,239,15,131,244,57,129,124,253,194,4,239,15,131,
+ 244,57,221,4,252,234,220,36,194,255,129,124,253,252,234,4,239,15,131,244,
+ 52,221,4,252,234,220,12,199,255,129,124,253,252,234,4,239,15,131,244,54,221,
+ 4,199,220,12,252,234,255,129,124,253,252,234,4,239,15,131,244,57,129,124,
+ 253,194,4,239,15,131,244,57,221,4,252,234,220,12,194,255,129,124,253,252,
+ 234,4,239,15,131,244,52,221,4,252,234,220,52,199,255,129,124,253,252,234,
+ 4,239,15,131,244,54,221,4,199,220,52,252,234,255,129,124,253,252,234,4,239,
+ 15,131,244,57,129,124,253,194,4,239,15,131,244,57,221,4,252,234,220,52,194,
+ 255,129,124,253,252,234,4,239,15,131,244,52,221,4,252,234,221,4,199,255,129,
+ 124,253,252,234,4,239,15,131,244,54,221,4,199,221,4,252,234,255,129,124,253,
+ 252,234,4,239,15,131,244,57,129,124,253,194,4,239,15,131,244,57,221,4,252,
+ 234,221,4,194,255,248,170,232,244,158,221,28,202,139,6,15,182,204,15,182,
+ 232,131,198,4,193,232,16,252,255,36,171,255,252,233,244,170,255,232,244,117,
+ 221,28,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,
+ 255,15,182,252,236,15,182,192,141,12,194,41,232,137,76,36,4,137,68,36,8,248,
+ 37,139,108,36,48,137,44,36,137,149,233,137,116,36,24,232,251,1,28,139,149,
+ 233,133,192,15,133,244,46,15,182,110,252,255,15,182,78,252,253,139,68,252,
+ 234,4,139,44,252,234,137,68,202,4,137,44,202,139,6,15,182,204,15,182,232,
+ 131,198,4,193,232,16,252,255,36,171,255,252,247,208,139,4,135,199,68,202,
+ 4,237,137,4,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
+ 36,171,255,223,70,252,254,221,28,202,139,6,15,182,204,15,182,232,131,198,
+ 4,193,232,16,252,255,36,171,255,221,4,199,221,28,202,139,6,15,182,204,15,
+ 182,232,131,198,4,193,232,16,252,255,36,171,255,252,247,208,137,68,202,4,
+ 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,141,76,
+ 202,12,141,68,194,4,189,237,137,105,252,248,248,1,137,41,131,193,8,57,193,
+ 15,134,244,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,
+ 171,255,139,106,252,248,139,172,253,133,233,139,173,233,139,69,4,139,109,
+ 0,137,68,202,4,137,44,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
+ 252,255,36,171,255,139,106,252,248,139,172,253,141,233,128,189,233,0,139,
+ 173,233,139,12,194,139,68,194,4,137,77,0,137,69,4,15,132,244,247,252,246,
+ 133,233,235,15,133,244,248,248,1,139,6,15,182,204,15,182,232,131,198,4,193,
+ 232,16,252,255,36,171,248,2,129,232,239,129,252,248,239,15,134,244,1,252,
+ 246,129,233,235,15,132,244,1,135,213,141,139,233,255,232,251,1,29,137,252,
+ 234,252,233,244,1,255,252,247,208,139,106,252,248,139,172,253,141,233,139,
+ 12,135,139,133,233,137,8,199,64,4,237,252,246,133,233,235,15,133,244,248,
+ 248,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,
+ 2,252,246,129,233,235,15,132,244,1,128,189,233,0,15,132,244,1,137,213,137,
+ 194,141,139,233,232,251,1,29,137,252,234,252,233,244,1,255,139,106,252,248,
+ 221,4,199,139,172,253,141,233,139,141,233,221,25,139,6,15,182,204,15,182,
+ 232,131,198,4,193,232,16,252,255,36,171,255,252,247,208,139,106,252,248,139,
+ 172,253,141,233,139,141,233,137,65,4,139,6,15,182,204,15,182,232,131,198,
+ 4,193,232,16,252,255,36,171,255,141,180,253,134,233,139,108,36,48,131,189,
+ 233,0,15,132,244,247,137,149,233,141,20,202,137,252,233,232,251,1,30,139,
+ 149,233,248,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,
+ 171,255,252,247,208,139,74,252,248,139,4,135,139,108,36,48,137,76,36,8,137,
+ 68,36,4,137,44,36,137,149,233,137,116,36,24,232,251,1,31,139,149,233,15,182,
+ 78,252,253,137,4,202,199,68,202,4,237,139,6,15,182,204,15,182,232,131,198,
+ 4,193,232,16,252,255,36,171,255,139,108,36,48,137,149,233,139,139,233,59,
+ 139,233,137,116,36,24,15,131,244,251,248,1,137,193,37,252,255,7,0,0,193,252,
+ 233,11,137,76,36,8,61,252,255,7,0,0,15,132,244,249,248,2,137,44,36,137,68,
+ 36,4,232,251,1,32,139,149,233,15,182,78,252,253,137,4,202,199,68,202,4,237,
+ 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,3,184,
+ 1,8,0,0,252,233,244,2,248,5,137,252,233,232,251,1,33,15,183,70,252,254,252,
+ 233,244,1,255,252,247,208,139,108,36,48,139,139,233,137,116,36,24,59,139,
+ 233,137,149,233,15,131,244,249,248,2,139,20,135,137,252,233,232,251,1,34,
+ 139,149,233,15,182,78,252,253,137,4,202,199,68,202,4,237,139,6,15,182,204,
+ 15,182,232,131,198,4,193,232,16,252,255,36,171,248,3,137,252,233,232,251,
+ 1,33,15,183,70,252,254,252,247,208,252,233,244,2,255,252,247,208,139,106,
+ 252,248,139,173,233,139,4,135,252,233,244,171,255,252,247,208,139,106,252,
+ 248,139,173,233,139,4,135,252,233,244,172,255,15,182,252,236,15,182,192,129,
+ 124,253,252,234,4,239,15,133,244,40,139,44,252,234,129,124,253,194,4,239,
+ 15,131,244,251,221,4,194,219,20,36,219,4,36,223,252,233,221,216,139,4,36,
+ 15,133,244,40,59,133,233,15,131,244,40,193,224,3,3,133,233,129,120,253,4,
+ 239,15,132,244,248,139,40,139,64,4,137,44,202,137,68,202,4,248,1,139,6,15,
+ 182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,2,131,189,233,
+ 0,15,132,244,249,255,139,141,233,252,246,129,233,235,15,132,244,40,15,182,
+ 78,252,253,248,3,199,68,202,4,237,252,233,244,1,248,5,129,124,253,194,4,239,
+ 15,133,244,40,139,4,194,252,233,244,171,255,15,182,252,236,15,182,192,252,
+ 247,208,139,4,135,129,124,253,252,234,4,239,15,133,244,38,139,44,252,234,
+ 248,171,139,141,233,35,136,233,105,201,239,3,141,233,248,1,129,185,233,239,
+ 15,133,244,250,57,129,233,15,133,244,250,129,121,253,4,239,15,132,244,251,
+ 15,182,70,252,253,139,41,139,73,4,137,44,194,137,76,194,4,248,2,255,139,6,
+ 15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,3,15,182,70,
+ 252,253,199,68,194,4,237,252,233,244,2,248,4,139,137,233,133,201,15,133,244,
+ 1,248,5,139,141,233,133,201,15,132,244,3,252,246,129,233,235,15,133,244,3,
+ 252,233,244,38,255,15,182,252,236,15,182,192,129,124,253,252,234,4,239,15,
+ 133,244,39,139,44,252,234,59,133,233,15,131,244,39,193,224,3,3,133,233,129,
+ 120,253,4,239,15,132,244,248,139,40,139,64,4,137,44,202,137,68,202,4,248,
+ 1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,2,131,
+ 189,233,0,15,132,244,249,139,141,233,252,246,129,233,235,15,132,244,39,255,
+ 15,182,78,252,253,248,3,199,68,202,4,237,252,233,244,1,255,15,182,252,236,
+ 15,182,192,129,124,253,252,234,4,239,15,133,244,43,139,44,252,234,129,124,
+ 253,194,4,239,15,131,244,251,221,4,194,219,20,36,219,4,36,223,252,233,221,
+ 216,139,4,36,15,133,244,43,59,133,233,15,131,244,43,193,224,3,3,133,233,129,
+ 120,253,4,239,15,132,244,249,248,1,252,246,133,233,235,15,133,244,253,248,
+ 2,255,139,108,202,4,139,12,202,137,104,4,137,8,139,6,15,182,204,15,182,232,
+ 131,198,4,193,232,16,252,255,36,171,248,3,131,189,233,0,15,132,244,1,139,
+ 141,233,252,246,129,233,235,15,132,244,43,15,182,78,252,253,252,233,244,1,
+ 248,5,129,124,253,194,4,239,15,133,244,43,139,4,194,252,233,244,172,248,7,
+ 128,165,233,235,255,139,139,233,137,171,233,137,141,233,15,182,78,252,253,
+ 252,233,244,2,255,15,182,252,236,15,182,192,252,247,208,139,4,135,129,124,
+ 253,252,234,4,239,15,133,244,41,139,44,252,234,248,172,139,141,233,35,136,
+ 233,105,201,239,198,133,233,0,3,141,233,248,1,129,185,233,239,15,133,244,
+ 251,57,129,233,15,133,244,251,129,121,253,4,239,15,132,244,250,248,2,255,
+ 252,246,133,233,235,15,133,244,253,248,3,15,182,70,252,253,139,108,194,4,
+ 139,4,194,137,105,4,137,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
+ 252,255,36,171,248,4,131,189,233,0,15,132,244,2,137,76,36,16,139,141,233,
+ 252,246,129,233,235,15,132,244,41,139,76,36,16,252,233,244,2,248,5,139,137,
+ 233,133,201,15,133,244,1,255,139,141,233,133,201,15,132,244,252,252,246,129,
+ 233,235,15,132,244,41,248,6,137,68,36,16,199,68,36,20,237,137,108,36,12,141,
+ 68,36,16,137,108,36,4,139,108,36,48,137,68,36,8,137,44,36,137,149,233,137,
+ 116,36,24,232,251,1,35,139,149,233,139,108,36,12,137,193,252,233,244,2,248,
+ 7,128,165,233,235,139,131,233,137,171,233,137,133,233,252,233,244,3,255,15,
+ 182,252,236,15,182,192,129,124,253,252,234,4,239,15,133,244,42,139,44,252,
+ 234,59,133,233,15,131,244,42,193,224,3,3,133,233,129,120,253,4,239,15,132,
+ 244,249,248,1,252,246,133,233,235,15,133,244,253,248,2,139,108,202,4,139,
+ 12,202,137,104,4,137,8,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,
+ 255,36,171,248,3,131,189,233,0,15,132,244,1,255,139,141,233,252,246,129,233,
+ 235,15,132,244,42,15,182,78,252,253,252,233,244,1,248,7,128,165,233,235,139,
+ 139,233,137,171,233,137,141,233,15,182,78,252,253,252,233,244,2,255,137,124,
+ 36,16,139,60,199,248,1,141,12,202,139,105,252,248,252,246,133,233,235,15,
+ 133,244,253,248,2,139,68,36,20,131,232,1,15,132,244,250,1,252,248,59,133,
+ 233,15,135,244,251,41,252,248,193,231,3,3,189,233,248,3,139,41,137,47,139,
+ 105,4,131,193,8,137,111,4,131,199,8,131,232,1,15,133,244,3,248,4,139,124,
+ 36,16,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,
+ 5,137,108,36,4,139,108,36,48,137,149,233,137,68,36,8,137,44,36,137,116,36,
+ 24,232,251,1,36,139,149,233,15,182,78,252,253,252,233,244,1,248,7,255,128,
+ 165,233,235,139,131,233,137,171,233,137,133,233,252,233,244,2,255,3,68,36,
+ 20,255,129,124,253,202,4,239,139,44,202,15,133,244,60,141,84,202,8,137,114,
+ 252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198,4,252,255,36,
+ 171,255,141,76,202,8,137,215,139,105,252,248,129,121,253,252,252,239,15,133,
+ 244,30,248,61,139,114,252,252,252,247,198,237,15,133,244,253,248,1,137,106,
+ 252,248,137,68,36,20,131,232,1,15,132,244,249,248,2,139,41,137,47,139,105,
+ 4,131,193,8,137,111,4,131,199,8,131,232,1,15,133,244,2,139,106,252,248,248,
+ 3,139,68,36,20,128,189,233,1,15,135,244,251,248,4,139,181,233,139,14,15,182,
+ 252,233,15,182,205,131,198,4,252,255,36,171,248,5,255,252,247,198,237,15,
+ 133,244,4,15,182,78,252,253,252,247,209,139,124,202,252,248,139,191,233,139,
+ 191,233,252,233,244,4,248,7,129,252,238,239,252,247,198,237,15,133,244,254,
+ 41,252,242,137,215,139,114,252,252,252,233,244,1,248,8,129,198,239,252,233,
+ 244,1,255,141,76,202,8,139,105,232,139,65,252,236,137,41,137,65,4,139,105,
+ 252,240,139,65,252,244,137,105,8,137,65,12,139,105,224,139,65,228,137,105,
+ 252,248,137,65,252,252,129,252,248,239,184,237,15,133,244,30,137,202,137,
+ 114,252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198,4,252,255,
+ 36,171,255,137,124,36,16,137,92,36,20,139,108,202,252,240,139,68,202,252,
+ 248,139,157,233,131,198,4,139,189,233,248,1,57,216,15,131,244,251,129,124,
+ 253,199,4,239,15,132,244,250,219,68,202,252,248,139,108,199,4,137,108,202,
+ 12,139,44,199,137,108,202,8,131,192,1,221,28,202,137,68,202,252,248,248,2,
+ 15,183,70,252,254,141,180,253,134,233,248,3,139,92,36,20,139,124,36,16,139,
+ 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,4,131,192,
+ 1,137,68,202,252,248,252,233,244,1,248,5,41,216,248,6,59,133,233,15,135,244,
+ 3,105,252,248,239,255,3,189,233,129,191,233,239,15,132,244,253,141,92,24,
+ 1,139,175,233,139,135,233,137,44,202,137,68,202,4,139,175,233,139,135,233,
+ 137,108,202,8,137,68,202,12,137,92,202,252,248,252,233,244,2,248,7,131,192,
+ 1,252,233,244,6,255,129,124,253,202,252,236,239,15,133,244,251,139,108,202,
+ 232,129,124,253,202,252,244,239,15,133,244,251,129,124,253,202,252,252,239,
+ 15,133,244,251,128,189,233,235,15,133,244,251,141,180,253,134,233,199,68,
+ 202,252,248,0,0,0,0,199,68,202,252,252,252,255,127,252,254,252,255,248,1,
+ 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,5,198,
+ 70,252,252,235,141,180,253,134,233,198,6,235,252,233,244,1,255,15,182,252,
+ 236,15,182,192,137,124,36,16,141,188,253,194,233,141,12,202,43,122,252,252,
+ 133,252,237,15,132,244,251,141,108,252,233,252,248,57,215,15,131,244,248,
+ 248,1,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,
+ 252,233,15,131,244,249,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,
+ 252,233,15,130,244,2,248,3,139,124,36,16,139,6,15,182,204,15,182,232,131,
+ 198,4,193,232,16,252,255,36,171,248,5,199,68,36,20,1,0,0,0,137,208,41,252,
+ 248,15,134,244,3,137,197,193,252,237,3,131,197,1,137,108,36,20,139,108,36,
+ 48,1,200,59,133,233,15,135,244,253,248,6,255,139,71,252,248,137,1,139,71,
+ 252,252,131,199,8,137,65,4,131,193,8,57,215,15,130,244,6,252,233,244,3,248,
+ 7,137,149,233,137,141,233,137,116,36,24,41,215,139,84,36,20,131,252,234,1,
+ 137,252,233,232,251,1,0,139,149,233,139,141,233,1,215,252,233,244,6,255,193,
+ 225,3,255,248,1,139,114,252,252,137,68,36,20,252,247,198,237,15,133,244,253,
+ 255,248,14,137,215,131,232,1,15,132,244,249,248,2,139,44,15,137,111,252,248,
+ 139,108,15,4,137,111,252,252,131,199,8,131,232,1,15,133,244,2,248,3,139,68,
+ 36,20,15,182,110,252,255,248,5,57,197,15,135,244,252,255,139,108,10,4,137,
+ 106,252,252,139,44,10,137,106,252,248,255,248,5,56,70,252,255,15,135,244,
+ 252,255,15,182,78,252,253,252,247,209,141,20,202,139,122,252,248,139,191,
+ 233,139,191,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
+ 36,171,248,6,255,199,71,252,252,237,131,199,8,255,199,68,194,252,244,237,
+ 255,131,192,1,252,233,244,5,248,7,141,174,233,252,247,197,237,15,133,244,
+ 15,41,252,234,255,1,252,233,255,137,252,245,209,252,237,129,229,239,102,129,
+ 172,253,43,233,238,15,130,244,150,255,141,12,202,255,129,121,253,4,239,15,
+ 133,244,255,255,129,121,253,12,239,15,133,244,62,129,121,253,20,239,15,133,
+ 244,62,139,41,131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,
+ 167,129,121,253,20,239,15,133,244,167,255,139,105,16,133,252,237,15,136,244,
+ 251,3,41,15,128,244,247,137,41,255,59,105,8,199,65,28,237,137,105,24,255,
+ 15,142,244,253,248,1,248,6,141,180,253,134,233,255,141,180,253,134,233,15,
+ 183,70,252,254,15,142,245,248,1,248,6,255,15,143,244,253,248,6,141,180,253,
+ 134,233,248,1,255,248,7,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
+ 252,255,36,171,248,5,255,3,41,15,128,244,1,137,41,255,15,141,244,7,255,141,
+ 180,253,134,233,15,183,70,252,254,15,141,245,255,15,140,244,7,255,252,233,
+ 244,6,248,9,255,129,121,253,4,239,255,15,131,244,62,129,121,253,12,239,15,
+ 131,244,62,255,129,121,253,12,239,15,131,244,167,129,121,253,20,239,15,131,
+ 244,167,255,139,105,20,255,129,252,253,239,15,131,244,62,255,221,65,8,221,
+ 1,255,220,65,16,221,17,221,81,24,133,252,237,15,136,244,247,255,221,81,24,
+ 15,140,244,247,255,217,201,248,1,223,252,233,221,216,255,15,131,244,248,141,
+ 180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,131,245,255,
+ 15,130,244,248,141,180,253,134,233,255,141,12,202,139,105,4,129,252,253,239,
+ 15,132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245,255,
+ 141,180,253,134,233,139,1,137,105,252,252,137,65,252,248,255,139,139,233,
+ 139,4,129,139,128,233,139,108,36,48,137,147,233,137,171,233,252,255,224,255,
+ 141,180,253,134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,
+ 255,36,171,255,137,252,245,209,252,237,129,229,239,102,129,172,253,43,233,
+ 238,15,130,244,152,255,139,190,233,139,108,36,48,141,12,202,59,141,233,15,
+ 135,244,25,15,182,142,233,57,200,15,134,244,249,248,2,255,15,183,70,252,254,
+ 252,233,245,255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,
+ 3,252,233,244,2,255,141,44,197,237,141,4,194,139,122,252,248,137,104,252,
+ 252,137,120,252,248,139,108,36,48,141,12,200,59,141,233,15,135,244,24,137,
+ 209,137,194,15,182,174,233,133,252,237,15,132,244,248,248,1,131,193,8,57,
+ 209,15,131,244,249,139,121,252,248,137,56,139,121,252,252,137,120,4,131,192,
+ 8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,139,190,233,139,
+ 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,248,3,199,
+ 64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,139,106,252,
+ 248,139,189,233,139,108,36,48,141,68,194,252,248,137,149,233,141,136,233,
+ 59,141,233,137,133,233,255,137,44,36,255,137,124,36,4,137,44,36,255,15,135,
+ 244,23,199,131,233,237,255,252,255,215,255,252,255,147,233,255,199,131,233,
+ 237,139,149,233,141,12,194,252,247,217,3,141,233,139,114,252,252,252,233,
+ 244,12,255,254,0
+};
+
+enum {
+ GLOB_vm_returnp,
+ GLOB_cont_dispatch,
+ GLOB_vm_returnc,
+ GLOB_vm_unwind_yield,
+ GLOB_BC_RET_Z,
+ GLOB_vm_return,
+ GLOB_vm_leave_cp,
+ GLOB_vm_leave_unw,
+ GLOB_vm_unwind_c_eh,
+ GLOB_vm_unwind_c,
+ GLOB_vm_unwind_rethrow,
+ GLOB_vm_unwind_ff,
+ GLOB_vm_unwind_ff_eh,
+ GLOB_vm_growstack_c,
+ GLOB_vm_growstack_v,
+ GLOB_vm_growstack_f,
+ GLOB_vm_resume,
+ GLOB_vm_pcall,
+ GLOB_vm_call,
+ GLOB_vm_call_dispatch,
+ GLOB_vmeta_call,
+ GLOB_vm_call_dispatch_f,
+ GLOB_vm_cpcall,
+ GLOB_cont_ffi_callback,
+ GLOB_vm_call_tail,
+ GLOB_cont_cat,
+ GLOB_cont_ra,
+ GLOB_BC_CAT_Z,
+ GLOB_vmeta_tgets,
+ GLOB_vmeta_tgetb,
+ GLOB_vmeta_tgetv,
+ GLOB_vmeta_tsets,
+ GLOB_vmeta_tsetb,
+ GLOB_vmeta_tsetv,
+ GLOB_cont_nop,
+ GLOB_vmeta_comp,
+ GLOB_vmeta_binop,
+ GLOB_cont_condt,
+ GLOB_cont_condf,
+ GLOB_vmeta_equal,
+ GLOB_vmeta_equal_cd,
+ GLOB_vmeta_arith_vno,
+ GLOB_vmeta_arith_vn,
+ GLOB_vmeta_arith_nvo,
+ GLOB_vmeta_arith_nv,
+ GLOB_vmeta_unm,
+ GLOB_vmeta_arith_vvo,
+ GLOB_vmeta_arith_vv,
+ GLOB_vmeta_len,
+ GLOB_BC_LEN_Z,
+ GLOB_vmeta_call_ra,
+ GLOB_BC_CALLT_Z,
+ GLOB_vmeta_for,
+ GLOB_ff_assert,
+ GLOB_fff_fallback,
+ GLOB_fff_res_,
+ GLOB_ff_type,
+ GLOB_fff_res1,
+ GLOB_ff_getmetatable,
+ GLOB_ff_setmetatable,
+ GLOB_ff_rawget,
+ GLOB_ff_tonumber,
+ GLOB_fff_resn,
+ GLOB_ff_tostring,
+ GLOB_fff_gcstep,
+ GLOB_ff_next,
+ GLOB_fff_res2,
+ GLOB_fff_res,
+ GLOB_ff_pairs,
+ GLOB_ff_ipairs_aux,
+ GLOB_fff_res0,
+ GLOB_ff_ipairs,
+ GLOB_ff_pcall,
+ GLOB_ff_xpcall,
+ GLOB_ff_coroutine_resume,
+ GLOB_ff_coroutine_wrap_aux,
+ GLOB_ff_coroutine_yield,
+ GLOB_fff_resi,
+ GLOB_ff_math_abs,
+ GLOB_fff_resxmm0,
+ GLOB_ff_math_floor,
+ GLOB_vm_floor,
+ GLOB_ff_math_ceil,
+ GLOB_vm_ceil,
+ GLOB_ff_math_sqrt,
+ GLOB_ff_math_log,
+ GLOB_ff_math_log10,
+ GLOB_ff_math_exp,
+ GLOB_vm_exp_x87,
+ GLOB_ff_math_sin,
+ GLOB_ff_math_cos,
+ GLOB_ff_math_tan,
+ GLOB_ff_math_asin,
+ GLOB_ff_math_acos,
+ GLOB_ff_math_atan,
+ GLOB_ff_math_sinh,
+ GLOB_ff_math_cosh,
+ GLOB_ff_math_tanh,
+ GLOB_ff_math_deg,
+ GLOB_ff_math_rad,
+ GLOB_ff_math_atan2,
+ GLOB_ff_math_ldexp,
+ GLOB_ff_math_frexp,
+ GLOB_ff_math_modf,
+ GLOB_vm_trunc,
+ GLOB_ff_math_fmod,
+ GLOB_ff_math_pow,
+ GLOB_vm_pow,
+ GLOB_ff_math_min,
+ GLOB_ff_math_max,
+ GLOB_ff_string_len,
+ GLOB_ff_string_byte,
+ GLOB_ff_string_char,
+ GLOB_fff_newstr,
+ GLOB_ff_string_sub,
+ GLOB_fff_emptystr,
+ GLOB_ff_string_rep,
+ GLOB_fff_fallback_2,
+ GLOB_ff_string_reverse,
+ GLOB_fff_fallback_1,
+ GLOB_ff_string_lower,
+ GLOB_ff_string_upper,
+ GLOB_ff_table_getn,
+ GLOB_ff_bit_tobit,
+ GLOB_ff_bit_band,
+ GLOB_fff_resbit,
+ GLOB_fff_fallback_bit_op,
+ GLOB_ff_bit_bor,
+ GLOB_ff_bit_bxor,
+ GLOB_ff_bit_bswap,
+ GLOB_ff_bit_bnot,
+ GLOB_ff_bit_lshift,
+ GLOB_ff_bit_rshift,
+ GLOB_ff_bit_arshift,
+ GLOB_ff_bit_rol,
+ GLOB_ff_bit_ror,
+ GLOB_vm_record,
+ GLOB_vm_rethook,
+ GLOB_vm_inshook,
+ GLOB_cont_hook,
+ GLOB_vm_hotloop,
+ GLOB_vm_callhook,
+ GLOB_vm_hotcall,
+ GLOB_vm_exit_handler,
+ GLOB_vm_exit_interp,
+ GLOB_vm_floor_sse,
+ GLOB_vm_ceil_sse,
+ GLOB_vm_trunc_sse,
+ GLOB_vm_mod,
+ GLOB_vm_log2,
+ GLOB_vm_exp2_x87,
+ GLOB_vm_exp2raw,
+ GLOB_vm_pow_sse,
+ GLOB_vm_powi_sse,
+ GLOB_vm_foldfpm,
+ GLOB_vm_foldarith,
+ GLOB_vm_cpuid,
+ GLOB_assert_bad_for_arg_type,
+ GLOB_vm_ffi_callback,
+ GLOB_vm_ffi_call,
+ GLOB_BC_MODVN_Z,
+ GLOB_BC_TGETS_Z,
+ GLOB_BC_TSETS_Z,
+ GLOB__MAX
+};
+static const char *const globnames[] = {
+ "vm_returnp",
+ "cont_dispatch",
+ "vm_returnc",
+ "vm_unwind_yield",
+ "BC_RET_Z",
+ "vm_return",
+ "vm_leave_cp",
+ "vm_leave_unw",
+ "vm_unwind_c_eh",
+ "vm_unwind_c@8",
+ "vm_unwind_rethrow",
+ "vm_unwind_ff@4",
+ "vm_unwind_ff_eh",
+ "vm_growstack_c",
+ "vm_growstack_v",
+ "vm_growstack_f",
+ "vm_resume",
+ "vm_pcall",
+ "vm_call",
+ "vm_call_dispatch",
+ "vmeta_call",
+ "vm_call_dispatch_f",
+ "vm_cpcall",
+ "cont_ffi_callback",
+ "vm_call_tail",
+ "cont_cat",
+ "cont_ra",
+ "BC_CAT_Z",
+ "vmeta_tgets",
+ "vmeta_tgetb",
+ "vmeta_tgetv",
+ "vmeta_tsets",
+ "vmeta_tsetb",
+ "vmeta_tsetv",
+ "cont_nop",
+ "vmeta_comp",
+ "vmeta_binop",
+ "cont_condt",
+ "cont_condf",
+ "vmeta_equal",
+ "vmeta_equal_cd",
+ "vmeta_arith_vno",
+ "vmeta_arith_vn",
+ "vmeta_arith_nvo",
+ "vmeta_arith_nv",
+ "vmeta_unm",
+ "vmeta_arith_vvo",
+ "vmeta_arith_vv",
+ "vmeta_len",
+ "BC_LEN_Z",
+ "vmeta_call_ra",
+ "BC_CALLT_Z",
+ "vmeta_for",
+ "ff_assert",
+ "fff_fallback",
+ "fff_res_",
+ "ff_type",
+ "fff_res1",
+ "ff_getmetatable",
+ "ff_setmetatable",
+ "ff_rawget",
+ "ff_tonumber",
+ "fff_resn",
+ "ff_tostring",
+ "fff_gcstep",
+ "ff_next",
+ "fff_res2",
+ "fff_res",
+ "ff_pairs",
+ "ff_ipairs_aux",
+ "fff_res0",
+ "ff_ipairs",
+ "ff_pcall",
+ "ff_xpcall",
+ "ff_coroutine_resume",
+ "ff_coroutine_wrap_aux",
+ "ff_coroutine_yield",
+ "fff_resi",
+ "ff_math_abs",
+ "fff_resxmm0",
+ "ff_math_floor",
+ "vm_floor",
+ "ff_math_ceil",
+ "vm_ceil",
+ "ff_math_sqrt",
+ "ff_math_log",
+ "ff_math_log10",
+ "ff_math_exp",
+ "vm_exp_x87",
+ "ff_math_sin",
+ "ff_math_cos",
+ "ff_math_tan",
+ "ff_math_asin",
+ "ff_math_acos",
+ "ff_math_atan",
+ "ff_math_sinh",
+ "ff_math_cosh",
+ "ff_math_tanh",
+ "ff_math_deg",
+ "ff_math_rad",
+ "ff_math_atan2",
+ "ff_math_ldexp",
+ "ff_math_frexp",
+ "ff_math_modf",
+ "vm_trunc",
+ "ff_math_fmod",
+ "ff_math_pow",
+ "vm_pow",
+ "ff_math_min",
+ "ff_math_max",
+ "ff_string_len",
+ "ff_string_byte",
+ "ff_string_char",
+ "fff_newstr",
+ "ff_string_sub",
+ "fff_emptystr",
+ "ff_string_rep",
+ "fff_fallback_2",
+ "ff_string_reverse",
+ "fff_fallback_1",
+ "ff_string_lower",
+ "ff_string_upper",
+ "ff_table_getn",
+ "ff_bit_tobit",
+ "ff_bit_band",
+ "fff_resbit",
+ "fff_fallback_bit_op",
+ "ff_bit_bor",
+ "ff_bit_bxor",
+ "ff_bit_bswap",
+ "ff_bit_bnot",
+ "ff_bit_lshift",
+ "ff_bit_rshift",
+ "ff_bit_arshift",
+ "ff_bit_rol",
+ "ff_bit_ror",
+ "vm_record",
+ "vm_rethook",
+ "vm_inshook",
+ "cont_hook",
+ "vm_hotloop",
+ "vm_callhook",
+ "vm_hotcall",
+ "vm_exit_handler",
+ "vm_exit_interp",
+ "vm_floor_sse",
+ "vm_ceil_sse",
+ "vm_trunc_sse",
+ "vm_mod",
+ "vm_log2",
+ "vm_exp2_x87",
+ "vm_exp2raw",
+ "vm_pow_sse",
+ "vm_powi_sse",
+ "vm_foldfpm",
+ "vm_foldarith",
+ "vm_cpuid",
+ "assert_bad_for_arg_type",
+ "vm_ffi_callback",
+ "vm_ffi_call@4",
+ "BC_MODVN_Z",
+ "BC_TGETS_Z",
+ "BC_TSETS_Z",
+ (const char *)0
+};
+static const char *const extnames[] = {
+ "lj_state_growstack@8",
+ "lj_meta_tget",
+ "lj_meta_tset",
+ "lj_meta_comp",
+ "lj_meta_equal",
+ "lj_meta_equal_cd@8",
+ "lj_meta_arith",
+ "lj_meta_len@8",
+ "lj_meta_call",
+ "lj_meta_for@8",
+ "lj_tab_get",
+ "lj_str_fromnum@8",
+ "lj_tab_next",
+ "lj_tab_getinth@8",
+ "lj_ffh_coroutine_wrap_err@8",
+ "lj_vm_sinh",
+ "lj_vm_cosh",
+ "lj_vm_tanh",
+ "lj_str_new",
+ "lj_tab_len@4",
+ "lj_gc_step@4",
+ "lj_dispatch_ins@8",
+ "lj_trace_hot@8",
+ "lj_dispatch_call@8",
+ "lj_trace_exit@8",
+ "lj_err_throw@8",
+ "lj_ccallback_enter@8",
+ "lj_ccallback_leave@8",
+ "lj_meta_cat",
+ "lj_gc_barrieruv@8",
+ "lj_func_closeuv@8",
+ "lj_func_newL_gc",
+ "lj_tab_new",
+ "lj_gc_step_fixtop@4",
+ "lj_tab_dup@8",
+ "lj_tab_newkey",
+ "lj_tab_reasize",
+ (const char *)0
+};
+#define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
+#define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
+#define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
+#define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
+#define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
+#define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
+#define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
+#define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
+#define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
+#define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
+#define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
+#define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
+#define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
+#define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
+#define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
+#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
+
+/* Generate subroutines used by opcodes and other parts of the VM. */
+/* The .code_sub section should be last to help static branch prediction. */
+static void build_subroutines(BuildCtx *ctx)
+{
+ dasm_put(Dst, 0);
+ dasm_put(Dst, 2, FRAME_P, LJ_TTRUE, FRAME_TYPE, FRAME_C, FRAME_TYPE, DISPATCH_GL(vmstate), ~LJ_VMST_C);
+ dasm_put(Dst, 91, Dt1(->base), Dt1(->top), Dt1(->cframe), Dt1(->maxstack), LJ_TNIL);
+ dasm_put(Dst, 192, Dt1(->top), Dt1(->top), LUA_YIELD, Dt1(->glref), Dt2(->vmstate), ~LJ_VMST_C);
+ dasm_put(Dst, 272, CFRAME_RAWMASK, 1+1, Dt1(->base), Dt1(->glref), GG_G2DISP, LJ_TFALSE, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, LUA_MINSTACK);
+ dasm_put(Dst, 339, -4+PC2PROTO(framesize), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), Dt7(->pc), FRAME_CP, CFRAME_RESUME, Dt1(->glref), GG_G2DISP, Dt1(->cframe), Dt1(->status));
+ dasm_put(Dst, 472, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->status), Dt1(->base), Dt1(->top), FRAME_TYPE, FRAME_CP, FRAME_C, Dt1(->cframe), Dt1(->cframe));
+ dasm_put(Dst, 570, Dt1(->glref), GG_G2DISP, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top), LJ_TFUNC, Dt7(->pc), Dt1(->stack), Dt1(->top), Dt1(->cframe), Dt1(->cframe));
+ dasm_put(Dst, 722, FRAME_CP, LJ_TNIL, Dt7(->pc), PC2PROTO(k));
+ dasm_put(Dst, 854, LJ_TSTR, BC_GGET, DISPATCH_GL(tmptv), LJ_TTAB, Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 1016, Dt1(->top), FRAME_CONT, 2+1, LJ_TSTR, BC_GSET, DISPATCH_GL(tmptv), LJ_TTAB);
+ dasm_put(Dst, 1128, Dt1(->base), Dt1(->base), Dt1(->top), FRAME_CONT, 3+1, Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 1310, -BCBIAS_J*4, LJ_TISTRUECOND, LJ_TISTRUECOND, Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 1446, Dt1(->base), Dt1(->base), FRAME_CONT, 2+1);
+ dasm_put(Dst, 1562, Dt1(->base), Dt1(->base));
+#if LJ_52
+ dasm_put(Dst, 1593);
+#else
+ dasm_put(Dst, 1612);
+#endif
+ dasm_put(Dst, 1617, Dt1(->base), Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base), GG_DISP2STATIC, 1+1, LJ_TISTRUECOND);
+ dasm_put(Dst, 1806, 1+1, ~LJ_TNUMX, ((char *)(&((GCfuncC *)0)->upvalue)), LJ_TSTR, 1+1);
+ dasm_put(Dst, 1905, LJ_TTAB, Dt6(->metatable), LJ_TNIL, DISPATCH_GL(gcroot)+4*(GCROOT_MMNAME+MM_metatable), LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR);
+ dasm_put(Dst, 1976, DtB(->key.gcr), DtB(->next), LJ_TNIL, LJ_TUDATA, LJ_TISNUM);
+ dasm_put(Dst, 2040, LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT]), 2+1, LJ_TTAB, Dt6(->metatable), LJ_TTAB);
+ dasm_put(Dst, 2099, Dt6(->metatable), LJ_TTAB, Dt6(->marked), LJ_GC_BLACK, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist), 2+1, LJ_TTAB);
+ dasm_put(Dst, 2166, 1+1, LJ_TISNUM, 1+1, LJ_TSTR, LJ_TSTR);
+ dasm_put(Dst, 2274, LJ_TISNUM, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 2344, 1+1, LJ_TTAB, Dt1(->base), Dt1(->top), Dt1(->base), 1+2, LJ_TNIL);
+ dasm_put(Dst, 2454, LJ_TNIL, 1+1, LJ_TTAB);
+#if LJ_52
+ dasm_put(Dst, 2491, Dt6(->metatable));
+#endif
+ dasm_put(Dst, 2500, Dt8(->upvalue[0]), LJ_TFUNC, LJ_TNIL, 1+3, 2+1, LJ_TTAB, LJ_TISNUM, Dt6(->asize), Dt6(->array));
+ dasm_put(Dst, 2597, LJ_TNIL, Dt6(->hmask), 1+0, 1+1, LJ_TTAB);
+ dasm_put(Dst, 2094);
+#if LJ_52
+ dasm_put(Dst, 2491, Dt6(->metatable));
+#endif
+ dasm_put(Dst, 2676, Dt8(->upvalue[0]), LJ_TFUNC, 1+3, 1+1, 8+FRAME_PCALL, DISPATCH_GL(hookmask), HOOK_ACTIVE_SHIFT, 2+1, LJ_TFUNC);
+ dasm_put(Dst, 2762, LJ_TFUNC, 16+FRAME_PCALL, 1+1, LJ_TTHREAD, Dt1(->cframe), Dt1(->status), LUA_YIELD);
+ dasm_put(Dst, 2847, Dt1(->top), Dt1(->base), Dt1(->maxstack), Dt1(->top), Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 2951, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), LUA_YIELD, Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->maxstack), LJ_TTRUE);
+ dasm_put(Dst, 3048, FRAME_TYPE, LJ_TFALSE, Dt1(->top), Dt1(->top), 1+2, Dt1(->top), Dt1(->base), Dt8(->upvalue[0].gcr), Dt1(->cframe));
+ dasm_put(Dst, 3163, Dt1(->status), LUA_YIELD, Dt1(->top), Dt1(->base), Dt1(->maxstack), Dt1(->top), Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 3233, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), LUA_YIELD, Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->maxstack));
+ dasm_put(Dst, 3334, FRAME_TYPE, Dt1(->top), Dt1(->base), Dt1(->cframe), CFRAME_RESUME);
+ dasm_put(Dst, 3447, Dt1(->base), Dt1(->top), Dt1(->cframe), LUA_YIELD, Dt1(->status), 1+1, LJ_TISNUM, 1+1);
+ dasm_put(Dst, 3516, FRAME_TYPE, LJ_TNIL, LJ_TISNUM);
+ dasm_put(Dst, 3616, LJ_TISNUM, 1+1, LJ_TISNUM);
+ dasm_put(Dst, 3671, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1);
+ dasm_put(Dst, 3742, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1);
+ dasm_put(Dst, 3799, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM);
+ dasm_put(Dst, 3867, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM);
+ dasm_put(Dst, 3961, 1+1, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1);
+ dasm_put(Dst, 4044, LJ_TISNUM, 1+1, LJ_TISNUM, Dt8(->upvalue[0]), 2+1);
+ dasm_put(Dst, 4116, LJ_TISNUM, LJ_TISNUM, 2+1, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 4191, 1+1, LJ_TISNUM, 1+2);
+ dasm_put(Dst, 4321, 1+1, LJ_TISNUM, 1+2);
+ dasm_put(Dst, 4436, 2+1, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 4518, 2+1, LJ_TISNUM, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 4583, LJ_TISNUM, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 4680, 1+1, LJ_TSTR, Dt5(->len), 1+1, LJ_TSTR, Dt5(->len));
+ dasm_put(Dst, 4744, Dt5([1]), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), 1+1, LJ_TISNUM);
+ dasm_put(Dst, 4818, Dt1(->base), Dt1(->base), LJ_TSTR, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), 1+2, LJ_TISNUM);
+ dasm_put(Dst, 4921, LJ_TSTR, LJ_TISNUM, Dt5(->len), sizeof(GCstr)-1);
+ dasm_put(Dst, 5013);
+ dasm_put(Dst, 5083, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), 2+1, LJ_TSTR, LJ_TISNUM, Dt5(->len));
+ dasm_put(Dst, 5152, DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(tmpbuf.buf), 1+1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
+ dasm_put(Dst, 5217, LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf));
+ dasm_put(Dst, 5296, 1+1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf));
+ dasm_put(Dst, 5361, 1+1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
+ dasm_put(Dst, 5437, LJ_TSTR, Dt5(->len), DISPATCH_GL(tmpbuf.sz), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf));
+ dasm_put(Dst, 5518, 1+1, LJ_TTAB, 1+1, LJ_TISNUM);
+ dasm_put(Dst, 5617, 1+1, LJ_TISNUM, LJ_TISNUM, 1+1, LJ_TISNUM);
+ dasm_put(Dst, 5725, LJ_TISNUM, 1+1, LJ_TISNUM);
+ dasm_put(Dst, 5841, LJ_TISNUM, 1+1, LJ_TISNUM, 1+1);
+ dasm_put(Dst, 5933, LJ_TISNUM, 2+1, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 6018, 2+1, LJ_TISNUM, LJ_TISNUM, 2+1, LJ_TISNUM);
+ dasm_put(Dst, 6149, LJ_TISNUM, 2+1, LJ_TISNUM, LJ_TISNUM, 2+1);
+ dasm_put(Dst, 6280, LJ_TISNUM, LJ_TISNUM, 1+2, 1+1, Dt1(->base), 8*LUA_MINSTACK, Dt1(->top), Dt1(->maxstack));
+ dasm_put(Dst, 6391, Dt8(->f), Dt1(->base), Dt1(->top), Dt7(->pc), FRAME_TYPE, LUA_MINSTACK);
+ dasm_put(Dst, 6499, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), DISPATCH_GL(hookmask), HOOK_VMEVENT, HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount));
+ dasm_put(Dst, 6597, DISPATCH_GL(hookmask), HOOK_ACTIVE, DISPATCH_GL(hookmask), HOOK_ACTIVE, LUA_MASKLINE|LUA_MASKCOUNT, DISPATCH_GL(hookcount));
+ dasm_put(Dst, 6644, LUA_MASKLINE, Dt1(->base), Dt1(->base), GG_DISP2STATIC, Dt7(->pc), PC2PROTO(framesize), Dt1(->base), Dt1(->top), GG_DISP2J, DISPATCH_J(L));
+ dasm_put(Dst, 6751, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top), DISPATCH_GL(vmstate), DISPATCH_GL(vmstate), ~LJ_VMST_EXIT, DISPATCH_J(exitno), DISPATCH_J(parent), 8*8+16, DISPATCH_GL(jit_L), DISPATCH_GL(jit_base));
+ dasm_put(Dst, 6951, DISPATCH_J(L), DISPATCH_GL(jit_L), Dt1(->base), GG_DISP2J, Dt1(->cframe), CFRAME_RAWMASK, CFRAME_OFS_L, Dt1(->base), CFRAME_OFS_PC, Dt7(->pc), PC2PROTO(k), DISPATCH_GL(jit_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, BC_FUNCF);
+ dasm_put(Dst, 7048);
+ dasm_put(Dst, 7567);
+ dasm_put(Dst, 7695);
+ dasm_put(Dst, 7763);
+ dasm_put(Dst, 7891);
+ dasm_put(Dst, 7994);
+ dasm_put(Dst, 8117);
+ dasm_put(Dst, 8306);
+ dasm_put(Dst, 8407);
+ dasm_put(Dst, 8519);
+ dasm_put(Dst, 8596);
+#ifdef LUA_USE_ASSERT
+ dasm_put(Dst, 8713);
+#endif
+#define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V)
+ dasm_put(Dst, 8715, GG_G2DISP, Dt2(->ctype_state), DtE(->cb.slot), CFRAME_SIZE+16, DtE(->cb.gpr[0]), DtE(->cb.gpr[1]), DtE(->cb.stack), CFRAME_SIZE+12, CFRAME_SIZE+8, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top), Dt7(->pc), DISPATCH_GL(ctype_state), DtE(->L), Dt1(->base), Dt1(->top));
+#define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
+ dasm_put(Dst, 8846, DtE(->cb.gpr[0]), DtE(->cb.gpr[1]), DtE(->cb.gpr[2]), DtE(->cb.fpr[0].d), DtE(->cb.fpr[0].f), Dt1(->top), DtF(->spadj), DtF(->spadj), DtF(->nsp));
+ dasm_put(Dst, 8947, offsetof(CCallState, stack), DtF(->gpr[0]), DtF(->gpr[1]), DtF(->func), DtF(->gpr[0]), DtF(->gpr[1]), DtF(->resx87), DtF(->fpr[0].d[0]), DtF(->fpr[0].f[0]));
+ dasm_put(Dst, 9008, DtF(->spadj));
+}
+
+/* Generate the code for a single instruction. */
+static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+{
+ int vk = 0;
+ dasm_put(Dst, 470, defop);
+
+ switch (op) {
+
+ /* -- Comparison ops ---------------------------------------------------- */
+
+ /* Remember: all ops branch for a true comparison, fall through otherwise. */
+
+
+ case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
+ dasm_put(Dst, 9018, LJ_TISNUM, LJ_TISNUM);
+ switch (op) {
+ case BC_ISLT:
+ dasm_put(Dst, 9059);
+ break;
+ case BC_ISGE:
+ dasm_put(Dst, 9064);
+ break;
+ case BC_ISLE:
+ dasm_put(Dst, 5212);
+ break;
+ case BC_ISGT:
+ dasm_put(Dst, 9069);
+ break;
+ default: break; /* Shut up GCC. */
+ }
+ dasm_put(Dst, 9074, -BCBIAS_J*4);
+ break;
+
+ case BC_ISEQV: case BC_ISNEV:
+ vk = op == BC_ISEQV;
+ dasm_put(Dst, 9105);
+ if (vk) {
+ } else {
+ }
+ dasm_put(Dst, 9113, LJ_TISNUM, LJ_TISNUM);
+ iseqne_fp:
+ if (vk) {
+ dasm_put(Dst, 9149);
+ } else {
+ dasm_put(Dst, 9158);
+ }
+ iseqne_end:
+ if (vk) {
+ dasm_put(Dst, 9167, -BCBIAS_J*4);
+ } else {
+ dasm_put(Dst, 9182, -BCBIAS_J*4);
+ }
+ if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
+ op == BC_ISEQN || op == BC_ISNEN)) {
+ dasm_put(Dst, 9197);
+ } else {
+ dasm_put(Dst, 9086);
+ }
+ if (op == BC_ISEQV || op == BC_ISNEV) {
+ dasm_put(Dst, 9202, LJ_TCDATA, LJ_TCDATA, LJ_TISPRI, LJ_TISTABUD, Dt6(->metatable));
+ dasm_put(Dst, 9269, Dt6(->nomm), 1<<MM_eq);
+ if (vk) {
+ dasm_put(Dst, 9279);
+ } else {
+ dasm_put(Dst, 9283);
+ }
+ dasm_put(Dst, 9289);
+ } else {
+ dasm_put(Dst, 9294, LJ_TCDATA);
+ if (LJ_DUALNUM && vk) {
+ dasm_put(Dst, 9301);
+ } else {
+ dasm_put(Dst, 9274);
+ }
+ dasm_put(Dst, 9306);
+ }
+ break;
+ case BC_ISEQS: case BC_ISNES:
+ vk = op == BC_ISEQS;
+ dasm_put(Dst, 9311, LJ_TSTR);
+ iseqne_test:
+ if (vk) {
+ dasm_put(Dst, 9153);
+ } else {
+ dasm_put(Dst, 6639);
+ }
+ goto iseqne_end;
+ case BC_ISEQN: case BC_ISNEN:
+ vk = op == BC_ISEQN;
+ dasm_put(Dst, 9336);
+ if (vk) {
+ } else {
+ }
+ dasm_put(Dst, 9344, LJ_TISNUM);
+ goto iseqne_fp;
+ case BC_ISEQP: case BC_ISNEP:
+ vk = op == BC_ISEQP;
+ dasm_put(Dst, 9370);
+ if (!LJ_HASFFI) goto iseqne_test;
+ if (vk) {
+ dasm_put(Dst, 9383, -BCBIAS_J*4, LJ_TCDATA);
+ } else {
+ dasm_put(Dst, 9432, LJ_TCDATA, -BCBIAS_J*4);
+ }
+ break;
+
+ /* -- Unary test and copy ops ------------------------------------------- */
+
+ case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
+ dasm_put(Dst, 9475, LJ_TISTRUECOND);
+ if (op == BC_IST || op == BC_ISTC) {
+ dasm_put(Dst, 9069);
+ } else {
+ dasm_put(Dst, 5212);
+ }
+ if (op == BC_ISTC || op == BC_ISFC) {
+ dasm_put(Dst, 9487);
+ }
+ dasm_put(Dst, 9074, -BCBIAS_J*4);
+ break;
+
+ /* -- Unary ops --------------------------------------------------------- */
+
+ case BC_MOV:
+ dasm_put(Dst, 9498);
+ break;
+ case BC_NOT:
+ dasm_put(Dst, 9531, LJ_TISTRUECOND, LJ_TTRUE);
+ break;
+ case BC_UNM:
+ dasm_put(Dst, 9566, LJ_TISNUM);
+ break;
+ case BC_LEN:
+ dasm_put(Dst, 9603, LJ_TSTR, Dt5(->len), LJ_TTAB);
+#if LJ_52
+ dasm_put(Dst, 9658, Dt6(->metatable));
+#endif
+ dasm_put(Dst, 9672);
+#if LJ_52
+ dasm_put(Dst, 9699, Dt6(->nomm), 1<<MM_len);
+#endif
+ break;
+
+ /* -- Binary ops -------------------------------------------------------- */
+
+
+ case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9723, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 9742, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 9761, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 9581);
+ break;
+ case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9790, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 9809, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 9828, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 9581);
+ break;
+ case BC_MULVN: case BC_MULNV: case BC_MULVV:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9857, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 9876, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 9895, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 9581);
+ break;
+ case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9924, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 9943, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 9962, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 9581);
+ break;
+ case BC_MODVN:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9991, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 10010, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 10029, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 10058);
+ break;
+ case BC_MODNV: case BC_MODVV:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9991, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 10010, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 10029, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 10085);
+ break;
+ case BC_POW:
+ dasm_put(Dst, 9715);
+ vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ switch (vk) {
+ case 0:
+ dasm_put(Dst, 9991, LJ_TISNUM);
+ break;
+ case 1:
+ dasm_put(Dst, 10010, LJ_TISNUM);
+ break;
+ default:
+ dasm_put(Dst, 10029, LJ_TISNUM, LJ_TISNUM);
+ break;
+ }
+ dasm_put(Dst, 10090);
+ break;
+
+ case BC_CAT:
+ dasm_put(Dst, 10115, Dt1(->base), Dt1(->base));
+ break;
+
+ /* -- Constant ops ------------------------------------------------------ */
+
+ case BC_KSTR:
+ dasm_put(Dst, 10209, LJ_TSTR);
+ break;
+ case BC_KCDATA:
+ dasm_put(Dst, 10209, LJ_TCDATA);
+ break;
+ case BC_KSHORT:
+ dasm_put(Dst, 10242);
+ break;
+ case BC_KNUM:
+ dasm_put(Dst, 10268);
+ break;
+ case BC_KPRI:
+ dasm_put(Dst, 10293);
+ break;
+ case BC_KNIL:
+ dasm_put(Dst, 10319, LJ_TNIL);
+ break;
+
+ /* -- Upvalue and function ops ------------------------------------------ */
+
+ case BC_UGET:
+ dasm_put(Dst, 10365, offsetof(GCfuncL, uvptr), DtA(->v));
+ break;
+ case BC_USETV:
+#define TV2MARKOFS \
+ ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
+ dasm_put(Dst, 10409, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TNUMX - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
+ dasm_put(Dst, 10499);
+ break;
+#undef TV2MARKOFS
+ case BC_USETS:
+ dasm_put(Dst, 10511, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
+ break;
+ case BC_USETN:
+ dasm_put(Dst, 10602, offsetof(GCfuncL, uvptr), DtA(->v));
+ break;
+ case BC_USETP:
+ dasm_put(Dst, 10638, offsetof(GCfuncL, uvptr), DtA(->v));
+ break;
+ case BC_UCLO:
+ dasm_put(Dst, 10675, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
+ break;
+
+ case BC_FNEW:
+ dasm_put(Dst, 10729, Dt1(->base), Dt1(->base), LJ_TFUNC);
+ break;
+
+ /* -- Table ops --------------------------------------------------------- */
+
+ case BC_TNEW:
+ dasm_put(Dst, 10800, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
+ break;
+ case BC_TDUP:
+ dasm_put(Dst, 10926, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
+ break;
+
+ case BC_GGET:
+ dasm_put(Dst, 11018, Dt7(->env));
+ break;
+ case BC_GSET:
+ dasm_put(Dst, 11036, Dt7(->env));
+ break;
+
+ case BC_TGETV:
+ dasm_put(Dst, 11054, LJ_TTAB, LJ_TISNUM, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable));
+ dasm_put(Dst, 11172, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL, LJ_TSTR);
+ break;
+ case BC_TGETS:
+ dasm_put(Dst, 11220, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
+ dasm_put(Dst, 11308, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
+ break;
+ case BC_TGETB:
+ dasm_put(Dst, 11378, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
+ dasm_put(Dst, 11477, LJ_TNIL);
+ break;
+
+ case BC_TSETV:
+ dasm_put(Dst, 11494, LJ_TTAB, LJ_TISNUM, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK);
+ dasm_put(Dst, 11583, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK);
+ dasm_put(Dst, 11670, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ break;
+ case BC_TSETS:
+ dasm_put(Dst, 11689, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
+ dasm_put(Dst, 11764, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
+ dasm_put(Dst, 11856, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ break;
+ case BC_TSETB:
+ dasm_put(Dst, 11952, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
+ dasm_put(Dst, 12050, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ break;
+
+ case BC_TSETM:
+ dasm_put(Dst, 12096, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 12245, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ break;
+
+ /* -- Calls and vararg handling ----------------------------------------- */
+
+ case BC_CALL: case BC_CALLM:
+ dasm_put(Dst, 9719);
+ if (op == BC_CALLM) {
+ dasm_put(Dst, 12263);
+ }
+ dasm_put(Dst, 12268, LJ_TFUNC, Dt7(->pc));
+ break;
+
+ case BC_CALLMT:
+ dasm_put(Dst, 12263);
+ break;
+ case BC_CALLT:
+ dasm_put(Dst, 12309, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
+ dasm_put(Dst, 12427, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
+ break;
+
+ case BC_ITERC:
+ dasm_put(Dst, 12495, LJ_TFUNC, 2+1, Dt7(->pc));
+ break;
+
+ case BC_ITERN:
+ dasm_put(Dst, 12575, Dt6(->asize), Dt6(->array), LJ_TNIL, -BCBIAS_J*4, Dt6(->hmask), sizeof(Node));
+ dasm_put(Dst, 12723, Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key.gcr), DtB(->key.it), DtB(->val.gcr), DtB(->val.it));
+ break;
+
+ case BC_ISNEXT:
+ dasm_put(Dst, 12784, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC);
+ break;
+
+ case BC_VARG:
+ dasm_put(Dst, 12895, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
+ dasm_put(Dst, 13059, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
+ break;
+
+ /* -- Returns ----------------------------------------------------------- */
+
+ case BC_RETM:
+ dasm_put(Dst, 12263);
+ break;
+
+ case BC_RET: case BC_RET0: case BC_RET1:
+ if (op != BC_RET0) {
+ dasm_put(Dst, 13130);
+ }
+ dasm_put(Dst, 13134, FRAME_TYPE);
+ switch (op) {
+ case BC_RET:
+ dasm_put(Dst, 13153);
+ break;
+ case BC_RET1:
+ dasm_put(Dst, 13211);
+ /* fallthrough */
+ case BC_RET0:
+ dasm_put(Dst, 13227);
+ default:
+ break;
+ }
+ dasm_put(Dst, 13238, Dt7(->pc), PC2PROTO(k));
+ if (op == BC_RET) {
+ dasm_put(Dst, 13280, LJ_TNIL);
+ } else {
+ dasm_put(Dst, 13289, LJ_TNIL);
+ }
+ dasm_put(Dst, 13296, -FRAME_VARG, FRAME_TYPEP);
+ if (op != BC_RET0) {
+ dasm_put(Dst, 13320);
+ }
+ dasm_put(Dst, 9694);
+ break;
+
+ /* -- Loops and branches ------------------------------------------------ */
+
+
+ case BC_FORL:
+ dasm_put(Dst, 13324, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ break;
+
+ case BC_JFORI:
+ case BC_JFORL:
+#if !LJ_HASJIT
+ break;
+#endif
+ case BC_FORI:
+ case BC_IFORL:
+ vk = (op == BC_IFORL || op == BC_JFORL);
+ dasm_put(Dst, 13345);
+ if (LJ_DUALNUM) {
+ dasm_put(Dst, 13349, LJ_TISNUM);
+ if (!vk) {
+ dasm_put(Dst, 13359, LJ_TISNUM, LJ_TISNUM);
+ } else {
+#ifdef LUA_USE_ASSERT
+ dasm_put(Dst, 13388, LJ_TISNUM, LJ_TISNUM);
+#endif
+ dasm_put(Dst, 13407);
+ }
+ dasm_put(Dst, 13426, LJ_TISNUM);
+ if (op == BC_FORI) {
+ dasm_put(Dst, 13437, -BCBIAS_J*4);
+ } else if (op == BC_JFORI) {
+ dasm_put(Dst, 13451, -BCBIAS_J*4, BC_JLOOP);
+ } else if (op == BC_IFORL) {
+ dasm_put(Dst, 13469, -BCBIAS_J*4);
+ } else {
+ dasm_put(Dst, 13461, BC_JLOOP);
+ }
+ dasm_put(Dst, 13483);
+ if (vk) {
+ dasm_put(Dst, 13506);
+ }
+ dasm_put(Dst, 13426, LJ_TISNUM);
+ if (op == BC_FORI) {
+ dasm_put(Dst, 13515);
+ } else if (op == BC_JFORI) {
+ dasm_put(Dst, 13520, -BCBIAS_J*4, BC_JLOOP);
+ } else if (op == BC_IFORL) {
+ dasm_put(Dst, 13534);
+ } else {
+ dasm_put(Dst, 13530, BC_JLOOP);
+ }
+ dasm_put(Dst, 13539);
+ } else if (!vk) {
+ dasm_put(Dst, 13546, LJ_TISNUM);
+ }
+ if (!vk) {
+ dasm_put(Dst, 13552, LJ_TISNUM);
+ } else {
+#ifdef LUA_USE_ASSERT
+ dasm_put(Dst, 13566, LJ_TISNUM, LJ_TISNUM);
+#endif
+ }
+ dasm_put(Dst, 13585);
+ if (!vk) {
+ dasm_put(Dst, 13589, LJ_TISNUM);
+ }
+ if (vk) {
+ } else {
+ }
+ dasm_put(Dst, 13598);
+ if (vk) {
+ dasm_put(Dst, 13604);
+ } else {
+ dasm_put(Dst, 13620);
+ }
+ dasm_put(Dst, 13628);
+ if (op == BC_FORI) {
+ dasm_put(Dst, 13638, -BCBIAS_J*4);
+ } else if (op == BC_JFORI) {
+ dasm_put(Dst, 13648, -BCBIAS_J*4, BC_JLOOP);
+ } else if (op == BC_IFORL) {
+ dasm_put(Dst, 13662, -BCBIAS_J*4);
+ } else {
+ dasm_put(Dst, 13658, BC_JLOOP);
+ }
+ dasm_put(Dst, 9454);
+ break;
+
+ case BC_ITERL:
+ dasm_put(Dst, 13324, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ break;
+
+ case BC_JITERL:
+#if !LJ_HASJIT
+ break;
+#endif
+ case BC_IITERL:
+ dasm_put(Dst, 13672, LJ_TNIL);
+ if (op == BC_JITERL) {
+ dasm_put(Dst, 13687, BC_JLOOP);
+ } else {
+ dasm_put(Dst, 13701, -BCBIAS_J*4);
+ }
+ dasm_put(Dst, 9084);
+ break;
+
+ case BC_LOOP:
+ dasm_put(Dst, 13324, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ break;
+
+ case BC_ILOOP:
+ dasm_put(Dst, 9086);
+ break;
+
+ case BC_JLOOP:
+ dasm_put(Dst, 13717, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
+ break;
+
+ case BC_JMP:
+ dasm_put(Dst, 13740, -BCBIAS_J*4);
+ break;
+
+ /* -- Function headers -------------------------------------------------- */
+
+ /*
+ ** Reminder: A function may be called with func/args above L->maxstack,
+ ** i.e. occupying EXTRA_STACK slots. And vmeta_call may add one extra slot,
+ ** too. This means all FUNC* ops (including fast functions) must check
+ ** for stack overflow _before_ adding more slots!
+ */
+
+ case BC_FUNCF:
+ dasm_put(Dst, 13764, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
+ case BC_FUNCV: /* NYI: compiled vararg functions. */
+ break;
+
+ case BC_JFUNCF:
+#if !LJ_HASJIT
+ break;
+#endif
+ case BC_IFUNCF:
+ dasm_put(Dst, 13785, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
+ if (op == BC_JFUNCF) {
+ dasm_put(Dst, 13815, BC_JLOOP);
+ } else {
+ dasm_put(Dst, 9086);
+ }
+ dasm_put(Dst, 13824, LJ_TNIL);
+ break;
+
+ case BC_JFUNCV:
+#if !LJ_HASJIT
+ break;
+#endif
+ dasm_put(Dst, 8713);
+ break; /* NYI: compiled vararg functions. */
+
+ case BC_IFUNCV:
+ dasm_put(Dst, 13846, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
+ if (op == BC_JFUNCV) {
+ dasm_put(Dst, 13815, BC_JLOOP);
+ } else {
+ dasm_put(Dst, 13937, -4+PC2PROTO(k));
+ }
+ dasm_put(Dst, 13959, LJ_TNIL);
+ break;
+
+ case BC_FUNCC:
+ case BC_FUNCCW:
+ dasm_put(Dst, 13981, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
+ if (op == BC_FUNCC) {
+ dasm_put(Dst, 14010);
+ } else {
+ dasm_put(Dst, 14014);
+ }
+ dasm_put(Dst, 14022, DISPATCH_GL(vmstate), ~LJ_VMST_C);
+ if (op == BC_FUNCC) {
+ dasm_put(Dst, 14031);
+ } else {
+ dasm_put(Dst, 14035, DISPATCH_GL(wrapf));
+ }
+ dasm_put(Dst, 14040, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
+ break;
+
+ /* ---------------------------------------------------------------------- */
+
+ default:
+ fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]);
+ exit(2);
+ break;
+ }
+}
+
+static int build_backend(BuildCtx *ctx)
+{
+ int op;
+ dasm_growpc(Dst, BC__MAX);
+ build_subroutines(ctx);
+ dasm_put(Dst, 14065);
+ for (op = 0; op < BC__MAX; op++)
+ build_ins(ctx, (BCOp)op, op);
+ return BC__MAX;
+}
+
+/* Emit pseudo frame-info for all assembler functions. */
+static void emit_asm_debug(BuildCtx *ctx)
+{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
+#if LJ_64
+#define SZPTR "8"
+#define BSZPTR "3"
+#define REG_SP "0x7"
+#define REG_RA "0x10"
+#else
+#define SZPTR "4"
+#define BSZPTR "2"
+#define REG_SP "0x4"
+#define REG_RA "0x8"
+#endif
+ switch (ctx->mode) {
+ case BUILD_elfasm:
+ fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n");
+ fprintf(ctx->fp,
+ ".Lframe0:\n"
+ "\t.long .LECIE0-.LSCIE0\n"
+ ".LSCIE0:\n"
+ "\t.long 0xffffffff\n"
+ "\t.byte 0x1\n"
+ "\t.string \"\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE0:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE0:\n"
+ "\t.long .LEFDE0-.LASFDE0\n"
+ ".LASFDE0:\n"
+ "\t.long .Lframe0\n"
+#if LJ_64
+ "\t.quad .Lbegin\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
+#if LJ_NO_UNWIND
+ "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
+ "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
+#endif
+#else
+ "\t.long .Lbegin\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+#if LJ_64
+ "\t.quad lj_vm_ffi_call\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
+#if !LJ_NO_UNWIND
+#if (defined(__sun__) && defined(__svr4__))
+#if LJ_64
+ fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
+#else
+ fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
+#endif
+#else
+ fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
+#endif
+ fprintf(ctx->fp,
+ ".Lframe1:\n"
+ "\t.long .LECIE1-.LSCIE1\n"
+ ".LSCIE1:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zPR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.uleb128 6\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.long lj_err_unwind_dwarf-.\n"
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE1:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
+ "\t.long .Lbegin-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
+#if LJ_64
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
+#else
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
+#endif
+ break;
+#if !LJ_NO_UNWIND
+ /* Mental note: never let Apple design an assembler.
+ ** Or a linker. Or a plastic case. But I digress.
+ */
+ case BUILD_machasm: {
+#if LJ_HASFFI
+ int fcsize = 0;
+#endif
+ int i;
+ fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
+ fprintf(ctx->fp,
+ "EH_frame1:\n"
+ "\t.set L$set$x,LECIEX-LSCIEX\n"
+ "\t.long L$set$x\n"
+ "LSCIEX:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.ascii \"zPR\\0\"\n"
+ "\t.byte 0x1\n"
+ "\t.byte 128-" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 6\n" /* augmentation length */
+ "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */
+#if LJ_64
+ "\t.long _lj_err_unwind_dwarf+4@GOTPCREL\n"
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
+#else
+ "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n"
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */
+#endif
+ "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
+ "\t.align " BSZPTR "\n"
+ "LECIEX:\n\n");
+ for (i = 0; i < ctx->nsym; i++) {
+ const char *name = ctx->sym[i].name;
+ int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
+ if (size == 0) continue;
+#if LJ_HASFFI
+ if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
+#endif
+ fprintf(ctx->fp,
+ "%s.eh:\n"
+ "LSFDE%d:\n"
+ "\t.set L$set$%d,LEFDE%d-LASFDE%d\n"
+ "\t.long L$set$%d\n"
+ "LASFDE%d:\n"
+ "\t.long LASFDE%d-EH_frame1\n"
+ "\t.long %s-.\n"
+ "\t.long %d\n"
+ "\t.byte 0\n" /* augmentation length */
+ "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
+#if LJ_64
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
+#else
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
+#endif
+ "\t.align " BSZPTR "\n"
+ "LEFDE%d:\n\n",
+ name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
+ }
+#if LJ_HASFFI
+ if (fcsize) {
+ fprintf(ctx->fp,
+ "EH_frame2:\n"
+ "\t.set L$set$y,LECIEY-LSCIEY\n"
+ "\t.long L$set$y\n"
+ "LSCIEY:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.ascii \"zR\\0\"\n"
+ "\t.byte 0x1\n"
+ "\t.byte 128-" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 1\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
+#else
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
+#endif
+ "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
+ "\t.align " BSZPTR "\n"
+ "LECIEY:\n\n");
+ fprintf(ctx->fp,
+ "_lj_vm_ffi_call.eh:\n"
+ "LSFDEY:\n"
+ "\t.set L$set$yy,LEFDEY-LASFDEY\n"
+ "\t.long L$set$yy\n"
+ "LASFDEY:\n"
+ "\t.long LASFDEY-EH_frame2\n"
+ "\t.long _lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.byte 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.byte 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0xd\n\t.byte 0x4\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
+#endif
+ "\t.align " BSZPTR "\n"
+ "LEFDEY:\n\n", fcsize);
+ }
+#endif
+#if LJ_64
+ fprintf(ctx->fp, "\t.subsections_via_symbols\n");
+#else
+ fprintf(ctx->fp,
+ "\t.non_lazy_symbol_pointer\n"
+ "L_lj_err_unwind_dwarf$non_lazy_ptr:\n"
+ ".indirect_symbol _lj_err_unwind_dwarf\n"
+ ".long 0\n");
+#endif
+ }
+ break;
+#endif
+ default: /* Difficult for other modes. */
+ break;
+ }
+}
+
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/.gitignore b/src/3rdparty/LuaJIT-2.0.5/src/host/.gitignore
index 762ac2a..762ac2a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/.gitignore
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/.gitignore
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/README b/src/3rdparty/LuaJIT-2.0.5/src/host/README
index abfcdaa..abfcdaa 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/README
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/README
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm.c b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm.c
index b9560f3..b9560f3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm.h b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm.h
index e6dd3dc..e6dd3dc 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_asm.c b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_asm.c
index 81a3969..81a3969 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_asm.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_asm.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_fold.c b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_fold.c
index d579f4d..d579f4d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_fold.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_fold.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_lib.c b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_lib.c
index 569e2ca..569e2ca 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_lib.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_lib.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_peobj.c b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_peobj.c
index aab00d6..aab00d6 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/buildvm_peobj.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/buildvm_peobj.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/genminilua.lua b/src/3rdparty/LuaJIT-2.0.5/src/host/genminilua.lua
index 50feff0..50feff0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/genminilua.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/genminilua.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/host/minilua.c b/src/3rdparty/LuaJIT-2.0.5/src/host/minilua.c
index 7915028..7915028 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/host/minilua.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/host/minilua.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/.gitignore b/src/3rdparty/LuaJIT-2.0.5/src/jit/.gitignore
index 500e285..500e285 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/.gitignore
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/.gitignore
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/bc.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/bc.lua
index a2f84aa..a2f84aa 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/bc.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/bc.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/bcsave.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/bcsave.lua
index c94064e..c94064e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/bcsave.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/bcsave.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_arm.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_arm.lua
index 91ebb7d..91ebb7d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_arm.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_arm.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_mips.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_mips.lua
index 02dfc17..02dfc17 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_mips.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_mips.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_mipsel.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_mipsel.lua
index c9c2e24..c9c2e24 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_mipsel.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_mipsel.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_ppc.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_ppc.lua
index 4043aeb..4043aeb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_ppc.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_ppc.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_x64.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_x64.lua
index 0891803..0891803 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_x64.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_x64.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_x86.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_x86.lua
index 74d0f52..74d0f52 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dis_x86.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dis_x86.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dump.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/dump.lua
index 666ba43..666ba43 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/dump.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/dump.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/jit/v.lua b/src/3rdparty/LuaJIT-2.0.5/src/jit/v.lua
index 47ee394..47ee394 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/jit/v.lua
+++ b/src/3rdparty/LuaJIT-2.0.5/src/jit/v.lua
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lauxlib.h b/src/3rdparty/LuaJIT-2.0.5/src/lauxlib.h
index fed1491..fed1491 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lauxlib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lauxlib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_aux.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_aux.c
index 7af1cd4..7af1cd4 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_aux.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_aux.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_base.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_base.c
index 162bbbb..162bbbb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_base.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_base.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_bit.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_bit.c
index 6dffdfa..6dffdfa 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_bit.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_bit.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_debug.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_debug.c
index 54c3b7e..54c3b7e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_debug.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_debug.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_ffi.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_ffi.c
index 83483d9..83483d9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_ffi.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_ffi.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_init.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_init.c
index 2ed370e..2ed370e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_init.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_init.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_io.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_io.c
index 9cdcfcf..9cdcfcf 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_io.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_io.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_jit.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_jit.c
index d2fcf21..d2fcf21 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_jit.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_jit.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_math.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_math.c
index 4c708a4..4c708a4 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_math.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_math.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_os.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_os.c
index 8c96b86..8c96b86 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_os.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_os.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_package.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_package.c
index 01b63d6..01b63d6 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_package.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_package.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_string.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_string.c
index c1e595c..c1e595c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_string.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_string.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lib_table.c b/src/3rdparty/LuaJIT-2.0.5/src/lib_table.c
index b2856ee..b2856ee 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lib_table.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lib_table.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj.supp b/src/3rdparty/LuaJIT-2.0.5/src/lj.supp
index 217f7c8..217f7c8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj.supp
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj.supp
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_alloc.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_alloc.c
index dc64dca..dc64dca 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_alloc.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_alloc.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_alloc.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_alloc.h
index f87a7cf..f87a7cf 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_alloc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_alloc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_api.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_api.c
index 7b0b3f9..7b0b3f9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_api.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_api.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_arch.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_arch.h
index 5f7e445..5f7e445 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_arch.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_arch.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm.c
index dd7186f..dd7186f 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm.h
index 2819481..2819481 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_arm.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_arm.h
index 961f7e3..961f7e3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_mips.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_mips.h
index 7631190..7631190 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_ppc.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_ppc.h
index d8a14c8..d8a14c8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_x86.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_x86.h
index 10468bb..10468bb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_asm_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_asm_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bc.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_bc.c
index a597692..a597692 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bc.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_bc.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bc.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_bc.h
index 108c10f..108c10f 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_bc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bcdump.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_bcdump.h
index ba53c0a..ba53c0a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bcdump.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_bcdump.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bcread.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_bcread.c
index 6a462bd..6a462bd 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bcread.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_bcread.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bcwrite.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_bcwrite.c
index fae1ebb..fae1ebb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_bcwrite.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_bcwrite.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_carith.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_carith.c
index c34596c..c34596c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_carith.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_carith.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_carith.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_carith.h
index 82fc824..82fc824 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_carith.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_carith.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccall.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccall.c
index 65076e7..65076e7 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccall.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccall.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccall.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccall.h
index 9089e6c..9089e6c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccall.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccall.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccallback.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccallback.c
index 06a7401..06a7401 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccallback.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccallback.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccallback.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccallback.h
index a8cdad3..a8cdad3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ccallback.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ccallback.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cconv.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_cconv.c
index ab398ad..ab398ad 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cconv.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_cconv.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cconv.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_cconv.h
index 0a0b66c..0a0b66c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cconv.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_cconv.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cdata.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_cdata.c
index 49b1aa5..49b1aa5 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cdata.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_cdata.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cdata.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_cdata.h
index 4bb65db..4bb65db 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cdata.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_cdata.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_char.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_char.c
index 11f23ef..11f23ef 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_char.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_char.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_char.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_char.h
index c3c86d3..c3c86d3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_char.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_char.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_clib.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_clib.c
index 8dc3c10..8dc3c10 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_clib.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_clib.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_clib.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_clib.h
index fcc9dac..fcc9dac 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_clib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_clib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cparse.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_cparse.c
index f111537..f111537 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cparse.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_cparse.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cparse.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_cparse.h
index bad1060..bad1060 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_cparse.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_cparse.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_crecord.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_crecord.c
index bc88d63..bc88d63 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_crecord.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_crecord.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_crecord.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_crecord.h
index 8e0afd1..8e0afd1 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_crecord.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_crecord.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ctype.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_ctype.c
index 9417500..9417500 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ctype.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ctype.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ctype.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ctype.h
index 2aefd3b..2aefd3b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ctype.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ctype.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_debug.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_debug.c
index a684302..a684302 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_debug.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_debug.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_debug.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_debug.h
index d10d0da..d10d0da 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_debug.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_debug.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_def.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_def.h
index 21cc59a..21cc59a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_def.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_def.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_dispatch.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_dispatch.c
index 627379a..627379a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_dispatch.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_dispatch.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_dispatch.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_dispatch.h
index e46a0ee..e46a0ee 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_dispatch.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_dispatch.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_arm.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_arm.h
index 285c98d..285c98d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_mips.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_mips.h
index ed62608..ed62608 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_ppc.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_ppc.h
index 1409930..1409930 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_x86.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_x86.h
index 9c371a9..9c371a9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_emit_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_emit_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_err.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_err.c
index 13a1ded..13a1ded 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_err.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_err.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_err.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_err.h
index cba5fb7..cba5fb7 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_err.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_err.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_errmsg.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_errmsg.h
index ac552f4..ac552f4 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_errmsg.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_errmsg.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ff.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ff.h
index 31d65a0..31d65a0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ff.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ff.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ffrecord.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_ffrecord.c
index da09dca..da09dca 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ffrecord.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ffrecord.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ffrecord.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ffrecord.h
index 3b40745..3b40745 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ffrecord.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ffrecord.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_frame.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_frame.h
index eb5df30..eb5df30 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_frame.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_frame.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_func.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_func.c
index 639dad8..639dad8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_func.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_func.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_func.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_func.h
index 901751b..901751b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_func.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_func.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gc.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_gc.c
index a5d32ea..a5d32ea 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gc.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_gc.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gc.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_gc.h
index 57ac714..57ac714 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_gc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gdbjit.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_gdbjit.c
index eeb017b..eeb017b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gdbjit.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_gdbjit.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gdbjit.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_gdbjit.h
index bbaa156..bbaa156 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_gdbjit.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_gdbjit.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ir.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_ir.c
index 1e4860d..1e4860d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ir.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ir.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ir.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ir.h
index ded3e0e..ded3e0e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ir.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ir.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ircall.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_ircall.h
index 44afde3..44afde3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_ircall.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_ircall.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_iropt.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_iropt.h
index b5081e0..b5081e0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_iropt.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_iropt.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_jit.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_jit.h
index 3f38d28..3f38d28 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_jit.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_jit.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lex.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_lex.c
index 3660316..3660316 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lex.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_lex.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lex.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_lex.h
index 41c03f9..41c03f9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lex.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_lex.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lib.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_lib.c
index a1bb6a2..a1bb6a2 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lib.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_lib.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lib.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_lib.h
index aa87407..aa87407 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_lib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_lib.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_load.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_load.c
index 20be8eb..20be8eb 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_load.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_load.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_mcode.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_mcode.c
index 5ea89f6..5ea89f6 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_mcode.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_mcode.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_mcode.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_mcode.h
index f0847e9..f0847e9 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_mcode.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_mcode.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_meta.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_meta.c
index 10e3498..10e3498 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_meta.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_meta.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_meta.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_meta.h
index e061d99..e061d99 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_meta.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_meta.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_obj.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_obj.c
index 4779d26..4779d26 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_obj.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_obj.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_obj.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_obj.h
index 2ee526c..2ee526c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_obj.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_obj.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_dce.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_dce.c
index 2417f32..2417f32 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_dce.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_dce.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_fold.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_fold.c
index 5dc7ae3..5dc7ae3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_fold.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_fold.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_loop.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_loop.c
index 36317b3..36317b3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_loop.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_loop.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_mem.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_mem.c
index 9f71405..9f71405 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_mem.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_mem.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_narrow.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_narrow.c
index 7336595..7336595 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_narrow.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_narrow.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_sink.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_sink.c
index 4efe395..4efe395 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_sink.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_sink.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_split.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_split.c
index 8d7cd4c..8d7cd4c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_opt_split.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_opt_split.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_parse.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_parse.c
index 6785495..6785495 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_parse.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_parse.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_parse.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_parse.h
index ceeab69..ceeab69 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_parse.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_parse.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_record.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_record.c
index bc4e8a6..bc4e8a6 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_record.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_record.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_record.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_record.h
index 2bbbde5..2bbbde5 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_record.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_record.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_snap.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_snap.c
index e891f7a..e891f7a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_snap.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_snap.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_snap.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_snap.h
index 2c9ae3d..2c9ae3d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_snap.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_snap.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_state.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_state.c
index f891351..f891351 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_state.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_state.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_state.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_state.h
index d5b476b..d5b476b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_state.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_state.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_str.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_str.c
index aae6ec5..aae6ec5 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_str.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_str.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_str.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_str.h
index be04a97..be04a97 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_str.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_str.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_strscan.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_strscan.c
index f1e34a3..f1e34a3 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_strscan.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_strscan.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_strscan.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_strscan.h
index 6fb0dda..6fb0dda 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_strscan.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_strscan.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_tab.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_tab.c
index f2f3c0b..f2f3c0b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_tab.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_tab.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_tab.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_tab.h
index 36ce7cd..36ce7cd 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_tab.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_tab.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_target.h
index 53bfa6b..53bfa6b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_target.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_arm.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_arm.h
index d02cbf8..d02cbf8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_arm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_arm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_mips.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_mips.h
index bed174b..bed174b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_mips.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_mips.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_ppc.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_ppc.h
index e57e27d..e57e27d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_ppc.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_ppc.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_x86.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_x86.h
index 4426cc8..4426cc8 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_target_x86.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_target_x86.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_trace.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_trace.c
index 6f8dc1a..6f8dc1a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_trace.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_trace.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_trace.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_trace.h
index edc7af0..edc7af0 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_trace.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_trace.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_traceerr.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_traceerr.h
index f920e5e..f920e5e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_traceerr.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_traceerr.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_udata.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_udata.c
index bd0321b..bd0321b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_udata.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_udata.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_udata.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_udata.h
index f271a42..f271a42 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_udata.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_udata.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vm.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_vm.h
index 3ffa76b..3ffa76b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vm.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_vm.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vmevent.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_vmevent.c
index 7b6d7bf..7b6d7bf 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vmevent.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_vmevent.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vmevent.h b/src/3rdparty/LuaJIT-2.0.5/src/lj_vmevent.h
index 050fb4d..050fb4d 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vmevent.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_vmevent.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vmmath.c b/src/3rdparty/LuaJIT-2.0.5/src/lj_vmmath.c
index 73fc667..73fc667 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lj_vmmath.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lj_vmmath.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/ljamalg.c b/src/3rdparty/LuaJIT-2.0.5/src/ljamalg.c
index 654fe82..654fe82 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/ljamalg.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/ljamalg.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lua.h b/src/3rdparty/LuaJIT-2.0.5/src/lua.h
index c83fd3b..c83fd3b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lua.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lua.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lua.hpp b/src/3rdparty/LuaJIT-2.0.5/src/lua.hpp
index 07e9002..07e9002 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lua.hpp
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lua.hpp
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/lua51.dll b/src/3rdparty/LuaJIT-2.0.5/src/lua51.dll
new file mode 100644
index 0000000..c9edadf
--- /dev/null
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lua51.dll
Binary files differ
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib b/src/3rdparty/LuaJIT-2.0.5/src/lua51.lib
index 36f6e7c..36f6e7c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lua51.lib
Binary files differ
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/luaconf.h b/src/3rdparty/LuaJIT-2.0.5/src/luaconf.h
index b33e91b..b33e91b 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/luaconf.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/luaconf.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/luajit.c b/src/3rdparty/LuaJIT-2.0.5/src/luajit.c
index 9ede59c..9ede59c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/luajit.c
+++ b/src/3rdparty/LuaJIT-2.0.5/src/luajit.c
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/luajit.h b/src/3rdparty/LuaJIT-2.0.5/src/luajit.h
index c5ff3ac..c5ff3ac 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/luajit.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/luajit.h
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lualib.h b/src/3rdparty/LuaJIT-2.0.5/src/lualib.h
index bfc130a..bfc130a 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/lualib.h
+++ b/src/3rdparty/LuaJIT-2.0.5/src/lualib.h
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib b/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib
new file mode 100644
index 0000000..e2b3ac3
--- /dev/null
+++ b/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib
Binary files differ
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/msvcbuild.bat b/src/3rdparty/LuaJIT-2.0.5/src/msvcbuild.bat
index 42e3652..42e3652 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/msvcbuild.bat
+++ b/src/3rdparty/LuaJIT-2.0.5/src/msvcbuild.bat
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/ps4build.bat b/src/3rdparty/LuaJIT-2.0.5/src/ps4build.bat
index bcfc0d5..bcfc0d5 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/ps4build.bat
+++ b/src/3rdparty/LuaJIT-2.0.5/src/ps4build.bat
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/psvitabuild.bat b/src/3rdparty/LuaJIT-2.0.5/src/psvitabuild.bat
index 515f354..515f354 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/psvitabuild.bat
+++ b/src/3rdparty/LuaJIT-2.0.5/src/psvitabuild.bat
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/vm_arm.dasc b/src/3rdparty/LuaJIT-2.0.5/src/vm_arm.dasc
index be5540c..be5540c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/vm_arm.dasc
+++ b/src/3rdparty/LuaJIT-2.0.5/src/vm_arm.dasc
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/vm_mips.dasc b/src/3rdparty/LuaJIT-2.0.5/src/vm_mips.dasc
index 3f9c98c..3f9c98c 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/vm_mips.dasc
+++ b/src/3rdparty/LuaJIT-2.0.5/src/vm_mips.dasc
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/vm_ppc.dasc b/src/3rdparty/LuaJIT-2.0.5/src/vm_ppc.dasc
index 91f5003..91f5003 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/vm_ppc.dasc
+++ b/src/3rdparty/LuaJIT-2.0.5/src/vm_ppc.dasc
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/vm_ppcspe.dasc b/src/3rdparty/LuaJIT-2.0.5/src/vm_ppcspe.dasc
index 2a57a41..2a57a41 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/vm_ppcspe.dasc
+++ b/src/3rdparty/LuaJIT-2.0.5/src/vm_ppcspe.dasc
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/vm_x86.dasc b/src/3rdparty/LuaJIT-2.0.5/src/vm_x86.dasc
index 359ad4f..359ad4f 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/vm_x86.dasc
+++ b/src/3rdparty/LuaJIT-2.0.5/src/vm_x86.dasc
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/vmdef.lua b/src/3rdparty/LuaJIT-2.0.5/src/vmdef.lua
new file mode 100644
index 0000000..cf85780
--- /dev/null
+++ b/src/3rdparty/LuaJIT-2.0.5/src/vmdef.lua
@@ -0,0 +1,331 @@
+-- This is a generated file. DO NOT EDIT!
+
+module(...)
+
+bcnames = "ISLT ISGE ISLE ISGT ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC ISFC IST ISF MOV NOT UNM LEN ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW CAT KSTR KCDATAKSHORTKNUM KPRI KNIL UGET USETV USETS USETN USETP UCLO FNEW TNEW TDUP GGET GSET TGETV TGETS TGETB TSETV TSETS TSETB TSETM CALLM CALL CALLMTCALLT ITERC ITERN VARG ISNEXTRETM RET RET0 RET1 FORI JFORI FORL IFORL JFORL ITERL IITERLJITERLLOOP ILOOP JLOOP JMP FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW"
+
+irnames = "LT GE LE GT ULT UGE ULE UGT EQ NE ABC RETF NOP BASE PVAL GCSTEPHIOP LOOP USE PHI RENAMEKPRI KINT KGC KPTR KKPTR KNULL KNUM KINT64KSLOT BNOT BSWAP BAND BOR BXOR BSHL BSHR BSAR BROL BROR ADD SUB MUL DIV MOD POW NEG ABS ATAN2 LDEXP MIN MAX FPMATHADDOV SUBOV MULOV AREF HREFK HREF NEWREFUREFO UREFC FREF STRREFALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW XSNEW TNEW TDUP CNEW CNEWI TBAR OBAR XBAR CONV TOBIT TOSTR STRTO CALLN CALLL CALLS CALLXSCARG "
+
+irfpm = { [0]="floor", "ceil", "trunc", "sqrt", "exp", "exp2", "log", "log2", "log10", "sin", "cos", "tan", "other", }
+
+irfield = { [0]="str.len", "func.env", "func.pc", "tab.meta", "tab.array", "tab.node", "tab.asize", "tab.hmask", "tab.nomm", "udata.meta", "udata.udtype", "udata.file", "cdata.ctypeid", "cdata.ptr", "cdata.int", "cdata.int64", "cdata.int64_4", }
+
+ircall = {
+[0]="lj_str_cmp",
+"lj_str_new",
+"lj_strscan_num",
+"lj_str_fromint",
+"lj_str_fromnum",
+"lj_tab_new1",
+"lj_tab_dup",
+"lj_tab_newkey",
+"lj_tab_len",
+"lj_gc_step_jit",
+"lj_gc_barrieruv",
+"lj_mem_newgco",
+"lj_math_random_step",
+"lj_vm_modi",
+"sinh",
+"cosh",
+"tanh",
+"fputc",
+"fwrite",
+"fflush",
+"lj_vm_floor",
+"lj_vm_ceil",
+"lj_vm_trunc",
+"sqrt",
+"exp",
+"lj_vm_exp2",
+"log",
+"lj_vm_log2",
+"log10",
+"sin",
+"cos",
+"tan",
+"lj_vm_powi",
+"pow",
+"atan2",
+"ldexp",
+"lj_vm_tobit",
+"softfp_add",
+"softfp_sub",
+"softfp_mul",
+"softfp_div",
+"softfp_cmp",
+"softfp_i2d",
+"softfp_d2i",
+"softfp_ui2d",
+"softfp_f2d",
+"softfp_d2ui",
+"softfp_d2f",
+"softfp_i2f",
+"softfp_ui2f",
+"softfp_f2i",
+"softfp_f2ui",
+"fp64_l2d",
+"fp64_ul2d",
+"fp64_l2f",
+"fp64_ul2f",
+"fp64_d2l",
+"fp64_d2ul",
+"fp64_f2l",
+"fp64_f2ul",
+"lj_carith_divi64",
+"lj_carith_divu64",
+"lj_carith_modi64",
+"lj_carith_modu64",
+"lj_carith_powi64",
+"lj_carith_powu64",
+"lj_cdata_setfin",
+"strlen",
+"memcpy",
+"memset",
+"lj_vm_errno",
+"lj_carith_mul64",
+}
+
+traceerr = {
+[0]="error thrown or hook called during recording",
+"trace too long",
+"trace too deep",
+"too many snapshots",
+"blacklisted",
+"NYI: bytecode %d",
+"leaving loop in root trace",
+"inner loop in root trace",
+"loop unroll limit reached",
+"bad argument type",
+"JIT compilation disabled for function",
+"call unroll limit reached",
+"down-recursion, restarting",
+"NYI: C function %s",
+"NYI: FastFunc %s",
+"NYI: unsupported variant of FastFunc %s",
+"NYI: return to lower frame",
+"store with nil or NaN key",
+"missing metamethod",
+"looping index lookup",
+"NYI: mixed sparse/dense table",
+"symbol not in cache",
+"NYI: unsupported C type conversion",
+"NYI: unsupported C function type",
+"guard would always fail",
+"too many PHIs",
+"persistent type instability",
+"failed to allocate mcode memory",
+"machine code too long",
+"hit mcode limit (retrying)",
+"too many spill slots",
+"inconsistent register allocation",
+"NYI: cannot assemble IR instruction %d",
+"NYI: PHI shuffling too complex",
+"NYI: register coalescing too complex",
+}
+
+ffnames = {
+[0]="Lua",
+"C",
+"assert",
+"type",
+"next",
+"pairs",
+"ipairs_aux",
+"ipairs",
+"getmetatable",
+"setmetatable",
+"getfenv",
+"setfenv",
+"rawget",
+"rawset",
+"rawequal",
+"unpack",
+"select",
+"tonumber",
+"tostring",
+"error",
+"pcall",
+"xpcall",
+"loadfile",
+"load",
+"loadstring",
+"dofile",
+"gcinfo",
+"collectgarbage",
+"newproxy",
+"print",
+"coroutine.status",
+"coroutine.running",
+"coroutine.create",
+"coroutine.yield",
+"coroutine.resume",
+"coroutine.wrap_aux",
+"coroutine.wrap",
+"math.abs",
+"math.floor",
+"math.ceil",
+"math.sqrt",
+"math.log10",
+"math.exp",
+"math.sin",
+"math.cos",
+"math.tan",
+"math.asin",
+"math.acos",
+"math.atan",
+"math.sinh",
+"math.cosh",
+"math.tanh",
+"math.frexp",
+"math.modf",
+"math.deg",
+"math.rad",
+"math.log",
+"math.atan2",
+"math.pow",
+"math.fmod",
+"math.ldexp",
+"math.min",
+"math.max",
+"math.random",
+"math.randomseed",
+"bit.tobit",
+"bit.bnot",
+"bit.bswap",
+"bit.lshift",
+"bit.rshift",
+"bit.arshift",
+"bit.rol",
+"bit.ror",
+"bit.band",
+"bit.bor",
+"bit.bxor",
+"bit.tohex",
+"string.len",
+"string.byte",
+"string.char",
+"string.sub",
+"string.rep",
+"string.reverse",
+"string.lower",
+"string.upper",
+"string.dump",
+"string.find",
+"string.match",
+"string.gmatch_aux",
+"string.gmatch",
+"string.gsub",
+"string.format",
+"table.foreachi",
+"table.foreach",
+"table.getn",
+"table.maxn",
+"table.insert",
+"table.remove",
+"table.concat",
+"table.sort",
+"io.method.close",
+"io.method.read",
+"io.method.write",
+"io.method.flush",
+"io.method.seek",
+"io.method.setvbuf",
+"io.method.lines",
+"io.method.__gc",
+"io.method.__tostring",
+"io.open",
+"io.popen",
+"io.tmpfile",
+"io.close",
+"io.read",
+"io.write",
+"io.flush",
+"io.input",
+"io.output",
+"io.lines",
+"io.type",
+"os.execute",
+"os.remove",
+"os.rename",
+"os.tmpname",
+"os.getenv",
+"os.exit",
+"os.clock",
+"os.date",
+"os.time",
+"os.difftime",
+"os.setlocale",
+"debug.getregistry",
+"debug.getmetatable",
+"debug.setmetatable",
+"debug.getfenv",
+"debug.setfenv",
+"debug.getinfo",
+"debug.getlocal",
+"debug.setlocal",
+"debug.getupvalue",
+"debug.setupvalue",
+"debug.upvalueid",
+"debug.upvaluejoin",
+"debug.sethook",
+"debug.gethook",
+"debug.debug",
+"debug.traceback",
+"jit.on",
+"jit.off",
+"jit.flush",
+"jit.status",
+"jit.attach",
+"jit.util.funcinfo",
+"jit.util.funcbc",
+"jit.util.funck",
+"jit.util.funcuvname",
+"jit.util.traceinfo",
+"jit.util.traceir",
+"jit.util.tracek",
+"jit.util.tracesnap",
+"jit.util.tracemc",
+"jit.util.traceexitstub",
+"jit.util.ircalladdr",
+"jit.opt.start",
+"ffi.meta.__index",
+"ffi.meta.__newindex",
+"ffi.meta.__eq",
+"ffi.meta.__len",
+"ffi.meta.__lt",
+"ffi.meta.__le",
+"ffi.meta.__concat",
+"ffi.meta.__call",
+"ffi.meta.__add",
+"ffi.meta.__sub",
+"ffi.meta.__mul",
+"ffi.meta.__div",
+"ffi.meta.__mod",
+"ffi.meta.__pow",
+"ffi.meta.__unm",
+"ffi.meta.__tostring",
+"ffi.meta.__pairs",
+"ffi.meta.__ipairs",
+"ffi.clib.__index",
+"ffi.clib.__newindex",
+"ffi.clib.__gc",
+"ffi.callback.free",
+"ffi.callback.set",
+"ffi.cdef",
+"ffi.new",
+"ffi.cast",
+"ffi.typeof",
+"ffi.istype",
+"ffi.sizeof",
+"ffi.alignof",
+"ffi.offsetof",
+"ffi.errno",
+"ffi.string",
+"ffi.copy",
+"ffi.fill",
+"ffi.abi",
+"ffi.metatype",
+"ffi.gc",
+"ffi.load",
+}
+
diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/xedkbuild.bat b/src/3rdparty/LuaJIT-2.0.5/src/xedkbuild.bat
index b4f236e..b4f236e 100644
--- a/build/vc++/libs/LuaJIT-2.0.5/src/xedkbuild.bat
+++ b/src/3rdparty/LuaJIT-2.0.5/src/xedkbuild.bat
diff --git a/src/3rdparty/SDL2/include/SDL.h b/src/3rdparty/SDL2/include/SDL.h
new file mode 100644
index 0000000..d48d9d4
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL.h
@@ -0,0 +1,133 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL.h
+ *
+ * Main include header for the SDL library
+ */
+
+
+#ifndef SDL_h_
+#define SDL_h_
+
+#include "SDL_main.h"
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+#include "SDL_atomic.h"
+#include "SDL_audio.h"
+#include "SDL_clipboard.h"
+#include "SDL_cpuinfo.h"
+#include "SDL_endian.h"
+#include "SDL_error.h"
+#include "SDL_events.h"
+#include "SDL_filesystem.h"
+#include "SDL_gamecontroller.h"
+#include "SDL_haptic.h"
+#include "SDL_hints.h"
+#include "SDL_joystick.h"
+#include "SDL_loadso.h"
+#include "SDL_log.h"
+#include "SDL_messagebox.h"
+#include "SDL_mutex.h"
+#include "SDL_power.h"
+#include "SDL_render.h"
+#include "SDL_rwops.h"
+#include "SDL_shape.h"
+#include "SDL_system.h"
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+#include "SDL_version.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* As of version 0.5, SDL is loaded dynamically into the application */
+
+/**
+ * \name SDL_INIT_*
+ *
+ * These are the flags which may be passed to SDL_Init(). You should
+ * specify the subsystems which you will be using in your application.
+ */
+/* @{ */
+#define SDL_INIT_TIMER 0x00000001u
+#define SDL_INIT_AUDIO 0x00000010u
+#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
+#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
+#define SDL_INIT_HAPTIC 0x00001000u
+#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
+#define SDL_INIT_EVENTS 0x00004000u
+#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
+#define SDL_INIT_EVERYTHING ( \
+ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
+ )
+/* @} */
+
+/**
+ * This function initializes the subsystems specified by \c flags
+ */
+extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
+
+/**
+ * This function initializes specific SDL subsystems
+ *
+ * Subsystem initialization is ref-counted, you must call
+ * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
+ * shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
+ * If a subsystem is already loaded then this call will
+ * increase the ref-count and return.
+ */
+extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
+
+/**
+ * This function cleans up specific SDL subsystems
+ */
+extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
+
+/**
+ * This function returns a mask of the specified subsystems which have
+ * previously been initialized.
+ *
+ * If \c flags is 0, it returns a mask of all initialized subsystems.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
+
+/**
+ * This function cleans up all initialized subsystems. You should
+ * call it upon all exit conditions.
+ */
+extern DECLSPEC void SDLCALL SDL_Quit(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL.h b/src/3rdparty/SDL2/include/SDL2/SDL.h
new file mode 100644
index 0000000..d48d9d4
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL.h
@@ -0,0 +1,133 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL.h
+ *
+ * Main include header for the SDL library
+ */
+
+
+#ifndef SDL_h_
+#define SDL_h_
+
+#include "SDL_main.h"
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+#include "SDL_atomic.h"
+#include "SDL_audio.h"
+#include "SDL_clipboard.h"
+#include "SDL_cpuinfo.h"
+#include "SDL_endian.h"
+#include "SDL_error.h"
+#include "SDL_events.h"
+#include "SDL_filesystem.h"
+#include "SDL_gamecontroller.h"
+#include "SDL_haptic.h"
+#include "SDL_hints.h"
+#include "SDL_joystick.h"
+#include "SDL_loadso.h"
+#include "SDL_log.h"
+#include "SDL_messagebox.h"
+#include "SDL_mutex.h"
+#include "SDL_power.h"
+#include "SDL_render.h"
+#include "SDL_rwops.h"
+#include "SDL_shape.h"
+#include "SDL_system.h"
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+#include "SDL_version.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* As of version 0.5, SDL is loaded dynamically into the application */
+
+/**
+ * \name SDL_INIT_*
+ *
+ * These are the flags which may be passed to SDL_Init(). You should
+ * specify the subsystems which you will be using in your application.
+ */
+/* @{ */
+#define SDL_INIT_TIMER 0x00000001u
+#define SDL_INIT_AUDIO 0x00000010u
+#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
+#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
+#define SDL_INIT_HAPTIC 0x00001000u
+#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
+#define SDL_INIT_EVENTS 0x00004000u
+#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
+#define SDL_INIT_EVERYTHING ( \
+ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
+ )
+/* @} */
+
+/**
+ * This function initializes the subsystems specified by \c flags
+ */
+extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
+
+/**
+ * This function initializes specific SDL subsystems
+ *
+ * Subsystem initialization is ref-counted, you must call
+ * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
+ * shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
+ * If a subsystem is already loaded then this call will
+ * increase the ref-count and return.
+ */
+extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
+
+/**
+ * This function cleans up specific SDL subsystems
+ */
+extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
+
+/**
+ * This function returns a mask of the specified subsystems which have
+ * previously been initialized.
+ *
+ * If \c flags is 0, it returns a mask of all initialized subsystems.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
+
+/**
+ * This function cleans up all initialized subsystems. You should
+ * call it upon all exit conditions.
+ */
+extern DECLSPEC void SDLCALL SDL_Quit(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_assert.h b/src/3rdparty/SDL2/include/SDL2/SDL_assert.h
new file mode 100644
index 0000000..b38f928
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_assert.h
@@ -0,0 +1,291 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
+
+#include "SDL_config.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SDL_ASSERT_LEVEL
+#ifdef SDL_DEFAULT_ASSERT_LEVEL
+#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
+#elif defined(_DEBUG) || defined(DEBUG) || \
+ (defined(__GNUC__) && !defined(__OPTIMIZE__))
+#define SDL_ASSERT_LEVEL 2
+#else
+#define SDL_ASSERT_LEVEL 1
+#endif
+#endif /* SDL_ASSERT_LEVEL */
+
+/*
+These are macros and not first class functions so that the debugger breaks
+on the assertion line and not in some random guts of SDL, and so each
+assert can have unique static variables associated with it.
+*/
+
+#if defined(_MSC_VER)
+/* Don't include intrin.h here because it contains C++ code */
+ extern void __cdecl __debugbreak(void);
+ #define SDL_TriggerBreakpoint() __debugbreak()
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
+ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
+#elif defined(__386__) && defined(__WATCOMC__)
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
+ #include <signal.h>
+ #define SDL_TriggerBreakpoint() raise(SIGTRAP)
+#else
+ /* How do we trigger breakpoints on this platform? */
+ #define SDL_TriggerBreakpoint()
+#endif
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
+# define SDL_FUNCTION __func__
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
+# define SDL_FUNCTION __FUNCTION__
+#else
+# define SDL_FUNCTION "???"
+#endif
+#define SDL_FILE __FILE__
+#define SDL_LINE __LINE__
+
+/*
+sizeof (x) makes the compiler still parse the expression even without
+assertions enabled, so the code is always checked at compile time, but
+doesn't actually generate code for it, so there are no side effects or
+expensive checks at run time, just the constant size of what x WOULD be,
+which presumably gets optimized out as unused.
+This also solves the problem of...
+
+ int somevalue = blah();
+ SDL_assert(somevalue == 1);
+
+...which would cause compiles to complain that somevalue is unused if we
+disable assertions.
+*/
+
+/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
+ this condition isn't constant. And looks like an owl's face! */
+#ifdef _MSC_VER /* stupid /W4 warnings. */
+#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
+#else
+#define SDL_NULL_WHILE_LOOP_CONDITION (0)
+#endif
+
+#define SDL_disabled_assert(condition) \
+ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
+
+typedef enum
+{
+ SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
+ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
+ SDL_ASSERTION_ABORT, /**< Terminate the program. */
+ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
+ SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
+} SDL_AssertState;
+
+typedef struct SDL_AssertData
+{
+ int always_ignore;
+ unsigned int trigger_count;
+ const char *condition;
+ const char *filename;
+ int linenum;
+ const char *function;
+ const struct SDL_AssertData *next;
+} SDL_AssertData;
+
+#if (SDL_ASSERT_LEVEL > 0)
+
+/* Never call this directly. Use the SDL_assert* macros. */
+extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
+ const char *,
+ const char *, int)
+#if defined(__clang__)
+#if __has_feature(attribute_analyzer_noreturn)
+/* this tells Clang's static analysis that we're a custom assert function,
+ and that the analyzer should assume the condition was always true past this
+ SDL_assert test. */
+ __attribute__((analyzer_noreturn))
+#endif
+#endif
+;
+
+/* the do {} while(0) avoids dangling else problems:
+ if (x) SDL_assert(y); else blah();
+ ... without the do/while, the "else" could attach to this macro's "if".
+ We try to handle just the minimum we need here in a macro...the loop,
+ the static vars, and break points. The heavy lifting is handled in
+ SDL_ReportAssertion(), in SDL_assert.c.
+*/
+#define SDL_enabled_assert(condition) \
+ do { \
+ while ( !(condition) ) { \
+ static struct SDL_AssertData sdl_assert_data = { \
+ 0, 0, #condition, 0, 0, 0, 0 \
+ }; \
+ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
+ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
+ continue; /* go again. */ \
+ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
+ SDL_TriggerBreakpoint(); \
+ } \
+ break; /* not retrying. */ \
+ } \
+ } while (SDL_NULL_WHILE_LOOP_CONDITION)
+
+#endif /* enabled assertions support code */
+
+/* Enable various levels of assertions. */
+#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
+# define SDL_assert(condition) SDL_disabled_assert(condition)
+# define SDL_assert_release(condition) SDL_disabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
+# define SDL_assert(condition) SDL_disabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
+# define SDL_assert(condition) SDL_enabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
+# define SDL_assert(condition) SDL_enabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
+#else
+# error Unknown assertion level.
+#endif
+
+/* this assertion is never disabled at any level. */
+#define SDL_assert_always(condition) SDL_enabled_assert(condition)
+
+
+typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
+ const SDL_AssertData* data, void* userdata);
+
+/**
+ * \brief Set an application-defined assertion handler.
+ *
+ * This allows an app to show its own assertion UI and/or force the
+ * response to an assertion failure. If the app doesn't provide this, SDL
+ * will try to do the right thing, popping up a system-specific GUI dialog,
+ * and probably minimizing any fullscreen windows.
+ *
+ * This callback may fire from any thread, but it runs wrapped in a mutex, so
+ * it will only fire from one thread at a time.
+ *
+ * Setting the callback to NULL restores SDL's original internal handler.
+ *
+ * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
+ *
+ * Return SDL_AssertState value of how to handle the assertion failure.
+ *
+ * \param handler Callback function, called when an assertion fails.
+ * \param userdata A pointer passed to the callback as-is.
+ */
+extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
+ SDL_AssertionHandler handler,
+ void *userdata);
+
+/**
+ * \brief Get the default assertion handler.
+ *
+ * This returns the function pointer that is called by default when an
+ * assertion is triggered. This is an internal function provided by SDL,
+ * that is used for assertions when SDL_SetAssertionHandler() hasn't been
+ * used to provide a different function.
+ *
+ * \return The default SDL_AssertionHandler that is called when an assert triggers.
+ */
+extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
+
+/**
+ * \brief Get the current assertion handler.
+ *
+ * This returns the function pointer that is called when an assertion is
+ * triggered. This is either the value last passed to
+ * SDL_SetAssertionHandler(), or if no application-specified function is
+ * set, is equivalent to calling SDL_GetDefaultAssertionHandler().
+ *
+ * \param puserdata Pointer to a void*, which will store the "userdata"
+ * pointer that was passed to SDL_SetAssertionHandler().
+ * This value will always be NULL for the default handler.
+ * If you don't care about this data, it is safe to pass
+ * a NULL pointer to this function to ignore it.
+ * \return The SDL_AssertionHandler that is called when an assert triggers.
+ */
+extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
+
+/**
+ * \brief Get a list of all assertion failures.
+ *
+ * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
+ * or the start of the program.
+ *
+ * The proper way to examine this data looks something like this:
+ *
+ * <code>
+ * const SDL_AssertData *item = SDL_GetAssertionReport();
+ * while (item) {
+ * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
+ * item->condition, item->function, item->filename,
+ * item->linenum, item->trigger_count,
+ * item->always_ignore ? "yes" : "no");
+ * item = item->next;
+ * }
+ * </code>
+ *
+ * \return List of all assertions.
+ * \sa SDL_ResetAssertionReport
+ */
+extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
+
+/**
+ * \brief Reset the list of all assertion failures.
+ *
+ * Reset list of all assertions triggered.
+ *
+ * \sa SDL_GetAssertionReport
+ */
+extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
+
+
+/* these had wrong naming conventions until 2.0.4. Please update your app! */
+#define SDL_assert_state SDL_AssertState
+#define SDL_assert_data SDL_AssertData
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_assert_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_atomic.h b/src/3rdparty/SDL2/include/SDL2/SDL_atomic.h
new file mode 100644
index 0000000..b228774
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_atomic.h
@@ -0,0 +1,277 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_atomic.h
+ *
+ * Atomic operations.
+ *
+ * IMPORTANT:
+ * If you are not an expert in concurrent lockless programming, you should
+ * only be using the atomic lock and reference counting functions in this
+ * file. In all other cases you should be protecting your data structures
+ * with full mutexes.
+ *
+ * The list of "safe" functions to use are:
+ * SDL_AtomicLock()
+ * SDL_AtomicUnlock()
+ * SDL_AtomicIncRef()
+ * SDL_AtomicDecRef()
+ *
+ * Seriously, here be dragons!
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * You can find out a little more about lockless programming and the
+ * subtle issues that can arise here:
+ * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
+ *
+ * There's also lots of good information here:
+ * http://www.1024cores.net/home/lock-free-algorithms
+ * http://preshing.com/
+ *
+ * These operations may or may not actually be implemented using
+ * processor specific atomic operations. When possible they are
+ * implemented as true processor specific atomic operations. When that
+ * is not possible the are implemented using locks that *do* use the
+ * available atomic operations.
+ *
+ * All of the atomic operations that modify memory are full memory barriers.
+ */
+
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_platform.h"
+
+#include "begin_code.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \name SDL AtomicLock
+ *
+ * The atomic locks are efficient spinlocks using CPU instructions,
+ * but are vulnerable to starvation and can spin forever if a thread
+ * holding a lock has been terminated. For this reason you should
+ * minimize the code executed inside an atomic lock and never do
+ * expensive things like API or system calls while holding them.
+ *
+ * The atomic locks are not safe to lock recursively.
+ *
+ * Porting Note:
+ * The spin lock functions and type are required and can not be
+ * emulated because they are used in the atomic emulation code.
+ */
+/* @{ */
+
+typedef int SDL_SpinLock;
+
+/**
+ * \brief Try to lock a spin lock by setting it to a non-zero value.
+ *
+ * \param lock Points to the lock.
+ *
+ * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
+
+/**
+ * \brief Lock a spin lock by setting it to a non-zero value.
+ *
+ * \param lock Points to the lock.
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
+
+/**
+ * \brief Unlock a spin lock by setting it to 0. Always returns immediately
+ *
+ * \param lock Points to the lock.
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
+
+/* @} *//* SDL AtomicLock */
+
+
+/**
+ * The compiler barrier prevents the compiler from reordering
+ * reads and writes to globally visible variables across the call.
+ */
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
+void _ReadWriteBarrier(void);
+#pragma intrinsic(_ReadWriteBarrier)
+#define SDL_CompilerBarrier() _ReadWriteBarrier()
+#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
+/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
+#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
+#else
+#define SDL_CompilerBarrier() \
+{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
+#endif
+
+/**
+ * Memory barriers are designed to prevent reads and writes from being
+ * reordered by the compiler and being seen out of order on multi-core CPUs.
+ *
+ * A typical pattern would be for thread A to write some data and a flag,
+ * and for thread B to read the flag and get the data. In this case you
+ * would insert a release barrier between writing the data and the flag,
+ * guaranteeing that the data write completes no later than the flag is
+ * written, and you would insert an acquire barrier between reading the
+ * flag and reading the data, to ensure that all the reads associated
+ * with the flag have completed.
+ *
+ * In this pattern you should always see a release barrier paired with
+ * an acquire barrier and you should gate the data reads/writes with a
+ * single flag variable.
+ *
+ * For more information on these semantics, take a look at the blog post:
+ * http://preshing.com/20120913/acquire-and-release-semantics
+ */
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
+#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
+#elif defined(__GNUC__) && defined(__aarch64__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#elif defined(__GNUC__) && defined(__arm__)
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
+#ifdef __thumb__
+/* The mcr instruction isn't available in thumb mode, use real functions */
+#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
+#else
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
+#endif /* __thumb__ */
+#else
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
+#endif /* __GNUC__ && __arm__ */
+#else
+#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
+/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
+#include <mbarrier.h>
+#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
+#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
+#else
+/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
+#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
+#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
+#endif
+#endif
+
+/**
+ * \brief A type representing an atomic integer value. It is a struct
+ * so people don't accidentally use numeric operations on it.
+ */
+typedef struct { int value; } SDL_atomic_t;
+
+/**
+ * \brief Set an atomic variable to a new value if it is currently an old value.
+ *
+ * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
+ *
+ * \note If you don't know what this function is for, you shouldn't use it!
+*/
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
+
+/**
+ * \brief Set an atomic variable to a value.
+ *
+ * \return The previous value of the atomic variable.
+ */
+extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
+
+/**
+ * \brief Get the value of an atomic variable
+ */
+extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
+
+/**
+ * \brief Add to an atomic variable.
+ *
+ * \return The previous value of the atomic variable.
+ *
+ * \note This same style can be used for any number operation
+ */
+extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
+
+/**
+ * \brief Increment an atomic variable used as a reference count.
+ */
+#ifndef SDL_AtomicIncRef
+#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
+#endif
+
+/**
+ * \brief Decrement an atomic variable used as a reference count.
+ *
+ * \return SDL_TRUE if the variable reached zero after decrementing,
+ * SDL_FALSE otherwise
+ */
+#ifndef SDL_AtomicDecRef
+#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
+#endif
+
+/**
+ * \brief Set a pointer to a new value if it is currently an old value.
+ *
+ * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
+ *
+ * \note If you don't know what this function is for, you shouldn't use it!
+*/
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
+
+/**
+ * \brief Set a pointer to a value atomically.
+ *
+ * \return The previous value of the pointer.
+ */
+extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
+
+/**
+ * \brief Get the value of a pointer atomically.
+ */
+extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
+#include "close_code.h"
+
+#endif /* SDL_atomic_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_audio.h b/src/3rdparty/SDL2/include/SDL2/SDL_audio.h
new file mode 100644
index 0000000..d6ea689
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_audio.h
@@ -0,0 +1,825 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_audio.h
+ *
+ * Access to the raw audio mixing buffer for the SDL library.
+ */
+
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_endian.h"
+#include "SDL_mutex.h"
+#include "SDL_thread.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Audio format flags.
+ *
+ * These are what the 16 bits in SDL_AudioFormat currently mean...
+ * (Unspecified bits are always zero).
+ *
+ * \verbatim
+ ++-----------------------sample is signed if set
+ ||
+ || ++-----------sample is bigendian if set
+ || ||
+ || || ++---sample is float if set
+ || || ||
+ || || || +---sample bit size---+
+ || || || | |
+ 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
+ \endverbatim
+ *
+ * There are macros in SDL 2.0 and later to query these bits.
+ */
+typedef Uint16 SDL_AudioFormat;
+
+/**
+ * \name Audio flags
+ */
+/* @{ */
+
+#define SDL_AUDIO_MASK_BITSIZE (0xFF)
+#define SDL_AUDIO_MASK_DATATYPE (1<<8)
+#define SDL_AUDIO_MASK_ENDIAN (1<<12)
+#define SDL_AUDIO_MASK_SIGNED (1<<15)
+#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
+#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
+#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
+#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
+#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
+#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
+#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
+
+/**
+ * \name Audio format flags
+ *
+ * Defaults to LSB byte order.
+ */
+/* @{ */
+#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
+#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
+#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
+#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
+#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
+#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
+#define AUDIO_U16 AUDIO_U16LSB
+#define AUDIO_S16 AUDIO_S16LSB
+/* @} */
+
+/**
+ * \name int32 support
+ */
+/* @{ */
+#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
+#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
+#define AUDIO_S32 AUDIO_S32LSB
+/* @} */
+
+/**
+ * \name float32 support
+ */
+/* @{ */
+#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
+#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
+#define AUDIO_F32 AUDIO_F32LSB
+/* @} */
+
+/**
+ * \name Native audio byte ordering
+ */
+/* @{ */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define AUDIO_U16SYS AUDIO_U16LSB
+#define AUDIO_S16SYS AUDIO_S16LSB
+#define AUDIO_S32SYS AUDIO_S32LSB
+#define AUDIO_F32SYS AUDIO_F32LSB
+#else
+#define AUDIO_U16SYS AUDIO_U16MSB
+#define AUDIO_S16SYS AUDIO_S16MSB
+#define AUDIO_S32SYS AUDIO_S32MSB
+#define AUDIO_F32SYS AUDIO_F32MSB
+#endif
+/* @} */
+
+/**
+ * \name Allow change flags
+ *
+ * Which audio format changes are allowed when opening a device.
+ */
+/* @{ */
+#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
+#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
+#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
+#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
+/* @} */
+
+/* @} *//* Audio flags */
+
+/**
+ * This function is called when the audio device needs more data.
+ *
+ * \param userdata An application-specific parameter saved in
+ * the SDL_AudioSpec structure
+ * \param stream A pointer to the audio data buffer.
+ * \param len The length of that buffer in bytes.
+ *
+ * Once the callback returns, the buffer will no longer be valid.
+ * Stereo samples are stored in a LRLRLR ordering.
+ *
+ * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
+ * you like. Just open your audio device with a NULL callback.
+ */
+typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
+ int len);
+
+/**
+ * The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ * For multi-channel audio, the default SDL channel mapping is:
+ * 2: FL FR (stereo)
+ * 3: FL FR LFE (2.1 surround)
+ * 4: FL FR BL BR (quad)
+ * 5: FL FR FC BL BR (quad + center)
+ * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
+ * 7: FL FR FC LFE BC SL SR (6.1 surround)
+ * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
+ */
+typedef struct SDL_AudioSpec
+{
+ int freq; /**< DSP frequency -- samples per second */
+ SDL_AudioFormat format; /**< Audio data format */
+ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
+ Uint8 silence; /**< Audio buffer silence value (calculated) */
+ Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
+ Uint16 padding; /**< Necessary for some compile environments */
+ Uint32 size; /**< Audio buffer size in bytes (calculated) */
+ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
+ void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
+} SDL_AudioSpec;
+
+
+struct SDL_AudioCVT;
+typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
+ SDL_AudioFormat format);
+
+/**
+ * \brief Upper limit of filters in SDL_AudioCVT
+ *
+ * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ * one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ * \struct SDL_AudioCVT
+ * \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ * Note that various parts of the conversion pipeline can take advantage
+ * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ * you to pass it aligned data, but can possibly run much faster if you
+ * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ * (len) field to something that's a multiple of 16, if possible.
+ */
+#ifdef __GNUC__
+/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
+ pad it out to 88 bytes to guarantee ABI compatibility between compilers.
+ vvv
+ The next time we rev the ABI, make sure to size the ints and add padding.
+*/
+#define SDL_AUDIOCVT_PACKED __attribute__((packed))
+#else
+#define SDL_AUDIOCVT_PACKED
+#endif
+/* */
+typedef struct SDL_AudioCVT
+{
+ int needed; /**< Set to 1 if conversion possible */
+ SDL_AudioFormat src_format; /**< Source audio format */
+ SDL_AudioFormat dst_format; /**< Target audio format */
+ double rate_incr; /**< Rate conversion increment */
+ Uint8 *buf; /**< Buffer to hold entire audio data */
+ int len; /**< Length of original audio buffer */
+ int len_cvt; /**< Length of converted audio buffer */
+ int len_mult; /**< buffer must be len*len_mult big */
+ double len_ratio; /**< Given len, final size is len*len_ratio */
+ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
+ int filter_index; /**< Current audio conversion function */
+} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
+
+
+/* Function prototypes */
+
+/**
+ * \name Driver discovery functions
+ *
+ * These functions return the list of built in audio drivers, in the
+ * order that they are normally initialized by default.
+ */
+/* @{ */
+extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
+extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
+/* @} */
+
+/**
+ * \name Initialization and cleanup
+ *
+ * \internal These functions are used internally, and should not be used unless
+ * you have a specific need to specify the audio driver you want to
+ * use. You should normally use SDL_Init() or SDL_InitSubSystem().
+ */
+/* @{ */
+extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
+extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
+/* @} */
+
+/**
+ * This function returns the name of the current audio driver, or NULL
+ * if no driver has been initialized.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
+
+/**
+ * This function opens the audio device with the desired parameters, and
+ * returns 0 if successful, placing the actual hardware parameters in the
+ * structure pointed to by \c obtained. If \c obtained is NULL, the audio
+ * data passed to the callback function will be guaranteed to be in the
+ * requested format, and will be automatically converted to the hardware
+ * audio format if necessary. This function returns -1 if it failed
+ * to open the audio device, or couldn't set up the audio thread.
+ *
+ * When filling in the desired audio spec structure,
+ * - \c desired->freq should be the desired audio frequency in samples-per-
+ * second.
+ * - \c desired->format should be the desired audio format.
+ * - \c desired->samples is the desired size of the audio buffer, in
+ * samples. This number should be a power of two, and may be adjusted by
+ * the audio driver to a value more suitable for the hardware. Good values
+ * seem to range between 512 and 8096 inclusive, depending on the
+ * application and CPU speed. Smaller values yield faster response time,
+ * but can lead to underflow if the application is doing heavy processing
+ * and cannot fill the audio buffer in time. A stereo sample consists of
+ * both right and left channels in LR ordering.
+ * Note that the number of samples is directly related to time by the
+ * following formula: \code ms = (samples*1000)/freq \endcode
+ * - \c desired->size is the size in bytes of the audio buffer, and is
+ * calculated by SDL_OpenAudio().
+ * - \c desired->silence is the value used to set the buffer to silence,
+ * and is calculated by SDL_OpenAudio().
+ * - \c desired->callback should be set to a function that will be called
+ * when the audio device is ready for more data. It is passed a pointer
+ * to the audio buffer, and the length in bytes of the audio buffer.
+ * This function usually runs in a separate thread, and so you should
+ * protect data structures that it accesses by calling SDL_LockAudio()
+ * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
+ * pointer here, and call SDL_QueueAudio() with some frequency, to queue
+ * more audio samples to be played (or for capture devices, call
+ * SDL_DequeueAudio() with some frequency, to obtain audio samples).
+ * - \c desired->userdata is passed as the first parameter to your callback
+ * function. If you passed a NULL callback, this value is ignored.
+ *
+ * The audio device starts out playing silence when it's opened, and should
+ * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
+ * for your audio callback function to be called. Since the audio driver
+ * may modify the requested size of the audio buffer, you should allocate
+ * any local mixing buffers after you open the audio device.
+ */
+extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
+ SDL_AudioSpec * obtained);
+
+/**
+ * SDL Audio Device IDs.
+ *
+ * A successful call to SDL_OpenAudio() is always device id 1, and legacy
+ * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
+ * always returns devices >= 2 on success. The legacy calls are good both
+ * for backwards compatibility and when you don't care about multiple,
+ * specific, or capture devices.
+ */
+typedef Uint32 SDL_AudioDeviceID;
+
+/**
+ * Get the number of available devices exposed by the current driver.
+ * Only valid after a successfully initializing the audio subsystem.
+ * Returns -1 if an explicit list of devices can't be determined; this is
+ * not an error. For example, if SDL is set up to talk to a remote audio
+ * server, it can't list every one available on the Internet, but it will
+ * still allow a specific host to be specified to SDL_OpenAudioDevice().
+ *
+ * In many common cases, when this function returns a value <= 0, it can still
+ * successfully open the default device (NULL for first argument of
+ * SDL_OpenAudioDevice()).
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
+
+/**
+ * Get the human-readable name of a specific audio device.
+ * Must be a value between 0 and (number of audio devices-1).
+ * Only valid after a successfully initializing the audio subsystem.
+ * The values returned by this function reflect the latest call to
+ * SDL_GetNumAudioDevices(); recall that function to redetect available
+ * hardware.
+ *
+ * The string returned by this function is UTF-8 encoded, read-only, and
+ * managed internally. You are not to free it. If you need to keep the
+ * string for any length of time, you should make your own copy of it, as it
+ * will be invalid next time any of several other SDL functions is called.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
+ int iscapture);
+
+
+/**
+ * Open a specific audio device. Passing in a device name of NULL requests
+ * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
+ *
+ * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
+ * some drivers allow arbitrary and driver-specific strings, such as a
+ * hostname/IP address for a remote audio server, or a filename in the
+ * diskaudio driver.
+ *
+ * \return 0 on error, a valid device ID that is >= 2 on success.
+ *
+ * SDL_OpenAudio(), unlike this function, always acts on device ID 1.
+ */
+extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
+ *device,
+ int iscapture,
+ const
+ SDL_AudioSpec *
+ desired,
+ SDL_AudioSpec *
+ obtained,
+ int
+ allowed_changes);
+
+
+
+/**
+ * \name Audio state
+ *
+ * Get the current audio state.
+ */
+/* @{ */
+typedef enum
+{
+ SDL_AUDIO_STOPPED = 0,
+ SDL_AUDIO_PLAYING,
+ SDL_AUDIO_PAUSED
+} SDL_AudioStatus;
+extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
+
+extern DECLSPEC SDL_AudioStatus SDLCALL
+SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
+/* @} *//* Audio State */
+
+/**
+ * \name Pause audio functions
+ *
+ * These functions pause and unpause the audio callback processing.
+ * They should be called with a parameter of 0 after opening the audio
+ * device to start playing sound. This is so you can safely initialize
+ * data for your callback function after opening the audio device.
+ * Silence will be written to the audio device during the pause.
+ */
+/* @{ */
+extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
+extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
+ int pause_on);
+/* @} *//* Pause audio functions */
+
+/**
+ * This function loads a WAVE from the data source, automatically freeing
+ * that source if \c freesrc is non-zero. For example, to load a WAVE file,
+ * you could do:
+ * \code
+ * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
+ * \endcode
+ *
+ * If this function succeeds, it returns the given SDL_AudioSpec,
+ * filled with the audio data format of the wave data, and sets
+ * \c *audio_buf to a malloc()'d buffer containing the audio data,
+ * and sets \c *audio_len to the length of that audio buffer, in bytes.
+ * You need to free the audio buffer with SDL_FreeWAV() when you are
+ * done with it.
+ *
+ * This function returns NULL and sets the SDL error message if the
+ * wave file cannot be opened, uses an unknown data format, or is
+ * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
+ */
+extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
+ int freesrc,
+ SDL_AudioSpec * spec,
+ Uint8 ** audio_buf,
+ Uint32 * audio_len);
+
+/**
+ * Loads a WAV from a file.
+ * Compatibility convenience function.
+ */
+#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
+ SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
+
+/**
+ * This function frees data previously allocated with SDL_LoadWAV_RW()
+ */
+extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
+
+/**
+ * This function takes a source format and rate and a destination format
+ * and rate, and initializes the \c cvt structure with information needed
+ * by SDL_ConvertAudio() to convert a buffer of audio data from one format
+ * to the other. An unsupported format causes an error and -1 will be returned.
+ *
+ * \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ * or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
+ SDL_AudioFormat src_format,
+ Uint8 src_channels,
+ int src_rate,
+ SDL_AudioFormat dst_format,
+ Uint8 dst_channels,
+ int dst_rate);
+
+/**
+ * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
+ * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
+ * audio data in the source format, this function will convert it in-place
+ * to the desired format.
+ *
+ * The data conversion may expand the size of the audio data, so the buffer
+ * \c cvt->buf should be allocated after the \c cvt structure is initialized by
+ * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
+ *
+ * \return 0 on success or -1 if \c cvt->buf is NULL.
+ */
+extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
+
+/* SDL_AudioStream is a new audio conversion interface.
+ The benefits vs SDL_AudioCVT:
+ - it can handle resampling data in chunks without generating
+ artifacts, when it doesn't have the complete buffer available.
+ - it can handle incoming data in any variable size.
+ - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ * Create a new audio stream
+ *
+ * \param src_format The format of the source audio
+ * \param src_channels The number of channels of the source audio
+ * \param src_rate The sampling rate of the source audio
+ * \param dst_format The format of the desired audio output
+ * \param dst_channels The number of channels of the desired audio output
+ * \param dst_rate The sampling rate of the desired audio output
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+ const Uint8 src_channels,
+ const int src_rate,
+ const SDL_AudioFormat dst_format,
+ const Uint8 dst_channels,
+ const int dst_rate);
+
+/**
+ * Add data to be converted/resampled to the stream
+ *
+ * \param stream The stream the audio data is being added to
+ * \param buf A pointer to the audio data to add
+ * \param len The number of bytes to write to the stream
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ * Get converted/resampled data from the stream
+ *
+ * \param stream The stream the audio is being requested from
+ * \param buf A buffer to fill with audio data
+ * \param len The maximum number of bytes to fill
+ * \return The number of bytes read from the stream, or -1 on error
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ * buffering data behind the scenes until it has enough to resample
+ * correctly, so this number might be lower than what you expect, or even
+ * be zero. Add more data or flush the stream if you need the data now.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ * should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ * be audio gaps in the output. Generally this is intended to signal the
+ * end of input, so the complete output becomes available.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ * Clear any pending data in the stream without converting it
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
+#define SDL_MIX_MAXVOLUME 128
+/**
+ * This takes two audio buffers of the playing audio format and mixes
+ * them, performing addition, volume adjustment, and overflow clipping.
+ * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
+ * for full audio volume. Note this does not change hardware volume.
+ * This is provided for convenience -- you can mix your own audio data.
+ */
+extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
+ Uint32 len, int volume);
+
+/**
+ * This works like SDL_MixAudio(), but you specify the audio format instead of
+ * using the format of audio device 1. Thus it can be used when no audio
+ * device is open at all.
+ */
+extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
+ const Uint8 * src,
+ SDL_AudioFormat format,
+ Uint32 len, int volume);
+
+/**
+ * Queue more audio on non-callback devices.
+ *
+ * (If you are looking to retrieve queued audio from a non-callback capture
+ * device, you want SDL_DequeueAudio() instead. This will return -1 to
+ * signify an error if you use it with capture devices.)
+ *
+ * SDL offers two ways to feed audio to the device: you can either supply a
+ * callback that SDL triggers with some frequency to obtain more audio
+ * (pull method), or you can supply no callback, and then SDL will expect
+ * you to supply data at regular intervals (push method) with this function.
+ *
+ * There are no limits on the amount of data you can queue, short of
+ * exhaustion of address space. Queued data will drain to the device as
+ * necessary without further intervention from you. If the device needs
+ * audio but there is not enough queued, it will play silence to make up
+ * the difference. This means you will have skips in your audio playback
+ * if you aren't routinely queueing sufficient data.
+ *
+ * This function copies the supplied data, so you are safe to free it when
+ * the function returns. This function is thread-safe, but queueing to the
+ * same device from two threads at once does not promise which buffer will
+ * be queued first.
+ *
+ * You may not queue audio on a device that is using an application-supplied
+ * callback; doing so returns an error. You have to use the audio callback
+ * or queue audio with this function, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before queueing; SDL
+ * handles locking internally for this function.
+ *
+ * \param dev The device ID to which we will queue audio.
+ * \param data The data to queue to the device for later playback.
+ * \param len The number of bytes (not samples!) to which (data) points.
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_GetQueuedAudioSize
+ * \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
+
+/**
+ * Dequeue more audio on non-callback devices.
+ *
+ * (If you are looking to queue audio for output on a non-callback playback
+ * device, you want SDL_QueueAudio() instead. This will always return 0
+ * if you use it with playback devices.)
+ *
+ * SDL offers two ways to retrieve audio from a capture device: you can
+ * either supply a callback that SDL triggers with some frequency as the
+ * device records more audio data, (push method), or you can supply no
+ * callback, and then SDL will expect you to retrieve data at regular
+ * intervals (pull method) with this function.
+ *
+ * There are no limits on the amount of data you can queue, short of
+ * exhaustion of address space. Data from the device will keep queuing as
+ * necessary without further intervention from you. This means you will
+ * eventually run out of memory if you aren't routinely dequeueing data.
+ *
+ * Capture devices will not queue data when paused; if you are expecting
+ * to not need captured audio for some length of time, use
+ * SDL_PauseAudioDevice() to stop the capture device from queueing more
+ * data. This can be useful during, say, level loading times. When
+ * unpaused, capture devices will start queueing data from that point,
+ * having flushed any capturable data available while paused.
+ *
+ * This function is thread-safe, but dequeueing from the same device from
+ * two threads at once does not promise which thread will dequeued data
+ * first.
+ *
+ * You may not dequeue audio from a device that is using an
+ * application-supplied callback; doing so returns an error. You have to use
+ * the audio callback, or dequeue audio with this function, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before queueing; SDL
+ * handles locking internally for this function.
+ *
+ * \param dev The device ID from which we will dequeue audio.
+ * \param data A pointer into where audio data should be copied.
+ * \param len The number of bytes (not samples!) to which (data) points.
+ * \return number of bytes dequeued, which could be less than requested.
+ *
+ * \sa SDL_GetQueuedAudioSize
+ * \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len);
+
+/**
+ * Get the number of bytes of still-queued audio.
+ *
+ * For playback device:
+ *
+ * This is the number of bytes that have been queued for playback with
+ * SDL_QueueAudio(), but have not yet been sent to the hardware. This
+ * number may shrink at any time, so this only informs of pending data.
+ *
+ * Once we've sent it to the hardware, this function can not decide the
+ * exact byte boundary of what has been played. It's possible that we just
+ * gave the hardware several kilobytes right before you called this
+ * function, but it hasn't played any of it yet, or maybe half of it, etc.
+ *
+ * For capture devices:
+ *
+ * This is the number of bytes that have been captured by the device and
+ * are waiting for you to dequeue. This number may grow at any time, so
+ * this only informs of the lower-bound of available data.
+ *
+ * You may not queue audio on a device that is using an application-supplied
+ * callback; calling this function on such a device always returns 0.
+ * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
+ * the audio callback, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before querying; SDL
+ * handles locking internally for this function.
+ *
+ * \param dev The device ID of which we will query queued audio size.
+ * \return Number of bytes (not samples!) of queued audio.
+ *
+ * \sa SDL_QueueAudio
+ * \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
+
+/**
+ * Drop any queued audio data. For playback devices, this is any queued data
+ * still waiting to be submitted to the hardware. For capture devices, this
+ * is any data that was queued by the device that hasn't yet been dequeued by
+ * the application.
+ *
+ * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For
+ * playback devices, the hardware will start playing silence if more audio
+ * isn't queued. Unpaused capture devices will start filling the queue again
+ * as soon as they have more data available (which, depending on the state
+ * of the hardware and the thread, could be before this function call
+ * returns!).
+ *
+ * This will not prevent playback of queued audio that's already been sent
+ * to the hardware, as we can not undo that, so expect there to be some
+ * fraction of a second of audio that might still be heard. This can be
+ * useful if you want to, say, drop any pending music during a level change
+ * in your game.
+ *
+ * You may not queue audio on a device that is using an application-supplied
+ * callback; calling this function on such a device is always a no-op.
+ * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
+ * the audio callback, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before clearing the
+ * queue; SDL handles locking internally for this function.
+ *
+ * This function always succeeds and thus returns void.
+ *
+ * \param dev The device ID of which to clear the audio queue.
+ *
+ * \sa SDL_QueueAudio
+ * \sa SDL_GetQueuedAudioSize
+ */
+extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
+
+
+/**
+ * \name Audio lock functions
+ *
+ * The lock manipulated by these functions protects the callback function.
+ * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
+ * the callback function is not running. Do not call these from the callback
+ * function or you will cause deadlock.
+ */
+/* @{ */
+extern DECLSPEC void SDLCALL SDL_LockAudio(void);
+extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
+extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
+extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
+/* @} *//* Audio lock functions */
+
+/**
+ * This function shuts down audio processing and closes the audio device.
+ */
+extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
+extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_audio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_bits.h b/src/3rdparty/SDL2/include/SDL2/SDL_bits.h
new file mode 100644
index 0000000..eb8322f
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_bits.h
@@ -0,0 +1,112 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_bits.h
+ *
+ * Functions for fiddling with bits and bitmasks.
+ */
+
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_bits.h
+ */
+
+/**
+ * Get the index of the most significant bit. Result is undefined when called
+ * with 0. This operation can also be stated as "count leading zeroes" and
+ * "log base 2".
+ *
+ * \return Index of the most significant bit, or -1 if the value is 0.
+ */
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+ "bsr eax, eax" \
+ "xor eax, 31" \
+ parm [eax] nomemory \
+ value [eax] \
+ modify exact [eax] nomemory;
+#endif
+
+SDL_FORCE_INLINE int
+SDL_MostSignificantBitIndex32(Uint32 x)
+{
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+ /* Count Leading Zeroes builtin in GCC.
+ * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
+ */
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - _SDL_clz_watcom(x);
+#else
+ /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
+ * <seander@cs.stanford.edu>, released in the public domain.
+ * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
+ */
+ const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
+ const int S[] = {1, 2, 4, 8, 16};
+
+ int msbIndex = 0;
+ int i;
+
+ if (x == 0) {
+ return -1;
+ }
+
+ for (i = 4; i >= 0; i--)
+ {
+ if (x & b[i])
+ {
+ x >>= S[i];
+ msbIndex |= S[i];
+ }
+ }
+
+ return msbIndex;
+#endif
+}
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_bits_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_blendmode.h b/src/3rdparty/SDL2/include/SDL2/SDL_blendmode.h
new file mode 100644
index 0000000..36a5ea7
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_blendmode.h
@@ -0,0 +1,120 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_blendmode.h
+ *
+ * Header file declaring the SDL_BlendMode enumeration
+ */
+
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
+ */
+typedef enum
+{
+ SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
+ dstRGBA = srcRGBA */
+ SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
+ dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
+ dstA = srcA + (dstA * (1-srcA)) */
+ SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
+ dstRGB = (srcRGB * srcA) + dstRGB
+ dstA = dstA */
+ SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
+ dstRGB = srcRGB * dstRGB
+ dstA = dstA */
+ SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
+} SDL_BlendMode;
+
+/**
+ * \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
+ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
+ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ * \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
+ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
+ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ * \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ * \param srcColorFactor
+ * \param dstColorFactor
+ * \param colorOperation
+ * \param srcAlphaFactor
+ * \param dstAlphaFactor
+ * \param alphaOperation
+ *
+ * The result of the blend mode operation will be:
+ * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ * and
+ * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+ SDL_BlendFactor dstColorFactor,
+ SDL_BlendOperation colorOperation,
+ SDL_BlendFactor srcAlphaFactor,
+ SDL_BlendFactor dstAlphaFactor,
+ SDL_BlendOperation alphaOperation);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_blendmode_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_clipboard.h b/src/3rdparty/SDL2/include/SDL2/SDL_clipboard.h
new file mode 100644
index 0000000..f28751e
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_clipboard.h
@@ -0,0 +1,71 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_clipboard.h
+ *
+ * Include file for SDL clipboard handling
+ */
+
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+/**
+ * \brief Put UTF-8 text into the clipboard
+ *
+ * \sa SDL_GetClipboardText()
+ */
+extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
+
+/**
+ * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
+ *
+ * \sa SDL_SetClipboardText()
+ */
+extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
+
+/**
+ * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
+ *
+ * \sa SDL_GetClipboardText()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_clipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config.h b/src/3rdparty/SDL2/include/SDL2/SDL_config.h
new file mode 100644
index 0000000..7e0340c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config.h
@@ -0,0 +1,53 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/**
+ * \file SDL_config.h
+ */
+
+/* Add any platform that doesn't build using the configure system. */
+#if defined(__WIN32__)
+#include "SDL_config_windows.h"
+#elif defined(__WINRT__)
+#include "SDL_config_winrt.h"
+#elif defined(__MACOSX__)
+#include "SDL_config_macosx.h"
+#elif defined(__IPHONEOS__)
+#include "SDL_config_iphoneos.h"
+#elif defined(__ANDROID__)
+#include "SDL_config_android.h"
+#elif defined(__PSP__)
+#include "SDL_config_psp.h"
+#else
+/* This is a minimal configuration just to get SDL running on new platforms */
+#include "SDL_config_minimal.h"
+#endif /* platform config */
+
+#ifdef USING_GENERATED_CONFIG_H
+#error Wrong SDL_config.h, check your include path?
+#endif
+
+#endif /* SDL_config_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_android.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_android.h
new file mode 100644
index 0000000..4c4da37
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_android.h
@@ -0,0 +1,171 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_android_h_
+#define SDL_config_android_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/**
+ * \file SDL_config_android.h
+ *
+ * This is a configuration that can be used to build SDL for Android
+ */
+
+#include <stdarg.h>
+
+#define HAVE_GCC_ATOMICS 1
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_CLOCK_GETTIME 1
+
+#define SIZEOF_VOIDP 4
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_ANDROID 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#define SDL_JOYSTICK_ANDROID 1
+#define SDL_HAPTIC_ANDROID 1
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_DLOPEN 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_ANDROID 1
+
+/* Enable OpenGL ES */
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_OPENGL_ES2 1
+#define SDL_VIDEO_OPENGL_EGL 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+
+/* Enable Vulkan support */
+/* Android does not support Vulkan in native code using the "armeabi" ABI. */
+#if defined(__ARM_ARCH) && __ARM_ARCH < 7
+#define SDL_VIDEO_VULKAN 0
+#else
+#define SDL_VIDEO_VULKAN 1
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_ANDROID 1
+
+/* Enable the filesystem driver */
+#define SDL_FILESYSTEM_ANDROID 1
+
+#endif /* SDL_config_android_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_iphoneos.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_iphoneos.h
new file mode 100644
index 0000000..7b0a6ca
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_iphoneos.h
@@ -0,0 +1,191 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_iphoneos_h_
+#define SDL_config_iphoneos_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+#ifdef __LP64__
+#define SIZEOF_VOIDP 8
+#else
+#define SIZEOF_VOIDP 4
+#endif
+
+#define HAVE_GCC_ATOMICS 1
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+/* The libunwind functions are only available on x86 */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYSCTLBYNAME 1
+
+/* enable iPhone version of Core Audio driver */
+#define SDL_AUDIO_DRIVER_COREAUDIO 1
+/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DUMMY 1
+
+/* Enable MFi joystick support */
+#define SDL_JOYSTICK_MFI 1
+
+/* Enable Unix style SO loading */
+#define SDL_LOADSO_DLOPEN 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Supported video drivers */
+#define SDL_VIDEO_DRIVER_UIKIT 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable OpenGL ES */
+#define SDL_VIDEO_OPENGL_ES2 1
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+
+/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */
+#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))
+#define SDL_PLATFORM_SUPPORTS_METAL 1
+#else
+#define SDL_PLATFORM_SUPPORTS_METAL 0
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_RENDER_METAL 1
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_VULKAN 1
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_UIKIT 1
+
+/* enable iPhone keyboard support */
+#define SDL_IPHONE_KEYBOARD 1
+
+/* enable iOS extended launch screen */
+#define SDL_IPHONE_LAUNCHSCREEN 1
+
+/* Set max recognized G-force from accelerometer
+ See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
+ */
+#define SDL_IPHONE_MAX_GFORCE 5.0
+
+/* enable filesystem support */
+#define SDL_FILESYSTEM_COCOA 1
+
+#endif /* SDL_config_iphoneos_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_macosx.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_macosx.h
new file mode 100644
index 0000000..29f583e
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_macosx.h
@@ -0,0 +1,234 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_macosx_h_
+#define SDL_config_macosx_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
+#include <AvailabilityMacros.h>
+
+/* This is a set of defines to configure the SDL features */
+
+#ifdef __LP64__
+ #define SIZEOF_VOIDP 8
+#else
+ #define SIZEOF_VOIDP 4
+#endif
+
+/* Useful headers */
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_LIBUNWIND_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYSCTLBYNAME 1
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_COREAUDIO 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#define SDL_JOYSTICK_IOKIT 1
+#define SDL_HAPTIC_IOKIT 1
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_DLOPEN 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_COCOA 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#undef SDL_VIDEO_DRIVER_X11
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_XDBE 1
+#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
+#define SDL_VIDEO_DRIVER_X11_XRANDR 1
+#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
+#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
+#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
+#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
+
+#ifdef MAC_OS_X_VERSION_10_8
+/*
+ * No matter the versions targeted, this is the 10.8 or later SDK, so you have
+ * to use the external Xquartz, which is a more modern Xlib. Previous SDKs
+ * used an older Xlib.
+ */
+#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
+#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
+#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_METAL
+/* Metal only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_RENDER_METAL 1
+#else
+#define SDL_VIDEO_RENDER_METAL 0
+#endif
+#endif
+
+/* Enable OpenGL support */
+#ifndef SDL_VIDEO_OPENGL
+#define SDL_VIDEO_OPENGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_CGL
+#define SDL_VIDEO_OPENGL_CGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_GLX
+#define SDL_VIDEO_OPENGL_GLX 1
+#endif
+
+/* Enable Vulkan support */
+/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_VULKAN 1
+#else
+#define SDL_VIDEO_VULKAN 0
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_MACOSX 1
+
+/* enable filesystem support */
+#define SDL_FILESYSTEM_COCOA 1
+
+/* Enable assembly routines */
+#define SDL_ASSEMBLY_ROUTINES 1
+#ifdef __ppc__
+#define SDL_ALTIVEC_BLITTERS 1
+#endif
+
+#endif /* SDL_config_macosx_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_minimal.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_minimal.h
new file mode 100644
index 0000000..5b03d8b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_minimal.h
@@ -0,0 +1,82 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_minimal_h_
+#define SDL_config_minimal_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/**
+ * \file SDL_config_minimal.h
+ *
+ * This is the minimal configuration that can be used to build SDL.
+ */
+
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+
+/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+/* Here are some reasonable defaults */
+typedef unsigned int size_t;
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+typedef unsigned long uintptr_t;
+#else
+#define HAVE_STDINT_H 1
+#endif /* Visual Studio 2008 */
+
+#ifdef __GNUC__
+#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
+#endif
+
+/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
+#define SDL_JOYSTICK_DISABLED 1
+
+/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED 1
+
+/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
+#define SDL_LOADSO_DISABLED 1
+
+/* Enable the stub thread support (src/thread/generic/\*.c) */
+#define SDL_THREADS_DISABLED 1
+
+/* Enable the stub timer support (src/timer/dummy/\*.c) */
+#define SDL_TIMERS_DISABLED 1
+
+/* Enable the dummy video driver (src/video/dummy/\*.c) */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
+#define SDL_FILESYSTEM_DUMMY 1
+
+#endif /* SDL_config_minimal_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_pandora.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_pandora.h
new file mode 100644
index 0000000..be5a85c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_pandora.h
@@ -0,0 +1,130 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_pandora_h_
+#define SDL_config_pandora_h_
+#define SDL_config_h_
+
+/* This is a set of defines to configure the SDL features */
+
+/* General platform specific identifiers */
+#include "SDL_platform.h"
+
+#ifdef __LP64__
+#define SIZEOF_VOIDP 8
+#else
+#define SIZEOF_VOIDP 4
+#endif
+
+#define SDL_BYTEORDER 1234
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_STRLEN 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_LOG10 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_OSS 1
+
+#define SDL_INPUT_LINUXEV 1
+#define SDL_INPUT_TSLIB 1
+#define SDL_JOYSTICK_LINUX 1
+#define SDL_HAPTIC_LINUX 1
+
+#define SDL_LOADSO_DLOPEN 1
+
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
+
+#define SDL_TIMER_UNIX 1
+#define SDL_FILESYSTEM_UNIX 1
+
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_X11 1
+#define SDL_VIDEO_DRIVER_PANDORA 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 1
+
+#endif /* SDL_config_pandora_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_psp.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_psp.h
new file mode 100644
index 0000000..61c3349
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_psp.h
@@ -0,0 +1,159 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_psp_h_
+#define SDL_config_psp_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+
+
+#ifdef __GNUC__
+#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
+#endif
+
+#define HAVE_GCC_ATOMICS 1
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+/* #define HAVE_SYSCONF 1 */
+/* #define HAVE_SIGACTION 1 */
+
+
+/* PSP isn't that sophisticated */
+#define LACKS_SYS_MMAN_H 1
+
+/* Enable the stub thread support (src/thread/psp/\*.c) */
+#define SDL_THREAD_PSP 1
+
+/* Enable the stub timer support (src/timer/psp/\*.c) */
+#define SDL_TIMERS_PSP 1
+
+/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
+#define SDL_JOYSTICK_PSP 1
+
+/* Enable the stub audio driver (src/audio/psp/\*.c) */
+#define SDL_AUDIO_DRIVER_PSP 1
+
+/* PSP video dirver */
+#define SDL_VIDEO_DRIVER_PSP 1
+
+/* PSP render dirver */
+#define SDL_VIDEO_RENDER_PSP 1
+
+#define SDL_POWER_PSP 1
+
+/* !!! FIXME: what does PSP do for filesystem stuff? */
+#define SDL_FILESYSTEM_DUMMY 1
+
+/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED 1
+
+/* PSP can't load shared object (src/loadso/dummy/\*.c) */
+#define SDL_LOADSO_DISABLED 1
+
+
+#endif /* SDL_config_psp_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_windows.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_windows.h
new file mode 100644
index 0000000..52a9ece
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_windows.h
@@ -0,0 +1,248 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_windows_h_
+#define SDL_config_windows_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* This is a set of defines to configure the SDL features */
+
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
+#define HAVE_STDINT_H 1
+#elif defined(_MSC_VER)
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#ifndef _UINTPTR_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+#define _UINTPTR_T_DEFINED
+#endif
+/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
+#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
+#define DWORD_PTR DWORD
+#endif
+#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
+#define LONG_PTR LONG
+#endif
+#else /* !__GNUC__ && !_MSC_VER */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#ifndef _SIZE_T_DEFINED_
+#define _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#endif
+typedef unsigned int uintptr_t;
+#endif /* __GNUC__ || _MSC_VER */
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
+#else
+# define SIZEOF_VOIDP 4
+#endif
+
+#define HAVE_DDRAW_H 1
+#define HAVE_DINPUT_H 1
+#define HAVE_DSOUND_H 1
+#define HAVE_DXGI_H 1
+#define HAVE_XINPUT_H 1
+
+/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
+#ifdef HAVE_LIBC
+/* Useful headers */
+#define STDC_HEADERS 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE__STRREV 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE__STRICMP 1
+#define HAVE__STRNICMP 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF 1
+#define HAVE__COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
+#if _MSC_VER >= 1800
+#define HAVE_STRTOLL 1
+#define HAVE_VSSCANF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#endif
+/* This function is available with at least the VC++ 2008 C runtime library */
+#if _MSC_VER >= 1400
+#define HAVE__FSEEKI64 1
+#endif
+#endif
+#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
+#define HAVE_M_PI 1
+#endif
+#else
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#endif
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#define SDL_AUDIO_DRIVER_DSOUND 1
+#define SDL_AUDIO_DRIVER_WINMM 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#define SDL_JOYSTICK_DINPUT 1
+#define SDL_JOYSTICK_XINPUT 1
+#define SDL_HAPTIC_DINPUT 1
+#define SDL_HAPTIC_XINPUT 1
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_WINDOWS 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_WINDOWS 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_WINDOWS 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_WINDOWS 1
+
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D 1
+#endif
+#ifndef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11 0
+#endif
+
+/* Enable OpenGL support */
+#ifndef SDL_VIDEO_OPENGL
+#define SDL_VIDEO_OPENGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_WGL
+#define SDL_VIDEO_OPENGL_WGL 1
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL 1
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
+
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
+
+/* Enable system power support */
+#define SDL_POWER_WINDOWS 1
+
+/* Enable filesystem support */
+#define SDL_FILESYSTEM_WINDOWS 1
+
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
+
+#endif /* SDL_config_windows_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_winrt.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_winrt.h
new file mode 100644
index 0000000..aac0e60
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_winrt.h
@@ -0,0 +1,230 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_winrt_h_
+#define SDL_config_winrt_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used
+ by SDL to determine which version of the Windows SDK is being used.
+*/
+#include <sdkddkver.h>
+
+/* Define possibly-undefined NTDDI values (used when compiling SDL against
+ older versions of the Windows SDK.
+*/
+#ifndef NTDDI_WINBLUE
+#define NTDDI_WINBLUE 0x06030000
+#endif
+#ifndef NTDDI_WIN10
+#define NTDDI_WIN10 0x0A000000
+#endif
+
+/* This is a set of defines to configure the SDL features */
+
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
+#define HAVE_STDINT_H 1
+#elif defined(_MSC_VER)
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#ifndef _UINTPTR_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+#define _UINTPTR_T_DEFINED
+#endif
+/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
+#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
+#define DWORD_PTR DWORD
+#endif
+#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
+#define LONG_PTR LONG
+#endif
+#else /* !__GNUC__ && !_MSC_VER */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#ifndef _SIZE_T_DEFINED_
+#define _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#endif
+typedef unsigned int uintptr_t;
+#endif /* __GNUC__ || _MSC_VER */
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
+#else
+# define SIZEOF_VOIDP 4
+#endif
+
+/* Useful headers */
+#define HAVE_DXGI_H 1
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+#define HAVE_XINPUT_H 1
+#endif
+#define HAVE_LIBC 1
+#define STDC_HEADERS 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE__STRREV 1
+#define HAVE__STRUPR 1
+//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
+//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
+//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+//#define HAVE_STRTOLL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE__STRICMP 1
+#define HAVE__STRNICMP 1
+#define HAVE_VSNPRINTF 1
+//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE__COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE__SCALB 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE__FSEEKI64 1
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+#define SDL_JOYSTICK_DISABLED 1
+#define SDL_HAPTIC_DISABLED 1
+#else
+#define SDL_JOYSTICK_XINPUT 1
+#define SDL_HAPTIC_XINPUT 1
+#endif
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_WINDOWS 1
+
+/* Enable various threading systems */
+#if (NTDDI_VERSION >= NTDDI_WINBLUE)
+#define SDL_THREAD_WINDOWS 1
+#else
+/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
+#define SDL_THREAD_STDCPP 1
+#endif
+
+/* Enable various timer systems */
+#define SDL_TIMER_WINDOWS 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_WINRT 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
+#define SDL_VIDEO_OPENGL_ES2 1
+#define SDL_VIDEO_OPENGL_EGL 1
+
+/* Enable appropriate renderer(s) */
+#define SDL_VIDEO_RENDER_D3D11 1
+
+#if SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_WINRT 1
+
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
+
+#endif /* SDL_config_winrt_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_config_wiz.h b/src/3rdparty/SDL2/include/SDL2/SDL_config_wiz.h
new file mode 100644
index 0000000..fe86d5e
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_config_wiz.h
@@ -0,0 +1,142 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_wiz_h_
+#define SDL_config_wiz_h_
+#define SDL_config_h_
+
+/* This is a set of defines to configure the SDL features */
+
+/* General platform specific identifiers */
+#include "SDL_platform.h"
+
+#define SDL_BYTEORDER 1234
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_STRLEN 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_POW 1
+
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_OSS 1
+
+#define SDL_INPUT_LINUXEV 1
+#define SDL_INPUT_TSLIB 1
+#define SDL_JOYSTICK_LINUX 1
+#define SDL_HAPTIC_LINUX 1
+
+#define SDL_LOADSO_DLOPEN 1
+
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
+
+#define SDL_TIMER_UNIX 1
+
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_PANDORA 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 1
+
+#endif /* SDL_config_wiz_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_copying.h b/src/3rdparty/SDL2/include/SDL2/SDL_copying.h
new file mode 100644
index 0000000..15616ac
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_copying.h
@@ -0,0 +1,20 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_cpuinfo.h b/src/3rdparty/SDL2/include/SDL2/SDL_cpuinfo.h
new file mode 100644
index 0000000..0812705
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_cpuinfo.h
@@ -0,0 +1,181 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_cpuinfo.h
+ *
+ * CPU feature detection for SDL.
+ */
+
+#ifndef SDL_cpuinfo_h_
+#define SDL_cpuinfo_h_
+
+#include "SDL_stdinc.h"
+
+/* Need to do this here because intrin.h has C++ code in it */
+/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
+#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
+#include <intrin.h>
+#ifndef _WIN64
+#define __MMX__
+#define __3dNOW__
+#endif
+#define __SSE__
+#define __SSE2__
+#endif /* __clang__ */
+#elif defined(__MINGW64_VERSION_MAJOR)
+#include <intrin.h>
+#else
+#ifdef __ALTIVEC__
+#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
+#include <altivec.h>
+#undef pixel
+#undef bool
+#endif
+#endif
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
+#include <mm3dnow.h>
+#endif
+#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
+#include <xmmintrin.h>
+#endif
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
+#include <emmintrin.h>
+#endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
+#endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This is a guess for the cacheline size used for padding.
+ * Most x86 processors have a 64 byte cache line.
+ * The 64-bit PowerPC processors have a 128 byte cache line.
+ * We'll use the larger value to be generally safe.
+ */
+#define SDL_CACHELINE_SIZE 128
+
+/**
+ * This function returns the number of CPU cores available.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
+
+/**
+ * This function returns the L1 cache line size of the CPU
+ *
+ * This is useful for determining multi-threaded structure padding
+ * or SIMD prefetch sizes.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
+
+/**
+ * This function returns true if the CPU has the RDTSC instruction.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
+
+/**
+ * This function returns true if the CPU has AltiVec features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
+
+/**
+ * This function returns true if the CPU has MMX features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
+
+/**
+ * This function returns true if the CPU has 3DNow! features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
+
+/**
+ * This function returns true if the CPU has SSE features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
+
+/**
+ * This function returns true if the CPU has SSE2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
+
+/**
+ * This function returns true if the CPU has SSE3 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
+
+/**
+ * This function returns true if the CPU has SSE4.1 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
+
+/**
+ * This function returns true if the CPU has SSE4.2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
+
+/**
+ * This function returns true if the CPU has AVX features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
+
+/**
+ * This function returns true if the CPU has AVX2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
+
+/**
+ * This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
+/**
+ * This function returns the amount of RAM configured in the system, in MB.
+ */
+extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_cpuinfo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_egl.h b/src/3rdparty/SDL2/include/SDL2/SDL_egl.h
new file mode 100644
index 0000000..d65ed43
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_egl.h
@@ -0,0 +1,1673 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_egl.h
+ *
+ * This is a simple file to encapsulate the EGL API headers.
+ */
+#if !defined(_MSC_VER) && !defined(__ANDROID__)
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#else /* _MSC_VER */
+
+/* EGL headers for Visual Studio */
+
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+*
+* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
+*
+* Adopters may modify this file to suit their platform. Adopters are
+* encouraged to submit platform specific modifications to the Khronos
+* group so that they can be included in future versions of this file.
+* Please submit changes by sending them to the public Khronos Bugzilla
+* (http://khronos.org/bugzilla) by filing a bug against product
+* "Khronos (general)" component "Registry".
+*
+* A predefined template which fills in some of the bug fields can be
+* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+* must create a Bugzilla login first.
+*
+*
+* See the Implementer's Guidelines for information about where this file
+* should be located on your system and for more details of its use:
+* http://www.khronos.org/registry/implementers_guide.pdf
+*
+* This file should be included as
+* #include <KHR/khrplatform.h>
+* by Khronos client API header files that use its types and defines.
+*
+* The types in khrplatform.h should only be used to define API-specific types.
+*
+* Types defined in khrplatform.h:
+* khronos_int8_t signed 8 bit
+* khronos_uint8_t unsigned 8 bit
+* khronos_int16_t signed 16 bit
+* khronos_uint16_t unsigned 16 bit
+* khronos_int32_t signed 32 bit
+* khronos_uint32_t unsigned 32 bit
+* khronos_int64_t signed 64 bit
+* khronos_uint64_t unsigned 64 bit
+* khronos_intptr_t signed same number of bits as a pointer
+* khronos_uintptr_t unsigned same number of bits as a pointer
+* khronos_ssize_t signed size
+* khronos_usize_t unsigned size
+* khronos_float_t signed 32 bit floating point
+* khronos_time_ns_t unsigned 64 bit time in nanoseconds
+* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+* nanoseconds
+* khronos_stime_nanoseconds_t signed time interval in nanoseconds
+* khronos_boolean_enum_t enumerated boolean type. This should
+* only be used as a base type when a client API's boolean type is
+* an enum. Client APIs which use an integer or other type for
+* booleans cannot use this as the base type for their boolean.
+*
+* Tokens defined in khrplatform.h:
+*
+* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+*
+* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+*
+* Calling convention macros defined in this file:
+* KHRONOS_APICALL
+* KHRONOS_APIENTRY
+* KHRONOS_APIATTRIBUTES
+*
+* These may be used in function prototypes as:
+*
+* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+* int arg1,
+* int arg2) KHRONOS_APIATTRIBUTES;
+*/
+
+/*-------------------------------------------------------------------------
+* Definition of KHRONOS_APICALL
+*-------------------------------------------------------------------------
+* This precedes the return type of the function in the function prototype.
+*/
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+* Definition of KHRONOS_APIENTRY
+*-------------------------------------------------------------------------
+* This follows the return type of the function and precedes the function
+* name in the function prototype.
+*/
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+/* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+* Definition of KHRONOS_APIATTRIBUTES
+*-------------------------------------------------------------------------
+* This follows the closing parenthesis of the function prototype arguments.
+*/
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+* basic type definitions
+*-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+* Using <stdint.h>
+*/
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+* Using <inttypes.h>
+*/
+#include <inttypes.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+* Win32
+*/
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+* Sun or Digital
+*/
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+* Hypothetical platform with no float or int64 support
+*/
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+* Generic fallback
+*/
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+* Types that are (so far) the same on all platforms
+*/
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+
+/*
+* Types that differ between LLP64 and LP64 architectures - in LLP64,
+* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+* to be the only LLP64 architecture in current use.
+*/
+#ifdef _WIN64
+typedef signed long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+* Float type
+*/
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+*
+* These types can be used to represent a time interval in nanoseconds or
+* an absolute Unadjusted System Time. Unadjusted System Time is the number
+* of nanoseconds since some arbitrary system event (e.g. since the last
+* time the system booted). The Unadjusted System Time is an unsigned
+* 64 bit value that wraps back to 0 every 584 years. Time intervals
+* may be either signed or unsigned.
+*/
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+* Dummy value used to pad enum types to 32 bits.
+*/
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+* Enumerated boolean type
+*
+* Values other than zero should be considered to be true. Therefore
+* comparisons should not be made against KHRONOS_TRUE.
+*/
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
+
+
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
+*
+* Adopters may modify khrplatform.h and this file to suit their platform.
+* You are encouraged to submit all modifications to the Khronos group so that
+* they can be included in future versions of this file. Please submit changes
+* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+* by filing a bug against product "EGL" component "Registry".
+*/
+
+/*#include <KHR/khrplatform.h>*/
+
+/* Macros used in EGL function prototype declarations.
+*
+* EGL functions should be prototyped as:
+*
+* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+*
+* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+*/
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+* are aliases of window-system-dependent types, such as X Display * or
+* Windows Device Context. They must be defined in platform-specific
+* code below. The EGL-prefixed versions of Native*Type are the same
+* types, renamed in EGL 1.3 so all types in the API start with "EGL".
+*
+* Khronos STRONGLY RECOMMENDS that you use the default definitions
+* provided below, since these changes affect both binary and source
+* portability of applications using EGL running on different EGL
+* implementations.
+*/
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+#if __WINRT__
+#include <Unknwn.h>
+typedef IUnknown * EGLNativeWindowType;
+typedef IUnknown * EGLNativePixmapType;
+typedef IUnknown * EGLNativeDisplayType;
+#else
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND EGLNativeWindowType;
+#endif
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(WL_EGL_PLATFORM)
+
+typedef struct wl_display *EGLNativeDisplayType;
+typedef struct wl_egl_pixmap *EGLNativePixmapType;
+typedef struct wl_egl_window *EGLNativeWindowType;
+
+#elif defined(__GBM__)
+
+typedef struct gbm_device *EGLNativeDisplayType;
+typedef struct gbm_bo *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
+#elif defined(__ANDROID__) /* Android */
+
+struct ANativeWindow;
+struct egl_native_pixmap_t;
+
+typedef struct ANativeWindow *EGLNativeWindowType;
+typedef struct egl_native_pixmap_t *EGLNativePixmapType;
+typedef void *EGLNativeDisplayType;
+
+#elif defined(MIR_EGL_PLATFORM)
+
+#include <mir_toolkit/mir_client_library.h>
+typedef MirEGLNativeDisplayType EGLNativeDisplayType;
+typedef void *EGLNativePixmapType;
+typedef MirEGLNativeWindowType EGLNativeWindowType;
+
+#elif defined(__unix__)
+
+#ifdef MESA_EGL_NO_X11_HEADERS
+
+typedef void *EGLNativeDisplayType;
+typedef khronos_uintptr_t EGLNativePixmapType;
+typedef khronos_uintptr_t EGLNativeWindowType;
+
+#else
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#endif /* MESA_EGL_NO_X11_HEADERS */
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+* all legal attribute names and values passed into and out of EGL, whether
+* their type is boolean, bitmask, enumerant (symbolic constant), integer,
+* handle, or other. While in general a 32-bit integer will suffice, if
+* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+* integer type.
+*/
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
+
+#ifndef __egl_h_
+#define __egl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2015 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
+*/
+
+/*#include <EGL/eglplatform.h>*/
+
+/* Generated on date 20150623 */
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
+typedef unsigned int EGLBoolean;
+typedef void *EGLDisplay;
+typedef void *EGLConfig;
+typedef void *EGLSurface;
+typedef void *EGLContext;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_DONT_CARE ((EGLint)-1)
+#define EGL_DRAW 0x3059
+#define EGL_EXTENSIONS 0x3055
+#define EGL_FALSE 0
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_HEIGHT 0x3056
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_NONE 0x3038
+#define EGL_NON_CONFORMANT_CONFIG 0x3051
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_NO_CONTEXT ((EGLContext)0)
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#define EGL_NO_SURFACE ((EGLSurface)0)
+#define EGL_PBUFFER_BIT 0x0001
+#define EGL_PIXMAP_BIT 0x0002
+#define EGL_READ 0x305A
+#define EGL_RED_SIZE 0x3024
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SLOW_CONFIG 0x3050
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_SUCCESS 0x3000
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_TRANSPARENT_RGB 0x3052
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRUE 1
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_WIDTH 0x3057
+#define EGL_WINDOW_BIT 0x0004
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
+EGLAPI EGLint EGLAPIENTRY eglGetError (void);
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
+#endif /* EGL_VERSION_1_0 */
+
+#ifndef EGL_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_CONTEXT_LOST 0x300E
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_2D 0x305F
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_TARGET 0x3081
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
+#endif /* EGL_VERSION_1_1 */
+
+#ifndef EGL_VERSION_1_2
+#define EGL_VERSION_1_2 1
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#define EGL_ALPHA_FORMAT 0x3088
+#define EGL_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_ALPHA_FORMAT_PRE 0x308C
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_BUFFER_PRESERVED 0x3094
+#define EGL_BUFFER_DESTROYED 0x3095
+#define EGL_CLIENT_APIS 0x308D
+#define EGL_COLORSPACE 0x3087
+#define EGL_COLORSPACE_sRGB 0x3089
+#define EGL_COLORSPACE_LINEAR 0x308A
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+#define EGL_DISPLAY_SCALING 10000
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_LUMINANCE_BUFFER 0x308F
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_OPENGL_ES_BIT 0x0001
+#define EGL_OPENVG_BIT 0x0002
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENVG_IMAGE 0x3096
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_RGB_BUFFER 0x308E
+#define EGL_SINGLE_BUFFER 0x3085
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_UNKNOWN ((EGLint)-1)
+#define EGL_VERTICAL_RESOLUTION 0x3091
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
+#endif /* EGL_VERSION_1_2 */
+
+#ifndef EGL_VERSION_1_3
+#define EGL_VERSION_1_3 1
+#define EGL_CONFORMANT 0x3042
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041
+#define EGL_OPENGL_ES2_BIT 0x0004
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_COLORSPACE_sRGB 0x3089
+#define EGL_VG_COLORSPACE_LINEAR 0x308A
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
+#endif /* EGL_VERSION_1_3 */
+
+#ifndef EGL_VERSION_1_4
+#define EGL_VERSION_1_4 1
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
+#define EGL_OPENGL_API 0x30A2
+#define EGL_OPENGL_BIT 0x0008
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
+#endif /* EGL_VERSION_1_4 */
+
+#ifndef EGL_VERSION_1_5
+#define EGL_VERSION_1_5 1
+typedef void *EGLSync;
+typedef intptr_t EGLAttrib;
+typedef khronos_utime_nanoseconds_t EGLTime;
+typedef void *EGLImage;
+#define EGL_CONTEXT_MAJOR_VERSION 0x3098
+#define EGL_CONTEXT_MINOR_VERSION 0x30FB
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
+#define EGL_NO_RESET_NOTIFICATION 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
+#define EGL_OPENGL_ES3_BIT 0x00000040
+#define EGL_CL_EVENT_HANDLE 0x309C
+#define EGL_SYNC_CL_EVENT 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
+#define EGL_SYNC_TYPE 0x30F7
+#define EGL_SYNC_STATUS 0x30F1
+#define EGL_SYNC_CONDITION 0x30F8
+#define EGL_SIGNALED 0x30F2
+#define EGL_UNSIGNALED 0x30F3
+#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
+#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED 0x30F5
+#define EGL_CONDITION_SATISFIED 0x30F6
+#define EGL_NO_SYNC ((EGLSync)0)
+#define EGL_SYNC_FENCE 0x30F9
+#define EGL_GL_COLORSPACE 0x309D
+#define EGL_GL_COLORSPACE_SRGB 0x3089
+#define EGL_GL_COLORSPACE_LINEAR 0x308A
+#define EGL_GL_RENDERBUFFER 0x30B9
+#define EGL_GL_TEXTURE_2D 0x30B1
+#define EGL_GL_TEXTURE_LEVEL 0x30BC
+#define EGL_GL_TEXTURE_3D 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
+#define EGL_IMAGE_PRESERVED 0x30D2
+#define EGL_NO_IMAGE ((EGLImage)0)
+EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#endif /* EGL_VERSION_1_5 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __egl_h_ */
+
+
+
+#ifndef __eglext_h_
+#define __eglext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2015 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
+*/
+
+/*#include <EGL/eglplatform.h>*/
+
+#define EGL_EGLEXT_VERSION 20150623
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR 0x309C
+#define EGL_SYNC_CL_EVENT_KHR 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
+#endif /* EGL_KHR_cl_event */
+
+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#endif
+#endif /* EGL_KHR_cl_event2 */
+
+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
+#endif /* EGL_KHR_config_attribs */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif /* EGL_KHR_create_context */
+
+#ifndef EGL_KHR_create_context_no_error
+#define EGL_KHR_create_context_no_error 1
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
+#endif /* EGL_KHR_create_context_no_error */
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR 0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
+#endif /* EGL_KHR_gl_colorspace */
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif
+#endif /* EGL_KHR_image */
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif /* EGL_KHR_image_base */
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+#endif /* EGL_KHR_image_pixmap */
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
+#define EGL_MATCH_FORMAT_KHR 0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
+#define EGL_FORMAT_RGB_565_KHR 0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
+#define EGL_BITMAP_POINTER_KHR 0x30C6
+#define EGL_BITMAP_PITCH_KHR 0x30C7
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR 0x30CE
+#define EGL_UPPER_LEFT_KHR 0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
+#endif
+#endif /* EGL_KHR_lock_surface */
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+#endif /* EGL_KHR_lock_surface2 */
+
+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#endif
+#endif /* EGL_KHR_lock_surface3 */
+
+#ifndef EGL_KHR_partial_update
+#define EGL_KHR_partial_update 1
+#define EGL_BUFFER_AGE_KHR 0x313D
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_partial_update */
+
+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR 0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR 0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
+
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void *EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+#define EGL_PRODUCER_FRAME_KHR 0x3212
+#define EGL_CONSUMER_FRAME_KHR 0x3213
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
+
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
+
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
+
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
+
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
+
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR 0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+#endif /* EGL_KHR_surfaceless_context */
+
+#ifndef EGL_KHR_swap_buffers_with_damage
+#define EGL_KHR_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_swap_buffers_with_damage */
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
+#endif /* EGL_KHR_vg_parent_image */
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+#endif /* EGL_KHR_wait_sync */
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+#endif /* EGL_ANDROID_blob_cache */
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
+#endif
+#endif /* EGL_ANDROID_native_fence_sync */
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_device_d3d
+#define EGL_ANGLE_device_d3d 1
+#define EGL_D3D9_DEVICE_ANGLE 0x33A0
+#define EGL_D3D11_DEVICE_ANGLE 0x33A1
+#endif /* EGL_ANGLE_device_d3d */
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+#endif /* EGL_ANGLE_query_surface_pointer */
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE 0x3201
+#endif /* EGL_ANGLE_window_fixed_size */
+
+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM 0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif /* EGL_EXT_buffer_age */
+
+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
+
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
+#endif /* EGL_EXT_create_context_robustness */
+
+#ifndef EGL_EXT_device_base
+#define EGL_EXT_device_base 1
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
+#define EGL_BAD_DEVICE_EXT 0x322B
+#define EGL_DEVICE_EXT 0x322C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#endif
+#endif /* EGL_EXT_device_base */
+
+#ifndef EGL_EXT_device_drm
+#define EGL_EXT_device_drm 1
+#define EGL_DRM_DEVICE_FILE_EXT 0x3233
+#endif /* EGL_EXT_device_drm */
+
+#ifndef EGL_EXT_device_enumeration
+#define EGL_EXT_device_enumeration 1
+#endif /* EGL_EXT_device_enumeration */
+
+#ifndef EGL_EXT_device_openwf
+#define EGL_EXT_device_openwf 1
+#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
+#endif /* EGL_EXT_device_openwf */
+
+#ifndef EGL_EXT_device_query
+#define EGL_EXT_device_query 1
+#endif /* EGL_EXT_device_query */
+
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT 0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT 0x327F
+#define EGL_ITU_REC709_EXT 0x3280
+#define EGL_ITU_REC2020_EXT 0x3281
+#define EGL_YUV_FULL_RANGE_EXT 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_output_base
+#define EGL_EXT_output_base 1
+typedef void *EGLOutputLayerEXT;
+typedef void *EGLOutputPortEXT;
+#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
+#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0)
+#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
+#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
+#define EGL_SWAP_INTERVAL_EXT 0x322F
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#endif
+#endif /* EGL_EXT_output_base */
+
+#ifndef EGL_EXT_output_drm
+#define EGL_EXT_output_drm 1
+#define EGL_DRM_CRTC_EXT 0x3234
+#define EGL_DRM_PLANE_EXT 0x3235
+#define EGL_DRM_CONNECTOR_EXT 0x3236
+#endif /* EGL_EXT_output_drm */
+
+#ifndef EGL_EXT_output_openwf
+#define EGL_EXT_output_openwf 1
+#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
+#define EGL_OPENWF_PORT_ID_EXT 0x3239
+#endif /* EGL_EXT_output_openwf */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#endif
+#endif /* EGL_EXT_platform_base */
+
+#ifndef EGL_EXT_platform_device
+#define EGL_EXT_platform_device 1
+#define EGL_PLATFORM_DEVICE_EXT 0x313F
+#endif /* EGL_EXT_platform_device */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
+#endif /* EGL_EXT_platform_x11 */
+
+#ifndef EGL_EXT_protected_surface
+#define EGL_EXT_protected_surface 1
+#define EGL_PROTECTED_CONTENT_EXT 0x32C0
+#endif /* EGL_EXT_protected_surface */
+
+#ifndef EGL_EXT_stream_consumer_egloutput
+#define EGL_EXT_stream_consumer_egloutput 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#endif
+#endif /* EGL_EXT_stream_consumer_egloutput */
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
+#ifndef EGL_EXT_yuv_surface
+#define EGL_EXT_yuv_surface 1
+#define EGL_YUV_ORDER_EXT 0x3301
+#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
+#define EGL_YUV_SUBSAMPLE_EXT 0x3312
+#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
+#define EGL_YUV_CSC_STANDARD_EXT 0x330A
+#define EGL_YUV_PLANE_BPP_EXT 0x331A
+#define EGL_YUV_BUFFER_EXT 0x3300
+#define EGL_YUV_ORDER_YUV_EXT 0x3302
+#define EGL_YUV_ORDER_YVU_EXT 0x3303
+#define EGL_YUV_ORDER_YUYV_EXT 0x3304
+#define EGL_YUV_ORDER_UYVY_EXT 0x3305
+#define EGL_YUV_ORDER_YVYU_EXT 0x3306
+#define EGL_YUV_ORDER_VYUY_EXT 0x3307
+#define EGL_YUV_ORDER_AYUV_EXT 0x3308
+#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
+#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
+#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
+#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
+#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
+#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
+#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
+#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
+#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
+#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
+#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
+#endif /* EGL_EXT_yuv_surface */
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+ void *pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#endif
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI 0x8F70
+#define EGL_COLOR_RGB_HI 0x8F71
+#define EGL_COLOR_RGBA_HI 0x8F72
+#define EGL_COLOR_ARGB_HI 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif /* EGL_IMG_context_priority */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
+#define EGL_DRM_BUFFER_USE_MESA 0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA 0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+#endif /* EGL_MESA_drm_image */
+
+#ifndef EGL_MESA_image_dma_buf_export
+#define EGL_MESA_image_dma_buf_export 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#endif
+#endif /* EGL_MESA_image_dma_buf_export */
+
+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA 0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region */
+
+#ifndef EGL_NOK_swap_region2
+#define EGL_NOK_swap_region2 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region2 */
+
+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+#define EGL_Y_INVERTED_NOK 0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif /* EGL_NV_3dvision_surface */
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif /* EGL_NV_coverage_sample */
+
+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_cuda_event
+#define EGL_NV_cuda_event 1
+#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
+#define EGL_SYNC_CUDA_EVENT_NV 0x323C
+#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
+#endif /* EGL_NV_cuda_event */
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_device_cuda
+#define EGL_NV_device_cuda 1
+#define EGL_CUDA_DEVICE_NV 0x323A
+#endif /* EGL_NV_device_cuda */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#endif
+#endif /* EGL_NV_native_query */
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+#endif /* EGL_NV_post_sub_buffer */
+
+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV 0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#endif
+#endif /* EGL_NV_stream_sync */
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
+
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
+
+#ifndef EGL_TIZEN_image_native_buffer
+#define EGL_TIZEN_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
+#endif /* EGL_TIZEN_image_native_buffer */
+
+#ifndef EGL_TIZEN_image_native_surface
+#define EGL_TIZEN_image_native_surface 1
+#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
+#endif /* EGL_TIZEN_image_native_surface */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __eglext_h_ */
+
+
+#endif /* _MSC_VER */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_endian.h b/src/3rdparty/SDL2/include/SDL2/SDL_endian.h
new file mode 100644
index 0000000..ed0bf5b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_endian.h
@@ -0,0 +1,260 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_endian.h
+ *
+ * Functions for reading and writing endian-specific values
+ */
+
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
+
+#include "SDL_stdinc.h"
+
+/**
+ * \name The two types of endianness
+ */
+/* @{ */
+#define SDL_LIL_ENDIAN 1234
+#define SDL_BIG_ENDIAN 4321
+/* @} */
+
+#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
+#ifdef __linux__
+#include <endian.h>
+#define SDL_BYTEORDER __BYTE_ORDER
+#else /* __linux__ */
+#if defined(__hppa__) || \
+ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
+ (defined(__MIPS__) && defined(__MISPEB__)) || \
+ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
+ defined(__sparc__)
+#define SDL_BYTEORDER SDL_BIG_ENDIAN
+#else
+#define SDL_BYTEORDER SDL_LIL_ENDIAN
+#endif
+#endif /* __linux__ */
+#endif /* !SDL_BYTEORDER */
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_endian.h
+ */
+#if defined(__GNUC__) && defined(__i386__) && \
+ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ int result;
+
+ __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
+ return (Uint16)result;
+}
+#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
+ return x;
+}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+ "xchg al, ah" \
+ parm [ax] \
+ modify [ax];
+#else
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
+}
+#endif
+
+#if defined(__GNUC__) && defined(__i386__)
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ __asm__("bswap %0": "=r"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ __asm__("bswapl %0": "=r"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ Uint32 result;
+
+ __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
+ __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
+ __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
+ return result;
+}
+#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
+ return x;
+}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+ "bswap eax" \
+ parm [eax] \
+ modify [eax];
+#else /* 386-only */
+#pragma aux SDL_Swap32 = \
+ "xchg al, ah" \
+ "ror eax, 16" \
+ "xchg al, ah" \
+ parm [eax] \
+ modify [eax];
+#endif
+#else
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
+ ((x >> 8) & 0x0000FF00) | (x >> 24)));
+}
+#endif
+
+#if defined(__GNUC__) && defined(__i386__)
+SDL_FORCE_INLINE Uint64
+SDL_Swap64(Uint64 x)
+{
+ union
+ {
+ struct
+ {
+ Uint32 a, b;
+ } s;
+ Uint64 u;
+ } v;
+ v.u = x;
+ __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
+ "1"(v.s.
+ b));
+ return v.u;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+SDL_FORCE_INLINE Uint64
+SDL_Swap64(Uint64 x)
+{
+ __asm__("bswapq %0": "=r"(x):"0"(x));
+ return x;
+}
+#else
+SDL_FORCE_INLINE Uint64
+SDL_Swap64(Uint64 x)
+{
+ Uint32 hi, lo;
+
+ /* Separate into high and low 32-bit values and swap them */
+ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+ x >>= 32;
+ hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+ x = SDL_Swap32(lo);
+ x <<= 32;
+ x |= SDL_Swap32(hi);
+ return (x);
+}
+#endif
+
+
+SDL_FORCE_INLINE float
+SDL_SwapFloat(float x)
+{
+ union
+ {
+ float f;
+ Uint32 ui32;
+ } swapper;
+ swapper.f = x;
+ swapper.ui32 = SDL_Swap32(swapper.ui32);
+ return swapper.f;
+}
+
+
+/**
+ * \name Swap to native
+ * Byteswap item from the specified endianness to the native endianness.
+ */
+/* @{ */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define SDL_SwapLE16(X) (X)
+#define SDL_SwapLE32(X) (X)
+#define SDL_SwapLE64(X) (X)
+#define SDL_SwapFloatLE(X) (X)
+#define SDL_SwapBE16(X) SDL_Swap16(X)
+#define SDL_SwapBE32(X) SDL_Swap32(X)
+#define SDL_SwapBE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
+#else
+#define SDL_SwapLE16(X) SDL_Swap16(X)
+#define SDL_SwapLE32(X) SDL_Swap32(X)
+#define SDL_SwapLE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
+#define SDL_SwapBE16(X) (X)
+#define SDL_SwapBE32(X) (X)
+#define SDL_SwapBE64(X) (X)
+#define SDL_SwapFloatBE(X) (X)
+#endif
+/* @} *//* Swap to native */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_endian_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_error.h b/src/3rdparty/SDL2/include/SDL2/SDL_error.h
new file mode 100644
index 0000000..c0e4629
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_error.h
@@ -0,0 +1,76 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_error.h
+ *
+ * Simple error message routines for SDL.
+ */
+
+#ifndef SDL_error_h_
+#define SDL_error_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Public functions */
+/* SDL_SetError() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+extern DECLSPEC const char *SDLCALL SDL_GetError(void);
+extern DECLSPEC void SDLCALL SDL_ClearError(void);
+
+/**
+ * \name Internal error functions
+ *
+ * \internal
+ * Private error reporting function - used internally.
+ */
+/* @{ */
+#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
+#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
+#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
+typedef enum
+{
+ SDL_ENOMEM,
+ SDL_EFREAD,
+ SDL_EFWRITE,
+ SDL_EFSEEK,
+ SDL_UNSUPPORTED,
+ SDL_LASTERROR
+} SDL_errorcode;
+/* SDL_Error() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
+/* @} *//* Internal error functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_error_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_events.h b/src/3rdparty/SDL2/include/SDL2/SDL_events.h
new file mode 100644
index 0000000..3d39e6a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_events.h
@@ -0,0 +1,754 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_events.h
+ *
+ * Include file for SDL event handling.
+ */
+
+#ifndef SDL_events_h_
+#define SDL_events_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_keyboard.h"
+#include "SDL_mouse.h"
+#include "SDL_joystick.h"
+#include "SDL_gamecontroller.h"
+#include "SDL_quit.h"
+#include "SDL_gesture.h"
+#include "SDL_touch.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* General keyboard/mouse state definitions */
+#define SDL_RELEASED 0
+#define SDL_PRESSED 1
+
+/**
+ * \brief The types of events that can be delivered.
+ */
+typedef enum
+{
+ SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
+
+ /* Application events */
+ SDL_QUIT = 0x100, /**< User-requested quit */
+
+ /* These application events have special meaning on iOS, see README-ios.md for details */
+ SDL_APP_TERMINATING, /**< The application is being terminated by the OS
+ Called on iOS in applicationWillTerminate()
+ Called on Android in onDestroy()
+ */
+ SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
+ Called on iOS in applicationDidReceiveMemoryWarning()
+ Called on Android in onLowMemory()
+ */
+ SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
+ Called on iOS in applicationWillResignActive()
+ Called on Android in onPause()
+ */
+ SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
+ Called on iOS in applicationDidEnterBackground()
+ Called on Android in onPause()
+ */
+ SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
+ Called on iOS in applicationWillEnterForeground()
+ Called on Android in onResume()
+ */
+ SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
+ Called on iOS in applicationDidBecomeActive()
+ Called on Android in onResume()
+ */
+
+ /* Window events */
+ SDL_WINDOWEVENT = 0x200, /**< Window state change */
+ SDL_SYSWMEVENT, /**< System specific event */
+
+ /* Keyboard events */
+ SDL_KEYDOWN = 0x300, /**< Key pressed */
+ SDL_KEYUP, /**< Key released */
+ SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
+ SDL_TEXTINPUT, /**< Keyboard text input */
+ SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
+ input language or keyboard layout change.
+ */
+
+ /* Mouse events */
+ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
+ SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
+ SDL_MOUSEBUTTONUP, /**< Mouse button released */
+ SDL_MOUSEWHEEL, /**< Mouse wheel motion */
+
+ /* Joystick events */
+ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
+ SDL_JOYBALLMOTION, /**< Joystick trackball motion */
+ SDL_JOYHATMOTION, /**< Joystick hat position change */
+ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
+ SDL_JOYBUTTONUP, /**< Joystick button released */
+ SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
+ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
+
+ /* Game controller events */
+ SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
+ SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
+ SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
+ SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
+ SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
+ SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
+
+ /* Touch events */
+ SDL_FINGERDOWN = 0x700,
+ SDL_FINGERUP,
+ SDL_FINGERMOTION,
+
+ /* Gesture events */
+ SDL_DOLLARGESTURE = 0x800,
+ SDL_DOLLARRECORD,
+ SDL_MULTIGESTURE,
+
+ /* Clipboard events */
+ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
+
+ /* Drag and drop events */
+ SDL_DROPFILE = 0x1000, /**< The system requests a file open */
+ SDL_DROPTEXT, /**< text/plain drag-and-drop event */
+ SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
+ SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
+
+ /* Audio hotplug events */
+ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
+ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
+
+ /* Render events */
+ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
+ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
+
+ /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+ * and should be allocated with SDL_RegisterEvents()
+ */
+ SDL_USEREVENT = 0x8000,
+
+ /**
+ * This last event is only for bounding internal arrays
+ */
+ SDL_LASTEVENT = 0xFFFF
+} SDL_EventType;
+
+/**
+ * \brief Fields shared by every event
+ */
+typedef struct SDL_CommonEvent
+{
+ Uint32 type;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+} SDL_CommonEvent;
+
+/**
+ * \brief Window state change event data (event.window.*)
+ */
+typedef struct SDL_WindowEvent
+{
+ Uint32 type; /**< ::SDL_WINDOWEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The associated window */
+ Uint8 event; /**< ::SDL_WindowEventID */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint32 data1; /**< event dependent data */
+ Sint32 data2; /**< event dependent data */
+} SDL_WindowEvent;
+
+/**
+ * \brief Keyboard button event structure (event.key.*)
+ */
+typedef struct SDL_KeyboardEvent
+{
+ Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 repeat; /**< Non-zero if this is a key repeat */
+ Uint8 padding2;
+ Uint8 padding3;
+ SDL_Keysym keysym; /**< The key that was pressed or released */
+} SDL_KeyboardEvent;
+
+#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
+/**
+ * \brief Keyboard text editing event structure (event.edit.*)
+ */
+typedef struct SDL_TextEditingEvent
+{
+ Uint32 type; /**< ::SDL_TEXTEDITING */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
+ Sint32 start; /**< The start cursor of selected editing text */
+ Sint32 length; /**< The length of selected editing text */
+} SDL_TextEditingEvent;
+
+
+#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
+/**
+ * \brief Keyboard text input event structure (event.text.*)
+ */
+typedef struct SDL_TextInputEvent
+{
+ Uint32 type; /**< ::SDL_TEXTINPUT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
+} SDL_TextInputEvent;
+
+/**
+ * \brief Mouse motion event structure (event.motion.*)
+ */
+typedef struct SDL_MouseMotionEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Uint32 state; /**< The current button state */
+ Sint32 x; /**< X coordinate, relative to window */
+ Sint32 y; /**< Y coordinate, relative to window */
+ Sint32 xrel; /**< The relative motion in the X direction */
+ Sint32 yrel; /**< The relative motion in the Y direction */
+} SDL_MouseMotionEvent;
+
+/**
+ * \brief Mouse button event structure (event.button.*)
+ */
+typedef struct SDL_MouseButtonEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Uint8 button; /**< The mouse button index */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
+ Uint8 padding1;
+ Sint32 x; /**< X coordinate, relative to window */
+ Sint32 y; /**< Y coordinate, relative to window */
+} SDL_MouseButtonEvent;
+
+/**
+ * \brief Mouse wheel event structure (event.wheel.*)
+ */
+typedef struct SDL_MouseWheelEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEWHEEL */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
+ Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
+ Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
+} SDL_MouseWheelEvent;
+
+/**
+ * \brief Joystick axis motion event structure (event.jaxis.*)
+ */
+typedef struct SDL_JoyAxisEvent
+{
+ Uint32 type; /**< ::SDL_JOYAXISMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 axis; /**< The joystick axis index */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
+ Uint16 padding4;
+} SDL_JoyAxisEvent;
+
+/**
+ * \brief Joystick trackball motion event structure (event.jball.*)
+ */
+typedef struct SDL_JoyBallEvent
+{
+ Uint32 type; /**< ::SDL_JOYBALLMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 ball; /**< The joystick trackball index */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint16 xrel; /**< The relative motion in the X direction */
+ Sint16 yrel; /**< The relative motion in the Y direction */
+} SDL_JoyBallEvent;
+
+/**
+ * \brief Joystick hat position change event structure (event.jhat.*)
+ */
+typedef struct SDL_JoyHatEvent
+{
+ Uint32 type; /**< ::SDL_JOYHATMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 hat; /**< The joystick hat index */
+ Uint8 value; /**< The hat position value.
+ * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
+ * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
+ * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
+ *
+ * Note that zero means the POV is centered.
+ */
+ Uint8 padding1;
+ Uint8 padding2;
+} SDL_JoyHatEvent;
+
+/**
+ * \brief Joystick button event structure (event.jbutton.*)
+ */
+typedef struct SDL_JoyButtonEvent
+{
+ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 button; /**< The joystick button index */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
+ Uint8 padding2;
+} SDL_JoyButtonEvent;
+
+/**
+ * \brief Joystick device event structure (event.jdevice.*)
+ */
+typedef struct SDL_JoyDeviceEvent
+{
+ Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
+} SDL_JoyDeviceEvent;
+
+
+/**
+ * \brief Game controller axis motion event structure (event.caxis.*)
+ */
+typedef struct SDL_ControllerAxisEvent
+{
+ Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
+ Uint16 padding4;
+} SDL_ControllerAxisEvent;
+
+
+/**
+ * \brief Game controller button event structure (event.cbutton.*)
+ */
+typedef struct SDL_ControllerButtonEvent
+{
+ Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 button; /**< The controller button (SDL_GameControllerButton) */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
+ Uint8 padding2;
+} SDL_ControllerButtonEvent;
+
+
+/**
+ * \brief Controller device event structure (event.cdevice.*)
+ */
+typedef struct SDL_ControllerDeviceEvent
+{
+ Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
+} SDL_ControllerDeviceEvent;
+
+/**
+ * \brief Audio device event structure (event.adevice.*)
+ */
+typedef struct SDL_AudioDeviceEvent
+{
+ Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
+ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+} SDL_AudioDeviceEvent;
+
+
+/**
+ * \brief Touch finger event structure (event.tfinger.*)
+ */
+typedef struct SDL_TouchFingerEvent
+{
+ Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
+ SDL_FingerID fingerId;
+ float x; /**< Normalized in the range 0...1 */
+ float y; /**< Normalized in the range 0...1 */
+ float dx; /**< Normalized in the range -1...1 */
+ float dy; /**< Normalized in the range -1...1 */
+ float pressure; /**< Normalized in the range 0...1 */
+} SDL_TouchFingerEvent;
+
+
+/**
+ * \brief Multiple Finger Gesture Event (event.mgesture.*)
+ */
+typedef struct SDL_MultiGestureEvent
+{
+ Uint32 type; /**< ::SDL_MULTIGESTURE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
+ float dTheta;
+ float dDist;
+ float x;
+ float y;
+ Uint16 numFingers;
+ Uint16 padding;
+} SDL_MultiGestureEvent;
+
+
+/**
+ * \brief Dollar Gesture Event (event.dgesture.*)
+ */
+typedef struct SDL_DollarGestureEvent
+{
+ Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
+ SDL_GestureID gestureId;
+ Uint32 numFingers;
+ float error;
+ float x; /**< Normalized center of gesture */
+ float y; /**< Normalized center of gesture */
+} SDL_DollarGestureEvent;
+
+
+/**
+ * \brief An event used to request a file open by the system (event.drop.*)
+ * This event is enabled by default, you can disable it with SDL_EventState().
+ * \note If this event is enabled, you must free the filename in the event.
+ */
+typedef struct SDL_DropEvent
+{
+ Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
+ Uint32 windowID; /**< The window that was dropped on, if any */
+} SDL_DropEvent;
+
+
+/**
+ * \brief The "quit requested" event
+ */
+typedef struct SDL_QuitEvent
+{
+ Uint32 type; /**< ::SDL_QUIT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+} SDL_QuitEvent;
+
+/**
+ * \brief OS Specific event
+ */
+typedef struct SDL_OSEvent
+{
+ Uint32 type; /**< ::SDL_QUIT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+} SDL_OSEvent;
+
+/**
+ * \brief A user-defined event type (event.user.*)
+ */
+typedef struct SDL_UserEvent
+{
+ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The associated window if any */
+ Sint32 code; /**< User defined event code */
+ void *data1; /**< User defined data pointer */
+ void *data2; /**< User defined data pointer */
+} SDL_UserEvent;
+
+
+struct SDL_SysWMmsg;
+typedef struct SDL_SysWMmsg SDL_SysWMmsg;
+
+/**
+ * \brief A video driver dependent system event (event.syswm.*)
+ * This event is disabled by default, you can enable it with SDL_EventState()
+ *
+ * \note If you want to use this event, you should include SDL_syswm.h.
+ */
+typedef struct SDL_SysWMEvent
+{
+ Uint32 type; /**< ::SDL_SYSWMEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
+} SDL_SysWMEvent;
+
+/**
+ * \brief General event structure
+ */
+typedef union SDL_Event
+{
+ Uint32 type; /**< Event type, shared with all events */
+ SDL_CommonEvent common; /**< Common event data */
+ SDL_WindowEvent window; /**< Window event data */
+ SDL_KeyboardEvent key; /**< Keyboard event data */
+ SDL_TextEditingEvent edit; /**< Text editing event data */
+ SDL_TextInputEvent text; /**< Text input event data */
+ SDL_MouseMotionEvent motion; /**< Mouse motion event data */
+ SDL_MouseButtonEvent button; /**< Mouse button event data */
+ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
+ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
+ SDL_JoyBallEvent jball; /**< Joystick ball event data */
+ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
+ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
+ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
+ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
+ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
+ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
+ SDL_AudioDeviceEvent adevice; /**< Audio device event data */
+ SDL_QuitEvent quit; /**< Quit request event data */
+ SDL_UserEvent user; /**< Custom event data */
+ SDL_SysWMEvent syswm; /**< System dependent window event data */
+ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
+ SDL_MultiGestureEvent mgesture; /**< Gesture event data */
+ SDL_DollarGestureEvent dgesture; /**< Gesture event data */
+ SDL_DropEvent drop; /**< Drag and drop event data */
+
+ /* This is necessary for ABI compatibility between Visual C++ and GCC
+ Visual C++ will respect the push pack pragma and use 52 bytes for
+ this structure, and GCC will use the alignment of the largest datatype
+ within the union, which is 8 bytes.
+
+ So... we'll add padding to force the size to be 56 bytes for both.
+ */
+ Uint8 padding[56];
+} SDL_Event;
+
+
+/* Function prototypes */
+
+/**
+ * Pumps the event loop, gathering events from the input devices.
+ *
+ * This function updates the event queue and internal input device state.
+ *
+ * This should only be run in the thread that sets the video mode.
+ */
+extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
+
+/* @{ */
+typedef enum
+{
+ SDL_ADDEVENT,
+ SDL_PEEKEVENT,
+ SDL_GETEVENT
+} SDL_eventaction;
+
+/**
+ * Checks the event queue for messages and optionally returns them.
+ *
+ * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
+ * the back of the event queue.
+ *
+ * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
+ * of the event queue, within the specified minimum and maximum type,
+ * will be returned and will not be removed from the queue.
+ *
+ * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
+ * of the event queue, within the specified minimum and maximum type,
+ * will be returned and will be removed from the queue.
+ *
+ * \return The number of events actually stored, or -1 if there was an error.
+ *
+ * This function is thread-safe.
+ */
+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
+ SDL_eventaction action,
+ Uint32 minType, Uint32 maxType);
+/* @} */
+
+/**
+ * Checks to see if certain event types are in the event queue.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ * This function clears events from the event queue
+ * This function only affects currently queued events. If you want to make
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
+ * on the main thread immediately before the flush call.
+ */
+extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
+extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ * \brief Polls for currently pending events.
+ *
+ * \return 1 if there are any pending events, or 0 if there are none available.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
+
+/**
+ * \brief Waits indefinitely for the next available event.
+ *
+ * \return 1, or 0 if there was an error while waiting for events.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
+
+/**
+ * \brief Waits until the specified timeout (in milliseconds) for the next
+ * available event.
+ *
+ * \return 1, or 0 if there was an error while waiting for events.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ * \param timeout The timeout (in milliseconds) to wait for next event.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
+ int timeout);
+
+/**
+ * \brief Add an event to the event queue.
+ *
+ * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
+ * was full or there was some other error.
+ */
+extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
+
+typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
+
+/**
+ * Sets up a filter to process all events before they change internal state and
+ * are posted to the internal event queue.
+ *
+ * The filter is prototyped as:
+ * \code
+ * int SDL_EventFilter(void *userdata, SDL_Event * event);
+ * \endcode
+ *
+ * If the filter returns 1, then the event will be added to the internal queue.
+ * If it returns 0, then the event will be dropped from the queue, but the
+ * internal state will still be updated. This allows selective filtering of
+ * dynamically arriving events.
+ *
+ * \warning Be very careful of what you do in the event filter function, as
+ * it may run in a different thread!
+ *
+ * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
+ * event filter is only called when the window manager desires to close the
+ * application window. If the event filter returns 1, then the window will
+ * be closed, otherwise the window will remain open if possible.
+ *
+ * If the quit event is generated by an interrupt signal, it will bypass the
+ * internal queue and be delivered to the application at the next event poll.
+ */
+extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
+ void *userdata);
+
+/**
+ * Return the current event filter - can be used to "chain" filters.
+ * If there is no event filter set, this function returns SDL_FALSE.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
+ void **userdata);
+
+/**
+ * Add a function which is called when an event is added to the queue.
+ */
+extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
+ void *userdata);
+
+/**
+ * Remove an event watch function added with SDL_AddEventWatch()
+ */
+extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
+ void *userdata);
+
+/**
+ * Run the filter function on the current event queue, removing any
+ * events for which the filter returns 0.
+ */
+extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
+ void *userdata);
+
+/* @{ */
+#define SDL_QUERY -1
+#define SDL_IGNORE 0
+#define SDL_DISABLE 0
+#define SDL_ENABLE 1
+
+/**
+ * This function allows you to set the state of processing certain events.
+ * - If \c state is set to ::SDL_IGNORE, that event will be automatically
+ * dropped from the event queue and will not be filtered.
+ * - If \c state is set to ::SDL_ENABLE, that event will be processed
+ * normally.
+ * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
+ * current processing state of the specified event.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
+/* @} */
+#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
+
+/**
+ * This function allocates a set of user-defined events, and returns
+ * the beginning event number for that set of events.
+ *
+ * If there aren't enough user-defined events left, this function
+ * returns (Uint32)-1
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_events_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_filesystem.h b/src/3rdparty/SDL2/include/SDL2/SDL_filesystem.h
new file mode 100644
index 0000000..fa6a1fa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_filesystem.h
@@ -0,0 +1,136 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_filesystem.h
+ *
+ * \brief Include file for filesystem SDL API functions
+ */
+
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Get the path where the application resides.
+ *
+ * Get the "base path". This is the directory where the application was run
+ * from, which is probably the installation directory, and may or may not
+ * be the process's current working directory.
+ *
+ * This returns an absolute path in UTF-8 encoding, and is guaranteed to
+ * end with a path separator ('\\' on Windows, '/' most other places).
+ *
+ * The pointer returned by this function is owned by you. Please call
+ * SDL_free() on the pointer when you are done with it, or it will be a
+ * memory leak. This is not necessarily a fast call, though, so you should
+ * call this once near startup and save the string if you need it.
+ *
+ * Some platforms can't determine the application's path, and on other
+ * platforms, this might be meaningless. In such cases, this function will
+ * return NULL.
+ *
+ * \return String of base dir in UTF-8 encoding, or NULL on error.
+ *
+ * \sa SDL_GetPrefPath
+ */
+extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
+
+/**
+ * \brief Get the user-and-app-specific path where files can be written.
+ *
+ * Get the "pref dir". This is meant to be where users can write personal
+ * files (preferences and save games, etc) that are specific to your
+ * application. This directory is unique per user, per application.
+ *
+ * This function will decide the appropriate location in the native filesystem,
+ * create the directory if necessary, and return a string of the absolute
+ * path to the directory in UTF-8 encoding.
+ *
+ * On Windows, the string might look like:
+ * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
+ *
+ * On Linux, the string might look like:
+ * "/home/bob/.local/share/My Program Name/"
+ *
+ * On Mac OS X, the string might look like:
+ * "/Users/bob/Library/Application Support/My Program Name/"
+ *
+ * (etc.)
+ *
+ * You specify the name of your organization (if it's not a real organization,
+ * your name or an Internet domain you own might do) and the name of your
+ * application. These should be untranslated proper names.
+ *
+ * Both the org and app strings may become part of a directory name, so
+ * please follow these rules:
+ *
+ * - Try to use the same org string (including case-sensitivity) for
+ * all your applications that use this function.
+ * - Always use a unique app string for each one, and make sure it never
+ * changes for an app once you've decided on it.
+ * - Unicode characters are legal, as long as it's UTF-8 encoded, but...
+ * - ...only use letters, numbers, and spaces. Avoid punctuation like
+ * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
+ *
+ * This returns an absolute path in UTF-8 encoding, and is guaranteed to
+ * end with a path separator ('\\' on Windows, '/' most other places).
+ *
+ * The pointer returned by this function is owned by you. Please call
+ * SDL_free() on the pointer when you are done with it, or it will be a
+ * memory leak. This is not necessarily a fast call, though, so you should
+ * call this once near startup and save the string if you need it.
+ *
+ * You should assume the path returned by this function is the only safe
+ * place to write files (and that SDL_GetBasePath(), while it might be
+ * writable, or even the parent of the returned path, aren't where you
+ * should be writing things).
+ *
+ * Some platforms can't determine the pref path, and on other
+ * platforms, this might be meaningless. In such cases, this function will
+ * return NULL.
+ *
+ * \param org The name of your organization.
+ * \param app The name of your application.
+ * \return UTF-8 string of user dir in platform-dependent notation. NULL
+ * if there's a problem (creating directory failed, etc).
+ *
+ * \sa SDL_GetBasePath
+ */
+extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_filesystem_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_gamecontroller.h b/src/3rdparty/SDL2/include/SDL2/SDL_gamecontroller.h
new file mode 100644
index 0000000..2e024be
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_gamecontroller.h
@@ -0,0 +1,362 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_gamecontroller.h
+ *
+ * Include file for SDL game controller event handling
+ */
+
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_rwops.h"
+#include "SDL_joystick.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_gamecontroller.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
+ * for game controllers, and load appropriate drivers.
+ *
+ * If you would like to receive controller updates while the application
+ * is in the background, you should set the following hint before calling
+ * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
+ */
+
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
+struct _SDL_GameController;
+typedef struct _SDL_GameController SDL_GameController;
+
+
+typedef enum
+{
+ SDL_CONTROLLER_BINDTYPE_NONE = 0,
+ SDL_CONTROLLER_BINDTYPE_BUTTON,
+ SDL_CONTROLLER_BINDTYPE_AXIS,
+ SDL_CONTROLLER_BINDTYPE_HAT
+} SDL_GameControllerBindType;
+
+/**
+ * Get the SDL joystick layer binding for this controller button/axis mapping
+ */
+typedef struct SDL_GameControllerButtonBind
+{
+ SDL_GameControllerBindType bindType;
+ union
+ {
+ int button;
+ int axis;
+ struct {
+ int hat;
+ int hat_mask;
+ } hat;
+ } value;
+
+} SDL_GameControllerButtonBind;
+
+
+/**
+ * To count the number of game controllers in the system for the following:
+ * int nJoysticks = SDL_NumJoysticks();
+ * int nGameControllers = 0;
+ * for (int i = 0; i < nJoysticks; i++) {
+ * if (SDL_IsGameController(i)) {
+ * nGameControllers++;
+ * }
+ * }
+ *
+ * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
+ * guid,name,mappings
+ *
+ * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
+ * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
+ * The mapping format for joystick is:
+ * bX - a joystick button, index X
+ * hX.Y - hat X with value Y
+ * aX - axis X of the joystick
+ * Buttons can be used as a controller axis and vice versa.
+ *
+ * This string shows an example of a valid mapping for a controller
+ * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
+ *
+ */
+
+/**
+ * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform()
+ * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
+ *
+ * If \c freerw is non-zero, the stream will be closed after being read.
+ *
+ * \return number of mappings added, -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
+
+/**
+ * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
+ *
+ * Convenience macro.
+ */
+#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
+
+/**
+ * Add or update an existing mapping configuration
+ *
+ * \return 1 if mapping is added, 0 if updated, -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
+
+/**
+ * Get the number of mappings installed
+ *
+ * \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ * Get the mapping at a particular index.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
+
+/**
+ * Get a mapping string for a GUID
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
+
+/**
+ * Get a mapping string for an open GameController
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
+
+/**
+ * Is the joystick on this index supported by the game controller interface?
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
+
+/**
+ * Get the implementation dependent name of a game controller.
+ * This can be called before any controllers are opened.
+ * If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
+
+/**
+ * Open a game controller for use.
+ * The index passed as an argument refers to the N'th game controller on the system.
+ * This index is not the value which will identify this controller in future
+ * controller events. The joystick's instance id (::SDL_JoystickID) will be
+ * used there instead.
+ *
+ * \return A controller identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
+
+/**
+ * Return the SDL_GameController associated with an instance id.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
+
+/**
+ * Return the name for this currently opened controller
+ */
+extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
+
+/**
+ * Get the USB vendor ID of an opened controller, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
+
+/**
+ * Get the USB product ID of an opened controller, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
+
+/**
+ * Get the product version of an opened controller, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
+
+/**
+ * Returns SDL_TRUE if the controller has been opened and currently connected,
+ * or SDL_FALSE if it has not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
+
+/**
+ * Get the underlying joystick object used by a controller
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
+
+/**
+ * Enable/disable controller event polling.
+ *
+ * If controller events are disabled, you must call SDL_GameControllerUpdate()
+ * yourself and check the state of the controller when you want controller
+ * information.
+ *
+ * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
+
+/**
+ * Update the current state of the open game controllers.
+ *
+ * This is called automatically by the event loop if any game controller
+ * events are enabled.
+ */
+extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
+
+
+/**
+ * The list of axes available from a controller
+ *
+ * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ * and are centered within ~8000 of zero, though advanced UI will allow users to set
+ * or autodetect the dead zone, which varies between controllers.
+ *
+ * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
+ */
+typedef enum
+{
+ SDL_CONTROLLER_AXIS_INVALID = -1,
+ SDL_CONTROLLER_AXIS_LEFTX,
+ SDL_CONTROLLER_AXIS_LEFTY,
+ SDL_CONTROLLER_AXIS_RIGHTX,
+ SDL_CONTROLLER_AXIS_RIGHTY,
+ SDL_CONTROLLER_AXIS_TRIGGERLEFT,
+ SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
+ SDL_CONTROLLER_AXIS_MAX
+} SDL_GameControllerAxis;
+
+/**
+ * turn this string into a axis mapping
+ */
+extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
+
+/**
+ * turn this axis enum into a string mapping
+ */
+extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
+
+/**
+ * Get the SDL joystick layer binding for this controller button mapping
+ */
+extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
+SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
+ SDL_GameControllerAxis axis);
+
+/**
+ * Get the current state of an axis control on a game controller.
+ *
+ * The state is a value ranging from -32768 to 32767 (except for the triggers,
+ * which range from 0 to 32767).
+ *
+ * The axis indices start at index 0.
+ */
+extern DECLSPEC Sint16 SDLCALL
+SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
+ SDL_GameControllerAxis axis);
+
+/**
+ * The list of buttons available from a controller
+ */
+typedef enum
+{
+ SDL_CONTROLLER_BUTTON_INVALID = -1,
+ SDL_CONTROLLER_BUTTON_A,
+ SDL_CONTROLLER_BUTTON_B,
+ SDL_CONTROLLER_BUTTON_X,
+ SDL_CONTROLLER_BUTTON_Y,
+ SDL_CONTROLLER_BUTTON_BACK,
+ SDL_CONTROLLER_BUTTON_GUIDE,
+ SDL_CONTROLLER_BUTTON_START,
+ SDL_CONTROLLER_BUTTON_LEFTSTICK,
+ SDL_CONTROLLER_BUTTON_RIGHTSTICK,
+ SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
+ SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
+ SDL_CONTROLLER_BUTTON_DPAD_UP,
+ SDL_CONTROLLER_BUTTON_DPAD_DOWN,
+ SDL_CONTROLLER_BUTTON_DPAD_LEFT,
+ SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
+ SDL_CONTROLLER_BUTTON_MAX
+} SDL_GameControllerButton;
+
+/**
+ * turn this string into a button mapping
+ */
+extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
+
+/**
+ * turn this button enum into a string mapping
+ */
+extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
+
+/**
+ * Get the SDL joystick layer binding for this controller button mapping
+ */
+extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
+SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
+ SDL_GameControllerButton button);
+
+
+/**
+ * Get the current state of a button on a game controller.
+ *
+ * The button indices start at index 0.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
+ SDL_GameControllerButton button);
+
+/**
+ * Close a controller previously opened with SDL_GameControllerOpen().
+ */
+extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_gamecontroller_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_gesture.h b/src/3rdparty/SDL2/include/SDL2/SDL_gesture.h
new file mode 100644
index 0000000..b223d80
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_gesture.h
@@ -0,0 +1,87 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_gesture.h
+ *
+ * Include file for SDL gesture event handling.
+ */
+
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "SDL_touch.h"
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef Sint64 SDL_GestureID;
+
+/* Function prototypes */
+
+/**
+ * \brief Begin Recording a gesture on the specified touch, or all touches (-1)
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
+
+
+/**
+ * \brief Save all currently loaded Dollar Gesture templates
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
+
+/**
+ * \brief Save a currently loaded Dollar Gesture template
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
+
+
+/**
+ * \brief Load Dollar Gesture templates from a file
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_gesture_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_haptic.h b/src/3rdparty/SDL2/include/SDL2/SDL_haptic.h
new file mode 100644
index 0000000..e3a2bca
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_haptic.h
@@ -0,0 +1,1227 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_haptic.h
+ *
+ * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
+ * devices.
+ *
+ * The basic usage is as follows:
+ * - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ * - Open a haptic device.
+ * - SDL_HapticOpen() to open from index.
+ * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
+ * - Create an effect (::SDL_HapticEffect).
+ * - Upload the effect with SDL_HapticNewEffect().
+ * - Run the effect with SDL_HapticRunEffect().
+ * - (optional) Free the effect with SDL_HapticDestroyEffect().
+ * - Close the haptic device with SDL_HapticClose().
+ *
+ * \par Simple rumble example:
+ * \code
+ * SDL_Haptic *haptic;
+ *
+ * // Open the device
+ * haptic = SDL_HapticOpen( 0 );
+ * if (haptic == NULL)
+ * return -1;
+ *
+ * // Initialize simple rumble
+ * if (SDL_HapticRumbleInit( haptic ) != 0)
+ * return -1;
+ *
+ * // Play effect at 50% strength for 2 seconds
+ * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
+ * return -1;
+ * SDL_Delay( 2000 );
+ *
+ * // Clean up
+ * SDL_HapticClose( haptic );
+ * \endcode
+ *
+ * \par Complete example:
+ * \code
+ * int test_haptic( SDL_Joystick * joystick ) {
+ * SDL_Haptic *haptic;
+ * SDL_HapticEffect effect;
+ * int effect_id;
+ *
+ * // Open the device
+ * haptic = SDL_HapticOpenFromJoystick( joystick );
+ * if (haptic == NULL) return -1; // Most likely joystick isn't haptic
+ *
+ * // See if it can do sine waves
+ * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
+ * SDL_HapticClose(haptic); // No sine effect
+ * return -1;
+ * }
+ *
+ * // Create the effect
+ * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
+ * effect.type = SDL_HAPTIC_SINE;
+ * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
+ * effect.periodic.direction.dir[0] = 18000; // Force comes from south
+ * effect.periodic.period = 1000; // 1000 ms
+ * effect.periodic.magnitude = 20000; // 20000/32767 strength
+ * effect.periodic.length = 5000; // 5 seconds long
+ * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
+ * effect.periodic.fade_length = 1000; // Takes 1 second to fade away
+ *
+ * // Upload the effect
+ * effect_id = SDL_HapticNewEffect( haptic, &effect );
+ *
+ * // Test the effect
+ * SDL_HapticRunEffect( haptic, effect_id, 1 );
+ * SDL_Delay( 5000); // Wait for the effect to finish
+ *
+ * // We destroy the effect, although closing the device also does this
+ * SDL_HapticDestroyEffect( haptic, effect_id );
+ *
+ * // Close the device
+ * SDL_HapticClose(haptic);
+ *
+ * return 0; // Success
+ * }
+ * \endcode
+ */
+
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_joystick.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \typedef SDL_Haptic
+ *
+ * \brief The haptic structure used to identify an SDL haptic.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticOpenFromJoystick
+ * \sa SDL_HapticClose
+ */
+struct _SDL_Haptic;
+typedef struct _SDL_Haptic SDL_Haptic;
+
+
+/**
+ * \name Haptic features
+ *
+ * Different haptic features a device can have.
+ */
+/* @{ */
+
+/**
+ * \name Haptic effects
+ */
+/* @{ */
+
+/**
+ * \brief Constant effect supported.
+ *
+ * Constant haptic effect.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_CONSTANT (1u<<0)
+
+/**
+ * \brief Sine wave effect supported.
+ *
+ * Periodic haptic effect that simulates sine waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SINE (1u<<1)
+
+/**
+ * \brief Left/Right effect supported.
+ *
+ * Haptic effect for direct control over high/low frequency motors.
+ *
+ * \sa SDL_HapticLeftRight
+ * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
+ * we ran out of bits, and this is important for XInput devices.
+ */
+#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
+
+/* !!! FIXME: put this back when we have more bits in 2.1 */
+/* #define SDL_HAPTIC_SQUARE (1<<2) */
+
+/**
+ * \brief Triangle wave effect supported.
+ *
+ * Periodic haptic effect that simulates triangular waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_TRIANGLE (1u<<3)
+
+/**
+ * \brief Sawtoothup wave effect supported.
+ *
+ * Periodic haptic effect that simulates saw tooth up waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
+
+/**
+ * \brief Sawtoothdown wave effect supported.
+ *
+ * Periodic haptic effect that simulates saw tooth down waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
+
+/**
+ * \brief Ramp effect supported.
+ *
+ * Ramp haptic effect.
+ *
+ * \sa SDL_HapticRamp
+ */
+#define SDL_HAPTIC_RAMP (1u<<6)
+
+/**
+ * \brief Spring effect supported - uses axes position.
+ *
+ * Condition haptic effect that simulates a spring. Effect is based on the
+ * axes position.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_SPRING (1u<<7)
+
+/**
+ * \brief Damper effect supported - uses axes velocity.
+ *
+ * Condition haptic effect that simulates dampening. Effect is based on the
+ * axes velocity.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_DAMPER (1u<<8)
+
+/**
+ * \brief Inertia effect supported - uses axes acceleration.
+ *
+ * Condition haptic effect that simulates inertia. Effect is based on the axes
+ * acceleration.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_INERTIA (1u<<9)
+
+/**
+ * \brief Friction effect supported - uses axes movement.
+ *
+ * Condition haptic effect that simulates friction. Effect is based on the
+ * axes movement.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_FRICTION (1u<<10)
+
+/**
+ * \brief Custom effect is supported.
+ *
+ * User defined custom haptic effect.
+ */
+#define SDL_HAPTIC_CUSTOM (1u<<11)
+
+/* @} *//* Haptic effects */
+
+/* These last few are features the device has, not effects */
+
+/**
+ * \brief Device can set global gain.
+ *
+ * Device supports setting the global gain.
+ *
+ * \sa SDL_HapticSetGain
+ */
+#define SDL_HAPTIC_GAIN (1u<<12)
+
+/**
+ * \brief Device can set autocenter.
+ *
+ * Device supports setting autocenter.
+ *
+ * \sa SDL_HapticSetAutocenter
+ */
+#define SDL_HAPTIC_AUTOCENTER (1u<<13)
+
+/**
+ * \brief Device can be queried for effect status.
+ *
+ * Device supports querying effect status.
+ *
+ * \sa SDL_HapticGetEffectStatus
+ */
+#define SDL_HAPTIC_STATUS (1u<<14)
+
+/**
+ * \brief Device can be paused.
+ *
+ * Devices supports being paused.
+ *
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticUnpause
+ */
+#define SDL_HAPTIC_PAUSE (1u<<15)
+
+
+/**
+ * \name Direction encodings
+ */
+/* @{ */
+
+/**
+ * \brief Uses polar coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_POLAR 0
+
+/**
+ * \brief Uses cartesian coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_CARTESIAN 1
+
+/**
+ * \brief Uses spherical coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_SPHERICAL 2
+
+/* @} *//* Direction encodings */
+
+/* @} *//* Haptic features */
+
+/*
+ * Misc defines.
+ */
+
+/**
+ * \brief Used to play a device an infinite number of times.
+ *
+ * \sa SDL_HapticRunEffect
+ */
+#define SDL_HAPTIC_INFINITY 4294967295U
+
+
+/**
+ * \brief Structure that represents a haptic direction.
+ *
+ * This is the direction where the force comes from,
+ * instead of the direction in which the force is exerted.
+ *
+ * Directions can be specified by:
+ * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
+ * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
+ * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
+ *
+ * Cardinal directions of the haptic device are relative to the positioning
+ * of the device. North is considered to be away from the user.
+ *
+ * The following diagram represents the cardinal directions:
+ * \verbatim
+ .--.
+ |__| .-------.
+ |=.| |.-----.|
+ |--| || ||
+ | | |'-----'|
+ |__|~')_____('
+ [ COMPUTER ]
+
+
+ North (0,-1)
+ ^
+ |
+ |
+ (-1,0) West <----[ HAPTIC ]----> East (1,0)
+ |
+ |
+ v
+ South (0,1)
+
+
+ [ USER ]
+ \|||/
+ (o o)
+ ---ooO-(_)-Ooo---
+ \endverbatim
+ *
+ * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
+ * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
+ * the first \c dir parameter. The cardinal directions would be:
+ * - North: 0 (0 degrees)
+ * - East: 9000 (90 degrees)
+ * - South: 18000 (180 degrees)
+ * - West: 27000 (270 degrees)
+ *
+ * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
+ * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
+ * the first three \c dir parameters. The cardinal directions would be:
+ * - North: 0,-1, 0
+ * - East: 1, 0, 0
+ * - South: 0, 1, 0
+ * - West: -1, 0, 0
+ *
+ * The Z axis represents the height of the effect if supported, otherwise
+ * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
+ * can use any multiple you want, only the direction matters.
+ *
+ * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
+ * The first two \c dir parameters are used. The \c dir parameters are as
+ * follows (all values are in hundredths of degrees):
+ * - Degrees from (1, 0) rotated towards (0, 1).
+ * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
+ *
+ *
+ * Example of force coming from the south with all encodings (force coming
+ * from the south means the user will have to pull the stick to counteract):
+ * \code
+ * SDL_HapticDirection direction;
+ *
+ * // Cartesian directions
+ * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
+ * direction.dir[0] = 0; // X position
+ * direction.dir[1] = 1; // Y position
+ * // Assuming the device has 2 axes, we don't need to specify third parameter.
+ *
+ * // Polar directions
+ * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
+ * direction.dir[0] = 18000; // Polar only uses first parameter
+ *
+ * // Spherical coordinates
+ * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
+ * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
+ * \endcode
+ *
+ * \sa SDL_HAPTIC_POLAR
+ * \sa SDL_HAPTIC_CARTESIAN
+ * \sa SDL_HAPTIC_SPHERICAL
+ * \sa SDL_HapticEffect
+ * \sa SDL_HapticNumAxes
+ */
+typedef struct SDL_HapticDirection
+{
+ Uint8 type; /**< The type of encoding. */
+ Sint32 dir[3]; /**< The encoded direction. */
+} SDL_HapticDirection;
+
+
+/**
+ * \brief A structure containing a template for a Constant effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
+ *
+ * A constant effect applies a constant force in the specified direction
+ * to the joystick.
+ *
+ * \sa SDL_HAPTIC_CONSTANT
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticConstant
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Constant */
+ Sint16 level; /**< Strength of the constant effect. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticConstant;
+
+/**
+ * \brief A structure containing a template for a Periodic effect.
+ *
+ * The struct handles the following effects:
+ * - ::SDL_HAPTIC_SINE
+ * - ::SDL_HAPTIC_LEFTRIGHT
+ * - ::SDL_HAPTIC_TRIANGLE
+ * - ::SDL_HAPTIC_SAWTOOTHUP
+ * - ::SDL_HAPTIC_SAWTOOTHDOWN
+ *
+ * A periodic effect consists in a wave-shaped effect that repeats itself
+ * over time. The type determines the shape of the wave and the parameters
+ * determine the dimensions of the wave.
+ *
+ * Phase is given by hundredth of a degree meaning that giving the phase a value
+ * of 9000 will displace it 25% of its period. Here are sample values:
+ * - 0: No phase displacement.
+ * - 9000: Displaced 25% of its period.
+ * - 18000: Displaced 50% of its period.
+ * - 27000: Displaced 75% of its period.
+ * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
+ *
+ * Examples:
+ * \verbatim
+ SDL_HAPTIC_SINE
+ __ __ __ __
+ / \ / \ / \ /
+ / \__/ \__/ \__/
+
+ SDL_HAPTIC_SQUARE
+ __ __ __ __ __
+ | | | | | | | | | |
+ | |__| |__| |__| |__| |
+
+ SDL_HAPTIC_TRIANGLE
+ /\ /\ /\ /\ /\
+ / \ / \ / \ / \ /
+ / \/ \/ \/ \/
+
+ SDL_HAPTIC_SAWTOOTHUP
+ /| /| /| /| /| /| /|
+ / | / | / | / | / | / | / |
+ / |/ |/ |/ |/ |/ |/ |
+
+ SDL_HAPTIC_SAWTOOTHDOWN
+ \ |\ |\ |\ |\ |\ |\ |
+ \ | \ | \ | \ | \ | \ | \ |
+ \| \| \| \| \| \| \|
+ \endverbatim
+ *
+ * \sa SDL_HAPTIC_SINE
+ * \sa SDL_HAPTIC_LEFTRIGHT
+ * \sa SDL_HAPTIC_TRIANGLE
+ * \sa SDL_HAPTIC_SAWTOOTHUP
+ * \sa SDL_HAPTIC_SAWTOOTHDOWN
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticPeriodic
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
+ ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
+ ::SDL_HAPTIC_SAWTOOTHDOWN */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Periodic */
+ Uint16 period; /**< Period of the wave. */
+ Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
+ Sint16 offset; /**< Mean value of the wave. */
+ Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticPeriodic;
+
+/**
+ * \brief A structure containing a template for a Condition effect.
+ *
+ * The struct handles the following effects:
+ * - ::SDL_HAPTIC_SPRING: Effect based on axes position.
+ * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
+ * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
+ * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
+ *
+ * Direction is handled by condition internals instead of a direction member.
+ * The condition effect specific members have three parameters. The first
+ * refers to the X axis, the second refers to the Y axis and the third
+ * refers to the Z axis. The right terms refer to the positive side of the
+ * axis and the left terms refer to the negative side of the axis. Please
+ * refer to the ::SDL_HapticDirection diagram for which side is positive and
+ * which is negative.
+ *
+ * \sa SDL_HapticDirection
+ * \sa SDL_HAPTIC_SPRING
+ * \sa SDL_HAPTIC_DAMPER
+ * \sa SDL_HAPTIC_INERTIA
+ * \sa SDL_HAPTIC_FRICTION
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticCondition
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
+ ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
+ SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Condition */
+ Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */
+ Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */
+ Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
+ Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
+ Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
+ Sint16 center[3]; /**< Position of the dead zone. */
+} SDL_HapticCondition;
+
+/**
+ * \brief A structure containing a template for a Ramp effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
+ *
+ * The ramp effect starts at start strength and ends at end strength.
+ * It augments in linear fashion. If you use attack and fade with a ramp
+ * the effects get added to the ramp effect making the effect become
+ * quadratic instead of linear.
+ *
+ * \sa SDL_HAPTIC_RAMP
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticRamp
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_RAMP */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Ramp */
+ Sint16 start; /**< Beginning strength level. */
+ Sint16 end; /**< Ending strength level. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticRamp;
+
+/**
+ * \brief A structure containing a template for a Left/Right effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
+ *
+ * The Left/Right effect is used to explicitly control the large and small
+ * motors, commonly found in modern game controllers. One motor is high
+ * frequency, the other is low frequency.
+ *
+ * \sa SDL_HAPTIC_LEFTRIGHT
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticLeftRight
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+
+ /* Rumble */
+ Uint16 large_magnitude; /**< Control of the large controller motor. */
+ Uint16 small_magnitude; /**< Control of the small controller motor. */
+} SDL_HapticLeftRight;
+
+/**
+ * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
+ * A custom force feedback effect is much like a periodic effect, where the
+ * application can define its exact shape. You will have to allocate the
+ * data yourself. Data should consist of channels * samples Uint16 samples.
+ *
+ * If channels is one, the effect is rotated using the defined direction.
+ * Otherwise it uses the samples in data for the different axes.
+ *
+ * \sa SDL_HAPTIC_CUSTOM
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticCustom
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Custom */
+ Uint8 channels; /**< Axes to use, minimum of one. */
+ Uint16 period; /**< Sample periods. */
+ Uint16 samples; /**< Amount of samples. */
+ Uint16 *data; /**< Should contain channels*samples items. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticCustom;
+
+/**
+ * \brief The generic template for any haptic effect.
+ *
+ * All values max at 32767 (0x7FFF). Signed values also can be negative.
+ * Time values unless specified otherwise are in milliseconds.
+ *
+ * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
+ * value. Neither delay, interval, attack_length nor fade_length support
+ * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
+ *
+ * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
+ * ::SDL_HAPTIC_INFINITY.
+ *
+ * Button triggers may not be supported on all devices, it is advised to not
+ * use them if possible. Buttons start at index 1 instead of index 0 like
+ * the joystick.
+ *
+ * If both attack_length and fade_level are 0, the envelope is not used,
+ * otherwise both values are used.
+ *
+ * Common parts:
+ * \code
+ * // Replay - All effects have this
+ * Uint32 length; // Duration of effect (ms).
+ * Uint16 delay; // Delay before starting effect.
+ *
+ * // Trigger - All effects have this
+ * Uint16 button; // Button that triggers effect.
+ * Uint16 interval; // How soon before effect can be triggered again.
+ *
+ * // Envelope - All effects except condition effects have this
+ * Uint16 attack_length; // Duration of the attack (ms).
+ * Uint16 attack_level; // Level at the start of the attack.
+ * Uint16 fade_length; // Duration of the fade out (ms).
+ * Uint16 fade_level; // Level at the end of the fade.
+ * \endcode
+ *
+ *
+ * Here we have an example of a constant effect evolution in time:
+ * \verbatim
+ Strength
+ ^
+ |
+ | effect level --> _________________
+ | / \
+ | / \
+ | / \
+ | / \
+ | attack_level --> | \
+ | | | <--- fade_level
+ |
+ +--------------------------------------------------> Time
+ [--] [---]
+ attack_length fade_length
+
+ [------------------][-----------------------]
+ delay length
+ \endverbatim
+ *
+ * Note either the attack_level or the fade_level may be above the actual
+ * effect level.
+ *
+ * \sa SDL_HapticConstant
+ * \sa SDL_HapticPeriodic
+ * \sa SDL_HapticCondition
+ * \sa SDL_HapticRamp
+ * \sa SDL_HapticLeftRight
+ * \sa SDL_HapticCustom
+ */
+typedef union SDL_HapticEffect
+{
+ /* Common for all force feedback effects */
+ Uint16 type; /**< Effect type. */
+ SDL_HapticConstant constant; /**< Constant effect. */
+ SDL_HapticPeriodic periodic; /**< Periodic effect. */
+ SDL_HapticCondition condition; /**< Condition effect. */
+ SDL_HapticRamp ramp; /**< Ramp effect. */
+ SDL_HapticLeftRight leftright; /**< Left/Right effect. */
+ SDL_HapticCustom custom; /**< Custom effect. */
+} SDL_HapticEffect;
+
+
+/* Function prototypes */
+/**
+ * \brief Count the number of haptic devices attached to the system.
+ *
+ * \return Number of haptic devices detected on the system.
+ */
+extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
+
+/**
+ * \brief Get the implementation dependent name of a haptic device.
+ *
+ * This can be called before any joysticks are opened.
+ * If no name can be found, this function returns NULL.
+ *
+ * \param device_index Index of the device to get its name.
+ * \return Name of the device or NULL on error.
+ *
+ * \sa SDL_NumHaptics
+ */
+extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
+
+/**
+ * \brief Opens a haptic device for use.
+ *
+ * The index passed as an argument refers to the N'th haptic device on this
+ * system.
+ *
+ * When opening a haptic device, its gain will be set to maximum and
+ * autocenter will be disabled. To modify these values use
+ * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
+ *
+ * \param device_index Index of the device to open.
+ * \return Device identifier or NULL on error.
+ *
+ * \sa SDL_HapticIndex
+ * \sa SDL_HapticOpenFromMouse
+ * \sa SDL_HapticOpenFromJoystick
+ * \sa SDL_HapticClose
+ * \sa SDL_HapticSetGain
+ * \sa SDL_HapticSetAutocenter
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticStopAll
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
+
+/**
+ * \brief Checks if the haptic device at index has been opened.
+ *
+ * \param device_index Index to check to see if it has been opened.
+ * \return 1 if it has been opened or 0 if it hasn't.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticIndex
+ */
+extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
+
+/**
+ * \brief Gets the index of a haptic device.
+ *
+ * \param haptic Haptic device to get the index of.
+ * \return The index of the haptic device or -1 on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticOpened
+ */
+extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
+
+/**
+ * \brief Gets whether or not the current mouse has haptic capabilities.
+ *
+ * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
+ *
+ * \sa SDL_HapticOpenFromMouse
+ */
+extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
+
+/**
+ * \brief Tries to open a haptic device from the current mouse.
+ *
+ * \return The haptic device identifier or NULL on error.
+ *
+ * \sa SDL_MouseIsHaptic
+ * \sa SDL_HapticOpen
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
+
+/**
+ * \brief Checks to see if a joystick has haptic features.
+ *
+ * \param joystick Joystick to test for haptic capabilities.
+ * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ * or -1 if an error occurred.
+ *
+ * \sa SDL_HapticOpenFromJoystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
+
+/**
+ * \brief Opens a haptic device for use from a joystick device.
+ *
+ * You must still close the haptic device separately. It will not be closed
+ * with the joystick.
+ *
+ * When opening from a joystick you should first close the haptic device before
+ * closing the joystick device. If not, on some implementations the haptic
+ * device will also get unallocated and you'll be unable to use force feedback
+ * on that device.
+ *
+ * \param joystick Joystick to create a haptic device from.
+ * \return A valid haptic device identifier on success or NULL on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticClose
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
+ joystick);
+
+/**
+ * \brief Closes a haptic device previously opened with SDL_HapticOpen().
+ *
+ * \param haptic Haptic device to close.
+ */
+extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
+
+/**
+ * \brief Returns the number of effects a haptic device can store.
+ *
+ * On some platforms this isn't fully supported, and therefore is an
+ * approximation. Always check to see if your created effect was actually
+ * created and do not rely solely on SDL_HapticNumEffects().
+ *
+ * \param haptic The haptic device to query effect max.
+ * \return The number of effects the haptic device can store or
+ * -1 on error.
+ *
+ * \sa SDL_HapticNumEffectsPlaying
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
+
+/**
+ * \brief Returns the number of effects a haptic device can play at the same
+ * time.
+ *
+ * This is not supported on all platforms, but will always return a value.
+ * Added here for the sake of completeness.
+ *
+ * \param haptic The haptic device to query maximum playing effects.
+ * \return The number of effects the haptic device can play at the same time
+ * or -1 on error.
+ *
+ * \sa SDL_HapticNumEffects
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
+
+/**
+ * \brief Gets the haptic device's supported features in bitwise manner.
+ *
+ * Example:
+ * \code
+ * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
+ * printf("We have constant haptic effect!\n");
+ * }
+ * \endcode
+ *
+ * \param haptic The haptic device to query.
+ * \return Haptic features in bitwise manner (OR'd).
+ *
+ * \sa SDL_HapticNumEffects
+ * \sa SDL_HapticEffectSupported
+ */
+extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
+
+
+/**
+ * \brief Gets the number of haptic axes the device has.
+ *
+ * \sa SDL_HapticDirection
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
+
+/**
+ * \brief Checks to see if effect is supported by haptic.
+ *
+ * \param haptic Haptic device to check on.
+ * \param effect Effect to check to see if it is supported.
+ * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ * \sa SDL_HapticNewEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
+ SDL_HapticEffect *
+ effect);
+
+/**
+ * \brief Creates a new haptic effect on the device.
+ *
+ * \param haptic Haptic device to create the effect on.
+ * \param effect Properties of the effect to create.
+ * \return The identifier of the effect on success or -1 on error.
+ *
+ * \sa SDL_HapticUpdateEffect
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
+ SDL_HapticEffect * effect);
+
+/**
+ * \brief Updates the properties of an effect.
+ *
+ * Can be used dynamically, although behavior when dynamically changing
+ * direction may be strange. Specifically the effect may reupload itself
+ * and start playing from the start. You cannot change the type either when
+ * running SDL_HapticUpdateEffect().
+ *
+ * \param haptic Haptic device that has the effect.
+ * \param effect Identifier of the effect to update.
+ * \param data New effect properties to use.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticNewEffect
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
+ int effect,
+ SDL_HapticEffect * data);
+
+/**
+ * \brief Runs the haptic effect on its associated haptic device.
+ *
+ * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
+ * repeating the envelope (attack and fade) every time. If you only want the
+ * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
+ * parameter.
+ *
+ * \param haptic Haptic device to run the effect on.
+ * \param effect Identifier of the haptic effect to run.
+ * \param iterations Number of iterations to run the effect. Use
+ * ::SDL_HAPTIC_INFINITY for infinity.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticStopEffect
+ * \sa SDL_HapticDestroyEffect
+ * \sa SDL_HapticGetEffectStatus
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
+ int effect,
+ Uint32 iterations);
+
+/**
+ * \brief Stops the haptic effect on its associated haptic device.
+ *
+ * \param haptic Haptic device to stop the effect on.
+ * \param effect Identifier of the effect to stop.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Destroys a haptic effect on the device.
+ *
+ * This will stop the effect if it's running. Effects are automatically
+ * destroyed when the device is closed.
+ *
+ * \param haptic Device to destroy the effect on.
+ * \param effect Identifier of the effect to destroy.
+ *
+ * \sa SDL_HapticNewEffect
+ */
+extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Gets the status of the current effect on the haptic device.
+ *
+ * Device must support the ::SDL_HAPTIC_STATUS feature.
+ *
+ * \param haptic Haptic device to query the effect status on.
+ * \param effect Identifier of the effect to query its status.
+ * \return 0 if it isn't playing, 1 if it is playing or -1 on error.
+ *
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticStopEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Sets the global gain of the device.
+ *
+ * Device must support the ::SDL_HAPTIC_GAIN feature.
+ *
+ * The user may specify the maximum gain by setting the environment variable
+ * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
+ * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
+ * maximum.
+ *
+ * \param haptic Haptic device to set the gain on.
+ * \param gain Value to set the gain to, should be between 0 and 100.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
+
+/**
+ * \brief Sets the global autocenter of the device.
+ *
+ * Autocenter should be between 0 and 100. Setting it to 0 will disable
+ * autocentering.
+ *
+ * Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
+ *
+ * \param haptic Haptic device to set autocentering on.
+ * \param autocenter Value to set autocenter to, 0 disables autocentering.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
+ int autocenter);
+
+/**
+ * \brief Pauses a haptic device.
+ *
+ * Device must support the ::SDL_HAPTIC_PAUSE feature. Call
+ * SDL_HapticUnpause() to resume playback.
+ *
+ * Do not modify the effects nor add new ones while the device is paused.
+ * That can cause all sorts of weird errors.
+ *
+ * \param haptic Haptic device to pause.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticUnpause
+ */
+extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
+
+/**
+ * \brief Unpauses a haptic device.
+ *
+ * Call to unpause after SDL_HapticPause().
+ *
+ * \param haptic Haptic device to unpause.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticPause
+ */
+extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
+
+/**
+ * \brief Stops all the currently playing effects on a haptic device.
+ *
+ * \param haptic Haptic device to stop.
+ * \return 0 on success or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
+
+/**
+ * \brief Checks to see if rumble is supported on a haptic device.
+ *
+ * \param haptic Haptic device to check to see if it supports rumble.
+ * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
+ *
+ * \sa SDL_HapticRumbleInit
+ * \sa SDL_HapticRumblePlay
+ * \sa SDL_HapticRumbleStop
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
+
+/**
+ * \brief Initializes the haptic device for simple rumble playback.
+ *
+ * \param haptic Haptic device to initialize for simple rumble playback.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticRumbleSupported
+ * \sa SDL_HapticRumblePlay
+ * \sa SDL_HapticRumbleStop
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
+
+/**
+ * \brief Runs simple rumble on a haptic device
+ *
+ * \param haptic Haptic device to play rumble effect on.
+ * \param strength Strength of the rumble to play as a 0-1 float value.
+ * \param length Length of the rumble to play in milliseconds.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRumbleSupported
+ * \sa SDL_HapticRumbleInit
+ * \sa SDL_HapticRumbleStop
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
+
+/**
+ * \brief Stops the simple rumble on a haptic device.
+ *
+ * \param haptic Haptic to stop the rumble on.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRumbleSupported
+ * \sa SDL_HapticRumbleInit
+ * \sa SDL_HapticRumblePlay
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_haptic_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_hints.h b/src/3rdparty/SDL2/include/SDL2/SDL_hints.h
new file mode 100644
index 0000000..3834640
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_hints.h
@@ -0,0 +1,1022 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_hints.h
+ *
+ * Official documentation for SDL configuration variables
+ *
+ * This file contains functions to set and get configuration hints,
+ * as well as listing each of them alphabetically.
+ *
+ * The convention for naming hints is SDL_HINT_X, where "SDL_X" is
+ * the environment variable that can be used to override the default.
+ *
+ * In general these hints are just that - they may or may not be
+ * supported or applicable on any given platform, but they provide
+ * a way for an application or user to give the library a hint as
+ * to how they would like the library to work.
+ */
+
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
+ *
+ * SDL can try to accelerate the SDL screen surface by using streaming
+ * textures with a 3D rendering engine. This variable controls whether and
+ * how this is done.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable 3D acceleration
+ * "1" - Enable 3D acceleration, using the default renderer.
+ * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
+ *
+ * By default SDL tries to make a best guess for each platform whether
+ * to use acceleration or not.
+ */
+#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
+
+/**
+ * \brief A variable specifying which render driver to use.
+ *
+ * If the application doesn't pick a specific renderer to use, this variable
+ * specifies the name of the preferred renderer. If the preferred renderer
+ * can't be initialized, the normal default renderer is used.
+ *
+ * This variable is case insensitive and can be set to the following values:
+ * "direct3d"
+ * "opengl"
+ * "opengles2"
+ * "opengles"
+ * "metal"
+ * "software"
+ *
+ * The default varies by platform, but it's the first one in the list that
+ * is available on the current platform.
+ */
+#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
+
+/**
+ * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable shaders
+ * "1" - Enable shaders
+ *
+ * By default shaders are used if OpenGL supports them.
+ */
+#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
+
+/**
+ * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations.
+ *
+ * This variable can be set to the following values:
+ * "0" - Thread-safety is not enabled (faster)
+ * "1" - Thread-safety is enabled
+ *
+ * By default the Direct3D device is created with thread-safety disabled.
+ */
+#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
+
+/**
+ * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer.
+ *
+ * This variable does not have any effect on the Direct3D 9 based renderer.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable Debug Layer use
+ * "1" - Enable Debug Layer use
+ *
+ * By default, SDL does not use Direct3D Debug Layer.
+ */
+#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
+
+/**
+ * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ * This variable can be set to the following values:
+ * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ * By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
+
+/**
+ * \brief A variable controlling the scaling quality
+ *
+ * This variable can be set to the following values:
+ * "0" or "nearest" - Nearest pixel sampling
+ * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
+ * "2" or "best" - Currently this is the same as "linear"
+ *
+ * By default nearest pixel sampling is used
+ */
+#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
+
+/**
+ * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable vsync
+ * "1" - Enable vsync
+ *
+ * By default SDL does not sync screen surface updates with vertical refresh.
+ */
+#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
+
+/**
+ * \brief A variable controlling whether the screensaver is enabled.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable screensaver
+ * "1" - Enable screensaver
+ *
+ * By default SDL will disable the screensaver.
+ */
+#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
+
+/**
+ * \brief A variable controlling whether the X11 VidMode extension should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable XVidMode
+ * "1" - Enable XVidMode
+ *
+ * By default SDL will use XVidMode if it is available.
+ */
+#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE"
+
+/**
+ * \brief A variable controlling whether the X11 Xinerama extension should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable Xinerama
+ * "1" - Enable Xinerama
+ *
+ * By default SDL will use Xinerama if it is available.
+ */
+#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA"
+
+/**
+ * \brief A variable controlling whether the X11 XRandR extension should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable XRandR
+ * "1" - Enable XRandR
+ *
+ * By default SDL will not use XRandR because of window manager issues.
+ */
+#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
+
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_PING
+ * "1" - Enable _NET_WM_PING
+ *
+ * By default SDL will use _NET_WM_PING, but for applications that know they
+ * will not always be able to respond to ping requests in a timely manner they can
+ * turn it off to avoid the window manager thinking the app is hung.
+ * The hint is checked in CreateWindow.
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
+
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
+ * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
+ *
+ * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
+ *
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
+
+/**
+ * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
+ *
+ * This variable can be set to the following values:
+ * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
+ * "1" - The window frame is interactive when the cursor is hidden
+ *
+ * By default SDL will allow interaction with the window frame when the cursor is hidden
+ */
+#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
+
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
+/**
+ * \brief A variable controlling whether the windows message loop is processed by SDL
+ *
+ * This variable can be set to the following values:
+ * "0" - The window message loop is not run
+ * "1" - The window message loop is processed in SDL_PumpEvents()
+ *
+ * By default SDL will process the windows message loop
+ */
+#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP"
+
+/**
+ * \brief A variable controlling whether grabbing input grabs the keyboard
+ *
+ * This variable can be set to the following values:
+ * "0" - Grab will affect only the mouse
+ * "1" - Grab will affect mouse and keyboard
+ *
+ * By default SDL will not grab the keyboard so system shortcuts still work.
+ */
+#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
+
+/**
+ * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
+/**
+ * \brief A variable controlling whether relative mouse mode is implemented using mouse warping
+ *
+ * This variable can be set to the following values:
+ * "0" - Relative mouse mode uses raw input
+ * "1" - Relative mouse mode uses mouse warping
+ *
+ * By default SDL will use raw input for relative mouse mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP"
+
+/**
+ * \brief Allow mouse click events when clicking to focus an SDL window
+ *
+ * This variable can be set to the following values:
+ * "0" - Ignore mouse clicks that activate a window
+ * "1" - Generate events for mouse clicks that activate a window
+ *
+ * By default SDL will ignore mouse clicks that activate a window
+ */
+#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
+
+/**
+ * \brief A variable controlling whether touch events should generate synthetic mouse events
+ *
+ * This variable can be set to the following values:
+ * "0" - Touch events will not generate mouse events
+ * "1" - Touch events will generate mouse events
+ *
+ * By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
+
+/**
+ * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
+ *
+ */
+#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
+
+/**
+ * \brief A variable controlling whether the idle timer is disabled on iOS.
+ *
+ * When an iOS app does not receive touches for some time, the screen is
+ * dimmed automatically. For games where the accelerometer is the only input
+ * this is problematic. This functionality can be disabled by setting this
+ * hint.
+ *
+ * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver()
+ * accomplish the same thing on iOS. They should be preferred over this hint.
+ *
+ * This variable can be set to the following values:
+ * "0" - Enable idle timer
+ * "1" - Disable idle timer
+ */
+#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
+
+/**
+ * \brief A variable controlling which orientations are allowed on iOS.
+ *
+ * In some circumstances it is necessary to be able to explicitly control
+ * which UI orientations are allowed.
+ *
+ * This variable is a space delimited list of the following values:
+ * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
+ */
+#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
+
+/**
+ * \brief A variable controlling whether controllers used with the Apple TV
+ * generate UI events.
+ *
+ * When UI events are generated by controller input, the app will be
+ * backgrounded when the Apple TV remote's menu button is pressed, and when the
+ * pause or B buttons on gamepads are pressed.
+ *
+ * More information about properly making use of controllers for the Apple TV
+ * can be found here:
+ * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/
+ *
+ * This variable can be set to the following values:
+ * "0" - Controller input does not generate UI events (the default).
+ * "1" - Controller input generates UI events.
+ */
+#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"
+
+/**
+ * \brief A variable controlling whether the Apple TV remote's joystick axes
+ * will automatically match the rotation of the remote.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remote orientation does not affect joystick axes (the default).
+ * "1" - Joystick axes are based on the orientation of the remote.
+ */
+#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
+
+/**
+ * \brief A variable controlling whether the home indicator bar on iPhone X
+ * should be hidden.
+ *
+ * This variable can be set to the following values:
+ * "0" - The indicator bar is not hidden (default for windowed applications)
+ * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
+ * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
+ */
+#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR"
+
+/**
+ * \brief A variable controlling whether the Android / iOS built-in
+ * accelerometer should be listed as a joystick device.
+ *
+ * This variable can be set to the following values:
+ * "0" - The accelerometer is not listed as a joystick
+ * "1" - The accelerometer is available as a 3 axis joystick (the default).
+ */
+#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
+
+/**
+ * \brief A variable controlling whether the Android / tvOS remotes
+ * should be listed as joystick devices, instead of sending keyboard events.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remotes send enter/escape/arrow key events
+ * "1" - Remotes are available as 2 axis, 2 button joysticks (the default).
+ */
+#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
+
+/**
+ * \brief A variable that lets you disable the detection and use of Xinput gamepad devices
+ *
+ * The variable can be set to the following values:
+ * "0" - Disable XInput detection (only uses direct input)
+ * "1" - Enable XInput detection (the default)
+ */
+#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
+
+/**
+ * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
+ *
+ * This hint is for backwards compatibility only and will be removed in SDL 2.1
+ *
+ * The default value is "0". This hint must be set before SDL_Init()
+ */
+#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
+
+/**
+ * \brief A variable that lets you manually hint extra gamecontroller db entries.
+ *
+ * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
+ *
+ * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
+ * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
+ */
+#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
+
+/**
+ * \brief A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
+
+/**
+ * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
+ *
+ * The variable can be set to the following values:
+ * "0" - Disable joystick & gamecontroller input events when the
+ * application is in the background.
+ * "1" - Enable joystick & gamecontroller input events when the
+ * application is in the background.
+ *
+ * The default value is "0". This hint may be set at any time.
+ */
+#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
+
+/**
+ * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
+ * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
+ *
+ * This variable can be set to the following values:
+ * "0" - don't allow topmost
+ * "1" - allow topmost
+ */
+#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
+
+/**
+ * \brief A variable that controls the timer resolution, in milliseconds.
+ *
+ * The higher resolution the timer, the more frequently the CPU services
+ * timer interrupts, and the more precise delays are, but this takes up
+ * power and CPU time. This hint is only used on Windows 7 and earlier.
+ *
+ * See this blog post for more information:
+ * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
+ *
+ * If this variable is set to "0", the system timer resolution is not set.
+ *
+ * The default value is "1". This hint may be set at any time.
+ */
+#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
+
+
+/**
+ * \brief A variable describing the content orientation on QtWayland-based platforms.
+ *
+ * On QtWayland platforms, windows are rotated client-side to allow for custom
+ * transitions. In order to correctly position overlays (e.g. volume bar) and
+ * gestures (e.g. events view, close/minimize gestures), the system needs to
+ * know in which orientation the application is currently drawing its contents.
+ *
+ * This does not cause the window to be rotated or resized, the application
+ * needs to take care of drawing the content in the right orientation (the
+ * framebuffer is always in portrait mode).
+ *
+ * This variable can be one of the following values:
+ * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
+ */
+#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
+
+/**
+ * \brief Flags to set on QtWayland windows to integrate with the native window manager.
+ *
+ * On QtWayland platforms, this hint controls the flags to set on the windows.
+ * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
+ *
+ * This variable is a space-separated list of the following values (empty = no flags):
+ * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
+ */
+#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
+
+/**
+* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
+*
+* Use this hint in case you need to set SDL's threads stack size to other than the default.
+* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
+* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
+* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
+*/
+#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
+
+/**
+ * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
+ */
+#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
+
+/**
+ * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac
+ *
+ * If present, holding ctrl while left clicking will generate a right click
+ * event when on Mac.
+ */
+#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
+
+/**
+* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
+*
+* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It
+* can use two different sets of binaries, those compiled by the user from source
+* or those provided by the Chrome browser. In the later case, these binaries require
+* that SDL loads a DLL providing the shader compiler.
+*
+* This variable can be set to the following values:
+* "d3dcompiler_46.dll" - default, best for Vista or later.
+* "d3dcompiler_43.dll" - for XP support.
+* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.
+*
+*/
+#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER"
+
+/**
+* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
+*
+* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
+* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
+* created SDL_Window:
+*
+* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
+* needed for example when sharing an OpenGL context across multiple windows.
+*
+* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for
+* OpenGL rendering.
+*
+* This variable can be set to the following values:
+* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should
+* share a pixel format with.
+*/
+#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
+
+/**
+ * \brief A URL to a WinRT app's privacy policy
+ *
+ * All network-enabled WinRT apps must make a privacy policy available to its
+ * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
+ * be available in the Windows Settings charm, as accessed from within the app.
+ * SDL provides code to add a URL-based link there, which can point to the app's
+ * privacy policy.
+ *
+ * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
+ * before calling any SDL_Init() functions. The contents of the hint should
+ * be a valid URL. For example, "http://www.example.com".
+ *
+ * The default value is "", which will prevent SDL from adding a privacy policy
+ * link to the Settings charm. This hint should only be set during app init.
+ *
+ * The label text of an app's "Privacy Policy" link may be customized via another
+ * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
+ *
+ * Please note that on Windows Phone, Microsoft does not provide standard UI
+ * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
+ * will not get used on that platform. Network-enabled phone apps should display
+ * their privacy policy through some other, in-app means.
+ */
+#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
+
+/** \brief Label text for a WinRT app's privacy policy link
+ *
+ * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
+ * Microsoft mandates that this policy be available via the Windows Settings charm.
+ * SDL provides code to add a link there, with its label text being set via the
+ * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
+ *
+ * Please note that a privacy policy's contents are not set via this hint. A separate
+ * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
+ * policy.
+ *
+ * The contents of this hint should be encoded as a UTF8 string.
+ *
+ * The default value is "Privacy Policy". This hint should only be set during app
+ * initialization, preferably before any calls to SDL_Init().
+ *
+ * For additional information on linking to a privacy policy, see the documentation for
+ * SDL_HINT_WINRT_PRIVACY_POLICY_URL.
+ */
+#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
+
+/** \brief Allows back-button-press events on Windows Phone to be marked as handled
+ *
+ * Windows Phone devices typically feature a Back button. When pressed,
+ * the OS will emit back-button-press events, which apps are expected to
+ * handle in an appropriate manner. If apps do not explicitly mark these
+ * events as 'Handled', then the OS will invoke its default behavior for
+ * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
+ * terminate the app (and attempt to switch to the previous app, or to the
+ * device's home screen).
+ *
+ * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
+ * to mark back-button-press events as Handled, if and when one is sent to
+ * the app.
+ *
+ * Internally, Windows Phone sends back button events as parameters to
+ * special back-button-press callback functions. Apps that need to respond
+ * to back-button-press events are expected to register one or more
+ * callback functions for such, shortly after being launched (during the
+ * app's initialization phase). After the back button is pressed, the OS
+ * will invoke these callbacks. If the app's callback(s) do not explicitly
+ * mark the event as handled by the time they return, or if the app never
+ * registers one of these callback, the OS will consider the event
+ * un-handled, and it will apply its default back button behavior (terminate
+ * the app).
+ *
+ * SDL registers its own back-button-press callback with the Windows Phone
+ * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
+ * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
+ * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
+ * If the hint's value is set to "1", the back button event's Handled
+ * property will get set to 'true'. If the hint's value is set to something
+ * else, or if it is unset, SDL will leave the event's Handled property
+ * alone. (By default, the OS sets this property to 'false', to note.)
+ *
+ * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
+ * back button is pressed, or can set it in direct-response to a back button
+ * being pressed.
+ *
+ * In order to get notified when a back button is pressed, SDL apps should
+ * register a callback function with SDL_AddEventWatch(), and have it listen
+ * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
+ * (Alternatively, SDL_KEYUP events can be listened-for. Listening for
+ * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
+ * set by such a callback, will be applied to the OS' current
+ * back-button-press event.
+ *
+ * More details on back button behavior in Windows Phone apps can be found
+ * at the following page, on Microsoft's developer site:
+ * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
+ */
+#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
+
+/**
+ * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X.
+ *
+ * This hint only applies to Mac OS X.
+ *
+ * The variable can be set to the following values:
+ * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and
+ * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen"
+ * button on their titlebars).
+ * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and
+ * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
+ * button on their titlebars).
+ *
+ * The default value is "1". Spaces are disabled regardless of this hint if
+ * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
+ * any windows are created.
+ */
+#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
+
+/**
+* \brief When set don't force the SDL app to become a foreground process
+*
+* This hint only applies to Mac OS X.
+*
+*/
+#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
+
+/**
+ * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
+ *
+ * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
+ *
+ * If both hints were set then SDL_RWFromFile() will look into expansion files
+ * after a given relative path was not found in the internal storage and assets.
+ *
+ * By default this hint is not set and the APK expansion files are not searched.
+ */
+#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
+
+/**
+ * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
+ *
+ * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
+ *
+ * If both hints were set then SDL_RWFromFile() will look into expansion files
+ * after a given relative path was not found in the internal storage and assets.
+ *
+ * By default this hint is not set and the APK expansion files are not searched.
+ */
+#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
+
+/**
+ * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL_TEXTEDITING events are sent, and it is the application's
+ * responsibility to render the text from these events and
+ * differentiate it somehow from committed text. (default)
+ * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
+ * and text that is being composed will be rendered in its own UI.
+ */
+#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
+
+ /**
+ * \brief A variable to control whether mouse and touch events are to be treated together or separately
+ *
+ * The variable can be set to the following values:
+ * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
+ * events. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - Mouse events will be handled separately from pure touch events.
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
+
+ /**
+ * \brief A variable to control whether the return key on the soft keyboard
+ * should hide the soft keyboard on Android and iOS.
+ *
+ * The variable can be set to the following values:
+ * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - The return key will hide the keyboard.
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
+
+/**
+ * \brief override the binding element for keyboard inputs for Emscripten builds
+ *
+ * This hint only applies to the emscripten platform
+ *
+ * The variable can be one of
+ * "#window" - The javascript window object (this is the default)
+ * "#document" - The javascript document object
+ * "#screen" - the javascript window.screen object
+ * "#canvas" - the WebGL canvas element
+ * any other string without a leading # sign applies to the element on the page with that ID.
+ */
+#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
+
+/**
+ * \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
+ *
+ * This hint only applies to Unix-like platforms.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL will install a SIGINT and SIGTERM handler, and when it
+ * catches a signal, convert it into an SDL_QUIT event.
+ * "1" - SDL will not install a signal handler at all.
+ */
+#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
+
+/**
+ * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL will generate a window-close event when it sees Alt+F4.
+ * "1" - SDL will only do normal key handling for Alt+F4.
+ */
+#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+
+/**
+ * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
+ *
+ * The bitmap header version 4 is required for proper alpha channel support and
+ * SDL will use it when required. Should this not be desired, this hint can
+ * force the use of the 40 byte header version which is supported everywhere.
+ *
+ * The variable can be set to the following values:
+ * "0" - Surfaces with a colorkey or an alpha channel are saved to a
+ * 32-bit BMP file with an alpha mask. SDL will use the bitmap
+ * header version 4 and set the alpha mask accordingly.
+ * "1" - Surfaces with a colorkey or an alpha channel are saved to a
+ * 32-bit BMP file without an alpha mask. The alpha channel data
+ * will be in the file, but applications are going to ignore it.
+ *
+ * The default value is "0".
+ */
+#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
+
+/**
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ * thread's name, but it tends to cause problems with other debuggers,
+ * and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ * the (safer) SetThreadDescription API, introduced in the Windows 10
+ * Creators Update, if available.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL will raise the 0x406D1388 Exception to name threads.
+ * This is the default behavior of SDL <= 2.0.4.
+ * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
+ * This is necessary with .NET languages or debuggers that aren't Visual Studio.
+ */
+#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
+
+/**
+ * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI
+ *
+ * Also known as Z-order. The variable can take a negative or positive value.
+ * The default is 10000.
+ */
+#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
+
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ * \brief A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ * On some platforms, currently Windows and X11, OpenGL drivers may support
+ * creating contexts with an OpenGL ES profile. By default SDL uses these
+ * profiles, when available, otherwise it attempts to load an OpenGL ES
+ * library, e.g. that provided by the ANGLE project. This variable controls
+ * whether SDL follows this default behaviour or will always load an
+ * OpenGL ES library.
+ *
+ * Circumstances where this is useful include
+ * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ * or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ * - Resolving OpenGL ES function addresses at link time by linking with
+ * the OpenGL ES library instead of querying them at run time with
+ * SDL_GL_GetProcAddress().
+ *
+ * Caution: for an application to work with the default behaviour across
+ * different OpenGL drivers it must query the OpenGL ES function
+ * addresses at run time using SDL_GL_GetProcAddress().
+ *
+ * This variable is ignored on most platforms because OpenGL ES is native
+ * or not supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
+ * "1" - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
+
+/**
+ * \brief A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ * to handle audio resampling. There are different resampling modes available
+ * that produce different levels of quality, using more CPU.
+ *
+ * If this hint isn't specified to a valid setting, or libsamplerate isn't
+ * available, SDL will use the default, internal resampling algorithm.
+ *
+ * Note that this is currently only applicable to resampling audio that is
+ * being written to a device for playback or audio being read from a device
+ * for capture. SDL_AudioCVT always uses the default resampler (although this
+ * might change for SDL 2.1).
+ *
+ * This hint is currently only checked at audio subsystem initialization.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ * "1" or "fast" - Use fast, slightly higher quality resampling, if available
+ * "2" or "medium" - Use medium quality resampling, if available
+ * "3" or "best" - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ * \brief A variable controlling the audio category on iOS and Mac OS X
+ *
+ * This variable can be set to the following values:
+ *
+ * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ * "playback" - Use the AVAudioSessionCategoryPlayback category
+ *
+ * For more information, see Apple's documentation:
+ * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
+
+/**
+ * \brief An enumeration of hint priorities
+ */
+typedef enum
+{
+ SDL_HINT_DEFAULT,
+ SDL_HINT_NORMAL,
+ SDL_HINT_OVERRIDE
+} SDL_HintPriority;
+
+
+/**
+ * \brief Set a hint with a specific priority
+ *
+ * The priority controls the behavior when setting a hint that already
+ * has a value. Hints will replace existing hints of their priority and
+ * lower. Environment variables are considered to have override priority.
+ *
+ * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
+ const char *value,
+ SDL_HintPriority priority);
+
+/**
+ * \brief Set a hint with normal priority
+ *
+ * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
+ const char *value);
+
+/**
+ * \brief Get a hint
+ *
+ * \return The string value of a hint variable.
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
+
+/**
+ * \brief Get a hint
+ *
+ * \return The boolean value of a hint variable.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
+
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
+/**
+ * \brief Add a function to watch a particular hint
+ *
+ * \param name The hint to watch
+ * \param callback The function to call when the hint value changes
+ * \param userdata A pointer to pass to the callback function
+ */
+extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
+ SDL_HintCallback callback,
+ void *userdata);
+
+/**
+ * \brief Remove a function watching a particular hint
+ *
+ * \param name The hint being watched
+ * \param callback The function being called when the hint value changes
+ * \param userdata A pointer being passed to the callback function
+ */
+extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
+ SDL_HintCallback callback,
+ void *userdata);
+
+/**
+ * \brief Clear all hints
+ *
+ * This function is called during SDL_Quit() to free stored hints.
+ */
+extern DECLSPEC void SDLCALL SDL_ClearHints(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_hints_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_joystick.h b/src/3rdparty/SDL2/include/SDL2/SDL_joystick.h
new file mode 100644
index 0000000..f67772d
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_joystick.h
@@ -0,0 +1,382 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_joystick.h
+ *
+ * Include file for SDL joystick event handling
+ *
+ * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
+ * behind a device_index changing as joysticks are plugged and unplugged.
+ *
+ * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
+ * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
+ *
+ * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
+ * the device (a X360 wired controller for example). This identifier is platform dependent.
+ *
+ *
+ */
+
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_joystick.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
+ * for joysticks, and load appropriate drivers.
+ *
+ * If you would like to receive joystick updates while the application
+ * is in the background, you should set the following hint before calling
+ * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
+ */
+
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
+struct _SDL_Joystick;
+typedef struct _SDL_Joystick SDL_Joystick;
+
+/* A structure that encodes the stable unique id for a joystick device */
+typedef struct {
+ Uint8 data[16];
+} SDL_JoystickGUID;
+
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
+typedef Sint32 SDL_JoystickID;
+
+typedef enum
+{
+ SDL_JOYSTICK_TYPE_UNKNOWN,
+ SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+ SDL_JOYSTICK_TYPE_WHEEL,
+ SDL_JOYSTICK_TYPE_ARCADE_STICK,
+ SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+ SDL_JOYSTICK_TYPE_DANCE_PAD,
+ SDL_JOYSTICK_TYPE_GUITAR,
+ SDL_JOYSTICK_TYPE_DRUM_KIT,
+ SDL_JOYSTICK_TYPE_ARCADE_PAD,
+ SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
+typedef enum
+{
+ SDL_JOYSTICK_POWER_UNKNOWN = -1,
+ SDL_JOYSTICK_POWER_EMPTY,
+ SDL_JOYSTICK_POWER_LOW,
+ SDL_JOYSTICK_POWER_MEDIUM,
+ SDL_JOYSTICK_POWER_FULL,
+ SDL_JOYSTICK_POWER_WIRED,
+ SDL_JOYSTICK_POWER_MAX
+} SDL_JoystickPowerLevel;
+
+/* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
+/**
+ * Count the number of joysticks attached to the system right now
+ */
+extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
+
+/**
+ * Get the implementation dependent name of a joystick.
+ * This can be called before any joysticks are opened.
+ * If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
+
+/**
+ * Return the GUID for the joystick at this index
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ * Get the USB vendor ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
+
+/**
+ * Get the USB product ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
+
+/**
+ * Get the product version of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
+
+/**
+ * Get the type of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ * Get the instance ID of a joystick.
+ * This can be called before any joysticks are opened.
+ * If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
+/**
+ * Open a joystick for use.
+ * The index passed as an argument refers to the N'th joystick on the system.
+ * This index is not the value which will identify this joystick in future
+ * joystick events. The joystick's instance id (::SDL_JoystickID) will be used
+ * there instead.
+ *
+ * \return A joystick identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
+
+/**
+ * Return the SDL_Joystick associated with an instance id.
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
+
+/**
+ * Return the name for this currently opened joystick.
+ * If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
+
+/**
+ * Return the GUID for this opened joystick
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+
+/**
+ * Get the USB vendor ID of an opened joystick, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
+
+/**
+ * Get the USB product ID of an opened joystick, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
+
+/**
+ * Get the product version of an opened joystick, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
+
+/**
+ * Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
+
+/**
+ * Return a string representation for this guid. pszGUID must point to at least 33 bytes
+ * (32 for the string plus a NULL terminator).
+ */
+extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
+
+/**
+ * Convert a string into a joystick guid
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
+
+/**
+ * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
+
+/**
+ * Get the instance ID of an opened joystick or -1 if the joystick is invalid.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
+
+/**
+ * Get the number of general axis controls on a joystick.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
+
+/**
+ * Get the number of trackballs on a joystick.
+ *
+ * Joystick trackballs have only relative motion events associated
+ * with them and their state cannot be polled.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
+
+/**
+ * Get the number of POV hats on a joystick.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
+
+/**
+ * Get the number of buttons on a joystick.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
+
+/**
+ * Update the current state of the open joysticks.
+ *
+ * This is called automatically by the event loop if any joystick
+ * events are enabled.
+ */
+extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
+
+/**
+ * Enable/disable joystick event polling.
+ *
+ * If joystick events are disabled, you must call SDL_JoystickUpdate()
+ * yourself and check the state of the joystick when you want joystick
+ * information.
+ *
+ * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
+
+#define SDL_JOYSTICK_AXIS_MAX 32767
+#define SDL_JOYSTICK_AXIS_MIN -32768
+/**
+ * Get the current state of an axis control on a joystick.
+ *
+ * The state is a value ranging from -32768 to 32767.
+ *
+ * The axis indices start at index 0.
+ */
+extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
+ int axis);
+
+/**
+ * Get the initial state of an axis control on a joystick.
+ *
+ * The state is a value ranging from -32768 to 32767.
+ *
+ * The axis indices start at index 0.
+ *
+ * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+ int axis, Sint16 *state);
+
+/**
+ * \name Hat positions
+ */
+/* @{ */
+#define SDL_HAT_CENTERED 0x00
+#define SDL_HAT_UP 0x01
+#define SDL_HAT_RIGHT 0x02
+#define SDL_HAT_DOWN 0x04
+#define SDL_HAT_LEFT 0x08
+#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
+#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
+#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
+#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
+/* @} */
+
+/**
+ * Get the current state of a POV hat on a joystick.
+ *
+ * The hat indices start at index 0.
+ *
+ * \return The return value is one of the following positions:
+ * - ::SDL_HAT_CENTERED
+ * - ::SDL_HAT_UP
+ * - ::SDL_HAT_RIGHT
+ * - ::SDL_HAT_DOWN
+ * - ::SDL_HAT_LEFT
+ * - ::SDL_HAT_RIGHTUP
+ * - ::SDL_HAT_RIGHTDOWN
+ * - ::SDL_HAT_LEFTUP
+ * - ::SDL_HAT_LEFTDOWN
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
+ int hat);
+
+/**
+ * Get the ball axis change since the last poll.
+ *
+ * \return 0, or -1 if you passed it invalid parameters.
+ *
+ * The ball indices start at index 0.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
+ int ball, int *dx, int *dy);
+
+/**
+ * Get the current state of a button on a joystick.
+ *
+ * The button indices start at index 0.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
+ int button);
+
+/**
+ * Close a joystick previously opened with SDL_JoystickOpen().
+ */
+extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
+
+/**
+ * Return the battery level of this joystick
+ */
+extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_joystick_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_keyboard.h b/src/3rdparty/SDL2/include/SDL2/SDL_keyboard.h
new file mode 100644
index 0000000..8748231
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_keyboard.h
@@ -0,0 +1,217 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_keyboard.h
+ *
+ * Include file for SDL keyboard event handling
+ */
+
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_keycode.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The SDL keysym structure, used in key events.
+ *
+ * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
+ */
+typedef struct SDL_Keysym
+{
+ SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
+ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
+ Uint16 mod; /**< current key modifiers */
+ Uint32 unused;
+} SDL_Keysym;
+
+/* Function prototypes */
+
+/**
+ * \brief Get the window which currently has keyboard focus.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
+
+/**
+ * \brief Get a snapshot of the current state of the keyboard.
+ *
+ * \param numkeys if non-NULL, receives the length of the returned array.
+ *
+ * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
+ *
+ * \b Example:
+ * \code
+ * const Uint8 *state = SDL_GetKeyboardState(NULL);
+ * if ( state[SDL_SCANCODE_RETURN] ) {
+ * printf("<RETURN> is pressed.\n");
+ * }
+ * \endcode
+ */
+extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
+
+/**
+ * \brief Get the current key modifier state for the keyboard.
+ */
+extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
+
+/**
+ * \brief Set the current key modifier state for the keyboard.
+ *
+ * \note This does not change the keyboard state, only the key modifier flags.
+ */
+extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
+
+/**
+ * \brief Get the key code corresponding to the given scancode according
+ * to the current keyboard layout.
+ *
+ * See ::SDL_Keycode for details.
+ *
+ * \sa SDL_GetKeyName()
+ */
+extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
+
+/**
+ * \brief Get the scancode corresponding to the given key code according to the
+ * current keyboard layout.
+ *
+ * See ::SDL_Scancode for details.
+ *
+ * \sa SDL_GetScancodeName()
+ */
+extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
+
+/**
+ * \brief Get a human-readable name for a scancode.
+ *
+ * \return A pointer to the name for the scancode.
+ * If the scancode doesn't have a name, this function returns
+ * an empty string ("").
+ *
+ * \sa SDL_Scancode
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
+
+/**
+ * \brief Get a scancode from a human-readable name
+ *
+ * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
+ *
+ * \sa SDL_Scancode
+ */
+extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
+
+/**
+ * \brief Get a human-readable name for a key.
+ *
+ * \return A pointer to a UTF-8 string that stays valid at least until the next
+ * call to this function. If you need it around any longer, you must
+ * copy it. If the key doesn't have a name, this function returns an
+ * empty string ("").
+ *
+ * \sa SDL_Keycode
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
+
+/**
+ * \brief Get a key code from a human-readable name
+ *
+ * \return key code, or SDLK_UNKNOWN if the name wasn't recognized
+ *
+ * \sa SDL_Keycode
+ */
+extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
+
+/**
+ * \brief Start accepting Unicode text input events.
+ * This function will show the on-screen keyboard if supported.
+ *
+ * \sa SDL_StopTextInput()
+ * \sa SDL_SetTextInputRect()
+ * \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
+
+/**
+ * \brief Return whether or not Unicode text input events are enabled.
+ *
+ * \sa SDL_StartTextInput()
+ * \sa SDL_StopTextInput()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
+
+/**
+ * \brief Stop receiving any text input events.
+ * This function will hide the on-screen keyboard if supported.
+ *
+ * \sa SDL_StartTextInput()
+ * \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
+
+/**
+ * \brief Set the rectangle used to type Unicode text inputs.
+ * This is used as a hint for IME and on-screen keyboard placement.
+ *
+ * \sa SDL_StartTextInput()
+ */
+extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
+
+/**
+ * \brief Returns whether the platform has some screen keyboard support.
+ *
+ * \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
+ *
+ * \note Not all screen keyboard functions are supported on all platforms.
+ *
+ * \sa SDL_IsScreenKeyboardShown()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
+
+/**
+ * \brief Returns whether the screen keyboard is shown for given window.
+ *
+ * \param window The window for which screen keyboard should be queried.
+ *
+ * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
+ *
+ * \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_keyboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_keycode.h b/src/3rdparty/SDL2/include/SDL2/SDL_keycode.h
new file mode 100644
index 0000000..d7d5b1d
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_keycode.h
@@ -0,0 +1,349 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_keycode.h
+ *
+ * Defines constants which identify keyboard keys and modifiers.
+ */
+
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_scancode.h"
+
+/**
+ * \brief The SDL virtual key representation.
+ *
+ * Values of this type are used to represent keyboard keys using the current
+ * layout of the keyboard. These values include Unicode values representing
+ * the unmodified character that would be generated by pressing the key, or
+ * an SDLK_* constant for those keys that do not generate characters.
+ *
+ * A special exception is the number keys at the top of the keyboard which
+ * always map to SDLK_0...SDLK_9, regardless of layout.
+ */
+typedef Sint32 SDL_Keycode;
+
+#define SDLK_SCANCODE_MASK (1<<30)
+#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
+
+enum
+{
+ SDLK_UNKNOWN = 0,
+
+ SDLK_RETURN = '\r',
+ SDLK_ESCAPE = '\033',
+ SDLK_BACKSPACE = '\b',
+ SDLK_TAB = '\t',
+ SDLK_SPACE = ' ',
+ SDLK_EXCLAIM = '!',
+ SDLK_QUOTEDBL = '"',
+ SDLK_HASH = '#',
+ SDLK_PERCENT = '%',
+ SDLK_DOLLAR = '$',
+ SDLK_AMPERSAND = '&',
+ SDLK_QUOTE = '\'',
+ SDLK_LEFTPAREN = '(',
+ SDLK_RIGHTPAREN = ')',
+ SDLK_ASTERISK = '*',
+ SDLK_PLUS = '+',
+ SDLK_COMMA = ',',
+ SDLK_MINUS = '-',
+ SDLK_PERIOD = '.',
+ SDLK_SLASH = '/',
+ SDLK_0 = '0',
+ SDLK_1 = '1',
+ SDLK_2 = '2',
+ SDLK_3 = '3',
+ SDLK_4 = '4',
+ SDLK_5 = '5',
+ SDLK_6 = '6',
+ SDLK_7 = '7',
+ SDLK_8 = '8',
+ SDLK_9 = '9',
+ SDLK_COLON = ':',
+ SDLK_SEMICOLON = ';',
+ SDLK_LESS = '<',
+ SDLK_EQUALS = '=',
+ SDLK_GREATER = '>',
+ SDLK_QUESTION = '?',
+ SDLK_AT = '@',
+ /*
+ Skip uppercase letters
+ */
+ SDLK_LEFTBRACKET = '[',
+ SDLK_BACKSLASH = '\\',
+ SDLK_RIGHTBRACKET = ']',
+ SDLK_CARET = '^',
+ SDLK_UNDERSCORE = '_',
+ SDLK_BACKQUOTE = '`',
+ SDLK_a = 'a',
+ SDLK_b = 'b',
+ SDLK_c = 'c',
+ SDLK_d = 'd',
+ SDLK_e = 'e',
+ SDLK_f = 'f',
+ SDLK_g = 'g',
+ SDLK_h = 'h',
+ SDLK_i = 'i',
+ SDLK_j = 'j',
+ SDLK_k = 'k',
+ SDLK_l = 'l',
+ SDLK_m = 'm',
+ SDLK_n = 'n',
+ SDLK_o = 'o',
+ SDLK_p = 'p',
+ SDLK_q = 'q',
+ SDLK_r = 'r',
+ SDLK_s = 's',
+ SDLK_t = 't',
+ SDLK_u = 'u',
+ SDLK_v = 'v',
+ SDLK_w = 'w',
+ SDLK_x = 'x',
+ SDLK_y = 'y',
+ SDLK_z = 'z',
+
+ SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
+
+ SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
+ SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
+ SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
+ SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
+ SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
+ SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
+ SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
+ SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
+ SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
+ SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
+ SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
+ SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
+
+ SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
+ SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
+ SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
+ SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
+ SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
+ SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
+ SDLK_DELETE = '\177',
+ SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
+ SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
+ SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
+ SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
+ SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
+ SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
+
+ SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
+ SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
+ SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
+ SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
+ SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
+ SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
+ SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
+ SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
+ SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
+ SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
+ SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
+ SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
+ SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
+ SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
+ SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
+ SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
+ SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
+
+ SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
+ SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
+ SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
+ SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
+ SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
+ SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
+ SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
+ SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
+ SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
+ SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
+ SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
+ SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
+ SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
+ SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
+ SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
+ SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
+ SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
+ SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
+ SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
+ SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
+ SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
+ SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
+ SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
+ SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
+ SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
+ SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
+ SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
+ SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
+ SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
+ SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
+ SDLK_KP_EQUALSAS400 =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
+
+ SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
+ SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
+ SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
+ SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
+ SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
+ SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
+ SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
+ SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
+ SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
+ SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
+ SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
+ SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
+
+ SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
+ SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
+ SDLK_THOUSANDSSEPARATOR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
+ SDLK_DECIMALSEPARATOR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
+ SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
+ SDLK_CURRENCYSUBUNIT =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
+ SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
+ SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
+ SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
+ SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
+ SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
+ SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
+ SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
+ SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
+ SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
+ SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
+ SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
+ SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
+ SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
+ SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
+ SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
+ SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
+ SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
+ SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
+ SDLK_KP_DBLAMPERSAND =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
+ SDLK_KP_VERTICALBAR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
+ SDLK_KP_DBLVERTICALBAR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
+ SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
+ SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
+ SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
+ SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
+ SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
+ SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
+ SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
+ SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
+ SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
+ SDLK_KP_MEMSUBTRACT =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
+ SDLK_KP_MEMMULTIPLY =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
+ SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
+ SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
+ SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
+ SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
+ SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
+ SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
+ SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
+ SDLK_KP_HEXADECIMAL =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
+
+ SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
+ SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
+ SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
+ SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
+ SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
+ SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
+ SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
+ SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
+
+ SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
+
+ SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
+ SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
+ SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
+ SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
+ SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
+ SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
+ SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
+ SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
+ SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
+ SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
+ SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
+ SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
+ SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
+ SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
+ SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
+ SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
+ SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
+
+ SDLK_BRIGHTNESSDOWN =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
+ SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
+ SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
+ SDLK_KBDILLUMTOGGLE =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
+ SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
+ SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
+ SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
+ SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+ SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+ SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+ SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+ SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
+};
+
+/**
+ * \brief Enumeration of valid key mods (possibly OR'd together).
+ */
+typedef enum
+{
+ KMOD_NONE = 0x0000,
+ KMOD_LSHIFT = 0x0001,
+ KMOD_RSHIFT = 0x0002,
+ KMOD_LCTRL = 0x0040,
+ KMOD_RCTRL = 0x0080,
+ KMOD_LALT = 0x0100,
+ KMOD_RALT = 0x0200,
+ KMOD_LGUI = 0x0400,
+ KMOD_RGUI = 0x0800,
+ KMOD_NUM = 0x1000,
+ KMOD_CAPS = 0x2000,
+ KMOD_MODE = 0x4000,
+ KMOD_RESERVED = 0x8000
+} SDL_Keymod;
+
+#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
+#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
+#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
+#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
+
+#endif /* SDL_keycode_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_loadso.h b/src/3rdparty/SDL2/include/SDL2/SDL_loadso.h
new file mode 100644
index 0000000..da56fb4
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_loadso.h
@@ -0,0 +1,81 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_loadso.h
+ *
+ * System dependent library loading routines
+ *
+ * Some things to keep in mind:
+ * \li These functions only work on C function names. Other languages may
+ * have name mangling and intrinsic language support that varies from
+ * compiler to compiler.
+ * \li Make sure you declare your function pointers with the same calling
+ * convention as the actual library function. Your code will crash
+ * mysteriously if you do not do this.
+ * \li Avoid namespace collisions. If you load a symbol from the library,
+ * it is not defined whether or not it goes into the global symbol
+ * namespace for the application. If it does and it conflicts with
+ * symbols in your code or other shared libraries, you will not get
+ * the results you expect. :)
+ */
+
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This function dynamically loads a shared object and returns a pointer
+ * to the object handle (or NULL if there was an error).
+ * The 'sofile' parameter is a system dependent name of the object file.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
+
+/**
+ * Given an object handle, this function looks up the address of the
+ * named function in the shared object and returns it. This address
+ * is no longer valid after calling SDL_UnloadObject().
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
+ const char *name);
+
+/**
+ * Unload a shared object from memory.
+ */
+extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_loadso_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_log.h b/src/3rdparty/SDL2/include/SDL2/SDL_log.h
new file mode 100644
index 0000000..e12b658
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_log.h
@@ -0,0 +1,211 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_log.h
+ *
+ * Simple log messages with categories and priorities.
+ *
+ * By default logs are quiet, but if you're debugging SDL you might want:
+ *
+ * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
+ *
+ * Here's where the messages go on different platforms:
+ * Windows: debug output stream
+ * Android: log output
+ * Others: standard error output (stderr)
+ */
+
+#ifndef SDL_log_h_
+#define SDL_log_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief The maximum size of a log message
+ *
+ * Messages longer than the maximum size will be truncated
+ */
+#define SDL_MAX_LOG_MESSAGE 4096
+
+/**
+ * \brief The predefined log categories
+ *
+ * By default the application category is enabled at the INFO level,
+ * the assert category is enabled at the WARN level, test is enabled
+ * at the VERBOSE level and all other categories are enabled at the
+ * CRITICAL level.
+ */
+enum
+{
+ SDL_LOG_CATEGORY_APPLICATION,
+ SDL_LOG_CATEGORY_ERROR,
+ SDL_LOG_CATEGORY_ASSERT,
+ SDL_LOG_CATEGORY_SYSTEM,
+ SDL_LOG_CATEGORY_AUDIO,
+ SDL_LOG_CATEGORY_VIDEO,
+ SDL_LOG_CATEGORY_RENDER,
+ SDL_LOG_CATEGORY_INPUT,
+ SDL_LOG_CATEGORY_TEST,
+
+ /* Reserved for future SDL library use */
+ SDL_LOG_CATEGORY_RESERVED1,
+ SDL_LOG_CATEGORY_RESERVED2,
+ SDL_LOG_CATEGORY_RESERVED3,
+ SDL_LOG_CATEGORY_RESERVED4,
+ SDL_LOG_CATEGORY_RESERVED5,
+ SDL_LOG_CATEGORY_RESERVED6,
+ SDL_LOG_CATEGORY_RESERVED7,
+ SDL_LOG_CATEGORY_RESERVED8,
+ SDL_LOG_CATEGORY_RESERVED9,
+ SDL_LOG_CATEGORY_RESERVED10,
+
+ /* Beyond this point is reserved for application use, e.g.
+ enum {
+ MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
+ MYAPP_CATEGORY_AWESOME2,
+ MYAPP_CATEGORY_AWESOME3,
+ ...
+ };
+ */
+ SDL_LOG_CATEGORY_CUSTOM
+};
+
+/**
+ * \brief The predefined log priorities
+ */
+typedef enum
+{
+ SDL_LOG_PRIORITY_VERBOSE = 1,
+ SDL_LOG_PRIORITY_DEBUG,
+ SDL_LOG_PRIORITY_INFO,
+ SDL_LOG_PRIORITY_WARN,
+ SDL_LOG_PRIORITY_ERROR,
+ SDL_LOG_PRIORITY_CRITICAL,
+ SDL_NUM_LOG_PRIORITIES
+} SDL_LogPriority;
+
+
+/**
+ * \brief Set the priority of all log categories
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
+
+/**
+ * \brief Set the priority of a particular log category
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
+ SDL_LogPriority priority);
+
+/**
+ * \brief Get the priority of a particular log category
+ */
+extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
+
+/**
+ * \brief Reset all priorities to default.
+ *
+ * \note This is called in SDL_Quit().
+ */
+extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
+
+/**
+ * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
+ */
+extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
+ */
+extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
+ */
+extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_INFO
+ */
+extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_WARN
+ */
+extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_ERROR
+ */
+extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
+ */
+extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with the specified category and priority.
+ */
+extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
+ SDL_LogPriority priority,
+ SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
+
+/**
+ * \brief Log a message with the specified category and priority.
+ */
+extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
+ SDL_LogPriority priority,
+ const char *fmt, va_list ap);
+
+/**
+ * \brief The prototype for the log output function
+ */
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+
+/**
+ * \brief Get the current log output function.
+ */
+extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
+
+/**
+ * \brief This function allows you to replace the default log output
+ * function with one of your own.
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_log_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_main.h b/src/3rdparty/SDL2/include/SDL2/SDL_main.h
new file mode 100644
index 0000000..9855821
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_main.h
@@ -0,0 +1,168 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_main_h_
+#define SDL_main_h_
+
+#include "SDL_stdinc.h"
+
+/**
+ * \file SDL_main.h
+ *
+ * Redefine main() on some platforms so that it is called by SDL.
+ */
+
+#ifndef SDL_MAIN_HANDLED
+#if defined(__WIN32__)
+/* On Windows SDL provides WinMain(), which parses the command line and passes
+ the arguments to your main function.
+
+ If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
+ */
+#define SDL_MAIN_AVAILABLE
+
+#elif defined(__WINRT__)
+/* On WinRT, SDL provides a main function that initializes CoreApplication,
+ creating an instance of IFrameworkView in the process.
+
+ Please note that #include'ing SDL_main.h is not enough to get a main()
+ function working. In non-XAML apps, the file,
+ src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
+ into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
+ called, with a pointer to the Direct3D-hosted XAML control passed in.
+*/
+#define SDL_MAIN_NEEDED
+
+#elif defined(__IPHONEOS__)
+/* On iOS SDL provides a main function that creates an application delegate
+ and starts the iOS application run loop.
+
+ See src/video/uikit/SDL_uikitappdelegate.m for more details.
+ */
+#define SDL_MAIN_NEEDED
+
+#elif defined(__ANDROID__)
+/* On Android SDL provides a Java class in SDLActivity.java that is the
+ main activity entry point.
+
+ See docs/README-android.md for more details on extending that class.
+ */
+#define SDL_MAIN_NEEDED
+
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC DECLSPEC
+
+#elif defined(__NACL__)
+/* On NACL we use ppapi_simple to set up the application helper code,
+ then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
+ starting the user main function.
+ All user code is run in a separate thread by ppapi_simple, thus
+ allowing for blocking io to take place via nacl_io
+*/
+#define SDL_MAIN_NEEDED
+
+#endif
+#endif /* SDL_MAIN_HANDLED */
+
+#ifdef __cplusplus
+#define C_LINKAGE "C"
+#else
+#define C_LINKAGE
+#endif /* __cplusplus */
+
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
+
+/**
+ * \file SDL_main.h
+ *
+ * The application's main() function must be called with C linkage,
+ * and should be declared like this:
+ * \code
+ * #ifdef __cplusplus
+ * extern "C"
+ * #endif
+ * int main(int argc, char *argv[])
+ * {
+ * }
+ * \endcode
+ */
+
+#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
+#define main SDL_main
+#endif
+
+/**
+ * The prototype for the application's main() function
+ */
+extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
+
+
+#include "begin_code.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This is called by the real SDL main function to let the rest of the
+ * library know that initialization was done properly.
+ *
+ * Calling this yourself without knowing what you're doing can cause
+ * crashes and hard to diagnose problems with your application.
+ */
+extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
+
+#ifdef __WIN32__
+
+/**
+ * This can be called to set the application class at startup
+ */
+extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
+ void *hInst);
+extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
+
+#endif /* __WIN32__ */
+
+
+#ifdef __WINRT__
+
+/**
+ * \brief Initializes and launches an SDL/WinRT application.
+ *
+ * \param mainFunction The SDL app's C-style main().
+ * \param reserved Reserved for future use; should be NULL
+ * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
+ * information on the failure.
+ */
+extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
+
+#endif /* __WINRT__ */
+
+
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_main_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_messagebox.h b/src/3rdparty/SDL2/include/SDL2/SDL_messagebox.h
new file mode 100644
index 0000000..b7be59d
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_messagebox.h
@@ -0,0 +1,144 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_video.h" /* For SDL_Window */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
+ */
+typedef enum
+{
+ SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
+ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
+ SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
+} SDL_MessageBoxFlags;
+
+/**
+ * \brief Flags for SDL_MessageBoxButtonData.
+ */
+typedef enum
+{
+ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
+ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
+} SDL_MessageBoxButtonFlags;
+
+/**
+ * \brief Individual button data.
+ */
+typedef struct
+{
+ Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
+ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
+ const char * text; /**< The UTF-8 button text */
+} SDL_MessageBoxButtonData;
+
+/**
+ * \brief RGB value used in a message box color scheme
+ */
+typedef struct
+{
+ Uint8 r, g, b;
+} SDL_MessageBoxColor;
+
+typedef enum
+{
+ SDL_MESSAGEBOX_COLOR_BACKGROUND,
+ SDL_MESSAGEBOX_COLOR_TEXT,
+ SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
+ SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
+ SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
+ SDL_MESSAGEBOX_COLOR_MAX
+} SDL_MessageBoxColorType;
+
+/**
+ * \brief A set of colors to use for message box dialogs
+ */
+typedef struct
+{
+ SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
+} SDL_MessageBoxColorScheme;
+
+/**
+ * \brief MessageBox structure containing title, text, window, etc.
+ */
+typedef struct
+{
+ Uint32 flags; /**< ::SDL_MessageBoxFlags */
+ SDL_Window *window; /**< Parent window, can be NULL */
+ const char *title; /**< UTF-8 title */
+ const char *message; /**< UTF-8 message text */
+
+ int numbuttons;
+ const SDL_MessageBoxButtonData *buttons;
+
+ const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
+} SDL_MessageBoxData;
+
+/**
+ * \brief Create a modal message box.
+ *
+ * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
+ * \param buttonid The pointer to which user id of hit button should be copied.
+ *
+ * \return -1 on error, otherwise 0 and buttonid contains user id of button
+ * hit or -1 if dialog was closed.
+ *
+ * \note This function should be called on the thread that created the parent
+ * window, or on the main thread if the messagebox has no parent. It will
+ * block execution of that thread until the user clicks a button or
+ * closes the messagebox.
+ */
+extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+/**
+ * \brief Create a simple modal message box
+ *
+ * \param flags ::SDL_MessageBoxFlags
+ * \param title UTF-8 title text
+ * \param message UTF-8 message text
+ * \param window The parent window, or NULL for no parent
+ *
+ * \return 0 on success, -1 on error
+ *
+ * \sa SDL_ShowMessageBox
+ */
+extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_messagebox_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_mouse.h b/src/3rdparty/SDL2/include/SDL2/SDL_mouse.h
new file mode 100644
index 0000000..d3c9f61
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_mouse.h
@@ -0,0 +1,302 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_mouse.h
+ *
+ * Include file for SDL mouse event handling.
+ */
+
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
+
+/**
+ * \brief Cursor types for SDL_CreateSystemCursor().
+ */
+typedef enum
+{
+ SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
+ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
+ SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
+ SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
+ SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
+ SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
+ SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
+ SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
+ SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
+ SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
+ SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
+ SDL_SYSTEM_CURSOR_HAND, /**< Hand */
+ SDL_NUM_SYSTEM_CURSORS
+} SDL_SystemCursor;
+
+/**
+ * \brief Scroll direction types for the Scroll event
+ */
+typedef enum
+{
+ SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
+ SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
+} SDL_MouseWheelDirection;
+
+/* Function prototypes */
+
+/**
+ * \brief Get the window which currently has mouse focus.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
+
+/**
+ * \brief Retrieve the current state of the mouse.
+ *
+ * The current button state is returned as a button bitmask, which can
+ * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
+ * mouse cursor position relative to the focus window for the currently
+ * selected mouse. You can pass NULL for either x or y.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
+
+/**
+ * \brief Get the current state of the mouse, in relation to the desktop
+ *
+ * This works just like SDL_GetMouseState(), but the coordinates will be
+ * reported relative to the top-left of the desktop. This can be useful if
+ * you need to track the mouse outside of a specific window and
+ * SDL_CaptureMouse() doesn't fit your needs. For example, it could be
+ * useful if you need to track the mouse while dragging a window, where
+ * coordinates relative to a window might not be in sync at all times.
+ *
+ * \note SDL_GetMouseState() returns the mouse position as SDL understands
+ * it from the last pump of the event queue. This function, however,
+ * queries the OS for the current mouse position, and as such, might
+ * be a slightly less efficient function. Unless you know what you're
+ * doing and have a good reason to use this function, you probably want
+ * SDL_GetMouseState() instead.
+ *
+ * \param x Returns the current X coord, relative to the desktop. Can be NULL.
+ * \param y Returns the current Y coord, relative to the desktop. Can be NULL.
+ * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
+ *
+ * \sa SDL_GetMouseState
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
+
+/**
+ * \brief Retrieve the relative state of the mouse.
+ *
+ * The current button state is returned as a button bitmask, which can
+ * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
+ * mouse deltas since the last call to SDL_GetRelativeMouseState().
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
+
+/**
+ * \brief Moves the mouse to the given position within the window.
+ *
+ * \param window The window to move the mouse into, or NULL for the current mouse focus
+ * \param x The x coordinate within the window
+ * \param y The y coordinate within the window
+ *
+ * \note This function generates a mouse motion event
+ */
+extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
+ int x, int y);
+
+/**
+ * \brief Moves the mouse to the given position in global screen space.
+ *
+ * \param x The x coordinate
+ * \param y The y coordinate
+ * \return 0 on success, -1 on error (usually: unsupported by a platform).
+ *
+ * \note This function generates a mouse motion event
+ */
+extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
+
+/**
+ * \brief Set relative mouse mode.
+ *
+ * \param enabled Whether or not to enable relative mode
+ *
+ * \return 0 on success, or -1 if relative mode is not supported.
+ *
+ * While the mouse is in relative mode, the cursor is hidden, and the
+ * driver will try to report continuous motion in the current window.
+ * Only relative motion events will be delivered, the mouse position
+ * will not change.
+ *
+ * \note This function will flush any pending mouse motion.
+ *
+ * \sa SDL_GetRelativeMouseMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
+
+/**
+ * \brief Capture the mouse, to track input outside an SDL window.
+ *
+ * \param enabled Whether or not to enable capturing
+ *
+ * Capturing enables your app to obtain mouse events globally, instead of
+ * just within your window. Not all video targets support this function.
+ * When capturing is enabled, the current window will get all mouse events,
+ * but unlike relative mode, no change is made to the cursor and it is
+ * not restrained to your window.
+ *
+ * This function may also deny mouse input to other windows--both those in
+ * your application and others on the system--so you should use this
+ * function sparingly, and in small bursts. For example, you might want to
+ * track the mouse while the user is dragging something, until the user
+ * releases a mouse button. It is not recommended that you capture the mouse
+ * for long periods of time, such as the entire time your app is running.
+ *
+ * While captured, mouse events still report coordinates relative to the
+ * current (foreground) window, but those coordinates may be outside the
+ * bounds of the window (including negative values). Capturing is only
+ * allowed for the foreground window. If the window loses focus while
+ * capturing, the capture will be disabled automatically.
+ *
+ * While capturing is enabled, the current window will have the
+ * SDL_WINDOW_MOUSE_CAPTURE flag set.
+ *
+ * \return 0 on success, or -1 if not supported.
+ */
+extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
+
+/**
+ * \brief Query whether relative mouse mode is enabled.
+ *
+ * \sa SDL_SetRelativeMouseMode()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
+
+/**
+ * \brief Create a cursor, using the specified bitmap data and
+ * mask (in MSB format).
+ *
+ * The cursor width must be a multiple of 8 bits.
+ *
+ * The cursor is created in black and white according to the following:
+ * <table>
+ * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
+ * <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
+ * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
+ * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
+ * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
+ * if not. </td></tr>
+ * </table>
+ *
+ * \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
+ const Uint8 * mask,
+ int w, int h, int hot_x,
+ int hot_y);
+
+/**
+ * \brief Create a color cursor.
+ *
+ * \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
+ int hot_x,
+ int hot_y);
+
+/**
+ * \brief Create a system cursor.
+ *
+ * \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
+
+/**
+ * \brief Set the active cursor.
+ */
+extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
+
+/**
+ * \brief Return the active cursor.
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
+
+/**
+ * \brief Return the default cursor.
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
+
+/**
+ * \brief Frees a cursor created with SDL_CreateCursor() or similar functions.
+ *
+ * \sa SDL_CreateCursor()
+ * \sa SDL_CreateColorCursor()
+ * \sa SDL_CreateSystemCursor()
+ */
+extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
+
+/**
+ * \brief Toggle whether or not the cursor is shown.
+ *
+ * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
+ * state.
+ *
+ * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
+ */
+extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
+
+/**
+ * Used as a mask when testing buttons in buttonstate.
+ * - Button 1: Left mouse button
+ * - Button 2: Middle mouse button
+ * - Button 3: Right mouse button
+ */
+#define SDL_BUTTON(X) (1 << ((X)-1))
+#define SDL_BUTTON_LEFT 1
+#define SDL_BUTTON_MIDDLE 2
+#define SDL_BUTTON_RIGHT 3
+#define SDL_BUTTON_X1 4
+#define SDL_BUTTON_X2 5
+#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
+#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
+#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
+#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
+#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_mouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_mutex.h b/src/3rdparty/SDL2/include/SDL2/SDL_mutex.h
new file mode 100644
index 0000000..ba4247c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_mutex.h
@@ -0,0 +1,251 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
+
+/**
+ * \file SDL_mutex.h
+ *
+ * Functions to provide thread synchronization primitives.
+ */
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Synchronization functions which can time out return this value
+ * if they time out.
+ */
+#define SDL_MUTEX_TIMEDOUT 1
+
+/**
+ * This is the timeout value which corresponds to never time out.
+ */
+#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
+
+
+/**
+ * \name Mutex functions
+ */
+/* @{ */
+
+/* The SDL mutex structure, defined in SDL_sysmutex.c */
+struct SDL_mutex;
+typedef struct SDL_mutex SDL_mutex;
+
+/**
+ * Create a mutex, initialized unlocked.
+ */
+extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
+
+/**
+ * Lock the mutex.
+ *
+ * \return 0, or -1 on error.
+ */
+#define SDL_mutexP(m) SDL_LockMutex(m)
+extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
+
+/**
+ * Try to lock the mutex
+ *
+ * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
+
+/**
+ * Unlock the mutex.
+ *
+ * \return 0, or -1 on error.
+ *
+ * \warning It is an error to unlock a mutex that has not been locked by
+ * the current thread, and doing so results in undefined behavior.
+ */
+#define SDL_mutexV(m) SDL_UnlockMutex(m)
+extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
+
+/**
+ * Destroy a mutex.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
+
+/* @} *//* Mutex functions */
+
+
+/**
+ * \name Semaphore functions
+ */
+/* @{ */
+
+/* The SDL semaphore structure, defined in SDL_syssem.c */
+struct SDL_semaphore;
+typedef struct SDL_semaphore SDL_sem;
+
+/**
+ * Create a semaphore, initialized with value, returns NULL on failure.
+ */
+extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
+
+/**
+ * Destroy a semaphore.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
+
+/**
+ * This function suspends the calling thread until the semaphore pointed
+ * to by \c sem has a positive count. It then atomically decreases the
+ * semaphore count.
+ */
+extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
+
+/**
+ * Non-blocking variant of SDL_SemWait().
+ *
+ * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
+ * block, and -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
+
+/**
+ * Variant of SDL_SemWait() with a timeout in milliseconds.
+ *
+ * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
+ * succeed in the allotted time, and -1 on error.
+ *
+ * \warning On some platforms this function is implemented by looping with a
+ * delay of 1 ms, and so should be avoided if possible.
+ */
+extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
+
+/**
+ * Atomically increases the semaphore's count (not blocking).
+ *
+ * \return 0, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
+
+/**
+ * Returns the current count of the semaphore.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
+
+/* @} *//* Semaphore functions */
+
+
+/**
+ * \name Condition variable functions
+ */
+/* @{ */
+
+/* The SDL condition variable structure, defined in SDL_syscond.c */
+struct SDL_cond;
+typedef struct SDL_cond SDL_cond;
+
+/**
+ * Create a condition variable.
+ *
+ * Typical use of condition variables:
+ *
+ * Thread A:
+ * SDL_LockMutex(lock);
+ * while ( ! condition ) {
+ * SDL_CondWait(cond, lock);
+ * }
+ * SDL_UnlockMutex(lock);
+ *
+ * Thread B:
+ * SDL_LockMutex(lock);
+ * ...
+ * condition = true;
+ * ...
+ * SDL_CondSignal(cond);
+ * SDL_UnlockMutex(lock);
+ *
+ * There is some discussion whether to signal the condition variable
+ * with the mutex locked or not. There is some potential performance
+ * benefit to unlocking first on some platforms, but there are some
+ * potential race conditions depending on how your code is structured.
+ *
+ * In general it's safer to signal the condition variable while the
+ * mutex is locked.
+ */
+extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
+
+/**
+ * Destroy a condition variable.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
+
+/**
+ * Restart one of the threads that are waiting on the condition variable.
+ *
+ * \return 0 or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
+
+/**
+ * Restart all threads that are waiting on the condition variable.
+ *
+ * \return 0 or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
+
+/**
+ * Wait on the condition variable, unlocking the provided mutex.
+ *
+ * \warning The mutex must be locked before entering this function!
+ *
+ * The mutex is re-locked once the condition variable is signaled.
+ *
+ * \return 0 when it is signaled, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
+
+/**
+ * Waits for at most \c ms milliseconds, and returns 0 if the condition
+ * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
+ * signaled in the allotted time, and -1 on error.
+ *
+ * \warning On some platforms this function is implemented by looping with a
+ * delay of 1 ms, and so should be avoided if possible.
+ */
+extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
+ SDL_mutex * mutex, Uint32 ms);
+
+/* @} *//* Condition variable functions */
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_mutex_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_name.h b/src/3rdparty/SDL2/include/SDL2/SDL_name.h
new file mode 100644
index 0000000..ecd863f
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_name.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDLname_h_
+#define SDLname_h_
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define NeedFunctionPrototypes 1
+#endif
+
+#define SDL_NAME(X) SDL_##X
+
+#endif /* SDLname_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_opengl.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengl.h
new file mode 100644
index 0000000..253d9c9
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengl.h
@@ -0,0 +1,2183 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_opengl.h
+ *
+ * This is a simple file to encapsulate the OpenGL API headers.
+ */
+
+/**
+ * \def NO_SDL_GLEXT
+ *
+ * Define this if you have your own version of glext.h and want to disable the
+ * version included in SDL_opengl.h.
+ */
+
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
+
+#include "SDL_config.h"
+
+#ifndef __IPHONEOS__ /* No OpenGL on iOS. */
+
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef __gl_h_
+#define __gl_h_
+
+#if defined(USE_MGL_NAMESPACE)
+#include "gl_mangle.h"
+#endif
+
+
+/**********************************************************************
+ * Begin system-specific stuff.
+ */
+
+#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
+#define __WIN32__
+#endif
+
+#if defined(__WIN32__) && !defined(__CYGWIN__)
+# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+# define GLAPI __declspec(dllexport)
+# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+# define GLAPI __declspec(dllimport)
+# else /* for use with static link lib build of Win32 edition only */
+# define GLAPI extern
+# endif /* _STATIC_MESA support */
+# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
+# define GLAPIENTRY
+# else
+# define GLAPIENTRY __stdcall
+# endif
+#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
+# define GLAPI extern
+# define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+# define GLAPI extern
+# define GLAPIENTRY _System
+# define APIENTRY _System
+# if defined(__GNUC__) && !defined(_System)
+# define _System
+# endif
+#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define GLAPI __attribute__((visibility("default")))
+# define GLAPIENTRY
+#endif /* WIN32 && !CYGWIN */
+
+/*
+ * WINDOWS: Include windows.h here to define APIENTRY.
+ * It is also useful when applications include this file by
+ * including only glut.h, since glut.h depends on windows.h.
+ * Applications needing to include windows.h with parms other
+ * than "WIN32_LEAN_AND_MEAN" may include windows.h before
+ * glut.h or gl.h.
+ */
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#ifndef NOMINMAX /* don't define min() and max(). */
+#define NOMINMAX
+#endif
+#include <windows.h>
+#endif
+
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY GLAPIENTRY
+#endif
+
+/* "P" suffix to be used for a pointer to a function */
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+
+#ifndef GLAPIENTRYP
+#define GLAPIENTRYP GLAPIENTRY *
+#endif
+
+#if defined(PRAGMA_EXPORT_SUPPORTED)
+#pragma export on
+#endif
+
+/*
+ * End system-specific stuff.
+ **********************************************************************/
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define GL_VERSION_1_1 1
+#define GL_VERSION_1_2 1
+#define GL_VERSION_1_3 1
+#define GL_ARB_imaging 1
+
+
+/*
+ * Datatypes
+ */
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef void GLvoid;
+typedef signed char GLbyte; /* 1-byte signed */
+typedef short GLshort; /* 2-byte signed */
+typedef int GLint; /* 4-byte signed */
+typedef unsigned char GLubyte; /* 1-byte unsigned */
+typedef unsigned short GLushort; /* 2-byte unsigned */
+typedef unsigned int GLuint; /* 4-byte unsigned */
+typedef int GLsizei; /* 4-byte signed */
+typedef float GLfloat; /* single precision float */
+typedef float GLclampf; /* single precision float in [0,1] */
+typedef double GLdouble; /* double precision float */
+typedef double GLclampd; /* double precision float in [0,1] */
+
+
+
+/*
+ * Constants
+ */
+
+/* Boolean values */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* Data types */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_2_BYTES 0x1407
+#define GL_3_BYTES 0x1408
+#define GL_4_BYTES 0x1409
+#define GL_DOUBLE 0x140A
+
+/* Primitives */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_QUADS 0x0007
+#define GL_QUAD_STRIP 0x0008
+#define GL_POLYGON 0x0009
+
+/* Vertex Arrays */
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_INDEX_ARRAY 0x8077
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_EDGE_FLAG_ARRAY 0x8079
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_INDEX_ARRAY_TYPE 0x8085
+#define GL_INDEX_ARRAY_STRIDE 0x8086
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_INDEX_ARRAY_POINTER 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
+#define GL_V2F 0x2A20
+#define GL_V3F 0x2A21
+#define GL_C4UB_V2F 0x2A22
+#define GL_C4UB_V3F 0x2A23
+#define GL_C3F_V3F 0x2A24
+#define GL_N3F_V3F 0x2A25
+#define GL_C4F_N3F_V3F 0x2A26
+#define GL_T2F_V3F 0x2A27
+#define GL_T4F_V4F 0x2A28
+#define GL_T2F_C4UB_V3F 0x2A29
+#define GL_T2F_C3F_V3F 0x2A2A
+#define GL_T2F_N3F_V3F 0x2A2B
+#define GL_T2F_C4F_N3F_V3F 0x2A2C
+#define GL_T4F_C4F_N3F_V4F 0x2A2D
+
+/* Matrix Mode */
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+
+/* Points */
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_POINT_SIZE_RANGE 0x0B12
+
+/* Lines */
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_LINE_STIPPLE 0x0B24
+#define GL_LINE_STIPPLE_PATTERN 0x0B25
+#define GL_LINE_STIPPLE_REPEAT 0x0B26
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_LINE_WIDTH_RANGE 0x0B22
+
+/* Polygons */
+#define GL_POINT 0x1B00
+#define GL_LINE 0x1B01
+#define GL_FILL 0x1B02
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_POLYGON_MODE 0x0B40
+#define GL_POLYGON_SMOOTH 0x0B41
+#define GL_POLYGON_STIPPLE 0x0B42
+#define GL_EDGE_FLAG 0x0B43
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_FILL 0x8037
+
+/* Display Lists */
+#define GL_COMPILE 0x1300
+#define GL_COMPILE_AND_EXECUTE 0x1301
+#define GL_LIST_BASE 0x0B32
+#define GL_LIST_INDEX 0x0B33
+#define GL_LIST_MODE 0x0B30
+
+/* Depth buffer */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+#define GL_DEPTH_TEST 0x0B71
+#define GL_DEPTH_BITS 0x0D56
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_COMPONENT 0x1902
+
+/* Lighting */
+#define GL_LIGHTING 0x0B50
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+#define GL_SPOT_EXPONENT 0x1205
+#define GL_SPOT_CUTOFF 0x1206
+#define GL_CONSTANT_ATTENUATION 0x1207
+#define GL_LINEAR_ATTENUATION 0x1208
+#define GL_QUADRATIC_ATTENUATION 0x1209
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_SHININESS 0x1601
+#define GL_EMISSION 0x1600
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+#define GL_COLOR_INDEXES 0x1603
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_SHADE_MODEL 0x0B54
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_COLOR_MATERIAL_FACE 0x0B55
+#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
+#define GL_NORMALIZE 0x0BA1
+
+/* User clipping planes */
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+
+/* Accumulation buffer */
+#define GL_ACCUM_RED_BITS 0x0D58
+#define GL_ACCUM_GREEN_BITS 0x0D59
+#define GL_ACCUM_BLUE_BITS 0x0D5A
+#define GL_ACCUM_ALPHA_BITS 0x0D5B
+#define GL_ACCUM_CLEAR_VALUE 0x0B80
+#define GL_ACCUM 0x0100
+#define GL_ADD 0x0104
+#define GL_LOAD 0x0101
+#define GL_MULT 0x0103
+#define GL_RETURN 0x0102
+
+/* Alpha testing */
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+
+/* Blending */
+#define GL_BLEND 0x0BE2
+#define GL_BLEND_SRC 0x0BE1
+#define GL_BLEND_DST 0x0BE0
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+
+/* Render Mode */
+#define GL_FEEDBACK 0x1C01
+#define GL_RENDER 0x1C00
+#define GL_SELECT 0x1C02
+
+/* Feedback */
+#define GL_2D 0x0600
+#define GL_3D 0x0601
+#define GL_3D_COLOR 0x0602
+#define GL_3D_COLOR_TEXTURE 0x0603
+#define GL_4D_COLOR_TEXTURE 0x0604
+#define GL_POINT_TOKEN 0x0701
+#define GL_LINE_TOKEN 0x0702
+#define GL_LINE_RESET_TOKEN 0x0707
+#define GL_POLYGON_TOKEN 0x0703
+#define GL_BITMAP_TOKEN 0x0704
+#define GL_DRAW_PIXEL_TOKEN 0x0705
+#define GL_COPY_PIXEL_TOKEN 0x0706
+#define GL_PASS_THROUGH_TOKEN 0x0700
+#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
+#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
+#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
+
+/* Selection */
+#define GL_SELECTION_BUFFER_POINTER 0x0DF3
+#define GL_SELECTION_BUFFER_SIZE 0x0DF4
+
+/* Fog */
+#define GL_FOG 0x0B60
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_COLOR 0x0B66
+#define GL_FOG_INDEX 0x0B61
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_LINEAR 0x2601
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+
+/* Logic Ops */
+#define GL_LOGIC_OP 0x0BF1
+#define GL_INDEX_LOGIC_OP 0x0BF1
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_CLEAR 0x1500
+#define GL_SET 0x150F
+#define GL_COPY 0x1503
+#define GL_COPY_INVERTED 0x150C
+#define GL_NOOP 0x1505
+#define GL_INVERT 0x150A
+#define GL_AND 0x1501
+#define GL_NAND 0x150E
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_XOR 0x1506
+#define GL_EQUIV 0x1509
+#define GL_AND_REVERSE 0x1502
+#define GL_AND_INVERTED 0x1504
+#define GL_OR_REVERSE 0x150B
+#define GL_OR_INVERTED 0x150D
+
+/* Stencil */
+#define GL_STENCIL_BITS 0x0D57
+#define GL_STENCIL_TEST 0x0B90
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_INDEX 0x1901
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+
+/* Buffers, Pixel Drawing/Reading */
+#define GL_NONE 0
+#define GL_LEFT 0x0406
+#define GL_RIGHT 0x0407
+/*GL_FRONT 0x0404 */
+/*GL_BACK 0x0405 */
+/*GL_FRONT_AND_BACK 0x0408 */
+#define GL_FRONT_LEFT 0x0400
+#define GL_FRONT_RIGHT 0x0401
+#define GL_BACK_LEFT 0x0402
+#define GL_BACK_RIGHT 0x0403
+#define GL_AUX0 0x0409
+#define GL_AUX1 0x040A
+#define GL_AUX2 0x040B
+#define GL_AUX3 0x040C
+#define GL_COLOR_INDEX 0x1900
+#define GL_RED 0x1903
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_ALPHA 0x1906
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_ALPHA_BITS 0x0D55
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_INDEX_BITS 0x0D51
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_AUX_BUFFERS 0x0C00
+#define GL_READ_BUFFER 0x0C02
+#define GL_DRAW_BUFFER 0x0C01
+#define GL_DOUBLEBUFFER 0x0C32
+#define GL_STEREO 0x0C33
+#define GL_BITMAP 0x1A00
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_DITHER 0x0BD0
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+
+/* Implementation limits */
+#define GL_MAX_LIST_NESTING 0x0B31
+#define GL_MAX_EVAL_ORDER 0x0D30
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
+#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_NAME_STACK_DEPTH 0x0D37
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
+
+/* Gets */
+#define GL_ATTRIB_STACK_DEPTH 0x0BB0
+#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_CURRENT_INDEX 0x0B01
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_RASTER_COLOR 0x0B04
+#define GL_CURRENT_RASTER_DISTANCE 0x0B09
+#define GL_CURRENT_RASTER_INDEX 0x0B05
+#define GL_CURRENT_RASTER_POSITION 0x0B07
+#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
+#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_INDEX_CLEAR_VALUE 0x0C20
+#define GL_INDEX_MODE 0x0C30
+#define GL_INDEX_WRITEMASK 0x0C21
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_NAME_STACK_DEPTH 0x0D70
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_RENDER_MODE 0x0C40
+#define GL_RGBA_MODE 0x0C31
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_VIEWPORT 0x0BA2
+
+/* Evaluators */
+#define GL_AUTO_NORMAL 0x0D80
+#define GL_MAP1_COLOR_4 0x0D90
+#define GL_MAP1_INDEX 0x0D91
+#define GL_MAP1_NORMAL 0x0D92
+#define GL_MAP1_TEXTURE_COORD_1 0x0D93
+#define GL_MAP1_TEXTURE_COORD_2 0x0D94
+#define GL_MAP1_TEXTURE_COORD_3 0x0D95
+#define GL_MAP1_TEXTURE_COORD_4 0x0D96
+#define GL_MAP1_VERTEX_3 0x0D97
+#define GL_MAP1_VERTEX_4 0x0D98
+#define GL_MAP2_COLOR_4 0x0DB0
+#define GL_MAP2_INDEX 0x0DB1
+#define GL_MAP2_NORMAL 0x0DB2
+#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
+#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
+#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
+#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
+#define GL_MAP2_VERTEX_3 0x0DB7
+#define GL_MAP2_VERTEX_4 0x0DB8
+#define GL_MAP1_GRID_DOMAIN 0x0DD0
+#define GL_MAP1_GRID_SEGMENTS 0x0DD1
+#define GL_MAP2_GRID_DOMAIN 0x0DD2
+#define GL_MAP2_GRID_SEGMENTS 0x0DD3
+#define GL_COEFF 0x0A00
+#define GL_ORDER 0x0A01
+#define GL_DOMAIN 0x0A02
+
+/* Hints */
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_POLYGON_SMOOTH_HINT 0x0C53
+#define GL_FOG_HINT 0x0C54
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* Scissor box */
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+
+/* Pixel Mode / Transfer */
+#define GL_MAP_COLOR 0x0D10
+#define GL_MAP_STENCIL 0x0D11
+#define GL_INDEX_SHIFT 0x0D12
+#define GL_INDEX_OFFSET 0x0D13
+#define GL_RED_SCALE 0x0D14
+#define GL_RED_BIAS 0x0D15
+#define GL_GREEN_SCALE 0x0D18
+#define GL_GREEN_BIAS 0x0D19
+#define GL_BLUE_SCALE 0x0D1A
+#define GL_BLUE_BIAS 0x0D1B
+#define GL_ALPHA_SCALE 0x0D1C
+#define GL_ALPHA_BIAS 0x0D1D
+#define GL_DEPTH_SCALE 0x0D1E
+#define GL_DEPTH_BIAS 0x0D1F
+#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
+#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
+#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
+#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
+#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
+#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
+#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
+#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
+#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
+#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
+#define GL_PIXEL_MAP_S_TO_S 0x0C71
+#define GL_PIXEL_MAP_I_TO_I 0x0C70
+#define GL_PIXEL_MAP_I_TO_R 0x0C72
+#define GL_PIXEL_MAP_I_TO_G 0x0C73
+#define GL_PIXEL_MAP_I_TO_B 0x0C74
+#define GL_PIXEL_MAP_I_TO_A 0x0C75
+#define GL_PIXEL_MAP_R_TO_R 0x0C76
+#define GL_PIXEL_MAP_G_TO_G 0x0C77
+#define GL_PIXEL_MAP_B_TO_B 0x0C78
+#define GL_PIXEL_MAP_A_TO_A 0x0C79
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_PACK_LSB_FIRST 0x0D01
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SWAP_BYTES 0x0D00
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_UNPACK_LSB_FIRST 0x0CF1
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SWAP_BYTES 0x0CF0
+#define GL_ZOOM_X 0x0D16
+#define GL_ZOOM_Y 0x0D17
+
+/* Texture mapping */
+#define GL_TEXTURE_ENV 0x2300
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_ENV_COLOR 0x2201
+#define GL_TEXTURE_GEN_S 0x0C60
+#define GL_TEXTURE_GEN_T 0x0C61
+#define GL_TEXTURE_GEN_R 0x0C62
+#define GL_TEXTURE_GEN_Q 0x0C63
+#define GL_TEXTURE_GEN_MODE 0x2500
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_BORDER 0x1005
+#define GL_TEXTURE_COMPONENTS 0x1003
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
+#define GL_TEXTURE_INTENSITY_SIZE 0x8061
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_OBJECT_LINEAR 0x2401
+#define GL_OBJECT_PLANE 0x2501
+#define GL_EYE_LINEAR 0x2400
+#define GL_EYE_PLANE 0x2502
+#define GL_SPHERE_MAP 0x2402
+#define GL_DECAL 0x2101
+#define GL_MODULATE 0x2100
+#define GL_NEAREST 0x2600
+#define GL_REPEAT 0x2901
+#define GL_CLAMP 0x2900
+#define GL_S 0x2000
+#define GL_T 0x2001
+#define GL_R 0x2002
+#define GL_Q 0x2003
+
+/* Utility */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* Errors */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* glPush/PopAttrib bits */
+#define GL_CURRENT_BIT 0x00000001
+#define GL_POINT_BIT 0x00000002
+#define GL_LINE_BIT 0x00000004
+#define GL_POLYGON_BIT 0x00000008
+#define GL_POLYGON_STIPPLE_BIT 0x00000010
+#define GL_PIXEL_MODE_BIT 0x00000020
+#define GL_LIGHTING_BIT 0x00000040
+#define GL_FOG_BIT 0x00000080
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_ACCUM_BUFFER_BIT 0x00000200
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_VIEWPORT_BIT 0x00000800
+#define GL_TRANSFORM_BIT 0x00001000
+#define GL_ENABLE_BIT 0x00002000
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_HINT_BIT 0x00008000
+#define GL_EVAL_BIT 0x00010000
+#define GL_LIST_BIT 0x00020000
+#define GL_TEXTURE_BIT 0x00040000
+#define GL_SCISSOR_BIT 0x00080000
+#define GL_ALL_ATTRIB_BITS 0x000FFFFF
+
+
+/* OpenGL 1.1 */
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_2D 0x8064
+#define GL_TEXTURE_PRIORITY 0x8066
+#define GL_TEXTURE_RESIDENT 0x8067
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_ALPHA4 0x803B
+#define GL_ALPHA8 0x803C
+#define GL_ALPHA12 0x803D
+#define GL_ALPHA16 0x803E
+#define GL_LUMINANCE4 0x803F
+#define GL_LUMINANCE8 0x8040
+#define GL_LUMINANCE12 0x8041
+#define GL_LUMINANCE16 0x8042
+#define GL_LUMINANCE4_ALPHA4 0x8043
+#define GL_LUMINANCE6_ALPHA2 0x8044
+#define GL_LUMINANCE8_ALPHA8 0x8045
+#define GL_LUMINANCE12_ALPHA4 0x8046
+#define GL_LUMINANCE12_ALPHA12 0x8047
+#define GL_LUMINANCE16_ALPHA16 0x8048
+#define GL_INTENSITY 0x8049
+#define GL_INTENSITY4 0x804A
+#define GL_INTENSITY8 0x804B
+#define GL_INTENSITY12 0x804C
+#define GL_INTENSITY16 0x804D
+#define GL_R3_G3_B2 0x2A10
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB8 0x8051
+#define GL_RGB10 0x8052
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGBA2 0x8055
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
+#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
+#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
+#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
+
+
+
+/*
+ * Miscellaneous
+ */
+
+GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
+
+GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
+
+GLAPI void GLAPIENTRY glClear( GLbitfield mask );
+
+GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
+
+GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
+
+GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
+
+GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
+
+GLAPI void GLAPIENTRY glLogicOp( GLenum opcode );
+
+GLAPI void GLAPIENTRY glCullFace( GLenum mode );
+
+GLAPI void GLAPIENTRY glFrontFace( GLenum mode );
+
+GLAPI void GLAPIENTRY glPointSize( GLfloat size );
+
+GLAPI void GLAPIENTRY glLineWidth( GLfloat width );
+
+GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern );
+
+GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode );
+
+GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
+
+GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask );
+
+GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask );
+
+GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
+
+GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
+
+GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
+
+GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
+
+GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation );
+
+GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode );
+
+GLAPI void GLAPIENTRY glReadBuffer( GLenum mode );
+
+GLAPI void GLAPIENTRY glEnable( GLenum cap );
+
+GLAPI void GLAPIENTRY glDisable( GLenum cap );
+
+GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap );
+
+
+GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */
+
+
+GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params );
+
+GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params );
+
+GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask );
+
+GLAPI void GLAPIENTRY glPopAttrib( void );
+
+
+GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */
+
+
+GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode );
+
+GLAPI GLenum GLAPIENTRY glGetError( void );
+
+GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name );
+
+GLAPI void GLAPIENTRY glFinish( void );
+
+GLAPI void GLAPIENTRY glFlush( void );
+
+GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode );
+
+
+/*
+ * Depth Buffer
+ */
+
+GLAPI void GLAPIENTRY glClearDepth( GLclampd depth );
+
+GLAPI void GLAPIENTRY glDepthFunc( GLenum func );
+
+GLAPI void GLAPIENTRY glDepthMask( GLboolean flag );
+
+GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
+
+
+/*
+ * Accumulation Buffer
+ */
+
+GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
+
+GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
+
+
+/*
+ * Transformation
+ */
+
+GLAPI void GLAPIENTRY glMatrixMode( GLenum mode );
+
+GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble near_val, GLdouble far_val );
+
+GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble near_val, GLdouble far_val );
+
+GLAPI void GLAPIENTRY glViewport( GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+GLAPI void GLAPIENTRY glPushMatrix( void );
+
+GLAPI void GLAPIENTRY glPopMatrix( void );
+
+GLAPI void GLAPIENTRY glLoadIdentity( void );
+
+GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m );
+GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m );
+
+GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m );
+GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m );
+
+GLAPI void GLAPIENTRY glRotated( GLdouble angle,
+ GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glRotatef( GLfloat angle,
+ GLfloat x, GLfloat y, GLfloat z );
+
+GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
+
+GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z );
+
+
+/*
+ * Display Lists
+ */
+
+GLAPI GLboolean GLAPIENTRY glIsList( GLuint list );
+
+GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range );
+
+GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range );
+
+GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode );
+
+GLAPI void GLAPIENTRY glEndList( void );
+
+GLAPI void GLAPIENTRY glCallList( GLuint list );
+
+GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type,
+ const GLvoid *lists );
+
+GLAPI void GLAPIENTRY glListBase( GLuint base );
+
+
+/*
+ * Drawing Functions
+ */
+
+GLAPI void GLAPIENTRY glBegin( GLenum mode );
+
+GLAPI void GLAPIENTRY glEnd( void );
+
+
+GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y );
+GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y );
+GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y );
+GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y );
+
+GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z );
+GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z );
+GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z );
+
+GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w );
+GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
+
+GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex2iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex3iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex4iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
+GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
+GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
+GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz );
+GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz );
+
+GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glNormal3iv( const GLint *v );
+GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glIndexd( GLdouble c );
+GLAPI void GLAPIENTRY glIndexf( GLfloat c );
+GLAPI void GLAPIENTRY glIndexi( GLint c );
+GLAPI void GLAPIENTRY glIndexs( GLshort c );
+GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c );
+GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c );
+GLAPI void GLAPIENTRY glIndexiv( const GLint *c );
+GLAPI void GLAPIENTRY glIndexsv( const GLshort *c );
+GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue );
+GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue );
+GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue );
+GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue );
+GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue );
+GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
+GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue );
+GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue );
+
+GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green,
+ GLbyte blue, GLbyte alpha );
+GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green,
+ GLdouble blue, GLdouble alpha );
+GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha );
+GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green,
+ GLint blue, GLint alpha );
+GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green,
+ GLshort blue, GLshort alpha );
+GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green,
+ GLubyte blue, GLubyte alpha );
+GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green,
+ GLuint blue, GLuint alpha );
+GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green,
+ GLushort blue, GLushort alpha );
+
+
+GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glColor3iv( const GLint *v );
+GLAPI void GLAPIENTRY glColor3sv( const GLshort *v );
+GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v );
+GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v );
+GLAPI void GLAPIENTRY glColor3usv( const GLushort *v );
+
+GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glColor4iv( const GLint *v );
+GLAPI void GLAPIENTRY glColor4sv( const GLshort *v );
+GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v );
+GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v );
+GLAPI void GLAPIENTRY glColor4usv( const GLushort *v );
+
+
+GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s );
+GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s );
+GLAPI void GLAPIENTRY glTexCoord1i( GLint s );
+GLAPI void GLAPIENTRY glTexCoord1s( GLshort s );
+
+GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t );
+GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t );
+GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t );
+GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t );
+
+GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
+GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
+GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r );
+GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r );
+
+GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q );
+GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
+
+GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y );
+GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y );
+GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y );
+GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y );
+
+GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
+GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z );
+GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z );
+
+GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w );
+GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
+
+GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
+GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
+GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
+GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
+
+
+GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 );
+GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 );
+GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 );
+GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 );
+
+
+/*
+ * Vertex Arrays (1.1)
+ */
+
+GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride,
+ const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride,
+ const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params );
+
+GLAPI void GLAPIENTRY glArrayElement( GLint i );
+
+GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
+
+GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices );
+
+GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride,
+ const GLvoid *pointer );
+
+/*
+ * Lighting
+ */
+
+GLAPI void GLAPIENTRY glShadeModel( GLenum mode );
+
+GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname,
+ const GLfloat *params );
+GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname,
+ GLfloat *params );
+GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params );
+
+GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode );
+
+
+/*
+ * Raster functions
+ */
+
+GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor );
+
+GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize,
+ const GLfloat *values );
+GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize,
+ const GLuint *values );
+GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize,
+ const GLushort *values );
+
+GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values );
+GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values );
+GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values );
+
+GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height,
+ GLfloat xorig, GLfloat yorig,
+ GLfloat xmove, GLfloat ymove,
+ const GLubyte *bitmap );
+
+GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum type );
+
+/*
+ * Stenciling
+ */
+
+GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask );
+
+GLAPI void GLAPIENTRY glStencilMask( GLuint mask );
+
+GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
+
+GLAPI void GLAPIENTRY glClearStencil( GLint s );
+
+
+
+/*
+ * Texture mapping
+ */
+
+GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param );
+GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params );
+GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
+GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname,
+ const GLfloat *params );
+GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target,
+ GLenum pname, GLfloat *params);
+GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target,
+ GLenum pname, GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level,
+ GLenum format, GLenum type,
+ GLvoid *pixels );
+
+
+/* 1.1 functions */
+
+GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures );
+
+GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures);
+
+GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture );
+
+GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n,
+ const GLuint *textures,
+ const GLclampf *priorities );
+
+GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences );
+
+GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture );
+
+
+GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid *pixels );
+
+
+GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLint border );
+
+
+GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLint border );
+
+
+GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y,
+ GLsizei width );
+
+
+GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+
+/*
+ * Evaluators
+ */
+
+GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2,
+ GLint stride,
+ GLint order, const GLdouble *points );
+GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2,
+ GLint stride,
+ GLint order, const GLfloat *points );
+
+GLAPI void GLAPIENTRY glMap2d( GLenum target,
+ GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+ GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+ const GLdouble *points );
+GLAPI void GLAPIENTRY glMap2f( GLenum target,
+ GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLfloat *points );
+
+GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v );
+GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v );
+GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v );
+
+GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u );
+GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u );
+
+GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u );
+GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u );
+
+GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v );
+GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v );
+
+GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u );
+GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u );
+
+GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
+GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
+
+GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+ GLint vn, GLdouble v1, GLdouble v2 );
+GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+ GLint vn, GLfloat v1, GLfloat v2 );
+
+GLAPI void GLAPIENTRY glEvalPoint1( GLint i );
+
+GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j );
+
+GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 );
+
+GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
+
+
+/*
+ * Fog
+ */
+
+GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param );
+
+GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params );
+
+GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params );
+
+
+/*
+ * Selection and Feedback
+ */
+
+GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
+
+GLAPI void GLAPIENTRY glPassThrough( GLfloat token );
+
+GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer );
+
+GLAPI void GLAPIENTRY glInitNames( void );
+
+GLAPI void GLAPIENTRY glLoadName( GLuint name );
+
+GLAPI void GLAPIENTRY glPushName( GLuint name );
+
+GLAPI void GLAPIENTRY glPopName( void );
+
+
+
+/*
+ * OpenGL 1.2
+ */
+
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_TEXTURE_BINDING_3D 0x806A
+
+GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start,
+ GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
+
+GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLsizei depth, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLenum format,
+ GLenum type, const GLvoid *pixels);
+
+GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLint x,
+ GLint y, GLsizei width,
+ GLsizei height );
+
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+/*
+ * GL_ARB_imaging
+ */
+
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_COLOR_TABLE 0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
+#define GL_PROXY_COLOR_TABLE 0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
+#define GL_COLOR_TABLE_SCALE 0x80D6
+#define GL_COLOR_TABLE_BIAS 0x80D7
+#define GL_COLOR_TABLE_FORMAT 0x80D8
+#define GL_COLOR_TABLE_WIDTH 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
+#define GL_CONVOLUTION_1D 0x8010
+#define GL_CONVOLUTION_2D 0x8011
+#define GL_SEPARABLE_2D 0x8012
+#define GL_CONVOLUTION_BORDER_MODE 0x8013
+#define GL_CONVOLUTION_FILTER_SCALE 0x8014
+#define GL_CONVOLUTION_FILTER_BIAS 0x8015
+#define GL_REDUCE 0x8016
+#define GL_CONVOLUTION_FORMAT 0x8017
+#define GL_CONVOLUTION_WIDTH 0x8018
+#define GL_CONVOLUTION_HEIGHT 0x8019
+#define GL_MAX_CONVOLUTION_WIDTH 0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
+#define GL_CONSTANT_BORDER 0x8151
+#define GL_REPLICATE_BORDER 0x8153
+#define GL_CONVOLUTION_BORDER_COLOR 0x8154
+#define GL_COLOR_MATRIX 0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
+#define GL_HISTOGRAM 0x8024
+#define GL_PROXY_HISTOGRAM 0x8025
+#define GL_HISTOGRAM_WIDTH 0x8026
+#define GL_HISTOGRAM_FORMAT 0x8027
+#define GL_HISTOGRAM_RED_SIZE 0x8028
+#define GL_HISTOGRAM_GREEN_SIZE 0x8029
+#define GL_HISTOGRAM_BLUE_SIZE 0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
+#define GL_HISTOGRAM_SINK 0x802D
+#define GL_MINMAX 0x802E
+#define GL_MINMAX_FORMAT 0x802F
+#define GL_MINMAX_SINK 0x8030
+#define GL_TABLE_TOO_LARGE 0x8031
+#define GL_BLEND_EQUATION 0x8009
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_COLOR 0x8005
+
+
+GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid *table );
+
+GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
+ GLsizei start, GLsizei count,
+ GLenum format, GLenum type,
+ const GLvoid *data );
+
+GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
+ const GLint *params);
+
+GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
+ const GLfloat *params);
+
+GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *table );
+
+GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
+
+GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha );
+
+GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
+ GLenum internalformat, GLboolean sink );
+
+GLAPI void GLAPIENTRY glResetHistogram( GLenum target );
+
+GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
+ GLenum format, GLenum type,
+ GLvoid *values );
+
+GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
+ GLboolean sink );
+
+GLAPI void GLAPIENTRY glResetMinmax( GLenum target );
+
+GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
+ GLenum format, GLenum types,
+ GLvoid *values );
+
+GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
+ GLenum internalformat, GLsizei width, GLenum format, GLenum type,
+ const GLvoid *image );
+
+GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *image );
+
+GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
+ GLfloat params );
+
+GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
+ const GLfloat *params );
+
+GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
+ GLint params );
+
+GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
+ GLenum internalformat, GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
+ GLenum internalformat, GLint x, GLint y, GLsizei width,
+ GLsizei height);
+
+GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
+ GLenum type, GLvoid *image );
+
+GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *row, const GLvoid *column );
+
+GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
+ GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
+
+
+
+
+/*
+ * OpenGL 1.3
+ */
+
+/* multitexture */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+/* texture_cube_map */
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+/* texture_compression */
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+/* multisample */
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_MULTISAMPLE_BIT 0x20000000
+/* transpose_matrix */
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+/* texture_env_combine */
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_SOURCE0_RGB 0x8580
+#define GL_SOURCE1_RGB 0x8581
+#define GL_SOURCE2_RGB 0x8582
+#define GL_SOURCE0_ALPHA 0x8588
+#define GL_SOURCE1_ALPHA 0x8589
+#define GL_SOURCE2_ALPHA 0x858A
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_OPERAND2_ALPHA 0x859A
+#define GL_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_SUBTRACT 0x84E7
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+/* texture_env_dot3 */
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+/* texture_border_clamp */
+#define GL_CLAMP_TO_BORDER 0x812D
+
+GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
+
+GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
+
+GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
+
+GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
+
+GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
+
+GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
+
+GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
+
+
+typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
+
+
+
+/*
+ * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
+ */
+#ifndef GL_ARB_multitexture
+#define GL_ARB_multitexture 1
+
+#define GL_TEXTURE0_ARB 0x84C0
+#define GL_TEXTURE1_ARB 0x84C1
+#define GL_TEXTURE2_ARB 0x84C2
+#define GL_TEXTURE3_ARB 0x84C3
+#define GL_TEXTURE4_ARB 0x84C4
+#define GL_TEXTURE5_ARB 0x84C5
+#define GL_TEXTURE6_ARB 0x84C6
+#define GL_TEXTURE7_ARB 0x84C7
+#define GL_TEXTURE8_ARB 0x84C8
+#define GL_TEXTURE9_ARB 0x84C9
+#define GL_TEXTURE10_ARB 0x84CA
+#define GL_TEXTURE11_ARB 0x84CB
+#define GL_TEXTURE12_ARB 0x84CC
+#define GL_TEXTURE13_ARB 0x84CD
+#define GL_TEXTURE14_ARB 0x84CE
+#define GL_TEXTURE15_ARB 0x84CF
+#define GL_TEXTURE16_ARB 0x84D0
+#define GL_TEXTURE17_ARB 0x84D1
+#define GL_TEXTURE18_ARB 0x84D2
+#define GL_TEXTURE19_ARB 0x84D3
+#define GL_TEXTURE20_ARB 0x84D4
+#define GL_TEXTURE21_ARB 0x84D5
+#define GL_TEXTURE22_ARB 0x84D6
+#define GL_TEXTURE23_ARB 0x84D7
+#define GL_TEXTURE24_ARB 0x84D8
+#define GL_TEXTURE25_ARB 0x84D9
+#define GL_TEXTURE26_ARB 0x84DA
+#define GL_TEXTURE27_ARB 0x84DB
+#define GL_TEXTURE28_ARB 0x84DC
+#define GL_TEXTURE29_ARB 0x84DD
+#define GL_TEXTURE30_ARB 0x84DE
+#define GL_TEXTURE31_ARB 0x84DF
+#define GL_ACTIVE_TEXTURE_ARB 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
+
+GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
+GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture);
+GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s);
+GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s);
+GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s);
+GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s);
+GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
+GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
+GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
+GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
+GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
+GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
+
+typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
+
+#endif /* GL_ARB_multitexture */
+
+
+
+/*
+ * Define this token if you want "old-style" header file behaviour (extensions
+ * defined in gl.h). Otherwise, extensions will be included from glext.h.
+ */
+#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
+#include "SDL_opengl_glext.h"
+#endif /* GL_GLEXT_LEGACY */
+
+
+
+/*
+ * ???. GL_MESA_packed_depth_stencil
+ * XXX obsolete
+ */
+#ifndef GL_MESA_packed_depth_stencil
+#define GL_MESA_packed_depth_stencil 1
+
+#define GL_DEPTH_STENCIL_MESA 0x8750
+#define GL_UNSIGNED_INT_24_8_MESA 0x8751
+#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
+#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753
+#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
+
+#endif /* GL_MESA_packed_depth_stencil */
+
+
+#ifndef GL_ATI_blend_equation_separate
+#define GL_ATI_blend_equation_separate 1
+
+#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D
+
+GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA );
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA);
+
+#endif /* GL_ATI_blend_equation_separate */
+
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+
+/**
+ ** NOTE!!!!! If you add new functions to this file, or update
+ ** glext.h be sure to regenerate the gl_mangle.h file. See comments
+ ** in that file for details.
+ **/
+
+
+
+/**********************************************************************
+ * Begin system-specific stuff
+ */
+#if defined(PRAGMA_EXPORT_SUPPORTED)
+#pragma export off
+#endif
+
+/*
+ * End system-specific stuff
+ **********************************************************************/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl_h_ */
+
+#endif /* !__IPHONEOS__ */
+
+#endif /* SDL_opengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl_glext.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengl_glext.h
index cd3869f..cd3869f 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengl_glext.h
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengl_glext.h
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_opengles.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengles.h
new file mode 100644
index 0000000..18dd984
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengles.h
@@ -0,0 +1,39 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_opengles.h
+ *
+ * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
+ */
+#include "SDL_config.h"
+
+#ifdef __IPHONEOS__
+#include <OpenGLES/ES1/gl.h>
+#include <OpenGLES/ES1/glext.h>
+#else
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_opengles2.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2.h
new file mode 100644
index 0000000..6ccecf2
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_opengles2.h
+ *
+ * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
+ */
+#include "SDL_config.h"
+
+#ifndef _MSC_VER
+
+#ifdef __IPHONEOS__
+#include <OpenGLES/ES2/gl.h>
+#include <OpenGLES/ES2/glext.h>
+#else
+#include <GLES2/gl2platform.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#endif
+
+#else /* _MSC_VER */
+
+/* OpenGL ES2 headers for Visual Studio */
+#include "SDL_opengles2_khrplatform.h"
+#include "SDL_opengles2_gl2platform.h"
+#include "SDL_opengles2_gl2.h"
+#include "SDL_opengles2_gl2ext.h"
+
+#endif /* _MSC_VER */
+
+#ifndef APIENTRY
+#define APIENTRY GL_APIENTRY
+#endif
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2.h
index c62fb0a..c62fb0a 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2.h
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2.h
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2ext.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2ext.h
index e8ca8b1..e8ca8b1 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2ext.h
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2ext.h
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2platform.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2platform.h
index c325686..c325686 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_gl2platform.h
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_gl2platform.h
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_khrplatform.h b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_khrplatform.h
index c9e6f17..c9e6f17 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL2/SDL_opengles2_khrplatform.h
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_opengles2_khrplatform.h
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_pixels.h b/src/3rdparty/SDL2/include/SDL2/SDL_pixels.h
new file mode 100644
index 0000000..0b4364b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_pixels.h
@@ -0,0 +1,470 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_pixels.h
+ *
+ * Header for the enumerated pixel format definitions.
+ */
+
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_endian.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \name Transparency definitions
+ *
+ * These define alpha as the opacity of a surface.
+ */
+/* @{ */
+#define SDL_ALPHA_OPAQUE 255
+#define SDL_ALPHA_TRANSPARENT 0
+/* @} */
+
+/** Pixel type. */
+enum
+{
+ SDL_PIXELTYPE_UNKNOWN,
+ SDL_PIXELTYPE_INDEX1,
+ SDL_PIXELTYPE_INDEX4,
+ SDL_PIXELTYPE_INDEX8,
+ SDL_PIXELTYPE_PACKED8,
+ SDL_PIXELTYPE_PACKED16,
+ SDL_PIXELTYPE_PACKED32,
+ SDL_PIXELTYPE_ARRAYU8,
+ SDL_PIXELTYPE_ARRAYU16,
+ SDL_PIXELTYPE_ARRAYU32,
+ SDL_PIXELTYPE_ARRAYF16,
+ SDL_PIXELTYPE_ARRAYF32
+};
+
+/** Bitmap pixel order, high bit -> low bit. */
+enum
+{
+ SDL_BITMAPORDER_NONE,
+ SDL_BITMAPORDER_4321,
+ SDL_BITMAPORDER_1234
+};
+
+/** Packed component order, high bit -> low bit. */
+enum
+{
+ SDL_PACKEDORDER_NONE,
+ SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDORDER_RGBX,
+ SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDORDER_BGRX,
+ SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDORDER_BGRA
+};
+
+/** Array component order, low byte -> high byte. */
+/* !!! FIXME: in 2.1, make these not overlap differently with
+ !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
+enum
+{
+ SDL_ARRAYORDER_NONE,
+ SDL_ARRAYORDER_RGB,
+ SDL_ARRAYORDER_RGBA,
+ SDL_ARRAYORDER_ARGB,
+ SDL_ARRAYORDER_BGR,
+ SDL_ARRAYORDER_BGRA,
+ SDL_ARRAYORDER_ABGR
+};
+
+/** Packed component layout. */
+enum
+{
+ SDL_PACKEDLAYOUT_NONE,
+ SDL_PACKEDLAYOUT_332,
+ SDL_PACKEDLAYOUT_4444,
+ SDL_PACKEDLAYOUT_1555,
+ SDL_PACKEDLAYOUT_5551,
+ SDL_PACKEDLAYOUT_565,
+ SDL_PACKEDLAYOUT_8888,
+ SDL_PACKEDLAYOUT_2101010,
+ SDL_PACKEDLAYOUT_1010102
+};
+
+#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
+
+#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
+ ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
+ ((bits) << 8) | ((bytes) << 0))
+
+#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
+#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
+#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
+#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
+#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
+#define SDL_BYTESPERPIXEL(X) \
+ (SDL_ISPIXELFORMAT_FOURCC(X) ? \
+ ((((X) == SDL_PIXELFORMAT_YUY2) || \
+ ((X) == SDL_PIXELFORMAT_UYVY) || \
+ ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
+
+#define SDL_ISPIXELFORMAT_INDEXED(format) \
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
+
+#define SDL_ISPIXELFORMAT_PACKED(format) \
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
+
+#define SDL_ISPIXELFORMAT_ARRAY(format) \
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
+
+#define SDL_ISPIXELFORMAT_ALPHA(format) \
+ ((SDL_ISPIXELFORMAT_PACKED(format) && \
+ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
+ (SDL_ISPIXELFORMAT_ARRAY(format) && \
+ ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
+ (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
+ (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
+ (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
+
+/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
+#define SDL_ISPIXELFORMAT_FOURCC(format) \
+ ((format) && (SDL_PIXELFLAG(format) != 1))
+
+/* Note: If you modify this list, update SDL_GetPixelFormatName() */
+enum
+{
+ SDL_PIXELFORMAT_UNKNOWN,
+ SDL_PIXELFORMAT_INDEX1LSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
+ 1, 0),
+ SDL_PIXELFORMAT_INDEX1MSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
+ 1, 0),
+ SDL_PIXELFORMAT_INDEX4LSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
+ 4, 0),
+ SDL_PIXELFORMAT_INDEX4MSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
+ 4, 0),
+ SDL_PIXELFORMAT_INDEX8 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
+ SDL_PIXELFORMAT_RGB332 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_332, 8, 1),
+ SDL_PIXELFORMAT_RGB444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_4444, 12, 2),
+ SDL_PIXELFORMAT_RGB555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_1555, 15, 2),
+ SDL_PIXELFORMAT_BGR555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_1555, 15, 2),
+ SDL_PIXELFORMAT_ARGB4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_RGBA4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_ABGR4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_BGRA4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_ARGB1555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_1555, 16, 2),
+ SDL_PIXELFORMAT_RGBA5551 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_5551, 16, 2),
+ SDL_PIXELFORMAT_ABGR1555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_1555, 16, 2),
+ SDL_PIXELFORMAT_BGRA5551 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_5551, 16, 2),
+ SDL_PIXELFORMAT_RGB565 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_565, 16, 2),
+ SDL_PIXELFORMAT_BGR565 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_565, 16, 2),
+ SDL_PIXELFORMAT_RGB24 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
+ 24, 3),
+ SDL_PIXELFORMAT_BGR24 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
+ 24, 3),
+ SDL_PIXELFORMAT_RGB888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_RGBX8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_BGR888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_BGRX8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_ARGB8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_RGBA8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_ABGR8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_BGRA8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_ARGB2101010 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_2101010, 32, 4),
+
+ /* Aliases for RGBA byte arrays of color data, for the current platform */
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
+ SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
+ SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
+#else
+ SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
+ SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
+ SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
+#endif
+
+ SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
+ SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
+ SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
+ SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
+ SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
+ SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
+ SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
+ SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+ SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
+ SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
+};
+
+typedef struct SDL_Color
+{
+ Uint8 r;
+ Uint8 g;
+ Uint8 b;
+ Uint8 a;
+} SDL_Color;
+#define SDL_Colour SDL_Color
+
+typedef struct SDL_Palette
+{
+ int ncolors;
+ SDL_Color *colors;
+ Uint32 version;
+ int refcount;
+} SDL_Palette;
+
+/**
+ * \note Everything in the pixel format structure is read-only.
+ */
+typedef struct SDL_PixelFormat
+{
+ Uint32 format;
+ SDL_Palette *palette;
+ Uint8 BitsPerPixel;
+ Uint8 BytesPerPixel;
+ Uint8 padding[2];
+ Uint32 Rmask;
+ Uint32 Gmask;
+ Uint32 Bmask;
+ Uint32 Amask;
+ Uint8 Rloss;
+ Uint8 Gloss;
+ Uint8 Bloss;
+ Uint8 Aloss;
+ Uint8 Rshift;
+ Uint8 Gshift;
+ Uint8 Bshift;
+ Uint8 Ashift;
+ int refcount;
+ struct SDL_PixelFormat *next;
+} SDL_PixelFormat;
+
+/**
+ * \brief Get the human readable name of a pixel format
+ */
+extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
+
+/**
+ * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
+ *
+ * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
+ *
+ * \sa SDL_MasksToPixelFormatEnum()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
+ int *bpp,
+ Uint32 * Rmask,
+ Uint32 * Gmask,
+ Uint32 * Bmask,
+ Uint32 * Amask);
+
+/**
+ * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
+ *
+ * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
+ * wasn't possible.
+ *
+ * \sa SDL_PixelFormatEnumToMasks()
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
+ Uint32 Rmask,
+ Uint32 Gmask,
+ Uint32 Bmask,
+ Uint32 Amask);
+
+/**
+ * \brief Create an SDL_PixelFormat structure from a pixel format enum.
+ */
+extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
+
+/**
+ * \brief Free an SDL_PixelFormat structure.
+ */
+extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
+
+/**
+ * \brief Create a palette structure with the specified number of color
+ * entries.
+ *
+ * \return A new palette, or NULL if there wasn't enough memory.
+ *
+ * \note The palette entries are initialized to white.
+ *
+ * \sa SDL_FreePalette()
+ */
+extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
+
+/**
+ * \brief Set the palette for a pixel format structure.
+ */
+extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
+ SDL_Palette *palette);
+
+/**
+ * \brief Set a range of colors in a palette.
+ *
+ * \param palette The palette to modify.
+ * \param colors An array of colors to copy into the palette.
+ * \param firstcolor The index of the first palette entry to modify.
+ * \param ncolors The number of entries to modify.
+ *
+ * \return 0 on success, or -1 if not all of the colors could be set.
+ */
+extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
+ const SDL_Color * colors,
+ int firstcolor, int ncolors);
+
+/**
+ * \brief Free a palette created with SDL_AllocPalette().
+ *
+ * \sa SDL_AllocPalette()
+ */
+extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
+
+/**
+ * \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
+ *
+ * \sa SDL_MapRGBA
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
+ Uint8 r, Uint8 g, Uint8 b);
+
+/**
+ * \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
+ *
+ * \sa SDL_MapRGB
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
+ Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a);
+
+/**
+ * \brief Get the RGB components from a pixel of the specified format.
+ *
+ * \sa SDL_GetRGBA
+ */
+extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
+ const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b);
+
+/**
+ * \brief Get the RGBA components from a pixel of the specified format.
+ *
+ * \sa SDL_GetRGB
+ */
+extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
+ const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b,
+ Uint8 * a);
+
+/**
+ * \brief Calculate a 256 entry gamma ramp for a gamma value.
+ */
+extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_pixels_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_platform.h b/src/3rdparty/SDL2/include/SDL2/SDL_platform.h
new file mode 100644
index 0000000..7dea4ce
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_platform.h
@@ -0,0 +1,198 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_platform.h
+ *
+ * Try to get a standard set of platform defines.
+ */
+
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
+
+#if defined(_AIX)
+#undef __AIX__
+#define __AIX__ 1
+#endif
+#if defined(__HAIKU__)
+#undef __HAIKU__
+#define __HAIKU__ 1
+#endif
+#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
+#undef __BSDI__
+#define __BSDI__ 1
+#endif
+#if defined(_arch_dreamcast)
+#undef __DREAMCAST__
+#define __DREAMCAST__ 1
+#endif
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+#undef __FREEBSD__
+#define __FREEBSD__ 1
+#endif
+#if defined(hpux) || defined(__hpux) || defined(__hpux__)
+#undef __HPUX__
+#define __HPUX__ 1
+#endif
+#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
+#undef __IRIX__
+#define __IRIX__ 1
+#endif
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+#undef __LINUX__
+#define __LINUX__ 1
+#endif
+#if defined(ANDROID) || defined(__ANDROID__)
+#undef __ANDROID__
+#undef __LINUX__ /* do we need to do this? */
+#define __ANDROID__ 1
+#endif
+
+#if defined(__APPLE__)
+/* lets us know what version of Mac OS X we're compiling on */
+#include "AvailabilityMacros.h"
+#include "TargetConditionals.h"
+#if TARGET_OS_TV
+#undef __TVOS__
+#define __TVOS__ 1
+#endif
+#if TARGET_OS_IPHONE
+/* if compiling for iOS */
+#undef __IPHONEOS__
+#define __IPHONEOS__ 1
+#undef __MACOSX__
+#else
+/* if not compiling for iOS */
+#undef __MACOSX__
+#define __MACOSX__ 1
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# error SDL for Mac OS X only supports deploying on 10.6 and above.
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
+#endif /* TARGET_OS_IPHONE */
+#endif /* defined(__APPLE__) */
+
+#if defined(__NetBSD__)
+#undef __NETBSD__
+#define __NETBSD__ 1
+#endif
+#if defined(__OpenBSD__)
+#undef __OPENBSD__
+#define __OPENBSD__ 1
+#endif
+#if defined(__OS2__) || defined(__EMX__)
+#undef __OS2__
+#define __OS2__ 1
+#endif
+#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
+#undef __OSF__
+#define __OSF__ 1
+#endif
+#if defined(__QNXNTO__)
+#undef __QNXNTO__
+#define __QNXNTO__ 1
+#endif
+#if defined(riscos) || defined(__riscos) || defined(__riscos__)
+#undef __RISCOS__
+#define __RISCOS__ 1
+#endif
+#if defined(__sun) && defined(__SVR4)
+#undef __SOLARIS__
+#define __SOLARIS__ 1
+#endif
+
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
+/* Try to find out if we're compiling for WinRT or non-WinRT */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
+#include <winapifamily.h>
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
+#undef __WINRT__
+#define __WINRT__ 1
+#else
+#undef __WINDOWS__
+#define __WINDOWS__ 1
+#endif
+#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
+
+#if defined(__WINDOWS__)
+#undef __WIN32__
+#define __WIN32__ 1
+#endif
+#if defined(__PSP__)
+#undef __PSP__
+#define __PSP__ 1
+#endif
+
+/* The NACL compiler defines __native_client__ and __pnacl__
+ * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
+ */
+#if defined(__native_client__)
+#undef __LINUX__
+#undef __NACL__
+#define __NACL__ 1
+#endif
+#if defined(__pnacl__)
+#undef __LINUX__
+#undef __PNACL__
+#define __PNACL__ 1
+/* PNACL with newlib supports static linking only */
+#define __SDL_NOGETPROCADDR__
+#endif
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Gets the name of the platform.
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_platform_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_power.h b/src/3rdparty/SDL2/include/SDL2/SDL_power.h
new file mode 100644
index 0000000..a4fe8a9
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_power.h
@@ -0,0 +1,75 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_power_h_
+#define SDL_power_h_
+
+/**
+ * \file SDL_power.h
+ *
+ * Header for the SDL power management routines.
+ */
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The basic state for the system's power supply.
+ */
+typedef enum
+{
+ SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
+ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
+ SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
+ SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
+ SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
+} SDL_PowerState;
+
+
+/**
+ * \brief Get the current power supply details.
+ *
+ * \param secs Seconds of battery life left. You can pass a NULL here if
+ * you don't care. Will return -1 if we can't determine a
+ * value, or we're not running on a battery.
+ *
+ * \param pct Percentage of battery life left, between 0 and 100. You can
+ * pass a NULL here if you don't care. Will return -1 if we
+ * can't determine a value, or we're not running on a battery.
+ *
+ * \return The state of the battery (if any).
+ */
+extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_power_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_quit.h b/src/3rdparty/SDL2/include/SDL2/SDL_quit.h
new file mode 100644
index 0000000..fea56a8
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_quit.h
@@ -0,0 +1,58 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_quit.h
+ *
+ * Include file for SDL quit event handling.
+ */
+
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+/**
+ * \file SDL_quit.h
+ *
+ * An ::SDL_QUIT event is generated when the user tries to close the application
+ * window. If it is ignored or filtered out, the window will remain open.
+ * If it is not ignored or filtered, it is queued normally and the window
+ * is allowed to close. When the window is closed, screen updates will
+ * complete, but have no effect.
+ *
+ * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
+ * and SIGTERM (system termination request), if handlers do not already
+ * exist, that generate ::SDL_QUIT events as well. There is no way
+ * to determine the cause of an ::SDL_QUIT event, but setting a signal
+ * handler in your application will override the default generation of
+ * quit events for that signal.
+ *
+ * \sa SDL_Quit()
+ */
+
+/* There are no functions directly affecting the quit event */
+
+#define SDL_QuitRequested() \
+ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
+
+#endif /* SDL_quit_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_rect.h b/src/3rdparty/SDL2/include/SDL2/SDL_rect.h
new file mode 100644
index 0000000..543bb61
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_rect.h
@@ -0,0 +1,148 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_rect.h
+ *
+ * Header file for SDL_rect definition and management functions.
+ */
+
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_pixels.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The structure that defines a point
+ *
+ * \sa SDL_EnclosePoints
+ * \sa SDL_PointInRect
+ */
+typedef struct SDL_Point
+{
+ int x;
+ int y;
+} SDL_Point;
+
+/**
+ * \brief A rectangle, with the origin at the upper left.
+ *
+ * \sa SDL_RectEmpty
+ * \sa SDL_RectEquals
+ * \sa SDL_HasIntersection
+ * \sa SDL_IntersectRect
+ * \sa SDL_UnionRect
+ * \sa SDL_EnclosePoints
+ */
+typedef struct SDL_Rect
+{
+ int x, y;
+ int w, h;
+} SDL_Rect;
+
+/**
+ * \brief Returns true if point resides inside a rectangle.
+ */
+SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
+{
+ return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
+ (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
+}
+
+/**
+ * \brief Returns true if the rectangle has no area.
+ */
+SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
+{
+ return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
+}
+
+/**
+ * \brief Returns true if the two rectangles are equal.
+ */
+SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
+{
+ return (a && b && (a->x == b->x) && (a->y == b->y) &&
+ (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
+}
+
+/**
+ * \brief Determine whether two rectangles intersect.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
+ const SDL_Rect * B);
+
+/**
+ * \brief Calculate the intersection of two rectangles.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
+ const SDL_Rect * B,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate the union of two rectangles.
+ */
+extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
+ const SDL_Rect * B,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate a minimal rectangle enclosing a set of points
+ *
+ * \return SDL_TRUE if any points were within the clipping rect
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
+ int count,
+ const SDL_Rect * clip,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate the intersection of a rectangle and line segment.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
+ rect, int *X1,
+ int *Y1, int *X2,
+ int *Y2);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_rect_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_render.h b/src/3rdparty/SDL2/include/SDL2/SDL_render.h
new file mode 100644
index 0000000..d336192
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_render.h
@@ -0,0 +1,931 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_render.h
+ *
+ * Header file for SDL 2D rendering functions.
+ *
+ * This API supports the following features:
+ * * single pixel points
+ * * single pixel lines
+ * * filled rectangles
+ * * texture images
+ *
+ * The primitives may be drawn in opaque, blended, or additive modes.
+ *
+ * The texture images may be drawn in opaque, blended, or additive modes.
+ * They can have an additional color tint or alpha modulation applied to
+ * them, and may also be stretched with linear interpolation.
+ *
+ * This API is designed to accelerate simple 2D operations. You may
+ * want more functionality such as polygons and particle effects and
+ * in that case you should use SDL's OpenGL/Direct3D support or one
+ * of the many good 3D engines.
+ *
+ * These functions must be called from the main thread.
+ * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
+ */
+
+#ifndef SDL_render_h_
+#define SDL_render_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_rect.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Flags used when creating a rendering context
+ */
+typedef enum
+{
+ SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
+ SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
+ acceleration */
+ SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
+ with the refresh rate */
+ SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
+ rendering to texture */
+} SDL_RendererFlags;
+
+/**
+ * \brief Information on the capabilities of a render driver or context.
+ */
+typedef struct SDL_RendererInfo
+{
+ const char *name; /**< The name of the renderer */
+ Uint32 flags; /**< Supported ::SDL_RendererFlags */
+ Uint32 num_texture_formats; /**< The number of available texture formats */
+ Uint32 texture_formats[16]; /**< The available texture formats */
+ int max_texture_width; /**< The maximum texture width */
+ int max_texture_height; /**< The maximum texture height */
+} SDL_RendererInfo;
+
+/**
+ * \brief The access pattern allowed for a texture.
+ */
+typedef enum
+{
+ SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
+ SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
+ SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
+} SDL_TextureAccess;
+
+/**
+ * \brief The texture channel modulation used in SDL_RenderCopy().
+ */
+typedef enum
+{
+ SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
+ SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
+ SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
+} SDL_TextureModulate;
+
+/**
+ * \brief Flip constants for SDL_RenderCopyEx
+ */
+typedef enum
+{
+ SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
+ SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
+ SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
+} SDL_RendererFlip;
+
+/**
+ * \brief A structure representing rendering state
+ */
+struct SDL_Renderer;
+typedef struct SDL_Renderer SDL_Renderer;
+
+/**
+ * \brief An efficient driver-specific representation of pixel data
+ */
+struct SDL_Texture;
+typedef struct SDL_Texture SDL_Texture;
+
+
+/* Function prototypes */
+
+/**
+ * \brief Get the number of 2D rendering drivers available for the current
+ * display.
+ *
+ * A render driver is a set of code that handles rendering and texture
+ * management on a particular display. Normally there is only one, but
+ * some drivers may have several available with different capabilities.
+ *
+ * \sa SDL_GetRenderDriverInfo()
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
+
+/**
+ * \brief Get information about a specific 2D rendering driver for the current
+ * display.
+ *
+ * \param index The index of the driver to query information about.
+ * \param info A pointer to an SDL_RendererInfo struct to be filled with
+ * information on the rendering driver.
+ *
+ * \return 0 on success, -1 if the index was out of range.
+ *
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
+ SDL_RendererInfo * info);
+
+/**
+ * \brief Create a window and default renderer
+ *
+ * \param width The width of the window
+ * \param height The height of the window
+ * \param window_flags The flags used to create the window
+ * \param window A pointer filled with the window, or NULL on error
+ * \param renderer A pointer filled with the renderer, or NULL on error
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
+ int width, int height, Uint32 window_flags,
+ SDL_Window **window, SDL_Renderer **renderer);
+
+
+/**
+ * \brief Create a 2D rendering context for a window.
+ *
+ * \param window The window where rendering is displayed.
+ * \param index The index of the rendering driver to initialize, or -1 to
+ * initialize the first one supporting the requested flags.
+ * \param flags ::SDL_RendererFlags.
+ *
+ * \return A valid rendering context or NULL if there was an error.
+ *
+ * \sa SDL_CreateSoftwareRenderer()
+ * \sa SDL_GetRendererInfo()
+ * \sa SDL_DestroyRenderer()
+ */
+extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
+ int index, Uint32 flags);
+
+/**
+ * \brief Create a 2D software rendering context for a surface.
+ *
+ * \param surface The surface where rendering is done.
+ *
+ * \return A valid rendering context or NULL if there was an error.
+ *
+ * \sa SDL_CreateRenderer()
+ * \sa SDL_DestroyRenderer()
+ */
+extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
+
+/**
+ * \brief Get the renderer associated with a window.
+ */
+extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
+
+/**
+ * \brief Get information about a rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
+ SDL_RendererInfo * info);
+
+/**
+ * \brief Get the output size in pixels of a rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
+ int *w, int *h);
+
+/**
+ * \brief Create a texture for a rendering context.
+ *
+ * \param renderer The renderer.
+ * \param format The format of the texture.
+ * \param access One of the enumerated values in ::SDL_TextureAccess.
+ * \param w The width of the texture in pixels.
+ * \param h The height of the texture in pixels.
+ *
+ * \return The created texture is returned, or NULL if no rendering context was
+ * active, the format was unsupported, or the width or height were out
+ * of range.
+ *
+ * \note The contents of the texture are not defined at creation.
+ *
+ * \sa SDL_QueryTexture()
+ * \sa SDL_UpdateTexture()
+ * \sa SDL_DestroyTexture()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
+ Uint32 format,
+ int access, int w,
+ int h);
+
+/**
+ * \brief Create a texture from an existing surface.
+ *
+ * \param renderer The renderer.
+ * \param surface The surface containing pixel data used to fill the texture.
+ *
+ * \return The created texture is returned, or NULL on error.
+ *
+ * \note The surface is not modified or freed by this function.
+ *
+ * \sa SDL_QueryTexture()
+ * \sa SDL_DestroyTexture()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
+
+/**
+ * \brief Query the attributes of a texture
+ *
+ * \param texture A texture to be queried.
+ * \param format A pointer filled in with the raw format of the texture. The
+ * actual format may differ, but pixel transfers will use this
+ * format.
+ * \param access A pointer filled in with the actual access to the texture.
+ * \param w A pointer filled in with the width of the texture in pixels.
+ * \param h A pointer filled in with the height of the texture in pixels.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ */
+extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
+ Uint32 * format, int *access,
+ int *w, int *h);
+
+/**
+ * \brief Set an additional color value used in render copy operations.
+ *
+ * \param texture The texture to update.
+ * \param r The red color value multiplied into copy operations.
+ * \param g The green color value multiplied into copy operations.
+ * \param b The blue color value multiplied into copy operations.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or color modulation
+ * is not supported.
+ *
+ * \sa SDL_GetTextureColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
+ Uint8 r, Uint8 g, Uint8 b);
+
+
+/**
+ * \brief Get the additional color value used in render copy operations.
+ *
+ * \param texture The texture to query.
+ * \param r A pointer filled in with the current red color value.
+ * \param g A pointer filled in with the current green color value.
+ * \param b A pointer filled in with the current blue color value.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
+ Uint8 * r, Uint8 * g,
+ Uint8 * b);
+
+/**
+ * \brief Set an additional alpha value used in render copy operations.
+ *
+ * \param texture The texture to update.
+ * \param alpha The alpha value multiplied into copy operations.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or alpha modulation
+ * is not supported.
+ *
+ * \sa SDL_GetTextureAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
+ Uint8 alpha);
+
+/**
+ * \brief Get the additional alpha value used in render copy operations.
+ *
+ * \param texture The texture to query.
+ * \param alpha A pointer filled in with the current alpha value.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
+ Uint8 * alpha);
+
+/**
+ * \brief Set the blend mode used for texture copy operations.
+ *
+ * \param texture The texture to update.
+ * \param blendMode ::SDL_BlendMode to use for texture blending.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or the blend mode is
+ * not supported.
+ *
+ * \note If the blend mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetTextureBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
+ SDL_BlendMode blendMode);
+
+/**
+ * \brief Get the blend mode used for texture copy operations.
+ *
+ * \param texture The texture to query.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
+ SDL_BlendMode *blendMode);
+
+/**
+ * \brief Update the given texture rectangle with new pixel data.
+ *
+ * \param texture The texture to update
+ * \param rect A pointer to the rectangle of pixels to update, or NULL to
+ * update the entire texture.
+ * \param pixels The raw pixel data in the format of the texture.
+ * \param pitch The number of bytes in a row of pixel data, including padding between lines.
+ *
+ * The pixel data must be in the format of the texture. The pixel format can be
+ * queried with SDL_QueryTexture.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \note This is a fairly slow function.
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const void *pixels, int pitch);
+
+/**
+ * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
+ *
+ * \param texture The texture to update
+ * \param rect A pointer to the rectangle of pixels to update, or NULL to
+ * update the entire texture.
+ * \param Yplane The raw pixel data for the Y plane.
+ * \param Ypitch The number of bytes between rows of pixel data for the Y plane.
+ * \param Uplane The raw pixel data for the U plane.
+ * \param Upitch The number of bytes between rows of pixel data for the U plane.
+ * \param Vplane The raw pixel data for the V plane.
+ * \param Vpitch The number of bytes between rows of pixel data for the V plane.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \note You can use SDL_UpdateTexture() as long as your pixel data is
+ * a contiguous block of Y and U/V planes in the proper order, but
+ * this function is available if your pixel data is not contiguous.
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+
+/**
+ * \brief Lock a portion of the texture for write-only pixel access.
+ *
+ * \param texture The texture to lock for access, which was created with
+ * ::SDL_TEXTUREACCESS_STREAMING.
+ * \param rect A pointer to the rectangle to lock for access. If the rect
+ * is NULL, the entire texture will be locked.
+ * \param pixels This is filled in with a pointer to the locked pixels,
+ * appropriately offset by the locked area.
+ * \param pitch This is filled in with the pitch of the locked pixels.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
+ *
+ * \sa SDL_UnlockTexture()
+ */
+extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ void **pixels, int *pitch);
+
+/**
+ * \brief Unlock a texture, uploading the changes to video memory, if needed.
+ *
+ * \sa SDL_LockTexture()
+ */
+extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
+
+/**
+ * \brief Determines whether a window supports the use of render targets
+ *
+ * \param renderer The renderer that will be checked
+ *
+ * \return SDL_TRUE if supported, SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
+
+/**
+ * \brief Set a texture as the current rendering target.
+ *
+ * \param renderer The renderer.
+ * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \sa SDL_GetRenderTarget()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
+ SDL_Texture *texture);
+
+/**
+ * \brief Get the current render target or NULL for the default render target.
+ *
+ * \return The current render target
+ *
+ * \sa SDL_SetRenderTarget()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
+
+/**
+ * \brief Set device independent resolution for rendering
+ *
+ * \param renderer The renderer for which resolution should be set.
+ * \param w The width of the logical resolution
+ * \param h The height of the logical resolution
+ *
+ * This function uses the viewport and scaling functionality to allow a fixed logical
+ * resolution for rendering, regardless of the actual output resolution. If the actual
+ * output resolution doesn't have the same aspect ratio the output rendering will be
+ * centered within the output display.
+ *
+ * If the output display is a window, mouse events in the window will be filtered
+ * and scaled so they seem to arrive within the logical resolution.
+ *
+ * \note If this function results in scaling or subpixel drawing by the
+ * rendering backend, it will be handled using the appropriate
+ * quality hints.
+ *
+ * \sa SDL_RenderGetLogicalSize()
+ * \sa SDL_RenderSetScale()
+ * \sa SDL_RenderSetViewport()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
+
+/**
+ * \brief Get device independent resolution for rendering
+ *
+ * \param renderer The renderer from which resolution should be queried.
+ * \param w A pointer filled with the width of the logical resolution
+ * \param h A pointer filled with the height of the logical resolution
+ *
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
+
+/**
+ * \brief Set whether to force integer scales for resolution-independent rendering
+ *
+ * \param renderer The renderer for which integer scaling should be set.
+ * \param enable Enable or disable integer scaling
+ *
+ * This function restricts the logical viewport to integer values - that is, when
+ * a resolution is between two multiples of a logical size, the viewport size is
+ * rounded down to the lower multiple.
+ *
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer,
+ SDL_bool enable);
+
+/**
+ * \brief Get whether integer scales are forced for resolution-independent rendering
+ *
+ * \param renderer The renderer from which integer scaling should be queried.
+ *
+ * \sa SDL_RenderSetIntegerScale()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer);
+
+/**
+ * \brief Set the drawing area for rendering on the current target.
+ *
+ * \param renderer The renderer for which the drawing area should be set.
+ * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
+ *
+ * The x,y of the viewport rect represents the origin for rendering.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \note If the window associated with the renderer is resized, the viewport is automatically reset.
+ *
+ * \sa SDL_RenderGetViewport()
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Get the drawing area for the current target.
+ *
+ * \sa SDL_RenderSetViewport()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
+ SDL_Rect * rect);
+
+/**
+ * \brief Set the clip rectangle for the current target.
+ *
+ * \param renderer The renderer for which clip rectangle should be set.
+ * \param rect A pointer to the rectangle to set as the clip rectangle, or
+ * NULL to disable clipping.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \sa SDL_RenderGetClipRect()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Get the clip rectangle for the current target.
+ *
+ * \param renderer The renderer from which clip rectangle should be queried.
+ * \param rect A pointer filled in with the current clip rectangle, or
+ * an empty rectangle if clipping is disabled.
+ *
+ * \sa SDL_RenderSetClipRect()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
+ SDL_Rect * rect);
+
+/**
+ * \brief Get whether clipping is enabled on the given renderer.
+ *
+ * \param renderer The renderer from which clip state should be queried.
+ *
+ * \sa SDL_RenderGetClipRect()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer);
+
+
+/**
+ * \brief Set the drawing scale for rendering on the current target.
+ *
+ * \param renderer The renderer for which the drawing scale should be set.
+ * \param scaleX The horizontal scaling factor
+ * \param scaleY The vertical scaling factor
+ *
+ * The drawing coordinates are scaled by the x/y scaling factors
+ * before they are used by the renderer. This allows resolution
+ * independent drawing with a single coordinate system.
+ *
+ * \note If this results in scaling or subpixel drawing by the
+ * rendering backend, it will be handled using the appropriate
+ * quality hints. For best results use integer scaling factors.
+ *
+ * \sa SDL_RenderGetScale()
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
+ float scaleX, float scaleY);
+
+/**
+ * \brief Get the drawing scale for the current target.
+ *
+ * \param renderer The renderer from which drawing scale should be queried.
+ * \param scaleX A pointer filled in with the horizontal scaling factor
+ * \param scaleY A pointer filled in with the vertical scaling factor
+ *
+ * \sa SDL_RenderSetScale()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
+ float *scaleX, float *scaleY);
+
+/**
+ * \brief Set the color used for drawing operations (Rect, Line and Clear).
+ *
+ * \param renderer The renderer for which drawing color should be set.
+ * \param r The red value used to draw on the rendering target.
+ * \param g The green value used to draw on the rendering target.
+ * \param b The blue value used to draw on the rendering target.
+ * \param a The alpha value used to draw on the rendering target, usually
+ * ::SDL_ALPHA_OPAQUE (255).
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
+ Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a);
+
+/**
+ * \brief Get the color used for drawing operations (Rect, Line and Clear).
+ *
+ * \param renderer The renderer from which drawing color should be queried.
+ * \param r A pointer to the red value used to draw on the rendering target.
+ * \param g A pointer to the green value used to draw on the rendering target.
+ * \param b A pointer to the blue value used to draw on the rendering target.
+ * \param a A pointer to the alpha value used to draw on the rendering target,
+ * usually ::SDL_ALPHA_OPAQUE (255).
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
+ Uint8 * r, Uint8 * g, Uint8 * b,
+ Uint8 * a);
+
+/**
+ * \brief Set the blend mode used for drawing operations (Fill and Line).
+ *
+ * \param renderer The renderer for which blend mode should be set.
+ * \param blendMode ::SDL_BlendMode to use for blending.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \note If the blend mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetRenderDrawBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
+ SDL_BlendMode blendMode);
+
+/**
+ * \brief Get the blend mode used for drawing operations.
+ *
+ * \param renderer The renderer from which blend mode should be queried.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \sa SDL_SetRenderDrawBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
+ SDL_BlendMode *blendMode);
+
+/**
+ * \brief Clear the current rendering target with the drawing color
+ *
+ * This function clears the entire rendering target, ignoring the viewport and
+ * the clip rectangle.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
+
+/**
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a point.
+ * \param x The x coordinate of the point.
+ * \param y The y coordinate of the point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
+ int x, int y);
+
+/**
+ * \brief Draw multiple points on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple points.
+ * \param points The points to draw
+ * \param count The number of points to draw
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_Point * points,
+ int count);
+
+/**
+ * \brief Draw a line on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a line.
+ * \param x1 The x coordinate of the start point.
+ * \param y1 The y coordinate of the start point.
+ * \param x2 The x coordinate of the end point.
+ * \param y2 The y coordinate of the end point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
+ int x1, int y1, int x2, int y2);
+
+/**
+ * \brief Draw a series of connected lines on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple lines.
+ * \param points The points along the lines
+ * \param count The number of points, drawing count-1 lines
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_Point * points,
+ int count);
+
+/**
+ * \brief Draw a rectangle on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Draw some number of rectangles on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
+ const SDL_Rect * rects,
+ int count);
+
+/**
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
+ * rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Fill some number of rectangles on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_Rect * rects,
+ int count);
+
+/**
+ * \brief Copy a portion of the texture to the current rendering target.
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_Rect * dstrect);
+
+/**
+ * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
+ * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
+ * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_Rect * dstrect,
+ const double angle,
+ const SDL_Point *center,
+ const SDL_RendererFlip flip);
+
+/**
+ * \brief Read pixels from the current rendering target.
+ *
+ * \param renderer The renderer from which pixels should be read.
+ * \param rect A pointer to the rectangle to read, or NULL for the entire
+ * render target.
+ * \param format The desired format of the pixel data, or 0 to use the format
+ * of the rendering target
+ * \param pixels A pointer to be filled in with the pixel data
+ * \param pitch The pitch of the pixels parameter.
+ *
+ * \return 0 on success, or -1 if pixel reading is not supported.
+ *
+ * \warning This is a very slow operation, and should not be used frequently.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
+ const SDL_Rect * rect,
+ Uint32 format,
+ void *pixels, int pitch);
+
+/**
+ * \brief Update the screen with rendering performed.
+ */
+extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
+
+/**
+ * \brief Destroy the specified texture.
+ *
+ * \sa SDL_CreateTexture()
+ * \sa SDL_CreateTextureFromSurface()
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
+
+/**
+ * \brief Destroy the rendering context for a window and free associated
+ * textures.
+ *
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
+
+
+/**
+ * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
+ * OpenGL instructions.
+ *
+ * \param texture The SDL texture to bind
+ * \param texw A pointer to a float that will be filled with the texture width
+ * \param texh A pointer to a float that will be filled with the texture height
+ *
+ * \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
+
+/**
+ * \brief Unbind a texture from the current OpenGL/ES/ES2 context.
+ *
+ * \param texture The SDL texture to unbind
+ *
+ * \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
+
+/**
+ * \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ * \param renderer The renderer to query
+ *
+ * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ * \brief Get the Metal command encoder for the current frame
+ *
+ * \param renderer The renderer to query
+ *
+ * \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_render_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_revision.h b/src/3rdparty/SDL2/include/SDL2/SDL_revision.h
new file mode 100644
index 0000000..dbe9b97
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_revision.h
@@ -0,0 +1,2 @@
+#define SDL_REVISION "hg-11914:f1084c419f33"
+#define SDL_REVISION_NUMBER 11914
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_rwops.h b/src/3rdparty/SDL2/include/SDL2/SDL_rwops.h
new file mode 100644
index 0000000..0960699
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_rwops.h
@@ -0,0 +1,254 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_rwops.h
+ *
+ * This file provides a general interface for SDL to read and write
+ * data streams. It can easily be extended to files, memory, etc.
+ */
+
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* RWops Types */
+#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
+#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
+#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
+#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
+
+/**
+ * This is the read/write operation structure -- very basic.
+ */
+typedef struct SDL_RWops
+{
+ /**
+ * Return the size of the file in this rwops, or -1 if unknown
+ */
+ Sint64 (SDLCALL * size) (struct SDL_RWops * context);
+
+ /**
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
+ *
+ * \return the final offset in the data stream, or -1 on error.
+ */
+ Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
+ int whence);
+
+ /**
+ * Read up to \c maxnum objects each of size \c size from the data
+ * stream to the area pointed at by \c ptr.
+ *
+ * \return the number of objects read, or 0 at error or end of file.
+ */
+ size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
+ size_t size, size_t maxnum);
+
+ /**
+ * Write exactly \c num objects each of size \c size from the area
+ * pointed at by \c ptr to data stream.
+ *
+ * \return the number of objects written, or 0 at error or end of file.
+ */
+ size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
+ size_t size, size_t num);
+
+ /**
+ * Close and free an allocated SDL_RWops structure.
+ *
+ * \return 0 if successful or -1 on write error when flushing data.
+ */
+ int (SDLCALL * close) (struct SDL_RWops * context);
+
+ Uint32 type;
+ union
+ {
+#if defined(__ANDROID__)
+ struct
+ {
+ void *fileNameRef;
+ void *inputStreamRef;
+ void *readableByteChannelRef;
+ void *readMethod;
+ void *assetFileDescriptorRef;
+ long position;
+ long size;
+ long offset;
+ int fd;
+ } androidio;
+#elif defined(__WIN32__)
+ struct
+ {
+ SDL_bool append;
+ void *h;
+ struct
+ {
+ void *data;
+ size_t size;
+ size_t left;
+ } buffer;
+ } windowsio;
+#endif
+
+#ifdef HAVE_STDIO_H
+ struct
+ {
+ SDL_bool autoclose;
+ FILE *fp;
+ } stdio;
+#endif
+ struct
+ {
+ Uint8 *base;
+ Uint8 *here;
+ Uint8 *stop;
+ } mem;
+ struct
+ {
+ void *data1;
+ void *data2;
+ } unknown;
+ } hidden;
+
+} SDL_RWops;
+
+
+/**
+ * \name RWFrom functions
+ *
+ * Functions to create SDL_RWops structures from various data streams.
+ */
+/* @{ */
+
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
+ const char *mode);
+
+#ifdef HAVE_STDIO_H
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
+ SDL_bool autoclose);
+#else
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
+ SDL_bool autoclose);
+#endif
+
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
+ int size);
+
+/* @} *//* RWFrom functions */
+
+
+extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
+extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
+
+#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
+#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
+#define RW_SEEK_END 2 /**< Seek relative to the end of data */
+
+/**
+ * \name Read/write macros
+ *
+ * Macros to easily read and write from an SDL_RWops structure.
+ */
+/* @{ */
+#define SDL_RWsize(ctx) (ctx)->size(ctx)
+#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
+#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
+#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
+#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
+#define SDL_RWclose(ctx) (ctx)->close(ctx)
+/* @} *//* Read/write macros */
+
+
+/**
+ * Load all the data from an SDL data stream.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+ int freesrc);
+
+/**
+ * Load an entire file.
+ *
+ * Convenience macro.
+ */
+#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
+
+/**
+ * \name Read endian functions
+ *
+ * Read an item of the specified endianness and return in native format.
+ */
+/* @{ */
+extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
+extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
+extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
+extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
+extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
+extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
+extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
+/* @} *//* Read endian functions */
+
+/**
+ * \name Write endian functions
+ *
+ * Write an item of native format to the specified endianness.
+ */
+/* @{ */
+extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
+/* @} *//* Write endian functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_rwops_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_scancode.h b/src/3rdparty/SDL2/include/SDL2/SDL_scancode.h
new file mode 100644
index 0000000..63871aa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_scancode.h
@@ -0,0 +1,413 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_scancode.h
+ *
+ * Defines keyboard scancodes.
+ */
+
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
+
+#include "SDL_stdinc.h"
+
+/**
+ * \brief The SDL keyboard scancode representation.
+ *
+ * Values of this type are used to represent keyboard keys, among other places
+ * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
+ * SDL_Event structure.
+ *
+ * The values in this enumeration are based on the USB usage page standard:
+ * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
+ */
+typedef enum
+{
+ SDL_SCANCODE_UNKNOWN = 0,
+
+ /**
+ * \name Usage page 0x07
+ *
+ * These values are from usage page 0x07 (USB keyboard page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_A = 4,
+ SDL_SCANCODE_B = 5,
+ SDL_SCANCODE_C = 6,
+ SDL_SCANCODE_D = 7,
+ SDL_SCANCODE_E = 8,
+ SDL_SCANCODE_F = 9,
+ SDL_SCANCODE_G = 10,
+ SDL_SCANCODE_H = 11,
+ SDL_SCANCODE_I = 12,
+ SDL_SCANCODE_J = 13,
+ SDL_SCANCODE_K = 14,
+ SDL_SCANCODE_L = 15,
+ SDL_SCANCODE_M = 16,
+ SDL_SCANCODE_N = 17,
+ SDL_SCANCODE_O = 18,
+ SDL_SCANCODE_P = 19,
+ SDL_SCANCODE_Q = 20,
+ SDL_SCANCODE_R = 21,
+ SDL_SCANCODE_S = 22,
+ SDL_SCANCODE_T = 23,
+ SDL_SCANCODE_U = 24,
+ SDL_SCANCODE_V = 25,
+ SDL_SCANCODE_W = 26,
+ SDL_SCANCODE_X = 27,
+ SDL_SCANCODE_Y = 28,
+ SDL_SCANCODE_Z = 29,
+
+ SDL_SCANCODE_1 = 30,
+ SDL_SCANCODE_2 = 31,
+ SDL_SCANCODE_3 = 32,
+ SDL_SCANCODE_4 = 33,
+ SDL_SCANCODE_5 = 34,
+ SDL_SCANCODE_6 = 35,
+ SDL_SCANCODE_7 = 36,
+ SDL_SCANCODE_8 = 37,
+ SDL_SCANCODE_9 = 38,
+ SDL_SCANCODE_0 = 39,
+
+ SDL_SCANCODE_RETURN = 40,
+ SDL_SCANCODE_ESCAPE = 41,
+ SDL_SCANCODE_BACKSPACE = 42,
+ SDL_SCANCODE_TAB = 43,
+ SDL_SCANCODE_SPACE = 44,
+
+ SDL_SCANCODE_MINUS = 45,
+ SDL_SCANCODE_EQUALS = 46,
+ SDL_SCANCODE_LEFTBRACKET = 47,
+ SDL_SCANCODE_RIGHTBRACKET = 48,
+ SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
+ * key on ISO keyboards and at the right end
+ * of the QWERTY row on ANSI keyboards.
+ * Produces REVERSE SOLIDUS (backslash) and
+ * VERTICAL LINE in a US layout, REVERSE
+ * SOLIDUS and VERTICAL LINE in a UK Mac
+ * layout, NUMBER SIGN and TILDE in a UK
+ * Windows layout, DOLLAR SIGN and POUND SIGN
+ * in a Swiss German layout, NUMBER SIGN and
+ * APOSTROPHE in a German layout, GRAVE
+ * ACCENT and POUND SIGN in a French Mac
+ * layout, and ASTERISK and MICRO SIGN in a
+ * French Windows layout.
+ */
+ SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
+ * instead of 49 for the same key, but all
+ * OSes I've seen treat the two codes
+ * identically. So, as an implementor, unless
+ * your keyboard generates both of those
+ * codes and your OS treats them differently,
+ * you should generate SDL_SCANCODE_BACKSLASH
+ * instead of this code. As a user, you
+ * should not rely on this code because SDL
+ * will never generate it with most (all?)
+ * keyboards.
+ */
+ SDL_SCANCODE_SEMICOLON = 51,
+ SDL_SCANCODE_APOSTROPHE = 52,
+ SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
+ * and ISO keyboards). Produces GRAVE ACCENT and
+ * TILDE in a US Windows layout and in US and UK
+ * Mac layouts on ANSI keyboards, GRAVE ACCENT
+ * and NOT SIGN in a UK Windows layout, SECTION
+ * SIGN and PLUS-MINUS SIGN in US and UK Mac
+ * layouts on ISO keyboards, SECTION SIGN and
+ * DEGREE SIGN in a Swiss German layout (Mac:
+ * only on ISO keyboards), CIRCUMFLEX ACCENT and
+ * DEGREE SIGN in a German layout (Mac: only on
+ * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
+ * French Windows layout, COMMERCIAL AT and
+ * NUMBER SIGN in a French Mac layout on ISO
+ * keyboards, and LESS-THAN SIGN and GREATER-THAN
+ * SIGN in a Swiss German, German, or French Mac
+ * layout on ANSI keyboards.
+ */
+ SDL_SCANCODE_COMMA = 54,
+ SDL_SCANCODE_PERIOD = 55,
+ SDL_SCANCODE_SLASH = 56,
+
+ SDL_SCANCODE_CAPSLOCK = 57,
+
+ SDL_SCANCODE_F1 = 58,
+ SDL_SCANCODE_F2 = 59,
+ SDL_SCANCODE_F3 = 60,
+ SDL_SCANCODE_F4 = 61,
+ SDL_SCANCODE_F5 = 62,
+ SDL_SCANCODE_F6 = 63,
+ SDL_SCANCODE_F7 = 64,
+ SDL_SCANCODE_F8 = 65,
+ SDL_SCANCODE_F9 = 66,
+ SDL_SCANCODE_F10 = 67,
+ SDL_SCANCODE_F11 = 68,
+ SDL_SCANCODE_F12 = 69,
+
+ SDL_SCANCODE_PRINTSCREEN = 70,
+ SDL_SCANCODE_SCROLLLOCK = 71,
+ SDL_SCANCODE_PAUSE = 72,
+ SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
+ does send code 73, not 117) */
+ SDL_SCANCODE_HOME = 74,
+ SDL_SCANCODE_PAGEUP = 75,
+ SDL_SCANCODE_DELETE = 76,
+ SDL_SCANCODE_END = 77,
+ SDL_SCANCODE_PAGEDOWN = 78,
+ SDL_SCANCODE_RIGHT = 79,
+ SDL_SCANCODE_LEFT = 80,
+ SDL_SCANCODE_DOWN = 81,
+ SDL_SCANCODE_UP = 82,
+
+ SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
+ */
+ SDL_SCANCODE_KP_DIVIDE = 84,
+ SDL_SCANCODE_KP_MULTIPLY = 85,
+ SDL_SCANCODE_KP_MINUS = 86,
+ SDL_SCANCODE_KP_PLUS = 87,
+ SDL_SCANCODE_KP_ENTER = 88,
+ SDL_SCANCODE_KP_1 = 89,
+ SDL_SCANCODE_KP_2 = 90,
+ SDL_SCANCODE_KP_3 = 91,
+ SDL_SCANCODE_KP_4 = 92,
+ SDL_SCANCODE_KP_5 = 93,
+ SDL_SCANCODE_KP_6 = 94,
+ SDL_SCANCODE_KP_7 = 95,
+ SDL_SCANCODE_KP_8 = 96,
+ SDL_SCANCODE_KP_9 = 97,
+ SDL_SCANCODE_KP_0 = 98,
+ SDL_SCANCODE_KP_PERIOD = 99,
+
+ SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
+ * keyboards have over ANSI ones,
+ * located between left shift and Y.
+ * Produces GRAVE ACCENT and TILDE in a
+ * US or UK Mac layout, REVERSE SOLIDUS
+ * (backslash) and VERTICAL LINE in a
+ * US or UK Windows layout, and
+ * LESS-THAN SIGN and GREATER-THAN SIGN
+ * in a Swiss German, German, or French
+ * layout. */
+ SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
+ SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
+ * not a physical key - but some Mac keyboards
+ * do have a power key. */
+ SDL_SCANCODE_KP_EQUALS = 103,
+ SDL_SCANCODE_F13 = 104,
+ SDL_SCANCODE_F14 = 105,
+ SDL_SCANCODE_F15 = 106,
+ SDL_SCANCODE_F16 = 107,
+ SDL_SCANCODE_F17 = 108,
+ SDL_SCANCODE_F18 = 109,
+ SDL_SCANCODE_F19 = 110,
+ SDL_SCANCODE_F20 = 111,
+ SDL_SCANCODE_F21 = 112,
+ SDL_SCANCODE_F22 = 113,
+ SDL_SCANCODE_F23 = 114,
+ SDL_SCANCODE_F24 = 115,
+ SDL_SCANCODE_EXECUTE = 116,
+ SDL_SCANCODE_HELP = 117,
+ SDL_SCANCODE_MENU = 118,
+ SDL_SCANCODE_SELECT = 119,
+ SDL_SCANCODE_STOP = 120,
+ SDL_SCANCODE_AGAIN = 121, /**< redo */
+ SDL_SCANCODE_UNDO = 122,
+ SDL_SCANCODE_CUT = 123,
+ SDL_SCANCODE_COPY = 124,
+ SDL_SCANCODE_PASTE = 125,
+ SDL_SCANCODE_FIND = 126,
+ SDL_SCANCODE_MUTE = 127,
+ SDL_SCANCODE_VOLUMEUP = 128,
+ SDL_SCANCODE_VOLUMEDOWN = 129,
+/* not sure whether there's a reason to enable these */
+/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
+/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
+/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
+ SDL_SCANCODE_KP_COMMA = 133,
+ SDL_SCANCODE_KP_EQUALSAS400 = 134,
+
+ SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
+ footnotes in USB doc */
+ SDL_SCANCODE_INTERNATIONAL2 = 136,
+ SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
+ SDL_SCANCODE_INTERNATIONAL4 = 138,
+ SDL_SCANCODE_INTERNATIONAL5 = 139,
+ SDL_SCANCODE_INTERNATIONAL6 = 140,
+ SDL_SCANCODE_INTERNATIONAL7 = 141,
+ SDL_SCANCODE_INTERNATIONAL8 = 142,
+ SDL_SCANCODE_INTERNATIONAL9 = 143,
+ SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
+ SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
+ SDL_SCANCODE_LANG3 = 146, /**< Katakana */
+ SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
+ SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
+ SDL_SCANCODE_LANG6 = 149, /**< reserved */
+ SDL_SCANCODE_LANG7 = 150, /**< reserved */
+ SDL_SCANCODE_LANG8 = 151, /**< reserved */
+ SDL_SCANCODE_LANG9 = 152, /**< reserved */
+
+ SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
+ SDL_SCANCODE_SYSREQ = 154,
+ SDL_SCANCODE_CANCEL = 155,
+ SDL_SCANCODE_CLEAR = 156,
+ SDL_SCANCODE_PRIOR = 157,
+ SDL_SCANCODE_RETURN2 = 158,
+ SDL_SCANCODE_SEPARATOR = 159,
+ SDL_SCANCODE_OUT = 160,
+ SDL_SCANCODE_OPER = 161,
+ SDL_SCANCODE_CLEARAGAIN = 162,
+ SDL_SCANCODE_CRSEL = 163,
+ SDL_SCANCODE_EXSEL = 164,
+
+ SDL_SCANCODE_KP_00 = 176,
+ SDL_SCANCODE_KP_000 = 177,
+ SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
+ SDL_SCANCODE_DECIMALSEPARATOR = 179,
+ SDL_SCANCODE_CURRENCYUNIT = 180,
+ SDL_SCANCODE_CURRENCYSUBUNIT = 181,
+ SDL_SCANCODE_KP_LEFTPAREN = 182,
+ SDL_SCANCODE_KP_RIGHTPAREN = 183,
+ SDL_SCANCODE_KP_LEFTBRACE = 184,
+ SDL_SCANCODE_KP_RIGHTBRACE = 185,
+ SDL_SCANCODE_KP_TAB = 186,
+ SDL_SCANCODE_KP_BACKSPACE = 187,
+ SDL_SCANCODE_KP_A = 188,
+ SDL_SCANCODE_KP_B = 189,
+ SDL_SCANCODE_KP_C = 190,
+ SDL_SCANCODE_KP_D = 191,
+ SDL_SCANCODE_KP_E = 192,
+ SDL_SCANCODE_KP_F = 193,
+ SDL_SCANCODE_KP_XOR = 194,
+ SDL_SCANCODE_KP_POWER = 195,
+ SDL_SCANCODE_KP_PERCENT = 196,
+ SDL_SCANCODE_KP_LESS = 197,
+ SDL_SCANCODE_KP_GREATER = 198,
+ SDL_SCANCODE_KP_AMPERSAND = 199,
+ SDL_SCANCODE_KP_DBLAMPERSAND = 200,
+ SDL_SCANCODE_KP_VERTICALBAR = 201,
+ SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
+ SDL_SCANCODE_KP_COLON = 203,
+ SDL_SCANCODE_KP_HASH = 204,
+ SDL_SCANCODE_KP_SPACE = 205,
+ SDL_SCANCODE_KP_AT = 206,
+ SDL_SCANCODE_KP_EXCLAM = 207,
+ SDL_SCANCODE_KP_MEMSTORE = 208,
+ SDL_SCANCODE_KP_MEMRECALL = 209,
+ SDL_SCANCODE_KP_MEMCLEAR = 210,
+ SDL_SCANCODE_KP_MEMADD = 211,
+ SDL_SCANCODE_KP_MEMSUBTRACT = 212,
+ SDL_SCANCODE_KP_MEMMULTIPLY = 213,
+ SDL_SCANCODE_KP_MEMDIVIDE = 214,
+ SDL_SCANCODE_KP_PLUSMINUS = 215,
+ SDL_SCANCODE_KP_CLEAR = 216,
+ SDL_SCANCODE_KP_CLEARENTRY = 217,
+ SDL_SCANCODE_KP_BINARY = 218,
+ SDL_SCANCODE_KP_OCTAL = 219,
+ SDL_SCANCODE_KP_DECIMAL = 220,
+ SDL_SCANCODE_KP_HEXADECIMAL = 221,
+
+ SDL_SCANCODE_LCTRL = 224,
+ SDL_SCANCODE_LSHIFT = 225,
+ SDL_SCANCODE_LALT = 226, /**< alt, option */
+ SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
+ SDL_SCANCODE_RCTRL = 228,
+ SDL_SCANCODE_RSHIFT = 229,
+ SDL_SCANCODE_RALT = 230, /**< alt gr, option */
+ SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
+
+ SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
+ * by any of the above, but since there's a
+ * special KMOD_MODE for it I'm adding it here
+ */
+
+ /* @} *//* Usage page 0x07 */
+
+ /**
+ * \name Usage page 0x0C
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIONEXT = 258,
+ SDL_SCANCODE_AUDIOPREV = 259,
+ SDL_SCANCODE_AUDIOSTOP = 260,
+ SDL_SCANCODE_AUDIOPLAY = 261,
+ SDL_SCANCODE_AUDIOMUTE = 262,
+ SDL_SCANCODE_MEDIASELECT = 263,
+ SDL_SCANCODE_WWW = 264,
+ SDL_SCANCODE_MAIL = 265,
+ SDL_SCANCODE_CALCULATOR = 266,
+ SDL_SCANCODE_COMPUTER = 267,
+ SDL_SCANCODE_AC_SEARCH = 268,
+ SDL_SCANCODE_AC_HOME = 269,
+ SDL_SCANCODE_AC_BACK = 270,
+ SDL_SCANCODE_AC_FORWARD = 271,
+ SDL_SCANCODE_AC_STOP = 272,
+ SDL_SCANCODE_AC_REFRESH = 273,
+ SDL_SCANCODE_AC_BOOKMARKS = 274,
+
+ /* @} *//* Usage page 0x0C */
+
+ /**
+ * \name Walther keys
+ *
+ * These are values that Christian Walther added (for mac keyboard?).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_BRIGHTNESSDOWN = 275,
+ SDL_SCANCODE_BRIGHTNESSUP = 276,
+ SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
+ switch, video mode switch */
+ SDL_SCANCODE_KBDILLUMTOGGLE = 278,
+ SDL_SCANCODE_KBDILLUMDOWN = 279,
+ SDL_SCANCODE_KBDILLUMUP = 280,
+ SDL_SCANCODE_EJECT = 281,
+ SDL_SCANCODE_SLEEP = 282,
+
+ SDL_SCANCODE_APP1 = 283,
+ SDL_SCANCODE_APP2 = 284,
+
+ /* @} *//* Walther keys */
+
+ /**
+ * \name Usage page 0x0C (additional media keys)
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIOREWIND = 285,
+ SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+ /* @} *//* Usage page 0x0C (additional media keys) */
+
+ /* Add any other keys here. */
+
+ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
+ for array bounds */
+} SDL_Scancode;
+
+#endif /* SDL_scancode_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_shape.h b/src/3rdparty/SDL2/include/SDL2/SDL_shape.h
new file mode 100644
index 0000000..40a6baa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_shape.h
@@ -0,0 +1,144 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_surface.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \file SDL_shape.h
+ *
+ * Header file for the shaped window API.
+ */
+
+#define SDL_NONSHAPEABLE_WINDOW -1
+#define SDL_INVALID_SHAPE_ARGUMENT -2
+#define SDL_WINDOW_LACKS_SHAPE -3
+
+/**
+ * \brief Create a window that can be shaped with the specified position, dimensions, and flags.
+ *
+ * \param title The title of the window, in UTF-8 encoding.
+ * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param w The width of the window.
+ * \param h The height of the window.
+ * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
+ * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
+ * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
+ * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
+ * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
+ *
+ * \return The window created, or NULL if window creation failed.
+ *
+ * \sa SDL_DestroyWindow()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
+
+/**
+ * \brief Return whether the given window is a shaped window.
+ *
+ * \param window The window to query for being shaped.
+ *
+ * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
+ * \sa SDL_CreateShapedWindow
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
+
+/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
+typedef enum {
+ /** \brief The default mode, a binarized alpha cutoff of 1. */
+ ShapeModeDefault,
+ /** \brief A binarized alpha cutoff with a given integer value. */
+ ShapeModeBinarizeAlpha,
+ /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
+ ShapeModeReverseBinarizeAlpha,
+ /** \brief A color key is applied. */
+ ShapeModeColorKey
+} WindowShapeMode;
+
+#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
+
+/** \brief A union containing parameters for shaped windows. */
+typedef union {
+ /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
+ Uint8 binarizationCutoff;
+ SDL_Color colorKey;
+} SDL_WindowShapeParams;
+
+/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
+typedef struct SDL_WindowShapeMode {
+ /** \brief The mode of these window-shape parameters. */
+ WindowShapeMode mode;
+ /** \brief Window-shape parameters. */
+ SDL_WindowShapeParams parameters;
+} SDL_WindowShapeMode;
+
+/**
+ * \brief Set the shape and parameters of a shaped window.
+ *
+ * \param window The shaped window whose parameters should be set.
+ * \param shape A surface encoding the desired shape for the window.
+ * \param shape_mode The parameters to set for the shaped window.
+ *
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ * if the SDL_Window given does not reference a valid shaped window.
+ *
+ * \sa SDL_WindowShapeMode
+ * \sa SDL_GetShapedWindowMode.
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
+
+/**
+ * \brief Get the shape parameters of a shaped window.
+ *
+ * \param window The shaped window whose parameters should be retrieved.
+ * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
+ *
+ * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
+ * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
+ * the SDL_Window given is a shapeable window currently lacking a shape.
+ *
+ * \sa SDL_WindowShapeMode
+ * \sa SDL_SetWindowShape
+ */
+extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_shape_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_stdinc.h b/src/3rdparty/SDL2/include/SDL2/SDL_stdinc.h
new file mode 100644
index 0000000..111a064
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_stdinc.h
@@ -0,0 +1,605 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_stdinc.h
+ *
+ * This is a general header that includes C language support.
+ */
+
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
+
+#include "SDL_config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if defined(STDC_HEADERS)
+# include <stdlib.h>
+# include <stddef.h>
+# include <stdarg.h>
+#else
+# if defined(HAVE_STDLIB_H)
+# include <stdlib.h>
+# elif defined(HAVE_MALLOC_H)
+# include <malloc.h>
+# endif
+# if defined(HAVE_STDDEF_H)
+# include <stddef.h>
+# endif
+# if defined(HAVE_STDARG_H)
+# include <stdarg.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#elif defined(HAVE_STDINT_H)
+# include <stdint.h>
+#endif
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_MATH_H
+# if defined(__WINRT__)
+/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
+ WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
+ for more information.
+*/
+# define _USE_MATH_DEFINES
+# endif
+# include <math.h>
+#endif
+#ifdef HAVE_FLOAT_H
+# include <float.h>
+#endif
+
+/**
+ * The number of elements in an array.
+ */
+#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
+#define SDL_TABLESIZE(table) SDL_arraysize(table)
+
+/**
+ * Macro useful for building other macros with strings in them
+ *
+ * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
+ */
+#define SDL_STRINGIFY_ARG(arg) #arg
+
+/**
+ * \name Cast operators
+ *
+ * Use proper C++ casts when compiled as C++ to be compatible with the option
+ * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
+ */
+/* @{ */
+#ifdef __cplusplus
+#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
+#define SDL_static_cast(type, expression) static_cast<type>(expression)
+#define SDL_const_cast(type, expression) const_cast<type>(expression)
+#else
+#define SDL_reinterpret_cast(type, expression) ((type)(expression))
+#define SDL_static_cast(type, expression) ((type)(expression))
+#define SDL_const_cast(type, expression) ((type)(expression))
+#endif
+/* @} *//* Cast operators */
+
+/* Define a four character code as a Uint32 */
+#define SDL_FOURCC(A, B, C, D) \
+ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
+ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
+ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
+ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
+
+/**
+ * \name Basic data types
+ */
+/* @{ */
+
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
+typedef enum
+{
+ SDL_FALSE = 0,
+ SDL_TRUE = 1
+} SDL_bool;
+#endif
+
+/**
+ * \brief A signed 8-bit integer type.
+ */
+#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
+#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
+typedef int8_t Sint8;
+/**
+ * \brief An unsigned 8-bit integer type.
+ */
+#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
+#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
+typedef uint8_t Uint8;
+/**
+ * \brief A signed 16-bit integer type.
+ */
+#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
+#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
+typedef int16_t Sint16;
+/**
+ * \brief An unsigned 16-bit integer type.
+ */
+#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
+#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
+typedef uint16_t Uint16;
+/**
+ * \brief A signed 32-bit integer type.
+ */
+#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
+#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
+typedef int32_t Sint32;
+/**
+ * \brief An unsigned 32-bit integer type.
+ */
+#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
+#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
+typedef uint32_t Uint32;
+
+/**
+ * \brief A signed 64-bit integer type.
+ */
+#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
+#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
+typedef int64_t Sint64;
+/**
+ * \brief An unsigned 64-bit integer type.
+ */
+#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
+#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
+typedef uint64_t Uint64;
+
+/* @} *//* Basic data types */
+
+/* Make sure we have macros for printing 64 bit values.
+ * <stdint.h> should define these but this is not true all platforms.
+ * (for example win32) */
+#ifndef SDL_PRIs64
+#ifdef PRIs64
+#define SDL_PRIs64 PRIs64
+#elif defined(__WIN32__)
+#define SDL_PRIs64 "I64d"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIs64 "ld"
+#else
+#define SDL_PRIs64 "lld"
+#endif
+#endif
+#ifndef SDL_PRIu64
+#ifdef PRIu64
+#define SDL_PRIu64 PRIu64
+#elif defined(__WIN32__)
+#define SDL_PRIu64 "I64u"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIu64 "lu"
+#else
+#define SDL_PRIu64 "llu"
+#endif
+#endif
+#ifndef SDL_PRIx64
+#ifdef PRIx64
+#define SDL_PRIx64 PRIx64
+#elif defined(__WIN32__)
+#define SDL_PRIx64 "I64x"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIx64 "lx"
+#else
+#define SDL_PRIx64 "llx"
+#endif
+#endif
+#ifndef SDL_PRIX64
+#ifdef PRIX64
+#define SDL_PRIX64 PRIX64
+#elif defined(__WIN32__)
+#define SDL_PRIX64 "I64X"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIX64 "lX"
+#else
+#define SDL_PRIX64 "llX"
+#endif
+#endif
+
+/* Annotations to help code analysis tools */
+#ifdef SDL_DISABLE_ANALYZE_MACROS
+#define SDL_IN_BYTECAP(x)
+#define SDL_INOUT_Z_CAP(x)
+#define SDL_OUT_Z_CAP(x)
+#define SDL_OUT_CAP(x)
+#define SDL_OUT_BYTECAP(x)
+#define SDL_OUT_Z_BYTECAP(x)
+#define SDL_PRINTF_FORMAT_STRING
+#define SDL_SCANF_FORMAT_STRING
+#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
+#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
+#else
+#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
+#include <sal.h>
+
+#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
+#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
+#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
+#define SDL_OUT_CAP(x) _Out_cap_(x)
+#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
+#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
+
+#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
+#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
+#else
+#define SDL_IN_BYTECAP(x)
+#define SDL_INOUT_Z_CAP(x)
+#define SDL_OUT_Z_CAP(x)
+#define SDL_OUT_CAP(x)
+#define SDL_OUT_BYTECAP(x)
+#define SDL_OUT_Z_BYTECAP(x)
+#define SDL_PRINTF_FORMAT_STRING
+#define SDL_SCANF_FORMAT_STRING
+#endif
+#if defined(__GNUC__)
+#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
+#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
+#else
+#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
+#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
+#endif
+#endif /* SDL_DISABLE_ANALYZE_MACROS */
+
+#define SDL_COMPILE_TIME_ASSERT(name, x) \
+ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
+/** \cond */
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
+SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
+SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
+SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
+SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
+SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
+SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
+SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
+SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
+#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
+/** \endcond */
+
+/* Check to make sure enums are the size of ints, for structure packing.
+ For both Watcom C/C++ and Borland C/C++ the compiler option that makes
+ enums having the size of an int must be enabled.
+ This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
+*/
+
+/** \cond */
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
+#if !defined(__ANDROID__)
+ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
+typedef enum
+{
+ DUMMY_ENUM_VALUE
+} SDL_DUMMY_ENUM;
+
+SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
+#endif
+#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
+/** \endcond */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(HAVE_ALLOCA) && !defined(alloca)
+# if defined(HAVE_ALLOCA_H)
+# include <alloca.h>
+# elif defined(__GNUC__)
+# define alloca __builtin_alloca
+# elif defined(_MSC_VER)
+# include <malloc.h>
+# define alloca _alloca
+# elif defined(__WATCOMC__)
+# include <malloc.h>
+# elif defined(__BORLANDC__)
+# include <malloc.h>
+# elif defined(__DMC__)
+# include <stdlib.h>
+# elif defined(__AIX__)
+#pragma alloca
+# elif defined(__MRC__)
+void *alloca(unsigned);
+# else
+char *alloca();
+# endif
+#endif
+#ifdef HAVE_ALLOCA
+#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
+#define SDL_stack_free(data)
+#else
+#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
+#define SDL_stack_free(data) SDL_free(data)
+#endif
+
+extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
+extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
+extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
+extern DECLSPEC void SDLCALL SDL_free(void *mem);
+
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ * \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+ SDL_calloc_func *calloc_func,
+ SDL_realloc_func *realloc_func,
+ SDL_free_func *free_func);
+
+/**
+ * \brief Replace SDL's memory allocation functions with a custom set
+ *
+ * \note If you are replacing SDL's memory functions, you should call
+ * SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ * That means that your free function will be called with memory
+ * allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+ SDL_calloc_func calloc_func,
+ SDL_realloc_func realloc_func,
+ SDL_free_func free_func);
+
+/**
+ * \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
+extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
+extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
+
+extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
+
+extern DECLSPEC int SDLCALL SDL_abs(int x);
+
+/* !!! FIXME: these have side effects. You probably shouldn't use them. */
+/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
+#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
+#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
+
+extern DECLSPEC int SDLCALL SDL_isdigit(int x);
+extern DECLSPEC int SDLCALL SDL_isspace(int x);
+extern DECLSPEC int SDLCALL SDL_toupper(int x);
+extern DECLSPEC int SDLCALL SDL_tolower(int x);
+
+extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
+
+#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
+#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
+
+/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
+SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
+{
+#if defined(__GNUC__) && defined(i386)
+ int u0, u1, u2;
+ __asm__ __volatile__ (
+ "cld \n\t"
+ "rep ; stosl \n\t"
+ : "=&D" (u0), "=&a" (u1), "=&c" (u2)
+ : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
+ : "memory"
+ );
+#else
+ size_t _n = (dwords + 3) / 4;
+ Uint32 *_p = SDL_static_cast(Uint32 *, dst);
+ Uint32 _val = (val);
+ if (dwords == 0)
+ return;
+ switch (dwords % 4)
+ {
+ case 0: do { *_p++ = _val; /* fallthrough */
+ case 3: *_p++ = _val; /* fallthrough */
+ case 2: *_p++ = _val; /* fallthrough */
+ case 1: *_p++ = _val; /* fallthrough */
+ } while ( --_n );
+ }
+#endif
+}
+
+
+extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
+
+extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
+extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+
+extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
+extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
+
+extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
+extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
+extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
+extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
+extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
+extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
+extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
+extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
+extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
+extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
+
+extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
+
+extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
+extern DECLSPEC double SDLCALL SDL_atof(const char *str);
+extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
+extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
+extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
+extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
+extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
+
+extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
+extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
+extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
+
+extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
+extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
+extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
+extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
+
+#ifndef HAVE_M_PI
+#ifndef M_PI
+#define M_PI 3.14159265358979323846264338327950288 /**< pi */
+#endif
+#endif
+
+extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
+extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
+extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
+extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
+extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
+extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
+extern DECLSPEC double SDLCALL SDL_cos(double x);
+extern DECLSPEC float SDLCALL SDL_cosf(float x);
+extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
+extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
+extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
+extern DECLSPEC double SDLCALL SDL_log10(double x);
+extern DECLSPEC float SDLCALL SDL_log10f(float x);
+extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
+extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
+extern DECLSPEC double SDLCALL SDL_sin(double x);
+extern DECLSPEC float SDLCALL SDL_sinf(float x);
+extern DECLSPEC double SDLCALL SDL_sqrt(double x);
+extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
+extern DECLSPEC double SDLCALL SDL_tan(double x);
+extern DECLSPEC float SDLCALL SDL_tanf(float x);
+
+/* The SDL implementation of iconv() returns these error codes */
+#define SDL_ICONV_ERROR (size_t)-1
+#define SDL_ICONV_E2BIG (size_t)-2
+#define SDL_ICONV_EILSEQ (size_t)-3
+#define SDL_ICONV_EINVAL (size_t)-4
+
+/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
+typedef struct _SDL_iconv_t *SDL_iconv_t;
+extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
+ const char *fromcode);
+extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
+extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
+ size_t * inbytesleft, char **outbuf,
+ size_t * outbytesleft);
+/**
+ * This function converts a string between encodings in one pass, returning a
+ * string that must be freed with SDL_free() or NULL on error.
+ */
+extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
+ const char *fromcode,
+ const char *inbuf,
+ size_t inbytesleft);
+#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
+#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
+#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
+
+/* force builds using Clang's static analysis tools to use literal C runtime
+ here, since there are possibly tests that are ineffective otherwise. */
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_malloc malloc
+#define SDL_calloc calloc
+#define SDL_realloc realloc
+#define SDL_free free
+#define SDL_memset memset
+#define SDL_memcpy memcpy
+#define SDL_memmove memmove
+#define SDL_memcmp memcmp
+#define SDL_strlen strlen
+#define SDL_strlcpy strlcpy
+#define SDL_strlcat strlcat
+#define SDL_strdup strdup
+#define SDL_strchr strchr
+#define SDL_strrchr strrchr
+#define SDL_strstr strstr
+#define SDL_strcmp strcmp
+#define SDL_strncmp strncmp
+#define SDL_strcasecmp strcasecmp
+#define SDL_strncasecmp strncasecmp
+#define SDL_sscanf sscanf
+#define SDL_vsscanf vsscanf
+#define SDL_snprintf snprintf
+#define SDL_vsnprintf vsnprintf
+#endif
+
+SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
+{
+ return SDL_memcpy(dst, src, dwords * 4);
+}
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_stdinc_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_surface.h b/src/3rdparty/SDL2/include/SDL2/SDL_surface.h
new file mode 100644
index 0000000..45e5366
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_surface.h
@@ -0,0 +1,546 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_surface.h
+ *
+ * Header file for ::SDL_Surface definition and management functions.
+ */
+
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_blendmode.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \name Surface flags
+ *
+ * These are the currently supported flags for the ::SDL_Surface.
+ *
+ * \internal
+ * Used internally (read-only).
+ */
+/* @{ */
+#define SDL_SWSURFACE 0 /**< Just here for compatibility */
+#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
+#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
+#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
+/* @} *//* Surface flags */
+
+/**
+ * Evaluates to true if the surface needs to be locked before access.
+ */
+#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
+
+/**
+ * \brief A collection of pixels used in software blitting.
+ *
+ * \note This structure should be treated as read-only, except for \c pixels,
+ * which, if not NULL, contains the raw pixel data for the surface.
+ */
+typedef struct SDL_Surface
+{
+ Uint32 flags; /**< Read-only */
+ SDL_PixelFormat *format; /**< Read-only */
+ int w, h; /**< Read-only */
+ int pitch; /**< Read-only */
+ void *pixels; /**< Read-write */
+
+ /** Application data associated with the surface */
+ void *userdata; /**< Read-write */
+
+ /** information needed for surfaces requiring locks */
+ int locked; /**< Read-only */
+ void *lock_data; /**< Read-only */
+
+ /** clipping information */
+ SDL_Rect clip_rect; /**< Read-only */
+
+ /** info for fast blit mapping to other surfaces */
+ struct SDL_BlitMap *map; /**< Private */
+
+ /** Reference count -- used when freeing surface */
+ int refcount; /**< Read-mostly */
+} SDL_Surface;
+
+/**
+ * \brief The type of function used for surface blitting functions.
+ */
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+ SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
+ SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
+ SDL_YUV_CONVERSION_BT709, /**< BT.709 */
+ SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
+
+/**
+ * Allocate and free an RGB surface.
+ *
+ * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
+ * If the depth is greater than 8 bits, the pixel format is set using the
+ * flags '[RGB]mask'.
+ *
+ * If the function runs out of memory, it will return NULL.
+ *
+ * \param flags The \c flags are obsolete and should be set to 0.
+ * \param width The width in pixels of the surface to create.
+ * \param height The height in pixels of the surface to create.
+ * \param depth The depth in bits of the surface to create.
+ * \param Rmask The red mask of the surface to create.
+ * \param Gmask The green mask of the surface to create.
+ * \param Bmask The blue mask of the surface to create.
+ * \param Amask The alpha mask of the surface to create.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
+ (Uint32 flags, int width, int height, int depth,
+ Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
+ (Uint32 flags, int width, int height, int depth, Uint32 format);
+
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
+ int width,
+ int height,
+ int depth,
+ int pitch,
+ Uint32 Rmask,
+ Uint32 Gmask,
+ Uint32 Bmask,
+ Uint32 Amask);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
+ (void *pixels, int width, int height, int depth, int pitch, Uint32 format);
+extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
+
+/**
+ * \brief Set the palette used by a surface.
+ *
+ * \return 0, or -1 if the surface format doesn't use a palette.
+ *
+ * \note A single palette can be shared with many surfaces.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
+ SDL_Palette * palette);
+
+/**
+ * \brief Sets up a surface for directly accessing the pixels.
+ *
+ * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
+ * to and read from \c surface->pixels, using the pixel format stored in
+ * \c surface->format. Once you are done accessing the surface, you should
+ * use SDL_UnlockSurface() to release it.
+ *
+ * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
+ * to 0, then you can read and write to the surface at any time, and the
+ * pixel format of the surface will not change.
+ *
+ * No operating system or library calls should be made between lock/unlock
+ * pairs, as critical system locks may be held during this time.
+ *
+ * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
+ *
+ * \sa SDL_UnlockSurface()
+ */
+extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
+/** \sa SDL_LockSurface() */
+extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
+
+/**
+ * Load a surface from a seekable SDL data stream (memory or file).
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The new surface should be freed with SDL_FreeSurface().
+ *
+ * \return the new surface, or NULL if there was an error.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
+ int freesrc);
+
+/**
+ * Load a surface from a file.
+ *
+ * Convenience macro.
+ */
+#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
+
+/**
+ * Save a surface to a seekable SDL data stream (memory or file).
+ *
+ * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
+ * BMP directly. Other RGB formats with 8-bit or higher get converted to a
+ * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
+ * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
+ * not supported.
+ *
+ * If \c freedst is non-zero, the stream will be closed after being written.
+ *
+ * \return 0 if successful or -1 if there was an error.
+ */
+extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
+ (SDL_Surface * surface, SDL_RWops * dst, int freedst);
+
+/**
+ * Save a surface to a file.
+ *
+ * Convenience macro.
+ */
+#define SDL_SaveBMP(surface, file) \
+ SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
+
+/**
+ * \brief Sets the RLE acceleration hint for a surface.
+ *
+ * \return 0 on success, or -1 if the surface is not valid
+ *
+ * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
+ * but the surface must be locked before directly accessing the pixels.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
+ int flag);
+
+/**
+ * \brief Sets the color key (transparent pixel) in a blittable surface.
+ *
+ * \param surface The surface to update
+ * \param flag Non-zero to enable colorkey and 0 to disable colorkey
+ * \param key The transparent pixel in the native surface format
+ *
+ * \return 0 on success, or -1 if the surface is not valid
+ *
+ * You can pass SDL_RLEACCEL to enable RLE accelerated blits.
+ */
+extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
+ int flag, Uint32 key);
+
+/**
+ * \brief Gets the color key (transparent pixel) in a blittable surface.
+ *
+ * \param surface The surface to update
+ * \param key A pointer filled in with the transparent pixel in the native
+ * surface format
+ *
+ * \return 0 on success, or -1 if the surface is not valid or colorkey is not
+ * enabled.
+ */
+extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
+ Uint32 * key);
+
+/**
+ * \brief Set an additional color value used in blit operations.
+ *
+ * \param surface The surface to update.
+ * \param r The red color value multiplied into blit operations.
+ * \param g The green color value multiplied into blit operations.
+ * \param b The blue color value multiplied into blit operations.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_GetSurfaceColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
+ Uint8 r, Uint8 g, Uint8 b);
+
+
+/**
+ * \brief Get the additional color value used in blit operations.
+ *
+ * \param surface The surface to query.
+ * \param r A pointer filled in with the current red color value.
+ * \param g A pointer filled in with the current green color value.
+ * \param b A pointer filled in with the current blue color value.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
+ Uint8 * r, Uint8 * g,
+ Uint8 * b);
+
+/**
+ * \brief Set an additional alpha value used in blit operations.
+ *
+ * \param surface The surface to update.
+ * \param alpha The alpha value multiplied into blit operations.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_GetSurfaceAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
+ Uint8 alpha);
+
+/**
+ * \brief Get the additional alpha value used in blit operations.
+ *
+ * \param surface The surface to query.
+ * \param alpha A pointer filled in with the current alpha value.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
+ Uint8 * alpha);
+
+/**
+ * \brief Set the blend mode used for blit operations.
+ *
+ * \param surface The surface to update.
+ * \param blendMode ::SDL_BlendMode to use for blit blending.
+ *
+ * \return 0 on success, or -1 if the parameters are not valid.
+ *
+ * \sa SDL_GetSurfaceBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
+ SDL_BlendMode blendMode);
+
+/**
+ * \brief Get the blend mode used for blit operations.
+ *
+ * \param surface The surface to query.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
+ SDL_BlendMode *blendMode);
+
+/**
+ * Sets the clipping rectangle for the destination surface in a blit.
+ *
+ * If the clip rectangle is NULL, clipping will be disabled.
+ *
+ * If the clip rectangle doesn't intersect the surface, the function will
+ * return SDL_FALSE and blits will be completely clipped. Otherwise the
+ * function returns SDL_TRUE and blits to the surface will be clipped to
+ * the intersection of the surface area and the clipping rectangle.
+ *
+ * Note that blits are automatically clipped to the edges of the source
+ * and destination surfaces.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
+ const SDL_Rect * rect);
+
+/**
+ * Gets the clipping rectangle for the destination surface in a blit.
+ *
+ * \c rect must be a pointer to a valid rectangle which will be filled
+ * with the correct values.
+ */
+extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
+ SDL_Rect * rect);
+
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
+/**
+ * Creates a new surface of the specified format, and then copies and maps
+ * the given surface to it so the blit of the converted surface will be as
+ * fast as possible. If this function fails, it returns NULL.
+ *
+ * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
+ * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and
+ * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
+ * surface.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
+ (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
+ (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
+
+/**
+ * \brief Copy a block of pixels of one format to another format
+ *
+ * \return 0 on success, or -1 if there was an error
+ */
+extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
+ Uint32 src_format,
+ const void * src, int src_pitch,
+ Uint32 dst_format,
+ void * dst, int dst_pitch);
+
+/**
+ * Performs a fast fill of the given rectangle with \c color.
+ *
+ * If \c rect is NULL, the whole surface will be filled with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_FillRect
+ (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
+extern DECLSPEC int SDLCALL SDL_FillRects
+ (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
+
+/**
+ * Performs a fast blit from the source surface to the destination surface.
+ *
+ * This assumes that the source and destination rectangles are
+ * the same size. If either \c srcrect or \c dstrect are NULL, the entire
+ * surface (\c src or \c dst) is copied. The final blit rectangles are saved
+ * in \c srcrect and \c dstrect after all clipping is performed.
+ *
+ * \return If the blit is successful, it returns 0, otherwise it returns -1.
+ *
+ * The blit function should not be called on a locked surface.
+ *
+ * The blit semantics for surfaces with and without blending and colorkey
+ * are defined as follows:
+ * \verbatim
+ RGBA->RGB:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source alpha-channel and per-surface alpha)
+ SDL_SRCCOLORKEY ignored.
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy RGB.
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ RGB values of the source color key, ignoring alpha in the
+ comparison.
+
+ RGB->RGBA:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source per-surface alpha)
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy RGB, set destination alpha to source per-surface alpha value.
+ both:
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ source color key.
+
+ RGBA->RGBA:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source alpha-channel and per-surface alpha)
+ SDL_SRCCOLORKEY ignored.
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy all of RGBA to the destination.
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ RGB values of the source color key, ignoring alpha in the
+ comparison.
+
+ RGB->RGB:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source per-surface alpha)
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy RGB.
+ both:
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ source color key.
+ \endverbatim
+ *
+ * You should call SDL_BlitSurface() unless you know exactly how SDL
+ * blitting works internally and how to use the other blit functions.
+ */
+#define SDL_BlitSurface SDL_UpperBlit
+
+/**
+ * This is the public blit function, SDL_BlitSurface(), and it performs
+ * rectangle validation and clipping before passing it to SDL_LowerBlit()
+ */
+extern DECLSPEC int SDLCALL SDL_UpperBlit
+ (SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * This is a semi-private blit function and it performs low-level surface
+ * blitting only.
+ */
+extern DECLSPEC int SDLCALL SDL_LowerBlit
+ (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief Perform a fast, low quality, stretch blit between two surfaces of the
+ * same pixel format.
+ *
+ * \note This function uses a static buffer, and is not thread-safe.
+ */
+extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
+ const SDL_Rect * srcrect,
+ SDL_Surface * dst,
+ const SDL_Rect * dstrect);
+
+#define SDL_BlitScaled SDL_UpperBlitScaled
+
+/**
+ * This is the public scaled blit function, SDL_BlitScaled(), and it performs
+ * rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
+ */
+extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
+ (SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * This is a semi-private blit function and it performs low-level surface
+ * scaled blitting only.
+ */
+extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
+ (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ * \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_surface_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_system.h b/src/3rdparty/SDL2/include/SDL2/SDL_system.h
new file mode 100644
index 0000000..7b776fd
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_system.h
@@ -0,0 +1,247 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_system.h
+ *
+ * Include file for platform specific SDL API functions
+ */
+
+#ifndef SDL_system_h_
+#define SDL_system_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_keyboard.h"
+#include "SDL_render.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Platform specific functions for Windows */
+#ifdef __WIN32__
+
+/**
+ \brief Set a function that is called for every windows message, before TranslateMessage()
+*/
+typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
+extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
+
+/**
+ \brief Returns the D3D9 adapter index that matches the specified display index.
+
+ This adapter index can be passed to IDirect3D9::CreateDevice and controls
+ on which monitor a full screen application will appear.
+*/
+extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
+
+typedef struct IDirect3DDevice9 IDirect3DDevice9;
+/**
+ \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer.
+
+ Once you are done using the device, you should release it to avoid a resource leak.
+ */
+extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
+
+/**
+ \brief Returns the DXGI Adapter and Output indices for the specified display index.
+
+ These can be passed to EnumAdapters and EnumOutputs respectively to get the objects
+ required to create a DX10 or DX11 device and swap chain.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
+
+#endif /* __WIN32__ */
+
+
+/* Platform specific functions for iOS */
+#if defined(__IPHONEOS__) && __IPHONEOS__
+
+#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
+extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+
+#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
+extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
+
+#endif /* __IPHONEOS__ */
+
+
+/* Platform specific functions for Android */
+#if defined(__ANDROID__) && __ANDROID__
+
+/**
+ \brief Get the JNI environment for the current thread
+
+ This returns JNIEnv*, but the prototype is void* so we don't need jni.h
+ */
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
+
+/**
+ \brief Get the SDL Activity object for the application
+
+ This returns jobject, but the prototype is void* so we don't need jni.h
+ The jobject returned by SDL_AndroidGetActivity is a local reference.
+ It is the caller's responsibility to properly release it
+ (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
+ */
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
+
+/**
+ \brief Return true if the application is running on Android TV
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
+
+/**
+ See the official Android developer guide for more information:
+ http://developer.android.com/guide/topics/data/data-storage.html
+*/
+#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
+#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
+
+/**
+ \brief Get the path used for internal storage for this application.
+
+ This path is unique to your application and cannot be written to
+ by other applications.
+ */
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
+
+/**
+ \brief Get the current state of external storage, a bitmask of these values:
+ SDL_ANDROID_EXTERNAL_STORAGE_READ
+ SDL_ANDROID_EXTERNAL_STORAGE_WRITE
+
+ If external storage is currently unavailable, this will return 0.
+*/
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
+
+/**
+ \brief Get the path used for external storage for this application.
+
+ This path is unique to your application, but is public and can be
+ written to by other applications.
+ */
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
+
+#endif /* __ANDROID__ */
+
+/* Platform specific functions for WinRT */
+#if defined(__WINRT__) && __WINRT__
+
+/**
+ * \brief WinRT / Windows Phone path types
+ */
+typedef enum
+{
+ /** \brief The installed app's root directory.
+ Files here are likely to be read-only. */
+ SDL_WINRT_PATH_INSTALLED_LOCATION,
+
+ /** \brief The app's local data store. Files may be written here */
+ SDL_WINRT_PATH_LOCAL_FOLDER,
+
+ /** \brief The app's roaming data store. Unsupported on Windows Phone.
+ Files written here may be copied to other machines via a network
+ connection.
+ */
+ SDL_WINRT_PATH_ROAMING_FOLDER,
+
+ /** \brief The app's temporary data store. Unsupported on Windows Phone.
+ Files written here may be deleted at any time. */
+ SDL_WINRT_PATH_TEMP_FOLDER
+} SDL_WinRT_Path;
+
+
+/**
+ * \brief WinRT Device Family
+ */
+typedef enum
+{
+ /** \brief Unknown family */
+ SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+ /** \brief Desktop family*/
+ SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+ /** \brief Mobile family (for example smartphone) */
+ SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+ /** \brief XBox family */
+ SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
+/**
+ * \brief Retrieves a WinRT defined path on the local file system
+ *
+ * \note Documentation on most app-specific path types on WinRT
+ * can be found on MSDN, at the URL:
+ * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
+ *
+ * \param pathType The type of path to retrieve.
+ * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
+ * if the path is not available for any reason. Not all paths are
+ * available on all versions of Windows. This is especially true on
+ * Windows Phone. Check the documentation for the given
+ * SDL_WinRT_Path for more information on which path types are
+ * supported where.
+ */
+extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
+
+/**
+ * \brief Retrieves a WinRT defined path on the local file system
+ *
+ * \note Documentation on most app-specific path types on WinRT
+ * can be found on MSDN, at the URL:
+ * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
+ *
+ * \param pathType The type of path to retrieve.
+ * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
+ * if the path is not available for any reason. Not all paths are
+ * available on all versions of Windows. This is especially true on
+ * Windows Phone. Check the documentation for the given
+ * SDL_WinRT_Path for more information on which path types are
+ * supported where.
+ */
+extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
+
+/**
+ * \brief Detects the device family of WinRT plattform on runtime
+ *
+ * \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
+#endif /* __WINRT__ */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_system_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_syswm.h b/src/3rdparty/SDL2/include/SDL2/SDL_syswm.h
new file mode 100644
index 0000000..8aa4a39
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_syswm.h
@@ -0,0 +1,324 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_syswm.h
+ *
+ * Include file for SDL custom system window manager hooks.
+ */
+
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_version.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_syswm.h
+ *
+ * Your application has access to a special type of event ::SDL_SYSWMEVENT,
+ * which contains window-manager specific information and arrives whenever
+ * an unhandled window event occurs. This event is ignored by default, but
+ * you can enable it with SDL_EventState().
+ */
+#ifdef SDL_PROTOTYPES_ONLY
+struct SDL_SysWMinfo;
+#else
+
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_WINRT)
+#include <Inspectable.h>
+#endif
+
+/* This is the structure for custom window manager events */
+#if defined(SDL_VIDEO_DRIVER_X11)
+#if defined(__APPLE__) && defined(__MACH__)
+/* conflicts with Quickdraw.h */
+#define Cursor X11Cursor
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#if defined(__APPLE__) && defined(__MACH__)
+/* matches the re-define above */
+#undef Cursor
+#endif
+
+#endif /* defined(SDL_VIDEO_DRIVER_X11) */
+
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+#include <directfb.h>
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+#ifdef __OBJC__
+@class NSWindow;
+#else
+typedef struct _NSWindow NSWindow;
+#endif
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_UIKIT)
+#ifdef __OBJC__
+#include <UIKit/UIKit.h>
+#else
+typedef struct _UIWindow UIWindow;
+typedef struct _UIViewController UIViewController;
+#endif
+typedef Uint32 GLuint;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_ANDROID)
+typedef struct ANativeWindow ANativeWindow;
+typedef void *EGLSurface;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+#include "SDL_egl.h"
+#endif
+
+/**
+ * These are the various supported windowing subsystems
+ */
+typedef enum
+{
+ SDL_SYSWM_UNKNOWN,
+ SDL_SYSWM_WINDOWS,
+ SDL_SYSWM_X11,
+ SDL_SYSWM_DIRECTFB,
+ SDL_SYSWM_COCOA,
+ SDL_SYSWM_UIKIT,
+ SDL_SYSWM_WAYLAND,
+ SDL_SYSWM_MIR,
+ SDL_SYSWM_WINRT,
+ SDL_SYSWM_ANDROID,
+ SDL_SYSWM_VIVANTE,
+ SDL_SYSWM_OS2
+} SDL_SYSWM_TYPE;
+
+/**
+ * The custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ SDL_SYSWM_TYPE subsystem;
+ union
+ {
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+ struct {
+ HWND hwnd; /**< The window for the message */
+ UINT msg; /**< The type of message */
+ WPARAM wParam; /**< WORD message parameter */
+ LPARAM lParam; /**< LONG message parameter */
+ } win;
+#endif
+#if defined(SDL_VIDEO_DRIVER_X11)
+ struct {
+ XEvent event;
+ } x11;
+#endif
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+ struct {
+ DFBEvent event;
+ } dfb;
+#endif
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+ struct
+ {
+ /* Latest version of Xcode clang complains about empty structs in C v. C++:
+ error: empty struct has size 0 in C, size 1 in C++
+ */
+ int dummy;
+ /* No Cocoa window events yet */
+ } cocoa;
+#endif
+#if defined(SDL_VIDEO_DRIVER_UIKIT)
+ struct
+ {
+ int dummy;
+ /* No UIKit window events yet */
+ } uikit;
+#endif
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+ struct
+ {
+ int dummy;
+ /* No Vivante window events yet */
+ } vivante;
+#endif
+ /* Can't have an empty union */
+ int dummy;
+ } msg;
+};
+
+/**
+ * The custom window manager information structure.
+ *
+ * When this structure is returned, it holds information about which
+ * low level system it is using, and will be one of SDL_SYSWM_TYPE.
+ */
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ SDL_SYSWM_TYPE subsystem;
+ union
+ {
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+ struct
+ {
+ HWND window; /**< The window handle */
+ HDC hdc; /**< The window device context */
+ HINSTANCE hinstance; /**< The instance handle */
+ } win;
+#endif
+#if defined(SDL_VIDEO_DRIVER_WINRT)
+ struct
+ {
+ IInspectable * window; /**< The WinRT CoreWindow */
+ } winrt;
+#endif
+#if defined(SDL_VIDEO_DRIVER_X11)
+ struct
+ {
+ Display *display; /**< The X11 display */
+ Window window; /**< The X11 window */
+ } x11;
+#endif
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+ struct
+ {
+ IDirectFB *dfb; /**< The directfb main interface */
+ IDirectFBWindow *window; /**< The directfb window handle */
+ IDirectFBSurface *surface; /**< The directfb client surface */
+ } dfb;
+#endif
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+ struct
+ {
+#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
+ NSWindow __unsafe_unretained *window; /**< The Cocoa window */
+#else
+ NSWindow *window; /**< The Cocoa window */
+#endif
+ } cocoa;
+#endif
+#if defined(SDL_VIDEO_DRIVER_UIKIT)
+ struct
+ {
+#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
+ UIWindow __unsafe_unretained *window; /**< The UIKit window */
+#else
+ UIWindow *window; /**< The UIKit window */
+#endif
+ GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+ GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+ GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+ } uikit;
+#endif
+#if defined(SDL_VIDEO_DRIVER_WAYLAND)
+ struct
+ {
+ struct wl_display *display; /**< Wayland display */
+ struct wl_surface *surface; /**< Wayland surface */
+ struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
+ } wl;
+#endif
+#if defined(SDL_VIDEO_DRIVER_MIR)
+ struct
+ {
+ struct MirConnection *connection; /**< Mir display server connection */
+ struct MirSurface *surface; /**< Mir surface */
+ } mir;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_ANDROID)
+ struct
+ {
+ ANativeWindow *window;
+ EGLSurface surface;
+ } android;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+ struct
+ {
+ EGLNativeDisplayType display;
+ EGLNativeWindowType window;
+ } vivante;
+#endif
+
+ /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+ /* Be careful not to overflow this if you add a new target! */
+ Uint8 dummy[64];
+ } info;
+};
+
+#endif /* SDL_PROTOTYPES_ONLY */
+
+typedef struct SDL_SysWMinfo SDL_SysWMinfo;
+
+/* Function prototypes */
+/**
+ * \brief This function allows access to driver-dependent window information.
+ *
+ * \param window The window about which information is being requested
+ * \param info This structure must be initialized with the SDL version, and is
+ * then filled in with information about the given window.
+ *
+ * \return SDL_TRUE if the function is implemented and the version member of
+ * the \c info struct is valid, SDL_FALSE otherwise.
+ *
+ * You typically use this function like this:
+ * \code
+ * SDL_SysWMinfo info;
+ * SDL_VERSION(&info.version);
+ * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
+ * \endcode
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
+ SDL_SysWMinfo * info);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_syswm_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test.h b/src/3rdparty/SDL2/include/SDL2/SDL_test.h
new file mode 100644
index 0000000..6cc373b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test.h
@@ -0,0 +1,69 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_h_
+#define SDL_test_h_
+
+#include "SDL.h"
+#include "SDL_test_assert.h"
+#include "SDL_test_common.h"
+#include "SDL_test_compare.h"
+#include "SDL_test_crc32.h"
+#include "SDL_test_font.h"
+#include "SDL_test_fuzzer.h"
+#include "SDL_test_harness.h"
+#include "SDL_test_images.h"
+#include "SDL_test_log.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_memory.h"
+#include "SDL_test_random.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Global definitions */
+
+/*
+ * Note: Maximum size of SDLTest log message is less than SDL's limit
+ * to ensure we can fit additional information such as the timestamp.
+ */
+#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_assert.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_assert.h
new file mode 100644
index 0000000..1788d7a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_assert.h
@@ -0,0 +1,105 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_assert.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ *
+ * Assert API for test code and test cases
+ *
+ */
+
+#ifndef SDL_test_assert_h_
+#define SDL_test_assert_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Fails the assert.
+ */
+#define ASSERT_FAIL 0
+
+/**
+ * \brief Passes the assert.
+ */
+#define ASSERT_PASS 1
+
+/**
+ * \brief Assert that logs and break execution flow on failures.
+ *
+ * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
+ * \param assertDescription Message to log with the assert describing it.
+ */
+void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
+ *
+ * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
+ * \param assertDescription Message to log with the assert describing it.
+ *
+ * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
+ */
+int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
+ *
+ * \param assertDescription Message to log with the assert describing it.
+ */
+void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/**
+ * \brief Resets the assert summary counters to zero.
+ */
+void SDLTest_ResetAssertSummary(void);
+
+/**
+ * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
+ */
+void SDLTest_LogAssertSummary(void);
+
+
+/**
+ * \brief Converts the current assert summary state to a test result.
+ *
+ * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
+ */
+int SDLTest_AssertSummaryToTestResult(void);
+
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_assert_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_common.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_common.h
new file mode 100644
index 0000000..be2e6b2
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_common.h
@@ -0,0 +1,188 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_common.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/* Ported from original test\common.h file. */
+
+#ifndef SDL_test_common_h_
+#define SDL_test_common_h_
+
+#include "SDL.h"
+
+#if defined(__PSP__)
+#define DEFAULT_WINDOW_WIDTH 480
+#define DEFAULT_WINDOW_HEIGHT 272
+#else
+#define DEFAULT_WINDOW_WIDTH 640
+#define DEFAULT_WINDOW_HEIGHT 480
+#endif
+
+#define VERBOSE_VIDEO 0x00000001
+#define VERBOSE_MODES 0x00000002
+#define VERBOSE_RENDER 0x00000004
+#define VERBOSE_EVENT 0x00000008
+#define VERBOSE_AUDIO 0x00000010
+
+typedef struct
+{
+ /* SDL init flags */
+ char **argv;
+ Uint32 flags;
+ Uint32 verbose;
+
+ /* Video info */
+ const char *videodriver;
+ int display;
+ const char *window_title;
+ const char *window_icon;
+ Uint32 window_flags;
+ int window_x;
+ int window_y;
+ int window_w;
+ int window_h;
+ int window_minW;
+ int window_minH;
+ int window_maxW;
+ int window_maxH;
+ int logical_w;
+ int logical_h;
+ float scale;
+ int depth;
+ int refresh_rate;
+ int num_windows;
+ SDL_Window **windows;
+
+ /* Renderer info */
+ const char *renderdriver;
+ Uint32 render_flags;
+ SDL_bool skip_renderer;
+ SDL_Renderer **renderers;
+ SDL_Texture **targets;
+
+ /* Audio info */
+ const char *audiodriver;
+ SDL_AudioSpec audiospec;
+
+ /* GL settings */
+ int gl_red_size;
+ int gl_green_size;
+ int gl_blue_size;
+ int gl_alpha_size;
+ int gl_buffer_size;
+ int gl_depth_size;
+ int gl_stencil_size;
+ int gl_double_buffer;
+ int gl_accum_red_size;
+ int gl_accum_green_size;
+ int gl_accum_blue_size;
+ int gl_accum_alpha_size;
+ int gl_stereo;
+ int gl_multisamplebuffers;
+ int gl_multisamplesamples;
+ int gl_retained_backing;
+ int gl_accelerated;
+ int gl_major_version;
+ int gl_minor_version;
+ int gl_debug;
+ int gl_profile_mask;
+} SDLTest_CommonState;
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+/**
+ * \brief Parse command line parameters and create common state.
+ *
+ * \param argv Array of command line parameters
+ * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
+ *
+ * \returns Returns a newly allocated common state object.
+ */
+SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
+
+/**
+ * \brief Process one common argument.
+ *
+ * \param state The common state describing the test window to create.
+ * \param index The index of the argument to process in argv[].
+ *
+ * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
+ */
+int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
+
+/**
+ * \brief Returns common usage information
+ *
+ * \param state The common state describing the test window to create.
+ *
+ * \returns String with usage information
+ */
+const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
+
+/**
+ * \brief Open test window.
+ *
+ * \param state The common state describing the test window to create.
+ *
+ * \returns True if initialization succeeded, false otherwise
+ */
+SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
+
+/**
+ * \brief Common event handler for test windows.
+ *
+ * \param state The common state used to create test window.
+ * \param event The event to handle.
+ * \param done Flag indicating we are done.
+ *
+ */
+void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
+
+/**
+ * \brief Close test window.
+ *
+ * \param state The common state used to create test window.
+ *
+ */
+void SDLTest_CommonQuit(SDLTest_CommonState * state);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_common_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_compare.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_compare.h
new file mode 100644
index 0000000..c22e447
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_compare.h
@@ -0,0 +1,69 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_compare.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Defines comparison functions (i.e. for surfaces).
+
+*/
+
+#ifndef SDL_test_compare_h_
+#define SDL_test_compare_h_
+
+#include "SDL.h"
+
+#include "SDL_test_images.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Compares a surface and with reference image data for equality
+ *
+ * \param surface Surface used in comparison
+ * \param referenceSurface Test Surface used in comparison
+ * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
+ *
+ * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
+ */
+int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_compare_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_crc32.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_crc32.h
new file mode 100644
index 0000000..3d235d0
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_crc32.h
@@ -0,0 +1,124 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_crc32.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Implements CRC32 calculations (default output is Perl String::CRC32 compatible).
+
+*/
+
+#ifndef SDL_test_crc32_h_
+#define SDL_test_crc32_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ------------ Definitions --------- */
+
+/* Definition shared by all CRC routines */
+
+#ifndef CrcUint32
+ #define CrcUint32 unsigned int
+#endif
+#ifndef CrcUint8
+ #define CrcUint8 unsigned char
+#endif
+
+#ifdef ORIGINAL_METHOD
+ #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
+#else
+ #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
+#endif
+
+/**
+ * Data structure for CRC32 (checksum) computation
+ */
+ typedef struct {
+ CrcUint32 crc32_table[256]; /* CRC table */
+ } SDLTest_Crc32Context;
+
+/* ---------- Function Prototypes ------------- */
+
+/**
+ * \brief Initialize the CRC context
+ *
+ * Note: The function initializes the crc table required for all crc calculations.
+ *
+ * \param crcContext pointer to context variable
+ *
+ * \returns 0 for OK, -1 on error
+ *
+ */
+ int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
+
+
+/**
+ * \brief calculate a crc32 from a data block
+ *
+ * \param crcContext pointer to context variable
+ * \param inBuf input buffer to checksum
+ * \param inLen length of input buffer
+ * \param crc32 pointer to Uint32 to store the final CRC into
+ *
+ * \returns 0 for OK, -1 on error
+ *
+ */
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+
+/* Same routine broken down into three steps */
+int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
+int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
+int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+
+
+/**
+ * \brief clean up CRC context
+ *
+ * \param crcContext pointer to context variable
+ *
+ * \returns 0 for OK, -1 on error
+ *
+*/
+
+int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_crc32_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_font.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_font.h
new file mode 100644
index 0000000..59cbdca
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_font.h
@@ -0,0 +1,81 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_font.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_font_h_
+#define SDL_test_font_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+#define FONT_CHARACTER_SIZE 8
+
+/**
+ * \brief Draw a string in the currently set font.
+ *
+ * \param renderer The renderer to draw on.
+ * \param x The X coordinate of the upper left corner of the character.
+ * \param y The Y coordinate of the upper left corner of the character.
+ * \param c The character to draw.
+ *
+ * \returns Returns 0 on success, -1 on failure.
+ */
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
+
+/**
+ * \brief Draw a string in the currently set font.
+ *
+ * \param renderer The renderer to draw on.
+ * \param x The X coordinate of the upper left corner of the string.
+ * \param y The Y coordinate of the upper left corner of the string.
+ * \param s The string to draw.
+ *
+ * \returns Returns 0 on success, -1 on failure.
+ */
+int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
+
+
+/**
+ * \brief Cleanup textures used by font drawing functions.
+ */
+void SDLTest_CleanupTextDrawing(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_font_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_fuzzer.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_fuzzer.h
new file mode 100644
index 0000000..8fcb9eb
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_fuzzer.h
@@ -0,0 +1,384 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_fuzzer.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Data generators for fuzzing test data in a reproducible way.
+
+*/
+
+#ifndef SDL_test_fuzzer_h_
+#define SDL_test_fuzzer_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ Based on GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
+*/
+
+
+/**
+ * \file
+ * Note: The fuzzer implementation uses a static instance of random context
+ * internally which makes it thread-UNsafe.
+ */
+
+/**
+ * Initializes the fuzzer for a test
+ *
+ * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
+ *
+ */
+void SDLTest_FuzzerInit(Uint64 execKey);
+
+
+/**
+ * Returns a random Uint8
+ *
+ * \returns Generated integer
+ */
+Uint8 SDLTest_RandomUint8(void);
+
+/**
+ * Returns a random Sint8
+ *
+ * \returns Generated signed integer
+ */
+Sint8 SDLTest_RandomSint8(void);
+
+
+/**
+ * Returns a random Uint16
+ *
+ * \returns Generated integer
+ */
+Uint16 SDLTest_RandomUint16(void);
+
+/**
+ * Returns a random Sint16
+ *
+ * \returns Generated signed integer
+ */
+Sint16 SDLTest_RandomSint16(void);
+
+
+/**
+ * Returns a random integer
+ *
+ * \returns Generated integer
+ */
+Sint32 SDLTest_RandomSint32(void);
+
+
+/**
+ * Returns a random positive integer
+ *
+ * \returns Generated integer
+ */
+Uint32 SDLTest_RandomUint32(void);
+
+/**
+ * Returns random Uint64.
+ *
+ * \returns Generated integer
+ */
+Uint64 SDLTest_RandomUint64(void);
+
+
+/**
+ * Returns random Sint64.
+ *
+ * \returns Generated signed integer
+ */
+Sint64 SDLTest_RandomSint64(void);
+
+/**
+ * \returns random float in range [0.0 - 1.0[
+ */
+float SDLTest_RandomUnitFloat(void);
+
+/**
+ * \returns random double in range [0.0 - 1.0[
+ */
+double SDLTest_RandomUnitDouble(void);
+
+/**
+ * \returns random float.
+ *
+ */
+float SDLTest_RandomFloat(void);
+
+/**
+ * \returns random double.
+ *
+ */
+double SDLTest_RandomDouble(void);
+
+/**
+ * Returns a random boundary value for Uint8 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint16 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint32 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint64 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint8 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
+ */
+Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
+
+
+/**
+ * Returns a random boundary value for Sint16 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
+ */
+Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint32 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
+ */
+Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint64 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
+ */
+Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
+
+
+/**
+ * Returns integer in range [min, max] (inclusive).
+ * Min and max values can be negative values.
+ * If Max in smaller than min, then the values are swapped.
+ * Min and max are the same value, that value will be returned.
+ *
+ * \param min Minimum inclusive value of returned random number
+ * \param max Maximum inclusive value of returned random number
+ *
+ * \returns Generated random integer in range
+ */
+Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
+
+
+/**
+ * Generates random null-terminated string. The minimum length for
+ * the string is 1 character, maximum length for the string is 255
+ * characters and it can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiString(void);
+
+
+/**
+ * Generates random null-terminated string. The maximum length for
+ * the string is defined by the maxLength parameter.
+ * String can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \param maxLength The maximum length of the generated string.
+ *
+ * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
+
+
+/**
+ * Generates random null-terminated string. The length for
+ * the string is defined by the size parameter.
+ * String can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \param size The length of the generated string
+ *
+ * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiStringOfSize(int size);
+
+/**
+ * Returns the invocation count for the fuzzer since last ...FuzzerInit.
+ */
+int SDLTest_GetFuzzerInvocationCount(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_fuzzer_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_harness.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_harness.h
new file mode 100644
index 0000000..8641e0a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_harness.h
@@ -0,0 +1,134 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_harness.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ Defines types for test case definitions and the test execution harness API.
+
+ Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
+*/
+
+#ifndef SDL_test_h_arness_h
+#define SDL_test_h_arness_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ! Definitions for test case structures */
+#define TEST_ENABLED 1
+#define TEST_DISABLED 0
+
+/* ! Definition of all the possible test return values of the test case method */
+#define TEST_ABORTED -1
+#define TEST_STARTED 0
+#define TEST_COMPLETED 1
+#define TEST_SKIPPED 2
+
+/* ! Definition of all the possible test results for the harness */
+#define TEST_RESULT_PASSED 0
+#define TEST_RESULT_FAILED 1
+#define TEST_RESULT_NO_ASSERT 2
+#define TEST_RESULT_SKIPPED 3
+#define TEST_RESULT_SETUP_FAILURE 4
+
+/* !< Function pointer to a test case setup function (run before every test) */
+typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
+
+/* !< Function pointer to a test case function */
+typedef int (*SDLTest_TestCaseFp)(void *arg);
+
+/* !< Function pointer to a test case teardown function (run after every test) */
+typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
+
+/**
+ * Holds information about a single test case.
+ */
+typedef struct SDLTest_TestCaseReference {
+ /* !< Func2Stress */
+ SDLTest_TestCaseFp testCase;
+ /* !< Short name (or function name) "Func2Stress" */
+ char *name;
+ /* !< Long name or full description "This test pushes func2() to the limit." */
+ char *description;
+ /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
+ int enabled;
+} SDLTest_TestCaseReference;
+
+/**
+ * Holds information about a test suite (multiple test cases).
+ */
+typedef struct SDLTest_TestSuiteReference {
+ /* !< "PlatformSuite" */
+ char *name;
+ /* !< The function that is run before each test. NULL skips. */
+ SDLTest_TestCaseSetUpFp testSetUp;
+ /* !< The test cases that are run as part of the suite. Last item should be NULL. */
+ const SDLTest_TestCaseReference **testCases;
+ /* !< The function that is run after each test. NULL skips. */
+ SDLTest_TestCaseTearDownFp testTearDown;
+} SDLTest_TestSuiteReference;
+
+
+/**
+ * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
+ *
+ * Note: The returned string needs to be deallocated by the caller.
+ *
+ * \param length The length of the seed string to generate
+ *
+ * \returns The generated seed string
+ */
+char *SDLTest_GenerateRunSeed(const int length);
+
+/**
+ * \brief Execute a test suite using the given run seed and execution key.
+ *
+ * \param testSuites Suites containing the test case.
+ * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
+ * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
+ * \param filter Filter specification. NULL disables. Case sensitive.
+ * \param testIterations Number of iterations to run each test case.
+ *
+ * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
+ */
+int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_h_arness_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_images.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_images.h
new file mode 100644
index 0000000..9c4dd5b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_images.h
@@ -0,0 +1,78 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_images.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Defines some images for tests.
+
+*/
+
+#ifndef SDL_test_images_h_
+#define SDL_test_images_h_
+
+#include "SDL.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *Type for test images.
+ */
+typedef struct SDLTest_SurfaceImage_s {
+ int width;
+ int height;
+ unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
+ const char *pixel_data;
+} SDLTest_SurfaceImage_t;
+
+/* Test images */
+SDL_Surface *SDLTest_ImageBlit(void);
+SDL_Surface *SDLTest_ImageBlitColor(void);
+SDL_Surface *SDLTest_ImageBlitAlpha(void);
+SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
+SDL_Surface *SDLTest_ImageBlitBlend(void);
+SDL_Surface *SDLTest_ImageBlitBlendMod(void);
+SDL_Surface *SDLTest_ImageBlitBlendNone(void);
+SDL_Surface *SDLTest_ImageBlitBlendAll(void);
+SDL_Surface *SDLTest_ImageFace(void);
+SDL_Surface *SDLTest_ImagePrimitives(void);
+SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_images_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_log.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_log.h
new file mode 100644
index 0000000..ebd44fb
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_log.h
@@ -0,0 +1,67 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_log.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ *
+ * Wrapper to log in the TEST category
+ *
+ */
+
+#ifndef SDL_test_log_h_
+#define SDL_test_log_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Prints given message with a timestamp in the TEST category and INFO priority.
+ *
+ * \param fmt Message to be logged
+ */
+void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/**
+ * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
+ *
+ * \param fmt Message to be logged
+ */
+void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_log_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_md5.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_md5.h
new file mode 100644
index 0000000..0e41057
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_md5.h
@@ -0,0 +1,129 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_md5.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ ***********************************************************************
+ ** Header file for implementation of MD5 **
+ ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
+ ** Created: 2/17/90 RLR **
+ ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
+ ** Revised (for MD5): RLR 4/27/91 **
+ ** -- G modified to have y&~z instead of y&z **
+ ** -- FF, GG, HH modified to add in last register done **
+ ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
+ ** -- distinct additive constant for each step **
+ ** -- round 4 added, working mod 7 **
+ ***********************************************************************
+*/
+
+/*
+ ***********************************************************************
+ ** Message-digest routines: **
+ ** To form the message digest for a message M **
+ ** (1) Initialize a context buffer mdContext using MD5Init **
+ ** (2) Call MD5Update on mdContext and M **
+ ** (3) Call MD5Final on mdContext **
+ ** The message digest is now in mdContext->digest[0...15] **
+ ***********************************************************************
+*/
+
+#ifndef SDL_test_md5_h_
+#define SDL_test_md5_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ------------ Definitions --------- */
+
+/* typedef a 32-bit type */
+ typedef unsigned long int MD5UINT4;
+
+/* Data structure for MD5 (Message-Digest) computation */
+ typedef struct {
+ MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
+ MD5UINT4 buf[4]; /* scratch buffer */
+ unsigned char in[64]; /* input buffer */
+ unsigned char digest[16]; /* actual digest after Md5Final call */
+ } SDLTest_Md5Context;
+
+/* ---------- Function Prototypes ------------- */
+
+/**
+ * \brief initialize the context
+ *
+ * \param mdContext pointer to context variable
+ *
+ * Note: The function initializes the message-digest context
+ * mdContext. Call before each new use of the context -
+ * all fields are set to zero.
+ */
+ void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
+
+
+/**
+ * \brief update digest from variable length data
+ *
+ * \param mdContext pointer to context variable
+ * \param inBuf pointer to data array/string
+ * \param inLen length of data array/string
+ *
+ * Note: The function updates the message-digest context to account
+ * for the presence of each of the characters inBuf[0..inLen-1]
+ * in the message whose digest is being computed.
+*/
+
+ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
+ unsigned int inLen);
+
+
+/**
+ * \brief complete digest computation
+ *
+ * \param mdContext pointer to context variable
+ *
+ * Note: The function terminates the message-digest computation and
+ * ends with the desired message digest in mdContext.digest[0..15].
+ * Always call before using the digest[] variable.
+*/
+
+ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_md5_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_memory.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_memory.h
new file mode 100644
index 0000000..4827ae6
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_memory.h
@@ -0,0 +1,63 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_memory.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_memory_h_
+#define SDL_test_memory_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief Start tracking SDL memory allocations
+ *
+ * \note This should be called before any other SDL functions for complete tracking coverage
+ */
+int SDLTest_TrackAllocations();
+
+/**
+ * \brief Print a log of any outstanding allocations
+ *
+ * \note This can be called after SDL_Quit()
+ */
+void SDLTest_LogAllocations();
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_memory_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_test_random.h b/src/3rdparty/SDL2/include/SDL2/SDL_test_random.h
new file mode 100644
index 0000000..0eb414f
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_test_random.h
@@ -0,0 +1,115 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_random.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ A "32-bit Multiply with carry random number generator. Very fast.
+ Includes a list of recommended multipliers.
+
+ multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32.
+ period: (a*2^31)-1
+
+*/
+
+#ifndef SDL_test_random_h_
+#define SDL_test_random_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* --- Definitions */
+
+/*
+ * Macros that return a random number in a specific format.
+ */
+#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c))
+
+/*
+ * Context structure for the random number generator state.
+ */
+ typedef struct {
+ unsigned int a;
+ unsigned int x;
+ unsigned int c;
+ unsigned int ah;
+ unsigned int al;
+ } SDLTest_RandomContext;
+
+
+/* --- Function prototypes */
+
+/**
+ * \brief Initialize random number generator with two integers.
+ *
+ * Note: The random sequence of numbers returned by ...Random() is the
+ * same for the same two integers and has a period of 2^31.
+ *
+ * \param rndContext pointer to context structure
+ * \param xi integer that defines the random sequence
+ * \param ci integer that defines the random sequence
+ *
+ */
+ void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
+ unsigned int ci);
+
+/**
+ * \brief Initialize random number generator based on current system time.
+ *
+ * \param rndContext pointer to context structure
+ *
+ */
+ void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
+
+
+/**
+ * \brief Initialize random number generator based on current system time.
+ *
+ * Note: ...RandomInit() or ...RandomInitTime() must have been called
+ * before using this function.
+ *
+ * \param rndContext pointer to context structure
+ *
+ * \returns A random number (32bit unsigned integer)
+ *
+ */
+ unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_random_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_thread.h b/src/3rdparty/SDL2/include/SDL2/SDL_thread.h
new file mode 100644
index 0000000..82a43fc
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_thread.h
@@ -0,0 +1,308 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
+
+/**
+ * \file SDL_thread.h
+ *
+ * Header for the SDL thread management routines.
+ */
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+/* Thread synchronization primitives */
+#include "SDL_atomic.h"
+#include "SDL_mutex.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The SDL thread structure, defined in SDL_thread.c */
+struct SDL_Thread;
+typedef struct SDL_Thread SDL_Thread;
+
+/* The SDL thread ID */
+typedef unsigned long SDL_threadID;
+
+/* Thread local storage ID, 0 is the invalid ID */
+typedef unsigned int SDL_TLSID;
+
+/**
+ * The SDL thread priority.
+ *
+ * \note On many systems you require special privileges to set high priority.
+ */
+typedef enum {
+ SDL_THREAD_PRIORITY_LOW,
+ SDL_THREAD_PRIORITY_NORMAL,
+ SDL_THREAD_PRIORITY_HIGH
+} SDL_ThreadPriority;
+
+/**
+ * The function passed to SDL_CreateThread().
+ * It is passed a void* user context parameter and returns an int.
+ */
+typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
+
+#if defined(__WIN32__) && !defined(HAVE_LIBC)
+/**
+ * \file SDL_thread.h
+ *
+ * We compile SDL into a DLL. This means, that it's the DLL which
+ * creates a new thread for the calling process with the SDL_CreateThread()
+ * API. There is a problem with this, that only the RTL of the SDL2.DLL will
+ * be initialized for those threads, and not the RTL of the calling
+ * application!
+ *
+ * To solve this, we make a little hack here.
+ *
+ * We'll always use the caller's _beginthread() and _endthread() APIs to
+ * start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ * then the RTL of SDL2.DLL will be used to create the new thread, and if it's
+ * the application, then the RTL of the application will be used.
+ *
+ * So, in short:
+ * Always use the _beginthread() and _endthread() of the calling runtime
+ * library!
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+ (void *, unsigned, unsigned (__stdcall *func)(void *),
+ void * /*arg*/, unsigned, unsigned * /* threadID */);
+typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
+
+/**
+ * Create a thread.
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+
+/**
+ * Create a thread.
+ */
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#endif
+
+#elif defined(__OS2__)
+/*
+ * just like the windows case above: We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#endif
+
+#else
+
+/**
+ * Create a thread.
+ *
+ * Thread naming is a little complicated: Most systems have very small
+ * limits for the string length (Haiku has 32 bytes, Linux currently has 16,
+ * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
+ * have to see what happens with your system's debugger. The name should be
+ * UTF-8 (but using the naming limits of C identifiers is a better bet).
+ * There are no requirements for thread naming conventions, so long as the
+ * string is null-terminated UTF-8, but these guidelines are helpful in
+ * choosing a name:
+ *
+ * http://stackoverflow.com/questions/149932/naming-conventions-for-threads
+ *
+ * If a system imposes requirements, SDL will try to munge the string for
+ * it (truncate, etc), but the original string contents will be available
+ * from SDL_GetThreadName().
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+
+#endif
+
+/**
+ * Get the thread name, as it was specified in SDL_CreateThread().
+ * This function returns a pointer to a UTF-8 string that names the
+ * specified thread, or NULL if it doesn't have a name. This is internal
+ * memory, not to be free()'d by the caller, and remains valid until the
+ * specified thread is cleaned up by SDL_WaitThread().
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
+
+/**
+ * Get the thread identifier for the current thread.
+ */
+extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
+
+/**
+ * Get the thread identifier for the specified thread.
+ *
+ * Equivalent to SDL_ThreadID() if the specified thread is NULL.
+ */
+extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
+
+/**
+ * Set the priority for the current thread
+ */
+extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
+
+/**
+ * Wait for a thread to finish. Threads that haven't been detached will
+ * remain (as a "zombie") until this function cleans them up. Not doing so
+ * is a resource leak.
+ *
+ * Once a thread has been cleaned up through this function, the SDL_Thread
+ * that references it becomes invalid and should not be referenced again.
+ * As such, only one thread may call SDL_WaitThread() on another.
+ *
+ * The return code for the thread function is placed in the area
+ * pointed to by \c status, if \c status is not NULL.
+ *
+ * You may not wait on a thread that has been used in a call to
+ * SDL_DetachThread(). Use either that function or this one, but not
+ * both, or behavior is undefined.
+ *
+ * It is safe to pass NULL to this function; it is a no-op.
+ */
+extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
+
+/**
+ * A thread may be "detached" to signify that it should not remain until
+ * another thread has called SDL_WaitThread() on it. Detaching a thread
+ * is useful for long-running threads that nothing needs to synchronize
+ * with or further manage. When a detached thread is done, it simply
+ * goes away.
+ *
+ * There is no way to recover the return code of a detached thread. If you
+ * need this, don't detach the thread and instead use SDL_WaitThread().
+ *
+ * Once a thread is detached, you should usually assume the SDL_Thread isn't
+ * safe to reference again, as it will become invalid immediately upon
+ * the detached thread's exit, instead of remaining until someone has called
+ * SDL_WaitThread() to finally clean it up. As such, don't detach the same
+ * thread more than once.
+ *
+ * If a thread has already exited when passed to SDL_DetachThread(), it will
+ * stop waiting for a call to SDL_WaitThread() and clean up immediately.
+ * It is not safe to detach a thread that might be used with SDL_WaitThread().
+ *
+ * You may not call SDL_WaitThread() on a thread that has been detached.
+ * Use either that function or this one, but not both, or behavior is
+ * undefined.
+ *
+ * It is safe to pass NULL to this function; it is a no-op.
+ */
+extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread);
+
+/**
+ * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
+ *
+ * \return The newly created thread local storage identifier, or 0 on error
+ *
+ * \code
+ * static SDL_SpinLock tls_lock;
+ * static SDL_TLSID thread_local_storage;
+ *
+ * void SetMyThreadData(void *value)
+ * {
+ * if (!thread_local_storage) {
+ * SDL_AtomicLock(&tls_lock);
+ * if (!thread_local_storage) {
+ * thread_local_storage = SDL_TLSCreate();
+ * }
+ * SDL_AtomicUnlock(&tls_lock);
+ * }
+ * SDL_TLSSet(thread_local_storage, value, 0);
+ * }
+ *
+ * void *GetMyThreadData(void)
+ * {
+ * return SDL_TLSGet(thread_local_storage);
+ * }
+ * \endcode
+ *
+ * \sa SDL_TLSGet()
+ * \sa SDL_TLSSet()
+ */
+extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
+
+/**
+ * \brief Get the value associated with a thread local storage ID for the current thread.
+ *
+ * \param id The thread local storage ID
+ *
+ * \return The value associated with the ID for the current thread, or NULL if no value has been set.
+ *
+ * \sa SDL_TLSCreate()
+ * \sa SDL_TLSSet()
+ */
+extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
+
+/**
+ * \brief Set the value associated with a thread local storage ID for the current thread.
+ *
+ * \param id The thread local storage ID
+ * \param value The value to associate with the ID for the current thread
+ * \param destructor A function called when the thread exits, to free the value.
+ *
+ * \return 0 on success, -1 on error
+ *
+ * \sa SDL_TLSCreate()
+ * \sa SDL_TLSGet()
+ */
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_thread_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_timer.h b/src/3rdparty/SDL2/include/SDL2/SDL_timer.h
new file mode 100644
index 0000000..5600618
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_timer.h
@@ -0,0 +1,115 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
+
+/**
+ * \file SDL_timer.h
+ *
+ * Header for the SDL time management routines.
+ */
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Get the number of milliseconds since the SDL library initialization.
+ *
+ * \note This value wraps if the program runs for more than ~49 days.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
+
+/**
+ * \brief Compare SDL ticks values, and return true if A has passed B
+ *
+ * e.g. if you want to wait 100 ms, you could do this:
+ * Uint32 timeout = SDL_GetTicks() + 100;
+ * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
+ * ... do work until timeout has elapsed
+ * }
+ */
+#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
+
+/**
+ * \brief Get the current value of the high resolution counter
+ */
+extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
+
+/**
+ * \brief Get the count per second of the high resolution counter
+ */
+extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
+
+/**
+ * \brief Wait a specified number of milliseconds before returning.
+ */
+extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
+
+/**
+ * Function prototype for the timer callback function.
+ *
+ * The callback function is passed the current timer interval and returns
+ * the next timer interval. If the returned value is the same as the one
+ * passed in, the periodic alarm continues, otherwise a new alarm is
+ * scheduled. If the callback returns 0, the periodic alarm is cancelled.
+ */
+typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
+
+/**
+ * Definition of the timer ID type.
+ */
+typedef int SDL_TimerID;
+
+/**
+ * \brief Add a new timer to the pool of timers already running.
+ *
+ * \return A timer ID, or 0 when an error occurs.
+ */
+extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
+ SDL_TimerCallback callback,
+ void *param);
+
+/**
+ * \brief Remove a timer knowing its ID.
+ *
+ * \return A boolean value indicating success or failure.
+ *
+ * \warning It is not safe to remove a timer multiple times.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_timer_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_touch.h b/src/3rdparty/SDL2/include/SDL2/SDL_touch.h
new file mode 100644
index 0000000..f4075e7
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_touch.h
@@ -0,0 +1,86 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_touch.h
+ *
+ * Include file for SDL touch event handling.
+ */
+
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef Sint64 SDL_TouchID;
+typedef Sint64 SDL_FingerID;
+
+typedef struct SDL_Finger
+{
+ SDL_FingerID id;
+ float x;
+ float y;
+ float pressure;
+} SDL_Finger;
+
+/* Used as the device ID for mouse events simulated with touch input */
+#define SDL_TOUCH_MOUSEID ((Uint32)-1)
+
+
+/* Function prototypes */
+
+/**
+ * \brief Get the number of registered touch devices.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
+
+/**
+ * \brief Get the touch ID with the given index, or 0 if the index is invalid.
+ */
+extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
+
+/**
+ * \brief Get the number of active fingers for a given touch device.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
+
+/**
+ * \brief Get the finger object of the given touch, with the given index.
+ */
+extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_touch_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_types.h b/src/3rdparty/SDL2/include/SDL2/SDL_types.h
new file mode 100644
index 0000000..4ac248c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_types.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_types.h
+ *
+ * \deprecated
+ */
+
+/* DEPRECATED */
+#include "SDL_stdinc.h"
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_version.h b/src/3rdparty/SDL2/include/SDL2/SDL_version.h
new file mode 100644
index 0000000..584b48c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_version.h
@@ -0,0 +1,162 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_version.h
+ *
+ * This header defines the current SDL version.
+ */
+
+#ifndef SDL_version_h_
+#define SDL_version_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Information the version of SDL in use.
+ *
+ * Represents the library's version as three levels: major revision
+ * (increments with massive changes, additions, and enhancements),
+ * minor revision (increments with backwards-compatible changes to the
+ * major revision), and patchlevel (increments with fixes to the minor
+ * revision).
+ *
+ * \sa SDL_VERSION
+ * \sa SDL_GetVersion
+ */
+typedef struct SDL_version
+{
+ Uint8 major; /**< major version */
+ Uint8 minor; /**< minor version */
+ Uint8 patch; /**< update version */
+} SDL_version;
+
+/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
+*/
+#define SDL_MAJOR_VERSION 2
+#define SDL_MINOR_VERSION 0
+#define SDL_PATCHLEVEL 8
+
+/**
+ * \brief Macro to determine SDL version program was compiled against.
+ *
+ * This macro fills in a SDL_version structure with the version of the
+ * library you compiled against. This is determined by what header the
+ * compiler uses. Note that if you dynamically linked the library, you might
+ * have a slightly newer or older version at runtime. That version can be
+ * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
+ * is not a macro.
+ *
+ * \param x A pointer to a SDL_version struct to initialize.
+ *
+ * \sa SDL_version
+ * \sa SDL_GetVersion
+ */
+#define SDL_VERSION(x) \
+{ \
+ (x)->major = SDL_MAJOR_VERSION; \
+ (x)->minor = SDL_MINOR_VERSION; \
+ (x)->patch = SDL_PATCHLEVEL; \
+}
+
+/**
+ * This macro turns the version numbers into a numeric value:
+ * \verbatim
+ (1,2,3) -> (1203)
+ \endverbatim
+ *
+ * This assumes that there will never be more than 100 patchlevels.
+ */
+#define SDL_VERSIONNUM(X, Y, Z) \
+ ((X)*1000 + (Y)*100 + (Z))
+
+/**
+ * This is the version number macro for the current SDL version.
+ */
+#define SDL_COMPILEDVERSION \
+ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
+
+/**
+ * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
+ */
+#define SDL_VERSION_ATLEAST(X, Y, Z) \
+ (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
+
+/**
+ * \brief Get the version of SDL that is linked against your program.
+ *
+ * If you are linking to SDL dynamically, then it is possible that the
+ * current version will be different than the version you compiled against.
+ * This function returns the current version, while SDL_VERSION() is a
+ * macro that tells you what version you compiled with.
+ *
+ * \code
+ * SDL_version compiled;
+ * SDL_version linked;
+ *
+ * SDL_VERSION(&compiled);
+ * SDL_GetVersion(&linked);
+ * printf("We compiled against SDL version %d.%d.%d ...\n",
+ * compiled.major, compiled.minor, compiled.patch);
+ * printf("But we linked against SDL version %d.%d.%d.\n",
+ * linked.major, linked.minor, linked.patch);
+ * \endcode
+ *
+ * This function may be called safely at any time, even before SDL_Init().
+ *
+ * \sa SDL_VERSION
+ */
+extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
+
+/**
+ * \brief Get the code revision of SDL that is linked against your program.
+ *
+ * Returns an arbitrary string (a hash value) uniquely identifying the
+ * exact revision of the SDL library in use, and is only useful in comparing
+ * against other revisions. It is NOT an incrementing number.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
+
+/**
+ * \brief Get the revision number of SDL that is linked against your program.
+ *
+ * Returns a number uniquely identifying the exact revision of the SDL
+ * library in use. It is an incrementing number based on commits to
+ * hg.libsdl.org.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_version_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_video.h b/src/3rdparty/SDL2/include/SDL2/SDL_video.h
new file mode 100644
index 0000000..83f49fa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_video.h
@@ -0,0 +1,1249 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_video.h
+ *
+ * Header file for SDL video functions.
+ */
+
+#ifndef SDL_video_h_
+#define SDL_video_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_surface.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The structure that defines a display mode
+ *
+ * \sa SDL_GetNumDisplayModes()
+ * \sa SDL_GetDisplayMode()
+ * \sa SDL_GetDesktopDisplayMode()
+ * \sa SDL_GetCurrentDisplayMode()
+ * \sa SDL_GetClosestDisplayMode()
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_GetWindowDisplayMode()
+ */
+typedef struct
+{
+ Uint32 format; /**< pixel format */
+ int w; /**< width, in screen coordinates */
+ int h; /**< height, in screen coordinates */
+ int refresh_rate; /**< refresh rate (or zero for unspecified) */
+ void *driverdata; /**< driver-specific data, initialize to 0 */
+} SDL_DisplayMode;
+
+/**
+ * \brief The type used to identify a window
+ *
+ * \sa SDL_CreateWindow()
+ * \sa SDL_CreateWindowFrom()
+ * \sa SDL_DestroyWindow()
+ * \sa SDL_GetWindowData()
+ * \sa SDL_GetWindowFlags()
+ * \sa SDL_GetWindowGrab()
+ * \sa SDL_GetWindowPosition()
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_GetWindowTitle()
+ * \sa SDL_HideWindow()
+ * \sa SDL_MaximizeWindow()
+ * \sa SDL_MinimizeWindow()
+ * \sa SDL_RaiseWindow()
+ * \sa SDL_RestoreWindow()
+ * \sa SDL_SetWindowData()
+ * \sa SDL_SetWindowFullscreen()
+ * \sa SDL_SetWindowGrab()
+ * \sa SDL_SetWindowIcon()
+ * \sa SDL_SetWindowPosition()
+ * \sa SDL_SetWindowSize()
+ * \sa SDL_SetWindowBordered()
+ * \sa SDL_SetWindowResizable()
+ * \sa SDL_SetWindowTitle()
+ * \sa SDL_ShowWindow()
+ */
+typedef struct SDL_Window SDL_Window;
+
+/**
+ * \brief The flags on a window
+ *
+ * \sa SDL_GetWindowFlags()
+ */
+typedef enum
+{
+ /* !!! FIXME: change this to name = (1<<x). */
+ SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
+ SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
+ SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
+ SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
+ SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
+ SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
+ SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
+ SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
+ SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
+ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
+ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
+ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
+ SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
+ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
+ On macOS NSHighResolutionCapable must be set true in the
+ application's Info.plist for this to have any effect. */
+ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
+ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
+ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
+ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
+ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
+ SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
+} SDL_WindowFlags;
+
+/**
+ * \brief Used to indicate that you don't care what the window position is.
+ */
+#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
+#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
+#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISUNDEFINED(X) \
+ (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
+
+/**
+ * \brief Used to indicate that the window position should be centered.
+ */
+#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
+#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
+#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISCENTERED(X) \
+ (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
+
+/**
+ * \brief Event subtype for window events
+ */
+typedef enum
+{
+ SDL_WINDOWEVENT_NONE, /**< Never used */
+ SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
+ SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
+ SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
+ redrawn */
+ SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
+ */
+ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
+ SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
+ a result of an API call or through the
+ system or user changing the window size. */
+ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
+ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
+ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
+ and position */
+ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
+ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
+ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
+ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
+ SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
+ SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
+ SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
+} SDL_WindowEventID;
+
+/**
+ * \brief An opaque handle to an OpenGL context.
+ */
+typedef void *SDL_GLContext;
+
+/**
+ * \brief OpenGL configuration attributes
+ */
+typedef enum
+{
+ SDL_GL_RED_SIZE,
+ SDL_GL_GREEN_SIZE,
+ SDL_GL_BLUE_SIZE,
+ SDL_GL_ALPHA_SIZE,
+ SDL_GL_BUFFER_SIZE,
+ SDL_GL_DOUBLEBUFFER,
+ SDL_GL_DEPTH_SIZE,
+ SDL_GL_STENCIL_SIZE,
+ SDL_GL_ACCUM_RED_SIZE,
+ SDL_GL_ACCUM_GREEN_SIZE,
+ SDL_GL_ACCUM_BLUE_SIZE,
+ SDL_GL_ACCUM_ALPHA_SIZE,
+ SDL_GL_STEREO,
+ SDL_GL_MULTISAMPLEBUFFERS,
+ SDL_GL_MULTISAMPLESAMPLES,
+ SDL_GL_ACCELERATED_VISUAL,
+ SDL_GL_RETAINED_BACKING,
+ SDL_GL_CONTEXT_MAJOR_VERSION,
+ SDL_GL_CONTEXT_MINOR_VERSION,
+ SDL_GL_CONTEXT_EGL,
+ SDL_GL_CONTEXT_FLAGS,
+ SDL_GL_CONTEXT_PROFILE_MASK,
+ SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
+ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+ SDL_GL_CONTEXT_RESET_NOTIFICATION,
+ SDL_GL_CONTEXT_NO_ERROR
+} SDL_GLattr;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
+ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
+ SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+} SDL_GLprofile;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
+ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
+ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
+ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
+} SDL_GLcontextFlag;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
+} SDL_GLcontextReleaseFlag;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
+} SDL_GLContextResetNotification;
+
+/* Function prototypes */
+
+/**
+ * \brief Get the number of video drivers compiled into SDL
+ *
+ * \sa SDL_GetVideoDriver()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
+
+/**
+ * \brief Get the name of a built in video driver.
+ *
+ * \note The video drivers are presented in the order in which they are
+ * normally checked during initialization.
+ *
+ * \sa SDL_GetNumVideoDrivers()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
+
+/**
+ * \brief Initialize the video subsystem, optionally specifying a video driver.
+ *
+ * \param driver_name Initialize a specific driver by name, or NULL for the
+ * default video driver.
+ *
+ * \return 0 on success, -1 on error
+ *
+ * This function initializes the video subsystem; setting up a connection
+ * to the window manager, etc, and determines the available display modes
+ * and pixel formats, but does not initialize a window or graphics mode.
+ *
+ * \sa SDL_VideoQuit()
+ */
+extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
+
+/**
+ * \brief Shuts down the video subsystem.
+ *
+ * This function closes all windows, and restores the original video mode.
+ *
+ * \sa SDL_VideoInit()
+ */
+extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
+
+/**
+ * \brief Returns the name of the currently initialized video driver.
+ *
+ * \return The name of the current video driver or NULL if no driver
+ * has been initialized
+ *
+ * \sa SDL_GetNumVideoDrivers()
+ * \sa SDL_GetVideoDriver()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
+
+/**
+ * \brief Returns the number of available video displays.
+ *
+ * \sa SDL_GetDisplayBounds()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
+
+/**
+ * \brief Get the name of a display in UTF-8 encoding
+ *
+ * \return The name of a display, or NULL for an invalid display index.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
+
+/**
+ * \brief Get the desktop area represented by a display, with the primary
+ * display located at 0,0
+ *
+ * \return 0 on success, or -1 if the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
+
+/**
+ * \brief Get the dots/pixels-per-inch for a display
+ *
+ * \note Diagonal, horizontal and vertical DPI can all be optionally
+ * returned if the parameter is non-NULL.
+ *
+ * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
+
+/**
+ * \brief Get the usable desktop area represented by a display, with the
+ * primary display located at 0,0
+ *
+ * This is the same area as SDL_GetDisplayBounds() reports, but with portions
+ * reserved by the system removed. For example, on Mac OS X, this subtracts
+ * the area occupied by the menu bar and dock.
+ *
+ * Setting a window to be fullscreen generally bypasses these unusable areas,
+ * so these are good guidelines for the maximum space available to a
+ * non-fullscreen window.
+ *
+ * \return 0 on success, or -1 if the index is out of range.
+ *
+ * \sa SDL_GetDisplayBounds()
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
+
+/**
+ * \brief Returns the number of available display modes.
+ *
+ * \sa SDL_GetDisplayMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
+
+/**
+ * \brief Fill in information about a specific display mode.
+ *
+ * \note The display modes are sorted in this priority:
+ * \li bits per pixel -> more colors to fewer colors
+ * \li width -> largest to smallest
+ * \li height -> largest to smallest
+ * \li refresh rate -> highest to lowest
+ *
+ * \sa SDL_GetNumDisplayModes()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
+ SDL_DisplayMode * mode);
+
+/**
+ * \brief Fill in information about the desktop display mode.
+ */
+extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
+
+/**
+ * \brief Fill in information about the current display mode.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
+
+
+/**
+ * \brief Get the closest match to the requested display mode.
+ *
+ * \param displayIndex The index of display from which mode should be queried.
+ * \param mode The desired display mode
+ * \param closest A pointer to a display mode to be filled in with the closest
+ * match of the available display modes.
+ *
+ * \return The passed in value \c closest, or NULL if no matching video mode
+ * was available.
+ *
+ * The available display modes are scanned, and \c closest is filled in with the
+ * closest mode matching the requested mode and returned. The mode format and
+ * refresh_rate default to the desktop mode if they are 0. The modes are
+ * scanned with size being first priority, format being second priority, and
+ * finally checking the refresh_rate. If all the available modes are too
+ * small, then NULL is returned.
+ *
+ * \sa SDL_GetNumDisplayModes()
+ * \sa SDL_GetDisplayMode()
+ */
+extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
+
+/**
+ * \brief Get the display index associated with a window.
+ *
+ * \return the display index of the display containing the center of the
+ * window, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
+
+/**
+ * \brief Set the display mode used when a fullscreen window is visible.
+ *
+ * By default the window's dimensions and the desktop format and refresh rate
+ * are used.
+ *
+ * \param window The window for which the display mode should be set.
+ * \param mode The mode to use, or NULL for the default mode.
+ *
+ * \return 0 on success, or -1 if setting the display mode failed.
+ *
+ * \sa SDL_GetWindowDisplayMode()
+ * \sa SDL_SetWindowFullscreen()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
+ const SDL_DisplayMode
+ * mode);
+
+/**
+ * \brief Fill in information about the display mode used when a fullscreen
+ * window is visible.
+ *
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_SetWindowFullscreen()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
+ SDL_DisplayMode * mode);
+
+/**
+ * \brief Get the pixel format associated with the window.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
+
+/**
+ * \brief Create a window with the specified position, dimensions, and flags.
+ *
+ * \param title The title of the window, in UTF-8 encoding.
+ * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param w The width of the window, in screen coordinates.
+ * \param h The height of the window, in screen coordinates.
+ * \param flags The flags for the window, a mask of any of the following:
+ * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
+ * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
+ * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
+ * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
+ * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
+ *
+ * \return The created window, or NULL if window creation failed.
+ *
+ * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
+ * in pixels may differ from its size in screen coordinates on platforms with
+ * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
+ * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ * drawable size in pixels.
+ *
+ * If the window is created with any of the SDL_WINDOW_OPENGL or
+ * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
+ *
+ * \note On non-Apple devices, SDL requires you to either not link to the
+ * Vulkan loader or link to a dynamic library version. This limitation
+ * may be removed in a future version of SDL.
+ *
+ * \sa SDL_DestroyWindow()
+ * \sa SDL_GL_LoadLibrary()
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
+ int x, int y, int w,
+ int h, Uint32 flags);
+
+/**
+ * \brief Create an SDL window from an existing native window.
+ *
+ * \param data A pointer to driver-dependent window creation data
+ *
+ * \return The created window, or NULL if window creation failed.
+ *
+ * \sa SDL_DestroyWindow()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
+
+/**
+ * \brief Get the numeric ID of a window, for logging purposes.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
+
+/**
+ * \brief Get a window from a stored ID, or NULL if it doesn't exist.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
+
+/**
+ * \brief Get the window flags.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
+
+/**
+ * \brief Set the title of a window, in UTF-8 format.
+ *
+ * \sa SDL_GetWindowTitle()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
+ const char *title);
+
+/**
+ * \brief Get the title of a window, in UTF-8 format.
+ *
+ * \sa SDL_SetWindowTitle()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
+
+/**
+ * \brief Set the icon for a window.
+ *
+ * \param window The window for which the icon should be set.
+ * \param icon The icon for the window.
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
+ SDL_Surface * icon);
+
+/**
+ * \brief Associate an arbitrary named pointer with a window.
+ *
+ * \param window The window to associate with the pointer.
+ * \param name The name of the pointer.
+ * \param userdata The associated pointer.
+ *
+ * \return The previous value associated with 'name'
+ *
+ * \note The name is case-sensitive.
+ *
+ * \sa SDL_GetWindowData()
+ */
+extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
+ const char *name,
+ void *userdata);
+
+/**
+ * \brief Retrieve the data pointer associated with a window.
+ *
+ * \param window The window to query.
+ * \param name The name of the pointer.
+ *
+ * \return The value associated with 'name'
+ *
+ * \sa SDL_SetWindowData()
+ */
+extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
+ const char *name);
+
+/**
+ * \brief Set the position of a window.
+ *
+ * \param window The window to reposition.
+ * \param x The x coordinate of the window in screen coordinates, or
+ * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y coordinate of the window in screen coordinates, or
+ * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
+ *
+ * \note The window coordinate origin is the upper left of the display.
+ *
+ * \sa SDL_GetWindowPosition()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
+ int x, int y);
+
+/**
+ * \brief Get the position of a window.
+ *
+ * \param window The window to query.
+ * \param x Pointer to variable for storing the x position, in screen
+ * coordinates. May be NULL.
+ * \param y Pointer to variable for storing the y position, in screen
+ * coordinates. May be NULL.
+ *
+ * \sa SDL_SetWindowPosition()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
+ int *x, int *y);
+
+/**
+ * \brief Set the size of a window's client area.
+ *
+ * \param window The window to resize.
+ * \param w The width of the window, in screen coordinates. Must be >0.
+ * \param h The height of the window, in screen coordinates. Must be >0.
+ *
+ * \note Fullscreen windows automatically match the size of the display mode,
+ * and you should use SDL_SetWindowDisplayMode() to change their size.
+ *
+ * The window size in screen coordinates may differ from the size in pixels, if
+ * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
+ * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
+ * SDL_GetRendererOutputSize() to get the real client area size in pixels.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_SetWindowDisplayMode()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
+ int h);
+
+/**
+ * \brief Get the size of a window's client area.
+ *
+ * \param window The window to query.
+ * \param w Pointer to variable for storing the width, in screen
+ * coordinates. May be NULL.
+ * \param h Pointer to variable for storing the height, in screen
+ * coordinates. May be NULL.
+ *
+ * The window size in screen coordinates may differ from the size in pixels, if
+ * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
+ * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
+ * SDL_GetRendererOutputSize() to get the real client area size in pixels.
+ *
+ * \sa SDL_SetWindowSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
+ int *h);
+
+/**
+ * \brief Get the size of a window's borders (decorations) around the client area.
+ *
+ * \param window The window to query.
+ * \param top Pointer to variable for storing the size of the top border. NULL is permitted.
+ * \param left Pointer to variable for storing the size of the left border. NULL is permitted.
+ * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted.
+ * \param right Pointer to variable for storing the size of the right border. NULL is permitted.
+ *
+ * \return 0 on success, or -1 if getting this information is not supported.
+ *
+ * \note if this function fails (returns -1), the size values will be
+ * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as
+ * if the window in question was borderless.
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
+ int *top, int *left,
+ int *bottom, int *right);
+
+/**
+ * \brief Set the minimum size of a window's client area.
+ *
+ * \param window The window to set a new minimum size.
+ * \param min_w The minimum width of the window, must be >0
+ * \param min_h The minimum height of the window, must be >0
+ *
+ * \note You can't change the minimum size of a fullscreen window, it
+ * automatically matches the size of the display mode.
+ *
+ * \sa SDL_GetWindowMinimumSize()
+ * \sa SDL_SetWindowMaximumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
+ int min_w, int min_h);
+
+/**
+ * \brief Get the minimum size of a window's client area.
+ *
+ * \param window The window to query.
+ * \param w Pointer to variable for storing the minimum width, may be NULL
+ * \param h Pointer to variable for storing the minimum height, may be NULL
+ *
+ * \sa SDL_GetWindowMaximumSize()
+ * \sa SDL_SetWindowMinimumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
+ int *w, int *h);
+
+/**
+ * \brief Set the maximum size of a window's client area.
+ *
+ * \param window The window to set a new maximum size.
+ * \param max_w The maximum width of the window, must be >0
+ * \param max_h The maximum height of the window, must be >0
+ *
+ * \note You can't change the maximum size of a fullscreen window, it
+ * automatically matches the size of the display mode.
+ *
+ * \sa SDL_GetWindowMaximumSize()
+ * \sa SDL_SetWindowMinimumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
+ int max_w, int max_h);
+
+/**
+ * \brief Get the maximum size of a window's client area.
+ *
+ * \param window The window to query.
+ * \param w Pointer to variable for storing the maximum width, may be NULL
+ * \param h Pointer to variable for storing the maximum height, may be NULL
+ *
+ * \sa SDL_GetWindowMinimumSize()
+ * \sa SDL_SetWindowMaximumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
+ int *w, int *h);
+
+/**
+ * \brief Set the border state of a window.
+ *
+ * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
+ * add or remove the border from the actual window. This is a no-op if the
+ * window's border already matches the requested state.
+ *
+ * \param window The window of which to change the border state.
+ * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
+ *
+ * \note You can't change the border state of a fullscreen window.
+ *
+ * \sa SDL_GetWindowFlags()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
+ SDL_bool bordered);
+
+/**
+ * \brief Set the user-resizable state of a window.
+ *
+ * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and
+ * allow/disallow user resizing of the window. This is a no-op if the
+ * window's resizable state already matches the requested state.
+ *
+ * \param window The window of which to change the resizable state.
+ * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.
+ *
+ * \note You can't change the resizable state of a fullscreen window.
+ *
+ * \sa SDL_GetWindowFlags()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
+ SDL_bool resizable);
+
+/**
+ * \brief Show a window.
+ *
+ * \sa SDL_HideWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
+
+/**
+ * \brief Hide a window.
+ *
+ * \sa SDL_ShowWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
+
+/**
+ * \brief Raise a window above other windows and set the input focus.
+ */
+extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
+
+/**
+ * \brief Make a window as large as possible.
+ *
+ * \sa SDL_RestoreWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
+
+/**
+ * \brief Minimize a window to an iconic representation.
+ *
+ * \sa SDL_RestoreWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
+
+/**
+ * \brief Restore the size and position of a minimized or maximized window.
+ *
+ * \sa SDL_MaximizeWindow()
+ * \sa SDL_MinimizeWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
+
+/**
+ * \brief Set a window's fullscreen state.
+ *
+ * \return 0 on success, or -1 if setting the display mode failed.
+ *
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_GetWindowDisplayMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
+ Uint32 flags);
+
+/**
+ * \brief Get the SDL surface associated with the window.
+ *
+ * \return The window's framebuffer surface, or NULL on error.
+ *
+ * A new surface will be created with the optimal format for the window,
+ * if necessary. This surface will be freed when the window is destroyed.
+ *
+ * \note You may not combine this with 3D or the rendering API on this window.
+ *
+ * \sa SDL_UpdateWindowSurface()
+ * \sa SDL_UpdateWindowSurfaceRects()
+ */
+extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
+
+/**
+ * \brief Copy the window surface to the screen.
+ *
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_GetWindowSurface()
+ * \sa SDL_UpdateWindowSurfaceRects()
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
+
+/**
+ * \brief Copy a number of rectangles on the window surface to the screen.
+ *
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_GetWindowSurface()
+ * \sa SDL_UpdateWindowSurface()
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
+ const SDL_Rect * rects,
+ int numrects);
+
+/**
+ * \brief Set a window's input grab mode.
+ *
+ * \param window The window for which the input grab mode should be set.
+ * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
+ *
+ * If the caller enables a grab while another window is currently grabbed,
+ * the other window loses its grab in favor of the caller's window.
+ *
+ * \sa SDL_GetWindowGrab()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
+ SDL_bool grabbed);
+
+/**
+ * \brief Get a window's input grab mode.
+ *
+ * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
+ *
+ * \sa SDL_SetWindowGrab()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
+
+/**
+ * \brief Get the window that currently has an input grab enabled.
+ *
+ * \return This returns the window if input is grabbed, and NULL otherwise.
+ *
+ * \sa SDL_SetWindowGrab()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
+
+/**
+ * \brief Set the brightness (gamma correction) for a window.
+ *
+ * \return 0 on success, or -1 if setting the brightness isn't supported.
+ *
+ * \sa SDL_GetWindowBrightness()
+ * \sa SDL_SetWindowGammaRamp()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
+
+/**
+ * \brief Get the brightness (gamma correction) for a window.
+ *
+ * \return The last brightness value passed to SDL_SetWindowBrightness()
+ *
+ * \sa SDL_SetWindowBrightness()
+ */
+extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
+
+/**
+ * \brief Set the opacity for a window
+ *
+ * \param window The window which will be made transparent or opaque
+ * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
+ * clamped internally between 0.0f and 1.0f.
+ *
+ * \return 0 on success, or -1 if setting the opacity isn't supported.
+ *
+ * \sa SDL_GetWindowOpacity()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
+
+/**
+ * \brief Get the opacity of a window.
+ *
+ * If transparency isn't supported on this platform, opacity will be reported
+ * as 1.0f without error.
+ *
+ * \param window The window in question.
+ * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)
+ *
+ * \return 0 on success, or -1 on error (invalid window, etc).
+ *
+ * \sa SDL_SetWindowOpacity()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
+
+/**
+ * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
+ *
+ * \param modal_window The window that should be modal
+ * \param parent_window The parent window
+ *
+ * \return 0 on success, or -1 otherwise.
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
+
+/**
+ * \brief Explicitly sets input focus to the window.
+ *
+ * You almost certainly want SDL_RaiseWindow() instead of this function. Use
+ * this with caution, as you might give focus to a window that's completely
+ * obscured by other windows.
+ *
+ * \param window The window that should get the input focus
+ *
+ * \return 0 on success, or -1 otherwise.
+ * \sa SDL_RaiseWindow()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
+
+/**
+ * \brief Set the gamma ramp for a window.
+ *
+ * \param window The window for which the gamma ramp should be set.
+ * \param red The translation table for the red channel, or NULL.
+ * \param green The translation table for the green channel, or NULL.
+ * \param blue The translation table for the blue channel, or NULL.
+ *
+ * \return 0 on success, or -1 if gamma ramps are unsupported.
+ *
+ * Set the gamma translation table for the red, green, and blue channels
+ * of the video hardware. Each table is an array of 256 16-bit quantities,
+ * representing a mapping between the input and output for that channel.
+ * The input is the index into the array, and the output is the 16-bit
+ * gamma value at that index, scaled to the output color precision.
+ *
+ * \sa SDL_GetWindowGammaRamp()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
+ const Uint16 * red,
+ const Uint16 * green,
+ const Uint16 * blue);
+
+/**
+ * \brief Get the gamma ramp for a window.
+ *
+ * \param window The window from which the gamma ramp should be queried.
+ * \param red A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the red channel, or NULL.
+ * \param green A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the green channel, or NULL.
+ * \param blue A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the blue channel, or NULL.
+ *
+ * \return 0 on success, or -1 if gamma ramps are unsupported.
+ *
+ * \sa SDL_SetWindowGammaRamp()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
+ Uint16 * red,
+ Uint16 * green,
+ Uint16 * blue);
+
+/**
+ * \brief Possible return values from the SDL_HitTest callback.
+ *
+ * \sa SDL_HitTest
+ */
+typedef enum
+{
+ SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
+ SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
+ SDL_HITTEST_RESIZE_TOPLEFT,
+ SDL_HITTEST_RESIZE_TOP,
+ SDL_HITTEST_RESIZE_TOPRIGHT,
+ SDL_HITTEST_RESIZE_RIGHT,
+ SDL_HITTEST_RESIZE_BOTTOMRIGHT,
+ SDL_HITTEST_RESIZE_BOTTOM,
+ SDL_HITTEST_RESIZE_BOTTOMLEFT,
+ SDL_HITTEST_RESIZE_LEFT
+} SDL_HitTestResult;
+
+/**
+ * \brief Callback used for hit-testing.
+ *
+ * \sa SDL_SetWindowHitTest
+ */
+typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
+ const SDL_Point *area,
+ void *data);
+
+/**
+ * \brief Provide a callback that decides if a window region has special properties.
+ *
+ * Normally windows are dragged and resized by decorations provided by the
+ * system window manager (a title bar, borders, etc), but for some apps, it
+ * makes sense to drag them from somewhere else inside the window itself; for
+ * example, one might have a borderless window that wants to be draggable
+ * from any part, or simulate its own title bar, etc.
+ *
+ * This function lets the app provide a callback that designates pieces of
+ * a given window as special. This callback is run during event processing
+ * if we need to tell the OS to treat a region of the window specially; the
+ * use of this callback is known as "hit testing."
+ *
+ * Mouse input may not be delivered to your application if it is within
+ * a special area; the OS will often apply that input to moving the window or
+ * resizing the window and not deliver it to the application.
+ *
+ * Specifying NULL for a callback disables hit-testing. Hit-testing is
+ * disabled by default.
+ *
+ * Platforms that don't support this functionality will return -1
+ * unconditionally, even if you're attempting to disable hit-testing.
+ *
+ * Your callback may fire at any time, and its firing does not indicate any
+ * specific behavior (for example, on Windows, this certainly might fire
+ * when the OS is deciding whether to drag your window, but it fires for lots
+ * of other reasons, too, some unrelated to anything you probably care about
+ * _and when the mouse isn't actually at the location it is testing_).
+ * Since this can fire at any time, you should try to keep your callback
+ * efficient, devoid of allocations, etc.
+ *
+ * \param window The window to set hit-testing on.
+ * \param callback The callback to call when doing a hit-test.
+ * \param callback_data An app-defined void pointer passed to the callback.
+ * \return 0 on success, -1 on error (including unsupported).
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
+ SDL_HitTest callback,
+ void *callback_data);
+
+/**
+ * \brief Destroy a window.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
+
+
+/**
+ * \brief Returns whether the screensaver is currently enabled (default off).
+ *
+ * \sa SDL_EnableScreenSaver()
+ * \sa SDL_DisableScreenSaver()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
+
+/**
+ * \brief Allow the screen to be blanked by a screensaver
+ *
+ * \sa SDL_IsScreenSaverEnabled()
+ * \sa SDL_DisableScreenSaver()
+ */
+extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
+
+/**
+ * \brief Prevent the screen from being blanked by a screensaver
+ *
+ * \sa SDL_IsScreenSaverEnabled()
+ * \sa SDL_EnableScreenSaver()
+ */
+extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
+
+
+/**
+ * \name OpenGL support functions
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load an OpenGL library.
+ *
+ * \param path The platform dependent OpenGL library name, or NULL to open the
+ * default OpenGL library.
+ *
+ * \return 0 on success, or -1 if the library couldn't be loaded.
+ *
+ * This should be done after initializing the video driver, but before
+ * creating any OpenGL windows. If no OpenGL library is loaded, the default
+ * library will be loaded upon creation of the first OpenGL window.
+ *
+ * \note If you do this, you need to retrieve all of the GL functions used in
+ * your program from the dynamic library using SDL_GL_GetProcAddress().
+ *
+ * \sa SDL_GL_GetProcAddress()
+ * \sa SDL_GL_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of an OpenGL function.
+ */
+extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
+
+/**
+ * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
+ *
+ * \sa SDL_GL_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
+
+/**
+ * \brief Return true if an OpenGL extension is supported for the current
+ * context.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
+ *extension);
+
+/**
+ * \brief Reset all previously set OpenGL context attributes to their default values
+ */
+extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
+
+/**
+ * \brief Set an OpenGL window attribute before window creation.
+ *
+ * \return 0 on success, or -1 if the attribute could not be set.
+ */
+extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
+
+/**
+ * \brief Get the actual value for an attribute from the current context.
+ *
+ * \return 0 on success, or -1 if the attribute could not be retrieved.
+ * The integer at \c value will be modified in either case.
+ */
+extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
+
+/**
+ * \brief Create an OpenGL context for use with an OpenGL window, and make it
+ * current.
+ *
+ * \sa SDL_GL_DeleteContext()
+ */
+extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
+ window);
+
+/**
+ * \brief Set up an OpenGL context for rendering into an OpenGL window.
+ *
+ * \note The context must have been created with a compatible window.
+ */
+extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
+ SDL_GLContext context);
+
+/**
+ * \brief Get the currently active OpenGL window.
+ */
+extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
+
+/**
+ * \brief Get the currently active OpenGL context.
+ */
+extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with glViewport).
+ *
+ * \param window Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels, may be NULL
+ * \param h Pointer to variable for storing the height in pixels, may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
+ int *h);
+
+/**
+ * \brief Set the swap interval for the current OpenGL context.
+ *
+ * \param interval 0 for immediate updates, 1 for updates synchronized with the
+ * vertical retrace. If the system supports it, you may
+ * specify -1 to allow late swaps to happen immediately
+ * instead of waiting for the next retrace.
+ *
+ * \return 0 on success, or -1 if setting the swap interval is not supported.
+ *
+ * \sa SDL_GL_GetSwapInterval()
+ */
+extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
+
+/**
+ * \brief Get the swap interval for the current OpenGL context.
+ *
+ * \return 0 if there is no vertical retrace synchronization, 1 if the buffer
+ * swap is synchronized with the vertical retrace, and -1 if late
+ * swaps happen immediately instead of waiting for the next retrace.
+ * If the system can't determine the swap interval, or there isn't a
+ * valid current context, this will return 0 as a safe default.
+ *
+ * \sa SDL_GL_SetSwapInterval()
+ */
+extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
+
+/**
+ * \brief Swap the OpenGL buffers for a window, if double-buffering is
+ * supported.
+ */
+extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
+
+/**
+ * \brief Delete an OpenGL context.
+ *
+ * \sa SDL_GL_CreateContext()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
+
+/* @} *//* OpenGL support functions */
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_video_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL2/SDL_vulkan.h b/src/3rdparty/SDL2/include/SDL2/SDL_vulkan.h
new file mode 100644
index 0000000..f04c21a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/SDL_vulkan.h
@@ -0,0 +1,273 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017, Mark Callow
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_vulkan.h
+ *
+ * Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ * \name Vulkan support functions
+ *
+ * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ * is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load a Vulkan loader library.
+ *
+ * \param [in] path The platform dependent Vulkan loader library name, or
+ * \c NULL.
+ *
+ * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ * If \a path is NULL SDL will use the value of the environment variable
+ * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan
+ * loader library.
+ *
+ * This should be called after initializing the video driver, but before
+ * creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ * default library will be loaded upon creation of the first Vulkan window.
+ *
+ * \note It is fairly common for Vulkan applications to link with \a libvulkan
+ * instead of explicitly loading it at run time. This will work with
+ * SDL provided the application links to a dynamic library and both it
+ * and SDL use the same search path.
+ *
+ * \note If you specify a non-NULL \c path, an application should retrieve all
+ * of the Vulkan functions it uses from the dynamic library using
+ * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ * \c path points to the same vulkan loader library the application
+ * linked to.
+ *
+ * \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ * the vkGetInstanceProcAddr address within all the mach-o images of
+ * the current process. This is because it is fairly common for Vulkan
+ * applications to link with libvulkan (and historically MoltenVK was
+ * provided as a static library). If it is not found then, on macOS, SDL
+ * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
+ * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order.
+ * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications
+ * using a dynamic framework or .dylib must ensure it is included in its
+ * application bundle.
+ *
+ * \note On non-Apple devices, application linking with a static libvulkan is
+ * not supported. Either do not link to the Vulkan loader or link to a
+ * dynamic library version.
+ *
+ * \note This function will fail if there are no working Vulkan drivers
+ * installed.
+ *
+ * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ * \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ * \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ * \brief Unload the Vulkan loader library previously loaded by
+ * \c SDL_Vulkan_LoadLibrary().
+ *
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ * \brief Get the names of the Vulkan instance extensions needed to create
+ * a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ * \param [in] window Window for which the required Vulkan instance
+ * extensions should be retrieved
+ * \param [in,out] count pointer to an \c unsigned related to the number of
+ * required Vulkan instance extensions
+ * \param [out] names \c NULL or a pointer to an array to be filled with the
+ * required Vulkan instance extensions
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * If \a pNames is \c NULL, then the number of required Vulkan instance
+ * extensions is returned in pCount. Otherwise, \a pCount must point to a
+ * variable set to the number of elements in the \a pNames array, and on
+ * return the variable is overwritten with the number of names actually
+ * written to \a pNames. If \a pCount is less than the number of required
+ * extensions, at most \a pCount structures will be written. If \a pCount
+ * is smaller than the number of required extensions, \c SDL_FALSE will be
+ * returned instead of \c SDL_TRUE, to indicate that not all the required
+ * extensions were returned.
+ *
+ * \note The returned list of extensions will contain \c VK_KHR_surface
+ * and zero or more platform specific extensions
+ *
+ * \note The extension names queried here must be enabled when calling
+ * VkCreateInstance, otherwise surface creation will fail.
+ *
+ * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \code
+ * unsigned int count;
+ * // get count of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL))
+ * handle_error();
+ *
+ * static const char *const additionalExtensions[] =
+ * {
+ * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ * };
+ * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ * size_t extensionCount = count + additionalExtensionsCount;
+ * const char **names = malloc(sizeof(const char *) * extensionCount);
+ * if(!names)
+ * handle_error();
+ *
+ * // get names of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names))
+ * handle_error();
+ *
+ * // copy additional extensions after required extensions
+ * for(size_t i = 0; i < additionalExtensionsCount; i++)
+ * names[i + count] = additionalExtensions[i];
+ *
+ * VkInstanceCreateInfo instanceCreateInfo = {};
+ * instanceCreateInfo.enabledExtensionCount = extensionCount;
+ * instanceCreateInfo.ppEnabledExtensionNames = names;
+ * // fill in rest of instanceCreateInfo
+ *
+ * VkInstance instance;
+ * // create the Vulkan instance
+ * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ * free(names);
+ * \endcode
+ *
+ * \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+ SDL_Window *window,
+ unsigned int *pCount,
+ const char **pNames);
+
+/**
+ * \brief Create a Vulkan rendering surface for a window.
+ *
+ * \param [in] window SDL_Window to which to attach the rendering surface.
+ * \param [in] instance handle to the Vulkan instance to use.
+ * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
+ * handle of the newly created surface.
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * \code
+ * VkInstance instance;
+ * SDL_Window *window;
+ *
+ * // create instance and window
+ *
+ * // create the Vulkan surface
+ * VkSurfaceKHR surface;
+ * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ * handle_error();
+ * \endcode
+ *
+ * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \note \a instance should have been created with the extensions returned
+ * by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ * \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR* surface);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with setting viewport, scissor & etc).
+ *
+ * \param window SDL_Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels,
+ * may be NULL
+ * \param h Pointer to variable for storing the height in pixels,
+ * may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \note On macOS high-DPI support must be enabled for an application by
+ * setting NSHighResolutionCapable to true in its Info.plist.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+ int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL2/begin_code.h b/src/3rdparty/SDL2/include/SDL2/begin_code.h
new file mode 100644
index 0000000..6c21062
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/begin_code.h
@@ -0,0 +1,167 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file begin_code.h
+ *
+ * This file sets things up for C dynamic library function definitions,
+ * static inlined functions, and structures aligned at 4-byte alignment.
+ * If you don't like ugly C preprocessor code, don't look at this file. :)
+ */
+
+/* This shouldn't be nested -- included it around code only. */
+#ifdef _begin_code_h
+#error Nested inclusion of begin_code.h
+#endif
+#define _begin_code_h
+
+#ifndef SDL_DEPRECATED
+# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
+# define SDL_DEPRECATED __attribute__((deprecated))
+# else
+# define SDL_DEPRECATED
+# endif
+#endif
+
+#ifndef SDL_UNUSED
+# ifdef __GNUC__
+# define SDL_UNUSED __attribute__((unused))
+# else
+# define SDL_UNUSED
+# endif
+#endif
+
+/* Some compilers use a special export keyword */
+#ifndef DECLSPEC
+# if defined(__WIN32__) || defined(__WINRT__)
+# ifdef __BORLANDC__
+# ifdef BUILD_SDL
+# define DECLSPEC
+# else
+# define DECLSPEC __declspec(dllimport)
+# endif
+# else
+# define DECLSPEC __declspec(dllexport)
+# endif
+# elif defined(__OS2__)
+# ifdef BUILD_SDL
+# define DECLSPEC __declspec(dllexport)
+# else
+# define DECLSPEC
+# endif
+# else
+# if defined(__GNUC__) && __GNUC__ >= 4
+# define DECLSPEC __attribute__ ((visibility("default")))
+# else
+# define DECLSPEC
+# endif
+# endif
+#endif
+
+/* By default SDL uses the C calling convention */
+#ifndef SDLCALL
+#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
+#define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+# define _System /* for old EMX/GCC compat. */
+# endif
+#else
+#define SDLCALL
+#endif
+#endif /* SDLCALL */
+
+/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
+#ifdef __SYMBIAN32__
+#undef DECLSPEC
+#define DECLSPEC
+#endif /* __SYMBIAN32__ */
+
+/* Force structure packing at 4 byte alignment.
+ This is necessary if the header is included in code which has structure
+ packing set to an alternate value, say for loading structures from disk.
+ The packing is reset to the previous value in close_code.h
+ */
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
+#ifdef _MSC_VER
+#pragma warning(disable: 4103)
+#endif
+#ifdef __BORLANDC__
+#pragma nopackwarning
+#endif
+#ifdef _M_X64
+/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
+#pragma pack(push,8)
+#else
+#pragma pack(push,4)
+#endif
+#endif /* Compiler needs structure packing set */
+
+#ifndef SDL_INLINE
+#if defined(__GNUC__)
+#define SDL_INLINE __inline__
+#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
+ defined(__DMC__) || defined(__SC__) || \
+ defined(__WATCOMC__) || defined(__LCC__) || \
+ defined(__DECC) || defined(__CC_ARM)
+#define SDL_INLINE __inline
+#ifndef __inline__
+#define __inline__ __inline
+#endif
+#else
+#define SDL_INLINE inline
+#ifndef __inline__
+#define __inline__ inline
+#endif
+#endif
+#endif /* SDL_INLINE not defined */
+
+#ifndef SDL_FORCE_INLINE
+#if defined(_MSC_VER)
+#define SDL_FORCE_INLINE __forceinline
+#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
+#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
+#else
+#define SDL_FORCE_INLINE static SDL_INLINE
+#endif
+#endif /* SDL_FORCE_INLINE not defined */
+
+#ifndef SDL_NORETURN
+#if defined(__GNUC__)
+#define SDL_NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define SDL_NORETURN __declspec(noreturn)
+#else
+#define SDL_NORETURN
+#endif
+#endif /* SDL_NORETURN not defined */
+
+/* Apparently this is needed by several Windows compilers */
+#if !defined(__MACH__)
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif /* NULL */
+#endif /* ! Mac OS X - breaks precompiled headers */
diff --git a/src/3rdparty/SDL2/include/SDL2/close_code.h b/src/3rdparty/SDL2/include/SDL2/close_code.h
new file mode 100644
index 0000000..b3b70a4
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL2/close_code.h
@@ -0,0 +1,37 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file close_code.h
+ *
+ * This file reverses the effects of begin_code.h and should be included
+ * after you finish any function and structure declarations in your headers
+ */
+
+#undef _begin_code_h
+
+/* Reset structure packing at previous byte alignment */
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
+#ifdef __BORLANDC__
+#pragma nopackwarning
+#endif
+#pragma pack(pop)
+#endif /* Compiler needs structure packing set */
diff --git a/src/3rdparty/SDL2/include/SDL_assert.h b/src/3rdparty/SDL2/include/SDL_assert.h
new file mode 100644
index 0000000..b38f928
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_assert.h
@@ -0,0 +1,291 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
+
+#include "SDL_config.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SDL_ASSERT_LEVEL
+#ifdef SDL_DEFAULT_ASSERT_LEVEL
+#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
+#elif defined(_DEBUG) || defined(DEBUG) || \
+ (defined(__GNUC__) && !defined(__OPTIMIZE__))
+#define SDL_ASSERT_LEVEL 2
+#else
+#define SDL_ASSERT_LEVEL 1
+#endif
+#endif /* SDL_ASSERT_LEVEL */
+
+/*
+These are macros and not first class functions so that the debugger breaks
+on the assertion line and not in some random guts of SDL, and so each
+assert can have unique static variables associated with it.
+*/
+
+#if defined(_MSC_VER)
+/* Don't include intrin.h here because it contains C++ code */
+ extern void __cdecl __debugbreak(void);
+ #define SDL_TriggerBreakpoint() __debugbreak()
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
+ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
+#elif defined(__386__) && defined(__WATCOMC__)
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
+ #include <signal.h>
+ #define SDL_TriggerBreakpoint() raise(SIGTRAP)
+#else
+ /* How do we trigger breakpoints on this platform? */
+ #define SDL_TriggerBreakpoint()
+#endif
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
+# define SDL_FUNCTION __func__
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
+# define SDL_FUNCTION __FUNCTION__
+#else
+# define SDL_FUNCTION "???"
+#endif
+#define SDL_FILE __FILE__
+#define SDL_LINE __LINE__
+
+/*
+sizeof (x) makes the compiler still parse the expression even without
+assertions enabled, so the code is always checked at compile time, but
+doesn't actually generate code for it, so there are no side effects or
+expensive checks at run time, just the constant size of what x WOULD be,
+which presumably gets optimized out as unused.
+This also solves the problem of...
+
+ int somevalue = blah();
+ SDL_assert(somevalue == 1);
+
+...which would cause compiles to complain that somevalue is unused if we
+disable assertions.
+*/
+
+/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
+ this condition isn't constant. And looks like an owl's face! */
+#ifdef _MSC_VER /* stupid /W4 warnings. */
+#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
+#else
+#define SDL_NULL_WHILE_LOOP_CONDITION (0)
+#endif
+
+#define SDL_disabled_assert(condition) \
+ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
+
+typedef enum
+{
+ SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
+ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
+ SDL_ASSERTION_ABORT, /**< Terminate the program. */
+ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
+ SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
+} SDL_AssertState;
+
+typedef struct SDL_AssertData
+{
+ int always_ignore;
+ unsigned int trigger_count;
+ const char *condition;
+ const char *filename;
+ int linenum;
+ const char *function;
+ const struct SDL_AssertData *next;
+} SDL_AssertData;
+
+#if (SDL_ASSERT_LEVEL > 0)
+
+/* Never call this directly. Use the SDL_assert* macros. */
+extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
+ const char *,
+ const char *, int)
+#if defined(__clang__)
+#if __has_feature(attribute_analyzer_noreturn)
+/* this tells Clang's static analysis that we're a custom assert function,
+ and that the analyzer should assume the condition was always true past this
+ SDL_assert test. */
+ __attribute__((analyzer_noreturn))
+#endif
+#endif
+;
+
+/* the do {} while(0) avoids dangling else problems:
+ if (x) SDL_assert(y); else blah();
+ ... without the do/while, the "else" could attach to this macro's "if".
+ We try to handle just the minimum we need here in a macro...the loop,
+ the static vars, and break points. The heavy lifting is handled in
+ SDL_ReportAssertion(), in SDL_assert.c.
+*/
+#define SDL_enabled_assert(condition) \
+ do { \
+ while ( !(condition) ) { \
+ static struct SDL_AssertData sdl_assert_data = { \
+ 0, 0, #condition, 0, 0, 0, 0 \
+ }; \
+ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
+ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
+ continue; /* go again. */ \
+ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
+ SDL_TriggerBreakpoint(); \
+ } \
+ break; /* not retrying. */ \
+ } \
+ } while (SDL_NULL_WHILE_LOOP_CONDITION)
+
+#endif /* enabled assertions support code */
+
+/* Enable various levels of assertions. */
+#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
+# define SDL_assert(condition) SDL_disabled_assert(condition)
+# define SDL_assert_release(condition) SDL_disabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
+# define SDL_assert(condition) SDL_disabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
+# define SDL_assert(condition) SDL_enabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
+# define SDL_assert(condition) SDL_enabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
+#else
+# error Unknown assertion level.
+#endif
+
+/* this assertion is never disabled at any level. */
+#define SDL_assert_always(condition) SDL_enabled_assert(condition)
+
+
+typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
+ const SDL_AssertData* data, void* userdata);
+
+/**
+ * \brief Set an application-defined assertion handler.
+ *
+ * This allows an app to show its own assertion UI and/or force the
+ * response to an assertion failure. If the app doesn't provide this, SDL
+ * will try to do the right thing, popping up a system-specific GUI dialog,
+ * and probably minimizing any fullscreen windows.
+ *
+ * This callback may fire from any thread, but it runs wrapped in a mutex, so
+ * it will only fire from one thread at a time.
+ *
+ * Setting the callback to NULL restores SDL's original internal handler.
+ *
+ * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
+ *
+ * Return SDL_AssertState value of how to handle the assertion failure.
+ *
+ * \param handler Callback function, called when an assertion fails.
+ * \param userdata A pointer passed to the callback as-is.
+ */
+extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
+ SDL_AssertionHandler handler,
+ void *userdata);
+
+/**
+ * \brief Get the default assertion handler.
+ *
+ * This returns the function pointer that is called by default when an
+ * assertion is triggered. This is an internal function provided by SDL,
+ * that is used for assertions when SDL_SetAssertionHandler() hasn't been
+ * used to provide a different function.
+ *
+ * \return The default SDL_AssertionHandler that is called when an assert triggers.
+ */
+extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
+
+/**
+ * \brief Get the current assertion handler.
+ *
+ * This returns the function pointer that is called when an assertion is
+ * triggered. This is either the value last passed to
+ * SDL_SetAssertionHandler(), or if no application-specified function is
+ * set, is equivalent to calling SDL_GetDefaultAssertionHandler().
+ *
+ * \param puserdata Pointer to a void*, which will store the "userdata"
+ * pointer that was passed to SDL_SetAssertionHandler().
+ * This value will always be NULL for the default handler.
+ * If you don't care about this data, it is safe to pass
+ * a NULL pointer to this function to ignore it.
+ * \return The SDL_AssertionHandler that is called when an assert triggers.
+ */
+extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
+
+/**
+ * \brief Get a list of all assertion failures.
+ *
+ * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
+ * or the start of the program.
+ *
+ * The proper way to examine this data looks something like this:
+ *
+ * <code>
+ * const SDL_AssertData *item = SDL_GetAssertionReport();
+ * while (item) {
+ * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
+ * item->condition, item->function, item->filename,
+ * item->linenum, item->trigger_count,
+ * item->always_ignore ? "yes" : "no");
+ * item = item->next;
+ * }
+ * </code>
+ *
+ * \return List of all assertions.
+ * \sa SDL_ResetAssertionReport
+ */
+extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
+
+/**
+ * \brief Reset the list of all assertion failures.
+ *
+ * Reset list of all assertions triggered.
+ *
+ * \sa SDL_GetAssertionReport
+ */
+extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
+
+
+/* these had wrong naming conventions until 2.0.4. Please update your app! */
+#define SDL_assert_state SDL_AssertState
+#define SDL_assert_data SDL_AssertData
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_assert_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_atomic.h b/src/3rdparty/SDL2/include/SDL_atomic.h
new file mode 100644
index 0000000..b228774
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_atomic.h
@@ -0,0 +1,277 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_atomic.h
+ *
+ * Atomic operations.
+ *
+ * IMPORTANT:
+ * If you are not an expert in concurrent lockless programming, you should
+ * only be using the atomic lock and reference counting functions in this
+ * file. In all other cases you should be protecting your data structures
+ * with full mutexes.
+ *
+ * The list of "safe" functions to use are:
+ * SDL_AtomicLock()
+ * SDL_AtomicUnlock()
+ * SDL_AtomicIncRef()
+ * SDL_AtomicDecRef()
+ *
+ * Seriously, here be dragons!
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * You can find out a little more about lockless programming and the
+ * subtle issues that can arise here:
+ * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
+ *
+ * There's also lots of good information here:
+ * http://www.1024cores.net/home/lock-free-algorithms
+ * http://preshing.com/
+ *
+ * These operations may or may not actually be implemented using
+ * processor specific atomic operations. When possible they are
+ * implemented as true processor specific atomic operations. When that
+ * is not possible the are implemented using locks that *do* use the
+ * available atomic operations.
+ *
+ * All of the atomic operations that modify memory are full memory barriers.
+ */
+
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_platform.h"
+
+#include "begin_code.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \name SDL AtomicLock
+ *
+ * The atomic locks are efficient spinlocks using CPU instructions,
+ * but are vulnerable to starvation and can spin forever if a thread
+ * holding a lock has been terminated. For this reason you should
+ * minimize the code executed inside an atomic lock and never do
+ * expensive things like API or system calls while holding them.
+ *
+ * The atomic locks are not safe to lock recursively.
+ *
+ * Porting Note:
+ * The spin lock functions and type are required and can not be
+ * emulated because they are used in the atomic emulation code.
+ */
+/* @{ */
+
+typedef int SDL_SpinLock;
+
+/**
+ * \brief Try to lock a spin lock by setting it to a non-zero value.
+ *
+ * \param lock Points to the lock.
+ *
+ * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
+
+/**
+ * \brief Lock a spin lock by setting it to a non-zero value.
+ *
+ * \param lock Points to the lock.
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
+
+/**
+ * \brief Unlock a spin lock by setting it to 0. Always returns immediately
+ *
+ * \param lock Points to the lock.
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
+
+/* @} *//* SDL AtomicLock */
+
+
+/**
+ * The compiler barrier prevents the compiler from reordering
+ * reads and writes to globally visible variables across the call.
+ */
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
+void _ReadWriteBarrier(void);
+#pragma intrinsic(_ReadWriteBarrier)
+#define SDL_CompilerBarrier() _ReadWriteBarrier()
+#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
+/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
+#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
+#else
+#define SDL_CompilerBarrier() \
+{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
+#endif
+
+/**
+ * Memory barriers are designed to prevent reads and writes from being
+ * reordered by the compiler and being seen out of order on multi-core CPUs.
+ *
+ * A typical pattern would be for thread A to write some data and a flag,
+ * and for thread B to read the flag and get the data. In this case you
+ * would insert a release barrier between writing the data and the flag,
+ * guaranteeing that the data write completes no later than the flag is
+ * written, and you would insert an acquire barrier between reading the
+ * flag and reading the data, to ensure that all the reads associated
+ * with the flag have completed.
+ *
+ * In this pattern you should always see a release barrier paired with
+ * an acquire barrier and you should gate the data reads/writes with a
+ * single flag variable.
+ *
+ * For more information on these semantics, take a look at the blog post:
+ * http://preshing.com/20120913/acquire-and-release-semantics
+ */
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
+#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
+#elif defined(__GNUC__) && defined(__aarch64__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#elif defined(__GNUC__) && defined(__arm__)
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
+#ifdef __thumb__
+/* The mcr instruction isn't available in thumb mode, use real functions */
+#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
+#else
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
+#endif /* __thumb__ */
+#else
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
+#endif /* __GNUC__ && __arm__ */
+#else
+#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
+/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
+#include <mbarrier.h>
+#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
+#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
+#else
+/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
+#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
+#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
+#endif
+#endif
+
+/**
+ * \brief A type representing an atomic integer value. It is a struct
+ * so people don't accidentally use numeric operations on it.
+ */
+typedef struct { int value; } SDL_atomic_t;
+
+/**
+ * \brief Set an atomic variable to a new value if it is currently an old value.
+ *
+ * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
+ *
+ * \note If you don't know what this function is for, you shouldn't use it!
+*/
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
+
+/**
+ * \brief Set an atomic variable to a value.
+ *
+ * \return The previous value of the atomic variable.
+ */
+extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
+
+/**
+ * \brief Get the value of an atomic variable
+ */
+extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
+
+/**
+ * \brief Add to an atomic variable.
+ *
+ * \return The previous value of the atomic variable.
+ *
+ * \note This same style can be used for any number operation
+ */
+extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
+
+/**
+ * \brief Increment an atomic variable used as a reference count.
+ */
+#ifndef SDL_AtomicIncRef
+#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
+#endif
+
+/**
+ * \brief Decrement an atomic variable used as a reference count.
+ *
+ * \return SDL_TRUE if the variable reached zero after decrementing,
+ * SDL_FALSE otherwise
+ */
+#ifndef SDL_AtomicDecRef
+#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
+#endif
+
+/**
+ * \brief Set a pointer to a new value if it is currently an old value.
+ *
+ * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
+ *
+ * \note If you don't know what this function is for, you shouldn't use it!
+*/
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
+
+/**
+ * \brief Set a pointer to a value atomically.
+ *
+ * \return The previous value of the pointer.
+ */
+extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
+
+/**
+ * \brief Get the value of a pointer atomically.
+ */
+extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
+#include "close_code.h"
+
+#endif /* SDL_atomic_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_audio.h b/src/3rdparty/SDL2/include/SDL_audio.h
new file mode 100644
index 0000000..d6ea689
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_audio.h
@@ -0,0 +1,825 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_audio.h
+ *
+ * Access to the raw audio mixing buffer for the SDL library.
+ */
+
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_endian.h"
+#include "SDL_mutex.h"
+#include "SDL_thread.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Audio format flags.
+ *
+ * These are what the 16 bits in SDL_AudioFormat currently mean...
+ * (Unspecified bits are always zero).
+ *
+ * \verbatim
+ ++-----------------------sample is signed if set
+ ||
+ || ++-----------sample is bigendian if set
+ || ||
+ || || ++---sample is float if set
+ || || ||
+ || || || +---sample bit size---+
+ || || || | |
+ 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
+ \endverbatim
+ *
+ * There are macros in SDL 2.0 and later to query these bits.
+ */
+typedef Uint16 SDL_AudioFormat;
+
+/**
+ * \name Audio flags
+ */
+/* @{ */
+
+#define SDL_AUDIO_MASK_BITSIZE (0xFF)
+#define SDL_AUDIO_MASK_DATATYPE (1<<8)
+#define SDL_AUDIO_MASK_ENDIAN (1<<12)
+#define SDL_AUDIO_MASK_SIGNED (1<<15)
+#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
+#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
+#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
+#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
+#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
+#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
+#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
+
+/**
+ * \name Audio format flags
+ *
+ * Defaults to LSB byte order.
+ */
+/* @{ */
+#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
+#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
+#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
+#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
+#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
+#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
+#define AUDIO_U16 AUDIO_U16LSB
+#define AUDIO_S16 AUDIO_S16LSB
+/* @} */
+
+/**
+ * \name int32 support
+ */
+/* @{ */
+#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
+#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
+#define AUDIO_S32 AUDIO_S32LSB
+/* @} */
+
+/**
+ * \name float32 support
+ */
+/* @{ */
+#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
+#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
+#define AUDIO_F32 AUDIO_F32LSB
+/* @} */
+
+/**
+ * \name Native audio byte ordering
+ */
+/* @{ */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define AUDIO_U16SYS AUDIO_U16LSB
+#define AUDIO_S16SYS AUDIO_S16LSB
+#define AUDIO_S32SYS AUDIO_S32LSB
+#define AUDIO_F32SYS AUDIO_F32LSB
+#else
+#define AUDIO_U16SYS AUDIO_U16MSB
+#define AUDIO_S16SYS AUDIO_S16MSB
+#define AUDIO_S32SYS AUDIO_S32MSB
+#define AUDIO_F32SYS AUDIO_F32MSB
+#endif
+/* @} */
+
+/**
+ * \name Allow change flags
+ *
+ * Which audio format changes are allowed when opening a device.
+ */
+/* @{ */
+#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
+#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
+#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
+#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
+/* @} */
+
+/* @} *//* Audio flags */
+
+/**
+ * This function is called when the audio device needs more data.
+ *
+ * \param userdata An application-specific parameter saved in
+ * the SDL_AudioSpec structure
+ * \param stream A pointer to the audio data buffer.
+ * \param len The length of that buffer in bytes.
+ *
+ * Once the callback returns, the buffer will no longer be valid.
+ * Stereo samples are stored in a LRLRLR ordering.
+ *
+ * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
+ * you like. Just open your audio device with a NULL callback.
+ */
+typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
+ int len);
+
+/**
+ * The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ * For multi-channel audio, the default SDL channel mapping is:
+ * 2: FL FR (stereo)
+ * 3: FL FR LFE (2.1 surround)
+ * 4: FL FR BL BR (quad)
+ * 5: FL FR FC BL BR (quad + center)
+ * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
+ * 7: FL FR FC LFE BC SL SR (6.1 surround)
+ * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
+ */
+typedef struct SDL_AudioSpec
+{
+ int freq; /**< DSP frequency -- samples per second */
+ SDL_AudioFormat format; /**< Audio data format */
+ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
+ Uint8 silence; /**< Audio buffer silence value (calculated) */
+ Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
+ Uint16 padding; /**< Necessary for some compile environments */
+ Uint32 size; /**< Audio buffer size in bytes (calculated) */
+ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
+ void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
+} SDL_AudioSpec;
+
+
+struct SDL_AudioCVT;
+typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
+ SDL_AudioFormat format);
+
+/**
+ * \brief Upper limit of filters in SDL_AudioCVT
+ *
+ * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ * one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ * \struct SDL_AudioCVT
+ * \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ * Note that various parts of the conversion pipeline can take advantage
+ * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ * you to pass it aligned data, but can possibly run much faster if you
+ * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ * (len) field to something that's a multiple of 16, if possible.
+ */
+#ifdef __GNUC__
+/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
+ pad it out to 88 bytes to guarantee ABI compatibility between compilers.
+ vvv
+ The next time we rev the ABI, make sure to size the ints and add padding.
+*/
+#define SDL_AUDIOCVT_PACKED __attribute__((packed))
+#else
+#define SDL_AUDIOCVT_PACKED
+#endif
+/* */
+typedef struct SDL_AudioCVT
+{
+ int needed; /**< Set to 1 if conversion possible */
+ SDL_AudioFormat src_format; /**< Source audio format */
+ SDL_AudioFormat dst_format; /**< Target audio format */
+ double rate_incr; /**< Rate conversion increment */
+ Uint8 *buf; /**< Buffer to hold entire audio data */
+ int len; /**< Length of original audio buffer */
+ int len_cvt; /**< Length of converted audio buffer */
+ int len_mult; /**< buffer must be len*len_mult big */
+ double len_ratio; /**< Given len, final size is len*len_ratio */
+ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
+ int filter_index; /**< Current audio conversion function */
+} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
+
+
+/* Function prototypes */
+
+/**
+ * \name Driver discovery functions
+ *
+ * These functions return the list of built in audio drivers, in the
+ * order that they are normally initialized by default.
+ */
+/* @{ */
+extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
+extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
+/* @} */
+
+/**
+ * \name Initialization and cleanup
+ *
+ * \internal These functions are used internally, and should not be used unless
+ * you have a specific need to specify the audio driver you want to
+ * use. You should normally use SDL_Init() or SDL_InitSubSystem().
+ */
+/* @{ */
+extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
+extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
+/* @} */
+
+/**
+ * This function returns the name of the current audio driver, or NULL
+ * if no driver has been initialized.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
+
+/**
+ * This function opens the audio device with the desired parameters, and
+ * returns 0 if successful, placing the actual hardware parameters in the
+ * structure pointed to by \c obtained. If \c obtained is NULL, the audio
+ * data passed to the callback function will be guaranteed to be in the
+ * requested format, and will be automatically converted to the hardware
+ * audio format if necessary. This function returns -1 if it failed
+ * to open the audio device, or couldn't set up the audio thread.
+ *
+ * When filling in the desired audio spec structure,
+ * - \c desired->freq should be the desired audio frequency in samples-per-
+ * second.
+ * - \c desired->format should be the desired audio format.
+ * - \c desired->samples is the desired size of the audio buffer, in
+ * samples. This number should be a power of two, and may be adjusted by
+ * the audio driver to a value more suitable for the hardware. Good values
+ * seem to range between 512 and 8096 inclusive, depending on the
+ * application and CPU speed. Smaller values yield faster response time,
+ * but can lead to underflow if the application is doing heavy processing
+ * and cannot fill the audio buffer in time. A stereo sample consists of
+ * both right and left channels in LR ordering.
+ * Note that the number of samples is directly related to time by the
+ * following formula: \code ms = (samples*1000)/freq \endcode
+ * - \c desired->size is the size in bytes of the audio buffer, and is
+ * calculated by SDL_OpenAudio().
+ * - \c desired->silence is the value used to set the buffer to silence,
+ * and is calculated by SDL_OpenAudio().
+ * - \c desired->callback should be set to a function that will be called
+ * when the audio device is ready for more data. It is passed a pointer
+ * to the audio buffer, and the length in bytes of the audio buffer.
+ * This function usually runs in a separate thread, and so you should
+ * protect data structures that it accesses by calling SDL_LockAudio()
+ * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
+ * pointer here, and call SDL_QueueAudio() with some frequency, to queue
+ * more audio samples to be played (or for capture devices, call
+ * SDL_DequeueAudio() with some frequency, to obtain audio samples).
+ * - \c desired->userdata is passed as the first parameter to your callback
+ * function. If you passed a NULL callback, this value is ignored.
+ *
+ * The audio device starts out playing silence when it's opened, and should
+ * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
+ * for your audio callback function to be called. Since the audio driver
+ * may modify the requested size of the audio buffer, you should allocate
+ * any local mixing buffers after you open the audio device.
+ */
+extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
+ SDL_AudioSpec * obtained);
+
+/**
+ * SDL Audio Device IDs.
+ *
+ * A successful call to SDL_OpenAudio() is always device id 1, and legacy
+ * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
+ * always returns devices >= 2 on success. The legacy calls are good both
+ * for backwards compatibility and when you don't care about multiple,
+ * specific, or capture devices.
+ */
+typedef Uint32 SDL_AudioDeviceID;
+
+/**
+ * Get the number of available devices exposed by the current driver.
+ * Only valid after a successfully initializing the audio subsystem.
+ * Returns -1 if an explicit list of devices can't be determined; this is
+ * not an error. For example, if SDL is set up to talk to a remote audio
+ * server, it can't list every one available on the Internet, but it will
+ * still allow a specific host to be specified to SDL_OpenAudioDevice().
+ *
+ * In many common cases, when this function returns a value <= 0, it can still
+ * successfully open the default device (NULL for first argument of
+ * SDL_OpenAudioDevice()).
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
+
+/**
+ * Get the human-readable name of a specific audio device.
+ * Must be a value between 0 and (number of audio devices-1).
+ * Only valid after a successfully initializing the audio subsystem.
+ * The values returned by this function reflect the latest call to
+ * SDL_GetNumAudioDevices(); recall that function to redetect available
+ * hardware.
+ *
+ * The string returned by this function is UTF-8 encoded, read-only, and
+ * managed internally. You are not to free it. If you need to keep the
+ * string for any length of time, you should make your own copy of it, as it
+ * will be invalid next time any of several other SDL functions is called.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
+ int iscapture);
+
+
+/**
+ * Open a specific audio device. Passing in a device name of NULL requests
+ * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
+ *
+ * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
+ * some drivers allow arbitrary and driver-specific strings, such as a
+ * hostname/IP address for a remote audio server, or a filename in the
+ * diskaudio driver.
+ *
+ * \return 0 on error, a valid device ID that is >= 2 on success.
+ *
+ * SDL_OpenAudio(), unlike this function, always acts on device ID 1.
+ */
+extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
+ *device,
+ int iscapture,
+ const
+ SDL_AudioSpec *
+ desired,
+ SDL_AudioSpec *
+ obtained,
+ int
+ allowed_changes);
+
+
+
+/**
+ * \name Audio state
+ *
+ * Get the current audio state.
+ */
+/* @{ */
+typedef enum
+{
+ SDL_AUDIO_STOPPED = 0,
+ SDL_AUDIO_PLAYING,
+ SDL_AUDIO_PAUSED
+} SDL_AudioStatus;
+extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
+
+extern DECLSPEC SDL_AudioStatus SDLCALL
+SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
+/* @} *//* Audio State */
+
+/**
+ * \name Pause audio functions
+ *
+ * These functions pause and unpause the audio callback processing.
+ * They should be called with a parameter of 0 after opening the audio
+ * device to start playing sound. This is so you can safely initialize
+ * data for your callback function after opening the audio device.
+ * Silence will be written to the audio device during the pause.
+ */
+/* @{ */
+extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
+extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
+ int pause_on);
+/* @} *//* Pause audio functions */
+
+/**
+ * This function loads a WAVE from the data source, automatically freeing
+ * that source if \c freesrc is non-zero. For example, to load a WAVE file,
+ * you could do:
+ * \code
+ * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
+ * \endcode
+ *
+ * If this function succeeds, it returns the given SDL_AudioSpec,
+ * filled with the audio data format of the wave data, and sets
+ * \c *audio_buf to a malloc()'d buffer containing the audio data,
+ * and sets \c *audio_len to the length of that audio buffer, in bytes.
+ * You need to free the audio buffer with SDL_FreeWAV() when you are
+ * done with it.
+ *
+ * This function returns NULL and sets the SDL error message if the
+ * wave file cannot be opened, uses an unknown data format, or is
+ * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
+ */
+extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
+ int freesrc,
+ SDL_AudioSpec * spec,
+ Uint8 ** audio_buf,
+ Uint32 * audio_len);
+
+/**
+ * Loads a WAV from a file.
+ * Compatibility convenience function.
+ */
+#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
+ SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
+
+/**
+ * This function frees data previously allocated with SDL_LoadWAV_RW()
+ */
+extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
+
+/**
+ * This function takes a source format and rate and a destination format
+ * and rate, and initializes the \c cvt structure with information needed
+ * by SDL_ConvertAudio() to convert a buffer of audio data from one format
+ * to the other. An unsupported format causes an error and -1 will be returned.
+ *
+ * \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ * or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
+ SDL_AudioFormat src_format,
+ Uint8 src_channels,
+ int src_rate,
+ SDL_AudioFormat dst_format,
+ Uint8 dst_channels,
+ int dst_rate);
+
+/**
+ * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
+ * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
+ * audio data in the source format, this function will convert it in-place
+ * to the desired format.
+ *
+ * The data conversion may expand the size of the audio data, so the buffer
+ * \c cvt->buf should be allocated after the \c cvt structure is initialized by
+ * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
+ *
+ * \return 0 on success or -1 if \c cvt->buf is NULL.
+ */
+extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
+
+/* SDL_AudioStream is a new audio conversion interface.
+ The benefits vs SDL_AudioCVT:
+ - it can handle resampling data in chunks without generating
+ artifacts, when it doesn't have the complete buffer available.
+ - it can handle incoming data in any variable size.
+ - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ * Create a new audio stream
+ *
+ * \param src_format The format of the source audio
+ * \param src_channels The number of channels of the source audio
+ * \param src_rate The sampling rate of the source audio
+ * \param dst_format The format of the desired audio output
+ * \param dst_channels The number of channels of the desired audio output
+ * \param dst_rate The sampling rate of the desired audio output
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+ const Uint8 src_channels,
+ const int src_rate,
+ const SDL_AudioFormat dst_format,
+ const Uint8 dst_channels,
+ const int dst_rate);
+
+/**
+ * Add data to be converted/resampled to the stream
+ *
+ * \param stream The stream the audio data is being added to
+ * \param buf A pointer to the audio data to add
+ * \param len The number of bytes to write to the stream
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ * Get converted/resampled data from the stream
+ *
+ * \param stream The stream the audio is being requested from
+ * \param buf A buffer to fill with audio data
+ * \param len The maximum number of bytes to fill
+ * \return The number of bytes read from the stream, or -1 on error
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ * buffering data behind the scenes until it has enough to resample
+ * correctly, so this number might be lower than what you expect, or even
+ * be zero. Add more data or flush the stream if you need the data now.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ * should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ * be audio gaps in the output. Generally this is intended to signal the
+ * end of input, so the complete output becomes available.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ * Clear any pending data in the stream without converting it
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
+#define SDL_MIX_MAXVOLUME 128
+/**
+ * This takes two audio buffers of the playing audio format and mixes
+ * them, performing addition, volume adjustment, and overflow clipping.
+ * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
+ * for full audio volume. Note this does not change hardware volume.
+ * This is provided for convenience -- you can mix your own audio data.
+ */
+extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
+ Uint32 len, int volume);
+
+/**
+ * This works like SDL_MixAudio(), but you specify the audio format instead of
+ * using the format of audio device 1. Thus it can be used when no audio
+ * device is open at all.
+ */
+extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
+ const Uint8 * src,
+ SDL_AudioFormat format,
+ Uint32 len, int volume);
+
+/**
+ * Queue more audio on non-callback devices.
+ *
+ * (If you are looking to retrieve queued audio from a non-callback capture
+ * device, you want SDL_DequeueAudio() instead. This will return -1 to
+ * signify an error if you use it with capture devices.)
+ *
+ * SDL offers two ways to feed audio to the device: you can either supply a
+ * callback that SDL triggers with some frequency to obtain more audio
+ * (pull method), or you can supply no callback, and then SDL will expect
+ * you to supply data at regular intervals (push method) with this function.
+ *
+ * There are no limits on the amount of data you can queue, short of
+ * exhaustion of address space. Queued data will drain to the device as
+ * necessary without further intervention from you. If the device needs
+ * audio but there is not enough queued, it will play silence to make up
+ * the difference. This means you will have skips in your audio playback
+ * if you aren't routinely queueing sufficient data.
+ *
+ * This function copies the supplied data, so you are safe to free it when
+ * the function returns. This function is thread-safe, but queueing to the
+ * same device from two threads at once does not promise which buffer will
+ * be queued first.
+ *
+ * You may not queue audio on a device that is using an application-supplied
+ * callback; doing so returns an error. You have to use the audio callback
+ * or queue audio with this function, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before queueing; SDL
+ * handles locking internally for this function.
+ *
+ * \param dev The device ID to which we will queue audio.
+ * \param data The data to queue to the device for later playback.
+ * \param len The number of bytes (not samples!) to which (data) points.
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_GetQueuedAudioSize
+ * \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
+
+/**
+ * Dequeue more audio on non-callback devices.
+ *
+ * (If you are looking to queue audio for output on a non-callback playback
+ * device, you want SDL_QueueAudio() instead. This will always return 0
+ * if you use it with playback devices.)
+ *
+ * SDL offers two ways to retrieve audio from a capture device: you can
+ * either supply a callback that SDL triggers with some frequency as the
+ * device records more audio data, (push method), or you can supply no
+ * callback, and then SDL will expect you to retrieve data at regular
+ * intervals (pull method) with this function.
+ *
+ * There are no limits on the amount of data you can queue, short of
+ * exhaustion of address space. Data from the device will keep queuing as
+ * necessary without further intervention from you. This means you will
+ * eventually run out of memory if you aren't routinely dequeueing data.
+ *
+ * Capture devices will not queue data when paused; if you are expecting
+ * to not need captured audio for some length of time, use
+ * SDL_PauseAudioDevice() to stop the capture device from queueing more
+ * data. This can be useful during, say, level loading times. When
+ * unpaused, capture devices will start queueing data from that point,
+ * having flushed any capturable data available while paused.
+ *
+ * This function is thread-safe, but dequeueing from the same device from
+ * two threads at once does not promise which thread will dequeued data
+ * first.
+ *
+ * You may not dequeue audio from a device that is using an
+ * application-supplied callback; doing so returns an error. You have to use
+ * the audio callback, or dequeue audio with this function, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before queueing; SDL
+ * handles locking internally for this function.
+ *
+ * \param dev The device ID from which we will dequeue audio.
+ * \param data A pointer into where audio data should be copied.
+ * \param len The number of bytes (not samples!) to which (data) points.
+ * \return number of bytes dequeued, which could be less than requested.
+ *
+ * \sa SDL_GetQueuedAudioSize
+ * \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len);
+
+/**
+ * Get the number of bytes of still-queued audio.
+ *
+ * For playback device:
+ *
+ * This is the number of bytes that have been queued for playback with
+ * SDL_QueueAudio(), but have not yet been sent to the hardware. This
+ * number may shrink at any time, so this only informs of pending data.
+ *
+ * Once we've sent it to the hardware, this function can not decide the
+ * exact byte boundary of what has been played. It's possible that we just
+ * gave the hardware several kilobytes right before you called this
+ * function, but it hasn't played any of it yet, or maybe half of it, etc.
+ *
+ * For capture devices:
+ *
+ * This is the number of bytes that have been captured by the device and
+ * are waiting for you to dequeue. This number may grow at any time, so
+ * this only informs of the lower-bound of available data.
+ *
+ * You may not queue audio on a device that is using an application-supplied
+ * callback; calling this function on such a device always returns 0.
+ * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
+ * the audio callback, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before querying; SDL
+ * handles locking internally for this function.
+ *
+ * \param dev The device ID of which we will query queued audio size.
+ * \return Number of bytes (not samples!) of queued audio.
+ *
+ * \sa SDL_QueueAudio
+ * \sa SDL_ClearQueuedAudio
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
+
+/**
+ * Drop any queued audio data. For playback devices, this is any queued data
+ * still waiting to be submitted to the hardware. For capture devices, this
+ * is any data that was queued by the device that hasn't yet been dequeued by
+ * the application.
+ *
+ * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For
+ * playback devices, the hardware will start playing silence if more audio
+ * isn't queued. Unpaused capture devices will start filling the queue again
+ * as soon as they have more data available (which, depending on the state
+ * of the hardware and the thread, could be before this function call
+ * returns!).
+ *
+ * This will not prevent playback of queued audio that's already been sent
+ * to the hardware, as we can not undo that, so expect there to be some
+ * fraction of a second of audio that might still be heard. This can be
+ * useful if you want to, say, drop any pending music during a level change
+ * in your game.
+ *
+ * You may not queue audio on a device that is using an application-supplied
+ * callback; calling this function on such a device is always a no-op.
+ * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use
+ * the audio callback, but not both.
+ *
+ * You should not call SDL_LockAudio() on the device before clearing the
+ * queue; SDL handles locking internally for this function.
+ *
+ * This function always succeeds and thus returns void.
+ *
+ * \param dev The device ID of which to clear the audio queue.
+ *
+ * \sa SDL_QueueAudio
+ * \sa SDL_GetQueuedAudioSize
+ */
+extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
+
+
+/**
+ * \name Audio lock functions
+ *
+ * The lock manipulated by these functions protects the callback function.
+ * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
+ * the callback function is not running. Do not call these from the callback
+ * function or you will cause deadlock.
+ */
+/* @{ */
+extern DECLSPEC void SDLCALL SDL_LockAudio(void);
+extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
+extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
+extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
+/* @} *//* Audio lock functions */
+
+/**
+ * This function shuts down audio processing and closes the audio device.
+ */
+extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
+extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_audio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_bits.h b/src/3rdparty/SDL2/include/SDL_bits.h
new file mode 100644
index 0000000..eb8322f
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_bits.h
@@ -0,0 +1,112 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_bits.h
+ *
+ * Functions for fiddling with bits and bitmasks.
+ */
+
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_bits.h
+ */
+
+/**
+ * Get the index of the most significant bit. Result is undefined when called
+ * with 0. This operation can also be stated as "count leading zeroes" and
+ * "log base 2".
+ *
+ * \return Index of the most significant bit, or -1 if the value is 0.
+ */
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+ "bsr eax, eax" \
+ "xor eax, 31" \
+ parm [eax] nomemory \
+ value [eax] \
+ modify exact [eax] nomemory;
+#endif
+
+SDL_FORCE_INLINE int
+SDL_MostSignificantBitIndex32(Uint32 x)
+{
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+ /* Count Leading Zeroes builtin in GCC.
+ * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
+ */
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - _SDL_clz_watcom(x);
+#else
+ /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
+ * <seander@cs.stanford.edu>, released in the public domain.
+ * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
+ */
+ const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
+ const int S[] = {1, 2, 4, 8, 16};
+
+ int msbIndex = 0;
+ int i;
+
+ if (x == 0) {
+ return -1;
+ }
+
+ for (i = 4; i >= 0; i--)
+ {
+ if (x & b[i])
+ {
+ x >>= S[i];
+ msbIndex |= S[i];
+ }
+ }
+
+ return msbIndex;
+#endif
+}
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_bits_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_blendmode.h b/src/3rdparty/SDL2/include/SDL_blendmode.h
new file mode 100644
index 0000000..36a5ea7
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_blendmode.h
@@ -0,0 +1,120 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_blendmode.h
+ *
+ * Header file declaring the SDL_BlendMode enumeration
+ */
+
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
+ */
+typedef enum
+{
+ SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
+ dstRGBA = srcRGBA */
+ SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
+ dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
+ dstA = srcA + (dstA * (1-srcA)) */
+ SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
+ dstRGB = (srcRGB * srcA) + dstRGB
+ dstA = dstA */
+ SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
+ dstRGB = srcRGB * dstRGB
+ dstA = dstA */
+ SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
+} SDL_BlendMode;
+
+/**
+ * \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
+ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
+ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ * \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
+ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
+ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ * \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ * \param srcColorFactor
+ * \param dstColorFactor
+ * \param colorOperation
+ * \param srcAlphaFactor
+ * \param dstAlphaFactor
+ * \param alphaOperation
+ *
+ * The result of the blend mode operation will be:
+ * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ * and
+ * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+ SDL_BlendFactor dstColorFactor,
+ SDL_BlendOperation colorOperation,
+ SDL_BlendFactor srcAlphaFactor,
+ SDL_BlendFactor dstAlphaFactor,
+ SDL_BlendOperation alphaOperation);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_blendmode_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_clipboard.h b/src/3rdparty/SDL2/include/SDL_clipboard.h
new file mode 100644
index 0000000..f28751e
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_clipboard.h
@@ -0,0 +1,71 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_clipboard.h
+ *
+ * Include file for SDL clipboard handling
+ */
+
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+/**
+ * \brief Put UTF-8 text into the clipboard
+ *
+ * \sa SDL_GetClipboardText()
+ */
+extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
+
+/**
+ * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
+ *
+ * \sa SDL_SetClipboardText()
+ */
+extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
+
+/**
+ * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
+ *
+ * \sa SDL_GetClipboardText()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_clipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_config.h b/src/3rdparty/SDL2/include/SDL_config.h
new file mode 100644
index 0000000..7e0340c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config.h
@@ -0,0 +1,53 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/**
+ * \file SDL_config.h
+ */
+
+/* Add any platform that doesn't build using the configure system. */
+#if defined(__WIN32__)
+#include "SDL_config_windows.h"
+#elif defined(__WINRT__)
+#include "SDL_config_winrt.h"
+#elif defined(__MACOSX__)
+#include "SDL_config_macosx.h"
+#elif defined(__IPHONEOS__)
+#include "SDL_config_iphoneos.h"
+#elif defined(__ANDROID__)
+#include "SDL_config_android.h"
+#elif defined(__PSP__)
+#include "SDL_config_psp.h"
+#else
+/* This is a minimal configuration just to get SDL running on new platforms */
+#include "SDL_config_minimal.h"
+#endif /* platform config */
+
+#ifdef USING_GENERATED_CONFIG_H
+#error Wrong SDL_config.h, check your include path?
+#endif
+
+#endif /* SDL_config_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_android.h b/src/3rdparty/SDL2/include/SDL_config_android.h
new file mode 100644
index 0000000..4c4da37
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_android.h
@@ -0,0 +1,171 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_android_h_
+#define SDL_config_android_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/**
+ * \file SDL_config_android.h
+ *
+ * This is a configuration that can be used to build SDL for Android
+ */
+
+#include <stdarg.h>
+
+#define HAVE_GCC_ATOMICS 1
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_CLOCK_GETTIME 1
+
+#define SIZEOF_VOIDP 4
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_ANDROID 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#define SDL_JOYSTICK_ANDROID 1
+#define SDL_HAPTIC_ANDROID 1
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_DLOPEN 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_ANDROID 1
+
+/* Enable OpenGL ES */
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_OPENGL_ES2 1
+#define SDL_VIDEO_OPENGL_EGL 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+
+/* Enable Vulkan support */
+/* Android does not support Vulkan in native code using the "armeabi" ABI. */
+#if defined(__ARM_ARCH) && __ARM_ARCH < 7
+#define SDL_VIDEO_VULKAN 0
+#else
+#define SDL_VIDEO_VULKAN 1
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_ANDROID 1
+
+/* Enable the filesystem driver */
+#define SDL_FILESYSTEM_ANDROID 1
+
+#endif /* SDL_config_android_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_iphoneos.h b/src/3rdparty/SDL2/include/SDL_config_iphoneos.h
new file mode 100644
index 0000000..7b0a6ca
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_iphoneos.h
@@ -0,0 +1,191 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_iphoneos_h_
+#define SDL_config_iphoneos_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+#ifdef __LP64__
+#define SIZEOF_VOIDP 8
+#else
+#define SIZEOF_VOIDP 4
+#endif
+
+#define HAVE_GCC_ATOMICS 1
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+/* The libunwind functions are only available on x86 */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYSCTLBYNAME 1
+
+/* enable iPhone version of Core Audio driver */
+#define SDL_AUDIO_DRIVER_COREAUDIO 1
+/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DUMMY 1
+
+/* Enable MFi joystick support */
+#define SDL_JOYSTICK_MFI 1
+
+/* Enable Unix style SO loading */
+#define SDL_LOADSO_DLOPEN 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Supported video drivers */
+#define SDL_VIDEO_DRIVER_UIKIT 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable OpenGL ES */
+#define SDL_VIDEO_OPENGL_ES2 1
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+
+/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */
+#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))
+#define SDL_PLATFORM_SUPPORTS_METAL 1
+#else
+#define SDL_PLATFORM_SUPPORTS_METAL 0
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_RENDER_METAL 1
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_VULKAN 1
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_UIKIT 1
+
+/* enable iPhone keyboard support */
+#define SDL_IPHONE_KEYBOARD 1
+
+/* enable iOS extended launch screen */
+#define SDL_IPHONE_LAUNCHSCREEN 1
+
+/* Set max recognized G-force from accelerometer
+ See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
+ */
+#define SDL_IPHONE_MAX_GFORCE 5.0
+
+/* enable filesystem support */
+#define SDL_FILESYSTEM_COCOA 1
+
+#endif /* SDL_config_iphoneos_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_macosx.h b/src/3rdparty/SDL2/include/SDL_config_macosx.h
new file mode 100644
index 0000000..29f583e
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_macosx.h
@@ -0,0 +1,234 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_macosx_h_
+#define SDL_config_macosx_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
+#include <AvailabilityMacros.h>
+
+/* This is a set of defines to configure the SDL features */
+
+#ifdef __LP64__
+ #define SIZEOF_VOIDP 8
+#else
+ #define SIZEOF_VOIDP 4
+#endif
+
+/* Useful headers */
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_LIBUNWIND_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYSCTLBYNAME 1
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_COREAUDIO 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#define SDL_JOYSTICK_IOKIT 1
+#define SDL_HAPTIC_IOKIT 1
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_DLOPEN 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_COCOA 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#undef SDL_VIDEO_DRIVER_X11
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_XDBE 1
+#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
+#define SDL_VIDEO_DRIVER_X11_XRANDR 1
+#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
+#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
+#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
+#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
+
+#ifdef MAC_OS_X_VERSION_10_8
+/*
+ * No matter the versions targeted, this is the 10.8 or later SDK, so you have
+ * to use the external Xquartz, which is a more modern Xlib. Previous SDKs
+ * used an older Xlib.
+ */
+#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
+#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
+#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_METAL
+/* Metal only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_RENDER_METAL 1
+#else
+#define SDL_VIDEO_RENDER_METAL 0
+#endif
+#endif
+
+/* Enable OpenGL support */
+#ifndef SDL_VIDEO_OPENGL
+#define SDL_VIDEO_OPENGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_CGL
+#define SDL_VIDEO_OPENGL_CGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_GLX
+#define SDL_VIDEO_OPENGL_GLX 1
+#endif
+
+/* Enable Vulkan support */
+/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_VULKAN 1
+#else
+#define SDL_VIDEO_VULKAN 0
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_MACOSX 1
+
+/* enable filesystem support */
+#define SDL_FILESYSTEM_COCOA 1
+
+/* Enable assembly routines */
+#define SDL_ASSEMBLY_ROUTINES 1
+#ifdef __ppc__
+#define SDL_ALTIVEC_BLITTERS 1
+#endif
+
+#endif /* SDL_config_macosx_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_minimal.h b/src/3rdparty/SDL2/include/SDL_config_minimal.h
new file mode 100644
index 0000000..5b03d8b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_minimal.h
@@ -0,0 +1,82 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_minimal_h_
+#define SDL_config_minimal_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/**
+ * \file SDL_config_minimal.h
+ *
+ * This is the minimal configuration that can be used to build SDL.
+ */
+
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+
+/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+/* Here are some reasonable defaults */
+typedef unsigned int size_t;
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+typedef unsigned long uintptr_t;
+#else
+#define HAVE_STDINT_H 1
+#endif /* Visual Studio 2008 */
+
+#ifdef __GNUC__
+#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
+#endif
+
+/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
+#define SDL_JOYSTICK_DISABLED 1
+
+/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED 1
+
+/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
+#define SDL_LOADSO_DISABLED 1
+
+/* Enable the stub thread support (src/thread/generic/\*.c) */
+#define SDL_THREADS_DISABLED 1
+
+/* Enable the stub timer support (src/timer/dummy/\*.c) */
+#define SDL_TIMERS_DISABLED 1
+
+/* Enable the dummy video driver (src/video/dummy/\*.c) */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
+#define SDL_FILESYSTEM_DUMMY 1
+
+#endif /* SDL_config_minimal_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_pandora.h b/src/3rdparty/SDL2/include/SDL_config_pandora.h
new file mode 100644
index 0000000..be5a85c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_pandora.h
@@ -0,0 +1,130 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_pandora_h_
+#define SDL_config_pandora_h_
+#define SDL_config_h_
+
+/* This is a set of defines to configure the SDL features */
+
+/* General platform specific identifiers */
+#include "SDL_platform.h"
+
+#ifdef __LP64__
+#define SIZEOF_VOIDP 8
+#else
+#define SIZEOF_VOIDP 4
+#endif
+
+#define SDL_BYTEORDER 1234
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_STRLEN 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_LOG10 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_OSS 1
+
+#define SDL_INPUT_LINUXEV 1
+#define SDL_INPUT_TSLIB 1
+#define SDL_JOYSTICK_LINUX 1
+#define SDL_HAPTIC_LINUX 1
+
+#define SDL_LOADSO_DLOPEN 1
+
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
+
+#define SDL_TIMER_UNIX 1
+#define SDL_FILESYSTEM_UNIX 1
+
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_X11 1
+#define SDL_VIDEO_DRIVER_PANDORA 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 1
+
+#endif /* SDL_config_pandora_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_psp.h b/src/3rdparty/SDL2/include/SDL_config_psp.h
new file mode 100644
index 0000000..61c3349
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_psp.h
@@ -0,0 +1,159 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_psp_h_
+#define SDL_config_psp_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+
+
+#ifdef __GNUC__
+#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
+#endif
+
+#define HAVE_GCC_ATOMICS 1
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+/* #define HAVE_SYSCONF 1 */
+/* #define HAVE_SIGACTION 1 */
+
+
+/* PSP isn't that sophisticated */
+#define LACKS_SYS_MMAN_H 1
+
+/* Enable the stub thread support (src/thread/psp/\*.c) */
+#define SDL_THREAD_PSP 1
+
+/* Enable the stub timer support (src/timer/psp/\*.c) */
+#define SDL_TIMERS_PSP 1
+
+/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
+#define SDL_JOYSTICK_PSP 1
+
+/* Enable the stub audio driver (src/audio/psp/\*.c) */
+#define SDL_AUDIO_DRIVER_PSP 1
+
+/* PSP video dirver */
+#define SDL_VIDEO_DRIVER_PSP 1
+
+/* PSP render dirver */
+#define SDL_VIDEO_RENDER_PSP 1
+
+#define SDL_POWER_PSP 1
+
+/* !!! FIXME: what does PSP do for filesystem stuff? */
+#define SDL_FILESYSTEM_DUMMY 1
+
+/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED 1
+
+/* PSP can't load shared object (src/loadso/dummy/\*.c) */
+#define SDL_LOADSO_DISABLED 1
+
+
+#endif /* SDL_config_psp_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_windows.h b/src/3rdparty/SDL2/include/SDL_config_windows.h
new file mode 100644
index 0000000..52a9ece
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_windows.h
@@ -0,0 +1,248 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_windows_h_
+#define SDL_config_windows_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* This is a set of defines to configure the SDL features */
+
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
+#define HAVE_STDINT_H 1
+#elif defined(_MSC_VER)
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#ifndef _UINTPTR_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+#define _UINTPTR_T_DEFINED
+#endif
+/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
+#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
+#define DWORD_PTR DWORD
+#endif
+#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
+#define LONG_PTR LONG
+#endif
+#else /* !__GNUC__ && !_MSC_VER */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#ifndef _SIZE_T_DEFINED_
+#define _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#endif
+typedef unsigned int uintptr_t;
+#endif /* __GNUC__ || _MSC_VER */
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
+#else
+# define SIZEOF_VOIDP 4
+#endif
+
+#define HAVE_DDRAW_H 1
+#define HAVE_DINPUT_H 1
+#define HAVE_DSOUND_H 1
+#define HAVE_DXGI_H 1
+#define HAVE_XINPUT_H 1
+
+/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
+#ifdef HAVE_LIBC
+/* Useful headers */
+#define STDC_HEADERS 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE__STRREV 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE__STRICMP 1
+#define HAVE__STRNICMP 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF 1
+#define HAVE__COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
+#if _MSC_VER >= 1800
+#define HAVE_STRTOLL 1
+#define HAVE_VSSCANF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#endif
+/* This function is available with at least the VC++ 2008 C runtime library */
+#if _MSC_VER >= 1400
+#define HAVE__FSEEKI64 1
+#endif
+#endif
+#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
+#define HAVE_M_PI 1
+#endif
+#else
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#endif
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#define SDL_AUDIO_DRIVER_DSOUND 1
+#define SDL_AUDIO_DRIVER_WINMM 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#define SDL_JOYSTICK_DINPUT 1
+#define SDL_JOYSTICK_XINPUT 1
+#define SDL_HAPTIC_DINPUT 1
+#define SDL_HAPTIC_XINPUT 1
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_WINDOWS 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_WINDOWS 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_WINDOWS 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_WINDOWS 1
+
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D 1
+#endif
+#ifndef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11 0
+#endif
+
+/* Enable OpenGL support */
+#ifndef SDL_VIDEO_OPENGL
+#define SDL_VIDEO_OPENGL 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_WGL
+#define SDL_VIDEO_OPENGL_WGL 1
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL 1
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
+
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
+
+/* Enable system power support */
+#define SDL_POWER_WINDOWS 1
+
+/* Enable filesystem support */
+#define SDL_FILESYSTEM_WINDOWS 1
+
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
+
+#endif /* SDL_config_windows_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_winrt.h b/src/3rdparty/SDL2/include/SDL_config_winrt.h
new file mode 100644
index 0000000..aac0e60
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_winrt.h
@@ -0,0 +1,230 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_winrt_h_
+#define SDL_config_winrt_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used
+ by SDL to determine which version of the Windows SDK is being used.
+*/
+#include <sdkddkver.h>
+
+/* Define possibly-undefined NTDDI values (used when compiling SDL against
+ older versions of the Windows SDK.
+*/
+#ifndef NTDDI_WINBLUE
+#define NTDDI_WINBLUE 0x06030000
+#endif
+#ifndef NTDDI_WIN10
+#define NTDDI_WIN10 0x0A000000
+#endif
+
+/* This is a set of defines to configure the SDL features */
+
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
+#define HAVE_STDINT_H 1
+#elif defined(_MSC_VER)
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#ifndef _UINTPTR_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+#define _UINTPTR_T_DEFINED
+#endif
+/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
+#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
+#define DWORD_PTR DWORD
+#endif
+#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
+#define LONG_PTR LONG
+#endif
+#else /* !__GNUC__ && !_MSC_VER */
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+#ifndef _SIZE_T_DEFINED_
+#define _SIZE_T_DEFINED_
+typedef unsigned int size_t;
+#endif
+typedef unsigned int uintptr_t;
+#endif /* __GNUC__ || _MSC_VER */
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
+#else
+# define SIZEOF_VOIDP 4
+#endif
+
+/* Useful headers */
+#define HAVE_DXGI_H 1
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+#define HAVE_XINPUT_H 1
+#endif
+#define HAVE_LIBC 1
+#define STDC_HEADERS 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE__STRREV 1
+#define HAVE__STRUPR 1
+//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
+//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
+//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+//#define HAVE_STRTOLL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE__STRICMP 1
+#define HAVE__STRNICMP 1
+#define HAVE_VSNPRINTF 1
+//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE__COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE__SCALB 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE__FSEEKI64 1
+
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable various input drivers */
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+#define SDL_JOYSTICK_DISABLED 1
+#define SDL_HAPTIC_DISABLED 1
+#else
+#define SDL_JOYSTICK_XINPUT 1
+#define SDL_HAPTIC_XINPUT 1
+#endif
+
+/* Enable various shared object loading systems */
+#define SDL_LOADSO_WINDOWS 1
+
+/* Enable various threading systems */
+#if (NTDDI_VERSION >= NTDDI_WINBLUE)
+#define SDL_THREAD_WINDOWS 1
+#else
+/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
+#define SDL_THREAD_STDCPP 1
+#endif
+
+/* Enable various timer systems */
+#define SDL_TIMER_WINDOWS 1
+
+/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_WINRT 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
+#define SDL_VIDEO_OPENGL_ES2 1
+#define SDL_VIDEO_OPENGL_EGL 1
+
+/* Enable appropriate renderer(s) */
+#define SDL_VIDEO_RENDER_D3D11 1
+
+#if SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+
+/* Enable system power support */
+#define SDL_POWER_WINRT 1
+
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
+
+#endif /* SDL_config_winrt_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_config_wiz.h b/src/3rdparty/SDL2/include/SDL_config_wiz.h
new file mode 100644
index 0000000..fe86d5e
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_config_wiz.h
@@ -0,0 +1,142 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_wiz_h_
+#define SDL_config_wiz_h_
+#define SDL_config_h_
+
+/* This is a set of defines to configure the SDL features */
+
+/* General platform specific identifiers */
+#include "SDL_platform.h"
+
+#define SDL_BYTEORDER 1234
+
+#define STDC_HEADERS 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_STRLEN 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_VSSCANF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL 1
+#define HAVE_CEILF 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_POW 1
+
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_OSS 1
+
+#define SDL_INPUT_LINUXEV 1
+#define SDL_INPUT_TSLIB 1
+#define SDL_JOYSTICK_LINUX 1
+#define SDL_HAPTIC_LINUX 1
+
+#define SDL_LOADSO_DLOPEN 1
+
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
+
+#define SDL_TIMER_UNIX 1
+
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_PANDORA 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 1
+
+#endif /* SDL_config_wiz_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_copying.h b/src/3rdparty/SDL2/include/SDL_copying.h
new file mode 100644
index 0000000..15616ac
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_copying.h
@@ -0,0 +1,20 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
diff --git a/src/3rdparty/SDL2/include/SDL_cpuinfo.h b/src/3rdparty/SDL2/include/SDL_cpuinfo.h
new file mode 100644
index 0000000..0812705
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_cpuinfo.h
@@ -0,0 +1,181 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_cpuinfo.h
+ *
+ * CPU feature detection for SDL.
+ */
+
+#ifndef SDL_cpuinfo_h_
+#define SDL_cpuinfo_h_
+
+#include "SDL_stdinc.h"
+
+/* Need to do this here because intrin.h has C++ code in it */
+/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
+#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
+#include <intrin.h>
+#ifndef _WIN64
+#define __MMX__
+#define __3dNOW__
+#endif
+#define __SSE__
+#define __SSE2__
+#endif /* __clang__ */
+#elif defined(__MINGW64_VERSION_MAJOR)
+#include <intrin.h>
+#else
+#ifdef __ALTIVEC__
+#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
+#include <altivec.h>
+#undef pixel
+#undef bool
+#endif
+#endif
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
+#include <mm3dnow.h>
+#endif
+#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
+#include <xmmintrin.h>
+#endif
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
+#include <emmintrin.h>
+#endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
+#endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This is a guess for the cacheline size used for padding.
+ * Most x86 processors have a 64 byte cache line.
+ * The 64-bit PowerPC processors have a 128 byte cache line.
+ * We'll use the larger value to be generally safe.
+ */
+#define SDL_CACHELINE_SIZE 128
+
+/**
+ * This function returns the number of CPU cores available.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
+
+/**
+ * This function returns the L1 cache line size of the CPU
+ *
+ * This is useful for determining multi-threaded structure padding
+ * or SIMD prefetch sizes.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
+
+/**
+ * This function returns true if the CPU has the RDTSC instruction.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
+
+/**
+ * This function returns true if the CPU has AltiVec features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
+
+/**
+ * This function returns true if the CPU has MMX features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
+
+/**
+ * This function returns true if the CPU has 3DNow! features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
+
+/**
+ * This function returns true if the CPU has SSE features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
+
+/**
+ * This function returns true if the CPU has SSE2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
+
+/**
+ * This function returns true if the CPU has SSE3 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
+
+/**
+ * This function returns true if the CPU has SSE4.1 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
+
+/**
+ * This function returns true if the CPU has SSE4.2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
+
+/**
+ * This function returns true if the CPU has AVX features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
+
+/**
+ * This function returns true if the CPU has AVX2 features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
+
+/**
+ * This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
+/**
+ * This function returns the amount of RAM configured in the system, in MB.
+ */
+extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_cpuinfo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_egl.h b/src/3rdparty/SDL2/include/SDL_egl.h
new file mode 100644
index 0000000..d65ed43
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_egl.h
@@ -0,0 +1,1673 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_egl.h
+ *
+ * This is a simple file to encapsulate the EGL API headers.
+ */
+#if !defined(_MSC_VER) && !defined(__ANDROID__)
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#else /* _MSC_VER */
+
+/* EGL headers for Visual Studio */
+
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+*
+* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
+*
+* Adopters may modify this file to suit their platform. Adopters are
+* encouraged to submit platform specific modifications to the Khronos
+* group so that they can be included in future versions of this file.
+* Please submit changes by sending them to the public Khronos Bugzilla
+* (http://khronos.org/bugzilla) by filing a bug against product
+* "Khronos (general)" component "Registry".
+*
+* A predefined template which fills in some of the bug fields can be
+* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+* must create a Bugzilla login first.
+*
+*
+* See the Implementer's Guidelines for information about where this file
+* should be located on your system and for more details of its use:
+* http://www.khronos.org/registry/implementers_guide.pdf
+*
+* This file should be included as
+* #include <KHR/khrplatform.h>
+* by Khronos client API header files that use its types and defines.
+*
+* The types in khrplatform.h should only be used to define API-specific types.
+*
+* Types defined in khrplatform.h:
+* khronos_int8_t signed 8 bit
+* khronos_uint8_t unsigned 8 bit
+* khronos_int16_t signed 16 bit
+* khronos_uint16_t unsigned 16 bit
+* khronos_int32_t signed 32 bit
+* khronos_uint32_t unsigned 32 bit
+* khronos_int64_t signed 64 bit
+* khronos_uint64_t unsigned 64 bit
+* khronos_intptr_t signed same number of bits as a pointer
+* khronos_uintptr_t unsigned same number of bits as a pointer
+* khronos_ssize_t signed size
+* khronos_usize_t unsigned size
+* khronos_float_t signed 32 bit floating point
+* khronos_time_ns_t unsigned 64 bit time in nanoseconds
+* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+* nanoseconds
+* khronos_stime_nanoseconds_t signed time interval in nanoseconds
+* khronos_boolean_enum_t enumerated boolean type. This should
+* only be used as a base type when a client API's boolean type is
+* an enum. Client APIs which use an integer or other type for
+* booleans cannot use this as the base type for their boolean.
+*
+* Tokens defined in khrplatform.h:
+*
+* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+*
+* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+*
+* Calling convention macros defined in this file:
+* KHRONOS_APICALL
+* KHRONOS_APIENTRY
+* KHRONOS_APIATTRIBUTES
+*
+* These may be used in function prototypes as:
+*
+* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+* int arg1,
+* int arg2) KHRONOS_APIATTRIBUTES;
+*/
+
+/*-------------------------------------------------------------------------
+* Definition of KHRONOS_APICALL
+*-------------------------------------------------------------------------
+* This precedes the return type of the function in the function prototype.
+*/
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+* Definition of KHRONOS_APIENTRY
+*-------------------------------------------------------------------------
+* This follows the return type of the function and precedes the function
+* name in the function prototype.
+*/
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+/* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+* Definition of KHRONOS_APIATTRIBUTES
+*-------------------------------------------------------------------------
+* This follows the closing parenthesis of the function prototype arguments.
+*/
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+* basic type definitions
+*-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+* Using <stdint.h>
+*/
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+* Using <inttypes.h>
+*/
+#include <inttypes.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+* Win32
+*/
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+* Sun or Digital
+*/
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+* Hypothetical platform with no float or int64 support
+*/
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+* Generic fallback
+*/
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+* Types that are (so far) the same on all platforms
+*/
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+
+/*
+* Types that differ between LLP64 and LP64 architectures - in LLP64,
+* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+* to be the only LLP64 architecture in current use.
+*/
+#ifdef _WIN64
+typedef signed long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+* Float type
+*/
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+*
+* These types can be used to represent a time interval in nanoseconds or
+* an absolute Unadjusted System Time. Unadjusted System Time is the number
+* of nanoseconds since some arbitrary system event (e.g. since the last
+* time the system booted). The Unadjusted System Time is an unsigned
+* 64 bit value that wraps back to 0 every 584 years. Time intervals
+* may be either signed or unsigned.
+*/
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+* Dummy value used to pad enum types to 32 bits.
+*/
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+* Enumerated boolean type
+*
+* Values other than zero should be considered to be true. Therefore
+* comparisons should not be made against KHRONOS_TRUE.
+*/
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
+
+
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
+*
+* Adopters may modify khrplatform.h and this file to suit their platform.
+* You are encouraged to submit all modifications to the Khronos group so that
+* they can be included in future versions of this file. Please submit changes
+* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+* by filing a bug against product "EGL" component "Registry".
+*/
+
+/*#include <KHR/khrplatform.h>*/
+
+/* Macros used in EGL function prototype declarations.
+*
+* EGL functions should be prototyped as:
+*
+* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+*
+* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+*/
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+* are aliases of window-system-dependent types, such as X Display * or
+* Windows Device Context. They must be defined in platform-specific
+* code below. The EGL-prefixed versions of Native*Type are the same
+* types, renamed in EGL 1.3 so all types in the API start with "EGL".
+*
+* Khronos STRONGLY RECOMMENDS that you use the default definitions
+* provided below, since these changes affect both binary and source
+* portability of applications using EGL running on different EGL
+* implementations.
+*/
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+#if __WINRT__
+#include <Unknwn.h>
+typedef IUnknown * EGLNativeWindowType;
+typedef IUnknown * EGLNativePixmapType;
+typedef IUnknown * EGLNativeDisplayType;
+#else
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND EGLNativeWindowType;
+#endif
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(WL_EGL_PLATFORM)
+
+typedef struct wl_display *EGLNativeDisplayType;
+typedef struct wl_egl_pixmap *EGLNativePixmapType;
+typedef struct wl_egl_window *EGLNativeWindowType;
+
+#elif defined(__GBM__)
+
+typedef struct gbm_device *EGLNativeDisplayType;
+typedef struct gbm_bo *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
+#elif defined(__ANDROID__) /* Android */
+
+struct ANativeWindow;
+struct egl_native_pixmap_t;
+
+typedef struct ANativeWindow *EGLNativeWindowType;
+typedef struct egl_native_pixmap_t *EGLNativePixmapType;
+typedef void *EGLNativeDisplayType;
+
+#elif defined(MIR_EGL_PLATFORM)
+
+#include <mir_toolkit/mir_client_library.h>
+typedef MirEGLNativeDisplayType EGLNativeDisplayType;
+typedef void *EGLNativePixmapType;
+typedef MirEGLNativeWindowType EGLNativeWindowType;
+
+#elif defined(__unix__)
+
+#ifdef MESA_EGL_NO_X11_HEADERS
+
+typedef void *EGLNativeDisplayType;
+typedef khronos_uintptr_t EGLNativePixmapType;
+typedef khronos_uintptr_t EGLNativeWindowType;
+
+#else
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#endif /* MESA_EGL_NO_X11_HEADERS */
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+* all legal attribute names and values passed into and out of EGL, whether
+* their type is boolean, bitmask, enumerant (symbolic constant), integer,
+* handle, or other. While in general a 32-bit integer will suffice, if
+* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+* integer type.
+*/
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
+
+#ifndef __egl_h_
+#define __egl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2015 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
+*/
+
+/*#include <EGL/eglplatform.h>*/
+
+/* Generated on date 20150623 */
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
+typedef unsigned int EGLBoolean;
+typedef void *EGLDisplay;
+typedef void *EGLConfig;
+typedef void *EGLSurface;
+typedef void *EGLContext;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_DONT_CARE ((EGLint)-1)
+#define EGL_DRAW 0x3059
+#define EGL_EXTENSIONS 0x3055
+#define EGL_FALSE 0
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_HEIGHT 0x3056
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_NONE 0x3038
+#define EGL_NON_CONFORMANT_CONFIG 0x3051
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_NO_CONTEXT ((EGLContext)0)
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#define EGL_NO_SURFACE ((EGLSurface)0)
+#define EGL_PBUFFER_BIT 0x0001
+#define EGL_PIXMAP_BIT 0x0002
+#define EGL_READ 0x305A
+#define EGL_RED_SIZE 0x3024
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SLOW_CONFIG 0x3050
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_SUCCESS 0x3000
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_TRANSPARENT_RGB 0x3052
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRUE 1
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_WIDTH 0x3057
+#define EGL_WINDOW_BIT 0x0004
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
+EGLAPI EGLint EGLAPIENTRY eglGetError (void);
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
+#endif /* EGL_VERSION_1_0 */
+
+#ifndef EGL_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_CONTEXT_LOST 0x300E
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_2D 0x305F
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_TARGET 0x3081
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
+#endif /* EGL_VERSION_1_1 */
+
+#ifndef EGL_VERSION_1_2
+#define EGL_VERSION_1_2 1
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#define EGL_ALPHA_FORMAT 0x3088
+#define EGL_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_ALPHA_FORMAT_PRE 0x308C
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_BUFFER_PRESERVED 0x3094
+#define EGL_BUFFER_DESTROYED 0x3095
+#define EGL_CLIENT_APIS 0x308D
+#define EGL_COLORSPACE 0x3087
+#define EGL_COLORSPACE_sRGB 0x3089
+#define EGL_COLORSPACE_LINEAR 0x308A
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+#define EGL_DISPLAY_SCALING 10000
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_LUMINANCE_BUFFER 0x308F
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_OPENGL_ES_BIT 0x0001
+#define EGL_OPENVG_BIT 0x0002
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENVG_IMAGE 0x3096
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_RGB_BUFFER 0x308E
+#define EGL_SINGLE_BUFFER 0x3085
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_UNKNOWN ((EGLint)-1)
+#define EGL_VERTICAL_RESOLUTION 0x3091
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
+#endif /* EGL_VERSION_1_2 */
+
+#ifndef EGL_VERSION_1_3
+#define EGL_VERSION_1_3 1
+#define EGL_CONFORMANT 0x3042
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041
+#define EGL_OPENGL_ES2_BIT 0x0004
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_COLORSPACE_sRGB 0x3089
+#define EGL_VG_COLORSPACE_LINEAR 0x308A
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
+#endif /* EGL_VERSION_1_3 */
+
+#ifndef EGL_VERSION_1_4
+#define EGL_VERSION_1_4 1
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
+#define EGL_OPENGL_API 0x30A2
+#define EGL_OPENGL_BIT 0x0008
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
+#endif /* EGL_VERSION_1_4 */
+
+#ifndef EGL_VERSION_1_5
+#define EGL_VERSION_1_5 1
+typedef void *EGLSync;
+typedef intptr_t EGLAttrib;
+typedef khronos_utime_nanoseconds_t EGLTime;
+typedef void *EGLImage;
+#define EGL_CONTEXT_MAJOR_VERSION 0x3098
+#define EGL_CONTEXT_MINOR_VERSION 0x30FB
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
+#define EGL_NO_RESET_NOTIFICATION 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
+#define EGL_OPENGL_ES3_BIT 0x00000040
+#define EGL_CL_EVENT_HANDLE 0x309C
+#define EGL_SYNC_CL_EVENT 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
+#define EGL_SYNC_TYPE 0x30F7
+#define EGL_SYNC_STATUS 0x30F1
+#define EGL_SYNC_CONDITION 0x30F8
+#define EGL_SIGNALED 0x30F2
+#define EGL_UNSIGNALED 0x30F3
+#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
+#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED 0x30F5
+#define EGL_CONDITION_SATISFIED 0x30F6
+#define EGL_NO_SYNC ((EGLSync)0)
+#define EGL_SYNC_FENCE 0x30F9
+#define EGL_GL_COLORSPACE 0x309D
+#define EGL_GL_COLORSPACE_SRGB 0x3089
+#define EGL_GL_COLORSPACE_LINEAR 0x308A
+#define EGL_GL_RENDERBUFFER 0x30B9
+#define EGL_GL_TEXTURE_2D 0x30B1
+#define EGL_GL_TEXTURE_LEVEL 0x30BC
+#define EGL_GL_TEXTURE_3D 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
+#define EGL_IMAGE_PRESERVED 0x30D2
+#define EGL_NO_IMAGE ((EGLImage)0)
+EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#endif /* EGL_VERSION_1_5 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __egl_h_ */
+
+
+
+#ifndef __eglext_h_
+#define __eglext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2015 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
+*/
+
+/*#include <EGL/eglplatform.h>*/
+
+#define EGL_EGLEXT_VERSION 20150623
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR 0x309C
+#define EGL_SYNC_CL_EVENT_KHR 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
+#endif /* EGL_KHR_cl_event */
+
+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#endif
+#endif /* EGL_KHR_cl_event2 */
+
+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
+#endif /* EGL_KHR_config_attribs */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif /* EGL_KHR_create_context */
+
+#ifndef EGL_KHR_create_context_no_error
+#define EGL_KHR_create_context_no_error 1
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
+#endif /* EGL_KHR_create_context_no_error */
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR 0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
+#endif /* EGL_KHR_gl_colorspace */
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif
+#endif /* EGL_KHR_image */
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif /* EGL_KHR_image_base */
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+#endif /* EGL_KHR_image_pixmap */
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
+#define EGL_MATCH_FORMAT_KHR 0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
+#define EGL_FORMAT_RGB_565_KHR 0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
+#define EGL_BITMAP_POINTER_KHR 0x30C6
+#define EGL_BITMAP_PITCH_KHR 0x30C7
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR 0x30CE
+#define EGL_UPPER_LEFT_KHR 0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
+#endif
+#endif /* EGL_KHR_lock_surface */
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+#endif /* EGL_KHR_lock_surface2 */
+
+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#endif
+#endif /* EGL_KHR_lock_surface3 */
+
+#ifndef EGL_KHR_partial_update
+#define EGL_KHR_partial_update 1
+#define EGL_BUFFER_AGE_KHR 0x313D
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_partial_update */
+
+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR 0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR 0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
+
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void *EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+#define EGL_PRODUCER_FRAME_KHR 0x3212
+#define EGL_CONSUMER_FRAME_KHR 0x3213
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
+
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
+
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
+
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
+
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
+
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR 0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+#endif /* EGL_KHR_surfaceless_context */
+
+#ifndef EGL_KHR_swap_buffers_with_damage
+#define EGL_KHR_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_swap_buffers_with_damage */
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
+#endif /* EGL_KHR_vg_parent_image */
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+#endif /* EGL_KHR_wait_sync */
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+#endif /* EGL_ANDROID_blob_cache */
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
+#endif
+#endif /* EGL_ANDROID_native_fence_sync */
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_device_d3d
+#define EGL_ANGLE_device_d3d 1
+#define EGL_D3D9_DEVICE_ANGLE 0x33A0
+#define EGL_D3D11_DEVICE_ANGLE 0x33A1
+#endif /* EGL_ANGLE_device_d3d */
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+#endif /* EGL_ANGLE_query_surface_pointer */
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE 0x3201
+#endif /* EGL_ANGLE_window_fixed_size */
+
+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM 0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif /* EGL_EXT_buffer_age */
+
+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
+
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
+#endif /* EGL_EXT_create_context_robustness */
+
+#ifndef EGL_EXT_device_base
+#define EGL_EXT_device_base 1
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
+#define EGL_BAD_DEVICE_EXT 0x322B
+#define EGL_DEVICE_EXT 0x322C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#endif
+#endif /* EGL_EXT_device_base */
+
+#ifndef EGL_EXT_device_drm
+#define EGL_EXT_device_drm 1
+#define EGL_DRM_DEVICE_FILE_EXT 0x3233
+#endif /* EGL_EXT_device_drm */
+
+#ifndef EGL_EXT_device_enumeration
+#define EGL_EXT_device_enumeration 1
+#endif /* EGL_EXT_device_enumeration */
+
+#ifndef EGL_EXT_device_openwf
+#define EGL_EXT_device_openwf 1
+#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
+#endif /* EGL_EXT_device_openwf */
+
+#ifndef EGL_EXT_device_query
+#define EGL_EXT_device_query 1
+#endif /* EGL_EXT_device_query */
+
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT 0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT 0x327F
+#define EGL_ITU_REC709_EXT 0x3280
+#define EGL_ITU_REC2020_EXT 0x3281
+#define EGL_YUV_FULL_RANGE_EXT 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_output_base
+#define EGL_EXT_output_base 1
+typedef void *EGLOutputLayerEXT;
+typedef void *EGLOutputPortEXT;
+#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
+#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0)
+#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
+#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
+#define EGL_SWAP_INTERVAL_EXT 0x322F
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#endif
+#endif /* EGL_EXT_output_base */
+
+#ifndef EGL_EXT_output_drm
+#define EGL_EXT_output_drm 1
+#define EGL_DRM_CRTC_EXT 0x3234
+#define EGL_DRM_PLANE_EXT 0x3235
+#define EGL_DRM_CONNECTOR_EXT 0x3236
+#endif /* EGL_EXT_output_drm */
+
+#ifndef EGL_EXT_output_openwf
+#define EGL_EXT_output_openwf 1
+#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
+#define EGL_OPENWF_PORT_ID_EXT 0x3239
+#endif /* EGL_EXT_output_openwf */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#endif
+#endif /* EGL_EXT_platform_base */
+
+#ifndef EGL_EXT_platform_device
+#define EGL_EXT_platform_device 1
+#define EGL_PLATFORM_DEVICE_EXT 0x313F
+#endif /* EGL_EXT_platform_device */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
+#endif /* EGL_EXT_platform_x11 */
+
+#ifndef EGL_EXT_protected_surface
+#define EGL_EXT_protected_surface 1
+#define EGL_PROTECTED_CONTENT_EXT 0x32C0
+#endif /* EGL_EXT_protected_surface */
+
+#ifndef EGL_EXT_stream_consumer_egloutput
+#define EGL_EXT_stream_consumer_egloutput 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#endif
+#endif /* EGL_EXT_stream_consumer_egloutput */
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
+#ifndef EGL_EXT_yuv_surface
+#define EGL_EXT_yuv_surface 1
+#define EGL_YUV_ORDER_EXT 0x3301
+#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
+#define EGL_YUV_SUBSAMPLE_EXT 0x3312
+#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
+#define EGL_YUV_CSC_STANDARD_EXT 0x330A
+#define EGL_YUV_PLANE_BPP_EXT 0x331A
+#define EGL_YUV_BUFFER_EXT 0x3300
+#define EGL_YUV_ORDER_YUV_EXT 0x3302
+#define EGL_YUV_ORDER_YVU_EXT 0x3303
+#define EGL_YUV_ORDER_YUYV_EXT 0x3304
+#define EGL_YUV_ORDER_UYVY_EXT 0x3305
+#define EGL_YUV_ORDER_YVYU_EXT 0x3306
+#define EGL_YUV_ORDER_VYUY_EXT 0x3307
+#define EGL_YUV_ORDER_AYUV_EXT 0x3308
+#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
+#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
+#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
+#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
+#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
+#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
+#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
+#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
+#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
+#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
+#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
+#endif /* EGL_EXT_yuv_surface */
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+ void *pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#endif
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI 0x8F70
+#define EGL_COLOR_RGB_HI 0x8F71
+#define EGL_COLOR_RGBA_HI 0x8F72
+#define EGL_COLOR_ARGB_HI 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif /* EGL_IMG_context_priority */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
+#define EGL_DRM_BUFFER_USE_MESA 0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA 0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+#endif /* EGL_MESA_drm_image */
+
+#ifndef EGL_MESA_image_dma_buf_export
+#define EGL_MESA_image_dma_buf_export 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#endif
+#endif /* EGL_MESA_image_dma_buf_export */
+
+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA 0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region */
+
+#ifndef EGL_NOK_swap_region2
+#define EGL_NOK_swap_region2 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region2 */
+
+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+#define EGL_Y_INVERTED_NOK 0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif /* EGL_NV_3dvision_surface */
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif /* EGL_NV_coverage_sample */
+
+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_cuda_event
+#define EGL_NV_cuda_event 1
+#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
+#define EGL_SYNC_CUDA_EVENT_NV 0x323C
+#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
+#endif /* EGL_NV_cuda_event */
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_device_cuda
+#define EGL_NV_device_cuda 1
+#define EGL_CUDA_DEVICE_NV 0x323A
+#endif /* EGL_NV_device_cuda */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#endif
+#endif /* EGL_NV_native_query */
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+#endif /* EGL_NV_post_sub_buffer */
+
+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV 0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#endif
+#endif /* EGL_NV_stream_sync */
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
+
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
+
+#ifndef EGL_TIZEN_image_native_buffer
+#define EGL_TIZEN_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
+#endif /* EGL_TIZEN_image_native_buffer */
+
+#ifndef EGL_TIZEN_image_native_surface
+#define EGL_TIZEN_image_native_surface 1
+#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
+#endif /* EGL_TIZEN_image_native_surface */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __eglext_h_ */
+
+
+#endif /* _MSC_VER */
diff --git a/src/3rdparty/SDL2/include/SDL_endian.h b/src/3rdparty/SDL2/include/SDL_endian.h
new file mode 100644
index 0000000..ed0bf5b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_endian.h
@@ -0,0 +1,260 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_endian.h
+ *
+ * Functions for reading and writing endian-specific values
+ */
+
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
+
+#include "SDL_stdinc.h"
+
+/**
+ * \name The two types of endianness
+ */
+/* @{ */
+#define SDL_LIL_ENDIAN 1234
+#define SDL_BIG_ENDIAN 4321
+/* @} */
+
+#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
+#ifdef __linux__
+#include <endian.h>
+#define SDL_BYTEORDER __BYTE_ORDER
+#else /* __linux__ */
+#if defined(__hppa__) || \
+ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
+ (defined(__MIPS__) && defined(__MISPEB__)) || \
+ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
+ defined(__sparc__)
+#define SDL_BYTEORDER SDL_BIG_ENDIAN
+#else
+#define SDL_BYTEORDER SDL_LIL_ENDIAN
+#endif
+#endif /* __linux__ */
+#endif /* !SDL_BYTEORDER */
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_endian.h
+ */
+#if defined(__GNUC__) && defined(__i386__) && \
+ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ int result;
+
+ __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
+ return (Uint16)result;
+}
+#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
+ return x;
+}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+ "xchg al, ah" \
+ parm [ax] \
+ modify [ax];
+#else
+SDL_FORCE_INLINE Uint16
+SDL_Swap16(Uint16 x)
+{
+ return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
+}
+#endif
+
+#if defined(__GNUC__) && defined(__i386__)
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ __asm__("bswap %0": "=r"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ __asm__("bswapl %0": "=r"(x):"0"(x));
+ return x;
+}
+#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ Uint32 result;
+
+ __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
+ __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
+ __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
+ return result;
+}
+#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
+ return x;
+}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+ "bswap eax" \
+ parm [eax] \
+ modify [eax];
+#else /* 386-only */
+#pragma aux SDL_Swap32 = \
+ "xchg al, ah" \
+ "ror eax, 16" \
+ "xchg al, ah" \
+ parm [eax] \
+ modify [eax];
+#endif
+#else
+SDL_FORCE_INLINE Uint32
+SDL_Swap32(Uint32 x)
+{
+ return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
+ ((x >> 8) & 0x0000FF00) | (x >> 24)));
+}
+#endif
+
+#if defined(__GNUC__) && defined(__i386__)
+SDL_FORCE_INLINE Uint64
+SDL_Swap64(Uint64 x)
+{
+ union
+ {
+ struct
+ {
+ Uint32 a, b;
+ } s;
+ Uint64 u;
+ } v;
+ v.u = x;
+ __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
+ "1"(v.s.
+ b));
+ return v.u;
+}
+#elif defined(__GNUC__) && defined(__x86_64__)
+SDL_FORCE_INLINE Uint64
+SDL_Swap64(Uint64 x)
+{
+ __asm__("bswapq %0": "=r"(x):"0"(x));
+ return x;
+}
+#else
+SDL_FORCE_INLINE Uint64
+SDL_Swap64(Uint64 x)
+{
+ Uint32 hi, lo;
+
+ /* Separate into high and low 32-bit values and swap them */
+ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+ x >>= 32;
+ hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+ x = SDL_Swap32(lo);
+ x <<= 32;
+ x |= SDL_Swap32(hi);
+ return (x);
+}
+#endif
+
+
+SDL_FORCE_INLINE float
+SDL_SwapFloat(float x)
+{
+ union
+ {
+ float f;
+ Uint32 ui32;
+ } swapper;
+ swapper.f = x;
+ swapper.ui32 = SDL_Swap32(swapper.ui32);
+ return swapper.f;
+}
+
+
+/**
+ * \name Swap to native
+ * Byteswap item from the specified endianness to the native endianness.
+ */
+/* @{ */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define SDL_SwapLE16(X) (X)
+#define SDL_SwapLE32(X) (X)
+#define SDL_SwapLE64(X) (X)
+#define SDL_SwapFloatLE(X) (X)
+#define SDL_SwapBE16(X) SDL_Swap16(X)
+#define SDL_SwapBE32(X) SDL_Swap32(X)
+#define SDL_SwapBE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
+#else
+#define SDL_SwapLE16(X) SDL_Swap16(X)
+#define SDL_SwapLE32(X) SDL_Swap32(X)
+#define SDL_SwapLE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
+#define SDL_SwapBE16(X) (X)
+#define SDL_SwapBE32(X) (X)
+#define SDL_SwapBE64(X) (X)
+#define SDL_SwapFloatBE(X) (X)
+#endif
+/* @} *//* Swap to native */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_endian_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_error.h b/src/3rdparty/SDL2/include/SDL_error.h
new file mode 100644
index 0000000..c0e4629
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_error.h
@@ -0,0 +1,76 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_error.h
+ *
+ * Simple error message routines for SDL.
+ */
+
+#ifndef SDL_error_h_
+#define SDL_error_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Public functions */
+/* SDL_SetError() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+extern DECLSPEC const char *SDLCALL SDL_GetError(void);
+extern DECLSPEC void SDLCALL SDL_ClearError(void);
+
+/**
+ * \name Internal error functions
+ *
+ * \internal
+ * Private error reporting function - used internally.
+ */
+/* @{ */
+#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
+#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
+#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
+typedef enum
+{
+ SDL_ENOMEM,
+ SDL_EFREAD,
+ SDL_EFWRITE,
+ SDL_EFSEEK,
+ SDL_UNSUPPORTED,
+ SDL_LASTERROR
+} SDL_errorcode;
+/* SDL_Error() unconditionally returns -1. */
+extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
+/* @} *//* Internal error functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_error_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_events.h b/src/3rdparty/SDL2/include/SDL_events.h
new file mode 100644
index 0000000..3d39e6a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_events.h
@@ -0,0 +1,754 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_events.h
+ *
+ * Include file for SDL event handling.
+ */
+
+#ifndef SDL_events_h_
+#define SDL_events_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_keyboard.h"
+#include "SDL_mouse.h"
+#include "SDL_joystick.h"
+#include "SDL_gamecontroller.h"
+#include "SDL_quit.h"
+#include "SDL_gesture.h"
+#include "SDL_touch.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* General keyboard/mouse state definitions */
+#define SDL_RELEASED 0
+#define SDL_PRESSED 1
+
+/**
+ * \brief The types of events that can be delivered.
+ */
+typedef enum
+{
+ SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
+
+ /* Application events */
+ SDL_QUIT = 0x100, /**< User-requested quit */
+
+ /* These application events have special meaning on iOS, see README-ios.md for details */
+ SDL_APP_TERMINATING, /**< The application is being terminated by the OS
+ Called on iOS in applicationWillTerminate()
+ Called on Android in onDestroy()
+ */
+ SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
+ Called on iOS in applicationDidReceiveMemoryWarning()
+ Called on Android in onLowMemory()
+ */
+ SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
+ Called on iOS in applicationWillResignActive()
+ Called on Android in onPause()
+ */
+ SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
+ Called on iOS in applicationDidEnterBackground()
+ Called on Android in onPause()
+ */
+ SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
+ Called on iOS in applicationWillEnterForeground()
+ Called on Android in onResume()
+ */
+ SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
+ Called on iOS in applicationDidBecomeActive()
+ Called on Android in onResume()
+ */
+
+ /* Window events */
+ SDL_WINDOWEVENT = 0x200, /**< Window state change */
+ SDL_SYSWMEVENT, /**< System specific event */
+
+ /* Keyboard events */
+ SDL_KEYDOWN = 0x300, /**< Key pressed */
+ SDL_KEYUP, /**< Key released */
+ SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
+ SDL_TEXTINPUT, /**< Keyboard text input */
+ SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
+ input language or keyboard layout change.
+ */
+
+ /* Mouse events */
+ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
+ SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
+ SDL_MOUSEBUTTONUP, /**< Mouse button released */
+ SDL_MOUSEWHEEL, /**< Mouse wheel motion */
+
+ /* Joystick events */
+ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
+ SDL_JOYBALLMOTION, /**< Joystick trackball motion */
+ SDL_JOYHATMOTION, /**< Joystick hat position change */
+ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
+ SDL_JOYBUTTONUP, /**< Joystick button released */
+ SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
+ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
+
+ /* Game controller events */
+ SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
+ SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
+ SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
+ SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
+ SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
+ SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
+
+ /* Touch events */
+ SDL_FINGERDOWN = 0x700,
+ SDL_FINGERUP,
+ SDL_FINGERMOTION,
+
+ /* Gesture events */
+ SDL_DOLLARGESTURE = 0x800,
+ SDL_DOLLARRECORD,
+ SDL_MULTIGESTURE,
+
+ /* Clipboard events */
+ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
+
+ /* Drag and drop events */
+ SDL_DROPFILE = 0x1000, /**< The system requests a file open */
+ SDL_DROPTEXT, /**< text/plain drag-and-drop event */
+ SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
+ SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
+
+ /* Audio hotplug events */
+ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
+ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
+
+ /* Render events */
+ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
+ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
+
+ /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+ * and should be allocated with SDL_RegisterEvents()
+ */
+ SDL_USEREVENT = 0x8000,
+
+ /**
+ * This last event is only for bounding internal arrays
+ */
+ SDL_LASTEVENT = 0xFFFF
+} SDL_EventType;
+
+/**
+ * \brief Fields shared by every event
+ */
+typedef struct SDL_CommonEvent
+{
+ Uint32 type;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+} SDL_CommonEvent;
+
+/**
+ * \brief Window state change event data (event.window.*)
+ */
+typedef struct SDL_WindowEvent
+{
+ Uint32 type; /**< ::SDL_WINDOWEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The associated window */
+ Uint8 event; /**< ::SDL_WindowEventID */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint32 data1; /**< event dependent data */
+ Sint32 data2; /**< event dependent data */
+} SDL_WindowEvent;
+
+/**
+ * \brief Keyboard button event structure (event.key.*)
+ */
+typedef struct SDL_KeyboardEvent
+{
+ Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 repeat; /**< Non-zero if this is a key repeat */
+ Uint8 padding2;
+ Uint8 padding3;
+ SDL_Keysym keysym; /**< The key that was pressed or released */
+} SDL_KeyboardEvent;
+
+#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
+/**
+ * \brief Keyboard text editing event structure (event.edit.*)
+ */
+typedef struct SDL_TextEditingEvent
+{
+ Uint32 type; /**< ::SDL_TEXTEDITING */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
+ Sint32 start; /**< The start cursor of selected editing text */
+ Sint32 length; /**< The length of selected editing text */
+} SDL_TextEditingEvent;
+
+
+#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
+/**
+ * \brief Keyboard text input event structure (event.text.*)
+ */
+typedef struct SDL_TextInputEvent
+{
+ Uint32 type; /**< ::SDL_TEXTINPUT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
+} SDL_TextInputEvent;
+
+/**
+ * \brief Mouse motion event structure (event.motion.*)
+ */
+typedef struct SDL_MouseMotionEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Uint32 state; /**< The current button state */
+ Sint32 x; /**< X coordinate, relative to window */
+ Sint32 y; /**< Y coordinate, relative to window */
+ Sint32 xrel; /**< The relative motion in the X direction */
+ Sint32 yrel; /**< The relative motion in the Y direction */
+} SDL_MouseMotionEvent;
+
+/**
+ * \brief Mouse button event structure (event.button.*)
+ */
+typedef struct SDL_MouseButtonEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Uint8 button; /**< The mouse button index */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
+ Uint8 padding1;
+ Sint32 x; /**< X coordinate, relative to window */
+ Sint32 y; /**< Y coordinate, relative to window */
+} SDL_MouseButtonEvent;
+
+/**
+ * \brief Mouse wheel event structure (event.wheel.*)
+ */
+typedef struct SDL_MouseWheelEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEWHEEL */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
+ Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
+ Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
+} SDL_MouseWheelEvent;
+
+/**
+ * \brief Joystick axis motion event structure (event.jaxis.*)
+ */
+typedef struct SDL_JoyAxisEvent
+{
+ Uint32 type; /**< ::SDL_JOYAXISMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 axis; /**< The joystick axis index */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
+ Uint16 padding4;
+} SDL_JoyAxisEvent;
+
+/**
+ * \brief Joystick trackball motion event structure (event.jball.*)
+ */
+typedef struct SDL_JoyBallEvent
+{
+ Uint32 type; /**< ::SDL_JOYBALLMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 ball; /**< The joystick trackball index */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint16 xrel; /**< The relative motion in the X direction */
+ Sint16 yrel; /**< The relative motion in the Y direction */
+} SDL_JoyBallEvent;
+
+/**
+ * \brief Joystick hat position change event structure (event.jhat.*)
+ */
+typedef struct SDL_JoyHatEvent
+{
+ Uint32 type; /**< ::SDL_JOYHATMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 hat; /**< The joystick hat index */
+ Uint8 value; /**< The hat position value.
+ * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
+ * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
+ * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
+ *
+ * Note that zero means the POV is centered.
+ */
+ Uint8 padding1;
+ Uint8 padding2;
+} SDL_JoyHatEvent;
+
+/**
+ * \brief Joystick button event structure (event.jbutton.*)
+ */
+typedef struct SDL_JoyButtonEvent
+{
+ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 button; /**< The joystick button index */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
+ Uint8 padding2;
+} SDL_JoyButtonEvent;
+
+/**
+ * \brief Joystick device event structure (event.jdevice.*)
+ */
+typedef struct SDL_JoyDeviceEvent
+{
+ Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
+} SDL_JoyDeviceEvent;
+
+
+/**
+ * \brief Game controller axis motion event structure (event.caxis.*)
+ */
+typedef struct SDL_ControllerAxisEvent
+{
+ Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
+ Uint16 padding4;
+} SDL_ControllerAxisEvent;
+
+
+/**
+ * \brief Game controller button event structure (event.cbutton.*)
+ */
+typedef struct SDL_ControllerButtonEvent
+{
+ Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_JoystickID which; /**< The joystick instance id */
+ Uint8 button; /**< The controller button (SDL_GameControllerButton) */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
+ Uint8 padding2;
+} SDL_ControllerButtonEvent;
+
+
+/**
+ * \brief Controller device event structure (event.cdevice.*)
+ */
+typedef struct SDL_ControllerDeviceEvent
+{
+ Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
+} SDL_ControllerDeviceEvent;
+
+/**
+ * \brief Audio device event structure (event.adevice.*)
+ */
+typedef struct SDL_AudioDeviceEvent
+{
+ Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
+ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+} SDL_AudioDeviceEvent;
+
+
+/**
+ * \brief Touch finger event structure (event.tfinger.*)
+ */
+typedef struct SDL_TouchFingerEvent
+{
+ Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
+ SDL_FingerID fingerId;
+ float x; /**< Normalized in the range 0...1 */
+ float y; /**< Normalized in the range 0...1 */
+ float dx; /**< Normalized in the range -1...1 */
+ float dy; /**< Normalized in the range -1...1 */
+ float pressure; /**< Normalized in the range 0...1 */
+} SDL_TouchFingerEvent;
+
+
+/**
+ * \brief Multiple Finger Gesture Event (event.mgesture.*)
+ */
+typedef struct SDL_MultiGestureEvent
+{
+ Uint32 type; /**< ::SDL_MULTIGESTURE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
+ float dTheta;
+ float dDist;
+ float x;
+ float y;
+ Uint16 numFingers;
+ Uint16 padding;
+} SDL_MultiGestureEvent;
+
+
+/**
+ * \brief Dollar Gesture Event (event.dgesture.*)
+ */
+typedef struct SDL_DollarGestureEvent
+{
+ Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
+ SDL_GestureID gestureId;
+ Uint32 numFingers;
+ float error;
+ float x; /**< Normalized center of gesture */
+ float y; /**< Normalized center of gesture */
+} SDL_DollarGestureEvent;
+
+
+/**
+ * \brief An event used to request a file open by the system (event.drop.*)
+ * This event is enabled by default, you can disable it with SDL_EventState().
+ * \note If this event is enabled, you must free the filename in the event.
+ */
+typedef struct SDL_DropEvent
+{
+ Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
+ Uint32 windowID; /**< The window that was dropped on, if any */
+} SDL_DropEvent;
+
+
+/**
+ * \brief The "quit requested" event
+ */
+typedef struct SDL_QuitEvent
+{
+ Uint32 type; /**< ::SDL_QUIT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+} SDL_QuitEvent;
+
+/**
+ * \brief OS Specific event
+ */
+typedef struct SDL_OSEvent
+{
+ Uint32 type; /**< ::SDL_QUIT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+} SDL_OSEvent;
+
+/**
+ * \brief A user-defined event type (event.user.*)
+ */
+typedef struct SDL_UserEvent
+{
+ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 windowID; /**< The associated window if any */
+ Sint32 code; /**< User defined event code */
+ void *data1; /**< User defined data pointer */
+ void *data2; /**< User defined data pointer */
+} SDL_UserEvent;
+
+
+struct SDL_SysWMmsg;
+typedef struct SDL_SysWMmsg SDL_SysWMmsg;
+
+/**
+ * \brief A video driver dependent system event (event.syswm.*)
+ * This event is disabled by default, you can enable it with SDL_EventState()
+ *
+ * \note If you want to use this event, you should include SDL_syswm.h.
+ */
+typedef struct SDL_SysWMEvent
+{
+ Uint32 type; /**< ::SDL_SYSWMEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
+} SDL_SysWMEvent;
+
+/**
+ * \brief General event structure
+ */
+typedef union SDL_Event
+{
+ Uint32 type; /**< Event type, shared with all events */
+ SDL_CommonEvent common; /**< Common event data */
+ SDL_WindowEvent window; /**< Window event data */
+ SDL_KeyboardEvent key; /**< Keyboard event data */
+ SDL_TextEditingEvent edit; /**< Text editing event data */
+ SDL_TextInputEvent text; /**< Text input event data */
+ SDL_MouseMotionEvent motion; /**< Mouse motion event data */
+ SDL_MouseButtonEvent button; /**< Mouse button event data */
+ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
+ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
+ SDL_JoyBallEvent jball; /**< Joystick ball event data */
+ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
+ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
+ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
+ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
+ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
+ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
+ SDL_AudioDeviceEvent adevice; /**< Audio device event data */
+ SDL_QuitEvent quit; /**< Quit request event data */
+ SDL_UserEvent user; /**< Custom event data */
+ SDL_SysWMEvent syswm; /**< System dependent window event data */
+ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
+ SDL_MultiGestureEvent mgesture; /**< Gesture event data */
+ SDL_DollarGestureEvent dgesture; /**< Gesture event data */
+ SDL_DropEvent drop; /**< Drag and drop event data */
+
+ /* This is necessary for ABI compatibility between Visual C++ and GCC
+ Visual C++ will respect the push pack pragma and use 52 bytes for
+ this structure, and GCC will use the alignment of the largest datatype
+ within the union, which is 8 bytes.
+
+ So... we'll add padding to force the size to be 56 bytes for both.
+ */
+ Uint8 padding[56];
+} SDL_Event;
+
+
+/* Function prototypes */
+
+/**
+ * Pumps the event loop, gathering events from the input devices.
+ *
+ * This function updates the event queue and internal input device state.
+ *
+ * This should only be run in the thread that sets the video mode.
+ */
+extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
+
+/* @{ */
+typedef enum
+{
+ SDL_ADDEVENT,
+ SDL_PEEKEVENT,
+ SDL_GETEVENT
+} SDL_eventaction;
+
+/**
+ * Checks the event queue for messages and optionally returns them.
+ *
+ * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
+ * the back of the event queue.
+ *
+ * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
+ * of the event queue, within the specified minimum and maximum type,
+ * will be returned and will not be removed from the queue.
+ *
+ * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
+ * of the event queue, within the specified minimum and maximum type,
+ * will be returned and will be removed from the queue.
+ *
+ * \return The number of events actually stored, or -1 if there was an error.
+ *
+ * This function is thread-safe.
+ */
+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
+ SDL_eventaction action,
+ Uint32 minType, Uint32 maxType);
+/* @} */
+
+/**
+ * Checks to see if certain event types are in the event queue.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ * This function clears events from the event queue
+ * This function only affects currently queued events. If you want to make
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
+ * on the main thread immediately before the flush call.
+ */
+extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
+extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ * \brief Polls for currently pending events.
+ *
+ * \return 1 if there are any pending events, or 0 if there are none available.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
+
+/**
+ * \brief Waits indefinitely for the next available event.
+ *
+ * \return 1, or 0 if there was an error while waiting for events.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
+
+/**
+ * \brief Waits until the specified timeout (in milliseconds) for the next
+ * available event.
+ *
+ * \return 1, or 0 if there was an error while waiting for events.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ * \param timeout The timeout (in milliseconds) to wait for next event.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
+ int timeout);
+
+/**
+ * \brief Add an event to the event queue.
+ *
+ * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
+ * was full or there was some other error.
+ */
+extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
+
+typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
+
+/**
+ * Sets up a filter to process all events before they change internal state and
+ * are posted to the internal event queue.
+ *
+ * The filter is prototyped as:
+ * \code
+ * int SDL_EventFilter(void *userdata, SDL_Event * event);
+ * \endcode
+ *
+ * If the filter returns 1, then the event will be added to the internal queue.
+ * If it returns 0, then the event will be dropped from the queue, but the
+ * internal state will still be updated. This allows selective filtering of
+ * dynamically arriving events.
+ *
+ * \warning Be very careful of what you do in the event filter function, as
+ * it may run in a different thread!
+ *
+ * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
+ * event filter is only called when the window manager desires to close the
+ * application window. If the event filter returns 1, then the window will
+ * be closed, otherwise the window will remain open if possible.
+ *
+ * If the quit event is generated by an interrupt signal, it will bypass the
+ * internal queue and be delivered to the application at the next event poll.
+ */
+extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
+ void *userdata);
+
+/**
+ * Return the current event filter - can be used to "chain" filters.
+ * If there is no event filter set, this function returns SDL_FALSE.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
+ void **userdata);
+
+/**
+ * Add a function which is called when an event is added to the queue.
+ */
+extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
+ void *userdata);
+
+/**
+ * Remove an event watch function added with SDL_AddEventWatch()
+ */
+extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
+ void *userdata);
+
+/**
+ * Run the filter function on the current event queue, removing any
+ * events for which the filter returns 0.
+ */
+extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
+ void *userdata);
+
+/* @{ */
+#define SDL_QUERY -1
+#define SDL_IGNORE 0
+#define SDL_DISABLE 0
+#define SDL_ENABLE 1
+
+/**
+ * This function allows you to set the state of processing certain events.
+ * - If \c state is set to ::SDL_IGNORE, that event will be automatically
+ * dropped from the event queue and will not be filtered.
+ * - If \c state is set to ::SDL_ENABLE, that event will be processed
+ * normally.
+ * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
+ * current processing state of the specified event.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
+/* @} */
+#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
+
+/**
+ * This function allocates a set of user-defined events, and returns
+ * the beginning event number for that set of events.
+ *
+ * If there aren't enough user-defined events left, this function
+ * returns (Uint32)-1
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_events_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_filesystem.h b/src/3rdparty/SDL2/include/SDL_filesystem.h
new file mode 100644
index 0000000..fa6a1fa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_filesystem.h
@@ -0,0 +1,136 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_filesystem.h
+ *
+ * \brief Include file for filesystem SDL API functions
+ */
+
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Get the path where the application resides.
+ *
+ * Get the "base path". This is the directory where the application was run
+ * from, which is probably the installation directory, and may or may not
+ * be the process's current working directory.
+ *
+ * This returns an absolute path in UTF-8 encoding, and is guaranteed to
+ * end with a path separator ('\\' on Windows, '/' most other places).
+ *
+ * The pointer returned by this function is owned by you. Please call
+ * SDL_free() on the pointer when you are done with it, or it will be a
+ * memory leak. This is not necessarily a fast call, though, so you should
+ * call this once near startup and save the string if you need it.
+ *
+ * Some platforms can't determine the application's path, and on other
+ * platforms, this might be meaningless. In such cases, this function will
+ * return NULL.
+ *
+ * \return String of base dir in UTF-8 encoding, or NULL on error.
+ *
+ * \sa SDL_GetPrefPath
+ */
+extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
+
+/**
+ * \brief Get the user-and-app-specific path where files can be written.
+ *
+ * Get the "pref dir". This is meant to be where users can write personal
+ * files (preferences and save games, etc) that are specific to your
+ * application. This directory is unique per user, per application.
+ *
+ * This function will decide the appropriate location in the native filesystem,
+ * create the directory if necessary, and return a string of the absolute
+ * path to the directory in UTF-8 encoding.
+ *
+ * On Windows, the string might look like:
+ * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
+ *
+ * On Linux, the string might look like:
+ * "/home/bob/.local/share/My Program Name/"
+ *
+ * On Mac OS X, the string might look like:
+ * "/Users/bob/Library/Application Support/My Program Name/"
+ *
+ * (etc.)
+ *
+ * You specify the name of your organization (if it's not a real organization,
+ * your name or an Internet domain you own might do) and the name of your
+ * application. These should be untranslated proper names.
+ *
+ * Both the org and app strings may become part of a directory name, so
+ * please follow these rules:
+ *
+ * - Try to use the same org string (including case-sensitivity) for
+ * all your applications that use this function.
+ * - Always use a unique app string for each one, and make sure it never
+ * changes for an app once you've decided on it.
+ * - Unicode characters are legal, as long as it's UTF-8 encoded, but...
+ * - ...only use letters, numbers, and spaces. Avoid punctuation like
+ * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
+ *
+ * This returns an absolute path in UTF-8 encoding, and is guaranteed to
+ * end with a path separator ('\\' on Windows, '/' most other places).
+ *
+ * The pointer returned by this function is owned by you. Please call
+ * SDL_free() on the pointer when you are done with it, or it will be a
+ * memory leak. This is not necessarily a fast call, though, so you should
+ * call this once near startup and save the string if you need it.
+ *
+ * You should assume the path returned by this function is the only safe
+ * place to write files (and that SDL_GetBasePath(), while it might be
+ * writable, or even the parent of the returned path, aren't where you
+ * should be writing things).
+ *
+ * Some platforms can't determine the pref path, and on other
+ * platforms, this might be meaningless. In such cases, this function will
+ * return NULL.
+ *
+ * \param org The name of your organization.
+ * \param app The name of your application.
+ * \return UTF-8 string of user dir in platform-dependent notation. NULL
+ * if there's a problem (creating directory failed, etc).
+ *
+ * \sa SDL_GetBasePath
+ */
+extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_filesystem_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_gamecontroller.h b/src/3rdparty/SDL2/include/SDL_gamecontroller.h
new file mode 100644
index 0000000..2e024be
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_gamecontroller.h
@@ -0,0 +1,362 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_gamecontroller.h
+ *
+ * Include file for SDL game controller event handling
+ */
+
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_rwops.h"
+#include "SDL_joystick.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_gamecontroller.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
+ * for game controllers, and load appropriate drivers.
+ *
+ * If you would like to receive controller updates while the application
+ * is in the background, you should set the following hint before calling
+ * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
+ */
+
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
+struct _SDL_GameController;
+typedef struct _SDL_GameController SDL_GameController;
+
+
+typedef enum
+{
+ SDL_CONTROLLER_BINDTYPE_NONE = 0,
+ SDL_CONTROLLER_BINDTYPE_BUTTON,
+ SDL_CONTROLLER_BINDTYPE_AXIS,
+ SDL_CONTROLLER_BINDTYPE_HAT
+} SDL_GameControllerBindType;
+
+/**
+ * Get the SDL joystick layer binding for this controller button/axis mapping
+ */
+typedef struct SDL_GameControllerButtonBind
+{
+ SDL_GameControllerBindType bindType;
+ union
+ {
+ int button;
+ int axis;
+ struct {
+ int hat;
+ int hat_mask;
+ } hat;
+ } value;
+
+} SDL_GameControllerButtonBind;
+
+
+/**
+ * To count the number of game controllers in the system for the following:
+ * int nJoysticks = SDL_NumJoysticks();
+ * int nGameControllers = 0;
+ * for (int i = 0; i < nJoysticks; i++) {
+ * if (SDL_IsGameController(i)) {
+ * nGameControllers++;
+ * }
+ * }
+ *
+ * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
+ * guid,name,mappings
+ *
+ * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
+ * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
+ * The mapping format for joystick is:
+ * bX - a joystick button, index X
+ * hX.Y - hat X with value Y
+ * aX - axis X of the joystick
+ * Buttons can be used as a controller axis and vice versa.
+ *
+ * This string shows an example of a valid mapping for a controller
+ * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
+ *
+ */
+
+/**
+ * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform()
+ * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
+ *
+ * If \c freerw is non-zero, the stream will be closed after being read.
+ *
+ * \return number of mappings added, -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
+
+/**
+ * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
+ *
+ * Convenience macro.
+ */
+#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
+
+/**
+ * Add or update an existing mapping configuration
+ *
+ * \return 1 if mapping is added, 0 if updated, -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
+
+/**
+ * Get the number of mappings installed
+ *
+ * \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ * Get the mapping at a particular index.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
+
+/**
+ * Get a mapping string for a GUID
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
+
+/**
+ * Get a mapping string for an open GameController
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller);
+
+/**
+ * Is the joystick on this index supported by the game controller interface?
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
+
+/**
+ * Get the implementation dependent name of a game controller.
+ * This can be called before any controllers are opened.
+ * If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
+
+/**
+ * Open a game controller for use.
+ * The index passed as an argument refers to the N'th game controller on the system.
+ * This index is not the value which will identify this controller in future
+ * controller events. The joystick's instance id (::SDL_JoystickID) will be
+ * used there instead.
+ *
+ * \return A controller identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
+
+/**
+ * Return the SDL_GameController associated with an instance id.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
+
+/**
+ * Return the name for this currently opened controller
+ */
+extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
+
+/**
+ * Get the USB vendor ID of an opened controller, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
+
+/**
+ * Get the USB product ID of an opened controller, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
+
+/**
+ * Get the product version of an opened controller, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
+
+/**
+ * Returns SDL_TRUE if the controller has been opened and currently connected,
+ * or SDL_FALSE if it has not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
+
+/**
+ * Get the underlying joystick object used by a controller
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
+
+/**
+ * Enable/disable controller event polling.
+ *
+ * If controller events are disabled, you must call SDL_GameControllerUpdate()
+ * yourself and check the state of the controller when you want controller
+ * information.
+ *
+ * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
+
+/**
+ * Update the current state of the open game controllers.
+ *
+ * This is called automatically by the event loop if any game controller
+ * events are enabled.
+ */
+extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
+
+
+/**
+ * The list of axes available from a controller
+ *
+ * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ * and are centered within ~8000 of zero, though advanced UI will allow users to set
+ * or autodetect the dead zone, which varies between controllers.
+ *
+ * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
+ */
+typedef enum
+{
+ SDL_CONTROLLER_AXIS_INVALID = -1,
+ SDL_CONTROLLER_AXIS_LEFTX,
+ SDL_CONTROLLER_AXIS_LEFTY,
+ SDL_CONTROLLER_AXIS_RIGHTX,
+ SDL_CONTROLLER_AXIS_RIGHTY,
+ SDL_CONTROLLER_AXIS_TRIGGERLEFT,
+ SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
+ SDL_CONTROLLER_AXIS_MAX
+} SDL_GameControllerAxis;
+
+/**
+ * turn this string into a axis mapping
+ */
+extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
+
+/**
+ * turn this axis enum into a string mapping
+ */
+extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
+
+/**
+ * Get the SDL joystick layer binding for this controller button mapping
+ */
+extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
+SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
+ SDL_GameControllerAxis axis);
+
+/**
+ * Get the current state of an axis control on a game controller.
+ *
+ * The state is a value ranging from -32768 to 32767 (except for the triggers,
+ * which range from 0 to 32767).
+ *
+ * The axis indices start at index 0.
+ */
+extern DECLSPEC Sint16 SDLCALL
+SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
+ SDL_GameControllerAxis axis);
+
+/**
+ * The list of buttons available from a controller
+ */
+typedef enum
+{
+ SDL_CONTROLLER_BUTTON_INVALID = -1,
+ SDL_CONTROLLER_BUTTON_A,
+ SDL_CONTROLLER_BUTTON_B,
+ SDL_CONTROLLER_BUTTON_X,
+ SDL_CONTROLLER_BUTTON_Y,
+ SDL_CONTROLLER_BUTTON_BACK,
+ SDL_CONTROLLER_BUTTON_GUIDE,
+ SDL_CONTROLLER_BUTTON_START,
+ SDL_CONTROLLER_BUTTON_LEFTSTICK,
+ SDL_CONTROLLER_BUTTON_RIGHTSTICK,
+ SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
+ SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
+ SDL_CONTROLLER_BUTTON_DPAD_UP,
+ SDL_CONTROLLER_BUTTON_DPAD_DOWN,
+ SDL_CONTROLLER_BUTTON_DPAD_LEFT,
+ SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
+ SDL_CONTROLLER_BUTTON_MAX
+} SDL_GameControllerButton;
+
+/**
+ * turn this string into a button mapping
+ */
+extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
+
+/**
+ * turn this button enum into a string mapping
+ */
+extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
+
+/**
+ * Get the SDL joystick layer binding for this controller button mapping
+ */
+extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
+SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
+ SDL_GameControllerButton button);
+
+
+/**
+ * Get the current state of a button on a game controller.
+ *
+ * The button indices start at index 0.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
+ SDL_GameControllerButton button);
+
+/**
+ * Close a controller previously opened with SDL_GameControllerOpen().
+ */
+extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_gamecontroller_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_gesture.h b/src/3rdparty/SDL2/include/SDL_gesture.h
new file mode 100644
index 0000000..b223d80
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_gesture.h
@@ -0,0 +1,87 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_gesture.h
+ *
+ * Include file for SDL gesture event handling.
+ */
+
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "SDL_touch.h"
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef Sint64 SDL_GestureID;
+
+/* Function prototypes */
+
+/**
+ * \brief Begin Recording a gesture on the specified touch, or all touches (-1)
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
+
+
+/**
+ * \brief Save all currently loaded Dollar Gesture templates
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
+
+/**
+ * \brief Save a currently loaded Dollar Gesture template
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
+
+
+/**
+ * \brief Load Dollar Gesture templates from a file
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_gesture_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_haptic.h b/src/3rdparty/SDL2/include/SDL_haptic.h
new file mode 100644
index 0000000..e3a2bca
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_haptic.h
@@ -0,0 +1,1227 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_haptic.h
+ *
+ * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
+ * devices.
+ *
+ * The basic usage is as follows:
+ * - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ * - Open a haptic device.
+ * - SDL_HapticOpen() to open from index.
+ * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
+ * - Create an effect (::SDL_HapticEffect).
+ * - Upload the effect with SDL_HapticNewEffect().
+ * - Run the effect with SDL_HapticRunEffect().
+ * - (optional) Free the effect with SDL_HapticDestroyEffect().
+ * - Close the haptic device with SDL_HapticClose().
+ *
+ * \par Simple rumble example:
+ * \code
+ * SDL_Haptic *haptic;
+ *
+ * // Open the device
+ * haptic = SDL_HapticOpen( 0 );
+ * if (haptic == NULL)
+ * return -1;
+ *
+ * // Initialize simple rumble
+ * if (SDL_HapticRumbleInit( haptic ) != 0)
+ * return -1;
+ *
+ * // Play effect at 50% strength for 2 seconds
+ * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
+ * return -1;
+ * SDL_Delay( 2000 );
+ *
+ * // Clean up
+ * SDL_HapticClose( haptic );
+ * \endcode
+ *
+ * \par Complete example:
+ * \code
+ * int test_haptic( SDL_Joystick * joystick ) {
+ * SDL_Haptic *haptic;
+ * SDL_HapticEffect effect;
+ * int effect_id;
+ *
+ * // Open the device
+ * haptic = SDL_HapticOpenFromJoystick( joystick );
+ * if (haptic == NULL) return -1; // Most likely joystick isn't haptic
+ *
+ * // See if it can do sine waves
+ * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
+ * SDL_HapticClose(haptic); // No sine effect
+ * return -1;
+ * }
+ *
+ * // Create the effect
+ * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
+ * effect.type = SDL_HAPTIC_SINE;
+ * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
+ * effect.periodic.direction.dir[0] = 18000; // Force comes from south
+ * effect.periodic.period = 1000; // 1000 ms
+ * effect.periodic.magnitude = 20000; // 20000/32767 strength
+ * effect.periodic.length = 5000; // 5 seconds long
+ * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
+ * effect.periodic.fade_length = 1000; // Takes 1 second to fade away
+ *
+ * // Upload the effect
+ * effect_id = SDL_HapticNewEffect( haptic, &effect );
+ *
+ * // Test the effect
+ * SDL_HapticRunEffect( haptic, effect_id, 1 );
+ * SDL_Delay( 5000); // Wait for the effect to finish
+ *
+ * // We destroy the effect, although closing the device also does this
+ * SDL_HapticDestroyEffect( haptic, effect_id );
+ *
+ * // Close the device
+ * SDL_HapticClose(haptic);
+ *
+ * return 0; // Success
+ * }
+ * \endcode
+ */
+
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_joystick.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \typedef SDL_Haptic
+ *
+ * \brief The haptic structure used to identify an SDL haptic.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticOpenFromJoystick
+ * \sa SDL_HapticClose
+ */
+struct _SDL_Haptic;
+typedef struct _SDL_Haptic SDL_Haptic;
+
+
+/**
+ * \name Haptic features
+ *
+ * Different haptic features a device can have.
+ */
+/* @{ */
+
+/**
+ * \name Haptic effects
+ */
+/* @{ */
+
+/**
+ * \brief Constant effect supported.
+ *
+ * Constant haptic effect.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_CONSTANT (1u<<0)
+
+/**
+ * \brief Sine wave effect supported.
+ *
+ * Periodic haptic effect that simulates sine waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SINE (1u<<1)
+
+/**
+ * \brief Left/Right effect supported.
+ *
+ * Haptic effect for direct control over high/low frequency motors.
+ *
+ * \sa SDL_HapticLeftRight
+ * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
+ * we ran out of bits, and this is important for XInput devices.
+ */
+#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
+
+/* !!! FIXME: put this back when we have more bits in 2.1 */
+/* #define SDL_HAPTIC_SQUARE (1<<2) */
+
+/**
+ * \brief Triangle wave effect supported.
+ *
+ * Periodic haptic effect that simulates triangular waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_TRIANGLE (1u<<3)
+
+/**
+ * \brief Sawtoothup wave effect supported.
+ *
+ * Periodic haptic effect that simulates saw tooth up waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
+
+/**
+ * \brief Sawtoothdown wave effect supported.
+ *
+ * Periodic haptic effect that simulates saw tooth down waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
+
+/**
+ * \brief Ramp effect supported.
+ *
+ * Ramp haptic effect.
+ *
+ * \sa SDL_HapticRamp
+ */
+#define SDL_HAPTIC_RAMP (1u<<6)
+
+/**
+ * \brief Spring effect supported - uses axes position.
+ *
+ * Condition haptic effect that simulates a spring. Effect is based on the
+ * axes position.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_SPRING (1u<<7)
+
+/**
+ * \brief Damper effect supported - uses axes velocity.
+ *
+ * Condition haptic effect that simulates dampening. Effect is based on the
+ * axes velocity.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_DAMPER (1u<<8)
+
+/**
+ * \brief Inertia effect supported - uses axes acceleration.
+ *
+ * Condition haptic effect that simulates inertia. Effect is based on the axes
+ * acceleration.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_INERTIA (1u<<9)
+
+/**
+ * \brief Friction effect supported - uses axes movement.
+ *
+ * Condition haptic effect that simulates friction. Effect is based on the
+ * axes movement.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_FRICTION (1u<<10)
+
+/**
+ * \brief Custom effect is supported.
+ *
+ * User defined custom haptic effect.
+ */
+#define SDL_HAPTIC_CUSTOM (1u<<11)
+
+/* @} *//* Haptic effects */
+
+/* These last few are features the device has, not effects */
+
+/**
+ * \brief Device can set global gain.
+ *
+ * Device supports setting the global gain.
+ *
+ * \sa SDL_HapticSetGain
+ */
+#define SDL_HAPTIC_GAIN (1u<<12)
+
+/**
+ * \brief Device can set autocenter.
+ *
+ * Device supports setting autocenter.
+ *
+ * \sa SDL_HapticSetAutocenter
+ */
+#define SDL_HAPTIC_AUTOCENTER (1u<<13)
+
+/**
+ * \brief Device can be queried for effect status.
+ *
+ * Device supports querying effect status.
+ *
+ * \sa SDL_HapticGetEffectStatus
+ */
+#define SDL_HAPTIC_STATUS (1u<<14)
+
+/**
+ * \brief Device can be paused.
+ *
+ * Devices supports being paused.
+ *
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticUnpause
+ */
+#define SDL_HAPTIC_PAUSE (1u<<15)
+
+
+/**
+ * \name Direction encodings
+ */
+/* @{ */
+
+/**
+ * \brief Uses polar coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_POLAR 0
+
+/**
+ * \brief Uses cartesian coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_CARTESIAN 1
+
+/**
+ * \brief Uses spherical coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_SPHERICAL 2
+
+/* @} *//* Direction encodings */
+
+/* @} *//* Haptic features */
+
+/*
+ * Misc defines.
+ */
+
+/**
+ * \brief Used to play a device an infinite number of times.
+ *
+ * \sa SDL_HapticRunEffect
+ */
+#define SDL_HAPTIC_INFINITY 4294967295U
+
+
+/**
+ * \brief Structure that represents a haptic direction.
+ *
+ * This is the direction where the force comes from,
+ * instead of the direction in which the force is exerted.
+ *
+ * Directions can be specified by:
+ * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
+ * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
+ * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
+ *
+ * Cardinal directions of the haptic device are relative to the positioning
+ * of the device. North is considered to be away from the user.
+ *
+ * The following diagram represents the cardinal directions:
+ * \verbatim
+ .--.
+ |__| .-------.
+ |=.| |.-----.|
+ |--| || ||
+ | | |'-----'|
+ |__|~')_____('
+ [ COMPUTER ]
+
+
+ North (0,-1)
+ ^
+ |
+ |
+ (-1,0) West <----[ HAPTIC ]----> East (1,0)
+ |
+ |
+ v
+ South (0,1)
+
+
+ [ USER ]
+ \|||/
+ (o o)
+ ---ooO-(_)-Ooo---
+ \endverbatim
+ *
+ * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
+ * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
+ * the first \c dir parameter. The cardinal directions would be:
+ * - North: 0 (0 degrees)
+ * - East: 9000 (90 degrees)
+ * - South: 18000 (180 degrees)
+ * - West: 27000 (270 degrees)
+ *
+ * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
+ * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
+ * the first three \c dir parameters. The cardinal directions would be:
+ * - North: 0,-1, 0
+ * - East: 1, 0, 0
+ * - South: 0, 1, 0
+ * - West: -1, 0, 0
+ *
+ * The Z axis represents the height of the effect if supported, otherwise
+ * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
+ * can use any multiple you want, only the direction matters.
+ *
+ * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
+ * The first two \c dir parameters are used. The \c dir parameters are as
+ * follows (all values are in hundredths of degrees):
+ * - Degrees from (1, 0) rotated towards (0, 1).
+ * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
+ *
+ *
+ * Example of force coming from the south with all encodings (force coming
+ * from the south means the user will have to pull the stick to counteract):
+ * \code
+ * SDL_HapticDirection direction;
+ *
+ * // Cartesian directions
+ * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
+ * direction.dir[0] = 0; // X position
+ * direction.dir[1] = 1; // Y position
+ * // Assuming the device has 2 axes, we don't need to specify third parameter.
+ *
+ * // Polar directions
+ * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
+ * direction.dir[0] = 18000; // Polar only uses first parameter
+ *
+ * // Spherical coordinates
+ * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
+ * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
+ * \endcode
+ *
+ * \sa SDL_HAPTIC_POLAR
+ * \sa SDL_HAPTIC_CARTESIAN
+ * \sa SDL_HAPTIC_SPHERICAL
+ * \sa SDL_HapticEffect
+ * \sa SDL_HapticNumAxes
+ */
+typedef struct SDL_HapticDirection
+{
+ Uint8 type; /**< The type of encoding. */
+ Sint32 dir[3]; /**< The encoded direction. */
+} SDL_HapticDirection;
+
+
+/**
+ * \brief A structure containing a template for a Constant effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
+ *
+ * A constant effect applies a constant force in the specified direction
+ * to the joystick.
+ *
+ * \sa SDL_HAPTIC_CONSTANT
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticConstant
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Constant */
+ Sint16 level; /**< Strength of the constant effect. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticConstant;
+
+/**
+ * \brief A structure containing a template for a Periodic effect.
+ *
+ * The struct handles the following effects:
+ * - ::SDL_HAPTIC_SINE
+ * - ::SDL_HAPTIC_LEFTRIGHT
+ * - ::SDL_HAPTIC_TRIANGLE
+ * - ::SDL_HAPTIC_SAWTOOTHUP
+ * - ::SDL_HAPTIC_SAWTOOTHDOWN
+ *
+ * A periodic effect consists in a wave-shaped effect that repeats itself
+ * over time. The type determines the shape of the wave and the parameters
+ * determine the dimensions of the wave.
+ *
+ * Phase is given by hundredth of a degree meaning that giving the phase a value
+ * of 9000 will displace it 25% of its period. Here are sample values:
+ * - 0: No phase displacement.
+ * - 9000: Displaced 25% of its period.
+ * - 18000: Displaced 50% of its period.
+ * - 27000: Displaced 75% of its period.
+ * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
+ *
+ * Examples:
+ * \verbatim
+ SDL_HAPTIC_SINE
+ __ __ __ __
+ / \ / \ / \ /
+ / \__/ \__/ \__/
+
+ SDL_HAPTIC_SQUARE
+ __ __ __ __ __
+ | | | | | | | | | |
+ | |__| |__| |__| |__| |
+
+ SDL_HAPTIC_TRIANGLE
+ /\ /\ /\ /\ /\
+ / \ / \ / \ / \ /
+ / \/ \/ \/ \/
+
+ SDL_HAPTIC_SAWTOOTHUP
+ /| /| /| /| /| /| /|
+ / | / | / | / | / | / | / |
+ / |/ |/ |/ |/ |/ |/ |
+
+ SDL_HAPTIC_SAWTOOTHDOWN
+ \ |\ |\ |\ |\ |\ |\ |
+ \ | \ | \ | \ | \ | \ | \ |
+ \| \| \| \| \| \| \|
+ \endverbatim
+ *
+ * \sa SDL_HAPTIC_SINE
+ * \sa SDL_HAPTIC_LEFTRIGHT
+ * \sa SDL_HAPTIC_TRIANGLE
+ * \sa SDL_HAPTIC_SAWTOOTHUP
+ * \sa SDL_HAPTIC_SAWTOOTHDOWN
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticPeriodic
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
+ ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
+ ::SDL_HAPTIC_SAWTOOTHDOWN */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Periodic */
+ Uint16 period; /**< Period of the wave. */
+ Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
+ Sint16 offset; /**< Mean value of the wave. */
+ Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticPeriodic;
+
+/**
+ * \brief A structure containing a template for a Condition effect.
+ *
+ * The struct handles the following effects:
+ * - ::SDL_HAPTIC_SPRING: Effect based on axes position.
+ * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
+ * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
+ * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
+ *
+ * Direction is handled by condition internals instead of a direction member.
+ * The condition effect specific members have three parameters. The first
+ * refers to the X axis, the second refers to the Y axis and the third
+ * refers to the Z axis. The right terms refer to the positive side of the
+ * axis and the left terms refer to the negative side of the axis. Please
+ * refer to the ::SDL_HapticDirection diagram for which side is positive and
+ * which is negative.
+ *
+ * \sa SDL_HapticDirection
+ * \sa SDL_HAPTIC_SPRING
+ * \sa SDL_HAPTIC_DAMPER
+ * \sa SDL_HAPTIC_INERTIA
+ * \sa SDL_HAPTIC_FRICTION
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticCondition
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
+ ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
+ SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Condition */
+ Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */
+ Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */
+ Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
+ Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
+ Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
+ Sint16 center[3]; /**< Position of the dead zone. */
+} SDL_HapticCondition;
+
+/**
+ * \brief A structure containing a template for a Ramp effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
+ *
+ * The ramp effect starts at start strength and ends at end strength.
+ * It augments in linear fashion. If you use attack and fade with a ramp
+ * the effects get added to the ramp effect making the effect become
+ * quadratic instead of linear.
+ *
+ * \sa SDL_HAPTIC_RAMP
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticRamp
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_RAMP */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Ramp */
+ Sint16 start; /**< Beginning strength level. */
+ Sint16 end; /**< Ending strength level. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticRamp;
+
+/**
+ * \brief A structure containing a template for a Left/Right effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
+ *
+ * The Left/Right effect is used to explicitly control the large and small
+ * motors, commonly found in modern game controllers. One motor is high
+ * frequency, the other is low frequency.
+ *
+ * \sa SDL_HAPTIC_LEFTRIGHT
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticLeftRight
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+
+ /* Rumble */
+ Uint16 large_magnitude; /**< Control of the large controller motor. */
+ Uint16 small_magnitude; /**< Control of the small controller motor. */
+} SDL_HapticLeftRight;
+
+/**
+ * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
+ * A custom force feedback effect is much like a periodic effect, where the
+ * application can define its exact shape. You will have to allocate the
+ * data yourself. Data should consist of channels * samples Uint16 samples.
+ *
+ * If channels is one, the effect is rotated using the defined direction.
+ * Otherwise it uses the samples in data for the different axes.
+ *
+ * \sa SDL_HAPTIC_CUSTOM
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticCustom
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Custom */
+ Uint8 channels; /**< Axes to use, minimum of one. */
+ Uint16 period; /**< Sample periods. */
+ Uint16 samples; /**< Amount of samples. */
+ Uint16 *data; /**< Should contain channels*samples items. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticCustom;
+
+/**
+ * \brief The generic template for any haptic effect.
+ *
+ * All values max at 32767 (0x7FFF). Signed values also can be negative.
+ * Time values unless specified otherwise are in milliseconds.
+ *
+ * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
+ * value. Neither delay, interval, attack_length nor fade_length support
+ * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
+ *
+ * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
+ * ::SDL_HAPTIC_INFINITY.
+ *
+ * Button triggers may not be supported on all devices, it is advised to not
+ * use them if possible. Buttons start at index 1 instead of index 0 like
+ * the joystick.
+ *
+ * If both attack_length and fade_level are 0, the envelope is not used,
+ * otherwise both values are used.
+ *
+ * Common parts:
+ * \code
+ * // Replay - All effects have this
+ * Uint32 length; // Duration of effect (ms).
+ * Uint16 delay; // Delay before starting effect.
+ *
+ * // Trigger - All effects have this
+ * Uint16 button; // Button that triggers effect.
+ * Uint16 interval; // How soon before effect can be triggered again.
+ *
+ * // Envelope - All effects except condition effects have this
+ * Uint16 attack_length; // Duration of the attack (ms).
+ * Uint16 attack_level; // Level at the start of the attack.
+ * Uint16 fade_length; // Duration of the fade out (ms).
+ * Uint16 fade_level; // Level at the end of the fade.
+ * \endcode
+ *
+ *
+ * Here we have an example of a constant effect evolution in time:
+ * \verbatim
+ Strength
+ ^
+ |
+ | effect level --> _________________
+ | / \
+ | / \
+ | / \
+ | / \
+ | attack_level --> | \
+ | | | <--- fade_level
+ |
+ +--------------------------------------------------> Time
+ [--] [---]
+ attack_length fade_length
+
+ [------------------][-----------------------]
+ delay length
+ \endverbatim
+ *
+ * Note either the attack_level or the fade_level may be above the actual
+ * effect level.
+ *
+ * \sa SDL_HapticConstant
+ * \sa SDL_HapticPeriodic
+ * \sa SDL_HapticCondition
+ * \sa SDL_HapticRamp
+ * \sa SDL_HapticLeftRight
+ * \sa SDL_HapticCustom
+ */
+typedef union SDL_HapticEffect
+{
+ /* Common for all force feedback effects */
+ Uint16 type; /**< Effect type. */
+ SDL_HapticConstant constant; /**< Constant effect. */
+ SDL_HapticPeriodic periodic; /**< Periodic effect. */
+ SDL_HapticCondition condition; /**< Condition effect. */
+ SDL_HapticRamp ramp; /**< Ramp effect. */
+ SDL_HapticLeftRight leftright; /**< Left/Right effect. */
+ SDL_HapticCustom custom; /**< Custom effect. */
+} SDL_HapticEffect;
+
+
+/* Function prototypes */
+/**
+ * \brief Count the number of haptic devices attached to the system.
+ *
+ * \return Number of haptic devices detected on the system.
+ */
+extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
+
+/**
+ * \brief Get the implementation dependent name of a haptic device.
+ *
+ * This can be called before any joysticks are opened.
+ * If no name can be found, this function returns NULL.
+ *
+ * \param device_index Index of the device to get its name.
+ * \return Name of the device or NULL on error.
+ *
+ * \sa SDL_NumHaptics
+ */
+extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
+
+/**
+ * \brief Opens a haptic device for use.
+ *
+ * The index passed as an argument refers to the N'th haptic device on this
+ * system.
+ *
+ * When opening a haptic device, its gain will be set to maximum and
+ * autocenter will be disabled. To modify these values use
+ * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
+ *
+ * \param device_index Index of the device to open.
+ * \return Device identifier or NULL on error.
+ *
+ * \sa SDL_HapticIndex
+ * \sa SDL_HapticOpenFromMouse
+ * \sa SDL_HapticOpenFromJoystick
+ * \sa SDL_HapticClose
+ * \sa SDL_HapticSetGain
+ * \sa SDL_HapticSetAutocenter
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticStopAll
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
+
+/**
+ * \brief Checks if the haptic device at index has been opened.
+ *
+ * \param device_index Index to check to see if it has been opened.
+ * \return 1 if it has been opened or 0 if it hasn't.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticIndex
+ */
+extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
+
+/**
+ * \brief Gets the index of a haptic device.
+ *
+ * \param haptic Haptic device to get the index of.
+ * \return The index of the haptic device or -1 on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticOpened
+ */
+extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
+
+/**
+ * \brief Gets whether or not the current mouse has haptic capabilities.
+ *
+ * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
+ *
+ * \sa SDL_HapticOpenFromMouse
+ */
+extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
+
+/**
+ * \brief Tries to open a haptic device from the current mouse.
+ *
+ * \return The haptic device identifier or NULL on error.
+ *
+ * \sa SDL_MouseIsHaptic
+ * \sa SDL_HapticOpen
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
+
+/**
+ * \brief Checks to see if a joystick has haptic features.
+ *
+ * \param joystick Joystick to test for haptic capabilities.
+ * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ * or -1 if an error occurred.
+ *
+ * \sa SDL_HapticOpenFromJoystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
+
+/**
+ * \brief Opens a haptic device for use from a joystick device.
+ *
+ * You must still close the haptic device separately. It will not be closed
+ * with the joystick.
+ *
+ * When opening from a joystick you should first close the haptic device before
+ * closing the joystick device. If not, on some implementations the haptic
+ * device will also get unallocated and you'll be unable to use force feedback
+ * on that device.
+ *
+ * \param joystick Joystick to create a haptic device from.
+ * \return A valid haptic device identifier on success or NULL on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticClose
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
+ joystick);
+
+/**
+ * \brief Closes a haptic device previously opened with SDL_HapticOpen().
+ *
+ * \param haptic Haptic device to close.
+ */
+extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
+
+/**
+ * \brief Returns the number of effects a haptic device can store.
+ *
+ * On some platforms this isn't fully supported, and therefore is an
+ * approximation. Always check to see if your created effect was actually
+ * created and do not rely solely on SDL_HapticNumEffects().
+ *
+ * \param haptic The haptic device to query effect max.
+ * \return The number of effects the haptic device can store or
+ * -1 on error.
+ *
+ * \sa SDL_HapticNumEffectsPlaying
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
+
+/**
+ * \brief Returns the number of effects a haptic device can play at the same
+ * time.
+ *
+ * This is not supported on all platforms, but will always return a value.
+ * Added here for the sake of completeness.
+ *
+ * \param haptic The haptic device to query maximum playing effects.
+ * \return The number of effects the haptic device can play at the same time
+ * or -1 on error.
+ *
+ * \sa SDL_HapticNumEffects
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
+
+/**
+ * \brief Gets the haptic device's supported features in bitwise manner.
+ *
+ * Example:
+ * \code
+ * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
+ * printf("We have constant haptic effect!\n");
+ * }
+ * \endcode
+ *
+ * \param haptic The haptic device to query.
+ * \return Haptic features in bitwise manner (OR'd).
+ *
+ * \sa SDL_HapticNumEffects
+ * \sa SDL_HapticEffectSupported
+ */
+extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
+
+
+/**
+ * \brief Gets the number of haptic axes the device has.
+ *
+ * \sa SDL_HapticDirection
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
+
+/**
+ * \brief Checks to see if effect is supported by haptic.
+ *
+ * \param haptic Haptic device to check on.
+ * \param effect Effect to check to see if it is supported.
+ * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ * \sa SDL_HapticNewEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
+ SDL_HapticEffect *
+ effect);
+
+/**
+ * \brief Creates a new haptic effect on the device.
+ *
+ * \param haptic Haptic device to create the effect on.
+ * \param effect Properties of the effect to create.
+ * \return The identifier of the effect on success or -1 on error.
+ *
+ * \sa SDL_HapticUpdateEffect
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
+ SDL_HapticEffect * effect);
+
+/**
+ * \brief Updates the properties of an effect.
+ *
+ * Can be used dynamically, although behavior when dynamically changing
+ * direction may be strange. Specifically the effect may reupload itself
+ * and start playing from the start. You cannot change the type either when
+ * running SDL_HapticUpdateEffect().
+ *
+ * \param haptic Haptic device that has the effect.
+ * \param effect Identifier of the effect to update.
+ * \param data New effect properties to use.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticNewEffect
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
+ int effect,
+ SDL_HapticEffect * data);
+
+/**
+ * \brief Runs the haptic effect on its associated haptic device.
+ *
+ * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
+ * repeating the envelope (attack and fade) every time. If you only want the
+ * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
+ * parameter.
+ *
+ * \param haptic Haptic device to run the effect on.
+ * \param effect Identifier of the haptic effect to run.
+ * \param iterations Number of iterations to run the effect. Use
+ * ::SDL_HAPTIC_INFINITY for infinity.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticStopEffect
+ * \sa SDL_HapticDestroyEffect
+ * \sa SDL_HapticGetEffectStatus
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
+ int effect,
+ Uint32 iterations);
+
+/**
+ * \brief Stops the haptic effect on its associated haptic device.
+ *
+ * \param haptic Haptic device to stop the effect on.
+ * \param effect Identifier of the effect to stop.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Destroys a haptic effect on the device.
+ *
+ * This will stop the effect if it's running. Effects are automatically
+ * destroyed when the device is closed.
+ *
+ * \param haptic Device to destroy the effect on.
+ * \param effect Identifier of the effect to destroy.
+ *
+ * \sa SDL_HapticNewEffect
+ */
+extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Gets the status of the current effect on the haptic device.
+ *
+ * Device must support the ::SDL_HAPTIC_STATUS feature.
+ *
+ * \param haptic Haptic device to query the effect status on.
+ * \param effect Identifier of the effect to query its status.
+ * \return 0 if it isn't playing, 1 if it is playing or -1 on error.
+ *
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticStopEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Sets the global gain of the device.
+ *
+ * Device must support the ::SDL_HAPTIC_GAIN feature.
+ *
+ * The user may specify the maximum gain by setting the environment variable
+ * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
+ * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
+ * maximum.
+ *
+ * \param haptic Haptic device to set the gain on.
+ * \param gain Value to set the gain to, should be between 0 and 100.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
+
+/**
+ * \brief Sets the global autocenter of the device.
+ *
+ * Autocenter should be between 0 and 100. Setting it to 0 will disable
+ * autocentering.
+ *
+ * Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
+ *
+ * \param haptic Haptic device to set autocentering on.
+ * \param autocenter Value to set autocenter to, 0 disables autocentering.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
+ int autocenter);
+
+/**
+ * \brief Pauses a haptic device.
+ *
+ * Device must support the ::SDL_HAPTIC_PAUSE feature. Call
+ * SDL_HapticUnpause() to resume playback.
+ *
+ * Do not modify the effects nor add new ones while the device is paused.
+ * That can cause all sorts of weird errors.
+ *
+ * \param haptic Haptic device to pause.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticUnpause
+ */
+extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
+
+/**
+ * \brief Unpauses a haptic device.
+ *
+ * Call to unpause after SDL_HapticPause().
+ *
+ * \param haptic Haptic device to unpause.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticPause
+ */
+extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
+
+/**
+ * \brief Stops all the currently playing effects on a haptic device.
+ *
+ * \param haptic Haptic device to stop.
+ * \return 0 on success or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
+
+/**
+ * \brief Checks to see if rumble is supported on a haptic device.
+ *
+ * \param haptic Haptic device to check to see if it supports rumble.
+ * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
+ *
+ * \sa SDL_HapticRumbleInit
+ * \sa SDL_HapticRumblePlay
+ * \sa SDL_HapticRumbleStop
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
+
+/**
+ * \brief Initializes the haptic device for simple rumble playback.
+ *
+ * \param haptic Haptic device to initialize for simple rumble playback.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticRumbleSupported
+ * \sa SDL_HapticRumblePlay
+ * \sa SDL_HapticRumbleStop
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
+
+/**
+ * \brief Runs simple rumble on a haptic device
+ *
+ * \param haptic Haptic device to play rumble effect on.
+ * \param strength Strength of the rumble to play as a 0-1 float value.
+ * \param length Length of the rumble to play in milliseconds.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRumbleSupported
+ * \sa SDL_HapticRumbleInit
+ * \sa SDL_HapticRumbleStop
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
+
+/**
+ * \brief Stops the simple rumble on a haptic device.
+ *
+ * \param haptic Haptic to stop the rumble on.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRumbleSupported
+ * \sa SDL_HapticRumbleInit
+ * \sa SDL_HapticRumblePlay
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_haptic_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_hints.h b/src/3rdparty/SDL2/include/SDL_hints.h
new file mode 100644
index 0000000..3834640
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_hints.h
@@ -0,0 +1,1022 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_hints.h
+ *
+ * Official documentation for SDL configuration variables
+ *
+ * This file contains functions to set and get configuration hints,
+ * as well as listing each of them alphabetically.
+ *
+ * The convention for naming hints is SDL_HINT_X, where "SDL_X" is
+ * the environment variable that can be used to override the default.
+ *
+ * In general these hints are just that - they may or may not be
+ * supported or applicable on any given platform, but they provide
+ * a way for an application or user to give the library a hint as
+ * to how they would like the library to work.
+ */
+
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
+ *
+ * SDL can try to accelerate the SDL screen surface by using streaming
+ * textures with a 3D rendering engine. This variable controls whether and
+ * how this is done.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable 3D acceleration
+ * "1" - Enable 3D acceleration, using the default renderer.
+ * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
+ *
+ * By default SDL tries to make a best guess for each platform whether
+ * to use acceleration or not.
+ */
+#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
+
+/**
+ * \brief A variable specifying which render driver to use.
+ *
+ * If the application doesn't pick a specific renderer to use, this variable
+ * specifies the name of the preferred renderer. If the preferred renderer
+ * can't be initialized, the normal default renderer is used.
+ *
+ * This variable is case insensitive and can be set to the following values:
+ * "direct3d"
+ * "opengl"
+ * "opengles2"
+ * "opengles"
+ * "metal"
+ * "software"
+ *
+ * The default varies by platform, but it's the first one in the list that
+ * is available on the current platform.
+ */
+#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
+
+/**
+ * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable shaders
+ * "1" - Enable shaders
+ *
+ * By default shaders are used if OpenGL supports them.
+ */
+#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
+
+/**
+ * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations.
+ *
+ * This variable can be set to the following values:
+ * "0" - Thread-safety is not enabled (faster)
+ * "1" - Thread-safety is enabled
+ *
+ * By default the Direct3D device is created with thread-safety disabled.
+ */
+#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
+
+/**
+ * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer.
+ *
+ * This variable does not have any effect on the Direct3D 9 based renderer.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable Debug Layer use
+ * "1" - Enable Debug Layer use
+ *
+ * By default, SDL does not use Direct3D Debug Layer.
+ */
+#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
+
+/**
+ * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ * This variable can be set to the following values:
+ * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ * By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
+
+/**
+ * \brief A variable controlling the scaling quality
+ *
+ * This variable can be set to the following values:
+ * "0" or "nearest" - Nearest pixel sampling
+ * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
+ * "2" or "best" - Currently this is the same as "linear"
+ *
+ * By default nearest pixel sampling is used
+ */
+#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
+
+/**
+ * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable vsync
+ * "1" - Enable vsync
+ *
+ * By default SDL does not sync screen surface updates with vertical refresh.
+ */
+#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
+
+/**
+ * \brief A variable controlling whether the screensaver is enabled.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable screensaver
+ * "1" - Enable screensaver
+ *
+ * By default SDL will disable the screensaver.
+ */
+#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
+
+/**
+ * \brief A variable controlling whether the X11 VidMode extension should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable XVidMode
+ * "1" - Enable XVidMode
+ *
+ * By default SDL will use XVidMode if it is available.
+ */
+#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE"
+
+/**
+ * \brief A variable controlling whether the X11 Xinerama extension should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable Xinerama
+ * "1" - Enable Xinerama
+ *
+ * By default SDL will use Xinerama if it is available.
+ */
+#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA"
+
+/**
+ * \brief A variable controlling whether the X11 XRandR extension should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable XRandR
+ * "1" - Enable XRandR
+ *
+ * By default SDL will not use XRandR because of window manager issues.
+ */
+#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
+
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_PING
+ * "1" - Enable _NET_WM_PING
+ *
+ * By default SDL will use _NET_WM_PING, but for applications that know they
+ * will not always be able to respond to ping requests in a timely manner they can
+ * turn it off to avoid the window manager thinking the app is hung.
+ * The hint is checked in CreateWindow.
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
+
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
+ * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
+ *
+ * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
+ *
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
+
+/**
+ * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
+ *
+ * This variable can be set to the following values:
+ * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
+ * "1" - The window frame is interactive when the cursor is hidden
+ *
+ * By default SDL will allow interaction with the window frame when the cursor is hidden
+ */
+#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
+
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
+/**
+ * \brief A variable controlling whether the windows message loop is processed by SDL
+ *
+ * This variable can be set to the following values:
+ * "0" - The window message loop is not run
+ * "1" - The window message loop is processed in SDL_PumpEvents()
+ *
+ * By default SDL will process the windows message loop
+ */
+#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP"
+
+/**
+ * \brief A variable controlling whether grabbing input grabs the keyboard
+ *
+ * This variable can be set to the following values:
+ * "0" - Grab will affect only the mouse
+ * "1" - Grab will affect mouse and keyboard
+ *
+ * By default SDL will not grab the keyboard so system shortcuts still work.
+ */
+#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
+
+/**
+ * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
+/**
+ * \brief A variable controlling whether relative mouse mode is implemented using mouse warping
+ *
+ * This variable can be set to the following values:
+ * "0" - Relative mouse mode uses raw input
+ * "1" - Relative mouse mode uses mouse warping
+ *
+ * By default SDL will use raw input for relative mouse mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP"
+
+/**
+ * \brief Allow mouse click events when clicking to focus an SDL window
+ *
+ * This variable can be set to the following values:
+ * "0" - Ignore mouse clicks that activate a window
+ * "1" - Generate events for mouse clicks that activate a window
+ *
+ * By default SDL will ignore mouse clicks that activate a window
+ */
+#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
+
+/**
+ * \brief A variable controlling whether touch events should generate synthetic mouse events
+ *
+ * This variable can be set to the following values:
+ * "0" - Touch events will not generate mouse events
+ * "1" - Touch events will generate mouse events
+ *
+ * By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
+
+/**
+ * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
+ *
+ */
+#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
+
+/**
+ * \brief A variable controlling whether the idle timer is disabled on iOS.
+ *
+ * When an iOS app does not receive touches for some time, the screen is
+ * dimmed automatically. For games where the accelerometer is the only input
+ * this is problematic. This functionality can be disabled by setting this
+ * hint.
+ *
+ * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver()
+ * accomplish the same thing on iOS. They should be preferred over this hint.
+ *
+ * This variable can be set to the following values:
+ * "0" - Enable idle timer
+ * "1" - Disable idle timer
+ */
+#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
+
+/**
+ * \brief A variable controlling which orientations are allowed on iOS.
+ *
+ * In some circumstances it is necessary to be able to explicitly control
+ * which UI orientations are allowed.
+ *
+ * This variable is a space delimited list of the following values:
+ * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
+ */
+#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
+
+/**
+ * \brief A variable controlling whether controllers used with the Apple TV
+ * generate UI events.
+ *
+ * When UI events are generated by controller input, the app will be
+ * backgrounded when the Apple TV remote's menu button is pressed, and when the
+ * pause or B buttons on gamepads are pressed.
+ *
+ * More information about properly making use of controllers for the Apple TV
+ * can be found here:
+ * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/
+ *
+ * This variable can be set to the following values:
+ * "0" - Controller input does not generate UI events (the default).
+ * "1" - Controller input generates UI events.
+ */
+#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS"
+
+/**
+ * \brief A variable controlling whether the Apple TV remote's joystick axes
+ * will automatically match the rotation of the remote.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remote orientation does not affect joystick axes (the default).
+ * "1" - Joystick axes are based on the orientation of the remote.
+ */
+#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
+
+/**
+ * \brief A variable controlling whether the home indicator bar on iPhone X
+ * should be hidden.
+ *
+ * This variable can be set to the following values:
+ * "0" - The indicator bar is not hidden (default for windowed applications)
+ * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
+ * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
+ */
+#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR"
+
+/**
+ * \brief A variable controlling whether the Android / iOS built-in
+ * accelerometer should be listed as a joystick device.
+ *
+ * This variable can be set to the following values:
+ * "0" - The accelerometer is not listed as a joystick
+ * "1" - The accelerometer is available as a 3 axis joystick (the default).
+ */
+#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
+
+/**
+ * \brief A variable controlling whether the Android / tvOS remotes
+ * should be listed as joystick devices, instead of sending keyboard events.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remotes send enter/escape/arrow key events
+ * "1" - Remotes are available as 2 axis, 2 button joysticks (the default).
+ */
+#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
+
+/**
+ * \brief A variable that lets you disable the detection and use of Xinput gamepad devices
+ *
+ * The variable can be set to the following values:
+ * "0" - Disable XInput detection (only uses direct input)
+ * "1" - Enable XInput detection (the default)
+ */
+#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
+
+/**
+ * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
+ *
+ * This hint is for backwards compatibility only and will be removed in SDL 2.1
+ *
+ * The default value is "0". This hint must be set before SDL_Init()
+ */
+#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
+
+/**
+ * \brief A variable that lets you manually hint extra gamecontroller db entries.
+ *
+ * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
+ *
+ * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
+ * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
+ */
+#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
+
+/**
+ * \brief A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
+
+/**
+ * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
+ *
+ * The variable can be set to the following values:
+ * "0" - Disable joystick & gamecontroller input events when the
+ * application is in the background.
+ * "1" - Enable joystick & gamecontroller input events when the
+ * application is in the background.
+ *
+ * The default value is "0". This hint may be set at any time.
+ */
+#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
+
+/**
+ * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
+ * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
+ *
+ * This variable can be set to the following values:
+ * "0" - don't allow topmost
+ * "1" - allow topmost
+ */
+#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
+
+/**
+ * \brief A variable that controls the timer resolution, in milliseconds.
+ *
+ * The higher resolution the timer, the more frequently the CPU services
+ * timer interrupts, and the more precise delays are, but this takes up
+ * power and CPU time. This hint is only used on Windows 7 and earlier.
+ *
+ * See this blog post for more information:
+ * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
+ *
+ * If this variable is set to "0", the system timer resolution is not set.
+ *
+ * The default value is "1". This hint may be set at any time.
+ */
+#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
+
+
+/**
+ * \brief A variable describing the content orientation on QtWayland-based platforms.
+ *
+ * On QtWayland platforms, windows are rotated client-side to allow for custom
+ * transitions. In order to correctly position overlays (e.g. volume bar) and
+ * gestures (e.g. events view, close/minimize gestures), the system needs to
+ * know in which orientation the application is currently drawing its contents.
+ *
+ * This does not cause the window to be rotated or resized, the application
+ * needs to take care of drawing the content in the right orientation (the
+ * framebuffer is always in portrait mode).
+ *
+ * This variable can be one of the following values:
+ * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
+ */
+#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
+
+/**
+ * \brief Flags to set on QtWayland windows to integrate with the native window manager.
+ *
+ * On QtWayland platforms, this hint controls the flags to set on the windows.
+ * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
+ *
+ * This variable is a space-separated list of the following values (empty = no flags):
+ * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
+ */
+#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
+
+/**
+* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
+*
+* Use this hint in case you need to set SDL's threads stack size to other than the default.
+* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
+* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
+* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
+*/
+#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
+
+/**
+ * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
+ */
+#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
+
+/**
+ * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac
+ *
+ * If present, holding ctrl while left clicking will generate a right click
+ * event when on Mac.
+ */
+#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
+
+/**
+* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
+*
+* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It
+* can use two different sets of binaries, those compiled by the user from source
+* or those provided by the Chrome browser. In the later case, these binaries require
+* that SDL loads a DLL providing the shader compiler.
+*
+* This variable can be set to the following values:
+* "d3dcompiler_46.dll" - default, best for Vista or later.
+* "d3dcompiler_43.dll" - for XP support.
+* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.
+*
+*/
+#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER"
+
+/**
+* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
+*
+* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
+* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
+* created SDL_Window:
+*
+* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
+* needed for example when sharing an OpenGL context across multiple windows.
+*
+* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for
+* OpenGL rendering.
+*
+* This variable can be set to the following values:
+* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should
+* share a pixel format with.
+*/
+#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
+
+/**
+ * \brief A URL to a WinRT app's privacy policy
+ *
+ * All network-enabled WinRT apps must make a privacy policy available to its
+ * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
+ * be available in the Windows Settings charm, as accessed from within the app.
+ * SDL provides code to add a URL-based link there, which can point to the app's
+ * privacy policy.
+ *
+ * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
+ * before calling any SDL_Init() functions. The contents of the hint should
+ * be a valid URL. For example, "http://www.example.com".
+ *
+ * The default value is "", which will prevent SDL from adding a privacy policy
+ * link to the Settings charm. This hint should only be set during app init.
+ *
+ * The label text of an app's "Privacy Policy" link may be customized via another
+ * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
+ *
+ * Please note that on Windows Phone, Microsoft does not provide standard UI
+ * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
+ * will not get used on that platform. Network-enabled phone apps should display
+ * their privacy policy through some other, in-app means.
+ */
+#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
+
+/** \brief Label text for a WinRT app's privacy policy link
+ *
+ * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
+ * Microsoft mandates that this policy be available via the Windows Settings charm.
+ * SDL provides code to add a link there, with its label text being set via the
+ * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
+ *
+ * Please note that a privacy policy's contents are not set via this hint. A separate
+ * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
+ * policy.
+ *
+ * The contents of this hint should be encoded as a UTF8 string.
+ *
+ * The default value is "Privacy Policy". This hint should only be set during app
+ * initialization, preferably before any calls to SDL_Init().
+ *
+ * For additional information on linking to a privacy policy, see the documentation for
+ * SDL_HINT_WINRT_PRIVACY_POLICY_URL.
+ */
+#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
+
+/** \brief Allows back-button-press events on Windows Phone to be marked as handled
+ *
+ * Windows Phone devices typically feature a Back button. When pressed,
+ * the OS will emit back-button-press events, which apps are expected to
+ * handle in an appropriate manner. If apps do not explicitly mark these
+ * events as 'Handled', then the OS will invoke its default behavior for
+ * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
+ * terminate the app (and attempt to switch to the previous app, or to the
+ * device's home screen).
+ *
+ * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
+ * to mark back-button-press events as Handled, if and when one is sent to
+ * the app.
+ *
+ * Internally, Windows Phone sends back button events as parameters to
+ * special back-button-press callback functions. Apps that need to respond
+ * to back-button-press events are expected to register one or more
+ * callback functions for such, shortly after being launched (during the
+ * app's initialization phase). After the back button is pressed, the OS
+ * will invoke these callbacks. If the app's callback(s) do not explicitly
+ * mark the event as handled by the time they return, or if the app never
+ * registers one of these callback, the OS will consider the event
+ * un-handled, and it will apply its default back button behavior (terminate
+ * the app).
+ *
+ * SDL registers its own back-button-press callback with the Windows Phone
+ * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
+ * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
+ * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
+ * If the hint's value is set to "1", the back button event's Handled
+ * property will get set to 'true'. If the hint's value is set to something
+ * else, or if it is unset, SDL will leave the event's Handled property
+ * alone. (By default, the OS sets this property to 'false', to note.)
+ *
+ * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
+ * back button is pressed, or can set it in direct-response to a back button
+ * being pressed.
+ *
+ * In order to get notified when a back button is pressed, SDL apps should
+ * register a callback function with SDL_AddEventWatch(), and have it listen
+ * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
+ * (Alternatively, SDL_KEYUP events can be listened-for. Listening for
+ * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
+ * set by such a callback, will be applied to the OS' current
+ * back-button-press event.
+ *
+ * More details on back button behavior in Windows Phone apps can be found
+ * at the following page, on Microsoft's developer site:
+ * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
+ */
+#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
+
+/**
+ * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X.
+ *
+ * This hint only applies to Mac OS X.
+ *
+ * The variable can be set to the following values:
+ * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and
+ * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen"
+ * button on their titlebars).
+ * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and
+ * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
+ * button on their titlebars).
+ *
+ * The default value is "1". Spaces are disabled regardless of this hint if
+ * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
+ * any windows are created.
+ */
+#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
+
+/**
+* \brief When set don't force the SDL app to become a foreground process
+*
+* This hint only applies to Mac OS X.
+*
+*/
+#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
+
+/**
+ * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
+ *
+ * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
+ *
+ * If both hints were set then SDL_RWFromFile() will look into expansion files
+ * after a given relative path was not found in the internal storage and assets.
+ *
+ * By default this hint is not set and the APK expansion files are not searched.
+ */
+#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
+
+/**
+ * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
+ *
+ * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
+ *
+ * If both hints were set then SDL_RWFromFile() will look into expansion files
+ * after a given relative path was not found in the internal storage and assets.
+ *
+ * By default this hint is not set and the APK expansion files are not searched.
+ */
+#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
+
+/**
+ * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL_TEXTEDITING events are sent, and it is the application's
+ * responsibility to render the text from these events and
+ * differentiate it somehow from committed text. (default)
+ * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
+ * and text that is being composed will be rendered in its own UI.
+ */
+#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
+
+ /**
+ * \brief A variable to control whether mouse and touch events are to be treated together or separately
+ *
+ * The variable can be set to the following values:
+ * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
+ * events. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - Mouse events will be handled separately from pure touch events.
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
+
+ /**
+ * \brief A variable to control whether the return key on the soft keyboard
+ * should hide the soft keyboard on Android and iOS.
+ *
+ * The variable can be set to the following values:
+ * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - The return key will hide the keyboard.
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
+
+/**
+ * \brief override the binding element for keyboard inputs for Emscripten builds
+ *
+ * This hint only applies to the emscripten platform
+ *
+ * The variable can be one of
+ * "#window" - The javascript window object (this is the default)
+ * "#document" - The javascript document object
+ * "#screen" - the javascript window.screen object
+ * "#canvas" - the WebGL canvas element
+ * any other string without a leading # sign applies to the element on the page with that ID.
+ */
+#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
+
+/**
+ * \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
+ *
+ * This hint only applies to Unix-like platforms.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL will install a SIGINT and SIGTERM handler, and when it
+ * catches a signal, convert it into an SDL_QUIT event.
+ * "1" - SDL will not install a signal handler at all.
+ */
+#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
+
+/**
+ * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL will generate a window-close event when it sees Alt+F4.
+ * "1" - SDL will only do normal key handling for Alt+F4.
+ */
+#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+
+/**
+ * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
+ *
+ * The bitmap header version 4 is required for proper alpha channel support and
+ * SDL will use it when required. Should this not be desired, this hint can
+ * force the use of the 40 byte header version which is supported everywhere.
+ *
+ * The variable can be set to the following values:
+ * "0" - Surfaces with a colorkey or an alpha channel are saved to a
+ * 32-bit BMP file with an alpha mask. SDL will use the bitmap
+ * header version 4 and set the alpha mask accordingly.
+ * "1" - Surfaces with a colorkey or an alpha channel are saved to a
+ * 32-bit BMP file without an alpha mask. The alpha channel data
+ * will be in the file, but applications are going to ignore it.
+ *
+ * The default value is "0".
+ */
+#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
+
+/**
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ * thread's name, but it tends to cause problems with other debuggers,
+ * and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ * the (safer) SetThreadDescription API, introduced in the Windows 10
+ * Creators Update, if available.
+ *
+ * The variable can be set to the following values:
+ * "0" - SDL will raise the 0x406D1388 Exception to name threads.
+ * This is the default behavior of SDL <= 2.0.4.
+ * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
+ * This is necessary with .NET languages or debuggers that aren't Visual Studio.
+ */
+#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
+
+/**
+ * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI
+ *
+ * Also known as Z-order. The variable can take a negative or positive value.
+ * The default is 10000.
+ */
+#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
+
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ * \brief A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ * On some platforms, currently Windows and X11, OpenGL drivers may support
+ * creating contexts with an OpenGL ES profile. By default SDL uses these
+ * profiles, when available, otherwise it attempts to load an OpenGL ES
+ * library, e.g. that provided by the ANGLE project. This variable controls
+ * whether SDL follows this default behaviour or will always load an
+ * OpenGL ES library.
+ *
+ * Circumstances where this is useful include
+ * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ * or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ * - Resolving OpenGL ES function addresses at link time by linking with
+ * the OpenGL ES library instead of querying them at run time with
+ * SDL_GL_GetProcAddress().
+ *
+ * Caution: for an application to work with the default behaviour across
+ * different OpenGL drivers it must query the OpenGL ES function
+ * addresses at run time using SDL_GL_GetProcAddress().
+ *
+ * This variable is ignored on most platforms because OpenGL ES is native
+ * or not supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
+ * "1" - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
+
+/**
+ * \brief A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ * to handle audio resampling. There are different resampling modes available
+ * that produce different levels of quality, using more CPU.
+ *
+ * If this hint isn't specified to a valid setting, or libsamplerate isn't
+ * available, SDL will use the default, internal resampling algorithm.
+ *
+ * Note that this is currently only applicable to resampling audio that is
+ * being written to a device for playback or audio being read from a device
+ * for capture. SDL_AudioCVT always uses the default resampler (although this
+ * might change for SDL 2.1).
+ *
+ * This hint is currently only checked at audio subsystem initialization.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ * "1" or "fast" - Use fast, slightly higher quality resampling, if available
+ * "2" or "medium" - Use medium quality resampling, if available
+ * "3" or "best" - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ * \brief A variable controlling the audio category on iOS and Mac OS X
+ *
+ * This variable can be set to the following values:
+ *
+ * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ * "playback" - Use the AVAudioSessionCategoryPlayback category
+ *
+ * For more information, see Apple's documentation:
+ * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
+
+/**
+ * \brief An enumeration of hint priorities
+ */
+typedef enum
+{
+ SDL_HINT_DEFAULT,
+ SDL_HINT_NORMAL,
+ SDL_HINT_OVERRIDE
+} SDL_HintPriority;
+
+
+/**
+ * \brief Set a hint with a specific priority
+ *
+ * The priority controls the behavior when setting a hint that already
+ * has a value. Hints will replace existing hints of their priority and
+ * lower. Environment variables are considered to have override priority.
+ *
+ * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
+ const char *value,
+ SDL_HintPriority priority);
+
+/**
+ * \brief Set a hint with normal priority
+ *
+ * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
+ const char *value);
+
+/**
+ * \brief Get a hint
+ *
+ * \return The string value of a hint variable.
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
+
+/**
+ * \brief Get a hint
+ *
+ * \return The boolean value of a hint variable.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
+
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
+/**
+ * \brief Add a function to watch a particular hint
+ *
+ * \param name The hint to watch
+ * \param callback The function to call when the hint value changes
+ * \param userdata A pointer to pass to the callback function
+ */
+extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
+ SDL_HintCallback callback,
+ void *userdata);
+
+/**
+ * \brief Remove a function watching a particular hint
+ *
+ * \param name The hint being watched
+ * \param callback The function being called when the hint value changes
+ * \param userdata A pointer being passed to the callback function
+ */
+extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
+ SDL_HintCallback callback,
+ void *userdata);
+
+/**
+ * \brief Clear all hints
+ *
+ * This function is called during SDL_Quit() to free stored hints.
+ */
+extern DECLSPEC void SDLCALL SDL_ClearHints(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_hints_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_joystick.h b/src/3rdparty/SDL2/include/SDL_joystick.h
new file mode 100644
index 0000000..f67772d
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_joystick.h
@@ -0,0 +1,382 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_joystick.h
+ *
+ * Include file for SDL joystick event handling
+ *
+ * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
+ * behind a device_index changing as joysticks are plugged and unplugged.
+ *
+ * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
+ * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
+ *
+ * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
+ * the device (a X360 wired controller for example). This identifier is platform dependent.
+ *
+ *
+ */
+
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_joystick.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
+ * for joysticks, and load appropriate drivers.
+ *
+ * If you would like to receive joystick updates while the application
+ * is in the background, you should set the following hint before calling
+ * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
+ */
+
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
+struct _SDL_Joystick;
+typedef struct _SDL_Joystick SDL_Joystick;
+
+/* A structure that encodes the stable unique id for a joystick device */
+typedef struct {
+ Uint8 data[16];
+} SDL_JoystickGUID;
+
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
+typedef Sint32 SDL_JoystickID;
+
+typedef enum
+{
+ SDL_JOYSTICK_TYPE_UNKNOWN,
+ SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+ SDL_JOYSTICK_TYPE_WHEEL,
+ SDL_JOYSTICK_TYPE_ARCADE_STICK,
+ SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+ SDL_JOYSTICK_TYPE_DANCE_PAD,
+ SDL_JOYSTICK_TYPE_GUITAR,
+ SDL_JOYSTICK_TYPE_DRUM_KIT,
+ SDL_JOYSTICK_TYPE_ARCADE_PAD,
+ SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
+typedef enum
+{
+ SDL_JOYSTICK_POWER_UNKNOWN = -1,
+ SDL_JOYSTICK_POWER_EMPTY,
+ SDL_JOYSTICK_POWER_LOW,
+ SDL_JOYSTICK_POWER_MEDIUM,
+ SDL_JOYSTICK_POWER_FULL,
+ SDL_JOYSTICK_POWER_WIRED,
+ SDL_JOYSTICK_POWER_MAX
+} SDL_JoystickPowerLevel;
+
+/* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
+/**
+ * Count the number of joysticks attached to the system right now
+ */
+extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
+
+/**
+ * Get the implementation dependent name of a joystick.
+ * This can be called before any joysticks are opened.
+ * If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
+
+/**
+ * Return the GUID for the joystick at this index
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ * Get the USB vendor ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
+
+/**
+ * Get the USB product ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
+
+/**
+ * Get the product version of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
+
+/**
+ * Get the type of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ * Get the instance ID of a joystick.
+ * This can be called before any joysticks are opened.
+ * If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
+/**
+ * Open a joystick for use.
+ * The index passed as an argument refers to the N'th joystick on the system.
+ * This index is not the value which will identify this joystick in future
+ * joystick events. The joystick's instance id (::SDL_JoystickID) will be used
+ * there instead.
+ *
+ * \return A joystick identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
+
+/**
+ * Return the SDL_Joystick associated with an instance id.
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
+
+/**
+ * Return the name for this currently opened joystick.
+ * If no name can be found, this function returns NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
+
+/**
+ * Return the GUID for this opened joystick
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+
+/**
+ * Get the USB vendor ID of an opened joystick, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
+
+/**
+ * Get the USB product ID of an opened joystick, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
+
+/**
+ * Get the product version of an opened joystick, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
+
+/**
+ * Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
+
+/**
+ * Return a string representation for this guid. pszGUID must point to at least 33 bytes
+ * (32 for the string plus a NULL terminator).
+ */
+extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
+
+/**
+ * Convert a string into a joystick guid
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
+
+/**
+ * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
+
+/**
+ * Get the instance ID of an opened joystick or -1 if the joystick is invalid.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
+
+/**
+ * Get the number of general axis controls on a joystick.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
+
+/**
+ * Get the number of trackballs on a joystick.
+ *
+ * Joystick trackballs have only relative motion events associated
+ * with them and their state cannot be polled.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
+
+/**
+ * Get the number of POV hats on a joystick.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
+
+/**
+ * Get the number of buttons on a joystick.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
+
+/**
+ * Update the current state of the open joysticks.
+ *
+ * This is called automatically by the event loop if any joystick
+ * events are enabled.
+ */
+extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
+
+/**
+ * Enable/disable joystick event polling.
+ *
+ * If joystick events are disabled, you must call SDL_JoystickUpdate()
+ * yourself and check the state of the joystick when you want joystick
+ * information.
+ *
+ * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
+
+#define SDL_JOYSTICK_AXIS_MAX 32767
+#define SDL_JOYSTICK_AXIS_MIN -32768
+/**
+ * Get the current state of an axis control on a joystick.
+ *
+ * The state is a value ranging from -32768 to 32767.
+ *
+ * The axis indices start at index 0.
+ */
+extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
+ int axis);
+
+/**
+ * Get the initial state of an axis control on a joystick.
+ *
+ * The state is a value ranging from -32768 to 32767.
+ *
+ * The axis indices start at index 0.
+ *
+ * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+ int axis, Sint16 *state);
+
+/**
+ * \name Hat positions
+ */
+/* @{ */
+#define SDL_HAT_CENTERED 0x00
+#define SDL_HAT_UP 0x01
+#define SDL_HAT_RIGHT 0x02
+#define SDL_HAT_DOWN 0x04
+#define SDL_HAT_LEFT 0x08
+#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
+#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
+#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
+#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
+/* @} */
+
+/**
+ * Get the current state of a POV hat on a joystick.
+ *
+ * The hat indices start at index 0.
+ *
+ * \return The return value is one of the following positions:
+ * - ::SDL_HAT_CENTERED
+ * - ::SDL_HAT_UP
+ * - ::SDL_HAT_RIGHT
+ * - ::SDL_HAT_DOWN
+ * - ::SDL_HAT_LEFT
+ * - ::SDL_HAT_RIGHTUP
+ * - ::SDL_HAT_RIGHTDOWN
+ * - ::SDL_HAT_LEFTUP
+ * - ::SDL_HAT_LEFTDOWN
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
+ int hat);
+
+/**
+ * Get the ball axis change since the last poll.
+ *
+ * \return 0, or -1 if you passed it invalid parameters.
+ *
+ * The ball indices start at index 0.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
+ int ball, int *dx, int *dy);
+
+/**
+ * Get the current state of a button on a joystick.
+ *
+ * The button indices start at index 0.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
+ int button);
+
+/**
+ * Close a joystick previously opened with SDL_JoystickOpen().
+ */
+extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
+
+/**
+ * Return the battery level of this joystick
+ */
+extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_joystick_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_keyboard.h b/src/3rdparty/SDL2/include/SDL_keyboard.h
new file mode 100644
index 0000000..8748231
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_keyboard.h
@@ -0,0 +1,217 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_keyboard.h
+ *
+ * Include file for SDL keyboard event handling
+ */
+
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_keycode.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The SDL keysym structure, used in key events.
+ *
+ * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
+ */
+typedef struct SDL_Keysym
+{
+ SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
+ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
+ Uint16 mod; /**< current key modifiers */
+ Uint32 unused;
+} SDL_Keysym;
+
+/* Function prototypes */
+
+/**
+ * \brief Get the window which currently has keyboard focus.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
+
+/**
+ * \brief Get a snapshot of the current state of the keyboard.
+ *
+ * \param numkeys if non-NULL, receives the length of the returned array.
+ *
+ * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
+ *
+ * \b Example:
+ * \code
+ * const Uint8 *state = SDL_GetKeyboardState(NULL);
+ * if ( state[SDL_SCANCODE_RETURN] ) {
+ * printf("<RETURN> is pressed.\n");
+ * }
+ * \endcode
+ */
+extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
+
+/**
+ * \brief Get the current key modifier state for the keyboard.
+ */
+extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
+
+/**
+ * \brief Set the current key modifier state for the keyboard.
+ *
+ * \note This does not change the keyboard state, only the key modifier flags.
+ */
+extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
+
+/**
+ * \brief Get the key code corresponding to the given scancode according
+ * to the current keyboard layout.
+ *
+ * See ::SDL_Keycode for details.
+ *
+ * \sa SDL_GetKeyName()
+ */
+extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
+
+/**
+ * \brief Get the scancode corresponding to the given key code according to the
+ * current keyboard layout.
+ *
+ * See ::SDL_Scancode for details.
+ *
+ * \sa SDL_GetScancodeName()
+ */
+extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
+
+/**
+ * \brief Get a human-readable name for a scancode.
+ *
+ * \return A pointer to the name for the scancode.
+ * If the scancode doesn't have a name, this function returns
+ * an empty string ("").
+ *
+ * \sa SDL_Scancode
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
+
+/**
+ * \brief Get a scancode from a human-readable name
+ *
+ * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
+ *
+ * \sa SDL_Scancode
+ */
+extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
+
+/**
+ * \brief Get a human-readable name for a key.
+ *
+ * \return A pointer to a UTF-8 string that stays valid at least until the next
+ * call to this function. If you need it around any longer, you must
+ * copy it. If the key doesn't have a name, this function returns an
+ * empty string ("").
+ *
+ * \sa SDL_Keycode
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
+
+/**
+ * \brief Get a key code from a human-readable name
+ *
+ * \return key code, or SDLK_UNKNOWN if the name wasn't recognized
+ *
+ * \sa SDL_Keycode
+ */
+extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
+
+/**
+ * \brief Start accepting Unicode text input events.
+ * This function will show the on-screen keyboard if supported.
+ *
+ * \sa SDL_StopTextInput()
+ * \sa SDL_SetTextInputRect()
+ * \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
+
+/**
+ * \brief Return whether or not Unicode text input events are enabled.
+ *
+ * \sa SDL_StartTextInput()
+ * \sa SDL_StopTextInput()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
+
+/**
+ * \brief Stop receiving any text input events.
+ * This function will hide the on-screen keyboard if supported.
+ *
+ * \sa SDL_StartTextInput()
+ * \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
+
+/**
+ * \brief Set the rectangle used to type Unicode text inputs.
+ * This is used as a hint for IME and on-screen keyboard placement.
+ *
+ * \sa SDL_StartTextInput()
+ */
+extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
+
+/**
+ * \brief Returns whether the platform has some screen keyboard support.
+ *
+ * \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
+ *
+ * \note Not all screen keyboard functions are supported on all platforms.
+ *
+ * \sa SDL_IsScreenKeyboardShown()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
+
+/**
+ * \brief Returns whether the screen keyboard is shown for given window.
+ *
+ * \param window The window for which screen keyboard should be queried.
+ *
+ * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
+ *
+ * \sa SDL_HasScreenKeyboardSupport()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_keyboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_keycode.h b/src/3rdparty/SDL2/include/SDL_keycode.h
new file mode 100644
index 0000000..d7d5b1d
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_keycode.h
@@ -0,0 +1,349 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_keycode.h
+ *
+ * Defines constants which identify keyboard keys and modifiers.
+ */
+
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_scancode.h"
+
+/**
+ * \brief The SDL virtual key representation.
+ *
+ * Values of this type are used to represent keyboard keys using the current
+ * layout of the keyboard. These values include Unicode values representing
+ * the unmodified character that would be generated by pressing the key, or
+ * an SDLK_* constant for those keys that do not generate characters.
+ *
+ * A special exception is the number keys at the top of the keyboard which
+ * always map to SDLK_0...SDLK_9, regardless of layout.
+ */
+typedef Sint32 SDL_Keycode;
+
+#define SDLK_SCANCODE_MASK (1<<30)
+#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
+
+enum
+{
+ SDLK_UNKNOWN = 0,
+
+ SDLK_RETURN = '\r',
+ SDLK_ESCAPE = '\033',
+ SDLK_BACKSPACE = '\b',
+ SDLK_TAB = '\t',
+ SDLK_SPACE = ' ',
+ SDLK_EXCLAIM = '!',
+ SDLK_QUOTEDBL = '"',
+ SDLK_HASH = '#',
+ SDLK_PERCENT = '%',
+ SDLK_DOLLAR = '$',
+ SDLK_AMPERSAND = '&',
+ SDLK_QUOTE = '\'',
+ SDLK_LEFTPAREN = '(',
+ SDLK_RIGHTPAREN = ')',
+ SDLK_ASTERISK = '*',
+ SDLK_PLUS = '+',
+ SDLK_COMMA = ',',
+ SDLK_MINUS = '-',
+ SDLK_PERIOD = '.',
+ SDLK_SLASH = '/',
+ SDLK_0 = '0',
+ SDLK_1 = '1',
+ SDLK_2 = '2',
+ SDLK_3 = '3',
+ SDLK_4 = '4',
+ SDLK_5 = '5',
+ SDLK_6 = '6',
+ SDLK_7 = '7',
+ SDLK_8 = '8',
+ SDLK_9 = '9',
+ SDLK_COLON = ':',
+ SDLK_SEMICOLON = ';',
+ SDLK_LESS = '<',
+ SDLK_EQUALS = '=',
+ SDLK_GREATER = '>',
+ SDLK_QUESTION = '?',
+ SDLK_AT = '@',
+ /*
+ Skip uppercase letters
+ */
+ SDLK_LEFTBRACKET = '[',
+ SDLK_BACKSLASH = '\\',
+ SDLK_RIGHTBRACKET = ']',
+ SDLK_CARET = '^',
+ SDLK_UNDERSCORE = '_',
+ SDLK_BACKQUOTE = '`',
+ SDLK_a = 'a',
+ SDLK_b = 'b',
+ SDLK_c = 'c',
+ SDLK_d = 'd',
+ SDLK_e = 'e',
+ SDLK_f = 'f',
+ SDLK_g = 'g',
+ SDLK_h = 'h',
+ SDLK_i = 'i',
+ SDLK_j = 'j',
+ SDLK_k = 'k',
+ SDLK_l = 'l',
+ SDLK_m = 'm',
+ SDLK_n = 'n',
+ SDLK_o = 'o',
+ SDLK_p = 'p',
+ SDLK_q = 'q',
+ SDLK_r = 'r',
+ SDLK_s = 's',
+ SDLK_t = 't',
+ SDLK_u = 'u',
+ SDLK_v = 'v',
+ SDLK_w = 'w',
+ SDLK_x = 'x',
+ SDLK_y = 'y',
+ SDLK_z = 'z',
+
+ SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
+
+ SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
+ SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
+ SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
+ SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
+ SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
+ SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
+ SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
+ SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
+ SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
+ SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
+ SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
+ SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
+
+ SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
+ SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
+ SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
+ SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
+ SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
+ SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
+ SDLK_DELETE = '\177',
+ SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
+ SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
+ SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
+ SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
+ SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
+ SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
+
+ SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
+ SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
+ SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
+ SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
+ SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
+ SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
+ SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
+ SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
+ SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
+ SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
+ SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
+ SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
+ SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
+ SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
+ SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
+ SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
+ SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
+
+ SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
+ SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
+ SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
+ SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
+ SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
+ SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
+ SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
+ SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
+ SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
+ SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
+ SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
+ SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
+ SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
+ SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
+ SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
+ SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
+ SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
+ SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
+ SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
+ SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
+ SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
+ SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
+ SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
+ SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
+ SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
+ SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
+ SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
+ SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
+ SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
+ SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
+ SDLK_KP_EQUALSAS400 =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
+
+ SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
+ SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
+ SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
+ SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
+ SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
+ SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
+ SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
+ SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
+ SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
+ SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
+ SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
+ SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
+
+ SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
+ SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
+ SDLK_THOUSANDSSEPARATOR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
+ SDLK_DECIMALSEPARATOR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
+ SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
+ SDLK_CURRENCYSUBUNIT =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
+ SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
+ SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
+ SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
+ SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
+ SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
+ SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
+ SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
+ SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
+ SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
+ SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
+ SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
+ SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
+ SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
+ SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
+ SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
+ SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
+ SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
+ SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
+ SDLK_KP_DBLAMPERSAND =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
+ SDLK_KP_VERTICALBAR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
+ SDLK_KP_DBLVERTICALBAR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
+ SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
+ SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
+ SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
+ SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
+ SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
+ SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
+ SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
+ SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
+ SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
+ SDLK_KP_MEMSUBTRACT =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
+ SDLK_KP_MEMMULTIPLY =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
+ SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
+ SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
+ SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
+ SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
+ SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
+ SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
+ SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
+ SDLK_KP_HEXADECIMAL =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
+
+ SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
+ SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
+ SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
+ SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
+ SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
+ SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
+ SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
+ SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
+
+ SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
+
+ SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
+ SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
+ SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
+ SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
+ SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
+ SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
+ SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
+ SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
+ SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
+ SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
+ SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
+ SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
+ SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
+ SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
+ SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
+ SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
+ SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
+
+ SDLK_BRIGHTNESSDOWN =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
+ SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
+ SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
+ SDLK_KBDILLUMTOGGLE =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
+ SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
+ SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
+ SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
+ SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+ SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+ SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+ SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+ SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
+};
+
+/**
+ * \brief Enumeration of valid key mods (possibly OR'd together).
+ */
+typedef enum
+{
+ KMOD_NONE = 0x0000,
+ KMOD_LSHIFT = 0x0001,
+ KMOD_RSHIFT = 0x0002,
+ KMOD_LCTRL = 0x0040,
+ KMOD_RCTRL = 0x0080,
+ KMOD_LALT = 0x0100,
+ KMOD_RALT = 0x0200,
+ KMOD_LGUI = 0x0400,
+ KMOD_RGUI = 0x0800,
+ KMOD_NUM = 0x1000,
+ KMOD_CAPS = 0x2000,
+ KMOD_MODE = 0x4000,
+ KMOD_RESERVED = 0x8000
+} SDL_Keymod;
+
+#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
+#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
+#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
+#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
+
+#endif /* SDL_keycode_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_loadso.h b/src/3rdparty/SDL2/include/SDL_loadso.h
new file mode 100644
index 0000000..da56fb4
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_loadso.h
@@ -0,0 +1,81 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_loadso.h
+ *
+ * System dependent library loading routines
+ *
+ * Some things to keep in mind:
+ * \li These functions only work on C function names. Other languages may
+ * have name mangling and intrinsic language support that varies from
+ * compiler to compiler.
+ * \li Make sure you declare your function pointers with the same calling
+ * convention as the actual library function. Your code will crash
+ * mysteriously if you do not do this.
+ * \li Avoid namespace collisions. If you load a symbol from the library,
+ * it is not defined whether or not it goes into the global symbol
+ * namespace for the application. If it does and it conflicts with
+ * symbols in your code or other shared libraries, you will not get
+ * the results you expect. :)
+ */
+
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This function dynamically loads a shared object and returns a pointer
+ * to the object handle (or NULL if there was an error).
+ * The 'sofile' parameter is a system dependent name of the object file.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
+
+/**
+ * Given an object handle, this function looks up the address of the
+ * named function in the shared object and returns it. This address
+ * is no longer valid after calling SDL_UnloadObject().
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
+ const char *name);
+
+/**
+ * Unload a shared object from memory.
+ */
+extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_loadso_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_log.h b/src/3rdparty/SDL2/include/SDL_log.h
new file mode 100644
index 0000000..e12b658
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_log.h
@@ -0,0 +1,211 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_log.h
+ *
+ * Simple log messages with categories and priorities.
+ *
+ * By default logs are quiet, but if you're debugging SDL you might want:
+ *
+ * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
+ *
+ * Here's where the messages go on different platforms:
+ * Windows: debug output stream
+ * Android: log output
+ * Others: standard error output (stderr)
+ */
+
+#ifndef SDL_log_h_
+#define SDL_log_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief The maximum size of a log message
+ *
+ * Messages longer than the maximum size will be truncated
+ */
+#define SDL_MAX_LOG_MESSAGE 4096
+
+/**
+ * \brief The predefined log categories
+ *
+ * By default the application category is enabled at the INFO level,
+ * the assert category is enabled at the WARN level, test is enabled
+ * at the VERBOSE level and all other categories are enabled at the
+ * CRITICAL level.
+ */
+enum
+{
+ SDL_LOG_CATEGORY_APPLICATION,
+ SDL_LOG_CATEGORY_ERROR,
+ SDL_LOG_CATEGORY_ASSERT,
+ SDL_LOG_CATEGORY_SYSTEM,
+ SDL_LOG_CATEGORY_AUDIO,
+ SDL_LOG_CATEGORY_VIDEO,
+ SDL_LOG_CATEGORY_RENDER,
+ SDL_LOG_CATEGORY_INPUT,
+ SDL_LOG_CATEGORY_TEST,
+
+ /* Reserved for future SDL library use */
+ SDL_LOG_CATEGORY_RESERVED1,
+ SDL_LOG_CATEGORY_RESERVED2,
+ SDL_LOG_CATEGORY_RESERVED3,
+ SDL_LOG_CATEGORY_RESERVED4,
+ SDL_LOG_CATEGORY_RESERVED5,
+ SDL_LOG_CATEGORY_RESERVED6,
+ SDL_LOG_CATEGORY_RESERVED7,
+ SDL_LOG_CATEGORY_RESERVED8,
+ SDL_LOG_CATEGORY_RESERVED9,
+ SDL_LOG_CATEGORY_RESERVED10,
+
+ /* Beyond this point is reserved for application use, e.g.
+ enum {
+ MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
+ MYAPP_CATEGORY_AWESOME2,
+ MYAPP_CATEGORY_AWESOME3,
+ ...
+ };
+ */
+ SDL_LOG_CATEGORY_CUSTOM
+};
+
+/**
+ * \brief The predefined log priorities
+ */
+typedef enum
+{
+ SDL_LOG_PRIORITY_VERBOSE = 1,
+ SDL_LOG_PRIORITY_DEBUG,
+ SDL_LOG_PRIORITY_INFO,
+ SDL_LOG_PRIORITY_WARN,
+ SDL_LOG_PRIORITY_ERROR,
+ SDL_LOG_PRIORITY_CRITICAL,
+ SDL_NUM_LOG_PRIORITIES
+} SDL_LogPriority;
+
+
+/**
+ * \brief Set the priority of all log categories
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
+
+/**
+ * \brief Set the priority of a particular log category
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
+ SDL_LogPriority priority);
+
+/**
+ * \brief Get the priority of a particular log category
+ */
+extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
+
+/**
+ * \brief Reset all priorities to default.
+ *
+ * \note This is called in SDL_Quit().
+ */
+extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
+
+/**
+ * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
+ */
+extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
+ */
+extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
+ */
+extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_INFO
+ */
+extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_WARN
+ */
+extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_ERROR
+ */
+extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
+ */
+extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Log a message with the specified category and priority.
+ */
+extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
+ SDL_LogPriority priority,
+ SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
+
+/**
+ * \brief Log a message with the specified category and priority.
+ */
+extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
+ SDL_LogPriority priority,
+ const char *fmt, va_list ap);
+
+/**
+ * \brief The prototype for the log output function
+ */
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+
+/**
+ * \brief Get the current log output function.
+ */
+extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
+
+/**
+ * \brief This function allows you to replace the default log output
+ * function with one of your own.
+ */
+extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_log_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_main.h b/src/3rdparty/SDL2/include/SDL_main.h
new file mode 100644
index 0000000..9855821
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_main.h
@@ -0,0 +1,168 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_main_h_
+#define SDL_main_h_
+
+#include "SDL_stdinc.h"
+
+/**
+ * \file SDL_main.h
+ *
+ * Redefine main() on some platforms so that it is called by SDL.
+ */
+
+#ifndef SDL_MAIN_HANDLED
+#if defined(__WIN32__)
+/* On Windows SDL provides WinMain(), which parses the command line and passes
+ the arguments to your main function.
+
+ If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
+ */
+#define SDL_MAIN_AVAILABLE
+
+#elif defined(__WINRT__)
+/* On WinRT, SDL provides a main function that initializes CoreApplication,
+ creating an instance of IFrameworkView in the process.
+
+ Please note that #include'ing SDL_main.h is not enough to get a main()
+ function working. In non-XAML apps, the file,
+ src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
+ into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
+ called, with a pointer to the Direct3D-hosted XAML control passed in.
+*/
+#define SDL_MAIN_NEEDED
+
+#elif defined(__IPHONEOS__)
+/* On iOS SDL provides a main function that creates an application delegate
+ and starts the iOS application run loop.
+
+ See src/video/uikit/SDL_uikitappdelegate.m for more details.
+ */
+#define SDL_MAIN_NEEDED
+
+#elif defined(__ANDROID__)
+/* On Android SDL provides a Java class in SDLActivity.java that is the
+ main activity entry point.
+
+ See docs/README-android.md for more details on extending that class.
+ */
+#define SDL_MAIN_NEEDED
+
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC DECLSPEC
+
+#elif defined(__NACL__)
+/* On NACL we use ppapi_simple to set up the application helper code,
+ then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
+ starting the user main function.
+ All user code is run in a separate thread by ppapi_simple, thus
+ allowing for blocking io to take place via nacl_io
+*/
+#define SDL_MAIN_NEEDED
+
+#endif
+#endif /* SDL_MAIN_HANDLED */
+
+#ifdef __cplusplus
+#define C_LINKAGE "C"
+#else
+#define C_LINKAGE
+#endif /* __cplusplus */
+
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
+
+/**
+ * \file SDL_main.h
+ *
+ * The application's main() function must be called with C linkage,
+ * and should be declared like this:
+ * \code
+ * #ifdef __cplusplus
+ * extern "C"
+ * #endif
+ * int main(int argc, char *argv[])
+ * {
+ * }
+ * \endcode
+ */
+
+#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
+#define main SDL_main
+#endif
+
+/**
+ * The prototype for the application's main() function
+ */
+extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
+
+
+#include "begin_code.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This is called by the real SDL main function to let the rest of the
+ * library know that initialization was done properly.
+ *
+ * Calling this yourself without knowing what you're doing can cause
+ * crashes and hard to diagnose problems with your application.
+ */
+extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
+
+#ifdef __WIN32__
+
+/**
+ * This can be called to set the application class at startup
+ */
+extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
+ void *hInst);
+extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
+
+#endif /* __WIN32__ */
+
+
+#ifdef __WINRT__
+
+/**
+ * \brief Initializes and launches an SDL/WinRT application.
+ *
+ * \param mainFunction The SDL app's C-style main().
+ * \param reserved Reserved for future use; should be NULL
+ * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
+ * information on the failure.
+ */
+extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
+
+#endif /* __WINRT__ */
+
+
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_main_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_messagebox.h b/src/3rdparty/SDL2/include/SDL_messagebox.h
new file mode 100644
index 0000000..b7be59d
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_messagebox.h
@@ -0,0 +1,144 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_video.h" /* For SDL_Window */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief SDL_MessageBox flags. If supported will display warning icon, etc.
+ */
+typedef enum
+{
+ SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
+ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
+ SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
+} SDL_MessageBoxFlags;
+
+/**
+ * \brief Flags for SDL_MessageBoxButtonData.
+ */
+typedef enum
+{
+ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
+ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
+} SDL_MessageBoxButtonFlags;
+
+/**
+ * \brief Individual button data.
+ */
+typedef struct
+{
+ Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
+ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
+ const char * text; /**< The UTF-8 button text */
+} SDL_MessageBoxButtonData;
+
+/**
+ * \brief RGB value used in a message box color scheme
+ */
+typedef struct
+{
+ Uint8 r, g, b;
+} SDL_MessageBoxColor;
+
+typedef enum
+{
+ SDL_MESSAGEBOX_COLOR_BACKGROUND,
+ SDL_MESSAGEBOX_COLOR_TEXT,
+ SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
+ SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
+ SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
+ SDL_MESSAGEBOX_COLOR_MAX
+} SDL_MessageBoxColorType;
+
+/**
+ * \brief A set of colors to use for message box dialogs
+ */
+typedef struct
+{
+ SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
+} SDL_MessageBoxColorScheme;
+
+/**
+ * \brief MessageBox structure containing title, text, window, etc.
+ */
+typedef struct
+{
+ Uint32 flags; /**< ::SDL_MessageBoxFlags */
+ SDL_Window *window; /**< Parent window, can be NULL */
+ const char *title; /**< UTF-8 title */
+ const char *message; /**< UTF-8 message text */
+
+ int numbuttons;
+ const SDL_MessageBoxButtonData *buttons;
+
+ const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
+} SDL_MessageBoxData;
+
+/**
+ * \brief Create a modal message box.
+ *
+ * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
+ * \param buttonid The pointer to which user id of hit button should be copied.
+ *
+ * \return -1 on error, otherwise 0 and buttonid contains user id of button
+ * hit or -1 if dialog was closed.
+ *
+ * \note This function should be called on the thread that created the parent
+ * window, or on the main thread if the messagebox has no parent. It will
+ * block execution of that thread until the user clicks a button or
+ * closes the messagebox.
+ */
+extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+/**
+ * \brief Create a simple modal message box
+ *
+ * \param flags ::SDL_MessageBoxFlags
+ * \param title UTF-8 title text
+ * \param message UTF-8 message text
+ * \param window The parent window, or NULL for no parent
+ *
+ * \return 0 on success, -1 on error
+ *
+ * \sa SDL_ShowMessageBox
+ */
+extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_messagebox_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_mouse.h b/src/3rdparty/SDL2/include/SDL_mouse.h
new file mode 100644
index 0000000..d3c9f61
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_mouse.h
@@ -0,0 +1,302 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_mouse.h
+ *
+ * Include file for SDL mouse event handling.
+ */
+
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
+
+/**
+ * \brief Cursor types for SDL_CreateSystemCursor().
+ */
+typedef enum
+{
+ SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
+ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
+ SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
+ SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
+ SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
+ SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
+ SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
+ SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
+ SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
+ SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
+ SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
+ SDL_SYSTEM_CURSOR_HAND, /**< Hand */
+ SDL_NUM_SYSTEM_CURSORS
+} SDL_SystemCursor;
+
+/**
+ * \brief Scroll direction types for the Scroll event
+ */
+typedef enum
+{
+ SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
+ SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
+} SDL_MouseWheelDirection;
+
+/* Function prototypes */
+
+/**
+ * \brief Get the window which currently has mouse focus.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
+
+/**
+ * \brief Retrieve the current state of the mouse.
+ *
+ * The current button state is returned as a button bitmask, which can
+ * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
+ * mouse cursor position relative to the focus window for the currently
+ * selected mouse. You can pass NULL for either x or y.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
+
+/**
+ * \brief Get the current state of the mouse, in relation to the desktop
+ *
+ * This works just like SDL_GetMouseState(), but the coordinates will be
+ * reported relative to the top-left of the desktop. This can be useful if
+ * you need to track the mouse outside of a specific window and
+ * SDL_CaptureMouse() doesn't fit your needs. For example, it could be
+ * useful if you need to track the mouse while dragging a window, where
+ * coordinates relative to a window might not be in sync at all times.
+ *
+ * \note SDL_GetMouseState() returns the mouse position as SDL understands
+ * it from the last pump of the event queue. This function, however,
+ * queries the OS for the current mouse position, and as such, might
+ * be a slightly less efficient function. Unless you know what you're
+ * doing and have a good reason to use this function, you probably want
+ * SDL_GetMouseState() instead.
+ *
+ * \param x Returns the current X coord, relative to the desktop. Can be NULL.
+ * \param y Returns the current Y coord, relative to the desktop. Can be NULL.
+ * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
+ *
+ * \sa SDL_GetMouseState
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
+
+/**
+ * \brief Retrieve the relative state of the mouse.
+ *
+ * The current button state is returned as a button bitmask, which can
+ * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
+ * mouse deltas since the last call to SDL_GetRelativeMouseState().
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
+
+/**
+ * \brief Moves the mouse to the given position within the window.
+ *
+ * \param window The window to move the mouse into, or NULL for the current mouse focus
+ * \param x The x coordinate within the window
+ * \param y The y coordinate within the window
+ *
+ * \note This function generates a mouse motion event
+ */
+extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
+ int x, int y);
+
+/**
+ * \brief Moves the mouse to the given position in global screen space.
+ *
+ * \param x The x coordinate
+ * \param y The y coordinate
+ * \return 0 on success, -1 on error (usually: unsupported by a platform).
+ *
+ * \note This function generates a mouse motion event
+ */
+extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
+
+/**
+ * \brief Set relative mouse mode.
+ *
+ * \param enabled Whether or not to enable relative mode
+ *
+ * \return 0 on success, or -1 if relative mode is not supported.
+ *
+ * While the mouse is in relative mode, the cursor is hidden, and the
+ * driver will try to report continuous motion in the current window.
+ * Only relative motion events will be delivered, the mouse position
+ * will not change.
+ *
+ * \note This function will flush any pending mouse motion.
+ *
+ * \sa SDL_GetRelativeMouseMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
+
+/**
+ * \brief Capture the mouse, to track input outside an SDL window.
+ *
+ * \param enabled Whether or not to enable capturing
+ *
+ * Capturing enables your app to obtain mouse events globally, instead of
+ * just within your window. Not all video targets support this function.
+ * When capturing is enabled, the current window will get all mouse events,
+ * but unlike relative mode, no change is made to the cursor and it is
+ * not restrained to your window.
+ *
+ * This function may also deny mouse input to other windows--both those in
+ * your application and others on the system--so you should use this
+ * function sparingly, and in small bursts. For example, you might want to
+ * track the mouse while the user is dragging something, until the user
+ * releases a mouse button. It is not recommended that you capture the mouse
+ * for long periods of time, such as the entire time your app is running.
+ *
+ * While captured, mouse events still report coordinates relative to the
+ * current (foreground) window, but those coordinates may be outside the
+ * bounds of the window (including negative values). Capturing is only
+ * allowed for the foreground window. If the window loses focus while
+ * capturing, the capture will be disabled automatically.
+ *
+ * While capturing is enabled, the current window will have the
+ * SDL_WINDOW_MOUSE_CAPTURE flag set.
+ *
+ * \return 0 on success, or -1 if not supported.
+ */
+extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
+
+/**
+ * \brief Query whether relative mouse mode is enabled.
+ *
+ * \sa SDL_SetRelativeMouseMode()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
+
+/**
+ * \brief Create a cursor, using the specified bitmap data and
+ * mask (in MSB format).
+ *
+ * The cursor width must be a multiple of 8 bits.
+ *
+ * The cursor is created in black and white according to the following:
+ * <table>
+ * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
+ * <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
+ * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
+ * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
+ * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
+ * if not. </td></tr>
+ * </table>
+ *
+ * \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
+ const Uint8 * mask,
+ int w, int h, int hot_x,
+ int hot_y);
+
+/**
+ * \brief Create a color cursor.
+ *
+ * \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
+ int hot_x,
+ int hot_y);
+
+/**
+ * \brief Create a system cursor.
+ *
+ * \sa SDL_FreeCursor()
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
+
+/**
+ * \brief Set the active cursor.
+ */
+extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
+
+/**
+ * \brief Return the active cursor.
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
+
+/**
+ * \brief Return the default cursor.
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
+
+/**
+ * \brief Frees a cursor created with SDL_CreateCursor() or similar functions.
+ *
+ * \sa SDL_CreateCursor()
+ * \sa SDL_CreateColorCursor()
+ * \sa SDL_CreateSystemCursor()
+ */
+extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
+
+/**
+ * \brief Toggle whether or not the cursor is shown.
+ *
+ * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
+ * state.
+ *
+ * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
+ */
+extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
+
+/**
+ * Used as a mask when testing buttons in buttonstate.
+ * - Button 1: Left mouse button
+ * - Button 2: Middle mouse button
+ * - Button 3: Right mouse button
+ */
+#define SDL_BUTTON(X) (1 << ((X)-1))
+#define SDL_BUTTON_LEFT 1
+#define SDL_BUTTON_MIDDLE 2
+#define SDL_BUTTON_RIGHT 3
+#define SDL_BUTTON_X1 4
+#define SDL_BUTTON_X2 5
+#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
+#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
+#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
+#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
+#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_mouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_mutex.h b/src/3rdparty/SDL2/include/SDL_mutex.h
new file mode 100644
index 0000000..ba4247c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_mutex.h
@@ -0,0 +1,251 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
+
+/**
+ * \file SDL_mutex.h
+ *
+ * Functions to provide thread synchronization primitives.
+ */
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Synchronization functions which can time out return this value
+ * if they time out.
+ */
+#define SDL_MUTEX_TIMEDOUT 1
+
+/**
+ * This is the timeout value which corresponds to never time out.
+ */
+#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
+
+
+/**
+ * \name Mutex functions
+ */
+/* @{ */
+
+/* The SDL mutex structure, defined in SDL_sysmutex.c */
+struct SDL_mutex;
+typedef struct SDL_mutex SDL_mutex;
+
+/**
+ * Create a mutex, initialized unlocked.
+ */
+extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
+
+/**
+ * Lock the mutex.
+ *
+ * \return 0, or -1 on error.
+ */
+#define SDL_mutexP(m) SDL_LockMutex(m)
+extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
+
+/**
+ * Try to lock the mutex
+ *
+ * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
+
+/**
+ * Unlock the mutex.
+ *
+ * \return 0, or -1 on error.
+ *
+ * \warning It is an error to unlock a mutex that has not been locked by
+ * the current thread, and doing so results in undefined behavior.
+ */
+#define SDL_mutexV(m) SDL_UnlockMutex(m)
+extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
+
+/**
+ * Destroy a mutex.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
+
+/* @} *//* Mutex functions */
+
+
+/**
+ * \name Semaphore functions
+ */
+/* @{ */
+
+/* The SDL semaphore structure, defined in SDL_syssem.c */
+struct SDL_semaphore;
+typedef struct SDL_semaphore SDL_sem;
+
+/**
+ * Create a semaphore, initialized with value, returns NULL on failure.
+ */
+extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
+
+/**
+ * Destroy a semaphore.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
+
+/**
+ * This function suspends the calling thread until the semaphore pointed
+ * to by \c sem has a positive count. It then atomically decreases the
+ * semaphore count.
+ */
+extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
+
+/**
+ * Non-blocking variant of SDL_SemWait().
+ *
+ * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
+ * block, and -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
+
+/**
+ * Variant of SDL_SemWait() with a timeout in milliseconds.
+ *
+ * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
+ * succeed in the allotted time, and -1 on error.
+ *
+ * \warning On some platforms this function is implemented by looping with a
+ * delay of 1 ms, and so should be avoided if possible.
+ */
+extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
+
+/**
+ * Atomically increases the semaphore's count (not blocking).
+ *
+ * \return 0, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
+
+/**
+ * Returns the current count of the semaphore.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
+
+/* @} *//* Semaphore functions */
+
+
+/**
+ * \name Condition variable functions
+ */
+/* @{ */
+
+/* The SDL condition variable structure, defined in SDL_syscond.c */
+struct SDL_cond;
+typedef struct SDL_cond SDL_cond;
+
+/**
+ * Create a condition variable.
+ *
+ * Typical use of condition variables:
+ *
+ * Thread A:
+ * SDL_LockMutex(lock);
+ * while ( ! condition ) {
+ * SDL_CondWait(cond, lock);
+ * }
+ * SDL_UnlockMutex(lock);
+ *
+ * Thread B:
+ * SDL_LockMutex(lock);
+ * ...
+ * condition = true;
+ * ...
+ * SDL_CondSignal(cond);
+ * SDL_UnlockMutex(lock);
+ *
+ * There is some discussion whether to signal the condition variable
+ * with the mutex locked or not. There is some potential performance
+ * benefit to unlocking first on some platforms, but there are some
+ * potential race conditions depending on how your code is structured.
+ *
+ * In general it's safer to signal the condition variable while the
+ * mutex is locked.
+ */
+extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
+
+/**
+ * Destroy a condition variable.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
+
+/**
+ * Restart one of the threads that are waiting on the condition variable.
+ *
+ * \return 0 or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
+
+/**
+ * Restart all threads that are waiting on the condition variable.
+ *
+ * \return 0 or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
+
+/**
+ * Wait on the condition variable, unlocking the provided mutex.
+ *
+ * \warning The mutex must be locked before entering this function!
+ *
+ * The mutex is re-locked once the condition variable is signaled.
+ *
+ * \return 0 when it is signaled, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
+
+/**
+ * Waits for at most \c ms milliseconds, and returns 0 if the condition
+ * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
+ * signaled in the allotted time, and -1 on error.
+ *
+ * \warning On some platforms this function is implemented by looping with a
+ * delay of 1 ms, and so should be avoided if possible.
+ */
+extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
+ SDL_mutex * mutex, Uint32 ms);
+
+/* @} *//* Condition variable functions */
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_mutex_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_name.h b/src/3rdparty/SDL2/include/SDL_name.h
new file mode 100644
index 0000000..ecd863f
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_name.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDLname_h_
+#define SDLname_h_
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define NeedFunctionPrototypes 1
+#endif
+
+#define SDL_NAME(X) SDL_##X
+
+#endif /* SDLname_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_opengl.h b/src/3rdparty/SDL2/include/SDL_opengl.h
new file mode 100644
index 0000000..253d9c9
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_opengl.h
@@ -0,0 +1,2183 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_opengl.h
+ *
+ * This is a simple file to encapsulate the OpenGL API headers.
+ */
+
+/**
+ * \def NO_SDL_GLEXT
+ *
+ * Define this if you have your own version of glext.h and want to disable the
+ * version included in SDL_opengl.h.
+ */
+
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
+
+#include "SDL_config.h"
+
+#ifndef __IPHONEOS__ /* No OpenGL on iOS. */
+
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef __gl_h_
+#define __gl_h_
+
+#if defined(USE_MGL_NAMESPACE)
+#include "gl_mangle.h"
+#endif
+
+
+/**********************************************************************
+ * Begin system-specific stuff.
+ */
+
+#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
+#define __WIN32__
+#endif
+
+#if defined(__WIN32__) && !defined(__CYGWIN__)
+# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+# define GLAPI __declspec(dllexport)
+# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+# define GLAPI __declspec(dllimport)
+# else /* for use with static link lib build of Win32 edition only */
+# define GLAPI extern
+# endif /* _STATIC_MESA support */
+# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
+# define GLAPIENTRY
+# else
+# define GLAPIENTRY __stdcall
+# endif
+#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
+# define GLAPI extern
+# define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+# define GLAPI extern
+# define GLAPIENTRY _System
+# define APIENTRY _System
+# if defined(__GNUC__) && !defined(_System)
+# define _System
+# endif
+#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define GLAPI __attribute__((visibility("default")))
+# define GLAPIENTRY
+#endif /* WIN32 && !CYGWIN */
+
+/*
+ * WINDOWS: Include windows.h here to define APIENTRY.
+ * It is also useful when applications include this file by
+ * including only glut.h, since glut.h depends on windows.h.
+ * Applications needing to include windows.h with parms other
+ * than "WIN32_LEAN_AND_MEAN" may include windows.h before
+ * glut.h or gl.h.
+ */
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#ifndef NOMINMAX /* don't define min() and max(). */
+#define NOMINMAX
+#endif
+#include <windows.h>
+#endif
+
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY GLAPIENTRY
+#endif
+
+/* "P" suffix to be used for a pointer to a function */
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+
+#ifndef GLAPIENTRYP
+#define GLAPIENTRYP GLAPIENTRY *
+#endif
+
+#if defined(PRAGMA_EXPORT_SUPPORTED)
+#pragma export on
+#endif
+
+/*
+ * End system-specific stuff.
+ **********************************************************************/
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define GL_VERSION_1_1 1
+#define GL_VERSION_1_2 1
+#define GL_VERSION_1_3 1
+#define GL_ARB_imaging 1
+
+
+/*
+ * Datatypes
+ */
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef void GLvoid;
+typedef signed char GLbyte; /* 1-byte signed */
+typedef short GLshort; /* 2-byte signed */
+typedef int GLint; /* 4-byte signed */
+typedef unsigned char GLubyte; /* 1-byte unsigned */
+typedef unsigned short GLushort; /* 2-byte unsigned */
+typedef unsigned int GLuint; /* 4-byte unsigned */
+typedef int GLsizei; /* 4-byte signed */
+typedef float GLfloat; /* single precision float */
+typedef float GLclampf; /* single precision float in [0,1] */
+typedef double GLdouble; /* double precision float */
+typedef double GLclampd; /* double precision float in [0,1] */
+
+
+
+/*
+ * Constants
+ */
+
+/* Boolean values */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* Data types */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_2_BYTES 0x1407
+#define GL_3_BYTES 0x1408
+#define GL_4_BYTES 0x1409
+#define GL_DOUBLE 0x140A
+
+/* Primitives */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_QUADS 0x0007
+#define GL_QUAD_STRIP 0x0008
+#define GL_POLYGON 0x0009
+
+/* Vertex Arrays */
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_INDEX_ARRAY 0x8077
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_EDGE_FLAG_ARRAY 0x8079
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_INDEX_ARRAY_TYPE 0x8085
+#define GL_INDEX_ARRAY_STRIDE 0x8086
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_INDEX_ARRAY_POINTER 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
+#define GL_V2F 0x2A20
+#define GL_V3F 0x2A21
+#define GL_C4UB_V2F 0x2A22
+#define GL_C4UB_V3F 0x2A23
+#define GL_C3F_V3F 0x2A24
+#define GL_N3F_V3F 0x2A25
+#define GL_C4F_N3F_V3F 0x2A26
+#define GL_T2F_V3F 0x2A27
+#define GL_T4F_V4F 0x2A28
+#define GL_T2F_C4UB_V3F 0x2A29
+#define GL_T2F_C3F_V3F 0x2A2A
+#define GL_T2F_N3F_V3F 0x2A2B
+#define GL_T2F_C4F_N3F_V3F 0x2A2C
+#define GL_T4F_C4F_N3F_V4F 0x2A2D
+
+/* Matrix Mode */
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+
+/* Points */
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_POINT_SIZE_RANGE 0x0B12
+
+/* Lines */
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_LINE_STIPPLE 0x0B24
+#define GL_LINE_STIPPLE_PATTERN 0x0B25
+#define GL_LINE_STIPPLE_REPEAT 0x0B26
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_LINE_WIDTH_RANGE 0x0B22
+
+/* Polygons */
+#define GL_POINT 0x1B00
+#define GL_LINE 0x1B01
+#define GL_FILL 0x1B02
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_POLYGON_MODE 0x0B40
+#define GL_POLYGON_SMOOTH 0x0B41
+#define GL_POLYGON_STIPPLE 0x0B42
+#define GL_EDGE_FLAG 0x0B43
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_FILL 0x8037
+
+/* Display Lists */
+#define GL_COMPILE 0x1300
+#define GL_COMPILE_AND_EXECUTE 0x1301
+#define GL_LIST_BASE 0x0B32
+#define GL_LIST_INDEX 0x0B33
+#define GL_LIST_MODE 0x0B30
+
+/* Depth buffer */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+#define GL_DEPTH_TEST 0x0B71
+#define GL_DEPTH_BITS 0x0D56
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_COMPONENT 0x1902
+
+/* Lighting */
+#define GL_LIGHTING 0x0B50
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+#define GL_SPOT_EXPONENT 0x1205
+#define GL_SPOT_CUTOFF 0x1206
+#define GL_CONSTANT_ATTENUATION 0x1207
+#define GL_LINEAR_ATTENUATION 0x1208
+#define GL_QUADRATIC_ATTENUATION 0x1209
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_SHININESS 0x1601
+#define GL_EMISSION 0x1600
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+#define GL_COLOR_INDEXES 0x1603
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_SHADE_MODEL 0x0B54
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_COLOR_MATERIAL_FACE 0x0B55
+#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
+#define GL_NORMALIZE 0x0BA1
+
+/* User clipping planes */
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+
+/* Accumulation buffer */
+#define GL_ACCUM_RED_BITS 0x0D58
+#define GL_ACCUM_GREEN_BITS 0x0D59
+#define GL_ACCUM_BLUE_BITS 0x0D5A
+#define GL_ACCUM_ALPHA_BITS 0x0D5B
+#define GL_ACCUM_CLEAR_VALUE 0x0B80
+#define GL_ACCUM 0x0100
+#define GL_ADD 0x0104
+#define GL_LOAD 0x0101
+#define GL_MULT 0x0103
+#define GL_RETURN 0x0102
+
+/* Alpha testing */
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+
+/* Blending */
+#define GL_BLEND 0x0BE2
+#define GL_BLEND_SRC 0x0BE1
+#define GL_BLEND_DST 0x0BE0
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+
+/* Render Mode */
+#define GL_FEEDBACK 0x1C01
+#define GL_RENDER 0x1C00
+#define GL_SELECT 0x1C02
+
+/* Feedback */
+#define GL_2D 0x0600
+#define GL_3D 0x0601
+#define GL_3D_COLOR 0x0602
+#define GL_3D_COLOR_TEXTURE 0x0603
+#define GL_4D_COLOR_TEXTURE 0x0604
+#define GL_POINT_TOKEN 0x0701
+#define GL_LINE_TOKEN 0x0702
+#define GL_LINE_RESET_TOKEN 0x0707
+#define GL_POLYGON_TOKEN 0x0703
+#define GL_BITMAP_TOKEN 0x0704
+#define GL_DRAW_PIXEL_TOKEN 0x0705
+#define GL_COPY_PIXEL_TOKEN 0x0706
+#define GL_PASS_THROUGH_TOKEN 0x0700
+#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
+#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
+#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
+
+/* Selection */
+#define GL_SELECTION_BUFFER_POINTER 0x0DF3
+#define GL_SELECTION_BUFFER_SIZE 0x0DF4
+
+/* Fog */
+#define GL_FOG 0x0B60
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_COLOR 0x0B66
+#define GL_FOG_INDEX 0x0B61
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_LINEAR 0x2601
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+
+/* Logic Ops */
+#define GL_LOGIC_OP 0x0BF1
+#define GL_INDEX_LOGIC_OP 0x0BF1
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_CLEAR 0x1500
+#define GL_SET 0x150F
+#define GL_COPY 0x1503
+#define GL_COPY_INVERTED 0x150C
+#define GL_NOOP 0x1505
+#define GL_INVERT 0x150A
+#define GL_AND 0x1501
+#define GL_NAND 0x150E
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_XOR 0x1506
+#define GL_EQUIV 0x1509
+#define GL_AND_REVERSE 0x1502
+#define GL_AND_INVERTED 0x1504
+#define GL_OR_REVERSE 0x150B
+#define GL_OR_INVERTED 0x150D
+
+/* Stencil */
+#define GL_STENCIL_BITS 0x0D57
+#define GL_STENCIL_TEST 0x0B90
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_INDEX 0x1901
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+
+/* Buffers, Pixel Drawing/Reading */
+#define GL_NONE 0
+#define GL_LEFT 0x0406
+#define GL_RIGHT 0x0407
+/*GL_FRONT 0x0404 */
+/*GL_BACK 0x0405 */
+/*GL_FRONT_AND_BACK 0x0408 */
+#define GL_FRONT_LEFT 0x0400
+#define GL_FRONT_RIGHT 0x0401
+#define GL_BACK_LEFT 0x0402
+#define GL_BACK_RIGHT 0x0403
+#define GL_AUX0 0x0409
+#define GL_AUX1 0x040A
+#define GL_AUX2 0x040B
+#define GL_AUX3 0x040C
+#define GL_COLOR_INDEX 0x1900
+#define GL_RED 0x1903
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_ALPHA 0x1906
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_ALPHA_BITS 0x0D55
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_INDEX_BITS 0x0D51
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_AUX_BUFFERS 0x0C00
+#define GL_READ_BUFFER 0x0C02
+#define GL_DRAW_BUFFER 0x0C01
+#define GL_DOUBLEBUFFER 0x0C32
+#define GL_STEREO 0x0C33
+#define GL_BITMAP 0x1A00
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_DITHER 0x0BD0
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+
+/* Implementation limits */
+#define GL_MAX_LIST_NESTING 0x0B31
+#define GL_MAX_EVAL_ORDER 0x0D30
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
+#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_NAME_STACK_DEPTH 0x0D37
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
+
+/* Gets */
+#define GL_ATTRIB_STACK_DEPTH 0x0BB0
+#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_CURRENT_INDEX 0x0B01
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_RASTER_COLOR 0x0B04
+#define GL_CURRENT_RASTER_DISTANCE 0x0B09
+#define GL_CURRENT_RASTER_INDEX 0x0B05
+#define GL_CURRENT_RASTER_POSITION 0x0B07
+#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
+#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_INDEX_CLEAR_VALUE 0x0C20
+#define GL_INDEX_MODE 0x0C30
+#define GL_INDEX_WRITEMASK 0x0C21
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_NAME_STACK_DEPTH 0x0D70
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_RENDER_MODE 0x0C40
+#define GL_RGBA_MODE 0x0C31
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_VIEWPORT 0x0BA2
+
+/* Evaluators */
+#define GL_AUTO_NORMAL 0x0D80
+#define GL_MAP1_COLOR_4 0x0D90
+#define GL_MAP1_INDEX 0x0D91
+#define GL_MAP1_NORMAL 0x0D92
+#define GL_MAP1_TEXTURE_COORD_1 0x0D93
+#define GL_MAP1_TEXTURE_COORD_2 0x0D94
+#define GL_MAP1_TEXTURE_COORD_3 0x0D95
+#define GL_MAP1_TEXTURE_COORD_4 0x0D96
+#define GL_MAP1_VERTEX_3 0x0D97
+#define GL_MAP1_VERTEX_4 0x0D98
+#define GL_MAP2_COLOR_4 0x0DB0
+#define GL_MAP2_INDEX 0x0DB1
+#define GL_MAP2_NORMAL 0x0DB2
+#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
+#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
+#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
+#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
+#define GL_MAP2_VERTEX_3 0x0DB7
+#define GL_MAP2_VERTEX_4 0x0DB8
+#define GL_MAP1_GRID_DOMAIN 0x0DD0
+#define GL_MAP1_GRID_SEGMENTS 0x0DD1
+#define GL_MAP2_GRID_DOMAIN 0x0DD2
+#define GL_MAP2_GRID_SEGMENTS 0x0DD3
+#define GL_COEFF 0x0A00
+#define GL_ORDER 0x0A01
+#define GL_DOMAIN 0x0A02
+
+/* Hints */
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_POLYGON_SMOOTH_HINT 0x0C53
+#define GL_FOG_HINT 0x0C54
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* Scissor box */
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+
+/* Pixel Mode / Transfer */
+#define GL_MAP_COLOR 0x0D10
+#define GL_MAP_STENCIL 0x0D11
+#define GL_INDEX_SHIFT 0x0D12
+#define GL_INDEX_OFFSET 0x0D13
+#define GL_RED_SCALE 0x0D14
+#define GL_RED_BIAS 0x0D15
+#define GL_GREEN_SCALE 0x0D18
+#define GL_GREEN_BIAS 0x0D19
+#define GL_BLUE_SCALE 0x0D1A
+#define GL_BLUE_BIAS 0x0D1B
+#define GL_ALPHA_SCALE 0x0D1C
+#define GL_ALPHA_BIAS 0x0D1D
+#define GL_DEPTH_SCALE 0x0D1E
+#define GL_DEPTH_BIAS 0x0D1F
+#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
+#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
+#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
+#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
+#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
+#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
+#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
+#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
+#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
+#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
+#define GL_PIXEL_MAP_S_TO_S 0x0C71
+#define GL_PIXEL_MAP_I_TO_I 0x0C70
+#define GL_PIXEL_MAP_I_TO_R 0x0C72
+#define GL_PIXEL_MAP_I_TO_G 0x0C73
+#define GL_PIXEL_MAP_I_TO_B 0x0C74
+#define GL_PIXEL_MAP_I_TO_A 0x0C75
+#define GL_PIXEL_MAP_R_TO_R 0x0C76
+#define GL_PIXEL_MAP_G_TO_G 0x0C77
+#define GL_PIXEL_MAP_B_TO_B 0x0C78
+#define GL_PIXEL_MAP_A_TO_A 0x0C79
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_PACK_LSB_FIRST 0x0D01
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SWAP_BYTES 0x0D00
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_UNPACK_LSB_FIRST 0x0CF1
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SWAP_BYTES 0x0CF0
+#define GL_ZOOM_X 0x0D16
+#define GL_ZOOM_Y 0x0D17
+
+/* Texture mapping */
+#define GL_TEXTURE_ENV 0x2300
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_ENV_COLOR 0x2201
+#define GL_TEXTURE_GEN_S 0x0C60
+#define GL_TEXTURE_GEN_T 0x0C61
+#define GL_TEXTURE_GEN_R 0x0C62
+#define GL_TEXTURE_GEN_Q 0x0C63
+#define GL_TEXTURE_GEN_MODE 0x2500
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_BORDER 0x1005
+#define GL_TEXTURE_COMPONENTS 0x1003
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
+#define GL_TEXTURE_INTENSITY_SIZE 0x8061
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_OBJECT_LINEAR 0x2401
+#define GL_OBJECT_PLANE 0x2501
+#define GL_EYE_LINEAR 0x2400
+#define GL_EYE_PLANE 0x2502
+#define GL_SPHERE_MAP 0x2402
+#define GL_DECAL 0x2101
+#define GL_MODULATE 0x2100
+#define GL_NEAREST 0x2600
+#define GL_REPEAT 0x2901
+#define GL_CLAMP 0x2900
+#define GL_S 0x2000
+#define GL_T 0x2001
+#define GL_R 0x2002
+#define GL_Q 0x2003
+
+/* Utility */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* Errors */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* glPush/PopAttrib bits */
+#define GL_CURRENT_BIT 0x00000001
+#define GL_POINT_BIT 0x00000002
+#define GL_LINE_BIT 0x00000004
+#define GL_POLYGON_BIT 0x00000008
+#define GL_POLYGON_STIPPLE_BIT 0x00000010
+#define GL_PIXEL_MODE_BIT 0x00000020
+#define GL_LIGHTING_BIT 0x00000040
+#define GL_FOG_BIT 0x00000080
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_ACCUM_BUFFER_BIT 0x00000200
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_VIEWPORT_BIT 0x00000800
+#define GL_TRANSFORM_BIT 0x00001000
+#define GL_ENABLE_BIT 0x00002000
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_HINT_BIT 0x00008000
+#define GL_EVAL_BIT 0x00010000
+#define GL_LIST_BIT 0x00020000
+#define GL_TEXTURE_BIT 0x00040000
+#define GL_SCISSOR_BIT 0x00080000
+#define GL_ALL_ATTRIB_BITS 0x000FFFFF
+
+
+/* OpenGL 1.1 */
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_2D 0x8064
+#define GL_TEXTURE_PRIORITY 0x8066
+#define GL_TEXTURE_RESIDENT 0x8067
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_ALPHA4 0x803B
+#define GL_ALPHA8 0x803C
+#define GL_ALPHA12 0x803D
+#define GL_ALPHA16 0x803E
+#define GL_LUMINANCE4 0x803F
+#define GL_LUMINANCE8 0x8040
+#define GL_LUMINANCE12 0x8041
+#define GL_LUMINANCE16 0x8042
+#define GL_LUMINANCE4_ALPHA4 0x8043
+#define GL_LUMINANCE6_ALPHA2 0x8044
+#define GL_LUMINANCE8_ALPHA8 0x8045
+#define GL_LUMINANCE12_ALPHA4 0x8046
+#define GL_LUMINANCE12_ALPHA12 0x8047
+#define GL_LUMINANCE16_ALPHA16 0x8048
+#define GL_INTENSITY 0x8049
+#define GL_INTENSITY4 0x804A
+#define GL_INTENSITY8 0x804B
+#define GL_INTENSITY12 0x804C
+#define GL_INTENSITY16 0x804D
+#define GL_R3_G3_B2 0x2A10
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB8 0x8051
+#define GL_RGB10 0x8052
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGBA2 0x8055
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
+#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
+#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
+#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
+
+
+
+/*
+ * Miscellaneous
+ */
+
+GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
+
+GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
+
+GLAPI void GLAPIENTRY glClear( GLbitfield mask );
+
+GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
+
+GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
+
+GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
+
+GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
+
+GLAPI void GLAPIENTRY glLogicOp( GLenum opcode );
+
+GLAPI void GLAPIENTRY glCullFace( GLenum mode );
+
+GLAPI void GLAPIENTRY glFrontFace( GLenum mode );
+
+GLAPI void GLAPIENTRY glPointSize( GLfloat size );
+
+GLAPI void GLAPIENTRY glLineWidth( GLfloat width );
+
+GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern );
+
+GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode );
+
+GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
+
+GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask );
+
+GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask );
+
+GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
+
+GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
+
+GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
+
+GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
+
+GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation );
+
+GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode );
+
+GLAPI void GLAPIENTRY glReadBuffer( GLenum mode );
+
+GLAPI void GLAPIENTRY glEnable( GLenum cap );
+
+GLAPI void GLAPIENTRY glDisable( GLenum cap );
+
+GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap );
+
+
+GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */
+
+
+GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params );
+
+GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params );
+
+GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask );
+
+GLAPI void GLAPIENTRY glPopAttrib( void );
+
+
+GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */
+
+
+GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode );
+
+GLAPI GLenum GLAPIENTRY glGetError( void );
+
+GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name );
+
+GLAPI void GLAPIENTRY glFinish( void );
+
+GLAPI void GLAPIENTRY glFlush( void );
+
+GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode );
+
+
+/*
+ * Depth Buffer
+ */
+
+GLAPI void GLAPIENTRY glClearDepth( GLclampd depth );
+
+GLAPI void GLAPIENTRY glDepthFunc( GLenum func );
+
+GLAPI void GLAPIENTRY glDepthMask( GLboolean flag );
+
+GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
+
+
+/*
+ * Accumulation Buffer
+ */
+
+GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
+
+GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
+
+
+/*
+ * Transformation
+ */
+
+GLAPI void GLAPIENTRY glMatrixMode( GLenum mode );
+
+GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble near_val, GLdouble far_val );
+
+GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble near_val, GLdouble far_val );
+
+GLAPI void GLAPIENTRY glViewport( GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+GLAPI void GLAPIENTRY glPushMatrix( void );
+
+GLAPI void GLAPIENTRY glPopMatrix( void );
+
+GLAPI void GLAPIENTRY glLoadIdentity( void );
+
+GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m );
+GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m );
+
+GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m );
+GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m );
+
+GLAPI void GLAPIENTRY glRotated( GLdouble angle,
+ GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glRotatef( GLfloat angle,
+ GLfloat x, GLfloat y, GLfloat z );
+
+GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
+
+GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z );
+
+
+/*
+ * Display Lists
+ */
+
+GLAPI GLboolean GLAPIENTRY glIsList( GLuint list );
+
+GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range );
+
+GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range );
+
+GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode );
+
+GLAPI void GLAPIENTRY glEndList( void );
+
+GLAPI void GLAPIENTRY glCallList( GLuint list );
+
+GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type,
+ const GLvoid *lists );
+
+GLAPI void GLAPIENTRY glListBase( GLuint base );
+
+
+/*
+ * Drawing Functions
+ */
+
+GLAPI void GLAPIENTRY glBegin( GLenum mode );
+
+GLAPI void GLAPIENTRY glEnd( void );
+
+
+GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y );
+GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y );
+GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y );
+GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y );
+
+GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z );
+GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z );
+GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z );
+
+GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w );
+GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
+
+GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex2iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex3iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex4iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
+GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
+GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
+GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz );
+GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz );
+
+GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glNormal3iv( const GLint *v );
+GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glIndexd( GLdouble c );
+GLAPI void GLAPIENTRY glIndexf( GLfloat c );
+GLAPI void GLAPIENTRY glIndexi( GLint c );
+GLAPI void GLAPIENTRY glIndexs( GLshort c );
+GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c );
+GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c );
+GLAPI void GLAPIENTRY glIndexiv( const GLint *c );
+GLAPI void GLAPIENTRY glIndexsv( const GLshort *c );
+GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue );
+GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue );
+GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue );
+GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue );
+GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue );
+GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
+GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue );
+GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue );
+
+GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green,
+ GLbyte blue, GLbyte alpha );
+GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green,
+ GLdouble blue, GLdouble alpha );
+GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha );
+GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green,
+ GLint blue, GLint alpha );
+GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green,
+ GLshort blue, GLshort alpha );
+GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green,
+ GLubyte blue, GLubyte alpha );
+GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green,
+ GLuint blue, GLuint alpha );
+GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green,
+ GLushort blue, GLushort alpha );
+
+
+GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glColor3iv( const GLint *v );
+GLAPI void GLAPIENTRY glColor3sv( const GLshort *v );
+GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v );
+GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v );
+GLAPI void GLAPIENTRY glColor3usv( const GLushort *v );
+
+GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glColor4iv( const GLint *v );
+GLAPI void GLAPIENTRY glColor4sv( const GLshort *v );
+GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v );
+GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v );
+GLAPI void GLAPIENTRY glColor4usv( const GLushort *v );
+
+
+GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s );
+GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s );
+GLAPI void GLAPIENTRY glTexCoord1i( GLint s );
+GLAPI void GLAPIENTRY glTexCoord1s( GLshort s );
+
+GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t );
+GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t );
+GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t );
+GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t );
+
+GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
+GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
+GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r );
+GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r );
+
+GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q );
+GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
+
+GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y );
+GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y );
+GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y );
+GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y );
+
+GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
+GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z );
+GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z );
+
+GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w );
+GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
+
+GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
+GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
+GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
+GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
+
+
+GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 );
+GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 );
+GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 );
+GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 );
+
+
+/*
+ * Vertex Arrays (1.1)
+ */
+
+GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride,
+ const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride,
+ const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params );
+
+GLAPI void GLAPIENTRY glArrayElement( GLint i );
+
+GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
+
+GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices );
+
+GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride,
+ const GLvoid *pointer );
+
+/*
+ * Lighting
+ */
+
+GLAPI void GLAPIENTRY glShadeModel( GLenum mode );
+
+GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname,
+ const GLfloat *params );
+GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname,
+ GLfloat *params );
+GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params );
+
+GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode );
+
+
+/*
+ * Raster functions
+ */
+
+GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor );
+
+GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize,
+ const GLfloat *values );
+GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize,
+ const GLuint *values );
+GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize,
+ const GLushort *values );
+
+GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values );
+GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values );
+GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values );
+
+GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height,
+ GLfloat xorig, GLfloat yorig,
+ GLfloat xmove, GLfloat ymove,
+ const GLubyte *bitmap );
+
+GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum type );
+
+/*
+ * Stenciling
+ */
+
+GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask );
+
+GLAPI void GLAPIENTRY glStencilMask( GLuint mask );
+
+GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
+
+GLAPI void GLAPIENTRY glClearStencil( GLint s );
+
+
+
+/*
+ * Texture mapping
+ */
+
+GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param );
+GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params );
+GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
+GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname,
+ const GLfloat *params );
+GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target,
+ GLenum pname, GLfloat *params);
+GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target,
+ GLenum pname, GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level,
+ GLenum format, GLenum type,
+ GLvoid *pixels );
+
+
+/* 1.1 functions */
+
+GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures );
+
+GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures);
+
+GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture );
+
+GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n,
+ const GLuint *textures,
+ const GLclampf *priorities );
+
+GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences );
+
+GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture );
+
+
+GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid *pixels );
+
+
+GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLint border );
+
+
+GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLint border );
+
+
+GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y,
+ GLsizei width );
+
+
+GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+
+/*
+ * Evaluators
+ */
+
+GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2,
+ GLint stride,
+ GLint order, const GLdouble *points );
+GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2,
+ GLint stride,
+ GLint order, const GLfloat *points );
+
+GLAPI void GLAPIENTRY glMap2d( GLenum target,
+ GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+ GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+ const GLdouble *points );
+GLAPI void GLAPIENTRY glMap2f( GLenum target,
+ GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLfloat *points );
+
+GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v );
+GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v );
+GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v );
+
+GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u );
+GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u );
+
+GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u );
+GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u );
+
+GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v );
+GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v );
+
+GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u );
+GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u );
+
+GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
+GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
+
+GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+ GLint vn, GLdouble v1, GLdouble v2 );
+GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+ GLint vn, GLfloat v1, GLfloat v2 );
+
+GLAPI void GLAPIENTRY glEvalPoint1( GLint i );
+
+GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j );
+
+GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 );
+
+GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
+
+
+/*
+ * Fog
+ */
+
+GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param );
+
+GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params );
+
+GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params );
+
+
+/*
+ * Selection and Feedback
+ */
+
+GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
+
+GLAPI void GLAPIENTRY glPassThrough( GLfloat token );
+
+GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer );
+
+GLAPI void GLAPIENTRY glInitNames( void );
+
+GLAPI void GLAPIENTRY glLoadName( GLuint name );
+
+GLAPI void GLAPIENTRY glPushName( GLuint name );
+
+GLAPI void GLAPIENTRY glPopName( void );
+
+
+
+/*
+ * OpenGL 1.2
+ */
+
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_TEXTURE_BINDING_3D 0x806A
+
+GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start,
+ GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
+
+GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLsizei depth, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLenum format,
+ GLenum type, const GLvoid *pixels);
+
+GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLint x,
+ GLint y, GLsizei width,
+ GLsizei height );
+
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+/*
+ * GL_ARB_imaging
+ */
+
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_COLOR_TABLE 0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
+#define GL_PROXY_COLOR_TABLE 0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
+#define GL_COLOR_TABLE_SCALE 0x80D6
+#define GL_COLOR_TABLE_BIAS 0x80D7
+#define GL_COLOR_TABLE_FORMAT 0x80D8
+#define GL_COLOR_TABLE_WIDTH 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
+#define GL_CONVOLUTION_1D 0x8010
+#define GL_CONVOLUTION_2D 0x8011
+#define GL_SEPARABLE_2D 0x8012
+#define GL_CONVOLUTION_BORDER_MODE 0x8013
+#define GL_CONVOLUTION_FILTER_SCALE 0x8014
+#define GL_CONVOLUTION_FILTER_BIAS 0x8015
+#define GL_REDUCE 0x8016
+#define GL_CONVOLUTION_FORMAT 0x8017
+#define GL_CONVOLUTION_WIDTH 0x8018
+#define GL_CONVOLUTION_HEIGHT 0x8019
+#define GL_MAX_CONVOLUTION_WIDTH 0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
+#define GL_CONSTANT_BORDER 0x8151
+#define GL_REPLICATE_BORDER 0x8153
+#define GL_CONVOLUTION_BORDER_COLOR 0x8154
+#define GL_COLOR_MATRIX 0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
+#define GL_HISTOGRAM 0x8024
+#define GL_PROXY_HISTOGRAM 0x8025
+#define GL_HISTOGRAM_WIDTH 0x8026
+#define GL_HISTOGRAM_FORMAT 0x8027
+#define GL_HISTOGRAM_RED_SIZE 0x8028
+#define GL_HISTOGRAM_GREEN_SIZE 0x8029
+#define GL_HISTOGRAM_BLUE_SIZE 0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
+#define GL_HISTOGRAM_SINK 0x802D
+#define GL_MINMAX 0x802E
+#define GL_MINMAX_FORMAT 0x802F
+#define GL_MINMAX_SINK 0x8030
+#define GL_TABLE_TOO_LARGE 0x8031
+#define GL_BLEND_EQUATION 0x8009
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_COLOR 0x8005
+
+
+GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid *table );
+
+GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
+ GLsizei start, GLsizei count,
+ GLenum format, GLenum type,
+ const GLvoid *data );
+
+GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
+ const GLint *params);
+
+GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
+ const GLfloat *params);
+
+GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *table );
+
+GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
+
+GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha );
+
+GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
+ GLenum internalformat, GLboolean sink );
+
+GLAPI void GLAPIENTRY glResetHistogram( GLenum target );
+
+GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
+ GLenum format, GLenum type,
+ GLvoid *values );
+
+GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
+ GLboolean sink );
+
+GLAPI void GLAPIENTRY glResetMinmax( GLenum target );
+
+GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
+ GLenum format, GLenum types,
+ GLvoid *values );
+
+GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
+ GLenum internalformat, GLsizei width, GLenum format, GLenum type,
+ const GLvoid *image );
+
+GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *image );
+
+GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
+ GLfloat params );
+
+GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
+ const GLfloat *params );
+
+GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
+ GLint params );
+
+GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
+ GLenum internalformat, GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
+ GLenum internalformat, GLint x, GLint y, GLsizei width,
+ GLsizei height);
+
+GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
+ GLenum type, GLvoid *image );
+
+GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *row, const GLvoid *column );
+
+GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
+ GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
+
+
+
+
+/*
+ * OpenGL 1.3
+ */
+
+/* multitexture */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+/* texture_cube_map */
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+/* texture_compression */
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+/* multisample */
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_MULTISAMPLE_BIT 0x20000000
+/* transpose_matrix */
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+/* texture_env_combine */
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_SOURCE0_RGB 0x8580
+#define GL_SOURCE1_RGB 0x8581
+#define GL_SOURCE2_RGB 0x8582
+#define GL_SOURCE0_ALPHA 0x8588
+#define GL_SOURCE1_ALPHA 0x8589
+#define GL_SOURCE2_ALPHA 0x858A
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_OPERAND2_ALPHA 0x859A
+#define GL_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_SUBTRACT 0x84E7
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+/* texture_env_dot3 */
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+/* texture_border_clamp */
+#define GL_CLAMP_TO_BORDER 0x812D
+
+GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
+
+GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
+
+GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
+
+GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
+
+GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
+
+GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
+
+GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
+
+
+typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
+
+
+
+/*
+ * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
+ */
+#ifndef GL_ARB_multitexture
+#define GL_ARB_multitexture 1
+
+#define GL_TEXTURE0_ARB 0x84C0
+#define GL_TEXTURE1_ARB 0x84C1
+#define GL_TEXTURE2_ARB 0x84C2
+#define GL_TEXTURE3_ARB 0x84C3
+#define GL_TEXTURE4_ARB 0x84C4
+#define GL_TEXTURE5_ARB 0x84C5
+#define GL_TEXTURE6_ARB 0x84C6
+#define GL_TEXTURE7_ARB 0x84C7
+#define GL_TEXTURE8_ARB 0x84C8
+#define GL_TEXTURE9_ARB 0x84C9
+#define GL_TEXTURE10_ARB 0x84CA
+#define GL_TEXTURE11_ARB 0x84CB
+#define GL_TEXTURE12_ARB 0x84CC
+#define GL_TEXTURE13_ARB 0x84CD
+#define GL_TEXTURE14_ARB 0x84CE
+#define GL_TEXTURE15_ARB 0x84CF
+#define GL_TEXTURE16_ARB 0x84D0
+#define GL_TEXTURE17_ARB 0x84D1
+#define GL_TEXTURE18_ARB 0x84D2
+#define GL_TEXTURE19_ARB 0x84D3
+#define GL_TEXTURE20_ARB 0x84D4
+#define GL_TEXTURE21_ARB 0x84D5
+#define GL_TEXTURE22_ARB 0x84D6
+#define GL_TEXTURE23_ARB 0x84D7
+#define GL_TEXTURE24_ARB 0x84D8
+#define GL_TEXTURE25_ARB 0x84D9
+#define GL_TEXTURE26_ARB 0x84DA
+#define GL_TEXTURE27_ARB 0x84DB
+#define GL_TEXTURE28_ARB 0x84DC
+#define GL_TEXTURE29_ARB 0x84DD
+#define GL_TEXTURE30_ARB 0x84DE
+#define GL_TEXTURE31_ARB 0x84DF
+#define GL_ACTIVE_TEXTURE_ARB 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
+
+GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
+GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture);
+GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s);
+GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s);
+GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s);
+GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s);
+GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
+GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
+GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
+GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
+GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
+GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
+
+typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
+
+#endif /* GL_ARB_multitexture */
+
+
+
+/*
+ * Define this token if you want "old-style" header file behaviour (extensions
+ * defined in gl.h). Otherwise, extensions will be included from glext.h.
+ */
+#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
+#include "SDL_opengl_glext.h"
+#endif /* GL_GLEXT_LEGACY */
+
+
+
+/*
+ * ???. GL_MESA_packed_depth_stencil
+ * XXX obsolete
+ */
+#ifndef GL_MESA_packed_depth_stencil
+#define GL_MESA_packed_depth_stencil 1
+
+#define GL_DEPTH_STENCIL_MESA 0x8750
+#define GL_UNSIGNED_INT_24_8_MESA 0x8751
+#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
+#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753
+#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
+
+#endif /* GL_MESA_packed_depth_stencil */
+
+
+#ifndef GL_ATI_blend_equation_separate
+#define GL_ATI_blend_equation_separate 1
+
+#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D
+
+GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA );
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA);
+
+#endif /* GL_ATI_blend_equation_separate */
+
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+
+/**
+ ** NOTE!!!!! If you add new functions to this file, or update
+ ** glext.h be sure to regenerate the gl_mangle.h file. See comments
+ ** in that file for details.
+ **/
+
+
+
+/**********************************************************************
+ * Begin system-specific stuff
+ */
+#if defined(PRAGMA_EXPORT_SUPPORTED)
+#pragma export off
+#endif
+
+/*
+ * End system-specific stuff
+ **********************************************************************/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl_h_ */
+
+#endif /* !__IPHONEOS__ */
+
+#endif /* SDL_opengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengl_glext.h b/src/3rdparty/SDL2/include/SDL_opengl_glext.h
index cd3869f..cd3869f 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengl_glext.h
+++ b/src/3rdparty/SDL2/include/SDL_opengl_glext.h
diff --git a/src/3rdparty/SDL2/include/SDL_opengles.h b/src/3rdparty/SDL2/include/SDL_opengles.h
new file mode 100644
index 0000000..18dd984
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_opengles.h
@@ -0,0 +1,39 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_opengles.h
+ *
+ * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
+ */
+#include "SDL_config.h"
+
+#ifdef __IPHONEOS__
+#include <OpenGLES/ES1/gl.h>
+#include <OpenGLES/ES1/glext.h>
+#else
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
diff --git a/src/3rdparty/SDL2/include/SDL_opengles2.h b/src/3rdparty/SDL2/include/SDL_opengles2.h
new file mode 100644
index 0000000..6ccecf2
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_opengles2.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_opengles2.h
+ *
+ * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
+ */
+#include "SDL_config.h"
+
+#ifndef _MSC_VER
+
+#ifdef __IPHONEOS__
+#include <OpenGLES/ES2/gl.h>
+#include <OpenGLES/ES2/glext.h>
+#else
+#include <GLES2/gl2platform.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#endif
+
+#else /* _MSC_VER */
+
+/* OpenGL ES2 headers for Visual Studio */
+#include "SDL_opengles2_khrplatform.h"
+#include "SDL_opengles2_gl2platform.h"
+#include "SDL_opengles2_gl2.h"
+#include "SDL_opengles2_gl2ext.h"
+
+#endif /* _MSC_VER */
+
+#ifndef APIENTRY
+#define APIENTRY GL_APIENTRY
+#endif
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2.h b/src/3rdparty/SDL2/include/SDL_opengles2_gl2.h
index c62fb0a..c62fb0a 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2.h
+++ b/src/3rdparty/SDL2/include/SDL_opengles2_gl2.h
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2ext.h b/src/3rdparty/SDL2/include/SDL_opengles2_gl2ext.h
index e8ca8b1..e8ca8b1 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2ext.h
+++ b/src/3rdparty/SDL2/include/SDL_opengles2_gl2ext.h
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2platform.h b/src/3rdparty/SDL2/include/SDL_opengles2_gl2platform.h
index c325686..c325686 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_gl2platform.h
+++ b/src/3rdparty/SDL2/include/SDL_opengles2_gl2platform.h
diff --git a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_khrplatform.h b/src/3rdparty/SDL2/include/SDL_opengles2_khrplatform.h
index c9e6f17..c9e6f17 100644
--- a/build/vc++/libs/SDL2-2.0.5/include/SDL_opengles2_khrplatform.h
+++ b/src/3rdparty/SDL2/include/SDL_opengles2_khrplatform.h
diff --git a/src/3rdparty/SDL2/include/SDL_pixels.h b/src/3rdparty/SDL2/include/SDL_pixels.h
new file mode 100644
index 0000000..0b4364b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_pixels.h
@@ -0,0 +1,470 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_pixels.h
+ *
+ * Header for the enumerated pixel format definitions.
+ */
+
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_endian.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \name Transparency definitions
+ *
+ * These define alpha as the opacity of a surface.
+ */
+/* @{ */
+#define SDL_ALPHA_OPAQUE 255
+#define SDL_ALPHA_TRANSPARENT 0
+/* @} */
+
+/** Pixel type. */
+enum
+{
+ SDL_PIXELTYPE_UNKNOWN,
+ SDL_PIXELTYPE_INDEX1,
+ SDL_PIXELTYPE_INDEX4,
+ SDL_PIXELTYPE_INDEX8,
+ SDL_PIXELTYPE_PACKED8,
+ SDL_PIXELTYPE_PACKED16,
+ SDL_PIXELTYPE_PACKED32,
+ SDL_PIXELTYPE_ARRAYU8,
+ SDL_PIXELTYPE_ARRAYU16,
+ SDL_PIXELTYPE_ARRAYU32,
+ SDL_PIXELTYPE_ARRAYF16,
+ SDL_PIXELTYPE_ARRAYF32
+};
+
+/** Bitmap pixel order, high bit -> low bit. */
+enum
+{
+ SDL_BITMAPORDER_NONE,
+ SDL_BITMAPORDER_4321,
+ SDL_BITMAPORDER_1234
+};
+
+/** Packed component order, high bit -> low bit. */
+enum
+{
+ SDL_PACKEDORDER_NONE,
+ SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDORDER_RGBX,
+ SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDORDER_BGRX,
+ SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDORDER_BGRA
+};
+
+/** Array component order, low byte -> high byte. */
+/* !!! FIXME: in 2.1, make these not overlap differently with
+ !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
+enum
+{
+ SDL_ARRAYORDER_NONE,
+ SDL_ARRAYORDER_RGB,
+ SDL_ARRAYORDER_RGBA,
+ SDL_ARRAYORDER_ARGB,
+ SDL_ARRAYORDER_BGR,
+ SDL_ARRAYORDER_BGRA,
+ SDL_ARRAYORDER_ABGR
+};
+
+/** Packed component layout. */
+enum
+{
+ SDL_PACKEDLAYOUT_NONE,
+ SDL_PACKEDLAYOUT_332,
+ SDL_PACKEDLAYOUT_4444,
+ SDL_PACKEDLAYOUT_1555,
+ SDL_PACKEDLAYOUT_5551,
+ SDL_PACKEDLAYOUT_565,
+ SDL_PACKEDLAYOUT_8888,
+ SDL_PACKEDLAYOUT_2101010,
+ SDL_PACKEDLAYOUT_1010102
+};
+
+#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
+
+#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
+ ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
+ ((bits) << 8) | ((bytes) << 0))
+
+#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
+#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
+#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
+#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
+#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
+#define SDL_BYTESPERPIXEL(X) \
+ (SDL_ISPIXELFORMAT_FOURCC(X) ? \
+ ((((X) == SDL_PIXELFORMAT_YUY2) || \
+ ((X) == SDL_PIXELFORMAT_UYVY) || \
+ ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
+
+#define SDL_ISPIXELFORMAT_INDEXED(format) \
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
+
+#define SDL_ISPIXELFORMAT_PACKED(format) \
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
+
+#define SDL_ISPIXELFORMAT_ARRAY(format) \
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
+
+#define SDL_ISPIXELFORMAT_ALPHA(format) \
+ ((SDL_ISPIXELFORMAT_PACKED(format) && \
+ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
+ (SDL_ISPIXELFORMAT_ARRAY(format) && \
+ ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
+ (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
+ (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
+ (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
+
+/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
+#define SDL_ISPIXELFORMAT_FOURCC(format) \
+ ((format) && (SDL_PIXELFLAG(format) != 1))
+
+/* Note: If you modify this list, update SDL_GetPixelFormatName() */
+enum
+{
+ SDL_PIXELFORMAT_UNKNOWN,
+ SDL_PIXELFORMAT_INDEX1LSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
+ 1, 0),
+ SDL_PIXELFORMAT_INDEX1MSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
+ 1, 0),
+ SDL_PIXELFORMAT_INDEX4LSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
+ 4, 0),
+ SDL_PIXELFORMAT_INDEX4MSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
+ 4, 0),
+ SDL_PIXELFORMAT_INDEX8 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
+ SDL_PIXELFORMAT_RGB332 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_332, 8, 1),
+ SDL_PIXELFORMAT_RGB444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_4444, 12, 2),
+ SDL_PIXELFORMAT_RGB555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_1555, 15, 2),
+ SDL_PIXELFORMAT_BGR555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_1555, 15, 2),
+ SDL_PIXELFORMAT_ARGB4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_RGBA4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_ABGR4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_BGRA4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_ARGB1555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_1555, 16, 2),
+ SDL_PIXELFORMAT_RGBA5551 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_5551, 16, 2),
+ SDL_PIXELFORMAT_ABGR1555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_1555, 16, 2),
+ SDL_PIXELFORMAT_BGRA5551 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_5551, 16, 2),
+ SDL_PIXELFORMAT_RGB565 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_565, 16, 2),
+ SDL_PIXELFORMAT_BGR565 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_565, 16, 2),
+ SDL_PIXELFORMAT_RGB24 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
+ 24, 3),
+ SDL_PIXELFORMAT_BGR24 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
+ 24, 3),
+ SDL_PIXELFORMAT_RGB888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_RGBX8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_BGR888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_BGRX8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_ARGB8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_RGBA8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_ABGR8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_BGRA8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_ARGB2101010 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_2101010, 32, 4),
+
+ /* Aliases for RGBA byte arrays of color data, for the current platform */
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
+ SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
+ SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
+#else
+ SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
+ SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
+ SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
+#endif
+
+ SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
+ SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
+ SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
+ SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
+ SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
+ SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
+ SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
+ SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+ SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
+ SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
+};
+
+typedef struct SDL_Color
+{
+ Uint8 r;
+ Uint8 g;
+ Uint8 b;
+ Uint8 a;
+} SDL_Color;
+#define SDL_Colour SDL_Color
+
+typedef struct SDL_Palette
+{
+ int ncolors;
+ SDL_Color *colors;
+ Uint32 version;
+ int refcount;
+} SDL_Palette;
+
+/**
+ * \note Everything in the pixel format structure is read-only.
+ */
+typedef struct SDL_PixelFormat
+{
+ Uint32 format;
+ SDL_Palette *palette;
+ Uint8 BitsPerPixel;
+ Uint8 BytesPerPixel;
+ Uint8 padding[2];
+ Uint32 Rmask;
+ Uint32 Gmask;
+ Uint32 Bmask;
+ Uint32 Amask;
+ Uint8 Rloss;
+ Uint8 Gloss;
+ Uint8 Bloss;
+ Uint8 Aloss;
+ Uint8 Rshift;
+ Uint8 Gshift;
+ Uint8 Bshift;
+ Uint8 Ashift;
+ int refcount;
+ struct SDL_PixelFormat *next;
+} SDL_PixelFormat;
+
+/**
+ * \brief Get the human readable name of a pixel format
+ */
+extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
+
+/**
+ * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
+ *
+ * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
+ *
+ * \sa SDL_MasksToPixelFormatEnum()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
+ int *bpp,
+ Uint32 * Rmask,
+ Uint32 * Gmask,
+ Uint32 * Bmask,
+ Uint32 * Amask);
+
+/**
+ * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
+ *
+ * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
+ * wasn't possible.
+ *
+ * \sa SDL_PixelFormatEnumToMasks()
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
+ Uint32 Rmask,
+ Uint32 Gmask,
+ Uint32 Bmask,
+ Uint32 Amask);
+
+/**
+ * \brief Create an SDL_PixelFormat structure from a pixel format enum.
+ */
+extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
+
+/**
+ * \brief Free an SDL_PixelFormat structure.
+ */
+extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
+
+/**
+ * \brief Create a palette structure with the specified number of color
+ * entries.
+ *
+ * \return A new palette, or NULL if there wasn't enough memory.
+ *
+ * \note The palette entries are initialized to white.
+ *
+ * \sa SDL_FreePalette()
+ */
+extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
+
+/**
+ * \brief Set the palette for a pixel format structure.
+ */
+extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
+ SDL_Palette *palette);
+
+/**
+ * \brief Set a range of colors in a palette.
+ *
+ * \param palette The palette to modify.
+ * \param colors An array of colors to copy into the palette.
+ * \param firstcolor The index of the first palette entry to modify.
+ * \param ncolors The number of entries to modify.
+ *
+ * \return 0 on success, or -1 if not all of the colors could be set.
+ */
+extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
+ const SDL_Color * colors,
+ int firstcolor, int ncolors);
+
+/**
+ * \brief Free a palette created with SDL_AllocPalette().
+ *
+ * \sa SDL_AllocPalette()
+ */
+extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
+
+/**
+ * \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
+ *
+ * \sa SDL_MapRGBA
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
+ Uint8 r, Uint8 g, Uint8 b);
+
+/**
+ * \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
+ *
+ * \sa SDL_MapRGB
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
+ Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a);
+
+/**
+ * \brief Get the RGB components from a pixel of the specified format.
+ *
+ * \sa SDL_GetRGBA
+ */
+extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
+ const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b);
+
+/**
+ * \brief Get the RGBA components from a pixel of the specified format.
+ *
+ * \sa SDL_GetRGB
+ */
+extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
+ const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b,
+ Uint8 * a);
+
+/**
+ * \brief Calculate a 256 entry gamma ramp for a gamma value.
+ */
+extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_pixels_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_platform.h b/src/3rdparty/SDL2/include/SDL_platform.h
new file mode 100644
index 0000000..7dea4ce
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_platform.h
@@ -0,0 +1,198 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_platform.h
+ *
+ * Try to get a standard set of platform defines.
+ */
+
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
+
+#if defined(_AIX)
+#undef __AIX__
+#define __AIX__ 1
+#endif
+#if defined(__HAIKU__)
+#undef __HAIKU__
+#define __HAIKU__ 1
+#endif
+#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
+#undef __BSDI__
+#define __BSDI__ 1
+#endif
+#if defined(_arch_dreamcast)
+#undef __DREAMCAST__
+#define __DREAMCAST__ 1
+#endif
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+#undef __FREEBSD__
+#define __FREEBSD__ 1
+#endif
+#if defined(hpux) || defined(__hpux) || defined(__hpux__)
+#undef __HPUX__
+#define __HPUX__ 1
+#endif
+#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
+#undef __IRIX__
+#define __IRIX__ 1
+#endif
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+#undef __LINUX__
+#define __LINUX__ 1
+#endif
+#if defined(ANDROID) || defined(__ANDROID__)
+#undef __ANDROID__
+#undef __LINUX__ /* do we need to do this? */
+#define __ANDROID__ 1
+#endif
+
+#if defined(__APPLE__)
+/* lets us know what version of Mac OS X we're compiling on */
+#include "AvailabilityMacros.h"
+#include "TargetConditionals.h"
+#if TARGET_OS_TV
+#undef __TVOS__
+#define __TVOS__ 1
+#endif
+#if TARGET_OS_IPHONE
+/* if compiling for iOS */
+#undef __IPHONEOS__
+#define __IPHONEOS__ 1
+#undef __MACOSX__
+#else
+/* if not compiling for iOS */
+#undef __MACOSX__
+#define __MACOSX__ 1
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# error SDL for Mac OS X only supports deploying on 10.6 and above.
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
+#endif /* TARGET_OS_IPHONE */
+#endif /* defined(__APPLE__) */
+
+#if defined(__NetBSD__)
+#undef __NETBSD__
+#define __NETBSD__ 1
+#endif
+#if defined(__OpenBSD__)
+#undef __OPENBSD__
+#define __OPENBSD__ 1
+#endif
+#if defined(__OS2__) || defined(__EMX__)
+#undef __OS2__
+#define __OS2__ 1
+#endif
+#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
+#undef __OSF__
+#define __OSF__ 1
+#endif
+#if defined(__QNXNTO__)
+#undef __QNXNTO__
+#define __QNXNTO__ 1
+#endif
+#if defined(riscos) || defined(__riscos) || defined(__riscos__)
+#undef __RISCOS__
+#define __RISCOS__ 1
+#endif
+#if defined(__sun) && defined(__SVR4)
+#undef __SOLARIS__
+#define __SOLARIS__ 1
+#endif
+
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
+/* Try to find out if we're compiling for WinRT or non-WinRT */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
+#include <winapifamily.h>
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
+#undef __WINRT__
+#define __WINRT__ 1
+#else
+#undef __WINDOWS__
+#define __WINDOWS__ 1
+#endif
+#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
+
+#if defined(__WINDOWS__)
+#undef __WIN32__
+#define __WIN32__ 1
+#endif
+#if defined(__PSP__)
+#undef __PSP__
+#define __PSP__ 1
+#endif
+
+/* The NACL compiler defines __native_client__ and __pnacl__
+ * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
+ */
+#if defined(__native_client__)
+#undef __LINUX__
+#undef __NACL__
+#define __NACL__ 1
+#endif
+#if defined(__pnacl__)
+#undef __LINUX__
+#undef __PNACL__
+#define __PNACL__ 1
+/* PNACL with newlib supports static linking only */
+#define __SDL_NOGETPROCADDR__
+#endif
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Gets the name of the platform.
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_platform_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_power.h b/src/3rdparty/SDL2/include/SDL_power.h
new file mode 100644
index 0000000..a4fe8a9
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_power.h
@@ -0,0 +1,75 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_power_h_
+#define SDL_power_h_
+
+/**
+ * \file SDL_power.h
+ *
+ * Header for the SDL power management routines.
+ */
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The basic state for the system's power supply.
+ */
+typedef enum
+{
+ SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
+ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
+ SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
+ SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
+ SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
+} SDL_PowerState;
+
+
+/**
+ * \brief Get the current power supply details.
+ *
+ * \param secs Seconds of battery life left. You can pass a NULL here if
+ * you don't care. Will return -1 if we can't determine a
+ * value, or we're not running on a battery.
+ *
+ * \param pct Percentage of battery life left, between 0 and 100. You can
+ * pass a NULL here if you don't care. Will return -1 if we
+ * can't determine a value, or we're not running on a battery.
+ *
+ * \return The state of the battery (if any).
+ */
+extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_power_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_quit.h b/src/3rdparty/SDL2/include/SDL_quit.h
new file mode 100644
index 0000000..fea56a8
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_quit.h
@@ -0,0 +1,58 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_quit.h
+ *
+ * Include file for SDL quit event handling.
+ */
+
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+/**
+ * \file SDL_quit.h
+ *
+ * An ::SDL_QUIT event is generated when the user tries to close the application
+ * window. If it is ignored or filtered out, the window will remain open.
+ * If it is not ignored or filtered, it is queued normally and the window
+ * is allowed to close. When the window is closed, screen updates will
+ * complete, but have no effect.
+ *
+ * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
+ * and SIGTERM (system termination request), if handlers do not already
+ * exist, that generate ::SDL_QUIT events as well. There is no way
+ * to determine the cause of an ::SDL_QUIT event, but setting a signal
+ * handler in your application will override the default generation of
+ * quit events for that signal.
+ *
+ * \sa SDL_Quit()
+ */
+
+/* There are no functions directly affecting the quit event */
+
+#define SDL_QuitRequested() \
+ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
+
+#endif /* SDL_quit_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_rect.h b/src/3rdparty/SDL2/include/SDL_rect.h
new file mode 100644
index 0000000..543bb61
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_rect.h
@@ -0,0 +1,148 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_rect.h
+ *
+ * Header file for SDL_rect definition and management functions.
+ */
+
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_pixels.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The structure that defines a point
+ *
+ * \sa SDL_EnclosePoints
+ * \sa SDL_PointInRect
+ */
+typedef struct SDL_Point
+{
+ int x;
+ int y;
+} SDL_Point;
+
+/**
+ * \brief A rectangle, with the origin at the upper left.
+ *
+ * \sa SDL_RectEmpty
+ * \sa SDL_RectEquals
+ * \sa SDL_HasIntersection
+ * \sa SDL_IntersectRect
+ * \sa SDL_UnionRect
+ * \sa SDL_EnclosePoints
+ */
+typedef struct SDL_Rect
+{
+ int x, y;
+ int w, h;
+} SDL_Rect;
+
+/**
+ * \brief Returns true if point resides inside a rectangle.
+ */
+SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
+{
+ return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
+ (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
+}
+
+/**
+ * \brief Returns true if the rectangle has no area.
+ */
+SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
+{
+ return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
+}
+
+/**
+ * \brief Returns true if the two rectangles are equal.
+ */
+SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
+{
+ return (a && b && (a->x == b->x) && (a->y == b->y) &&
+ (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
+}
+
+/**
+ * \brief Determine whether two rectangles intersect.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
+ const SDL_Rect * B);
+
+/**
+ * \brief Calculate the intersection of two rectangles.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
+ const SDL_Rect * B,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate the union of two rectangles.
+ */
+extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
+ const SDL_Rect * B,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate a minimal rectangle enclosing a set of points
+ *
+ * \return SDL_TRUE if any points were within the clipping rect
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
+ int count,
+ const SDL_Rect * clip,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate the intersection of a rectangle and line segment.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
+ rect, int *X1,
+ int *Y1, int *X2,
+ int *Y2);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_rect_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_render.h b/src/3rdparty/SDL2/include/SDL_render.h
new file mode 100644
index 0000000..d336192
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_render.h
@@ -0,0 +1,931 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_render.h
+ *
+ * Header file for SDL 2D rendering functions.
+ *
+ * This API supports the following features:
+ * * single pixel points
+ * * single pixel lines
+ * * filled rectangles
+ * * texture images
+ *
+ * The primitives may be drawn in opaque, blended, or additive modes.
+ *
+ * The texture images may be drawn in opaque, blended, or additive modes.
+ * They can have an additional color tint or alpha modulation applied to
+ * them, and may also be stretched with linear interpolation.
+ *
+ * This API is designed to accelerate simple 2D operations. You may
+ * want more functionality such as polygons and particle effects and
+ * in that case you should use SDL's OpenGL/Direct3D support or one
+ * of the many good 3D engines.
+ *
+ * These functions must be called from the main thread.
+ * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
+ */
+
+#ifndef SDL_render_h_
+#define SDL_render_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_rect.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Flags used when creating a rendering context
+ */
+typedef enum
+{
+ SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
+ SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
+ acceleration */
+ SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
+ with the refresh rate */
+ SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
+ rendering to texture */
+} SDL_RendererFlags;
+
+/**
+ * \brief Information on the capabilities of a render driver or context.
+ */
+typedef struct SDL_RendererInfo
+{
+ const char *name; /**< The name of the renderer */
+ Uint32 flags; /**< Supported ::SDL_RendererFlags */
+ Uint32 num_texture_formats; /**< The number of available texture formats */
+ Uint32 texture_formats[16]; /**< The available texture formats */
+ int max_texture_width; /**< The maximum texture width */
+ int max_texture_height; /**< The maximum texture height */
+} SDL_RendererInfo;
+
+/**
+ * \brief The access pattern allowed for a texture.
+ */
+typedef enum
+{
+ SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
+ SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
+ SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
+} SDL_TextureAccess;
+
+/**
+ * \brief The texture channel modulation used in SDL_RenderCopy().
+ */
+typedef enum
+{
+ SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
+ SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
+ SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
+} SDL_TextureModulate;
+
+/**
+ * \brief Flip constants for SDL_RenderCopyEx
+ */
+typedef enum
+{
+ SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
+ SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
+ SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
+} SDL_RendererFlip;
+
+/**
+ * \brief A structure representing rendering state
+ */
+struct SDL_Renderer;
+typedef struct SDL_Renderer SDL_Renderer;
+
+/**
+ * \brief An efficient driver-specific representation of pixel data
+ */
+struct SDL_Texture;
+typedef struct SDL_Texture SDL_Texture;
+
+
+/* Function prototypes */
+
+/**
+ * \brief Get the number of 2D rendering drivers available for the current
+ * display.
+ *
+ * A render driver is a set of code that handles rendering and texture
+ * management on a particular display. Normally there is only one, but
+ * some drivers may have several available with different capabilities.
+ *
+ * \sa SDL_GetRenderDriverInfo()
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
+
+/**
+ * \brief Get information about a specific 2D rendering driver for the current
+ * display.
+ *
+ * \param index The index of the driver to query information about.
+ * \param info A pointer to an SDL_RendererInfo struct to be filled with
+ * information on the rendering driver.
+ *
+ * \return 0 on success, -1 if the index was out of range.
+ *
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
+ SDL_RendererInfo * info);
+
+/**
+ * \brief Create a window and default renderer
+ *
+ * \param width The width of the window
+ * \param height The height of the window
+ * \param window_flags The flags used to create the window
+ * \param window A pointer filled with the window, or NULL on error
+ * \param renderer A pointer filled with the renderer, or NULL on error
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(
+ int width, int height, Uint32 window_flags,
+ SDL_Window **window, SDL_Renderer **renderer);
+
+
+/**
+ * \brief Create a 2D rendering context for a window.
+ *
+ * \param window The window where rendering is displayed.
+ * \param index The index of the rendering driver to initialize, or -1 to
+ * initialize the first one supporting the requested flags.
+ * \param flags ::SDL_RendererFlags.
+ *
+ * \return A valid rendering context or NULL if there was an error.
+ *
+ * \sa SDL_CreateSoftwareRenderer()
+ * \sa SDL_GetRendererInfo()
+ * \sa SDL_DestroyRenderer()
+ */
+extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
+ int index, Uint32 flags);
+
+/**
+ * \brief Create a 2D software rendering context for a surface.
+ *
+ * \param surface The surface where rendering is done.
+ *
+ * \return A valid rendering context or NULL if there was an error.
+ *
+ * \sa SDL_CreateRenderer()
+ * \sa SDL_DestroyRenderer()
+ */
+extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
+
+/**
+ * \brief Get the renderer associated with a window.
+ */
+extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
+
+/**
+ * \brief Get information about a rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
+ SDL_RendererInfo * info);
+
+/**
+ * \brief Get the output size in pixels of a rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
+ int *w, int *h);
+
+/**
+ * \brief Create a texture for a rendering context.
+ *
+ * \param renderer The renderer.
+ * \param format The format of the texture.
+ * \param access One of the enumerated values in ::SDL_TextureAccess.
+ * \param w The width of the texture in pixels.
+ * \param h The height of the texture in pixels.
+ *
+ * \return The created texture is returned, or NULL if no rendering context was
+ * active, the format was unsupported, or the width or height were out
+ * of range.
+ *
+ * \note The contents of the texture are not defined at creation.
+ *
+ * \sa SDL_QueryTexture()
+ * \sa SDL_UpdateTexture()
+ * \sa SDL_DestroyTexture()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
+ Uint32 format,
+ int access, int w,
+ int h);
+
+/**
+ * \brief Create a texture from an existing surface.
+ *
+ * \param renderer The renderer.
+ * \param surface The surface containing pixel data used to fill the texture.
+ *
+ * \return The created texture is returned, or NULL on error.
+ *
+ * \note The surface is not modified or freed by this function.
+ *
+ * \sa SDL_QueryTexture()
+ * \sa SDL_DestroyTexture()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
+
+/**
+ * \brief Query the attributes of a texture
+ *
+ * \param texture A texture to be queried.
+ * \param format A pointer filled in with the raw format of the texture. The
+ * actual format may differ, but pixel transfers will use this
+ * format.
+ * \param access A pointer filled in with the actual access to the texture.
+ * \param w A pointer filled in with the width of the texture in pixels.
+ * \param h A pointer filled in with the height of the texture in pixels.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ */
+extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
+ Uint32 * format, int *access,
+ int *w, int *h);
+
+/**
+ * \brief Set an additional color value used in render copy operations.
+ *
+ * \param texture The texture to update.
+ * \param r The red color value multiplied into copy operations.
+ * \param g The green color value multiplied into copy operations.
+ * \param b The blue color value multiplied into copy operations.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or color modulation
+ * is not supported.
+ *
+ * \sa SDL_GetTextureColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
+ Uint8 r, Uint8 g, Uint8 b);
+
+
+/**
+ * \brief Get the additional color value used in render copy operations.
+ *
+ * \param texture The texture to query.
+ * \param r A pointer filled in with the current red color value.
+ * \param g A pointer filled in with the current green color value.
+ * \param b A pointer filled in with the current blue color value.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
+ Uint8 * r, Uint8 * g,
+ Uint8 * b);
+
+/**
+ * \brief Set an additional alpha value used in render copy operations.
+ *
+ * \param texture The texture to update.
+ * \param alpha The alpha value multiplied into copy operations.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or alpha modulation
+ * is not supported.
+ *
+ * \sa SDL_GetTextureAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
+ Uint8 alpha);
+
+/**
+ * \brief Get the additional alpha value used in render copy operations.
+ *
+ * \param texture The texture to query.
+ * \param alpha A pointer filled in with the current alpha value.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
+ Uint8 * alpha);
+
+/**
+ * \brief Set the blend mode used for texture copy operations.
+ *
+ * \param texture The texture to update.
+ * \param blendMode ::SDL_BlendMode to use for texture blending.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or the blend mode is
+ * not supported.
+ *
+ * \note If the blend mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetTextureBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
+ SDL_BlendMode blendMode);
+
+/**
+ * \brief Get the blend mode used for texture copy operations.
+ *
+ * \param texture The texture to query.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
+ SDL_BlendMode *blendMode);
+
+/**
+ * \brief Update the given texture rectangle with new pixel data.
+ *
+ * \param texture The texture to update
+ * \param rect A pointer to the rectangle of pixels to update, or NULL to
+ * update the entire texture.
+ * \param pixels The raw pixel data in the format of the texture.
+ * \param pitch The number of bytes in a row of pixel data, including padding between lines.
+ *
+ * The pixel data must be in the format of the texture. The pixel format can be
+ * queried with SDL_QueryTexture.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \note This is a fairly slow function.
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const void *pixels, int pitch);
+
+/**
+ * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
+ *
+ * \param texture The texture to update
+ * \param rect A pointer to the rectangle of pixels to update, or NULL to
+ * update the entire texture.
+ * \param Yplane The raw pixel data for the Y plane.
+ * \param Ypitch The number of bytes between rows of pixel data for the Y plane.
+ * \param Uplane The raw pixel data for the U plane.
+ * \param Upitch The number of bytes between rows of pixel data for the U plane.
+ * \param Vplane The raw pixel data for the V plane.
+ * \param Vpitch The number of bytes between rows of pixel data for the V plane.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \note You can use SDL_UpdateTexture() as long as your pixel data is
+ * a contiguous block of Y and U/V planes in the proper order, but
+ * this function is available if your pixel data is not contiguous.
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+
+/**
+ * \brief Lock a portion of the texture for write-only pixel access.
+ *
+ * \param texture The texture to lock for access, which was created with
+ * ::SDL_TEXTUREACCESS_STREAMING.
+ * \param rect A pointer to the rectangle to lock for access. If the rect
+ * is NULL, the entire texture will be locked.
+ * \param pixels This is filled in with a pointer to the locked pixels,
+ * appropriately offset by the locked area.
+ * \param pitch This is filled in with the pitch of the locked pixels.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
+ *
+ * \sa SDL_UnlockTexture()
+ */
+extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ void **pixels, int *pitch);
+
+/**
+ * \brief Unlock a texture, uploading the changes to video memory, if needed.
+ *
+ * \sa SDL_LockTexture()
+ */
+extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
+
+/**
+ * \brief Determines whether a window supports the use of render targets
+ *
+ * \param renderer The renderer that will be checked
+ *
+ * \return SDL_TRUE if supported, SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
+
+/**
+ * \brief Set a texture as the current rendering target.
+ *
+ * \param renderer The renderer.
+ * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \sa SDL_GetRenderTarget()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
+ SDL_Texture *texture);
+
+/**
+ * \brief Get the current render target or NULL for the default render target.
+ *
+ * \return The current render target
+ *
+ * \sa SDL_SetRenderTarget()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
+
+/**
+ * \brief Set device independent resolution for rendering
+ *
+ * \param renderer The renderer for which resolution should be set.
+ * \param w The width of the logical resolution
+ * \param h The height of the logical resolution
+ *
+ * This function uses the viewport and scaling functionality to allow a fixed logical
+ * resolution for rendering, regardless of the actual output resolution. If the actual
+ * output resolution doesn't have the same aspect ratio the output rendering will be
+ * centered within the output display.
+ *
+ * If the output display is a window, mouse events in the window will be filtered
+ * and scaled so they seem to arrive within the logical resolution.
+ *
+ * \note If this function results in scaling or subpixel drawing by the
+ * rendering backend, it will be handled using the appropriate
+ * quality hints.
+ *
+ * \sa SDL_RenderGetLogicalSize()
+ * \sa SDL_RenderSetScale()
+ * \sa SDL_RenderSetViewport()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h);
+
+/**
+ * \brief Get device independent resolution for rendering
+ *
+ * \param renderer The renderer from which resolution should be queried.
+ * \param w A pointer filled with the width of the logical resolution
+ * \param h A pointer filled with the height of the logical resolution
+ *
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
+
+/**
+ * \brief Set whether to force integer scales for resolution-independent rendering
+ *
+ * \param renderer The renderer for which integer scaling should be set.
+ * \param enable Enable or disable integer scaling
+ *
+ * This function restricts the logical viewport to integer values - that is, when
+ * a resolution is between two multiples of a logical size, the viewport size is
+ * rounded down to the lower multiple.
+ *
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer,
+ SDL_bool enable);
+
+/**
+ * \brief Get whether integer scales are forced for resolution-independent rendering
+ *
+ * \param renderer The renderer from which integer scaling should be queried.
+ *
+ * \sa SDL_RenderSetIntegerScale()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer);
+
+/**
+ * \brief Set the drawing area for rendering on the current target.
+ *
+ * \param renderer The renderer for which the drawing area should be set.
+ * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
+ *
+ * The x,y of the viewport rect represents the origin for rendering.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \note If the window associated with the renderer is resized, the viewport is automatically reset.
+ *
+ * \sa SDL_RenderGetViewport()
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Get the drawing area for the current target.
+ *
+ * \sa SDL_RenderSetViewport()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
+ SDL_Rect * rect);
+
+/**
+ * \brief Set the clip rectangle for the current target.
+ *
+ * \param renderer The renderer for which clip rectangle should be set.
+ * \param rect A pointer to the rectangle to set as the clip rectangle, or
+ * NULL to disable clipping.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \sa SDL_RenderGetClipRect()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Get the clip rectangle for the current target.
+ *
+ * \param renderer The renderer from which clip rectangle should be queried.
+ * \param rect A pointer filled in with the current clip rectangle, or
+ * an empty rectangle if clipping is disabled.
+ *
+ * \sa SDL_RenderSetClipRect()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
+ SDL_Rect * rect);
+
+/**
+ * \brief Get whether clipping is enabled on the given renderer.
+ *
+ * \param renderer The renderer from which clip state should be queried.
+ *
+ * \sa SDL_RenderGetClipRect()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer);
+
+
+/**
+ * \brief Set the drawing scale for rendering on the current target.
+ *
+ * \param renderer The renderer for which the drawing scale should be set.
+ * \param scaleX The horizontal scaling factor
+ * \param scaleY The vertical scaling factor
+ *
+ * The drawing coordinates are scaled by the x/y scaling factors
+ * before they are used by the renderer. This allows resolution
+ * independent drawing with a single coordinate system.
+ *
+ * \note If this results in scaling or subpixel drawing by the
+ * rendering backend, it will be handled using the appropriate
+ * quality hints. For best results use integer scaling factors.
+ *
+ * \sa SDL_RenderGetScale()
+ * \sa SDL_RenderSetLogicalSize()
+ */
+extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
+ float scaleX, float scaleY);
+
+/**
+ * \brief Get the drawing scale for the current target.
+ *
+ * \param renderer The renderer from which drawing scale should be queried.
+ * \param scaleX A pointer filled in with the horizontal scaling factor
+ * \param scaleY A pointer filled in with the vertical scaling factor
+ *
+ * \sa SDL_RenderSetScale()
+ */
+extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
+ float *scaleX, float *scaleY);
+
+/**
+ * \brief Set the color used for drawing operations (Rect, Line and Clear).
+ *
+ * \param renderer The renderer for which drawing color should be set.
+ * \param r The red value used to draw on the rendering target.
+ * \param g The green value used to draw on the rendering target.
+ * \param b The blue value used to draw on the rendering target.
+ * \param a The alpha value used to draw on the rendering target, usually
+ * ::SDL_ALPHA_OPAQUE (255).
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
+ Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a);
+
+/**
+ * \brief Get the color used for drawing operations (Rect, Line and Clear).
+ *
+ * \param renderer The renderer from which drawing color should be queried.
+ * \param r A pointer to the red value used to draw on the rendering target.
+ * \param g A pointer to the green value used to draw on the rendering target.
+ * \param b A pointer to the blue value used to draw on the rendering target.
+ * \param a A pointer to the alpha value used to draw on the rendering target,
+ * usually ::SDL_ALPHA_OPAQUE (255).
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer,
+ Uint8 * r, Uint8 * g, Uint8 * b,
+ Uint8 * a);
+
+/**
+ * \brief Set the blend mode used for drawing operations (Fill and Line).
+ *
+ * \param renderer The renderer for which blend mode should be set.
+ * \param blendMode ::SDL_BlendMode to use for blending.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \note If the blend mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetRenderDrawBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
+ SDL_BlendMode blendMode);
+
+/**
+ * \brief Get the blend mode used for drawing operations.
+ *
+ * \param renderer The renderer from which blend mode should be queried.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 on error
+ *
+ * \sa SDL_SetRenderDrawBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
+ SDL_BlendMode *blendMode);
+
+/**
+ * \brief Clear the current rendering target with the drawing color
+ *
+ * This function clears the entire rendering target, ignoring the viewport and
+ * the clip rectangle.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
+
+/**
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a point.
+ * \param x The x coordinate of the point.
+ * \param y The y coordinate of the point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
+ int x, int y);
+
+/**
+ * \brief Draw multiple points on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple points.
+ * \param points The points to draw
+ * \param count The number of points to draw
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_Point * points,
+ int count);
+
+/**
+ * \brief Draw a line on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a line.
+ * \param x1 The x coordinate of the start point.
+ * \param y1 The y coordinate of the start point.
+ * \param x2 The x coordinate of the end point.
+ * \param y2 The y coordinate of the end point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
+ int x1, int y1, int x2, int y2);
+
+/**
+ * \brief Draw a series of connected lines on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple lines.
+ * \param points The points along the lines
+ * \param count The number of points, drawing count-1 lines
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_Point * points,
+ int count);
+
+/**
+ * \brief Draw a rectangle on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Draw some number of rectangles on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
+ const SDL_Rect * rects,
+ int count);
+
+/**
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
+ * rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
+ const SDL_Rect * rect);
+
+/**
+ * \brief Fill some number of rectangles on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_Rect * rects,
+ int count);
+
+/**
+ * \brief Copy a portion of the texture to the current rendering target.
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_Rect * dstrect);
+
+/**
+ * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
+ * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
+ * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_Rect * dstrect,
+ const double angle,
+ const SDL_Point *center,
+ const SDL_RendererFlip flip);
+
+/**
+ * \brief Read pixels from the current rendering target.
+ *
+ * \param renderer The renderer from which pixels should be read.
+ * \param rect A pointer to the rectangle to read, or NULL for the entire
+ * render target.
+ * \param format The desired format of the pixel data, or 0 to use the format
+ * of the rendering target
+ * \param pixels A pointer to be filled in with the pixel data
+ * \param pitch The pitch of the pixels parameter.
+ *
+ * \return 0 on success, or -1 if pixel reading is not supported.
+ *
+ * \warning This is a very slow operation, and should not be used frequently.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
+ const SDL_Rect * rect,
+ Uint32 format,
+ void *pixels, int pitch);
+
+/**
+ * \brief Update the screen with rendering performed.
+ */
+extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
+
+/**
+ * \brief Destroy the specified texture.
+ *
+ * \sa SDL_CreateTexture()
+ * \sa SDL_CreateTextureFromSurface()
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
+
+/**
+ * \brief Destroy the rendering context for a window and free associated
+ * textures.
+ *
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
+
+
+/**
+ * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
+ * OpenGL instructions.
+ *
+ * \param texture The SDL texture to bind
+ * \param texw A pointer to a float that will be filled with the texture width
+ * \param texh A pointer to a float that will be filled with the texture height
+ *
+ * \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
+
+/**
+ * \brief Unbind a texture from the current OpenGL/ES/ES2 context.
+ *
+ * \param texture The SDL texture to unbind
+ *
+ * \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
+
+/**
+ * \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ * \param renderer The renderer to query
+ *
+ * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ * \brief Get the Metal command encoder for the current frame
+ *
+ * \param renderer The renderer to query
+ *
+ * \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_render_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_revision.h b/src/3rdparty/SDL2/include/SDL_revision.h
new file mode 100644
index 0000000..dbe9b97
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_revision.h
@@ -0,0 +1,2 @@
+#define SDL_REVISION "hg-11914:f1084c419f33"
+#define SDL_REVISION_NUMBER 11914
diff --git a/src/3rdparty/SDL2/include/SDL_rwops.h b/src/3rdparty/SDL2/include/SDL_rwops.h
new file mode 100644
index 0000000..0960699
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_rwops.h
@@ -0,0 +1,254 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_rwops.h
+ *
+ * This file provides a general interface for SDL to read and write
+ * data streams. It can easily be extended to files, memory, etc.
+ */
+
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* RWops Types */
+#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
+#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
+#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
+#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
+
+/**
+ * This is the read/write operation structure -- very basic.
+ */
+typedef struct SDL_RWops
+{
+ /**
+ * Return the size of the file in this rwops, or -1 if unknown
+ */
+ Sint64 (SDLCALL * size) (struct SDL_RWops * context);
+
+ /**
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
+ *
+ * \return the final offset in the data stream, or -1 on error.
+ */
+ Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
+ int whence);
+
+ /**
+ * Read up to \c maxnum objects each of size \c size from the data
+ * stream to the area pointed at by \c ptr.
+ *
+ * \return the number of objects read, or 0 at error or end of file.
+ */
+ size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
+ size_t size, size_t maxnum);
+
+ /**
+ * Write exactly \c num objects each of size \c size from the area
+ * pointed at by \c ptr to data stream.
+ *
+ * \return the number of objects written, or 0 at error or end of file.
+ */
+ size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
+ size_t size, size_t num);
+
+ /**
+ * Close and free an allocated SDL_RWops structure.
+ *
+ * \return 0 if successful or -1 on write error when flushing data.
+ */
+ int (SDLCALL * close) (struct SDL_RWops * context);
+
+ Uint32 type;
+ union
+ {
+#if defined(__ANDROID__)
+ struct
+ {
+ void *fileNameRef;
+ void *inputStreamRef;
+ void *readableByteChannelRef;
+ void *readMethod;
+ void *assetFileDescriptorRef;
+ long position;
+ long size;
+ long offset;
+ int fd;
+ } androidio;
+#elif defined(__WIN32__)
+ struct
+ {
+ SDL_bool append;
+ void *h;
+ struct
+ {
+ void *data;
+ size_t size;
+ size_t left;
+ } buffer;
+ } windowsio;
+#endif
+
+#ifdef HAVE_STDIO_H
+ struct
+ {
+ SDL_bool autoclose;
+ FILE *fp;
+ } stdio;
+#endif
+ struct
+ {
+ Uint8 *base;
+ Uint8 *here;
+ Uint8 *stop;
+ } mem;
+ struct
+ {
+ void *data1;
+ void *data2;
+ } unknown;
+ } hidden;
+
+} SDL_RWops;
+
+
+/**
+ * \name RWFrom functions
+ *
+ * Functions to create SDL_RWops structures from various data streams.
+ */
+/* @{ */
+
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
+ const char *mode);
+
+#ifdef HAVE_STDIO_H
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
+ SDL_bool autoclose);
+#else
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
+ SDL_bool autoclose);
+#endif
+
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
+ int size);
+
+/* @} *//* RWFrom functions */
+
+
+extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
+extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
+
+#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
+#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
+#define RW_SEEK_END 2 /**< Seek relative to the end of data */
+
+/**
+ * \name Read/write macros
+ *
+ * Macros to easily read and write from an SDL_RWops structure.
+ */
+/* @{ */
+#define SDL_RWsize(ctx) (ctx)->size(ctx)
+#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
+#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
+#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
+#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
+#define SDL_RWclose(ctx) (ctx)->close(ctx)
+/* @} *//* Read/write macros */
+
+
+/**
+ * Load all the data from an SDL data stream.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+ int freesrc);
+
+/**
+ * Load an entire file.
+ *
+ * Convenience macro.
+ */
+#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
+
+/**
+ * \name Read endian functions
+ *
+ * Read an item of the specified endianness and return in native format.
+ */
+/* @{ */
+extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
+extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
+extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
+extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
+extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
+extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
+extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
+/* @} *//* Read endian functions */
+
+/**
+ * \name Write endian functions
+ *
+ * Write an item of native format to the specified endianness.
+ */
+/* @{ */
+extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
+/* @} *//* Write endian functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_rwops_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_scancode.h b/src/3rdparty/SDL2/include/SDL_scancode.h
new file mode 100644
index 0000000..63871aa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_scancode.h
@@ -0,0 +1,413 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_scancode.h
+ *
+ * Defines keyboard scancodes.
+ */
+
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
+
+#include "SDL_stdinc.h"
+
+/**
+ * \brief The SDL keyboard scancode representation.
+ *
+ * Values of this type are used to represent keyboard keys, among other places
+ * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
+ * SDL_Event structure.
+ *
+ * The values in this enumeration are based on the USB usage page standard:
+ * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
+ */
+typedef enum
+{
+ SDL_SCANCODE_UNKNOWN = 0,
+
+ /**
+ * \name Usage page 0x07
+ *
+ * These values are from usage page 0x07 (USB keyboard page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_A = 4,
+ SDL_SCANCODE_B = 5,
+ SDL_SCANCODE_C = 6,
+ SDL_SCANCODE_D = 7,
+ SDL_SCANCODE_E = 8,
+ SDL_SCANCODE_F = 9,
+ SDL_SCANCODE_G = 10,
+ SDL_SCANCODE_H = 11,
+ SDL_SCANCODE_I = 12,
+ SDL_SCANCODE_J = 13,
+ SDL_SCANCODE_K = 14,
+ SDL_SCANCODE_L = 15,
+ SDL_SCANCODE_M = 16,
+ SDL_SCANCODE_N = 17,
+ SDL_SCANCODE_O = 18,
+ SDL_SCANCODE_P = 19,
+ SDL_SCANCODE_Q = 20,
+ SDL_SCANCODE_R = 21,
+ SDL_SCANCODE_S = 22,
+ SDL_SCANCODE_T = 23,
+ SDL_SCANCODE_U = 24,
+ SDL_SCANCODE_V = 25,
+ SDL_SCANCODE_W = 26,
+ SDL_SCANCODE_X = 27,
+ SDL_SCANCODE_Y = 28,
+ SDL_SCANCODE_Z = 29,
+
+ SDL_SCANCODE_1 = 30,
+ SDL_SCANCODE_2 = 31,
+ SDL_SCANCODE_3 = 32,
+ SDL_SCANCODE_4 = 33,
+ SDL_SCANCODE_5 = 34,
+ SDL_SCANCODE_6 = 35,
+ SDL_SCANCODE_7 = 36,
+ SDL_SCANCODE_8 = 37,
+ SDL_SCANCODE_9 = 38,
+ SDL_SCANCODE_0 = 39,
+
+ SDL_SCANCODE_RETURN = 40,
+ SDL_SCANCODE_ESCAPE = 41,
+ SDL_SCANCODE_BACKSPACE = 42,
+ SDL_SCANCODE_TAB = 43,
+ SDL_SCANCODE_SPACE = 44,
+
+ SDL_SCANCODE_MINUS = 45,
+ SDL_SCANCODE_EQUALS = 46,
+ SDL_SCANCODE_LEFTBRACKET = 47,
+ SDL_SCANCODE_RIGHTBRACKET = 48,
+ SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
+ * key on ISO keyboards and at the right end
+ * of the QWERTY row on ANSI keyboards.
+ * Produces REVERSE SOLIDUS (backslash) and
+ * VERTICAL LINE in a US layout, REVERSE
+ * SOLIDUS and VERTICAL LINE in a UK Mac
+ * layout, NUMBER SIGN and TILDE in a UK
+ * Windows layout, DOLLAR SIGN and POUND SIGN
+ * in a Swiss German layout, NUMBER SIGN and
+ * APOSTROPHE in a German layout, GRAVE
+ * ACCENT and POUND SIGN in a French Mac
+ * layout, and ASTERISK and MICRO SIGN in a
+ * French Windows layout.
+ */
+ SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
+ * instead of 49 for the same key, but all
+ * OSes I've seen treat the two codes
+ * identically. So, as an implementor, unless
+ * your keyboard generates both of those
+ * codes and your OS treats them differently,
+ * you should generate SDL_SCANCODE_BACKSLASH
+ * instead of this code. As a user, you
+ * should not rely on this code because SDL
+ * will never generate it with most (all?)
+ * keyboards.
+ */
+ SDL_SCANCODE_SEMICOLON = 51,
+ SDL_SCANCODE_APOSTROPHE = 52,
+ SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
+ * and ISO keyboards). Produces GRAVE ACCENT and
+ * TILDE in a US Windows layout and in US and UK
+ * Mac layouts on ANSI keyboards, GRAVE ACCENT
+ * and NOT SIGN in a UK Windows layout, SECTION
+ * SIGN and PLUS-MINUS SIGN in US and UK Mac
+ * layouts on ISO keyboards, SECTION SIGN and
+ * DEGREE SIGN in a Swiss German layout (Mac:
+ * only on ISO keyboards), CIRCUMFLEX ACCENT and
+ * DEGREE SIGN in a German layout (Mac: only on
+ * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
+ * French Windows layout, COMMERCIAL AT and
+ * NUMBER SIGN in a French Mac layout on ISO
+ * keyboards, and LESS-THAN SIGN and GREATER-THAN
+ * SIGN in a Swiss German, German, or French Mac
+ * layout on ANSI keyboards.
+ */
+ SDL_SCANCODE_COMMA = 54,
+ SDL_SCANCODE_PERIOD = 55,
+ SDL_SCANCODE_SLASH = 56,
+
+ SDL_SCANCODE_CAPSLOCK = 57,
+
+ SDL_SCANCODE_F1 = 58,
+ SDL_SCANCODE_F2 = 59,
+ SDL_SCANCODE_F3 = 60,
+ SDL_SCANCODE_F4 = 61,
+ SDL_SCANCODE_F5 = 62,
+ SDL_SCANCODE_F6 = 63,
+ SDL_SCANCODE_F7 = 64,
+ SDL_SCANCODE_F8 = 65,
+ SDL_SCANCODE_F9 = 66,
+ SDL_SCANCODE_F10 = 67,
+ SDL_SCANCODE_F11 = 68,
+ SDL_SCANCODE_F12 = 69,
+
+ SDL_SCANCODE_PRINTSCREEN = 70,
+ SDL_SCANCODE_SCROLLLOCK = 71,
+ SDL_SCANCODE_PAUSE = 72,
+ SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
+ does send code 73, not 117) */
+ SDL_SCANCODE_HOME = 74,
+ SDL_SCANCODE_PAGEUP = 75,
+ SDL_SCANCODE_DELETE = 76,
+ SDL_SCANCODE_END = 77,
+ SDL_SCANCODE_PAGEDOWN = 78,
+ SDL_SCANCODE_RIGHT = 79,
+ SDL_SCANCODE_LEFT = 80,
+ SDL_SCANCODE_DOWN = 81,
+ SDL_SCANCODE_UP = 82,
+
+ SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
+ */
+ SDL_SCANCODE_KP_DIVIDE = 84,
+ SDL_SCANCODE_KP_MULTIPLY = 85,
+ SDL_SCANCODE_KP_MINUS = 86,
+ SDL_SCANCODE_KP_PLUS = 87,
+ SDL_SCANCODE_KP_ENTER = 88,
+ SDL_SCANCODE_KP_1 = 89,
+ SDL_SCANCODE_KP_2 = 90,
+ SDL_SCANCODE_KP_3 = 91,
+ SDL_SCANCODE_KP_4 = 92,
+ SDL_SCANCODE_KP_5 = 93,
+ SDL_SCANCODE_KP_6 = 94,
+ SDL_SCANCODE_KP_7 = 95,
+ SDL_SCANCODE_KP_8 = 96,
+ SDL_SCANCODE_KP_9 = 97,
+ SDL_SCANCODE_KP_0 = 98,
+ SDL_SCANCODE_KP_PERIOD = 99,
+
+ SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
+ * keyboards have over ANSI ones,
+ * located between left shift and Y.
+ * Produces GRAVE ACCENT and TILDE in a
+ * US or UK Mac layout, REVERSE SOLIDUS
+ * (backslash) and VERTICAL LINE in a
+ * US or UK Windows layout, and
+ * LESS-THAN SIGN and GREATER-THAN SIGN
+ * in a Swiss German, German, or French
+ * layout. */
+ SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
+ SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
+ * not a physical key - but some Mac keyboards
+ * do have a power key. */
+ SDL_SCANCODE_KP_EQUALS = 103,
+ SDL_SCANCODE_F13 = 104,
+ SDL_SCANCODE_F14 = 105,
+ SDL_SCANCODE_F15 = 106,
+ SDL_SCANCODE_F16 = 107,
+ SDL_SCANCODE_F17 = 108,
+ SDL_SCANCODE_F18 = 109,
+ SDL_SCANCODE_F19 = 110,
+ SDL_SCANCODE_F20 = 111,
+ SDL_SCANCODE_F21 = 112,
+ SDL_SCANCODE_F22 = 113,
+ SDL_SCANCODE_F23 = 114,
+ SDL_SCANCODE_F24 = 115,
+ SDL_SCANCODE_EXECUTE = 116,
+ SDL_SCANCODE_HELP = 117,
+ SDL_SCANCODE_MENU = 118,
+ SDL_SCANCODE_SELECT = 119,
+ SDL_SCANCODE_STOP = 120,
+ SDL_SCANCODE_AGAIN = 121, /**< redo */
+ SDL_SCANCODE_UNDO = 122,
+ SDL_SCANCODE_CUT = 123,
+ SDL_SCANCODE_COPY = 124,
+ SDL_SCANCODE_PASTE = 125,
+ SDL_SCANCODE_FIND = 126,
+ SDL_SCANCODE_MUTE = 127,
+ SDL_SCANCODE_VOLUMEUP = 128,
+ SDL_SCANCODE_VOLUMEDOWN = 129,
+/* not sure whether there's a reason to enable these */
+/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
+/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
+/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
+ SDL_SCANCODE_KP_COMMA = 133,
+ SDL_SCANCODE_KP_EQUALSAS400 = 134,
+
+ SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
+ footnotes in USB doc */
+ SDL_SCANCODE_INTERNATIONAL2 = 136,
+ SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
+ SDL_SCANCODE_INTERNATIONAL4 = 138,
+ SDL_SCANCODE_INTERNATIONAL5 = 139,
+ SDL_SCANCODE_INTERNATIONAL6 = 140,
+ SDL_SCANCODE_INTERNATIONAL7 = 141,
+ SDL_SCANCODE_INTERNATIONAL8 = 142,
+ SDL_SCANCODE_INTERNATIONAL9 = 143,
+ SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
+ SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
+ SDL_SCANCODE_LANG3 = 146, /**< Katakana */
+ SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
+ SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
+ SDL_SCANCODE_LANG6 = 149, /**< reserved */
+ SDL_SCANCODE_LANG7 = 150, /**< reserved */
+ SDL_SCANCODE_LANG8 = 151, /**< reserved */
+ SDL_SCANCODE_LANG9 = 152, /**< reserved */
+
+ SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
+ SDL_SCANCODE_SYSREQ = 154,
+ SDL_SCANCODE_CANCEL = 155,
+ SDL_SCANCODE_CLEAR = 156,
+ SDL_SCANCODE_PRIOR = 157,
+ SDL_SCANCODE_RETURN2 = 158,
+ SDL_SCANCODE_SEPARATOR = 159,
+ SDL_SCANCODE_OUT = 160,
+ SDL_SCANCODE_OPER = 161,
+ SDL_SCANCODE_CLEARAGAIN = 162,
+ SDL_SCANCODE_CRSEL = 163,
+ SDL_SCANCODE_EXSEL = 164,
+
+ SDL_SCANCODE_KP_00 = 176,
+ SDL_SCANCODE_KP_000 = 177,
+ SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
+ SDL_SCANCODE_DECIMALSEPARATOR = 179,
+ SDL_SCANCODE_CURRENCYUNIT = 180,
+ SDL_SCANCODE_CURRENCYSUBUNIT = 181,
+ SDL_SCANCODE_KP_LEFTPAREN = 182,
+ SDL_SCANCODE_KP_RIGHTPAREN = 183,
+ SDL_SCANCODE_KP_LEFTBRACE = 184,
+ SDL_SCANCODE_KP_RIGHTBRACE = 185,
+ SDL_SCANCODE_KP_TAB = 186,
+ SDL_SCANCODE_KP_BACKSPACE = 187,
+ SDL_SCANCODE_KP_A = 188,
+ SDL_SCANCODE_KP_B = 189,
+ SDL_SCANCODE_KP_C = 190,
+ SDL_SCANCODE_KP_D = 191,
+ SDL_SCANCODE_KP_E = 192,
+ SDL_SCANCODE_KP_F = 193,
+ SDL_SCANCODE_KP_XOR = 194,
+ SDL_SCANCODE_KP_POWER = 195,
+ SDL_SCANCODE_KP_PERCENT = 196,
+ SDL_SCANCODE_KP_LESS = 197,
+ SDL_SCANCODE_KP_GREATER = 198,
+ SDL_SCANCODE_KP_AMPERSAND = 199,
+ SDL_SCANCODE_KP_DBLAMPERSAND = 200,
+ SDL_SCANCODE_KP_VERTICALBAR = 201,
+ SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
+ SDL_SCANCODE_KP_COLON = 203,
+ SDL_SCANCODE_KP_HASH = 204,
+ SDL_SCANCODE_KP_SPACE = 205,
+ SDL_SCANCODE_KP_AT = 206,
+ SDL_SCANCODE_KP_EXCLAM = 207,
+ SDL_SCANCODE_KP_MEMSTORE = 208,
+ SDL_SCANCODE_KP_MEMRECALL = 209,
+ SDL_SCANCODE_KP_MEMCLEAR = 210,
+ SDL_SCANCODE_KP_MEMADD = 211,
+ SDL_SCANCODE_KP_MEMSUBTRACT = 212,
+ SDL_SCANCODE_KP_MEMMULTIPLY = 213,
+ SDL_SCANCODE_KP_MEMDIVIDE = 214,
+ SDL_SCANCODE_KP_PLUSMINUS = 215,
+ SDL_SCANCODE_KP_CLEAR = 216,
+ SDL_SCANCODE_KP_CLEARENTRY = 217,
+ SDL_SCANCODE_KP_BINARY = 218,
+ SDL_SCANCODE_KP_OCTAL = 219,
+ SDL_SCANCODE_KP_DECIMAL = 220,
+ SDL_SCANCODE_KP_HEXADECIMAL = 221,
+
+ SDL_SCANCODE_LCTRL = 224,
+ SDL_SCANCODE_LSHIFT = 225,
+ SDL_SCANCODE_LALT = 226, /**< alt, option */
+ SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
+ SDL_SCANCODE_RCTRL = 228,
+ SDL_SCANCODE_RSHIFT = 229,
+ SDL_SCANCODE_RALT = 230, /**< alt gr, option */
+ SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
+
+ SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
+ * by any of the above, but since there's a
+ * special KMOD_MODE for it I'm adding it here
+ */
+
+ /* @} *//* Usage page 0x07 */
+
+ /**
+ * \name Usage page 0x0C
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIONEXT = 258,
+ SDL_SCANCODE_AUDIOPREV = 259,
+ SDL_SCANCODE_AUDIOSTOP = 260,
+ SDL_SCANCODE_AUDIOPLAY = 261,
+ SDL_SCANCODE_AUDIOMUTE = 262,
+ SDL_SCANCODE_MEDIASELECT = 263,
+ SDL_SCANCODE_WWW = 264,
+ SDL_SCANCODE_MAIL = 265,
+ SDL_SCANCODE_CALCULATOR = 266,
+ SDL_SCANCODE_COMPUTER = 267,
+ SDL_SCANCODE_AC_SEARCH = 268,
+ SDL_SCANCODE_AC_HOME = 269,
+ SDL_SCANCODE_AC_BACK = 270,
+ SDL_SCANCODE_AC_FORWARD = 271,
+ SDL_SCANCODE_AC_STOP = 272,
+ SDL_SCANCODE_AC_REFRESH = 273,
+ SDL_SCANCODE_AC_BOOKMARKS = 274,
+
+ /* @} *//* Usage page 0x0C */
+
+ /**
+ * \name Walther keys
+ *
+ * These are values that Christian Walther added (for mac keyboard?).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_BRIGHTNESSDOWN = 275,
+ SDL_SCANCODE_BRIGHTNESSUP = 276,
+ SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
+ switch, video mode switch */
+ SDL_SCANCODE_KBDILLUMTOGGLE = 278,
+ SDL_SCANCODE_KBDILLUMDOWN = 279,
+ SDL_SCANCODE_KBDILLUMUP = 280,
+ SDL_SCANCODE_EJECT = 281,
+ SDL_SCANCODE_SLEEP = 282,
+
+ SDL_SCANCODE_APP1 = 283,
+ SDL_SCANCODE_APP2 = 284,
+
+ /* @} *//* Walther keys */
+
+ /**
+ * \name Usage page 0x0C (additional media keys)
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIOREWIND = 285,
+ SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+ /* @} *//* Usage page 0x0C (additional media keys) */
+
+ /* Add any other keys here. */
+
+ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
+ for array bounds */
+} SDL_Scancode;
+
+#endif /* SDL_scancode_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_shape.h b/src/3rdparty/SDL2/include/SDL_shape.h
new file mode 100644
index 0000000..40a6baa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_shape.h
@@ -0,0 +1,144 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_surface.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \file SDL_shape.h
+ *
+ * Header file for the shaped window API.
+ */
+
+#define SDL_NONSHAPEABLE_WINDOW -1
+#define SDL_INVALID_SHAPE_ARGUMENT -2
+#define SDL_WINDOW_LACKS_SHAPE -3
+
+/**
+ * \brief Create a window that can be shaped with the specified position, dimensions, and flags.
+ *
+ * \param title The title of the window, in UTF-8 encoding.
+ * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param w The width of the window.
+ * \param h The height of the window.
+ * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
+ * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
+ * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
+ * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
+ * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
+ *
+ * \return The window created, or NULL if window creation failed.
+ *
+ * \sa SDL_DestroyWindow()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
+
+/**
+ * \brief Return whether the given window is a shaped window.
+ *
+ * \param window The window to query for being shaped.
+ *
+ * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
+ * \sa SDL_CreateShapedWindow
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
+
+/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
+typedef enum {
+ /** \brief The default mode, a binarized alpha cutoff of 1. */
+ ShapeModeDefault,
+ /** \brief A binarized alpha cutoff with a given integer value. */
+ ShapeModeBinarizeAlpha,
+ /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
+ ShapeModeReverseBinarizeAlpha,
+ /** \brief A color key is applied. */
+ ShapeModeColorKey
+} WindowShapeMode;
+
+#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
+
+/** \brief A union containing parameters for shaped windows. */
+typedef union {
+ /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
+ Uint8 binarizationCutoff;
+ SDL_Color colorKey;
+} SDL_WindowShapeParams;
+
+/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
+typedef struct SDL_WindowShapeMode {
+ /** \brief The mode of these window-shape parameters. */
+ WindowShapeMode mode;
+ /** \brief Window-shape parameters. */
+ SDL_WindowShapeParams parameters;
+} SDL_WindowShapeMode;
+
+/**
+ * \brief Set the shape and parameters of a shaped window.
+ *
+ * \param window The shaped window whose parameters should be set.
+ * \param shape A surface encoding the desired shape for the window.
+ * \param shape_mode The parameters to set for the shaped window.
+ *
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ * if the SDL_Window given does not reference a valid shaped window.
+ *
+ * \sa SDL_WindowShapeMode
+ * \sa SDL_GetShapedWindowMode.
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
+
+/**
+ * \brief Get the shape parameters of a shaped window.
+ *
+ * \param window The shaped window whose parameters should be retrieved.
+ * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
+ *
+ * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
+ * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
+ * the SDL_Window given is a shapeable window currently lacking a shape.
+ *
+ * \sa SDL_WindowShapeMode
+ * \sa SDL_SetWindowShape
+ */
+extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_shape_h_ */
diff --git a/src/3rdparty/SDL2/include/SDL_stdinc.h b/src/3rdparty/SDL2/include/SDL_stdinc.h
new file mode 100644
index 0000000..111a064
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_stdinc.h
@@ -0,0 +1,605 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_stdinc.h
+ *
+ * This is a general header that includes C language support.
+ */
+
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
+
+#include "SDL_config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if defined(STDC_HEADERS)
+# include <stdlib.h>
+# include <stddef.h>
+# include <stdarg.h>
+#else
+# if defined(HAVE_STDLIB_H)
+# include <stdlib.h>
+# elif defined(HAVE_MALLOC_H)
+# include <malloc.h>
+# endif
+# if defined(HAVE_STDDEF_H)
+# include <stddef.h>
+# endif
+# if defined(HAVE_STDARG_H)
+# include <stdarg.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#elif defined(HAVE_STDINT_H)
+# include <stdint.h>
+#endif
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_MATH_H
+# if defined(__WINRT__)
+/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
+ WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
+ for more information.
+*/
+# define _USE_MATH_DEFINES
+# endif
+# include <math.h>
+#endif
+#ifdef HAVE_FLOAT_H
+# include <float.h>
+#endif
+
+/**
+ * The number of elements in an array.
+ */
+#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
+#define SDL_TABLESIZE(table) SDL_arraysize(table)
+
+/**
+ * Macro useful for building other macros with strings in them
+ *
+ * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
+ */
+#define SDL_STRINGIFY_ARG(arg) #arg
+
+/**
+ * \name Cast operators
+ *
+ * Use proper C++ casts when compiled as C++ to be compatible with the option
+ * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
+ */
+/* @{ */
+#ifdef __cplusplus
+#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
+#define SDL_static_cast(type, expression) static_cast<type>(expression)
+#define SDL_const_cast(type, expression) const_cast<type>(expression)
+#else
+#define SDL_reinterpret_cast(type, expression) ((type)(expression))
+#define SDL_static_cast(type, expression) ((type)(expression))
+#define SDL_const_cast(type, expression) ((type)(expression))
+#endif
+/* @} *//* Cast operators */
+
+/* Define a four character code as a Uint32 */
+#define SDL_FOURCC(A, B, C, D) \
+ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
+ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
+ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
+ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
+
+/**
+ * \name Basic data types
+ */
+/* @{ */
+
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
+typedef enum
+{
+ SDL_FALSE = 0,
+ SDL_TRUE = 1
+} SDL_bool;
+#endif
+
+/**
+ * \brief A signed 8-bit integer type.
+ */
+#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
+#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
+typedef int8_t Sint8;
+/**
+ * \brief An unsigned 8-bit integer type.
+ */
+#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
+#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
+typedef uint8_t Uint8;
+/**
+ * \brief A signed 16-bit integer type.
+ */
+#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
+#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
+typedef int16_t Sint16;
+/**
+ * \brief An unsigned 16-bit integer type.
+ */
+#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
+#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
+typedef uint16_t Uint16;
+/**
+ * \brief A signed 32-bit integer type.
+ */
+#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
+#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
+typedef int32_t Sint32;
+/**
+ * \brief An unsigned 32-bit integer type.
+ */
+#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
+#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
+typedef uint32_t Uint32;
+
+/**
+ * \brief A signed 64-bit integer type.
+ */
+#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
+#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
+typedef int64_t Sint64;
+/**
+ * \brief An unsigned 64-bit integer type.
+ */
+#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
+#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
+typedef uint64_t Uint64;
+
+/* @} *//* Basic data types */
+
+/* Make sure we have macros for printing 64 bit values.
+ * <stdint.h> should define these but this is not true all platforms.
+ * (for example win32) */
+#ifndef SDL_PRIs64
+#ifdef PRIs64
+#define SDL_PRIs64 PRIs64
+#elif defined(__WIN32__)
+#define SDL_PRIs64 "I64d"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIs64 "ld"
+#else
+#define SDL_PRIs64 "lld"
+#endif
+#endif
+#ifndef SDL_PRIu64
+#ifdef PRIu64
+#define SDL_PRIu64 PRIu64
+#elif defined(__WIN32__)
+#define SDL_PRIu64 "I64u"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIu64 "lu"
+#else
+#define SDL_PRIu64 "llu"
+#endif
+#endif
+#ifndef SDL_PRIx64
+#ifdef PRIx64
+#define SDL_PRIx64 PRIx64
+#elif defined(__WIN32__)
+#define SDL_PRIx64 "I64x"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIx64 "lx"
+#else
+#define SDL_PRIx64 "llx"
+#endif
+#endif
+#ifndef SDL_PRIX64
+#ifdef PRIX64
+#define SDL_PRIX64 PRIX64
+#elif defined(__WIN32__)
+#define SDL_PRIX64 "I64X"
+#elif defined(__LINUX__) && defined(__LP64__)
+#define SDL_PRIX64 "lX"
+#else
+#define SDL_PRIX64 "llX"
+#endif
+#endif
+
+/* Annotations to help code analysis tools */
+#ifdef SDL_DISABLE_ANALYZE_MACROS
+#define SDL_IN_BYTECAP(x)
+#define SDL_INOUT_Z_CAP(x)
+#define SDL_OUT_Z_CAP(x)
+#define SDL_OUT_CAP(x)
+#define SDL_OUT_BYTECAP(x)
+#define SDL_OUT_Z_BYTECAP(x)
+#define SDL_PRINTF_FORMAT_STRING
+#define SDL_SCANF_FORMAT_STRING
+#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
+#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
+#else
+#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
+#include <sal.h>
+
+#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
+#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
+#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
+#define SDL_OUT_CAP(x) _Out_cap_(x)
+#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
+#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
+
+#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
+#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
+#else
+#define SDL_IN_BYTECAP(x)
+#define SDL_INOUT_Z_CAP(x)
+#define SDL_OUT_Z_CAP(x)
+#define SDL_OUT_CAP(x)
+#define SDL_OUT_BYTECAP(x)
+#define SDL_OUT_Z_BYTECAP(x)
+#define SDL_PRINTF_FORMAT_STRING
+#define SDL_SCANF_FORMAT_STRING
+#endif
+#if defined(__GNUC__)
+#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
+#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
+#else
+#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
+#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
+#endif
+#endif /* SDL_DISABLE_ANALYZE_MACROS */
+
+#define SDL_COMPILE_TIME_ASSERT(name, x) \
+ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
+/** \cond */
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
+SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
+SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
+SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
+SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
+SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
+SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
+SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
+SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
+#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
+/** \endcond */
+
+/* Check to make sure enums are the size of ints, for structure packing.
+ For both Watcom C/C++ and Borland C/C++ the compiler option that makes
+ enums having the size of an int must be enabled.
+ This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
+*/
+
+/** \cond */
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
+#if !defined(__ANDROID__)
+ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
+typedef enum
+{
+ DUMMY_ENUM_VALUE
+} SDL_DUMMY_ENUM;
+
+SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
+#endif
+#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
+/** \endcond */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(HAVE_ALLOCA) && !defined(alloca)
+# if defined(HAVE_ALLOCA_H)
+# include <alloca.h>
+# elif defined(__GNUC__)
+# define alloca __builtin_alloca
+# elif defined(_MSC_VER)
+# include <malloc.h>
+# define alloca _alloca
+# elif defined(__WATCOMC__)
+# include <malloc.h>
+# elif defined(__BORLANDC__)
+# include <malloc.h>
+# elif defined(__DMC__)
+# include <stdlib.h>
+# elif defined(__AIX__)
+#pragma alloca
+# elif defined(__MRC__)
+void *alloca(unsigned);
+# else
+char *alloca();
+# endif
+#endif
+#ifdef HAVE_ALLOCA
+#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
+#define SDL_stack_free(data)
+#else
+#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
+#define SDL_stack_free(data) SDL_free(data)
+#endif
+
+extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
+extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
+extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
+extern DECLSPEC void SDLCALL SDL_free(void *mem);
+
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ * \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+ SDL_calloc_func *calloc_func,
+ SDL_realloc_func *realloc_func,
+ SDL_free_func *free_func);
+
+/**
+ * \brief Replace SDL's memory allocation functions with a custom set
+ *
+ * \note If you are replacing SDL's memory functions, you should call
+ * SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ * That means that your free function will be called with memory
+ * allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+ SDL_calloc_func calloc_func,
+ SDL_realloc_func realloc_func,
+ SDL_free_func free_func);
+
+/**
+ * \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
+extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
+extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
+
+extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
+
+extern DECLSPEC int SDLCALL SDL_abs(int x);
+
+/* !!! FIXME: these have side effects. You probably shouldn't use them. */
+/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
+#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
+#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
+
+extern DECLSPEC int SDLCALL SDL_isdigit(int x);
+extern DECLSPEC int SDLCALL SDL_isspace(int x);
+extern DECLSPEC int SDLCALL SDL_toupper(int x);
+extern DECLSPEC int SDLCALL SDL_tolower(int x);
+
+extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
+
+#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
+#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
+
+/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
+SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
+{
+#if defined(__GNUC__) && defined(i386)
+ int u0, u1, u2;
+ __asm__ __volatile__ (
+ "cld \n\t"
+ "rep ; stosl \n\t"
+ : "=&D" (u0), "=&a" (u1), "=&c" (u2)
+ : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
+ : "memory"
+ );
+#else
+ size_t _n = (dwords + 3) / 4;
+ Uint32 *_p = SDL_static_cast(Uint32 *, dst);
+ Uint32 _val = (val);
+ if (dwords == 0)
+ return;
+ switch (dwords % 4)
+ {
+ case 0: do { *_p++ = _val; /* fallthrough */
+ case 3: *_p++ = _val; /* fallthrough */
+ case 2: *_p++ = _val; /* fallthrough */
+ case 1: *_p++ = _val; /* fallthrough */
+ } while ( --_n );
+ }
+#endif
+}
+
+
+extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
+
+extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
+extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+
+extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
+extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
+
+extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
+extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
+extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
+extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
+extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
+extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
+extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
+extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
+extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
+extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
+
+extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
+extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
+
+extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
+extern DECLSPEC double SDLCALL SDL_atof(const char *str);
+extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
+extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
+extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
+extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
+extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
+
+extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
+extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
+extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
+
+extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
+extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
+extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
+extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
+
+#ifndef HAVE_M_PI
+#ifndef M_PI
+#define M_PI 3.14159265358979323846264338327950288 /**< pi */
+#endif
+#endif
+
+extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
+extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
+extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
+extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
+extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
+extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
+extern DECLSPEC double SDLCALL SDL_cos(double x);
+extern DECLSPEC float SDLCALL SDL_cosf(float x);
+extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
+extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
+extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
+extern DECLSPEC double SDLCALL SDL_log10(double x);
+extern DECLSPEC float SDLCALL SDL_log10f(float x);
+extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
+extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
+extern DECLSPEC double SDLCALL SDL_sin(double x);
+extern DECLSPEC float SDLCALL SDL_sinf(float x);
+extern DECLSPEC double SDLCALL SDL_sqrt(double x);
+extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
+extern DECLSPEC double SDLCALL SDL_tan(double x);
+extern DECLSPEC float SDLCALL SDL_tanf(float x);
+
+/* The SDL implementation of iconv() returns these error codes */
+#define SDL_ICONV_ERROR (size_t)-1
+#define SDL_ICONV_E2BIG (size_t)-2
+#define SDL_ICONV_EILSEQ (size_t)-3
+#define SDL_ICONV_EINVAL (size_t)-4
+
+/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
+typedef struct _SDL_iconv_t *SDL_iconv_t;
+extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
+ const char *fromcode);
+extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
+extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
+ size_t * inbytesleft, char **outbuf,
+ size_t * outbytesleft);
+/**
+ * This function converts a string between encodings in one pass, returning a
+ * string that must be freed with SDL_free() or NULL on error.
+ */
+extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
+ const char *fromcode,
+ const char *inbuf,
+ size_t inbytesleft);
+#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
+#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
+#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
+
+/* force builds using Clang's static analysis tools to use literal C runtime
+ here, since there are possibly tests that are ineffective otherwise. */
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_malloc malloc
+#define SDL_calloc calloc
+#define SDL_realloc realloc
+#define SDL_free free
+#define SDL_memset memset
+#define SDL_memcpy memcpy
+#define SDL_memmove memmove
+#define SDL_memcmp memcmp
+#define SDL_strlen strlen
+#define SDL_strlcpy strlcpy
+#define SDL_strlcat strlcat
+#define SDL_strdup strdup
+#define SDL_strchr strchr
+#define SDL_strrchr strrchr
+#define SDL_strstr strstr
+#define SDL_strcmp strcmp
+#define SDL_strncmp strncmp
+#define SDL_strcasecmp strcasecmp
+#define SDL_strncasecmp strncasecmp
+#define SDL_sscanf sscanf
+#define SDL_vsscanf vsscanf
+#define SDL_snprintf snprintf
+#define SDL_vsnprintf vsnprintf
+#endif
+
+SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
+{
+ return SDL_memcpy(dst, src, dwords * 4);
+}
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_stdinc_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_surface.h b/src/3rdparty/SDL2/include/SDL_surface.h
new file mode 100644
index 0000000..45e5366
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_surface.h
@@ -0,0 +1,546 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_surface.h
+ *
+ * Header file for ::SDL_Surface definition and management functions.
+ */
+
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_blendmode.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \name Surface flags
+ *
+ * These are the currently supported flags for the ::SDL_Surface.
+ *
+ * \internal
+ * Used internally (read-only).
+ */
+/* @{ */
+#define SDL_SWSURFACE 0 /**< Just here for compatibility */
+#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
+#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
+#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
+/* @} *//* Surface flags */
+
+/**
+ * Evaluates to true if the surface needs to be locked before access.
+ */
+#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
+
+/**
+ * \brief A collection of pixels used in software blitting.
+ *
+ * \note This structure should be treated as read-only, except for \c pixels,
+ * which, if not NULL, contains the raw pixel data for the surface.
+ */
+typedef struct SDL_Surface
+{
+ Uint32 flags; /**< Read-only */
+ SDL_PixelFormat *format; /**< Read-only */
+ int w, h; /**< Read-only */
+ int pitch; /**< Read-only */
+ void *pixels; /**< Read-write */
+
+ /** Application data associated with the surface */
+ void *userdata; /**< Read-write */
+
+ /** information needed for surfaces requiring locks */
+ int locked; /**< Read-only */
+ void *lock_data; /**< Read-only */
+
+ /** clipping information */
+ SDL_Rect clip_rect; /**< Read-only */
+
+ /** info for fast blit mapping to other surfaces */
+ struct SDL_BlitMap *map; /**< Private */
+
+ /** Reference count -- used when freeing surface */
+ int refcount; /**< Read-mostly */
+} SDL_Surface;
+
+/**
+ * \brief The type of function used for surface blitting functions.
+ */
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+ SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
+ SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
+ SDL_YUV_CONVERSION_BT709, /**< BT.709 */
+ SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
+
+/**
+ * Allocate and free an RGB surface.
+ *
+ * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
+ * If the depth is greater than 8 bits, the pixel format is set using the
+ * flags '[RGB]mask'.
+ *
+ * If the function runs out of memory, it will return NULL.
+ *
+ * \param flags The \c flags are obsolete and should be set to 0.
+ * \param width The width in pixels of the surface to create.
+ * \param height The height in pixels of the surface to create.
+ * \param depth The depth in bits of the surface to create.
+ * \param Rmask The red mask of the surface to create.
+ * \param Gmask The green mask of the surface to create.
+ * \param Bmask The blue mask of the surface to create.
+ * \param Amask The alpha mask of the surface to create.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
+ (Uint32 flags, int width, int height, int depth,
+ Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
+ (Uint32 flags, int width, int height, int depth, Uint32 format);
+
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
+ int width,
+ int height,
+ int depth,
+ int pitch,
+ Uint32 Rmask,
+ Uint32 Gmask,
+ Uint32 Bmask,
+ Uint32 Amask);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
+ (void *pixels, int width, int height, int depth, int pitch, Uint32 format);
+extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
+
+/**
+ * \brief Set the palette used by a surface.
+ *
+ * \return 0, or -1 if the surface format doesn't use a palette.
+ *
+ * \note A single palette can be shared with many surfaces.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
+ SDL_Palette * palette);
+
+/**
+ * \brief Sets up a surface for directly accessing the pixels.
+ *
+ * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
+ * to and read from \c surface->pixels, using the pixel format stored in
+ * \c surface->format. Once you are done accessing the surface, you should
+ * use SDL_UnlockSurface() to release it.
+ *
+ * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
+ * to 0, then you can read and write to the surface at any time, and the
+ * pixel format of the surface will not change.
+ *
+ * No operating system or library calls should be made between lock/unlock
+ * pairs, as critical system locks may be held during this time.
+ *
+ * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
+ *
+ * \sa SDL_UnlockSurface()
+ */
+extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
+/** \sa SDL_LockSurface() */
+extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
+
+/**
+ * Load a surface from a seekable SDL data stream (memory or file).
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The new surface should be freed with SDL_FreeSurface().
+ *
+ * \return the new surface, or NULL if there was an error.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
+ int freesrc);
+
+/**
+ * Load a surface from a file.
+ *
+ * Convenience macro.
+ */
+#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
+
+/**
+ * Save a surface to a seekable SDL data stream (memory or file).
+ *
+ * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
+ * BMP directly. Other RGB formats with 8-bit or higher get converted to a
+ * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
+ * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
+ * not supported.
+ *
+ * If \c freedst is non-zero, the stream will be closed after being written.
+ *
+ * \return 0 if successful or -1 if there was an error.
+ */
+extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
+ (SDL_Surface * surface, SDL_RWops * dst, int freedst);
+
+/**
+ * Save a surface to a file.
+ *
+ * Convenience macro.
+ */
+#define SDL_SaveBMP(surface, file) \
+ SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
+
+/**
+ * \brief Sets the RLE acceleration hint for a surface.
+ *
+ * \return 0 on success, or -1 if the surface is not valid
+ *
+ * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
+ * but the surface must be locked before directly accessing the pixels.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
+ int flag);
+
+/**
+ * \brief Sets the color key (transparent pixel) in a blittable surface.
+ *
+ * \param surface The surface to update
+ * \param flag Non-zero to enable colorkey and 0 to disable colorkey
+ * \param key The transparent pixel in the native surface format
+ *
+ * \return 0 on success, or -1 if the surface is not valid
+ *
+ * You can pass SDL_RLEACCEL to enable RLE accelerated blits.
+ */
+extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
+ int flag, Uint32 key);
+
+/**
+ * \brief Gets the color key (transparent pixel) in a blittable surface.
+ *
+ * \param surface The surface to update
+ * \param key A pointer filled in with the transparent pixel in the native
+ * surface format
+ *
+ * \return 0 on success, or -1 if the surface is not valid or colorkey is not
+ * enabled.
+ */
+extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
+ Uint32 * key);
+
+/**
+ * \brief Set an additional color value used in blit operations.
+ *
+ * \param surface The surface to update.
+ * \param r The red color value multiplied into blit operations.
+ * \param g The green color value multiplied into blit operations.
+ * \param b The blue color value multiplied into blit operations.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_GetSurfaceColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
+ Uint8 r, Uint8 g, Uint8 b);
+
+
+/**
+ * \brief Get the additional color value used in blit operations.
+ *
+ * \param surface The surface to query.
+ * \param r A pointer filled in with the current red color value.
+ * \param g A pointer filled in with the current green color value.
+ * \param b A pointer filled in with the current blue color value.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
+ Uint8 * r, Uint8 * g,
+ Uint8 * b);
+
+/**
+ * \brief Set an additional alpha value used in blit operations.
+ *
+ * \param surface The surface to update.
+ * \param alpha The alpha value multiplied into blit operations.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_GetSurfaceAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
+ Uint8 alpha);
+
+/**
+ * \brief Get the additional alpha value used in blit operations.
+ *
+ * \param surface The surface to query.
+ * \param alpha A pointer filled in with the current alpha value.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
+ Uint8 * alpha);
+
+/**
+ * \brief Set the blend mode used for blit operations.
+ *
+ * \param surface The surface to update.
+ * \param blendMode ::SDL_BlendMode to use for blit blending.
+ *
+ * \return 0 on success, or -1 if the parameters are not valid.
+ *
+ * \sa SDL_GetSurfaceBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
+ SDL_BlendMode blendMode);
+
+/**
+ * \brief Get the blend mode used for blit operations.
+ *
+ * \param surface The surface to query.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
+ SDL_BlendMode *blendMode);
+
+/**
+ * Sets the clipping rectangle for the destination surface in a blit.
+ *
+ * If the clip rectangle is NULL, clipping will be disabled.
+ *
+ * If the clip rectangle doesn't intersect the surface, the function will
+ * return SDL_FALSE and blits will be completely clipped. Otherwise the
+ * function returns SDL_TRUE and blits to the surface will be clipped to
+ * the intersection of the surface area and the clipping rectangle.
+ *
+ * Note that blits are automatically clipped to the edges of the source
+ * and destination surfaces.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
+ const SDL_Rect * rect);
+
+/**
+ * Gets the clipping rectangle for the destination surface in a blit.
+ *
+ * \c rect must be a pointer to a valid rectangle which will be filled
+ * with the correct values.
+ */
+extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
+ SDL_Rect * rect);
+
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
+/**
+ * Creates a new surface of the specified format, and then copies and maps
+ * the given surface to it so the blit of the converted surface will be as
+ * fast as possible. If this function fails, it returns NULL.
+ *
+ * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
+ * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and
+ * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
+ * surface.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
+ (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
+ (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
+
+/**
+ * \brief Copy a block of pixels of one format to another format
+ *
+ * \return 0 on success, or -1 if there was an error
+ */
+extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
+ Uint32 src_format,
+ const void * src, int src_pitch,
+ Uint32 dst_format,
+ void * dst, int dst_pitch);
+
+/**
+ * Performs a fast fill of the given rectangle with \c color.
+ *
+ * If \c rect is NULL, the whole surface will be filled with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_FillRect
+ (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
+extern DECLSPEC int SDLCALL SDL_FillRects
+ (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
+
+/**
+ * Performs a fast blit from the source surface to the destination surface.
+ *
+ * This assumes that the source and destination rectangles are
+ * the same size. If either \c srcrect or \c dstrect are NULL, the entire
+ * surface (\c src or \c dst) is copied. The final blit rectangles are saved
+ * in \c srcrect and \c dstrect after all clipping is performed.
+ *
+ * \return If the blit is successful, it returns 0, otherwise it returns -1.
+ *
+ * The blit function should not be called on a locked surface.
+ *
+ * The blit semantics for surfaces with and without blending and colorkey
+ * are defined as follows:
+ * \verbatim
+ RGBA->RGB:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source alpha-channel and per-surface alpha)
+ SDL_SRCCOLORKEY ignored.
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy RGB.
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ RGB values of the source color key, ignoring alpha in the
+ comparison.
+
+ RGB->RGBA:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source per-surface alpha)
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy RGB, set destination alpha to source per-surface alpha value.
+ both:
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ source color key.
+
+ RGBA->RGBA:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source alpha-channel and per-surface alpha)
+ SDL_SRCCOLORKEY ignored.
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy all of RGBA to the destination.
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ RGB values of the source color key, ignoring alpha in the
+ comparison.
+
+ RGB->RGB:
+ Source surface blend mode set to SDL_BLENDMODE_BLEND:
+ alpha-blend (using the source per-surface alpha)
+ Source surface blend mode set to SDL_BLENDMODE_NONE:
+ copy RGB.
+ both:
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ source color key.
+ \endverbatim
+ *
+ * You should call SDL_BlitSurface() unless you know exactly how SDL
+ * blitting works internally and how to use the other blit functions.
+ */
+#define SDL_BlitSurface SDL_UpperBlit
+
+/**
+ * This is the public blit function, SDL_BlitSurface(), and it performs
+ * rectangle validation and clipping before passing it to SDL_LowerBlit()
+ */
+extern DECLSPEC int SDLCALL SDL_UpperBlit
+ (SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * This is a semi-private blit function and it performs low-level surface
+ * blitting only.
+ */
+extern DECLSPEC int SDLCALL SDL_LowerBlit
+ (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief Perform a fast, low quality, stretch blit between two surfaces of the
+ * same pixel format.
+ *
+ * \note This function uses a static buffer, and is not thread-safe.
+ */
+extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
+ const SDL_Rect * srcrect,
+ SDL_Surface * dst,
+ const SDL_Rect * dstrect);
+
+#define SDL_BlitScaled SDL_UpperBlitScaled
+
+/**
+ * This is the public scaled blit function, SDL_BlitScaled(), and it performs
+ * rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
+ */
+extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
+ (SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * This is a semi-private blit function and it performs low-level surface
+ * scaled blitting only.
+ */
+extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
+ (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ * \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_surface_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_system.h b/src/3rdparty/SDL2/include/SDL_system.h
new file mode 100644
index 0000000..7b776fd
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_system.h
@@ -0,0 +1,247 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_system.h
+ *
+ * Include file for platform specific SDL API functions
+ */
+
+#ifndef SDL_system_h_
+#define SDL_system_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_keyboard.h"
+#include "SDL_render.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Platform specific functions for Windows */
+#ifdef __WIN32__
+
+/**
+ \brief Set a function that is called for every windows message, before TranslateMessage()
+*/
+typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
+extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
+
+/**
+ \brief Returns the D3D9 adapter index that matches the specified display index.
+
+ This adapter index can be passed to IDirect3D9::CreateDevice and controls
+ on which monitor a full screen application will appear.
+*/
+extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
+
+typedef struct IDirect3DDevice9 IDirect3DDevice9;
+/**
+ \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer.
+
+ Once you are done using the device, you should release it to avoid a resource leak.
+ */
+extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
+
+/**
+ \brief Returns the DXGI Adapter and Output indices for the specified display index.
+
+ These can be passed to EnumAdapters and EnumOutputs respectively to get the objects
+ required to create a DX10 or DX11 device and swap chain.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
+
+#endif /* __WIN32__ */
+
+
+/* Platform specific functions for iOS */
+#if defined(__IPHONEOS__) && __IPHONEOS__
+
+#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
+extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+
+#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
+extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
+
+#endif /* __IPHONEOS__ */
+
+
+/* Platform specific functions for Android */
+#if defined(__ANDROID__) && __ANDROID__
+
+/**
+ \brief Get the JNI environment for the current thread
+
+ This returns JNIEnv*, but the prototype is void* so we don't need jni.h
+ */
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
+
+/**
+ \brief Get the SDL Activity object for the application
+
+ This returns jobject, but the prototype is void* so we don't need jni.h
+ The jobject returned by SDL_AndroidGetActivity is a local reference.
+ It is the caller's responsibility to properly release it
+ (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
+ */
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
+
+/**
+ \brief Return true if the application is running on Android TV
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
+
+/**
+ See the official Android developer guide for more information:
+ http://developer.android.com/guide/topics/data/data-storage.html
+*/
+#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
+#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
+
+/**
+ \brief Get the path used for internal storage for this application.
+
+ This path is unique to your application and cannot be written to
+ by other applications.
+ */
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
+
+/**
+ \brief Get the current state of external storage, a bitmask of these values:
+ SDL_ANDROID_EXTERNAL_STORAGE_READ
+ SDL_ANDROID_EXTERNAL_STORAGE_WRITE
+
+ If external storage is currently unavailable, this will return 0.
+*/
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
+
+/**
+ \brief Get the path used for external storage for this application.
+
+ This path is unique to your application, but is public and can be
+ written to by other applications.
+ */
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
+
+#endif /* __ANDROID__ */
+
+/* Platform specific functions for WinRT */
+#if defined(__WINRT__) && __WINRT__
+
+/**
+ * \brief WinRT / Windows Phone path types
+ */
+typedef enum
+{
+ /** \brief The installed app's root directory.
+ Files here are likely to be read-only. */
+ SDL_WINRT_PATH_INSTALLED_LOCATION,
+
+ /** \brief The app's local data store. Files may be written here */
+ SDL_WINRT_PATH_LOCAL_FOLDER,
+
+ /** \brief The app's roaming data store. Unsupported on Windows Phone.
+ Files written here may be copied to other machines via a network
+ connection.
+ */
+ SDL_WINRT_PATH_ROAMING_FOLDER,
+
+ /** \brief The app's temporary data store. Unsupported on Windows Phone.
+ Files written here may be deleted at any time. */
+ SDL_WINRT_PATH_TEMP_FOLDER
+} SDL_WinRT_Path;
+
+
+/**
+ * \brief WinRT Device Family
+ */
+typedef enum
+{
+ /** \brief Unknown family */
+ SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+ /** \brief Desktop family*/
+ SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+ /** \brief Mobile family (for example smartphone) */
+ SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+ /** \brief XBox family */
+ SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
+/**
+ * \brief Retrieves a WinRT defined path on the local file system
+ *
+ * \note Documentation on most app-specific path types on WinRT
+ * can be found on MSDN, at the URL:
+ * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
+ *
+ * \param pathType The type of path to retrieve.
+ * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
+ * if the path is not available for any reason. Not all paths are
+ * available on all versions of Windows. This is especially true on
+ * Windows Phone. Check the documentation for the given
+ * SDL_WinRT_Path for more information on which path types are
+ * supported where.
+ */
+extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
+
+/**
+ * \brief Retrieves a WinRT defined path on the local file system
+ *
+ * \note Documentation on most app-specific path types on WinRT
+ * can be found on MSDN, at the URL:
+ * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
+ *
+ * \param pathType The type of path to retrieve.
+ * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
+ * if the path is not available for any reason. Not all paths are
+ * available on all versions of Windows. This is especially true on
+ * Windows Phone. Check the documentation for the given
+ * SDL_WinRT_Path for more information on which path types are
+ * supported where.
+ */
+extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
+
+/**
+ * \brief Detects the device family of WinRT plattform on runtime
+ *
+ * \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
+#endif /* __WINRT__ */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_system_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_syswm.h b/src/3rdparty/SDL2/include/SDL_syswm.h
new file mode 100644
index 0000000..8aa4a39
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_syswm.h
@@ -0,0 +1,324 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_syswm.h
+ *
+ * Include file for SDL custom system window manager hooks.
+ */
+
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+#include "SDL_version.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file SDL_syswm.h
+ *
+ * Your application has access to a special type of event ::SDL_SYSWMEVENT,
+ * which contains window-manager specific information and arrives whenever
+ * an unhandled window event occurs. This event is ignored by default, but
+ * you can enable it with SDL_EventState().
+ */
+#ifdef SDL_PROTOTYPES_ONLY
+struct SDL_SysWMinfo;
+#else
+
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_WINRT)
+#include <Inspectable.h>
+#endif
+
+/* This is the structure for custom window manager events */
+#if defined(SDL_VIDEO_DRIVER_X11)
+#if defined(__APPLE__) && defined(__MACH__)
+/* conflicts with Quickdraw.h */
+#define Cursor X11Cursor
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#if defined(__APPLE__) && defined(__MACH__)
+/* matches the re-define above */
+#undef Cursor
+#endif
+
+#endif /* defined(SDL_VIDEO_DRIVER_X11) */
+
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+#include <directfb.h>
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+#ifdef __OBJC__
+@class NSWindow;
+#else
+typedef struct _NSWindow NSWindow;
+#endif
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_UIKIT)
+#ifdef __OBJC__
+#include <UIKit/UIKit.h>
+#else
+typedef struct _UIWindow UIWindow;
+typedef struct _UIViewController UIViewController;
+#endif
+typedef Uint32 GLuint;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_ANDROID)
+typedef struct ANativeWindow ANativeWindow;
+typedef void *EGLSurface;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+#include "SDL_egl.h"
+#endif
+
+/**
+ * These are the various supported windowing subsystems
+ */
+typedef enum
+{
+ SDL_SYSWM_UNKNOWN,
+ SDL_SYSWM_WINDOWS,
+ SDL_SYSWM_X11,
+ SDL_SYSWM_DIRECTFB,
+ SDL_SYSWM_COCOA,
+ SDL_SYSWM_UIKIT,
+ SDL_SYSWM_WAYLAND,
+ SDL_SYSWM_MIR,
+ SDL_SYSWM_WINRT,
+ SDL_SYSWM_ANDROID,
+ SDL_SYSWM_VIVANTE,
+ SDL_SYSWM_OS2
+} SDL_SYSWM_TYPE;
+
+/**
+ * The custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ SDL_SYSWM_TYPE subsystem;
+ union
+ {
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+ struct {
+ HWND hwnd; /**< The window for the message */
+ UINT msg; /**< The type of message */
+ WPARAM wParam; /**< WORD message parameter */
+ LPARAM lParam; /**< LONG message parameter */
+ } win;
+#endif
+#if defined(SDL_VIDEO_DRIVER_X11)
+ struct {
+ XEvent event;
+ } x11;
+#endif
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+ struct {
+ DFBEvent event;
+ } dfb;
+#endif
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+ struct
+ {
+ /* Latest version of Xcode clang complains about empty structs in C v. C++:
+ error: empty struct has size 0 in C, size 1 in C++
+ */
+ int dummy;
+ /* No Cocoa window events yet */
+ } cocoa;
+#endif
+#if defined(SDL_VIDEO_DRIVER_UIKIT)
+ struct
+ {
+ int dummy;
+ /* No UIKit window events yet */
+ } uikit;
+#endif
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+ struct
+ {
+ int dummy;
+ /* No Vivante window events yet */
+ } vivante;
+#endif
+ /* Can't have an empty union */
+ int dummy;
+ } msg;
+};
+
+/**
+ * The custom window manager information structure.
+ *
+ * When this structure is returned, it holds information about which
+ * low level system it is using, and will be one of SDL_SYSWM_TYPE.
+ */
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ SDL_SYSWM_TYPE subsystem;
+ union
+ {
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+ struct
+ {
+ HWND window; /**< The window handle */
+ HDC hdc; /**< The window device context */
+ HINSTANCE hinstance; /**< The instance handle */
+ } win;
+#endif
+#if defined(SDL_VIDEO_DRIVER_WINRT)
+ struct
+ {
+ IInspectable * window; /**< The WinRT CoreWindow */
+ } winrt;
+#endif
+#if defined(SDL_VIDEO_DRIVER_X11)
+ struct
+ {
+ Display *display; /**< The X11 display */
+ Window window; /**< The X11 window */
+ } x11;
+#endif
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+ struct
+ {
+ IDirectFB *dfb; /**< The directfb main interface */
+ IDirectFBWindow *window; /**< The directfb window handle */
+ IDirectFBSurface *surface; /**< The directfb client surface */
+ } dfb;
+#endif
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+ struct
+ {
+#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
+ NSWindow __unsafe_unretained *window; /**< The Cocoa window */
+#else
+ NSWindow *window; /**< The Cocoa window */
+#endif
+ } cocoa;
+#endif
+#if defined(SDL_VIDEO_DRIVER_UIKIT)
+ struct
+ {
+#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
+ UIWindow __unsafe_unretained *window; /**< The UIKit window */
+#else
+ UIWindow *window; /**< The UIKit window */
+#endif
+ GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+ GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+ GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+ } uikit;
+#endif
+#if defined(SDL_VIDEO_DRIVER_WAYLAND)
+ struct
+ {
+ struct wl_display *display; /**< Wayland display */
+ struct wl_surface *surface; /**< Wayland surface */
+ struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
+ } wl;
+#endif
+#if defined(SDL_VIDEO_DRIVER_MIR)
+ struct
+ {
+ struct MirConnection *connection; /**< Mir display server connection */
+ struct MirSurface *surface; /**< Mir surface */
+ } mir;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_ANDROID)
+ struct
+ {
+ ANativeWindow *window;
+ EGLSurface surface;
+ } android;
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_VIVANTE)
+ struct
+ {
+ EGLNativeDisplayType display;
+ EGLNativeWindowType window;
+ } vivante;
+#endif
+
+ /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+ /* Be careful not to overflow this if you add a new target! */
+ Uint8 dummy[64];
+ } info;
+};
+
+#endif /* SDL_PROTOTYPES_ONLY */
+
+typedef struct SDL_SysWMinfo SDL_SysWMinfo;
+
+/* Function prototypes */
+/**
+ * \brief This function allows access to driver-dependent window information.
+ *
+ * \param window The window about which information is being requested
+ * \param info This structure must be initialized with the SDL version, and is
+ * then filled in with information about the given window.
+ *
+ * \return SDL_TRUE if the function is implemented and the version member of
+ * the \c info struct is valid, SDL_FALSE otherwise.
+ *
+ * You typically use this function like this:
+ * \code
+ * SDL_SysWMinfo info;
+ * SDL_VERSION(&info.version);
+ * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
+ * \endcode
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
+ SDL_SysWMinfo * info);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_syswm_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test.h b/src/3rdparty/SDL2/include/SDL_test.h
new file mode 100644
index 0000000..6cc373b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test.h
@@ -0,0 +1,69 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_h_
+#define SDL_test_h_
+
+#include "SDL.h"
+#include "SDL_test_assert.h"
+#include "SDL_test_common.h"
+#include "SDL_test_compare.h"
+#include "SDL_test_crc32.h"
+#include "SDL_test_font.h"
+#include "SDL_test_fuzzer.h"
+#include "SDL_test_harness.h"
+#include "SDL_test_images.h"
+#include "SDL_test_log.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_memory.h"
+#include "SDL_test_random.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Global definitions */
+
+/*
+ * Note: Maximum size of SDLTest log message is less than SDL's limit
+ * to ensure we can fit additional information such as the timestamp.
+ */
+#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_assert.h b/src/3rdparty/SDL2/include/SDL_test_assert.h
new file mode 100644
index 0000000..1788d7a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_assert.h
@@ -0,0 +1,105 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_assert.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ *
+ * Assert API for test code and test cases
+ *
+ */
+
+#ifndef SDL_test_assert_h_
+#define SDL_test_assert_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Fails the assert.
+ */
+#define ASSERT_FAIL 0
+
+/**
+ * \brief Passes the assert.
+ */
+#define ASSERT_PASS 1
+
+/**
+ * \brief Assert that logs and break execution flow on failures.
+ *
+ * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
+ * \param assertDescription Message to log with the assert describing it.
+ */
+void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
+ *
+ * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
+ * \param assertDescription Message to log with the assert describing it.
+ *
+ * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
+ */
+int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
+
+/**
+ * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
+ *
+ * \param assertDescription Message to log with the assert describing it.
+ */
+void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/**
+ * \brief Resets the assert summary counters to zero.
+ */
+void SDLTest_ResetAssertSummary(void);
+
+/**
+ * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
+ */
+void SDLTest_LogAssertSummary(void);
+
+
+/**
+ * \brief Converts the current assert summary state to a test result.
+ *
+ * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
+ */
+int SDLTest_AssertSummaryToTestResult(void);
+
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_assert_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_common.h b/src/3rdparty/SDL2/include/SDL_test_common.h
new file mode 100644
index 0000000..be2e6b2
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_common.h
@@ -0,0 +1,188 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_common.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/* Ported from original test\common.h file. */
+
+#ifndef SDL_test_common_h_
+#define SDL_test_common_h_
+
+#include "SDL.h"
+
+#if defined(__PSP__)
+#define DEFAULT_WINDOW_WIDTH 480
+#define DEFAULT_WINDOW_HEIGHT 272
+#else
+#define DEFAULT_WINDOW_WIDTH 640
+#define DEFAULT_WINDOW_HEIGHT 480
+#endif
+
+#define VERBOSE_VIDEO 0x00000001
+#define VERBOSE_MODES 0x00000002
+#define VERBOSE_RENDER 0x00000004
+#define VERBOSE_EVENT 0x00000008
+#define VERBOSE_AUDIO 0x00000010
+
+typedef struct
+{
+ /* SDL init flags */
+ char **argv;
+ Uint32 flags;
+ Uint32 verbose;
+
+ /* Video info */
+ const char *videodriver;
+ int display;
+ const char *window_title;
+ const char *window_icon;
+ Uint32 window_flags;
+ int window_x;
+ int window_y;
+ int window_w;
+ int window_h;
+ int window_minW;
+ int window_minH;
+ int window_maxW;
+ int window_maxH;
+ int logical_w;
+ int logical_h;
+ float scale;
+ int depth;
+ int refresh_rate;
+ int num_windows;
+ SDL_Window **windows;
+
+ /* Renderer info */
+ const char *renderdriver;
+ Uint32 render_flags;
+ SDL_bool skip_renderer;
+ SDL_Renderer **renderers;
+ SDL_Texture **targets;
+
+ /* Audio info */
+ const char *audiodriver;
+ SDL_AudioSpec audiospec;
+
+ /* GL settings */
+ int gl_red_size;
+ int gl_green_size;
+ int gl_blue_size;
+ int gl_alpha_size;
+ int gl_buffer_size;
+ int gl_depth_size;
+ int gl_stencil_size;
+ int gl_double_buffer;
+ int gl_accum_red_size;
+ int gl_accum_green_size;
+ int gl_accum_blue_size;
+ int gl_accum_alpha_size;
+ int gl_stereo;
+ int gl_multisamplebuffers;
+ int gl_multisamplesamples;
+ int gl_retained_backing;
+ int gl_accelerated;
+ int gl_major_version;
+ int gl_minor_version;
+ int gl_debug;
+ int gl_profile_mask;
+} SDLTest_CommonState;
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+/**
+ * \brief Parse command line parameters and create common state.
+ *
+ * \param argv Array of command line parameters
+ * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
+ *
+ * \returns Returns a newly allocated common state object.
+ */
+SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
+
+/**
+ * \brief Process one common argument.
+ *
+ * \param state The common state describing the test window to create.
+ * \param index The index of the argument to process in argv[].
+ *
+ * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
+ */
+int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
+
+/**
+ * \brief Returns common usage information
+ *
+ * \param state The common state describing the test window to create.
+ *
+ * \returns String with usage information
+ */
+const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
+
+/**
+ * \brief Open test window.
+ *
+ * \param state The common state describing the test window to create.
+ *
+ * \returns True if initialization succeeded, false otherwise
+ */
+SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
+
+/**
+ * \brief Common event handler for test windows.
+ *
+ * \param state The common state used to create test window.
+ * \param event The event to handle.
+ * \param done Flag indicating we are done.
+ *
+ */
+void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
+
+/**
+ * \brief Close test window.
+ *
+ * \param state The common state used to create test window.
+ *
+ */
+void SDLTest_CommonQuit(SDLTest_CommonState * state);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_common_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_compare.h b/src/3rdparty/SDL2/include/SDL_test_compare.h
new file mode 100644
index 0000000..c22e447
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_compare.h
@@ -0,0 +1,69 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_compare.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Defines comparison functions (i.e. for surfaces).
+
+*/
+
+#ifndef SDL_test_compare_h_
+#define SDL_test_compare_h_
+
+#include "SDL.h"
+
+#include "SDL_test_images.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Compares a surface and with reference image data for equality
+ *
+ * \param surface Surface used in comparison
+ * \param referenceSurface Test Surface used in comparison
+ * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
+ *
+ * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
+ */
+int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_compare_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_crc32.h b/src/3rdparty/SDL2/include/SDL_test_crc32.h
new file mode 100644
index 0000000..3d235d0
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_crc32.h
@@ -0,0 +1,124 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_crc32.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Implements CRC32 calculations (default output is Perl String::CRC32 compatible).
+
+*/
+
+#ifndef SDL_test_crc32_h_
+#define SDL_test_crc32_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ------------ Definitions --------- */
+
+/* Definition shared by all CRC routines */
+
+#ifndef CrcUint32
+ #define CrcUint32 unsigned int
+#endif
+#ifndef CrcUint8
+ #define CrcUint8 unsigned char
+#endif
+
+#ifdef ORIGINAL_METHOD
+ #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
+#else
+ #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
+#endif
+
+/**
+ * Data structure for CRC32 (checksum) computation
+ */
+ typedef struct {
+ CrcUint32 crc32_table[256]; /* CRC table */
+ } SDLTest_Crc32Context;
+
+/* ---------- Function Prototypes ------------- */
+
+/**
+ * \brief Initialize the CRC context
+ *
+ * Note: The function initializes the crc table required for all crc calculations.
+ *
+ * \param crcContext pointer to context variable
+ *
+ * \returns 0 for OK, -1 on error
+ *
+ */
+ int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
+
+
+/**
+ * \brief calculate a crc32 from a data block
+ *
+ * \param crcContext pointer to context variable
+ * \param inBuf input buffer to checksum
+ * \param inLen length of input buffer
+ * \param crc32 pointer to Uint32 to store the final CRC into
+ *
+ * \returns 0 for OK, -1 on error
+ *
+ */
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+
+/* Same routine broken down into three steps */
+int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
+int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
+int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+
+
+/**
+ * \brief clean up CRC context
+ *
+ * \param crcContext pointer to context variable
+ *
+ * \returns 0 for OK, -1 on error
+ *
+*/
+
+int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_crc32_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_font.h b/src/3rdparty/SDL2/include/SDL_test_font.h
new file mode 100644
index 0000000..59cbdca
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_font.h
@@ -0,0 +1,81 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_font.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_font_h_
+#define SDL_test_font_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Function prototypes */
+
+#define FONT_CHARACTER_SIZE 8
+
+/**
+ * \brief Draw a string in the currently set font.
+ *
+ * \param renderer The renderer to draw on.
+ * \param x The X coordinate of the upper left corner of the character.
+ * \param y The Y coordinate of the upper left corner of the character.
+ * \param c The character to draw.
+ *
+ * \returns Returns 0 on success, -1 on failure.
+ */
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
+
+/**
+ * \brief Draw a string in the currently set font.
+ *
+ * \param renderer The renderer to draw on.
+ * \param x The X coordinate of the upper left corner of the string.
+ * \param y The Y coordinate of the upper left corner of the string.
+ * \param s The string to draw.
+ *
+ * \returns Returns 0 on success, -1 on failure.
+ */
+int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
+
+
+/**
+ * \brief Cleanup textures used by font drawing functions.
+ */
+void SDLTest_CleanupTextDrawing(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_font_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_fuzzer.h b/src/3rdparty/SDL2/include/SDL_test_fuzzer.h
new file mode 100644
index 0000000..8fcb9eb
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_fuzzer.h
@@ -0,0 +1,384 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_fuzzer.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Data generators for fuzzing test data in a reproducible way.
+
+*/
+
+#ifndef SDL_test_fuzzer_h_
+#define SDL_test_fuzzer_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ Based on GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
+*/
+
+
+/**
+ * \file
+ * Note: The fuzzer implementation uses a static instance of random context
+ * internally which makes it thread-UNsafe.
+ */
+
+/**
+ * Initializes the fuzzer for a test
+ *
+ * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
+ *
+ */
+void SDLTest_FuzzerInit(Uint64 execKey);
+
+
+/**
+ * Returns a random Uint8
+ *
+ * \returns Generated integer
+ */
+Uint8 SDLTest_RandomUint8(void);
+
+/**
+ * Returns a random Sint8
+ *
+ * \returns Generated signed integer
+ */
+Sint8 SDLTest_RandomSint8(void);
+
+
+/**
+ * Returns a random Uint16
+ *
+ * \returns Generated integer
+ */
+Uint16 SDLTest_RandomUint16(void);
+
+/**
+ * Returns a random Sint16
+ *
+ * \returns Generated signed integer
+ */
+Sint16 SDLTest_RandomSint16(void);
+
+
+/**
+ * Returns a random integer
+ *
+ * \returns Generated integer
+ */
+Sint32 SDLTest_RandomSint32(void);
+
+
+/**
+ * Returns a random positive integer
+ *
+ * \returns Generated integer
+ */
+Uint32 SDLTest_RandomUint32(void);
+
+/**
+ * Returns random Uint64.
+ *
+ * \returns Generated integer
+ */
+Uint64 SDLTest_RandomUint64(void);
+
+
+/**
+ * Returns random Sint64.
+ *
+ * \returns Generated signed integer
+ */
+Sint64 SDLTest_RandomSint64(void);
+
+/**
+ * \returns random float in range [0.0 - 1.0[
+ */
+float SDLTest_RandomUnitFloat(void);
+
+/**
+ * \returns random double in range [0.0 - 1.0[
+ */
+double SDLTest_RandomUnitDouble(void);
+
+/**
+ * \returns random float.
+ *
+ */
+float SDLTest_RandomFloat(void);
+
+/**
+ * \returns random double.
+ *
+ */
+double SDLTest_RandomDouble(void);
+
+/**
+ * Returns a random boundary value for Uint8 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint16 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint32 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Uint64 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
+ * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
+ * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
+ * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or 0 with error set
+ */
+Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint8 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
+ */
+Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
+
+
+/**
+ * Returns a random boundary value for Sint16 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
+ */
+Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint32 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value)
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
+ */
+Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
+
+/**
+ * Returns a random boundary value for Sint64 within the given boundaries.
+ * Boundaries are inclusive, see the usage examples below. If validDomain
+ * is true, the function will only return valid boundaries, otherwise non-valid
+ * boundaries are also possible.
+ * If boundary1 > boundary2, the values are swapped
+ *
+ * Usage examples:
+ * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
+ * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
+ * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
+ * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
+ *
+ * \param boundary1 Lower boundary limit
+ * \param boundary2 Upper boundary limit
+ * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
+ *
+ * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
+ */
+Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
+
+
+/**
+ * Returns integer in range [min, max] (inclusive).
+ * Min and max values can be negative values.
+ * If Max in smaller than min, then the values are swapped.
+ * Min and max are the same value, that value will be returned.
+ *
+ * \param min Minimum inclusive value of returned random number
+ * \param max Maximum inclusive value of returned random number
+ *
+ * \returns Generated random integer in range
+ */
+Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
+
+
+/**
+ * Generates random null-terminated string. The minimum length for
+ * the string is 1 character, maximum length for the string is 255
+ * characters and it can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiString(void);
+
+
+/**
+ * Generates random null-terminated string. The maximum length for
+ * the string is defined by the maxLength parameter.
+ * String can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \param maxLength The maximum length of the generated string.
+ *
+ * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
+
+
+/**
+ * Generates random null-terminated string. The length for
+ * the string is defined by the size parameter.
+ * String can contain ASCII characters from 32 to 126.
+ *
+ * Note: Returned string needs to be deallocated.
+ *
+ * \param size The length of the generated string
+ *
+ * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated.
+ */
+char * SDLTest_RandomAsciiStringOfSize(int size);
+
+/**
+ * Returns the invocation count for the fuzzer since last ...FuzzerInit.
+ */
+int SDLTest_GetFuzzerInvocationCount(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_fuzzer_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_harness.h b/src/3rdparty/SDL2/include/SDL_test_harness.h
new file mode 100644
index 0000000..8641e0a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_harness.h
@@ -0,0 +1,134 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_harness.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ Defines types for test case definitions and the test execution harness API.
+
+ Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
+*/
+
+#ifndef SDL_test_h_arness_h
+#define SDL_test_h_arness_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* ! Definitions for test case structures */
+#define TEST_ENABLED 1
+#define TEST_DISABLED 0
+
+/* ! Definition of all the possible test return values of the test case method */
+#define TEST_ABORTED -1
+#define TEST_STARTED 0
+#define TEST_COMPLETED 1
+#define TEST_SKIPPED 2
+
+/* ! Definition of all the possible test results for the harness */
+#define TEST_RESULT_PASSED 0
+#define TEST_RESULT_FAILED 1
+#define TEST_RESULT_NO_ASSERT 2
+#define TEST_RESULT_SKIPPED 3
+#define TEST_RESULT_SETUP_FAILURE 4
+
+/* !< Function pointer to a test case setup function (run before every test) */
+typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
+
+/* !< Function pointer to a test case function */
+typedef int (*SDLTest_TestCaseFp)(void *arg);
+
+/* !< Function pointer to a test case teardown function (run after every test) */
+typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
+
+/**
+ * Holds information about a single test case.
+ */
+typedef struct SDLTest_TestCaseReference {
+ /* !< Func2Stress */
+ SDLTest_TestCaseFp testCase;
+ /* !< Short name (or function name) "Func2Stress" */
+ char *name;
+ /* !< Long name or full description "This test pushes func2() to the limit." */
+ char *description;
+ /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
+ int enabled;
+} SDLTest_TestCaseReference;
+
+/**
+ * Holds information about a test suite (multiple test cases).
+ */
+typedef struct SDLTest_TestSuiteReference {
+ /* !< "PlatformSuite" */
+ char *name;
+ /* !< The function that is run before each test. NULL skips. */
+ SDLTest_TestCaseSetUpFp testSetUp;
+ /* !< The test cases that are run as part of the suite. Last item should be NULL. */
+ const SDLTest_TestCaseReference **testCases;
+ /* !< The function that is run after each test. NULL skips. */
+ SDLTest_TestCaseTearDownFp testTearDown;
+} SDLTest_TestSuiteReference;
+
+
+/**
+ * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
+ *
+ * Note: The returned string needs to be deallocated by the caller.
+ *
+ * \param length The length of the seed string to generate
+ *
+ * \returns The generated seed string
+ */
+char *SDLTest_GenerateRunSeed(const int length);
+
+/**
+ * \brief Execute a test suite using the given run seed and execution key.
+ *
+ * \param testSuites Suites containing the test case.
+ * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
+ * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
+ * \param filter Filter specification. NULL disables. Case sensitive.
+ * \param testIterations Number of iterations to run each test case.
+ *
+ * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
+ */
+int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_h_arness_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_images.h b/src/3rdparty/SDL2/include/SDL_test_images.h
new file mode 100644
index 0000000..9c4dd5b
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_images.h
@@ -0,0 +1,78 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_images.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ Defines some images for tests.
+
+*/
+
+#ifndef SDL_test_images_h_
+#define SDL_test_images_h_
+
+#include "SDL.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *Type for test images.
+ */
+typedef struct SDLTest_SurfaceImage_s {
+ int width;
+ int height;
+ unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
+ const char *pixel_data;
+} SDLTest_SurfaceImage_t;
+
+/* Test images */
+SDL_Surface *SDLTest_ImageBlit(void);
+SDL_Surface *SDLTest_ImageBlitColor(void);
+SDL_Surface *SDLTest_ImageBlitAlpha(void);
+SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
+SDL_Surface *SDLTest_ImageBlitBlend(void);
+SDL_Surface *SDLTest_ImageBlitBlendMod(void);
+SDL_Surface *SDLTest_ImageBlitBlendNone(void);
+SDL_Surface *SDLTest_ImageBlitBlendAll(void);
+SDL_Surface *SDLTest_ImageFace(void);
+SDL_Surface *SDLTest_ImagePrimitives(void);
+SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_images_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_log.h b/src/3rdparty/SDL2/include/SDL_test_log.h
new file mode 100644
index 0000000..ebd44fb
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_log.h
@@ -0,0 +1,67 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_log.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ *
+ * Wrapper to log in the TEST category
+ *
+ */
+
+#ifndef SDL_test_log_h_
+#define SDL_test_log_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Prints given message with a timestamp in the TEST category and INFO priority.
+ *
+ * \param fmt Message to be logged
+ */
+void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/**
+ * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
+ *
+ * \param fmt Message to be logged
+ */
+void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_log_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_md5.h b/src/3rdparty/SDL2/include/SDL_test_md5.h
new file mode 100644
index 0000000..0e41057
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_md5.h
@@ -0,0 +1,129 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_md5.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+ ***********************************************************************
+ ** Header file for implementation of MD5 **
+ ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
+ ** Created: 2/17/90 RLR **
+ ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
+ ** Revised (for MD5): RLR 4/27/91 **
+ ** -- G modified to have y&~z instead of y&z **
+ ** -- FF, GG, HH modified to add in last register done **
+ ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
+ ** -- distinct additive constant for each step **
+ ** -- round 4 added, working mod 7 **
+ ***********************************************************************
+*/
+
+/*
+ ***********************************************************************
+ ** Message-digest routines: **
+ ** To form the message digest for a message M **
+ ** (1) Initialize a context buffer mdContext using MD5Init **
+ ** (2) Call MD5Update on mdContext and M **
+ ** (3) Call MD5Final on mdContext **
+ ** The message digest is now in mdContext->digest[0...15] **
+ ***********************************************************************
+*/
+
+#ifndef SDL_test_md5_h_
+#define SDL_test_md5_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ------------ Definitions --------- */
+
+/* typedef a 32-bit type */
+ typedef unsigned long int MD5UINT4;
+
+/* Data structure for MD5 (Message-Digest) computation */
+ typedef struct {
+ MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
+ MD5UINT4 buf[4]; /* scratch buffer */
+ unsigned char in[64]; /* input buffer */
+ unsigned char digest[16]; /* actual digest after Md5Final call */
+ } SDLTest_Md5Context;
+
+/* ---------- Function Prototypes ------------- */
+
+/**
+ * \brief initialize the context
+ *
+ * \param mdContext pointer to context variable
+ *
+ * Note: The function initializes the message-digest context
+ * mdContext. Call before each new use of the context -
+ * all fields are set to zero.
+ */
+ void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
+
+
+/**
+ * \brief update digest from variable length data
+ *
+ * \param mdContext pointer to context variable
+ * \param inBuf pointer to data array/string
+ * \param inLen length of data array/string
+ *
+ * Note: The function updates the message-digest context to account
+ * for the presence of each of the characters inBuf[0..inLen-1]
+ * in the message whose digest is being computed.
+*/
+
+ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
+ unsigned int inLen);
+
+
+/**
+ * \brief complete digest computation
+ *
+ * \param mdContext pointer to context variable
+ *
+ * Note: The function terminates the message-digest computation and
+ * ends with the desired message digest in mdContext.digest[0..15].
+ * Always call before using the digest[] variable.
+*/
+
+ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_md5_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_memory.h b/src/3rdparty/SDL2/include/SDL_test_memory.h
new file mode 100644
index 0000000..4827ae6
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_memory.h
@@ -0,0 +1,63 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_memory.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_memory_h_
+#define SDL_test_memory_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief Start tracking SDL memory allocations
+ *
+ * \note This should be called before any other SDL functions for complete tracking coverage
+ */
+int SDLTest_TrackAllocations();
+
+/**
+ * \brief Print a log of any outstanding allocations
+ *
+ * \note This can be called after SDL_Quit()
+ */
+void SDLTest_LogAllocations();
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_memory_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_test_random.h b/src/3rdparty/SDL2/include/SDL_test_random.h
new file mode 100644
index 0000000..0eb414f
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_test_random.h
@@ -0,0 +1,115 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_test_random.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+/*
+
+ A "32-bit Multiply with carry random number generator. Very fast.
+ Includes a list of recommended multipliers.
+
+ multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32.
+ period: (a*2^31)-1
+
+*/
+
+#ifndef SDL_test_random_h_
+#define SDL_test_random_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* --- Definitions */
+
+/*
+ * Macros that return a random number in a specific format.
+ */
+#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c))
+
+/*
+ * Context structure for the random number generator state.
+ */
+ typedef struct {
+ unsigned int a;
+ unsigned int x;
+ unsigned int c;
+ unsigned int ah;
+ unsigned int al;
+ } SDLTest_RandomContext;
+
+
+/* --- Function prototypes */
+
+/**
+ * \brief Initialize random number generator with two integers.
+ *
+ * Note: The random sequence of numbers returned by ...Random() is the
+ * same for the same two integers and has a period of 2^31.
+ *
+ * \param rndContext pointer to context structure
+ * \param xi integer that defines the random sequence
+ * \param ci integer that defines the random sequence
+ *
+ */
+ void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
+ unsigned int ci);
+
+/**
+ * \brief Initialize random number generator based on current system time.
+ *
+ * \param rndContext pointer to context structure
+ *
+ */
+ void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
+
+
+/**
+ * \brief Initialize random number generator based on current system time.
+ *
+ * Note: ...RandomInit() or ...RandomInitTime() must have been called
+ * before using this function.
+ *
+ * \param rndContext pointer to context structure
+ *
+ * \returns A random number (32bit unsigned integer)
+ *
+ */
+ unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_random_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_thread.h b/src/3rdparty/SDL2/include/SDL_thread.h
new file mode 100644
index 0000000..82a43fc
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_thread.h
@@ -0,0 +1,308 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
+
+/**
+ * \file SDL_thread.h
+ *
+ * Header for the SDL thread management routines.
+ */
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+/* Thread synchronization primitives */
+#include "SDL_atomic.h"
+#include "SDL_mutex.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The SDL thread structure, defined in SDL_thread.c */
+struct SDL_Thread;
+typedef struct SDL_Thread SDL_Thread;
+
+/* The SDL thread ID */
+typedef unsigned long SDL_threadID;
+
+/* Thread local storage ID, 0 is the invalid ID */
+typedef unsigned int SDL_TLSID;
+
+/**
+ * The SDL thread priority.
+ *
+ * \note On many systems you require special privileges to set high priority.
+ */
+typedef enum {
+ SDL_THREAD_PRIORITY_LOW,
+ SDL_THREAD_PRIORITY_NORMAL,
+ SDL_THREAD_PRIORITY_HIGH
+} SDL_ThreadPriority;
+
+/**
+ * The function passed to SDL_CreateThread().
+ * It is passed a void* user context parameter and returns an int.
+ */
+typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
+
+#if defined(__WIN32__) && !defined(HAVE_LIBC)
+/**
+ * \file SDL_thread.h
+ *
+ * We compile SDL into a DLL. This means, that it's the DLL which
+ * creates a new thread for the calling process with the SDL_CreateThread()
+ * API. There is a problem with this, that only the RTL of the SDL2.DLL will
+ * be initialized for those threads, and not the RTL of the calling
+ * application!
+ *
+ * To solve this, we make a little hack here.
+ *
+ * We'll always use the caller's _beginthread() and _endthread() APIs to
+ * start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ * then the RTL of SDL2.DLL will be used to create the new thread, and if it's
+ * the application, then the RTL of the application will be used.
+ *
+ * So, in short:
+ * Always use the _beginthread() and _endthread() of the calling runtime
+ * library!
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+ (void *, unsigned, unsigned (__stdcall *func)(void *),
+ void * /*arg*/, unsigned, unsigned * /* threadID */);
+typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
+
+/**
+ * Create a thread.
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+
+/**
+ * Create a thread.
+ */
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#endif
+
+#elif defined(__OS2__)
+/*
+ * just like the windows case above: We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#endif
+
+#else
+
+/**
+ * Create a thread.
+ *
+ * Thread naming is a little complicated: Most systems have very small
+ * limits for the string length (Haiku has 32 bytes, Linux currently has 16,
+ * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
+ * have to see what happens with your system's debugger. The name should be
+ * UTF-8 (but using the naming limits of C identifiers is a better bet).
+ * There are no requirements for thread naming conventions, so long as the
+ * string is null-terminated UTF-8, but these guidelines are helpful in
+ * choosing a name:
+ *
+ * http://stackoverflow.com/questions/149932/naming-conventions-for-threads
+ *
+ * If a system imposes requirements, SDL will try to munge the string for
+ * it (truncate, etc), but the original string contents will be available
+ * from SDL_GetThreadName().
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+
+#endif
+
+/**
+ * Get the thread name, as it was specified in SDL_CreateThread().
+ * This function returns a pointer to a UTF-8 string that names the
+ * specified thread, or NULL if it doesn't have a name. This is internal
+ * memory, not to be free()'d by the caller, and remains valid until the
+ * specified thread is cleaned up by SDL_WaitThread().
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
+
+/**
+ * Get the thread identifier for the current thread.
+ */
+extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
+
+/**
+ * Get the thread identifier for the specified thread.
+ *
+ * Equivalent to SDL_ThreadID() if the specified thread is NULL.
+ */
+extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
+
+/**
+ * Set the priority for the current thread
+ */
+extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
+
+/**
+ * Wait for a thread to finish. Threads that haven't been detached will
+ * remain (as a "zombie") until this function cleans them up. Not doing so
+ * is a resource leak.
+ *
+ * Once a thread has been cleaned up through this function, the SDL_Thread
+ * that references it becomes invalid and should not be referenced again.
+ * As such, only one thread may call SDL_WaitThread() on another.
+ *
+ * The return code for the thread function is placed in the area
+ * pointed to by \c status, if \c status is not NULL.
+ *
+ * You may not wait on a thread that has been used in a call to
+ * SDL_DetachThread(). Use either that function or this one, but not
+ * both, or behavior is undefined.
+ *
+ * It is safe to pass NULL to this function; it is a no-op.
+ */
+extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
+
+/**
+ * A thread may be "detached" to signify that it should not remain until
+ * another thread has called SDL_WaitThread() on it. Detaching a thread
+ * is useful for long-running threads that nothing needs to synchronize
+ * with or further manage. When a detached thread is done, it simply
+ * goes away.
+ *
+ * There is no way to recover the return code of a detached thread. If you
+ * need this, don't detach the thread and instead use SDL_WaitThread().
+ *
+ * Once a thread is detached, you should usually assume the SDL_Thread isn't
+ * safe to reference again, as it will become invalid immediately upon
+ * the detached thread's exit, instead of remaining until someone has called
+ * SDL_WaitThread() to finally clean it up. As such, don't detach the same
+ * thread more than once.
+ *
+ * If a thread has already exited when passed to SDL_DetachThread(), it will
+ * stop waiting for a call to SDL_WaitThread() and clean up immediately.
+ * It is not safe to detach a thread that might be used with SDL_WaitThread().
+ *
+ * You may not call SDL_WaitThread() on a thread that has been detached.
+ * Use either that function or this one, but not both, or behavior is
+ * undefined.
+ *
+ * It is safe to pass NULL to this function; it is a no-op.
+ */
+extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread);
+
+/**
+ * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
+ *
+ * \return The newly created thread local storage identifier, or 0 on error
+ *
+ * \code
+ * static SDL_SpinLock tls_lock;
+ * static SDL_TLSID thread_local_storage;
+ *
+ * void SetMyThreadData(void *value)
+ * {
+ * if (!thread_local_storage) {
+ * SDL_AtomicLock(&tls_lock);
+ * if (!thread_local_storage) {
+ * thread_local_storage = SDL_TLSCreate();
+ * }
+ * SDL_AtomicUnlock(&tls_lock);
+ * }
+ * SDL_TLSSet(thread_local_storage, value, 0);
+ * }
+ *
+ * void *GetMyThreadData(void)
+ * {
+ * return SDL_TLSGet(thread_local_storage);
+ * }
+ * \endcode
+ *
+ * \sa SDL_TLSGet()
+ * \sa SDL_TLSSet()
+ */
+extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
+
+/**
+ * \brief Get the value associated with a thread local storage ID for the current thread.
+ *
+ * \param id The thread local storage ID
+ *
+ * \return The value associated with the ID for the current thread, or NULL if no value has been set.
+ *
+ * \sa SDL_TLSCreate()
+ * \sa SDL_TLSSet()
+ */
+extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
+
+/**
+ * \brief Set the value associated with a thread local storage ID for the current thread.
+ *
+ * \param id The thread local storage ID
+ * \param value The value to associate with the ID for the current thread
+ * \param destructor A function called when the thread exits, to free the value.
+ *
+ * \return 0 on success, -1 on error
+ *
+ * \sa SDL_TLSCreate()
+ * \sa SDL_TLSGet()
+ */
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_thread_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_timer.h b/src/3rdparty/SDL2/include/SDL_timer.h
new file mode 100644
index 0000000..5600618
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_timer.h
@@ -0,0 +1,115 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
+
+/**
+ * \file SDL_timer.h
+ *
+ * Header for the SDL time management routines.
+ */
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Get the number of milliseconds since the SDL library initialization.
+ *
+ * \note This value wraps if the program runs for more than ~49 days.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
+
+/**
+ * \brief Compare SDL ticks values, and return true if A has passed B
+ *
+ * e.g. if you want to wait 100 ms, you could do this:
+ * Uint32 timeout = SDL_GetTicks() + 100;
+ * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
+ * ... do work until timeout has elapsed
+ * }
+ */
+#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
+
+/**
+ * \brief Get the current value of the high resolution counter
+ */
+extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
+
+/**
+ * \brief Get the count per second of the high resolution counter
+ */
+extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
+
+/**
+ * \brief Wait a specified number of milliseconds before returning.
+ */
+extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
+
+/**
+ * Function prototype for the timer callback function.
+ *
+ * The callback function is passed the current timer interval and returns
+ * the next timer interval. If the returned value is the same as the one
+ * passed in, the periodic alarm continues, otherwise a new alarm is
+ * scheduled. If the callback returns 0, the periodic alarm is cancelled.
+ */
+typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
+
+/**
+ * Definition of the timer ID type.
+ */
+typedef int SDL_TimerID;
+
+/**
+ * \brief Add a new timer to the pool of timers already running.
+ *
+ * \return A timer ID, or 0 when an error occurs.
+ */
+extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
+ SDL_TimerCallback callback,
+ void *param);
+
+/**
+ * \brief Remove a timer knowing its ID.
+ *
+ * \return A boolean value indicating success or failure.
+ *
+ * \warning It is not safe to remove a timer multiple times.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_timer_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_touch.h b/src/3rdparty/SDL2/include/SDL_touch.h
new file mode 100644
index 0000000..f4075e7
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_touch.h
@@ -0,0 +1,86 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_touch.h
+ *
+ * Include file for SDL touch event handling.
+ */
+
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef Sint64 SDL_TouchID;
+typedef Sint64 SDL_FingerID;
+
+typedef struct SDL_Finger
+{
+ SDL_FingerID id;
+ float x;
+ float y;
+ float pressure;
+} SDL_Finger;
+
+/* Used as the device ID for mouse events simulated with touch input */
+#define SDL_TOUCH_MOUSEID ((Uint32)-1)
+
+
+/* Function prototypes */
+
+/**
+ * \brief Get the number of registered touch devices.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
+
+/**
+ * \brief Get the touch ID with the given index, or 0 if the index is invalid.
+ */
+extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
+
+/**
+ * \brief Get the number of active fingers for a given touch device.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
+
+/**
+ * \brief Get the finger object of the given touch, with the given index.
+ */
+extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_touch_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_types.h b/src/3rdparty/SDL2/include/SDL_types.h
new file mode 100644
index 0000000..4ac248c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_types.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_types.h
+ *
+ * \deprecated
+ */
+
+/* DEPRECATED */
+#include "SDL_stdinc.h"
diff --git a/src/3rdparty/SDL2/include/SDL_version.h b/src/3rdparty/SDL2/include/SDL_version.h
new file mode 100644
index 0000000..584b48c
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_version.h
@@ -0,0 +1,162 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_version.h
+ *
+ * This header defines the current SDL version.
+ */
+
+#ifndef SDL_version_h_
+#define SDL_version_h_
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Information the version of SDL in use.
+ *
+ * Represents the library's version as three levels: major revision
+ * (increments with massive changes, additions, and enhancements),
+ * minor revision (increments with backwards-compatible changes to the
+ * major revision), and patchlevel (increments with fixes to the minor
+ * revision).
+ *
+ * \sa SDL_VERSION
+ * \sa SDL_GetVersion
+ */
+typedef struct SDL_version
+{
+ Uint8 major; /**< major version */
+ Uint8 minor; /**< minor version */
+ Uint8 patch; /**< update version */
+} SDL_version;
+
+/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
+*/
+#define SDL_MAJOR_VERSION 2
+#define SDL_MINOR_VERSION 0
+#define SDL_PATCHLEVEL 8
+
+/**
+ * \brief Macro to determine SDL version program was compiled against.
+ *
+ * This macro fills in a SDL_version structure with the version of the
+ * library you compiled against. This is determined by what header the
+ * compiler uses. Note that if you dynamically linked the library, you might
+ * have a slightly newer or older version at runtime. That version can be
+ * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
+ * is not a macro.
+ *
+ * \param x A pointer to a SDL_version struct to initialize.
+ *
+ * \sa SDL_version
+ * \sa SDL_GetVersion
+ */
+#define SDL_VERSION(x) \
+{ \
+ (x)->major = SDL_MAJOR_VERSION; \
+ (x)->minor = SDL_MINOR_VERSION; \
+ (x)->patch = SDL_PATCHLEVEL; \
+}
+
+/**
+ * This macro turns the version numbers into a numeric value:
+ * \verbatim
+ (1,2,3) -> (1203)
+ \endverbatim
+ *
+ * This assumes that there will never be more than 100 patchlevels.
+ */
+#define SDL_VERSIONNUM(X, Y, Z) \
+ ((X)*1000 + (Y)*100 + (Z))
+
+/**
+ * This is the version number macro for the current SDL version.
+ */
+#define SDL_COMPILEDVERSION \
+ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
+
+/**
+ * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
+ */
+#define SDL_VERSION_ATLEAST(X, Y, Z) \
+ (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
+
+/**
+ * \brief Get the version of SDL that is linked against your program.
+ *
+ * If you are linking to SDL dynamically, then it is possible that the
+ * current version will be different than the version you compiled against.
+ * This function returns the current version, while SDL_VERSION() is a
+ * macro that tells you what version you compiled with.
+ *
+ * \code
+ * SDL_version compiled;
+ * SDL_version linked;
+ *
+ * SDL_VERSION(&compiled);
+ * SDL_GetVersion(&linked);
+ * printf("We compiled against SDL version %d.%d.%d ...\n",
+ * compiled.major, compiled.minor, compiled.patch);
+ * printf("But we linked against SDL version %d.%d.%d.\n",
+ * linked.major, linked.minor, linked.patch);
+ * \endcode
+ *
+ * This function may be called safely at any time, even before SDL_Init().
+ *
+ * \sa SDL_VERSION
+ */
+extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
+
+/**
+ * \brief Get the code revision of SDL that is linked against your program.
+ *
+ * Returns an arbitrary string (a hash value) uniquely identifying the
+ * exact revision of the SDL library in use, and is only useful in comparing
+ * against other revisions. It is NOT an incrementing number.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
+
+/**
+ * \brief Get the revision number of SDL that is linked against your program.
+ *
+ * Returns a number uniquely identifying the exact revision of the SDL
+ * library in use. It is an incrementing number based on commits to
+ * hg.libsdl.org.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_version_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_video.h b/src/3rdparty/SDL2/include/SDL_video.h
new file mode 100644
index 0000000..83f49fa
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_video.h
@@ -0,0 +1,1249 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_video.h
+ *
+ * Header file for SDL video functions.
+ */
+
+#ifndef SDL_video_h_
+#define SDL_video_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_surface.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief The structure that defines a display mode
+ *
+ * \sa SDL_GetNumDisplayModes()
+ * \sa SDL_GetDisplayMode()
+ * \sa SDL_GetDesktopDisplayMode()
+ * \sa SDL_GetCurrentDisplayMode()
+ * \sa SDL_GetClosestDisplayMode()
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_GetWindowDisplayMode()
+ */
+typedef struct
+{
+ Uint32 format; /**< pixel format */
+ int w; /**< width, in screen coordinates */
+ int h; /**< height, in screen coordinates */
+ int refresh_rate; /**< refresh rate (or zero for unspecified) */
+ void *driverdata; /**< driver-specific data, initialize to 0 */
+} SDL_DisplayMode;
+
+/**
+ * \brief The type used to identify a window
+ *
+ * \sa SDL_CreateWindow()
+ * \sa SDL_CreateWindowFrom()
+ * \sa SDL_DestroyWindow()
+ * \sa SDL_GetWindowData()
+ * \sa SDL_GetWindowFlags()
+ * \sa SDL_GetWindowGrab()
+ * \sa SDL_GetWindowPosition()
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_GetWindowTitle()
+ * \sa SDL_HideWindow()
+ * \sa SDL_MaximizeWindow()
+ * \sa SDL_MinimizeWindow()
+ * \sa SDL_RaiseWindow()
+ * \sa SDL_RestoreWindow()
+ * \sa SDL_SetWindowData()
+ * \sa SDL_SetWindowFullscreen()
+ * \sa SDL_SetWindowGrab()
+ * \sa SDL_SetWindowIcon()
+ * \sa SDL_SetWindowPosition()
+ * \sa SDL_SetWindowSize()
+ * \sa SDL_SetWindowBordered()
+ * \sa SDL_SetWindowResizable()
+ * \sa SDL_SetWindowTitle()
+ * \sa SDL_ShowWindow()
+ */
+typedef struct SDL_Window SDL_Window;
+
+/**
+ * \brief The flags on a window
+ *
+ * \sa SDL_GetWindowFlags()
+ */
+typedef enum
+{
+ /* !!! FIXME: change this to name = (1<<x). */
+ SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
+ SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
+ SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
+ SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
+ SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
+ SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
+ SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
+ SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
+ SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
+ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
+ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
+ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
+ SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
+ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
+ On macOS NSHighResolutionCapable must be set true in the
+ application's Info.plist for this to have any effect. */
+ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
+ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
+ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
+ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
+ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
+ SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
+} SDL_WindowFlags;
+
+/**
+ * \brief Used to indicate that you don't care what the window position is.
+ */
+#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
+#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
+#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISUNDEFINED(X) \
+ (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
+
+/**
+ * \brief Used to indicate that the window position should be centered.
+ */
+#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
+#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
+#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
+#define SDL_WINDOWPOS_ISCENTERED(X) \
+ (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
+
+/**
+ * \brief Event subtype for window events
+ */
+typedef enum
+{
+ SDL_WINDOWEVENT_NONE, /**< Never used */
+ SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
+ SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
+ SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
+ redrawn */
+ SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
+ */
+ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
+ SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
+ a result of an API call or through the
+ system or user changing the window size. */
+ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
+ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
+ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
+ and position */
+ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
+ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
+ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
+ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
+ SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */
+ SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
+ SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
+} SDL_WindowEventID;
+
+/**
+ * \brief An opaque handle to an OpenGL context.
+ */
+typedef void *SDL_GLContext;
+
+/**
+ * \brief OpenGL configuration attributes
+ */
+typedef enum
+{
+ SDL_GL_RED_SIZE,
+ SDL_GL_GREEN_SIZE,
+ SDL_GL_BLUE_SIZE,
+ SDL_GL_ALPHA_SIZE,
+ SDL_GL_BUFFER_SIZE,
+ SDL_GL_DOUBLEBUFFER,
+ SDL_GL_DEPTH_SIZE,
+ SDL_GL_STENCIL_SIZE,
+ SDL_GL_ACCUM_RED_SIZE,
+ SDL_GL_ACCUM_GREEN_SIZE,
+ SDL_GL_ACCUM_BLUE_SIZE,
+ SDL_GL_ACCUM_ALPHA_SIZE,
+ SDL_GL_STEREO,
+ SDL_GL_MULTISAMPLEBUFFERS,
+ SDL_GL_MULTISAMPLESAMPLES,
+ SDL_GL_ACCELERATED_VISUAL,
+ SDL_GL_RETAINED_BACKING,
+ SDL_GL_CONTEXT_MAJOR_VERSION,
+ SDL_GL_CONTEXT_MINOR_VERSION,
+ SDL_GL_CONTEXT_EGL,
+ SDL_GL_CONTEXT_FLAGS,
+ SDL_GL_CONTEXT_PROFILE_MASK,
+ SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
+ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+ SDL_GL_CONTEXT_RESET_NOTIFICATION,
+ SDL_GL_CONTEXT_NO_ERROR
+} SDL_GLattr;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
+ SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
+ SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+} SDL_GLprofile;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
+ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
+ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
+ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
+} SDL_GLcontextFlag;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
+} SDL_GLcontextReleaseFlag;
+
+typedef enum
+{
+ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
+} SDL_GLContextResetNotification;
+
+/* Function prototypes */
+
+/**
+ * \brief Get the number of video drivers compiled into SDL
+ *
+ * \sa SDL_GetVideoDriver()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
+
+/**
+ * \brief Get the name of a built in video driver.
+ *
+ * \note The video drivers are presented in the order in which they are
+ * normally checked during initialization.
+ *
+ * \sa SDL_GetNumVideoDrivers()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
+
+/**
+ * \brief Initialize the video subsystem, optionally specifying a video driver.
+ *
+ * \param driver_name Initialize a specific driver by name, or NULL for the
+ * default video driver.
+ *
+ * \return 0 on success, -1 on error
+ *
+ * This function initializes the video subsystem; setting up a connection
+ * to the window manager, etc, and determines the available display modes
+ * and pixel formats, but does not initialize a window or graphics mode.
+ *
+ * \sa SDL_VideoQuit()
+ */
+extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
+
+/**
+ * \brief Shuts down the video subsystem.
+ *
+ * This function closes all windows, and restores the original video mode.
+ *
+ * \sa SDL_VideoInit()
+ */
+extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
+
+/**
+ * \brief Returns the name of the currently initialized video driver.
+ *
+ * \return The name of the current video driver or NULL if no driver
+ * has been initialized
+ *
+ * \sa SDL_GetNumVideoDrivers()
+ * \sa SDL_GetVideoDriver()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
+
+/**
+ * \brief Returns the number of available video displays.
+ *
+ * \sa SDL_GetDisplayBounds()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
+
+/**
+ * \brief Get the name of a display in UTF-8 encoding
+ *
+ * \return The name of a display, or NULL for an invalid display index.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
+
+/**
+ * \brief Get the desktop area represented by a display, with the primary
+ * display located at 0,0
+ *
+ * \return 0 on success, or -1 if the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
+
+/**
+ * \brief Get the dots/pixels-per-inch for a display
+ *
+ * \note Diagonal, horizontal and vertical DPI can all be optionally
+ * returned if the parameter is non-NULL.
+ *
+ * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
+
+/**
+ * \brief Get the usable desktop area represented by a display, with the
+ * primary display located at 0,0
+ *
+ * This is the same area as SDL_GetDisplayBounds() reports, but with portions
+ * reserved by the system removed. For example, on Mac OS X, this subtracts
+ * the area occupied by the menu bar and dock.
+ *
+ * Setting a window to be fullscreen generally bypasses these unusable areas,
+ * so these are good guidelines for the maximum space available to a
+ * non-fullscreen window.
+ *
+ * \return 0 on success, or -1 if the index is out of range.
+ *
+ * \sa SDL_GetDisplayBounds()
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
+
+/**
+ * \brief Returns the number of available display modes.
+ *
+ * \sa SDL_GetDisplayMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
+
+/**
+ * \brief Fill in information about a specific display mode.
+ *
+ * \note The display modes are sorted in this priority:
+ * \li bits per pixel -> more colors to fewer colors
+ * \li width -> largest to smallest
+ * \li height -> largest to smallest
+ * \li refresh rate -> highest to lowest
+ *
+ * \sa SDL_GetNumDisplayModes()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
+ SDL_DisplayMode * mode);
+
+/**
+ * \brief Fill in information about the desktop display mode.
+ */
+extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
+
+/**
+ * \brief Fill in information about the current display mode.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
+
+
+/**
+ * \brief Get the closest match to the requested display mode.
+ *
+ * \param displayIndex The index of display from which mode should be queried.
+ * \param mode The desired display mode
+ * \param closest A pointer to a display mode to be filled in with the closest
+ * match of the available display modes.
+ *
+ * \return The passed in value \c closest, or NULL if no matching video mode
+ * was available.
+ *
+ * The available display modes are scanned, and \c closest is filled in with the
+ * closest mode matching the requested mode and returned. The mode format and
+ * refresh_rate default to the desktop mode if they are 0. The modes are
+ * scanned with size being first priority, format being second priority, and
+ * finally checking the refresh_rate. If all the available modes are too
+ * small, then NULL is returned.
+ *
+ * \sa SDL_GetNumDisplayModes()
+ * \sa SDL_GetDisplayMode()
+ */
+extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
+
+/**
+ * \brief Get the display index associated with a window.
+ *
+ * \return the display index of the display containing the center of the
+ * window, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
+
+/**
+ * \brief Set the display mode used when a fullscreen window is visible.
+ *
+ * By default the window's dimensions and the desktop format and refresh rate
+ * are used.
+ *
+ * \param window The window for which the display mode should be set.
+ * \param mode The mode to use, or NULL for the default mode.
+ *
+ * \return 0 on success, or -1 if setting the display mode failed.
+ *
+ * \sa SDL_GetWindowDisplayMode()
+ * \sa SDL_SetWindowFullscreen()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
+ const SDL_DisplayMode
+ * mode);
+
+/**
+ * \brief Fill in information about the display mode used when a fullscreen
+ * window is visible.
+ *
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_SetWindowFullscreen()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
+ SDL_DisplayMode * mode);
+
+/**
+ * \brief Get the pixel format associated with the window.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
+
+/**
+ * \brief Create a window with the specified position, dimensions, and flags.
+ *
+ * \param title The title of the window, in UTF-8 encoding.
+ * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param w The width of the window, in screen coordinates.
+ * \param h The height of the window, in screen coordinates.
+ * \param flags The flags for the window, a mask of any of the following:
+ * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
+ * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
+ * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
+ * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
+ * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
+ *
+ * \return The created window, or NULL if window creation failed.
+ *
+ * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
+ * in pixels may differ from its size in screen coordinates on platforms with
+ * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
+ * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ * drawable size in pixels.
+ *
+ * If the window is created with any of the SDL_WINDOW_OPENGL or
+ * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
+ *
+ * \note On non-Apple devices, SDL requires you to either not link to the
+ * Vulkan loader or link to a dynamic library version. This limitation
+ * may be removed in a future version of SDL.
+ *
+ * \sa SDL_DestroyWindow()
+ * \sa SDL_GL_LoadLibrary()
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
+ int x, int y, int w,
+ int h, Uint32 flags);
+
+/**
+ * \brief Create an SDL window from an existing native window.
+ *
+ * \param data A pointer to driver-dependent window creation data
+ *
+ * \return The created window, or NULL if window creation failed.
+ *
+ * \sa SDL_DestroyWindow()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
+
+/**
+ * \brief Get the numeric ID of a window, for logging purposes.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
+
+/**
+ * \brief Get a window from a stored ID, or NULL if it doesn't exist.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
+
+/**
+ * \brief Get the window flags.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
+
+/**
+ * \brief Set the title of a window, in UTF-8 format.
+ *
+ * \sa SDL_GetWindowTitle()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
+ const char *title);
+
+/**
+ * \brief Get the title of a window, in UTF-8 format.
+ *
+ * \sa SDL_SetWindowTitle()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
+
+/**
+ * \brief Set the icon for a window.
+ *
+ * \param window The window for which the icon should be set.
+ * \param icon The icon for the window.
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
+ SDL_Surface * icon);
+
+/**
+ * \brief Associate an arbitrary named pointer with a window.
+ *
+ * \param window The window to associate with the pointer.
+ * \param name The name of the pointer.
+ * \param userdata The associated pointer.
+ *
+ * \return The previous value associated with 'name'
+ *
+ * \note The name is case-sensitive.
+ *
+ * \sa SDL_GetWindowData()
+ */
+extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
+ const char *name,
+ void *userdata);
+
+/**
+ * \brief Retrieve the data pointer associated with a window.
+ *
+ * \param window The window to query.
+ * \param name The name of the pointer.
+ *
+ * \return The value associated with 'name'
+ *
+ * \sa SDL_SetWindowData()
+ */
+extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
+ const char *name);
+
+/**
+ * \brief Set the position of a window.
+ *
+ * \param window The window to reposition.
+ * \param x The x coordinate of the window in screen coordinates, or
+ * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y coordinate of the window in screen coordinates, or
+ * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
+ *
+ * \note The window coordinate origin is the upper left of the display.
+ *
+ * \sa SDL_GetWindowPosition()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
+ int x, int y);
+
+/**
+ * \brief Get the position of a window.
+ *
+ * \param window The window to query.
+ * \param x Pointer to variable for storing the x position, in screen
+ * coordinates. May be NULL.
+ * \param y Pointer to variable for storing the y position, in screen
+ * coordinates. May be NULL.
+ *
+ * \sa SDL_SetWindowPosition()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
+ int *x, int *y);
+
+/**
+ * \brief Set the size of a window's client area.
+ *
+ * \param window The window to resize.
+ * \param w The width of the window, in screen coordinates. Must be >0.
+ * \param h The height of the window, in screen coordinates. Must be >0.
+ *
+ * \note Fullscreen windows automatically match the size of the display mode,
+ * and you should use SDL_SetWindowDisplayMode() to change their size.
+ *
+ * The window size in screen coordinates may differ from the size in pixels, if
+ * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
+ * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
+ * SDL_GetRendererOutputSize() to get the real client area size in pixels.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_SetWindowDisplayMode()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
+ int h);
+
+/**
+ * \brief Get the size of a window's client area.
+ *
+ * \param window The window to query.
+ * \param w Pointer to variable for storing the width, in screen
+ * coordinates. May be NULL.
+ * \param h Pointer to variable for storing the height, in screen
+ * coordinates. May be NULL.
+ *
+ * The window size in screen coordinates may differ from the size in pixels, if
+ * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
+ * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
+ * SDL_GetRendererOutputSize() to get the real client area size in pixels.
+ *
+ * \sa SDL_SetWindowSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
+ int *h);
+
+/**
+ * \brief Get the size of a window's borders (decorations) around the client area.
+ *
+ * \param window The window to query.
+ * \param top Pointer to variable for storing the size of the top border. NULL is permitted.
+ * \param left Pointer to variable for storing the size of the left border. NULL is permitted.
+ * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted.
+ * \param right Pointer to variable for storing the size of the right border. NULL is permitted.
+ *
+ * \return 0 on success, or -1 if getting this information is not supported.
+ *
+ * \note if this function fails (returns -1), the size values will be
+ * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as
+ * if the window in question was borderless.
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
+ int *top, int *left,
+ int *bottom, int *right);
+
+/**
+ * \brief Set the minimum size of a window's client area.
+ *
+ * \param window The window to set a new minimum size.
+ * \param min_w The minimum width of the window, must be >0
+ * \param min_h The minimum height of the window, must be >0
+ *
+ * \note You can't change the minimum size of a fullscreen window, it
+ * automatically matches the size of the display mode.
+ *
+ * \sa SDL_GetWindowMinimumSize()
+ * \sa SDL_SetWindowMaximumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
+ int min_w, int min_h);
+
+/**
+ * \brief Get the minimum size of a window's client area.
+ *
+ * \param window The window to query.
+ * \param w Pointer to variable for storing the minimum width, may be NULL
+ * \param h Pointer to variable for storing the minimum height, may be NULL
+ *
+ * \sa SDL_GetWindowMaximumSize()
+ * \sa SDL_SetWindowMinimumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
+ int *w, int *h);
+
+/**
+ * \brief Set the maximum size of a window's client area.
+ *
+ * \param window The window to set a new maximum size.
+ * \param max_w The maximum width of the window, must be >0
+ * \param max_h The maximum height of the window, must be >0
+ *
+ * \note You can't change the maximum size of a fullscreen window, it
+ * automatically matches the size of the display mode.
+ *
+ * \sa SDL_GetWindowMaximumSize()
+ * \sa SDL_SetWindowMinimumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
+ int max_w, int max_h);
+
+/**
+ * \brief Get the maximum size of a window's client area.
+ *
+ * \param window The window to query.
+ * \param w Pointer to variable for storing the maximum width, may be NULL
+ * \param h Pointer to variable for storing the maximum height, may be NULL
+ *
+ * \sa SDL_GetWindowMinimumSize()
+ * \sa SDL_SetWindowMaximumSize()
+ */
+extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
+ int *w, int *h);
+
+/**
+ * \brief Set the border state of a window.
+ *
+ * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
+ * add or remove the border from the actual window. This is a no-op if the
+ * window's border already matches the requested state.
+ *
+ * \param window The window of which to change the border state.
+ * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border.
+ *
+ * \note You can't change the border state of a fullscreen window.
+ *
+ * \sa SDL_GetWindowFlags()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
+ SDL_bool bordered);
+
+/**
+ * \brief Set the user-resizable state of a window.
+ *
+ * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and
+ * allow/disallow user resizing of the window. This is a no-op if the
+ * window's resizable state already matches the requested state.
+ *
+ * \param window The window of which to change the resizable state.
+ * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow.
+ *
+ * \note You can't change the resizable state of a fullscreen window.
+ *
+ * \sa SDL_GetWindowFlags()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
+ SDL_bool resizable);
+
+/**
+ * \brief Show a window.
+ *
+ * \sa SDL_HideWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
+
+/**
+ * \brief Hide a window.
+ *
+ * \sa SDL_ShowWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
+
+/**
+ * \brief Raise a window above other windows and set the input focus.
+ */
+extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
+
+/**
+ * \brief Make a window as large as possible.
+ *
+ * \sa SDL_RestoreWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
+
+/**
+ * \brief Minimize a window to an iconic representation.
+ *
+ * \sa SDL_RestoreWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
+
+/**
+ * \brief Restore the size and position of a minimized or maximized window.
+ *
+ * \sa SDL_MaximizeWindow()
+ * \sa SDL_MinimizeWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
+
+/**
+ * \brief Set a window's fullscreen state.
+ *
+ * \return 0 on success, or -1 if setting the display mode failed.
+ *
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_GetWindowDisplayMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
+ Uint32 flags);
+
+/**
+ * \brief Get the SDL surface associated with the window.
+ *
+ * \return The window's framebuffer surface, or NULL on error.
+ *
+ * A new surface will be created with the optimal format for the window,
+ * if necessary. This surface will be freed when the window is destroyed.
+ *
+ * \note You may not combine this with 3D or the rendering API on this window.
+ *
+ * \sa SDL_UpdateWindowSurface()
+ * \sa SDL_UpdateWindowSurfaceRects()
+ */
+extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
+
+/**
+ * \brief Copy the window surface to the screen.
+ *
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_GetWindowSurface()
+ * \sa SDL_UpdateWindowSurfaceRects()
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
+
+/**
+ * \brief Copy a number of rectangles on the window surface to the screen.
+ *
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_GetWindowSurface()
+ * \sa SDL_UpdateWindowSurface()
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
+ const SDL_Rect * rects,
+ int numrects);
+
+/**
+ * \brief Set a window's input grab mode.
+ *
+ * \param window The window for which the input grab mode should be set.
+ * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
+ *
+ * If the caller enables a grab while another window is currently grabbed,
+ * the other window loses its grab in favor of the caller's window.
+ *
+ * \sa SDL_GetWindowGrab()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
+ SDL_bool grabbed);
+
+/**
+ * \brief Get a window's input grab mode.
+ *
+ * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
+ *
+ * \sa SDL_SetWindowGrab()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
+
+/**
+ * \brief Get the window that currently has an input grab enabled.
+ *
+ * \return This returns the window if input is grabbed, and NULL otherwise.
+ *
+ * \sa SDL_SetWindowGrab()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
+
+/**
+ * \brief Set the brightness (gamma correction) for a window.
+ *
+ * \return 0 on success, or -1 if setting the brightness isn't supported.
+ *
+ * \sa SDL_GetWindowBrightness()
+ * \sa SDL_SetWindowGammaRamp()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness);
+
+/**
+ * \brief Get the brightness (gamma correction) for a window.
+ *
+ * \return The last brightness value passed to SDL_SetWindowBrightness()
+ *
+ * \sa SDL_SetWindowBrightness()
+ */
+extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
+
+/**
+ * \brief Set the opacity for a window
+ *
+ * \param window The window which will be made transparent or opaque
+ * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
+ * clamped internally between 0.0f and 1.0f.
+ *
+ * \return 0 on success, or -1 if setting the opacity isn't supported.
+ *
+ * \sa SDL_GetWindowOpacity()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
+
+/**
+ * \brief Get the opacity of a window.
+ *
+ * If transparency isn't supported on this platform, opacity will be reported
+ * as 1.0f without error.
+ *
+ * \param window The window in question.
+ * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque)
+ *
+ * \return 0 on success, or -1 on error (invalid window, etc).
+ *
+ * \sa SDL_SetWindowOpacity()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
+
+/**
+ * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name)
+ *
+ * \param modal_window The window that should be modal
+ * \param parent_window The parent window
+ *
+ * \return 0 on success, or -1 otherwise.
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
+
+/**
+ * \brief Explicitly sets input focus to the window.
+ *
+ * You almost certainly want SDL_RaiseWindow() instead of this function. Use
+ * this with caution, as you might give focus to a window that's completely
+ * obscured by other windows.
+ *
+ * \param window The window that should get the input focus
+ *
+ * \return 0 on success, or -1 otherwise.
+ * \sa SDL_RaiseWindow()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
+
+/**
+ * \brief Set the gamma ramp for a window.
+ *
+ * \param window The window for which the gamma ramp should be set.
+ * \param red The translation table for the red channel, or NULL.
+ * \param green The translation table for the green channel, or NULL.
+ * \param blue The translation table for the blue channel, or NULL.
+ *
+ * \return 0 on success, or -1 if gamma ramps are unsupported.
+ *
+ * Set the gamma translation table for the red, green, and blue channels
+ * of the video hardware. Each table is an array of 256 16-bit quantities,
+ * representing a mapping between the input and output for that channel.
+ * The input is the index into the array, and the output is the 16-bit
+ * gamma value at that index, scaled to the output color precision.
+ *
+ * \sa SDL_GetWindowGammaRamp()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
+ const Uint16 * red,
+ const Uint16 * green,
+ const Uint16 * blue);
+
+/**
+ * \brief Get the gamma ramp for a window.
+ *
+ * \param window The window from which the gamma ramp should be queried.
+ * \param red A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the red channel, or NULL.
+ * \param green A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the green channel, or NULL.
+ * \param blue A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the blue channel, or NULL.
+ *
+ * \return 0 on success, or -1 if gamma ramps are unsupported.
+ *
+ * \sa SDL_SetWindowGammaRamp()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
+ Uint16 * red,
+ Uint16 * green,
+ Uint16 * blue);
+
+/**
+ * \brief Possible return values from the SDL_HitTest callback.
+ *
+ * \sa SDL_HitTest
+ */
+typedef enum
+{
+ SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
+ SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
+ SDL_HITTEST_RESIZE_TOPLEFT,
+ SDL_HITTEST_RESIZE_TOP,
+ SDL_HITTEST_RESIZE_TOPRIGHT,
+ SDL_HITTEST_RESIZE_RIGHT,
+ SDL_HITTEST_RESIZE_BOTTOMRIGHT,
+ SDL_HITTEST_RESIZE_BOTTOM,
+ SDL_HITTEST_RESIZE_BOTTOMLEFT,
+ SDL_HITTEST_RESIZE_LEFT
+} SDL_HitTestResult;
+
+/**
+ * \brief Callback used for hit-testing.
+ *
+ * \sa SDL_SetWindowHitTest
+ */
+typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
+ const SDL_Point *area,
+ void *data);
+
+/**
+ * \brief Provide a callback that decides if a window region has special properties.
+ *
+ * Normally windows are dragged and resized by decorations provided by the
+ * system window manager (a title bar, borders, etc), but for some apps, it
+ * makes sense to drag them from somewhere else inside the window itself; for
+ * example, one might have a borderless window that wants to be draggable
+ * from any part, or simulate its own title bar, etc.
+ *
+ * This function lets the app provide a callback that designates pieces of
+ * a given window as special. This callback is run during event processing
+ * if we need to tell the OS to treat a region of the window specially; the
+ * use of this callback is known as "hit testing."
+ *
+ * Mouse input may not be delivered to your application if it is within
+ * a special area; the OS will often apply that input to moving the window or
+ * resizing the window and not deliver it to the application.
+ *
+ * Specifying NULL for a callback disables hit-testing. Hit-testing is
+ * disabled by default.
+ *
+ * Platforms that don't support this functionality will return -1
+ * unconditionally, even if you're attempting to disable hit-testing.
+ *
+ * Your callback may fire at any time, and its firing does not indicate any
+ * specific behavior (for example, on Windows, this certainly might fire
+ * when the OS is deciding whether to drag your window, but it fires for lots
+ * of other reasons, too, some unrelated to anything you probably care about
+ * _and when the mouse isn't actually at the location it is testing_).
+ * Since this can fire at any time, you should try to keep your callback
+ * efficient, devoid of allocations, etc.
+ *
+ * \param window The window to set hit-testing on.
+ * \param callback The callback to call when doing a hit-test.
+ * \param callback_data An app-defined void pointer passed to the callback.
+ * \return 0 on success, -1 on error (including unsupported).
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
+ SDL_HitTest callback,
+ void *callback_data);
+
+/**
+ * \brief Destroy a window.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
+
+
+/**
+ * \brief Returns whether the screensaver is currently enabled (default off).
+ *
+ * \sa SDL_EnableScreenSaver()
+ * \sa SDL_DisableScreenSaver()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
+
+/**
+ * \brief Allow the screen to be blanked by a screensaver
+ *
+ * \sa SDL_IsScreenSaverEnabled()
+ * \sa SDL_DisableScreenSaver()
+ */
+extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
+
+/**
+ * \brief Prevent the screen from being blanked by a screensaver
+ *
+ * \sa SDL_IsScreenSaverEnabled()
+ * \sa SDL_EnableScreenSaver()
+ */
+extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
+
+
+/**
+ * \name OpenGL support functions
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load an OpenGL library.
+ *
+ * \param path The platform dependent OpenGL library name, or NULL to open the
+ * default OpenGL library.
+ *
+ * \return 0 on success, or -1 if the library couldn't be loaded.
+ *
+ * This should be done after initializing the video driver, but before
+ * creating any OpenGL windows. If no OpenGL library is loaded, the default
+ * library will be loaded upon creation of the first OpenGL window.
+ *
+ * \note If you do this, you need to retrieve all of the GL functions used in
+ * your program from the dynamic library using SDL_GL_GetProcAddress().
+ *
+ * \sa SDL_GL_GetProcAddress()
+ * \sa SDL_GL_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of an OpenGL function.
+ */
+extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
+
+/**
+ * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
+ *
+ * \sa SDL_GL_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
+
+/**
+ * \brief Return true if an OpenGL extension is supported for the current
+ * context.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
+ *extension);
+
+/**
+ * \brief Reset all previously set OpenGL context attributes to their default values
+ */
+extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
+
+/**
+ * \brief Set an OpenGL window attribute before window creation.
+ *
+ * \return 0 on success, or -1 if the attribute could not be set.
+ */
+extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
+
+/**
+ * \brief Get the actual value for an attribute from the current context.
+ *
+ * \return 0 on success, or -1 if the attribute could not be retrieved.
+ * The integer at \c value will be modified in either case.
+ */
+extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
+
+/**
+ * \brief Create an OpenGL context for use with an OpenGL window, and make it
+ * current.
+ *
+ * \sa SDL_GL_DeleteContext()
+ */
+extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
+ window);
+
+/**
+ * \brief Set up an OpenGL context for rendering into an OpenGL window.
+ *
+ * \note The context must have been created with a compatible window.
+ */
+extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
+ SDL_GLContext context);
+
+/**
+ * \brief Get the currently active OpenGL window.
+ */
+extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
+
+/**
+ * \brief Get the currently active OpenGL context.
+ */
+extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with glViewport).
+ *
+ * \param window Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels, may be NULL
+ * \param h Pointer to variable for storing the height in pixels, may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
+ int *h);
+
+/**
+ * \brief Set the swap interval for the current OpenGL context.
+ *
+ * \param interval 0 for immediate updates, 1 for updates synchronized with the
+ * vertical retrace. If the system supports it, you may
+ * specify -1 to allow late swaps to happen immediately
+ * instead of waiting for the next retrace.
+ *
+ * \return 0 on success, or -1 if setting the swap interval is not supported.
+ *
+ * \sa SDL_GL_GetSwapInterval()
+ */
+extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
+
+/**
+ * \brief Get the swap interval for the current OpenGL context.
+ *
+ * \return 0 if there is no vertical retrace synchronization, 1 if the buffer
+ * swap is synchronized with the vertical retrace, and -1 if late
+ * swaps happen immediately instead of waiting for the next retrace.
+ * If the system can't determine the swap interval, or there isn't a
+ * valid current context, this will return 0 as a safe default.
+ *
+ * \sa SDL_GL_SetSwapInterval()
+ */
+extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
+
+/**
+ * \brief Swap the OpenGL buffers for a window, if double-buffering is
+ * supported.
+ */
+extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
+
+/**
+ * \brief Delete an OpenGL context.
+ *
+ * \sa SDL_GL_CreateContext()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
+
+/* @} *//* OpenGL support functions */
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_video_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/include/SDL_vulkan.h b/src/3rdparty/SDL2/include/SDL_vulkan.h
new file mode 100644
index 0000000..f04c21a
--- /dev/null
+++ b/src/3rdparty/SDL2/include/SDL_vulkan.h
@@ -0,0 +1,273 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017, Mark Callow
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file SDL_vulkan.h
+ *
+ * Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ * \name Vulkan support functions
+ *
+ * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ * is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load a Vulkan loader library.
+ *
+ * \param [in] path The platform dependent Vulkan loader library name, or
+ * \c NULL.
+ *
+ * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ * If \a path is NULL SDL will use the value of the environment variable
+ * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan
+ * loader library.
+ *
+ * This should be called after initializing the video driver, but before
+ * creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ * default library will be loaded upon creation of the first Vulkan window.
+ *
+ * \note It is fairly common for Vulkan applications to link with \a libvulkan
+ * instead of explicitly loading it at run time. This will work with
+ * SDL provided the application links to a dynamic library and both it
+ * and SDL use the same search path.
+ *
+ * \note If you specify a non-NULL \c path, an application should retrieve all
+ * of the Vulkan functions it uses from the dynamic library using
+ * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ * \c path points to the same vulkan loader library the application
+ * linked to.
+ *
+ * \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ * the vkGetInstanceProcAddr address within all the mach-o images of
+ * the current process. This is because it is fairly common for Vulkan
+ * applications to link with libvulkan (and historically MoltenVK was
+ * provided as a static library). If it is not found then, on macOS, SDL
+ * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
+ * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order.
+ * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications
+ * using a dynamic framework or .dylib must ensure it is included in its
+ * application bundle.
+ *
+ * \note On non-Apple devices, application linking with a static libvulkan is
+ * not supported. Either do not link to the Vulkan loader or link to a
+ * dynamic library version.
+ *
+ * \note This function will fail if there are no working Vulkan drivers
+ * installed.
+ *
+ * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ * \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ * \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ * \brief Unload the Vulkan loader library previously loaded by
+ * \c SDL_Vulkan_LoadLibrary().
+ *
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ * \brief Get the names of the Vulkan instance extensions needed to create
+ * a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ * \param [in] window Window for which the required Vulkan instance
+ * extensions should be retrieved
+ * \param [in,out] count pointer to an \c unsigned related to the number of
+ * required Vulkan instance extensions
+ * \param [out] names \c NULL or a pointer to an array to be filled with the
+ * required Vulkan instance extensions
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * If \a pNames is \c NULL, then the number of required Vulkan instance
+ * extensions is returned in pCount. Otherwise, \a pCount must point to a
+ * variable set to the number of elements in the \a pNames array, and on
+ * return the variable is overwritten with the number of names actually
+ * written to \a pNames. If \a pCount is less than the number of required
+ * extensions, at most \a pCount structures will be written. If \a pCount
+ * is smaller than the number of required extensions, \c SDL_FALSE will be
+ * returned instead of \c SDL_TRUE, to indicate that not all the required
+ * extensions were returned.
+ *
+ * \note The returned list of extensions will contain \c VK_KHR_surface
+ * and zero or more platform specific extensions
+ *
+ * \note The extension names queried here must be enabled when calling
+ * VkCreateInstance, otherwise surface creation will fail.
+ *
+ * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \code
+ * unsigned int count;
+ * // get count of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL))
+ * handle_error();
+ *
+ * static const char *const additionalExtensions[] =
+ * {
+ * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ * };
+ * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ * size_t extensionCount = count + additionalExtensionsCount;
+ * const char **names = malloc(sizeof(const char *) * extensionCount);
+ * if(!names)
+ * handle_error();
+ *
+ * // get names of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names))
+ * handle_error();
+ *
+ * // copy additional extensions after required extensions
+ * for(size_t i = 0; i < additionalExtensionsCount; i++)
+ * names[i + count] = additionalExtensions[i];
+ *
+ * VkInstanceCreateInfo instanceCreateInfo = {};
+ * instanceCreateInfo.enabledExtensionCount = extensionCount;
+ * instanceCreateInfo.ppEnabledExtensionNames = names;
+ * // fill in rest of instanceCreateInfo
+ *
+ * VkInstance instance;
+ * // create the Vulkan instance
+ * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ * free(names);
+ * \endcode
+ *
+ * \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+ SDL_Window *window,
+ unsigned int *pCount,
+ const char **pNames);
+
+/**
+ * \brief Create a Vulkan rendering surface for a window.
+ *
+ * \param [in] window SDL_Window to which to attach the rendering surface.
+ * \param [in] instance handle to the Vulkan instance to use.
+ * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
+ * handle of the newly created surface.
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * \code
+ * VkInstance instance;
+ * SDL_Window *window;
+ *
+ * // create instance and window
+ *
+ * // create the Vulkan surface
+ * VkSurfaceKHR surface;
+ * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ * handle_error();
+ * \endcode
+ *
+ * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \note \a instance should have been created with the extensions returned
+ * by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ * \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR* surface);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with setting viewport, scissor & etc).
+ *
+ * \param window SDL_Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels,
+ * may be NULL
+ * \param h Pointer to variable for storing the height in pixels,
+ * may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \note On macOS high-DPI support must be enabled for an application by
+ * setting NSHighResolutionCapable to true in its Info.plist.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+ int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */
diff --git a/src/3rdparty/SDL2/include/begin_code.h b/src/3rdparty/SDL2/include/begin_code.h
new file mode 100644
index 0000000..6c21062
--- /dev/null
+++ b/src/3rdparty/SDL2/include/begin_code.h
@@ -0,0 +1,167 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file begin_code.h
+ *
+ * This file sets things up for C dynamic library function definitions,
+ * static inlined functions, and structures aligned at 4-byte alignment.
+ * If you don't like ugly C preprocessor code, don't look at this file. :)
+ */
+
+/* This shouldn't be nested -- included it around code only. */
+#ifdef _begin_code_h
+#error Nested inclusion of begin_code.h
+#endif
+#define _begin_code_h
+
+#ifndef SDL_DEPRECATED
+# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
+# define SDL_DEPRECATED __attribute__((deprecated))
+# else
+# define SDL_DEPRECATED
+# endif
+#endif
+
+#ifndef SDL_UNUSED
+# ifdef __GNUC__
+# define SDL_UNUSED __attribute__((unused))
+# else
+# define SDL_UNUSED
+# endif
+#endif
+
+/* Some compilers use a special export keyword */
+#ifndef DECLSPEC
+# if defined(__WIN32__) || defined(__WINRT__)
+# ifdef __BORLANDC__
+# ifdef BUILD_SDL
+# define DECLSPEC
+# else
+# define DECLSPEC __declspec(dllimport)
+# endif
+# else
+# define DECLSPEC __declspec(dllexport)
+# endif
+# elif defined(__OS2__)
+# ifdef BUILD_SDL
+# define DECLSPEC __declspec(dllexport)
+# else
+# define DECLSPEC
+# endif
+# else
+# if defined(__GNUC__) && __GNUC__ >= 4
+# define DECLSPEC __attribute__ ((visibility("default")))
+# else
+# define DECLSPEC
+# endif
+# endif
+#endif
+
+/* By default SDL uses the C calling convention */
+#ifndef SDLCALL
+#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
+#define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+# define _System /* for old EMX/GCC compat. */
+# endif
+#else
+#define SDLCALL
+#endif
+#endif /* SDLCALL */
+
+/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
+#ifdef __SYMBIAN32__
+#undef DECLSPEC
+#define DECLSPEC
+#endif /* __SYMBIAN32__ */
+
+/* Force structure packing at 4 byte alignment.
+ This is necessary if the header is included in code which has structure
+ packing set to an alternate value, say for loading structures from disk.
+ The packing is reset to the previous value in close_code.h
+ */
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
+#ifdef _MSC_VER
+#pragma warning(disable: 4103)
+#endif
+#ifdef __BORLANDC__
+#pragma nopackwarning
+#endif
+#ifdef _M_X64
+/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
+#pragma pack(push,8)
+#else
+#pragma pack(push,4)
+#endif
+#endif /* Compiler needs structure packing set */
+
+#ifndef SDL_INLINE
+#if defined(__GNUC__)
+#define SDL_INLINE __inline__
+#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
+ defined(__DMC__) || defined(__SC__) || \
+ defined(__WATCOMC__) || defined(__LCC__) || \
+ defined(__DECC) || defined(__CC_ARM)
+#define SDL_INLINE __inline
+#ifndef __inline__
+#define __inline__ __inline
+#endif
+#else
+#define SDL_INLINE inline
+#ifndef __inline__
+#define __inline__ inline
+#endif
+#endif
+#endif /* SDL_INLINE not defined */
+
+#ifndef SDL_FORCE_INLINE
+#if defined(_MSC_VER)
+#define SDL_FORCE_INLINE __forceinline
+#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
+#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
+#else
+#define SDL_FORCE_INLINE static SDL_INLINE
+#endif
+#endif /* SDL_FORCE_INLINE not defined */
+
+#ifndef SDL_NORETURN
+#if defined(__GNUC__)
+#define SDL_NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define SDL_NORETURN __declspec(noreturn)
+#else
+#define SDL_NORETURN
+#endif
+#endif /* SDL_NORETURN not defined */
+
+/* Apparently this is needed by several Windows compilers */
+#if !defined(__MACH__)
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif /* NULL */
+#endif /* ! Mac OS X - breaks precompiled headers */
diff --git a/src/3rdparty/SDL2/include/close_code.h b/src/3rdparty/SDL2/include/close_code.h
new file mode 100644
index 0000000..b3b70a4
--- /dev/null
+++ b/src/3rdparty/SDL2/include/close_code.h
@@ -0,0 +1,37 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * \file close_code.h
+ *
+ * This file reverses the effects of begin_code.h and should be included
+ * after you finish any function and structure declarations in your headers
+ */
+
+#undef _begin_code_h
+
+/* Reset structure packing at previous byte alignment */
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
+#ifdef __BORLANDC__
+#pragma nopackwarning
+#endif
+#pragma pack(pop)
+#endif /* Compiler needs structure packing set */
diff --git a/src/3rdparty/SDL2/src/SDL.c b/src/3rdparty/SDL2/src/SDL.c
new file mode 100644
index 0000000..0e55279
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL.c
@@ -0,0 +1,476 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "./SDL_internal.h"
+
+#if defined(__WIN32__)
+#include "core/windows/SDL_windows.h"
+#endif
+
+/* Initialization code for SDL */
+
+#include "SDL.h"
+#include "SDL_bits.h"
+#include "SDL_revision.h"
+#include "SDL_assert_c.h"
+#include "events/SDL_events_c.h"
+#include "haptic/SDL_haptic_c.h"
+#include "joystick/SDL_joystick_c.h"
+
+/* Initialization/Cleanup routines */
+#if !SDL_TIMERS_DISABLED
+# include "timer/SDL_timer_c.h"
+#endif
+#if SDL_VIDEO_DRIVER_WINDOWS
+extern int SDL_HelperWindowCreate(void);
+extern int SDL_HelperWindowDestroy(void);
+#endif
+
+
+/* The initialized subsystems */
+#ifdef SDL_MAIN_NEEDED
+static SDL_bool SDL_MainIsReady = SDL_FALSE;
+#else
+static SDL_bool SDL_MainIsReady = SDL_TRUE;
+#endif
+static SDL_bool SDL_bInMainQuit = SDL_FALSE;
+static Uint8 SDL_SubsystemRefCount[ 32 ];
+
+/* Private helper to increment a subsystem's ref counter. */
+static void
+SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem)
+{
+ int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+ SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
+ ++SDL_SubsystemRefCount[subsystem_index];
+}
+
+/* Private helper to decrement a subsystem's ref counter. */
+static void
+SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem)
+{
+ int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+ if (SDL_SubsystemRefCount[subsystem_index] > 0) {
+ --SDL_SubsystemRefCount[subsystem_index];
+ }
+}
+
+/* Private helper to check if a system needs init. */
+static SDL_bool
+SDL_PrivateShouldInitSubsystem(Uint32 subsystem)
+{
+ int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+ SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
+ return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE;
+}
+
+/* Private helper to check if a system needs to be quit. */
+static SDL_bool
+SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) {
+ int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
+ if (SDL_SubsystemRefCount[subsystem_index] == 0) {
+ return SDL_FALSE;
+ }
+
+ /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
+ * isn't zero.
+ */
+ return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE;
+}
+
+void
+SDL_SetMainReady(void)
+{
+ SDL_MainIsReady = SDL_TRUE;
+}
+
+int
+SDL_InitSubSystem(Uint32 flags)
+{
+ if (!SDL_MainIsReady) {
+ SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
+ return -1;
+ }
+
+ /* Clear the error message */
+ SDL_ClearError();
+
+ if ((flags & SDL_INIT_GAMECONTROLLER)) {
+ /* game controller implies joystick */
+ flags |= SDL_INIT_JOYSTICK;
+ }
+
+ if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK))) {
+ /* video or joystick implies events */
+ flags |= SDL_INIT_EVENTS;
+ }
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+ if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
+ if (SDL_HelperWindowCreate() < 0) {
+ return -1;
+ }
+ }
+#endif
+
+#if !SDL_TIMERS_DISABLED
+ SDL_TicksInit();
+#endif
+
+ /* Initialize the event subsystem */
+ if ((flags & SDL_INIT_EVENTS)) {
+#if !SDL_EVENTS_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) {
+ if (SDL_StartEventLoop() < 0) {
+ return (-1);
+ }
+ SDL_QuitInit();
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_EVENTS);
+#else
+ return SDL_SetError("SDL not built with events support");
+#endif
+ }
+
+ /* Initialize the timer subsystem */
+ if ((flags & SDL_INIT_TIMER)){
+#if !SDL_TIMERS_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
+ if (SDL_TimerInit() < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER);
+#else
+ return SDL_SetError("SDL not built with timer support");
+#endif
+ }
+
+ /* Initialize the video subsystem */
+ if ((flags & SDL_INIT_VIDEO)){
+#if !SDL_VIDEO_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
+ if (SDL_VideoInit(NULL) < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_VIDEO);
+#else
+ return SDL_SetError("SDL not built with video support");
+#endif
+ }
+
+ /* Initialize the audio subsystem */
+ if ((flags & SDL_INIT_AUDIO)){
+#if !SDL_AUDIO_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
+ if (SDL_AudioInit(NULL) < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_AUDIO);
+#else
+ return SDL_SetError("SDL not built with audio support");
+#endif
+ }
+
+ /* Initialize the joystick subsystem */
+ if ((flags & SDL_INIT_JOYSTICK)){
+#if !SDL_JOYSTICK_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
+ if (SDL_JoystickInit() < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_JOYSTICK);
+#else
+ return SDL_SetError("SDL not built with joystick support");
+#endif
+ }
+
+ if ((flags & SDL_INIT_GAMECONTROLLER)){
+#if !SDL_JOYSTICK_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
+ if (SDL_GameControllerInit() < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER);
+#else
+ return SDL_SetError("SDL not built with joystick support");
+#endif
+ }
+
+ /* Initialize the haptic subsystem */
+ if ((flags & SDL_INIT_HAPTIC)){
+#if !SDL_HAPTIC_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
+ if (SDL_HapticInit() < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC);
+#else
+ return SDL_SetError("SDL not built with haptic (force feedback) support");
+#endif
+ }
+
+ return (0);
+}
+
+int
+SDL_Init(Uint32 flags)
+{
+ return SDL_InitSubSystem(flags);
+}
+
+void
+SDL_QuitSubSystem(Uint32 flags)
+{
+ /* Shut down requested initialized subsystems */
+#if !SDL_JOYSTICK_DISABLED
+ if ((flags & SDL_INIT_GAMECONTROLLER)) {
+ /* game controller implies joystick */
+ flags |= SDL_INIT_JOYSTICK;
+
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
+ SDL_GameControllerQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER);
+ }
+
+ if ((flags & SDL_INIT_JOYSTICK)) {
+ /* joystick implies events */
+ flags |= SDL_INIT_EVENTS;
+
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_JOYSTICK)) {
+ SDL_JoystickQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK);
+ }
+#endif
+
+#if !SDL_HAPTIC_DISABLED
+ if ((flags & SDL_INIT_HAPTIC)) {
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
+ SDL_HapticQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_HAPTIC);
+ }
+#endif
+
+#if !SDL_AUDIO_DISABLED
+ if ((flags & SDL_INIT_AUDIO)) {
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) {
+ SDL_AudioQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO);
+ }
+#endif
+
+#if !SDL_VIDEO_DISABLED
+ if ((flags & SDL_INIT_VIDEO)) {
+ /* video implies events */
+ flags |= SDL_INIT_EVENTS;
+
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) {
+ SDL_VideoQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO);
+ }
+#endif
+
+#if !SDL_TIMERS_DISABLED
+ if ((flags & SDL_INIT_TIMER)) {
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
+ SDL_TimerQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_TIMER);
+ }
+#endif
+
+#if !SDL_EVENTS_DISABLED
+ if ((flags & SDL_INIT_EVENTS)) {
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) {
+ SDL_QuitQuit();
+ SDL_StopEventLoop();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_EVENTS);
+ }
+#endif
+}
+
+Uint32
+SDL_WasInit(Uint32 flags)
+{
+ int i;
+ int num_subsystems = SDL_arraysize(SDL_SubsystemRefCount);
+ Uint32 initialized = 0;
+
+ if (!flags) {
+ flags = SDL_INIT_EVERYTHING;
+ }
+
+ num_subsystems = SDL_min(num_subsystems, SDL_MostSignificantBitIndex32(flags) + 1);
+
+ /* Iterate over each bit in flags, and check the matching subsystem. */
+ for (i = 0; i < num_subsystems; ++i) {
+ if ((flags & 1) && SDL_SubsystemRefCount[i] > 0) {
+ initialized |= (1 << i);
+ }
+
+ flags >>= 1;
+ }
+
+ return initialized;
+}
+
+void
+SDL_Quit(void)
+{
+ SDL_bInMainQuit = SDL_TRUE;
+
+ /* Quit all subsystems */
+#if SDL_VIDEO_DRIVER_WINDOWS
+ SDL_HelperWindowDestroy();
+#endif
+ SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
+
+#if !SDL_TIMERS_DISABLED
+ SDL_TicksQuit();
+#endif
+
+ SDL_ClearHints();
+ SDL_AssertionsQuit();
+ SDL_LogResetPriorities();
+
+ /* Now that every subsystem has been quit, we reset the subsystem refcount
+ * and the list of initialized subsystems.
+ */
+ SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) );
+
+ SDL_bInMainQuit = SDL_FALSE;
+}
+
+/* Get the library version number */
+void
+SDL_GetVersion(SDL_version * ver)
+{
+ SDL_VERSION(ver);
+}
+
+/* Get the library source revision */
+const char *
+SDL_GetRevision(void)
+{
+ return SDL_REVISION;
+}
+
+/* Get the library source revision number */
+int
+SDL_GetRevisionNumber(void)
+{
+ return SDL_REVISION_NUMBER;
+}
+
+/* Get the name of the platform */
+const char *
+SDL_GetPlatform()
+{
+#if __AIX__
+ return "AIX";
+#elif __ANDROID__
+ return "Android";
+#elif __BSDI__
+ return "BSDI";
+#elif __DREAMCAST__
+ return "Dreamcast";
+#elif __EMSCRIPTEN__
+ return "Emscripten";
+#elif __FREEBSD__
+ return "FreeBSD";
+#elif __HAIKU__
+ return "Haiku";
+#elif __HPUX__
+ return "HP-UX";
+#elif __IRIX__
+ return "Irix";
+#elif __LINUX__
+ return "Linux";
+#elif __MINT__
+ return "Atari MiNT";
+#elif __MACOS__
+ return "MacOS Classic";
+#elif __MACOSX__
+ return "Mac OS X";
+#elif __NACL__
+ return "NaCl";
+#elif __NETBSD__
+ return "NetBSD";
+#elif __OPENBSD__
+ return "OpenBSD";
+#elif __OS2__
+ return "OS/2";
+#elif __OSF__
+ return "OSF/1";
+#elif __QNXNTO__
+ return "QNX Neutrino";
+#elif __RISCOS__
+ return "RISC OS";
+#elif __SOLARIS__
+ return "Solaris";
+#elif __WIN32__
+ return "Windows";
+#elif __WINRT__
+ return "WinRT";
+#elif __TVOS__
+ return "tvOS";
+#elif __IPHONEOS__
+ return "iOS";
+#elif __PSP__
+ return "PlayStation Portable";
+#else
+ return "Unknown (see SDL_platform.h)";
+#endif
+}
+
+#if defined(__WIN32__)
+
+#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
+/* Need to include DllMain() on Watcom C for some reason.. */
+
+BOOL APIENTRY
+_DllMainCRTStartup(HANDLE hModule,
+ DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+#endif /* Building DLL */
+
+#endif /* __WIN32__ */
+
+/* vi: set sts=4 ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_assert.c b/src/3rdparty/SDL2/src/SDL_assert.c
new file mode 100644
index 0000000..76f5d60
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_assert.c
@@ -0,0 +1,441 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "./SDL_internal.h"
+
+#if defined(__WIN32__)
+#include "core/windows/SDL_windows.h"
+#endif
+
+#include "SDL.h"
+#include "SDL_atomic.h"
+#include "SDL_messagebox.h"
+#include "SDL_video.h"
+#include "SDL_assert.h"
+#include "SDL_assert_c.h"
+#include "video/SDL_sysvideo.h"
+
+#ifdef __WIN32__
+#ifndef WS_OVERLAPPEDWINDOW
+#define WS_OVERLAPPEDWINDOW 0
+#endif
+#else /* fprintf, _exit(), etc. */
+#include <stdio.h>
+#include <stdlib.h>
+#if ! defined(__WINRT__)
+#include <unistd.h>
+#endif
+#endif
+
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
+#endif
+
+
+static SDL_assert_state SDLCALL
+SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
+
+/*
+ * We keep all triggered assertions in a singly-linked list so we can
+ * generate a report later.
+ */
+static SDL_assert_data *triggered_assertions = NULL;
+
+#ifndef SDL_THREADS_DISABLED
+static SDL_mutex *assertion_mutex = NULL;
+#endif
+
+static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
+static void *assertion_userdata = NULL;
+
+#ifdef __GNUC__
+static void
+debug_print(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+#endif
+
+static void
+debug_print(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ SDL_LogMessageV(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_WARN, fmt, ap);
+ va_end(ap);
+}
+
+
+static void SDL_AddAssertionToReport(SDL_assert_data *data)
+{
+ /* (data) is always a static struct defined with the assert macros, so
+ we don't have to worry about copying or allocating them. */
+ data->trigger_count++;
+ if (data->trigger_count == 1) { /* not yet added? */
+ data->next = triggered_assertions;
+ triggered_assertions = data;
+ }
+}
+
+
+static void SDL_GenerateAssertionReport(void)
+{
+ const SDL_assert_data *item = triggered_assertions;
+
+ /* only do this if the app hasn't assigned an assertion handler. */
+ if ((item != NULL) && (assertion_handler != SDL_PromptAssertion)) {
+ debug_print("\n\nSDL assertion report.\n");
+ debug_print("All SDL assertions between last init/quit:\n\n");
+
+ while (item != NULL) {
+ debug_print(
+ "'%s'\n"
+ " * %s (%s:%d)\n"
+ " * triggered %u time%s.\n"
+ " * always ignore: %s.\n",
+ item->condition, item->function, item->filename,
+ item->linenum, item->trigger_count,
+ (item->trigger_count == 1) ? "" : "s",
+ item->always_ignore ? "yes" : "no");
+ item = item->next;
+ }
+ debug_print("\n");
+
+ SDL_ResetAssertionReport();
+ }
+}
+
+
+static SDL_NORETURN void SDL_ExitProcess(int exitcode)
+{
+#ifdef __WIN32__
+ ExitProcess(exitcode);
+#elif defined(__EMSCRIPTEN__)
+ emscripten_cancel_main_loop(); /* this should "kill" the app. */
+ emscripten_force_exit(exitcode); /* this should "kill" the app. */
+ exit(exitcode);
+#else
+ _exit(exitcode);
+#endif
+}
+
+
+static SDL_NORETURN void SDL_AbortAssertion(void)
+{
+ SDL_Quit();
+ SDL_ExitProcess(42);
+}
+
+
+static SDL_assert_state SDLCALL
+SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
+{
+#ifdef __WIN32__
+ #define ENDLINE "\r\n"
+#else
+ #define ENDLINE "\n"
+#endif
+
+ const char *envr;
+ SDL_assert_state state = SDL_ASSERTION_ABORT;
+ SDL_Window *window;
+ SDL_MessageBoxData messagebox;
+ SDL_MessageBoxButtonData buttons[] = {
+ { 0, SDL_ASSERTION_RETRY, "Retry" },
+ { 0, SDL_ASSERTION_BREAK, "Break" },
+ { 0, SDL_ASSERTION_ABORT, "Abort" },
+ { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT,
+ SDL_ASSERTION_IGNORE, "Ignore" },
+ { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT,
+ SDL_ASSERTION_ALWAYS_IGNORE, "Always Ignore" }
+ };
+ char *message;
+ int selected;
+
+ (void) userdata; /* unused in default handler. */
+
+ message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
+ if (!message) {
+ /* Uh oh, we're in real trouble now... */
+ return SDL_ASSERTION_ABORT;
+ }
+ SDL_snprintf(message, SDL_MAX_LOG_MESSAGE,
+ "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE
+ " '%s'",
+ data->function, data->filename, data->linenum,
+ data->trigger_count, (data->trigger_count == 1) ? "time" : "times",
+ data->condition);
+
+ debug_print("\n\n%s\n\n", message);
+
+ /* let env. variable override, so unit tests won't block in a GUI. */
+ envr = SDL_getenv("SDL_ASSERT");
+ if (envr != NULL) {
+ SDL_stack_free(message);
+
+ if (SDL_strcmp(envr, "abort") == 0) {
+ return SDL_ASSERTION_ABORT;
+ } else if (SDL_strcmp(envr, "break") == 0) {
+ return SDL_ASSERTION_BREAK;
+ } else if (SDL_strcmp(envr, "retry") == 0) {
+ return SDL_ASSERTION_RETRY;
+ } else if (SDL_strcmp(envr, "ignore") == 0) {
+ return SDL_ASSERTION_IGNORE;
+ } else if (SDL_strcmp(envr, "always_ignore") == 0) {
+ return SDL_ASSERTION_ALWAYS_IGNORE;
+ } else {
+ return SDL_ASSERTION_ABORT; /* oh well. */
+ }
+ }
+
+ /* Leave fullscreen mode, if possible (scary!) */
+ window = SDL_GetFocusWindow();
+ if (window) {
+ if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
+ SDL_MinimizeWindow(window);
+ } else {
+ /* !!! FIXME: ungrab the input if we're not fullscreen? */
+ /* No need to mess with the window */
+ window = NULL;
+ }
+ }
+
+ /* Show a messagebox if we can, otherwise fall back to stdio */
+ SDL_zero(messagebox);
+ messagebox.flags = SDL_MESSAGEBOX_WARNING;
+ messagebox.window = window;
+ messagebox.title = "Assertion Failed";
+ messagebox.message = message;
+ messagebox.numbuttons = SDL_arraysize(buttons);
+ messagebox.buttons = buttons;
+
+ if (SDL_ShowMessageBox(&messagebox, &selected) == 0) {
+ if (selected == -1) {
+ state = SDL_ASSERTION_IGNORE;
+ } else {
+ state = (SDL_assert_state)selected;
+ }
+ }
+
+ else
+ {
+#if defined(__EMSCRIPTEN__)
+ /* This is nasty, but we can't block on a custom UI. */
+ for ( ; ; ) {
+ SDL_bool okay = SDL_TRUE;
+ char *buf = (char *) EM_ASM_INT({
+ var str =
+ Pointer_stringify($0) + '\n\n' +
+ 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :';
+ var reply = window.prompt(str, "i");
+ if (reply === null) {
+ reply = "i";
+ }
+ return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL);
+ }, message);
+
+ if (SDL_strcmp(buf, "a") == 0) {
+ state = SDL_ASSERTION_ABORT;
+ /* (currently) no break functionality on Emscripten
+ } else if (SDL_strcmp(buf, "b") == 0) {
+ state = SDL_ASSERTION_BREAK; */
+ } else if (SDL_strcmp(buf, "r") == 0) {
+ state = SDL_ASSERTION_RETRY;
+ } else if (SDL_strcmp(buf, "i") == 0) {
+ state = SDL_ASSERTION_IGNORE;
+ } else if (SDL_strcmp(buf, "A") == 0) {
+ state = SDL_ASSERTION_ALWAYS_IGNORE;
+ } else {
+ okay = SDL_FALSE;
+ }
+ free(buf);
+
+ if (okay) {
+ break;
+ }
+ }
+#elif defined(HAVE_STDIO_H)
+ /* this is a little hacky. */
+ for ( ; ; ) {
+ char buf[32];
+ fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
+ fflush(stderr);
+ if (fgets(buf, sizeof (buf), stdin) == NULL) {
+ break;
+ }
+
+ if (SDL_strncmp(buf, "a", 1) == 0) {
+ state = SDL_ASSERTION_ABORT;
+ break;
+ } else if (SDL_strncmp(buf, "b", 1) == 0) {
+ state = SDL_ASSERTION_BREAK;
+ break;
+ } else if (SDL_strncmp(buf, "r", 1) == 0) {
+ state = SDL_ASSERTION_RETRY;
+ break;
+ } else if (SDL_strncmp(buf, "i", 1) == 0) {
+ state = SDL_ASSERTION_IGNORE;
+ break;
+ } else if (SDL_strncmp(buf, "A", 1) == 0) {
+ state = SDL_ASSERTION_ALWAYS_IGNORE;
+ break;
+ }
+ }
+#endif /* HAVE_STDIO_H */
+ }
+
+ /* Re-enter fullscreen mode */
+ if (window) {
+ SDL_RestoreWindow(window);
+ }
+
+ SDL_stack_free(message);
+
+ return state;
+}
+
+
+SDL_assert_state
+SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
+ int line)
+{
+ SDL_assert_state state = SDL_ASSERTION_IGNORE;
+ static int assertion_running = 0;
+
+#ifndef SDL_THREADS_DISABLED
+ static SDL_SpinLock spinlock = 0;
+ SDL_AtomicLock(&spinlock);
+ if (assertion_mutex == NULL) { /* never called SDL_Init()? */
+ assertion_mutex = SDL_CreateMutex();
+ if (assertion_mutex == NULL) {
+ SDL_AtomicUnlock(&spinlock);
+ return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
+ }
+ }
+ SDL_AtomicUnlock(&spinlock);
+
+ if (SDL_LockMutex(assertion_mutex) < 0) {
+ return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
+ }
+#endif
+
+ /* doing this because Visual C is upset over assigning in the macro. */
+ if (data->trigger_count == 0) {
+ data->function = func;
+ data->filename = file;
+ data->linenum = line;
+ }
+
+ SDL_AddAssertionToReport(data);
+
+ assertion_running++;
+ if (assertion_running > 1) { /* assert during assert! Abort. */
+ if (assertion_running == 2) {
+ SDL_AbortAssertion();
+ } else if (assertion_running == 3) { /* Abort asserted! */
+ SDL_ExitProcess(42);
+ } else {
+ while (1) { /* do nothing but spin; what else can you do?! */ }
+ }
+ }
+
+ if (!data->always_ignore) {
+ state = assertion_handler(data, assertion_userdata);
+ }
+
+ switch (state)
+ {
+ case SDL_ASSERTION_ABORT:
+ SDL_AbortAssertion();
+ return SDL_ASSERTION_IGNORE; /* shouldn't return, but oh well. */
+
+ case SDL_ASSERTION_ALWAYS_IGNORE:
+ state = SDL_ASSERTION_IGNORE;
+ data->always_ignore = 1;
+ break;
+
+ case SDL_ASSERTION_IGNORE:
+ case SDL_ASSERTION_RETRY:
+ case SDL_ASSERTION_BREAK:
+ break; /* macro handles these. */
+ }
+
+ assertion_running--;
+
+#ifndef SDL_THREADS_DISABLED
+ SDL_UnlockMutex(assertion_mutex);
+#endif
+
+ return state;
+}
+
+
+void SDL_AssertionsQuit(void)
+{
+ SDL_GenerateAssertionReport();
+#ifndef SDL_THREADS_DISABLED
+ if (assertion_mutex != NULL) {
+ SDL_DestroyMutex(assertion_mutex);
+ assertion_mutex = NULL;
+ }
+#endif
+}
+
+void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
+{
+ if (handler != NULL) {
+ assertion_handler = handler;
+ assertion_userdata = userdata;
+ } else {
+ assertion_handler = SDL_PromptAssertion;
+ assertion_userdata = NULL;
+ }
+}
+
+const SDL_assert_data *SDL_GetAssertionReport(void)
+{
+ return triggered_assertions;
+}
+
+void SDL_ResetAssertionReport(void)
+{
+ SDL_assert_data *next = NULL;
+ SDL_assert_data *item;
+ for (item = triggered_assertions; item != NULL; item = next) {
+ next = (SDL_assert_data *) item->next;
+ item->always_ignore = SDL_FALSE;
+ item->trigger_count = 0;
+ item->next = NULL;
+ }
+
+ triggered_assertions = NULL;
+}
+
+SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void)
+{
+ return SDL_PromptAssertion;
+}
+
+SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata)
+{
+ if (userdata != NULL) {
+ *userdata = assertion_userdata;
+ }
+ return assertion_handler;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_assert_c.h b/src/3rdparty/SDL2/src/SDL_assert_c.h
new file mode 100644
index 0000000..aa690a3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_assert_c.h
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+extern void SDL_AssertionsQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_dataqueue.c b/src/3rdparty/SDL2/src/SDL_dataqueue.c
new file mode 100644
index 0000000..97916f4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_dataqueue.c
@@ -0,0 +1,339 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "./SDL_internal.h"
+#include "SDL.h"
+#include "./SDL_dataqueue.h"
+#include "SDL_assert.h"
+
+typedef struct SDL_DataQueuePacket
+{
+ size_t datalen; /* bytes currently in use in this packet. */
+ size_t startpos; /* bytes currently consumed in this packet. */
+ struct SDL_DataQueuePacket *next; /* next item in linked list. */
+ Uint8 data[SDL_VARIABLE_LENGTH_ARRAY]; /* packet data */
+} SDL_DataQueuePacket;
+
+struct SDL_DataQueue
+{
+ SDL_DataQueuePacket *head; /* device fed from here. */
+ SDL_DataQueuePacket *tail; /* queue fills to here. */
+ SDL_DataQueuePacket *pool; /* these are unused packets. */
+ size_t packet_size; /* size of new packets */
+ size_t queued_bytes; /* number of bytes of data in the queue. */
+};
+
+static void
+SDL_FreeDataQueueList(SDL_DataQueuePacket *packet)
+{
+ while (packet) {
+ SDL_DataQueuePacket *next = packet->next;
+ SDL_free(packet);
+ packet = next;
+ }
+}
+
+
+/* this all expects that you managed thread safety elsewhere. */
+
+SDL_DataQueue *
+SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack)
+{
+ SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue));
+
+ if (!queue) {
+ SDL_OutOfMemory();
+ return NULL;
+ } else {
+ const size_t packetlen = _packetlen ? _packetlen : 1024;
+ const size_t wantpackets = (initialslack + (packetlen - 1)) / packetlen;
+ size_t i;
+
+ SDL_zerop(queue);
+ queue->packet_size = packetlen;
+
+ for (i = 0; i < wantpackets; i++) {
+ SDL_DataQueuePacket *packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + packetlen);
+ if (packet) { /* don't care if this fails, we'll deal later. */
+ packet->datalen = 0;
+ packet->startpos = 0;
+ packet->next = queue->pool;
+ queue->pool = packet;
+ }
+ }
+ }
+
+ return queue;
+}
+
+void
+SDL_FreeDataQueue(SDL_DataQueue *queue)
+{
+ if (queue) {
+ SDL_FreeDataQueueList(queue->head);
+ SDL_FreeDataQueueList(queue->pool);
+ SDL_free(queue);
+ }
+}
+
+void
+SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack)
+{
+ const size_t packet_size = queue ? queue->packet_size : 1;
+ const size_t slackpackets = (slack + (packet_size-1)) / packet_size;
+ SDL_DataQueuePacket *packet;
+ SDL_DataQueuePacket *prev = NULL;
+ size_t i;
+
+ if (!queue) {
+ return;
+ }
+
+ packet = queue->head;
+
+ /* merge the available pool and the current queue into one list. */
+ if (packet) {
+ queue->tail->next = queue->pool;
+ } else {
+ packet = queue->pool;
+ }
+
+ /* Remove the queued packets from the device. */
+ queue->tail = NULL;
+ queue->head = NULL;
+ queue->queued_bytes = 0;
+ queue->pool = packet;
+
+ /* Optionally keep some slack in the pool to reduce malloc pressure. */
+ for (i = 0; packet && (i < slackpackets); i++) {
+ prev = packet;
+ packet = packet->next;
+ }
+
+ if (prev) {
+ prev->next = NULL;
+ } else {
+ queue->pool = NULL;
+ }
+
+ SDL_FreeDataQueueList(packet); /* free extra packets */
+}
+
+static SDL_DataQueuePacket *
+AllocateDataQueuePacket(SDL_DataQueue *queue)
+{
+ SDL_DataQueuePacket *packet;
+
+ SDL_assert(queue != NULL);
+
+ packet = queue->pool;
+ if (packet != NULL) {
+ /* we have one available in the pool. */
+ queue->pool = packet->next;
+ } else {
+ /* Have to allocate a new one! */
+ packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + queue->packet_size);
+ if (packet == NULL) {
+ return NULL;
+ }
+ }
+
+ packet->datalen = 0;
+ packet->startpos = 0;
+ packet->next = NULL;
+
+ SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0));
+ if (queue->tail == NULL) {
+ queue->head = packet;
+ } else {
+ queue->tail->next = packet;
+ }
+ queue->tail = packet;
+ return packet;
+}
+
+
+int
+SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len)
+{
+ size_t len = _len;
+ const Uint8 *data = (const Uint8 *) _data;
+ const size_t packet_size = queue ? queue->packet_size : 0;
+ SDL_DataQueuePacket *orighead;
+ SDL_DataQueuePacket *origtail;
+ size_t origlen;
+ size_t datalen;
+
+ if (!queue) {
+ return SDL_InvalidParamError("queue");
+ }
+
+ orighead = queue->head;
+ origtail = queue->tail;
+ origlen = origtail ? origtail->datalen : 0;
+
+ while (len > 0) {
+ SDL_DataQueuePacket *packet = queue->tail;
+ SDL_assert(!packet || (packet->datalen <= packet_size));
+ if (!packet || (packet->datalen >= packet_size)) {
+ /* tail packet missing or completely full; we need a new packet. */
+ packet = AllocateDataQueuePacket(queue);
+ if (!packet) {
+ /* uhoh, reset so we've queued nothing new, free what we can. */
+ if (!origtail) {
+ packet = queue->head; /* whole queue. */
+ } else {
+ packet = origtail->next; /* what we added to existing queue. */
+ origtail->next = NULL;
+ origtail->datalen = origlen;
+ }
+ queue->head = orighead;
+ queue->tail = origtail;
+ queue->pool = NULL;
+
+ SDL_FreeDataQueueList(packet); /* give back what we can. */
+ return SDL_OutOfMemory();
+ }
+ }
+
+ datalen = SDL_min(len, packet_size - packet->datalen);
+ SDL_memcpy(packet->data + packet->datalen, data, datalen);
+ data += datalen;
+ len -= datalen;
+ packet->datalen += datalen;
+ queue->queued_bytes += datalen;
+ }
+
+ return 0;
+}
+
+size_t
+SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
+{
+ size_t len = _len;
+ Uint8 *buf = (Uint8 *) _buf;
+ Uint8 *ptr = buf;
+ SDL_DataQueuePacket *packet;
+
+ if (!queue) {
+ return 0;
+ }
+
+ for (packet = queue->head; len && packet; packet = packet->next) {
+ const size_t avail = packet->datalen - packet->startpos;
+ const size_t cpy = SDL_min(len, avail);
+ SDL_assert(queue->queued_bytes >= avail);
+
+ SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+ ptr += cpy;
+ len -= cpy;
+ }
+
+ return (size_t) (ptr - buf);
+}
+
+size_t
+SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
+{
+ size_t len = _len;
+ Uint8 *buf = (Uint8 *) _buf;
+ Uint8 *ptr = buf;
+ SDL_DataQueuePacket *packet;
+
+ if (!queue) {
+ return 0;
+ }
+
+ while ((len > 0) && ((packet = queue->head) != NULL)) {
+ const size_t avail = packet->datalen - packet->startpos;
+ const size_t cpy = SDL_min(len, avail);
+ SDL_assert(queue->queued_bytes >= avail);
+
+ SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+ packet->startpos += cpy;
+ ptr += cpy;
+ queue->queued_bytes -= cpy;
+ len -= cpy;
+
+ if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */
+ queue->head = packet->next;
+ SDL_assert((packet->next != NULL) || (packet == queue->tail));
+ packet->next = queue->pool;
+ queue->pool = packet;
+ }
+ }
+
+ SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0));
+
+ if (queue->head == NULL) {
+ queue->tail = NULL; /* in case we drained the queue entirely. */
+ }
+
+ return (size_t) (ptr - buf);
+}
+
+size_t
+SDL_CountDataQueue(SDL_DataQueue *queue)
+{
+ return queue ? queue->queued_bytes : 0;
+}
+
+void *
+SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len)
+{
+ SDL_DataQueuePacket *packet;
+
+ if (!queue) {
+ SDL_InvalidParamError("queue");
+ return NULL;
+ } else if (len == 0) {
+ SDL_InvalidParamError("len");
+ return NULL;
+ } else if (len > queue->packet_size) {
+ SDL_SetError("len is larger than packet size");
+ return NULL;
+ }
+
+ packet = queue->head;
+ if (packet) {
+ const size_t avail = queue->packet_size - packet->datalen;
+ if (len <= avail) { /* we can use the space at end of this packet. */
+ void *retval = packet->data + packet->datalen;
+ packet->datalen += len;
+ queue->queued_bytes += len;
+ return retval;
+ }
+ }
+
+ /* Need a fresh packet. */
+ packet = AllocateDataQueuePacket(queue);
+ if (!packet) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ packet->datalen = len;
+ queue->queued_bytes += len;
+ return packet->data;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/SDL_dataqueue.h b/src/3rdparty/SDL2/src/SDL_dataqueue.h
new file mode 100644
index 0000000..d44f58d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_dataqueue.h
@@ -0,0 +1,55 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_dataqueue_h_
+#define SDL_dataqueue_h_
+
+/* this is not (currently) a public API. But maybe it should be! */
+
+struct SDL_DataQueue;
+typedef struct SDL_DataQueue SDL_DataQueue;
+
+SDL_DataQueue *SDL_NewDataQueue(const size_t packetlen, const size_t initialslack);
+void SDL_FreeDataQueue(SDL_DataQueue *queue);
+void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack);
+int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t len);
+size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
+size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
+size_t SDL_CountDataQueue(SDL_DataQueue *queue);
+
+/* this sets a section of the data queue aside (possibly allocating memory for it)
+ as if it's been written to, but returns a pointer to that space. You may write
+ to this space until a read would consume it. Writes (and other calls to this
+ function) will safely append their data after this reserved space and can
+ be in flight at the same time. There is no thread safety.
+ If there isn't an existing block of memory that can contain the reserved
+ space, one will be allocated for it. You can not (currently) allocate
+ a space larger than the packetlen requested in SDL_NewDataQueue.
+ Returned buffer is uninitialized.
+ This lets you avoid an extra copy in some cases, but it's safer to use
+ SDL_WriteToDataQueue() unless you know what you're doing.
+ Returns pointer to buffer of at least (len) bytes, NULL on error.
+*/
+void *SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len);
+
+#endif /* SDL_dataqueue_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/SDL_error.c b/src/3rdparty/SDL2/src/SDL_error.c
new file mode 100644
index 0000000..14761c5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_error.c
@@ -0,0 +1,319 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "./SDL_internal.h"
+
+/* Simple error handling in SDL */
+
+#include "SDL_log.h"
+#include "SDL_error.h"
+#include "SDL_error_c.h"
+
+
+/* Routine to get the thread-specific error variable */
+#if SDL_THREADS_DISABLED
+/* The default (non-thread-safe) global error variable */
+static SDL_error SDL_global_error;
+#define SDL_GetErrBuf() (&SDL_global_error)
+#else
+extern SDL_error *SDL_GetErrBuf(void);
+#endif /* SDL_THREADS_DISABLED */
+
+#define SDL_ERRBUFIZE 1024
+
+/* Private functions */
+
+static const char *
+SDL_LookupString(const char *key)
+{
+ /* FIXME: Add code to lookup key in language string hash-table */
+ return key;
+}
+
+/* Public functions */
+
+static char *SDL_GetErrorMsg(char *errstr, int maxlen);
+
+int
+SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+ SDL_error *error;
+
+ /* Ignore call if invalid format pointer was passed */
+ if (fmt == NULL) return -1;
+
+ /* Copy in the key, mark error as valid */
+ error = SDL_GetErrBuf();
+ error->error = 1;
+ SDL_strlcpy((char *) error->key, fmt, sizeof(error->key));
+
+ va_start(ap, fmt);
+ error->argc = 0;
+ while (*fmt) {
+ if (*fmt++ == '%') {
+ while (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) {
+ ++fmt;
+ }
+ switch (*fmt++) {
+ case 0: /* Malformed format string.. */
+ --fmt;
+ break;
+ case 'l':
+ switch (*fmt++) {
+ case 0: /* Malformed format string.. */
+ --fmt;
+ break;
+ case 'i': case 'd': case 'u':
+ error->args[error->argc++].value_l = va_arg(ap, long);
+ break;
+ }
+ break;
+ case 'c':
+ case 'i':
+ case 'd':
+ case 'u':
+ case 'o':
+ case 'x':
+ case 'X':
+ error->args[error->argc++].value_i = va_arg(ap, int);
+ break;
+ case 'f':
+ error->args[error->argc++].value_f = va_arg(ap, double);
+ break;
+ case 'p':
+ error->args[error->argc++].value_ptr = va_arg(ap, void *);
+ break;
+ case 's':
+ {
+ int i = error->argc;
+ const char *str = va_arg(ap, const char *);
+ if (str == NULL)
+ str = "(null)";
+ SDL_strlcpy((char *) error->args[i].buf, str,
+ ERR_MAX_STRLEN);
+ error->argc++;
+ }
+ break;
+ default:
+ break;
+ }
+ if (error->argc >= ERR_MAX_ARGS) {
+ break;
+ }
+ }
+ }
+ va_end(ap);
+
+ if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
+ /* If we are in debug mode, print out an error message
+ * Avoid stomping on the static buffer in GetError, just
+ * in case this is called while processing a ShowMessageBox to
+ * show an error already in that static buffer.
+ */
+ char errmsg[SDL_ERRBUFIZE];
+ SDL_GetErrorMsg(errmsg, sizeof(errmsg));
+ SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg);
+ }
+ return -1;
+}
+
+/* Available for backwards compatibility */
+const char *
+SDL_GetError(void)
+{
+ static char errmsg[SDL_ERRBUFIZE];
+
+ return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
+}
+
+void
+SDL_ClearError(void)
+{
+ SDL_error *error;
+
+ error = SDL_GetErrBuf();
+ error->error = 0;
+}
+
+/* Very common errors go here */
+int
+SDL_Error(SDL_errorcode code)
+{
+ switch (code) {
+ case SDL_ENOMEM:
+ return SDL_SetError("Out of memory");
+ case SDL_EFREAD:
+ return SDL_SetError("Error reading from datastream");
+ case SDL_EFWRITE:
+ return SDL_SetError("Error writing to datastream");
+ case SDL_EFSEEK:
+ return SDL_SetError("Error seeking in datastream");
+ case SDL_UNSUPPORTED:
+ return SDL_SetError("That operation is not supported");
+ default:
+ return SDL_SetError("Unknown SDL error");
+ }
+}
+
+#ifdef TEST_ERROR
+int
+main(int argc, char *argv[])
+{
+ char buffer[BUFSIZ + 1];
+
+ SDL_SetError("Hi there!");
+ printf("Error 1: %s\n", SDL_GetError());
+ SDL_ClearError();
+ SDL_memset(buffer, '1', BUFSIZ);
+ buffer[BUFSIZ] = 0;
+ SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
+ printf("Error 2: %s\n", SDL_GetError());
+ exit(0);
+}
+#endif
+
+
+/* keep this at the end of the file so it works with GCC builds that don't
+ support "#pragma GCC diagnostic push" ... we'll just leave the warning
+ disabled after this. */
+/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2))))
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
+
+/* This function has a bit more overhead than most error functions
+ so that it supports internationalization and thread-safe errors.
+*/
+static char *
+SDL_GetErrorMsg(char *errstr, int maxlen)
+{
+ SDL_error *error;
+
+ /* Clear the error string */
+ *errstr = '\0';
+ --maxlen;
+
+ /* Get the thread-safe error, and print it out */
+ error = SDL_GetErrBuf();
+ if (error->error) {
+ const char *fmt;
+ char *msg = errstr;
+ int len;
+ int argi;
+
+ fmt = SDL_LookupString(error->key);
+ argi = 0;
+ while (*fmt && (maxlen > 0)) {
+ if (*fmt == '%') {
+ char tmp[32], *spot = tmp;
+ *spot++ = *fmt++;
+ while ((*fmt == '.' || (*fmt >= '0' && *fmt <= '9'))
+ && spot < (tmp + SDL_arraysize(tmp) - 2)) {
+ *spot++ = *fmt++;
+ }
+ if (*fmt == 'l') {
+ *spot++ = *fmt++;
+ *spot++ = *fmt++;
+ *spot++ = '\0';
+ switch (spot[-2]) {
+ case 'i': case 'd': case 'u':
+ len = SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_l);
+ if (len > 0) {
+ msg += len;
+ maxlen -= len;
+ }
+ break;
+ }
+ continue;
+ }
+ *spot++ = *fmt++;
+ *spot++ = '\0';
+ switch (spot[-2]) {
+ case '%':
+ *msg++ = '%';
+ maxlen -= 1;
+ break;
+ case 'c':
+ case 'i':
+ case 'd':
+ case 'u':
+ case 'o':
+ case 'x':
+ case 'X':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_i);
+ if (len > 0) {
+ msg += len;
+ maxlen -= len;
+ }
+ break;
+
+ case 'f':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_f);
+ if (len > 0) {
+ msg += len;
+ maxlen -= len;
+ }
+ break;
+
+ case 'p':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_ptr);
+ if (len > 0) {
+ msg += len;
+ maxlen -= len;
+ }
+ break;
+
+ case 's':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ SDL_LookupString(error->args[argi++].
+ buf));
+ if (len > 0) {
+ msg += len;
+ maxlen -= len;
+ }
+ break;
+
+ }
+ } else {
+ *msg++ = *fmt++;
+ maxlen -= 1;
+ }
+ }
+
+ /* slide back if we've overshot the end of our buffer. */
+ if (maxlen < 0) {
+ msg -= (-maxlen) + 1;
+ }
+
+ *msg = 0; /* NULL terminate the string */
+ }
+ return (errstr);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_error_c.h b/src/3rdparty/SDL2/src/SDL_error_c.h
new file mode 100644
index 0000000..6bb9caa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_error_c.h
@@ -0,0 +1,65 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "./SDL_internal.h"
+
+/* This file defines a structure that carries language-independent
+ error messages
+*/
+
+#ifndef SDL_error_c_h_
+#define SDL_error_c_h_
+
+#define ERR_MAX_STRLEN 128
+#define ERR_MAX_ARGS 5
+
+typedef struct SDL_error
+{
+ /* This is a numeric value corresponding to the current error */
+ int error;
+
+ /* This is a key used to index into a language hashtable containing
+ internationalized versions of the SDL error messages. If the key
+ is not in the hashtable, or no hashtable is available, the key is
+ used directly as an error message format string.
+ */
+ char key[ERR_MAX_STRLEN];
+
+ /* These are the arguments for the error functions */
+ int argc;
+ union
+ {
+ void *value_ptr;
+#if 0 /* What is a character anyway? (UNICODE issues) */
+ unsigned char value_c;
+#endif
+ int value_i;
+ long value_l;
+ double value_f;
+ char buf[ERR_MAX_STRLEN];
+ } args[ERR_MAX_ARGS];
+} SDL_error;
+
+/* Defined in SDL_thread.c */
+extern SDL_error *SDL_GetErrBuf(void);
+
+#endif /* SDL_error_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_hints.c b/src/3rdparty/SDL2/src/SDL_hints.c
new file mode 100644
index 0000000..09689aa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_hints.c
@@ -0,0 +1,236 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "./SDL_internal.h"
+
+#include "SDL_hints.h"
+#include "SDL_error.h"
+
+
+/* Assuming there aren't many hints set and they aren't being queried in
+ critical performance paths, we'll just use linked lists here.
+ */
+typedef struct SDL_HintWatch {
+ SDL_HintCallback callback;
+ void *userdata;
+ struct SDL_HintWatch *next;
+} SDL_HintWatch;
+
+typedef struct SDL_Hint {
+ char *name;
+ char *value;
+ SDL_HintPriority priority;
+ SDL_HintWatch *callbacks;
+ struct SDL_Hint *next;
+} SDL_Hint;
+
+static SDL_Hint *SDL_hints;
+
+SDL_bool
+SDL_SetHintWithPriority(const char *name, const char *value,
+ SDL_HintPriority priority)
+{
+ const char *env;
+ SDL_Hint *hint;
+ SDL_HintWatch *entry;
+
+ if (!name || !value) {
+ return SDL_FALSE;
+ }
+
+ env = SDL_getenv(name);
+ if (env && priority < SDL_HINT_OVERRIDE) {
+ return SDL_FALSE;
+ }
+
+ for (hint = SDL_hints; hint; hint = hint->next) {
+ if (SDL_strcmp(name, hint->name) == 0) {
+ if (priority < hint->priority) {
+ return SDL_FALSE;
+ }
+ if (!hint->value || !value || SDL_strcmp(hint->value, value) != 0) {
+ for (entry = hint->callbacks; entry; ) {
+ /* Save the next entry in case this one is deleted */
+ SDL_HintWatch *next = entry->next;
+ entry->callback(entry->userdata, name, hint->value, value);
+ entry = next;
+ }
+ SDL_free(hint->value);
+ hint->value = value ? SDL_strdup(value) : NULL;
+ }
+ hint->priority = priority;
+ return SDL_TRUE;
+ }
+ }
+
+ /* Couldn't find the hint, add a new one */
+ hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
+ if (!hint) {
+ return SDL_FALSE;
+ }
+ hint->name = SDL_strdup(name);
+ hint->value = value ? SDL_strdup(value) : NULL;
+ hint->priority = priority;
+ hint->callbacks = NULL;
+ hint->next = SDL_hints;
+ SDL_hints = hint;
+ return SDL_TRUE;
+}
+
+SDL_bool
+SDL_SetHint(const char *name, const char *value)
+{
+ return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL);
+}
+
+const char *
+SDL_GetHint(const char *name)
+{
+ const char *env;
+ SDL_Hint *hint;
+
+ env = SDL_getenv(name);
+ for (hint = SDL_hints; hint; hint = hint->next) {
+ if (SDL_strcmp(name, hint->name) == 0) {
+ if (!env || hint->priority == SDL_HINT_OVERRIDE) {
+ return hint->value;
+ }
+ break;
+ }
+ }
+ return env;
+}
+
+SDL_bool
+SDL_GetHintBoolean(const char *name, SDL_bool default_value)
+{
+ const char *hint = SDL_GetHint(name);
+ if (!hint || !*hint) {
+ return default_value;
+ }
+ if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+void
+SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
+{
+ SDL_Hint *hint;
+ SDL_HintWatch *entry;
+ const char *value;
+
+ if (!name || !*name) {
+ SDL_InvalidParamError("name");
+ return;
+ }
+ if (!callback) {
+ SDL_InvalidParamError("callback");
+ return;
+ }
+
+ SDL_DelHintCallback(name, callback, userdata);
+
+ entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry));
+ if (!entry) {
+ SDL_OutOfMemory();
+ return;
+ }
+ entry->callback = callback;
+ entry->userdata = userdata;
+
+ for (hint = SDL_hints; hint; hint = hint->next) {
+ if (SDL_strcmp(name, hint->name) == 0) {
+ break;
+ }
+ }
+ if (!hint) {
+ /* Need to add a hint entry for this watcher */
+ hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
+ if (!hint) {
+ SDL_OutOfMemory();
+ SDL_free(entry);
+ return;
+ }
+ hint->name = SDL_strdup(name);
+ hint->value = NULL;
+ hint->priority = SDL_HINT_DEFAULT;
+ hint->callbacks = NULL;
+ hint->next = SDL_hints;
+ SDL_hints = hint;
+ }
+
+ /* Add it to the callbacks for this hint */
+ entry->next = hint->callbacks;
+ hint->callbacks = entry;
+
+ /* Now call it with the current value */
+ value = SDL_GetHint(name);
+ callback(userdata, name, value, value);
+}
+
+void
+SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
+{
+ SDL_Hint *hint;
+ SDL_HintWatch *entry, *prev;
+
+ for (hint = SDL_hints; hint; hint = hint->next) {
+ if (SDL_strcmp(name, hint->name) == 0) {
+ prev = NULL;
+ for (entry = hint->callbacks; entry; entry = entry->next) {
+ if (callback == entry->callback && userdata == entry->userdata) {
+ if (prev) {
+ prev->next = entry->next;
+ } else {
+ hint->callbacks = entry->next;
+ }
+ SDL_free(entry);
+ break;
+ }
+ prev = entry;
+ }
+ return;
+ }
+ }
+}
+
+void SDL_ClearHints(void)
+{
+ SDL_Hint *hint;
+ SDL_HintWatch *entry;
+
+ while (SDL_hints) {
+ hint = SDL_hints;
+ SDL_hints = hint->next;
+
+ SDL_free(hint->name);
+ SDL_free(hint->value);
+ for (entry = hint->callbacks; entry; ) {
+ SDL_HintWatch *freeable = entry;
+ entry = entry->next;
+ SDL_free(freeable);
+ }
+ SDL_free(hint);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_internal.h b/src/3rdparty/SDL2/src/SDL_internal.h
new file mode 100644
index 0000000..e0ba2a8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_internal.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_internal_h_
+#define SDL_internal_h_
+
+/* Many of SDL's features require _GNU_SOURCE on various platforms */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+/* This is for a variable-length array at the end of a struct:
+ struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; };
+ Use this because GCC 2 needs different magic than other compilers. */
+#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus)
+#define SDL_VARIABLE_LENGTH_ARRAY 1
+#else
+#define SDL_VARIABLE_LENGTH_ARRAY
+#endif
+
+#include "dynapi/SDL_dynapi.h"
+
+#if SDL_DYNAMIC_API
+#include "dynapi/SDL_dynapi_overrides.h"
+/* force DECLSPEC and SDLCALL off...it's all internal symbols now.
+ These will have actual #defines during SDL_dynapi.c only */
+#define DECLSPEC
+#define SDLCALL
+#endif
+
+#include "SDL_config.h"
+
+#endif /* SDL_internal_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/SDL_log.c b/src/3rdparty/SDL2/src/SDL_log.c
new file mode 100644
index 0000000..b1bf27d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/SDL_log.c
@@ -0,0 +1,450 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "./SDL_internal.h"
+
+#if defined(__WIN32__) || defined(__WINRT__)
+#include "core/windows/SDL_windows.h"
+#endif
+
+/* Simple log messages in SDL */
+
+#include "SDL_error.h"
+#include "SDL_log.h"
+
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#if defined(__ANDROID__)
+#include <android/log.h>
+#endif
+
+#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL
+#define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN
+#define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO
+#define DEFAULT_TEST_PRIORITY SDL_LOG_PRIORITY_VERBOSE
+
+typedef struct SDL_LogLevel
+{
+ int category;
+ SDL_LogPriority priority;
+ struct SDL_LogLevel *next;
+} SDL_LogLevel;
+
+/* The default log output function */
+static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
+
+static SDL_LogLevel *SDL_loglevels;
+static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
+static SDL_LogPriority SDL_assert_priority = DEFAULT_ASSERT_PRIORITY;
+static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
+static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY;
+static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput;
+static void *SDL_log_userdata = NULL;
+
+static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = {
+ NULL,
+ "VERBOSE",
+ "DEBUG",
+ "INFO",
+ "WARN",
+ "ERROR",
+ "CRITICAL"
+};
+
+#ifdef __ANDROID__
+static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = {
+ "APP",
+ "ERROR",
+ "SYSTEM",
+ "AUDIO",
+ "VIDEO",
+ "RENDER",
+ "INPUT"
+};
+
+static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = {
+ ANDROID_LOG_UNKNOWN,
+ ANDROID_LOG_VERBOSE,
+ ANDROID_LOG_DEBUG,
+ ANDROID_LOG_INFO,
+ ANDROID_LOG_WARN,
+ ANDROID_LOG_ERROR,
+ ANDROID_LOG_FATAL
+};
+#endif /* __ANDROID__ */
+
+
+void
+SDL_LogSetAllPriority(SDL_LogPriority priority)
+{
+ SDL_LogLevel *entry;
+
+ for (entry = SDL_loglevels; entry; entry = entry->next) {
+ entry->priority = priority;
+ }
+ SDL_default_priority = priority;
+ SDL_assert_priority = priority;
+ SDL_application_priority = priority;
+}
+
+void
+SDL_LogSetPriority(int category, SDL_LogPriority priority)
+{
+ SDL_LogLevel *entry;
+
+ for (entry = SDL_loglevels; entry; entry = entry->next) {
+ if (entry->category == category) {
+ entry->priority = priority;
+ return;
+ }
+ }
+
+ /* Create a new entry */
+ entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry));
+ if (entry) {
+ entry->category = category;
+ entry->priority = priority;
+ entry->next = SDL_loglevels;
+ SDL_loglevels = entry;
+ }
+}
+
+SDL_LogPriority
+SDL_LogGetPriority(int category)
+{
+ SDL_LogLevel *entry;
+
+ for (entry = SDL_loglevels; entry; entry = entry->next) {
+ if (entry->category == category) {
+ return entry->priority;
+ }
+ }
+
+ if (category == SDL_LOG_CATEGORY_TEST) {
+ return SDL_test_priority;
+ } else if (category == SDL_LOG_CATEGORY_APPLICATION) {
+ return SDL_application_priority;
+ } else if (category == SDL_LOG_CATEGORY_ASSERT) {
+ return SDL_assert_priority;
+ } else {
+ return SDL_default_priority;
+ }
+}
+
+void
+SDL_LogResetPriorities(void)
+{
+ SDL_LogLevel *entry;
+
+ while (SDL_loglevels) {
+ entry = SDL_loglevels;
+ SDL_loglevels = entry->next;
+ SDL_free(entry);
+ }
+
+ SDL_default_priority = DEFAULT_PRIORITY;
+ SDL_assert_priority = DEFAULT_ASSERT_PRIORITY;
+ SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
+ SDL_test_priority = DEFAULT_TEST_PRIORITY;
+}
+
+void
+SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, SDL_LOG_PRIORITY_DEBUG, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap);
+ va_end(ap);
+}
+
+void
+SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ SDL_LogMessageV(category, priority, fmt, ap);
+ va_end(ap);
+}
+
+#ifdef __ANDROID__
+static const char *
+GetCategoryPrefix(int category)
+{
+ if (category < SDL_LOG_CATEGORY_RESERVED1) {
+ return SDL_category_prefixes[category];
+ }
+ if (category < SDL_LOG_CATEGORY_CUSTOM) {
+ return "RESERVED";
+ }
+ return "CUSTOM";
+}
+#endif /* __ANDROID__ */
+
+void
+SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap)
+{
+ char *message;
+ size_t len;
+
+ /* Nothing to do if we don't have an output function */
+ if (!SDL_log_function) {
+ return;
+ }
+
+ /* Make sure we don't exceed array bounds */
+ if ((int)priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) {
+ return;
+ }
+
+ /* See if we want to do anything with this message */
+ if (priority < SDL_LogGetPriority(category)) {
+ return;
+ }
+
+ message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
+ if (!message) {
+ return;
+ }
+
+ SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap);
+
+ /* Chop off final endline. */
+ len = SDL_strlen(message);
+ if ((len > 0) && (message[len-1] == '\n')) {
+ message[--len] = '\0';
+ if ((len > 0) && (message[len-1] == '\r')) { /* catch "\r\n", too. */
+ message[--len] = '\0';
+ }
+ }
+
+ SDL_log_function(SDL_log_userdata, category, priority, message);
+ SDL_stack_free(message);
+}
+
+#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__)
+/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */
+static int consoleAttached = 0;
+
+/* Handle to stderr output of console. */
+static HANDLE stderrHandle = NULL;
+#endif
+
+static void SDLCALL
+SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
+ const char *message)
+{
+#if defined(__WIN32__) || defined(__WINRT__)
+ /* Way too many allocations here, urgh */
+ /* Note: One can't call SDL_SetError here, since that function itself logs. */
+ {
+ char *output;
+ size_t length;
+ LPTSTR tstr;
+
+#if !defined(HAVE_STDIO_H) && !defined(__WINRT__)
+ BOOL attachResult;
+ DWORD attachError;
+ unsigned long charsWritten;
+ DWORD consoleMode;
+
+ /* Maybe attach console and get stderr handle */
+ if (consoleAttached == 0) {
+ attachResult = AttachConsole(ATTACH_PARENT_PROCESS);
+ if (!attachResult) {
+ attachError = GetLastError();
+ if (attachError == ERROR_INVALID_HANDLE) {
+ /* This is expected when running from Visual Studio */
+ /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/
+ consoleAttached = -1;
+ } else if (attachError == ERROR_GEN_FAILURE) {
+ OutputDebugString(TEXT("Could not attach to console of parent process\r\n"));
+ consoleAttached = -1;
+ } else if (attachError == ERROR_ACCESS_DENIED) {
+ /* Already attached */
+ consoleAttached = 1;
+ } else {
+ OutputDebugString(TEXT("Error attaching console\r\n"));
+ consoleAttached = -1;
+ }
+ } else {
+ /* Newly attached */
+ consoleAttached = 1;
+ }
+
+ if (consoleAttached == 1) {
+ stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
+
+ if (GetConsoleMode(stderrHandle, &consoleMode) == 0) {
+ /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */
+ consoleAttached = 2;
+ }
+ }
+ }
+#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
+
+ length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
+ output = SDL_stack_alloc(char, length);
+ SDL_snprintf(output, length, "%s: %s\r\n", SDL_priority_prefixes[priority], message);
+ tstr = WIN_UTF8ToString(output);
+
+ /* Output to debugger */
+ OutputDebugString(tstr);
+
+#if !defined(HAVE_STDIO_H) && !defined(__WINRT__)
+ /* Screen output to stderr, if console was attached. */
+ if (consoleAttached == 1) {
+ if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
+ OutputDebugString(TEXT("Error calling WriteConsole\r\n"));
+ if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
+ OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
+ }
+ }
+
+ } else if (consoleAttached == 2) {
+ if (!WriteFile(stderrHandle, output, lstrlenA(output), &charsWritten, NULL)) {
+ OutputDebugString(TEXT("Error calling WriteFile\r\n"));
+ }
+ }
+#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
+
+ SDL_free(tstr);
+ SDL_stack_free(output);
+ }
+#elif defined(__ANDROID__)
+ {
+ char tag[32];
+
+ SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
+ __android_log_write(SDL_android_priority[priority], tag, message);
+ }
+#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
+ /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
+ */
+ extern void SDL_NSLog(const char *text);
+ {
+ char *text;
+
+ text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
+ if (text) {
+ SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message);
+ SDL_NSLog(text);
+ SDL_stack_free(text);
+ return;
+ }
+ }
+#elif defined(__PSP__)
+ {
+ FILE* pFile;
+ pFile = fopen ("SDL_Log.txt", "a");
+ fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message);
+ fclose (pFile);
+ }
+#endif
+#if HAVE_STDIO_H
+ fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
+#if __NACL__
+ fflush(stderr);
+#endif
+#endif
+}
+
+void
+SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
+{
+ if (callback) {
+ *callback = SDL_log_function;
+ }
+ if (userdata) {
+ *userdata = SDL_log_userdata;
+ }
+}
+
+void
+SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata)
+{
+ SDL_log_function = callback;
+ SDL_log_userdata = userdata;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/atomic/SDL_atomic.c b/src/3rdparty/SDL2/src/atomic/SDL_atomic.c
new file mode 100644
index 0000000..df49201
--- /dev/null
+++ b/src/3rdparty/SDL2/src/atomic/SDL_atomic.c
@@ -0,0 +1,303 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_atomic.h"
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1500)
+#include <intrin.h>
+#define HAVE_MSC_ATOMICS 1
+#endif
+
+#if defined(__MACOSX__) /* !!! FIXME: should we favor gcc atomics? */
+#include <libkern/OSAtomic.h>
+#endif
+
+#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
+#include <atomic.h>
+#endif
+
+/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */
+#if defined(HAVE_GCC_ATOMICS)
+# if defined(__clang__)
+# if __has_builtin(__atomic_load_n)
+ /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have.
+ It might be in a later NDK or we might need an extra library? --ryan. */
+# if !defined(__ANDROID__)
+# define HAVE_ATOMIC_LOAD_N 1
+# endif
+# endif
+# elif defined(__GNUC__)
+# if (__GNUC__ >= 5)
+# define HAVE_ATOMIC_LOAD_N 1
+# endif
+# endif
+#endif
+
+#if defined(__WATCOMC__) && defined(__386__)
+#define HAVE_WATCOM_ATOMICS
+extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
+#pragma aux _SDL_xchg_watcom = \
+ "xchg [ecx], eax" \
+ parm [ecx] [eax] \
+ value [eax] \
+ modify exact [eax];
+
+extern _inline unsigned char _SDL_cmpxchg_watcom(volatile int *a, int newval, int oldval);
+#pragma aux _SDL_cmpxchg_watcom = \
+ "lock cmpxchg [edx], ecx" \
+ "setz al" \
+ parm [edx] [ecx] [eax] \
+ value [al] \
+ modify exact [eax];
+
+extern _inline int _SDL_xadd_watcom(volatile int *a, int v);
+#pragma aux _SDL_xadd_watcom = \
+ "lock xadd [ecx], eax" \
+ parm [ecx] [eax] \
+ value [eax] \
+ modify exact [eax];
+#endif /* __WATCOMC__ && __386__ */
+
+/*
+ If any of the operations are not provided then we must emulate some
+ of them. That means we need a nice implementation of spin locks
+ that avoids the "one big lock" problem. We use a vector of spin
+ locks and pick which one to use based on the address of the operand
+ of the function.
+
+ To generate the index of the lock we first shift by 3 bits to get
+ rid on the zero bits that result from 32 and 64 bit allignment of
+ data. We then mask off all but 5 bits and use those 5 bits as an
+ index into the table.
+
+ Picking the lock this way insures that accesses to the same data at
+ the same time will go to the same lock. OTOH, accesses to different
+ data have only a 1/32 chance of hitting the same lock. That should
+ pretty much eliminate the chances of several atomic operations on
+ different data from waiting on the same "big lock". If it isn't
+ then the table of locks can be expanded to a new size so long as
+ the new size is a power of two.
+
+ Contributed by Bob Pendleton, bob@pendleton.com
+*/
+
+#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS)
+#define EMULATE_CAS 1
+#endif
+
+#if EMULATE_CAS
+static SDL_SpinLock locks[32];
+
+static SDL_INLINE void
+enterLock(void *a)
+{
+ uintptr_t index = ((((uintptr_t)a) >> 3) & 0x1f);
+
+ SDL_AtomicLock(&locks[index]);
+}
+
+static SDL_INLINE void
+leaveLock(void *a)
+{
+ uintptr_t index = ((((uintptr_t)a) >> 3) & 0x1f);
+
+ SDL_AtomicUnlock(&locks[index]);
+}
+#endif
+
+
+SDL_bool
+SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
+{
+#ifdef HAVE_MSC_ATOMICS
+ return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval);
+#elif defined(HAVE_WATCOM_ATOMICS)
+ return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval);
+#elif defined(HAVE_GCC_ATOMICS)
+ return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
+#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+ return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
+#elif defined(__SOLARIS__) && defined(_LP64)
+ return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval);
+#elif defined(__SOLARIS__) && !defined(_LP64)
+ return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)&a->value, (uint32_t)oldval, (uint32_t)newval) == oldval);
+#elif EMULATE_CAS
+ SDL_bool retval = SDL_FALSE;
+
+ enterLock(a);
+ if (a->value == oldval) {
+ a->value = newval;
+ retval = SDL_TRUE;
+ }
+ leaveLock(a);
+
+ return retval;
+#else
+ #error Please define your platform.
+#endif
+}
+
+SDL_bool
+SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
+{
+#if defined(HAVE_MSC_ATOMICS) && (_M_IX86)
+ return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval);
+#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
+ return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval);
+#elif defined(HAVE_WATCOM_ATOMICS)
+ return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
+#elif defined(HAVE_GCC_ATOMICS)
+ return __sync_bool_compare_and_swap(a, oldval, newval);
+#elif defined(__MACOSX__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+ return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a);
+#elif defined(__MACOSX__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+ return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
+#elif defined(__SOLARIS__)
+ return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval);
+#elif EMULATE_CAS
+ SDL_bool retval = SDL_FALSE;
+
+ enterLock(a);
+ if (*a == oldval) {
+ *a = newval;
+ retval = SDL_TRUE;
+ }
+ leaveLock(a);
+
+ return retval;
+#else
+ #error Please define your platform.
+#endif
+}
+
+int
+SDL_AtomicSet(SDL_atomic_t *a, int v)
+{
+#ifdef HAVE_MSC_ATOMICS
+ return _InterlockedExchange((long*)&a->value, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+ return _SDL_xchg_watcom(&a->value, v);
+#elif defined(HAVE_GCC_ATOMICS)
+ return __sync_lock_test_and_set(&a->value, v);
+#elif defined(__SOLARIS__) && defined(_LP64)
+ return (int) atomic_swap_64((volatile uint64_t*)&a->value, (uint64_t)v);
+#elif defined(__SOLARIS__) && !defined(_LP64)
+ return (int) atomic_swap_32((volatile uint32_t*)&a->value, (uint32_t)v);
+#else
+ int value;
+ do {
+ value = a->value;
+ } while (!SDL_AtomicCAS(a, value, v));
+ return value;
+#endif
+}
+
+void*
+SDL_AtomicSetPtr(void **a, void *v)
+{
+#if defined(HAVE_MSC_ATOMICS) && (_M_IX86)
+ return (void *) _InterlockedExchange((long *)a, (long) v);
+#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
+ return _InterlockedExchangePointer(a, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+ return (void *) _SDL_xchg_watcom((int *)a, (long)v);
+#elif defined(HAVE_GCC_ATOMICS)
+ return __sync_lock_test_and_set(a, v);
+#elif defined(__SOLARIS__)
+ return atomic_swap_ptr(a, v);
+#else
+ void *value;
+ do {
+ value = *a;
+ } while (!SDL_AtomicCASPtr(a, value, v));
+ return value;
+#endif
+}
+
+int
+SDL_AtomicAdd(SDL_atomic_t *a, int v)
+{
+#ifdef HAVE_MSC_ATOMICS
+ return _InterlockedExchangeAdd((long*)&a->value, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+ return _SDL_xadd_watcom(&a->value, v);
+#elif defined(HAVE_GCC_ATOMICS)
+ return __sync_fetch_and_add(&a->value, v);
+#elif defined(__SOLARIS__)
+ int pv = a->value;
+ membar_consumer();
+#if defined(_LP64)
+ atomic_add_64((volatile uint64_t*)&a->value, v);
+#elif !defined(_LP64)
+ atomic_add_32((volatile uint32_t*)&a->value, v);
+#endif
+ return pv;
+#else
+ int value;
+ do {
+ value = a->value;
+ } while (!SDL_AtomicCAS(a, value, (value + v)));
+ return value;
+#endif
+}
+
+int
+SDL_AtomicGet(SDL_atomic_t *a)
+{
+#ifdef HAVE_ATOMIC_LOAD_N
+ return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST);
+#else
+ int value;
+ do {
+ value = a->value;
+ } while (!SDL_AtomicCAS(a, value, value));
+ return value;
+#endif
+}
+
+void *
+SDL_AtomicGetPtr(void **a)
+{
+#ifdef HAVE_ATOMIC_LOAD_N
+ return __atomic_load_n(a, __ATOMIC_SEQ_CST);
+#else
+ void *value;
+ do {
+ value = *a;
+ } while (!SDL_AtomicCASPtr(a, value, value));
+ return value;
+#endif
+}
+
+void
+SDL_MemoryBarrierReleaseFunction(void)
+{
+ SDL_MemoryBarrierRelease();
+}
+
+void
+SDL_MemoryBarrierAcquireFunction(void)
+{
+ SDL_MemoryBarrierAcquire();
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/atomic/SDL_spinlock.c b/src/3rdparty/SDL2/src/atomic/SDL_spinlock.c
new file mode 100644
index 0000000..1ebc718
--- /dev/null
+++ b/src/3rdparty/SDL2/src/atomic/SDL_spinlock.c
@@ -0,0 +1,152 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#if defined(__WIN32__) || defined(__WINRT__)
+#include "../core/windows/SDL_windows.h"
+#endif
+
+#include "SDL_atomic.h"
+#include "SDL_mutex.h"
+#include "SDL_timer.h"
+
+#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
+#include <atomic.h>
+#endif
+
+#if defined(__WATCOMC__) && defined(__386__)
+SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock));
+extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
+#pragma aux _SDL_xchg_watcom = \
+ "xchg [ecx], eax" \
+ parm [ecx] [eax] \
+ value [eax] \
+ modify exact [eax];
+#endif /* __WATCOMC__ && __386__ */
+
+/* This function is where all the magic happens... */
+SDL_bool
+SDL_AtomicTryLock(SDL_SpinLock *lock)
+{
+#if SDL_ATOMIC_DISABLED
+ /* Terrible terrible damage */
+ static SDL_mutex *_spinlock_mutex;
+
+ if (!_spinlock_mutex) {
+ /* Race condition on first lock... */
+ _spinlock_mutex = SDL_CreateMutex();
+ }
+ SDL_LockMutex(_spinlock_mutex);
+ if (*lock == 0) {
+ *lock = 1;
+ SDL_UnlockMutex(_spinlock_mutex);
+ return SDL_TRUE;
+ } else {
+ SDL_UnlockMutex(_spinlock_mutex);
+ return SDL_FALSE;
+ }
+
+#elif defined(_MSC_VER)
+ SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
+ return (InterlockedExchange((long*)lock, 1) == 0);
+
+#elif defined(__WATCOMC__) && defined(__386__)
+ return _SDL_xchg_watcom(lock, 1) == 0;
+
+#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
+ return (__sync_lock_test_and_set(lock, 1) == 0);
+
+#elif defined(__GNUC__) && defined(__arm__) && \
+ (defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
+ defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
+ defined(__ARM_ARCH_5TEJ__))
+ int result;
+ __asm__ __volatile__ (
+ "swp %0, %1, [%2]\n"
+ : "=&r,&r" (result) : "r,0" (1), "r,r" (lock) : "memory");
+ return (result == 0);
+
+#elif defined(__GNUC__) && defined(__arm__)
+ int result;
+ __asm__ __volatile__ (
+ "ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
+ : "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
+ return (result == 0);
+
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+ int result;
+ __asm__ __volatile__(
+ "lock ; xchgl %0, (%1)\n"
+ : "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
+ return (result == 0);
+
+#elif defined(__MACOSX__) || defined(__IPHONEOS__)
+ /* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
+ return OSAtomicCompareAndSwap32Barrier(0, 1, lock);
+
+#elif defined(__SOLARIS__) && defined(_LP64)
+ /* Used for Solaris with non-gcc compilers. */
+ return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)lock, 0, 1) == 0);
+
+#elif defined(__SOLARIS__) && !defined(_LP64)
+ /* Used for Solaris with non-gcc compilers. */
+ return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)lock, 0, 1) == 0);
+
+#else
+#error Please implement for your platform.
+ return SDL_FALSE;
+#endif
+}
+
+void
+SDL_AtomicLock(SDL_SpinLock *lock)
+{
+ /* FIXME: Should we have an eventual timeout? */
+ while (!SDL_AtomicTryLock(lock)) {
+ SDL_Delay(0);
+ }
+}
+
+void
+SDL_AtomicUnlock(SDL_SpinLock *lock)
+{
+#if defined(_MSC_VER)
+ _ReadWriteBarrier();
+ *lock = 0;
+
+#elif defined(__WATCOMC__) && defined(__386__)
+ SDL_CompilerBarrier ();
+ *lock = 0;
+
+#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
+ __sync_lock_release(lock);
+
+#elif defined(__SOLARIS__)
+ /* Used for Solaris when not using gcc. */
+ *lock = 0;
+ membar_producer();
+
+#else
+ *lock = 0;
+#endif
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_audio.c b/src/3rdparty/SDL2/src/audio/SDL_audio.c
new file mode 100644
index 0000000..dcaebea
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_audio.c
@@ -0,0 +1,1635 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Allow access to a raw mixing buffer */
+
+#include "SDL.h"
+#include "SDL_audio.h"
+#include "SDL_audio_c.h"
+#include "SDL_sysaudio.h"
+#include "../thread/SDL_systhread.h"
+
+#define _THIS SDL_AudioDevice *_this
+
+static SDL_AudioDriver current_audio;
+static SDL_AudioDevice *open_devices[16];
+
+/* Available audio drivers */
+static const AudioBootStrap *const bootstrap[] = {
+#if SDL_AUDIO_DRIVER_PULSEAUDIO
+ &PULSEAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_ALSA
+ &ALSA_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_SNDIO
+ &SNDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_NETBSD
+ &NETBSDAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_OSS
+ &DSP_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_QSA
+ &QSAAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_SUNAUDIO
+ &SUNAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_ARTS
+ &ARTS_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_ESD
+ &ESD_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_NACL
+ &NACLAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_NAS
+ &NAS_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_WASAPI
+ &WASAPI_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_DSOUND
+ &DSOUND_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_WINMM
+ &WINMM_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_PAUDIO
+ &PAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_HAIKU
+ &HAIKUAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_COREAUDIO
+ &COREAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_FUSIONSOUND
+ &FUSIONSOUND_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_ANDROID
+ &ANDROIDAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_PSP
+ &PSPAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_EMSCRIPTEN
+ &EMSCRIPTENAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_JACK
+ &JACK_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_DISK
+ &DISKAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_DUMMY
+ &DUMMYAUDIO_bootstrap,
+#endif
+ NULL
+};
+
+
+#ifdef HAVE_LIBSAMPLERATE_H
+#ifdef SDL_LIBSAMPLERATE_DYNAMIC
+static void *SRC_lib = NULL;
+#endif
+SDL_bool SRC_available = SDL_FALSE;
+int SRC_converter = 0;
+SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error) = NULL;
+int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL;
+int (*SRC_src_reset)(SRC_STATE *state) = NULL;
+SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL;
+const char* (*SRC_src_strerror)(int error) = NULL;
+
+static SDL_bool
+LoadLibSampleRate(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_AUDIO_RESAMPLING_MODE);
+
+ SRC_available = SDL_FALSE;
+ SRC_converter = 0;
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "default") == 0) {
+ return SDL_FALSE; /* don't load anything. */
+ } else if (*hint == '1' || SDL_strcasecmp(hint, "fast") == 0) {
+ SRC_converter = SRC_SINC_FASTEST;
+ } else if (*hint == '2' || SDL_strcasecmp(hint, "medium") == 0) {
+ SRC_converter = SRC_SINC_MEDIUM_QUALITY;
+ } else if (*hint == '3' || SDL_strcasecmp(hint, "best") == 0) {
+ SRC_converter = SRC_SINC_BEST_QUALITY;
+ } else {
+ return SDL_FALSE; /* treat it like "default", don't load anything. */
+ }
+
+#ifdef SDL_LIBSAMPLERATE_DYNAMIC
+ SDL_assert(SRC_lib == NULL);
+ SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC);
+ if (!SRC_lib) {
+ SDL_ClearError();
+ return SDL_FALSE;
+ }
+
+ SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new");
+ SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process");
+ SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset");
+ SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete");
+ SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror");
+
+ if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) {
+ SDL_UnloadObject(SRC_lib);
+ SRC_lib = NULL;
+ return SDL_FALSE;
+ }
+#else
+ SRC_src_new = src_new;
+ SRC_src_process = src_process;
+ SRC_src_reset = src_reset;
+ SRC_src_delete = src_delete;
+ SRC_src_strerror = src_strerror;
+#endif
+
+ SRC_available = SDL_TRUE;
+ return SDL_TRUE;
+}
+
+static void
+UnloadLibSampleRate(void)
+{
+#ifdef SDL_LIBSAMPLERATE_DYNAMIC
+ if (SRC_lib != NULL) {
+ SDL_UnloadObject(SRC_lib);
+ }
+ SRC_lib = NULL;
+#endif
+
+ SRC_available = SDL_FALSE;
+ SRC_src_new = NULL;
+ SRC_src_process = NULL;
+ SRC_src_reset = NULL;
+ SRC_src_delete = NULL;
+ SRC_src_strerror = NULL;
+}
+#endif
+
+static SDL_AudioDevice *
+get_audio_device(SDL_AudioDeviceID id)
+{
+ id--;
+ if ((id >= SDL_arraysize(open_devices)) || (open_devices[id] == NULL)) {
+ SDL_SetError("Invalid audio device ID");
+ return NULL;
+ }
+
+ return open_devices[id];
+}
+
+
+/* stubs for audio drivers that don't need a specific entry point... */
+static void
+SDL_AudioDetectDevices_Default(void)
+{
+ /* you have to write your own implementation if these assertions fail. */
+ SDL_assert(current_audio.impl.OnlyHasDefaultOutputDevice);
+ SDL_assert(current_audio.impl.OnlyHasDefaultCaptureDevice || !current_audio.impl.HasCaptureSupport);
+
+ SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) ((size_t) 0x1));
+ if (current_audio.impl.HasCaptureSupport) {
+ SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, (void *) ((size_t) 0x2));
+ }
+}
+
+static void
+SDL_AudioThreadInit_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioThreadDeinit_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioBeginLoopIteration_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioWaitDevice_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioPlayDevice_Default(_THIS)
+{ /* no-op. */
+}
+
+static int
+SDL_AudioGetPendingBytes_Default(_THIS)
+{
+ return 0;
+}
+
+static Uint8 *
+SDL_AudioGetDeviceBuf_Default(_THIS)
+{
+ return NULL;
+}
+
+static int
+SDL_AudioCaptureFromDevice_Default(_THIS, void *buffer, int buflen)
+{
+ return -1; /* just fail immediately. */
+}
+
+static void
+SDL_AudioFlushCapture_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioPrepareToClose_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioCloseDevice_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioDeinitialize_Default(void)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioFreeDeviceHandle_Default(void *handle)
+{ /* no-op. */
+}
+
+
+static int
+SDL_AudioOpenDevice_Default(_THIS, void *handle, const char *devname, int iscapture)
+{
+ return SDL_Unsupported();
+}
+
+static SDL_INLINE SDL_bool
+is_in_audio_device_thread(SDL_AudioDevice * device)
+{
+ /* The device thread locks the same mutex, but not through the public API.
+ This check is in case the application, in the audio callback,
+ tries to lock the thread that we've already locked from the
+ device thread...just in case we only have non-recursive mutexes. */
+ if (device->thread && (SDL_ThreadID() == device->threadid)) {
+ return SDL_TRUE;
+ }
+
+ return SDL_FALSE;
+}
+
+static void
+SDL_AudioLockDevice_Default(SDL_AudioDevice * device)
+{
+ if (!is_in_audio_device_thread(device)) {
+ SDL_LockMutex(device->mixer_lock);
+ }
+}
+
+static void
+SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
+{
+ if (!is_in_audio_device_thread(device)) {
+ SDL_UnlockMutex(device->mixer_lock);
+ }
+}
+
+static void
+SDL_AudioLockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
+{
+}
+
+static void
+finish_audio_entry_points_init(void)
+{
+ /*
+ * Fill in stub functions for unused driver entry points. This lets us
+ * blindly call them without having to check for validity first.
+ */
+
+ if (current_audio.impl.SkipMixerLock) {
+ if (current_audio.impl.LockDevice == NULL) {
+ current_audio.impl.LockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock;
+ }
+ if (current_audio.impl.UnlockDevice == NULL) {
+ current_audio.impl.UnlockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock;
+ }
+ }
+
+#define FILL_STUB(x) \
+ if (current_audio.impl.x == NULL) { \
+ current_audio.impl.x = SDL_Audio##x##_Default; \
+ }
+ FILL_STUB(DetectDevices);
+ FILL_STUB(OpenDevice);
+ FILL_STUB(ThreadInit);
+ FILL_STUB(ThreadDeinit);
+ FILL_STUB(BeginLoopIteration);
+ FILL_STUB(WaitDevice);
+ FILL_STUB(PlayDevice);
+ FILL_STUB(GetPendingBytes);
+ FILL_STUB(GetDeviceBuf);
+ FILL_STUB(CaptureFromDevice);
+ FILL_STUB(FlushCapture);
+ FILL_STUB(PrepareToClose);
+ FILL_STUB(CloseDevice);
+ FILL_STUB(LockDevice);
+ FILL_STUB(UnlockDevice);
+ FILL_STUB(FreeDeviceHandle);
+ FILL_STUB(Deinitialize);
+#undef FILL_STUB
+}
+
+
+/* device hotplug support... */
+
+static int
+add_audio_device(const char *name, void *handle, SDL_AudioDeviceItem **devices, int *devCount)
+{
+ int retval = -1;
+ const size_t size = sizeof (SDL_AudioDeviceItem) + SDL_strlen(name) + 1;
+ SDL_AudioDeviceItem *item = (SDL_AudioDeviceItem *) SDL_malloc(size);
+ if (item == NULL) {
+ return -1;
+ }
+
+ SDL_assert(handle != NULL); /* we reserve NULL, audio backends can't use it. */
+
+ item->handle = handle;
+ SDL_strlcpy(item->name, name, size - sizeof (SDL_AudioDeviceItem));
+
+ SDL_LockMutex(current_audio.detectionLock);
+ item->next = *devices;
+ *devices = item;
+ retval = (*devCount)++;
+ SDL_UnlockMutex(current_audio.detectionLock);
+
+ return retval;
+}
+
+static SDL_INLINE int
+add_capture_device(const char *name, void *handle)
+{
+ SDL_assert(current_audio.impl.HasCaptureSupport);
+ return add_audio_device(name, handle, &current_audio.inputDevices, &current_audio.inputDeviceCount);
+}
+
+static SDL_INLINE int
+add_output_device(const char *name, void *handle)
+{
+ return add_audio_device(name, handle, &current_audio.outputDevices, &current_audio.outputDeviceCount);
+}
+
+static void
+free_device_list(SDL_AudioDeviceItem **devices, int *devCount)
+{
+ SDL_AudioDeviceItem *item, *next;
+ for (item = *devices; item != NULL; item = next) {
+ next = item->next;
+ if (item->handle != NULL) {
+ current_audio.impl.FreeDeviceHandle(item->handle);
+ }
+ SDL_free(item);
+ }
+ *devices = NULL;
+ *devCount = 0;
+}
+
+
+/* The audio backends call this when a new device is plugged in. */
+void
+SDL_AddAudioDevice(const int iscapture, const char *name, void *handle)
+{
+ const int device_index = iscapture ? add_capture_device(name, handle) : add_output_device(name, handle);
+ if (device_index != -1) {
+ /* Post the event, if desired */
+ if (SDL_GetEventState(SDL_AUDIODEVICEADDED) == SDL_ENABLE) {
+ SDL_Event event;
+ SDL_zero(event);
+ event.adevice.type = SDL_AUDIODEVICEADDED;
+ event.adevice.which = device_index;
+ event.adevice.iscapture = iscapture;
+ SDL_PushEvent(&event);
+ }
+ }
+}
+
+/* The audio backends call this when a currently-opened device is lost. */
+void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device)
+{
+ SDL_assert(get_audio_device(device->id) == device);
+
+ if (!SDL_AtomicGet(&device->enabled)) {
+ return;
+ }
+
+ /* Ends the audio callback and mark the device as STOPPED, but the
+ app still needs to close the device to free resources. */
+ current_audio.impl.LockDevice(device);
+ SDL_AtomicSet(&device->enabled, 0);
+ current_audio.impl.UnlockDevice(device);
+
+ /* Post the event, if desired */
+ if (SDL_GetEventState(SDL_AUDIODEVICEREMOVED) == SDL_ENABLE) {
+ SDL_Event event;
+ SDL_zero(event);
+ event.adevice.type = SDL_AUDIODEVICEREMOVED;
+ event.adevice.which = device->id;
+ event.adevice.iscapture = device->iscapture ? 1 : 0;
+ SDL_PushEvent(&event);
+ }
+}
+
+static void
+mark_device_removed(void *handle, SDL_AudioDeviceItem *devices, SDL_bool *removedFlag)
+{
+ SDL_AudioDeviceItem *item;
+ SDL_assert(handle != NULL);
+ for (item = devices; item != NULL; item = item->next) {
+ if (item->handle == handle) {
+ item->handle = NULL;
+ *removedFlag = SDL_TRUE;
+ return;
+ }
+ }
+}
+
+/* The audio backends call this when a device is removed from the system. */
+void
+SDL_RemoveAudioDevice(const int iscapture, void *handle)
+{
+ int device_index;
+ SDL_AudioDevice *device = NULL;
+
+ SDL_LockMutex(current_audio.detectionLock);
+ if (iscapture) {
+ mark_device_removed(handle, current_audio.inputDevices, &current_audio.captureDevicesRemoved);
+ } else {
+ mark_device_removed(handle, current_audio.outputDevices, &current_audio.outputDevicesRemoved);
+ }
+ for (device_index = 0; device_index < SDL_arraysize(open_devices); device_index++)
+ {
+ device = open_devices[device_index];
+ if (device != NULL && device->handle == handle)
+ {
+ SDL_OpenedAudioDeviceDisconnected(device);
+ break;
+ }
+ }
+ SDL_UnlockMutex(current_audio.detectionLock);
+
+ current_audio.impl.FreeDeviceHandle(handle);
+}
+
+
+
+/* buffer queueing support... */
+
+static void SDLCALL
+SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len)
+{
+ /* this function always holds the mixer lock before being called. */
+ SDL_AudioDevice *device = (SDL_AudioDevice *) userdata;
+ size_t dequeued;
+
+ SDL_assert(device != NULL); /* this shouldn't ever happen, right?! */
+ SDL_assert(!device->iscapture); /* this shouldn't ever happen, right?! */
+ SDL_assert(len >= 0); /* this shouldn't ever happen, right?! */
+
+ dequeued = SDL_ReadFromDataQueue(device->buffer_queue, stream, len);
+ stream += dequeued;
+ len -= (int) dequeued;
+
+ if (len > 0) { /* fill any remaining space in the stream with silence. */
+ SDL_assert(SDL_CountDataQueue(device->buffer_queue) == 0);
+ SDL_memset(stream, device->spec.silence, len);
+ }
+}
+
+static void SDLCALL
+SDL_BufferQueueFillCallback(void *userdata, Uint8 *stream, int len)
+{
+ /* this function always holds the mixer lock before being called. */
+ SDL_AudioDevice *device = (SDL_AudioDevice *) userdata;
+
+ SDL_assert(device != NULL); /* this shouldn't ever happen, right?! */
+ SDL_assert(device->iscapture); /* this shouldn't ever happen, right?! */
+ SDL_assert(len >= 0); /* this shouldn't ever happen, right?! */
+
+ /* note that if this needs to allocate more space and run out of memory,
+ we have no choice but to quietly drop the data and hope it works out
+ later, but you probably have bigger problems in this case anyhow. */
+ SDL_WriteToDataQueue(device->buffer_queue, stream, len);
+}
+
+int
+SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len)
+{
+ SDL_AudioDevice *device = get_audio_device(devid);
+ int rc = 0;
+
+ if (!device) {
+ return -1; /* get_audio_device() will have set the error state */
+ } else if (device->iscapture) {
+ return SDL_SetError("This is a capture device, queueing not allowed");
+ } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) {
+ return SDL_SetError("Audio device has a callback, queueing not allowed");
+ }
+
+ if (len > 0) {
+ current_audio.impl.LockDevice(device);
+ rc = SDL_WriteToDataQueue(device->buffer_queue, data, len);
+ current_audio.impl.UnlockDevice(device);
+ }
+
+ return rc;
+}
+
+Uint32
+SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len)
+{
+ SDL_AudioDevice *device = get_audio_device(devid);
+ Uint32 rc;
+
+ if ( (len == 0) || /* nothing to do? */
+ (!device) || /* called with bogus device id */
+ (!device->iscapture) || /* playback devices can't dequeue */
+ (device->callbackspec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */
+ return 0; /* just report zero bytes dequeued. */
+ }
+
+ current_audio.impl.LockDevice(device);
+ rc = (Uint32) SDL_ReadFromDataQueue(device->buffer_queue, data, len);
+ current_audio.impl.UnlockDevice(device);
+ return rc;
+}
+
+Uint32
+SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid)
+{
+ Uint32 retval = 0;
+ SDL_AudioDevice *device = get_audio_device(devid);
+
+ if (!device) {
+ return 0;
+ }
+
+ /* Nothing to do unless we're set up for queueing. */
+ if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) {
+ current_audio.impl.LockDevice(device);
+ retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device);
+ current_audio.impl.UnlockDevice(device);
+ } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) {
+ current_audio.impl.LockDevice(device);
+ retval = (Uint32) SDL_CountDataQueue(device->buffer_queue);
+ current_audio.impl.UnlockDevice(device);
+ }
+
+ return retval;
+}
+
+void
+SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
+{
+ SDL_AudioDevice *device = get_audio_device(devid);
+
+ if (!device) {
+ return; /* nothing to do. */
+ }
+
+ /* Blank out the device and release the mutex. Free it afterwards. */
+ current_audio.impl.LockDevice(device);
+
+ /* Keep up to two packets in the pool to reduce future malloc pressure. */
+ SDL_ClearDataQueue(device->buffer_queue, SDL_AUDIOBUFFERQUEUE_PACKETLEN * 2);
+
+ current_audio.impl.UnlockDevice(device);
+}
+
+
+/* The general mixing thread function */
+static int SDLCALL
+SDL_RunAudio(void *devicep)
+{
+ SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
+ void *udata = device->callbackspec.userdata;
+ SDL_AudioCallback callback = device->callbackspec.callback;
+ int data_len = 0;
+ Uint8 *data;
+
+ SDL_assert(!device->iscapture);
+
+ /* The audio mixing is always a high priority thread */
+ SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
+
+ /* Perform any thread setup */
+ device->threadid = SDL_ThreadID();
+ current_audio.impl.ThreadInit(device);
+
+ /* Loop, filling the audio buffers */
+ while (!SDL_AtomicGet(&device->shutdown)) {
+ current_audio.impl.BeginLoopIteration(device);
+ data_len = device->callbackspec.size;
+
+ /* Fill the current buffer with sound */
+ if (!device->stream && SDL_AtomicGet(&device->enabled)) {
+ SDL_assert(data_len == device->spec.size);
+ data = current_audio.impl.GetDeviceBuf(device);
+ } else {
+ /* if the device isn't enabled, we still write to the
+ work_buffer, so the app's callback will fire with
+ a regular frequency, in case they depend on that
+ for timing or progress. They can use hotplug
+ now to know if the device failed.
+ Streaming playback uses work_buffer, too. */
+ data = NULL;
+ }
+
+ if (data == NULL) {
+ data = device->work_buffer;
+ }
+
+ /* !!! FIXME: this should be LockDevice. */
+ SDL_LockMutex(device->mixer_lock);
+ if (SDL_AtomicGet(&device->paused)) {
+ SDL_memset(data, device->spec.silence, data_len);
+ } else {
+ callback(udata, data, data_len);
+ }
+ SDL_UnlockMutex(device->mixer_lock);
+
+ if (device->stream) {
+ /* Stream available audio to device, converting/resampling. */
+ /* if this fails...oh well. We'll play silence here. */
+ SDL_AudioStreamPut(device->stream, data, data_len);
+
+ while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->spec.size)) {
+ int got;
+ data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL;
+ got = SDL_AudioStreamGet(device->stream, data ? data : device->work_buffer, device->spec.size);
+ SDL_assert((got < 0) || (got == device->spec.size));
+
+ if (data == NULL) { /* device is having issues... */
+ const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
+ SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */
+ } else {
+ if (got != device->spec.size) {
+ SDL_memset(data, device->spec.silence, device->spec.size);
+ }
+ current_audio.impl.PlayDevice(device);
+ current_audio.impl.WaitDevice(device);
+ }
+ }
+ } else if (data == device->work_buffer) {
+ /* nothing to do; pause like we queued a buffer to play. */
+ const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
+ SDL_Delay(delay);
+ } else { /* writing directly to the device. */
+ /* queue this buffer and wait for it to finish playing. */
+ current_audio.impl.PlayDevice(device);
+ current_audio.impl.WaitDevice(device);
+ }
+ }
+
+ current_audio.impl.PrepareToClose(device);
+
+ /* Wait for the audio to drain. */
+ SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2);
+
+ current_audio.impl.ThreadDeinit(device);
+
+ return 0;
+}
+
+/* !!! FIXME: this needs to deal with device spec changes. */
+/* The general capture thread function */
+static int SDLCALL
+SDL_CaptureAudio(void *devicep)
+{
+ SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
+ const int silence = (int) device->spec.silence;
+ const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
+ const int data_len = device->spec.size;
+ Uint8 *data;
+ void *udata = device->callbackspec.userdata;
+ SDL_AudioCallback callback = device->callbackspec.callback;
+
+ SDL_assert(device->iscapture);
+
+ /* The audio mixing is always a high priority thread */
+ SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
+
+ /* Perform any thread setup */
+ device->threadid = SDL_ThreadID();
+ current_audio.impl.ThreadInit(device);
+
+ /* Loop, filling the audio buffers */
+ while (!SDL_AtomicGet(&device->shutdown)) {
+ int still_need;
+ Uint8 *ptr;
+
+ current_audio.impl.BeginLoopIteration(device);
+
+ if (SDL_AtomicGet(&device->paused)) {
+ SDL_Delay(delay); /* just so we don't cook the CPU. */
+ if (device->stream) {
+ SDL_AudioStreamClear(device->stream);
+ }
+ current_audio.impl.FlushCapture(device); /* dump anything pending. */
+ continue;
+ }
+
+ /* Fill the current buffer with sound */
+ still_need = data_len;
+
+ /* Use the work_buffer to hold data read from the device. */
+ data = device->work_buffer;
+ SDL_assert(data != NULL);
+
+ ptr = data;
+
+ /* We still read from the device when "paused" to keep the state sane,
+ and block when there isn't data so this thread isn't eating CPU.
+ But we don't process it further or call the app's callback. */
+
+ if (!SDL_AtomicGet(&device->enabled)) {
+ SDL_Delay(delay); /* try to keep callback firing at normal pace. */
+ } else {
+ while (still_need > 0) {
+ const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need);
+ SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */
+ if (rc > 0) {
+ still_need -= rc;
+ ptr += rc;
+ } else { /* uhoh, device failed for some reason! */
+ SDL_OpenedAudioDeviceDisconnected(device);
+ break;
+ }
+ }
+ }
+
+ if (still_need > 0) {
+ /* Keep any data we already read, silence the rest. */
+ SDL_memset(ptr, silence, still_need);
+ }
+
+ if (device->stream) {
+ /* if this fails...oh well. */
+ SDL_AudioStreamPut(device->stream, data, data_len);
+
+ while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) {
+ const int got = SDL_AudioStreamGet(device->stream, device->work_buffer, device->callbackspec.size);
+ SDL_assert((got < 0) || (got == device->callbackspec.size));
+ if (got != device->callbackspec.size) {
+ SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size);
+ }
+
+ /* !!! FIXME: this should be LockDevice. */
+ SDL_LockMutex(device->mixer_lock);
+ if (!SDL_AtomicGet(&device->paused)) {
+ callback(udata, device->work_buffer, device->callbackspec.size);
+ }
+ SDL_UnlockMutex(device->mixer_lock);
+ }
+ } else { /* feeding user callback directly without streaming. */
+ /* !!! FIXME: this should be LockDevice. */
+ SDL_LockMutex(device->mixer_lock);
+ if (!SDL_AtomicGet(&device->paused)) {
+ callback(udata, data, device->callbackspec.size);
+ }
+ SDL_UnlockMutex(device->mixer_lock);
+ }
+ }
+
+ current_audio.impl.FlushCapture(device);
+
+ current_audio.impl.ThreadDeinit(device);
+
+ return 0;
+}
+
+
+static SDL_AudioFormat
+SDL_ParseAudioFormat(const char *string)
+{
+#define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) return AUDIO_##x
+ CHECK_FMT_STRING(U8);
+ CHECK_FMT_STRING(S8);
+ CHECK_FMT_STRING(U16LSB);
+ CHECK_FMT_STRING(S16LSB);
+ CHECK_FMT_STRING(U16MSB);
+ CHECK_FMT_STRING(S16MSB);
+ CHECK_FMT_STRING(U16SYS);
+ CHECK_FMT_STRING(S16SYS);
+ CHECK_FMT_STRING(U16);
+ CHECK_FMT_STRING(S16);
+ CHECK_FMT_STRING(S32LSB);
+ CHECK_FMT_STRING(S32MSB);
+ CHECK_FMT_STRING(S32SYS);
+ CHECK_FMT_STRING(S32);
+ CHECK_FMT_STRING(F32LSB);
+ CHECK_FMT_STRING(F32MSB);
+ CHECK_FMT_STRING(F32SYS);
+ CHECK_FMT_STRING(F32);
+#undef CHECK_FMT_STRING
+ return 0;
+}
+
+int
+SDL_GetNumAudioDrivers(void)
+{
+ return SDL_arraysize(bootstrap) - 1;
+}
+
+const char *
+SDL_GetAudioDriver(int index)
+{
+ if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
+ return bootstrap[index]->name;
+ }
+ return NULL;
+}
+
+int
+SDL_AudioInit(const char *driver_name)
+{
+ int i = 0;
+ int initialized = 0;
+ int tried_to_init = 0;
+
+ if (SDL_WasInit(SDL_INIT_AUDIO)) {
+ SDL_AudioQuit(); /* shutdown driver if already running. */
+ }
+
+ SDL_zero(current_audio);
+ SDL_zero(open_devices);
+
+ /* Select the proper audio driver */
+ if (driver_name == NULL) {
+ driver_name = SDL_getenv("SDL_AUDIODRIVER");
+ }
+
+ for (i = 0; (!initialized) && (bootstrap[i]); ++i) {
+ /* make sure we should even try this driver before doing so... */
+ const AudioBootStrap *backend = bootstrap[i];
+ if ((driver_name && (SDL_strncasecmp(backend->name, driver_name, SDL_strlen(driver_name)) != 0)) ||
+ (!driver_name && backend->demand_only)) {
+ continue;
+ }
+
+ tried_to_init = 1;
+ SDL_zero(current_audio);
+ current_audio.name = backend->name;
+ current_audio.desc = backend->desc;
+ initialized = backend->init(&current_audio.impl);
+ }
+
+ if (!initialized) {
+ /* specific drivers will set the error message if they fail... */
+ if (!tried_to_init) {
+ if (driver_name) {
+ SDL_SetError("Audio target '%s' not available", driver_name);
+ } else {
+ SDL_SetError("No available audio device");
+ }
+ }
+
+ SDL_zero(current_audio);
+ return -1; /* No driver was available, so fail. */
+ }
+
+ current_audio.detectionLock = SDL_CreateMutex();
+
+ finish_audio_entry_points_init();
+
+ /* Make sure we have a list of devices available at startup. */
+ current_audio.impl.DetectDevices();
+
+#ifdef HAVE_LIBSAMPLERATE_H
+ LoadLibSampleRate();
+#endif
+
+ return 0;
+}
+
+/*
+ * Get the current audio driver name
+ */
+const char *
+SDL_GetCurrentAudioDriver()
+{
+ return current_audio.name;
+}
+
+/* Clean out devices that we've removed but had to keep around for stability. */
+static void
+clean_out_device_list(SDL_AudioDeviceItem **devices, int *devCount, SDL_bool *removedFlag)
+{
+ SDL_AudioDeviceItem *item = *devices;
+ SDL_AudioDeviceItem *prev = NULL;
+ int total = 0;
+
+ while (item) {
+ SDL_AudioDeviceItem *next = item->next;
+ if (item->handle != NULL) {
+ total++;
+ prev = item;
+ } else {
+ if (prev) {
+ prev->next = next;
+ } else {
+ *devices = next;
+ }
+ SDL_free(item);
+ }
+ item = next;
+ }
+
+ *devCount = total;
+ *removedFlag = SDL_FALSE;
+}
+
+
+int
+SDL_GetNumAudioDevices(int iscapture)
+{
+ int retval = 0;
+
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ return -1;
+ }
+
+ SDL_LockMutex(current_audio.detectionLock);
+ if (iscapture && current_audio.captureDevicesRemoved) {
+ clean_out_device_list(&current_audio.inputDevices, &current_audio.inputDeviceCount, &current_audio.captureDevicesRemoved);
+ }
+
+ if (!iscapture && current_audio.outputDevicesRemoved) {
+ clean_out_device_list(&current_audio.outputDevices, &current_audio.outputDeviceCount, &current_audio.outputDevicesRemoved);
+ current_audio.outputDevicesRemoved = SDL_FALSE;
+ }
+
+ retval = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount;
+ SDL_UnlockMutex(current_audio.detectionLock);
+
+ return retval;
+}
+
+
+const char *
+SDL_GetAudioDeviceName(int index, int iscapture)
+{
+ const char *retval = NULL;
+
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ SDL_SetError("Audio subsystem is not initialized");
+ return NULL;
+ }
+
+ if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) {
+ SDL_SetError("No capture support");
+ return NULL;
+ }
+
+ if (index >= 0) {
+ SDL_AudioDeviceItem *item;
+ int i;
+
+ SDL_LockMutex(current_audio.detectionLock);
+ item = iscapture ? current_audio.inputDevices : current_audio.outputDevices;
+ i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount;
+ if (index < i) {
+ for (i--; i > index; i--, item = item->next) {
+ SDL_assert(item != NULL);
+ }
+ SDL_assert(item != NULL);
+ retval = item->name;
+ }
+ SDL_UnlockMutex(current_audio.detectionLock);
+ }
+
+ if (retval == NULL) {
+ SDL_SetError("No such device");
+ }
+
+ return retval;
+}
+
+
+static void
+close_audio_device(SDL_AudioDevice * device)
+{
+ if (!device) {
+ return;
+ }
+
+ if (device->id > 0) {
+ SDL_AudioDevice *opendev = open_devices[device->id - 1];
+ SDL_assert((opendev == device) || (opendev == NULL));
+ if (opendev == device) {
+ open_devices[device->id - 1] = NULL;
+ }
+ }
+
+ SDL_AtomicSet(&device->shutdown, 1);
+ SDL_AtomicSet(&device->enabled, 0);
+ if (device->thread != NULL) {
+ SDL_WaitThread(device->thread, NULL);
+ }
+ if (device->mixer_lock != NULL) {
+ SDL_DestroyMutex(device->mixer_lock);
+ }
+
+ SDL_free(device->work_buffer);
+ SDL_FreeAudioStream(device->stream);
+
+ if (device->hidden != NULL) {
+ current_audio.impl.CloseDevice(device);
+ }
+
+ SDL_FreeDataQueue(device->buffer_queue);
+
+ SDL_free(device);
+}
+
+
+/*
+ * Sanity check desired AudioSpec for SDL_OpenAudio() in (orig).
+ * Fills in a sanitized copy in (prepared).
+ * Returns non-zero if okay, zero on fatal parameters in (orig).
+ */
+static int
+prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared)
+{
+ SDL_memcpy(prepared, orig, sizeof(SDL_AudioSpec));
+
+ if (orig->freq == 0) {
+ const char *env = SDL_getenv("SDL_AUDIO_FREQUENCY");
+ if ((!env) || ((prepared->freq = SDL_atoi(env)) == 0)) {
+ prepared->freq = 22050; /* a reasonable default */
+ }
+ }
+
+ if (orig->format == 0) {
+ const char *env = SDL_getenv("SDL_AUDIO_FORMAT");
+ if ((!env) || ((prepared->format = SDL_ParseAudioFormat(env)) == 0)) {
+ prepared->format = AUDIO_S16; /* a reasonable default */
+ }
+ }
+
+ switch (orig->channels) {
+ case 0:{
+ const char *env = SDL_getenv("SDL_AUDIO_CHANNELS");
+ if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) {
+ prepared->channels = 2; /* a reasonable default */
+ }
+ break;
+ }
+ case 1: /* Mono */
+ case 2: /* Stereo */
+ case 4: /* surround */
+ case 6: /* surround with center and lfe */
+ break;
+ default:
+ SDL_SetError("Unsupported number of audio channels.");
+ return 0;
+ }
+
+ if (orig->samples == 0) {
+ const char *env = SDL_getenv("SDL_AUDIO_SAMPLES");
+ if ((!env) || ((prepared->samples = (Uint16) SDL_atoi(env)) == 0)) {
+ /* Pick a default of ~46 ms at desired frequency */
+ /* !!! FIXME: remove this when the non-Po2 resampling is in. */
+ const int samples = (prepared->freq / 1000) * 46;
+ int power2 = 1;
+ while (power2 < samples) {
+ power2 *= 2;
+ }
+ prepared->samples = power2;
+ }
+ }
+
+ /* Calculate the silence and size of the audio specification */
+ SDL_CalculateAudioSpec(prepared);
+
+ return 1;
+}
+
+static SDL_AudioDeviceID
+open_audio_device(const char *devname, int iscapture,
+ const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
+ int allowed_changes, int min_id)
+{
+ const SDL_bool is_internal_thread = (desired->callback == NULL);
+ SDL_AudioDeviceID id = 0;
+ SDL_AudioSpec _obtained;
+ SDL_AudioDevice *device;
+ SDL_bool build_stream;
+ void *handle = NULL;
+ int i = 0;
+
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ SDL_SetError("Audio subsystem is not initialized");
+ return 0;
+ }
+
+ if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) {
+ SDL_SetError("No capture support");
+ return 0;
+ }
+
+ /* !!! FIXME: there is a race condition here if two devices open from two threads at once. */
+ /* Find an available device ID... */
+ for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) {
+ if (open_devices[id] == NULL) {
+ break;
+ }
+ }
+
+ if (id == SDL_arraysize(open_devices)) {
+ SDL_SetError("Too many open audio devices");
+ return 0;
+ }
+
+ if (!obtained) {
+ obtained = &_obtained;
+ }
+ if (!prepare_audiospec(desired, obtained)) {
+ return 0;
+ }
+
+ /* If app doesn't care about a specific device, let the user override. */
+ if (devname == NULL) {
+ devname = SDL_getenv("SDL_AUDIO_DEVICE_NAME");
+ }
+
+ /*
+ * Catch device names at the high level for the simple case...
+ * This lets us have a basic "device enumeration" for systems that
+ * don't have multiple devices, but makes sure the device name is
+ * always NULL when it hits the low level.
+ *
+ * Also make sure that the simple case prevents multiple simultaneous
+ * opens of the default system device.
+ */
+
+ if ((iscapture) && (current_audio.impl.OnlyHasDefaultCaptureDevice)) {
+ if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) {
+ SDL_SetError("No such device");
+ return 0;
+ }
+ devname = NULL;
+
+ for (i = 0; i < SDL_arraysize(open_devices); i++) {
+ if ((open_devices[i]) && (open_devices[i]->iscapture)) {
+ SDL_SetError("Audio device already open");
+ return 0;
+ }
+ }
+ } else if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) {
+ if ((devname) && (SDL_strcmp(devname, DEFAULT_OUTPUT_DEVNAME) != 0)) {
+ SDL_SetError("No such device");
+ return 0;
+ }
+ devname = NULL;
+
+ for (i = 0; i < SDL_arraysize(open_devices); i++) {
+ if ((open_devices[i]) && (!open_devices[i]->iscapture)) {
+ SDL_SetError("Audio device already open");
+ return 0;
+ }
+ }
+ } else if (devname != NULL) {
+ /* if the app specifies an exact string, we can pass the backend
+ an actual device handle thingey, which saves them the effort of
+ figuring out what device this was (such as, reenumerating
+ everything again to find the matching human-readable name).
+ It might still need to open a device based on the string for,
+ say, a network audio server, but this optimizes some cases. */
+ SDL_AudioDeviceItem *item;
+ SDL_LockMutex(current_audio.detectionLock);
+ for (item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; item; item = item->next) {
+ if ((item->handle != NULL) && (SDL_strcmp(item->name, devname) == 0)) {
+ handle = item->handle;
+ break;
+ }
+ }
+ SDL_UnlockMutex(current_audio.detectionLock);
+ }
+
+ if (!current_audio.impl.AllowsArbitraryDeviceNames) {
+ /* has to be in our device list, or the default device. */
+ if ((handle == NULL) && (devname != NULL)) {
+ SDL_SetError("No such device.");
+ return 0;
+ }
+ }
+
+ device = (SDL_AudioDevice *) SDL_calloc(1, sizeof (SDL_AudioDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ device->id = id + 1;
+ device->spec = *obtained;
+ device->iscapture = iscapture ? SDL_TRUE : SDL_FALSE;
+ device->handle = handle;
+
+ SDL_AtomicSet(&device->shutdown, 0); /* just in case. */
+ SDL_AtomicSet(&device->paused, 1);
+ SDL_AtomicSet(&device->enabled, 1);
+
+ /* Create a mutex for locking the sound buffers */
+ if (!current_audio.impl.SkipMixerLock) {
+ device->mixer_lock = SDL_CreateMutex();
+ if (device->mixer_lock == NULL) {
+ close_audio_device(device);
+ SDL_SetError("Couldn't create mixer lock");
+ return 0;
+ }
+ }
+
+ if (current_audio.impl.OpenDevice(device, handle, devname, iscapture) < 0) {
+ close_audio_device(device);
+ return 0;
+ }
+
+ /* if your target really doesn't need it, set it to 0x1 or something. */
+ /* otherwise, close_audio_device() won't call impl.CloseDevice(). */
+ SDL_assert(device->hidden != NULL);
+
+ /* See if we need to do any conversion */
+ build_stream = SDL_FALSE;
+ if (obtained->freq != device->spec.freq) {
+ if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) {
+ obtained->freq = device->spec.freq;
+ } else {
+ build_stream = SDL_TRUE;
+ }
+ }
+ if (obtained->format != device->spec.format) {
+ if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) {
+ obtained->format = device->spec.format;
+ } else {
+ build_stream = SDL_TRUE;
+ }
+ }
+ if (obtained->channels != device->spec.channels) {
+ if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) {
+ obtained->channels = device->spec.channels;
+ } else {
+ build_stream = SDL_TRUE;
+ }
+ }
+
+ /* !!! FIXME in 2.1: add SDL_AUDIO_ALLOW_SAMPLES_CHANGE flag?
+ As of 2.0.6, we will build a stream to buffer the difference between
+ what the app wants to feed and the device wants to eat, so everyone
+ gets their way. In prior releases, SDL would force the callback to
+ feed at the rate the device requested, adjusted for resampling.
+ */
+ if (device->spec.samples != obtained->samples) {
+ build_stream = SDL_TRUE;
+ }
+
+ SDL_CalculateAudioSpec(obtained); /* recalc after possible changes. */
+
+ device->callbackspec = *obtained;
+
+ if (build_stream) {
+ if (iscapture) {
+ device->stream = SDL_NewAudioStream(device->spec.format,
+ device->spec.channels, device->spec.freq,
+ obtained->format, obtained->channels, obtained->freq);
+ } else {
+ device->stream = SDL_NewAudioStream(obtained->format, obtained->channels,
+ obtained->freq, device->spec.format,
+ device->spec.channels, device->spec.freq);
+ }
+
+ if (!device->stream) {
+ close_audio_device(device);
+ return 0;
+ }
+ }
+
+ if (device->spec.callback == NULL) { /* use buffer queueing? */
+ /* pool a few packets to start. Enough for two callbacks. */
+ device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2);
+ if (!device->buffer_queue) {
+ close_audio_device(device);
+ SDL_SetError("Couldn't create audio buffer queue");
+ return 0;
+ }
+ device->callbackspec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback;
+ device->callbackspec.userdata = device;
+ }
+
+ /* Allocate a scratch audio buffer */
+ device->work_buffer_len = build_stream ? device->callbackspec.size : 0;
+ if (device->spec.size > device->work_buffer_len) {
+ device->work_buffer_len = device->spec.size;
+ }
+ SDL_assert(device->work_buffer_len > 0);
+
+ device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len);
+ if (device->work_buffer == NULL) {
+ close_audio_device(device);
+ SDL_OutOfMemory();
+ return 0;
+ }
+
+ open_devices[id] = device; /* add it to our list of open devices. */
+
+ /* Start the audio thread if necessary */
+ if (!current_audio.impl.ProvidesOwnCallbackThread) {
+ /* Start the audio thread */
+ /* !!! FIXME: we don't force the audio thread stack size here if it calls into user code, but maybe we should? */
+ /* buffer queueing callback only needs a few bytes, so make the stack tiny. */
+ const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;
+ char threadname[64];
+
+ SDL_snprintf(threadname, sizeof (threadname), "SDLAudio%c%d", (iscapture) ? 'C' : 'P', (int) device->id);
+ device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device);
+
+ if (device->thread == NULL) {
+ close_audio_device(device);
+ SDL_SetError("Couldn't create audio thread");
+ return 0;
+ }
+ }
+
+ return device->id;
+}
+
+
+int
+SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained)
+{
+ SDL_AudioDeviceID id = 0;
+
+ /* Start up the audio driver, if necessary. This is legacy behaviour! */
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
+ return -1;
+ }
+ }
+
+ /* SDL_OpenAudio() is legacy and can only act on Device ID #1. */
+ if (open_devices[0] != NULL) {
+ SDL_SetError("Audio device is already opened");
+ return -1;
+ }
+
+ if (obtained) {
+ id = open_audio_device(NULL, 0, desired, obtained,
+ SDL_AUDIO_ALLOW_ANY_CHANGE, 1);
+ } else {
+ SDL_AudioSpec _obtained;
+ SDL_zero(_obtained);
+ id = open_audio_device(NULL, 0, desired, &_obtained, 0, 1);
+ /* On successful open, copy calculated values into 'desired'. */
+ if (id > 0) {
+ desired->size = _obtained.size;
+ desired->silence = _obtained.silence;
+ }
+ }
+
+ SDL_assert((id == 0) || (id == 1));
+ return (id == 0) ? -1 : 0;
+}
+
+SDL_AudioDeviceID
+SDL_OpenAudioDevice(const char *device, int iscapture,
+ const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
+ int allowed_changes)
+{
+ return open_audio_device(device, iscapture, desired, obtained,
+ allowed_changes, 2);
+}
+
+SDL_AudioStatus
+SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
+{
+ SDL_AudioDevice *device = get_audio_device(devid);
+ SDL_AudioStatus status = SDL_AUDIO_STOPPED;
+ if (device && SDL_AtomicGet(&device->enabled)) {
+ if (SDL_AtomicGet(&device->paused)) {
+ status = SDL_AUDIO_PAUSED;
+ } else {
+ status = SDL_AUDIO_PLAYING;
+ }
+ }
+ return status;
+}
+
+
+SDL_AudioStatus
+SDL_GetAudioStatus(void)
+{
+ return SDL_GetAudioDeviceStatus(1);
+}
+
+void
+SDL_PauseAudioDevice(SDL_AudioDeviceID devid, int pause_on)
+{
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ current_audio.impl.LockDevice(device);
+ SDL_AtomicSet(&device->paused, pause_on ? 1 : 0);
+ current_audio.impl.UnlockDevice(device);
+ }
+}
+
+void
+SDL_PauseAudio(int pause_on)
+{
+ SDL_PauseAudioDevice(1, pause_on);
+}
+
+
+void
+SDL_LockAudioDevice(SDL_AudioDeviceID devid)
+{
+ /* Obtain a lock on the mixing buffers */
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ current_audio.impl.LockDevice(device);
+ }
+}
+
+void
+SDL_LockAudio(void)
+{
+ SDL_LockAudioDevice(1);
+}
+
+void
+SDL_UnlockAudioDevice(SDL_AudioDeviceID devid)
+{
+ /* Obtain a lock on the mixing buffers */
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ current_audio.impl.UnlockDevice(device);
+ }
+}
+
+void
+SDL_UnlockAudio(void)
+{
+ SDL_UnlockAudioDevice(1);
+}
+
+void
+SDL_CloseAudioDevice(SDL_AudioDeviceID devid)
+{
+ close_audio_device(get_audio_device(devid));
+}
+
+void
+SDL_CloseAudio(void)
+{
+ SDL_CloseAudioDevice(1);
+}
+
+void
+SDL_AudioQuit(void)
+{
+ SDL_AudioDeviceID i;
+
+ if (!current_audio.name) { /* not initialized?! */
+ return;
+ }
+
+ for (i = 0; i < SDL_arraysize(open_devices); i++) {
+ close_audio_device(open_devices[i]);
+ }
+
+ free_device_list(&current_audio.outputDevices, &current_audio.outputDeviceCount);
+ free_device_list(&current_audio.inputDevices, &current_audio.inputDeviceCount);
+
+ /* Free the driver data */
+ current_audio.impl.Deinitialize();
+
+ SDL_DestroyMutex(current_audio.detectionLock);
+
+ SDL_zero(current_audio);
+ SDL_zero(open_devices);
+
+#ifdef HAVE_LIBSAMPLERATE_H
+ UnloadLibSampleRate();
+#endif
+
+ SDL_FreeResampleFilter();
+}
+
+#define NUM_FORMATS 10
+static int format_idx;
+static int format_idx_sub;
+static SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS] = {
+ {AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB,
+ AUDIO_U16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB},
+ {AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB,
+ AUDIO_U16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB},
+ {AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S32LSB,
+ AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S32MSB,
+ AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB,
+ AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_S32MSB,
+ AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S16LSB,
+ AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S16MSB,
+ AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S16LSB,
+ AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_S16MSB,
+ AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8},
+};
+
+SDL_AudioFormat
+SDL_FirstAudioFormat(SDL_AudioFormat format)
+{
+ for (format_idx = 0; format_idx < NUM_FORMATS; ++format_idx) {
+ if (format_list[format_idx][0] == format) {
+ break;
+ }
+ }
+ format_idx_sub = 0;
+ return SDL_NextAudioFormat();
+}
+
+SDL_AudioFormat
+SDL_NextAudioFormat(void)
+{
+ if ((format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS)) {
+ return 0;
+ }
+ return format_list[format_idx][format_idx_sub++];
+}
+
+void
+SDL_CalculateAudioSpec(SDL_AudioSpec * spec)
+{
+ switch (spec->format) {
+ case AUDIO_U8:
+ spec->silence = 0x80;
+ break;
+ default:
+ spec->silence = 0x00;
+ break;
+ }
+ spec->size = SDL_AUDIO_BITSIZE(spec->format) / 8;
+ spec->size *= spec->channels;
+ spec->size *= spec->samples;
+}
+
+
+/*
+ * Moved here from SDL_mixer.c, since it relies on internals of an opened
+ * audio device (and is deprecated, by the way!).
+ */
+void
+SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume)
+{
+ /* Mix the user-level audio format */
+ SDL_AudioDevice *device = get_audio_device(1);
+ if (device != NULL) {
+ SDL_MixAudioFormat(dst, src, device->callbackspec.format, len, volume);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_audio_c.h b/src/3rdparty/SDL2/src/audio/SDL_audio_c.h
new file mode 100644
index 0000000..d47ebb1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_audio_c.h
@@ -0,0 +1,79 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_audio_c_h_
+#define SDL_audio_c_h_
+
+#include "../SDL_internal.h"
+
+#ifndef DEBUG_CONVERT
+#define DEBUG_CONVERT 0
+#endif
+
+#if DEBUG_CONVERT
+#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to);
+#else
+#define LOG_DEBUG_CONVERT(from, to)
+#endif
+
+/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
+
+#ifdef HAVE_LIBSAMPLERATE_H
+#include "samplerate.h"
+extern SDL_bool SRC_available;
+extern int SRC_converter;
+extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error);
+extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data);
+extern int (*SRC_src_reset)(SRC_STATE *state);
+extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state);
+extern const char* (*SRC_src_strerror)(int error);
+#endif
+
+/* Functions to get a list of "close" audio formats */
+extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format);
+extern SDL_AudioFormat SDL_NextAudioFormat(void);
+
+/* Function to calculate the size and silence for a SDL_AudioSpec */
+extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
+
+/* Choose the audio filter functions below */
+extern void SDL_ChooseAudioConverters(void);
+
+/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */
+extern SDL_AudioFilter SDL_Convert_S8_to_F32;
+extern SDL_AudioFilter SDL_Convert_U8_to_F32;
+extern SDL_AudioFilter SDL_Convert_S16_to_F32;
+extern SDL_AudioFilter SDL_Convert_U16_to_F32;
+extern SDL_AudioFilter SDL_Convert_S32_to_F32;
+extern SDL_AudioFilter SDL_Convert_F32_to_S8;
+extern SDL_AudioFilter SDL_Convert_F32_to_U8;
+extern SDL_AudioFilter SDL_Convert_F32_to_S16;
+extern SDL_AudioFilter SDL_Convert_F32_to_U16;
+extern SDL_AudioFilter SDL_Convert_F32_to_S32;
+
+/* You need to call SDL_PrepareResampleFilter() before using the internal resampler.
+ SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */
+extern int SDL_PrepareResampleFilter(void);
+extern void SDL_FreeResampleFilter(void);
+
+#endif /* SDL_audio_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_audiocvt.c b/src/3rdparty/SDL2/src/audio/SDL_audiocvt.c
new file mode 100644
index 0000000..7fde2b9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_audiocvt.c
@@ -0,0 +1,1673 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Functions for audio drivers to perform runtime conversion of audio format */
+
+/* FIXME: Channel weights when converting from more channels to fewer may need to be adjusted, see https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx
+*/
+
+#include "SDL.h"
+#include "SDL_audio.h"
+#include "SDL_audio_c.h"
+
+#include "SDL_loadso.h"
+#include "SDL_assert.h"
+#include "../SDL_dataqueue.h"
+#include "SDL_cpuinfo.h"
+
+#define DEBUG_AUDIOSTREAM 0
+
+#ifdef __SSE3__
+#define HAVE_SSE3_INTRINSICS 1
+#endif
+
+#if HAVE_SSE3_INTRINSICS
+/* Convert from stereo to mono. Average left and right. */
+static void SDLCALL
+SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float *dst = (float *) cvt->buf;
+ const float *src = dst;
+ int i = cvt->len_cvt / 8;
+
+ LOG_DEBUG_CONVERT("stereo", "mono (using SSE3)");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ /* We can only do this if dst is aligned to 16 bytes; since src is the
+ same pointer and it moves by 2, it can't be forcibly aligned. */
+ if ((((size_t) dst) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128 divby2 = _mm_set1_ps(0.5f);
+ while (i >= 4) { /* 4 * float32 */
+ _mm_store_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_load_ps(src+4)), divby2));
+ i -= 4; src += 8; dst += 4;
+ }
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (src[0] + src[1]) * 0.5f;
+ dst++; i--; src += 2;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+#endif
+
+/* Convert from stereo to mono. Average left and right. */
+static void SDLCALL
+SDL_ConvertStereoToMono(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float *dst = (float *) cvt->buf;
+ const float *src = dst;
+ int i;
+
+ LOG_DEBUG_CONVERT("stereo", "mono");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ for (i = cvt->len_cvt / 8; i; --i, src += 2) {
+ *(dst++) = (src[0] + src[1]) * 0.5f;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */
+static void SDLCALL
+SDL_Convert51ToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float *dst = (float *) cvt->buf;
+ const float *src = dst;
+ int i;
+
+ LOG_DEBUG_CONVERT("5.1", "stereo");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */
+ for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 2) {
+ const float front_center_distributed = src[2] * 0.5f;
+ dst[0] = (src[0] + front_center_distributed + src[4]) / 2.5f; /* left */
+ dst[1] = (src[1] + front_center_distributed + src[5]) / 2.5f; /* right */
+ }
+
+ cvt->len_cvt /= 3;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Convert from quad to stereo. Average left and right. */
+static void SDLCALL
+SDL_ConvertQuadToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float *dst = (float *) cvt->buf;
+ const float *src = dst;
+ int i;
+
+ LOG_DEBUG_CONVERT("quad", "stereo");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ for (i = cvt->len_cvt / (sizeof (float) * 4); i; --i, src += 4, dst += 2) {
+ dst[0] = (src[0] + src[2]) * 0.5f; /* left */
+ dst[1] = (src[1] + src[3]) * 0.5f; /* right */
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Convert from 7.1 to 5.1. Distribute sides across front and back. */
+static void SDLCALL
+SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float *dst = (float *) cvt->buf;
+ const float *src = dst;
+ int i;
+
+ LOG_DEBUG_CONVERT("7.1", "5.1");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 6) {
+ const float surround_left_distributed = src[6] * 0.5f;
+ const float surround_right_distributed = src[7] * 0.5f;
+ dst[0] = (src[0] + surround_left_distributed) / 1.5f; /* FL */
+ dst[1] = (src[1] + surround_right_distributed) / 1.5f; /* FR */
+ dst[2] = src[2] / 1.5f; /* CC */
+ dst[3] = src[3] / 1.5f; /* LFE */
+ dst[4] = (src[4] + surround_left_distributed) / 1.5f; /* BL */
+ dst[5] = (src[5] + surround_right_distributed) / 1.5f; /* BR */
+ }
+
+ cvt->len_cvt /= 8;
+ cvt->len_cvt *= 6;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Convert from 5.1 to quad. Distribute center across front, discard LFE. */
+static void SDLCALL
+SDL_Convert51ToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float *dst = (float *) cvt->buf;
+ const float *src = dst;
+ int i;
+
+ LOG_DEBUG_CONVERT("5.1", "quad");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ /* SDL's 4.0 layout: FL+FR+BL+BR */
+ /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */
+ for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 4) {
+ const float front_center_distributed = src[2] * 0.5f;
+ dst[0] = (src[0] + front_center_distributed) / 1.5f; /* FL */
+ dst[1] = (src[1] + front_center_distributed) / 1.5f; /* FR */
+ dst[2] = src[4] / 1.5f; /* BL */
+ dst[3] = src[5] / 1.5f; /* BR */
+ }
+
+ cvt->len_cvt /= 6;
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Upmix mono to stereo (by duplication) */
+static void SDLCALL
+SDL_ConvertMonoToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+ float *dst = (float *) (cvt->buf + cvt->len_cvt * 2);
+ int i;
+
+ LOG_DEBUG_CONVERT("mono", "stereo");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ for (i = cvt->len_cvt / sizeof (float); i; --i) {
+ src--;
+ dst -= 2;
+ dst[0] = dst[1] = *src;
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Upmix stereo to a pseudo-5.1 stream */
+static void SDLCALL
+SDL_ConvertStereoTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ float lf, rf, ce;
+ const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+ float *dst = (float *) (cvt->buf + cvt->len_cvt * 3);
+
+ LOG_DEBUG_CONVERT("stereo", "5.1");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = src[0];
+ rf = src[1];
+ ce = (lf + rf) * 0.5f;
+ /* !!! FIXME: FL and FR may clip */
+ dst[0] = lf + (lf - ce); /* FL */
+ dst[1] = rf + (rf - ce); /* FR */
+ dst[2] = ce; /* FC */
+ dst[3] = 0; /* LFE (only meant for special LFE effects) */
+ dst[4] = lf; /* BL */
+ dst[5] = rf; /* BR */
+ }
+
+ cvt->len_cvt *= 3;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Upmix quad to a pseudo-5.1 stream */
+static void SDLCALL
+SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ float lf, rf, lb, rb, ce;
+ const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+ float *dst = (float *) (cvt->buf + cvt->len_cvt * 3 / 2);
+
+ LOG_DEBUG_CONVERT("quad", "5.1");
+ SDL_assert(format == AUDIO_F32SYS);
+ SDL_assert(cvt->len_cvt % (sizeof(float) * 4) == 0);
+
+ for (i = cvt->len_cvt / (sizeof(float) * 4); i; --i) {
+ dst -= 6;
+ src -= 4;
+ lf = src[0];
+ rf = src[1];
+ lb = src[2];
+ rb = src[3];
+ ce = (lf + rf) * 0.5f;
+ /* !!! FIXME: FL and FR may clip */
+ dst[0] = lf + (lf - ce); /* FL */
+ dst[1] = rf + (rf - ce); /* FR */
+ dst[2] = ce; /* FC */
+ dst[3] = 0; /* LFE (only meant for special LFE effects) */
+ dst[4] = lb; /* BL */
+ dst[5] = rb; /* BR */
+ }
+
+ cvt->len_cvt = cvt->len_cvt * 3 / 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Upmix stereo to a pseudo-4.0 stream (by duplication) */
+static void SDLCALL
+SDL_ConvertStereoToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+ float *dst = (float *) (cvt->buf + cvt->len_cvt * 2);
+ float lf, rf;
+ int i;
+
+ LOG_DEBUG_CONVERT("stereo", "quad");
+ SDL_assert(format == AUDIO_F32SYS);
+
+ for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) {
+ dst -= 4;
+ src -= 2;
+ lf = src[0];
+ rf = src[1];
+ dst[0] = lf; /* FL */
+ dst[1] = rf; /* FR */
+ dst[2] = lf; /* BL */
+ dst[3] = rf; /* BR */
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+/* Upmix 5.1 to 7.1 */
+static void SDLCALL
+SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ float lf, rf, lb, rb, ls, rs;
+ int i;
+ const float *src = (const float *) (cvt->buf + cvt->len_cvt);
+ float *dst = (float *) (cvt->buf + cvt->len_cvt * 4 / 3);
+
+ LOG_DEBUG_CONVERT("5.1", "7.1");
+ SDL_assert(format == AUDIO_F32SYS);
+ SDL_assert(cvt->len_cvt % (sizeof(float) * 6) == 0);
+
+ for (i = cvt->len_cvt / (sizeof(float) * 6); i; --i) {
+ dst -= 8;
+ src -= 6;
+ lf = src[0];
+ rf = src[1];
+ lb = src[4];
+ rb = src[5];
+ ls = (lf + lb) * 0.5f;
+ rs = (rf + rb) * 0.5f;
+ /* !!! FIXME: these four may clip */
+ lf += lf - ls;
+ rf += rf - ls;
+ lb += lb - ls;
+ rb += rb - ls;
+ dst[3] = src[3]; /* LFE */
+ dst[2] = src[2]; /* FC */
+ dst[7] = rs; /* SR */
+ dst[6] = ls; /* SL */
+ dst[5] = rb; /* BR */
+ dst[4] = lb; /* BL */
+ dst[1] = rf; /* FR */
+ dst[0] = lf; /* FL */
+ }
+
+ cvt->len_cvt = cvt->len_cvt * 4 / 3;
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+/* SDL's resampler uses a "bandlimited interpolation" algorithm:
+ https://ccrma.stanford.edu/~jos/resample/ */
+
+#define RESAMPLER_ZERO_CROSSINGS 5
+#define RESAMPLER_BITS_PER_SAMPLE 16
+#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1))
+#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1)
+
+/* This is a "modified" bessel function, so you can't use POSIX j0() */
+static double
+bessel(const double x)
+{
+ const double xdiv2 = x / 2.0;
+ double i0 = 1.0f;
+ double f = 1.0f;
+ int i = 1;
+
+ while (SDL_TRUE) {
+ const double diff = SDL_pow(xdiv2, i * 2) / SDL_pow(f, 2);
+ if (diff < 1.0e-21f) {
+ break;
+ }
+ i0 += diff;
+ i++;
+ f *= (double) i;
+ }
+
+ return i0;
+}
+
+/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */
+static void
+kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta)
+{
+ const int lenm1 = tablelen - 1;
+ const int lenm1div2 = lenm1 / 2;
+ int i;
+
+ table[0] = 1.0f;
+ for (i = 1; i < tablelen; i++) {
+ const double kaiser = bessel(beta * SDL_sqrt(1.0 - SDL_pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta);
+ table[tablelen - i] = (float) kaiser;
+ }
+
+ for (i = 1; i < tablelen; i++) {
+ const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI);
+ table[i] *= SDL_sinf(x) / x;
+ diffs[i - 1] = table[i] - table[i - 1];
+ }
+ diffs[lenm1] = 0.0f;
+}
+
+
+static SDL_SpinLock ResampleFilterSpinlock = 0;
+static float *ResamplerFilter = NULL;
+static float *ResamplerFilterDifference = NULL;
+
+int
+SDL_PrepareResampleFilter(void)
+{
+ SDL_AtomicLock(&ResampleFilterSpinlock);
+ if (!ResamplerFilter) {
+ /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */
+ const double dB = 80.0;
+ const double beta = 0.1102 * (dB - 8.7);
+ const size_t alloclen = RESAMPLER_FILTER_SIZE * sizeof (float);
+
+ ResamplerFilter = (float *) SDL_malloc(alloclen);
+ if (!ResamplerFilter) {
+ SDL_AtomicUnlock(&ResampleFilterSpinlock);
+ return SDL_OutOfMemory();
+ }
+
+ ResamplerFilterDifference = (float *) SDL_malloc(alloclen);
+ if (!ResamplerFilterDifference) {
+ SDL_free(ResamplerFilter);
+ ResamplerFilter = NULL;
+ SDL_AtomicUnlock(&ResampleFilterSpinlock);
+ return SDL_OutOfMemory();
+ }
+ kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta);
+ }
+ SDL_AtomicUnlock(&ResampleFilterSpinlock);
+ return 0;
+}
+
+void
+SDL_FreeResampleFilter(void)
+{
+ SDL_free(ResamplerFilter);
+ SDL_free(ResamplerFilterDifference);
+ ResamplerFilter = NULL;
+ ResamplerFilterDifference = NULL;
+}
+
+static int
+ResamplerPadding(const int inrate, const int outrate)
+{
+ if (inrate == outrate) {
+ return 0;
+ } else if (inrate > outrate) {
+ return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate)));
+ }
+ return RESAMPLER_SAMPLES_PER_ZERO_CROSSING;
+}
+
+/* lpadding and rpadding are expected to be buffers of (ResamplePadding(inrate, outrate) * chans * sizeof (float)) bytes. */
+static int
+SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
+ const float *lpadding, const float *rpadding,
+ const float *inbuf, const int inbuflen,
+ float *outbuf, const int outbuflen)
+{
+ const double finrate = (double) inrate;
+ const double outtimeincr = 1.0 / ((float) outrate);
+ const double ratio = ((float) outrate) / ((float) inrate);
+ const int paddinglen = ResamplerPadding(inrate, outrate);
+ const int framelen = chans * (int)sizeof (float);
+ const int inframes = inbuflen / framelen;
+ const int wantedoutframes = (int) ((inbuflen / framelen) * ratio); /* outbuflen isn't total to write, it's total available. */
+ const int maxoutframes = outbuflen / framelen;
+ const int outframes = SDL_min(wantedoutframes, maxoutframes);
+ float *dst = outbuf;
+ double outtime = 0.0;
+ int i, j, chan;
+
+ for (i = 0; i < outframes; i++) {
+ const int srcindex = (int) (outtime * inrate);
+ const double intime = ((double) srcindex) / finrate;
+ const double innexttime = ((double) (srcindex + 1)) / finrate;
+ const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime));
+ const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING);
+ const double interpolation2 = 1.0 - interpolation1;
+ const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING);
+
+ for (chan = 0; chan < chans; chan++) {
+ float outsample = 0.0f;
+
+ /* do this twice to calculate the sample, once for the "left wing" and then same for the right. */
+ /* !!! FIXME: do both wings in one loop */
+ for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) {
+ const int srcframe = srcindex - j;
+ /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */
+ const float insample = (srcframe < 0) ? lpadding[((paddinglen + srcframe) * chans) + chan] : inbuf[(srcframe * chans) + chan];
+ outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)])));
+ }
+
+ for (j = 0; (filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) {
+ const int srcframe = srcindex + 1 + j;
+ /* !!! FIXME: we can bubble this conditional out of here by doing a post loop. */
+ const float insample = (srcframe >= inframes) ? rpadding[((srcframe - inframes) * chans) + chan] : inbuf[(srcframe * chans) + chan];
+ outsample += (float)(insample * (ResamplerFilter[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation2 * ResamplerFilterDifference[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)])));
+ }
+ *(dst++) = outsample;
+ }
+
+ outtime += outtimeincr;
+ }
+
+ return outframes * chans * sizeof (float);
+}
+
+int
+SDL_ConvertAudio(SDL_AudioCVT * cvt)
+{
+ /* !!! FIXME: (cvt) should be const; stack-copy it here. */
+ /* !!! FIXME: (actually, we can't...len_cvt needs to be updated. Grr.) */
+
+ /* Make sure there's data to convert */
+ if (cvt->buf == NULL) {
+ return SDL_SetError("No buffer allocated for conversion");
+ }
+
+ /* Return okay if no conversion is necessary */
+ cvt->len_cvt = cvt->len;
+ if (cvt->filters[0] == NULL) {
+ return 0;
+ }
+
+ /* Set up the conversion and go! */
+ cvt->filter_index = 0;
+ cvt->filters[0] (cvt, cvt->src_format);
+ return 0;
+}
+
+static void SDLCALL
+SDL_Convert_Byteswap(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ printf("Converting byte order\n");
+#endif
+
+ switch (SDL_AUDIO_BITSIZE(format)) {
+ #define CASESWAP(b) \
+ case b: { \
+ Uint##b *ptr = (Uint##b *) cvt->buf; \
+ int i; \
+ for (i = cvt->len_cvt / sizeof (*ptr); i; --i, ++ptr) { \
+ *ptr = SDL_Swap##b(*ptr); \
+ } \
+ break; \
+ }
+
+ CASESWAP(16);
+ CASESWAP(32);
+ CASESWAP(64);
+
+ #undef CASESWAP
+
+ default: SDL_assert(!"unhandled byteswap datatype!"); break;
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ /* flip endian flag for data. */
+ if (format & SDL_AUDIO_MASK_ENDIAN) {
+ format &= ~SDL_AUDIO_MASK_ENDIAN;
+ } else {
+ format |= SDL_AUDIO_MASK_ENDIAN;
+ }
+ cvt->filters[cvt->filter_index](cvt, format);
+ }
+}
+
+static int
+SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter)
+{
+ if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) {
+ return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS);
+ }
+ if (filter == NULL) {
+ return SDL_SetError("Audio filter pointer is NULL");
+ }
+ cvt->filters[cvt->filter_index++] = filter;
+ cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */
+ return 0;
+}
+
+static int
+SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt)
+{
+ int retval = 0; /* 0 == no conversion necessary. */
+
+ if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) {
+ return -1;
+ }
+ retval = 1; /* added a converter. */
+ }
+
+ if (!SDL_AUDIO_ISFLOAT(src_fmt)) {
+ const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt);
+ const Uint16 dst_bitsize = 32;
+ SDL_AudioFilter filter = NULL;
+
+ switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
+ case AUDIO_S8: filter = SDL_Convert_S8_to_F32; break;
+ case AUDIO_U8: filter = SDL_Convert_U8_to_F32; break;
+ case AUDIO_S16: filter = SDL_Convert_S16_to_F32; break;
+ case AUDIO_U16: filter = SDL_Convert_U16_to_F32; break;
+ case AUDIO_S32: filter = SDL_Convert_S32_to_F32; break;
+ default: SDL_assert(!"Unexpected audio format!"); break;
+ }
+
+ if (!filter) {
+ return SDL_SetError("No conversion from source format to float available");
+ }
+
+ if (SDL_AddAudioCVTFilter(cvt, filter) < 0) {
+ return -1;
+ }
+ if (src_bitsize < dst_bitsize) {
+ const int mult = (dst_bitsize / src_bitsize);
+ cvt->len_mult *= mult;
+ cvt->len_ratio *= mult;
+ } else if (src_bitsize > dst_bitsize) {
+ cvt->len_ratio /= (src_bitsize / dst_bitsize);
+ }
+
+ retval = 1; /* added a converter. */
+ }
+
+ return retval;
+}
+
+static int
+SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt)
+{
+ int retval = 0; /* 0 == no conversion necessary. */
+
+ if (!SDL_AUDIO_ISFLOAT(dst_fmt)) {
+ const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt);
+ const Uint16 src_bitsize = 32;
+ SDL_AudioFilter filter = NULL;
+ switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
+ case AUDIO_S8: filter = SDL_Convert_F32_to_S8; break;
+ case AUDIO_U8: filter = SDL_Convert_F32_to_U8; break;
+ case AUDIO_S16: filter = SDL_Convert_F32_to_S16; break;
+ case AUDIO_U16: filter = SDL_Convert_F32_to_U16; break;
+ case AUDIO_S32: filter = SDL_Convert_F32_to_S32; break;
+ default: SDL_assert(!"Unexpected audio format!"); break;
+ }
+
+ if (!filter) {
+ return SDL_SetError("No conversion from float to destination format available");
+ }
+
+ if (SDL_AddAudioCVTFilter(cvt, filter) < 0) {
+ return -1;
+ }
+ if (src_bitsize < dst_bitsize) {
+ const int mult = (dst_bitsize / src_bitsize);
+ cvt->len_mult *= mult;
+ cvt->len_ratio *= mult;
+ } else if (src_bitsize > dst_bitsize) {
+ cvt->len_ratio /= (src_bitsize / dst_bitsize);
+ }
+ retval = 1; /* added a converter. */
+ }
+
+ if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) {
+ return -1;
+ }
+ retval = 1; /* added a converter. */
+ }
+
+ return retval;
+}
+
+static void
+SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
+{
+ /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator).
+ !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates,
+ !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */
+ const int inrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1];
+ const int outrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS];
+ const float *src = (const float *) cvt->buf;
+ const int srclen = cvt->len_cvt;
+ /*float *dst = (float *) cvt->buf;
+ const int dstlen = (cvt->len * cvt->len_mult);*/
+ /* !!! FIXME: remove this if we can get the resampler to work in-place again. */
+ float *dst = (float *) (cvt->buf + srclen);
+ const int dstlen = (cvt->len * cvt->len_mult) - srclen;
+ const int paddingsamples = (ResamplerPadding(inrate, outrate) * chans);
+ float *padding;
+
+ SDL_assert(format == AUDIO_F32SYS);
+
+ /* we keep no streaming state here, so pad with silence on both ends. */
+ padding = (float *) SDL_calloc(paddingsamples, sizeof (float));
+ if (!padding) {
+ SDL_OutOfMemory();
+ return;
+ }
+
+ cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen);
+
+ SDL_free(padding);
+
+ SDL_memmove(cvt->buf, dst, cvt->len_cvt); /* !!! FIXME: remove this if we can get the resampler to work in-place again. */
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, format);
+ }
+}
+
+/* !!! FIXME: We only have this macro salsa because SDL_AudioCVT doesn't
+ !!! FIXME: store channel info, so we have to have function entry
+ !!! FIXME: points for each supported channel count and multiple
+ !!! FIXME: vs arbitrary. When we rev the ABI, clean this up. */
+#define RESAMPLER_FUNCS(chans) \
+ static void SDLCALL \
+ SDL_ResampleCVT_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \
+ SDL_ResampleCVT(cvt, chans, format); \
+ }
+RESAMPLER_FUNCS(1)
+RESAMPLER_FUNCS(2)
+RESAMPLER_FUNCS(4)
+RESAMPLER_FUNCS(6)
+RESAMPLER_FUNCS(8)
+#undef RESAMPLER_FUNCS
+
+static SDL_AudioFilter
+ChooseCVTResampler(const int dst_channels)
+{
+ switch (dst_channels) {
+ case 1: return SDL_ResampleCVT_c1;
+ case 2: return SDL_ResampleCVT_c2;
+ case 4: return SDL_ResampleCVT_c4;
+ case 6: return SDL_ResampleCVT_c6;
+ case 8: return SDL_ResampleCVT_c8;
+ default: break;
+ }
+
+ return NULL;
+}
+
+static int
+SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels,
+ const int src_rate, const int dst_rate)
+{
+ SDL_AudioFilter filter;
+
+ if (src_rate == dst_rate) {
+ return 0; /* no conversion necessary. */
+ }
+
+ filter = ChooseCVTResampler(dst_channels);
+ if (filter == NULL) {
+ return SDL_SetError("No conversion available for these rates");
+ }
+
+ if (SDL_PrepareResampleFilter() < 0) {
+ return -1;
+ }
+
+ /* Update (cvt) with filter details... */
+ if (SDL_AddAudioCVTFilter(cvt, filter) < 0) {
+ return -1;
+ }
+
+ /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator).
+ !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates,
+ !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */
+ if (cvt->filter_index >= (SDL_AUDIOCVT_MAX_FILTERS-2)) {
+ return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS-2);
+ }
+ cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1] = (SDL_AudioFilter) (size_t) src_rate;
+ cvt->filters[SDL_AUDIOCVT_MAX_FILTERS] = (SDL_AudioFilter) (size_t) dst_rate;
+
+ if (src_rate < dst_rate) {
+ const double mult = ((double) dst_rate) / ((double) src_rate);
+ cvt->len_mult *= (int) SDL_ceil(mult);
+ cvt->len_ratio *= mult;
+ } else {
+ cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate);
+ }
+
+ /* !!! FIXME: remove this if we can get the resampler to work in-place again. */
+ /* the buffer is big enough to hold the destination now, but
+ we need it large enough to hold a separate scratch buffer. */
+ cvt->len_mult *= 2;
+
+ return 1; /* added a converter. */
+}
+
+static SDL_bool
+SDL_SupportedAudioFormat(const SDL_AudioFormat fmt)
+{
+ switch (fmt) {
+ case AUDIO_U8:
+ case AUDIO_S8:
+ case AUDIO_U16LSB:
+ case AUDIO_S16LSB:
+ case AUDIO_U16MSB:
+ case AUDIO_S16MSB:
+ case AUDIO_S32LSB:
+ case AUDIO_S32MSB:
+ case AUDIO_F32LSB:
+ case AUDIO_F32MSB:
+ return SDL_TRUE; /* supported. */
+
+ default:
+ break;
+ }
+
+ return SDL_FALSE; /* unsupported. */
+}
+
+static SDL_bool
+SDL_SupportedChannelCount(const int channels)
+{
+ switch (channels) {
+ case 1: /* mono */
+ case 2: /* stereo */
+ case 4: /* quad */
+ case 6: /* 5.1 */
+ case 8: /* 7.1 */
+ return SDL_TRUE; /* supported. */
+
+ default:
+ break;
+ }
+
+ return SDL_FALSE; /* unsupported. */
+}
+
+
+/* Creates a set of audio filters to convert from one format to another.
+ Returns 0 if no conversion is needed, 1 if the audio filter is set up,
+ or -1 if an error like invalid parameter, unsupported format, etc. occurred.
+*/
+
+int
+SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
+ SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate,
+ SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate)
+{
+ /* Sanity check target pointer */
+ if (cvt == NULL) {
+ return SDL_InvalidParamError("cvt");
+ }
+
+ /* Make sure we zero out the audio conversion before error checking */
+ SDL_zerop(cvt);
+
+ if (!SDL_SupportedAudioFormat(src_fmt)) {
+ return SDL_SetError("Invalid source format");
+ } else if (!SDL_SupportedAudioFormat(dst_fmt)) {
+ return SDL_SetError("Invalid destination format");
+ } else if (!SDL_SupportedChannelCount(src_channels)) {
+ return SDL_SetError("Invalid source channels");
+ } else if (!SDL_SupportedChannelCount(dst_channels)) {
+ return SDL_SetError("Invalid destination channels");
+ } else if (src_rate == 0) {
+ return SDL_SetError("Source rate is zero");
+ } else if (dst_rate == 0) {
+ return SDL_SetError("Destination rate is zero");
+ }
+
+#if DEBUG_CONVERT
+ printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
+ src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate);
+#endif
+
+ /* Start off with no conversion necessary */
+ cvt->src_format = src_fmt;
+ cvt->dst_format = dst_fmt;
+ cvt->needed = 0;
+ cvt->filter_index = 0;
+ SDL_zero(cvt->filters);
+ cvt->len_mult = 1;
+ cvt->len_ratio = 1.0;
+ cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);
+
+ /* Make sure we've chosen audio conversion functions (MMX, scalar, etc.) */
+ SDL_ChooseAudioConverters();
+
+ /* Type conversion goes like this now:
+ - byteswap to CPU native format first if necessary.
+ - convert to native Float32 if necessary.
+ - resample and change channel count if necessary.
+ - convert back to native format.
+ - byteswap back to foreign format if necessary.
+
+ The expectation is we can process data faster in float32
+ (possibly with SIMD), and making several passes over the same
+ buffer is likely to be CPU cache-friendly, avoiding the
+ biggest performance hit in modern times. Previously we had
+ (script-generated) custom converters for every data type and
+ it was a bloat on SDL compile times and final library size. */
+
+ /* see if we can skip float conversion entirely. */
+ if (src_rate == dst_rate && src_channels == dst_channels) {
+ if (src_fmt == dst_fmt) {
+ return 0;
+ }
+
+ /* just a byteswap needed? */
+ if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) {
+ return -1;
+ }
+ cvt->needed = 1;
+ return 1;
+ }
+ }
+
+ /* Convert data types, if necessary. Updates (cvt). */
+ if (SDL_BuildAudioTypeCVTToFloat(cvt, src_fmt) < 0) {
+ return -1; /* shouldn't happen, but just in case... */
+ }
+
+ /* Channel conversion */
+ if (src_channels < dst_channels) {
+ /* Upmixing */
+ /* Mono -> Stereo [-> ...] */
+ if ((src_channels == 1) && (dst_channels > 1)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertMonoToStereo) < 0) {
+ return -1;
+ }
+ cvt->len_mult *= 2;
+ src_channels = 2;
+ cvt->len_ratio *= 2;
+ }
+ /* [Mono ->] Stereo -> 5.1 [-> 7.1] */
+ if ((src_channels == 2) && (dst_channels >= 6)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoTo51) < 0) {
+ return -1;
+ }
+ src_channels = 6;
+ cvt->len_mult *= 3;
+ cvt->len_ratio *= 3;
+ }
+ /* Quad -> 5.1 [-> 7.1] */
+ if ((src_channels == 4) && (dst_channels >= 6)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadTo51) < 0) {
+ return -1;
+ }
+ src_channels = 6;
+ cvt->len_mult = (cvt->len_mult * 3 + 1) / 2;
+ cvt->len_ratio *= 1.5;
+ }
+ /* [[Mono ->] Stereo ->] 5.1 -> 7.1 */
+ if ((src_channels == 6) && (dst_channels == 8)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51To71) < 0) {
+ return -1;
+ }
+ src_channels = 8;
+ cvt->len_mult = (cvt->len_mult * 4 + 2) / 3;
+ /* Should be numerically exact with every valid input to this
+ function */
+ cvt->len_ratio = cvt->len_ratio * 4 / 3;
+ }
+ /* [Mono ->] Stereo -> Quad */
+ if ((src_channels == 2) && (dst_channels == 4)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoToQuad) < 0) {
+ return -1;
+ }
+ src_channels = 4;
+ cvt->len_mult *= 2;
+ cvt->len_ratio *= 2;
+ }
+ } else if (src_channels > dst_channels) {
+ /* Downmixing */
+ /* 7.1 -> 5.1 [-> Stereo [-> Mono]] */
+ /* 7.1 -> 5.1 [-> Quad] */
+ if ((src_channels == 8) && (dst_channels <= 6)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert71To51) < 0) {
+ return -1;
+ }
+ src_channels = 6;
+ cvt->len_ratio *= 0.75;
+ }
+ /* [7.1 ->] 5.1 -> Stereo [-> Mono] */
+ if ((src_channels == 6) && (dst_channels <= 2)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToStereo) < 0) {
+ return -1;
+ }
+ src_channels = 2;
+ cvt->len_ratio /= 3;
+ }
+ /* 5.1 -> Quad */
+ if ((src_channels == 6) && (dst_channels == 4)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToQuad) < 0) {
+ return -1;
+ }
+ src_channels = 4;
+ cvt->len_ratio = cvt->len_ratio * 2 / 3;
+ }
+ /* Quad -> Stereo [-> Mono] */
+ if ((src_channels == 4) && (dst_channels <= 2)) {
+ if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadToStereo) < 0) {
+ return -1;
+ }
+ src_channels = 2;
+ cvt->len_ratio /= 2;
+ }
+ /* [... ->] Stereo -> Mono */
+ if ((src_channels == 2) && (dst_channels == 1)) {
+ SDL_AudioFilter filter = NULL;
+
+ #if HAVE_SSE3_INTRINSICS
+ if (SDL_HasSSE3()) {
+ filter = SDL_ConvertStereoToMono_SSE3;
+ }
+ #endif
+
+ if (!filter) {
+ filter = SDL_ConvertStereoToMono;
+ }
+
+ if (SDL_AddAudioCVTFilter(cvt, filter) < 0) {
+ return -1;
+ }
+
+ src_channels = 1;
+ cvt->len_ratio /= 2;
+ }
+ }
+
+ if (src_channels != dst_channels) {
+ /* All combinations of supported channel counts should have been
+ handled by now, but let's be defensive */
+ return SDL_SetError("Invalid channel combination");
+ }
+
+ /* Do rate conversion, if necessary. Updates (cvt). */
+ if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) < 0) {
+ return -1; /* shouldn't happen, but just in case... */
+ }
+
+ /* Move to final data type. */
+ if (SDL_BuildAudioTypeCVTFromFloat(cvt, dst_fmt) < 0) {
+ return -1; /* shouldn't happen, but just in case... */
+ }
+
+ cvt->needed = (cvt->filter_index != 0);
+ return (cvt->needed);
+}
+
+typedef int (*SDL_ResampleAudioStreamFunc)(SDL_AudioStream *stream, const void *inbuf, const int inbuflen, void *outbuf, const int outbuflen);
+typedef void (*SDL_ResetAudioStreamResamplerFunc)(SDL_AudioStream *stream);
+typedef void (*SDL_CleanupAudioStreamResamplerFunc)(SDL_AudioStream *stream);
+
+struct _SDL_AudioStream
+{
+ SDL_AudioCVT cvt_before_resampling;
+ SDL_AudioCVT cvt_after_resampling;
+ SDL_DataQueue *queue;
+ SDL_bool first_run;
+ Uint8 *staging_buffer;
+ int staging_buffer_size;
+ int staging_buffer_filled;
+ Uint8 *work_buffer_base; /* maybe unaligned pointer from SDL_realloc(). */
+ int work_buffer_len;
+ int src_sample_frame_size;
+ SDL_AudioFormat src_format;
+ Uint8 src_channels;
+ int src_rate;
+ int dst_sample_frame_size;
+ SDL_AudioFormat dst_format;
+ Uint8 dst_channels;
+ int dst_rate;
+ double rate_incr;
+ Uint8 pre_resample_channels;
+ int packetlen;
+ int resampler_padding_samples;
+ float *resampler_padding;
+ void *resampler_state;
+ SDL_ResampleAudioStreamFunc resampler_func;
+ SDL_ResetAudioStreamResamplerFunc reset_resampler_func;
+ SDL_CleanupAudioStreamResamplerFunc cleanup_resampler_func;
+};
+
+static Uint8 *
+EnsureStreamBufferSize(SDL_AudioStream *stream, const int newlen)
+{
+ Uint8 *ptr;
+ size_t offset;
+
+ if (stream->work_buffer_len >= newlen) {
+ ptr = stream->work_buffer_base;
+ } else {
+ ptr = (Uint8 *) SDL_realloc(stream->work_buffer_base, newlen + 32);
+ if (!ptr) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ /* Make sure we're aligned to 16 bytes for SIMD code. */
+ stream->work_buffer_base = ptr;
+ stream->work_buffer_len = newlen;
+ }
+
+ offset = ((size_t) ptr) & 15;
+ return offset ? ptr + (16 - offset) : ptr;
+}
+
+#ifdef HAVE_LIBSAMPLERATE_H
+static int
+SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen)
+{
+ const float *inbuf = (const float *) _inbuf;
+ float *outbuf = (float *) _outbuf;
+ const int framelen = sizeof(float) * stream->pre_resample_channels;
+ SRC_STATE *state = (SRC_STATE *)stream->resampler_state;
+ SRC_DATA data;
+ int result;
+
+ SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */
+
+ data.data_in = (float *)inbuf; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */
+ data.input_frames = inbuflen / framelen;
+ data.input_frames_used = 0;
+
+ data.data_out = outbuf;
+ data.output_frames = outbuflen / framelen;
+
+ data.end_of_input = 0;
+ data.src_ratio = stream->rate_incr;
+
+ result = SRC_src_process(state, &data);
+ if (result != 0) {
+ SDL_SetError("src_process() failed: %s", SRC_src_strerror(result));
+ return 0;
+ }
+
+ /* If this fails, we need to store them off somewhere */
+ SDL_assert(data.input_frames_used == data.input_frames);
+
+ return data.output_frames_gen * (sizeof(float) * stream->pre_resample_channels);
+}
+
+static void
+SDL_ResetAudioStreamResampler_SRC(SDL_AudioStream *stream)
+{
+ SRC_src_reset((SRC_STATE *)stream->resampler_state);
+}
+
+static void
+SDL_CleanupAudioStreamResampler_SRC(SDL_AudioStream *stream)
+{
+ SRC_STATE *state = (SRC_STATE *)stream->resampler_state;
+ if (state) {
+ SRC_src_delete(state);
+ }
+
+ stream->resampler_state = NULL;
+ stream->resampler_func = NULL;
+ stream->reset_resampler_func = NULL;
+ stream->cleanup_resampler_func = NULL;
+}
+
+static SDL_bool
+SetupLibSampleRateResampling(SDL_AudioStream *stream)
+{
+ int result = 0;
+ SRC_STATE *state = NULL;
+
+ if (SRC_available) {
+ state = SRC_src_new(SRC_converter, stream->pre_resample_channels, &result);
+ if (!state) {
+ SDL_SetError("src_new() failed: %s", SRC_src_strerror(result));
+ }
+ }
+
+ if (!state) {
+ SDL_CleanupAudioStreamResampler_SRC(stream);
+ return SDL_FALSE;
+ }
+
+ stream->resampler_state = state;
+ stream->resampler_func = SDL_ResampleAudioStream_SRC;
+ stream->reset_resampler_func = SDL_ResetAudioStreamResampler_SRC;
+ stream->cleanup_resampler_func = SDL_CleanupAudioStreamResampler_SRC;
+
+ return SDL_TRUE;
+}
+#endif /* HAVE_LIBSAMPLERATE_H */
+
+
+static int
+SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen)
+{
+ const Uint8 *inbufend = ((const Uint8 *) _inbuf) + inbuflen;
+ const float *inbuf = (const float *) _inbuf;
+ float *outbuf = (float *) _outbuf;
+ const int chans = (int) stream->pre_resample_channels;
+ const int inrate = stream->src_rate;
+ const int outrate = stream->dst_rate;
+ const int paddingsamples = stream->resampler_padding_samples;
+ const int paddingbytes = paddingsamples * sizeof (float);
+ float *lpadding = (float *) stream->resampler_state;
+ const float *rpadding = (const float *) inbufend; /* we set this up so there are valid padding samples at the end of the input buffer. */
+ const int cpy = SDL_min(inbuflen, paddingbytes);
+ int retval;
+
+ SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */
+
+ retval = SDL_ResampleAudio(chans, inrate, outrate, lpadding, rpadding, inbuf, inbuflen, outbuf, outbuflen);
+
+ /* update our left padding with end of current input, for next run. */
+ SDL_memcpy((lpadding + paddingsamples) - (cpy / sizeof (float)), inbufend - cpy, cpy);
+ return retval;
+}
+
+static void
+SDL_ResetAudioStreamResampler(SDL_AudioStream *stream)
+{
+ /* set all the padding to silence. */
+ const int len = stream->resampler_padding_samples;
+ SDL_memset(stream->resampler_state, '\0', len * sizeof (float));
+}
+
+static void
+SDL_CleanupAudioStreamResampler(SDL_AudioStream *stream)
+{
+ SDL_free(stream->resampler_state);
+}
+
+SDL_AudioStream *
+SDL_NewAudioStream(const SDL_AudioFormat src_format,
+ const Uint8 src_channels,
+ const int src_rate,
+ const SDL_AudioFormat dst_format,
+ const Uint8 dst_channels,
+ const int dst_rate)
+{
+ const int packetlen = 4096; /* !!! FIXME: good enough for now. */
+ Uint8 pre_resample_channels;
+ SDL_AudioStream *retval;
+
+ retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream));
+ if (!retval) {
+ return NULL;
+ }
+
+ /* If increasing channels, do it after resampling, since we'd just
+ do more work to resample duplicate channels. If we're decreasing, do
+ it first so we resample the interpolated data instead of interpolating
+ the resampled data (!!! FIXME: decide if that works in practice, though!). */
+ pre_resample_channels = SDL_min(src_channels, dst_channels);
+
+ retval->first_run = SDL_TRUE;
+ retval->src_sample_frame_size = (SDL_AUDIO_BITSIZE(src_format) / 8) * src_channels;
+ retval->src_format = src_format;
+ retval->src_channels = src_channels;
+ retval->src_rate = src_rate;
+ retval->dst_sample_frame_size = (SDL_AUDIO_BITSIZE(dst_format) / 8) * dst_channels;
+ retval->dst_format = dst_format;
+ retval->dst_channels = dst_channels;
+ retval->dst_rate = dst_rate;
+ retval->pre_resample_channels = pre_resample_channels;
+ retval->packetlen = packetlen;
+ retval->rate_incr = ((double) dst_rate) / ((double) src_rate);
+ retval->resampler_padding_samples = ResamplerPadding(retval->src_rate, retval->dst_rate) * pre_resample_channels;
+ retval->resampler_padding = (float *) SDL_calloc(retval->resampler_padding_samples, sizeof (float));
+
+ if (retval->resampler_padding == NULL) {
+ SDL_FreeAudioStream(retval);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ retval->staging_buffer_size = ((retval->resampler_padding_samples / retval->pre_resample_channels) * retval->src_sample_frame_size);
+ if (retval->staging_buffer_size > 0) {
+ retval->staging_buffer = (Uint8 *) SDL_malloc(retval->staging_buffer_size);
+ if (retval->staging_buffer == NULL) {
+ SDL_FreeAudioStream(retval);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ }
+
+ /* Not resampling? It's an easy conversion (and maybe not even that!) */
+ if (src_rate == dst_rate) {
+ retval->cvt_before_resampling.needed = SDL_FALSE;
+ if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, src_format, src_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) {
+ SDL_FreeAudioStream(retval);
+ return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
+ }
+ } else {
+ /* Don't resample at first. Just get us to Float32 format. */
+ /* !!! FIXME: convert to int32 on devices without hardware float. */
+ if (SDL_BuildAudioCVT(&retval->cvt_before_resampling, src_format, src_channels, src_rate, AUDIO_F32SYS, pre_resample_channels, src_rate) < 0) {
+ SDL_FreeAudioStream(retval);
+ return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
+ }
+
+#ifdef HAVE_LIBSAMPLERATE_H
+ SetupLibSampleRateResampling(retval);
+#endif
+
+ if (!retval->resampler_func) {
+ retval->resampler_state = SDL_calloc(retval->resampler_padding_samples, sizeof (float));
+ if (!retval->resampler_state) {
+ SDL_FreeAudioStream(retval);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ if (SDL_PrepareResampleFilter() < 0) {
+ SDL_free(retval->resampler_state);
+ retval->resampler_state = NULL;
+ SDL_FreeAudioStream(retval);
+ return NULL;
+ }
+
+ retval->resampler_func = SDL_ResampleAudioStream;
+ retval->reset_resampler_func = SDL_ResetAudioStreamResampler;
+ retval->cleanup_resampler_func = SDL_CleanupAudioStreamResampler;
+ }
+
+ /* Convert us to the final format after resampling. */
+ if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, AUDIO_F32SYS, pre_resample_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) {
+ SDL_FreeAudioStream(retval);
+ return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
+ }
+ }
+
+ retval->queue = SDL_NewDataQueue(packetlen, packetlen * 2);
+ if (!retval->queue) {
+ SDL_FreeAudioStream(retval);
+ return NULL; /* SDL_NewDataQueue should have called SDL_SetError. */
+ }
+
+ return retval;
+}
+
+static int
+SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, int len, int *maxputbytes)
+{
+ int buflen = len;
+ int workbuflen;
+ Uint8 *workbuf;
+ Uint8 *resamplebuf = NULL;
+ int resamplebuflen = 0;
+ int neededpaddingbytes;
+ int paddingbytes;
+
+ /* !!! FIXME: several converters can take advantage of SIMD, but only
+ !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize()
+ !!! FIXME: guarantees the buffer will align, but the
+ !!! FIXME: converters will iterate over the data backwards if
+ !!! FIXME: the output grows, and this means we won't align if buflen
+ !!! FIXME: isn't a multiple of 16. In these cases, we should chop off
+ !!! FIXME: a few samples at the end and convert them separately. */
+
+ /* no padding prepended on first run. */
+ neededpaddingbytes = stream->resampler_padding_samples * sizeof (float);
+ paddingbytes = stream->first_run ? 0 : neededpaddingbytes;
+ stream->first_run = SDL_FALSE;
+
+ /* Make sure the work buffer can hold all the data we need at once... */
+ workbuflen = buflen;
+ if (stream->cvt_before_resampling.needed) {
+ workbuflen *= stream->cvt_before_resampling.len_mult;
+ }
+
+ if (stream->dst_rate != stream->src_rate) {
+ /* resamples can't happen in place, so make space for second buf. */
+ const int framesize = stream->pre_resample_channels * sizeof (float);
+ const int frames = workbuflen / framesize;
+ resamplebuflen = ((int) SDL_ceil(frames * stream->rate_incr)) * framesize;
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: will resample %d bytes to %d (ratio=%.6f)\n", workbuflen, resamplebuflen, stream->rate_incr);
+ #endif
+ workbuflen += resamplebuflen;
+ }
+
+ if (stream->cvt_after_resampling.needed) {
+ /* !!! FIXME: buffer might be big enough already? */
+ workbuflen *= stream->cvt_after_resampling.len_mult;
+ }
+
+ workbuflen += neededpaddingbytes;
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: Putting %d bytes of preconverted audio, need %d byte work buffer\n", buflen, workbuflen);
+ #endif
+
+ workbuf = EnsureStreamBufferSize(stream, workbuflen);
+ if (!workbuf) {
+ return -1; /* probably out of memory. */
+ }
+
+ resamplebuf = workbuf; /* default if not resampling. */
+
+ SDL_memcpy(workbuf + paddingbytes, buf, buflen);
+
+ if (stream->cvt_before_resampling.needed) {
+ stream->cvt_before_resampling.buf = workbuf + paddingbytes;
+ stream->cvt_before_resampling.len = buflen;
+ if (SDL_ConvertAudio(&stream->cvt_before_resampling) == -1) {
+ return -1; /* uhoh! */
+ }
+ buflen = stream->cvt_before_resampling.len_cvt;
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: After initial conversion we have %d bytes\n", buflen);
+ #endif
+ }
+
+ if (stream->dst_rate != stream->src_rate) {
+ /* save off some samples at the end; they are used for padding now so
+ the resampler is coherent and then used at the start of the next
+ put operation. Prepend last put operation's padding, too. */
+
+ /* prepend prior put's padding. :P */
+ if (paddingbytes) {
+ SDL_memcpy(workbuf, stream->resampler_padding, paddingbytes);
+ buflen += paddingbytes;
+ }
+
+ /* save off the data at the end for the next run. */
+ SDL_memcpy(stream->resampler_padding, workbuf + (buflen - neededpaddingbytes), neededpaddingbytes);
+
+ resamplebuf = workbuf + buflen; /* skip to second piece of workbuf. */
+ SDL_assert(buflen >= neededpaddingbytes);
+ if (buflen > neededpaddingbytes) {
+ buflen = stream->resampler_func(stream, workbuf, buflen - neededpaddingbytes, resamplebuf, resamplebuflen);
+ } else {
+ buflen = 0;
+ }
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: After resampling we have %d bytes\n", buflen);
+ #endif
+ }
+
+ if (stream->cvt_after_resampling.needed && (buflen > 0)) {
+ stream->cvt_after_resampling.buf = resamplebuf;
+ stream->cvt_after_resampling.len = buflen;
+ if (SDL_ConvertAudio(&stream->cvt_after_resampling) == -1) {
+ return -1; /* uhoh! */
+ }
+ buflen = stream->cvt_after_resampling.len_cvt;
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: After final conversion we have %d bytes\n", buflen);
+ #endif
+ }
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: Final output is %d bytes\n", buflen);
+ #endif
+
+ if (maxputbytes) {
+ const int maxbytes = *maxputbytes;
+ if (buflen > maxbytes)
+ buflen = maxbytes;
+ *maxputbytes -= buflen;
+ }
+
+ /* resamplebuf holds the final output, even if we didn't resample. */
+ return buflen ? SDL_WriteToDataQueue(stream->queue, resamplebuf, buflen) : 0;
+}
+
+int
+SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len)
+{
+ /* !!! FIXME: several converters can take advantage of SIMD, but only
+ !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize()
+ !!! FIXME: guarantees the buffer will align, but the
+ !!! FIXME: converters will iterate over the data backwards if
+ !!! FIXME: the output grows, and this means we won't align if buflen
+ !!! FIXME: isn't a multiple of 16. In these cases, we should chop off
+ !!! FIXME: a few samples at the end and convert them separately. */
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen);
+ #endif
+
+ if (!stream) {
+ return SDL_InvalidParamError("stream");
+ } else if (!buf) {
+ return SDL_InvalidParamError("buf");
+ } else if (len == 0) {
+ return 0; /* nothing to do. */
+ } else if ((len % stream->src_sample_frame_size) != 0) {
+ return SDL_SetError("Can't add partial sample frames");
+ }
+
+ if (!stream->cvt_before_resampling.needed &&
+ (stream->dst_rate == stream->src_rate) &&
+ !stream->cvt_after_resampling.needed) {
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: no conversion needed at all, queueing %d bytes.\n", len);
+ #endif
+ return SDL_WriteToDataQueue(stream->queue, buf, len);
+ }
+
+ while (len > 0) {
+ int amount;
+
+ /* If we don't have a staging buffer or we're given enough data that
+ we don't need to store it for later, skip the staging process.
+ */
+ if (!stream->staging_buffer_filled && len >= stream->staging_buffer_size) {
+ return SDL_AudioStreamPutInternal(stream, buf, len, NULL);
+ }
+
+ /* If there's not enough data to fill the staging buffer, just save it */
+ if ((stream->staging_buffer_filled + len) < stream->staging_buffer_size) {
+ SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, len);
+ stream->staging_buffer_filled += len;
+ return 0;
+ }
+
+ /* Fill the staging buffer, process it, and continue */
+ amount = (stream->staging_buffer_size - stream->staging_buffer_filled);
+ SDL_assert(amount > 0);
+ SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, amount);
+ stream->staging_buffer_filled = 0;
+ if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, NULL) < 0) {
+ return -1;
+ }
+ buf = (void *)((Uint8 *)buf + amount);
+ len -= amount;
+ }
+ return 0;
+}
+
+int SDL_AudioStreamFlush(SDL_AudioStream *stream)
+{
+ if (!stream) {
+ return SDL_InvalidParamError("stream");
+ }
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: flushing! staging_buffer_filled=%d bytes\n", stream->staging_buffer_filled);
+ #endif
+
+ /* shouldn't use a staging buffer if we're not resampling. */
+ SDL_assert((stream->dst_rate != stream->src_rate) || (stream->staging_buffer_filled == 0));
+
+ if (stream->staging_buffer_filled > 0) {
+ /* push the staging buffer + silence. We need to flush out not just
+ the staging buffer, but the piece that the stream was saving off
+ for right-side resampler padding. */
+ const SDL_bool first_run = stream->first_run;
+ const int filled = stream->staging_buffer_filled;
+ int actual_input_frames = filled / stream->src_sample_frame_size;
+ if (!first_run)
+ actual_input_frames += stream->resampler_padding_samples / stream->pre_resample_channels;
+
+ if (actual_input_frames > 0) { /* don't bother if nothing to flush. */
+ /* This is how many bytes we're expecting without silence appended. */
+ int flush_remaining = ((int) SDL_ceil(actual_input_frames * stream->rate_incr)) * stream->dst_sample_frame_size;
+
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: flushing with padding to get max %d bytes!\n", flush_remaining);
+ #endif
+
+ SDL_memset(stream->staging_buffer + filled, '\0', stream->staging_buffer_size - filled);
+ if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) {
+ return -1;
+ }
+
+ /* we have flushed out (or initially filled) the pending right-side
+ resampler padding, but we need to push more silence to guarantee
+ the staging buffer is fully flushed out, too. */
+ SDL_memset(stream->staging_buffer, '\0', filled);
+ if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) {
+ return -1;
+ }
+ }
+ }
+
+ stream->staging_buffer_filled = 0;
+ stream->first_run = SDL_TRUE;
+
+ return 0;
+}
+
+/* get converted/resampled data from the stream */
+int
+SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len)
+{
+ #if DEBUG_AUDIOSTREAM
+ printf("AUDIOSTREAM: want to get %d converted bytes\n", len);
+ #endif
+
+ if (!stream) {
+ return SDL_InvalidParamError("stream");
+ } else if (!buf) {
+ return SDL_InvalidParamError("buf");
+ } else if (len <= 0) {
+ return 0; /* nothing to do. */
+ } else if ((len % stream->dst_sample_frame_size) != 0) {
+ return SDL_SetError("Can't request partial sample frames");
+ }
+
+ return (int) SDL_ReadFromDataQueue(stream->queue, buf, len);
+}
+
+/* number of converted/resampled bytes available */
+int
+SDL_AudioStreamAvailable(SDL_AudioStream *stream)
+{
+ return stream ? (int) SDL_CountDataQueue(stream->queue) : 0;
+}
+
+void
+SDL_AudioStreamClear(SDL_AudioStream *stream)
+{
+ if (!stream) {
+ SDL_InvalidParamError("stream");
+ } else {
+ SDL_ClearDataQueue(stream->queue, stream->packetlen * 2);
+ if (stream->reset_resampler_func) {
+ stream->reset_resampler_func(stream);
+ }
+ stream->first_run = SDL_TRUE;
+ stream->staging_buffer_filled = 0;
+ }
+}
+
+/* dispose of a stream */
+void
+SDL_FreeAudioStream(SDL_AudioStream *stream)
+{
+ if (stream) {
+ if (stream->cleanup_resampler_func) {
+ stream->cleanup_resampler_func(stream);
+ }
+ SDL_FreeDataQueue(stream->queue);
+ SDL_free(stream->staging_buffer);
+ SDL_free(stream->work_buffer_base);
+ SDL_free(stream->resampler_padding);
+ SDL_free(stream);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/audio/SDL_audiodev.c b/src/3rdparty/SDL2/src/audio/SDL_audiodev.c
new file mode 100644
index 0000000..d0b94a0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_audiodev.c
@@ -0,0 +1,124 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Get the name of the audio device we use for output */
+
+#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h> /* For close() */
+
+#include "SDL_stdinc.h"
+#include "SDL_audiodev_c.h"
+
+#ifndef _PATH_DEV_DSP
+#if defined(__NETBSD__) || defined(__OPENBSD__)
+#define _PATH_DEV_DSP "/dev/audio"
+#else
+#define _PATH_DEV_DSP "/dev/dsp"
+#endif
+#endif
+#ifndef _PATH_DEV_DSP24
+#define _PATH_DEV_DSP24 "/dev/sound/dsp"
+#endif
+#ifndef _PATH_DEV_AUDIO
+#define _PATH_DEV_AUDIO "/dev/audio"
+#endif
+
+static void
+test_device(const int iscapture, const char *fname, int flags, int (*test) (int fd))
+{
+ struct stat sb;
+ if ((stat(fname, &sb) == 0) && (S_ISCHR(sb.st_mode))) {
+ const int audio_fd = open(fname, flags, 0);
+ if (audio_fd >= 0) {
+ const int okay = test(audio_fd);
+ close(audio_fd);
+ if (okay) {
+ static size_t dummyhandle = 0;
+ dummyhandle++;
+ SDL_assert(dummyhandle != 0);
+ SDL_AddAudioDevice(iscapture, fname, (void *) dummyhandle);
+ }
+ }
+ }
+}
+
+static int
+test_stub(int fd)
+{
+ return 1;
+}
+
+static void
+SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (*test)(int))
+{
+ const int flags = iscapture ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT;
+ const char *audiodev;
+ char audiopath[1024];
+
+ if (test == NULL)
+ test = test_stub;
+
+ /* Figure out what our audio device is */
+ if (((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) &&
+ ((audiodev = SDL_getenv("AUDIODEV")) == NULL)) {
+ if (classic) {
+ audiodev = _PATH_DEV_AUDIO;
+ } else {
+ struct stat sb;
+
+ /* Added support for /dev/sound/\* in Linux 2.4 */
+ if (((stat("/dev/sound", &sb) == 0) && S_ISDIR(sb.st_mode))
+ && ((stat(_PATH_DEV_DSP24, &sb) == 0)
+ && S_ISCHR(sb.st_mode))) {
+ audiodev = _PATH_DEV_DSP24;
+ } else {
+ audiodev = _PATH_DEV_DSP;
+ }
+ }
+ }
+ test_device(iscapture, audiodev, flags, test);
+
+ if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) {
+ int instance = 0;
+ while (instance <= 64) {
+ SDL_snprintf(audiopath, SDL_arraysize(audiopath),
+ "%s%d", audiodev, instance);
+ instance++;
+ test_device(iscapture, audiopath, flags, test);
+ }
+ }
+}
+
+void
+SDL_EnumUnixAudioDevices(const int classic, int (*test)(int))
+{
+ SDL_EnumUnixAudioDevices_Internal(SDL_TRUE, classic, test);
+ SDL_EnumUnixAudioDevices_Internal(SDL_FALSE, classic, test);
+}
+
+#endif /* Audio driver selection */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_audiodev_c.h b/src/3rdparty/SDL2/src/audio/SDL_audiodev_c.h
new file mode 100644
index 0000000..15928d1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_audiodev_c.h
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL.h"
+#include "../SDL_internal.h"
+#include "SDL_sysaudio.h"
+
+/* Open the audio device for playback, and don't block if busy */
+/* #define USE_BLOCKING_WRITES */
+
+#ifdef USE_BLOCKING_WRITES
+#define OPEN_FLAGS_OUTPUT O_WRONLY
+#define OPEN_FLAGS_INPUT O_RDONLY
+#else
+#define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK)
+#define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK)
+#endif
+
+extern void SDL_EnumUnixAudioDevices(const int classic, int (*test)(int));
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_audiotypecvt.c b/src/3rdparty/SDL2/src/audio/SDL_audiotypecvt.c
new file mode 100644
index 0000000..2fbd916
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_audiotypecvt.c
@@ -0,0 +1,829 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../SDL_internal.h"
+#include "SDL_audio.h"
+#include "SDL_audio_c.h"
+#include "SDL_cpuinfo.h"
+#include "SDL_assert.h"
+
+/* !!! FIXME: write NEON code. */
+#define HAVE_NEON_INTRINSICS 0
+
+#ifdef __SSE2__
+#define HAVE_SSE2_INTRINSICS 1
+#endif
+
+#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */
+#elif __MACOSX__ && HAVE_SSE2_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */
+#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */
+#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */
+#endif
+
+/* Set to zero if platform is guaranteed to use a SIMD codepath here. */
+#ifndef NEED_SCALAR_CONVERTER_FALLBACKS
+#define NEED_SCALAR_CONVERTER_FALLBACKS 1
+#endif
+
+/* Function pointers set to a CPU-specific implementation. */
+SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL;
+SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL;
+
+
+#define DIVBY128 0.0078125f
+#define DIVBY32768 0.000030517578125f
+#define DIVBY2147483648 0.00000000046566128730773926
+
+
+#if NEED_SCALAR_CONVERTER_FALLBACKS
+static void SDLCALL
+SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
+
+ for (i = cvt->len_cvt; i; --i, --src, --dst) {
+ *dst = ((float) *src) * DIVBY128;
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32");
+
+ for (i = cvt->len_cvt; i; --i, --src, --dst) {
+ *dst = (((float) *src) * DIVBY128) - 1.0f;
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32");
+
+ for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
+ *dst = ((float) *src) * DIVBY32768;
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32");
+
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ *dst = (((float) *src) * DIVBY32768) - 1.0f;
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Sint32 *src = (const Sint32 *) cvt->buf;
+ float *dst = (float *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32");
+
+ for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
+ *dst = (float) (((double) *src) * DIVBY2147483648);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
+
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float sample = *src;
+ if (sample > 1.0f) {
+ *dst = 127;
+ } else if (sample < -1.0f) {
+ *dst = -127;
+ } else {
+ *dst = (Sint8)(sample * 127.0f);
+ }
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8");
+
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float sample = *src;
+ if (sample > 1.0f) {
+ *dst = 255;
+ } else if (sample < -1.0f) {
+ *dst = 0;
+ } else {
+ *dst = (Uint8)((sample + 1.0f) * 127.0f);
+ }
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
+
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float sample = *src;
+ if (sample > 1.0f) {
+ *dst = 32767;
+ } else if (sample < -1.0f) {
+ *dst = -32767;
+ } else {
+ *dst = (Sint16)(sample * 32767.0f);
+ }
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16");
+
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float sample = *src;
+ if (sample > 1.0f) {
+ *dst = 65534;
+ } else if (sample < -1.0f) {
+ *dst = 0;
+ } else {
+ *dst = (Uint16)((sample + 1.0f) * 32767.0f);
+ }
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
+
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float sample = *src;
+ if (sample > 1.0f) {
+ *dst = 2147483647;
+ } else if (sample < -1.0f) {
+ *dst = -2147483647;
+ } else {
+ *dst = (Sint32)((double)sample * 2147483647.0);
+ }
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
+ }
+}
+#endif
+
+
+#if HAVE_SSE2_INTRINSICS
+static void SDLCALL
+SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+ for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) {
+ *dst = ((float) *src) * DIVBY128;
+ }
+
+ src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128i *mmsrc = (const __m128i *) src;
+ const __m128i zero = _mm_setzero_si128();
+ const __m128 divby128 = _mm_set1_ps(DIVBY128);
+ while (i >= 16) { /* 16 * 8-bit */
+ const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 sint8 into an XMM register. */
+ /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */
+ const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8);
+ /* right-shift-sign-extend gets us sint16 with the other set of values. */
+ const __m128i shorts2 = _mm_srai_epi16(bytes, 8);
+ /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */
+ const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128);
+ const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128);
+ const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128);
+ const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128);
+ /* Interleave back into correct order, store. */
+ _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2));
+ _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2));
+ _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4));
+ _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4));
+ i -= 16; mmsrc--; dst -= 16;
+ }
+
+ src = (const Sint8 *) mmsrc;
+ }
+
+ src += 15; dst += 15; /* adjust for any scalar finishing. */
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = ((float) *src) * DIVBY128;
+ i--; src--; dst--;
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+ for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) {
+ *dst = (((float) *src) * DIVBY128) - 1.0f;
+ }
+
+ src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128i *mmsrc = (const __m128i *) src;
+ const __m128i zero = _mm_setzero_si128();
+ const __m128 divby128 = _mm_set1_ps(DIVBY128);
+ const __m128 minus1 = _mm_set1_ps(-1.0f);
+ while (i >= 16) { /* 16 * 8-bit */
+ const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 uint8 into an XMM register. */
+ /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */
+ const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8);
+ /* right-shift-zero-extend gets us uint16 with the other set of values. */
+ const __m128i shorts2 = _mm_srli_epi16(bytes, 8);
+ /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */
+ /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */
+ const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1);
+ const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1);
+ const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1);
+ const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1);
+ /* Interleave back into correct order, store. */
+ _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2));
+ _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2));
+ _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4));
+ _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4));
+ i -= 16; mmsrc--; dst -= 16;
+ }
+
+ src = (const Uint8 *) mmsrc;
+ }
+
+ src += 15; dst += 15; /* adjust for any scalar finishing. */
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (((float) *src) * DIVBY128) - 1.0f;
+ i--; src--; dst--;
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+ for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) {
+ *dst = ((float) *src) * DIVBY32768;
+ }
+
+ src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
+ while (i >= 8) { /* 8 * 16-bit */
+ const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */
+ /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */
+ const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16);
+ /* right-shift-sign-extend gets us sint32 with the other set of values. */
+ const __m128i b = _mm_srai_epi32(ints, 16);
+ /* Interleave these back into the right order, convert to float, multiply, store. */
+ _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768));
+ _mm_store_ps(dst+4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768));
+ i -= 8; src -= 8; dst -= 8;
+ }
+ }
+
+ src += 7; dst += 7; /* adjust for any scalar finishing. */
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = ((float) *src) * DIVBY32768;
+ i--; src--; dst--;
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
+ for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) {
+ *dst = (((float) *src) * DIVBY32768) - 1.0f;
+ }
+
+ src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
+ const __m128 minus1 = _mm_set1_ps(1.0f);
+ while (i >= 8) { /* 8 * 16-bit */
+ const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */
+ /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */
+ const __m128i a = _mm_srli_epi32(_mm_slli_epi32(ints, 16), 16);
+ /* right-shift-sign-extend gets us sint32 with the other set of values. */
+ const __m128i b = _mm_srli_epi32(ints, 16);
+ /* Interleave these back into the right order, convert to float, multiply, store. */
+ _mm_store_ps(dst, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768), minus1));
+ _mm_store_ps(dst+4, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768), minus1));
+ i -= 8; src -= 8; dst -= 8;
+ }
+ }
+
+ src += 7; dst += 7; /* adjust for any scalar finishing. */
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (((float) *src) * DIVBY32768) - 1.0f;
+ i--; src--; dst--;
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+#if defined(__GNUC__) && (__GNUC__ < 4)
+/* these were added as of gcc-4.0: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19418 */
+static inline __m128 _mm_castsi128_ps(__m128i __A) {
+ return (__m128) __A;
+}
+static inline __m128i _mm_castps_si128(__m128 __A) {
+ return (__m128i) __A;
+}
+#endif
+
+static void SDLCALL
+SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const Sint32 *src = (const Sint32 *) cvt->buf;
+ float *dst = (float *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes */
+ for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+ *dst = (float) (((double) *src) * DIVBY2147483648);
+ }
+
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+ SDL_assert(!i || ((((size_t) src) & 15) == 0));
+
+ {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128d divby2147483648 = _mm_set1_pd(DIVBY2147483648);
+ const __m128i *mmsrc = (const __m128i *) src;
+ while (i >= 4) { /* 4 * sint32 */
+ const __m128i ints = _mm_load_si128(mmsrc);
+ /* bitshift the whole register over, so _mm_cvtepi32_pd can read the top ints in the bottom of the vector. */
+ const __m128d doubles1 = _mm_mul_pd(_mm_cvtepi32_pd(_mm_srli_si128(ints, 8)), divby2147483648);
+ const __m128d doubles2 = _mm_mul_pd(_mm_cvtepi32_pd(ints), divby2147483648);
+ /* convert to float32, bitshift/or to get these into a vector to store. */
+ _mm_store_ps(dst, _mm_castsi128_ps(_mm_or_si128(_mm_slli_si128(_mm_castps_si128(_mm_cvtpd_ps(doubles1)), 8), _mm_castps_si128(_mm_cvtpd_ps(doubles2)))));
+ i -= 4; mmsrc++; dst += 4;
+ }
+ src = (const Sint32 *) mmsrc;
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (float) (((double) *src) * DIVBY2147483648);
+ i--; src++; dst++;
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes */
+ for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+ *dst = (Sint8) (*src * 127.0f);
+ }
+
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128 mulby127 = _mm_set1_ps(127.0f);
+ __m128i *mmdst = (__m128i *) dst;
+ while (i >= 16) { /* 16 * float32 */
+ const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby127)); /* load 4 floats, convert to sint32 */
+ const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby127)); /* load 4 floats, convert to sint32 */
+ const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+8), mulby127)); /* load 4 floats, convert to sint32 */
+ const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+12), mulby127)); /* load 4 floats, convert to sint32 */
+ _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */
+ i -= 16; src += 16; mmdst++;
+ }
+ dst = (Sint8 *) mmdst;
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (Sint8) (*src * 127.0f);
+ i--; src++; dst++;
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes */
+ for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+ *dst = (Uint8) ((*src + 1.0f) * 127.0f);
+ }
+
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128 add1 = _mm_set1_ps(1.0f);
+ const __m128 mulby127 = _mm_set1_ps(127.0f);
+ __m128i *mmdst = (__m128i *) dst;
+ while (i >= 16) { /* 16 * float32 */
+ const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src), add1), mulby127)); /* load 4 floats, convert to sint32 */
+ const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+4), add1), mulby127)); /* load 4 floats, convert to sint32 */
+ const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+8), add1), mulby127)); /* load 4 floats, convert to sint32 */
+ const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+12), add1), mulby127)); /* load 4 floats, convert to sint32 */
+ _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */
+ i -= 16; src += 16; mmdst++;
+ }
+ dst = (Uint8 *) mmdst;
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (Uint8) ((*src + 1.0f) * 127.0f);
+ i--; src++; dst++;
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes */
+ for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+ *dst = (Sint16) (*src * 32767.0f);
+ }
+
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128 mulby32767 = _mm_set1_ps(32767.0f);
+ __m128i *mmdst = (__m128i *) dst;
+ while (i >= 8) { /* 8 * float32 */
+ const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767)); /* load 4 floats, convert to sint32 */
+ const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767)); /* load 4 floats, convert to sint32 */
+ _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2)); /* pack to sint16, store out. */
+ i -= 8; src += 8; mmdst++;
+ }
+ dst = (Sint16 *) mmdst;
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (Sint16) (*src * 32767.0f);
+ i--; src++; dst++;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes */
+ for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+ *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
+ }
+
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+
+ /* Make sure src is aligned too. */
+ if ((((size_t) src) & 15) == 0) {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ /* This calculates differently than the scalar path because SSE2 can't
+ pack int32 data down to unsigned int16. _mm_packs_epi32 does signed
+ saturation, so that would corrupt our data. _mm_packus_epi32 exists,
+ but not before SSE 4.1. So we convert from float to sint16, packing
+ that down with legit signed saturation, and then xor the top bit
+ against 1. This results in the correct unsigned 16-bit value, even
+ though it looks like dark magic. */
+ const __m128 mulby32767 = _mm_set1_ps(32767.0f);
+ const __m128i topbit = _mm_set1_epi16(-32768);
+ __m128i *mmdst = (__m128i *) dst;
+ while (i >= 8) { /* 8 * float32 */
+ const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767)); /* load 4 floats, convert to sint32 */
+ const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767)); /* load 4 floats, convert to sint32 */
+ _mm_store_si128(mmdst, _mm_xor_si128(_mm_packs_epi32(ints1, ints2), topbit)); /* pack to sint16, xor top bit, store out. */
+ i -= 8; src += 8; mmdst++;
+ }
+ dst = (Uint16 *) mmdst;
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
+ i--; src++; dst++;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+{
+ const float *src = (const float *) cvt->buf;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ int i;
+
+ LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)");
+
+ /* Get dst aligned to 16 bytes */
+ for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
+ *dst = (Sint32) (((double) *src) * 2147483647.0);
+ }
+
+ SDL_assert(!i || ((((size_t) dst) & 15) == 0));
+ SDL_assert(!i || ((((size_t) src) & 15) == 0));
+
+ {
+ /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
+ const __m128d mulby2147483647 = _mm_set1_pd(2147483647.0);
+ __m128i *mmdst = (__m128i *) dst;
+ while (i >= 4) { /* 4 * float32 */
+ const __m128 floats = _mm_load_ps(src);
+ /* bitshift the whole register over, so _mm_cvtps_pd can read the top floats in the bottom of the vector. */
+ const __m128d doubles1 = _mm_mul_pd(_mm_cvtps_pd(_mm_castsi128_ps(_mm_srli_si128(_mm_castps_si128(floats), 8))), mulby2147483647);
+ const __m128d doubles2 = _mm_mul_pd(_mm_cvtps_pd(floats), mulby2147483647);
+ _mm_store_si128(mmdst, _mm_or_si128(_mm_slli_si128(_mm_cvtpd_epi32(doubles1), 8), _mm_cvtpd_epi32(doubles2)));
+ i -= 4; src += 4; mmdst++;
+ }
+ dst = (Sint32 *) mmdst;
+ }
+
+ /* Finish off any leftovers with scalar operations. */
+ while (i) {
+ *dst = (Sint32) (((double) *src) * 2147483647.0);
+ i--; src++; dst++;
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
+ }
+}
+#endif
+
+
+void SDL_ChooseAudioConverters(void)
+{
+ static SDL_bool converters_chosen = SDL_FALSE;
+
+ if (converters_chosen) {
+ return;
+ }
+
+#define SET_CONVERTER_FUNCS(fntype) \
+ SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \
+ SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \
+ SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \
+ SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \
+ SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \
+ SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \
+ SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \
+ SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \
+ SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \
+ SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
+ converters_chosen = SDL_TRUE
+
+#if HAVE_SSE2_INTRINSICS
+ if (SDL_HasSSE2()) {
+ SET_CONVERTER_FUNCS(SSE2);
+ return;
+ }
+#endif
+
+#if NEED_SCALAR_CONVERTER_FALLBACKS
+ SET_CONVERTER_FUNCS(Scalar);
+#endif
+
+#undef SET_CONVERTER_FUNCS
+
+ SDL_assert(converters_chosen == SDL_TRUE);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_mixer.c b/src/3rdparty/SDL2/src/audio/SDL_mixer.c
new file mode 100644
index 0000000..d416a94
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_mixer.c
@@ -0,0 +1,369 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* This provides the default mixing callback for the SDL audio routines */
+
+#include "SDL_cpuinfo.h"
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "SDL_sysaudio.h"
+
+/* This table is used to add two sound values together and pin
+ * the value to avoid overflow. (used with permission from ARDI)
+ * Changed to use 0xFE instead of 0xFF for better sound quality.
+ */
+static const Uint8 mix8[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+ 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
+ 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
+ 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
+ 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
+ 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+ 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
+ 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
+ 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
+ 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D,
+ 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8,
+ 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
+ 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE,
+ 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
+ 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4,
+ 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
+ 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5,
+ 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
+};
+
+/* The volume ranges from 0 - 128 */
+#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
+#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
+
+
+void
+SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
+ Uint32 len, int volume)
+{
+ if (volume == 0) {
+ return;
+ }
+
+ switch (format) {
+
+ case AUDIO_U8:
+ {
+#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
+ SDL_MixAudio_m68k_U8((char *) dst, (char *) src,
+ (unsigned long) len, (long) volume,
+ (char *) mix8);
+#else
+ Uint8 src_sample;
+
+ while (len--) {
+ src_sample = *src;
+ ADJUST_VOLUME_U8(src_sample, volume);
+ *dst = mix8[*dst + src_sample];
+ ++dst;
+ ++src;
+ }
+#endif
+ }
+ break;
+
+ case AUDIO_S8:
+ {
+ Sint8 *dst8, *src8;
+ Sint8 src_sample;
+ int dst_sample;
+ const int max_audioval = ((1 << (8 - 1)) - 1);
+ const int min_audioval = -(1 << (8 - 1));
+
+ src8 = (Sint8 *) src;
+ dst8 = (Sint8 *) dst;
+ while (len--) {
+ src_sample = *src8;
+ ADJUST_VOLUME(src_sample, volume);
+ dst_sample = *dst8 + src_sample;
+ if (dst_sample > max_audioval) {
+ *dst8 = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ *dst8 = min_audioval;
+ } else {
+ *dst8 = dst_sample;
+ }
+ ++dst8;
+ ++src8;
+ }
+ }
+ break;
+
+ case AUDIO_S16LSB:
+ {
+ Sint16 src1, src2;
+ int dst_sample;
+ const int max_audioval = ((1 << (16 - 1)) - 1);
+ const int min_audioval = -(1 << (16 - 1));
+
+ len /= 2;
+ while (len--) {
+ src1 = ((src[1]) << 8 | src[0]);
+ ADJUST_VOLUME(src1, volume);
+ src2 = ((dst[1]) << 8 | dst[0]);
+ src += 2;
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ dst[0] = dst_sample & 0xFF;
+ dst_sample >>= 8;
+ dst[1] = dst_sample & 0xFF;
+ dst += 2;
+ }
+ }
+ break;
+
+ case AUDIO_S16MSB:
+ {
+#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
+ SDL_MixAudio_m68k_S16MSB((short *) dst, (short *) src,
+ (unsigned long) len, (long) volume);
+#else
+ Sint16 src1, src2;
+ int dst_sample;
+ const int max_audioval = ((1 << (16 - 1)) - 1);
+ const int min_audioval = -(1 << (16 - 1));
+
+ len /= 2;
+ while (len--) {
+ src1 = ((src[0]) << 8 | src[1]);
+ ADJUST_VOLUME(src1, volume);
+ src2 = ((dst[0]) << 8 | dst[1]);
+ src += 2;
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ dst[1] = dst_sample & 0xFF;
+ dst_sample >>= 8;
+ dst[0] = dst_sample & 0xFF;
+ dst += 2;
+ }
+#endif
+ }
+ break;
+
+ case AUDIO_U16LSB:
+ {
+ Uint16 src1, src2;
+ int dst_sample;
+ const int max_audioval = 0xFFFF;
+
+ len /= 2;
+ while (len--) {
+ src1 = ((src[1]) << 8 | src[0]);
+ ADJUST_VOLUME(src1, volume);
+ src2 = ((dst[1]) << 8 | dst[0]);
+ src += 2;
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ }
+ dst[0] = dst_sample & 0xFF;
+ dst_sample >>= 8;
+ dst[1] = dst_sample & 0xFF;
+ dst += 2;
+ }
+ }
+ break;
+
+ case AUDIO_U16MSB:
+ {
+ Uint16 src1, src2;
+ int dst_sample;
+ const int max_audioval = 0xFFFF;
+
+ len /= 2;
+ while (len--) {
+ src1 = ((src[0]) << 8 | src[1]);
+ ADJUST_VOLUME(src1, volume);
+ src2 = ((dst[0]) << 8 | dst[1]);
+ src += 2;
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ }
+ dst[1] = dst_sample & 0xFF;
+ dst_sample >>= 8;
+ dst[0] = dst_sample & 0xFF;
+ dst += 2;
+ }
+ }
+ break;
+
+ case AUDIO_S32LSB:
+ {
+ const Uint32 *src32 = (Uint32 *) src;
+ Uint32 *dst32 = (Uint32 *) dst;
+ Sint64 src1, src2;
+ Sint64 dst_sample;
+ const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
+ const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
+
+ len /= 4;
+ while (len--) {
+ src1 = (Sint64) ((Sint32) SDL_SwapLE32(*src32));
+ src32++;
+ ADJUST_VOLUME(src1, volume);
+ src2 = (Sint64) ((Sint32) SDL_SwapLE32(*dst32));
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapLE32((Uint32) ((Sint32) dst_sample));
+ }
+ }
+ break;
+
+ case AUDIO_S32MSB:
+ {
+ const Uint32 *src32 = (Uint32 *) src;
+ Uint32 *dst32 = (Uint32 *) dst;
+ Sint64 src1, src2;
+ Sint64 dst_sample;
+ const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
+ const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
+
+ len /= 4;
+ while (len--) {
+ src1 = (Sint64) ((Sint32) SDL_SwapBE32(*src32));
+ src32++;
+ ADJUST_VOLUME(src1, volume);
+ src2 = (Sint64) ((Sint32) SDL_SwapBE32(*dst32));
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapBE32((Uint32) ((Sint32) dst_sample));
+ }
+ }
+ break;
+
+ case AUDIO_F32LSB:
+ {
+ const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME);
+ const float fvolume = (float) volume;
+ const float *src32 = (float *) src;
+ float *dst32 = (float *) dst;
+ float src1, src2;
+ double dst_sample;
+ /* !!! FIXME: are these right? */
+ const double max_audioval = 3.402823466e+38F;
+ const double min_audioval = -3.402823466e+38F;
+
+ len /= 4;
+ while (len--) {
+ src1 = ((SDL_SwapFloatLE(*src32) * fvolume) * fmaxvolume);
+ src2 = SDL_SwapFloatLE(*dst32);
+ src32++;
+
+ dst_sample = ((double) src1) + ((double) src2);
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapFloatLE((float) dst_sample);
+ }
+ }
+ break;
+
+ case AUDIO_F32MSB:
+ {
+ const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME);
+ const float fvolume = (float) volume;
+ const float *src32 = (float *) src;
+ float *dst32 = (float *) dst;
+ float src1, src2;
+ double dst_sample;
+ /* !!! FIXME: are these right? */
+ const double max_audioval = 3.402823466e+38F;
+ const double min_audioval = -3.402823466e+38F;
+
+ len /= 4;
+ while (len--) {
+ src1 = ((SDL_SwapFloatBE(*src32) * fvolume) * fmaxvolume);
+ src2 = SDL_SwapFloatBE(*dst32);
+ src32++;
+
+ dst_sample = ((double) src1) + ((double) src2);
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapFloatBE((float) dst_sample);
+ }
+ }
+ break;
+
+ default: /* If this happens... FIXME! */
+ SDL_SetError("SDL_MixAudioFormat(): unknown audio format");
+ return;
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_sysaudio.h b/src/3rdparty/SDL2/src/audio/SDL_sysaudio.h
new file mode 100644
index 0000000..f0e1f3d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_sysaudio.h
@@ -0,0 +1,211 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_sysaudio_h_
+#define SDL_sysaudio_h_
+
+#include "SDL_mutex.h"
+#include "SDL_thread.h"
+#include "../SDL_dataqueue.h"
+#include "./SDL_audio_c.h"
+
+/* !!! FIXME: These are wordy and unlocalized... */
+#define DEFAULT_OUTPUT_DEVNAME "System audio output device"
+#define DEFAULT_INPUT_DEVNAME "System audio capture device"
+
+/* The SDL audio driver */
+typedef struct SDL_AudioDevice SDL_AudioDevice;
+#define _THIS SDL_AudioDevice *_this
+
+/* Audio targets should call this as devices are added to the system (such as
+ a USB headset being plugged in), and should also be called for
+ for every device found during DetectDevices(). */
+extern void SDL_AddAudioDevice(const int iscapture, const char *name, void *handle);
+
+/* Audio targets should call this as devices are removed, so SDL can update
+ its list of available devices. */
+extern void SDL_RemoveAudioDevice(const int iscapture, void *handle);
+
+/* Audio targets should call this if an opened audio device is lost while
+ being used. This can happen due to i/o errors, or a device being unplugged,
+ etc. If the device is totally gone, please also call SDL_RemoveAudioDevice()
+ as appropriate so SDL's list of devices is accurate. */
+extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device);
+
+/* This is the size of a packet when using SDL_QueueAudio(). We allocate
+ these as necessary and pool them, under the assumption that we'll
+ eventually end up with a handful that keep recycling, meeting whatever
+ the app needs. We keep packing data tightly as more arrives to avoid
+ wasting space, and if we get a giant block of data, we'll split them
+ into multiple packets behind the scenes. My expectation is that most
+ apps will have 2-3 of these in the pool. 8k should cover most needs, but
+ if this is crippling for some embedded system, we can #ifdef this.
+ The system preallocates enough packets for 2 callbacks' worth of data. */
+#define SDL_AUDIOBUFFERQUEUE_PACKETLEN (8 * 1024)
+
+typedef struct SDL_AudioDriverImpl
+{
+ void (*DetectDevices) (void);
+ int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture);
+ void (*ThreadInit) (_THIS); /* Called by audio thread at start */
+ void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */
+ void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */
+ void (*WaitDevice) (_THIS);
+ void (*PlayDevice) (_THIS);
+ int (*GetPendingBytes) (_THIS);
+ Uint8 *(*GetDeviceBuf) (_THIS);
+ int (*CaptureFromDevice) (_THIS, void *buffer, int buflen);
+ void (*FlushCapture) (_THIS);
+ void (*PrepareToClose) (_THIS); /**< Called between run and draining wait for playback devices */
+ void (*CloseDevice) (_THIS);
+ void (*LockDevice) (_THIS);
+ void (*UnlockDevice) (_THIS);
+ void (*FreeDeviceHandle) (void *handle); /**< SDL is done with handle from SDL_AddAudioDevice() */
+ void (*Deinitialize) (void);
+
+ /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
+
+ /* Some flags to push duplicate code into the core and reduce #ifdefs. */
+ /* !!! FIXME: these should be SDL_bool */
+ int ProvidesOwnCallbackThread;
+ int SkipMixerLock;
+ int HasCaptureSupport;
+ int OnlyHasDefaultOutputDevice;
+ int OnlyHasDefaultCaptureDevice;
+ int AllowsArbitraryDeviceNames;
+} SDL_AudioDriverImpl;
+
+
+typedef struct SDL_AudioDeviceItem
+{
+ void *handle;
+ struct SDL_AudioDeviceItem *next;
+ char name[SDL_VARIABLE_LENGTH_ARRAY];
+} SDL_AudioDeviceItem;
+
+
+typedef struct SDL_AudioDriver
+{
+ /* * * */
+ /* The name of this audio driver */
+ const char *name;
+
+ /* * * */
+ /* The description of this audio driver */
+ const char *desc;
+
+ SDL_AudioDriverImpl impl;
+
+ /* A mutex for device detection */
+ SDL_mutex *detectionLock;
+ SDL_bool captureDevicesRemoved;
+ SDL_bool outputDevicesRemoved;
+ int outputDeviceCount;
+ int inputDeviceCount;
+ SDL_AudioDeviceItem *outputDevices;
+ SDL_AudioDeviceItem *inputDevices;
+} SDL_AudioDriver;
+
+
+/* Define the SDL audio driver structure */
+struct SDL_AudioDevice
+{
+ /* * * */
+ /* Data common to all devices */
+ SDL_AudioDeviceID id;
+
+ /* The device's current audio specification */
+ SDL_AudioSpec spec;
+
+ /* The callback's expected audio specification (converted vs device's spec). */
+ SDL_AudioSpec callbackspec;
+
+ /* Stream that converts and resamples. NULL if not needed. */
+ SDL_AudioStream *stream;
+
+ /* Current state flags */
+ SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */
+ SDL_atomic_t enabled; /* true if device is functioning and connected. */
+ SDL_atomic_t paused;
+ SDL_bool iscapture;
+
+ /* Scratch buffer used in the bridge between SDL and the user callback. */
+ Uint8 *work_buffer;
+
+ /* Size, in bytes, of work_buffer. */
+ Uint32 work_buffer_len;
+
+ /* A mutex for locking the mixing buffers */
+ SDL_mutex *mixer_lock;
+
+ /* A thread to feed the audio device */
+ SDL_Thread *thread;
+ SDL_threadID threadid;
+
+ /* Queued buffers (if app not using callback). */
+ SDL_DataQueue *buffer_queue;
+
+ /* * * */
+ /* Data private to this driver */
+ struct SDL_PrivateAudioData *hidden;
+
+ void *handle;
+};
+#undef _THIS
+
+typedef struct AudioBootStrap
+{
+ const char *name;
+ const char *desc;
+ int (*init) (SDL_AudioDriverImpl * impl);
+ int demand_only; /* 1==request explicitly, or it won't be available. */
+} AudioBootStrap;
+
+/* Not all of these are available in a given build. Use #ifdefs, etc. */
+extern AudioBootStrap PULSEAUDIO_bootstrap;
+extern AudioBootStrap ALSA_bootstrap;
+extern AudioBootStrap JACK_bootstrap;
+extern AudioBootStrap SNDIO_bootstrap;
+extern AudioBootStrap NETBSDAUDIO_bootstrap;
+extern AudioBootStrap DSP_bootstrap;
+extern AudioBootStrap QSAAUDIO_bootstrap;
+extern AudioBootStrap SUNAUDIO_bootstrap;
+extern AudioBootStrap ARTS_bootstrap;
+extern AudioBootStrap ESD_bootstrap;
+extern AudioBootStrap NACLAUDIO_bootstrap;
+extern AudioBootStrap NAS_bootstrap;
+extern AudioBootStrap WASAPI_bootstrap;
+extern AudioBootStrap DSOUND_bootstrap;
+extern AudioBootStrap WINMM_bootstrap;
+extern AudioBootStrap PAUDIO_bootstrap;
+extern AudioBootStrap HAIKUAUDIO_bootstrap;
+extern AudioBootStrap COREAUDIO_bootstrap;
+extern AudioBootStrap DISKAUDIO_bootstrap;
+extern AudioBootStrap DUMMYAUDIO_bootstrap;
+extern AudioBootStrap FUSIONSOUND_bootstrap;
+extern AudioBootStrap ANDROIDAUDIO_bootstrap;
+extern AudioBootStrap PSPAUDIO_bootstrap;
+extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
+
+#endif /* SDL_sysaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_wave.c b/src/3rdparty/SDL2/src/audio/SDL_wave.c
new file mode 100644
index 0000000..2c76a8c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_wave.c
@@ -0,0 +1,694 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Microsoft WAVE file loading routines */
+
+#include "SDL_audio.h"
+#include "SDL_wave.h"
+
+
+static int ReadChunk(SDL_RWops * src, Chunk * chunk);
+
+struct MS_ADPCM_decodestate
+{
+ Uint8 hPredictor;
+ Uint16 iDelta;
+ Sint16 iSamp1;
+ Sint16 iSamp2;
+};
+static struct MS_ADPCM_decoder
+{
+ WaveFMT wavefmt;
+ Uint16 wSamplesPerBlock;
+ Uint16 wNumCoef;
+ Sint16 aCoeff[7][2];
+ /* * * */
+ struct MS_ADPCM_decodestate state[2];
+} MS_ADPCM_state;
+
+static int
+InitMS_ADPCM(WaveFMT * format)
+{
+ Uint8 *rogue_feel;
+ int i;
+
+ /* Set the rogue pointer to the MS_ADPCM specific data */
+ MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
+ MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
+ MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
+ MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
+ MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
+ MS_ADPCM_state.wavefmt.bitspersample =
+ SDL_SwapLE16(format->bitspersample);
+ rogue_feel = (Uint8 *) format + sizeof(*format);
+ if (sizeof(*format) == 16) {
+ /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */
+ rogue_feel += sizeof(Uint16);
+ }
+ MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ MS_ADPCM_state.wNumCoef = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ if (MS_ADPCM_state.wNumCoef != 7) {
+ SDL_SetError("Unknown set of MS_ADPCM coefficients");
+ return (-1);
+ }
+ for (i = 0; i < MS_ADPCM_state.wNumCoef; ++i) {
+ MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ }
+ return (0);
+}
+
+static Sint32
+MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
+ Uint8 nybble, Sint16 * coeff)
+{
+ const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
+ const Sint32 min_audioval = -(1 << (16 - 1));
+ const Sint32 adaptive[] = {
+ 230, 230, 230, 230, 307, 409, 512, 614,
+ 768, 614, 512, 409, 307, 230, 230, 230
+ };
+ Sint32 new_sample, delta;
+
+ new_sample = ((state->iSamp1 * coeff[0]) +
+ (state->iSamp2 * coeff[1])) / 256;
+ if (nybble & 0x08) {
+ new_sample += state->iDelta * (nybble - 0x10);
+ } else {
+ new_sample += state->iDelta * nybble;
+ }
+ if (new_sample < min_audioval) {
+ new_sample = min_audioval;
+ } else if (new_sample > max_audioval) {
+ new_sample = max_audioval;
+ }
+ delta = ((Sint32) state->iDelta * adaptive[nybble]) / 256;
+ if (delta < 16) {
+ delta = 16;
+ }
+ state->iDelta = (Uint16) delta;
+ state->iSamp2 = state->iSamp1;
+ state->iSamp1 = (Sint16) new_sample;
+ return (new_sample);
+}
+
+static int
+MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
+{
+ struct MS_ADPCM_decodestate *state[2];
+ Uint8 *freeable, *encoded, *decoded;
+ Sint32 encoded_len, samplesleft;
+ Sint8 nybble;
+ Uint8 stereo;
+ Sint16 *coeff[2];
+ Sint32 new_sample;
+
+ /* Allocate the proper sized output buffer */
+ encoded_len = *audio_len;
+ encoded = *audio_buf;
+ freeable = *audio_buf;
+ *audio_len = (encoded_len / MS_ADPCM_state.wavefmt.blockalign) *
+ MS_ADPCM_state.wSamplesPerBlock *
+ MS_ADPCM_state.wavefmt.channels * sizeof(Sint16);
+ *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
+ if (*audio_buf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ decoded = *audio_buf;
+
+ /* Get ready... Go! */
+ stereo = (MS_ADPCM_state.wavefmt.channels == 2);
+ state[0] = &MS_ADPCM_state.state[0];
+ state[1] = &MS_ADPCM_state.state[stereo];
+ while (encoded_len >= MS_ADPCM_state.wavefmt.blockalign) {
+ /* Grab the initial information for this block */
+ state[0]->hPredictor = *encoded++;
+ if (stereo) {
+ state[1]->hPredictor = *encoded++;
+ }
+ state[0]->iDelta = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ if (stereo) {
+ state[1]->iDelta = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ }
+ state[0]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ if (stereo) {
+ state[1]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ }
+ state[0]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ if (stereo) {
+ state[1]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ }
+ coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor];
+ coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
+
+ /* Store the two initial samples we start with */
+ decoded[0] = state[0]->iSamp2 & 0xFF;
+ decoded[1] = state[0]->iSamp2 >> 8;
+ decoded += 2;
+ if (stereo) {
+ decoded[0] = state[1]->iSamp2 & 0xFF;
+ decoded[1] = state[1]->iSamp2 >> 8;
+ decoded += 2;
+ }
+ decoded[0] = state[0]->iSamp1 & 0xFF;
+ decoded[1] = state[0]->iSamp1 >> 8;
+ decoded += 2;
+ if (stereo) {
+ decoded[0] = state[1]->iSamp1 & 0xFF;
+ decoded[1] = state[1]->iSamp1 >> 8;
+ decoded += 2;
+ }
+
+ /* Decode and store the other samples in this block */
+ samplesleft = (MS_ADPCM_state.wSamplesPerBlock - 2) *
+ MS_ADPCM_state.wavefmt.channels;
+ while (samplesleft > 0) {
+ nybble = (*encoded) >> 4;
+ new_sample = MS_ADPCM_nibble(state[0], nybble, coeff[0]);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2;
+
+ nybble = (*encoded) & 0x0F;
+ new_sample = MS_ADPCM_nibble(state[1], nybble, coeff[1]);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2;
+
+ ++encoded;
+ samplesleft -= 2;
+ }
+ encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
+ }
+ SDL_free(freeable);
+ return (0);
+}
+
+struct IMA_ADPCM_decodestate
+{
+ Sint32 sample;
+ Sint8 index;
+};
+static struct IMA_ADPCM_decoder
+{
+ WaveFMT wavefmt;
+ Uint16 wSamplesPerBlock;
+ /* * * */
+ struct IMA_ADPCM_decodestate state[2];
+} IMA_ADPCM_state;
+
+static int
+InitIMA_ADPCM(WaveFMT * format)
+{
+ Uint8 *rogue_feel;
+
+ /* Set the rogue pointer to the IMA_ADPCM specific data */
+ IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
+ IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
+ IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
+ IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
+ IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
+ IMA_ADPCM_state.wavefmt.bitspersample =
+ SDL_SwapLE16(format->bitspersample);
+ rogue_feel = (Uint8 *) format + sizeof(*format);
+ if (sizeof(*format) == 16) {
+ /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */
+ rogue_feel += sizeof(Uint16);
+ }
+ IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ return (0);
+}
+
+static Sint32
+IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble)
+{
+ const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
+ const Sint32 min_audioval = -(1 << (16 - 1));
+ const int index_table[16] = {
+ -1, -1, -1, -1,
+ 2, 4, 6, 8,
+ -1, -1, -1, -1,
+ 2, 4, 6, 8
+ };
+ const Sint32 step_table[89] = {
+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31,
+ 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130,
+ 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408,
+ 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282,
+ 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327,
+ 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630,
+ 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350,
+ 22385, 24623, 27086, 29794, 32767
+ };
+ Sint32 delta, step;
+
+ /* Compute difference and new sample value */
+ if (state->index > 88) {
+ state->index = 88;
+ } else if (state->index < 0) {
+ state->index = 0;
+ }
+ /* explicit cast to avoid gcc warning about using 'char' as array index */
+ step = step_table[(int)state->index];
+ delta = step >> 3;
+ if (nybble & 0x04)
+ delta += step;
+ if (nybble & 0x02)
+ delta += (step >> 1);
+ if (nybble & 0x01)
+ delta += (step >> 2);
+ if (nybble & 0x08)
+ delta = -delta;
+ state->sample += delta;
+
+ /* Update index value */
+ state->index += index_table[nybble];
+
+ /* Clamp output sample */
+ if (state->sample > max_audioval) {
+ state->sample = max_audioval;
+ } else if (state->sample < min_audioval) {
+ state->sample = min_audioval;
+ }
+ return (state->sample);
+}
+
+/* Fill the decode buffer with a channel block of data (8 samples) */
+static void
+Fill_IMA_ADPCM_block(Uint8 * decoded, Uint8 * encoded,
+ int channel, int numchannels,
+ struct IMA_ADPCM_decodestate *state)
+{
+ int i;
+ Sint8 nybble;
+ Sint32 new_sample;
+
+ decoded += (channel * 2);
+ for (i = 0; i < 4; ++i) {
+ nybble = (*encoded) & 0x0F;
+ new_sample = IMA_ADPCM_nibble(state, nybble);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2 * numchannels;
+
+ nybble = (*encoded) >> 4;
+ new_sample = IMA_ADPCM_nibble(state, nybble);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2 * numchannels;
+
+ ++encoded;
+ }
+}
+
+static int
+IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
+{
+ struct IMA_ADPCM_decodestate *state;
+ Uint8 *freeable, *encoded, *decoded;
+ Sint32 encoded_len, samplesleft;
+ unsigned int c, channels;
+
+ /* Check to make sure we have enough variables in the state array */
+ channels = IMA_ADPCM_state.wavefmt.channels;
+ if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
+ SDL_SetError("IMA ADPCM decoder can only handle %u channels",
+ (unsigned int)SDL_arraysize(IMA_ADPCM_state.state));
+ return (-1);
+ }
+ state = IMA_ADPCM_state.state;
+
+ /* Allocate the proper sized output buffer */
+ encoded_len = *audio_len;
+ encoded = *audio_buf;
+ freeable = *audio_buf;
+ *audio_len = (encoded_len / IMA_ADPCM_state.wavefmt.blockalign) *
+ IMA_ADPCM_state.wSamplesPerBlock *
+ IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16);
+ *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
+ if (*audio_buf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ decoded = *audio_buf;
+
+ /* Get ready... Go! */
+ while (encoded_len >= IMA_ADPCM_state.wavefmt.blockalign) {
+ /* Grab the initial information for this block */
+ for (c = 0; c < channels; ++c) {
+ /* Fill the state information for this block */
+ state[c].sample = ((encoded[1] << 8) | encoded[0]);
+ encoded += 2;
+ if (state[c].sample & 0x8000) {
+ state[c].sample -= 0x10000;
+ }
+ state[c].index = *encoded++;
+ /* Reserved byte in buffer header, should be 0 */
+ if (*encoded++ != 0) {
+ /* Uh oh, corrupt data? Buggy code? */ ;
+ }
+
+ /* Store the initial sample we start with */
+ decoded[0] = (Uint8) (state[c].sample & 0xFF);
+ decoded[1] = (Uint8) (state[c].sample >> 8);
+ decoded += 2;
+ }
+
+ /* Decode and store the other samples in this block */
+ samplesleft = (IMA_ADPCM_state.wSamplesPerBlock - 1) * channels;
+ while (samplesleft > 0) {
+ for (c = 0; c < channels; ++c) {
+ Fill_IMA_ADPCM_block(decoded, encoded,
+ c, channels, &state[c]);
+ encoded += 4;
+ samplesleft -= 8;
+ }
+ decoded += (channels * 8 * 2);
+ }
+ encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
+ }
+ SDL_free(freeable);
+ return (0);
+}
+
+
+static int
+ConvertSint24ToSint32(Uint8 ** audio_buf, Uint32 * audio_len)
+{
+ const double DIVBY8388608 = 0.00000011920928955078125;
+ const Uint32 original_len = *audio_len;
+ const Uint32 samples = original_len / 3;
+ const Uint32 expanded_len = samples * sizeof (Uint32);
+ Uint8 *ptr = (Uint8 *) SDL_realloc(*audio_buf, expanded_len);
+ const Uint8 *src;
+ Uint32 *dst;
+ Uint32 i;
+
+ if (!ptr) {
+ return SDL_OutOfMemory();
+ }
+
+ *audio_buf = ptr;
+ *audio_len = expanded_len;
+
+ /* work from end to start, since we're expanding in-place. */
+ src = (ptr + original_len) - 3;
+ dst = ((Uint32 *) (ptr + expanded_len)) - 1;
+ for (i = 0; i < samples; i++) {
+ /* There's probably a faster way to do all this. */
+ const Sint32 converted = ((Sint32) ( (((Uint32) src[2]) << 24) |
+ (((Uint32) src[1]) << 16) |
+ (((Uint32) src[0]) << 8) )) >> 8;
+ const double scaled = (((double) converted) * DIVBY8388608);
+ src -= 3;
+ *(dst--) = (Sint32) (scaled * 2147483647.0);
+ }
+
+ return 0;
+}
+
+
+/* GUIDs that are used by WAVE_FORMAT_EXTENSIBLE */
+static const Uint8 extensible_pcm_guid[16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 };
+static const Uint8 extensible_ieee_guid[16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 };
+
+SDL_AudioSpec *
+SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
+ SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
+{
+ int was_error;
+ Chunk chunk;
+ int lenread;
+ int IEEE_float_encoded, MS_ADPCM_encoded, IMA_ADPCM_encoded;
+ int samplesize;
+
+ /* WAV magic header */
+ Uint32 RIFFchunk;
+ Uint32 wavelen = 0;
+ Uint32 WAVEmagic;
+ Uint32 headerDiff = 0;
+
+ /* FMT chunk */
+ WaveFMT *format = NULL;
+ WaveExtensibleFMT *ext = NULL;
+
+ SDL_zero(chunk);
+
+ /* Make sure we are passed a valid data source */
+ was_error = 0;
+ if (src == NULL) {
+ was_error = 1;
+ goto done;
+ }
+
+ /* Check the magic header */
+ RIFFchunk = SDL_ReadLE32(src);
+ wavelen = SDL_ReadLE32(src);
+ if (wavelen == WAVE) { /* The RIFFchunk has already been read */
+ WAVEmagic = wavelen;
+ wavelen = RIFFchunk;
+ RIFFchunk = RIFF;
+ } else {
+ WAVEmagic = SDL_ReadLE32(src);
+ }
+ if ((RIFFchunk != RIFF) || (WAVEmagic != WAVE)) {
+ SDL_SetError("Unrecognized file type (not WAVE)");
+ was_error = 1;
+ goto done;
+ }
+ headerDiff += sizeof(Uint32); /* for WAVE */
+
+ /* Read the audio data format chunk */
+ chunk.data = NULL;
+ do {
+ SDL_free(chunk.data);
+ chunk.data = NULL;
+ lenread = ReadChunk(src, &chunk);
+ if (lenread < 0) {
+ was_error = 1;
+ goto done;
+ }
+ /* 2 Uint32's for chunk header+len, plus the lenread */
+ headerDiff += lenread + 2 * sizeof(Uint32);
+ } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT) || (chunk.magic == JUNK));
+
+ /* Decode the audio data format */
+ format = (WaveFMT *) chunk.data;
+ if (chunk.magic != FMT) {
+ SDL_SetError("Complex WAVE files not supported");
+ was_error = 1;
+ goto done;
+ }
+ IEEE_float_encoded = MS_ADPCM_encoded = IMA_ADPCM_encoded = 0;
+ switch (SDL_SwapLE16(format->encoding)) {
+ case PCM_CODE:
+ /* We can understand this */
+ break;
+ case IEEE_FLOAT_CODE:
+ IEEE_float_encoded = 1;
+ /* We can understand this */
+ break;
+ case MS_ADPCM_CODE:
+ /* Try to understand this */
+ if (InitMS_ADPCM(format) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ MS_ADPCM_encoded = 1;
+ break;
+ case IMA_ADPCM_CODE:
+ /* Try to understand this */
+ if (InitIMA_ADPCM(format) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ IMA_ADPCM_encoded = 1;
+ break;
+ case EXTENSIBLE_CODE:
+ /* note that this ignores channel masks, smaller valid bit counts
+ inside a larger container, and most subtypes. This is just enough
+ to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE
+ to be useful working when they use this format flag. */
+ ext = (WaveExtensibleFMT *) format;
+ if (SDL_SwapLE16(ext->size) < 22) {
+ SDL_SetError("bogus extended .wav header");
+ was_error = 1;
+ goto done;
+ }
+ if (SDL_memcmp(ext->subformat, extensible_pcm_guid, 16) == 0) {
+ break; /* cool. */
+ } else if (SDL_memcmp(ext->subformat, extensible_ieee_guid, 16) == 0) {
+ IEEE_float_encoded = 1;
+ break;
+ }
+ break;
+ case MP3_CODE:
+ SDL_SetError("MPEG Layer 3 data not supported");
+ was_error = 1;
+ goto done;
+ default:
+ SDL_SetError("Unknown WAVE data format: 0x%.4x",
+ SDL_SwapLE16(format->encoding));
+ was_error = 1;
+ goto done;
+ }
+ SDL_zerop(spec);
+ spec->freq = SDL_SwapLE32(format->frequency);
+
+ if (IEEE_float_encoded) {
+ if ((SDL_SwapLE16(format->bitspersample)) != 32) {
+ was_error = 1;
+ } else {
+ spec->format = AUDIO_F32;
+ }
+ } else {
+ switch (SDL_SwapLE16(format->bitspersample)) {
+ case 4:
+ if (MS_ADPCM_encoded || IMA_ADPCM_encoded) {
+ spec->format = AUDIO_S16;
+ } else {
+ was_error = 1;
+ }
+ break;
+ case 8:
+ spec->format = AUDIO_U8;
+ break;
+ case 16:
+ spec->format = AUDIO_S16;
+ break;
+ case 24: /* convert this. */
+ spec->format = AUDIO_S32;
+ break;
+ case 32:
+ spec->format = AUDIO_S32;
+ break;
+ default:
+ was_error = 1;
+ break;
+ }
+ }
+
+ if (was_error) {
+ SDL_SetError("Unknown %d-bit PCM data format",
+ SDL_SwapLE16(format->bitspersample));
+ goto done;
+ }
+ spec->channels = (Uint8) SDL_SwapLE16(format->channels);
+ spec->samples = 4096; /* Good default buffer size */
+
+ /* Read the audio data chunk */
+ *audio_buf = NULL;
+ do {
+ SDL_free(*audio_buf);
+ *audio_buf = NULL;
+ lenread = ReadChunk(src, &chunk);
+ if (lenread < 0) {
+ was_error = 1;
+ goto done;
+ }
+ *audio_len = lenread;
+ *audio_buf = chunk.data;
+ if (chunk.magic != DATA)
+ headerDiff += lenread + 2 * sizeof(Uint32);
+ } while (chunk.magic != DATA);
+ headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */
+
+ if (MS_ADPCM_encoded) {
+ if (MS_ADPCM_decode(audio_buf, audio_len) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ }
+ if (IMA_ADPCM_encoded) {
+ if (IMA_ADPCM_decode(audio_buf, audio_len) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ }
+
+ if (SDL_SwapLE16(format->bitspersample) == 24) {
+ if (ConvertSint24ToSint32(audio_buf, audio_len) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ }
+
+ /* Don't return a buffer that isn't a multiple of samplesize */
+ samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels;
+ *audio_len &= ~(samplesize - 1);
+
+ done:
+ SDL_free(format);
+ if (src) {
+ if (freesrc) {
+ SDL_RWclose(src);
+ } else {
+ /* seek to the end of the file (given by the RIFF chunk) */
+ SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
+ }
+ }
+ if (was_error) {
+ spec = NULL;
+ }
+ return (spec);
+}
+
+/* Since the WAV memory is allocated in the shared library, it must also
+ be freed here. (Necessary under Win32, VC++)
+ */
+void
+SDL_FreeWAV(Uint8 * audio_buf)
+{
+ SDL_free(audio_buf);
+}
+
+static int
+ReadChunk(SDL_RWops * src, Chunk * chunk)
+{
+ chunk->magic = SDL_ReadLE32(src);
+ chunk->length = SDL_ReadLE32(src);
+ chunk->data = (Uint8 *) SDL_malloc(chunk->length);
+ if (chunk->data == NULL) {
+ return SDL_OutOfMemory();
+ }
+ if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
+ SDL_free(chunk->data);
+ chunk->data = NULL;
+ return SDL_Error(SDL_EFREAD);
+ }
+ return (chunk->length);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/SDL_wave.h b/src/3rdparty/SDL2/src/audio/SDL_wave.h
new file mode 100644
index 0000000..5c60f75
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/SDL_wave.h
@@ -0,0 +1,77 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* WAVE files are little-endian */
+
+/*******************************************/
+/* Define values for Microsoft WAVE format */
+/*******************************************/
+#define RIFF 0x46464952 /* "RIFF" */
+#define WAVE 0x45564157 /* "WAVE" */
+#define FACT 0x74636166 /* "fact" */
+#define LIST 0x5453494c /* "LIST" */
+#define BEXT 0x74786562 /* "bext" */
+#define JUNK 0x4B4E554A /* "JUNK" */
+#define FMT 0x20746D66 /* "fmt " */
+#define DATA 0x61746164 /* "data" */
+#define PCM_CODE 0x0001
+#define MS_ADPCM_CODE 0x0002
+#define IEEE_FLOAT_CODE 0x0003
+#define IMA_ADPCM_CODE 0x0011
+#define MP3_CODE 0x0055
+#define EXTENSIBLE_CODE 0xFFFE
+#define WAVE_MONO 1
+#define WAVE_STEREO 2
+
+/* Normally, these three chunks come consecutively in a WAVE file */
+typedef struct WaveFMT
+{
+/* Not saved in the chunk we read:
+ Uint32 FMTchunk;
+ Uint32 fmtlen;
+*/
+ Uint16 encoding;
+ Uint16 channels; /* 1 = mono, 2 = stereo */
+ Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
+ Uint32 byterate; /* Average bytes per second */
+ Uint16 blockalign; /* Bytes per sample block */
+ Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */
+} WaveFMT;
+
+/* The general chunk found in the WAVE file */
+typedef struct Chunk
+{
+ Uint32 magic;
+ Uint32 length;
+ Uint8 *data;
+} Chunk;
+
+typedef struct WaveExtensibleFMT
+{
+ WaveFMT format;
+ Uint16 size;
+ Uint16 validbits;
+ Uint32 channelmask;
+ Uint8 subformat[16]; /* a GUID. */
+} WaveExtensibleFMT;
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.c b/src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.c
new file mode 100644
index 0000000..2dba1ff
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.c
@@ -0,0 +1,1030 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_ALSA
+
+/* Allow access to a raw mixing buffer */
+
+#include <sys/types.h>
+#include <signal.h> /* For kill() */
+#include <string.h>
+
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_alsa_audio.h"
+
+#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#include "SDL_loadso.h"
+#endif
+
+static int (*ALSA_snd_pcm_open)
+ (snd_pcm_t **, const char *, snd_pcm_stream_t, int);
+static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm);
+static snd_pcm_sframes_t (*ALSA_snd_pcm_writei)
+ (snd_pcm_t *, const void *, snd_pcm_uframes_t);
+static snd_pcm_sframes_t (*ALSA_snd_pcm_readi)
+ (snd_pcm_t *, void *, snd_pcm_uframes_t);
+static int (*ALSA_snd_pcm_recover) (snd_pcm_t *, int, int);
+static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *);
+static int (*ALSA_snd_pcm_drain) (snd_pcm_t *);
+static const char *(*ALSA_snd_strerror) (int);
+static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void);
+static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void);
+static void (*ALSA_snd_pcm_hw_params_copy)
+ (snd_pcm_hw_params_t *, const snd_pcm_hw_params_t *);
+static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *);
+static int (*ALSA_snd_pcm_hw_params_set_access)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t);
+static int (*ALSA_snd_pcm_hw_params_set_format)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
+static int (*ALSA_snd_pcm_hw_params_set_channels)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
+static int (*ALSA_snd_pcm_hw_params_get_channels)
+ (const snd_pcm_hw_params_t *, unsigned int *);
+static int (*ALSA_snd_pcm_hw_params_set_rate_near)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
+static int (*ALSA_snd_pcm_hw_params_set_period_size_near)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
+static int (*ALSA_snd_pcm_hw_params_get_period_size)
+ (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
+static int (*ALSA_snd_pcm_hw_params_set_periods_near)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
+static int (*ALSA_snd_pcm_hw_params_get_periods)
+ (const snd_pcm_hw_params_t *, unsigned int *, int *);
+static int (*ALSA_snd_pcm_hw_params_set_buffer_size_near)
+ (snd_pcm_t *pcm, snd_pcm_hw_params_t *, snd_pcm_uframes_t *);
+static int (*ALSA_snd_pcm_hw_params_get_buffer_size)
+ (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *);
+static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *);
+static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *,
+ snd_pcm_sw_params_t *);
+static int (*ALSA_snd_pcm_sw_params_set_start_threshold)
+ (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
+static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *);
+static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int);
+static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int);
+static int (*ALSA_snd_pcm_sw_params_set_avail_min)
+ (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
+static int (*ALSA_snd_pcm_reset)(snd_pcm_t *);
+static int (*ALSA_snd_device_name_hint) (int, const char *, void ***);
+static char* (*ALSA_snd_device_name_get_hint) (const void *, const char *);
+static int (*ALSA_snd_device_name_free_hint) (void **);
+#ifdef SND_CHMAP_API_VERSION
+static snd_pcm_chmap_t* (*ALSA_snd_pcm_get_chmap) (snd_pcm_t *);
+static int (*ALSA_snd_pcm_chmap_print) (const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
+#endif
+
+#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
+#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof
+
+static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC;
+static void *alsa_handle = NULL;
+
+static int
+load_alsa_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(alsa_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return 0;
+ }
+
+ return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_ALSA_SYM(x) \
+ if (!load_alsa_sym(#x, (void **) (char *) &ALSA_##x)) return -1
+#else
+#define SDL_ALSA_SYM(x) ALSA_##x = x
+#endif
+
+static int
+load_alsa_syms(void)
+{
+ SDL_ALSA_SYM(snd_pcm_open);
+ SDL_ALSA_SYM(snd_pcm_close);
+ SDL_ALSA_SYM(snd_pcm_writei);
+ SDL_ALSA_SYM(snd_pcm_readi);
+ SDL_ALSA_SYM(snd_pcm_recover);
+ SDL_ALSA_SYM(snd_pcm_prepare);
+ SDL_ALSA_SYM(snd_pcm_drain);
+ SDL_ALSA_SYM(snd_strerror);
+ SDL_ALSA_SYM(snd_pcm_hw_params_sizeof);
+ SDL_ALSA_SYM(snd_pcm_sw_params_sizeof);
+ SDL_ALSA_SYM(snd_pcm_hw_params_copy);
+ SDL_ALSA_SYM(snd_pcm_hw_params_any);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_access);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_format);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_channels);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_channels);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_periods);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size);
+ SDL_ALSA_SYM(snd_pcm_hw_params);
+ SDL_ALSA_SYM(snd_pcm_sw_params_current);
+ SDL_ALSA_SYM(snd_pcm_sw_params_set_start_threshold);
+ SDL_ALSA_SYM(snd_pcm_sw_params);
+ SDL_ALSA_SYM(snd_pcm_nonblock);
+ SDL_ALSA_SYM(snd_pcm_wait);
+ SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min);
+ SDL_ALSA_SYM(snd_pcm_reset);
+ SDL_ALSA_SYM(snd_device_name_hint);
+ SDL_ALSA_SYM(snd_device_name_get_hint);
+ SDL_ALSA_SYM(snd_device_name_free_hint);
+#ifdef SND_CHMAP_API_VERSION
+ SDL_ALSA_SYM(snd_pcm_get_chmap);
+ SDL_ALSA_SYM(snd_pcm_chmap_print);
+#endif
+
+ return 0;
+}
+
+#undef SDL_ALSA_SYM
+
+#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+
+static void
+UnloadALSALibrary(void)
+{
+ if (alsa_handle != NULL) {
+ SDL_UnloadObject(alsa_handle);
+ alsa_handle = NULL;
+ }
+}
+
+static int
+LoadALSALibrary(void)
+{
+ int retval = 0;
+ if (alsa_handle == NULL) {
+ alsa_handle = SDL_LoadObject(alsa_library);
+ if (alsa_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = load_alsa_syms();
+ if (retval < 0) {
+ UnloadALSALibrary();
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+static void
+UnloadALSALibrary(void)
+{
+}
+
+static int
+LoadALSALibrary(void)
+{
+ load_alsa_syms();
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
+
+static const char *
+get_audio_device(void *handle, const int channels)
+{
+ const char *device;
+
+ if (handle != NULL) {
+ return (const char *) handle;
+ }
+
+ /* !!! FIXME: we also check "SDL_AUDIO_DEVICE_NAME" at the higher level. */
+ device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */
+ if (device != NULL) {
+ return device;
+ }
+
+ if (channels == 6) {
+ return "plug:surround51";
+ } else if (channels == 4) {
+ return "plug:surround40";
+ }
+
+ return "default";
+}
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+ALSA_WaitDevice(_THIS)
+{
+ /* We're in blocking mode, so there's nothing to do here */
+}
+
+
+/* !!! FIXME: is there a channel swizzler in alsalib instead? */
+/*
+ * http://bugzilla.libsdl.org/show_bug.cgi?id=110
+ * "For Linux ALSA, this is FL-FR-RL-RR-C-LFE
+ * and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR"
+ */
+#define SWIZ6(T, buf, numframes) \
+ T *ptr = (T *) buf; \
+ Uint32 i; \
+ for (i = 0; i < numframes; i++, ptr += 6) { \
+ T tmp; \
+ tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \
+ tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \
+ }
+
+static void
+swizzle_alsa_channels_6_64bit(void *buffer, Uint32 bufferlen)
+{
+ SWIZ6(Uint64, buffer, bufferlen);
+}
+
+static void
+swizzle_alsa_channels_6_32bit(void *buffer, Uint32 bufferlen)
+{
+ SWIZ6(Uint32, buffer, bufferlen);
+}
+
+static void
+swizzle_alsa_channels_6_16bit(void *buffer, Uint32 bufferlen)
+{
+ SWIZ6(Uint16, buffer, bufferlen);
+}
+
+static void
+swizzle_alsa_channels_6_8bit(void *buffer, Uint32 bufferlen)
+{
+ SWIZ6(Uint8, buffer, bufferlen);
+}
+
+#undef SWIZ6
+
+
+/*
+ * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle
+ * channels from Windows/Mac order to the format alsalib will want.
+ */
+static void
+swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen)
+{
+ if (this->spec.channels == 6) {
+ switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
+ case 8: swizzle_alsa_channels_6_8bit(buffer, bufferlen); break;
+ case 16: swizzle_alsa_channels_6_16bit(buffer, bufferlen); break;
+ case 32: swizzle_alsa_channels_6_32bit(buffer, bufferlen); break;
+ case 64: swizzle_alsa_channels_6_64bit(buffer, bufferlen); break;
+ default: SDL_assert(!"unhandled bitsize"); break;
+ }
+ }
+
+ /* !!! FIXME: update this for 7.1 if needed, later. */
+}
+
+#ifdef SND_CHMAP_API_VERSION
+/* Some devices have the right channel map, no swizzling necessary */
+static void
+no_swizzle(_THIS, void *buffer, Uint32 bufferlen)
+{
+ return;
+}
+#endif /* SND_CHMAP_API_VERSION */
+
+
+static void
+ALSA_PlayDevice(_THIS)
+{
+ const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
+ const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
+ this->spec.channels;
+ snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
+
+ this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left);
+
+ while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
+ int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
+ sample_buf, frames_left);
+
+ if (status < 0) {
+ if (status == -EAGAIN) {
+ /* Apparently snd_pcm_recover() doesn't handle this case -
+ does it assume snd_pcm_wait() above? */
+ SDL_Delay(1);
+ continue;
+ }
+ status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
+ if (status < 0) {
+ /* Hmm, not much we can do - abort */
+ fprintf(stderr, "ALSA write failed (unrecoverable): %s\n",
+ ALSA_snd_strerror(status));
+ SDL_OpenedAudioDeviceDisconnected(this);
+ return;
+ }
+ continue;
+ }
+ else if (status == 0) {
+ /* No frames were written (no available space in pcm device).
+ Allow other threads to catch up. */
+ Uint32 delay = (frames_left / 2 * 1000) / this->spec.freq;
+ SDL_Delay(delay);
+ }
+
+ sample_buf += status * frame_size;
+ frames_left -= status;
+ }
+}
+
+static Uint8 *
+ALSA_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static int
+ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ Uint8 *sample_buf = (Uint8 *) buffer;
+ const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
+ this->spec.channels;
+ const int total_frames = buflen / frame_size;
+ snd_pcm_uframes_t frames_left = total_frames;
+ snd_pcm_uframes_t wait_time = frame_size / 2;
+
+ SDL_assert((buflen % frame_size) == 0);
+
+ while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
+ int status;
+
+ status = ALSA_snd_pcm_readi(this->hidden->pcm_handle,
+ sample_buf, frames_left);
+
+ if (status == -EAGAIN) {
+ ALSA_snd_pcm_wait(this->hidden->pcm_handle, wait_time);
+ status = 0;
+ }
+ else if (status < 0) {
+ /*printf("ALSA: capture error %d\n", status);*/
+ status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
+ if (status < 0) {
+ /* Hmm, not much we can do - abort */
+ fprintf(stderr, "ALSA read failed (unrecoverable): %s\n",
+ ALSA_snd_strerror(status));
+ return -1;
+ }
+ continue;
+ }
+
+ /*printf("ALSA: captured %d bytes\n", status * frame_size);*/
+ sample_buf += status * frame_size;
+ frames_left -= status;
+ }
+
+ this->hidden->swizzle_func(this, buffer, total_frames - frames_left);
+
+ return (total_frames - frames_left) * frame_size;
+}
+
+static void
+ALSA_FlushCapture(_THIS)
+{
+ ALSA_snd_pcm_reset(this->hidden->pcm_handle);
+}
+
+static void
+ALSA_CloseDevice(_THIS)
+{
+ if (this->hidden->pcm_handle) {
+ /* Wait for the submitted audio to drain
+ ALSA_snd_pcm_drop() can hang, so don't use that.
+ */
+ Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2;
+ SDL_Delay(delay);
+
+ ALSA_snd_pcm_close(this->hidden->pcm_handle);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static int
+ALSA_finalize_hardware(_THIS, snd_pcm_hw_params_t *hwparams, int override)
+{
+ int status;
+ snd_pcm_uframes_t bufsize;
+
+ /* "set" the hardware with the desired parameters */
+ status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams);
+ if ( status < 0 ) {
+ return(-1);
+ }
+
+ /* Get samples for the actual buffer size */
+ status = ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize);
+ if ( status < 0 ) {
+ return(-1);
+ }
+ if ( !override && bufsize != this->spec.samples * 2 ) {
+ return(-1);
+ }
+
+ /* !!! FIXME: Is this safe to do? */
+ this->spec.samples = bufsize / 2;
+
+ /* This is useful for debugging */
+ if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) {
+ snd_pcm_uframes_t persize = 0;
+ unsigned int periods = 0;
+
+ ALSA_snd_pcm_hw_params_get_period_size(hwparams, &persize, NULL);
+ ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL);
+
+ fprintf(stderr,
+ "ALSA: period size = %ld, periods = %u, buffer size = %lu\n",
+ persize, periods, bufsize);
+ }
+
+ return(0);
+}
+
+static int
+ALSA_set_period_size(_THIS, snd_pcm_hw_params_t *params, int override)
+{
+ const char *env;
+ int status;
+ snd_pcm_hw_params_t *hwparams;
+ snd_pcm_uframes_t frames;
+ unsigned int periods;
+
+ /* Copy the hardware parameters for this setup */
+ snd_pcm_hw_params_alloca(&hwparams);
+ ALSA_snd_pcm_hw_params_copy(hwparams, params);
+
+ if ( !override ) {
+ env = SDL_getenv("SDL_AUDIO_ALSA_SET_PERIOD_SIZE");
+ if ( env ) {
+ override = SDL_atoi(env);
+ if ( override == 0 ) {
+ return(-1);
+ }
+ }
+ }
+
+ frames = this->spec.samples;
+ status = ALSA_snd_pcm_hw_params_set_period_size_near(
+ this->hidden->pcm_handle, hwparams, &frames, NULL);
+ if ( status < 0 ) {
+ return(-1);
+ }
+
+ periods = 2;
+ status = ALSA_snd_pcm_hw_params_set_periods_near(
+ this->hidden->pcm_handle, hwparams, &periods, NULL);
+ if ( status < 0 ) {
+ return(-1);
+ }
+
+ return ALSA_finalize_hardware(this, hwparams, override);
+}
+
+static int
+ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params, int override)
+{
+ const char *env;
+ int status;
+ snd_pcm_hw_params_t *hwparams;
+ snd_pcm_uframes_t frames;
+
+ /* Copy the hardware parameters for this setup */
+ snd_pcm_hw_params_alloca(&hwparams);
+ ALSA_snd_pcm_hw_params_copy(hwparams, params);
+
+ if ( !override ) {
+ env = SDL_getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE");
+ if ( env ) {
+ override = SDL_atoi(env);
+ if ( override == 0 ) {
+ return(-1);
+ }
+ }
+ }
+
+ frames = this->spec.samples * 2;
+ status = ALSA_snd_pcm_hw_params_set_buffer_size_near(
+ this->hidden->pcm_handle, hwparams, &frames);
+ if ( status < 0 ) {
+ return(-1);
+ }
+
+ return ALSA_finalize_hardware(this, hwparams, override);
+}
+
+static int
+ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ int status = 0;
+ snd_pcm_t *pcm_handle = NULL;
+ snd_pcm_hw_params_t *hwparams = NULL;
+ snd_pcm_sw_params_t *swparams = NULL;
+ snd_pcm_format_t format = 0;
+ SDL_AudioFormat test_format = 0;
+ unsigned int rate = 0;
+ unsigned int channels = 0;
+#ifdef SND_CHMAP_API_VERSION
+ snd_pcm_chmap_t *chmap;
+ char chmap_str[64];
+#endif
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Open the audio device */
+ /* Name of device should depend on # channels in spec */
+ status = ALSA_snd_pcm_open(&pcm_handle,
+ get_audio_device(handle, this->spec.channels),
+ iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
+ SND_PCM_NONBLOCK);
+
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't open audio device: %s",
+ ALSA_snd_strerror(status));
+ }
+
+ this->hidden->pcm_handle = pcm_handle;
+
+ /* Figure out what the hardware is capable of */
+ snd_pcm_hw_params_alloca(&hwparams);
+ status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't get hardware config: %s",
+ ALSA_snd_strerror(status));
+ }
+
+ /* SDL only uses interleaved sample output */
+ status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't set interleaved access: %s",
+ ALSA_snd_strerror(status));
+ }
+
+ /* Try for a closest match on audio format */
+ status = -1;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ test_format && (status < 0);) {
+ status = 0; /* if we can't support a format, it'll become -1. */
+ switch (test_format) {
+ case AUDIO_U8:
+ format = SND_PCM_FORMAT_U8;
+ break;
+ case AUDIO_S8:
+ format = SND_PCM_FORMAT_S8;
+ break;
+ case AUDIO_S16LSB:
+ format = SND_PCM_FORMAT_S16_LE;
+ break;
+ case AUDIO_S16MSB:
+ format = SND_PCM_FORMAT_S16_BE;
+ break;
+ case AUDIO_U16LSB:
+ format = SND_PCM_FORMAT_U16_LE;
+ break;
+ case AUDIO_U16MSB:
+ format = SND_PCM_FORMAT_U16_BE;
+ break;
+ case AUDIO_S32LSB:
+ format = SND_PCM_FORMAT_S32_LE;
+ break;
+ case AUDIO_S32MSB:
+ format = SND_PCM_FORMAT_S32_BE;
+ break;
+ case AUDIO_F32LSB:
+ format = SND_PCM_FORMAT_FLOAT_LE;
+ break;
+ case AUDIO_F32MSB:
+ format = SND_PCM_FORMAT_FLOAT_BE;
+ break;
+ default:
+ status = -1;
+ break;
+ }
+ if (status >= 0) {
+ status = ALSA_snd_pcm_hw_params_set_format(pcm_handle,
+ hwparams, format);
+ }
+ if (status < 0) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ /* Validate number of channels and determine if swizzling is necessary
+ * Assume original swizzling, until proven otherwise.
+ */
+ this->hidden->swizzle_func = swizzle_alsa_channels;
+#ifdef SND_CHMAP_API_VERSION
+ chmap = ALSA_snd_pcm_get_chmap(pcm_handle);
+ if (chmap) {
+ ALSA_snd_pcm_chmap_print(chmap, sizeof(chmap_str), chmap_str);
+ if (SDL_strcmp("FL FR FC LFE RL RR", chmap_str) == 0 ||
+ SDL_strcmp("FL FR FC LFE SL SR", chmap_str) == 0) {
+ this->hidden->swizzle_func = no_swizzle;
+ }
+ free(chmap);
+ }
+#endif /* SND_CHMAP_API_VERSION */
+
+ /* Set the number of channels */
+ status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams,
+ this->spec.channels);
+ channels = this->spec.channels;
+ if (status < 0) {
+ status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't set audio channels");
+ }
+ this->spec.channels = channels;
+ }
+
+ /* Set the audio rate */
+ rate = this->spec.freq;
+ status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams,
+ &rate, NULL);
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't set audio frequency: %s",
+ ALSA_snd_strerror(status));
+ }
+ this->spec.freq = rate;
+
+ /* Set the buffer size, in samples */
+ if ( ALSA_set_period_size(this, hwparams, 0) < 0 &&
+ ALSA_set_buffer_size(this, hwparams, 0) < 0 ) {
+ /* Failed to set desired buffer size, do the best you can... */
+ status = ALSA_set_period_size(this, hwparams, 1);
+ if (status < 0) {
+ return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
+ }
+ }
+ /* Set the software parameters */
+ snd_pcm_sw_params_alloca(&swparams);
+ status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams);
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't get software config: %s",
+ ALSA_snd_strerror(status));
+ }
+ status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples);
+ if (status < 0) {
+ return SDL_SetError("Couldn't set minimum available samples: %s",
+ ALSA_snd_strerror(status));
+ }
+ status =
+ ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
+ if (status < 0) {
+ return SDL_SetError("ALSA: Couldn't set start threshold: %s",
+ ALSA_snd_strerror(status));
+ }
+ status = ALSA_snd_pcm_sw_params(pcm_handle, swparams);
+ if (status < 0) {
+ return SDL_SetError("Couldn't set software audio parameters: %s",
+ ALSA_snd_strerror(status));
+ }
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ if (!iscapture) {
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
+ }
+
+ if (!iscapture) {
+ ALSA_snd_pcm_nonblock(pcm_handle, 0);
+ }
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+typedef struct ALSA_Device
+{
+ char *name;
+ SDL_bool iscapture;
+ struct ALSA_Device *next;
+} ALSA_Device;
+
+static void
+add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSeen)
+{
+ ALSA_Device *dev = SDL_malloc(sizeof (ALSA_Device));
+ char *desc;
+ char *handle = NULL;
+ char *ptr;
+
+ if (!dev) {
+ return;
+ }
+
+ /* Not all alsa devices are enumerable via snd_device_name_get_hint
+ (i.e. bluetooth devices). Therefore if hint is passed in to this
+ function as NULL, assume name contains desc.
+ Make sure not to free the storage associated with desc in this case */
+ if (hint) {
+ desc = ALSA_snd_device_name_get_hint(hint, "DESC");
+ if (!desc) {
+ SDL_free(dev);
+ return;
+ }
+ } else {
+ desc = (char *) name;
+ }
+
+ SDL_assert(name != NULL);
+
+ /* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output".
+ just chop the extra lines off, this seems to get a reasonable device
+ name without extra details. */
+ if ((ptr = strchr(desc, '\n')) != NULL) {
+ *ptr = '\0';
+ }
+
+ /*printf("ALSA: adding %s device '%s' (%s)\n", iscapture ? "capture" : "output", name, desc);*/
+
+ handle = SDL_strdup(name);
+ if (!handle) {
+ if (hint) {
+ free(desc);
+ }
+ SDL_free(dev);
+ return;
+ }
+
+ SDL_AddAudioDevice(iscapture, desc, handle);
+ if (hint)
+ free(desc);
+ dev->name = handle;
+ dev->iscapture = iscapture;
+ dev->next = *pSeen;
+ *pSeen = dev;
+}
+
+
+static SDL_atomic_t ALSA_hotplug_shutdown;
+static SDL_Thread *ALSA_hotplug_thread;
+
+static int SDLCALL
+ALSA_HotplugThread(void *arg)
+{
+ SDL_sem *first_run_semaphore = (SDL_sem *) arg;
+ ALSA_Device *devices = NULL;
+ ALSA_Device *next;
+ ALSA_Device *dev;
+ Uint32 ticks;
+
+ SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW);
+
+ while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) {
+ void **hints = NULL;
+ ALSA_Device *unseen;
+ ALSA_Device *seen;
+ ALSA_Device *prev;
+
+ if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) {
+ int i, j;
+ const char *match = NULL;
+ int bestmatch = 0xFFFF;
+ size_t match_len = 0;
+ int defaultdev = -1;
+ static const char * const prefixes[] = {
+ "hw:", "sysdefault:", "default:", NULL
+ };
+
+ unseen = devices;
+ seen = NULL;
+ /* Apparently there are several different ways that ALSA lists
+ actual hardware. It could be prefixed with "hw:" or "default:"
+ or "sysdefault:" and maybe others. Go through the list and see
+ if we can find a preferred prefix for the system. */
+ for (i = 0; hints[i]; i++) {
+ char *name = ALSA_snd_device_name_get_hint(hints[i], "NAME");
+ if (!name) {
+ continue;
+ }
+
+ /* full name, not a prefix */
+ if ((defaultdev == -1) && (SDL_strcmp(name, "default") == 0)) {
+ defaultdev = i;
+ }
+
+ for (j = 0; prefixes[j]; j++) {
+ const char *prefix = prefixes[j];
+ const size_t prefixlen = SDL_strlen(prefix);
+ if (SDL_strncmp(name, prefix, prefixlen) == 0) {
+ if (j < bestmatch) {
+ bestmatch = j;
+ match = prefix;
+ match_len = prefixlen;
+ }
+ }
+ }
+
+ free(name);
+ }
+
+ /* look through the list of device names to find matches */
+ for (i = 0; hints[i]; i++) {
+ char *name;
+
+ /* if we didn't find a device name prefix we like at all... */
+ if ((!match) && (defaultdev != i)) {
+ continue; /* ...skip anything that isn't the default device. */
+ }
+
+ name = ALSA_snd_device_name_get_hint(hints[i], "NAME");
+ if (!name) {
+ continue;
+ }
+
+ /* only want physical hardware interfaces */
+ if (!match || (SDL_strncmp(name, match, match_len) == 0)) {
+ char *ioid = ALSA_snd_device_name_get_hint(hints[i], "IOID");
+ const SDL_bool isoutput = (ioid == NULL) || (SDL_strcmp(ioid, "Output") == 0);
+ const SDL_bool isinput = (ioid == NULL) || (SDL_strcmp(ioid, "Input") == 0);
+ SDL_bool have_output = SDL_FALSE;
+ SDL_bool have_input = SDL_FALSE;
+
+ free(ioid);
+
+ if (!isoutput && !isinput) {
+ free(name);
+ continue;
+ }
+
+ prev = NULL;
+ for (dev = unseen; dev; dev = next) {
+ next = dev->next;
+ if ( (SDL_strcmp(dev->name, name) == 0) && (((isinput) && dev->iscapture) || ((isoutput) && !dev->iscapture)) ) {
+ if (prev) {
+ prev->next = next;
+ } else {
+ unseen = next;
+ }
+ dev->next = seen;
+ seen = dev;
+ if (isinput) have_input = SDL_TRUE;
+ if (isoutput) have_output = SDL_TRUE;
+ } else {
+ prev = dev;
+ }
+ }
+
+ if (isinput && !have_input) {
+ add_device(SDL_TRUE, name, hints[i], &seen);
+ }
+ if (isoutput && !have_output) {
+ add_device(SDL_FALSE, name, hints[i], &seen);
+ }
+ }
+
+ free(name);
+ }
+
+ ALSA_snd_device_name_free_hint(hints);
+
+ devices = seen; /* now we have a known-good list of attached devices. */
+
+ /* report anything still in unseen as removed. */
+ for (dev = unseen; dev; dev = next) {
+ /*printf("ALSA: removing usb %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/
+ next = dev->next;
+ SDL_RemoveAudioDevice(dev->iscapture, dev->name);
+ SDL_free(dev->name);
+ SDL_free(dev);
+ }
+ }
+
+ /* On first run, tell ALSA_DetectDevices() that we have a complete device list so it can return. */
+ if (first_run_semaphore) {
+ SDL_SemPost(first_run_semaphore);
+ first_run_semaphore = NULL; /* let other thread clean it up. */
+ }
+
+ /* Block awhile before checking again, unless we're told to stop. */
+ ticks = SDL_GetTicks() + 5000;
+ while (!SDL_AtomicGet(&ALSA_hotplug_shutdown) && !SDL_TICKS_PASSED(SDL_GetTicks(), ticks)) {
+ SDL_Delay(100);
+ }
+ }
+
+ /* Shutting down! Clean up any data we've gathered. */
+ for (dev = devices; dev; dev = next) {
+ /*printf("ALSA: at shutdown, removing %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/
+ next = dev->next;
+ SDL_free(dev->name);
+ SDL_free(dev);
+ }
+
+ return 0;
+}
+
+static void
+ALSA_DetectDevices(void)
+{
+ /* Start the device detection thread here, wait for an initial iteration to complete. */
+ SDL_sem *semaphore = SDL_CreateSemaphore(0);
+ if (!semaphore) {
+ return; /* oh well. */
+ }
+
+ SDL_AtomicSet(&ALSA_hotplug_shutdown, 0);
+
+ ALSA_hotplug_thread = SDL_CreateThread(ALSA_HotplugThread, "SDLHotplugALSA", semaphore);
+ if (ALSA_hotplug_thread) {
+ SDL_SemWait(semaphore); /* wait for the first iteration to finish. */
+ }
+
+ SDL_DestroySemaphore(semaphore);
+}
+
+static void
+ALSA_Deinitialize(void)
+{
+ if (ALSA_hotplug_thread != NULL) {
+ SDL_AtomicSet(&ALSA_hotplug_shutdown, 1);
+ SDL_WaitThread(ALSA_hotplug_thread, NULL);
+ ALSA_hotplug_thread = NULL;
+ }
+
+ UnloadALSALibrary();
+}
+
+static int
+ALSA_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadALSALibrary() < 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->DetectDevices = ALSA_DetectDevices;
+ impl->OpenDevice = ALSA_OpenDevice;
+ impl->WaitDevice = ALSA_WaitDevice;
+ impl->GetDeviceBuf = ALSA_GetDeviceBuf;
+ impl->PlayDevice = ALSA_PlayDevice;
+ impl->CloseDevice = ALSA_CloseDevice;
+ impl->Deinitialize = ALSA_Deinitialize;
+ impl->CaptureFromDevice = ALSA_CaptureFromDevice;
+ impl->FlushCapture = ALSA_FlushCapture;
+
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap ALSA_bootstrap = {
+ "alsa", "ALSA PCM audio", ALSA_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_ALSA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.h b/src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.h
new file mode 100644
index 0000000..f620500
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/alsa/SDL_alsa_audio.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_ALSA_audio_h_
+#define SDL_ALSA_audio_h_
+
+#include <alsa/asoundlib.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The audio device handle */
+ snd_pcm_t *pcm_handle;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ /* swizzle function */
+ void (*swizzle_func)(_THIS, void *buffer, Uint32 bufferlen);
+};
+
+#endif /* SDL_ALSA_audio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.c b/src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.c
new file mode 100644
index 0000000..7a25424
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.c
@@ -0,0 +1,226 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_ANDROID
+
+/* Output audio to Android */
+
+#include "SDL_assert.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_androidaudio.h"
+
+#include "../../core/android/SDL_android.h"
+
+#include <android/log.h>
+
+static SDL_AudioDevice* audioDevice = NULL;
+static SDL_AudioDevice* captureDevice = NULL;
+
+static int
+ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ SDL_AudioFormat test_format;
+
+ SDL_assert((captureDevice == NULL) || !iscapture);
+ SDL_assert((audioDevice == NULL) || iscapture);
+
+ if (iscapture) {
+ captureDevice = this;
+ } else {
+ audioDevice = this;
+ }
+
+ this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ test_format = SDL_FirstAudioFormat(this->spec.format);
+ while (test_format != 0) { /* no "UNKNOWN" constant */
+ if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) {
+ this->spec.format = test_format;
+ break;
+ }
+ test_format = SDL_NextAudioFormat();
+ }
+
+ if (test_format == 0) {
+ /* Didn't find a compatible format :( */
+ return SDL_SetError("No compatible audio format!");
+ }
+
+ if (this->spec.channels > 1) {
+ this->spec.channels = 2;
+ } else {
+ this->spec.channels = 1;
+ }
+
+ if (this->spec.freq < 8000) {
+ this->spec.freq = 8000;
+ }
+ if (this->spec.freq > 48000) {
+ this->spec.freq = 48000;
+ }
+
+ /* TODO: pass in/return a (Java) device ID */
+ this->spec.samples = Android_JNI_OpenAudioDevice(iscapture, this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
+
+ if (this->spec.samples == 0) {
+ /* Init failed? */
+ return SDL_SetError("Java-side initialization failed!");
+ }
+
+ SDL_CalculateAudioSpec(&this->spec);
+
+ return 0;
+}
+
+static void
+ANDROIDAUDIO_PlayDevice(_THIS)
+{
+ Android_JNI_WriteAudioBuffer();
+}
+
+static Uint8 *
+ANDROIDAUDIO_GetDeviceBuf(_THIS)
+{
+ return Android_JNI_GetAudioBuffer();
+}
+
+static int
+ANDROIDAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ return Android_JNI_CaptureAudioBuffer(buffer, buflen);
+}
+
+static void
+ANDROIDAUDIO_FlushCapture(_THIS)
+{
+ Android_JNI_FlushCapturedAudio();
+}
+
+static void
+ANDROIDAUDIO_CloseDevice(_THIS)
+{
+ /* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread
+ so it's safe to terminate the Java side buffer and AudioTrack
+ */
+ Android_JNI_CloseAudioDevice(this->iscapture);
+ if (this->iscapture) {
+ SDL_assert(captureDevice == this);
+ captureDevice = NULL;
+ } else {
+ SDL_assert(audioDevice == this);
+ audioDevice = NULL;
+ }
+ SDL_free(this->hidden);
+}
+
+static int
+ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = ANDROIDAUDIO_OpenDevice;
+ impl->PlayDevice = ANDROIDAUDIO_PlayDevice;
+ impl->GetDeviceBuf = ANDROIDAUDIO_GetDeviceBuf;
+ impl->CloseDevice = ANDROIDAUDIO_CloseDevice;
+ impl->CaptureFromDevice = ANDROIDAUDIO_CaptureFromDevice;
+ impl->FlushCapture = ANDROIDAUDIO_FlushCapture;
+
+ /* and the capabilities */
+ impl->HasCaptureSupport = SDL_TRUE;
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultCaptureDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap ANDROIDAUDIO_bootstrap = {
+ "android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0
+};
+
+/* Pause (block) all non already paused audio devices by taking their mixer lock */
+void ANDROIDAUDIO_PauseDevices(void)
+{
+ /* TODO: Handle multiple devices? */
+ struct SDL_PrivateAudioData *private;
+ if(audioDevice != NULL && audioDevice->hidden != NULL) {
+ private = (struct SDL_PrivateAudioData *) audioDevice->hidden;
+ if (SDL_AtomicGet(&audioDevice->paused)) {
+ /* The device is already paused, leave it alone */
+ private->resume = SDL_FALSE;
+ }
+ else {
+ SDL_LockMutex(audioDevice->mixer_lock);
+ SDL_AtomicSet(&audioDevice->paused, 1);
+ private->resume = SDL_TRUE;
+ }
+ }
+
+ if(captureDevice != NULL && captureDevice->hidden != NULL) {
+ private = (struct SDL_PrivateAudioData *) captureDevice->hidden;
+ if (SDL_AtomicGet(&captureDevice->paused)) {
+ /* The device is already paused, leave it alone */
+ private->resume = SDL_FALSE;
+ }
+ else {
+ SDL_LockMutex(captureDevice->mixer_lock);
+ SDL_AtomicSet(&captureDevice->paused, 1);
+ private->resume = SDL_TRUE;
+ }
+ }
+}
+
+/* Resume (unblock) all non already paused audio devices by releasing their mixer lock */
+void ANDROIDAUDIO_ResumeDevices(void)
+{
+ /* TODO: Handle multiple devices? */
+ struct SDL_PrivateAudioData *private;
+ if(audioDevice != NULL && audioDevice->hidden != NULL) {
+ private = (struct SDL_PrivateAudioData *) audioDevice->hidden;
+ if (private->resume) {
+ SDL_AtomicSet(&audioDevice->paused, 0);
+ private->resume = SDL_FALSE;
+ SDL_UnlockMutex(audioDevice->mixer_lock);
+ }
+ }
+
+ if(captureDevice != NULL && captureDevice->hidden != NULL) {
+ private = (struct SDL_PrivateAudioData *) captureDevice->hidden;
+ if (private->resume) {
+ SDL_AtomicSet(&captureDevice->paused, 0);
+ private->resume = SDL_FALSE;
+ SDL_UnlockMutex(captureDevice->mixer_lock);
+ }
+ }
+}
+
+#else
+
+void ANDROIDAUDIO_ResumeDevices(void) {}
+void ANDROIDAUDIO_PauseDevices(void) {}
+
+#endif /* SDL_AUDIO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.h b/src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.h
new file mode 100644
index 0000000..c732ac6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/android/SDL_androidaudio.h
@@ -0,0 +1,42 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_androidaudio_h_
+#define SDL_androidaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* Resume device if it was paused automatically */
+ int resume;
+};
+
+void ANDROIDAUDIO_ResumeDevices(void);
+void ANDROIDAUDIO_PauseDevices(void);
+
+#endif /* SDL_androidaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.c b/src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.c
new file mode 100644
index 0000000..4e3ebf2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.c
@@ -0,0 +1,365 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_ARTS
+
+/* Allow access to a raw mixing buffer */
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_artsaudio.h"
+
+#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+#else
+#define SDL_NAME(X) X
+#endif
+
+#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
+
+static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
+static void *arts_handle = NULL;
+
+/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
+static int (*SDL_NAME(arts_init)) (void);
+static void (*SDL_NAME(arts_free)) (void);
+static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits,
+ int channels,
+ const char *name);
+static int (*SDL_NAME(arts_stream_set)) (arts_stream_t s,
+ arts_parameter_t param, int value);
+static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s,
+ arts_parameter_t param);
+static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer,
+ int count);
+static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s);
+static int (*SDL_NAME(arts_suspend))(void);
+static int (*SDL_NAME(arts_suspended)) (void);
+static const char *(*SDL_NAME(arts_error_text)) (int errorcode);
+
+#define SDL_ARTS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
+static struct
+{
+ const char *name;
+ void **func;
+} arts_functions[] = {
+/* *INDENT-OFF* */
+ SDL_ARTS_SYM(arts_init),
+ SDL_ARTS_SYM(arts_free),
+ SDL_ARTS_SYM(arts_play_stream),
+ SDL_ARTS_SYM(arts_stream_set),
+ SDL_ARTS_SYM(arts_stream_get),
+ SDL_ARTS_SYM(arts_write),
+ SDL_ARTS_SYM(arts_close_stream),
+ SDL_ARTS_SYM(arts_suspend),
+ SDL_ARTS_SYM(arts_suspended),
+ SDL_ARTS_SYM(arts_error_text),
+/* *INDENT-ON* */
+};
+
+#undef SDL_ARTS_SYM
+
+static void
+UnloadARTSLibrary()
+{
+ if (arts_handle != NULL) {
+ SDL_UnloadObject(arts_handle);
+ arts_handle = NULL;
+ }
+}
+
+static int
+LoadARTSLibrary(void)
+{
+ int i, retval = -1;
+
+ if (arts_handle == NULL) {
+ arts_handle = SDL_LoadObject(arts_library);
+ if (arts_handle != NULL) {
+ retval = 0;
+ for (i = 0; i < SDL_arraysize(arts_functions); ++i) {
+ *arts_functions[i].func =
+ SDL_LoadFunction(arts_handle, arts_functions[i].name);
+ if (!*arts_functions[i].func) {
+ retval = -1;
+ UnloadARTSLibrary();
+ break;
+ }
+ }
+ }
+ }
+
+ return retval;
+}
+
+#else
+
+static void
+UnloadARTSLibrary()
+{
+ return;
+}
+
+static int
+LoadARTSLibrary(void)
+{
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+ARTS_WaitDevice(_THIS)
+{
+ Sint32 ticks;
+
+ /* Check to see if the thread-parent process is still alive */
+ {
+ static int cnt = 0;
+ /* Note that this only works with thread implementations
+ that use a different process id for each thread.
+ */
+ /* Check every 10 loops */
+ if (this->hidden->parent && (((++cnt) % 10) == 0)) {
+ if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ }
+ }
+
+ /* Use timer for general audio synchronization */
+ ticks =
+ ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
+}
+
+static void
+ARTS_PlayDevice(_THIS)
+{
+ /* Write the audio data */
+ int written = SDL_NAME(arts_write) (this->hidden->stream,
+ this->hidden->mixbuf,
+ this->hidden->mixlen);
+
+ /* If timer synchronization is enabled, set the next write frame */
+ if (this->hidden->frame_ticks) {
+ this->hidden->next_frame += this->hidden->frame_ticks;
+ }
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
+}
+
+static Uint8 *
+ARTS_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+
+static void
+ARTS_CloseDevice(_THIS)
+{
+ if (this->hidden->stream) {
+ SDL_NAME(arts_close_stream) (this->hidden->stream);
+ }
+ SDL_NAME(arts_free) ();
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static int
+ARTS_Suspend(void)
+{
+ const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */
+ while ( (!SDL_NAME(arts_suspended)()) && !SDL_TICKS_PASSED(SDL_GetTicks(), abortms) ) {
+ if ( SDL_NAME(arts_suspend)() ) {
+ break;
+ }
+ }
+ return SDL_NAME(arts_suspended)();
+}
+
+static int
+ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ int rc = 0;
+ int bits = 0, frag_spec = 0;
+ SDL_AudioFormat test_format = 0, format = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ bits = 8;
+ format = 1;
+ break;
+ case AUDIO_S16LSB:
+ bits = 16;
+ format = 1;
+ break;
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ return SDL_SetError("Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ if ((rc = SDL_NAME(arts_init) ()) != 0) {
+ return SDL_SetError("Unable to initialize ARTS: %s",
+ SDL_NAME(arts_error_text) (rc));
+ }
+
+ if (!ARTS_Suspend()) {
+ return SDL_SetError("ARTS can not open audio device");
+ }
+
+ this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq,
+ bits,
+ this->spec.channels,
+ "SDL");
+
+ /* Play nothing so we have at least one write (server bug workaround). */
+ SDL_NAME(arts_write) (this->hidden->stream, "", 0);
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Determine the power of two of the fragment size */
+ for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec);
+ if ((0x01 << frag_spec) != this->spec.size) {
+ return SDL_SetError("Fragment size must be a power of two");
+ }
+ frag_spec |= 0x00020000; /* two fragments, for low latency */
+
+#ifdef ARTS_P_PACKET_SETTINGS
+ SDL_NAME(arts_stream_set) (this->hidden->stream,
+ ARTS_P_PACKET_SETTINGS, frag_spec);
+#else
+ SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_SIZE,
+ frag_spec & 0xffff);
+ SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_COUNT,
+ frag_spec >> 16);
+#endif
+ this->spec.size = SDL_NAME(arts_stream_get) (this->hidden->stream,
+ ARTS_P_PACKET_SIZE);
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /* Get the parent process id (we're the parent of the audio thread) */
+ this->hidden->parent = getpid();
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+
+static void
+ARTS_Deinitialize(void)
+{
+ UnloadARTSLibrary();
+}
+
+
+static int
+ARTS_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadARTSLibrary() < 0) {
+ return 0;
+ } else {
+ if (SDL_NAME(arts_init) () != 0) {
+ UnloadARTSLibrary();
+ SDL_SetError("ARTS: arts_init failed (no audio server?)");
+ return 0;
+ }
+
+ /* Play a stream so aRts doesn't crash */
+ if (ARTS_Suspend()) {
+ arts_stream_t stream;
+ stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL");
+ SDL_NAME(arts_write) (stream, "", 0);
+ SDL_NAME(arts_close_stream) (stream);
+ }
+
+ SDL_NAME(arts_free) ();
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = ARTS_OpenDevice;
+ impl->PlayDevice = ARTS_PlayDevice;
+ impl->WaitDevice = ARTS_WaitDevice;
+ impl->GetDeviceBuf = ARTS_GetDeviceBuf;
+ impl->CloseDevice = ARTS_CloseDevice;
+ impl->Deinitialize = ARTS_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap ARTS_bootstrap = {
+ "arts", "Analog RealTime Synthesizer", ARTS_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_ARTS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.h b/src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.h
new file mode 100644
index 0000000..7743654
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/arts/SDL_artsaudio.h
@@ -0,0 +1,53 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_artsaudio_h_
+#define SDL_artsaudio_h_
+
+#include <artsc.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The stream descriptor for the audio device */
+ arts_stream_t stream;
+
+ /* The parent process id, to detect when application quits */
+ pid_t parent;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ /* Support for audio timing using a timer, in addition to SDL_IOReady() */
+ float frame_ticks;
+ float next_frame;
+};
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+
+#endif /* SDL_artsaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.h b/src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.h
new file mode 100644
index 0000000..7ce8b8d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.h
@@ -0,0 +1,68 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_coreaudio_h_
+#define SDL_coreaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+#if !defined(__IPHONEOS__)
+#define MACOSX_COREAUDIO 1
+#endif
+
+#if MACOSX_COREAUDIO
+#include <CoreAudio/CoreAudio.h>
+#include <CoreServices/CoreServices.h>
+#else
+#import <AVFoundation/AVFoundation.h>
+#import <UIKit/UIApplication.h>
+#endif
+
+#include <AudioToolbox/AudioToolbox.h>
+#include <AudioUnit/AudioUnit.h>
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ SDL_Thread *thread;
+ AudioQueueRef audioQueue;
+ AudioQueueBufferRef *audioBuffer;
+ void *buffer;
+ UInt32 bufferOffset;
+ UInt32 bufferSize;
+ AudioStreamBasicDescription strdesc;
+ SDL_sem *ready_semaphore;
+ char *thread_error;
+ SDL_atomic_t shutdown;
+#if MACOSX_COREAUDIO
+ AudioDeviceID deviceID;
+#else
+ SDL_bool interrupted;
+ CFTypeRef interruption_listener;
+#endif
+};
+
+#endif /* SDL_coreaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.m b/src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.m
new file mode 100644
index 0000000..92f5f12
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/coreaudio/SDL_coreaudio.m
@@ -0,0 +1,891 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_COREAUDIO
+
+/* !!! FIXME: clean out some of the macro salsa in here. */
+
+#include "SDL_audio.h"
+#include "SDL_hints.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_coreaudio.h"
+#include "SDL_assert.h"
+#include "../../thread/SDL_systhread.h"
+
+#define DEBUG_COREAUDIO 0
+
+#define CHECK_RESULT(msg) \
+ if (result != noErr) { \
+ SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
+ return 0; \
+ }
+
+#if MACOSX_COREAUDIO
+static const AudioObjectPropertyAddress devlist_address = {
+ kAudioHardwarePropertyDevices,
+ kAudioObjectPropertyScopeGlobal,
+ kAudioObjectPropertyElementMaster
+};
+
+typedef void (*addDevFn)(const char *name, const int iscapture, AudioDeviceID devId, void *data);
+
+typedef struct AudioDeviceList
+{
+ AudioDeviceID devid;
+ SDL_bool alive;
+ struct AudioDeviceList *next;
+} AudioDeviceList;
+
+static AudioDeviceList *output_devs = NULL;
+static AudioDeviceList *capture_devs = NULL;
+
+static SDL_bool
+add_to_internal_dev_list(const int iscapture, AudioDeviceID devId)
+{
+ AudioDeviceList *item = (AudioDeviceList *) SDL_malloc(sizeof (AudioDeviceList));
+ if (item == NULL) {
+ return SDL_FALSE;
+ }
+ item->devid = devId;
+ item->alive = SDL_TRUE;
+ item->next = iscapture ? capture_devs : output_devs;
+ if (iscapture) {
+ capture_devs = item;
+ } else {
+ output_devs = item;
+ }
+
+ return SDL_TRUE;
+}
+
+static void
+addToDevList(const char *name, const int iscapture, AudioDeviceID devId, void *data)
+{
+ if (add_to_internal_dev_list(iscapture, devId)) {
+ SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId));
+ }
+}
+
+static void
+build_device_list(int iscapture, addDevFn addfn, void *addfndata)
+{
+ OSStatus result = noErr;
+ UInt32 size = 0;
+ AudioDeviceID *devs = NULL;
+ UInt32 i = 0;
+ UInt32 max = 0;
+
+ result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
+ &devlist_address, 0, NULL, &size);
+ if (result != kAudioHardwareNoError)
+ return;
+
+ devs = (AudioDeviceID *) alloca(size);
+ if (devs == NULL)
+ return;
+
+ result = AudioObjectGetPropertyData(kAudioObjectSystemObject,
+ &devlist_address, 0, NULL, &size, devs);
+ if (result != kAudioHardwareNoError)
+ return;
+
+ max = size / sizeof (AudioDeviceID);
+ for (i = 0; i < max; i++) {
+ CFStringRef cfstr = NULL;
+ char *ptr = NULL;
+ AudioDeviceID dev = devs[i];
+ AudioBufferList *buflist = NULL;
+ int usable = 0;
+ CFIndex len = 0;
+ const AudioObjectPropertyAddress addr = {
+ kAudioDevicePropertyStreamConfiguration,
+ iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
+ kAudioObjectPropertyElementMaster
+ };
+
+ const AudioObjectPropertyAddress nameaddr = {
+ kAudioObjectPropertyName,
+ iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
+ kAudioObjectPropertyElementMaster
+ };
+
+ result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size);
+ if (result != noErr)
+ continue;
+
+ buflist = (AudioBufferList *) SDL_malloc(size);
+ if (buflist == NULL)
+ continue;
+
+ result = AudioObjectGetPropertyData(dev, &addr, 0, NULL,
+ &size, buflist);
+
+ if (result == noErr) {
+ UInt32 j;
+ for (j = 0; j < buflist->mNumberBuffers; j++) {
+ if (buflist->mBuffers[j].mNumberChannels > 0) {
+ usable = 1;
+ break;
+ }
+ }
+ }
+
+ SDL_free(buflist);
+
+ if (!usable)
+ continue;
+
+
+ size = sizeof (CFStringRef);
+ result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr);
+ if (result != kAudioHardwareNoError)
+ continue;
+
+ len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr),
+ kCFStringEncodingUTF8);
+
+ ptr = (char *) SDL_malloc(len + 1);
+ usable = ((ptr != NULL) &&
+ (CFStringGetCString
+ (cfstr, ptr, len + 1, kCFStringEncodingUTF8)));
+
+ CFRelease(cfstr);
+
+ if (usable) {
+ len = strlen(ptr);
+ /* Some devices have whitespace at the end...trim it. */
+ while ((len > 0) && (ptr[len - 1] == ' ')) {
+ len--;
+ }
+ usable = (len > 0);
+ }
+
+ if (usable) {
+ ptr[len] = '\0';
+
+#if DEBUG_COREAUDIO
+ printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n",
+ ((iscapture) ? "capture" : "output"),
+ (int) i, ptr, (int) dev);
+#endif
+ addfn(ptr, iscapture, dev, addfndata);
+ }
+ SDL_free(ptr); /* addfn() would have copied the string. */
+ }
+}
+
+static void
+free_audio_device_list(AudioDeviceList **list)
+{
+ AudioDeviceList *item = *list;
+ while (item) {
+ AudioDeviceList *next = item->next;
+ SDL_free(item);
+ item = next;
+ }
+ *list = NULL;
+}
+
+static void
+COREAUDIO_DetectDevices(void)
+{
+ build_device_list(SDL_TRUE, addToDevList, NULL);
+ build_device_list(SDL_FALSE, addToDevList, NULL);
+}
+
+static void
+build_device_change_list(const char *name, const int iscapture, AudioDeviceID devId, void *data)
+{
+ AudioDeviceList **list = (AudioDeviceList **) data;
+ AudioDeviceList *item;
+ for (item = *list; item != NULL; item = item->next) {
+ if (item->devid == devId) {
+ item->alive = SDL_TRUE;
+ return;
+ }
+ }
+
+ add_to_internal_dev_list(iscapture, devId); /* new device, add it. */
+ SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId));
+}
+
+static void
+reprocess_device_list(const int iscapture, AudioDeviceList **list)
+{
+ AudioDeviceList *item;
+ AudioDeviceList *prev = NULL;
+ for (item = *list; item != NULL; item = item->next) {
+ item->alive = SDL_FALSE;
+ }
+
+ build_device_list(iscapture, build_device_change_list, list);
+
+ /* free items in the list that aren't still alive. */
+ item = *list;
+ while (item != NULL) {
+ AudioDeviceList *next = item->next;
+ if (item->alive) {
+ prev = item;
+ } else {
+ SDL_RemoveAudioDevice(iscapture, (void *) ((size_t) item->devid));
+ if (prev) {
+ prev->next = item->next;
+ } else {
+ *list = item->next;
+ }
+ SDL_free(item);
+ }
+ item = next;
+ }
+}
+
+/* this is called when the system's list of available audio devices changes. */
+static OSStatus
+device_list_changed(AudioObjectID systemObj, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data)
+{
+ reprocess_device_list(SDL_TRUE, &capture_devs);
+ reprocess_device_list(SDL_FALSE, &output_devs);
+ return 0;
+}
+#endif
+
+
+static int open_playback_devices = 0;
+static int open_capture_devices = 0;
+
+#if !MACOSX_COREAUDIO
+
+static void interruption_begin(_THIS)
+{
+ if (this != NULL && this->hidden->audioQueue != NULL) {
+ this->hidden->interrupted = SDL_TRUE;
+ AudioQueuePause(this->hidden->audioQueue);
+ }
+}
+
+static void interruption_end(_THIS)
+{
+ if (this != NULL && this->hidden != NULL && this->hidden->audioQueue != NULL
+ && this->hidden->interrupted
+ && AudioQueueStart(this->hidden->audioQueue, NULL) == AVAudioSessionErrorCodeNone) {
+ this->hidden->interrupted = SDL_FALSE;
+ }
+}
+
+@interface SDLInterruptionListener : NSObject
+
+@property (nonatomic, assign) SDL_AudioDevice *device;
+
+@end
+
+@implementation SDLInterruptionListener
+
+- (void)audioSessionInterruption:(NSNotification *)note
+{
+ @synchronized (self) {
+ NSNumber *type = note.userInfo[AVAudioSessionInterruptionTypeKey];
+ if (type.unsignedIntegerValue == AVAudioSessionInterruptionTypeBegan) {
+ interruption_begin(self.device);
+ } else {
+ interruption_end(self.device);
+ }
+ }
+}
+
+- (void)applicationBecameActive:(NSNotification *)note
+{
+ @synchronized (self) {
+ interruption_end(self.device);
+ }
+}
+
+@end
+
+static BOOL update_audio_session(_THIS, SDL_bool open)
+{
+ @autoreleasepool {
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ /* Set category to ambient by default so that other music continues playing. */
+ NSString *category = AVAudioSessionCategoryAmbient;
+ NSError *err = nil;
+
+ if (open_playback_devices && open_capture_devices) {
+ category = AVAudioSessionCategoryPlayAndRecord;
+ } else if (open_capture_devices) {
+ category = AVAudioSessionCategoryRecord;
+ } else {
+ const char *hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
+ if (hint) {
+ if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
+ category = AVAudioSessionCategoryAmbient;
+ } else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
+ category = AVAudioSessionCategorySoloAmbient;
+ } else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayback") == 0 ||
+ SDL_strcasecmp(hint, "playback") == 0) {
+ category = AVAudioSessionCategoryPlayback;
+ }
+ }
+ }
+
+ if (![session setCategory:category error:&err]) {
+ NSString *desc = err.description;
+ SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
+ return NO;
+ }
+
+ if (open_playback_devices + open_capture_devices == 1) {
+ if (![session setActive:YES error:&err]) {
+ NSString *desc = err.description;
+ SDL_SetError("Could not activate Audio Session: %s", desc.UTF8String);
+ return NO;
+ }
+ } else if (!open_playback_devices && !open_capture_devices) {
+ [session setActive:NO error:nil];
+ }
+
+ if (open) {
+ SDLInterruptionListener *listener = [SDLInterruptionListener new];
+ listener.device = this;
+
+ [center addObserver:listener
+ selector:@selector(audioSessionInterruption:)
+ name:AVAudioSessionInterruptionNotification
+ object:session];
+
+ /* An interruption end notification is not guaranteed to be sent if
+ we were previously interrupted... resuming if needed when the app
+ becomes active seems to be the way to go. */
+ [center addObserver:listener
+ selector:@selector(applicationBecameActive:)
+ name:UIApplicationDidBecomeActiveNotification
+ object:session];
+
+ [center addObserver:listener
+ selector:@selector(applicationBecameActive:)
+ name:UIApplicationWillEnterForegroundNotification
+ object:session];
+
+ this->hidden->interruption_listener = CFBridgingRetain(listener);
+ } else {
+ if (this->hidden->interruption_listener != NULL) {
+ SDLInterruptionListener *listener = nil;
+ listener = (SDLInterruptionListener *) CFBridgingRelease(this->hidden->interruption_listener);
+ @synchronized (listener) {
+ listener.device = NULL;
+ }
+ [center removeObserver:listener];
+ }
+ }
+ }
+
+ return YES;
+}
+#endif
+
+
+/* The AudioQueue callback */
+static void
+outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData;
+ if (SDL_AtomicGet(&this->hidden->shutdown)) {
+ return; /* don't do anything. */
+ }
+
+ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) {
+ /* Supply silence if audio is not enabled or paused */
+ SDL_memset(inBuffer->mAudioData, this->spec.silence, inBuffer->mAudioDataBytesCapacity);
+ } else {
+ UInt32 remaining = inBuffer->mAudioDataBytesCapacity;
+ Uint8 *ptr = (Uint8 *) inBuffer->mAudioData;
+
+ while (remaining > 0) {
+ UInt32 len;
+ if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
+ /* Generate the data */
+ SDL_LockMutex(this->mixer_lock);
+ (*this->callbackspec.callback)(this->callbackspec.userdata,
+ this->hidden->buffer, this->hidden->bufferSize);
+ SDL_UnlockMutex(this->mixer_lock);
+ this->hidden->bufferOffset = 0;
+ }
+
+ len = this->hidden->bufferSize - this->hidden->bufferOffset;
+ if (len > remaining) {
+ len = remaining;
+ }
+ SDL_memcpy(ptr, (char *)this->hidden->buffer +
+ this->hidden->bufferOffset, len);
+ ptr = ptr + len;
+ remaining -= len;
+ this->hidden->bufferOffset += len;
+ }
+ }
+
+ AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL);
+
+ inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity;
+}
+
+static void
+inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer,
+ const AudioTimeStamp *inStartTime, UInt32 inNumberPacketDescriptions,
+ const AudioStreamPacketDescription *inPacketDescs )
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData;
+
+ if (SDL_AtomicGet(&this->shutdown)) {
+ return; /* don't do anything. */
+ }
+
+ /* ignore unless we're active. */
+ if (!SDL_AtomicGet(&this->paused) && SDL_AtomicGet(&this->enabled) && !SDL_AtomicGet(&this->paused)) {
+ const Uint8 *ptr = (const Uint8 *) inBuffer->mAudioData;
+ UInt32 remaining = inBuffer->mAudioDataByteSize;
+ while (remaining > 0) {
+ UInt32 len = this->hidden->bufferSize - this->hidden->bufferOffset;
+ if (len > remaining) {
+ len = remaining;
+ }
+
+ SDL_memcpy((char *)this->hidden->buffer + this->hidden->bufferOffset, ptr, len);
+ ptr += len;
+ remaining -= len;
+ this->hidden->bufferOffset += len;
+
+ if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
+ SDL_LockMutex(this->mixer_lock);
+ (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize);
+ SDL_UnlockMutex(this->mixer_lock);
+ this->hidden->bufferOffset = 0;
+ }
+ }
+ }
+
+ AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL);
+}
+
+
+#if MACOSX_COREAUDIO
+static const AudioObjectPropertyAddress alive_address =
+{
+ kAudioDevicePropertyDeviceIsAlive,
+ kAudioObjectPropertyScopeGlobal,
+ kAudioObjectPropertyElementMaster
+};
+
+static OSStatus
+device_unplugged(AudioObjectID devid, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) data;
+ SDL_bool dead = SDL_FALSE;
+ UInt32 isAlive = 1;
+ UInt32 size = sizeof (isAlive);
+ OSStatus error;
+
+ if (!SDL_AtomicGet(&this->enabled)) {
+ return 0; /* already known to be dead. */
+ }
+
+ error = AudioObjectGetPropertyData(this->hidden->deviceID, &alive_address,
+ 0, NULL, &size, &isAlive);
+
+ if (error == kAudioHardwareBadDeviceError) {
+ dead = SDL_TRUE; /* device was unplugged. */
+ } else if ((error == kAudioHardwareNoError) && (!isAlive)) {
+ dead = SDL_TRUE; /* device died in some other way. */
+ }
+
+ if (dead) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+
+ return 0;
+}
+#endif
+
+static void
+COREAUDIO_CloseDevice(_THIS)
+{
+ const SDL_bool iscapture = this->iscapture;
+
+/* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */
+/* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */
+#if MACOSX_COREAUDIO
+ /* Fire a callback if the device stops being "alive" (disconnected, etc). */
+ AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
+#endif
+
+#if !MACOSX_COREAUDIO
+ update_audio_session(this, SDL_FALSE);
+#endif
+
+ /* if callback fires again, feed silence; don't call into the app. */
+ SDL_AtomicSet(&this->paused, 1);
+
+ if (this->hidden->audioQueue) {
+ AudioQueueDispose(this->hidden->audioQueue, 1);
+ }
+
+ if (this->hidden->thread) {
+ SDL_AtomicSet(&this->hidden->shutdown, 1);
+ SDL_WaitThread(this->hidden->thread, NULL);
+ }
+
+ if (this->hidden->ready_semaphore) {
+ SDL_DestroySemaphore(this->hidden->ready_semaphore);
+ }
+
+ /* AudioQueueDispose() frees the actual buffer objects. */
+ SDL_free(this->hidden->audioBuffer);
+ SDL_free(this->hidden->thread_error);
+ SDL_free(this->hidden->buffer);
+ SDL_free(this->hidden);
+
+ if (iscapture) {
+ open_capture_devices--;
+ } else {
+ open_playback_devices--;
+ }
+}
+
+#if MACOSX_COREAUDIO
+static int
+prepare_device(_THIS, void *handle, int iscapture)
+{
+ AudioDeviceID devid = (AudioDeviceID) ((size_t) handle);
+ OSStatus result = noErr;
+ UInt32 size = 0;
+ UInt32 alive = 0;
+ pid_t pid = 0;
+
+ AudioObjectPropertyAddress addr = {
+ 0,
+ kAudioObjectPropertyScopeGlobal,
+ kAudioObjectPropertyElementMaster
+ };
+
+ if (handle == NULL) {
+ size = sizeof (AudioDeviceID);
+ addr.mSelector =
+ ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice :
+ kAudioHardwarePropertyDefaultOutputDevice);
+ result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr,
+ 0, NULL, &size, &devid);
+ CHECK_RESULT("AudioHardwareGetProperty (default device)");
+ }
+
+ addr.mSelector = kAudioDevicePropertyDeviceIsAlive;
+ addr.mScope = iscapture ? kAudioDevicePropertyScopeInput :
+ kAudioDevicePropertyScopeOutput;
+
+ size = sizeof (alive);
+ result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive);
+ CHECK_RESULT
+ ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)");
+
+ if (!alive) {
+ SDL_SetError("CoreAudio: requested device exists, but isn't alive.");
+ return 0;
+ }
+
+ addr.mSelector = kAudioDevicePropertyHogMode;
+ size = sizeof (pid);
+ result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid);
+
+ /* some devices don't support this property, so errors are fine here. */
+ if ((result == noErr) && (pid != -1)) {
+ SDL_SetError("CoreAudio: requested device is being hogged.");
+ return 0;
+ }
+
+ this->hidden->deviceID = devid;
+ return 1;
+}
+#endif
+
+static int
+prepare_audioqueue(_THIS)
+{
+ const AudioStreamBasicDescription *strdesc = &this->hidden->strdesc;
+ const int iscapture = this->iscapture;
+ OSStatus result;
+ int i;
+
+ SDL_assert(CFRunLoopGetCurrent() != NULL);
+
+ if (iscapture) {
+ result = AudioQueueNewInput(strdesc, inputCallback, this, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &this->hidden->audioQueue);
+ CHECK_RESULT("AudioQueueNewInput");
+ } else {
+ result = AudioQueueNewOutput(strdesc, outputCallback, this, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &this->hidden->audioQueue);
+ CHECK_RESULT("AudioQueueNewOutput");
+ }
+
+#if MACOSX_COREAUDIO
+{
+ const AudioObjectPropertyAddress prop = {
+ kAudioDevicePropertyDeviceUID,
+ iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
+ kAudioObjectPropertyElementMaster
+ };
+ CFStringRef devuid;
+ UInt32 devuidsize = sizeof (devuid);
+ result = AudioObjectGetPropertyData(this->hidden->deviceID, &prop, 0, NULL, &devuidsize, &devuid);
+ CHECK_RESULT("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID)");
+ result = AudioQueueSetProperty(this->hidden->audioQueue, kAudioQueueProperty_CurrentDevice, &devuid, devuidsize);
+ CHECK_RESULT("AudioQueueSetProperty (kAudioQueueProperty_CurrentDevice)");
+
+ /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */
+ /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */
+ /* Fire a callback if the device stops being "alive" (disconnected, etc). */
+ AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
+}
+#endif
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate a sample buffer */
+ this->hidden->bufferSize = this->spec.size;
+ this->hidden->bufferOffset = iscapture ? 0 : this->hidden->bufferSize;
+
+ this->hidden->buffer = SDL_malloc(this->hidden->bufferSize);
+ if (this->hidden->buffer == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+
+ /* Make sure we can feed the device a minimum amount of time */
+ double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0;
+#if defined(__IPHONEOS__)
+ if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
+ /* Older iOS hardware, use 40 ms as a minimum time */
+ MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0;
+ }
+#endif
+ const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0;
+ int numAudioBuffers = 2;
+ if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { /* use more buffers if we have a VERY small sample set. */
+ numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2);
+ }
+
+ this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * numAudioBuffers);
+ if (this->hidden->audioBuffer == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+
+#if DEBUG_COREAUDIO
+ printf("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers);
+#endif
+
+ for (i = 0; i < numAudioBuffers; i++) {
+ result = AudioQueueAllocateBuffer(this->hidden->audioQueue, this->spec.size, &this->hidden->audioBuffer[i]);
+ CHECK_RESULT("AudioQueueAllocateBuffer");
+ SDL_memset(this->hidden->audioBuffer[i]->mAudioData, this->spec.silence, this->hidden->audioBuffer[i]->mAudioDataBytesCapacity);
+ this->hidden->audioBuffer[i]->mAudioDataByteSize = this->hidden->audioBuffer[i]->mAudioDataBytesCapacity;
+ result = AudioQueueEnqueueBuffer(this->hidden->audioQueue, this->hidden->audioBuffer[i], 0, NULL);
+ CHECK_RESULT("AudioQueueEnqueueBuffer");
+ }
+
+ result = AudioQueueStart(this->hidden->audioQueue, NULL);
+ CHECK_RESULT("AudioQueueStart");
+
+ /* We're running! */
+ return 1;
+}
+
+static int
+audioqueue_thread(void *arg)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
+ const int rc = prepare_audioqueue(this);
+ if (!rc) {
+ this->hidden->thread_error = SDL_strdup(SDL_GetError());
+ SDL_SemPost(this->hidden->ready_semaphore);
+ return 0;
+ }
+
+ /* init was successful, alert parent thread and start running... */
+ SDL_SemPost(this->hidden->ready_semaphore);
+ while (!SDL_AtomicGet(&this->hidden->shutdown)) {
+ CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1);
+ }
+
+ if (!this->iscapture) { /* Drain off any pending playback. */
+ const CFTimeInterval secs = (((this->spec.size / (SDL_AUDIO_BITSIZE(this->spec.format) / 8)) / this->spec.channels) / ((CFTimeInterval) this->spec.freq)) * 2.0;
+ CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0);
+ }
+
+ return 0;
+}
+
+static int
+COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ AudioStreamBasicDescription *strdesc;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ int valid_datatype = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ strdesc = &this->hidden->strdesc;
+
+ if (iscapture) {
+ open_capture_devices++;
+ } else {
+ open_playback_devices++;
+ }
+
+#if !MACOSX_COREAUDIO
+ if (!update_audio_session(this, SDL_TRUE)) {
+ return -1;
+ }
+
+ /* Stop CoreAudio from doing expensive audio rate conversion */
+ @autoreleasepool {
+ AVAudioSession* session = [AVAudioSession sharedInstance];
+ [session setPreferredSampleRate:this->spec.freq error:nil];
+ this->spec.freq = (int)session.sampleRate;
+ }
+#endif
+
+ /* Setup a AudioStreamBasicDescription with the requested format */
+ SDL_zerop(strdesc);
+ strdesc->mFormatID = kAudioFormatLinearPCM;
+ strdesc->mFormatFlags = kLinearPCMFormatFlagIsPacked;
+ strdesc->mChannelsPerFrame = this->spec.channels;
+ strdesc->mSampleRate = this->spec.freq;
+ strdesc->mFramesPerPacket = 1;
+
+ while ((!valid_datatype) && (test_format)) {
+ this->spec.format = test_format;
+ /* Just a list of valid SDL formats, so people don't pass junk here. */
+ switch (test_format) {
+ case AUDIO_U8:
+ case AUDIO_S8:
+ case AUDIO_U16LSB:
+ case AUDIO_S16LSB:
+ case AUDIO_U16MSB:
+ case AUDIO_S16MSB:
+ case AUDIO_S32LSB:
+ case AUDIO_S32MSB:
+ case AUDIO_F32LSB:
+ case AUDIO_F32MSB:
+ valid_datatype = 1;
+ strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format);
+ if (SDL_AUDIO_ISBIGENDIAN(this->spec.format))
+ strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
+
+ if (SDL_AUDIO_ISFLOAT(this->spec.format))
+ strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat;
+ else if (SDL_AUDIO_ISSIGNED(this->spec.format))
+ strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
+ break;
+ }
+ }
+
+ if (!valid_datatype) { /* shouldn't happen, but just in case... */
+ return SDL_SetError("Unsupported audio format");
+ }
+
+ strdesc->mBytesPerFrame = strdesc->mBitsPerChannel * strdesc->mChannelsPerFrame / 8;
+ strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket;
+
+#if MACOSX_COREAUDIO
+ if (!prepare_device(this, handle, iscapture)) {
+ return -1;
+ }
+#endif
+
+ /* This has to init in a new thread so it can get its own CFRunLoop. :/ */
+ SDL_AtomicSet(&this->hidden->shutdown, 0);
+ this->hidden->ready_semaphore = SDL_CreateSemaphore(0);
+ if (!this->hidden->ready_semaphore) {
+ return -1; /* oh well. */
+ }
+
+ this->hidden->thread = SDL_CreateThreadInternal(audioqueue_thread, "AudioQueue thread", 512 * 1024, this);
+ if (!this->hidden->thread) {
+ return -1;
+ }
+
+ SDL_SemWait(this->hidden->ready_semaphore);
+ SDL_DestroySemaphore(this->hidden->ready_semaphore);
+ this->hidden->ready_semaphore = NULL;
+
+ if ((this->hidden->thread != NULL) && (this->hidden->thread_error != NULL)) {
+ SDL_SetError("%s", this->hidden->thread_error);
+ return -1;
+ }
+
+ return (this->hidden->thread != NULL) ? 0 : -1;
+}
+
+static void
+COREAUDIO_Deinitialize(void)
+{
+#if MACOSX_COREAUDIO
+ AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
+ free_audio_device_list(&capture_devs);
+ free_audio_device_list(&output_devs);
+#endif
+}
+
+static int
+COREAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = COREAUDIO_OpenDevice;
+ impl->CloseDevice = COREAUDIO_CloseDevice;
+ impl->Deinitialize = COREAUDIO_Deinitialize;
+
+#if MACOSX_COREAUDIO
+ impl->DetectDevices = COREAUDIO_DetectDevices;
+ AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
+#else
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultCaptureDevice = 1;
+#endif
+
+ impl->ProvidesOwnCallbackThread = 1;
+ impl->HasCaptureSupport = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap COREAUDIO_bootstrap = {
+ "coreaudio", "CoreAudio", COREAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_COREAUDIO */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.c b/src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.c
new file mode 100644
index 0000000..09b83ae
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.c
@@ -0,0 +1,604 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_DSOUND
+
+/* Allow access to a raw mixing buffer */
+
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_loadso.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_directsound.h"
+
+#ifndef WAVE_FORMAT_IEEE_FLOAT
+#define WAVE_FORMAT_IEEE_FLOAT 0x0003
+#endif
+
+/* DirectX function pointers for audio */
+static void* DSoundDLL = NULL;
+typedef HRESULT (WINAPI *fnDirectSoundCreate8)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN);
+typedef HRESULT (WINAPI *fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
+typedef HRESULT (WINAPI *fnDirectSoundCaptureCreate8)(LPCGUID,LPDIRECTSOUNDCAPTURE8 *,LPUNKNOWN);
+typedef HRESULT (WINAPI *fnDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW,LPVOID);
+static fnDirectSoundCreate8 pDirectSoundCreate8 = NULL;
+static fnDirectSoundEnumerateW pDirectSoundEnumerateW = NULL;
+static fnDirectSoundCaptureCreate8 pDirectSoundCaptureCreate8 = NULL;
+static fnDirectSoundCaptureEnumerateW pDirectSoundCaptureEnumerateW = NULL;
+
+static void
+DSOUND_Unload(void)
+{
+ pDirectSoundCreate8 = NULL;
+ pDirectSoundEnumerateW = NULL;
+ pDirectSoundCaptureCreate8 = NULL;
+ pDirectSoundCaptureEnumerateW = NULL;
+
+ if (DSoundDLL != NULL) {
+ SDL_UnloadObject(DSoundDLL);
+ DSoundDLL = NULL;
+ }
+}
+
+
+static int
+DSOUND_Load(void)
+{
+ int loaded = 0;
+
+ DSOUND_Unload();
+
+ DSoundDLL = SDL_LoadObject("DSOUND.DLL");
+ if (DSoundDLL == NULL) {
+ SDL_SetError("DirectSound: failed to load DSOUND.DLL");
+ } else {
+ /* Now make sure we have DirectX 8 or better... */
+ #define DSOUNDLOAD(f) { \
+ p##f = (fn##f) SDL_LoadFunction(DSoundDLL, #f); \
+ if (!p##f) loaded = 0; \
+ }
+ loaded = 1; /* will reset if necessary. */
+ DSOUNDLOAD(DirectSoundCreate8);
+ DSOUNDLOAD(DirectSoundEnumerateW);
+ DSOUNDLOAD(DirectSoundCaptureCreate8);
+ DSOUNDLOAD(DirectSoundCaptureEnumerateW);
+ #undef DSOUNDLOAD
+
+ if (!loaded) {
+ SDL_SetError("DirectSound: System doesn't appear to have DX8.");
+ }
+ }
+
+ if (!loaded) {
+ DSOUND_Unload();
+ }
+
+ return loaded;
+}
+
+static int
+SetDSerror(const char *function, int code)
+{
+ static const char *error;
+ static char errbuf[1024];
+
+ errbuf[0] = 0;
+ switch (code) {
+ case E_NOINTERFACE:
+ error = "Unsupported interface -- Is DirectX 8.0 or later installed?";
+ break;
+ case DSERR_ALLOCATED:
+ error = "Audio device in use";
+ break;
+ case DSERR_BADFORMAT:
+ error = "Unsupported audio format";
+ break;
+ case DSERR_BUFFERLOST:
+ error = "Mixing buffer was lost";
+ break;
+ case DSERR_CONTROLUNAVAIL:
+ error = "Control requested is not available";
+ break;
+ case DSERR_INVALIDCALL:
+ error = "Invalid call for the current state";
+ break;
+ case DSERR_INVALIDPARAM:
+ error = "Invalid parameter";
+ break;
+ case DSERR_NODRIVER:
+ error = "No audio device found";
+ break;
+ case DSERR_OUTOFMEMORY:
+ error = "Out of memory";
+ break;
+ case DSERR_PRIOLEVELNEEDED:
+ error = "Caller doesn't have priority";
+ break;
+ case DSERR_UNSUPPORTED:
+ error = "Function not supported";
+ break;
+ default:
+ SDL_snprintf(errbuf, SDL_arraysize(errbuf),
+ "%s: Unknown DirectSound error: 0x%x", function, code);
+ break;
+ }
+ if (!errbuf[0]) {
+ SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function,
+ error);
+ }
+ return SDL_SetError("%s", errbuf);
+}
+
+static void
+DSOUND_FreeDeviceHandle(void *handle)
+{
+ SDL_free(handle);
+}
+
+static BOOL CALLBACK
+FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID data)
+{
+ const int iscapture = (int) ((size_t) data);
+ if (guid != NULL) { /* skip default device */
+ char *str = WIN_LookupAudioDeviceName(desc, guid);
+ if (str != NULL) {
+ LPGUID cpyguid = (LPGUID) SDL_malloc(sizeof (GUID));
+ SDL_memcpy(cpyguid, guid, sizeof (GUID));
+ SDL_AddAudioDevice(iscapture, str, cpyguid);
+ SDL_free(str); /* addfn() makes a copy of this string. */
+ }
+ }
+ return TRUE; /* keep enumerating. */
+}
+
+static void
+DSOUND_DetectDevices(void)
+{
+ pDirectSoundCaptureEnumerateW(FindAllDevs, (void *) ((size_t) 1));
+ pDirectSoundEnumerateW(FindAllDevs, (void *) ((size_t) 0));
+}
+
+
+static void
+DSOUND_WaitDevice(_THIS)
+{
+ DWORD status = 0;
+ DWORD cursor = 0;
+ DWORD junk = 0;
+ HRESULT result = DS_OK;
+
+ /* Semi-busy wait, since we have no way of getting play notification
+ on a primary mixing buffer located in hardware (DirectX 5.0)
+ */
+ result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf,
+ &junk, &cursor);
+ if (result != DS_OK) {
+ if (result == DSERR_BUFFERLOST) {
+ IDirectSoundBuffer_Restore(this->hidden->mixbuf);
+ }
+#ifdef DEBUG_SOUND
+ SetDSerror("DirectSound GetCurrentPosition", result);
+#endif
+ return;
+ }
+
+ while ((cursor / this->spec.size) == this->hidden->lastchunk) {
+ /* FIXME: find out how much time is left and sleep that long */
+ SDL_Delay(1);
+
+ /* Try to restore a lost sound buffer */
+ IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status);
+ if ((status & DSBSTATUS_BUFFERLOST)) {
+ IDirectSoundBuffer_Restore(this->hidden->mixbuf);
+ IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status);
+ if ((status & DSBSTATUS_BUFFERLOST)) {
+ break;
+ }
+ }
+ if (!(status & DSBSTATUS_PLAYING)) {
+ result = IDirectSoundBuffer_Play(this->hidden->mixbuf, 0, 0,
+ DSBPLAY_LOOPING);
+ if (result == DS_OK) {
+ continue;
+ }
+#ifdef DEBUG_SOUND
+ SetDSerror("DirectSound Play", result);
+#endif
+ return;
+ }
+
+ /* Find out where we are playing */
+ result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf,
+ &junk, &cursor);
+ if (result != DS_OK) {
+ SetDSerror("DirectSound GetCurrentPosition", result);
+ return;
+ }
+ }
+}
+
+static void
+DSOUND_PlayDevice(_THIS)
+{
+ /* Unlock the buffer, allowing it to play */
+ if (this->hidden->locked_buf) {
+ IDirectSoundBuffer_Unlock(this->hidden->mixbuf,
+ this->hidden->locked_buf,
+ this->spec.size, NULL, 0);
+ }
+}
+
+static Uint8 *
+DSOUND_GetDeviceBuf(_THIS)
+{
+ DWORD cursor = 0;
+ DWORD junk = 0;
+ HRESULT result = DS_OK;
+ DWORD rawlen = 0;
+
+ /* Figure out which blocks to fill next */
+ this->hidden->locked_buf = NULL;
+ result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf,
+ &junk, &cursor);
+ if (result == DSERR_BUFFERLOST) {
+ IDirectSoundBuffer_Restore(this->hidden->mixbuf);
+ result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf,
+ &junk, &cursor);
+ }
+ if (result != DS_OK) {
+ SetDSerror("DirectSound GetCurrentPosition", result);
+ return (NULL);
+ }
+ cursor /= this->spec.size;
+#ifdef DEBUG_SOUND
+ /* Detect audio dropouts */
+ {
+ DWORD spot = cursor;
+ if (spot < this->hidden->lastchunk) {
+ spot += this->hidden->num_buffers;
+ }
+ if (spot > this->hidden->lastchunk + 1) {
+ fprintf(stderr, "Audio dropout, missed %d fragments\n",
+ (spot - (this->hidden->lastchunk + 1)));
+ }
+ }
+#endif
+ this->hidden->lastchunk = cursor;
+ cursor = (cursor + 1) % this->hidden->num_buffers;
+ cursor *= this->spec.size;
+
+ /* Lock the audio buffer */
+ result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor,
+ this->spec.size,
+ (LPVOID *) & this->hidden->locked_buf,
+ &rawlen, NULL, &junk, 0);
+ if (result == DSERR_BUFFERLOST) {
+ IDirectSoundBuffer_Restore(this->hidden->mixbuf);
+ result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor,
+ this->spec.size,
+ (LPVOID *) & this->
+ hidden->locked_buf, &rawlen, NULL,
+ &junk, 0);
+ }
+ if (result != DS_OK) {
+ SetDSerror("DirectSound Lock", result);
+ return (NULL);
+ }
+ return (this->hidden->locked_buf);
+}
+
+static int
+DSOUND_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ DWORD junk, cursor, ptr1len, ptr2len;
+ VOID *ptr1, *ptr2;
+
+ SDL_assert(buflen == this->spec.size);
+
+ while (SDL_TRUE) {
+ if (SDL_AtomicGet(&this->shutdown)) { /* in case the buffer froze... */
+ SDL_memset(buffer, this->spec.silence, buflen);
+ return buflen;
+ }
+
+ if (IDirectSoundCaptureBuffer_GetCurrentPosition(h->capturebuf, &junk, &cursor) != DS_OK) {
+ return -1;
+ }
+ if ((cursor / this->spec.size) == h->lastchunk) {
+ SDL_Delay(1); /* FIXME: find out how much time is left and sleep that long */
+ } else {
+ break;
+ }
+ }
+
+ if (IDirectSoundCaptureBuffer_Lock(h->capturebuf, h->lastchunk * this->spec.size, this->spec.size, &ptr1, &ptr1len, &ptr2, &ptr2len, 0) != DS_OK) {
+ return -1;
+ }
+
+ SDL_assert(ptr1len == this->spec.size);
+ SDL_assert(ptr2 == NULL);
+ SDL_assert(ptr2len == 0);
+
+ SDL_memcpy(buffer, ptr1, ptr1len);
+
+ if (IDirectSoundCaptureBuffer_Unlock(h->capturebuf, ptr1, ptr1len, ptr2, ptr2len) != DS_OK) {
+ return -1;
+ }
+
+ h->lastchunk = (h->lastchunk + 1) % h->num_buffers;
+
+ return ptr1len;
+}
+
+static void
+DSOUND_FlushCapture(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ DWORD junk, cursor;
+ if (IDirectSoundCaptureBuffer_GetCurrentPosition(h->capturebuf, &junk, &cursor) == DS_OK) {
+ h->lastchunk = cursor / this->spec.size;
+ }
+}
+
+static void
+DSOUND_CloseDevice(_THIS)
+{
+ if (this->hidden->mixbuf != NULL) {
+ IDirectSoundBuffer_Stop(this->hidden->mixbuf);
+ IDirectSoundBuffer_Release(this->hidden->mixbuf);
+ }
+ if (this->hidden->sound != NULL) {
+ IDirectSound_Release(this->hidden->sound);
+ }
+ if (this->hidden->capturebuf != NULL) {
+ IDirectSoundCaptureBuffer_Stop(this->hidden->capturebuf);
+ IDirectSoundCaptureBuffer_Release(this->hidden->capturebuf);
+ }
+ if (this->hidden->capture != NULL) {
+ IDirectSoundCapture_Release(this->hidden->capture);
+ }
+ SDL_free(this->hidden);
+}
+
+/* This function tries to create a secondary audio buffer, and returns the
+ number of audio chunks available in the created buffer. This is for
+ playback devices, not capture.
+*/
+static int
+CreateSecondary(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt)
+{
+ LPDIRECTSOUND sndObj = this->hidden->sound;
+ LPDIRECTSOUNDBUFFER *sndbuf = &this->hidden->mixbuf;
+ HRESULT result = DS_OK;
+ DSBUFFERDESC format;
+ LPVOID pvAudioPtr1, pvAudioPtr2;
+ DWORD dwAudioBytes1, dwAudioBytes2;
+
+ /* Try to create the secondary buffer */
+ SDL_zero(format);
+ format.dwSize = sizeof(format);
+ format.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
+ format.dwFlags |= DSBCAPS_GLOBALFOCUS;
+ format.dwBufferBytes = bufsize;
+ format.lpwfxFormat = wfmt;
+ result = IDirectSound_CreateSoundBuffer(sndObj, &format, sndbuf, NULL);
+ if (result != DS_OK) {
+ return SetDSerror("DirectSound CreateSoundBuffer", result);
+ }
+ IDirectSoundBuffer_SetFormat(*sndbuf, wfmt);
+
+ /* Silence the initial audio buffer */
+ result = IDirectSoundBuffer_Lock(*sndbuf, 0, format.dwBufferBytes,
+ (LPVOID *) & pvAudioPtr1, &dwAudioBytes1,
+ (LPVOID *) & pvAudioPtr2, &dwAudioBytes2,
+ DSBLOCK_ENTIREBUFFER);
+ if (result == DS_OK) {
+ SDL_memset(pvAudioPtr1, this->spec.silence, dwAudioBytes1);
+ IDirectSoundBuffer_Unlock(*sndbuf,
+ (LPVOID) pvAudioPtr1, dwAudioBytes1,
+ (LPVOID) pvAudioPtr2, dwAudioBytes2);
+ }
+
+ /* We're ready to go */
+ return 0;
+}
+
+/* This function tries to create a capture buffer, and returns the
+ number of audio chunks available in the created buffer. This is for
+ capture devices, not playback.
+*/
+static int
+CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt)
+{
+ LPDIRECTSOUNDCAPTURE capture = this->hidden->capture;
+ LPDIRECTSOUNDCAPTUREBUFFER *capturebuf = &this->hidden->capturebuf;
+ DSCBUFFERDESC format;
+ HRESULT result;
+
+ SDL_zero(format);
+ format.dwSize = sizeof (format);
+ format.dwFlags = DSCBCAPS_WAVEMAPPED;
+ format.dwBufferBytes = bufsize;
+ format.lpwfxFormat = wfmt;
+
+ result = IDirectSoundCapture_CreateCaptureBuffer(capture, &format, capturebuf, NULL);
+ if (result != DS_OK) {
+ return SetDSerror("DirectSound CreateCaptureBuffer", result);
+ }
+
+ result = IDirectSoundCaptureBuffer_Start(*capturebuf, DSCBSTART_LOOPING);
+ if (result != DS_OK) {
+ IDirectSoundCaptureBuffer_Release(*capturebuf);
+ return SetDSerror("DirectSound Start", result);
+ }
+
+#if 0
+ /* presumably this starts at zero, but just in case... */
+ result = IDirectSoundCaptureBuffer_GetCurrentPosition(*capturebuf, &junk, &cursor);
+ if (result != DS_OK) {
+ IDirectSoundCaptureBuffer_Stop(*capturebuf);
+ IDirectSoundCaptureBuffer_Release(*capturebuf);
+ return SetDSerror("DirectSound GetCurrentPosition", result);
+ }
+
+ this->hidden->lastchunk = cursor / this->spec.size;
+#endif
+
+ return 0;
+}
+
+static int
+DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ const DWORD numchunks = 8;
+ HRESULT result;
+ SDL_bool valid_format = SDL_FALSE;
+ SDL_bool tried_format = SDL_FALSE;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ LPGUID guid = (LPGUID) handle;
+ DWORD bufsize;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Open the audio device */
+ if (iscapture) {
+ result = pDirectSoundCaptureCreate8(guid, &this->hidden->capture, NULL);
+ if (result != DS_OK) {
+ return SetDSerror("DirectSoundCaptureCreate8", result);
+ }
+ } else {
+ result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL);
+ if (result != DS_OK) {
+ return SetDSerror("DirectSoundCreate8", result);
+ }
+ result = IDirectSound_SetCooperativeLevel(this->hidden->sound,
+ GetDesktopWindow(),
+ DSSCL_NORMAL);
+ if (result != DS_OK) {
+ return SetDSerror("DirectSound SetCooperativeLevel", result);
+ }
+ }
+
+ while ((!valid_format) && (test_format)) {
+ switch (test_format) {
+ case AUDIO_U8:
+ case AUDIO_S16:
+ case AUDIO_S32:
+ case AUDIO_F32:
+ tried_format = SDL_TRUE;
+
+ this->spec.format = test_format;
+
+ /* Update the fragment size as size in bytes */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ bufsize = numchunks * this->spec.size;
+ if ((bufsize < DSBSIZE_MIN) || (bufsize > DSBSIZE_MAX)) {
+ SDL_SetError("Sound buffer size must be between %d and %d",
+ (int) ((DSBSIZE_MIN < numchunks) ? 1 : DSBSIZE_MIN / numchunks),
+ (int) (DSBSIZE_MAX / numchunks));
+ } else {
+ int rc;
+ WAVEFORMATEX wfmt;
+ SDL_zero(wfmt);
+ if (SDL_AUDIO_ISFLOAT(this->spec.format)) {
+ wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
+ } else {
+ wfmt.wFormatTag = WAVE_FORMAT_PCM;
+ }
+
+ wfmt.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format);
+ wfmt.nChannels = this->spec.channels;
+ wfmt.nSamplesPerSec = this->spec.freq;
+ wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8);
+ wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign;
+
+ rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt);
+ if (rc == 0) {
+ this->hidden->num_buffers = numchunks;
+ valid_format = SDL_TRUE;
+ }
+ }
+ break;
+ }
+ test_format = SDL_NextAudioFormat();
+ }
+
+ if (!valid_format) {
+ if (tried_format) {
+ return -1; /* CreateSecondary() should have called SDL_SetError(). */
+ }
+ return SDL_SetError("DirectSound: Unsupported audio format");
+ }
+
+ /* Playback buffers will auto-start playing in DSOUND_WaitDevice() */
+
+ return 0; /* good to go. */
+}
+
+
+static void
+DSOUND_Deinitialize(void)
+{
+ DSOUND_Unload();
+}
+
+
+static int
+DSOUND_Init(SDL_AudioDriverImpl * impl)
+{
+ if (!DSOUND_Load()) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->DetectDevices = DSOUND_DetectDevices;
+ impl->OpenDevice = DSOUND_OpenDevice;
+ impl->PlayDevice = DSOUND_PlayDevice;
+ impl->WaitDevice = DSOUND_WaitDevice;
+ impl->GetDeviceBuf = DSOUND_GetDeviceBuf;
+ impl->CaptureFromDevice = DSOUND_CaptureFromDevice;
+ impl->FlushCapture = DSOUND_FlushCapture;
+ impl->CloseDevice = DSOUND_CloseDevice;
+ impl->FreeDeviceHandle = DSOUND_FreeDeviceHandle;
+ impl->Deinitialize = DSOUND_Deinitialize;
+
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap DSOUND_bootstrap = {
+ "directsound", "DirectSound", DSOUND_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_DSOUND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.h b/src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.h
new file mode 100644
index 0000000..acb7b6a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/directsound/SDL_directsound.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_directsound_h_
+#define SDL_directsound_h_
+
+#include "../../core/windows/SDL_directx.h"
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+/* The DirectSound objects */
+struct SDL_PrivateAudioData
+{
+ LPDIRECTSOUND sound;
+ LPDIRECTSOUNDBUFFER mixbuf;
+ LPDIRECTSOUNDCAPTURE capture;
+ LPDIRECTSOUNDCAPTUREBUFFER capturebuf;
+ int num_buffers;
+ DWORD lastchunk;
+ Uint8 *locked_buf;
+};
+
+#endif /* SDL_directsound_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.c b/src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.c
new file mode 100644
index 0000000..2250375
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.c
@@ -0,0 +1,207 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_DISK
+
+/* Output raw audio data to a file. */
+
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#include "SDL_rwops.h"
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_diskaudio.h"
+#include "SDL_log.h"
+
+/* !!! FIXME: these should be SDL hints, not environment variables. */
+/* environment variables and defaults. */
+#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE"
+#define DISKDEFAULT_OUTFILE "sdlaudio.raw"
+#define DISKENVR_INFILE "SDL_DISKAUDIOFILEIN"
+#define DISKDEFAULT_INFILE "sdlaudio-in.raw"
+#define DISKENVR_IODELAY "SDL_DISKAUDIODELAY"
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+DISKAUDIO_WaitDevice(_THIS)
+{
+ SDL_Delay(this->hidden->io_delay);
+}
+
+static void
+DISKAUDIO_PlayDevice(_THIS)
+{
+ const size_t written = SDL_RWwrite(this->hidden->io,
+ this->hidden->mixbuf,
+ 1, this->spec.size);
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written != this->spec.size) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
+}
+
+static Uint8 *
+DISKAUDIO_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static int
+DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ const int origbuflen = buflen;
+
+ SDL_Delay(h->io_delay);
+
+ if (h->io) {
+ const size_t br = SDL_RWread(h->io, buffer, 1, buflen);
+ buflen -= (int) br;
+ buffer = ((Uint8 *) buffer) + br;
+ if (buflen > 0) { /* EOF (or error, but whatever). */
+ SDL_RWclose(h->io);
+ h->io = NULL;
+ }
+ }
+
+ /* if we ran out of file, just write silence. */
+ SDL_memset(buffer, this->spec.silence, buflen);
+
+ return origbuflen;
+}
+
+static void
+DISKAUDIO_FlushCapture(_THIS)
+{
+ /* no op...we don't advance the file pointer or anything. */
+}
+
+
+static void
+DISKAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden->io != NULL) {
+ SDL_RWclose(this->hidden->io);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+
+static const char *
+get_filename(const int iscapture, const char *devname)
+{
+ if (devname == NULL) {
+ devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE);
+ if (devname == NULL) {
+ devname = iscapture ? DISKDEFAULT_INFILE : DISKDEFAULT_OUTFILE;
+ }
+ }
+ return devname;
+}
+
+static int
+DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ /* handle != NULL means "user specified the placeholder name on the fake detected device list" */
+ const char *fname = get_filename(iscapture, handle ? NULL : devname);
+ const char *envr = SDL_getenv(DISKENVR_IODELAY);
+
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc(sizeof(*this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ if (envr != NULL) {
+ this->hidden->io_delay = SDL_atoi(envr);
+ } else {
+ this->hidden->io_delay = ((this->spec.samples * 1000) / this->spec.freq);
+ }
+
+ /* Open the audio device */
+ this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb");
+ if (this->hidden->io == NULL) {
+ return -1;
+ }
+
+ /* Allocate mixing buffer */
+ if (!iscapture) {
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+ }
+
+ SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO,
+ "You are using the SDL disk i/o audio driver!\n");
+ SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO,
+ " %s file [%s].\n", iscapture ? "Reading from" : "Writing to",
+ fname);
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static void
+DISKAUDIO_DetectDevices(void)
+{
+ SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) 0x1);
+ SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, (void *) 0x2);
+}
+
+static int
+DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = DISKAUDIO_OpenDevice;
+ impl->WaitDevice = DISKAUDIO_WaitDevice;
+ impl->PlayDevice = DISKAUDIO_PlayDevice;
+ impl->GetDeviceBuf = DISKAUDIO_GetDeviceBuf;
+ impl->CaptureFromDevice = DISKAUDIO_CaptureFromDevice;
+ impl->FlushCapture = DISKAUDIO_FlushCapture;
+
+ impl->CloseDevice = DISKAUDIO_CloseDevice;
+ impl->DetectDevices = DISKAUDIO_DetectDevices;
+
+ impl->AllowsArbitraryDeviceNames = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap DISKAUDIO_bootstrap = {
+ "disk", "direct-to-disk audio", DISKAUDIO_Init, 1
+};
+
+#endif /* SDL_AUDIO_DRIVER_DISK */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.h b/src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.h
new file mode 100644
index 0000000..7e73ebe
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/disk/SDL_diskaudio.h
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_diskaudio_h_
+#define SDL_diskaudio_h_
+
+#include "SDL_rwops.h"
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ SDL_RWops *io;
+ Uint32 io_delay;
+ Uint8 *mixbuf;
+};
+
+#endif /* SDL_diskaudio_h_ */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.c b/src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.c
new file mode 100644
index 0000000..77653be
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.c
@@ -0,0 +1,320 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_OSS
+
+/* Allow access to a raw mixing buffer */
+
+#include <stdio.h> /* For perror() */
+#include <string.h> /* For strerror() */
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+
+#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
+/* This is installed on some systems */
+#include <soundcard.h>
+#else
+/* This is recommended by OSS */
+#include <sys/soundcard.h>
+#endif
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
+#include "SDL_dspaudio.h"
+
+
+static void
+DSP_DetectDevices(void)
+{
+ SDL_EnumUnixAudioDevices(0, NULL);
+}
+
+
+static void
+DSP_CloseDevice(_THIS)
+{
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+
+static int
+DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ int format;
+ int value;
+ int frag_spec;
+ SDL_AudioFormat test_format;
+
+ /* We don't care what the devname is...we'll try to open anything. */
+ /* ...but default to first name in the list... */
+ if (devname == NULL) {
+ devname = SDL_GetAudioDeviceName(0, iscapture);
+ if (devname == NULL) {
+ return SDL_SetError("No such audio device");
+ }
+ }
+
+ /* Make sure fragment size stays a power of 2, or OSS fails. */
+ /* I don't know which of these are actually legal values, though... */
+ if (this->spec.channels > 8)
+ this->spec.channels = 8;
+ else if (this->spec.channels > 4)
+ this->spec.channels = 4;
+ else if (this->spec.channels > 2)
+ this->spec.channels = 2;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Open the audio device */
+ this->hidden->audio_fd = open(devname, flags, 0);
+ if (this->hidden->audio_fd < 0) {
+ return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
+ }
+
+ /* Make the file descriptor use blocking i/o with fcntl() */
+ {
+ long ctlflags;
+ ctlflags = fcntl(this->hidden->audio_fd, F_GETFL);
+ ctlflags &= ~O_NONBLOCK;
+ if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) {
+ return SDL_SetError("Couldn't set audio blocking mode");
+ }
+ }
+
+ /* Get a list of supported hardware formats */
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
+ perror("SNDCTL_DSP_GETFMTS");
+ return SDL_SetError("Couldn't get audio format list");
+ }
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ if (value & AFMT_U8) {
+ format = AFMT_U8;
+ }
+ break;
+ case AUDIO_S16LSB:
+ if (value & AFMT_S16_LE) {
+ format = AFMT_S16_LE;
+ }
+ break;
+ case AUDIO_S16MSB:
+ if (value & AFMT_S16_BE) {
+ format = AFMT_S16_BE;
+ }
+ break;
+#if 0
+/*
+ * These formats are not used by any real life systems so they are not
+ * needed here.
+ */
+ case AUDIO_S8:
+ if (value & AFMT_S8) {
+ format = AFMT_S8;
+ }
+ break;
+ case AUDIO_U16LSB:
+ if (value & AFMT_U16_LE) {
+ format = AFMT_U16_LE;
+ }
+ break;
+ case AUDIO_U16MSB:
+ if (value & AFMT_U16_BE) {
+ format = AFMT_U16_BE;
+ }
+ break;
+#endif
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ return SDL_SetError("Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ /* Set the audio format */
+ value = format;
+ if ((ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
+ (value != format)) {
+ perror("SNDCTL_DSP_SETFMT");
+ return SDL_SetError("Couldn't set audio format");
+ }
+
+ /* Set the number of channels of output */
+ value = this->spec.channels;
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) {
+ perror("SNDCTL_DSP_CHANNELS");
+ return SDL_SetError("Cannot set the number of channels");
+ }
+ this->spec.channels = value;
+
+ /* Set the DSP frequency */
+ value = this->spec.freq;
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) {
+ perror("SNDCTL_DSP_SPEED");
+ return SDL_SetError("Couldn't set audio frequency");
+ }
+ this->spec.freq = value;
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Determine the power of two of the fragment size */
+ for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec);
+ if ((0x01U << frag_spec) != this->spec.size) {
+ return SDL_SetError("Fragment size must be a power of two");
+ }
+ frag_spec |= 0x00020000; /* two fragments, for low latency */
+
+ /* Set the audio buffering parameters */
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Requesting %d fragments of size %d\n",
+ (frag_spec >> 16), 1 << (frag_spec & 0xFFFF));
+#endif
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0) {
+ perror("SNDCTL_DSP_SETFRAGMENT");
+ }
+#ifdef DEBUG_AUDIO
+ {
+ audio_buf_info info;
+ ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETOSPACE, &info);
+ fprintf(stderr, "fragments = %d\n", info.fragments);
+ fprintf(stderr, "fragstotal = %d\n", info.fragstotal);
+ fprintf(stderr, "fragsize = %d\n", info.fragsize);
+ fprintf(stderr, "bytes = %d\n", info.bytes);
+ }
+#endif
+
+ /* Allocate mixing buffer */
+ if (!iscapture) {
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+ }
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+
+static void
+DSP_PlayDevice(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ if (write(h->audio_fd, h->mixbuf, h->mixlen) == -1) {
+ perror("Audio write");
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", h->mixlen);
+#endif
+}
+
+static Uint8 *
+DSP_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static int
+DSP_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ return (int) read(this->hidden->audio_fd, buffer, buflen);
+}
+
+static void
+DSP_FlushCapture(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ audio_buf_info info;
+ if (ioctl(h->audio_fd, SNDCTL_DSP_GETISPACE, &info) == 0) {
+ while (info.bytes > 0) {
+ char buf[512];
+ const size_t len = SDL_min(sizeof (buf), info.bytes);
+ const ssize_t br = read(h->audio_fd, buf, len);
+ if (br <= 0) {
+ break;
+ }
+ info.bytes -= br;
+ }
+ }
+}
+
+static int
+DSP_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = DSP_DetectDevices;
+ impl->OpenDevice = DSP_OpenDevice;
+ impl->PlayDevice = DSP_PlayDevice;
+ impl->GetDeviceBuf = DSP_GetDeviceBuf;
+ impl->CloseDevice = DSP_CloseDevice;
+ impl->CaptureFromDevice = DSP_CaptureFromDevice;
+ impl->FlushCapture = DSP_FlushCapture;
+
+ impl->AllowsArbitraryDeviceNames = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap DSP_bootstrap = {
+ "dsp", "OSS /dev/dsp standard audio", DSP_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_OSS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.h b/src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.h
new file mode 100644
index 0000000..6bd86d7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/dsp/SDL_dspaudio.h
@@ -0,0 +1,43 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_dspaudio_h_
+#define SDL_dspaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+};
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+
+#endif /* SDL_dspaudio_h_ */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.c b/src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.c
new file mode 100644
index 0000000..f91dea3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.c
@@ -0,0 +1,65 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* Output audio to nowhere... */
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_dummyaudio.h"
+
+static int
+DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ return 0; /* always succeeds. */
+}
+
+static int
+DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ /* Delay to make this sort of simulate real audio input. */
+ SDL_Delay((this->spec.samples * 1000) / this->spec.freq);
+
+ /* always return a full buffer of silence. */
+ SDL_memset(buffer, this->spec.silence, buflen);
+ return buflen;
+}
+
+static int
+DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = DUMMYAUDIO_OpenDevice;
+ impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
+
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap DUMMYAUDIO_bootstrap = {
+ "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.h b/src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.h
new file mode 100644
index 0000000..18241ee
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/dummy/SDL_dummyaudio.h
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_dummyaudio_h_
+#define SDL_dummyaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ Uint8 *mixbuf;
+ Uint32 mixlen;
+ Uint32 write_delay;
+ Uint32 initial_calls;
+};
+
+#endif /* SDL_dummyaudio_h_ */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c b/src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c
new file mode 100644
index 0000000..e519f08
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c
@@ -0,0 +1,379 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_EMSCRIPTEN
+
+#include "SDL_audio.h"
+#include "SDL_log.h"
+#include "../SDL_audio_c.h"
+#include "SDL_emscriptenaudio.h"
+#include "SDL_assert.h"
+
+#include <emscripten/emscripten.h>
+
+static void
+FeedAudioDevice(_THIS, const void *buf, const int buflen)
+{
+ const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels;
+ EM_ASM_ARGS({
+ var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels'];
+ for (var c = 0; c < numChannels; ++c) {
+ var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c);
+ if (channelData.length != $1) {
+ throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!';
+ }
+
+ for (var j = 0; j < $1; ++j) {
+ channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; /* !!! FIXME: why are these shifts here? */
+ }
+ }
+ }, buf, buflen / framelen);
+}
+
+static void
+HandleAudioProcess(_THIS)
+{
+ SDL_AudioCallback callback = this->callbackspec.callback;
+ const int stream_len = this->callbackspec.size;
+
+ /* Only do something if audio is enabled */
+ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) {
+ if (this->stream) {
+ SDL_AudioStreamClear(this->stream);
+ }
+ return;
+ }
+
+ if (this->stream == NULL) { /* no conversion necessary. */
+ SDL_assert(this->spec.size == stream_len);
+ callback(this->callbackspec.userdata, this->work_buffer, stream_len);
+ } else { /* streaming/converting */
+ int got;
+ while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) {
+ callback(this->callbackspec.userdata, this->work_buffer, stream_len);
+ if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) {
+ SDL_AudioStreamClear(this->stream);
+ SDL_AtomicSet(&this->enabled, 0);
+ break;
+ }
+ }
+
+ got = SDL_AudioStreamGet(this->stream, this->work_buffer, this->spec.size);
+ SDL_assert((got < 0) || (got == this->spec.size));
+ if (got != this->spec.size) {
+ SDL_memset(this->work_buffer, this->spec.silence, this->spec.size);
+ }
+ }
+
+ FeedAudioDevice(this, this->work_buffer, this->spec.size);
+}
+
+static void
+HandleCaptureProcess(_THIS)
+{
+ SDL_AudioCallback callback = this->callbackspec.callback;
+ const int stream_len = this->callbackspec.size;
+
+ /* Only do something if audio is enabled */
+ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) {
+ SDL_AudioStreamClear(this->stream);
+ return;
+ }
+
+ EM_ASM_ARGS({
+ var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels;
+ for (var c = 0; c < numChannels; ++c) {
+ var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c);
+ if (channelData.length != $1) {
+ throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!';
+ }
+
+ if (numChannels == 1) { /* fastpath this a little for the common (mono) case. */
+ for (var j = 0; j < $1; ++j) {
+ setValue($0 + (j * 4), channelData[j], 'float');
+ }
+ } else {
+ for (var j = 0; j < $1; ++j) {
+ setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float');
+ }
+ }
+ }
+ }, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels);
+
+ /* okay, we've got an interleaved float32 array in C now. */
+
+ if (this->stream == NULL) { /* no conversion necessary. */
+ SDL_assert(this->spec.size == stream_len);
+ callback(this->callbackspec.userdata, this->work_buffer, stream_len);
+ } else { /* streaming/converting */
+ if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) {
+ SDL_AtomicSet(&this->enabled, 0);
+ }
+
+ while (SDL_AudioStreamAvailable(this->stream) >= stream_len) {
+ const int got = SDL_AudioStreamGet(this->stream, this->work_buffer, stream_len);
+ SDL_assert((got < 0) || (got == stream_len));
+ if (got != stream_len) {
+ SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len);
+ }
+ callback(this->callbackspec.userdata, this->work_buffer, stream_len); /* Send it to the app. */
+ }
+ }
+}
+
+
+static void
+EMSCRIPTENAUDIO_CloseDevice(_THIS)
+{
+ EM_ASM_({
+ if ($0) {
+ if (SDL2.capture.silenceTimer !== undefined) {
+ clearTimeout(SDL2.capture.silenceTimer);
+ }
+ if (SDL2.capture.stream !== undefined) {
+ var tracks = SDL2.capture.stream.getAudioTracks();
+ for (var i = 0; i < tracks.length; i++) {
+ SDL2.capture.stream.removeTrack(tracks[i]);
+ }
+ SDL2.capture.stream = undefined;
+ }
+ if (SDL2.capture.scriptProcessorNode !== undefined) {
+ SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {};
+ SDL2.capture.scriptProcessorNode.disconnect();
+ SDL2.capture.scriptProcessorNode = undefined;
+ }
+ if (SDL2.capture.mediaStreamNode !== undefined) {
+ SDL2.capture.mediaStreamNode.disconnect();
+ SDL2.capture.mediaStreamNode = undefined;
+ }
+ if (SDL2.capture.silenceBuffer !== undefined) {
+ SDL2.capture.silenceBuffer = undefined
+ }
+ SDL2.capture = undefined;
+ } else {
+ if (SDL2.audio.scriptProcessorNode != undefined) {
+ SDL2.audio.scriptProcessorNode.disconnect();
+ SDL2.audio.scriptProcessorNode = undefined;
+ }
+ SDL2.audio = undefined;
+ }
+ if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) {
+ SDL2.audioContext.close();
+ SDL2.audioContext = undefined;
+ }
+ }, this->iscapture);
+
+#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
+ SDL_free(this->hidden);
+#endif
+}
+
+static int
+EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ SDL_bool valid_format = SDL_FALSE;
+ SDL_AudioFormat test_format;
+ int result;
+
+ /* based on parts of library_sdl.js */
+
+ /* create context (TODO: this puts stuff in the global namespace...)*/
+ result = EM_ASM_INT({
+ if(typeof(SDL2) === 'undefined') {
+ SDL2 = {};
+ }
+ if (!$0) {
+ SDL2.audio = {};
+ } else {
+ SDL2.capture = {};
+ }
+
+ if (!SDL2.audioContext) {
+ if (typeof(AudioContext) !== 'undefined') {
+ SDL2.audioContext = new AudioContext();
+ } else if (typeof(webkitAudioContext) !== 'undefined') {
+ SDL2.audioContext = new webkitAudioContext();
+ }
+ }
+ return SDL2.audioContext === undefined ? -1 : 0;
+ }, iscapture);
+ if (result < 0) {
+ return SDL_SetError("Web Audio API is not available!");
+ }
+
+ test_format = SDL_FirstAudioFormat(this->spec.format);
+ while ((!valid_format) && (test_format)) {
+ switch (test_format) {
+ case AUDIO_F32: /* web audio only supports floats */
+ this->spec.format = test_format;
+
+ valid_format = SDL_TRUE;
+ break;
+ }
+ test_format = SDL_NextAudioFormat();
+ }
+
+ if (!valid_format) {
+ /* Didn't find a compatible format :( */
+ return SDL_SetError("No compatible audio format!");
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+#endif
+
+ /* limit to native freq */
+ this->spec.freq = EM_ASM_INT_V({ return SDL2.audioContext.sampleRate; });
+
+ SDL_CalculateAudioSpec(&this->spec);
+
+ if (iscapture) {
+ /* The idea is to take the capture media stream, hook it up to an
+ audio graph where we can pass it through a ScriptProcessorNode
+ to access the raw PCM samples and push them to the SDL app's
+ callback. From there, we "process" the audio data into silence
+ and forget about it. */
+
+ /* This should, strictly speaking, use MediaRecorder for capture, but
+ this API is cleaner to use and better supported, and fires a
+ callback whenever there's enough data to fire down into the app.
+ The downside is that we are spending CPU time silencing a buffer
+ that the audiocontext uselessly mixes into any output. On the
+ upside, both of those things are not only run in native code in
+ the browser, they're probably SIMD code, too. MediaRecorder
+ feels like it's a pretty inefficient tapdance in similar ways,
+ to be honest. */
+
+ EM_ASM_({
+ var have_microphone = function(stream) {
+ //console.log('SDL audio capture: we have a microphone! Replacing silence callback.');
+ if (SDL2.capture.silenceTimer !== undefined) {
+ clearTimeout(SDL2.capture.silenceTimer);
+ SDL2.capture.silenceTimer = undefined;
+ }
+ SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream);
+ SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1);
+ SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {
+ if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; }
+ audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0);
+ SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer;
+ Runtime.dynCall('vi', $2, [$3]);
+ };
+ SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode);
+ SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination);
+ SDL2.capture.stream = stream;
+ };
+
+ var no_microphone = function(error) {
+ //console.log('SDL audio capture: we DO NOT have a microphone! (' + error.name + ')...leaving silence callback running.');
+ };
+
+ /* we write silence to the audio callback until the microphone is available (user approves use, etc). */
+ SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate);
+ SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0);
+ var silence_callback = function() {
+ SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer;
+ Runtime.dynCall('vi', $2, [$3]);
+ };
+
+ SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000);
+
+ if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) {
+ navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone);
+ } else if (navigator.webkitGetUserMedia !== undefined) {
+ navigator.webkitGetUserMedia({ audio: true, video: false }, have_microphone, no_microphone);
+ }
+ }, this->spec.channels, this->spec.samples, HandleCaptureProcess, this);
+ } else {
+ /* setup a ScriptProcessorNode */
+ EM_ASM_ARGS({
+ SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0);
+ SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) {
+ if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; }
+ SDL2.audio.currentOutputBuffer = e['outputBuffer'];
+ Runtime.dynCall('vi', $2, [$3]);
+ };
+ SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']);
+ }, this->spec.channels, this->spec.samples, HandleAudioProcess, this);
+ }
+
+ return 0;
+}
+
+static int
+EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ int available;
+ int capture_available;
+
+ /* Set the function pointers */
+ impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
+ impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
+
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ /* no threads here */
+ impl->SkipMixerLock = 1;
+ impl->ProvidesOwnCallbackThread = 1;
+
+ /* check availability */
+ available = EM_ASM_INT_V({
+ if (typeof(AudioContext) !== 'undefined') {
+ return 1;
+ } else if (typeof(webkitAudioContext) !== 'undefined') {
+ return 1;
+ }
+ return 0;
+ });
+
+ if (!available) {
+ SDL_SetError("No audio context available");
+ }
+
+ capture_available = available && EM_ASM_INT_V({
+ if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) {
+ return 1;
+ } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') {
+ return 1;
+ }
+ return 0;
+ });
+
+ impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE;
+ impl->OnlyHasDefaultCaptureDevice = capture_available ? SDL_TRUE : SDL_FALSE;
+
+ return available;
+}
+
+AudioBootStrap EMSCRIPTENAUDIO_bootstrap = {
+ "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h b/src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h
new file mode 100644
index 0000000..3c95668
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_emscriptenaudio_h_
+#define SDL_emscriptenaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ int unused;
+};
+
+#endif /* SDL_emscriptenaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.c b/src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.c
new file mode 100644
index 0000000..802ea78
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.c
@@ -0,0 +1,335 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_ESD
+
+/* Allow access to an ESD network stream mixing buffer */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <esd.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_esdaudio.h"
+
+#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+#else
+#define SDL_NAME(X) X
+#endif
+
+#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+
+static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC;
+static void *esd_handle = NULL;
+
+static int (*SDL_NAME(esd_open_sound)) (const char *host);
+static int (*SDL_NAME(esd_close)) (int esd);
+static int (*SDL_NAME(esd_play_stream)) (esd_format_t format, int rate,
+ const char *host, const char *name);
+
+#define SDL_ESD_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
+static struct
+{
+ const char *name;
+ void **func;
+} const esd_functions[] = {
+ SDL_ESD_SYM(esd_open_sound),
+ SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_play_stream),
+};
+
+#undef SDL_ESD_SYM
+
+static void
+UnloadESDLibrary()
+{
+ if (esd_handle != NULL) {
+ SDL_UnloadObject(esd_handle);
+ esd_handle = NULL;
+ }
+}
+
+static int
+LoadESDLibrary(void)
+{
+ int i, retval = -1;
+
+ if (esd_handle == NULL) {
+ esd_handle = SDL_LoadObject(esd_library);
+ if (esd_handle) {
+ retval = 0;
+ for (i = 0; i < SDL_arraysize(esd_functions); ++i) {
+ *esd_functions[i].func =
+ SDL_LoadFunction(esd_handle, esd_functions[i].name);
+ if (!*esd_functions[i].func) {
+ retval = -1;
+ UnloadESDLibrary();
+ break;
+ }
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+static void
+UnloadESDLibrary()
+{
+ return;
+}
+
+static int
+LoadESDLibrary(void)
+{
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_ESD_DYNAMIC */
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+ESD_WaitDevice(_THIS)
+{
+ Sint32 ticks;
+
+ /* Check to see if the thread-parent process is still alive */
+ {
+ static int cnt = 0;
+ /* Note that this only works with thread implementations
+ that use a different process id for each thread.
+ */
+ /* Check every 10 loops */
+ if (this->hidden->parent && (((++cnt) % 10) == 0)) {
+ if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ }
+ }
+
+ /* Use timer for general audio synchronization */
+ ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
+}
+
+static void
+ESD_PlayDevice(_THIS)
+{
+ int written = 0;
+
+ /* Write the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ written = write(this->hidden->audio_fd,
+ this->hidden->mixbuf, this->hidden->mixlen);
+ if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
+ }
+ } while ((written < 0) &&
+ ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
+
+ /* Set the next write frame */
+ this->hidden->next_frame += this->hidden->frame_ticks;
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+}
+
+static Uint8 *
+ESD_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static void
+ESD_CloseDevice(_THIS)
+{
+ if (this->hidden->audio_fd >= 0) {
+ SDL_NAME(esd_close) (this->hidden->audio_fd);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+/* Try to get the name of the program */
+static char *
+get_progname(void)
+{
+ char *progname = NULL;
+#ifdef __LINUX__
+ FILE *fp;
+ static char temp[BUFSIZ];
+
+ SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
+ fp = fopen(temp, "r");
+ if (fp != NULL) {
+ if (fgets(temp, sizeof(temp) - 1, fp)) {
+ progname = SDL_strrchr(temp, '/');
+ if (progname == NULL) {
+ progname = temp;
+ } else {
+ progname = progname + 1;
+ }
+ }
+ fclose(fp);
+ }
+#endif
+ return (progname);
+}
+
+
+static int
+ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ esd_format_t format = (ESD_STREAM | ESD_PLAY);
+ SDL_AudioFormat test_format = 0;
+ int found = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+ this->hidden->audio_fd = -1;
+
+ /* Convert audio spec to the ESD audio format */
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !found && test_format; test_format = SDL_NextAudioFormat()) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ found = 1;
+ switch (test_format) {
+ case AUDIO_U8:
+ format |= ESD_BITS8;
+ break;
+ case AUDIO_S16SYS:
+ format |= ESD_BITS16;
+ break;
+ default:
+ found = 0;
+ break;
+ }
+ }
+
+ if (!found) {
+ return SDL_SetError("Couldn't find any hardware audio formats");
+ }
+
+ if (this->spec.channels == 1) {
+ format |= ESD_MONO;
+ } else {
+ format |= ESD_STEREO;
+ }
+#if 0
+ this->spec.samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */
+#endif
+
+ /* Open a connection to the ESD audio server */
+ this->hidden->audio_fd =
+ SDL_NAME(esd_play_stream) (format, this->spec.freq, NULL,
+ get_progname());
+
+ if (this->hidden->audio_fd < 0) {
+ return SDL_SetError("Couldn't open ESD connection");
+ }
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+ this->hidden->frame_ticks =
+ (float) (this->spec.samples * 1000) / this->spec.freq;
+ this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks;
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /* Get the parent process id (we're the parent of the audio thread) */
+ this->hidden->parent = getpid();
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static void
+ESD_Deinitialize(void)
+{
+ UnloadESDLibrary();
+}
+
+static int
+ESD_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadESDLibrary() < 0) {
+ return 0;
+ } else {
+ int connection = 0;
+
+ /* Don't start ESD if it's not running */
+ SDL_setenv("ESD_NO_SPAWN", "1", 0);
+
+ connection = SDL_NAME(esd_open_sound) (NULL);
+ if (connection < 0) {
+ UnloadESDLibrary();
+ SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
+ return 0;
+ }
+ SDL_NAME(esd_close) (connection);
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = ESD_OpenDevice;
+ impl->PlayDevice = ESD_PlayDevice;
+ impl->WaitDevice = ESD_WaitDevice;
+ impl->GetDeviceBuf = ESD_GetDeviceBuf;
+ impl->CloseDevice = ESD_CloseDevice;
+ impl->Deinitialize = ESD_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap ESD_bootstrap = {
+ "esd", "Enlightened Sound Daemon", ESD_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_ESD */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.h b/src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.h
new file mode 100644
index 0000000..9b5c25a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/esd/SDL_esdaudio.h
@@ -0,0 +1,51 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_esdaudio_h_
+#define SDL_esdaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
+
+ /* The parent process id, to detect when application quits */
+ pid_t parent;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ /* Support for audio timing using a timer */
+ float frame_ticks;
+ float next_frame;
+};
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+
+#endif /* SDL_esdaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.c b/src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.c
new file mode 100644
index 0000000..36fa5c5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.c
@@ -0,0 +1,328 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_FUSIONSOUND
+
+/* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */
+
+/* Allow access to a raw mixing buffer */
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <unistd.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_fsaudio.h"
+
+#include <fusionsound/fusionsound_version.h>
+
+/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */
+
+#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+#else
+#define SDL_NAME(X) X
+#endif
+
+#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1)
+typedef DFBResult DirectResult;
+#endif
+
+/* Buffers to use - more than 2 gives a lot of latency */
+#define FUSION_BUFFERS (2)
+
+#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+
+static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC;
+static void *fs_handle = NULL;
+
+static DirectResult (*SDL_NAME(FusionSoundInit)) (int *argc, char *(*argv[]));
+static DirectResult (*SDL_NAME(FusionSoundCreate)) (IFusionSound **
+ ret_interface);
+
+#define SDL_FS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
+static struct
+{
+ const char *name;
+ void **func;
+} fs_functions[] = {
+/* *INDENT-OFF* */
+ SDL_FS_SYM(FusionSoundInit),
+ SDL_FS_SYM(FusionSoundCreate),
+/* *INDENT-ON* */
+};
+
+#undef SDL_FS_SYM
+
+static void
+UnloadFusionSoundLibrary()
+{
+ if (fs_handle != NULL) {
+ SDL_UnloadObject(fs_handle);
+ fs_handle = NULL;
+ }
+}
+
+static int
+LoadFusionSoundLibrary(void)
+{
+ int i, retval = -1;
+
+ if (fs_handle == NULL) {
+ fs_handle = SDL_LoadObject(fs_library);
+ if (fs_handle != NULL) {
+ retval = 0;
+ for (i = 0; i < SDL_arraysize(fs_functions); ++i) {
+ *fs_functions[i].func =
+ SDL_LoadFunction(fs_handle, fs_functions[i].name);
+ if (!*fs_functions[i].func) {
+ retval = -1;
+ UnloadFusionSoundLibrary();
+ break;
+ }
+ }
+ }
+ }
+
+ return retval;
+}
+
+#else
+
+static void
+UnloadFusionSoundLibrary()
+{
+ return;
+}
+
+static int
+LoadFusionSoundLibrary(void)
+{
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+SDL_FS_WaitDevice(_THIS)
+{
+ this->hidden->stream->Wait(this->hidden->stream,
+ this->hidden->mixsamples);
+}
+
+static void
+SDL_FS_PlayDevice(_THIS)
+{
+ DirectResult ret;
+
+ ret = this->hidden->stream->Write(this->hidden->stream,
+ this->hidden->mixbuf,
+ this->hidden->mixsamples);
+ /* If we couldn't write, assume fatal error for now */
+ if (ret) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
+#endif
+}
+
+
+static Uint8 *
+SDL_FS_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+
+static void
+SDL_FS_CloseDevice(_THIS)
+{
+ if (this->hidden->stream) {
+ this->hidden->stream->Release(this->hidden->stream);
+ }
+ if (this->hidden->fs) {
+ this->hidden->fs->Release(this->hidden->fs);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+
+static int
+SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ int bytes;
+ SDL_AudioFormat test_format = 0, format = 0;
+ FSSampleFormat fs_format;
+ FSStreamDescription desc;
+ DirectResult ret;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ fs_format = FSSF_U8;
+ bytes = 1;
+ format = 1;
+ break;
+ case AUDIO_S16SYS:
+ fs_format = FSSF_S16;
+ bytes = 2;
+ format = 1;
+ break;
+ case AUDIO_S32SYS:
+ fs_format = FSSF_S32;
+ bytes = 4;
+ format = 1;
+ break;
+ case AUDIO_F32SYS:
+ fs_format = FSSF_FLOAT;
+ bytes = 4;
+ format = 1;
+ break;
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+
+ if (format == 0) {
+ return SDL_SetError("Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ /* Retrieve the main sound interface. */
+ ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs);
+ if (ret) {
+ return SDL_SetError("Unable to initialize FusionSound: %d", ret);
+ }
+
+ this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels;
+
+ /* Fill stream description. */
+ desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE |
+ FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_PREBUFFER;
+ desc.samplerate = this->spec.freq;
+ desc.buffersize = this->spec.size * FUSION_BUFFERS;
+ desc.channels = this->spec.channels;
+ desc.prebuffer = 10;
+ desc.sampleformat = fs_format;
+
+ ret =
+ this->hidden->fs->CreateStream(this->hidden->fs, &desc,
+ &this->hidden->stream);
+ if (ret) {
+ return SDL_SetError("Unable to create FusionSoundStream: %d", ret);
+ }
+
+ /* See what we got */
+ desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE |
+ FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT;
+ ret = this->hidden->stream->GetDescription(this->hidden->stream, &desc);
+
+ this->spec.freq = desc.samplerate;
+ this->spec.size =
+ desc.buffersize / FUSION_BUFFERS * bytes * desc.channels;
+ this->spec.channels = desc.channels;
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+
+static void
+SDL_FS_Deinitialize(void)
+{
+ UnloadFusionSoundLibrary();
+}
+
+
+static int
+SDL_FS_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadFusionSoundLibrary() < 0) {
+ return 0;
+ } else {
+ DirectResult ret;
+
+ ret = SDL_NAME(FusionSoundInit) (NULL, NULL);
+ if (ret) {
+ UnloadFusionSoundLibrary();
+ SDL_SetError
+ ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
+ ret);
+ return 0;
+ }
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = SDL_FS_OpenDevice;
+ impl->PlayDevice = SDL_FS_PlayDevice;
+ impl->WaitDevice = SDL_FS_WaitDevice;
+ impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
+ impl->CloseDevice = SDL_FS_CloseDevice;
+ impl->Deinitialize = SDL_FS_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap FUSIONSOUND_bootstrap = {
+ "fusionsound", "FusionSound", SDL_FS_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.h b/src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.h
new file mode 100644
index 0000000..27e45ce
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/fusionsound/SDL_fsaudio.h
@@ -0,0 +1,50 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_fsaudio_h_
+#define SDL_fsaudio_h_
+
+#include <fusionsound/fusionsound.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* Interface */
+ IFusionSound *fs;
+
+ /* The stream interface for the audio device */
+ IFusionSoundStream *stream;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+ int mixsamples;
+
+};
+
+#endif /* SDL_fsaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.cc b/src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.cc
new file mode 100644
index 0000000..52946a5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.cc
@@ -0,0 +1,248 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_HAIKU
+
+/* Allow access to the audio stream on Haiku */
+
+#include <SoundPlayer.h>
+#include <signal.h>
+
+#include "../../main/haiku/SDL_BeApp.h"
+
+extern "C"
+{
+
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_haikuaudio.h"
+#include "SDL_assert.h"
+
+}
+
+
+/* !!! FIXME: have the callback call the higher level to avoid code dupe. */
+/* The Haiku callback for handling the audio buffer */
+static void
+FillSound(void *device, void *stream, size_t len,
+ const media_raw_audio_format & format)
+{
+ SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
+ SDL_AudioCallback callback = audio->callbackspec.callback;
+
+ /* Only do something if audio is enabled */
+ if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) {
+ if (audio->stream) {
+ SDL_AudioStreamClear(audio->stream);
+ }
+ SDL_memset(stream, audio->spec.silence, len);
+ return;
+ }
+
+ SDL_assert(audio->spec.size == len);
+
+ if (audio->stream == NULL) { /* no conversion necessary. */
+ SDL_LockMutex(audio->mixer_lock);
+ callback(audio->callbackspec.userdata, (Uint8 *) stream, len);
+ SDL_UnlockMutex(audio->mixer_lock);
+ } else { /* streaming/converting */
+ const int stream_len = audio->callbackspec.size;
+ const int ilen = (int) len;
+ while (SDL_AudioStreamAvailable(audio->stream) < ilen) {
+ callback(audio->callbackspec.userdata, audio->work_buffer, stream_len);
+ if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) {
+ SDL_AudioStreamClear(audio->stream);
+ SDL_AtomicSet(&audio->enabled, 0);
+ break;
+ }
+ }
+
+ const int got = SDL_AudioStreamGet(audio->stream, stream, ilen);
+ SDL_assert((got < 0) || (got == ilen));
+ if (got != ilen) {
+ SDL_memset(stream, audio->spec.silence, len);
+ }
+ }
+}
+
+static void
+HAIKUAUDIO_CloseDevice(_THIS)
+{
+ if (_this->hidden->audio_obj) {
+ _this->hidden->audio_obj->Stop();
+ delete _this->hidden->audio_obj;
+ }
+ delete _this->hidden;
+}
+
+
+static const int sig_list[] = {
+ SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGWINCH, 0
+};
+
+static inline void
+MaskSignals(sigset_t * omask)
+{
+ sigset_t mask;
+ int i;
+
+ sigemptyset(&mask);
+ for (i = 0; sig_list[i]; ++i) {
+ sigaddset(&mask, sig_list[i]);
+ }
+ sigprocmask(SIG_BLOCK, &mask, omask);
+}
+
+static inline void
+UnmaskSignals(sigset_t * omask)
+{
+ sigprocmask(SIG_SETMASK, omask, NULL);
+}
+
+
+static int
+HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ int valid_datatype = 0;
+ media_raw_audio_format format;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format);
+
+ /* Initialize all variables that we clean on shutdown */
+ _this->hidden = new SDL_PrivateAudioData;
+ if (_this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(_this->hidden);
+
+ /* Parse the audio format and fill the Be raw audio format */
+ SDL_zero(format);
+ format.byte_order = B_MEDIA_LITTLE_ENDIAN;
+ format.frame_rate = (float) _this->spec.freq;
+ format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */
+ while ((!valid_datatype) && (test_format)) {
+ valid_datatype = 1;
+ _this->spec.format = test_format;
+ switch (test_format) {
+ case AUDIO_S8:
+ format.format = media_raw_audio_format::B_AUDIO_CHAR;
+ break;
+
+ case AUDIO_U8:
+ format.format = media_raw_audio_format::B_AUDIO_UCHAR;
+ break;
+
+ case AUDIO_S16LSB:
+ format.format = media_raw_audio_format::B_AUDIO_SHORT;
+ break;
+
+ case AUDIO_S16MSB:
+ format.format = media_raw_audio_format::B_AUDIO_SHORT;
+ format.byte_order = B_MEDIA_BIG_ENDIAN;
+ break;
+
+ case AUDIO_S32LSB:
+ format.format = media_raw_audio_format::B_AUDIO_INT;
+ break;
+
+ case AUDIO_S32MSB:
+ format.format = media_raw_audio_format::B_AUDIO_INT;
+ format.byte_order = B_MEDIA_BIG_ENDIAN;
+ break;
+
+ case AUDIO_F32LSB:
+ format.format = media_raw_audio_format::B_AUDIO_FLOAT;
+ break;
+
+ case AUDIO_F32MSB:
+ format.format = media_raw_audio_format::B_AUDIO_FLOAT;
+ format.byte_order = B_MEDIA_BIG_ENDIAN;
+ break;
+
+ default:
+ valid_datatype = 0;
+ test_format = SDL_NextAudioFormat();
+ break;
+ }
+ }
+
+ if (!valid_datatype) { /* shouldn't happen, but just in case... */
+ return SDL_SetError("Unsupported audio format");
+ }
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&_this->spec);
+
+ format.buffer_size = _this->spec.size;
+
+ /* Subscribe to the audio stream (creates a new thread) */
+ sigset_t omask;
+ MaskSignals(&omask);
+ _this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio",
+ FillSound, NULL, _this);
+ UnmaskSignals(&omask);
+
+ if (_this->hidden->audio_obj->Start() == B_NO_ERROR) {
+ _this->hidden->audio_obj->SetHasData(true);
+ } else {
+ return SDL_SetError("Unable to start Be audio");
+ }
+
+ /* We're running! */
+ return 0;
+}
+
+static void
+HAIKUAUDIO_Deinitialize(void)
+{
+ SDL_QuitBeApp();
+}
+
+static int
+HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Initialize the Be Application, if it's not already started */
+ if (SDL_InitBeApp() < 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = HAIKUAUDIO_OpenDevice;
+ impl->CloseDevice = HAIKUAUDIO_CloseDevice;
+ impl->Deinitialize = HAIKUAUDIO_Deinitialize;
+ impl->ProvidesOwnCallbackThread = 1;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+extern "C"
+{
+ extern AudioBootStrap HAIKUAUDIO_bootstrap;
+}
+AudioBootStrap HAIKUAUDIO_bootstrap = {
+ "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.h b/src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.h
new file mode 100644
index 0000000..f63ccdb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/haiku/SDL_haikuaudio.h
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_haikuaudio_h_
+#define SDL_haikuaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *_this
+
+struct SDL_PrivateAudioData
+{
+ BSoundPlayer *audio_obj;
+};
+
+#endif /* SDL_haikuaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.c b/src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.c
new file mode 100644
index 0000000..a252da7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.c
@@ -0,0 +1,429 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_JACK
+
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_jackaudio.h"
+#include "SDL_loadso.h"
+#include "../../thread/SDL_systhread.h"
+
+
+static jack_client_t * (*JACK_jack_client_open) (const char *, jack_options_t, jack_status_t *, ...);
+static int (*JACK_jack_client_close) (jack_client_t *);
+static void (*JACK_jack_on_shutdown) (jack_client_t *, JackShutdownCallback, void *);
+static int (*JACK_jack_activate) (jack_client_t *);
+static int (*JACK_jack_deactivate) (jack_client_t *);
+static void * (*JACK_jack_port_get_buffer) (jack_port_t *, jack_nframes_t);
+static int (*JACK_jack_port_unregister) (jack_client_t *, jack_port_t *);
+static void (*JACK_jack_free) (void *);
+static const char ** (*JACK_jack_get_ports) (jack_client_t *, const char *, const char *, unsigned long);
+static jack_nframes_t (*JACK_jack_get_sample_rate) (jack_client_t *);
+static jack_nframes_t (*JACK_jack_get_buffer_size) (jack_client_t *);
+static jack_port_t * (*JACK_jack_port_register) (jack_client_t *, const char *, const char *, unsigned long, unsigned long);
+static const char * (*JACK_jack_port_name) (const jack_port_t *);
+static int (*JACK_jack_connect) (jack_client_t *, const char *, const char *);
+static int (*JACK_jack_set_process_callback) (jack_client_t *, JackProcessCallback, void *);
+
+static int load_jack_syms(void);
+
+
+#ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC
+
+static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC;
+static void *jack_handle = NULL;
+
+/* !!! FIXME: this is copy/pasted in several places now */
+static int
+load_jack_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(jack_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return 0;
+ }
+
+ return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_JACK_SYM(x) \
+ if (!load_jack_sym(#x, (void **) (char *) &JACK_##x)) return -1
+
+static void
+UnloadJackLibrary(void)
+{
+ if (jack_handle != NULL) {
+ SDL_UnloadObject(jack_handle);
+ jack_handle = NULL;
+ }
+}
+
+static int
+LoadJackLibrary(void)
+{
+ int retval = 0;
+ if (jack_handle == NULL) {
+ jack_handle = SDL_LoadObject(jack_library);
+ if (jack_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = load_jack_syms();
+ if (retval < 0) {
+ UnloadJackLibrary();
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+#define SDL_JACK_SYM(x) JACK_##x = x
+
+static void
+UnloadJackLibrary(void)
+{
+}
+
+static int
+LoadJackLibrary(void)
+{
+ load_jack_syms();
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_JACK_DYNAMIC */
+
+
+static int
+load_jack_syms(void)
+{
+ SDL_JACK_SYM(jack_client_open);
+ SDL_JACK_SYM(jack_client_close);
+ SDL_JACK_SYM(jack_on_shutdown);
+ SDL_JACK_SYM(jack_activate);
+ SDL_JACK_SYM(jack_deactivate);
+ SDL_JACK_SYM(jack_port_get_buffer);
+ SDL_JACK_SYM(jack_port_unregister);
+ SDL_JACK_SYM(jack_free);
+ SDL_JACK_SYM(jack_get_ports);
+ SDL_JACK_SYM(jack_get_sample_rate);
+ SDL_JACK_SYM(jack_get_buffer_size);
+ SDL_JACK_SYM(jack_port_register);
+ SDL_JACK_SYM(jack_port_name);
+ SDL_JACK_SYM(jack_connect);
+ SDL_JACK_SYM(jack_set_process_callback);
+ return 0;
+}
+
+
+static void
+jackShutdownCallback(void *arg) /* JACK went away; device is lost. */
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
+ SDL_OpenedAudioDeviceDisconnected(this);
+ SDL_SemPost(this->hidden->iosem); /* unblock the SDL thread. */
+}
+
+// !!! FIXME: implement and register these!
+//typedef int(* JackSampleRateCallback)(jack_nframes_t nframes, void *arg)
+//typedef int(* JackBufferSizeCallback)(jack_nframes_t nframes, void *arg)
+
+static int
+jackProcessPlaybackCallback(jack_nframes_t nframes, void *arg)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
+ jack_port_t **ports = this->hidden->sdlports;
+ const int total_channels = this->spec.channels;
+ const int total_frames = this->spec.samples;
+ int channelsi;
+
+ if (!SDL_AtomicGet(&this->enabled)) {
+ /* silence the buffer to avoid repeats and corruption. */
+ SDL_memset(this->hidden->iobuffer, '\0', this->spec.size);
+ }
+
+ for (channelsi = 0; channelsi < total_channels; channelsi++) {
+ float *dst = (float *) JACK_jack_port_get_buffer(ports[channelsi], nframes);
+ if (dst) {
+ const float *src = ((float *) this->hidden->iobuffer) + channelsi;
+ int framesi;
+ for (framesi = 0; framesi < total_frames; framesi++) {
+ *(dst++) = *src;
+ src += total_channels;
+ }
+ }
+ }
+
+ SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; refill the buffer. */
+ return 0; /* success */
+}
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+JACK_WaitDevice(_THIS)
+{
+ if (SDL_AtomicGet(&this->enabled)) {
+ if (SDL_SemWait(this->hidden->iosem) == -1) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ }
+}
+
+static Uint8 *
+JACK_GetDeviceBuf(_THIS)
+{
+ return (Uint8 *) this->hidden->iobuffer;
+}
+
+
+static int
+jackProcessCaptureCallback(jack_nframes_t nframes, void *arg)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) arg;
+ if (SDL_AtomicGet(&this->enabled)) {
+ jack_port_t **ports = this->hidden->sdlports;
+ const int total_channels = this->spec.channels;
+ const int total_frames = this->spec.samples;
+ int channelsi;
+
+ for (channelsi = 0; channelsi < total_channels; channelsi++) {
+ const float *src = (const float *) JACK_jack_port_get_buffer(ports[channelsi], nframes);
+ if (src) {
+ float *dst = ((float *) this->hidden->iobuffer) + channelsi;
+ int framesi;
+ for (framesi = 0; framesi < total_frames; framesi++) {
+ *dst = *(src++);
+ dst += total_channels;
+ }
+ }
+ }
+ }
+
+ SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; new buffer is ready! */
+ return 0; /* success */
+}
+
+static int
+JACK_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ SDL_assert(buflen == this->spec.size); /* we always fill a full buffer. */
+
+ /* Wait for JACK to fill the iobuffer */
+ if (SDL_SemWait(this->hidden->iosem) == -1) {
+ return -1;
+ }
+
+ SDL_memcpy(buffer, this->hidden->iobuffer, buflen);
+ return buflen;
+}
+
+static void
+JACK_FlushCapture(_THIS)
+{
+ SDL_SemWait(this->hidden->iosem);
+}
+
+
+static void
+JACK_CloseDevice(_THIS)
+{
+ if (this->hidden->client) {
+ JACK_jack_deactivate(this->hidden->client);
+
+ if (this->hidden->sdlports) {
+ const int channels = this->spec.channels;
+ int i;
+ for (i = 0; i < channels; i++) {
+ JACK_jack_port_unregister(this->hidden->client, this->hidden->sdlports[i]);
+ }
+ SDL_free(this->hidden->sdlports);
+ }
+
+ JACK_jack_client_close(this->hidden->client);
+ }
+
+ if (this->hidden->iosem) {
+ SDL_DestroySemaphore(this->hidden->iosem);
+ }
+
+ if (this->hidden->devports) {
+ JACK_jack_free(this->hidden->devports);
+ }
+
+ SDL_free(this->hidden->iobuffer);
+}
+
+static int
+JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ /* Note that JACK uses "output" for capture devices (they output audio
+ data to us) and "input" for playback (we input audio data to them).
+ Likewise, SDL's playback port will be "output" (we write data out)
+ and capture will be "input" (we read data in). */
+ const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput;
+ const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput;
+ const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback;
+ const char *sdlportstr = iscapture ? "input" : "output";
+ const char **devports = NULL;
+ jack_client_t *client = NULL;
+ jack_status_t status;
+ int channels = 0;
+ int i;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof (*this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* !!! FIXME: we _still_ need an API to specify an app name */
+ client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
+ this->hidden->client = client;
+ if (client == NULL) {
+ return SDL_SetError("Can't open JACK client");
+ }
+
+ devports = JACK_jack_get_ports(client, NULL, NULL, JackPortIsPhysical | sysportflags);
+ this->hidden->devports = devports;
+ if (!devports || !devports[0]) {
+ return SDL_SetError("No physical JACK ports available");
+ }
+
+ while (devports[++channels]) {
+ /* spin to count devports */
+ }
+
+ /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be notified if it does." */
+
+ /* Jack pretty much demands what it wants. */
+ this->spec.format = AUDIO_F32SYS;
+ this->spec.freq = JACK_jack_get_sample_rate(client);
+ this->spec.channels = channels;
+ this->spec.samples = JACK_jack_get_buffer_size(client);
+
+ SDL_CalculateAudioSpec(&this->spec);
+
+ this->hidden->iosem = SDL_CreateSemaphore(0);
+ if (!this->hidden->iosem) {
+ return -1; /* error was set by SDL_CreateSemaphore */
+ }
+
+ this->hidden->iobuffer = (float *) SDL_calloc(1, this->spec.size);
+ if (!this->hidden->iobuffer) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Build SDL's ports, which we will connect to the device ports. */
+ this->hidden->sdlports = (jack_port_t **) SDL_calloc(channels, sizeof (jack_port_t *));
+ if (this->hidden->sdlports == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ for (i = 0; i < channels; i++) {
+ char portname[32];
+ SDL_snprintf(portname, sizeof (portname), "sdl_jack_%s_%d", sdlportstr, i);
+ this->hidden->sdlports[i] = JACK_jack_port_register(client, portname, JACK_DEFAULT_AUDIO_TYPE, sdlportflags, 0);
+ if (this->hidden->sdlports[i] == NULL) {
+ return SDL_SetError("jack_port_register failed");
+ }
+ }
+
+ if (JACK_jack_set_process_callback(client, callback, this) != 0) {
+ return SDL_SetError("JACK: Couldn't set process callback");
+ }
+
+ JACK_jack_on_shutdown(client, jackShutdownCallback, this);
+
+ if (JACK_jack_activate(client) != 0) {
+ return SDL_SetError("Failed to activate JACK client");
+ }
+
+ /* once activated, we can connect all the ports. */
+ for (i = 0; i < channels; i++) {
+ const char *sdlport = JACK_jack_port_name(this->hidden->sdlports[i]);
+ const char *srcport = iscapture ? devports[i] : sdlport;
+ const char *dstport = iscapture ? sdlport : devports[i];
+ if (JACK_jack_connect(client, srcport, dstport) != 0) {
+ return SDL_SetError("Couldn't connect JACK ports: %s => %s", srcport, dstport);
+ }
+ }
+
+ /* don't need these anymore. */
+ this->hidden->devports = NULL;
+ JACK_jack_free(devports);
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static void
+JACK_Deinitialize(void)
+{
+ UnloadJackLibrary();
+}
+
+static int
+JACK_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadJackLibrary() < 0) {
+ return 0;
+ } else {
+ /* Make sure a JACK server is running and available. */
+ jack_status_t status;
+ jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
+ if (client == NULL) {
+ UnloadJackLibrary();
+ return 0;
+ }
+ JACK_jack_client_close(client);
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = JACK_OpenDevice;
+ impl->WaitDevice = JACK_WaitDevice;
+ impl->GetDeviceBuf = JACK_GetDeviceBuf;
+ impl->CloseDevice = JACK_CloseDevice;
+ impl->Deinitialize = JACK_Deinitialize;
+ impl->CaptureFromDevice = JACK_CaptureFromDevice;
+ impl->FlushCapture = JACK_FlushCapture;
+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
+ impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap JACK_bootstrap = {
+ "jack", "JACK Audio Connection Kit", JACK_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_JACK */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.h b/src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.h
new file mode 100644
index 0000000..aab199a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/jack/SDL_jackaudio.h
@@ -0,0 +1,42 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_jackaudio_h_
+#define SDL_jackaudio_h_
+
+#include <jack/jack.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ jack_client_t *client;
+ SDL_sem *iosem;
+ float *iobuffer;
+ const char **devports;
+ jack_port_t **sdlports;
+};
+
+#endif /* SDL_jackaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.c b/src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.c
new file mode 100644
index 0000000..3e3afc0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.c
@@ -0,0 +1,165 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_NACL
+
+#include "SDL_naclaudio.h"
+
+#include "SDL_audio.h"
+#include "SDL_mutex.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi_simple/ps.h"
+#include "ppapi_simple/ps_interface.h"
+#include "ppapi_simple/ps_event.h"
+
+/* The tag name used by NACL audio */
+#define NACLAUDIO_DRIVER_NAME "nacl"
+
+#define SAMPLE_FRAME_COUNT 4096
+
+/* Audio driver functions */
+static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data);
+
+/* FIXME: Make use of latency if needed */
+static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) {
+ const int len = (int) buffer_size;
+ SDL_AudioDevice* _this = (SDL_AudioDevice*) data;
+ SDL_AudioCallback callback = _this->callbackspec.callback;
+
+ SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */
+
+ /* Only do something if audio is enabled */
+ if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) {
+ if (_this->stream) {
+ SDL_AudioStreamClear(_this->stream);
+ }
+ SDL_memset(stream, _this->spec.silence, len);
+ return;
+ }
+
+ SDL_assert(_this->spec.size == len);
+
+ if (_this->stream == NULL) { /* no conversion necessary. */
+ SDL_LockMutex(_this->mixer_lock);
+ callback(_this->callbackspec.userdata, stream, len);
+ SDL_UnlockMutex(_this->mixer_lock);
+ } else { /* streaming/converting */
+ const int stream_len = _this->callbackspec.size;
+ while (SDL_AudioStreamAvailable(_this->stream) < len) {
+ callback(_this->callbackspec.userdata, _this->work_buffer, stream_len);
+ if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) {
+ SDL_AudioStreamClear(_this->stream);
+ SDL_AtomicSet(&_this->enabled, 0);
+ break;
+ }
+ }
+
+ const int got = SDL_AudioStreamGet(_this->stream, stream, len);
+ SDL_assert((got < 0) || (got == len));
+ if (got != len) {
+ SDL_memset(stream, _this->spec.silence, len);
+ }
+ }
+
+ SDL_UnlockMutex(private->mutex);
+}
+
+static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
+ const PPB_Core *core = PSInterfaceCore();
+ const PPB_Audio *ppb_audio = PSInterfaceAudio();
+ SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden;
+
+ ppb_audio->StopPlayback(hidden->audio);
+ SDL_DestroyMutex(hidden->mutex);
+ core->ReleaseResource(hidden->audio);
+}
+
+static int
+NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
+ PP_Instance instance = PSGetInstanceId();
+ const PPB_Audio *ppb_audio = PSInterfaceAudio();
+ const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
+
+ private = (SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *private));
+ if (private == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ private->mutex = SDL_CreateMutex();
+ _this->spec.freq = 44100;
+ _this->spec.format = AUDIO_S16LSB;
+ _this->spec.channels = 2;
+ _this->spec.samples = ppb_audiocfg->RecommendSampleFrameCount(
+ instance,
+ PP_AUDIOSAMPLERATE_44100,
+ SAMPLE_FRAME_COUNT);
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&_this->spec);
+
+ private->audio = ppb_audio->Create(
+ instance,
+ ppb_audiocfg->CreateStereo16Bit(instance, PP_AUDIOSAMPLERATE_44100, _this->spec.samples),
+ nacl_audio_callback,
+ _this);
+
+ /* Start audio playback while we are still on the main thread. */
+ ppb_audio->StartPlayback(private->audio);
+
+ return 0;
+}
+
+static int
+NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ if (PSGetInstanceId() == 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = NACLAUDIO_OpenDevice;
+ impl->CloseDevice = NACLAUDIO_CloseDevice;
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->ProvidesOwnCallbackThread = 1;
+ /*
+ * impl->WaitDevice = NACLAUDIO_WaitDevice;
+ * impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf;
+ * impl->PlayDevice = NACLAUDIO_PlayDevice;
+ * impl->Deinitialize = NACLAUDIO_Deinitialize;
+ */
+
+ return 1;
+}
+
+AudioBootStrap NACLAUDIO_bootstrap = {
+ NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver",
+ NACLAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_NACL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.h b/src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.h
new file mode 100644
index 0000000..5ec842b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/nacl/SDL_naclaudio.h
@@ -0,0 +1,43 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_naclaudio_h_
+#define SDL_naclaudio_h_
+
+#include "SDL_audio.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_mutex.h"
+
+#include "ppapi/c/ppb_audio.h"
+
+#define _THIS SDL_AudioDevice *_this
+#define private _this->hidden
+
+typedef struct SDL_PrivateAudioData {
+ SDL_mutex* mutex;
+ PP_Resource audio;
+} SDL_PrivateAudioData;
+
+#endif /* SDL_naclaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.c b/src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.c
new file mode 100644
index 0000000..5a02a3b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.c
@@ -0,0 +1,463 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_NAS
+
+/* Allow access to a raw mixing buffer */
+
+#include <signal.h>
+#include <unistd.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "SDL_loadso.h"
+#include "../SDL_audio_c.h"
+#include "SDL_nasaudio.h"
+
+static void (*NAS_AuCloseServer) (AuServer *);
+static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *);
+static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *);
+static void (*NAS_AuHandleEvents) (AuServer *);
+static AuFlowID(*NAS_AuCreateFlow) (AuServer *, AuStatus *);
+static void (*NAS_AuStartFlow) (AuServer *, AuFlowID, AuStatus *);
+static void (*NAS_AuSetElements)
+ (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *);
+static void (*NAS_AuWriteElement)
+ (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuBool, AuStatus *);
+static AuUint32 (*NAS_AuReadElement)
+ (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuStatus *);
+static AuServer *(*NAS_AuOpenServer)
+ (_AuConst char *, int, _AuConst char *, int, _AuConst char *, char **);
+static AuEventHandlerRec *(*NAS_AuRegisterEventHandler)
+ (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer);
+
+
+#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
+
+static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC;
+static void *nas_handle = NULL;
+
+static int
+load_nas_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(nas_handle, fn);
+ if (*addr == NULL) {
+ return 0;
+ }
+ return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_NAS_SYM(x) \
+ if (!load_nas_sym(#x, (void **) (char *) &NAS_##x)) return -1
+#else
+#define SDL_NAS_SYM(x) NAS_##x = x
+#endif
+
+static int
+load_nas_syms(void)
+{
+ SDL_NAS_SYM(AuCloseServer);
+ SDL_NAS_SYM(AuNextEvent);
+ SDL_NAS_SYM(AuDispatchEvent);
+ SDL_NAS_SYM(AuHandleEvents);
+ SDL_NAS_SYM(AuCreateFlow);
+ SDL_NAS_SYM(AuStartFlow);
+ SDL_NAS_SYM(AuSetElements);
+ SDL_NAS_SYM(AuWriteElement);
+ SDL_NAS_SYM(AuReadElement);
+ SDL_NAS_SYM(AuOpenServer);
+ SDL_NAS_SYM(AuRegisterEventHandler);
+ return 0;
+}
+
+#undef SDL_NAS_SYM
+
+#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
+
+static void
+UnloadNASLibrary(void)
+{
+ if (nas_handle != NULL) {
+ SDL_UnloadObject(nas_handle);
+ nas_handle = NULL;
+ }
+}
+
+static int
+LoadNASLibrary(void)
+{
+ int retval = 0;
+ if (nas_handle == NULL) {
+ nas_handle = SDL_LoadObject(nas_library);
+ if (nas_handle == NULL) {
+ /* Copy error string so we can use it in a new SDL_SetError(). */
+ const char *origerr = SDL_GetError();
+ const size_t len = SDL_strlen(origerr) + 1;
+ char *err = (char *) alloca(len);
+ SDL_strlcpy(err, origerr, len);
+ retval = -1;
+ SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s",
+ nas_library, err);
+ } else {
+ retval = load_nas_syms();
+ if (retval < 0) {
+ UnloadNASLibrary();
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+static void
+UnloadNASLibrary(void)
+{
+}
+
+static int
+LoadNASLibrary(void)
+{
+ load_nas_syms();
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+NAS_WaitDevice(_THIS)
+{
+ while (this->hidden->buf_free < this->hidden->mixlen) {
+ AuEvent ev;
+ NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
+ NAS_AuDispatchEvent(this->hidden->aud, &ev);
+ }
+}
+
+static void
+NAS_PlayDevice(_THIS)
+{
+ while (this->hidden->mixlen > this->hidden->buf_free) {
+ /*
+ * We think the buffer is full? Yikes! Ask the server for events,
+ * in the hope that some of them is LowWater events telling us more
+ * of the buffer is free now than what we think.
+ */
+ AuEvent ev;
+ NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
+ NAS_AuDispatchEvent(this->hidden->aud, &ev);
+ }
+ this->hidden->buf_free -= this->hidden->mixlen;
+
+ /* Write the audio data */
+ NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0,
+ this->hidden->mixlen, this->hidden->mixbuf, AuFalse,
+ NULL);
+
+ this->hidden->written += this->hidden->mixlen;
+
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
+#endif
+}
+
+static Uint8 *
+NAS_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static int
+NAS_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ int retval;
+
+ while (SDL_TRUE) {
+ /* just keep the event queue moving and the server chattering. */
+ NAS_AuHandleEvents(h->aud);
+
+ retval = (int) NAS_AuReadElement(h->aud, h->flow, 1, buflen, buffer, NULL);
+ /*printf("read %d capture bytes\n", (int) retval);*/
+ if (retval == 0) {
+ SDL_Delay(10); /* don't burn the CPU if we're waiting for data. */
+ } else {
+ break;
+ }
+ }
+
+ return retval;
+}
+
+static void
+NAS_FlushCapture(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ AuUint32 total = 0;
+ AuUint32 br;
+ Uint8 buf[512];
+
+ do {
+ /* just keep the event queue moving and the server chattering. */
+ NAS_AuHandleEvents(h->aud);
+ br = NAS_AuReadElement(h->aud, h->flow, 1, sizeof (buf), buf, NULL);
+ /*printf("flushed %d capture bytes\n", (int) br);*/
+ total += br;
+ } while ((br == sizeof (buf)) && (total < this->spec.size));
+}
+
+static void
+NAS_CloseDevice(_THIS)
+{
+ if (this->hidden->aud) {
+ NAS_AuCloseServer(this->hidden->aud);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static unsigned char
+sdlformat_to_auformat(unsigned int fmt)
+{
+ switch (fmt) {
+ case AUDIO_U8:
+ return AuFormatLinearUnsigned8;
+ case AUDIO_S8:
+ return AuFormatLinearSigned8;
+ case AUDIO_U16LSB:
+ return AuFormatLinearUnsigned16LSB;
+ case AUDIO_U16MSB:
+ return AuFormatLinearUnsigned16MSB;
+ case AUDIO_S16LSB:
+ return AuFormatLinearSigned16LSB;
+ case AUDIO_S16MSB:
+ return AuFormatLinearSigned16MSB;
+ }
+ return AuNone;
+}
+
+static AuBool
+event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) hnd->data;
+ struct SDL_PrivateAudioData *h = this->hidden;
+ if (this->iscapture) {
+ return AuTrue; /* we don't (currently) care about any of this for capture devices */
+ }
+
+ switch (ev->type) {
+ case AuEventTypeElementNotify:
+ {
+ AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
+
+ switch (event->kind) {
+ case AuElementNotifyKindLowWater:
+ if (h->buf_free >= 0) {
+ h->really += event->num_bytes;
+ gettimeofday(&h->last_tv, 0);
+ h->buf_free += event->num_bytes;
+ } else {
+ h->buf_free = event->num_bytes;
+ }
+ break;
+ case AuElementNotifyKindState:
+ switch (event->cur_state) {
+ case AuStatePause:
+ if (event->reason != AuReasonUser) {
+ if (h->buf_free >= 0) {
+ h->really += event->num_bytes;
+ gettimeofday(&h->last_tv, 0);
+ h->buf_free += event->num_bytes;
+ } else {
+ h->buf_free = event->num_bytes;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ return AuTrue;
+}
+
+static AuDeviceID
+find_device(_THIS)
+{
+ /* These "Au" things are all macros, not functions... */
+ struct SDL_PrivateAudioData *h = this->hidden;
+ const unsigned int devicekind = this->iscapture ? AuComponentKindPhysicalInput : AuComponentKindPhysicalOutput;
+ const int numdevs = AuServerNumDevices(h->aud);
+ const int nch = this->spec.channels;
+ int i;
+
+ /* Try to find exact match on channels first... */
+ for (i = 0; i < numdevs; i++) {
+ const AuDeviceAttributes *dev = AuServerDevice(h->aud, i);
+ if ((AuDeviceKind(dev) == devicekind) && (AuDeviceNumTracks(dev) == nch)) {
+ return AuDeviceIdentifier(dev);
+ }
+ }
+
+ /* Take anything, then... */
+ for (i = 0; i < numdevs; i++) {
+ const AuDeviceAttributes *dev = AuServerDevice(h->aud, i);
+ if (AuDeviceKind(dev) == devicekind) {
+ this->spec.channels = AuDeviceNumTracks(dev);
+ return AuDeviceIdentifier(dev);
+ }
+ }
+ return AuNone;
+}
+
+static int
+NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ AuElement elms[3];
+ int buffer_size;
+ SDL_AudioFormat test_format, format;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+ format = sdlformat_to_auformat(test_format);
+ if (format == AuNone) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ return SDL_SetError("NAS: Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
+ if (this->hidden->aud == 0) {
+ return SDL_SetError("NAS: Couldn't open connection to NAS server");
+ }
+
+ this->hidden->dev = find_device(this);
+ if ((this->hidden->dev == AuNone)
+ || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) {
+ return SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
+ }
+
+ buffer_size = this->spec.freq;
+ if (buffer_size < 4096)
+ buffer_size = 4096;
+
+ if (buffer_size > 32768)
+ buffer_size = 32768; /* So that the buffer won't get unmanageably big. */
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ if (iscapture) {
+ AuMakeElementImportDevice(elms, this->spec.freq, this->hidden->dev,
+ AuUnlimitedSamples, 0, NULL);
+ AuMakeElementExportClient(elms + 1, 0, this->spec.freq, format,
+ this->spec.channels, AuTrue, buffer_size,
+ buffer_size, 0, NULL);
+ } else {
+ AuMakeElementImportClient(elms, this->spec.freq, format,
+ this->spec.channels, AuTrue, buffer_size,
+ buffer_size / 4, 0, NULL);
+ AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq,
+ AuUnlimitedSamples, 0, NULL);
+ }
+
+ NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue,
+ 2, elms, NULL);
+
+ NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0,
+ this->hidden->flow, event_handler,
+ (AuPointer) this);
+
+ NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL);
+
+ /* Allocate mixing buffer */
+ if (!iscapture) {
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+ }
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static void
+NAS_Deinitialize(void)
+{
+ UnloadNASLibrary();
+}
+
+static int
+NAS_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadNASLibrary() < 0) {
+ return 0;
+ } else {
+ AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
+ if (aud == NULL) {
+ SDL_SetError("NAS: AuOpenServer() failed (no audio server?)");
+ return 0;
+ }
+ NAS_AuCloseServer(aud);
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = NAS_OpenDevice;
+ impl->PlayDevice = NAS_PlayDevice;
+ impl->WaitDevice = NAS_WaitDevice;
+ impl->GetDeviceBuf = NAS_GetDeviceBuf;
+ impl->CaptureFromDevice = NAS_CaptureFromDevice;
+ impl->FlushCapture = NAS_FlushCapture;
+ impl->CloseDevice = NAS_CloseDevice;
+ impl->Deinitialize = NAS_Deinitialize;
+
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultCaptureDevice = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap NAS_bootstrap = {
+ "nas", "Network Audio System", NAS_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_NAS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.h b/src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.h
new file mode 100644
index 0000000..b1a51d1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/nas/SDL_nasaudio.h
@@ -0,0 +1,56 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_nasaudio_h_
+#define SDL_nasaudio_h_
+
+#ifdef __sgi
+#include <nas/audiolib.h>
+#else
+#include <audio/audiolib.h>
+#endif
+#include <sys/time.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ AuServer *aud;
+ AuFlowID flow;
+ AuDeviceID dev;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ int written;
+ int really;
+ int bps;
+ struct timeval last_tv;
+ int buf_free;
+};
+#endif /* SDL_nasaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.c b/src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.c
new file mode 100644
index 0000000..0dc0b25
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.c
@@ -0,0 +1,412 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_NETBSD
+
+/*
+ * Driver for native NetBSD audio(4).
+ * vedge@vedge.com.ar.
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/audioio.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../../core/unix/SDL_poll.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
+#include "SDL_netbsdaudio.h"
+
+/* Use timer for synchronization */
+/* #define USE_TIMER_SYNC */
+
+/* #define DEBUG_AUDIO */
+/* #define DEBUG_AUDIO_STREAM */
+
+
+static void
+NETBSDAUDIO_DetectDevices(void)
+{
+ SDL_EnumUnixAudioDevices(0, NULL);
+}
+
+
+static void
+NETBSDAUDIO_Status(_THIS)
+{
+#ifdef DEBUG_AUDIO
+ /* *INDENT-OFF* */
+ audio_info_t info;
+ const audio_prinfo *prinfo;
+
+ if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) {
+ fprintf(stderr, "AUDIO_GETINFO failed.\n");
+ return;
+ }
+
+ prinfo = this->iscapture ? &info.play : &info.record;
+
+ fprintf(stderr, "\n"
+ "[%s info]\n"
+ "buffer size : %d bytes\n"
+ "sample rate : %i Hz\n"
+ "channels : %i\n"
+ "precision : %i-bit\n"
+ "encoding : 0x%x\n"
+ "seek : %i\n"
+ "sample count : %i\n"
+ "EOF count : %i\n"
+ "paused : %s\n"
+ "error occured : %s\n"
+ "waiting : %s\n"
+ "active : %s\n"
+ "",
+ this->iscapture ? "record" : "play",
+ prinfo->buffer_size,
+ prinfo->sample_rate,
+ prinfo->channels,
+ prinfo->precision,
+ prinfo->encoding,
+ prinfo->seek,
+ prinfo->samples,
+ prinfo->eof,
+ prinfo->pause ? "yes" : "no",
+ prinfo->error ? "yes" : "no",
+ prinfo->waiting ? "yes" : "no",
+ prinfo->active ? "yes" : "no");
+
+ fprintf(stderr, "\n"
+ "[audio info]\n"
+ "monitor_gain : %i\n"
+ "hw block size : %d bytes\n"
+ "hi watermark : %i\n"
+ "lo watermark : %i\n"
+ "audio mode : %s\n"
+ "",
+ info.monitor_gain,
+ info.blocksize,
+ info.hiwat, info.lowat,
+ (info.mode == AUMODE_PLAY) ? "PLAY"
+ : (info.mode = AUMODE_RECORD) ? "RECORD"
+ : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" : "?"));
+ /* *INDENT-ON* */
+#endif /* DEBUG_AUDIO */
+}
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+NETBSDAUDIO_WaitDevice(_THIS)
+{
+#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */
+ /* See if we need to use timed audio synchronization */
+ if (this->hidden->frame_ticks) {
+ /* Use timer for general audio synchronization */
+ Sint32 ticks;
+
+ ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
+ } else {
+ /* Use SDL_IOReady() for audio synchronization */
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Waiting for audio to get ready\n");
+#endif
+ if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, 10 * 1000)
+ <= 0) {
+ const char *message =
+ "Audio timeout - buggy audio driver? (disabled)";
+ /* In general we should never print to the screen,
+ but in this case we have no other way of letting
+ the user know what happened.
+ */
+ fprintf(stderr, "SDL: %s\n", message);
+ SDL_OpenedAudioDeviceDisconnected(this);
+ /* Don't try to close - may hang */
+ this->hidden->audio_fd = -1;
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Done disabling audio\n");
+#endif
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Ready!\n");
+#endif
+ }
+#endif /* !USE_BLOCKING_WRITES */
+}
+
+static void
+NETBSDAUDIO_PlayDevice(_THIS)
+{
+ int written, p = 0;
+
+ /* Write the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ written = write(this->hidden->audio_fd,
+ &this->hidden->mixbuf[p], this->hidden->mixlen - p);
+
+ if (written > 0)
+ p += written;
+ if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) {
+ /* Non recoverable error has occurred. It should be reported!!! */
+ perror("audio");
+ break;
+ }
+
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
+
+ if (p < this->hidden->mixlen
+ || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
+ }
+ } while (p < this->hidden->mixlen);
+
+ /* If timer synchronization is enabled, set the next write frame */
+ if (this->hidden->frame_ticks) {
+ this->hidden->next_frame += this->hidden->frame_ticks;
+ }
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+}
+
+static Uint8 *
+NETBSDAUDIO_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+
+static int
+NETBSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen)
+{
+ Uint8 *buffer = (Uint8 *) _buffer;
+ int br, p = 0;
+
+ /* Capture the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ br = read(this->hidden->audio_fd, buffer + p, buflen - p);
+ if (br > 0)
+ p += br;
+ if (br == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) {
+ /* Non recoverable error has occurred. It should be reported!!! */
+ perror("audio");
+ return p ? p : -1;
+ }
+
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Captured %d bytes of audio data\n", br);
+#endif
+
+ if (p < buflen
+ || ((br < 0) && ((errno == 0) || (errno == EAGAIN)))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
+ }
+ } while (p < buflen);
+}
+
+static void
+NETBSDAUDIO_FlushCapture(_THIS)
+{
+ audio_info_t info;
+ size_t remain;
+ Uint8 buf[512];
+
+ if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) {
+ return; /* oh well. */
+ }
+
+ remain = (size_t) (info.record.samples * (SDL_AUDIO_BITSIZE(this->spec.format) / 8));
+ while (remain > 0) {
+ const size_t len = SDL_min(sizeof (buf), remain);
+ const int br = read(this->hidden->audio_fd, buf, len);
+ if (br <= 0) {
+ return; /* oh well. */
+ }
+ remain -= br;
+ }
+}
+
+static void
+NETBSDAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static int
+NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ const int flags = iscapture ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT;
+ SDL_AudioFormat format = 0;
+ audio_info_t info;
+ audio_prinfo *prinfo = iscapture ? &info.play : &info.record;
+
+ /* We don't care what the devname is...we'll try to open anything. */
+ /* ...but default to first name in the list... */
+ if (devname == NULL) {
+ devname = SDL_GetAudioDeviceName(0, iscapture);
+ if (devname == NULL) {
+ return SDL_SetError("No such audio device");
+ }
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Open the audio device */
+ this->hidden->audio_fd = open(devname, flags, 0);
+ if (this->hidden->audio_fd < 0) {
+ return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
+ }
+
+ AUDIO_INITINFO(&info);
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Set to play mode */
+ info.mode = iscapture ? AUMODE_RECORD : AUMODE_PLAY;
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) {
+ return SDL_SetError("Couldn't put device into play mode");
+ }
+
+ AUDIO_INITINFO(&info);
+ for (format = SDL_FirstAudioFormat(this->spec.format);
+ format; format = SDL_NextAudioFormat()) {
+ switch (format) {
+ case AUDIO_U8:
+ prinfo->encoding = AUDIO_ENCODING_ULINEAR;
+ prinfo->precision = 8;
+ break;
+ case AUDIO_S8:
+ prinfo->encoding = AUDIO_ENCODING_SLINEAR;
+ prinfo->precision = 8;
+ break;
+ case AUDIO_S16LSB:
+ prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE;
+ prinfo->precision = 16;
+ break;
+ case AUDIO_S16MSB:
+ prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE;
+ prinfo->precision = 16;
+ break;
+ case AUDIO_U16LSB:
+ prinfo->encoding = AUDIO_ENCODING_ULINEAR_LE;
+ prinfo->precision = 16;
+ break;
+ case AUDIO_U16MSB:
+ prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE;
+ prinfo->precision = 16;
+ break;
+ default:
+ continue;
+ }
+
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) {
+ break;
+ }
+ }
+
+ if (!format) {
+ return SDL_SetError("No supported encoding for 0x%x", this->spec.format);
+ }
+
+ this->spec.format = format;
+
+ AUDIO_INITINFO(&info);
+ prinfo->channels = this->spec.channels;
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == -1) {
+ this->spec.channels = 1;
+ }
+ AUDIO_INITINFO(&info);
+ prinfo->sample_rate = this->spec.freq;
+ info.blocksize = this->spec.size;
+ info.hiwat = 5;
+ info.lowat = 3;
+ (void) ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info);
+ (void) ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info);
+ this->spec.freq = prinfo->sample_rate;
+
+ if (!iscapture) {
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+ }
+
+ NETBSDAUDIO_Status(this);
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static int
+NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = NETBSDAUDIO_DetectDevices;
+ impl->OpenDevice = NETBSDAUDIO_OpenDevice;
+ impl->PlayDevice = NETBSDAUDIO_PlayDevice;
+ impl->WaitDevice = NETBSDAUDIO_WaitDevice;
+ impl->GetDeviceBuf = NETBSDAUDIO_GetDeviceBuf;
+ impl->CloseDevice = NETBSDAUDIO_CloseDevice;
+ impl->CaptureFromDevice = NETBSDAUDIO_CaptureFromDevice;
+ impl->FlushCapture = NETBSDAUDIO_FlushCapture;
+
+ impl->HasCaptureSupport = SDL_TRUE;
+ impl->AllowsArbitraryDeviceNames = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap NETBSDAUDIO_bootstrap = {
+ "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_NETBSD */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.h b/src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.h
new file mode 100644
index 0000000..1c46068
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/netbsd/SDL_netbsdaudio.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_netbsdaudio_h_
+#define SDL_netbsdaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ /* Support for audio timing using a timer, in addition to SDL_IOReady() */
+ float frame_ticks;
+ float next_frame;
+};
+
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+
+#endif /* SDL_netbsdaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.c b/src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.c
new file mode 100644
index 0000000..1e8c124
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.c
@@ -0,0 +1,516 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_PAUDIO
+
+/* Allow access to a raw mixing buffer */
+
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "SDL_stdinc.h"
+#include "../SDL_audio_c.h"
+#include "../../core/unix/SDL_poll.h"
+#include "SDL_paudio.h"
+
+/* #define DEBUG_AUDIO */
+
+/* A conflict within AIX 4.3.3 <sys/> headers and probably others as well.
+ * I guess nobody ever uses audio... Shame over AIX header files. */
+#include <sys/machine.h>
+#undef BIG_ENDIAN
+#include <sys/audio.h>
+
+/* Open the audio device for playback, and don't block if busy */
+/* #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) */
+#define OPEN_FLAGS O_WRONLY
+
+/* Get the name of the audio device we use for output */
+
+#ifndef _PATH_DEV_DSP
+#define _PATH_DEV_DSP "/dev/%caud%c/%c"
+#endif
+
+static char devsettings[][3] = {
+ {'p', '0', '1'}, {'p', '0', '2'}, {'p', '0', '3'}, {'p', '0', '4'},
+ {'p', '1', '1'}, {'p', '1', '2'}, {'p', '1', '3'}, {'p', '1', '4'},
+ {'p', '2', '1'}, {'p', '2', '2'}, {'p', '2', '3'}, {'p', '2', '4'},
+ {'p', '3', '1'}, {'p', '3', '2'}, {'p', '3', '3'}, {'p', '3', '4'},
+ {'b', '0', '1'}, {'b', '0', '2'}, {'b', '0', '3'}, {'b', '0', '4'},
+ {'b', '1', '1'}, {'b', '1', '2'}, {'b', '1', '3'}, {'b', '1', '4'},
+ {'b', '2', '1'}, {'b', '2', '2'}, {'b', '2', '3'}, {'b', '2', '4'},
+ {'b', '3', '1'}, {'b', '3', '2'}, {'b', '3', '3'}, {'b', '3', '4'},
+ {'\0', '\0', '\0'}
+};
+
+static int
+OpenUserDefinedDevice(char *path, int maxlen, int flags)
+{
+ const char *audiodev;
+ int fd;
+
+ /* Figure out what our audio device is */
+ if ((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) {
+ audiodev = SDL_getenv("AUDIODEV");
+ }
+ if (audiodev == NULL) {
+ return -1;
+ }
+ fd = open(audiodev, flags, 0);
+ if (path != NULL) {
+ SDL_strlcpy(path, audiodev, maxlen);
+ path[maxlen - 1] = '\0';
+ }
+ return fd;
+}
+
+static int
+OpenAudioPath(char *path, int maxlen, int flags, int classic)
+{
+ struct stat sb;
+ int cycle = 0;
+ int fd = OpenUserDefinedDevice(path, maxlen, flags);
+
+ if (fd != -1) {
+ return fd;
+ }
+
+ /* !!! FIXME: do we really need a table here? */
+ while (devsettings[cycle][0] != '\0') {
+ char audiopath[1024];
+ SDL_snprintf(audiopath, SDL_arraysize(audiopath),
+ _PATH_DEV_DSP,
+ devsettings[cycle][0],
+ devsettings[cycle][1], devsettings[cycle][2]);
+
+ if (stat(audiopath, &sb) == 0) {
+ fd = open(audiopath, flags, 0);
+ if (fd >= 0) {
+ if (path != NULL) {
+ SDL_strlcpy(path, audiopath, maxlen);
+ }
+ return fd;
+ }
+ }
+ }
+ return -1;
+}
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+PAUDIO_WaitDevice(_THIS)
+{
+ fd_set fdset;
+
+ /* See if we need to use timed audio synchronization */
+ if (this->hidden->frame_ticks) {
+ /* Use timer for general audio synchronization */
+ Sint32 ticks;
+
+ ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
+ } else {
+ int timeoutMS;
+ audio_buffer paud_bufinfo;
+
+ if (ioctl(this->hidden->audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Couldn't get audio buffer information\n");
+#endif
+ timeoutMS = 10 * 1000;
+ } else {
+ timeoutMS = paud_bufinfo.write_buf_time;
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Waiting for write_buf_time=%d ms\n", timeoutMS);
+#endif
+ }
+
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Waiting for audio to get ready\n");
+#endif
+ if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, timeoutMS) <= 0) {
+ /*
+ * In general we should never print to the screen,
+ * but in this case we have no other way of letting
+ * the user know what happened.
+ */
+ fprintf(stderr, "SDL: %s - Audio timeout - buggy audio driver? (disabled)\n", strerror(errno));
+ SDL_OpenedAudioDeviceDisconnected(this);
+ /* Don't try to close - may hang */
+ this->hidden->audio_fd = -1;
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Done disabling audio\n");
+#endif
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Ready!\n");
+#endif
+ }
+}
+
+static void
+PAUDIO_PlayDevice(_THIS)
+{
+ int written = 0;
+ const Uint8 *mixbuf = this->hidden->mixbuf;
+ const size_t mixlen = this->hidden->mixlen;
+
+ /* Write the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ written = write(this->hidden->audio_fd, mixbuf, mixlen);
+ if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
+ }
+ } while ((written < 0) &&
+ ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
+
+ /* If timer synchronization is enabled, set the next write frame */
+ if (this->hidden->frame_ticks) {
+ this->hidden->next_frame += this->hidden->frame_ticks;
+ }
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
+}
+
+static Uint8 *
+PAUDIO_GetDeviceBuf(_THIS)
+{
+ return this->hidden->mixbuf;
+}
+
+static void
+PAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static int
+PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ const char *workaround = SDL_getenv("SDL_DSP_NOSELECT");
+ char audiodev[1024];
+ const char *err = NULL;
+ int format;
+ int bytes_per_sample;
+ SDL_AudioFormat test_format;
+ audio_init paud_init;
+ audio_buffer paud_bufinfo;
+ audio_control paud_control;
+ audio_change paud_change;
+ int fd = -1;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Open the audio device */
+ fd = OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
+ this->hidden->audio_fd = fd;
+ if (fd < 0) {
+ return SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
+ }
+
+ /*
+ * We can't set the buffer size - just ask the device for the maximum
+ * that we can have.
+ */
+ if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
+ return SDL_SetError("Couldn't get audio buffer information");
+ }
+
+ if (this->spec.channels > 1)
+ this->spec.channels = 2;
+ else
+ this->spec.channels = 1;
+
+ /*
+ * Fields in the audio_init structure:
+ *
+ * Ignored by us:
+ *
+ * paud.loadpath[LOAD_PATH]; * DSP code to load, MWave chip only?
+ * paud.slot_number; * slot number of the adapter
+ * paud.device_id; * adapter identification number
+ *
+ * Input:
+ *
+ * paud.srate; * the sampling rate in Hz
+ * paud.bits_per_sample; * 8, 16, 32, ...
+ * paud.bsize; * block size for this rate
+ * paud.mode; * ADPCM, PCM, MU_LAW, A_LAW, SOURCE_MIX
+ * paud.channels; * 1=mono, 2=stereo
+ * paud.flags; * FIXED - fixed length data
+ * * LEFT_ALIGNED, RIGHT_ALIGNED (var len only)
+ * * TWOS_COMPLEMENT - 2's complement data
+ * * SIGNED - signed? comment seems wrong in sys/audio.h
+ * * BIG_ENDIAN
+ * paud.operation; * PLAY, RECORD
+ *
+ * Output:
+ *
+ * paud.flags; * PITCH - pitch is supported
+ * * INPUT - input is supported
+ * * OUTPUT - output is supported
+ * * MONITOR - monitor is supported
+ * * VOLUME - volume is supported
+ * * VOLUME_DELAY - volume delay is supported
+ * * BALANCE - balance is supported
+ * * BALANCE_DELAY - balance delay is supported
+ * * TREBLE - treble control is supported
+ * * BASS - bass control is supported
+ * * BESTFIT_PROVIDED - best fit returned
+ * * LOAD_CODE - DSP load needed
+ * paud.rc; * NO_PLAY - DSP code can't do play requests
+ * * NO_RECORD - DSP code can't do record requests
+ * * INVALID_REQUEST - request was invalid
+ * * CONFLICT - conflict with open's flags
+ * * OVERLOADED - out of DSP MIPS or memory
+ * paud.position_resolution; * smallest increment for position
+ */
+
+ paud_init.srate = this->spec.freq;
+ paud_init.mode = PCM;
+ paud_init.operation = PLAY;
+ paud_init.channels = this->spec.channels;
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ bytes_per_sample = 1;
+ paud_init.bits_per_sample = 8;
+ paud_init.flags = TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_S8:
+ bytes_per_sample = 1;
+ paud_init.bits_per_sample = 8;
+ paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_S16LSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_S16MSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = BIG_ENDIAN | SIGNED | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_U16LSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_U16MSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = BIG_ENDIAN | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ default:
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Couldn't find any hardware audio formats\n");
+#endif
+ return SDL_SetError("Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ /*
+ * We know the buffer size and the max number of subsequent writes
+ * that can be pending. If more than one can pend, allow the application
+ * to do something like double buffering between our write buffer and
+ * the device's own buffer that we are filling with write() anyway.
+ *
+ * We calculate this->spec.samples like this because
+ * SDL_CalculateAudioSpec() will give put paud_bufinfo.write_buf_cap
+ * (or paud_bufinfo.write_buf_cap/2) into this->spec.size in return.
+ */
+ if (paud_bufinfo.request_buf_cap == 1) {
+ this->spec.samples = paud_bufinfo.write_buf_cap
+ / bytes_per_sample / this->spec.channels;
+ } else {
+ this->spec.samples = paud_bufinfo.write_buf_cap
+ / bytes_per_sample / this->spec.channels / 2;
+ }
+ paud_init.bsize = bytes_per_sample * this->spec.channels;
+
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /*
+ * The AIX paud device init can't modify the values of the audio_init
+ * structure that we pass to it. So we don't need any recalculation
+ * of this stuff and no reinit call as in linux dsp code.
+ *
+ * /dev/paud supports all of the encoding formats, so we don't need
+ * to do anything like reopening the device, either.
+ */
+ if (ioctl(fd, AUDIO_INIT, &paud_init) < 0) {
+ switch (paud_init.rc) {
+ case 1:
+ err = "Couldn't set audio format: DSP can't do play requests";
+ break;
+ case 2:
+ err = "Couldn't set audio format: DSP can't do record requests";
+ break;
+ case 4:
+ err = "Couldn't set audio format: request was invalid";
+ break;
+ case 5:
+ err = "Couldn't set audio format: conflict with open's flags";
+ break;
+ case 6:
+ err = "Couldn't set audio format: out of DSP MIPS or memory";
+ break;
+ default:
+ err = "Couldn't set audio format: not documented in sys/audio.h";
+ break;
+ }
+ }
+
+ if (err != NULL) {
+ return SDL_SetError("Paudio: %s", err);
+ }
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /*
+ * Set some paramters: full volume, first speaker that we can find.
+ * Ignore the other settings for now.
+ */
+ paud_change.input = AUDIO_IGNORE; /* the new input source */
+ paud_change.output = OUTPUT_1; /* EXTERNAL_SPEAKER,INTERNAL_SPEAKER,OUTPUT_1 */
+ paud_change.monitor = AUDIO_IGNORE; /* the new monitor state */
+ paud_change.volume = 0x7fffffff; /* volume level [0-0x7fffffff] */
+ paud_change.volume_delay = AUDIO_IGNORE; /* the new volume delay */
+ paud_change.balance = 0x3fffffff; /* the new balance */
+ paud_change.balance_delay = AUDIO_IGNORE; /* the new balance delay */
+ paud_change.treble = AUDIO_IGNORE; /* the new treble state */
+ paud_change.bass = AUDIO_IGNORE; /* the new bass state */
+ paud_change.pitch = AUDIO_IGNORE; /* the new pitch state */
+
+ paud_control.ioctl_request = AUDIO_CHANGE;
+ paud_control.request_info = (char *) &paud_change;
+ if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Can't change audio display settings\n");
+#endif
+ }
+
+ /*
+ * Tell the device to expect data. Actual start will wait for
+ * the first write() call.
+ */
+ paud_control.ioctl_request = AUDIO_START;
+ paud_control.position = 0;
+ if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Can't start audio play\n");
+#endif
+ return SDL_SetError("Can't start audio play");
+ }
+
+ /* Check to see if we need to use SDL_IOReady() workaround */
+ if (workaround != NULL) {
+ this->hidden->frame_ticks = (float) (this->spec.samples * 1000) /
+ this->spec.freq;
+ this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks;
+ }
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static int
+PAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* !!! FIXME: not right for device enum? */
+ int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
+ if (fd < 0) {
+ SDL_SetError("PAUDIO: Couldn't open audio device");
+ return 0;
+ }
+ close(fd);
+
+ /* Set the function pointers */
+ impl->OpenDevice = PAUDIO_OpenDevice;
+ impl->PlayDevice = PAUDIO_PlayDevice;
+ impl->PlayDevice = PAUDIO_WaitDevice;
+ impl->GetDeviceBuf = PAUDIO_GetDeviceBuf;
+ impl->CloseDevice = PAUDIO_CloseDevice;
+ impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap PAUDIO_bootstrap = {
+ "paud", "AIX Paudio", PAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_PAUDIO */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.h b/src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.h
new file mode 100644
index 0000000..c295ae4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/paudio/SDL_paudio.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_paudio_h_
+#define SDL_paudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ /* Support for audio timing using a timer, in addition to SDL_IOReady() */
+ float frame_ticks;
+ float next_frame;
+};
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+
+#endif /* SDL_paudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.c b/src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.c
new file mode 100644
index 0000000..3e7b8e1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.c
@@ -0,0 +1,181 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_PSP
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <malloc.h>
+
+#include "SDL_audio.h"
+#include "SDL_error.h"
+#include "SDL_timer.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_pspaudio.h"
+
+#include <pspaudio.h>
+#include <pspthreadman.h>
+
+/* The tag name used by PSP audio */
+#define PSPAUDIO_DRIVER_NAME "psp"
+
+static int
+PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ int format, mixlen, i;
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc(sizeof(*this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+ switch (this->spec.format & 0xff) {
+ case 8:
+ case 16:
+ this->spec.format = AUDIO_S16LSB;
+ break;
+ default:
+ return SDL_SetError("Unsupported audio format");
+ }
+
+ /* The sample count must be a multiple of 64. */
+ this->spec.samples = PSP_AUDIO_SAMPLE_ALIGN(this->spec.samples);
+ this->spec.freq = 44100;
+
+ /* Update the fragment size as size in bytes. */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate the mixing buffer. Its size and starting address must
+ be a multiple of 64 bytes. Our sample count is already a multiple of
+ 64, so spec->size should be a multiple of 64 as well. */
+ mixlen = this->spec.size * NUM_BUFFERS;
+ this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
+ if (this->hidden->rawbuf == NULL) {
+ return SDL_SetError("Couldn't allocate mixing buffer");
+ }
+
+ /* Setup the hardware channel. */
+ if (this->spec.channels == 1) {
+ format = PSP_AUDIO_FORMAT_MONO;
+ } else {
+ this->spec.channels = 2;
+ format = PSP_AUDIO_FORMAT_STEREO;
+ }
+ this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
+ if (this->hidden->channel < 0) {
+ free(this->hidden->rawbuf);
+ this->hidden->rawbuf = NULL;
+ return SDL_SetError("Couldn't reserve hardware channel");
+ }
+
+ memset(this->hidden->rawbuf, 0, mixlen);
+ for (i = 0; i < NUM_BUFFERS; i++) {
+ this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size];
+ }
+
+ this->hidden->next_buffer = 0;
+ return 0;
+}
+
+static void PSPAUDIO_PlayDevice(_THIS)
+{
+ Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
+
+ if (this->spec.channels == 1) {
+ sceAudioOutputBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, mixbuf);
+ } else {
+ sceAudioOutputPannedBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, mixbuf);
+ }
+
+ this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
+}
+
+/* This function waits until it is possible to write a full sound buffer */
+static void PSPAUDIO_WaitDevice(_THIS)
+{
+ /* Because we block when sending audio, there's no need for this function to do anything. */
+}
+static Uint8 *PSPAUDIO_GetDeviceBuf(_THIS)
+{
+ return this->hidden->mixbufs[this->hidden->next_buffer];
+}
+
+static void PSPAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden->channel >= 0) {
+ sceAudioChRelease(this->hidden->channel);
+ }
+ free(this->hidden->rawbuf); /* this uses memalign(), not SDL_malloc(). */
+ SDL_free(this->hidden);
+}
+
+static void PSPAUDIO_ThreadInit(_THIS)
+{
+ /* Increase the priority of this audio thread by 1 to put it
+ ahead of other SDL threads. */
+ SceUID thid;
+ SceKernelThreadInfo status;
+ thid = sceKernelGetThreadId();
+ status.size = sizeof(SceKernelThreadInfo);
+ if (sceKernelReferThreadStatus(thid, &status) == 0) {
+ sceKernelChangeThreadPriority(thid, status.currentPriority - 1);
+ }
+}
+
+
+static int
+PSPAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = PSPAUDIO_OpenDevice;
+ impl->PlayDevice = PSPAUDIO_PlayDevice;
+ impl->WaitDevice = PSPAUDIO_WaitDevice;
+ impl->GetDeviceBuf = PSPAUDIO_GetDeviceBuf;
+ impl->CloseDevice = PSPAUDIO_CloseDevice;
+ impl->ThreadInit = PSPAUDIO_ThreadInit;
+
+ /* PSP audio device */
+ impl->OnlyHasDefaultOutputDevice = 1;
+/*
+ impl->HasCaptureSupport = 1;
+
+ impl->OnlyHasDefaultCaptureDevice = 1;
+*/
+ /*
+ impl->DetectDevices = DSOUND_DetectDevices;
+ impl->Deinitialize = DSOUND_Deinitialize;
+ */
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap PSPAUDIO_bootstrap = {
+ "psp", "PSP audio driver", PSPAUDIO_Init, 0
+};
+
+ /* SDL_AUDI */
+
+#endif /* SDL_AUDIO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.h b/src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.h
new file mode 100644
index 0000000..3f0cdc1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/psp/SDL_pspaudio.h
@@ -0,0 +1,45 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_pspaudio_h_
+#define SDL_pspaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+#define NUM_BUFFERS 2
+
+struct SDL_PrivateAudioData {
+ /* The hardware output channel. */
+ int channel;
+ /* The raw allocated mixing buffer. */
+ Uint8 *rawbuf;
+ /* Individual mixing buffers. */
+ Uint8 *mixbufs[NUM_BUFFERS];
+ /* Index of the next available mixing buffer. */
+ int next_buffer;
+};
+
+#endif /* SDL_pspaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c b/src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c
new file mode 100644
index 0000000..1e98580
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -0,0 +1,782 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ The PulseAudio target for SDL 1.3 is based on the 1.3 arts target, with
+ the appropriate parts replaced with the 1.2 PulseAudio target code. This
+ was the cleanest way to move it to 1.3. The 1.2 target was written by
+ Stéphan Kochen: stephan .a.t. kochen.nl
+*/
+#include "../../SDL_internal.h"
+#include "SDL_assert.h"
+
+#if SDL_AUDIO_DRIVER_PULSEAUDIO
+
+/* Allow access to a raw mixing buffer */
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <unistd.h>
+#include <sys/types.h>
+#include <pulse/pulseaudio.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_pulseaudio.h"
+#include "SDL_loadso.h"
+#include "../../thread/SDL_systhread.h"
+
+#if (PA_API_VERSION < 12)
+/** Return non-zero if the passed state is one of the connected states */
+static SDL_INLINE int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
+ return
+ x == PA_CONTEXT_CONNECTING ||
+ x == PA_CONTEXT_AUTHORIZING ||
+ x == PA_CONTEXT_SETTING_NAME ||
+ x == PA_CONTEXT_READY;
+}
+/** Return non-zero if the passed state is one of the connected states */
+static SDL_INLINE int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
+ return
+ x == PA_STREAM_CREATING ||
+ x == PA_STREAM_READY;
+}
+#endif /* pulseaudio <= 0.9.10 */
+
+
+static const char *(*PULSEAUDIO_pa_get_library_version) (void);
+static pa_channel_map *(*PULSEAUDIO_pa_channel_map_init_auto) (
+ pa_channel_map *, unsigned, pa_channel_map_def_t);
+static const char * (*PULSEAUDIO_pa_strerror) (int);
+static pa_mainloop * (*PULSEAUDIO_pa_mainloop_new) (void);
+static pa_mainloop_api * (*PULSEAUDIO_pa_mainloop_get_api) (pa_mainloop *);
+static int (*PULSEAUDIO_pa_mainloop_iterate) (pa_mainloop *, int, int *);
+static int (*PULSEAUDIO_pa_mainloop_run) (pa_mainloop *, int *);
+static void (*PULSEAUDIO_pa_mainloop_quit) (pa_mainloop *, int);
+static void (*PULSEAUDIO_pa_mainloop_free) (pa_mainloop *);
+
+static pa_operation_state_t (*PULSEAUDIO_pa_operation_get_state) (
+ pa_operation *);
+static void (*PULSEAUDIO_pa_operation_cancel) (pa_operation *);
+static void (*PULSEAUDIO_pa_operation_unref) (pa_operation *);
+
+static pa_context * (*PULSEAUDIO_pa_context_new) (pa_mainloop_api *,
+ const char *);
+static int (*PULSEAUDIO_pa_context_connect) (pa_context *, const char *,
+ pa_context_flags_t, const pa_spawn_api *);
+static pa_operation * (*PULSEAUDIO_pa_context_get_sink_info_list) (pa_context *, pa_sink_info_cb_t, void *);
+static pa_operation * (*PULSEAUDIO_pa_context_get_source_info_list) (pa_context *, pa_source_info_cb_t, void *);
+static pa_operation * (*PULSEAUDIO_pa_context_get_sink_info_by_index) (pa_context *, uint32_t, pa_sink_info_cb_t, void *);
+static pa_operation * (*PULSEAUDIO_pa_context_get_source_info_by_index) (pa_context *, uint32_t, pa_source_info_cb_t, void *);
+static pa_context_state_t (*PULSEAUDIO_pa_context_get_state) (pa_context *);
+static pa_operation * (*PULSEAUDIO_pa_context_subscribe) (pa_context *, pa_subscription_mask_t, pa_context_success_cb_t, void *);
+static void (*PULSEAUDIO_pa_context_set_subscribe_callback) (pa_context *, pa_context_subscribe_cb_t, void *);
+static void (*PULSEAUDIO_pa_context_disconnect) (pa_context *);
+static void (*PULSEAUDIO_pa_context_unref) (pa_context *);
+
+static pa_stream * (*PULSEAUDIO_pa_stream_new) (pa_context *, const char *,
+ const pa_sample_spec *, const pa_channel_map *);
+static int (*PULSEAUDIO_pa_stream_connect_playback) (pa_stream *, const char *,
+ const pa_buffer_attr *, pa_stream_flags_t, pa_cvolume *, pa_stream *);
+static int (*PULSEAUDIO_pa_stream_connect_record) (pa_stream *, const char *,
+ const pa_buffer_attr *, pa_stream_flags_t);
+static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (pa_stream *);
+static size_t (*PULSEAUDIO_pa_stream_writable_size) (pa_stream *);
+static size_t (*PULSEAUDIO_pa_stream_readable_size) (pa_stream *);
+static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t,
+ pa_free_cb_t, int64_t, pa_seek_mode_t);
+static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *,
+ pa_stream_success_cb_t, void *);
+static int (*PULSEAUDIO_pa_stream_peek) (pa_stream *, const void **, size_t *);
+static int (*PULSEAUDIO_pa_stream_drop) (pa_stream *);
+static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *,
+ pa_stream_success_cb_t, void *);
+static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *);
+static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *);
+
+static int load_pulseaudio_syms(void);
+
+
+#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
+
+static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
+static void *pulseaudio_handle = NULL;
+
+static int
+load_pulseaudio_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(pulseaudio_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return 0;
+ }
+
+ return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_PULSEAUDIO_SYM(x) \
+ if (!load_pulseaudio_sym(#x, (void **) (char *) &PULSEAUDIO_##x)) return -1
+
+static void
+UnloadPulseAudioLibrary(void)
+{
+ if (pulseaudio_handle != NULL) {
+ SDL_UnloadObject(pulseaudio_handle);
+ pulseaudio_handle = NULL;
+ }
+}
+
+static int
+LoadPulseAudioLibrary(void)
+{
+ int retval = 0;
+ if (pulseaudio_handle == NULL) {
+ pulseaudio_handle = SDL_LoadObject(pulseaudio_library);
+ if (pulseaudio_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = load_pulseaudio_syms();
+ if (retval < 0) {
+ UnloadPulseAudioLibrary();
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+#define SDL_PULSEAUDIO_SYM(x) PULSEAUDIO_##x = x
+
+static void
+UnloadPulseAudioLibrary(void)
+{
+}
+
+static int
+LoadPulseAudioLibrary(void)
+{
+ load_pulseaudio_syms();
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
+
+
+static int
+load_pulseaudio_syms(void)
+{
+ SDL_PULSEAUDIO_SYM(pa_get_library_version);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_new);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_get_api);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_iterate);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_run);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_quit);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_free);
+ SDL_PULSEAUDIO_SYM(pa_operation_get_state);
+ SDL_PULSEAUDIO_SYM(pa_operation_cancel);
+ SDL_PULSEAUDIO_SYM(pa_operation_unref);
+ SDL_PULSEAUDIO_SYM(pa_context_new);
+ SDL_PULSEAUDIO_SYM(pa_context_connect);
+ SDL_PULSEAUDIO_SYM(pa_context_get_sink_info_list);
+ SDL_PULSEAUDIO_SYM(pa_context_get_source_info_list);
+ SDL_PULSEAUDIO_SYM(pa_context_get_sink_info_by_index);
+ SDL_PULSEAUDIO_SYM(pa_context_get_source_info_by_index);
+ SDL_PULSEAUDIO_SYM(pa_context_get_state);
+ SDL_PULSEAUDIO_SYM(pa_context_subscribe);
+ SDL_PULSEAUDIO_SYM(pa_context_set_subscribe_callback);
+ SDL_PULSEAUDIO_SYM(pa_context_disconnect);
+ SDL_PULSEAUDIO_SYM(pa_context_unref);
+ SDL_PULSEAUDIO_SYM(pa_stream_new);
+ SDL_PULSEAUDIO_SYM(pa_stream_connect_playback);
+ SDL_PULSEAUDIO_SYM(pa_stream_connect_record);
+ SDL_PULSEAUDIO_SYM(pa_stream_get_state);
+ SDL_PULSEAUDIO_SYM(pa_stream_writable_size);
+ SDL_PULSEAUDIO_SYM(pa_stream_readable_size);
+ SDL_PULSEAUDIO_SYM(pa_stream_write);
+ SDL_PULSEAUDIO_SYM(pa_stream_drain);
+ SDL_PULSEAUDIO_SYM(pa_stream_disconnect);
+ SDL_PULSEAUDIO_SYM(pa_stream_peek);
+ SDL_PULSEAUDIO_SYM(pa_stream_drop);
+ SDL_PULSEAUDIO_SYM(pa_stream_flush);
+ SDL_PULSEAUDIO_SYM(pa_stream_unref);
+ SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto);
+ SDL_PULSEAUDIO_SYM(pa_strerror);
+ return 0;
+}
+
+static SDL_INLINE int
+squashVersion(const int major, const int minor, const int patch)
+{
+ return ((major & 0xFF) << 16) | ((minor & 0xFF) << 8) | (patch & 0xFF);
+}
+
+/* Workaround for older pulse: pa_context_new() must have non-NULL appname */
+static const char *
+getAppName(void)
+{
+ const char *verstr = PULSEAUDIO_pa_get_library_version();
+ if (verstr != NULL) {
+ int maj, min, patch;
+ if (SDL_sscanf(verstr, "%d.%d.%d", &maj, &min, &patch) == 3) {
+ if (squashVersion(maj, min, patch) >= squashVersion(0, 9, 15)) {
+ return NULL; /* 0.9.15+ handles NULL correctly. */
+ }
+ }
+ }
+ return "SDL Application"; /* oh well. */
+}
+
+static void
+WaitForPulseOperation(pa_mainloop *mainloop, pa_operation *o)
+{
+ /* This checks for NO errors currently. Either fix that, check results elsewhere, or do things you don't care about. */
+ if (mainloop && o) {
+ SDL_bool okay = SDL_TRUE;
+ while (okay && (PULSEAUDIO_pa_operation_get_state(o) == PA_OPERATION_RUNNING)) {
+ okay = (PULSEAUDIO_pa_mainloop_iterate(mainloop, 1, NULL) >= 0);
+ }
+ PULSEAUDIO_pa_operation_unref(o);
+ }
+}
+
+static void
+DisconnectFromPulseServer(pa_mainloop *mainloop, pa_context *context)
+{
+ if (context) {
+ PULSEAUDIO_pa_context_disconnect(context);
+ PULSEAUDIO_pa_context_unref(context);
+ }
+ if (mainloop != NULL) {
+ PULSEAUDIO_pa_mainloop_free(mainloop);
+ }
+}
+
+static int
+ConnectToPulseServer_Internal(pa_mainloop **_mainloop, pa_context **_context)
+{
+ pa_mainloop *mainloop = NULL;
+ pa_context *context = NULL;
+ pa_mainloop_api *mainloop_api = NULL;
+ int state = 0;
+
+ *_mainloop = NULL;
+ *_context = NULL;
+
+ /* Set up a new main loop */
+ if (!(mainloop = PULSEAUDIO_pa_mainloop_new())) {
+ return SDL_SetError("pa_mainloop_new() failed");
+ }
+
+ *_mainloop = mainloop;
+
+ mainloop_api = PULSEAUDIO_pa_mainloop_get_api(mainloop);
+ SDL_assert(mainloop_api); /* this never fails, right? */
+
+ context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName());
+ if (!context) {
+ return SDL_SetError("pa_context_new() failed");
+ }
+ *_context = context;
+
+ /* Connect to the PulseAudio server */
+ if (PULSEAUDIO_pa_context_connect(context, NULL, 0, NULL) < 0) {
+ return SDL_SetError("Could not setup connection to PulseAudio");
+ }
+
+ do {
+ if (PULSEAUDIO_pa_mainloop_iterate(mainloop, 1, NULL) < 0) {
+ return SDL_SetError("pa_mainloop_iterate() failed");
+ }
+ state = PULSEAUDIO_pa_context_get_state(context);
+ if (!PA_CONTEXT_IS_GOOD(state)) {
+ return SDL_SetError("Could not connect to PulseAudio");
+ }
+ } while (state != PA_CONTEXT_READY);
+
+ return 0; /* connected and ready! */
+}
+
+static int
+ConnectToPulseServer(pa_mainloop **_mainloop, pa_context **_context)
+{
+ const int retval = ConnectToPulseServer_Internal(_mainloop, _context);
+ if (retval < 0) {
+ DisconnectFromPulseServer(*_mainloop, *_context);
+ }
+ return retval;
+}
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+PULSEAUDIO_WaitDevice(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+
+ while (SDL_AtomicGet(&this->enabled)) {
+ if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY ||
+ PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY ||
+ PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ return;
+ }
+ if (PULSEAUDIO_pa_stream_writable_size(h->stream) >= h->mixlen) {
+ return;
+ }
+ }
+}
+
+static void
+PULSEAUDIO_PlayDevice(_THIS)
+{
+ /* Write the audio data */
+ struct SDL_PrivateAudioData *h = this->hidden;
+ if (SDL_AtomicGet(&this->enabled)) {
+ if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf, h->mixlen, NULL, 0LL, PA_SEEK_RELATIVE) < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ }
+}
+
+static Uint8 *
+PULSEAUDIO_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+
+static int
+PULSEAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ const void *data = NULL;
+ size_t nbytes = 0;
+
+ while (SDL_AtomicGet(&this->enabled)) {
+ if (h->capturebuf != NULL) {
+ const int cpy = SDL_min(buflen, h->capturelen);
+ SDL_memcpy(buffer, h->capturebuf, cpy);
+ /*printf("PULSEAUDIO: fed %d captured bytes\n", cpy);*/
+ h->capturebuf += cpy;
+ h->capturelen -= cpy;
+ if (h->capturelen == 0) {
+ h->capturebuf = NULL;
+ PULSEAUDIO_pa_stream_drop(h->stream); /* done with this fragment. */
+ }
+ return cpy; /* new data, return it. */
+ }
+
+ if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY ||
+ PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY ||
+ PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ return -1; /* uhoh, pulse failed! */
+ }
+
+ if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) {
+ continue; /* no data available yet. */
+ }
+
+ /* a new fragment is available! */
+ PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes);
+ SDL_assert(nbytes > 0);
+ if (data == NULL) { /* NULL==buffer had a hole. Ignore that. */
+ PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */
+ } else {
+ /* store this fragment's data, start feeding it to SDL. */
+ /*printf("PULSEAUDIO: captured %d new bytes\n", (int) nbytes);*/
+ h->capturebuf = (const Uint8 *) data;
+ h->capturelen = nbytes;
+ }
+ }
+
+ return -1; /* not enabled? */
+}
+
+static void
+PULSEAUDIO_FlushCapture(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ const void *data = NULL;
+ size_t nbytes = 0;
+
+ if (h->capturebuf != NULL) {
+ PULSEAUDIO_pa_stream_drop(h->stream);
+ h->capturebuf = NULL;
+ h->capturelen = 0;
+ }
+
+ while (SDL_TRUE) {
+ if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY ||
+ PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY ||
+ PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ return; /* uhoh, pulse failed! */
+ }
+
+ if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) {
+ break; /* no data available, so we're done. */
+ }
+
+ /* a new fragment is available! Just dump it. */
+ PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes);
+ PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */
+ }
+}
+
+static void
+PULSEAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden->stream) {
+ if (this->hidden->capturebuf != NULL) {
+ PULSEAUDIO_pa_stream_drop(this->hidden->stream);
+ }
+ PULSEAUDIO_pa_stream_disconnect(this->hidden->stream);
+ PULSEAUDIO_pa_stream_unref(this->hidden->stream);
+ }
+
+ DisconnectFromPulseServer(this->hidden->mainloop, this->hidden->context);
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden->device_name);
+ SDL_free(this->hidden);
+}
+
+static void
+SinkDeviceNameCallback(pa_context *c, const pa_sink_info *i, int is_last, void *data)
+{
+ if (i) {
+ char **devname = (char **) data;
+ *devname = SDL_strdup(i->name);
+ }
+}
+
+static void
+SourceDeviceNameCallback(pa_context *c, const pa_source_info *i, int is_last, void *data)
+{
+ if (i) {
+ char **devname = (char **) data;
+ *devname = SDL_strdup(i->name);
+ }
+}
+
+static SDL_bool
+FindDeviceName(struct SDL_PrivateAudioData *h, const int iscapture, void *handle)
+{
+ const uint32_t idx = ((uint32_t) ((size_t) handle)) - 1;
+
+ if (handle == NULL) { /* NULL == default device. */
+ return SDL_TRUE;
+ }
+
+ if (iscapture) {
+ WaitForPulseOperation(h->mainloop,
+ PULSEAUDIO_pa_context_get_source_info_by_index(h->context, idx,
+ SourceDeviceNameCallback, &h->device_name));
+ } else {
+ WaitForPulseOperation(h->mainloop,
+ PULSEAUDIO_pa_context_get_sink_info_by_index(h->context, idx,
+ SinkDeviceNameCallback, &h->device_name));
+ }
+
+ return (h->device_name != NULL);
+}
+
+static int
+PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ struct SDL_PrivateAudioData *h = NULL;
+ Uint16 test_format = 0;
+ pa_sample_spec paspec;
+ pa_buffer_attr paattr;
+ pa_channel_map pacmap;
+ pa_stream_flags_t flags = 0;
+ int state = 0;
+ int rc = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ h = this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ paspec.format = PA_SAMPLE_INVALID;
+
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ (paspec.format == PA_SAMPLE_INVALID) && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ paspec.format = PA_SAMPLE_U8;
+ break;
+ case AUDIO_S16LSB:
+ paspec.format = PA_SAMPLE_S16LE;
+ break;
+ case AUDIO_S16MSB:
+ paspec.format = PA_SAMPLE_S16BE;
+ break;
+ case AUDIO_S32LSB:
+ paspec.format = PA_SAMPLE_S32LE;
+ break;
+ case AUDIO_S32MSB:
+ paspec.format = PA_SAMPLE_S32BE;
+ break;
+ case AUDIO_F32LSB:
+ paspec.format = PA_SAMPLE_FLOAT32LE;
+ break;
+ case AUDIO_F32MSB:
+ paspec.format = PA_SAMPLE_FLOAT32BE;
+ break;
+ default:
+ paspec.format = PA_SAMPLE_INVALID;
+ break;
+ }
+ if (paspec.format == PA_SAMPLE_INVALID) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (paspec.format == PA_SAMPLE_INVALID) {
+ return SDL_SetError("Couldn't find any hardware audio formats");
+ }
+ this->spec.format = test_format;
+
+ /* Calculate the final parameters for this audio specification */
+#ifdef PA_STREAM_ADJUST_LATENCY
+ this->spec.samples /= 2; /* Mix in smaller chunck to avoid underruns */
+#endif
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ if (!iscapture) {
+ h->mixlen = this->spec.size;
+ h->mixbuf = (Uint8 *) SDL_malloc(h->mixlen);
+ if (h->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(h->mixbuf, this->spec.silence, this->spec.size);
+ }
+
+ paspec.channels = this->spec.channels;
+ paspec.rate = this->spec.freq;
+
+ /* Reduced prebuffering compared to the defaults. */
+#ifdef PA_STREAM_ADJUST_LATENCY
+ /* 2x original requested bufsize */
+ paattr.tlength = h->mixlen * 4;
+ paattr.prebuf = -1;
+ paattr.maxlength = -1;
+ /* -1 can lead to pa_stream_writable_size() >= mixlen never being true */
+ paattr.minreq = h->mixlen;
+ flags = PA_STREAM_ADJUST_LATENCY;
+#else
+ paattr.tlength = h->mixlen*2;
+ paattr.prebuf = h->mixlen*2;
+ paattr.maxlength = h->mixlen*2;
+ paattr.minreq = h->mixlen;
+#endif
+
+ if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) {
+ return SDL_SetError("Could not connect to PulseAudio server");
+ }
+
+ if (!FindDeviceName(h, iscapture, handle)) {
+ return SDL_SetError("Requested PulseAudio sink/source missing?");
+ }
+
+ /* The SDL ALSA output hints us that we use Windows' channel mapping */
+ /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
+ PULSEAUDIO_pa_channel_map_init_auto(&pacmap, this->spec.channels,
+ PA_CHANNEL_MAP_WAVEEX);
+
+ h->stream = PULSEAUDIO_pa_stream_new(
+ h->context,
+ "Simple DirectMedia Layer", /* stream description */
+ &paspec, /* sample format spec */
+ &pacmap /* channel map */
+ );
+
+ if (h->stream == NULL) {
+ return SDL_SetError("Could not set up PulseAudio stream");
+ }
+
+ /* now that we have multi-device support, don't move a stream from
+ a device that was unplugged to something else, unless we're default. */
+ if (h->device_name != NULL) {
+ flags |= PA_STREAM_DONT_MOVE;
+ }
+
+ if (iscapture) {
+ rc = PULSEAUDIO_pa_stream_connect_record(h->stream, h->device_name, &paattr, flags);
+ } else {
+ rc = PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, NULL, NULL);
+ }
+
+ if (rc < 0) {
+ return SDL_SetError("Could not connect PulseAudio stream");
+ }
+
+ do {
+ if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ return SDL_SetError("pa_mainloop_iterate() failed");
+ }
+ state = PULSEAUDIO_pa_stream_get_state(h->stream);
+ if (!PA_STREAM_IS_GOOD(state)) {
+ return SDL_SetError("Could not connect PulseAudio stream");
+ }
+ } while (state != PA_STREAM_READY);
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static pa_mainloop *hotplug_mainloop = NULL;
+static pa_context *hotplug_context = NULL;
+static SDL_Thread *hotplug_thread = NULL;
+
+/* device handles are device index + 1, cast to void*, so we never pass a NULL. */
+
+/* This is called when PulseAudio adds an output ("sink") device. */
+static void
+SinkInfoCallback(pa_context *c, const pa_sink_info *i, int is_last, void *data)
+{
+ if (i) {
+ SDL_AddAudioDevice(SDL_FALSE, i->description, (void *) ((size_t) i->index+1));
+ }
+}
+
+/* This is called when PulseAudio adds a capture ("source") device. */
+static void
+SourceInfoCallback(pa_context *c, const pa_source_info *i, int is_last, void *data)
+{
+ if (i) {
+ /* Skip "monitor" sources. These are just output from other sinks. */
+ if (i->monitor_of_sink == PA_INVALID_INDEX) {
+ SDL_AddAudioDevice(SDL_TRUE, i->description, (void *) ((size_t) i->index+1));
+ }
+ }
+}
+
+/* This is called when PulseAudio has a device connected/removed/changed. */
+static void
+HotplugCallback(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *data)
+{
+ const SDL_bool added = ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW);
+ const SDL_bool removed = ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE);
+
+ if (added || removed) { /* we only care about add/remove events. */
+ const SDL_bool sink = ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK);
+ const SDL_bool source = ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE);
+
+ /* adds need sink details from the PulseAudio server. Another callback... */
+ if (added && sink) {
+ PULSEAUDIO_pa_context_get_sink_info_by_index(hotplug_context, idx, SinkInfoCallback, NULL);
+ } else if (added && source) {
+ PULSEAUDIO_pa_context_get_source_info_by_index(hotplug_context, idx, SourceInfoCallback, NULL);
+ } else if (removed && (sink || source)) {
+ /* removes we can handle just with the device index. */
+ SDL_RemoveAudioDevice(source != 0, (void *) ((size_t) idx+1));
+ }
+ }
+}
+
+/* this runs as a thread while the Pulse target is initialized to catch hotplug events. */
+static int SDLCALL
+HotplugThread(void *data)
+{
+ pa_operation *o;
+ SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW);
+ PULSEAUDIO_pa_context_set_subscribe_callback(hotplug_context, HotplugCallback, NULL);
+ o = PULSEAUDIO_pa_context_subscribe(hotplug_context, PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE, NULL, NULL);
+ PULSEAUDIO_pa_operation_unref(o); /* don't wait for it, just do our thing. */
+ PULSEAUDIO_pa_mainloop_run(hotplug_mainloop, NULL);
+ return 0;
+}
+
+static void
+PULSEAUDIO_DetectDevices()
+{
+ WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_sink_info_list(hotplug_context, SinkInfoCallback, NULL));
+ WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_source_info_list(hotplug_context, SourceInfoCallback, NULL));
+
+ /* ok, we have a sane list, let's set up hotplug notifications now... */
+ hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, NULL);
+}
+
+static void
+PULSEAUDIO_Deinitialize(void)
+{
+ if (hotplug_thread) {
+ PULSEAUDIO_pa_mainloop_quit(hotplug_mainloop, 0);
+ SDL_WaitThread(hotplug_thread, NULL);
+ hotplug_thread = NULL;
+ }
+
+ DisconnectFromPulseServer(hotplug_mainloop, hotplug_context);
+ hotplug_mainloop = NULL;
+ hotplug_context = NULL;
+
+ UnloadPulseAudioLibrary();
+}
+
+static int
+PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadPulseAudioLibrary() < 0) {
+ return 0;
+ }
+
+ if (ConnectToPulseServer(&hotplug_mainloop, &hotplug_context) < 0) {
+ UnloadPulseAudioLibrary();
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->DetectDevices = PULSEAUDIO_DetectDevices;
+ impl->OpenDevice = PULSEAUDIO_OpenDevice;
+ impl->PlayDevice = PULSEAUDIO_PlayDevice;
+ impl->WaitDevice = PULSEAUDIO_WaitDevice;
+ impl->GetDeviceBuf = PULSEAUDIO_GetDeviceBuf;
+ impl->CloseDevice = PULSEAUDIO_CloseDevice;
+ impl->Deinitialize = PULSEAUDIO_Deinitialize;
+ impl->CaptureFromDevice = PULSEAUDIO_CaptureFromDevice;
+ impl->FlushCapture = PULSEAUDIO_FlushCapture;
+
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap PULSEAUDIO_bootstrap = {
+ "pulseaudio", "PulseAudio", PULSEAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_PULSEAUDIO */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h b/src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h
new file mode 100644
index 0000000..61da70b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_pulseaudio_h_
+#define SDL_pulseaudio_h_
+
+#include <pulse/simple.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ char *device_name;
+
+ /* pulseaudio structures */
+ pa_mainloop *mainloop;
+ pa_context *context;
+ pa_stream *stream;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ const Uint8 *capturebuf;
+ int capturelen;
+};
+
+#endif /* SDL_pulseaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.c b/src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.c
new file mode 100644
index 0000000..957ac2d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.c
@@ -0,0 +1,666 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * !!! FIXME: streamline this a little by removing all the
+ * !!! FIXME: if (capture) {} else {} sections that are identical
+ * !!! FIXME: except for one flag.
+ */
+
+/* !!! FIXME: can this target support hotplugging? */
+/* !!! FIXME: ...does SDL2 even support QNX? */
+
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_QSA
+
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sched.h>
+#include <sys/select.h>
+#include <sys/neutrino.h>
+#include <sys/asoundlib.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../../core/unix/SDL_poll.h"
+#include "../SDL_audio_c.h"
+#include "SDL_qsa_audio.h"
+
+/* default channel communication parameters */
+#define DEFAULT_CPARAMS_RATE 44100
+#define DEFAULT_CPARAMS_VOICES 1
+
+#define DEFAULT_CPARAMS_FRAG_SIZE 4096
+#define DEFAULT_CPARAMS_FRAGS_MIN 1
+#define DEFAULT_CPARAMS_FRAGS_MAX 1
+
+/* List of found devices */
+#define QSA_MAX_DEVICES 32
+#define QSA_MAX_NAME_LENGTH 81+16 /* Hardcoded in QSA, can't be changed */
+
+typedef struct _QSA_Device
+{
+ char name[QSA_MAX_NAME_LENGTH]; /* Long audio device name for SDL */
+ int cardno;
+ int deviceno;
+} QSA_Device;
+
+QSA_Device qsa_playback_device[QSA_MAX_DEVICES];
+uint32_t qsa_playback_devices;
+
+QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
+uint32_t qsa_capture_devices;
+
+static SDL_INLINE int
+QSA_SetError(const char *fn, int status)
+{
+ return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
+}
+
+/* !!! FIXME: does this need to be here? Does the SDL version not work? */
+static void
+QSA_ThreadInit(_THIS)
+{
+ /* Increase default 10 priority to 25 to avoid jerky sound */
+ struct sched_param param;
+ if (SchedGet(0, 0, &param) != -1) {
+ param.sched_priority = param.sched_curpriority + 15;
+ SchedSet(0, 0, SCHED_NOCHANGE, &param);
+ }
+}
+
+/* PCM channel parameters initialize function */
+static void
+QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
+{
+ SDL_zerop(cpars);
+ cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
+ cpars->mode = SND_PCM_MODE_BLOCK;
+ cpars->start_mode = SND_PCM_START_DATA;
+ cpars->stop_mode = SND_PCM_STOP_STOP;
+ cpars->format.format = SND_PCM_SFMT_S16_LE;
+ cpars->format.interleave = 1;
+ cpars->format.rate = DEFAULT_CPARAMS_RATE;
+ cpars->format.voices = DEFAULT_CPARAMS_VOICES;
+ cpars->buf.block.frag_size = DEFAULT_CPARAMS_FRAG_SIZE;
+ cpars->buf.block.frags_min = DEFAULT_CPARAMS_FRAGS_MIN;
+ cpars->buf.block.frags_max = DEFAULT_CPARAMS_FRAGS_MAX;
+}
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+QSA_WaitDevice(_THIS)
+{
+ int result;
+
+ /* Setup timeout for playing one fragment equal to 2 seconds */
+ /* If timeout occured than something wrong with hardware or driver */
+ /* For example, Vortex 8820 audio driver stucks on second DAC because */
+ /* it doesn't exist ! */
+ result = SDL_IOReady(this->hidden->audio_fd, !this->hidden->iscapture, 2 * 1000);
+ switch (result) {
+ case -1:
+ SDL_SetError("QSA: SDL_IOReady() failed: %s", strerror(errno));
+ break;
+ case 0:
+ SDL_SetError("QSA: timeout on buffer waiting occured");
+ this->hidden->timeout_on_wait = 1;
+ break;
+ default:
+ this->hidden->timeout_on_wait = 0;
+ break;
+ }
+}
+
+static void
+QSA_PlayDevice(_THIS)
+{
+ snd_pcm_channel_status_t cstatus;
+ int written;
+ int status;
+ int towrite;
+ void *pcmbuffer;
+
+ if (!SDL_AtomicGet(&this->enabled) || !this->hidden) {
+ return;
+ }
+
+ towrite = this->spec.size;
+ pcmbuffer = this->hidden->pcm_buf;
+
+ /* Write the audio data, checking for EAGAIN (buffer full) and underrun */
+ do {
+ written =
+ snd_pcm_plugin_write(this->hidden->audio_handle, pcmbuffer,
+ towrite);
+ if (written != towrite) {
+ /* Check if samples playback got stuck somewhere in hardware or in */
+ /* the audio device driver */
+ if ((errno == EAGAIN) && (written == 0)) {
+ if (this->hidden->timeout_on_wait != 0) {
+ SDL_SetError("QSA: buffer playback timeout");
+ return;
+ }
+ }
+
+ /* Check for errors or conditions */
+ if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
+ /* Let a little CPU time go by and try to write again */
+ SDL_Delay(1);
+
+ /* if we wrote some data */
+ towrite -= written;
+ pcmbuffer += written * this->spec.channels;
+ continue;
+ } else {
+ if ((errno == EINVAL) || (errno == EIO)) {
+ SDL_zero(cstatus);
+ if (!this->hidden->iscapture) {
+ cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
+ } else {
+ cstatus.channel = SND_PCM_CHANNEL_CAPTURE;
+ }
+
+ status =
+ snd_pcm_plugin_status(this->hidden->audio_handle,
+ &cstatus);
+ if (status < 0) {
+ QSA_SetError("snd_pcm_plugin_status", status);
+ return;
+ }
+
+ if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) ||
+ (cstatus.status == SND_PCM_STATUS_READY)) {
+ if (!this->hidden->iscapture) {
+ status =
+ snd_pcm_plugin_prepare(this->hidden->
+ audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ status =
+ snd_pcm_plugin_prepare(this->hidden->
+ audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+ if (status < 0) {
+ QSA_SetError("snd_pcm_plugin_prepare", status);
+ return;
+ }
+ }
+ continue;
+ } else {
+ return;
+ }
+ }
+ } else {
+ /* we wrote all remaining data */
+ towrite -= written;
+ pcmbuffer += written * this->spec.channels;
+ }
+ } while ((towrite > 0) && SDL_AtomicGet(&this->enabled));
+
+ /* If we couldn't write, assume fatal error for now */
+ if (towrite != 0) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+}
+
+static Uint8 *
+QSA_GetDeviceBuf(_THIS)
+{
+ return this->hidden->pcm_buf;
+}
+
+static void
+QSA_CloseDevice(_THIS)
+{
+ if (this->hidden->audio_handle != NULL) {
+ if (!this->hidden->iscapture) {
+ /* Finish playing available samples */
+ snd_pcm_plugin_flush(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ /* Cancel unread samples during capture */
+ snd_pcm_plugin_flush(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+ snd_pcm_close(this->hidden->audio_handle);
+ }
+
+ SDL_free(this->hidden->pcm_buf);
+ SDL_free(this->hidden);
+}
+
+static int
+QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ const QSA_Device *device = (const QSA_Device *) handle;
+ int status = 0;
+ int format = 0;
+ SDL_AudioFormat test_format = 0;
+ int found = 0;
+ snd_pcm_channel_setup_t csetup;
+ snd_pcm_channel_params_t cparams;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden =
+ (struct SDL_PrivateAudioData *) SDL_calloc(1,
+ (sizeof
+ (struct
+ SDL_PrivateAudioData)));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Initialize channel transfer parameters to default */
+ QSA_InitAudioParams(&cparams);
+
+ /* Initialize channel direction: capture or playback */
+ this->hidden->iscapture = iscapture ? SDL_TRUE : SDL_FALSE;
+
+ if (device != NULL) {
+ /* Open requested audio device */
+ this->hidden->deviceno = device->deviceno;
+ this->hidden->cardno = device->cardno;
+ status = snd_pcm_open(&this->hidden->audio_handle,
+ device->cardno, device->deviceno,
+ iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
+ } else {
+ /* Open system default audio device */
+ status = snd_pcm_open_preferred(&this->hidden->audio_handle,
+ &this->hidden->cardno,
+ &this->hidden->deviceno,
+ iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK);
+ }
+
+ /* Check if requested device is opened */
+ if (status < 0) {
+ this->hidden->audio_handle = NULL;
+ return QSA_SetError("snd_pcm_open", status);
+ }
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */
+ found = 0;
+
+ for (test_format = SDL_FirstAudioFormat(this->spec.format); !found;) {
+ /* if match found set format to equivalent QSA format */
+ switch (test_format) {
+ case AUDIO_U8:
+ {
+ format = SND_PCM_SFMT_U8;
+ found = 1;
+ }
+ break;
+ case AUDIO_S8:
+ {
+ format = SND_PCM_SFMT_S8;
+ found = 1;
+ }
+ break;
+ case AUDIO_S16LSB:
+ {
+ format = SND_PCM_SFMT_S16_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_S16MSB:
+ {
+ format = SND_PCM_SFMT_S16_BE;
+ found = 1;
+ }
+ break;
+ case AUDIO_U16LSB:
+ {
+ format = SND_PCM_SFMT_U16_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_U16MSB:
+ {
+ format = SND_PCM_SFMT_U16_BE;
+ found = 1;
+ }
+ break;
+ case AUDIO_S32LSB:
+ {
+ format = SND_PCM_SFMT_S32_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_S32MSB:
+ {
+ format = SND_PCM_SFMT_S32_BE;
+ found = 1;
+ }
+ break;
+ case AUDIO_F32LSB:
+ {
+ format = SND_PCM_SFMT_FLOAT_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_F32MSB:
+ {
+ format = SND_PCM_SFMT_FLOAT_BE;
+ found = 1;
+ }
+ break;
+ default:
+ {
+ break;
+ }
+ }
+
+ if (!found) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+
+ /* assumes test_format not 0 on success */
+ if (test_format == 0) {
+ return SDL_SetError("QSA: Couldn't find any hardware audio formats");
+ }
+
+ this->spec.format = test_format;
+
+ /* Set the audio format */
+ cparams.format.format = format;
+
+ /* Set mono/stereo/4ch/6ch/8ch audio */
+ cparams.format.voices = this->spec.channels;
+
+ /* Set rate */
+ cparams.format.rate = this->spec.freq;
+
+ /* Setup the transfer parameters according to cparams */
+ status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams);
+ if (status < 0) {
+ return QSA_SetError("snd_pcm_plugin_params", status);
+ }
+
+ /* Make sure channel is setup right one last time */
+ SDL_zero(csetup);
+ if (!this->hidden->iscapture) {
+ csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
+ } else {
+ csetup.channel = SND_PCM_CHANNEL_CAPTURE;
+ }
+
+ /* Setup an audio channel */
+ if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
+ return SDL_SetError("QSA: Unable to setup channel");
+ }
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ this->hidden->pcm_len = this->spec.size;
+
+ if (this->hidden->pcm_len == 0) {
+ this->hidden->pcm_len =
+ csetup.buf.block.frag_size * this->spec.channels *
+ (snd_pcm_format_width(format) / 8);
+ }
+
+ /*
+ * Allocate memory to the audio buffer and initialize with silence
+ * (Note that buffer size must be a multiple of fragment size, so find
+ * closest multiple)
+ */
+ this->hidden->pcm_buf =
+ (Uint8 *) SDL_malloc(this->hidden->pcm_len);
+ if (this->hidden->pcm_buf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->pcm_buf, this->spec.silence,
+ this->hidden->pcm_len);
+
+ /* get the file descriptor */
+ if (!this->hidden->iscapture) {
+ this->hidden->audio_fd =
+ snd_pcm_file_descriptor(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ this->hidden->audio_fd =
+ snd_pcm_file_descriptor(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+
+ if (this->hidden->audio_fd < 0) {
+ return QSA_SetError("snd_pcm_file_descriptor", status);
+ }
+
+ /* Prepare an audio channel */
+ if (!this->hidden->iscapture) {
+ /* Prepare audio playback */
+ status =
+ snd_pcm_plugin_prepare(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ /* Prepare audio capture */
+ status =
+ snd_pcm_plugin_prepare(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+
+ if (status < 0) {
+ return QSA_SetError("snd_pcm_plugin_prepare", status);
+ }
+
+ /* We're really ready to rock and roll. :-) */
+ return 0;
+}
+
+static void
+QSA_DetectDevices(void)
+{
+ uint32_t it;
+ uint32_t cards;
+ uint32_t devices;
+ int32_t status;
+
+ /* Detect amount of available devices */
+ /* this value can be changed in the runtime */
+ cards = snd_cards();
+
+ /* If io-audio manager is not running we will get 0 as number */
+ /* of available audio devices */
+ if (cards == 0) {
+ /* We have no any available audio devices */
+ return;
+ }
+
+ /* !!! FIXME: code duplication */
+ /* Find requested devices by type */
+ { /* output devices */
+ /* Playback devices enumeration requested */
+ for (it = 0; it < cards; it++) {
+ devices = 0;
+ do {
+ status =
+ snd_card_get_longname(it,
+ qsa_playback_device
+ [qsa_playback_devices].name,
+ QSA_MAX_NAME_LENGTH);
+ if (status == EOK) {
+ snd_pcm_t *handle;
+
+ /* Add device number to device name */
+ sprintf(qsa_playback_device[qsa_playback_devices].name +
+ SDL_strlen(qsa_playback_device
+ [qsa_playback_devices].name), " d%d",
+ devices);
+
+ /* Store associated card number id */
+ qsa_playback_device[qsa_playback_devices].cardno = it;
+
+ /* Check if this device id could play anything */
+ status =
+ snd_pcm_open(&handle, it, devices,
+ SND_PCM_OPEN_PLAYBACK);
+ if (status == EOK) {
+ qsa_playback_device[qsa_playback_devices].deviceno =
+ devices;
+ status = snd_pcm_close(handle);
+ if (status == EOK) {
+ SDL_AddAudioDevice(SDL_FALSE, qsa_playback_device[qsa_playback_devices].name, &qsa_playback_device[qsa_playback_devices]);
+ qsa_playback_devices++;
+ }
+ } else {
+ /* Check if we got end of devices list */
+ if (status == -ENOENT) {
+ break;
+ }
+ }
+ } else {
+ break;
+ }
+
+ /* Check if we reached maximum devices count */
+ if (qsa_playback_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ devices++;
+ } while (1);
+
+ /* Check if we reached maximum devices count */
+ if (qsa_playback_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ }
+ }
+
+ { /* capture devices */
+ /* Capture devices enumeration requested */
+ for (it = 0; it < cards; it++) {
+ devices = 0;
+ do {
+ status =
+ snd_card_get_longname(it,
+ qsa_capture_device
+ [qsa_capture_devices].name,
+ QSA_MAX_NAME_LENGTH);
+ if (status == EOK) {
+ snd_pcm_t *handle;
+
+ /* Add device number to device name */
+ sprintf(qsa_capture_device[qsa_capture_devices].name +
+ SDL_strlen(qsa_capture_device
+ [qsa_capture_devices].name), " d%d",
+ devices);
+
+ /* Store associated card number id */
+ qsa_capture_device[qsa_capture_devices].cardno = it;
+
+ /* Check if this device id could play anything */
+ status =
+ snd_pcm_open(&handle, it, devices,
+ SND_PCM_OPEN_CAPTURE);
+ if (status == EOK) {
+ qsa_capture_device[qsa_capture_devices].deviceno =
+ devices;
+ status = snd_pcm_close(handle);
+ if (status == EOK) {
+ SDL_AddAudioDevice(SDL_TRUE, qsa_capture_device[qsa_capture_devices].name, &qsa_capture_device[qsa_capture_devices]);
+ qsa_capture_devices++;
+ }
+ } else {
+ /* Check if we got end of devices list */
+ if (status == -ENOENT) {
+ break;
+ }
+ }
+
+ /* Check if we reached maximum devices count */
+ if (qsa_capture_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ } else {
+ break;
+ }
+ devices++;
+ } while (1);
+
+ /* Check if we reached maximum devices count */
+ if (qsa_capture_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ }
+ }
+}
+
+static void
+QSA_Deinitialize(void)
+{
+ /* Clear devices array on shutdown */
+ /* !!! FIXME: we zero these on init...any reason to do it here? */
+ SDL_zero(qsa_playback_device);
+ SDL_zero(qsa_capture_device);
+ qsa_playback_devices = 0;
+ qsa_capture_devices = 0;
+}
+
+static int
+QSA_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Clear devices array */
+ SDL_zero(qsa_playback_device);
+ SDL_zero(qsa_capture_device);
+ qsa_playback_devices = 0;
+ qsa_capture_devices = 0;
+
+ /* Set function pointers */
+ /* DeviceLock and DeviceUnlock functions are used default, */
+ /* provided by SDL, which uses pthread_mutex for lock/unlock */
+ impl->DetectDevices = QSA_DetectDevices;
+ impl->OpenDevice = QSA_OpenDevice;
+ impl->ThreadInit = QSA_ThreadInit;
+ impl->WaitDevice = QSA_WaitDevice;
+ impl->PlayDevice = QSA_PlayDevice;
+ impl->GetDeviceBuf = QSA_GetDeviceBuf;
+ impl->CloseDevice = QSA_CloseDevice;
+ impl->Deinitialize = QSA_Deinitialize;
+ impl->LockDevice = NULL;
+ impl->UnlockDevice = NULL;
+
+ impl->ProvidesOwnCallbackThread = 0;
+ impl->SkipMixerLock = 0;
+ impl->HasCaptureSupport = 1;
+ impl->OnlyHasDefaultOutputDevice = 0;
+ impl->OnlyHasDefaultCaptureDevice = 0;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap QSAAUDIO_bootstrap = {
+ "qsa", "QNX QSA Audio", QSA_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_QSA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.h b/src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.h
new file mode 100644
index 0000000..a6300c1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/qsa/SDL_qsa_audio.h
@@ -0,0 +1,57 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef __SDL_QSA_AUDIO_H__
+#define __SDL_QSA_AUDIO_H__
+
+#include <sys/asoundlib.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice* this
+
+struct SDL_PrivateAudioData
+{
+ /* SDL capture state */
+ SDL_bool iscapture;
+
+ /* The audio device handle */
+ int cardno;
+ int deviceno;
+ snd_pcm_t *audio_handle;
+
+ /* The audio file descriptor */
+ int audio_fd;
+
+ /* Select timeout status */
+ uint32_t timeout_on_wait;
+
+ /* Raw mixing buffer */
+ Uint8 *pcm_buf;
+ Uint32 pcm_len;
+};
+
+#endif /* __SDL_QSA_AUDIO_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.c b/src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.c
new file mode 100644
index 0000000..4a49171
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.c
@@ -0,0 +1,382 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_SNDIO
+
+/* OpenBSD sndio target */
+
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#include <poll.h>
+#include <unistd.h>
+
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_sndioaudio.h"
+
+#ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
+#include "SDL_loadso.h"
+#endif
+
+#ifndef INFTIM
+#define INFTIM -1
+#endif
+
+#ifndef SIO_DEVANY
+#define SIO_DEVANY "default"
+#endif
+
+static struct sio_hdl * (*SNDIO_sio_open)(const char *, unsigned int, int);
+static void (*SNDIO_sio_close)(struct sio_hdl *);
+static int (*SNDIO_sio_setpar)(struct sio_hdl *, struct sio_par *);
+static int (*SNDIO_sio_getpar)(struct sio_hdl *, struct sio_par *);
+static int (*SNDIO_sio_start)(struct sio_hdl *);
+static int (*SNDIO_sio_stop)(struct sio_hdl *);
+static size_t (*SNDIO_sio_read)(struct sio_hdl *, void *, size_t);
+static size_t (*SNDIO_sio_write)(struct sio_hdl *, const void *, size_t);
+static int (*SNDIO_sio_nfds)(struct sio_hdl *);
+static int (*SNDIO_sio_pollfd)(struct sio_hdl *, struct pollfd *, int);
+static int (*SNDIO_sio_revents)(struct sio_hdl *, struct pollfd *);
+static int (*SNDIO_sio_eof)(struct sio_hdl *);
+static void (*SNDIO_sio_initpar)(struct sio_par *);
+
+#ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
+static const char *sndio_library = SDL_AUDIO_DRIVER_SNDIO_DYNAMIC;
+static void *sndio_handle = NULL;
+
+static int
+load_sndio_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(sndio_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return 0;
+ }
+
+ return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_SNDIO_SYM(x) \
+ if (!load_sndio_sym(#x, (void **) (char *) &SNDIO_##x)) return -1
+#else
+#define SDL_SNDIO_SYM(x) SNDIO_##x = x
+#endif
+
+static int
+load_sndio_syms(void)
+{
+ SDL_SNDIO_SYM(sio_open);
+ SDL_SNDIO_SYM(sio_close);
+ SDL_SNDIO_SYM(sio_setpar);
+ SDL_SNDIO_SYM(sio_getpar);
+ SDL_SNDIO_SYM(sio_start);
+ SDL_SNDIO_SYM(sio_stop);
+ SDL_SNDIO_SYM(sio_read);
+ SDL_SNDIO_SYM(sio_write);
+ SDL_SNDIO_SYM(sio_nfds);
+ SDL_SNDIO_SYM(sio_pollfd);
+ SDL_SNDIO_SYM(sio_revents);
+ SDL_SNDIO_SYM(sio_eof);
+ SDL_SNDIO_SYM(sio_initpar);
+ return 0;
+}
+
+#undef SDL_SNDIO_SYM
+
+#ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
+
+static void
+UnloadSNDIOLibrary(void)
+{
+ if (sndio_handle != NULL) {
+ SDL_UnloadObject(sndio_handle);
+ sndio_handle = NULL;
+ }
+}
+
+static int
+LoadSNDIOLibrary(void)
+{
+ int retval = 0;
+ if (sndio_handle == NULL) {
+ sndio_handle = SDL_LoadObject(sndio_library);
+ if (sndio_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = load_sndio_syms();
+ if (retval < 0) {
+ UnloadSNDIOLibrary();
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+static void
+UnloadSNDIOLibrary(void)
+{
+}
+
+static int
+LoadSNDIOLibrary(void)
+{
+ load_sndio_syms();
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */
+
+
+
+
+static void
+SNDIO_WaitDevice(_THIS)
+{
+ /* no-op; SNDIO_sio_write() blocks if necessary. */
+}
+
+static void
+SNDIO_PlayDevice(_THIS)
+{
+ const int written = SNDIO_sio_write(this->hidden->dev,
+ this->hidden->mixbuf,
+ this->hidden->mixlen);
+
+ /* If we couldn't write, assume fatal error for now */
+ if ( written == 0 ) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
+}
+
+static int
+SNDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ size_t r;
+ int revents;
+ int nfds;
+
+ /* Emulate a blocking read */
+ r = SNDIO_sio_read(this->hidden->dev, buffer, buflen);
+ while (r == 0 && !SNDIO_sio_eof(this->hidden->dev)) {
+ if ((nfds = SNDIO_sio_pollfd(this->hidden->dev, this->hidden->pfd, POLLIN)) <= 0
+ || poll(this->hidden->pfd, nfds, INFTIM) < 0) {
+ return -1;
+ }
+ revents = SNDIO_sio_revents(this->hidden->dev, this->hidden->pfd);
+ if (revents & POLLIN) {
+ r = SNDIO_sio_read(this->hidden->dev, buffer, buflen);
+ }
+ if (revents & POLLHUP) {
+ break;
+ }
+ }
+ return (int) r;
+}
+
+static void
+SNDIO_FlushCapture(_THIS)
+{
+ char buf[512];
+
+ while (SNDIO_sio_read(this->hidden->dev, buf, sizeof(buf)) != 0) {
+ /* do nothing */;
+ }
+}
+
+static Uint8 *
+SNDIO_GetDeviceBuf(_THIS)
+{
+ return this->hidden->mixbuf;
+}
+
+static void
+SNDIO_CloseDevice(_THIS)
+{
+ if ( this->hidden->pfd != NULL ) {
+ SDL_free(this->hidden->pfd);
+ }
+ if ( this->hidden->dev != NULL ) {
+ SNDIO_sio_stop(this->hidden->dev);
+ SNDIO_sio_close(this->hidden->dev);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static int
+SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ struct sio_par par;
+ int status;
+
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc(sizeof(*this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ this->hidden->mixlen = this->spec.size;
+
+ /* Capture devices must be non-blocking for SNDIO_FlushCapture */
+ if ((this->hidden->dev =
+ SNDIO_sio_open(devname != NULL ? devname : SIO_DEVANY,
+ iscapture ? SIO_REC : SIO_PLAY, iscapture)) == NULL) {
+ return SDL_SetError("sio_open() failed");
+ }
+
+ /* Allocate the pollfd array for capture devices */
+ if (iscapture && (this->hidden->pfd =
+ SDL_malloc(sizeof(struct pollfd) * SNDIO_sio_nfds(this->hidden->dev))) == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ SNDIO_sio_initpar(&par);
+
+ par.rate = this->spec.freq;
+ par.pchan = this->spec.channels;
+ par.round = this->spec.samples;
+ par.appbufsz = par.round * 2;
+
+ /* Try for a closest match on audio format */
+ status = -1;
+ while (test_format && (status < 0)) {
+ if (!SDL_AUDIO_ISFLOAT(test_format)) {
+ par.le = SDL_AUDIO_ISLITTLEENDIAN(test_format) ? 1 : 0;
+ par.sig = SDL_AUDIO_ISSIGNED(test_format) ? 1 : 0;
+ par.bits = SDL_AUDIO_BITSIZE(test_format);
+
+ if (SNDIO_sio_setpar(this->hidden->dev, &par) == 0) {
+ continue;
+ }
+ if (SNDIO_sio_getpar(this->hidden->dev, &par) == 0) {
+ return SDL_SetError("sio_getpar() failed");
+ }
+ if (par.bps != SIO_BPS(par.bits)) {
+ continue;
+ }
+ if ((par.bits == 8 * par.bps) || (par.msb)) {
+ status = 0;
+ break;
+ }
+ }
+ test_format = SDL_NextAudioFormat();
+ }
+
+ if (status < 0) {
+ return SDL_SetError("sndio: Couldn't find any hardware audio formats");
+ }
+
+ if ((par.bps == 4) && (par.sig) && (par.le))
+ this->spec.format = AUDIO_S32LSB;
+ else if ((par.bps == 4) && (par.sig) && (!par.le))
+ this->spec.format = AUDIO_S32MSB;
+ else if ((par.bps == 2) && (par.sig) && (par.le))
+ this->spec.format = AUDIO_S16LSB;
+ else if ((par.bps == 2) && (par.sig) && (!par.le))
+ this->spec.format = AUDIO_S16MSB;
+ else if ((par.bps == 2) && (!par.sig) && (par.le))
+ this->spec.format = AUDIO_U16LSB;
+ else if ((par.bps == 2) && (!par.sig) && (!par.le))
+ this->spec.format = AUDIO_U16MSB;
+ else if ((par.bps == 1) && (par.sig))
+ this->spec.format = AUDIO_S8;
+ else if ((par.bps == 1) && (!par.sig))
+ this->spec.format = AUDIO_U8;
+ else {
+ return SDL_SetError("sndio: Got unsupported hardware audio format.");
+ }
+
+ this->spec.freq = par.rate;
+ this->spec.channels = par.pchan;
+ this->spec.samples = par.round;
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
+
+ if (!SNDIO_sio_start(this->hidden->dev)) {
+ return SDL_SetError("sio_start() failed");
+ }
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+static void
+SNDIO_Deinitialize(void)
+{
+ UnloadSNDIOLibrary();
+}
+
+static int
+SNDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadSNDIOLibrary() < 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = SNDIO_OpenDevice;
+ impl->WaitDevice = SNDIO_WaitDevice;
+ impl->PlayDevice = SNDIO_PlayDevice;
+ impl->GetDeviceBuf = SNDIO_GetDeviceBuf;
+ impl->CloseDevice = SNDIO_CloseDevice;
+ impl->CaptureFromDevice = SNDIO_CaptureFromDevice;
+ impl->FlushCapture = SNDIO_FlushCapture;
+ impl->Deinitialize = SNDIO_Deinitialize;
+
+ impl->AllowsArbitraryDeviceNames = 1;
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap SNDIO_bootstrap = {
+ "sndio", "OpenBSD sndio", SNDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_SNDIO */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.h b/src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.h
new file mode 100644
index 0000000..144bbc2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/sndio/SDL_sndioaudio.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_sndioaudio_h_
+#define SDL_sndioaudio_h_
+
+#include <poll.h>
+#include <sndio.h>
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The audio device handle */
+ struct sio_hdl *dev;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+
+ /* Polling structures for non-blocking sndio devices */
+ struct pollfd *pfd;
+};
+
+#endif /* SDL_sndioaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.c b/src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.c
new file mode 100644
index 0000000..ddf94b3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.c
@@ -0,0 +1,419 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_SUNAUDIO
+
+/* Allow access to a raw mixing buffer */
+
+#include <fcntl.h>
+#include <errno.h>
+#ifdef __NETBSD__
+#include <sys/ioctl.h>
+#include <sys/audioio.h>
+#endif
+#ifdef __SVR4
+#include <sys/audioio.h>
+#else
+#include <sys/time.h>
+#include <sys/types.h>
+#endif
+#include <unistd.h>
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../../core/unix/SDL_poll.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_audiodev_c.h"
+#include "SDL_sunaudio.h"
+
+/* Open the audio device for playback, and don't block if busy */
+
+#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
+#define AUDIO_GETBUFINFO AUDIO_GETINFO
+#endif
+
+/* Audio driver functions */
+static Uint8 snd2au(int sample);
+
+/* Audio driver bootstrap functions */
+static void
+SUNAUDIO_DetectDevices(void)
+{
+ SDL_EnumUnixAudioDevices(1, (int (*)(int)) NULL);
+}
+
+#ifdef DEBUG_AUDIO
+void
+CheckUnderflow(_THIS)
+{
+#ifdef AUDIO_GETBUFINFO
+ audio_info_t info;
+ int left;
+
+ ioctl(this->hidden->audio_fd, AUDIO_GETBUFINFO, &info);
+ left = (this->hidden->written - info.play.samples);
+ if (this->hidden->written && (left == 0)) {
+ fprintf(stderr, "audio underflow!\n");
+ }
+#endif
+}
+#endif
+
+static void
+SUNAUDIO_WaitDevice(_THIS)
+{
+#ifdef AUDIO_GETBUFINFO
+#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
+ audio_info_t info;
+ Sint32 left;
+
+ ioctl(this->hidden->audio_fd, AUDIO_GETBUFINFO, &info);
+ left = (this->hidden->written - info.play.samples);
+ if (left > this->hidden->fragsize) {
+ Sint32 sleepy;
+
+ sleepy = ((left - this->hidden->fragsize) / this->hidden->frequency);
+ sleepy -= SLEEP_FUDGE;
+ if (sleepy > 0) {
+ SDL_Delay(sleepy);
+ }
+ }
+#else
+ SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, -1);
+#endif
+}
+
+static void
+SUNAUDIO_PlayDevice(_THIS)
+{
+ /* Write the audio data */
+ if (this->hidden->ulaw_only) {
+ /* Assuming that this->spec.freq >= 8000 Hz */
+ int accum, incr, pos;
+ Uint8 *aubuf;
+
+ accum = 0;
+ incr = this->spec.freq / 8;
+ aubuf = this->hidden->ulaw_buf;
+ switch (this->hidden->audio_fmt & 0xFF) {
+ case 8:
+ {
+ Uint8 *sndbuf;
+
+ sndbuf = this->hidden->mixbuf;
+ for (pos = 0; pos < this->hidden->fragsize; ++pos) {
+ *aubuf = snd2au((0x80 - *sndbuf) * 64);
+ accum += incr;
+ while (accum > 0) {
+ accum -= 1000;
+ sndbuf += 1;
+ }
+ aubuf += 1;
+ }
+ }
+ break;
+ case 16:
+ {
+ Sint16 *sndbuf;
+
+ sndbuf = (Sint16 *) this->hidden->mixbuf;
+ for (pos = 0; pos < this->hidden->fragsize; ++pos) {
+ *aubuf = snd2au(*sndbuf / 4);
+ accum += incr;
+ while (accum > 0) {
+ accum -= 1000;
+ sndbuf += 1;
+ }
+ aubuf += 1;
+ }
+ }
+ break;
+ }
+#ifdef DEBUG_AUDIO
+ CheckUnderflow(this);
+#endif
+ if (write(this->hidden->audio_fd, this->hidden->ulaw_buf,
+ this->hidden->fragsize) < 0) {
+ /* Assume fatal error, for now */
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ this->hidden->written += this->hidden->fragsize;
+ } else {
+#ifdef DEBUG_AUDIO
+ CheckUnderflow(this);
+#endif
+ if (write(this->hidden->audio_fd, this->hidden->mixbuf,
+ this->spec.size) < 0) {
+ /* Assume fatal error, for now */
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ this->hidden->written += this->hidden->fragsize;
+ }
+}
+
+static Uint8 *
+SUNAUDIO_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static void
+SUNAUDIO_CloseDevice(_THIS)
+{
+ SDL_free(this->hidden->ulaw_buf);
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ }
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static int
+SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+#ifdef AUDIO_SETINFO
+ int enc;
+#endif
+ int desired_freq = 0;
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ SDL_AudioFormat format = 0;
+ audio_info_t info;
+
+ /* We don't care what the devname is...we'll try to open anything. */
+ /* ...but default to first name in the list... */
+ if (devname == NULL) {
+ devname = SDL_GetAudioDeviceName(0, iscapture);
+ if (devname == NULL) {
+ return SDL_SetError("No such audio device");
+ }
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Open the audio device */
+ this->hidden->audio_fd = open(devname, flags, 0);
+ if (this->hidden->audio_fd < 0) {
+ return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
+ }
+
+ desired_freq = this->spec.freq;
+
+ /* Determine the audio parameters from the AudioSpec */
+ switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
+
+ case 8:
+ { /* Unsigned 8 bit audio data */
+ this->spec.format = AUDIO_U8;
+#ifdef AUDIO_SETINFO
+ enc = AUDIO_ENCODING_LINEAR8;
+#endif
+ }
+ break;
+
+ case 16:
+ { /* Signed 16 bit audio data */
+ this->spec.format = AUDIO_S16SYS;
+#ifdef AUDIO_SETINFO
+ enc = AUDIO_ENCODING_LINEAR;
+#endif
+ }
+ break;
+
+ default:
+ {
+ /* !!! FIXME: fallback to conversion on unsupported types! */
+ return SDL_SetError("Unsupported audio format");
+ }
+ }
+ this->hidden->audio_fmt = this->spec.format;
+
+ this->hidden->ulaw_only = 0; /* modern Suns do support linear audio */
+#ifdef AUDIO_SETINFO
+ for (;;) {
+ audio_info_t info;
+ AUDIO_INITINFO(&info); /* init all fields to "no change" */
+
+ /* Try to set the requested settings */
+ info.play.sample_rate = this->spec.freq;
+ info.play.channels = this->spec.channels;
+ info.play.precision = (enc == AUDIO_ENCODING_ULAW)
+ ? 8 : this->spec.format & 0xff;
+ info.play.encoding = enc;
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) {
+
+ /* Check to be sure we got what we wanted */
+ if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) {
+ return SDL_SetError("Error getting audio parameters: %s",
+ strerror(errno));
+ }
+ if (info.play.encoding == enc
+ && info.play.precision == (this->spec.format & 0xff)
+ && info.play.channels == this->spec.channels) {
+ /* Yow! All seems to be well! */
+ this->spec.freq = info.play.sample_rate;
+ break;
+ }
+ }
+
+ switch (enc) {
+ case AUDIO_ENCODING_LINEAR8:
+ /* unsigned 8bit apparently not supported here */
+ enc = AUDIO_ENCODING_LINEAR;
+ this->spec.format = AUDIO_S16SYS;
+ break; /* try again */
+
+ case AUDIO_ENCODING_LINEAR:
+ /* linear 16bit didn't work either, resort to -law */
+ enc = AUDIO_ENCODING_ULAW;
+ this->spec.channels = 1;
+ this->spec.freq = 8000;
+ this->spec.format = AUDIO_U8;
+ this->hidden->ulaw_only = 1;
+ break;
+
+ default:
+ /* oh well... */
+ return SDL_SetError("Error setting audio parameters: %s",
+ strerror(errno));
+ }
+ }
+#endif /* AUDIO_SETINFO */
+ this->hidden->written = 0;
+
+ /* We can actually convert on-the-fly to U-Law */
+ if (this->hidden->ulaw_only) {
+ this->spec.freq = desired_freq;
+ this->hidden->fragsize = (this->spec.samples * 1000) /
+ (this->spec.freq / 8);
+ this->hidden->frequency = 8;
+ this->hidden->ulaw_buf = (Uint8 *) SDL_malloc(this->hidden->fragsize);
+ if (this->hidden->ulaw_buf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ this->spec.channels = 1;
+ } else {
+ this->hidden->fragsize = this->spec.samples;
+ this->hidden->frequency = this->spec.freq / 1000;
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Audio device %s U-Law only\n",
+ this->hidden->ulaw_only ? "is" : "is not");
+ fprintf(stderr, "format=0x%x chan=%d freq=%d\n",
+ this->spec.format, this->spec.channels, this->spec.freq);
+#endif
+
+ /* Update the fragment size as size in bytes */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /* We're ready to rock and roll. :-) */
+ return 0;
+}
+
+/************************************************************************/
+/* This function (snd2au()) copyrighted: */
+/************************************************************************/
+/* Copyright 1989 by Rich Gopstein and Harris Corporation */
+/* */
+/* Permission to use, copy, modify, and distribute this software */
+/* and its documentation for any purpose and without fee is */
+/* hereby granted, provided that the above copyright notice */
+/* appears in all copies and that both that copyright notice and */
+/* this permission notice appear in supporting documentation, and */
+/* that the name of Rich Gopstein and Harris Corporation not be */
+/* used in advertising or publicity pertaining to distribution */
+/* of the software without specific, written prior permission. */
+/* Rich Gopstein and Harris Corporation make no representations */
+/* about the suitability of this software for any purpose. It */
+/* provided "as is" without express or implied warranty. */
+/************************************************************************/
+
+static Uint8
+snd2au(int sample)
+{
+
+ int mask;
+
+ if (sample < 0) {
+ sample = -sample;
+ mask = 0x7f;
+ } else {
+ mask = 0xff;
+ }
+
+ if (sample < 32) {
+ sample = 0xF0 | (15 - sample / 2);
+ } else if (sample < 96) {
+ sample = 0xE0 | (15 - (sample - 32) / 4);
+ } else if (sample < 224) {
+ sample = 0xD0 | (15 - (sample - 96) / 8);
+ } else if (sample < 480) {
+ sample = 0xC0 | (15 - (sample - 224) / 16);
+ } else if (sample < 992) {
+ sample = 0xB0 | (15 - (sample - 480) / 32);
+ } else if (sample < 2016) {
+ sample = 0xA0 | (15 - (sample - 992) / 64);
+ } else if (sample < 4064) {
+ sample = 0x90 | (15 - (sample - 2016) / 128);
+ } else if (sample < 8160) {
+ sample = 0x80 | (15 - (sample - 4064) / 256);
+ } else {
+ sample = 0x80;
+ }
+ return (mask & sample);
+}
+
+static int
+SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = SUNAUDIO_DetectDevices;
+ impl->OpenDevice = SUNAUDIO_OpenDevice;
+ impl->PlayDevice = SUNAUDIO_PlayDevice;
+ impl->WaitDevice = SUNAUDIO_WaitDevice;
+ impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf;
+ impl->CloseDevice = SUNAUDIO_CloseDevice;
+
+ impl->AllowsArbitraryDeviceNames = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap SUNAUDIO_bootstrap = {
+ "audio", "UNIX /dev/audio interface", SUNAUDIO_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_SUNAUDIO */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.h b/src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.h
new file mode 100644
index 0000000..2b7d57b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/sun/SDL_sunaudio.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_sunaudio_h_
+#define SDL_sunaudio_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
+
+ SDL_AudioFormat audio_fmt; /* The app audio format */
+ Uint8 *mixbuf; /* The app mixing buffer */
+ int ulaw_only; /* Flag -- does hardware only output U-law? */
+ Uint8 *ulaw_buf; /* The U-law mixing buffer */
+ Sint32 written; /* The number of samples written */
+ int fragsize; /* The audio fragment size in samples */
+ int frequency; /* The audio frequency in KHz */
+};
+
+#endif /* SDL_sunaudio_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.c b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.c
new file mode 100644
index 0000000..b7c8dda
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.c
@@ -0,0 +1,779 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_WASAPI
+
+#include "../../core/windows/SDL_windows.h"
+#include "SDL_audio.h"
+#include "SDL_timer.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_assert.h"
+#include "SDL_log.h"
+
+#define COBJMACROS
+#include <mmdeviceapi.h>
+#include <audioclient.h>
+
+#include "SDL_wasapi.h"
+
+/* This constant isn't available on MinGW-w64 */
+#ifndef AUDCLNT_STREAMFLAGS_RATEADJUST
+#define AUDCLNT_STREAMFLAGS_RATEADJUST 0x00100000
+#endif
+
+/* these increment as default devices change. Opened default devices pick up changes in their threads. */
+SDL_atomic_t WASAPI_DefaultPlaybackGeneration;
+SDL_atomic_t WASAPI_DefaultCaptureGeneration;
+
+/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */
+typedef struct DevIdList
+{
+ WCHAR *str;
+ struct DevIdList *next;
+} DevIdList;
+
+static DevIdList *deviceid_list = NULL;
+
+/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */
+static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,{ 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } };
+static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,{ 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } };
+static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } };
+static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } };
+
+static SDL_bool
+WStrEqual(const WCHAR *a, const WCHAR *b)
+{
+ while (*a) {
+ if (*a != *b) {
+ return SDL_FALSE;
+ }
+ a++;
+ b++;
+ }
+ return *b == 0;
+}
+
+static size_t
+WStrLen(const WCHAR *wstr)
+{
+ size_t retval = 0;
+ if (wstr) {
+ while (*(wstr++)) {
+ retval++;
+ }
+ }
+ return retval;
+}
+
+static WCHAR *
+WStrDupe(const WCHAR *wstr)
+{
+ const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR);
+ WCHAR *retval = (WCHAR *) SDL_malloc(len);
+ if (retval) {
+ SDL_memcpy(retval, wstr, len);
+ }
+ return retval;
+}
+
+
+void
+WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid)
+{
+ DevIdList *i;
+ DevIdList *next;
+ DevIdList *prev = NULL;
+ for (i = deviceid_list; i; i = next) {
+ next = i->next;
+ if (WStrEqual(i->str, devid)) {
+ if (prev) {
+ prev->next = next;
+ } else {
+ deviceid_list = next;
+ }
+ SDL_RemoveAudioDevice(iscapture, i->str);
+ SDL_free(i->str);
+ SDL_free(i);
+ }
+ prev = i;
+ }
+}
+
+void
+WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid)
+{
+ DevIdList *devidlist;
+
+ /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever).
+ In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for
+ phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be
+ available and switch automatically. (!!! FIXME...?) */
+
+ /* see if we already have this one. */
+ for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) {
+ if (WStrEqual(devidlist->str, devid)) {
+ return; /* we already have this. */
+ }
+ }
+
+ devidlist = (DevIdList *) SDL_malloc(sizeof (*devidlist));
+ if (!devidlist) {
+ return; /* oh well. */
+ }
+
+ devid = WStrDupe(devid);
+ if (!devid) {
+ SDL_free(devidlist);
+ return; /* oh well. */
+ }
+
+ devidlist->str = (WCHAR *) devid;
+ devidlist->next = deviceid_list;
+ deviceid_list = devidlist;
+
+ SDL_AddAudioDevice(iscapture, devname, (void *) devid);
+}
+
+static void
+WASAPI_DetectDevices(void)
+{
+ WASAPI_EnumerateEndpoints();
+}
+
+static int
+WASAPI_GetPendingBytes(_THIS)
+{
+ UINT32 frames = 0;
+
+ /* it's okay to fail here; we'll deal with failures in the audio thread. */
+ /* FIXME: need a lock around checking this->hidden->client */
+ if (this->hidden->client != NULL) { /* definitely activated? */
+ if (FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) {
+ return 0; /* oh well. */
+ }
+ }
+ return ((int) frames) * this->hidden->framesize;
+}
+
+static SDL_INLINE SDL_bool
+WasapiFailed(_THIS, const HRESULT err)
+{
+ if (err == S_OK) {
+ return SDL_FALSE;
+ }
+
+ if (err == AUDCLNT_E_DEVICE_INVALIDATED) {
+ this->hidden->device_lost = SDL_TRUE;
+ } else if (SDL_AtomicGet(&this->enabled)) {
+ IAudioClient_Stop(this->hidden->client);
+ SDL_OpenedAudioDeviceDisconnected(this);
+ SDL_assert(!SDL_AtomicGet(&this->enabled));
+ }
+
+ return SDL_TRUE;
+}
+
+static int
+UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec)
+{
+ /* Since WASAPI requires us to handle all audio conversion, and our
+ device format might have changed, we might have to add/remove/change
+ the audio stream that the higher level uses to convert data, so
+ SDL keeps firing the callback as if nothing happened here. */
+
+ if ( (this->callbackspec.channels == this->spec.channels) &&
+ (this->callbackspec.format == this->spec.format) &&
+ (this->callbackspec.freq == this->spec.freq) &&
+ (this->callbackspec.samples == this->spec.samples) ) {
+ /* no need to buffer/convert in an AudioStream! */
+ SDL_FreeAudioStream(this->stream);
+ this->stream = NULL;
+ } else if ( (oldspec->channels == this->spec.channels) &&
+ (oldspec->format == this->spec.format) &&
+ (oldspec->freq == this->spec.freq) ) {
+ /* The existing audio stream is okay to keep using. */
+ } else {
+ /* replace the audiostream for new format */
+ SDL_FreeAudioStream(this->stream);
+ if (this->iscapture) {
+ this->stream = SDL_NewAudioStream(this->spec.format,
+ this->spec.channels, this->spec.freq,
+ this->callbackspec.format,
+ this->callbackspec.channels,
+ this->callbackspec.freq);
+ } else {
+ this->stream = SDL_NewAudioStream(this->callbackspec.format,
+ this->callbackspec.channels,
+ this->callbackspec.freq, this->spec.format,
+ this->spec.channels, this->spec.freq);
+ }
+
+ if (!this->stream) {
+ return -1;
+ }
+ }
+
+ /* make sure our scratch buffer can cover the new device spec. */
+ if (this->spec.size > this->work_buffer_len) {
+ Uint8 *ptr = (Uint8 *) SDL_realloc(this->work_buffer, this->spec.size);
+ if (ptr == NULL) {
+ return SDL_OutOfMemory();
+ }
+ this->work_buffer = ptr;
+ this->work_buffer_len = this->spec.size;
+ }
+
+ return 0;
+}
+
+
+static void ReleaseWasapiDevice(_THIS);
+
+static SDL_bool
+RecoverWasapiDevice(_THIS)
+{
+ ReleaseWasapiDevice(this); /* dump the lost device's handles. */
+
+ if (this->hidden->default_device_generation) {
+ this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration);
+ }
+
+ /* this can fail for lots of reasons, but the most likely is we had a
+ non-default device that was disconnected, so we can't recover. Default
+ devices try to reinitialize whatever the new default is, so it's more
+ likely to carry on here, but this handles a non-default device that
+ simply had its format changed in the Windows Control Panel. */
+ if (WASAPI_ActivateDevice(this, SDL_TRUE) == -1) {
+ SDL_OpenedAudioDeviceDisconnected(this);
+ return SDL_FALSE;
+ }
+
+ this->hidden->device_lost = SDL_FALSE;
+
+ return SDL_TRUE; /* okay, carry on with new device details! */
+}
+
+static SDL_bool
+RecoverWasapiIfLost(_THIS)
+{
+ const int generation = this->hidden->default_device_generation;
+ SDL_bool lost = this->hidden->device_lost;
+
+ if (!SDL_AtomicGet(&this->enabled)) {
+ return SDL_FALSE; /* already failed. */
+ }
+
+ if (!this->hidden->client) {
+ return SDL_TRUE; /* still waiting for activation. */
+ }
+
+ if (!lost && (generation > 0)) { /* is a default device? */
+ const int newgen = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration);
+ if (generation != newgen) { /* the desired default device was changed, jump over to it. */
+ lost = SDL_TRUE;
+ }
+ }
+
+ return lost ? RecoverWasapiDevice(this) : SDL_TRUE;
+}
+
+static Uint8 *
+WASAPI_GetDeviceBuf(_THIS)
+{
+ /* get an endpoint buffer from WASAPI. */
+ BYTE *buffer = NULL;
+
+ while (RecoverWasapiIfLost(this) && this->hidden->render) {
+ if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) {
+ return (Uint8 *) buffer;
+ }
+ SDL_assert(buffer == NULL);
+ }
+
+ return (Uint8 *) buffer;
+}
+
+static void
+WASAPI_PlayDevice(_THIS)
+{
+ if (this->hidden->render != NULL) { /* definitely activated? */
+ /* WasapiFailed() will mark the device for reacquisition or removal elsewhere. */
+ WasapiFailed(this, IAudioRenderClient_ReleaseBuffer(this->hidden->render, this->spec.samples, 0));
+ }
+}
+
+static void
+WASAPI_WaitDevice(_THIS)
+{
+ while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) {
+ /*SDL_Log("WAITDEVICE");*/
+ if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) {
+ const UINT32 maxpadding = this->spec.samples;
+ UINT32 padding = 0;
+ if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) {
+ /*SDL_Log("WASAPI EVENT! padding=%u maxpadding=%u", (unsigned int)padding, (unsigned int)maxpadding);*/
+ if (padding <= maxpadding) {
+ break;
+ }
+ }
+ } else {
+ /*SDL_Log("WASAPI FAILED EVENT!");*/
+ IAudioClient_Stop(this->hidden->client);
+ SDL_OpenedAudioDeviceDisconnected(this);
+ }
+ }
+}
+
+static int
+WASAPI_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ SDL_AudioStream *stream = this->hidden->capturestream;
+ const int avail = SDL_AudioStreamAvailable(stream);
+ if (avail > 0) {
+ const int cpy = SDL_min(buflen, avail);
+ SDL_AudioStreamGet(stream, buffer, cpy);
+ return cpy;
+ }
+
+ while (RecoverWasapiIfLost(this)) {
+ HRESULT ret;
+ BYTE *ptr = NULL;
+ UINT32 frames = 0;
+ DWORD flags = 0;
+
+ /* uhoh, client isn't activated yet, just return silence. */
+ if (!this->hidden->capture) {
+ /* Delay so we run at about the speed that audio would be arriving. */
+ SDL_Delay(((this->spec.samples * 1000) / this->spec.freq));
+ SDL_memset(buffer, this->spec.silence, buflen);
+ return buflen;
+ }
+
+ ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL);
+ if (ret != AUDCLNT_S_BUFFER_EMPTY) {
+ WasapiFailed(this, ret); /* mark device lost/failed if necessary. */
+ }
+
+ if ((ret == AUDCLNT_S_BUFFER_EMPTY) || !frames) {
+ WASAPI_WaitDevice(this);
+ } else if (ret == S_OK) {
+ const int total = ((int) frames) * this->hidden->framesize;
+ const int cpy = SDL_min(buflen, total);
+ const int leftover = total - cpy;
+ const SDL_bool silent = (flags & AUDCLNT_BUFFERFLAGS_SILENT) ? SDL_TRUE : SDL_FALSE;
+
+ if (silent) {
+ SDL_memset(buffer, this->spec.silence, cpy);
+ } else {
+ SDL_memcpy(buffer, ptr, cpy);
+ }
+
+ if (leftover > 0) {
+ ptr += cpy;
+ if (silent) {
+ SDL_memset(ptr, this->spec.silence, leftover); /* I guess this is safe? */
+ }
+
+ if (SDL_AudioStreamPut(stream, ptr, leftover) == -1) {
+ return -1; /* uhoh, out of memory, etc. Kill device. :( */
+ }
+ }
+
+ ret = IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames);
+ WasapiFailed(this, ret); /* mark device lost/failed if necessary. */
+
+ return cpy;
+ }
+ }
+
+ return -1; /* unrecoverable error. */
+}
+
+static void
+WASAPI_FlushCapture(_THIS)
+{
+ BYTE *ptr = NULL;
+ UINT32 frames = 0;
+ DWORD flags = 0;
+
+ if (!this->hidden->capture) {
+ return; /* not activated yet? */
+ }
+
+ /* just read until we stop getting packets, throwing them away. */
+ while (SDL_TRUE) {
+ const HRESULT ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL);
+ if (ret == AUDCLNT_S_BUFFER_EMPTY) {
+ break; /* no more buffered data; we're done. */
+ } else if (WasapiFailed(this, ret)) {
+ break; /* failed for some other reason, abort. */
+ } else if (WasapiFailed(this, IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames))) {
+ break; /* something broke. */
+ }
+ }
+ SDL_AudioStreamClear(this->hidden->capturestream);
+}
+
+static void
+ReleaseWasapiDevice(_THIS)
+{
+ if (this->hidden->client) {
+ IAudioClient_Stop(this->hidden->client);
+ IAudioClient_SetEventHandle(this->hidden->client, NULL);
+ IAudioClient_Release(this->hidden->client);
+ this->hidden->client = NULL;
+ }
+
+ if (this->hidden->render) {
+ IAudioRenderClient_Release(this->hidden->render);
+ this->hidden->render = NULL;
+ }
+
+ if (this->hidden->capture) {
+ IAudioCaptureClient_Release(this->hidden->capture);
+ this->hidden->capture = NULL;
+ }
+
+ if (this->hidden->waveformat) {
+ CoTaskMemFree(this->hidden->waveformat);
+ this->hidden->waveformat = NULL;
+ }
+
+ if (this->hidden->capturestream) {
+ SDL_FreeAudioStream(this->hidden->capturestream);
+ this->hidden->capturestream = NULL;
+ }
+
+ if (this->hidden->activation_handler) {
+ WASAPI_PlatformDeleteActivationHandler(this->hidden->activation_handler);
+ this->hidden->activation_handler = NULL;
+ }
+
+ if (this->hidden->event) {
+ CloseHandle(this->hidden->event);
+ this->hidden->event = NULL;
+ }
+}
+
+static void
+WASAPI_CloseDevice(_THIS)
+{
+ WASAPI_UnrefDevice(this);
+}
+
+void
+WASAPI_RefDevice(_THIS)
+{
+ SDL_AtomicIncRef(&this->hidden->refcount);
+}
+
+void
+WASAPI_UnrefDevice(_THIS)
+{
+ if (!SDL_AtomicDecRef(&this->hidden->refcount)) {
+ return;
+ }
+
+ /* actual closing happens here. */
+
+ /* don't touch this->hidden->task in here; it has to be reverted from
+ our callback thread. We do that in WASAPI_ThreadDeinit().
+ (likewise for this->hidden->coinitialized). */
+ ReleaseWasapiDevice(this);
+ SDL_free(this->hidden->devid);
+ SDL_free(this->hidden);
+}
+
+/* This is called once a device is activated, possibly asynchronously. */
+int
+WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
+{
+ /* !!! FIXME: we could request an exclusive mode stream, which is lower latency;
+ !!! it will write into the kernel's audio buffer directly instead of
+ !!! shared memory that a user-mode mixer then writes to the kernel with
+ !!! everything else. Doing this means any other sound using this device will
+ !!! stop playing, including the user's MP3 player and system notification
+ !!! sounds. You'd probably need to release the device when the app isn't in
+ !!! the foreground, to be a good citizen of the system. It's doable, but it's
+ !!! more work and causes some annoyances, and I don't know what the latency
+ !!! wins actually look like. Maybe add a hint to force exclusive mode at
+ !!! some point. To be sure, defaulting to shared mode is the right thing to
+ !!! do in any case. */
+ const SDL_AudioSpec oldspec = this->spec;
+ const AUDCLNT_SHAREMODE sharemode = AUDCLNT_SHAREMODE_SHARED;
+ UINT32 bufsize = 0; /* this is in sample frames, not samples, not bytes. */
+ REFERENCE_TIME duration = 0;
+ IAudioClient *client = this->hidden->client;
+ IAudioRenderClient *render = NULL;
+ IAudioCaptureClient *capture = NULL;
+ WAVEFORMATEX *waveformat = NULL;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ SDL_AudioFormat wasapi_format = 0;
+ SDL_bool valid_format = SDL_FALSE;
+ HRESULT ret = S_OK;
+ DWORD streamflags = 0;
+
+ SDL_assert(client != NULL);
+
+#ifdef __WINRT__ /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */
+ this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
+#else
+ this->hidden->event = CreateEventW(NULL, 0, 0, NULL);
+#endif
+
+ if (this->hidden->event == NULL) {
+ return WIN_SetError("WASAPI can't create an event handle");
+ }
+
+ ret = IAudioClient_GetMixFormat(client, &waveformat);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret);
+ }
+
+ SDL_assert(waveformat != NULL);
+ this->hidden->waveformat = waveformat;
+
+ this->spec.channels = (Uint8) waveformat->nChannels;
+
+ /* Make sure we have a valid format that we can convert to whatever WASAPI wants. */
+ if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) {
+ wasapi_format = AUDIO_F32SYS;
+ } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) {
+ wasapi_format = AUDIO_S16SYS;
+ } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) {
+ wasapi_format = AUDIO_S32SYS;
+ } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
+ const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *) waveformat;
+ if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) {
+ wasapi_format = AUDIO_F32SYS;
+ } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 16)) {
+ wasapi_format = AUDIO_S16SYS;
+ } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) {
+ wasapi_format = AUDIO_S32SYS;
+ }
+ }
+
+ while ((!valid_format) && (test_format)) {
+ if (test_format == wasapi_format) {
+ this->spec.format = test_format;
+ valid_format = SDL_TRUE;
+ break;
+ }
+ test_format = SDL_NextAudioFormat();
+ }
+
+ if (!valid_format) {
+ return SDL_SetError("WASAPI: Unsupported audio format");
+ }
+
+ ret = IAudioClient_GetDevicePeriod(client, NULL, &duration);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret);
+ }
+
+ /* favor WASAPI's resampler over our own, in Win7+. */
+ if (this->spec.freq != waveformat->nSamplesPerSec) {
+ /* RATEADJUST only works with output devices in share mode, and is available in Win7 and later.*/
+ if (WIN_IsWindows7OrGreater() && !this->iscapture && (sharemode == AUDCLNT_SHAREMODE_SHARED)) {
+ streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST;
+ waveformat->nSamplesPerSec = this->spec.freq;
+ waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8);
+ }
+ else {
+ this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in. */
+ }
+ }
+
+ streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
+ ret = IAudioClient_Initialize(client, sharemode, streamflags, duration, sharemode == AUDCLNT_SHAREMODE_SHARED ? 0 : duration, waveformat, NULL);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't initialize audio client", ret);
+ }
+
+ ret = IAudioClient_SetEventHandle(client, this->hidden->event);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't set event handle", ret);
+ }
+
+ ret = IAudioClient_GetBufferSize(client, &bufsize);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't determine buffer size", ret);
+ }
+
+ this->spec.samples = (Uint16) bufsize;
+ if (!this->iscapture) {
+ this->spec.samples /= 2; /* fill half of the DMA buffer on each run. */
+ }
+
+ /* Update the fragment size as size in bytes */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ this->hidden->framesize = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels;
+
+ if (this->iscapture) {
+ this->hidden->capturestream = SDL_NewAudioStream(this->spec.format, this->spec.channels, this->spec.freq, this->spec.format, this->spec.channels, this->spec.freq);
+ if (!this->hidden->capturestream) {
+ return -1; /* already set SDL_Error */
+ }
+
+ ret = IAudioClient_GetService(client, &SDL_IID_IAudioCaptureClient, (void**) &capture);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret);
+ }
+
+ SDL_assert(capture != NULL);
+ this->hidden->capture = capture;
+ ret = IAudioClient_Start(client);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't start capture", ret);
+ }
+
+ WASAPI_FlushCapture(this); /* MSDN says you should flush capture endpoint right after startup. */
+ } else {
+ ret = IAudioClient_GetService(client, &SDL_IID_IAudioRenderClient, (void**) &render);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret);
+ }
+
+ SDL_assert(render != NULL);
+ this->hidden->render = render;
+ ret = IAudioClient_Start(client);
+ if (FAILED(ret)) {
+ return WIN_SetErrorFromHRESULT("WASAPI can't start playback", ret);
+ }
+ }
+
+ if (updatestream) {
+ if (UpdateAudioStream(this, &oldspec) == -1) {
+ return -1;
+ }
+ }
+
+ return 0; /* good to go. */
+}
+
+
+static int
+WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ LPCWSTR devid = (LPCWSTR) handle;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */
+
+ if (!devid) { /* is default device? */
+ this->hidden->default_device_generation = SDL_AtomicGet(iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration);
+ } else {
+ this->hidden->devid = WStrDupe(devid);
+ if (!this->hidden->devid) {
+ return SDL_OutOfMemory();
+ }
+ }
+
+ if (WASAPI_ActivateDevice(this, SDL_FALSE) == -1) {
+ return -1; /* already set error. */
+ }
+
+ /* Ready, but waiting for async device activation.
+ Until activation is successful, we will report silence from capture
+ devices and ignore data on playback devices.
+ Also, since we don't know the _actual_ device format until after
+ activation, we let the app have whatever it asks for. We set up
+ an SDL_AudioStream to convert, if necessary, once the activation
+ completes. */
+
+ return 0;
+}
+
+static void
+WASAPI_ThreadInit(_THIS)
+{
+ WASAPI_PlatformThreadInit(this);
+}
+
+static void
+WASAPI_ThreadDeinit(_THIS)
+{
+ WASAPI_PlatformThreadDeinit(this);
+}
+
+static void
+WASAPI_Deinitialize(void)
+{
+ DevIdList *devidlist;
+ DevIdList *next;
+
+ WASAPI_PlatformDeinit();
+
+ for (devidlist = deviceid_list; devidlist; devidlist = next) {
+ next = devidlist->next;
+ SDL_free(devidlist->str);
+ SDL_free(devidlist);
+ }
+ deviceid_list = NULL;
+}
+
+static int
+WASAPI_Init(SDL_AudioDriverImpl * impl)
+{
+ SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1);
+ SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1);
+
+ if (WASAPI_PlatformInit() == -1) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->DetectDevices = WASAPI_DetectDevices;
+ impl->ThreadInit = WASAPI_ThreadInit;
+ impl->ThreadDeinit = WASAPI_ThreadDeinit;
+ impl->BeginLoopIteration = WASAPI_BeginLoopIteration;
+ impl->OpenDevice = WASAPI_OpenDevice;
+ impl->PlayDevice = WASAPI_PlayDevice;
+ impl->WaitDevice = WASAPI_WaitDevice;
+ impl->GetPendingBytes = WASAPI_GetPendingBytes;
+ impl->GetDeviceBuf = WASAPI_GetDeviceBuf;
+ impl->CaptureFromDevice = WASAPI_CaptureFromDevice;
+ impl->FlushCapture = WASAPI_FlushCapture;
+ impl->CloseDevice = WASAPI_CloseDevice;
+ impl->Deinitialize = WASAPI_Deinitialize;
+ impl->HasCaptureSupport = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap WASAPI_bootstrap = {
+ "wasapi", "WASAPI", WASAPI_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_WASAPI */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.h b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.h
new file mode 100644
index 0000000..142c0e5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi.h
@@ -0,0 +1,85 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_wasapi_h_
+#define SDL_wasapi_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#ifdef __cplusplus
+#define _THIS SDL_AudioDevice *_this
+#else
+#define _THIS SDL_AudioDevice *this
+#endif
+
+struct SDL_PrivateAudioData
+{
+ SDL_atomic_t refcount;
+ WCHAR *devid;
+ WAVEFORMATEX *waveformat;
+ IAudioClient *client;
+ IAudioRenderClient *render;
+ IAudioCaptureClient *capture;
+ SDL_AudioStream *capturestream;
+ HANDLE event;
+ HANDLE task;
+ SDL_bool coinitialized;
+ int framesize;
+ int default_device_generation;
+ SDL_bool device_lost;
+ void *activation_handler;
+ SDL_atomic_t just_activated;
+};
+
+/* these increment as default devices change. Opened default devices pick up changes in their threads. */
+extern SDL_atomic_t WASAPI_DefaultPlaybackGeneration;
+extern SDL_atomic_t WASAPI_DefaultCaptureGeneration;
+
+/* win32 and winrt implementations call into these. */
+int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream);
+void WASAPI_RefDevice(_THIS);
+void WASAPI_UnrefDevice(_THIS);
+void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid);
+void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid);
+
+/* These are functions that are implemented differently for Windows vs WinRT. */
+int WASAPI_PlatformInit(void);
+void WASAPI_PlatformDeinit(void);
+void WASAPI_EnumerateEndpoints(void);
+int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery);
+void WASAPI_PlatformThreadInit(_THIS);
+void WASAPI_PlatformThreadDeinit(_THIS);
+void WASAPI_PlatformDeleteActivationHandler(void *handler);
+void WASAPI_BeginLoopIteration(_THIS);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_wasapi_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_win32.c b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_win32.c
new file mode 100644
index 0000000..8b55582
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_win32.c
@@ -0,0 +1,417 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+/* This is code that Windows uses to talk to WASAPI-related system APIs.
+ This is for non-WinRT desktop apps. The C++/CX implementation of these
+ functions, exclusive to WinRT, are in SDL_wasapi_winrt.cpp.
+ The code in SDL_wasapi.c is used by both standard Windows and WinRT builds
+ to deal with audio and calls into these functions. */
+
+#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__)
+
+#include "../../core/windows/SDL_windows.h"
+#include "SDL_audio.h"
+#include "SDL_timer.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_assert.h"
+#include "SDL_log.h"
+
+#define COBJMACROS
+#include <mmdeviceapi.h>
+#include <audioclient.h>
+
+#include "SDL_wasapi.h"
+
+static const ERole SDL_WASAPI_role = eConsole; /* !!! FIXME: should this be eMultimedia? Should be a hint? */
+
+/* This is global to the WASAPI target, to handle hotplug and default device lookup. */
+static IMMDeviceEnumerator *enumerator = NULL;
+
+/* PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. */
+#ifdef PropVariantInit
+#undef PropVariantInit
+#endif
+#define PropVariantInit(p) SDL_zerop(p)
+
+/* handle to Avrt.dll--Vista and later!--for flagging the callback thread as "Pro Audio" (low latency). */
+static HMODULE libavrt = NULL;
+typedef HANDLE(WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPWSTR, LPDWORD);
+typedef BOOL(WINAPI *pfnAvRevertMmThreadCharacteristics)(HANDLE);
+static pfnAvSetMmThreadCharacteristicsW pAvSetMmThreadCharacteristicsW = NULL;
+static pfnAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL;
+
+/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */
+static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } };
+static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } };
+static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } };
+static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } };
+static const IID SDL_IID_IAudioClient = { 0x1cb9ad4c, 0xdbfa, 0x4c32,{ 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2 } };
+static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 };
+
+
+static char *
+GetWasapiDeviceName(IMMDevice *device)
+{
+ /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be
+ "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in
+ its own UIs, like Volume Control, etc. */
+ char *utf8dev = NULL;
+ IPropertyStore *props = NULL;
+ if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) {
+ PROPVARIANT var;
+ PropVariantInit(&var);
+ if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) {
+ utf8dev = WIN_StringToUTF8(var.pwszVal);
+ }
+ PropVariantClear(&var);
+ IPropertyStore_Release(props);
+ }
+ return utf8dev;
+}
+
+
+/* We need a COM subclass of IMMNotificationClient for hotplug support, which is
+ easy in C++, but we have to tapdance more to make work in C.
+ Thanks to this page for coaching on how to make this work:
+ https://www.codeproject.com/Articles/13601/COM-in-plain-C */
+
+typedef struct SDLMMNotificationClient
+{
+ const IMMNotificationClientVtbl *lpVtbl;
+ SDL_atomic_t refcount;
+} SDLMMNotificationClient;
+
+static HRESULT STDMETHODCALLTYPE
+SDLMMNotificationClient_QueryInterface(IMMNotificationClient *this, REFIID iid, void **ppv)
+{
+ if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient)))
+ {
+ *ppv = this;
+ this->lpVtbl->AddRef(this);
+ return S_OK;
+ }
+
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE
+SDLMMNotificationClient_AddRef(IMMNotificationClient *ithis)
+{
+ SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis;
+ return (ULONG) (SDL_AtomicIncRef(&this->refcount) + 1);
+}
+
+static ULONG STDMETHODCALLTYPE
+SDLMMNotificationClient_Release(IMMNotificationClient *ithis)
+{
+ /* this is a static object; we don't ever free it. */
+ SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis;
+ const ULONG retval = SDL_AtomicDecRef(&this->refcount);
+ if (retval == 0) {
+ SDL_AtomicSet(&this->refcount, 0); /* uhh... */
+ return 0;
+ }
+ return retval - 1;
+}
+
+/* These are the entry points called when WASAPI device endpoints change. */
+static HRESULT STDMETHODCALLTYPE
+SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *ithis, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId)
+{
+ if (role != SDL_WASAPI_role) {
+ return S_OK; /* ignore it. */
+ }
+
+ /* Increment the "generation," so opened devices will pick this up in their threads. */
+ switch (flow) {
+ case eRender:
+ SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1);
+ break;
+
+ case eCapture:
+ SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1);
+ break;
+
+ case eAll:
+ SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1);
+ SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1);
+ break;
+
+ default:
+ SDL_assert(!"uhoh, unexpected OnDefaultDeviceChange flow!");
+ break;
+ }
+
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE
+SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId)
+{
+ /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in
+ OnDeviceStateChange, making that a better place to deal with device adds. More
+ importantly: the first time you plug in a USB audio device, this callback will
+ fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT).
+ Plugging it back in won't fire this callback again. */
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE
+SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId)
+{
+ /* See notes in OnDeviceAdded handler about why we ignore this. */
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE
+SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId, DWORD dwNewState)
+{
+ IMMDevice *device = NULL;
+
+ if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) {
+ IMMEndpoint *endpoint = NULL;
+ if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **) &endpoint))) {
+ EDataFlow flow;
+ if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) {
+ const SDL_bool iscapture = (flow == eCapture);
+ if (dwNewState == DEVICE_STATE_ACTIVE) {
+ char *utf8dev = GetWasapiDeviceName(device);
+ if (utf8dev) {
+ WASAPI_AddDevice(iscapture, utf8dev, pwstrDeviceId);
+ SDL_free(utf8dev);
+ }
+ } else {
+ WASAPI_RemoveDevice(iscapture, pwstrDeviceId);
+ }
+ }
+ IMMEndpoint_Release(endpoint);
+ }
+ IMMDevice_Release(device);
+ }
+
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE
+SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *this, LPCWSTR pwstrDeviceId, const PROPERTYKEY key)
+{
+ return S_OK; /* we don't care about these. */
+}
+
+static const IMMNotificationClientVtbl notification_client_vtbl = {
+ SDLMMNotificationClient_QueryInterface,
+ SDLMMNotificationClient_AddRef,
+ SDLMMNotificationClient_Release,
+ SDLMMNotificationClient_OnDeviceStateChanged,
+ SDLMMNotificationClient_OnDeviceAdded,
+ SDLMMNotificationClient_OnDeviceRemoved,
+ SDLMMNotificationClient_OnDefaultDeviceChanged,
+ SDLMMNotificationClient_OnPropertyValueChanged
+};
+
+static SDLMMNotificationClient notification_client = { &notification_client_vtbl, { 1 } };
+
+
+int
+WASAPI_PlatformInit(void)
+{
+ HRESULT ret;
+
+ /* just skip the discussion with COM here. */
+ if (!WIN_IsWindowsVistaOrGreater()) {
+ return SDL_SetError("WASAPI support requires Windows Vista or later");
+ }
+
+ if (FAILED(WIN_CoInitialize())) {
+ return SDL_SetError("WASAPI: CoInitialize() failed");
+ }
+
+ ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID) &enumerator);
+ if (FAILED(ret)) {
+ WIN_CoUninitialize();
+ return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret);
+ }
+
+ libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */
+ if (libavrt) {
+ pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
+ pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
+ }
+
+ return 0;
+}
+
+void
+WASAPI_PlatformDeinit(void)
+{
+ if (enumerator) {
+ IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) &notification_client);
+ IMMDeviceEnumerator_Release(enumerator);
+ enumerator = NULL;
+ }
+
+ if (libavrt) {
+ FreeLibrary(libavrt);
+ libavrt = NULL;
+ }
+
+ pAvSetMmThreadCharacteristicsW = NULL;
+ pAvRevertMmThreadCharacteristics = NULL;
+
+ WIN_CoUninitialize();
+}
+
+void
+WASAPI_PlatformThreadInit(_THIS)
+{
+ /* this thread uses COM. */
+ if (SUCCEEDED(WIN_CoInitialize())) { /* can't report errors, hope it worked! */
+ this->hidden->coinitialized = SDL_TRUE;
+ }
+
+ /* Set this thread to very high "Pro Audio" priority. */
+ if (pAvSetMmThreadCharacteristicsW) {
+ DWORD idx = 0;
+ this->hidden->task = pAvSetMmThreadCharacteristicsW(TEXT("Pro Audio"), &idx);
+ }
+}
+
+void
+WASAPI_PlatformThreadDeinit(_THIS)
+{
+ /* Set this thread back to normal priority. */
+ if (this->hidden->task && pAvRevertMmThreadCharacteristics) {
+ pAvRevertMmThreadCharacteristics(this->hidden->task);
+ this->hidden->task = NULL;
+ }
+
+ if (this->hidden->coinitialized) {
+ WIN_CoUninitialize();
+ this->hidden->coinitialized = SDL_FALSE;
+ }
+}
+
+int
+WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery)
+{
+ LPCWSTR devid = this->hidden->devid;
+ IMMDevice *device = NULL;
+ HRESULT ret;
+
+ if (devid == NULL) {
+ const EDataFlow dataflow = this->iscapture ? eCapture : eRender;
+ ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_WASAPI_role, &device);
+ } else {
+ ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, &device);
+ }
+
+ if (FAILED(ret)) {
+ SDL_assert(device == NULL);
+ this->hidden->client = NULL;
+ return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret);
+ }
+
+ /* this is not async in standard win32, yay! */
+ ret = IMMDevice_Activate(device, &SDL_IID_IAudioClient, CLSCTX_ALL, NULL, (void **) &this->hidden->client);
+ IMMDevice_Release(device);
+
+ if (FAILED(ret)) {
+ SDL_assert(this->hidden->client == NULL);
+ return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret);
+ }
+
+ SDL_assert(this->hidden->client != NULL);
+ if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */
+ return -1;
+ }
+
+ return 0; /* good to go. */
+}
+
+
+static void
+WASAPI_EnumerateEndpointsForFlow(const SDL_bool iscapture)
+{
+ IMMDeviceCollection *collection = NULL;
+ UINT i, total;
+
+ /* Note that WASAPI separates "adapter devices" from "audio endpoint devices"
+ ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */
+
+ if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, iscapture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) {
+ return;
+ }
+
+ if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) {
+ IMMDeviceCollection_Release(collection);
+ return;
+ }
+
+ for (i = 0; i < total; i++) {
+ IMMDevice *device = NULL;
+ if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &device))) {
+ LPWSTR devid = NULL;
+ if (SUCCEEDED(IMMDevice_GetId(device, &devid))) {
+ char *devname = GetWasapiDeviceName(device);
+ if (devname) {
+ WASAPI_AddDevice(iscapture, devname, devid);
+ SDL_free(devname);
+ }
+ CoTaskMemFree(devid);
+ }
+ IMMDevice_Release(device);
+ }
+ }
+
+ IMMDeviceCollection_Release(collection);
+}
+
+void
+WASAPI_EnumerateEndpoints(void)
+{
+ WASAPI_EnumerateEndpointsForFlow(SDL_FALSE); /* playback */
+ WASAPI_EnumerateEndpointsForFlow(SDL_TRUE); /* capture */
+
+ /* if this fails, we just won't get hotplug events. Carry on anyhow. */
+ IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) &notification_client);
+}
+
+void
+WASAPI_PlatformDeleteActivationHandler(void *handler)
+{
+ /* not asynchronous. */
+ SDL_assert(!"This function should have only been called on WinRT.");
+}
+
+void
+WASAPI_BeginLoopIteration(_THIS)
+{
+ /* no-op. */
+}
+
+#endif /* SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp
new file mode 100644
index 0000000..309ec6a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp
@@ -0,0 +1,276 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+// This is C++/CX code that the WinRT port uses to talk to WASAPI-related
+// system APIs. The C implementation of these functions, for non-WinRT apps,
+// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard
+// Windows and WinRT builds to deal with audio and calls into these functions.
+
+#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__)
+
+#include <Windows.h>
+#include <windows.ui.core.h>
+#include <windows.devices.enumeration.h>
+#include <windows.media.devices.h>
+#include <wrl/implements.h>
+
+extern "C" {
+#include "../../core/windows/SDL_windows.h"
+#include "SDL_audio.h"
+#include "SDL_timer.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_assert.h"
+#include "SDL_log.h"
+}
+
+#define COBJMACROS
+#include <mmdeviceapi.h>
+#include <audioclient.h>
+
+#include "SDL_wasapi.h"
+
+using namespace Windows::Devices::Enumeration;
+using namespace Windows::Media::Devices;
+using namespace Windows::Foundation;
+using namespace Microsoft::WRL;
+
+class SDL_WasapiDeviceEventHandler
+{
+public:
+ SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture);
+ ~SDL_WasapiDeviceEventHandler();
+ void OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ args);
+ void OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ args);
+ void OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args);
+ void OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args);
+ void OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args);
+
+private:
+ const SDL_bool iscapture;
+ DeviceWatcher^ watcher;
+ Windows::Foundation::EventRegistrationToken added_handler;
+ Windows::Foundation::EventRegistrationToken removed_handler;
+ Windows::Foundation::EventRegistrationToken updated_handler;
+ Windows::Foundation::EventRegistrationToken default_changed_handler;
+};
+
+SDL_WasapiDeviceEventHandler::SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture)
+ : iscapture(_iscapture)
+ , watcher(DeviceInformation::CreateWatcher(_iscapture ? DeviceClass::AudioCapture : DeviceClass::AudioRender))
+{
+ if (!watcher)
+ return; // uhoh.
+
+ // !!! FIXME: this doesn't need a lambda here, I think, if I make SDL_WasapiDeviceEventHandler a proper C++/CX class. --ryan.
+ added_handler = watcher->Added += ref new TypedEventHandler<DeviceWatcher^, DeviceInformation^>([this](DeviceWatcher^ sender, DeviceInformation^ args) { OnDeviceAdded(sender, args); } );
+ removed_handler = watcher->Removed += ref new TypedEventHandler<DeviceWatcher^, DeviceInformationUpdate^>([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceRemoved(sender, args); } );
+ updated_handler = watcher->Updated += ref new TypedEventHandler<DeviceWatcher^, DeviceInformationUpdate^>([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceUpdated(sender, args); } );
+ if (iscapture) {
+ default_changed_handler = MediaDevice::DefaultAudioCaptureDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioCaptureDeviceChangedEventArgs^>([this](Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { OnDefaultCaptureDeviceChanged(sender, args); } );
+ } else {
+ default_changed_handler = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioRenderDeviceChangedEventArgs^>([this](Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { OnDefaultRenderDeviceChanged(sender, args); } );
+ }
+ watcher->Start();
+}
+
+SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler()
+{
+ if (watcher) {
+ watcher->Added -= added_handler;
+ watcher->Removed -= removed_handler;
+ watcher->Updated -= updated_handler;
+ watcher->Stop();
+ watcher = nullptr;
+ }
+
+ if (iscapture) {
+ MediaDevice::DefaultAudioCaptureDeviceChanged -= default_changed_handler;
+ } else {
+ MediaDevice::DefaultAudioRenderDeviceChanged -= default_changed_handler;
+ }
+}
+
+void
+SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ info)
+{
+ SDL_assert(sender == this->watcher);
+ char *utf8dev = WIN_StringToUTF8(info->Name->Data());
+ if (utf8dev) {
+ WASAPI_AddDevice(this->iscapture, utf8dev, info->Id->Data());
+ SDL_free(utf8dev);
+ }
+}
+
+void
+SDL_WasapiDeviceEventHandler::OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ info)
+{
+ SDL_assert(sender == this->watcher);
+ WASAPI_RemoveDevice(this->iscapture, info->Id->Data());
+}
+
+void
+SDL_WasapiDeviceEventHandler::OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args)
+{
+ SDL_assert(sender == this->watcher);
+}
+
+void
+SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args)
+{
+ SDL_assert(this->iscapture);
+ SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1);
+}
+
+void
+SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args)
+{
+ SDL_assert(!this->iscapture);
+ SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1);
+}
+
+
+static SDL_WasapiDeviceEventHandler *playback_device_event_handler;
+static SDL_WasapiDeviceEventHandler *capture_device_event_handler;
+
+int WASAPI_PlatformInit(void)
+{
+ return 0;
+}
+
+void WASAPI_PlatformDeinit(void)
+{
+ delete playback_device_event_handler;
+ playback_device_event_handler = nullptr;
+ delete capture_device_event_handler;
+ capture_device_event_handler = nullptr;
+}
+
+void WASAPI_EnumerateEndpoints(void)
+{
+ // DeviceWatchers will fire an Added event for each existing device at
+ // startup, so we don't need to enumerate them separately before
+ // listening for updates.
+ playback_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_FALSE);
+ capture_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_TRUE);
+}
+
+struct SDL_WasapiActivationHandler : public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler >
+{
+ SDL_WasapiActivationHandler() : device(nullptr) {}
+ STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation);
+ SDL_AudioDevice *device;
+};
+
+HRESULT
+SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async)
+{
+ HRESULT result = S_OK;
+ IUnknown *iunknown = nullptr;
+ const HRESULT ret = async->GetActivateResult(&result, &iunknown);
+
+ if (SUCCEEDED(ret) && SUCCEEDED(result)) {
+ iunknown->QueryInterface(IID_PPV_ARGS(&device->hidden->client));
+ if (device->hidden->client) {
+ // Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races.
+ SDL_AtomicSet(&device->hidden->just_activated, 1);
+ }
+ }
+
+ WASAPI_UnrefDevice(device);
+
+ return S_OK;
+}
+
+void
+WASAPI_PlatformDeleteActivationHandler(void *handler)
+{
+ ((SDL_WasapiActivationHandler *) handler)->Release();
+}
+
+int
+WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery)
+{
+ LPCWSTR devid = _this->hidden->devid;
+ Platform::String^ defdevid;
+
+ if (devid == nullptr) {
+ defdevid = _this->iscapture ? MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Default) : MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default);
+ if (defdevid) {
+ devid = defdevid->Data();
+ }
+ }
+
+ SDL_AtomicSet(&_this->hidden->just_activated, 0);
+
+ ComPtr<SDL_WasapiActivationHandler> handler = Make<SDL_WasapiActivationHandler>();
+ if (handler == nullptr) {
+ return SDL_SetError("Failed to allocate WASAPI activation handler");
+ }
+
+ handler.Get()->AddRef(); // we hold a reference after ComPtr destructs on return, causing a Release, and Release ourselves in WASAPI_PlatformDeleteActivationHandler(), etc.
+ handler.Get()->device = _this;
+ _this->hidden->activation_handler = handler.Get();
+
+ WASAPI_RefDevice(_this); /* completion handler will unref it. */
+ IActivateAudioInterfaceAsyncOperation *async = nullptr;
+ const HRESULT ret = ActivateAudioInterfaceAsync(devid, __uuidof(IAudioClient), nullptr, handler.Get(), &async);
+
+ if (async != nullptr) {
+ async->Release();
+ }
+
+ if (FAILED(ret)) {
+ handler.Get()->Release();
+ WASAPI_UnrefDevice(_this);
+ return WIN_SetErrorFromHRESULT("WASAPI can't activate requested audio endpoint", ret);
+ }
+
+ return 0;
+}
+
+void
+WASAPI_BeginLoopIteration(_THIS)
+{
+ if (SDL_AtomicCAS(&_this->hidden->just_activated, 1, 0)) {
+ if (WASAPI_PrepDevice(_this, SDL_TRUE) == -1) {
+ SDL_OpenedAudioDeviceDisconnected(_this);
+ }
+ }
+}
+
+void
+WASAPI_PlatformThreadInit(_THIS)
+{
+ // !!! FIXME: set this thread to "Pro Audio" priority.
+}
+
+void
+WASAPI_PlatformThreadDeinit(_THIS)
+{
+ // !!! FIXME: set this thread to "Pro Audio" priority.
+}
+
+#endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__)
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.c b/src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.c
new file mode 100644
index 0000000..8e5c17b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.c
@@ -0,0 +1,457 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_AUDIO_DRIVER_WINMM
+
+/* Allow access to a raw mixing buffer */
+
+#include "../../core/windows/SDL_windows.h"
+#include <mmsystem.h>
+
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "SDL_winmm.h"
+
+/* MinGW32 mmsystem.h doesn't include these structures */
+#if defined(__MINGW32__) && defined(_MMSYSTEM_H)
+
+typedef struct tagWAVEINCAPS2W
+{
+ WORD wMid;
+ WORD wPid;
+ MMVERSION vDriverVersion;
+ WCHAR szPname[MAXPNAMELEN];
+ DWORD dwFormats;
+ WORD wChannels;
+ WORD wReserved1;
+ GUID ManufacturerGuid;
+ GUID ProductGuid;
+ GUID NameGuid;
+} WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W;
+
+typedef struct tagWAVEOUTCAPS2W
+{
+ WORD wMid;
+ WORD wPid;
+ MMVERSION vDriverVersion;
+ WCHAR szPname[MAXPNAMELEN];
+ DWORD dwFormats;
+ WORD wChannels;
+ WORD wReserved1;
+ DWORD dwSupport;
+ GUID ManufacturerGuid;
+ GUID ProductGuid;
+ GUID NameGuid;
+} WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W;
+
+#endif /* defined(__MINGW32__) && defined(_MMSYSTEM_H) */
+
+#ifndef WAVE_FORMAT_IEEE_FLOAT
+#define WAVE_FORMAT_IEEE_FLOAT 0x0003
+#endif
+
+#define DETECT_DEV_IMPL(iscap, typ, capstyp) \
+static void DetectWave##typ##Devs(void) { \
+ const UINT iscapture = iscap ? 1 : 0; \
+ const UINT devcount = wave##typ##GetNumDevs(); \
+ capstyp##2W caps; \
+ UINT i; \
+ for (i = 0; i < devcount; i++) { \
+ if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \
+ char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \
+ if (name != NULL) { \
+ SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \
+ SDL_free(name); \
+ } \
+ } \
+ } \
+}
+
+DETECT_DEV_IMPL(SDL_FALSE, Out, WAVEOUTCAPS)
+DETECT_DEV_IMPL(SDL_TRUE, In, WAVEINCAPS)
+
+static void
+WINMM_DetectDevices(void)
+{
+ DetectWaveInDevs();
+ DetectWaveOutDevs();
+}
+
+static void CALLBACK
+CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance,
+ DWORD_PTR dwParam1, DWORD_PTR dwParam2)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;
+
+ /* Only service "buffer is filled" messages */
+ if (uMsg != WIM_DATA)
+ return;
+
+ /* Signal that we have a new buffer of data */
+ ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
+}
+
+
+/* The Win32 callback for filling the WAVE device */
+static void CALLBACK
+FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
+ DWORD_PTR dwParam1, DWORD_PTR dwParam2)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;
+
+ /* Only service "buffer done playing" messages */
+ if (uMsg != WOM_DONE)
+ return;
+
+ /* Signal that we are done playing a buffer */
+ ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
+}
+
+static int
+SetMMerror(char *function, MMRESULT code)
+{
+ int len;
+ char errbuf[MAXERRORLENGTH];
+ wchar_t werrbuf[MAXERRORLENGTH];
+
+ SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
+ len = SDL_static_cast(int, SDL_strlen(errbuf));
+
+ waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH - len);
+ WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len,
+ MAXERRORLENGTH - len, NULL, NULL);
+
+ return SDL_SetError("%s", errbuf);
+}
+
+static void
+WINMM_WaitDevice(_THIS)
+{
+ /* Wait for an audio chunk to finish */
+ WaitForSingleObject(this->hidden->audio_sem, INFINITE);
+}
+
+static Uint8 *
+WINMM_GetDeviceBuf(_THIS)
+{
+ return (Uint8 *) (this->hidden->
+ wavebuf[this->hidden->next_buffer].lpData);
+}
+
+static void
+WINMM_PlayDevice(_THIS)
+{
+ /* Queue it up */
+ waveOutWrite(this->hidden->hout,
+ &this->hidden->wavebuf[this->hidden->next_buffer],
+ sizeof(this->hidden->wavebuf[0]));
+ this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
+}
+
+static int
+WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen)
+{
+ const int nextbuf = this->hidden->next_buffer;
+ MMRESULT result;
+
+ SDL_assert(buflen == this->spec.size);
+
+ /* Wait for an audio chunk to finish */
+ WaitForSingleObject(this->hidden->audio_sem, INFINITE);
+
+ /* Copy it to caller's buffer... */
+ SDL_memcpy(buffer, this->hidden->wavebuf[nextbuf].lpData, this->spec.size);
+
+ /* requeue the buffer that just finished. */
+ result = waveInAddBuffer(this->hidden->hin,
+ &this->hidden->wavebuf[nextbuf],
+ sizeof (this->hidden->wavebuf[nextbuf]));
+ if (result != MMSYSERR_NOERROR) {
+ return -1; /* uhoh! Disable the device. */
+ }
+
+ /* queue the next buffer in sequence, next time. */
+ this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS;
+ return this->spec.size;
+}
+
+static void
+WINMM_FlushCapture(_THIS)
+{
+ /* Wait for an audio chunk to finish */
+ if (WaitForSingleObject(this->hidden->audio_sem, 0) == WAIT_OBJECT_0) {
+ const int nextbuf = this->hidden->next_buffer;
+ /* requeue the buffer that just finished without reading from it. */
+ waveInAddBuffer(this->hidden->hin,
+ &this->hidden->wavebuf[nextbuf],
+ sizeof (this->hidden->wavebuf[nextbuf]));
+ this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS;
+ }
+}
+
+static void
+WINMM_CloseDevice(_THIS)
+{
+ int i;
+
+ if (this->hidden->hout) {
+ waveOutReset(this->hidden->hout);
+
+ /* Clean up mixing buffers */
+ for (i = 0; i < NUM_BUFFERS; ++i) {
+ if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
+ waveOutUnprepareHeader(this->hidden->hout,
+ &this->hidden->wavebuf[i],
+ sizeof (this->hidden->wavebuf[i]));
+ }
+ }
+
+ waveOutClose(this->hidden->hout);
+ }
+
+ if (this->hidden->hin) {
+ waveInReset(this->hidden->hin);
+
+ /* Clean up mixing buffers */
+ for (i = 0; i < NUM_BUFFERS; ++i) {
+ if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
+ waveInUnprepareHeader(this->hidden->hin,
+ &this->hidden->wavebuf[i],
+ sizeof (this->hidden->wavebuf[i]));
+ }
+ }
+ waveInClose(this->hidden->hin);
+ }
+
+ if (this->hidden->audio_sem) {
+ CloseHandle(this->hidden->audio_sem);
+ }
+
+ SDL_free(this->hidden->mixbuf);
+ SDL_free(this->hidden);
+}
+
+static SDL_bool
+PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture)
+{
+ SDL_zerop(pfmt);
+
+ if (SDL_AUDIO_ISFLOAT(this->spec.format)) {
+ pfmt->wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
+ } else {
+ pfmt->wFormatTag = WAVE_FORMAT_PCM;
+ }
+ pfmt->wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format);
+
+ pfmt->nChannels = this->spec.channels;
+ pfmt->nSamplesPerSec = this->spec.freq;
+ pfmt->nBlockAlign = pfmt->nChannels * (pfmt->wBitsPerSample / 8);
+ pfmt->nAvgBytesPerSec = pfmt->nSamplesPerSec * pfmt->nBlockAlign;
+
+ if (iscapture) {
+ return (waveInOpen(0, devId, pfmt, 0, 0, WAVE_FORMAT_QUERY) == 0);
+ } else {
+ return (waveOutOpen(0, devId, pfmt, 0, 0, WAVE_FORMAT_QUERY) == 0);
+ }
+}
+
+static int
+WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
+{
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ int valid_datatype = 0;
+ MMRESULT result;
+ WAVEFORMATEX waveformat;
+ UINT devId = WAVE_MAPPER; /* WAVE_MAPPER == choose system's default */
+ UINT i;
+
+ if (handle != NULL) { /* specific device requested? */
+ /* -1 because we increment the original value to avoid NULL. */
+ const size_t val = ((size_t) handle) - 1;
+ devId = (UINT) val;
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(this->hidden);
+
+ /* Initialize the wavebuf structures for closing */
+ for (i = 0; i < NUM_BUFFERS; ++i)
+ this->hidden->wavebuf[i].dwUser = 0xFFFF;
+
+ if (this->spec.channels > 2)
+ this->spec.channels = 2; /* !!! FIXME: is this right? */
+
+ while ((!valid_datatype) && (test_format)) {
+ switch (test_format) {
+ case AUDIO_U8:
+ case AUDIO_S16:
+ case AUDIO_S32:
+ case AUDIO_F32:
+ this->spec.format = test_format;
+ if (PrepWaveFormat(this, devId, &waveformat, iscapture)) {
+ valid_datatype = 1;
+ } else {
+ test_format = SDL_NextAudioFormat();
+ }
+ break;
+
+ default:
+ test_format = SDL_NextAudioFormat();
+ break;
+ }
+ }
+
+ if (!valid_datatype) {
+ return SDL_SetError("Unsupported audio format");
+ }
+
+ /* Update the fragment size as size in bytes */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Open the audio device */
+ if (iscapture) {
+ result = waveInOpen(&this->hidden->hin, devId, &waveformat,
+ (DWORD_PTR) CaptureSound, (DWORD_PTR) this,
+ CALLBACK_FUNCTION);
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveInOpen()", result);
+ }
+ } else {
+ result = waveOutOpen(&this->hidden->hout, devId, &waveformat,
+ (DWORD_PTR) FillSound, (DWORD_PTR) this,
+ CALLBACK_FUNCTION);
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveOutOpen()", result);
+ }
+ }
+
+#ifdef SOUND_DEBUG
+ /* Check the sound device we retrieved */
+ {
+ if (iscapture) {
+ WAVEINCAPS caps;
+ result = waveInGetDevCaps((UINT) this->hidden->hout,
+ &caps, sizeof (caps));
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveInGetDevCaps()", result);
+ }
+ printf("Audio device: %s\n", caps.szPname);
+ } else {
+ WAVEOUTCAPS caps;
+ result = waveOutGetDevCaps((UINT) this->hidden->hout,
+ &caps, sizeof(caps));
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveOutGetDevCaps()", result);
+ }
+ printf("Audio device: %s\n", caps.szPname);
+ }
+ }
+#endif
+
+ /* Create the audio buffer semaphore */
+ this->hidden->audio_sem =
+ CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
+ if (this->hidden->audio_sem == NULL) {
+ return SDL_SetError("Couldn't create semaphore");
+ }
+
+ /* Create the sound buffers */
+ this->hidden->mixbuf =
+ (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size);
+ if (this->hidden->mixbuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_zero(this->hidden->wavebuf);
+ for (i = 0; i < NUM_BUFFERS; ++i) {
+ this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
+ this->hidden->wavebuf[i].dwFlags = WHDR_DONE;
+ this->hidden->wavebuf[i].lpData =
+ (LPSTR) & this->hidden->mixbuf[i * this->spec.size];
+
+ if (iscapture) {
+ result = waveInPrepareHeader(this->hidden->hin,
+ &this->hidden->wavebuf[i],
+ sizeof(this->hidden->wavebuf[i]));
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveInPrepareHeader()", result);
+ }
+
+ result = waveInAddBuffer(this->hidden->hin,
+ &this->hidden->wavebuf[i],
+ sizeof(this->hidden->wavebuf[i]));
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveInAddBuffer()", result);
+ }
+ } else {
+ result = waveOutPrepareHeader(this->hidden->hout,
+ &this->hidden->wavebuf[i],
+ sizeof(this->hidden->wavebuf[i]));
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveOutPrepareHeader()", result);
+ }
+ }
+ }
+
+ if (iscapture) {
+ result = waveInStart(this->hidden->hin);
+ if (result != MMSYSERR_NOERROR) {
+ return SetMMerror("waveInStart()", result);
+ }
+ }
+
+ return 0; /* Ready to go! */
+}
+
+
+static int
+WINMM_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = WINMM_DetectDevices;
+ impl->OpenDevice = WINMM_OpenDevice;
+ impl->PlayDevice = WINMM_PlayDevice;
+ impl->WaitDevice = WINMM_WaitDevice;
+ impl->GetDeviceBuf = WINMM_GetDeviceBuf;
+ impl->CaptureFromDevice = WINMM_CaptureFromDevice;
+ impl->FlushCapture = WINMM_FlushCapture;
+ impl->CloseDevice = WINMM_CloseDevice;
+
+ impl->HasCaptureSupport = SDL_TRUE;
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap WINMM_bootstrap = {
+ "winmm", "Windows Waveform Audio", WINMM_Init, 0
+};
+
+#endif /* SDL_AUDIO_DRIVER_WINMM */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.h b/src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.h
new file mode 100644
index 0000000..9342bb9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/audio/winmm/SDL_winmm.h
@@ -0,0 +1,45 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_winmm_h_
+#define SDL_winmm_h_
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+#define NUM_BUFFERS 2 /* -- Don't lower this! */
+
+struct SDL_PrivateAudioData
+{
+ HWAVEOUT hout;
+ HWAVEIN hin;
+ HANDLE audio_sem;
+ Uint8 *mixbuf; /* The raw allocated mixing buffer */
+ WAVEHDR wavebuf[NUM_BUFFERS]; /* Wave audio fragments */
+ int next_buffer;
+};
+
+#endif /* SDL_winmm_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/android/SDL_android.c b/src/3rdparty/SDL2/src/core/android/SDL_android.c
new file mode 100644
index 0000000..c40c676
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/android/SDL_android.c
@@ -0,0 +1,2171 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_log.h"
+#include "SDL_main.h"
+
+#ifdef __ANDROID__
+
+#include "SDL_system.h"
+#include "SDL_android.h"
+
+#include "keyinfotable.h"
+
+#include "../../events/SDL_events_c.h"
+#include "../../video/android/SDL_androidkeyboard.h"
+#include "../../video/android/SDL_androidmouse.h"
+#include "../../video/android/SDL_androidtouch.h"
+#include "../../video/android/SDL_androidvideo.h"
+#include "../../video/android/SDL_androidwindow.h"
+#include "../../joystick/android/SDL_sysjoystick_c.h"
+#include "../../haptic/android/SDL_syshaptic_c.h"
+
+#include <android/log.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <dlfcn.h>
+/* #define LOG_TAG "SDL_android" */
+/* #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) */
+/* #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) */
+#define LOGI(...) do {} while (0)
+#define LOGE(...) do {} while (0)
+
+
+#define SDL_JAVA_PREFIX org_libsdl_app
+#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function)
+#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function
+#define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function)
+#define SDL_JAVA_AUDIO_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLAudioManager, function)
+#define SDL_JAVA_CONTROLLER_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLControllerManager, function)
+#define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function)
+
+
+/* Java class SDLActivity */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(
+ JNIEnv* mEnv, jclass cls);
+
+JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(
+ JNIEnv* env, jclass cls,
+ jstring library, jstring function, jobject array);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
+ JNIEnv* env, jclass jcls,
+ jstring filename);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
+ JNIEnv* env, jclass jcls,
+ jint width, jint height, jint format, jfloat rate);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(
+ JNIEnv* env, jclass jcls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(
+ JNIEnv* env, jclass jcls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)(
+ JNIEnv* env, jclass jcls,
+ jint keycode);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)(
+ JNIEnv* env, jclass jcls,
+ jint keycode);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)(
+ JNIEnv* env, jclass jcls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)(
+ JNIEnv* env, jclass jcls,
+ jint touch_device_id_in, jint pointer_finger_id_in,
+ jint action, jfloat x, jfloat y, jfloat p);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)(
+ JNIEnv* env, jclass jcls,
+ jint button, jint action, jfloat x, jfloat y);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)(
+ JNIEnv* env, jclass jcls,
+ jfloat x, jfloat y, jfloat z);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
+ JNIEnv* env, jclass jcls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
+ JNIEnv* env, jclass cls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)(
+ JNIEnv* env, jclass cls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)(
+ JNIEnv* env, jclass cls);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)(
+ JNIEnv* env, jclass cls);
+
+JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)(
+ JNIEnv* env, jclass cls,
+ jstring name);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
+ JNIEnv* env, jclass cls,
+ jstring name, jstring value);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)(
+ JNIEnv* env, jclass cls);
+
+/* Java class SDLInputConnection */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)(
+ JNIEnv* env, jclass cls,
+ jstring text, jint newCursorPosition);
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)(
+ JNIEnv* env, jclass cls,
+ jstring text, jint newCursorPosition);
+
+/* Java class SDLAudioManager */
+JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(
+ JNIEnv *env, jclass jcls);
+
+/* Java class SDLControllerManager */
+JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(
+ JNIEnv *env, jclass jcls);
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint keycode);
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint keycode);
+
+JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint axis, jfloat value);
+
+JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint hat_id, jint x, jint y);
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jstring device_name, jstring device_desc, jint is_accelerometer,
+ jint nbuttons, jint naxes, jint nhats, jint nballs);
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)(
+ JNIEnv* env, jclass jcls,
+ jint device_id);
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jstring device_name);
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)(
+ JNIEnv* env, jclass jcls,
+ jint device_id);
+
+
+
+/* Uncomment this to log messages entering and exiting methods in this file */
+/* #define DEBUG_JNI */
+
+static void Android_JNI_ThreadDestroyed(void*);
+
+/*******************************************************************************
+ This file links the Java side of Android with libsdl
+*******************************************************************************/
+#include <jni.h>
+
+
+/*******************************************************************************
+ Globals
+*******************************************************************************/
+static pthread_key_t mThreadKey;
+static JavaVM* mJavaVM;
+
+/* Main activity */
+static jclass mActivityClass;
+
+/* method signatures */
+static jmethodID midGetNativeSurface;
+static jmethodID midSetActivityTitle;
+static jmethodID midSetWindowStyle;
+static jmethodID midSetOrientation;
+static jmethodID midGetContext;
+static jmethodID midIsAndroidTV;
+static jmethodID midInputGetInputDeviceIds;
+static jmethodID midSendMessage;
+static jmethodID midShowTextInput;
+static jmethodID midIsScreenKeyboardShown;
+static jmethodID midClipboardSetText;
+static jmethodID midClipboardGetText;
+static jmethodID midClipboardHasText;
+static jmethodID midOpenAPKExpansionInputStream;
+static jmethodID midGetManifestEnvironmentVariables;
+static jmethodID midGetDisplayDPI;
+
+/* audio manager */
+static jclass mAudioManagerClass;
+
+/* method signatures */
+static jmethodID midAudioOpen;
+static jmethodID midAudioWriteShortBuffer;
+static jmethodID midAudioWriteByteBuffer;
+static jmethodID midAudioClose;
+static jmethodID midCaptureOpen;
+static jmethodID midCaptureReadShortBuffer;
+static jmethodID midCaptureReadByteBuffer;
+static jmethodID midCaptureClose;
+
+/* controller manager */
+static jclass mControllerManagerClass;
+
+/* method signatures */
+static jmethodID midPollInputDevices;
+static jmethodID midPollHapticDevices;
+static jmethodID midHapticRun;
+
+/* static fields */
+static jfieldID fidSeparateMouseAndTouch;
+
+/* Accelerometer data storage */
+static float fLastAccelerometer[3];
+static SDL_bool bHasNewData;
+
+static SDL_bool bHasEnvironmentVariables = SDL_FALSE;
+
+/*******************************************************************************
+ Functions called by JNI
+*******************************************************************************/
+
+/* Library init */
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
+{
+ JNIEnv *env;
+ mJavaVM = vm;
+ LOGI("JNI_OnLoad called");
+ if ((*mJavaVM)->GetEnv(mJavaVM, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+ LOGE("Failed to get the environment using GetEnv()");
+ return -1;
+ }
+ /*
+ * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread
+ * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this
+ */
+ if (pthread_key_create(&mThreadKey, Android_JNI_ThreadDestroyed) != 0) {
+ __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing pthread key");
+ }
+ Android_JNI_SetupThread();
+
+ return JNI_VERSION_1_4;
+}
+
+void checkJNIReady()
+{
+ if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) {
+ // We aren't fully initialized, let's just return.
+ return;
+ }
+
+ SDL_SetMainReady();
+}
+
+/* Activity initialization -- called before SDL_main() to initialize JNI bindings */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls)
+{
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()");
+
+ Android_JNI_SetupThread();
+
+ mActivityClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls));
+
+ midGetNativeSurface = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "getNativeSurface","()Landroid/view/Surface;");
+ midSetActivityTitle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "setActivityTitle","(Ljava/lang/String;)Z");
+ midSetWindowStyle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "setWindowStyle","(Z)V");
+ midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "setOrientation","(IIZLjava/lang/String;)V");
+ midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "getContext","()Landroid/content/Context;");
+ midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "isAndroidTV","()Z");
+ midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "inputGetInputDeviceIds", "(I)[I");
+ midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "sendMessage", "(II)Z");
+ midShowTextInput = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "showTextInput", "(IIII)Z");
+ midIsScreenKeyboardShown = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "isScreenKeyboardShown","()Z");
+ midClipboardSetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "clipboardSetText", "(Ljava/lang/String;)V");
+ midClipboardGetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "clipboardGetText", "()Ljava/lang/String;");
+ midClipboardHasText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "clipboardHasText", "()Z");
+ midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
+
+ midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
+ "getManifestEnvironmentVariables", "()Z");
+
+ midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
+ midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
+
+ if (!midGetNativeSurface ||
+ !midSetActivityTitle || !midSetWindowStyle || !midSetOrientation || !midGetContext || !midIsAndroidTV || !midInputGetInputDeviceIds ||
+ !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown ||
+ !midClipboardSetText || !midClipboardGetText || !midClipboardHasText ||
+ !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables|| !midGetDisplayDPI) {
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?");
+ }
+
+ fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z");
+
+ if (!fidSeparateMouseAndTouch) {
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java static fields, do you have the latest version of SDLActivity.java?");
+ }
+
+ checkJNIReady();
+}
+
+/* Audio initialization -- called before SDL_main() to initialize JNI bindings */
+JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls)
+{
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()");
+
+ Android_JNI_SetupThread();
+
+ mAudioManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls));
+
+ midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "audioOpen", "(IZZI)I");
+ midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "audioWriteShortBuffer", "([S)V");
+ midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "audioWriteByteBuffer", "([B)V");
+ midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "audioClose", "()V");
+ midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "captureOpen", "(IZZI)I");
+ midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "captureReadShortBuffer", "([SZ)I");
+ midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "captureReadByteBuffer", "([BZ)I");
+ midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass,
+ "captureClose", "()V");
+
+ if (!midAudioOpen || !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioClose ||
+ !midCaptureOpen || !midCaptureReadShortBuffer || !midCaptureReadByteBuffer || !midCaptureClose) {
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?");
+ }
+
+ checkJNIReady();
+}
+
+/* Controller initialization -- called before SDL_main() to initialize JNI bindings */
+JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls)
+{
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()");
+
+ Android_JNI_SetupThread();
+
+ mControllerManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls));
+
+ midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
+ "pollInputDevices", "()V");
+ midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
+ "pollHapticDevices", "()V");
+ midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
+ "hapticRun", "(II)V");
+
+ if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun) {
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?");
+ }
+
+ checkJNIReady();
+}
+
+/* SDL main function prototype */
+typedef int (*SDL_main_func)(int argc, char *argv[]);
+
+/* Start up the SDL app */
+JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, jstring library, jstring function, jobject array)
+{
+ int status = -1;
+ const char *library_file;
+ void *library_handle;
+
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain()");
+
+ library_file = (*env)->GetStringUTFChars(env, library, NULL);
+ library_handle = dlopen(library_file, RTLD_GLOBAL);
+ if (library_handle) {
+ const char *function_name;
+ SDL_main_func SDL_main;
+
+ function_name = (*env)->GetStringUTFChars(env, function, NULL);
+ SDL_main = (SDL_main_func)dlsym(library_handle, function_name);
+ if (SDL_main) {
+ int i;
+ int argc;
+ int len;
+ char **argv;
+
+ /* Prepare the arguments. */
+ len = (*env)->GetArrayLength(env, array);
+ argv = SDL_stack_alloc(char*, 1 + len + 1);
+ argc = 0;
+ /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works.
+ https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start
+ */
+ argv[argc++] = SDL_strdup("app_process");
+ for (i = 0; i < len; ++i) {
+ const char* utf;
+ char* arg = NULL;
+ jstring string = (*env)->GetObjectArrayElement(env, array, i);
+ if (string) {
+ utf = (*env)->GetStringUTFChars(env, string, 0);
+ if (utf) {
+ arg = SDL_strdup(utf);
+ (*env)->ReleaseStringUTFChars(env, string, utf);
+ }
+ (*env)->DeleteLocalRef(env, string);
+ }
+ if (!arg) {
+ arg = SDL_strdup("");
+ }
+ argv[argc++] = arg;
+ }
+ argv[argc] = NULL;
+
+
+ /* Run the application. */
+ status = SDL_main(argc, argv);
+
+ /* Release the arguments. */
+ for (i = 0; i < argc; ++i) {
+ SDL_free(argv[i]);
+ }
+ SDL_stack_free(argv);
+
+ } else {
+ __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't find function %s in library %s", function_name, library_file);
+ }
+ (*env)->ReleaseStringUTFChars(env, function, function_name);
+
+ dlclose(library_handle);
+
+ } else {
+ __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't load library %s", library_file);
+ }
+ (*env)->ReleaseStringUTFChars(env, library, library_file);
+
+ /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
+ /* exit(status); */
+
+ return status;
+}
+
+/* Drop file */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
+ JNIEnv* env, jclass jcls,
+ jstring filename)
+{
+ const char *path = (*env)->GetStringUTFChars(env, filename, NULL);
+ SDL_SendDropFile(NULL, path);
+ (*env)->ReleaseStringUTFChars(env, filename, path);
+ SDL_SendDropComplete(NULL);
+}
+
+/* Resize */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
+ JNIEnv* env, jclass jcls,
+ jint width, jint height, jint format, jfloat rate)
+{
+ Android_SetScreenResolution(width, height, format, rate);
+}
+
+/* Paddown */
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint keycode)
+{
+ return Android_OnPadDown(device_id, keycode);
+}
+
+/* Padup */
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint keycode)
+{
+ return Android_OnPadUp(device_id, keycode);
+}
+
+/* Joy */
+JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint axis, jfloat value)
+{
+ Android_OnJoy(device_id, axis, value);
+}
+
+/* POV Hat */
+JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jint hat_id, jint x, jint y)
+{
+ Android_OnHat(device_id, hat_id, x, y);
+}
+
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)(
+ JNIEnv* env, jclass jcls,
+ jint device_id, jstring device_name, jstring device_desc, jint is_accelerometer,
+ jint nbuttons, jint naxes, jint nhats, jint nballs)
+{
+ int retval;
+ const char *name = (*env)->GetStringUTFChars(env, device_name, NULL);
+ const char *desc = (*env)->GetStringUTFChars(env, device_desc, NULL);
+
+ retval = Android_AddJoystick(device_id, name, desc, (SDL_bool) is_accelerometer, nbuttons, naxes, nhats, nballs);
+
+ (*env)->ReleaseStringUTFChars(env, device_name, name);
+ (*env)->ReleaseStringUTFChars(env, device_desc, desc);
+
+ return retval;
+}
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)(
+ JNIEnv* env, jclass jcls,
+ jint device_id)
+{
+ return Android_RemoveJoystick(device_id);
+}
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)(
+ JNIEnv* env, jclass jcls, jint device_id, jstring device_name)
+{
+ int retval;
+ const char *name = (*env)->GetStringUTFChars(env, device_name, NULL);
+
+ retval = Android_AddHaptic(device_id, name);
+
+ (*env)->ReleaseStringUTFChars(env, device_name, name);
+
+ return retval;
+}
+
+JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)(
+ JNIEnv* env, jclass jcls, jint device_id)
+{
+ return Android_RemoveHaptic(device_id);
+}
+
+
+/* Surface Created */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv* env, jclass jcls)
+{
+ SDL_WindowData *data;
+ SDL_VideoDevice *_this;
+
+ if (Android_Window == NULL || Android_Window->driverdata == NULL ) {
+ return;
+ }
+
+ _this = SDL_GetVideoDevice();
+ data = (SDL_WindowData *) Android_Window->driverdata;
+
+ /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */
+ if (data->egl_surface == EGL_NO_SURFACE) {
+ if(data->native_window) {
+ ANativeWindow_release(data->native_window);
+ }
+ data->native_window = Android_JNI_GetNativeWindow();
+ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window);
+ }
+
+ /* GL Context handling is done in the event loop because this function is run from the Java thread */
+
+}
+
+/* Surface Destroyed */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv* env, jclass jcls)
+{
+ /* We have to clear the current context and destroy the egl surface here
+ * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume
+ * Ref: http://stackoverflow.com/questions/8762589/eglcreatewindowsurface-on-ics-and-switching-from-2d-to-3d
+ */
+ SDL_WindowData *data;
+ SDL_VideoDevice *_this;
+
+ if (Android_Window == NULL || Android_Window->driverdata == NULL ) {
+ return;
+ }
+
+ _this = SDL_GetVideoDevice();
+ data = (SDL_WindowData *) Android_Window->driverdata;
+
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_MakeCurrent(_this, NULL, NULL);
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ data->egl_surface = EGL_NO_SURFACE;
+ }
+
+ /* GL Context handling is done in the event loop because this function is run from the Java thread */
+
+}
+
+/* Keydown */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)(
+ JNIEnv* env, jclass jcls,
+ jint keycode)
+{
+ Android_OnKeyDown(keycode);
+}
+
+/* Keyup */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)(
+ JNIEnv* env, jclass jcls,
+ jint keycode)
+{
+ Android_OnKeyUp(keycode);
+}
+
+/* Keyboard Focus Lost */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)(
+ JNIEnv* env, jclass jcls)
+{
+ /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */
+ SDL_StopTextInput();
+}
+
+
+/* Touch */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)(
+ JNIEnv* env, jclass jcls,
+ jint touch_device_id_in, jint pointer_finger_id_in,
+ jint action, jfloat x, jfloat y, jfloat p)
+{
+ Android_OnTouch(touch_device_id_in, pointer_finger_id_in, action, x, y, p);
+}
+
+/* Mouse */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)(
+ JNIEnv* env, jclass jcls,
+ jint button, jint action, jfloat x, jfloat y)
+{
+ Android_OnMouse(button, action, x, y);
+}
+
+/* Accelerometer */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)(
+ JNIEnv* env, jclass jcls,
+ jfloat x, jfloat y, jfloat z)
+{
+ fLastAccelerometer[0] = x;
+ fLastAccelerometer[1] = y;
+ fLastAccelerometer[2] = z;
+ bHasNewData = SDL_TRUE;
+}
+
+/* Clipboard */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
+ JNIEnv* env, jclass jcls)
+{
+ SDL_SendClipboardUpdate();
+}
+
+/* Low memory */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
+ JNIEnv* env, jclass cls)
+{
+ SDL_SendAppEvent(SDL_APP_LOWMEMORY);
+}
+
+/* Quit */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)(
+ JNIEnv* env, jclass cls)
+{
+ /* Discard previous events. The user should have handled state storage
+ * in SDL_APP_WILLENTERBACKGROUND. After nativeQuit() is called, no
+ * events other than SDL_QUIT and SDL_APP_TERMINATING should fire */
+ SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
+ /* Inject a SDL_QUIT event */
+ SDL_SendQuit();
+ SDL_SendAppEvent(SDL_APP_TERMINATING);
+ /* Resume the event loop so that the app can catch SDL_QUIT which
+ * should now be the top event in the event queue. */
+ if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
+}
+
+/* Pause */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)(
+ JNIEnv* env, jclass cls)
+{
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()");
+
+ if (Android_Window) {
+ SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
+ SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+ SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
+ SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
+
+ /* *After* sending the relevant events, signal the pause semaphore
+ * so the event loop knows to pause and (optionally) block itself */
+ if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem);
+ }
+}
+
+/* Resume */
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)(
+ JNIEnv* env, jclass cls)
+{
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()");
+
+ if (Android_Window) {
+ SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
+ SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
+ SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
+ SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context
+ * We can't restore the GL Context here because it needs to be done on the SDL main thread
+ * and this function will be called from the Java thread instead.
+ */
+ if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
+ }
+}
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)(
+ JNIEnv* env, jclass cls,
+ jstring text, jint newCursorPosition)
+{
+ const char *utftext = (*env)->GetStringUTFChars(env, text, NULL);
+
+ SDL_SendKeyboardText(utftext);
+
+ (*env)->ReleaseStringUTFChars(env, text, utftext);
+}
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)(
+ JNIEnv* env, jclass cls,
+ jchar chUnicode)
+{
+ SDL_Scancode code = SDL_SCANCODE_UNKNOWN;
+ uint16_t mod = 0;
+
+ // We do not care about bigger than 127.
+ if (chUnicode < 127) {
+ AndroidKeyInfo info = unicharToAndroidKeyInfoTable[chUnicode];
+ code = info.code;
+ mod = info.mod;
+ }
+
+ if (mod & KMOD_SHIFT) {
+ /* If character uses shift, press shift down */
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
+ }
+
+ /* send a keydown and keyup even for the character */
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+ SDL_SendKeyboardKey(SDL_RELEASED, code);
+
+ if (mod & KMOD_SHIFT) {
+ /* If character uses shift, press shift back up */
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
+ }
+}
+
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)(
+ JNIEnv* env, jclass cls,
+ jstring text, jint newCursorPosition)
+{
+ const char *utftext = (*env)->GetStringUTFChars(env, text, NULL);
+
+ SDL_SendEditingText(utftext, 0, 0);
+
+ (*env)->ReleaseStringUTFChars(env, text, utftext);
+}
+
+JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)(
+ JNIEnv* env, jclass cls,
+ jstring name)
+{
+ const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
+ const char *hint = SDL_GetHint(utfname);
+
+ jstring result = (*env)->NewStringUTF(env, hint);
+ (*env)->ReleaseStringUTFChars(env, name, utfname);
+
+ return result;
+}
+
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
+ JNIEnv* env, jclass cls,
+ jstring name, jstring value)
+{
+ const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
+ const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL);
+
+ SDL_setenv(utfname, utfvalue, 1);
+
+ (*env)->ReleaseStringUTFChars(env, name, utfname);
+ (*env)->ReleaseStringUTFChars(env, value, utfvalue);
+
+}
+
+/*******************************************************************************
+ Functions called by SDL into Java
+*******************************************************************************/
+
+static int s_active = 0;
+struct LocalReferenceHolder
+{
+ JNIEnv *m_env;
+ const char *m_func;
+};
+
+static struct LocalReferenceHolder LocalReferenceHolder_Setup(const char *func)
+{
+ struct LocalReferenceHolder refholder;
+ refholder.m_env = NULL;
+ refholder.m_func = func;
+#ifdef DEBUG_JNI
+ SDL_Log("Entering function %s", func);
+#endif
+ return refholder;
+}
+
+static SDL_bool LocalReferenceHolder_Init(struct LocalReferenceHolder *refholder, JNIEnv *env)
+{
+ const int capacity = 16;
+ if ((*env)->PushLocalFrame(env, capacity) < 0) {
+ SDL_SetError("Failed to allocate enough JVM local references");
+ return SDL_FALSE;
+ }
+ ++s_active;
+ refholder->m_env = env;
+ return SDL_TRUE;
+}
+
+static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder)
+{
+#ifdef DEBUG_JNI
+ SDL_Log("Leaving function %s", refholder->m_func);
+#endif
+ if (refholder->m_env) {
+ JNIEnv* env = refholder->m_env;
+ (*env)->PopLocalFrame(env, NULL);
+ --s_active;
+ }
+}
+
+static SDL_bool LocalReferenceHolder_IsActive(void)
+{
+ return s_active > 0;
+}
+
+ANativeWindow* Android_JNI_GetNativeWindow(void)
+{
+ ANativeWindow* anw;
+ jobject s;
+ JNIEnv *env = Android_JNI_GetEnv();
+
+ s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface);
+ anw = ANativeWindow_fromSurface(env, s);
+ (*env)->DeleteLocalRef(env, s);
+
+ return anw;
+}
+
+void Android_JNI_SetActivityTitle(const char *title)
+{
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+
+ jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title));
+ (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetActivityTitle, jtitle);
+ (*mEnv)->DeleteLocalRef(mEnv, jtitle);
+}
+
+void Android_JNI_SetWindowStyle(SDL_bool fullscreen)
+{
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+ (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0);
+}
+
+void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint)
+{
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+
+ jstring jhint = (jstring)((*mEnv)->NewStringUTF(mEnv, (hint ? hint : "")));
+ (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint);
+ (*mEnv)->DeleteLocalRef(mEnv, jhint);
+}
+
+SDL_bool Android_JNI_GetAccelerometerValues(float values[3])
+{
+ int i;
+ SDL_bool retval = SDL_FALSE;
+
+ if (bHasNewData) {
+ for (i = 0; i < 3; ++i) {
+ values[i] = fLastAccelerometer[i];
+ }
+ bHasNewData = SDL_FALSE;
+ retval = SDL_TRUE;
+ }
+
+ return retval;
+}
+
+static void Android_JNI_ThreadDestroyed(void* value)
+{
+ /* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */
+ JNIEnv *env = (JNIEnv*) value;
+ if (env != NULL) {
+ (*mJavaVM)->DetachCurrentThread(mJavaVM);
+ pthread_setspecific(mThreadKey, NULL);
+ }
+}
+
+JNIEnv* Android_JNI_GetEnv(void)
+{
+ /* From http://developer.android.com/guide/practices/jni.html
+ * All threads are Linux threads, scheduled by the kernel.
+ * They're usually started from managed code (using Thread.start), but they can also be created elsewhere and then
+ * attached to the JavaVM. For example, a thread started with pthread_create can be attached with the
+ * JNI AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a thread is attached, it has no JNIEnv,
+ * and cannot make JNI calls.
+ * Attaching a natively-created thread causes a java.lang.Thread object to be constructed and added to the "main"
+ * ThreadGroup, making it visible to the debugger. Calling AttachCurrentThread on an already-attached thread
+ * is a no-op.
+ * Note: You can call this function any number of times for the same thread, there's no harm in it
+ */
+
+ JNIEnv *env;
+ int status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL);
+ if(status < 0) {
+ LOGE("failed to attach current thread");
+ return 0;
+ }
+
+ /* From http://developer.android.com/guide/practices/jni.html
+ * Threads attached through JNI must call DetachCurrentThread before they exit. If coding this directly is awkward,
+ * in Android 2.0 (Eclair) and higher you can use pthread_key_create to define a destructor function that will be
+ * called before the thread exits, and call DetachCurrentThread from there. (Use that key with pthread_setspecific
+ * to store the JNIEnv in thread-local-storage; that way it'll be passed into your destructor as the argument.)
+ * Note: The destructor is not called unless the stored value is != NULL
+ * Note: You can call this function any number of times for the same thread, there's no harm in it
+ * (except for some lost CPU cycles)
+ */
+ pthread_setspecific(mThreadKey, (void*) env);
+
+ return env;
+}
+
+int Android_JNI_SetupThread(void)
+{
+ Android_JNI_GetEnv();
+ return 1;
+}
+
+/*
+ * Audio support
+ */
+static jboolean audioBuffer16Bit = JNI_FALSE;
+static jobject audioBuffer = NULL;
+static void* audioBufferPinned = NULL;
+static jboolean captureBuffer16Bit = JNI_FALSE;
+static jobject captureBuffer = NULL;
+
+int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames)
+{
+ jboolean audioBufferStereo;
+ int audioBufferFrames;
+ jobject jbufobj = NULL;
+ jboolean isCopy;
+
+ JNIEnv *env = Android_JNI_GetEnv();
+
+ if (!env) {
+ LOGE("callback_handler: failed to attach current thread");
+ }
+ Android_JNI_SetupThread();
+
+ audioBufferStereo = channelCount > 1;
+
+ if (iscapture) {
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for capture");
+ captureBuffer16Bit = is16Bit;
+ if ((*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) {
+ /* Error during audio initialization */
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioRecord initialization!");
+ return 0;
+ }
+ } else {
+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for output");
+ audioBuffer16Bit = is16Bit;
+ if ((*env)->CallStaticIntMethod(env, mAudioManagerClass, midAudioOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) {
+ /* Error during audio initialization */
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioTrack initialization!");
+ return 0;
+ }
+ }
+
+ /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on
+ * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */
+
+ if (is16Bit) {
+ jshortArray audioBufferLocal = (*env)->NewShortArray(env, desiredBufferFrames * (audioBufferStereo ? 2 : 1));
+ if (audioBufferLocal) {
+ jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal);
+ (*env)->DeleteLocalRef(env, audioBufferLocal);
+ }
+ }
+ else {
+ jbyteArray audioBufferLocal = (*env)->NewByteArray(env, desiredBufferFrames * (audioBufferStereo ? 2 : 1));
+ if (audioBufferLocal) {
+ jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal);
+ (*env)->DeleteLocalRef(env, audioBufferLocal);
+ }
+ }
+
+ if (jbufobj == NULL) {
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer!");
+ return 0;
+ }
+
+ if (iscapture) {
+ captureBuffer = jbufobj;
+ } else {
+ audioBuffer = jbufobj;
+ }
+
+ isCopy = JNI_FALSE;
+
+ if (is16Bit) {
+ if (!iscapture) {
+ audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy);
+ }
+ audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer);
+ } else {
+ if (!iscapture) {
+ audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy);
+ }
+ audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer);
+ }
+
+ if (audioBufferStereo) {
+ audioBufferFrames /= 2;
+ }
+
+ return audioBufferFrames;
+}
+
+int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+
+ jobject jDisplayObj = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetDisplayDPI);
+ jclass jDisplayClass = (*env)->GetObjectClass(env, jDisplayObj);
+
+ jfieldID fidXdpi = (*env)->GetFieldID(env, jDisplayClass, "xdpi", "F");
+ jfieldID fidYdpi = (*env)->GetFieldID(env, jDisplayClass, "ydpi", "F");
+ jfieldID fidDdpi = (*env)->GetFieldID(env, jDisplayClass, "densityDpi", "I");
+
+ float nativeXdpi = (*env)->GetFloatField(env, jDisplayObj, fidXdpi);
+ float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi);
+ int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi);
+
+
+ (*env)->DeleteLocalRef(env, jDisplayObj);
+ (*env)->DeleteLocalRef(env, jDisplayClass);
+
+ if (ddpi) {
+ *ddpi = (float)nativeDdpi;
+ }
+ if (xdpi) {
+ *xdpi = nativeXdpi;
+ }
+ if (ydpi) {
+ *ydpi = nativeYdpi;
+ }
+
+ return 0;
+}
+
+void * Android_JNI_GetAudioBuffer(void)
+{
+ return audioBufferPinned;
+}
+
+void Android_JNI_WriteAudioBuffer(void)
+{
+ JNIEnv *mAudioEnv = Android_JNI_GetEnv();
+
+ if (audioBuffer16Bit) {
+ (*mAudioEnv)->ReleaseShortArrayElements(mAudioEnv, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT);
+ (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer);
+ } else {
+ (*mAudioEnv)->ReleaseByteArrayElements(mAudioEnv, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT);
+ (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer);
+ }
+
+ /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */
+}
+
+int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ jboolean isCopy = JNI_FALSE;
+ jint br;
+
+ if (captureBuffer16Bit) {
+ SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == (buflen / 2));
+ br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE);
+ if (br > 0) {
+ jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)captureBuffer, &isCopy);
+ br *= 2;
+ SDL_memcpy(buffer, ptr, br);
+ (*env)->ReleaseShortArrayElements(env, (jshortArray)captureBuffer, (jshort *)ptr, JNI_ABORT);
+ }
+ } else {
+ SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == buflen);
+ br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE);
+ if (br > 0) {
+ jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)captureBuffer, &isCopy);
+ SDL_memcpy(buffer, ptr, br);
+ (*env)->ReleaseByteArrayElements(env, (jbyteArray)captureBuffer, (jbyte *)ptr, JNI_ABORT);
+ }
+ }
+
+ return (int) br;
+}
+
+void Android_JNI_FlushCapturedAudio(void)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+#if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */
+ if (captureBuffer16Bit) {
+ const jint len = (*env)->GetArrayLength(env, (jshortArray)captureBuffer);
+ while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE) == len) { /* spin */ }
+ } else {
+ const jint len = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer);
+ while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE) == len) { /* spin */ }
+ }
+#else
+ if (captureBuffer16Bit) {
+ (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE);
+ } else {
+ (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE);
+ }
+#endif
+}
+
+void Android_JNI_CloseAudioDevice(const int iscapture)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+
+ if (iscapture) {
+ (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midCaptureClose);
+ if (captureBuffer) {
+ (*env)->DeleteGlobalRef(env, captureBuffer);
+ captureBuffer = NULL;
+ }
+ } else {
+ (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioClose);
+ if (audioBuffer) {
+ (*env)->DeleteGlobalRef(env, audioBuffer);
+ audioBuffer = NULL;
+ audioBufferPinned = NULL;
+ }
+ }
+}
+
+/* Test for an exception and call SDL_SetError with its detail if one occurs */
+/* If the parameter silent is truthy then SDL_SetError() will not be called. */
+static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent)
+{
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+ jthrowable exception;
+
+ SDL_assert(LocalReferenceHolder_IsActive());
+
+ exception = (*mEnv)->ExceptionOccurred(mEnv);
+ if (exception != NULL) {
+ jmethodID mid;
+
+ /* Until this happens most JNI operations have undefined behaviour */
+ (*mEnv)->ExceptionClear(mEnv);
+
+ if (!silent) {
+ jclass exceptionClass = (*mEnv)->GetObjectClass(mEnv, exception);
+ jclass classClass = (*mEnv)->FindClass(mEnv, "java/lang/Class");
+ jstring exceptionName;
+ const char* exceptionNameUTF8;
+ jstring exceptionMessage;
+
+ mid = (*mEnv)->GetMethodID(mEnv, classClass, "getName", "()Ljava/lang/String;");
+ exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid);
+ exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0);
+
+ mid = (*mEnv)->GetMethodID(mEnv, exceptionClass, "getMessage", "()Ljava/lang/String;");
+ exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid);
+
+ if (exceptionMessage != NULL) {
+ const char* exceptionMessageUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionMessage, 0);
+ SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8);
+ (*mEnv)->ReleaseStringUTFChars(mEnv, exceptionMessage, exceptionMessageUTF8);
+ } else {
+ SDL_SetError("%s", exceptionNameUTF8);
+ }
+
+ (*mEnv)->ReleaseStringUTFChars(mEnv, exceptionName, exceptionNameUTF8);
+ }
+
+ return SDL_TRUE;
+ }
+
+ return SDL_FALSE;
+}
+
+static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx)
+{
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+
+ int result = 0;
+
+ jmethodID mid;
+ jobject context;
+ jobject assetManager;
+ jobject inputStream;
+ jclass channels;
+ jobject readableByteChannel;
+ jstring fileNameJString;
+ jobject fd;
+ jclass fdCls;
+ jfieldID descriptor;
+
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+ if (!LocalReferenceHolder_Init(&refs, mEnv)) {
+ goto failure;
+ }
+
+ fileNameJString = (jstring)ctx->hidden.androidio.fileNameRef;
+ ctx->hidden.androidio.position = 0;
+
+ /* context = SDLActivity.getContext(); */
+ context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midGetContext);
+
+ /* assetManager = context.getAssets(); */
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
+ "getAssets", "()Landroid/content/res/AssetManager;");
+ assetManager = (*mEnv)->CallObjectMethod(mEnv, context, mid);
+
+ /* First let's try opening the file to obtain an AssetFileDescriptor.
+ * This method reads the files directly from the APKs using standard *nix calls
+ */
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;");
+ inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString);
+ if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
+ goto fallback;
+ }
+
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getStartOffset", "()J");
+ ctx->hidden.androidio.offset = (*mEnv)->CallLongMethod(mEnv, inputStream, mid);
+ if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
+ goto fallback;
+ }
+
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getDeclaredLength", "()J");
+ ctx->hidden.androidio.size = (*mEnv)->CallLongMethod(mEnv, inputStream, mid);
+ if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
+ goto fallback;
+ }
+
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getFileDescriptor", "()Ljava/io/FileDescriptor;");
+ fd = (*mEnv)->CallObjectMethod(mEnv, inputStream, mid);
+ fdCls = (*mEnv)->GetObjectClass(mEnv, fd);
+ descriptor = (*mEnv)->GetFieldID(mEnv, fdCls, "descriptor", "I");
+ ctx->hidden.androidio.fd = (*mEnv)->GetIntField(mEnv, fd, descriptor);
+ ctx->hidden.androidio.assetFileDescriptorRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);
+
+ /* Seek to the correct offset in the file. */
+ lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET);
+
+ if (0) {
+fallback:
+ /* Disabled log message because of spam on the Nexus 7 */
+ /* __android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file"); */
+
+ /* Try the old method using InputStream */
+ ctx->hidden.androidio.assetFileDescriptorRef = NULL;
+
+ /* inputStream = assetManager.open(<filename>); */
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager),
+ "open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
+ inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ /* Try fallback to APK expansion files */
+ inputStream = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString);
+
+ /* Exception is checked first because it always needs to be cleared.
+ * If no exception occurred then the last SDL error message is kept.
+ */
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE) || !inputStream) {
+ goto failure;
+ }
+ }
+
+ ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);
+
+ /* Despite all the visible documentation on [Asset]InputStream claiming
+ * that the .available() method is not guaranteed to return the entire file
+ * size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
+ * android/apis/content/ReadAsset.java imply that Android's
+ * AssetInputStream.available() /will/ always return the total file size
+ */
+
+ /* size = inputStream.available(); */
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream),
+ "available", "()I");
+ ctx->hidden.androidio.size = (long)(*mEnv)->CallIntMethod(mEnv, inputStream, mid);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ goto failure;
+ }
+
+ /* readableByteChannel = Channels.newChannel(inputStream); */
+ channels = (*mEnv)->FindClass(mEnv, "java/nio/channels/Channels");
+ mid = (*mEnv)->GetStaticMethodID(mEnv, channels,
+ "newChannel",
+ "(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;");
+ readableByteChannel = (*mEnv)->CallStaticObjectMethod(
+ mEnv, channels, mid, inputStream);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ goto failure;
+ }
+
+ ctx->hidden.androidio.readableByteChannelRef =
+ (*mEnv)->NewGlobalRef(mEnv, readableByteChannel);
+
+ /* Store .read id for reading purposes */
+ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, readableByteChannel),
+ "read", "(Ljava/nio/ByteBuffer;)I");
+ ctx->hidden.androidio.readMethod = mid;
+ }
+
+ if (0) {
+failure:
+ result = -1;
+
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.fileNameRef);
+
+ if(ctx->hidden.androidio.inputStreamRef != NULL) {
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.inputStreamRef);
+ }
+
+ if(ctx->hidden.androidio.readableByteChannelRef != NULL) {
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.readableByteChannelRef);
+ }
+
+ if(ctx->hidden.androidio.assetFileDescriptorRef != NULL) {
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.assetFileDescriptorRef);
+ }
+
+ }
+
+ LocalReferenceHolder_Cleanup(&refs);
+ return result;
+}
+
+int Android_JNI_FileOpen(SDL_RWops* ctx,
+ const char* fileName, const char* mode)
+{
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+ int retval;
+ jstring fileNameJString;
+
+ if (!LocalReferenceHolder_Init(&refs, mEnv)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return -1;
+ }
+
+ if (!ctx) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return -1;
+ }
+
+ fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName);
+ ctx->hidden.androidio.fileNameRef = (*mEnv)->NewGlobalRef(mEnv, fileNameJString);
+ ctx->hidden.androidio.inputStreamRef = NULL;
+ ctx->hidden.androidio.readableByteChannelRef = NULL;
+ ctx->hidden.androidio.readMethod = NULL;
+ ctx->hidden.androidio.assetFileDescriptorRef = NULL;
+
+ retval = Internal_Android_JNI_FileOpen(ctx);
+ LocalReferenceHolder_Cleanup(&refs);
+ return retval;
+}
+
+size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer,
+ size_t size, size_t maxnum)
+{
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+
+ if (ctx->hidden.androidio.assetFileDescriptorRef) {
+ size_t bytesMax = size * maxnum;
+ size_t result;
+ if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) {
+ bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position;
+ }
+ result = read(ctx->hidden.androidio.fd, buffer, bytesMax );
+ if (result > 0) {
+ ctx->hidden.androidio.position += result;
+ LocalReferenceHolder_Cleanup(&refs);
+ return result / size;
+ }
+ LocalReferenceHolder_Cleanup(&refs);
+ return 0;
+ } else {
+ jlong bytesRemaining = (jlong) (size * maxnum);
+ jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position);
+ int bytesRead = 0;
+ JNIEnv *mEnv;
+ jobject readableByteChannel;
+ jmethodID readMethod;
+ jobject byteBuffer;
+
+ /* Don't read more bytes than those that remain in the file, otherwise we get an exception */
+ if (bytesRemaining > bytesMax) bytesRemaining = bytesMax;
+
+ mEnv = Android_JNI_GetEnv();
+ if (!LocalReferenceHolder_Init(&refs, mEnv)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return 0;
+ }
+
+ readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef;
+ readMethod = (jmethodID)ctx->hidden.androidio.readMethod;
+ byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining);
+
+ while (bytesRemaining > 0) {
+ /* result = readableByteChannel.read(...); */
+ int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer);
+
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return 0;
+ }
+
+ if (result < 0) {
+ break;
+ }
+
+ bytesRemaining -= result;
+ bytesRead += result;
+ ctx->hidden.androidio.position += result;
+ }
+ LocalReferenceHolder_Cleanup(&refs);
+ return bytesRead / size;
+ }
+}
+
+size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer,
+ size_t size, size_t num)
+{
+ SDL_SetError("Cannot write to Android package filesystem");
+ return 0;
+}
+
+static int Internal_Android_JNI_FileClose(SDL_RWops* ctx, SDL_bool release)
+{
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+
+ int result = 0;
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+
+ if (!LocalReferenceHolder_Init(&refs, mEnv)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return SDL_SetError("Failed to allocate enough JVM local references");
+ }
+
+ if (ctx) {
+ if (release) {
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.fileNameRef);
+ }
+
+ if (ctx->hidden.androidio.assetFileDescriptorRef) {
+ jobject inputStream = (jobject)ctx->hidden.androidio.assetFileDescriptorRef;
+ jmethodID mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream),
+ "close", "()V");
+ (*mEnv)->CallVoidMethod(mEnv, inputStream, mid);
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.assetFileDescriptorRef);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ result = -1;
+ }
+ }
+ else {
+ jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef;
+
+ /* inputStream.close(); */
+ jmethodID mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream),
+ "close", "()V");
+ (*mEnv)->CallVoidMethod(mEnv, inputStream, mid);
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.inputStreamRef);
+ (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.readableByteChannelRef);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ result = -1;
+ }
+ }
+
+ if (release) {
+ SDL_FreeRW(ctx);
+ }
+ }
+
+ LocalReferenceHolder_Cleanup(&refs);
+ return result;
+}
+
+
+Sint64 Android_JNI_FileSize(SDL_RWops* ctx)
+{
+ return ctx->hidden.androidio.size;
+}
+
+Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence)
+{
+ if (ctx->hidden.androidio.assetFileDescriptorRef) {
+ off_t ret;
+ switch (whence) {
+ case RW_SEEK_SET:
+ if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size;
+ offset += ctx->hidden.androidio.offset;
+ break;
+ case RW_SEEK_CUR:
+ offset += ctx->hidden.androidio.position;
+ if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size;
+ offset += ctx->hidden.androidio.offset;
+ break;
+ case RW_SEEK_END:
+ offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset;
+ break;
+ default:
+ return SDL_SetError("Unknown value for 'whence'");
+ }
+ whence = SEEK_SET;
+
+ ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET);
+ if (ret == -1) return -1;
+ ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset;
+ } else {
+ Sint64 newPosition;
+ Sint64 movement;
+
+ switch (whence) {
+ case RW_SEEK_SET:
+ newPosition = offset;
+ break;
+ case RW_SEEK_CUR:
+ newPosition = ctx->hidden.androidio.position + offset;
+ break;
+ case RW_SEEK_END:
+ newPosition = ctx->hidden.androidio.size + offset;
+ break;
+ default:
+ return SDL_SetError("Unknown value for 'whence'");
+ }
+
+ /* Validate the new position */
+ if (newPosition < 0) {
+ return SDL_Error(SDL_EFSEEK);
+ }
+ if (newPosition > ctx->hidden.androidio.size) {
+ newPosition = ctx->hidden.androidio.size;
+ }
+
+ movement = newPosition - ctx->hidden.androidio.position;
+ if (movement > 0) {
+ unsigned char buffer[4096];
+
+ /* The easy case where we're seeking forwards */
+ while (movement > 0) {
+ Sint64 amount = sizeof (buffer);
+ size_t result;
+ if (amount > movement) {
+ amount = movement;
+ }
+ result = Android_JNI_FileRead(ctx, buffer, 1, amount);
+ if (result <= 0) {
+ /* Failed to read/skip the required amount, so fail */
+ return -1;
+ }
+
+ movement -= result;
+ }
+
+ } else if (movement < 0) {
+ /* We can't seek backwards so we have to reopen the file and seek */
+ /* forwards which obviously isn't very efficient */
+ Internal_Android_JNI_FileClose(ctx, SDL_FALSE);
+ Internal_Android_JNI_FileOpen(ctx);
+ Android_JNI_FileSeek(ctx, newPosition, RW_SEEK_SET);
+ }
+ }
+
+ return ctx->hidden.androidio.position;
+
+}
+
+int Android_JNI_FileClose(SDL_RWops* ctx)
+{
+ return Internal_Android_JNI_FileClose(ctx, SDL_TRUE);
+}
+
+int Android_JNI_SetClipboardText(const char* text)
+{
+ JNIEnv* env = Android_JNI_GetEnv();
+ jstring string = (*env)->NewStringUTF(env, text);
+ (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string);
+ (*env)->DeleteLocalRef(env, string);
+ return 0;
+}
+
+char* Android_JNI_GetClipboardText(void)
+{
+ JNIEnv* env = Android_JNI_GetEnv();
+ char* text = NULL;
+ jstring string;
+
+ string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText);
+ if (string) {
+ const char* utf = (*env)->GetStringUTFChars(env, string, 0);
+ if (utf) {
+ text = SDL_strdup(utf);
+ (*env)->ReleaseStringUTFChars(env, string, utf);
+ }
+ (*env)->DeleteLocalRef(env, string);
+ }
+
+ return (text == NULL) ? SDL_strdup("") : text;
+}
+
+SDL_bool Android_JNI_HasClipboardText(void)
+{
+ JNIEnv* env = Android_JNI_GetEnv();
+ jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText);
+ return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE;
+}
+
+/* returns 0 on success or -1 on error (others undefined then)
+ * returns truthy or falsy value in plugged, charged and battery
+ * returns the value in seconds and percent or -1 if not available
+ */
+int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent)
+{
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+ JNIEnv* env = Android_JNI_GetEnv();
+ jmethodID mid;
+ jobject context;
+ jstring action;
+ jclass cls;
+ jobject filter;
+ jobject intent;
+ jstring iname;
+ jmethodID imid;
+ jstring bname;
+ jmethodID bmid;
+ if (!LocalReferenceHolder_Init(&refs, env)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return -1;
+ }
+
+
+ /* context = SDLActivity.getContext(); */
+ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
+
+ action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED");
+
+ cls = (*env)->FindClass(env, "android/content/IntentFilter");
+
+ mid = (*env)->GetMethodID(env, cls, "<init>", "(Ljava/lang/String;)V");
+ filter = (*env)->NewObject(env, cls, mid, action);
+
+ (*env)->DeleteLocalRef(env, action);
+
+ mid = (*env)->GetMethodID(env, mActivityClass, "registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;");
+ intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter);
+
+ (*env)->DeleteLocalRef(env, filter);
+
+ cls = (*env)->GetObjectClass(env, intent);
+
+ imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I");
+
+ /* Watch out for C89 scoping rules because of the macro */
+#define GET_INT_EXTRA(var, key) \
+ int var; \
+ iname = (*env)->NewStringUTF(env, key); \
+ var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \
+ (*env)->DeleteLocalRef(env, iname);
+
+ bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z");
+
+ /* Watch out for C89 scoping rules because of the macro */
+#define GET_BOOL_EXTRA(var, key) \
+ int var; \
+ bname = (*env)->NewStringUTF(env, key); \
+ var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \
+ (*env)->DeleteLocalRef(env, bname);
+
+ if (plugged) {
+ /* Watch out for C89 scoping rules because of the macro */
+ GET_INT_EXTRA(plug, "plugged") /* == BatteryManager.EXTRA_PLUGGED (API 5) */
+ if (plug == -1) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return -1;
+ }
+ /* 1 == BatteryManager.BATTERY_PLUGGED_AC */
+ /* 2 == BatteryManager.BATTERY_PLUGGED_USB */
+ *plugged = (0 < plug) ? 1 : 0;
+ }
+
+ if (charged) {
+ /* Watch out for C89 scoping rules because of the macro */
+ GET_INT_EXTRA(status, "status") /* == BatteryManager.EXTRA_STATUS (API 5) */
+ if (status == -1) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return -1;
+ }
+ /* 5 == BatteryManager.BATTERY_STATUS_FULL */
+ *charged = (status == 5) ? 1 : 0;
+ }
+
+ if (battery) {
+ GET_BOOL_EXTRA(present, "present") /* == BatteryManager.EXTRA_PRESENT (API 5) */
+ *battery = present ? 1 : 0;
+ }
+
+ if (seconds) {
+ *seconds = -1; /* not possible */
+ }
+
+ if (percent) {
+ int level;
+ int scale;
+
+ /* Watch out for C89 scoping rules because of the macro */
+ {
+ GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */
+ level = level_temp;
+ }
+ /* Watch out for C89 scoping rules because of the macro */
+ {
+ GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */
+ scale = scale_temp;
+ }
+
+ if ((level == -1) || (scale == -1)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return -1;
+ }
+ *percent = level * 100 / scale;
+ }
+
+ (*env)->DeleteLocalRef(env, intent);
+
+ LocalReferenceHolder_Cleanup(&refs);
+ return 0;
+}
+
+/* returns number of found touch devices as return value and ids in parameter ids */
+int Android_JNI_GetTouchDeviceIds(int **ids) {
+ JNIEnv *env = Android_JNI_GetEnv();
+ jint sources = 4098; /* == InputDevice.SOURCE_TOUCHSCREEN */
+ jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, midInputGetInputDeviceIds, sources);
+ int number = 0;
+ *ids = NULL;
+ if (array) {
+ number = (int) (*env)->GetArrayLength(env, array);
+ if (0 < number) {
+ jint* elements = (*env)->GetIntArrayElements(env, array, NULL);
+ if (elements) {
+ int i;
+ *ids = SDL_malloc(number * sizeof (**ids));
+ for (i = 0; i < number; ++i) { /* not assuming sizeof (jint) == sizeof (int) */
+ (*ids)[i] = elements[i];
+ }
+ (*env)->ReleaseIntArrayElements(env, array, elements, JNI_ABORT);
+ }
+ }
+ (*env)->DeleteLocalRef(env, array);
+ }
+ return number;
+}
+
+/* sets the mSeparateMouseAndTouch field */
+void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ (*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE);
+}
+
+void Android_JNI_PollInputDevices(void)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollInputDevices);
+}
+
+void Android_JNI_PollHapticDevices(void)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollHapticDevices);
+}
+
+void Android_JNI_HapticRun(int device_id, int length)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, length);
+}
+
+
+/* See SDLActivity.java for constants. */
+#define COMMAND_SET_KEEP_SCREEN_ON 5
+
+/* sends message to be handled on the UI event dispatch thread */
+int Android_JNI_SendMessage(int command, int param)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ jboolean success;
+ success = (*env)->CallStaticBooleanMethod(env, mActivityClass, midSendMessage, command, param);
+ return success ? 0 : -1;
+}
+
+void Android_JNI_SuspendScreenSaver(SDL_bool suspend)
+{
+ Android_JNI_SendMessage(COMMAND_SET_KEEP_SCREEN_ON, (suspend == SDL_FALSE) ? 0 : 1);
+}
+
+void Android_JNI_ShowTextInput(SDL_Rect *inputRect)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput,
+ inputRect->x,
+ inputRect->y,
+ inputRect->w,
+ inputRect->h );
+}
+
+void Android_JNI_HideTextInput(void)
+{
+ /* has to match Activity constant */
+ const int COMMAND_TEXTEDIT_HIDE = 3;
+ Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0);
+}
+
+SDL_bool Android_JNI_IsScreenKeyboardShown()
+{
+ JNIEnv *mEnv = Android_JNI_GetEnv();
+ jboolean is_shown = 0;
+ is_shown = (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midIsScreenKeyboardShown);
+ return is_shown;
+}
+
+
+int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ JNIEnv *env;
+ jclass clazz;
+ jmethodID mid;
+ jobject context;
+ jstring title;
+ jstring message;
+ jintArray button_flags;
+ jintArray button_ids;
+ jobjectArray button_texts;
+ jintArray colors;
+ jobject text;
+ jint temp;
+ int i;
+
+ env = Android_JNI_GetEnv();
+
+ /* convert parameters */
+
+ clazz = (*env)->FindClass(env, "java/lang/String");
+
+ title = (*env)->NewStringUTF(env, messageboxdata->title);
+ message = (*env)->NewStringUTF(env, messageboxdata->message);
+
+ button_flags = (*env)->NewIntArray(env, messageboxdata->numbuttons);
+ button_ids = (*env)->NewIntArray(env, messageboxdata->numbuttons);
+ button_texts = (*env)->NewObjectArray(env, messageboxdata->numbuttons,
+ clazz, NULL);
+ for (i = 0; i < messageboxdata->numbuttons; ++i) {
+ temp = messageboxdata->buttons[i].flags;
+ (*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp);
+ temp = messageboxdata->buttons[i].buttonid;
+ (*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp);
+ text = (*env)->NewStringUTF(env, messageboxdata->buttons[i].text);
+ (*env)->SetObjectArrayElement(env, button_texts, i, text);
+ (*env)->DeleteLocalRef(env, text);
+ }
+
+ if (messageboxdata->colorScheme) {
+ colors = (*env)->NewIntArray(env, SDL_MESSAGEBOX_COLOR_MAX);
+ for (i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; ++i) {
+ temp = (0xFF << 24) |
+ (messageboxdata->colorScheme->colors[i].r << 16) |
+ (messageboxdata->colorScheme->colors[i].g << 8) |
+ (messageboxdata->colorScheme->colors[i].b << 0);
+ (*env)->SetIntArrayRegion(env, colors, i, 1, &temp);
+ }
+ } else {
+ colors = NULL;
+ }
+
+ (*env)->DeleteLocalRef(env, clazz);
+
+ /* context = SDLActivity.getContext(); */
+ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
+
+ clazz = (*env)->GetObjectClass(env, context);
+
+ mid = (*env)->GetMethodID(env, clazz,
+ "messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I");
+ *buttonid = (*env)->CallIntMethod(env, context, mid,
+ messageboxdata->flags,
+ title,
+ message,
+ button_flags,
+ button_ids,
+ button_texts,
+ colors);
+
+ (*env)->DeleteLocalRef(env, context);
+ (*env)->DeleteLocalRef(env, clazz);
+
+ /* delete parameters */
+
+ (*env)->DeleteLocalRef(env, title);
+ (*env)->DeleteLocalRef(env, message);
+ (*env)->DeleteLocalRef(env, button_flags);
+ (*env)->DeleteLocalRef(env, button_ids);
+ (*env)->DeleteLocalRef(env, button_texts);
+ (*env)->DeleteLocalRef(env, colors);
+
+ return 0;
+}
+
+/*
+//////////////////////////////////////////////////////////////////////////////
+//
+// Functions exposed to SDL applications in SDL_system.h
+//////////////////////////////////////////////////////////////////////////////
+*/
+
+void *SDL_AndroidGetJNIEnv(void)
+{
+ return Android_JNI_GetEnv();
+}
+
+void *SDL_AndroidGetActivity(void)
+{
+ /* See SDL_system.h for caveats on using this function. */
+
+ JNIEnv *env = Android_JNI_GetEnv();
+ if (!env) {
+ return NULL;
+ }
+
+ /* return SDLActivity.getContext(); */
+ return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
+}
+
+SDL_bool SDL_IsAndroidTV(void)
+{
+ JNIEnv *env = Android_JNI_GetEnv();
+ return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV);
+}
+
+const char * SDL_AndroidGetInternalStoragePath(void)
+{
+ static char *s_AndroidInternalFilesPath = NULL;
+
+ if (!s_AndroidInternalFilesPath) {
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+ jmethodID mid;
+ jobject context;
+ jobject fileObject;
+ jstring pathString;
+ const char *path;
+
+ JNIEnv *env = Android_JNI_GetEnv();
+ if (!LocalReferenceHolder_Init(&refs, env)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
+
+ /* context = SDLActivity.getContext(); */
+ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
+ if (!context) {
+ SDL_SetError("Couldn't get Android context!");
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
+
+ /* fileObj = context.getFilesDir(); */
+ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
+ "getFilesDir", "()Ljava/io/File;");
+ fileObject = (*env)->CallObjectMethod(env, context, mid);
+ if (!fileObject) {
+ SDL_SetError("Couldn't get internal directory");
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
+
+ /* path = fileObject.getCanonicalPath(); */
+ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject),
+ "getCanonicalPath", "()Ljava/lang/String;");
+ pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
+
+ path = (*env)->GetStringUTFChars(env, pathString, NULL);
+ s_AndroidInternalFilesPath = SDL_strdup(path);
+ (*env)->ReleaseStringUTFChars(env, pathString, path);
+
+ LocalReferenceHolder_Cleanup(&refs);
+ }
+ return s_AndroidInternalFilesPath;
+}
+
+int SDL_AndroidGetExternalStorageState(void)
+{
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+ jmethodID mid;
+ jclass cls;
+ jstring stateString;
+ const char *state;
+ int stateFlags;
+
+ JNIEnv *env = Android_JNI_GetEnv();
+ if (!LocalReferenceHolder_Init(&refs, env)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return 0;
+ }
+
+ cls = (*env)->FindClass(env, "android/os/Environment");
+ mid = (*env)->GetStaticMethodID(env, cls,
+ "getExternalStorageState", "()Ljava/lang/String;");
+ stateString = (jstring)(*env)->CallStaticObjectMethod(env, cls, mid);
+
+ state = (*env)->GetStringUTFChars(env, stateString, NULL);
+
+ /* Print an info message so people debugging know the storage state */
+ __android_log_print(ANDROID_LOG_INFO, "SDL", "external storage state: %s", state);
+
+ if (SDL_strcmp(state, "mounted") == 0) {
+ stateFlags = SDL_ANDROID_EXTERNAL_STORAGE_READ |
+ SDL_ANDROID_EXTERNAL_STORAGE_WRITE;
+ } else if (SDL_strcmp(state, "mounted_ro") == 0) {
+ stateFlags = SDL_ANDROID_EXTERNAL_STORAGE_READ;
+ } else {
+ stateFlags = 0;
+ }
+ (*env)->ReleaseStringUTFChars(env, stateString, state);
+
+ LocalReferenceHolder_Cleanup(&refs);
+ return stateFlags;
+}
+
+const char * SDL_AndroidGetExternalStoragePath(void)
+{
+ static char *s_AndroidExternalFilesPath = NULL;
+
+ if (!s_AndroidExternalFilesPath) {
+ struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
+ jmethodID mid;
+ jobject context;
+ jobject fileObject;
+ jstring pathString;
+ const char *path;
+
+ JNIEnv *env = Android_JNI_GetEnv();
+ if (!LocalReferenceHolder_Init(&refs, env)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
+
+ /* context = SDLActivity.getContext(); */
+ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
+
+ /* fileObj = context.getExternalFilesDir(); */
+ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
+ "getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;");
+ fileObject = (*env)->CallObjectMethod(env, context, mid, NULL);
+ if (!fileObject) {
+ SDL_SetError("Couldn't get external directory");
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
+
+ /* path = fileObject.getAbsolutePath(); */
+ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject),
+ "getAbsolutePath", "()Ljava/lang/String;");
+ pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid);
+
+ path = (*env)->GetStringUTFChars(env, pathString, NULL);
+ s_AndroidExternalFilesPath = SDL_strdup(path);
+ (*env)->ReleaseStringUTFChars(env, pathString, path);
+
+ LocalReferenceHolder_Cleanup(&refs);
+ }
+ return s_AndroidExternalFilesPath;
+}
+
+void Android_JNI_GetManifestEnvironmentVariables(void)
+{
+ if (!mActivityClass || !midGetManifestEnvironmentVariables) {
+ __android_log_print(ANDROID_LOG_WARN, "SDL", "Request to get environment variables before JNI is ready");
+ return;
+ }
+
+ if (!bHasEnvironmentVariables) {
+ JNIEnv *env = Android_JNI_GetEnv();
+ SDL_bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables);
+ if (ret) {
+ bHasEnvironmentVariables = SDL_TRUE;
+ }
+ }
+}
+
+#endif /* __ANDROID__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/android/SDL_android.h b/src/3rdparty/SDL2/src/core/android/SDL_android.h
new file mode 100644
index 0000000..c800dc6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/android/SDL_android.h
@@ -0,0 +1,112 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+#include <EGL/eglplatform.h>
+#include <android/native_window_jni.h>
+
+#include "SDL_rect.h"
+
+/* Interface from the SDL library into the Android Java activity */
+extern void Android_JNI_SetActivityTitle(const char *title);
+extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen);
+extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint);
+
+extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]);
+extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
+extern void Android_JNI_HideTextInput(void);
+extern SDL_bool Android_JNI_IsScreenKeyboardShown(void);
+extern ANativeWindow* Android_JNI_GetNativeWindow(void);
+
+extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi);
+
+/* Audio support */
+extern int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames);
+extern void* Android_JNI_GetAudioBuffer(void);
+extern void Android_JNI_WriteAudioBuffer(void);
+extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen);
+extern void Android_JNI_FlushCapturedAudio(void);
+extern void Android_JNI_CloseAudioDevice(const int iscapture);
+
+#include "SDL_rwops.h"
+
+int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode);
+Sint64 Android_JNI_FileSize(SDL_RWops* ctx);
+Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence);
+size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum);
+size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num);
+int Android_JNI_FileClose(SDL_RWops* ctx);
+
+/* Environment support */
+void Android_JNI_GetManifestEnvironmentVariables(void);
+
+/* Clipboard support */
+int Android_JNI_SetClipboardText(const char* text);
+char* Android_JNI_GetClipboardText(void);
+SDL_bool Android_JNI_HasClipboardText(void);
+
+/* Power support */
+int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
+
+/* Joystick support */
+void Android_JNI_PollInputDevices(void);
+
+/* Haptic support */
+void Android_JNI_PollHapticDevices(void);
+void Android_JNI_HapticRun(int device_id, int length);
+
+/* Video */
+void Android_JNI_SuspendScreenSaver(SDL_bool suspend);
+
+/* Touch support */
+int Android_JNI_GetTouchDeviceIds(int **ids);
+void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
+
+/* Threads */
+#include <jni.h>
+JNIEnv *Android_JNI_GetEnv(void);
+int Android_JNI_SetupThread(void);
+
+/* Generic messages */
+int Android_JNI_SendMessage(int command, int param);
+
+/* Init */
+JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls);
+
+/* MessageBox */
+#include "SDL_messagebox.h"
+int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/android/keyinfotable.h b/src/3rdparty/SDL2/src/core/android/keyinfotable.h
new file mode 100644
index 0000000..4437121
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/android/keyinfotable.h
@@ -0,0 +1,175 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef _ANDROID_KeyInfo
+#define _ANDROID_KeyInfo
+
+#include "SDL_scancode.h"
+#include "SDL_keycode.h"
+
+/*
+ This file is used by the keyboard code in SDL_uikitview.m to convert between characters
+ passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods.
+ For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
+ case a.
+*/
+
+typedef struct
+{
+ SDL_Scancode code;
+ uint16_t mod;
+} AndroidKeyInfo;
+
+/* So far only ASCII characters here */
+static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = {
+/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 13 */ { SDL_SCANCODE_RETURN, 0 },
+/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 32 */ { SDL_SCANCODE_SPACE, 0 },
+/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */
+/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */
+/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */
+/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */
+/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */
+/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */
+/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */
+/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */
+/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */
+/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */
+/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */
+/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */
+/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */
+/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */
+/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */
+/* 48 */ { SDL_SCANCODE_0, 0 },
+/* 49 */ { SDL_SCANCODE_1, 0 },
+/* 50 */ { SDL_SCANCODE_2, 0 },
+/* 51 */ { SDL_SCANCODE_3, 0 },
+/* 52 */ { SDL_SCANCODE_4, 0 },
+/* 53 */ { SDL_SCANCODE_5, 0 },
+/* 54 */ { SDL_SCANCODE_6, 0 },
+/* 55 */ { SDL_SCANCODE_7, 0 },
+/* 56 */ { SDL_SCANCODE_8, 0 },
+/* 57 */ { SDL_SCANCODE_9, 0 },
+/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */
+/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 },
+/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */
+/* 61 */ { SDL_SCANCODE_EQUALS, 0 },
+/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */
+/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */
+/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */
+/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */
+/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT },
+/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT },
+/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT },
+/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT },
+/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT },
+/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT },
+/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT },
+/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT },
+/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT },
+/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT },
+/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT },
+/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT },
+/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT },
+/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT },
+/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT },
+/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT },
+/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT },
+/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT },
+/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT },
+/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT },
+/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT },
+/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT },
+/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT },
+/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT },
+/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT },
+/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 },
+/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 },
+/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 },
+/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */
+/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */
+/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */
+/* 97 */ { SDL_SCANCODE_A, 0 },
+/* 98 */ { SDL_SCANCODE_B, 0 },
+/* 99 */ { SDL_SCANCODE_C, 0 },
+/* 100 */{ SDL_SCANCODE_D, 0 },
+/* 101 */{ SDL_SCANCODE_E, 0 },
+/* 102 */{ SDL_SCANCODE_F, 0 },
+/* 103 */{ SDL_SCANCODE_G, 0 },
+/* 104 */{ SDL_SCANCODE_H, 0 },
+/* 105 */{ SDL_SCANCODE_I, 0 },
+/* 106 */{ SDL_SCANCODE_J, 0 },
+/* 107 */{ SDL_SCANCODE_K, 0 },
+/* 108 */{ SDL_SCANCODE_L, 0 },
+/* 109 */{ SDL_SCANCODE_M, 0 },
+/* 110 */{ SDL_SCANCODE_N, 0 },
+/* 111 */{ SDL_SCANCODE_O, 0 },
+/* 112 */{ SDL_SCANCODE_P, 0 },
+/* 113 */{ SDL_SCANCODE_Q, 0 },
+/* 114 */{ SDL_SCANCODE_R, 0 },
+/* 115 */{ SDL_SCANCODE_S, 0 },
+/* 116 */{ SDL_SCANCODE_T, 0 },
+/* 117 */{ SDL_SCANCODE_U, 0 },
+/* 118 */{ SDL_SCANCODE_V, 0 },
+/* 119 */{ SDL_SCANCODE_W, 0 },
+/* 120 */{ SDL_SCANCODE_X, 0 },
+/* 121 */{ SDL_SCANCODE_Y, 0 },
+/* 122 */{ SDL_SCANCODE_Z, 0 },
+/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */
+/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */
+/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */
+/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */
+/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
+};
+
+#endif /* _ANDROID_KeyInfo */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_dbus.c b/src/3rdparty/SDL2/src/core/linux/SDL_dbus.c
new file mode 100644
index 0000000..ff4f0fe
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_dbus.c
@@ -0,0 +1,335 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "SDL_dbus.h"
+
+#if SDL_USE_LIBDBUS
+/* we never link directly to libdbus. */
+#include "SDL_loadso.h"
+static const char *dbus_library = "libdbus-1.so.3";
+static void *dbus_handle = NULL;
+static unsigned int screensaver_cookie = 0;
+static SDL_DBusContext dbus;
+
+static int
+LoadDBUSSyms(void)
+{
+ #define SDL_DBUS_SYM2(x, y) \
+ if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1
+
+ #define SDL_DBUS_SYM(x) \
+ SDL_DBUS_SYM2(x, dbus_##x)
+
+ SDL_DBUS_SYM(bus_get_private);
+ SDL_DBUS_SYM(bus_register);
+ SDL_DBUS_SYM(bus_add_match);
+ SDL_DBUS_SYM(connection_open_private);
+ SDL_DBUS_SYM(connection_set_exit_on_disconnect);
+ SDL_DBUS_SYM(connection_get_is_connected);
+ SDL_DBUS_SYM(connection_add_filter);
+ SDL_DBUS_SYM(connection_try_register_object_path);
+ SDL_DBUS_SYM(connection_send);
+ SDL_DBUS_SYM(connection_send_with_reply_and_block);
+ SDL_DBUS_SYM(connection_close);
+ SDL_DBUS_SYM(connection_unref);
+ SDL_DBUS_SYM(connection_flush);
+ SDL_DBUS_SYM(connection_read_write);
+ SDL_DBUS_SYM(connection_dispatch);
+ SDL_DBUS_SYM(message_is_signal);
+ SDL_DBUS_SYM(message_new_method_call);
+ SDL_DBUS_SYM(message_append_args);
+ SDL_DBUS_SYM(message_append_args_valist);
+ SDL_DBUS_SYM(message_get_args);
+ SDL_DBUS_SYM(message_get_args_valist);
+ SDL_DBUS_SYM(message_iter_init);
+ SDL_DBUS_SYM(message_iter_next);
+ SDL_DBUS_SYM(message_iter_get_basic);
+ SDL_DBUS_SYM(message_iter_get_arg_type);
+ SDL_DBUS_SYM(message_iter_recurse);
+ SDL_DBUS_SYM(message_unref);
+ SDL_DBUS_SYM(error_init);
+ SDL_DBUS_SYM(error_is_set);
+ SDL_DBUS_SYM(error_free);
+ SDL_DBUS_SYM(get_local_machine_id);
+ SDL_DBUS_SYM(free);
+ SDL_DBUS_SYM(free_string_array);
+ SDL_DBUS_SYM(shutdown);
+
+ #undef SDL_DBUS_SYM
+ #undef SDL_DBUS_SYM2
+
+ return 0;
+}
+
+static void
+UnloadDBUSLibrary(void)
+{
+ if (dbus_handle != NULL) {
+ SDL_UnloadObject(dbus_handle);
+ dbus_handle = NULL;
+ }
+}
+
+static int
+LoadDBUSLibrary(void)
+{
+ int retval = 0;
+ if (dbus_handle == NULL) {
+ dbus_handle = SDL_LoadObject(dbus_library);
+ if (dbus_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = LoadDBUSSyms();
+ if (retval < 0) {
+ UnloadDBUSLibrary();
+ }
+ }
+ }
+
+ return retval;
+}
+
+void
+SDL_DBus_Init(void)
+{
+ if (!dbus.session_conn && LoadDBUSLibrary() != -1) {
+ DBusError err;
+ dbus.error_init(&err);
+ dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
+ if (!dbus.error_is_set(&err)) {
+ dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
+ }
+ if (dbus.error_is_set(&err)) {
+ dbus.error_free(&err);
+ SDL_DBus_Quit();
+ return; /* oh well */
+ }
+ dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
+ dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0);
+ }
+}
+
+void
+SDL_DBus_Quit(void)
+{
+ if (dbus.system_conn) {
+ dbus.connection_close(dbus.system_conn);
+ dbus.connection_unref(dbus.system_conn);
+ }
+ if (dbus.session_conn) {
+ dbus.connection_close(dbus.session_conn);
+ dbus.connection_unref(dbus.session_conn);
+ }
+/* Don't do this - bug 3950
+ dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it.
+*/
+#if 0
+ if (dbus.shutdown) {
+ dbus.shutdown();
+ }
+#endif
+ SDL_zero(dbus);
+ UnloadDBUSLibrary();
+}
+
+SDL_DBusContext *
+SDL_DBus_GetContext(void)
+{
+ if(!dbus_handle || !dbus.session_conn){
+ SDL_DBus_Init();
+ }
+
+ if(dbus_handle && dbus.session_conn){
+ return &dbus;
+ } else {
+ return NULL;
+ }
+}
+
+static SDL_bool
+SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap)
+{
+ SDL_bool retval = SDL_FALSE;
+
+ if (conn) {
+ DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method);
+ if (msg) {
+ int firstarg = va_arg(ap, int);
+ if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) {
+ DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL);
+ if (reply) {
+ firstarg = va_arg(ap, int);
+ if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap)) {
+ retval = SDL_TRUE;
+ }
+ dbus.message_unref(reply);
+ }
+ }
+ dbus.message_unref(msg);
+ }
+ }
+
+ return retval;
+}
+
+SDL_bool
+SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
+{
+ SDL_bool retval;
+ va_list ap;
+ va_start(ap, method);
+ retval = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap);
+ va_end(ap);
+ return retval;
+}
+
+SDL_bool
+SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
+{
+ SDL_bool retval;
+ va_list ap;
+ va_start(ap, method);
+ retval = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap);
+ va_end(ap);
+ return retval;
+}
+
+static SDL_bool
+SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap)
+{
+ SDL_bool retval = SDL_FALSE;
+
+ if (conn) {
+ DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method);
+ if (msg) {
+ int firstarg = va_arg(ap, int);
+ if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) {
+ if (dbus.connection_send(conn, msg, NULL)) {
+ dbus.connection_flush(conn);
+ retval = SDL_TRUE;
+ }
+ }
+
+ dbus.message_unref(msg);
+ }
+ }
+
+ return retval;
+}
+
+SDL_bool
+SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
+{
+ SDL_bool retval;
+ va_list ap;
+ va_start(ap, method);
+ retval = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap);
+ va_end(ap);
+ return retval;
+}
+
+SDL_bool
+SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
+{
+ SDL_bool retval;
+ va_list ap;
+ va_start(ap, method);
+ retval = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap);
+ va_end(ap);
+ return retval;
+}
+
+SDL_bool
+SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
+{
+ SDL_bool retval = SDL_FALSE;
+
+ if (conn) {
+ DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get");
+ if (msg) {
+ if (dbus.message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) {
+ DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL);
+ if (reply) {
+ DBusMessageIter iter, sub;
+ dbus.message_iter_init(reply, &iter);
+ if (dbus.message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) {
+ dbus.message_iter_recurse(&iter, &sub);
+ if (dbus.message_iter_get_arg_type(&sub) == expectedtype) {
+ dbus.message_iter_get_basic(&sub, result);
+ retval = SDL_TRUE;
+ }
+ }
+ dbus.message_unref(reply);
+ }
+ }
+ dbus.message_unref(msg);
+ }
+ }
+
+ return retval;
+}
+
+SDL_bool
+SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
+{
+ return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result);
+}
+
+
+void
+SDL_DBus_ScreensaverTickle(void)
+{
+ SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID);
+}
+
+SDL_bool
+SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
+{
+ if ( (inhibit && (screensaver_cookie != 0)) || (!inhibit && (screensaver_cookie == 0)) ) {
+ return SDL_TRUE;
+ } else {
+ const char *node = "org.freedesktop.ScreenSaver";
+ const char *path = "/org/freedesktop/ScreenSaver";
+ const char *interface = "org.freedesktop.ScreenSaver";
+
+ if (inhibit) {
+ const char *app = "My SDL application";
+ const char *reason = "Playing a game";
+ if (!SDL_DBus_CallMethod(node, path, interface, "Inhibit",
+ DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID,
+ DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) {
+ return SDL_FALSE;
+ }
+ return (screensaver_cookie != 0) ? SDL_TRUE : SDL_FALSE;
+ } else {
+ if (!SDL_DBus_CallVoidMethod(node, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) {
+ return SDL_FALSE;
+ }
+ screensaver_cookie = 0;
+ }
+ }
+
+ return SDL_TRUE;
+}
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_dbus.h b/src/3rdparty/SDL2/src/core/linux/SDL_dbus.h
new file mode 100644
index 0000000..062543d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_dbus.h
@@ -0,0 +1,97 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_dbus_h_
+#define SDL_dbus_h_
+
+#ifdef HAVE_DBUS_DBUS_H
+#define SDL_USE_LIBDBUS 1
+#include "SDL_stdinc.h"
+#include <dbus/dbus.h>
+
+
+typedef struct SDL_DBusContext {
+ DBusConnection *session_conn;
+ DBusConnection *system_conn;
+
+ DBusConnection *(*bus_get_private)(DBusBusType, DBusError *);
+ dbus_bool_t (*bus_register)(DBusConnection *, DBusError *);
+ void (*bus_add_match)(DBusConnection *, const char *, DBusError *);
+ DBusConnection * (*connection_open_private)(const char *, DBusError *);
+ void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t);
+ dbus_bool_t (*connection_get_is_connected)(DBusConnection *);
+ dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction,
+ void *, DBusFreeFunction);
+ dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *,
+ const DBusObjectPathVTable *, void *, DBusError *);
+ dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);
+ DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *);
+ void (*connection_close)(DBusConnection *);
+ void (*connection_unref)(DBusConnection *);
+ void (*connection_flush)(DBusConnection *);
+ dbus_bool_t (*connection_read_write)(DBusConnection *, int);
+ DBusDispatchStatus (*connection_dispatch)(DBusConnection *);
+ dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *);
+ DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *);
+ dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);
+ dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list);
+ dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...);
+ dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list);
+ dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *);
+ dbus_bool_t (*message_iter_next)(DBusMessageIter *);
+ void (*message_iter_get_basic)(DBusMessageIter *, void *);
+ int (*message_iter_get_arg_type)(DBusMessageIter *);
+ void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);
+ void (*message_unref)(DBusMessage *);
+ void (*error_init)(DBusError *);
+ dbus_bool_t (*error_is_set)(const DBusError *);
+ void (*error_free)(DBusError *);
+ char *(*get_local_machine_id)(void);
+ void (*free)(void *);
+ void (*free_string_array)(char **);
+ void (*shutdown)(void);
+
+} SDL_DBusContext;
+
+extern void SDL_DBus_Init(void);
+extern void SDL_DBus_Quit(void);
+extern SDL_DBusContext * SDL_DBus_GetContext(void);
+
+/* These use the built-in Session connection. */
+extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...);
+extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...);
+extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
+
+/* These use whatever connection you like. */
+extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
+extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
+extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
+
+extern void SDL_DBus_ScreensaverTickle(void);
+extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit);
+
+#endif /* HAVE_DBUS_DBUS_H */
+
+#endif /* SDL_dbus_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_evdev.c b/src/3rdparty/SDL2/src/core/linux/SDL_evdev.c
new file mode 100644
index 0000000..a506926
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_evdev.c
@@ -0,0 +1,698 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_INPUT_LINUXEV
+
+/* This is based on the linux joystick driver */
+/* References: https://www.kernel.org/doc/Documentation/input/input.txt
+ * https://www.kernel.org/doc/Documentation/input/event-codes.txt
+ * /usr/include/linux/input.h
+ * The evtest application is also useful to debug the protocol
+ */
+
+#include "SDL_evdev.h"
+#include "SDL_evdev_kbd.h"
+
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/input.h>
+
+#include "SDL.h"
+#include "SDL_assert.h"
+#include "SDL_endian.h"
+#include "SDL_scancode.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/scancodes_linux.h" /* adds linux_scancode_table */
+#include "../../core/linux/SDL_udev.h"
+
+/* These are not defined in older Linux kernel headers */
+#ifndef SYN_DROPPED
+#define SYN_DROPPED 3
+#endif
+#ifndef ABS_MT_SLOT
+#define ABS_MT_SLOT 0x2f
+#define ABS_MT_POSITION_X 0x35
+#define ABS_MT_POSITION_Y 0x36
+#define ABS_MT_TRACKING_ID 0x39
+#endif
+
+typedef struct SDL_evdevlist_item
+{
+ char *path;
+ int fd;
+
+ /* TODO: use this for every device, not just touchscreen */
+ int out_of_sync;
+
+ /* TODO: expand on this to have data for every possible class (mouse,
+ keyboard, touchpad, etc.). Also there's probably some things in here we
+ can pull out to the SDL_evdevlist_item i.e. name */
+ int is_touchscreen;
+ struct {
+ char* name;
+
+ int min_x, max_x, range_x;
+ int min_y, max_y, range_y;
+
+ int max_slots;
+ int current_slot;
+ struct {
+ enum {
+ EVDEV_TOUCH_SLOTDELTA_NONE = 0,
+ EVDEV_TOUCH_SLOTDELTA_DOWN,
+ EVDEV_TOUCH_SLOTDELTA_UP,
+ EVDEV_TOUCH_SLOTDELTA_MOVE
+ } delta;
+ int tracking_id;
+ int x, y;
+ } * slots;
+ } * touchscreen_data;
+
+ struct SDL_evdevlist_item *next;
+} SDL_evdevlist_item;
+
+typedef struct SDL_EVDEV_PrivateData
+{
+ int ref_count;
+ int num_devices;
+ SDL_evdevlist_item *first;
+ SDL_evdevlist_item *last;
+ SDL_EVDEV_keyboard_state *kbd;
+} SDL_EVDEV_PrivateData;
+
+#define _THIS SDL_EVDEV_PrivateData *_this
+static _THIS = NULL;
+
+static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode);
+static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item);
+static int SDL_EVDEV_device_removed(const char *dev_path);
+
+#if SDL_USE_LIBUDEV
+static int SDL_EVDEV_device_added(const char *dev_path, int udev_class);
+static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class,
+ const char *dev_path);
+#endif /* SDL_USE_LIBUDEV */
+
+static Uint8 EVDEV_MouseButtons[] = {
+ SDL_BUTTON_LEFT, /* BTN_LEFT 0x110 */
+ SDL_BUTTON_RIGHT, /* BTN_RIGHT 0x111 */
+ SDL_BUTTON_MIDDLE, /* BTN_MIDDLE 0x112 */
+ SDL_BUTTON_X1, /* BTN_SIDE 0x113 */
+ SDL_BUTTON_X2, /* BTN_EXTRA 0x114 */
+ SDL_BUTTON_X2 + 1, /* BTN_FORWARD 0x115 */
+ SDL_BUTTON_X2 + 2, /* BTN_BACK 0x116 */
+ SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */
+};
+
+int
+SDL_EVDEV_Init(void)
+{
+ if (_this == NULL) {
+ _this = (SDL_EVDEV_PrivateData*)SDL_calloc(1, sizeof(*_this));
+ if (_this == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+#if SDL_USE_LIBUDEV
+ if (SDL_UDEV_Init() < 0) {
+ SDL_free(_this);
+ _this = NULL;
+ return -1;
+ }
+
+ /* Set up the udev callback */
+ if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) {
+ SDL_UDEV_Quit();
+ SDL_free(_this);
+ _this = NULL;
+ return -1;
+ }
+
+ /* Force a scan to build the initial device list */
+ SDL_UDEV_Scan();
+#else
+ /* TODO: Scan the devices manually, like a caveman */
+#endif /* SDL_USE_LIBUDEV */
+
+ _this->kbd = SDL_EVDEV_kbd_init();
+ }
+
+ _this->ref_count += 1;
+
+ return 0;
+}
+
+void
+SDL_EVDEV_Quit(void)
+{
+ if (_this == NULL) {
+ return;
+ }
+
+ _this->ref_count -= 1;
+
+ if (_this->ref_count < 1) {
+#if SDL_USE_LIBUDEV
+ SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback);
+ SDL_UDEV_Quit();
+#endif /* SDL_USE_LIBUDEV */
+
+ SDL_EVDEV_kbd_quit(_this->kbd);
+
+ /* Remove existing devices */
+ while(_this->first != NULL) {
+ SDL_EVDEV_device_removed(_this->first->path);
+ }
+
+ SDL_assert(_this->first == NULL);
+ SDL_assert(_this->last == NULL);
+ SDL_assert(_this->num_devices == 0);
+
+ SDL_free(_this);
+ _this = NULL;
+ }
+}
+
+#if SDL_USE_LIBUDEV
+static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class,
+ const char* dev_path)
+{
+ if (dev_path == NULL) {
+ return;
+ }
+
+ switch(udev_event) {
+ case SDL_UDEV_DEVICEADDED:
+ if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD |
+ SDL_UDEV_DEVICE_TOUCHSCREEN)))
+ return;
+
+ SDL_EVDEV_device_added(dev_path, udev_class);
+ break;
+ case SDL_UDEV_DEVICEREMOVED:
+ SDL_EVDEV_device_removed(dev_path);
+ break;
+ default:
+ break;
+ }
+}
+#endif /* SDL_USE_LIBUDEV */
+
+void
+SDL_EVDEV_Poll(void)
+{
+ struct input_event events[32];
+ int i, j, len;
+ SDL_evdevlist_item *item;
+ SDL_Scancode scan_code;
+ int mouse_button;
+ SDL_Mouse *mouse;
+ float norm_x, norm_y;
+
+ if (!_this) {
+ return;
+ }
+
+#if SDL_USE_LIBUDEV
+ SDL_UDEV_Poll();
+#endif
+
+ mouse = SDL_GetMouse();
+
+ for (item = _this->first; item != NULL; item = item->next) {
+ while ((len = read(item->fd, events, (sizeof events))) > 0) {
+ len /= sizeof(events[0]);
+ for (i = 0; i < len; ++i) {
+ /* special handling for touchscreen, that should eventually be
+ used for all devices */
+ if (item->out_of_sync && item->is_touchscreen &&
+ events[i].type == EV_SYN && events[i].code != SYN_REPORT) {
+ break;
+ }
+
+ switch (events[i].type) {
+ case EV_KEY:
+ if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) {
+ mouse_button = events[i].code - BTN_MOUSE;
+ if (events[i].value == 0) {
+ SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]);
+ } else if (events[i].value == 1) {
+ SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]);
+ }
+ break;
+ }
+
+ /* Probably keyboard */
+ scan_code = SDL_EVDEV_translate_keycode(events[i].code);
+ if (scan_code != SDL_SCANCODE_UNKNOWN) {
+ if (events[i].value == 0) {
+ SDL_SendKeyboardKey(SDL_RELEASED, scan_code);
+ } else if (events[i].value == 1 || events[i].value == 2 /* key repeated */) {
+ SDL_SendKeyboardKey(SDL_PRESSED, scan_code);
+ }
+ }
+ SDL_EVDEV_kbd_keycode(_this->kbd, events[i].code, events[i].value);
+ break;
+ case EV_ABS:
+ switch(events[i].code) {
+ case ABS_MT_SLOT:
+ if (!item->is_touchscreen) /* FIXME: temp hack */
+ break;
+ item->touchscreen_data->current_slot = events[i].value;
+ break;
+ case ABS_MT_TRACKING_ID:
+ if (!item->is_touchscreen) /* FIXME: temp hack */
+ break;
+ if (events[i].value >= 0) {
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value;
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN;
+ } else {
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP;
+ }
+ break;
+ case ABS_MT_POSITION_X:
+ if (!item->is_touchscreen) /* FIXME: temp hack */
+ break;
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value;
+ if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
+ }
+ break;
+ case ABS_MT_POSITION_Y:
+ if (!item->is_touchscreen) /* FIXME: temp hack */
+ break;
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value;
+ if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) {
+ item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE;
+ }
+ break;
+ case ABS_X:
+ if (item->is_touchscreen) /* FIXME: temp hack */
+ break;
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y);
+ break;
+ case ABS_Y:
+ if (item->is_touchscreen) /* FIXME: temp hack */
+ break;
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value);
+ break;
+ default:
+ break;
+ }
+ break;
+ case EV_REL:
+ switch(events[i].code) {
+ case REL_X:
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0);
+ break;
+ case REL_Y:
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value);
+ break;
+ case REL_WHEEL:
+ SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value, SDL_MOUSEWHEEL_NORMAL);
+ break;
+ case REL_HWHEEL:
+ SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL);
+ break;
+ default:
+ break;
+ }
+ break;
+ case EV_SYN:
+ switch (events[i].code) {
+ case SYN_REPORT:
+ if (!item->is_touchscreen) /* FIXME: temp hack */
+ break;
+
+ for(j = 0; j < item->touchscreen_data->max_slots; j++) {
+ norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) /
+ (float)item->touchscreen_data->range_x;
+ norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) /
+ (float)item->touchscreen_data->range_y;
+
+ switch(item->touchscreen_data->slots[j].delta) {
+ case EVDEV_TOUCH_SLOTDELTA_DOWN:
+ SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, 1.0f);
+ item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
+ break;
+ case EVDEV_TOUCH_SLOTDELTA_UP:
+ SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_FALSE, norm_x, norm_y, 1.0f);
+ item->touchscreen_data->slots[j].tracking_id = -1;
+ item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
+ break;
+ case EVDEV_TOUCH_SLOTDELTA_MOVE:
+ SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, norm_x, norm_y, 1.0f);
+ item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (item->out_of_sync)
+ item->out_of_sync = 0;
+ break;
+ case SYN_DROPPED:
+ if (item->is_touchscreen)
+ item->out_of_sync = 1;
+ SDL_EVDEV_sync_device(item);
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+static SDL_Scancode
+SDL_EVDEV_translate_keycode(int keycode)
+{
+ SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
+
+ if (keycode < SDL_arraysize(linux_scancode_table))
+ scancode = linux_scancode_table[keycode];
+
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ SDL_Log("The key you just pressed is not recognized by SDL. To help "
+ "get this fixed, please report this to the SDL forums/mailing list "
+ "<https://discourse.libsdl.org/> EVDEV KeyCode %d", keycode);
+ }
+
+ return scancode;
+}
+
+#ifdef SDL_USE_LIBUDEV
+static int
+SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item)
+{
+ int ret, i;
+ char name[64];
+ struct input_absinfo abs_info;
+
+ if (!item->is_touchscreen)
+ return 0;
+
+ item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data));
+ if (item->touchscreen_data == NULL)
+ return SDL_OutOfMemory();
+
+ ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
+ if (ret < 0) {
+ SDL_free(item->touchscreen_data);
+ return SDL_SetError("Failed to get evdev touchscreen name");
+ }
+
+ item->touchscreen_data->name = SDL_strdup(name);
+ if (item->touchscreen_data->name == NULL) {
+ SDL_free(item->touchscreen_data);
+ return SDL_OutOfMemory();
+ }
+
+ ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_X), &abs_info);
+ if (ret < 0) {
+ SDL_free(item->touchscreen_data->name);
+ SDL_free(item->touchscreen_data);
+ return SDL_SetError("Failed to get evdev touchscreen limits");
+ }
+ item->touchscreen_data->min_x = abs_info.minimum;
+ item->touchscreen_data->max_x = abs_info.maximum;
+ item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum;
+
+ ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_Y), &abs_info);
+ if (ret < 0) {
+ SDL_free(item->touchscreen_data->name);
+ SDL_free(item->touchscreen_data);
+ return SDL_SetError("Failed to get evdev touchscreen limits");
+ }
+ item->touchscreen_data->min_y = abs_info.minimum;
+ item->touchscreen_data->max_y = abs_info.maximum;
+ item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum;
+
+ ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info);
+ if (ret < 0) {
+ SDL_free(item->touchscreen_data->name);
+ SDL_free(item->touchscreen_data);
+ return SDL_SetError("Failed to get evdev touchscreen limits");
+ }
+ item->touchscreen_data->max_slots = abs_info.maximum + 1;
+
+ item->touchscreen_data->slots = SDL_calloc(
+ item->touchscreen_data->max_slots,
+ sizeof(*item->touchscreen_data->slots));
+ if (item->touchscreen_data->slots == NULL) {
+ SDL_free(item->touchscreen_data->name);
+ SDL_free(item->touchscreen_data);
+ return SDL_OutOfMemory();
+ }
+
+ for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ item->touchscreen_data->slots[i].tracking_id = -1;
+ }
+
+ ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */
+ item->touchscreen_data->name);
+ if (ret < 0) {
+ SDL_free(item->touchscreen_data->slots);
+ SDL_free(item->touchscreen_data->name);
+ SDL_free(item->touchscreen_data);
+ return ret;
+ }
+
+ return 0;
+}
+#endif /* SDL_USE_LIBUDEV */
+
+static void
+SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) {
+ if (!item->is_touchscreen)
+ return;
+
+ SDL_DelTouch(item->fd);
+ SDL_free(item->touchscreen_data->slots);
+ SDL_free(item->touchscreen_data->name);
+ SDL_free(item->touchscreen_data);
+}
+
+static void
+SDL_EVDEV_sync_device(SDL_evdevlist_item *item)
+{
+#ifdef EVIOCGMTSLOTS
+ int i, ret;
+ struct input_absinfo abs_info;
+ /*
+ * struct input_mt_request_layout {
+ * __u32 code;
+ * __s32 values[num_slots];
+ * };
+ *
+ * this is the structure we're trying to emulate
+ */
+ __u32* mt_req_code;
+ __s32* mt_req_values;
+ size_t mt_req_size;
+
+ /* TODO: sync devices other than touchscreen */
+ if (!item->is_touchscreen)
+ return;
+
+ mt_req_size = sizeof(*mt_req_code) +
+ sizeof(*mt_req_values) * item->touchscreen_data->max_slots;
+
+ mt_req_code = SDL_calloc(1, mt_req_size);
+ if (mt_req_code == NULL) {
+ return;
+ }
+
+ mt_req_values = (__s32*)mt_req_code + 1;
+
+ *mt_req_code = ABS_MT_TRACKING_ID;
+ ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code);
+ if (ret < 0) {
+ SDL_free(mt_req_code);
+ return;
+ }
+ for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ /*
+ * This doesn't account for the very edge case of the user removing their
+ * finger and replacing it on the screen during the time we're out of sync,
+ * which'll mean that we're not going from down -> up or up -> down, we're
+ * going from down -> down but with a different tracking id, meaning we'd
+ * have to tell SDL of the two events, but since we wait till SYN_REPORT in
+ * SDL_EVDEV_Poll to tell SDL, the current structure of this code doesn't
+ * allow it. Lets just pray to God it doesn't happen.
+ */
+ if (item->touchscreen_data->slots[i].tracking_id < 0 &&
+ mt_req_values[i] >= 0) {
+ item->touchscreen_data->slots[i].tracking_id = mt_req_values[i];
+ item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_DOWN;
+ } else if (item->touchscreen_data->slots[i].tracking_id >= 0 &&
+ mt_req_values[i] < 0) {
+ item->touchscreen_data->slots[i].tracking_id = -1;
+ item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_UP;
+ }
+ }
+
+ *mt_req_code = ABS_MT_POSITION_X;
+ ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code);
+ if (ret < 0) {
+ SDL_free(mt_req_code);
+ return;
+ }
+ for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ if (item->touchscreen_data->slots[i].tracking_id >= 0 &&
+ item->touchscreen_data->slots[i].x != mt_req_values[i]) {
+ item->touchscreen_data->slots[i].x = mt_req_values[i];
+ if (item->touchscreen_data->slots[i].delta ==
+ EVDEV_TOUCH_SLOTDELTA_NONE) {
+ item->touchscreen_data->slots[i].delta =
+ EVDEV_TOUCH_SLOTDELTA_MOVE;
+ }
+ }
+ }
+
+ *mt_req_code = ABS_MT_POSITION_Y;
+ ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code);
+ if (ret < 0) {
+ SDL_free(mt_req_code);
+ return;
+ }
+ for(i = 0; i < item->touchscreen_data->max_slots; i++) {
+ if (item->touchscreen_data->slots[i].tracking_id >= 0 &&
+ item->touchscreen_data->slots[i].y != mt_req_values[i]) {
+ item->touchscreen_data->slots[i].y = mt_req_values[i];
+ if (item->touchscreen_data->slots[i].delta ==
+ EVDEV_TOUCH_SLOTDELTA_NONE) {
+ item->touchscreen_data->slots[i].delta =
+ EVDEV_TOUCH_SLOTDELTA_MOVE;
+ }
+ }
+ }
+
+ ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info);
+ if (ret < 0) {
+ SDL_free(mt_req_code);
+ return;
+ }
+ item->touchscreen_data->current_slot = abs_info.value;
+
+ SDL_free(mt_req_code);
+
+#endif /* EVIOCGMTSLOTS */
+}
+
+#if SDL_USE_LIBUDEV
+static int
+SDL_EVDEV_device_added(const char *dev_path, int udev_class)
+{
+ int ret;
+ SDL_evdevlist_item *item;
+
+ /* Check to make sure it's not already in list. */
+ for (item = _this->first; item != NULL; item = item->next) {
+ if (SDL_strcmp(dev_path, item->path) == 0) {
+ return -1; /* already have this one */
+ }
+ }
+
+ item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item));
+ if (item == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ item->fd = open(dev_path, O_RDONLY | O_NONBLOCK);
+ if (item->fd < 0) {
+ SDL_free(item);
+ return SDL_SetError("Unable to open %s", dev_path);
+ }
+
+ item->path = SDL_strdup(dev_path);
+ if (item->path == NULL) {
+ close(item->fd);
+ SDL_free(item);
+ return SDL_OutOfMemory();
+ }
+
+ if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) {
+ item->is_touchscreen = 1;
+
+ if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) {
+ close(item->fd);
+ SDL_free(item);
+ return ret;
+ }
+ }
+
+ if (_this->last == NULL) {
+ _this->first = _this->last = item;
+ } else {
+ _this->last->next = item;
+ _this->last = item;
+ }
+
+ SDL_EVDEV_sync_device(item);
+
+ return _this->num_devices++;
+}
+#endif /* SDL_USE_LIBUDEV */
+
+static int
+SDL_EVDEV_device_removed(const char *dev_path)
+{
+ SDL_evdevlist_item *item;
+ SDL_evdevlist_item *prev = NULL;
+
+ for (item = _this->first; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (SDL_strcmp(dev_path, item->path) == 0) {
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(_this->first == item);
+ _this->first = item->next;
+ }
+ if (item == _this->last) {
+ _this->last = prev;
+ }
+ if (item->is_touchscreen) {
+ SDL_EVDEV_destroy_touchscreen(item);
+ }
+ close(item->fd);
+ SDL_free(item->path);
+ SDL_free(item);
+ _this->num_devices--;
+ return 0;
+ }
+ prev = item;
+ }
+
+ return -1;
+}
+
+
+#endif /* SDL_INPUT_LINUXEV */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_evdev.h b/src/3rdparty/SDL2/src/core/linux/SDL_evdev.h
new file mode 100644
index 0000000..8d6d683
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_evdev.h
@@ -0,0 +1,39 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_evdev_h_
+#define SDL_evdev_h_
+
+#ifdef SDL_INPUT_LINUXEV
+
+#include "SDL_events.h"
+
+extern int SDL_EVDEV_Init(void);
+extern void SDL_EVDEV_Quit(void);
+extern void SDL_EVDEV_Poll(void);
+
+#endif /* SDL_INPUT_LINUXEV */
+
+#endif /* SDL_evdev_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.c b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.c
new file mode 100644
index 0000000..250e644
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.c
@@ -0,0 +1,677 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_evdev_kbd.h"
+
+#ifdef SDL_INPUT_LINUXKD
+
+/* This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+#include <linux/keyboard.h>
+#include <linux/vt.h>
+#include <linux/tiocl.h> /* for TIOCL_GETSHIFTSTATE */
+
+#include "../../events/SDL_events_c.h"
+#include "SDL_evdev_kbd_default_accents.h"
+#include "SDL_evdev_kbd_default_keymap.h"
+
+/* These are not defined in older Linux kernel headers */
+#ifndef K_UNICODE
+#define K_UNICODE 0x03
+#endif
+#ifndef K_OFF
+#define K_OFF 0x04
+#endif
+
+/*
+ * Handler Tables.
+ */
+
+#define K_HANDLERS\
+ k_self, k_fn, k_spec, k_pad,\
+ k_dead, k_cons, k_cur, k_shift,\
+ k_meta, k_ascii, k_lock, k_lowercase,\
+ k_slock, k_dead2, k_brl, k_ignore
+
+typedef void (k_handler_fn)(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag);
+static k_handler_fn K_HANDLERS;
+static k_handler_fn *k_handler[16] = { K_HANDLERS };
+
+typedef void (fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd);
+static void fn_enter(SDL_EVDEV_keyboard_state *kbd);
+static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd);
+static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd);
+static void fn_num(SDL_EVDEV_keyboard_state *kbd);
+static void fn_compose(SDL_EVDEV_keyboard_state *kbd);
+
+static fn_handler_fn *fn_handler[] =
+{
+ NULL, fn_enter, NULL, NULL,
+ NULL, NULL, NULL, fn_caps_toggle,
+ fn_num, NULL, NULL, NULL,
+ NULL, fn_caps_on, fn_compose, NULL,
+ NULL, NULL, NULL, fn_num
+};
+
+
+/*
+ * Keyboard State
+ */
+
+struct SDL_EVDEV_keyboard_state
+{
+ int console_fd;
+ int old_kbd_mode;
+ unsigned short **key_maps;
+ unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */
+ SDL_bool dead_key_next;
+ int npadch; /* -1 or number assembled on pad */
+ struct kbdiacrs *accents;
+ unsigned int diacr;
+ SDL_bool rep; /* flag telling character repeat */
+ unsigned char lockstate;
+ unsigned char slockstate;
+ unsigned char ledflagstate;
+ char shift_state;
+ char text[128];
+ unsigned int text_len;
+};
+
+#ifdef DUMP_ACCENTS
+static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd)
+{
+ unsigned int i;
+
+ printf("static struct kbdiacrs default_accents = {\n");
+ printf(" %d,\n", kbd->accents->kb_cnt);
+ printf(" {\n");
+ for (i = 0; i < kbd->accents->kb_cnt; ++i) {
+ struct kbdiacr *diacr = &kbd->accents->kbdiacr[i];
+ printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n",
+ diacr->diacr, diacr->base, diacr->result);
+ }
+ while (i < 256) {
+ printf(" { 0x00, 0x00, 0x00 },\n");
+ ++i;
+ }
+ printf(" }\n");
+ printf("};\n");
+}
+#endif /* DUMP_ACCENTS */
+
+#ifdef DUMP_KEYMAP
+static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd)
+{
+ int i, j;
+
+ for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
+ if (kbd->key_maps[i]) {
+ printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i);
+ for (j = 0; j < NR_KEYS; ++j) {
+ if ((j%8) == 0) {
+ printf("\n ");
+ }
+ printf("0x%.4x, ", kbd->key_maps[i][j]);
+ }
+ printf("\n};\n");
+ }
+ }
+ printf("\n");
+ printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n");
+ for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
+ if (kbd->key_maps[i]) {
+ printf(" default_key_map_%d,\n", i);
+ } else {
+ printf(" NULL,\n");
+ }
+ }
+ printf("};\n");
+}
+#endif /* DUMP_KEYMAP */
+
+static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd)
+{
+ int i, j;
+
+ kbd->key_maps = (unsigned short **)SDL_calloc(MAX_NR_KEYMAPS, sizeof(unsigned short *));
+ if (!kbd->key_maps) {
+ return -1;
+ }
+
+ for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
+ struct kbentry kbe;
+
+ kbe.kb_table = i;
+ kbe.kb_index = 0;
+ if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) {
+ return -1;
+ }
+
+ if (kbe.kb_value == K_NOSUCHMAP) {
+ continue;
+ }
+
+ kbd->key_maps[i] = (unsigned short *)SDL_malloc(NR_KEYS * sizeof(unsigned short));
+ if (!kbd->key_maps[i]) {
+ return -1;
+ }
+
+ for (j = 0; j < NR_KEYS; ++j) {
+ kbe.kb_table = i;
+ kbe.kb_index = j;
+ if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) {
+ return -1;
+ }
+ kbd->key_maps[i][j] = (kbe.kb_value ^ 0xf000);
+ }
+ }
+ return 0;
+}
+
+SDL_EVDEV_keyboard_state *
+SDL_EVDEV_kbd_init(void)
+{
+ SDL_EVDEV_keyboard_state *kbd;
+ int i;
+ char flag_state;
+ char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0};
+
+ kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd));
+ if (!kbd) {
+ return NULL;
+ }
+
+ kbd->npadch = -1;
+
+ /* This might fail if we're not connected to a tty (e.g. on the Steam Link) */
+ kbd->console_fd = open("/dev/tty", O_RDONLY);
+
+ if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) {
+ kbd->shift_state = *shift_state;
+ }
+
+ if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) {
+ kbd->ledflagstate = flag_state;
+ }
+
+ kbd->accents = &default_accents;
+ if (ioctl(kbd->console_fd, KDGKBDIACR, kbd->accents) < 0) {
+ /* No worries, we'll use the default accent table */
+ }
+
+ kbd->key_maps = default_key_maps;
+ if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) {
+ /* Set the keyboard in UNICODE mode and load the keymaps */
+ ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE);
+
+ if (SDL_EVDEV_kbd_load_keymaps(kbd) < 0) {
+ for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
+ if (kbd->key_maps[i]) {
+ SDL_free(kbd->key_maps[i]);
+ }
+ }
+ SDL_free(kbd->key_maps);
+
+ kbd->key_maps = default_key_maps;
+ }
+
+ /* Mute the keyboard so keystrokes only generate evdev events
+ * and do not leak through to the console
+ */
+ ioctl(kbd->console_fd, KDSKBMODE, K_OFF);
+ }
+
+#ifdef DUMP_ACCENTS
+ SDL_EVDEV_dump_accents(kbd);
+#endif
+#ifdef DUMP_KEYMAP
+ SDL_EVDEV_dump_keymap(kbd);
+#endif
+ return kbd;
+}
+
+void
+SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
+{
+ if (!kbd) {
+ return;
+ }
+
+ if (kbd->console_fd >= 0) {
+ /* Restore the original keyboard mode */
+ ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode);
+
+ close(kbd->console_fd);
+ kbd->console_fd = -1;
+ }
+
+ if (kbd->key_maps && kbd->key_maps != default_key_maps) {
+ int i;
+ for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
+ if (kbd->key_maps[i]) {
+ SDL_free(kbd->key_maps[i]);
+ }
+ }
+ SDL_free(kbd->key_maps);
+ }
+
+ SDL_free(kbd);
+}
+
+/*
+ * Helper Functions.
+ */
+static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c)
+{
+ /* c is already part of a UTF-8 sequence and safe to add as a character */
+ if (kbd->text_len < (sizeof(kbd->text)-1)) {
+ kbd->text[kbd->text_len++] = (char)c;
+ }
+}
+
+static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c)
+{
+ if (c < 0x80)
+ /* 0******* */
+ put_queue(kbd, c);
+ else if (c < 0x800) {
+ /* 110***** 10****** */
+ put_queue(kbd, 0xc0 | (c >> 6));
+ put_queue(kbd, 0x80 | (c & 0x3f));
+ } else if (c < 0x10000) {
+ if (c >= 0xD800 && c < 0xE000)
+ return;
+ if (c == 0xFFFF)
+ return;
+ /* 1110**** 10****** 10****** */
+ put_queue(kbd, 0xe0 | (c >> 12));
+ put_queue(kbd, 0x80 | ((c >> 6) & 0x3f));
+ put_queue(kbd, 0x80 | (c & 0x3f));
+ } else if (c < 0x110000) {
+ /* 11110*** 10****** 10****** 10****** */
+ put_queue(kbd, 0xf0 | (c >> 18));
+ put_queue(kbd, 0x80 | ((c >> 12) & 0x3f));
+ put_queue(kbd, 0x80 | ((c >> 6) & 0x3f));
+ put_queue(kbd, 0x80 | (c & 0x3f));
+ }
+}
+
+/*
+ * We have a combining character DIACR here, followed by the character CH.
+ * If the combination occurs in the table, return the corresponding value.
+ * Otherwise, if CH is a space or equals DIACR, return DIACR.
+ * Otherwise, conclude that DIACR was not combining after all,
+ * queue it and return CH.
+ */
+static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch)
+{
+ unsigned int d = kbd->diacr;
+ unsigned int i;
+
+ kbd->diacr = 0;
+
+ for (i = 0; i < kbd->accents->kb_cnt; i++) {
+ if (kbd->accents->kbdiacr[i].diacr == d &&
+ kbd->accents->kbdiacr[i].base == ch) {
+ return kbd->accents->kbdiacr[i].result;
+ }
+ }
+
+ if (ch == ' ' || ch == d)
+ return d;
+
+ put_utf8(kbd, d);
+
+ return ch;
+}
+
+static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
+{
+ return ((kbd->ledflagstate >> flag) & 1);
+}
+
+static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
+{
+ kbd->ledflagstate |= 1 << flag;
+}
+
+static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
+{
+ kbd->ledflagstate &= ~(1 << flag);
+}
+
+static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag)
+{
+ kbd->lockstate ^= 1 << flag;
+}
+
+static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag)
+{
+ kbd->slockstate ^= 1 << flag;
+}
+
+static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
+{
+ kbd->ledflagstate ^= 1 << flag;
+}
+
+/*
+ * Special function handlers
+ */
+
+static void fn_enter(SDL_EVDEV_keyboard_state *kbd)
+{
+ if (kbd->diacr) {
+ put_utf8(kbd, kbd->diacr);
+ kbd->diacr = 0;
+ }
+}
+
+static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd)
+{
+ if (kbd->rep)
+ return;
+
+ chg_vc_kbd_led(kbd, K_CAPSLOCK);
+}
+
+static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd)
+{
+ if (kbd->rep)
+ return;
+
+ set_vc_kbd_led(kbd, K_CAPSLOCK);
+}
+
+static void fn_num(SDL_EVDEV_keyboard_state *kbd)
+{
+ if (!kbd->rep)
+ chg_vc_kbd_led(kbd, K_NUMLOCK);
+}
+
+static void fn_compose(SDL_EVDEV_keyboard_state *kbd)
+{
+ kbd->dead_key_next = SDL_TRUE;
+}
+
+/*
+ * Special key handlers
+ */
+
+static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ if (up_flag)
+ return;
+ if (value >= SDL_arraysize(fn_handler))
+ return;
+ if (fn_handler[value])
+ fn_handler[value](kbd);
+}
+
+static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ if (up_flag)
+ return; /* no action, if this is a key release */
+
+ if (kbd->diacr)
+ value = handle_diacr(kbd, value);
+
+ if (kbd->dead_key_next) {
+ kbd->dead_key_next = SDL_FALSE;
+ kbd->diacr = value;
+ return;
+ }
+ put_utf8(kbd, value);
+}
+
+static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag)
+{
+ if (up_flag)
+ return;
+
+ kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value);
+}
+
+static void k_dead(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' };
+
+ k_deadunicode(kbd, ret_diacr[value], up_flag);
+}
+
+static void k_dead2(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ k_deadunicode(kbd, value, up_flag);
+}
+
+static void k_cons(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+static void k_fn(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+static void k_cur(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+static void k_pad(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ static const char pad_chars[] = "0123456789+-*/\015,.?()#";
+
+ if (up_flag)
+ return; /* no action, if this is a key release */
+
+ if (!vc_kbd_led(kbd, K_NUMLOCK)) {
+ /* unprintable action */
+ return;
+ }
+
+ put_queue(kbd, pad_chars[value]);
+}
+
+static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ int old_state = kbd->shift_state;
+
+ if (kbd->rep)
+ return;
+ /*
+ * Mimic typewriter:
+ * a CapsShift key acts like Shift but undoes CapsLock
+ */
+ if (value == KVAL(K_CAPSSHIFT)) {
+ value = KVAL(K_SHIFT);
+ if (!up_flag)
+ clr_vc_kbd_led(kbd, K_CAPSLOCK);
+ }
+
+ if (up_flag) {
+ /*
+ * handle the case that two shift or control
+ * keys are depressed simultaneously
+ */
+ if (kbd->shift_down[value])
+ kbd->shift_down[value]--;
+ } else
+ kbd->shift_down[value]++;
+
+ if (kbd->shift_down[value])
+ kbd->shift_state |= (1 << value);
+ else
+ kbd->shift_state &= ~(1 << value);
+
+ /* kludge */
+ if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) {
+ put_utf8(kbd, kbd->npadch);
+ kbd->npadch = -1;
+ }
+}
+
+static void k_meta(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+static void k_ascii(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ int base;
+
+ if (up_flag)
+ return;
+
+ if (value < 10) {
+ /* decimal input of code, while Alt depressed */
+ base = 10;
+ } else {
+ /* hexadecimal input of code, while AltGr depressed */
+ value -= 10;
+ base = 16;
+ }
+
+ if (kbd->npadch == -1)
+ kbd->npadch = value;
+ else
+ kbd->npadch = kbd->npadch * base + value;
+}
+
+static void k_lock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ if (up_flag || kbd->rep)
+ return;
+
+ chg_vc_kbd_lock(kbd, value);
+}
+
+static void k_slock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+ k_shift(kbd, value, up_flag);
+ if (up_flag || kbd->rep)
+ return;
+
+ chg_vc_kbd_slock(kbd, value);
+ /* try to make Alt, oops, AltGr and such work */
+ if (!kbd->key_maps[kbd->lockstate ^ kbd->slockstate]) {
+ kbd->slockstate = 0;
+ chg_vc_kbd_slock(kbd, value);
+ }
+}
+
+static void k_brl(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag)
+{
+}
+
+void
+SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down)
+{
+ unsigned char shift_final;
+ unsigned char type;
+ unsigned short *key_map;
+ unsigned short keysym;
+
+ if (!kbd) {
+ return;
+ }
+
+ kbd->rep = (down == 2);
+
+ shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate;
+ key_map = kbd->key_maps[shift_final];
+ if (!key_map) {
+ kbd->slockstate = 0;
+ return;
+ }
+
+ if (keycode < NR_KEYS) {
+ keysym = key_map[keycode];
+ } else {
+ return;
+ }
+
+ type = KTYP(keysym);
+
+ if (type < 0xf0) {
+ if (down) {
+ put_utf8(kbd, keysym);
+ }
+ } else {
+ type -= 0xf0;
+
+ /* if type is KT_LETTER then it can be affected by Caps Lock */
+ if (type == KT_LETTER) {
+ type = KT_LATIN;
+
+ if (vc_kbd_led(kbd, K_CAPSLOCK)) {
+ key_map = kbd->key_maps[shift_final ^ (1 << KG_SHIFT)];
+ if (key_map) {
+ keysym = key_map[keycode];
+ }
+ }
+ }
+
+ (*k_handler[type])(kbd, keysym & 0xff, !down);
+
+ if (type != KT_SLOCK) {
+ kbd->slockstate = 0;
+ }
+ }
+
+ if (kbd->text_len > 0) {
+ kbd->text[kbd->text_len] = '\0';
+ SDL_SendKeyboardText(kbd->text);
+ kbd->text_len = 0;
+ }
+}
+
+#else /* !SDL_INPUT_LINUXKD */
+
+SDL_EVDEV_keyboard_state *
+SDL_EVDEV_kbd_init(void)
+{
+ return NULL;
+}
+
+void
+SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down)
+{
+}
+
+void
+SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state)
+{
+}
+
+#endif /* SDL_INPUT_LINUXKD */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.h b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.h
new file mode 100644
index 0000000..831ba3a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+struct SDL_EVDEV_keyboard_state;
+typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state;
+
+extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void);
+extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down);
+extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h
new file mode 100644
index 0000000..2fb5254
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h
@@ -0,0 +1,284 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+static struct kbdiacrs default_accents = {
+ 68,
+ {
+ { 0x60, 0x41, 0xc0 },
+ { 0x60, 0x61, 0xe0 },
+ { 0x27, 0x41, 0xc1 },
+ { 0x27, 0x61, 0xe1 },
+ { 0x5e, 0x41, 0xc2 },
+ { 0x5e, 0x61, 0xe2 },
+ { 0x7e, 0x41, 0xc3 },
+ { 0x7e, 0x61, 0xe3 },
+ { 0x22, 0x41, 0xc4 },
+ { 0x22, 0x61, 0xe4 },
+ { 0x4f, 0x41, 0xc5 },
+ { 0x6f, 0x61, 0xe5 },
+ { 0x30, 0x41, 0xc5 },
+ { 0x30, 0x61, 0xe5 },
+ { 0x41, 0x41, 0xc5 },
+ { 0x61, 0x61, 0xe5 },
+ { 0x41, 0x45, 0xc6 },
+ { 0x61, 0x65, 0xe6 },
+ { 0x2c, 0x43, 0xc7 },
+ { 0x2c, 0x63, 0xe7 },
+ { 0x60, 0x45, 0xc8 },
+ { 0x60, 0x65, 0xe8 },
+ { 0x27, 0x45, 0xc9 },
+ { 0x27, 0x65, 0xe9 },
+ { 0x5e, 0x45, 0xca },
+ { 0x5e, 0x65, 0xea },
+ { 0x22, 0x45, 0xcb },
+ { 0x22, 0x65, 0xeb },
+ { 0x60, 0x49, 0xcc },
+ { 0x60, 0x69, 0xec },
+ { 0x27, 0x49, 0xcd },
+ { 0x27, 0x69, 0xed },
+ { 0x5e, 0x49, 0xce },
+ { 0x5e, 0x69, 0xee },
+ { 0x22, 0x49, 0xcf },
+ { 0x22, 0x69, 0xef },
+ { 0x2d, 0x44, 0xd0 },
+ { 0x2d, 0x64, 0xf0 },
+ { 0x7e, 0x4e, 0xd1 },
+ { 0x7e, 0x6e, 0xf1 },
+ { 0x60, 0x4f, 0xd2 },
+ { 0x60, 0x6f, 0xf2 },
+ { 0x27, 0x4f, 0xd3 },
+ { 0x27, 0x6f, 0xf3 },
+ { 0x5e, 0x4f, 0xd4 },
+ { 0x5e, 0x6f, 0xf4 },
+ { 0x7e, 0x4f, 0xd5 },
+ { 0x7e, 0x6f, 0xf5 },
+ { 0x22, 0x4f, 0xd6 },
+ { 0x22, 0x6f, 0xf6 },
+ { 0x2f, 0x4f, 0xd8 },
+ { 0x2f, 0x6f, 0xf8 },
+ { 0x60, 0x55, 0xd9 },
+ { 0x60, 0x75, 0xf9 },
+ { 0x27, 0x55, 0xda },
+ { 0x27, 0x75, 0xfa },
+ { 0x5e, 0x55, 0xdb },
+ { 0x5e, 0x75, 0xfb },
+ { 0x22, 0x55, 0xdc },
+ { 0x22, 0x75, 0xfc },
+ { 0x27, 0x59, 0xdd },
+ { 0x27, 0x79, 0xfd },
+ { 0x54, 0x48, 0xde },
+ { 0x74, 0x68, 0xfe },
+ { 0x73, 0x73, 0xdf },
+ { 0x22, 0x79, 0xff },
+ { 0x73, 0x7a, 0xdf },
+ { 0x69, 0x6a, 0xff },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00 },
+ }
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h
new file mode 100644
index 0000000..0ed3050
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h
@@ -0,0 +1,4763 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+static unsigned short default_key_map_0[NR_KEYS] = {
+ 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_1[NR_KEYS] = {
+ 0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_2[NR_KEYS] = {
+ 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_3[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+#ifdef INCLUDE_EXTENDED_KEYMAP
+static unsigned short default_key_map_4[NR_KEYS] = {
+ 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_5[NR_KEYS] = {
+ 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_6[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_7[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_8[NR_KEYS] = {
+ 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_9[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_10[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_11[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_12[NR_KEYS] = {
+ 0xf200, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static unsigned short default_key_map_13[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_14[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_15[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_16[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_17[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_18[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_19[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_20[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_21[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_22[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_23[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_24[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_25[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_26[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_27[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_28[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_29[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_30[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_31[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_32[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_33[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_34[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_35[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_36[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_37[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_38[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_39[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_40[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_41[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_42[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_43[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_44[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_45[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_46[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_47[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_48[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_49[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_50[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_51[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_52[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_53[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_54[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_55[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_56[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_57[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_58[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_59[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_60[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_61[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_62[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_63[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_64[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_65[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_66[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_67[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_68[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_69[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_70[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_71[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_72[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_73[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_74[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_75[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_76[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_77[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_78[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_79[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_80[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_81[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_82[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_83[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_84[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_85[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_86[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_87[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_88[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_89[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_90[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_91[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_92[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_93[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_94[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_95[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_96[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_97[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_98[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_99[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_100[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_101[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_102[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_103[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_104[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_105[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_106[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_107[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_108[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_109[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_110[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_111[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_112[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_113[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
+ 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
+ 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_114[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
+ 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
+ 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
+ 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53,
+ 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b,
+ 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
+ 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916,
+ 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_115[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
+ 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009,
+ 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
+ 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73,
+ 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a,
+ 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
+ 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
+ 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_116[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126,
+ 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c,
+ 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_117[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132,
+ 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138,
+ 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_118[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_119[NR_KEYS] = {
+ 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009,
+ 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
+ 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013,
+ 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
+ 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
+ 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c,
+ 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c,
+ 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522,
+ 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_120[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907,
+ 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901,
+ 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212,
+ 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_121[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916,
+ 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911,
+ 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b,
+ 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_122[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
+ 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809,
+ 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
+ 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
+ 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
+ 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
+ 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_123[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
+ 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809,
+ 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
+ 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853,
+ 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
+ 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
+ 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c,
+ 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_124[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
+ 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a,
+ 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_125[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510,
+ 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516,
+ 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_126[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+static unsigned short default_key_map_127[NR_KEYS] = {
+ 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809,
+ 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
+ 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813,
+ 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
+ 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
+ 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c,
+ 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
+ 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
+ 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
+ 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a,
+ 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603,
+ 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d,
+ 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+ 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
+};
+#endif /* INCLUDE_EXTENDED_KEYMAP */
+
+static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {
+ default_key_map_0,
+ default_key_map_1,
+ default_key_map_2,
+ default_key_map_3,
+#ifdef INCLUDE_EXTENDED_KEYMAP
+ default_key_map_4,
+ default_key_map_5,
+ default_key_map_6,
+ default_key_map_7,
+ default_key_map_8,
+ default_key_map_9,
+ default_key_map_10,
+ default_key_map_11,
+ default_key_map_12,
+ default_key_map_13,
+ default_key_map_14,
+ default_key_map_15,
+ default_key_map_16,
+ default_key_map_17,
+ default_key_map_18,
+ default_key_map_19,
+ default_key_map_20,
+ default_key_map_21,
+ default_key_map_22,
+ default_key_map_23,
+ default_key_map_24,
+ default_key_map_25,
+ default_key_map_26,
+ default_key_map_27,
+ default_key_map_28,
+ default_key_map_29,
+ default_key_map_30,
+ default_key_map_31,
+ default_key_map_32,
+ default_key_map_33,
+ default_key_map_34,
+ default_key_map_35,
+ default_key_map_36,
+ default_key_map_37,
+ default_key_map_38,
+ default_key_map_39,
+ default_key_map_40,
+ default_key_map_41,
+ default_key_map_42,
+ default_key_map_43,
+ default_key_map_44,
+ default_key_map_45,
+ default_key_map_46,
+ default_key_map_47,
+ default_key_map_48,
+ default_key_map_49,
+ default_key_map_50,
+ default_key_map_51,
+ default_key_map_52,
+ default_key_map_53,
+ default_key_map_54,
+ default_key_map_55,
+ default_key_map_56,
+ default_key_map_57,
+ default_key_map_58,
+ default_key_map_59,
+ default_key_map_60,
+ default_key_map_61,
+ default_key_map_62,
+ default_key_map_63,
+ default_key_map_64,
+ default_key_map_65,
+ default_key_map_66,
+ default_key_map_67,
+ default_key_map_68,
+ default_key_map_69,
+ default_key_map_70,
+ default_key_map_71,
+ default_key_map_72,
+ default_key_map_73,
+ default_key_map_74,
+ default_key_map_75,
+ default_key_map_76,
+ default_key_map_77,
+ default_key_map_78,
+ default_key_map_79,
+ default_key_map_80,
+ default_key_map_81,
+ default_key_map_82,
+ default_key_map_83,
+ default_key_map_84,
+ default_key_map_85,
+ default_key_map_86,
+ default_key_map_87,
+ default_key_map_88,
+ default_key_map_89,
+ default_key_map_90,
+ default_key_map_91,
+ default_key_map_92,
+ default_key_map_93,
+ default_key_map_94,
+ default_key_map_95,
+ default_key_map_96,
+ default_key_map_97,
+ default_key_map_98,
+ default_key_map_99,
+ default_key_map_100,
+ default_key_map_101,
+ default_key_map_102,
+ default_key_map_103,
+ default_key_map_104,
+ default_key_map_105,
+ default_key_map_106,
+ default_key_map_107,
+ default_key_map_108,
+ default_key_map_109,
+ default_key_map_110,
+ default_key_map_111,
+ default_key_map_112,
+ default_key_map_113,
+ default_key_map_114,
+ default_key_map_115,
+ default_key_map_116,
+ default_key_map_117,
+ default_key_map_118,
+ default_key_map_119,
+ default_key_map_120,
+ default_key_map_121,
+ default_key_map_122,
+ default_key_map_123,
+ default_key_map_124,
+ default_key_map_125,
+ default_key_map_126,
+ default_key_map_127,
+#else /* !INCLUDE_EXTENDED_KEYMAP */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+#endif /* INCLUDE_EXTENDED_KEYMAP */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_fcitx.c b/src/3rdparty/SDL2/src/core/linux/SDL_fcitx.c
new file mode 100644
index 0000000..41954e9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_fcitx.c
@@ -0,0 +1,373 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef HAVE_FCITX_FRONTEND_H
+
+#include <fcitx/frontend.h>
+#include <unistd.h>
+
+#include "SDL_fcitx.h"
+#include "SDL_keycode.h"
+#include "SDL_keyboard.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_dbus.h"
+#include "SDL_syswm.h"
+#if SDL_VIDEO_DRIVER_X11
+# include "../../video/x11/SDL_x11video.h"
+#endif
+#include "SDL_hints.h"
+
+#define FCITX_DBUS_SERVICE "org.fcitx.Fcitx"
+
+#define FCITX_IM_DBUS_PATH "/inputmethod"
+#define FCITX_IC_DBUS_PATH "/inputcontext_%d"
+
+#define FCITX_IM_DBUS_INTERFACE "org.fcitx.Fcitx.InputMethod"
+#define FCITX_IC_DBUS_INTERFACE "org.fcitx.Fcitx.InputContext"
+
+#define IC_NAME_MAX 64
+#define DBUS_TIMEOUT 500
+
+typedef struct _FcitxClient
+{
+ SDL_DBusContext *dbus;
+
+ char servicename[IC_NAME_MAX];
+ char icname[IC_NAME_MAX];
+
+ int id;
+
+ SDL_Rect cursor_rect;
+} FcitxClient;
+
+static FcitxClient fcitx_client;
+
+static int
+GetDisplayNumber()
+{
+ const char *display = SDL_getenv("DISPLAY");
+ const char *p = NULL;
+ int number = 0;
+
+ if (display == NULL)
+ return 0;
+
+ display = SDL_strchr(display, ':');
+ if (display == NULL)
+ return 0;
+
+ display++;
+ p = SDL_strchr(display, '.');
+ if (p == NULL && display != NULL) {
+ number = SDL_strtod(display, NULL);
+ } else {
+ char *buffer = SDL_strdup(display);
+ buffer[p - display] = '\0';
+ number = SDL_strtod(buffer, NULL);
+ SDL_free(buffer);
+ }
+
+ return number;
+}
+
+static char*
+GetAppName()
+{
+#if defined(__LINUX__) || defined(__FREEBSD__)
+ char *spot;
+ char procfile[1024];
+ char linkfile[1024];
+ int linksize;
+
+#if defined(__LINUX__)
+ SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
+#elif defined(__FREEBSD__)
+ SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
+#endif
+ linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
+ if (linksize > 0) {
+ linkfile[linksize] = '\0';
+ spot = SDL_strrchr(linkfile, '/');
+ if (spot) {
+ return SDL_strdup(spot + 1);
+ } else {
+ return SDL_strdup(linkfile);
+ }
+ }
+#endif /* __LINUX__ || __FREEBSD__ */
+
+ return SDL_strdup("SDL_App");
+}
+
+static DBusHandlerResult
+DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+ SDL_DBusContext *dbus = (SDL_DBusContext *)data;
+
+ if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "CommitString")) {
+ DBusMessageIter iter;
+ const char *text = NULL;
+
+ dbus->message_iter_init(msg, &iter);
+ dbus->message_iter_get_basic(&iter, &text);
+
+ if (text)
+ SDL_SendKeyboardText(text);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdatePreedit")) {
+ DBusMessageIter iter;
+ const char *text;
+
+ dbus->message_iter_init(msg, &iter);
+ dbus->message_iter_get_basic(&iter, &text);
+
+ if (text && *text) {
+ char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
+ size_t text_bytes = SDL_strlen(text), i = 0;
+ size_t cursor = 0;
+
+ while (i < text_bytes) {
+ const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
+ const size_t chars = SDL_utf8strlen(buf);
+
+ SDL_SendEditingText(buf, cursor, chars);
+
+ i += sz;
+ cursor += chars;
+ }
+ }
+
+ SDL_Fcitx_UpdateTextRect(NULL);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static void
+FcitxClientICCallMethod(FcitxClient *client, const char *method)
+{
+ SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID);
+}
+
+static void SDLCALL
+Fcitx_SetCapabilities(void *data,
+ const char *name,
+ const char *old_val,
+ const char *internal_editing)
+{
+ FcitxClient *client = (FcitxClient *)data;
+ Uint32 caps = CAPACITY_NONE;
+
+ if (!(internal_editing && *internal_editing == '1')) {
+ caps |= CAPACITY_PREEDIT;
+ }
+
+ SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, "SetCapacity", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID);
+}
+
+static SDL_bool
+FcitxClientCreateIC(FcitxClient *client)
+{
+ char *appname = GetAppName();
+ pid_t pid = getpid();
+ int id = -1;
+ Uint32 enable, arg1, arg2, arg3, arg4;
+
+ if (!SDL_DBus_CallMethod(client->servicename, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateICv3",
+ DBUS_TYPE_STRING, &appname, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID,
+ DBUS_TYPE_INT32, &id, DBUS_TYPE_BOOLEAN, &enable, DBUS_TYPE_UINT32, &arg1, DBUS_TYPE_UINT32, &arg2, DBUS_TYPE_UINT32, &arg3, DBUS_TYPE_UINT32, &arg4, DBUS_TYPE_INVALID)) {
+ id = -1; /* just in case. */
+ }
+
+ SDL_free(appname);
+
+ if (id >= 0) {
+ SDL_DBusContext *dbus = client->dbus;
+
+ client->id = id;
+
+ SDL_snprintf(client->icname, IC_NAME_MAX, FCITX_IC_DBUS_PATH, client->id);
+
+ dbus->bus_add_match(dbus->session_conn,
+ "type='signal', interface='org.fcitx.Fcitx.InputContext'",
+ NULL);
+ dbus->connection_add_filter(dbus->session_conn,
+ &DBus_MessageFilter, dbus,
+ NULL);
+ dbus->connection_flush(dbus->session_conn);
+
+ SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client);
+ return SDL_TRUE;
+ }
+
+ return SDL_FALSE;
+}
+
+static Uint32
+Fcitx_ModState(void)
+{
+ Uint32 fcitx_mods = 0;
+ SDL_Keymod sdl_mods = SDL_GetModState();
+
+ if (sdl_mods & KMOD_SHIFT) fcitx_mods |= FcitxKeyState_Shift;
+ if (sdl_mods & KMOD_CAPS) fcitx_mods |= FcitxKeyState_CapsLock;
+ if (sdl_mods & KMOD_CTRL) fcitx_mods |= FcitxKeyState_Ctrl;
+ if (sdl_mods & KMOD_ALT) fcitx_mods |= FcitxKeyState_Alt;
+ if (sdl_mods & KMOD_NUM) fcitx_mods |= FcitxKeyState_NumLock;
+ if (sdl_mods & KMOD_LGUI) fcitx_mods |= FcitxKeyState_Super;
+ if (sdl_mods & KMOD_RGUI) fcitx_mods |= FcitxKeyState_Meta;
+
+ return fcitx_mods;
+}
+
+SDL_bool
+SDL_Fcitx_Init()
+{
+ fcitx_client.dbus = SDL_DBus_GetContext();
+
+ fcitx_client.cursor_rect.x = -1;
+ fcitx_client.cursor_rect.y = -1;
+ fcitx_client.cursor_rect.w = 0;
+ fcitx_client.cursor_rect.h = 0;
+
+ SDL_snprintf(fcitx_client.servicename, IC_NAME_MAX,
+ "%s-%d",
+ FCITX_DBUS_SERVICE, GetDisplayNumber());
+
+ return FcitxClientCreateIC(&fcitx_client);
+}
+
+void
+SDL_Fcitx_Quit()
+{
+ FcitxClientICCallMethod(&fcitx_client, "DestroyIC");
+}
+
+void
+SDL_Fcitx_SetFocus(SDL_bool focused)
+{
+ if (focused) {
+ FcitxClientICCallMethod(&fcitx_client, "FocusIn");
+ } else {
+ FcitxClientICCallMethod(&fcitx_client, "FocusOut");
+ }
+}
+
+void
+SDL_Fcitx_Reset(void)
+{
+ FcitxClientICCallMethod(&fcitx_client, "Reset");
+ FcitxClientICCallMethod(&fcitx_client, "CloseIC");
+}
+
+SDL_bool
+SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
+{
+ Uint32 state = Fcitx_ModState();
+ Uint32 handled = SDL_FALSE;
+ int type = FCITX_PRESS_KEY;
+ Uint32 event_time = 0;
+
+ if (SDL_DBus_CallMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent",
+ DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INT32, &type, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID,
+ DBUS_TYPE_INT32, &handled, DBUS_TYPE_INVALID)) {
+ if (handled) {
+ SDL_Fcitx_UpdateTextRect(NULL);
+ return SDL_TRUE;
+ }
+ }
+
+ return SDL_FALSE;
+}
+
+void
+SDL_Fcitx_UpdateTextRect(SDL_Rect *rect)
+{
+ SDL_Window *focused_win = NULL;
+ SDL_SysWMinfo info;
+ int x = 0, y = 0;
+ SDL_Rect *cursor = &fcitx_client.cursor_rect;
+
+ if (rect) {
+ SDL_memcpy(cursor, rect, sizeof(SDL_Rect));
+ }
+
+ focused_win = SDL_GetKeyboardFocus();
+ if (!focused_win) {
+ return ;
+ }
+
+ SDL_VERSION(&info.version);
+ if (!SDL_GetWindowWMInfo(focused_win, &info)) {
+ return;
+ }
+
+ SDL_GetWindowPosition(focused_win, &x, &y);
+
+#if SDL_VIDEO_DRIVER_X11
+ if (info.subsystem == SDL_SYSWM_X11) {
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
+
+ Display *x_disp = info.info.x11.display;
+ Window x_win = info.info.x11.window;
+ int x_screen = displaydata->screen;
+ Window unused;
+ X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
+ }
+#endif
+
+ if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) {
+ /* move to bottom left */
+ int w = 0, h = 0;
+ SDL_GetWindowSize(focused_win, &w, &h);
+ cursor->x = 0;
+ cursor->y = h;
+ }
+
+ x += cursor->x;
+ y += cursor->y;
+
+ SDL_DBus_CallVoidMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "SetCursorRect",
+ DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID);
+}
+
+void
+SDL_Fcitx_PumpEvents(void)
+{
+ SDL_DBusContext *dbus = fcitx_client.dbus;
+ DBusConnection *conn = dbus->session_conn;
+
+ dbus->connection_read_write(conn, 0);
+
+ while (dbus->connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) {
+ /* Do nothing, actual work happens in DBus_MessageFilter */
+ usleep(10);
+ }
+}
+
+#endif /* HAVE_FCITX_FRONTEND_H */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_fcitx.h b/src/3rdparty/SDL2/src/core/linux/SDL_fcitx.h
new file mode 100644
index 0000000..9407cd9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_fcitx.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_fcitx_h_
+#define SDL_fcitx_h_
+
+#include "../../SDL_internal.h"
+
+#include "SDL_stdinc.h"
+#include "SDL_rect.h"
+
+extern SDL_bool SDL_Fcitx_Init(void);
+extern void SDL_Fcitx_Quit(void);
+extern void SDL_Fcitx_SetFocus(SDL_bool focused);
+extern void SDL_Fcitx_Reset(void);
+extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
+extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
+extern void SDL_Fcitx_PumpEvents(void);
+
+#endif /* SDL_fcitx_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_ibus.c b/src/3rdparty/SDL2/src/core/linux/SDL_ibus.c
new file mode 100644
index 0000000..a9c3197
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_ibus.c
@@ -0,0 +1,584 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef HAVE_IBUS_IBUS_H
+#include "SDL.h"
+#include "SDL_syswm.h"
+#include "SDL_ibus.h"
+#include "SDL_dbus.h"
+#include "../../video/SDL_sysvideo.h"
+#include "../../events/SDL_keyboard_c.h"
+
+#if SDL_VIDEO_DRIVER_X11
+ #include "../../video/x11/SDL_x11video.h"
+#endif
+
+#include <sys/inotify.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+static const char IBUS_SERVICE[] = "org.freedesktop.IBus";
+static const char IBUS_PATH[] = "/org/freedesktop/IBus";
+static const char IBUS_INTERFACE[] = "org.freedesktop.IBus";
+static const char IBUS_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext";
+
+static char *input_ctx_path = NULL;
+static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 };
+static DBusConnection *ibus_conn = NULL;
+static char *ibus_addr_file = NULL;
+static int inotify_fd = -1, inotify_wd = -1;
+
+static Uint32
+IBus_ModState(void)
+{
+ Uint32 ibus_mods = 0;
+ SDL_Keymod sdl_mods = SDL_GetModState();
+
+ /* Not sure about MOD3, MOD4 and HYPER mappings */
+ if (sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK;
+ if (sdl_mods & KMOD_CAPS) ibus_mods |= IBUS_LOCK_MASK;
+ if (sdl_mods & KMOD_LCTRL) ibus_mods |= IBUS_CONTROL_MASK;
+ if (sdl_mods & KMOD_LALT) ibus_mods |= IBUS_MOD1_MASK;
+ if (sdl_mods & KMOD_NUM) ibus_mods |= IBUS_MOD2_MASK;
+ if (sdl_mods & KMOD_MODE) ibus_mods |= IBUS_MOD5_MASK;
+ if (sdl_mods & KMOD_LGUI) ibus_mods |= IBUS_SUPER_MASK;
+ if (sdl_mods & KMOD_RGUI) ibus_mods |= IBUS_META_MASK;
+
+ return ibus_mods;
+}
+
+static const char *
+IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus)
+{
+ /* The text we need is nested weirdly, use dbus-monitor to see the structure better */
+ const char *text = NULL;
+ const char *struct_id = NULL;
+ DBusMessageIter sub1, sub2;
+
+ if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) {
+ return NULL;
+ }
+
+ dbus->message_iter_recurse(iter, &sub1);
+
+ if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) {
+ return NULL;
+ }
+
+ dbus->message_iter_recurse(&sub1, &sub2);
+
+ if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) {
+ return NULL;
+ }
+
+ dbus->message_iter_get_basic(&sub2, &struct_id);
+ if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) {
+ return NULL;
+ }
+
+ dbus->message_iter_next(&sub2);
+ dbus->message_iter_next(&sub2);
+
+ if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) {
+ return NULL;
+ }
+
+ dbus->message_iter_get_basic(&sub2, &text);
+
+ return text;
+}
+
+static DBusHandlerResult
+IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data)
+{
+ SDL_DBusContext *dbus = (SDL_DBusContext *)user_data;
+
+ if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) {
+ DBusMessageIter iter;
+ const char *text;
+
+ dbus->message_iter_init(msg, &iter);
+
+ text = IBus_GetVariantText(conn, &iter, dbus);
+ if (text && *text) {
+ char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+ size_t text_bytes = SDL_strlen(text), i = 0;
+
+ while (i < text_bytes) {
+ size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
+ SDL_SendKeyboardText(buf);
+
+ i += sz;
+ }
+ }
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) {
+ DBusMessageIter iter;
+ const char *text;
+
+ dbus->message_iter_init(msg, &iter);
+ text = IBus_GetVariantText(conn, &iter, dbus);
+
+ if (text) {
+ char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
+ size_t text_bytes = SDL_strlen(text), i = 0;
+ size_t cursor = 0;
+
+ do {
+ const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
+ const size_t chars = SDL_utf8strlen(buf);
+
+ SDL_SendEditingText(buf, cursor, chars);
+
+ i += sz;
+ cursor += chars;
+ } while (i < text_bytes);
+ }
+
+ SDL_IBus_UpdateTextRect(NULL);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) {
+ SDL_SendEditingText("", 0, 0);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static char *
+IBus_ReadAddressFromFile(const char *file_path)
+{
+ char addr_buf[1024];
+ SDL_bool success = SDL_FALSE;
+ FILE *addr_file;
+
+ addr_file = fopen(file_path, "r");
+ if (!addr_file) {
+ return NULL;
+ }
+
+ while (fgets(addr_buf, sizeof(addr_buf), addr_file)) {
+ if (SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0) {
+ size_t sz = SDL_strlen(addr_buf);
+ if (addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0;
+ if (addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0;
+ success = SDL_TRUE;
+ break;
+ }
+ }
+
+ fclose(addr_file);
+
+ if (success) {
+ return SDL_strdup(addr_buf + (sizeof("IBUS_ADDRESS=") - 1));
+ } else {
+ return NULL;
+ }
+}
+
+static char *
+IBus_GetDBusAddressFilename(void)
+{
+ SDL_DBusContext *dbus;
+ const char *disp_env;
+ char config_dir[PATH_MAX];
+ char *display = NULL;
+ const char *addr;
+ const char *conf_env;
+ char *key;
+ char file_path[PATH_MAX];
+ const char *host;
+ char *disp_num, *screen_num;
+
+ if (ibus_addr_file) {
+ return SDL_strdup(ibus_addr_file);
+ }
+
+ dbus = SDL_DBus_GetContext();
+ if (!dbus) {
+ return NULL;
+ }
+
+ /* Use this environment variable if it exists. */
+ addr = SDL_getenv("IBUS_ADDRESS");
+ if (addr && *addr) {
+ return SDL_strdup(addr);
+ }
+
+ /* Otherwise, we have to get the hostname, display, machine id, config dir
+ and look up the address from a filepath using all those bits, eek. */
+ disp_env = SDL_getenv("DISPLAY");
+
+ if (!disp_env || !*disp_env) {
+ display = SDL_strdup(":0.0");
+ } else {
+ display = SDL_strdup(disp_env);
+ }
+
+ host = display;
+ disp_num = SDL_strrchr(display, ':');
+ screen_num = SDL_strrchr(display, '.');
+
+ if (!disp_num) {
+ SDL_free(display);
+ return NULL;
+ }
+
+ *disp_num = 0;
+ disp_num++;
+
+ if (screen_num) {
+ *screen_num = 0;
+ }
+
+ if (!*host) {
+ host = "unix";
+ }
+
+ SDL_memset(config_dir, 0, sizeof(config_dir));
+
+ conf_env = SDL_getenv("XDG_CONFIG_HOME");
+ if (conf_env && *conf_env) {
+ SDL_strlcpy(config_dir, conf_env, sizeof(config_dir));
+ } else {
+ const char *home_env = SDL_getenv("HOME");
+ if (!home_env || !*home_env) {
+ SDL_free(display);
+ return NULL;
+ }
+ SDL_snprintf(config_dir, sizeof(config_dir), "%s/.config", home_env);
+ }
+
+ key = dbus->get_local_machine_id();
+
+ SDL_memset(file_path, 0, sizeof(file_path));
+ SDL_snprintf(file_path, sizeof(file_path), "%s/ibus/bus/%s-%s-%s",
+ config_dir, key, host, disp_num);
+ dbus->free(key);
+ SDL_free(display);
+
+ return SDL_strdup(file_path);
+}
+
+static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus);
+
+static void SDLCALL
+IBus_SetCapabilities(void *data, const char *name, const char *old_val,
+ const char *internal_editing)
+{
+ SDL_DBusContext *dbus = SDL_DBus_GetContext();
+
+ if (IBus_CheckConnection(dbus)) {
+ Uint32 caps = IBUS_CAP_FOCUS;
+ if (!(internal_editing && *internal_editing == '1')) {
+ caps |= IBUS_CAP_PREEDIT_TEXT;
+ }
+
+ SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities",
+ DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID);
+ }
+}
+
+
+static SDL_bool
+IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
+{
+ const char *client_name = "SDL2_Application";
+ const char *path = NULL;
+ SDL_bool result = SDL_FALSE;
+ DBusObjectPathVTable ibus_vtable;
+
+ SDL_zero(ibus_vtable);
+ ibus_vtable.message_function = &IBus_MessageHandler;
+
+ ibus_conn = dbus->connection_open_private(addr, NULL);
+
+ if (!ibus_conn) {
+ return SDL_FALSE;
+ }
+
+ dbus->connection_flush(ibus_conn);
+
+ if (!dbus->bus_register(ibus_conn, NULL)) {
+ ibus_conn = NULL;
+ return SDL_FALSE;
+ }
+
+ dbus->connection_flush(ibus_conn);
+
+ if (SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext",
+ DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID,
+ DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
+ SDL_free(input_ctx_path);
+ input_ctx_path = SDL_strdup(path);
+ SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
+
+ dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL);
+ dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL);
+ dbus->connection_flush(ibus_conn);
+ result = SDL_TRUE;
+ }
+
+ SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL);
+ SDL_IBus_UpdateTextRect(NULL);
+
+ return result;
+}
+
+static SDL_bool
+IBus_CheckConnection(SDL_DBusContext *dbus)
+{
+ if (!dbus) return SDL_FALSE;
+
+ if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) {
+ return SDL_TRUE;
+ }
+
+ if (inotify_fd > 0 && inotify_wd > 0) {
+ char buf[1024];
+ ssize_t readsize = read(inotify_fd, buf, sizeof(buf));
+ if (readsize > 0) {
+
+ char *p;
+ SDL_bool file_updated = SDL_FALSE;
+
+ for (p = buf; p < buf + readsize; /**/) {
+ struct inotify_event *event = (struct inotify_event*) p;
+ if (event->len > 0) {
+ char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/');
+ if (!addr_file_no_path) return SDL_FALSE;
+
+ if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) {
+ file_updated = SDL_TRUE;
+ break;
+ }
+ }
+
+ p += sizeof(struct inotify_event) + event->len;
+ }
+
+ if (file_updated) {
+ char *addr = IBus_ReadAddressFromFile(ibus_addr_file);
+ if (addr) {
+ SDL_bool result = IBus_SetupConnection(dbus, addr);
+ SDL_free(addr);
+ return result;
+ }
+ }
+ }
+ }
+
+ return SDL_FALSE;
+}
+
+SDL_bool
+SDL_IBus_Init(void)
+{
+ SDL_bool result = SDL_FALSE;
+ SDL_DBusContext *dbus = SDL_DBus_GetContext();
+
+ if (dbus) {
+ char *addr_file = IBus_GetDBusAddressFilename();
+ char *addr;
+ char *addr_file_dir;
+
+ if (!addr_file) {
+ return SDL_FALSE;
+ }
+
+ /* !!! FIXME: if ibus_addr_file != NULL, this will overwrite it and leak (twice!) */
+ ibus_addr_file = SDL_strdup(addr_file);
+
+ addr = IBus_ReadAddressFromFile(addr_file);
+ if (!addr) {
+ SDL_free(addr_file);
+ return SDL_FALSE;
+ }
+
+ if (inotify_fd < 0) {
+ inotify_fd = inotify_init();
+ fcntl(inotify_fd, F_SETFL, O_NONBLOCK);
+ }
+
+ addr_file_dir = SDL_strrchr(addr_file, '/');
+ if (addr_file_dir) {
+ *addr_file_dir = 0;
+ }
+
+ inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY);
+ SDL_free(addr_file);
+
+ if (addr) {
+ result = IBus_SetupConnection(dbus, addr);
+ SDL_free(addr);
+ }
+ }
+
+ return result;
+}
+
+void
+SDL_IBus_Quit(void)
+{
+ SDL_DBusContext *dbus;
+
+ if (input_ctx_path) {
+ SDL_free(input_ctx_path);
+ input_ctx_path = NULL;
+ }
+
+ if (ibus_addr_file) {
+ SDL_free(ibus_addr_file);
+ ibus_addr_file = NULL;
+ }
+
+ dbus = SDL_DBus_GetContext();
+
+ if (dbus && ibus_conn) {
+ dbus->connection_close(ibus_conn);
+ dbus->connection_unref(ibus_conn);
+ }
+
+ if (inotify_fd > 0 && inotify_wd > 0) {
+ inotify_rm_watch(inotify_fd, inotify_wd);
+ inotify_wd = -1;
+ }
+
+ SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
+
+ SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect));
+}
+
+static void
+IBus_SimpleMessage(const char *method)
+{
+ SDL_DBusContext *dbus = SDL_DBus_GetContext();
+
+ if (IBus_CheckConnection(dbus)) {
+ SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method, DBUS_TYPE_INVALID);
+ }
+}
+
+void
+SDL_IBus_SetFocus(SDL_bool focused)
+{
+ const char *method = focused ? "FocusIn" : "FocusOut";
+ IBus_SimpleMessage(method);
+}
+
+void
+SDL_IBus_Reset(void)
+{
+ IBus_SimpleMessage("Reset");
+}
+
+SDL_bool
+SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
+{
+ Uint32 result = 0;
+ SDL_DBusContext *dbus = SDL_DBus_GetContext();
+
+ if (IBus_CheckConnection(dbus)) {
+ Uint32 mods = IBus_ModState();
+ if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent",
+ DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID,
+ DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) {
+ result = 0;
+ }
+ }
+
+ SDL_IBus_UpdateTextRect(NULL);
+
+ return result ? SDL_TRUE : SDL_FALSE;
+}
+
+void
+SDL_IBus_UpdateTextRect(SDL_Rect *rect)
+{
+ SDL_Window *focused_win;
+ SDL_SysWMinfo info;
+ int x = 0, y = 0;
+ SDL_DBusContext *dbus;
+
+ if (rect) {
+ SDL_memcpy(&ibus_cursor_rect, rect, sizeof(ibus_cursor_rect));
+ }
+
+ focused_win = SDL_GetKeyboardFocus();
+ if (!focused_win) {
+ return;
+ }
+
+ SDL_VERSION(&info.version);
+ if (!SDL_GetWindowWMInfo(focused_win, &info)) {
+ return;
+ }
+
+ SDL_GetWindowPosition(focused_win, &x, &y);
+
+#if SDL_VIDEO_DRIVER_X11
+ if (info.subsystem == SDL_SYSWM_X11) {
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
+
+ Display *x_disp = info.info.x11.display;
+ Window x_win = info.info.x11.window;
+ int x_screen = displaydata->screen;
+ Window unused;
+
+ X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
+ }
+#endif
+
+ x += ibus_cursor_rect.x;
+ y += ibus_cursor_rect.y;
+
+ dbus = SDL_DBus_GetContext();
+
+ if (IBus_CheckConnection(dbus)) {
+ SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation",
+ DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID);
+ }
+}
+
+void
+SDL_IBus_PumpEvents(void)
+{
+ SDL_DBusContext *dbus = SDL_DBus_GetContext();
+
+ if (IBus_CheckConnection(dbus)) {
+ dbus->connection_read_write(ibus_conn, 0);
+
+ while (dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS) {
+ /* Do nothing, actual work happens in IBus_MessageHandler */
+ }
+ }
+}
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_ibus.h b/src/3rdparty/SDL2/src/core/linux/SDL_ibus.h
new file mode 100644
index 0000000..d533ff7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_ibus.h
@@ -0,0 +1,58 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_ibus_h_
+#define SDL_ibus_h_
+
+#ifdef HAVE_IBUS_IBUS_H
+#define SDL_USE_IBUS 1
+#include "SDL_stdinc.h"
+#include <ibus-1.0/ibus.h>
+
+extern SDL_bool SDL_IBus_Init(void);
+extern void SDL_IBus_Quit(void);
+
+/* Lets the IBus server know about changes in window focus */
+extern void SDL_IBus_SetFocus(SDL_bool focused);
+
+/* Closes the candidate list and resets any text currently being edited */
+extern void SDL_IBus_Reset(void);
+
+/* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to
+ update its candidate list or change input methods. PumpEvents should be
+ called some time after this, to recieve the TextInput / TextEditing event back. */
+extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
+
+/* Update the position of IBus' candidate list. If rect is NULL then this will
+ just reposition it relative to the focused window's new position. */
+extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect);
+
+/* Checks DBus for new IBus events, and calls SDL_SendKeyboardText /
+ SDL_SendEditingText for each event it finds */
+extern void SDL_IBus_PumpEvents(void);
+
+#endif /* HAVE_IBUS_IBUS_H */
+
+#endif /* SDL_ibus_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_ime.c b/src/3rdparty/SDL2/src/core/linux/SDL_ime.c
new file mode 100644
index 0000000..29b0182
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_ime.c
@@ -0,0 +1,152 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "SDL_ime.h"
+#include "SDL_ibus.h"
+#include "SDL_fcitx.h"
+
+typedef SDL_bool (*_SDL_IME_Init)();
+typedef void (*_SDL_IME_Quit)();
+typedef void (*_SDL_IME_SetFocus)(SDL_bool);
+typedef void (*_SDL_IME_Reset)();
+typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32);
+typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *);
+typedef void (*_SDL_IME_PumpEvents)();
+
+static _SDL_IME_Init SDL_IME_Init_Real = NULL;
+static _SDL_IME_Quit SDL_IME_Quit_Real = NULL;
+static _SDL_IME_SetFocus SDL_IME_SetFocus_Real = NULL;
+static _SDL_IME_Reset SDL_IME_Reset_Real = NULL;
+static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL;
+static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL;
+static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL;
+
+static void
+InitIME()
+{
+ static SDL_bool inited = SDL_FALSE;
+#ifdef HAVE_FCITX_FRONTEND_H
+ const char *im_module = SDL_getenv("SDL_IM_MODULE");
+ const char *xmodifiers = SDL_getenv("XMODIFIERS");
+#endif
+
+ if (inited == SDL_TRUE)
+ return;
+
+ inited = SDL_TRUE;
+
+ /* See if fcitx IME support is being requested */
+#ifdef HAVE_FCITX_FRONTEND_H
+ if (!SDL_IME_Init_Real &&
+ ((im_module && SDL_strcmp(im_module, "fcitx") == 0) ||
+ (!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) {
+ SDL_IME_Init_Real = SDL_Fcitx_Init;
+ SDL_IME_Quit_Real = SDL_Fcitx_Quit;
+ SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus;
+ SDL_IME_Reset_Real = SDL_Fcitx_Reset;
+ SDL_IME_ProcessKeyEvent_Real = SDL_Fcitx_ProcessKeyEvent;
+ SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect;
+ SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents;
+ }
+#endif /* HAVE_FCITX_FRONTEND_H */
+
+ /* default to IBus */
+#ifdef HAVE_IBUS_IBUS_H
+ if (!SDL_IME_Init_Real) {
+ SDL_IME_Init_Real = SDL_IBus_Init;
+ SDL_IME_Quit_Real = SDL_IBus_Quit;
+ SDL_IME_SetFocus_Real = SDL_IBus_SetFocus;
+ SDL_IME_Reset_Real = SDL_IBus_Reset;
+ SDL_IME_ProcessKeyEvent_Real = SDL_IBus_ProcessKeyEvent;
+ SDL_IME_UpdateTextRect_Real = SDL_IBus_UpdateTextRect;
+ SDL_IME_PumpEvents_Real = SDL_IBus_PumpEvents;
+ }
+#endif /* HAVE_IBUS_IBUS_H */
+}
+
+SDL_bool
+SDL_IME_Init(void)
+{
+ InitIME();
+
+ if (SDL_IME_Init_Real) {
+ if (SDL_IME_Init_Real()) {
+ return SDL_TRUE;
+ }
+
+ /* uhoh, the IME implementation's init failed! Disable IME support. */
+ SDL_IME_Init_Real = NULL;
+ SDL_IME_Quit_Real = NULL;
+ SDL_IME_SetFocus_Real = NULL;
+ SDL_IME_Reset_Real = NULL;
+ SDL_IME_ProcessKeyEvent_Real = NULL;
+ SDL_IME_UpdateTextRect_Real = NULL;
+ SDL_IME_PumpEvents_Real = NULL;
+ }
+
+ return SDL_FALSE;
+}
+
+void
+SDL_IME_Quit(void)
+{
+ if (SDL_IME_Quit_Real)
+ SDL_IME_Quit_Real();
+}
+
+void
+SDL_IME_SetFocus(SDL_bool focused)
+{
+ if (SDL_IME_SetFocus_Real)
+ SDL_IME_SetFocus_Real(focused);
+}
+
+void
+SDL_IME_Reset(void)
+{
+ if (SDL_IME_Reset_Real)
+ SDL_IME_Reset_Real();
+}
+
+SDL_bool
+SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
+{
+ if (SDL_IME_ProcessKeyEvent_Real)
+ return SDL_IME_ProcessKeyEvent_Real(keysym, keycode);
+
+ return SDL_FALSE;
+}
+
+void
+SDL_IME_UpdateTextRect(SDL_Rect *rect)
+{
+ if (SDL_IME_UpdateTextRect_Real)
+ SDL_IME_UpdateTextRect_Real(rect);
+}
+
+void
+SDL_IME_PumpEvents()
+{
+ if (SDL_IME_PumpEvents_Real)
+ SDL_IME_PumpEvents_Real();
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_ime.h b/src/3rdparty/SDL2/src/core/linux/SDL_ime.h
new file mode 100644
index 0000000..e39839c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_ime.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_ime_h_
+#define SDL_ime_h_
+
+#include "../../SDL_internal.h"
+
+#include "SDL_stdinc.h"
+#include "SDL_rect.h"
+
+extern SDL_bool SDL_IME_Init(void);
+extern void SDL_IME_Quit(void);
+extern void SDL_IME_SetFocus(SDL_bool focused);
+extern void SDL_IME_Reset(void);
+extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
+extern void SDL_IME_UpdateTextRect(SDL_Rect *rect);
+extern void SDL_IME_PumpEvents(void);
+
+#endif /* SDL_ime_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_udev.c b/src/3rdparty/SDL2/src/core/linux/SDL_udev.c
new file mode 100644
index 0000000..dfbeb79
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_udev.c
@@ -0,0 +1,553 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * To list the properties of a device, try something like:
+ * udevadm info -a -n snd/hwC0D0 (for a sound card)
+ * udevadm info --query=all -n input/event3 (for a keyboard, mouse, etc)
+ * udevadm info --query=property -n input/event2
+ */
+#include "SDL_udev.h"
+
+#ifdef SDL_USE_LIBUDEV
+
+#include <linux/input.h>
+
+#include "SDL_assert.h"
+#include "SDL_loadso.h"
+#include "SDL_timer.h"
+#include "../unix/SDL_poll.h"
+
+static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };
+
+#define _THIS SDL_UDEV_PrivateData *_this
+static _THIS = NULL;
+
+static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr);
+static int SDL_UDEV_load_syms(void);
+static SDL_bool SDL_UDEV_hotplug_update_available(void);
+static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev);
+
+static SDL_bool
+SDL_UDEV_load_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(_this->udev_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return SDL_FALSE;
+ }
+
+ return SDL_TRUE;
+}
+
+static int
+SDL_UDEV_load_syms(void)
+{
+ /* cast funcs to char* first, to please GCC's strict aliasing rules. */
+ #define SDL_UDEV_SYM(x) \
+ if (!SDL_UDEV_load_sym(#x, (void **) (char *) & _this->x)) return -1
+
+ SDL_UDEV_SYM(udev_device_get_action);
+ SDL_UDEV_SYM(udev_device_get_devnode);
+ SDL_UDEV_SYM(udev_device_get_subsystem);
+ SDL_UDEV_SYM(udev_device_get_parent_with_subsystem_devtype);
+ SDL_UDEV_SYM(udev_device_get_property_value);
+ SDL_UDEV_SYM(udev_device_get_sysattr_value);
+ SDL_UDEV_SYM(udev_device_new_from_syspath);
+ SDL_UDEV_SYM(udev_device_unref);
+ SDL_UDEV_SYM(udev_enumerate_add_match_property);
+ SDL_UDEV_SYM(udev_enumerate_add_match_subsystem);
+ SDL_UDEV_SYM(udev_enumerate_get_list_entry);
+ SDL_UDEV_SYM(udev_enumerate_new);
+ SDL_UDEV_SYM(udev_enumerate_scan_devices);
+ SDL_UDEV_SYM(udev_enumerate_unref);
+ SDL_UDEV_SYM(udev_list_entry_get_name);
+ SDL_UDEV_SYM(udev_list_entry_get_next);
+ SDL_UDEV_SYM(udev_monitor_enable_receiving);
+ SDL_UDEV_SYM(udev_monitor_filter_add_match_subsystem_devtype);
+ SDL_UDEV_SYM(udev_monitor_get_fd);
+ SDL_UDEV_SYM(udev_monitor_new_from_netlink);
+ SDL_UDEV_SYM(udev_monitor_receive_device);
+ SDL_UDEV_SYM(udev_monitor_unref);
+ SDL_UDEV_SYM(udev_new);
+ SDL_UDEV_SYM(udev_unref);
+ SDL_UDEV_SYM(udev_device_new_from_devnum);
+ SDL_UDEV_SYM(udev_device_get_devnum);
+ #undef SDL_UDEV_SYM
+
+ return 0;
+}
+
+static SDL_bool
+SDL_UDEV_hotplug_update_available(void)
+{
+ if (_this->udev_mon != NULL) {
+ const int fd = _this->udev_monitor_get_fd(_this->udev_mon);
+ if (SDL_IOReady(fd, SDL_FALSE, 0)) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+
+int
+SDL_UDEV_Init(void)
+{
+ int retval = 0;
+
+ if (_this == NULL) {
+ _this = (SDL_UDEV_PrivateData *) SDL_calloc(1, sizeof(*_this));
+ if(_this == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ retval = SDL_UDEV_LoadLibrary();
+ if (retval < 0) {
+ SDL_UDEV_Quit();
+ return retval;
+ }
+
+ /* Set up udev monitoring
+ * Listen for input devices (mouse, keyboard, joystick, etc) and sound devices
+ */
+
+ _this->udev = _this->udev_new();
+ if (_this->udev == NULL) {
+ SDL_UDEV_Quit();
+ return SDL_SetError("udev_new() failed");
+ }
+
+ _this->udev_mon = _this->udev_monitor_new_from_netlink(_this->udev, "udev");
+ if (_this->udev_mon == NULL) {
+ SDL_UDEV_Quit();
+ return SDL_SetError("udev_monitor_new_from_netlink() failed");
+ }
+
+ _this->udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "input", NULL);
+ _this->udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "sound", NULL);
+ _this->udev_monitor_enable_receiving(_this->udev_mon);
+
+ /* Do an initial scan of existing devices */
+ SDL_UDEV_Scan();
+
+ }
+
+ _this->ref_count += 1;
+
+ return retval;
+}
+
+void
+SDL_UDEV_Quit(void)
+{
+ SDL_UDEV_CallbackList *item;
+
+ if (_this == NULL) {
+ return;
+ }
+
+ _this->ref_count -= 1;
+
+ if (_this->ref_count < 1) {
+
+ if (_this->udev_mon != NULL) {
+ _this->udev_monitor_unref(_this->udev_mon);
+ _this->udev_mon = NULL;
+ }
+ if (_this->udev != NULL) {
+ _this->udev_unref(_this->udev);
+ _this->udev = NULL;
+ }
+
+ /* Remove existing devices */
+ while (_this->first != NULL) {
+ item = _this->first;
+ _this->first = _this->first->next;
+ SDL_free(item);
+ }
+
+ SDL_UDEV_UnloadLibrary();
+ SDL_free(_this);
+ _this = NULL;
+ }
+}
+
+void
+SDL_UDEV_Scan(void)
+{
+ struct udev_enumerate *enumerate = NULL;
+ struct udev_list_entry *devs = NULL;
+ struct udev_list_entry *item = NULL;
+
+ if (_this == NULL) {
+ return;
+ }
+
+ enumerate = _this->udev_enumerate_new(_this->udev);
+ if (enumerate == NULL) {
+ SDL_UDEV_Quit();
+ SDL_SetError("udev_enumerate_new() failed");
+ return;
+ }
+
+ _this->udev_enumerate_add_match_subsystem(enumerate, "input");
+ _this->udev_enumerate_add_match_subsystem(enumerate, "sound");
+
+ _this->udev_enumerate_scan_devices(enumerate);
+ devs = _this->udev_enumerate_get_list_entry(enumerate);
+ for (item = devs; item; item = _this->udev_list_entry_get_next(item)) {
+ const char *path = _this->udev_list_entry_get_name(item);
+ struct udev_device *dev = _this->udev_device_new_from_syspath(_this->udev, path);
+ if (dev != NULL) {
+ device_event(SDL_UDEV_DEVICEADDED, dev);
+ _this->udev_device_unref(dev);
+ }
+ }
+
+ _this->udev_enumerate_unref(enumerate);
+}
+
+
+void
+SDL_UDEV_UnloadLibrary(void)
+{
+ if (_this == NULL) {
+ return;
+ }
+
+ if (_this->udev_handle != NULL) {
+ SDL_UnloadObject(_this->udev_handle);
+ _this->udev_handle = NULL;
+ }
+}
+
+int
+SDL_UDEV_LoadLibrary(void)
+{
+ int retval = 0, i;
+
+ if (_this == NULL) {
+ return SDL_SetError("UDEV not initialized");
+ }
+
+ /* See if there is a udev library already loaded */
+ if (SDL_UDEV_load_syms() == 0) {
+ return 0;
+ }
+
+#ifdef SDL_UDEV_DYNAMIC
+ /* Check for the build environment's libudev first */
+ if (_this->udev_handle == NULL) {
+ _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC);
+ if (_this->udev_handle != NULL) {
+ retval = SDL_UDEV_load_syms();
+ if (retval < 0) {
+ SDL_UDEV_UnloadLibrary();
+ }
+ }
+ }
+#endif
+
+ if (_this->udev_handle == NULL) {
+ for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) {
+ _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]);
+ if (_this->udev_handle != NULL) {
+ retval = SDL_UDEV_load_syms();
+ if (retval < 0) {
+ SDL_UDEV_UnloadLibrary();
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ if (_this->udev_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ }
+ }
+
+ return retval;
+}
+
+#define BITS_PER_LONG (sizeof(unsigned long) * 8)
+#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
+#define OFF(x) ((x)%BITS_PER_LONG)
+#define LONG(x) ((x)/BITS_PER_LONG)
+#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
+
+static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len)
+{
+ const char *value;
+ char text[4096];
+ char *word;
+ int i;
+ unsigned long v;
+
+ SDL_memset(bitmask, 0, bitmask_len*sizeof(*bitmask));
+ value = _this->udev_device_get_sysattr_value(pdev, attr);
+ if (!value) {
+ return;
+ }
+
+ SDL_strlcpy(text, value, sizeof(text));
+ i = 0;
+ while ((word = SDL_strrchr(text, ' ')) != NULL) {
+ v = SDL_strtoul(word+1, NULL, 16);
+ if (i < bitmask_len) {
+ bitmask[i] = v;
+ }
+ ++i;
+ *word = '\0';
+ }
+ v = SDL_strtoul(text, NULL, 16);
+ if (i < bitmask_len) {
+ bitmask[i] = v;
+ }
+}
+
+static int
+guess_device_class(struct udev_device *dev)
+{
+ int devclass = 0;
+ struct udev_device *pdev;
+ unsigned long bitmask_ev[NBITS(EV_MAX)];
+ unsigned long bitmask_abs[NBITS(ABS_MAX)];
+ unsigned long bitmask_key[NBITS(KEY_MAX)];
+ unsigned long bitmask_rel[NBITS(REL_MAX)];
+ unsigned long keyboard_mask;
+
+ /* walk up the parental chain until we find the real input device; the
+ * argument is very likely a subdevice of this, like eventN */
+ pdev = dev;
+ while (pdev && !_this->udev_device_get_sysattr_value(pdev, "capabilities/ev")) {
+ pdev = _this->udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL);
+ }
+ if (!pdev) {
+ return 0;
+ }
+
+ get_caps(dev, pdev, "capabilities/ev", bitmask_ev, SDL_arraysize(bitmask_ev));
+ get_caps(dev, pdev, "capabilities/abs", bitmask_abs, SDL_arraysize(bitmask_abs));
+ get_caps(dev, pdev, "capabilities/rel", bitmask_rel, SDL_arraysize(bitmask_rel));
+ get_caps(dev, pdev, "capabilities/key", bitmask_key, SDL_arraysize(bitmask_key));
+
+ if (test_bit(EV_ABS, bitmask_ev) &&
+ test_bit(ABS_X, bitmask_abs) && test_bit(ABS_Y, bitmask_abs)) {
+ if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) {
+ ; /* ID_INPUT_TABLET */
+ } else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) {
+ ; /* ID_INPUT_TOUCHPAD */
+ } else if (test_bit(BTN_MOUSE, bitmask_key)) {
+ devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
+ } else if (test_bit(BTN_TOUCH, bitmask_key)) {
+ /* TODO: better determining between touchscreen and multitouch touchpad,
+ see https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c */
+ devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; /* ID_INPUT_TOUCHSCREEN */
+ }
+
+ if (test_bit(BTN_TRIGGER, bitmask_key) ||
+ test_bit(BTN_A, bitmask_key) ||
+ test_bit(BTN_1, bitmask_key) ||
+ test_bit(ABS_RX, bitmask_abs) ||
+ test_bit(ABS_RY, bitmask_abs) ||
+ test_bit(ABS_RZ, bitmask_abs) ||
+ test_bit(ABS_THROTTLE, bitmask_abs) ||
+ test_bit(ABS_RUDDER, bitmask_abs) ||
+ test_bit(ABS_WHEEL, bitmask_abs) ||
+ test_bit(ABS_GAS, bitmask_abs) ||
+ test_bit(ABS_BRAKE, bitmask_abs)) {
+ devclass |= SDL_UDEV_DEVICE_JOYSTICK; /* ID_INPUT_JOYSTICK */
+ }
+ }
+
+ if (test_bit(EV_REL, bitmask_ev) &&
+ test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel) &&
+ test_bit(BTN_MOUSE, bitmask_key)) {
+ devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
+ }
+
+ /* the first 32 bits are ESC, numbers, and Q to D; if we have any of
+ * those, consider it a keyboard device; do not test KEY_RESERVED, though */
+ keyboard_mask = 0xFFFFFFFE;
+ if ((bitmask_key[0] & keyboard_mask) != 0)
+ devclass |= SDL_UDEV_DEVICE_KEYBOARD; /* ID_INPUT_KEYBOARD */
+
+ return devclass;
+}
+
+static void
+device_event(SDL_UDEV_deviceevent type, struct udev_device *dev)
+{
+ const char *subsystem;
+ const char *val = NULL;
+ int devclass = 0;
+ const char *path;
+ SDL_UDEV_CallbackList *item;
+
+ path = _this->udev_device_get_devnode(dev);
+ if (path == NULL) {
+ return;
+ }
+
+ subsystem = _this->udev_device_get_subsystem(dev);
+ if (SDL_strcmp(subsystem, "sound") == 0) {
+ devclass = SDL_UDEV_DEVICE_SOUND;
+ } else if (SDL_strcmp(subsystem, "input") == 0) {
+ /* udev rules reference: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c */
+
+ val = _this->udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
+ if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
+ devclass |= SDL_UDEV_DEVICE_JOYSTICK;
+ }
+
+ val = _this->udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
+ if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
+ devclass |= SDL_UDEV_DEVICE_MOUSE;
+ }
+
+ val = _this->udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN");
+ if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
+ devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN;
+ }
+
+ /* The undocumented rule is:
+ - All devices with keys get ID_INPUT_KEY
+ - From this subset, if they have ESC, numbers, and Q to D, it also gets ID_INPUT_KEYBOARD
+
+ Ref: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c#n183
+ */
+ val = _this->udev_device_get_property_value(dev, "ID_INPUT_KEY");
+ if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
+ devclass |= SDL_UDEV_DEVICE_KEYBOARD;
+ }
+
+ if (devclass == 0) {
+ /* Fall back to old style input classes */
+ val = _this->udev_device_get_property_value(dev, "ID_CLASS");
+ if (val != NULL) {
+ if (SDL_strcmp(val, "joystick") == 0) {
+ devclass = SDL_UDEV_DEVICE_JOYSTICK;
+ } else if (SDL_strcmp(val, "mouse") == 0) {
+ devclass = SDL_UDEV_DEVICE_MOUSE;
+ } else if (SDL_strcmp(val, "kbd") == 0) {
+ devclass = SDL_UDEV_DEVICE_KEYBOARD;
+ } else {
+ return;
+ }
+ } else {
+ /* We could be linked with libudev on a system that doesn't have udev running */
+ devclass = guess_device_class(dev);
+ }
+ }
+ } else {
+ return;
+ }
+
+ /* Process callbacks */
+ for (item = _this->first; item != NULL; item = item->next) {
+ item->callback(type, devclass, path);
+ }
+}
+
+void
+SDL_UDEV_Poll(void)
+{
+ struct udev_device *dev = NULL;
+ const char *action = NULL;
+
+ if (_this == NULL) {
+ return;
+ }
+
+ while (SDL_UDEV_hotplug_update_available()) {
+ dev = _this->udev_monitor_receive_device(_this->udev_mon);
+ if (dev == NULL) {
+ break;
+ }
+ action = _this->udev_device_get_action(dev);
+
+ if (SDL_strcmp(action, "add") == 0) {
+ /* Wait for the device to finish initialization */
+ SDL_Delay(100);
+
+ device_event(SDL_UDEV_DEVICEADDED, dev);
+ } else if (SDL_strcmp(action, "remove") == 0) {
+ device_event(SDL_UDEV_DEVICEREMOVED, dev);
+ }
+
+ _this->udev_device_unref(dev);
+ }
+}
+
+int
+SDL_UDEV_AddCallback(SDL_UDEV_Callback cb)
+{
+ SDL_UDEV_CallbackList *item;
+ item = (SDL_UDEV_CallbackList *) SDL_calloc(1, sizeof (SDL_UDEV_CallbackList));
+ if (item == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ item->callback = cb;
+
+ if (_this->last == NULL) {
+ _this->first = _this->last = item;
+ } else {
+ _this->last->next = item;
+ _this->last = item;
+ }
+
+ return 1;
+}
+
+void
+SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
+{
+ SDL_UDEV_CallbackList *item;
+ SDL_UDEV_CallbackList *prev = NULL;
+
+ for (item = _this->first; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (item->callback == cb) {
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(_this->first == item);
+ _this->first = item->next;
+ }
+ if (item == _this->last) {
+ _this->last = prev;
+ }
+ SDL_free(item);
+ return;
+ }
+ prev = item;
+ }
+
+}
+
+
+#endif /* SDL_USE_LIBUDEV */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/linux/SDL_udev.h b/src/3rdparty/SDL2/src/core/linux/SDL_udev.h
new file mode 100644
index 0000000..edf5187
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/linux/SDL_udev.h
@@ -0,0 +1,121 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_udev_h_
+#define SDL_udev_h_
+
+#if HAVE_LIBUDEV_H
+
+#ifndef SDL_USE_LIBUDEV
+#define SDL_USE_LIBUDEV 1
+#endif
+
+#include "SDL_loadso.h"
+#include "SDL_events.h"
+#include <libudev.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+/**
+ * \brief Device type
+ */
+
+typedef enum
+{
+ SDL_UDEV_DEVICEADDED = 1,
+ SDL_UDEV_DEVICEREMOVED
+} SDL_UDEV_deviceevent;
+
+/* A device can be any combination of these classes */
+typedef enum
+{
+ SDL_UDEV_DEVICE_UNKNOWN = 0x0000,
+ SDL_UDEV_DEVICE_MOUSE = 0x0001,
+ SDL_UDEV_DEVICE_KEYBOARD = 0x0002,
+ SDL_UDEV_DEVICE_JOYSTICK = 0x0004,
+ SDL_UDEV_DEVICE_SOUND = 0x0008,
+ SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010
+} SDL_UDEV_deviceclass;
+
+typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
+
+typedef struct SDL_UDEV_CallbackList {
+ SDL_UDEV_Callback callback;
+ struct SDL_UDEV_CallbackList *next;
+} SDL_UDEV_CallbackList;
+
+typedef struct SDL_UDEV_PrivateData
+{
+ const char *udev_library;
+ void *udev_handle;
+ struct udev *udev;
+ struct udev_monitor *udev_mon;
+ int ref_count;
+ SDL_UDEV_CallbackList *first, *last;
+
+ /* Function pointers */
+ const char *(*udev_device_get_action)(struct udev_device *);
+ const char *(*udev_device_get_devnode)(struct udev_device *);
+ const char *(*udev_device_get_subsystem)(struct udev_device *);
+ struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype);
+ const char *(*udev_device_get_property_value)(struct udev_device *, const char *);
+ const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr);
+ struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *);
+ void (*udev_device_unref)(struct udev_device *);
+ int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *);
+ int (*udev_enumerate_add_match_subsystem)(struct udev_enumerate *, const char *);
+ struct udev_list_entry *(*udev_enumerate_get_list_entry)(struct udev_enumerate *);
+ struct udev_enumerate *(*udev_enumerate_new)(struct udev *);
+ int (*udev_enumerate_scan_devices)(struct udev_enumerate *);
+ void (*udev_enumerate_unref)(struct udev_enumerate *);
+ const char *(*udev_list_entry_get_name)(struct udev_list_entry *);
+ struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *);
+ int (*udev_monitor_enable_receiving)(struct udev_monitor *);
+ int (*udev_monitor_filter_add_match_subsystem_devtype)(struct udev_monitor *, const char *, const char *);
+ int (*udev_monitor_get_fd)(struct udev_monitor *);
+ struct udev_monitor *(*udev_monitor_new_from_netlink)(struct udev *, const char *);
+ struct udev_device *(*udev_monitor_receive_device)(struct udev_monitor *);
+ void (*udev_monitor_unref)(struct udev_monitor *);
+ struct udev *(*udev_new)(void);
+ void (*udev_unref)(struct udev *);
+ struct udev_device * (*udev_device_new_from_devnum)(struct udev *udev, char type, dev_t devnum);
+ dev_t (*udev_device_get_devnum) (struct udev_device *udev_device);
+} SDL_UDEV_PrivateData;
+
+extern int SDL_UDEV_Init(void);
+extern void SDL_UDEV_Quit(void);
+extern void SDL_UDEV_UnloadLibrary(void);
+extern int SDL_UDEV_LoadLibrary(void);
+extern void SDL_UDEV_Poll(void);
+extern void SDL_UDEV_Scan(void);
+extern int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb);
+extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb);
+
+
+
+
+#endif /* HAVE_LIBUDEV_H */
+
+#endif /* SDL_udev_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/unix/SDL_poll.c b/src/3rdparty/SDL2/src/core/unix/SDL_poll.c
new file mode 100644
index 0000000..5ac6d0b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/unix/SDL_poll.c
@@ -0,0 +1,87 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#include "SDL_assert.h"
+#include "SDL_poll.h"
+
+#ifdef HAVE_POLL
+#include <poll.h>
+#else
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+#include <errno.h>
+
+
+int
+SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS)
+{
+ int result;
+
+ /* Note: We don't bother to account for elapsed time if we get EINTR */
+ do
+ {
+#ifdef HAVE_POLL
+ struct pollfd info;
+
+ info.fd = fd;
+ if (forWrite) {
+ info.events = POLLOUT;
+ } else {
+ info.events = POLLIN | POLLPRI;
+ }
+ result = poll(&info, 1, timeoutMS);
+#else
+ fd_set rfdset, *rfdp = NULL;
+ fd_set wfdset, *wfdp = NULL;
+ struct timeval tv, *tvp = NULL;
+
+ /* If this assert triggers we'll corrupt memory here */
+ SDL_assert(fd >= 0 && fd < FD_SETSIZE);
+
+ if (forWrite) {
+ FD_ZERO(&wfdset);
+ FD_SET(fd, &wfdset);
+ wfdp = &wfdset;
+ } else {
+ FD_ZERO(&rfdset);
+ FD_SET(fd, &rfdset);
+ rfdp = &rfdset;
+ }
+
+ if (timeoutMS >= 0) {
+ tv.tv_sec = timeoutMS / 1000;
+ tv.tv_usec = (timeoutMS % 1000) * 1000;
+ tvp = &tv;
+ }
+
+ result = select(fd + 1, rfdp, wfdp, NULL, tvp);
+#endif /* HAVE_POLL */
+
+ } while ( result < 0 && errno == EINTR );
+
+ return result;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/unix/SDL_poll.h b/src/3rdparty/SDL2/src/core/unix/SDL_poll.h
new file mode 100644
index 0000000..bf20e23
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/unix/SDL_poll.h
@@ -0,0 +1,34 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_poll_h_
+#define SDL_poll_h_
+
+#include "SDL_stdinc.h"
+
+
+extern int SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS);
+
+#endif /* SDL_poll_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/windows/SDL_directx.h b/src/3rdparty/SDL2/src/core/windows/SDL_directx.h
new file mode 100644
index 0000000..7fe826f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/windows/SDL_directx.h
@@ -0,0 +1,111 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_directx_h_
+#define SDL_directx_h_
+
+/* Include all of the DirectX 8.0 headers and adds any necessary tweaks */
+
+#include "SDL_windows.h"
+#include <mmsystem.h>
+#ifndef WIN32
+#define WIN32
+#endif
+#undef WINNT
+
+/* Far pointers don't exist in 32-bit code */
+#ifndef FAR
+#define FAR
+#endif
+
+/* Error codes not yet included in Win32 API header files */
+#ifndef MAKE_HRESULT
+#define MAKE_HRESULT(sev,fac,code) \
+ ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))))
+#endif
+
+#ifndef S_OK
+#define S_OK (HRESULT)0x00000000L
+#endif
+
+#ifndef SUCCEEDED
+#define SUCCEEDED(x) ((HRESULT)(x) >= 0)
+#endif
+#ifndef FAILED
+#define FAILED(x) ((HRESULT)(x)<0)
+#endif
+
+#ifndef E_FAIL
+#define E_FAIL (HRESULT)0x80000008L
+#endif
+#ifndef E_NOINTERFACE
+#define E_NOINTERFACE (HRESULT)0x80004002L
+#endif
+#ifndef E_OUTOFMEMORY
+#define E_OUTOFMEMORY (HRESULT)0x8007000EL
+#endif
+#ifndef E_INVALIDARG
+#define E_INVALIDARG (HRESULT)0x80070057L
+#endif
+#ifndef E_NOTIMPL
+#define E_NOTIMPL (HRESULT)0x80004001L
+#endif
+#ifndef REGDB_E_CLASSNOTREG
+#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
+#endif
+
+/* Severity codes */
+#ifndef SEVERITY_ERROR
+#define SEVERITY_ERROR 1
+#endif
+
+/* Error facility codes */
+#ifndef FACILITY_WIN32
+#define FACILITY_WIN32 7
+#endif
+
+#ifndef FIELD_OFFSET
+#define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
+#endif
+
+/* DirectX headers (if it isn't included, I haven't tested it yet)
+ */
+/* We need these defines to mark what version of DirectX API we use */
+#define DIRECTDRAW_VERSION 0x0700
+#define DIRECTSOUND_VERSION 0x0800
+#define DIRECTINPUT_VERSION 0x0800 /* Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... */
+
+#ifdef HAVE_DDRAW_H
+#include <ddraw.h>
+#endif
+#ifdef HAVE_DSOUND_H
+#include <dsound.h>
+#endif
+#ifdef HAVE_DINPUT_H
+#include <dinput.h>
+#else
+typedef struct { int unused; } DIDEVICEINSTANCE;
+#endif
+
+#endif /* SDL_directx_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/windows/SDL_windows.c b/src/3rdparty/SDL2/src/core/windows/SDL_windows.c
new file mode 100644
index 0000000..6624043
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/windows/SDL_windows.c
@@ -0,0 +1,230 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(__WIN32__) || defined(__WINRT__)
+
+#include "SDL_windows.h"
+#include "SDL_error.h"
+#include "SDL_assert.h"
+
+#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
+
+#ifndef _WIN32_WINNT_VISTA
+#define _WIN32_WINNT_VISTA 0x0600
+#endif
+
+
+/* Sets an error message based on an HRESULT */
+int
+WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr)
+{
+ TCHAR buffer[1024];
+ char *message;
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0,
+ buffer, SDL_arraysize(buffer), NULL);
+ message = WIN_StringToUTF8(buffer);
+ SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
+ SDL_free(message);
+ return -1;
+}
+
+/* Sets an error message based on GetLastError() */
+int
+WIN_SetError(const char *prefix)
+{
+ return WIN_SetErrorFromHRESULT(prefix, GetLastError());
+}
+
+HRESULT
+WIN_CoInitialize(void)
+{
+ /* SDL handles any threading model, so initialize with the default, which
+ is compatible with OLE and if that doesn't work, try multi-threaded mode.
+
+ If you need multi-threaded mode, call CoInitializeEx() before SDL_Init()
+ */
+#ifdef __WINRT__
+ /* DLudwig: On WinRT, it is assumed that COM was initialized in main().
+ CoInitializeEx is available (not CoInitialize though), however
+ on WinRT, main() is typically declared with the [MTAThread]
+ attribute, which, AFAIK, should initialize COM.
+ */
+ return S_OK;
+#else
+ HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ if (hr == RPC_E_CHANGED_MODE) {
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ }
+
+ /* S_FALSE means success, but someone else already initialized. */
+ /* You still need to call CoUninitialize in this case! */
+ if (hr == S_FALSE) {
+ return S_OK;
+ }
+
+ return hr;
+#endif
+}
+
+void
+WIN_CoUninitialize(void)
+{
+#ifndef __WINRT__
+ CoUninitialize();
+#endif
+}
+
+#ifndef __WINRT__
+static BOOL
+IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
+{
+ OSVERSIONINFOEXW osvi;
+ DWORDLONG const dwlConditionMask = VerSetConditionMask(
+ VerSetConditionMask(
+ VerSetConditionMask(
+ 0, VER_MAJORVERSION, VER_GREATER_EQUAL ),
+ VER_MINORVERSION, VER_GREATER_EQUAL ),
+ VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL );
+
+ SDL_zero(osvi);
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ osvi.dwMajorVersion = wMajorVersion;
+ osvi.dwMinorVersion = wMinorVersion;
+ osvi.wServicePackMajor = wServicePackMajor;
+
+ return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
+}
+#endif
+
+BOOL WIN_IsWindowsVistaOrGreater(void)
+{
+#ifdef __WINRT__
+ return TRUE;
+#else
+ return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
+#endif
+}
+
+BOOL WIN_IsWindows7OrGreater(void)
+{
+#ifdef __WINRT__
+ return TRUE;
+#else
+ return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
+#endif
+}
+
+/*
+WAVExxxCAPS gives you 31 bytes for the device name, and just truncates if it's
+longer. However, since WinXP, you can use the WAVExxxCAPS2 structure, which
+will give you a name GUID. The full name is in the Windows Registry under
+that GUID, located here: HKLM\System\CurrentControlSet\Control\MediaCategories
+
+Note that drivers can report GUID_NULL for the name GUID, in which case,
+Windows makes a best effort to fill in those 31 bytes in the usual place.
+This info summarized from MSDN:
+
+http://web.archive.org/web/20131027093034/http://msdn.microsoft.com/en-us/library/windows/hardware/ff536382(v=vs.85).aspx
+
+Always look this up in the registry if possible, because the strings are
+different! At least on Win10, I see "Yeti Stereo Microphone" in the
+Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh.
+
+(Also, DirectSound shouldn't be limited to 32 chars, but its device enum
+has the same problem.)
+
+WASAPI doesn't need this. This is just for DirectSound/WinMM.
+*/
+char *
+WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
+{
+#if __WINRT__
+ return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP, go with what we've got. */
+#else
+ static const GUID nullguid = { 0 };
+ const unsigned char *ptr;
+ char keystr[128];
+ WCHAR *strw = NULL;
+ SDL_bool rc;
+ HKEY hkey;
+ DWORD len = 0;
+ char *retval = NULL;
+
+ if (WIN_IsEqualGUID(guid, &nullguid)) {
+ return WIN_StringToUTF8(name); /* No GUID, go with what we've got. */
+ }
+
+ ptr = (const unsigned char *) guid;
+ SDL_snprintf(keystr, sizeof (keystr),
+ "System\\CurrentControlSet\\Control\\MediaCategories\\{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ ptr[3], ptr[2], ptr[1], ptr[0], ptr[5], ptr[4], ptr[7], ptr[6],
+ ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15]);
+
+ strw = WIN_UTF8ToString(keystr);
+ rc = (RegOpenKeyExW(HKEY_LOCAL_MACHINE, strw, 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS);
+ SDL_free(strw);
+ if (!rc) {
+ return WIN_StringToUTF8(name); /* oh well. */
+ }
+
+ rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, NULL, &len) == ERROR_SUCCESS);
+ if (!rc) {
+ RegCloseKey(hkey);
+ return WIN_StringToUTF8(name); /* oh well. */
+ }
+
+ strw = (WCHAR *) SDL_malloc(len + sizeof (WCHAR));
+ if (!strw) {
+ RegCloseKey(hkey);
+ return WIN_StringToUTF8(name); /* oh well. */
+ }
+
+ rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, (LPBYTE) strw, &len) == ERROR_SUCCESS);
+ RegCloseKey(hkey);
+ if (!rc) {
+ SDL_free(strw);
+ return WIN_StringToUTF8(name); /* oh well. */
+ }
+
+ strw[len / 2] = 0; /* make sure it's null-terminated. */
+
+ retval = WIN_StringToUTF8(strw);
+ SDL_free(strw);
+ return retval ? retval : WIN_StringToUTF8(name);
+#endif /* if __WINRT__ / else */
+}
+
+BOOL
+WIN_IsEqualGUID(const GUID * a, const GUID * b)
+{
+ return (SDL_memcmp(a, b, sizeof (*a)) == 0);
+}
+
+BOOL
+WIN_IsEqualIID(REFIID a, REFIID b)
+{
+ return (SDL_memcmp(a, b, sizeof (*a)) == 0);
+}
+
+#endif /* __WIN32__ || __WINRT__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/windows/SDL_windows.h b/src/3rdparty/SDL2/src/core/windows/SDL_windows.h
new file mode 100644
index 0000000..4a3336a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/windows/SDL_windows.h
@@ -0,0 +1,75 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* This is an include file for windows.h with the SDL build settings */
+
+#ifndef _INCLUDED_WINDOWS_H
+#define _INCLUDED_WINDOWS_H
+
+#if defined(__WIN32__)
+#define WIN32_LEAN_AND_MEAN
+#define STRICT
+#ifndef UNICODE
+#define UNICODE 1
+#endif
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
+#endif
+
+#include <windows.h>
+#include <basetyps.h> /* for REFIID with broken mingw.org headers */
+
+/* Routines to convert from UTF8 to native Windows text */
+#if UNICODE
+#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR))
+#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1)
+#else
+/* !!! FIXME: UTF8ToString() can just be a SDL_strdup() here. */
+#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1))
+#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
+#endif
+
+/* Sets an error message based on a given HRESULT */
+extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
+
+/* Sets an error message based on GetLastError(). Always return -1. */
+extern int WIN_SetError(const char *prefix);
+
+/* Wrap up the oddities of CoInitialize() into a common function. */
+extern HRESULT WIN_CoInitialize(void);
+extern void WIN_CoUninitialize(void);
+
+/* Returns SDL_TRUE if we're running on Windows Vista and newer */
+extern BOOL WIN_IsWindowsVistaOrGreater(void);
+
+/* Returns SDL_TRUE if we're running on Windows 7 and newer */
+extern BOOL WIN_IsWindows7OrGreater(void);
+
+/* You need to SDL_free() the result of this call. */
+extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid);
+
+/* Checks to see if two GUID are the same. */
+extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b);
+extern BOOL WIN_IsEqualIID(REFIID a, REFIID b);
+
+#endif /* _INCLUDED_WINDOWS_H */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/windows/SDL_xinput.c b/src/3rdparty/SDL2/src/core/windows/SDL_xinput.c
new file mode 100644
index 0000000..75bf600
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/windows/SDL_xinput.c
@@ -0,0 +1,139 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_assert.h"
+#include "SDL_xinput.h"
+
+
+#ifdef HAVE_XINPUT_H
+
+XInputGetState_t SDL_XInputGetState = NULL;
+XInputSetState_t SDL_XInputSetState = NULL;
+XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL;
+XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation = NULL;
+DWORD SDL_XInputVersion = 0;
+
+static HANDLE s_pXInputDLL = 0;
+static int s_XInputDLLRefCount = 0;
+
+
+#ifdef __WINRT__
+
+int
+WIN_LoadXInputDLL(void)
+{
+ /* Getting handles to system dlls (via LoadLibrary and its variants) is not
+ * supported on WinRT, thus, pointers to XInput's functions can't be
+ * retrieved via GetProcAddress.
+ *
+ * When on WinRT, assume that XInput is already loaded, and directly map
+ * its XInput.h-declared functions to the SDL_XInput* set of function
+ * pointers.
+ *
+ * Side-note: XInputGetStateEx is not available for use in WinRT.
+ * This seems to mean that support for the guide button is not available
+ * in WinRT, unfortunately.
+ */
+ SDL_XInputGetState = (XInputGetState_t)XInputGetState;
+ SDL_XInputSetState = (XInputSetState_t)XInputSetState;
+ SDL_XInputGetCapabilities = (XInputGetCapabilities_t)XInputGetCapabilities;
+ SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)XInputGetBatteryInformation;
+
+ /* XInput 1.4 ships with Windows 8 and 8.1: */
+ SDL_XInputVersion = (1 << 16) | 4;
+
+ return 0;
+}
+
+void
+WIN_UnloadXInputDLL(void)
+{
+}
+
+#else /* !__WINRT__ */
+
+int
+WIN_LoadXInputDLL(void)
+{
+ DWORD version = 0;
+
+ if (s_pXInputDLL) {
+ SDL_assert(s_XInputDLLRefCount > 0);
+ s_XInputDLLRefCount++;
+ return 0; /* already loaded */
+ }
+
+ version = (1 << 16) | 4;
+ s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
+ if (!s_pXInputDLL) {
+ version = (1 << 16) | 3;
+ s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 can be installed as a redistributable component. */
+ }
+ if (!s_pXInputDLL) {
+ s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
+ }
+ if (!s_pXInputDLL) {
+ /* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) */
+ s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll");
+ }
+ if (!s_pXInputDLL) {
+ return -1;
+ }
+
+ SDL_assert(s_XInputDLLRefCount == 0);
+ SDL_XInputVersion = version;
+ s_XInputDLLRefCount = 1;
+
+ /* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
+ SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
+ if (!SDL_XInputGetState) {
+ SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
+ }
+ SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
+ SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
+ SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
+ if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
+ WIN_UnloadXInputDLL();
+ return -1;
+ }
+
+ return 0;
+}
+
+void
+WIN_UnloadXInputDLL(void)
+{
+ if (s_pXInputDLL) {
+ SDL_assert(s_XInputDLLRefCount > 0);
+ if (--s_XInputDLLRefCount == 0) {
+ FreeLibrary(s_pXInputDLL);
+ s_pXInputDLL = NULL;
+ }
+ } else {
+ SDL_assert(s_XInputDLLRefCount == 0);
+ }
+}
+
+#endif /* __WINRT__ */
+#endif /* HAVE_XINPUT_H */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/windows/SDL_xinput.h b/src/3rdparty/SDL2/src/core/windows/SDL_xinput.h
new file mode 100644
index 0000000..6106c2b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/windows/SDL_xinput.h
@@ -0,0 +1,177 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_xinput_h_
+#define SDL_xinput_h_
+
+#ifdef HAVE_XINPUT_H
+
+#include "SDL_windows.h"
+#include <xinput.h>
+
+#ifndef XUSER_MAX_COUNT
+#define XUSER_MAX_COUNT 4
+#endif
+#ifndef XUSER_INDEX_ANY
+#define XUSER_INDEX_ANY 0x000000FF
+#endif
+#ifndef XINPUT_CAPS_FFB_SUPPORTED
+#define XINPUT_CAPS_FFB_SUPPORTED 0x0001
+#endif
+
+#ifndef XINPUT_DEVSUBTYPE_UNKNOWN
+#define XINPUT_DEVSUBTYPE_UNKNOWN 0x00
+#endif
+#ifndef XINPUT_DEVSUBTYPE_GAMEPAD
+#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
+#endif
+#ifndef XINPUT_DEVSUBTYPE_WHEEL
+#define XINPUT_DEVSUBTYPE_WHEEL 0x02
+#endif
+#ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK
+#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
+#endif
+#ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK
+#define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04
+#endif
+#ifndef XINPUT_DEVSUBTYPE_DANCE_PAD
+#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
+#endif
+#ifndef XINPUT_DEVSUBTYPE_GUITAR
+#define XINPUT_DEVSUBTYPE_GUITAR 0x06
+#endif
+#ifndef XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE
+#define XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE 0x07
+#endif
+#ifndef XINPUT_DEVSUBTYPE_DRUM_KIT
+#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
+#endif
+#ifndef XINPUT_DEVSUBTYPE_GUITAR_BASS
+#define XINPUT_DEVSUBTYPE_GUITAR_BASS 0x0B
+#endif
+#ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD
+#define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13
+#endif
+
+#ifndef XINPUT_GAMEPAD_GUIDE
+#define XINPUT_GAMEPAD_GUIDE 0x0400
+#endif
+
+#ifndef BATTERY_DEVTYPE_GAMEPAD
+#define BATTERY_DEVTYPE_GAMEPAD 0x00
+#endif
+#ifndef BATTERY_TYPE_WIRED
+#define BATTERY_TYPE_WIRED 0x01
+#endif
+
+#ifndef BATTERY_TYPE_UNKNOWN
+#define BATTERY_TYPE_UNKNOWN 0xFF
+#endif
+#ifndef BATTERY_LEVEL_EMPTY
+#define BATTERY_LEVEL_EMPTY 0x00
+#endif
+#ifndef BATTERY_LEVEL_LOW
+#define BATTERY_LEVEL_LOW 0x01
+#endif
+#ifndef BATTERY_LEVEL_MEDIUM
+#define BATTERY_LEVEL_MEDIUM 0x02
+#endif
+#ifndef BATTERY_LEVEL_FULL
+#define BATTERY_LEVEL_FULL 0x03
+#endif
+
+/* typedef's for XInput structs we use */
+
+#ifndef HAVE_XINPUT_GAMEPAD_EX
+typedef struct
+{
+ WORD wButtons;
+ BYTE bLeftTrigger;
+ BYTE bRightTrigger;
+ SHORT sThumbLX;
+ SHORT sThumbLY;
+ SHORT sThumbRX;
+ SHORT sThumbRY;
+ DWORD dwPaddingReserved;
+} XINPUT_GAMEPAD_EX;
+#endif
+
+#ifndef HAVE_XINPUT_STATE_EX
+typedef struct
+{
+ DWORD dwPacketNumber;
+ XINPUT_GAMEPAD_EX Gamepad;
+} XINPUT_STATE_EX;
+#endif
+
+typedef struct
+{
+ BYTE BatteryType;
+ BYTE BatteryLevel;
+} XINPUT_BATTERY_INFORMATION_EX;
+
+/* Forward decl's for XInput API's we load dynamically and use if available */
+typedef DWORD (WINAPI *XInputGetState_t)
+ (
+ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
+ XINPUT_STATE_EX* pState /* [out] Receives the current state */
+ );
+
+typedef DWORD (WINAPI *XInputSetState_t)
+ (
+ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
+ XINPUT_VIBRATION* pVibration /* [in, out] The vibration information to send to the controller */
+ );
+
+typedef DWORD (WINAPI *XInputGetCapabilities_t)
+ (
+ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
+ DWORD dwFlags, /* [in] Input flags that identify the device type */
+ XINPUT_CAPABILITIES* pCapabilities /* [out] Receives the capabilities */
+ );
+
+typedef DWORD (WINAPI *XInputGetBatteryInformation_t)
+ (
+ DWORD dwUserIndex,
+ BYTE devType,
+ XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation
+ );
+
+extern int WIN_LoadXInputDLL(void);
+extern void WIN_UnloadXInputDLL(void);
+
+extern XInputGetState_t SDL_XInputGetState;
+extern XInputSetState_t SDL_XInputSetState;
+extern XInputGetCapabilities_t SDL_XInputGetCapabilities;
+extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation;
+extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
+
+#define XINPUTGETSTATE SDL_XInputGetState
+#define XINPUTSETSTATE SDL_XInputSetState
+#define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities
+#define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation
+
+#endif /* HAVE_XINPUT_H */
+
+#endif /* SDL_xinput_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.cpp b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.cpp
new file mode 100644
index 0000000..887b47e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.cpp
@@ -0,0 +1,66 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_system.h"
+#include "SDL_winrtapp_direct3d.h"
+#include "SDL_winrtapp_xaml.h"
+
+#include <wrl.h>
+
+int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL;
+
+extern "C" DECLSPEC int
+SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel)
+{
+ if (xamlBackgroundPanel) {
+ return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel);
+ } else {
+ if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
+ return 1;
+ }
+ return SDL_WinRTInitNonXAMLApp(mainFunction);
+ }
+}
+
+
+extern "C" DECLSPEC SDL_WinRT_DeviceFamily
+SDL_WinRTGetDeviceFamily()
+{
+#if NTDDI_VERSION >= NTDDI_WIN10 /* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */
+ Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily;
+
+ if (deviceFamily->Equals("Windows.Desktop"))
+ {
+ return SDL_WINRT_DEVICEFAMILY_DESKTOP;
+ }
+ else if (deviceFamily->Equals("Windows.Mobile"))
+ {
+ return SDL_WINRT_DEVICEFAMILY_MOBILE;
+ }
+ else if (deviceFamily->Equals("Windows.Xbox"))
+ {
+ return SDL_WINRT_DEVICEFAMILY_XBOX;
+ }
+#endif
+
+ return SDL_WINRT_DEVICEFAMILY_UNKNOWN;
+} \ No newline at end of file
diff --git a/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.h b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.h
new file mode 100644
index 0000000..d68704c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_common.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#ifndef SDL_winrtapp_common_h_
+#define SDL_winrtapp_common_h_
+
+/* A pointer to the app's C-style main() function (which is a different
+ function than the WinRT app's actual entry point).
+ */
+extern int (*WINRT_SDLAppEntryPoint)(int, char **);
+
+#endif // SDL_winrtapp_common_h_
diff --git a/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp
new file mode 100644
index 0000000..6fa0bea
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -0,0 +1,855 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* Standard C++11 includes */
+#include <functional>
+#include <string>
+#include <sstream>
+using namespace std;
+
+
+/* Windows includes */
+#include "ppltasks.h"
+using namespace concurrency;
+using namespace Windows::ApplicationModel;
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::ApplicationModel::Activation;
+using namespace Windows::Devices::Input;
+using namespace Windows::Graphics::Display;
+using namespace Windows::Foundation;
+using namespace Windows::System;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Input;
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+using namespace Windows::Phone::UI::Input;
+#endif
+
+
+/* SDL includes */
+extern "C" {
+#include "SDL_assert.h"
+#include "SDL_events.h"
+#include "SDL_hints.h"
+#include "SDL_log.h"
+#include "SDL_main.h"
+#include "SDL_stdinc.h"
+#include "SDL_render.h"
+#include "../../video/SDL_sysvideo.h"
+//#include "../../SDL_hints_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_windowevents_c.h"
+#include "../../render/SDL_sysrender.h"
+#include "../windows/SDL_windows.h"
+}
+
+#include "../../video/winrt/SDL_winrtevents_c.h"
+#include "../../video/winrt/SDL_winrtvideo_cpp.h"
+#include "SDL_winrtapp_common.h"
+#include "SDL_winrtapp_direct3d.h"
+
+#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
+/* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary
+ * when Windows 8.1 apps are about to get suspended.
+ */
+extern "C" void D3D11_Trim(SDL_Renderer *);
+#endif
+
+
+// Compile-time debugging options:
+// To enable, uncomment; to disable, comment them out.
+//#define LOG_POINTER_EVENTS 1
+//#define LOG_WINDOW_EVENTS 1
+//#define LOG_ORIENTATION_EVENTS 1
+
+
+// HACK, DLudwig: record a reference to the global, WinRT 'app'/view.
+// SDL/WinRT will use this throughout its code.
+//
+// TODO, WinRT: consider replacing SDL_WinRTGlobalApp with something
+// non-global, such as something created inside
+// SDL_InitSubSystem(SDL_INIT_VIDEO), or something inside
+// SDL_CreateWindow().
+SDL_WinRTApp ^ SDL_WinRTGlobalApp = nullptr;
+
+ref class SDLApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
+{
+public:
+ virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
+};
+
+IFrameworkView^ SDLApplicationSource::CreateView()
+{
+ // TODO, WinRT: see if this function (CreateView) can ever get called
+ // more than once. For now, just prevent it from ever assigning
+ // SDL_WinRTGlobalApp more than once.
+ SDL_assert(!SDL_WinRTGlobalApp);
+ SDL_WinRTApp ^ app = ref new SDL_WinRTApp();
+ if (!SDL_WinRTGlobalApp)
+ {
+ SDL_WinRTGlobalApp = app;
+ }
+ return app;
+}
+
+int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **))
+{
+ WINRT_SDLAppEntryPoint = mainFunction;
+ auto direct3DApplicationSource = ref new SDLApplicationSource();
+ CoreApplication::Run(direct3DApplicationSource);
+ return 0;
+}
+
+static void SDLCALL
+WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
+{
+ SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);
+
+ /* HACK: prevent SDL from altering an app's .appxmanifest-set orientation
+ * from being changed on startup, by detecting when SDL_HINT_ORIENTATIONS
+ * is getting registered.
+ *
+ * TODO, WinRT: consider reading in an app's .appxmanifest file, and apply its orientation when 'newValue == NULL'.
+ */
+ if ((oldValue == NULL) && (newValue == NULL)) {
+ return;
+ }
+
+ // Start with no orientation flags, then add each in as they're parsed
+ // from newValue.
+ unsigned int orientationFlags = 0;
+ if (newValue) {
+ std::istringstream tokenizer(newValue);
+ while (!tokenizer.eof()) {
+ std::string orientationName;
+ std::getline(tokenizer, orientationName, ' ');
+ if (orientationName == "LandscapeLeft") {
+ orientationFlags |= (unsigned int) DisplayOrientations::LandscapeFlipped;
+ } else if (orientationName == "LandscapeRight") {
+ orientationFlags |= (unsigned int) DisplayOrientations::Landscape;
+ } else if (orientationName == "Portrait") {
+ orientationFlags |= (unsigned int) DisplayOrientations::Portrait;
+ } else if (orientationName == "PortraitUpsideDown") {
+ orientationFlags |= (unsigned int) DisplayOrientations::PortraitFlipped;
+ }
+ }
+ }
+
+ // If no valid orientation flags were specified, use a reasonable set of defaults:
+ if (!orientationFlags) {
+ // TODO, WinRT: consider seeing if an app's default orientation flags can be found out via some API call(s).
+ orientationFlags = (unsigned int) ( \
+ DisplayOrientations::Landscape |
+ DisplayOrientations::LandscapeFlipped |
+ DisplayOrientations::Portrait |
+ DisplayOrientations::PortraitFlipped);
+ }
+
+ // Set the orientation/rotation preferences. Please note that this does
+ // not constitute a 100%-certain lock of a given set of possible
+ // orientations. According to Microsoft's documentation on WinRT [1]
+ // when a device is not capable of being rotated, Windows may ignore
+ // the orientation preferences, and stick to what the device is capable of
+ // displaying.
+ //
+ // [1] Documentation on the 'InitialRotationPreference' setting for a
+ // Windows app's manifest file describes how some orientation/rotation
+ // preferences may be ignored. See
+ // http://msdn.microsoft.com/en-us/library/windows/apps/hh700343.aspx
+ // for details. Microsoft's "Display orientation sample" also gives an
+ // outline of how Windows treats device rotation
+ // (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
+ WINRT_DISPLAY_PROPERTY(AutoRotationPreferences) = (DisplayOrientations) orientationFlags;
+}
+
+static void
+WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identifying thing into WINRT_ProcessWindowSizeChange()
+{
+ CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread();
+ if (coreWindow) {
+ if (WINRT_GlobalSDLWindow) {
+ SDL_Window * window = WINRT_GlobalSDLWindow;
+ SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
+
+ int x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left);
+ int y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top);
+ int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+ int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
+ /* WinPhone 8.0 always keeps its native window size in portrait,
+ regardless of orientation. This changes in WinPhone 8.1,
+ in which the native window's size changes along with
+ orientation.
+
+ Attempt to emulate WinPhone 8.1's behavior on WinPhone 8.0, with
+ regards to window size. This fixes a rendering bug that occurs
+ when a WinPhone 8.0 app is rotated to either 90 or 270 degrees.
+ */
+ const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
+ switch (currentOrientation) {
+ case DisplayOrientations::Landscape:
+ case DisplayOrientations::LandscapeFlipped: {
+ int tmp = w;
+ w = h;
+ h = tmp;
+ } break;
+ }
+#endif
+
+ const Uint32 latestFlags = WINRT_DetectWindowFlags(window);
+ if (latestFlags & SDL_WINDOW_MAXIMIZED) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+ } else {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ }
+
+ WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+
+ /* The window can move during a resize event, such as when maximizing
+ or resizing from a corner */
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
+ }
+ }
+}
+
+SDL_WinRTApp::SDL_WinRTApp() :
+ m_windowClosed(false),
+ m_windowVisible(true)
+{
+}
+
+void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView)
+{
+ applicationView->Activated +=
+ ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &SDL_WinRTApp::OnAppActivated);
+
+ CoreApplication::Suspending +=
+ ref new EventHandler<SuspendingEventArgs^>(this, &SDL_WinRTApp::OnSuspending);
+
+ CoreApplication::Resuming +=
+ ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnResuming);
+
+ CoreApplication::Exiting +=
+ ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnExiting);
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+ /* HACK ALERT! Xbox One doesn't seem to detect gamepads unless something
+ gets registered to receive Win10's Windows.Gaming.Input.Gamepad.GamepadAdded
+ events. We'll register an event handler for these events here, to make
+ sure that gamepad detection works later on, if requested.
+ */
+ Windows::Gaming::Input::Gamepad::GamepadAdded +=
+ ref new Windows::Foundation::EventHandler<Windows::Gaming::Input::Gamepad^>(
+ this, &SDL_WinRTApp::OnGamepadAdded
+ );
+#endif
+}
+
+#if NTDDI_VERSION > NTDDI_WIN8
+void SDL_WinRTApp::OnOrientationChanged(DisplayInformation^ sender, Object^ args)
+#else
+void SDL_WinRTApp::OnOrientationChanged(Object^ sender)
+#endif
+{
+#if LOG_ORIENTATION_EVENTS==1
+ {
+ CoreWindow^ window = CoreWindow::GetForCurrentThread();
+ if (window) {
+ SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Bounds={%f,%f,%f,%f}\n",
+ __FUNCTION__,
+ WINRT_DISPLAY_PROPERTY(CurrentOrientation),
+ WINRT_DISPLAY_PROPERTY(NativeOrientation),
+ WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
+ window->Bounds.X,
+ window->Bounds.Y,
+ window->Bounds.Width,
+ window->Bounds.Height);
+ } else {
+ SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n",
+ __FUNCTION__,
+ WINRT_DISPLAY_PROPERTY(CurrentOrientation),
+ WINRT_DISPLAY_PROPERTY(NativeOrientation),
+ WINRT_DISPLAY_PROPERTY(AutoRotationPreferences));
+ }
+ }
+#endif
+
+ WINRT_ProcessWindowSizeChange();
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ // HACK: Make sure that orientation changes
+ // lead to the Direct3D renderer's viewport getting updated:
+ //
+ // For some reason, this doesn't seem to need to be done on Windows 8.x,
+ // even when going from Landscape to LandscapeFlipped. It only seems to
+ // be needed on Windows Phone, at least when I tested on my devices.
+ // I'm not currently sure why this is, but it seems to work fine. -- David L.
+ //
+ // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases
+ SDL_Window * window = WINRT_GlobalSDLWindow;
+ if (window) {
+ SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
+ int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+ int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SIZE_CHANGED, w, h);
+ }
+#endif
+
+}
+
+void SDL_WinRTApp::SetWindow(CoreWindow^ window)
+{
+#if LOG_WINDOW_EVENTS==1
+ SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window bounds={%f, %f, %f,%f}\n",
+ __FUNCTION__,
+ WINRT_DISPLAY_PROPERTY(CurrentOrientation),
+ WINRT_DISPLAY_PROPERTY(NativeOrientation),
+ WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
+ window->Bounds.X,
+ window->Bounds.Y,
+ window->Bounds.Width,
+ window->Bounds.Height);
+#endif
+
+ window->SizeChanged +=
+ ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &SDL_WinRTApp::OnWindowSizeChanged);
+
+ window->VisibilityChanged +=
+ ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &SDL_WinRTApp::OnVisibilityChanged);
+
+ window->Activated +=
+ ref new TypedEventHandler<CoreWindow^, WindowActivatedEventArgs^>(this, &SDL_WinRTApp::OnWindowActivated);
+
+ window->Closed +=
+ ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &SDL_WinRTApp::OnWindowClosed);
+
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+ window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
+#endif
+
+ window->PointerPressed +=
+ ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerPressed);
+
+ window->PointerMoved +=
+ ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerMoved);
+
+ window->PointerReleased +=
+ ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased);
+
+ window->PointerEntered +=
+ ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerEntered);
+
+ window->PointerExited +=
+ ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerExited);
+
+ window->PointerWheelChanged +=
+ ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerWheelChanged);
+
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+ // Retrieves relative-only mouse movements:
+ Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved +=
+ ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &SDL_WinRTApp::OnMouseMoved);
+#endif
+
+ window->KeyDown +=
+ ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyDown);
+
+ window->KeyUp +=
+ ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyUp);
+
+ window->CharacterReceived +=
+ ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &SDL_WinRTApp::OnCharacterReceived);
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+ Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested +=
+ ref new EventHandler<BackRequestedEventArgs^>(this, &SDL_WinRTApp::OnBackButtonPressed);
+#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ HardwareButtons::BackPressed +=
+ ref new EventHandler<BackPressedEventArgs^>(this, &SDL_WinRTApp::OnBackButtonPressed);
+#endif
+
+#if NTDDI_VERSION > NTDDI_WIN8
+ DisplayInformation::GetForCurrentView()->OrientationChanged +=
+ ref new TypedEventHandler<Windows::Graphics::Display::DisplayInformation^, Object^>(this, &SDL_WinRTApp::OnOrientationChanged);
+#else
+ DisplayProperties::OrientationChanged +=
+ ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
+#endif
+
+ // Register the hint, SDL_HINT_ORIENTATIONS, with SDL.
+ // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly.
+ SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL);
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps)
+ // Make sure we know when a user has opened the app's settings pane.
+ // This is needed in order to display a privacy policy, which needs
+ // to be done for network-enabled apps, as per Windows Store requirements.
+ using namespace Windows::UI::ApplicationSettings;
+ SettingsPane::GetForCurrentView()->CommandsRequested +=
+ ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^>
+ (this, &SDL_WinRTApp::OnSettingsPaneCommandsRequested);
+#endif
+}
+
+void SDL_WinRTApp::Load(Platform::String^ entryPoint)
+{
+}
+
+void SDL_WinRTApp::Run()
+{
+ SDL_SetMainReady();
+ if (WINRT_SDLAppEntryPoint)
+ {
+ // TODO, WinRT: pass the C-style main() a reasonably realistic
+ // representation of command line arguments.
+ int argc = 0;
+ char **argv = NULL;
+ WINRT_SDLAppEntryPoint(argc, argv);
+ }
+}
+
+static bool IsSDLWindowEventPending(SDL_WindowEventID windowEventID)
+{
+ SDL_Event events[128];
+ const int count = SDL_PeepEvents(events, sizeof(events)/sizeof(SDL_Event), SDL_PEEKEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT);
+ for (int i = 0; i < count; ++i) {
+ if (events[i].window.event == windowEventID) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SDL_WinRTApp::ShouldWaitForAppResumeEvents()
+{
+ /* Don't wait if the app is visible: */
+ if (m_windowVisible) {
+ return false;
+ }
+
+ /* Don't wait until the window-hide events finish processing.
+ * Do note that if an app-suspend event is sent (as indicated
+ * by SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND
+ * events), then this code may be a moot point, as WinRT's
+ * own event pump (aka ProcessEvents()) will pause regardless
+ * of what we do here. This happens on Windows Phone 8, to note.
+ * Windows 8.x apps, on the other hand, may get a chance to run
+ * these.
+ */
+ if (IsSDLWindowEventPending(SDL_WINDOWEVENT_HIDDEN)) {
+ return false;
+ } else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_FOCUS_LOST)) {
+ return false;
+ } else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_MINIMIZED)) {
+ return false;
+ }
+
+ return true;
+}
+
+void SDL_WinRTApp::PumpEvents()
+{
+ if (!m_windowClosed) {
+ if (!ShouldWaitForAppResumeEvents()) {
+ /* This is the normal way in which events should be pumped.
+ * 'ProcessAllIfPresent' will make ProcessEvents() process anywhere
+ * from zero to N events, and will then return.
+ */
+ CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
+ } else {
+ /* This style of event-pumping, with 'ProcessOneAndAllPending',
+ * will cause anywhere from one to N events to be processed. If
+ * at least one event is processed, the call will return. If
+ * no events are pending, then the call will wait until one is
+ * available, and will not return (to the caller) until this
+ * happens! This should only occur when the app is hidden.
+ */
+ CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
+ }
+ }
+}
+
+void SDL_WinRTApp::Uninitialize()
+{
+}
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)
+void SDL_WinRTApp::OnSettingsPaneCommandsRequested(
+ Windows::UI::ApplicationSettings::SettingsPane ^p,
+ Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args)
+{
+ using namespace Platform;
+ using namespace Windows::UI::ApplicationSettings;
+ using namespace Windows::UI::Popups;
+
+ String ^privacyPolicyURL = nullptr; // a URL to an app's Privacy Policy
+ String ^privacyPolicyLabel = nullptr; // label/link text
+ const char *tmpHintValue = NULL; // SDL_GetHint-retrieved value, used immediately
+ wchar_t *tmpStr = NULL; // used for UTF8 to UCS2 conversion
+
+ // Setup a 'Privacy Policy' link, if one is available (via SDL_GetHint):
+ tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_URL);
+ if (tmpHintValue && tmpHintValue[0] != '\0') {
+ // Convert the privacy policy's URL to UCS2:
+ tmpStr = WIN_UTF8ToString(tmpHintValue);
+ privacyPolicyURL = ref new String(tmpStr);
+ SDL_free(tmpStr);
+
+ // Optionally retrieve custom label-text for the link. If this isn't
+ // available, a default value will be used instead.
+ tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_LABEL);
+ if (tmpHintValue && tmpHintValue[0] != '\0') {
+ tmpStr = WIN_UTF8ToString(tmpHintValue);
+ privacyPolicyLabel = ref new String(tmpStr);
+ SDL_free(tmpStr);
+ } else {
+ privacyPolicyLabel = ref new String(L"Privacy Policy");
+ }
+
+ // Register the link, along with a handler to be called if and when it is
+ // clicked:
+ auto cmd = ref new SettingsCommand(L"privacyPolicy", privacyPolicyLabel,
+ ref new UICommandInvokedHandler([=](IUICommand ^) {
+ Windows::System::Launcher::LaunchUriAsync(ref new Uri(privacyPolicyURL));
+ }));
+ args->Request->ApplicationCommands->Append(cmd);
+ }
+}
+#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)
+
+void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
+{
+#if LOG_WINDOW_EVENTS==1
+ SDL_Log("%s, size={%f,%f}, bounds={%f,%f,%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n",
+ __FUNCTION__,
+ args->Size.Width, args->Size.Height,
+ sender->Bounds.X, sender->Bounds.Y, sender->Bounds.Width, sender->Bounds.Height,
+ WINRT_DISPLAY_PROPERTY(CurrentOrientation),
+ WINRT_DISPLAY_PROPERTY(NativeOrientation),
+ WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
+ (WINRT_GlobalSDLWindow ? "yes" : "no"));
+#endif
+
+ WINRT_ProcessWindowSizeChange();
+}
+
+void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
+{
+#if LOG_WINDOW_EVENTS==1
+ SDL_Log("%s, visible?=%s, bounds={%f,%f,%f,%f}, WINRT_GlobalSDLWindow?=%s\n",
+ __FUNCTION__,
+ (args->Visible ? "yes" : "no"),
+ sender->Bounds.X, sender->Bounds.Y,
+ sender->Bounds.Width, sender->Bounds.Height,
+ (WINRT_GlobalSDLWindow ? "yes" : "no"));
+#endif
+
+ m_windowVisible = args->Visible;
+ if (WINRT_GlobalSDLWindow) {
+ SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
+ Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow);
+ if (args->Visible) {
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
+ if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) {
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+ } else {
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ }
+ } else {
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
+ SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+ }
+
+ // HACK: Prevent SDL's window-hide handling code, which currently
+ // triggers a fake window resize (possibly erronously), from
+ // marking the SDL window's surface as invalid.
+ //
+ // A better solution to this probably involves figuring out if the
+ // fake window resize can be prevented.
+ WINRT_GlobalSDLWindow->surface_valid = wasSDLWindowSurfaceValid;
+ }
+}
+
+void SDL_WinRTApp::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArgs^ args)
+{
+#if LOG_WINDOW_EVENTS==1
+ SDL_Log("%s, WINRT_GlobalSDLWindow?=%s\n\n",
+ __FUNCTION__,
+ (WINRT_GlobalSDLWindow ? "yes" : "no"));
+#endif
+
+ /* There's no property in Win 8.x to tell whether a window is active or
+ not. [De]activation events are, however, sent to the app. We'll just
+ record those, in case the CoreWindow gets wrapped by an SDL_Window at
+ some future time.
+ */
+ sender->CustomProperties->Insert("SDLHelperWindowActivationState", args->WindowActivationState);
+
+ SDL_Window * window = WINRT_GlobalSDLWindow;
+ if (window) {
+ if (args->WindowActivationState != CoreWindowActivationState::Deactivated) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ if (SDL_GetKeyboardFocus() != window) {
+ SDL_SetKeyboardFocus(window);
+ }
+
+ /* Send a mouse-motion event as appropriate.
+ This doesn't work when called from OnPointerEntered, at least
+ not in WinRT CoreWindow apps (as OnPointerEntered doesn't
+ appear to be called after window-reactivation, at least not
+ in Windows 10, Build 10586.3 (November 2015 update, non-beta).
+
+ Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition'
+ property isn't available.
+ */
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE)
+ Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize);
+ SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y);
+#endif
+
+ /* TODO, WinRT: see if the Win32 bugfix from https://hg.libsdl.org/SDL/rev/d278747da408 needs to be applied (on window activation) */
+ //WIN_CheckAsyncMouseRelease(data);
+
+ /* TODO, WinRT: implement clipboard support, if possible */
+ ///*
+ // * FIXME: Update keyboard state
+ // */
+ //WIN_CheckClipboardUpdate(data->videodata);
+
+ // HACK: Resetting the mouse-cursor here seems to fix
+ // https://bugzilla.libsdl.org/show_bug.cgi?id=3217, whereby a
+ // WinRT app's mouse cursor may switch to Windows' 'wait' cursor,
+ // after a user alt-tabs back into a full-screened SDL app.
+ // This bug does not appear to reproduce 100% of the time.
+ // It may be a bug in Windows itself (v.10.0.586.36, as tested,
+ // and the most-recent as of this writing).
+ SDL_SetCursor(NULL);
+ } else {
+ if (SDL_GetKeyboardFocus() == window) {
+ SDL_SetKeyboardFocus(NULL);
+ }
+ }
+ }
+}
+
+void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
+{
+#if LOG_WINDOW_EVENTS==1
+ SDL_Log("%s\n", __FUNCTION__);
+#endif
+ m_windowClosed = true;
+}
+
+void SDL_WinRTApp::OnAppActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
+{
+ CoreWindow::GetForCurrentThread()->Activate();
+}
+
+void SDL_WinRTApp::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
+{
+ // Save app state asynchronously after requesting a deferral. Holding a deferral
+ // indicates that the application is busy performing suspending operations. Be
+ // aware that a deferral may not be held indefinitely. After about five seconds,
+ // the app will be forced to exit.
+
+ // ... but first, let the app know it's about to go to the background.
+ // The separation of events may be important, given that the deferral
+ // runs in a separate thread. This'll make SDL_APP_WILLENTERBACKGROUND
+ // the only event among the two that runs in the main thread. Given
+ // that a few WinRT operations can only be done from the main thread
+ // (things that access the WinRT CoreWindow are one example of this),
+ // this could be important.
+ SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
+
+ SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
+ create_task([this, deferral]()
+ {
+ // Send an app did-enter-background event immediately to observers.
+ // CoreDispatcher::ProcessEvents, which is the backbone on which
+ // SDL_WinRTApp::PumpEvents is built, will not return to its caller
+ // once it sends out a suspend event. Any events posted to SDL's
+ // event queue won't get received until the WinRT app is resumed.
+ // SDL_AddEventWatch() may be used to receive app-suspend events on
+ // WinRT.
+ SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
+
+ // Let the Direct3D 11 renderer prepare for the app to be backgrounded.
+ // This is necessary for Windows 8.1, possibly elsewhere in the future.
+ // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx
+#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
+ if (WINRT_GlobalSDLWindow) {
+ SDL_Renderer * renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow);
+ if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) {
+ D3D11_Trim(renderer);
+ }
+ }
+#endif
+
+ deferral->Complete();
+ });
+}
+
+void SDL_WinRTApp::OnResuming(Platform::Object^ sender, Platform::Object^ args)
+{
+ // Restore any data or state that was unloaded on suspend. By default, data
+ // and state are persisted when resuming from suspend. Note that these events
+ // do not occur if the app was previously terminated.
+ SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
+ SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
+}
+
+void SDL_WinRTApp::OnExiting(Platform::Object^ sender, Platform::Object^ args)
+{
+ SDL_SendAppEvent(SDL_APP_TERMINATING);
+}
+
+static void
+WINRT_LogPointerEvent(const char * header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint)
+{
+ Windows::UI::Input::PointerPoint ^ pt = args->CurrentPoint;
+ SDL_Log("%s: Position={%f,%f}, Transformed Pos={%f, %f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, SDL button=%d\n",
+ header,
+ pt->Position.X, pt->Position.Y,
+ transformedPoint.X, transformedPoint.Y,
+ pt->Properties->MouseWheelDelta,
+ pt->FrameId,
+ pt->PointerId,
+ WINRT_GetSDLButtonForPointerPoint(pt));
+}
+
+void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+ WINRT_LogPointerEvent("pointer pressed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+ WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+ WINRT_LogPointerEvent("pointer moved", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+ WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+ WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+ WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnPointerEntered(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+ WINRT_LogPointerEvent("pointer entered", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+ WINRT_ProcessPointerEnteredEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnPointerExited(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+ WINRT_LogPointerEvent("pointer exited", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+ WINRT_ProcessPointerExitedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+ WINRT_LogPointerEvent("pointer wheel changed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+ WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnMouseMoved(MouseDevice^ mouseDevice, MouseEventArgs^ args)
+{
+ WINRT_ProcessMouseMovedEvent(WINRT_GlobalSDLWindow, args);
+}
+
+void SDL_WinRTApp::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
+{
+ WINRT_ProcessKeyDownEvent(args);
+}
+
+void SDL_WinRTApp::OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
+{
+ WINRT_ProcessKeyUpEvent(args);
+}
+
+void SDL_WinRTApp::OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args)
+{
+ WINRT_ProcessCharacterReceivedEvent(args);
+}
+
+template <typename BackButtonEventArgs>
+static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args)
+{
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_AC_BACK);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_AC_BACK);
+
+ if (SDL_GetHintBoolean(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, SDL_FALSE)) {
+ args->Handled = true;
+ }
+}
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args)
+
+{
+ WINRT_OnBackButtonPressed(args);
+}
+#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args)
+
+{
+ WINRT_OnBackButtonPressed(args);
+}
+#endif
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+void SDL_WinRTApp::OnGamepadAdded(Platform::Object ^sender, Windows::Gaming::Input::Gamepad ^gamepad)
+{
+ /* HACK ALERT: Nothing needs to be done here, as this method currently
+ only exists to allow something to be registered with Win10's
+ GamepadAdded event, an operation that seems to be necessary to get
+ Xinput-based detection to work on Xbox One.
+ */
+}
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h
new file mode 100644
index 0000000..7f52592
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h
@@ -0,0 +1,92 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include <Windows.h>
+
+extern int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **));
+
+ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
+{
+public:
+ SDL_WinRTApp();
+
+ // IFrameworkView Methods.
+ virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
+ virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
+ virtual void Load(Platform::String^ entryPoint);
+ virtual void Run();
+ virtual void Uninitialize();
+
+internal:
+ // SDL-specific methods
+ void PumpEvents();
+
+protected:
+ bool ShouldWaitForAppResumeEvents();
+
+ // Event Handlers.
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps)
+ void OnSettingsPaneCommandsRequested(
+ Windows::UI::ApplicationSettings::SettingsPane ^p,
+ Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args);
+#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)
+
+#if NTDDI_VERSION > NTDDI_WIN8
+ void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
+#else
+ void OnOrientationChanged(Platform::Object^ sender);
+#endif
+ void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
+ void OnLogicalDpiChanged(Platform::Object^ sender);
+ void OnAppActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
+ void OnResuming(Platform::Object^ sender, Platform::Object^ args);
+ void OnExiting(Platform::Object^ sender, Platform::Object^ args);
+ void OnWindowActivated(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args);
+ void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
+ void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
+ void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+ void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+ void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+ void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+ void OnPointerEntered(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+ void OnPointerExited(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+ void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
+ void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
+ void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
+ void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args);
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+ void OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args);
+#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args);
+#endif
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+ void OnGamepadAdded(Platform::Object ^sender, Windows::Gaming::Input::Gamepad ^gamepad);
+#endif
+
+private:
+ bool m_windowClosed;
+ bool m_windowVisible;
+};
+
+extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
diff --git a/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp
new file mode 100644
index 0000000..9789d03
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp
@@ -0,0 +1,160 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* Windows includes */
+#include <agile.h>
+#include <Windows.h>
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#include <windows.ui.xaml.media.dxinterop.h>
+#endif
+
+
+/* SDL includes */
+#include "../../SDL_internal.h"
+#include "SDL.h"
+#include "../../video/winrt/SDL_winrtevents_c.h"
+#include "../../video/winrt/SDL_winrtvideo_cpp.h"
+#include "SDL_winrtapp_common.h"
+#include "SDL_winrtapp_xaml.h"
+
+
+
+/* SDL-internal globals: */
+SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+extern "C"
+ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
+static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken;
+#endif
+
+
+/*
+ * Input event handlers (XAML)
+ */
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+
+static void
+WINRT_OnPointerPressedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
+{
+ WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
+}
+
+static void
+WINRT_OnPointerMovedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
+{
+ WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
+}
+
+static void
+WINRT_OnPointerReleasedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
+{
+ WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
+}
+
+static void
+WINRT_OnPointerWheelChangedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
+{
+ WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
+}
+
+#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP
+
+
+/*
+ * XAML-to-SDL Rendering Callback
+ */
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+
+static void
+WINRT_OnRenderViaXAML(_In_ Platform::Object^ sender, _In_ Platform::Object^ args)
+{
+ WINRT_CycleXAMLThread();
+}
+
+#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP
+
+
+/*
+ * SDL + XAML Initialization
+ */
+
+int
+SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable)
+{
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ return SDL_SetError("XAML support is not yet available in Windows Phone.");
+#else
+ // Declare C++/CX namespaces:
+ using namespace Platform;
+ using namespace Windows::Foundation;
+ using namespace Windows::UI::Core;
+ using namespace Windows::UI::Xaml;
+ using namespace Windows::UI::Xaml::Controls;
+ using namespace Windows::UI::Xaml::Input;
+ using namespace Windows::UI::Xaml::Media;
+
+ // Make sure we have a valid XAML element (to draw onto):
+ if ( ! backgroundPanelAsIInspectable) {
+ return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL");
+ }
+
+ Platform::Object ^ backgroundPanel = reinterpret_cast<Object ^>((IInspectable *) backgroundPanelAsIInspectable);
+ SwapChainBackgroundPanel ^swapChainBackgroundPanel = dynamic_cast<SwapChainBackgroundPanel ^>(backgroundPanel);
+ if ( ! swapChainBackgroundPanel) {
+ return SDL_SetError("An unknown or unsupported type of XAML control was specified.");
+ }
+
+ // Setup event handlers:
+ swapChainBackgroundPanel->PointerPressed += ref new PointerEventHandler(WINRT_OnPointerPressedViaXAML);
+ swapChainBackgroundPanel->PointerReleased += ref new PointerEventHandler(WINRT_OnPointerReleasedViaXAML);
+ swapChainBackgroundPanel->PointerWheelChanged += ref new PointerEventHandler(WINRT_OnPointerWheelChangedViaXAML);
+ swapChainBackgroundPanel->PointerMoved += ref new PointerEventHandler(WINRT_OnPointerMovedViaXAML);
+
+ // Setup for rendering:
+ IInspectable *panelInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(swapChainBackgroundPanel);
+ panelInspectable->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&WINRT_GlobalSwapChainBackgroundPanelNative);
+
+ WINRT_XAMLAppEventToken = CompositionTarget::Rendering::add(ref new EventHandler<Object^>(WINRT_OnRenderViaXAML));
+
+ // Make sure the app is ready to call the SDL-centric main() function:
+ WINRT_SDLAppEntryPoint = mainFunction;
+ SDL_SetMainReady();
+
+ // Make sure video-init knows that we're initializing XAML:
+ SDL_bool oldXAMLWasEnabledValue = WINRT_XAMLWasEnabled;
+ WINRT_XAMLWasEnabled = SDL_TRUE;
+
+ // Make sure video modes are detected now, while we still have access to the WinRT
+ // CoreWindow. WinRT will not allow the app's CoreWindow to be accessed via the
+ // SDL/WinRT thread.
+ if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
+ // SDL_InitSubSystem will, on error, set the SDL error. Let that propogate to
+ // the caller to here:
+ WINRT_XAMLWasEnabled = oldXAMLWasEnabledValue;
+ return -1;
+ }
+
+ // All done, for now.
+ return 0;
+#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else
+}
diff --git a/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.h b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.h
new file mode 100644
index 0000000..85b4305
--- /dev/null
+++ b/src/3rdparty/SDL2/src/core/winrt/SDL_winrtapp_xaml.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#ifndef SDL_winrtapp_xaml_h_
+#define SDL_winrtapp_xaml_h_
+
+#include "SDL_stdinc.h"
+
+#ifdef __cplusplus
+extern SDL_bool WINRT_XAMLWasEnabled;
+extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable);
+#endif // ifdef __cplusplus
+
+#endif // SDL_winrtapp_xaml_h_
diff --git a/src/3rdparty/SDL2/src/cpuinfo/SDL_cpuinfo.c b/src/3rdparty/SDL2/src/cpuinfo/SDL_cpuinfo.c
new file mode 100644
index 0000000..4e2c0f1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/cpuinfo/SDL_cpuinfo.c
@@ -0,0 +1,777 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifdef TEST_MAIN
+#include "SDL_config.h"
+#else
+#include "../SDL_internal.h"
+#endif
+
+#if defined(__WIN32__)
+#include "../core/windows/SDL_windows.h"
+#endif
+#if defined(__OS2__)
+#define INCL_DOS
+#include <os2.h>
+#ifndef QSV_NUMPROCESSORS
+#define QSV_NUMPROCESSORS 26
+#endif
+#endif
+
+/* CPU feature detection for SDL */
+
+#include "SDL_cpuinfo.h"
+
+#ifdef HAVE_SYSCONF
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYSCTLBYNAME
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
+#include <sys/sysctl.h> /* For AltiVec check */
+#elif defined(__OpenBSD__) && defined(__powerpc__)
+#include <sys/param.h>
+#include <sys/sysctl.h> /* For AltiVec check */
+#include <machine/cpu.h>
+#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
+#include <signal.h>
+#include <setjmp.h>
+#endif
+
+#if defined(__QNXNTO__)
+#include <sys/syspage.h>
+#endif
+
+#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH)
+/*#include <asm/hwcap.h>*/
+#ifndef AT_HWCAP
+#define AT_HWCAP 16
+#endif
+#ifndef HWCAP_NEON
+#define HWCAP_NEON (1 << 12)
+#endif
+#if defined HAVE_GETAUXVAL
+#include <sys/auxv.h>
+#else
+#include <fcntl.h>
+#endif
+#endif
+
+#define CPU_HAS_RDTSC 0x00000001
+#define CPU_HAS_ALTIVEC 0x00000002
+#define CPU_HAS_MMX 0x00000004
+#define CPU_HAS_3DNOW 0x00000008
+#define CPU_HAS_SSE 0x00000010
+#define CPU_HAS_SSE2 0x00000020
+#define CPU_HAS_SSE3 0x00000040
+#define CPU_HAS_SSE41 0x00000100
+#define CPU_HAS_SSE42 0x00000200
+#define CPU_HAS_AVX 0x00000400
+#define CPU_HAS_AVX2 0x00000800
+#define CPU_HAS_NEON 0x00001000
+
+#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__
+/* This is the brute force way of detecting instruction sets...
+ the idea is borrowed from the libmpeg2 library - thanks!
+ */
+static jmp_buf jmpbuf;
+static void
+illegal_instruction(int sig)
+{
+ longjmp(jmpbuf, 1);
+}
+#endif /* HAVE_SETJMP */
+
+static int
+CPU_haveCPUID(void)
+{
+ int has_CPUID = 0;
+
+/* *INDENT-OFF* */
+#ifndef SDL_CPUINFO_DISABLED
+#if defined(__GNUC__) && defined(i386)
+ __asm__ (
+" pushfl # Get original EFLAGS \n"
+" popl %%eax \n"
+" movl %%eax,%%ecx \n"
+" xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
+" pushl %%eax # Save new EFLAGS value on stack \n"
+" popfl # Replace current EFLAGS value \n"
+" pushfl # Get new EFLAGS \n"
+" popl %%eax # Store new EFLAGS in EAX \n"
+" xorl %%ecx,%%eax # Can not toggle ID bit, \n"
+" jz 1f # Processor=80486 \n"
+" movl $1,%0 # We have CPUID support \n"
+"1: \n"
+ : "=m" (has_CPUID)
+ :
+ : "%eax", "%ecx"
+ );
+#elif defined(__GNUC__) && defined(__x86_64__)
+/* Technically, if this is being compiled under __x86_64__ then it has
+ CPUid by definition. But it's nice to be able to prove it. :) */
+ __asm__ (
+" pushfq # Get original EFLAGS \n"
+" popq %%rax \n"
+" movq %%rax,%%rcx \n"
+" xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
+" pushq %%rax # Save new EFLAGS value on stack \n"
+" popfq # Replace current EFLAGS value \n"
+" pushfq # Get new EFLAGS \n"
+" popq %%rax # Store new EFLAGS in EAX \n"
+" xorl %%ecx,%%eax # Can not toggle ID bit, \n"
+" jz 1f # Processor=80486 \n"
+" movl $1,%0 # We have CPUID support \n"
+"1: \n"
+ : "=m" (has_CPUID)
+ :
+ : "%rax", "%rcx"
+ );
+#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
+ __asm {
+ pushfd ; Get original EFLAGS
+ pop eax
+ mov ecx, eax
+ xor eax, 200000h ; Flip ID bit in EFLAGS
+ push eax ; Save new EFLAGS value on stack
+ popfd ; Replace current EFLAGS value
+ pushfd ; Get new EFLAGS
+ pop eax ; Store new EFLAGS in EAX
+ xor eax, ecx ; Can not toggle ID bit,
+ jz done ; Processor=80486
+ mov has_CPUID,1 ; We have CPUID support
+done:
+ }
+#elif defined(_MSC_VER) && defined(_M_X64)
+ has_CPUID = 1;
+#elif defined(__sun) && defined(__i386)
+ __asm (
+" pushfl \n"
+" popl %eax \n"
+" movl %eax,%ecx \n"
+" xorl $0x200000,%eax \n"
+" pushl %eax \n"
+" popfl \n"
+" pushfl \n"
+" popl %eax \n"
+" xorl %ecx,%eax \n"
+" jz 1f \n"
+" movl $1,-8(%ebp) \n"
+"1: \n"
+ );
+#elif defined(__sun) && defined(__amd64)
+ __asm (
+" pushfq \n"
+" popq %rax \n"
+" movq %rax,%rcx \n"
+" xorl $0x200000,%eax \n"
+" pushq %rax \n"
+" popfq \n"
+" pushfq \n"
+" popq %rax \n"
+" xorl %ecx,%eax \n"
+" jz 1f \n"
+" movl $1,-8(%rbp) \n"
+"1: \n"
+ );
+#endif
+#endif
+/* *INDENT-ON* */
+ return has_CPUID;
+}
+
+#if defined(__GNUC__) && defined(i386)
+#define cpuid(func, a, b, c, d) \
+ __asm__ __volatile__ ( \
+" pushl %%ebx \n" \
+" xorl %%ecx,%%ecx \n" \
+" cpuid \n" \
+" movl %%ebx, %%esi \n" \
+" popl %%ebx \n" : \
+ "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
+#elif defined(__GNUC__) && defined(__x86_64__)
+#define cpuid(func, a, b, c, d) \
+ __asm__ __volatile__ ( \
+" pushq %%rbx \n" \
+" xorq %%rcx,%%rcx \n" \
+" cpuid \n" \
+" movq %%rbx, %%rsi \n" \
+" popq %%rbx \n" : \
+ "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
+#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
+#define cpuid(func, a, b, c, d) \
+ __asm { \
+ __asm mov eax, func \
+ __asm xor ecx, ecx \
+ __asm cpuid \
+ __asm mov a, eax \
+ __asm mov b, ebx \
+ __asm mov c, ecx \
+ __asm mov d, edx \
+}
+#elif defined(_MSC_VER) && defined(_M_X64)
+#define cpuid(func, a, b, c, d) \
+{ \
+ int CPUInfo[4]; \
+ __cpuid(CPUInfo, func); \
+ a = CPUInfo[0]; \
+ b = CPUInfo[1]; \
+ c = CPUInfo[2]; \
+ d = CPUInfo[3]; \
+}
+#else
+#define cpuid(func, a, b, c, d) \
+ do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0)
+#endif
+
+static int CPU_CPUIDFeatures[4];
+static int CPU_CPUIDMaxFunction = 0;
+static SDL_bool CPU_OSSavesYMM = SDL_FALSE;
+
+static void
+CPU_calcCPUIDFeatures(void)
+{
+ static SDL_bool checked = SDL_FALSE;
+ if (!checked) {
+ checked = SDL_TRUE;
+ if (CPU_haveCPUID()) {
+ int a, b, c, d;
+ cpuid(0, a, b, c, d);
+ CPU_CPUIDMaxFunction = a;
+ if (CPU_CPUIDMaxFunction >= 1) {
+ cpuid(1, a, b, c, d);
+ CPU_CPUIDFeatures[0] = a;
+ CPU_CPUIDFeatures[1] = b;
+ CPU_CPUIDFeatures[2] = c;
+ CPU_CPUIDFeatures[3] = d;
+
+ /* Check to make sure we can call xgetbv */
+ if (c & 0x08000000) {
+ /* Call xgetbv to see if YMM register state is saved */
+#if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
+ __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx");
+#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
+ a = (int)_xgetbv(0);
+#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
+ __asm
+ {
+ xor ecx, ecx
+ _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
+ mov a, eax
+ }
+#endif
+ CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE;
+ }
+ }
+ }
+ }
+}
+
+static int
+CPU_haveAltiVec(void)
+{
+ volatile int altivec = 0;
+#ifndef SDL_CPUINFO_DISABLED
+#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
+#ifdef __OpenBSD__
+ int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
+#else
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+#endif
+ int hasVectorUnit = 0;
+ size_t length = sizeof(hasVectorUnit);
+ int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
+ if (0 == error)
+ altivec = (hasVectorUnit != 0);
+#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
+ void (*handler) (int sig);
+ handler = signal(SIGILL, illegal_instruction);
+ if (setjmp(jmpbuf) == 0) {
+ asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1));
+ altivec = 1;
+ }
+ signal(SIGILL, handler);
+#endif
+#endif
+ return altivec;
+}
+
+#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL)
+static int
+readProcAuxvForNeon(void)
+{
+ int neon = 0;
+ int kv[2];
+ const int fd = open("/proc/self/auxv", O_RDONLY);
+ if (fd != -1) {
+ while (read(fd, kv, sizeof (kv)) == sizeof (kv)) {
+ if (kv[0] == AT_HWCAP) {
+ neon = ((kv[1] & HWCAP_NEON) == HWCAP_NEON);
+ break;
+ }
+ }
+ close(fd);
+ }
+ return neon;
+}
+#endif
+
+
+static int
+CPU_haveNEON(void)
+{
+/* The way you detect NEON is a privileged instruction on ARM, so you have
+ query the OS kernel in a platform-specific way. :/ */
+#if defined(SDL_CPUINFO_DISABLED) || !defined(__ARM_ARCH)
+ return 0; /* disabled or not an ARM CPU at all. */
+#elif __ARM_ARCH >= 8
+ return 1; /* ARMv8 always has non-optional NEON support. */
+#elif defined(__APPLE__) && (__ARM_ARCH >= 7)
+ /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
+ return 1; /* all Apple ARMv7 chips and later have NEON. */
+#elif defined(__APPLE__)
+ return 0; /* assume anything else from Apple doesn't have NEON. */
+#elif defined(__QNXNTO__)
+ return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
+#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
+ return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
+#elif (defined(__LINUX__) || defined(__ANDROID__))
+ return readProcAuxvForNeon(); /* Android offers a static library for this, but it just parses /proc/self/auxv */
+#elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM)
+ /* All WinRT ARM devices are required to support NEON, but just in case. */
+ return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
+#else
+#warning SDL_HasNEON is not implemented for this ARM platform. Write me.
+ return 0;
+#endif
+}
+
+static int
+CPU_have3DNow(void)
+{
+ if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */
+ int a, b, c, d;
+ cpuid(0x80000000, a, b, c, d);
+ if (a >= 0x80000001) {
+ cpuid(0x80000001, a, b, c, d);
+ return (d & 0x80000000);
+ }
+ }
+ return 0;
+}
+
+#define CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010)
+#define CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000)
+#define CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000)
+#define CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000)
+#define CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001)
+#define CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000)
+#define CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000)
+#define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000))
+
+static int
+CPU_haveAVX2(void)
+{
+ if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) {
+ int a, b, c, d;
+ (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
+ cpuid(7, a, b, c, d);
+ return (b & 0x00000020);
+ }
+ return 0;
+}
+
+static int SDL_CPUCount = 0;
+
+int
+SDL_GetCPUCount(void)
+{
+ if (!SDL_CPUCount) {
+#ifndef SDL_CPUINFO_DISABLED
+#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
+ if (SDL_CPUCount <= 0) {
+ SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
+ }
+#endif
+#ifdef HAVE_SYSCTLBYNAME
+ if (SDL_CPUCount <= 0) {
+ size_t size = sizeof(SDL_CPUCount);
+ sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
+ }
+#endif
+#ifdef __WIN32__
+ if (SDL_CPUCount <= 0) {
+ SYSTEM_INFO info;
+ GetSystemInfo(&info);
+ SDL_CPUCount = info.dwNumberOfProcessors;
+ }
+#endif
+#ifdef __OS2__
+ if (SDL_CPUCount <= 0) {
+ DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS,
+ &SDL_CPUCount, sizeof(SDL_CPUCount) );
+ }
+#endif
+#endif
+ /* There has to be at least 1, right? :) */
+ if (SDL_CPUCount <= 0) {
+ SDL_CPUCount = 1;
+ }
+ }
+ return SDL_CPUCount;
+}
+
+/* Oh, such a sweet sweet trick, just not very useful. :) */
+static const char *
+SDL_GetCPUType(void)
+{
+ static char SDL_CPUType[13];
+
+ if (!SDL_CPUType[0]) {
+ int i = 0;
+
+ CPU_calcCPUIDFeatures();
+ if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */
+ int a, b, c, d;
+ cpuid(0x00000000, a, b, c, d);
+ (void) a;
+ SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUType[i++] = (char)(b & 0xff);
+
+ SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUType[i++] = (char)(d & 0xff);
+
+ SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUType[i++] = (char)(c & 0xff);
+ }
+ if (!SDL_CPUType[0]) {
+ SDL_strlcpy(SDL_CPUType, "Unknown", sizeof(SDL_CPUType));
+ }
+ }
+ return SDL_CPUType;
+}
+
+
+#ifdef TEST_MAIN /* !!! FIXME: only used for test at the moment. */
+static const char *
+SDL_GetCPUName(void)
+{
+ static char SDL_CPUName[48];
+
+ if (!SDL_CPUName[0]) {
+ int i = 0;
+ int a, b, c, d;
+
+ CPU_calcCPUIDFeatures();
+ if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */
+ cpuid(0x80000000, a, b, c, d);
+ if (a >= 0x80000004) {
+ cpuid(0x80000002, a, b, c, d);
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ cpuid(0x80000003, a, b, c, d);
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ cpuid(0x80000004, a, b, c, d);
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8;
+ }
+ }
+ if (!SDL_CPUName[0]) {
+ SDL_strlcpy(SDL_CPUName, "Unknown", sizeof(SDL_CPUName));
+ }
+ }
+ return SDL_CPUName;
+}
+#endif
+
+int
+SDL_GetCPUCacheLineSize(void)
+{
+ const char *cpuType = SDL_GetCPUType();
+ int a, b, c, d;
+ (void) a; (void) b; (void) c; (void) d;
+ if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
+ cpuid(0x00000001, a, b, c, d);
+ return (((b >> 8) & 0xff) * 8);
+ } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0) {
+ cpuid(0x80000005, a, b, c, d);
+ return (c & 0xff);
+ } else {
+ /* Just make a guess here... */
+ return SDL_CACHELINE_SIZE;
+ }
+}
+
+static Uint32 SDL_CPUFeatures = 0xFFFFFFFF;
+
+static Uint32
+SDL_GetCPUFeatures(void)
+{
+ if (SDL_CPUFeatures == 0xFFFFFFFF) {
+ CPU_calcCPUIDFeatures();
+ SDL_CPUFeatures = 0;
+ if (CPU_haveRDTSC()) {
+ SDL_CPUFeatures |= CPU_HAS_RDTSC;
+ }
+ if (CPU_haveAltiVec()) {
+ SDL_CPUFeatures |= CPU_HAS_ALTIVEC;
+ }
+ if (CPU_haveMMX()) {
+ SDL_CPUFeatures |= CPU_HAS_MMX;
+ }
+ if (CPU_have3DNow()) {
+ SDL_CPUFeatures |= CPU_HAS_3DNOW;
+ }
+ if (CPU_haveSSE()) {
+ SDL_CPUFeatures |= CPU_HAS_SSE;
+ }
+ if (CPU_haveSSE2()) {
+ SDL_CPUFeatures |= CPU_HAS_SSE2;
+ }
+ if (CPU_haveSSE3()) {
+ SDL_CPUFeatures |= CPU_HAS_SSE3;
+ }
+ if (CPU_haveSSE41()) {
+ SDL_CPUFeatures |= CPU_HAS_SSE41;
+ }
+ if (CPU_haveSSE42()) {
+ SDL_CPUFeatures |= CPU_HAS_SSE42;
+ }
+ if (CPU_haveAVX()) {
+ SDL_CPUFeatures |= CPU_HAS_AVX;
+ }
+ if (CPU_haveAVX2()) {
+ SDL_CPUFeatures |= CPU_HAS_AVX2;
+ }
+ if (CPU_haveNEON()) {
+ SDL_CPUFeatures |= CPU_HAS_NEON;
+ }
+ }
+ return SDL_CPUFeatures;
+}
+
+#define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE)
+
+SDL_bool SDL_HasRDTSC(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_RDTSC);
+}
+
+SDL_bool
+SDL_HasAltiVec(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC);
+}
+
+SDL_bool
+SDL_HasMMX(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX);
+}
+
+SDL_bool
+SDL_Has3DNow(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW);
+}
+
+SDL_bool
+SDL_HasSSE(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE);
+}
+
+SDL_bool
+SDL_HasSSE2(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2);
+}
+
+SDL_bool
+SDL_HasSSE3(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3);
+}
+
+SDL_bool
+SDL_HasSSE41(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41);
+}
+
+SDL_bool
+SDL_HasSSE42(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42);
+}
+
+SDL_bool
+SDL_HasAVX(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX);
+}
+
+SDL_bool
+SDL_HasAVX2(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2);
+}
+
+SDL_bool
+SDL_HasNEON(void)
+{
+ return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON);
+}
+
+static int SDL_SystemRAM = 0;
+
+int
+SDL_GetSystemRAM(void)
+{
+ if (!SDL_SystemRAM) {
+#ifndef SDL_CPUINFO_DISABLED
+#if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
+ if (SDL_SystemRAM <= 0) {
+ SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
+ }
+#endif
+#ifdef HAVE_SYSCTLBYNAME
+ if (SDL_SystemRAM <= 0) {
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
+#ifdef HW_REALMEM
+ int mib[2] = {CTL_HW, HW_REALMEM};
+#else
+ /* might only report up to 2 GiB */
+ int mib[2] = {CTL_HW, HW_PHYSMEM};
+#endif /* HW_REALMEM */
+#else
+ int mib[2] = {CTL_HW, HW_MEMSIZE};
+#endif /* __FreeBSD__ || __FreeBSD_kernel__ */
+ Uint64 memsize = 0;
+ size_t len = sizeof(memsize);
+
+ if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
+ SDL_SystemRAM = (int)(memsize / (1024*1024));
+ }
+ }
+#endif
+#ifdef __WIN32__
+ if (SDL_SystemRAM <= 0) {
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(stat);
+ if (GlobalMemoryStatusEx(&stat)) {
+ SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
+ }
+ }
+#endif
+#ifdef __OS2__
+ if (SDL_SystemRAM <= 0) {
+ Uint32 sysram = 0;
+ DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4);
+ SDL_SystemRAM = (int) (sysram / 0x100000U);
+ }
+#endif
+#endif
+ }
+ return SDL_SystemRAM;
+}
+
+
+#ifdef TEST_MAIN
+
+#include <stdio.h>
+
+int
+main()
+{
+ printf("CPU count: %d\n", SDL_GetCPUCount());
+ printf("CPU type: %s\n", SDL_GetCPUType());
+ printf("CPU name: %s\n", SDL_GetCPUName());
+ printf("CacheLine size: %d\n", SDL_GetCPUCacheLineSize());
+ printf("RDTSC: %d\n", SDL_HasRDTSC());
+ printf("Altivec: %d\n", SDL_HasAltiVec());
+ printf("MMX: %d\n", SDL_HasMMX());
+ printf("3DNow: %d\n", SDL_Has3DNow());
+ printf("SSE: %d\n", SDL_HasSSE());
+ printf("SSE2: %d\n", SDL_HasSSE2());
+ printf("SSE3: %d\n", SDL_HasSSE3());
+ printf("SSE4.1: %d\n", SDL_HasSSE41());
+ printf("SSE4.2: %d\n", SDL_HasSSE42());
+ printf("AVX: %d\n", SDL_HasAVX());
+ printf("AVX2: %d\n", SDL_HasAVX2());
+ printf("NEON: %d\n", SDL_HasNEON());
+ printf("RAM: %d MB\n", SDL_GetSystemRAM());
+ return 0;
+}
+
+#endif /* TEST_MAIN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/dynapi/SDL_dynapi.c b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi.c
new file mode 100644
index 0000000..b898826
--- /dev/null
+++ b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi.c
@@ -0,0 +1,325 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "SDL_config.h"
+#include "SDL_dynapi.h"
+
+#if SDL_DYNAMIC_API
+
+#if defined(__OS2__)
+#define INCL_DOS
+#define INCL_DOSERRORS
+#include <dos.h>
+#endif
+
+#include "SDL.h"
+
+/* These headers have system specific definitions, so aren't included above */
+#include "SDL_syswm.h"
+#include "SDL_vulkan.h"
+
+/* This is the version of the dynamic API. This doesn't match the SDL version
+ and should not change until there's been a major revamp in API/ABI.
+ So 2.0.5 adds functions over 2.0.4? This number doesn't change;
+ the sizeof (jump_table) changes instead. But 2.1.0 changes how a function
+ works in an incompatible way or removes a function? This number changes,
+ since sizeof (jump_table) isn't sufficient anymore. It's likely
+ we'll forget to bump every time we add a function, so this is the
+ failsafe switch for major API change decisions. Respect it and use it
+ sparingly. */
+#define SDL_DYNAPI_VERSION 1
+
+static void SDL_InitDynamicAPI(void);
+
+
+/* BE CAREFUL CALLING ANY SDL CODE IN HERE, IT WILL BLOW UP.
+ Even self-contained stuff might call SDL_Error and break everything. */
+
+
+/* behold, the macro salsa! */
+
+/* !!! FIXME: ...disabled...until we write it. :) */
+#define DISABLE_JUMP_MAGIC 1
+
+#if DISABLE_JUMP_MAGIC
+/* Can't use the macro for varargs nonsense. This is atrocious. */
+#define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \
+ _static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
+ va_list ap; initcall; va_start(ap, fmt); \
+ jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \
+ va_end(ap); \
+ }
+
+#define SDL_DYNAPI_VARARGS(_static, name, initcall) \
+ _static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
+ char buf[512]; /* !!! FIXME: dynamic allocation */ \
+ va_list ap; initcall; va_start(ap, fmt); \
+ jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \
+ va_end(ap); \
+ return jump_table.SDL_SetError("%s", buf); \
+ } \
+ _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \
+ int retval; va_list ap; initcall; va_start(ap, fmt); \
+ retval = jump_table.SDL_vsscanf(buf, fmt, ap); \
+ va_end(ap); \
+ return retval; \
+ } \
+ _static int SDLCALL SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
+ int retval; va_list ap; initcall; va_start(ap, fmt); \
+ retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \
+ va_end(ap); \
+ return retval; \
+ } \
+ _static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
+ va_list ap; initcall; va_start(ap, fmt); \
+ jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \
+ va_end(ap); \
+ } \
+ _static void SDLCALL SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
+ va_list ap; initcall; va_start(ap, fmt); \
+ jump_table.SDL_LogMessageV(category, priority, fmt, ap); \
+ va_end(ap); \
+ } \
+ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Verbose, VERBOSE) \
+ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Debug, DEBUG) \
+ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Info, INFO) \
+ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Warn, WARN) \
+ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Error, ERROR) \
+ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Critical, CRITICAL)
+#endif
+
+
+/* Typedefs for function pointers for jump table, and predeclare funcs */
+/* The DEFAULT funcs will init jump table and then call real function. */
+/* The REAL funcs are the actual functions, name-mangled to not clash. */
+#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
+ typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params; \
+ static rc SDLCALL fn##_DEFAULT params; \
+ extern rc SDLCALL fn##_REAL params;
+#include "SDL_dynapi_procs.h"
+#undef SDL_DYNAPI_PROC
+
+/* The jump table! */
+typedef struct {
+ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) SDL_DYNAPIFN_##fn fn;
+ #include "SDL_dynapi_procs.h"
+ #undef SDL_DYNAPI_PROC
+} SDL_DYNAPI_jump_table;
+
+/* Predeclare the default functions for initializing the jump table. */
+#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc SDLCALL fn##_DEFAULT params;
+#include "SDL_dynapi_procs.h"
+#undef SDL_DYNAPI_PROC
+
+/* The actual jump table. */
+static SDL_DYNAPI_jump_table jump_table = {
+ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) fn##_DEFAULT,
+ #include "SDL_dynapi_procs.h"
+ #undef SDL_DYNAPI_PROC
+};
+
+/* Default functions init the function table then call right thing. */
+#if DISABLE_JUMP_MAGIC
+#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
+ static rc SDLCALL fn##_DEFAULT params { \
+ SDL_InitDynamicAPI(); \
+ ret jump_table.fn args; \
+ }
+#define SDL_DYNAPI_PROC_NO_VARARGS 1
+#include "SDL_dynapi_procs.h"
+#undef SDL_DYNAPI_PROC
+#undef SDL_DYNAPI_PROC_NO_VARARGS
+SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
+#else
+/* !!! FIXME: need the jump magic. */
+#error Write me.
+#endif
+
+/* Public API functions to jump into the jump table. */
+#if DISABLE_JUMP_MAGIC
+#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
+ rc SDLCALL fn params { ret jump_table.fn args; }
+#define SDL_DYNAPI_PROC_NO_VARARGS 1
+#include "SDL_dynapi_procs.h"
+#undef SDL_DYNAPI_PROC
+#undef SDL_DYNAPI_PROC_NO_VARARGS
+SDL_DYNAPI_VARARGS(,,)
+#else
+/* !!! FIXME: need the jump magic. */
+#error Write me.
+#endif
+
+
+
+/* Here's the exported entry point that fills in the jump table. */
+/* Use specific types when an "int" might suffice to keep this sane. */
+typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
+extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
+
+Sint32
+SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
+{
+ SDL_DYNAPI_jump_table *output_jump_table = (SDL_DYNAPI_jump_table *) table;
+
+ if (apiver != SDL_DYNAPI_VERSION) {
+ /* !!! FIXME: can maybe handle older versions? */
+ return -1; /* not compatible. */
+ } else if (tablesize > sizeof (jump_table)) {
+ return -1; /* newer version of SDL with functions we can't provide. */
+ }
+
+ /* Init our jump table first. */
+ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_REAL;
+ #include "SDL_dynapi_procs.h"
+ #undef SDL_DYNAPI_PROC
+
+ /* Then the external table... */
+ if (output_jump_table != &jump_table) {
+ jump_table.SDL_memcpy(output_jump_table, &jump_table, tablesize);
+ }
+
+ /* Safe to call SDL functions now; jump table is initialized! */
+
+ return 0; /* success! */
+}
+
+
+/* Obviously we can't use SDL_LoadObject() to load SDL. :) */
+/* Also obviously, we never close the loaded library. */
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
+{
+ HANDLE lib = LoadLibraryA(fname);
+ void *retval = NULL;
+ if (lib) {
+ retval = GetProcAddress(lib, sym);
+ if (retval == NULL) {
+ FreeLibrary(lib);
+ }
+ }
+ return retval;
+}
+
+#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__)
+#include <dlfcn.h>
+static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
+{
+ void *lib = dlopen(fname, RTLD_NOW | RTLD_LOCAL);
+ void *retval = NULL;
+ if (lib != NULL) {
+ retval = dlsym(lib, sym);
+ if (retval == NULL) {
+ dlclose(lib);
+ }
+ }
+ return retval;
+}
+
+#elif defined(__OS2__)
+static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
+{
+ HMODULE hmodule;
+ PFN retval = NULL;
+ char error[256];
+ if (DosLoadModule(&error, sizeof(error), fname, &hmodule) == NO_ERROR) {
+ if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) {
+ DosFreeModule(hmodule);
+ }
+ }
+ return (void *) retval;
+}
+
+#else
+#error Please define your platform.
+#endif
+
+
+static void
+SDL_InitDynamicAPILocked(void)
+{
+ const char *libname = SDL_getenv_REAL("SDL_DYNAMIC_API");
+ SDL_DYNAPI_ENTRYFN entry = SDL_DYNAPI_entry; /* funcs from here by default. */
+
+ if (libname) {
+ entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
+ if (!entry) {
+ /* !!! FIXME: fail to startup here instead? */
+ /* !!! FIXME: definitely warn user. */
+ /* Just fill in the function pointers from this library. */
+ entry = SDL_DYNAPI_entry;
+ }
+ }
+
+ if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) {
+ /* !!! FIXME: fail to startup here instead? */
+ /* !!! FIXME: definitely warn user. */
+ /* Just fill in the function pointers from this library. */
+ if (entry != SDL_DYNAPI_entry) {
+ if (!SDL_DYNAPI_entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) {
+ /* !!! FIXME: now we're screwed. Should definitely abort now. */
+ }
+ }
+ }
+
+ /* we intentionally never close the newly-loaded lib, of course. */
+}
+
+static void
+SDL_InitDynamicAPI(void)
+{
+ /* So the theory is that every function in the jump table defaults to
+ * calling this function, and then replaces itself with a version that
+ * doesn't call this function anymore. But it's possible that, in an
+ * extreme corner case, you can have a second thread hit this function
+ * while the jump table is being initialized by the first.
+ * In this case, a spinlock is really painful compared to what spinlocks
+ * _should_ be used for, but this would only happen once, and should be
+ * insanely rare, as you would have to spin a thread outside of SDL (as
+ * SDL_CreateThread() would also call this function before building the
+ * new thread).
+ */
+ static SDL_bool already_initialized = SDL_FALSE;
+
+ /* SDL_AtomicLock calls SDL mutex functions to emulate if
+ SDL_ATOMIC_DISABLED, which we can't do here, so in such a
+ configuration, you're on your own. */
+ #if !SDL_ATOMIC_DISABLED
+ static SDL_SpinLock lock = 0;
+ SDL_AtomicLock_REAL(&lock);
+ #endif
+
+ if (!already_initialized) {
+ SDL_InitDynamicAPILocked();
+ already_initialized = SDL_TRUE;
+ }
+
+ #if !SDL_ATOMIC_DISABLED
+ SDL_AtomicUnlock_REAL(&lock);
+ #endif
+}
+
+#endif /* SDL_DYNAMIC_API */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/dynapi/SDL_dynapi.h b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi.h
new file mode 100644
index 0000000..73316f1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi.h
@@ -0,0 +1,67 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_dynapi_h_
+#define SDL_dynapi_h_
+
+/* IMPORTANT:
+ This is the master switch to disabling the dynamic API. We made it so you
+ have to hand-edit an internal source file in SDL to turn it off; you
+ can do it if you want it badly enough, but hopefully you won't want to.
+ You should understand the ramifications of turning this off: it makes it
+ hard to update your SDL in the field, and impossible if you've statically
+ linked SDL into your app. Understand that platforms change, and if we can't
+ drop in an updated SDL, your application can definitely break some time
+ in the future, even if it's fine today.
+ To be sure, as new system-level video and audio APIs are introduced, an
+ updated SDL can transparently take advantage of them, but your program will
+ not without this feature. Think hard before turning it off.
+*/
+#ifdef SDL_DYNAMIC_API /* Tried to force it on the command line? */
+#error Nope, you have to edit this file to force this off.
+#endif
+
+#ifdef __APPLE__
+#include "TargetConditionals.h"
+#endif
+
+#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* probably not useful on iOS. */
+#define SDL_DYNAMIC_API 0
+#elif defined(__native_client__) && __native_client__ /* probably not useful on NACL. */
+#define SDL_DYNAMIC_API 0
+#elif defined(__EMSCRIPTEN__) && __EMSCRIPTEN__ /* probably not useful on Emscripten. */
+#define SDL_DYNAMIC_API 0
+#elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */
+#define SDL_DYNAMIC_API 0
+#elif defined(__PSP__) && __PSP__
+#define SDL_DYNAMIC_API 0
+#elif defined(__clang_analyzer__)
+#define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */
+#endif
+
+/* everyone else. This is where we turn on the API if nothing forced it off. */
+#ifndef SDL_DYNAMIC_API
+#define SDL_DYNAMIC_API 1
+#endif
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/dynapi/SDL_dynapi_overrides.h b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi_overrides.h
new file mode 100644
index 0000000..1ec2eaf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi_overrides.h
@@ -0,0 +1,671 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* vi: set ts=4 sw=4 expandtab: */
+
+/* DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. */
+
+#if !SDL_DYNAMIC_API
+#error You should not be here.
+#endif
+
+#define SDL_SetError SDL_SetError_REAL
+#define SDL_Log SDL_Log_REAL
+#define SDL_LogVerbose SDL_LogVerbose_REAL
+#define SDL_LogDebug SDL_LogDebug_REAL
+#define SDL_LogInfo SDL_LogInfo_REAL
+#define SDL_LogWarn SDL_LogWarn_REAL
+#define SDL_LogError SDL_LogError_REAL
+#define SDL_LogCritical SDL_LogCritical_REAL
+#define SDL_LogMessage SDL_LogMessage_REAL
+#define SDL_sscanf SDL_sscanf_REAL
+#define SDL_snprintf SDL_snprintf_REAL
+#define SDL_CreateThread SDL_CreateThread_REAL
+#define SDL_RWFromFP SDL_RWFromFP_REAL
+#define SDL_RegisterApp SDL_RegisterApp_REAL
+#define SDL_UnregisterApp SDL_UnregisterApp_REAL
+#define SDL_Direct3D9GetAdapterIndex SDL_Direct3D9GetAdapterIndex_REAL
+#define SDL_RenderGetD3D9Device SDL_RenderGetD3D9Device_REAL
+#define SDL_iPhoneSetAnimationCallback SDL_iPhoneSetAnimationCallback_REAL
+#define SDL_iPhoneSetEventPump SDL_iPhoneSetEventPump_REAL
+#define SDL_AndroidGetJNIEnv SDL_AndroidGetJNIEnv_REAL
+#define SDL_AndroidGetActivity SDL_AndroidGetActivity_REAL
+#define SDL_AndroidGetInternalStoragePath SDL_AndroidGetInternalStoragePath_REAL
+#define SDL_AndroidGetExternalStorageState SDL_AndroidGetExternalStorageState_REAL
+#define SDL_AndroidGetExternalStoragePath SDL_AndroidGetExternalStoragePath_REAL
+#define SDL_Init SDL_Init_REAL
+#define SDL_InitSubSystem SDL_InitSubSystem_REAL
+#define SDL_QuitSubSystem SDL_QuitSubSystem_REAL
+#define SDL_WasInit SDL_WasInit_REAL
+#define SDL_Quit SDL_Quit_REAL
+#define SDL_ReportAssertion SDL_ReportAssertion_REAL
+#define SDL_SetAssertionHandler SDL_SetAssertionHandler_REAL
+#define SDL_GetAssertionReport SDL_GetAssertionReport_REAL
+#define SDL_ResetAssertionReport SDL_ResetAssertionReport_REAL
+#define SDL_AtomicTryLock SDL_AtomicTryLock_REAL
+#define SDL_AtomicLock SDL_AtomicLock_REAL
+#define SDL_AtomicUnlock SDL_AtomicUnlock_REAL
+#define SDL_AtomicCAS SDL_AtomicCAS_REAL
+#define SDL_AtomicSet SDL_AtomicSet_REAL
+#define SDL_AtomicGet SDL_AtomicGet_REAL
+#define SDL_AtomicAdd SDL_AtomicAdd_REAL
+#define SDL_AtomicCASPtr SDL_AtomicCASPtr_REAL
+#define SDL_AtomicSetPtr SDL_AtomicSetPtr_REAL
+#define SDL_AtomicGetPtr SDL_AtomicGetPtr_REAL
+#define SDL_GetNumAudioDrivers SDL_GetNumAudioDrivers_REAL
+#define SDL_GetAudioDriver SDL_GetAudioDriver_REAL
+#define SDL_AudioInit SDL_AudioInit_REAL
+#define SDL_AudioQuit SDL_AudioQuit_REAL
+#define SDL_GetCurrentAudioDriver SDL_GetCurrentAudioDriver_REAL
+#define SDL_OpenAudio SDL_OpenAudio_REAL
+#define SDL_GetNumAudioDevices SDL_GetNumAudioDevices_REAL
+#define SDL_GetAudioDeviceName SDL_GetAudioDeviceName_REAL
+#define SDL_OpenAudioDevice SDL_OpenAudioDevice_REAL
+#define SDL_GetAudioStatus SDL_GetAudioStatus_REAL
+#define SDL_GetAudioDeviceStatus SDL_GetAudioDeviceStatus_REAL
+#define SDL_PauseAudio SDL_PauseAudio_REAL
+#define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL
+#define SDL_LoadWAV_RW SDL_LoadWAV_RW_REAL
+#define SDL_FreeWAV SDL_FreeWAV_REAL
+#define SDL_BuildAudioCVT SDL_BuildAudioCVT_REAL
+#define SDL_ConvertAudio SDL_ConvertAudio_REAL
+#define SDL_MixAudio SDL_MixAudio_REAL
+#define SDL_MixAudioFormat SDL_MixAudioFormat_REAL
+#define SDL_LockAudio SDL_LockAudio_REAL
+#define SDL_LockAudioDevice SDL_LockAudioDevice_REAL
+#define SDL_UnlockAudio SDL_UnlockAudio_REAL
+#define SDL_UnlockAudioDevice SDL_UnlockAudioDevice_REAL
+#define SDL_CloseAudio SDL_CloseAudio_REAL
+#define SDL_CloseAudioDevice SDL_CloseAudioDevice_REAL
+#define SDL_SetClipboardText SDL_SetClipboardText_REAL
+#define SDL_GetClipboardText SDL_GetClipboardText_REAL
+#define SDL_HasClipboardText SDL_HasClipboardText_REAL
+#define SDL_GetCPUCount SDL_GetCPUCount_REAL
+#define SDL_GetCPUCacheLineSize SDL_GetCPUCacheLineSize_REAL
+#define SDL_HasRDTSC SDL_HasRDTSC_REAL
+#define SDL_HasAltiVec SDL_HasAltiVec_REAL
+#define SDL_HasMMX SDL_HasMMX_REAL
+#define SDL_Has3DNow SDL_Has3DNow_REAL
+#define SDL_HasSSE SDL_HasSSE_REAL
+#define SDL_HasSSE2 SDL_HasSSE2_REAL
+#define SDL_HasSSE3 SDL_HasSSE3_REAL
+#define SDL_HasSSE41 SDL_HasSSE41_REAL
+#define SDL_HasSSE42 SDL_HasSSE42_REAL
+#define SDL_GetSystemRAM SDL_GetSystemRAM_REAL
+#define SDL_GetError SDL_GetError_REAL
+#define SDL_ClearError SDL_ClearError_REAL
+#define SDL_Error SDL_Error_REAL
+#define SDL_PumpEvents SDL_PumpEvents_REAL
+#define SDL_PeepEvents SDL_PeepEvents_REAL
+#define SDL_HasEvent SDL_HasEvent_REAL
+#define SDL_HasEvents SDL_HasEvents_REAL
+#define SDL_FlushEvent SDL_FlushEvent_REAL
+#define SDL_FlushEvents SDL_FlushEvents_REAL
+#define SDL_PollEvent SDL_PollEvent_REAL
+#define SDL_WaitEvent SDL_WaitEvent_REAL
+#define SDL_WaitEventTimeout SDL_WaitEventTimeout_REAL
+#define SDL_PushEvent SDL_PushEvent_REAL
+#define SDL_SetEventFilter SDL_SetEventFilter_REAL
+#define SDL_GetEventFilter SDL_GetEventFilter_REAL
+#define SDL_AddEventWatch SDL_AddEventWatch_REAL
+#define SDL_DelEventWatch SDL_DelEventWatch_REAL
+#define SDL_FilterEvents SDL_FilterEvents_REAL
+#define SDL_EventState SDL_EventState_REAL
+#define SDL_RegisterEvents SDL_RegisterEvents_REAL
+#define SDL_GetBasePath SDL_GetBasePath_REAL
+#define SDL_GetPrefPath SDL_GetPrefPath_REAL
+#define SDL_GameControllerAddMapping SDL_GameControllerAddMapping_REAL
+#define SDL_GameControllerMappingForGUID SDL_GameControllerMappingForGUID_REAL
+#define SDL_GameControllerMapping SDL_GameControllerMapping_REAL
+#define SDL_IsGameController SDL_IsGameController_REAL
+#define SDL_GameControllerNameForIndex SDL_GameControllerNameForIndex_REAL
+#define SDL_GameControllerOpen SDL_GameControllerOpen_REAL
+#define SDL_GameControllerName SDL_GameControllerName_REAL
+#define SDL_GameControllerGetAttached SDL_GameControllerGetAttached_REAL
+#define SDL_GameControllerGetJoystick SDL_GameControllerGetJoystick_REAL
+#define SDL_GameControllerEventState SDL_GameControllerEventState_REAL
+#define SDL_GameControllerUpdate SDL_GameControllerUpdate_REAL
+#define SDL_GameControllerGetAxisFromString SDL_GameControllerGetAxisFromString_REAL
+#define SDL_GameControllerGetStringForAxis SDL_GameControllerGetStringForAxis_REAL
+#define SDL_GameControllerGetBindForAxis SDL_GameControllerGetBindForAxis_REAL
+#define SDL_GameControllerGetAxis SDL_GameControllerGetAxis_REAL
+#define SDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString_REAL
+#define SDL_GameControllerGetStringForButton SDL_GameControllerGetStringForButton_REAL
+#define SDL_GameControllerGetBindForButton SDL_GameControllerGetBindForButton_REAL
+#define SDL_GameControllerGetButton SDL_GameControllerGetButton_REAL
+#define SDL_GameControllerClose SDL_GameControllerClose_REAL
+#define SDL_RecordGesture SDL_RecordGesture_REAL
+#define SDL_SaveAllDollarTemplates SDL_SaveAllDollarTemplates_REAL
+#define SDL_SaveDollarTemplate SDL_SaveDollarTemplate_REAL
+#define SDL_LoadDollarTemplates SDL_LoadDollarTemplates_REAL
+#define SDL_NumHaptics SDL_NumHaptics_REAL
+#define SDL_HapticName SDL_HapticName_REAL
+#define SDL_HapticOpen SDL_HapticOpen_REAL
+#define SDL_HapticOpened SDL_HapticOpened_REAL
+#define SDL_HapticIndex SDL_HapticIndex_REAL
+#define SDL_MouseIsHaptic SDL_MouseIsHaptic_REAL
+#define SDL_HapticOpenFromMouse SDL_HapticOpenFromMouse_REAL
+#define SDL_JoystickIsHaptic SDL_JoystickIsHaptic_REAL
+#define SDL_HapticOpenFromJoystick SDL_HapticOpenFromJoystick_REAL
+#define SDL_HapticClose SDL_HapticClose_REAL
+#define SDL_HapticNumEffects SDL_HapticNumEffects_REAL
+#define SDL_HapticNumEffectsPlaying SDL_HapticNumEffectsPlaying_REAL
+#define SDL_HapticQuery SDL_HapticQuery_REAL
+#define SDL_HapticNumAxes SDL_HapticNumAxes_REAL
+#define SDL_HapticEffectSupported SDL_HapticEffectSupported_REAL
+#define SDL_HapticNewEffect SDL_HapticNewEffect_REAL
+#define SDL_HapticUpdateEffect SDL_HapticUpdateEffect_REAL
+#define SDL_HapticRunEffect SDL_HapticRunEffect_REAL
+#define SDL_HapticStopEffect SDL_HapticStopEffect_REAL
+#define SDL_HapticDestroyEffect SDL_HapticDestroyEffect_REAL
+#define SDL_HapticGetEffectStatus SDL_HapticGetEffectStatus_REAL
+#define SDL_HapticSetGain SDL_HapticSetGain_REAL
+#define SDL_HapticSetAutocenter SDL_HapticSetAutocenter_REAL
+#define SDL_HapticPause SDL_HapticPause_REAL
+#define SDL_HapticUnpause SDL_HapticUnpause_REAL
+#define SDL_HapticStopAll SDL_HapticStopAll_REAL
+#define SDL_HapticRumbleSupported SDL_HapticRumbleSupported_REAL
+#define SDL_HapticRumbleInit SDL_HapticRumbleInit_REAL
+#define SDL_HapticRumblePlay SDL_HapticRumblePlay_REAL
+#define SDL_HapticRumbleStop SDL_HapticRumbleStop_REAL
+#define SDL_SetHintWithPriority SDL_SetHintWithPriority_REAL
+#define SDL_SetHint SDL_SetHint_REAL
+#define SDL_GetHint SDL_GetHint_REAL
+#define SDL_AddHintCallback SDL_AddHintCallback_REAL
+#define SDL_DelHintCallback SDL_DelHintCallback_REAL
+#define SDL_ClearHints SDL_ClearHints_REAL
+#define SDL_NumJoysticks SDL_NumJoysticks_REAL
+#define SDL_JoystickNameForIndex SDL_JoystickNameForIndex_REAL
+#define SDL_JoystickOpen SDL_JoystickOpen_REAL
+#define SDL_JoystickName SDL_JoystickName_REAL
+#define SDL_JoystickGetDeviceGUID SDL_JoystickGetDeviceGUID_REAL
+#define SDL_JoystickGetGUID SDL_JoystickGetGUID_REAL
+#define SDL_JoystickGetGUIDString SDL_JoystickGetGUIDString_REAL
+#define SDL_JoystickGetGUIDFromString SDL_JoystickGetGUIDFromString_REAL
+#define SDL_JoystickGetAttached SDL_JoystickGetAttached_REAL
+#define SDL_JoystickInstanceID SDL_JoystickInstanceID_REAL
+#define SDL_JoystickNumAxes SDL_JoystickNumAxes_REAL
+#define SDL_JoystickNumBalls SDL_JoystickNumBalls_REAL
+#define SDL_JoystickNumHats SDL_JoystickNumHats_REAL
+#define SDL_JoystickNumButtons SDL_JoystickNumButtons_REAL
+#define SDL_JoystickUpdate SDL_JoystickUpdate_REAL
+#define SDL_JoystickEventState SDL_JoystickEventState_REAL
+#define SDL_JoystickGetAxis SDL_JoystickGetAxis_REAL
+#define SDL_JoystickGetHat SDL_JoystickGetHat_REAL
+#define SDL_JoystickGetBall SDL_JoystickGetBall_REAL
+#define SDL_JoystickGetButton SDL_JoystickGetButton_REAL
+#define SDL_JoystickClose SDL_JoystickClose_REAL
+#define SDL_GetKeyboardFocus SDL_GetKeyboardFocus_REAL
+#define SDL_GetKeyboardState SDL_GetKeyboardState_REAL
+#define SDL_GetModState SDL_GetModState_REAL
+#define SDL_SetModState SDL_SetModState_REAL
+#define SDL_GetKeyFromScancode SDL_GetKeyFromScancode_REAL
+#define SDL_GetScancodeFromKey SDL_GetScancodeFromKey_REAL
+#define SDL_GetScancodeName SDL_GetScancodeName_REAL
+#define SDL_GetScancodeFromName SDL_GetScancodeFromName_REAL
+#define SDL_GetKeyName SDL_GetKeyName_REAL
+#define SDL_GetKeyFromName SDL_GetKeyFromName_REAL
+#define SDL_StartTextInput SDL_StartTextInput_REAL
+#define SDL_IsTextInputActive SDL_IsTextInputActive_REAL
+#define SDL_StopTextInput SDL_StopTextInput_REAL
+#define SDL_SetTextInputRect SDL_SetTextInputRect_REAL
+#define SDL_HasScreenKeyboardSupport SDL_HasScreenKeyboardSupport_REAL
+#define SDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown_REAL
+#define SDL_LoadObject SDL_LoadObject_REAL
+#define SDL_LoadFunction SDL_LoadFunction_REAL
+#define SDL_UnloadObject SDL_UnloadObject_REAL
+#define SDL_LogSetAllPriority SDL_LogSetAllPriority_REAL
+#define SDL_LogSetPriority SDL_LogSetPriority_REAL
+#define SDL_LogGetPriority SDL_LogGetPriority_REAL
+#define SDL_LogResetPriorities SDL_LogResetPriorities_REAL
+#define SDL_LogMessageV SDL_LogMessageV_REAL
+#define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_REAL
+#define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_REAL
+#define SDL_SetMainReady SDL_SetMainReady_REAL
+#define SDL_ShowMessageBox SDL_ShowMessageBox_REAL
+#define SDL_ShowSimpleMessageBox SDL_ShowSimpleMessageBox_REAL
+#define SDL_GetMouseFocus SDL_GetMouseFocus_REAL
+#define SDL_GetMouseState SDL_GetMouseState_REAL
+#define SDL_GetRelativeMouseState SDL_GetRelativeMouseState_REAL
+#define SDL_WarpMouseInWindow SDL_WarpMouseInWindow_REAL
+#define SDL_SetRelativeMouseMode SDL_SetRelativeMouseMode_REAL
+#define SDL_GetRelativeMouseMode SDL_GetRelativeMouseMode_REAL
+#define SDL_CreateCursor SDL_CreateCursor_REAL
+#define SDL_CreateColorCursor SDL_CreateColorCursor_REAL
+#define SDL_CreateSystemCursor SDL_CreateSystemCursor_REAL
+#define SDL_SetCursor SDL_SetCursor_REAL
+#define SDL_GetCursor SDL_GetCursor_REAL
+#define SDL_GetDefaultCursor SDL_GetDefaultCursor_REAL
+#define SDL_FreeCursor SDL_FreeCursor_REAL
+#define SDL_ShowCursor SDL_ShowCursor_REAL
+#define SDL_CreateMutex SDL_CreateMutex_REAL
+#define SDL_LockMutex SDL_LockMutex_REAL
+#define SDL_TryLockMutex SDL_TryLockMutex_REAL
+#define SDL_UnlockMutex SDL_UnlockMutex_REAL
+#define SDL_DestroyMutex SDL_DestroyMutex_REAL
+#define SDL_CreateSemaphore SDL_CreateSemaphore_REAL
+#define SDL_DestroySemaphore SDL_DestroySemaphore_REAL
+#define SDL_SemWait SDL_SemWait_REAL
+#define SDL_SemTryWait SDL_SemTryWait_REAL
+#define SDL_SemWaitTimeout SDL_SemWaitTimeout_REAL
+#define SDL_SemPost SDL_SemPost_REAL
+#define SDL_SemValue SDL_SemValue_REAL
+#define SDL_CreateCond SDL_CreateCond_REAL
+#define SDL_DestroyCond SDL_DestroyCond_REAL
+#define SDL_CondSignal SDL_CondSignal_REAL
+#define SDL_CondBroadcast SDL_CondBroadcast_REAL
+#define SDL_CondWait SDL_CondWait_REAL
+#define SDL_CondWaitTimeout SDL_CondWaitTimeout_REAL
+#define SDL_GetPixelFormatName SDL_GetPixelFormatName_REAL
+#define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_REAL
+#define SDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum_REAL
+#define SDL_AllocFormat SDL_AllocFormat_REAL
+#define SDL_FreeFormat SDL_FreeFormat_REAL
+#define SDL_AllocPalette SDL_AllocPalette_REAL
+#define SDL_SetPixelFormatPalette SDL_SetPixelFormatPalette_REAL
+#define SDL_SetPaletteColors SDL_SetPaletteColors_REAL
+#define SDL_FreePalette SDL_FreePalette_REAL
+#define SDL_MapRGB SDL_MapRGB_REAL
+#define SDL_MapRGBA SDL_MapRGBA_REAL
+#define SDL_GetRGB SDL_GetRGB_REAL
+#define SDL_GetRGBA SDL_GetRGBA_REAL
+#define SDL_CalculateGammaRamp SDL_CalculateGammaRamp_REAL
+#define SDL_GetPlatform SDL_GetPlatform_REAL
+#define SDL_GetPowerInfo SDL_GetPowerInfo_REAL
+#define SDL_HasIntersection SDL_HasIntersection_REAL
+#define SDL_IntersectRect SDL_IntersectRect_REAL
+#define SDL_UnionRect SDL_UnionRect_REAL
+#define SDL_EnclosePoints SDL_EnclosePoints_REAL
+#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL
+#define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL
+#define SDL_GetRenderDriverInfo SDL_GetRenderDriverInfo_REAL
+#define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL
+#define SDL_CreateRenderer SDL_CreateRenderer_REAL
+#define SDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer_REAL
+#define SDL_GetRenderer SDL_GetRenderer_REAL
+#define SDL_GetRendererInfo SDL_GetRendererInfo_REAL
+#define SDL_GetRendererOutputSize SDL_GetRendererOutputSize_REAL
+#define SDL_CreateTexture SDL_CreateTexture_REAL
+#define SDL_CreateTextureFromSurface SDL_CreateTextureFromSurface_REAL
+#define SDL_QueryTexture SDL_QueryTexture_REAL
+#define SDL_SetTextureColorMod SDL_SetTextureColorMod_REAL
+#define SDL_GetTextureColorMod SDL_GetTextureColorMod_REAL
+#define SDL_SetTextureAlphaMod SDL_SetTextureAlphaMod_REAL
+#define SDL_GetTextureAlphaMod SDL_GetTextureAlphaMod_REAL
+#define SDL_SetTextureBlendMode SDL_SetTextureBlendMode_REAL
+#define SDL_GetTextureBlendMode SDL_GetTextureBlendMode_REAL
+#define SDL_UpdateTexture SDL_UpdateTexture_REAL
+#define SDL_UpdateYUVTexture SDL_UpdateYUVTexture_REAL
+#define SDL_LockTexture SDL_LockTexture_REAL
+#define SDL_UnlockTexture SDL_UnlockTexture_REAL
+#define SDL_RenderTargetSupported SDL_RenderTargetSupported_REAL
+#define SDL_SetRenderTarget SDL_SetRenderTarget_REAL
+#define SDL_GetRenderTarget SDL_GetRenderTarget_REAL
+#define SDL_RenderSetLogicalSize SDL_RenderSetLogicalSize_REAL
+#define SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize_REAL
+#define SDL_RenderSetViewport SDL_RenderSetViewport_REAL
+#define SDL_RenderGetViewport SDL_RenderGetViewport_REAL
+#define SDL_RenderSetClipRect SDL_RenderSetClipRect_REAL
+#define SDL_RenderGetClipRect SDL_RenderGetClipRect_REAL
+#define SDL_RenderSetScale SDL_RenderSetScale_REAL
+#define SDL_RenderGetScale SDL_RenderGetScale_REAL
+#define SDL_SetRenderDrawColor SDL_SetRenderDrawColor_REAL
+#define SDL_GetRenderDrawColor SDL_GetRenderDrawColor_REAL
+#define SDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode_REAL
+#define SDL_GetRenderDrawBlendMode SDL_GetRenderDrawBlendMode_REAL
+#define SDL_RenderClear SDL_RenderClear_REAL
+#define SDL_RenderDrawPoint SDL_RenderDrawPoint_REAL
+#define SDL_RenderDrawPoints SDL_RenderDrawPoints_REAL
+#define SDL_RenderDrawLine SDL_RenderDrawLine_REAL
+#define SDL_RenderDrawLines SDL_RenderDrawLines_REAL
+#define SDL_RenderDrawRect SDL_RenderDrawRect_REAL
+#define SDL_RenderDrawRects SDL_RenderDrawRects_REAL
+#define SDL_RenderFillRect SDL_RenderFillRect_REAL
+#define SDL_RenderFillRects SDL_RenderFillRects_REAL
+#define SDL_RenderCopy SDL_RenderCopy_REAL
+#define SDL_RenderCopyEx SDL_RenderCopyEx_REAL
+#define SDL_RenderReadPixels SDL_RenderReadPixels_REAL
+#define SDL_RenderPresent SDL_RenderPresent_REAL
+#define SDL_DestroyTexture SDL_DestroyTexture_REAL
+#define SDL_DestroyRenderer SDL_DestroyRenderer_REAL
+#define SDL_GL_BindTexture SDL_GL_BindTexture_REAL
+#define SDL_GL_UnbindTexture SDL_GL_UnbindTexture_REAL
+#define SDL_RWFromFile SDL_RWFromFile_REAL
+#define SDL_RWFromMem SDL_RWFromMem_REAL
+#define SDL_RWFromConstMem SDL_RWFromConstMem_REAL
+#define SDL_AllocRW SDL_AllocRW_REAL
+#define SDL_FreeRW SDL_FreeRW_REAL
+#define SDL_ReadU8 SDL_ReadU8_REAL
+#define SDL_ReadLE16 SDL_ReadLE16_REAL
+#define SDL_ReadBE16 SDL_ReadBE16_REAL
+#define SDL_ReadLE32 SDL_ReadLE32_REAL
+#define SDL_ReadBE32 SDL_ReadBE32_REAL
+#define SDL_ReadLE64 SDL_ReadLE64_REAL
+#define SDL_ReadBE64 SDL_ReadBE64_REAL
+#define SDL_WriteU8 SDL_WriteU8_REAL
+#define SDL_WriteLE16 SDL_WriteLE16_REAL
+#define SDL_WriteBE16 SDL_WriteBE16_REAL
+#define SDL_WriteLE32 SDL_WriteLE32_REAL
+#define SDL_WriteBE32 SDL_WriteBE32_REAL
+#define SDL_WriteLE64 SDL_WriteLE64_REAL
+#define SDL_WriteBE64 SDL_WriteBE64_REAL
+#define SDL_CreateShapedWindow SDL_CreateShapedWindow_REAL
+#define SDL_IsShapedWindow SDL_IsShapedWindow_REAL
+#define SDL_SetWindowShape SDL_SetWindowShape_REAL
+#define SDL_GetShapedWindowMode SDL_GetShapedWindowMode_REAL
+#define SDL_malloc SDL_malloc_REAL
+#define SDL_calloc SDL_calloc_REAL
+#define SDL_realloc SDL_realloc_REAL
+#define SDL_free SDL_free_REAL
+#define SDL_getenv SDL_getenv_REAL
+#define SDL_setenv SDL_setenv_REAL
+#define SDL_qsort SDL_qsort_REAL
+#define SDL_abs SDL_abs_REAL
+#define SDL_isdigit SDL_isdigit_REAL
+#define SDL_isspace SDL_isspace_REAL
+#define SDL_toupper SDL_toupper_REAL
+#define SDL_tolower SDL_tolower_REAL
+#define SDL_memset SDL_memset_REAL
+#define SDL_memcpy SDL_memcpy_REAL
+#define SDL_memmove SDL_memmove_REAL
+#define SDL_memcmp SDL_memcmp_REAL
+#define SDL_wcslen SDL_wcslen_REAL
+#define SDL_wcslcpy SDL_wcslcpy_REAL
+#define SDL_wcslcat SDL_wcslcat_REAL
+#define SDL_strlen SDL_strlen_REAL
+#define SDL_strlcpy SDL_strlcpy_REAL
+#define SDL_utf8strlcpy SDL_utf8strlcpy_REAL
+#define SDL_strlcat SDL_strlcat_REAL
+#define SDL_strdup SDL_strdup_REAL
+#define SDL_strrev SDL_strrev_REAL
+#define SDL_strupr SDL_strupr_REAL
+#define SDL_strlwr SDL_strlwr_REAL
+#define SDL_strchr SDL_strchr_REAL
+#define SDL_strrchr SDL_strrchr_REAL
+#define SDL_strstr SDL_strstr_REAL
+#define SDL_itoa SDL_itoa_REAL
+#define SDL_uitoa SDL_uitoa_REAL
+#define SDL_ltoa SDL_ltoa_REAL
+#define SDL_ultoa SDL_ultoa_REAL
+#define SDL_lltoa SDL_lltoa_REAL
+#define SDL_ulltoa SDL_ulltoa_REAL
+#define SDL_atoi SDL_atoi_REAL
+#define SDL_atof SDL_atof_REAL
+#define SDL_strtol SDL_strtol_REAL
+#define SDL_strtoul SDL_strtoul_REAL
+#define SDL_strtoll SDL_strtoll_REAL
+#define SDL_strtoull SDL_strtoull_REAL
+#define SDL_strtod SDL_strtod_REAL
+#define SDL_strcmp SDL_strcmp_REAL
+#define SDL_strncmp SDL_strncmp_REAL
+#define SDL_strcasecmp SDL_strcasecmp_REAL
+#define SDL_strncasecmp SDL_strncasecmp_REAL
+#define SDL_vsnprintf SDL_vsnprintf_REAL
+#define SDL_acos SDL_acos_REAL
+#define SDL_asin SDL_asin_REAL
+#define SDL_atan SDL_atan_REAL
+#define SDL_atan2 SDL_atan2_REAL
+#define SDL_ceil SDL_ceil_REAL
+#define SDL_copysign SDL_copysign_REAL
+#define SDL_cos SDL_cos_REAL
+#define SDL_cosf SDL_cosf_REAL
+#define SDL_fabs SDL_fabs_REAL
+#define SDL_floor SDL_floor_REAL
+#define SDL_log SDL_log_REAL
+#define SDL_pow SDL_pow_REAL
+#define SDL_scalbn SDL_scalbn_REAL
+#define SDL_sin SDL_sin_REAL
+#define SDL_sinf SDL_sinf_REAL
+#define SDL_sqrt SDL_sqrt_REAL
+#define SDL_iconv_open SDL_iconv_open_REAL
+#define SDL_iconv_close SDL_iconv_close_REAL
+#define SDL_iconv SDL_iconv_REAL
+#define SDL_iconv_string SDL_iconv_string_REAL
+#define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL
+#define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL
+#define SDL_CreateRGBSurface SDL_CreateRGBSurface_REAL
+#define SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom_REAL
+#define SDL_FreeSurface SDL_FreeSurface_REAL
+#define SDL_SetSurfacePalette SDL_SetSurfacePalette_REAL
+#define SDL_LockSurface SDL_LockSurface_REAL
+#define SDL_UnlockSurface SDL_UnlockSurface_REAL
+#define SDL_LoadBMP_RW SDL_LoadBMP_RW_REAL
+#define SDL_SaveBMP_RW SDL_SaveBMP_RW_REAL
+#define SDL_SetSurfaceRLE SDL_SetSurfaceRLE_REAL
+#define SDL_SetColorKey SDL_SetColorKey_REAL
+#define SDL_GetColorKey SDL_GetColorKey_REAL
+#define SDL_SetSurfaceColorMod SDL_SetSurfaceColorMod_REAL
+#define SDL_GetSurfaceColorMod SDL_GetSurfaceColorMod_REAL
+#define SDL_SetSurfaceAlphaMod SDL_SetSurfaceAlphaMod_REAL
+#define SDL_GetSurfaceAlphaMod SDL_GetSurfaceAlphaMod_REAL
+#define SDL_SetSurfaceBlendMode SDL_SetSurfaceBlendMode_REAL
+#define SDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode_REAL
+#define SDL_SetClipRect SDL_SetClipRect_REAL
+#define SDL_GetClipRect SDL_GetClipRect_REAL
+#define SDL_ConvertSurface SDL_ConvertSurface_REAL
+#define SDL_ConvertSurfaceFormat SDL_ConvertSurfaceFormat_REAL
+#define SDL_ConvertPixels SDL_ConvertPixels_REAL
+#define SDL_FillRect SDL_FillRect_REAL
+#define SDL_FillRects SDL_FillRects_REAL
+#define SDL_UpperBlit SDL_UpperBlit_REAL
+#define SDL_LowerBlit SDL_LowerBlit_REAL
+#define SDL_SoftStretch SDL_SoftStretch_REAL
+#define SDL_UpperBlitScaled SDL_UpperBlitScaled_REAL
+#define SDL_LowerBlitScaled SDL_LowerBlitScaled_REAL
+#define SDL_GetWindowWMInfo SDL_GetWindowWMInfo_REAL
+#define SDL_GetThreadName SDL_GetThreadName_REAL
+#define SDL_ThreadID SDL_ThreadID_REAL
+#define SDL_GetThreadID SDL_GetThreadID_REAL
+#define SDL_SetThreadPriority SDL_SetThreadPriority_REAL
+#define SDL_WaitThread SDL_WaitThread_REAL
+#define SDL_DetachThread SDL_DetachThread_REAL
+#define SDL_TLSCreate SDL_TLSCreate_REAL
+#define SDL_TLSGet SDL_TLSGet_REAL
+#define SDL_TLSSet SDL_TLSSet_REAL
+#define SDL_GetTicks SDL_GetTicks_REAL
+#define SDL_GetPerformanceCounter SDL_GetPerformanceCounter_REAL
+#define SDL_GetPerformanceFrequency SDL_GetPerformanceFrequency_REAL
+#define SDL_Delay SDL_Delay_REAL
+#define SDL_AddTimer SDL_AddTimer_REAL
+#define SDL_RemoveTimer SDL_RemoveTimer_REAL
+#define SDL_GetNumTouchDevices SDL_GetNumTouchDevices_REAL
+#define SDL_GetTouchDevice SDL_GetTouchDevice_REAL
+#define SDL_GetNumTouchFingers SDL_GetNumTouchFingers_REAL
+#define SDL_GetTouchFinger SDL_GetTouchFinger_REAL
+#define SDL_GetVersion SDL_GetVersion_REAL
+#define SDL_GetRevision SDL_GetRevision_REAL
+#define SDL_GetRevisionNumber SDL_GetRevisionNumber_REAL
+#define SDL_GetNumVideoDrivers SDL_GetNumVideoDrivers_REAL
+#define SDL_GetVideoDriver SDL_GetVideoDriver_REAL
+#define SDL_VideoInit SDL_VideoInit_REAL
+#define SDL_VideoQuit SDL_VideoQuit_REAL
+#define SDL_GetCurrentVideoDriver SDL_GetCurrentVideoDriver_REAL
+#define SDL_GetNumVideoDisplays SDL_GetNumVideoDisplays_REAL
+#define SDL_GetDisplayName SDL_GetDisplayName_REAL
+#define SDL_GetDisplayBounds SDL_GetDisplayBounds_REAL
+#define SDL_GetDisplayDPI SDL_GetDisplayDPI_REAL
+#define SDL_GetNumDisplayModes SDL_GetNumDisplayModes_REAL
+#define SDL_GetDisplayMode SDL_GetDisplayMode_REAL
+#define SDL_GetDesktopDisplayMode SDL_GetDesktopDisplayMode_REAL
+#define SDL_GetCurrentDisplayMode SDL_GetCurrentDisplayMode_REAL
+#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_REAL
+#define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_REAL
+#define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_REAL
+#define SDL_GetWindowDisplayMode SDL_GetWindowDisplayMode_REAL
+#define SDL_GetWindowPixelFormat SDL_GetWindowPixelFormat_REAL
+#define SDL_CreateWindow SDL_CreateWindow_REAL
+#define SDL_CreateWindowFrom SDL_CreateWindowFrom_REAL
+#define SDL_GetWindowID SDL_GetWindowID_REAL
+#define SDL_GetWindowFromID SDL_GetWindowFromID_REAL
+#define SDL_GetWindowFlags SDL_GetWindowFlags_REAL
+#define SDL_SetWindowTitle SDL_SetWindowTitle_REAL
+#define SDL_GetWindowTitle SDL_GetWindowTitle_REAL
+#define SDL_SetWindowIcon SDL_SetWindowIcon_REAL
+#define SDL_SetWindowData SDL_SetWindowData_REAL
+#define SDL_GetWindowData SDL_GetWindowData_REAL
+#define SDL_SetWindowPosition SDL_SetWindowPosition_REAL
+#define SDL_GetWindowPosition SDL_GetWindowPosition_REAL
+#define SDL_SetWindowSize SDL_SetWindowSize_REAL
+#define SDL_GetWindowSize SDL_GetWindowSize_REAL
+#define SDL_SetWindowMinimumSize SDL_SetWindowMinimumSize_REAL
+#define SDL_GetWindowMinimumSize SDL_GetWindowMinimumSize_REAL
+#define SDL_SetWindowMaximumSize SDL_SetWindowMaximumSize_REAL
+#define SDL_GetWindowMaximumSize SDL_GetWindowMaximumSize_REAL
+#define SDL_SetWindowBordered SDL_SetWindowBordered_REAL
+#define SDL_ShowWindow SDL_ShowWindow_REAL
+#define SDL_HideWindow SDL_HideWindow_REAL
+#define SDL_RaiseWindow SDL_RaiseWindow_REAL
+#define SDL_MaximizeWindow SDL_MaximizeWindow_REAL
+#define SDL_MinimizeWindow SDL_MinimizeWindow_REAL
+#define SDL_RestoreWindow SDL_RestoreWindow_REAL
+#define SDL_SetWindowFullscreen SDL_SetWindowFullscreen_REAL
+#define SDL_GetWindowSurface SDL_GetWindowSurface_REAL
+#define SDL_UpdateWindowSurface SDL_UpdateWindowSurface_REAL
+#define SDL_UpdateWindowSurfaceRects SDL_UpdateWindowSurfaceRects_REAL
+#define SDL_SetWindowGrab SDL_SetWindowGrab_REAL
+#define SDL_GetWindowGrab SDL_GetWindowGrab_REAL
+#define SDL_SetWindowBrightness SDL_SetWindowBrightness_REAL
+#define SDL_GetWindowBrightness SDL_GetWindowBrightness_REAL
+#define SDL_SetWindowGammaRamp SDL_SetWindowGammaRamp_REAL
+#define SDL_GetWindowGammaRamp SDL_GetWindowGammaRamp_REAL
+#define SDL_DestroyWindow SDL_DestroyWindow_REAL
+#define SDL_IsScreenSaverEnabled SDL_IsScreenSaverEnabled_REAL
+#define SDL_EnableScreenSaver SDL_EnableScreenSaver_REAL
+#define SDL_DisableScreenSaver SDL_DisableScreenSaver_REAL
+#define SDL_GL_LoadLibrary SDL_GL_LoadLibrary_REAL
+#define SDL_GL_GetProcAddress SDL_GL_GetProcAddress_REAL
+#define SDL_GL_UnloadLibrary SDL_GL_UnloadLibrary_REAL
+#define SDL_GL_ExtensionSupported SDL_GL_ExtensionSupported_REAL
+#define SDL_GL_SetAttribute SDL_GL_SetAttribute_REAL
+#define SDL_GL_GetAttribute SDL_GL_GetAttribute_REAL
+#define SDL_GL_CreateContext SDL_GL_CreateContext_REAL
+#define SDL_GL_MakeCurrent SDL_GL_MakeCurrent_REAL
+#define SDL_GL_GetCurrentWindow SDL_GL_GetCurrentWindow_REAL
+#define SDL_GL_GetCurrentContext SDL_GL_GetCurrentContext_REAL
+#define SDL_GL_GetDrawableSize SDL_GL_GetDrawableSize_REAL
+#define SDL_GL_SetSwapInterval SDL_GL_SetSwapInterval_REAL
+#define SDL_GL_GetSwapInterval SDL_GL_GetSwapInterval_REAL
+#define SDL_GL_SwapWindow SDL_GL_SwapWindow_REAL
+#define SDL_GL_DeleteContext SDL_GL_DeleteContext_REAL
+#define SDL_vsscanf SDL_vsscanf_REAL
+#define SDL_GameControllerAddMappingsFromRW SDL_GameControllerAddMappingsFromRW_REAL
+#define SDL_GL_ResetAttributes SDL_GL_ResetAttributes_REAL
+#define SDL_HasAVX SDL_HasAVX_REAL
+#define SDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler_REAL
+#define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL
+#define SDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo_REAL
+#define SDL_RenderIsClipEnabled SDL_RenderIsClipEnabled_REAL
+#define SDL_WinRTRunApp SDL_WinRTRunApp_REAL
+#define SDL_WarpMouseGlobal SDL_WarpMouseGlobal_REAL
+#define SDL_WinRTGetFSPathUNICODE SDL_WinRTGetFSPathUNICODE_REAL
+#define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_REAL
+#define SDL_WinRTRunApp SDL_WinRTRunApp_REAL
+#define SDL_sqrtf SDL_sqrtf_REAL
+#define SDL_tan SDL_tan_REAL
+#define SDL_tanf SDL_tanf_REAL
+#define SDL_CaptureMouse SDL_CaptureMouse_REAL
+#define SDL_SetWindowHitTest SDL_SetWindowHitTest_REAL
+#define SDL_GetGlobalMouseState SDL_GetGlobalMouseState_REAL
+#define SDL_HasAVX2 SDL_HasAVX2_REAL
+#define SDL_QueueAudio SDL_QueueAudio_REAL
+#define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL
+#define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
+#define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL
+#define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL
+#define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL
+#define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL
+#define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL
+#define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL
+#define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL
+#define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL
+#define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL
+#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL
+#define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL
+#define SDL_RenderSetIntegerScale SDL_RenderSetIntegerScale_REAL
+#define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_REAL
+#define SDL_DequeueAudio SDL_DequeueAudio_REAL
+#define SDL_SetWindowResizable SDL_SetWindowResizable_REAL
+#define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL
+#define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL
+#define SDL_GetHintBoolean SDL_GetHintBoolean_REAL
+#define SDL_JoystickGetDeviceVendor SDL_JoystickGetDeviceVendor_REAL
+#define SDL_JoystickGetDeviceProduct SDL_JoystickGetDeviceProduct_REAL
+#define SDL_JoystickGetDeviceProductVersion SDL_JoystickGetDeviceProductVersion_REAL
+#define SDL_JoystickGetVendor SDL_JoystickGetVendor_REAL
+#define SDL_JoystickGetProduct SDL_JoystickGetProduct_REAL
+#define SDL_JoystickGetProductVersion SDL_JoystickGetProductVersion_REAL
+#define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_REAL
+#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_REAL
+#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_REAL
+#define SDL_HasNEON SDL_HasNEON_REAL
+#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_REAL
+#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_REAL
+#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL
+#define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL
+#define SDL_JoystickGetType SDL_JoystickGetType_REAL
+#define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL
+#define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL
+#define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL
+#define SDL_utf8strlen SDL_utf8strlen_REAL
+#define SDL_LoadFile_RW SDL_LoadFile_RW_REAL
+#define SDL_wcscmp SDL_wcscmp_REAL
+#define SDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode_REAL
+#define SDL_DuplicateSurface SDL_DuplicateSurface_REAL
+#define SDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary_REAL
+#define SDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr_REAL
+#define SDL_Vulkan_UnloadLibrary SDL_Vulkan_UnloadLibrary_REAL
+#define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL
+#define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL
+#define SDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize_REAL
+#define SDL_LockJoysticks SDL_LockJoysticks_REAL
+#define SDL_UnlockJoysticks SDL_UnlockJoysticks_REAL
+#define SDL_GetMemoryFunctions SDL_GetMemoryFunctions_REAL
+#define SDL_SetMemoryFunctions SDL_SetMemoryFunctions_REAL
+#define SDL_GetNumAllocations SDL_GetNumAllocations_REAL
+#define SDL_NewAudioStream SDL_NewAudioStream_REAL
+#define SDL_AudioStreamPut SDL_AudioStreamPut_REAL
+#define SDL_AudioStreamGet SDL_AudioStreamGet_REAL
+#define SDL_AudioStreamClear SDL_AudioStreamClear_REAL
+#define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_REAL
+#define SDL_FreeAudioStream SDL_FreeAudioStream_REAL
+#define SDL_AudioStreamFlush SDL_AudioStreamFlush_REAL
+#define SDL_acosf SDL_acosf_REAL
+#define SDL_asinf SDL_asinf_REAL
+#define SDL_atanf SDL_atanf_REAL
+#define SDL_atan2f SDL_atan2f_REAL
+#define SDL_ceilf SDL_ceilf_REAL
+#define SDL_copysignf SDL_copysignf_REAL
+#define SDL_fabsf SDL_fabsf_REAL
+#define SDL_floorf SDL_floorf_REAL
+#define SDL_logf SDL_logf_REAL
+#define SDL_powf SDL_powf_REAL
+#define SDL_scalbnf SDL_scalbnf_REAL
+#define SDL_fmod SDL_fmod_REAL
+#define SDL_fmodf SDL_fmodf_REAL
+#define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL
+#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL
+#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL
+#define SDL_RenderGetMetalLayer SDL_RenderGetMetalLayer_REAL
+#define SDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder_REAL
+#define SDL_IsAndroidTV SDL_IsAndroidTV_REAL
+#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_REAL
+#define SDL_log10 SDL_log10_REAL
+#define SDL_log10f SDL_log10f_REAL
diff --git a/src/3rdparty/SDL2/src/dynapi/SDL_dynapi_procs.h b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi_procs.h
new file mode 100644
index 0000000..b715d33
--- /dev/null
+++ b/src/3rdparty/SDL2/src/dynapi/SDL_dynapi_procs.h
@@ -0,0 +1,709 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* vi: set ts=4 sw=4 expandtab: */
+
+/*
+ DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl.
+ NEVER REARRANGE THIS FILE, THE ORDER IS ABI LAW.
+ Changing this file means bumping SDL_DYNAPI_VERSION. You can safely add
+ new items to the end of the file, though.
+ Also, this file gets included multiple times, don't add #pragma once, etc.
+*/
+
+/* direct jump magic can use these, the rest needs special code. */
+#if !SDL_DYNAPI_PROC_NO_VARARGS
+SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return)
+SDL_DYNAPI_PROC(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),)
+SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogDebug,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogInfo,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogWarn,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogError,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogCritical,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogMessage,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_sscanf,(const char *a, SDL_SCANF_FORMAT_STRING const char *b, ...),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),return)
+#endif
+
+#ifdef SDL_CreateThread
+#undef SDL_CreateThread
+#endif
+
+#if defined(__WIN32__) && !defined(HAVE_LIBC)
+SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return)
+#elif defined(__OS2__)
+SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return)
+#else
+SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return)
+#endif
+
+#ifdef HAVE_STDIO_H
+SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(FILE *a, SDL_bool b),(a,b),return)
+#else
+SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return)
+#endif
+
+#ifdef __WIN32__
+SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_Direct3D9GetAdapterIndex,(int a),(a),return)
+SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),return)
+#endif
+
+#ifdef __IPHONEOS__
+SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),)
+#endif
+
+#ifdef __ANDROID__
+SDL_DYNAPI_PROC(void*,SDL_AndroidGetJNIEnv,(void),(),return)
+SDL_DYNAPI_PROC(void*,SDL_AndroidGetActivity,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_AndroidGetInternalStoragePath,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_AndroidGetExternalStorageState,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_AndroidGetExternalStoragePath,(void),(),return)
+#endif
+
+SDL_DYNAPI_PROC(int,SDL_Init,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_InitSubSystem,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_QuitSubSystem,(Uint32 a),(a),)
+SDL_DYNAPI_PROC(Uint32,SDL_WasInit,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_Quit,(void),(),)
+SDL_DYNAPI_PROC(SDL_assert_state,SDL_ReportAssertion,(SDL_assert_data *a, const char *b, const char *c, int d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(void,SDL_SetAssertionHandler,(SDL_AssertionHandler a, void *b),(a,b),)
+SDL_DYNAPI_PROC(const SDL_assert_data*,SDL_GetAssertionReport,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicTryLock,(SDL_SpinLock *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_AtomicLock,(SDL_SpinLock *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_AtomicUnlock,(SDL_SpinLock *a),(a),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCAS,(SDL_atomic_t *a, int b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_AtomicSet,(SDL_atomic_t *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_AtomicGet,(SDL_atomic_t *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_atomic_t *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCASPtr,(void **a, void *b, void *c),(a,b,c),return)
+SDL_DYNAPI_PROC(void*,SDL_AtomicSetPtr,(void **a, void *b),(a,b),return)
+SDL_DYNAPI_PROC(void*,SDL_AtomicGetPtr,(void **a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumAudioDrivers,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_AudioInit,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_AudioQuit,(void),(),)
+SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_OpenAudio,(SDL_AudioSpec *a, SDL_AudioSpec *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumAudioDevices,(int a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetAudioDeviceName,(int a, int b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_OpenAudioDevice,(const char *a, int b, const SDL_AudioSpec *c, SDL_AudioSpec *d, int e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(SDL_AudioStatus,SDL_GetAudioStatus,(void),(),return)
+SDL_DYNAPI_PROC(SDL_AudioStatus,SDL_GetAudioDeviceStatus,(SDL_AudioDeviceID a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_PauseAudio,(int a),(a),)
+SDL_DYNAPI_PROC(void,SDL_PauseAudioDevice,(SDL_AudioDeviceID a, int b),(a,b),)
+SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(void,SDL_FreeWAV,(Uint8 *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_BuildAudioCVT,(SDL_AudioCVT *a, SDL_AudioFormat b, Uint8 c, int d, SDL_AudioFormat e, Uint8 f, int g),(a,b,c,d,e,f,g),return)
+SDL_DYNAPI_PROC(int,SDL_ConvertAudio,(SDL_AudioCVT *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_MixAudio,(Uint8 *a, const Uint8 *b, Uint32 c, int d),(a,b,c,d),)
+SDL_DYNAPI_PROC(void,SDL_MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e),(a,b,c,d,e),)
+SDL_DYNAPI_PROC(void,SDL_LockAudio,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_LockAudioDevice,(SDL_AudioDeviceID a),(a),)
+SDL_DYNAPI_PROC(void,SDL_UnlockAudio,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),)
+SDL_DYNAPI_PROC(void,SDL_CloseAudio,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),)
+SDL_DYNAPI_PROC(int,SDL_SetClipboardText,(const char *a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_GetClipboardText,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasClipboardText,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetCPUCount,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetCPUCacheLineSize,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasRDTSC,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasAltiVec,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasMMX,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_Has3DNow,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE2,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE3,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE41,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE42,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetSystemRAM,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetError,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_ClearError,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_Error,(SDL_errorcode a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL_Event *a, int b, SDL_eventaction c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvent,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvents,(Uint32 a, Uint32 b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),)
+SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_PollEvent,(SDL_Event *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitEvent,(SDL_Event *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitEventTimeout,(SDL_Event *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL_Event *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_SetEventFilter,(SDL_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_AddEventWatch,(SDL_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_DelEventWatch,(SDL_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_FilterEvents,(SDL_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(Uint8,SDL_EventState,(Uint32 a, int b),(a,b),return)
+SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_GetBasePath,(void),(),return)
+SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GameControllerAddMapping,(const char *a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForGUID,(SDL_JoystickGUID a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_GameControllerMapping,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IsGameController,(int a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GameControllerNameForIndex,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerOpen,(int a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GameControllerName,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerGetAttached,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GameControllerGetJoystick,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GameControllerEventState,(int a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_GameControllerUpdate,(void),(),)
+SDL_DYNAPI_PROC(SDL_GameControllerAxis,SDL_GameControllerGetAxisFromString,(const char *a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetStringForAxis,(SDL_GameControllerAxis a),(a),return)
+SDL_DYNAPI_PROC(SDL_GameControllerButtonBind,SDL_GameControllerGetBindForAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
+SDL_DYNAPI_PROC(Sint16,SDL_GameControllerGetAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_GameControllerButton,SDL_GameControllerGetButtonFromString,(const char *a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetStringForButton,(SDL_GameControllerButton a),(a),return)
+SDL_DYNAPI_PROC(SDL_GameControllerButtonBind,SDL_GameControllerGetBindForButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
+SDL_DYNAPI_PROC(Uint8,SDL_GameControllerGetButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_GameControllerClose,(SDL_GameController *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_RecordGesture,(SDL_TouchID a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SaveAllDollarTemplates,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SaveDollarTemplate,(SDL_GestureID a, SDL_RWops *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_LoadDollarTemplates,(SDL_TouchID a, SDL_RWops *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_NumHaptics,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_HapticName,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpen,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticOpened,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticIndex,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_MouseIsHaptic,(void),(),return)
+SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpenFromMouse,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickIsHaptic,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpenFromJoystick,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_HapticClose,(SDL_Haptic *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_HapticNumEffects,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticNumEffectsPlaying,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(unsigned int,SDL_HapticQuery,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticNumAxes,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticEffectSupported,(SDL_Haptic *a, SDL_HapticEffect *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_HapticNewEffect,(SDL_Haptic *a, SDL_HapticEffect *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_HapticUpdateEffect,(SDL_Haptic *a, int b, SDL_HapticEffect *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_HapticRunEffect,(SDL_Haptic *a, int b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_HapticStopEffect,(SDL_Haptic *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_HapticDestroyEffect,(SDL_Haptic *a, int b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_HapticGetEffectStatus,(SDL_Haptic *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_HapticSetGain,(SDL_Haptic *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_HapticSetAutocenter,(SDL_Haptic *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_HapticPause,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticUnpause,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticStopAll,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticRumbleSupported,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticRumbleInit,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_HapticRumblePlay,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_HapticRumbleStop,(SDL_Haptic *a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_SetHint,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetHint,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_DelHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_ClearHints,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_NumJoysticks,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_JoystickNameForIndex,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickOpen,(int a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_JoystickName,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetDeviceGUID,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetGUID,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_JoystickGetGUIDString,(SDL_JoystickGUID a, char *b, int c),(a,b,c),)
+SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetGUIDFromString,(const char *a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAttached,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickInstanceID,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickNumAxes,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickNumBalls,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickNumHats,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickNumButtons,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_JoystickUpdate,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_JoystickEventState,(int a),(a),return)
+SDL_DYNAPI_PROC(Sint16,SDL_JoystickGetAxis,(SDL_Joystick *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(Uint8,SDL_JoystickGetHat,(SDL_Joystick *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickGetBall,(SDL_Joystick *a, int b, int *c, int *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(Uint8,SDL_JoystickGetButton,(SDL_Joystick *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_JoystickClose,(SDL_Joystick *a),(a),)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return)
+SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return)
+SDL_DYNAPI_PROC(SDL_Keymod,SDL_GetModState,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_SetModState,(SDL_Keymod a),(a),)
+SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a),(a),return)
+SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromKey,(SDL_Keycode a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetScancodeName,(SDL_Scancode a),(a),return)
+SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromName,(const char *a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return)
+SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_StartTextInput,(void),(),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputActive,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_StopTextInput,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(SDL_Rect *a),(a),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenKeyboardShown,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_LoadFunction,(void *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_LogSetAllPriority,(SDL_LogPriority a),(a),)
+SDL_DYNAPI_PROC(void,SDL_LogSetPriority,(int a, SDL_LogPriority b),(a,b),)
+SDL_DYNAPI_PROC(SDL_LogPriority,SDL_LogGetPriority,(int a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_LogResetPriorities,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_LogMessageV,(int a, SDL_LogPriority b, const char *c, va_list d),(a,b,c,d),)
+SDL_DYNAPI_PROC(void,SDL_LogGetOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_LogSetOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_SetMainReady,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_ShowMessageBox,(const SDL_MessageBoxData *a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_ShowSimpleMessageBox,(Uint32 a, const char *b, const char *c, SDL_Window *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_GetMouseFocus,(void),(),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetMouseState,(int *a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetRelativeMouseState,(int *a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_WarpMouseInWindow,(SDL_Window *a, int b, int c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_SetRelativeMouseMode,(SDL_bool a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return)
+SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateCursor,(const Uint8 *a, const Uint8 *b, int c, int d, int e, int f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateColorCursor,(SDL_Surface *a, int b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateSystemCursor,(SDL_SystemCursor a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_SetCursor,(SDL_Cursor *a),(a),)
+SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetCursor,(void),(),return)
+SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetDefaultCursor,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_FreeCursor,(SDL_Cursor *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_ShowCursor,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_mutex*,SDL_CreateMutex,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_LockMutex,(SDL_mutex *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_TryLockMutex,(SDL_mutex *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_UnlockMutex,(SDL_mutex *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_mutex *a),(a),)
+SDL_DYNAPI_PROC(SDL_sem*,SDL_CreateSemaphore,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_sem *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_SemWait,(SDL_sem *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SemTryWait,(SDL_sem *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SemWaitTimeout,(SDL_sem *a, Uint32 b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SemPost,(SDL_sem *a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_SemValue,(SDL_sem *a),(a),return)
+SDL_DYNAPI_PROC(SDL_cond*,SDL_CreateCond,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_DestroyCond,(SDL_cond *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_CondSignal,(SDL_cond *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_CondBroadcast,(SDL_cond *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_CondWait,(SDL_cond *a, SDL_mutex *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_CondWaitTimeout,(SDL_cond *a, SDL_mutex *b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetPixelFormatName,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_PixelFormatEnumToMasks,(Uint32 a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(Uint32,SDL_MasksToPixelFormatEnum,(int a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_AllocFormat,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_FreeFormat,(SDL_PixelFormat *a),(a),)
+SDL_DYNAPI_PROC(SDL_Palette*,SDL_AllocPalette,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetPixelFormatPalette,(SDL_PixelFormat *a, SDL_Palette *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, int c, int d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(void,SDL_FreePalette,(SDL_Palette *a),(a),)
+SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),)
+SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),)
+SDL_DYNAPI_PROC(void,SDL_CalculateGammaRamp,(float a, Uint16 *b),(a,b),)
+SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return)
+SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetRenderDriverInfo,(int a, SDL_RendererInfo *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, int b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return)
+SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetRendererInfo,(SDL_Renderer *a, SDL_RendererInfo *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetRendererOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTexture,(SDL_Renderer *a, Uint32 b, int c, int d, int e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureFromSurface,(SDL_Renderer *a, SDL_Surface *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_QueryTexture,(SDL_Texture *a, Uint32 *b, int *c, int *d, int *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_UpdateTexture,(SDL_Texture *a, const SDL_Rect *b, const void *c, int d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return)
+SDL_DYNAPI_PROC(int,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(void,SDL_UnlockTexture,(SDL_Texture *a),(a),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTargetSupported,(SDL_Renderer *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_Texture*,SDL_GetRenderTarget,(SDL_Renderer *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_RenderSetLogicalSize,(SDL_Renderer *a, int b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_RenderGetLogicalSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_RenderSetViewport,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_RenderGetViewport,(SDL_Renderer *a, SDL_Rect *b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_RenderSetClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_RenderGetClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_RenderSetScale,(SDL_Renderer *a, float b, float c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_RenderGetScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_RenderClear,(SDL_Renderer *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_RenderDrawPoint,(SDL_Renderer *a, int b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_RenderDrawPoints,(SDL_Renderer *a, const SDL_Point *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_RenderDrawLine,(SDL_Renderer *a, int b, int c, int d, int e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_RenderDrawLines,(SDL_Renderer *a, const SDL_Point *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_RenderDrawRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_RenderDrawRects,(SDL_Renderer *a, const SDL_Rect *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_RenderFillRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_RenderFillRects,(SDL_Renderer *a, const SDL_Rect *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_RenderCopy,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_RenderCopyEx,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d, const double e, const SDL_Point *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return)
+SDL_DYNAPI_PROC(int,SDL_RenderReadPixels,(SDL_Renderer *a, const SDL_Rect *b, Uint32 c, void *d, int e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(void,SDL_RenderPresent,(SDL_Renderer *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_DestroyTexture,(SDL_Texture *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_GL_BindTexture,(SDL_Texture *a, float *b, float *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GL_UnbindTexture,(SDL_Texture *a),(a),return)
+SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFile,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromMem,(void *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromConstMem,(const void *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_RWops*,SDL_AllocRW,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_FreeRW,(SDL_RWops *a),(a),)
+SDL_DYNAPI_PROC(Uint8,SDL_ReadU8,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_ReadLE16,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_ReadBE16,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_ReadLE32,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_ReadBE32,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(Uint64,SDL_ReadLE64,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(Uint64,SDL_ReadBE64,(SDL_RWops *a),(a),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteU8,(SDL_RWops *a, Uint8 b),(a,b),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteLE16,(SDL_RWops *a, Uint16 b),(a,b),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteBE16,(SDL_RWops *a, Uint16 b),(a,b),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteLE32,(SDL_RWops *a, Uint32 b),(a,b),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteBE32,(SDL_RWops *a, Uint32 b),(a,b),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteLE64,(SDL_RWops *a, Uint64 b),(a,b),return)
+SDL_DYNAPI_PROC(size_t,SDL_WriteBE64,(SDL_RWops *a, Uint64 b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateShapedWindow,(const char *a, unsigned int b, unsigned int c, unsigned int d, unsigned int e, Uint32 f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IsShapedWindow,(const SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b, SDL_WindowShapeMode *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetShapedWindowMode,(SDL_Window *a, SDL_WindowShapeMode *b),(a,b),return)
+SDL_DYNAPI_PROC(void*,SDL_malloc,(size_t a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_calloc,(size_t a, size_t b),(a,b),return)
+SDL_DYNAPI_PROC(void*,SDL_realloc,(void *a, size_t b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),)
+SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_setenv,(const char *a, const char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (*d)(const void *, const void *)),(a,b,c,d),)
+SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_isdigit,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_isspace,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_toupper,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_tolower,(int a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_memset,(SDL_OUT_BYTECAP(c) void *a, int b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(void*,SDL_memcpy,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(void*,SDL_memmove,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_memcmp,(const void *a, const void *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(size_t,SDL_wcslen,(const wchar_t *a),(a),return)
+SDL_DYNAPI_PROC(size_t,SDL_wcslcpy,(SDL_OUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(size_t,SDL_wcslcat,(SDL_INOUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(size_t,SDL_strlen,(const char *a),(a),return)
+SDL_DYNAPI_PROC(size_t,SDL_strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(size_t,SDL_utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(size_t,SDL_strlcat,(SDL_INOUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(char*,SDL_strdup,(const char *a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_strrev,(char *a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_strupr,(char *a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_strlwr,(char *a),(a),return)
+SDL_DYNAPI_PROC(char*,SDL_strchr,(const char *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(char*,SDL_strrchr,(const char *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(char*,SDL_strstr,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(char*,SDL_itoa,(int a, char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(char*,SDL_uitoa,(unsigned int a, char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(char*,SDL_ltoa,(long a, char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(char*,SDL_ultoa,(unsigned long a, char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(char*,SDL_lltoa,(Sint64 a, char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(char*,SDL_ulltoa,(Uint64 a, char *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_atoi,(const char *a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_atof,(const char *a),(a),return)
+SDL_DYNAPI_PROC(long,SDL_strtol,(const char *a, char **b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(unsigned long,SDL_strtoul,(const char *a, char **b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(Sint64,SDL_strtoll,(const char *a, char **b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(Uint64,SDL_strtoull,(const char *a, char **b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(double,SDL_strtod,(const char *a, char **b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_strcmp,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_strncmp,(const char *a, const char *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_strcasecmp,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_strncasecmp,(const char *a, const char *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_vsnprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, const char *c, va_list d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(double,SDL_acos,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_asin,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_atan,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_atan2,(double a, double b),(a,b),return)
+SDL_DYNAPI_PROC(double,SDL_ceil,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_copysign,(double a, double b),(a,b),return)
+SDL_DYNAPI_PROC(double,SDL_cos,(double a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_cosf,(float a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_fabs,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_floor,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_log,(double a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_pow,(double a, double b),(a,b),return)
+SDL_DYNAPI_PROC(double,SDL_scalbn,(double a, int b),(a,b),return)
+SDL_DYNAPI_PROC(double,SDL_sin,(double a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_sinf,(float a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_sqrt,(double a),(a),return)
+SDL_DYNAPI_PROC(SDL_iconv_t,SDL_iconv_open,(const char *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return)
+SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(char*,SDL_iconv_string,(const char *a, const char *b, const char *c, size_t d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurface,(Uint32 a, int b, int c, int d, Uint32 e, Uint32 f, Uint32 g, Uint32 h),(a,b,c,d,e,f,g,h),return)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceFrom,(void *a, int b, int c, int d, int e, Uint32 f, Uint32 g, Uint32 h, Uint32 i),(a,b,c,d,e,f,g,h,i),return)
+SDL_DYNAPI_PROC(void,SDL_FreeSurface,(SDL_Surface *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_RW,(SDL_RWops *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SaveBMP_RW,(SDL_Surface *a, SDL_RWops *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_SetSurfaceRLE,(SDL_Surface *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetColorKey,(SDL_Surface *a, int b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_SetClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_GetClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return)
+SDL_DYNAPI_PROC(int,SDL_FillRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_FillRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_UpperBlit,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_LowerBlit,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_UpperBlitScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_LowerBlitScaled,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b),(a,b),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return)
+SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return)
+SDL_DYNAPI_PROC(SDL_threadID,SDL_GetThreadID,(SDL_Thread *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetThreadPriority,(SDL_ThreadPriority a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_WaitThread,(SDL_Thread *a, int *b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),)
+SDL_DYNAPI_PROC(SDL_TLSID,SDL_TLSCreate,(void),(),return)
+SDL_DYNAPI_PROC(void*,SDL_TLSGet,(SDL_TLSID a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (*c)(void*)),(a,b,c),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetTicks,(void),(),return)
+SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return)
+SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_Delay,(Uint32 a),(a),)
+SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_RemoveTimer,(SDL_TimerID a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumTouchDevices,(void),(),return)
+SDL_DYNAPI_PROC(SDL_TouchID,SDL_GetTouchDevice,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumTouchFingers,(SDL_TouchID a),(a),return)
+SDL_DYNAPI_PROC(SDL_Finger*,SDL_GetTouchFinger,(SDL_TouchID a, int b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_GetVersion,(SDL_version *a),(a),)
+SDL_DYNAPI_PROC(const char*,SDL_GetRevision,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetRevisionNumber,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumVideoDrivers,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_VideoInit,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_VideoQuit,(void),(),)
+SDL_DYNAPI_PROC(const char*,SDL_GetCurrentVideoDriver,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumVideoDisplays,(void),(),return)
+SDL_DYNAPI_PROC(const char*,SDL_GetDisplayName,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetDisplayBounds,(int a, SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumDisplayModes,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetDisplayMode,(int a, int b, SDL_DisplayMode *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetDesktopDisplayMode,(int a, SDL_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetCurrentDisplayMode,(int a, SDL_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_DisplayMode*,SDL_GetClosestDisplayMode,(int a, const SDL_DisplayMode *b, SDL_DisplayMode *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayIndex,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowDisplayMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayMode,(SDL_Window *a, SDL_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetWindowPixelFormat,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowFrom,(const void *a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetWindowID,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(Uint32 a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_SetWindowTitle,(SDL_Window *a, const char *b),(a,b),)
+SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),)
+SDL_DYNAPI_PROC(void*,SDL_SetWindowData,(SDL_Window *a, const char *b, void *c),(a,b,c),return)
+SDL_DYNAPI_PROC(void*,SDL_GetWindowData,(SDL_Window *a, const char *b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_SetWindowMinimumSize,(SDL_Window *a, int b, int c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_GetWindowMinimumSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_SetWindowMaximumSize,(SDL_Window *a, int b, int c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_ShowWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_HideWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_RaiseWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_MaximizeWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_MinimizeWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_RestoreWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreen,(SDL_Window *a, Uint32 b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowGrab,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowBrightness,(SDL_Window *a, float b),(a,b),return)
+SDL_DYNAPI_PROC(float,SDL_GetWindowBrightness,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowGammaRamp,(SDL_Window *a, const Uint16 *b, const Uint16 *c, const Uint16 *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowGammaRamp,(SDL_Window *a, Uint16 *b, Uint16 *c, Uint16 *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(void,SDL_DestroyWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenSaverEnabled,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_EnableScreenSaver,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_DisableScreenSaver,(void),(),)
+SDL_DYNAPI_PROC(int,SDL_GL_LoadLibrary,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_GL_GetProcAddress,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_GL_GetCurrentWindow,(void),(),return)
+SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_GL_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_GL_SwapWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(void,SDL_GL_DeleteContext,(SDL_GLContext a),(a),)
+SDL_DYNAPI_PROC(int,SDL_vsscanf,(const char *a, const char *b, va_list c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GameControllerAddMappingsFromRW,(SDL_RWops *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_GL_ResetAttributes,(void),(),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX,(void),(),return)
+SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),return)
+SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return)
+#ifdef __WIN32__
+SDL_DYNAPI_PROC(SDL_bool,SDL_DXGIGetOutputInfo,(int a,int *b, int *c),(a,b,c),return)
+#endif
+SDL_DYNAPI_PROC(SDL_bool,SDL_RenderIsClipEnabled,(SDL_Renderer *a),(a),return)
+#ifdef __WINRT__
+SDL_DYNAPI_PROC(int,SDL_WinRTRunApp,(int a, char **b, void *c),(a,b,c),return)
+SDL_DYNAPI_PROC(const wchar_t*,SDL_WinRTGetFSPathUNICODE,(SDL_WinRT_Path a),(a),return)
+SDL_DYNAPI_PROC(const char*,SDL_WinRTGetFSPathUTF8,(SDL_WinRT_Path a),(a),return)
+#endif
+SDL_DYNAPI_PROC(int,SDL_WarpMouseGlobal,(int a, int b),(a,b),return)
+SDL_DYNAPI_PROC(float,SDL_sqrtf,(float a),(a),return)
+SDL_DYNAPI_PROC(double,SDL_tan,(double a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_tanf,(float a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_CaptureMouse,(SDL_bool a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetGlobalMouseState,(int *a, int *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX2,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
+SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return)
+#ifdef __WIN32__
+SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),)
+#endif
+SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return)
+SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(int a, SDL_Rect *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_RenderGetIntegerScale,(SDL_Renderer *a),(a),return)
+SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return)
+SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceVendor,(int a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProduct,(int a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProductVersion,(int a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetVendor,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProduct,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProductVersion,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetVendor,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProduct,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProductVersion,(SDL_GameController *a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasNEON,(void),(),return)
+SDL_DYNAPI_PROC(int,SDL_GameControllerNumMappings,(void),(),return)
+SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForIndex,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),)
+SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return)
+SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),)
+SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),)
+SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return)
+SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_NewAudioStream,(const SDL_AudioFormat a, const Uint8 b, const int c, const SDL_AudioFormat d, const Uint8 e, const int f),(a,b,c,d,e,f),return)
+SDL_DYNAPI_PROC(int,SDL_AudioStreamPut,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_AudioStreamGet,(SDL_AudioStream *a, void *b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(void,SDL_AudioStreamClear,(SDL_AudioStream *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_AudioStreamAvailable,(SDL_AudioStream *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_FreeAudioStream,(SDL_AudioStream *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_AudioStreamFlush,(SDL_AudioStream *a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_asinf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_atanf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_atan2f,(float a, float b),(a,b),return)
+SDL_DYNAPI_PROC(float,SDL_ceilf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_copysignf,(float a, float b),(a,b),return)
+SDL_DYNAPI_PROC(float,SDL_fabsf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_floorf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_logf,(float a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_powf,(float a, float b),(a,b),return)
+SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return)
+SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return)
+SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),)
+SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return)
+SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return)
+SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalLayer,(SDL_Renderer *a),(a),return)
+SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalCommandEncoder,(SDL_Renderer *a),(a),return)
+#ifdef __WINRT__
+SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_WinRTGetDeviceFamily,(void),(),return)
+#endif
+#ifdef __ANDROID__
+SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return)
+#endif
+SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return)
+SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return)
diff --git a/src/3rdparty/SDL2/src/dynapi/gendynapi.pl b/src/3rdparty/SDL2/src/dynapi/gendynapi.pl
new file mode 100644
index 0000000..721241b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/dynapi/gendynapi.pl
@@ -0,0 +1,141 @@
+#!/usr/bin/perl -w
+
+# Simple DirectMedia Layer
+# Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+#
+# This software is provided 'as-is', without any express or implied
+# warranty. In no event will the authors be held liable for any damages
+# arising from the use of this software.
+#
+# Permission is granted to anyone to use this software for any purpose,
+# including commercial applications, and to alter it and redistribute it
+# freely, subject to the following restrictions:
+#
+# 1. The origin of this software must not be misrepresented; you must not
+# claim that you wrote the original software. If you use this software
+# in a product, an acknowledgment in the product documentation would be
+# appreciated but is not required.
+# 2. Altered source versions must be plainly marked as such, and must not be
+# misrepresented as being the original software.
+# 3. This notice may not be removed or altered from any source distribution.
+
+# WHAT IS THIS?
+# When you add a public API to SDL, please run this script, make sure the
+# output looks sane (hg diff, it adds to existing files), and commit it.
+# It keeps the dynamic API jump table operating correctly.
+
+# If you wanted this to be readable, you shouldn't have used perl.
+
+use warnings;
+use strict;
+use File::Basename;
+
+chdir(dirname(__FILE__) . '/../..');
+my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h";
+my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h";
+
+my %existing = ();
+if (-f $sdl_dynapi_procs_h) {
+ open(SDL_DYNAPI_PROCS_H, '<', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
+ while (<SDL_DYNAPI_PROCS_H>) {
+ if (/\ASDL_DYNAPI_PROC\(.*?,(.*?),/) {
+ $existing{$1} = 1;
+ }
+ }
+ close(SDL_DYNAPI_PROCS_H)
+}
+
+open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
+open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
+
+opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
+while (readdir(HEADERS)) {
+ next if not /\.h\Z/;
+ my $header = "include/$_";
+ open(HEADER, '<', $header) or die("Can't open $header: $!\n");
+ while (<HEADER>) {
+ chomp;
+ next if not /\A\s*extern\s+DECLSPEC/;
+ my $decl = "$_ ";
+ if (not $decl =~ /\)\s*;/) {
+ while (<HEADER>) {
+ chomp;
+ s/\A\s+//;
+ s/\s+\Z//;
+ $decl .= "$_ ";
+ last if /\)\s*;/;
+ }
+ }
+
+ $decl =~ s/\s+\Z//;
+ #print("DECL: [$decl]\n");
+
+ if ($decl =~ /\A\s*extern\s+DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) {
+ my $rc = "$1$2$3$4";
+ my $fn = $5;
+
+ next if $existing{$fn}; # already slotted into the jump table.
+
+ my @params = split(',', $6);
+
+ #print("rc == '$rc', fn == '$fn', params == '$params'\n");
+
+ my $retstr = ($rc eq 'void') ? '' : 'return';
+ my $paramstr = '(';
+ my $argstr = '(';
+ my $i = 0;
+ foreach (@params) {
+ my $str = $_;
+ $str =~ s/\A\s+//;
+ $str =~ s/\s+\Z//;
+ #print("1PARAM: $str\n");
+ if ($str eq 'void') {
+ $paramstr .= 'void';
+ } elsif ($str eq '...') {
+ if ($i > 0) {
+ $paramstr .= ', ';
+ }
+ $paramstr .= $str;
+ } elsif ($str =~ /\A\s*((const\s+|)(unsigned\s+|)([a-zA-Z0-9_]*)\s*([\*\s]*))\s*(.*?)\Z/) {
+ #print("PARSED: [$1], [$2], [$3], [$4], [$5]\n");
+ my $type = $1;
+ my $var = $6;
+ $type =~ s/\A\s+//;
+ $type =~ s/\s+\Z//;
+ $var =~ s/\A\s+//;
+ $var =~ s/\s+\Z//;
+ $type =~ s/\s*\*\Z/*/g;
+ $type =~ s/\s*(\*+)\Z/ $1/;
+ #print("SPLIT: ($type, $var)\n");
+ my $name = chr(ord('a') + $i);
+ if ($i > 0) {
+ $paramstr .= ', ';
+ $argstr .= ',';
+ }
+ my $spc = ($type =~ /\*\Z/) ? '' : ' ';
+ $paramstr .= "$type$spc$name";
+ $argstr .= "$name";
+ }
+ $i++;
+ }
+
+ $paramstr = '(void' if ($i == 0); # Just to make this consistent.
+
+ $paramstr .= ')';
+ $argstr .= ')';
+
+ print("NEW: $decl\n");
+ print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n";
+ print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n";
+ } else {
+ print("Failed to parse decl [$decl]!\n");
+ }
+ }
+ close(HEADER);
+}
+closedir(HEADERS);
+
+close(SDL_DYNAPI_PROCS_H);
+close(SDL_DYNAPI_OVERRIDES_H);
+
+# vi: set ts=4 sw=4 expandtab:
diff --git a/src/3rdparty/SDL2/src/events/SDL_clipboardevents.c b/src/3rdparty/SDL2/src/events/SDL_clipboardevents.c
new file mode 100644
index 0000000..5c45853
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_clipboardevents.c
@@ -0,0 +1,46 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Clipboard event handling code for SDL */
+
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "SDL_clipboardevents_c.h"
+
+
+int
+SDL_SendClipboardUpdate(void)
+{
+ int posted;
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = SDL_CLIPBOARDUPDATE;
+
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return (posted);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_clipboardevents_c.h b/src/3rdparty/SDL2/src/events/SDL_clipboardevents_c.h
new file mode 100644
index 0000000..24c450b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_clipboardevents_c.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_clipboardevents_c_h_
+#define SDL_clipboardevents_c_h_
+
+extern int SDL_SendClipboardUpdate(void);
+
+#endif /* SDL_clipboardevents_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_dropevents.c b/src/3rdparty/SDL2/src/events/SDL_dropevents.c
new file mode 100644
index 0000000..39c5120
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_dropevents.c
@@ -0,0 +1,98 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Drag and drop event handling code for SDL */
+
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "SDL_dropevents_c.h"
+
+#include "../video/SDL_sysvideo.h" /* for SDL_Window internals. */
+
+
+static int
+SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data)
+{
+ static SDL_bool app_is_dropping = SDL_FALSE;
+ int posted = 0;
+
+ /* Post the event, if desired */
+ if (SDL_GetEventState(evtype) == SDL_ENABLE) {
+ const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping;
+ SDL_Event event;
+
+ if (need_begin) {
+ SDL_zero(event);
+ event.type = SDL_DROPBEGIN;
+
+ if (window) {
+ event.drop.windowID = window->id;
+ }
+
+ posted = (SDL_PushEvent(&event) > 0);
+ if (!posted) {
+ return 0;
+ }
+ if (window) {
+ window->is_dropping = SDL_TRUE;
+ } else {
+ app_is_dropping = SDL_TRUE;
+ }
+ }
+
+ SDL_zero(event);
+ event.type = evtype;
+ event.drop.file = data ? SDL_strdup(data) : NULL;
+ event.drop.windowID = window ? window->id : 0;
+ posted = (SDL_PushEvent(&event) > 0);
+
+ if (posted && (evtype == SDL_DROPCOMPLETE)) {
+ if (window) {
+ window->is_dropping = SDL_FALSE;
+ } else {
+ app_is_dropping = SDL_FALSE;
+ }
+ }
+ }
+ return posted;
+}
+
+int
+SDL_SendDropFile(SDL_Window *window, const char *file)
+{
+ return SDL_SendDrop(window, SDL_DROPFILE, file);
+}
+
+int
+SDL_SendDropText(SDL_Window *window, const char *text)
+{
+ return SDL_SendDrop(window, SDL_DROPTEXT, text);
+}
+
+int
+SDL_SendDropComplete(SDL_Window *window)
+{
+ return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL);
+}
+
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_dropevents_c.h b/src/3rdparty/SDL2/src/events/SDL_dropevents_c.h
new file mode 100644
index 0000000..79f37cc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_dropevents_c.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_dropevents_c_h_
+#define SDL_dropevents_c_h_
+
+extern int SDL_SendDropFile(SDL_Window *window, const char *file);
+extern int SDL_SendDropText(SDL_Window *window, const char *text);
+extern int SDL_SendDropComplete(SDL_Window *window);
+
+#endif /* SDL_dropevents_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_events.c b/src/3rdparty/SDL2/src/events/SDL_events.c
new file mode 100644
index 0000000..f2e5b62
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_events.c
@@ -0,0 +1,955 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* General event handling code for SDL */
+
+#include "SDL.h"
+#include "SDL_events.h"
+#include "SDL_thread.h"
+#include "SDL_events_c.h"
+#include "../timer/SDL_timer_c.h"
+#if !SDL_JOYSTICK_DISABLED
+#include "../joystick/SDL_joystick_c.h"
+#endif
+#include "../video/SDL_sysvideo.h"
+#include "SDL_syswm.h"
+
+/*#define SDL_DEBUG_EVENTS 1*/
+
+/* An arbitrary limit so we don't have unbounded growth */
+#define SDL_MAX_QUEUED_EVENTS 65535
+
+typedef struct SDL_EventWatcher {
+ SDL_EventFilter callback;
+ void *userdata;
+ SDL_bool removed;
+} SDL_EventWatcher;
+
+static SDL_mutex *SDL_event_watchers_lock;
+static SDL_EventWatcher SDL_EventOK;
+static SDL_EventWatcher *SDL_event_watchers = NULL;
+static int SDL_event_watchers_count = 0;
+static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE;
+static SDL_bool SDL_event_watchers_removed = SDL_FALSE;
+
+typedef struct {
+ Uint32 bits[8];
+} SDL_DisabledEventBlock;
+
+static SDL_DisabledEventBlock *SDL_disabled_events[256];
+static Uint32 SDL_userevents = SDL_USEREVENT;
+
+/* Private data -- event queue */
+typedef struct _SDL_EventEntry
+{
+ SDL_Event event;
+ SDL_SysWMmsg msg;
+ struct _SDL_EventEntry *prev;
+ struct _SDL_EventEntry *next;
+} SDL_EventEntry;
+
+typedef struct _SDL_SysWMEntry
+{
+ SDL_SysWMmsg msg;
+ struct _SDL_SysWMEntry *next;
+} SDL_SysWMEntry;
+
+static struct
+{
+ SDL_mutex *lock;
+ SDL_atomic_t active;
+ SDL_atomic_t count;
+ int max_events_seen;
+ SDL_EventEntry *head;
+ SDL_EventEntry *tail;
+ SDL_EventEntry *free;
+ SDL_SysWMEntry *wmmsg_used;
+ SDL_SysWMEntry *wmmsg_free;
+} SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL };
+
+
+#ifdef SDL_DEBUG_EVENTS
+
+/* this is to make printf() calls cleaner. */
+#define uint unsigned int
+
+static void
+SDL_DebugPrintEvent(const SDL_Event *event)
+{
+ /* !!! FIXME: This code is kinda ugly, sorry. */
+ printf("SDL EVENT: ");
+
+ if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) {
+ printf("SDL_USEREVENT");
+ if (event->type > SDL_USEREVENT) {
+ printf("+%u", ((uint) event->type) - SDL_USEREVENT);
+ }
+ printf(" (timestamp=%u windowid=%u code=%d data1=%p data2=%p)",
+ (uint) event->user.timestamp, (uint) event->user.windowID,
+ (int) event->user.code, event->user.data1, event->user.data2);
+ return;
+ }
+
+ switch (event->type) {
+ #define SDL_EVENT_CASE(x) case x: printf("%s", #x);
+ SDL_EVENT_CASE(SDL_FIRSTEVENT) printf("(THIS IS PROBABLY A BUG!)"); break;
+ SDL_EVENT_CASE(SDL_QUIT) printf("(timestamp=%u)", (uint) event->quit.timestamp); break;
+ SDL_EVENT_CASE(SDL_APP_TERMINATING) break;
+ SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break;
+ SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break;
+ SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break;
+ SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break;
+ SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break;
+ SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break;
+ SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break;
+ SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break;
+ SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break;
+ #undef SDL_EVENT_CASE
+
+ #define SDL_EVENT_CASE(x) case x: printf("%s ", #x);
+
+ SDL_EVENT_CASE(SDL_WINDOWEVENT)
+ printf("(timestamp=%u windowid=%u event=", (uint) event->window.timestamp, (uint) event->window.windowID);
+ switch(event->window.event) {
+ case SDL_WINDOWEVENT_NONE: printf("none(THIS IS PROBABLY A BUG!)"); break;
+ #define SDL_WINDOWEVENT_CASE(x) case x: printf("%s", #x); break
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS);
+ SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST);
+ #undef SDL_WINDOWEVENT_CASE
+ default: printf("UNKNOWN(bug? fixme?)"); break;
+ }
+ printf(" data1=%d data2=%d)", (int) event->window.data1, (int) event->window.data2);
+ break;
+
+ SDL_EVENT_CASE(SDL_SYSWMEVENT)
+ printf("(timestamp=%u)", (uint) event->syswm.timestamp);
+ /* !!! FIXME: we don't delve further at the moment. */
+ break;
+
+ #define PRINT_KEY_EVENT(event) \
+ printf("(timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \
+ (uint) event->key.timestamp, (uint) event->key.windowID, \
+ event->key.state == SDL_PRESSED ? "pressed" : "released", \
+ event->key.repeat ? "true" : "false", \
+ (uint) event->key.keysym.scancode, \
+ (uint) event->key.keysym.sym, \
+ (uint) event->key.keysym.mod)
+ SDL_EVENT_CASE(SDL_KEYDOWN) PRINT_KEY_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_KEYUP) PRINT_KEY_EVENT(event); break;
+ #undef PRINT_KEY_EVENT
+
+ SDL_EVENT_CASE(SDL_TEXTEDITING)
+ printf("(timestamp=%u windowid=%u text='%s' start=%d length=%d)",
+ (uint) event->edit.timestamp, (uint) event->edit.windowID,
+ event->edit.text, (int) event->edit.start, (int) event->edit.length);
+ break;
+
+ SDL_EVENT_CASE(SDL_TEXTINPUT)
+ printf("(timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text);
+ break;
+
+
+ SDL_EVENT_CASE(SDL_MOUSEMOTION)
+ printf("(timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)",
+ (uint) event->motion.timestamp, (uint) event->motion.windowID,
+ (uint) event->motion.which, (uint) event->motion.state,
+ (int) event->motion.x, (int) event->motion.y,
+ (int) event->motion.xrel, (int) event->motion.yrel);
+ break;
+
+ #define PRINT_MBUTTON_EVENT(event) \
+ printf("(timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \
+ (uint) event->button.timestamp, (uint) event->button.windowID, \
+ (uint) event->button.which, (uint) event->button.button, \
+ event->button.state == SDL_PRESSED ? "pressed" : "released", \
+ (uint) event->button.clicks, (int) event->button.x, (int) event->button.y)
+ SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN) PRINT_MBUTTON_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_MOUSEBUTTONUP) PRINT_MBUTTON_EVENT(event); break;
+ #undef PRINT_MBUTTON_EVENT
+
+
+ SDL_EVENT_CASE(SDL_MOUSEWHEEL)
+ printf("(timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)",
+ (uint) event->wheel.timestamp, (uint) event->wheel.windowID,
+ (uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y,
+ event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped");
+ break;
+
+ SDL_EVENT_CASE(SDL_JOYAXISMOTION)
+ printf("(timestamp=%u which=%d axis=%u value=%d)",
+ (uint) event->jaxis.timestamp, (int) event->jaxis.which,
+ (uint) event->jaxis.axis, (int) event->jaxis.value);
+ break;
+
+ SDL_EVENT_CASE(SDL_JOYBALLMOTION)
+ printf("(timestamp=%u which=%d ball=%u xrel=%d yrel=%d)",
+ (uint) event->jball.timestamp, (int) event->jball.which,
+ (uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel);
+ break;
+
+ SDL_EVENT_CASE(SDL_JOYHATMOTION)
+ printf("(timestamp=%u which=%d hat=%u value=%u)",
+ (uint) event->jhat.timestamp, (int) event->jhat.which,
+ (uint) event->jhat.hat, (uint) event->jhat.value);
+ break;
+
+ #define PRINT_JBUTTON_EVENT(event) \
+ printf("(timestamp=%u which=%d button=%u state=%s)", \
+ (uint) event->jbutton.timestamp, (int) event->jbutton.which, \
+ (uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released")
+ SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break;
+ #undef PRINT_JBUTTON_EVENT
+
+ #define PRINT_JOYDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which)
+ SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break;
+ #undef PRINT_JOYDEV_EVENT
+
+ SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION)
+ printf("(timestamp=%u which=%d axis=%u value=%d)",
+ (uint) event->caxis.timestamp, (int) event->caxis.which,
+ (uint) event->caxis.axis, (int) event->caxis.value);
+ break;
+
+ #define PRINT_CBUTTON_EVENT(event) \
+ printf("(timestamp=%u which=%d button=%u state=%s)", \
+ (uint) event->cbutton.timestamp, (int) event->cbutton.which, \
+ (uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released")
+ SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break;
+ #undef PRINT_CBUTTON_EVENT
+
+ #define PRINT_CONTROLLERDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which)
+ SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break;
+ #undef PRINT_CONTROLLERDEV_EVENT
+
+ #define PRINT_FINGER_EVENT(event) \
+ printf("(timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \
+ (uint) event->tfinger.timestamp, (long long) event->tfinger.touchId, \
+ (long long) event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
+ event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
+ SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
+ #undef PRINT_FINGER_EVENT
+
+ #define PRINT_DOLLAR_EVENT(event) \
+ printf("(timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \
+ (uint) event->dgesture.timestamp, (long long) event->dgesture.touchId, \
+ (long long) event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
+ event->dgesture.error, event->dgesture.x, event->dgesture.y);
+ SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
+ #undef PRINT_DOLLAR_EVENT
+
+ SDL_EVENT_CASE(SDL_MULTIGESTURE)
+ printf("(timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)",
+ (uint) event->mgesture.timestamp, (long long) event->mgesture.touchId,
+ event->mgesture.dTheta, event->mgesture.dDist,
+ event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers);
+ break;
+
+ #define PRINT_DROP_EVENT(event) printf("(file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID)
+ SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break;
+ #undef PRINT_DROP_EVENT
+
+ #define PRINT_AUDIODEV_EVENT(event) printf("(timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false");
+ SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break;
+ SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break;
+ #undef PRINT_AUDIODEV_EVENT
+
+ #undef SDL_EVENT_CASE
+
+ default:
+ printf("UNKNOWN SDL EVENT #%u! (Bug? FIXME?)", (uint) event->type);
+ break;
+ }
+
+ printf("\n");
+}
+#undef uint
+#endif
+
+
+
+/* Public functions */
+
+void
+SDL_StopEventLoop(void)
+{
+ const char *report = SDL_GetHint("SDL_EVENT_QUEUE_STATISTICS");
+ int i;
+ SDL_EventEntry *entry;
+ SDL_SysWMEntry *wmmsg;
+
+ if (SDL_EventQ.lock) {
+ SDL_LockMutex(SDL_EventQ.lock);
+ }
+
+ SDL_AtomicSet(&SDL_EventQ.active, 0);
+
+ if (report && SDL_atoi(report)) {
+ SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n",
+ SDL_EventQ.max_events_seen);
+ }
+
+ /* Clean out EventQ */
+ for (entry = SDL_EventQ.head; entry; ) {
+ SDL_EventEntry *next = entry->next;
+ SDL_free(entry);
+ entry = next;
+ }
+ for (entry = SDL_EventQ.free; entry; ) {
+ SDL_EventEntry *next = entry->next;
+ SDL_free(entry);
+ entry = next;
+ }
+ for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; ) {
+ SDL_SysWMEntry *next = wmmsg->next;
+ SDL_free(wmmsg);
+ wmmsg = next;
+ }
+ for (wmmsg = SDL_EventQ.wmmsg_free; wmmsg; ) {
+ SDL_SysWMEntry *next = wmmsg->next;
+ SDL_free(wmmsg);
+ wmmsg = next;
+ }
+
+ SDL_AtomicSet(&SDL_EventQ.count, 0);
+ SDL_EventQ.max_events_seen = 0;
+ SDL_EventQ.head = NULL;
+ SDL_EventQ.tail = NULL;
+ SDL_EventQ.free = NULL;
+ SDL_EventQ.wmmsg_used = NULL;
+ SDL_EventQ.wmmsg_free = NULL;
+
+ /* Clear disabled event state */
+ for (i = 0; i < SDL_arraysize(SDL_disabled_events); ++i) {
+ SDL_free(SDL_disabled_events[i]);
+ SDL_disabled_events[i] = NULL;
+ }
+
+ if (SDL_event_watchers_lock) {
+ SDL_DestroyMutex(SDL_event_watchers_lock);
+ SDL_event_watchers_lock = NULL;
+ }
+ if (SDL_event_watchers) {
+ SDL_free(SDL_event_watchers);
+ SDL_event_watchers = NULL;
+ SDL_event_watchers_count = 0;
+ }
+ SDL_zero(SDL_EventOK);
+
+ if (SDL_EventQ.lock) {
+ SDL_UnlockMutex(SDL_EventQ.lock);
+ SDL_DestroyMutex(SDL_EventQ.lock);
+ SDL_EventQ.lock = NULL;
+ }
+}
+
+/* This function (and associated calls) may be called more than once */
+int
+SDL_StartEventLoop(void)
+{
+ /* We'll leave the event queue alone, since we might have gotten
+ some important events at launch (like SDL_DROPFILE)
+
+ FIXME: Does this introduce any other bugs with events at startup?
+ */
+
+ /* Create the lock and set ourselves active */
+#if !SDL_THREADS_DISABLED
+ if (!SDL_EventQ.lock) {
+ SDL_EventQ.lock = SDL_CreateMutex();
+ if (SDL_EventQ.lock == NULL) {
+ return -1;
+ }
+ }
+
+ if (!SDL_event_watchers_lock) {
+ SDL_event_watchers_lock = SDL_CreateMutex();
+ if (SDL_event_watchers_lock == NULL) {
+ return -1;
+ }
+ }
+#endif /* !SDL_THREADS_DISABLED */
+
+ /* Process most event types */
+ SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
+ SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
+ SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
+
+ SDL_AtomicSet(&SDL_EventQ.active, 1);
+
+ return 0;
+}
+
+
+/* Add an event to the event queue -- called with the queue locked */
+static int
+SDL_AddEvent(SDL_Event * event)
+{
+ SDL_EventEntry *entry;
+ const int initial_count = SDL_AtomicGet(&SDL_EventQ.count);
+ int final_count;
+
+ if (initial_count >= SDL_MAX_QUEUED_EVENTS) {
+ SDL_SetError("Event queue is full (%d events)", initial_count);
+ return 0;
+ }
+
+ if (SDL_EventQ.free == NULL) {
+ entry = (SDL_EventEntry *)SDL_malloc(sizeof(*entry));
+ if (!entry) {
+ return 0;
+ }
+ } else {
+ entry = SDL_EventQ.free;
+ SDL_EventQ.free = entry->next;
+ }
+
+ #ifdef SDL_DEBUG_EVENTS
+ SDL_DebugPrintEvent(event);
+ #endif
+
+ entry->event = *event;
+ if (event->type == SDL_SYSWMEVENT) {
+ entry->msg = *event->syswm.msg;
+ entry->event.syswm.msg = &entry->msg;
+ }
+
+ if (SDL_EventQ.tail) {
+ SDL_EventQ.tail->next = entry;
+ entry->prev = SDL_EventQ.tail;
+ SDL_EventQ.tail = entry;
+ entry->next = NULL;
+ } else {
+ SDL_assert(!SDL_EventQ.head);
+ SDL_EventQ.head = entry;
+ SDL_EventQ.tail = entry;
+ entry->prev = NULL;
+ entry->next = NULL;
+ }
+
+ final_count = SDL_AtomicAdd(&SDL_EventQ.count, 1) + 1;
+ if (final_count > SDL_EventQ.max_events_seen) {
+ SDL_EventQ.max_events_seen = final_count;
+ }
+
+ return 1;
+}
+
+/* Remove an event from the queue -- called with the queue locked */
+static void
+SDL_CutEvent(SDL_EventEntry *entry)
+{
+ if (entry->prev) {
+ entry->prev->next = entry->next;
+ }
+ if (entry->next) {
+ entry->next->prev = entry->prev;
+ }
+
+ if (entry == SDL_EventQ.head) {
+ SDL_assert(entry->prev == NULL);
+ SDL_EventQ.head = entry->next;
+ }
+ if (entry == SDL_EventQ.tail) {
+ SDL_assert(entry->next == NULL);
+ SDL_EventQ.tail = entry->prev;
+ }
+
+ entry->next = SDL_EventQ.free;
+ SDL_EventQ.free = entry;
+ SDL_assert(SDL_AtomicGet(&SDL_EventQ.count) > 0);
+ SDL_AtomicAdd(&SDL_EventQ.count, -1);
+}
+
+/* Lock the event queue, take a peep at it, and unlock it */
+int
+SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
+ Uint32 minType, Uint32 maxType)
+{
+ int i, used;
+
+ /* Don't look after we've quit */
+ if (!SDL_AtomicGet(&SDL_EventQ.active)) {
+ /* We get a few spurious events at shutdown, so don't warn then */
+ if (action != SDL_ADDEVENT) {
+ SDL_SetError("The event system has been shut down");
+ }
+ return (-1);
+ }
+ /* Lock the event queue */
+ used = 0;
+ if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) {
+ if (action == SDL_ADDEVENT) {
+ for (i = 0; i < numevents; ++i) {
+ used += SDL_AddEvent(&events[i]);
+ }
+ } else {
+ SDL_EventEntry *entry, *next;
+ SDL_SysWMEntry *wmmsg, *wmmsg_next;
+ Uint32 type;
+
+ if (action == SDL_GETEVENT) {
+ /* Clean out any used wmmsg data
+ FIXME: Do we want to retain the data for some period of time?
+ */
+ for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) {
+ wmmsg_next = wmmsg->next;
+ wmmsg->next = SDL_EventQ.wmmsg_free;
+ SDL_EventQ.wmmsg_free = wmmsg;
+ }
+ SDL_EventQ.wmmsg_used = NULL;
+ }
+
+ for (entry = SDL_EventQ.head; entry && (!events || used < numevents); entry = next) {
+ next = entry->next;
+ type = entry->event.type;
+ if (minType <= type && type <= maxType) {
+ if (events) {
+ events[used] = entry->event;
+ if (entry->event.type == SDL_SYSWMEVENT) {
+ /* We need to copy the wmmsg somewhere safe.
+ For now we'll guarantee it's valid at least until
+ the next call to SDL_PeepEvents()
+ */
+ if (SDL_EventQ.wmmsg_free) {
+ wmmsg = SDL_EventQ.wmmsg_free;
+ SDL_EventQ.wmmsg_free = wmmsg->next;
+ } else {
+ wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg));
+ }
+ wmmsg->msg = *entry->event.syswm.msg;
+ wmmsg->next = SDL_EventQ.wmmsg_used;
+ SDL_EventQ.wmmsg_used = wmmsg;
+ events[used].syswm.msg = &wmmsg->msg;
+ }
+
+ if (action == SDL_GETEVENT) {
+ SDL_CutEvent(entry);
+ }
+ }
+ ++used;
+ }
+ }
+ }
+ if (SDL_EventQ.lock) {
+ SDL_UnlockMutex(SDL_EventQ.lock);
+ }
+ } else {
+ return SDL_SetError("Couldn't lock event queue");
+ }
+ return (used);
+}
+
+SDL_bool
+SDL_HasEvent(Uint32 type)
+{
+ return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0);
+}
+
+SDL_bool
+SDL_HasEvents(Uint32 minType, Uint32 maxType)
+{
+ return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0);
+}
+
+void
+SDL_FlushEvent(Uint32 type)
+{
+ SDL_FlushEvents(type, type);
+}
+
+void
+SDL_FlushEvents(Uint32 minType, Uint32 maxType)
+{
+ /* Don't look after we've quit */
+ if (!SDL_AtomicGet(&SDL_EventQ.active)) {
+ return;
+ }
+
+ /* Make sure the events are current */
+#if 0
+ /* Actually, we can't do this since we might be flushing while processing
+ a resize event, and calling this might trigger further resize events.
+ */
+ SDL_PumpEvents();
+#endif
+
+ /* Lock the event queue */
+ if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) {
+ SDL_EventEntry *entry, *next;
+ Uint32 type;
+ for (entry = SDL_EventQ.head; entry; entry = next) {
+ next = entry->next;
+ type = entry->event.type;
+ if (minType <= type && type <= maxType) {
+ SDL_CutEvent(entry);
+ }
+ }
+ if (SDL_EventQ.lock) {
+ SDL_UnlockMutex(SDL_EventQ.lock);
+ }
+ }
+}
+
+/* Run the system dependent event loops */
+void
+SDL_PumpEvents(void)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ /* Get events from the video subsystem */
+ if (_this) {
+ _this->PumpEvents(_this);
+ }
+#if !SDL_JOYSTICK_DISABLED
+ /* Check for joystick state change */
+ if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) {
+ SDL_JoystickUpdate();
+ }
+#endif
+
+ SDL_SendPendingQuit(); /* in case we had a signal handler fire, etc. */
+}
+
+/* Public functions */
+
+int
+SDL_PollEvent(SDL_Event * event)
+{
+ return SDL_WaitEventTimeout(event, 0);
+}
+
+int
+SDL_WaitEvent(SDL_Event * event)
+{
+ return SDL_WaitEventTimeout(event, -1);
+}
+
+int
+SDL_WaitEventTimeout(SDL_Event * event, int timeout)
+{
+ Uint32 expiration = 0;
+
+ if (timeout > 0)
+ expiration = SDL_GetTicks() + timeout;
+
+ for (;;) {
+ SDL_PumpEvents();
+ switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
+ case -1:
+ return 0;
+ case 0:
+ if (timeout == 0) {
+ /* Polling and no events, just return */
+ return 0;
+ }
+ if (timeout > 0 && SDL_TICKS_PASSED(SDL_GetTicks(), expiration)) {
+ /* Timeout expired and no events */
+ return 0;
+ }
+ SDL_Delay(10);
+ break;
+ default:
+ /* Has events */
+ return 1;
+ }
+ }
+}
+
+int
+SDL_PushEvent(SDL_Event * event)
+{
+ event->common.timestamp = SDL_GetTicks();
+
+ if (SDL_EventOK.callback || SDL_event_watchers_count > 0) {
+ if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) {
+ if (SDL_event_watchers_lock) {
+ SDL_UnlockMutex(SDL_event_watchers_lock);
+ }
+ return 0;
+ }
+
+ if (SDL_event_watchers_count > 0) {
+ /* Make sure we only dispatch the current watcher list */
+ int i, event_watchers_count = SDL_event_watchers_count;
+
+ SDL_event_watchers_dispatching = SDL_TRUE;
+ for (i = 0; i < event_watchers_count; ++i) {
+ if (!SDL_event_watchers[i].removed) {
+ SDL_event_watchers[i].callback(SDL_event_watchers[i].userdata, event);
+ }
+ }
+ SDL_event_watchers_dispatching = SDL_FALSE;
+
+ if (SDL_event_watchers_removed) {
+ for (i = SDL_event_watchers_count; i--; ) {
+ if (SDL_event_watchers[i].removed) {
+ --SDL_event_watchers_count;
+ if (i < SDL_event_watchers_count) {
+ SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
+ }
+ }
+ }
+ SDL_event_watchers_removed = SDL_FALSE;
+ }
+ }
+
+ if (SDL_event_watchers_lock) {
+ SDL_UnlockMutex(SDL_event_watchers_lock);
+ }
+ }
+ }
+
+ if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) {
+ return -1;
+ }
+
+ SDL_GestureProcessEvent(event);
+
+ return 1;
+}
+
+void
+SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
+{
+ if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ /* Set filter and discard pending events */
+ SDL_EventOK.callback = filter;
+ SDL_EventOK.userdata = userdata;
+ SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
+
+ if (SDL_event_watchers_lock) {
+ SDL_UnlockMutex(SDL_event_watchers_lock);
+ }
+ }
+}
+
+SDL_bool
+SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)
+{
+ SDL_EventWatcher event_ok;
+
+ if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ event_ok = SDL_EventOK;
+
+ if (SDL_event_watchers_lock) {
+ SDL_UnlockMutex(SDL_event_watchers_lock);
+ }
+ } else {
+ SDL_zero(event_ok);
+ }
+
+ if (filter) {
+ *filter = event_ok.callback;
+ }
+ if (userdata) {
+ *userdata = event_ok.userdata;
+ }
+ return event_ok.callback ? SDL_TRUE : SDL_FALSE;
+}
+
+void
+SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
+{
+ if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ SDL_EventWatcher *event_watchers;
+
+ event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers));
+ if (event_watchers) {
+ SDL_EventWatcher *watcher;
+
+ SDL_event_watchers = event_watchers;
+ watcher = &SDL_event_watchers[SDL_event_watchers_count];
+ watcher->callback = filter;
+ watcher->userdata = userdata;
+ watcher->removed = SDL_FALSE;
+ ++SDL_event_watchers_count;
+ }
+
+ if (SDL_event_watchers_lock) {
+ SDL_UnlockMutex(SDL_event_watchers_lock);
+ }
+ }
+}
+
+void
+SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
+{
+ if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
+ int i;
+
+ for (i = 0; i < SDL_event_watchers_count; ++i) {
+ if (SDL_event_watchers[i].callback == filter && SDL_event_watchers[i].userdata == userdata) {
+ if (SDL_event_watchers_dispatching) {
+ SDL_event_watchers[i].removed = SDL_TRUE;
+ SDL_event_watchers_removed = SDL_TRUE;
+ } else {
+ --SDL_event_watchers_count;
+ if (i < SDL_event_watchers_count) {
+ SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
+ }
+ }
+ break;
+ }
+ }
+
+ if (SDL_event_watchers_lock) {
+ SDL_UnlockMutex(SDL_event_watchers_lock);
+ }
+ }
+}
+
+void
+SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
+{
+ if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) {
+ SDL_EventEntry *entry, *next;
+ for (entry = SDL_EventQ.head; entry; entry = next) {
+ next = entry->next;
+ if (!filter(userdata, &entry->event)) {
+ SDL_CutEvent(entry);
+ }
+ }
+ if (SDL_EventQ.lock) {
+ SDL_UnlockMutex(SDL_EventQ.lock);
+ }
+ }
+}
+
+Uint8
+SDL_EventState(Uint32 type, int state)
+{
+ Uint8 current_state;
+ Uint8 hi = ((type >> 8) & 0xff);
+ Uint8 lo = (type & 0xff);
+
+ if (SDL_disabled_events[hi] &&
+ (SDL_disabled_events[hi]->bits[lo/32] & (1 << (lo&31)))) {
+ current_state = SDL_DISABLE;
+ } else {
+ current_state = SDL_ENABLE;
+ }
+
+ if (state != current_state)
+ {
+ switch (state) {
+ case SDL_DISABLE:
+ /* Disable this event type and discard pending events */
+ if (!SDL_disabled_events[hi]) {
+ SDL_disabled_events[hi] = (SDL_DisabledEventBlock*) SDL_calloc(1, sizeof(SDL_DisabledEventBlock));
+ if (!SDL_disabled_events[hi]) {
+ /* Out of memory, nothing we can do... */
+ break;
+ }
+ }
+ SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31));
+ SDL_FlushEvent(type);
+ break;
+ case SDL_ENABLE:
+ SDL_disabled_events[hi]->bits[lo/32] &= ~(1 << (lo&31));
+ break;
+ default:
+ /* Querying state... */
+ break;
+ }
+ }
+
+ return current_state;
+}
+
+Uint32
+SDL_RegisterEvents(int numevents)
+{
+ Uint32 event_base;
+
+ if ((numevents > 0) && (SDL_userevents+numevents <= SDL_LASTEVENT)) {
+ event_base = SDL_userevents;
+ SDL_userevents += numevents;
+ } else {
+ event_base = (Uint32)-1;
+ }
+ return event_base;
+}
+
+int
+SDL_SendAppEvent(SDL_EventType eventType)
+{
+ int posted;
+
+ posted = 0;
+ if (SDL_GetEventState(eventType) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = eventType;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return (posted);
+}
+
+int
+SDL_SendSysWMEvent(SDL_SysWMmsg * message)
+{
+ int posted;
+
+ posted = 0;
+ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
+ SDL_Event event;
+ SDL_memset(&event, 0, sizeof(event));
+ event.type = SDL_SYSWMEVENT;
+ event.syswm.msg = message;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ /* Update internal event state */
+ return (posted);
+}
+
+int
+SDL_SendKeymapChangedEvent(void)
+{
+ return SDL_SendAppEvent(SDL_KEYMAPCHANGED);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_events_c.h b/src/3rdparty/SDL2/src/events/SDL_events_c.h
new file mode 100644
index 0000000..b1bd277
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_events_c.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Useful functions and variables from SDL_events.c */
+#include "SDL_events.h"
+#include "SDL_thread.h"
+#include "SDL_clipboardevents_c.h"
+#include "SDL_dropevents_c.h"
+#include "SDL_gesture_c.h"
+#include "SDL_keyboard_c.h"
+#include "SDL_mouse_c.h"
+#include "SDL_touch_c.h"
+#include "SDL_windowevents_c.h"
+
+/* Start and stop the event processing loop */
+extern int SDL_StartEventLoop(void);
+extern void SDL_StopEventLoop(void);
+extern void SDL_QuitInterrupt(void);
+
+extern int SDL_SendAppEvent(SDL_EventType eventType);
+extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
+extern int SDL_SendKeymapChangedEvent(void);
+
+extern int SDL_QuitInit(void);
+extern int SDL_SendQuit(void);
+extern void SDL_QuitQuit(void);
+
+extern void SDL_SendPendingQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_gesture.c b/src/3rdparty/SDL2/src/events/SDL_gesture.c
new file mode 100644
index 0000000..c3b73e0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_gesture.c
@@ -0,0 +1,700 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../SDL_internal.h"
+
+/* General gesture handling code for SDL */
+
+#include "SDL_events.h"
+#include "SDL_endian.h"
+#include "SDL_events_c.h"
+#include "SDL_gesture_c.h"
+
+/*
+#include <stdio.h>
+*/
+
+/* TODO: Replace with malloc */
+
+#define MAXPATHSIZE 1024
+
+#define DOLLARNPOINTS 64
+#define DOLLARSIZE 256
+
+#define ENABLE_DOLLAR
+
+#define PHI 0.618033989
+
+typedef struct {
+ float x,y;
+} SDL_FloatPoint;
+
+typedef struct {
+ float length;
+
+ int numPoints;
+ SDL_FloatPoint p[MAXPATHSIZE];
+} SDL_DollarPath;
+
+typedef struct {
+ SDL_FloatPoint path[DOLLARNPOINTS];
+ unsigned long hash;
+} SDL_DollarTemplate;
+
+typedef struct {
+ SDL_TouchID id;
+ SDL_FloatPoint centroid;
+ SDL_DollarPath dollarPath;
+ Uint16 numDownFingers;
+
+ int numDollarTemplates;
+ SDL_DollarTemplate *dollarTemplate;
+
+ SDL_bool recording;
+} SDL_GestureTouch;
+
+static SDL_GestureTouch *SDL_gestureTouch;
+static int SDL_numGestureTouches = 0;
+static SDL_bool recordAll;
+
+#if 0
+static void PrintPath(SDL_FloatPoint *path)
+{
+ int i;
+ printf("Path:");
+ for (i=0; i<DOLLARNPOINTS; i++) {
+ printf(" (%f,%f)",path[i].x,path[i].y);
+ }
+ printf("\n");
+}
+#endif
+
+int SDL_RecordGesture(SDL_TouchID touchId)
+{
+ int i;
+ if (touchId < 0) recordAll = SDL_TRUE;
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ if ((touchId < 0) || (SDL_gestureTouch[i].id == touchId)) {
+ SDL_gestureTouch[i].recording = SDL_TRUE;
+ if (touchId >= 0)
+ return 1;
+ }
+ }
+ return (touchId < 0);
+}
+
+void SDL_GestureQuit()
+{
+ SDL_free(SDL_gestureTouch);
+ SDL_gestureTouch = NULL;
+}
+
+static unsigned long SDL_HashDollar(SDL_FloatPoint* points)
+{
+ unsigned long hash = 5381;
+ int i;
+ for (i = 0; i < DOLLARNPOINTS; i++) {
+ hash = ((hash<<5) + hash) + (unsigned long)points[i].x;
+ hash = ((hash<<5) + hash) + (unsigned long)points[i].y;
+ }
+ return hash;
+}
+
+
+static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst)
+{
+ if (dst == NULL) {
+ return 0;
+ }
+
+ /* No Longer storing the Hash, rehash on load */
+ /* if (SDL_RWops.write(dst, &(templ->hash), sizeof(templ->hash), 1) != 1) return 0; */
+
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ if (SDL_RWwrite(dst, templ->path,
+ sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) {
+ return 0;
+ }
+#else
+ {
+ SDL_DollarTemplate copy = *templ;
+ SDL_FloatPoint *p = copy.path;
+ int i;
+ for (i = 0; i < DOLLARNPOINTS; i++, p++) {
+ p->x = SDL_SwapFloatLE(p->x);
+ p->y = SDL_SwapFloatLE(p->y);
+ }
+
+ if (SDL_RWwrite(dst, copy.path,
+ sizeof(copy.path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) {
+ return 0;
+ }
+ }
+#endif
+
+ return 1;
+}
+
+
+int SDL_SaveAllDollarTemplates(SDL_RWops *dst)
+{
+ int i,j,rtrn = 0;
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ SDL_GestureTouch* touch = &SDL_gestureTouch[i];
+ for (j = 0; j < touch->numDollarTemplates; j++) {
+ rtrn += SaveTemplate(&touch->dollarTemplate[j], dst);
+ }
+ }
+ return rtrn;
+}
+
+int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst)
+{
+ int i,j;
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ SDL_GestureTouch* touch = &SDL_gestureTouch[i];
+ for (j = 0; j < touch->numDollarTemplates; j++) {
+ if (touch->dollarTemplate[j].hash == gestureId) {
+ return SaveTemplate(&touch->dollarTemplate[j], dst);
+ }
+ }
+ }
+ return SDL_SetError("Unknown gestureId");
+}
+
+/* path is an already sampled set of points
+Returns the index of the gesture on success, or -1 */
+static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
+{
+ SDL_DollarTemplate* dollarTemplate;
+ SDL_DollarTemplate *templ;
+ int index;
+
+ index = inTouch->numDollarTemplates;
+ dollarTemplate =
+ (SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
+ (index + 1) *
+ sizeof(SDL_DollarTemplate));
+ if (!dollarTemplate) {
+ return SDL_OutOfMemory();
+ }
+ inTouch->dollarTemplate = dollarTemplate;
+
+ templ = &inTouch->dollarTemplate[index];
+ SDL_memcpy(templ->path, path, DOLLARNPOINTS*sizeof(SDL_FloatPoint));
+ templ->hash = SDL_HashDollar(templ->path);
+ inTouch->numDollarTemplates++;
+
+ return index;
+}
+
+static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
+{
+ int index = -1;
+ int i = 0;
+ if (inTouch == NULL) {
+ if (SDL_numGestureTouches == 0) return SDL_SetError("no gesture touch devices registered");
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ inTouch = &SDL_gestureTouch[i];
+ index = SDL_AddDollarGesture_one(inTouch, path);
+ if (index < 0)
+ return -1;
+ }
+ /* Use the index of the last one added. */
+ return index;
+ }
+ return SDL_AddDollarGesture_one(inTouch, path);
+}
+
+int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
+{
+ int i,loaded = 0;
+ SDL_GestureTouch *touch = NULL;
+ if (src == NULL) return 0;
+ if (touchId >= 0) {
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ if (SDL_gestureTouch[i].id == touchId) {
+ touch = &SDL_gestureTouch[i];
+ }
+ }
+ if (touch == NULL) {
+ return SDL_SetError("given touch id not found");
+ }
+ }
+
+ while (1) {
+ SDL_DollarTemplate templ;
+
+ if (SDL_RWread(src,templ.path,sizeof(templ.path[0]),DOLLARNPOINTS) < DOLLARNPOINTS) {
+ if (loaded == 0) {
+ return SDL_SetError("could not read any dollar gesture from rwops");
+ }
+ break;
+ }
+
+#if SDL_BYTEORDER != SDL_LIL_ENDIAN
+ for (i = 0; i < DOLLARNPOINTS; i++) {
+ SDL_FloatPoint *p = &templ.path[i];
+ p->x = SDL_SwapFloatLE(p->x);
+ p->y = SDL_SwapFloatLE(p->y);
+ }
+#endif
+
+ if (touchId >= 0) {
+ /* printf("Adding loaded gesture to 1 touch\n"); */
+ if (SDL_AddDollarGesture(touch, templ.path) >= 0)
+ loaded++;
+ }
+ else {
+ /* printf("Adding to: %i touches\n",SDL_numGestureTouches); */
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ touch = &SDL_gestureTouch[i];
+ /* printf("Adding loaded gesture to + touches\n"); */
+ /* TODO: What if this fails? */
+ SDL_AddDollarGesture(touch,templ.path);
+ }
+ loaded++;
+ }
+ }
+
+ return loaded;
+}
+
+
+static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang)
+{
+ /* SDL_FloatPoint p[DOLLARNPOINTS]; */
+ float dist = 0;
+ SDL_FloatPoint p;
+ int i;
+ for (i = 0; i < DOLLARNPOINTS; i++) {
+ p.x = (float)(points[i].x * SDL_cos(ang) - points[i].y * SDL_sin(ang));
+ p.y = (float)(points[i].x * SDL_sin(ang) + points[i].y * SDL_cos(ang));
+ dist += (float)(SDL_sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
+ (p.y-templ[i].y)*(p.y-templ[i].y)));
+ }
+ return dist/DOLLARNPOINTS;
+
+}
+
+static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
+{
+ /*------------BEGIN DOLLAR BLACKBOX------------------
+ -TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-
+ -"http://depts.washington.edu/aimgroup/proj/dollar/"
+ */
+ double ta = -M_PI/4;
+ double tb = M_PI/4;
+ double dt = M_PI/90;
+ float x1 = (float)(PHI*ta + (1-PHI)*tb);
+ float f1 = dollarDifference(points,templ,x1);
+ float x2 = (float)((1-PHI)*ta + PHI*tb);
+ float f2 = dollarDifference(points,templ,x2);
+ while (SDL_fabs(ta-tb) > dt) {
+ if (f1 < f2) {
+ tb = x2;
+ x2 = x1;
+ f2 = f1;
+ x1 = (float)(PHI*ta + (1-PHI)*tb);
+ f1 = dollarDifference(points,templ,x1);
+ }
+ else {
+ ta = x1;
+ x1 = x2;
+ f1 = f2;
+ x2 = (float)((1-PHI)*ta + PHI*tb);
+ f2 = dollarDifference(points,templ,x2);
+ }
+ }
+ /*
+ if (f1 <= f2)
+ printf("Min angle (x1): %f\n",x1);
+ else if (f1 > f2)
+ printf("Min angle (x2): %f\n",x2);
+ */
+ return SDL_min(f1,f2);
+}
+
+/* DollarPath contains raw points, plus (possibly) the calculated length */
+static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
+{
+ int i;
+ float interval;
+ float dist;
+ int numPoints = 0;
+ SDL_FloatPoint centroid;
+ float xmin,xmax,ymin,ymax;
+ float ang;
+ float w,h;
+ float length = path->length;
+
+ /* Calculate length if it hasn't already been done */
+ if (length <= 0) {
+ for (i=1;i < path->numPoints; i++) {
+ float dx = path->p[i ].x - path->p[i-1].x;
+ float dy = path->p[i ].y - path->p[i-1].y;
+ length += (float)(SDL_sqrt(dx*dx+dy*dy));
+ }
+ }
+
+ /* Resample */
+ interval = length/(DOLLARNPOINTS - 1);
+ dist = interval;
+
+ centroid.x = 0;centroid.y = 0;
+
+ /* printf("(%f,%f)\n",path->p[path->numPoints-1].x,path->p[path->numPoints-1].y); */
+ for (i = 1; i < path->numPoints; i++) {
+ float d = (float)(SDL_sqrt((path->p[i-1].x-path->p[i].x)*(path->p[i-1].x-path->p[i].x)+
+ (path->p[i-1].y-path->p[i].y)*(path->p[i-1].y-path->p[i].y)));
+ /* printf("d = %f dist = %f/%f\n",d,dist,interval); */
+ while (dist + d > interval) {
+ points[numPoints].x = path->p[i-1].x +
+ ((interval-dist)/d)*(path->p[i].x-path->p[i-1].x);
+ points[numPoints].y = path->p[i-1].y +
+ ((interval-dist)/d)*(path->p[i].y-path->p[i-1].y);
+ centroid.x += points[numPoints].x;
+ centroid.y += points[numPoints].y;
+ numPoints++;
+
+ dist -= interval;
+ }
+ dist += d;
+ }
+ if (numPoints < DOLLARNPOINTS-1) {
+ SDL_SetError("ERROR: NumPoints = %i", numPoints);
+ return 0;
+ }
+ /* copy the last point */
+ points[DOLLARNPOINTS-1] = path->p[path->numPoints-1];
+ numPoints = DOLLARNPOINTS;
+
+ centroid.x /= numPoints;
+ centroid.y /= numPoints;
+
+ /* printf("Centroid (%f,%f)",centroid.x,centroid.y); */
+ /* Rotate Points so point 0 is left of centroid and solve for the bounding box */
+ xmin = centroid.x;
+ xmax = centroid.x;
+ ymin = centroid.y;
+ ymax = centroid.y;
+
+ ang = (float)(SDL_atan2(centroid.y - points[0].y,
+ centroid.x - points[0].x));
+
+ for (i = 0; i<numPoints; i++) {
+ float px = points[i].x;
+ float py = points[i].y;
+ points[i].x = (float)((px - centroid.x)*SDL_cos(ang) -
+ (py - centroid.y)*SDL_sin(ang) + centroid.x);
+ points[i].y = (float)((px - centroid.x)*SDL_sin(ang) +
+ (py - centroid.y)*SDL_cos(ang) + centroid.y);
+
+
+ if (points[i].x < xmin) xmin = points[i].x;
+ if (points[i].x > xmax) xmax = points[i].x;
+ if (points[i].y < ymin) ymin = points[i].y;
+ if (points[i].y > ymax) ymax = points[i].y;
+ }
+
+ /* Scale points to DOLLARSIZE, and translate to the origin */
+ w = xmax-xmin;
+ h = ymax-ymin;
+
+ for (i=0; i<numPoints; i++) {
+ points[i].x = (points[i].x - centroid.x)*DOLLARSIZE/w;
+ points[i].y = (points[i].y - centroid.y)*DOLLARSIZE/h;
+ }
+ return numPoints;
+}
+
+static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch)
+{
+ SDL_FloatPoint points[DOLLARNPOINTS];
+ int i;
+ float bestDiff = 10000;
+
+ SDL_memset(points, 0, sizeof(points));
+
+ dollarNormalize(path,points);
+
+ /* PrintPath(points); */
+ *bestTempl = -1;
+ for (i = 0; i < touch->numDollarTemplates; i++) {
+ float diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
+ if (diff < bestDiff) {bestDiff = diff; *bestTempl = i;}
+ }
+ return bestDiff;
+}
+
+int SDL_GestureAddTouch(SDL_TouchID touchId)
+{
+ SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
+ (SDL_numGestureTouches + 1) *
+ sizeof(SDL_GestureTouch));
+
+ if (!gestureTouch) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_gestureTouch = gestureTouch;
+
+ SDL_zero(SDL_gestureTouch[SDL_numGestureTouches]);
+ SDL_gestureTouch[SDL_numGestureTouches].id = touchId;
+ SDL_numGestureTouches++;
+ return 0;
+}
+
+int SDL_GestureDelTouch(SDL_TouchID touchId)
+{
+ int i;
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ if (SDL_gestureTouch[i].id == touchId) {
+ break;
+ }
+ }
+
+ if (i == SDL_numGestureTouches) {
+ /* not found */
+ return -1;
+ }
+
+ SDL_free(SDL_gestureTouch[i].dollarTemplate);
+ SDL_zero(SDL_gestureTouch[i]);
+
+ SDL_numGestureTouches--;
+ SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i]));
+ return 0;
+}
+
+static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
+{
+ int i;
+ for (i = 0; i < SDL_numGestureTouches; i++) {
+ /* printf("%i ?= %i\n",SDL_gestureTouch[i].id,id); */
+ if (SDL_gestureTouch[i].id == id)
+ return &SDL_gestureTouch[i];
+ }
+ return NULL;
+}
+
+static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
+{
+ SDL_Event event;
+ event.mgesture.type = SDL_MULTIGESTURE;
+ event.mgesture.touchId = touch->id;
+ event.mgesture.x = touch->centroid.x;
+ event.mgesture.y = touch->centroid.y;
+ event.mgesture.dTheta = dTheta;
+ event.mgesture.dDist = dDist;
+ event.mgesture.numFingers = touch->numDownFingers;
+ return SDL_PushEvent(&event) > 0;
+}
+
+static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
+ SDL_GestureID gestureId,float error)
+{
+ SDL_Event event;
+ event.dgesture.type = SDL_DOLLARGESTURE;
+ event.dgesture.touchId = touch->id;
+ event.dgesture.x = touch->centroid.x;
+ event.dgesture.y = touch->centroid.y;
+ event.dgesture.gestureId = gestureId;
+ event.dgesture.error = error;
+ /* A finger came up to trigger this event. */
+ event.dgesture.numFingers = touch->numDownFingers + 1;
+ return SDL_PushEvent(&event) > 0;
+}
+
+
+static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
+{
+ SDL_Event event;
+ event.dgesture.type = SDL_DOLLARRECORD;
+ event.dgesture.touchId = touch->id;
+ event.dgesture.gestureId = gestureId;
+ return SDL_PushEvent(&event) > 0;
+}
+
+
+void SDL_GestureProcessEvent(SDL_Event* event)
+{
+ float x,y;
+ int index;
+ int i;
+ float pathDx, pathDy;
+ SDL_FloatPoint lastP;
+ SDL_FloatPoint lastCentroid;
+ float lDist;
+ float Dist;
+ float dtheta;
+ float dDist;
+
+ if (event->type == SDL_FINGERMOTION ||
+ event->type == SDL_FINGERDOWN ||
+ event->type == SDL_FINGERUP) {
+ SDL_GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
+
+ /* Shouldn't be possible */
+ if (inTouch == NULL) return;
+
+ x = event->tfinger.x;
+ y = event->tfinger.y;
+
+ /* Finger Up */
+ if (event->type == SDL_FINGERUP) {
+ SDL_FloatPoint path[DOLLARNPOINTS];
+
+ inTouch->numDownFingers--;
+
+#ifdef ENABLE_DOLLAR
+ if (inTouch->recording) {
+ inTouch->recording = SDL_FALSE;
+ dollarNormalize(&inTouch->dollarPath,path);
+ /* PrintPath(path); */
+ if (recordAll) {
+ index = SDL_AddDollarGesture(NULL,path);
+ for (i = 0; i < SDL_numGestureTouches; i++)
+ SDL_gestureTouch[i].recording = SDL_FALSE;
+ }
+ else {
+ index = SDL_AddDollarGesture(inTouch,path);
+ }
+
+ if (index >= 0) {
+ SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash);
+ }
+ else {
+ SDL_SendDollarRecord(inTouch,-1);
+ }
+ }
+ else {
+ int bestTempl;
+ float error;
+ error = dollarRecognize(&inTouch->dollarPath,
+ &bestTempl,inTouch);
+ if (bestTempl >= 0){
+ /* Send Event */
+ unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
+ SDL_SendGestureDollar(inTouch,gestureId,error);
+ /* printf ("%s\n",);("Dollar error: %f\n",error); */
+ }
+ }
+#endif
+ /* inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers]; */
+ if (inTouch->numDownFingers > 0) {
+ inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers+1)-
+ x)/inTouch->numDownFingers;
+ inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers+1)-
+ y)/inTouch->numDownFingers;
+ }
+ }
+ else if (event->type == SDL_FINGERMOTION) {
+ float dx = event->tfinger.dx;
+ float dy = event->tfinger.dy;
+#ifdef ENABLE_DOLLAR
+ SDL_DollarPath* path = &inTouch->dollarPath;
+ if (path->numPoints < MAXPATHSIZE) {
+ path->p[path->numPoints].x = inTouch->centroid.x;
+ path->p[path->numPoints].y = inTouch->centroid.y;
+ pathDx =
+ (path->p[path->numPoints].x-path->p[path->numPoints-1].x);
+ pathDy =
+ (path->p[path->numPoints].y-path->p[path->numPoints-1].y);
+ path->length += (float)SDL_sqrt(pathDx*pathDx + pathDy*pathDy);
+ path->numPoints++;
+ }
+#endif
+ lastP.x = x - dx;
+ lastP.y = y - dy;
+ lastCentroid = inTouch->centroid;
+
+ inTouch->centroid.x += dx/inTouch->numDownFingers;
+ inTouch->centroid.y += dy/inTouch->numDownFingers;
+ /* printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y); */
+ if (inTouch->numDownFingers > 1) {
+ SDL_FloatPoint lv; /* Vector from centroid to last x,y position */
+ SDL_FloatPoint v; /* Vector from centroid to current x,y position */
+ /* lv = inTouch->gestureLast[j].cv; */
+ lv.x = lastP.x - lastCentroid.x;
+ lv.y = lastP.y - lastCentroid.y;
+ lDist = (float)SDL_sqrt(lv.x*lv.x + lv.y*lv.y);
+ /* printf("lDist = %f\n",lDist); */
+ v.x = x - inTouch->centroid.x;
+ v.y = y - inTouch->centroid.y;
+ /* inTouch->gestureLast[j].cv = v; */
+ Dist = (float)SDL_sqrt(v.x*v.x+v.y*v.y);
+ /* SDL_cos(dTheta) = (v . lv)/(|v| * |lv|) */
+
+ /* Normalize Vectors to simplify angle calculation */
+ lv.x/=lDist;
+ lv.y/=lDist;
+ v.x/=Dist;
+ v.y/=Dist;
+ dtheta = (float)SDL_atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
+
+ dDist = (Dist - lDist);
+ if (lDist == 0) {dDist = 0;dtheta = 0;} /* To avoid impossible values */
+
+ /* inTouch->gestureLast[j].dDist = dDist;
+ inTouch->gestureLast[j].dtheta = dtheta;
+
+ printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
+ gdtheta = gdtheta*.9 + dtheta*.1;
+ gdDist = gdDist*.9 + dDist*.1
+ knob.r += dDist/numDownFingers;
+ knob.ang += dtheta;
+ printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
+ printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist); */
+ SDL_SendGestureMulti(inTouch,dtheta,dDist);
+ }
+ else {
+ /* inTouch->gestureLast[j].dDist = 0;
+ inTouch->gestureLast[j].dtheta = 0;
+ inTouch->gestureLast[j].cv.x = 0;
+ inTouch->gestureLast[j].cv.y = 0; */
+ }
+ /* inTouch->gestureLast[j].f.p.x = x;
+ inTouch->gestureLast[j].f.p.y = y;
+ break;
+ pressure? */
+ }
+ else if (event->type == SDL_FINGERDOWN) {
+
+ inTouch->numDownFingers++;
+ inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers - 1)+
+ x)/inTouch->numDownFingers;
+ inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers - 1)+
+ y)/inTouch->numDownFingers;
+ /* printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
+ inTouch->centroid.x,inTouch->centroid.y); */
+
+#ifdef ENABLE_DOLLAR
+ inTouch->dollarPath.length = 0;
+ inTouch->dollarPath.p[0].x = x;
+ inTouch->dollarPath.p[0].y = y;
+ inTouch->dollarPath.numPoints = 1;
+#endif
+ }
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_gesture_c.h b/src/3rdparty/SDL2/src/events/SDL_gesture_c.h
new file mode 100644
index 0000000..b8e4427
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_gesture_c.h
@@ -0,0 +1,35 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_gesture_c_h_
+#define SDL_gesture_c_h_
+
+extern int SDL_GestureAddTouch(SDL_TouchID touchId);
+extern int SDL_GestureDelTouch(SDL_TouchID touchId);
+
+extern void SDL_GestureProcessEvent(SDL_Event* event);
+
+extern void SDL_GestureQuit(void);
+
+#endif /* SDL_gesture_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_keyboard.c b/src/3rdparty/SDL2/src/events/SDL_keyboard.c
new file mode 100644
index 0000000..e129576
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_keyboard.c
@@ -0,0 +1,1033 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* General keyboard handling code for SDL */
+
+#include "SDL_timer.h"
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "SDL_assert.h"
+#include "../video/SDL_sysvideo.h"
+
+
+/* #define DEBUG_KEYBOARD */
+
+/* Global keyboard information */
+
+typedef struct SDL_Keyboard SDL_Keyboard;
+
+struct SDL_Keyboard
+{
+ /* Data common to all keyboards */
+ SDL_Window *focus;
+ Uint16 modstate;
+ Uint8 keystate[SDL_NUM_SCANCODES];
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+};
+
+static SDL_Keyboard SDL_keyboard;
+
+static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
+ 0, 0, 0, 0,
+ 'a',
+ 'b',
+ 'c',
+ 'd',
+ 'e',
+ 'f',
+ 'g',
+ 'h',
+ 'i',
+ 'j',
+ 'k',
+ 'l',
+ 'm',
+ 'n',
+ 'o',
+ 'p',
+ 'q',
+ 'r',
+ 's',
+ 't',
+ 'u',
+ 'v',
+ 'w',
+ 'x',
+ 'y',
+ 'z',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '0',
+ SDLK_RETURN,
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE,
+ SDLK_TAB,
+ SDLK_SPACE,
+ '-',
+ '=',
+ '[',
+ ']',
+ '\\',
+ '#',
+ ';',
+ '\'',
+ '`',
+ ',',
+ '.',
+ '/',
+ SDLK_CAPSLOCK,
+ SDLK_F1,
+ SDLK_F2,
+ SDLK_F3,
+ SDLK_F4,
+ SDLK_F5,
+ SDLK_F6,
+ SDLK_F7,
+ SDLK_F8,
+ SDLK_F9,
+ SDLK_F10,
+ SDLK_F11,
+ SDLK_F12,
+ SDLK_PRINTSCREEN,
+ SDLK_SCROLLLOCK,
+ SDLK_PAUSE,
+ SDLK_INSERT,
+ SDLK_HOME,
+ SDLK_PAGEUP,
+ SDLK_DELETE,
+ SDLK_END,
+ SDLK_PAGEDOWN,
+ SDLK_RIGHT,
+ SDLK_LEFT,
+ SDLK_DOWN,
+ SDLK_UP,
+ SDLK_NUMLOCKCLEAR,
+ SDLK_KP_DIVIDE,
+ SDLK_KP_MULTIPLY,
+ SDLK_KP_MINUS,
+ SDLK_KP_PLUS,
+ SDLK_KP_ENTER,
+ SDLK_KP_1,
+ SDLK_KP_2,
+ SDLK_KP_3,
+ SDLK_KP_4,
+ SDLK_KP_5,
+ SDLK_KP_6,
+ SDLK_KP_7,
+ SDLK_KP_8,
+ SDLK_KP_9,
+ SDLK_KP_0,
+ SDLK_KP_PERIOD,
+ 0,
+ SDLK_APPLICATION,
+ SDLK_POWER,
+ SDLK_KP_EQUALS,
+ SDLK_F13,
+ SDLK_F14,
+ SDLK_F15,
+ SDLK_F16,
+ SDLK_F17,
+ SDLK_F18,
+ SDLK_F19,
+ SDLK_F20,
+ SDLK_F21,
+ SDLK_F22,
+ SDLK_F23,
+ SDLK_F24,
+ SDLK_EXECUTE,
+ SDLK_HELP,
+ SDLK_MENU,
+ SDLK_SELECT,
+ SDLK_STOP,
+ SDLK_AGAIN,
+ SDLK_UNDO,
+ SDLK_CUT,
+ SDLK_COPY,
+ SDLK_PASTE,
+ SDLK_FIND,
+ SDLK_MUTE,
+ SDLK_VOLUMEUP,
+ SDLK_VOLUMEDOWN,
+ 0, 0, 0,
+ SDLK_KP_COMMA,
+ SDLK_KP_EQUALSAS400,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ SDLK_ALTERASE,
+ SDLK_SYSREQ,
+ SDLK_CANCEL,
+ SDLK_CLEAR,
+ SDLK_PRIOR,
+ SDLK_RETURN2,
+ SDLK_SEPARATOR,
+ SDLK_OUT,
+ SDLK_OPER,
+ SDLK_CLEARAGAIN,
+ SDLK_CRSEL,
+ SDLK_EXSEL,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ SDLK_KP_00,
+ SDLK_KP_000,
+ SDLK_THOUSANDSSEPARATOR,
+ SDLK_DECIMALSEPARATOR,
+ SDLK_CURRENCYUNIT,
+ SDLK_CURRENCYSUBUNIT,
+ SDLK_KP_LEFTPAREN,
+ SDLK_KP_RIGHTPAREN,
+ SDLK_KP_LEFTBRACE,
+ SDLK_KP_RIGHTBRACE,
+ SDLK_KP_TAB,
+ SDLK_KP_BACKSPACE,
+ SDLK_KP_A,
+ SDLK_KP_B,
+ SDLK_KP_C,
+ SDLK_KP_D,
+ SDLK_KP_E,
+ SDLK_KP_F,
+ SDLK_KP_XOR,
+ SDLK_KP_POWER,
+ SDLK_KP_PERCENT,
+ SDLK_KP_LESS,
+ SDLK_KP_GREATER,
+ SDLK_KP_AMPERSAND,
+ SDLK_KP_DBLAMPERSAND,
+ SDLK_KP_VERTICALBAR,
+ SDLK_KP_DBLVERTICALBAR,
+ SDLK_KP_COLON,
+ SDLK_KP_HASH,
+ SDLK_KP_SPACE,
+ SDLK_KP_AT,
+ SDLK_KP_EXCLAM,
+ SDLK_KP_MEMSTORE,
+ SDLK_KP_MEMRECALL,
+ SDLK_KP_MEMCLEAR,
+ SDLK_KP_MEMADD,
+ SDLK_KP_MEMSUBTRACT,
+ SDLK_KP_MEMMULTIPLY,
+ SDLK_KP_MEMDIVIDE,
+ SDLK_KP_PLUSMINUS,
+ SDLK_KP_CLEAR,
+ SDLK_KP_CLEARENTRY,
+ SDLK_KP_BINARY,
+ SDLK_KP_OCTAL,
+ SDLK_KP_DECIMAL,
+ SDLK_KP_HEXADECIMAL,
+ 0, 0,
+ SDLK_LCTRL,
+ SDLK_LSHIFT,
+ SDLK_LALT,
+ SDLK_LGUI,
+ SDLK_RCTRL,
+ SDLK_RSHIFT,
+ SDLK_RALT,
+ SDLK_RGUI,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ SDLK_MODE,
+ SDLK_AUDIONEXT,
+ SDLK_AUDIOPREV,
+ SDLK_AUDIOSTOP,
+ SDLK_AUDIOPLAY,
+ SDLK_AUDIOMUTE,
+ SDLK_MEDIASELECT,
+ SDLK_WWW,
+ SDLK_MAIL,
+ SDLK_CALCULATOR,
+ SDLK_COMPUTER,
+ SDLK_AC_SEARCH,
+ SDLK_AC_HOME,
+ SDLK_AC_BACK,
+ SDLK_AC_FORWARD,
+ SDLK_AC_STOP,
+ SDLK_AC_REFRESH,
+ SDLK_AC_BOOKMARKS,
+ SDLK_BRIGHTNESSDOWN,
+ SDLK_BRIGHTNESSUP,
+ SDLK_DISPLAYSWITCH,
+ SDLK_KBDILLUMTOGGLE,
+ SDLK_KBDILLUMDOWN,
+ SDLK_KBDILLUMUP,
+ SDLK_EJECT,
+ SDLK_SLEEP,
+ SDLK_APP1,
+ SDLK_APP2,
+ SDLK_AUDIOREWIND,
+ SDLK_AUDIOFASTFORWARD,
+};
+
+static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
+ NULL, NULL, NULL, NULL,
+ "A",
+ "B",
+ "C",
+ "D",
+ "E",
+ "F",
+ "G",
+ "H",
+ "I",
+ "J",
+ "K",
+ "L",
+ "M",
+ "N",
+ "O",
+ "P",
+ "Q",
+ "R",
+ "S",
+ "T",
+ "U",
+ "V",
+ "W",
+ "X",
+ "Y",
+ "Z",
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "0",
+ "Return",
+ "Escape",
+ "Backspace",
+ "Tab",
+ "Space",
+ "-",
+ "=",
+ "[",
+ "]",
+ "\\",
+ "#",
+ ";",
+ "'",
+ "`",
+ ",",
+ ".",
+ "/",
+ "CapsLock",
+ "F1",
+ "F2",
+ "F3",
+ "F4",
+ "F5",
+ "F6",
+ "F7",
+ "F8",
+ "F9",
+ "F10",
+ "F11",
+ "F12",
+ "PrintScreen",
+ "ScrollLock",
+ "Pause",
+ "Insert",
+ "Home",
+ "PageUp",
+ "Delete",
+ "End",
+ "PageDown",
+ "Right",
+ "Left",
+ "Down",
+ "Up",
+ "Numlock",
+ "Keypad /",
+ "Keypad *",
+ "Keypad -",
+ "Keypad +",
+ "Keypad Enter",
+ "Keypad 1",
+ "Keypad 2",
+ "Keypad 3",
+ "Keypad 4",
+ "Keypad 5",
+ "Keypad 6",
+ "Keypad 7",
+ "Keypad 8",
+ "Keypad 9",
+ "Keypad 0",
+ "Keypad .",
+ NULL,
+ "Application",
+ "Power",
+ "Keypad =",
+ "F13",
+ "F14",
+ "F15",
+ "F16",
+ "F17",
+ "F18",
+ "F19",
+ "F20",
+ "F21",
+ "F22",
+ "F23",
+ "F24",
+ "Execute",
+ "Help",
+ "Menu",
+ "Select",
+ "Stop",
+ "Again",
+ "Undo",
+ "Cut",
+ "Copy",
+ "Paste",
+ "Find",
+ "Mute",
+ "VolumeUp",
+ "VolumeDown",
+ NULL, NULL, NULL,
+ "Keypad ,",
+ "Keypad = (AS400)",
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ "AltErase",
+ "SysReq",
+ "Cancel",
+ "Clear",
+ "Prior",
+ "Return",
+ "Separator",
+ "Out",
+ "Oper",
+ "Clear / Again",
+ "CrSel",
+ "ExSel",
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ "Keypad 00",
+ "Keypad 000",
+ "ThousandsSeparator",
+ "DecimalSeparator",
+ "CurrencyUnit",
+ "CurrencySubUnit",
+ "Keypad (",
+ "Keypad )",
+ "Keypad {",
+ "Keypad }",
+ "Keypad Tab",
+ "Keypad Backspace",
+ "Keypad A",
+ "Keypad B",
+ "Keypad C",
+ "Keypad D",
+ "Keypad E",
+ "Keypad F",
+ "Keypad XOR",
+ "Keypad ^",
+ "Keypad %",
+ "Keypad <",
+ "Keypad >",
+ "Keypad &",
+ "Keypad &&",
+ "Keypad |",
+ "Keypad ||",
+ "Keypad :",
+ "Keypad #",
+ "Keypad Space",
+ "Keypad @",
+ "Keypad !",
+ "Keypad MemStore",
+ "Keypad MemRecall",
+ "Keypad MemClear",
+ "Keypad MemAdd",
+ "Keypad MemSubtract",
+ "Keypad MemMultiply",
+ "Keypad MemDivide",
+ "Keypad +/-",
+ "Keypad Clear",
+ "Keypad ClearEntry",
+ "Keypad Binary",
+ "Keypad Octal",
+ "Keypad Decimal",
+ "Keypad Hexadecimal",
+ NULL, NULL,
+ "Left Ctrl",
+ "Left Shift",
+ "Left Alt",
+ "Left GUI",
+ "Right Ctrl",
+ "Right Shift",
+ "Right Alt",
+ "Right GUI",
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL,
+ "ModeSwitch",
+ "AudioNext",
+ "AudioPrev",
+ "AudioStop",
+ "AudioPlay",
+ "AudioMute",
+ "MediaSelect",
+ "WWW",
+ "Mail",
+ "Calculator",
+ "Computer",
+ "AC Search",
+ "AC Home",
+ "AC Back",
+ "AC Forward",
+ "AC Stop",
+ "AC Refresh",
+ "AC Bookmarks",
+ "BrightnessDown",
+ "BrightnessUp",
+ "DisplaySwitch",
+ "KBDIllumToggle",
+ "KBDIllumDown",
+ "KBDIllumUp",
+ "Eject",
+ "Sleep",
+ "App1",
+ "App2",
+ "AudioRewind",
+ "AudioFastForward",
+};
+
+/* Taken from SDL_iconv() */
+char *
+SDL_UCS4ToUTF8(Uint32 ch, char *dst)
+{
+ Uint8 *p = (Uint8 *) dst;
+ if (ch <= 0x7F) {
+ *p = (Uint8) ch;
+ ++dst;
+ } else if (ch <= 0x7FF) {
+ p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
+ p[1] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 2;
+ } else if (ch <= 0xFFFF) {
+ p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
+ p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[2] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 3;
+ } else if (ch <= 0x1FFFFF) {
+ p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
+ p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
+ p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[3] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 4;
+ } else if (ch <= 0x3FFFFFF) {
+ p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
+ p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
+ p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
+ p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[4] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 5;
+ } else {
+ p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
+ p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
+ p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
+ p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
+ p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[5] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 6;
+ }
+ return dst;
+}
+
+/* Public functions */
+int
+SDL_KeyboardInit(void)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ /* Set the default keymap */
+ SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
+ return (0);
+}
+
+void
+SDL_ResetKeyboard(void)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ SDL_Scancode scancode;
+
+#ifdef DEBUG_KEYBOARD
+ printf("Resetting keyboard\n");
+#endif
+ for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
+ if (keyboard->keystate[scancode] == SDL_PRESSED) {
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+ }
+}
+
+void
+SDL_GetDefaultKeymap(SDL_Keycode * keymap)
+{
+ SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
+}
+
+void
+SDL_SetKeymap(int start, SDL_Keycode * keys, int length)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ SDL_Scancode scancode;
+
+ if (start < 0 || start + length > SDL_NUM_SCANCODES) {
+ return;
+ }
+
+ SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length);
+
+ /* The number key scancodes always map to the number key keycodes.
+ * On AZERTY layouts these technically are symbols, but users (and games)
+ * always think of them and view them in UI as number keys.
+ */
+ keyboard->keymap[SDL_SCANCODE_0] = SDLK_0;
+ for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) {
+ keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1);
+ }
+}
+
+void
+SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
+{
+ SDL_scancode_names[scancode] = name;
+}
+
+SDL_Window *
+SDL_GetKeyboardFocus(void)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ return keyboard->focus;
+}
+
+void
+SDL_SetKeyboardFocus(SDL_Window * window)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ if (keyboard->focus && !window) {
+ /* We won't get anymore keyboard messages, so reset keyboard state */
+ SDL_ResetKeyboard();
+ }
+
+ /* See if the current window has lost focus */
+ if (keyboard->focus && keyboard->focus != window) {
+
+ /* new window shouldn't think it has mouse captured. */
+ SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
+
+ /* old window must lose an existing mouse capture. */
+ if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
+ SDL_CaptureMouse(SDL_FALSE); /* drop the capture. */
+ SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE));
+ }
+
+ SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
+ 0, 0);
+
+ /* Ensures IME compositions are committed */
+ if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+ SDL_VideoDevice *video = SDL_GetVideoDevice();
+ if (video && video->StopTextInput) {
+ video->StopTextInput(video);
+ }
+ }
+ }
+
+ keyboard->focus = window;
+
+ if (keyboard->focus) {
+ SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
+ 0, 0);
+
+ if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+ SDL_VideoDevice *video = SDL_GetVideoDevice();
+ if (video && video->StartTextInput) {
+ video->StartTextInput(video);
+ }
+ }
+ }
+}
+
+int
+SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ int posted;
+ SDL_Keymod modifier;
+ SDL_Keycode keycode;
+ Uint32 type;
+ Uint8 repeat;
+
+ if (!scancode) {
+ return 0;
+ }
+#ifdef DEBUG_KEYBOARD
+ printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
+ state == SDL_PRESSED ? "pressed" : "released");
+#endif
+
+ /* Figure out what type of event this is */
+ switch (state) {
+ case SDL_PRESSED:
+ type = SDL_KEYDOWN;
+ break;
+ case SDL_RELEASED:
+ type = SDL_KEYUP;
+ break;
+ default:
+ /* Invalid state -- bail */
+ return 0;
+ }
+
+ /* Drop events that don't change state */
+ repeat = (state && keyboard->keystate[scancode]);
+ if (keyboard->keystate[scancode] == state && !repeat) {
+#if 0
+ printf("Keyboard event didn't change state - dropped!\n");
+#endif
+ return 0;
+ }
+
+ /* Update internal keyboard state */
+ keyboard->keystate[scancode] = state;
+
+ keycode = keyboard->keymap[scancode];
+
+ /* Update modifiers state if applicable */
+ switch (keycode) {
+ case SDLK_LCTRL:
+ modifier = KMOD_LCTRL;
+ break;
+ case SDLK_RCTRL:
+ modifier = KMOD_RCTRL;
+ break;
+ case SDLK_LSHIFT:
+ modifier = KMOD_LSHIFT;
+ break;
+ case SDLK_RSHIFT:
+ modifier = KMOD_RSHIFT;
+ break;
+ case SDLK_LALT:
+ modifier = KMOD_LALT;
+ break;
+ case SDLK_RALT:
+ modifier = KMOD_RALT;
+ break;
+ case SDLK_LGUI:
+ modifier = KMOD_LGUI;
+ break;
+ case SDLK_RGUI:
+ modifier = KMOD_RGUI;
+ break;
+ case SDLK_MODE:
+ modifier = KMOD_MODE;
+ break;
+ default:
+ modifier = KMOD_NONE;
+ break;
+ }
+ if (SDL_KEYDOWN == type) {
+ switch (keycode) {
+ case SDLK_NUMLOCKCLEAR:
+ keyboard->modstate ^= KMOD_NUM;
+ break;
+ case SDLK_CAPSLOCK:
+ keyboard->modstate ^= KMOD_CAPS;
+ break;
+ default:
+ keyboard->modstate |= modifier;
+ break;
+ }
+ } else {
+ keyboard->modstate &= ~modifier;
+ }
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(type) == SDL_ENABLE) {
+ SDL_Event event;
+ event.key.type = type;
+ event.key.state = state;
+ event.key.repeat = repeat;
+ event.key.keysym.scancode = scancode;
+ event.key.keysym.sym = keycode;
+ event.key.keysym.mod = keyboard->modstate;
+ event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return (posted);
+}
+
+int
+SDL_SendKeyboardText(const char *text)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ int posted;
+
+ /* Don't post text events for unprintable characters */
+ if ((unsigned char)*text < ' ' || *text == 127) {
+ return 0;
+ }
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
+ SDL_Event event;
+ event.text.type = SDL_TEXTINPUT;
+ event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
+ SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return (posted);
+}
+
+int
+SDL_SendEditingText(const char *text, int start, int length)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ int posted;
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) {
+ SDL_Event event;
+ event.edit.type = SDL_TEXTEDITING;
+ event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
+ event.edit.start = start;
+ event.edit.length = length;
+ SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return (posted);
+}
+
+void
+SDL_KeyboardQuit(void)
+{
+}
+
+const Uint8 *
+SDL_GetKeyboardState(int *numkeys)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ if (numkeys != (int *) 0) {
+ *numkeys = SDL_NUM_SCANCODES;
+ }
+ return keyboard->keystate;
+}
+
+SDL_Keymod
+SDL_GetModState(void)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ return (SDL_Keymod) keyboard->modstate;
+}
+
+void
+SDL_SetModState(SDL_Keymod modstate)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ keyboard->modstate = modstate;
+}
+
+/* Note that SDL_ToggleModState() is not a public API. SDL_SetModState() is. */
+void
+SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ if (toggle) {
+ keyboard->modstate |= modstate;
+ } else {
+ keyboard->modstate &= ~modstate;
+ }
+}
+
+
+SDL_Keycode
+SDL_GetKeyFromScancode(SDL_Scancode scancode)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+
+ if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
+ SDL_InvalidParamError("scancode");
+ return 0;
+ }
+
+ return keyboard->keymap[scancode];
+}
+
+SDL_Scancode
+SDL_GetScancodeFromKey(SDL_Keycode key)
+{
+ SDL_Keyboard *keyboard = &SDL_keyboard;
+ SDL_Scancode scancode;
+
+ for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES;
+ ++scancode) {
+ if (keyboard->keymap[scancode] == key) {
+ return scancode;
+ }
+ }
+ return SDL_SCANCODE_UNKNOWN;
+}
+
+const char *
+SDL_GetScancodeName(SDL_Scancode scancode)
+{
+ const char *name;
+ if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
+ SDL_InvalidParamError("scancode");
+ return "";
+ }
+
+ name = SDL_scancode_names[scancode];
+ if (name)
+ return name;
+ else
+ return "";
+}
+
+SDL_Scancode SDL_GetScancodeFromName(const char *name)
+{
+ int i;
+
+ if (!name || !*name) {
+ SDL_InvalidParamError("name");
+ return SDL_SCANCODE_UNKNOWN;
+ }
+
+ for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
+ if (!SDL_scancode_names[i]) {
+ continue;
+ }
+ if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
+ return (SDL_Scancode)i;
+ }
+ }
+
+ SDL_InvalidParamError("name");
+ return SDL_SCANCODE_UNKNOWN;
+}
+
+const char *
+SDL_GetKeyName(SDL_Keycode key)
+{
+ static char name[8];
+ char *end;
+
+ if (key & SDLK_SCANCODE_MASK) {
+ return
+ SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK));
+ }
+
+ switch (key) {
+ case SDLK_RETURN:
+ return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
+ case SDLK_ESCAPE:
+ return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
+ case SDLK_BACKSPACE:
+ return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
+ case SDLK_TAB:
+ return SDL_GetScancodeName(SDL_SCANCODE_TAB);
+ case SDLK_SPACE:
+ return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
+ case SDLK_DELETE:
+ return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
+ default:
+ /* Unaccented letter keys on latin keyboards are normally
+ labeled in upper case (and probably on others like Greek or
+ Cyrillic too, so if you happen to know for sure, please
+ adapt this). */
+ if (key >= 'a' && key <= 'z') {
+ key -= 32;
+ }
+
+ end = SDL_UCS4ToUTF8((Uint32) key, name);
+ *end = '\0';
+ return name;
+ }
+}
+
+SDL_Keycode
+SDL_GetKeyFromName(const char *name)
+{
+ SDL_Keycode key;
+
+ /* Check input */
+ if (name == NULL) {
+ return SDLK_UNKNOWN;
+ }
+
+ /* If it's a single UTF-8 character, then that's the keycode itself */
+ key = *(const unsigned char *)name;
+ if (key >= 0xF0) {
+ if (SDL_strlen(name) == 4) {
+ int i = 0;
+ key = (Uint16)(name[i]&0x07) << 18;
+ key |= (Uint16)(name[++i]&0x3F) << 12;
+ key |= (Uint16)(name[++i]&0x3F) << 6;
+ key |= (Uint16)(name[++i]&0x3F);
+ return key;
+ }
+ return SDLK_UNKNOWN;
+ } else if (key >= 0xE0) {
+ if (SDL_strlen(name) == 3) {
+ int i = 0;
+ key = (Uint16)(name[i]&0x0F) << 12;
+ key |= (Uint16)(name[++i]&0x3F) << 6;
+ key |= (Uint16)(name[++i]&0x3F);
+ return key;
+ }
+ return SDLK_UNKNOWN;
+ } else if (key >= 0xC0) {
+ if (SDL_strlen(name) == 2) {
+ int i = 0;
+ key = (Uint16)(name[i]&0x1F) << 6;
+ key |= (Uint16)(name[++i]&0x3F);
+ return key;
+ }
+ return SDLK_UNKNOWN;
+ } else {
+ if (SDL_strlen(name) == 1) {
+ if (key >= 'A' && key <= 'Z') {
+ key += 32;
+ }
+ return key;
+ }
+
+ /* Get the scancode for this name, and the associated keycode */
+ return SDL_default_keymap[SDL_GetScancodeFromName(name)];
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_keyboard_c.h b/src/3rdparty/SDL2/src/events/SDL_keyboard_c.h
new file mode 100644
index 0000000..7f12a38
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_keyboard_c.h
@@ -0,0 +1,70 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_keyboard_c_h_
+#define SDL_keyboard_c_h_
+
+#include "SDL_keycode.h"
+#include "SDL_events.h"
+
+/* Initialize the keyboard subsystem */
+extern int SDL_KeyboardInit(void);
+
+/* Clear the state of the keyboard */
+extern void SDL_ResetKeyboard(void);
+
+/* Get the default keymap */
+extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap);
+
+/* Set the mapping of scancode to key codes */
+extern void SDL_SetKeymap(int start, SDL_Keycode * keys, int length);
+
+/* Set a platform-dependent key name, overriding the default platform-agnostic
+ name. Encoded as UTF-8. The string is not copied, thus the pointer given to
+ this function must stay valid forever (or at least until the call to
+ VideoQuit()). */
+extern void SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
+
+/* Set the keyboard focus window */
+extern void SDL_SetKeyboardFocus(SDL_Window * window);
+
+/* Send a keyboard key event */
+extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
+
+/* Send keyboard text input */
+extern int SDL_SendKeyboardText(const char *text);
+
+/* Send editing text for selected range from start to end */
+extern int SDL_SendEditingText(const char *text, int start, int end);
+
+/* Shutdown the keyboard subsystem */
+extern void SDL_KeyboardQuit(void);
+
+/* Convert to UTF-8 */
+extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst);
+
+/* Toggle on or off pieces of the keyboard mod state. */
+extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle);
+
+#endif /* SDL_keyboard_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_mouse.c b/src/3rdparty/SDL2/src/events/SDL_mouse.c
new file mode 100644
index 0000000..4f4e62f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_mouse.c
@@ -0,0 +1,1027 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* General mouse handling code for SDL */
+
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_timer.h"
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "../video/SDL_sysvideo.h"
+
+/* #define DEBUG_MOUSE */
+
+/* The mouse state */
+static SDL_Mouse SDL_mouse;
+static Uint32 SDL_double_click_time = 500;
+static int SDL_double_click_radius = 1;
+
+static int
+SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
+
+static void SDLCALL
+SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ SDL_Mouse *mouse = (SDL_Mouse *)userdata;
+
+ if (hint && *hint) {
+ mouse->normal_speed_scale = (float)SDL_atof(hint);
+ } else {
+ mouse->normal_speed_scale = 1.0f;
+ }
+}
+
+static void SDLCALL
+SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ SDL_Mouse *mouse = (SDL_Mouse *)userdata;
+
+ if (hint && *hint) {
+ mouse->relative_speed_scale = (float)SDL_atof(hint);
+ } else {
+ mouse->relative_speed_scale = 1.0f;
+ }
+}
+
+static void SDLCALL
+SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ SDL_Mouse *mouse = (SDL_Mouse *)userdata;
+
+ if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) {
+ mouse->touch_mouse_events = SDL_FALSE;
+ } else {
+ mouse->touch_mouse_events = SDL_TRUE;
+ }
+}
+
+/* Public functions */
+int
+SDL_MouseInit(void)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ SDL_zerop(mouse);
+
+ SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
+ SDL_MouseNormalSpeedScaleChanged, mouse);
+
+ SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE,
+ SDL_MouseRelativeSpeedScaleChanged, mouse);
+
+ SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS,
+ SDL_TouchMouseEventsChanged, mouse);
+
+ mouse->cursor_shown = SDL_TRUE;
+
+ return (0);
+}
+
+void
+SDL_SetDefaultCursor(SDL_Cursor * cursor)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->def_cursor = cursor;
+ if (!mouse->cur_cursor) {
+ SDL_SetCursor(cursor);
+ }
+}
+
+SDL_Mouse *
+SDL_GetMouse(void)
+{
+ return &SDL_mouse;
+}
+
+void
+SDL_SetDoubleClickTime(Uint32 interval)
+{
+ SDL_double_click_time = interval;
+}
+
+SDL_Window *
+SDL_GetMouseFocus(void)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ return mouse->focus;
+}
+
+#if 0
+void
+SDL_ResetMouse(void)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ Uint8 i;
+
+#ifdef DEBUG_MOUSE
+ printf("Resetting mouse\n");
+#endif
+ for (i = 1; i <= sizeof(mouse->buttonstate)*8; ++i) {
+ if (mouse->buttonstate & SDL_BUTTON(i)) {
+ SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i);
+ }
+ }
+ SDL_assert(mouse->buttonstate == 0);
+}
+#endif
+
+void
+SDL_SetMouseFocus(SDL_Window * window)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse->focus == window) {
+ return;
+ }
+
+ /* Actually, this ends up being a bad idea, because most operating
+ systems have an implicit grab when you press the mouse button down
+ so you can drag things out of the window and then get the mouse up
+ when it happens. So, #if 0...
+ */
+#if 0
+ if (mouse->focus && !window) {
+ /* We won't get anymore mouse messages, so reset mouse state */
+ SDL_ResetMouse();
+ }
+#endif
+
+ /* See if the current window has lost focus */
+ if (mouse->focus) {
+ SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
+ }
+
+ mouse->focus = window;
+ mouse->has_position = SDL_FALSE;
+
+ if (mouse->focus) {
+ SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
+ }
+
+ /* Update cursor visibility */
+ SDL_SetCursor(NULL);
+}
+
+/* Check to see if we need to synthesize focus events */
+static SDL_bool
+SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_bool inWindow = SDL_TRUE;
+
+ if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
+ int w, h;
+ SDL_GetWindowSize(window, &w, &h);
+ if (x < 0 || y < 0 || x >= w || y >= h) {
+ inWindow = SDL_FALSE;
+ }
+ }
+
+/* Linux doesn't give you mouse events outside your window unless you grab
+ the pointer.
+
+ Windows doesn't give you mouse events outside your window unless you call
+ SetCapture().
+
+ Both of these are slightly scary changes, so for now we'll punt and if the
+ mouse leaves the window you'll lose mouse focus and reset button state.
+*/
+#ifdef SUPPORT_DRAG_OUTSIDE_WINDOW
+ if (!inWindow && !buttonstate) {
+#else
+ if (!inWindow) {
+#endif
+ if (window == mouse->focus) {
+#ifdef DEBUG_MOUSE
+ printf("Mouse left window, synthesizing move & focus lost event\n");
+#endif
+ SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y);
+ SDL_SetMouseFocus(NULL);
+ }
+ return SDL_FALSE;
+ }
+
+ if (window != mouse->focus) {
+#ifdef DEBUG_MOUSE
+ printf("Mouse entered window, synthesizing focus gain & move event\n");
+#endif
+ SDL_SetMouseFocus(window);
+ SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y);
+ }
+ return SDL_TRUE;
+}
+
+int
+SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y)
+{
+ if (window && !relative) {
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (!SDL_UpdateMouseFocus(window, x, y, mouse->buttonstate)) {
+ return 0;
+ }
+ }
+
+ return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y);
+}
+
+static int
+GetScaledMouseDelta(float scale, int value, float *accum)
+{
+ if (scale != 1.0f) {
+ *accum += scale * value;
+ if (*accum >= 0.0f) {
+ value = (int)SDL_floor(*accum);
+ } else {
+ value = (int)SDL_ceil(*accum);
+ }
+ *accum -= value;
+ }
+ return value;
+}
+
+static int
+SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ int posted;
+ int xrel;
+ int yrel;
+
+ if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) {
+ return 0;
+ }
+
+ if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) {
+ int center_x = 0, center_y = 0;
+ SDL_GetWindowSize(window, &center_x, &center_y);
+ center_x /= 2;
+ center_y /= 2;
+ if (x == center_x && y == center_y) {
+ mouse->last_x = center_x;
+ mouse->last_y = center_y;
+ return 0;
+ }
+ SDL_WarpMouseInWindow(window, center_x, center_y);
+ }
+
+ if (relative) {
+ if (mouse->relative_mode) {
+ x = GetScaledMouseDelta(mouse->relative_speed_scale, x, &mouse->scale_accum_x);
+ y = GetScaledMouseDelta(mouse->relative_speed_scale, y, &mouse->scale_accum_y);
+ } else {
+ x = GetScaledMouseDelta(mouse->normal_speed_scale, x, &mouse->scale_accum_x);
+ y = GetScaledMouseDelta(mouse->normal_speed_scale, y, &mouse->scale_accum_y);
+ }
+ xrel = x;
+ yrel = y;
+ x = (mouse->last_x + xrel);
+ y = (mouse->last_y + yrel);
+ } else {
+ xrel = x - mouse->last_x;
+ yrel = y - mouse->last_y;
+ }
+
+ /* Drop events that don't change state */
+ if (!xrel && !yrel) {
+#ifdef DEBUG_MOUSE
+ printf("Mouse event didn't change state - dropped!\n");
+#endif
+ return 0;
+ }
+
+ /* Ignore relative motion when first positioning the mouse */
+ if (!mouse->has_position) {
+ xrel = 0;
+ yrel = 0;
+ mouse->has_position = SDL_TRUE;
+ }
+
+ /* Ignore relative motion positioning the first touch */
+ if (mouseID == SDL_TOUCH_MOUSEID && !mouse->buttonstate) {
+ xrel = 0;
+ yrel = 0;
+ }
+
+ /* Update internal mouse coordinates */
+ if (!mouse->relative_mode) {
+ mouse->x = x;
+ mouse->y = y;
+ } else {
+ mouse->x += xrel;
+ mouse->y += yrel;
+ }
+
+ /* make sure that the pointers find themselves inside the windows,
+ unless we have the mouse captured. */
+ if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
+ int x_max = 0, y_max = 0;
+
+ /* !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? */
+ SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
+ --x_max;
+ --y_max;
+
+ if (mouse->x > x_max) {
+ mouse->x = x_max;
+ }
+ if (mouse->x < 0) {
+ mouse->x = 0;
+ }
+
+ if (mouse->y > y_max) {
+ mouse->y = y_max;
+ }
+ if (mouse->y < 0) {
+ mouse->y = 0;
+ }
+ }
+
+ mouse->xdelta += xrel;
+ mouse->ydelta += yrel;
+
+ /* Move the mouse cursor, if needed */
+ if (mouse->cursor_shown && !mouse->relative_mode &&
+ mouse->MoveCursor && mouse->cur_cursor) {
+ mouse->MoveCursor(mouse->cur_cursor);
+ }
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE) {
+ SDL_Event event;
+ event.motion.type = SDL_MOUSEMOTION;
+ event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
+ event.motion.which = mouseID;
+ event.motion.state = mouse->buttonstate;
+ event.motion.x = mouse->x;
+ event.motion.y = mouse->y;
+ event.motion.xrel = xrel;
+ event.motion.yrel = yrel;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ if (relative) {
+ mouse->last_x = mouse->x;
+ mouse->last_y = mouse->y;
+ } else {
+ /* Use unclamped values if we're getting events outside the window */
+ mouse->last_x = x;
+ mouse->last_y = y;
+ }
+ return posted;
+}
+
+static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button)
+{
+ if (button >= mouse->num_clickstates) {
+ int i, count = button + 1;
+ SDL_MouseClickState *clickstate = (SDL_MouseClickState *)SDL_realloc(mouse->clickstate, count * sizeof(*mouse->clickstate));
+ if (!clickstate) {
+ return NULL;
+ }
+ mouse->clickstate = clickstate;
+
+ for (i = mouse->num_clickstates; i < count; ++i) {
+ SDL_zero(mouse->clickstate[i]);
+ }
+ mouse->num_clickstates = count;
+ }
+ return &mouse->clickstate[button];
+}
+
+static int
+SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ int posted;
+ Uint32 type;
+ Uint32 buttonstate = mouse->buttonstate;
+
+ if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) {
+ return 0;
+ }
+
+ /* Figure out which event to perform */
+ switch (state) {
+ case SDL_PRESSED:
+ type = SDL_MOUSEBUTTONDOWN;
+ buttonstate |= SDL_BUTTON(button);
+ break;
+ case SDL_RELEASED:
+ type = SDL_MOUSEBUTTONUP;
+ buttonstate &= ~SDL_BUTTON(button);
+ break;
+ default:
+ /* Invalid state -- bail */
+ return 0;
+ }
+
+ /* We do this after calculating buttonstate so button presses gain focus */
+ if (window && state == SDL_PRESSED) {
+ SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate);
+ }
+
+ if (buttonstate == mouse->buttonstate) {
+ /* Ignore this event, no state change */
+ return 0;
+ }
+ mouse->buttonstate = buttonstate;
+
+ if (clicks < 0) {
+ SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button);
+ if (clickstate) {
+ if (state == SDL_PRESSED) {
+ Uint32 now = SDL_GetTicks();
+
+ if (SDL_TICKS_PASSED(now, clickstate->last_timestamp + SDL_double_click_time) ||
+ SDL_abs(mouse->x - clickstate->last_x) > SDL_double_click_radius ||
+ SDL_abs(mouse->y - clickstate->last_y) > SDL_double_click_radius) {
+ clickstate->click_count = 0;
+ }
+ clickstate->last_timestamp = now;
+ clickstate->last_x = mouse->x;
+ clickstate->last_y = mouse->y;
+ if (clickstate->click_count < 255) {
+ ++clickstate->click_count;
+ }
+ }
+ clicks = clickstate->click_count;
+ } else {
+ clicks = 1;
+ }
+ }
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(type) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = type;
+ event.button.windowID = mouse->focus ? mouse->focus->id : 0;
+ event.button.which = mouseID;
+ event.button.state = state;
+ event.button.button = button;
+ event.button.clicks = (Uint8) SDL_min(clicks, 255);
+ event.button.x = mouse->x;
+ event.button.y = mouse->y;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+
+ /* We do this after dispatching event so button releases can lose focus */
+ if (window && state == SDL_RELEASED) {
+ SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate);
+ }
+
+ return posted;
+}
+
+int
+SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks)
+{
+ clicks = SDL_max(clicks, 0);
+ return SDL_PrivateSendMouseButton(window, mouseID, state, button, clicks);
+}
+
+int
+SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
+{
+ return SDL_PrivateSendMouseButton(window, mouseID, state, button, -1);
+}
+
+int
+SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ int posted;
+ int integral_x, integral_y;
+
+ if (window) {
+ SDL_SetMouseFocus(window);
+ }
+
+ if (!x && !y) {
+ return 0;
+ }
+
+ mouse->accumulated_wheel_x += x;
+ if (mouse->accumulated_wheel_x > 0) {
+ integral_x = (int)SDL_floor(mouse->accumulated_wheel_x);
+ } else if (mouse->accumulated_wheel_x < 0) {
+ integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x);
+ } else {
+ integral_x = 0;
+ }
+ mouse->accumulated_wheel_x -= integral_x;
+
+ mouse->accumulated_wheel_y += y;
+ if (mouse->accumulated_wheel_y > 0) {
+ integral_y = (int)SDL_floor(mouse->accumulated_wheel_y);
+ } else if (mouse->accumulated_wheel_y < 0) {
+ integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y);
+ } else {
+ integral_y = 0;
+ }
+ mouse->accumulated_wheel_y -= integral_y;
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = SDL_MOUSEWHEEL;
+ event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
+ event.wheel.which = mouseID;
+#if 0 /* Uncomment this when it goes in for SDL 2.1 */
+ event.wheel.preciseX = x;
+ event.wheel.preciseY = y;
+#endif
+ event.wheel.x = integral_x;
+ event.wheel.y = integral_y;
+ event.wheel.direction = (Uint32)direction;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return posted;
+}
+
+void
+SDL_MouseQuit(void)
+{
+ SDL_Cursor *cursor, *next;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse->CaptureMouse) {
+ SDL_CaptureMouse(SDL_FALSE);
+ }
+ SDL_SetRelativeMouseMode(SDL_FALSE);
+ SDL_ShowCursor(1);
+
+ cursor = mouse->cursors;
+ while (cursor) {
+ next = cursor->next;
+ SDL_FreeCursor(cursor);
+ cursor = next;
+ }
+ mouse->cursors = NULL;
+
+ if (mouse->def_cursor && mouse->FreeCursor) {
+ mouse->FreeCursor(mouse->def_cursor);
+ mouse->def_cursor = NULL;
+ }
+
+ if (mouse->clickstate) {
+ SDL_free(mouse->clickstate);
+ mouse->clickstate = NULL;
+ }
+
+ SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
+ SDL_MouseNormalSpeedScaleChanged, mouse);
+
+ SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE,
+ SDL_MouseRelativeSpeedScaleChanged, mouse);
+}
+
+Uint32
+SDL_GetMouseState(int *x, int *y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (x) {
+ *x = mouse->x;
+ }
+ if (y) {
+ *y = mouse->y;
+ }
+ return mouse->buttonstate;
+}
+
+Uint32
+SDL_GetRelativeMouseState(int *x, int *y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (x) {
+ *x = mouse->xdelta;
+ }
+ if (y) {
+ *y = mouse->ydelta;
+ }
+ mouse->xdelta = 0;
+ mouse->ydelta = 0;
+ return mouse->buttonstate;
+}
+
+Uint32
+SDL_GetGlobalMouseState(int *x, int *y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ int tmpx, tmpy;
+
+ /* make sure these are never NULL for the backend implementations... */
+ if (!x) {
+ x = &tmpx;
+ }
+ if (!y) {
+ y = &tmpy;
+ }
+
+ *x = *y = 0;
+
+ if (!mouse->GetGlobalMouseState) {
+ return 0;
+ }
+
+ return mouse->GetGlobalMouseState(x, y);
+}
+
+void
+SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (window == NULL) {
+ window = mouse->focus;
+ }
+
+ if (window == NULL) {
+ return;
+ }
+
+ if (mouse->WarpMouse) {
+ mouse->WarpMouse(window, x, y);
+ } else {
+ SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y);
+ }
+}
+
+int
+SDL_WarpMouseGlobal(int x, int y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse->WarpMouseGlobal) {
+ return mouse->WarpMouseGlobal(x, y);
+ }
+
+ return SDL_Unsupported();
+}
+
+static SDL_bool
+ShouldUseRelativeModeWarp(SDL_Mouse *mouse)
+{
+ if (!mouse->SetRelativeMouseMode) {
+ return SDL_TRUE;
+ }
+
+ return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE);
+}
+
+int
+SDL_SetRelativeMouseMode(SDL_bool enabled)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Window *focusWindow = SDL_GetKeyboardFocus();
+
+ if (enabled == mouse->relative_mode) {
+ return 0;
+ }
+
+ if (enabled && focusWindow) {
+ /* Center it in the focused window to prevent clicks from going through
+ * to background windows.
+ */
+ SDL_SetMouseFocus(focusWindow);
+ SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2);
+ }
+
+ /* Set the relative mode */
+ if (!enabled && mouse->relative_mode_warp) {
+ mouse->relative_mode_warp = SDL_FALSE;
+ } else if (enabled && ShouldUseRelativeModeWarp(mouse)) {
+ mouse->relative_mode_warp = SDL_TRUE;
+ } else if (mouse->SetRelativeMouseMode(enabled) < 0) {
+ if (enabled) {
+ /* Fall back to warp mode if native relative mode failed */
+ mouse->relative_mode_warp = SDL_TRUE;
+ }
+ }
+ mouse->relative_mode = enabled;
+ mouse->scale_accum_x = 0.0f;
+ mouse->scale_accum_y = 0.0f;
+
+ if (mouse->focus) {
+ SDL_UpdateWindowGrab(mouse->focus);
+
+ /* Put the cursor back to where the application expects it */
+ if (!enabled) {
+ SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y);
+ }
+ }
+
+ /* Flush pending mouse motion - ideally we would pump events, but that's not always safe */
+ SDL_FlushEvent(SDL_MOUSEMOTION);
+
+ /* Update cursor visibility */
+ SDL_SetCursor(NULL);
+
+ return 0;
+}
+
+SDL_bool
+SDL_GetRelativeMouseMode()
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ return mouse->relative_mode;
+}
+
+int
+SDL_CaptureMouse(SDL_bool enabled)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Window *focusWindow;
+ SDL_bool isCaptured;
+
+ if (!mouse->CaptureMouse) {
+ return SDL_Unsupported();
+ }
+
+ focusWindow = SDL_GetKeyboardFocus();
+
+ isCaptured = focusWindow && (focusWindow->flags & SDL_WINDOW_MOUSE_CAPTURE);
+ if (isCaptured == enabled) {
+ return 0; /* already done! */
+ }
+
+ if (enabled) {
+ if (!focusWindow) {
+ return SDL_SetError("No window has focus");
+ } else if (mouse->CaptureMouse(focusWindow) == -1) {
+ return -1; /* CaptureMouse() should call SetError */
+ }
+ focusWindow->flags |= SDL_WINDOW_MOUSE_CAPTURE;
+ } else {
+ if (mouse->CaptureMouse(NULL) == -1) {
+ return -1; /* CaptureMouse() should call SetError */
+ }
+ focusWindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
+ }
+
+ return 0;
+}
+
+SDL_Cursor *
+SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
+ int w, int h, int hot_x, int hot_y)
+{
+ SDL_Surface *surface;
+ SDL_Cursor *cursor;
+ int x, y;
+ Uint32 *pixel;
+ Uint8 datab = 0, maskb = 0;
+ const Uint32 black = 0xFF000000;
+ const Uint32 white = 0xFFFFFFFF;
+ const Uint32 transparent = 0x00000000;
+
+ /* Make sure the width is a multiple of 8 */
+ w = ((w + 7) & ~7);
+
+ /* Create the surface from a bitmap */
+ surface = SDL_CreateRGBSurface(0, w, h, 32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ 0xFF000000);
+ if (!surface) {
+ return NULL;
+ }
+ for (y = 0; y < h; ++y) {
+ pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
+ for (x = 0; x < w; ++x) {
+ if ((x % 8) == 0) {
+ datab = *data++;
+ maskb = *mask++;
+ }
+ if (maskb & 0x80) {
+ *pixel++ = (datab & 0x80) ? black : white;
+ } else {
+ *pixel++ = (datab & 0x80) ? black : transparent;
+ }
+ datab <<= 1;
+ maskb <<= 1;
+ }
+ }
+
+ cursor = SDL_CreateColorCursor(surface, hot_x, hot_y);
+
+ SDL_FreeSurface(surface);
+
+ return cursor;
+}
+
+SDL_Cursor *
+SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Surface *temp = NULL;
+ SDL_Cursor *cursor;
+
+ if (!surface) {
+ SDL_SetError("Passed NULL cursor surface");
+ return NULL;
+ }
+
+ if (!mouse->CreateCursor) {
+ SDL_SetError("Cursors are not currently supported");
+ return NULL;
+ }
+
+ /* Sanity check the hot spot */
+ if ((hot_x < 0) || (hot_y < 0) ||
+ (hot_x >= surface->w) || (hot_y >= surface->h)) {
+ SDL_SetError("Cursor hot spot doesn't lie within cursor");
+ return NULL;
+ }
+
+ if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) {
+ temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
+ if (!temp) {
+ return NULL;
+ }
+ surface = temp;
+ }
+
+ cursor = mouse->CreateCursor(surface, hot_x, hot_y);
+ if (cursor) {
+ cursor->next = mouse->cursors;
+ mouse->cursors = cursor;
+ }
+
+ SDL_FreeSurface(temp);
+
+ return cursor;
+}
+
+SDL_Cursor *
+SDL_CreateSystemCursor(SDL_SystemCursor id)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Cursor *cursor;
+
+ if (!mouse->CreateSystemCursor) {
+ SDL_SetError("CreateSystemCursor is not currently supported");
+ return NULL;
+ }
+
+ cursor = mouse->CreateSystemCursor(id);
+ if (cursor) {
+ cursor->next = mouse->cursors;
+ mouse->cursors = cursor;
+ }
+
+ return cursor;
+}
+
+/* SDL_SetCursor(NULL) can be used to force the cursor redraw,
+ if this is desired for any reason. This is used when setting
+ the video mode and when the SDL window gains the mouse focus.
+ */
+void
+SDL_SetCursor(SDL_Cursor * cursor)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ /* Set the new cursor */
+ if (cursor) {
+ /* Make sure the cursor is still valid for this mouse */
+ if (cursor != mouse->def_cursor) {
+ SDL_Cursor *found;
+ for (found = mouse->cursors; found; found = found->next) {
+ if (found == cursor) {
+ break;
+ }
+ }
+ if (!found) {
+ SDL_SetError("Cursor not associated with the current mouse");
+ return;
+ }
+ }
+ mouse->cur_cursor = cursor;
+ } else {
+ if (mouse->focus) {
+ cursor = mouse->cur_cursor;
+ } else {
+ cursor = mouse->def_cursor;
+ }
+ }
+
+ if (cursor && mouse->cursor_shown && !mouse->relative_mode) {
+ if (mouse->ShowCursor) {
+ mouse->ShowCursor(cursor);
+ }
+ } else {
+ if (mouse->ShowCursor) {
+ mouse->ShowCursor(NULL);
+ }
+ }
+}
+
+SDL_Cursor *
+SDL_GetCursor(void)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (!mouse) {
+ return NULL;
+ }
+ return mouse->cur_cursor;
+}
+
+SDL_Cursor *
+SDL_GetDefaultCursor(void)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (!mouse) {
+ return NULL;
+ }
+ return mouse->def_cursor;
+}
+
+void
+SDL_FreeCursor(SDL_Cursor * cursor)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Cursor *curr, *prev;
+
+ if (!cursor) {
+ return;
+ }
+
+ if (cursor == mouse->def_cursor) {
+ return;
+ }
+ if (cursor == mouse->cur_cursor) {
+ SDL_SetCursor(mouse->def_cursor);
+ }
+
+ for (prev = NULL, curr = mouse->cursors; curr;
+ prev = curr, curr = curr->next) {
+ if (curr == cursor) {
+ if (prev) {
+ prev->next = curr->next;
+ } else {
+ mouse->cursors = curr->next;
+ }
+
+ if (mouse->FreeCursor) {
+ mouse->FreeCursor(curr);
+ }
+ return;
+ }
+ }
+}
+
+int
+SDL_ShowCursor(int toggle)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_bool shown;
+
+ if (!mouse) {
+ return 0;
+ }
+
+ shown = mouse->cursor_shown;
+ if (toggle >= 0) {
+ if (toggle) {
+ mouse->cursor_shown = SDL_TRUE;
+ } else {
+ mouse->cursor_shown = SDL_FALSE;
+ }
+ if (mouse->cursor_shown != shown) {
+ SDL_SetCursor(NULL);
+ }
+ }
+ return shown;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_mouse_c.h b/src/3rdparty/SDL2/src/events/SDL_mouse_c.h
new file mode 100644
index 0000000..28089e0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_mouse_c.h
@@ -0,0 +1,141 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_mouse_c_h_
+#define SDL_mouse_c_h_
+
+#include "SDL_mouse.h"
+
+typedef Uint32 SDL_MouseID;
+
+struct SDL_Cursor
+{
+ struct SDL_Cursor *next;
+ void *driverdata;
+};
+
+typedef struct
+{
+ int last_x, last_y;
+ Uint32 last_timestamp;
+ Uint8 click_count;
+} SDL_MouseClickState;
+
+typedef struct
+{
+ /* Create a cursor from a surface */
+ SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
+
+ /* Create a system cursor */
+ SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id);
+
+ /* Show the specified cursor, or hide if cursor is NULL */
+ int (*ShowCursor) (SDL_Cursor * cursor);
+
+ /* This is called when a mouse motion event occurs */
+ void (*MoveCursor) (SDL_Cursor * cursor);
+
+ /* Free a window manager cursor */
+ void (*FreeCursor) (SDL_Cursor * cursor);
+
+ /* Warp the mouse to (x,y) within a window */
+ void (*WarpMouse) (SDL_Window * window, int x, int y);
+
+ /* Warp the mouse to (x,y) in screen space */
+ int (*WarpMouseGlobal) (int x, int y);
+
+ /* Set relative mode */
+ int (*SetRelativeMouseMode) (SDL_bool enabled);
+
+ /* Set mouse capture */
+ int (*CaptureMouse) (SDL_Window * window);
+
+ /* Get absolute mouse coordinates. (x) and (y) are never NULL and set to zero before call. */
+ Uint32 (*GetGlobalMouseState) (int *x, int *y);
+
+ /* Data common to all mice */
+ SDL_MouseID mouseID;
+ SDL_Window *focus;
+ int x;
+ int y;
+ int xdelta;
+ int ydelta;
+ int last_x, last_y; /* the last reported x and y coordinates */
+ float accumulated_wheel_x;
+ float accumulated_wheel_y;
+ Uint32 buttonstate;
+ SDL_bool has_position;
+ SDL_bool relative_mode;
+ SDL_bool relative_mode_warp;
+ float normal_speed_scale;
+ float relative_speed_scale;
+ float scale_accum_x;
+ float scale_accum_y;
+ SDL_bool touch_mouse_events;
+
+ /* Data for double-click tracking */
+ int num_clickstates;
+ SDL_MouseClickState *clickstate;
+
+ SDL_Cursor *cursors;
+ SDL_Cursor *def_cursor;
+ SDL_Cursor *cur_cursor;
+ SDL_bool cursor_shown;
+
+ /* Driver-dependent data. */
+ void *driverdata;
+} SDL_Mouse;
+
+
+/* Initialize the mouse subsystem */
+extern int SDL_MouseInit(void);
+
+/* Get the mouse state structure */
+SDL_Mouse *SDL_GetMouse(void);
+
+/* Set the default double-click interval */
+extern void SDL_SetDoubleClickTime(Uint32 interval);
+
+/* Set the default mouse cursor */
+extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
+
+/* Set the mouse focus window */
+extern void SDL_SetMouseFocus(SDL_Window * window);
+
+/* Send a mouse motion event */
+extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
+
+/* Send a mouse button event */
+extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button);
+
+/* Send a mouse button event with a click count */
+extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks);
+
+/* Send a mouse wheel event */
+extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
+
+/* Shutdown the mouse subsystem */
+extern void SDL_MouseQuit(void);
+
+#endif /* SDL_mouse_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_quit.c b/src/3rdparty/SDL2/src/events/SDL_quit.c
new file mode 100644
index 0000000..2b24efe
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_quit.c
@@ -0,0 +1,152 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+#include "SDL_hints.h"
+#include "SDL_assert.h"
+
+/* General quit handling code for SDL */
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+
+static SDL_bool disable_signals = SDL_FALSE;
+static SDL_bool send_quit_pending = SDL_FALSE;
+
+#ifdef HAVE_SIGNAL_H
+static void
+SDL_HandleSIG(int sig)
+{
+ /* Reset the signal handler */
+ signal(sig, SDL_HandleSIG);
+
+ /* Send a quit event next time the event loop pumps. */
+ /* We can't send it in signal handler; malloc() might be interrupted! */
+ send_quit_pending = SDL_TRUE;
+}
+#endif /* HAVE_SIGNAL_H */
+
+/* Public functions */
+static int
+SDL_QuitInit_Internal(void)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction action;
+ sigaction(SIGINT, NULL, &action);
+#ifdef HAVE_SA_SIGACTION
+ if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) {
+#else
+ if ( action.sa_handler == SIG_DFL ) {
+#endif
+ action.sa_handler = SDL_HandleSIG;
+ sigaction(SIGINT, &action, NULL);
+ }
+ sigaction(SIGTERM, NULL, &action);
+
+#ifdef HAVE_SA_SIGACTION
+ if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) {
+#else
+ if ( action.sa_handler == SIG_DFL ) {
+#endif
+ action.sa_handler = SDL_HandleSIG;
+ sigaction(SIGTERM, &action, NULL);
+ }
+#elif HAVE_SIGNAL_H
+ void (*ohandler) (int);
+
+ /* Both SIGINT and SIGTERM are translated into quit interrupts */
+ ohandler = signal(SIGINT, SDL_HandleSIG);
+ if (ohandler != SIG_DFL)
+ signal(SIGINT, ohandler);
+ ohandler = signal(SIGTERM, SDL_HandleSIG);
+ if (ohandler != SIG_DFL)
+ signal(SIGTERM, ohandler);
+#endif /* HAVE_SIGNAL_H */
+
+ /* That's it! */
+ return 0;
+}
+
+int
+SDL_QuitInit(void)
+{
+ if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) {
+ return SDL_QuitInit_Internal();
+ }
+ return 0;
+}
+
+static void
+SDL_QuitQuit_Internal(void)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction action;
+ sigaction(SIGINT, NULL, &action);
+ if ( action.sa_handler == SDL_HandleSIG ) {
+ action.sa_handler = SIG_DFL;
+ sigaction(SIGINT, &action, NULL);
+ }
+ sigaction(SIGTERM, NULL, &action);
+ if ( action.sa_handler == SDL_HandleSIG ) {
+ action.sa_handler = SIG_DFL;
+ sigaction(SIGTERM, &action, NULL);
+ }
+#elif HAVE_SIGNAL_H
+ void (*ohandler) (int);
+
+ ohandler = signal(SIGINT, SIG_DFL);
+ if (ohandler != SDL_HandleSIG)
+ signal(SIGINT, ohandler);
+ ohandler = signal(SIGTERM, SIG_DFL);
+ if (ohandler != SDL_HandleSIG)
+ signal(SIGTERM, ohandler);
+#endif /* HAVE_SIGNAL_H */
+}
+
+void
+SDL_QuitQuit(void)
+{
+ if (!disable_signals) {
+ SDL_QuitQuit_Internal();
+ }
+}
+
+/* This function returns 1 if it's okay to close the application window */
+int
+SDL_SendQuit(void)
+{
+ send_quit_pending = SDL_FALSE;
+ return SDL_SendAppEvent(SDL_QUIT);
+}
+
+void
+SDL_SendPendingQuit(void)
+{
+ if (send_quit_pending) {
+ SDL_SendQuit();
+ SDL_assert(!send_quit_pending);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_sysevents.h b/src/3rdparty/SDL2/src/events/SDL_sysevents.h
new file mode 100644
index 0000000..3d9ab92
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_sysevents.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "../video/SDL_sysvideo.h"
+
+/* Useful functions and variables from SDL_sysevents.c */
+
+#if defined(__HAIKU__)
+/* The Haiku event loops run in a separate thread */
+#define MUST_THREAD_EVENTS
+#endif
+
+#ifdef __WIN32__ /* Windows doesn't allow a separate event thread */
+#define CANT_THREAD_EVENTS
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_touch.c b/src/3rdparty/SDL2/src/events/SDL_touch.c
new file mode 100644
index 0000000..0037416
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_touch.c
@@ -0,0 +1,375 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* General touch handling code for SDL */
+
+#include "SDL_assert.h"
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "../video/SDL_sysvideo.h"
+
+
+static int SDL_num_touch = 0;
+static SDL_Touch **SDL_touchDevices = NULL;
+
+
+/* Public functions */
+int
+SDL_TouchInit(void)
+{
+ return (0);
+}
+
+int
+SDL_GetNumTouchDevices(void)
+{
+ return SDL_num_touch;
+}
+
+SDL_TouchID
+SDL_GetTouchDevice(int index)
+{
+ if (index < 0 || index >= SDL_num_touch) {
+ SDL_SetError("Unknown touch device index %d", index);
+ return 0;
+ }
+ return SDL_touchDevices[index]->id;
+}
+
+static int
+SDL_GetTouchIndex(SDL_TouchID id)
+{
+ int index;
+ SDL_Touch *touch;
+
+ for (index = 0; index < SDL_num_touch; ++index) {
+ touch = SDL_touchDevices[index];
+ if (touch->id == id) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+SDL_Touch *
+SDL_GetTouch(SDL_TouchID id)
+{
+ int index = SDL_GetTouchIndex(id);
+ if (index < 0 || index >= SDL_num_touch) {
+ if (SDL_GetVideoDevice()->ResetTouch != NULL) {
+ SDL_SetError("Unknown touch id %d, resetting", (int) id);
+ (SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice());
+ } else {
+ SDL_SetError("Unknown touch device id %d, cannot reset", (int) id);
+ }
+ return NULL;
+ }
+ return SDL_touchDevices[index];
+}
+
+static int
+SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
+{
+ int index;
+ for (index = 0; index < touch->num_fingers; ++index) {
+ if (touch->fingers[index]->id == fingerid) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+static SDL_Finger *
+SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id)
+{
+ int index = SDL_GetFingerIndex(touch, id);
+ if (index < 0 || index >= touch->num_fingers) {
+ return NULL;
+ }
+ return touch->fingers[index];
+}
+
+int
+SDL_GetNumTouchFingers(SDL_TouchID touchID)
+{
+ SDL_Touch *touch = SDL_GetTouch(touchID);
+ if (touch) {
+ return touch->num_fingers;
+ }
+ return 0;
+}
+
+SDL_Finger *
+SDL_GetTouchFinger(SDL_TouchID touchID, int index)
+{
+ SDL_Touch *touch = SDL_GetTouch(touchID);
+ if (!touch) {
+ return NULL;
+ }
+ if (index < 0 || index >= touch->num_fingers) {
+ SDL_SetError("Unknown touch finger");
+ return NULL;
+ }
+ return touch->fingers[index];
+}
+
+int
+SDL_AddTouch(SDL_TouchID touchID, const char *name)
+{
+ SDL_Touch **touchDevices;
+ int index;
+
+ index = SDL_GetTouchIndex(touchID);
+ if (index >= 0) {
+ return index;
+ }
+
+ /* Add the touch to the list of touch */
+ touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices,
+ (SDL_num_touch + 1) * sizeof(*touchDevices));
+ if (!touchDevices) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_touchDevices = touchDevices;
+ index = SDL_num_touch;
+
+ SDL_touchDevices[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchDevices[index]));
+ if (!SDL_touchDevices[index]) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Added touch to list */
+ ++SDL_num_touch;
+
+ /* we're setting the touch properties */
+ SDL_touchDevices[index]->id = touchID;
+ SDL_touchDevices[index]->num_fingers = 0;
+ SDL_touchDevices[index]->max_fingers = 0;
+ SDL_touchDevices[index]->fingers = NULL;
+
+ /* Record this touch device for gestures */
+ /* We could do this on the fly in the gesture code if we wanted */
+ SDL_GestureAddTouch(touchID);
+
+ return index;
+}
+
+static int
+SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
+{
+ SDL_Finger *finger;
+
+ if (touch->num_fingers == touch->max_fingers) {
+ SDL_Finger **new_fingers;
+ new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers));
+ if (!new_fingers) {
+ return SDL_OutOfMemory();
+ }
+ touch->fingers = new_fingers;
+ touch->fingers[touch->max_fingers] = (SDL_Finger *)SDL_malloc(sizeof(*finger));
+ if (!touch->fingers[touch->max_fingers]) {
+ return SDL_OutOfMemory();
+ }
+ touch->max_fingers++;
+ }
+
+ finger = touch->fingers[touch->num_fingers++];
+ finger->id = fingerid;
+ finger->x = x;
+ finger->y = y;
+ finger->pressure = pressure;
+ return 0;
+}
+
+static int
+SDL_DelFinger(SDL_Touch* touch, SDL_FingerID fingerid)
+{
+ SDL_Finger *temp;
+
+ int index = SDL_GetFingerIndex(touch, fingerid);
+ if (index < 0) {
+ return -1;
+ }
+
+ touch->num_fingers--;
+ temp = touch->fingers[index];
+ touch->fingers[index] = touch->fingers[touch->num_fingers];
+ touch->fingers[touch->num_fingers] = temp;
+ return 0;
+}
+
+int
+SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
+ SDL_bool down, float x, float y, float pressure)
+{
+ int posted;
+ SDL_Finger *finger;
+
+ SDL_Touch* touch = SDL_GetTouch(id);
+ if (!touch) {
+ return -1;
+ }
+
+ finger = SDL_GetFinger(touch, fingerid);
+ if (down) {
+ if (finger) {
+ /* This finger is already down */
+ return 0;
+ }
+
+ if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) {
+ return 0;
+ }
+
+ posted = 0;
+ if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
+ SDL_Event event;
+ event.tfinger.type = SDL_FINGERDOWN;
+ event.tfinger.touchId = id;
+ event.tfinger.fingerId = fingerid;
+ event.tfinger.x = x;
+ event.tfinger.y = y;
+ event.tfinger.dx = 0;
+ event.tfinger.dy = 0;
+ event.tfinger.pressure = pressure;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ } else {
+ if (!finger) {
+ /* This finger is already up */
+ return 0;
+ }
+
+ posted = 0;
+ if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
+ SDL_Event event;
+ event.tfinger.type = SDL_FINGERUP;
+ event.tfinger.touchId = id;
+ event.tfinger.fingerId = fingerid;
+ /* I don't trust the coordinates passed on fingerUp */
+ event.tfinger.x = finger->x;
+ event.tfinger.y = finger->y;
+ event.tfinger.dx = 0;
+ event.tfinger.dy = 0;
+ event.tfinger.pressure = pressure;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+
+ SDL_DelFinger(touch, fingerid);
+ }
+ return posted;
+}
+
+int
+SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
+ float x, float y, float pressure)
+{
+ SDL_Touch *touch;
+ SDL_Finger *finger;
+ int posted;
+ float xrel, yrel, prel;
+
+ touch = SDL_GetTouch(id);
+ if (!touch) {
+ return -1;
+ }
+
+ finger = SDL_GetFinger(touch,fingerid);
+ if (!finger) {
+ return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure);
+ }
+
+ xrel = x - finger->x;
+ yrel = y - finger->y;
+ prel = pressure - finger->pressure;
+
+ /* Drop events that don't change state */
+ if (!xrel && !yrel && !prel) {
+#if 0
+ printf("Touch event didn't change state - dropped!\n");
+#endif
+ return 0;
+ }
+
+ /* Update internal touch coordinates */
+ finger->x = x;
+ finger->y = y;
+ finger->pressure = pressure;
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
+ SDL_Event event;
+ event.tfinger.type = SDL_FINGERMOTION;
+ event.tfinger.touchId = id;
+ event.tfinger.fingerId = fingerid;
+ event.tfinger.x = x;
+ event.tfinger.y = y;
+ event.tfinger.dx = xrel;
+ event.tfinger.dy = yrel;
+ event.tfinger.pressure = pressure;
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+ return posted;
+}
+
+void
+SDL_DelTouch(SDL_TouchID id)
+{
+ int i;
+ int index = SDL_GetTouchIndex(id);
+ SDL_Touch *touch = SDL_GetTouch(id);
+
+ if (!touch) {
+ return;
+ }
+
+ for (i = 0; i < touch->max_fingers; ++i) {
+ SDL_free(touch->fingers[i]);
+ }
+ SDL_free(touch->fingers);
+ SDL_free(touch);
+
+ SDL_num_touch--;
+ SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch];
+
+ /* Delete this touch device for gestures */
+ SDL_GestureDelTouch(id);
+}
+
+void
+SDL_TouchQuit(void)
+{
+ int i;
+
+ for (i = SDL_num_touch; i--; ) {
+ SDL_DelTouch(SDL_touchDevices[i]->id);
+ }
+ SDL_assert(SDL_num_touch == 0);
+
+ SDL_free(SDL_touchDevices);
+ SDL_touchDevices = NULL;
+ SDL_GestureQuit();
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_touch_c.h b/src/3rdparty/SDL2/src/events/SDL_touch_c.h
new file mode 100644
index 0000000..2a44310
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_touch_c.h
@@ -0,0 +1,61 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+#include "../../include/SDL_touch.h"
+
+#ifndef SDL_touch_c_h_
+#define SDL_touch_c_h_
+
+typedef struct SDL_Touch
+{
+ SDL_TouchID id;
+ int num_fingers;
+ int max_fingers;
+ SDL_Finger** fingers;
+} SDL_Touch;
+
+
+/* Initialize the touch subsystem */
+extern int SDL_TouchInit(void);
+
+/* Add a touch, returning the index of the touch, or -1 if there was an error. */
+extern int SDL_AddTouch(SDL_TouchID id, const char *name);
+
+/* Get the touch with a given id */
+extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
+
+/* Send a touch down/up event for a touch */
+extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
+ SDL_bool down, float x, float y, float pressure);
+
+/* Send a touch motion event for a touch */
+extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
+ float x, float y, float pressure);
+
+/* Remove a touch */
+extern void SDL_DelTouch(SDL_TouchID id);
+
+/* Shutdown the touch subsystem */
+extern void SDL_TouchQuit(void);
+
+#endif /* SDL_touch_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_windowevents.c b/src/3rdparty/SDL2/src/events/SDL_windowevents.c
new file mode 100644
index 0000000..610fad5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_windowevents.c
@@ -0,0 +1,228 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Window event handling code for SDL */
+
+#include "SDL_events.h"
+#include "SDL_events_c.h"
+#include "SDL_mouse_c.h"
+#include "../video/SDL_sysvideo.h"
+
+
+static int SDLCALL
+RemovePendingResizedEvents(void * userdata, SDL_Event *event)
+{
+ SDL_Event *new_event = (SDL_Event *)userdata;
+
+ if (event->type == SDL_WINDOWEVENT &&
+ event->window.event == SDL_WINDOWEVENT_RESIZED &&
+ event->window.windowID == new_event->window.windowID) {
+ /* We're about to post a new size event, drop the old one */
+ return 0;
+ }
+ return 1;
+}
+
+static int SDLCALL
+RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event)
+{
+ SDL_Event *new_event = (SDL_Event *)userdata;
+
+ if (event->type == SDL_WINDOWEVENT &&
+ event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED &&
+ event->window.windowID == new_event->window.windowID) {
+ /* We're about to post a new size event, drop the old one */
+ return 0;
+ }
+ return 1;
+}
+
+static int SDLCALL
+RemovePendingMoveEvents(void * userdata, SDL_Event *event)
+{
+ SDL_Event *new_event = (SDL_Event *)userdata;
+
+ if (event->type == SDL_WINDOWEVENT &&
+ event->window.event == SDL_WINDOWEVENT_MOVED &&
+ event->window.windowID == new_event->window.windowID) {
+ /* We're about to post a new move event, drop the old one */
+ return 0;
+ }
+ return 1;
+}
+
+static int SDLCALL
+RemovePendingExposedEvents(void * userdata, SDL_Event *event)
+{
+ SDL_Event *new_event = (SDL_Event *)userdata;
+
+ if (event->type == SDL_WINDOWEVENT &&
+ event->window.event == SDL_WINDOWEVENT_EXPOSED &&
+ event->window.windowID == new_event->window.windowID) {
+ /* We're about to post a new exposed event, drop the old one */
+ return 0;
+ }
+ return 1;
+}
+
+int
+SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
+ int data2)
+{
+ int posted;
+
+ if (!window) {
+ return 0;
+ }
+ switch (windowevent) {
+ case SDL_WINDOWEVENT_SHOWN:
+ if (window->flags & SDL_WINDOW_SHOWN) {
+ return 0;
+ }
+ window->flags &= ~SDL_WINDOW_HIDDEN;
+ window->flags |= SDL_WINDOW_SHOWN;
+ SDL_OnWindowShown(window);
+ break;
+ case SDL_WINDOWEVENT_HIDDEN:
+ if (!(window->flags & SDL_WINDOW_SHOWN)) {
+ return 0;
+ }
+ window->flags &= ~SDL_WINDOW_SHOWN;
+ window->flags |= SDL_WINDOW_HIDDEN;
+ SDL_OnWindowHidden(window);
+ break;
+ case SDL_WINDOWEVENT_MOVED:
+ if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
+ SDL_WINDOWPOS_ISUNDEFINED(data2)) {
+ return 0;
+ }
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ window->windowed.x = data1;
+ window->windowed.y = data2;
+ }
+ if (data1 == window->x && data2 == window->y) {
+ return 0;
+ }
+ window->x = data1;
+ window->y = data2;
+ break;
+ case SDL_WINDOWEVENT_RESIZED:
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ window->windowed.w = data1;
+ window->windowed.h = data2;
+ }
+ if (data1 == window->w && data2 == window->h) {
+ return 0;
+ }
+ window->w = data1;
+ window->h = data2;
+ SDL_OnWindowResized(window);
+ break;
+ case SDL_WINDOWEVENT_MINIMIZED:
+ if (window->flags & SDL_WINDOW_MINIMIZED) {
+ return 0;
+ }
+ window->flags &= ~SDL_WINDOW_MAXIMIZED;
+ window->flags |= SDL_WINDOW_MINIMIZED;
+ SDL_OnWindowMinimized(window);
+ break;
+ case SDL_WINDOWEVENT_MAXIMIZED:
+ if (window->flags & SDL_WINDOW_MAXIMIZED) {
+ return 0;
+ }
+ window->flags &= ~SDL_WINDOW_MINIMIZED;
+ window->flags |= SDL_WINDOW_MAXIMIZED;
+ break;
+ case SDL_WINDOWEVENT_RESTORED:
+ if (!(window->flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {
+ return 0;
+ }
+ window->flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED);
+ SDL_OnWindowRestored(window);
+ break;
+ case SDL_WINDOWEVENT_ENTER:
+ if (window->flags & SDL_WINDOW_MOUSE_FOCUS) {
+ return 0;
+ }
+ window->flags |= SDL_WINDOW_MOUSE_FOCUS;
+ SDL_OnWindowEnter(window);
+ break;
+ case SDL_WINDOWEVENT_LEAVE:
+ if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) {
+ return 0;
+ }
+ window->flags &= ~SDL_WINDOW_MOUSE_FOCUS;
+ SDL_OnWindowLeave(window);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_GAINED:
+ if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
+ return 0;
+ }
+ window->flags |= SDL_WINDOW_INPUT_FOCUS;
+ SDL_OnWindowFocusGained(window);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_LOST:
+ if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
+ return 0;
+ }
+ window->flags &= ~SDL_WINDOW_INPUT_FOCUS;
+ SDL_OnWindowFocusLost(window);
+ break;
+ }
+
+ /* Post the event, if desired */
+ posted = 0;
+ if (SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = SDL_WINDOWEVENT;
+ event.window.event = windowevent;
+ event.window.data1 = data1;
+ event.window.data2 = data2;
+ event.window.windowID = window->id;
+
+ /* Fixes queue overflow with resize events that aren't processed */
+ if (windowevent == SDL_WINDOWEVENT_RESIZED) {
+ SDL_FilterEvents(RemovePendingResizedEvents, &event);
+ }
+ if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
+ SDL_FilterEvents(RemovePendingSizeChangedEvents, &event);
+ }
+ if (windowevent == SDL_WINDOWEVENT_MOVED) {
+ SDL_FilterEvents(RemovePendingMoveEvents, &event);
+ }
+ if (windowevent == SDL_WINDOWEVENT_EXPOSED) {
+ SDL_FilterEvents(RemovePendingExposedEvents, &event);
+ }
+ posted = (SDL_PushEvent(&event) > 0);
+ }
+
+ if (windowevent == SDL_WINDOWEVENT_CLOSE) {
+ if ( !window->prev && !window->next ) {
+ /* This is the last window in the list so send the SDL_QUIT event */
+ SDL_SendQuit();
+ }
+ }
+
+ return (posted);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/SDL_windowevents_c.h b/src/3rdparty/SDL2/src/events/SDL_windowevents_c.h
new file mode 100644
index 0000000..a529a11
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/SDL_windowevents_c.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_windowevents_c_h_
+#define SDL_windowevents_c_h_
+
+extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent,
+ int data1, int data2);
+
+#endif /* SDL_windowevents_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/blank_cursor.h b/src/3rdparty/SDL2/src/events/blank_cursor.h
new file mode 100644
index 0000000..bc1bffa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/blank_cursor.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * A default blank 8x8 cursor */
+
+#define BLANK_CWIDTH 8
+#define BLANK_CHEIGHT 8
+#define BLANK_CHOTX 0
+#define BLANK_CHOTY 0
+
+static const unsigned char blank_cdata[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+static const unsigned char blank_cmask[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/default_cursor.h b/src/3rdparty/SDL2/src/events/default_cursor.h
new file mode 100644
index 0000000..27e82ff
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/default_cursor.h
@@ -0,0 +1,114 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Default cursor - it happens to be the Mac cursor, but could be anything */
+
+#define DEFAULT_CWIDTH 16
+#define DEFAULT_CHEIGHT 16
+#define DEFAULT_CHOTX 0
+#define DEFAULT_CHOTY 0
+
+/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrire */
+#define USE_MACOS_CURSOR
+
+#ifdef USE_MACOS_CURSOR
+
+static const unsigned char default_cdata[] = {
+ 0x00, 0x00,
+ 0x40, 0x00,
+ 0x60, 0x00,
+ 0x70, 0x00,
+ 0x78, 0x00,
+ 0x7C, 0x00,
+ 0x7E, 0x00,
+ 0x7F, 0x00,
+ 0x7F, 0x80,
+ 0x7C, 0x00,
+ 0x6C, 0x00,
+ 0x46, 0x00,
+ 0x06, 0x00,
+ 0x03, 0x00,
+ 0x03, 0x00,
+ 0x00, 0x00
+};
+
+static const unsigned char default_cmask[] = {
+ 0xC0, 0x00,
+ 0xE0, 0x00,
+ 0xF0, 0x00,
+ 0xF8, 0x00,
+ 0xFC, 0x00,
+ 0xFE, 0x00,
+ 0xFF, 0x00,
+ 0xFF, 0x80,
+ 0xFF, 0xC0,
+ 0xFF, 0xE0,
+ 0xFE, 0x00,
+ 0xEF, 0x00,
+ 0xCF, 0x00,
+ 0x87, 0x80,
+ 0x07, 0x80,
+ 0x03, 0x00
+};
+
+#else
+
+static const unsigned char default_cdata[] = {
+ 0x00, 0x00,
+ 0x40, 0x00,
+ 0x60, 0x00,
+ 0x70, 0x00,
+ 0x78, 0x00,
+ 0x7C, 0x00,
+ 0x7E, 0x00,
+ 0x7F, 0x00,
+ 0x7F, 0x80,
+ 0x7C, 0x00,
+ 0x6C, 0x00,
+ 0x46, 0x00,
+ 0x06, 0x00,
+ 0x03, 0x00,
+ 0x03, 0x00,
+ 0x00, 0x00
+};
+
+static const unsigned char default_cmask[] = {
+ 0x40, 0x00,
+ 0xE0, 0x00,
+ 0xF0, 0x00,
+ 0xF8, 0x00,
+ 0xFC, 0x00,
+ 0xFE, 0x00,
+ 0xFF, 0x00,
+ 0xFF, 0x80,
+ 0xFF, 0xC0,
+ 0xFF, 0x80,
+ 0xFE, 0x00,
+ 0xEF, 0x00,
+ 0x4F, 0x00,
+ 0x07, 0x80,
+ 0x07, 0x80,
+ 0x03, 0x00
+};
+
+#endif /* USE_MACOS_CURSOR */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/events/scancodes_darwin.h b/src/3rdparty/SDL2/src/events/scancodes_darwin.h
new file mode 100644
index 0000000..7848d86
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/scancodes_darwin.h
@@ -0,0 +1,159 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* Mac virtual key code to SDL scancode mapping table
+ Sources:
+ - Inside Macintosh: Text <http://developer.apple.com/documentation/mac/Text/Text-571.html>
+ - Apple USB keyboard driver source <http://darwinsource.opendarwin.org/10.4.6.ppc/IOHIDFamily-172.8/IOHIDFamily/Cosmo_USB2ADB.c>
+ - experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard
+*/
+/* *INDENT-OFF* */
+static const SDL_Scancode darwin_scancode_table[] = {
+ /* 0 */ SDL_SCANCODE_A,
+ /* 1 */ SDL_SCANCODE_S,
+ /* 2 */ SDL_SCANCODE_D,
+ /* 3 */ SDL_SCANCODE_F,
+ /* 4 */ SDL_SCANCODE_H,
+ /* 5 */ SDL_SCANCODE_G,
+ /* 6 */ SDL_SCANCODE_Z,
+ /* 7 */ SDL_SCANCODE_X,
+ /* 8 */ SDL_SCANCODE_C,
+ /* 9 */ SDL_SCANCODE_V,
+ /* 10 */ SDL_SCANCODE_NONUSBACKSLASH, /* SDL_SCANCODE_NONUSBACKSLASH on ANSI and JIS keyboards (if this key would exist there), SDL_SCANCODE_GRAVE on ISO. (The USB keyboard driver actually translates these usage codes to different virtual key codes depending on whether the keyboard is ISO/ANSI/JIS. That's why you have to help it identify the keyboard type when you plug in a PC USB keyboard. It's a historical thing - ADB keyboards are wired this way.) */
+ /* 11 */ SDL_SCANCODE_B,
+ /* 12 */ SDL_SCANCODE_Q,
+ /* 13 */ SDL_SCANCODE_W,
+ /* 14 */ SDL_SCANCODE_E,
+ /* 15 */ SDL_SCANCODE_R,
+ /* 16 */ SDL_SCANCODE_Y,
+ /* 17 */ SDL_SCANCODE_T,
+ /* 18 */ SDL_SCANCODE_1,
+ /* 19 */ SDL_SCANCODE_2,
+ /* 20 */ SDL_SCANCODE_3,
+ /* 21 */ SDL_SCANCODE_4,
+ /* 22 */ SDL_SCANCODE_6,
+ /* 23 */ SDL_SCANCODE_5,
+ /* 24 */ SDL_SCANCODE_EQUALS,
+ /* 25 */ SDL_SCANCODE_9,
+ /* 26 */ SDL_SCANCODE_7,
+ /* 27 */ SDL_SCANCODE_MINUS,
+ /* 28 */ SDL_SCANCODE_8,
+ /* 29 */ SDL_SCANCODE_0,
+ /* 30 */ SDL_SCANCODE_RIGHTBRACKET,
+ /* 31 */ SDL_SCANCODE_O,
+ /* 32 */ SDL_SCANCODE_U,
+ /* 33 */ SDL_SCANCODE_LEFTBRACKET,
+ /* 34 */ SDL_SCANCODE_I,
+ /* 35 */ SDL_SCANCODE_P,
+ /* 36 */ SDL_SCANCODE_RETURN,
+ /* 37 */ SDL_SCANCODE_L,
+ /* 38 */ SDL_SCANCODE_J,
+ /* 39 */ SDL_SCANCODE_APOSTROPHE,
+ /* 40 */ SDL_SCANCODE_K,
+ /* 41 */ SDL_SCANCODE_SEMICOLON,
+ /* 42 */ SDL_SCANCODE_BACKSLASH,
+ /* 43 */ SDL_SCANCODE_COMMA,
+ /* 44 */ SDL_SCANCODE_SLASH,
+ /* 45 */ SDL_SCANCODE_N,
+ /* 46 */ SDL_SCANCODE_M,
+ /* 47 */ SDL_SCANCODE_PERIOD,
+ /* 48 */ SDL_SCANCODE_TAB,
+ /* 49 */ SDL_SCANCODE_SPACE,
+ /* 50 */ SDL_SCANCODE_GRAVE, /* SDL_SCANCODE_GRAVE on ANSI and JIS keyboards, SDL_SCANCODE_NONUSBACKSLASH on ISO (see comment about virtual key code 10 above) */
+ /* 51 */ SDL_SCANCODE_BACKSPACE,
+ /* 52 */ SDL_SCANCODE_KP_ENTER, /* keyboard enter on portables */
+ /* 53 */ SDL_SCANCODE_ESCAPE,
+ /* 54 */ SDL_SCANCODE_RGUI,
+ /* 55 */ SDL_SCANCODE_LGUI,
+ /* 56 */ SDL_SCANCODE_LSHIFT,
+ /* 57 */ SDL_SCANCODE_CAPSLOCK,
+ /* 58 */ SDL_SCANCODE_LALT,
+ /* 59 */ SDL_SCANCODE_LCTRL,
+ /* 60 */ SDL_SCANCODE_RSHIFT,
+ /* 61 */ SDL_SCANCODE_RALT,
+ /* 62 */ SDL_SCANCODE_RCTRL,
+ /* 63 */ SDL_SCANCODE_RGUI, /* fn on portables, acts as a hardware-level modifier already, so we don't generate events for it, also XK_Meta_R */
+ /* 64 */ SDL_SCANCODE_F17,
+ /* 65 */ SDL_SCANCODE_KP_PERIOD,
+ /* 66 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 67 */ SDL_SCANCODE_KP_MULTIPLY,
+ /* 68 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 69 */ SDL_SCANCODE_KP_PLUS,
+ /* 70 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 71 */ SDL_SCANCODE_NUMLOCKCLEAR,
+ /* 72 */ SDL_SCANCODE_VOLUMEUP,
+ /* 73 */ SDL_SCANCODE_VOLUMEDOWN,
+ /* 74 */ SDL_SCANCODE_MUTE,
+ /* 75 */ SDL_SCANCODE_KP_DIVIDE,
+ /* 76 */ SDL_SCANCODE_KP_ENTER, /* keypad enter on external keyboards, fn-return on portables */
+ /* 77 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 78 */ SDL_SCANCODE_KP_MINUS,
+ /* 79 */ SDL_SCANCODE_F18,
+ /* 80 */ SDL_SCANCODE_F19,
+ /* 81 */ SDL_SCANCODE_KP_EQUALS,
+ /* 82 */ SDL_SCANCODE_KP_0,
+ /* 83 */ SDL_SCANCODE_KP_1,
+ /* 84 */ SDL_SCANCODE_KP_2,
+ /* 85 */ SDL_SCANCODE_KP_3,
+ /* 86 */ SDL_SCANCODE_KP_4,
+ /* 87 */ SDL_SCANCODE_KP_5,
+ /* 88 */ SDL_SCANCODE_KP_6,
+ /* 89 */ SDL_SCANCODE_KP_7,
+ /* 90 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 91 */ SDL_SCANCODE_KP_8,
+ /* 92 */ SDL_SCANCODE_KP_9,
+ /* 93 */ SDL_SCANCODE_INTERNATIONAL3, /* Cosmo_USB2ADB.c says "Yen (JIS)" */
+ /* 94 */ SDL_SCANCODE_INTERNATIONAL1, /* Cosmo_USB2ADB.c says "Ro (JIS)" */
+ /* 95 */ SDL_SCANCODE_KP_COMMA, /* Cosmo_USB2ADB.c says ", JIS only" */
+ /* 96 */ SDL_SCANCODE_F5,
+ /* 97 */ SDL_SCANCODE_F6,
+ /* 98 */ SDL_SCANCODE_F7,
+ /* 99 */ SDL_SCANCODE_F3,
+ /* 100 */ SDL_SCANCODE_F8,
+ /* 101 */ SDL_SCANCODE_F9,
+ /* 102 */ SDL_SCANCODE_LANG2, /* Cosmo_USB2ADB.c says "Eisu" */
+ /* 103 */ SDL_SCANCODE_F11,
+ /* 104 */ SDL_SCANCODE_LANG1, /* Cosmo_USB2ADB.c says "Kana" */
+ /* 105 */ SDL_SCANCODE_PRINTSCREEN, /* On ADB keyboards, this key is labeled "F13/print screen". Problem: USB has different usage codes for these two functions. On Apple USB keyboards, the key is labeled "F13" and sends the F13 usage code (SDL_SCANCODE_F13). I decided to use SDL_SCANCODE_PRINTSCREEN here nevertheless since SDL applications are more likely to assume the presence of a print screen key than an F13 key. */
+ /* 106 */ SDL_SCANCODE_F16,
+ /* 107 */ SDL_SCANCODE_SCROLLLOCK, /* F14/scroll lock, see comment about F13/print screen above */
+ /* 108 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 109 */ SDL_SCANCODE_F10,
+ /* 110 */ SDL_SCANCODE_APPLICATION, /* windows contextual menu key, fn-enter on portables */
+ /* 111 */ SDL_SCANCODE_F12,
+ /* 112 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
+ /* 113 */ SDL_SCANCODE_PAUSE, /* F15/pause, see comment about F13/print screen above */
+ /* 114 */ SDL_SCANCODE_INSERT, /* the key is actually labeled "help" on Apple keyboards, and works as such in Mac OS, but it sends the "insert" usage code even on Apple USB keyboards */
+ /* 115 */ SDL_SCANCODE_HOME,
+ /* 116 */ SDL_SCANCODE_PAGEUP,
+ /* 117 */ SDL_SCANCODE_DELETE,
+ /* 118 */ SDL_SCANCODE_F4,
+ /* 119 */ SDL_SCANCODE_END,
+ /* 120 */ SDL_SCANCODE_F2,
+ /* 121 */ SDL_SCANCODE_PAGEDOWN,
+ /* 122 */ SDL_SCANCODE_F1,
+ /* 123 */ SDL_SCANCODE_LEFT,
+ /* 124 */ SDL_SCANCODE_RIGHT,
+ /* 125 */ SDL_SCANCODE_DOWN,
+ /* 126 */ SDL_SCANCODE_UP,
+ /* 127 */ SDL_SCANCODE_POWER
+};
+/* *INDENT-ON* */
diff --git a/src/3rdparty/SDL2/src/events/scancodes_linux.h b/src/3rdparty/SDL2/src/events/scancodes_linux.h
new file mode 100644
index 0000000..3fec4b5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/scancodes_linux.h
@@ -0,0 +1,263 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../include/SDL_scancode.h"
+
+/* Linux virtual key code to SDL_Keycode mapping table
+ Sources:
+ - Linux kernel source input.h
+*/
+/* *INDENT-OFF* */
+static SDL_Scancode const linux_scancode_table[] = {
+ /* 0 */ SDL_SCANCODE_UNKNOWN,
+ /* 1 */ SDL_SCANCODE_ESCAPE,
+ /* 2 */ SDL_SCANCODE_1,
+ /* 3 */ SDL_SCANCODE_2,
+ /* 4 */ SDL_SCANCODE_3,
+ /* 5 */ SDL_SCANCODE_4,
+ /* 6 */ SDL_SCANCODE_5,
+ /* 7 */ SDL_SCANCODE_6,
+ /* 8 */ SDL_SCANCODE_7,
+ /* 9 */ SDL_SCANCODE_8,
+ /* 10 */ SDL_SCANCODE_9,
+ /* 11 */ SDL_SCANCODE_0,
+ /* 12 */ SDL_SCANCODE_MINUS,
+ /* 13 */ SDL_SCANCODE_EQUALS,
+ /* 14 */ SDL_SCANCODE_BACKSPACE,
+ /* 15 */ SDL_SCANCODE_TAB,
+ /* 16 */ SDL_SCANCODE_Q,
+ /* 17 */ SDL_SCANCODE_W,
+ /* 18 */ SDL_SCANCODE_E,
+ /* 19 */ SDL_SCANCODE_R,
+ /* 20 */ SDL_SCANCODE_T,
+ /* 21 */ SDL_SCANCODE_Y,
+ /* 22 */ SDL_SCANCODE_U,
+ /* 23 */ SDL_SCANCODE_I,
+ /* 24 */ SDL_SCANCODE_O,
+ /* 25 */ SDL_SCANCODE_P,
+ /* 26 */ SDL_SCANCODE_LEFTBRACKET,
+ /* 27 */ SDL_SCANCODE_RIGHTBRACKET,
+ /* 28 */ SDL_SCANCODE_RETURN,
+ /* 29 */ SDL_SCANCODE_LCTRL,
+ /* 30 */ SDL_SCANCODE_A,
+ /* 31 */ SDL_SCANCODE_S,
+ /* 32 */ SDL_SCANCODE_D,
+ /* 33 */ SDL_SCANCODE_F,
+ /* 34 */ SDL_SCANCODE_G,
+ /* 35 */ SDL_SCANCODE_H,
+ /* 36 */ SDL_SCANCODE_J,
+ /* 37 */ SDL_SCANCODE_K,
+ /* 38 */ SDL_SCANCODE_L,
+ /* 39 */ SDL_SCANCODE_SEMICOLON,
+ /* 40 */ SDL_SCANCODE_APOSTROPHE,
+ /* 41 */ SDL_SCANCODE_GRAVE,
+ /* 42 */ SDL_SCANCODE_LSHIFT,
+ /* 43 */ SDL_SCANCODE_BACKSLASH,
+ /* 44 */ SDL_SCANCODE_Z,
+ /* 45 */ SDL_SCANCODE_X,
+ /* 46 */ SDL_SCANCODE_C,
+ /* 47 */ SDL_SCANCODE_V,
+ /* 48 */ SDL_SCANCODE_B,
+ /* 49 */ SDL_SCANCODE_N,
+ /* 50 */ SDL_SCANCODE_M,
+ /* 51 */ SDL_SCANCODE_COMMA,
+ /* 52 */ SDL_SCANCODE_PERIOD,
+ /* 53 */ SDL_SCANCODE_SLASH,
+ /* 54 */ SDL_SCANCODE_RSHIFT,
+ /* 55 */ SDL_SCANCODE_KP_MULTIPLY,
+ /* 56 */ SDL_SCANCODE_LALT,
+ /* 57 */ SDL_SCANCODE_SPACE,
+ /* 58 */ SDL_SCANCODE_CAPSLOCK,
+ /* 59 */ SDL_SCANCODE_F1,
+ /* 60 */ SDL_SCANCODE_F2,
+ /* 61 */ SDL_SCANCODE_F3,
+ /* 62 */ SDL_SCANCODE_F4,
+ /* 63 */ SDL_SCANCODE_F5,
+ /* 64 */ SDL_SCANCODE_F6,
+ /* 65 */ SDL_SCANCODE_F7,
+ /* 66 */ SDL_SCANCODE_F8,
+ /* 67 */ SDL_SCANCODE_F9,
+ /* 68 */ SDL_SCANCODE_F10,
+ /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR,
+ /* 70 */ SDL_SCANCODE_SCROLLLOCK,
+ /* 71 */ SDL_SCANCODE_KP_7,
+ /* 72 */ SDL_SCANCODE_KP_8,
+ /* 73 */ SDL_SCANCODE_KP_9,
+ /* 74 */ SDL_SCANCODE_KP_MINUS,
+ /* 75 */ SDL_SCANCODE_KP_4,
+ /* 76 */ SDL_SCANCODE_KP_5,
+ /* 77 */ SDL_SCANCODE_KP_6,
+ /* 78 */ SDL_SCANCODE_KP_PLUS,
+ /* 79 */ SDL_SCANCODE_KP_1,
+ /* 80 */ SDL_SCANCODE_KP_2,
+ /* 81 */ SDL_SCANCODE_KP_3,
+ /* 82 */ SDL_SCANCODE_KP_0,
+ /* 83 */ SDL_SCANCODE_KP_PERIOD,
+ 0,
+ /* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */
+ /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */
+ /* 87 */ SDL_SCANCODE_F11,
+ /* 88 */ SDL_SCANCODE_F12,
+ /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* KEY_RO */
+ /* 90 */ SDL_SCANCODE_LANG3, /* KEY_KATAKANA */
+ /* 91 */ SDL_SCANCODE_LANG4, /* KEY_HIRAGANA */
+ /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* KEY_HENKAN */
+ /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* KEY_KATAKANAHIRAGANA */
+ /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_MUHENKAN */
+ /* 95 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_KPJPCOMMA */
+ /* 96 */ SDL_SCANCODE_KP_ENTER,
+ /* 97 */ SDL_SCANCODE_RCTRL,
+ /* 98 */ SDL_SCANCODE_KP_DIVIDE,
+ /* 99 */ SDL_SCANCODE_SYSREQ,
+ /* 100 */ SDL_SCANCODE_RALT,
+ /* 101 */ SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED */
+ /* 102 */ SDL_SCANCODE_HOME,
+ /* 103 */ SDL_SCANCODE_UP,
+ /* 104 */ SDL_SCANCODE_PAGEUP,
+ /* 105 */ SDL_SCANCODE_LEFT,
+ /* 106 */ SDL_SCANCODE_RIGHT,
+ /* 107 */ SDL_SCANCODE_END,
+ /* 108 */ SDL_SCANCODE_DOWN,
+ /* 109 */ SDL_SCANCODE_PAGEDOWN,
+ /* 110 */ SDL_SCANCODE_INSERT,
+ /* 111 */ SDL_SCANCODE_DELETE,
+ /* 112 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO */
+ /* 113 */ SDL_SCANCODE_MUTE,
+ /* 114 */ SDL_SCANCODE_VOLUMEDOWN,
+ /* 115 */ SDL_SCANCODE_VOLUMEUP,
+ /* 116 */ SDL_SCANCODE_POWER,
+ /* 117 */ SDL_SCANCODE_KP_EQUALS,
+ /* 118 */ SDL_SCANCODE_KP_PLUSMINUS,
+ /* 119 */ SDL_SCANCODE_PAUSE,
+ 0,
+ /* 121 */ SDL_SCANCODE_KP_COMMA,
+ /* 122 */ SDL_SCANCODE_LANG1, /* KEY_HANGUEL */
+ /* 123 */ SDL_SCANCODE_LANG2, /* KEY_HANJA */
+ /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */
+ /* 125 */ SDL_SCANCODE_LGUI,
+ /* 126 */ SDL_SCANCODE_RGUI,
+ /* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */
+ /* 128 */ SDL_SCANCODE_STOP,
+ /* 129 */ SDL_SCANCODE_AGAIN,
+ /* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */
+ /* 131 */ SDL_SCANCODE_UNDO,
+ /* 132 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRONT */
+ /* 133 */ SDL_SCANCODE_COPY,
+ /* 134 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPEN */
+ /* 135 */ SDL_SCANCODE_PASTE,
+ /* 136 */ SDL_SCANCODE_FIND,
+ /* 137 */ SDL_SCANCODE_CUT,
+ /* 138 */ SDL_SCANCODE_HELP,
+ /* 139 */ SDL_SCANCODE_MENU,
+ /* 140 */ SDL_SCANCODE_CALCULATOR,
+ /* 141 */ SDL_SCANCODE_UNKNOWN, /* KEY_SETUP */
+ /* 142 */ SDL_SCANCODE_SLEEP,
+ /* 143 */ SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP */
+ /* 144 */ SDL_SCANCODE_UNKNOWN, /* KEY_FILE */
+ /* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */
+ /* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */
+ /* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */
+ /* 148 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */
+ /* 149 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */
+ /* 150 */ SDL_SCANCODE_WWW, /* KEY_WWW */
+ /* 151 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */
+ /* 152 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */
+ /* 153 */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION */
+ /* 154 */ SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS */
+ /* 155 */ SDL_SCANCODE_MAIL,
+ /* 156 */ SDL_SCANCODE_AC_BOOKMARKS,
+ /* 157 */ SDL_SCANCODE_COMPUTER,
+ /* 158 */ SDL_SCANCODE_AC_BACK,
+ /* 159 */ SDL_SCANCODE_AC_FORWARD,
+ /* 160 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD */
+ /* 161 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCD */
+ /* 162 */ SDL_SCANCODE_UNKNOWN, /* KEY_EJECTCLOSECD */
+ /* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */
+ /* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */
+ /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */
+ /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */
+ /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */
+ /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */
+ /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */
+ /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */
+ /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */
+ /* 172 */ SDL_SCANCODE_AC_HOME,
+ /* 173 */ SDL_SCANCODE_AC_REFRESH,
+ /* 174 */ SDL_SCANCODE_UNKNOWN, /* KEY_EXIT */
+ /* 175 */ SDL_SCANCODE_UNKNOWN, /* KEY_MOVE */
+ /* 176 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDIT */
+ /* 177 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP */
+ /* 178 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN */
+ /* 179 */ SDL_SCANCODE_KP_LEFTPAREN,
+ /* 180 */ SDL_SCANCODE_KP_RIGHTPAREN,
+ /* 181 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEW */
+ /* 182 */ SDL_SCANCODE_UNKNOWN, /* KEY_REDO */
+ /* 183 */ SDL_SCANCODE_F13,
+ /* 184 */ SDL_SCANCODE_F14,
+ /* 185 */ SDL_SCANCODE_F15,
+ /* 186 */ SDL_SCANCODE_F16,
+ /* 187 */ SDL_SCANCODE_F17,
+ /* 188 */ SDL_SCANCODE_F18,
+ /* 189 */ SDL_SCANCODE_F19,
+ /* 190 */ SDL_SCANCODE_F20,
+ /* 191 */ SDL_SCANCODE_F21,
+ /* 192 */ SDL_SCANCODE_F22,
+ /* 193 */ SDL_SCANCODE_F23,
+ /* 194 */ SDL_SCANCODE_F24,
+ 0, 0, 0, 0, 0,
+ /* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */
+ /* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */
+ /* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */
+ /* 203 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 */
+ 0,
+ /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */
+ /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */
+ /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */
+ /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */
+ /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */
+ /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */
+ /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */
+ /* 212 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA */
+ /* 213 */ SDL_SCANCODE_UNKNOWN, /* KEY_SOUND */
+ /* 214 */ SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION */
+ /* 215 */ SDL_SCANCODE_UNKNOWN, /* KEY_EMAIL */
+ /* 216 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHAT */
+ /* 217 */ SDL_SCANCODE_AC_SEARCH,
+ /* 218 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT */
+ /* 219 */ SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE */
+ /* 220 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPORT */
+ /* 221 */ SDL_SCANCODE_UNKNOWN, /* KEY_SHOP */
+ /* 222 */ SDL_SCANCODE_ALTERASE,
+ /* 223 */ SDL_SCANCODE_CANCEL,
+ /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN,
+ /* 225 */ SDL_SCANCODE_BRIGHTNESSUP,
+ /* 226 */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA */
+ /* 227 */ SDL_SCANCODE_DISPLAYSWITCH, /* KEY_SWITCHVIDEOMODE */
+ /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE,
+ /* 229 */ SDL_SCANCODE_KBDILLUMDOWN,
+ /* 230 */ SDL_SCANCODE_KBDILLUMUP,
+ /* 231 */ SDL_SCANCODE_UNKNOWN, /* KEY_SEND */
+ /* 232 */ SDL_SCANCODE_UNKNOWN, /* KEY_REPLY */
+ /* 233 */ SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL */
+ /* 234 */ SDL_SCANCODE_UNKNOWN, /* KEY_SAVE */
+ /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */
+ /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */
+};
+/* *INDENT-ON* */
diff --git a/src/3rdparty/SDL2/src/events/scancodes_windows.h b/src/3rdparty/SDL2/src/events/scancodes_windows.h
new file mode 100644
index 0000000..f8eed1b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/scancodes_windows.h
@@ -0,0 +1,55 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../include/SDL_scancode.h"
+
+/* Windows scancode to SDL scancode mapping table */
+/* derived from Microsoft scan code document, http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc */
+
+/* *INDENT-OFF* */
+static const SDL_Scancode windows_scancode_table[] =
+{
+ /* 0 1 2 3 4 5 6 7 */
+ /* 8 9 A B C D E F */
+ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */
+ SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */
+
+ SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */
+ SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */
+
+ SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */
+ SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */
+
+ SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,/* 3 */
+ SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */
+
+ SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, /* 4 */
+ SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, /* 4 */
+
+ SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */
+ SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 5 */
+
+ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, SDL_SCANCODE_F16, /* 6 */
+ SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 6 */
+
+ SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */
+ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */
+};
+/* *INDENT-ON* */
diff --git a/src/3rdparty/SDL2/src/events/scancodes_xfree86.h b/src/3rdparty/SDL2/src/events/scancodes_xfree86.h
new file mode 100644
index 0000000..7d1f844
--- /dev/null
+++ b/src/3rdparty/SDL2/src/events/scancodes_xfree86.h
@@ -0,0 +1,506 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../include/SDL_scancode.h"
+
+/* XFree86 key code to SDL scancode mapping table
+ Sources:
+ - atKeyNames.h from XFree86 source code
+*/
+/* *INDENT-OFF* */
+static const SDL_Scancode xfree86_scancode_table[] = {
+ /* 0 */ SDL_SCANCODE_UNKNOWN,
+ /* 1 */ SDL_SCANCODE_ESCAPE,
+ /* 2 */ SDL_SCANCODE_1,
+ /* 3 */ SDL_SCANCODE_2,
+ /* 4 */ SDL_SCANCODE_3,
+ /* 5 */ SDL_SCANCODE_4,
+ /* 6 */ SDL_SCANCODE_5,
+ /* 7 */ SDL_SCANCODE_6,
+ /* 8 */ SDL_SCANCODE_7,
+ /* 9 */ SDL_SCANCODE_8,
+ /* 10 */ SDL_SCANCODE_9,
+ /* 11 */ SDL_SCANCODE_0,
+ /* 12 */ SDL_SCANCODE_MINUS,
+ /* 13 */ SDL_SCANCODE_EQUALS,
+ /* 14 */ SDL_SCANCODE_BACKSPACE,
+ /* 15 */ SDL_SCANCODE_TAB,
+ /* 16 */ SDL_SCANCODE_Q,
+ /* 17 */ SDL_SCANCODE_W,
+ /* 18 */ SDL_SCANCODE_E,
+ /* 19 */ SDL_SCANCODE_R,
+ /* 20 */ SDL_SCANCODE_T,
+ /* 21 */ SDL_SCANCODE_Y,
+ /* 22 */ SDL_SCANCODE_U,
+ /* 23 */ SDL_SCANCODE_I,
+ /* 24 */ SDL_SCANCODE_O,
+ /* 25 */ SDL_SCANCODE_P,
+ /* 26 */ SDL_SCANCODE_LEFTBRACKET,
+ /* 27 */ SDL_SCANCODE_RIGHTBRACKET,
+ /* 28 */ SDL_SCANCODE_RETURN,
+ /* 29 */ SDL_SCANCODE_LCTRL,
+ /* 30 */ SDL_SCANCODE_A,
+ /* 31 */ SDL_SCANCODE_S,
+ /* 32 */ SDL_SCANCODE_D,
+ /* 33 */ SDL_SCANCODE_F,
+ /* 34 */ SDL_SCANCODE_G,
+ /* 35 */ SDL_SCANCODE_H,
+ /* 36 */ SDL_SCANCODE_J,
+ /* 37 */ SDL_SCANCODE_K,
+ /* 38 */ SDL_SCANCODE_L,
+ /* 39 */ SDL_SCANCODE_SEMICOLON,
+ /* 40 */ SDL_SCANCODE_APOSTROPHE,
+ /* 41 */ SDL_SCANCODE_GRAVE,
+ /* 42 */ SDL_SCANCODE_LSHIFT,
+ /* 43 */ SDL_SCANCODE_BACKSLASH,
+ /* 44 */ SDL_SCANCODE_Z,
+ /* 45 */ SDL_SCANCODE_X,
+ /* 46 */ SDL_SCANCODE_C,
+ /* 47 */ SDL_SCANCODE_V,
+ /* 48 */ SDL_SCANCODE_B,
+ /* 49 */ SDL_SCANCODE_N,
+ /* 50 */ SDL_SCANCODE_M,
+ /* 51 */ SDL_SCANCODE_COMMA,
+ /* 52 */ SDL_SCANCODE_PERIOD,
+ /* 53 */ SDL_SCANCODE_SLASH,
+ /* 54 */ SDL_SCANCODE_RSHIFT,
+ /* 55 */ SDL_SCANCODE_KP_MULTIPLY,
+ /* 56 */ SDL_SCANCODE_LALT,
+ /* 57 */ SDL_SCANCODE_SPACE,
+ /* 58 */ SDL_SCANCODE_CAPSLOCK,
+ /* 59 */ SDL_SCANCODE_F1,
+ /* 60 */ SDL_SCANCODE_F2,
+ /* 61 */ SDL_SCANCODE_F3,
+ /* 62 */ SDL_SCANCODE_F4,
+ /* 63 */ SDL_SCANCODE_F5,
+ /* 64 */ SDL_SCANCODE_F6,
+ /* 65 */ SDL_SCANCODE_F7,
+ /* 66 */ SDL_SCANCODE_F8,
+ /* 67 */ SDL_SCANCODE_F9,
+ /* 68 */ SDL_SCANCODE_F10,
+ /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR,
+ /* 70 */ SDL_SCANCODE_SCROLLLOCK,
+ /* 71 */ SDL_SCANCODE_KP_7,
+ /* 72 */ SDL_SCANCODE_KP_8,
+ /* 73 */ SDL_SCANCODE_KP_9,
+ /* 74 */ SDL_SCANCODE_KP_MINUS,
+ /* 75 */ SDL_SCANCODE_KP_4,
+ /* 76 */ SDL_SCANCODE_KP_5,
+ /* 77 */ SDL_SCANCODE_KP_6,
+ /* 78 */ SDL_SCANCODE_KP_PLUS,
+ /* 79 */ SDL_SCANCODE_KP_1,
+ /* 80 */ SDL_SCANCODE_KP_2,
+ /* 81 */ SDL_SCANCODE_KP_3,
+ /* 82 */ SDL_SCANCODE_KP_0,
+ /* 83 */ SDL_SCANCODE_KP_PERIOD,
+ /* 84 */ SDL_SCANCODE_SYSREQ,
+ /* 85 */ SDL_SCANCODE_MODE,
+ /* 86 */ SDL_SCANCODE_NONUSBACKSLASH,
+ /* 87 */ SDL_SCANCODE_F11,
+ /* 88 */ SDL_SCANCODE_F12,
+ /* 89 */ SDL_SCANCODE_HOME,
+ /* 90 */ SDL_SCANCODE_UP,
+ /* 91 */ SDL_SCANCODE_PAGEUP,
+ /* 92 */ SDL_SCANCODE_LEFT,
+ /* 93 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* on PowerBook G4 / KEY_Begin */
+ /* 94 */ SDL_SCANCODE_RIGHT,
+ /* 95 */ SDL_SCANCODE_END,
+ /* 96 */ SDL_SCANCODE_DOWN,
+ /* 97 */ SDL_SCANCODE_PAGEDOWN,
+ /* 98 */ SDL_SCANCODE_INSERT,
+ /* 99 */ SDL_SCANCODE_DELETE,
+ /* 100 */ SDL_SCANCODE_KP_ENTER,
+ /* 101 */ SDL_SCANCODE_RCTRL,
+ /* 102 */ SDL_SCANCODE_PAUSE,
+ /* 103 */ SDL_SCANCODE_PRINTSCREEN,
+ /* 104 */ SDL_SCANCODE_KP_DIVIDE,
+ /* 105 */ SDL_SCANCODE_RALT,
+ /* 106 */ SDL_SCANCODE_UNKNOWN, /* BREAK */
+ /* 107 */ SDL_SCANCODE_LGUI,
+ /* 108 */ SDL_SCANCODE_RGUI,
+ /* 109 */ SDL_SCANCODE_APPLICATION,
+ /* 110 */ SDL_SCANCODE_F13,
+ /* 111 */ SDL_SCANCODE_F14,
+ /* 112 */ SDL_SCANCODE_F15,
+ /* 113 */ SDL_SCANCODE_F16,
+ /* 114 */ SDL_SCANCODE_F17,
+ /* 115 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */
+ /* 116 */ SDL_SCANCODE_UNKNOWN, /* is translated to XK_ISO_Level3_Shift by my X server, but I have no keyboard that generates this code, so I don't know what the correct SDL_SCANCODE_* for it is */
+ /* 117 */ SDL_SCANCODE_UNKNOWN,
+ /* 118 */ SDL_SCANCODE_KP_EQUALS,
+ /* 119 */ SDL_SCANCODE_UNKNOWN,
+ /* 120 */ SDL_SCANCODE_UNKNOWN,
+ /* 121 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */
+ /* 122 */ SDL_SCANCODE_UNKNOWN,
+ /* 123 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */
+ /* 124 */ SDL_SCANCODE_UNKNOWN,
+ /* 125 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */
+ /* 126 */ SDL_SCANCODE_UNKNOWN,
+ /* 127 */ SDL_SCANCODE_UNKNOWN,
+ /* 128 */ SDL_SCANCODE_UNKNOWN,
+ /* 129 */ SDL_SCANCODE_UNKNOWN,
+ /* 130 */ SDL_SCANCODE_UNKNOWN,
+ /* 131 */ SDL_SCANCODE_UNKNOWN,
+ /* 132 */ SDL_SCANCODE_POWER,
+ /* 133 */ SDL_SCANCODE_MUTE,
+ /* 134 */ SDL_SCANCODE_VOLUMEDOWN,
+ /* 135 */ SDL_SCANCODE_VOLUMEUP,
+ /* 136 */ SDL_SCANCODE_HELP,
+ /* 137 */ SDL_SCANCODE_STOP,
+ /* 138 */ SDL_SCANCODE_AGAIN,
+ /* 139 */ SDL_SCANCODE_UNKNOWN, /* PROPS */
+ /* 140 */ SDL_SCANCODE_UNDO,
+ /* 141 */ SDL_SCANCODE_UNKNOWN, /* FRONT */
+ /* 142 */ SDL_SCANCODE_COPY,
+ /* 143 */ SDL_SCANCODE_UNKNOWN, /* OPEN */
+ /* 144 */ SDL_SCANCODE_PASTE,
+ /* 145 */ SDL_SCANCODE_FIND,
+ /* 146 */ SDL_SCANCODE_CUT,
+};
+
+/* for wireless usb keyboard (manufacturer TRUST) without numpad. */
+static const SDL_Scancode xfree86_scancode_table2[] = {
+ /* 0 */ SDL_SCANCODE_UNKNOWN,
+ /* 1 */ SDL_SCANCODE_ESCAPE,
+ /* 2 */ SDL_SCANCODE_1,
+ /* 3 */ SDL_SCANCODE_2,
+ /* 4 */ SDL_SCANCODE_3,
+ /* 5 */ SDL_SCANCODE_4,
+ /* 6 */ SDL_SCANCODE_5,
+ /* 7 */ SDL_SCANCODE_6,
+ /* 8 */ SDL_SCANCODE_7,
+ /* 9 */ SDL_SCANCODE_8,
+ /* 10 */ SDL_SCANCODE_9,
+ /* 11 */ SDL_SCANCODE_0,
+ /* 12 */ SDL_SCANCODE_MINUS,
+ /* 13 */ SDL_SCANCODE_EQUALS,
+ /* 14 */ SDL_SCANCODE_BACKSPACE,
+ /* 15 */ SDL_SCANCODE_TAB,
+ /* 16 */ SDL_SCANCODE_Q,
+ /* 17 */ SDL_SCANCODE_W,
+ /* 18 */ SDL_SCANCODE_E,
+ /* 19 */ SDL_SCANCODE_R,
+ /* 20 */ SDL_SCANCODE_T,
+ /* 21 */ SDL_SCANCODE_Y,
+ /* 22 */ SDL_SCANCODE_U,
+ /* 23 */ SDL_SCANCODE_I,
+ /* 24 */ SDL_SCANCODE_O,
+ /* 25 */ SDL_SCANCODE_P,
+ /* 26 */ SDL_SCANCODE_LEFTBRACKET,
+ /* 27 */ SDL_SCANCODE_RIGHTBRACKET,
+ /* 28 */ SDL_SCANCODE_RETURN,
+ /* 29 */ SDL_SCANCODE_LCTRL,
+ /* 30 */ SDL_SCANCODE_A,
+ /* 31 */ SDL_SCANCODE_S,
+ /* 32 */ SDL_SCANCODE_D,
+ /* 33 */ SDL_SCANCODE_F,
+ /* 34 */ SDL_SCANCODE_G,
+ /* 35 */ SDL_SCANCODE_H,
+ /* 36 */ SDL_SCANCODE_J,
+ /* 37 */ SDL_SCANCODE_K,
+ /* 38 */ SDL_SCANCODE_L,
+ /* 39 */ SDL_SCANCODE_SEMICOLON,
+ /* 40 */ SDL_SCANCODE_APOSTROPHE,
+ /* 41 */ SDL_SCANCODE_GRAVE,
+ /* 42 */ SDL_SCANCODE_LSHIFT,
+ /* 43 */ SDL_SCANCODE_BACKSLASH,
+ /* 44 */ SDL_SCANCODE_Z,
+ /* 45 */ SDL_SCANCODE_X,
+ /* 46 */ SDL_SCANCODE_C,
+ /* 47 */ SDL_SCANCODE_V,
+ /* 48 */ SDL_SCANCODE_B,
+ /* 49 */ SDL_SCANCODE_N,
+ /* 50 */ SDL_SCANCODE_M,
+ /* 51 */ SDL_SCANCODE_COMMA,
+ /* 52 */ SDL_SCANCODE_PERIOD,
+ /* 53 */ SDL_SCANCODE_SLASH,
+ /* 54 */ SDL_SCANCODE_RSHIFT,
+ /* 55 */ SDL_SCANCODE_KP_MULTIPLY,
+ /* 56 */ SDL_SCANCODE_LALT,
+ /* 57 */ SDL_SCANCODE_SPACE,
+ /* 58 */ SDL_SCANCODE_CAPSLOCK,
+ /* 59 */ SDL_SCANCODE_F1,
+ /* 60 */ SDL_SCANCODE_F2,
+ /* 61 */ SDL_SCANCODE_F3,
+ /* 62 */ SDL_SCANCODE_F4,
+ /* 63 */ SDL_SCANCODE_F5,
+ /* 64 */ SDL_SCANCODE_F6,
+ /* 65 */ SDL_SCANCODE_F7,
+ /* 66 */ SDL_SCANCODE_F8,
+ /* 67 */ SDL_SCANCODE_F9,
+ /* 68 */ SDL_SCANCODE_F10,
+ /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR,
+ /* 70 */ SDL_SCANCODE_SCROLLLOCK,
+ /* 71 */ SDL_SCANCODE_KP_7,
+ /* 72 */ SDL_SCANCODE_KP_8,
+ /* 73 */ SDL_SCANCODE_KP_9,
+ /* 74 */ SDL_SCANCODE_KP_MINUS,
+ /* 75 */ SDL_SCANCODE_KP_4,
+ /* 76 */ SDL_SCANCODE_KP_5,
+ /* 77 */ SDL_SCANCODE_KP_6,
+ /* 78 */ SDL_SCANCODE_KP_PLUS,
+ /* 79 */ SDL_SCANCODE_KP_1,
+ /* 80 */ SDL_SCANCODE_KP_2,
+ /* 81 */ SDL_SCANCODE_KP_3,
+ /* 82 */ SDL_SCANCODE_KP_0,
+ /* 83 */ SDL_SCANCODE_KP_PERIOD,
+ /* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */
+ /* 85 */ SDL_SCANCODE_MODE, /* ???? */
+ /* 86 */ SDL_SCANCODE_NONUSBACKSLASH,
+ /* 87 */ SDL_SCANCODE_F11,
+ /* 88 */ SDL_SCANCODE_F12,
+ /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */
+ /* 90 */ SDL_SCANCODE_UNKNOWN, /* Katakana */
+ /* 91 */ SDL_SCANCODE_UNKNOWN, /* Hiragana */
+ /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */
+ /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* Hiragana_Katakana */
+ /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */
+ /* 95 */ SDL_SCANCODE_UNKNOWN,
+ /* 96 */ SDL_SCANCODE_KP_ENTER,
+ /* 97 */ SDL_SCANCODE_RCTRL,
+ /* 98 */ SDL_SCANCODE_KP_DIVIDE,
+ /* 99 */ SDL_SCANCODE_PRINTSCREEN,
+ /* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */
+ /* 101 */ SDL_SCANCODE_UNKNOWN, /* Linefeed */
+ /* 102 */ SDL_SCANCODE_HOME,
+ /* 103 */ SDL_SCANCODE_UP,
+ /* 104 */ SDL_SCANCODE_PAGEUP,
+ /* 105 */ SDL_SCANCODE_LEFT,
+ /* 106 */ SDL_SCANCODE_RIGHT,
+ /* 107 */ SDL_SCANCODE_END,
+ /* 108 */ SDL_SCANCODE_DOWN,
+ /* 109 */ SDL_SCANCODE_PAGEDOWN,
+ /* 110 */ SDL_SCANCODE_INSERT,
+ /* 111 */ SDL_SCANCODE_DELETE,
+ /* 112 */ SDL_SCANCODE_UNKNOWN,
+ /* 113 */ SDL_SCANCODE_MUTE,
+ /* 114 */ SDL_SCANCODE_VOLUMEDOWN,
+ /* 115 */ SDL_SCANCODE_VOLUMEUP,
+ /* 116 */ SDL_SCANCODE_POWER,
+ /* 117 */ SDL_SCANCODE_KP_EQUALS,
+ /* 118 */ SDL_SCANCODE_UNKNOWN, /* plusminus */
+ /* 119 */ SDL_SCANCODE_PAUSE,
+ /* 120 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */
+ /* 121 */ SDL_SCANCODE_UNKNOWN, /* KP_Decimal */
+ /* 122 */ SDL_SCANCODE_UNKNOWN, /* Hangul */
+ /* 123 */ SDL_SCANCODE_UNKNOWN, /* Hangul_Hanja */
+ /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */
+ /* 125 */ SDL_SCANCODE_LGUI,
+ /* 126 */ SDL_SCANCODE_RGUI,
+ /* 127 */ SDL_SCANCODE_APPLICATION,
+ /* 128 */ SDL_SCANCODE_CANCEL,
+ /* 129 */ SDL_SCANCODE_AGAIN,
+ /* 130 */ SDL_SCANCODE_UNKNOWN, /* SunProps */
+ /* 131 */ SDL_SCANCODE_UNDO,
+ /* 132 */ SDL_SCANCODE_UNKNOWN, /* SunFront */
+ /* 133 */ SDL_SCANCODE_COPY,
+ /* 134 */ SDL_SCANCODE_UNKNOWN, /* SunOpen */
+ /* 135 */ SDL_SCANCODE_PASTE,
+ /* 136 */ SDL_SCANCODE_FIND,
+ /* 137 */ SDL_SCANCODE_CUT,
+ /* 138 */ SDL_SCANCODE_HELP,
+ /* 139 */ SDL_SCANCODE_UNKNOWN, /* XF86MenuKB */
+ /* 140 */ SDL_SCANCODE_CALCULATOR,
+ /* 141 */ SDL_SCANCODE_UNKNOWN,
+ /* 142 */ SDL_SCANCODE_SLEEP,
+ /* 143 */ SDL_SCANCODE_UNKNOWN, /* XF86WakeUp */
+ /* 144 */ SDL_SCANCODE_UNKNOWN, /* XF86Explorer */
+ /* 145 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */
+ /* 146 */ SDL_SCANCODE_UNKNOWN,
+ /* 147 */ SDL_SCANCODE_UNKNOWN, /* XF86Xfer */
+ /* 148 */ SDL_SCANCODE_APP1, /* XF86Launch1 */
+ /* 149 */ SDL_SCANCODE_APP2, /* XF86Launch2 */
+ /* 150 */ SDL_SCANCODE_WWW,
+ /* 151 */ SDL_SCANCODE_UNKNOWN, /* XF86DOS */
+ /* 152 */ SDL_SCANCODE_UNKNOWN, /* XF86ScreenSaver */
+ /* 153 */ SDL_SCANCODE_UNKNOWN,
+ /* 154 */ SDL_SCANCODE_UNKNOWN, /* XF86RotateWindows */
+ /* 155 */ SDL_SCANCODE_MAIL,
+ /* 156 */ SDL_SCANCODE_AC_BOOKMARKS, /* XF86Favorites */
+ /* 157 */ SDL_SCANCODE_COMPUTER,
+ /* 158 */ SDL_SCANCODE_AC_BACK,
+ /* 159 */ SDL_SCANCODE_AC_FORWARD,
+ /* 160 */ SDL_SCANCODE_UNKNOWN,
+ /* 161 */ SDL_SCANCODE_EJECT,
+ /* 162 */ SDL_SCANCODE_EJECT,
+ /* 163 */ SDL_SCANCODE_AUDIONEXT,
+ /* 164 */ SDL_SCANCODE_AUDIOPLAY,
+ /* 165 */ SDL_SCANCODE_AUDIOPREV,
+ /* 166 */ SDL_SCANCODE_AUDIOSTOP,
+ /* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */
+ /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */
+ /* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */
+ /* 170 */ SDL_SCANCODE_UNKNOWN,
+ /* 171 */ SDL_SCANCODE_F13, /* XF86Tools */
+ /* 172 */ SDL_SCANCODE_AC_HOME,
+ /* 173 */ SDL_SCANCODE_AC_REFRESH,
+ /* 174 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
+ /* 175 */ SDL_SCANCODE_UNKNOWN,
+ /* 176 */ SDL_SCANCODE_UNKNOWN,
+ /* 177 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */
+ /* 178 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */
+ /* 179 */ SDL_SCANCODE_UNKNOWN, /* parenleft */
+ /* 180 */ SDL_SCANCODE_UNKNOWN, /* parenright */
+ /* 181 */ SDL_SCANCODE_UNKNOWN, /* XF86New */
+ /* 182 */ SDL_SCANCODE_AGAIN,
+ /* 183 */ SDL_SCANCODE_F13, /* XF86Tools */
+ /* 184 */ SDL_SCANCODE_F14, /* XF86Launch5 */
+ /* 185 */ SDL_SCANCODE_F15, /* XF86Launch6 */
+ /* 186 */ SDL_SCANCODE_F16, /* XF86Launch7 */
+ /* 187 */ SDL_SCANCODE_F17, /* XF86Launch8 */
+ /* 188 */ SDL_SCANCODE_F18, /* XF86Launch9 */
+ /* 189 */ SDL_SCANCODE_F19, /* null keysym */
+ /* 190 */ SDL_SCANCODE_UNKNOWN,
+ /* 191 */ SDL_SCANCODE_UNKNOWN,
+ /* 192 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */
+ /* 193 */ SDL_SCANCODE_UNKNOWN,
+ /* 194 */ SDL_SCANCODE_UNKNOWN,
+ /* 195 */ SDL_SCANCODE_MODE,
+ /* 196 */ SDL_SCANCODE_UNKNOWN,
+ /* 197 */ SDL_SCANCODE_UNKNOWN,
+ /* 198 */ SDL_SCANCODE_UNKNOWN,
+ /* 199 */ SDL_SCANCODE_UNKNOWN,
+ /* 200 */ SDL_SCANCODE_AUDIOPLAY,
+ /* 201 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPause */
+ /* 202 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch3 */
+ /* 203 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch4 */
+ /* 204 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchB */
+ /* 205 */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */
+ /* 206 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
+ /* 207 */ SDL_SCANCODE_AUDIOPLAY,
+ /* 208 */ SDL_SCANCODE_AUDIONEXT,
+ /* 209 */ SDL_SCANCODE_UNKNOWN,
+ /* 210 */ SDL_SCANCODE_PRINTSCREEN,
+ /* 211 */ SDL_SCANCODE_UNKNOWN,
+ /* 212 */ SDL_SCANCODE_UNKNOWN, /* XF86WebCam */
+ /* 213 */ SDL_SCANCODE_UNKNOWN,
+ /* 214 */ SDL_SCANCODE_UNKNOWN,
+ /* 215 */ SDL_SCANCODE_MAIL,
+ /* 216 */ SDL_SCANCODE_UNKNOWN,
+ /* 217 */ SDL_SCANCODE_AC_SEARCH,
+ /* 218 */ SDL_SCANCODE_UNKNOWN,
+ /* 219 */ SDL_SCANCODE_UNKNOWN, /* XF86Finance */
+ /* 220 */ SDL_SCANCODE_UNKNOWN,
+ /* 221 */ SDL_SCANCODE_UNKNOWN, /* XF86Shop */
+ /* 222 */ SDL_SCANCODE_UNKNOWN,
+ /* 223 */ SDL_SCANCODE_STOP,
+ /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN,
+ /* 225 */ SDL_SCANCODE_BRIGHTNESSUP,
+ /* 226 */ SDL_SCANCODE_MEDIASELECT,
+ /* 227 */ SDL_SCANCODE_DISPLAYSWITCH,
+ /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE,
+ /* 229 */ SDL_SCANCODE_KBDILLUMDOWN,
+ /* 230 */ SDL_SCANCODE_KBDILLUMUP,
+ /* 231 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */
+ /* 232 */ SDL_SCANCODE_UNKNOWN, /* XF86Reply */
+ /* 233 */ SDL_SCANCODE_UNKNOWN, /* XF86MailForward */
+ /* 234 */ SDL_SCANCODE_UNKNOWN, /* XF86Save */
+ /* 235 */ SDL_SCANCODE_UNKNOWN, /* XF86Documents */
+ /* 236 */ SDL_SCANCODE_UNKNOWN, /* XF86Battery */
+ /* 237 */ SDL_SCANCODE_UNKNOWN, /* XF86Bluetooth */
+ /* 238 */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */
+};
+
+/* Xvnc / Xtightvnc scancodes from xmodmap -pk */
+static const SDL_Scancode xvnc_scancode_table[] = {
+ /* 0 */ SDL_SCANCODE_LCTRL,
+ /* 1 */ SDL_SCANCODE_RCTRL,
+ /* 2 */ SDL_SCANCODE_LSHIFT,
+ /* 3 */ SDL_SCANCODE_RSHIFT,
+ /* 4 */ SDL_SCANCODE_UNKNOWN, /* Meta_L */
+ /* 5 */ SDL_SCANCODE_UNKNOWN, /* Meta_R */
+ /* 6 */ SDL_SCANCODE_LALT,
+ /* 7 */ SDL_SCANCODE_RALT,
+ /* 8 */ SDL_SCANCODE_SPACE,
+ /* 9 */ SDL_SCANCODE_0,
+ /* 10 */ SDL_SCANCODE_1,
+ /* 11 */ SDL_SCANCODE_2,
+ /* 12 */ SDL_SCANCODE_3,
+ /* 13 */ SDL_SCANCODE_4,
+ /* 14 */ SDL_SCANCODE_5,
+ /* 15 */ SDL_SCANCODE_6,
+ /* 16 */ SDL_SCANCODE_7,
+ /* 17 */ SDL_SCANCODE_8,
+ /* 18 */ SDL_SCANCODE_9,
+ /* 19 */ SDL_SCANCODE_MINUS,
+ /* 20 */ SDL_SCANCODE_EQUALS,
+ /* 21 */ SDL_SCANCODE_LEFTBRACKET,
+ /* 22 */ SDL_SCANCODE_RIGHTBRACKET,
+ /* 23 */ SDL_SCANCODE_SEMICOLON,
+ /* 24 */ SDL_SCANCODE_APOSTROPHE,
+ /* 25 */ SDL_SCANCODE_GRAVE,
+ /* 26 */ SDL_SCANCODE_COMMA,
+ /* 27 */ SDL_SCANCODE_PERIOD,
+ /* 28 */ SDL_SCANCODE_SLASH,
+ /* 29 */ SDL_SCANCODE_BACKSLASH,
+ /* 30 */ SDL_SCANCODE_A,
+ /* 31 */ SDL_SCANCODE_B,
+ /* 32 */ SDL_SCANCODE_C,
+ /* 33 */ SDL_SCANCODE_D,
+ /* 34 */ SDL_SCANCODE_E,
+ /* 35 */ SDL_SCANCODE_F,
+ /* 36 */ SDL_SCANCODE_G,
+ /* 37 */ SDL_SCANCODE_H,
+ /* 38 */ SDL_SCANCODE_I,
+ /* 39 */ SDL_SCANCODE_J,
+ /* 40 */ SDL_SCANCODE_K,
+ /* 41 */ SDL_SCANCODE_L,
+ /* 42 */ SDL_SCANCODE_M,
+ /* 43 */ SDL_SCANCODE_N,
+ /* 44 */ SDL_SCANCODE_O,
+ /* 45 */ SDL_SCANCODE_P,
+ /* 46 */ SDL_SCANCODE_Q,
+ /* 47 */ SDL_SCANCODE_R,
+ /* 48 */ SDL_SCANCODE_S,
+ /* 49 */ SDL_SCANCODE_T,
+ /* 50 */ SDL_SCANCODE_U,
+ /* 51 */ SDL_SCANCODE_V,
+ /* 52 */ SDL_SCANCODE_W,
+ /* 53 */ SDL_SCANCODE_X,
+ /* 54 */ SDL_SCANCODE_Y,
+ /* 55 */ SDL_SCANCODE_Z,
+ /* 56 */ SDL_SCANCODE_BACKSPACE,
+ /* 57 */ SDL_SCANCODE_RETURN,
+ /* 58 */ SDL_SCANCODE_TAB,
+ /* 59 */ SDL_SCANCODE_ESCAPE,
+ /* 60 */ SDL_SCANCODE_DELETE,
+ /* 61 */ SDL_SCANCODE_HOME,
+ /* 62 */ SDL_SCANCODE_END,
+ /* 63 */ SDL_SCANCODE_PAGEUP,
+ /* 64 */ SDL_SCANCODE_PAGEDOWN,
+ /* 65 */ SDL_SCANCODE_UP,
+ /* 66 */ SDL_SCANCODE_DOWN,
+ /* 67 */ SDL_SCANCODE_LEFT,
+ /* 68 */ SDL_SCANCODE_RIGHT,
+ /* 69 */ SDL_SCANCODE_F1,
+ /* 70 */ SDL_SCANCODE_F2,
+ /* 71 */ SDL_SCANCODE_F3,
+ /* 72 */ SDL_SCANCODE_F4,
+ /* 73 */ SDL_SCANCODE_F5,
+ /* 74 */ SDL_SCANCODE_F6,
+ /* 75 */ SDL_SCANCODE_F7,
+ /* 76 */ SDL_SCANCODE_F8,
+ /* 77 */ SDL_SCANCODE_F9,
+ /* 78 */ SDL_SCANCODE_F10,
+ /* 79 */ SDL_SCANCODE_F11,
+ /* 80 */ SDL_SCANCODE_F12,
+};
+
+/* *INDENT-ON* */
diff --git a/src/3rdparty/SDL2/src/file/SDL_rwops.c b/src/3rdparty/SDL2/src/file/SDL_rwops.c
new file mode 100644
index 0000000..cf5d3aa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/file/SDL_rwops.c
@@ -0,0 +1,867 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* We won't get fseeko64 on QNX if _LARGEFILE64_SOURCE is defined, but the
+ configure script knows the C runtime has it and enables it. */
+#ifndef __QNXNTO__
+/* Need this so Linux systems define fseek64o, ftell64o and off64_t */
+#define _LARGEFILE64_SOURCE
+#endif
+
+#include "../SDL_internal.h"
+
+#if defined(__WIN32__)
+#include "../core/windows/SDL_windows.h"
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+/* This file provides a general interface for SDL to read and write
+ data sources. It can easily be extended to files, memory, etc.
+*/
+
+#include "SDL_endian.h"
+#include "SDL_rwops.h"
+
+#ifdef __APPLE__
+#include "cocoa/SDL_rwopsbundlesupport.h"
+#endif /* __APPLE__ */
+
+#ifdef __ANDROID__
+#include "../core/android/SDL_android.h"
+#include "SDL_system.h"
+#endif
+
+#if __NACL__
+#include "nacl_io/nacl_io.h"
+#endif
+
+#ifdef __WIN32__
+
+/* Functions to read/write Win32 API file pointers */
+
+#ifndef INVALID_SET_FILE_POINTER
+#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
+#endif
+
+#define READAHEAD_BUFFER_SIZE 1024
+
+static int SDLCALL
+windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
+{
+ UINT old_error_mode;
+ HANDLE h;
+ DWORD r_right, w_right;
+ DWORD must_exist, truncate;
+ int a_mode;
+
+ if (!context)
+ return -1; /* failed (invalid call) */
+
+ context->hidden.windowsio.h = INVALID_HANDLE_VALUE; /* mark this as unusable */
+ context->hidden.windowsio.buffer.data = NULL;
+ context->hidden.windowsio.buffer.size = 0;
+ context->hidden.windowsio.buffer.left = 0;
+
+ /* "r" = reading, file must exist */
+ /* "w" = writing, truncate existing, file may not exist */
+ /* "r+"= reading or writing, file must exist */
+ /* "a" = writing, append file may not exist */
+ /* "a+"= append + read, file may not exist */
+ /* "w+" = read, write, truncate. file may not exist */
+
+ must_exist = (SDL_strchr(mode, 'r') != NULL) ? OPEN_EXISTING : 0;
+ truncate = (SDL_strchr(mode, 'w') != NULL) ? CREATE_ALWAYS : 0;
+ r_right = (SDL_strchr(mode, '+') != NULL
+ || must_exist) ? GENERIC_READ : 0;
+ a_mode = (SDL_strchr(mode, 'a') != NULL) ? OPEN_ALWAYS : 0;
+ w_right = (a_mode || SDL_strchr(mode, '+')
+ || truncate) ? GENERIC_WRITE : 0;
+
+ if (!r_right && !w_right) /* inconsistent mode */
+ return -1; /* failed (invalid call) */
+
+ context->hidden.windowsio.buffer.data =
+ (char *) SDL_malloc(READAHEAD_BUFFER_SIZE);
+ if (!context->hidden.windowsio.buffer.data) {
+ return SDL_OutOfMemory();
+ }
+ /* Do not open a dialog box if failure */
+ old_error_mode =
+ SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
+
+ {
+ LPTSTR tstr = WIN_UTF8ToString(filename);
+ h = CreateFile(tstr, (w_right | r_right),
+ (w_right) ? 0 : FILE_SHARE_READ, NULL,
+ (must_exist | truncate | a_mode),
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ SDL_free(tstr);
+ }
+
+ /* restore old behavior */
+ SetErrorMode(old_error_mode);
+
+ if (h == INVALID_HANDLE_VALUE) {
+ SDL_free(context->hidden.windowsio.buffer.data);
+ context->hidden.windowsio.buffer.data = NULL;
+ SDL_SetError("Couldn't open %s", filename);
+ return -2; /* failed (CreateFile) */
+ }
+ context->hidden.windowsio.h = h;
+ context->hidden.windowsio.append = a_mode ? SDL_TRUE : SDL_FALSE;
+
+ return 0; /* ok */
+}
+
+static Sint64 SDLCALL
+windows_file_size(SDL_RWops * context)
+{
+ LARGE_INTEGER size;
+
+ if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
+ return SDL_SetError("windows_file_size: invalid context/file not opened");
+ }
+
+ if (!GetFileSizeEx(context->hidden.windowsio.h, &size)) {
+ return WIN_SetError("windows_file_size");
+ }
+
+ return size.QuadPart;
+}
+
+static Sint64 SDLCALL
+windows_file_seek(SDL_RWops * context, Sint64 offset, int whence)
+{
+ DWORD windowswhence;
+ LARGE_INTEGER windowsoffset;
+
+ if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) {
+ return SDL_SetError("windows_file_seek: invalid context/file not opened");
+ }
+
+ /* FIXME: We may be able to satisfy the seek within buffered data */
+ if (whence == RW_SEEK_CUR && context->hidden.windowsio.buffer.left) {
+ offset -= (long)context->hidden.windowsio.buffer.left;
+ }
+ context->hidden.windowsio.buffer.left = 0;
+
+ switch (whence) {
+ case RW_SEEK_SET:
+ windowswhence = FILE_BEGIN;
+ break;
+ case RW_SEEK_CUR:
+ windowswhence = FILE_CURRENT;
+ break;
+ case RW_SEEK_END:
+ windowswhence = FILE_END;
+ break;
+ default:
+ return SDL_SetError("windows_file_seek: Unknown value for 'whence'");
+ }
+
+ windowsoffset.QuadPart = offset;
+ if (!SetFilePointerEx(context->hidden.windowsio.h, windowsoffset, &windowsoffset, windowswhence)) {
+ return WIN_SetError("windows_file_seek");
+ }
+ return windowsoffset.QuadPart;
+}
+
+static size_t SDLCALL
+windows_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
+{
+ size_t total_need;
+ size_t total_read = 0;
+ size_t read_ahead;
+ DWORD byte_read;
+
+ total_need = size * maxnum;
+
+ if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE
+ || !total_need)
+ return 0;
+
+ if (context->hidden.windowsio.buffer.left > 0) {
+ void *data = (char *) context->hidden.windowsio.buffer.data +
+ context->hidden.windowsio.buffer.size -
+ context->hidden.windowsio.buffer.left;
+ read_ahead =
+ SDL_min(total_need, context->hidden.windowsio.buffer.left);
+ SDL_memcpy(ptr, data, read_ahead);
+ context->hidden.windowsio.buffer.left -= read_ahead;
+
+ if (read_ahead == total_need) {
+ return maxnum;
+ }
+ ptr = (char *) ptr + read_ahead;
+ total_need -= read_ahead;
+ total_read += read_ahead;
+ }
+
+ if (total_need < READAHEAD_BUFFER_SIZE) {
+ if (!ReadFile
+ (context->hidden.windowsio.h, context->hidden.windowsio.buffer.data,
+ READAHEAD_BUFFER_SIZE, &byte_read, NULL)) {
+ SDL_Error(SDL_EFREAD);
+ return 0;
+ }
+ read_ahead = SDL_min(total_need, (int) byte_read);
+ SDL_memcpy(ptr, context->hidden.windowsio.buffer.data, read_ahead);
+ context->hidden.windowsio.buffer.size = byte_read;
+ context->hidden.windowsio.buffer.left = byte_read - read_ahead;
+ total_read += read_ahead;
+ } else {
+ if (!ReadFile
+ (context->hidden.windowsio.h, ptr, (DWORD)total_need, &byte_read, NULL)) {
+ SDL_Error(SDL_EFREAD);
+ return 0;
+ }
+ total_read += byte_read;
+ }
+ return (total_read / size);
+}
+
+static size_t SDLCALL
+windows_file_write(SDL_RWops * context, const void *ptr, size_t size,
+ size_t num)
+{
+
+ size_t total_bytes;
+ DWORD byte_written;
+ size_t nwritten;
+
+ total_bytes = size * num;
+
+ if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE
+ || total_bytes <= 0 || !size)
+ return 0;
+
+ if (context->hidden.windowsio.buffer.left) {
+ SetFilePointer(context->hidden.windowsio.h,
+ -(LONG)context->hidden.windowsio.buffer.left, NULL,
+ FILE_CURRENT);
+ context->hidden.windowsio.buffer.left = 0;
+ }
+
+ /* if in append mode, we must go to the EOF before write */
+ if (context->hidden.windowsio.append) {
+ if (SetFilePointer(context->hidden.windowsio.h, 0L, NULL, FILE_END) ==
+ INVALID_SET_FILE_POINTER) {
+ SDL_Error(SDL_EFWRITE);
+ return 0;
+ }
+ }
+
+ if (!WriteFile
+ (context->hidden.windowsio.h, ptr, (DWORD)total_bytes, &byte_written, NULL)) {
+ SDL_Error(SDL_EFWRITE);
+ return 0;
+ }
+
+ nwritten = byte_written / size;
+ return nwritten;
+}
+
+static int SDLCALL
+windows_file_close(SDL_RWops * context)
+{
+
+ if (context) {
+ if (context->hidden.windowsio.h != INVALID_HANDLE_VALUE) {
+ CloseHandle(context->hidden.windowsio.h);
+ context->hidden.windowsio.h = INVALID_HANDLE_VALUE; /* to be sure */
+ }
+ SDL_free(context->hidden.windowsio.buffer.data);
+ context->hidden.windowsio.buffer.data = NULL;
+ SDL_FreeRW(context);
+ }
+ return 0;
+}
+#endif /* __WIN32__ */
+
+#ifdef HAVE_STDIO_H
+
+#ifdef HAVE_FOPEN64
+#define fopen fopen64
+#endif
+#ifdef HAVE_FSEEKO64
+#define fseek_off_t off64_t
+#define fseek fseeko64
+#define ftell ftello64
+#elif defined(HAVE_FSEEKO)
+#if defined(OFF_MIN) && defined(OFF_MAX)
+#define FSEEK_OFF_MIN OFF_MIN
+#define FSEEK_OFF_MAX OFF_MAX
+#elif defined(HAVE_LIMITS_H)
+/* POSIX doesn't specify the minimum and maximum macros for off_t so
+ * we have to improvise and dance around implementation-defined
+ * behavior. This may fail if the off_t type has padding bits or
+ * is not a two's-complement representation. The compilers will detect
+ * and eliminate the dead code if off_t has 64 bits.
+ */
+#define FSEEK_OFF_MAX (((((off_t)1 << (sizeof(off_t) * CHAR_BIT - 2)) - 1) << 1) + 1)
+#define FSEEK_OFF_MIN (-(FSEEK_OFF_MAX) - 1)
+#endif
+#define fseek_off_t off_t
+#define fseek fseeko
+#define ftell ftello
+#elif defined(HAVE__FSEEKI64)
+#define fseek_off_t __int64
+#define fseek _fseeki64
+#define ftell _ftelli64
+#else
+#ifdef HAVE_LIMITS_H
+#define FSEEK_OFF_MIN LONG_MIN
+#define FSEEK_OFF_MAX LONG_MAX
+#endif
+#define fseek_off_t long
+#endif
+
+/* Functions to read/write stdio file pointers */
+
+static Sint64 SDLCALL
+stdio_size(SDL_RWops * context)
+{
+ Sint64 pos, size;
+
+ pos = SDL_RWseek(context, 0, RW_SEEK_CUR);
+ if (pos < 0) {
+ return -1;
+ }
+ size = SDL_RWseek(context, 0, RW_SEEK_END);
+
+ SDL_RWseek(context, pos, RW_SEEK_SET);
+ return size;
+}
+
+static Sint64 SDLCALL
+stdio_seek(SDL_RWops * context, Sint64 offset, int whence)
+{
+#if defined(FSEEK_OFF_MIN) && defined(FSEEK_OFF_MAX)
+ if (offset < (Sint64)(FSEEK_OFF_MIN) || offset > (Sint64)(FSEEK_OFF_MAX)) {
+ return SDL_SetError("Seek offset out of range");
+ }
+#endif
+
+ if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, whence) == 0) {
+ Sint64 pos = ftell(context->hidden.stdio.fp);
+ if (pos < 0) {
+ return SDL_SetError("Couldn't get stream offset");
+ }
+ return pos;
+ }
+ return SDL_Error(SDL_EFSEEK);
+}
+
+static size_t SDLCALL
+stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
+{
+ size_t nread;
+
+ nread = fread(ptr, size, maxnum, context->hidden.stdio.fp);
+ if (nread == 0 && ferror(context->hidden.stdio.fp)) {
+ SDL_Error(SDL_EFREAD);
+ }
+ return nread;
+}
+
+static size_t SDLCALL
+stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num)
+{
+ size_t nwrote;
+
+ nwrote = fwrite(ptr, size, num, context->hidden.stdio.fp);
+ if (nwrote == 0 && ferror(context->hidden.stdio.fp)) {
+ SDL_Error(SDL_EFWRITE);
+ }
+ return nwrote;
+}
+
+static int SDLCALL
+stdio_close(SDL_RWops * context)
+{
+ int status = 0;
+ if (context) {
+ if (context->hidden.stdio.autoclose) {
+ /* WARNING: Check the return value here! */
+ if (fclose(context->hidden.stdio.fp) != 0) {
+ status = SDL_Error(SDL_EFWRITE);
+ }
+ }
+ SDL_FreeRW(context);
+ }
+ return status;
+}
+#endif /* !HAVE_STDIO_H */
+
+/* Functions to read/write memory pointers */
+
+static Sint64 SDLCALL
+mem_size(SDL_RWops * context)
+{
+ return (Sint64)(context->hidden.mem.stop - context->hidden.mem.base);
+}
+
+static Sint64 SDLCALL
+mem_seek(SDL_RWops * context, Sint64 offset, int whence)
+{
+ Uint8 *newpos;
+
+ switch (whence) {
+ case RW_SEEK_SET:
+ newpos = context->hidden.mem.base + offset;
+ break;
+ case RW_SEEK_CUR:
+ newpos = context->hidden.mem.here + offset;
+ break;
+ case RW_SEEK_END:
+ newpos = context->hidden.mem.stop + offset;
+ break;
+ default:
+ return SDL_SetError("Unknown value for 'whence'");
+ }
+ if (newpos < context->hidden.mem.base) {
+ newpos = context->hidden.mem.base;
+ }
+ if (newpos > context->hidden.mem.stop) {
+ newpos = context->hidden.mem.stop;
+ }
+ context->hidden.mem.here = newpos;
+ return (Sint64)(context->hidden.mem.here - context->hidden.mem.base);
+}
+
+static size_t SDLCALL
+mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
+{
+ size_t total_bytes;
+ size_t mem_available;
+
+ total_bytes = (maxnum * size);
+ if ((maxnum <= 0) || (size <= 0)
+ || ((total_bytes / maxnum) != (size_t) size)) {
+ return 0;
+ }
+
+ mem_available = (context->hidden.mem.stop - context->hidden.mem.here);
+ if (total_bytes > mem_available) {
+ total_bytes = mem_available;
+ }
+
+ SDL_memcpy(ptr, context->hidden.mem.here, total_bytes);
+ context->hidden.mem.here += total_bytes;
+
+ return (total_bytes / size);
+}
+
+static size_t SDLCALL
+mem_write(SDL_RWops * context, const void *ptr, size_t size, size_t num)
+{
+ if ((context->hidden.mem.here + (num * size)) > context->hidden.mem.stop) {
+ num = (context->hidden.mem.stop - context->hidden.mem.here) / size;
+ }
+ SDL_memcpy(context->hidden.mem.here, ptr, num * size);
+ context->hidden.mem.here += num * size;
+ return num;
+}
+
+static size_t SDLCALL
+mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num)
+{
+ SDL_SetError("Can't write to read-only memory");
+ return 0;
+}
+
+static int SDLCALL
+mem_close(SDL_RWops * context)
+{
+ if (context) {
+ SDL_FreeRW(context);
+ }
+ return 0;
+}
+
+
+/* Functions to create SDL_RWops structures from various data sources */
+
+SDL_RWops *
+SDL_RWFromFile(const char *file, const char *mode)
+{
+ SDL_RWops *rwops = NULL;
+ if (!file || !*file || !mode || !*mode) {
+ SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
+ return NULL;
+ }
+#if defined(__ANDROID__)
+#ifdef HAVE_STDIO_H
+ /* Try to open the file on the filesystem first */
+ if (*file == '/') {
+ FILE *fp = fopen(file, mode);
+ if (fp) {
+ return SDL_RWFromFP(fp, 1);
+ }
+ } else {
+ /* Try opening it from internal storage if it's a relative path */
+ char *path;
+ FILE *fp;
+
+ path = SDL_stack_alloc(char, PATH_MAX);
+ if (path) {
+ SDL_snprintf(path, PATH_MAX, "%s/%s",
+ SDL_AndroidGetInternalStoragePath(), file);
+ fp = fopen(path, mode);
+ SDL_stack_free(path);
+ if (fp) {
+ return SDL_RWFromFP(fp, 1);
+ }
+ }
+ }
+#endif /* HAVE_STDIO_H */
+
+ /* Try to open the file from the asset system */
+ rwops = SDL_AllocRW();
+ if (!rwops)
+ return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
+ if (Android_JNI_FileOpen(rwops, file, mode) < 0) {
+ SDL_FreeRW(rwops);
+ return NULL;
+ }
+ rwops->size = Android_JNI_FileSize;
+ rwops->seek = Android_JNI_FileSeek;
+ rwops->read = Android_JNI_FileRead;
+ rwops->write = Android_JNI_FileWrite;
+ rwops->close = Android_JNI_FileClose;
+ rwops->type = SDL_RWOPS_JNIFILE;
+
+#elif defined(__WIN32__)
+ rwops = SDL_AllocRW();
+ if (!rwops)
+ return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
+ if (windows_file_open(rwops, file, mode) < 0) {
+ SDL_FreeRW(rwops);
+ return NULL;
+ }
+ rwops->size = windows_file_size;
+ rwops->seek = windows_file_seek;
+ rwops->read = windows_file_read;
+ rwops->write = windows_file_write;
+ rwops->close = windows_file_close;
+ rwops->type = SDL_RWOPS_WINFILE;
+
+#elif HAVE_STDIO_H
+ {
+ #ifdef __APPLE__
+ FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
+ #elif __WINRT__
+ FILE *fp = NULL;
+ fopen_s(&fp, file, mode);
+ #else
+ FILE *fp = fopen(file, mode);
+ #endif
+ if (fp == NULL) {
+ SDL_SetError("Couldn't open %s", file);
+ } else {
+ rwops = SDL_RWFromFP(fp, 1);
+ }
+ }
+#else
+ SDL_SetError("SDL not compiled with stdio support");
+#endif /* !HAVE_STDIO_H */
+
+ return rwops;
+}
+
+#ifdef HAVE_STDIO_H
+SDL_RWops *
+SDL_RWFromFP(FILE * fp, SDL_bool autoclose)
+{
+ SDL_RWops *rwops = NULL;
+
+ rwops = SDL_AllocRW();
+ if (rwops != NULL) {
+ rwops->size = stdio_size;
+ rwops->seek = stdio_seek;
+ rwops->read = stdio_read;
+ rwops->write = stdio_write;
+ rwops->close = stdio_close;
+ rwops->hidden.stdio.fp = fp;
+ rwops->hidden.stdio.autoclose = autoclose;
+ rwops->type = SDL_RWOPS_STDFILE;
+ }
+ return rwops;
+}
+#else
+SDL_RWops *
+SDL_RWFromFP(void * fp, SDL_bool autoclose)
+{
+ SDL_SetError("SDL not compiled with stdio support");
+ return NULL;
+}
+#endif /* HAVE_STDIO_H */
+
+SDL_RWops *
+SDL_RWFromMem(void *mem, int size)
+{
+ SDL_RWops *rwops = NULL;
+ if (!mem) {
+ SDL_InvalidParamError("mem");
+ return rwops;
+ }
+ if (!size) {
+ SDL_InvalidParamError("size");
+ return rwops;
+ }
+
+ rwops = SDL_AllocRW();
+ if (rwops != NULL) {
+ rwops->size = mem_size;
+ rwops->seek = mem_seek;
+ rwops->read = mem_read;
+ rwops->write = mem_write;
+ rwops->close = mem_close;
+ rwops->hidden.mem.base = (Uint8 *) mem;
+ rwops->hidden.mem.here = rwops->hidden.mem.base;
+ rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
+ rwops->type = SDL_RWOPS_MEMORY;
+ }
+ return rwops;
+}
+
+SDL_RWops *
+SDL_RWFromConstMem(const void *mem, int size)
+{
+ SDL_RWops *rwops = NULL;
+ if (!mem) {
+ SDL_InvalidParamError("mem");
+ return rwops;
+ }
+ if (!size) {
+ SDL_InvalidParamError("size");
+ return rwops;
+ }
+
+ rwops = SDL_AllocRW();
+ if (rwops != NULL) {
+ rwops->size = mem_size;
+ rwops->seek = mem_seek;
+ rwops->read = mem_read;
+ rwops->write = mem_writeconst;
+ rwops->close = mem_close;
+ rwops->hidden.mem.base = (Uint8 *) mem;
+ rwops->hidden.mem.here = rwops->hidden.mem.base;
+ rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
+ rwops->type = SDL_RWOPS_MEMORY_RO;
+ }
+ return rwops;
+}
+
+SDL_RWops *
+SDL_AllocRW(void)
+{
+ SDL_RWops *area;
+
+ area = (SDL_RWops *) SDL_malloc(sizeof *area);
+ if (area == NULL) {
+ SDL_OutOfMemory();
+ } else {
+ area->type = SDL_RWOPS_UNKNOWN;
+ }
+ return area;
+}
+
+void
+SDL_FreeRW(SDL_RWops * area)
+{
+ SDL_free(area);
+}
+
+/* Load all the data from an SDL data stream */
+void *
+SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc)
+{
+ const int FILE_CHUNK_SIZE = 1024;
+ Sint64 size;
+ size_t size_read, size_total;
+ void *data = NULL, *newdata;
+
+ if (!src) {
+ SDL_InvalidParamError("src");
+ return NULL;
+ }
+
+ size = SDL_RWsize(src);
+ if (size < 0) {
+ size = FILE_CHUNK_SIZE;
+ }
+ data = SDL_malloc((size_t)(size + 1));
+
+ size_total = 0;
+ for (;;) {
+ if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) {
+ size = (size_total + FILE_CHUNK_SIZE);
+ newdata = SDL_realloc(data, (size_t)(size + 1));
+ if (!newdata) {
+ SDL_free(data);
+ data = NULL;
+ SDL_OutOfMemory();
+ goto done;
+ }
+ data = newdata;
+ }
+
+ size_read = SDL_RWread(src, (char *)data+size_total, 1, (size_t)(size-size_total));
+ if (size_read == 0) {
+ break;
+ }
+ size_total += size_read;
+ }
+
+ if (datasize) {
+ *datasize = size_total;
+ }
+ ((char *)data)[size_total] = '\0';
+
+done:
+ if (freesrc && src) {
+ SDL_RWclose(src);
+ }
+ return data;
+}
+
+/* Functions for dynamically reading and writing endian-specific values */
+
+Uint8
+SDL_ReadU8(SDL_RWops * src)
+{
+ Uint8 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return value;
+}
+
+Uint16
+SDL_ReadLE16(SDL_RWops * src)
+{
+ Uint16 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapLE16(value);
+}
+
+Uint16
+SDL_ReadBE16(SDL_RWops * src)
+{
+ Uint16 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapBE16(value);
+}
+
+Uint32
+SDL_ReadLE32(SDL_RWops * src)
+{
+ Uint32 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapLE32(value);
+}
+
+Uint32
+SDL_ReadBE32(SDL_RWops * src)
+{
+ Uint32 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapBE32(value);
+}
+
+Uint64
+SDL_ReadLE64(SDL_RWops * src)
+{
+ Uint64 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapLE64(value);
+}
+
+Uint64
+SDL_ReadBE64(SDL_RWops * src)
+{
+ Uint64 value = 0;
+
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapBE64(value);
+}
+
+size_t
+SDL_WriteU8(SDL_RWops * dst, Uint8 value)
+{
+ return SDL_RWwrite(dst, &value, sizeof (value), 1);
+}
+
+size_t
+SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
+{
+ const Uint16 swapped = SDL_SwapLE16(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+}
+
+size_t
+SDL_WriteBE16(SDL_RWops * dst, Uint16 value)
+{
+ const Uint16 swapped = SDL_SwapBE16(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+}
+
+size_t
+SDL_WriteLE32(SDL_RWops * dst, Uint32 value)
+{
+ const Uint32 swapped = SDL_SwapLE32(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+}
+
+size_t
+SDL_WriteBE32(SDL_RWops * dst, Uint32 value)
+{
+ const Uint32 swapped = SDL_SwapBE32(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+}
+
+size_t
+SDL_WriteLE64(SDL_RWops * dst, Uint64 value)
+{
+ const Uint64 swapped = SDL_SwapLE64(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+}
+
+size_t
+SDL_WriteBE64(SDL_RWops * dst, Uint64 value)
+{
+ const Uint64 swapped = SDL_SwapBE64(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h b/src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h
new file mode 100644
index 0000000..64edc0d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifdef __APPLE__
+
+#include <stdio.h>
+
+#ifndef SDL_rwopsbundlesupport_h
+#define SDL_rwopsbundlesupport_h
+FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode);
+#endif
+#endif
diff --git a/src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m b/src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m
new file mode 100644
index 0000000..8f1bf54
--- /dev/null
+++ b/src/3rdparty/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m
@@ -0,0 +1,62 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef __APPLE__
+#import <Foundation/Foundation.h>
+
+#include "SDL_rwopsbundlesupport.h"
+
+/* For proper OS X applications, the resources are contained inside the application bundle.
+ So the strategy is to first check the application bundle for the file, then fallback to the current working directory.
+ Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app.
+ We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework,
+ but we would somehow need to know what the bundle identifiers we need to search are.
+ Also, note the bundle layouts are different for iPhone and Mac.
+*/
+FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
+{ @autoreleasepool
+{
+ FILE* fp = NULL;
+
+ /* If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only. */
+ if(strcmp("r", mode) && strcmp("rb", mode)) {
+ return fopen(file, mode);
+ }
+
+ NSFileManager* file_manager = [NSFileManager defaultManager];
+ NSString* resource_path = [[NSBundle mainBundle] resourcePath];
+
+ NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+
+ NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
+ if([file_manager fileExistsAtPath:full_path_with_file_to_try]) {
+ fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
+ } else {
+ fp = fopen(file, mode);
+ }
+
+ return fp;
+}}
+
+#endif /* __APPLE__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/android/SDL_sysfilesystem.c b/src/3rdparty/SDL2/src/filesystem/android/SDL_sysfilesystem.c
new file mode 100644
index 0000000..7f3f92d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/android/SDL_sysfilesystem.c
@@ -0,0 +1,62 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_FILESYSTEM_ANDROID
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+
+#include <unistd.h>
+
+#include "SDL_error.h"
+#include "SDL_filesystem.h"
+#include "SDL_system.h"
+
+
+char *
+SDL_GetBasePath(void)
+{
+ /* The current working directory is / on Android */
+ SDL_Unsupported();
+ return NULL;
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ const char *path = SDL_AndroidGetInternalStoragePath();
+ if (path) {
+ size_t pathlen = SDL_strlen(path)+2;
+ char *fullpath = (char *)SDL_malloc(pathlen);
+ if (!fullpath) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_snprintf(fullpath, pathlen, "%s/", path);
+ return fullpath;
+ }
+ return NULL;
+}
+
+#endif /* SDL_FILESYSTEM_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m b/src/3rdparty/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m
new file mode 100644
index 0000000..6153a20
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m
@@ -0,0 +1,117 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_FILESYSTEM_COCOA
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+
+#include <Foundation/Foundation.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "SDL_error.h"
+#include "SDL_stdinc.h"
+#include "SDL_filesystem.h"
+
+char *
+SDL_GetBasePath(void)
+{ @autoreleasepool
+{
+ NSBundle *bundle = [NSBundle mainBundle];
+ const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String];
+ const char *base = NULL;
+ char *retval = NULL;
+
+ if (baseType == NULL) {
+ baseType = "resource";
+ }
+ if (SDL_strcasecmp(baseType, "bundle")==0) {
+ base = [[bundle bundlePath] fileSystemRepresentation];
+ } else if (SDL_strcasecmp(baseType, "parent")==0) {
+ base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation];
+ } else {
+ /* this returns the exedir for non-bundled and the resourceDir for bundled apps */
+ base = [[bundle resourcePath] fileSystemRepresentation];
+ }
+
+ if (base) {
+ const size_t len = SDL_strlen(base) + 2;
+ retval = (char *) SDL_malloc(len);
+ if (retval == NULL) {
+ SDL_OutOfMemory();
+ } else {
+ SDL_snprintf(retval, len, "%s/", base);
+ }
+ }
+
+ return retval;
+}}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{ @autoreleasepool
+{
+ if (!app) {
+ SDL_InvalidParamError("app");
+ return NULL;
+ }
+ if (!org) {
+ org = "";
+ }
+
+ char *retval = NULL;
+ NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
+
+ if ([array count] > 0) { /* we only want the first item in the list. */
+ NSString *str = [array objectAtIndex:0];
+ const char *base = [str fileSystemRepresentation];
+ if (base) {
+ const size_t len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4;
+ retval = (char *) SDL_malloc(len);
+ if (retval == NULL) {
+ SDL_OutOfMemory();
+ } else {
+ char *ptr;
+ if (*org) {
+ SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app);
+ } else {
+ SDL_snprintf(retval, len, "%s/%s/", base, app);
+ }
+ for (ptr = retval+1; *ptr; ptr++) {
+ if (*ptr == '/') {
+ *ptr = '\0';
+ mkdir(retval, 0700);
+ *ptr = '/';
+ }
+ }
+ mkdir(retval, 0700);
+ }
+ }
+ }
+
+ return retval;
+}}
+
+#endif /* SDL_FILESYSTEM_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c b/src/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c
new file mode 100644
index 0000000..f4628a1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(SDL_FILESYSTEM_DUMMY) || defined(SDL_FILESYSTEM_DISABLED)
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+
+#include "SDL_error.h"
+#include "SDL_filesystem.h"
+
+char *
+SDL_GetBasePath(void)
+{
+ SDL_Unsupported();
+ return NULL;
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ SDL_Unsupported();
+ return NULL;
+}
+
+#endif /* SDL_FILESYSTEM_DUMMY || SDL_FILESYSTEM_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c b/src/3rdparty/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c
new file mode 100644
index 0000000..4ba57c1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c
@@ -0,0 +1,81 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_FILESYSTEM_EMSCRIPTEN
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+#include <errno.h>
+#include <sys/stat.h>
+
+#include "SDL_error.h"
+#include "SDL_filesystem.h"
+
+#include <emscripten/emscripten.h>
+
+char *
+SDL_GetBasePath(void)
+{
+ char *retval = "/";
+ return SDL_strdup(retval);
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ const char *append = "/libsdl/";
+ char *retval;
+ size_t len = 0;
+
+ if (!app) {
+ SDL_InvalidParamError("app");
+ return NULL;
+ }
+ if (!org) {
+ org = "";
+ }
+
+ len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
+ retval = (char *) SDL_malloc(len);
+ if (!retval) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ if (*org) {
+ SDL_snprintf(retval, len, "%s%s/%s/", append, org, app);
+ } else {
+ SDL_snprintf(retval, len, "%s%s/", append, app);
+ }
+
+ if (mkdir(retval, 0700) != 0 && errno != EEXIST) {
+ SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno));
+ SDL_free(retval);
+ return NULL;
+ }
+
+ return retval;
+}
+
+#endif /* SDL_FILESYSTEM_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/3rdparty/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc
new file mode 100644
index 0000000..b56bc4b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc
@@ -0,0 +1,110 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_FILESYSTEM_HAIKU
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+
+#include <kernel/image.h>
+#include <storage/Directory.h>
+#include <storage/Entry.h>
+#include <storage/Path.h>
+
+#include "SDL_error.h"
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+#include "SDL_filesystem.h"
+
+char *
+SDL_GetBasePath(void)
+{
+ image_info info;
+ int32 cookie = 0;
+
+ while (get_next_image_info(0, &cookie, &info) == B_OK) {
+ if (info.type == B_APP_IMAGE) {
+ break;
+ }
+ }
+
+ BEntry entry(info.name, true);
+ BPath path;
+ status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */
+ SDL_assert(rc == B_OK);
+ rc = path.GetParent(&path); /* chop filename, keep directory. */
+ SDL_assert(rc == B_OK);
+ const char *str = path.Path();
+ SDL_assert(str != NULL);
+
+ const size_t len = SDL_strlen(str);
+ char *retval = (char *) SDL_malloc(len + 2);
+ if (!retval) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ SDL_memcpy(retval, str, len);
+ retval[len] = '/';
+ retval[len+1] = '\0';
+ return retval;
+}
+
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ // !!! FIXME: is there a better way to do this?
+ const char *home = SDL_getenv("HOME");
+ const char *append = "/config/settings/";
+ size_t len = SDL_strlen(home);
+
+ if (!app) {
+ SDL_InvalidParamError("app");
+ return NULL;
+ }
+ if (!org) {
+ org = "";
+ }
+
+ if (!len || (home[len - 1] == '/')) {
+ ++append; // home empty or ends with separator, skip the one from append
+ }
+ len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
+ char *retval = (char *) SDL_malloc(len);
+ if (!retval) {
+ SDL_OutOfMemory();
+ } else {
+ if (*org) {
+ SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app);
+ } else {
+ SDL_snprintf(retval, len, "%s%s%s/", home, append, app);
+ }
+ create_directory(retval, 0700); // Haiku api: creates missing dirs
+ }
+
+ return retval;
+}
+
+#endif /* SDL_FILESYSTEM_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c b/src/3rdparty/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c
new file mode 100644
index 0000000..f22ca75
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c
@@ -0,0 +1,43 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "SDL_error.h"
+#include "SDL_filesystem.h"
+
+#ifdef SDL_FILESYSTEM_NACL
+
+char *
+SDL_GetBasePath(void)
+{
+ SDL_Unsupported();
+ return NULL;
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ SDL_Unsupported();
+ return NULL;
+}
+
+#endif /* SDL_FILESYSTEM_NACL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c b/src/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
new file mode 100644
index 0000000..d6af39f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
@@ -0,0 +1,250 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_FILESYSTEM_UNIX
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
+
+#if defined(__FREEBSD__) || defined(__OPENBSD__)
+#include <sys/sysctl.h>
+#endif
+
+#include "SDL_error.h"
+#include "SDL_stdinc.h"
+#include "SDL_filesystem.h"
+#include "SDL_rwops.h"
+
+/* QNX's /proc/self/exefile is a text file and not a symlink. */
+#if !defined(__QNXNTO__)
+static char *
+readSymLink(const char *path)
+{
+ char *retval = NULL;
+ ssize_t len = 64;
+ ssize_t rc = -1;
+
+ while (1)
+ {
+ char *ptr = (char *) SDL_realloc(retval, (size_t) len);
+ if (ptr == NULL) {
+ SDL_OutOfMemory();
+ break;
+ }
+
+ retval = ptr;
+
+ rc = readlink(path, retval, len);
+ if (rc == -1) {
+ break; /* not a symlink, i/o error, etc. */
+ } else if (rc < len) {
+ retval[rc] = '\0'; /* readlink doesn't null-terminate. */
+ return retval; /* we're good to go. */
+ }
+
+ len *= 2; /* grow buffer, try again. */
+ }
+
+ SDL_free(retval);
+ return NULL;
+}
+#endif
+
+char *
+SDL_GetBasePath(void)
+{
+ char *retval = NULL;
+
+#if defined(__FREEBSD__)
+ char fullpath[PATH_MAX];
+ size_t buflen = sizeof (fullpath);
+ const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+ if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) {
+ retval = SDL_strdup(fullpath);
+ if (!retval) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ }
+#endif
+#if defined(__OPENBSD__)
+ char **retvalargs;
+ size_t len;
+ const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
+ if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) {
+ retvalargs = SDL_malloc(len);
+ if (!retvalargs) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ sysctl(mib, 4, retvalargs, &len, NULL, 0);
+ retval = SDL_malloc(PATH_MAX + 1);
+ if (retval)
+ realpath(retvalargs[0], retval);
+
+ SDL_free(retvalargs);
+ }
+#endif
+#if defined(__SOLARIS__)
+ const char *path = getexecname();
+ if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */
+ retval = SDL_strdup(path);
+ if (!retval) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ }
+#endif
+
+ /* is a Linux-style /proc filesystem available? */
+ if (!retval && (access("/proc", F_OK) == 0)) {
+ /* !!! FIXME: after 2.0.6 ships, let's delete this code and just
+ use the /proc/%llu version. There's no reason to have
+ two copies of this plus all the #ifdefs. --ryan. */
+#if defined(__FREEBSD__)
+ retval = readSymLink("/proc/curproc/file");
+#elif defined(__NETBSD__)
+ retval = readSymLink("/proc/curproc/exe");
+#elif defined(__QNXNTO__)
+ retval = SDL_LoadFile("/proc/self/exefile", NULL);
+#else
+ retval = readSymLink("/proc/self/exe"); /* linux. */
+ if (retval == NULL) {
+ /* older kernels don't have /proc/self ... try PID version... */
+ char path[64];
+ const int rc = (int) SDL_snprintf(path, sizeof(path),
+ "/proc/%llu/exe",
+ (unsigned long long) getpid());
+ if ( (rc > 0) && (rc < sizeof(path)) ) {
+ retval = readSymLink(path);
+ }
+ }
+#endif
+ }
+
+ /* If we had access to argv[0] here, we could check it for a path,
+ or troll through $PATH looking for it, too. */
+
+ if (retval != NULL) { /* chop off filename. */
+ char *ptr = SDL_strrchr(retval, '/');
+ if (ptr != NULL) {
+ *(ptr+1) = '\0';
+ } else { /* shouldn't happen, but just in case... */
+ SDL_free(retval);
+ retval = NULL;
+ }
+ }
+
+ if (retval != NULL) {
+ /* try to shrink buffer... */
+ char *ptr = (char *) SDL_realloc(retval, strlen(retval) + 1);
+ if (ptr != NULL)
+ retval = ptr; /* oh well if it failed. */
+ }
+
+ return retval;
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ /*
+ * We use XDG's base directory spec, even if you're not on Linux.
+ * This isn't strictly correct, but the results are relatively sane
+ * in any case.
+ *
+ * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+ */
+ const char *envr = SDL_getenv("XDG_DATA_HOME");
+ const char *append;
+ char *retval = NULL;
+ char *ptr = NULL;
+ size_t len = 0;
+
+ if (!app) {
+ SDL_InvalidParamError("app");
+ return NULL;
+ }
+ if (!org) {
+ org = "";
+ }
+
+ if (!envr) {
+ /* You end up with "$HOME/.local/share/Game Name 2" */
+ envr = SDL_getenv("HOME");
+ if (!envr) {
+ /* we could take heroic measures with /etc/passwd, but oh well. */
+ SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
+ return NULL;
+ }
+ append = "/.local/share/";
+ } else {
+ append = "/";
+ }
+
+ len = SDL_strlen(envr);
+ if (envr[len - 1] == '/')
+ append += 1;
+
+ len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
+ retval = (char *) SDL_malloc(len);
+ if (!retval) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ if (*org) {
+ SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app);
+ } else {
+ SDL_snprintf(retval, len, "%s%s%s/", envr, append, app);
+ }
+
+ for (ptr = retval+1; *ptr; ptr++) {
+ if (*ptr == '/') {
+ *ptr = '\0';
+ if (mkdir(retval, 0700) != 0 && errno != EEXIST)
+ goto error;
+ *ptr = '/';
+ }
+ }
+ if (mkdir(retval, 0700) != 0 && errno != EEXIST) {
+error:
+ SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno));
+ SDL_free(retval);
+ return NULL;
+ }
+
+ return retval;
+}
+
+#endif /* SDL_FILESYSTEM_UNIX */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/windows/SDL_sysfilesystem.c b/src/3rdparty/SDL2/src/filesystem/windows/SDL_sysfilesystem.c
new file mode 100644
index 0000000..5219789
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/windows/SDL_sysfilesystem.c
@@ -0,0 +1,192 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_FILESYSTEM_WINDOWS
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent filesystem routines */
+
+#include "../../core/windows/SDL_windows.h"
+#include <shlobj.h>
+
+#include "SDL_assert.h"
+#include "SDL_error.h"
+#include "SDL_stdinc.h"
+#include "SDL_filesystem.h"
+
+char *
+SDL_GetBasePath(void)
+{
+ typedef DWORD (WINAPI *GetModuleFileNameExW_t)(HANDLE, HMODULE, LPWSTR, DWORD);
+ GetModuleFileNameExW_t pGetModuleFileNameExW;
+ DWORD buflen = 128;
+ WCHAR *path = NULL;
+ HANDLE psapi = LoadLibrary(L"psapi.dll");
+ char *retval = NULL;
+ DWORD len = 0;
+ int i;
+
+ if (!psapi) {
+ WIN_SetError("Couldn't load psapi.dll");
+ return NULL;
+ }
+
+ pGetModuleFileNameExW = (GetModuleFileNameExW_t)GetProcAddress(psapi, "GetModuleFileNameExW");
+ if (!pGetModuleFileNameExW) {
+ WIN_SetError("Couldn't find GetModuleFileNameExW");
+ FreeLibrary(psapi);
+ return NULL;
+ }
+
+ while (SDL_TRUE) {
+ void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR));
+ if (!ptr) {
+ SDL_free(path);
+ FreeLibrary(psapi);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ path = (WCHAR *) ptr;
+
+ len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen);
+ if (len != buflen) {
+ break;
+ }
+
+ /* buffer too small? Try again. */
+ buflen *= 2;
+ }
+
+ FreeLibrary(psapi);
+
+ if (len == 0) {
+ SDL_free(path);
+ WIN_SetError("Couldn't locate our .exe");
+ return NULL;
+ }
+
+ for (i = len-1; i > 0; i--) {
+ if (path[i] == '\\') {
+ break;
+ }
+ }
+
+ SDL_assert(i > 0); /* Should have been an absolute path. */
+ path[i+1] = '\0'; /* chop off filename. */
+
+ retval = WIN_StringToUTF8(path);
+ SDL_free(path);
+
+ return retval;
+}
+
+char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ /*
+ * Vista and later has a new API for this, but SHGetFolderPath works there,
+ * and apparently just wraps the new API. This is the new way to do it:
+ *
+ * SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_CREATE,
+ * NULL, &wszPath);
+ */
+
+ WCHAR path[MAX_PATH];
+ char *retval = NULL;
+ WCHAR* worg = NULL;
+ WCHAR* wapp = NULL;
+ size_t new_wpath_len = 0;
+ BOOL api_result = FALSE;
+
+ if (!app) {
+ SDL_InvalidParamError("app");
+ return NULL;
+ }
+ if (!org) {
+ org = "";
+ }
+
+ if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) {
+ WIN_SetError("Couldn't locate our prefpath");
+ return NULL;
+ }
+
+ worg = WIN_UTF8ToString(org);
+ if (worg == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ wapp = WIN_UTF8ToString(app);
+ if (wapp == NULL) {
+ SDL_free(worg);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ new_wpath_len = lstrlenW(worg) + lstrlenW(wapp) + lstrlenW(path) + 3;
+
+ if ((new_wpath_len + 1) > MAX_PATH) {
+ SDL_free(worg);
+ SDL_free(wapp);
+ WIN_SetError("Path too long.");
+ return NULL;
+ }
+
+ if (*worg) {
+ lstrcatW(path, L"\\");
+ lstrcatW(path, worg);
+ }
+ SDL_free(worg);
+
+ api_result = CreateDirectoryW(path, NULL);
+ if (api_result == FALSE) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS) {
+ SDL_free(wapp);
+ WIN_SetError("Couldn't create a prefpath.");
+ return NULL;
+ }
+ }
+
+ lstrcatW(path, L"\\");
+ lstrcatW(path, wapp);
+ SDL_free(wapp);
+
+ api_result = CreateDirectoryW(path, NULL);
+ if (api_result == FALSE) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS) {
+ WIN_SetError("Couldn't create a prefpath.");
+ return NULL;
+ }
+ }
+
+ lstrcatW(path, L"\\");
+
+ retval = WIN_StringToUTF8(path);
+
+ return retval;
+}
+
+#endif /* SDL_FILESYSTEM_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp b/src/3rdparty/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp
new file mode 100644
index 0000000..71818dd
--- /dev/null
+++ b/src/3rdparty/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp
@@ -0,0 +1,233 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all
+*/
+
+#ifdef __WINRT__
+
+extern "C" {
+#include "SDL_filesystem.h"
+#include "SDL_error.h"
+#include "SDL_hints.h"
+#include "SDL_stdinc.h"
+#include "SDL_system.h"
+#include "../../core/windows/SDL_windows.h"
+}
+
+#include <string>
+#include <unordered_map>
+
+using namespace std;
+using namespace Windows::Storage;
+
+extern "C" const wchar_t *
+SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
+{
+ switch (pathType) {
+ case SDL_WINRT_PATH_INSTALLED_LOCATION:
+ {
+ static wstring path;
+ if (path.empty()) {
+ path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
+ }
+ return path.c_str();
+ }
+
+ case SDL_WINRT_PATH_LOCAL_FOLDER:
+ {
+ static wstring path;
+ if (path.empty()) {
+ path = ApplicationData::Current->LocalFolder->Path->Data();
+ }
+ return path.c_str();
+ }
+
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
+ case SDL_WINRT_PATH_ROAMING_FOLDER:
+ {
+ static wstring path;
+ if (path.empty()) {
+ path = ApplicationData::Current->RoamingFolder->Path->Data();
+ }
+ return path.c_str();
+ }
+
+ case SDL_WINRT_PATH_TEMP_FOLDER:
+ {
+ static wstring path;
+ if (path.empty()) {
+ path = ApplicationData::Current->TemporaryFolder->Path->Data();
+ }
+ return path.c_str();
+ }
+#endif
+
+ default:
+ break;
+ }
+
+ SDL_Unsupported();
+ return NULL;
+}
+
+extern "C" const char *
+SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
+{
+ typedef unordered_map<SDL_WinRT_Path, string> UTF8PathMap;
+ static UTF8PathMap utf8Paths;
+
+ UTF8PathMap::iterator searchResult = utf8Paths.find(pathType);
+ if (searchResult != utf8Paths.end()) {
+ return searchResult->second.c_str();
+ }
+
+ const wchar_t * ucs2Path = SDL_WinRTGetFSPathUNICODE(pathType);
+ if (!ucs2Path) {
+ return NULL;
+ }
+
+ char * utf8Path = WIN_StringToUTF8(ucs2Path);
+ utf8Paths[pathType] = utf8Path;
+ SDL_free(utf8Path);
+ return utf8Paths[pathType].c_str();
+}
+
+extern "C" char *
+SDL_GetBasePath(void)
+{
+ const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_INSTALLED_LOCATION);
+ size_t destPathLen;
+ char * destPath = NULL;
+
+ if (!srcPath) {
+ SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
+ return NULL;
+ }
+
+ destPathLen = SDL_strlen(srcPath) + 2;
+ destPath = (char *) SDL_malloc(destPathLen);
+ if (!destPath) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ SDL_snprintf(destPath, destPathLen, "%s\\", srcPath);
+ return destPath;
+}
+
+extern "C" char *
+SDL_GetPrefPath(const char *org, const char *app)
+{
+ /* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and
+ * earlier is not available on WinRT or Windows Phone. WinRT provides
+ * a similar API, but SHGetFolderPath can't be called, at least not
+ * without violating Microsoft's app-store requirements.
+ */
+
+ const WCHAR * srcPath = NULL;
+ WCHAR path[MAX_PATH];
+ char *retval = NULL;
+ WCHAR* worg = NULL;
+ WCHAR* wapp = NULL;
+ size_t new_wpath_len = 0;
+ BOOL api_result = FALSE;
+
+ if (!app) {
+ SDL_InvalidParamError("app");
+ return NULL;
+ }
+ if (!org) {
+ org = "";
+ }
+
+ srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER);
+ if ( ! srcPath) {
+ SDL_SetError("Unable to find a source path");
+ return NULL;
+ }
+
+ if (SDL_wcslen(srcPath) >= MAX_PATH) {
+ SDL_SetError("Path too long.");
+ return NULL;
+ }
+ SDL_wcslcpy(path, srcPath, SDL_arraysize(path));
+
+ worg = WIN_UTF8ToString(org);
+ if (worg == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ wapp = WIN_UTF8ToString(app);
+ if (wapp == NULL) {
+ SDL_free(worg);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ new_wpath_len = SDL_wcslen(worg) + SDL_wcslen(wapp) + SDL_wcslen(path) + 3;
+
+ if ((new_wpath_len + 1) > MAX_PATH) {
+ SDL_free(worg);
+ SDL_free(wapp);
+ SDL_SetError("Path too long.");
+ return NULL;
+ }
+
+ if (*worg) {
+ SDL_wcslcat(path, L"\\", new_wpath_len + 1);
+ SDL_wcslcat(path, worg, new_wpath_len + 1);
+ SDL_free(worg);
+ }
+
+ api_result = CreateDirectoryW(path, NULL);
+ if (api_result == FALSE) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS) {
+ SDL_free(wapp);
+ WIN_SetError("Couldn't create a prefpath.");
+ return NULL;
+ }
+ }
+
+ SDL_wcslcat(path, L"\\", new_wpath_len + 1);
+ SDL_wcslcat(path, wapp, new_wpath_len + 1);
+ SDL_free(wapp);
+
+ api_result = CreateDirectoryW(path, NULL);
+ if (api_result == FALSE) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS) {
+ WIN_SetError("Couldn't create a prefpath.");
+ return NULL;
+ }
+ }
+
+ SDL_wcslcat(path, L"\\", new_wpath_len + 1);
+
+ retval = WIN_StringToUTF8(path);
+
+ return retval;
+}
+
+#endif /* __WINRT__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/SDL_haptic.c b/src/3rdparty/SDL2/src/haptic/SDL_haptic.c
new file mode 100644
index 0000000..4988c30
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/SDL_haptic.c
@@ -0,0 +1,849 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_syshaptic.h"
+#include "SDL_haptic_c.h"
+#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
+#include "SDL_assert.h"
+
+/* Global for SDL_windowshaptic.c */
+SDL_Haptic *SDL_haptics = NULL;
+
+/*
+ * Initializes the Haptic devices.
+ */
+int
+SDL_HapticInit(void)
+{
+ int status;
+
+ status = SDL_SYS_HapticInit();
+ if (status >= 0) {
+ status = 0;
+ }
+
+ return status;
+}
+
+
+/*
+ * Checks to see if the haptic device is valid
+ */
+static int
+ValidHaptic(SDL_Haptic * haptic)
+{
+ int valid;
+ SDL_Haptic *hapticlist;
+
+ valid = 0;
+ if (haptic != NULL) {
+ hapticlist = SDL_haptics;
+ while ( hapticlist )
+ {
+ if (hapticlist == haptic) {
+ valid = 1;
+ break;
+ }
+ hapticlist = hapticlist->next;
+ }
+ }
+
+ /* Create the error here. */
+ if (valid == 0) {
+ SDL_SetError("Haptic: Invalid haptic device identifier");
+ }
+
+ return valid;
+}
+
+
+/*
+ * Returns the number of available devices.
+ */
+int
+SDL_NumHaptics(void)
+{
+ return SDL_SYS_NumHaptics();
+}
+
+
+/*
+ * Gets the name of a Haptic device by index.
+ */
+const char *
+SDL_HapticName(int device_index)
+{
+ if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
+ SDL_SetError("Haptic: There are %d haptic devices available",
+ SDL_NumHaptics());
+ return NULL;
+ }
+ return SDL_SYS_HapticName(device_index);
+}
+
+
+/*
+ * Opens a Haptic device.
+ */
+SDL_Haptic *
+SDL_HapticOpen(int device_index)
+{
+ SDL_Haptic *haptic;
+ SDL_Haptic *hapticlist;
+
+ if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
+ SDL_SetError("Haptic: There are %d haptic devices available",
+ SDL_NumHaptics());
+ return NULL;
+ }
+
+ hapticlist = SDL_haptics;
+ /* If the haptic is already open, return it
+ * TODO: Should we create haptic instance IDs like the Joystick API?
+ */
+ while ( hapticlist )
+ {
+ if (device_index == hapticlist->index) {
+ haptic = hapticlist;
+ ++haptic->ref_count;
+ return haptic;
+ }
+ hapticlist = hapticlist->next;
+ }
+
+ /* Create the haptic device */
+ haptic = (SDL_Haptic *) SDL_malloc((sizeof *haptic));
+ if (haptic == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize the haptic device */
+ SDL_memset(haptic, 0, (sizeof *haptic));
+ haptic->rumble_id = -1;
+ haptic->index = device_index;
+ if (SDL_SYS_HapticOpen(haptic) < 0) {
+ SDL_free(haptic);
+ return NULL;
+ }
+
+ /* Add haptic to list */
+ ++haptic->ref_count;
+ /* Link the haptic in the list */
+ haptic->next = SDL_haptics;
+ SDL_haptics = haptic;
+
+ /* Disable autocenter and set gain to max. */
+ if (haptic->supported & SDL_HAPTIC_GAIN)
+ SDL_HapticSetGain(haptic, 100);
+ if (haptic->supported & SDL_HAPTIC_AUTOCENTER)
+ SDL_HapticSetAutocenter(haptic, 0);
+
+ return haptic;
+}
+
+
+/*
+ * Returns 1 if the device has been opened.
+ */
+int
+SDL_HapticOpened(int device_index)
+{
+ int opened;
+ SDL_Haptic *hapticlist;
+
+ /* Make sure it's valid. */
+ if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
+ SDL_SetError("Haptic: There are %d haptic devices available",
+ SDL_NumHaptics());
+ return 0;
+ }
+
+ opened = 0;
+ hapticlist = SDL_haptics;
+ /* TODO Should this use an instance ID? */
+ while ( hapticlist )
+ {
+ if (hapticlist->index == (Uint8) device_index) {
+ opened = 1;
+ break;
+ }
+ hapticlist = hapticlist->next;
+ }
+ return opened;
+}
+
+
+/*
+ * Returns the index to a haptic device.
+ */
+int
+SDL_HapticIndex(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ return haptic->index;
+}
+
+
+/*
+ * Returns SDL_TRUE if mouse is haptic, SDL_FALSE if it isn't.
+ */
+int
+SDL_MouseIsHaptic(void)
+{
+ if (SDL_SYS_HapticMouse() < 0)
+ return SDL_FALSE;
+ return SDL_TRUE;
+}
+
+
+/*
+ * Returns the haptic device if mouse is haptic or NULL elsewise.
+ */
+SDL_Haptic *
+SDL_HapticOpenFromMouse(void)
+{
+ int device_index;
+
+ device_index = SDL_SYS_HapticMouse();
+
+ if (device_index < 0) {
+ SDL_SetError("Haptic: Mouse isn't a haptic device.");
+ return NULL;
+ }
+
+ return SDL_HapticOpen(device_index);
+}
+
+
+/*
+ * Returns SDL_TRUE if joystick has haptic features.
+ */
+int
+SDL_JoystickIsHaptic(SDL_Joystick * joystick)
+{
+ int ret;
+
+ /* Must be a valid joystick */
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return -1;
+ }
+
+ ret = SDL_SYS_JoystickIsHaptic(joystick);
+
+ if (ret > 0)
+ return SDL_TRUE;
+ else if (ret == 0)
+ return SDL_FALSE;
+ else
+ return -1;
+}
+
+
+/*
+ * Opens a haptic device from a joystick.
+ */
+SDL_Haptic *
+SDL_HapticOpenFromJoystick(SDL_Joystick * joystick)
+{
+ SDL_Haptic *haptic;
+ SDL_Haptic *hapticlist;
+
+ /* Make sure there is room. */
+ if (SDL_NumHaptics() <= 0) {
+ SDL_SetError("Haptic: There are %d haptic devices available",
+ SDL_NumHaptics());
+ return NULL;
+ }
+
+ /* Must be a valid joystick */
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ SDL_SetError("Haptic: Joystick isn't valid.");
+ return NULL;
+ }
+
+ /* Joystick must be haptic */
+ if (SDL_SYS_JoystickIsHaptic(joystick) <= 0) {
+ SDL_SetError("Haptic: Joystick isn't a haptic device.");
+ return NULL;
+ }
+
+ hapticlist = SDL_haptics;
+ /* Check to see if joystick's haptic is already open */
+ while ( hapticlist )
+ {
+ if (SDL_SYS_JoystickSameHaptic(hapticlist, joystick)) {
+ haptic = hapticlist;
+ ++haptic->ref_count;
+ return haptic;
+ }
+ hapticlist = hapticlist->next;
+ }
+
+ /* Create the haptic device */
+ haptic = (SDL_Haptic *) SDL_malloc((sizeof *haptic));
+ if (haptic == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize the haptic device */
+ SDL_memset(haptic, 0, sizeof(SDL_Haptic));
+ haptic->rumble_id = -1;
+ if (SDL_SYS_HapticOpenFromJoystick(haptic, joystick) < 0) {
+ SDL_SetError("Haptic: SDL_SYS_HapticOpenFromJoystick failed.");
+ SDL_free(haptic);
+ return NULL;
+ }
+
+ /* Add haptic to list */
+ ++haptic->ref_count;
+ /* Link the haptic in the list */
+ haptic->next = SDL_haptics;
+ SDL_haptics = haptic;
+
+ return haptic;
+}
+
+
+/*
+ * Closes a SDL_Haptic device.
+ */
+void
+SDL_HapticClose(SDL_Haptic * haptic)
+{
+ int i;
+ SDL_Haptic *hapticlist;
+ SDL_Haptic *hapticlistprev;
+
+ /* Must be valid */
+ if (!ValidHaptic(haptic)) {
+ return;
+ }
+
+ /* Check if it's still in use */
+ if (--haptic->ref_count > 0) {
+ return;
+ }
+
+ /* Close it, properly removing effects if needed */
+ for (i = 0; i < haptic->neffects; i++) {
+ if (haptic->effects[i].hweffect != NULL) {
+ SDL_HapticDestroyEffect(haptic, i);
+ }
+ }
+ SDL_SYS_HapticClose(haptic);
+
+ /* Remove from the list */
+ hapticlist = SDL_haptics;
+ hapticlistprev = NULL;
+ while ( hapticlist )
+ {
+ if (haptic == hapticlist)
+ {
+ if ( hapticlistprev )
+ {
+ /* unlink this entry */
+ hapticlistprev->next = hapticlist->next;
+ }
+ else
+ {
+ SDL_haptics = haptic->next;
+ }
+
+ break;
+ }
+ hapticlistprev = hapticlist;
+ hapticlist = hapticlist->next;
+ }
+
+ /* Free */
+ SDL_free(haptic);
+}
+
+/*
+ * Cleans up after the subsystem.
+ */
+void
+SDL_HapticQuit(void)
+{
+ SDL_SYS_HapticQuit();
+ SDL_assert(SDL_haptics == NULL);
+ SDL_haptics = NULL;
+}
+
+/*
+ * Returns the number of effects a haptic device has.
+ */
+int
+SDL_HapticNumEffects(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ return haptic->neffects;
+}
+
+
+/*
+ * Returns the number of effects a haptic device can play.
+ */
+int
+SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ return haptic->nplaying;
+}
+
+
+/*
+ * Returns supported effects by the device.
+ */
+unsigned int
+SDL_HapticQuery(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return 0; /* same as if no effects were supported */
+ }
+
+ return haptic->supported;
+}
+
+
+/*
+ * Returns the number of axis on the device.
+ */
+int
+SDL_HapticNumAxes(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ return haptic->naxes;
+}
+
+/*
+ * Checks to see if the device can support the effect.
+ */
+int
+SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if ((haptic->supported & effect->type) != 0)
+ return SDL_TRUE;
+ return SDL_FALSE;
+}
+
+/*
+ * Creates a new haptic effect.
+ */
+int
+SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect)
+{
+ int i;
+
+ /* Check for device validity. */
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ /* Check to see if effect is supported */
+ if (SDL_HapticEffectSupported(haptic, effect) == SDL_FALSE) {
+ return SDL_SetError("Haptic: Effect not supported by haptic device.");
+ }
+
+ /* See if there's a free slot */
+ for (i = 0; i < haptic->neffects; i++) {
+ if (haptic->effects[i].hweffect == NULL) {
+
+ /* Now let the backend create the real effect */
+ if (SDL_SYS_HapticNewEffect(haptic, &haptic->effects[i], effect)
+ != 0) {
+ return -1; /* Backend failed to create effect */
+ }
+
+ SDL_memcpy(&haptic->effects[i].effect, effect,
+ sizeof(SDL_HapticEffect));
+ return i;
+ }
+ }
+
+ return SDL_SetError("Haptic: Device has no free space left.");
+}
+
+/*
+ * Checks to see if an effect is valid.
+ */
+static int
+ValidEffect(SDL_Haptic * haptic, int effect)
+{
+ if ((effect < 0) || (effect >= haptic->neffects)) {
+ SDL_SetError("Haptic: Invalid effect identifier.");
+ return 0;
+ }
+ return 1;
+}
+
+/*
+ * Updates an effect.
+ */
+int
+SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect,
+ SDL_HapticEffect * data)
+{
+ if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
+ return -1;
+ }
+
+ /* Can't change type dynamically. */
+ if (data->type != haptic->effects[effect].effect.type) {
+ return SDL_SetError("Haptic: Updating effect type is illegal.");
+ }
+
+ /* Updates the effect */
+ if (SDL_SYS_HapticUpdateEffect(haptic, &haptic->effects[effect], data) <
+ 0) {
+ return -1;
+ }
+
+ SDL_memcpy(&haptic->effects[effect].effect, data,
+ sizeof(SDL_HapticEffect));
+ return 0;
+}
+
+
+/*
+ * Runs the haptic effect on the device.
+ */
+int
+SDL_HapticRunEffect(SDL_Haptic * haptic, int effect, Uint32 iterations)
+{
+ if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
+ return -1;
+ }
+
+ /* Run the effect */
+ if (SDL_SYS_HapticRunEffect(haptic, &haptic->effects[effect], iterations)
+ < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Stops the haptic effect on the device.
+ */
+int
+SDL_HapticStopEffect(SDL_Haptic * haptic, int effect)
+{
+ if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
+ return -1;
+ }
+
+ /* Stop the effect */
+ if (SDL_SYS_HapticStopEffect(haptic, &haptic->effects[effect]) < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Gets rid of a haptic effect.
+ */
+void
+SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect)
+{
+ if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
+ return;
+ }
+
+ /* Not allocated */
+ if (haptic->effects[effect].hweffect == NULL) {
+ return;
+ }
+
+ SDL_SYS_HapticDestroyEffect(haptic, &haptic->effects[effect]);
+}
+
+/*
+ * Gets the status of a haptic effect.
+ */
+int
+SDL_HapticGetEffectStatus(SDL_Haptic * haptic, int effect)
+{
+ if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
+ return -1;
+ }
+
+ if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) {
+ return SDL_SetError("Haptic: Device does not support status queries.");
+ }
+
+ return SDL_SYS_HapticGetEffectStatus(haptic, &haptic->effects[effect]);
+}
+
+/*
+ * Sets the global gain of the device.
+ */
+int
+SDL_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ const char *env;
+ int real_gain, max_gain;
+
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) {
+ return SDL_SetError("Haptic: Device does not support setting gain.");
+ }
+
+ if ((gain < 0) || (gain > 100)) {
+ return SDL_SetError("Haptic: Gain must be between 0 and 100.");
+ }
+
+ /* We use the envvar to get the maximum gain. */
+ env = SDL_getenv("SDL_HAPTIC_GAIN_MAX");
+ if (env != NULL) {
+ max_gain = SDL_atoi(env);
+
+ /* Check for sanity. */
+ if (max_gain < 0)
+ max_gain = 0;
+ else if (max_gain > 100)
+ max_gain = 100;
+
+ /* We'll scale it linearly with SDL_HAPTIC_GAIN_MAX */
+ real_gain = (gain * max_gain) / 100;
+ } else {
+ real_gain = gain;
+ }
+
+ if (SDL_SYS_HapticSetGain(haptic, real_gain) < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Makes the device autocenter, 0 disables.
+ */
+int
+SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) {
+ return SDL_SetError("Haptic: Device does not support setting autocenter.");
+ }
+
+ if ((autocenter < 0) || (autocenter > 100)) {
+ return SDL_SetError("Haptic: Autocenter must be between 0 and 100.");
+ }
+
+ if (SDL_SYS_HapticSetAutocenter(haptic, autocenter) < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Pauses the haptic device.
+ */
+int
+SDL_HapticPause(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
+ return SDL_SetError("Haptic: Device does not support setting pausing.");
+ }
+
+ return SDL_SYS_HapticPause(haptic);
+}
+
+/*
+ * Unpauses the haptic device.
+ */
+int
+SDL_HapticUnpause(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
+ return 0; /* Not going to be paused, so we pretend it's unpaused. */
+ }
+
+ return SDL_SYS_HapticUnpause(haptic);
+}
+
+/*
+ * Stops all the currently playing effects.
+ */
+int
+SDL_HapticStopAll(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ return SDL_SYS_HapticStopAll(haptic);
+}
+
+/*
+ * Checks to see if rumble is supported.
+ */
+int
+SDL_HapticRumbleSupported(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ /* Most things can use SINE, but XInput only has LEFTRIGHT. */
+ return ((haptic->supported & (SDL_HAPTIC_SINE|SDL_HAPTIC_LEFTRIGHT)) != 0);
+}
+
+/*
+ * Initializes the haptic device for simple rumble playback.
+ */
+int
+SDL_HapticRumbleInit(SDL_Haptic * haptic)
+{
+ SDL_HapticEffect *efx = &haptic->rumble_effect;
+
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ /* Already allocated. */
+ if (haptic->rumble_id >= 0) {
+ return 0;
+ }
+
+ SDL_zerop(efx);
+ if (haptic->supported & SDL_HAPTIC_SINE) {
+ efx->type = SDL_HAPTIC_SINE;
+ efx->periodic.period = 1000;
+ efx->periodic.magnitude = 0x4000;
+ efx->periodic.length = 5000;
+ efx->periodic.attack_length = 0;
+ efx->periodic.fade_length = 0;
+ } else if (haptic->supported & SDL_HAPTIC_LEFTRIGHT) { /* XInput? */
+ efx->type = SDL_HAPTIC_LEFTRIGHT;
+ efx->leftright.length = 5000;
+ efx->leftright.large_magnitude = 0x4000;
+ efx->leftright.small_magnitude = 0x4000;
+ } else {
+ return SDL_SetError("Device doesn't support rumble");
+ }
+
+ haptic->rumble_id = SDL_HapticNewEffect(haptic, &haptic->rumble_effect);
+ if (haptic->rumble_id >= 0) {
+ return 0;
+ }
+ return -1;
+}
+
+/*
+ * Runs simple rumble on a haptic device
+ */
+int
+SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length)
+{
+ SDL_HapticEffect *efx;
+ Sint16 magnitude;
+
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if (haptic->rumble_id < 0) {
+ return SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
+ }
+
+ /* Clamp strength. */
+ if (strength > 1.0f) {
+ strength = 1.0f;
+ } else if (strength < 0.0f) {
+ strength = 0.0f;
+ }
+ magnitude = (Sint16)(32767.0f*strength);
+
+ efx = &haptic->rumble_effect;
+ if (efx->type == SDL_HAPTIC_SINE) {
+ efx->periodic.magnitude = magnitude;
+ efx->periodic.length = length;
+ } else if (efx->type == SDL_HAPTIC_LEFTRIGHT) {
+ efx->leftright.small_magnitude = efx->leftright.large_magnitude = magnitude;
+ efx->leftright.length = length;
+ } else {
+ SDL_assert(0 && "This should have been caught elsewhere");
+ }
+
+ if (SDL_HapticUpdateEffect(haptic, haptic->rumble_id, &haptic->rumble_effect) < 0) {
+ return -1;
+ }
+
+ return SDL_HapticRunEffect(haptic, haptic->rumble_id, 1);
+}
+
+/*
+ * Stops the simple rumble on a haptic device.
+ */
+int
+SDL_HapticRumbleStop(SDL_Haptic * haptic)
+{
+ if (!ValidHaptic(haptic)) {
+ return -1;
+ }
+
+ if (haptic->rumble_id < 0) {
+ return SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
+ }
+
+ return SDL_HapticStopEffect(haptic, haptic->rumble_id);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/SDL_haptic_c.h b/src/3rdparty/SDL2/src/haptic/SDL_haptic_c.h
new file mode 100644
index 0000000..26d900d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/SDL_haptic_c.h
@@ -0,0 +1,25 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+extern int SDL_HapticInit(void);
+extern void SDL_HapticQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/SDL_syshaptic.h b/src/3rdparty/SDL2/src/haptic/SDL_syshaptic.h
new file mode 100644
index 0000000..4f4cd9f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/SDL_syshaptic.h
@@ -0,0 +1,208 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../SDL_internal.h"
+
+#ifndef SDL_syshaptic_h_
+#define SDL_syshaptic_h_
+
+#include "SDL_haptic.h"
+
+
+struct haptic_effect
+{
+ SDL_HapticEffect effect; /* The current event */
+ struct haptic_hweffect *hweffect; /* The hardware behind the event */
+};
+
+/*
+ * The real SDL_Haptic struct.
+ */
+struct _SDL_Haptic
+{
+ Uint8 index; /* Stores index it is attached to */
+
+ struct haptic_effect *effects; /* Allocated effects */
+ int neffects; /* Maximum amount of effects */
+ int nplaying; /* Maximum amount of effects to play at the same time */
+ unsigned int supported; /* Supported effects */
+ int naxes; /* Number of axes on the device. */
+
+ struct haptic_hwdata *hwdata; /* Driver dependent */
+ int ref_count; /* Count for multiple opens */
+
+ int rumble_id; /* ID of rumble effect for simple rumble API. */
+ SDL_HapticEffect rumble_effect; /* Rumble effect. */
+ struct _SDL_Haptic *next; /* pointer to next haptic we have allocated */
+};
+
+/*
+ * Scans the system for haptic devices.
+ *
+ * Returns number of devices on success, -1 on error.
+ */
+extern int SDL_SYS_HapticInit(void);
+
+/* Function to return the number of haptic devices plugged in right now */
+extern int SDL_SYS_NumHaptics(void);
+
+/*
+ * Gets the device dependent name of the haptic device
+ */
+extern const char *SDL_SYS_HapticName(int index);
+
+/*
+ * Opens the haptic device for usage. The haptic device should have
+ * the index value set previously.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticOpen(SDL_Haptic * haptic);
+
+/*
+ * Returns the index of the haptic core pointer or -1 if none is found.
+ */
+int SDL_SYS_HapticMouse(void);
+
+/*
+ * Checks to see if the joystick has haptic capabilities.
+ *
+ * Returns >0 if haptic capabilities are detected, 0 if haptic
+ * capabilities aren't detected and -1 on error.
+ */
+extern int SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick);
+
+/*
+ * Opens the haptic device for usage using the same device as
+ * the joystick.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic,
+ SDL_Joystick * joystick);
+/*
+ * Checks to see if haptic device and joystick device are the same.
+ *
+ * Returns 1 if they are the same, 0 if they aren't.
+ */
+extern int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic,
+ SDL_Joystick * joystick);
+
+/*
+ * Closes a haptic device after usage.
+ */
+extern void SDL_SYS_HapticClose(SDL_Haptic * haptic);
+
+/*
+ * Performs a cleanup on the haptic subsystem.
+ */
+extern void SDL_SYS_HapticQuit(void);
+
+/*
+ * Creates a new haptic effect on the haptic device using base
+ * as a template for the effect.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * base);
+
+/*
+ * Updates the haptic effect on the haptic device using data
+ * as a template.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * data);
+
+/*
+ * Runs the effect on the haptic device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticRunEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ Uint32 iterations);
+
+/*
+ * Stops the effect on the haptic device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticStopEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect);
+
+/*
+ * Cleanups up the effect on the haptic device.
+ */
+extern void SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect);
+
+/*
+ * Queries the device for the status of effect.
+ *
+ * Returns 0 if device is stopped, >0 if device is playing and
+ * -1 on error.
+ */
+extern int SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
+ struct haptic_effect *effect);
+
+/*
+ * Sets the global gain of the haptic device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain);
+
+/*
+ * Sets the autocenter feature of the haptic device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
+
+/*
+ * Pauses the haptic device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticPause(SDL_Haptic * haptic);
+
+/*
+ * Unpauses the haptic device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
+
+/*
+ * Stops all the currently playing haptic effects on the device.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
+
+#endif /* SDL_syshaptic_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic.c b/src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic.c
new file mode 100644
index 0000000..1fb2352
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic.c
@@ -0,0 +1,357 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_HAPTIC_ANDROID
+
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_syshaptic_c.h"
+#include "../SDL_syshaptic.h"
+#include "SDL_haptic.h"
+#include "../../core/android/SDL_android.h"
+#include "SDL_joystick.h"
+#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
+#include "../../joystick/android/SDL_sysjoystick_c.h" /* For joystick hwdata */
+
+
+typedef struct SDL_hapticlist_item
+{
+ int device_id;
+ char *name;
+ SDL_Haptic *haptic;
+ struct SDL_hapticlist_item *next;
+} SDL_hapticlist_item;
+
+static SDL_hapticlist_item *SDL_hapticlist = NULL;
+static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
+static int numhaptics = 0;
+
+
+int
+SDL_SYS_HapticInit(void)
+{
+ /* Support for device connect/disconnect is API >= 16 only,
+ * so we poll every three seconds
+ * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html
+ */
+ static Uint32 timeout = 0;
+ if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
+ timeout = SDL_GetTicks() + 3000;
+ Android_JNI_PollHapticDevices();
+ }
+ return (numhaptics);
+}
+
+int
+SDL_SYS_NumHaptics(void)
+{
+ return (numhaptics);
+}
+
+static SDL_hapticlist_item *
+HapticByOrder(int index)
+{
+ SDL_hapticlist_item *item = SDL_hapticlist;
+ if ((index < 0) || (index >= numhaptics)) {
+ return NULL;
+ }
+ while (index > 0) {
+ SDL_assert(item != NULL);
+ --index;
+ item = item->next;
+ }
+ return item;
+}
+
+static SDL_hapticlist_item *
+HapticByDevId (int device_id)
+{
+ SDL_hapticlist_item *item;
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (device_id == item->device_id) {
+ /*SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);*/
+ return item;
+ }
+ }
+ return NULL;
+}
+
+const char *
+SDL_SYS_HapticName(int index)
+{
+ SDL_hapticlist_item *item = HapticByOrder(index);
+ if (item == NULL ) {
+ SDL_SetError("No such device");
+ return NULL;
+ }
+ return item->name;
+}
+
+
+static SDL_hapticlist_item *
+OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item)
+{
+ if (item == NULL ) {
+ SDL_SetError("No such device");
+ return NULL;
+ }
+ if (item->haptic != NULL) {
+ SDL_SetError("Haptic already opened");
+ return NULL;
+ }
+
+ haptic->hwdata = (struct haptic_hwdata *)item;
+ item->haptic = haptic;
+
+ haptic->supported = SDL_HAPTIC_LEFTRIGHT;
+ haptic->neffects = 1;
+ haptic->nplaying = haptic->neffects;
+ haptic->effects = (struct haptic_effect *)SDL_malloc (sizeof (struct haptic_effect) * haptic->neffects);
+ if (haptic->effects == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_memset(haptic->effects, 0, sizeof (struct haptic_effect) * haptic->neffects);
+ return item;
+}
+
+static SDL_hapticlist_item *
+OpenHapticByOrder(SDL_Haptic *haptic, int index)
+{
+ return OpenHaptic (haptic, HapticByOrder(index));
+}
+
+static SDL_hapticlist_item *
+OpenHapticByDevId(SDL_Haptic *haptic, int device_id)
+{
+ return OpenHaptic (haptic, HapticByDevId(device_id));
+}
+
+int
+SDL_SYS_HapticOpen(SDL_Haptic *haptic)
+{
+ return (OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0);
+}
+
+
+int
+SDL_SYS_HapticMouse(void)
+{
+ return 0;
+}
+
+
+int
+SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
+{
+ SDL_hapticlist_item *item;
+ item = HapticByDevId(((joystick_hwdata *)joystick->hwdata)->device_id);
+ return (item != NULL) ? 1 : 0;
+}
+
+
+int
+SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
+{
+ return (OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0);
+}
+
+
+int
+SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return (((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0);
+}
+
+
+void
+SDL_SYS_HapticClose(SDL_Haptic * haptic)
+{
+ ((SDL_hapticlist_item *)haptic->hwdata)->haptic = NULL;
+ haptic->hwdata = NULL;
+ return;
+}
+
+
+void
+SDL_SYS_HapticQuit(void)
+{
+ SDL_hapticlist_item *item = NULL;
+ SDL_hapticlist_item *next = NULL;
+
+ for (item = SDL_hapticlist; item; item = next) {
+ next = item->next;
+ SDL_free(item);
+ }
+
+ SDL_hapticlist = SDL_hapticlist_tail = NULL;
+ numhaptics = 0;
+ return;
+}
+
+
+int
+SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect, SDL_HapticEffect * base)
+{
+ return 0;
+}
+
+
+int
+SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * data)
+{
+ return 0;
+}
+
+
+int
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ Uint32 iterations)
+{
+ Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, effect->effect.leftright.length);
+ return 0;
+}
+
+
+int
+SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return 0;
+}
+
+
+void
+SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return;
+}
+
+
+int
+SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
+ struct haptic_effect *effect)
+{
+ return 0;
+}
+
+
+int
+SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ return 0;
+}
+
+
+int
+SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ return 0;
+}
+
+int
+SDL_SYS_HapticPause(SDL_Haptic * haptic)
+{
+ return 0;
+}
+
+int
+SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
+{
+ return 0;
+}
+
+int
+SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
+{
+ return 0;
+}
+
+
+
+int
+Android_AddHaptic(int device_id, const char *name)
+{
+ SDL_hapticlist_item *item;
+ item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item));
+ if (item == NULL) {
+ return -1;
+ }
+
+ item->device_id = device_id;
+ item->name = SDL_strdup (name);
+ if (item->name == NULL) {
+ SDL_free (item);
+ return -1;
+ }
+
+ if (SDL_hapticlist_tail == NULL) {
+ SDL_hapticlist = SDL_hapticlist_tail = item;
+ } else {
+ SDL_hapticlist_tail->next = item;
+ SDL_hapticlist_tail = item;
+ }
+
+ ++numhaptics;
+ return numhaptics;
+}
+
+int
+Android_RemoveHaptic(int device_id)
+{
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *prev = NULL;
+
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (device_id == item->device_id) {
+ const int retval = item->haptic ? item->haptic->index : -1;
+
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_hapticlist == item);
+ SDL_hapticlist = item->next;
+ }
+ if (item == SDL_hapticlist_tail) {
+ SDL_hapticlist_tail = prev;
+ }
+
+ /* Need to decrement the haptic count */
+ --numhaptics;
+ /* !!! TODO: Send a haptic remove event? */
+
+ SDL_free(item->name);
+ SDL_free(item);
+ return retval;
+ }
+ prev = item;
+ }
+ return -1;
+}
+
+
+#endif /* SDL_HAPTIC_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic_c.h b/src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic_c.h
new file mode 100644
index 0000000..08634d2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/android/SDL_syshaptic_c.h
@@ -0,0 +1,12 @@
+#include "SDL_config.h"
+
+#ifdef SDL_HAPTIC_ANDROID
+
+
+extern int Android_AddHaptic(int device_id, const char *name);
+extern int Android_RemoveHaptic(int device_id);
+
+
+#endif /* SDL_HAPTIC_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic.c b/src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic.c
new file mode 100644
index 0000000..67cb9f5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic.c
@@ -0,0 +1,1417 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_HAPTIC_IOKIT
+
+#include "SDL_assert.h"
+#include "SDL_stdinc.h"
+#include "SDL_haptic.h"
+#include "../SDL_syshaptic.h"
+#include "SDL_joystick.h"
+#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
+#include "../../joystick/darwin/SDL_sysjoystick_c.h" /* For joystick hwdata */
+#include "SDL_syshaptic_c.h"
+
+#include <IOKit/IOKitLib.h>
+#include <IOKit/hid/IOHIDKeys.h>
+#include <IOKit/hid/IOHIDUsageTables.h>
+#include <ForceFeedback/ForceFeedback.h>
+#include <ForceFeedback/ForceFeedbackConstants.h>
+
+#ifndef IO_OBJECT_NULL
+#define IO_OBJECT_NULL ((io_service_t)0)
+#endif
+
+/*
+ * List of available haptic devices.
+ */
+typedef struct SDL_hapticlist_item
+{
+ char name[256]; /* Name of the device. */
+
+ io_service_t dev; /* Node we use to create the device. */
+ SDL_Haptic *haptic; /* Haptic currently associated with it. */
+
+ /* Usage pages for determining if it's a mouse or not. */
+ long usage;
+ long usagePage;
+
+ struct SDL_hapticlist_item *next;
+} SDL_hapticlist_item;
+
+
+/*
+ * Haptic system hardware data.
+ */
+struct haptic_hwdata
+{
+ FFDeviceObjectReference device; /* Hardware device. */
+ UInt8 axes[3];
+};
+
+
+/*
+ * Haptic system effect data.
+ */
+struct haptic_hweffect
+{
+ FFEffectObjectReference ref; /* Reference. */
+ struct FFEFFECT effect; /* Hardware effect. */
+};
+
+/*
+ * Prototypes.
+ */
+static void SDL_SYS_HapticFreeFFEFFECT(FFEFFECT * effect, int type);
+static int HIDGetDeviceProduct(io_service_t dev, char *name);
+
+static SDL_hapticlist_item *SDL_hapticlist = NULL;
+static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
+static int numhaptics = -1;
+
+/*
+ * Like strerror but for force feedback errors.
+ */
+static const char *
+FFStrError(unsigned int err)
+{
+ switch (err) {
+ case FFERR_DEVICEFULL:
+ return "device full";
+ /* This should be valid, but for some reason isn't defined... */
+ /* case FFERR_DEVICENOTREG:
+ return "device not registered"; */
+ case FFERR_DEVICEPAUSED:
+ return "device paused";
+ case FFERR_DEVICERELEASED:
+ return "device released";
+ case FFERR_EFFECTPLAYING:
+ return "effect playing";
+ case FFERR_EFFECTTYPEMISMATCH:
+ return "effect type mismatch";
+ case FFERR_EFFECTTYPENOTSUPPORTED:
+ return "effect type not supported";
+ case FFERR_GENERIC:
+ return "undetermined error";
+ case FFERR_HASEFFECTS:
+ return "device has effects";
+ case FFERR_INCOMPLETEEFFECT:
+ return "incomplete effect";
+ case FFERR_INTERNAL:
+ return "internal fault";
+ case FFERR_INVALIDDOWNLOADID:
+ return "invalid download id";
+ case FFERR_INVALIDPARAM:
+ return "invalid parameter";
+ case FFERR_MOREDATA:
+ return "more data";
+ case FFERR_NOINTERFACE:
+ return "interface not supported";
+ case FFERR_NOTDOWNLOADED:
+ return "effect is not downloaded";
+ case FFERR_NOTINITIALIZED:
+ return "object has not been initialized";
+ case FFERR_OUTOFMEMORY:
+ return "out of memory";
+ case FFERR_UNPLUGGED:
+ return "device is unplugged";
+ case FFERR_UNSUPPORTED:
+ return "function call unsupported";
+ case FFERR_UNSUPPORTEDAXIS:
+ return "axis unsupported";
+
+ default:
+ return "unknown error";
+ }
+}
+
+
+/*
+ * Initializes the haptic subsystem.
+ */
+int
+SDL_SYS_HapticInit(void)
+{
+ IOReturn result;
+ io_iterator_t iter;
+ CFDictionaryRef match;
+ io_service_t device;
+
+ if (numhaptics != -1) {
+ return SDL_SetError("Haptic subsystem already initialized!");
+ }
+ numhaptics = 0;
+
+ /* Get HID devices. */
+ match = IOServiceMatching(kIOHIDDeviceKey);
+ if (match == NULL) {
+ return SDL_SetError("Haptic: Failed to get IOServiceMatching.");
+ }
+
+ /* Now search I/O Registry for matching devices. */
+ result = IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iter);
+ if (result != kIOReturnSuccess) {
+ return SDL_SetError("Haptic: Couldn't create a HID object iterator.");
+ }
+ /* IOServiceGetMatchingServices consumes dictionary. */
+
+ if (!IOIteratorIsValid(iter)) { /* No iterator. */
+ return 0;
+ }
+
+ while ((device = IOIteratorNext(iter)) != IO_OBJECT_NULL) {
+ MacHaptic_MaybeAddDevice(device);
+ /* always release as the AddDevice will retain IF it's a forcefeedback device */
+ IOObjectRelease(device);
+ }
+ IOObjectRelease(iter);
+
+ return numhaptics;
+}
+
+int
+SDL_SYS_NumHaptics(void)
+{
+ return numhaptics;
+}
+
+static SDL_hapticlist_item *
+HapticByDevIndex(int device_index)
+{
+ SDL_hapticlist_item *item = SDL_hapticlist;
+
+ if ((device_index < 0) || (device_index >= numhaptics)) {
+ return NULL;
+ }
+
+ while (device_index > 0) {
+ SDL_assert(item != NULL);
+ --device_index;
+ item = item->next;
+ }
+
+ return item;
+}
+
+int
+MacHaptic_MaybeAddDevice( io_object_t device )
+{
+ IOReturn result;
+ CFMutableDictionaryRef hidProperties;
+ CFTypeRef refCF;
+ SDL_hapticlist_item *item;
+
+ if (numhaptics == -1) {
+ return -1; /* not initialized. We'll pick these up on enumeration if we init later. */
+ }
+
+ /* Check for force feedback. */
+ if (FFIsForceFeedback(device) != FF_OK) {
+ return -1;
+ }
+
+ /* Make sure we don't already have it */
+ for (item = SDL_hapticlist; item ; item = item->next)
+ {
+ if (IOObjectIsEqualTo((io_object_t) item->dev, device)) {
+ /* Already added */
+ return -1;
+ }
+ }
+
+ item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item));
+ if (item == NULL) {
+ return SDL_SetError("Could not allocate haptic storage");
+ }
+
+ /* retain it as we are going to keep it around a while */
+ IOObjectRetain(device);
+
+ /* Set basic device data. */
+ HIDGetDeviceProduct(device, item->name);
+ item->dev = device;
+
+ /* Set usage pages. */
+ hidProperties = 0;
+ refCF = 0;
+ result = IORegistryEntryCreateCFProperties(device,
+ &hidProperties,
+ kCFAllocatorDefault,
+ kNilOptions);
+ if ((result == KERN_SUCCESS) && hidProperties) {
+ refCF = CFDictionaryGetValue(hidProperties,
+ CFSTR(kIOHIDPrimaryUsagePageKey));
+ if (refCF) {
+ if (!CFNumberGetValue(refCF, kCFNumberLongType, &item->usagePage)) {
+ SDL_SetError("Haptic: Receiving device's usage page.");
+ }
+ refCF = CFDictionaryGetValue(hidProperties,
+ CFSTR(kIOHIDPrimaryUsageKey));
+ if (refCF) {
+ if (!CFNumberGetValue(refCF, kCFNumberLongType, &item->usage)) {
+ SDL_SetError("Haptic: Receiving device's usage.");
+ }
+ }
+ }
+ CFRelease(hidProperties);
+ }
+
+ if (SDL_hapticlist_tail == NULL) {
+ SDL_hapticlist = SDL_hapticlist_tail = item;
+ } else {
+ SDL_hapticlist_tail->next = item;
+ SDL_hapticlist_tail = item;
+ }
+
+ /* Device has been added. */
+ ++numhaptics;
+
+ return numhaptics;
+}
+
+int
+MacHaptic_MaybeRemoveDevice( io_object_t device )
+{
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *prev = NULL;
+
+ if (numhaptics == -1) {
+ return -1; /* not initialized. ignore this. */
+ }
+
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (IOObjectIsEqualTo((io_object_t) item->dev, device)) {
+ const int retval = item->haptic ? item->haptic->index : -1;
+
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_hapticlist == item);
+ SDL_hapticlist = item->next;
+ }
+ if (item == SDL_hapticlist_tail) {
+ SDL_hapticlist_tail = prev;
+ }
+
+ /* Need to decrement the haptic count */
+ --numhaptics;
+ /* !!! TODO: Send a haptic remove event? */
+
+ IOObjectRelease(item->dev);
+ SDL_free(item);
+ return retval;
+ }
+ prev = item;
+ }
+
+ return -1;
+}
+
+/*
+ * Return the name of a haptic device, does not need to be opened.
+ */
+const char *
+SDL_SYS_HapticName(int index)
+{
+ SDL_hapticlist_item *item;
+ item = HapticByDevIndex(index);
+ return item->name;
+}
+
+/*
+ * Gets the device's product name.
+ */
+static int
+HIDGetDeviceProduct(io_service_t dev, char *name)
+{
+ CFMutableDictionaryRef hidProperties, usbProperties;
+ io_registry_entry_t parent1, parent2;
+ kern_return_t ret;
+
+ hidProperties = usbProperties = 0;
+
+ ret = IORegistryEntryCreateCFProperties(dev, &hidProperties,
+ kCFAllocatorDefault, kNilOptions);
+ if ((ret != KERN_SUCCESS) || !hidProperties) {
+ return SDL_SetError("Haptic: Unable to create CFProperties.");
+ }
+
+ /* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also
+ * get dictionary for USB properties: step up two levels and get CF dictionary for USB properties
+ */
+ if ((KERN_SUCCESS ==
+ IORegistryEntryGetParentEntry(dev, kIOServicePlane, &parent1))
+ && (KERN_SUCCESS ==
+ IORegistryEntryGetParentEntry(parent1, kIOServicePlane, &parent2))
+ && (KERN_SUCCESS ==
+ IORegistryEntryCreateCFProperties(parent2, &usbProperties,
+ kCFAllocatorDefault,
+ kNilOptions))) {
+ if (usbProperties) {
+ CFTypeRef refCF = 0;
+ /* get device info
+ * try hid dictionary first, if fail then go to USB dictionary
+ */
+
+
+ /* Get product name */
+ refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductKey));
+ if (!refCF) {
+ refCF = CFDictionaryGetValue(usbProperties,
+ CFSTR("USB Product Name"));
+ }
+ if (refCF) {
+ if (!CFStringGetCString(refCF, name, 256,
+ CFStringGetSystemEncoding())) {
+ return SDL_SetError("Haptic: CFStringGetCString error retrieving pDevice->product.");
+ }
+ }
+
+ CFRelease(usbProperties);
+ } else {
+ return SDL_SetError("Haptic: IORegistryEntryCreateCFProperties failed to create usbProperties.");
+ }
+
+ /* Release stuff. */
+ if (kIOReturnSuccess != IOObjectRelease(parent2)) {
+ SDL_SetError("Haptic: IOObjectRelease error with parent2.");
+ }
+ if (kIOReturnSuccess != IOObjectRelease(parent1)) {
+ SDL_SetError("Haptic: IOObjectRelease error with parent1.");
+ }
+ } else {
+ return SDL_SetError("Haptic: Error getting registry entries.");
+ }
+
+ return 0;
+}
+
+
+#define FF_TEST(ff, s) \
+if (features.supportedEffects & (ff)) supported |= (s)
+/*
+ * Gets supported features.
+ */
+static unsigned int
+GetSupportedFeatures(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+ FFDeviceObjectReference device;
+ FFCAPABILITIES features;
+ unsigned int supported;
+ Uint32 val;
+
+ device = haptic->hwdata->device;
+
+ ret = FFDeviceGetForceFeedbackCapabilities(device, &features);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Unable to get device's supported features.");
+ }
+
+ supported = 0;
+
+ /* Get maximum effects. */
+ haptic->neffects = features.storageCapacity;
+ haptic->nplaying = features.playbackCapacity;
+
+ /* Test for effects. */
+ FF_TEST(FFCAP_ET_CONSTANTFORCE, SDL_HAPTIC_CONSTANT);
+ FF_TEST(FFCAP_ET_RAMPFORCE, SDL_HAPTIC_RAMP);
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* FF_TEST(FFCAP_ET_SQUARE, SDL_HAPTIC_SQUARE); */
+ FF_TEST(FFCAP_ET_SINE, SDL_HAPTIC_SINE);
+ FF_TEST(FFCAP_ET_TRIANGLE, SDL_HAPTIC_TRIANGLE);
+ FF_TEST(FFCAP_ET_SAWTOOTHUP, SDL_HAPTIC_SAWTOOTHUP);
+ FF_TEST(FFCAP_ET_SAWTOOTHDOWN, SDL_HAPTIC_SAWTOOTHDOWN);
+ FF_TEST(FFCAP_ET_SPRING, SDL_HAPTIC_SPRING);
+ FF_TEST(FFCAP_ET_DAMPER, SDL_HAPTIC_DAMPER);
+ FF_TEST(FFCAP_ET_INERTIA, SDL_HAPTIC_INERTIA);
+ FF_TEST(FFCAP_ET_FRICTION, SDL_HAPTIC_FRICTION);
+ FF_TEST(FFCAP_ET_CUSTOMFORCE, SDL_HAPTIC_CUSTOM);
+
+ /* Check if supports gain. */
+ ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_FFGAIN,
+ &val, sizeof(val));
+ if (ret == FF_OK) {
+ supported |= SDL_HAPTIC_GAIN;
+ } else if (ret != FFERR_UNSUPPORTED) {
+ return SDL_SetError("Haptic: Unable to get if device supports gain: %s.",
+ FFStrError(ret));
+ }
+
+ /* Checks if supports autocenter. */
+ ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_AUTOCENTER,
+ &val, sizeof(val));
+ if (ret == FF_OK) {
+ supported |= SDL_HAPTIC_AUTOCENTER;
+ } else if (ret != FFERR_UNSUPPORTED) {
+ return SDL_SetError
+ ("Haptic: Unable to get if device supports autocenter: %s.",
+ FFStrError(ret));
+ }
+
+ /* Check for axes, we have an artificial limit on axes */
+ haptic->naxes = ((features.numFfAxes) > 3) ? 3 : features.numFfAxes;
+ /* Actually store the axes we want to use */
+ SDL_memcpy(haptic->hwdata->axes, features.ffAxes,
+ haptic->naxes * sizeof(Uint8));
+
+ /* Always supported features. */
+ supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE;
+
+ haptic->supported = supported;
+ return 0;
+}
+
+
+/*
+ * Opens the haptic device from the file descriptor.
+ */
+static int
+SDL_SYS_HapticOpenFromService(SDL_Haptic * haptic, io_service_t service)
+{
+ HRESULT ret;
+ int ret2;
+
+ /* Allocate the hwdata */
+ haptic->hwdata = (struct haptic_hwdata *)
+ SDL_malloc(sizeof(*haptic->hwdata));
+ if (haptic->hwdata == NULL) {
+ SDL_OutOfMemory();
+ goto creat_err;
+ }
+ SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
+
+ /* Open the device */
+ ret = FFCreateDevice(service, &haptic->hwdata->device);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Unable to create device from service: %s.",
+ FFStrError(ret));
+ goto creat_err;
+ }
+
+ /* Get supported features. */
+ ret2 = GetSupportedFeatures(haptic);
+ if (ret2 < 0) {
+ goto open_err;
+ }
+
+
+ /* Reset and then enable actuators. */
+ ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
+ FFSFFC_RESET);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Unable to reset device: %s.", FFStrError(ret));
+ goto open_err;
+ }
+ ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
+ FFSFFC_SETACTUATORSON);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Unable to enable actuators: %s.",
+ FFStrError(ret));
+ goto open_err;
+ }
+
+
+ /* Allocate effects memory. */
+ haptic->effects = (struct haptic_effect *)
+ SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
+ if (haptic->effects == NULL) {
+ SDL_OutOfMemory();
+ goto open_err;
+ }
+ /* Clear the memory */
+ SDL_memset(haptic->effects, 0,
+ sizeof(struct haptic_effect) * haptic->neffects);
+
+ return 0;
+
+ /* Error handling */
+ open_err:
+ FFReleaseDevice(haptic->hwdata->device);
+ creat_err:
+ if (haptic->hwdata != NULL) {
+ SDL_free(haptic->hwdata);
+ haptic->hwdata = NULL;
+ }
+ return -1;
+
+}
+
+
+/*
+ * Opens a haptic device for usage.
+ */
+int
+SDL_SYS_HapticOpen(SDL_Haptic * haptic)
+{
+ SDL_hapticlist_item *item;
+ item = HapticByDevIndex(haptic->index);
+
+ return SDL_SYS_HapticOpenFromService(haptic, item->dev);
+}
+
+
+/*
+ * Opens a haptic device from first mouse it finds for usage.
+ */
+int
+SDL_SYS_HapticMouse(void)
+{
+ int device_index = 0;
+ SDL_hapticlist_item *item;
+
+ for (item = SDL_hapticlist; item; item = item->next) {
+ if ((item->usagePage == kHIDPage_GenericDesktop) &&
+ (item->usage == kHIDUsage_GD_Mouse)) {
+ return device_index;
+ }
+ ++device_index;
+ }
+
+ return -1;
+}
+
+
+/*
+ * Checks to see if a joystick has haptic features.
+ */
+int
+SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
+{
+ if (joystick->hwdata->ffservice != 0) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
+
+/*
+ * Checks to see if the haptic device and joystick are in reality the same.
+ */
+int
+SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ if (IOObjectIsEqualTo((io_object_t) ((size_t)haptic->hwdata->device),
+ joystick->hwdata->ffservice)) {
+ return 1;
+ }
+ return 0;
+}
+
+
+/*
+ * Opens a SDL_Haptic from a SDL_Joystick.
+ */
+int
+SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ int device_index = 0;
+ SDL_hapticlist_item *item;
+
+ for (item = SDL_hapticlist; item; item = item->next) {
+ if (IOObjectIsEqualTo((io_object_t) item->dev,
+ joystick->hwdata->ffservice)) {
+ haptic->index = device_index;
+ break;
+ }
+ ++device_index;
+ }
+
+ return SDL_SYS_HapticOpenFromService(haptic, joystick->hwdata->ffservice);
+}
+
+
+/*
+ * Closes the haptic device.
+ */
+void
+SDL_SYS_HapticClose(SDL_Haptic * haptic)
+{
+ if (haptic->hwdata) {
+
+ /* Free Effects. */
+ SDL_free(haptic->effects);
+ haptic->effects = NULL;
+ haptic->neffects = 0;
+
+ /* Clean up */
+ FFReleaseDevice(haptic->hwdata->device);
+
+ /* Free */
+ SDL_free(haptic->hwdata);
+ haptic->hwdata = NULL;
+ }
+}
+
+
+/*
+ * Clean up after system specific haptic stuff
+ */
+void
+SDL_SYS_HapticQuit(void)
+{
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *next = NULL;
+
+ for (item = SDL_hapticlist; item; item = next) {
+ next = item->next;
+ /* Opened and not closed haptics are leaked, this is on purpose.
+ * Close your haptic devices after usage. */
+
+ /* Free the io_service_t */
+ IOObjectRelease(item->dev);
+ SDL_free(item);
+ }
+
+ numhaptics = -1;
+ SDL_hapticlist = NULL;
+ SDL_hapticlist_tail = NULL;
+}
+
+
+/*
+ * Converts an SDL trigger button to an FFEFFECT trigger button.
+ */
+static DWORD
+FFGetTriggerButton(Uint16 button)
+{
+ DWORD dwTriggerButton;
+
+ dwTriggerButton = FFEB_NOTRIGGER;
+
+ if (button != 0) {
+ dwTriggerButton = FFJOFS_BUTTON(button - 1);
+ }
+
+ return dwTriggerButton;
+}
+
+
+/*
+ * Sets the direction.
+ */
+static int
+SDL_SYS_SetDirection(FFEFFECT * effect, SDL_HapticDirection * dir, int naxes)
+{
+ LONG *rglDir;
+
+ /* Handle no axes a part. */
+ if (naxes == 0) {
+ effect->dwFlags |= FFEFF_SPHERICAL; /* Set as default. */
+ effect->rglDirection = NULL;
+ return 0;
+ }
+
+ /* Has axes. */
+ rglDir = SDL_malloc(sizeof(LONG) * naxes);
+ if (rglDir == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(rglDir, 0, sizeof(LONG) * naxes);
+ effect->rglDirection = rglDir;
+
+ switch (dir->type) {
+ case SDL_HAPTIC_POLAR:
+ effect->dwFlags |= FFEFF_POLAR;
+ rglDir[0] = dir->dir[0];
+ return 0;
+ case SDL_HAPTIC_CARTESIAN:
+ effect->dwFlags |= FFEFF_CARTESIAN;
+ rglDir[0] = dir->dir[0];
+ if (naxes > 1) {
+ rglDir[1] = dir->dir[1];
+ }
+ if (naxes > 2) {
+ rglDir[2] = dir->dir[2];
+ }
+ return 0;
+ case SDL_HAPTIC_SPHERICAL:
+ effect->dwFlags |= FFEFF_SPHERICAL;
+ rglDir[0] = dir->dir[0];
+ if (naxes > 1) {
+ rglDir[1] = dir->dir[1];
+ }
+ if (naxes > 2) {
+ rglDir[2] = dir->dir[2];
+ }
+ return 0;
+
+ default:
+ return SDL_SetError("Haptic: Unknown direction type.");
+ }
+}
+
+
+/* Clamps and converts. */
+#define CCONVERT(x) (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
+/* Just converts. */
+#define CONVERT(x) (((x)*10000) / 0x7FFF)
+/*
+ * Creates the FFEFFECT from a SDL_HapticEffect.
+ */
+static int
+SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
+{
+ int i;
+ FFCONSTANTFORCE *constant = NULL;
+ FFPERIODIC *periodic = NULL;
+ FFCONDITION *condition = NULL; /* Actually an array of conditions - one per axis. */
+ FFRAMPFORCE *ramp = NULL;
+ FFCUSTOMFORCE *custom = NULL;
+ FFENVELOPE *envelope = NULL;
+ SDL_HapticConstant *hap_constant = NULL;
+ SDL_HapticPeriodic *hap_periodic = NULL;
+ SDL_HapticCondition *hap_condition = NULL;
+ SDL_HapticRamp *hap_ramp = NULL;
+ SDL_HapticCustom *hap_custom = NULL;
+ DWORD *axes = NULL;
+
+ /* Set global stuff. */
+ SDL_memset(dest, 0, sizeof(FFEFFECT));
+ dest->dwSize = sizeof(FFEFFECT); /* Set the structure size. */
+ dest->dwSamplePeriod = 0; /* Not used by us. */
+ dest->dwGain = 10000; /* Gain is set globally, not locally. */
+ dest->dwFlags = FFEFF_OBJECTOFFSETS; /* Seems obligatory. */
+
+ /* Envelope. */
+ envelope = SDL_malloc(sizeof(FFENVELOPE));
+ if (envelope == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(envelope, 0, sizeof(FFENVELOPE));
+ dest->lpEnvelope = envelope;
+ envelope->dwSize = sizeof(FFENVELOPE); /* Always should be this. */
+
+ /* Axes. */
+ dest->cAxes = haptic->naxes;
+ if (dest->cAxes > 0) {
+ axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
+ if (axes == NULL) {
+ return SDL_OutOfMemory();
+ }
+ axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */
+ if (dest->cAxes > 1) {
+ axes[1] = haptic->hwdata->axes[1];
+ }
+ if (dest->cAxes > 2) {
+ axes[2] = haptic->hwdata->axes[2];
+ }
+ dest->rgdwAxes = axes;
+ }
+
+
+ /* The big type handling switch, even bigger then Linux's version. */
+ switch (src->type) {
+ case SDL_HAPTIC_CONSTANT:
+ hap_constant = &src->constant;
+ constant = SDL_malloc(sizeof(FFCONSTANTFORCE));
+ if (constant == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(constant, 0, sizeof(FFCONSTANTFORCE));
+
+ /* Specifics */
+ constant->lMagnitude = CONVERT(hap_constant->level);
+ dest->cbTypeSpecificParams = sizeof(FFCONSTANTFORCE);
+ dest->lpvTypeSpecificParams = constant;
+
+ /* Generics */
+ dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = FFGetTriggerButton(hap_constant->button);
+ dest->dwTriggerRepeatInterval = hap_constant->interval;
+ dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_constant->direction, dest->cAxes)
+ < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_constant->attack_length == 0)
+ && (hap_constant->fade_length == 0)) {
+ SDL_free(envelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_constant->attack_level);
+ envelope->dwAttackTime = hap_constant->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_constant->fade_level);
+ envelope->dwFadeTime = hap_constant->fade_length * 1000;
+ }
+
+ break;
+
+ case SDL_HAPTIC_SINE:
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* case SDL_HAPTIC_SQUARE: */
+ case SDL_HAPTIC_TRIANGLE:
+ case SDL_HAPTIC_SAWTOOTHUP:
+ case SDL_HAPTIC_SAWTOOTHDOWN:
+ hap_periodic = &src->periodic;
+ periodic = SDL_malloc(sizeof(FFPERIODIC));
+ if (periodic == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(periodic, 0, sizeof(FFPERIODIC));
+
+ /* Specifics */
+ periodic->dwMagnitude = CONVERT(SDL_abs(hap_periodic->magnitude));
+ periodic->lOffset = CONVERT(hap_periodic->offset);
+ periodic->dwPhase =
+ (hap_periodic->phase + (hap_periodic->magnitude < 0 ? 18000 : 0)) % 36000;
+ periodic->dwPeriod = hap_periodic->period * 1000;
+ dest->cbTypeSpecificParams = sizeof(FFPERIODIC);
+ dest->lpvTypeSpecificParams = periodic;
+
+ /* Generics */
+ dest->dwDuration = hap_periodic->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = FFGetTriggerButton(hap_periodic->button);
+ dest->dwTriggerRepeatInterval = hap_periodic->interval;
+ dest->dwStartDelay = hap_periodic->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_periodic->direction, dest->cAxes)
+ < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_periodic->attack_length == 0)
+ && (hap_periodic->fade_length == 0)) {
+ SDL_free(envelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_periodic->attack_level);
+ envelope->dwAttackTime = hap_periodic->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_periodic->fade_level);
+ envelope->dwFadeTime = hap_periodic->fade_length * 1000;
+ }
+
+ break;
+
+ case SDL_HAPTIC_SPRING:
+ case SDL_HAPTIC_DAMPER:
+ case SDL_HAPTIC_INERTIA:
+ case SDL_HAPTIC_FRICTION:
+ hap_condition = &src->condition;
+ if (dest->cAxes > 0) {
+ condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes);
+ if (condition == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(condition, 0, sizeof(FFCONDITION));
+
+ /* Specifics */
+ for (i = 0; i < dest->cAxes; i++) {
+ condition[i].lOffset = CONVERT(hap_condition->center[i]);
+ condition[i].lPositiveCoefficient =
+ CONVERT(hap_condition->right_coeff[i]);
+ condition[i].lNegativeCoefficient =
+ CONVERT(hap_condition->left_coeff[i]);
+ condition[i].dwPositiveSaturation =
+ CCONVERT(hap_condition->right_sat[i] / 2);
+ condition[i].dwNegativeSaturation =
+ CCONVERT(hap_condition->left_sat[i] / 2);
+ condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i] / 2);
+ }
+ }
+
+ dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes;
+ dest->lpvTypeSpecificParams = condition;
+
+ /* Generics */
+ dest->dwDuration = hap_condition->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = FFGetTriggerButton(hap_condition->button);
+ dest->dwTriggerRepeatInterval = hap_condition->interval;
+ dest->dwStartDelay = hap_condition->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_condition->direction, dest->cAxes)
+ < 0) {
+ return -1;
+ }
+
+ /* Envelope - Not actually supported by most CONDITION implementations. */
+ SDL_free(dest->lpEnvelope);
+ dest->lpEnvelope = NULL;
+
+ break;
+
+ case SDL_HAPTIC_RAMP:
+ hap_ramp = &src->ramp;
+ ramp = SDL_malloc(sizeof(FFRAMPFORCE));
+ if (ramp == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(ramp, 0, sizeof(FFRAMPFORCE));
+
+ /* Specifics */
+ ramp->lStart = CONVERT(hap_ramp->start);
+ ramp->lEnd = CONVERT(hap_ramp->end);
+ dest->cbTypeSpecificParams = sizeof(FFRAMPFORCE);
+ dest->lpvTypeSpecificParams = ramp;
+
+ /* Generics */
+ dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = FFGetTriggerButton(hap_ramp->button);
+ dest->dwTriggerRepeatInterval = hap_ramp->interval;
+ dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_ramp->direction, dest->cAxes) < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_ramp->attack_length == 0) && (hap_ramp->fade_length == 0)) {
+ SDL_free(envelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_ramp->attack_level);
+ envelope->dwAttackTime = hap_ramp->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_ramp->fade_level);
+ envelope->dwFadeTime = hap_ramp->fade_length * 1000;
+ }
+
+ break;
+
+ case SDL_HAPTIC_CUSTOM:
+ hap_custom = &src->custom;
+ custom = SDL_malloc(sizeof(FFCUSTOMFORCE));
+ if (custom == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(custom, 0, sizeof(FFCUSTOMFORCE));
+
+ /* Specifics */
+ custom->cChannels = hap_custom->channels;
+ custom->dwSamplePeriod = hap_custom->period * 1000;
+ custom->cSamples = hap_custom->samples;
+ custom->rglForceData =
+ SDL_malloc(sizeof(LONG) * custom->cSamples * custom->cChannels);
+ for (i = 0; i < hap_custom->samples * hap_custom->channels; i++) { /* Copy data. */
+ custom->rglForceData[i] = CCONVERT(hap_custom->data[i]);
+ }
+ dest->cbTypeSpecificParams = sizeof(FFCUSTOMFORCE);
+ dest->lpvTypeSpecificParams = custom;
+
+ /* Generics */
+ dest->dwDuration = hap_custom->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = FFGetTriggerButton(hap_custom->button);
+ dest->dwTriggerRepeatInterval = hap_custom->interval;
+ dest->dwStartDelay = hap_custom->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_custom->direction, dest->cAxes) <
+ 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_custom->attack_length == 0)
+ && (hap_custom->fade_length == 0)) {
+ SDL_free(envelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_custom->attack_level);
+ envelope->dwAttackTime = hap_custom->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_custom->fade_level);
+ envelope->dwFadeTime = hap_custom->fade_length * 1000;
+ }
+
+ break;
+
+
+ default:
+ return SDL_SetError("Haptic: Unknown effect type.");
+ }
+
+ return 0;
+}
+
+
+/*
+ * Frees an FFEFFECT allocated by SDL_SYS_ToFFEFFECT.
+ */
+static void
+SDL_SYS_HapticFreeFFEFFECT(FFEFFECT * effect, int type)
+{
+ FFCUSTOMFORCE *custom;
+
+ SDL_free(effect->lpEnvelope);
+ effect->lpEnvelope = NULL;
+ SDL_free(effect->rgdwAxes);
+ effect->rgdwAxes = NULL;
+ if (effect->lpvTypeSpecificParams != NULL) {
+ if (type == SDL_HAPTIC_CUSTOM) { /* Must free the custom data. */
+ custom = (FFCUSTOMFORCE *) effect->lpvTypeSpecificParams;
+ SDL_free(custom->rglForceData);
+ custom->rglForceData = NULL;
+ }
+ SDL_free(effect->lpvTypeSpecificParams);
+ effect->lpvTypeSpecificParams = NULL;
+ }
+ SDL_free(effect->rglDirection);
+ effect->rglDirection = NULL;
+}
+
+
+/*
+ * Gets the effect type from the generic SDL haptic effect wrapper.
+ */
+CFUUIDRef
+SDL_SYS_HapticEffectType(Uint16 type)
+{
+ switch (type) {
+ case SDL_HAPTIC_CONSTANT:
+ return kFFEffectType_ConstantForce_ID;
+
+ case SDL_HAPTIC_RAMP:
+ return kFFEffectType_RampForce_ID;
+
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* case SDL_HAPTIC_SQUARE:
+ return kFFEffectType_Square_ID; */
+
+ case SDL_HAPTIC_SINE:
+ return kFFEffectType_Sine_ID;
+
+ case SDL_HAPTIC_TRIANGLE:
+ return kFFEffectType_Triangle_ID;
+
+ case SDL_HAPTIC_SAWTOOTHUP:
+ return kFFEffectType_SawtoothUp_ID;
+
+ case SDL_HAPTIC_SAWTOOTHDOWN:
+ return kFFEffectType_SawtoothDown_ID;
+
+ case SDL_HAPTIC_SPRING:
+ return kFFEffectType_Spring_ID;
+
+ case SDL_HAPTIC_DAMPER:
+ return kFFEffectType_Damper_ID;
+
+ case SDL_HAPTIC_INERTIA:
+ return kFFEffectType_Inertia_ID;
+
+ case SDL_HAPTIC_FRICTION:
+ return kFFEffectType_Friction_ID;
+
+ case SDL_HAPTIC_CUSTOM:
+ return kFFEffectType_CustomForce_ID;
+
+ default:
+ SDL_SetError("Haptic: Unknown effect type.");
+ return NULL;
+ }
+}
+
+
+/*
+ * Creates a new haptic effect.
+ */
+int
+SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ SDL_HapticEffect * base)
+{
+ HRESULT ret;
+ CFUUIDRef type;
+
+ /* Alloc the effect. */
+ effect->hweffect = (struct haptic_hweffect *)
+ SDL_malloc(sizeof(struct haptic_hweffect));
+ if (effect->hweffect == NULL) {
+ SDL_OutOfMemory();
+ goto err_hweffect;
+ }
+
+ /* Get the type. */
+ type = SDL_SYS_HapticEffectType(base->type);
+ if (type == NULL) {
+ goto err_hweffect;
+ }
+
+ /* Get the effect. */
+ if (SDL_SYS_ToFFEFFECT(haptic, &effect->hweffect->effect, base) < 0) {
+ goto err_effectdone;
+ }
+
+ /* Create the actual effect. */
+ ret = FFDeviceCreateEffect(haptic->hwdata->device, type,
+ &effect->hweffect->effect,
+ &effect->hweffect->ref);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Unable to create effect: %s.", FFStrError(ret));
+ goto err_effectdone;
+ }
+
+ return 0;
+
+ err_effectdone:
+ SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect, base->type);
+ err_hweffect:
+ SDL_free(effect->hweffect);
+ effect->hweffect = NULL;
+ return -1;
+}
+
+
+/*
+ * Updates an effect.
+ */
+int
+SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * data)
+{
+ HRESULT ret;
+ FFEffectParameterFlag flags;
+ FFEFFECT temp;
+
+ /* Get the effect. */
+ SDL_memset(&temp, 0, sizeof(FFEFFECT));
+ if (SDL_SYS_ToFFEFFECT(haptic, &temp, data) < 0) {
+ goto err_update;
+ }
+
+ /* Set the flags. Might be worthwhile to diff temp with loaded effect and
+ * only change those parameters. */
+ flags = FFEP_DIRECTION |
+ FFEP_DURATION |
+ FFEP_ENVELOPE |
+ FFEP_STARTDELAY |
+ FFEP_TRIGGERBUTTON |
+ FFEP_TRIGGERREPEATINTERVAL | FFEP_TYPESPECIFICPARAMS;
+
+ /* Create the actual effect. */
+ ret = FFEffectSetParameters(effect->hweffect->ref, &temp, flags);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Unable to update effect: %s.", FFStrError(ret));
+ goto err_update;
+ }
+
+ /* Copy it over. */
+ SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect, data->type);
+ SDL_memcpy(&effect->hweffect->effect, &temp, sizeof(FFEFFECT));
+
+ return 0;
+
+ err_update:
+ SDL_SYS_HapticFreeFFEFFECT(&temp, data->type);
+ return -1;
+}
+
+
+/*
+ * Runs an effect.
+ */
+int
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ Uint32 iterations)
+{
+ HRESULT ret;
+ Uint32 iter;
+
+ /* Check if it's infinite. */
+ if (iterations == SDL_HAPTIC_INFINITY) {
+ iter = FF_INFINITE;
+ } else
+ iter = iterations;
+
+ /* Run the effect. */
+ ret = FFEffectStart(effect->hweffect->ref, iter, 0);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Unable to run the effect: %s.",
+ FFStrError(ret));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Stops an effect.
+ */
+int
+SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ HRESULT ret;
+
+ ret = FFEffectStop(effect->hweffect->ref);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Unable to stop the effect: %s.",
+ FFStrError(ret));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Frees the effect.
+ */
+void
+SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ HRESULT ret;
+
+ ret = FFDeviceReleaseEffect(haptic->hwdata->device, effect->hweffect->ref);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Error removing the effect from the device: %s.",
+ FFStrError(ret));
+ }
+ SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect,
+ effect->effect.type);
+ SDL_free(effect->hweffect);
+ effect->hweffect = NULL;
+}
+
+
+/*
+ * Gets the status of a haptic effect.
+ */
+int
+SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
+ struct haptic_effect *effect)
+{
+ HRESULT ret;
+ FFEffectStatusFlag status;
+
+ ret = FFEffectGetEffectStatus(effect->hweffect->ref, &status);
+ if (ret != FF_OK) {
+ SDL_SetError("Haptic: Unable to get effect status: %s.",
+ FFStrError(ret));
+ return -1;
+ }
+
+ if (status == 0) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE; /* Assume it's playing or emulated. */
+}
+
+
+/*
+ * Sets the gain.
+ */
+int
+SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ HRESULT ret;
+ Uint32 val;
+
+ val = gain * 100; /* Mac OS X uses 0 to 10,000 */
+ ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
+ FFPROP_FFGAIN, &val);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Error setting gain: %s.", FFStrError(ret));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Sets the autocentering.
+ */
+int
+SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ HRESULT ret;
+ Uint32 val;
+
+ /* Mac OS X only has 0 (off) and 1 (on) */
+ if (autocenter == 0) {
+ val = 0;
+ } else {
+ val = 1;
+ }
+
+ ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
+ FFPROP_AUTOCENTER, &val);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Error setting autocenter: %s.",
+ FFStrError(ret));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Pauses the device.
+ */
+int
+SDL_SYS_HapticPause(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+
+ ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
+ FFSFFC_PAUSE);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Unpauses the device.
+ */
+int
+SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+
+ ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
+ FFSFFC_CONTINUE);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Stops all currently playing effects.
+ */
+int
+SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+
+ ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
+ FFSFFC_STOPALL);
+ if (ret != FF_OK) {
+ return SDL_SetError("Haptic: Error stopping device: %s.", FFStrError(ret));
+ }
+
+ return 0;
+}
+
+#endif /* SDL_HAPTIC_IOKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic_c.h b/src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic_c.h
new file mode 100644
index 0000000..073db53
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/darwin/SDL_syshaptic_c.h
@@ -0,0 +1,26 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+extern int MacHaptic_MaybeAddDevice( io_object_t device );
+extern int MacHaptic_MaybeRemoveDevice( io_object_t device );
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/haptic/dummy/SDL_syshaptic.c b/src/3rdparty/SDL2/src/haptic/dummy/SDL_syshaptic.c
new file mode 100644
index 0000000..283fe67
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/dummy/SDL_syshaptic.c
@@ -0,0 +1,186 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(SDL_HAPTIC_DUMMY) || defined(SDL_HAPTIC_DISABLED)
+
+#include "SDL_haptic.h"
+#include "../SDL_syshaptic.h"
+
+
+static int
+SDL_SYS_LogicError(void)
+{
+ return SDL_SetError("Logic error: No haptic devices available.");
+}
+
+
+int
+SDL_SYS_HapticInit(void)
+{
+ return 0;
+}
+
+int
+SDL_SYS_NumHaptics(void)
+{
+ return 0;
+}
+
+const char *
+SDL_SYS_HapticName(int index)
+{
+ SDL_SYS_LogicError();
+ return NULL;
+}
+
+
+int
+SDL_SYS_HapticOpen(SDL_Haptic * haptic)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_HapticMouse(void)
+{
+ return -1;
+}
+
+
+int
+SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
+{
+ return 0;
+}
+
+
+int
+SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return 0;
+}
+
+
+void
+SDL_SYS_HapticClose(SDL_Haptic * haptic)
+{
+ return;
+}
+
+
+void
+SDL_SYS_HapticQuit(void)
+{
+ return;
+}
+
+
+int
+SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect, SDL_HapticEffect * base)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * data)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ Uint32 iterations)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+void
+SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ SDL_SYS_LogicError();
+ return;
+}
+
+
+int
+SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
+ struct haptic_effect *effect)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ return SDL_SYS_LogicError();
+}
+
+
+int
+SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ return SDL_SYS_LogicError();
+}
+
+int
+SDL_SYS_HapticPause(SDL_Haptic * haptic)
+{
+ return SDL_SYS_LogicError();
+}
+
+int
+SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
+{
+ return SDL_SYS_LogicError();
+}
+
+int
+SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
+{
+ return SDL_SYS_LogicError();
+}
+
+#endif /* SDL_HAPTIC_DUMMY || SDL_HAPTIC_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/linux/SDL_syshaptic.c b/src/3rdparty/SDL2/src/haptic/linux/SDL_syshaptic.c
new file mode 100644
index 0000000..9c11a2f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/linux/SDL_syshaptic.c
@@ -0,0 +1,1162 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_HAPTIC_LINUX
+
+#include "SDL_assert.h"
+#include "SDL_haptic.h"
+#include "../SDL_syshaptic.h"
+#include "SDL_joystick.h"
+#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
+#include "../../joystick/linux/SDL_sysjoystick_c.h" /* For joystick hwdata */
+#include "../../core/linux/SDL_udev.h"
+
+#include <unistd.h> /* close */
+#include <linux/input.h> /* Force feedback linux stuff. */
+#include <fcntl.h> /* O_RDWR */
+#include <limits.h> /* INT_MAX */
+#include <errno.h> /* errno, strerror */
+#include <math.h> /* atan2 */
+#include <sys/stat.h> /* stat */
+
+/* Just in case. */
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+
+#define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */
+
+static int MaybeAddDevice(const char *path);
+#if SDL_USE_LIBUDEV
+static int MaybeRemoveDevice(const char *path);
+static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
+#endif /* SDL_USE_LIBUDEV */
+
+/*
+ * List of available haptic devices.
+ */
+typedef struct SDL_hapticlist_item
+{
+ char *fname; /* Dev path name (like /dev/input/event1) */
+ SDL_Haptic *haptic; /* Associated haptic. */
+ dev_t dev_num;
+ struct SDL_hapticlist_item *next;
+} SDL_hapticlist_item;
+
+
+/*
+ * Haptic system hardware data.
+ */
+struct haptic_hwdata
+{
+ int fd; /* File descriptor of the device. */
+ char *fname; /* Points to the name in SDL_hapticlist. */
+};
+
+
+/*
+ * Haptic system effect data.
+ */
+struct haptic_hweffect
+{
+ struct ff_effect effect; /* The linux kernel effect structure. */
+};
+
+static SDL_hapticlist_item *SDL_hapticlist = NULL;
+static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
+static int numhaptics = 0;
+
+#define test_bit(nr, addr) \
+ (((1UL << ((nr) & 31)) & (((const unsigned int *) addr)[(nr) >> 5])) != 0)
+#define EV_TEST(ev,f) \
+ if (test_bit((ev), features)) ret |= (f);
+/*
+ * Test whether a device has haptic properties.
+ * Returns available properties or 0 if there are none.
+ */
+static int
+EV_IsHaptic(int fd)
+{
+ unsigned int ret;
+ unsigned long features[1 + FF_MAX / sizeof(unsigned long)];
+
+ /* Ask device for what it has. */
+ ret = 0;
+ if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(features)), features) < 0) {
+ return SDL_SetError("Haptic: Unable to get device's features: %s",
+ strerror(errno));
+ }
+
+ /* Convert supported features to SDL_HAPTIC platform-neutral features. */
+ EV_TEST(FF_CONSTANT, SDL_HAPTIC_CONSTANT);
+ EV_TEST(FF_SINE, SDL_HAPTIC_SINE);
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* EV_TEST(FF_SQUARE, SDL_HAPTIC_SQUARE); */
+ EV_TEST(FF_TRIANGLE, SDL_HAPTIC_TRIANGLE);
+ EV_TEST(FF_SAW_UP, SDL_HAPTIC_SAWTOOTHUP);
+ EV_TEST(FF_SAW_DOWN, SDL_HAPTIC_SAWTOOTHDOWN);
+ EV_TEST(FF_RAMP, SDL_HAPTIC_RAMP);
+ EV_TEST(FF_SPRING, SDL_HAPTIC_SPRING);
+ EV_TEST(FF_FRICTION, SDL_HAPTIC_FRICTION);
+ EV_TEST(FF_DAMPER, SDL_HAPTIC_DAMPER);
+ EV_TEST(FF_INERTIA, SDL_HAPTIC_INERTIA);
+ EV_TEST(FF_CUSTOM, SDL_HAPTIC_CUSTOM);
+ EV_TEST(FF_GAIN, SDL_HAPTIC_GAIN);
+ EV_TEST(FF_AUTOCENTER, SDL_HAPTIC_AUTOCENTER);
+ EV_TEST(FF_RUMBLE, SDL_HAPTIC_LEFTRIGHT);
+
+ /* Return what it supports. */
+ return ret;
+}
+
+
+/*
+ * Tests whether a device is a mouse or not.
+ */
+static int
+EV_IsMouse(int fd)
+{
+ unsigned long argp[40];
+
+ /* Ask for supported features. */
+ if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(argp)), argp) < 0) {
+ return -1;
+ }
+
+ /* Currently we only test for BTN_MOUSE which can give fake positives. */
+ if (test_bit(BTN_MOUSE, argp) != 0) {
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+ * Initializes the haptic subsystem by finding available devices.
+ */
+int
+SDL_SYS_HapticInit(void)
+{
+ const char joydev_pattern[] = "/dev/input/event%d";
+ char path[PATH_MAX];
+ int i, j;
+
+ /*
+ * Limit amount of checks to MAX_HAPTICS since we may or may not have
+ * permission to some or all devices.
+ */
+ i = 0;
+ for (j = 0; j < MAX_HAPTICS; ++j) {
+
+ snprintf(path, PATH_MAX, joydev_pattern, i++);
+ MaybeAddDevice(path);
+ }
+
+#if SDL_USE_LIBUDEV
+ if (SDL_UDEV_Init() < 0) {
+ return SDL_SetError("Could not initialize UDEV");
+ }
+
+ if ( SDL_UDEV_AddCallback(haptic_udev_callback) < 0) {
+ SDL_UDEV_Quit();
+ return SDL_SetError("Could not setup haptic <-> udev callback");
+ }
+#endif /* SDL_USE_LIBUDEV */
+
+ return numhaptics;
+}
+
+int
+SDL_SYS_NumHaptics(void)
+{
+ return numhaptics;
+}
+
+static SDL_hapticlist_item *
+HapticByDevIndex(int device_index)
+{
+ SDL_hapticlist_item *item = SDL_hapticlist;
+
+ if ((device_index < 0) || (device_index >= numhaptics)) {
+ return NULL;
+ }
+
+ while (device_index > 0) {
+ SDL_assert(item != NULL);
+ --device_index;
+ item = item->next;
+ }
+
+ return item;
+}
+
+#if SDL_USE_LIBUDEV
+static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
+{
+ if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
+ return;
+ }
+
+ switch( udev_type )
+ {
+ case SDL_UDEV_DEVICEADDED:
+ MaybeAddDevice(devpath);
+ break;
+
+ case SDL_UDEV_DEVICEREMOVED:
+ MaybeRemoveDevice(devpath);
+ break;
+
+ default:
+ break;
+ }
+
+}
+#endif /* SDL_USE_LIBUDEV */
+
+static int
+MaybeAddDevice(const char *path)
+{
+ struct stat sb;
+ int fd;
+ int success;
+ SDL_hapticlist_item *item;
+
+ if (path == NULL) {
+ return -1;
+ }
+
+ /* check to see if file exists */
+ if (stat(path, &sb) != 0) {
+ return -1;
+ }
+
+ /* check for duplicates */
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (item->dev_num == sb.st_rdev) {
+ return -1; /* duplicate. */
+ }
+ }
+
+ /* try to open */
+ fd = open(path, O_RDWR, 0);
+ if (fd < 0) {
+ return -1;
+ }
+
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Checking %s\n", path);
+#endif
+
+ /* see if it works */
+ success = EV_IsHaptic(fd);
+ close(fd);
+ if (success <= 0) {
+ return -1;
+ }
+
+ item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item));
+ if (item == NULL) {
+ return -1;
+ }
+
+ item->fname = SDL_strdup(path);
+ if (item->fname == NULL) {
+ SDL_free(item);
+ return -1;
+ }
+
+ item->dev_num = sb.st_rdev;
+
+ /* TODO: should we add instance IDs? */
+ if (SDL_hapticlist_tail == NULL) {
+ SDL_hapticlist = SDL_hapticlist_tail = item;
+ } else {
+ SDL_hapticlist_tail->next = item;
+ SDL_hapticlist_tail = item;
+ }
+
+ ++numhaptics;
+
+ /* !!! TODO: Send a haptic add event? */
+
+ return numhaptics;
+}
+
+#if SDL_USE_LIBUDEV
+static int
+MaybeRemoveDevice(const char* path)
+{
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *prev = NULL;
+
+ if (path == NULL) {
+ return -1;
+ }
+
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (SDL_strcmp(path, item->fname) == 0) {
+ const int retval = item->haptic ? item->haptic->index : -1;
+
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_hapticlist == item);
+ SDL_hapticlist = item->next;
+ }
+ if (item == SDL_hapticlist_tail) {
+ SDL_hapticlist_tail = prev;
+ }
+
+ /* Need to decrement the haptic count */
+ --numhaptics;
+ /* !!! TODO: Send a haptic remove event? */
+
+ SDL_free(item->fname);
+ SDL_free(item);
+ return retval;
+ }
+ prev = item;
+ }
+
+ return -1;
+}
+#endif /* SDL_USE_LIBUDEV */
+
+/*
+ * Gets the name from a file descriptor.
+ */
+static const char *
+SDL_SYS_HapticNameFromFD(int fd)
+{
+ static char namebuf[128];
+
+ /* We use the evdev name ioctl. */
+ if (ioctl(fd, EVIOCGNAME(sizeof(namebuf)), namebuf) <= 0) {
+ return NULL;
+ }
+
+ return namebuf;
+}
+
+
+/*
+ * Return the name of a haptic device, does not need to be opened.
+ */
+const char *
+SDL_SYS_HapticName(int index)
+{
+ SDL_hapticlist_item *item;
+ int fd;
+ const char *name;
+
+ item = HapticByDevIndex(index);
+ /* Open the haptic device. */
+ name = NULL;
+ fd = open(item->fname, O_RDONLY, 0);
+
+ if (fd >= 0) {
+
+ name = SDL_SYS_HapticNameFromFD(fd);
+ if (name == NULL) {
+ /* No name found, return device character device */
+ name = item->fname;
+ }
+ close(fd);
+ }
+
+ return name;
+}
+
+
+/*
+ * Opens the haptic device from the file descriptor.
+ */
+static int
+SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
+{
+ /* Allocate the hwdata */
+ haptic->hwdata = (struct haptic_hwdata *)
+ SDL_malloc(sizeof(*haptic->hwdata));
+ if (haptic->hwdata == NULL) {
+ SDL_OutOfMemory();
+ goto open_err;
+ }
+ SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
+
+ /* Set the data. */
+ haptic->hwdata->fd = fd;
+ haptic->supported = EV_IsHaptic(fd);
+ haptic->naxes = 2; /* Hardcoded for now, not sure if it's possible to find out. */
+
+ /* Set the effects */
+ if (ioctl(fd, EVIOCGEFFECTS, &haptic->neffects) < 0) {
+ SDL_SetError("Haptic: Unable to query device memory: %s",
+ strerror(errno));
+ goto open_err;
+ }
+ haptic->nplaying = haptic->neffects; /* Linux makes no distinction. */
+ haptic->effects = (struct haptic_effect *)
+ SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
+ if (haptic->effects == NULL) {
+ SDL_OutOfMemory();
+ goto open_err;
+ }
+ /* Clear the memory */
+ SDL_memset(haptic->effects, 0,
+ sizeof(struct haptic_effect) * haptic->neffects);
+
+ return 0;
+
+ /* Error handling */
+ open_err:
+ close(fd);
+ if (haptic->hwdata != NULL) {
+ SDL_free(haptic->hwdata);
+ haptic->hwdata = NULL;
+ }
+ return -1;
+}
+
+
+/*
+ * Opens a haptic device for usage.
+ */
+int
+SDL_SYS_HapticOpen(SDL_Haptic * haptic)
+{
+ int fd;
+ int ret;
+ SDL_hapticlist_item *item;
+
+ item = HapticByDevIndex(haptic->index);
+ /* Open the character device */
+ fd = open(item->fname, O_RDWR, 0);
+ if (fd < 0) {
+ return SDL_SetError("Haptic: Unable to open %s: %s",
+ item->fname, strerror(errno));
+ }
+
+ /* Try to create the haptic. */
+ ret = SDL_SYS_HapticOpenFromFD(haptic, fd); /* Already closes on error. */
+ if (ret < 0) {
+ return -1;
+ }
+
+ /* Set the fname. */
+ haptic->hwdata->fname = SDL_strdup( item->fname );
+ return 0;
+}
+
+
+/*
+ * Opens a haptic device from first mouse it finds for usage.
+ */
+int
+SDL_SYS_HapticMouse(void)
+{
+ int fd;
+ int device_index = 0;
+ SDL_hapticlist_item *item;
+
+ for (item = SDL_hapticlist; item; item = item->next) {
+ /* Open the device. */
+ fd = open(item->fname, O_RDWR, 0);
+ if (fd < 0) {
+ return SDL_SetError("Haptic: Unable to open %s: %s",
+ item->fname, strerror(errno));
+ }
+
+ /* Is it a mouse? */
+ if (EV_IsMouse(fd)) {
+ close(fd);
+ return device_index;
+ }
+
+ close(fd);
+
+ ++device_index;
+ }
+
+ return -1;
+}
+
+
+/*
+ * Checks to see if a joystick has haptic features.
+ */
+int
+SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
+{
+ return EV_IsHaptic(joystick->hwdata->fd);
+}
+
+
+/*
+ * Checks to see if the haptic device and joystick are in reality the same.
+ */
+int
+SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ /* We are assuming Linux is using evdev which should trump the old
+ * joystick methods. */
+ if (SDL_strcmp(joystick->hwdata->fname, haptic->hwdata->fname) == 0) {
+ return 1;
+ }
+ return 0;
+}
+
+
+/*
+ * Opens a SDL_Haptic from a SDL_Joystick.
+ */
+int
+SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ int device_index = 0;
+ int fd;
+ int ret;
+ SDL_hapticlist_item *item;
+
+ /* Find the joystick in the haptic list. */
+ for (item = SDL_hapticlist; item; item = item->next) {
+ if (SDL_strcmp(item->fname, joystick->hwdata->fname) == 0) {
+ break;
+ }
+ ++device_index;
+ }
+ haptic->index = device_index;
+
+ if (device_index >= MAX_HAPTICS) {
+ return SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities");
+ }
+
+ fd = open(joystick->hwdata->fname, O_RDWR, 0);
+ if (fd < 0) {
+ return SDL_SetError("Haptic: Unable to open %s: %s",
+ joystick->hwdata->fname, strerror(errno));
+ }
+ ret = SDL_SYS_HapticOpenFromFD(haptic, fd); /* Already closes on error. */
+ if (ret < 0) {
+ return -1;
+ }
+
+ haptic->hwdata->fname = SDL_strdup( joystick->hwdata->fname );
+
+ return 0;
+}
+
+
+/*
+ * Closes the haptic device.
+ */
+void
+SDL_SYS_HapticClose(SDL_Haptic * haptic)
+{
+ if (haptic->hwdata) {
+
+ /* Free effects. */
+ SDL_free(haptic->effects);
+ haptic->effects = NULL;
+ haptic->neffects = 0;
+
+ /* Clean up */
+ close(haptic->hwdata->fd);
+
+ /* Free */
+ SDL_free(haptic->hwdata->fname);
+ SDL_free(haptic->hwdata);
+ haptic->hwdata = NULL;
+ }
+
+ /* Clear the rest. */
+ SDL_memset(haptic, 0, sizeof(SDL_Haptic));
+}
+
+
+/*
+ * Clean up after system specific haptic stuff
+ */
+void
+SDL_SYS_HapticQuit(void)
+{
+ SDL_hapticlist_item *item = NULL;
+ SDL_hapticlist_item *next = NULL;
+
+ for (item = SDL_hapticlist; item; item = next) {
+ next = item->next;
+ /* Opened and not closed haptics are leaked, this is on purpose.
+ * Close your haptic devices after usage. */
+ SDL_free(item->fname);
+ SDL_free(item);
+ }
+
+#if SDL_USE_LIBUDEV
+ SDL_UDEV_DelCallback(haptic_udev_callback);
+ SDL_UDEV_Quit();
+#endif /* SDL_USE_LIBUDEV */
+
+ numhaptics = 0;
+ SDL_hapticlist = NULL;
+ SDL_hapticlist_tail = NULL;
+}
+
+
+/*
+ * Converts an SDL button to a ff_trigger button.
+ */
+static Uint16
+SDL_SYS_ToButton(Uint16 button)
+{
+ Uint16 ff_button;
+
+ ff_button = 0;
+
+ /*
+ * Not sure what the proper syntax is because this actually isn't implemented
+ * in the current kernel from what I've seen (2.6.26).
+ */
+ if (button != 0) {
+ ff_button = BTN_GAMEPAD + button - 1;
+ }
+
+ return ff_button;
+}
+
+
+/*
+ * Initializes the ff_effect usable direction from a SDL_HapticDirection.
+ */
+static int
+SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
+{
+ Uint32 tmp;
+
+ switch (src->type) {
+ case SDL_HAPTIC_POLAR:
+ /* Linux directions start from south.
+ (and range from 0 to 0xFFFF)
+ Quoting include/linux/input.h, line 926:
+ Direction of the effect is encoded as follows:
+ 0 deg -> 0x0000 (down)
+ 90 deg -> 0x4000 (left)
+ 180 deg -> 0x8000 (up)
+ 270 deg -> 0xC000 (right)
+ The force pulls into the direction specified by Linux directions,
+ i.e. the opposite convention of SDL directions.
+ */
+ tmp = ((src->dir[0] % 36000) * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
+ *dest = (Uint16) tmp;
+ break;
+
+ case SDL_HAPTIC_SPHERICAL:
+ /*
+ We convert to polar, because that's the only supported direction on Linux.
+ The first value of a spherical direction is practically the same as a
+ Polar direction, except that we have to add 90 degrees. It is the angle
+ from EAST {1,0} towards SOUTH {0,1}.
+ --> add 9000
+ --> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
+ */
+ tmp = ((src->dir[0]) + 9000) % 36000; /* Convert to polars */
+ tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
+ *dest = (Uint16) tmp;
+ break;
+
+ case SDL_HAPTIC_CARTESIAN:
+ if (!src->dir[1])
+ *dest = (src->dir[0] >= 0 ? 0x4000 : 0xC000);
+ else if (!src->dir[0])
+ *dest = (src->dir[1] >= 0 ? 0x8000 : 0);
+ else {
+ float f = SDL_atan2(src->dir[1], src->dir[0]); /* Ideally we'd use fixed point math instead of floats... */
+ /*
+ atan2 takes the parameters: Y-axis-value and X-axis-value (in that order)
+ - Y-axis-value is the second coordinate (from center to SOUTH)
+ - X-axis-value is the first coordinate (from center to EAST)
+ We add 36000, because atan2 also returns negative values. Then we practically
+ have the first spherical value. Therefore we proceed as in case
+ SDL_HAPTIC_SPHERICAL and add another 9000 to get the polar value.
+ --> add 45000 in total
+ --> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
+ */
+ tmp = (((Sint32) (f * 18000. / M_PI)) + 45000) % 36000;
+ tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
+ *dest = (Uint16) tmp;
+ }
+ break;
+
+ default:
+ return SDL_SetError("Haptic: Unsupported direction type.");
+ }
+
+ return 0;
+}
+
+
+#define CLAMP(x) (((x) > 32767) ? 32767 : x)
+/*
+ * Initializes the Linux effect struct from a haptic_effect.
+ * Values above 32767 (for unsigned) are unspecified so we must clamp.
+ */
+static int
+SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
+{
+ SDL_HapticConstant *constant;
+ SDL_HapticPeriodic *periodic;
+ SDL_HapticCondition *condition;
+ SDL_HapticRamp *ramp;
+ SDL_HapticLeftRight *leftright;
+
+ /* Clear up */
+ SDL_memset(dest, 0, sizeof(struct ff_effect));
+
+ switch (src->type) {
+ case SDL_HAPTIC_CONSTANT:
+ constant = &src->constant;
+
+ /* Header */
+ dest->type = FF_CONSTANT;
+ if (SDL_SYS_ToDirection(&dest->direction, &constant->direction) == -1)
+ return -1;
+
+ /* Replay */
+ dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ?
+ 0 : CLAMP(constant->length);
+ dest->replay.delay = CLAMP(constant->delay);
+
+ /* Trigger */
+ dest->trigger.button = SDL_SYS_ToButton(constant->button);
+ dest->trigger.interval = CLAMP(constant->interval);
+
+ /* Constant */
+ dest->u.constant.level = constant->level;
+
+ /* Envelope */
+ dest->u.constant.envelope.attack_length =
+ CLAMP(constant->attack_length);
+ dest->u.constant.envelope.attack_level =
+ CLAMP(constant->attack_level);
+ dest->u.constant.envelope.fade_length = CLAMP(constant->fade_length);
+ dest->u.constant.envelope.fade_level = CLAMP(constant->fade_level);
+
+ break;
+
+ case SDL_HAPTIC_SINE:
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* case SDL_HAPTIC_SQUARE: */
+ case SDL_HAPTIC_TRIANGLE:
+ case SDL_HAPTIC_SAWTOOTHUP:
+ case SDL_HAPTIC_SAWTOOTHDOWN:
+ periodic = &src->periodic;
+
+ /* Header */
+ dest->type = FF_PERIODIC;
+ if (SDL_SYS_ToDirection(&dest->direction, &periodic->direction) == -1)
+ return -1;
+
+ /* Replay */
+ dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ?
+ 0 : CLAMP(periodic->length);
+ dest->replay.delay = CLAMP(periodic->delay);
+
+ /* Trigger */
+ dest->trigger.button = SDL_SYS_ToButton(periodic->button);
+ dest->trigger.interval = CLAMP(periodic->interval);
+
+ /* Periodic */
+ if (periodic->type == SDL_HAPTIC_SINE)
+ dest->u.periodic.waveform = FF_SINE;
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* else if (periodic->type == SDL_HAPTIC_SQUARE)
+ dest->u.periodic.waveform = FF_SQUARE; */
+ else if (periodic->type == SDL_HAPTIC_TRIANGLE)
+ dest->u.periodic.waveform = FF_TRIANGLE;
+ else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP)
+ dest->u.periodic.waveform = FF_SAW_UP;
+ else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN)
+ dest->u.periodic.waveform = FF_SAW_DOWN;
+ dest->u.periodic.period = CLAMP(periodic->period);
+ dest->u.periodic.magnitude = periodic->magnitude;
+ dest->u.periodic.offset = periodic->offset;
+ /* Linux phase is defined in interval "[0x0000, 0x10000[", corresponds with "[0deg, 360deg[" phase shift. */
+ dest->u.periodic.phase = ((Uint32)periodic->phase * 0x10000U) / 36000;
+
+ /* Envelope */
+ dest->u.periodic.envelope.attack_length =
+ CLAMP(periodic->attack_length);
+ dest->u.periodic.envelope.attack_level =
+ CLAMP(periodic->attack_level);
+ dest->u.periodic.envelope.fade_length = CLAMP(periodic->fade_length);
+ dest->u.periodic.envelope.fade_level = CLAMP(periodic->fade_level);
+
+ break;
+
+ case SDL_HAPTIC_SPRING:
+ case SDL_HAPTIC_DAMPER:
+ case SDL_HAPTIC_INERTIA:
+ case SDL_HAPTIC_FRICTION:
+ condition = &src->condition;
+
+ /* Header */
+ if (condition->type == SDL_HAPTIC_SPRING)
+ dest->type = FF_SPRING;
+ else if (condition->type == SDL_HAPTIC_DAMPER)
+ dest->type = FF_DAMPER;
+ else if (condition->type == SDL_HAPTIC_INERTIA)
+ dest->type = FF_INERTIA;
+ else if (condition->type == SDL_HAPTIC_FRICTION)
+ dest->type = FF_FRICTION;
+ dest->direction = 0; /* Handled by the condition-specifics. */
+
+ /* Replay */
+ dest->replay.length = (condition->length == SDL_HAPTIC_INFINITY) ?
+ 0 : CLAMP(condition->length);
+ dest->replay.delay = CLAMP(condition->delay);
+
+ /* Trigger */
+ dest->trigger.button = SDL_SYS_ToButton(condition->button);
+ dest->trigger.interval = CLAMP(condition->interval);
+
+ /* Condition */
+ /* X axis */
+ dest->u.condition[0].right_saturation = condition->right_sat[0];
+ dest->u.condition[0].left_saturation = condition->left_sat[0];
+ dest->u.condition[0].right_coeff = condition->right_coeff[0];
+ dest->u.condition[0].left_coeff = condition->left_coeff[0];
+ dest->u.condition[0].deadband = condition->deadband[0];
+ dest->u.condition[0].center = condition->center[0];
+ /* Y axis */
+ dest->u.condition[1].right_saturation = condition->right_sat[1];
+ dest->u.condition[1].left_saturation = condition->left_sat[1];
+ dest->u.condition[1].right_coeff = condition->right_coeff[1];
+ dest->u.condition[1].left_coeff = condition->left_coeff[1];
+ dest->u.condition[1].deadband = condition->deadband[1];
+ dest->u.condition[1].center = condition->center[1];
+
+ /*
+ * There is no envelope in the linux force feedback api for conditions.
+ */
+
+ break;
+
+ case SDL_HAPTIC_RAMP:
+ ramp = &src->ramp;
+
+ /* Header */
+ dest->type = FF_RAMP;
+ if (SDL_SYS_ToDirection(&dest->direction, &ramp->direction) == -1)
+ return -1;
+
+ /* Replay */
+ dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ?
+ 0 : CLAMP(ramp->length);
+ dest->replay.delay = CLAMP(ramp->delay);
+
+ /* Trigger */
+ dest->trigger.button = SDL_SYS_ToButton(ramp->button);
+ dest->trigger.interval = CLAMP(ramp->interval);
+
+ /* Ramp */
+ dest->u.ramp.start_level = ramp->start;
+ dest->u.ramp.end_level = ramp->end;
+
+ /* Envelope */
+ dest->u.ramp.envelope.attack_length = CLAMP(ramp->attack_length);
+ dest->u.ramp.envelope.attack_level = CLAMP(ramp->attack_level);
+ dest->u.ramp.envelope.fade_length = CLAMP(ramp->fade_length);
+ dest->u.ramp.envelope.fade_level = CLAMP(ramp->fade_level);
+
+ break;
+
+ case SDL_HAPTIC_LEFTRIGHT:
+ leftright = &src->leftright;
+
+ /* Header */
+ dest->type = FF_RUMBLE;
+ dest->direction = 0;
+
+ /* Replay */
+ dest->replay.length = (leftright->length == SDL_HAPTIC_INFINITY) ?
+ 0 : CLAMP(leftright->length);
+
+ /* Trigger */
+ dest->trigger.button = 0;
+ dest->trigger.interval = 0;
+
+ /* Rumble */
+ dest->u.rumble.strong_magnitude = leftright->large_magnitude;
+ dest->u.rumble.weak_magnitude = leftright->small_magnitude;
+
+ break;
+
+
+ default:
+ return SDL_SetError("Haptic: Unknown effect type.");
+ }
+
+ return 0;
+}
+
+
+/*
+ * Creates a new haptic effect.
+ */
+int
+SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ SDL_HapticEffect * base)
+{
+ struct ff_effect *linux_effect;
+
+ /* Allocate the hardware effect */
+ effect->hweffect = (struct haptic_hweffect *)
+ SDL_malloc(sizeof(struct haptic_hweffect));
+ if (effect->hweffect == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Prepare the ff_effect */
+ linux_effect = &effect->hweffect->effect;
+ if (SDL_SYS_ToFFEffect(linux_effect, base) != 0) {
+ goto new_effect_err;
+ }
+ linux_effect->id = -1; /* Have the kernel give it an id */
+
+ /* Upload the effect */
+ if (ioctl(haptic->hwdata->fd, EVIOCSFF, linux_effect) < 0) {
+ SDL_SetError("Haptic: Error uploading effect to the device: %s",
+ strerror(errno));
+ goto new_effect_err;
+ }
+
+ return 0;
+
+ new_effect_err:
+ SDL_free(effect->hweffect);
+ effect->hweffect = NULL;
+ return -1;
+}
+
+
+/*
+ * Updates an effect.
+ *
+ * Note: Dynamically updating the direction can in some cases force
+ * the effect to restart and run once.
+ */
+int
+SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * data)
+{
+ struct ff_effect linux_effect;
+
+ /* Create the new effect */
+ if (SDL_SYS_ToFFEffect(&linux_effect, data) != 0) {
+ return -1;
+ }
+ linux_effect.id = effect->hweffect->effect.id;
+
+ /* See if it can be uploaded. */
+ if (ioctl(haptic->hwdata->fd, EVIOCSFF, &linux_effect) < 0) {
+ return SDL_SetError("Haptic: Error updating the effect: %s",
+ strerror(errno));
+ }
+
+ /* Copy the new effect into memory. */
+ SDL_memcpy(&effect->hweffect->effect, &linux_effect,
+ sizeof(struct ff_effect));
+
+ return effect->hweffect->effect.id;
+}
+
+
+/*
+ * Runs an effect.
+ */
+int
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ Uint32 iterations)
+{
+ struct input_event run;
+
+ /* Prepare to run the effect */
+ run.type = EV_FF;
+ run.code = effect->hweffect->effect.id;
+ /* We don't actually have infinity here, so we just do INT_MAX which is pretty damn close. */
+ run.value = (iterations > INT_MAX) ? INT_MAX : iterations;
+
+ if (write(haptic->hwdata->fd, (const void *) &run, sizeof(run)) < 0) {
+ return SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Stops an effect.
+ */
+int
+SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ struct input_event stop;
+
+ stop.type = EV_FF;
+ stop.code = effect->hweffect->effect.id;
+ stop.value = 0;
+
+ if (write(haptic->hwdata->fd, (const void *) &stop, sizeof(stop)) < 0) {
+ return SDL_SetError("Haptic: Unable to stop the effect: %s",
+ strerror(errno));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Frees the effect.
+ */
+void
+SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ if (ioctl(haptic->hwdata->fd, EVIOCRMFF, effect->hweffect->effect.id) < 0) {
+ SDL_SetError("Haptic: Error removing the effect from the device: %s",
+ strerror(errno));
+ }
+ SDL_free(effect->hweffect);
+ effect->hweffect = NULL;
+}
+
+
+/*
+ * Gets the status of a haptic effect.
+ */
+int
+SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
+ struct haptic_effect *effect)
+{
+#if 0 /* Not supported atm. */
+ struct input_event ie;
+
+ ie.type = EV_FF;
+ ie.type = EV_FF_STATUS;
+ ie.code = effect->hweffect->effect.id;
+
+ if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
+ return SDL_SetError("Haptic: Error getting device status.");
+ }
+
+ return 0;
+#endif
+
+ return -1;
+}
+
+
+/*
+ * Sets the gain.
+ */
+int
+SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ struct input_event ie;
+
+ ie.type = EV_FF;
+ ie.code = FF_GAIN;
+ ie.value = (0xFFFFUL * gain) / 100;
+
+ if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
+ return SDL_SetError("Haptic: Error setting gain: %s", strerror(errno));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Sets the autocentering.
+ */
+int
+SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ struct input_event ie;
+
+ ie.type = EV_FF;
+ ie.code = FF_AUTOCENTER;
+ ie.value = (0xFFFFUL * autocenter) / 100;
+
+ if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
+ return SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno));
+ }
+
+ return 0;
+}
+
+
+/*
+ * Pausing is not supported atm by linux.
+ */
+int
+SDL_SYS_HapticPause(SDL_Haptic * haptic)
+{
+ return -1;
+}
+
+
+/*
+ * Unpausing is not supported atm by linux.
+ */
+int
+SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
+{
+ return -1;
+}
+
+
+/*
+ * Stops all the currently playing effects.
+ */
+int
+SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
+{
+ int i, ret;
+
+ /* Linux does not support this natively so we have to loop. */
+ for (i = 0; i < haptic->neffects; i++) {
+ if (haptic->effects[i].hweffect != NULL) {
+ ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
+ if (ret < 0) {
+ return SDL_SetError
+ ("Haptic: Error while trying to stop all playing effects.");
+ }
+ }
+ }
+ return 0;
+}
+
+#endif /* SDL_HAPTIC_LINUX */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic.c b/src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic.c
new file mode 100644
index 0000000..897d128
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic.c
@@ -0,0 +1,1305 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_error.h"
+#include "SDL_haptic.h"
+#include "../SDL_syshaptic.h"
+
+#if SDL_HAPTIC_DINPUT
+
+#include "SDL_stdinc.h"
+#include "SDL_timer.h"
+#include "SDL_windowshaptic_c.h"
+#include "SDL_dinputhaptic_c.h"
+#include "../../joystick/windows/SDL_windowsjoystick_c.h"
+
+/*
+ * External stuff.
+ */
+extern HWND SDL_HelperWindow;
+
+
+/*
+ * Internal stuff.
+ */
+static SDL_bool coinitialized = SDL_FALSE;
+static LPDIRECTINPUT8 dinput = NULL;
+
+
+/*
+ * Like SDL_SetError but for DX error codes.
+ */
+static int
+DI_SetError(const char *str, HRESULT err)
+{
+ /*
+ SDL_SetError("Haptic: %s - %s: %s", str,
+ DXGetErrorString8A(err), DXGetErrorDescription8A(err));
+ */
+ return SDL_SetError("Haptic error %s", str);
+}
+
+/*
+ * Callback to find the haptic devices.
+ */
+static BOOL CALLBACK
+EnumHapticsCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
+{
+ (void) pContext;
+ SDL_DINPUT_MaybeAddDevice(pdidInstance);
+ return DIENUM_CONTINUE; /* continue enumerating */
+}
+
+int
+SDL_DINPUT_HapticInit(void)
+{
+ HRESULT ret;
+ HINSTANCE instance;
+
+ if (dinput != NULL) { /* Already open. */
+ return SDL_SetError("Haptic: SubSystem already open.");
+ }
+
+ ret = WIN_CoInitialize();
+ if (FAILED(ret)) {
+ return DI_SetError("Coinitialize", ret);
+ }
+
+ coinitialized = SDL_TRUE;
+
+ ret = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IDirectInput8, (LPVOID)& dinput);
+ if (FAILED(ret)) {
+ SDL_SYS_HapticQuit();
+ return DI_SetError("CoCreateInstance", ret);
+ }
+
+ /* Because we used CoCreateInstance, we need to Initialize it, first. */
+ instance = GetModuleHandle(NULL);
+ if (instance == NULL) {
+ SDL_SYS_HapticQuit();
+ return SDL_SetError("GetModuleHandle() failed with error code %lu.",
+ GetLastError());
+ }
+ ret = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
+ if (FAILED(ret)) {
+ SDL_SYS_HapticQuit();
+ return DI_SetError("Initializing DirectInput device", ret);
+ }
+
+ /* Look for haptic devices. */
+ ret = IDirectInput8_EnumDevices(dinput,
+ 0,
+ EnumHapticsCallback,
+ NULL,
+ DIEDFL_FORCEFEEDBACK |
+ DIEDFL_ATTACHEDONLY);
+ if (FAILED(ret)) {
+ SDL_SYS_HapticQuit();
+ return DI_SetError("Enumerating DirectInput devices", ret);
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_MaybeAddDevice(const DIDEVICEINSTANCE * pdidInstance)
+{
+ HRESULT ret;
+ LPDIRECTINPUTDEVICE8 device;
+ const DWORD needflags = DIDC_ATTACHED | DIDC_FORCEFEEDBACK;
+ DIDEVCAPS capabilities;
+ SDL_hapticlist_item *item = NULL;
+
+ if (dinput == NULL) {
+ return -1; /* not initialized. We'll pick these up on enumeration if we init later. */
+ }
+
+ /* Make sure we don't already have it */
+ for (item = SDL_hapticlist; item; item = item->next) {
+ if ((!item->bXInputHaptic) && (SDL_memcmp(&item->instance, pdidInstance, sizeof(*pdidInstance)) == 0)) {
+ return -1; /* Already added */
+ }
+ }
+
+ /* Open the device */
+ ret = IDirectInput8_CreateDevice(dinput, &pdidInstance->guidInstance, &device, NULL);
+ if (FAILED(ret)) {
+ /* DI_SetError("Creating DirectInput device",ret); */
+ return -1;
+ }
+
+ /* Get capabilities. */
+ SDL_zero(capabilities);
+ capabilities.dwSize = sizeof(DIDEVCAPS);
+ ret = IDirectInputDevice8_GetCapabilities(device, &capabilities);
+ IDirectInputDevice8_Release(device);
+ if (FAILED(ret)) {
+ /* DI_SetError("Getting device capabilities",ret); */
+ return -1;
+ }
+
+ if ((capabilities.dwFlags & needflags) != needflags) {
+ return -1; /* not a device we can use. */
+ }
+
+ item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item));
+ if (item == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ item->name = WIN_StringToUTF8(pdidInstance->tszProductName);
+ if (!item->name) {
+ SDL_free(item);
+ return -1;
+ }
+
+ /* Copy the instance over, useful for creating devices. */
+ SDL_memcpy(&item->instance, pdidInstance, sizeof(DIDEVICEINSTANCE));
+ SDL_memcpy(&item->capabilities, &capabilities, sizeof(capabilities));
+
+ return SDL_SYS_AddHapticDevice(item);
+}
+
+int
+SDL_DINPUT_MaybeRemoveDevice(const DIDEVICEINSTANCE * pdidInstance)
+{
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *prev = NULL;
+
+ if (dinput == NULL) {
+ return -1; /* not initialized, ignore this. */
+ }
+
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (!item->bXInputHaptic && SDL_memcmp(&item->instance, pdidInstance, sizeof(*pdidInstance)) == 0) {
+ /* found it, remove it. */
+ return SDL_SYS_RemoveHapticDevice(prev, item);
+ }
+ prev = item;
+ }
+ return -1;
+}
+
+/*
+ * Callback to get supported axes.
+ */
+static BOOL CALLBACK
+DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
+{
+ SDL_Haptic *haptic = (SDL_Haptic *) pvRef;
+
+ if ((dev->dwType & DIDFT_AXIS) && (dev->dwFlags & DIDOI_FFACTUATOR)) {
+ const GUID *guid = &dev->guidType;
+ DWORD offset = 0;
+ if (WIN_IsEqualGUID(guid, &GUID_XAxis)) {
+ offset = DIJOFS_X;
+ } else if (WIN_IsEqualGUID(guid, &GUID_YAxis)) {
+ offset = DIJOFS_Y;
+ } else if (WIN_IsEqualGUID(guid, &GUID_ZAxis)) {
+ offset = DIJOFS_Z;
+ } else if (WIN_IsEqualGUID(guid, &GUID_RxAxis)) {
+ offset = DIJOFS_RX;
+ } else if (WIN_IsEqualGUID(guid, &GUID_RyAxis)) {
+ offset = DIJOFS_RY;
+ } else if (WIN_IsEqualGUID(guid, &GUID_RzAxis)) {
+ offset = DIJOFS_RZ;
+ } else {
+ return DIENUM_CONTINUE; /* can't use this, go on. */
+ }
+
+ haptic->hwdata->axes[haptic->naxes] = offset;
+ haptic->naxes++;
+
+ /* Currently using the artificial limit of 3 axes. */
+ if (haptic->naxes >= 3) {
+ return DIENUM_STOP;
+ }
+ }
+
+ return DIENUM_CONTINUE;
+}
+
+/*
+ * Callback to get all supported effects.
+ */
+#define EFFECT_TEST(e,s) \
+if (WIN_IsEqualGUID(&pei->guid, &(e))) \
+ haptic->supported |= (s)
+static BOOL CALLBACK
+DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv)
+{
+ /* Prepare the haptic device. */
+ SDL_Haptic *haptic = (SDL_Haptic *) pv;
+
+ /* Get supported. */
+ EFFECT_TEST(GUID_Spring, SDL_HAPTIC_SPRING);
+ EFFECT_TEST(GUID_Damper, SDL_HAPTIC_DAMPER);
+ EFFECT_TEST(GUID_Inertia, SDL_HAPTIC_INERTIA);
+ EFFECT_TEST(GUID_Friction, SDL_HAPTIC_FRICTION);
+ EFFECT_TEST(GUID_ConstantForce, SDL_HAPTIC_CONSTANT);
+ EFFECT_TEST(GUID_CustomForce, SDL_HAPTIC_CUSTOM);
+ EFFECT_TEST(GUID_Sine, SDL_HAPTIC_SINE);
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* EFFECT_TEST(GUID_Square, SDL_HAPTIC_SQUARE); */
+ EFFECT_TEST(GUID_Triangle, SDL_HAPTIC_TRIANGLE);
+ EFFECT_TEST(GUID_SawtoothUp, SDL_HAPTIC_SAWTOOTHUP);
+ EFFECT_TEST(GUID_SawtoothDown, SDL_HAPTIC_SAWTOOTHDOWN);
+ EFFECT_TEST(GUID_RampForce, SDL_HAPTIC_RAMP);
+
+ /* Check for more. */
+ return DIENUM_CONTINUE;
+}
+
+/*
+ * Opens the haptic device.
+ *
+ * Steps:
+ * - Set cooperative level.
+ * - Set data format.
+ * - Acquire exclusiveness.
+ * - Reset actuators.
+ * - Get supported features.
+ */
+static int
+SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic * haptic, LPDIRECTINPUTDEVICE8 device8, SDL_bool is_joystick)
+{
+ HRESULT ret;
+ DIPROPDWORD dipdw;
+
+ /* Allocate the hwdata */
+ haptic->hwdata = (struct haptic_hwdata *)SDL_malloc(sizeof(*haptic->hwdata));
+ if (haptic->hwdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
+
+ /* We'll use the device8 from now on. */
+ haptic->hwdata->device = device8;
+ haptic->hwdata->is_joystick = is_joystick;
+
+ /* !!! FIXME: opening a haptic device here first will make an attempt to
+ !!! FIXME: SDL_JoystickOpen() that same device fail later, since we
+ !!! FIXME: have it open in exclusive mode. But this will allow
+ !!! FIXME: SDL_JoystickOpen() followed by SDL_HapticOpenFromJoystick()
+ !!! FIXME: to work, and that's probably the common case. Still,
+ !!! FIXME: ideally, We need to unify the opening code. */
+
+ if (!is_joystick) { /* if is_joystick, we already set this up elsewhere. */
+ /* Grab it exclusively to use force feedback stuff. */
+ ret = IDirectInputDevice8_SetCooperativeLevel(haptic->hwdata->device,
+ SDL_HelperWindow,
+ DISCL_EXCLUSIVE |
+ DISCL_BACKGROUND);
+ if (FAILED(ret)) {
+ DI_SetError("Setting cooperative level to exclusive", ret);
+ goto acquire_err;
+ }
+
+ /* Set data format. */
+ ret = IDirectInputDevice8_SetDataFormat(haptic->hwdata->device,
+ &SDL_c_dfDIJoystick2);
+ if (FAILED(ret)) {
+ DI_SetError("Setting data format", ret);
+ goto acquire_err;
+ }
+
+
+ /* Acquire the device. */
+ ret = IDirectInputDevice8_Acquire(haptic->hwdata->device);
+ if (FAILED(ret)) {
+ DI_SetError("Acquiring DirectInput device", ret);
+ goto acquire_err;
+ }
+ }
+
+ /* Get number of axes. */
+ ret = IDirectInputDevice8_EnumObjects(haptic->hwdata->device,
+ DI_DeviceObjectCallback,
+ haptic, DIDFT_AXIS);
+ if (FAILED(ret)) {
+ DI_SetError("Getting device axes", ret);
+ goto acquire_err;
+ }
+
+ /* Reset all actuators - just in case. */
+ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
+ DISFFC_RESET);
+ if (FAILED(ret)) {
+ DI_SetError("Resetting device", ret);
+ goto acquire_err;
+ }
+
+ /* Enabling actuators. */
+ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
+ DISFFC_SETACTUATORSON);
+ if (FAILED(ret)) {
+ DI_SetError("Enabling actuators", ret);
+ goto acquire_err;
+ }
+
+ /* Get supported effects. */
+ ret = IDirectInputDevice8_EnumEffects(haptic->hwdata->device,
+ DI_EffectCallback, haptic,
+ DIEFT_ALL);
+ if (FAILED(ret)) {
+ DI_SetError("Enumerating supported effects", ret);
+ goto acquire_err;
+ }
+ if (haptic->supported == 0) { /* Error since device supports nothing. */
+ SDL_SetError("Haptic: Internal error on finding supported effects.");
+ goto acquire_err;
+ }
+
+ /* Check autogain and autocenter. */
+ dipdw.diph.dwSize = sizeof(DIPROPDWORD);
+ dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = 10000;
+ ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device,
+ DIPROP_FFGAIN, &dipdw.diph);
+ if (!FAILED(ret)) { /* Gain is supported. */
+ haptic->supported |= SDL_HAPTIC_GAIN;
+ }
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = DIPROPAUTOCENTER_OFF;
+ ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device,
+ DIPROP_AUTOCENTER, &dipdw.diph);
+ if (!FAILED(ret)) { /* Autocenter is supported. */
+ haptic->supported |= SDL_HAPTIC_AUTOCENTER;
+ }
+
+ /* Status is always supported. */
+ haptic->supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE;
+
+ /* Check maximum effects. */
+ haptic->neffects = 128; /* This is not actually supported as thus under windows,
+ there is no way to tell the number of EFFECTS that a
+ device can hold, so we'll just use a "random" number
+ instead and put warnings in SDL_haptic.h */
+ haptic->nplaying = 128; /* Even more impossible to get this then neffects. */
+
+ /* Prepare effects memory. */
+ haptic->effects = (struct haptic_effect *)
+ SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
+ if (haptic->effects == NULL) {
+ SDL_OutOfMemory();
+ goto acquire_err;
+ }
+ /* Clear the memory */
+ SDL_memset(haptic->effects, 0,
+ sizeof(struct haptic_effect) * haptic->neffects);
+
+ return 0;
+
+ /* Error handling */
+ acquire_err:
+ IDirectInputDevice8_Unacquire(haptic->hwdata->device);
+ return -1;
+}
+
+int
+SDL_DINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
+{
+ HRESULT ret;
+ LPDIRECTINPUTDEVICE8 device;
+ LPDIRECTINPUTDEVICE8 device8;
+
+ /* Open the device */
+ ret = IDirectInput8_CreateDevice(dinput, &item->instance.guidInstance,
+ &device, NULL);
+ if (FAILED(ret)) {
+ DI_SetError("Creating DirectInput device", ret);
+ return -1;
+ }
+
+ /* Now get the IDirectInputDevice8 interface, instead. */
+ ret = IDirectInputDevice8_QueryInterface(device,
+ &IID_IDirectInputDevice8,
+ (LPVOID *)&device8);
+ /* Done with the temporary one now. */
+ IDirectInputDevice8_Release(device);
+ if (FAILED(ret)) {
+ DI_SetError("Querying DirectInput interface", ret);
+ return -1;
+ }
+
+ if (SDL_DINPUT_HapticOpenFromDevice(haptic, device8, SDL_FALSE) < 0) {
+ IDirectInputDevice8_Release(device8);
+ return -1;
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ HRESULT ret;
+ DIDEVICEINSTANCE hap_instance, joy_instance;
+
+ hap_instance.dwSize = sizeof(DIDEVICEINSTANCE);
+ joy_instance.dwSize = sizeof(DIDEVICEINSTANCE);
+
+ /* Get the device instances. */
+ ret = IDirectInputDevice8_GetDeviceInfo(haptic->hwdata->device,
+ &hap_instance);
+ if (FAILED(ret)) {
+ return 0;
+ }
+ ret = IDirectInputDevice8_GetDeviceInfo(joystick->hwdata->InputDevice,
+ &joy_instance);
+ if (FAILED(ret)) {
+ return 0;
+ }
+
+ return WIN_IsEqualGUID(&hap_instance.guidInstance, &joy_instance.guidInstance);
+}
+
+int
+SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ SDL_hapticlist_item *item;
+ int index = 0;
+ HRESULT ret;
+ DIDEVICEINSTANCE joy_instance;
+
+ joy_instance.dwSize = sizeof(DIDEVICEINSTANCE);
+ ret = IDirectInputDevice8_GetDeviceInfo(joystick->hwdata->InputDevice, &joy_instance);
+ if (FAILED(ret)) {
+ return -1;
+ }
+
+ /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (!item->bXInputHaptic && WIN_IsEqualGUID(&item->instance.guidInstance, &joy_instance.guidInstance)) {
+ haptic->index = index;
+ return SDL_DINPUT_HapticOpenFromDevice(haptic, joystick->hwdata->InputDevice, SDL_TRUE);
+ }
+ ++index;
+ }
+
+ SDL_SetError("Couldn't find joystick in haptic device list");
+ return -1;
+}
+
+void
+SDL_DINPUT_HapticClose(SDL_Haptic * haptic)
+{
+ IDirectInputDevice8_Unacquire(haptic->hwdata->device);
+
+ /* Only release if isn't grabbed by a joystick. */
+ if (haptic->hwdata->is_joystick == 0) {
+ IDirectInputDevice8_Release(haptic->hwdata->device);
+ }
+}
+
+void
+SDL_DINPUT_HapticQuit(void)
+{
+ if (dinput != NULL) {
+ IDirectInput8_Release(dinput);
+ dinput = NULL;
+ }
+
+ if (coinitialized) {
+ WIN_CoUninitialize();
+ coinitialized = SDL_FALSE;
+ }
+}
+
+/*
+ * Converts an SDL trigger button to an DIEFFECT trigger button.
+ */
+static DWORD
+DIGetTriggerButton(Uint16 button)
+{
+ DWORD dwTriggerButton;
+
+ dwTriggerButton = DIEB_NOTRIGGER;
+
+ if (button != 0) {
+ dwTriggerButton = DIJOFS_BUTTON(button - 1);
+ }
+
+ return dwTriggerButton;
+}
+
+
+/*
+ * Sets the direction.
+ */
+static int
+SDL_SYS_SetDirection(DIEFFECT * effect, SDL_HapticDirection * dir, int naxes)
+{
+ LONG *rglDir;
+
+ /* Handle no axes a part. */
+ if (naxes == 0) {
+ effect->dwFlags |= DIEFF_SPHERICAL; /* Set as default. */
+ effect->rglDirection = NULL;
+ return 0;
+ }
+
+ /* Has axes. */
+ rglDir = SDL_malloc(sizeof(LONG) * naxes);
+ if (rglDir == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(rglDir, 0, sizeof(LONG) * naxes);
+ effect->rglDirection = rglDir;
+
+ switch (dir->type) {
+ case SDL_HAPTIC_POLAR:
+ effect->dwFlags |= DIEFF_POLAR;
+ rglDir[0] = dir->dir[0];
+ return 0;
+ case SDL_HAPTIC_CARTESIAN:
+ effect->dwFlags |= DIEFF_CARTESIAN;
+ rglDir[0] = dir->dir[0];
+ if (naxes > 1)
+ rglDir[1] = dir->dir[1];
+ if (naxes > 2)
+ rglDir[2] = dir->dir[2];
+ return 0;
+ case SDL_HAPTIC_SPHERICAL:
+ effect->dwFlags |= DIEFF_SPHERICAL;
+ rglDir[0] = dir->dir[0];
+ if (naxes > 1)
+ rglDir[1] = dir->dir[1];
+ if (naxes > 2)
+ rglDir[2] = dir->dir[2];
+ return 0;
+
+ default:
+ return SDL_SetError("Haptic: Unknown direction type.");
+ }
+}
+
+/* Clamps and converts. */
+#define CCONVERT(x) (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
+/* Just converts. */
+#define CONVERT(x) (((x)*10000) / 0x7FFF)
+/*
+ * Creates the DIEFFECT from a SDL_HapticEffect.
+ */
+static int
+SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest,
+ SDL_HapticEffect * src)
+{
+ int i;
+ DICONSTANTFORCE *constant;
+ DIPERIODIC *periodic;
+ DICONDITION *condition; /* Actually an array of conditions - one per axis. */
+ DIRAMPFORCE *ramp;
+ DICUSTOMFORCE *custom;
+ DIENVELOPE *envelope;
+ SDL_HapticConstant *hap_constant;
+ SDL_HapticPeriodic *hap_periodic;
+ SDL_HapticCondition *hap_condition;
+ SDL_HapticRamp *hap_ramp;
+ SDL_HapticCustom *hap_custom;
+ DWORD *axes;
+
+ /* Set global stuff. */
+ SDL_memset(dest, 0, sizeof(DIEFFECT));
+ dest->dwSize = sizeof(DIEFFECT); /* Set the structure size. */
+ dest->dwSamplePeriod = 0; /* Not used by us. */
+ dest->dwGain = 10000; /* Gain is set globally, not locally. */
+ dest->dwFlags = DIEFF_OBJECTOFFSETS; /* Seems obligatory. */
+
+ /* Envelope. */
+ envelope = SDL_malloc(sizeof(DIENVELOPE));
+ if (envelope == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(envelope, 0, sizeof(DIENVELOPE));
+ dest->lpEnvelope = envelope;
+ envelope->dwSize = sizeof(DIENVELOPE); /* Always should be this. */
+
+ /* Axes. */
+ dest->cAxes = haptic->naxes;
+ if (dest->cAxes > 0) {
+ axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
+ if (axes == NULL) {
+ return SDL_OutOfMemory();
+ }
+ axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */
+ if (dest->cAxes > 1) {
+ axes[1] = haptic->hwdata->axes[1];
+ }
+ if (dest->cAxes > 2) {
+ axes[2] = haptic->hwdata->axes[2];
+ }
+ dest->rgdwAxes = axes;
+ }
+
+ /* The big type handling switch, even bigger than Linux's version. */
+ switch (src->type) {
+ case SDL_HAPTIC_CONSTANT:
+ hap_constant = &src->constant;
+ constant = SDL_malloc(sizeof(DICONSTANTFORCE));
+ if (constant == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(constant, 0, sizeof(DICONSTANTFORCE));
+
+ /* Specifics */
+ constant->lMagnitude = CONVERT(hap_constant->level);
+ dest->cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
+ dest->lpvTypeSpecificParams = constant;
+
+ /* Generics */
+ dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = DIGetTriggerButton(hap_constant->button);
+ dest->dwTriggerRepeatInterval = hap_constant->interval;
+ dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_constant->direction, dest->cAxes) < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_constant->attack_length == 0)
+ && (hap_constant->fade_length == 0)) {
+ SDL_free(dest->lpEnvelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_constant->attack_level);
+ envelope->dwAttackTime = hap_constant->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_constant->fade_level);
+ envelope->dwFadeTime = hap_constant->fade_length * 1000;
+ }
+
+ break;
+
+ case SDL_HAPTIC_SINE:
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* case SDL_HAPTIC_SQUARE: */
+ case SDL_HAPTIC_TRIANGLE:
+ case SDL_HAPTIC_SAWTOOTHUP:
+ case SDL_HAPTIC_SAWTOOTHDOWN:
+ hap_periodic = &src->periodic;
+ periodic = SDL_malloc(sizeof(DIPERIODIC));
+ if (periodic == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(periodic, 0, sizeof(DIPERIODIC));
+
+ /* Specifics */
+ periodic->dwMagnitude = CONVERT(SDL_abs(hap_periodic->magnitude));
+ periodic->lOffset = CONVERT(hap_periodic->offset);
+ periodic->dwPhase =
+ (hap_periodic->phase + (hap_periodic->magnitude < 0 ? 18000 : 0)) % 36000;
+ periodic->dwPeriod = hap_periodic->period * 1000;
+ dest->cbTypeSpecificParams = sizeof(DIPERIODIC);
+ dest->lpvTypeSpecificParams = periodic;
+
+ /* Generics */
+ dest->dwDuration = hap_periodic->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = DIGetTriggerButton(hap_periodic->button);
+ dest->dwTriggerRepeatInterval = hap_periodic->interval;
+ dest->dwStartDelay = hap_periodic->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_periodic->direction, dest->cAxes)
+ < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_periodic->attack_length == 0)
+ && (hap_periodic->fade_length == 0)) {
+ SDL_free(dest->lpEnvelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_periodic->attack_level);
+ envelope->dwAttackTime = hap_periodic->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_periodic->fade_level);
+ envelope->dwFadeTime = hap_periodic->fade_length * 1000;
+ }
+
+ break;
+
+ case SDL_HAPTIC_SPRING:
+ case SDL_HAPTIC_DAMPER:
+ case SDL_HAPTIC_INERTIA:
+ case SDL_HAPTIC_FRICTION:
+ hap_condition = &src->condition;
+ condition = SDL_malloc(sizeof(DICONDITION) * dest->cAxes);
+ if (condition == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(condition, 0, sizeof(DICONDITION));
+
+ /* Specifics */
+ for (i = 0; i < (int) dest->cAxes; i++) {
+ condition[i].lOffset = CONVERT(hap_condition->center[i]);
+ condition[i].lPositiveCoefficient =
+ CONVERT(hap_condition->right_coeff[i]);
+ condition[i].lNegativeCoefficient =
+ CONVERT(hap_condition->left_coeff[i]);
+ condition[i].dwPositiveSaturation =
+ CCONVERT(hap_condition->right_sat[i] / 2);
+ condition[i].dwNegativeSaturation =
+ CCONVERT(hap_condition->left_sat[i] / 2);
+ condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i] / 2);
+ }
+ dest->cbTypeSpecificParams = sizeof(DICONDITION) * dest->cAxes;
+ dest->lpvTypeSpecificParams = condition;
+
+ /* Generics */
+ dest->dwDuration = hap_condition->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = DIGetTriggerButton(hap_condition->button);
+ dest->dwTriggerRepeatInterval = hap_condition->interval;
+ dest->dwStartDelay = hap_condition->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_condition->direction, dest->cAxes)
+ < 0) {
+ return -1;
+ }
+
+ /* Envelope - Not actually supported by most CONDITION implementations. */
+ SDL_free(dest->lpEnvelope);
+ dest->lpEnvelope = NULL;
+
+ break;
+
+ case SDL_HAPTIC_RAMP:
+ hap_ramp = &src->ramp;
+ ramp = SDL_malloc(sizeof(DIRAMPFORCE));
+ if (ramp == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(ramp, 0, sizeof(DIRAMPFORCE));
+
+ /* Specifics */
+ ramp->lStart = CONVERT(hap_ramp->start);
+ ramp->lEnd = CONVERT(hap_ramp->end);
+ dest->cbTypeSpecificParams = sizeof(DIRAMPFORCE);
+ dest->lpvTypeSpecificParams = ramp;
+
+ /* Generics */
+ dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = DIGetTriggerButton(hap_ramp->button);
+ dest->dwTriggerRepeatInterval = hap_ramp->interval;
+ dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_ramp->direction, dest->cAxes) < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_ramp->attack_length == 0) && (hap_ramp->fade_length == 0)) {
+ SDL_free(dest->lpEnvelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_ramp->attack_level);
+ envelope->dwAttackTime = hap_ramp->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_ramp->fade_level);
+ envelope->dwFadeTime = hap_ramp->fade_length * 1000;
+ }
+
+ break;
+
+ case SDL_HAPTIC_CUSTOM:
+ hap_custom = &src->custom;
+ custom = SDL_malloc(sizeof(DICUSTOMFORCE));
+ if (custom == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(custom, 0, sizeof(DICUSTOMFORCE));
+
+ /* Specifics */
+ custom->cChannels = hap_custom->channels;
+ custom->dwSamplePeriod = hap_custom->period * 1000;
+ custom->cSamples = hap_custom->samples;
+ custom->rglForceData =
+ SDL_malloc(sizeof(LONG) * custom->cSamples * custom->cChannels);
+ for (i = 0; i < hap_custom->samples * hap_custom->channels; i++) { /* Copy data. */
+ custom->rglForceData[i] = CCONVERT(hap_custom->data[i]);
+ }
+ dest->cbTypeSpecificParams = sizeof(DICUSTOMFORCE);
+ dest->lpvTypeSpecificParams = custom;
+
+ /* Generics */
+ dest->dwDuration = hap_custom->length * 1000; /* In microseconds. */
+ dest->dwTriggerButton = DIGetTriggerButton(hap_custom->button);
+ dest->dwTriggerRepeatInterval = hap_custom->interval;
+ dest->dwStartDelay = hap_custom->delay * 1000; /* In microseconds. */
+
+ /* Direction. */
+ if (SDL_SYS_SetDirection(dest, &hap_custom->direction, dest->cAxes) < 0) {
+ return -1;
+ }
+
+ /* Envelope */
+ if ((hap_custom->attack_length == 0)
+ && (hap_custom->fade_length == 0)) {
+ SDL_free(dest->lpEnvelope);
+ dest->lpEnvelope = NULL;
+ } else {
+ envelope->dwAttackLevel = CCONVERT(hap_custom->attack_level);
+ envelope->dwAttackTime = hap_custom->attack_length * 1000;
+ envelope->dwFadeLevel = CCONVERT(hap_custom->fade_level);
+ envelope->dwFadeTime = hap_custom->fade_length * 1000;
+ }
+
+ break;
+
+ default:
+ return SDL_SetError("Haptic: Unknown effect type.");
+ }
+
+ return 0;
+}
+
+
+/*
+ * Frees an DIEFFECT allocated by SDL_SYS_ToDIEFFECT.
+ */
+static void
+SDL_SYS_HapticFreeDIEFFECT(DIEFFECT * effect, int type)
+{
+ DICUSTOMFORCE *custom;
+
+ SDL_free(effect->lpEnvelope);
+ effect->lpEnvelope = NULL;
+ SDL_free(effect->rgdwAxes);
+ effect->rgdwAxes = NULL;
+ if (effect->lpvTypeSpecificParams != NULL) {
+ if (type == SDL_HAPTIC_CUSTOM) { /* Must free the custom data. */
+ custom = (DICUSTOMFORCE *) effect->lpvTypeSpecificParams;
+ SDL_free(custom->rglForceData);
+ custom->rglForceData = NULL;
+ }
+ SDL_free(effect->lpvTypeSpecificParams);
+ effect->lpvTypeSpecificParams = NULL;
+ }
+ SDL_free(effect->rglDirection);
+ effect->rglDirection = NULL;
+}
+
+/*
+ * Gets the effect type from the generic SDL haptic effect wrapper.
+ */
+static REFGUID
+SDL_SYS_HapticEffectType(SDL_HapticEffect * effect)
+{
+ switch (effect->type) {
+ case SDL_HAPTIC_CONSTANT:
+ return &GUID_ConstantForce;
+
+ case SDL_HAPTIC_RAMP:
+ return &GUID_RampForce;
+
+ /* !!! FIXME: put this back when we have more bits in 2.1 */
+ /* case SDL_HAPTIC_SQUARE:
+ return &GUID_Square; */
+
+ case SDL_HAPTIC_SINE:
+ return &GUID_Sine;
+
+ case SDL_HAPTIC_TRIANGLE:
+ return &GUID_Triangle;
+
+ case SDL_HAPTIC_SAWTOOTHUP:
+ return &GUID_SawtoothUp;
+
+ case SDL_HAPTIC_SAWTOOTHDOWN:
+ return &GUID_SawtoothDown;
+
+ case SDL_HAPTIC_SPRING:
+ return &GUID_Spring;
+
+ case SDL_HAPTIC_DAMPER:
+ return &GUID_Damper;
+
+ case SDL_HAPTIC_INERTIA:
+ return &GUID_Inertia;
+
+ case SDL_HAPTIC_FRICTION:
+ return &GUID_Friction;
+
+ case SDL_HAPTIC_CUSTOM:
+ return &GUID_CustomForce;
+
+ default:
+ return NULL;
+ }
+}
+int
+SDL_DINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
+{
+ HRESULT ret;
+ REFGUID type = SDL_SYS_HapticEffectType(base);
+
+ if (type == NULL) {
+ SDL_SetError("Haptic: Unknown effect type.");
+ return -1;
+ }
+
+ /* Get the effect. */
+ if (SDL_SYS_ToDIEFFECT(haptic, &effect->hweffect->effect, base) < 0) {
+ goto err_effectdone;
+ }
+
+ /* Create the actual effect. */
+ ret = IDirectInputDevice8_CreateEffect(haptic->hwdata->device, type,
+ &effect->hweffect->effect,
+ &effect->hweffect->ref, NULL);
+ if (FAILED(ret)) {
+ DI_SetError("Unable to create effect", ret);
+ goto err_effectdone;
+ }
+
+ return 0;
+
+err_effectdone:
+ SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, base->type);
+ return -1;
+}
+
+int
+SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
+{
+ HRESULT ret;
+ DWORD flags;
+ DIEFFECT temp;
+
+ /* Get the effect. */
+ SDL_memset(&temp, 0, sizeof(DIEFFECT));
+ if (SDL_SYS_ToDIEFFECT(haptic, &temp, data) < 0) {
+ goto err_update;
+ }
+
+ /* Set the flags. Might be worthwhile to diff temp with loaded effect and
+ * only change those parameters. */
+ flags = DIEP_DIRECTION |
+ DIEP_DURATION |
+ DIEP_ENVELOPE |
+ DIEP_STARTDELAY |
+ DIEP_TRIGGERBUTTON |
+ DIEP_TRIGGERREPEATINTERVAL | DIEP_TYPESPECIFICPARAMS;
+
+ /* Create the actual effect. */
+ ret =
+ IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags);
+ if (ret == DIERR_NOTEXCLUSIVEACQUIRED) {
+ IDirectInputDevice8_Unacquire(haptic->hwdata->device);
+ ret = IDirectInputDevice8_SetCooperativeLevel(haptic->hwdata->device, SDL_HelperWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND);
+ if (SUCCEEDED(ret)) {
+ ret = DIERR_NOTACQUIRED;
+ }
+ }
+ if (ret == DIERR_INPUTLOST || ret == DIERR_NOTACQUIRED) {
+ ret = IDirectInputDevice8_Acquire(haptic->hwdata->device);
+ if (SUCCEEDED(ret)) {
+ ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags);
+ }
+ }
+ if (FAILED(ret)) {
+ DI_SetError("Unable to update effect", ret);
+ goto err_update;
+ }
+
+ /* Copy it over. */
+ SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, data->type);
+ SDL_memcpy(&effect->hweffect->effect, &temp, sizeof(DIEFFECT));
+
+ return 0;
+
+err_update:
+ SDL_SYS_HapticFreeDIEFFECT(&temp, data->type);
+ return -1;
+}
+
+int
+SDL_DINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
+{
+ HRESULT ret;
+ DWORD iter;
+
+ /* Check if it's infinite. */
+ if (iterations == SDL_HAPTIC_INFINITY) {
+ iter = INFINITE;
+ } else {
+ iter = iterations;
+ }
+
+ /* Run the effect. */
+ ret = IDirectInputEffect_Start(effect->hweffect->ref, iter, 0);
+ if (FAILED(ret)) {
+ return DI_SetError("Running the effect", ret);
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ HRESULT ret;
+
+ ret = IDirectInputEffect_Stop(effect->hweffect->ref);
+ if (FAILED(ret)) {
+ return DI_SetError("Unable to stop effect", ret);
+ }
+ return 0;
+}
+
+void
+SDL_DINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ HRESULT ret;
+
+ ret = IDirectInputEffect_Unload(effect->hweffect->ref);
+ if (FAILED(ret)) {
+ DI_SetError("Removing effect from the device", ret);
+ }
+ SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, effect->effect.type);
+}
+
+int
+SDL_DINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ HRESULT ret;
+ DWORD status;
+
+ ret = IDirectInputEffect_GetEffectStatus(effect->hweffect->ref, &status);
+ if (FAILED(ret)) {
+ return DI_SetError("Getting effect status", ret);
+ }
+
+ if (status == 0)
+ return SDL_FALSE;
+ return SDL_TRUE;
+}
+
+int
+SDL_DINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ HRESULT ret;
+ DIPROPDWORD dipdw;
+
+ /* Create the weird structure thingy. */
+ dipdw.diph.dwSize = sizeof(DIPROPDWORD);
+ dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = gain * 100; /* 0 to 10,000 */
+
+ /* Try to set the autocenter. */
+ ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device,
+ DIPROP_FFGAIN, &dipdw.diph);
+ if (FAILED(ret)) {
+ return DI_SetError("Setting gain", ret);
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ HRESULT ret;
+ DIPROPDWORD dipdw;
+
+ /* Create the weird structure thingy. */
+ dipdw.diph.dwSize = sizeof(DIPROPDWORD);
+ dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = (autocenter == 0) ? DIPROPAUTOCENTER_OFF :
+ DIPROPAUTOCENTER_ON;
+
+ /* Try to set the autocenter. */
+ ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device,
+ DIPROP_AUTOCENTER, &dipdw.diph);
+ if (FAILED(ret)) {
+ return DI_SetError("Setting autocenter", ret);
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_HapticPause(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+
+ /* Pause the device. */
+ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
+ DISFFC_PAUSE);
+ if (FAILED(ret)) {
+ return DI_SetError("Pausing the device", ret);
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+
+ /* Unpause the device. */
+ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
+ DISFFC_CONTINUE);
+ if (FAILED(ret)) {
+ return DI_SetError("Pausing the device", ret);
+ }
+ return 0;
+}
+
+int
+SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic)
+{
+ HRESULT ret;
+
+ /* Try to stop the effects. */
+ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device,
+ DISFFC_STOPALL);
+ if (FAILED(ret)) {
+ return DI_SetError("Stopping the device", ret);
+ }
+ return 0;
+}
+
+#else /* !SDL_HAPTIC_DINPUT */
+
+typedef struct DIDEVICEINSTANCE DIDEVICEINSTANCE;
+typedef struct SDL_hapticlist_item SDL_hapticlist_item;
+
+int
+SDL_DINPUT_HapticInit(void)
+{
+ return 0;
+}
+
+int
+SDL_DINPUT_MaybeAddDevice(const DIDEVICEINSTANCE * pdidInstance)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_MaybeRemoveDevice(const DIDEVICEINSTANCE * pdidInstance)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return SDL_Unsupported();
+}
+
+void
+SDL_DINPUT_HapticClose(SDL_Haptic * haptic)
+{
+}
+
+void
+SDL_DINPUT_HapticQuit(void)
+{
+}
+
+int
+SDL_DINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return SDL_Unsupported();
+}
+
+void
+SDL_DINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+}
+
+int
+SDL_DINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticPause(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+#endif /* SDL_HAPTIC_DINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h b/src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h
new file mode 100644
index 0000000..81c0ad1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_haptic.h"
+#include "SDL_windowshaptic_c.h"
+
+
+extern int SDL_DINPUT_HapticInit(void);
+extern int SDL_DINPUT_MaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance);
+extern int SDL_DINPUT_MaybeRemoveDevice(const DIDEVICEINSTANCE *pdidInstance);
+extern int SDL_DINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item);
+extern int SDL_DINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick);
+extern int SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick);
+extern void SDL_DINPUT_HapticClose(SDL_Haptic * haptic);
+extern void SDL_DINPUT_HapticQuit(void);
+extern int SDL_DINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base);
+extern int SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data);
+extern int SDL_DINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations);
+extern int SDL_DINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect);
+extern void SDL_DINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect);
+extern int SDL_DINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect);
+extern int SDL_DINPUT_HapticSetGain(SDL_Haptic * haptic, int gain);
+extern int SDL_DINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
+extern int SDL_DINPUT_HapticPause(SDL_Haptic * haptic);
+extern int SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic);
+extern int SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic.c b/src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic.c
new file mode 100644
index 0000000..3d7361d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic.c
@@ -0,0 +1,449 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT
+
+#include "SDL_assert.h"
+#include "SDL_thread.h"
+#include "SDL_mutex.h"
+#include "SDL_timer.h"
+#include "SDL_hints.h"
+#include "SDL_haptic.h"
+#include "../SDL_syshaptic.h"
+#include "SDL_joystick.h"
+#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
+#include "../../joystick/windows/SDL_windowsjoystick_c.h" /* For joystick hwdata */
+#include "../../joystick/windows/SDL_xinputjoystick_c.h" /* For xinput rumble */
+
+#include "SDL_windowshaptic_c.h"
+#include "SDL_dinputhaptic_c.h"
+#include "SDL_xinputhaptic_c.h"
+
+
+/*
+ * Internal stuff.
+ */
+SDL_hapticlist_item *SDL_hapticlist = NULL;
+static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
+static int numhaptics = 0;
+
+
+/*
+ * Initializes the haptic subsystem.
+ */
+int
+SDL_SYS_HapticInit(void)
+{
+ if (SDL_DINPUT_HapticInit() < 0) {
+ return -1;
+ }
+ if (SDL_XINPUT_HapticInit() < 0) {
+ return -1;
+ }
+ return numhaptics;
+}
+
+int
+SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item)
+{
+ if (SDL_hapticlist_tail == NULL) {
+ SDL_hapticlist = SDL_hapticlist_tail = item;
+ } else {
+ SDL_hapticlist_tail->next = item;
+ SDL_hapticlist_tail = item;
+ }
+
+ /* Device has been added. */
+ ++numhaptics;
+
+ return numhaptics;
+}
+
+int
+SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item)
+{
+ const int retval = item->haptic ? item->haptic->index : -1;
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_hapticlist == item);
+ SDL_hapticlist = item->next;
+ }
+ if (item == SDL_hapticlist_tail) {
+ SDL_hapticlist_tail = prev;
+ }
+ --numhaptics;
+ /* !!! TODO: Send a haptic remove event? */
+ SDL_free(item);
+ return retval;
+}
+
+int
+SDL_SYS_NumHaptics(void)
+{
+ return numhaptics;
+}
+
+static SDL_hapticlist_item *
+HapticByDevIndex(int device_index)
+{
+ SDL_hapticlist_item *item = SDL_hapticlist;
+
+ if ((device_index < 0) || (device_index >= numhaptics)) {
+ return NULL;
+ }
+
+ while (device_index > 0) {
+ SDL_assert(item != NULL);
+ --device_index;
+ item = item->next;
+ }
+ return item;
+}
+
+/*
+ * Return the name of a haptic device, does not need to be opened.
+ */
+const char *
+SDL_SYS_HapticName(int index)
+{
+ SDL_hapticlist_item *item = HapticByDevIndex(index);
+ return item->name;
+}
+
+/*
+ * Opens a haptic device for usage.
+ */
+int
+SDL_SYS_HapticOpen(SDL_Haptic * haptic)
+{
+ SDL_hapticlist_item *item = HapticByDevIndex(haptic->index);
+ if (item->bXInputHaptic) {
+ return SDL_XINPUT_HapticOpen(haptic, item);
+ } else {
+ return SDL_DINPUT_HapticOpen(haptic, item);
+ }
+}
+
+
+/*
+ * Opens a haptic device from first mouse it finds for usage.
+ */
+int
+SDL_SYS_HapticMouse(void)
+{
+#if SDL_HAPTIC_DINPUT
+ SDL_hapticlist_item *item;
+ int index = 0;
+
+ /* Grab the first mouse haptic device we find. */
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER ) {
+ return index;
+ }
+ ++index;
+ }
+#endif /* SDL_HAPTIC_DINPUT */
+ return -1;
+}
+
+
+/*
+ * Checks to see if a joystick has haptic features.
+ */
+int
+SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
+{
+ const struct joystick_hwdata *hwdata = joystick->hwdata;
+#if SDL_HAPTIC_XINPUT
+ if (hwdata->bXInputHaptic) {
+ return 1;
+ }
+#endif
+#if SDL_HAPTIC_DINPUT
+ if (hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
+ return 1;
+ }
+#endif
+ return 0;
+}
+
+/*
+ * Checks to see if the haptic device and joystick are in reality the same.
+ */
+int
+SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ if (joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) {
+ return 0; /* one is XInput, one is not; not the same device. */
+ } else if (joystick->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_JoystickSameHaptic(haptic, joystick);
+ } else {
+ return SDL_DINPUT_JoystickSameHaptic(haptic, joystick);
+ }
+}
+
+/*
+ * Opens a SDL_Haptic from a SDL_Joystick.
+ */
+int
+SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ if (joystick->hwdata->bXInputDevice) {
+ return SDL_XINPUT_HapticOpenFromJoystick(haptic, joystick);
+ } else {
+ return SDL_DINPUT_HapticOpenFromJoystick(haptic, joystick);
+ }
+}
+
+/*
+ * Closes the haptic device.
+ */
+void
+SDL_SYS_HapticClose(SDL_Haptic * haptic)
+{
+ if (haptic->hwdata) {
+
+ /* Free effects. */
+ SDL_free(haptic->effects);
+ haptic->effects = NULL;
+ haptic->neffects = 0;
+
+ /* Clean up */
+ if (haptic->hwdata->bXInputHaptic) {
+ SDL_XINPUT_HapticClose(haptic);
+ } else {
+ SDL_DINPUT_HapticClose(haptic);
+ }
+
+ /* Free */
+ SDL_free(haptic->hwdata);
+ haptic->hwdata = NULL;
+ }
+}
+
+/*
+ * Clean up after system specific haptic stuff
+ */
+void
+SDL_SYS_HapticQuit(void)
+{
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *next = NULL;
+ SDL_Haptic *hapticitem = NULL;
+
+ extern SDL_Haptic *SDL_haptics;
+ for (hapticitem = SDL_haptics; hapticitem; hapticitem = hapticitem->next) {
+ if ((hapticitem->hwdata->bXInputHaptic) && (hapticitem->hwdata->thread)) {
+ /* we _have_ to stop the thread before we free the XInput DLL! */
+ SDL_AtomicSet(&hapticitem->hwdata->stopThread, 1);
+ SDL_WaitThread(hapticitem->hwdata->thread, NULL);
+ hapticitem->hwdata->thread = NULL;
+ }
+ }
+
+ for (item = SDL_hapticlist; item; item = next) {
+ /* Opened and not closed haptics are leaked, this is on purpose.
+ * Close your haptic devices after usage. */
+ /* !!! FIXME: (...is leaking on purpose a good idea?) - No, of course not. */
+ next = item->next;
+ SDL_free(item->name);
+ SDL_free(item);
+ }
+
+ SDL_XINPUT_HapticQuit();
+ SDL_DINPUT_HapticQuit();
+
+ numhaptics = 0;
+ SDL_hapticlist = NULL;
+ SDL_hapticlist_tail = NULL;
+}
+
+/*
+ * Creates a new haptic effect.
+ */
+int
+SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ SDL_HapticEffect * base)
+{
+ int result;
+
+ /* Alloc the effect. */
+ effect->hweffect = (struct haptic_hweffect *)
+ SDL_malloc(sizeof(struct haptic_hweffect));
+ if (effect->hweffect == NULL) {
+ SDL_OutOfMemory();
+ return -1;
+ }
+ SDL_zerop(effect->hweffect);
+
+ if (haptic->hwdata->bXInputHaptic) {
+ result = SDL_XINPUT_HapticNewEffect(haptic, effect, base);
+ } else {
+ result = SDL_DINPUT_HapticNewEffect(haptic, effect, base);
+ }
+ if (result < 0) {
+ SDL_free(effect->hweffect);
+ effect->hweffect = NULL;
+ }
+ return result;
+}
+
+/*
+ * Updates an effect.
+ */
+int
+SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
+ struct haptic_effect *effect,
+ SDL_HapticEffect * data)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticUpdateEffect(haptic, effect, data);
+ } else {
+ return SDL_DINPUT_HapticUpdateEffect(haptic, effect, data);
+ }
+}
+
+/*
+ * Runs an effect.
+ */
+int
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
+ Uint32 iterations)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticRunEffect(haptic, effect, iterations);
+ } else {
+ return SDL_DINPUT_HapticRunEffect(haptic, effect, iterations);
+ }
+}
+
+/*
+ * Stops an effect.
+ */
+int
+SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticStopEffect(haptic, effect);
+ } else {
+ return SDL_DINPUT_HapticStopEffect(haptic, effect);
+ }
+}
+
+/*
+ * Frees the effect.
+ */
+void
+SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ SDL_XINPUT_HapticDestroyEffect(haptic, effect);
+ } else {
+ SDL_DINPUT_HapticDestroyEffect(haptic, effect);
+ }
+ SDL_free(effect->hweffect);
+ effect->hweffect = NULL;
+}
+
+/*
+ * Gets the status of a haptic effect.
+ */
+int
+SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
+ struct haptic_effect *effect)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticGetEffectStatus(haptic, effect);
+ } else {
+ return SDL_DINPUT_HapticGetEffectStatus(haptic, effect);
+ }
+}
+
+/*
+ * Sets the gain.
+ */
+int
+SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticSetGain(haptic, gain);
+ } else {
+ return SDL_DINPUT_HapticSetGain(haptic, gain);
+ }
+}
+
+/*
+ * Sets the autocentering.
+ */
+int
+SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticSetAutocenter(haptic, autocenter);
+ } else {
+ return SDL_DINPUT_HapticSetAutocenter(haptic, autocenter);
+ }
+}
+
+/*
+ * Pauses the device.
+ */
+int
+SDL_SYS_HapticPause(SDL_Haptic * haptic)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticPause(haptic);
+ } else {
+ return SDL_DINPUT_HapticPause(haptic);
+ }
+}
+
+/*
+ * Pauses the device.
+ */
+int
+SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticUnpause(haptic);
+ } else {
+ return SDL_DINPUT_HapticUnpause(haptic);
+ }
+}
+
+/*
+ * Stops all the playing effects on the device.
+ */
+int
+SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
+{
+ if (haptic->hwdata->bXInputHaptic) {
+ return SDL_XINPUT_HapticStopAll(haptic);
+ } else {
+ return SDL_DINPUT_HapticStopAll(haptic);
+ }
+}
+
+#endif /* SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic_c.h b/src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic_c.h
new file mode 100644
index 0000000..256ffbf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/windows/SDL_windowshaptic_c.h
@@ -0,0 +1,88 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowshaptic_c_h_
+#define SDL_windowshaptic_c_h_
+
+#include "SDL_thread.h"
+#include "../SDL_syshaptic.h"
+#include "../../core/windows/SDL_directx.h"
+#include "../../core/windows/SDL_xinput.h"
+
+/*
+ * Haptic system hardware data.
+ */
+struct haptic_hwdata
+{
+#if SDL_HAPTIC_DINPUT
+ LPDIRECTINPUTDEVICE8 device;
+#endif
+ DWORD axes[3]; /* Axes to use. */
+ SDL_bool is_joystick; /* Device is loaded as joystick. */
+ Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
+ Uint8 userid; /* XInput userid index for this joystick */
+ SDL_Thread *thread;
+ SDL_mutex *mutex;
+ Uint32 stopTicks;
+ SDL_atomic_t stopThread;
+};
+
+
+/*
+ * Haptic system effect data.
+ */
+struct haptic_hweffect
+{
+#if SDL_HAPTIC_DINPUT
+ DIEFFECT effect;
+ LPDIRECTINPUTEFFECT ref;
+#endif
+#if SDL_HAPTIC_XINPUT
+ XINPUT_VIBRATION vibration;
+#endif
+};
+
+/*
+* List of available haptic devices.
+*/
+typedef struct SDL_hapticlist_item
+{
+ char *name;
+ SDL_Haptic *haptic;
+#if SDL_HAPTIC_DINPUT
+ DIDEVICEINSTANCE instance;
+ DIDEVCAPS capabilities;
+#endif
+ SDL_bool bXInputHaptic; /* Supports force feedback via XInput. */
+ Uint8 userid; /* XInput userid index for this joystick */
+ struct SDL_hapticlist_item *next;
+} SDL_hapticlist_item;
+
+extern SDL_hapticlist_item *SDL_hapticlist;
+
+extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item);
+extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item);
+
+#endif /* SDL_windowshaptic_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic.c b/src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic.c
new file mode 100644
index 0000000..53e7ad3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic.c
@@ -0,0 +1,487 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_error.h"
+#include "SDL_haptic.h"
+#include "../SDL_syshaptic.h"
+
+#if SDL_HAPTIC_XINPUT
+
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_timer.h"
+#include "SDL_windowshaptic_c.h"
+#include "SDL_xinputhaptic_c.h"
+#include "../../core/windows/SDL_xinput.h"
+#include "../../joystick/windows/SDL_windowsjoystick_c.h"
+#include "../../thread/SDL_systhread.h"
+
+/*
+ * Internal stuff.
+ */
+static SDL_bool loaded_xinput = SDL_FALSE;
+
+
+int
+SDL_XINPUT_HapticInit(void)
+{
+ if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) {
+ loaded_xinput = (WIN_LoadXInputDLL() == 0);
+ }
+
+ if (loaded_xinput) {
+ DWORD i;
+ for (i = 0; i < XUSER_MAX_COUNT; i++) {
+ SDL_XINPUT_MaybeAddDevice(i);
+ }
+ }
+ return 0;
+}
+
+int
+SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid)
+{
+ const Uint8 userid = (Uint8)dwUserid;
+ SDL_hapticlist_item *item;
+ XINPUT_VIBRATION state;
+
+ if ((!loaded_xinput) || (dwUserid >= XUSER_MAX_COUNT)) {
+ return -1;
+ }
+
+ /* Make sure we don't already have it */
+ for (item = SDL_hapticlist; item; item = item->next) {
+ if (item->bXInputHaptic && item->userid == userid) {
+ return -1; /* Already added */
+ }
+ }
+
+ SDL_zero(state);
+ if (XINPUTSETSTATE(dwUserid, &state) != ERROR_SUCCESS) {
+ return -1; /* no force feedback on this device. */
+ }
+
+ item = (SDL_hapticlist_item *)SDL_malloc(sizeof(SDL_hapticlist_item));
+ if (item == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_zerop(item);
+
+ /* !!! FIXME: I'm not bothering to query for a real name right now (can we even?) */
+ {
+ char buf[64];
+ SDL_snprintf(buf, sizeof(buf), "XInput Controller #%u", (unsigned int)(userid + 1));
+ item->name = SDL_strdup(buf);
+ }
+
+ if (!item->name) {
+ SDL_free(item);
+ return -1;
+ }
+
+ /* Copy the instance over, useful for creating devices. */
+ item->bXInputHaptic = SDL_TRUE;
+ item->userid = userid;
+
+ return SDL_SYS_AddHapticDevice(item);
+}
+
+int
+SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid)
+{
+ const Uint8 userid = (Uint8)dwUserid;
+ SDL_hapticlist_item *item;
+ SDL_hapticlist_item *prev = NULL;
+
+ if ((!loaded_xinput) || (dwUserid >= XUSER_MAX_COUNT)) {
+ return -1;
+ }
+
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (item->bXInputHaptic && item->userid == userid) {
+ /* found it, remove it. */
+ return SDL_SYS_RemoveHapticDevice(prev, item);
+ }
+ prev = item;
+ }
+ return -1;
+}
+
+/* !!! FIXME: this is a hack, remove this later. */
+/* Since XInput doesn't offer a way to vibrate for X time, we hook into
+ * SDL_PumpEvents() to check if it's time to stop vibrating with some
+ * frequency.
+ * In practice, this works for 99% of use cases. But in an ideal world,
+ * we do this in a separate thread so that:
+ * - we aren't bound to when the app chooses to pump the event queue.
+ * - we aren't adding more polling to the event queue
+ * - we can emulate all the haptic effects correctly (start on a delay,
+ * mix multiple effects, etc).
+ *
+ * Mostly, this is here to get rumbling to work, and all the other features
+ * are absent in the XInput path for now. :(
+ */
+static int SDLCALL
+SDL_RunXInputHaptic(void *arg)
+{
+ struct haptic_hwdata *hwdata = (struct haptic_hwdata *) arg;
+
+ while (!SDL_AtomicGet(&hwdata->stopThread)) {
+ SDL_Delay(50);
+ SDL_LockMutex(hwdata->mutex);
+ /* If we're currently running and need to stop... */
+ if (hwdata->stopTicks) {
+ if ((hwdata->stopTicks != SDL_HAPTIC_INFINITY) && SDL_TICKS_PASSED(SDL_GetTicks(), hwdata->stopTicks)) {
+ XINPUT_VIBRATION vibration = { 0, 0 };
+ hwdata->stopTicks = 0;
+ XINPUTSETSTATE(hwdata->userid, &vibration);
+ }
+ }
+ SDL_UnlockMutex(hwdata->mutex);
+ }
+
+ return 0;
+}
+
+static int
+SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 userid)
+{
+ char threadName[32];
+ XINPUT_VIBRATION vibration = { 0, 0 }; /* stop any current vibration */
+ XINPUTSETSTATE(userid, &vibration);
+
+ haptic->supported = SDL_HAPTIC_LEFTRIGHT;
+
+ haptic->neffects = 1;
+ haptic->nplaying = 1;
+
+ /* Prepare effects memory. */
+ haptic->effects = (struct haptic_effect *)
+ SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
+ if (haptic->effects == NULL) {
+ return SDL_OutOfMemory();
+ }
+ /* Clear the memory */
+ SDL_memset(haptic->effects, 0,
+ sizeof(struct haptic_effect) * haptic->neffects);
+
+ haptic->hwdata = (struct haptic_hwdata *) SDL_malloc(sizeof(*haptic->hwdata));
+ if (haptic->hwdata == NULL) {
+ SDL_free(haptic->effects);
+ haptic->effects = NULL;
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
+
+ haptic->hwdata->bXInputHaptic = 1;
+ haptic->hwdata->userid = userid;
+
+ haptic->hwdata->mutex = SDL_CreateMutex();
+ if (haptic->hwdata->mutex == NULL) {
+ SDL_free(haptic->effects);
+ SDL_free(haptic->hwdata);
+ haptic->effects = NULL;
+ return SDL_SetError("Couldn't create XInput haptic mutex");
+ }
+
+ SDL_snprintf(threadName, sizeof(threadName), "SDLXInputDev%d", (int)userid);
+ haptic->hwdata->thread = SDL_CreateThreadInternal(SDL_RunXInputHaptic, threadName, 64 * 1024, haptic->hwdata);
+
+ if (haptic->hwdata->thread == NULL) {
+ SDL_DestroyMutex(haptic->hwdata->mutex);
+ SDL_free(haptic->effects);
+ SDL_free(haptic->hwdata);
+ haptic->effects = NULL;
+ return SDL_SetError("Couldn't create XInput haptic thread");
+ }
+
+ return 0;
+}
+
+int
+SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
+{
+ return SDL_XINPUT_HapticOpenFromUserIndex(haptic, item->userid);
+}
+
+int
+SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return (haptic->hwdata->userid == joystick->hwdata->userid);
+}
+
+int
+SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ SDL_hapticlist_item *item;
+ int index = 0;
+
+ /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */
+ for (item = SDL_hapticlist; item != NULL; item = item->next) {
+ if (item->bXInputHaptic && item->userid == joystick->hwdata->userid) {
+ haptic->index = index;
+ return SDL_XINPUT_HapticOpenFromUserIndex(haptic, joystick->hwdata->userid);
+ }
+ ++index;
+ }
+
+ SDL_SetError("Couldn't find joystick in haptic device list");
+ return -1;
+}
+
+void
+SDL_XINPUT_HapticClose(SDL_Haptic * haptic)
+{
+ SDL_AtomicSet(&haptic->hwdata->stopThread, 1);
+ SDL_WaitThread(haptic->hwdata->thread, NULL);
+ SDL_DestroyMutex(haptic->hwdata->mutex);
+}
+
+void
+SDL_XINPUT_HapticQuit(void)
+{
+ if (loaded_xinput) {
+ WIN_UnloadXInputDLL();
+ loaded_xinput = SDL_FALSE;
+ }
+}
+
+int
+SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
+{
+ SDL_assert(base->type == SDL_HAPTIC_LEFTRIGHT); /* should catch this at higher level */
+ return SDL_XINPUT_HapticUpdateEffect(haptic, effect, base);
+}
+
+int
+SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
+{
+ XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
+ SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT);
+ /* SDL_HapticEffect has max magnitude of 32767, XInput expects 65535 max, so multiply */
+ vib->wLeftMotorSpeed = data->leftright.large_magnitude * 2;
+ vib->wRightMotorSpeed = data->leftright.small_magnitude * 2;
+ SDL_LockMutex(haptic->hwdata->mutex);
+ if (haptic->hwdata->stopTicks) { /* running right now? Update it. */
+ XINPUTSETSTATE(haptic->hwdata->userid, vib);
+ }
+ SDL_UnlockMutex(haptic->hwdata->mutex);
+ return 0;
+}
+
+int
+SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
+{
+ XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
+ SDL_assert(effect->effect.type == SDL_HAPTIC_LEFTRIGHT); /* should catch this at higher level */
+ SDL_LockMutex(haptic->hwdata->mutex);
+ if (effect->effect.leftright.length == SDL_HAPTIC_INFINITY || iterations == SDL_HAPTIC_INFINITY) {
+ haptic->hwdata->stopTicks = SDL_HAPTIC_INFINITY;
+ } else if ((!effect->effect.leftright.length) || (!iterations)) {
+ /* do nothing. Effect runs for zero milliseconds. */
+ } else {
+ haptic->hwdata->stopTicks = SDL_GetTicks() + (effect->effect.leftright.length * iterations);
+ if ((haptic->hwdata->stopTicks == SDL_HAPTIC_INFINITY) || (haptic->hwdata->stopTicks == 0)) {
+ haptic->hwdata->stopTicks = 1; /* fix edge cases. */
+ }
+ }
+ SDL_UnlockMutex(haptic->hwdata->mutex);
+ return (XINPUTSETSTATE(haptic->hwdata->userid, vib) == ERROR_SUCCESS) ? 0 : -1;
+}
+
+int
+SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ XINPUT_VIBRATION vibration = { 0, 0 };
+ SDL_LockMutex(haptic->hwdata->mutex);
+ haptic->hwdata->stopTicks = 0;
+ SDL_UnlockMutex(haptic->hwdata->mutex);
+ return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
+}
+
+void
+SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ SDL_XINPUT_HapticStopEffect(haptic, effect);
+}
+
+int
+SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticPause(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
+{
+ XINPUT_VIBRATION vibration = { 0, 0 };
+ SDL_LockMutex(haptic->hwdata->mutex);
+ haptic->hwdata->stopTicks = 0;
+ SDL_UnlockMutex(haptic->hwdata->mutex);
+ return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
+}
+
+#else /* !SDL_HAPTIC_XINPUT */
+
+#include "../../core/windows/SDL_windows.h"
+
+typedef struct SDL_hapticlist_item SDL_hapticlist_item;
+
+int
+SDL_XINPUT_HapticInit(void)
+{
+ return 0;
+}
+
+int
+SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
+{
+ return SDL_Unsupported();
+}
+
+void
+SDL_XINPUT_HapticClose(SDL_Haptic * haptic)
+{
+}
+
+void
+SDL_XINPUT_HapticQuit(void)
+{
+}
+
+int
+SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return SDL_Unsupported();
+}
+
+void
+SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+}
+
+int
+SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticPause(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+int
+SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
+{
+ return SDL_Unsupported();
+}
+
+#endif /* SDL_HAPTIC_XINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h b/src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h
new file mode 100644
index 0000000..eed029e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_haptic.h"
+#include "SDL_windowshaptic_c.h"
+
+
+extern int SDL_XINPUT_HapticInit(void);
+extern int SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid);
+extern int SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid);
+extern int SDL_XINPUT_HapticOpen(SDL_Haptic * haptic, SDL_hapticlist_item *item);
+extern int SDL_XINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick);
+extern int SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick);
+extern void SDL_XINPUT_HapticClose(SDL_Haptic * haptic);
+extern void SDL_XINPUT_HapticQuit(void);
+extern int SDL_XINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base);
+extern int SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * data);
+extern int SDL_XINPUT_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, Uint32 iterations);
+extern int SDL_XINPUT_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect);
+extern void SDL_XINPUT_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect);
+extern int SDL_XINPUT_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect *effect);
+extern int SDL_XINPUT_HapticSetGain(SDL_Haptic * haptic, int gain);
+extern int SDL_XINPUT_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
+extern int SDL_XINPUT_HapticPause(SDL_Haptic * haptic);
+extern int SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic);
+extern int SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/SDL_gamecontroller.c b/src/3rdparty/SDL2/src/joystick/SDL_gamecontroller.c
new file mode 100644
index 0000000..b0f833a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/SDL_gamecontroller.c
@@ -0,0 +1,1871 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* This is the game controller API for Simple DirectMedia Layer */
+
+#include "SDL_events.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_sysjoystick.h"
+#include "SDL_joystick_c.h"
+#include "SDL_gamecontrollerdb.h"
+
+#if !SDL_EVENTS_DISABLED
+#include "../events/SDL_events_c.h"
+#endif
+
+#if defined(__ANDROID__)
+#include "SDL_system.h"
+#endif
+
+
+#define SDL_CONTROLLER_PLATFORM_FIELD "platform:"
+
+/* a list of currently opened game controllers */
+static SDL_GameController *SDL_gamecontrollers = NULL;
+
+typedef struct
+{
+ SDL_GameControllerBindType inputType;
+ union
+ {
+ int button;
+
+ struct {
+ int axis;
+ int axis_min;
+ int axis_max;
+ } axis;
+
+ struct {
+ int hat;
+ int hat_mask;
+ } hat;
+
+ } input;
+
+ SDL_GameControllerBindType outputType;
+ union
+ {
+ SDL_GameControllerButton button;
+
+ struct {
+ SDL_GameControllerAxis axis;
+ int axis_min;
+ int axis_max;
+ } axis;
+
+ } output;
+
+} SDL_ExtendedGameControllerBind;
+
+/* our hard coded list of mapping support */
+typedef enum
+{
+ SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT,
+ SDL_CONTROLLER_MAPPING_PRIORITY_API,
+ SDL_CONTROLLER_MAPPING_PRIORITY_USER,
+} SDL_ControllerMappingPriority;
+
+typedef struct _ControllerMapping_t
+{
+ SDL_JoystickGUID guid;
+ char *name;
+ char *mapping;
+ SDL_ControllerMappingPriority priority;
+ struct _ControllerMapping_t *next;
+} ControllerMapping_t;
+
+static SDL_JoystickGUID s_zeroGUID;
+static ControllerMapping_t *s_pSupportedControllers = NULL;
+static ControllerMapping_t *s_pXInputMapping = NULL;
+static ControllerMapping_t *s_pEmscriptenMapping = NULL;
+
+/* The SDL game controller structure */
+struct _SDL_GameController
+{
+ SDL_Joystick *joystick; /* underlying joystick device */
+ int ref_count;
+
+ SDL_JoystickGUID guid;
+ const char *name;
+ int num_bindings;
+ SDL_ExtendedGameControllerBind *bindings;
+ SDL_ExtendedGameControllerBind **last_match_axis;
+ Uint8 *last_hat_mask;
+
+ struct _SDL_GameController *next; /* pointer to next game controller we have allocated */
+};
+
+
+typedef struct
+{
+ int num_entries;
+ int max_entries;
+ Uint32 *entries;
+} SDL_vidpid_list;
+
+static SDL_vidpid_list SDL_allowed_controllers;
+static SDL_vidpid_list SDL_ignored_controllers;
+
+static void
+SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list)
+{
+ Uint32 entry;
+ char *spot;
+ char *file = NULL;
+
+ list->num_entries = 0;
+
+ if (hint && *hint == '@') {
+ spot = file = (char *)SDL_LoadFile(hint+1, NULL);
+ } else {
+ spot = (char *)hint;
+ }
+
+ if (!spot) {
+ return;
+ }
+
+ while ((spot = SDL_strstr(spot, "0x")) != NULL) {
+ entry = (Uint16)SDL_strtol(spot, &spot, 0);
+ entry <<= 16;
+ spot = SDL_strstr(spot, "0x");
+ if (!spot) {
+ break;
+ }
+ entry |= (Uint16)SDL_strtol(spot, &spot, 0);
+
+ if (list->num_entries == list->max_entries) {
+ int max_entries = list->max_entries + 16;
+ Uint32 *entries = (Uint32 *)SDL_realloc(list->entries, max_entries*sizeof(*list->entries));
+ if (entries == NULL) {
+ /* Out of memory, go with what we have already */
+ break;
+ }
+ list->entries = entries;
+ list->max_entries = max_entries;
+ }
+ list->entries[list->num_entries++] = entry;
+ }
+
+ if (file) {
+ SDL_free(file);
+ }
+}
+
+static void SDLCALL
+SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers);
+}
+
+static void SDLCALL
+SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers);
+}
+
+static int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value);
+static int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state);
+
+/*
+ * If there is an existing add event in the queue, it needs to be modified
+ * to have the right value for which, because the number of controllers in
+ * the system is now one less.
+ */
+static void UpdateEventsForDeviceRemoval()
+{
+ int i, num_events;
+ SDL_Event *events;
+
+ num_events = SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEADDED);
+ if (num_events <= 0) {
+ return;
+ }
+
+ events = SDL_stack_alloc(SDL_Event, num_events);
+ if (!events) {
+ return;
+ }
+
+ num_events = SDL_PeepEvents(events, num_events, SDL_GETEVENT, SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEADDED);
+ for (i = 0; i < num_events; ++i) {
+ --events[i].cdevice.which;
+ }
+ SDL_PeepEvents(events, num_events, SDL_ADDEVENT, 0, 0);
+
+ SDL_stack_free(events);
+}
+
+static SDL_bool HasSameOutput(SDL_ExtendedGameControllerBind *a, SDL_ExtendedGameControllerBind *b)
+{
+ if (a->outputType != b->outputType) {
+ return SDL_FALSE;
+ }
+
+ if (a->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ return (a->output.axis.axis == b->output.axis.axis);
+ } else {
+ return (a->output.button == b->output.button);
+ }
+}
+
+static void ResetOutput(SDL_GameController *gamecontroller, SDL_ExtendedGameControllerBind *bind)
+{
+ if (bind->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ SDL_PrivateGameControllerAxis(gamecontroller, bind->output.axis.axis, 0);
+ } else {
+ SDL_PrivateGameControllerButton(gamecontroller, bind->output.button, SDL_RELEASED);
+ }
+}
+
+static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int value)
+{
+ int i;
+ SDL_ExtendedGameControllerBind *last_match = gamecontroller->last_match_axis[axis];
+ SDL_ExtendedGameControllerBind *match = NULL;
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS &&
+ axis == binding->input.axis.axis) {
+ if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
+ if (value >= binding->input.axis.axis_min &&
+ value <= binding->input.axis.axis_max) {
+ match = binding;
+ break;
+ }
+ } else {
+ if (value >= binding->input.axis.axis_max &&
+ value <= binding->input.axis.axis_min) {
+ match = binding;
+ break;
+ }
+ }
+ }
+ }
+
+ if (last_match && (!match || !HasSameOutput(last_match, match))) {
+ /* Clear the last input that this axis generated */
+ ResetOutput(gamecontroller, last_match);
+ }
+
+ if (match) {
+ if (match->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) {
+ float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min);
+ value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min));
+ }
+ SDL_PrivateGameControllerAxis(gamecontroller, match->output.axis.axis, (Sint16)value);
+ } else {
+ Uint8 state;
+ int threshold = match->input.axis.axis_min + (match->input.axis.axis_max - match->input.axis.axis_min) / 2;
+ if (match->input.axis.axis_max < match->input.axis.axis_min) {
+ state = (value <= threshold) ? SDL_PRESSED : SDL_RELEASED;
+ } else {
+ state = (value >= threshold) ? SDL_PRESSED : SDL_RELEASED;
+ }
+ SDL_PrivateGameControllerButton(gamecontroller, match->output.button, state);
+ }
+ }
+ gamecontroller->last_match_axis[axis] = match;
+}
+
+static void HandleJoystickButton(SDL_GameController *gamecontroller, int button, Uint8 state)
+{
+ int i;
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON &&
+ button == binding->input.button) {
+ if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min;
+ SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)value);
+ } else {
+ SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, state);
+ }
+ break;
+ }
+ }
+}
+
+static void HandleJoystickHat(SDL_GameController *gamecontroller, int hat, Uint8 value)
+{
+ int i;
+ Uint8 last_mask = gamecontroller->last_hat_mask[hat];
+ Uint8 changed_mask = (last_mask ^ value);
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT && hat == binding->input.hat.hat) {
+ if ((changed_mask & binding->input.hat.hat_mask) != 0) {
+ if (value & binding->input.hat.hat_mask) {
+ if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max);
+ } else {
+ SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, SDL_PRESSED);
+ }
+ } else {
+ ResetOutput(gamecontroller, binding);
+ }
+ }
+ }
+ }
+ gamecontroller->last_hat_mask[hat] = value;
+}
+
+/*
+ * Event filter to fire controller events from joystick ones
+ */
+static int SDLCALL SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
+{
+ switch(event->type) {
+ case SDL_JOYAXISMOTION:
+ {
+ SDL_GameController *controllerlist = SDL_gamecontrollers;
+ while (controllerlist) {
+ if (controllerlist->joystick->instance_id == event->jaxis.which) {
+ HandleJoystickAxis(controllerlist, event->jaxis.axis, event->jaxis.value);
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ case SDL_JOYBUTTONDOWN:
+ case SDL_JOYBUTTONUP:
+ {
+ SDL_GameController *controllerlist = SDL_gamecontrollers;
+ while (controllerlist) {
+ if (controllerlist->joystick->instance_id == event->jbutton.which) {
+ HandleJoystickButton(controllerlist, event->jbutton.button, event->jbutton.state);
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ case SDL_JOYHATMOTION:
+ {
+ SDL_GameController *controllerlist = SDL_gamecontrollers;
+ while (controllerlist) {
+ if (controllerlist->joystick->instance_id == event->jhat.which) {
+ HandleJoystickHat(controllerlist, event->jhat.hat, event->jhat.value);
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ case SDL_JOYDEVICEADDED:
+ {
+ if (SDL_IsGameController(event->jdevice.which)) {
+ SDL_Event deviceevent;
+ deviceevent.type = SDL_CONTROLLERDEVICEADDED;
+ deviceevent.cdevice.which = event->jdevice.which;
+ SDL_PushEvent(&deviceevent);
+ }
+ }
+ break;
+ case SDL_JOYDEVICEREMOVED:
+ {
+ SDL_GameController *controllerlist = SDL_gamecontrollers;
+ while (controllerlist) {
+ if (controllerlist->joystick->instance_id == event->jdevice.which) {
+ SDL_Event deviceevent;
+
+ deviceevent.type = SDL_CONTROLLERDEVICEREMOVED;
+ deviceevent.cdevice.which = event->jdevice.which;
+ SDL_PushEvent(&deviceevent);
+
+ UpdateEventsForDeviceRemoval();
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+/*
+ * Helper function to scan the mappings database for a controller with the specified GUID
+ */
+static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid)
+{
+ ControllerMapping_t *pSupportedController = s_pSupportedControllers;
+ while (pSupportedController) {
+ if (SDL_memcmp(guid, &pSupportedController->guid, sizeof(*guid)) == 0) {
+ return pSupportedController;
+ }
+ pSupportedController = pSupportedController->next;
+ }
+ return NULL;
+}
+
+static const char* map_StringForControllerAxis[] = {
+ "leftx",
+ "lefty",
+ "rightx",
+ "righty",
+ "lefttrigger",
+ "righttrigger",
+ NULL
+};
+
+/*
+ * convert a string to its enum equivalent
+ */
+SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString)
+{
+ int entry;
+
+ if (pchString && (*pchString == '+' || *pchString == '-')) {
+ ++pchString;
+ }
+
+ if (!pchString || !pchString[0]) {
+ return SDL_CONTROLLER_AXIS_INVALID;
+ }
+
+ for (entry = 0; map_StringForControllerAxis[entry]; ++entry) {
+ if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry]))
+ return (SDL_GameControllerAxis) entry;
+ }
+ return SDL_CONTROLLER_AXIS_INVALID;
+}
+
+/*
+ * convert an enum to its string equivalent
+ */
+const char* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)
+{
+ if (axis > SDL_CONTROLLER_AXIS_INVALID && axis < SDL_CONTROLLER_AXIS_MAX) {
+ return map_StringForControllerAxis[axis];
+ }
+ return NULL;
+}
+
+static const char* map_StringForControllerButton[] = {
+ "a",
+ "b",
+ "x",
+ "y",
+ "back",
+ "guide",
+ "start",
+ "leftstick",
+ "rightstick",
+ "leftshoulder",
+ "rightshoulder",
+ "dpup",
+ "dpdown",
+ "dpleft",
+ "dpright",
+ NULL
+};
+
+/*
+ * convert a string to its enum equivalent
+ */
+SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString)
+{
+ int entry;
+ if (!pchString || !pchString[0])
+ return SDL_CONTROLLER_BUTTON_INVALID;
+
+ for (entry = 0; map_StringForControllerButton[entry]; ++entry) {
+ if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0)
+ return (SDL_GameControllerButton) entry;
+ }
+ return SDL_CONTROLLER_BUTTON_INVALID;
+}
+
+/*
+ * convert an enum to its string equivalent
+ */
+const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis)
+{
+ if (axis > SDL_CONTROLLER_BUTTON_INVALID && axis < SDL_CONTROLLER_BUTTON_MAX) {
+ return map_StringForControllerButton[axis];
+ }
+ return NULL;
+}
+
+/*
+ * given a controller button name and a joystick name update our mapping structure with it
+ */
+static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontroller, const char *szGameButton, const char *szJoystickButton)
+{
+ SDL_ExtendedGameControllerBind bind;
+ SDL_GameControllerButton button;
+ SDL_GameControllerAxis axis;
+ SDL_bool invert_input = SDL_FALSE;
+ char half_axis_input = 0;
+ char half_axis_output = 0;
+
+ if (*szGameButton == '+' || *szGameButton == '-') {
+ half_axis_output = *szGameButton++;
+ }
+
+ axis = SDL_GameControllerGetAxisFromString(szGameButton);
+ button = SDL_GameControllerGetButtonFromString(szGameButton);
+ if (axis != SDL_CONTROLLER_AXIS_INVALID) {
+ bind.outputType = SDL_CONTROLLER_BINDTYPE_AXIS;
+ bind.output.axis.axis = axis;
+ if (axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) {
+ bind.output.axis.axis_min = 0;
+ bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX;
+ } else {
+ if (half_axis_output == '+') {
+ bind.output.axis.axis_min = 0;
+ bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX;
+ } else if (half_axis_output == '-') {
+ bind.output.axis.axis_min = 0;
+ bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MIN;
+ } else {
+ bind.output.axis.axis_min = SDL_JOYSTICK_AXIS_MIN;
+ bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX;
+ }
+ }
+ } else if (button != SDL_CONTROLLER_BUTTON_INVALID) {
+ bind.outputType = SDL_CONTROLLER_BINDTYPE_BUTTON;
+ bind.output.button = button;
+ } else {
+ SDL_SetError("Unexpected controller element %s", szGameButton);
+ return;
+ }
+
+ if (*szJoystickButton == '+' || *szJoystickButton == '-') {
+ half_axis_input = *szJoystickButton++;
+ }
+ if (szJoystickButton[SDL_strlen(szJoystickButton) - 1] == '~') {
+ invert_input = SDL_TRUE;
+ }
+
+ if (szJoystickButton[0] == 'a' && SDL_isdigit(szJoystickButton[1])) {
+ bind.inputType = SDL_CONTROLLER_BINDTYPE_AXIS;
+ bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]);
+ if (half_axis_input == '+') {
+ bind.input.axis.axis_min = 0;
+ bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX;
+ } else if (half_axis_input == '-') {
+ bind.input.axis.axis_min = 0;
+ bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MIN;
+ } else {
+ bind.input.axis.axis_min = SDL_JOYSTICK_AXIS_MIN;
+ bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX;
+ }
+ if (invert_input) {
+ int tmp = bind.input.axis.axis_min;
+ bind.input.axis.axis_min = bind.input.axis.axis_max;
+ bind.input.axis.axis_max = tmp;
+ }
+ } else if (szJoystickButton[0] == 'b' && SDL_isdigit(szJoystickButton[1])) {
+ bind.inputType = SDL_CONTROLLER_BINDTYPE_BUTTON;
+ bind.input.button = SDL_atoi(&szJoystickButton[1]);
+ } else if (szJoystickButton[0] == 'h' && SDL_isdigit(szJoystickButton[1]) &&
+ szJoystickButton[2] == '.' && SDL_isdigit(szJoystickButton[3])) {
+ int hat = SDL_atoi(&szJoystickButton[1]);
+ int mask = SDL_atoi(&szJoystickButton[3]);
+ bind.inputType = SDL_CONTROLLER_BINDTYPE_HAT;
+ bind.input.hat.hat = hat;
+ bind.input.hat.hat_mask = mask;
+ } else {
+ SDL_SetError("Unexpected joystick element: %s", szJoystickButton);
+ return;
+ }
+
+ ++gamecontroller->num_bindings;
+ gamecontroller->bindings = (SDL_ExtendedGameControllerBind *)SDL_realloc(gamecontroller->bindings, gamecontroller->num_bindings * sizeof(*gamecontroller->bindings));
+ if (!gamecontroller->bindings) {
+ gamecontroller->num_bindings = 0;
+ SDL_OutOfMemory();
+ return;
+ }
+ gamecontroller->bindings[gamecontroller->num_bindings - 1] = bind;
+}
+
+
+/*
+ * given a controller mapping string update our mapping object
+ */
+static void
+SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecontroller, const char *pchString)
+{
+ char szGameButton[20];
+ char szJoystickButton[20];
+ SDL_bool bGameButton = SDL_TRUE;
+ int i = 0;
+ const char *pchPos = pchString;
+
+ SDL_zero(szGameButton);
+ SDL_zero(szJoystickButton);
+
+ while (pchPos && *pchPos) {
+ if (*pchPos == ':') {
+ i = 0;
+ bGameButton = SDL_FALSE;
+ } else if (*pchPos == ' ') {
+
+ } else if (*pchPos == ',') {
+ i = 0;
+ bGameButton = SDL_TRUE;
+ SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
+ SDL_zero(szGameButton);
+ SDL_zero(szJoystickButton);
+
+ } else if (bGameButton) {
+ if (i >= sizeof(szGameButton)) {
+ SDL_SetError("Button name too large: %s", szGameButton);
+ return;
+ }
+ szGameButton[i] = *pchPos;
+ i++;
+ } else {
+ if (i >= sizeof(szJoystickButton)) {
+ SDL_SetError("Joystick button name too large: %s", szJoystickButton);
+ return;
+ }
+ szJoystickButton[i] = *pchPos;
+ i++;
+ }
+ pchPos++;
+ }
+
+ SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
+
+}
+
+/*
+ * Make a new button mapping struct
+ */
+static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping)
+{
+ int i;
+
+ gamecontroller->guid = guid;
+ gamecontroller->name = pchName;
+ gamecontroller->num_bindings = 0;
+ SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes * sizeof(*gamecontroller->last_match_axis));
+
+ SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pchMapping);
+
+ /* Set the zero point for triggers */
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS &&
+ binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS &&
+ (binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT ||
+ binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) {
+ if (binding->input.axis.axis < gamecontroller->joystick->naxes) {
+ gamecontroller->joystick->axes[binding->input.axis.axis].value =
+ gamecontroller->joystick->axes[binding->input.axis.axis].zero = (Sint16)binding->input.axis.axis_min;
+ }
+ }
+ }
+}
+
+
+/*
+ * grab the guid string from a mapping string
+ */
+static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
+{
+ const char *pFirstComma = SDL_strchr(pMapping, ',');
+ if (pFirstComma) {
+ char *pchGUID = SDL_malloc(pFirstComma - pMapping + 1);
+ if (!pchGUID) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping);
+ pchGUID[pFirstComma - pMapping] = '\0';
+
+ /* Convert old style GUIDs to the new style in 2.0.5 */
+#if __WIN32__
+ if (SDL_strlen(pchGUID) == 32 &&
+ SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) {
+ SDL_memcpy(&pchGUID[20], "000000000000", 12);
+ SDL_memcpy(&pchGUID[16], &pchGUID[4], 4);
+ SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
+ SDL_memcpy(&pchGUID[0], "03000000", 8);
+ }
+#elif __MACOSX__
+ if (SDL_strlen(pchGUID) == 32 &&
+ SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 &&
+ SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) {
+ SDL_memcpy(&pchGUID[20], "000000000000", 12);
+ SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
+ SDL_memcpy(&pchGUID[0], "03000000", 8);
+ }
+#endif
+ return pchGUID;
+ }
+ return NULL;
+}
+
+
+/*
+ * grab the name string from a mapping string
+ */
+static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
+{
+ const char *pFirstComma, *pSecondComma;
+ char *pchName;
+
+ pFirstComma = SDL_strchr(pMapping, ',');
+ if (!pFirstComma)
+ return NULL;
+
+ pSecondComma = SDL_strchr(pFirstComma + 1, ',');
+ if (!pSecondComma)
+ return NULL;
+
+ pchName = SDL_malloc(pSecondComma - pFirstComma);
+ if (!pchName) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma);
+ pchName[pSecondComma - pFirstComma - 1] = 0;
+ return pchName;
+}
+
+
+/*
+ * grab the button mapping string from a mapping string
+ */
+static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
+{
+ const char *pFirstComma, *pSecondComma;
+
+ pFirstComma = SDL_strchr(pMapping, ',');
+ if (!pFirstComma)
+ return NULL;
+
+ pSecondComma = SDL_strchr(pFirstComma + 1, ',');
+ if (!pSecondComma)
+ return NULL;
+
+ return SDL_strdup(pSecondComma + 1); /* mapping is everything after the 3rd comma */
+}
+
+/*
+ * Helper function to refresh a mapping
+ */
+static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping)
+{
+ SDL_GameController *gamecontrollerlist = SDL_gamecontrollers;
+ while (gamecontrollerlist) {
+ if (!SDL_memcmp(&gamecontrollerlist->guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) {
+ SDL_Event event;
+ event.type = SDL_CONTROLLERDEVICEREMAPPED;
+ event.cdevice.which = gamecontrollerlist->joystick->instance_id;
+ SDL_PushEvent(&event);
+
+ /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */
+ SDL_PrivateLoadButtonMapping(gamecontrollerlist, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping);
+ }
+
+ gamecontrollerlist = gamecontrollerlist->next;
+ }
+}
+
+/*
+ * Helper function to add a mapping for a guid
+ */
+static ControllerMapping_t *
+SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_ControllerMappingPriority priority)
+{
+ char *pchName;
+ char *pchMapping;
+ ControllerMapping_t *pControllerMapping;
+
+ pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString);
+ if (!pchName) {
+ SDL_SetError("Couldn't parse name from %s", mappingString);
+ return NULL;
+ }
+
+ pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString);
+ if (!pchMapping) {
+ SDL_free(pchName);
+ SDL_SetError("Couldn't parse %s", mappingString);
+ return NULL;
+ }
+
+ pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID);
+ if (pControllerMapping) {
+ /* Only overwrite the mapping if the priority is the same or higher. */
+ if (pControllerMapping->priority <= priority) {
+ /* Update existing mapping */
+ SDL_free(pControllerMapping->name);
+ pControllerMapping->name = pchName;
+ SDL_free(pControllerMapping->mapping);
+ pControllerMapping->mapping = pchMapping;
+ pControllerMapping->priority = priority;
+ /* refresh open controllers */
+ SDL_PrivateGameControllerRefreshMapping(pControllerMapping);
+ } else {
+ SDL_free(pchName);
+ SDL_free(pchMapping);
+ }
+ *existing = SDL_TRUE;
+ } else {
+ pControllerMapping = SDL_malloc(sizeof(*pControllerMapping));
+ if (!pControllerMapping) {
+ SDL_free(pchName);
+ SDL_free(pchMapping);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ pControllerMapping->guid = jGUID;
+ pControllerMapping->name = pchName;
+ pControllerMapping->mapping = pchMapping;
+ pControllerMapping->next = NULL;
+ pControllerMapping->priority = priority;
+
+ if (s_pSupportedControllers) {
+ /* Add the mapping to the end of the list */
+ ControllerMapping_t *pCurrMapping, *pPrevMapping;
+
+ for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->next;
+ pCurrMapping;
+ pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->next ) {
+ continue;
+ }
+ pPrevMapping->next = pControllerMapping;
+ } else {
+ s_pSupportedControllers = pControllerMapping;
+ }
+ *existing = SDL_FALSE;
+ }
+ return pControllerMapping;
+}
+
+/*
+ * Helper function to determine pre-calculated offset to certain joystick mappings
+ */
+static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid)
+{
+ ControllerMapping_t *mapping;
+
+ mapping = SDL_PrivateGetControllerMappingForGUID(&guid);
+#if defined(SDL_JOYSTICK_EMSCRIPTEN)
+ if (!mapping && s_pEmscriptenMapping) {
+ mapping = s_pEmscriptenMapping;
+ }
+#else
+ (void) s_pEmscriptenMapping; /* pacify ARMCC */
+#endif
+#ifdef __LINUX__
+ if (!mapping && name) {
+ if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
+ /* The Linux driver xpad.c maps the wireless dpad to buttons */
+ SDL_bool existing;
+ mapping = SDL_PrivateAddMappingForGUID(guid,
+"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ }
+ }
+#endif /* __LINUX__ */
+
+ if (!mapping && name) {
+ if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) {
+ mapping = s_pXInputMapping;
+ }
+ }
+ return mapping;
+}
+
+static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
+{
+ const char *name;
+ SDL_JoystickGUID guid;
+ ControllerMapping_t *mapping;
+
+ SDL_LockJoysticks();
+
+ if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
+ SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
+ SDL_UnlockJoysticks();
+ return (NULL);
+ }
+
+ name = SDL_JoystickNameForIndex(device_index);
+ guid = SDL_JoystickGetDeviceGUID(device_index);
+ mapping = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid);
+#if SDL_JOYSTICK_XINPUT
+ if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) {
+ mapping = s_pXInputMapping;
+ }
+#endif
+#if defined(__ANDROID__)
+ if (!mapping && SDL_SYS_IsDPAD_DeviceIndex(device_index)) {
+ SDL_bool existing;
+ char mapping_string[1024];
+ SDL_snprintf(mapping_string, sizeof(mapping_string), "none,%s,a:b0,b:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,", name);
+ mapping = SDL_PrivateAddMappingForGUID(guid, mapping_string,
+ &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+ }
+#endif /* __ANDROID__ */
+ SDL_UnlockJoysticks();
+ return mapping;
+}
+
+/*
+ * Add or update an entry into the Mappings Database
+ */
+int
+SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw)
+{
+ const char *platform = SDL_GetPlatform();
+ int controllers = 0;
+ char *buf, *line, *line_end, *tmp, *comma, line_platform[64];
+ size_t db_size, platform_len;
+
+ if (rw == NULL) {
+ return SDL_SetError("Invalid RWops");
+ }
+ db_size = (size_t)SDL_RWsize(rw);
+
+ buf = (char *)SDL_malloc(db_size + 1);
+ if (buf == NULL) {
+ if (freerw) {
+ SDL_RWclose(rw);
+ }
+ return SDL_SetError("Could not allocate space to read DB into memory");
+ }
+
+ if (SDL_RWread(rw, buf, db_size, 1) != 1) {
+ if (freerw) {
+ SDL_RWclose(rw);
+ }
+ SDL_free(buf);
+ return SDL_SetError("Could not read DB");
+ }
+
+ if (freerw) {
+ SDL_RWclose(rw);
+ }
+
+ buf[db_size] = '\0';
+ line = buf;
+
+ while (line < buf + db_size) {
+ line_end = SDL_strchr(line, '\n');
+ if (line_end != NULL) {
+ *line_end = '\0';
+ } else {
+ line_end = buf + db_size;
+ }
+
+ /* Extract and verify the platform */
+ tmp = SDL_strstr(line, SDL_CONTROLLER_PLATFORM_FIELD);
+ if (tmp != NULL) {
+ tmp += SDL_strlen(SDL_CONTROLLER_PLATFORM_FIELD);
+ comma = SDL_strchr(tmp, ',');
+ if (comma != NULL) {
+ platform_len = comma - tmp + 1;
+ if (platform_len + 1 < SDL_arraysize(line_platform)) {
+ SDL_strlcpy(line_platform, tmp, platform_len);
+ if (SDL_strncasecmp(line_platform, platform, platform_len) == 0 &&
+ SDL_GameControllerAddMapping(line) > 0) {
+ controllers++;
+ }
+ }
+ }
+ }
+
+ line = line_end + 1;
+ }
+
+ SDL_free(buf);
+ return controllers;
+}
+
+/*
+ * Add or update an entry into the Mappings Database with a priority
+ */
+static int
+SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority)
+{
+ char *pchGUID;
+ SDL_JoystickGUID jGUID;
+ SDL_bool is_xinput_mapping = SDL_FALSE;
+ SDL_bool is_emscripten_mapping = SDL_FALSE;
+ SDL_bool existing = SDL_FALSE;
+ ControllerMapping_t *pControllerMapping;
+
+ if (!mappingString) {
+ return SDL_InvalidParamError("mappingString");
+ }
+
+ pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString);
+ if (!pchGUID) {
+ return SDL_SetError("Couldn't parse GUID from %s", mappingString);
+ }
+ if (!SDL_strcasecmp(pchGUID, "xinput")) {
+ is_xinput_mapping = SDL_TRUE;
+ }
+ if (!SDL_strcasecmp(pchGUID, "emscripten")) {
+ is_emscripten_mapping = SDL_TRUE;
+ }
+ jGUID = SDL_JoystickGetGUIDFromString(pchGUID);
+ SDL_free(pchGUID);
+
+ pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority);
+ if (!pControllerMapping) {
+ return -1;
+ }
+
+ if (existing) {
+ return 0;
+ } else {
+ if (is_xinput_mapping) {
+ s_pXInputMapping = pControllerMapping;
+ }
+ if (is_emscripten_mapping) {
+ s_pEmscriptenMapping = pControllerMapping;
+ }
+ return 1;
+ }
+}
+
+/*
+ * Add or update an entry into the Mappings Database
+ */
+int
+SDL_GameControllerAddMapping(const char *mappingString)
+{
+ return SDL_PrivateGameControllerAddMapping(mappingString, SDL_CONTROLLER_MAPPING_PRIORITY_API);
+}
+
+/*
+ * Get the number of mappings installed
+ */
+int
+SDL_GameControllerNumMappings(void)
+{
+ int num_mappings = 0;
+ ControllerMapping_t *mapping;
+
+ for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) {
+ if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) {
+ continue;
+ }
+ ++num_mappings;
+ }
+ return num_mappings;
+}
+
+/*
+ * Get the mapping at a particular index.
+ */
+char *
+SDL_GameControllerMappingForIndex(int mapping_index)
+{
+ ControllerMapping_t *mapping;
+
+ for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) {
+ if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) {
+ continue;
+ }
+ if (mapping_index == 0) {
+ char *pMappingString;
+ char pchGUID[33];
+ size_t needed;
+
+ SDL_JoystickGetGUIDString(mapping->guid, pchGUID, sizeof(pchGUID));
+ /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */
+ needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1;
+ pMappingString = SDL_malloc(needed);
+ if (!pMappingString) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping);
+ return pMappingString;
+ }
+ --mapping_index;
+ }
+ return NULL;
+}
+
+/*
+ * Get the mapping string for this GUID
+ */
+char *
+SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
+{
+ char *pMappingString = NULL;
+ ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(&guid);
+ if (mapping) {
+ char pchGUID[33];
+ size_t needed;
+ SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID));
+ /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */
+ needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1;
+ pMappingString = SDL_malloc(needed);
+ if (!pMappingString) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping);
+ }
+ return pMappingString;
+}
+
+/*
+ * Get the mapping string for this device
+ */
+char *
+SDL_GameControllerMapping(SDL_GameController * gamecontroller)
+{
+ if (!gamecontroller) {
+ return NULL;
+ }
+
+ return SDL_GameControllerMappingForGUID(gamecontroller->guid);
+}
+
+static void
+SDL_GameControllerLoadHints()
+{
+ const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG);
+ if (hint && hint[0]) {
+ size_t nchHints = SDL_strlen(hint);
+ char *pUserMappings = SDL_malloc(nchHints + 1);
+ char *pTempMappings = pUserMappings;
+ SDL_memcpy(pUserMappings, hint, nchHints);
+ pUserMappings[nchHints] = '\0';
+ while (pUserMappings) {
+ char *pchNewLine = NULL;
+
+ pchNewLine = SDL_strchr(pUserMappings, '\n');
+ if (pchNewLine)
+ *pchNewLine = '\0';
+
+ SDL_PrivateGameControllerAddMapping(pUserMappings, SDL_CONTROLLER_MAPPING_PRIORITY_USER);
+
+ if (pchNewLine) {
+ pUserMappings = pchNewLine + 1;
+ } else {
+ pUserMappings = NULL;
+ }
+ }
+ SDL_free(pTempMappings);
+ }
+}
+
+/*
+ * Fill the given buffer with the expected controller mapping filepath.
+ * Usually this will just be CONTROLLER_MAPPING_FILE, but for Android,
+ * we want to get the internal storage path.
+ */
+static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size)
+{
+#ifdef CONTROLLER_MAPPING_FILE
+#define STRING(X) SDL_STRINGIFY_ARG(X)
+ return SDL_strlcpy(path, STRING(CONTROLLER_MAPPING_FILE), size) < size;
+#elif defined(__ANDROID__)
+ return SDL_snprintf(path, size, "%s/controller_map.txt", SDL_AndroidGetInternalStoragePath()) < size;
+#else
+ return SDL_FALSE;
+#endif
+}
+
+/*
+ * Initialize the game controller system, mostly load our DB of controller config mappings
+ */
+int
+SDL_GameControllerInitMappings(void)
+{
+ char szControllerMapPath[1024];
+ int i = 0;
+ const char *pMappingString = NULL;
+ pMappingString = s_ControllerMappings[i];
+ while (pMappingString) {
+ SDL_PrivateGameControllerAddMapping(pMappingString, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
+
+ i++;
+ pMappingString = s_ControllerMappings[i];
+ }
+
+ if (SDL_GetControllerMappingFilePath(szControllerMapPath, sizeof(szControllerMapPath))) {
+ SDL_GameControllerAddMappingsFromFile(szControllerMapPath);
+ }
+
+ /* load in any user supplied config */
+ SDL_GameControllerLoadHints();
+
+ SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES,
+ SDL_GameControllerIgnoreDevicesChanged, NULL);
+ SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT,
+ SDL_GameControllerIgnoreDevicesExceptChanged, NULL);
+
+ return (0);
+}
+
+int
+SDL_GameControllerInit(void)
+{
+ int i;
+
+ /* watch for joy events and fire controller ones if needed */
+ SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL);
+
+ /* Send added events for controllers currently attached */
+ for (i = 0; i < SDL_NumJoysticks(); ++i) {
+ if (SDL_IsGameController(i)) {
+ SDL_Event deviceevent;
+ deviceevent.type = SDL_CONTROLLERDEVICEADDED;
+ deviceevent.cdevice.which = i;
+ SDL_PushEvent(&deviceevent);
+ }
+ }
+
+ return (0);
+}
+
+
+/*
+ * Get the implementation dependent name of a controller
+ */
+const char *
+SDL_GameControllerNameForIndex(int device_index)
+{
+ ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
+ if (pSupportedController) {
+ return pSupportedController->name;
+ }
+ return NULL;
+}
+
+
+/*
+ * Return 1 if the joystick with this name and GUID is a supported controller
+ */
+SDL_bool
+SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid)
+{
+ ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid);
+ if (pSupportedController) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
+/*
+ * Return 1 if the joystick at this device index is a supported controller
+ */
+SDL_bool
+SDL_IsGameController(int device_index)
+{
+ ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
+ if (pSupportedController) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
+/*
+ * Return 1 if the game controller should be ignored by SDL
+ */
+SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
+{
+ int i;
+ Uint16 vendor;
+ Uint16 product;
+ Uint32 vidpid;
+
+ if (SDL_allowed_controllers.num_entries == 0 &&
+ SDL_ignored_controllers.num_entries == 0) {
+ return SDL_FALSE;
+ }
+
+ SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
+ vidpid = MAKE_VIDPID(vendor, product);
+
+ if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
+ /* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */
+ SDL_bool bSteamVirtualGamepad = SDL_FALSE;
+#if defined(__LINUX__)
+ bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
+#elif defined(__MACOSX__)
+ bSteamVirtualGamepad = (SDL_strncmp(name, "GamePad-", 8) == 0);
+#elif defined(__WIN32__)
+ /* We can't tell on Windows, but Steam will block others in input hooks */
+ bSteamVirtualGamepad = SDL_TRUE;
+#endif
+ if (bSteamVirtualGamepad) {
+ return SDL_FALSE;
+ }
+ }
+
+ if (SDL_allowed_controllers.num_entries > 0) {
+ for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) {
+ if (vidpid == SDL_allowed_controllers.entries[i]) {
+ return SDL_FALSE;
+ }
+ }
+ return SDL_TRUE;
+ } else {
+ for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) {
+ if (vidpid == SDL_ignored_controllers.entries[i]) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+ }
+}
+
+/*
+ * Open a controller for use - the index passed as an argument refers to
+ * the N'th controller on the system. This index is the value which will
+ * identify this controller in future controller events.
+ *
+ * This function returns a controller identifier, or NULL if an error occurred.
+ */
+SDL_GameController *
+SDL_GameControllerOpen(int device_index)
+{
+ SDL_GameController *gamecontroller;
+ SDL_GameController *gamecontrollerlist;
+ ControllerMapping_t *pSupportedController = NULL;
+
+ SDL_LockJoysticks();
+
+ if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
+ SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
+ SDL_UnlockJoysticks();
+ return (NULL);
+ }
+
+ gamecontrollerlist = SDL_gamecontrollers;
+ /* If the controller is already open, return it */
+ while (gamecontrollerlist) {
+ if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id) {
+ gamecontroller = gamecontrollerlist;
+ ++gamecontroller->ref_count;
+ SDL_UnlockJoysticks();
+ return (gamecontroller);
+ }
+ gamecontrollerlist = gamecontrollerlist->next;
+ }
+
+ /* Find a controller mapping */
+ pSupportedController = SDL_PrivateGetControllerMapping(device_index);
+ if (!pSupportedController) {
+ SDL_SetError("Couldn't find mapping for device (%d)", device_index);
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+
+ /* Create and initialize the controller */
+ gamecontroller = (SDL_GameController *) SDL_calloc(1, sizeof(*gamecontroller));
+ if (gamecontroller == NULL) {
+ SDL_OutOfMemory();
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+
+ gamecontroller->joystick = SDL_JoystickOpen(device_index);
+ if (!gamecontroller->joystick) {
+ SDL_free(gamecontroller);
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+
+ if (gamecontroller->joystick->naxes) {
+ gamecontroller->last_match_axis = (SDL_ExtendedGameControllerBind **)SDL_calloc(gamecontroller->joystick->naxes, sizeof(*gamecontroller->last_match_axis));
+ if (!gamecontroller->last_match_axis) {
+ SDL_OutOfMemory();
+ SDL_JoystickClose(gamecontroller->joystick);
+ SDL_free(gamecontroller);
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+ }
+ if (gamecontroller->joystick->nhats) {
+ gamecontroller->last_hat_mask = (Uint8 *)SDL_calloc(gamecontroller->joystick->nhats, sizeof(*gamecontroller->last_hat_mask));
+ if (!gamecontroller->last_hat_mask) {
+ SDL_OutOfMemory();
+ SDL_JoystickClose(gamecontroller->joystick);
+ SDL_free(gamecontroller->last_match_axis);
+ SDL_free(gamecontroller);
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+ }
+
+ SDL_PrivateLoadButtonMapping(gamecontroller, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping);
+
+ /* Add the controller to list */
+ ++gamecontroller->ref_count;
+ /* Link the controller in the list */
+ gamecontroller->next = SDL_gamecontrollers;
+ SDL_gamecontrollers = gamecontroller;
+
+ SDL_UnlockJoysticks();
+
+ return (gamecontroller);
+}
+
+/*
+ * Manually pump for controller updates.
+ */
+void
+SDL_GameControllerUpdate(void)
+{
+ /* Just for API completeness; the joystick API does all the work. */
+ SDL_JoystickUpdate();
+}
+
+/*
+ * Get the current state of an axis control on a controller
+ */
+Sint16
+SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
+{
+ int i;
+
+ if (!gamecontroller)
+ return 0;
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
+ int value = 0;
+ SDL_bool valid_input_range;
+ SDL_bool valid_output_range;
+
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis);
+ if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
+ valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max);
+ } else {
+ valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min);
+ }
+ if (valid_input_range) {
+ if (binding->input.axis.axis_min != binding->output.axis.axis_min || binding->input.axis.axis_max != binding->output.axis.axis_max) {
+ float normalized_value = (float)(value - binding->input.axis.axis_min) / (binding->input.axis.axis_max - binding->input.axis.axis_min);
+ value = binding->output.axis.axis_min + (int)(normalized_value * (binding->output.axis.axis_max - binding->output.axis.axis_min));
+ }
+ }
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
+ value = SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button);
+ if (value == SDL_PRESSED) {
+ value = binding->output.axis.axis_max;
+ }
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
+ int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat);
+ if (hat_mask & binding->input.hat.hat_mask) {
+ value = binding->output.axis.axis_max;
+ }
+ }
+
+ if (binding->output.axis.axis_min < binding->output.axis.axis_max) {
+ valid_output_range = (value >= binding->output.axis.axis_min && value <= binding->output.axis.axis_max);
+ } else {
+ valid_output_range = (value >= binding->output.axis.axis_max && value <= binding->output.axis.axis_min);
+ }
+ /* If the value is zero, there might be another binding that makes it non-zero */
+ if (value != 0 && valid_output_range) {
+ return (Sint16)value;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ * Get the current state of a button on a controller
+ */
+Uint8
+SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
+{
+ int i;
+
+ if (!gamecontroller)
+ return 0;
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) {
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ SDL_bool valid_input_range;
+
+ int value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis);
+ int threshold = binding->input.axis.axis_min + (binding->input.axis.axis_max - binding->input.axis.axis_min) / 2;
+ if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
+ valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max);
+ if (valid_input_range) {
+ return (value >= threshold) ? SDL_PRESSED : SDL_RELEASED;
+ }
+ } else {
+ valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min);
+ if (valid_input_range) {
+ return (value <= threshold) ? SDL_PRESSED : SDL_RELEASED;
+ }
+ }
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
+ return SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button);
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
+ int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat);
+ return (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED;
+ }
+ }
+ }
+ return SDL_RELEASED;
+}
+
+const char *
+SDL_GameControllerName(SDL_GameController * gamecontroller)
+{
+ if (!gamecontroller)
+ return NULL;
+
+ return gamecontroller->name;
+}
+
+Uint16
+SDL_GameControllerGetVendor(SDL_GameController * gamecontroller)
+{
+ return SDL_JoystickGetVendor(SDL_GameControllerGetJoystick(gamecontroller));
+}
+
+Uint16
+SDL_GameControllerGetProduct(SDL_GameController * gamecontroller)
+{
+ return SDL_JoystickGetProduct(SDL_GameControllerGetJoystick(gamecontroller));
+}
+
+Uint16
+SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller)
+{
+ return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller));
+}
+
+/*
+ * Return if the controller in question is currently attached to the system,
+ * \return 0 if not plugged in, 1 if still present.
+ */
+SDL_bool
+SDL_GameControllerGetAttached(SDL_GameController * gamecontroller)
+{
+ if (!gamecontroller)
+ return SDL_FALSE;
+
+ return SDL_JoystickGetAttached(gamecontroller->joystick);
+}
+
+/*
+ * Get the joystick for this controller
+ */
+SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller)
+{
+ if (!gamecontroller)
+ return NULL;
+
+ return gamecontroller->joystick;
+}
+
+
+/*
+ * Find the SDL_GameController that owns this instance id
+ */
+SDL_GameController *
+SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
+{
+ SDL_GameController *gamecontroller;
+
+ SDL_LockJoysticks();
+ gamecontroller = SDL_gamecontrollers;
+ while (gamecontroller) {
+ if (gamecontroller->joystick->instance_id == joyid) {
+ SDL_UnlockJoysticks();
+ return gamecontroller;
+ }
+ gamecontroller = gamecontroller->next;
+ }
+ SDL_UnlockJoysticks();
+ return NULL;
+}
+
+
+/*
+ * Get the SDL joystick layer binding for this controller axis mapping
+ */
+SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
+{
+ int i;
+ SDL_GameControllerButtonBind bind;
+ SDL_zero(bind);
+
+ if (!gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID)
+ return bind;
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
+ bind.bindType = binding->inputType;
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ /* FIXME: There might be multiple axes bound now that we have axis ranges... */
+ bind.value.axis = binding->input.axis.axis;
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
+ bind.value.button = binding->input.button;
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
+ bind.value.hat.hat = binding->input.hat.hat;
+ bind.value.hat.hat_mask = binding->input.hat.hat_mask;
+ }
+ break;
+ }
+ }
+ return bind;
+}
+
+
+/*
+ * Get the SDL joystick layer binding for this controller button mapping
+ */
+SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
+{
+ int i;
+ SDL_GameControllerButtonBind bind;
+ SDL_zero(bind);
+
+ if (!gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID)
+ return bind;
+
+ for (i = 0; i < gamecontroller->num_bindings; ++i) {
+ SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i];
+ if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) {
+ bind.bindType = binding->inputType;
+ if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ bind.value.axis = binding->input.axis.axis;
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
+ bind.value.button = binding->input.button;
+ } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
+ bind.value.hat.hat = binding->input.hat.hat;
+ bind.value.hat.hat_mask = binding->input.hat.hat_mask;
+ }
+ break;
+ }
+ }
+ return bind;
+}
+
+
+void
+SDL_GameControllerClose(SDL_GameController * gamecontroller)
+{
+ SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev;
+
+ if (!gamecontroller)
+ return;
+
+ SDL_LockJoysticks();
+
+ /* First decrement ref count */
+ if (--gamecontroller->ref_count > 0) {
+ SDL_UnlockJoysticks();
+ return;
+ }
+
+ SDL_JoystickClose(gamecontroller->joystick);
+
+ gamecontrollerlist = SDL_gamecontrollers;
+ gamecontrollerlistprev = NULL;
+ while (gamecontrollerlist) {
+ if (gamecontroller == gamecontrollerlist) {
+ if (gamecontrollerlistprev) {
+ /* unlink this entry */
+ gamecontrollerlistprev->next = gamecontrollerlist->next;
+ } else {
+ SDL_gamecontrollers = gamecontroller->next;
+ }
+ break;
+ }
+ gamecontrollerlistprev = gamecontrollerlist;
+ gamecontrollerlist = gamecontrollerlist->next;
+ }
+
+ SDL_free(gamecontroller->bindings);
+ SDL_free(gamecontroller->last_match_axis);
+ SDL_free(gamecontroller->last_hat_mask);
+ SDL_free(gamecontroller);
+
+ SDL_UnlockJoysticks();
+}
+
+
+/*
+ * Quit the controller subsystem
+ */
+void
+SDL_GameControllerQuit(void)
+{
+ SDL_LockJoysticks();
+ while (SDL_gamecontrollers) {
+ SDL_gamecontrollers->ref_count = 1;
+ SDL_GameControllerClose(SDL_gamecontrollers);
+ }
+ SDL_UnlockJoysticks();
+}
+
+void
+SDL_GameControllerQuitMappings(void)
+{
+ ControllerMapping_t *pControllerMap;
+
+ while (s_pSupportedControllers) {
+ pControllerMap = s_pSupportedControllers;
+ s_pSupportedControllers = s_pSupportedControllers->next;
+ SDL_free(pControllerMap->name);
+ SDL_free(pControllerMap->mapping);
+ SDL_free(pControllerMap);
+ }
+
+ SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL);
+
+ SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES,
+ SDL_GameControllerIgnoreDevicesChanged, NULL);
+ SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT,
+ SDL_GameControllerIgnoreDevicesExceptChanged, NULL);
+
+ if (SDL_allowed_controllers.entries) {
+ SDL_free(SDL_allowed_controllers.entries);
+ SDL_zero(SDL_allowed_controllers);
+ }
+ if (SDL_ignored_controllers.entries) {
+ SDL_free(SDL_ignored_controllers.entries);
+ SDL_zero(SDL_ignored_controllers);
+ }
+}
+
+/*
+ * Event filter to transform joystick events into appropriate game controller ones
+ */
+static int
+SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value)
+{
+ int posted;
+
+ /* translate the event, if desired */
+ posted = 0;
+#if !SDL_EVENTS_DISABLED
+ if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = SDL_CONTROLLERAXISMOTION;
+ event.caxis.which = gamecontroller->joystick->instance_id;
+ event.caxis.axis = axis;
+ event.caxis.value = value;
+ posted = SDL_PushEvent(&event) == 1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+ return (posted);
+}
+
+
+/*
+ * Event filter to transform joystick events into appropriate game controller ones
+ */
+static int
+SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state)
+{
+ int posted;
+#if !SDL_EVENTS_DISABLED
+ SDL_Event event;
+
+ if (button == SDL_CONTROLLER_BUTTON_INVALID)
+ return (0);
+
+ switch (state) {
+ case SDL_PRESSED:
+ event.type = SDL_CONTROLLERBUTTONDOWN;
+ break;
+ case SDL_RELEASED:
+ event.type = SDL_CONTROLLERBUTTONUP;
+ break;
+ default:
+ /* Invalid state -- bail */
+ return (0);
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+
+ /* translate the event, if desired */
+ posted = 0;
+#if !SDL_EVENTS_DISABLED
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.cbutton.which = gamecontroller->joystick->instance_id;
+ event.cbutton.button = button;
+ event.cbutton.state = state;
+ posted = SDL_PushEvent(&event) == 1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+ return (posted);
+}
+
+/*
+ * Turn off controller events
+ */
+int
+SDL_GameControllerEventState(int state)
+{
+#if SDL_EVENTS_DISABLED
+ return SDL_IGNORE;
+#else
+ const Uint32 event_list[] = {
+ SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP,
+ SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED,
+ };
+ unsigned int i;
+
+ switch (state) {
+ case SDL_QUERY:
+ state = SDL_IGNORE;
+ for (i = 0; i < SDL_arraysize(event_list); ++i) {
+ state = SDL_EventState(event_list[i], SDL_QUERY);
+ if (state == SDL_ENABLE) {
+ break;
+ }
+ }
+ break;
+ default:
+ for (i = 0; i < SDL_arraysize(event_list); ++i) {
+ SDL_EventState(event_list[i], state);
+ }
+ break;
+ }
+ return (state);
+#endif /* SDL_EVENTS_DISABLED */
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/SDL_gamecontrollerdb.h b/src/3rdparty/SDL2/src/joystick/SDL_gamecontrollerdb.h
new file mode 100644
index 0000000..fdc0b59
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/SDL_gamecontrollerdb.h
@@ -0,0 +1,232 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+
+/* Default mappings we support
+
+ The easiest way to generate a new mapping is to start Steam in Big Picture
+ mode, configure your joystick and then look in config/config.vdf in your
+ Steam installation directory for the "SDL_GamepadBind" entry.
+
+ Alternatively, you can use the app located in test/controllermap
+ */
+static const char *s_ControllerMappings [] =
+{
+#if SDL_JOYSTICK_XINPUT
+ "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+#endif
+#if SDL_JOYSTICK_DINPUT
+ "03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
+ "03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,",
+ "03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
+ "03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
+ "03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+ "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
+ "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+ "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,",
+ "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
+ "03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+ "030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
+ "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,",
+ "03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,",
+ "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+ "03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,",
+ "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+ "030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,",
+ "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,",
+ "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
+ "03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,",
+#endif
+#if defined(__MACOSX__)
+ "03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
+ "03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
+ "03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
+ "03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
+ "030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
+ "03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+ "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,",
+ "030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
+ "030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */
+ "03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+ "030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
+ "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+ "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+ "030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
+ "030000005e0400008e02000001000000,Steam Virtual GamePad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,",
+ "03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,",
+ "03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,",
+ "03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,",
+ "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+ "030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+ "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
+ "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,",
+#endif
+#if defined(__LINUX__)
+ "03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
+ "05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,",
+ "05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
+ "05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,",
+ "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+ "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+ "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
+ "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+ "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
+ "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,",
+ "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+ "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
+ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+ "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
+ "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+ "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
+ "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,",
+ "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,",
+ "030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
+ "030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+ "050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+ "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+ "030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+ "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+ "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,",
+ "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+ "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+ "0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+ "030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,",
+ "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,",
+ "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+ "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+ "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+ "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+ "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+ "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+ "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+ "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
+ "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+ "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,",
+#endif
+#if defined(__ANDROID__)
+ "34323662653333636330306631326233,ASUS Gamepad,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,",
+ "64633436313965656664373634323364,Microsoft X-Box 360 pad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,",
+ "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+ "61363931656135336130663561616264,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+ "37336435666338653565313731303834,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+ "35643031303033326130316330353564,PS4 Controller,a:b1,b:b17,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,",
+ "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+ "34356136633366613530316338376136,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,x:b17,y:b2,",
+#endif
+#if defined(SDL_JOYSTICK_MFI)
+ "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,",
+ "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,",
+ "4d466947616d65706164030000000000,Remote,a:b0,b:b2,leftx:a0,lefty:a1,",
+ "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+#endif
+#if defined(SDL_JOYSTICK_EMSCRIPTEN)
+ "emscripten,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+#endif
+ NULL
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/SDL_joystick.c b/src/3rdparty/SDL2/src/joystick/SDL_joystick.c
new file mode 100644
index 0000000..b93c03d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/SDL_joystick.c
@@ -0,0 +1,1276 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* This is the joystick API for Simple DirectMedia Layer */
+
+#include "SDL.h"
+#include "SDL_events.h"
+#include "SDL_sysjoystick.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+
+#if !SDL_EVENTS_DISABLED
+#include "../events/SDL_events_c.h"
+#endif
+#include "../video/SDL_sysvideo.h"
+
+
+static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE;
+static SDL_Joystick *SDL_joysticks = NULL;
+static SDL_bool SDL_updating_joystick = SDL_FALSE;
+static SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
+
+void
+SDL_LockJoysticks(void)
+{
+ if (SDL_joystick_lock) {
+ SDL_LockMutex(SDL_joystick_lock);
+ }
+}
+
+void
+SDL_UnlockJoysticks(void)
+{
+ if (SDL_joystick_lock) {
+ SDL_UnlockMutex(SDL_joystick_lock);
+ }
+}
+
+
+static void SDLCALL
+SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ if (hint && *hint == '1') {
+ SDL_joystick_allows_background_events = SDL_TRUE;
+ } else {
+ SDL_joystick_allows_background_events = SDL_FALSE;
+ }
+}
+
+int
+SDL_JoystickInit(void)
+{
+ int status;
+
+ SDL_GameControllerInitMappings();
+
+ /* Create the joystick list lock */
+ if (!SDL_joystick_lock) {
+ SDL_joystick_lock = SDL_CreateMutex();
+ }
+
+ /* See if we should allow joystick events while in the background */
+ SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
+ SDL_JoystickAllowBackgroundEventsChanged, NULL);
+
+#if !SDL_EVENTS_DISABLED
+ if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
+ return -1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+
+ status = SDL_SYS_JoystickInit();
+ if (status >= 0) {
+ status = 0;
+ }
+ return (status);
+}
+
+/*
+ * Count the number of joysticks attached to the system
+ */
+int
+SDL_NumJoysticks(void)
+{
+ return SDL_SYS_NumJoysticks();
+}
+
+/*
+ * Get the implementation dependent name of a joystick
+ */
+const char *
+SDL_JoystickNameForIndex(int device_index)
+{
+ if (device_index < 0 || device_index >= SDL_NumJoysticks()) {
+ SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
+ return (NULL);
+ }
+ return (SDL_SYS_JoystickNameForDeviceIndex(device_index));
+}
+
+/*
+ * Return true if this joystick is known to have all axes centered at zero
+ * This isn't generally needed unless the joystick never generates an initial axis value near zero,
+ * e.g. it's emulating axes with digital buttons
+ */
+static SDL_bool
+SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
+{
+ static Uint32 zero_centered_joysticks[] = {
+ MAKE_VIDPID(0x0e8f, 0x3013), /* HuiJia SNES USB adapter */
+ MAKE_VIDPID(0x05a0, 0x3232), /* 8Bitdo Zero Gamepad */
+ };
+
+ int i;
+ Uint32 id = MAKE_VIDPID(SDL_JoystickGetVendor(joystick),
+ SDL_JoystickGetProduct(joystick));
+
+/*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/
+
+ if (joystick->naxes == 2) {
+ /* Assume D-pad or thumbstick style axes are centered at 0 */
+ return SDL_TRUE;
+ }
+
+ for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) {
+ if (id == zero_centered_joysticks[i]) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+/*
+ * Open a joystick for use - the index passed as an argument refers to
+ * the N'th joystick on the system. This index is the value which will
+ * identify this joystick in future joystick events.
+ *
+ * This function returns a joystick identifier, or NULL if an error occurred.
+ */
+SDL_Joystick *
+SDL_JoystickOpen(int device_index)
+{
+ SDL_Joystick *joystick;
+ SDL_Joystick *joysticklist;
+ const char *joystickname = NULL;
+
+ if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
+ SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
+ return (NULL);
+ }
+
+ SDL_LockJoysticks();
+
+ joysticklist = SDL_joysticks;
+ /* If the joystick is already open, return it
+ * it is important that we have a single joystick * for each instance id
+ */
+ while (joysticklist) {
+ if (SDL_JoystickGetDeviceInstanceID(device_index) == joysticklist->instance_id) {
+ joystick = joysticklist;
+ ++joystick->ref_count;
+ SDL_UnlockJoysticks();
+ return (joystick);
+ }
+ joysticklist = joysticklist->next;
+ }
+
+ /* Create and initialize the joystick */
+ joystick = (SDL_Joystick *) SDL_calloc(sizeof(*joystick), 1);
+ if (joystick == NULL) {
+ SDL_OutOfMemory();
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+
+ if (SDL_SYS_JoystickOpen(joystick, device_index) < 0) {
+ SDL_free(joystick);
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+
+ joystickname = SDL_SYS_JoystickNameForDeviceIndex(device_index);
+ if (joystickname)
+ joystick->name = SDL_strdup(joystickname);
+ else
+ joystick->name = NULL;
+
+ if (joystick->naxes > 0) {
+ joystick->axes = (SDL_JoystickAxisInfo *) SDL_calloc(joystick->naxes, sizeof(SDL_JoystickAxisInfo));
+ }
+ if (joystick->nhats > 0) {
+ joystick->hats = (Uint8 *) SDL_calloc(joystick->nhats, sizeof(Uint8));
+ }
+ if (joystick->nballs > 0) {
+ joystick->balls = (struct balldelta *) SDL_calloc(joystick->nballs, sizeof(*joystick->balls));
+ }
+ if (joystick->nbuttons > 0) {
+ joystick->buttons = (Uint8 *) SDL_calloc(joystick->nbuttons, sizeof(Uint8));
+ }
+ if (((joystick->naxes > 0) && !joystick->axes)
+ || ((joystick->nhats > 0) && !joystick->hats)
+ || ((joystick->nballs > 0) && !joystick->balls)
+ || ((joystick->nbuttons > 0) && !joystick->buttons)) {
+ SDL_OutOfMemory();
+ SDL_JoystickClose(joystick);
+ SDL_UnlockJoysticks();
+ return NULL;
+ }
+ joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
+
+ /* If this joystick is known to have all zero centered axes, skip the auto-centering code */
+ if (SDL_JoystickAxesCenteredAtZero(joystick)) {
+ int i;
+
+ for (i = 0; i < joystick->naxes; ++i) {
+ joystick->axes[i].has_initial_value = SDL_TRUE;
+ }
+ }
+
+ joystick->is_game_controller = SDL_IsGameController(device_index);
+
+ /* Add joystick to list */
+ ++joystick->ref_count;
+ /* Link the joystick in the list */
+ joystick->next = SDL_joysticks;
+ SDL_joysticks = joystick;
+
+ SDL_UnlockJoysticks();
+
+ SDL_SYS_JoystickUpdate(joystick);
+
+ return (joystick);
+}
+
+
+/*
+ * Checks to make sure the joystick is valid.
+ */
+int
+SDL_PrivateJoystickValid(SDL_Joystick * joystick)
+{
+ int valid;
+
+ if (joystick == NULL) {
+ SDL_SetError("Joystick hasn't been opened yet");
+ valid = 0;
+ } else {
+ valid = 1;
+ }
+
+ return valid;
+}
+
+/*
+ * Get the number of multi-dimensional axis controls on a joystick
+ */
+int
+SDL_JoystickNumAxes(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (-1);
+ }
+ return (joystick->naxes);
+}
+
+/*
+ * Get the number of hats on a joystick
+ */
+int
+SDL_JoystickNumHats(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (-1);
+ }
+ return (joystick->nhats);
+}
+
+/*
+ * Get the number of trackballs on a joystick
+ */
+int
+SDL_JoystickNumBalls(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (-1);
+ }
+ return (joystick->nballs);
+}
+
+/*
+ * Get the number of buttons on a joystick
+ */
+int
+SDL_JoystickNumButtons(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (-1);
+ }
+ return (joystick->nbuttons);
+}
+
+/*
+ * Get the current state of an axis control on a joystick
+ */
+Sint16
+SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis)
+{
+ Sint16 state;
+
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (0);
+ }
+ if (axis < joystick->naxes) {
+ state = joystick->axes[axis].value;
+ } else {
+ SDL_SetError("Joystick only has %d axes", joystick->naxes);
+ state = 0;
+ }
+ return (state);
+}
+
+/*
+ * Get the initial state of an axis control on a joystick
+ */
+SDL_bool
+SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, int axis, Sint16 *state)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return SDL_FALSE;
+ }
+ if (axis >= joystick->naxes) {
+ SDL_SetError("Joystick only has %d axes", joystick->naxes);
+ return SDL_FALSE;
+ }
+ if (state) {
+ *state = joystick->axes[axis].initial_value;
+ }
+ return joystick->axes[axis].has_initial_value;
+}
+
+/*
+ * Get the current state of a hat on a joystick
+ */
+Uint8
+SDL_JoystickGetHat(SDL_Joystick * joystick, int hat)
+{
+ Uint8 state;
+
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (0);
+ }
+ if (hat < joystick->nhats) {
+ state = joystick->hats[hat];
+ } else {
+ SDL_SetError("Joystick only has %d hats", joystick->nhats);
+ state = 0;
+ }
+ return (state);
+}
+
+/*
+ * Get the ball axis change since the last poll
+ */
+int
+SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy)
+{
+ int retval;
+
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (-1);
+ }
+
+ retval = 0;
+ if (ball < joystick->nballs) {
+ if (dx) {
+ *dx = joystick->balls[ball].dx;
+ }
+ if (dy) {
+ *dy = joystick->balls[ball].dy;
+ }
+ joystick->balls[ball].dx = 0;
+ joystick->balls[ball].dy = 0;
+ } else {
+ return SDL_SetError("Joystick only has %d balls", joystick->nballs);
+ }
+ return (retval);
+}
+
+/*
+ * Get the current state of a button on a joystick
+ */
+Uint8
+SDL_JoystickGetButton(SDL_Joystick * joystick, int button)
+{
+ Uint8 state;
+
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (0);
+ }
+ if (button < joystick->nbuttons) {
+ state = joystick->buttons[button];
+ } else {
+ SDL_SetError("Joystick only has %d buttons", joystick->nbuttons);
+ state = 0;
+ }
+ return (state);
+}
+
+/*
+ * Return if the joystick in question is currently attached to the system,
+ * \return SDL_FALSE if not plugged in, SDL_TRUE if still present.
+ */
+SDL_bool
+SDL_JoystickGetAttached(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return SDL_FALSE;
+ }
+
+ return SDL_SYS_JoystickAttached(joystick);
+}
+
+/*
+ * Get the instance id for this opened joystick
+ */
+SDL_JoystickID
+SDL_JoystickInstanceID(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (-1);
+ }
+
+ return (joystick->instance_id);
+}
+
+/*
+ * Find the SDL_Joystick that owns this instance id
+ */
+SDL_Joystick *
+SDL_JoystickFromInstanceID(SDL_JoystickID joyid)
+{
+ SDL_Joystick *joystick;
+
+ SDL_LockJoysticks();
+ for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
+ if (joystick->instance_id == joyid) {
+ SDL_UnlockJoysticks();
+ return joystick;
+ }
+ }
+ SDL_UnlockJoysticks();
+ return NULL;
+}
+
+/*
+ * Get the friendly name of this joystick
+ */
+const char *
+SDL_JoystickName(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (NULL);
+ }
+
+ return (joystick->name);
+}
+
+/*
+ * Close a joystick previously opened with SDL_JoystickOpen()
+ */
+void
+SDL_JoystickClose(SDL_Joystick * joystick)
+{
+ SDL_Joystick *joysticklist;
+ SDL_Joystick *joysticklistprev;
+
+ if (!joystick) {
+ return;
+ }
+
+ SDL_LockJoysticks();
+
+ /* First decrement ref count */
+ if (--joystick->ref_count > 0) {
+ SDL_UnlockJoysticks();
+ return;
+ }
+
+ if (SDL_updating_joystick) {
+ SDL_UnlockJoysticks();
+ return;
+ }
+
+ SDL_SYS_JoystickClose(joystick);
+ joystick->hwdata = NULL;
+
+ joysticklist = SDL_joysticks;
+ joysticklistprev = NULL;
+ while (joysticklist) {
+ if (joystick == joysticklist) {
+ if (joysticklistprev) {
+ /* unlink this entry */
+ joysticklistprev->next = joysticklist->next;
+ } else {
+ SDL_joysticks = joystick->next;
+ }
+ break;
+ }
+ joysticklistprev = joysticklist;
+ joysticklist = joysticklist->next;
+ }
+
+ SDL_free(joystick->name);
+
+ /* Free the data associated with this joystick */
+ SDL_free(joystick->axes);
+ SDL_free(joystick->hats);
+ SDL_free(joystick->balls);
+ SDL_free(joystick->buttons);
+ SDL_free(joystick);
+
+ SDL_UnlockJoysticks();
+}
+
+void
+SDL_JoystickQuit(void)
+{
+ /* Make sure we're not getting called in the middle of updating joysticks */
+ SDL_assert(!SDL_updating_joystick);
+
+ SDL_LockJoysticks();
+
+ /* Stop the event polling */
+ while (SDL_joysticks) {
+ SDL_joysticks->ref_count = 1;
+ SDL_JoystickClose(SDL_joysticks);
+ }
+
+ /* Quit the joystick setup */
+ SDL_SYS_JoystickQuit();
+
+ SDL_UnlockJoysticks();
+
+#if !SDL_EVENTS_DISABLED
+ SDL_QuitSubSystem(SDL_INIT_EVENTS);
+#endif
+
+ SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
+ SDL_JoystickAllowBackgroundEventsChanged, NULL);
+
+ if (SDL_joystick_lock) {
+ SDL_DestroyMutex(SDL_joystick_lock);
+ SDL_joystick_lock = NULL;
+ }
+
+ SDL_GameControllerQuitMappings();
+}
+
+
+static SDL_bool
+SDL_PrivateJoystickShouldIgnoreEvent()
+{
+ if (SDL_joystick_allows_background_events) {
+ return SDL_FALSE;
+ }
+
+ if (SDL_HasWindows() && SDL_GetKeyboardFocus() == NULL) {
+ /* We have windows but we don't have focus, ignore the event. */
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
+/* These are global for SDL_sysjoystick.c and SDL_events.c */
+
+void SDL_PrivateJoystickAdded(int device_index)
+{
+#if !SDL_EVENTS_DISABLED
+ SDL_Event event;
+
+ event.type = SDL_JOYDEVICEADDED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = device_index;
+ SDL_PushEvent(&event);
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+}
+
+/*
+ * If there is an existing add event in the queue, it needs to be modified
+ * to have the right value for which, because the number of controllers in
+ * the system is now one less.
+ */
+static void UpdateEventsForDeviceRemoval()
+{
+ int i, num_events;
+ SDL_Event *events;
+
+ num_events = SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEADDED);
+ if (num_events <= 0) {
+ return;
+ }
+
+ events = SDL_stack_alloc(SDL_Event, num_events);
+ if (!events) {
+ return;
+ }
+
+ num_events = SDL_PeepEvents(events, num_events, SDL_GETEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEADDED);
+ for (i = 0; i < num_events; ++i) {
+ --events[i].jdevice.which;
+ }
+ SDL_PeepEvents(events, num_events, SDL_ADDEVENT, 0, 0);
+
+ SDL_stack_free(events);
+}
+
+void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
+{
+#if !SDL_EVENTS_DISABLED
+ SDL_Event event;
+
+ event.type = SDL_JOYDEVICEREMOVED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = device_instance;
+ SDL_PushEvent(&event);
+ }
+
+ UpdateEventsForDeviceRemoval();
+#endif /* !SDL_EVENTS_DISABLED */
+}
+
+int
+SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
+{
+ int posted;
+
+ /* Make sure we're not getting garbage or duplicate events */
+ if (axis >= joystick->naxes) {
+ return 0;
+ }
+ if (!joystick->axes[axis].has_initial_value) {
+ joystick->axes[axis].initial_value = value;
+ joystick->axes[axis].value = value;
+ joystick->axes[axis].zero = value;
+ joystick->axes[axis].has_initial_value = SDL_TRUE;
+ }
+ if (value == joystick->axes[axis].value) {
+ return 0;
+ }
+ if (!joystick->axes[axis].sent_initial_value) {
+ /* Make sure we don't send motion until there's real activity on this axis */
+ const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
+ if (SDL_abs(value - joystick->axes[axis].value) <= MAX_ALLOWED_JITTER) {
+ return 0;
+ }
+ joystick->axes[axis].sent_initial_value = SDL_TRUE;
+ joystick->axes[axis].value = value; /* Just so we pass the check above */
+ SDL_PrivateJoystickAxis(joystick, axis, joystick->axes[axis].initial_value);
+ }
+
+ /* We ignore events if we don't have keyboard focus, except for centering
+ * events.
+ */
+ if (SDL_PrivateJoystickShouldIgnoreEvent()) {
+ if ((value > joystick->axes[axis].zero && value >= joystick->axes[axis].value) ||
+ (value < joystick->axes[axis].zero && value <= joystick->axes[axis].value)) {
+ return 0;
+ }
+ }
+
+ /* Update internal joystick state */
+ joystick->axes[axis].value = value;
+
+ /* Post the event, if desired */
+ posted = 0;
+#if !SDL_EVENTS_DISABLED
+ if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) {
+ SDL_Event event;
+ event.type = SDL_JOYAXISMOTION;
+ event.jaxis.which = joystick->instance_id;
+ event.jaxis.axis = axis;
+ event.jaxis.value = value;
+ posted = SDL_PushEvent(&event) == 1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+ return (posted);
+}
+
+int
+SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value)
+{
+ int posted;
+
+ /* Make sure we're not getting garbage or duplicate events */
+ if (hat >= joystick->nhats) {
+ return 0;
+ }
+ if (value == joystick->hats[hat]) {
+ return 0;
+ }
+
+ /* We ignore events if we don't have keyboard focus, except for centering
+ * events.
+ */
+ if (SDL_PrivateJoystickShouldIgnoreEvent()) {
+ if (value != SDL_HAT_CENTERED) {
+ return 0;
+ }
+ }
+
+ /* Update internal joystick state */
+ joystick->hats[hat] = value;
+
+ /* Post the event, if desired */
+ posted = 0;
+#if !SDL_EVENTS_DISABLED
+ if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) {
+ SDL_Event event;
+ event.jhat.type = SDL_JOYHATMOTION;
+ event.jhat.which = joystick->instance_id;
+ event.jhat.hat = hat;
+ event.jhat.value = value;
+ posted = SDL_PushEvent(&event) == 1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+ return (posted);
+}
+
+int
+SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball,
+ Sint16 xrel, Sint16 yrel)
+{
+ int posted;
+
+ /* Make sure we're not getting garbage events */
+ if (ball >= joystick->nballs) {
+ return 0;
+ }
+
+ /* We ignore events if we don't have keyboard focus. */
+ if (SDL_PrivateJoystickShouldIgnoreEvent()) {
+ return 0;
+ }
+
+ /* Update internal mouse state */
+ joystick->balls[ball].dx += xrel;
+ joystick->balls[ball].dy += yrel;
+
+ /* Post the event, if desired */
+ posted = 0;
+#if !SDL_EVENTS_DISABLED
+ if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) {
+ SDL_Event event;
+ event.jball.type = SDL_JOYBALLMOTION;
+ event.jball.which = joystick->instance_id;
+ event.jball.ball = ball;
+ event.jball.xrel = xrel;
+ event.jball.yrel = yrel;
+ posted = SDL_PushEvent(&event) == 1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+ return (posted);
+}
+
+int
+SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)
+{
+ int posted;
+#if !SDL_EVENTS_DISABLED
+ SDL_Event event;
+
+ switch (state) {
+ case SDL_PRESSED:
+ event.type = SDL_JOYBUTTONDOWN;
+ break;
+ case SDL_RELEASED:
+ event.type = SDL_JOYBUTTONUP;
+ break;
+ default:
+ /* Invalid state -- bail */
+ return (0);
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+
+ /* Make sure we're not getting garbage or duplicate events */
+ if (button >= joystick->nbuttons) {
+ return 0;
+ }
+ if (state == joystick->buttons[button]) {
+ return 0;
+ }
+
+ /* We ignore events if we don't have keyboard focus, except for button
+ * release. */
+ if (SDL_PrivateJoystickShouldIgnoreEvent()) {
+ if (state == SDL_PRESSED) {
+ return 0;
+ }
+ }
+
+ /* Update internal joystick state */
+ joystick->buttons[button] = state;
+
+ /* Post the event, if desired */
+ posted = 0;
+#if !SDL_EVENTS_DISABLED
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jbutton.which = joystick->instance_id;
+ event.jbutton.button = button;
+ event.jbutton.state = state;
+ posted = SDL_PushEvent(&event) == 1;
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+ return (posted);
+}
+
+void
+SDL_JoystickUpdate(void)
+{
+ SDL_Joystick *joystick;
+
+ SDL_LockJoysticks();
+
+ if (SDL_updating_joystick) {
+ /* The joysticks are already being updated */
+ SDL_UnlockJoysticks();
+ return;
+ }
+
+ SDL_updating_joystick = SDL_TRUE;
+
+ /* Make sure the list is unlocked while dispatching events to prevent application deadlocks */
+ SDL_UnlockJoysticks();
+
+ for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
+ SDL_SYS_JoystickUpdate(joystick);
+
+ if (joystick->force_recentering) {
+ int i;
+
+ /* Tell the app that everything is centered/unpressed... */
+ for (i = 0; i < joystick->naxes; i++) {
+ if (joystick->axes[i].has_initial_value) {
+ SDL_PrivateJoystickAxis(joystick, i, joystick->axes[i].zero);
+ }
+ }
+
+ for (i = 0; i < joystick->nbuttons; i++) {
+ SDL_PrivateJoystickButton(joystick, i, 0);
+ }
+
+ for (i = 0; i < joystick->nhats; i++) {
+ SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED);
+ }
+
+ joystick->force_recentering = SDL_FALSE;
+ }
+ }
+
+ SDL_LockJoysticks();
+
+ SDL_updating_joystick = SDL_FALSE;
+
+ /* If any joysticks were closed while updating, free them here */
+ for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
+ if (joystick->ref_count <= 0) {
+ SDL_JoystickClose(joystick);
+ }
+ }
+
+ /* this needs to happen AFTER walking the joystick list above, so that any
+ dangling hardware data from removed devices can be free'd
+ */
+ SDL_SYS_JoystickDetect();
+
+ SDL_UnlockJoysticks();
+}
+
+int
+SDL_JoystickEventState(int state)
+{
+#if SDL_EVENTS_DISABLED
+ return SDL_DISABLE;
+#else
+ const Uint32 event_list[] = {
+ SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION,
+ SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_JOYDEVICEADDED, SDL_JOYDEVICEREMOVED
+ };
+ unsigned int i;
+
+ switch (state) {
+ case SDL_QUERY:
+ state = SDL_DISABLE;
+ for (i = 0; i < SDL_arraysize(event_list); ++i) {
+ state = SDL_EventState(event_list[i], SDL_QUERY);
+ if (state == SDL_ENABLE) {
+ break;
+ }
+ }
+ break;
+ default:
+ for (i = 0; i < SDL_arraysize(event_list); ++i) {
+ SDL_EventState(event_list[i], state);
+ }
+ break;
+ }
+ return (state);
+#endif /* SDL_EVENTS_DISABLED */
+}
+
+void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version)
+{
+ Uint16 *guid16 = (Uint16 *)guid.data;
+
+ /* If the GUID fits the form of BUS 0000 VENDOR 0000 PRODUCT 0000, return the data */
+ if (/* guid16[0] is device bus type */
+ guid16[1] == 0x0000 &&
+ /* guid16[2] is vendor ID */
+ guid16[3] == 0x0000 &&
+ /* guid16[4] is product ID */
+ guid16[5] == 0x0000
+ /* guid16[6] is product version */
+ ) {
+ if (vendor) {
+ *vendor = guid16[2];
+ }
+ if (product) {
+ *product = guid16[4];
+ }
+ if (version) {
+ *version = guid16[6];
+ }
+ } else {
+ if (vendor) {
+ *vendor = 0;
+ }
+ if (product) {
+ *product = 0;
+ }
+ if (version) {
+ *version = 0;
+ }
+ }
+}
+
+static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid)
+{
+ static Uint32 wheel_joysticks[] = {
+ MAKE_VIDPID(0x046d, 0xc294), /* Logitech generic wheel */
+ MAKE_VIDPID(0x046d, 0xc295), /* Logitech Momo Force */
+ MAKE_VIDPID(0x046d, 0xc298), /* Logitech Driving Force Pro */
+ MAKE_VIDPID(0x046d, 0xc299), /* Logitech G25 */
+ MAKE_VIDPID(0x046d, 0xc29a), /* Logitech Driving Force GT */
+ MAKE_VIDPID(0x046d, 0xc29b), /* Logitech G27 */
+ MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */
+ MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */
+ MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */
+ MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */
+ MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */
+ MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */
+ MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */
+ };
+ int i;
+
+ for (i = 0; i < SDL_arraysize(wheel_joysticks); ++i) {
+ if (vidpid == wheel_joysticks[i]) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid)
+{
+ static Uint32 flightstick_joysticks[] = {
+ MAKE_VIDPID(0x044f, 0x0402), /* HOTAS Warthog Joystick */
+ MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */
+ };
+ int i;
+
+ for (i = 0; i < SDL_arraysize(flightstick_joysticks); ++i) {
+ if (vidpid == flightstick_joysticks[i]) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static SDL_bool SDL_IsJoystickProductThrottle(Uint32 vidpid)
+{
+ static Uint32 throttle_joysticks[] = {
+ MAKE_VIDPID(0x044f, 0x0404), /* HOTAS Warthog Throttle */
+ MAKE_VIDPID(0x0738, 0xa221), /* Saitek Pro Flight X-56 Rhino Throttle */
+ };
+ int i;
+
+ for (i = 0; i < SDL_arraysize(throttle_joysticks); ++i) {
+ if (vidpid == throttle_joysticks[i]) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid)
+{
+ Uint16 vendor;
+ Uint16 product;
+ Uint32 vidpid;
+
+ if (guid.data[14] == 'x') {
+ /* XInput GUID, get the type based on the XInput device subtype */
+ switch (guid.data[15]) {
+ case 0x01: /* XINPUT_DEVSUBTYPE_GAMEPAD */
+ return SDL_JOYSTICK_TYPE_GAMECONTROLLER;
+ case 0x02: /* XINPUT_DEVSUBTYPE_WHEEL */
+ return SDL_JOYSTICK_TYPE_WHEEL;
+ case 0x03: /* XINPUT_DEVSUBTYPE_ARCADE_STICK */
+ return SDL_JOYSTICK_TYPE_ARCADE_STICK;
+ case 0x04: /* XINPUT_DEVSUBTYPE_FLIGHT_STICK */
+ return SDL_JOYSTICK_TYPE_FLIGHT_STICK;
+ case 0x05: /* XINPUT_DEVSUBTYPE_DANCE_PAD */
+ return SDL_JOYSTICK_TYPE_DANCE_PAD;
+ case 0x06: /* XINPUT_DEVSUBTYPE_GUITAR */
+ case 0x07: /* XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE */
+ case 0x0B: /* XINPUT_DEVSUBTYPE_GUITAR_BASS */
+ return SDL_JOYSTICK_TYPE_GUITAR;
+ case 0x08: /* XINPUT_DEVSUBTYPE_DRUM_KIT */
+ return SDL_JOYSTICK_TYPE_DRUM_KIT;
+ case 0x13: /* XINPUT_DEVSUBTYPE_ARCADE_PAD */
+ return SDL_JOYSTICK_TYPE_ARCADE_PAD;
+ default:
+ return SDL_JOYSTICK_TYPE_UNKNOWN;
+ }
+ }
+
+ SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
+ vidpid = MAKE_VIDPID(vendor, product);
+
+ if (SDL_IsJoystickProductWheel(vidpid)) {
+ return SDL_JOYSTICK_TYPE_WHEEL;
+ }
+
+ if (SDL_IsJoystickProductFlightStick(vidpid)) {
+ return SDL_JOYSTICK_TYPE_FLIGHT_STICK;
+ }
+
+ if (SDL_IsJoystickProductThrottle(vidpid)) {
+ return SDL_JOYSTICK_TYPE_THROTTLE;
+ }
+
+ return SDL_JOYSTICK_TYPE_UNKNOWN;
+}
+
+/* return the guid for this index */
+SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index)
+{
+ if (device_index < 0 || device_index >= SDL_NumJoysticks()) {
+ SDL_JoystickGUID emptyGUID;
+ SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
+ SDL_zero(emptyGUID);
+ return emptyGUID;
+ }
+ return SDL_SYS_JoystickGetDeviceGUID(device_index);
+}
+
+Uint16 SDL_JoystickGetDeviceVendor(int device_index)
+{
+ Uint16 vendor;
+ SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index);
+
+ SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL);
+ return vendor;
+}
+
+Uint16 SDL_JoystickGetDeviceProduct(int device_index)
+{
+ Uint16 product;
+ SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index);
+
+ SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL);
+ return product;
+}
+
+Uint16 SDL_JoystickGetDeviceProductVersion(int device_index)
+{
+ Uint16 version;
+ SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index);
+
+ SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version);
+ return version;
+}
+
+SDL_JoystickType SDL_JoystickGetDeviceType(int device_index)
+{
+ SDL_JoystickType type;
+ SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index);
+
+ type = SDL_GetJoystickGUIDType(guid);
+ if (type == SDL_JOYSTICK_TYPE_UNKNOWN) {
+ if (SDL_IsGameController(device_index)) {
+ type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
+ }
+ }
+ return type;
+}
+
+SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index)
+{
+ if (device_index < 0 || device_index >= SDL_NumJoysticks()) {
+ SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
+ return -1;
+ }
+ return SDL_SYS_GetInstanceIdOfDeviceIndex(device_index);
+}
+
+SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ SDL_JoystickGUID emptyGUID;
+ SDL_zero(emptyGUID);
+ return emptyGUID;
+ }
+ return SDL_SYS_JoystickGetGUID(joystick);
+}
+
+Uint16 SDL_JoystickGetVendor(SDL_Joystick * joystick)
+{
+ Uint16 vendor;
+ SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick);
+
+ SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL);
+ return vendor;
+}
+
+Uint16 SDL_JoystickGetProduct(SDL_Joystick * joystick)
+{
+ Uint16 product;
+ SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick);
+
+ SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL);
+ return product;
+}
+
+Uint16 SDL_JoystickGetProductVersion(SDL_Joystick * joystick)
+{
+ Uint16 version;
+ SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick);
+
+ SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version);
+ return version;
+}
+
+SDL_JoystickType SDL_JoystickGetType(SDL_Joystick * joystick)
+{
+ SDL_JoystickType type;
+ SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick);
+
+ type = SDL_GetJoystickGUIDType(guid);
+ if (type == SDL_JOYSTICK_TYPE_UNKNOWN) {
+ if (joystick && joystick->is_game_controller) {
+ type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
+ }
+ }
+ return type;
+}
+
+/* convert the guid to a printable string */
+void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
+{
+ static const char k_rgchHexToASCII[] = "0123456789abcdef";
+ int i;
+
+ if ((pszGUID == NULL) || (cbGUID <= 0)) {
+ return;
+ }
+
+ for (i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++) {
+ /* each input byte writes 2 ascii chars, and might write a null byte. */
+ /* If we don't have room for next input byte, stop */
+ unsigned char c = guid.data[i];
+
+ *pszGUID++ = k_rgchHexToASCII[c >> 4];
+ *pszGUID++ = k_rgchHexToASCII[c & 0x0F];
+ }
+ *pszGUID = '\0';
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Purpose: Returns the 4 bit nibble for a hex character
+ * Input : c -
+ * Output : unsigned char
+ *-----------------------------------------------------------------------------*/
+static unsigned char nibble(char c)
+{
+ if ((c >= '0') && (c <= '9')) {
+ return (unsigned char)(c - '0');
+ }
+
+ if ((c >= 'A') && (c <= 'F')) {
+ return (unsigned char)(c - 'A' + 0x0a);
+ }
+
+ if ((c >= 'a') && (c <= 'f')) {
+ return (unsigned char)(c - 'a' + 0x0a);
+ }
+
+ /* received an invalid character, and no real way to return an error */
+ /* AssertMsg1(false, "Q_nibble invalid hex character '%c' ", c); */
+ return 0;
+}
+
+
+/* convert the string version of a joystick guid to the struct */
+SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID)
+{
+ SDL_JoystickGUID guid;
+ int maxoutputbytes= sizeof(guid);
+ size_t len = SDL_strlen(pchGUID);
+ Uint8 *p;
+ size_t i;
+
+ /* Make sure it's even */
+ len = (len) & ~0x1;
+
+ SDL_memset(&guid, 0x00, sizeof(guid));
+
+ p = (Uint8 *)&guid;
+ for (i = 0; (i < len) && ((p - (Uint8 *)&guid) < maxoutputbytes); i+=2, p++) {
+ *p = (nibble(pchGUID[i]) << 4) | nibble(pchGUID[i+1]);
+ }
+
+ return guid;
+}
+
+
+/* update the power level for this joystick */
+void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick, SDL_JoystickPowerLevel ePowerLevel)
+{
+ joystick->epowerlevel = ePowerLevel;
+}
+
+
+/* return its power level */
+SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick)
+{
+ if (!SDL_PrivateJoystickValid(joystick)) {
+ return (SDL_JOYSTICK_POWER_UNKNOWN);
+ }
+ return joystick->epowerlevel;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/SDL_joystick_c.h b/src/3rdparty/SDL2/src/joystick/SDL_joystick_c.h
new file mode 100644
index 0000000..0a8fdb4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/SDL_joystick_c.h
@@ -0,0 +1,62 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Useful functions and variables from SDL_joystick.c */
+#include "SDL_joystick.h"
+
+/* Initialization and shutdown functions */
+extern int SDL_JoystickInit(void);
+extern void SDL_JoystickQuit(void);
+
+/* Initialization and shutdown functions */
+extern int SDL_GameControllerInitMappings(void);
+extern void SDL_GameControllerQuitMappings(void);
+extern int SDL_GameControllerInit(void);
+extern void SDL_GameControllerQuit(void);
+
+/* Function to extract information from an SDL joystick GUID */
+extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version);
+
+/* Function to return whether a joystick name and GUID is a game controller */
+extern SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid);
+
+/* Function to return whether a game controller should be ignored */
+extern SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid);
+
+/* Internal event queueing functions */
+extern void SDL_PrivateJoystickAdded(int device_index);
+extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance);
+extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick,
+ Uint8 axis, Sint16 value);
+extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick,
+ Uint8 ball, Sint16 xrel, Sint16 yrel);
+extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
+ Uint8 hat, Uint8 value);
+extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
+ Uint8 button, Uint8 state);
+extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick,
+ SDL_JoystickPowerLevel ePowerLevel);
+
+/* Internal sanity checking functions */
+extern int SDL_PrivateJoystickValid(SDL_Joystick * joystick);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/SDL_sysjoystick.h b/src/3rdparty/SDL2/src/joystick/SDL_sysjoystick.h
new file mode 100644
index 0000000..7de5d83
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/SDL_sysjoystick.h
@@ -0,0 +1,136 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_sysjoystick_h_
+#define SDL_sysjoystick_h_
+
+/* This is the system specific header for the SDL joystick API */
+
+#include "SDL_joystick.h"
+#include "SDL_joystick_c.h"
+
+/* The SDL joystick structure */
+typedef struct _SDL_JoystickAxisInfo
+{
+ Sint16 initial_value; /* Initial axis state */
+ Sint16 value; /* Current axis state */
+ Sint16 zero; /* Zero point on the axis (-32768 for triggers) */
+ SDL_bool has_initial_value; /* Whether we've seen a value on the axis yet */
+ SDL_bool sent_initial_value; /* Whether we've sent the initial axis value */
+} SDL_JoystickAxisInfo;
+
+struct _SDL_Joystick
+{
+ SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */
+ char *name; /* Joystick name - system dependent */
+
+ int naxes; /* Number of axis controls on the joystick */
+ SDL_JoystickAxisInfo *axes;
+
+ int nhats; /* Number of hats on the joystick */
+ Uint8 *hats; /* Current hat states */
+
+ int nballs; /* Number of trackballs on the joystick */
+ struct balldelta {
+ int dx;
+ int dy;
+ } *balls; /* Current ball motion deltas */
+
+ int nbuttons; /* Number of buttons on the joystick */
+ Uint8 *buttons; /* Current button states */
+
+ struct joystick_hwdata *hwdata; /* Driver dependent information */
+
+ int ref_count; /* Reference count for multiple opens */
+
+ SDL_bool is_game_controller;
+ SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */
+ SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */
+ struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */
+};
+
+/* Macro to combine a USB vendor ID and product ID into a single Uint32 value */
+#define MAKE_VIDPID(VID, PID) (((Uint32)(VID))<<16|(PID))
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * This function should return the number of available joysticks, or -1
+ * on an unrecoverable fatal error.
+ */
+extern int SDL_SYS_JoystickInit(void);
+
+/* Function to return the number of joystick devices plugged in right now */
+extern int SDL_SYS_NumJoysticks(void);
+
+/* Function to cause any queued joystick insertions to be processed */
+extern void SDL_SYS_JoystickDetect(void);
+
+/* Function to get the device-dependent name of a joystick */
+extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index);
+
+/* Function to get the current instance id of the joystick located at device_index */
+extern SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index);
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+extern int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index);
+
+/* Function to query if the joystick is currently attached
+ * It returns SDL_TRUE if attached, SDL_FALSE otherwise.
+ */
+extern SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick * joystick);
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+extern void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick);
+
+/* Function to close a joystick after use */
+extern void SDL_SYS_JoystickClose(SDL_Joystick * joystick);
+
+/* Function to perform any system-specific joystick related cleanup */
+extern void SDL_SYS_JoystickQuit(void);
+
+/* Function to return the stable GUID for a plugged in device */
+extern SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index);
+
+/* Function to return the stable GUID for a opened joystick */
+extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick);
+
+#if SDL_JOYSTICK_XINPUT
+/* Function returns SDL_TRUE if this device is an XInput gamepad */
+extern SDL_bool SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index);
+#endif
+
+#if defined(__ANDROID__)
+/* Function returns SDL_TRUE if this device is a DPAD (maybe a TV remote) */
+extern SDL_bool SDL_SYS_IsDPAD_DeviceIndex(int device_index);
+#endif
+
+#endif /* SDL_sysjoystick_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick.c
new file mode 100644
index 0000000..ce5a5df
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick.c
@@ -0,0 +1,687 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_ANDROID
+
+#include <stdio.h> /* For the definition of NULL */
+#include "SDL_error.h"
+#include "SDL_events.h"
+
+#include "SDL_joystick.h"
+#include "SDL_hints.h"
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_log.h"
+#include "SDL_sysjoystick_c.h"
+#include "../SDL_joystick_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../core/android/SDL_android.h"
+#include "../steam/SDL_steamcontroller.h"
+
+#include "android/keycodes.h"
+
+/* As of platform android-14, android/keycodes.h is missing these defines */
+#ifndef AKEYCODE_BUTTON_1
+#define AKEYCODE_BUTTON_1 188
+#define AKEYCODE_BUTTON_2 189
+#define AKEYCODE_BUTTON_3 190
+#define AKEYCODE_BUTTON_4 191
+#define AKEYCODE_BUTTON_5 192
+#define AKEYCODE_BUTTON_6 193
+#define AKEYCODE_BUTTON_7 194
+#define AKEYCODE_BUTTON_8 195
+#define AKEYCODE_BUTTON_9 196
+#define AKEYCODE_BUTTON_10 197
+#define AKEYCODE_BUTTON_11 198
+#define AKEYCODE_BUTTON_12 199
+#define AKEYCODE_BUTTON_13 200
+#define AKEYCODE_BUTTON_14 201
+#define AKEYCODE_BUTTON_15 202
+#define AKEYCODE_BUTTON_16 203
+#endif
+
+#define ANDROID_ACCELEROMETER_NAME "Android Accelerometer"
+#define ANDROID_ACCELEROMETER_DEVICE_ID INT_MIN
+#define ANDROID_MAX_NBUTTONS 36
+
+static SDL_joylist_item * JoystickByDeviceId(int device_id);
+
+static SDL_joylist_item *SDL_joylist = NULL;
+static SDL_joylist_item *SDL_joylist_tail = NULL;
+static int numjoysticks = 0;
+static int instance_counter = 0;
+
+
+/* Function to convert Android keyCodes into SDL ones.
+ * This code manipulation is done to get a sequential list of codes.
+ * FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS
+ */
+static int
+keycode_to_SDL(int keycode)
+{
+ /* FIXME: If this function gets too unwieldy in the future, replace with a lookup table */
+ int button = 0;
+ switch (keycode) {
+ /* Some gamepad buttons (API 9) */
+ case AKEYCODE_BUTTON_A:
+ button = SDL_CONTROLLER_BUTTON_A;
+ break;
+ case AKEYCODE_BUTTON_B:
+ button = SDL_CONTROLLER_BUTTON_B;
+ break;
+ case AKEYCODE_BUTTON_X:
+ button = SDL_CONTROLLER_BUTTON_X;
+ break;
+ case AKEYCODE_BUTTON_Y:
+ button = SDL_CONTROLLER_BUTTON_Y;
+ break;
+ case AKEYCODE_BUTTON_L1:
+ button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
+ break;
+ case AKEYCODE_BUTTON_R1:
+ button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
+ break;
+ case AKEYCODE_BUTTON_THUMBL:
+ button = SDL_CONTROLLER_BUTTON_LEFTSTICK;
+ break;
+ case AKEYCODE_BUTTON_THUMBR:
+ button = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
+ break;
+ case AKEYCODE_BUTTON_START:
+ button = SDL_CONTROLLER_BUTTON_START;
+ break;
+ case AKEYCODE_BACK:
+ case AKEYCODE_BUTTON_SELECT:
+ button = SDL_CONTROLLER_BUTTON_BACK;
+ break;
+ case AKEYCODE_BUTTON_MODE:
+ button = SDL_CONTROLLER_BUTTON_GUIDE;
+ break;
+ case AKEYCODE_BUTTON_L2:
+ button = SDL_CONTROLLER_BUTTON_MAX; /* Not supported by GameController */
+ break;
+ case AKEYCODE_BUTTON_R2:
+ button = SDL_CONTROLLER_BUTTON_MAX+1; /* Not supported by GameController */
+ break;
+ case AKEYCODE_BUTTON_C:
+ button = SDL_CONTROLLER_BUTTON_MAX+2; /* Not supported by GameController */
+ break;
+ case AKEYCODE_BUTTON_Z:
+ button = SDL_CONTROLLER_BUTTON_MAX+3; /* Not supported by GameController */
+ break;
+
+ /* D-Pad key codes (API 1) */
+ case AKEYCODE_DPAD_UP:
+ button = SDL_CONTROLLER_BUTTON_DPAD_UP;
+ break;
+ case AKEYCODE_DPAD_DOWN:
+ button = SDL_CONTROLLER_BUTTON_DPAD_DOWN;
+ break;
+ case AKEYCODE_DPAD_LEFT:
+ button = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
+ break;
+ case AKEYCODE_DPAD_RIGHT:
+ button = SDL_CONTROLLER_BUTTON_DPAD_RIGHT;
+ break;
+ case AKEYCODE_DPAD_CENTER:
+ /* This is handled better by applications as the A button */
+ /*button = SDL_CONTROLLER_BUTTON_MAX+4;*/ /* Not supported by GameController */
+ button = SDL_CONTROLLER_BUTTON_A;
+ break;
+
+ /* More gamepad buttons (API 12), these get mapped to 20...35*/
+ case AKEYCODE_BUTTON_1:
+ case AKEYCODE_BUTTON_2:
+ case AKEYCODE_BUTTON_3:
+ case AKEYCODE_BUTTON_4:
+ case AKEYCODE_BUTTON_5:
+ case AKEYCODE_BUTTON_6:
+ case AKEYCODE_BUTTON_7:
+ case AKEYCODE_BUTTON_8:
+ case AKEYCODE_BUTTON_9:
+ case AKEYCODE_BUTTON_10:
+ case AKEYCODE_BUTTON_11:
+ case AKEYCODE_BUTTON_12:
+ case AKEYCODE_BUTTON_13:
+ case AKEYCODE_BUTTON_14:
+ case AKEYCODE_BUTTON_15:
+ case AKEYCODE_BUTTON_16:
+ button = keycode - AKEYCODE_BUTTON_1 + SDL_CONTROLLER_BUTTON_MAX + 5;
+ break;
+
+ default:
+ return -1;
+ /* break; -Wunreachable-code-break */
+ }
+
+ /* This is here in case future generations, probably with six fingers per hand,
+ * happily add new cases up above and forget to update the max number of buttons.
+ */
+ SDL_assert(button < ANDROID_MAX_NBUTTONS);
+ return button;
+}
+
+static SDL_Scancode
+button_to_scancode(int button)
+{
+ switch (button) {
+ case SDL_CONTROLLER_BUTTON_A:
+ return SDL_SCANCODE_RETURN;
+ case SDL_CONTROLLER_BUTTON_B:
+ return SDL_SCANCODE_ESCAPE;
+ case SDL_CONTROLLER_BUTTON_BACK:
+ return SDL_SCANCODE_ESCAPE;
+ case SDL_CONTROLLER_BUTTON_DPAD_UP:
+ return SDL_SCANCODE_UP;
+ case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
+ return SDL_SCANCODE_DOWN;
+ case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
+ return SDL_SCANCODE_LEFT;
+ case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
+ return SDL_SCANCODE_RIGHT;
+ }
+
+ /* Unsupported button */
+ return SDL_SCANCODE_UNKNOWN;
+}
+
+int
+Android_OnPadDown(int device_id, int keycode)
+{
+ SDL_joylist_item *item;
+ int button = keycode_to_SDL(keycode);
+ if (button >= 0) {
+ item = JoystickByDeviceId(device_id);
+ if (item && item->joystick) {
+ SDL_PrivateJoystickButton(item->joystick, button , SDL_PRESSED);
+ } else {
+ SDL_SendKeyboardKey(SDL_PRESSED, button_to_scancode(button));
+ }
+ return 0;
+ }
+
+ return -1;
+}
+
+int
+Android_OnPadUp(int device_id, int keycode)
+{
+ SDL_joylist_item *item;
+ int button = keycode_to_SDL(keycode);
+ if (button >= 0) {
+ item = JoystickByDeviceId(device_id);
+ if (item && item->joystick) {
+ SDL_PrivateJoystickButton(item->joystick, button, SDL_RELEASED);
+ } else {
+ SDL_SendKeyboardKey(SDL_RELEASED, button_to_scancode(button));
+ }
+ return 0;
+ }
+
+ return -1;
+}
+
+int
+Android_OnJoy(int device_id, int axis, float value)
+{
+ /* Android gives joy info normalized as [-1.0, 1.0] or [0.0, 1.0] */
+ SDL_joylist_item *item = JoystickByDeviceId(device_id);
+ if (item && item->joystick) {
+ SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value));
+ }
+
+ return 0;
+}
+
+int
+Android_OnHat(int device_id, int hat_id, int x, int y)
+{
+ const Uint8 position_map[3][3] = {
+ {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP},
+ {SDL_HAT_LEFT, SDL_HAT_CENTERED, SDL_HAT_RIGHT},
+ {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
+ };
+
+ if (x >= -1 && x <=1 && y >= -1 && y <= 1) {
+ SDL_joylist_item *item = JoystickByDeviceId(device_id);
+ if (item && item->joystick) {
+ SDL_PrivateJoystickHat(item->joystick, hat_id, position_map[y+1][x+1]);
+ }
+ return 0;
+ }
+
+ return -1;
+}
+
+
+int
+Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs)
+{
+ SDL_JoystickGUID guid;
+ SDL_joylist_item *item;
+
+ if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
+ /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */
+ if (naxes < 2 && nhats < 1) {
+ return -1;
+ }
+ }
+
+ if (JoystickByDeviceId(device_id) != NULL || name == NULL) {
+ return -1;
+ }
+
+ /* the GUID is just the first 16 chars of the name for now */
+ SDL_zero(guid);
+ SDL_memcpy(&guid, desc, SDL_min(sizeof(guid), SDL_strlen(desc)));
+
+ item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item));
+ if (item == NULL) {
+ return -1;
+ }
+
+ SDL_zerop(item);
+ item->guid = guid;
+ item->device_id = device_id;
+ item->name = SDL_strdup(name);
+ if (item->name == NULL) {
+ SDL_free(item);
+ return -1;
+ }
+
+ item->is_accelerometer = is_accelerometer;
+ if (nbuttons > -1) {
+ item->nbuttons = nbuttons;
+ }
+ else {
+ item->nbuttons = ANDROID_MAX_NBUTTONS;
+ }
+ item->naxes = naxes;
+ item->nhats = nhats;
+ item->nballs = nballs;
+ item->device_instance = instance_counter++;
+ if (SDL_joylist_tail == NULL) {
+ SDL_joylist = SDL_joylist_tail = item;
+ } else {
+ SDL_joylist_tail->next = item;
+ SDL_joylist_tail = item;
+ }
+
+ /* Need to increment the joystick count before we post the event */
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+
+#ifdef DEBUG_JOYSTICK
+ SDL_Log("Added joystick %s with device_id %d", name, device_id);
+#endif
+
+ return numjoysticks;
+}
+
+int
+Android_RemoveJoystick(int device_id)
+{
+ SDL_joylist_item *item = SDL_joylist;
+ SDL_joylist_item *prev = NULL;
+
+ /* Don't call JoystickByDeviceId here or there'll be an infinite loop! */
+ while (item != NULL) {
+ if (item->device_id == device_id) {
+ break;
+ }
+ prev = item;
+ item = item->next;
+ }
+
+ if (item == NULL) {
+ return -1;
+ }
+
+ if (item->joystick) {
+ item->joystick->hwdata = NULL;
+ }
+
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_joylist == item);
+ SDL_joylist = item->next;
+ }
+ if (item == SDL_joylist_tail) {
+ SDL_joylist_tail = prev;
+ }
+
+ /* Need to decrement the joystick count before we post the event */
+ --numjoysticks;
+
+ SDL_PrivateJoystickRemoved(item->device_instance);
+
+#ifdef DEBUG_JOYSTICK
+ SDL_Log("Removed joystick with device_id %d", device_id);
+#endif
+
+ SDL_free(item->name);
+ SDL_free(item);
+ return numjoysticks;
+}
+
+
+static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance)
+{
+ SDL_joylist_item *item;
+
+ item = (SDL_joylist_item *)SDL_calloc(1, sizeof (SDL_joylist_item));
+ if (item == NULL) {
+ return SDL_FALSE;
+ }
+
+ *device_instance = item->device_instance = instance_counter++;
+ item->device_id = -1;
+ item->name = SDL_strdup(name);
+ item->guid = guid;
+ SDL_GetSteamControllerInputs(&item->nbuttons,
+ &item->naxes,
+ &item->nhats);
+ item->m_bSteamController = SDL_TRUE;
+
+ if (SDL_joylist_tail == NULL) {
+ SDL_joylist = SDL_joylist_tail = item;
+ } else {
+ SDL_joylist_tail->next = item;
+ SDL_joylist_tail = item;
+ }
+
+ /* Need to increment the joystick count before we post the event */
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+
+ return SDL_TRUE;
+}
+
+static void SteamControllerDisconnectedCallback(int device_instance)
+{
+ SDL_joylist_item *item = SDL_joylist;
+ SDL_joylist_item *prev = NULL;
+
+ while (item != NULL) {
+ if (item->device_instance == device_instance) {
+ break;
+ }
+ prev = item;
+ item = item->next;
+ }
+
+ if (item == NULL) {
+ return;
+ }
+
+ if (item->joystick) {
+ item->joystick->hwdata = NULL;
+ }
+
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_joylist == item);
+ SDL_joylist = item->next;
+ }
+ if (item == SDL_joylist_tail) {
+ SDL_joylist_tail = prev;
+ }
+
+ /* Need to decrement the joystick count before we post the event */
+ --numjoysticks;
+
+ SDL_PrivateJoystickRemoved(item->device_instance);
+
+ SDL_free(item->name);
+ SDL_free(item);
+}
+
+int
+SDL_SYS_JoystickInit(void)
+{
+ SDL_SYS_JoystickDetect();
+
+ if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
+ /* Default behavior, accelerometer as joystick */
+ Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0);
+ }
+
+ SDL_InitSteamControllers(SteamControllerConnectedCallback,
+ SteamControllerDisconnectedCallback);
+
+ return (numjoysticks);
+
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return numjoysticks;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+ /* Support for device connect/disconnect is API >= 16 only,
+ * so we poll every three seconds
+ * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html
+ */
+ static Uint32 timeout = 0;
+ if (!timeout || SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
+ timeout = SDL_GetTicks() + 3000;
+ Android_JNI_PollInputDevices();
+ }
+
+ SDL_UpdateSteamControllers();
+}
+
+static SDL_joylist_item *
+JoystickByDevIndex(int device_index)
+{
+ SDL_joylist_item *item = SDL_joylist;
+
+ if ((device_index < 0) || (device_index >= numjoysticks)) {
+ return NULL;
+ }
+
+ while (device_index > 0) {
+ SDL_assert(item != NULL);
+ device_index--;
+ item = item->next;
+ }
+
+ return item;
+}
+
+static SDL_joylist_item *
+JoystickByDeviceId(int device_id)
+{
+ SDL_joylist_item *item = SDL_joylist;
+
+ while (item != NULL) {
+ if (item->device_id == device_id) {
+ return item;
+ }
+ item = item->next;
+ }
+
+ /* Joystick not found, try adding it */
+ SDL_SYS_JoystickDetect();
+
+ while (item != NULL) {
+ if (item->device_id == device_id) {
+ return item;
+ }
+ item = item->next;
+ }
+
+ return NULL;
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ return JoystickByDevIndex(device_index)->name;
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return JoystickByDevIndex(device_index)->device_instance;
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ SDL_joylist_item *item = JoystickByDevIndex(device_index);
+
+ if (item == NULL) {
+ return SDL_SetError("No such device");
+ }
+
+ if (item->joystick != NULL) {
+ return SDL_SetError("Joystick already opened");
+ }
+
+ joystick->instance_id = item->device_instance;
+ joystick->hwdata = (struct joystick_hwdata *) item;
+ item->joystick = joystick;
+ joystick->nhats = item->nhats;
+ joystick->nballs = item->nballs;
+ joystick->nbuttons = item->nbuttons;
+ joystick->naxes = item->naxes;
+
+ return (0);
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return joystick->hwdata != NULL;
+}
+
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata;
+
+ if (item == NULL) {
+ return;
+ }
+
+ if (item->m_bSteamController) {
+ SDL_UpdateSteamController(joystick);
+ return;
+ }
+
+ if (item->is_accelerometer) {
+ int i;
+ Sint16 value;
+ float values[3];
+
+ if (Android_JNI_GetAccelerometerValues(values)) {
+ for (i = 0; i < 3; i++) {
+ if (values[i] > 1.0f) {
+ values[i] = 1.0f;
+ } else if (values[i] < -1.0f) {
+ values[i] = -1.0f;
+ }
+
+ value = (Sint16)(values[i] * 32767.0f);
+ SDL_PrivateJoystickAxis(item->joystick, i, value);
+ }
+ }
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+ SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata;
+ if (item) {
+ item->joystick = NULL;
+ }
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+/* We don't have any way to scan for joysticks at init, so don't wipe the list
+ * of joysticks here in case this is a reinit.
+ */
+#if 0
+ SDL_joylist_item *item = NULL;
+ SDL_joylist_item *next = NULL;
+
+ for (item = SDL_joylist; item; item = next) {
+ next = item->next;
+ SDL_free(item->name);
+ SDL_free(item);
+ }
+
+ SDL_joylist = SDL_joylist_tail = NULL;
+
+ numjoysticks = 0;
+ instance_counter = 0;
+#endif /* 0 */
+
+ SDL_QuitSteamControllers();
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index)
+{
+ return JoystickByDevIndex(device_index)->guid;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+
+ if (joystick->hwdata != NULL) {
+ return ((SDL_joylist_item*)joystick->hwdata)->guid;
+ }
+
+ SDL_zero(guid);
+ return guid;
+}
+
+SDL_bool SDL_SYS_IsDPAD_DeviceIndex(int device_index)
+{
+ return JoystickByDevIndex(device_index)->naxes == 0;
+}
+
+#endif /* SDL_JOYSTICK_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick_c.h b/src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick_c.h
new file mode 100644
index 0000000..c2cbc4e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/android/SDL_sysjoystick_c.h
@@ -0,0 +1,61 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_ANDROID
+
+#ifndef SDL_sysjoystick_c_h_
+#define SDL_sysjoystick_c_h_
+
+#include "../SDL_sysjoystick.h"
+
+extern int Android_OnPadDown(int device_id, int keycode);
+extern int Android_OnPadUp(int device_id, int keycode);
+extern int Android_OnJoy(int device_id, int axisnum, float value);
+extern int Android_OnHat(int device_id, int hat_id, int x, int y);
+extern int Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs);
+extern int Android_RemoveJoystick(int device_id);
+
+/* A linked list of available joysticks */
+typedef struct SDL_joylist_item
+{
+ int device_instance;
+ int device_id; /* Android's device id */
+ char *name; /* "SideWinder 3D Pro" or whatever */
+ SDL_JoystickGUID guid;
+ SDL_bool is_accelerometer;
+ SDL_Joystick *joystick;
+ int nbuttons, naxes, nhats, nballs;
+
+ /* Steam Controller support */
+ SDL_bool m_bSteamController;
+
+ struct SDL_joylist_item *next;
+} SDL_joylist_item;
+
+typedef SDL_joylist_item joystick_hwdata;
+
+#endif /* SDL_sysjoystick_c_h_ */
+
+#endif /* SDL_JOYSTICK_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/bsd/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/bsd/SDL_sysjoystick.c
new file mode 100644
index 0000000..9408545
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/bsd/SDL_sysjoystick.c
@@ -0,0 +1,691 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_USBHID
+
+/*
+ * Joystick driver for the uhid(4) interface found in OpenBSD,
+ * NetBSD and FreeBSD.
+ *
+ * Maintainer: <vedge at csoft.org>
+ */
+
+#include <sys/param.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#ifndef __FreeBSD_kernel_version
+#define __FreeBSD_kernel_version __FreeBSD_version
+#endif
+
+#if defined(HAVE_USB_H)
+#include <usb.h>
+#endif
+#ifdef __DragonFly__
+#include <bus/usb/usb.h>
+#include <bus/usb/usbhid.h>
+#else
+#include <dev/usb/usb.h>
+#include <dev/usb/usbhid.h>
+#endif
+
+#if defined(HAVE_USBHID_H)
+#include <usbhid.h>
+#elif defined(HAVE_LIBUSB_H)
+#include <libusb.h>
+#elif defined(HAVE_LIBUSBHID_H)
+#include <libusbhid.h>
+#endif
+
+#if defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
+#ifndef __DragonFly__
+#include <osreldate.h>
+#endif
+#if __FreeBSD_kernel_version > 800063
+#include <dev/usb/usb_ioctl.h>
+#endif
+#include <sys/joystick.h>
+#endif
+
+#if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
+#include <machine/joystick.h>
+#endif
+
+#include "SDL_joystick.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+
+#define MAX_UHID_JOYS 64
+#define MAX_JOY_JOYS 2
+#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
+
+
+struct report
+{
+#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
+ void *buf; /* Buffer */
+#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
+ struct usb_gen_descriptor *buf; /* Buffer */
+#else
+ struct usb_ctl_report *buf; /* Buffer */
+#endif
+ size_t size; /* Buffer size */
+ int rid; /* Report ID */
+ enum
+ {
+ SREPORT_UNINIT,
+ SREPORT_CLEAN,
+ SREPORT_DIRTY
+ } status;
+};
+
+static struct
+{
+ int uhid_report;
+ hid_kind_t kind;
+ const char *name;
+} const repinfo[] = {
+ {UHID_INPUT_REPORT, hid_input, "input"},
+ {UHID_OUTPUT_REPORT, hid_output, "output"},
+ {UHID_FEATURE_REPORT, hid_feature, "feature"}
+};
+
+enum
+{
+ REPORT_INPUT = 0,
+ REPORT_OUTPUT = 1,
+ REPORT_FEATURE = 2
+};
+
+enum
+{
+ JOYAXE_X,
+ JOYAXE_Y,
+ JOYAXE_Z,
+ JOYAXE_SLIDER,
+ JOYAXE_WHEEL,
+ JOYAXE_RX,
+ JOYAXE_RY,
+ JOYAXE_RZ,
+ JOYAXE_count
+};
+
+struct joystick_hwdata
+{
+ int fd;
+ char *path;
+ enum
+ {
+ BSDJOY_UHID, /* uhid(4) */
+ BSDJOY_JOY /* joy(4) */
+ } type;
+ struct report_desc *repdesc;
+ struct report inreport;
+ int axis_map[JOYAXE_count]; /* map present JOYAXE_* to 0,1,.. */
+};
+
+static char *joynames[MAX_JOYS];
+static char *joydevnames[MAX_JOYS];
+
+static int report_alloc(struct report *, struct report_desc *, int);
+static void report_free(struct report *);
+
+#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063)
+#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
+#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000))
+#define REP_BUF_DATA(rep) ((rep)->buf)
+#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
+#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
+#else
+#define REP_BUF_DATA(rep) ((rep)->buf->data)
+#endif
+
+static int SDL_SYS_numjoysticks = 0;
+
+int
+SDL_SYS_JoystickInit(void)
+{
+ char s[16];
+ int i, fd;
+
+ SDL_SYS_numjoysticks = 0;
+
+ SDL_memset(joynames, 0, sizeof(joynames));
+ SDL_memset(joydevnames, 0, sizeof(joydevnames));
+
+ for (i = 0; i < MAX_UHID_JOYS; i++) {
+ SDL_Joystick nj;
+
+ SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
+
+ joynames[SDL_SYS_numjoysticks] = SDL_strdup(s);
+
+ if (SDL_SYS_JoystickOpen(&nj, SDL_SYS_numjoysticks) == 0) {
+ SDL_SYS_JoystickClose(&nj);
+ SDL_SYS_numjoysticks++;
+ } else {
+ SDL_free(joynames[SDL_SYS_numjoysticks]);
+ joynames[SDL_SYS_numjoysticks] = NULL;
+ }
+ }
+ for (i = 0; i < MAX_JOY_JOYS; i++) {
+ SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i);
+ fd = open(s, O_RDONLY);
+ if (fd != -1) {
+ joynames[SDL_SYS_numjoysticks++] = SDL_strdup(s);
+ close(fd);
+ }
+ }
+
+ /* Read the default USB HID usage table. */
+ hid_init(NULL);
+
+ return (SDL_SYS_numjoysticks);
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return SDL_SYS_numjoysticks;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+}
+
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ if (joydevnames[device_index] != NULL) {
+ return (joydevnames[device_index]);
+ }
+ return (joynames[device_index]);
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return device_index;
+}
+
+static int
+usage_to_joyaxe(unsigned usage)
+{
+ int joyaxe;
+ switch (usage) {
+ case HUG_X:
+ joyaxe = JOYAXE_X;
+ break;
+ case HUG_Y:
+ joyaxe = JOYAXE_Y;
+ break;
+ case HUG_Z:
+ joyaxe = JOYAXE_Z;
+ break;
+ case HUG_SLIDER:
+ joyaxe = JOYAXE_SLIDER;
+ break;
+ case HUG_WHEEL:
+ joyaxe = JOYAXE_WHEEL;
+ break;
+ case HUG_RX:
+ joyaxe = JOYAXE_RX;
+ break;
+ case HUG_RY:
+ joyaxe = JOYAXE_RY;
+ break;
+ case HUG_RZ:
+ joyaxe = JOYAXE_RZ;
+ break;
+ default:
+ joyaxe = -1;
+ }
+ return joyaxe;
+}
+
+static unsigned
+hatval_to_sdl(Sint32 hatval)
+{
+ static const unsigned hat_dir_map[8] = {
+ SDL_HAT_UP, SDL_HAT_RIGHTUP, SDL_HAT_RIGHT, SDL_HAT_RIGHTDOWN,
+ SDL_HAT_DOWN, SDL_HAT_LEFTDOWN, SDL_HAT_LEFT, SDL_HAT_LEFTUP
+ };
+ unsigned result;
+ if ((hatval & 7) == hatval)
+ result = hat_dir_map[hatval];
+ else
+ result = SDL_HAT_CENTERED;
+ return result;
+}
+
+
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index)
+{
+ char *path = joynames[device_index];
+ struct joystick_hwdata *hw;
+ struct hid_item hitem;
+ struct hid_data *hdata;
+ struct report *rep = NULL;
+ int fd;
+ int i;
+
+ fd = open(path, O_RDONLY);
+ if (fd == -1) {
+ return SDL_SetError("%s: %s", path, strerror(errno));
+ }
+
+ joy->instance_id = device_index;
+ hw = (struct joystick_hwdata *)
+ SDL_malloc(sizeof(struct joystick_hwdata));
+ if (hw == NULL) {
+ close(fd);
+ return SDL_OutOfMemory();
+ }
+ joy->hwdata = hw;
+ hw->fd = fd;
+ hw->path = SDL_strdup(path);
+ if (!SDL_strncmp(path, "/dev/joy", 8)) {
+ hw->type = BSDJOY_JOY;
+ joy->naxes = 2;
+ joy->nbuttons = 2;
+ joy->nhats = 0;
+ joy->nballs = 0;
+ joydevnames[device_index] = SDL_strdup("Gameport joystick");
+ goto usbend;
+ } else {
+ hw->type = BSDJOY_UHID;
+ }
+
+ {
+ int ax;
+ for (ax = 0; ax < JOYAXE_count; ax++)
+ hw->axis_map[ax] = -1;
+ }
+ hw->repdesc = hid_get_report_desc(fd);
+ if (hw->repdesc == NULL) {
+ SDL_SetError("%s: USB_GET_REPORT_DESC: %s", hw->path,
+ strerror(errno));
+ goto usberr;
+ }
+ rep = &hw->inreport;
+#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__)
+ rep->rid = hid_get_report_id(fd);
+ if (rep->rid < 0) {
+#else
+ if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
+#endif
+ rep->rid = -1; /* XXX */
+ }
+#if defined(__NetBSD__)
+ usb_device_descriptor_t udd;
+ struct usb_string_desc usd;
+ if (ioctl(fd, USB_GET_DEVICE_DESC, &udd) == -1)
+ goto desc_failed;
+
+ /* Get default language */
+ usd.usd_string_index = USB_LANGUAGE_TABLE;
+ usd.usd_language_id = 0;
+ if (ioctl(fd, USB_GET_STRING_DESC, &usd) == -1 || usd.usd_desc.bLength < 4) {
+ usd.usd_language_id = 0;
+ } else {
+ usd.usd_language_id = UGETW(usd.usd_desc.bString[0]);
+ }
+
+ usd.usd_string_index = udd.iProduct;
+ if (ioctl(fd, USB_GET_STRING_DESC, &usd) == 0) {
+ char str[128];
+ char *new_name = NULL;
+ int i;
+ for (i = 0; i < (usd.usd_desc.bLength >> 1) - 1 && i < sizeof(str) - 1; i++) {
+ str[i] = UGETW(usd.usd_desc.bString[i]);
+ }
+ str[i] = '\0';
+ asprintf(&new_name, "%s @ %s", str, path);
+ if (new_name != NULL) {
+ SDL_free(joydevnames[SDL_SYS_numjoysticks]);
+ joydevnames[SDL_SYS_numjoysticks] = new_name;
+ }
+ }
+desc_failed:
+#endif
+ if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
+ goto usberr;
+ }
+ if (rep->size <= 0) {
+ SDL_SetError("%s: Input report descriptor has invalid length",
+ hw->path);
+ goto usberr;
+ }
+#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__)
+ hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
+#else
+ hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
+#endif
+ if (hdata == NULL) {
+ SDL_SetError("%s: Cannot start HID parser", hw->path);
+ goto usberr;
+ }
+ joy->naxes = 0;
+ joy->nbuttons = 0;
+ joy->nhats = 0;
+ joy->nballs = 0;
+ for (i = 0; i < JOYAXE_count; i++)
+ hw->axis_map[i] = -1;
+
+ while (hid_get_item(hdata, &hitem) > 0) {
+ char *sp;
+ const char *s;
+
+ switch (hitem.kind) {
+ case hid_collection:
+ switch (HID_PAGE(hitem.usage)) {
+ case HUP_GENERIC_DESKTOP:
+ switch (HID_USAGE(hitem.usage)) {
+ case HUG_JOYSTICK:
+ case HUG_GAME_PAD:
+ s = hid_usage_in_page(hitem.usage);
+ sp = SDL_malloc(SDL_strlen(s) + 5);
+ SDL_snprintf(sp, SDL_strlen(s) + 5, "%s (%d)",
+ s, device_index);
+ joydevnames[device_index] = sp;
+ }
+ }
+ break;
+ case hid_input:
+ switch (HID_PAGE(hitem.usage)) {
+ case HUP_GENERIC_DESKTOP:
+ {
+ unsigned usage = HID_USAGE(hitem.usage);
+ int joyaxe = usage_to_joyaxe(usage);
+ if (joyaxe >= 0) {
+ hw->axis_map[joyaxe] = 1;
+ } else if (usage == HUG_HAT_SWITCH) {
+ joy->nhats++;
+ }
+ break;
+ }
+ case HUP_BUTTON:
+ joy->nbuttons++;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ hid_end_parse(hdata);
+ for (i = 0; i < JOYAXE_count; i++)
+ if (hw->axis_map[i] > 0)
+ hw->axis_map[i] = joy->naxes++;
+
+ if (joy->naxes == 0 && joy->nbuttons == 0 && joy->nhats == 0 && joy->nballs == 0) {
+ SDL_SetError("%s: Not a joystick, ignoring", hw->path);
+ goto usberr;
+ }
+
+ usbend:
+ /* The poll blocks the event thread. */
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+#ifdef __NetBSD__
+ /* Flush pending events */
+ if (rep) {
+ while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size)
+ ;
+ }
+#endif
+
+ return (0);
+ usberr:
+ close(hw->fd);
+ SDL_free(hw->path);
+ SDL_free(hw);
+ return (-1);
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return SDL_TRUE;
+}
+
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joy)
+{
+ struct hid_item hitem;
+ struct hid_data *hdata;
+ struct report *rep;
+ int nbutton, naxe = -1;
+ Sint32 v;
+
+#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__)
+ struct joystick gameport;
+ static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
+
+ if (joy->hwdata->type == BSDJOY_JOY) {
+ while (read(joy->hwdata->fd, &gameport, sizeof gameport) == sizeof gameport) {
+ if (abs(x - gameport.x) > 8) {
+ x = gameport.x;
+ if (x < xmin) {
+ xmin = x;
+ }
+ if (x > xmax) {
+ xmax = x;
+ }
+ if (xmin == xmax) {
+ xmin--;
+ xmax++;
+ }
+ v = (Sint32) x;
+ v -= (xmax + xmin + 1) / 2;
+ v *= 32768 / ((xmax - xmin + 1) / 2);
+ SDL_PrivateJoystickAxis(joy, 0, v);
+ }
+ if (abs(y - gameport.y) > 8) {
+ y = gameport.y;
+ if (y < ymin) {
+ ymin = y;
+ }
+ if (y > ymax) {
+ ymax = y;
+ }
+ if (ymin == ymax) {
+ ymin--;
+ ymax++;
+ }
+ v = (Sint32) y;
+ v -= (ymax + ymin + 1) / 2;
+ v *= 32768 / ((ymax - ymin + 1) / 2);
+ SDL_PrivateJoystickAxis(joy, 1, v);
+ }
+ SDL_PrivateJoystickButton(joy, 0, gameport.b1);
+ SDL_PrivateJoystickButton(joy, 1, gameport.b2);
+ }
+ return;
+ }
+#endif /* defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
+
+ rep = &joy->hwdata->inreport;
+
+ while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) {
+#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__)
+ hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
+#else
+ hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
+#endif
+ if (hdata == NULL) {
+ /*fprintf(stderr, "%s: Cannot start HID parser\n", joy->hwdata->path);*/
+ continue;
+ }
+
+ for (nbutton = 0; hid_get_item(hdata, &hitem) > 0;) {
+ switch (hitem.kind) {
+ case hid_input:
+ switch (HID_PAGE(hitem.usage)) {
+ case HUP_GENERIC_DESKTOP:
+ {
+ unsigned usage = HID_USAGE(hitem.usage);
+ int joyaxe = usage_to_joyaxe(usage);
+ if (joyaxe >= 0) {
+ naxe = joy->hwdata->axis_map[joyaxe];
+ /* scaleaxe */
+ v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
+ v -= (hitem.logical_maximum +
+ hitem.logical_minimum + 1) / 2;
+ v *= 32768 /
+ ((hitem.logical_maximum -
+ hitem.logical_minimum + 1) / 2);
+ SDL_PrivateJoystickAxis(joy, naxe, v);
+ } else if (usage == HUG_HAT_SWITCH) {
+ v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
+ SDL_PrivateJoystickHat(joy, 0,
+ hatval_to_sdl(v) -
+ hitem.logical_minimum);
+ }
+ break;
+ }
+ case HUP_BUTTON:
+ v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
+ SDL_PrivateJoystickButton(joy, nbutton, v);
+ nbutton++;
+ break;
+ default:
+ continue;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ hid_end_parse(hdata);
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joy)
+{
+ if (SDL_strncmp(joy->hwdata->path, "/dev/joy", 8)) {
+ report_free(&joy->hwdata->inreport);
+ hid_dispose_report_desc(joy->hwdata->repdesc);
+ }
+ close(joy->hwdata->fd);
+ SDL_free(joy->hwdata->path);
+ SDL_free(joy->hwdata);
+}
+
+void
+SDL_SYS_JoystickQuit(void)
+{
+ int i;
+
+ for (i = 0; i < MAX_JOYS; i++) {
+ SDL_free(joynames[i]);
+ SDL_free(joydevnames[i]);
+ }
+
+ return;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = joystick->name;
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+static int
+report_alloc(struct report *r, struct report_desc *rd, int repind)
+{
+ int len;
+
+#ifdef __DragonFly__
+ len = hid_report_size(rd, r->rid, repinfo[repind].kind);
+#elif __FREEBSD__
+# if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
+# if (__FreeBSD_kernel_version <= 500111)
+ len = hid_report_size(rd, r->rid, repinfo[repind].kind);
+# else
+ len = hid_report_size(rd, repinfo[repind].kind, r->rid);
+# endif
+# else
+ len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
+# endif
+#else
+# ifdef USBHID_NEW
+ len = hid_report_size(rd, repinfo[repind].kind, r->rid);
+# else
+ len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
+# endif
+#endif
+
+ if (len < 0) {
+ return SDL_SetError("Negative HID report size");
+ }
+ r->size = len;
+
+ if (r->size > 0) {
+#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
+ r->buf = SDL_malloc(r->size);
+#else
+ r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
+ r->size);
+#endif
+ if (r->buf == NULL) {
+ return SDL_OutOfMemory();
+ }
+ } else {
+ r->buf = NULL;
+ }
+
+ r->status = SREPORT_CLEAN;
+ return 0;
+}
+
+static void
+report_free(struct report *r)
+{
+ SDL_free(r->buf);
+ r->status = SREPORT_UNINIT;
+}
+
+#endif /* SDL_JOYSTICK_USBHID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick.c
new file mode 100644
index 0000000..abfb1c6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick.c
@@ -0,0 +1,837 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_IOKIT
+
+#include <IOKit/hid/IOHIDLib.h>
+
+/* For force feedback testing. */
+#include <ForceFeedback/ForceFeedback.h>
+#include <ForceFeedback/ForceFeedbackConstants.h>
+
+#include "SDL_joystick.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+#include "SDL_sysjoystick_c.h"
+#include "SDL_events.h"
+#include "../../haptic/darwin/SDL_syshaptic_c.h" /* For haptic hot plugging */
+
+#define SDL_JOYSTICK_RUNLOOP_MODE CFSTR("SDLJoystick")
+
+/* The base object of the HID Manager API */
+static IOHIDManagerRef hidman = NULL;
+
+/* Linked list of all available devices */
+static recDevice *gpDeviceList = NULL;
+
+/* static incrementing counter for new joystick devices seen on the system. Devices should start with index 0 */
+static int s_joystick_instance_id = -1;
+
+static recDevice *GetDeviceForIndex(int device_index)
+{
+ recDevice *device = gpDeviceList;
+ while (device) {
+ if (!device->removed) {
+ if (device_index == 0)
+ break;
+
+ --device_index;
+ }
+ device = device->pNext;
+ }
+ return device;
+}
+
+static void
+FreeElementList(recElement *pElement)
+{
+ while (pElement) {
+ recElement *pElementNext = pElement->pNext;
+ SDL_free(pElement);
+ pElement = pElementNext;
+ }
+}
+
+static recDevice *
+FreeDevice(recDevice *removeDevice)
+{
+ recDevice *pDeviceNext = NULL;
+ if (removeDevice) {
+ if (removeDevice->deviceRef) {
+ IOHIDDeviceUnscheduleFromRunLoop(removeDevice->deviceRef, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
+ removeDevice->deviceRef = NULL;
+ }
+
+ /* save next device prior to disposing of this device */
+ pDeviceNext = removeDevice->pNext;
+
+ if ( gpDeviceList == removeDevice ) {
+ gpDeviceList = pDeviceNext;
+ } else {
+ recDevice *device = gpDeviceList;
+ while (device->pNext != removeDevice) {
+ device = device->pNext;
+ }
+ device->pNext = pDeviceNext;
+ }
+ removeDevice->pNext = NULL;
+
+ /* free element lists */
+ FreeElementList(removeDevice->firstAxis);
+ FreeElementList(removeDevice->firstButton);
+ FreeElementList(removeDevice->firstHat);
+
+ SDL_free(removeDevice);
+ }
+ return pDeviceNext;
+}
+
+static SDL_bool
+GetHIDElementState(recDevice *pDevice, recElement *pElement, SInt32 *pValue)
+{
+ SInt32 value = 0;
+ int returnValue = SDL_FALSE;
+
+ if (pDevice && pElement) {
+ IOHIDValueRef valueRef;
+ if (IOHIDDeviceGetValue(pDevice->deviceRef, pElement->elementRef, &valueRef) == kIOReturnSuccess) {
+ value = (SInt32) IOHIDValueGetIntegerValue(valueRef);
+
+ /* record min and max for auto calibration */
+ if (value < pElement->minReport) {
+ pElement->minReport = value;
+ }
+ if (value > pElement->maxReport) {
+ pElement->maxReport = value;
+ }
+ *pValue = value;
+
+ returnValue = SDL_TRUE;
+ }
+ }
+ return returnValue;
+}
+
+static SDL_bool
+GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max, SInt32 *pValue)
+{
+ const float deviceScale = max - min;
+ const float readScale = pElement->maxReport - pElement->minReport;
+ int returnValue = SDL_FALSE;
+ if (GetHIDElementState(pDevice, pElement, pValue))
+ {
+ if (readScale == 0) {
+ returnValue = SDL_TRUE; /* no scaling at all */
+ }
+ else
+ {
+ *pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min;
+ returnValue = SDL_TRUE;
+ }
+ }
+ return returnValue;
+}
+
+static void
+JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *sender)
+{
+ recDevice *device = (recDevice *) ctx;
+ device->removed = SDL_TRUE;
+ device->deviceRef = NULL; // deviceRef was invalidated due to the remove
+#if SDL_HAPTIC_IOKIT
+ MacHaptic_MaybeRemoveDevice(device->ffservice);
+#endif
+
+ SDL_PrivateJoystickRemoved(device->instance_id);
+}
+
+
+static void AddHIDElement(const void *value, void *parameter);
+
+/* Call AddHIDElement() on all elements in an array of IOHIDElementRefs */
+static void
+AddHIDElements(CFArrayRef array, recDevice *pDevice)
+{
+ const CFRange range = { 0, CFArrayGetCount(array) };
+ CFArrayApplyFunction(array, range, AddHIDElement, pDevice);
+}
+
+static SDL_bool
+ElementAlreadyAdded(const IOHIDElementCookie cookie, const recElement *listitem) {
+ while (listitem) {
+ if (listitem->cookie == cookie) {
+ return SDL_TRUE;
+ }
+ listitem = listitem->pNext;
+ }
+ return SDL_FALSE;
+}
+
+/* See if we care about this HID element, and if so, note it in our recDevice. */
+static void
+AddHIDElement(const void *value, void *parameter)
+{
+ recDevice *pDevice = (recDevice *) parameter;
+ IOHIDElementRef refElement = (IOHIDElementRef) value;
+ const CFTypeID elementTypeID = refElement ? CFGetTypeID(refElement) : 0;
+
+ if (refElement && (elementTypeID == IOHIDElementGetTypeID())) {
+ const IOHIDElementCookie cookie = IOHIDElementGetCookie(refElement);
+ const uint32_t usagePage = IOHIDElementGetUsagePage(refElement);
+ const uint32_t usage = IOHIDElementGetUsage(refElement);
+ recElement *element = NULL;
+ recElement **headElement = NULL;
+
+ /* look at types of interest */
+ switch (IOHIDElementGetType(refElement)) {
+ case kIOHIDElementTypeInput_Misc:
+ case kIOHIDElementTypeInput_Button:
+ case kIOHIDElementTypeInput_Axis: {
+ switch (usagePage) { /* only interested in kHIDPage_GenericDesktop and kHIDPage_Button */
+ case kHIDPage_GenericDesktop:
+ switch (usage) {
+ case kHIDUsage_GD_X:
+ case kHIDUsage_GD_Y:
+ case kHIDUsage_GD_Z:
+ case kHIDUsage_GD_Rx:
+ case kHIDUsage_GD_Ry:
+ case kHIDUsage_GD_Rz:
+ case kHIDUsage_GD_Slider:
+ case kHIDUsage_GD_Dial:
+ case kHIDUsage_GD_Wheel:
+ if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) {
+ element = (recElement *) SDL_calloc(1, sizeof (recElement));
+ if (element) {
+ pDevice->axes++;
+ headElement = &(pDevice->firstAxis);
+ }
+ }
+ break;
+
+ case kHIDUsage_GD_Hatswitch:
+ if (!ElementAlreadyAdded(cookie, pDevice->firstHat)) {
+ element = (recElement *) SDL_calloc(1, sizeof (recElement));
+ if (element) {
+ pDevice->hats++;
+ headElement = &(pDevice->firstHat);
+ }
+ }
+ break;
+ case kHIDUsage_GD_DPadUp:
+ case kHIDUsage_GD_DPadDown:
+ case kHIDUsage_GD_DPadRight:
+ case kHIDUsage_GD_DPadLeft:
+ case kHIDUsage_GD_Start:
+ case kHIDUsage_GD_Select:
+ case kHIDUsage_GD_SystemMainMenu:
+ if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
+ element = (recElement *) SDL_calloc(1, sizeof (recElement));
+ if (element) {
+ pDevice->buttons++;
+ headElement = &(pDevice->firstButton);
+ }
+ }
+ break;
+ }
+ break;
+
+ case kHIDPage_Simulation:
+ switch (usage) {
+ case kHIDUsage_Sim_Rudder:
+ case kHIDUsage_Sim_Throttle:
+ case kHIDUsage_Sim_Accelerator:
+ case kHIDUsage_Sim_Brake:
+ if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) {
+ element = (recElement *) SDL_calloc(1, sizeof (recElement));
+ if (element) {
+ pDevice->axes++;
+ headElement = &(pDevice->firstAxis);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case kHIDPage_Button:
+ case kHIDPage_Consumer: /* e.g. 'pause' button on Steelseries MFi gamepads. */
+ if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
+ element = (recElement *) SDL_calloc(1, sizeof (recElement));
+ if (element) {
+ pDevice->buttons++;
+ headElement = &(pDevice->firstButton);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case kIOHIDElementTypeCollection: {
+ CFArrayRef array = IOHIDElementGetChildren(refElement);
+ if (array) {
+ AddHIDElements(array, pDevice);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (element && headElement) { /* add to list */
+ recElement *elementPrevious = NULL;
+ recElement *elementCurrent = *headElement;
+ while (elementCurrent && usage >= elementCurrent->usage) {
+ elementPrevious = elementCurrent;
+ elementCurrent = elementCurrent->pNext;
+ }
+ if (elementPrevious) {
+ elementPrevious->pNext = element;
+ } else {
+ *headElement = element;
+ }
+
+ element->elementRef = refElement;
+ element->usagePage = usagePage;
+ element->usage = usage;
+ element->pNext = elementCurrent;
+
+ element->minReport = element->min = (SInt32) IOHIDElementGetLogicalMin(refElement);
+ element->maxReport = element->max = (SInt32) IOHIDElementGetLogicalMax(refElement);
+ element->cookie = IOHIDElementGetCookie(refElement);
+
+ pDevice->elements++;
+ }
+ }
+}
+
+static SDL_bool
+GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice)
+{
+ const Uint16 BUS_USB = 0x03;
+ const Uint16 BUS_BLUETOOTH = 0x05;
+ Sint32 vendor = 0;
+ Sint32 product = 0;
+ Sint32 version = 0;
+ CFTypeRef refCF = NULL;
+ CFArrayRef array = NULL;
+ Uint16 *guid16 = (Uint16 *)pDevice->guid.data;
+
+ /* get usage page and usage */
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsagePageKey));
+ if (refCF) {
+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->usagePage);
+ }
+ if (pDevice->usagePage != kHIDPage_GenericDesktop) {
+ return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */
+ }
+
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsageKey));
+ if (refCF) {
+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->usage);
+ }
+
+ if ((pDevice->usage != kHIDUsage_GD_Joystick &&
+ pDevice->usage != kHIDUsage_GD_GamePad &&
+ pDevice->usage != kHIDUsage_GD_MultiAxisController)) {
+ return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */
+ }
+
+ pDevice->deviceRef = hidDevice;
+
+ /* get device name */
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductKey));
+ if (!refCF) {
+ /* Maybe we can't get "AwesomeJoystick2000", but we can get "Logitech"? */
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDManufacturerKey));
+ }
+ if ((!refCF) || (!CFStringGetCString(refCF, pDevice->product, sizeof (pDevice->product), kCFStringEncodingUTF8))) {
+ SDL_strlcpy(pDevice->product, "Unidentified joystick", sizeof (pDevice->product));
+ }
+
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVendorIDKey));
+ if (refCF) {
+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &vendor);
+ }
+
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductIDKey));
+ if (refCF) {
+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &product);
+ }
+
+ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVersionNumberKey));
+ if (refCF) {
+ CFNumberGetValue(refCF, kCFNumberSInt32Type, &version);
+ }
+
+ SDL_memset(pDevice->guid.data, 0, sizeof(pDevice->guid.data));
+
+ if (vendor && product) {
+ *guid16++ = SDL_SwapLE16(BUS_USB);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16((Uint16)vendor);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16((Uint16)product);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16((Uint16)version);
+ *guid16++ = 0;
+ } else {
+ *guid16++ = SDL_SwapLE16(BUS_BLUETOOTH);
+ *guid16++ = 0;
+ SDL_strlcpy((char*)guid16, pDevice->product, sizeof(pDevice->guid.data) - 4);
+ }
+
+ array = IOHIDDeviceCopyMatchingElements(hidDevice, NULL, kIOHIDOptionsTypeNone);
+ if (array) {
+ AddHIDElements(array, pDevice);
+ CFRelease(array);
+ }
+
+ return SDL_TRUE;
+}
+
+static SDL_bool
+JoystickAlreadyKnown(IOHIDDeviceRef ioHIDDeviceObject)
+{
+ recDevice *i;
+ for (i = gpDeviceList; i != NULL; i = i->pNext) {
+ if (i->deviceRef == ioHIDDeviceObject) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+
+static void
+JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject)
+{
+ recDevice *device;
+ int device_index = 0;
+ io_service_t ioservice;
+
+ if (res != kIOReturnSuccess) {
+ return;
+ }
+
+ if (JoystickAlreadyKnown(ioHIDDeviceObject)) {
+ return; /* IOKit sent us a duplicate. */
+ }
+
+ device = (recDevice *) SDL_calloc(1, sizeof(recDevice));
+
+ if (!device) {
+ SDL_OutOfMemory();
+ return;
+ }
+
+ if (!GetDeviceInfo(ioHIDDeviceObject, device)) {
+ SDL_free(device);
+ return; /* not a device we care about, probably. */
+ }
+
+ if (SDL_IsGameControllerNameAndGUID(device->product, device->guid) &&
+ SDL_ShouldIgnoreGameController(device->product, device->guid)) {
+ SDL_free(device);
+ return;
+ }
+
+ /* Get notified when this device is disconnected. */
+ IOHIDDeviceRegisterRemovalCallback(ioHIDDeviceObject, JoystickDeviceWasRemovedCallback, device);
+ IOHIDDeviceScheduleWithRunLoop(ioHIDDeviceObject, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
+
+ /* Allocate an instance ID for this device */
+ device->instance_id = ++s_joystick_instance_id;
+
+ /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */
+ ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
+#if SDL_HAPTIC_IOKIT
+ if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
+ device->ffservice = ioservice;
+ MacHaptic_MaybeAddDevice(ioservice);
+ }
+#endif
+
+ /* Add device to the end of the list */
+ if ( !gpDeviceList ) {
+ gpDeviceList = device;
+ } else {
+ recDevice *curdevice;
+
+ curdevice = gpDeviceList;
+ while ( curdevice->pNext ) {
+ ++device_index;
+ curdevice = curdevice->pNext;
+ }
+ curdevice->pNext = device;
+ ++device_index; /* bump by one since we counted by pNext. */
+ }
+
+ SDL_PrivateJoystickAdded(device_index);
+}
+
+static SDL_bool
+ConfigHIDManager(CFArrayRef matchingArray)
+{
+ CFRunLoopRef runloop = CFRunLoopGetCurrent();
+
+ if (IOHIDManagerOpen(hidman, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {
+ return SDL_FALSE;
+ }
+
+ IOHIDManagerSetDeviceMatchingMultiple(hidman, matchingArray);
+ IOHIDManagerRegisterDeviceMatchingCallback(hidman, JoystickDeviceWasAddedCallback, NULL);
+ IOHIDManagerScheduleWithRunLoop(hidman, runloop, SDL_JOYSTICK_RUNLOOP_MODE);
+
+ while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
+ /* no-op. Callback fires once per existing device. */
+ }
+
+ /* future hotplug events will come through SDL_JOYSTICK_RUNLOOP_MODE now. */
+
+ return SDL_TRUE; /* good to go. */
+}
+
+
+static CFDictionaryRef
+CreateHIDDeviceMatchDictionary(const UInt32 page, const UInt32 usage, int *okay)
+{
+ CFDictionaryRef retval = NULL;
+ CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
+ CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
+ const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) };
+ const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef };
+
+ if (pageNumRef && usageNumRef) {
+ retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ }
+
+ if (pageNumRef) {
+ CFRelease(pageNumRef);
+ }
+ if (usageNumRef) {
+ CFRelease(usageNumRef);
+ }
+
+ if (!retval) {
+ *okay = 0;
+ }
+
+ return retval;
+}
+
+static SDL_bool
+CreateHIDManager(void)
+{
+ SDL_bool retval = SDL_FALSE;
+ int okay = 1;
+ const void *vals[] = {
+ (void *) CreateHIDDeviceMatchDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay),
+ (void *) CreateHIDDeviceMatchDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay),
+ (void *) CreateHIDDeviceMatchDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay),
+ };
+ const size_t numElements = SDL_arraysize(vals);
+ CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, numElements, &kCFTypeArrayCallBacks) : NULL;
+ size_t i;
+
+ for (i = 0; i < numElements; i++) {
+ if (vals[i]) {
+ CFRelease((CFTypeRef) vals[i]);
+ }
+ }
+
+ if (array) {
+ hidman = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
+ if (hidman != NULL) {
+ retval = ConfigHIDManager(array);
+ }
+ CFRelease(array);
+ }
+
+ return retval;
+}
+
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * This function should return the number of available joysticks, or -1
+ * on an unrecoverable fatal error.
+ */
+int
+SDL_SYS_JoystickInit(void)
+{
+ if (gpDeviceList) {
+ return SDL_SetError("Joystick: Device list already inited.");
+ }
+
+ if (!CreateHIDManager()) {
+ return SDL_SetError("Joystick: Couldn't initialize HID Manager");
+ }
+
+ return SDL_SYS_NumJoysticks();
+}
+
+/* Function to return the number of joystick devices plugged in right now */
+int
+SDL_SYS_NumJoysticks(void)
+{
+ recDevice *device = gpDeviceList;
+ int nJoySticks = 0;
+
+ while (device) {
+ if (!device->removed) {
+ nJoySticks++;
+ }
+ device = device->pNext;
+ }
+
+ return nJoySticks;
+}
+
+/* Function to cause any queued joystick insertions to be processed
+ */
+void
+SDL_SYS_JoystickDetect(void)
+{
+ recDevice *device = gpDeviceList;
+ while (device) {
+ if (device->removed) {
+ device = FreeDevice(device);
+ } else {
+ device = device->pNext;
+ }
+ }
+
+ /* run this after the checks above so we don't set device->removed and delete the device before
+ SDL_SYS_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */
+ while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
+ /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
+ }
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ recDevice *device = GetDeviceForIndex(device_index);
+ return device ? device->product : "UNKNOWN";
+}
+
+/* Function to return the instance id of the joystick at device_index
+ */
+SDL_JoystickID
+SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ recDevice *device = GetDeviceForIndex(device_index);
+ return device ? device->instance_id : 0;
+}
+
+/* Function to open a joystick for use.
+ * The joystick to open is specified by the device index.
+ * This should fill the nbuttons and naxes fields of the joystick structure.
+ * It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ recDevice *device = GetDeviceForIndex(device_index);
+
+ joystick->instance_id = device->instance_id;
+ joystick->hwdata = device;
+ joystick->name = device->product;
+
+ joystick->naxes = device->axes;
+ joystick->nhats = device->hats;
+ joystick->nballs = 0;
+ joystick->nbuttons = device->buttons;
+ return 0;
+}
+
+/* Function to query if the joystick is currently attached
+ * It returns SDL_TRUE if attached, SDL_FALSE otherwise.
+ */
+SDL_bool
+SDL_SYS_JoystickAttached(SDL_Joystick * joystick)
+{
+ return joystick->hwdata != NULL;
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ recDevice *device = joystick->hwdata;
+ recElement *element;
+ SInt32 value, range;
+ int i;
+
+ if (!device) {
+ return;
+ }
+
+ if (device->removed) { /* device was unplugged; ignore it. */
+ if (joystick->hwdata) {
+ joystick->force_recentering = SDL_TRUE;
+ joystick->hwdata = NULL;
+ }
+ return;
+ }
+
+ element = device->firstAxis;
+ i = 0;
+
+ int goodRead = SDL_FALSE;
+ while (element) {
+ goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value);
+ if (goodRead) {
+ SDL_PrivateJoystickAxis(joystick, i, value);
+ }
+
+ element = element->pNext;
+ ++i;
+ }
+
+ element = device->firstButton;
+ i = 0;
+ while (element) {
+ goodRead = GetHIDElementState(device, element, &value);
+ if (goodRead) {
+ if (value > 1) { /* handle pressure-sensitive buttons */
+ value = 1;
+ }
+ SDL_PrivateJoystickButton(joystick, i, value);
+ }
+
+ element = element->pNext;
+ ++i;
+ }
+
+ element = device->firstHat;
+ i = 0;
+
+ while (element) {
+ Uint8 pos = 0;
+
+ range = (element->max - element->min + 1);
+ goodRead = GetHIDElementState(device, element, &value);
+ if (goodRead) {
+ value -= element->min;
+ if (range == 4) { /* 4 position hatswitch - scale up value */
+ value *= 2;
+ } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */
+ value = -1;
+ }
+ switch (value) {
+ case 0:
+ pos = SDL_HAT_UP;
+ break;
+ case 1:
+ pos = SDL_HAT_RIGHTUP;
+ break;
+ case 2:
+ pos = SDL_HAT_RIGHT;
+ break;
+ case 3:
+ pos = SDL_HAT_RIGHTDOWN;
+ break;
+ case 4:
+ pos = SDL_HAT_DOWN;
+ break;
+ case 5:
+ pos = SDL_HAT_LEFTDOWN;
+ break;
+ case 6:
+ pos = SDL_HAT_LEFT;
+ break;
+ case 7:
+ pos = SDL_HAT_LEFTUP;
+ break;
+ default:
+ /* Every other value is mapped to center. We do that because some
+ * joysticks use 8 and some 15 for this value, and apparently
+ * there are even more variants out there - so we try to be generous.
+ */
+ pos = SDL_HAT_CENTERED;
+ break;
+ }
+
+ SDL_PrivateJoystickHat(joystick, i, pos);
+ }
+
+ element = element->pNext;
+ ++i;
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+ while (FreeDevice(gpDeviceList)) {
+ /* spin */
+ }
+
+ if (hidman) {
+ IOHIDManagerUnscheduleFromRunLoop(hidman, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
+ IOHIDManagerClose(hidman, kIOHIDOptionsTypeNone);
+ CFRelease(hidman);
+ hidman = NULL;
+ }
+}
+
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ recDevice *device = GetDeviceForIndex(device_index);
+ SDL_JoystickGUID guid;
+ if (device) {
+ guid = device->guid;
+ } else {
+ SDL_zero(guid);
+ }
+ return guid;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick *joystick)
+{
+ return joystick->hwdata->guid;
+}
+
+#endif /* SDL_JOYSTICK_IOKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h b/src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h
new file mode 100644
index 0000000..cde6a5c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h
@@ -0,0 +1,73 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_JOYSTICK_IOKIT_H
+#define SDL_JOYSTICK_IOKIT_H
+
+#include <IOKit/hid/IOHIDLib.h>
+
+struct recElement
+{
+ IOHIDElementRef elementRef;
+ IOHIDElementCookie cookie;
+ uint32_t usagePage, usage; /* HID usage */
+ SInt32 min; /* reported min value possible */
+ SInt32 max; /* reported max value possible */
+
+ /* runtime variables used for auto-calibration */
+ SInt32 minReport; /* min returned value */
+ SInt32 maxReport; /* max returned value */
+
+ struct recElement *pNext; /* next element in list */
+};
+typedef struct recElement recElement;
+
+struct joystick_hwdata
+{
+ IOHIDDeviceRef deviceRef; /* HIDManager device handle */
+ io_service_t ffservice; /* Interface for force feedback, 0 = no ff */
+
+ char product[256]; /* name of product */
+ uint32_t usage; /* usage page from IOUSBHID Parser.h which defines general usage */
+ uint32_t usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
+
+ int axes; /* number of axis (calculated, not reported by device) */
+ int buttons; /* number of buttons (calculated, not reported by device) */
+ int hats; /* number of hat switches (calculated, not reported by device) */
+ int elements; /* number of total elements (should be total of above) (calculated, not reported by device) */
+
+ recElement *firstAxis;
+ recElement *firstButton;
+ recElement *firstHat;
+
+ SDL_bool removed;
+
+ int instance_id;
+ SDL_JoystickGUID guid;
+
+ struct joystick_hwdata *pNext; /* next device */
+};
+typedef struct joystick_hwdata recDevice;
+
+#endif /* SDL_JOYSTICK_IOKIT_H */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/dummy/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/dummy/SDL_sysjoystick.c
new file mode 100644
index 0000000..3dd96a0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/dummy/SDL_sysjoystick.c
@@ -0,0 +1,127 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED)
+
+/* This is the dummy implementation of the SDL joystick API */
+
+#include "SDL_joystick.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+
+/* Function to scan the system for joysticks.
+ * It should return 0, or -1 on an unrecoverable fatal error.
+ */
+int
+SDL_SYS_JoystickInit(void)
+{
+ return 0;
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return 0;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ SDL_SetError("Logic error: No joysticks available");
+ return (NULL);
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return device_index;
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ return SDL_SetError("Logic error: No joysticks available");
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return SDL_TRUE;
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = joystick->name;
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+#endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick.c
new file mode 100644
index 0000000..b5bcaad
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick.c
@@ -0,0 +1,403 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_EMSCRIPTEN
+
+#include <stdio.h> /* For the definition of NULL */
+#include "SDL_error.h"
+#include "SDL_events.h"
+
+#include "SDL_joystick.h"
+#include "SDL_assert.h"
+#include "SDL_timer.h"
+#include "SDL_log.h"
+#include "SDL_sysjoystick_c.h"
+#include "../SDL_joystick_c.h"
+
+static SDL_joylist_item * JoystickByIndex(int index);
+
+static SDL_joylist_item *SDL_joylist = NULL;
+static SDL_joylist_item *SDL_joylist_tail = NULL;
+static int numjoysticks = 0;
+static int instance_counter = 0;
+
+static EM_BOOL
+Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)
+{
+ int i;
+
+ SDL_joylist_item *item;
+
+ if (JoystickByIndex(gamepadEvent->index) != NULL) {
+ return 1;
+ }
+
+ item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item));
+ if (item == NULL) {
+ return 1;
+ }
+
+ SDL_zerop(item);
+ item->index = gamepadEvent->index;
+
+ item->name = SDL_strdup(gamepadEvent->id);
+ if ( item->name == NULL ) {
+ SDL_free(item);
+ return 1;
+ }
+
+ item->mapping = SDL_strdup(gamepadEvent->mapping);
+ if ( item->mapping == NULL ) {
+ SDL_free(item->name);
+ SDL_free(item);
+ return 1;
+ }
+
+ item->naxes = gamepadEvent->numAxes;
+ item->nbuttons = gamepadEvent->numButtons;
+ item->device_instance = instance_counter++;
+
+ item->timestamp = gamepadEvent->timestamp;
+
+ for( i = 0; i < item->naxes; i++) {
+ item->axis[i] = gamepadEvent->axis[i];
+ }
+
+ for( i = 0; i < item->nbuttons; i++) {
+ item->analogButton[i] = gamepadEvent->analogButton[i];
+ item->digitalButton[i] = gamepadEvent->digitalButton[i];
+ }
+
+ if (SDL_joylist_tail == NULL) {
+ SDL_joylist = SDL_joylist_tail = item;
+ } else {
+ SDL_joylist_tail->next = item;
+ SDL_joylist_tail = item;
+ }
+
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+
+#ifdef DEBUG_JOYSTICK
+ SDL_Log("Number of joysticks is %d", numjoysticks);
+#endif
+
+#ifdef DEBUG_JOYSTICK
+ SDL_Log("Added joystick with index %d", item->index);
+#endif
+
+ return 1;
+}
+
+static EM_BOOL
+Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)
+{
+ SDL_joylist_item *item = SDL_joylist;
+ SDL_joylist_item *prev = NULL;
+
+ while (item != NULL) {
+ if (item->index == gamepadEvent->index) {
+ break;
+ }
+ prev = item;
+ item = item->next;
+ }
+
+ if (item == NULL) {
+ return 1;
+ }
+
+ if (item->joystick) {
+ item->joystick->hwdata = NULL;
+ }
+
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_joylist == item);
+ SDL_joylist = item->next;
+ }
+ if (item == SDL_joylist_tail) {
+ SDL_joylist_tail = prev;
+ }
+
+ /* Need to decrement the joystick count before we post the event */
+ --numjoysticks;
+
+ SDL_PrivateJoystickRemoved(item->device_instance);
+
+#ifdef DEBUG_JOYSTICK
+ SDL_Log("Removed joystick with id %d", item->device_instance);
+#endif
+ SDL_free(item->name);
+ SDL_free(item->mapping);
+ SDL_free(item);
+ return 1;
+}
+
+/* Function to scan the system for joysticks.
+ * It should return 0, or -1 on an unrecoverable fatal error.
+ */
+int
+SDL_SYS_JoystickInit(void)
+{
+ int retval, i, numjs;
+ EmscriptenGamepadEvent gamepadState;
+
+ numjoysticks = 0;
+ numjs = emscripten_get_num_gamepads();
+
+ /* Check if gamepad is supported by browser */
+ if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
+ return SDL_SetError("Gamepads not supported");
+ }
+
+ /* handle already connected gamepads */
+ if (numjs > 0) {
+ for(i = 0; i < numjs; i++) {
+ retval = emscripten_get_gamepad_status(i, &gamepadState);
+ if (retval == EMSCRIPTEN_RESULT_SUCCESS) {
+ Emscripten_JoyStickConnected(EMSCRIPTEN_EVENT_GAMEPADCONNECTED,
+ &gamepadState,
+ NULL);
+ }
+ }
+ }
+
+ retval = emscripten_set_gamepadconnected_callback(NULL,
+ 0,
+ Emscripten_JoyStickConnected);
+
+ if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
+ SDL_SYS_JoystickQuit();
+ return SDL_SetError("Could not set gamepad connect callback");
+ }
+
+ retval = emscripten_set_gamepaddisconnected_callback(NULL,
+ 0,
+ Emscripten_JoyStickDisconnected);
+ if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
+ SDL_SYS_JoystickQuit();
+ return SDL_SetError("Could not set gamepad disconnect callback");
+ }
+
+ return 0;
+}
+
+/* Returns item matching given SDL device index. */
+static SDL_joylist_item *
+JoystickByDeviceIndex(int device_index)
+{
+ SDL_joylist_item *item = SDL_joylist;
+
+ while (0 < device_index) {
+ --device_index;
+ item = item->next;
+ }
+
+ return item;
+}
+
+/* Returns item matching given HTML gamepad index. */
+static SDL_joylist_item *
+JoystickByIndex(int index)
+{
+ SDL_joylist_item *item = SDL_joylist;
+
+ if (index < 0) {
+ return NULL;
+ }
+
+ while (item != NULL) {
+ if (item->index == index) {
+ break;
+ }
+ item = item->next;
+ }
+
+ return item;
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return numjoysticks;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ return JoystickByDeviceIndex(device_index)->name;
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return JoystickByDeviceIndex(device_index)->device_instance;
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ SDL_joylist_item *item = JoystickByDeviceIndex(device_index);
+
+ if (item == NULL ) {
+ return SDL_SetError("No such device");
+ }
+
+ if (item->joystick != NULL) {
+ return SDL_SetError("Joystick already opened");
+ }
+
+ joystick->instance_id = item->device_instance;
+ joystick->hwdata = (struct joystick_hwdata *) item;
+ item->joystick = joystick;
+
+ /* HTML5 Gamepad API doesn't say anything about these */
+ joystick->nhats = 0;
+ joystick->nballs = 0;
+
+ joystick->nbuttons = item->nbuttons;
+ joystick->naxes = item->naxes;
+
+ return (0);
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return joystick->hwdata != NULL;
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ EmscriptenGamepadEvent gamepadState;
+ SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata;
+ int i, result, buttonState;
+
+ if (item) {
+ result = emscripten_get_gamepad_status(item->index, &gamepadState);
+ if( result == EMSCRIPTEN_RESULT_SUCCESS) {
+ if(gamepadState.timestamp == 0 || gamepadState.timestamp != item->timestamp) {
+ for(i = 0; i < item->nbuttons; i++) {
+ if(item->digitalButton[i] != gamepadState.digitalButton[i]) {
+ buttonState = gamepadState.digitalButton[i]? SDL_PRESSED: SDL_RELEASED;
+ SDL_PrivateJoystickButton(item->joystick, i, buttonState);
+ }
+
+ /* store values to compare them in the next update */
+ item->analogButton[i] = gamepadState.analogButton[i];
+ item->digitalButton[i] = gamepadState.digitalButton[i];
+ }
+
+ for(i = 0; i < item->naxes; i++) {
+ if(item->axis[i] != gamepadState.axis[i]) {
+ /* do we need to do conversion? */
+ SDL_PrivateJoystickAxis(item->joystick, i,
+ (Sint16) (32767.*gamepadState.axis[i]));
+ }
+
+ /* store to compare in next update */
+ item->axis[i] = gamepadState.axis[i];
+ }
+
+ item->timestamp = gamepadState.timestamp;
+ }
+ }
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+ SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata;
+ if (item) {
+ item->joystick = NULL;
+ }
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+ SDL_joylist_item *item = NULL;
+ SDL_joylist_item *next = NULL;
+
+ for (item = SDL_joylist; item; item = next) {
+ next = item->next;
+ SDL_free(item->mapping);
+ SDL_free(item->name);
+ SDL_free(item);
+ }
+
+ SDL_joylist = SDL_joylist_tail = NULL;
+
+ numjoysticks = 0;
+ instance_counter = 0;
+
+ emscripten_set_gamepadconnected_callback(NULL, 0, NULL);
+ emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL);
+}
+
+SDL_JoystickGUID
+SDL_SYS_JoystickGetDeviceGUID(int device_index)
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = SDL_SYS_JoystickNameForDeviceIndex(device_index);
+ SDL_zero(guid);
+ SDL_memcpy(&guid, name, SDL_min(sizeof(guid), SDL_strlen(name)));
+ return guid;
+}
+
+SDL_JoystickGUID
+SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = joystick->name;
+ SDL_zero(guid);
+ SDL_memcpy(&guid, name, SDL_min(sizeof(guid), SDL_strlen(name)));
+ return guid;
+}
+
+#endif /* SDL_JOYSTICK_EMSCRIPTEN */
diff --git a/src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h b/src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h
new file mode 100644
index 0000000..0c2be1d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_EMSCRIPTEN
+#include "../SDL_sysjoystick.h"
+
+
+#include <emscripten/html5.h>
+
+/* A linked list of available joysticks */
+typedef struct SDL_joylist_item
+{
+ int index;
+ char *name;
+ char *mapping;
+ SDL_JoystickID device_instance;
+ SDL_Joystick *joystick;
+ int nbuttons;
+ int naxes;
+ double timestamp;
+ double axis[64];
+ double analogButton[64];
+ EM_BOOL digitalButton[64];
+
+ struct SDL_joylist_item *next;
+} SDL_joylist_item;
+
+typedef SDL_joylist_item joystick_hwdata;
+
+#endif /* SDL_JOYSTICK_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/haiku/SDL_haikujoystick.cc b/src/3rdparty/SDL2/src/joystick/haiku/SDL_haikujoystick.cc
new file mode 100644
index 0000000..9ab2c72
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/haiku/SDL_haikujoystick.cc
@@ -0,0 +1,266 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_HAIKU
+
+/* This is the Haiku implementation of the SDL joystick API */
+
+#include <support/String.h>
+#include <device/Joystick.h>
+
+extern "C"
+{
+
+#include "SDL_joystick.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+
+
+/* The maximum number of joysticks we'll detect */
+#define MAX_JOYSTICKS 16
+
+/* A list of available joysticks */
+ static char *SDL_joyport[MAX_JOYSTICKS];
+ static char *SDL_joyname[MAX_JOYSTICKS];
+
+/* The private structure used to keep track of a joystick */
+ struct joystick_hwdata
+ {
+ BJoystick *stick;
+ uint8 *new_hats;
+ int16 *new_axes;
+ };
+
+ static int SDL_SYS_numjoysticks = 0;
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * It should return 0, or -1 on an unrecoverable fatal error.
+ */
+ int SDL_SYS_JoystickInit(void)
+ {
+ BJoystick joystick;
+ int i;
+ int32 nports;
+ char name[B_OS_NAME_LENGTH];
+
+ /* Search for attached joysticks */
+ nports = joystick.CountDevices();
+ SDL_SYS_numjoysticks = 0;
+ SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport));
+ SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname));
+ for (i = 0; (SDL_SYS_numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i)
+ {
+ if (joystick.GetDeviceName(i, name) == B_OK) {
+ if (joystick.Open(name) != B_ERROR) {
+ BString stick_name;
+ joystick.GetControllerName(&stick_name);
+ SDL_joyport[SDL_SYS_numjoysticks] = SDL_strdup(name);
+ SDL_joyname[SDL_SYS_numjoysticks] = SDL_strdup(stick_name.String());
+ SDL_SYS_numjoysticks++;
+ joystick.Close();
+ }
+ }
+ }
+ return (SDL_SYS_numjoysticks);
+ }
+
+ int SDL_SYS_NumJoysticks(void)
+ {
+ return SDL_SYS_numjoysticks;
+ }
+
+ void SDL_SYS_JoystickDetect(void)
+ {
+ }
+
+/* Function to get the device-dependent name of a joystick */
+ const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+ {
+ return SDL_joyname[device_index];
+ }
+
+/* Function to perform the mapping from device index to the instance id for this index */
+ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+ {
+ return device_index;
+ }
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+ int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+ {
+ BJoystick *stick;
+
+ /* Create the joystick data structure */
+ joystick->instance_id = device_index;
+ joystick->hwdata = (struct joystick_hwdata *)
+ SDL_malloc(sizeof(*joystick->hwdata));
+ if (joystick->hwdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
+ stick = new BJoystick;
+ joystick->hwdata->stick = stick;
+
+ /* Open the requested joystick for use */
+ if (stick->Open(SDL_joyport[device_index]) == B_ERROR) {
+ SDL_SYS_JoystickClose(joystick);
+ return SDL_SetError("Unable to open joystick");
+ }
+
+ /* Set the joystick to calibrated mode */
+ stick->EnableCalibration();
+
+ /* Get the number of buttons, hats, and axes on the joystick */
+ joystick->nbuttons = stick->CountButtons();
+ joystick->naxes = stick->CountAxes();
+ joystick->nhats = stick->CountHats();
+
+ joystick->hwdata->new_axes = (int16 *)
+ SDL_malloc(joystick->naxes * sizeof(int16));
+ joystick->hwdata->new_hats = (uint8 *)
+ SDL_malloc(joystick->nhats * sizeof(uint8));
+ if (!joystick->hwdata->new_hats || !joystick->hwdata->new_axes) {
+ SDL_SYS_JoystickClose(joystick);
+ return SDL_OutOfMemory();
+ }
+
+ /* We're done! */
+ return (0);
+ }
+
+/* Function to determine if this joystick is attached to the system right now */
+ SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+ {
+ return SDL_TRUE;
+ }
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+ void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+ {
+ static const Uint8 hat_map[9] = {
+ SDL_HAT_CENTERED,
+ SDL_HAT_UP,
+ SDL_HAT_RIGHTUP,
+ SDL_HAT_RIGHT,
+ SDL_HAT_RIGHTDOWN,
+ SDL_HAT_DOWN,
+ SDL_HAT_LEFTDOWN,
+ SDL_HAT_LEFT,
+ SDL_HAT_LEFTUP
+ };
+
+ BJoystick *stick;
+ int i;
+ int16 *axes;
+ uint8 *hats;
+ uint32 buttons;
+
+ /* Set up data pointers */
+ stick = joystick->hwdata->stick;
+ axes = joystick->hwdata->new_axes;
+ hats = joystick->hwdata->new_hats;
+
+ /* Get the new joystick state */
+ stick->Update();
+ stick->GetAxisValues(axes);
+ stick->GetHatValues(hats);
+ buttons = stick->ButtonValues();
+
+ /* Generate axis motion events */
+ for (i = 0; i < joystick->naxes; ++i) {
+ SDL_PrivateJoystickAxis(joystick, i, axes[i]);
+ }
+
+ /* Generate hat change events */
+ for (i = 0; i < joystick->nhats; ++i) {
+ SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]);
+ }
+
+ /* Generate button events */
+ for (i = 0; i < joystick->nbuttons; ++i) {
+ SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01));
+ buttons >>= 1;
+ }
+ }
+
+/* Function to close a joystick after use */
+ void SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+ {
+ if (joystick->hwdata) {
+ joystick->hwdata->stick->Close();
+ delete joystick->hwdata->stick;
+ SDL_free(joystick->hwdata->new_hats);
+ SDL_free(joystick->hwdata->new_axes);
+ SDL_free(joystick->hwdata);
+ }
+ }
+
+/* Function to perform any system-specific joystick related cleanup */
+ void SDL_SYS_JoystickQuit(void)
+ {
+ int i;
+
+ for (i = 0; i < SDL_SYS_numjoysticks; ++i) {
+ SDL_free(SDL_joyport[i]);
+ }
+ SDL_joyport[0] = NULL;
+
+ for (i = 0; i < SDL_SYS_numjoysticks; ++i) {
+ SDL_free(SDL_joyname[i]);
+ }
+ SDL_joyname[0] = NULL;
+ }
+
+ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+ {
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+ }
+
+ SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+ {
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = joystick->name;
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+ }
+
+}; // extern "C"
+
+#endif /* SDL_JOYSTICK_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m b/src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m
new file mode 100644
index 0000000..d601498
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m
@@ -0,0 +1,795 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* This is the iOS implementation of the SDL joystick API */
+#include "SDL_sysjoystick_c.h"
+
+/* needed for SDL_IPHONE_MAX_GFORCE macro */
+#include "SDL_config_iphoneos.h"
+
+#include "SDL_assert.h"
+#include "SDL_events.h"
+#include "SDL_joystick.h"
+#include "SDL_hints.h"
+#include "SDL_stdinc.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+#include "../steam/SDL_steamcontroller.h"
+
+
+#if !SDL_EVENTS_DISABLED
+#include "../../events/SDL_events_c.h"
+#endif
+
+#if !TARGET_OS_TV
+#import <CoreMotion/CoreMotion.h>
+#endif
+
+#ifdef SDL_JOYSTICK_MFI
+#import <GameController/GameController.h>
+
+static id connectObserver = nil;
+static id disconnectObserver = nil;
+#endif /* SDL_JOYSTICK_MFI */
+
+#if !TARGET_OS_TV
+static const char *accelerometerName = "iOS Accelerometer";
+static CMMotionManager *motionManager = nil;
+#endif /* !TARGET_OS_TV */
+
+static SDL_JoystickDeviceItem *deviceList = NULL;
+
+static int numjoysticks = 0;
+static SDL_JoystickID instancecounter = 0;
+int SDL_AppleTVRemoteOpenedAsJoystick = 0;
+
+static SDL_JoystickDeviceItem *
+GetDeviceForIndex(int device_index)
+{
+ SDL_JoystickDeviceItem *device = deviceList;
+ int i = 0;
+
+ while (i < device_index) {
+ if (device == NULL) {
+ return NULL;
+ }
+ device = device->next;
+ i++;
+ }
+
+ return device;
+}
+
+static void
+SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller)
+{
+#ifdef SDL_JOYSTICK_MFI
+ const char *name = NULL;
+ /* Explicitly retain the controller because SDL_JoystickDeviceItem is a
+ * struct, and ARC doesn't work with structs. */
+ device->controller = (__bridge GCController *) CFBridgingRetain(controller);
+
+ if (controller.vendorName) {
+ name = controller.vendorName.UTF8String;
+ }
+
+ if (!name) {
+ name = "MFi Gamepad";
+ }
+
+ device->name = SDL_strdup(name);
+
+ device->guid.data[0] = 'M';
+ device->guid.data[1] = 'F';
+ device->guid.data[2] = 'i';
+ device->guid.data[3] = 'G';
+ device->guid.data[4] = 'a';
+ device->guid.data[5] = 'm';
+ device->guid.data[6] = 'e';
+ device->guid.data[7] = 'p';
+ device->guid.data[8] = 'a';
+ device->guid.data[9] = 'd';
+
+ if (controller.extendedGamepad) {
+ device->guid.data[10] = 1;
+ } else if (controller.gamepad) {
+ device->guid.data[10] = 2;
+ }
+#if TARGET_OS_TV
+ else if (controller.microGamepad) {
+ device->guid.data[10] = 3;
+ device->remote = SDL_TRUE;
+ }
+#endif /* TARGET_OS_TV */
+
+ if (controller.extendedGamepad) {
+ device->naxes = 6; /* 2 thumbsticks and 2 triggers */
+ device->nhats = 1; /* d-pad */
+ device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */
+ } else if (controller.gamepad) {
+ device->naxes = 0; /* no traditional analog inputs */
+ device->nhats = 1; /* d-pad */
+ device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */
+ }
+#if TARGET_OS_TV
+ else if (controller.microGamepad) {
+ device->naxes = 2; /* treat the touch surface as two axes */
+ device->nhats = 0; /* apparently the touch surface-as-dpad is buggy */
+ device->nbuttons = 3; /* AX, pause button */
+
+ controller.microGamepad.allowsRotation = SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, SDL_FALSE);
+ }
+#endif /* TARGET_OS_TV */
+
+ /* This will be set when the first button press of the controller is
+ * detected. */
+ controller.playerIndex = -1;
+
+#endif /* SDL_JOYSTICK_MFI */
+}
+
+static void
+SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer)
+{
+ SDL_JoystickDeviceItem *device = deviceList;
+
+#if TARGET_OS_TV
+ if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
+ /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */
+ if (controller && !controller.extendedGamepad && !controller.gamepad && controller.microGamepad) {
+ return;
+ }
+ }
+#endif
+
+ while (device != NULL) {
+ if (device->controller == controller) {
+ return;
+ }
+ device = device->next;
+ }
+
+ device = (SDL_JoystickDeviceItem *) SDL_calloc(1, sizeof(SDL_JoystickDeviceItem));
+ if (device == NULL) {
+ return;
+ }
+
+ device->accelerometer = accelerometer;
+ device->instance_id = instancecounter++;
+
+ if (accelerometer) {
+#if TARGET_OS_TV
+ SDL_free(device);
+ return;
+#else
+ device->name = SDL_strdup(accelerometerName);
+ device->naxes = 3; /* Device acceleration in the x, y, and z axes. */
+ device->nhats = 0;
+ device->nbuttons = 0;
+
+ /* Use the accelerometer name as a GUID. */
+ SDL_memcpy(&device->guid.data, device->name, SDL_min(sizeof(SDL_JoystickGUID), SDL_strlen(device->name)));
+#endif /* TARGET_OS_TV */
+ } else if (controller) {
+ SDL_SYS_AddMFIJoystickDevice(device, controller);
+ }
+
+ if (deviceList == NULL) {
+ deviceList = device;
+ } else {
+ SDL_JoystickDeviceItem *lastdevice = deviceList;
+ while (lastdevice->next != NULL) {
+ lastdevice = lastdevice->next;
+ }
+ lastdevice->next = device;
+ }
+
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+}
+
+static SDL_JoystickDeviceItem *
+SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
+{
+ SDL_JoystickDeviceItem *prev = NULL;
+ SDL_JoystickDeviceItem *next = NULL;
+ SDL_JoystickDeviceItem *item = deviceList;
+
+ if (device == NULL) {
+ return NULL;
+ }
+
+ next = device->next;
+
+ while (item != NULL) {
+ if (item == device) {
+ break;
+ }
+ prev = item;
+ item = item->next;
+ }
+
+ /* Unlink the device item from the device list. */
+ if (prev) {
+ prev->next = device->next;
+ } else if (device == deviceList) {
+ deviceList = device->next;
+ }
+
+ if (device->joystick) {
+ device->joystick->hwdata = NULL;
+ }
+
+#ifdef SDL_JOYSTICK_MFI
+ @autoreleasepool {
+ if (device->controller) {
+ /* The controller was explicitly retained in the struct, so it
+ * should be explicitly released before freeing the struct. */
+ GCController *controller = CFBridgingRelease((__bridge CFTypeRef)(device->controller));
+ controller.controllerPausedHandler = nil;
+ device->controller = nil;
+ }
+ }
+#endif /* SDL_JOYSTICK_MFI */
+
+ --numjoysticks;
+
+ SDL_PrivateJoystickRemoved(device->instance_id);
+
+ SDL_free(device->name);
+ SDL_free(device);
+
+ return next;
+}
+
+#if TARGET_OS_TV
+static void SDLCALL
+SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue)
+{
+ BOOL allowRotation = newValue != NULL && *newValue != '0';
+
+ @autoreleasepool {
+ for (GCController *controller in [GCController controllers]) {
+ if (controller.microGamepad) {
+ controller.microGamepad.allowsRotation = allowRotation;
+ }
+ }
+ }
+}
+#endif /* TARGET_OS_TV */
+
+static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance)
+{
+ SDL_JoystickDeviceItem *device = (SDL_JoystickDeviceItem *)SDL_calloc(1, sizeof(SDL_JoystickDeviceItem));
+ if (device == NULL) {
+ return SDL_FALSE;
+ }
+
+ *device_instance = device->instance_id = instancecounter++;
+ device->name = SDL_strdup(name);
+ device->guid = guid;
+ SDL_GetSteamControllerInputs(&device->nbuttons,
+ &device->naxes,
+ &device->nhats);
+ device->m_bSteamController = SDL_TRUE;
+
+ if (deviceList == NULL) {
+ deviceList = device;
+ } else {
+ SDL_JoystickDeviceItem *lastdevice = deviceList;
+ while (lastdevice->next != NULL) {
+ lastdevice = lastdevice->next;
+ }
+ lastdevice->next = device;
+ }
+
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+
+ return SDL_TRUE;
+}
+
+static void SteamControllerDisconnectedCallback(int device_instance)
+{
+ SDL_JoystickDeviceItem *item;
+
+ for (item = deviceList; item; item = item->next) {
+ if (item->instance_id == device_instance) {
+ SDL_SYS_RemoveJoystickDevice(item);
+ break;
+ }
+ }
+}
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * It should return 0, or -1 on an unrecoverable fatal error.
+ */
+int
+SDL_SYS_JoystickInit(void)
+{
+ @autoreleasepool {
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+
+ SDL_InitSteamControllers(SteamControllerConnectedCallback,
+ SteamControllerDisconnectedCallback);
+
+#if !TARGET_OS_TV
+ if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
+ /* Default behavior, accelerometer as joystick */
+ SDL_SYS_AddJoystickDevice(nil, SDL_TRUE);
+ }
+#endif /* !TARGET_OS_TV */
+
+#ifdef SDL_JOYSTICK_MFI
+ /* GameController.framework was added in iOS 7. */
+ if (![GCController class]) {
+ return numjoysticks;
+ }
+
+ for (GCController *controller in [GCController controllers]) {
+ SDL_SYS_AddJoystickDevice(controller, SDL_FALSE);
+ }
+
+#if TARGET_OS_TV
+ SDL_AddHintCallback(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION,
+ SDL_AppleTVRemoteRotationHintChanged, NULL);
+#endif /* TARGET_OS_TV */
+
+ connectObserver = [center addObserverForName:GCControllerDidConnectNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification *note) {
+ GCController *controller = note.object;
+ SDL_SYS_AddJoystickDevice(controller, SDL_FALSE);
+ }];
+
+ disconnectObserver = [center addObserverForName:GCControllerDidDisconnectNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification *note) {
+ GCController *controller = note.object;
+ SDL_JoystickDeviceItem *device = deviceList;
+ while (device != NULL) {
+ if (device->controller == controller) {
+ SDL_SYS_RemoveJoystickDevice(device);
+ break;
+ }
+ device = device->next;
+ }
+ }];
+#endif /* SDL_JOYSTICK_MFI */
+ }
+
+ return numjoysticks;
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return numjoysticks;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+ SDL_UpdateSteamControllers();
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+ return device ? device->name : "Unknown";
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+ return device ? device->instance_id : 0;
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+ if (device == NULL) {
+ return SDL_SetError("Could not open Joystick: no hardware device for the specified index");
+ }
+
+ joystick->hwdata = device;
+ joystick->instance_id = device->instance_id;
+
+ joystick->naxes = device->naxes;
+ joystick->nhats = device->nhats;
+ joystick->nbuttons = device->nbuttons;
+ joystick->nballs = 0;
+
+ device->joystick = joystick;
+
+ @autoreleasepool {
+ if (device->accelerometer) {
+#if !TARGET_OS_TV
+ if (motionManager == nil) {
+ motionManager = [[CMMotionManager alloc] init];
+ }
+
+ /* Shorter times between updates can significantly increase CPU usage. */
+ motionManager.accelerometerUpdateInterval = 0.1;
+ [motionManager startAccelerometerUpdates];
+#endif /* !TARGET_OS_TV */
+ } else {
+#ifdef SDL_JOYSTICK_MFI
+ GCController *controller = device->controller;
+ controller.controllerPausedHandler = ^(GCController *c) {
+ if (joystick->hwdata) {
+ ++joystick->hwdata->num_pause_presses;
+ }
+ };
+#endif /* SDL_JOYSTICK_MFI */
+ }
+ }
+ if (device->remote) {
+ ++SDL_AppleTVRemoteOpenedAsJoystick;
+ }
+
+ return 0;
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool
+SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return joystick->hwdata != NULL;
+}
+
+static void
+SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick)
+{
+#if !TARGET_OS_TV
+ const float maxgforce = SDL_IPHONE_MAX_GFORCE;
+ const SInt16 maxsint16 = 0x7FFF;
+ CMAcceleration accel;
+
+ @autoreleasepool {
+ if (!motionManager.isAccelerometerActive) {
+ return;
+ }
+
+ accel = motionManager.accelerometerData.acceleration;
+ }
+
+ /*
+ Convert accelerometer data from floating point to Sint16, which is what
+ the joystick system expects.
+
+ To do the conversion, the data is first clamped onto the interval
+ [-SDL_IPHONE_MAX_G_FORCE, SDL_IPHONE_MAX_G_FORCE], then the data is multiplied
+ by MAX_SINT16 so that it is mapped to the full range of an Sint16.
+
+ You can customize the clamped range of this function by modifying the
+ SDL_IPHONE_MAX_GFORCE macro in SDL_config_iphoneos.h.
+
+ Once converted to Sint16, the accelerometer data no longer has coherent
+ units. You can convert the data back to units of g-force by multiplying
+ it in your application's code by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
+ */
+
+ /* clamp the data */
+ accel.x = SDL_min(SDL_max(accel.x, -maxgforce), maxgforce);
+ accel.y = SDL_min(SDL_max(accel.y, -maxgforce), maxgforce);
+ accel.z = SDL_min(SDL_max(accel.z, -maxgforce), maxgforce);
+
+ /* pass in data mapped to range of SInt16 */
+ SDL_PrivateJoystickAxis(joystick, 0, (accel.x / maxgforce) * maxsint16);
+ SDL_PrivateJoystickAxis(joystick, 1, -(accel.y / maxgforce) * maxsint16);
+ SDL_PrivateJoystickAxis(joystick, 2, (accel.z / maxgforce) * maxsint16);
+#endif /* !TARGET_OS_TV */
+}
+
+#ifdef SDL_JOYSTICK_MFI
+static Uint8
+SDL_SYS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad)
+{
+ Uint8 hat = 0;
+
+ if (dpad.up.isPressed) {
+ hat |= SDL_HAT_UP;
+ } else if (dpad.down.isPressed) {
+ hat |= SDL_HAT_DOWN;
+ }
+
+ if (dpad.left.isPressed) {
+ hat |= SDL_HAT_LEFT;
+ } else if (dpad.right.isPressed) {
+ hat |= SDL_HAT_RIGHT;
+ }
+
+ if (hat == 0) {
+ return SDL_HAT_CENTERED;
+ }
+
+ return hat;
+}
+#endif
+
+static void
+SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick)
+{
+#if SDL_JOYSTICK_MFI
+ @autoreleasepool {
+ GCController *controller = joystick->hwdata->controller;
+ Uint8 hatstate = SDL_HAT_CENTERED;
+ int i;
+ int updateplayerindex = 0;
+
+ if (controller.extendedGamepad) {
+ GCExtendedGamepad *gamepad = controller.extendedGamepad;
+
+ /* Axis order matches the XInput Windows mappings. */
+ Sint16 axes[] = {
+ (Sint16) (gamepad.leftThumbstick.xAxis.value * 32767),
+ (Sint16) (gamepad.leftThumbstick.yAxis.value * -32767),
+ (Sint16) ((gamepad.leftTrigger.value * 65535) - 32768),
+ (Sint16) (gamepad.rightThumbstick.xAxis.value * 32767),
+ (Sint16) (gamepad.rightThumbstick.yAxis.value * -32767),
+ (Sint16) ((gamepad.rightTrigger.value * 65535) - 32768),
+ };
+
+ /* Button order matches the XInput Windows mappings. */
+ Uint8 buttons[] = {
+ gamepad.buttonA.isPressed, gamepad.buttonB.isPressed,
+ gamepad.buttonX.isPressed, gamepad.buttonY.isPressed,
+ gamepad.leftShoulder.isPressed,
+ gamepad.rightShoulder.isPressed,
+ };
+
+ hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad);
+
+ for (i = 0; i < SDL_arraysize(axes); i++) {
+ /* The triggers (axes 2 and 5) are resting at -32768 but SDL
+ * initializes its values to 0. We only want to make sure the
+ * player index is up to date if the user actually moves an axis. */
+ if ((i != 2 && i != 5) || axes[i] != -32768) {
+ updateplayerindex |= (joystick->axes[i].value != axes[i]);
+ }
+ SDL_PrivateJoystickAxis(joystick, i, axes[i]);
+ }
+
+ for (i = 0; i < SDL_arraysize(buttons); i++) {
+ updateplayerindex |= (joystick->buttons[i] != buttons[i]);
+ SDL_PrivateJoystickButton(joystick, i, buttons[i]);
+ }
+ } else if (controller.gamepad) {
+ GCGamepad *gamepad = controller.gamepad;
+
+ /* Button order matches the XInput Windows mappings. */
+ Uint8 buttons[] = {
+ gamepad.buttonA.isPressed, gamepad.buttonB.isPressed,
+ gamepad.buttonX.isPressed, gamepad.buttonY.isPressed,
+ gamepad.leftShoulder.isPressed,
+ gamepad.rightShoulder.isPressed,
+ };
+
+ hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad);
+
+ for (i = 0; i < SDL_arraysize(buttons); i++) {
+ updateplayerindex |= (joystick->buttons[i] != buttons[i]);
+ SDL_PrivateJoystickButton(joystick, i, buttons[i]);
+ }
+ }
+#if TARGET_OS_TV
+ else if (controller.microGamepad) {
+ GCMicroGamepad *gamepad = controller.microGamepad;
+
+ Sint16 axes[] = {
+ (Sint16) (gamepad.dpad.xAxis.value * 32767),
+ (Sint16) (gamepad.dpad.yAxis.value * -32767),
+ };
+
+ for (i = 0; i < SDL_arraysize(axes); i++) {
+ updateplayerindex |= (joystick->axes[i].value != axes[i]);
+ SDL_PrivateJoystickAxis(joystick, i, axes[i]);
+ }
+
+ Uint8 buttons[] = {
+ gamepad.buttonA.isPressed,
+ gamepad.buttonX.isPressed,
+ };
+
+ for (i = 0; i < SDL_arraysize(buttons); i++) {
+ updateplayerindex |= (joystick->buttons[i] != buttons[i]);
+ SDL_PrivateJoystickButton(joystick, i, buttons[i]);
+ }
+ }
+#endif /* TARGET_OS_TV */
+
+ if (joystick->nhats > 0) {
+ updateplayerindex |= (joystick->hats[0] != hatstate);
+ SDL_PrivateJoystickHat(joystick, 0, hatstate);
+ }
+
+ for (i = 0; i < joystick->hwdata->num_pause_presses; i++) {
+ /* The pause button is always last. */
+ Uint8 pausebutton = joystick->nbuttons - 1;
+
+ SDL_PrivateJoystickButton(joystick, pausebutton, SDL_PRESSED);
+ SDL_PrivateJoystickButton(joystick, pausebutton, SDL_RELEASED);
+
+ updateplayerindex = YES;
+ }
+
+ joystick->hwdata->num_pause_presses = 0;
+
+ if (updateplayerindex && controller.playerIndex == -1) {
+ BOOL usedPlayerIndexSlots[4] = {NO, NO, NO, NO};
+
+ /* Find the player index of all other connected controllers. */
+ for (GCController *c in [GCController controllers]) {
+ if (c != controller && c.playerIndex >= 0) {
+ usedPlayerIndexSlots[c.playerIndex] = YES;
+ }
+ }
+
+ /* Set this controller's player index to the first unused index.
+ * FIXME: This logic isn't great... but SDL doesn't expose this
+ * concept in its external API, so we don't have much to go on. */
+ for (i = 0; i < SDL_arraysize(usedPlayerIndexSlots); i++) {
+ if (!usedPlayerIndexSlots[i]) {
+ controller.playerIndex = i;
+ break;
+ }
+ }
+ }
+ }
+#endif /* SDL_JOYSTICK_MFI */
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ SDL_JoystickDeviceItem *device = joystick->hwdata;
+
+ if (device == NULL) {
+ return;
+ }
+
+ if (device->m_bSteamController) {
+ SDL_UpdateSteamController(joystick);
+ return;
+ }
+
+ if (device->accelerometer) {
+ SDL_SYS_AccelerometerUpdate(joystick);
+ } else if (device->controller) {
+ SDL_SYS_MFIJoystickUpdate(joystick);
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+ SDL_JoystickDeviceItem *device = joystick->hwdata;
+
+ if (device == NULL) {
+ return;
+ }
+
+ device->joystick = NULL;
+
+ @autoreleasepool {
+ if (device->accelerometer) {
+#if !TARGET_OS_TV
+ [motionManager stopAccelerometerUpdates];
+#endif /* !TARGET_OS_TV */
+ } else if (device->controller) {
+#ifdef SDL_JOYSTICK_MFI
+ GCController *controller = device->controller;
+ controller.controllerPausedHandler = nil;
+ controller.playerIndex = -1;
+#endif
+ }
+ }
+ if (device->remote) {
+ --SDL_AppleTVRemoteOpenedAsJoystick;
+ }
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+ @autoreleasepool {
+#ifdef SDL_JOYSTICK_MFI
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+
+ if (connectObserver) {
+ [center removeObserver:connectObserver name:GCControllerDidConnectNotification object:nil];
+ connectObserver = nil;
+ }
+
+ if (disconnectObserver) {
+ [center removeObserver:disconnectObserver name:GCControllerDidDisconnectNotification object:nil];
+ disconnectObserver = nil;
+ }
+
+#if TARGET_OS_TV
+ SDL_DelHintCallback(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION,
+ SDL_AppleTVRemoteRotationHintChanged, NULL);
+#endif /* TARGET_OS_TV */
+#endif /* SDL_JOYSTICK_MFI */
+
+ while (deviceList != NULL) {
+ SDL_SYS_RemoveJoystickDevice(deviceList);
+ }
+
+#if !TARGET_OS_TV
+ motionManager = nil;
+#endif /* !TARGET_OS_TV */
+ }
+
+ SDL_QuitSteamControllers();
+
+ numjoysticks = 0;
+}
+
+SDL_JoystickGUID
+SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+ SDL_JoystickGUID guid;
+ if (device) {
+ guid = device->guid;
+ } else {
+ SDL_zero(guid);
+ }
+ return guid;
+}
+
+SDL_JoystickGUID
+SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+ if (joystick->hwdata) {
+ guid = joystick->hwdata->guid;
+ } else {
+ SDL_zero(guid);
+ }
+ return guid;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h b/src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h
new file mode 100644
index 0000000..7be5b04
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h
@@ -0,0 +1,59 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_JOYSTICK_IOS_H
+#define SDL_JOYSTICK_IOS_H
+
+#include "SDL_stdinc.h"
+#include "../SDL_sysjoystick.h"
+
+@class GCController;
+
+typedef struct joystick_hwdata
+{
+ SDL_bool accelerometer;
+ SDL_bool remote;
+
+ GCController __unsafe_unretained *controller;
+ int num_pause_presses;
+
+ char *name;
+ SDL_Joystick *joystick;
+ SDL_JoystickID instance_id;
+ SDL_JoystickGUID guid;
+
+ int naxes;
+ int nbuttons;
+ int nhats;
+
+ /* Steam Controller support */
+ SDL_bool m_bSteamController;
+
+ struct joystick_hwdata *next;
+} joystick_hwdata;
+
+typedef joystick_hwdata SDL_JoystickDeviceItem;
+
+#endif /* SDL_JOYSTICK_IOS_H */
+
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick.c
new file mode 100644
index 0000000..457c4b8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick.c
@@ -0,0 +1,1049 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_LINUX
+
+#ifndef SDL_INPUT_LINUXEV
+#error SDL now requires a Linux 2.4+ kernel with /dev/input/event support.
+#endif
+
+/* This is the Linux implementation of the SDL joystick API */
+
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <limits.h> /* For the definition of PATH_MAX */
+#include <linux/joystick.h>
+
+#include "SDL_assert.h"
+#include "SDL_joystick.h"
+#include "SDL_endian.h"
+#include "../../events/SDL_events_c.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+#include "../steam/SDL_steamcontroller.h"
+#include "SDL_sysjoystick_c.h"
+
+/* This isn't defined in older Linux kernel headers */
+#ifndef SYN_DROPPED
+#define SYN_DROPPED 3
+#endif
+
+#include "../../core/linux/SDL_udev.h"
+
+static int MaybeAddDevice(const char *path);
+#if SDL_USE_LIBUDEV
+static int MaybeRemoveDevice(const char *path);
+static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
+#endif /* SDL_USE_LIBUDEV */
+
+
+/* A linked list of available joysticks */
+typedef struct SDL_joylist_item
+{
+ int device_instance;
+ char *path; /* "/dev/input/event2" or whatever */
+ char *name; /* "SideWinder 3D Pro" or whatever */
+ SDL_JoystickGUID guid;
+ dev_t devnum;
+ struct joystick_hwdata *hwdata;
+ struct SDL_joylist_item *next;
+
+ /* Steam Controller support */
+ SDL_bool m_bSteamController;
+} SDL_joylist_item;
+
+static SDL_joylist_item *SDL_joylist = NULL;
+static SDL_joylist_item *SDL_joylist_tail = NULL;
+static int numjoysticks = 0;
+static int instance_counter = 0;
+
+
+#define test_bit(nr, addr) \
+ (((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0)
+#define NBITS(x) ((((x)-1)/(sizeof(long) * 8))+1)
+
+static int
+IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *guid)
+{
+ /* This list is taken from:
+ https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
+ */
+ static Uint32 joystick_blacklist[] = {
+ /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
+ /* Microsoft Wireless Desktop - Comfort Edition */
+ MAKE_VIDPID(0x045e, 0x009d),
+
+ /* Microsoft Microsoft® Digital Media Pro Keyboard */
+ /* Microsoft Corp. Digital Media Pro Keyboard */
+ MAKE_VIDPID(0x045e, 0x00b0),
+
+ /* Microsoft Microsoft® Digital Media Keyboard */
+ /* Microsoft Corp. Digital Media Keyboard 1.0A */
+ MAKE_VIDPID(0x045e, 0x00b4),
+
+ /* Microsoft Microsoft® Digital Media Keyboard 3000 */
+ MAKE_VIDPID(0x045e, 0x0730),
+
+ /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */
+ /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */
+ /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
+ /* Microsoft Wireless Mobile Mouse 1000 */
+ /* Microsoft Wireless Desktop 3000 */
+ MAKE_VIDPID(0x045e, 0x0745),
+
+ /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */
+ MAKE_VIDPID(0x045e, 0x0748),
+
+ /* Microsoft Corp. Wired Keyboard 600 */
+ MAKE_VIDPID(0x045e, 0x0750),
+
+ /* Microsoft Corp. Sidewinder X4 keyboard */
+ MAKE_VIDPID(0x045e, 0x0768),
+
+ /* Microsoft Corp. Arc Touch Mouse Transceiver */
+ MAKE_VIDPID(0x045e, 0x0773),
+
+ /* Microsoft® 2.4GHz Transceiver v9.0 */
+ /* Microsoft® Nano Transceiver v2.1 */
+ /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
+ MAKE_VIDPID(0x045e, 0x07a5),
+
+ /* Microsoft® Nano Transceiver v1.0 */
+ /* Microsoft Wireless Keyboard 800 */
+ MAKE_VIDPID(0x045e, 0x07b2),
+
+ /* Microsoft® Nano Transceiver v2.0 */
+ MAKE_VIDPID(0x045e, 0x0800),
+
+ /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */
+ MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */
+ MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */
+ MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */
+ MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */
+ MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */
+ MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */
+ MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */
+ MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */
+ MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire 4 6x8 */
+ MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun 4x5 */
+ MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */
+ MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */
+ MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */
+
+ MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */
+ MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */
+ MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */
+ MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */
+ MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */
+ MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */
+ MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */
+ MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */
+ MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */
+ MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */
+ MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */
+ MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */
+ MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */
+ MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */
+ MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */
+ MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */
+ MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */
+
+ MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */
+
+ MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */
+
+ MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */
+
+ MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */
+ MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */
+ };
+ struct input_id inpid;
+ int i;
+ Uint32 id;
+ Uint16 *guid16 = (Uint16 *)guid->data;
+
+#if !SDL_USE_LIBUDEV
+ /* When udev is enabled we only get joystick devices here, so there's no need to test them */
+ unsigned long evbit[NBITS(EV_MAX)] = { 0 };
+ unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
+ unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
+
+ if ((ioctl(fd, EVIOCGBIT(0, sizeof(evbit)), evbit) < 0) ||
+ (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) ||
+ (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) < 0)) {
+ return (0);
+ }
+
+ if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) &&
+ test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit))) {
+ return 0;
+ }
+#endif
+
+ if (ioctl(fd, EVIOCGNAME(namebuflen), namebuf) < 0) {
+ return 0;
+ }
+
+ if (ioctl(fd, EVIOCGID, &inpid) < 0) {
+ return 0;
+ }
+
+ /* Check the joystick blacklist */
+ id = MAKE_VIDPID(inpid.vendor, inpid.product);
+ for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) {
+ if (id == joystick_blacklist[i]) {
+ return 0;
+ }
+ }
+
+#ifdef DEBUG_JOYSTICK
+ printf("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
+#endif
+
+ SDL_memset(guid->data, 0, sizeof(guid->data));
+
+ /* We only need 16 bits for each of these; space them out to fill 128. */
+ /* Byteswap so devices get same GUID on little/big endian platforms. */
+ *guid16++ = SDL_SwapLE16(inpid.bustype);
+ *guid16++ = 0;
+
+ if (inpid.vendor && inpid.product) {
+ *guid16++ = SDL_SwapLE16(inpid.vendor);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16(inpid.product);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16(inpid.version);
+ *guid16++ = 0;
+ } else {
+ SDL_strlcpy((char*)guid16, namebuf, sizeof(guid->data) - 4);
+ }
+
+ if (SDL_IsGameControllerNameAndGUID(namebuf, *guid) &&
+ SDL_ShouldIgnoreGameController(namebuf, *guid)) {
+ return 0;
+ }
+ return 1;
+}
+
+#if SDL_USE_LIBUDEV
+static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
+{
+ if (devpath == NULL) {
+ return;
+ }
+
+ switch (udev_type) {
+ case SDL_UDEV_DEVICEADDED:
+ if (!(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
+ return;
+ }
+ MaybeAddDevice(devpath);
+ break;
+
+ case SDL_UDEV_DEVICEREMOVED:
+ MaybeRemoveDevice(devpath);
+ break;
+
+ default:
+ break;
+ }
+
+}
+#endif /* SDL_USE_LIBUDEV */
+
+
+/* !!! FIXME: I would love to dump this code and use libudev instead. */
+static int
+MaybeAddDevice(const char *path)
+{
+ struct stat sb;
+ int fd = -1;
+ int isstick = 0;
+ char namebuf[128];
+ SDL_JoystickGUID guid;
+ SDL_joylist_item *item;
+
+ if (path == NULL) {
+ return -1;
+ }
+
+ if (stat(path, &sb) == -1) {
+ return -1;
+ }
+
+ /* Check to make sure it's not already in list. */
+ for (item = SDL_joylist; item != NULL; item = item->next) {
+ if (sb.st_rdev == item->devnum) {
+ return -1; /* already have this one */
+ }
+ }
+
+ fd = open(path, O_RDONLY, 0);
+ if (fd < 0) {
+ return -1;
+ }
+
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Checking %s\n", path);
+#endif
+
+ isstick = IsJoystick(fd, namebuf, sizeof (namebuf), &guid);
+ close(fd);
+ if (!isstick) {
+ return -1;
+ }
+
+ item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item));
+ if (item == NULL) {
+ return -1;
+ }
+
+ SDL_zerop(item);
+ item->devnum = sb.st_rdev;
+ item->path = SDL_strdup(path);
+ item->name = SDL_strdup(namebuf);
+ item->guid = guid;
+
+ if ( (item->path == NULL) || (item->name == NULL) ) {
+ SDL_free(item->path);
+ SDL_free(item->name);
+ SDL_free(item);
+ return -1;
+ }
+
+ item->device_instance = instance_counter++;
+ if (SDL_joylist_tail == NULL) {
+ SDL_joylist = SDL_joylist_tail = item;
+ } else {
+ SDL_joylist_tail->next = item;
+ SDL_joylist_tail = item;
+ }
+
+ /* Need to increment the joystick count before we post the event */
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+
+ return numjoysticks;
+}
+
+#if SDL_USE_LIBUDEV
+/* !!! FIXME: I would love to dump this code and use libudev instead. */
+static int
+MaybeRemoveDevice(const char *path)
+{
+ SDL_joylist_item *item;
+ SDL_joylist_item *prev = NULL;
+
+ if (path == NULL) {
+ return -1;
+ }
+
+ for (item = SDL_joylist; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (SDL_strcmp(path, item->path) == 0) {
+ const int retval = item->device_instance;
+ if (item->hwdata) {
+ item->hwdata->item = NULL;
+ }
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_joylist == item);
+ SDL_joylist = item->next;
+ }
+ if (item == SDL_joylist_tail) {
+ SDL_joylist_tail = prev;
+ }
+
+ /* Need to decrement the joystick count before we post the event */
+ --numjoysticks;
+
+ SDL_PrivateJoystickRemoved(item->device_instance);
+
+ SDL_free(item->path);
+ SDL_free(item->name);
+ SDL_free(item);
+ return retval;
+ }
+ prev = item;
+ }
+
+ return -1;
+}
+#endif
+
+#if ! SDL_USE_LIBUDEV
+static int
+JoystickInitWithoutUdev(void)
+{
+ int i;
+ char path[PATH_MAX];
+
+ /* !!! FIXME: only finds sticks if they're called /dev/input/event[0..31] */
+ /* !!! FIXME: we could at least readdir() through /dev/input...? */
+ /* !!! FIXME: (or delete this and rely on libudev?) */
+ for (i = 0; i < 32; i++) {
+ SDL_snprintf(path, SDL_arraysize(path), "/dev/input/event%d", i);
+ MaybeAddDevice(path);
+ }
+
+ return numjoysticks;
+}
+#endif
+
+#if SDL_USE_LIBUDEV
+static int
+JoystickInitWithUdev(void)
+{
+ if (SDL_UDEV_Init() < 0) {
+ return SDL_SetError("Could not initialize UDEV");
+ }
+
+ /* Set up the udev callback */
+ if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) {
+ SDL_UDEV_Quit();
+ return SDL_SetError("Could not set up joystick <-> udev callback");
+ }
+
+ /* Force a scan to build the initial device list */
+ SDL_UDEV_Scan();
+
+ return numjoysticks;
+}
+#endif
+
+static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance)
+{
+ SDL_joylist_item *item;
+
+ item = (SDL_joylist_item *) SDL_calloc(1, sizeof (SDL_joylist_item));
+ if (item == NULL) {
+ return SDL_FALSE;
+ }
+
+ item->path = SDL_strdup("");
+ item->name = SDL_strdup(name);
+ item->guid = guid;
+ item->m_bSteamController = SDL_TRUE;
+
+ if ((item->path == NULL) || (item->name == NULL)) {
+ SDL_free(item->path);
+ SDL_free(item->name);
+ SDL_free(item);
+ return SDL_FALSE;
+ }
+
+ *device_instance = item->device_instance = instance_counter++;
+ if (SDL_joylist_tail == NULL) {
+ SDL_joylist = SDL_joylist_tail = item;
+ } else {
+ SDL_joylist_tail->next = item;
+ SDL_joylist_tail = item;
+ }
+
+ /* Need to increment the joystick count before we post the event */
+ ++numjoysticks;
+
+ SDL_PrivateJoystickAdded(numjoysticks - 1);
+
+ return SDL_TRUE;
+}
+
+static void SteamControllerDisconnectedCallback(int device_instance)
+{
+ SDL_joylist_item *item;
+ SDL_joylist_item *prev = NULL;
+
+ for (item = SDL_joylist; item != NULL; item = item->next) {
+ /* found it, remove it. */
+ if (item->device_instance == device_instance) {
+ if (item->hwdata) {
+ item->hwdata->item = NULL;
+ }
+ if (prev != NULL) {
+ prev->next = item->next;
+ } else {
+ SDL_assert(SDL_joylist == item);
+ SDL_joylist = item->next;
+ }
+ if (item == SDL_joylist_tail) {
+ SDL_joylist_tail = prev;
+ }
+
+ /* Need to decrement the joystick count before we post the event */
+ --numjoysticks;
+
+ SDL_PrivateJoystickRemoved(item->device_instance);
+
+ SDL_free(item->name);
+ SDL_free(item);
+ return;
+ }
+ prev = item;
+ }
+}
+
+int
+SDL_SYS_JoystickInit(void)
+{
+ /* First see if the user specified one or more joysticks to use */
+ if (SDL_getenv("SDL_JOYSTICK_DEVICE") != NULL) {
+ char *envcopy, *envpath, *delim;
+ envcopy = SDL_strdup(SDL_getenv("SDL_JOYSTICK_DEVICE"));
+ envpath = envcopy;
+ while (envpath != NULL) {
+ delim = SDL_strchr(envpath, ':');
+ if (delim != NULL) {
+ *delim++ = '\0';
+ }
+ MaybeAddDevice(envpath);
+ envpath = delim;
+ }
+ SDL_free(envcopy);
+ }
+
+ SDL_InitSteamControllers(SteamControllerConnectedCallback,
+ SteamControllerDisconnectedCallback);
+
+#if SDL_USE_LIBUDEV
+ return JoystickInitWithUdev();
+#else
+ return JoystickInitWithoutUdev();
+#endif
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return numjoysticks;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+#if SDL_USE_LIBUDEV
+ SDL_UDEV_Poll();
+#endif
+
+ SDL_UpdateSteamControllers();
+}
+
+static SDL_joylist_item *
+JoystickByDevIndex(int device_index)
+{
+ SDL_joylist_item *item = SDL_joylist;
+
+ if ((device_index < 0) || (device_index >= numjoysticks)) {
+ return NULL;
+ }
+
+ while (device_index > 0) {
+ SDL_assert(item != NULL);
+ device_index--;
+ item = item->next;
+ }
+
+ return item;
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ return JoystickByDevIndex(device_index)->name;
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return JoystickByDevIndex(device_index)->device_instance;
+}
+
+static int
+allocate_hatdata(SDL_Joystick * joystick)
+{
+ int i;
+
+ joystick->hwdata->hats =
+ (struct hwdata_hat *) SDL_malloc(joystick->nhats *
+ sizeof(struct hwdata_hat));
+ if (joystick->hwdata->hats == NULL) {
+ return (-1);
+ }
+ for (i = 0; i < joystick->nhats; ++i) {
+ joystick->hwdata->hats[i].axis[0] = 1;
+ joystick->hwdata->hats[i].axis[1] = 1;
+ }
+ return (0);
+}
+
+static int
+allocate_balldata(SDL_Joystick * joystick)
+{
+ int i;
+
+ joystick->hwdata->balls =
+ (struct hwdata_ball *) SDL_malloc(joystick->nballs *
+ sizeof(struct hwdata_ball));
+ if (joystick->hwdata->balls == NULL) {
+ return (-1);
+ }
+ for (i = 0; i < joystick->nballs; ++i) {
+ joystick->hwdata->balls[i].axis[0] = 0;
+ joystick->hwdata->balls[i].axis[1] = 0;
+ }
+ return (0);
+}
+
+static void
+ConfigJoystick(SDL_Joystick * joystick, int fd)
+{
+ int i, t;
+ unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
+ unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
+ unsigned long relbit[NBITS(REL_MAX)] = { 0 };
+
+ /* See if this device uses the new unified event API */
+ if ((ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) >= 0) &&
+ (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) >= 0) &&
+ (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit) >= 0)) {
+
+ /* Get the number of buttons, axes, and other thingamajigs */
+ for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
+ if (test_bit(i, keybit)) {
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Joystick has button: 0x%x\n", i);
+#endif
+ joystick->hwdata->key_map[i] = joystick->nbuttons;
+ ++joystick->nbuttons;
+ }
+ }
+ for (i = 0; i < BTN_JOYSTICK; ++i) {
+ if (test_bit(i, keybit)) {
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Joystick has button: 0x%x\n", i);
+#endif
+ joystick->hwdata->key_map[i] = joystick->nbuttons;
+ ++joystick->nbuttons;
+ }
+ }
+ for (i = 0; i < ABS_MAX; ++i) {
+ /* Skip hats */
+ if (i == ABS_HAT0X) {
+ i = ABS_HAT3Y;
+ continue;
+ }
+ if (test_bit(i, absbit)) {
+ struct input_absinfo absinfo;
+
+ if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) {
+ continue;
+ }
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Joystick has absolute axis: 0x%.2x\n", i);
+ printf("Values = { %d, %d, %d, %d, %d }\n",
+ absinfo.value, absinfo.minimum, absinfo.maximum,
+ absinfo.fuzz, absinfo.flat);
+#endif /* DEBUG_INPUT_EVENTS */
+ joystick->hwdata->abs_map[i] = joystick->naxes;
+ if (absinfo.minimum == absinfo.maximum) {
+ joystick->hwdata->abs_correct[i].used = 0;
+ } else {
+ joystick->hwdata->abs_correct[i].used = 1;
+ joystick->hwdata->abs_correct[i].coef[0] =
+ (absinfo.maximum + absinfo.minimum) - 2 * absinfo.flat;
+ joystick->hwdata->abs_correct[i].coef[1] =
+ (absinfo.maximum + absinfo.minimum) + 2 * absinfo.flat;
+ t = ((absinfo.maximum - absinfo.minimum) - 4 * absinfo.flat);
+ if (t != 0) {
+ joystick->hwdata->abs_correct[i].coef[2] =
+ (1 << 28) / t;
+ } else {
+ joystick->hwdata->abs_correct[i].coef[2] = 0;
+ }
+ }
+ ++joystick->naxes;
+ }
+ }
+ for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) {
+ if (test_bit(i, absbit) || test_bit(i + 1, absbit)) {
+ struct input_absinfo absinfo;
+
+ if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) {
+ continue;
+ }
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Joystick has hat %d\n", (i - ABS_HAT0X) / 2);
+ printf("Values = { %d, %d, %d, %d, %d }\n",
+ absinfo.value, absinfo.minimum, absinfo.maximum,
+ absinfo.fuzz, absinfo.flat);
+#endif /* DEBUG_INPUT_EVENTS */
+ ++joystick->nhats;
+ }
+ }
+ if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) {
+ ++joystick->nballs;
+ }
+
+ /* Allocate data to keep track of these thingamajigs */
+ if (joystick->nhats > 0) {
+ if (allocate_hatdata(joystick) < 0) {
+ joystick->nhats = 0;
+ }
+ }
+ if (joystick->nballs > 0) {
+ if (allocate_balldata(joystick) < 0) {
+ joystick->nballs = 0;
+ }
+ }
+ }
+}
+
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ SDL_joylist_item *item = JoystickByDevIndex(device_index);
+
+ if (item == NULL) {
+ return SDL_SetError("No such device");
+ }
+
+ joystick->instance_id = item->device_instance;
+ joystick->hwdata = (struct joystick_hwdata *)
+ SDL_calloc(1, sizeof(*joystick->hwdata));
+ if (joystick->hwdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+ joystick->hwdata->item = item;
+ joystick->hwdata->guid = item->guid;
+ joystick->hwdata->m_bSteamController = item->m_bSteamController;
+
+ if (item->m_bSteamController) {
+ joystick->hwdata->fd = -1;
+ SDL_GetSteamControllerInputs(&joystick->nbuttons,
+ &joystick->naxes,
+ &joystick->nhats);
+ } else {
+ int fd = open(item->path, O_RDONLY, 0);
+ if (fd < 0) {
+ SDL_free(joystick->hwdata);
+ joystick->hwdata = NULL;
+ return SDL_SetError("Unable to open %s", item->path);
+ }
+
+ joystick->hwdata->fd = fd;
+ joystick->hwdata->fname = SDL_strdup(item->path);
+ if (joystick->hwdata->fname == NULL) {
+ SDL_free(joystick->hwdata);
+ joystick->hwdata = NULL;
+ close(fd);
+ return SDL_OutOfMemory();
+ }
+
+ /* Set the joystick to non-blocking read mode */
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+
+ /* Get the number of buttons and axes on the joystick */
+ ConfigJoystick(joystick, fd);
+ }
+
+ SDL_assert(item->hwdata == NULL);
+ item->hwdata = joystick->hwdata;
+
+ /* mark joystick as fresh and ready */
+ joystick->hwdata->fresh = 1;
+
+ return (0);
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return joystick->hwdata->item != NULL;
+}
+
+static SDL_INLINE void
+HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
+{
+ struct hwdata_hat *the_hat;
+ const Uint8 position_map[3][3] = {
+ {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP},
+ {SDL_HAT_LEFT, SDL_HAT_CENTERED, SDL_HAT_RIGHT},
+ {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
+ };
+
+ the_hat = &stick->hwdata->hats[hat];
+ if (value < 0) {
+ value = 0;
+ } else if (value == 0) {
+ value = 1;
+ } else if (value > 0) {
+ value = 2;
+ }
+ if (value != the_hat->axis[axis]) {
+ the_hat->axis[axis] = value;
+ SDL_PrivateJoystickHat(stick, hat,
+ position_map[the_hat->
+ axis[1]][the_hat->axis[0]]);
+ }
+}
+
+static SDL_INLINE void
+HandleBall(SDL_Joystick * stick, Uint8 ball, int axis, int value)
+{
+ stick->hwdata->balls[ball].axis[axis] += value;
+}
+
+
+static SDL_INLINE int
+AxisCorrect(SDL_Joystick * joystick, int which, int value)
+{
+ struct axis_correct *correct;
+
+ correct = &joystick->hwdata->abs_correct[which];
+ if (correct->used) {
+ value *= 2;
+ if (value > correct->coef[0]) {
+ if (value < correct->coef[1]) {
+ return 0;
+ }
+ value -= correct->coef[1];
+ } else {
+ value -= correct->coef[0];
+ }
+ value *= correct->coef[2];
+ value >>= 13;
+ }
+
+ /* Clamp and return */
+ if (value < -32768)
+ return -32768;
+ if (value > 32767)
+ return 32767;
+
+ return value;
+}
+
+static SDL_INLINE void
+PollAllValues(SDL_Joystick * joystick)
+{
+ struct input_absinfo absinfo;
+ int a, b = 0;
+
+ /* Poll all axis */
+ for (a = ABS_X; b < ABS_MAX; a++) {
+ switch (a) {
+ case ABS_HAT0X:
+ case ABS_HAT0Y:
+ case ABS_HAT1X:
+ case ABS_HAT1Y:
+ case ABS_HAT2X:
+ case ABS_HAT2Y:
+ case ABS_HAT3X:
+ case ABS_HAT3Y:
+ /* ingore hats */
+ break;
+ default:
+ if (joystick->hwdata->abs_correct[b].used) {
+ if (ioctl(joystick->hwdata->fd, EVIOCGABS(a), &absinfo) >= 0) {
+ absinfo.value = AxisCorrect(joystick, b, absinfo.value);
+
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Joystick : Re-read Axis %d (%d) val= %d\n",
+ joystick->hwdata->abs_map[b], a, absinfo.value);
+#endif
+ SDL_PrivateJoystickAxis(joystick,
+ joystick->hwdata->abs_map[b],
+ absinfo.value);
+ }
+ }
+ b++;
+ }
+ }
+}
+
+static SDL_INLINE void
+HandleInputEvents(SDL_Joystick * joystick)
+{
+ struct input_event events[32];
+ int i, len;
+ int code;
+
+ if (joystick->hwdata->fresh) {
+ PollAllValues(joystick);
+ joystick->hwdata->fresh = 0;
+ }
+
+ while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) {
+ len /= sizeof(events[0]);
+ for (i = 0; i < len; ++i) {
+ code = events[i].code;
+ switch (events[i].type) {
+ case EV_KEY:
+ SDL_PrivateJoystickButton(joystick,
+ joystick->hwdata->key_map[code],
+ events[i].value);
+ break;
+ case EV_ABS:
+ switch (code) {
+ case ABS_HAT0X:
+ case ABS_HAT0Y:
+ case ABS_HAT1X:
+ case ABS_HAT1Y:
+ case ABS_HAT2X:
+ case ABS_HAT2Y:
+ case ABS_HAT3X:
+ case ABS_HAT3Y:
+ code -= ABS_HAT0X;
+ HandleHat(joystick, code / 2, code % 2, events[i].value);
+ break;
+ default:
+ events[i].value =
+ AxisCorrect(joystick, code, events[i].value);
+ SDL_PrivateJoystickAxis(joystick,
+ joystick->hwdata->abs_map[code],
+ events[i].value);
+ break;
+ }
+ break;
+ case EV_REL:
+ switch (code) {
+ case REL_X:
+ case REL_Y:
+ code -= REL_X;
+ HandleBall(joystick, code / 2, code % 2, events[i].value);
+ break;
+ default:
+ break;
+ }
+ break;
+ case EV_SYN:
+ switch (code) {
+ case SYN_DROPPED :
+#ifdef DEBUG_INPUT_EVENTS
+ printf("Event SYN_DROPPED detected\n");
+#endif
+ PollAllValues(joystick);
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ int i;
+
+ if (joystick->hwdata->m_bSteamController) {
+ SDL_UpdateSteamController(joystick);
+ return;
+ }
+
+ HandleInputEvents(joystick);
+
+ /* Deliver ball motion updates */
+ for (i = 0; i < joystick->nballs; ++i) {
+ int xrel, yrel;
+
+ xrel = joystick->hwdata->balls[i].axis[0];
+ yrel = joystick->hwdata->balls[i].axis[1];
+ if (xrel || yrel) {
+ joystick->hwdata->balls[i].axis[0] = 0;
+ joystick->hwdata->balls[i].axis[1] = 0;
+ SDL_PrivateJoystickBall(joystick, (Uint8) i, xrel, yrel);
+ }
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+ if (joystick->hwdata) {
+ if (joystick->hwdata->fd >= 0) {
+ close(joystick->hwdata->fd);
+ }
+ if (joystick->hwdata->item) {
+ joystick->hwdata->item->hwdata = NULL;
+ }
+ SDL_free(joystick->hwdata->hats);
+ SDL_free(joystick->hwdata->balls);
+ SDL_free(joystick->hwdata->fname);
+ SDL_free(joystick->hwdata);
+ }
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+ SDL_joylist_item *item = NULL;
+ SDL_joylist_item *next = NULL;
+
+ for (item = SDL_joylist; item; item = next) {
+ next = item->next;
+ SDL_free(item->path);
+ SDL_free(item->name);
+ SDL_free(item);
+ }
+
+ SDL_joylist = SDL_joylist_tail = NULL;
+
+ numjoysticks = 0;
+ instance_counter = 0;
+
+#if SDL_USE_LIBUDEV
+ SDL_UDEV_DelCallback(joystick_udev_callback);
+ SDL_UDEV_Quit();
+#endif
+
+ SDL_QuitSteamControllers();
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ return JoystickByDevIndex(device_index)->guid;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ return joystick->hwdata->guid;
+}
+
+#endif /* SDL_JOYSTICK_LINUX */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick_c.h b/src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick_c.h
new file mode 100644
index 0000000..d06b387
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/linux/SDL_sysjoystick_c.h
@@ -0,0 +1,60 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include <linux/input.h>
+
+struct SDL_joylist_item;
+
+/* The private structure used to keep track of a joystick */
+struct joystick_hwdata
+{
+ int fd;
+ struct SDL_joylist_item *item;
+ SDL_JoystickGUID guid;
+ char *fname; /* Used in haptic subsystem */
+
+ /* The current Linux joystick driver maps hats to two axes */
+ struct hwdata_hat
+ {
+ int axis[2];
+ } *hats;
+ /* The current Linux joystick driver maps balls to two axes */
+ struct hwdata_ball
+ {
+ int axis[2];
+ } *balls;
+
+ /* Support for the Linux 2.4 unified input interface */
+ Uint8 key_map[KEY_MAX];
+ Uint8 abs_map[ABS_MAX];
+ struct axis_correct
+ {
+ int used;
+ int coef[3];
+ } abs_correct[ABS_MAX];
+
+ int fresh;
+
+ /* Steam Controller support */
+ SDL_bool m_bSteamController;
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/psp/SDL_sysjoystick.c b/src/3rdparty/SDL2/src/joystick/psp/SDL_sysjoystick.c
new file mode 100644
index 0000000..228cbb2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/psp/SDL_sysjoystick.c
@@ -0,0 +1,270 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_JOYSTICK_PSP
+
+/* This is the PSP implementation of the SDL joystick API */
+#include <pspctrl.h>
+#include <pspkernel.h>
+
+#include <stdio.h> /* For the definition of NULL */
+#include <stdlib.h>
+
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+
+#include "SDL_events.h"
+#include "SDL_error.h"
+#include "SDL_mutex.h"
+#include "SDL_timer.h"
+#include "../../thread/SDL_systhread.h"
+
+/* Current pad state */
+static SceCtrlData pad = { .Lx = 0, .Ly = 0, .Buttons = 0 };
+static SDL_sem *pad_sem = NULL;
+static SDL_Thread *thread = NULL;
+static int running = 0;
+static const enum PspCtrlButtons button_map[] = {
+ PSP_CTRL_TRIANGLE, PSP_CTRL_CIRCLE, PSP_CTRL_CROSS, PSP_CTRL_SQUARE,
+ PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER,
+ PSP_CTRL_DOWN, PSP_CTRL_LEFT, PSP_CTRL_UP, PSP_CTRL_RIGHT,
+ PSP_CTRL_SELECT, PSP_CTRL_START, PSP_CTRL_HOME, PSP_CTRL_HOLD };
+static int analog_map[256]; /* Map analog inputs to -32768 -> 32767 */
+
+typedef struct
+{
+ int x;
+ int y;
+} point;
+
+/* 4 points define the bezier-curve. */
+static point a = { 0, 0 };
+static point b = { 50, 0 };
+static point c = { 78, 32767 };
+static point d = { 128, 32767 };
+
+/* simple linear interpolation between two points */
+static SDL_INLINE void lerp (point *dest, point *a, point *b, float t)
+{
+ dest->x = a->x + (b->x - a->x)*t;
+ dest->y = a->y + (b->y - a->y)*t;
+}
+
+/* evaluate a point on a bezier-curve. t goes from 0 to 1.0 */
+static int calc_bezier_y(float t)
+{
+ point ab, bc, cd, abbc, bccd, dest;
+ lerp (&ab, &a, &b, t); /* point between a and b */
+ lerp (&bc, &b, &c, t); /* point between b and c */
+ lerp (&cd, &c, &d, t); /* point between c and d */
+ lerp (&abbc, &ab, &bc, t); /* point between ab and bc */
+ lerp (&bccd, &bc, &cd, t); /* point between bc and cd */
+ lerp (&dest, &abbc, &bccd, t); /* point on the bezier-curve */
+ return dest.y;
+}
+
+/*
+ * Collect pad data about once per frame
+ */
+int JoystickUpdate(void *data)
+{
+ while (running) {
+ SDL_SemWait(pad_sem);
+ sceCtrlPeekBufferPositive(&pad, 1);
+ SDL_SemPost(pad_sem);
+ /* Delay 1/60th of a second */
+ sceKernelDelayThread(1000000 / 60);
+ }
+ return 0;
+}
+
+
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * It should return number of joysticks, or -1 on an unrecoverable fatal error.
+ */
+int SDL_SYS_JoystickInit(void)
+{
+ int i;
+
+ /* Setup input */
+ sceCtrlSetSamplingCycle(0);
+ sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
+
+ /* Start thread to read data */
+ if((pad_sem = SDL_CreateSemaphore(1)) == NULL) {
+ return SDL_SetError("Can't create input semaphore");
+ }
+ running = 1;
+ if((thread = SDL_CreateThreadInternal(JoystickUpdate, "JoystickThread", 4096, NULL)) == NULL) {
+ return SDL_SetError("Can't create input thread");
+ }
+
+ /* Create an accurate map from analog inputs (0 to 255)
+ to SDL joystick positions (-32768 to 32767) */
+ for (i = 0; i < 128; i++)
+ {
+ float t = (float)i/127.0f;
+ analog_map[i+128] = calc_bezier_y(t);
+ analog_map[127-i] = -1 * analog_map[i+128];
+ }
+
+ return 1;
+}
+
+int SDL_SYS_NumJoysticks(void)
+{
+ return 1;
+}
+
+void SDL_SYS_JoystickDetect(void)
+{
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char * SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ return "PSP builtin joypad";
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return device_index;
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *SDL_SYS_JoystickName(int index)
+{
+ if (index == 0)
+ return "PSP controller";
+
+ SDL_SetError("No joystick available with that index");
+ return(NULL);
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index)
+{
+ joystick->nbuttons = 14;
+ joystick->naxes = 2;
+ joystick->nhats = 0;
+
+ return 0;
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return SDL_TRUE;
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
+{
+ int i;
+ enum PspCtrlButtons buttons;
+ enum PspCtrlButtons changed;
+ unsigned char x, y;
+ static enum PspCtrlButtons old_buttons = 0;
+ static unsigned char old_x = 0, old_y = 0;
+
+ SDL_SemWait(pad_sem);
+ buttons = pad.Buttons;
+ x = pad.Lx;
+ y = pad.Ly;
+ SDL_SemPost(pad_sem);
+
+ /* Axes */
+ if(old_x != x) {
+ SDL_PrivateJoystickAxis(joystick, 0, analog_map[x]);
+ old_x = x;
+ }
+ if(old_y != y) {
+ SDL_PrivateJoystickAxis(joystick, 1, analog_map[y]);
+ old_y = y;
+ }
+
+ /* Buttons */
+ changed = old_buttons ^ buttons;
+ old_buttons = buttons;
+ if(changed) {
+ for(i=0; i<sizeof(button_map)/sizeof(button_map[0]); i++) {
+ if(changed & button_map[i]) {
+ SDL_PrivateJoystickButton(
+ joystick, i,
+ (buttons & button_map[i]) ?
+ SDL_PRESSED : SDL_RELEASED);
+ }
+ }
+ }
+
+ sceKernelDelayThread(0);
+}
+
+/* Function to close a joystick after use */
+void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
+{
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void SDL_SYS_JoystickQuit(void)
+{
+ /* Cleanup Threads and Semaphore. */
+ running = 0;
+ SDL_WaitThread(thread, NULL);
+ SDL_DestroySemaphore(pad_sem);
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = joystick->name;
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+#endif /* SDL_JOYSTICK_PSP */
+
+/* vim: ts=4 sw=4
+ */
diff --git a/src/3rdparty/SDL2/src/joystick/sort_controllers.py b/src/3rdparty/SDL2/src/joystick/sort_controllers.py
new file mode 100644
index 0000000..47213c2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/sort_controllers.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# Script to sort the game controller database entries in SDL_gamecontroller.c
+
+import re
+
+
+filename = "SDL_gamecontrollerdb.h"
+input = open(filename)
+output = open(filename + ".new", "w")
+parsing_controllers = False
+controllers = []
+controller_guids = {}
+split_pattern = re.compile(r'([^"]*")([^,]*,)([^,]*,)([^"]*)(".*)')
+
+def save_controller(line):
+ global controllers
+ match = split_pattern.match(line)
+ entry = [ match.group(1), match.group(2), match.group(3) ]
+ bindings = sorted(match.group(4).split(","))
+ if (bindings[0] == ""):
+ bindings.pop(0)
+ entry.extend(",".join(bindings) + ",")
+ entry.append(match.group(5))
+ controllers.append(entry)
+
+def write_controllers():
+ global controllers
+ global controller_guids
+ for entry in sorted(controllers, key=lambda entry: entry[2]):
+ line = "".join(entry) + "\n"
+ line = line.replace("\t", " ")
+ if not line.endswith(",\n") and not line.endswith("*/\n"):
+ print("Warning: '%s' is missing a comma at the end of the line" % (line))
+ if (entry[1] in controller_guids):
+ print("Warning: entry '%s' is duplicate of entry '%s'" % (entry[2], controller_guids[entry[1]][2]))
+ controller_guids[entry[1]] = entry
+
+ output.write(line)
+ controllers = []
+ controller_guids = {}
+
+for line in input:
+ if (parsing_controllers):
+ if (line.startswith("{")):
+ output.write(line)
+ elif (line.startswith(" NULL")):
+ parsing_controllers = False
+ write_controllers()
+ output.write(line)
+ elif (line.startswith("#if")):
+ print("Parsing " + line.strip())
+ output.write(line)
+ elif (line.startswith("#endif")):
+ write_controllers()
+ output.write(line)
+ else:
+ save_controller(line)
+ else:
+ if (line.startswith("static const char *s_ControllerMappings")):
+ parsing_controllers = True
+
+ output.write(line)
+
+output.close()
+print("Finished writing %s.new" % filename)
diff --git a/src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.c b/src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.c
new file mode 100644
index 0000000..1edaa94
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.c
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+#include "SDL_steamcontroller.h"
+
+
+void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback,
+ SteamControllerDisconnectedCallback_t disconnectedCallback)
+{
+}
+
+void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats)
+{
+ *nbuttons = 0;
+ *naxes = 0;
+ *nhats = 0;
+}
+
+void SDL_UpdateSteamControllers(void)
+{
+}
+
+void SDL_UpdateSteamController(SDL_Joystick *joystick)
+{
+}
+
+void SDL_QuitSteamControllers(void)
+{
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.h b/src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.h
new file mode 100644
index 0000000..ce37b4d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/steam/SDL_steamcontroller.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+typedef SDL_bool (*SteamControllerConnectedCallback_t)(const char *name, SDL_JoystickGUID guid, int *device_instance);
+typedef void (*SteamControllerDisconnectedCallback_t)(int device_instance);
+
+void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback,
+ SteamControllerDisconnectedCallback_t disconnectedCallback);
+void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats);
+void SDL_UpdateSteamControllers(void);
+void SDL_UpdateSteamController(SDL_Joystick *joystick);
+void SDL_QuitSteamControllers(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick.c b/src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick.c
new file mode 100644
index 0000000..cff868b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick.c
@@ -0,0 +1,992 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "../SDL_sysjoystick.h"
+
+#if SDL_JOYSTICK_DINPUT
+
+#include "SDL_windowsjoystick_c.h"
+#include "SDL_dinputjoystick_c.h"
+#include "SDL_xinputjoystick_c.h"
+
+#ifndef DIDFT_OPTIONAL
+#define DIDFT_OPTIONAL 0x80000000
+#endif
+
+#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */
+#define JOY_AXIS_THRESHOLD (((SDL_JOYSTICK_AXIS_MAX)-(SDL_JOYSTICK_AXIS_MIN))/100) /* 1% motion */
+
+/* external variables referenced. */
+extern HWND SDL_HelperWindow;
+
+/* local variables */
+static SDL_bool coinitialized = SDL_FALSE;
+static LPDIRECTINPUT8 dinput = NULL;
+static PRAWINPUTDEVICELIST SDL_RawDevList = NULL;
+static UINT SDL_RawDevListCount = 0;
+
+/* Taken from Wine - Thanks! */
+static DIOBJECTDATAFORMAT dfDIJoystick2[] = {
+ { &GUID_XAxis, DIJOFS_X, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_YAxis, DIJOFS_Y, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_ZAxis, DIJOFS_Z, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RxAxis, DIJOFS_RX, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RyAxis, DIJOFS_RY, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RzAxis, DIJOFS_RZ, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, DIJOFS_SLIDER(0), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, DIJOFS_SLIDER(1), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_POV, DIJOFS_POV(0), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_POV, DIJOFS_POV(1), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_POV, DIJOFS_POV(2), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_POV, DIJOFS_POV(3), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(0), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(1), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(2), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(3), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(4), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(5), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(6), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(7), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(8), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(9), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(10), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(11), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(12), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(13), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(14), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(15), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(16), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(17), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(18), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(19), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(20), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(21), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(22), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(23), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(24), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(25), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(26), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(27), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(28), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(29), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(30), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(31), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(32), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(33), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(34), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(35), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(36), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(37), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(38), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(39), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(40), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(41), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(42), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(43), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(44), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(45), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(46), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(47), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(48), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(49), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(50), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(51), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(52), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(53), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(54), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(55), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(56), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(57), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(58), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(59), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(60), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(61), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(62), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(63), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(64), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(65), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(66), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(67), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(68), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(69), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(70), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(71), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(72), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(73), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(74), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(75), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(76), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(77), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(78), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(79), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(80), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(81), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(82), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(83), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(84), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(85), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(86), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(87), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(88), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(89), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(90), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(91), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(92), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(93), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(94), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(95), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(96), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(97), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(98), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(99), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(100), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(101), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(102), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(103), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(104), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(105), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(106), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(107), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(108), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(109), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(110), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(111), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(112), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(113), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(114), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(115), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(116), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(117), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(118), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(119), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(120), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(121), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(122), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(123), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(124), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(125), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(126), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { NULL, DIJOFS_BUTTON(127), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lVX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lVY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lVZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lVRx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lVRy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lVRz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lAX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lAY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lAZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lARx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lARy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lARz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lFX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lFY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lFZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lFRx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lFRy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lFRz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+ { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 },
+};
+
+const DIDATAFORMAT SDL_c_dfDIJoystick2 = {
+ sizeof(DIDATAFORMAT),
+ sizeof(DIOBJECTDATAFORMAT),
+ DIDF_ABSAXIS,
+ sizeof(DIJOYSTATE2),
+ SDL_arraysize(dfDIJoystick2),
+ dfDIJoystick2
+};
+
+/* Convert a DirectInput return code to a text message */
+static int
+SetDIerror(const char *function, HRESULT code)
+{
+ /*
+ return SDL_SetError("%s() [%s]: %s", function,
+ DXGetErrorString9A(code), DXGetErrorDescription9A(code));
+ */
+ return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);
+}
+
+static SDL_bool
+SDL_IsXInputDevice(const GUID* pGuidProductFromDirectInput)
+{
+ static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XOneWiredGamepad = { MAKELONG(0x045E, 0x02FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XOneWirelessGamepad = { MAKELONG(0x045E, 0x02DD), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XOneNewWirelessGamepad = { MAKELONG(0x045E, 0x02D1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XOneSWirelessGamepad = { MAKELONG(0x045E, 0x02EA), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XOneSBluetoothGamepad = { MAKELONG(0x045E, 0x02E0), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+ static GUID IID_XOneEliteWirelessGamepad = { MAKELONG(0x045E, 0x02E3), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
+
+ static const GUID *s_XInputProductGUID[] = {
+ &IID_ValveStreamingGamepad,
+ &IID_X360WiredGamepad, /* Microsoft's wired X360 controller for Windows. */
+ &IID_X360WirelessGamepad, /* Microsoft's wireless X360 controller for Windows. */
+ &IID_XOneWiredGamepad, /* Microsoft's wired Xbox One controller for Windows. */
+ &IID_XOneWirelessGamepad, /* Microsoft's wireless Xbox One controller for Windows. */
+ &IID_XOneNewWirelessGamepad, /* Microsoft's updated wireless Xbox One controller (w/ 3.5 mm jack) for Windows. */
+ &IID_XOneSWirelessGamepad, /* Microsoft's wireless Xbox One S controller for Windows. */
+ &IID_XOneSBluetoothGamepad, /* Microsoft's Bluetooth Xbox One S controller for Windows. */
+ &IID_XOneEliteWirelessGamepad /* Microsoft's wireless Xbox One Elite controller for Windows. */
+ };
+
+ size_t iDevice;
+ UINT i;
+
+ if (!SDL_XINPUT_Enabled()) {
+ return SDL_FALSE;
+ }
+
+ /* Check for well known XInput device GUIDs */
+ /* This lets us skip RAWINPUT for popular devices. Also, we need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list. */
+ for (iDevice = 0; iDevice < SDL_arraysize(s_XInputProductGUID); ++iDevice) {
+ if (SDL_memcmp(pGuidProductFromDirectInput, s_XInputProductGUID[iDevice], sizeof(GUID)) == 0) {
+ return SDL_TRUE;
+ }
+ }
+
+ /* Go through RAWINPUT (WinXP and later) to find HID devices. */
+ /* Cache this if we end up using it. */
+ if (SDL_RawDevList == NULL) {
+ if ((GetRawInputDeviceList(NULL, &SDL_RawDevListCount, sizeof(RAWINPUTDEVICELIST)) == -1) || (!SDL_RawDevListCount)) {
+ return SDL_FALSE; /* oh well. */
+ }
+
+ SDL_RawDevList = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * SDL_RawDevListCount);
+ if (SDL_RawDevList == NULL) {
+ SDL_OutOfMemory();
+ return SDL_FALSE;
+ }
+
+ if (GetRawInputDeviceList(SDL_RawDevList, &SDL_RawDevListCount, sizeof(RAWINPUTDEVICELIST)) == -1) {
+ SDL_free(SDL_RawDevList);
+ SDL_RawDevList = NULL;
+ return SDL_FALSE; /* oh well. */
+ }
+ }
+
+ for (i = 0; i < SDL_RawDevListCount; i++) {
+ RID_DEVICE_INFO rdi;
+ char devName[128];
+ UINT rdiSize = sizeof(rdi);
+ UINT nameSize = SDL_arraysize(devName);
+
+ rdi.cbSize = sizeof(rdi);
+ if ((SDL_RawDevList[i].dwType == RIM_TYPEHID) &&
+ (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
+ (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)pGuidProductFromDirectInput->Data1)) &&
+ (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
+ (SDL_strstr(devName, "IG_") != NULL)) {
+ return SDL_TRUE;
+ }
+ }
+
+ return SDL_FALSE;
+}
+
+int
+SDL_DINPUT_JoystickInit(void)
+{
+ HRESULT result;
+ HINSTANCE instance;
+
+ result = WIN_CoInitialize();
+ if (FAILED(result)) {
+ return SetDIerror("CoInitialize", result);
+ }
+
+ coinitialized = SDL_TRUE;
+
+ result = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IDirectInput8, (LPVOID)&dinput);
+
+ if (FAILED(result)) {
+ return SetDIerror("CoCreateInstance", result);
+ }
+
+ /* Because we used CoCreateInstance, we need to Initialize it, first. */
+ instance = GetModuleHandle(NULL);
+ if (instance == NULL) {
+ return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError());
+ }
+ result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInput::Initialize", result);
+ }
+ return 0;
+}
+
+/* helper function for direct input, gets called for each connected joystick */
+static BOOL CALLBACK
+EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
+{
+ const Uint16 BUS_USB = 0x03;
+ const Uint16 BUS_BLUETOOTH = 0x05;
+ JoyStick_DeviceData *pNewJoystick;
+ JoyStick_DeviceData *pPrevJoystick = NULL;
+ const DWORD devtype = (pdidInstance->dwDevType & 0xFF);
+ Uint16 *guid16;
+ WCHAR hidPath[MAX_PATH];
+
+ if (devtype == DI8DEVTYPE_SUPPLEMENTAL) {
+ /* Add any supplemental devices that should be ignored here */
+#define MAKE_TABLE_ENTRY(VID, PID) ((((DWORD)PID)<<16)|VID)
+ static DWORD ignored_devices[] = {
+ MAKE_TABLE_ENTRY(0, 0)
+ };
+#undef MAKE_TABLE_ENTRY
+ unsigned int i;
+
+ for (i = 0; i < SDL_arraysize(ignored_devices); ++i) {
+ if (pdidInstance->guidProduct.Data1 == ignored_devices[i]) {
+ return DIENUM_CONTINUE;
+ }
+ }
+ }
+
+ if (SDL_IsXInputDevice(&pdidInstance->guidProduct)) {
+ return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */
+ }
+
+ {
+ HRESULT result;
+ LPDIRECTINPUTDEVICE8 device;
+ LPDIRECTINPUTDEVICE8 InputDevice;
+ DIPROPGUIDANDPATH dipdw2;
+
+ result = IDirectInput8_CreateDevice(dinput, &(pdidInstance->guidInstance), &device, NULL);
+ if (FAILED(result)) {
+ return DIENUM_CONTINUE; /* better luck next time? */
+ }
+
+ /* Now get the IDirectInputDevice8 interface, instead. */
+ result = IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8, (LPVOID *)&InputDevice);
+ /* We are done with this object. Use the stored one from now on. */
+ IDirectInputDevice8_Release(device);
+ if (FAILED(result)) {
+ return DIENUM_CONTINUE; /* better luck next time? */
+ }
+ dipdw2.diph.dwSize = sizeof(dipdw2);
+ dipdw2.diph.dwHeaderSize = sizeof(dipdw2.diph);
+ dipdw2.diph.dwObj = 0; // device property
+ dipdw2.diph.dwHow = DIPH_DEVICE;
+
+ result = IDirectInputDevice8_GetProperty(InputDevice, DIPROP_GUIDANDPATH, &dipdw2.diph);
+ IDirectInputDevice8_Release(InputDevice);
+ if (FAILED(result)) {
+ return DIENUM_CONTINUE; /* better luck next time? */
+ }
+
+ /* Get device path, compare that instead of GUID, additionally update GUIDs of joysticks with matching paths, in case they're not open yet. */
+ SDL_wcslcpy(hidPath, dipdw2.wszPath, SDL_arraysize(hidPath));
+ }
+
+ pNewJoystick = *(JoyStick_DeviceData **)pContext;
+ while (pNewJoystick) {
+ if (SDL_wcscmp(pNewJoystick->hidPath, hidPath) == 0) {
+ /* if we are replacing the front of the list then update it */
+ if (pNewJoystick == *(JoyStick_DeviceData **)pContext) {
+ *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext;
+ } else if (pPrevJoystick) {
+ pPrevJoystick->pNext = pNewJoystick->pNext;
+ }
+
+ // Update with new guid/etc, if it has changed
+ pNewJoystick->dxdevice = *pdidInstance;
+
+ pNewJoystick->pNext = SYS_Joystick;
+ SYS_Joystick = pNewJoystick;
+
+ return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */
+ }
+
+ pPrevJoystick = pNewJoystick;
+ pNewJoystick = pNewJoystick->pNext;
+ }
+
+ pNewJoystick = (JoyStick_DeviceData *)SDL_malloc(sizeof(JoyStick_DeviceData));
+ if (!pNewJoystick) {
+ return DIENUM_CONTINUE; /* better luck next time? */
+ }
+
+ SDL_zerop(pNewJoystick);
+ SDL_wcslcpy(pNewJoystick->hidPath, hidPath, SDL_arraysize(pNewJoystick->hidPath));
+ pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName);
+ if (!pNewJoystick->joystickname) {
+ SDL_free(pNewJoystick);
+ return DIENUM_CONTINUE; /* better luck next time? */
+ }
+
+ SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance,
+ sizeof(DIDEVICEINSTANCE));
+
+ SDL_memset(pNewJoystick->guid.data, 0, sizeof(pNewJoystick->guid.data));
+
+ guid16 = (Uint16 *)pNewJoystick->guid.data;
+ if (SDL_memcmp(&pdidInstance->guidProduct.Data4[2], "PIDVID", 6) == 0) {
+ *guid16++ = SDL_SwapLE16(BUS_USB);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16((Uint16)LOWORD(pdidInstance->guidProduct.Data1)); /* vendor */
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16((Uint16)HIWORD(pdidInstance->guidProduct.Data1)); /* product */
+ *guid16++ = 0;
+ *guid16++ = 0; /* version */
+ *guid16++ = 0;
+ } else {
+ *guid16++ = SDL_SwapLE16(BUS_BLUETOOTH);
+ *guid16++ = 0;
+ SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4);
+ }
+
+ if (SDL_IsGameControllerNameAndGUID(pNewJoystick->joystickname, pNewJoystick->guid) &&
+ SDL_ShouldIgnoreGameController(pNewJoystick->joystickname, pNewJoystick->guid)) {
+ SDL_free(pNewJoystick);
+ return DIENUM_CONTINUE;
+ }
+
+ SDL_SYS_AddJoystickDevice(pNewJoystick);
+
+ return DIENUM_CONTINUE; /* get next device, please */
+}
+
+void
+SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
+{
+ IDirectInput8_EnumDevices(dinput, DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, pContext, DIEDFL_ATTACHEDONLY);
+
+ if (SDL_RawDevList) {
+ SDL_free(SDL_RawDevList); /* in case we used this in DirectInput detection */
+ SDL_RawDevList = NULL;
+ }
+ SDL_RawDevListCount = 0;
+}
+
+static BOOL CALLBACK
+EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
+{
+ SDL_Joystick *joystick = (SDL_Joystick *)pvRef;
+ HRESULT result;
+ input_t *in = &joystick->hwdata->Inputs[joystick->hwdata->NumInputs];
+
+ if (dev->dwType & DIDFT_BUTTON) {
+ in->type = BUTTON;
+ in->num = joystick->nbuttons;
+ in->ofs = DIJOFS_BUTTON(in->num);
+ joystick->nbuttons++;
+ } else if (dev->dwType & DIDFT_POV) {
+ in->type = HAT;
+ in->num = joystick->nhats;
+ in->ofs = DIJOFS_POV(in->num);
+ joystick->nhats++;
+ } else if (dev->dwType & DIDFT_AXIS) {
+ DIPROPRANGE diprg;
+ DIPROPDWORD dilong;
+
+ in->type = AXIS;
+ in->num = joystick->naxes;
+ if (!SDL_memcmp(&dev->guidType, &GUID_XAxis, sizeof(dev->guidType)))
+ in->ofs = DIJOFS_X;
+ else if (!SDL_memcmp(&dev->guidType, &GUID_YAxis, sizeof(dev->guidType)))
+ in->ofs = DIJOFS_Y;
+ else if (!SDL_memcmp(&dev->guidType, &GUID_ZAxis, sizeof(dev->guidType)))
+ in->ofs = DIJOFS_Z;
+ else if (!SDL_memcmp(&dev->guidType, &GUID_RxAxis, sizeof(dev->guidType)))
+ in->ofs = DIJOFS_RX;
+ else if (!SDL_memcmp(&dev->guidType, &GUID_RyAxis, sizeof(dev->guidType)))
+ in->ofs = DIJOFS_RY;
+ else if (!SDL_memcmp(&dev->guidType, &GUID_RzAxis, sizeof(dev->guidType)))
+ in->ofs = DIJOFS_RZ;
+ else if (!SDL_memcmp(&dev->guidType, &GUID_Slider, sizeof(dev->guidType))) {
+ in->ofs = DIJOFS_SLIDER(joystick->hwdata->NumSliders);
+ ++joystick->hwdata->NumSliders;
+ } else {
+ return DIENUM_CONTINUE; /* not an axis we can grok */
+ }
+
+ diprg.diph.dwSize = sizeof(diprg);
+ diprg.diph.dwHeaderSize = sizeof(diprg.diph);
+ diprg.diph.dwObj = dev->dwType;
+ diprg.diph.dwHow = DIPH_BYID;
+ diprg.lMin = SDL_JOYSTICK_AXIS_MIN;
+ diprg.lMax = SDL_JOYSTICK_AXIS_MAX;
+
+ result =
+ IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_RANGE, &diprg.diph);
+ if (FAILED(result)) {
+ return DIENUM_CONTINUE; /* don't use this axis */
+ }
+
+ /* Set dead zone to 0. */
+ dilong.diph.dwSize = sizeof(dilong);
+ dilong.diph.dwHeaderSize = sizeof(dilong.diph);
+ dilong.diph.dwObj = dev->dwType;
+ dilong.diph.dwHow = DIPH_BYID;
+ dilong.dwData = 0;
+ result =
+ IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_DEADZONE, &dilong.diph);
+ if (FAILED(result)) {
+ return DIENUM_CONTINUE; /* don't use this axis */
+ }
+
+ joystick->naxes++;
+ } else {
+ /* not supported at this time */
+ return DIENUM_CONTINUE;
+ }
+
+ joystick->hwdata->NumInputs++;
+
+ if (joystick->hwdata->NumInputs == MAX_INPUTS) {
+ return DIENUM_STOP; /* too many */
+ }
+
+ return DIENUM_CONTINUE;
+}
+
+/* Sort using the data offset into the DInput struct.
+ * This gives a reasonable ordering for the inputs.
+ */
+static int
+SortDevFunc(const void *a, const void *b)
+{
+ const input_t *inputA = (const input_t*)a;
+ const input_t *inputB = (const input_t*)b;
+
+ if (inputA->ofs < inputB->ofs)
+ return -1;
+ if (inputA->ofs > inputB->ofs)
+ return 1;
+ return 0;
+}
+
+/* Sort the input objects and recalculate the indices for each input. */
+static void
+SortDevObjects(SDL_Joystick *joystick)
+{
+ input_t *inputs = joystick->hwdata->Inputs;
+ int nButtons = 0;
+ int nHats = 0;
+ int nAxis = 0;
+ int n;
+
+ SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc);
+
+ for (n = 0; n < joystick->hwdata->NumInputs; n++) {
+ switch (inputs[n].type) {
+ case BUTTON:
+ inputs[n].num = nButtons;
+ nButtons++;
+ break;
+
+ case HAT:
+ inputs[n].num = nHats;
+ nHats++;
+ break;
+
+ case AXIS:
+ inputs[n].num = nAxis;
+ nAxis++;
+ break;
+ }
+ }
+}
+
+int
+SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice)
+{
+ HRESULT result;
+ LPDIRECTINPUTDEVICE8 device;
+ DIPROPDWORD dipdw;
+
+ joystick->hwdata->buffered = SDL_TRUE;
+ joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS);
+
+ SDL_zero(dipdw);
+ dipdw.diph.dwSize = sizeof(DIPROPDWORD);
+ dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+
+ result =
+ IDirectInput8_CreateDevice(dinput,
+ &(joystickdevice->dxdevice.guidInstance), &device, NULL);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInput::CreateDevice", result);
+ }
+
+ /* Now get the IDirectInputDevice8 interface, instead. */
+ result = IDirectInputDevice8_QueryInterface(device,
+ &IID_IDirectInputDevice8,
+ (LPVOID *)& joystick->
+ hwdata->InputDevice);
+ /* We are done with this object. Use the stored one from now on. */
+ IDirectInputDevice8_Release(device);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::QueryInterface", result);
+ }
+
+ /* Acquire shared access. Exclusive access is required for forces,
+ * though. */
+ result =
+ IDirectInputDevice8_SetCooperativeLevel(joystick->hwdata->
+ InputDevice, SDL_HelperWindow,
+ DISCL_EXCLUSIVE |
+ DISCL_BACKGROUND);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result);
+ }
+
+ /* Use the extended data structure: DIJOYSTATE2. */
+ result =
+ IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
+ &SDL_c_dfDIJoystick2);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
+ }
+
+ /* Get device capabilities */
+ result =
+ IDirectInputDevice8_GetCapabilities(joystick->hwdata->InputDevice,
+ &joystick->hwdata->Capabilities);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::GetCapabilities", result);
+ }
+
+ /* Force capable? */
+ if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
+
+ result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::Acquire", result);
+ }
+
+ /* reset all actuators. */
+ result =
+ IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata->
+ InputDevice,
+ DISFFC_RESET);
+
+ /* Not necessarily supported, ignore if not supported.
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result);
+ }
+ */
+
+ result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::Unacquire", result);
+ }
+
+ /* Turn on auto-centering for a ForceFeedback device (until told
+ * otherwise). */
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = DIPROPAUTOCENTER_ON;
+
+ result =
+ IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_AUTOCENTER, &dipdw.diph);
+
+ /* Not necessarily supported, ignore if not supported.
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetProperty", result);
+ }
+ */
+ }
+
+ /* What buttons and axes does it have? */
+ IDirectInputDevice8_EnumObjects(joystick->hwdata->InputDevice,
+ EnumDevObjectsCallback, joystick,
+ DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
+
+ /* Reorder the input objects. Some devices do not report the X axis as
+ * the first axis, for example. */
+ SortDevObjects(joystick);
+
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = INPUT_QSIZE;
+
+ /* Set the buffer size */
+ result =
+ IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_BUFFERSIZE, &dipdw.diph);
+
+ if (result == DI_POLLEDDEVICE) {
+ /* This device doesn't support buffering, so we're forced
+ * to use less reliable polling. */
+ joystick->hwdata->buffered = SDL_FALSE;
+ } else if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetProperty", result);
+ }
+ return 0;
+}
+
+static Uint8
+TranslatePOV(DWORD value)
+{
+ const int HAT_VALS[] = {
+ SDL_HAT_UP,
+ SDL_HAT_UP | SDL_HAT_RIGHT,
+ SDL_HAT_RIGHT,
+ SDL_HAT_DOWN | SDL_HAT_RIGHT,
+ SDL_HAT_DOWN,
+ SDL_HAT_DOWN | SDL_HAT_LEFT,
+ SDL_HAT_LEFT,
+ SDL_HAT_UP | SDL_HAT_LEFT
+ };
+
+ if (LOWORD(value) == 0xFFFF)
+ return SDL_HAT_CENTERED;
+
+ /* Round the value up: */
+ value += 4500 / 2;
+ value %= 36000;
+ value /= 4500;
+
+ if (value >= 8)
+ return SDL_HAT_CENTERED; /* shouldn't happen */
+
+ return HAT_VALS[value];
+}
+
+static void
+UpdateDINPUTJoystickState_Buffered(SDL_Joystick * joystick)
+{
+ int i;
+ HRESULT result;
+ DWORD numevents;
+ DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE];
+
+ numevents = INPUT_QSIZE;
+ result =
+ IDirectInputDevice8_GetDeviceData(joystick->hwdata->InputDevice,
+ sizeof(DIDEVICEOBJECTDATA), evtbuf,
+ &numevents, 0);
+ if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
+ IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
+ result =
+ IDirectInputDevice8_GetDeviceData(joystick->hwdata->InputDevice,
+ sizeof(DIDEVICEOBJECTDATA),
+ evtbuf, &numevents, 0);
+ }
+
+ /* Handle the events or punt */
+ if (FAILED(result)) {
+ joystick->hwdata->send_remove_event = SDL_TRUE;
+ joystick->hwdata->removed = SDL_TRUE;
+ return;
+ }
+
+ for (i = 0; i < (int)numevents; ++i) {
+ int j;
+
+ for (j = 0; j < joystick->hwdata->NumInputs; ++j) {
+ const input_t *in = &joystick->hwdata->Inputs[j];
+
+ if (evtbuf[i].dwOfs != in->ofs)
+ continue;
+
+ switch (in->type) {
+ case AXIS:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)evtbuf[i].dwData);
+ break;
+ case BUTTON:
+ SDL_PrivateJoystickButton(joystick, in->num,
+ (Uint8)(evtbuf[i].dwData ? SDL_PRESSED : SDL_RELEASED));
+ break;
+ case HAT:
+ {
+ Uint8 pos = TranslatePOV(evtbuf[i].dwData);
+ SDL_PrivateJoystickHat(joystick, in->num, pos);
+ }
+ break;
+ }
+ }
+ }
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+static void
+UpdateDINPUTJoystickState_Polled(SDL_Joystick * joystick)
+{
+ DIJOYSTATE2 state;
+ HRESULT result;
+ int i;
+
+ result =
+ IDirectInputDevice8_GetDeviceState(joystick->hwdata->InputDevice,
+ sizeof(DIJOYSTATE2), &state);
+ if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
+ IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
+ result =
+ IDirectInputDevice8_GetDeviceState(joystick->hwdata->InputDevice,
+ sizeof(DIJOYSTATE2), &state);
+ }
+
+ if (result != DI_OK) {
+ joystick->hwdata->send_remove_event = SDL_TRUE;
+ joystick->hwdata->removed = SDL_TRUE;
+ return;
+ }
+
+ /* Set each known axis, button and POV. */
+ for (i = 0; i < joystick->hwdata->NumInputs; ++i) {
+ const input_t *in = &joystick->hwdata->Inputs[i];
+
+ switch (in->type) {
+ case AXIS:
+ switch (in->ofs) {
+ case DIJOFS_X:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lX);
+ break;
+ case DIJOFS_Y:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lY);
+ break;
+ case DIJOFS_Z:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lZ);
+ break;
+ case DIJOFS_RX:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRx);
+ break;
+ case DIJOFS_RY:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRy);
+ break;
+ case DIJOFS_RZ:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRz);
+ break;
+ case DIJOFS_SLIDER(0):
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.rglSlider[0]);
+ break;
+ case DIJOFS_SLIDER(1):
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.rglSlider[1]);
+ break;
+ }
+ break;
+
+ case BUTTON:
+ SDL_PrivateJoystickButton(joystick, in->num,
+ (Uint8)(state.rgbButtons[in->ofs - DIJOFS_BUTTON0] ? SDL_PRESSED : SDL_RELEASED));
+ break;
+ case HAT:
+ {
+ Uint8 pos = TranslatePOV(state.rgdwPOV[in->ofs - DIJOFS_POV(0)]);
+ SDL_PrivateJoystickHat(joystick, in->num, pos);
+ break;
+ }
+ }
+ }
+}
+
+void
+SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick)
+{
+ HRESULT result;
+
+ result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice);
+ if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
+ IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
+ IDirectInputDevice8_Poll(joystick->hwdata->InputDevice);
+ }
+
+ if (joystick->hwdata->buffered) {
+ UpdateDINPUTJoystickState_Buffered(joystick);
+ } else {
+ UpdateDINPUTJoystickState_Polled(joystick);
+ }
+}
+
+void
+SDL_DINPUT_JoystickClose(SDL_Joystick * joystick)
+{
+ IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
+ IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
+}
+
+void
+SDL_DINPUT_JoystickQuit(void)
+{
+ if (dinput != NULL) {
+ IDirectInput8_Release(dinput);
+ dinput = NULL;
+ }
+
+ if (coinitialized) {
+ WIN_CoUninitialize();
+ coinitialized = SDL_FALSE;
+ }
+}
+
+#else /* !SDL_JOYSTICK_DINPUT */
+
+typedef struct JoyStick_DeviceData JoyStick_DeviceData;
+
+int
+SDL_DINPUT_JoystickInit(void)
+{
+ return 0;
+}
+
+void
+SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
+{
+}
+
+int
+SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice)
+{
+ return SDL_Unsupported();
+}
+
+void
+SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick)
+{
+}
+
+void
+SDL_DINPUT_JoystickClose(SDL_Joystick * joystick)
+{
+}
+
+void
+SDL_DINPUT_JoystickQuit(void)
+{
+}
+
+#endif /* SDL_JOYSTICK_DINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h b/src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h
new file mode 100644
index 0000000..5cc1890
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+extern int SDL_DINPUT_JoystickInit(void);
+extern void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
+extern int SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice);
+extern void SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick);
+extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick);
+extern void SDL_DINPUT_JoystickQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_mmjoystick.c b/src/3rdparty/SDL2/src/joystick/windows/SDL_mmjoystick.c
new file mode 100644
index 0000000..9fa8665
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_mmjoystick.c
@@ -0,0 +1,461 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_JOYSTICK_WINMM
+
+/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
+
+#include "../../core/windows/SDL_windows.h"
+#include <mmsystem.h>
+#include <regstr.h>
+
+#include "SDL_events.h"
+#include "SDL_joystick.h"
+#include "../SDL_sysjoystick.h"
+#include "../SDL_joystick_c.h"
+
+#ifdef REGSTR_VAL_JOYOEMNAME
+#undef REGSTR_VAL_JOYOEMNAME
+#endif
+#define REGSTR_VAL_JOYOEMNAME "OEMName"
+
+#define MAX_JOYSTICKS 16
+#define MAX_AXES 6 /* each joystick can have up to 6 axes */
+#define MAX_BUTTONS 32 /* and 32 buttons */
+#define JOY_BUTTON_FLAG(n) (1<<n)
+
+
+/* array to hold joystick ID values */
+static UINT SYS_JoystickID[MAX_JOYSTICKS];
+static JOYCAPSA SYS_Joystick[MAX_JOYSTICKS];
+static char *SYS_JoystickName[MAX_JOYSTICKS];
+
+/* The private structure used to keep track of a joystick */
+struct joystick_hwdata
+{
+ /* joystick ID */
+ UINT id;
+
+ /* values used to translate device-specific coordinates into
+ SDL-standard ranges */
+ struct _transaxis
+ {
+ int offset;
+ float scale;
+ } transaxis[6];
+};
+
+/* Convert a Windows Multimedia API return code to a text message */
+static void SetMMerror(char *function, int code);
+
+
+static char *
+GetJoystickName(int index, const char *szRegKey)
+{
+ /* added 7/24/2004 by Eckhard Stolberg */
+ /*
+ see if there is a joystick for the current
+ index (1-16) listed in the registry
+ */
+ char *name = NULL;
+ HKEY hTopKey;
+ HKEY hKey;
+ DWORD regsize;
+ LONG regresult;
+ char regkey[256];
+ char regvalue[256];
+ char regname[256];
+
+ SDL_snprintf(regkey, SDL_arraysize(regkey),
+#ifdef UNICODE
+ "%S\\%s\\%S",
+#else
+ "%s\\%s\\%s",
+#endif
+ REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
+ hTopKey = HKEY_LOCAL_MACHINE;
+ regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
+ if (regresult != ERROR_SUCCESS) {
+ hTopKey = HKEY_CURRENT_USER;
+ regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
+ }
+ if (regresult != ERROR_SUCCESS) {
+ return NULL;
+ }
+
+ /* find the registry key name for the joystick's properties */
+ regsize = sizeof(regname);
+ SDL_snprintf(regvalue, SDL_arraysize(regvalue), "Joystick%d%s", index + 1,
+ REGSTR_VAL_JOYOEMNAME);
+ regresult =
+ RegQueryValueExA(hKey, regvalue, 0, 0, (LPBYTE) regname, &regsize);
+ RegCloseKey(hKey);
+
+ if (regresult != ERROR_SUCCESS) {
+ return NULL;
+ }
+
+ /* open that registry key */
+ SDL_snprintf(regkey, SDL_arraysize(regkey),
+#ifdef UNICODE
+ "%S\\%s",
+#else
+ "%s\\%s",
+#endif
+ REGSTR_PATH_JOYOEM, regname);
+ regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
+ if (regresult != ERROR_SUCCESS) {
+ return NULL;
+ }
+
+ /* find the size for the OEM name text */
+ regsize = sizeof(regvalue);
+ regresult =
+ RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, NULL, &regsize);
+ if (regresult == ERROR_SUCCESS) {
+ /* allocate enough memory for the OEM name text ... */
+ name = (char *) SDL_malloc(regsize);
+ if (name) {
+ /* ... and read it from the registry */
+ regresult = RegQueryValueExA(hKey,
+ REGSTR_VAL_JOYOEMNAME, 0, 0,
+ (LPBYTE) name, &regsize);
+ }
+ }
+ RegCloseKey(hKey);
+
+ return (name);
+}
+
+static int SDL_SYS_numjoysticks = 0;
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * It should return 0, or -1 on an unrecoverable fatal error.
+ */
+int
+SDL_SYS_JoystickInit(void)
+{
+ int i;
+ int maxdevs;
+ JOYINFOEX joyinfo;
+ JOYCAPSA joycaps;
+ MMRESULT result;
+
+ /* Reset the joystick ID & name mapping tables */
+ for (i = 0; i < MAX_JOYSTICKS; ++i) {
+ SYS_JoystickID[i] = 0;
+ SYS_JoystickName[i] = NULL;
+ }
+
+ /* Loop over all potential joystick devices */
+ SDL_SYS_numjoysticks = 0;
+ maxdevs = joyGetNumDevs();
+ for (i = JOYSTICKID1; i < maxdevs && SDL_SYS_numjoysticks < MAX_JOYSTICKS; ++i) {
+
+ joyinfo.dwSize = sizeof(joyinfo);
+ joyinfo.dwFlags = JOY_RETURNALL;
+ result = joyGetPosEx(i, &joyinfo);
+ if (result == JOYERR_NOERROR) {
+ result = joyGetDevCapsA(i, &joycaps, sizeof(joycaps));
+ if (result == JOYERR_NOERROR) {
+ SYS_JoystickID[SDL_SYS_numjoysticks] = i;
+ SYS_Joystick[SDL_SYS_numjoysticks] = joycaps;
+ SYS_JoystickName[SDL_SYS_numjoysticks] =
+ GetJoystickName(i, joycaps.szRegKey);
+ SDL_SYS_numjoysticks++;
+ }
+ }
+ }
+ return (SDL_SYS_numjoysticks);
+}
+
+int
+SDL_SYS_NumJoysticks(void)
+{
+ return SDL_SYS_numjoysticks;
+}
+
+void
+SDL_SYS_JoystickDetect(void)
+{
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ if (SYS_JoystickName[device_index] != NULL) {
+ return (SYS_JoystickName[device_index]);
+ } else {
+ return (SYS_Joystick[device_index].szPname);
+ }
+}
+
+/* Function to perform the mapping from device index to the instance id for this index */
+SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ return device_index;
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ int index, i;
+ int caps_flags[MAX_AXES - 2] =
+ { JOYCAPS_HASZ, JOYCAPS_HASR, JOYCAPS_HASU, JOYCAPS_HASV };
+ int axis_min[MAX_AXES], axis_max[MAX_AXES];
+
+
+ /* shortcut */
+ index = device_index;
+ axis_min[0] = SYS_Joystick[index].wXmin;
+ axis_max[0] = SYS_Joystick[index].wXmax;
+ axis_min[1] = SYS_Joystick[index].wYmin;
+ axis_max[1] = SYS_Joystick[index].wYmax;
+ axis_min[2] = SYS_Joystick[index].wZmin;
+ axis_max[2] = SYS_Joystick[index].wZmax;
+ axis_min[3] = SYS_Joystick[index].wRmin;
+ axis_max[3] = SYS_Joystick[index].wRmax;
+ axis_min[4] = SYS_Joystick[index].wUmin;
+ axis_max[4] = SYS_Joystick[index].wUmax;
+ axis_min[5] = SYS_Joystick[index].wVmin;
+ axis_max[5] = SYS_Joystick[index].wVmax;
+
+ /* allocate memory for system specific hardware data */
+ joystick->instance_id = device_index;
+ joystick->hwdata =
+ (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
+ if (joystick->hwdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
+
+ /* set hardware data */
+ joystick->hwdata->id = SYS_JoystickID[index];
+ for (i = 0; i < MAX_AXES; ++i) {
+ if ((i < 2) || (SYS_Joystick[index].wCaps & caps_flags[i - 2])) {
+ joystick->hwdata->transaxis[i].offset = SDL_JOYSTICK_AXIS_MIN - axis_min[i];
+ joystick->hwdata->transaxis[i].scale =
+ (float) (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) / (axis_max[i] - axis_min[i]);
+ } else {
+ joystick->hwdata->transaxis[i].offset = 0;
+ joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */
+ }
+ }
+
+ /* fill nbuttons, naxes, and nhats fields */
+ joystick->nbuttons = SYS_Joystick[index].wNumButtons;
+ joystick->naxes = SYS_Joystick[index].wNumAxes;
+ if (SYS_Joystick[index].wCaps & JOYCAPS_HASPOV) {
+ joystick->nhats = 1;
+ } else {
+ joystick->nhats = 0;
+ }
+ return (0);
+}
+
+/* Function to determine if this joystick is attached to the system right now */
+SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+{
+ return SDL_TRUE;
+}
+
+static Uint8
+TranslatePOV(DWORD value)
+{
+ Uint8 pos;
+
+ pos = SDL_HAT_CENTERED;
+ if (value != JOY_POVCENTERED) {
+ if ((value > JOY_POVLEFT) || (value < JOY_POVRIGHT)) {
+ pos |= SDL_HAT_UP;
+ }
+ if ((value > JOY_POVFORWARD) && (value < JOY_POVBACKWARD)) {
+ pos |= SDL_HAT_RIGHT;
+ }
+ if ((value > JOY_POVRIGHT) && (value < JOY_POVLEFT)) {
+ pos |= SDL_HAT_DOWN;
+ }
+ if (value > JOY_POVBACKWARD) {
+ pos |= SDL_HAT_LEFT;
+ }
+ }
+ return (pos);
+}
+
+/* Function to update the state of a joystick - called as a device poll.
+ * This function shouldn't update the joystick structure directly,
+ * but instead should call SDL_PrivateJoystick*() to deliver events
+ * and update joystick device state.
+ */
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ MMRESULT result;
+ int i;
+ DWORD flags[MAX_AXES] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
+ JOY_RETURNR, JOY_RETURNU, JOY_RETURNV
+ };
+ DWORD pos[MAX_AXES];
+ struct _transaxis *transaxis;
+ int value;
+ JOYINFOEX joyinfo;
+
+ joyinfo.dwSize = sizeof(joyinfo);
+ joyinfo.dwFlags = JOY_RETURNALL | JOY_RETURNPOVCTS;
+ if (!joystick->hats) {
+ joyinfo.dwFlags &= ~(JOY_RETURNPOV | JOY_RETURNPOVCTS);
+ }
+ result = joyGetPosEx(joystick->hwdata->id, &joyinfo);
+ if (result != JOYERR_NOERROR) {
+ SetMMerror("joyGetPosEx", result);
+ return;
+ }
+
+ /* joystick motion events */
+ pos[0] = joyinfo.dwXpos;
+ pos[1] = joyinfo.dwYpos;
+ pos[2] = joyinfo.dwZpos;
+ pos[3] = joyinfo.dwRpos;
+ pos[4] = joyinfo.dwUpos;
+ pos[5] = joyinfo.dwVpos;
+
+ transaxis = joystick->hwdata->transaxis;
+ for (i = 0; i < joystick->naxes; i++) {
+ if (joyinfo.dwFlags & flags[i]) {
+ value = (int) (((float) pos[i] + transaxis[i].offset) * transaxis[i].scale);
+ SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value);
+ }
+ }
+
+ /* joystick button events */
+ if (joyinfo.dwFlags & JOY_RETURNBUTTONS) {
+ for (i = 0; i < joystick->nbuttons; ++i) {
+ if (joyinfo.dwButtons & JOY_BUTTON_FLAG(i)) {
+ SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_PRESSED);
+ } else {
+ SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_RELEASED);
+ }
+ }
+ }
+
+ /* joystick hat events */
+ if (joyinfo.dwFlags & JOY_RETURNPOV) {
+ Uint8 pos;
+
+ pos = TranslatePOV(joyinfo.dwPOV);
+ SDL_PrivateJoystickHat(joystick, 0, pos);
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+ SDL_free(joystick->hwdata);
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+ int i;
+ for (i = 0; i < MAX_JOYSTICKS; i++) {
+ SDL_free(SYS_JoystickName[i]);
+ SYS_JoystickName[i] = NULL;
+ }
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ SDL_JoystickGUID guid;
+ /* the GUID is just the first 16 chars of the name for now */
+ const char *name = joystick->name;
+ SDL_zero( guid );
+ SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+ return guid;
+}
+
+
+/* implementation functions */
+void
+SetMMerror(char *function, int code)
+{
+ static char *error;
+ static char errbuf[1024];
+
+ errbuf[0] = 0;
+ switch (code) {
+ case MMSYSERR_NODRIVER:
+ error = "Joystick driver not present";
+ break;
+
+ case MMSYSERR_INVALPARAM:
+ case JOYERR_PARMS:
+ error = "Invalid parameter(s)";
+ break;
+
+ case MMSYSERR_BADDEVICEID:
+ error = "Bad device ID";
+ break;
+
+ case JOYERR_UNPLUGGED:
+ error = "Joystick not attached";
+ break;
+
+ case JOYERR_NOCANDO:
+ error = "Can't capture joystick input";
+ break;
+
+ default:
+ SDL_snprintf(errbuf, SDL_arraysize(errbuf),
+ "%s: Unknown Multimedia system error: 0x%x",
+ function, code);
+ break;
+ }
+
+ if (!errbuf[0]) {
+ SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function,
+ error);
+ }
+ SDL_SetError("%s", errbuf);
+}
+
+#endif /* SDL_JOYSTICK_WINMM */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick.c b/src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick.c
new file mode 100644
index 0000000..45cbea6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick.c
@@ -0,0 +1,548 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT
+
+/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
+ * A. Formiga's WINMM driver.
+ *
+ * Hats and sliders are completely untested; the app I'm writing this for mostly
+ * doesn't use them and I don't own any joysticks with them.
+ *
+ * We don't bother to use event notification here. It doesn't seem to work
+ * with polled devices, and it's fine to call IDirectInputDevice8_GetDeviceData and
+ * let it return 0 events. */
+
+#include "SDL_error.h"
+#include "SDL_assert.h"
+#include "SDL_events.h"
+#include "SDL_timer.h"
+#include "SDL_mutex.h"
+#include "SDL_joystick.h"
+#include "../SDL_sysjoystick.h"
+#include "../../thread/SDL_systhread.h"
+#include "../../core/windows/SDL_windows.h"
+#if !defined(__WINRT__)
+#include <dbt.h>
+#endif
+
+#define INITGUID /* Only set here, if set twice will cause mingw32 to break. */
+#include "SDL_windowsjoystick_c.h"
+#include "SDL_dinputjoystick_c.h"
+#include "SDL_xinputjoystick_c.h"
+
+#include "../../haptic/windows/SDL_dinputhaptic_c.h" /* For haptic hot plugging */
+#include "../../haptic/windows/SDL_xinputhaptic_c.h" /* For haptic hot plugging */
+
+
+#ifndef DEVICE_NOTIFY_WINDOW_HANDLE
+#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
+#endif
+
+/* local variables */
+static SDL_bool s_bDeviceAdded = SDL_FALSE;
+static SDL_bool s_bDeviceRemoved = SDL_FALSE;
+static SDL_JoystickID s_nInstanceID = -1;
+static SDL_cond *s_condJoystickThread = NULL;
+static SDL_mutex *s_mutexJoyStickEnum = NULL;
+static SDL_Thread *s_threadJoystick = NULL;
+static SDL_bool s_bJoystickThreadQuit = SDL_FALSE;
+
+JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */
+
+static SDL_bool s_bWindowsDeviceChanged = SDL_FALSE;
+
+#ifdef __WINRT__
+
+typedef struct
+{
+ int unused;
+} SDL_DeviceNotificationData;
+
+static void
+SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
+{
+}
+
+static int
+SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
+{
+ return 0;
+}
+
+static SDL_bool
+SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex)
+{
+ return SDL_FALSE;
+}
+
+#else /* !__WINRT__ */
+
+typedef struct
+{
+ HRESULT coinitialized;
+ WNDCLASSEX wincl;
+ HWND messageWindow;
+ HDEVNOTIFY hNotify;
+} SDL_DeviceNotificationData;
+
+#define IDT_SDL_DEVICE_CHANGE_TIMER_1 1200
+#define IDT_SDL_DEVICE_CHANGE_TIMER_2 1201
+
+/* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal */
+static LRESULT CALLBACK
+SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message) {
+ case WM_DEVICECHANGE:
+ switch (wParam) {
+ case DBT_DEVICEARRIVAL:
+ case DBT_DEVICEREMOVECOMPLETE:
+ if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
+ /* notify 300ms and 2 seconds later to ensure all APIs have updated status */
+ SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_1, 300, NULL);
+ SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_2, 2000, NULL);
+ }
+ break;
+ }
+ return 0;
+ case WM_TIMER:
+ KillTimer(hwnd, wParam);
+ s_bWindowsDeviceChanged = SDL_TRUE;
+ return 0;
+ }
+
+ return DefWindowProc (hwnd, message, wParam, lParam);
+}
+
+static void
+SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
+{
+ if (data->hNotify)
+ UnregisterDeviceNotification(data->hNotify);
+
+ if (data->messageWindow)
+ DestroyWindow(data->messageWindow);
+
+ UnregisterClass(data->wincl.lpszClassName, data->wincl.hInstance);
+
+ if (data->coinitialized == S_OK) {
+ WIN_CoUninitialize();
+ }
+}
+
+static int
+SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
+{
+ DEV_BROADCAST_DEVICEINTERFACE dbh;
+ GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
+
+ SDL_zerop(data);
+
+ data->coinitialized = WIN_CoInitialize();
+
+ data->wincl.hInstance = GetModuleHandle(NULL);
+ data->wincl.lpszClassName = L"Message";
+ data->wincl.lpfnWndProc = SDL_PrivateJoystickDetectProc; /* This function is called by windows */
+ data->wincl.cbSize = sizeof (WNDCLASSEX);
+
+ if (!RegisterClassEx(&data->wincl)) {
+ WIN_SetError("Failed to create register class for joystick autodetect");
+ SDL_CleanupDeviceNotification(data);
+ return -1;
+ }
+
+ data->messageWindow = (HWND)CreateWindowEx(0, L"Message", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
+ if (!data->messageWindow) {
+ WIN_SetError("Failed to create message window for joystick autodetect");
+ SDL_CleanupDeviceNotification(data);
+ return -1;
+ }
+
+ SDL_zero(dbh);
+ dbh.dbcc_size = sizeof(dbh);
+ dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+ dbh.dbcc_classguid = GUID_DEVINTERFACE_HID;
+
+ data->hNotify = RegisterDeviceNotification(data->messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE);
+ if (!data->hNotify) {
+ WIN_SetError("Failed to create notify device for joystick autodetect");
+ SDL_CleanupDeviceNotification(data);
+ return -1;
+ }
+ return 0;
+}
+
+static SDL_bool
+SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex)
+{
+ MSG msg;
+ int lastret = 1;
+
+ if (!data->messageWindow) {
+ return SDL_FALSE; /* device notifications require a window */
+ }
+
+ SDL_UnlockMutex(mutex);
+ while (lastret > 0 && s_bWindowsDeviceChanged == SDL_FALSE) {
+ lastret = GetMessage(&msg, NULL, 0, 0); /* WM_QUIT causes return value of 0 */
+ if (lastret > 0) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ SDL_LockMutex(mutex);
+ return (lastret != -1) ? SDL_TRUE : SDL_FALSE;
+}
+
+#endif /* __WINRT__ */
+
+/* Function/thread to scan the system for joysticks. */
+static int
+SDL_JoystickThread(void *_data)
+{
+ SDL_DeviceNotificationData notification_data;
+
+#if SDL_JOYSTICK_XINPUT
+ SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT];
+ SDL_zero(bOpenedXInputDevices);
+#endif
+
+ if (SDL_CreateDeviceNotification(&notification_data) < 0) {
+ return -1;
+ }
+
+ SDL_LockMutex(s_mutexJoyStickEnum);
+ while (s_bJoystickThreadQuit == SDL_FALSE) {
+ SDL_bool bXInputChanged = SDL_FALSE;
+
+ if (SDL_WaitForDeviceNotification(&notification_data, s_mutexJoyStickEnum) == SDL_FALSE) {
+#if SDL_JOYSTICK_XINPUT
+ /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */
+ SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000);
+ if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) {
+ /* scan for any change in XInput devices */
+ Uint8 userId;
+ for (userId = 0; userId < XUSER_MAX_COUNT; userId++) {
+ XINPUT_CAPABILITIES capabilities;
+ const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities);
+ const SDL_bool available = (result == ERROR_SUCCESS);
+ if (bOpenedXInputDevices[userId] != available) {
+ bXInputChanged = SDL_TRUE;
+ bOpenedXInputDevices[userId] = available;
+ }
+ }
+ }
+#else
+ /* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */
+ break;
+#endif /* SDL_JOYSTICK_XINPUT */
+ }
+
+ if (s_bWindowsDeviceChanged || bXInputChanged) {
+ s_bDeviceRemoved = SDL_TRUE;
+ s_bDeviceAdded = SDL_TRUE;
+ s_bWindowsDeviceChanged = SDL_FALSE;
+ }
+ }
+ SDL_UnlockMutex(s_mutexJoyStickEnum);
+
+ SDL_CleanupDeviceNotification(&notification_data);
+
+ return 1;
+}
+
+void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device)
+{
+ device->send_add_event = SDL_TRUE;
+ device->nInstanceID = ++s_nInstanceID;
+ device->pNext = SYS_Joystick;
+ SYS_Joystick = device;
+
+ s_bDeviceAdded = SDL_TRUE;
+}
+
+/* Function to scan the system for joysticks.
+ * Joystick 0 should be the system default joystick.
+ * It should return 0, or -1 on an unrecoverable fatal error.
+ */
+int
+SDL_SYS_JoystickInit(void)
+{
+ if (SDL_DINPUT_JoystickInit() < 0) {
+ SDL_SYS_JoystickQuit();
+ return -1;
+ }
+
+ if (SDL_XINPUT_JoystickInit() < 0) {
+ SDL_SYS_JoystickQuit();
+ return -1;
+ }
+
+ s_mutexJoyStickEnum = SDL_CreateMutex();
+ s_condJoystickThread = SDL_CreateCond();
+ s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */
+
+ SDL_SYS_JoystickDetect();
+
+ if (!s_threadJoystick) {
+ /* spin up the thread to detect hotplug of devices */
+ s_bJoystickThreadQuit = SDL_FALSE;
+ s_threadJoystick = SDL_CreateThreadInternal(SDL_JoystickThread, "SDL_joystick", 64 * 1024, NULL);
+ }
+ return SDL_SYS_NumJoysticks();
+}
+
+/* return the number of joysticks that are connected right now */
+int
+SDL_SYS_NumJoysticks(void)
+{
+ int nJoysticks = 0;
+ JoyStick_DeviceData *device = SYS_Joystick;
+ while (device) {
+ nJoysticks++;
+ device = device->pNext;
+ }
+
+ return nJoysticks;
+}
+
+/* detect any new joysticks being inserted into the system */
+void
+SDL_SYS_JoystickDetect(void)
+{
+ JoyStick_DeviceData *pCurList = NULL;
+
+ /* only enum the devices if the joystick thread told us something changed */
+ if (!s_bDeviceAdded && !s_bDeviceRemoved) {
+ return; /* thread hasn't signaled, nothing to do right now. */
+ }
+
+ SDL_LockMutex(s_mutexJoyStickEnum);
+
+ s_bDeviceAdded = SDL_FALSE;
+ s_bDeviceRemoved = SDL_FALSE;
+
+ pCurList = SYS_Joystick;
+ SYS_Joystick = NULL;
+
+ /* Look for DirectInput joysticks, wheels, head trackers, gamepads, etc.. */
+ SDL_DINPUT_JoystickDetect(&pCurList);
+
+ /* Look for XInput devices. Do this last, so they're first in the final list. */
+ SDL_XINPUT_JoystickDetect(&pCurList);
+
+ SDL_UnlockMutex(s_mutexJoyStickEnum);
+
+ while (pCurList) {
+ JoyStick_DeviceData *pListNext = NULL;
+
+ if (pCurList->bXInputDevice) {
+ SDL_XINPUT_MaybeRemoveDevice(pCurList->XInputUserId);
+ } else {
+ SDL_DINPUT_MaybeRemoveDevice(&pCurList->dxdevice);
+ }
+
+ SDL_PrivateJoystickRemoved(pCurList->nInstanceID);
+
+ pListNext = pCurList->pNext;
+ SDL_free(pCurList->joystickname);
+ SDL_free(pCurList);
+ pCurList = pListNext;
+ }
+
+ if (s_bDeviceAdded) {
+ JoyStick_DeviceData *pNewJoystick;
+ int device_index = 0;
+ s_bDeviceAdded = SDL_FALSE;
+ pNewJoystick = SYS_Joystick;
+ while (pNewJoystick) {
+ if (pNewJoystick->send_add_event) {
+ if (pNewJoystick->bXInputDevice) {
+ SDL_XINPUT_MaybeAddDevice(pNewJoystick->XInputUserId);
+ } else {
+ SDL_DINPUT_MaybeAddDevice(&pNewJoystick->dxdevice);
+ }
+
+ SDL_PrivateJoystickAdded(device_index);
+
+ pNewJoystick->send_add_event = SDL_FALSE;
+ }
+ device_index++;
+ pNewJoystick = pNewJoystick->pNext;
+ }
+ }
+}
+
+/* Function to get the device-dependent name of a joystick */
+const char *
+SDL_SYS_JoystickNameForDeviceIndex(int device_index)
+{
+ JoyStick_DeviceData *device = SYS_Joystick;
+
+ for (; device_index > 0; device_index--)
+ device = device->pNext;
+
+ return device->joystickname;
+}
+
+/* Function to perform the mapping between current device instance and this joysticks instance id */
+SDL_JoystickID
+SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
+{
+ JoyStick_DeviceData *device = SYS_Joystick;
+ int index;
+
+ for (index = device_index; index > 0; index--)
+ device = device->pNext;
+
+ return device->nInstanceID;
+}
+
+/* Function to open a joystick for use.
+ The joystick to open is specified by the device index.
+ This should fill the nbuttons and naxes fields of the joystick structure.
+ It returns 0, or -1 if there is an error.
+ */
+int
+SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
+{
+ JoyStick_DeviceData *joystickdevice = SYS_Joystick;
+
+ for (; device_index > 0; device_index--)
+ joystickdevice = joystickdevice->pNext;
+
+ /* allocate memory for system specific hardware data */
+ joystick->instance_id = joystickdevice->nInstanceID;
+ joystick->hwdata =
+ (struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
+ if (joystick->hwdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+ SDL_zerop(joystick->hwdata);
+ joystick->hwdata->guid = joystickdevice->guid;
+
+ if (joystickdevice->bXInputDevice) {
+ return SDL_XINPUT_JoystickOpen(joystick, joystickdevice);
+ } else {
+ return SDL_DINPUT_JoystickOpen(joystick, joystickdevice);
+ }
+}
+
+/* return true if this joystick is plugged in right now */
+SDL_bool
+SDL_SYS_JoystickAttached(SDL_Joystick * joystick)
+{
+ return joystick->hwdata && !joystick->hwdata->removed;
+}
+
+void
+SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
+{
+ if (!joystick->hwdata || joystick->hwdata->removed) {
+ return;
+ }
+
+ if (joystick->hwdata->bXInputDevice) {
+ SDL_XINPUT_JoystickUpdate(joystick);
+ } else {
+ SDL_DINPUT_JoystickUpdate(joystick);
+ }
+
+ if (joystick->hwdata->removed) {
+ joystick->force_recentering = SDL_TRUE;
+ }
+}
+
+/* Function to close a joystick after use */
+void
+SDL_SYS_JoystickClose(SDL_Joystick * joystick)
+{
+ if (joystick->hwdata->bXInputDevice) {
+ SDL_XINPUT_JoystickClose(joystick);
+ } else {
+ SDL_DINPUT_JoystickClose(joystick);
+ }
+
+ SDL_free(joystick->hwdata);
+}
+
+/* Function to perform any system-specific joystick related cleanup */
+void
+SDL_SYS_JoystickQuit(void)
+{
+ JoyStick_DeviceData *device = SYS_Joystick;
+
+ while (device) {
+ JoyStick_DeviceData *device_next = device->pNext;
+ SDL_free(device->joystickname);
+ SDL_free(device);
+ device = device_next;
+ }
+ SYS_Joystick = NULL;
+
+ if (s_threadJoystick) {
+ SDL_LockMutex(s_mutexJoyStickEnum);
+ s_bJoystickThreadQuit = SDL_TRUE;
+ SDL_CondBroadcast(s_condJoystickThread); /* signal the joystick thread to quit */
+ SDL_UnlockMutex(s_mutexJoyStickEnum);
+#ifndef __WINRT__
+ PostThreadMessage(SDL_GetThreadID(s_threadJoystick), WM_QUIT, 0, 0);
+#endif
+ SDL_WaitThread(s_threadJoystick, NULL); /* wait for it to bugger off */
+
+ SDL_DestroyMutex(s_mutexJoyStickEnum);
+ SDL_DestroyCond(s_condJoystickThread);
+ s_condJoystickThread= NULL;
+ s_mutexJoyStickEnum = NULL;
+ s_threadJoystick = NULL;
+ }
+
+ SDL_DINPUT_JoystickQuit();
+ SDL_XINPUT_JoystickQuit();
+
+ s_bDeviceAdded = SDL_FALSE;
+ s_bDeviceRemoved = SDL_FALSE;
+}
+
+/* return the stable device guid for this device index */
+SDL_JoystickGUID
+SDL_SYS_JoystickGetDeviceGUID(int device_index)
+{
+ JoyStick_DeviceData *device = SYS_Joystick;
+ int index;
+
+ for (index = device_index; index > 0; index--)
+ device = device->pNext;
+
+ return device->guid;
+}
+
+SDL_JoystickGUID
+SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+{
+ return joystick->hwdata->guid;
+}
+
+#endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h b/src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h
new file mode 100644
index 0000000..01b8b3a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h
@@ -0,0 +1,93 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_events.h"
+#include "../SDL_sysjoystick.h"
+#include "../../core/windows/SDL_windows.h"
+#include "../../core/windows/SDL_directx.h"
+
+#define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */
+
+typedef struct JoyStick_DeviceData
+{
+ SDL_JoystickGUID guid;
+ char *joystickname;
+ Uint8 send_add_event;
+ SDL_JoystickID nInstanceID;
+ SDL_bool bXInputDevice;
+ BYTE SubType;
+ Uint8 XInputUserId;
+ DIDEVICEINSTANCE dxdevice;
+ WCHAR hidPath[MAX_PATH];
+ struct JoyStick_DeviceData *pNext;
+} JoyStick_DeviceData;
+
+extern JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */
+
+typedef enum Type
+{
+ BUTTON,
+ AXIS,
+ HAT
+} Type;
+
+typedef struct input_t
+{
+ /* DirectInput offset for this input type: */
+ DWORD ofs;
+
+ /* Button, axis or hat: */
+ Type type;
+
+ /* SDL input offset: */
+ Uint8 num;
+} input_t;
+
+/* The private structure used to keep track of a joystick */
+struct joystick_hwdata
+{
+ SDL_JoystickGUID guid;
+ SDL_bool removed;
+ SDL_bool send_remove_event;
+
+#if SDL_JOYSTICK_DINPUT
+ LPDIRECTINPUTDEVICE8 InputDevice;
+ DIDEVCAPS Capabilities;
+ SDL_bool buffered;
+ input_t Inputs[MAX_INPUTS];
+ int NumInputs;
+ int NumSliders;
+#endif
+
+ SDL_bool bXInputDevice; /* SDL_TRUE if this device supports using the xinput API rather than DirectInput */
+ SDL_bool bXInputHaptic; /* Supports force feedback via XInput. */
+ Uint8 userid; /* XInput userid index for this joystick */
+ DWORD dwPacketNumber;
+};
+
+#if SDL_JOYSTICK_DINPUT
+extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
+#endif
+
+extern void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick.c b/src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick.c
new file mode 100644
index 0000000..823e767
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick.c
@@ -0,0 +1,522 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "../SDL_sysjoystick.h"
+
+#if SDL_JOYSTICK_XINPUT
+
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_windowsjoystick_c.h"
+#include "SDL_xinputjoystick_c.h"
+
+/*
+ * Internal stuff.
+ */
+static SDL_bool s_bXInputEnabled = SDL_TRUE;
+static char *s_arrXInputDevicePath[XUSER_MAX_COUNT];
+
+
+static SDL_bool
+SDL_XInputUseOldJoystickMapping()
+{
+#ifdef __WINRT__
+ /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
+ /* FIXME: Why are Win8/10 different here? -flibit */
+ return (NTDDI_VERSION < NTDDI_WIN10);
+#else
+ static int s_XInputUseOldJoystickMapping = -1;
+ if (s_XInputUseOldJoystickMapping < 0) {
+ s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
+ }
+ return (s_XInputUseOldJoystickMapping > 0);
+#endif
+}
+
+SDL_bool SDL_XINPUT_Enabled(void)
+{
+ return s_bXInputEnabled;
+}
+
+int
+SDL_XINPUT_JoystickInit(void)
+{
+ s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE);
+
+ if (s_bXInputEnabled && WIN_LoadXInputDLL() < 0) {
+ s_bXInputEnabled = SDL_FALSE; /* oh well. */
+ }
+ return 0;
+}
+
+static char *
+GetXInputName(const Uint8 userid, BYTE SubType)
+{
+ char name[32];
+
+ if (SDL_XInputUseOldJoystickMapping()) {
+ SDL_snprintf(name, sizeof(name), "X360 Controller #%u", 1 + userid);
+ } else {
+ switch (SubType) {
+ case XINPUT_DEVSUBTYPE_GAMEPAD:
+ SDL_snprintf(name, sizeof(name), "XInput Controller #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_WHEEL:
+ SDL_snprintf(name, sizeof(name), "XInput Wheel #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_ARCADE_STICK:
+ SDL_snprintf(name, sizeof(name), "XInput ArcadeStick #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
+ SDL_snprintf(name, sizeof(name), "XInput FlightStick #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_DANCE_PAD:
+ SDL_snprintf(name, sizeof(name), "XInput DancePad #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_GUITAR:
+ case XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE:
+ case XINPUT_DEVSUBTYPE_GUITAR_BASS:
+ SDL_snprintf(name, sizeof(name), "XInput Guitar #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_DRUM_KIT:
+ SDL_snprintf(name, sizeof(name), "XInput DrumKit #%u", 1 + userid);
+ break;
+ case XINPUT_DEVSUBTYPE_ARCADE_PAD:
+ SDL_snprintf(name, sizeof(name), "XInput ArcadePad #%u", 1 + userid);
+ break;
+ default:
+ SDL_snprintf(name, sizeof(name), "XInput Device #%u", 1 + userid);
+ break;
+ }
+ }
+ return SDL_strdup(name);
+}
+
+/* We can't really tell what device is being used for XInput, but we can guess
+ and we'll be correct for the case where only one device is connected.
+ */
+static void
+GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion)
+{
+#ifndef __WINRT__ /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
+
+ PRAWINPUTDEVICELIST devices = NULL;
+ UINT i, j, device_count = 0;
+
+ if ((GetRawInputDeviceList(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!device_count)) {
+ return; /* oh well. */
+ }
+
+ devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count);
+ if (devices == NULL) {
+ return;
+ }
+
+ if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) {
+ SDL_free(devices);
+ return; /* oh well. */
+ }
+
+ for (i = 0; i < device_count; i++) {
+ RID_DEVICE_INFO rdi;
+ char devName[128];
+ UINT rdiSize = sizeof(rdi);
+ UINT nameSize = SDL_arraysize(devName);
+
+ rdi.cbSize = sizeof(rdi);
+ if ((devices[i].dwType == RIM_TYPEHID) &&
+ (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
+ (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
+ (SDL_strstr(devName, "IG_") != NULL)) {
+ SDL_bool found = SDL_FALSE;
+ for (j = 0; j < SDL_arraysize(s_arrXInputDevicePath); ++j) {
+ if (j == userid) {
+ continue;
+ }
+ if (!s_arrXInputDevicePath[j]) {
+ continue;
+ }
+ if (SDL_strcmp(devName, s_arrXInputDevicePath[j]) == 0) {
+ found = SDL_TRUE;
+ break;
+ }
+ }
+ if (found) {
+ /* We already have this device in our XInput device list */
+ continue;
+ }
+
+ /* We don't actually know if this is the right device for this
+ * userid, but we'll record it so we'll at least be consistent
+ * when the raw device list changes.
+ */
+ *pVID = (Uint16)rdi.hid.dwVendorId;
+ *pPID = (Uint16)rdi.hid.dwProductId;
+ *pVersion = (Uint16)rdi.hid.dwVersionNumber;
+ if (s_arrXInputDevicePath[userid]) {
+ SDL_free(s_arrXInputDevicePath[userid]);
+ }
+ s_arrXInputDevicePath[userid] = SDL_strdup(devName);
+ break;
+ }
+ }
+ SDL_free(devices);
+#endif /* ifndef __WINRT__ */
+}
+
+static void
+AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
+{
+ JoyStick_DeviceData *pPrevJoystick = NULL;
+ JoyStick_DeviceData *pNewJoystick = *pContext;
+
+ if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD)
+ return;
+
+ if (SubType == XINPUT_DEVSUBTYPE_UNKNOWN)
+ return;
+
+ while (pNewJoystick) {
+ if (pNewJoystick->bXInputDevice && (pNewJoystick->XInputUserId == userid) && (pNewJoystick->SubType == SubType)) {
+ /* if we are replacing the front of the list then update it */
+ if (pNewJoystick == *pContext) {
+ *pContext = pNewJoystick->pNext;
+ } else if (pPrevJoystick) {
+ pPrevJoystick->pNext = pNewJoystick->pNext;
+ }
+
+ pNewJoystick->pNext = SYS_Joystick;
+ SYS_Joystick = pNewJoystick;
+ return; /* already in the list. */
+ }
+
+ pPrevJoystick = pNewJoystick;
+ pNewJoystick = pNewJoystick->pNext;
+ }
+
+ pNewJoystick = (JoyStick_DeviceData *)SDL_malloc(sizeof(JoyStick_DeviceData));
+ if (!pNewJoystick) {
+ return; /* better luck next time? */
+ }
+ SDL_zerop(pNewJoystick);
+
+ pNewJoystick->joystickname = GetXInputName(userid, SubType);
+ if (!pNewJoystick->joystickname) {
+ SDL_free(pNewJoystick);
+ return; /* better luck next time? */
+ }
+
+ pNewJoystick->bXInputDevice = SDL_TRUE;
+ if (SDL_XInputUseOldJoystickMapping()) {
+ SDL_zero(pNewJoystick->guid);
+ } else {
+ const Uint16 BUS_USB = 0x03;
+ Uint16 vendor = 0;
+ Uint16 product = 0;
+ Uint16 version = 0;
+ Uint16 *guid16 = (Uint16 *)pNewJoystick->guid.data;
+
+ GuessXInputDevice(userid, &vendor, &product, &version);
+
+ *guid16++ = SDL_SwapLE16(BUS_USB);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16(vendor);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16(product);
+ *guid16++ = 0;
+ *guid16++ = SDL_SwapLE16(version);
+ *guid16++ = 0;
+
+ /* Note that this is an XInput device and what subtype it is */
+ pNewJoystick->guid.data[14] = 'x';
+ pNewJoystick->guid.data[15] = SubType;
+ }
+ pNewJoystick->SubType = SubType;
+ pNewJoystick->XInputUserId = userid;
+
+ if (SDL_ShouldIgnoreGameController(pNewJoystick->joystickname, pNewJoystick->guid)) {
+ SDL_free(pNewJoystick);
+ return;
+ }
+
+ SDL_SYS_AddJoystickDevice(pNewJoystick);
+}
+
+void
+SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
+{
+ int iuserid;
+
+ if (!s_bXInputEnabled) {
+ return;
+ }
+
+ /* iterate in reverse, so these are in the final list in ascending numeric order. */
+ for (iuserid = XUSER_MAX_COUNT - 1; iuserid >= 0; iuserid--) {
+ const Uint8 userid = (Uint8)iuserid;
+ XINPUT_CAPABILITIES capabilities;
+ if (XINPUTGETCAPABILITIES(userid, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS) {
+ AddXInputDevice(userid, capabilities.SubType, pContext);
+ }
+ }
+}
+
+int
+SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice)
+{
+ const Uint8 userId = joystickdevice->XInputUserId;
+ XINPUT_CAPABILITIES capabilities;
+ XINPUT_VIBRATION state;
+
+ SDL_assert(s_bXInputEnabled);
+ SDL_assert(XINPUTGETCAPABILITIES);
+ SDL_assert(XINPUTSETSTATE);
+ SDL_assert(userId < XUSER_MAX_COUNT);
+
+ joystick->hwdata->bXInputDevice = SDL_TRUE;
+
+ if (XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities) != ERROR_SUCCESS) {
+ SDL_free(joystick->hwdata);
+ joystick->hwdata = NULL;
+ return SDL_SetError("Failed to obtain XInput device capabilities. Device disconnected?");
+ }
+ SDL_zero(state);
+ joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS);
+ joystick->hwdata->userid = userId;
+
+ /* The XInput API has a hard coded button/axis mapping, so we just match it */
+ if (SDL_XInputUseOldJoystickMapping()) {
+ joystick->naxes = 6;
+ joystick->nbuttons = 15;
+ } else {
+ joystick->naxes = 6;
+ joystick->nbuttons = 11;
+ joystick->nhats = 1;
+ }
+ return 0;
+}
+
+static void
+UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
+{
+ if (pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN) {
+ SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN;
+ if (pBatteryInformation->BatteryType == BATTERY_TYPE_WIRED) {
+ ePowerLevel = SDL_JOYSTICK_POWER_WIRED;
+ } else {
+ switch (pBatteryInformation->BatteryLevel) {
+ case BATTERY_LEVEL_EMPTY:
+ ePowerLevel = SDL_JOYSTICK_POWER_EMPTY;
+ break;
+ case BATTERY_LEVEL_LOW:
+ ePowerLevel = SDL_JOYSTICK_POWER_LOW;
+ break;
+ case BATTERY_LEVEL_MEDIUM:
+ ePowerLevel = SDL_JOYSTICK_POWER_MEDIUM;
+ break;
+ default:
+ case BATTERY_LEVEL_FULL:
+ ePowerLevel = SDL_JOYSTICK_POWER_FULL;
+ break;
+ }
+ }
+
+ SDL_PrivateJoystickBatteryLevel(joystick, ePowerLevel);
+ }
+}
+
+static void
+UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
+{
+ static WORD s_XInputButtons[] = {
+ XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT,
+ XINPUT_GAMEPAD_START, XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB,
+ XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER,
+ XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y,
+ XINPUT_GAMEPAD_GUIDE
+ };
+ WORD wButtons = pXInputState->Gamepad.wButtons;
+ Uint8 button;
+
+ SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX);
+ SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY)));
+ SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX);
+ SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbRY)));
+ SDL_PrivateJoystickAxis(joystick, 4, (Sint16)(((int)pXInputState->Gamepad.bLeftTrigger * 65535 / 255) - 32768));
+ SDL_PrivateJoystickAxis(joystick, 5, (Sint16)(((int)pXInputState->Gamepad.bRightTrigger * 65535 / 255) - 32768));
+
+ for (button = 0; button < SDL_arraysize(s_XInputButtons); ++button) {
+ SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED);
+ }
+
+ UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation);
+}
+
+static void
+UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
+{
+ static WORD s_XInputButtons[] = {
+ XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y,
+ XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER, XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_START,
+ XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB,
+ XINPUT_GAMEPAD_GUIDE
+ };
+ WORD wButtons = pXInputState->Gamepad.wButtons;
+ Uint8 button;
+ Uint8 hat = SDL_HAT_CENTERED;
+
+ SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX);
+ SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY)));
+ SDL_PrivateJoystickAxis(joystick, 2, (Sint16)(((int)pXInputState->Gamepad.bLeftTrigger * 65535 / 255) - 32768));
+ SDL_PrivateJoystickAxis(joystick, 3, (Sint16)pXInputState->Gamepad.sThumbRX);
+ SDL_PrivateJoystickAxis(joystick, 4, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbRY)));
+ SDL_PrivateJoystickAxis(joystick, 5, (Sint16)(((int)pXInputState->Gamepad.bRightTrigger * 65535 / 255) - 32768));
+
+ for (button = 0; button < SDL_arraysize(s_XInputButtons); ++button) {
+ SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED);
+ }
+
+ if (wButtons & XINPUT_GAMEPAD_DPAD_UP) {
+ hat |= SDL_HAT_UP;
+ }
+ if (wButtons & XINPUT_GAMEPAD_DPAD_DOWN) {
+ hat |= SDL_HAT_DOWN;
+ }
+ if (wButtons & XINPUT_GAMEPAD_DPAD_LEFT) {
+ hat |= SDL_HAT_LEFT;
+ }
+ if (wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) {
+ hat |= SDL_HAT_RIGHT;
+ }
+ SDL_PrivateJoystickHat(joystick, 0, hat);
+
+ UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation);
+}
+
+void
+SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
+{
+ HRESULT result;
+ XINPUT_STATE_EX XInputState;
+ XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
+
+ if (!XINPUTGETSTATE)
+ return;
+
+ result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState);
+ if (result == ERROR_DEVICE_NOT_CONNECTED) {
+ Uint8 userid = joystick->hwdata->userid;
+
+ joystick->hwdata->send_remove_event = SDL_TRUE;
+ joystick->hwdata->removed = SDL_TRUE;
+ if (s_arrXInputDevicePath[userid]) {
+ SDL_free(s_arrXInputDevicePath[userid]);
+ s_arrXInputDevicePath[userid] = NULL;
+ }
+ return;
+ }
+
+ SDL_zero(XBatteryInformation);
+ if (XINPUTGETBATTERYINFORMATION) {
+ result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation);
+ }
+
+ /* only fire events if the data changed from last time */
+ if (XInputState.dwPacketNumber && XInputState.dwPacketNumber != joystick->hwdata->dwPacketNumber) {
+ if (SDL_XInputUseOldJoystickMapping()) {
+ UpdateXInputJoystickState_OLD(joystick, &XInputState, &XBatteryInformation);
+ } else {
+ UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation);
+ }
+ joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber;
+ }
+}
+
+void
+SDL_XINPUT_JoystickClose(SDL_Joystick * joystick)
+{
+}
+
+void
+SDL_XINPUT_JoystickQuit(void)
+{
+ if (s_bXInputEnabled) {
+ WIN_UnloadXInputDLL();
+ }
+}
+
+SDL_bool
+SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index)
+{
+ JoyStick_DeviceData *device = SYS_Joystick;
+ int index;
+
+ for (index = device_index; index > 0; index--)
+ device = device->pNext;
+
+ return device->bXInputDevice;
+}
+
+#else /* !SDL_JOYSTICK_XINPUT */
+
+typedef struct JoyStick_DeviceData JoyStick_DeviceData;
+
+SDL_bool SDL_XINPUT_Enabled(void)
+{
+ return SDL_FALSE;
+}
+
+int
+SDL_XINPUT_JoystickInit(void)
+{
+ return 0;
+}
+
+void
+SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
+{
+}
+
+int
+SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice)
+{
+ return SDL_Unsupported();
+}
+
+void
+SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
+{
+}
+
+void
+SDL_XINPUT_JoystickClose(SDL_Joystick * joystick)
+{
+}
+
+void
+SDL_XINPUT_JoystickQuit(void)
+{
+}
+
+#endif /* SDL_JOYSTICK_XINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h b/src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h
new file mode 100644
index 0000000..63616ee
--- /dev/null
+++ b/src/3rdparty/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "../../core/windows/SDL_xinput.h"
+
+extern SDL_bool SDL_XINPUT_Enabled(void);
+extern int SDL_XINPUT_JoystickInit(void);
+extern void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext);
+extern int SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice);
+extern void SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick);
+extern void SDL_XINPUT_JoystickClose(SDL_Joystick * joystick);
+extern void SDL_XINPUT_JoystickQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/libm/e_atan2.c b/src/3rdparty/SDL2/src/libm/e_atan2.c
new file mode 100644
index 0000000..32b9725
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_atan2.c
@@ -0,0 +1,134 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_atan2(y,x)
+ * Method :
+ * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
+ * 2. Reduce x to positive by (if x and y are unexceptional):
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
+ *
+ * Special cases:
+ *
+ * ATAN2((anything), NaN ) is NaN;
+ * ATAN2(NAN , (anything) ) is NaN;
+ * ATAN2(+-0, +(anything but NaN)) is +-0 ;
+ * ATAN2(+-0, -(anything but NaN)) is +-pi ;
+ * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
+ * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
+ * ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
+ * ATAN2(+-INF,+INF ) is +-pi/4 ;
+ * ATAN2(+-INF,-INF ) is +-3pi/4;
+ * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double
+tiny = 1.0e-300,
+zero = 0.0,
+pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */
+pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
+pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
+pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
+
+double attribute_hidden __ieee754_atan2(double y, double x)
+{
+ double z;
+ int32_t k,m,hx,hy,ix,iy;
+ u_int32_t lx,ly;
+
+ EXTRACT_WORDS(hx,lx,x);
+ ix = hx&0x7fffffff;
+ EXTRACT_WORDS(hy,ly,y);
+ iy = hy&0x7fffffff;
+ if(((ix|((lx|-(int32_t)lx)>>31))>0x7ff00000)||
+ ((iy|((ly|-(int32_t)ly)>>31))>0x7ff00000)) /* x or y is NaN */
+ return x+y;
+ if(((hx-0x3ff00000)|lx)==0) return atan(y); /* x=1.0 */
+ m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */
+
+ /* when y = 0 */
+ if((iy|ly)==0) {
+ switch(m) {
+ case 0:
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 2: return pi+tiny;/* atan(+0,-anything) = pi */
+ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
+ }
+ }
+ /* when x = 0 */
+ if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+ /* when x is INF */
+ if(ix==0x7ff00000) {
+ if(iy==0x7ff00000) {
+ switch(m) {
+ case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
+ case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
+ case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/
+ case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/
+ }
+ } else {
+ switch(m) {
+ case 0: return zero ; /* atan(+...,+INF) */
+ case 1: return -zero ; /* atan(-...,+INF) */
+ case 2: return pi+tiny ; /* atan(+...,-INF) */
+ case 3: return -pi-tiny ; /* atan(-...,-INF) */
+ }
+ }
+ }
+ /* when y is INF */
+ if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+ /* compute y/x */
+ k = (iy-ix)>>20;
+ if(k > 60) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**60 */
+ else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */
+ else z=atan(fabs(y/x)); /* safe to do y/x */
+ switch (m) {
+ case 0: return z ; /* atan(+,+) */
+ case 1: {
+ u_int32_t zh;
+ GET_HIGH_WORD(zh,z);
+ SET_HIGH_WORD(z,zh ^ 0x80000000);
+ }
+ return z ; /* atan(-,+) */
+ case 2: return pi-(z-pi_lo);/* atan(+,-) */
+ default: /* case 3 */
+ return (z-pi_lo)-pi;/* atan(-,-) */
+ }
+}
+
+/*
+ * wrapper atan2(y,x)
+ */
+#ifndef _IEEE_LIBM
+double atan2(double y, double x)
+{
+ double z = __ieee754_atan2(y, x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x) || isnan(y))
+ return z;
+ if (x == 0.0 && y == 0.0)
+ return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
+ return z;
+}
+#else
+strong_alias(__ieee754_atan2, atan2)
+#endif
+libm_hidden_def(atan2)
diff --git a/src/3rdparty/SDL2/src/libm/e_fmod.c b/src/3rdparty/SDL2/src/libm/e_fmod.c
new file mode 100644
index 0000000..fd8bacb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_fmod.c
@@ -0,0 +1,144 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * __ieee754_fmod(x,y)
+ * Return x mod y in exact arithmetic
+ * Method: shift and subtract
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double one = 1.0, Zero[] = {0.0, -0.0,};
+
+double attribute_hidden __ieee754_fmod(double x, double y)
+{
+ int32_t n,hx,hy,hz,ix,iy,sx,i;
+ u_int32_t lx,ly,lz;
+
+ EXTRACT_WORDS(hx,lx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ sx = hx&0x80000000; /* sign of x */
+ hx ^=sx; /* |x| */
+ hy &= 0x7fffffff; /* |y| */
+
+ /* purge off exception values */
+ if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */
+ ((hy|((ly|-(int32_t)ly)>>31))>0x7ff00000)) /* or y is NaN */
+ return (x*y)/(x*y);
+ if(hx<=hy) {
+ if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
+ if(lx==ly)
+ return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
+ }
+
+ /* determine ix = ilogb(x) */
+ if(hx<0x00100000) { /* subnormal x */
+ if(hx==0) {
+ for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
+ } else {
+ for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
+ }
+ } else ix = (hx>>20)-1023;
+
+ /* determine iy = ilogb(y) */
+ if(hy<0x00100000) { /* subnormal y */
+ if(hy==0) {
+ for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
+ } else {
+ for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
+ }
+ } else iy = (hy>>20)-1023;
+
+ /* set up {hx,lx}, {hy,ly} and align y to x */
+ if(ix >= -1022)
+ hx = 0x00100000|(0x000fffff&hx);
+ else { /* subnormal x, shift x to normal */
+ n = -1022-ix;
+ if(n<=31) {
+ hx = (hx<<n)|(lx>>(32-n));
+ lx <<= n;
+ } else {
+ hx = lx<<(n-32);
+ lx = 0;
+ }
+ }
+ if(iy >= -1022)
+ hy = 0x00100000|(0x000fffff&hy);
+ else { /* subnormal y, shift y to normal */
+ n = -1022-iy;
+ if(n<=31) {
+ hy = (hy<<n)|(ly>>(32-n));
+ ly <<= n;
+ } else {
+ hy = ly<<(n-32);
+ ly = 0;
+ }
+ }
+
+ /* fix point fmod */
+ n = ix - iy;
+ while(n--) {
+ hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+ if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
+ else {
+ if((hz|lz)==0) /* return sign(x)*0 */
+ return Zero[(u_int32_t)sx>>31];
+ hx = hz+hz+(lz>>31); lx = lz+lz;
+ }
+ }
+ hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+ if(hz>=0) {hx=hz;lx=lz;}
+
+ /* convert back to floating value and restore the sign */
+ if((hx|lx)==0) /* return sign(x)*0 */
+ return Zero[(u_int32_t)sx>>31];
+ while(hx<0x00100000) { /* normalize x */
+ hx = hx+hx+(lx>>31); lx = lx+lx;
+ iy -= 1;
+ }
+ if(iy>= -1022) { /* normalize output */
+ hx = ((hx-0x00100000)|((iy+1023)<<20));
+ INSERT_WORDS(x,hx|sx,lx);
+ } else { /* subnormal output */
+ n = -1022 - iy;
+ if(n<=20) {
+ lx = (lx>>n)|((u_int32_t)hx<<(32-n));
+ hx >>= n;
+ } else if (n<=31) {
+ lx = (hx<<(32-n))|(lx>>n); hx = sx;
+ } else {
+ lx = hx>>(n-32); hx = sx;
+ }
+ INSERT_WORDS(x,hx|sx,lx);
+ x *= one; /* create necessary signal */
+ }
+ return x; /* exact output */
+}
+
+/*
+ * wrapper fmod(x,y)
+ */
+#ifndef _IEEE_LIBM
+double fmod(double x, double y)
+{
+ double z = __ieee754_fmod(x, y);
+ if (_LIB_VERSION == _IEEE_ || isnan(y) || isnan(x))
+ return z;
+ if (y == 0.0)
+ return __kernel_standard(x, y, 27); /* fmod(x,0) */
+ return z;
+}
+#else
+strong_alias(__ieee754_fmod, fmod)
+#endif
+libm_hidden_def(fmod)
diff --git a/src/3rdparty/SDL2/src/libm/e_log.c b/src/3rdparty/SDL2/src/libm/e_log.c
new file mode 100644
index 0000000..208df81
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_log.c
@@ -0,0 +1,152 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
+/* C4723: potential divide by zero. */
+#pragma warning ( disable : 4723 )
+#endif
+
+/* __ieee754_log(x)
+ * Return the logrithm of x
+ *
+ * Method :
+ * 1. Argument Reduction: find k and f such that
+ * x = 2^k * (1+f),
+ * where sqrt(2)/2 < 1+f < sqrt(2) .
+ *
+ * 2. Approximation of log(1+f).
+ * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
+ * = 2s + 2/3 s**3 + 2/5 s**5 + .....,
+ * = 2s + s*R
+ * We use a special Reme algorithm on [0,0.1716] to generate
+ * a polynomial of degree 14 to approximate R The maximum error
+ * of this polynomial approximation is bounded by 2**-58.45. In
+ * other words,
+ * 2 4 6 8 10 12 14
+ * R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s
+ * (the values of Lg1 to Lg7 are listed in the program)
+ * and
+ * | 2 14 | -58.45
+ * | Lg1*s +...+Lg7*s - R(z) | <= 2
+ * | |
+ * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
+ * In order to guarantee error in log below 1ulp, we compute log
+ * by
+ * log(1+f) = f - s*(f - R) (if f is not too large)
+ * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy)
+ *
+ * 3. Finally, log(x) = k*ln2 + log(1+f).
+ * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
+ * Here ln2 is split into two floating point number:
+ * ln2_hi + ln2_lo,
+ * where n*ln2_hi is always exact for |n| < 2000.
+ *
+ * Special cases:
+ * log(x) is NaN with signal if x < 0 (including -INF) ;
+ * log(+INF) is +INF; log(0) is -INF with signal;
+ * log(NaN) is that NaN with no signal.
+ *
+ * Accuracy:
+ * according to an error analysis, the error is always less than
+ * 1 ulp (unit in the last place).
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double
+ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
+ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
+two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
+Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
+Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
+Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */
+Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
+Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
+Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
+Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
+
+static const double zero = 0.0;
+
+double attribute_hidden __ieee754_log(double x)
+{
+ double hfsq,f,s,z,R,w,t1,t2,dk;
+ int32_t k,hx,i,j;
+ u_int32_t lx;
+
+ EXTRACT_WORDS(hx,lx,x);
+
+ k=0;
+ if (hx < 0x00100000) { /* x < 2**-1022 */
+ if (((hx&0x7fffffff)|lx)==0)
+ return -two54/zero; /* log(+-0)=-inf */
+ if (hx<0) return (x-x)/zero; /* log(-#) = NaN */
+ k -= 54; x *= two54; /* subnormal number, scale up x */
+ GET_HIGH_WORD(hx,x);
+ }
+ if (hx >= 0x7ff00000) return x+x;
+ k += (hx>>20)-1023;
+ hx &= 0x000fffff;
+ i = (hx+0x95f64)&0x100000;
+ SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */
+ k += (i>>20);
+ f = x-1.0;
+ if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */
+ if(f==zero) {if(k==0) return zero; else {dk=(double)k;
+ return dk*ln2_hi+dk*ln2_lo;}
+ }
+ R = f*f*(0.5-0.33333333333333333*f);
+ if(k==0) return f-R; else {dk=(double)k;
+ return dk*ln2_hi-((R-dk*ln2_lo)-f);}
+ }
+ s = f/(2.0+f);
+ dk = (double)k;
+ z = s*s;
+ i = hx-0x6147a;
+ w = z*z;
+ j = 0x6b851-hx;
+ t1= w*(Lg2+w*(Lg4+w*Lg6));
+ t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
+ i |= j;
+ R = t2+t1;
+ if(i>0) {
+ hfsq=0.5*f*f;
+ if(k==0) return f-(hfsq-s*(hfsq+R)); else
+ return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f);
+ } else {
+ if(k==0) return f-s*(f-R); else
+ return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
+ }
+}
+
+/*
+ * wrapper log(x)
+ */
+#ifndef _IEEE_LIBM
+double log(double x)
+{
+ double z = __ieee754_log(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0)
+ return z;
+ if (x == 0.0)
+ return __kernel_standard(x, x, 16); /* log(0) */
+ return __kernel_standard(x, x, 17); /* log(x<0) */
+}
+#else
+strong_alias(__ieee754_log, log)
+#endif
+libm_hidden_def(log)
diff --git a/src/3rdparty/SDL2/src/libm/e_log10.c b/src/3rdparty/SDL2/src/libm/e_log10.c
new file mode 100644
index 0000000..a30ba54
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_log10.c
@@ -0,0 +1,106 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
+/* C4723: potential divide by zero. */
+#pragma warning ( disable : 4723 )
+#endif
+
+/* __ieee754_log10(x)
+ * Return the base 10 logarithm of x
+ *
+ * Method :
+ * Let log10_2hi = leading 40 bits of log10(2) and
+ * log10_2lo = log10(2) - log10_2hi,
+ * ivln10 = 1/log(10) rounded.
+ * Then
+ * n = ilogb(x),
+ * if(n<0) n = n+1;
+ * x = scalbn(x,-n);
+ * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x))
+ *
+ * Note 1:
+ * To guarantee log10(10**n)=n, where 10**n is normal, the rounding
+ * mode must set to Round-to-Nearest.
+ * Note 2:
+ * [1/log(10)] rounded to 53 bits has error .198 ulps;
+ * log10 is monotonic at all binary break points.
+ *
+ * Special cases:
+ * log10(x) is NaN with signal if x < 0;
+ * log10(+INF) is +INF with no signal; log10(0) is -INF with signal;
+ * log10(NaN) is that NaN with no signal;
+ * log10(10**N) = N for N=0,1,...,22.
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following constants.
+ * The decimal values may be used, provided that the compiler will convert
+ * from decimal to binary accurately enough to produce the hexadecimal values
+ * shown.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double
+two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */
+log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
+log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
+
+static const double zero = 0.0;
+
+double attribute_hidden __ieee754_log10(double x)
+{
+ double y,z;
+ int32_t i,k,hx;
+ u_int32_t lx;
+
+ EXTRACT_WORDS(hx,lx,x);
+
+ k=0;
+ if (hx < 0x00100000) { /* x < 2**-1022 */
+ if (((hx&0x7fffffff)|lx)==0)
+ return -two54/zero; /* log(+-0)=-inf */
+ if (hx<0) return (x-x)/zero; /* log(-#) = NaN */
+ k -= 54; x *= two54; /* subnormal number, scale up x */
+ GET_HIGH_WORD(hx,x);
+ }
+ if (hx >= 0x7ff00000) return x+x;
+ k += (hx>>20)-1023;
+ i = ((u_int32_t)k&0x80000000)>>31;
+ hx = (hx&0x000fffff)|((0x3ff-i)<<20);
+ y = (double)(k+i);
+ SET_HIGH_WORD(x,hx);
+ z = y*log10_2lo + ivln10*__ieee754_log(x);
+ return z+y*log10_2hi;
+}
+
+/*
+ * wrapper log10(X)
+ */
+#ifndef _IEEE_LIBM
+double log10(double x)
+{
+ double z = __ieee754_log10(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x <= 0.0) {
+ if(x == 0.0)
+ return __kernel_standard(x, x, 18); /* log10(0) */
+ return __kernel_standard(x, x, 19); /* log10(x<0) */
+ }
+ return z;
+}
+#else
+strong_alias(__ieee754_log10, log10)
+#endif
+libm_hidden_def(log10)
diff --git a/src/3rdparty/SDL2/src/libm/e_pow.c b/src/3rdparty/SDL2/src/libm/e_pow.c
new file mode 100644
index 0000000..cfd1dbf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_pow.c
@@ -0,0 +1,343 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_pow(x,y) return x**y
+ *
+ * n
+ * Method: Let x = 2 * (1+f)
+ * 1. Compute and return log2(x) in two pieces:
+ * log2(x) = w1 + w2,
+ * where w1 has 53-24 = 29 bit trailing zeros.
+ * 2. Perform y*log2(x) = n+y' by simulating muti-precision
+ * arithmetic, where |y'|<=0.5.
+ * 3. Return x**y = 2**n*exp(y'*log2)
+ *
+ * Special cases:
+ * 1. +-1 ** anything is 1.0
+ * 2. +-1 ** +-INF is 1.0
+ * 3. (anything) ** 0 is 1
+ * 4. (anything) ** 1 is itself
+ * 5. (anything) ** NAN is NAN
+ * 6. NAN ** (anything except 0) is NAN
+ * 7. +-(|x| > 1) ** +INF is +INF
+ * 8. +-(|x| > 1) ** -INF is +0
+ * 9. +-(|x| < 1) ** +INF is +0
+ * 10 +-(|x| < 1) ** -INF is +INF
+ * 11. +0 ** (+anything except 0, NAN) is +0
+ * 12. -0 ** (+anything except 0, NAN, odd integer) is +0
+ * 13. +0 ** (-anything except 0, NAN) is +INF
+ * 14. -0 ** (-anything except 0, NAN, odd integer) is +INF
+ * 15. -0 ** (odd integer) = -( +0 ** (odd integer) )
+ * 16. +INF ** (+anything except 0,NAN) is +INF
+ * 17. +INF ** (-anything except 0,NAN) is +0
+ * 18. -INF ** (anything) = -0 ** (-anything)
+ * 19. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
+ * 20. (-anything except 0 and inf) ** (non-integer) is NAN
+ *
+ * Accuracy:
+ * pow(x,y) returns x**y nearly rounded. In particular
+ * pow(integer,integer)
+ * always returns the correct integer provided it is
+ * representable.
+ *
+ * Constants :
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
+/* C4756: overflow in constant arithmetic */
+#pragma warning ( disable : 4756 )
+#endif
+
+static const double
+bp[] = {1.0, 1.5,},
+dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
+dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
+zero = 0.0,
+one = 1.0,
+two = 2.0,
+two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */
+huge = 1.0e300,
+tiny = 1.0e-300,
+ /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
+L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */
+L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */
+L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */
+L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */
+L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */
+L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */
+P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
+P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
+P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
+P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
+P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */
+lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
+lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */
+lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */
+ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */
+cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */
+cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */
+cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/
+ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */
+ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/
+ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
+
+double attribute_hidden __ieee754_pow(double x, double y)
+{
+ double z,ax,z_h,z_l,p_h,p_l;
+ double y1,t1,t2,r,s,t,u,v,w;
+ int32_t i,j,k,yisint,n;
+ int32_t hx,hy,ix,iy;
+ u_int32_t lx,ly;
+
+ EXTRACT_WORDS(hx,lx,x);
+ /* x==1: 1**y = 1 (even if y is NaN) */
+ if (hx==0x3ff00000 && lx==0) {
+ return x;
+ }
+ ix = hx&0x7fffffff;
+
+ EXTRACT_WORDS(hy,ly,y);
+ iy = hy&0x7fffffff;
+
+ /* y==zero: x**0 = 1 */
+ if((iy|ly)==0) return one;
+
+ /* +-NaN return x+y */
+ if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
+ iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
+ return x+y;
+
+ /* determine if y is an odd int when x < 0
+ * yisint = 0 ... y is not an integer
+ * yisint = 1 ... y is an odd int
+ * yisint = 2 ... y is an even int
+ */
+ yisint = 0;
+ if(hx<0) {
+ if(iy>=0x43400000) yisint = 2; /* even integer y */
+ else if(iy>=0x3ff00000) {
+ k = (iy>>20)-0x3ff; /* exponent */
+ if(k>20) {
+ j = ly>>(52-k);
+ if((j<<(52-k))==ly) yisint = 2-(j&1);
+ } else if(ly==0) {
+ j = iy>>(20-k);
+ if((j<<(20-k))==iy) yisint = 2-(j&1);
+ }
+ }
+ }
+
+ /* special value of y */
+ if(ly==0) {
+ if (iy==0x7ff00000) { /* y is +-inf */
+ if (((ix-0x3ff00000)|lx)==0)
+ return one; /* +-1**+-inf is 1 (yes, weird rule) */
+ if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */
+ return (hy>=0) ? y : zero;
+ /* (|x|<1)**-,+inf = inf,0 */
+ return (hy<0) ? -y : zero;
+ }
+ if(iy==0x3ff00000) { /* y is +-1 */
+ if(hy<0) return one/x; else return x;
+ }
+ if(hy==0x40000000) return x*x; /* y is 2 */
+ if(hy==0x3fe00000) { /* y is 0.5 */
+ if(hx>=0) /* x >= +0 */
+ return __ieee754_sqrt(x);
+ }
+ }
+
+ ax = fabs(x);
+ /* special value of x */
+ if(lx==0) {
+ if(ix==0x7ff00000||ix==0||ix==0x3ff00000){
+ z = ax; /*x is +-0,+-inf,+-1*/
+ if(hy<0) z = one/z; /* z = (1/|x|) */
+ if(hx<0) {
+ if(((ix-0x3ff00000)|yisint)==0) {
+ z = (z-z)/(z-z); /* (-1)**non-int is NaN */
+ } else if(yisint==1)
+ z = -z; /* (x<0)**odd = -(|x|**odd) */
+ }
+ return z;
+ }
+ }
+
+ /* (x<0)**(non-int) is NaN */
+ if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
+
+ /* |y| is huge */
+ if(iy>0x41e00000) { /* if |y| > 2**31 */
+ if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */
+ if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
+ if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
+ }
+ /* over/underflow if x is not close to one */
+ if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
+ if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
+ /* now |1-x| is tiny <= 2**-20, suffice to compute
+ log(x) by x-x^2/2+x^3/3-x^4/4 */
+ t = x-1; /* t has 20 trailing zeros */
+ w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
+ u = ivln2_h*t; /* ivln2_h has 21 sig. bits */
+ v = t*ivln2_l-w*ivln2;
+ t1 = u+v;
+ SET_LOW_WORD(t1,0);
+ t2 = v-(t1-u);
+ } else {
+ double s2,s_h,s_l,t_h,t_l;
+ n = 0;
+ /* take care subnormal number */
+ if(ix<0x00100000)
+ {ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); }
+ n += ((ix)>>20)-0x3ff;
+ j = ix&0x000fffff;
+ /* determine interval */
+ ix = j|0x3ff00000; /* normalize ix */
+ if(j<=0x3988E) k=0; /* |x|<sqrt(3/2) */
+ else if(j<0xBB67A) k=1; /* |x|<sqrt(3) */
+ else {k=0;n+=1;ix -= 0x00100000;}
+ SET_HIGH_WORD(ax,ix);
+
+ /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
+ u = ax-bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
+ v = one/(ax+bp[k]);
+ s = u*v;
+ s_h = s;
+ SET_LOW_WORD(s_h,0);
+ /* t_h=ax+bp[k] High */
+ t_h = zero;
+ SET_HIGH_WORD(t_h,((ix>>1)|0x20000000)+0x00080000+(k<<18));
+ t_l = ax - (t_h-bp[k]);
+ s_l = v*((u-s_h*t_h)-s_h*t_l);
+ /* compute log(ax) */
+ s2 = s*s;
+ r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6)))));
+ r += s_l*(s_h+s);
+ s2 = s_h*s_h;
+ t_h = 3.0+s2+r;
+ SET_LOW_WORD(t_h,0);
+ t_l = r-((t_h-3.0)-s2);
+ /* u+v = s*(1+...) */
+ u = s_h*t_h;
+ v = s_l*t_h+t_l*s;
+ /* 2/(3log2)*(s+...) */
+ p_h = u+v;
+ SET_LOW_WORD(p_h,0);
+ p_l = v-(p_h-u);
+ z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */
+ z_l = cp_l*p_h+p_l*cp+dp_l[k];
+ /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
+ t = (double)n;
+ t1 = (((z_h+z_l)+dp_h[k])+t);
+ SET_LOW_WORD(t1,0);
+ t2 = z_l-(((t1-t)-dp_h[k])-z_h);
+ }
+
+ s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
+ if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0)
+ s = -one;/* (-ve)**(odd int) */
+
+ /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
+ y1 = y;
+ SET_LOW_WORD(y1,0);
+ p_l = (y-y1)*t1+y*t2;
+ p_h = y1*t1;
+ z = p_l+p_h;
+ EXTRACT_WORDS(j,i,z);
+ if (j>=0x40900000) { /* z >= 1024 */
+ if(((j-0x40900000)|i)!=0) /* if z > 1024 */
+ return s*huge*huge; /* overflow */
+ else {
+ if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */
+ }
+ } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */
+ if(((j-0xc090cc00)|i)!=0) /* z < -1075 */
+ return s*tiny*tiny; /* underflow */
+ else {
+ if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */
+ }
+ }
+ /*
+ * compute 2**(p_h+p_l)
+ */
+ i = j&0x7fffffff;
+ k = (i>>20)-0x3ff;
+ n = 0;
+ if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */
+ n = j+(0x00100000>>(k+1));
+ k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */
+ t = zero;
+ SET_HIGH_WORD(t,n&~(0x000fffff>>k));
+ n = ((n&0x000fffff)|0x00100000)>>(20-k);
+ if(j<0) n = -n;
+ p_h -= t;
+ }
+ t = p_l+p_h;
+ SET_LOW_WORD(t,0);
+ u = t*lg2_h;
+ v = (p_l-(t-p_h))*lg2+t*lg2_l;
+ z = u+v;
+ w = v-(z-u);
+ t = z*z;
+ t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
+ r = (z*t1)/(t1-two)-(w+z*w);
+ z = one-(r-z);
+ GET_HIGH_WORD(j,z);
+ j += (n<<20);
+ if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */
+ else SET_HIGH_WORD(z,j);
+ return s*z;
+}
+
+/*
+ * wrapper pow(x,y) return x**y
+ */
+#ifndef _IEEE_LIBM
+double pow(double x, double y)
+{
+ double z = __ieee754_pow(x, y);
+ if (_LIB_VERSION == _IEEE_|| isnan(y))
+ return z;
+ if (isnan(x)) {
+ if (y == 0.0)
+ return __kernel_standard(x, y, 42); /* pow(NaN,0.0) */
+ return z;
+ }
+ if (x == 0.0) {
+ if (y == 0.0)
+ return __kernel_standard(x, y, 20); /* pow(0.0,0.0) */
+ if (isfinite(y) && y < 0.0)
+ return __kernel_standard(x,y,23); /* pow(0.0,negative) */
+ return z;
+ }
+ if (!isfinite(z)) {
+ if (isfinite(x) && isfinite(y)) {
+ if (isnan(z))
+ return __kernel_standard(x, y, 24); /* pow neg**non-int */
+ return __kernel_standard(x, y, 21); /* pow overflow */
+ }
+ }
+ if (z == 0.0 && isfinite(x) && isfinite(y))
+ return __kernel_standard(x, y, 22); /* pow underflow */
+ return z;
+}
+#else
+strong_alias(__ieee754_pow, pow)
+#endif
+libm_hidden_def(pow)
diff --git a/src/3rdparty/SDL2/src/libm/e_rem_pio2.c b/src/3rdparty/SDL2/src/libm/e_rem_pio2.c
new file mode 100644
index 0000000..df7c2b8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_rem_pio2.c
@@ -0,0 +1,161 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_rem_pio2(x,y)
+ *
+ * return the remainder of x rem pi/2 in y[0]+y[1]
+ * use __kernel_rem_pio2()
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+/*
+ * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
+ */
+static const int32_t two_over_pi[] = {
+0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
+0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
+0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,
+0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41,
+0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8,
+0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,
+0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
+0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08,
+0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,
+0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880,
+0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
+};
+
+static const int32_t npio2_hw[] = {
+0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
+0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
+0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A,
+0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C,
+0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB,
+0x404858EB, 0x404921FB,
+};
+
+/*
+ * invpio2: 53 bits of 2/pi
+ * pio2_1: first 33 bit of pi/2
+ * pio2_1t: pi/2 - pio2_1
+ * pio2_2: second 33 bit of pi/2
+ * pio2_2t: pi/2 - (pio2_1+pio2_2)
+ * pio2_3: third 33 bit of pi/2
+ * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3)
+ */
+
+static const double
+zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
+half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
+two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
+invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
+pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
+pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */
+pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */
+pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
+pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
+pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
+
+int32_t attribute_hidden __ieee754_rem_pio2(double x, double *y)
+{
+ double z=0.0,w,t,r,fn;
+ double tx[3];
+ int32_t e0,i,j,nx,n,ix,hx;
+ u_int32_t low;
+
+ GET_HIGH_WORD(hx,x); /* high word of x */
+ ix = hx&0x7fffffff;
+ if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
+ {y[0] = x; y[1] = 0; return 0;}
+ if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */
+ if(hx>0) {
+ z = x - pio2_1;
+ if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
+ y[0] = z - pio2_1t;
+ y[1] = (z-y[0])-pio2_1t;
+ } else { /* near pi/2, use 33+33+53 bit pi */
+ z -= pio2_2;
+ y[0] = z - pio2_2t;
+ y[1] = (z-y[0])-pio2_2t;
+ }
+ return 1;
+ } else { /* negative x */
+ z = x + pio2_1;
+ if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
+ y[0] = z + pio2_1t;
+ y[1] = (z-y[0])+pio2_1t;
+ } else { /* near pi/2, use 33+33+53 bit pi */
+ z += pio2_2;
+ y[0] = z + pio2_2t;
+ y[1] = (z-y[0])+pio2_2t;
+ }
+ return -1;
+ }
+ }
+ if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
+ t = fabs(x);
+ n = (int32_t) (t*invpio2+half);
+ fn = (double)n;
+ r = t-fn*pio2_1;
+ w = fn*pio2_1t; /* 1st round good to 85 bit */
+ if(n<32&&ix!=npio2_hw[n-1]) {
+ y[0] = r-w; /* quick check no cancellation */
+ } else {
+ u_int32_t high;
+ j = ix>>20;
+ y[0] = r-w;
+ GET_HIGH_WORD(high,y[0]);
+ i = j-((high>>20)&0x7ff);
+ if(i>16) { /* 2nd iteration needed, good to 118 */
+ t = r;
+ w = fn*pio2_2;
+ r = t-w;
+ w = fn*pio2_2t-((t-r)-w);
+ y[0] = r-w;
+ GET_HIGH_WORD(high,y[0]);
+ i = j-((high>>20)&0x7ff);
+ if(i>49) { /* 3rd iteration need, 151 bits acc */
+ t = r; /* will cover all possible cases */
+ w = fn*pio2_3;
+ r = t-w;
+ w = fn*pio2_3t-((t-r)-w);
+ y[0] = r-w;
+ }
+ }
+ }
+ y[1] = (r-y[0])-w;
+ if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
+ else return n;
+ }
+ /*
+ * all other (large) arguments
+ */
+ if(ix>=0x7ff00000) { /* x is inf or NaN */
+ y[0]=y[1]=x-x; return 0;
+ }
+ /* set z = scalbn(|x|,ilogb(x)-23) */
+ GET_LOW_WORD(low,x);
+ SET_LOW_WORD(z,low);
+ e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */
+ SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20)));
+ for(i=0;i<2;i++) {
+ tx[i] = (double)((int32_t)(z));
+ z = (z-tx[i])*two24;
+ }
+ tx[2] = z;
+ nx = 3;
+ while(tx[nx-1]==zero) nx--; /* skip zero term */
+ n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi);
+ if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
+ return n;
+}
diff --git a/src/3rdparty/SDL2/src/libm/e_sqrt.c b/src/3rdparty/SDL2/src/libm/e_sqrt.c
new file mode 100644
index 0000000..39c83e1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/e_sqrt.c
@@ -0,0 +1,457 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_sqrt(x)
+ * Return correctly rounded sqrt.
+ * ------------------------------------------
+ * | Use the hardware sqrt if you have one |
+ * ------------------------------------------
+ * Method:
+ * Bit by bit method using integer arithmetic. (Slow, but portable)
+ * 1. Normalization
+ * Scale x to y in [1,4) with even powers of 2:
+ * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then
+ * sqrt(x) = 2^k * sqrt(y)
+ * 2. Bit by bit computation
+ * Let q = sqrt(y) truncated to i bit after binary point (q = 1),
+ * i 0
+ * i+1 2
+ * s = 2*q , and y = 2 * ( y - q ). (1)
+ * i i i i
+ *
+ * To compute q from q , one checks whether
+ * i+1 i
+ *
+ * -(i+1) 2
+ * (q + 2 ) <= y. (2)
+ * i
+ * -(i+1)
+ * If (2) is false, then q = q ; otherwise q = q + 2 .
+ * i+1 i i+1 i
+ *
+ * With some algebric manipulation, it is not difficult to see
+ * that (2) is equivalent to
+ * -(i+1)
+ * s + 2 <= y (3)
+ * i i
+ *
+ * The advantage of (3) is that s and y can be computed by
+ * i i
+ * the following recurrence formula:
+ * if (3) is false
+ *
+ * s = s , y = y ; (4)
+ * i+1 i i+1 i
+ *
+ * otherwise,
+ * -i -(i+1)
+ * s = s + 2 , y = y - s - 2 (5)
+ * i+1 i i+1 i i
+ *
+ * One may easily use induction to prove (4) and (5).
+ * Note. Since the left hand side of (3) contain only i+2 bits,
+ * it does not necessary to do a full (53-bit) comparison
+ * in (3).
+ * 3. Final rounding
+ * After generating the 53 bits result, we compute one more bit.
+ * Together with the remainder, we can decide whether the
+ * result is exact, bigger than 1/2ulp, or less than 1/2ulp
+ * (it will never equal to 1/2ulp).
+ * The rounding mode can be detected by checking whether
+ * huge + tiny is equal to huge, and whether huge - tiny is
+ * equal to huge for some floating point number "huge" and "tiny".
+ *
+ * Special cases:
+ * sqrt(+-0) = +-0 ... exact
+ * sqrt(inf) = inf
+ * sqrt(-ve) = NaN ... with invalid signal
+ * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
+ *
+ * Other methods : see the appended file at the end of the program below.
+ *---------------
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double one = 1.0, tiny = 1.0e-300;
+
+double attribute_hidden __ieee754_sqrt(double x)
+{
+ double z;
+ int32_t sign = (int)0x80000000;
+ int32_t ix0,s0,q,m,t,i;
+ u_int32_t r,t1,s1,ix1,q1;
+
+ EXTRACT_WORDS(ix0,ix1,x);
+
+ /* take care of Inf and NaN */
+ if((ix0&0x7ff00000)==0x7ff00000) {
+ return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
+ sqrt(-inf)=sNaN */
+ }
+ /* take care of zero */
+ if(ix0<=0) {
+ if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */
+ else if(ix0<0)
+ return (x-x)/(x-x); /* sqrt(-ve) = sNaN */
+ }
+ /* normalize x */
+ m = (ix0>>20);
+ if(m==0) { /* subnormal x */
+ while(ix0==0) {
+ m -= 21;
+ ix0 |= (ix1>>11); ix1 <<= 21;
+ }
+ for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1;
+ m -= i-1;
+ ix0 |= (ix1>>(32-i));
+ ix1 <<= i;
+ }
+ m -= 1023; /* unbias exponent */
+ ix0 = (ix0&0x000fffff)|0x00100000;
+ if(m&1){ /* odd m, double x to make it even */
+ ix0 += ix0 + ((ix1&sign)>>31);
+ ix1 += ix1;
+ }
+ m >>= 1; /* m = [m/2] */
+
+ /* generate sqrt(x) bit by bit */
+ ix0 += ix0 + ((ix1&sign)>>31);
+ ix1 += ix1;
+ q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */
+ r = 0x00200000; /* r = moving bit from right to left */
+
+ while(r!=0) {
+ t = s0+r;
+ if(t<=ix0) {
+ s0 = t+r;
+ ix0 -= t;
+ q += r;
+ }
+ ix0 += ix0 + ((ix1&sign)>>31);
+ ix1 += ix1;
+ r>>=1;
+ }
+
+ r = sign;
+ while(r!=0) {
+ t1 = s1+r;
+ t = s0;
+ if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
+ s1 = t1+r;
+ if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1;
+ ix0 -= t;
+ if (ix1 < t1) ix0 -= 1;
+ ix1 -= t1;
+ q1 += r;
+ }
+ ix0 += ix0 + ((ix1&sign)>>31);
+ ix1 += ix1;
+ r>>=1;
+ }
+
+ /* use floating add to find out rounding direction */
+ if((ix0|ix1)!=0) {
+ z = one-tiny; /* trigger inexact flag */
+ if (z>=one) {
+ z = one+tiny;
+ if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;}
+ else if (z>one) {
+ if (q1==(u_int32_t)0xfffffffe) q+=1;
+ q1+=2;
+ } else
+ q1 += (q1&1);
+ }
+ }
+ ix0 = (q>>1)+0x3fe00000;
+ ix1 = q1>>1;
+ if ((q&1)==1) ix1 |= sign;
+ ix0 += (m <<20);
+ INSERT_WORDS(z,ix0,ix1);
+ return z;
+}
+
+/*
+ * wrapper sqrt(x)
+ */
+#ifndef _IEEE_LIBM
+double sqrt(double x)
+{
+ double z = __ieee754_sqrt(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x < 0.0)
+ return __kernel_standard(x, x, 26); /* sqrt(negative) */
+ return z;
+}
+#else
+strong_alias(__ieee754_sqrt, sqrt)
+#endif
+libm_hidden_def(sqrt)
+
+
+/*
+Other methods (use floating-point arithmetic)
+-------------
+(This is a copy of a drafted paper by Prof W. Kahan
+and K.C. Ng, written in May, 1986)
+
+ Two algorithms are given here to implement sqrt(x)
+ (IEEE double precision arithmetic) in software.
+ Both supply sqrt(x) correctly rounded. The first algorithm (in
+ Section A) uses newton iterations and involves four divisions.
+ The second one uses reciproot iterations to avoid division, but
+ requires more multiplications. Both algorithms need the ability
+ to chop results of arithmetic operations instead of round them,
+ and the INEXACT flag to indicate when an arithmetic operation
+ is executed exactly with no roundoff error, all part of the
+ standard (IEEE 754-1985). The ability to perform shift, add,
+ subtract and logical AND operations upon 32-bit words is needed
+ too, though not part of the standard.
+
+A. sqrt(x) by Newton Iteration
+
+ (1) Initial approximation
+
+ Let x0 and x1 be the leading and the trailing 32-bit words of
+ a floating point number x (in IEEE double format) respectively
+
+ 1 11 52 ...widths
+ ------------------------------------------------------
+ x: |s| e | f |
+ ------------------------------------------------------
+ msb lsb msb lsb ...order
+
+
+ ------------------------ ------------------------
+ x0: |s| e | f1 | x1: | f2 |
+ ------------------------ ------------------------
+
+ By performing shifts and subtracts on x0 and x1 (both regarded
+ as integers), we obtain an 8-bit approximation of sqrt(x) as
+ follows.
+
+ k := (x0>>1) + 0x1ff80000;
+ y0 := k - T1[31&(k>>15)]. ... y ~ sqrt(x) to 8 bits
+ Here k is a 32-bit integer and T1[] is an integer array containing
+ correction terms. Now magically the floating value of y (y's
+ leading 32-bit word is y0, the value of its trailing word is 0)
+ approximates sqrt(x) to almost 8-bit.
+
+ Value of T1:
+ static int T1[32]= {
+ 0, 1024, 3062, 5746, 9193, 13348, 18162, 23592,
+ 29598, 36145, 43202, 50740, 58733, 67158, 75992, 85215,
+ 83599, 71378, 60428, 50647, 41945, 34246, 27478, 21581,
+ 16499, 12183, 8588, 5674, 3403, 1742, 661, 130,};
+
+ (2) Iterative refinement
+
+ Apply Heron's rule three times to y, we have y approximates
+ sqrt(x) to within 1 ulp (Unit in the Last Place):
+
+ y := (y+x/y)/2 ... almost 17 sig. bits
+ y := (y+x/y)/2 ... almost 35 sig. bits
+ y := y-(y-x/y)/2 ... within 1 ulp
+
+
+ Remark 1.
+ Another way to improve y to within 1 ulp is:
+
+ y := (y+x/y) ... almost 17 sig. bits to 2*sqrt(x)
+ y := y - 0x00100006 ... almost 18 sig. bits to sqrt(x)
+
+ 2
+ (x-y )*y
+ y := y + 2* ---------- ...within 1 ulp
+ 2
+ 3y + x
+
+
+ This formula has one division fewer than the one above; however,
+ it requires more multiplications and additions. Also x must be
+ scaled in advance to avoid spurious overflow in evaluating the
+ expression 3y*y+x. Hence it is not recommended uless division
+ is slow. If division is very slow, then one should use the
+ reciproot algorithm given in section B.
+
+ (3) Final adjustment
+
+ By twiddling y's last bit it is possible to force y to be
+ correctly rounded according to the prevailing rounding mode
+ as follows. Let r and i be copies of the rounding mode and
+ inexact flag before entering the square root program. Also we
+ use the expression y+-ulp for the next representable floating
+ numbers (up and down) of y. Note that y+-ulp = either fixed
+ point y+-1, or multiply y by nextafter(1,+-inf) in chopped
+ mode.
+
+ I := FALSE; ... reset INEXACT flag I
+ R := RZ; ... set rounding mode to round-toward-zero
+ z := x/y; ... chopped quotient, possibly inexact
+ If(not I) then { ... if the quotient is exact
+ if(z=y) {
+ I := i; ... restore inexact flag
+ R := r; ... restore rounded mode
+ return sqrt(x):=y.
+ } else {
+ z := z - ulp; ... special rounding
+ }
+ }
+ i := TRUE; ... sqrt(x) is inexact
+ If (r=RN) then z=z+ulp ... rounded-to-nearest
+ If (r=RP) then { ... round-toward-+inf
+ y = y+ulp; z=z+ulp;
+ }
+ y := y+z; ... chopped sum
+ y0:=y0-0x00100000; ... y := y/2 is correctly rounded.
+ I := i; ... restore inexact flag
+ R := r; ... restore rounded mode
+ return sqrt(x):=y.
+
+ (4) Special cases
+
+ Square root of +inf, +-0, or NaN is itself;
+ Square root of a negative number is NaN with invalid signal.
+
+
+B. sqrt(x) by Reciproot Iteration
+
+ (1) Initial approximation
+
+ Let x0 and x1 be the leading and the trailing 32-bit words of
+ a floating point number x (in IEEE double format) respectively
+ (see section A). By performing shifs and subtracts on x0 and y0,
+ we obtain a 7.8-bit approximation of 1/sqrt(x) as follows.
+
+ k := 0x5fe80000 - (x0>>1);
+ y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits
+
+ Here k is a 32-bit integer and T2[] is an integer array
+ containing correction terms. Now magically the floating
+ value of y (y's leading 32-bit word is y0, the value of
+ its trailing word y1 is set to zero) approximates 1/sqrt(x)
+ to almost 7.8-bit.
+
+ Value of T2:
+ static int T2[64]= {
+ 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866,
+ 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f,
+ 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d,
+ 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0,
+ 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989,
+ 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd,
+ 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e,
+ 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd,};
+
+ (2) Iterative refinement
+
+ Apply Reciproot iteration three times to y and multiply the
+ result by x to get an approximation z that matches sqrt(x)
+ to about 1 ulp. To be exact, we will have
+ -1ulp < sqrt(x)-z<1.0625ulp.
+
+ ... set rounding mode to Round-to-nearest
+ y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x)
+ y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x)
+ ... special arrangement for better accuracy
+ z := x*y ... 29 bits to sqrt(x), with z*y<1
+ z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x)
+
+ Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that
+ (a) the term z*y in the final iteration is always less than 1;
+ (b) the error in the final result is biased upward so that
+ -1 ulp < sqrt(x) - z < 1.0625 ulp
+ instead of |sqrt(x)-z|<1.03125ulp.
+
+ (3) Final adjustment
+
+ By twiddling y's last bit it is possible to force y to be
+ correctly rounded according to the prevailing rounding mode
+ as follows. Let r and i be copies of the rounding mode and
+ inexact flag before entering the square root program. Also we
+ use the expression y+-ulp for the next representable floating
+ numbers (up and down) of y. Note that y+-ulp = either fixed
+ point y+-1, or multiply y by nextafter(1,+-inf) in chopped
+ mode.
+
+ R := RZ; ... set rounding mode to round-toward-zero
+ switch(r) {
+ case RN: ... round-to-nearest
+ if(x<= z*(z-ulp)...chopped) z = z - ulp; else
+ if(x<= z*(z+ulp)...chopped) z = z; else z = z+ulp;
+ break;
+ case RZ:case RM: ... round-to-zero or round-to--inf
+ R:=RP; ... reset rounding mod to round-to-+inf
+ if(x<z*z ... rounded up) z = z - ulp; else
+ if(x>=(z+ulp)*(z+ulp) ...rounded up) z = z+ulp;
+ break;
+ case RP: ... round-to-+inf
+ if(x>(z+ulp)*(z+ulp)...chopped) z = z+2*ulp; else
+ if(x>z*z ...chopped) z = z+ulp;
+ break;
+ }
+
+ Remark 3. The above comparisons can be done in fixed point. For
+ example, to compare x and w=z*z chopped, it suffices to compare
+ x1 and w1 (the trailing parts of x and w), regarding them as
+ two's complement integers.
+
+ ...Is z an exact square root?
+ To determine whether z is an exact square root of x, let z1 be the
+ trailing part of z, and also let x0 and x1 be the leading and
+ trailing parts of x.
+
+ If ((z1&0x03ffffff)!=0) ... not exact if trailing 26 bits of z!=0
+ I := 1; ... Raise Inexact flag: z is not exact
+ else {
+ j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2
+ k := z1 >> 26; ... get z's 25-th and 26-th
+ fraction bits
+ I := i or (k&j) or ((k&(j+j+1))!=(x1&3));
+ }
+ R:= r ... restore rounded mode
+ return sqrt(x):=z.
+
+ If multiplication is cheaper then the foregoing red tape, the
+ Inexact flag can be evaluated by
+
+ I := i;
+ I := (z*z!=x) or I.
+
+ Note that z*z can overwrite I; this value must be sensed if it is
+ True.
+
+ Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be
+ zero.
+
+ --------------------
+ z1: | f2 |
+ --------------------
+ bit 31 bit 0
+
+ Further more, bit 27 and 26 of z1, bit 0 and 1 of x1, and the odd
+ or even of logb(x) have the following relations:
+
+ -------------------------------------------------
+ bit 27,26 of z1 bit 1,0 of x1 logb(x)
+ -------------------------------------------------
+ 00 00 odd and even
+ 01 01 even
+ 10 10 odd
+ 10 00 even
+ 11 01 even
+ -------------------------------------------------
+
+ (4) Special cases (see (4) of Section A).
+
+ */
diff --git a/src/3rdparty/SDL2/src/libm/k_cos.c b/src/3rdparty/SDL2/src/libm/k_cos.c
new file mode 100644
index 0000000..e1326fa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/k_cos.c
@@ -0,0 +1,82 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * __kernel_cos( x, y )
+ * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
+ * Input x is assumed to be bounded by ~pi/4 in magnitude.
+ * Input y is the tail of x.
+ *
+ * Algorithm
+ * 1. Since cos(-x) = cos(x), we need only to consider positive x.
+ * 2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0.
+ * 3. cos(x) is approximated by a polynomial of degree 14 on
+ * [0,pi/4]
+ * 4 14
+ * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x
+ * where the remez error is
+ *
+ * | 2 4 6 8 10 12 14 | -58
+ * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2
+ * | |
+ *
+ * 4 6 8 10 12 14
+ * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then
+ * cos(x) = 1 - x*x/2 + r
+ * since cos(x+y) ~ cos(x) - sin(x)*y
+ * ~ cos(x) - x*y,
+ * a correction term is necessary in cos(x) and hence
+ * cos(x+y) = 1 - (x*x/2 - (r - x*y))
+ * For better accuracy when x > 0.3, let qx = |x|/4 with
+ * the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125.
+ * Then
+ * cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)).
+ * Note that 1-qx and (x*x/2-qx) is EXACT here, and the
+ * magnitude of the latter is at least a quarter of x*x/2,
+ * thus, reducing the rounding error in the subtraction.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double
+one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */
+C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */
+C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */
+C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */
+C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */
+C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
+
+double attribute_hidden __kernel_cos(double x, double y)
+{
+ double a,hz,z,r,qx;
+ int32_t ix;
+ GET_HIGH_WORD(ix,x);
+ ix &= 0x7fffffff; /* ix = |x|'s high word*/
+ if(ix<0x3e400000) { /* if x < 2**27 */
+ if(((int)x)==0) return one; /* generate inexact */
+ }
+ z = x*x;
+ r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
+ if(ix < 0x3FD33333) /* if |x| < 0.3 */
+ return one - (0.5*z - (z*r - x*y));
+ else {
+ if(ix > 0x3fe90000) { /* x > 0.78125 */
+ qx = 0.28125;
+ } else {
+ INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */
+ }
+ hz = 0.5*z-qx;
+ a = one-qx;
+ return a - (hz - (z*r-x*y));
+ }
+}
diff --git a/src/3rdparty/SDL2/src/libm/k_rem_pio2.c b/src/3rdparty/SDL2/src/libm/k_rem_pio2.c
new file mode 100644
index 0000000..7b04275
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/k_rem_pio2.c
@@ -0,0 +1,299 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
+ * double x[],y[]; int e0,nx,prec; int ipio2[];
+ *
+ * __kernel_rem_pio2 return the last three digits of N with
+ * y = x - N*pi/2
+ * so that |y| < pi/2.
+ *
+ * The method is to compute the integer (mod 8) and fraction parts of
+ * (2/pi)*x without doing the full multiplication. In general we
+ * skip the part of the product that are known to be a huge integer (
+ * more accurately, = 0 mod 8 ). Thus the number of operations are
+ * independent of the exponent of the input.
+ *
+ * (2/pi) is represented by an array of 24-bit integers in ipio2[].
+ *
+ * Input parameters:
+ * x[] The input value (must be positive) is broken into nx
+ * pieces of 24-bit integers in double precision format.
+ * x[i] will be the i-th 24 bit of x. The scaled exponent
+ * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0
+ * match x's up to 24 bits.
+ *
+ * Example of breaking a double positive z into x[0]+x[1]+x[2]:
+ * e0 = ilogb(z)-23
+ * z = scalbn(z,-e0)
+ * for i = 0,1,2
+ * x[i] = floor(z)
+ * z = (z-x[i])*2**24
+ *
+ *
+ * y[] ouput result in an array of double precision numbers.
+ * The dimension of y[] is:
+ * 24-bit precision 1
+ * 53-bit precision 2
+ * 64-bit precision 2
+ * 113-bit precision 3
+ * The actual value is the sum of them. Thus for 113-bit
+ * precison, one may have to do something like:
+ *
+ * long double t,w,r_head, r_tail;
+ * t = (long double)y[2] + (long double)y[1];
+ * w = (long double)y[0];
+ * r_head = t+w;
+ * r_tail = w - (r_head - t);
+ *
+ * e0 The exponent of x[0]
+ *
+ * nx dimension of x[]
+ *
+ * prec an integer indicating the precision:
+ * 0 24 bits (single)
+ * 1 53 bits (double)
+ * 2 64 bits (extended)
+ * 3 113 bits (quad)
+ *
+ * ipio2[]
+ * integer array, contains the (24*i)-th to (24*i+23)-th
+ * bit of 2/pi after binary point. The corresponding
+ * floating value is
+ *
+ * ipio2[i] * 2^(-24(i+1)).
+ *
+ * External function:
+ * double scalbn(), floor();
+ *
+ *
+ * Here is the description of some local variables:
+ *
+ * jk jk+1 is the initial number of terms of ipio2[] needed
+ * in the computation. The recommended value is 2,3,4,
+ * 6 for single, double, extended,and quad.
+ *
+ * jz local integer variable indicating the number of
+ * terms of ipio2[] used.
+ *
+ * jx nx - 1
+ *
+ * jv index for pointing to the suitable ipio2[] for the
+ * computation. In general, we want
+ * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8
+ * is an integer. Thus
+ * e0-3-24*jv >= 0 or (e0-3)/24 >= jv
+ * Hence jv = max(0,(e0-3)/24).
+ *
+ * jp jp+1 is the number of terms in PIo2[] needed, jp = jk.
+ *
+ * q[] double array with integral value, representing the
+ * 24-bits chunk of the product of x and 2/pi.
+ *
+ * q0 the corresponding exponent of q[0]. Note that the
+ * exponent for q[i] would be q0-24*i.
+ *
+ * PIo2[] double precision array, obtained by cutting pi/2
+ * into 24 bits chunks.
+ *
+ * f[] ipio2[] in floating point
+ *
+ * iq[] integer array by breaking up q[] in 24-bits chunk.
+ *
+ * fq[] final product of x*(2/pi) in fq[0],..,fq[jk]
+ *
+ * ih integer. If >0 it indicates q[] is >= 0.5, hence
+ * it also indicates the *sign* of the result.
+ *
+ */
+
+
+/*
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const int init_jk[] = {2,3,4,6}; /* initial value for jk */
+
+static const double PIo2[] = {
+ 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */
+ 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */
+ 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */
+ 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */
+ 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */
+ 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */
+ 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */
+ 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */
+};
+
+static const double
+zero = 0.0,
+one = 1.0,
+two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
+twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
+
+int attribute_hidden __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
+{
+ int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
+ double z,fw,f[20],fq[20],q[20];
+
+ /* initialize jk*/
+ jk = init_jk[prec];
+ jp = jk;
+
+ /* determine jx,jv,q0, note that 3>q0 */
+ jx = nx-1;
+ jv = (e0-3)/24; if(jv<0) jv=0;
+ q0 = e0-24*(jv+1);
+
+ /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */
+ j = jv-jx; m = jx+jk;
+ for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j];
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+ for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
+ q[i] = fw;
+ }
+
+ jz = jk;
+recompute:
+ /* distill q[] into iq[] reversingly */
+ for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
+ fw = (double)((int32_t)(twon24* z));
+ iq[i] = (int32_t)(z-two24*fw);
+ z = q[j-1]+fw;
+ }
+
+ /* compute n */
+ z = scalbn(z,q0); /* actual value of z */
+ z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */
+ n = (int32_t) z;
+ z -= (double)n;
+ ih = 0;
+ if(q0>0) { /* need iq[jz-1] to determine n */
+ i = (iq[jz-1]>>(24-q0)); n += i;
+ iq[jz-1] -= i<<(24-q0);
+ ih = iq[jz-1]>>(23-q0);
+ }
+ else if(q0==0) ih = iq[jz-1]>>23;
+ else if(z>=0.5) ih=2;
+
+ if(ih>0) { /* q > 0.5 */
+ n += 1; carry = 0;
+ for(i=0;i<jz ;i++) { /* compute 1-q */
+ j = iq[i];
+ if(carry==0) {
+ if(j!=0) {
+ carry = 1; iq[i] = 0x1000000- j;
+ }
+ } else iq[i] = 0xffffff - j;
+ }
+ if(q0>0) { /* rare case: chance is 1 in 12 */
+ switch(q0) {
+ case 1:
+ iq[jz-1] &= 0x7fffff; break;
+ case 2:
+ iq[jz-1] &= 0x3fffff; break;
+ }
+ }
+ if(ih==2) {
+ z = one - z;
+ if(carry!=0) z -= scalbn(one,q0);
+ }
+ }
+
+ /* check if recomputation is needed */
+ if(z==zero) {
+ j = 0;
+ for (i=jz-1;i>=jk;i--) j |= iq[i];
+ if(j==0) { /* need recomputation */
+ for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */
+
+ for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */
+ f[jx+i] = (double) ipio2[jv+i];
+ for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
+ q[i] = fw;
+ }
+ jz += k;
+ goto recompute;
+ }
+ }
+
+ /* chop off zero terms */
+ if(z==0.0) {
+ jz -= 1; q0 -= 24;
+ while(iq[jz]==0) { jz--; q0-=24;}
+ } else { /* break z into 24-bit if necessary */
+ z = scalbn(z,-q0);
+ if(z>=two24) {
+ fw = (double)((int32_t)(twon24*z));
+ iq[jz] = (int32_t)(z-two24*fw);
+ jz += 1; q0 += 24;
+ iq[jz] = (int32_t) fw;
+ } else iq[jz] = (int32_t) z ;
+ }
+
+ /* convert integer "bit" chunk to floating-point value */
+ fw = scalbn(one,q0);
+ for(i=jz;i>=0;i--) {
+ q[i] = fw*(double)iq[i]; fw*=twon24;
+ }
+
+ /* compute PIo2[0,...,jp]*q[jz,...,0] */
+ for(i=jz;i>=0;i--) {
+ for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k];
+ fq[jz-i] = fw;
+ }
+
+ /* compress fq[] into y[] */
+ switch(prec) {
+ case 0:
+ fw = 0.0;
+ for (i=jz;i>=0;i--) fw += fq[i];
+ y[0] = (ih==0)? fw: -fw;
+ break;
+ case 1:
+ case 2:
+ fw = 0.0;
+ for (i=jz;i>=0;i--) fw += fq[i];
+ y[0] = (ih==0)? fw: -fw;
+ fw = fq[0]-fw;
+ for (i=1;i<=jz;i++) fw += fq[i];
+ y[1] = (ih==0)? fw: -fw;
+ break;
+ case 3: /* painful */
+ for (i=jz;i>0;i--) {
+ fw = fq[i-1]+fq[i];
+ fq[i] += fq[i-1]-fw;
+ fq[i-1] = fw;
+ }
+ for (i=jz;i>1;i--) {
+ fw = fq[i-1]+fq[i];
+ fq[i] += fq[i-1]-fw;
+ fq[i-1] = fw;
+ }
+ for (fw=0.0,i=jz;i>=2;i--) fw += fq[i];
+ if(ih==0) {
+ y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
+ } else {
+ y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw;
+ }
+ }
+ return n&7;
+}
diff --git a/src/3rdparty/SDL2/src/libm/k_sin.c b/src/3rdparty/SDL2/src/libm/k_sin.c
new file mode 100644
index 0000000..3520d6b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/k_sin.c
@@ -0,0 +1,65 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __kernel_sin( x, y, iy)
+ * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854
+ * Input x is assumed to be bounded by ~pi/4 in magnitude.
+ * Input y is the tail of x.
+ * Input iy indicates whether y is 0. (if iy=0, y assume to be 0).
+ *
+ * Algorithm
+ * 1. Since sin(-x) = -sin(x), we need only to consider positive x.
+ * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0.
+ * 3. sin(x) is approximated by a polynomial of degree 13 on
+ * [0,pi/4]
+ * 3 13
+ * sin(x) ~ x + S1*x + ... + S6*x
+ * where
+ *
+ * |sin(x) 2 4 6 8 10 12 | -58
+ * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2
+ * | x |
+ *
+ * 4. sin(x+y) = sin(x) + sin'(x')*y
+ * ~ sin(x) + (1-x*x/2)*y
+ * For better accuracy, let
+ * 3 2 2 2 2
+ * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))
+ * then 3 2
+ * sin(x) = x + (S1*x + (x *(r-y/2)+y))
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double
+half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
+S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */
+S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */
+S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */
+S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */
+S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */
+S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */
+
+double attribute_hidden __kernel_sin(double x, double y, int iy)
+{
+ double z,r,v;
+ int32_t ix;
+ GET_HIGH_WORD(ix,x);
+ ix &= 0x7fffffff; /* high word of x */
+ if(ix<0x3e400000) /* |x| < 2**-27 */
+ {if((int)x==0) return x;} /* generate inexact */
+ z = x*x;
+ v = z*x;
+ r = S2+z*(S3+z*(S4+z*(S5+z*S6)));
+ if(iy==0) return x+v*(S1+z*r);
+ else return x-((z*(half*y-v*r)-y)-v*S1);
+}
diff --git a/src/3rdparty/SDL2/src/libm/k_tan.c b/src/3rdparty/SDL2/src/libm/k_tan.c
new file mode 100644
index 0000000..47b4e3d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/k_tan.c
@@ -0,0 +1,118 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __kernel_tan( x, y, k )
+ * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
+ * Input x is assumed to be bounded by ~pi/4 in magnitude.
+ * Input y is the tail of x.
+ * Input k indicates whether tan (if k=1) or
+ * -1/tan (if k= -1) is returned.
+ *
+ * Algorithm
+ * 1. Since tan(-x) = -tan(x), we need only to consider positive x.
+ * 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0.
+ * 3. tan(x) is approximated by a odd polynomial of degree 27 on
+ * [0,0.67434]
+ * 3 27
+ * tan(x) ~ x + T1*x + ... + T13*x
+ * where
+ *
+ * |tan(x) 2 4 26 | -59.2
+ * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2
+ * | x |
+ *
+ * Note: tan(x+y) = tan(x) + tan'(x)*y
+ * ~ tan(x) + (1+x*x)*y
+ * Therefore, for better accuracy in computing tan(x+y), let
+ * 3 2 2 2 2
+ * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))
+ * then
+ * 3 2
+ * tan(x+y) = x + (T1*x + (x *(r+y)+y))
+ *
+ * 4. For x in [0.67434,pi/4], let y = pi/4 - x, then
+ * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))
+ * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double
+one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
+pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */
+pio4lo= 3.06161699786838301793e-17, /* 0x3C81A626, 0x33145C07 */
+T[] = {
+ 3.33333333333334091986e-01, /* 0x3FD55555, 0x55555563 */
+ 1.33333333333201242699e-01, /* 0x3FC11111, 0x1110FE7A */
+ 5.39682539762260521377e-02, /* 0x3FABA1BA, 0x1BB341FE */
+ 2.18694882948595424599e-02, /* 0x3F9664F4, 0x8406D637 */
+ 8.86323982359930005737e-03, /* 0x3F8226E3, 0xE96E8493 */
+ 3.59207910759131235356e-03, /* 0x3F6D6D22, 0xC9560328 */
+ 1.45620945432529025516e-03, /* 0x3F57DBC8, 0xFEE08315 */
+ 5.88041240820264096874e-04, /* 0x3F4344D8, 0xF2F26501 */
+ 2.46463134818469906812e-04, /* 0x3F3026F7, 0x1A8D1068 */
+ 7.81794442939557092300e-05, /* 0x3F147E88, 0xA03792A6 */
+ 7.14072491382608190305e-05, /* 0x3F12B80F, 0x32F0A7E9 */
+ -1.85586374855275456654e-05, /* 0xBEF375CB, 0xDB605373 */
+ 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */
+};
+
+double attribute_hidden __kernel_tan(double x, double y, int iy)
+{
+ double z,r,v,w,s;
+ int32_t ix,hx;
+ GET_HIGH_WORD(hx,x);
+ ix = hx&0x7fffffff; /* high word of |x| */
+ if(ix<0x3e300000) /* x < 2**-28 */
+ {if((int)x==0) { /* generate inexact */
+ u_int32_t low;
+ GET_LOW_WORD(low,x);
+ if(((ix|low)|(iy+1))==0) return one/fabs(x);
+ else return (iy==1)? x: -one/x;
+ }
+ }
+ if(ix>=0x3FE59428) { /* |x|>=0.6744 */
+ if(hx<0) {x = -x; y = -y;}
+ z = pio4-x;
+ w = pio4lo-y;
+ x = z+w; y = 0.0;
+ }
+ z = x*x;
+ w = z*z;
+ /* Break x^5*(T[1]+x^2*T[2]+...) into
+ * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) +
+ * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12]))
+ */
+ r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11]))));
+ v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12])))));
+ s = z*x;
+ r = y + z*(s*(r+v)+y);
+ r += T[0]*s;
+ w = x+r;
+ if(ix>=0x3FE59428) {
+ v = (double)iy;
+ return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r)));
+ }
+ if(iy==1) return w;
+ else { /* if allow error up to 2 ulp,
+ simply return -1.0/(x+r) here */
+ /* compute -1.0/(x+r) accurately */
+ double a,t;
+ z = w;
+ SET_LOW_WORD(z,0);
+ v = r-(z - x); /* z+v = r+x */
+ t = a = -1.0/w; /* a = -1.0/w */
+ SET_LOW_WORD(t,0);
+ s = 1.0+t*z;
+ return t+a*(s+t*v);
+ }
+}
diff --git a/src/3rdparty/SDL2/src/libm/math_libm.h b/src/3rdparty/SDL2/src/libm/math_libm.h
new file mode 100644
index 0000000..eb7bdd5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/math_libm.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Math routines from uClibc: http://www.uclibc.org */
+
+double SDL_uclibc_atan(double x);
+double SDL_uclibc_atan2(double y, double x);
+double SDL_uclibc_copysign(double x, double y);
+double SDL_uclibc_cos(double x);
+double SDL_uclibc_fabs(double x);
+double SDL_uclibc_floor(double x);
+double SDL_uclibc_fmod(double x, double y);
+double SDL_uclibc_log(double x);
+double SDL_uclibc_log10(double x);
+double SDL_uclibc_pow(double x, double y);
+double SDL_uclibc_scalbn(double x, int n);
+double SDL_uclibc_sin(double x);
+double SDL_uclibc_sqrt(double x);
+double SDL_uclibc_tan(double x);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/libm/math_private.h b/src/3rdparty/SDL2/src/libm/math_private.h
new file mode 100644
index 0000000..1c0c8a4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/math_private.h
@@ -0,0 +1,226 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $Id: math_private.h,v 1.3 2004/02/09 07:10:38 andersen Exp $
+ */
+
+#ifndef _MATH_PRIVATE_H_
+#define _MATH_PRIVATE_H_
+
+/* #include <endian.h> */
+#include "SDL_endian.h"
+/* #include <sys/types.h> */
+
+#define _IEEE_LIBM
+#define attribute_hidden
+#define libm_hidden_proto(x)
+#define libm_hidden_def(x)
+#define strong_alias(x, y)
+
+#ifndef __HAIKU__ /* already defined in a system header. */
+typedef unsigned int u_int32_t;
+#endif
+
+#define atan SDL_uclibc_atan
+#define __ieee754_atan2 SDL_uclibc_atan2
+#define copysign SDL_uclibc_copysign
+#define cos SDL_uclibc_cos
+#define fabs SDL_uclibc_fabs
+#define floor SDL_uclibc_floor
+#define __ieee754_fmod SDL_uclibc_fmod
+#define __ieee754_log SDL_uclibc_log
+#define __ieee754_log10 SDL_uclibc_log10
+#define __ieee754_pow SDL_uclibc_pow
+#define scalbln SDL_uclibc_scalbln
+#define scalbn SDL_uclibc_scalbn
+#define sin SDL_uclibc_sin
+#define __ieee754_sqrt SDL_uclibc_sqrt
+#define tan SDL_uclibc_tan
+
+/* The original fdlibm code used statements like:
+ n0 = ((*(int*)&one)>>29)^1; * index of high word *
+ ix0 = *(n0+(int*)&x); * high word of x *
+ ix1 = *((1-n0)+(int*)&x); * low word of x *
+ to dig two 32 bit words out of the 64 bit IEEE floating point
+ value. That is non-ANSI, and, moreover, the gcc instruction
+ scheduler gets it wrong. We instead use the following macros.
+ Unlike the original code, we determine the endianness at compile
+ time, not at run time; I don't see much benefit to selecting
+ endianness at run time. */
+
+/* A union which permits us to convert between a double and two 32 bit
+ ints. */
+
+/*
+ * Math on arm is special:
+ * For FPA, float words are always big-endian.
+ * For VFP, floats words follow the memory system mode.
+ */
+
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+
+typedef union
+{
+ double value;
+ struct
+ {
+ u_int32_t msw;
+ u_int32_t lsw;
+ } parts;
+} ieee_double_shape_type;
+
+#else
+
+typedef union
+{
+ double value;
+ struct
+ {
+ u_int32_t lsw;
+ u_int32_t msw;
+ } parts;
+} ieee_double_shape_type;
+
+#endif
+
+/* Get two 32 bit ints from a double. */
+
+#define EXTRACT_WORDS(ix0,ix1,d) \
+do { \
+ ieee_double_shape_type ew_u; \
+ ew_u.value = (d); \
+ (ix0) = ew_u.parts.msw; \
+ (ix1) = ew_u.parts.lsw; \
+} while (0)
+
+/* Get the more significant 32 bit int from a double. */
+
+#define GET_HIGH_WORD(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.parts.msw; \
+} while (0)
+
+/* Get the less significant 32 bit int from a double. */
+
+#define GET_LOW_WORD(i,d) \
+do { \
+ ieee_double_shape_type gl_u; \
+ gl_u.value = (d); \
+ (i) = gl_u.parts.lsw; \
+} while (0)
+
+/* Set a double from two 32 bit ints. */
+
+#define INSERT_WORDS(d,ix0,ix1) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.parts.msw = (ix0); \
+ iw_u.parts.lsw = (ix1); \
+ (d) = iw_u.value; \
+} while (0)
+
+/* Set the more significant 32 bits of a double from an int. */
+
+#define SET_HIGH_WORD(d,v) \
+do { \
+ ieee_double_shape_type sh_u; \
+ sh_u.value = (d); \
+ sh_u.parts.msw = (v); \
+ (d) = sh_u.value; \
+} while (0)
+
+/* Set the less significant 32 bits of a double from an int. */
+
+#define SET_LOW_WORD(d,v) \
+do { \
+ ieee_double_shape_type sl_u; \
+ sl_u.value = (d); \
+ sl_u.parts.lsw = (v); \
+ (d) = sl_u.value; \
+} while (0)
+
+/* A union which permits us to convert between a float and a 32 bit
+ int. */
+
+typedef union
+{
+ float value;
+ u_int32_t word;
+} ieee_float_shape_type;
+
+/* Get a 32 bit int from a float. */
+
+#define GET_FLOAT_WORD(i,d) \
+do { \
+ ieee_float_shape_type gf_u; \
+ gf_u.value = (d); \
+ (i) = gf_u.word; \
+} while (0)
+
+/* Set a float from a 32 bit int. */
+
+#define SET_FLOAT_WORD(d,i) \
+do { \
+ ieee_float_shape_type sf_u; \
+ sf_u.word = (i); \
+ (d) = sf_u.value; \
+} while (0)
+
+/* ieee style elementary functions */
+extern double
+__ieee754_sqrt(double)
+ attribute_hidden;
+ extern double __ieee754_acos(double) attribute_hidden;
+ extern double __ieee754_acosh(double) attribute_hidden;
+ extern double __ieee754_log(double) attribute_hidden;
+ extern double __ieee754_atanh(double) attribute_hidden;
+ extern double __ieee754_asin(double) attribute_hidden;
+ extern double __ieee754_atan2(double, double) attribute_hidden;
+ extern double __ieee754_exp(double) attribute_hidden;
+ extern double __ieee754_cosh(double) attribute_hidden;
+ extern double __ieee754_fmod(double, double) attribute_hidden;
+ extern double __ieee754_pow(double, double) attribute_hidden;
+ extern double __ieee754_lgamma_r(double, int *) attribute_hidden;
+ extern double __ieee754_gamma_r(double, int *) attribute_hidden;
+ extern double __ieee754_lgamma(double) attribute_hidden;
+ extern double __ieee754_gamma(double) attribute_hidden;
+ extern double __ieee754_log10(double) attribute_hidden;
+ extern double __ieee754_sinh(double) attribute_hidden;
+ extern double __ieee754_hypot(double, double) attribute_hidden;
+ extern double __ieee754_j0(double) attribute_hidden;
+ extern double __ieee754_j1(double) attribute_hidden;
+ extern double __ieee754_y0(double) attribute_hidden;
+ extern double __ieee754_y1(double) attribute_hidden;
+ extern double __ieee754_jn(int, double) attribute_hidden;
+ extern double __ieee754_yn(int, double) attribute_hidden;
+ extern double __ieee754_remainder(double, double) attribute_hidden;
+ extern int __ieee754_rem_pio2(double, double *) attribute_hidden;
+#if defined(_SCALB_INT)
+ extern double __ieee754_scalb(double, int) attribute_hidden;
+#else
+ extern double __ieee754_scalb(double, double) attribute_hidden;
+#endif
+
+/* fdlibm kernel function */
+#ifndef _IEEE_LIBM
+ extern double __kernel_standard(double, double, int) attribute_hidden;
+#endif
+ extern double __kernel_sin(double, double, int) attribute_hidden;
+ extern double __kernel_cos(double, double) attribute_hidden;
+ extern double __kernel_tan(double, double, int) attribute_hidden;
+ extern int __kernel_rem_pio2(double *, double *, int, int, int,
+ const int *) attribute_hidden;
+
+#endif /* _MATH_PRIVATE_H_ */
diff --git a/src/3rdparty/SDL2/src/libm/s_atan.c b/src/3rdparty/SDL2/src/libm/s_atan.c
new file mode 100644
index 0000000..f664f0e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_atan.c
@@ -0,0 +1,114 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* atan(x)
+ * Method
+ * 1. Reduce x to positive by atan(x) = -atan(-x).
+ * 2. According to the integer k=4t+0.25 chopped, t=x, the argument
+ * is further reduced to one of the following intervals and the
+ * arctangent of t is evaluated by the corresponding formula:
+ *
+ * [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)
+ * [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) )
+ * [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) )
+ * [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) )
+ * [39/16,INF] atan(x) = atan(INF) + atan( -1/t )
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double atanhi[] = {
+ 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
+ 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */
+ 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */
+ 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */
+};
+
+static const double atanlo[] = {
+ 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */
+ 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */
+ 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */
+ 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */
+};
+
+static const double aT[] = {
+ 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */
+ -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */
+ 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */
+ -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */
+ 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */
+ -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */
+ 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */
+ -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */
+ 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */
+ -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */
+ 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */
+};
+
+static const double
+one = 1.0,
+huge = 1.0e300;
+
+double atan(double x)
+{
+ double w,s1,s2,z;
+ int32_t ix,hx,id;
+
+ GET_HIGH_WORD(hx,x);
+ ix = hx&0x7fffffff;
+ if(ix>=0x44100000) { /* if |x| >= 2^66 */
+ u_int32_t low;
+ GET_LOW_WORD(low,x);
+ if(ix>0x7ff00000||
+ (ix==0x7ff00000&&(low!=0)))
+ return x+x; /* NaN */
+ if(hx>0) return atanhi[3]+atanlo[3];
+ else return -atanhi[3]-atanlo[3];
+ } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */
+ if (ix < 0x3e200000) { /* |x| < 2^-29 */
+ if(huge+x>one) return x; /* raise inexact */
+ }
+ id = -1;
+ } else {
+ x = fabs(x);
+ if (ix < 0x3ff30000) { /* |x| < 1.1875 */
+ if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */
+ id = 0; x = (2.0*x-one)/(2.0+x);
+ } else { /* 11/16<=|x|< 19/16 */
+ id = 1; x = (x-one)/(x+one);
+ }
+ } else {
+ if (ix < 0x40038000) { /* |x| < 2.4375 */
+ id = 2; x = (x-1.5)/(one+1.5*x);
+ } else { /* 2.4375 <= |x| < 2^66 */
+ id = 3; x = -1.0/x;
+ }
+ }}
+ /* end of argument reduction */
+ z = x*x;
+ w = z*z;
+ /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */
+ s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10])))));
+ s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9]))));
+ if (id<0) return x - x*(s1+s2);
+ else {
+ z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x);
+ return (hx<0)? -z:z;
+ }
+}
+libm_hidden_def(atan)
diff --git a/src/3rdparty/SDL2/src/libm/s_copysign.c b/src/3rdparty/SDL2/src/libm/s_copysign.c
new file mode 100644
index 0000000..a2f275b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_copysign.c
@@ -0,0 +1,29 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * copysign(double x, double y)
+ * copysign(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+double copysign(double x, double y)
+{
+ u_int32_t hx,hy;
+ GET_HIGH_WORD(hx,x);
+ GET_HIGH_WORD(hy,y);
+ SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
+ return x;
+}
+libm_hidden_def(copysign)
diff --git a/src/3rdparty/SDL2/src/libm/s_cos.c b/src/3rdparty/SDL2/src/libm/s_cos.c
new file mode 100644
index 0000000..5540260
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_cos.c
@@ -0,0 +1,73 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* cos(x)
+ * Return cosine function of x.
+ *
+ * kernel function:
+ * __kernel_sin ... sine function on [-pi/4,pi/4]
+ * __kernel_cos ... cosine function on [-pi/4,pi/4]
+ * __ieee754_rem_pio2 ... argument reduction routine
+ *
+ * Method.
+ * Let S,C and T denote the sin, cos and tan respectively on
+ * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ * in [-pi/4 , +pi/4], and let n = k mod 4.
+ * We have
+ *
+ * n sin(x) cos(x) tan(x)
+ * ----------------------------------------------------------
+ * 0 S C T
+ * 1 C -S -1/T
+ * 2 -S -C T
+ * 3 -C S -1/T
+ * ----------------------------------------------------------
+ *
+ * Special cases:
+ * Let trig be any of sin, cos, or tan.
+ * trig(+-INF) is NaN, with signals;
+ * trig(NaN) is that NaN;
+ *
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+double cos(double x)
+{
+ double y[2],z=0.0;
+ int32_t n, ix;
+
+ /* High word of x. */
+ GET_HIGH_WORD(ix,x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffff;
+ if(ix <= 0x3fe921fb) return __kernel_cos(x,z);
+
+ /* cos(Inf or NaN) is NaN */
+ else if (ix>=0x7ff00000) return x-x;
+
+ /* argument reduction needed */
+ else {
+ n = __ieee754_rem_pio2(x,y);
+ switch(n&3) {
+ case 0: return __kernel_cos(y[0],y[1]);
+ case 1: return -__kernel_sin(y[0],y[1],1);
+ case 2: return -__kernel_cos(y[0],y[1]);
+ default:
+ return __kernel_sin(y[0],y[1],1);
+ }
+ }
+}
+libm_hidden_def(cos)
diff --git a/src/3rdparty/SDL2/src/libm/s_fabs.c b/src/3rdparty/SDL2/src/libm/s_fabs.c
new file mode 100644
index 0000000..9ee943c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_fabs.c
@@ -0,0 +1,29 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * fabs(x) returns the absolute value of x.
+ */
+
+/*#include <features.h>*/
+/* Prevent math.h from defining a colliding inline */
+#undef __USE_EXTERN_INLINES
+#include "math_libm.h"
+#include "math_private.h"
+
+double fabs(double x)
+{
+ u_int32_t high;
+ GET_HIGH_WORD(high,x);
+ SET_HIGH_WORD(x,high&0x7fffffff);
+ return x;
+}
+libm_hidden_def(fabs)
diff --git a/src/3rdparty/SDL2/src/libm/s_floor.c b/src/3rdparty/SDL2/src/libm/s_floor.c
new file mode 100644
index 0000000..3f9a5ce
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_floor.c
@@ -0,0 +1,71 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * floor(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to floor(x).
+ */
+
+/*#include <features.h>*/
+/* Prevent math.h from defining a colliding inline */
+#undef __USE_EXTERN_INLINES
+#include "math_libm.h"
+#include "math_private.h"
+
+static const double huge = 1.0e300;
+
+double floor(double x)
+{
+ int32_t i0,i1,j0;
+ u_int32_t i,j;
+ EXTRACT_WORDS(i0,i1,x);
+ j0 = ((i0>>20)&0x7ff)-0x3ff;
+ if(j0<20) {
+ if(j0<0) { /* raise inexact if x != 0 */
+ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+ if(i0>=0) {i0=i1=0;}
+ else if(((i0&0x7fffffff)|i1)!=0)
+ { i0=0xbff00000;i1=0;}
+ }
+ } else {
+ i = (0x000fffff)>>j0;
+ if(((i0&i)|i1)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(i0<0) i0 += (0x00100000)>>j0;
+ i0 &= (~i); i1=0;
+ }
+ }
+ } else if (j0>51) {
+ if(j0==0x400) return x+x; /* inf or NaN */
+ else return x; /* x is integral */
+ } else {
+ i = ((u_int32_t)(0xffffffff))>>(j0-20);
+ if((i1&i)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(i0<0) {
+ if(j0==20) i0+=1;
+ else {
+ j = i1+(1<<(52-j0));
+ if(j<(u_int32_t)i1) i0 +=1 ; /* got a carry */
+ i1=j;
+ }
+ }
+ i1 &= (~i);
+ }
+ }
+ INSERT_WORDS(x,i0,i1);
+ return x;
+}
+libm_hidden_def(floor)
diff --git a/src/3rdparty/SDL2/src/libm/s_scalbn.c b/src/3rdparty/SDL2/src/libm/s_scalbn.c
new file mode 100644
index 0000000..6bb7192
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_scalbn.c
@@ -0,0 +1,69 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * scalbln(double x, long n)
+ * scalbln(x,n) returns x * 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+#include <limits.h>
+
+static const double
+two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge = 1.0e+300,
+tiny = 1.0e-300;
+
+double scalbln(double x, long n)
+{
+ int32_t k, hx, lx;
+
+ EXTRACT_WORDS(hx, lx, x);
+ k = (hx & 0x7ff00000) >> 20; /* extract exponent */
+ if (k == 0) { /* 0 or subnormal x */
+ if ((lx | (hx & 0x7fffffff)) == 0)
+ return x; /* +-0 */
+ x *= two54;
+ GET_HIGH_WORD(hx, x);
+ k = ((hx & 0x7ff00000) >> 20) - 54;
+ }
+ if (k == 0x7ff)
+ return x + x; /* NaN or Inf */
+ k = k + n;
+ if (k > 0x7fe)
+ return huge * copysign(huge, x); /* overflow */
+ if (n < -50000)
+ return tiny * copysign(tiny, x); /* underflow */
+ if (k > 0) { /* normal result */
+ SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20));
+ return x;
+ }
+ if (k <= -54) {
+ if (n > 50000) /* in case integer overflow in n+k */
+ return huge * copysign(huge, x); /* overflow */
+ return tiny * copysign(tiny, x); /* underflow */
+ }
+ k += 54; /* subnormal result */
+ SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20));
+ return x * twom54;
+}
+libm_hidden_def(scalbln)
+
+
+double scalbn(double x, int n)
+{
+ return scalbln(x, n);
+}
+libm_hidden_def(scalbn)
diff --git a/src/3rdparty/SDL2/src/libm/s_sin.c b/src/3rdparty/SDL2/src/libm/s_sin.c
new file mode 100644
index 0000000..b3cd7a0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_sin.c
@@ -0,0 +1,73 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* sin(x)
+ * Return sine function of x.
+ *
+ * kernel function:
+ * __kernel_sin ... sine function on [-pi/4,pi/4]
+ * __kernel_cos ... cose function on [-pi/4,pi/4]
+ * __ieee754_rem_pio2 ... argument reduction routine
+ *
+ * Method.
+ * Let S,C and T denote the sin, cos and tan respectively on
+ * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ * in [-pi/4 , +pi/4], and let n = k mod 4.
+ * We have
+ *
+ * n sin(x) cos(x) tan(x)
+ * ----------------------------------------------------------
+ * 0 S C T
+ * 1 C -S -1/T
+ * 2 -S -C T
+ * 3 -C S -1/T
+ * ----------------------------------------------------------
+ *
+ * Special cases:
+ * Let trig be any of sin, cos, or tan.
+ * trig(+-INF) is NaN, with signals;
+ * trig(NaN) is that NaN;
+ *
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+double sin(double x)
+{
+ double y[2],z=0.0;
+ int32_t n, ix;
+
+ /* High word of x. */
+ GET_HIGH_WORD(ix,x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffff;
+ if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0);
+
+ /* sin(Inf or NaN) is NaN */
+ else if (ix>=0x7ff00000) return x-x;
+
+ /* argument reduction needed */
+ else {
+ n = __ieee754_rem_pio2(x,y);
+ switch(n&3) {
+ case 0: return __kernel_sin(y[0],y[1],1);
+ case 1: return __kernel_cos(y[0],y[1]);
+ case 2: return -__kernel_sin(y[0],y[1],1);
+ default:
+ return -__kernel_cos(y[0],y[1]);
+ }
+ }
+}
+libm_hidden_def(sin)
diff --git a/src/3rdparty/SDL2/src/libm/s_tan.c b/src/3rdparty/SDL2/src/libm/s_tan.c
new file mode 100644
index 0000000..18c8f5b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/libm/s_tan.c
@@ -0,0 +1,67 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* tan(x)
+ * Return tangent function of x.
+ *
+ * kernel function:
+ * __kernel_tan ... tangent function on [-pi/4,pi/4]
+ * __ieee754_rem_pio2 ... argument reduction routine
+ *
+ * Method.
+ * Let S,C and T denote the sin, cos and tan respectively on
+ * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ * in [-pi/4 , +pi/4], and let n = k mod 4.
+ * We have
+ *
+ * n sin(x) cos(x) tan(x)
+ * ----------------------------------------------------------
+ * 0 S C T
+ * 1 C -S -1/T
+ * 2 -S -C T
+ * 3 -C S -1/T
+ * ----------------------------------------------------------
+ *
+ * Special cases:
+ * Let trig be any of sin, cos, or tan.
+ * trig(+-INF) is NaN, with signals;
+ * trig(NaN) is that NaN;
+ *
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math_libm.h"
+#include "math_private.h"
+
+double tan(double x)
+{
+ double y[2],z=0.0;
+ int32_t n, ix;
+
+ /* High word of x. */
+ GET_HIGH_WORD(ix,x);
+
+ /* |x| ~< pi/4 */
+ ix &= 0x7fffffff;
+ if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1);
+
+ /* tan(Inf or NaN) is NaN */
+ else if (ix>=0x7ff00000) return x-x; /* NaN */
+
+ /* argument reduction needed */
+ else {
+ n = __ieee754_rem_pio2(x,y);
+ return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even
+ -1 -- n odd */
+ }
+}
+libm_hidden_def(tan)
diff --git a/src/3rdparty/SDL2/src/loadso/dlopen/SDL_sysloadso.c b/src/3rdparty/SDL2/src/loadso/dlopen/SDL_sysloadso.c
new file mode 100644
index 0000000..18b4b84
--- /dev/null
+++ b/src/3rdparty/SDL2/src/loadso/dlopen/SDL_sysloadso.c
@@ -0,0 +1,88 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_LOADSO_DLOPEN
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines */
+
+#include <stdio.h>
+#include <dlfcn.h>
+
+#include "SDL_loadso.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+#include "../../video/uikit/SDL_uikitvideo.h"
+#endif
+
+void *
+SDL_LoadObject(const char *sofile)
+{
+ void *handle;
+ const char *loaderror;
+
+#if SDL_VIDEO_DRIVER_UIKIT
+ if (!UIKit_IsSystemVersionAtLeast(8.0)) {
+ SDL_SetError("SDL_LoadObject requires iOS 8+");
+ return NULL;
+ }
+#endif
+
+ handle = dlopen(sofile, RTLD_NOW|RTLD_LOCAL);
+ loaderror = (char *) dlerror();
+ if (handle == NULL) {
+ SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+ }
+ return (handle);
+}
+
+void *
+SDL_LoadFunction(void *handle, const char *name)
+{
+ void *symbol = dlsym(handle, name);
+ if (symbol == NULL) {
+ /* append an underscore for platforms that need that. */
+ size_t len = 1 + SDL_strlen(name) + 1;
+ char *_name = SDL_stack_alloc(char, len);
+ _name[0] = '_';
+ SDL_strlcpy(&_name[1], name, len);
+ symbol = dlsym(handle, _name);
+ SDL_stack_free(_name);
+ if (symbol == NULL) {
+ SDL_SetError("Failed loading %s: %s", name,
+ (const char *) dlerror());
+ }
+ }
+ return (symbol);
+}
+
+void
+SDL_UnloadObject(void *handle)
+{
+ if (handle != NULL) {
+ dlclose(handle);
+ }
+}
+
+#endif /* SDL_LOADSO_DLOPEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/loadso/dummy/SDL_sysloadso.c b/src/3rdparty/SDL2/src/loadso/dummy/SDL_sysloadso.c
new file mode 100644
index 0000000..291c08b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/loadso/dummy/SDL_sysloadso.c
@@ -0,0 +1,54 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(SDL_LOADSO_DUMMY) || defined(SDL_LOADSO_DISABLED)
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines */
+
+#include "SDL_loadso.h"
+
+void *
+SDL_LoadObject(const char *sofile)
+{
+ const char *loaderror = "SDL_LoadObject() not implemented";
+ SDL_SetError("Failed loading %s: %s", sofile, loaderror);
+ return (NULL);
+}
+
+void *
+SDL_LoadFunction(void *handle, const char *name)
+{
+ const char *loaderror = "SDL_LoadFunction() not implemented";
+ SDL_SetError("Failed loading %s: %s", name, loaderror);
+ return (NULL);
+}
+
+void
+SDL_UnloadObject(void *handle)
+{
+ /* no-op. */
+}
+
+#endif /* SDL_LOADSO_DUMMY || SDL_LOADSO_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/loadso/windows/SDL_sysloadso.c b/src/3rdparty/SDL2/src/loadso/windows/SDL_sysloadso.c
new file mode 100644
index 0000000..351570f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/loadso/windows/SDL_sysloadso.c
@@ -0,0 +1,80 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_LOADSO_WINDOWS
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* System dependent library loading routines */
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_loadso.h"
+
+void *
+SDL_LoadObject(const char *sofile)
+{
+ LPTSTR tstr = WIN_UTF8ToString(sofile);
+#ifdef __WINRT__
+ /* WinRT only publically supports LoadPackagedLibrary() for loading .dll
+ files. LoadLibrary() is a private API, and not available for apps
+ (that can be published to MS' Windows Store.)
+ */
+ void *handle = (void *) LoadPackagedLibrary(tstr, 0);
+#else
+ void *handle = (void *) LoadLibrary(tstr);
+#endif
+ SDL_free(tstr);
+
+ /* Generate an error message if all loads failed */
+ if (handle == NULL) {
+ char errbuf[512];
+ SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
+ SDL_strlcat(errbuf, sofile, SDL_arraysize(errbuf));
+ WIN_SetError(errbuf);
+ }
+ return handle;
+}
+
+void *
+SDL_LoadFunction(void *handle, const char *name)
+{
+ void *symbol = (void *) GetProcAddress((HMODULE) handle, name);
+ if (symbol == NULL) {
+ char errbuf[512];
+ SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
+ SDL_strlcat(errbuf, name, SDL_arraysize(errbuf));
+ WIN_SetError(errbuf);
+ }
+ return symbol;
+}
+
+void
+SDL_UnloadObject(void *handle)
+{
+ if (handle != NULL) {
+ FreeLibrary((HMODULE) handle);
+ }
+}
+
+#endif /* SDL_LOADSO_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/main/android/SDL_android_main.c b/src/3rdparty/SDL2/src/main/android/SDL_android_main.c
new file mode 100644
index 0000000..054738a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/android/SDL_android_main.c
@@ -0,0 +1,7 @@
+/*
+ SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14
+
+ As of SDL 2.0.6 this file is no longer necessary.
+*/
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/main/dummy/SDL_dummy_main.c b/src/3rdparty/SDL2/src/main/dummy/SDL_dummy_main.c
new file mode 100644
index 0000000..0174136
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/dummy/SDL_dummy_main.c
@@ -0,0 +1,28 @@
+/*
+ SDL_dummy_main.c, placed in the public domain by Sam Lantinga 3/13/14
+*/
+#include "../../SDL_internal.h"
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+
+#ifdef main
+#undef main
+int
+main(int argc, char *argv[])
+{
+ return (SDL_main(argc, argv));
+}
+#else
+/* Nothing to do on this platform */
+int
+SDL_main_stub_symbol(void);
+
+int
+SDL_main_stub_symbol(void)
+{
+ return 0;
+}
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/main/haiku/SDL_BApp.h b/src/3rdparty/SDL2/src/main/haiku/SDL_BApp.h
new file mode 100644
index 0000000..ba3f927
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/haiku/SDL_BApp.h
@@ -0,0 +1,399 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_BAPP_H
+#define SDL_BAPP_H
+
+#include <InterfaceKit.h>
+#if SDL_VIDEO_OPENGL
+#include <OpenGLKit.h>
+#endif
+
+#include "../../video/haiku/SDL_bkeyboard.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../SDL_internal.h"
+
+#include "SDL_video.h"
+
+/* Local includes */
+#include "../../events/SDL_events_c.h"
+#include "../../video/haiku/SDL_bframebuffer.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <vector>
+
+
+
+
+/* Forward declarations */
+class SDL_BWin;
+
+/* Message constants */
+enum ToSDL {
+ /* Intercepted by BWindow on its way to BView */
+ BAPP_MOUSE_MOVED,
+ BAPP_MOUSE_BUTTON,
+ BAPP_MOUSE_WHEEL,
+ BAPP_KEY,
+ BAPP_REPAINT, /* from _UPDATE_ */
+ /* From BWindow */
+ BAPP_MAXIMIZE, /* from B_ZOOM */
+ BAPP_MINIMIZE,
+ BAPP_RESTORE, /* TODO: IMPLEMENT! */
+ BAPP_SHOW,
+ BAPP_HIDE,
+ BAPP_MOUSE_FOCUS, /* caused by MOUSE_MOVE */
+ BAPP_KEYBOARD_FOCUS, /* from WINDOW_ACTIVATED */
+ BAPP_WINDOW_CLOSE_REQUESTED,
+ BAPP_WINDOW_MOVED,
+ BAPP_WINDOW_RESIZED,
+ BAPP_SCREEN_CHANGED
+};
+
+
+
+/* Create a descendant of BApplication */
+class SDL_BApp : public BApplication {
+public:
+ SDL_BApp(const char* signature) :
+ BApplication(signature) {
+#if SDL_VIDEO_OPENGL
+ _current_context = NULL;
+#endif
+ }
+
+
+ virtual ~SDL_BApp() {
+ }
+
+
+
+ /* Event-handling functions */
+ virtual void MessageReceived(BMessage* message) {
+ /* Sort out SDL-related messages */
+ switch ( message->what ) {
+ case BAPP_MOUSE_MOVED:
+ _HandleMouseMove(message);
+ break;
+
+ case BAPP_MOUSE_BUTTON:
+ _HandleMouseButton(message);
+ break;
+
+ case BAPP_MOUSE_WHEEL:
+ _HandleMouseWheel(message);
+ break;
+
+ case BAPP_KEY:
+ _HandleKey(message);
+ break;
+
+ case BAPP_REPAINT:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
+ break;
+
+ case BAPP_MAXIMIZE:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
+ break;
+
+ case BAPP_MINIMIZE:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
+ break;
+
+ case BAPP_SHOW:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
+ break;
+
+ case BAPP_HIDE:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
+ break;
+
+ case BAPP_MOUSE_FOCUS:
+ _HandleMouseFocus(message);
+ break;
+
+ case BAPP_KEYBOARD_FOCUS:
+ _HandleKeyboardFocus(message);
+ break;
+
+ case BAPP_WINDOW_CLOSE_REQUESTED:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
+ break;
+
+ case BAPP_WINDOW_MOVED:
+ _HandleWindowMoved(message);
+ break;
+
+ case BAPP_WINDOW_RESIZED:
+ _HandleWindowResized(message);
+ break;
+
+ case BAPP_SCREEN_CHANGED:
+ /* TODO: Handle screen resize or workspace change */
+ break;
+
+ default:
+ BApplication::MessageReceived(message);
+ break;
+ }
+ }
+
+ /* Window creation/destruction methods */
+ int32 GetID(SDL_Window *win) {
+ int32 i;
+ for(i = 0; i < _GetNumWindowSlots(); ++i) {
+ if( GetSDLWindow(i) == NULL ) {
+ _SetSDLWindow(win, i);
+ return i;
+ }
+ }
+
+ /* Expand the vector if all slots are full */
+ if( i == _GetNumWindowSlots() ) {
+ _PushBackWindow(win);
+ return i;
+ }
+
+ /* TODO: error handling */
+ return 0;
+ }
+
+ /* FIXME: Bad coding practice, but I can't include SDL_BWin.h here. Is
+ there another way to do this? */
+ void ClearID(SDL_BWin *bwin); /* Defined in SDL_BeApp.cc */
+
+
+ SDL_Window *GetSDLWindow(int32 winID) {
+ return _window_map[winID];
+ }
+
+#if SDL_VIDEO_OPENGL
+ void SetCurrentContext(BGLView *newContext) {
+ if(_current_context)
+ _current_context->UnlockGL();
+ _current_context = newContext;
+ if (_current_context)
+ _current_context->LockGL();
+ }
+#endif
+
+private:
+ /* Event management */
+ void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) {
+ SDL_Window *win;
+ int32 winID;
+ if(
+ !_GetWinID(msg, &winID)
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendWindowEvent(win, sdlEventType, 0, 0);
+ }
+
+ void _HandleMouseMove(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 x = 0, y = 0;
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("x", &x) != B_OK || /* x movement */
+ msg->FindInt32("y", &y) != B_OK /* y movement */
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendMouseMotion(win, 0, 0, x, y);
+
+ /* Tell the application that the mouse passed over, redraw needed */
+ BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
+ }
+
+ void _HandleMouseButton(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 button, state; /* left/middle/right, pressed/released */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("button-id", &button) != B_OK ||
+ msg->FindInt32("button-state", &state) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendMouseButton(win, 0, state, button);
+ }
+
+ void _HandleMouseWheel(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 xTicks, yTicks;
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("xticks", &xTicks) != B_OK ||
+ msg->FindInt32("yticks", &yTicks) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendMouseWheel(win, 0, xTicks, yTicks, SDL_MOUSEWHEEL_NORMAL);
+ }
+
+ void _HandleKey(BMessage *msg) {
+ int32 scancode, state; /* scancode, pressed/released */
+ if(
+ msg->FindInt32("key-state", &state) != B_OK ||
+ msg->FindInt32("key-scancode", &scancode) != B_OK
+ ) {
+ return;
+ }
+
+ /* Make sure this isn't a repeated event (key pressed and held) */
+ if(state == SDL_PRESSED && BE_GetKeyState(scancode) == SDL_PRESSED) {
+ return;
+ }
+ BE_SetKeyState(scancode, state);
+ SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode));
+
+ if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+ const int8 *keyUtf8;
+ ssize_t count;
+ if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) {
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+ SDL_zero(text);
+ SDL_memcpy(text, keyUtf8, count);
+ SDL_SendKeyboardText(text);
+ }
+ }
+ }
+
+ void _HandleMouseFocus(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ bool bSetFocus; /* If false, lose focus */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindBool("focusGained", &bSetFocus) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ if(bSetFocus) {
+ SDL_SetMouseFocus(win);
+ } else if(SDL_GetMouseFocus() == win) {
+ /* Only lose all focus if this window was the current focus */
+ SDL_SetMouseFocus(NULL);
+ }
+ }
+
+ void _HandleKeyboardFocus(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ bool bSetFocus; /* If false, lose focus */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindBool("focusGained", &bSetFocus) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ if(bSetFocus) {
+ SDL_SetKeyboardFocus(win);
+ } else if(SDL_GetKeyboardFocus() == win) {
+ /* Only lose all focus if this window was the current focus */
+ SDL_SetKeyboardFocus(NULL);
+ }
+ }
+
+ void _HandleWindowMoved(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 xPos, yPos;
+ /* Get the window id and new x/y position of the window */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("window-x", &xPos) != B_OK ||
+ msg->FindInt32("window-y", &yPos) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
+ }
+
+ void _HandleWindowResized(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 w, h;
+ /* Get the window id ]and new x/y position of the window */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("window-w", &w) != B_OK ||
+ msg->FindInt32("window-h", &h) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
+ }
+
+ bool _GetWinID(BMessage *msg, int32 *winID) {
+ return msg->FindInt32("window-id", winID) == B_OK;
+ }
+
+
+
+ /* Vector functions: Wraps vector stuff in case we need to change
+ implementation */
+ void _SetSDLWindow(SDL_Window *win, int32 winID) {
+ _window_map[winID] = win;
+ }
+
+ int32 _GetNumWindowSlots() {
+ return _window_map.size();
+ }
+
+
+ void _PopBackWindow() {
+ _window_map.pop_back();
+ }
+
+ void _PushBackWindow(SDL_Window *win) {
+ _window_map.push_back(win);
+ }
+
+
+ /* Members */
+ std::vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id */
+
+#if SDL_VIDEO_OPENGL
+ BGLView *_current_context;
+#endif
+};
+
+#endif
diff --git a/src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.cc b/src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.cc
new file mode 100644
index 0000000..f4ee179
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.cc
@@ -0,0 +1,157 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(__HAIKU__)
+
+/* Handle the BeApp specific portions of the application */
+
+#include <AppKit.h>
+#include <storage/AppFileInfo.h>
+#include <storage/Path.h>
+#include <storage/Entry.h>
+#include <storage/File.h>
+#include <unistd.h>
+
+#include "SDL_BApp.h" /* SDL_BApp class definition */
+#include "SDL_BeApp.h"
+#include "SDL_timer.h"
+#include "SDL_error.h"
+
+#include "../../video/haiku/SDL_BWin.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../thread/SDL_systhread.h"
+
+/* Flag to tell whether or not the Be application is active or not */
+static int SDL_BeAppActive = 0;
+static SDL_Thread *SDL_AppThread = NULL;
+
+static int
+StartBeApp(void *unused)
+{
+ BApplication *App;
+
+ // default application signature
+ const char *signature = "application/x-SDL-executable";
+ // dig resources for correct signature
+ image_info info;
+ int32 cookie = 0;
+ if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
+ BFile f(info.name, O_RDONLY);
+ if (f.InitCheck() == B_OK) {
+ BAppFileInfo app_info(&f);
+ if (app_info.InitCheck() == B_OK) {
+ char sig[B_MIME_TYPE_LENGTH];
+ if (app_info.GetSignature(sig) == B_OK)
+ signature = strndup(sig, B_MIME_TYPE_LENGTH);
+ }
+ }
+ }
+
+ App = new SDL_BApp(signature);
+
+ App->Run();
+ delete App;
+ return (0);
+}
+
+/* Initialize the Be Application, if it's not already started */
+int
+SDL_InitBeApp(void)
+{
+ /* Create the BApplication that handles appserver interaction */
+ if (SDL_BeAppActive <= 0) {
+ SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL);
+ if (SDL_AppThread == NULL) {
+ return SDL_SetError("Couldn't create BApplication thread");
+ }
+
+ /* Change working directory to that of executable */
+ app_info info;
+ if (B_OK == be_app->GetAppInfo(&info)) {
+ entry_ref ref = info.ref;
+ BEntry entry;
+ if (B_OK == entry.SetTo(&ref)) {
+ BPath path;
+ if (B_OK == path.SetTo(&entry)) {
+ if (B_OK == path.GetParent(&path)) {
+ chdir(path.Path());
+ }
+ }
+ }
+ }
+
+ do {
+ SDL_Delay(10);
+ } while ((be_app == NULL) || be_app->IsLaunching());
+
+ /* Mark the application active */
+ SDL_BeAppActive = 0;
+ }
+
+ /* Increment the application reference count */
+ ++SDL_BeAppActive;
+
+ /* The app is running, and we're ready to go */
+ return (0);
+}
+
+/* Quit the Be Application, if there's nothing left to do */
+void
+SDL_QuitBeApp(void)
+{
+ /* Decrement the application reference count */
+ --SDL_BeAppActive;
+
+ /* If the reference count reached zero, clean up the app */
+ if (SDL_BeAppActive == 0) {
+ if (SDL_AppThread != NULL) {
+ if (be_app != NULL) { /* Not tested */
+ be_app->PostMessage(B_QUIT_REQUESTED);
+ }
+ SDL_WaitThread(SDL_AppThread, NULL);
+ SDL_AppThread = NULL;
+ }
+ /* be_app should now be NULL since be_app has quit */
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* SDL_BApp functions */
+void SDL_BApp::ClearID(SDL_BWin *bwin) {
+ _SetSDLWindow(NULL, bwin->GetID());
+ int32 i = _GetNumWindowSlots() - 1;
+ while(i >= 0 && GetSDLWindow(i) == NULL) {
+ _PopBackWindow();
+ --i;
+ }
+}
+
+#endif /* __HAIKU__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.h b/src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.h
new file mode 100644
index 0000000..83a2beb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/haiku/SDL_BeApp.h
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Handle the BeApp specific portions of the application */
+
+/* Initialize the Be Application, if it's not already started */
+extern int SDL_InitBeApp(void);
+
+/* Quit the Be Application, if there's nothing left to do */
+extern void SDL_QuitBeApp(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/3rdparty/SDL2/src/main/nacl/SDL_nacl_main.c b/src/3rdparty/SDL2/src/main/nacl/SDL_nacl_main.c
new file mode 100644
index 0000000..af66bdb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/nacl/SDL_nacl_main.c
@@ -0,0 +1,93 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_NACL
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+
+#include "ppapi_simple/ps_main.h"
+#include "ppapi_simple/ps_event.h"
+#include "ppapi_simple/ps_interface.h"
+#include "nacl_io/nacl_io.h"
+#include "sys/mount.h"
+
+extern void NACL_SetScreenResolution(int width, int height, Uint32 format);
+
+int
+nacl_main(int argc, char *argv[])
+{
+ int status;
+ PSEvent* ps_event;
+ PP_Resource event;
+ struct PP_Rect rect;
+ int ready = 0;
+ const PPB_View *ppb_view = PSInterfaceView();
+
+ /* This is started in a worker thread by ppapi_simple! */
+
+ /* Wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before starting the app */
+
+ PSEventSetFilter(PSE_INSTANCE_DIDCHANGEVIEW);
+ while (!ready) {
+ /* Process all waiting events without blocking */
+ while (!ready && (ps_event = PSEventWaitAcquire()) != NULL) {
+ event = ps_event->as_resource;
+ switch(ps_event->type) {
+ /* From DidChangeView, contains a view resource */
+ case PSE_INSTANCE_DIDCHANGEVIEW:
+ ppb_view->GetRect(event, &rect);
+ NACL_SetScreenResolution(rect.size.width, rect.size.height, 0);
+ ready = 1;
+ break;
+ default:
+ break;
+ }
+ PSEventRelease(ps_event);
+ }
+ }
+
+ /* Do a default httpfs mount on /,
+ * apps can override this by unmounting /
+ * and remounting with the desired configuration
+ */
+ nacl_io_init_ppapi(PSGetInstanceId(), PSGetInterface);
+
+ umount("/");
+ mount(
+ "", /* source */
+ "/", /* target */
+ "httpfs", /* filesystemtype */
+ 0, /* mountflags */
+ ""); /* data specific to the html5fs type */
+
+ /* Everything is ready, start the user main function */
+ SDL_SetMainReady();
+ status = SDL_main(argc, argv);
+
+ return 0;
+}
+
+/* ppapi_simple will start nacl_main in a worker thread */
+PPAPI_SIMPLE_REGISTER_MAIN(nacl_main);
+
+#endif /* SDL_VIDEO_DRIVER_NACL */
diff --git a/src/3rdparty/SDL2/src/main/psp/SDL_psp_main.c b/src/3rdparty/SDL2/src/main/psp/SDL_psp_main.c
new file mode 100644
index 0000000..2ca8e44
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/psp/SDL_psp_main.c
@@ -0,0 +1,70 @@
+/*
+ SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14
+*/
+#include "SDL_config.h"
+
+#ifdef __PSP__
+
+#include "SDL_main.h"
+#include <pspkernel.h>
+#include <pspdebug.h>
+#include <pspsdk.h>
+#include <pspthreadman.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* If application's main() is redefined as SDL_main, and libSDLmain is
+ linked, then this file will create the standard exit callback,
+ define the PSP_MODULE_INFO macro, and exit back to the browser when
+ the program is finished.
+
+ You can still override other parameters in your own code if you
+ desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR,
+ PSP_MAIN_THREAD_STACK_SIZE, etc.
+*/
+
+PSP_MODULE_INFO("SDL App", 0, 1, 1);
+
+int sdl_psp_exit_callback(int arg1, int arg2, void *common)
+{
+ exit(0);
+ return 0;
+}
+
+int sdl_psp_callback_thread(SceSize args, void *argp)
+{
+ int cbid;
+ cbid = sceKernelCreateCallback("Exit Callback",
+ sdl_psp_exit_callback, NULL);
+ sceKernelRegisterExitCallback(cbid);
+ sceKernelSleepThreadCB();
+ return 0;
+}
+
+int sdl_psp_setup_callbacks(void)
+{
+ int thid = 0;
+ thid = sceKernelCreateThread("update_thread",
+ sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
+ if(thid >= 0)
+ sceKernelStartThread(thid, 0, 0);
+ return thid;
+}
+
+int main(int argc, char *argv[])
+{
+ pspDebugScreenInit();
+ sdl_psp_setup_callbacks();
+
+ /* Register sceKernelExitGame() to be called when we exit */
+ atexit(sceKernelExitGame);
+
+ SDL_SetMainReady();
+
+ (void)SDL_main(argc, argv);
+ return 0;
+}
+
+#endif /* __PSP__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/main/windows/SDL_windows_main.c b/src/3rdparty/SDL2/src/main/windows/SDL_windows_main.c
new file mode 100644
index 0000000..5e643a4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/windows/SDL_windows_main.c
@@ -0,0 +1,207 @@
+/*
+ SDL_windows_main.c, placed in the public domain by Sam Lantinga 4/13/98
+
+ The WinMain function -- calls your program's main() function
+*/
+#include "SDL_config.h"
+
+#ifdef __WIN32__
+
+/* Include this so we define UNICODE properly */
+#include "../../core/windows/SDL_windows.h"
+
+/* Include the SDL main definition header */
+#include "SDL.h"
+#include "SDL_main.h"
+
+#ifdef main
+# undef main
+#endif /* main */
+
+static void
+UnEscapeQuotes(char *arg)
+{
+ char *last = NULL;
+
+ while (*arg) {
+ if (*arg == '"' && (last != NULL && *last == '\\')) {
+ char *c_curr = arg;
+ char *c_last = last;
+
+ while (*c_curr) {
+ *c_last = *c_curr;
+ c_last = c_curr;
+ c_curr++;
+ }
+ *c_last = '\0';
+ }
+ last = arg;
+ arg++;
+ }
+}
+
+/* Parse a command line buffer into arguments */
+static int
+ParseCommandLine(char *cmdline, char **argv)
+{
+ char *bufp;
+ char *lastp = NULL;
+ int argc, last_argc;
+
+ argc = last_argc = 0;
+ for (bufp = cmdline; *bufp;) {
+ /* Skip leading whitespace */
+ while (*bufp == ' ' || *bufp == '\t') {
+ ++bufp;
+ }
+ /* Skip over argument */
+ if (*bufp == '"') {
+ ++bufp;
+ if (*bufp) {
+ if (argv) {
+ argv[argc] = bufp;
+ }
+ ++argc;
+ }
+ /* Skip over word */
+ lastp = bufp;
+ while (*bufp && (*bufp != '"' || *lastp == '\\')) {
+ lastp = bufp;
+ ++bufp;
+ }
+ } else {
+ if (*bufp) {
+ if (argv) {
+ argv[argc] = bufp;
+ }
+ ++argc;
+ }
+ /* Skip over word */
+ while (*bufp && (*bufp != ' ' && *bufp != '\t')) {
+ ++bufp;
+ }
+ }
+ if (*bufp) {
+ if (argv) {
+ *bufp = '\0';
+ }
+ ++bufp;
+ }
+
+ /* Strip out \ from \" sequences */
+ if (argv && last_argc != argc) {
+ UnEscapeQuotes(argv[last_argc]);
+ }
+ last_argc = argc;
+ }
+ if (argv) {
+ argv[argc] = NULL;
+ }
+ return (argc);
+}
+
+/* Pop up an out of memory message, returns to Windows */
+static BOOL
+OutOfMemory(void)
+{
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL);
+ return FALSE;
+}
+
+#if defined(_MSC_VER)
+/* The VC++ compiler needs main/wmain defined */
+# define console_ansi_main main
+# if UNICODE
+# define console_wmain wmain
+# endif
+#endif
+
+/* WinMain, main, and wmain eventually call into here. */
+static int
+main_utf8(int argc, char *argv[])
+{
+ SDL_SetMainReady();
+
+ /* Run the application main() code */
+ return SDL_main(argc, argv);
+}
+
+/* Gets the arguments with GetCommandLine, converts them to argc and argv
+ and calls main_utf8 */
+static int
+main_getcmdline()
+{
+ char **argv;
+ int argc;
+ char *cmdline;
+ int retval = 0;
+
+ /* Grab the command line */
+ TCHAR *text = GetCommandLine();
+#if UNICODE
+ cmdline = WIN_StringToUTF8(text);
+#else
+ /* !!! FIXME: are these in the system codepage? We need to convert to UTF-8. */
+ cmdline = SDL_strdup(text);
+#endif
+ if (cmdline == NULL) {
+ return OutOfMemory();
+ }
+
+ /* Parse it into argv and argc */
+ argc = ParseCommandLine(cmdline, NULL);
+ argv = SDL_stack_alloc(char *, argc + 1);
+ if (argv == NULL) {
+ return OutOfMemory();
+ }
+ ParseCommandLine(cmdline, argv);
+
+ retval = main_utf8(argc, argv);
+
+ SDL_stack_free(argv);
+ SDL_free(cmdline);
+
+ return retval;
+}
+
+/* This is where execution begins [console apps, ansi] */
+int
+console_ansi_main(int argc, char *argv[])
+{
+ return main_getcmdline();
+}
+
+
+#if UNICODE
+/* This is where execution begins [console apps, unicode] */
+int
+console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp)
+{
+ int retval = 0;
+ char **argv = SDL_stack_alloc(char*, argc + 1);
+ int i;
+
+ for (i = 0; i < argc; ++i) {
+ argv[i] = WIN_StringToUTF8(wargv[i]);
+ }
+ argv[argc] = NULL;
+
+ retval = main_utf8(argc, argv);
+
+ /* !!! FIXME: we are leaking all the elements of argv we allocated. */
+ SDL_stack_free(argv);
+
+ return retval;
+}
+#endif
+
+/* This is where execution begins [windowed apps] */
+int WINAPI
+WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
+{
+ return main_getcmdline();
+}
+
+#endif /* __WIN32__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/main/windows/version.rc b/src/3rdparty/SDL2/src/main/windows/version.rc
new file mode 100644
index 0000000..6d16ad5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/windows/version.rc
@@ -0,0 +1,38 @@
+
+#include "winresrc.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 2,0,8,0
+ PRODUCTVERSION 2,0,8,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "SDL\0"
+ VALUE "FileVersion", "2, 0, 8, 0\0"
+ VALUE "InternalName", "SDL\0"
+ VALUE "LegalCopyright", "Copyright 2018 Sam Lantinga\0"
+ VALUE "OriginalFilename", "SDL2.dll\0"
+ VALUE "ProductName", "Simple DirectMedia Layer\0"
+ VALUE "ProductVersion", "2, 0, 8, 0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur b/src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur
new file mode 100644
index 0000000..c6556b8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur
Binary files differ
diff --git a/src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResources.rc b/src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResources.rc
new file mode 100644
index 0000000..988a8d5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/winrt/SDL2-WinRTResources.rc
@@ -0,0 +1,3 @@
+#include "winres.h"
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+5000 CURSOR "SDL2-WinRTResource_BlankCursor.cur"
diff --git a/src/3rdparty/SDL2/src/main/winrt/SDL_winrt_main_NonXAML.cpp b/src/3rdparty/SDL2/src/main/winrt/SDL_winrt_main_NonXAML.cpp
new file mode 100644
index 0000000..19d2250
--- /dev/null
+++ b/src/3rdparty/SDL2/src/main/winrt/SDL_winrt_main_NonXAML.cpp
@@ -0,0 +1,54 @@
+/*
+ SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14
+*/
+
+#include "SDL_main.h"
+#include <wrl.h>
+
+/* At least one file in any SDL/WinRT app appears to require compilation
+ with C++/CX, otherwise a Windows Metadata file won't get created, and
+ an APPX0702 build error can appear shortly after linking.
+
+ The following set of preprocessor code forces this file to be compiled
+ as C++/CX, which appears to cause Visual C++ 2012's build tools to
+ create this .winmd file, and will help allow builds of SDL/WinRT apps
+ to proceed without error.
+
+ If other files in an app's project enable C++/CX compilation, then it might
+ be possible for SDL_winrt_main_NonXAML.cpp to be compiled without /ZW,
+ for Visual C++'s build tools to create a winmd file, and for the app to
+ build without APPX0702 errors. In this case, if
+ SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
+ the #error (to force C++/CX compilation) will be disabled.
+
+ Please note that /ZW can be specified on a file-by-file basis. To do this,
+ right click on the file in Visual C++, click Properties, then change the
+ setting through the dialog that comes up.
+*/
+#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
+#ifndef __cplusplus_winrt
+#error SDL_winrt_main_NonXAML.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur.
+#endif
+#endif
+
+/* Prevent MSVC++ from warning about threading models when defining our
+ custom WinMain. The threading model will instead be set via a direct
+ call to Windows::Foundation::Initialize (rather than via an attributed
+ function).
+
+ To note, this warning (C4447) does not seem to come up unless this file
+ is compiled with C++/CX enabled (via the /ZW compiler flag).
+*/
+#ifdef _MSC_VER
+#pragma warning(disable:4447)
+#endif
+
+/* Make sure the function to initialize the Windows Runtime gets linked in. */
+#ifdef _MSC_VER
+#pragma comment(lib, "runtimeobject.lib")
+#endif
+
+int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
+{
+ return SDL_WinRTRunApp(SDL_main, NULL);
+}
diff --git a/src/3rdparty/SDL2/src/power/SDL_power.c b/src/3rdparty/SDL2/src/power/SDL_power.c
new file mode 100644
index 0000000..e09e27b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/SDL_power.c
@@ -0,0 +1,116 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+#include "SDL_power.h"
+#include "SDL_syspower.h"
+
+/*
+ * Returns SDL_TRUE if we have a definitive answer.
+ * SDL_FALSE to try next implementation.
+ */
+typedef SDL_bool
+ (*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds,
+ int *percent);
+
+#ifndef SDL_POWER_DISABLED
+#ifdef SDL_POWER_HARDWIRED
+/* This is for things that _never_ have a battery */
+static SDL_bool
+SDL_GetPowerInfo_Hardwired(SDL_PowerState * state, int *seconds, int *percent)
+{
+ *seconds = -1;
+ *percent = -1;
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ return SDL_TRUE;
+}
+#endif
+#endif
+
+
+static SDL_GetPowerInfo_Impl implementations[] = {
+#ifndef SDL_POWER_DISABLED
+#ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */
+ SDL_GetPowerInfo_Linux_org_freedesktop_upower,
+ SDL_GetPowerInfo_Linux_sys_class_power_supply,
+ SDL_GetPowerInfo_Linux_proc_acpi,
+ SDL_GetPowerInfo_Linux_proc_apm,
+#endif
+#ifdef SDL_POWER_WINDOWS /* handles Win32, Win64, PocketPC. */
+ SDL_GetPowerInfo_Windows,
+#endif
+#ifdef SDL_POWER_UIKIT /* handles iPhone/iPad/etc */
+ SDL_GetPowerInfo_UIKit,
+#endif
+#ifdef SDL_POWER_MACOSX /* handles Mac OS X, Darwin. */
+ SDL_GetPowerInfo_MacOSX,
+#endif
+#ifdef SDL_POWER_HAIKU /* with BeOS euc.jp apm driver. Does this work on Haiku? */
+ SDL_GetPowerInfo_Haiku,
+#endif
+#ifdef SDL_POWER_ANDROID /* handles Android. */
+ SDL_GetPowerInfo_Android,
+#endif
+#ifdef SDL_POWER_PSP /* handles PSP. */
+ SDL_GetPowerInfo_PSP,
+#endif
+#ifdef SDL_POWER_WINRT /* handles WinRT */
+ SDL_GetPowerInfo_WinRT,
+#endif
+#ifdef SDL_POWER_EMSCRIPTEN /* handles Emscripten */
+ SDL_GetPowerInfo_Emscripten,
+#endif
+
+#ifdef SDL_POWER_HARDWIRED
+ SDL_GetPowerInfo_Hardwired,
+#endif
+#endif
+};
+
+SDL_PowerState
+SDL_GetPowerInfo(int *seconds, int *percent)
+{
+ const int total = sizeof(implementations) / sizeof(implementations[0]);
+ int _seconds, _percent;
+ SDL_PowerState retval = SDL_POWERSTATE_UNKNOWN;
+ int i;
+
+ /* Make these never NULL for platform-specific implementations. */
+ if (seconds == NULL) {
+ seconds = &_seconds;
+ }
+
+ if (percent == NULL) {
+ percent = &_percent;
+ }
+
+ for (i = 0; i < total; i++) {
+ if (implementations[i](&retval, seconds, percent)) {
+ return retval;
+ }
+ }
+
+ /* nothing was definitive. */
+ *seconds = -1;
+ *percent = -1;
+ return SDL_POWERSTATE_UNKNOWN;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/SDL_syspower.h b/src/3rdparty/SDL2/src/power/SDL_syspower.h
new file mode 100644
index 0000000..a9bf70c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/SDL_syspower.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* These are functions that need to be implemented by a port of SDL */
+
+#ifndef SDL_syspower_h_
+#define SDL_syspower_h_
+
+#include "SDL_power.h"
+
+/* Not all of these are available in a given build. Use #ifdefs, etc. */
+SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *);
+
+#endif /* SDL_syspower_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/android/SDL_syspower.c b/src/3rdparty/SDL2/src/power/android/SDL_syspower.c
new file mode 100644
index 0000000..f0f492d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/android/SDL_syspower.c
@@ -0,0 +1,64 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_ANDROID
+
+#include "SDL_power.h"
+#include "../SDL_syspower.h"
+
+#include "../../core/android/SDL_android.h"
+
+SDL_bool
+SDL_GetPowerInfo_Android(SDL_PowerState * state, int *seconds, int *percent)
+{
+ int battery;
+ int plugged;
+ int charged;
+
+ if (Android_JNI_GetPowerInfo(&plugged, &charged, &battery, seconds, percent) != -1) {
+ if (plugged) {
+ if (charged) {
+ *state = SDL_POWERSTATE_CHARGED;
+ } else if (battery) {
+ *state = SDL_POWERSTATE_CHARGING;
+ } else {
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ *seconds = -1;
+ *percent = -1;
+ }
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY;
+ }
+ } else {
+ *state = SDL_POWERSTATE_UNKNOWN;
+ *seconds = -1;
+ *percent = -1;
+ }
+
+ return SDL_TRUE;
+}
+
+#endif /* SDL_POWER_ANDROID */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/emscripten/SDL_syspower.c b/src/3rdparty/SDL2/src/power/emscripten/SDL_syspower.c
new file mode 100644
index 0000000..9b92168
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/emscripten/SDL_syspower.c
@@ -0,0 +1,62 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_EMSCRIPTEN
+
+#include <emscripten/html5.h>
+
+#include "SDL_power.h"
+
+SDL_bool
+SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
+{
+ EmscriptenBatteryEvent batteryState;
+ int haveBattery = 0;
+
+ if (emscripten_get_battery_status(&batteryState) == EMSCRIPTEN_RESULT_NOT_SUPPORTED)
+ return SDL_FALSE;
+
+ haveBattery = batteryState.level != 1.0 || !batteryState.charging || batteryState.chargingTime != 0.0;
+
+ if (!haveBattery) {
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ *seconds = -1;
+ *percent = -1;
+ return SDL_TRUE;
+ }
+
+ if (batteryState.charging)
+ *state = batteryState.chargingTime == 0.0 ? SDL_POWERSTATE_CHARGED : SDL_POWERSTATE_CHARGING;
+ else
+ *state = SDL_POWERSTATE_ON_BATTERY;
+
+ *seconds = batteryState.dischargingTime;
+ *percent = batteryState.level * 100;
+
+ return SDL_TRUE;
+}
+
+#endif /* SDL_POWER_EMSCRIPTEN */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/haiku/SDL_syspower.c b/src/3rdparty/SDL2/src/power/haiku/SDL_syspower.c
new file mode 100644
index 0000000..47961bb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/haiku/SDL_syspower.c
@@ -0,0 +1,128 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* uses BeOS euc.jp apm driver. */
+/* !!! FIXME: does this thing even work on Haiku? */
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_HAIKU
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <drivers/Drivers.h>
+
+/* These values are from apm.h ... */
+#define APM_DEVICE_PATH "/dev/misc/apm"
+#define APM_FUNC_OFFSET 0x5300
+#define APM_FUNC_GET_POWER_STATUS 10
+#define APM_DEVICE_ALL 1
+#define APM_BIOS_CALL (B_DEVICE_OP_CODES_END + 3)
+
+#include "SDL_power.h"
+
+SDL_bool
+SDL_GetPowerInfo_Haiku(SDL_PowerState * state, int *seconds, int *percent)
+{
+ const int fd = open("/dev/misc/apm", O_RDONLY);
+ SDL_bool need_details = SDL_FALSE;
+ uint16 regs[6];
+ uint8 ac_status;
+ uint8 battery_status;
+ uint8 battery_flags;
+ uint8 battery_life;
+ uint32 battery_time;
+ int rc;
+
+ if (fd == -1) {
+ return SDL_FALSE; /* maybe some other method will work? */
+ }
+
+ memset(regs, '\0', sizeof(regs));
+ regs[0] = APM_FUNC_OFFSET + APM_FUNC_GET_POWER_STATUS;
+ regs[1] = APM_DEVICE_ALL;
+ rc = ioctl(fd, APM_BIOS_CALL, regs);
+ close(fd);
+
+ if (rc < 0) {
+ return SDL_FALSE;
+ }
+
+ ac_status = regs[1] >> 8;
+ battery_status = regs[1] & 0xFF;
+ battery_flags = regs[2] >> 8;
+ battery_life = regs[2] & 0xFF;
+ battery_time = (uint32) regs[3];
+
+ /* in theory, _something_ should be set in battery_flags, right? */
+ if (battery_flags == 0x00) { /* older APM BIOS? Less fields. */
+ battery_time = 0xFFFF;
+ if (battery_status == 0xFF) {
+ battery_flags = 0xFF;
+ } else {
+ battery_flags = (1 << battery_status);
+ }
+ }
+
+ if ((battery_time != 0xFFFF) && (battery_time & (1 << 15))) {
+ /* time is in minutes, not seconds */
+ battery_time = (battery_time & 0x7FFF) * 60;
+ }
+
+ if (battery_flags == 0xFF) { /* unknown state */
+ *state = SDL_POWERSTATE_UNKNOWN;
+ } else if (battery_flags & (1 << 7)) { /* no battery */
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ } else if (battery_flags & (1 << 3)) { /* charging */
+ *state = SDL_POWERSTATE_CHARGING;
+ need_details = SDL_TRUE;
+ } else if (ac_status == 1) {
+ *state = SDL_POWERSTATE_CHARGED; /* on AC, not charging. */
+ need_details = SDL_TRUE;
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY; /* not on AC. */
+ need_details = SDL_TRUE;
+ }
+
+ *percent = -1;
+ *seconds = -1;
+ if (need_details) {
+ const int pct = (int) battery_life;
+ const int secs = (int) battery_time;
+
+ if (pct != 255) { /* 255 == unknown */
+ *percent = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */
+ }
+ if (secs != 0xFFFF) { /* 0xFFFF == unknown */
+ *seconds = secs;
+ }
+ }
+
+ return SDL_TRUE; /* the definitive answer if APM driver replied. */
+}
+
+#endif /* SDL_POWER_HAIKU */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/linux/SDL_syspower.c b/src/3rdparty/SDL2/src/power/linux/SDL_syspower.c
new file mode 100644
index 0000000..105d5fe
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/linux/SDL_syspower.c
@@ -0,0 +1,642 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_LINUX
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <fcntl.h>
+
+#include "SDL_power.h"
+#include "../SDL_syspower.h"
+
+#include "../../core/linux/SDL_dbus.h"
+
+static const char *proc_apm_path = "/proc/apm";
+static const char *proc_acpi_battery_path = "/proc/acpi/battery";
+static const char *proc_acpi_ac_adapter_path = "/proc/acpi/ac_adapter";
+static const char *sys_class_power_supply_path = "/sys/class/power_supply";
+
+static int
+open_power_file(const char *base, const char *node, const char *key)
+{
+ const size_t pathlen = strlen(base) + strlen(node) + strlen(key) + 3;
+ char *path = (char *) alloca(pathlen);
+ if (path == NULL) {
+ return -1; /* oh well. */
+ }
+
+ snprintf(path, pathlen, "%s/%s/%s", base, node, key);
+ return open(path, O_RDONLY);
+}
+
+
+static SDL_bool
+read_power_file(const char *base, const char *node, const char *key,
+ char *buf, size_t buflen)
+{
+ ssize_t br = 0;
+ const int fd = open_power_file(base, node, key);
+ if (fd == -1) {
+ return SDL_FALSE;
+ }
+ br = read(fd, buf, buflen-1);
+ close(fd);
+ if (br < 0) {
+ return SDL_FALSE;
+ }
+ buf[br] = '\0'; /* null-terminate the string. */
+ return SDL_TRUE;
+}
+
+
+static SDL_bool
+make_proc_acpi_key_val(char **_ptr, char **_key, char **_val)
+{
+ char *ptr = *_ptr;
+
+ while (*ptr == ' ') {
+ ptr++; /* skip whitespace. */
+ }
+
+ if (*ptr == '\0') {
+ return SDL_FALSE; /* EOF. */
+ }
+
+ *_key = ptr;
+
+ while ((*ptr != ':') && (*ptr != '\0')) {
+ ptr++;
+ }
+
+ if (*ptr == '\0') {
+ return SDL_FALSE; /* (unexpected) EOF. */
+ }
+
+ *(ptr++) = '\0'; /* terminate the key. */
+
+ while ((*ptr == ' ') && (*ptr != '\0')) {
+ ptr++; /* skip whitespace. */
+ }
+
+ if (*ptr == '\0') {
+ return SDL_FALSE; /* (unexpected) EOF. */
+ }
+
+ *_val = ptr;
+
+ while ((*ptr != '\n') && (*ptr != '\0')) {
+ ptr++;
+ }
+
+ if (*ptr != '\0') {
+ *(ptr++) = '\0'; /* terminate the value. */
+ }
+
+ *_ptr = ptr; /* store for next time. */
+ return SDL_TRUE;
+}
+
+static void
+check_proc_acpi_battery(const char * node, SDL_bool * have_battery,
+ SDL_bool * charging, int *seconds, int *percent)
+{
+ const char *base = proc_acpi_battery_path;
+ char info[1024];
+ char state[1024];
+ char *ptr = NULL;
+ char *key = NULL;
+ char *val = NULL;
+ SDL_bool charge = SDL_FALSE;
+ SDL_bool choose = SDL_FALSE;
+ int maximum = -1;
+ int remaining = -1;
+ int secs = -1;
+ int pct = -1;
+
+ if (!read_power_file(base, node, "state", state, sizeof (state))) {
+ return;
+ } else if (!read_power_file(base, node, "info", info, sizeof (info))) {
+ return;
+ }
+
+ ptr = &state[0];
+ while (make_proc_acpi_key_val(&ptr, &key, &val)) {
+ if (strcmp(key, "present") == 0) {
+ if (strcmp(val, "yes") == 0) {
+ *have_battery = SDL_TRUE;
+ }
+ } else if (strcmp(key, "charging state") == 0) {
+ /* !!! FIXME: what exactly _does_ charging/discharging mean? */
+ if (strcmp(val, "charging/discharging") == 0) {
+ charge = SDL_TRUE;
+ } else if (strcmp(val, "charging") == 0) {
+ charge = SDL_TRUE;
+ }
+ } else if (strcmp(key, "remaining capacity") == 0) {
+ char *endptr = NULL;
+ const int cvt = (int) strtol(val, &endptr, 10);
+ if (*endptr == ' ') {
+ remaining = cvt;
+ }
+ }
+ }
+
+ ptr = &info[0];
+ while (make_proc_acpi_key_val(&ptr, &key, &val)) {
+ if (strcmp(key, "design capacity") == 0) {
+ char *endptr = NULL;
+ const int cvt = (int) strtol(val, &endptr, 10);
+ if (*endptr == ' ') {
+ maximum = cvt;
+ }
+ }
+ }
+
+ if ((maximum >= 0) && (remaining >= 0)) {
+ pct = (int) ((((float) remaining) / ((float) maximum)) * 100.0f);
+ if (pct < 0) {
+ pct = 0;
+ } else if (pct > 100) {
+ pct = 100;
+ }
+ }
+
+ /* !!! FIXME: calculate (secs). */
+
+ /*
+ * We pick the battery that claims to have the most minutes left.
+ * (failing a report of minutes, we'll take the highest percent.)
+ */
+ if ((secs < 0) && (*seconds < 0)) {
+ if ((pct < 0) && (*percent < 0)) {
+ choose = SDL_TRUE; /* at least we know there's a battery. */
+ }
+ if (pct > *percent) {
+ choose = SDL_TRUE;
+ }
+ } else if (secs > *seconds) {
+ choose = SDL_TRUE;
+ }
+
+ if (choose) {
+ *seconds = secs;
+ *percent = pct;
+ *charging = charge;
+ }
+}
+
+static void
+check_proc_acpi_ac_adapter(const char * node, SDL_bool * have_ac)
+{
+ const char *base = proc_acpi_ac_adapter_path;
+ char state[256];
+ char *ptr = NULL;
+ char *key = NULL;
+ char *val = NULL;
+
+ if (!read_power_file(base, node, "state", state, sizeof (state))) {
+ return;
+ }
+
+ ptr = &state[0];
+ while (make_proc_acpi_key_val(&ptr, &key, &val)) {
+ if (strcmp(key, "state") == 0) {
+ if (strcmp(val, "on-line") == 0) {
+ *have_ac = SDL_TRUE;
+ }
+ }
+ }
+}
+
+
+SDL_bool
+SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState * state,
+ int *seconds, int *percent)
+{
+ struct dirent *dent = NULL;
+ DIR *dirp = NULL;
+ SDL_bool have_battery = SDL_FALSE;
+ SDL_bool have_ac = SDL_FALSE;
+ SDL_bool charging = SDL_FALSE;
+
+ *seconds = -1;
+ *percent = -1;
+ *state = SDL_POWERSTATE_UNKNOWN;
+
+ dirp = opendir(proc_acpi_battery_path);
+ if (dirp == NULL) {
+ return SDL_FALSE; /* can't use this interface. */
+ } else {
+ while ((dent = readdir(dirp)) != NULL) {
+ const char *node = dent->d_name;
+ check_proc_acpi_battery(node, &have_battery, &charging,
+ seconds, percent);
+ }
+ closedir(dirp);
+ }
+
+ dirp = opendir(proc_acpi_ac_adapter_path);
+ if (dirp == NULL) {
+ return SDL_FALSE; /* can't use this interface. */
+ } else {
+ while ((dent = readdir(dirp)) != NULL) {
+ const char *node = dent->d_name;
+ check_proc_acpi_ac_adapter(node, &have_ac);
+ }
+ closedir(dirp);
+ }
+
+ if (!have_battery) {
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ } else if (charging) {
+ *state = SDL_POWERSTATE_CHARGING;
+ } else if (have_ac) {
+ *state = SDL_POWERSTATE_CHARGED;
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY;
+ }
+
+ return SDL_TRUE; /* definitive answer. */
+}
+
+
+static SDL_bool
+next_string(char **_ptr, char **_str)
+{
+ char *ptr = *_ptr;
+ char *str = *_str;
+
+ while (*ptr == ' ') { /* skip any spaces... */
+ ptr++;
+ }
+
+ if (*ptr == '\0') {
+ return SDL_FALSE;
+ }
+
+ str = ptr;
+ while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0'))
+ ptr++;
+
+ if (*ptr != '\0')
+ *(ptr++) = '\0';
+
+ *_str = str;
+ *_ptr = ptr;
+ return SDL_TRUE;
+}
+
+static SDL_bool
+int_string(char *str, int *val)
+{
+ char *endptr = NULL;
+ *val = (int) strtol(str, &endptr, 0);
+ return ((*str != '\0') && (*endptr == '\0'));
+}
+
+/* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
+SDL_bool
+SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state,
+ int *seconds, int *percent)
+{
+ SDL_bool need_details = SDL_FALSE;
+ int ac_status = 0;
+ int battery_status = 0;
+ int battery_flag = 0;
+ int battery_percent = 0;
+ int battery_time = 0;
+ const int fd = open(proc_apm_path, O_RDONLY);
+ char buf[128];
+ char *ptr = &buf[0];
+ char *str = NULL;
+ ssize_t br;
+
+ if (fd == -1) {
+ return SDL_FALSE; /* can't use this interface. */
+ }
+
+ br = read(fd, buf, sizeof (buf) - 1);
+ close(fd);
+
+ if (br < 0) {
+ return SDL_FALSE;
+ }
+
+ buf[br] = '\0'; /* null-terminate the string. */
+ if (!next_string(&ptr, &str)) { /* driver version */
+ return SDL_FALSE;
+ }
+ if (!next_string(&ptr, &str)) { /* BIOS version */
+ return SDL_FALSE;
+ }
+ if (!next_string(&ptr, &str)) { /* APM flags */
+ return SDL_FALSE;
+ }
+
+ if (!next_string(&ptr, &str)) { /* AC line status */
+ return SDL_FALSE;
+ } else if (!int_string(str, &ac_status)) {
+ return SDL_FALSE;
+ }
+
+ if (!next_string(&ptr, &str)) { /* battery status */
+ return SDL_FALSE;
+ } else if (!int_string(str, &battery_status)) {
+ return SDL_FALSE;
+ }
+ if (!next_string(&ptr, &str)) { /* battery flag */
+ return SDL_FALSE;
+ } else if (!int_string(str, &battery_flag)) {
+ return SDL_FALSE;
+ }
+ if (!next_string(&ptr, &str)) { /* remaining battery life percent */
+ return SDL_FALSE;
+ }
+ if (str[strlen(str) - 1] == '%') {
+ str[strlen(str) - 1] = '\0';
+ }
+ if (!int_string(str, &battery_percent)) {
+ return SDL_FALSE;
+ }
+
+ if (!next_string(&ptr, &str)) { /* remaining battery life time */
+ return SDL_FALSE;
+ } else if (!int_string(str, &battery_time)) {
+ return SDL_FALSE;
+ }
+
+ if (!next_string(&ptr, &str)) { /* remaining battery life time units */
+ return SDL_FALSE;
+ } else if (strcmp(str, "min") == 0) {
+ battery_time *= 60;
+ }
+
+ if (battery_flag == 0xFF) { /* unknown state */
+ *state = SDL_POWERSTATE_UNKNOWN;
+ } else if (battery_flag & (1 << 7)) { /* no battery */
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ } else if (battery_flag & (1 << 3)) { /* charging */
+ *state = SDL_POWERSTATE_CHARGING;
+ need_details = SDL_TRUE;
+ } else if (ac_status == 1) {
+ *state = SDL_POWERSTATE_CHARGED; /* on AC, not charging. */
+ need_details = SDL_TRUE;
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY;
+ need_details = SDL_TRUE;
+ }
+
+ *percent = -1;
+ *seconds = -1;
+ if (need_details) {
+ const int pct = battery_percent;
+ const int secs = battery_time;
+
+ if (pct >= 0) { /* -1 == unknown */
+ *percent = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */
+ }
+ if (secs >= 0) { /* -1 == unknown */
+ *seconds = secs;
+ }
+ }
+
+ return SDL_TRUE;
+}
+
+SDL_bool
+SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent)
+{
+ const char *base = sys_class_power_supply_path;
+ struct dirent *dent;
+ DIR *dirp;
+
+ dirp = opendir(base);
+ if (!dirp) {
+ return SDL_FALSE;
+ }
+
+ *state = SDL_POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */
+ *seconds = -1;
+ *percent = -1;
+
+ while ((dent = readdir(dirp)) != NULL) {
+ const char *name = dent->d_name;
+ SDL_bool choose = SDL_FALSE;
+ char str[64];
+ SDL_PowerState st;
+ int secs;
+ int pct;
+
+ if ((SDL_strcmp(name, ".") == 0) || (SDL_strcmp(name, "..") == 0)) {
+ continue; /* skip these, of course. */
+ } else if (!read_power_file(base, name, "type", str, sizeof (str))) {
+ continue; /* Don't know _what_ we're looking at. Give up on it. */
+ } else if (SDL_strcmp(str, "Battery\n") != 0) {
+ continue; /* we don't care about UPS and such. */
+ }
+
+ /* if the scope is "device," it might be something like a PS4
+ controller reporting its own battery, and not something that powers
+ the system. Most system batteries don't list a scope at all; we
+ assume it's a system battery if not specified. */
+ if (read_power_file(base, name, "scope", str, sizeof (str))) {
+ if (SDL_strcmp(str, "device\n") == 0) {
+ continue; /* skip external devices with their own batteries. */
+ }
+ }
+
+ /* some drivers don't offer this, so if it's not explicitly reported assume it's present. */
+ if (read_power_file(base, name, "present", str, sizeof (str)) && (SDL_strcmp(str, "0\n") == 0)) {
+ st = SDL_POWERSTATE_NO_BATTERY;
+ } else if (!read_power_file(base, name, "status", str, sizeof (str))) {
+ st = SDL_POWERSTATE_UNKNOWN; /* uh oh */
+ } else if (SDL_strcmp(str, "Charging\n") == 0) {
+ st = SDL_POWERSTATE_CHARGING;
+ } else if (SDL_strcmp(str, "Discharging\n") == 0) {
+ st = SDL_POWERSTATE_ON_BATTERY;
+ } else if ((SDL_strcmp(str, "Full\n") == 0) || (SDL_strcmp(str, "Not charging\n") == 0)) {
+ st = SDL_POWERSTATE_CHARGED;
+ } else {
+ st = SDL_POWERSTATE_UNKNOWN; /* uh oh */
+ }
+
+ if (!read_power_file(base, name, "capacity", str, sizeof (str))) {
+ pct = -1;
+ } else {
+ pct = SDL_atoi(str);
+ pct = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */
+ }
+
+ if (!read_power_file(base, name, "time_to_empty_now", str, sizeof (str))) {
+ secs = -1;
+ } else {
+ secs = SDL_atoi(str);
+ secs = (secs <= 0) ? -1 : secs; /* 0 == unknown */
+ }
+
+ /*
+ * We pick the battery that claims to have the most minutes left.
+ * (failing a report of minutes, we'll take the highest percent.)
+ */
+ if ((secs < 0) && (*seconds < 0)) {
+ if ((pct < 0) && (*percent < 0)) {
+ choose = SDL_TRUE; /* at least we know there's a battery. */
+ } else if (pct > *percent) {
+ choose = SDL_TRUE;
+ }
+ } else if (secs > *seconds) {
+ choose = SDL_TRUE;
+ }
+
+ if (choose) {
+ *seconds = secs;
+ *percent = pct;
+ *state = st;
+ }
+ }
+
+ closedir(dirp);
+ return SDL_TRUE; /* don't look any further. */
+}
+
+
+/* d-bus queries to org.freedesktop.UPower. */
+#if SDL_USE_LIBDBUS
+#define UPOWER_DBUS_NODE "org.freedesktop.UPower"
+#define UPOWER_DBUS_PATH "/org/freedesktop/UPower"
+#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower"
+#define UPOWER_DEVICE_DBUS_INTERFACE "org.freedesktop.UPower.Device"
+
+static void
+check_upower_device(DBusConnection *conn, const char *path, SDL_PowerState *state, int *seconds, int *percent)
+{
+ SDL_bool choose = SDL_FALSE;
+ SDL_PowerState st;
+ int secs;
+ int pct;
+ Uint32 ui32 = 0;
+ Sint64 si64 = 0;
+ double d = 0.0;
+
+ if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Type", DBUS_TYPE_UINT32, &ui32)) {
+ return; /* Don't know _what_ we're looking at. Give up on it. */
+ } else if (ui32 != 2) { /* 2==Battery*/
+ return; /* we don't care about UPS and such. */
+ } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "PowerSupply", DBUS_TYPE_BOOLEAN, &ui32)) {
+ return;
+ } else if (!ui32) {
+ return; /* we don't care about random devices with batteries, like wireless controllers, etc */
+ } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) {
+ return;
+ } else if (!ui32) {
+ st = SDL_POWERSTATE_NO_BATTERY;
+ } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) {
+ st = SDL_POWERSTATE_UNKNOWN; /* uh oh */
+ } else if (ui32 == 1) { /* 1 == charging */
+ st = SDL_POWERSTATE_CHARGING;
+ } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */
+ st = SDL_POWERSTATE_ON_BATTERY;
+ } else if (ui32 == 4) { /* 4 == full */
+ st = SDL_POWERSTATE_CHARGED;
+ } else {
+ st = SDL_POWERSTATE_UNKNOWN; /* uh oh */
+ }
+
+ if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Percentage", DBUS_TYPE_DOUBLE, &d)) {
+ pct = -1; /* some old/cheap batteries don't set this property. */
+ } else {
+ pct = (int) d;
+ pct = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */
+ }
+
+ if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "TimeToEmpty", DBUS_TYPE_INT64, &si64)) {
+ secs = -1;
+ } else {
+ secs = (int) si64;
+ secs = (secs <= 0) ? -1 : secs; /* 0 == unknown */
+ }
+
+ /*
+ * We pick the battery that claims to have the most minutes left.
+ * (failing a report of minutes, we'll take the highest percent.)
+ */
+ if ((secs < 0) && (*seconds < 0)) {
+ if ((pct < 0) && (*percent < 0)) {
+ choose = SDL_TRUE; /* at least we know there's a battery. */
+ } else if (pct > *percent) {
+ choose = SDL_TRUE;
+ }
+ } else if (secs > *seconds) {
+ choose = SDL_TRUE;
+ }
+
+ if (choose) {
+ *seconds = secs;
+ *percent = pct;
+ *state = st;
+ }
+}
+#endif
+
+SDL_bool
+SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent)
+{
+ SDL_bool retval = SDL_FALSE;
+
+ #if SDL_USE_LIBDBUS
+ SDL_DBusContext *dbus = SDL_DBus_GetContext();
+ char **paths = NULL;
+ int i, numpaths = 0;
+
+ if (!SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices",
+ DBUS_TYPE_INVALID,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) {
+ return SDL_FALSE; /* try a different approach than UPower. */
+ }
+
+ retval = SDL_TRUE; /* Clearly we can use this interface. */
+ *state = SDL_POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */
+ *seconds = -1;
+ *percent = -1;
+
+ for (i = 0; i < numpaths; i++) {
+ check_upower_device(dbus->system_conn, paths[i], state, seconds, percent);
+ }
+
+ if (dbus) {
+ dbus->free_string_array(paths);
+ }
+ #endif /* SDL_USE_LIBDBUS */
+
+ return retval;
+}
+
+#endif /* SDL_POWER_LINUX */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/macosx/SDL_syspower.c b/src/3rdparty/SDL2/src/power/macosx/SDL_syspower.c
new file mode 100644
index 0000000..f28b6c8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/macosx/SDL_syspower.c
@@ -0,0 +1,192 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_MACOSX
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <IOKit/ps/IOPowerSources.h>
+#include <IOKit/ps/IOPSKeys.h>
+
+#include "SDL_power.h"
+
+/* CoreFoundation is so verbose... */
+#define STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo)
+#define GETVAL(k,v) \
+ CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v)
+
+/* Note that AC power sources also include a laptop battery it is charging. */
+static void
+checkps(CFDictionaryRef dict, SDL_bool * have_ac, SDL_bool * have_battery,
+ SDL_bool * charging, int *seconds, int *percent)
+{
+ CFStringRef strval; /* don't CFRelease() this. */
+ CFBooleanRef bval;
+ CFNumberRef numval;
+ SDL_bool charge = SDL_FALSE;
+ SDL_bool choose = SDL_FALSE;
+ SDL_bool is_ac = SDL_FALSE;
+ int secs = -1;
+ int maxpct = -1;
+ int pct = -1;
+
+ if ((GETVAL(kIOPSIsPresentKey, &bval)) && (bval == kCFBooleanFalse)) {
+ return; /* nothing to see here. */
+ }
+
+ if (!GETVAL(kIOPSPowerSourceStateKey, &strval)) {
+ return;
+ }
+
+ if (STRMATCH(strval, CFSTR(kIOPSACPowerValue))) {
+ is_ac = *have_ac = SDL_TRUE;
+ } else if (!STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue))) {
+ return; /* not a battery? */
+ }
+
+ if ((GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue)) {
+ charge = SDL_TRUE;
+ }
+
+ if (GETVAL(kIOPSMaxCapacityKey, &numval)) {
+ SInt32 val = -1;
+ CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
+ if (val > 0) {
+ *have_battery = SDL_TRUE;
+ maxpct = (int) val;
+ }
+ }
+
+ if (GETVAL(kIOPSMaxCapacityKey, &numval)) {
+ SInt32 val = -1;
+ CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
+ if (val > 0) {
+ *have_battery = SDL_TRUE;
+ maxpct = (int) val;
+ }
+ }
+
+ if (GETVAL(kIOPSTimeToEmptyKey, &numval)) {
+ SInt32 val = -1;
+ CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
+
+ /* Mac OS X reports 0 minutes until empty if you're plugged in. :( */
+ if ((val == 0) && (is_ac)) {
+ val = -1; /* !!! FIXME: calc from timeToFull and capacity? */
+ }
+
+ secs = (int) val;
+ if (secs > 0) {
+ secs *= 60; /* value is in minutes, so convert to seconds. */
+ }
+ }
+
+ if (GETVAL(kIOPSCurrentCapacityKey, &numval)) {
+ SInt32 val = -1;
+ CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
+ pct = (int) val;
+ }
+
+ if ((pct > 0) && (maxpct > 0)) {
+ pct = (int) ((((double) pct) / ((double) maxpct)) * 100.0);
+ }
+
+ if (pct > 100) {
+ pct = 100;
+ }
+
+ /*
+ * We pick the battery that claims to have the most minutes left.
+ * (failing a report of minutes, we'll take the highest percent.)
+ */
+ if ((secs < 0) && (*seconds < 0)) {
+ if ((pct < 0) && (*percent < 0)) {
+ choose = SDL_TRUE; /* at least we know there's a battery. */
+ }
+ if (pct > *percent) {
+ choose = SDL_TRUE;
+ }
+ } else if (secs > *seconds) {
+ choose = SDL_TRUE;
+ }
+
+ if (choose) {
+ *seconds = secs;
+ *percent = pct;
+ *charging = charge;
+ }
+}
+
+#undef GETVAL
+#undef STRMATCH
+
+
+SDL_bool
+SDL_GetPowerInfo_MacOSX(SDL_PowerState * state, int *seconds, int *percent)
+{
+ CFTypeRef blob = IOPSCopyPowerSourcesInfo();
+
+ *seconds = -1;
+ *percent = -1;
+ *state = SDL_POWERSTATE_UNKNOWN;
+
+ if (blob != NULL) {
+ CFArrayRef list = IOPSCopyPowerSourcesList(blob);
+ if (list != NULL) {
+ /* don't CFRelease() the list items, or dictionaries! */
+ SDL_bool have_ac = SDL_FALSE;
+ SDL_bool have_battery = SDL_FALSE;
+ SDL_bool charging = SDL_FALSE;
+ const CFIndex total = CFArrayGetCount(list);
+ CFIndex i;
+ for (i = 0; i < total; i++) {
+ CFTypeRef ps = (CFTypeRef) CFArrayGetValueAtIndex(list, i);
+ CFDictionaryRef dict =
+ IOPSGetPowerSourceDescription(blob, ps);
+ if (dict != NULL) {
+ checkps(dict, &have_ac, &have_battery, &charging,
+ seconds, percent);
+ }
+ }
+
+ if (!have_battery) {
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ } else if (charging) {
+ *state = SDL_POWERSTATE_CHARGING;
+ } else if (have_ac) {
+ *state = SDL_POWERSTATE_CHARGED;
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY;
+ }
+
+ CFRelease(list);
+ }
+ CFRelease(blob);
+ }
+
+ return SDL_TRUE; /* always the definitive answer on Mac OS X. */
+}
+
+#endif /* SDL_POWER_MACOSX */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/psp/SDL_syspower.c b/src/3rdparty/SDL2/src/power/psp/SDL_syspower.c
new file mode 100644
index 0000000..74585b2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/psp/SDL_syspower.c
@@ -0,0 +1,68 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_PSP
+
+#include "SDL_power.h"
+#include <psppower.h>
+
+
+SDL_bool
+SDL_GetPowerInfo_PSP(SDL_PowerState * state, int *seconds,
+ int *percent)
+{
+ int battery = scePowerIsBatteryExist();
+ int plugged = scePowerIsPowerOnline();
+ int charging = scePowerIsBatteryCharging();
+
+ *state = SDL_POWERSTATE_UNKNOWN;
+ *seconds = -1;
+ *percent = -1;
+
+ if (!battery) {
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ *seconds = -1;
+ *percent = -1;
+ } else if (charging) {
+ *state = SDL_POWERSTATE_CHARGING;
+ *percent = scePowerGetBatteryLifePercent();
+ *seconds = scePowerGetBatteryLifeTime()*60;
+ } else if (plugged) {
+ *state = SDL_POWERSTATE_CHARGED;
+ *percent = scePowerGetBatteryLifePercent();
+ *seconds = scePowerGetBatteryLifeTime()*60;
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY;
+ *percent = scePowerGetBatteryLifePercent();
+ *seconds = scePowerGetBatteryLifeTime()*60;
+ }
+
+
+ return SDL_TRUE; /* always the definitive answer on PSP. */
+}
+
+#endif /* SDL_POWER_PSP */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/uikit/SDL_syspower.h b/src/3rdparty/SDL2/src/power/uikit/SDL_syspower.h
new file mode 100644
index 0000000..4a42fd2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/uikit/SDL_syspower.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_POWER_UIKIT
+
+#include "SDL_power.h"
+
+void SDL_UIKit_UpdateBatteryMonitoring(void);
+SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent);
+
+#endif /* SDL_POWER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/uikit/SDL_syspower.m b/src/3rdparty/SDL2/src/power/uikit/SDL_syspower.m
new file mode 100644
index 0000000..cb8a252
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/uikit/SDL_syspower.m
@@ -0,0 +1,113 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_UIKIT
+
+#import <UIKit/UIKit.h>
+
+#include "SDL_power.h"
+#include "SDL_timer.h"
+#include "SDL_assert.h"
+#include "SDL_syspower.h"
+
+#if !TARGET_OS_TV
+/* turn off the battery monitor if it's been more than X ms since last check. */
+static const int BATTERY_MONITORING_TIMEOUT = 3000;
+static Uint32 SDL_UIKitLastPowerInfoQuery = 0;
+
+void
+SDL_UIKit_UpdateBatteryMonitoring(void)
+{
+ if (SDL_UIKitLastPowerInfoQuery) {
+ if (SDL_TICKS_PASSED(SDL_GetTicks(), SDL_UIKitLastPowerInfoQuery + BATTERY_MONITORING_TIMEOUT)) {
+ UIDevice *uidev = [UIDevice currentDevice];
+ SDL_assert([uidev isBatteryMonitoringEnabled] == YES);
+ [uidev setBatteryMonitoringEnabled:NO];
+ SDL_UIKitLastPowerInfoQuery = 0;
+ }
+ }
+}
+#else
+void
+SDL_UIKit_UpdateBatteryMonitoring(void)
+{
+ /* Do nothing. */
+}
+#endif /* !TARGET_OS_TV */
+
+SDL_bool
+SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent)
+{
+#if TARGET_OS_TV
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ *seconds = -1;
+ *percent = -1;
+#else /* TARGET_OS_TV */
+ @autoreleasepool {
+ UIDevice *uidev = [UIDevice currentDevice];
+
+ if (!SDL_UIKitLastPowerInfoQuery) {
+ SDL_assert(uidev.isBatteryMonitoringEnabled == NO);
+ uidev.batteryMonitoringEnabled = YES;
+ }
+
+ /* UIKit_GL_SwapWindow() (etc) will check this and disable the battery
+ * monitoring if the app hasn't queried it in the last X seconds.
+ * Apparently monitoring the battery burns battery life. :)
+ * Apple's docs say not to monitor the battery unless you need it.
+ */
+ SDL_UIKitLastPowerInfoQuery = SDL_GetTicks();
+
+ *seconds = -1; /* no API to estimate this in UIKit. */
+
+ switch (uidev.batteryState) {
+ case UIDeviceBatteryStateCharging:
+ *state = SDL_POWERSTATE_CHARGING;
+ break;
+
+ case UIDeviceBatteryStateFull:
+ *state = SDL_POWERSTATE_CHARGED;
+ break;
+
+ case UIDeviceBatteryStateUnplugged:
+ *state = SDL_POWERSTATE_ON_BATTERY;
+ break;
+
+ case UIDeviceBatteryStateUnknown:
+ default:
+ *state = SDL_POWERSTATE_UNKNOWN;
+ break;
+ }
+
+ const float level = uidev.batteryLevel;
+ *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) );
+ }
+#endif /* TARGET_OS_TV */
+
+ return SDL_TRUE; /* always the definitive answer on iOS. */
+}
+
+#endif /* SDL_POWER_UIKIT */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/windows/SDL_syspower.c b/src/3rdparty/SDL2/src/power/windows/SDL_syspower.c
new file mode 100644
index 0000000..be6c9d3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/windows/SDL_syspower.c
@@ -0,0 +1,76 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_WINDOWS
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_power.h"
+
+SDL_bool
+SDL_GetPowerInfo_Windows(SDL_PowerState * state, int *seconds, int *percent)
+{
+ SYSTEM_POWER_STATUS status;
+ SDL_bool need_details = SDL_FALSE;
+
+ /* This API should exist back to Win95. */
+ if (!GetSystemPowerStatus(&status))
+ {
+ /* !!! FIXME: push GetLastError() into SDL_GetError() */
+ *state = SDL_POWERSTATE_UNKNOWN;
+ } else if (status.BatteryFlag == 0xFF) { /* unknown state */
+ *state = SDL_POWERSTATE_UNKNOWN;
+ } else if (status.BatteryFlag & (1 << 7)) { /* no battery */
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ } else if (status.BatteryFlag & (1 << 3)) { /* charging */
+ *state = SDL_POWERSTATE_CHARGING;
+ need_details = SDL_TRUE;
+ } else if (status.ACLineStatus == 1) {
+ *state = SDL_POWERSTATE_CHARGED; /* on AC, not charging. */
+ need_details = SDL_TRUE;
+ } else {
+ *state = SDL_POWERSTATE_ON_BATTERY; /* not on AC. */
+ need_details = SDL_TRUE;
+ }
+
+ *percent = -1;
+ *seconds = -1;
+ if (need_details) {
+ const int pct = (int) status.BatteryLifePercent;
+ const int secs = (int) status.BatteryLifeTime;
+
+ if (pct != 255) { /* 255 == unknown */
+ *percent = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */
+ }
+ if (secs != 0xFFFFFFFF) { /* ((DWORD)-1) == unknown */
+ *seconds = secs;
+ }
+ }
+
+ return SDL_TRUE; /* always the definitive answer on Windows. */
+}
+
+#endif /* SDL_POWER_WINDOWS */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/power/winrt/SDL_syspower.cpp b/src/3rdparty/SDL2/src/power/winrt/SDL_syspower.cpp
new file mode 100644
index 0000000..9f2c2ad
--- /dev/null
+++ b/src/3rdparty/SDL2/src/power/winrt/SDL_syspower.cpp
@@ -0,0 +1,44 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_POWER_DISABLED
+#if SDL_POWER_WINRT
+
+#include "SDL_power.h"
+
+extern "C"
+SDL_bool
+SDL_GetPowerInfo_WinRT(SDL_PowerState * state, int *seconds, int *percent)
+{
+ /* TODO, WinRT: Battery info is available on at least one WinRT platform (Windows Phone 8). Implement SDL_GetPowerInfo_WinRT as appropriate. */
+ /* Notes:
+ - the Win32 function, GetSystemPowerStatus, is not available for use on WinRT
+ - Windows Phone 8 has a 'Battery' class, which is documented as available for C++
+ - More info on WP8's Battery class can be found at http://msdn.microsoft.com/library/windowsphone/develop/jj207231
+ */
+ return SDL_FALSE;
+}
+
+#endif /* SDL_POWER_WINRT */
+#endif /* SDL_POWER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/SDL_d3dmath.c b/src/3rdparty/SDL2/src/render/SDL_d3dmath.c
new file mode 100644
index 0000000..47eafb2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/SDL_d3dmath.c
@@ -0,0 +1,136 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED
+#include "SDL_stdinc.h"
+
+#include "SDL_d3dmath.h"
+
+/* Direct3D matrix math functions */
+
+Float4X4 MatrixIdentity()
+{
+ Float4X4 m;
+ SDL_zero(m);
+ m.v._11 = 1.0f;
+ m.v._22 = 1.0f;
+ m.v._33 = 1.0f;
+ m.v._44 = 1.0f;
+ return m;
+}
+
+Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2)
+{
+ Float4X4 m;
+ m.v._11 = M1.v._11 * M2.v._11 + M1.v._12 * M2.v._21 + M1.v._13 * M2.v._31 + M1.v._14 * M2.v._41;
+ m.v._12 = M1.v._11 * M2.v._12 + M1.v._12 * M2.v._22 + M1.v._13 * M2.v._32 + M1.v._14 * M2.v._42;
+ m.v._13 = M1.v._11 * M2.v._13 + M1.v._12 * M2.v._23 + M1.v._13 * M2.v._33 + M1.v._14 * M2.v._43;
+ m.v._14 = M1.v._11 * M2.v._14 + M1.v._12 * M2.v._24 + M1.v._13 * M2.v._34 + M1.v._14 * M2.v._44;
+ m.v._21 = M1.v._21 * M2.v._11 + M1.v._22 * M2.v._21 + M1.v._23 * M2.v._31 + M1.v._24 * M2.v._41;
+ m.v._22 = M1.v._21 * M2.v._12 + M1.v._22 * M2.v._22 + M1.v._23 * M2.v._32 + M1.v._24 * M2.v._42;
+ m.v._23 = M1.v._21 * M2.v._13 + M1.v._22 * M2.v._23 + M1.v._23 * M2.v._33 + M1.v._24 * M2.v._43;
+ m.v._24 = M1.v._21 * M2.v._14 + M1.v._22 * M2.v._24 + M1.v._23 * M2.v._34 + M1.v._24 * M2.v._44;
+ m.v._31 = M1.v._31 * M2.v._11 + M1.v._32 * M2.v._21 + M1.v._33 * M2.v._31 + M1.v._34 * M2.v._41;
+ m.v._32 = M1.v._31 * M2.v._12 + M1.v._32 * M2.v._22 + M1.v._33 * M2.v._32 + M1.v._34 * M2.v._42;
+ m.v._33 = M1.v._31 * M2.v._13 + M1.v._32 * M2.v._23 + M1.v._33 * M2.v._33 + M1.v._34 * M2.v._43;
+ m.v._34 = M1.v._31 * M2.v._14 + M1.v._32 * M2.v._24 + M1.v._33 * M2.v._34 + M1.v._34 * M2.v._44;
+ m.v._41 = M1.v._41 * M2.v._11 + M1.v._42 * M2.v._21 + M1.v._43 * M2.v._31 + M1.v._44 * M2.v._41;
+ m.v._42 = M1.v._41 * M2.v._12 + M1.v._42 * M2.v._22 + M1.v._43 * M2.v._32 + M1.v._44 * M2.v._42;
+ m.v._43 = M1.v._41 * M2.v._13 + M1.v._42 * M2.v._23 + M1.v._43 * M2.v._33 + M1.v._44 * M2.v._43;
+ m.v._44 = M1.v._41 * M2.v._14 + M1.v._42 * M2.v._24 + M1.v._43 * M2.v._34 + M1.v._44 * M2.v._44;
+ return m;
+}
+
+Float4X4 MatrixScaling(float x, float y, float z)
+{
+ Float4X4 m;
+ SDL_zero(m);
+ m.v._11 = x;
+ m.v._22 = y;
+ m.v._33 = z;
+ m.v._44 = 1.0f;
+ return m;
+}
+
+Float4X4 MatrixTranslation(float x, float y, float z)
+{
+ Float4X4 m;
+ SDL_zero(m);
+ m.v._11 = 1.0f;
+ m.v._22 = 1.0f;
+ m.v._33 = 1.0f;
+ m.v._44 = 1.0f;
+ m.v._41 = x;
+ m.v._42 = y;
+ m.v._43 = z;
+ return m;
+}
+
+Float4X4 MatrixRotationX(float r)
+{
+ float sinR = SDL_sinf(r);
+ float cosR = SDL_cosf(r);
+ Float4X4 m;
+ SDL_zero(m);
+ m.v._11 = 1.0f;
+ m.v._22 = cosR;
+ m.v._23 = sinR;
+ m.v._32 = -sinR;
+ m.v._33 = cosR;
+ m.v._44 = 1.0f;
+ return m;
+}
+
+Float4X4 MatrixRotationY(float r)
+{
+ float sinR = SDL_sinf(r);
+ float cosR = SDL_cosf(r);
+ Float4X4 m;
+ SDL_zero(m);
+ m.v._11 = cosR;
+ m.v._13 = -sinR;
+ m.v._22 = 1.0f;
+ m.v._31 = sinR;
+ m.v._33 = cosR;
+ m.v._44 = 1.0f;
+ return m;
+}
+
+Float4X4 MatrixRotationZ(float r)
+{
+ float sinR = SDL_sinf(r);
+ float cosR = SDL_cosf(r);
+ Float4X4 m;
+ SDL_zero(m);
+ m.v._11 = cosR;
+ m.v._12 = sinR;
+ m.v._21 = -sinR;
+ m.v._22 = cosR;
+ m.v._33 = 1.0f;
+ m.v._44 = 1.0f;
+ return m;
+
+}
+
+#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/SDL_d3dmath.h b/src/3rdparty/SDL2/src/render/SDL_d3dmath.h
new file mode 100644
index 0000000..8555a17
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/SDL_d3dmath.h
@@ -0,0 +1,72 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED
+
+/* Direct3D matrix math functions */
+
+typedef struct
+{
+ float x;
+ float y;
+} Float2;
+
+typedef struct
+{
+ float x;
+ float y;
+ float z;
+} Float3;
+
+typedef struct
+{
+ float x;
+ float y;
+ float z;
+ float w;
+} Float4;
+
+typedef struct
+{
+ union {
+ struct {
+ float _11, _12, _13, _14;
+ float _21, _22, _23, _24;
+ float _31, _32, _33, _34;
+ float _41, _42, _43, _44;
+ } v;
+ float m[4][4];
+ };
+} Float4X4;
+
+
+Float4X4 MatrixIdentity();
+Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2);
+Float4X4 MatrixScaling(float x, float y, float z);
+Float4X4 MatrixTranslation(float x, float y, float z);
+Float4X4 MatrixRotationX(float r);
+Float4X4 MatrixRotationY(float r);
+Float4X4 MatrixRotationZ(float r);
+
+#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/SDL_render.c b/src/3rdparty/SDL2/src/render/SDL_render.c
new file mode 100644
index 0000000..8cd3a7b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/SDL_render.c
@@ -0,0 +1,2234 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* The SDL 2D rendering system */
+
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_log.h"
+#include "SDL_render.h"
+#include "SDL_sysrender.h"
+#include "software/SDL_render_sw_c.h"
+
+
+#define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData"
+
+#define CHECK_RENDERER_MAGIC(renderer, retval) \
+ SDL_assert(renderer && renderer->magic == &renderer_magic); \
+ if (!renderer || renderer->magic != &renderer_magic) { \
+ SDL_SetError("Invalid renderer"); \
+ return retval; \
+ }
+
+#define CHECK_TEXTURE_MAGIC(texture, retval) \
+ SDL_assert(texture && texture->magic == &texture_magic); \
+ if (!texture || texture->magic != &texture_magic) { \
+ SDL_SetError("Invalid texture"); \
+ return retval; \
+ }
+
+/* Predefined blend modes */
+#define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, \
+ srcAlphaFactor, dstAlphaFactor, alphaOperation) \
+ (SDL_BlendMode)(((Uint32)colorOperation << 0) | \
+ ((Uint32)srcColorFactor << 4) | \
+ ((Uint32)dstColorFactor << 8) | \
+ ((Uint32)alphaOperation << 16) | \
+ ((Uint32)srcAlphaFactor << 20) | \
+ ((Uint32)dstAlphaFactor << 24))
+
+#define SDL_BLENDMODE_NONE_FULL \
+ SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD, \
+ SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD)
+
+#define SDL_BLENDMODE_BLEND_FULL \
+ SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \
+ SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD)
+
+#define SDL_BLENDMODE_ADD_FULL \
+ SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD, \
+ SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
+
+#define SDL_BLENDMODE_MOD_FULL \
+ SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDOPERATION_ADD, \
+ SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
+
+#if !SDL_RENDER_DISABLED
+static const SDL_RenderDriver *render_drivers[] = {
+#if SDL_VIDEO_RENDER_D3D
+ &D3D_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_D3D11
+ &D3D11_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_OGL
+ &GL_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_OGL_ES2
+ &GLES2_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_OGL_ES
+ &GLES_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_DIRECTFB
+ &DirectFB_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_METAL
+ &METAL_RenderDriver,
+#endif
+#if SDL_VIDEO_RENDER_PSP
+ &PSP_RenderDriver,
+#endif
+ &SW_RenderDriver
+};
+#endif /* !SDL_RENDER_DISABLED */
+
+static char renderer_magic;
+static char texture_magic;
+
+static int UpdateLogicalSize(SDL_Renderer *renderer);
+
+int
+SDL_GetNumRenderDrivers(void)
+{
+#if !SDL_RENDER_DISABLED
+ return SDL_arraysize(render_drivers);
+#else
+ return 0;
+#endif
+}
+
+int
+SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info)
+{
+#if !SDL_RENDER_DISABLED
+ if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
+ return SDL_SetError("index must be in the range of 0 - %d",
+ SDL_GetNumRenderDrivers() - 1);
+ }
+ *info = render_drivers[index]->info;
+ return 0;
+#else
+ return SDL_SetError("SDL not built with rendering support");
+#endif
+}
+
+static int SDLCALL
+SDL_RendererEventWatch(void *userdata, SDL_Event *event)
+{
+ SDL_Renderer *renderer = (SDL_Renderer *)userdata;
+
+ if (event->type == SDL_WINDOWEVENT) {
+ SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
+ if (window == renderer->window) {
+ if (renderer->WindowEvent) {
+ renderer->WindowEvent(renderer, &event->window);
+ }
+
+ if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
+ /* Make sure we're operating on the default render target */
+ SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
+ if (saved_target) {
+ SDL_SetRenderTarget(renderer, NULL);
+ }
+
+ if (renderer->logical_w) {
+ UpdateLogicalSize(renderer);
+ } else {
+ /* Window was resized, reset viewport */
+ int w, h;
+
+ if (renderer->GetOutputSize) {
+ renderer->GetOutputSize(renderer, &w, &h);
+ } else {
+ SDL_GetWindowSize(renderer->window, &w, &h);
+ }
+
+ if (renderer->target) {
+ renderer->viewport_backup.x = 0;
+ renderer->viewport_backup.y = 0;
+ renderer->viewport_backup.w = w;
+ renderer->viewport_backup.h = h;
+ } else {
+ renderer->viewport.x = 0;
+ renderer->viewport.y = 0;
+ renderer->viewport.w = w;
+ renderer->viewport.h = h;
+ renderer->UpdateViewport(renderer);
+ }
+ }
+
+ if (saved_target) {
+ SDL_SetRenderTarget(renderer, saved_target);
+ }
+ } else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) {
+ renderer->hidden = SDL_TRUE;
+ } else if (event->window.event == SDL_WINDOWEVENT_SHOWN) {
+ if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)) {
+ renderer->hidden = SDL_FALSE;
+ }
+ } else if (event->window.event == SDL_WINDOWEVENT_MINIMIZED) {
+ renderer->hidden = SDL_TRUE;
+ } else if (event->window.event == SDL_WINDOWEVENT_RESTORED ||
+ event->window.event == SDL_WINDOWEVENT_MAXIMIZED) {
+ if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_HIDDEN)) {
+ renderer->hidden = SDL_FALSE;
+ }
+ }
+ }
+ } else if (event->type == SDL_MOUSEMOTION) {
+ SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID);
+ if (renderer->logical_w && window == renderer->window) {
+ event->motion.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x);
+ event->motion.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y);
+ event->motion.x = (int)(event->motion.x / (renderer->scale.x * renderer->dpi_scale.x));
+ event->motion.y = (int)(event->motion.y / (renderer->scale.y * renderer->dpi_scale.y));
+ if (event->motion.xrel > 0) {
+ event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x)));
+ } else if (event->motion.xrel < 0) {
+ event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x)));
+ }
+ if (event->motion.yrel > 0) {
+ event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y)));
+ } else if (event->motion.yrel < 0) {
+ event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y)));
+ }
+ }
+ } else if (event->type == SDL_MOUSEBUTTONDOWN ||
+ event->type == SDL_MOUSEBUTTONUP) {
+ SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
+ if (renderer->logical_w && window == renderer->window) {
+ event->button.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x);
+ event->button.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y);
+ event->button.x = (int)(event->button.x / (renderer->scale.x * renderer->dpi_scale.x));
+ event->button.y = (int)(event->button.y / (renderer->scale.y * renderer->dpi_scale.y));
+ }
+ } else if (event->type == SDL_FINGERDOWN ||
+ event->type == SDL_FINGERUP ||
+ event->type == SDL_FINGERMOTION) {
+ if (renderer->logical_w) {
+ int w = 1;
+ int h = 1;
+ SDL_GetRendererOutputSize(renderer, &w, &h);
+
+ event->tfinger.x *= (w - 1);
+ event->tfinger.y *= (h - 1);
+
+ event->tfinger.x -= (renderer->viewport.x * renderer->dpi_scale.x);
+ event->tfinger.y -= (renderer->viewport.y * renderer->dpi_scale.y);
+ event->tfinger.x = (event->tfinger.x / (renderer->scale.x * renderer->dpi_scale.x));
+ event->tfinger.y = (event->tfinger.y / (renderer->scale.y * renderer->dpi_scale.y));
+
+ if (renderer->logical_w > 1) {
+ event->tfinger.x = event->tfinger.x / (renderer->logical_w - 1);
+ } else {
+ event->tfinger.x = 0.5f;
+ }
+ if (renderer->logical_h > 1) {
+ event->tfinger.y = event->tfinger.y / (renderer->logical_h - 1);
+ } else {
+ event->tfinger.y = 0.5f;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int
+SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags,
+ SDL_Window **window, SDL_Renderer **renderer)
+{
+ *window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ width, height, window_flags);
+ if (!*window) {
+ *renderer = NULL;
+ return -1;
+ }
+
+ *renderer = SDL_CreateRenderer(*window, -1, 0);
+ if (!*renderer) {
+ return -1;
+ }
+
+ return 0;
+}
+
+SDL_Renderer *
+SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
+{
+#if !SDL_RENDER_DISABLED
+ SDL_Renderer *renderer = NULL;
+ int n = SDL_GetNumRenderDrivers();
+ const char *hint;
+
+ if (!window) {
+ SDL_SetError("Invalid window");
+ return NULL;
+ }
+
+ if (SDL_GetRenderer(window)) {
+ SDL_SetError("Renderer already associated with window");
+ return NULL;
+ }
+
+ if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) {
+ if (SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE)) {
+ flags |= SDL_RENDERER_PRESENTVSYNC;
+ } else {
+ flags &= ~SDL_RENDERER_PRESENTVSYNC;
+ }
+ }
+
+ if (index < 0) {
+ hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
+ if (hint) {
+ for (index = 0; index < n; ++index) {
+ const SDL_RenderDriver *driver = render_drivers[index];
+
+ if (SDL_strcasecmp(hint, driver->info.name) == 0) {
+ /* Create a new renderer instance */
+ renderer = driver->CreateRenderer(window, flags);
+ break;
+ }
+ }
+ }
+
+ if (!renderer) {
+ for (index = 0; index < n; ++index) {
+ const SDL_RenderDriver *driver = render_drivers[index];
+
+ if ((driver->info.flags & flags) == flags) {
+ /* Create a new renderer instance */
+ renderer = driver->CreateRenderer(window, flags);
+ if (renderer) {
+ /* Yay, we got one! */
+ break;
+ }
+ }
+ }
+ }
+ if (index == n) {
+ SDL_SetError("Couldn't find matching render driver");
+ return NULL;
+ }
+ } else {
+ if (index >= SDL_GetNumRenderDrivers()) {
+ SDL_SetError("index must be -1 or in the range of 0 - %d",
+ SDL_GetNumRenderDrivers() - 1);
+ return NULL;
+ }
+ /* Create a new renderer instance */
+ renderer = render_drivers[index]->CreateRenderer(window, flags);
+ }
+
+ if (renderer) {
+ renderer->magic = &renderer_magic;
+ renderer->window = window;
+ renderer->scale.x = 1.0f;
+ renderer->scale.y = 1.0f;
+ renderer->dpi_scale.x = 1.0f;
+ renderer->dpi_scale.y = 1.0f;
+
+ if (window && renderer->GetOutputSize) {
+ int window_w, window_h;
+ int output_w, output_h;
+ if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) {
+ SDL_GetWindowSize(renderer->window, &window_w, &window_h);
+ renderer->dpi_scale.x = (float)window_w / output_w;
+ renderer->dpi_scale.y = (float)window_h / output_h;
+ }
+ }
+
+ if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) {
+ renderer->hidden = SDL_TRUE;
+ } else {
+ renderer->hidden = SDL_FALSE;
+ }
+
+ SDL_SetWindowData(window, SDL_WINDOWRENDERDATA, renderer);
+
+ SDL_RenderSetViewport(renderer, NULL);
+
+ SDL_AddEventWatch(SDL_RendererEventWatch, renderer);
+
+ SDL_LogInfo(SDL_LOG_CATEGORY_RENDER,
+ "Created renderer: %s", renderer->info.name);
+ }
+ return renderer;
+#else
+ SDL_SetError("SDL not built with rendering support");
+ return NULL;
+#endif
+}
+
+SDL_Renderer *
+SDL_CreateSoftwareRenderer(SDL_Surface * surface)
+{
+#if !SDL_RENDER_DISABLED
+ SDL_Renderer *renderer;
+
+ renderer = SW_CreateRendererForSurface(surface);
+
+ if (renderer) {
+ renderer->magic = &renderer_magic;
+ renderer->scale.x = 1.0f;
+ renderer->scale.y = 1.0f;
+
+ SDL_RenderSetViewport(renderer, NULL);
+ }
+ return renderer;
+#else
+ SDL_SetError("SDL not built with rendering support");
+ return NULL;
+#endif /* !SDL_RENDER_DISABLED */
+}
+
+SDL_Renderer *
+SDL_GetRenderer(SDL_Window * window)
+{
+ return (SDL_Renderer *)SDL_GetWindowData(window, SDL_WINDOWRENDERDATA);
+}
+
+int
+SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ *info = renderer->info;
+ return 0;
+}
+
+int
+SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (renderer->target) {
+ return SDL_QueryTexture(renderer->target, NULL, NULL, w, h);
+ } else if (renderer->GetOutputSize) {
+ return renderer->GetOutputSize(renderer, w, h);
+ } else if (renderer->window) {
+ SDL_GetWindowSize(renderer->window, w, h);
+ return 0;
+ } else {
+ SDL_assert(0 && "This should never happen");
+ return SDL_SetError("Renderer doesn't support querying output size");
+ }
+}
+
+static SDL_bool
+IsSupportedBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ switch (blendMode)
+ {
+ /* These are required to be supported by all renderers */
+ case SDL_BLENDMODE_NONE:
+ case SDL_BLENDMODE_BLEND:
+ case SDL_BLENDMODE_ADD:
+ case SDL_BLENDMODE_MOD:
+ return SDL_TRUE;
+
+ default:
+ return renderer->SupportsBlendMode && renderer->SupportsBlendMode(renderer, blendMode);
+ }
+}
+
+static SDL_bool
+IsSupportedFormat(SDL_Renderer * renderer, Uint32 format)
+{
+ Uint32 i;
+
+ for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+ if (renderer->info.texture_formats[i] == format) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static Uint32
+GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format)
+{
+ Uint32 i;
+
+ if (SDL_ISPIXELFORMAT_FOURCC(format)) {
+ /* Look for an exact match */
+ for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+ if (renderer->info.texture_formats[i] == format) {
+ return renderer->info.texture_formats[i];
+ }
+ }
+ } else {
+ SDL_bool hasAlpha = SDL_ISPIXELFORMAT_ALPHA(format);
+
+ /* We just want to match the first format that has the same channels */
+ for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+ if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
+ SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == hasAlpha) {
+ return renderer->info.texture_formats[i];
+ }
+ }
+ }
+ return renderer->info.texture_formats[0];
+}
+
+SDL_Texture *
+SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h)
+{
+ SDL_Texture *texture;
+
+ CHECK_RENDERER_MAGIC(renderer, NULL);
+
+ if (!format) {
+ format = renderer->info.texture_formats[0];
+ }
+ if (SDL_BYTESPERPIXEL(format) == 0) {
+ SDL_SetError("Invalid texture format");
+ return NULL;
+ }
+ if (SDL_ISPIXELFORMAT_INDEXED(format)) {
+ SDL_SetError("Palettized textures are not supported");
+ return NULL;
+ }
+ if (w <= 0 || h <= 0) {
+ SDL_SetError("Texture dimensions can't be 0");
+ return NULL;
+ }
+ if ((renderer->info.max_texture_width && w > renderer->info.max_texture_width) ||
+ (renderer->info.max_texture_height && h > renderer->info.max_texture_height)) {
+ SDL_SetError("Texture dimensions are limited to %dx%d", renderer->info.max_texture_width, renderer->info.max_texture_height);
+ return NULL;
+ }
+ texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
+ if (!texture) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ texture->magic = &texture_magic;
+ texture->format = format;
+ texture->access = access;
+ texture->w = w;
+ texture->h = h;
+ texture->r = 255;
+ texture->g = 255;
+ texture->b = 255;
+ texture->a = 255;
+ texture->renderer = renderer;
+ texture->next = renderer->textures;
+ if (renderer->textures) {
+ renderer->textures->prev = texture;
+ }
+ renderer->textures = texture;
+
+ if (IsSupportedFormat(renderer, format)) {
+ if (renderer->CreateTexture(renderer, texture) < 0) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ } else {
+ texture->native = SDL_CreateTexture(renderer,
+ GetClosestSupportedFormat(renderer, format),
+ access, w, h);
+ if (!texture->native) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+
+ /* Swap textures to have texture before texture->native in the list */
+ texture->native->next = texture->next;
+ if (texture->native->next) {
+ texture->native->next->prev = texture->native;
+ }
+ texture->prev = texture->native->prev;
+ if (texture->prev) {
+ texture->prev->next = texture;
+ }
+ texture->native->prev = texture;
+ texture->next = texture->native;
+ renderer->textures = texture;
+
+ if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
+ texture->yuv = SDL_SW_CreateYUVTexture(format, w, h);
+ if (!texture->yuv) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ } else if (access == SDL_TEXTUREACCESS_STREAMING) {
+ /* The pitch is 4 byte aligned */
+ texture->pitch = (((w * SDL_BYTESPERPIXEL(format)) + 3) & ~3);
+ texture->pixels = SDL_calloc(1, texture->pitch * h);
+ if (!texture->pixels) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ }
+ }
+ return texture;
+}
+
+SDL_Texture *
+SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
+{
+ const SDL_PixelFormat *fmt;
+ SDL_bool needAlpha;
+ Uint32 i;
+ Uint32 format;
+ SDL_Texture *texture;
+
+ CHECK_RENDERER_MAGIC(renderer, NULL);
+
+ if (!surface) {
+ SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface");
+ return NULL;
+ }
+
+ /* See what the best texture format is */
+ fmt = surface->format;
+ if (fmt->Amask || SDL_GetColorKey(surface, NULL) == 0) {
+ needAlpha = SDL_TRUE;
+ } else {
+ needAlpha = SDL_FALSE;
+ }
+ format = renderer->info.texture_formats[0];
+ for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+ if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
+ SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
+ format = renderer->info.texture_formats[i];
+ break;
+ }
+ }
+
+ texture = SDL_CreateTexture(renderer, format, SDL_TEXTUREACCESS_STATIC,
+ surface->w, surface->h);
+ if (!texture) {
+ return NULL;
+ }
+
+ if (format == surface->format->format) {
+ if (SDL_MUSTLOCK(surface)) {
+ SDL_LockSurface(surface);
+ SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
+ SDL_UnlockSurface(surface);
+ } else {
+ SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
+ }
+ } else {
+ SDL_PixelFormat *dst_fmt;
+ SDL_Surface *temp = NULL;
+
+ /* Set up a destination surface for the texture update */
+ dst_fmt = SDL_AllocFormat(format);
+ if (!dst_fmt) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ temp = SDL_ConvertSurface(surface, dst_fmt, 0);
+ SDL_FreeFormat(dst_fmt);
+ if (temp) {
+ SDL_UpdateTexture(texture, NULL, temp->pixels, temp->pitch);
+ SDL_FreeSurface(temp);
+ } else {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ }
+
+ {
+ Uint8 r, g, b, a;
+ SDL_BlendMode blendMode;
+
+ SDL_GetSurfaceColorMod(surface, &r, &g, &b);
+ SDL_SetTextureColorMod(texture, r, g, b);
+
+ SDL_GetSurfaceAlphaMod(surface, &a);
+ SDL_SetTextureAlphaMod(texture, a);
+
+ if (SDL_GetColorKey(surface, NULL) == 0) {
+ /* We converted to a texture with alpha format */
+ SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
+ } else {
+ SDL_GetSurfaceBlendMode(surface, &blendMode);
+ SDL_SetTextureBlendMode(texture, blendMode);
+ }
+ }
+ return texture;
+}
+
+int
+SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access,
+ int *w, int *h)
+{
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (format) {
+ *format = texture->format;
+ }
+ if (access) {
+ *access = texture->access;
+ }
+ if (w) {
+ *w = texture->w;
+ }
+ if (h) {
+ *h = texture->h;
+ }
+ return 0;
+}
+
+int
+SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ renderer = texture->renderer;
+ if (r < 255 || g < 255 || b < 255) {
+ texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
+ } else {
+ texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;
+ }
+ texture->r = r;
+ texture->g = g;
+ texture->b = b;
+ if (texture->native) {
+ return SDL_SetTextureColorMod(texture->native, r, g, b);
+ } else if (renderer->SetTextureColorMod) {
+ return renderer->SetTextureColorMod(renderer, texture);
+ } else {
+ return 0;
+ }
+}
+
+int
+SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g,
+ Uint8 * b)
+{
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (r) {
+ *r = texture->r;
+ }
+ if (g) {
+ *g = texture->g;
+ }
+ if (b) {
+ *b = texture->b;
+ }
+ return 0;
+}
+
+int
+SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ renderer = texture->renderer;
+ if (alpha < 255) {
+ texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
+ } else {
+ texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
+ }
+ texture->a = alpha;
+ if (texture->native) {
+ return SDL_SetTextureAlphaMod(texture->native, alpha);
+ } else if (renderer->SetTextureAlphaMod) {
+ return renderer->SetTextureAlphaMod(renderer, texture);
+ } else {
+ return 0;
+ }
+}
+
+int
+SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha)
+{
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (alpha) {
+ *alpha = texture->a;
+ }
+ return 0;
+}
+
+int
+SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ renderer = texture->renderer;
+ if (!IsSupportedBlendMode(renderer, blendMode)) {
+ return SDL_Unsupported();
+ }
+ texture->blendMode = blendMode;
+ if (texture->native) {
+ return SDL_SetTextureBlendMode(texture->native, blendMode);
+ } else if (renderer->SetTextureBlendMode) {
+ return renderer->SetTextureBlendMode(renderer, texture);
+ } else {
+ return 0;
+ }
+}
+
+int
+SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode)
+{
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (blendMode) {
+ *blendMode = texture->blendMode;
+ }
+ return 0;
+}
+
+static int
+SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
+ const void *pixels, int pitch)
+{
+ SDL_Texture *native = texture->native;
+ SDL_Rect full_rect;
+
+ if (SDL_SW_UpdateYUVTexture(texture->yuv, rect, pixels, pitch) < 0) {
+ return -1;
+ }
+
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ /* We can lock the texture and copy to it */
+ void *native_pixels = NULL;
+ int native_pitch = 0;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return -1;
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
+ rect->w, rect->h, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+ } else {
+ /* Use a temporary buffer for updating */
+ const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
+ const size_t alloclen = rect->h * temp_pitch;
+ if (alloclen > 0) {
+ void *temp_pixels = SDL_malloc(alloclen);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
+ rect->w, rect->h, temp_pixels, temp_pitch);
+ SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
+ SDL_free(temp_pixels);
+ }
+ }
+ return 0;
+}
+
+static int
+SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
+ const void *pixels, int pitch)
+{
+ SDL_Texture *native = texture->native;
+
+ if (!rect->w || !rect->h) {
+ return 0; /* nothing to do. */
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ /* We can lock the texture and copy to it */
+ void *native_pixels = NULL;
+ int native_pitch = 0;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return -1;
+ }
+ SDL_ConvertPixels(rect->w, rect->h,
+ texture->format, pixels, pitch,
+ native->format, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+ } else {
+ /* Use a temporary buffer for updating */
+ const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
+ const size_t alloclen = rect->h * temp_pitch;
+ if (alloclen > 0) {
+ void *temp_pixels = SDL_malloc(alloclen);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+ SDL_ConvertPixels(rect->w, rect->h,
+ texture->format, pixels, pitch,
+ native->format, temp_pixels, temp_pitch);
+ SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
+ SDL_free(temp_pixels);
+ }
+ }
+ return 0;
+}
+
+int
+SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
+ const void *pixels, int pitch)
+{
+ SDL_Renderer *renderer;
+ SDL_Rect full_rect;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (!pixels) {
+ return SDL_InvalidParamError("pixels");
+ }
+ if (!pitch) {
+ return SDL_InvalidParamError("pitch");
+ }
+
+ if (!rect) {
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+ }
+
+ if ((rect->w == 0) || (rect->h == 0)) {
+ return 0; /* nothing to do. */
+ } else if (texture->yuv) {
+ return SDL_UpdateTextureYUV(texture, rect, pixels, pitch);
+ } else if (texture->native) {
+ return SDL_UpdateTextureNative(texture, rect, pixels, pitch);
+ } else {
+ renderer = texture->renderer;
+ return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
+ }
+}
+
+static int
+SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ SDL_Texture *native = texture->native;
+ SDL_Rect full_rect;
+
+ if (SDL_SW_UpdateYUVTexturePlanar(texture->yuv, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch) < 0) {
+ return -1;
+ }
+
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+
+ if (!rect->w || !rect->h) {
+ return 0; /* nothing to do. */
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ /* We can lock the texture and copy to it */
+ void *native_pixels = NULL;
+ int native_pitch = 0;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return -1;
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
+ rect->w, rect->h, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+ } else {
+ /* Use a temporary buffer for updating */
+ const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
+ const size_t alloclen = rect->h * temp_pitch;
+ if (alloclen > 0) {
+ void *temp_pixels = SDL_malloc(alloclen);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
+ rect->w, rect->h, temp_pixels, temp_pitch);
+ SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
+ SDL_free(temp_pixels);
+ }
+ }
+ return 0;
+}
+
+int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ SDL_Renderer *renderer;
+ SDL_Rect full_rect;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (!Yplane) {
+ return SDL_InvalidParamError("Yplane");
+ }
+ if (!Ypitch) {
+ return SDL_InvalidParamError("Ypitch");
+ }
+ if (!Uplane) {
+ return SDL_InvalidParamError("Uplane");
+ }
+ if (!Upitch) {
+ return SDL_InvalidParamError("Upitch");
+ }
+ if (!Vplane) {
+ return SDL_InvalidParamError("Vplane");
+ }
+ if (!Vpitch) {
+ return SDL_InvalidParamError("Vpitch");
+ }
+
+ if (texture->format != SDL_PIXELFORMAT_YV12 &&
+ texture->format != SDL_PIXELFORMAT_IYUV) {
+ return SDL_SetError("Texture format must by YV12 or IYUV");
+ }
+
+ if (!rect) {
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+ }
+
+ if (!rect->w || !rect->h) {
+ return 0; /* nothing to do. */
+ }
+
+ if (texture->yuv) {
+ return SDL_UpdateTextureYUVPlanar(texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
+ } else {
+ SDL_assert(!texture->native);
+ renderer = texture->renderer;
+ SDL_assert(renderer->UpdateTextureYUV);
+ if (renderer->UpdateTextureYUV) {
+ return renderer->UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
+ } else {
+ return SDL_Unsupported();
+ }
+ }
+}
+
+static int
+SDL_LockTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
+ void **pixels, int *pitch)
+{
+ return SDL_SW_LockYUVTexture(texture->yuv, rect, pixels, pitch);
+}
+
+static int
+SDL_LockTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
+ void **pixels, int *pitch)
+{
+ texture->locked_rect = *rect;
+ *pixels = (void *) ((Uint8 *) texture->pixels +
+ rect->y * texture->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = texture->pitch;
+ return 0;
+}
+
+int
+SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect,
+ void **pixels, int *pitch)
+{
+ SDL_Renderer *renderer;
+ SDL_Rect full_rect;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
+ return SDL_SetError("SDL_LockTexture(): texture must be streaming");
+ }
+
+ if (!rect) {
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+ }
+
+ if (texture->yuv) {
+ return SDL_LockTextureYUV(texture, rect, pixels, pitch);
+ } else if (texture->native) {
+ return SDL_LockTextureNative(texture, rect, pixels, pitch);
+ } else {
+ renderer = texture->renderer;
+ return renderer->LockTexture(renderer, texture, rect, pixels, pitch);
+ }
+}
+
+static void
+SDL_UnlockTextureYUV(SDL_Texture * texture)
+{
+ SDL_Texture *native = texture->native;
+ void *native_pixels = NULL;
+ int native_pitch = 0;
+ SDL_Rect rect;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = texture->w;
+ rect.h = texture->h;
+
+ if (SDL_LockTexture(native, &rect, &native_pixels, &native_pitch) < 0) {
+ return;
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, &rect, native->format,
+ rect.w, rect.h, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+}
+
+static void
+SDL_UnlockTextureNative(SDL_Texture * texture)
+{
+ SDL_Texture *native = texture->native;
+ void *native_pixels = NULL;
+ int native_pitch = 0;
+ const SDL_Rect *rect = &texture->locked_rect;
+ const void* pixels = (void *) ((Uint8 *) texture->pixels +
+ rect->y * texture->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ int pitch = texture->pitch;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return;
+ }
+ SDL_ConvertPixels(rect->w, rect->h,
+ texture->format, pixels, pitch,
+ native->format, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+}
+
+void
+SDL_UnlockTexture(SDL_Texture * texture)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, );
+
+ if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
+ return;
+ }
+ if (texture->yuv) {
+ SDL_UnlockTextureYUV(texture);
+ } else if (texture->native) {
+ SDL_UnlockTextureNative(texture);
+ } else {
+ renderer = texture->renderer;
+ renderer->UnlockTexture(renderer, texture);
+ }
+}
+
+SDL_bool
+SDL_RenderTargetSupported(SDL_Renderer *renderer)
+{
+ if (!renderer || !renderer->SetRenderTarget) {
+ return SDL_FALSE;
+ }
+ return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0;
+}
+
+int
+SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
+{
+ if (!SDL_RenderTargetSupported(renderer)) {
+ return SDL_Unsupported();
+ }
+ if (texture == renderer->target) {
+ /* Nothing to do! */
+ return 0;
+ }
+
+ /* texture == NULL is valid and means reset the target to the window */
+ if (texture) {
+ CHECK_TEXTURE_MAGIC(texture, -1);
+ if (renderer != texture->renderer) {
+ return SDL_SetError("Texture was not created with this renderer");
+ }
+ if (texture->access != SDL_TEXTUREACCESS_TARGET) {
+ return SDL_SetError("Texture not created with SDL_TEXTUREACCESS_TARGET");
+ }
+ if (texture->native) {
+ /* Always render to the native texture */
+ texture = texture->native;
+ }
+ }
+
+ if (texture && !renderer->target) {
+ /* Make a backup of the viewport */
+ renderer->viewport_backup = renderer->viewport;
+ renderer->clip_rect_backup = renderer->clip_rect;
+ renderer->clipping_enabled_backup = renderer->clipping_enabled;
+ renderer->scale_backup = renderer->scale;
+ renderer->logical_w_backup = renderer->logical_w;
+ renderer->logical_h_backup = renderer->logical_h;
+ }
+ renderer->target = texture;
+
+ if (renderer->SetRenderTarget(renderer, texture) < 0) {
+ return -1;
+ }
+
+ if (texture) {
+ renderer->viewport.x = 0;
+ renderer->viewport.y = 0;
+ renderer->viewport.w = texture->w;
+ renderer->viewport.h = texture->h;
+ SDL_zero(renderer->clip_rect);
+ renderer->clipping_enabled = SDL_FALSE;
+ renderer->scale.x = 1.0f;
+ renderer->scale.y = 1.0f;
+ renderer->logical_w = texture->w;
+ renderer->logical_h = texture->h;
+ } else {
+ renderer->viewport = renderer->viewport_backup;
+ renderer->clip_rect = renderer->clip_rect_backup;
+ renderer->clipping_enabled = renderer->clipping_enabled_backup;
+ renderer->scale = renderer->scale_backup;
+ renderer->logical_w = renderer->logical_w_backup;
+ renderer->logical_h = renderer->logical_h_backup;
+ }
+ if (renderer->UpdateViewport(renderer) < 0) {
+ return -1;
+ }
+ if (renderer->UpdateClipRect(renderer) < 0) {
+ return -1;
+ }
+
+ /* All set! */
+ return 0;
+}
+
+SDL_Texture *
+SDL_GetRenderTarget(SDL_Renderer *renderer)
+{
+ return renderer->target;
+}
+
+static int
+UpdateLogicalSize(SDL_Renderer *renderer)
+{
+ int w = 1, h = 1;
+ float want_aspect;
+ float real_aspect;
+ float scale;
+ SDL_Rect viewport;
+ /* 0 is for letterbox, 1 is for overscan */
+ int scale_policy = 0;
+ const char *hint;
+
+ if (!renderer->logical_w || !renderer->logical_h) {
+ return 0;
+ }
+ if (SDL_GetRendererOutputSize(renderer, &w, &h) < 0) {
+ return -1;
+ }
+
+ hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE);
+ if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) {
+ SDL_bool overscan_supported = SDL_TRUE;
+ /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers
+ which the overscan implementation relies on.
+ */
+ if (SDL_strcasecmp(SDL_GetCurrentVideoDriver(), "direct3d") == 0) {
+ overscan_supported = SDL_FALSE;
+ }
+ if (overscan_supported) {
+ scale_policy = 1;
+ }
+ }
+
+ want_aspect = (float)renderer->logical_w / renderer->logical_h;
+ real_aspect = (float)w / h;
+
+ /* Clear the scale because we're setting viewport in output coordinates */
+ SDL_RenderSetScale(renderer, 1.0f, 1.0f);
+
+ if (renderer->integer_scale) {
+ if (want_aspect > real_aspect) {
+ scale = (float)(w / renderer->logical_w);
+ } else {
+ scale = (float)(h / renderer->logical_h);
+ }
+ viewport.w = (int)SDL_ceil(renderer->logical_w * scale);
+ viewport.x = (w - viewport.w) / 2;
+ viewport.h = (int)SDL_ceil(renderer->logical_h * scale);
+ viewport.y = (h - viewport.h) / 2;
+
+ SDL_RenderSetViewport(renderer, &viewport);
+ } else if (SDL_fabs(want_aspect-real_aspect) < 0.0001) {
+ /* The aspect ratios are the same, just scale appropriately */
+ scale = (float)w / renderer->logical_w;
+ SDL_RenderSetViewport(renderer, NULL);
+ } else if (want_aspect > real_aspect) {
+ if (scale_policy == 1) {
+ /* We want a wider aspect ratio than is available -
+ zoom so logical height matches the real height
+ and the width will grow off the screen
+ */
+ scale = (float)h / renderer->logical_h;
+ viewport.y = 0;
+ viewport.h = h;
+ viewport.w = (int)SDL_ceil(renderer->logical_w * scale);
+ viewport.x = (w - viewport.w) / 2;
+ SDL_RenderSetViewport(renderer, &viewport);
+ } else {
+ /* We want a wider aspect ratio than is available - letterbox it */
+ scale = (float)w / renderer->logical_w;
+ viewport.x = 0;
+ viewport.w = w;
+ viewport.h = (int)SDL_ceil(renderer->logical_h * scale);
+ viewport.y = (h - viewport.h) / 2;
+ SDL_RenderSetViewport(renderer, &viewport);
+ }
+ } else {
+ if (scale_policy == 1) {
+ /* We want a narrower aspect ratio than is available -
+ zoom so logical width matches the real width
+ and the height will grow off the screen
+ */
+ scale = (float)w / renderer->logical_w;
+ viewport.x = 0;
+ viewport.w = w;
+ viewport.h = (int)SDL_ceil(renderer->logical_h * scale);
+ viewport.y = (h - viewport.h) / 2;
+ SDL_RenderSetViewport(renderer, &viewport);
+ } else {
+ /* We want a narrower aspect ratio than is available - use side-bars */
+ scale = (float)h / renderer->logical_h;
+ viewport.y = 0;
+ viewport.h = h;
+ viewport.w = (int)SDL_ceil(renderer->logical_w * scale);
+ viewport.x = (w - viewport.w) / 2;
+ SDL_RenderSetViewport(renderer, &viewport);
+ }
+ }
+
+ /* Set the new scale */
+ SDL_RenderSetScale(renderer, scale, scale);
+
+ return 0;
+}
+
+int
+SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!w || !h) {
+ /* Clear any previous logical resolution */
+ renderer->logical_w = 0;
+ renderer->logical_h = 0;
+ SDL_RenderSetViewport(renderer, NULL);
+ SDL_RenderSetScale(renderer, 1.0f, 1.0f);
+ return 0;
+ }
+
+ renderer->logical_w = w;
+ renderer->logical_h = h;
+
+ return UpdateLogicalSize(renderer);
+}
+
+void
+SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h)
+{
+ CHECK_RENDERER_MAGIC(renderer, );
+
+ if (w) {
+ *w = renderer->logical_w;
+ }
+ if (h) {
+ *h = renderer->logical_h;
+ }
+}
+
+int
+SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ renderer->integer_scale = enable;
+
+ return UpdateLogicalSize(renderer);
+}
+
+SDL_bool
+SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, SDL_FALSE);
+
+ return renderer->integer_scale;
+}
+
+int
+SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (rect) {
+ renderer->viewport.x = (int)SDL_floor(rect->x * renderer->scale.x);
+ renderer->viewport.y = (int)SDL_floor(rect->y * renderer->scale.y);
+ renderer->viewport.w = (int)SDL_ceil(rect->w * renderer->scale.x);
+ renderer->viewport.h = (int)SDL_ceil(rect->h * renderer->scale.y);
+ } else {
+ renderer->viewport.x = 0;
+ renderer->viewport.y = 0;
+ if (SDL_GetRendererOutputSize(renderer, &renderer->viewport.w, &renderer->viewport.h) < 0) {
+ return -1;
+ }
+ }
+ return renderer->UpdateViewport(renderer);
+}
+
+void
+SDL_RenderGetViewport(SDL_Renderer * renderer, SDL_Rect * rect)
+{
+ CHECK_RENDERER_MAGIC(renderer, );
+
+ if (rect) {
+ rect->x = (int)(renderer->viewport.x / renderer->scale.x);
+ rect->y = (int)(renderer->viewport.y / renderer->scale.y);
+ rect->w = (int)(renderer->viewport.w / renderer->scale.x);
+ rect->h = (int)(renderer->viewport.h / renderer->scale.y);
+ }
+}
+
+int
+SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1)
+
+ if (rect) {
+ renderer->clipping_enabled = SDL_TRUE;
+ renderer->clip_rect.x = (int)SDL_floor(rect->x * renderer->scale.x);
+ renderer->clip_rect.y = (int)SDL_floor(rect->y * renderer->scale.y);
+ renderer->clip_rect.w = (int)SDL_ceil(rect->w * renderer->scale.x);
+ renderer->clip_rect.h = (int)SDL_ceil(rect->h * renderer->scale.y);
+ } else {
+ renderer->clipping_enabled = SDL_FALSE;
+ SDL_zero(renderer->clip_rect);
+ }
+ return renderer->UpdateClipRect(renderer);
+}
+
+void
+SDL_RenderGetClipRect(SDL_Renderer * renderer, SDL_Rect * rect)
+{
+ CHECK_RENDERER_MAGIC(renderer, )
+
+ if (rect) {
+ rect->x = (int)(renderer->clip_rect.x / renderer->scale.x);
+ rect->y = (int)(renderer->clip_rect.y / renderer->scale.y);
+ rect->w = (int)(renderer->clip_rect.w / renderer->scale.x);
+ rect->h = (int)(renderer->clip_rect.h / renderer->scale.y);
+ }
+}
+
+SDL_bool
+SDL_RenderIsClipEnabled(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, SDL_FALSE)
+ return renderer->clipping_enabled;
+}
+
+int
+SDL_RenderSetScale(SDL_Renderer * renderer, float scaleX, float scaleY)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ renderer->scale.x = scaleX;
+ renderer->scale.y = scaleY;
+ return 0;
+}
+
+void
+SDL_RenderGetScale(SDL_Renderer * renderer, float *scaleX, float *scaleY)
+{
+ CHECK_RENDERER_MAGIC(renderer, );
+
+ if (scaleX) {
+ *scaleX = renderer->scale.x;
+ }
+ if (scaleY) {
+ *scaleY = renderer->scale.y;
+ }
+}
+
+int
+SDL_SetRenderDrawColor(SDL_Renderer * renderer,
+ Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ renderer->r = r;
+ renderer->g = g;
+ renderer->b = b;
+ renderer->a = a;
+ return 0;
+}
+
+int
+SDL_GetRenderDrawColor(SDL_Renderer * renderer,
+ Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (r) {
+ *r = renderer->r;
+ }
+ if (g) {
+ *g = renderer->g;
+ }
+ if (b) {
+ *b = renderer->b;
+ }
+ if (a) {
+ *a = renderer->a;
+ }
+ return 0;
+}
+
+int
+SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!IsSupportedBlendMode(renderer, blendMode)) {
+ return SDL_Unsupported();
+ }
+ renderer->blendMode = blendMode;
+ return 0;
+}
+
+int
+SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode *blendMode)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ *blendMode = renderer->blendMode;
+ return 0;
+}
+
+int
+SDL_RenderClear(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+ return renderer->RenderClear(renderer);
+}
+
+int
+SDL_RenderDrawPoint(SDL_Renderer * renderer, int x, int y)
+{
+ SDL_Point point;
+
+ point.x = x;
+ point.y = y;
+ return SDL_RenderDrawPoints(renderer, &point, 1);
+}
+
+static int
+RenderDrawPointsWithRects(SDL_Renderer * renderer,
+ const SDL_Point * points, int count)
+{
+ SDL_FRect *frects;
+ int i;
+ int status;
+
+ frects = SDL_stack_alloc(SDL_FRect, count);
+ if (!frects) {
+ return SDL_OutOfMemory();
+ }
+ for (i = 0; i < count; ++i) {
+ frects[i].x = points[i].x * renderer->scale.x;
+ frects[i].y = points[i].y * renderer->scale.y;
+ frects[i].w = renderer->scale.x;
+ frects[i].h = renderer->scale.y;
+ }
+
+ status = renderer->RenderFillRects(renderer, frects, count);
+
+ SDL_stack_free(frects);
+
+ return status;
+}
+
+int
+SDL_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_Point * points, int count)
+{
+ SDL_FPoint *fpoints;
+ int i;
+ int status;
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!points) {
+ return SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points");
+ }
+ if (count < 1) {
+ return 0;
+ }
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+
+ if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) {
+ return RenderDrawPointsWithRects(renderer, points, count);
+ }
+
+ fpoints = SDL_stack_alloc(SDL_FPoint, count);
+ if (!fpoints) {
+ return SDL_OutOfMemory();
+ }
+ for (i = 0; i < count; ++i) {
+ fpoints[i].x = points[i].x * renderer->scale.x;
+ fpoints[i].y = points[i].y * renderer->scale.y;
+ }
+
+ status = renderer->RenderDrawPoints(renderer, fpoints, count);
+
+ SDL_stack_free(fpoints);
+
+ return status;
+}
+
+int
+SDL_RenderDrawLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
+{
+ SDL_Point points[2];
+
+ points[0].x = x1;
+ points[0].y = y1;
+ points[1].x = x2;
+ points[1].y = y2;
+ return SDL_RenderDrawLines(renderer, points, 2);
+}
+
+static int
+RenderDrawLinesWithRects(SDL_Renderer * renderer,
+ const SDL_Point * points, int count)
+{
+ SDL_FRect *frect;
+ SDL_FRect *frects;
+ SDL_FPoint fpoints[2];
+ int i, nrects;
+ int status;
+
+ frects = SDL_stack_alloc(SDL_FRect, count-1);
+ if (!frects) {
+ return SDL_OutOfMemory();
+ }
+
+ status = 0;
+ nrects = 0;
+ for (i = 0; i < count-1; ++i) {
+ if (points[i].x == points[i+1].x) {
+ int minY = SDL_min(points[i].y, points[i+1].y);
+ int maxY = SDL_max(points[i].y, points[i+1].y);
+
+ frect = &frects[nrects++];
+ frect->x = points[i].x * renderer->scale.x;
+ frect->y = minY * renderer->scale.y;
+ frect->w = renderer->scale.x;
+ frect->h = (maxY - minY + 1) * renderer->scale.y;
+ } else if (points[i].y == points[i+1].y) {
+ int minX = SDL_min(points[i].x, points[i+1].x);
+ int maxX = SDL_max(points[i].x, points[i+1].x);
+
+ frect = &frects[nrects++];
+ frect->x = minX * renderer->scale.x;
+ frect->y = points[i].y * renderer->scale.y;
+ frect->w = (maxX - minX + 1) * renderer->scale.x;
+ frect->h = renderer->scale.y;
+ } else {
+ /* FIXME: We can't use a rect for this line... */
+ fpoints[0].x = points[i].x * renderer->scale.x;
+ fpoints[0].y = points[i].y * renderer->scale.y;
+ fpoints[1].x = points[i+1].x * renderer->scale.x;
+ fpoints[1].y = points[i+1].y * renderer->scale.y;
+ status += renderer->RenderDrawLines(renderer, fpoints, 2);
+ }
+ }
+
+ status += renderer->RenderFillRects(renderer, frects, nrects);
+
+ SDL_stack_free(frects);
+
+ if (status < 0) {
+ status = -1;
+ }
+ return status;
+}
+
+int
+SDL_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_Point * points, int count)
+{
+ SDL_FPoint *fpoints;
+ int i;
+ int status;
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!points) {
+ return SDL_SetError("SDL_RenderDrawLines(): Passed NULL points");
+ }
+ if (count < 2) {
+ return 0;
+ }
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+
+ if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) {
+ return RenderDrawLinesWithRects(renderer, points, count);
+ }
+
+ fpoints = SDL_stack_alloc(SDL_FPoint, count);
+ if (!fpoints) {
+ return SDL_OutOfMemory();
+ }
+ for (i = 0; i < count; ++i) {
+ fpoints[i].x = points[i].x * renderer->scale.x;
+ fpoints[i].y = points[i].y * renderer->scale.y;
+ }
+
+ status = renderer->RenderDrawLines(renderer, fpoints, count);
+
+ SDL_stack_free(fpoints);
+
+ return status;
+}
+
+int
+SDL_RenderDrawRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+ SDL_Rect full_rect;
+ SDL_Point points[5];
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ /* If 'rect' == NULL, then outline the whole surface */
+ if (!rect) {
+ SDL_RenderGetViewport(renderer, &full_rect);
+ full_rect.x = 0;
+ full_rect.y = 0;
+ rect = &full_rect;
+ }
+
+ points[0].x = rect->x;
+ points[0].y = rect->y;
+ points[1].x = rect->x+rect->w-1;
+ points[1].y = rect->y;
+ points[2].x = rect->x+rect->w-1;
+ points[2].y = rect->y+rect->h-1;
+ points[3].x = rect->x;
+ points[3].y = rect->y+rect->h-1;
+ points[4].x = rect->x;
+ points[4].y = rect->y;
+ return SDL_RenderDrawLines(renderer, points, 5);
+}
+
+int
+SDL_RenderDrawRects(SDL_Renderer * renderer,
+ const SDL_Rect * rects, int count)
+{
+ int i;
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!rects) {
+ return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects");
+ }
+ if (count < 1) {
+ return 0;
+ }
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+
+ for (i = 0; i < count; ++i) {
+ if (SDL_RenderDrawRect(renderer, &rects[i]) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int
+SDL_RenderFillRect(SDL_Renderer * renderer, const SDL_Rect * rect)
+{
+ SDL_Rect full_rect = { 0, 0, 0, 0 };
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ /* If 'rect' == NULL, then outline the whole surface */
+ if (!rect) {
+ SDL_RenderGetViewport(renderer, &full_rect);
+ full_rect.x = 0;
+ full_rect.y = 0;
+ rect = &full_rect;
+ }
+ return SDL_RenderFillRects(renderer, rect, 1);
+}
+
+int
+SDL_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_Rect * rects, int count)
+{
+ SDL_FRect *frects;
+ int i;
+ int status;
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!rects) {
+ return SDL_SetError("SDL_RenderFillRects(): Passed NULL rects");
+ }
+ if (count < 1) {
+ return 0;
+ }
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+
+ frects = SDL_stack_alloc(SDL_FRect, count);
+ if (!frects) {
+ return SDL_OutOfMemory();
+ }
+ for (i = 0; i < count; ++i) {
+ frects[i].x = rects[i].x * renderer->scale.x;
+ frects[i].y = rects[i].y * renderer->scale.y;
+ frects[i].w = rects[i].w * renderer->scale.x;
+ frects[i].h = rects[i].h * renderer->scale.y;
+ }
+
+ status = renderer->RenderFillRects(renderer, frects, count);
+
+ SDL_stack_free(frects);
+
+ return status;
+}
+
+int
+SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_Rect * dstrect)
+{
+ SDL_Rect real_srcrect = { 0, 0, 0, 0 };
+ SDL_Rect real_dstrect = { 0, 0, 0, 0 };
+ SDL_FRect frect;
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (renderer != texture->renderer) {
+ return SDL_SetError("Texture was not created with this renderer");
+ }
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+
+ real_srcrect.x = 0;
+ real_srcrect.y = 0;
+ real_srcrect.w = texture->w;
+ real_srcrect.h = texture->h;
+ if (srcrect) {
+ if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) {
+ return 0;
+ }
+ }
+
+ SDL_RenderGetViewport(renderer, &real_dstrect);
+ real_dstrect.x = 0;
+ real_dstrect.y = 0;
+ if (dstrect) {
+ if (!SDL_HasIntersection(dstrect, &real_dstrect)) {
+ return 0;
+ }
+ real_dstrect = *dstrect;
+ }
+
+ if (texture->native) {
+ texture = texture->native;
+ }
+
+ frect.x = real_dstrect.x * renderer->scale.x;
+ frect.y = real_dstrect.y * renderer->scale.y;
+ frect.w = real_dstrect.w * renderer->scale.x;
+ frect.h = real_dstrect.h * renderer->scale.y;
+
+ return renderer->RenderCopy(renderer, texture, &real_srcrect, &frect);
+}
+
+
+int
+SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_Rect * dstrect,
+ const double angle, const SDL_Point *center, const SDL_RendererFlip flip)
+{
+ SDL_Rect real_srcrect = { 0, 0, 0, 0 };
+ SDL_Rect real_dstrect = { 0, 0, 0, 0 };
+ SDL_Point real_center;
+ SDL_FRect frect;
+ SDL_FPoint fcenter;
+
+ if (flip == SDL_FLIP_NONE && (int)(angle/360) == angle/360) { /* fast path when we don't need rotation or flipping */
+ return SDL_RenderCopy(renderer, texture, srcrect, dstrect);
+ }
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+ CHECK_TEXTURE_MAGIC(texture, -1);
+
+ if (renderer != texture->renderer) {
+ return SDL_SetError("Texture was not created with this renderer");
+ }
+ if (!renderer->RenderCopyEx) {
+ return SDL_SetError("Renderer does not support RenderCopyEx");
+ }
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return 0;
+ }
+
+ real_srcrect.x = 0;
+ real_srcrect.y = 0;
+ real_srcrect.w = texture->w;
+ real_srcrect.h = texture->h;
+ if (srcrect) {
+ if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) {
+ return 0;
+ }
+ }
+
+ /* We don't intersect the dstrect with the viewport as RenderCopy does because of potential rotation clipping issues... TODO: should we? */
+ if (dstrect) {
+ real_dstrect = *dstrect;
+ } else {
+ SDL_RenderGetViewport(renderer, &real_dstrect);
+ real_dstrect.x = 0;
+ real_dstrect.y = 0;
+ }
+
+ if (texture->native) {
+ texture = texture->native;
+ }
+
+ if (center) {
+ real_center = *center;
+ } else {
+ real_center.x = real_dstrect.w/2;
+ real_center.y = real_dstrect.h/2;
+ }
+
+ frect.x = real_dstrect.x * renderer->scale.x;
+ frect.y = real_dstrect.y * renderer->scale.y;
+ frect.w = real_dstrect.w * renderer->scale.x;
+ frect.h = real_dstrect.h * renderer->scale.y;
+
+ fcenter.x = real_center.x * renderer->scale.x;
+ fcenter.y = real_center.y * renderer->scale.y;
+
+ return renderer->RenderCopyEx(renderer, texture, &real_srcrect, &frect, angle, &fcenter, flip);
+}
+
+int
+SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch)
+{
+ SDL_Rect real_rect;
+
+ CHECK_RENDERER_MAGIC(renderer, -1);
+
+ if (!renderer->RenderReadPixels) {
+ return SDL_Unsupported();
+ }
+
+ if (!format) {
+ format = SDL_GetWindowPixelFormat(renderer->window);
+ }
+
+ real_rect.x = renderer->viewport.x;
+ real_rect.y = renderer->viewport.y;
+ real_rect.w = renderer->viewport.w;
+ real_rect.h = renderer->viewport.h;
+ if (rect) {
+ if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
+ return 0;
+ }
+ if (real_rect.y > rect->y) {
+ pixels = (Uint8 *)pixels + pitch * (real_rect.y - rect->y);
+ }
+ if (real_rect.x > rect->x) {
+ int bpp = SDL_BYTESPERPIXEL(format);
+ pixels = (Uint8 *)pixels + bpp * (real_rect.x - rect->x);
+ }
+ }
+
+ return renderer->RenderReadPixels(renderer, &real_rect,
+ format, pixels, pitch);
+}
+
+void
+SDL_RenderPresent(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, );
+
+ /* Don't draw while we're hidden */
+ if (renderer->hidden) {
+ return;
+ }
+ renderer->RenderPresent(renderer);
+}
+
+void
+SDL_DestroyTexture(SDL_Texture * texture)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, );
+
+ renderer = texture->renderer;
+ if (texture == renderer->target) {
+ SDL_SetRenderTarget(renderer, NULL);
+ }
+
+ texture->magic = NULL;
+
+ if (texture->next) {
+ texture->next->prev = texture->prev;
+ }
+ if (texture->prev) {
+ texture->prev->next = texture->next;
+ } else {
+ renderer->textures = texture->next;
+ }
+
+ if (texture->native) {
+ SDL_DestroyTexture(texture->native);
+ }
+ if (texture->yuv) {
+ SDL_SW_DestroyYUVTexture(texture->yuv);
+ }
+ SDL_free(texture->pixels);
+
+ renderer->DestroyTexture(renderer, texture);
+ SDL_free(texture);
+}
+
+void
+SDL_DestroyRenderer(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, );
+
+ SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
+
+ /* Free existing textures for this renderer */
+ while (renderer->textures) {
+ SDL_Texture *tex = renderer->textures; (void) tex;
+ SDL_DestroyTexture(renderer->textures);
+ SDL_assert(tex != renderer->textures); /* satisfy static analysis. */
+ }
+
+ if (renderer->window) {
+ SDL_SetWindowData(renderer->window, SDL_WINDOWRENDERDATA, NULL);
+ }
+
+ /* It's no longer magical... */
+ renderer->magic = NULL;
+
+ /* Free the renderer instance */
+ renderer->DestroyRenderer(renderer);
+}
+
+int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+ renderer = texture->renderer;
+ if (texture->native) {
+ return SDL_GL_BindTexture(texture->native, texw, texh);
+ } else if (renderer && renderer->GL_BindTexture) {
+ return renderer->GL_BindTexture(renderer, texture, texw, texh);
+ } else {
+ return SDL_Unsupported();
+ }
+}
+
+int SDL_GL_UnbindTexture(SDL_Texture *texture)
+{
+ SDL_Renderer *renderer;
+
+ CHECK_TEXTURE_MAGIC(texture, -1);
+ renderer = texture->renderer;
+ if (texture->native) {
+ return SDL_GL_UnbindTexture(texture->native);
+ } else if (renderer && renderer->GL_UnbindTexture) {
+ return renderer->GL_UnbindTexture(renderer, texture);
+ }
+
+ return SDL_Unsupported();
+}
+
+void *
+SDL_RenderGetMetalLayer(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, NULL);
+
+ if (renderer->GetMetalLayer) {
+ return renderer->GetMetalLayer(renderer);
+ }
+ return NULL;
+}
+
+void *
+SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer)
+{
+ CHECK_RENDERER_MAGIC(renderer, NULL);
+
+ if (renderer->GetMetalCommandEncoder) {
+ return renderer->GetMetalCommandEncoder(renderer);
+ }
+ return NULL;
+}
+
+static SDL_BlendMode
+SDL_GetShortBlendMode(SDL_BlendMode blendMode)
+{
+ if (blendMode == SDL_BLENDMODE_NONE_FULL) {
+ return SDL_BLENDMODE_NONE;
+ }
+ if (blendMode == SDL_BLENDMODE_BLEND_FULL) {
+ return SDL_BLENDMODE_BLEND;
+ }
+ if (blendMode == SDL_BLENDMODE_ADD_FULL) {
+ return SDL_BLENDMODE_ADD;
+ }
+ if (blendMode == SDL_BLENDMODE_MOD_FULL) {
+ return SDL_BLENDMODE_MOD;
+ }
+ return blendMode;
+}
+
+static SDL_BlendMode
+SDL_GetLongBlendMode(SDL_BlendMode blendMode)
+{
+ if (blendMode == SDL_BLENDMODE_NONE) {
+ return SDL_BLENDMODE_NONE_FULL;
+ }
+ if (blendMode == SDL_BLENDMODE_BLEND) {
+ return SDL_BLENDMODE_BLEND_FULL;
+ }
+ if (blendMode == SDL_BLENDMODE_ADD) {
+ return SDL_BLENDMODE_ADD_FULL;
+ }
+ if (blendMode == SDL_BLENDMODE_MOD) {
+ return SDL_BLENDMODE_MOD_FULL;
+ }
+ return blendMode;
+}
+
+SDL_BlendMode
+SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor,
+ SDL_BlendOperation colorOperation,
+ SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor,
+ SDL_BlendOperation alphaOperation)
+{
+ SDL_BlendMode blendMode = SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation,
+ srcAlphaFactor, dstAlphaFactor, alphaOperation);
+ return SDL_GetShortBlendMode(blendMode);
+}
+
+SDL_BlendFactor
+SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode)
+{
+ blendMode = SDL_GetLongBlendMode(blendMode);
+ return (SDL_BlendFactor)(((Uint32)blendMode >> 4) & 0xF);
+}
+
+SDL_BlendFactor
+SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode)
+{
+ blendMode = SDL_GetLongBlendMode(blendMode);
+ return (SDL_BlendFactor)(((Uint32)blendMode >> 8) & 0xF);
+}
+
+SDL_BlendOperation
+SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode)
+{
+ blendMode = SDL_GetLongBlendMode(blendMode);
+ return (SDL_BlendOperation)(((Uint32)blendMode >> 0) & 0xF);
+}
+
+SDL_BlendFactor
+SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode)
+{
+ blendMode = SDL_GetLongBlendMode(blendMode);
+ return (SDL_BlendFactor)(((Uint32)blendMode >> 20) & 0xF);
+}
+
+SDL_BlendFactor
+SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode)
+{
+ blendMode = SDL_GetLongBlendMode(blendMode);
+ return (SDL_BlendFactor)(((Uint32)blendMode >> 24) & 0xF);
+}
+
+SDL_BlendOperation
+SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode)
+{
+ blendMode = SDL_GetLongBlendMode(blendMode);
+ return (SDL_BlendOperation)(((Uint32)blendMode >> 16) & 0xF);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/SDL_sysrender.h b/src/3rdparty/SDL2/src/render/SDL_sysrender.h
new file mode 100644
index 0000000..f0f54c8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/SDL_sysrender.h
@@ -0,0 +1,204 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_sysrender_h_
+#define SDL_sysrender_h_
+
+#include "SDL_render.h"
+#include "SDL_events.h"
+#include "SDL_yuv_sw_c.h"
+
+/* The SDL 2D rendering system */
+
+typedef struct SDL_RenderDriver SDL_RenderDriver;
+
+typedef struct
+{
+ float x;
+ float y;
+} SDL_FPoint;
+
+typedef struct
+{
+ float x;
+ float y;
+ float w;
+ float h;
+} SDL_FRect;
+
+/* Define the SDL texture structure */
+struct SDL_Texture
+{
+ const void *magic;
+ Uint32 format; /**< The pixel format of the texture */
+ int access; /**< SDL_TextureAccess */
+ int w; /**< The width of the texture */
+ int h; /**< The height of the texture */
+ int modMode; /**< The texture modulation mode */
+ SDL_BlendMode blendMode; /**< The texture blend mode */
+ Uint8 r, g, b, a; /**< Texture modulation values */
+
+ SDL_Renderer *renderer;
+
+ /* Support for formats not supported directly by the renderer */
+ SDL_Texture *native;
+ SDL_SW_YUVTexture *yuv;
+ void *pixels;
+ int pitch;
+ SDL_Rect locked_rect;
+
+ void *driverdata; /**< Driver specific texture representation */
+
+ SDL_Texture *prev;
+ SDL_Texture *next;
+};
+
+/* Define the SDL renderer structure */
+struct SDL_Renderer
+{
+ const void *magic;
+
+ void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
+ int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h);
+ SDL_bool (*SupportsBlendMode)(SDL_Renderer * renderer, SDL_BlendMode blendMode);
+ int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+ int (*SetTextureColorMod) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*SetTextureBlendMode) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+ int (*UpdateTextureYUV) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+ int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+ void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+ int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
+ int (*UpdateViewport) (SDL_Renderer * renderer);
+ int (*UpdateClipRect) (SDL_Renderer * renderer);
+ int (*RenderClear) (SDL_Renderer * renderer);
+ int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count);
+ int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count);
+ int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_FRect * rects,
+ int count);
+ int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
+ int (*RenderCopyEx) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcquad, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
+ int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch);
+ void (*RenderPresent) (SDL_Renderer * renderer);
+ void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+
+ void (*DestroyRenderer) (SDL_Renderer * renderer);
+
+ int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
+ int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture);
+
+ void *(*GetMetalLayer) (SDL_Renderer * renderer);
+ void *(*GetMetalCommandEncoder) (SDL_Renderer * renderer);
+
+ /* The current renderer info */
+ SDL_RendererInfo info;
+
+ /* The window associated with the renderer */
+ SDL_Window *window;
+ SDL_bool hidden;
+
+ /* The logical resolution for rendering */
+ int logical_w;
+ int logical_h;
+ int logical_w_backup;
+ int logical_h_backup;
+
+ /* Whether or not to force the viewport to even integer intervals */
+ SDL_bool integer_scale;
+
+ /* The drawable area within the window */
+ SDL_Rect viewport;
+ SDL_Rect viewport_backup;
+
+ /* The clip rectangle within the window */
+ SDL_Rect clip_rect;
+ SDL_Rect clip_rect_backup;
+
+ /* Wether or not the clipping rectangle is used. */
+ SDL_bool clipping_enabled;
+ SDL_bool clipping_enabled_backup;
+
+ /* The render output coordinate scale */
+ SDL_FPoint scale;
+ SDL_FPoint scale_backup;
+
+ /* The pixel to point coordinate scale */
+ SDL_FPoint dpi_scale;
+
+ /* The list of textures */
+ SDL_Texture *textures;
+ SDL_Texture *target;
+
+ Uint8 r, g, b, a; /**< Color for drawing operations values */
+ SDL_BlendMode blendMode; /**< The drawing blend mode */
+
+ void *driverdata;
+};
+
+/* Define the SDL render driver structure */
+struct SDL_RenderDriver
+{
+ SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
+
+ /* Info about the renderer capabilities */
+ SDL_RendererInfo info;
+};
+
+/* Not all of these are available in a given build. Use #ifdefs, etc. */
+extern SDL_RenderDriver D3D_RenderDriver;
+extern SDL_RenderDriver D3D11_RenderDriver;
+extern SDL_RenderDriver GL_RenderDriver;
+extern SDL_RenderDriver GLES2_RenderDriver;
+extern SDL_RenderDriver GLES_RenderDriver;
+extern SDL_RenderDriver DirectFB_RenderDriver;
+extern SDL_RenderDriver METAL_RenderDriver;
+extern SDL_RenderDriver PSP_RenderDriver;
+extern SDL_RenderDriver SW_RenderDriver;
+
+/* Blend mode functions */
+extern SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode);
+extern SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode);
+extern SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode);
+extern SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode);
+extern SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode);
+extern SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode);
+
+#endif /* SDL_sysrender_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/SDL_yuv_sw.c b/src/3rdparty/SDL2/src/render/SDL_yuv_sw.c
new file mode 100644
index 0000000..c227cdc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/SDL_yuv_sw.c
@@ -0,0 +1,414 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* This is the software implementation of the YUV texture support */
+
+#include "SDL_assert.h"
+
+#include "SDL_yuv_sw_c.h"
+
+
+SDL_SW_YUVTexture *
+SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
+{
+ SDL_SW_YUVTexture *swdata;
+
+ switch (format) {
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_YUY2:
+ case SDL_PIXELFORMAT_UYVY:
+ case SDL_PIXELFORMAT_YVYU:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ break;
+ default:
+ SDL_SetError("Unsupported YUV format");
+ return NULL;
+ }
+
+ swdata = (SDL_SW_YUVTexture *) SDL_calloc(1, sizeof(*swdata));
+ if (!swdata) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ swdata->format = format;
+ swdata->target_format = SDL_PIXELFORMAT_UNKNOWN;
+ swdata->w = w;
+ swdata->h = h;
+ {
+ const int sz_plane = w * h;
+ const int sz_plane_chroma = ((w + 1) / 2) * ((h + 1) / 2);
+ const int sz_plane_packed = ((w + 1) / 2) * h;
+ int dst_size = 0;
+ switch(format)
+ {
+ case SDL_PIXELFORMAT_YV12: /**< Planar mode: Y + V + U (3 planes) */
+ case SDL_PIXELFORMAT_IYUV: /**< Planar mode: Y + U + V (3 planes) */
+ dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma;
+ break;
+
+ case SDL_PIXELFORMAT_YUY2: /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
+ case SDL_PIXELFORMAT_UYVY: /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
+ case SDL_PIXELFORMAT_YVYU: /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
+ dst_size = 4 * sz_plane_packed;
+ break;
+
+ case SDL_PIXELFORMAT_NV12: /**< Planar mode: Y + U/V interleaved (2 planes) */
+ case SDL_PIXELFORMAT_NV21: /**< Planar mode: Y + V/U interleaved (2 planes) */
+ dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma;
+ break;
+
+ default:
+ SDL_assert(0 && "We should never get here (caught above)");
+ break;
+ }
+ swdata->pixels = (Uint8 *) SDL_malloc(dst_size);
+ if (!swdata->pixels) {
+ SDL_SW_DestroyYUVTexture(swdata);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ }
+
+ /* Find the pitch and offset values for the texture */
+ switch (format) {
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ swdata->pitches[0] = w;
+ swdata->pitches[1] = (swdata->pitches[0] + 1) / 2;
+ swdata->pitches[2] = (swdata->pitches[0] + 1) / 2;
+ swdata->planes[0] = swdata->pixels;
+ swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h;
+ swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * ((h + 1) / 2);
+ break;
+ case SDL_PIXELFORMAT_YUY2:
+ case SDL_PIXELFORMAT_UYVY:
+ case SDL_PIXELFORMAT_YVYU:
+ swdata->pitches[0] = ((w + 1) / 2) * 4;
+ swdata->planes[0] = swdata->pixels;
+ break;
+
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ swdata->pitches[0] = w;
+ swdata->pitches[1] = 2 * ((swdata->pitches[0] + 1) / 2);
+ swdata->planes[0] = swdata->pixels;
+ swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h;
+ break;
+
+ default:
+ SDL_assert(0 && "We should never get here (caught above)");
+ break;
+ }
+
+ /* We're all done.. */
+ return (swdata);
+}
+
+int
+SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
+ int *pitch)
+{
+ *pixels = swdata->planes[0];
+ *pitch = swdata->pitches[0];
+ return 0;
+}
+
+int
+SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
+ const void *pixels, int pitch)
+{
+ switch (swdata->format) {
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ if (rect->x == 0 && rect->y == 0 &&
+ rect->w == swdata->w && rect->h == swdata->h) {
+ SDL_memcpy(swdata->pixels, pixels,
+ (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2));
+ } else {
+ Uint8 *src, *dst;
+ int row;
+ size_t length;
+
+ /* Copy the Y plane */
+ src = (Uint8 *) pixels;
+ dst = swdata->pixels + rect->y * swdata->w + rect->x;
+ length = rect->w;
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += swdata->w;
+ }
+
+ /* Copy the next plane */
+ src = (Uint8 *) pixels + rect->h * pitch;
+ dst = swdata->pixels + swdata->h * swdata->w;
+ dst += rect->y/2 * ((swdata->w + 1) / 2) + rect->x/2;
+ length = (rect->w + 1) / 2;
+ for (row = 0; row < (rect->h + 1)/2; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += (pitch + 1)/2;
+ dst += (swdata->w + 1)/2;
+ }
+
+ /* Copy the next plane */
+ src = (Uint8 *) pixels + rect->h * pitch + ((rect->h + 1) / 2) * ((pitch + 1) / 2);
+ dst = swdata->pixels + swdata->h * swdata->w +
+ ((swdata->h + 1)/2) * ((swdata->w+1) / 2);
+ dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2;
+ length = (rect->w + 1) / 2;
+ for (row = 0; row < (rect->h + 1)/2; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += (pitch + 1)/2;
+ dst += (swdata->w + 1)/2;
+ }
+ }
+ break;
+ case SDL_PIXELFORMAT_YUY2:
+ case SDL_PIXELFORMAT_UYVY:
+ case SDL_PIXELFORMAT_YVYU:
+ {
+ Uint8 *src, *dst;
+ int row;
+ size_t length;
+
+ src = (Uint8 *) pixels;
+ dst =
+ swdata->planes[0] + rect->y * swdata->pitches[0] +
+ rect->x * 2;
+ length = 4 * ((rect->w + 1) / 2);
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += swdata->pitches[0];
+ }
+ }
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ {
+ if (rect->x == 0 && rect->y == 0 && rect->w == swdata->w && rect->h == swdata->h) {
+ SDL_memcpy(swdata->pixels, pixels,
+ (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2));
+ } else {
+
+ Uint8 *src, *dst;
+ int row;
+ size_t length;
+
+ /* Copy the Y plane */
+ src = (Uint8 *) pixels;
+ dst = swdata->pixels + rect->y * swdata->w + rect->x;
+ length = rect->w;
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += swdata->w;
+ }
+
+ /* Copy the next plane */
+ src = (Uint8 *) pixels + rect->h * pitch;
+ dst = swdata->pixels + swdata->h * swdata->w;
+ dst += 2 * ((rect->y + 1)/2) * ((swdata->w + 1) / 2) + 2 * (rect->x/2);
+ length = 2 * ((rect->w + 1) / 2);
+ for (row = 0; row < (rect->h + 1)/2; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += 2 * ((pitch + 1)/2);
+ dst += 2 * ((swdata->w + 1)/2);
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+int
+SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ const Uint8 *src;
+ Uint8 *dst;
+ int row;
+ size_t length;
+
+ /* Copy the Y plane */
+ src = Yplane;
+ dst = swdata->pixels + rect->y * swdata->w + rect->x;
+ length = rect->w;
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += Ypitch;
+ dst += swdata->w;
+ }
+
+ /* Copy the U plane */
+ src = Uplane;
+ if (swdata->format == SDL_PIXELFORMAT_IYUV) {
+ dst = swdata->pixels + swdata->h * swdata->w;
+ } else {
+ dst = swdata->pixels + swdata->h * swdata->w +
+ ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2);
+ }
+ dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2;
+ length = (rect->w + 1) / 2;
+ for (row = 0; row < (rect->h + 1)/2; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += Upitch;
+ dst += (swdata->w + 1)/2;
+ }
+
+ /* Copy the V plane */
+ src = Vplane;
+ if (swdata->format == SDL_PIXELFORMAT_YV12) {
+ dst = swdata->pixels + swdata->h * swdata->w;
+ } else {
+ dst = swdata->pixels + swdata->h * swdata->w +
+ ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2);
+ }
+ dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2;
+ length = (rect->w + 1) / 2;
+ for (row = 0; row < (rect->h + 1)/2; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += Vpitch;
+ dst += (swdata->w + 1)/2;
+ }
+ return 0;
+}
+
+int
+SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
+ void **pixels, int *pitch)
+{
+ switch (swdata->format) {
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ if (rect
+ && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w
+ || rect->h != swdata->h)) {
+ return SDL_SetError
+ ("YV12, IYUV, NV12, NV21 textures only support full surface locks");
+ }
+ break;
+ }
+
+ if (rect) {
+ *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
+ } else {
+ *pixels = swdata->planes[0];
+ }
+ *pitch = swdata->pitches[0];
+ return 0;
+}
+
+void
+SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata)
+{
+}
+
+int
+SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
+ Uint32 target_format, int w, int h, void *pixels,
+ int pitch)
+{
+ int stretch;
+
+ /* Make sure we're set up to display in the desired format */
+ if (target_format != swdata->target_format && swdata->display) {
+ SDL_FreeSurface(swdata->display);
+ swdata->display = NULL;
+ }
+
+ stretch = 0;
+ if (srcrect->x || srcrect->y || srcrect->w < swdata->w || srcrect->h < swdata->h) {
+ /* The source rectangle has been clipped.
+ Using a scratch surface is easier than adding clipped
+ source support to all the blitters, plus that would
+ slow them down in the general unclipped case.
+ */
+ stretch = 1;
+ } else if ((srcrect->w != w) || (srcrect->h != h)) {
+ stretch = 1;
+ }
+ if (stretch) {
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ if (swdata->display) {
+ swdata->display->w = w;
+ swdata->display->h = h;
+ swdata->display->pixels = pixels;
+ swdata->display->pitch = pitch;
+ } else {
+ /* This must have succeeded in SDL_SW_SetupYUVDisplay() earlier */
+ SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask,
+ &Bmask, &Amask);
+ swdata->display =
+ SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask,
+ Gmask, Bmask, Amask);
+ if (!swdata->display) {
+ return (-1);
+ }
+ }
+ if (!swdata->stretch) {
+ /* This must have succeeded in SDL_SW_SetupYUVDisplay() earlier */
+ SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask,
+ &Bmask, &Amask);
+ swdata->stretch =
+ SDL_CreateRGBSurface(0, swdata->w, swdata->h, bpp, Rmask,
+ Gmask, Bmask, Amask);
+ if (!swdata->stretch) {
+ return (-1);
+ }
+ }
+ pixels = swdata->stretch->pixels;
+ pitch = swdata->stretch->pitch;
+ }
+ if (SDL_ConvertPixels(swdata->w, swdata->h, swdata->format,
+ swdata->planes[0], swdata->pitches[0],
+ target_format, pixels, pitch) < 0) {
+ return -1;
+ }
+ if (stretch) {
+ SDL_Rect rect = *srcrect;
+ SDL_SoftStretch(swdata->stretch, &rect, swdata->display, NULL);
+ }
+ return 0;
+}
+
+void
+SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata)
+{
+ if (swdata) {
+ SDL_free(swdata->pixels);
+ SDL_FreeSurface(swdata->stretch);
+ SDL_FreeSurface(swdata->display);
+ SDL_free(swdata);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/SDL_yuv_sw_c.h b/src/3rdparty/SDL2/src/render/SDL_yuv_sw_c.h
new file mode 100644
index 0000000..0dfb5db
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/SDL_yuv_sw_c.h
@@ -0,0 +1,67 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+
+/* This is the software implementation of the YUV texture support */
+
+struct SDL_SW_YUVTexture
+{
+ Uint32 format;
+ Uint32 target_format;
+ int w, h;
+ Uint8 *pixels;
+
+ /* These are just so we don't have to allocate them separately */
+ Uint16 pitches[3];
+ Uint8 *planes[3];
+
+ /* This is a temporary surface in case we have to stretch copy */
+ SDL_Surface *stretch;
+ SDL_Surface *display;
+};
+
+typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;
+
+SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h);
+int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
+ int *pitch);
+int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
+ const void *pixels, int pitch);
+int SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
+ void **pixels, int *pitch);
+void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata);
+int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
+ Uint32 target_format, int w, int h, void *pixels,
+ int pitch);
+void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata);
+
+/* FIXME: This breaks on various versions of GCC and should be rewritten using intrinsics */
+#if 0 /* (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES && !defined(__clang__) */
+#define USE_MMX_ASSEMBLY 1
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d/SDL_render_d3d.c b/src/3rdparty/SDL2/src/render/direct3d/SDL_render_d3d.c
new file mode 100644
index 0000000..d3be571
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d/SDL_render_d3d.c
@@ -0,0 +1,1825 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_render.h"
+#include "SDL_system.h"
+
+#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_hints.h"
+#include "SDL_loadso.h"
+#include "SDL_syswm.h"
+#include "../SDL_sysrender.h"
+#include "../SDL_d3dmath.h"
+#include "../../video/windows/SDL_windowsvideo.h"
+
+#if SDL_VIDEO_RENDER_D3D
+#define D3D_DEBUG_INFO
+#include <d3d9.h>
+#endif
+
+#include "SDL_shaders_d3d.h"
+
+
+/* Direct3D renderer implementation */
+
+static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void D3D_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static SDL_bool D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
+static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+static int D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D_UpdateViewport(SDL_Renderer * renderer);
+static int D3D_UpdateClipRect(SDL_Renderer * renderer);
+static int D3D_RenderClear(SDL_Renderer * renderer);
+static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int D3D_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int D3D_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
+static int D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
+static int D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch);
+static void D3D_RenderPresent(SDL_Renderer * renderer);
+static void D3D_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static void D3D_DestroyRenderer(SDL_Renderer * renderer);
+
+
+SDL_RenderDriver D3D_RenderDriver = {
+ D3D_CreateRenderer,
+ {
+ "direct3d",
+ (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
+ 1,
+ {SDL_PIXELFORMAT_ARGB8888},
+ 0,
+ 0}
+};
+
+typedef struct
+{
+ void* d3dDLL;
+ IDirect3D9 *d3d;
+ IDirect3DDevice9 *device;
+ UINT adapter;
+ D3DPRESENT_PARAMETERS pparams;
+ SDL_bool updateSize;
+ SDL_bool beginScene;
+ SDL_bool enableSeparateAlphaBlend;
+ D3DTEXTUREFILTERTYPE scaleMode[8];
+ IDirect3DSurface9 *defaultRenderTarget;
+ IDirect3DSurface9 *currentRenderTarget;
+ void* d3dxDLL;
+ LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS];
+} D3D_RenderData;
+
+typedef struct
+{
+ SDL_bool dirty;
+ int w, h;
+ DWORD usage;
+ Uint32 format;
+ D3DFORMAT d3dfmt;
+ IDirect3DTexture9 *texture;
+ IDirect3DTexture9 *staging;
+} D3D_TextureRep;
+
+typedef struct
+{
+ D3D_TextureRep texture;
+ D3DTEXTUREFILTERTYPE scaleMode;
+
+ /* YV12 texture support */
+ SDL_bool yuv;
+ D3D_TextureRep utexture;
+ D3D_TextureRep vtexture;
+ Uint8 *pixels;
+ int pitch;
+ SDL_Rect locked_rect;
+} D3D_TextureData;
+
+typedef struct
+{
+ float x, y, z;
+ DWORD color;
+ float u, v;
+} Vertex;
+
+static int
+D3D_SetError(const char *prefix, HRESULT result)
+{
+ const char *error;
+
+ switch (result) {
+ case D3DERR_WRONGTEXTUREFORMAT:
+ error = "WRONGTEXTUREFORMAT";
+ break;
+ case D3DERR_UNSUPPORTEDCOLOROPERATION:
+ error = "UNSUPPORTEDCOLOROPERATION";
+ break;
+ case D3DERR_UNSUPPORTEDCOLORARG:
+ error = "UNSUPPORTEDCOLORARG";
+ break;
+ case D3DERR_UNSUPPORTEDALPHAOPERATION:
+ error = "UNSUPPORTEDALPHAOPERATION";
+ break;
+ case D3DERR_UNSUPPORTEDALPHAARG:
+ error = "UNSUPPORTEDALPHAARG";
+ break;
+ case D3DERR_TOOMANYOPERATIONS:
+ error = "TOOMANYOPERATIONS";
+ break;
+ case D3DERR_CONFLICTINGTEXTUREFILTER:
+ error = "CONFLICTINGTEXTUREFILTER";
+ break;
+ case D3DERR_UNSUPPORTEDFACTORVALUE:
+ error = "UNSUPPORTEDFACTORVALUE";
+ break;
+ case D3DERR_CONFLICTINGRENDERSTATE:
+ error = "CONFLICTINGRENDERSTATE";
+ break;
+ case D3DERR_UNSUPPORTEDTEXTUREFILTER:
+ error = "UNSUPPORTEDTEXTUREFILTER";
+ break;
+ case D3DERR_CONFLICTINGTEXTUREPALETTE:
+ error = "CONFLICTINGTEXTUREPALETTE";
+ break;
+ case D3DERR_DRIVERINTERNALERROR:
+ error = "DRIVERINTERNALERROR";
+ break;
+ case D3DERR_NOTFOUND:
+ error = "NOTFOUND";
+ break;
+ case D3DERR_MOREDATA:
+ error = "MOREDATA";
+ break;
+ case D3DERR_DEVICELOST:
+ error = "DEVICELOST";
+ break;
+ case D3DERR_DEVICENOTRESET:
+ error = "DEVICENOTRESET";
+ break;
+ case D3DERR_NOTAVAILABLE:
+ error = "NOTAVAILABLE";
+ break;
+ case D3DERR_OUTOFVIDEOMEMORY:
+ error = "OUTOFVIDEOMEMORY";
+ break;
+ case D3DERR_INVALIDDEVICE:
+ error = "INVALIDDEVICE";
+ break;
+ case D3DERR_INVALIDCALL:
+ error = "INVALIDCALL";
+ break;
+ case D3DERR_DRIVERINVALIDCALL:
+ error = "DRIVERINVALIDCALL";
+ break;
+ case D3DERR_WASSTILLDRAWING:
+ error = "WASSTILLDRAWING";
+ break;
+ default:
+ error = "UNKNOWN";
+ break;
+ }
+ return SDL_SetError("%s: %s", prefix, error);
+}
+
+static D3DFORMAT
+PixelFormatToD3DFMT(Uint32 format)
+{
+ switch (format) {
+ case SDL_PIXELFORMAT_RGB565:
+ return D3DFMT_R5G6B5;
+ case SDL_PIXELFORMAT_RGB888:
+ return D3DFMT_X8R8G8B8;
+ case SDL_PIXELFORMAT_ARGB8888:
+ return D3DFMT_A8R8G8B8;
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ return D3DFMT_L8;
+ default:
+ return D3DFMT_UNKNOWN;
+ }
+}
+
+static Uint32
+D3DFMTToPixelFormat(D3DFORMAT format)
+{
+ switch (format) {
+ case D3DFMT_R5G6B5:
+ return SDL_PIXELFORMAT_RGB565;
+ case D3DFMT_X8R8G8B8:
+ return SDL_PIXELFORMAT_RGB888;
+ case D3DFMT_A8R8G8B8:
+ return SDL_PIXELFORMAT_ARGB8888;
+ default:
+ return SDL_PIXELFORMAT_UNKNOWN;
+ }
+}
+
+static void
+D3D_InitRenderState(D3D_RenderData *data)
+{
+ D3DMATRIX matrix;
+
+ IDirect3DDevice9 *device = data->device;
+
+ IDirect3DDevice9_SetVertexShader(device, NULL);
+ IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1);
+ IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE);
+ IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE);
+ IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);
+
+ /* Enable color modulation by diffuse color */
+ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP,
+ D3DTOP_MODULATE);
+ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1,
+ D3DTA_TEXTURE);
+ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG2,
+ D3DTA_DIFFUSE);
+
+ /* Enable alpha modulation by diffuse alpha */
+ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP,
+ D3DTOP_MODULATE);
+ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1,
+ D3DTA_TEXTURE);
+ IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAARG2,
+ D3DTA_DIFFUSE);
+
+ /* Enable separate alpha blend function, if possible */
+ if (data->enableSeparateAlphaBlend) {
+ IDirect3DDevice9_SetRenderState(device, D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+ }
+
+ /* Disable second texture stage, since we're done */
+ IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP,
+ D3DTOP_DISABLE);
+ IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_ALPHAOP,
+ D3DTOP_DISABLE);
+
+ /* Set an identity world and view matrix */
+ matrix.m[0][0] = 1.0f;
+ matrix.m[0][1] = 0.0f;
+ matrix.m[0][2] = 0.0f;
+ matrix.m[0][3] = 0.0f;
+ matrix.m[1][0] = 0.0f;
+ matrix.m[1][1] = 1.0f;
+ matrix.m[1][2] = 0.0f;
+ matrix.m[1][3] = 0.0f;
+ matrix.m[2][0] = 0.0f;
+ matrix.m[2][1] = 0.0f;
+ matrix.m[2][2] = 1.0f;
+ matrix.m[2][3] = 0.0f;
+ matrix.m[3][0] = 0.0f;
+ matrix.m[3][1] = 0.0f;
+ matrix.m[3][2] = 0.0f;
+ matrix.m[3][3] = 1.0f;
+ IDirect3DDevice9_SetTransform(device, D3DTS_WORLD, &matrix);
+ IDirect3DDevice9_SetTransform(device, D3DTS_VIEW, &matrix);
+
+ /* Reset our current scale mode */
+ SDL_memset(data->scaleMode, 0xFF, sizeof(data->scaleMode));
+
+ /* Start the render with beginScene */
+ data->beginScene = SDL_TRUE;
+}
+
+static int
+D3D_Reset(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ HRESULT result;
+ SDL_Texture *texture;
+
+ /* Release the default render target before reset */
+ if (data->defaultRenderTarget) {
+ IDirect3DSurface9_Release(data->defaultRenderTarget);
+ data->defaultRenderTarget = NULL;
+ }
+ if (data->currentRenderTarget != NULL) {
+ IDirect3DSurface9_Release(data->currentRenderTarget);
+ data->currentRenderTarget = NULL;
+ }
+
+ /* Release application render targets */
+ for (texture = renderer->textures; texture; texture = texture->next) {
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ D3D_DestroyTexture(renderer, texture);
+ } else {
+ D3D_RecreateTexture(renderer, texture);
+ }
+ }
+
+ result = IDirect3DDevice9_Reset(data->device, &data->pparams);
+ if (FAILED(result)) {
+ if (result == D3DERR_DEVICELOST) {
+ /* Don't worry about it, we'll reset later... */
+ return 0;
+ } else {
+ return D3D_SetError("Reset()", result);
+ }
+ }
+
+ /* Allocate application render targets */
+ for (texture = renderer->textures; texture; texture = texture->next) {
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ D3D_CreateTexture(renderer, texture);
+ }
+ }
+
+ IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
+ D3D_InitRenderState(data);
+ D3D_SetRenderTargetInternal(renderer, renderer->target);
+ D3D_UpdateViewport(renderer);
+
+ /* Let the application know that render targets were reset */
+ {
+ SDL_Event event;
+ event.type = SDL_RENDER_TARGETS_RESET;
+ SDL_PushEvent(&event);
+ }
+
+ return 0;
+}
+
+static int
+D3D_ActivateRenderer(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ HRESULT result;
+
+ if (data->updateSize) {
+ SDL_Window *window = renderer->window;
+ int w, h;
+ Uint32 window_flags = SDL_GetWindowFlags(window);
+
+ SDL_GetWindowSize(window, &w, &h);
+ data->pparams.BackBufferWidth = w;
+ data->pparams.BackBufferHeight = h;
+ if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ SDL_DisplayMode fullscreen_mode;
+ SDL_GetWindowDisplayMode(window, &fullscreen_mode);
+ data->pparams.Windowed = FALSE;
+ data->pparams.BackBufferFormat = PixelFormatToD3DFMT(fullscreen_mode.format);
+ data->pparams.FullScreen_RefreshRateInHz = fullscreen_mode.refresh_rate;
+ } else {
+ data->pparams.Windowed = TRUE;
+ data->pparams.BackBufferFormat = D3DFMT_UNKNOWN;
+ data->pparams.FullScreen_RefreshRateInHz = 0;
+ }
+ if (D3D_Reset(renderer) < 0) {
+ return -1;
+ }
+
+ data->updateSize = SDL_FALSE;
+ }
+ if (data->beginScene) {
+ result = IDirect3DDevice9_BeginScene(data->device);
+ if (result == D3DERR_DEVICELOST) {
+ if (D3D_Reset(renderer) < 0) {
+ return -1;
+ }
+ result = IDirect3DDevice9_BeginScene(data->device);
+ }
+ if (FAILED(result)) {
+ return D3D_SetError("BeginScene()", result);
+ }
+ data->beginScene = SDL_FALSE;
+ }
+ return 0;
+}
+
+SDL_Renderer *
+D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+ SDL_Renderer *renderer;
+ D3D_RenderData *data;
+ SDL_SysWMinfo windowinfo;
+ HRESULT result;
+ D3DPRESENT_PARAMETERS pparams;
+ IDirect3DSwapChain9 *chain;
+ D3DCAPS9 caps;
+ DWORD device_flags;
+ Uint32 window_flags;
+ int w, h;
+ SDL_DisplayMode fullscreen_mode;
+ int displayIndex;
+
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ data = (D3D_RenderData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ SDL_free(renderer);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ if (!D3D_LoadDLL(&data->d3dDLL, &data->d3d)) {
+ SDL_free(renderer);
+ SDL_free(data);
+ SDL_SetError("Unable to create Direct3D interface");
+ return NULL;
+ }
+
+ renderer->WindowEvent = D3D_WindowEvent;
+ renderer->SupportsBlendMode = D3D_SupportsBlendMode;
+ renderer->CreateTexture = D3D_CreateTexture;
+ renderer->UpdateTexture = D3D_UpdateTexture;
+ renderer->UpdateTextureYUV = D3D_UpdateTextureYUV;
+ renderer->LockTexture = D3D_LockTexture;
+ renderer->UnlockTexture = D3D_UnlockTexture;
+ renderer->SetRenderTarget = D3D_SetRenderTarget;
+ renderer->UpdateViewport = D3D_UpdateViewport;
+ renderer->UpdateClipRect = D3D_UpdateClipRect;
+ renderer->RenderClear = D3D_RenderClear;
+ renderer->RenderDrawPoints = D3D_RenderDrawPoints;
+ renderer->RenderDrawLines = D3D_RenderDrawLines;
+ renderer->RenderFillRects = D3D_RenderFillRects;
+ renderer->RenderCopy = D3D_RenderCopy;
+ renderer->RenderCopyEx = D3D_RenderCopyEx;
+ renderer->RenderReadPixels = D3D_RenderReadPixels;
+ renderer->RenderPresent = D3D_RenderPresent;
+ renderer->DestroyTexture = D3D_DestroyTexture;
+ renderer->DestroyRenderer = D3D_DestroyRenderer;
+ renderer->info = D3D_RenderDriver.info;
+ renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
+ renderer->driverdata = data;
+
+ SDL_VERSION(&windowinfo.version);
+ SDL_GetWindowWMInfo(window, &windowinfo);
+
+ window_flags = SDL_GetWindowFlags(window);
+ SDL_GetWindowSize(window, &w, &h);
+ SDL_GetWindowDisplayMode(window, &fullscreen_mode);
+
+ SDL_zero(pparams);
+ pparams.hDeviceWindow = windowinfo.info.win.window;
+ pparams.BackBufferWidth = w;
+ pparams.BackBufferHeight = h;
+ pparams.BackBufferCount = 1;
+ pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
+
+ if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ pparams.Windowed = FALSE;
+ pparams.BackBufferFormat = PixelFormatToD3DFMT(fullscreen_mode.format);
+ pparams.FullScreen_RefreshRateInHz = fullscreen_mode.refresh_rate;
+ } else {
+ pparams.Windowed = TRUE;
+ pparams.BackBufferFormat = D3DFMT_UNKNOWN;
+ pparams.FullScreen_RefreshRateInHz = 0;
+ }
+ if (flags & SDL_RENDERER_PRESENTVSYNC) {
+ pparams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+ } else {
+ pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
+ }
+
+ /* Get the adapter for the display that the window is on */
+ displayIndex = SDL_GetWindowDisplayIndex(window);
+ data->adapter = SDL_Direct3D9GetAdapterIndex(displayIndex);
+
+ IDirect3D9_GetDeviceCaps(data->d3d, data->adapter, D3DDEVTYPE_HAL, &caps);
+
+ device_flags = D3DCREATE_FPU_PRESERVE;
+ if (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
+ device_flags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
+ } else {
+ device_flags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
+ }
+
+ if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_FALSE)) {
+ device_flags |= D3DCREATE_MULTITHREADED;
+ }
+
+ result = IDirect3D9_CreateDevice(data->d3d, data->adapter,
+ D3DDEVTYPE_HAL,
+ pparams.hDeviceWindow,
+ device_flags,
+ &pparams, &data->device);
+ if (FAILED(result)) {
+ D3D_DestroyRenderer(renderer);
+ D3D_SetError("CreateDevice()", result);
+ return NULL;
+ }
+
+ /* Get presentation parameters to fill info */
+ result = IDirect3DDevice9_GetSwapChain(data->device, 0, &chain);
+ if (FAILED(result)) {
+ D3D_DestroyRenderer(renderer);
+ D3D_SetError("GetSwapChain()", result);
+ return NULL;
+ }
+ result = IDirect3DSwapChain9_GetPresentParameters(chain, &pparams);
+ if (FAILED(result)) {
+ IDirect3DSwapChain9_Release(chain);
+ D3D_DestroyRenderer(renderer);
+ D3D_SetError("GetPresentParameters()", result);
+ return NULL;
+ }
+ IDirect3DSwapChain9_Release(chain);
+ if (pparams.PresentationInterval == D3DPRESENT_INTERVAL_ONE) {
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+ data->pparams = pparams;
+
+ IDirect3DDevice9_GetDeviceCaps(data->device, &caps);
+ renderer->info.max_texture_width = caps.MaxTextureWidth;
+ renderer->info.max_texture_height = caps.MaxTextureHeight;
+ if (caps.NumSimultaneousRTs >= 2) {
+ renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE;
+ }
+
+ if (caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND) {
+ data->enableSeparateAlphaBlend = SDL_TRUE;
+ }
+
+ /* Store the default render target */
+ IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
+ data->currentRenderTarget = NULL;
+
+ /* Set up parameters for rendering */
+ D3D_InitRenderState(data);
+
+ if (caps.MaxSimultaneousTextures >= 3) {
+ int i;
+ for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
+ result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]);
+ if (FAILED(result)) {
+ D3D_SetError("CreatePixelShader()", result);
+ }
+ }
+ if (data->shaders[SHADER_YUV_JPEG] && data->shaders[SHADER_YUV_BT601] && data->shaders[SHADER_YUV_BT709]) {
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
+ }
+ }
+ return renderer;
+}
+
+static void
+D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
+ data->updateSize = SDL_TRUE;
+ }
+}
+
+static D3DBLEND GetBlendFunc(SDL_BlendFactor factor)
+{
+ switch (factor) {
+ case SDL_BLENDFACTOR_ZERO:
+ return D3DBLEND_ZERO;
+ case SDL_BLENDFACTOR_ONE:
+ return D3DBLEND_ONE;
+ case SDL_BLENDFACTOR_SRC_COLOR:
+ return D3DBLEND_SRCCOLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
+ return D3DBLEND_INVSRCCOLOR;
+ case SDL_BLENDFACTOR_SRC_ALPHA:
+ return D3DBLEND_SRCALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
+ return D3DBLEND_INVSRCALPHA;
+ case SDL_BLENDFACTOR_DST_COLOR:
+ return D3DBLEND_DESTCOLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
+ return D3DBLEND_INVDESTCOLOR;
+ case SDL_BLENDFACTOR_DST_ALPHA:
+ return D3DBLEND_DESTALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
+ return D3DBLEND_INVDESTALPHA;
+ default:
+ return (D3DBLEND)0;
+ }
+}
+
+static SDL_bool
+D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+
+ if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) ||
+ !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor)) {
+ return SDL_FALSE;
+ }
+ if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->enableSeparateAlphaBlend) {
+ return SDL_FALSE;
+ }
+ if (colorOperation != SDL_BLENDOPERATION_ADD || alphaOperation != SDL_BLENDOPERATION_ADD) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static D3DTEXTUREFILTERTYPE
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return D3DTEXF_POINT;
+ } else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
+ return D3DTEXF_LINEAR;
+ }
+}
+
+static int
+D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h)
+{
+ HRESULT result;
+
+ texture->dirty = SDL_FALSE;
+ texture->w = w;
+ texture->h = h;
+ texture->usage = usage;
+ texture->format = format;
+ texture->d3dfmt = d3dfmt;
+
+ result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage,
+ PixelFormatToD3DFMT(format),
+ D3DPOOL_DEFAULT, &texture->texture, NULL);
+ if (FAILED(result)) {
+ return D3D_SetError("CreateTexture(D3DPOOL_DEFAULT)", result);
+ }
+ return 0;
+}
+
+
+static int
+D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture)
+{
+ HRESULT result;
+
+ if (texture->staging == NULL) {
+ result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0,
+ texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
+ if (FAILED(result)) {
+ return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result);
+ }
+ }
+ return 0;
+}
+
+static int
+D3D_BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD sampler)
+{
+ HRESULT result;
+
+ if (texture->dirty && texture->staging) {
+ if (!texture->texture) {
+ result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, texture->usage,
+ PixelFormatToD3DFMT(texture->format), D3DPOOL_DEFAULT, &texture->texture, NULL);
+ if (FAILED(result)) {
+ return D3D_SetError("CreateTexture(D3DPOOL_DEFAULT)", result);
+ }
+ }
+
+ result = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)texture->staging, (IDirect3DBaseTexture9 *)texture->texture);
+ if (FAILED(result)) {
+ return D3D_SetError("UpdateTexture()", result);
+ }
+ texture->dirty = SDL_FALSE;
+ }
+ result = IDirect3DDevice9_SetTexture(device, sampler, (IDirect3DBaseTexture9 *)texture->texture);
+ if (FAILED(result)) {
+ return D3D_SetError("SetTexture()", result);
+ }
+ return 0;
+}
+
+static int
+D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture)
+{
+ if (texture->texture) {
+ IDirect3DTexture9_Release(texture->texture);
+ texture->texture = NULL;
+ }
+ if (texture->staging) {
+ IDirect3DTexture9_AddDirtyRect(texture->staging, NULL);
+ texture->dirty = SDL_TRUE;
+ }
+ return 0;
+}
+
+static int
+D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, int x, int y, int w, int h, const void *pixels, int pitch)
+{
+ RECT d3drect;
+ D3DLOCKED_RECT locked;
+ const Uint8 *src;
+ Uint8 *dst;
+ int row, length;
+ HRESULT result;
+
+ if (D3D_CreateStagingTexture(device, texture) < 0) {
+ return -1;
+ }
+
+ d3drect.left = x;
+ d3drect.right = x + w;
+ d3drect.top = y;
+ d3drect.bottom = y + h;
+
+ result = IDirect3DTexture9_LockRect(texture->staging, 0, &locked, &d3drect, 0);
+ if (FAILED(result)) {
+ return D3D_SetError("LockRect()", result);
+ }
+
+ src = (const Uint8 *)pixels;
+ dst = (Uint8 *)locked.pBits;
+ length = w * SDL_BYTESPERPIXEL(texture->format);
+ if (length == pitch && length == locked.Pitch) {
+ SDL_memcpy(dst, src, length*h);
+ } else {
+ if (length > pitch) {
+ length = pitch;
+ }
+ if (length > locked.Pitch) {
+ length = locked.Pitch;
+ }
+ for (row = 0; row < h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += locked.Pitch;
+ }
+ }
+ result = IDirect3DTexture9_UnlockRect(texture->staging, 0);
+ if (FAILED(result)) {
+ return D3D_SetError("UnlockRect()", result);
+ }
+ texture->dirty = SDL_TRUE;
+
+ return 0;
+}
+
+static void
+D3D_DestroyTextureRep(D3D_TextureRep *texture)
+{
+ if (texture->texture) {
+ IDirect3DTexture9_Release(texture->texture);
+ texture->texture = NULL;
+ }
+ if (texture->staging) {
+ IDirect3DTexture9_Release(texture->staging);
+ texture->staging = NULL;
+ }
+}
+
+static int
+D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ D3D_TextureData *texturedata;
+ DWORD usage;
+
+ texturedata = (D3D_TextureData *) SDL_calloc(1, sizeof(*texturedata));
+ if (!texturedata) {
+ return SDL_OutOfMemory();
+ }
+ texturedata->scaleMode = GetScaleQuality();
+
+ texture->driverdata = texturedata;
+
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ usage = D3DUSAGE_RENDERTARGET;
+ } else {
+ usage = 0;
+ }
+
+ if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) {
+ return -1;
+ }
+
+ if (texture->format == SDL_PIXELFORMAT_YV12 ||
+ texture->format == SDL_PIXELFORMAT_IYUV) {
+ texturedata->yuv = SDL_TRUE;
+
+ if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) {
+ return -1;
+ }
+
+ if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
+ D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
+
+ if (!texturedata) {
+ return 0;
+ }
+
+ if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) {
+ return -1;
+ }
+
+ if (texturedata->yuv) {
+ if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) {
+ return -1;
+ }
+
+ if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{
+ D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
+ D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata;
+
+ if (!texturedata) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
+ return -1;
+ }
+
+ if (texturedata->yuv) {
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+
+ if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) {
+ return -1;
+ }
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2));
+ if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, rect->x / 2, (rect->y + 1) / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
+ D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata;
+
+ if (!texturedata) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
+ return -1;
+ }
+ if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch) < 0) {
+ return -1;
+ }
+ if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+static int
+D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
+ D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
+ IDirect3DDevice9 *device = data->device;
+
+ if (!texturedata) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ texturedata->locked_rect = *rect;
+
+ if (texturedata->yuv) {
+ /* It's more efficient to upload directly... */
+ if (!texturedata->pixels) {
+ texturedata->pitch = texture->w;
+ texturedata->pixels = (Uint8 *)SDL_malloc((texture->h * texturedata->pitch * 3) / 2);
+ if (!texturedata->pixels) {
+ return SDL_OutOfMemory();
+ }
+ }
+ *pixels =
+ (void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = texturedata->pitch;
+ } else {
+ RECT d3drect;
+ D3DLOCKED_RECT locked;
+ HRESULT result;
+
+ if (D3D_CreateStagingTexture(device, &texturedata->texture) < 0) {
+ return -1;
+ }
+
+ d3drect.left = rect->x;
+ d3drect.right = rect->x + rect->w;
+ d3drect.top = rect->y;
+ d3drect.bottom = rect->y + rect->h;
+
+ result = IDirect3DTexture9_LockRect(texturedata->texture.staging, 0, &locked, &d3drect, 0);
+ if (FAILED(result)) {
+ return D3D_SetError("LockRect()", result);
+ }
+ *pixels = locked.pBits;
+ *pitch = locked.Pitch;
+ }
+ return 0;
+}
+
+static void
+D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ /*D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;*/
+ D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
+
+ if (!texturedata) {
+ return;
+ }
+
+ if (texturedata->yuv) {
+ const SDL_Rect *rect = &texturedata->locked_rect;
+ void *pixels =
+ (void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ D3D_UpdateTexture(renderer, texture, rect, pixels, texturedata->pitch);
+ } else {
+ IDirect3DTexture9_UnlockRect(texturedata->texture.staging, 0);
+ texturedata->texture.dirty = SDL_TRUE;
+ }
+}
+
+static int
+D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ D3D_TextureData *texturedata;
+ D3D_TextureRep *texturerep;
+ HRESULT result;
+ IDirect3DDevice9 *device = data->device;
+
+ /* Release the previous render target if it wasn't the default one */
+ if (data->currentRenderTarget != NULL) {
+ IDirect3DSurface9_Release(data->currentRenderTarget);
+ data->currentRenderTarget = NULL;
+ }
+
+ if (texture == NULL) {
+ IDirect3DDevice9_SetRenderTarget(data->device, 0, data->defaultRenderTarget);
+ return 0;
+ }
+
+ texturedata = (D3D_TextureData *)texture->driverdata;
+ if (!texturedata) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ /* Make sure the render target is updated if it was locked and written to */
+ texturerep = &texturedata->texture;
+ if (texturerep->dirty && texturerep->staging) {
+ if (!texturerep->texture) {
+ result = IDirect3DDevice9_CreateTexture(device, texturerep->w, texturerep->h, 1, texturerep->usage,
+ PixelFormatToD3DFMT(texturerep->format), D3DPOOL_DEFAULT, &texturerep->texture, NULL);
+ if (FAILED(result)) {
+ return D3D_SetError("CreateTexture(D3DPOOL_DEFAULT)", result);
+ }
+ }
+
+ result = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)texturerep->staging, (IDirect3DBaseTexture9 *)texturerep->texture);
+ if (FAILED(result)) {
+ return D3D_SetError("UpdateTexture()", result);
+ }
+ texturerep->dirty = SDL_FALSE;
+ }
+
+ result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture.texture, 0, &data->currentRenderTarget);
+ if(FAILED(result)) {
+ return D3D_SetError("GetSurfaceLevel()", result);
+ }
+ result = IDirect3DDevice9_SetRenderTarget(data->device, 0, data->currentRenderTarget);
+ if(FAILED(result)) {
+ return D3D_SetError("SetRenderTarget()", result);
+ }
+
+ return 0;
+}
+
+static int
+D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ return D3D_SetRenderTargetInternal(renderer, texture);
+}
+
+static int
+D3D_UpdateViewport(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ D3DVIEWPORT9 viewport;
+ D3DMATRIX matrix;
+
+ /* Set the viewport */
+ viewport.X = renderer->viewport.x;
+ viewport.Y = renderer->viewport.y;
+ viewport.Width = renderer->viewport.w;
+ viewport.Height = renderer->viewport.h;
+ viewport.MinZ = 0.0f;
+ viewport.MaxZ = 1.0f;
+ IDirect3DDevice9_SetViewport(data->device, &viewport);
+
+ /* Set an orthographic projection matrix */
+ if (renderer->viewport.w && renderer->viewport.h) {
+ matrix.m[0][0] = 2.0f / renderer->viewport.w;
+ matrix.m[0][1] = 0.0f;
+ matrix.m[0][2] = 0.0f;
+ matrix.m[0][3] = 0.0f;
+ matrix.m[1][0] = 0.0f;
+ matrix.m[1][1] = -2.0f / renderer->viewport.h;
+ matrix.m[1][2] = 0.0f;
+ matrix.m[1][3] = 0.0f;
+ matrix.m[2][0] = 0.0f;
+ matrix.m[2][1] = 0.0f;
+ matrix.m[2][2] = 1.0f;
+ matrix.m[2][3] = 0.0f;
+ matrix.m[3][0] = -1.0f;
+ matrix.m[3][1] = 1.0f;
+ matrix.m[3][2] = 0.0f;
+ matrix.m[3][3] = 1.0f;
+ IDirect3DDevice9_SetTransform(data->device, D3DTS_PROJECTION, &matrix);
+ }
+
+ return 0;
+}
+
+static int
+D3D_UpdateClipRect(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+
+ if (renderer->clipping_enabled) {
+ const SDL_Rect *rect = &renderer->clip_rect;
+ RECT r;
+ HRESULT result;
+
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, TRUE);
+ r.left = renderer->viewport.x + rect->x;
+ r.top = renderer->viewport.y + rect->y;
+ r.right = renderer->viewport.x + rect->x + rect->w;
+ r.bottom = renderer->viewport.y + rect->y + rect->h;
+
+ result = IDirect3DDevice9_SetScissorRect(data->device, &r);
+ if (result != D3D_OK) {
+ D3D_SetError("SetScissor()", result);
+ return -1;
+ }
+ } else {
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, FALSE);
+ }
+ return 0;
+}
+
+static int
+D3D_RenderClear(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ DWORD color;
+ HRESULT result;
+ int BackBufferWidth, BackBufferHeight;
+
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
+
+ if (renderer->target) {
+ BackBufferWidth = renderer->target->w;
+ BackBufferHeight = renderer->target->h;
+ } else {
+ BackBufferWidth = data->pparams.BackBufferWidth;
+ BackBufferHeight = data->pparams.BackBufferHeight;
+ }
+
+ if (renderer->clipping_enabled) {
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, FALSE);
+ }
+
+ /* Don't reset the viewport if we don't have to! */
+ if (!renderer->viewport.x && !renderer->viewport.y &&
+ renderer->viewport.w == BackBufferWidth &&
+ renderer->viewport.h == BackBufferHeight) {
+ result = IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
+ } else {
+ D3DVIEWPORT9 viewport;
+
+ /* Clear is defined to clear the entire render target */
+ viewport.X = 0;
+ viewport.Y = 0;
+ viewport.Width = BackBufferWidth;
+ viewport.Height = BackBufferHeight;
+ viewport.MinZ = 0.0f;
+ viewport.MaxZ = 1.0f;
+ IDirect3DDevice9_SetViewport(data->device, &viewport);
+
+ result = IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
+
+ /* Reset the viewport */
+ viewport.X = renderer->viewport.x;
+ viewport.Y = renderer->viewport.y;
+ viewport.Width = renderer->viewport.w;
+ viewport.Height = renderer->viewport.h;
+ viewport.MinZ = 0.0f;
+ viewport.MaxZ = 1.0f;
+ IDirect3DDevice9_SetViewport(data->device, &viewport);
+ }
+
+ if (renderer->clipping_enabled) {
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, TRUE);
+ }
+
+ if (FAILED(result)) {
+ return D3D_SetError("Clear()", result);
+ }
+ return 0;
+}
+
+static void
+D3D_SetBlendMode(D3D_RenderData * data, SDL_BlendMode blendMode)
+{
+ if (blendMode == SDL_BLENDMODE_NONE) {
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, FALSE);
+ } else {
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, TRUE);
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
+ GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)));
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
+ GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)));
+ if (data->enableSeparateAlphaBlend) {
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA,
+ GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)));
+ IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA,
+ GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode)));
+ }
+ }
+}
+
+static int
+D3D_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ DWORD color;
+ Vertex *vertices;
+ int i;
+ HRESULT result;
+
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ D3D_SetBlendMode(data, renderer->blendMode);
+
+ result =
+ IDirect3DDevice9_SetTexture(data->device, 0,
+ (IDirect3DBaseTexture9 *) 0);
+ if (FAILED(result)) {
+ return D3D_SetError("SetTexture()", result);
+ }
+
+ color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
+
+ vertices = SDL_stack_alloc(Vertex, count);
+ for (i = 0; i < count; ++i) {
+ vertices[i].x = points[i].x;
+ vertices[i].y = points[i].y;
+ vertices[i].z = 0.0f;
+ vertices[i].color = color;
+ vertices[i].u = 0.0f;
+ vertices[i].v = 0.0f;
+ }
+ result =
+ IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, count,
+ vertices, sizeof(*vertices));
+ SDL_stack_free(vertices);
+ if (FAILED(result)) {
+ return D3D_SetError("DrawPrimitiveUP()", result);
+ }
+ return 0;
+}
+
+static int
+D3D_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ DWORD color;
+ Vertex *vertices;
+ int i;
+ HRESULT result;
+
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ D3D_SetBlendMode(data, renderer->blendMode);
+
+ result =
+ IDirect3DDevice9_SetTexture(data->device, 0,
+ (IDirect3DBaseTexture9 *) 0);
+ if (FAILED(result)) {
+ return D3D_SetError("SetTexture()", result);
+ }
+
+ color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
+
+ vertices = SDL_stack_alloc(Vertex, count);
+ for (i = 0; i < count; ++i) {
+ vertices[i].x = points[i].x;
+ vertices[i].y = points[i].y;
+ vertices[i].z = 0.0f;
+ vertices[i].color = color;
+ vertices[i].u = 0.0f;
+ vertices[i].v = 0.0f;
+ }
+ result =
+ IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, count-1,
+ vertices, sizeof(*vertices));
+
+ /* DirectX 9 has the same line rasterization semantics as GDI,
+ so we need to close the endpoint of the line */
+ if (count == 2 ||
+ points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
+ vertices[0].x = points[count-1].x;
+ vertices[0].y = points[count-1].y;
+ result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, vertices, sizeof(*vertices));
+ }
+
+ SDL_stack_free(vertices);
+ if (FAILED(result)) {
+ return D3D_SetError("DrawPrimitiveUP()", result);
+ }
+ return 0;
+}
+
+static int
+D3D_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects,
+ int count)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ DWORD color;
+ int i;
+ float minx, miny, maxx, maxy;
+ Vertex vertices[4];
+ HRESULT result;
+
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ D3D_SetBlendMode(data, renderer->blendMode);
+
+ result =
+ IDirect3DDevice9_SetTexture(data->device, 0,
+ (IDirect3DBaseTexture9 *) 0);
+ if (FAILED(result)) {
+ return D3D_SetError("SetTexture()", result);
+ }
+
+ color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b);
+
+ for (i = 0; i < count; ++i) {
+ const SDL_FRect *rect = &rects[i];
+
+ minx = rect->x;
+ miny = rect->y;
+ maxx = rect->x + rect->w;
+ maxy = rect->y + rect->h;
+
+ vertices[0].x = minx;
+ vertices[0].y = miny;
+ vertices[0].z = 0.0f;
+ vertices[0].color = color;
+ vertices[0].u = 0.0f;
+ vertices[0].v = 0.0f;
+
+ vertices[1].x = maxx;
+ vertices[1].y = miny;
+ vertices[1].z = 0.0f;
+ vertices[1].color = color;
+ vertices[1].u = 0.0f;
+ vertices[1].v = 0.0f;
+
+ vertices[2].x = maxx;
+ vertices[2].y = maxy;
+ vertices[2].z = 0.0f;
+ vertices[2].color = color;
+ vertices[2].u = 0.0f;
+ vertices[2].v = 0.0f;
+
+ vertices[3].x = minx;
+ vertices[3].y = maxy;
+ vertices[3].z = 0.0f;
+ vertices[3].color = color;
+ vertices[3].u = 0.0f;
+ vertices[3].v = 0.0f;
+
+ result =
+ IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN,
+ 2, vertices, sizeof(*vertices));
+ if (FAILED(result)) {
+ return D3D_SetError("DrawPrimitiveUP()", result);
+ }
+ }
+ return 0;
+}
+
+static void
+D3D_UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *texturedata, unsigned index)
+{
+ if (texturedata->scaleMode != data->scaleMode[index]) {
+ IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_MINFILTER,
+ texturedata->scaleMode);
+ IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_MAGFILTER,
+ texturedata->scaleMode);
+ IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSU,
+ D3DTADDRESS_CLAMP);
+ IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSV,
+ D3DTADDRESS_CLAMP);
+ data->scaleMode[index] = texturedata->scaleMode;
+ }
+}
+
+static int
+D3D_RenderSetupTextureState(SDL_Renderer * renderer, SDL_Texture * texture, LPDIRECT3DPIXELSHADER9 *shader)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ D3D_TextureData *texturedata;
+
+ *shader = NULL;
+
+ texturedata = (D3D_TextureData *)texture->driverdata;
+ if (!texturedata) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ D3D_UpdateTextureScaleMode(data, texturedata, 0);
+
+ if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
+ return -1;
+ }
+
+ if (texturedata->yuv) {
+ switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ *shader = data->shaders[SHADER_YUV_JPEG];
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ *shader = data->shaders[SHADER_YUV_BT601];
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ *shader = data->shaders[SHADER_YUV_BT709];
+ break;
+ default:
+ return SDL_SetError("Unsupported YUV conversion mode");
+ }
+
+ D3D_UpdateTextureScaleMode(data, texturedata, 1);
+ D3D_UpdateTextureScaleMode(data, texturedata, 2);
+
+ if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
+ return -1;
+ }
+ if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ LPDIRECT3DPIXELSHADER9 shader;
+ float minx, miny, maxx, maxy;
+ float minu, maxu, minv, maxv;
+ DWORD color;
+ Vertex vertices[4];
+ HRESULT result;
+
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ minx = dstrect->x - 0.5f;
+ miny = dstrect->y - 0.5f;
+ maxx = dstrect->x + dstrect->w - 0.5f;
+ maxy = dstrect->y + dstrect->h - 0.5f;
+
+ minu = (float) srcrect->x / texture->w;
+ maxu = (float) (srcrect->x + srcrect->w) / texture->w;
+ minv = (float) srcrect->y / texture->h;
+ maxv = (float) (srcrect->y + srcrect->h) / texture->h;
+
+ color = D3DCOLOR_ARGB(texture->a, texture->r, texture->g, texture->b);
+
+ vertices[0].x = minx;
+ vertices[0].y = miny;
+ vertices[0].z = 0.0f;
+ vertices[0].color = color;
+ vertices[0].u = minu;
+ vertices[0].v = minv;
+
+ vertices[1].x = maxx;
+ vertices[1].y = miny;
+ vertices[1].z = 0.0f;
+ vertices[1].color = color;
+ vertices[1].u = maxu;
+ vertices[1].v = minv;
+
+ vertices[2].x = maxx;
+ vertices[2].y = maxy;
+ vertices[2].z = 0.0f;
+ vertices[2].color = color;
+ vertices[2].u = maxu;
+ vertices[2].v = maxv;
+
+ vertices[3].x = minx;
+ vertices[3].y = maxy;
+ vertices[3].z = 0.0f;
+ vertices[3].color = color;
+ vertices[3].u = minu;
+ vertices[3].v = maxv;
+
+ D3D_SetBlendMode(data, texture->blendMode);
+
+ if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) {
+ return -1;
+ }
+
+ if (shader) {
+ result = IDirect3DDevice9_SetPixelShader(data->device, shader);
+ if (FAILED(result)) {
+ return D3D_SetError("SetShader()", result);
+ }
+ }
+ result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
+ vertices, sizeof(*vertices));
+ if (FAILED(result)) {
+ D3D_SetError("DrawPrimitiveUP()", result);
+ }
+ if (shader) {
+ IDirect3DDevice9_SetPixelShader(data->device, NULL);
+ }
+ return FAILED(result) ? -1 : 0;
+}
+
+
+static int
+D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ LPDIRECT3DPIXELSHADER9 shader = NULL;
+ float minx, miny, maxx, maxy;
+ float minu, maxu, minv, maxv;
+ float centerx, centery;
+ DWORD color;
+ Vertex vertices[4];
+ Float4X4 modelMatrix;
+ HRESULT result;
+
+ if (D3D_ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+
+ centerx = center->x;
+ centery = center->y;
+
+ minx = -centerx;
+ maxx = dstrect->w - centerx;
+ miny = -centery;
+ maxy = dstrect->h - centery;
+
+ minu = (float) srcrect->x / texture->w;
+ maxu = (float) (srcrect->x + srcrect->w) / texture->w;
+ minv = (float) srcrect->y / texture->h;
+ maxv = (float) (srcrect->y + srcrect->h) / texture->h;
+
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ float tmp = maxu;
+ maxu = minu;
+ minu = tmp;
+ }
+ if (flip & SDL_FLIP_VERTICAL) {
+ float tmp = maxv;
+ maxv = minv;
+ minv = tmp;
+ }
+
+ color = D3DCOLOR_ARGB(texture->a, texture->r, texture->g, texture->b);
+
+ vertices[0].x = minx;
+ vertices[0].y = miny;
+ vertices[0].z = 0.0f;
+ vertices[0].color = color;
+ vertices[0].u = minu;
+ vertices[0].v = minv;
+
+ vertices[1].x = maxx;
+ vertices[1].y = miny;
+ vertices[1].z = 0.0f;
+ vertices[1].color = color;
+ vertices[1].u = maxu;
+ vertices[1].v = minv;
+
+ vertices[2].x = maxx;
+ vertices[2].y = maxy;
+ vertices[2].z = 0.0f;
+ vertices[2].color = color;
+ vertices[2].u = maxu;
+ vertices[2].v = maxv;
+
+ vertices[3].x = minx;
+ vertices[3].y = maxy;
+ vertices[3].z = 0.0f;
+ vertices[3].color = color;
+ vertices[3].u = minu;
+ vertices[3].v = maxv;
+
+ D3D_SetBlendMode(data, texture->blendMode);
+
+ if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) {
+ return -1;
+ }
+
+ /* Rotate and translate */
+ modelMatrix = MatrixMultiply(
+ MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)),
+ MatrixTranslation(dstrect->x + center->x - 0.5f, dstrect->y + center->y - 0.5f, 0));
+ IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix);
+
+ if (shader) {
+ result = IDirect3DDevice9_SetPixelShader(data->device, shader);
+ if (FAILED(result)) {
+ D3D_SetError("SetShader()", result);
+ goto done;
+ }
+ }
+ result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
+ vertices, sizeof(*vertices));
+ if (FAILED(result)) {
+ D3D_SetError("DrawPrimitiveUP()", result);
+ }
+done:
+ if (shader) {
+ IDirect3DDevice9_SetPixelShader(data->device, NULL);
+ }
+
+ modelMatrix = MatrixIdentity();
+ IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix);
+
+ return FAILED(result) ? -1 : 0;
+}
+
+static int
+D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ D3DSURFACE_DESC desc;
+ LPDIRECT3DSURFACE9 backBuffer;
+ LPDIRECT3DSURFACE9 surface;
+ RECT d3drect;
+ D3DLOCKED_RECT locked;
+ HRESULT result;
+
+ if (data->currentRenderTarget) {
+ backBuffer = data->currentRenderTarget;
+ } else {
+ backBuffer = data->defaultRenderTarget;
+ }
+
+ result = IDirect3DSurface9_GetDesc(backBuffer, &desc);
+ if (FAILED(result)) {
+ IDirect3DSurface9_Release(backBuffer);
+ return D3D_SetError("GetDesc()", result);
+ }
+
+ result = IDirect3DDevice9_CreateOffscreenPlainSurface(data->device, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL);
+ if (FAILED(result)) {
+ IDirect3DSurface9_Release(backBuffer);
+ return D3D_SetError("CreateOffscreenPlainSurface()", result);
+ }
+
+ result = IDirect3DDevice9_GetRenderTargetData(data->device, backBuffer, surface);
+ if (FAILED(result)) {
+ IDirect3DSurface9_Release(surface);
+ IDirect3DSurface9_Release(backBuffer);
+ return D3D_SetError("GetRenderTargetData()", result);
+ }
+
+ d3drect.left = rect->x;
+ d3drect.right = rect->x + rect->w;
+ d3drect.top = rect->y;
+ d3drect.bottom = rect->y + rect->h;
+
+ result = IDirect3DSurface9_LockRect(surface, &locked, &d3drect, D3DLOCK_READONLY);
+ if (FAILED(result)) {
+ IDirect3DSurface9_Release(surface);
+ IDirect3DSurface9_Release(backBuffer);
+ return D3D_SetError("LockRect()", result);
+ }
+
+ SDL_ConvertPixels(rect->w, rect->h,
+ D3DFMTToPixelFormat(desc.Format), locked.pBits, locked.Pitch,
+ format, pixels, pitch);
+
+ IDirect3DSurface9_UnlockRect(surface);
+
+ IDirect3DSurface9_Release(surface);
+
+ return 0;
+}
+
+static void
+D3D_RenderPresent(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+ HRESULT result;
+
+ if (!data->beginScene) {
+ IDirect3DDevice9_EndScene(data->device);
+ data->beginScene = SDL_TRUE;
+ }
+
+ result = IDirect3DDevice9_TestCooperativeLevel(data->device);
+ if (result == D3DERR_DEVICELOST) {
+ /* We'll reset later */
+ return;
+ }
+ if (result == D3DERR_DEVICENOTRESET) {
+ D3D_Reset(renderer);
+ }
+ result = IDirect3DDevice9_Present(data->device, NULL, NULL, NULL, NULL);
+ if (FAILED(result)) {
+ D3D_SetError("Present()", result);
+ }
+}
+
+static void
+D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
+
+ if (!data) {
+ return;
+ }
+ D3D_DestroyTextureRep(&data->texture);
+ D3D_DestroyTextureRep(&data->utexture);
+ D3D_DestroyTextureRep(&data->vtexture);
+ SDL_free(data->pixels);
+ SDL_free(data);
+ texture->driverdata = NULL;
+}
+
+static void
+D3D_DestroyRenderer(SDL_Renderer * renderer)
+{
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+
+ if (data) {
+ int i;
+
+ /* Release the render target */
+ if (data->defaultRenderTarget) {
+ IDirect3DSurface9_Release(data->defaultRenderTarget);
+ data->defaultRenderTarget = NULL;
+ }
+ if (data->currentRenderTarget != NULL) {
+ IDirect3DSurface9_Release(data->currentRenderTarget);
+ data->currentRenderTarget = NULL;
+ }
+ for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
+ if (data->shaders[i]) {
+ IDirect3DPixelShader9_Release(data->shaders[i]);
+ data->shaders[i] = NULL;
+ }
+ }
+ if (data->device) {
+ IDirect3DDevice9_Release(data->device);
+ data->device = NULL;
+ }
+ if (data->d3d) {
+ IDirect3D9_Release(data->d3d);
+ SDL_UnloadObject(data->d3dDLL);
+ }
+ SDL_free(data);
+ }
+ SDL_free(renderer);
+}
+#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
+
+#ifdef __WIN32__
+/* This function needs to always exist on Windows, for the Dynamic API. */
+IDirect3DDevice9 *
+SDL_RenderGetD3D9Device(SDL_Renderer * renderer)
+{
+ IDirect3DDevice9 *device = NULL;
+
+#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
+ D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
+
+ /* Make sure that this is a D3D renderer */
+ if (renderer->DestroyRenderer != D3D_DestroyRenderer) {
+ SDL_SetError("Renderer is not a D3D renderer");
+ return NULL;
+ }
+
+ device = data->device;
+ if (device) {
+ IDirect3DDevice9_AddRef(device);
+ }
+#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
+
+ return device;
+}
+#endif /* __WIN32__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.c b/src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.c
new file mode 100644
index 0000000..b95fddc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.c
@@ -0,0 +1,274 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_render.h"
+#include "SDL_system.h"
+
+#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
+
+#include "../../core/windows/SDL_windows.h"
+
+#include <d3d9.h>
+
+#include "SDL_shaders_d3d.h"
+
+/* The shaders here were compiled with:
+
+ fxc /T ps_2_0 /Fo"<OUTPUT FILE>" "<INPUT FILE>"
+
+ Shader object code was converted to a list of DWORDs via the following
+ *nix style command (available separately from Windows + MSVC):
+
+ hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
+*/
+
+/* --- D3D9_PixelShader_YUV_JPEG.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureU : register(t1);
+ Texture2D theTextureV : register(t2);
+ SamplerState theSampler = sampler_state
+ {
+ addressU = Clamp;
+ addressV = Clamp;
+ mipfilter = NONE;
+ minfilter = LINEAR;
+ magfilter = LINEAR;
+ };
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {0.0, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
+ const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
+ const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+*/
+static const DWORD D3D9_PixelShader_YUV_JPEG[] = {
+ 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
+ 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
+ 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
+ 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
+ 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
+ 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
+ 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
+ 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
+ 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
+ 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
+ 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
+ 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
+ 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
+ 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
+ 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
+ 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
+ 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
+ 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
+ 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
+};
+
+/* --- D3D9_PixelShader_YUV_BT601.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureU : register(t1);
+ Texture2D theTextureV : register(t2);
+ SamplerState theSampler = sampler_state
+ {
+ addressU = Clamp;
+ addressV = Clamp;
+ mipfilter = NONE;
+ minfilter = LINEAR;
+ magfilter = LINEAR;
+ };
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
+ const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
+ const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+*/
+static const DWORD D3D9_PixelShader_YUV_BT601[] = {
+ 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
+ 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
+ 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
+ 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
+ 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
+ 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
+ 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
+ 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
+ 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
+ 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
+ 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
+ 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
+ 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
+ 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
+ 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
+ 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
+ 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
+ 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
+};
+
+/* --- D3D9_PixelShader_YUV_BT709.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureU : register(t1);
+ Texture2D theTextureV : register(t2);
+ SamplerState theSampler = sampler_state
+ {
+ addressU = Clamp;
+ addressV = Clamp;
+ mipfilter = NONE;
+ minfilter = LINEAR;
+ magfilter = LINEAR;
+ };
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
+ const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
+ const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+*/
+static const DWORD D3D9_PixelShader_YUV_BT709[] = {
+ 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
+ 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
+ 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
+ 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
+ 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
+ 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
+ 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
+ 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
+ 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
+ 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
+ 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
+ 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
+ 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
+ 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
+ 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
+ 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
+ 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
+ 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
+};
+
+
+static const DWORD *D3D9_shaders[] = {
+ D3D9_PixelShader_YUV_JPEG,
+ D3D9_PixelShader_YUV_BT601,
+ D3D9_PixelShader_YUV_BT709,
+};
+
+HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader)
+{
+ return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader);
+}
+
+#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.h b/src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.h
new file mode 100644
index 0000000..8549582
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d/SDL_shaders_d3d.h
@@ -0,0 +1,34 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* D3D9 shader implementation */
+
+typedef enum {
+ SHADER_YUV_JPEG,
+ SHADER_YUV_BT601,
+ SHADER_YUV_BT709,
+ NUM_SHADERS
+} D3D9_Shader;
+
+extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_d3d11.c b/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_d3d11.c
new file mode 100644
index 0000000..e0ccfc4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_d3d11.c
@@ -0,0 +1,2570 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
+
+#define COBJMACROS
+#include "../../core/windows/SDL_windows.h"
+#include "SDL_hints.h"
+#include "SDL_loadso.h"
+#include "SDL_syswm.h"
+#include "../SDL_sysrender.h"
+#include "../SDL_d3dmath.h"
+
+#include <d3d11_1.h>
+
+#include "SDL_shaders_d3d11.h"
+
+#ifdef __WINRT__
+
+#if NTDDI_VERSION > NTDDI_WIN8
+#include <DXGI1_3.h>
+#endif
+
+#include "SDL_render_winrt.h"
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#include <windows.ui.xaml.media.dxinterop.h>
+/* TODO, WinRT, XAML: get the ISwapChainBackgroundPanelNative from something other than a global var */
+extern ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative;
+#endif /* WINAPI_FAMILY == WINAPI_FAMILY_APP */
+
+#endif /* __WINRT__ */
+
+
+#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
+
+#define SAFE_RELEASE(X) if ((X)) { IUnknown_Release(SDL_static_cast(IUnknown*, X)); X = NULL; }
+
+
+/* Vertex shader, common values */
+typedef struct
+{
+ Float4X4 model;
+ Float4X4 projectionAndView;
+} VertexShaderConstants;
+
+/* Per-vertex data */
+typedef struct
+{
+ Float3 pos;
+ Float2 tex;
+ Float4 color;
+} VertexPositionColor;
+
+/* Per-texture data */
+typedef struct
+{
+ ID3D11Texture2D *mainTexture;
+ ID3D11ShaderResourceView *mainTextureResourceView;
+ ID3D11RenderTargetView *mainTextureRenderTargetView;
+ ID3D11Texture2D *stagingTexture;
+ int lockedTexturePositionX;
+ int lockedTexturePositionY;
+ D3D11_FILTER scaleMode;
+
+ /* YV12 texture support */
+ SDL_bool yuv;
+ ID3D11Texture2D *mainTextureU;
+ ID3D11ShaderResourceView *mainTextureResourceViewU;
+ ID3D11Texture2D *mainTextureV;
+ ID3D11ShaderResourceView *mainTextureResourceViewV;
+
+ /* NV12 texture support */
+ SDL_bool nv12;
+ ID3D11Texture2D *mainTextureNV;
+ ID3D11ShaderResourceView *mainTextureResourceViewNV;
+
+ Uint8 *pixels;
+ int pitch;
+ SDL_Rect locked_rect;
+} D3D11_TextureData;
+
+/* Blend mode data */
+typedef struct
+{
+ SDL_BlendMode blendMode;
+ ID3D11BlendState *blendState;
+} D3D11_BlendMode;
+
+/* Private renderer data */
+typedef struct
+{
+ void *hDXGIMod;
+ void *hD3D11Mod;
+ IDXGIFactory2 *dxgiFactory;
+ IDXGIAdapter *dxgiAdapter;
+ ID3D11Device1 *d3dDevice;
+ ID3D11DeviceContext1 *d3dContext;
+ IDXGISwapChain1 *swapChain;
+ DXGI_SWAP_EFFECT swapEffect;
+ ID3D11RenderTargetView *mainRenderTargetView;
+ ID3D11RenderTargetView *currentOffscreenRenderTargetView;
+ ID3D11InputLayout *inputLayout;
+ ID3D11Buffer *vertexBuffer;
+ ID3D11VertexShader *vertexShader;
+ ID3D11PixelShader *pixelShaders[NUM_SHADERS];
+ int blendModesCount;
+ D3D11_BlendMode *blendModes;
+ ID3D11SamplerState *nearestPixelSampler;
+ ID3D11SamplerState *linearSampler;
+ D3D_FEATURE_LEVEL featureLevel;
+
+ /* Rasterizers */
+ ID3D11RasterizerState *mainRasterizer;
+ ID3D11RasterizerState *clippedRasterizer;
+
+ /* Vertex buffer constants */
+ VertexShaderConstants vertexShaderConstantsData;
+ ID3D11Buffer *vertexShaderConstants;
+
+ /* Cached renderer properties */
+ DXGI_MODE_ROTATION rotation;
+ ID3D11RenderTargetView *currentRenderTargetView;
+ ID3D11RasterizerState *currentRasterizerState;
+ ID3D11BlendState *currentBlendState;
+ ID3D11PixelShader *currentShader;
+ ID3D11ShaderResourceView *currentShaderResource;
+ ID3D11SamplerState *currentSampler;
+} D3D11_RenderData;
+
+
+/* Define D3D GUIDs here so we don't have to include uuid.lib.
+*
+* Fix for SDL bug https://bugzilla.libsdl.org/show_bug.cgi?id=3437:
+* The extra 'SDL_' was added to the start of each IID's name, in order
+* to prevent build errors on both MinGW-w64 and WinRT/UWP.
+* (SDL bug https://bugzilla.libsdl.org/show_bug.cgi?id=3336 led to
+* linker errors in WinRT/UWP builds.)
+*/
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-const-variable"
+#endif
+
+static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
+static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
+static const GUID SDL_IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
+static const GUID SDL_IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
+static const GUID SDL_IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } };
+static const GUID SDL_IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } };
+static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+
+/* Direct3D 11.1 renderer implementation */
+static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void D3D11_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
+static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *srcPixels,
+ int srcPitch);
+static int D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+static int D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+static int D3D11_UpdateViewport(SDL_Renderer * renderer);
+static int D3D11_UpdateClipRect(SDL_Renderer * renderer);
+static int D3D11_RenderClear(SDL_Renderer * renderer);
+static int D3D11_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int D3D11_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int D3D11_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
+static int D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
+static int D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch);
+static void D3D11_RenderPresent(SDL_Renderer * renderer);
+static void D3D11_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static void D3D11_DestroyRenderer(SDL_Renderer * renderer);
+
+/* Direct3D 11.1 Internal Functions */
+static HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
+static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
+static HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
+static HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
+static void D3D11_ReleaseMainRenderTargetView(SDL_Renderer * renderer);
+
+SDL_RenderDriver D3D11_RenderDriver = {
+ D3D11_CreateRenderer,
+ {
+ "direct3d11",
+ (
+ SDL_RENDERER_ACCELERATED |
+ SDL_RENDERER_PRESENTVSYNC |
+ SDL_RENDERER_TARGETTEXTURE
+ ), /* flags. see SDL_RendererFlags */
+ 6, /* num_texture_formats */
+ { /* texture_formats */
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_RGB888,
+ SDL_PIXELFORMAT_YV12,
+ SDL_PIXELFORMAT_IYUV,
+ SDL_PIXELFORMAT_NV12,
+ SDL_PIXELFORMAT_NV21
+ },
+ 0, /* max_texture_width: will be filled in later */
+ 0 /* max_texture_height: will be filled in later */
+ }
+};
+
+
+Uint32
+D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
+{
+ switch (dxgiFormat) {
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ return SDL_PIXELFORMAT_ARGB8888;
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ return SDL_PIXELFORMAT_RGB888;
+ default:
+ return SDL_PIXELFORMAT_UNKNOWN;
+ }
+}
+
+static DXGI_FORMAT
+SDLPixelFormatToDXGIFormat(Uint32 sdlFormat)
+{
+ switch (sdlFormat) {
+ case SDL_PIXELFORMAT_ARGB8888:
+ return DXGI_FORMAT_B8G8R8A8_UNORM;
+ case SDL_PIXELFORMAT_RGB888:
+ return DXGI_FORMAT_B8G8R8X8_UNORM;
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_NV12: /* For the Y texture */
+ case SDL_PIXELFORMAT_NV21: /* For the Y texture */
+ return DXGI_FORMAT_R8_UNORM;
+ default:
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+SDL_Renderer *
+D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+ SDL_Renderer *renderer;
+ D3D11_RenderData *data;
+
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ data = (D3D11_RenderData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ renderer->WindowEvent = D3D11_WindowEvent;
+ renderer->SupportsBlendMode = D3D11_SupportsBlendMode;
+ renderer->CreateTexture = D3D11_CreateTexture;
+ renderer->UpdateTexture = D3D11_UpdateTexture;
+ renderer->UpdateTextureYUV = D3D11_UpdateTextureYUV;
+ renderer->LockTexture = D3D11_LockTexture;
+ renderer->UnlockTexture = D3D11_UnlockTexture;
+ renderer->SetRenderTarget = D3D11_SetRenderTarget;
+ renderer->UpdateViewport = D3D11_UpdateViewport;
+ renderer->UpdateClipRect = D3D11_UpdateClipRect;
+ renderer->RenderClear = D3D11_RenderClear;
+ renderer->RenderDrawPoints = D3D11_RenderDrawPoints;
+ renderer->RenderDrawLines = D3D11_RenderDrawLines;
+ renderer->RenderFillRects = D3D11_RenderFillRects;
+ renderer->RenderCopy = D3D11_RenderCopy;
+ renderer->RenderCopyEx = D3D11_RenderCopyEx;
+ renderer->RenderReadPixels = D3D11_RenderReadPixels;
+ renderer->RenderPresent = D3D11_RenderPresent;
+ renderer->DestroyTexture = D3D11_DestroyTexture;
+ renderer->DestroyRenderer = D3D11_DestroyRenderer;
+ renderer->info = D3D11_RenderDriver.info;
+ renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
+ renderer->driverdata = data;
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ /* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1.
+ * Failure to use it seems to either result in:
+ *
+ * - with the D3D11 debug runtime turned OFF, vsync seemingly gets turned
+ * off (framerate doesn't get capped), but nothing appears on-screen
+ *
+ * - with the D3D11 debug runtime turned ON, vsync gets automatically
+ * turned back on, and the following gets output to the debug console:
+ *
+ * DXGI ERROR: IDXGISwapChain::Present: Interval 0 is not supported, changed to Interval 1. [ UNKNOWN ERROR #1024: ]
+ */
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+#else
+ if ((flags & SDL_RENDERER_PRESENTVSYNC)) {
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+#endif
+
+ /* HACK: make sure the SDL_Renderer references the SDL_Window data now, in
+ * order to give init functions access to the underlying window handle:
+ */
+ renderer->window = window;
+
+ /* Initialize Direct3D resources */
+ if (FAILED(D3D11_CreateDeviceResources(renderer))) {
+ D3D11_DestroyRenderer(renderer);
+ return NULL;
+ }
+ if (FAILED(D3D11_CreateWindowSizeDependentResources(renderer))) {
+ D3D11_DestroyRenderer(renderer);
+ return NULL;
+ }
+
+ return renderer;
+}
+
+static void
+D3D11_ReleaseAll(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ SDL_Texture *texture = NULL;
+
+ /* Release all textures */
+ for (texture = renderer->textures; texture; texture = texture->next) {
+ D3D11_DestroyTexture(renderer, texture);
+ }
+
+ /* Release/reset everything else */
+ if (data) {
+ int i;
+
+ SAFE_RELEASE(data->dxgiFactory);
+ SAFE_RELEASE(data->dxgiAdapter);
+ SAFE_RELEASE(data->d3dDevice);
+ SAFE_RELEASE(data->d3dContext);
+ SAFE_RELEASE(data->swapChain);
+ SAFE_RELEASE(data->mainRenderTargetView);
+ SAFE_RELEASE(data->currentOffscreenRenderTargetView);
+ SAFE_RELEASE(data->inputLayout);
+ SAFE_RELEASE(data->vertexBuffer);
+ SAFE_RELEASE(data->vertexShader);
+ for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
+ SAFE_RELEASE(data->pixelShaders[i]);
+ }
+ if (data->blendModesCount > 0) {
+ for (i = 0; i < data->blendModesCount; ++i) {
+ SAFE_RELEASE(data->blendModes[i].blendState);
+ }
+ SDL_free(data->blendModes);
+
+ data->blendModesCount = 0;
+ }
+ SAFE_RELEASE(data->nearestPixelSampler);
+ SAFE_RELEASE(data->linearSampler);
+ SAFE_RELEASE(data->mainRasterizer);
+ SAFE_RELEASE(data->clippedRasterizer);
+ SAFE_RELEASE(data->vertexShaderConstants);
+
+ data->swapEffect = (DXGI_SWAP_EFFECT) 0;
+ data->rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
+ data->currentRenderTargetView = NULL;
+ data->currentRasterizerState = NULL;
+ data->currentBlendState = NULL;
+ data->currentShader = NULL;
+ data->currentShaderResource = NULL;
+ data->currentSampler = NULL;
+
+ /* Unload the D3D libraries. This should be done last, in order
+ * to prevent IUnknown::Release() calls from crashing.
+ */
+ if (data->hD3D11Mod) {
+ SDL_UnloadObject(data->hD3D11Mod);
+ data->hD3D11Mod = NULL;
+ }
+ if (data->hDXGIMod) {
+ SDL_UnloadObject(data->hDXGIMod);
+ data->hDXGIMod = NULL;
+ }
+ }
+}
+
+static void
+D3D11_DestroyRenderer(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_ReleaseAll(renderer);
+ if (data) {
+ SDL_free(data);
+ }
+ SDL_free(renderer);
+}
+
+static D3D11_BLEND GetBlendFunc(SDL_BlendFactor factor)
+{
+ switch (factor) {
+ case SDL_BLENDFACTOR_ZERO:
+ return D3D11_BLEND_ZERO;
+ case SDL_BLENDFACTOR_ONE:
+ return D3D11_BLEND_ONE;
+ case SDL_BLENDFACTOR_SRC_COLOR:
+ return D3D11_BLEND_SRC_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
+ return D3D11_BLEND_INV_SRC_COLOR;
+ case SDL_BLENDFACTOR_SRC_ALPHA:
+ return D3D11_BLEND_SRC_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
+ return D3D11_BLEND_INV_SRC_ALPHA;
+ case SDL_BLENDFACTOR_DST_COLOR:
+ return D3D11_BLEND_DEST_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
+ return D3D11_BLEND_INV_DEST_COLOR;
+ case SDL_BLENDFACTOR_DST_ALPHA:
+ return D3D11_BLEND_DEST_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
+ return D3D11_BLEND_INV_DEST_ALPHA;
+ default:
+ return (D3D11_BLEND)0;
+ }
+}
+
+static D3D11_BLEND_OP GetBlendEquation(SDL_BlendOperation operation)
+{
+ switch (operation) {
+ case SDL_BLENDOPERATION_ADD:
+ return D3D11_BLEND_OP_ADD;
+ case SDL_BLENDOPERATION_SUBTRACT:
+ return D3D11_BLEND_OP_SUBTRACT;
+ case SDL_BLENDOPERATION_REV_SUBTRACT:
+ return D3D11_BLEND_OP_REV_SUBTRACT;
+ case SDL_BLENDOPERATION_MINIMUM:
+ return D3D11_BLEND_OP_MIN;
+ case SDL_BLENDOPERATION_MAXIMUM:
+ return D3D11_BLEND_OP_MAX;
+ default:
+ return (D3D11_BLEND_OP)0;
+ }
+}
+
+static SDL_bool
+D3D11_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+ ID3D11BlendState *blendState = NULL;
+ D3D11_BlendMode *blendModes;
+ HRESULT result = S_OK;
+
+ D3D11_BLEND_DESC blendDesc;
+ SDL_zero(blendDesc);
+ blendDesc.AlphaToCoverageEnable = FALSE;
+ blendDesc.IndependentBlendEnable = FALSE;
+ blendDesc.RenderTarget[0].BlendEnable = TRUE;
+ blendDesc.RenderTarget[0].SrcBlend = GetBlendFunc(srcColorFactor);
+ blendDesc.RenderTarget[0].DestBlend = GetBlendFunc(dstColorFactor);
+ blendDesc.RenderTarget[0].BlendOp = GetBlendEquation(colorOperation);
+ blendDesc.RenderTarget[0].SrcBlendAlpha = GetBlendFunc(srcAlphaFactor);
+ blendDesc.RenderTarget[0].DestBlendAlpha = GetBlendFunc(dstAlphaFactor);
+ blendDesc.RenderTarget[0].BlendOpAlpha = GetBlendEquation(alphaOperation);
+ blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
+ result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, &blendState);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBlendState"), result);
+ return SDL_FALSE;
+ }
+
+ blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes));
+ if (!blendModes) {
+ SAFE_RELEASE(blendState);
+ SDL_OutOfMemory();
+ return SDL_FALSE;
+ }
+ blendModes[data->blendModesCount].blendMode = blendMode;
+ blendModes[data->blendModesCount].blendState = blendState;
+ data->blendModes = blendModes;
+ ++data->blendModesCount;
+
+ return SDL_TRUE;
+}
+
+/* Create resources that depend on the device. */
+static HRESULT
+D3D11_CreateDeviceResources(SDL_Renderer * renderer)
+{
+ typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);
+ PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
+ ID3D11Device *d3dDevice = NULL;
+ ID3D11DeviceContext *d3dContext = NULL;
+ IDXGIDevice1 *dxgiDevice = NULL;
+ HRESULT result = S_OK;
+ UINT creationFlags;
+ int i;
+
+ /* This array defines the set of DirectX hardware feature levels this app will support.
+ * Note the ordering should be preserved.
+ * Don't forget to declare your application's minimum required feature level in its
+ * description. All applications are assumed to support 9.1 unless otherwise stated.
+ */
+ D3D_FEATURE_LEVEL featureLevels[] =
+ {
+ D3D_FEATURE_LEVEL_11_1,
+ D3D_FEATURE_LEVEL_11_0,
+ D3D_FEATURE_LEVEL_10_1,
+ D3D_FEATURE_LEVEL_10_0,
+ D3D_FEATURE_LEVEL_9_3,
+ D3D_FEATURE_LEVEL_9_2,
+ D3D_FEATURE_LEVEL_9_1
+ };
+
+ D3D11_BUFFER_DESC constantBufferDesc;
+ D3D11_SAMPLER_DESC samplerDesc;
+ D3D11_RASTERIZER_DESC rasterDesc;
+
+#ifdef __WINRT__
+ CreateDXGIFactoryFunc = CreateDXGIFactory1;
+ D3D11CreateDeviceFunc = D3D11CreateDevice;
+#else
+ data->hDXGIMod = SDL_LoadObject("dxgi.dll");
+ if (!data->hDXGIMod) {
+ result = E_FAIL;
+ goto done;
+ }
+
+ CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
+ if (!CreateDXGIFactoryFunc) {
+ result = E_FAIL;
+ goto done;
+ }
+
+ data->hD3D11Mod = SDL_LoadObject("d3d11.dll");
+ if (!data->hD3D11Mod) {
+ result = E_FAIL;
+ goto done;
+ }
+
+ D3D11CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
+ if (!D3D11CreateDeviceFunc) {
+ result = E_FAIL;
+ goto done;
+ }
+#endif /* __WINRT__ */
+
+ result = CreateDXGIFactoryFunc(&SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result);
+ goto done;
+ }
+
+ /* FIXME: Should we use the default adapter? */
+ result = IDXGIFactory2_EnumAdapters(data->dxgiFactory, 0, &data->dxgiAdapter);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result);
+ goto done;
+ }
+
+ /* This flag adds support for surfaces with a different color channel ordering
+ * than the API default. It is required for compatibility with Direct2D.
+ */
+ creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
+
+ /* Make sure Direct3D's debugging feature gets used, if the app requests it. */
+ if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE)) {
+ creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
+ }
+
+ /* Create the Direct3D 11 API device object and a corresponding context. */
+ result = D3D11CreateDeviceFunc(
+ data->dxgiAdapter,
+ D3D_DRIVER_TYPE_UNKNOWN,
+ NULL,
+ creationFlags, /* Set set debug and Direct2D compatibility flags. */
+ featureLevels, /* List of feature levels this app can support. */
+ SDL_arraysize(featureLevels),
+ D3D11_SDK_VERSION, /* Always set this to D3D11_SDK_VERSION for Windows Store apps. */
+ &d3dDevice, /* Returns the Direct3D device created. */
+ &data->featureLevel, /* Returns feature level of device created. */
+ &d3dContext /* Returns the device immediate context. */
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result);
+ goto done;
+ }
+
+ result = ID3D11Device_QueryInterface(d3dDevice, &SDL_IID_ID3D11Device1, (void **)&data->d3dDevice);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to ID3D11Device1"), result);
+ goto done;
+ }
+
+ result = ID3D11DeviceContext_QueryInterface(d3dContext, &SDL_IID_ID3D11DeviceContext1, (void **)&data->d3dContext);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext to ID3D11DeviceContext1"), result);
+ goto done;
+ }
+
+ result = ID3D11Device_QueryInterface(d3dDevice, &SDL_IID_IDXGIDevice1, (void **)&dxgiDevice);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to IDXGIDevice1"), result);
+ goto done;
+ }
+
+ /* Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
+ * ensures that the application will only render after each VSync, minimizing power consumption.
+ */
+ result = IDXGIDevice1_SetMaximumFrameLatency(dxgiDevice, 1);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIDevice1::SetMaximumFrameLatency"), result);
+ goto done;
+ }
+
+ /* Make note of the maximum texture size
+ * Max texture sizes are documented on MSDN, at:
+ * http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
+ */
+ switch (data->featureLevel) {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
+ break;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
+ break;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
+ break;
+
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
+ break;
+
+ default:
+ SDL_SetError("%s, Unexpected feature level: %d", __FUNCTION__, data->featureLevel);
+ result = E_FAIL;
+ goto done;
+ }
+
+ if (D3D11_CreateVertexShader(data->d3dDevice, &data->vertexShader, &data->inputLayout) < 0) {
+ goto done;
+ }
+
+ for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
+ if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) {
+ goto done;
+ }
+ }
+
+ /* Setup space to hold vertex shader constants: */
+ SDL_zero(constantBufferDesc);
+ constantBufferDesc.ByteWidth = sizeof(VertexShaderConstants);
+ constantBufferDesc.Usage = D3D11_USAGE_DEFAULT;
+ constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ result = ID3D11Device_CreateBuffer(data->d3dDevice,
+ &constantBufferDesc,
+ NULL,
+ &data->vertexShaderConstants
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex shader constants]"), result);
+ goto done;
+ }
+
+ /* Create samplers to use when drawing textures: */
+ SDL_zero(samplerDesc);
+ samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
+ samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+ samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+ samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+ samplerDesc.MipLODBias = 0.0f;
+ samplerDesc.MaxAnisotropy = 1;
+ samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
+ samplerDesc.MinLOD = 0.0f;
+ samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
+ result = ID3D11Device_CreateSamplerState(data->d3dDevice,
+ &samplerDesc,
+ &data->nearestPixelSampler
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [nearest-pixel filter]"), result);
+ goto done;
+ }
+
+ samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
+ result = ID3D11Device_CreateSamplerState(data->d3dDevice,
+ &samplerDesc,
+ &data->linearSampler
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [linear filter]"), result);
+ goto done;
+ }
+
+ /* Setup Direct3D rasterizer states */
+ SDL_zero(rasterDesc);
+ rasterDesc.AntialiasedLineEnable = FALSE;
+ rasterDesc.CullMode = D3D11_CULL_NONE;
+ rasterDesc.DepthBias = 0;
+ rasterDesc.DepthBiasClamp = 0.0f;
+ rasterDesc.DepthClipEnable = TRUE;
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
+ rasterDesc.FrontCounterClockwise = FALSE;
+ rasterDesc.MultisampleEnable = FALSE;
+ rasterDesc.ScissorEnable = FALSE;
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->mainRasterizer);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [main rasterizer]"), result);
+ goto done;
+ }
+
+ rasterDesc.ScissorEnable = TRUE;
+ result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->clippedRasterizer);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [clipped rasterizer]"), result);
+ goto done;
+ }
+
+ /* Create blending states: */
+ if (!D3D11_CreateBlendState(renderer, SDL_BLENDMODE_BLEND) ||
+ !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_ADD) ||
+ !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_MOD)) {
+ /* D3D11_CreateBlendMode will set the SDL error, if it fails */
+ goto done;
+ }
+
+ /* Setup render state that doesn't change */
+ ID3D11DeviceContext_IASetInputLayout(data->d3dContext, data->inputLayout);
+ ID3D11DeviceContext_VSSetShader(data->d3dContext, data->vertexShader, NULL, 0);
+ ID3D11DeviceContext_VSSetConstantBuffers(data->d3dContext, 0, 1, &data->vertexShaderConstants);
+
+done:
+ SAFE_RELEASE(d3dDevice);
+ SAFE_RELEASE(d3dContext);
+ SAFE_RELEASE(dxgiDevice);
+ return result;
+}
+
+#ifdef __WIN32__
+
+static DXGI_MODE_ROTATION
+D3D11_GetCurrentRotation()
+{
+ /* FIXME */
+ return DXGI_MODE_ROTATION_IDENTITY;
+}
+
+#endif /* __WIN32__ */
+
+static BOOL
+D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation)
+{
+ switch (rotation) {
+ case DXGI_MODE_ROTATION_ROTATE90:
+ case DXGI_MODE_ROTATION_ROTATE270:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static int
+D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
+ if (data->currentOffscreenRenderTargetView) {
+ return DXGI_MODE_ROTATION_IDENTITY;
+ } else {
+ return data->rotation;
+ }
+}
+
+static int
+D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect, BOOL includeViewportOffset)
+{
+ const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
+ switch (rotation) {
+ case DXGI_MODE_ROTATION_IDENTITY:
+ outRect->left = sdlRect->x;
+ outRect->right = sdlRect->x + sdlRect->w;
+ outRect->top = sdlRect->y;
+ outRect->bottom = sdlRect->y + sdlRect->h;
+ if (includeViewportOffset) {
+ outRect->left += renderer->viewport.x;
+ outRect->right += renderer->viewport.x;
+ outRect->top += renderer->viewport.y;
+ outRect->bottom += renderer->viewport.y;
+ }
+ break;
+ case DXGI_MODE_ROTATION_ROTATE270:
+ outRect->left = sdlRect->y;
+ outRect->right = sdlRect->y + sdlRect->h;
+ outRect->top = renderer->viewport.w - sdlRect->x - sdlRect->w;
+ outRect->bottom = renderer->viewport.w - sdlRect->x;
+ break;
+ case DXGI_MODE_ROTATION_ROTATE180:
+ outRect->left = renderer->viewport.w - sdlRect->x - sdlRect->w;
+ outRect->right = renderer->viewport.w - sdlRect->x;
+ outRect->top = renderer->viewport.h - sdlRect->y - sdlRect->h;
+ outRect->bottom = renderer->viewport.h - sdlRect->y;
+ break;
+ case DXGI_MODE_ROTATION_ROTATE90:
+ outRect->left = renderer->viewport.h - sdlRect->y - sdlRect->h;
+ outRect->right = renderer->viewport.h - sdlRect->y;
+ outRect->top = sdlRect->x;
+ outRect->bottom = sdlRect->x + sdlRect->h;
+ break;
+ default:
+ return SDL_SetError("The physical display is in an unknown or unsupported rotation");
+ }
+ return 0;
+}
+
+static HRESULT
+D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
+#ifdef __WINRT__
+ IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
+ const BOOL usingXAML = (coreWindow == NULL);
+#else
+ IUnknown *coreWindow = NULL;
+ const BOOL usingXAML = FALSE;
+#endif
+ HRESULT result = S_OK;
+
+ /* Create a swap chain using the same adapter as the existing Direct3D device. */
+ DXGI_SWAP_CHAIN_DESC1 swapChainDesc;
+ SDL_zero(swapChainDesc);
+ swapChainDesc.Width = w;
+ swapChainDesc.Height = h;
+ swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; /* This is the most common swap chain format. */
+ swapChainDesc.Stereo = FALSE;
+ swapChainDesc.SampleDesc.Count = 1; /* Don't use multi-sampling. */
+ swapChainDesc.SampleDesc.Quality = 0;
+ swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ swapChainDesc.BufferCount = 2; /* Use double-buffering to minimize latency. */
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH; /* On phone, only stretch and aspect-ratio stretch scaling are allowed. */
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; /* On phone, no swap effects are supported. */
+ /* TODO, WinRT: see if Win 8.x DXGI_SWAP_CHAIN_DESC1 settings are available on Windows Phone 8.1, and if there's any advantage to having them on */
+#else
+ if (usingXAML) {
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
+ } else {
+ swapChainDesc.Scaling = DXGI_SCALING_NONE;
+ }
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; /* All Windows Store apps must use this SwapEffect. */
+#endif
+ swapChainDesc.Flags = 0;
+
+ if (coreWindow) {
+ result = IDXGIFactory2_CreateSwapChainForCoreWindow(data->dxgiFactory,
+ (IUnknown *)data->d3dDevice,
+ coreWindow,
+ &swapChainDesc,
+ NULL, /* Allow on all displays. */
+ &data->swapChain
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForCoreWindow"), result);
+ goto done;
+ }
+ } else if (usingXAML) {
+ result = IDXGIFactory2_CreateSwapChainForComposition(data->dxgiFactory,
+ (IUnknown *)data->d3dDevice,
+ &swapChainDesc,
+ NULL,
+ &data->swapChain);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForComposition"), result);
+ goto done;
+ }
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+ result = ISwapChainBackgroundPanelNative_SetSwapChain(WINRT_GlobalSwapChainBackgroundPanelNative, (IDXGISwapChain *) data->swapChain);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ISwapChainBackgroundPanelNative::SetSwapChain"), result);
+ goto done;
+ }
+#else
+ SDL_SetError(SDL_COMPOSE_ERROR("XAML support is not yet available for Windows Phone"));
+ result = E_FAIL;
+ goto done;
+#endif
+ } else {
+#ifdef __WIN32__
+ SDL_SysWMinfo windowinfo;
+ SDL_VERSION(&windowinfo.version);
+ SDL_GetWindowWMInfo(renderer->window, &windowinfo);
+
+ result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
+ (IUnknown *)data->d3dDevice,
+ windowinfo.info.win.window,
+ &swapChainDesc,
+ NULL,
+ NULL, /* Allow on all displays. */
+ &data->swapChain
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForHwnd"), result);
+ goto done;
+ }
+
+ IDXGIFactory_MakeWindowAssociation(data->dxgiFactory, windowinfo.info.win.window, DXGI_MWA_NO_WINDOW_CHANGES);
+#else
+ SDL_SetError(__FUNCTION__", Unable to find something to attach a swap chain to");
+ goto done;
+#endif /* ifdef __WIN32__ / else */
+ }
+ data->swapEffect = swapChainDesc.SwapEffect;
+
+done:
+ SAFE_RELEASE(coreWindow);
+ return result;
+}
+
+
+/* Initialize all resources that change when the window's size changes. */
+static HRESULT
+D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
+ ID3D11Texture2D *backBuffer = NULL;
+ HRESULT result = S_OK;
+ int w, h;
+
+ /* Release the previous render target view */
+ D3D11_ReleaseMainRenderTargetView(renderer);
+
+ /* The width and height of the swap chain must be based on the display's
+ * non-rotated size.
+ */
+ SDL_GetWindowSize(renderer->window, &w, &h);
+ data->rotation = D3D11_GetCurrentRotation();
+ /* SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); */
+ if (D3D11_IsDisplayRotated90Degrees(data->rotation)) {
+ int tmp = w;
+ w = h;
+ h = tmp;
+ }
+
+ if (data->swapChain) {
+ /* IDXGISwapChain::ResizeBuffers is not available on Windows Phone 8. */
+#if !defined(__WINRT__) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+ /* If the swap chain already exists, resize it. */
+ result = IDXGISwapChain_ResizeBuffers(data->swapChain,
+ 0,
+ w, h,
+ DXGI_FORMAT_UNKNOWN,
+ 0
+ );
+ if (result == DXGI_ERROR_DEVICE_REMOVED) {
+ /* If the device was removed for any reason, a new device and swap chain will need to be created. */
+ D3D11_HandleDeviceLost(renderer);
+
+ /* Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method
+ * and correctly set up the new device.
+ */
+ goto done;
+ } else if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::ResizeBuffers"), result);
+ goto done;
+ }
+#endif
+ } else {
+ result = D3D11_CreateSwapChain(renderer, w, h);
+ if (FAILED(result)) {
+ goto done;
+ }
+ }
+
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+ /* Set the proper rotation for the swap chain.
+ *
+ * To note, the call for this, IDXGISwapChain1::SetRotation, is not necessary
+ * on Windows Phone 8.0, nor is it supported there.
+ *
+ * IDXGISwapChain1::SetRotation does seem to be available on Windows Phone 8.1,
+ * however I've yet to find a way to make it work. It might have something to
+ * do with IDXGISwapChain::ResizeBuffers appearing to not being available on
+ * Windows Phone 8.1 (it wasn't on Windows Phone 8.0), but I'm not 100% sure of this.
+ * The call doesn't appear to be entirely necessary though, and is a performance-related
+ * call, at least according to the following page on MSDN:
+ * http://code.msdn.microsoft.com/windowsapps/DXGI-swap-chain-rotation-21d13d71
+ * -- David L.
+ *
+ * TODO, WinRT: reexamine the docs for IDXGISwapChain1::SetRotation, see if might be available, usable, and prudent-to-call on WinPhone 8.1
+ */
+ if (data->swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) {
+ result = IDXGISwapChain1_SetRotation(data->swapChain, data->rotation);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::SetRotation"), result);
+ goto done;
+ }
+ }
+#endif
+
+ result = IDXGISwapChain_GetBuffer(data->swapChain,
+ 0,
+ &SDL_IID_ID3D11Texture2D,
+ (void **)&backBuffer
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::GetBuffer [back-buffer]"), result);
+ goto done;
+ }
+
+ /* Create a render target view of the swap chain back buffer. */
+ result = ID3D11Device_CreateRenderTargetView(data->d3dDevice,
+ (ID3D11Resource *)backBuffer,
+ NULL,
+ &data->mainRenderTargetView
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateRenderTargetView"), result);
+ goto done;
+ }
+
+ if (D3D11_UpdateViewport(renderer) != 0) {
+ /* D3D11_UpdateViewport will set the SDL error if it fails. */
+ result = E_FAIL;
+ goto done;
+ }
+
+done:
+ SAFE_RELEASE(backBuffer);
+ return result;
+}
+
+/* This method is called when the window's size changes. */
+static HRESULT
+D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer)
+{
+ return D3D11_CreateWindowSizeDependentResources(renderer);
+}
+
+HRESULT
+D3D11_HandleDeviceLost(SDL_Renderer * renderer)
+{
+ HRESULT result = S_OK;
+
+ D3D11_ReleaseAll(renderer);
+
+ result = D3D11_CreateDeviceResources(renderer);
+ if (FAILED(result)) {
+ /* D3D11_CreateDeviceResources will set the SDL error */
+ return result;
+ }
+
+ result = D3D11_UpdateForWindowSizeChange(renderer);
+ if (FAILED(result)) {
+ /* D3D11_UpdateForWindowSizeChange will set the SDL error */
+ return result;
+ }
+
+ /* Let the application know that the device has been reset */
+ {
+ SDL_Event event;
+ event.type = SDL_RENDER_DEVICE_RESET;
+ SDL_PushEvent(&event);
+ }
+
+ return S_OK;
+}
+
+void
+D3D11_Trim(SDL_Renderer * renderer)
+{
+#ifdef __WINRT__
+#if NTDDI_VERSION > NTDDI_WIN8
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
+ HRESULT result = S_OK;
+ IDXGIDevice3 *dxgiDevice = NULL;
+
+ result = ID3D11Device_QueryInterface(data->d3dDevice, &SDL_IID_IDXGIDevice3, &dxgiDevice);
+ if (FAILED(result)) {
+ //WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice3", result);
+ return;
+ }
+
+ IDXGIDevice3_Trim(dxgiDevice);
+ SAFE_RELEASE(dxgiDevice);
+#endif
+#endif
+}
+
+static void
+D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
+ D3D11_UpdateForWindowSizeChange(renderer);
+ }
+}
+
+static SDL_bool
+D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+
+ if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) ||
+ !GetBlendEquation(colorOperation) ||
+ !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) ||
+ !GetBlendEquation(alphaOperation)) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static D3D11_FILTER
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return D3D11_FILTER_MIN_MAG_MIP_POINT;
+ } else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
+ return D3D11_FILTER_MIN_MAG_MIP_LINEAR;
+ }
+}
+
+static int
+D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData;
+ HRESULT result;
+ DXGI_FORMAT textureFormat = SDLPixelFormatToDXGIFormat(texture->format);
+ D3D11_TEXTURE2D_DESC textureDesc;
+ D3D11_SHADER_RESOURCE_VIEW_DESC resourceViewDesc;
+
+ if (textureFormat == DXGI_FORMAT_UNKNOWN) {
+ return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified",
+ __FUNCTION__, texture->format);
+ }
+
+ textureData = (D3D11_TextureData*) SDL_calloc(1, sizeof(*textureData));
+ if (!textureData) {
+ SDL_OutOfMemory();
+ return -1;
+ }
+ textureData->scaleMode = GetScaleQuality();
+
+ texture->driverdata = textureData;
+
+ SDL_zero(textureDesc);
+ textureDesc.Width = texture->w;
+ textureDesc.Height = texture->h;
+ textureDesc.MipLevels = 1;
+ textureDesc.ArraySize = 1;
+ textureDesc.Format = textureFormat;
+ textureDesc.SampleDesc.Count = 1;
+ textureDesc.SampleDesc.Quality = 0;
+ textureDesc.MiscFlags = 0;
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ textureDesc.Usage = D3D11_USAGE_DYNAMIC;
+ textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ } else {
+ textureDesc.Usage = D3D11_USAGE_DEFAULT;
+ textureDesc.CPUAccessFlags = 0;
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+ } else {
+ textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ }
+
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
+ &textureDesc,
+ NULL,
+ &textureData->mainTexture
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
+ return -1;
+ }
+
+ if (texture->format == SDL_PIXELFORMAT_YV12 ||
+ texture->format == SDL_PIXELFORMAT_IYUV) {
+ textureData->yuv = SDL_TRUE;
+
+ textureDesc.Width = (textureDesc.Width + 1) / 2;
+ textureDesc.Height = (textureDesc.Height + 1) / 2;
+
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
+ &textureDesc,
+ NULL,
+ &textureData->mainTextureU
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
+ return -1;
+ }
+
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
+ &textureDesc,
+ NULL,
+ &textureData->mainTextureV
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
+ return -1;
+ }
+ }
+
+ if (texture->format == SDL_PIXELFORMAT_NV12 ||
+ texture->format == SDL_PIXELFORMAT_NV21) {
+ D3D11_TEXTURE2D_DESC nvTextureDesc = textureDesc;
+
+ textureData->nv12 = SDL_TRUE;
+
+ nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM;
+ nvTextureDesc.Width = (textureDesc.Width + 1) / 2;
+ nvTextureDesc.Height = (textureDesc.Height + 1) / 2;
+
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
+ &nvTextureDesc,
+ NULL,
+ &textureData->mainTextureNV
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
+ return -1;
+ }
+ }
+
+ resourceViewDesc.Format = textureDesc.Format;
+ resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ resourceViewDesc.Texture2D.MostDetailedMip = 0;
+ resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels;
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
+ (ID3D11Resource *)textureData->mainTexture,
+ &resourceViewDesc,
+ &textureData->mainTextureResourceView
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
+ return -1;
+ }
+
+ if (textureData->yuv) {
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
+ (ID3D11Resource *)textureData->mainTextureU,
+ &resourceViewDesc,
+ &textureData->mainTextureResourceViewU
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
+ return -1;
+ }
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
+ (ID3D11Resource *)textureData->mainTextureV,
+ &resourceViewDesc,
+ &textureData->mainTextureResourceViewV
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
+ return -1;
+ }
+ }
+
+ if (textureData->nv12) {
+ D3D11_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc;
+
+ nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM;
+
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
+ (ID3D11Resource *)textureData->mainTextureNV,
+ &nvResourceViewDesc,
+ &textureData->mainTextureResourceViewNV
+ );
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
+ return -1;
+ }
+ }
+
+ if (texture->access & SDL_TEXTUREACCESS_TARGET) {
+ D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
+ renderTargetViewDesc.Format = textureDesc.Format;
+ renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ renderTargetViewDesc.Texture2D.MipSlice = 0;
+
+ result = ID3D11Device_CreateRenderTargetView(rendererData->d3dDevice,
+ (ID3D11Resource *)textureData->mainTexture,
+ &renderTargetViewDesc,
+ &textureData->mainTextureRenderTargetView);
+ if (FAILED(result)) {
+ D3D11_DestroyTexture(renderer, texture);
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static void
+D3D11_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture)
+{
+ D3D11_TextureData *data = (D3D11_TextureData *)texture->driverdata;
+
+ if (!data) {
+ return;
+ }
+
+ SAFE_RELEASE(data->mainTexture);
+ SAFE_RELEASE(data->mainTextureResourceView);
+ SAFE_RELEASE(data->mainTextureRenderTargetView);
+ SAFE_RELEASE(data->stagingTexture);
+ SAFE_RELEASE(data->mainTextureU);
+ SAFE_RELEASE(data->mainTextureResourceViewU);
+ SAFE_RELEASE(data->mainTextureV);
+ SAFE_RELEASE(data->mainTextureResourceViewV);
+ SDL_free(data->pixels);
+ SDL_free(data);
+ texture->driverdata = NULL;
+}
+
+static int
+D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch)
+{
+ ID3D11Texture2D *stagingTexture;
+ const Uint8 *src;
+ Uint8 *dst;
+ int row;
+ UINT length;
+ HRESULT result;
+ D3D11_TEXTURE2D_DESC stagingTextureDesc;
+ D3D11_MAPPED_SUBRESOURCE textureMemory;
+
+ /* Create a 'staging' texture, which will be used to write to a portion of the main texture. */
+ ID3D11Texture2D_GetDesc(texture, &stagingTextureDesc);
+ stagingTextureDesc.Width = w;
+ stagingTextureDesc.Height = h;
+ stagingTextureDesc.BindFlags = 0;
+ stagingTextureDesc.MiscFlags = 0;
+ stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
+ &stagingTextureDesc,
+ NULL,
+ &stagingTexture);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
+ return -1;
+ }
+
+ /* Get a write-only pointer to data in the staging texture: */
+ result = ID3D11DeviceContext_Map(rendererData->d3dContext,
+ (ID3D11Resource *)stagingTexture,
+ 0,
+ D3D11_MAP_WRITE,
+ 0,
+ &textureMemory
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
+ SAFE_RELEASE(stagingTexture);
+ return -1;
+ }
+
+ src = (const Uint8 *)pixels;
+ dst = textureMemory.pData;
+ length = w * bpp;
+ if (length == pitch && length == textureMemory.RowPitch) {
+ SDL_memcpy(dst, src, length*h);
+ } else {
+ if (length > (UINT)pitch) {
+ length = pitch;
+ }
+ if (length > textureMemory.RowPitch) {
+ length = textureMemory.RowPitch;
+ }
+ for (row = 0; row < h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += textureMemory.RowPitch;
+ }
+ }
+
+ /* Commit the pixel buffer's changes back to the staging texture: */
+ ID3D11DeviceContext_Unmap(rendererData->d3dContext,
+ (ID3D11Resource *)stagingTexture,
+ 0);
+
+ /* Copy the staging texture's contents back to the texture: */
+ ID3D11DeviceContext_CopySubresourceRegion(rendererData->d3dContext,
+ (ID3D11Resource *)texture,
+ 0,
+ x,
+ y,
+ 0,
+ (ID3D11Resource *)stagingTexture,
+ 0,
+ NULL);
+
+ SAFE_RELEASE(stagingTexture);
+
+ return 0;
+}
+
+static int
+D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void * srcPixels,
+ int srcPitch)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
+
+ if (!textureData) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) {
+ return -1;
+ }
+
+ if (textureData->yuv) {
+ /* Skip to the correct offset into the next texture */
+ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
+
+ if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) {
+ return -1;
+ }
+
+ /* Skip to the correct offset into the next texture */
+ srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2));
+ if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) {
+ return -1;
+ }
+ }
+
+ if (textureData->nv12) {
+ /* Skip to the correct offset into the next texture */
+ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
+
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2)) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
+
+ if (!textureData) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
+ return -1;
+ }
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) {
+ return -1;
+ }
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+static int
+D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
+ HRESULT result = S_OK;
+ D3D11_TEXTURE2D_DESC stagingTextureDesc;
+ D3D11_MAPPED_SUBRESOURCE textureMemory;
+
+ if (!textureData) {
+ SDL_SetError("Texture is not currently available");
+ return -1;
+ }
+
+ if (textureData->yuv || textureData->nv12) {
+ /* It's more efficient to upload directly... */
+ if (!textureData->pixels) {
+ textureData->pitch = texture->w;
+ textureData->pixels = (Uint8 *)SDL_malloc((texture->h * textureData->pitch * 3) / 2);
+ if (!textureData->pixels) {
+ return SDL_OutOfMemory();
+ }
+ }
+ textureData->locked_rect = *rect;
+ *pixels =
+ (void *)((Uint8 *)textureData->pixels + rect->y * textureData->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = textureData->pitch;
+ return 0;
+ }
+
+ if (textureData->stagingTexture) {
+ return SDL_SetError("texture is already locked");
+ }
+
+ /* Create a 'staging' texture, which will be used to write to a portion
+ * of the main texture. This is necessary, as Direct3D 11.1 does not
+ * have the ability to write a CPU-bound pixel buffer to a rectangular
+ * subrect of a texture. Direct3D 11.1 can, however, write a pixel
+ * buffer to an entire texture, hence the use of a staging texture.
+ *
+ * TODO, WinRT: consider avoiding the use of a staging texture in D3D11_LockTexture if/when the entire texture is being updated
+ */
+ ID3D11Texture2D_GetDesc(textureData->mainTexture, &stagingTextureDesc);
+ stagingTextureDesc.Width = rect->w;
+ stagingTextureDesc.Height = rect->h;
+ stagingTextureDesc.BindFlags = 0;
+ stagingTextureDesc.MiscFlags = 0;
+ stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
+ &stagingTextureDesc,
+ NULL,
+ &textureData->stagingTexture);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
+ return -1;
+ }
+
+ /* Get a write-only pointer to data in the staging texture: */
+ result = ID3D11DeviceContext_Map(rendererData->d3dContext,
+ (ID3D11Resource *)textureData->stagingTexture,
+ 0,
+ D3D11_MAP_WRITE,
+ 0,
+ &textureMemory
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
+ SAFE_RELEASE(textureData->stagingTexture);
+ return -1;
+ }
+
+ /* Make note of where the staging texture will be written to
+ * (on a call to SDL_UnlockTexture):
+ */
+ textureData->lockedTexturePositionX = rect->x;
+ textureData->lockedTexturePositionY = rect->y;
+
+ /* Make sure the caller has information on the texture's pixel buffer,
+ * then return:
+ */
+ *pixels = textureMemory.pData;
+ *pitch = textureMemory.RowPitch;
+ return 0;
+}
+
+static void
+D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
+
+ if (!textureData) {
+ return;
+ }
+
+ if (textureData->yuv || textureData->nv12) {
+ const SDL_Rect *rect = &textureData->locked_rect;
+ void *pixels =
+ (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ D3D11_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch);
+ return;
+ }
+
+ /* Commit the pixel buffer's changes back to the staging texture: */
+ ID3D11DeviceContext_Unmap(rendererData->d3dContext,
+ (ID3D11Resource *)textureData->stagingTexture,
+ 0);
+
+ /* Copy the staging texture's contents back to the main texture: */
+ ID3D11DeviceContext_CopySubresourceRegion(rendererData->d3dContext,
+ (ID3D11Resource *)textureData->mainTexture,
+ 0,
+ textureData->lockedTexturePositionX,
+ textureData->lockedTexturePositionY,
+ 0,
+ (ID3D11Resource *)textureData->stagingTexture,
+ 0,
+ NULL);
+
+ SAFE_RELEASE(textureData->stagingTexture);
+}
+
+static int
+D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData = NULL;
+
+ if (texture == NULL) {
+ rendererData->currentOffscreenRenderTargetView = NULL;
+ return 0;
+ }
+
+ textureData = (D3D11_TextureData *) texture->driverdata;
+
+ if (!textureData->mainTextureRenderTargetView) {
+ return SDL_SetError("specified texture is not a render target");
+ }
+
+ rendererData->currentOffscreenRenderTargetView = textureData->mainTextureRenderTargetView;
+
+ return 0;
+}
+
+static void
+D3D11_SetModelMatrix(SDL_Renderer *renderer, const Float4X4 *matrix)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
+
+ if (matrix) {
+ data->vertexShaderConstantsData.model = *matrix;
+ } else {
+ data->vertexShaderConstantsData.model = MatrixIdentity();
+ }
+
+ ID3D11DeviceContext_UpdateSubresource(data->d3dContext,
+ (ID3D11Resource *)data->vertexShaderConstants,
+ 0,
+ NULL,
+ &data->vertexShaderConstantsData,
+ 0,
+ 0
+ );
+}
+
+static int
+D3D11_UpdateViewport(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ Float4X4 projection;
+ Float4X4 view;
+ SDL_FRect orientationAlignedViewport;
+ BOOL swapDimensions;
+ D3D11_VIEWPORT viewport;
+ const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
+
+ if (renderer->viewport.w == 0 || renderer->viewport.h == 0) {
+ /* If the viewport is empty, assume that it is because
+ * SDL_CreateRenderer is calling it, and will call it again later
+ * with a non-empty viewport.
+ */
+ /* SDL_Log("%s, no viewport was set!\n", __FUNCTION__); */
+ return 0;
+ }
+
+ /* Make sure the SDL viewport gets rotated to that of the physical display's rotation.
+ * Keep in mind here that the Y-axis will be been inverted (from Direct3D's
+ * default coordinate system) so rotations will be done in the opposite
+ * direction of the DXGI_MODE_ROTATION enumeration.
+ */
+ switch (rotation) {
+ case DXGI_MODE_ROTATION_IDENTITY:
+ projection = MatrixIdentity();
+ break;
+ case DXGI_MODE_ROTATION_ROTATE270:
+ projection = MatrixRotationZ(SDL_static_cast(float, M_PI * 0.5f));
+ break;
+ case DXGI_MODE_ROTATION_ROTATE180:
+ projection = MatrixRotationZ(SDL_static_cast(float, M_PI));
+ break;
+ case DXGI_MODE_ROTATION_ROTATE90:
+ projection = MatrixRotationZ(SDL_static_cast(float, -M_PI * 0.5f));
+ break;
+ default:
+ return SDL_SetError("An unknown DisplayOrientation is being used");
+ }
+
+ /* Update the view matrix */
+ view.m[0][0] = 2.0f / renderer->viewport.w;
+ view.m[0][1] = 0.0f;
+ view.m[0][2] = 0.0f;
+ view.m[0][3] = 0.0f;
+ view.m[1][0] = 0.0f;
+ view.m[1][1] = -2.0f / renderer->viewport.h;
+ view.m[1][2] = 0.0f;
+ view.m[1][3] = 0.0f;
+ view.m[2][0] = 0.0f;
+ view.m[2][1] = 0.0f;
+ view.m[2][2] = 1.0f;
+ view.m[2][3] = 0.0f;
+ view.m[3][0] = -1.0f;
+ view.m[3][1] = 1.0f;
+ view.m[3][2] = 0.0f;
+ view.m[3][3] = 1.0f;
+
+ /* Combine the projection + view matrix together now, as both only get
+ * set here (as of this writing, on Dec 26, 2013). When done, store it
+ * for eventual transfer to the GPU.
+ */
+ data->vertexShaderConstantsData.projectionAndView = MatrixMultiply(
+ view,
+ projection);
+
+ /* Reset the model matrix */
+ D3D11_SetModelMatrix(renderer, NULL);
+
+ /* Update the Direct3D viewport, which seems to be aligned to the
+ * swap buffer's coordinate space, which is always in either
+ * a landscape mode, for all Windows 8/RT devices, or a portrait mode,
+ * for Windows Phone devices.
+ */
+ swapDimensions = D3D11_IsDisplayRotated90Degrees(rotation);
+ if (swapDimensions) {
+ orientationAlignedViewport.x = (float) renderer->viewport.y;
+ orientationAlignedViewport.y = (float) renderer->viewport.x;
+ orientationAlignedViewport.w = (float) renderer->viewport.h;
+ orientationAlignedViewport.h = (float) renderer->viewport.w;
+ } else {
+ orientationAlignedViewport.x = (float) renderer->viewport.x;
+ orientationAlignedViewport.y = (float) renderer->viewport.y;
+ orientationAlignedViewport.w = (float) renderer->viewport.w;
+ orientationAlignedViewport.h = (float) renderer->viewport.h;
+ }
+ /* TODO, WinRT: get custom viewports working with non-Landscape modes (Portrait, PortraitFlipped, and LandscapeFlipped) */
+
+ viewport.TopLeftX = orientationAlignedViewport.x;
+ viewport.TopLeftY = orientationAlignedViewport.y;
+ viewport.Width = orientationAlignedViewport.w;
+ viewport.Height = orientationAlignedViewport.h;
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ /* SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, viewport.TopLeftX, viewport.TopLeftY, viewport.Width, viewport.Height); */
+ ID3D11DeviceContext_RSSetViewports(data->d3dContext, 1, &viewport);
+
+ return 0;
+}
+
+static int
+D3D11_UpdateClipRect(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+
+ if (!renderer->clipping_enabled) {
+ ID3D11DeviceContext_RSSetScissorRects(data->d3dContext, 0, NULL);
+ } else {
+ D3D11_RECT scissorRect;
+ if (D3D11_GetViewportAlignedD3DRect(renderer, &renderer->clip_rect, &scissorRect, TRUE) != 0) {
+ /* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
+ return -1;
+ }
+ ID3D11DeviceContext_RSSetScissorRects(data->d3dContext, 1, &scissorRect);
+ }
+
+ return 0;
+}
+
+static void
+D3D11_ReleaseMainRenderTargetView(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
+ ID3D11DeviceContext_OMSetRenderTargets(data->d3dContext, 0, NULL, NULL);
+ SAFE_RELEASE(data->mainRenderTargetView);
+}
+
+static ID3D11RenderTargetView *
+D3D11_GetCurrentRenderTargetView(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ if (data->currentOffscreenRenderTargetView) {
+ return data->currentOffscreenRenderTargetView;
+ } else {
+ return data->mainRenderTargetView;
+ }
+}
+
+static int
+D3D11_RenderClear(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ const float colorRGBA[] = {
+ (renderer->r / 255.0f),
+ (renderer->g / 255.0f),
+ (renderer->b / 255.0f),
+ (renderer->a / 255.0f)
+ };
+ ID3D11DeviceContext_ClearRenderTargetView(data->d3dContext,
+ D3D11_GetCurrentRenderTargetView(renderer),
+ colorRGBA
+ );
+ return 0;
+}
+
+static int
+D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
+ const void * vertexData, size_t dataSizeInBytes)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_BUFFER_DESC vertexBufferDesc;
+ HRESULT result = S_OK;
+ D3D11_SUBRESOURCE_DATA vertexBufferData;
+ const UINT stride = sizeof(VertexPositionColor);
+ const UINT offset = 0;
+
+ if (rendererData->vertexBuffer) {
+ ID3D11Buffer_GetDesc(rendererData->vertexBuffer, &vertexBufferDesc);
+ } else {
+ SDL_zero(vertexBufferDesc);
+ }
+
+ if (rendererData->vertexBuffer && vertexBufferDesc.ByteWidth >= dataSizeInBytes) {
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = ID3D11DeviceContext_Map(rendererData->d3dContext,
+ (ID3D11Resource *)rendererData->vertexBuffer,
+ 0,
+ D3D11_MAP_WRITE_DISCARD,
+ 0,
+ &mappedResource
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result);
+ return -1;
+ }
+ SDL_memcpy(mappedResource.pData, vertexData, dataSizeInBytes);
+ ID3D11DeviceContext_Unmap(rendererData->d3dContext, (ID3D11Resource *)rendererData->vertexBuffer, 0);
+ } else {
+ SAFE_RELEASE(rendererData->vertexBuffer);
+
+ vertexBufferDesc.ByteWidth = (UINT) dataSizeInBytes;
+ vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+
+ SDL_zero(vertexBufferData);
+ vertexBufferData.pSysMem = vertexData;
+ vertexBufferData.SysMemPitch = 0;
+ vertexBufferData.SysMemSlicePitch = 0;
+
+ result = ID3D11Device_CreateBuffer(rendererData->d3dDevice,
+ &vertexBufferDesc,
+ &vertexBufferData,
+ &rendererData->vertexBuffer
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result);
+ return -1;
+ }
+
+ ID3D11DeviceContext_IASetVertexBuffers(rendererData->d3dContext,
+ 0,
+ 1,
+ &rendererData->vertexBuffer,
+ &stride,
+ &offset
+ );
+ }
+
+ return 0;
+}
+
+static void
+D3D11_RenderStartDrawOp(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
+ ID3D11RasterizerState *rasterizerState;
+ ID3D11RenderTargetView *renderTargetView = D3D11_GetCurrentRenderTargetView(renderer);
+ if (renderTargetView != rendererData->currentRenderTargetView) {
+ ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext,
+ 1,
+ &renderTargetView,
+ NULL
+ );
+ rendererData->currentRenderTargetView = renderTargetView;
+ }
+
+ if (!renderer->clipping_enabled) {
+ rasterizerState = rendererData->mainRasterizer;
+ } else {
+ rasterizerState = rendererData->clippedRasterizer;
+ }
+ if (rasterizerState != rendererData->currentRasterizerState) {
+ ID3D11DeviceContext_RSSetState(rendererData->d3dContext, rasterizerState);
+ rendererData->currentRasterizerState = rasterizerState;
+ }
+}
+
+static void
+D3D11_RenderSetBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
+ ID3D11BlendState *blendState = NULL;
+ if (blendMode != SDL_BLENDMODE_NONE) {
+ int i;
+ for (i = 0; i < rendererData->blendModesCount; ++i) {
+ if (blendMode == rendererData->blendModes[i].blendMode) {
+ blendState = rendererData->blendModes[i].blendState;
+ break;
+ }
+ }
+ if (!blendState) {
+ if (D3D11_CreateBlendState(renderer, blendMode)) {
+ /* Successfully created the blend state, try again */
+ D3D11_RenderSetBlendMode(renderer, blendMode);
+ }
+ return;
+ }
+ }
+ if (blendState != rendererData->currentBlendState) {
+ ID3D11DeviceContext_OMSetBlendState(rendererData->d3dContext, blendState, 0, 0xFFFFFFFF);
+ rendererData->currentBlendState = blendState;
+ }
+}
+
+static void
+D3D11_SetPixelShader(SDL_Renderer * renderer,
+ ID3D11PixelShader * shader,
+ int numShaderResources,
+ ID3D11ShaderResourceView ** shaderResources,
+ ID3D11SamplerState * sampler)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ ID3D11ShaderResourceView *shaderResource;
+ if (shader != rendererData->currentShader) {
+ ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, shader, NULL, 0);
+ rendererData->currentShader = shader;
+ }
+ if (numShaderResources > 0) {
+ shaderResource = shaderResources[0];
+ } else {
+ shaderResource = NULL;
+ }
+ if (shaderResource != rendererData->currentShaderResource) {
+ ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, numShaderResources, shaderResources);
+ rendererData->currentShaderResource = shaderResource;
+ }
+ if (sampler != rendererData->currentSampler) {
+ ID3D11DeviceContext_PSSetSamplers(rendererData->d3dContext, 0, 1, &sampler);
+ rendererData->currentSampler = sampler;
+ }
+}
+
+static void
+D3D11_RenderFinishDrawOp(SDL_Renderer * renderer,
+ D3D11_PRIMITIVE_TOPOLOGY primitiveTopology,
+ UINT vertexCount)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+
+ ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, primitiveTopology);
+ ID3D11DeviceContext_Draw(rendererData->d3dContext, vertexCount, 0);
+}
+
+static int
+D3D11_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ float r, g, b, a;
+ VertexPositionColor *vertices;
+ int i;
+
+ r = (float)(renderer->r / 255.0f);
+ g = (float)(renderer->g / 255.0f);
+ b = (float)(renderer->b / 255.0f);
+ a = (float)(renderer->a / 255.0f);
+
+ vertices = SDL_stack_alloc(VertexPositionColor, count);
+ for (i = 0; i < count; ++i) {
+ const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } };
+ vertices[i] = v;
+ }
+
+ D3D11_RenderStartDrawOp(renderer);
+ D3D11_RenderSetBlendMode(renderer, renderer->blendMode);
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, (unsigned int)count * sizeof(VertexPositionColor)) != 0) {
+ SDL_stack_free(vertices);
+ return -1;
+ }
+
+ D3D11_SetPixelShader(
+ renderer,
+ rendererData->pixelShaders[SHADER_SOLID],
+ 0,
+ NULL,
+ NULL);
+
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, count);
+ SDL_stack_free(vertices);
+ return 0;
+}
+
+static int
+D3D11_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ float r, g, b, a;
+ VertexPositionColor *vertices;
+ int i;
+
+ r = (float)(renderer->r / 255.0f);
+ g = (float)(renderer->g / 255.0f);
+ b = (float)(renderer->b / 255.0f);
+ a = (float)(renderer->a / 255.0f);
+
+ vertices = SDL_stack_alloc(VertexPositionColor, count);
+ for (i = 0; i < count; ++i) {
+ const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } };
+ vertices[i] = v;
+ }
+
+ D3D11_RenderStartDrawOp(renderer);
+ D3D11_RenderSetBlendMode(renderer, renderer->blendMode);
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, (unsigned int)count * sizeof(VertexPositionColor)) != 0) {
+ SDL_stack_free(vertices);
+ return -1;
+ }
+
+ D3D11_SetPixelShader(
+ renderer,
+ rendererData->pixelShaders[SHADER_SOLID],
+ 0,
+ NULL,
+ NULL);
+
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, count);
+
+ if (points[0].x != points[count - 1].x || points[0].y != points[count - 1].y) {
+ ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+ ID3D11DeviceContext_Draw(rendererData->d3dContext, 1, count - 1);
+ }
+
+ SDL_stack_free(vertices);
+ return 0;
+}
+
+static int
+D3D11_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ float r, g, b, a;
+ int i;
+
+ r = (float)(renderer->r / 255.0f);
+ g = (float)(renderer->g / 255.0f);
+ b = (float)(renderer->b / 255.0f);
+ a = (float)(renderer->a / 255.0f);
+
+ for (i = 0; i < count; ++i) {
+ VertexPositionColor vertices[] = {
+ { { rects[i].x, rects[i].y, 0.0f }, { 0.0f, 0.0f}, {r, g, b, a} },
+ { { rects[i].x, rects[i].y + rects[i].h, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } },
+ { { rects[i].x + rects[i].w, rects[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } },
+ { { rects[i].x + rects[i].w, rects[i].y + rects[i].h, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } },
+ };
+
+ D3D11_RenderStartDrawOp(renderer);
+ D3D11_RenderSetBlendMode(renderer, renderer->blendMode);
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, sizeof(vertices)) != 0) {
+ return -1;
+ }
+
+ D3D11_SetPixelShader(
+ renderer,
+ rendererData->pixelShaders[SHADER_SOLID],
+ 0,
+ NULL,
+ NULL);
+
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, SDL_arraysize(vertices));
+ }
+
+ return 0;
+}
+
+static int
+D3D11_RenderSetupSampler(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
+ ID3D11SamplerState *textureSampler;
+
+ switch (textureData->scaleMode) {
+ case D3D11_FILTER_MIN_MAG_MIP_POINT:
+ textureSampler = rendererData->nearestPixelSampler;
+ break;
+ case D3D11_FILTER_MIN_MAG_MIP_LINEAR:
+ textureSampler = rendererData->linearSampler;
+ break;
+ default:
+ return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
+ }
+
+ if (textureData->yuv) {
+ ID3D11ShaderResourceView *shaderResources[] = {
+ textureData->mainTextureResourceView,
+ textureData->mainTextureResourceViewU,
+ textureData->mainTextureResourceViewV
+ };
+ D3D11_Shader shader;
+
+ switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ shader = SHADER_YUV_JPEG;
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ shader = SHADER_YUV_BT601;
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ shader = SHADER_YUV_BT709;
+ break;
+ default:
+ return SDL_SetError("Unsupported YUV conversion mode");
+ }
+
+ D3D11_SetPixelShader(
+ renderer,
+ rendererData->pixelShaders[shader],
+ SDL_arraysize(shaderResources),
+ shaderResources,
+ textureSampler);
+
+ } else if (textureData->nv12) {
+ ID3D11ShaderResourceView *shaderResources[] = {
+ textureData->mainTextureResourceView,
+ textureData->mainTextureResourceViewNV,
+ };
+ D3D11_Shader shader;
+
+ switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG;
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601;
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709;
+ break;
+ default:
+ return SDL_SetError("Unsupported YUV conversion mode");
+ }
+
+ D3D11_SetPixelShader(
+ renderer,
+ rendererData->pixelShaders[shader],
+ SDL_arraysize(shaderResources),
+ shaderResources,
+ textureSampler);
+
+ } else {
+ D3D11_SetPixelShader(
+ renderer,
+ rendererData->pixelShaders[SHADER_RGB],
+ 1,
+ &textureData->mainTextureResourceView,
+ textureSampler);
+ }
+
+ return 0;
+}
+
+static int
+D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
+ float minu, maxu, minv, maxv;
+ Float4 color;
+ VertexPositionColor vertices[4];
+
+ D3D11_RenderStartDrawOp(renderer);
+ D3D11_RenderSetBlendMode(renderer, texture->blendMode);
+
+ minu = (float) srcrect->x / texture->w;
+ maxu = (float) (srcrect->x + srcrect->w) / texture->w;
+ minv = (float) srcrect->y / texture->h;
+ maxv = (float) (srcrect->y + srcrect->h) / texture->h;
+
+ color.x = 1.0f; /* red */
+ color.y = 1.0f; /* green */
+ color.z = 1.0f; /* blue */
+ color.w = 1.0f; /* alpha */
+ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
+ color.x = (float)(texture->r / 255.0f); /* red */
+ color.y = (float)(texture->g / 255.0f); /* green */
+ color.z = (float)(texture->b / 255.0f); /* blue */
+ }
+ if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
+ color.w = (float)(texture->a / 255.0f); /* alpha */
+ }
+
+ vertices[0].pos.x = dstrect->x;
+ vertices[0].pos.y = dstrect->y;
+ vertices[0].pos.z = 0.0f;
+ vertices[0].tex.x = minu;
+ vertices[0].tex.y = minv;
+ vertices[0].color = color;
+
+ vertices[1].pos.x = dstrect->x;
+ vertices[1].pos.y = dstrect->y + dstrect->h;
+ vertices[1].pos.z = 0.0f;
+ vertices[1].tex.x = minu;
+ vertices[1].tex.y = maxv;
+ vertices[1].color = color;
+
+ vertices[2].pos.x = dstrect->x + dstrect->w;
+ vertices[2].pos.y = dstrect->y;
+ vertices[2].pos.z = 0.0f;
+ vertices[2].tex.x = maxu;
+ vertices[2].tex.y = minv;
+ vertices[2].color = color;
+
+ vertices[3].pos.x = dstrect->x + dstrect->w;
+ vertices[3].pos.y = dstrect->y + dstrect->h;
+ vertices[3].pos.z = 0.0f;
+ vertices[3].tex.x = maxu;
+ vertices[3].tex.y = maxv;
+ vertices[3].color = color;
+
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, sizeof(vertices)) != 0) {
+ return -1;
+ }
+
+ if (D3D11_RenderSetupSampler(renderer, texture) < 0) {
+ return -1;
+ }
+
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor));
+
+ return 0;
+}
+
+static int
+D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
+{
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
+ float minu, maxu, minv, maxv;
+ Float4 color;
+ Float4X4 modelMatrix;
+ float minx, maxx, miny, maxy;
+ VertexPositionColor vertices[4];
+
+ D3D11_RenderStartDrawOp(renderer);
+ D3D11_RenderSetBlendMode(renderer, texture->blendMode);
+
+ minu = (float) srcrect->x / texture->w;
+ maxu = (float) (srcrect->x + srcrect->w) / texture->w;
+ minv = (float) srcrect->y / texture->h;
+ maxv = (float) (srcrect->y + srcrect->h) / texture->h;
+
+ color.x = 1.0f; /* red */
+ color.y = 1.0f; /* green */
+ color.z = 1.0f; /* blue */
+ color.w = 1.0f; /* alpha */
+ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
+ color.x = (float)(texture->r / 255.0f); /* red */
+ color.y = (float)(texture->g / 255.0f); /* green */
+ color.z = (float)(texture->b / 255.0f); /* blue */
+ }
+ if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
+ color.w = (float)(texture->a / 255.0f); /* alpha */
+ }
+
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ float tmp = maxu;
+ maxu = minu;
+ minu = tmp;
+ }
+ if (flip & SDL_FLIP_VERTICAL) {
+ float tmp = maxv;
+ maxv = minv;
+ minv = tmp;
+ }
+
+ modelMatrix = MatrixMultiply(
+ MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)),
+ MatrixTranslation(dstrect->x + center->x, dstrect->y + center->y, 0)
+ );
+ D3D11_SetModelMatrix(renderer, &modelMatrix);
+
+ minx = -center->x;
+ maxx = dstrect->w - center->x;
+ miny = -center->y;
+ maxy = dstrect->h - center->y;
+
+ vertices[0].pos.x = minx;
+ vertices[0].pos.y = miny;
+ vertices[0].pos.z = 0.0f;
+ vertices[0].tex.x = minu;
+ vertices[0].tex.y = minv;
+ vertices[0].color = color;
+
+ vertices[1].pos.x = minx;
+ vertices[1].pos.y = maxy;
+ vertices[1].pos.z = 0.0f;
+ vertices[1].tex.x = minu;
+ vertices[1].tex.y = maxv;
+ vertices[1].color = color;
+
+ vertices[2].pos.x = maxx;
+ vertices[2].pos.y = miny;
+ vertices[2].pos.z = 0.0f;
+ vertices[2].tex.x = maxu;
+ vertices[2].tex.y = minv;
+ vertices[2].color = color;
+
+ vertices[3].pos.x = maxx;
+ vertices[3].pos.y = maxy;
+ vertices[3].pos.z = 0.0f;
+ vertices[3].tex.x = maxu;
+ vertices[3].tex.y = maxv;
+ vertices[3].color = color;
+
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, sizeof(vertices)) != 0) {
+ return -1;
+ }
+
+ if (D3D11_RenderSetupSampler(renderer, texture) < 0) {
+ return -1;
+ }
+
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor));
+
+ D3D11_SetModelMatrix(renderer, NULL);
+
+ return 0;
+}
+
+static int
+D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch)
+{
+ D3D11_RenderData * data = (D3D11_RenderData *) renderer->driverdata;
+ ID3D11Texture2D *backBuffer = NULL;
+ ID3D11Texture2D *stagingTexture = NULL;
+ HRESULT result;
+ int status = -1;
+ D3D11_TEXTURE2D_DESC stagingTextureDesc;
+ D3D11_RECT srcRect = {0, 0, 0, 0};
+ D3D11_BOX srcBox;
+ D3D11_MAPPED_SUBRESOURCE textureMemory;
+
+ /* Retrieve a pointer to the back buffer: */
+ result = IDXGISwapChain_GetBuffer(data->swapChain,
+ 0,
+ &SDL_IID_ID3D11Texture2D,
+ (void **)&backBuffer
+ );
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::GetBuffer [get back buffer]"), result);
+ goto done;
+ }
+
+ /* Create a staging texture to copy the screen's data to: */
+ ID3D11Texture2D_GetDesc(backBuffer, &stagingTextureDesc);
+ stagingTextureDesc.Width = rect->w;
+ stagingTextureDesc.Height = rect->h;
+ stagingTextureDesc.BindFlags = 0;
+ stagingTextureDesc.MiscFlags = 0;
+ stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+ stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
+ result = ID3D11Device_CreateTexture2D(data->d3dDevice,
+ &stagingTextureDesc,
+ NULL,
+ &stagingTexture);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
+ goto done;
+ }
+
+ /* Copy the desired portion of the back buffer to the staging texture: */
+ if (D3D11_GetViewportAlignedD3DRect(renderer, rect, &srcRect, FALSE) != 0) {
+ /* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
+ goto done;
+ }
+
+ srcBox.left = srcRect.left;
+ srcBox.right = srcRect.right;
+ srcBox.top = srcRect.top;
+ srcBox.bottom = srcRect.bottom;
+ srcBox.front = 0;
+ srcBox.back = 1;
+ ID3D11DeviceContext_CopySubresourceRegion(data->d3dContext,
+ (ID3D11Resource *)stagingTexture,
+ 0,
+ 0, 0, 0,
+ (ID3D11Resource *)backBuffer,
+ 0,
+ &srcBox);
+
+ /* Map the staging texture's data to CPU-accessible memory: */
+ result = ID3D11DeviceContext_Map(data->d3dContext,
+ (ID3D11Resource *)stagingTexture,
+ 0,
+ D3D11_MAP_READ,
+ 0,
+ &textureMemory);
+ if (FAILED(result)) {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
+ goto done;
+ }
+
+ /* Copy the data into the desired buffer, converting pixels to the
+ * desired format at the same time:
+ */
+ if (SDL_ConvertPixels(
+ rect->w, rect->h,
+ D3D11_DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format),
+ textureMemory.pData,
+ textureMemory.RowPitch,
+ format,
+ pixels,
+ pitch) != 0) {
+ /* When SDL_ConvertPixels fails, it'll have already set the format.
+ * Get the error message, and attach some extra data to it.
+ */
+ char errorMessage[1024];
+ SDL_snprintf(errorMessage, sizeof(errorMessage), "%s, Convert Pixels failed: %s", __FUNCTION__, SDL_GetError());
+ SDL_SetError("%s", errorMessage);
+ goto done;
+ }
+
+ /* Unmap the texture: */
+ ID3D11DeviceContext_Unmap(data->d3dContext,
+ (ID3D11Resource *)stagingTexture,
+ 0);
+
+ status = 0;
+
+done:
+ SAFE_RELEASE(backBuffer);
+ SAFE_RELEASE(stagingTexture);
+ return status;
+}
+
+static void
+D3D11_RenderPresent(SDL_Renderer * renderer)
+{
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
+ UINT syncInterval;
+ UINT presentFlags;
+ HRESULT result;
+ DXGI_PRESENT_PARAMETERS parameters;
+
+ SDL_zero(parameters);
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ syncInterval = 1;
+ presentFlags = 0;
+ result = IDXGISwapChain_Present(data->swapChain, syncInterval, presentFlags);
+#else
+ if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
+ syncInterval = 1;
+ presentFlags = 0;
+ } else {
+ syncInterval = 0;
+ presentFlags = DXGI_PRESENT_DO_NOT_WAIT;
+ }
+
+ /* The application may optionally specify "dirty" or "scroll"
+ * rects to improve efficiency in certain scenarios.
+ * This option is not available on Windows Phone 8, to note.
+ */
+ result = IDXGISwapChain1_Present1(data->swapChain, syncInterval, presentFlags, &parameters);
+#endif
+
+ /* Discard the contents of the render target.
+ * This is a valid operation only when the existing contents will be entirely
+ * overwritten. If dirty or scroll rects are used, this call should be removed.
+ */
+ ID3D11DeviceContext1_DiscardView(data->d3dContext, (ID3D11View*)data->mainRenderTargetView);
+
+ /* When the present flips, it unbinds the current view, so bind it again on the next draw call */
+ data->currentRenderTargetView = NULL;
+
+ if (FAILED(result) && result != DXGI_ERROR_WAS_STILL_DRAWING) {
+ /* If the device was removed either by a disconnect or a driver upgrade, we
+ * must recreate all device resources.
+ *
+ * TODO, WinRT: consider throwing an exception if D3D11_RenderPresent fails, especially if there is a way to salvage debug info from users' machines
+ */
+ if ( result == DXGI_ERROR_DEVICE_REMOVED ) {
+ D3D11_HandleDeviceLost(renderer);
+ } else if (result == DXGI_ERROR_INVALID_CALL) {
+ /* We probably went through a fullscreen <-> windowed transition */
+ D3D11_CreateWindowSizeDependentResources(renderer);
+ } else {
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::Present"), result);
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.cpp b/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.cpp
new file mode 100644
index 0000000..2f2c3e5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.cpp
@@ -0,0 +1,116 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
+
+#include "SDL_syswm.h"
+#include "../../video/winrt/SDL_winrtvideo_cpp.h"
+extern "C" {
+#include "../SDL_sysrender.h"
+}
+
+#include <windows.ui.core.h>
+#include <windows.graphics.display.h>
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#include <windows.ui.xaml.media.dxinterop.h>
+#endif
+
+using namespace Windows::UI::Core;
+using namespace Windows::Graphics::Display;
+
+#include <DXGI.h>
+
+#include "SDL_render_winrt.h"
+
+
+extern "C" void *
+D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
+{
+ SDL_Window * sdlWindow = renderer->window;
+ if ( ! renderer->window ) {
+ return NULL;
+ }
+
+ SDL_SysWMinfo sdlWindowInfo;
+ SDL_VERSION(&sdlWindowInfo.version);
+ if ( ! SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo) ) {
+ return NULL;
+ }
+
+ if (sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
+ return NULL;
+ }
+
+ if (!sdlWindowInfo.info.winrt.window) {
+ return NULL;
+ }
+
+ ABI::Windows::UI::Core::ICoreWindow *coreWindow = NULL;
+ if (FAILED(sdlWindowInfo.info.winrt.window->QueryInterface(&coreWindow))) {
+ return NULL;
+ }
+
+ IUnknown *coreWindowAsIUnknown = NULL;
+ coreWindow->QueryInterface(&coreWindowAsIUnknown);
+ coreWindow->Release();
+
+ return coreWindowAsIUnknown;
+}
+
+extern "C" DXGI_MODE_ROTATION
+D3D11_GetCurrentRotation()
+{
+ const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
+
+ switch (currentOrientation) {
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ /* Windows Phone rotations */
+ case DisplayOrientations::Landscape:
+ return DXGI_MODE_ROTATION_ROTATE90;
+ case DisplayOrientations::Portrait:
+ return DXGI_MODE_ROTATION_IDENTITY;
+ case DisplayOrientations::LandscapeFlipped:
+ return DXGI_MODE_ROTATION_ROTATE270;
+ case DisplayOrientations::PortraitFlipped:
+ return DXGI_MODE_ROTATION_ROTATE180;
+#else
+ /* Non-Windows-Phone rotations (ex: Windows 8, Windows RT) */
+ case DisplayOrientations::Landscape:
+ return DXGI_MODE_ROTATION_IDENTITY;
+ case DisplayOrientations::Portrait:
+ return DXGI_MODE_ROTATION_ROTATE270;
+ case DisplayOrientations::LandscapeFlipped:
+ return DXGI_MODE_ROTATION_ROTATE180;
+ case DisplayOrientations::PortraitFlipped:
+ return DXGI_MODE_ROTATION_ROTATE90;
+#endif /* WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP */
+ }
+
+ return DXGI_MODE_ROTATION_IDENTITY;
+}
+
+
+#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.h b/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.h
new file mode 100644
index 0000000..7bb8fb7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d11/SDL_render_winrt.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
+
+#include "SDL_render.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void * D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer);
+DXGI_MODE_ROTATION D3D11_GetCurrentRotation();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c b/src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c
new file mode 100644
index 0000000..f1277b9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c
@@ -0,0 +1,1957 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
+
+#include "SDL_stdinc.h"
+
+#define COBJMACROS
+#include "../../core/windows/SDL_windows.h"
+#include <d3d11_1.h>
+
+#include "SDL_shaders_d3d11.h"
+
+#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
+
+
+/* Direct3D 11.x shaders
+
+ SDL's shaders are compiled into SDL itself, to simplify distribution.
+
+ All Direct3D 11.x shaders were compiled with the following:
+
+ fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>"
+
+ Variables:
+ - <TYPE>: the type of shader. A table of utilized shader types is
+ listed below.
+ - <OUTPUT FILE>: where to store compiled output
+ - <INPUT FILE>: where to read shader source code from
+
+ Shader types:
+ - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT
+ - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT
+ - ps_4_0_level_9_3: Pixel shader for Windows Phone 8
+ - vs_4_0_level_9_3: Vertex shader for Windows Phone 8
+
+
+ Shader object code was converted to a list of DWORDs via the following
+ *nix style command (available separately from Windows + MSVC):
+
+ hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
+ */
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+#define D3D11_USE_SHADER_MODEL_4_0_level_9_3
+#else
+#define D3D11_USE_SHADER_MODEL_4_0_level_9_1
+#endif
+
+/* The color-only-rendering pixel shader:
+
+ --- D3D11_PixelShader_Colors.hlsl ---
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ return input.color;
+ }
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_Colors[] = {
+ 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001,
+ 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
+ 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
+ 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
+ 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
+ 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
+ 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
+ 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
+ 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
+ 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
+ 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_Colors[] = {
+ 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001,
+ 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
+ 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
+ 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
+ 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
+ 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
+ 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
+ 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
+ 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
+ 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
+ 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'colors' pixel shader is not defined."
+#endif
+
+/* The texture-rendering pixel shader:
+
+ --- D3D11_PixelShader_Textures.hlsl ---
+ Texture2D theTexture : register(t0);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ return theTexture.Sample(theSampler, input.tex) * input.color;
+ }
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_Textures[] = {
+ 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001,
+ 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
+ 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
+ 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
+ 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000,
+ 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
+ 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
+ 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
+ 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
+ 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
+ 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
+ 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
+ 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
+ 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
+ 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
+ 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
+ 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_Textures[] = {
+ 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001,
+ 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
+ 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
+ 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
+ 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000,
+ 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
+ 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
+ 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
+ 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
+ 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
+ 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
+ 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
+ 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
+ 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
+ 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
+ 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
+ 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'textures' pixel shader is not defined"
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_YUV_JPEG.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureU : register(t1);
+ Texture2D theTextureV : register(t2);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {0.0, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
+ const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
+ const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_YUV_JPEG[] = {
+ 0x43425844, 0x10359e9c, 0x92c3d2c4, 0x00bf0cd5, 0x5ce8c499, 0x00000001,
+ 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
+ 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
+ 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
+ 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
+ 0xa00f0000, 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
+ 0xa00f0001, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051,
+ 0xa00f0002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051,
+ 0xa00f0003, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f,
+ 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
+ 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
+ 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
+ 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
+ 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
+ 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
+ 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
+ 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
+ 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
+ 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
+ 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
+ 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
+ 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
+ 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
+ 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
+ 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
+ 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
+ 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
+ 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
+ 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
+ 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc,
+ 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
+ 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000,
+ 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
+ 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
+ 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
+ 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
+ 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
+ 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
+ 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
+ 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
+ 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
+ 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
+ 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_YUV_JPEG[] = {
+ 0x43425844, 0x616d6673, 0x83174178, 0x15aac25d, 0x2a340487, 0x00000001,
+ 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
+ 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
+ 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
+ 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
+ 0xa00f0000, 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051,
+ 0xa00f0001, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051,
+ 0xa00f0002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f,
+ 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
+ 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
+ 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
+ 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
+ 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
+ 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
+ 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, 0x03000008,
+ 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, 0x80e40000,
+ 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
+ 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
+ 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
+ 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
+ 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
+ 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
+ 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
+ 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
+ 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
+ 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
+ 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
+ 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
+ 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
+ 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000,
+ 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
+ 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
+ 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0,
+ 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
+ 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000,
+ 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
+ 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
+ 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
+ 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
+ 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
+ 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
+ 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
+ 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
+ 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
+ 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
+ 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
+ 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
+ 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
+ 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
+ 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
+ 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
+ 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_YUV_BT601.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureU : register(t1);
+ Texture2D theTextureV : register(t2);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
+ const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
+ const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_YUV_BT601[] = {
+ 0x43425844, 0x628ec838, 0xbe9cec6a, 0xc9ee10bb, 0x63283218, 0x00000001,
+ 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
+ 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
+ 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
+ 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
+ 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
+ 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051,
+ 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051,
+ 0xa00f0003, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f,
+ 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
+ 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
+ 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
+ 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
+ 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
+ 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
+ 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
+ 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
+ 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
+ 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
+ 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
+ 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
+ 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
+ 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
+ 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
+ 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
+ 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
+ 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
+ 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
+ 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba,
+ 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
+ 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000,
+ 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
+ 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
+ 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
+ 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
+ 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
+ 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
+ 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
+ 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
+ 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
+ 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
+ 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
+ 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_YUV_BT601[] = {
+ 0x43425844, 0x692b159b, 0xf58723cc, 0xf4ceac9e, 0x35eec738, 0x00000001,
+ 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
+ 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
+ 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
+ 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
+ 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051,
+ 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051,
+ 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f,
+ 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
+ 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
+ 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
+ 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
+ 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
+ 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
+ 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
+ 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
+ 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
+ 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
+ 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
+ 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
+ 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
+ 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
+ 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
+ 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
+ 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
+ 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
+ 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
+ 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
+ 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
+ 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000,
+ 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
+ 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
+ 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02,
+ 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
+ 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000,
+ 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
+ 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
+ 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
+ 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
+ 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
+ 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
+ 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
+ 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
+ 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
+ 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
+ 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
+ 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
+ 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
+ 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
+ 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
+ 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
+ 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_YUV_BT709.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureU : register(t1);
+ Texture2D theTextureV : register(t2);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
+ const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
+ const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_YUV_BT709[] = {
+ 0x43425844, 0x5045fa84, 0xc2908cce, 0x278dacc3, 0xd4276f8f, 0x00000001,
+ 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
+ 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
+ 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
+ 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
+ 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
+ 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051,
+ 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051,
+ 0xa00f0003, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f,
+ 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
+ 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
+ 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
+ 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
+ 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
+ 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
+ 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
+ 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
+ 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
+ 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
+ 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
+ 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
+ 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
+ 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
+ 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
+ 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
+ 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
+ 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
+ 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
+ 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732,
+ 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
+ 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000,
+ 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
+ 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
+ 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
+ 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
+ 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
+ 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
+ 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
+ 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
+ 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
+ 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
+ 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
+ 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
+ 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
+ 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
+ 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_YUV_BT709[] = {
+ 0x43425844, 0x72d13260, 0xf6c36f65, 0x8b9b28f5, 0x5010733c, 0x00000001,
+ 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
+ 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
+ 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
+ 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
+ 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051,
+ 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051,
+ 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f,
+ 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
+ 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
+ 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
+ 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
+ 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
+ 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
+ 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
+ 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
+ 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
+ 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
+ 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
+ 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
+ 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
+ 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
+ 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
+ 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
+ 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
+ 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
+ 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
+ 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
+ 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
+ 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000,
+ 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
+ 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
+ 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a,
+ 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
+ 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000,
+ 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
+ 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
+ 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
+ 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
+ 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
+ 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
+ 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
+ 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
+ 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
+ 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
+ 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
+ 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
+ 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
+ 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
+ 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
+ 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
+ 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_NV12_JPEG.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureUV : register(t1);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {0.0, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
+ const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
+ const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_NV12_JPEG[] = {
+ 0x43425844, 0x8fb9c77a, 0xe9e39686, 0x62b0e0e9, 0xd2bf8183, 0x00000001,
+ 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4,
+ 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200,
+ 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
+ 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
+ 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000,
+ 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004,
+ 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001,
+ 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003,
+ 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000,
+ 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
+ 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000,
+ 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
+ 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001,
+ 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
+ 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
+ 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001,
+ 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106,
+ 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000,
+ 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f,
+ 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000,
+ 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001,
+ 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42,
+ 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000,
+ 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036,
+ 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2,
+ 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e,
+ 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003,
+ 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003,
+ 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000,
+ 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61,
+ 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478,
+ 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
+ 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036,
+ 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
+ 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
+ 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
+ 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
+ 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
+ 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
+ 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_NV12_JPEG[] = {
+ 0x43425844, 0xe33e5d8b, 0x1b5f6461, 0x1afee99f, 0xcc345c04, 0x00000001,
+ 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
+ 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
+ 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
+ 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001,
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
+ 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001,
+ 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000,
+ 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001,
+ 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000,
+ 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
+ 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
+ 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
+ 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
+ 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
+ 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081,
+ 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
+ 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010,
+ 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000,
+ 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
+ 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000,
+ 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
+ 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
+ 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
+ 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
+ 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
+ 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
+ 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
+ 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
+ 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
+ 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
+ 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
+ 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_NV12_BT601.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureUV : register(t1);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
+ const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
+ const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_NV12_BT601[] = {
+ 0x43425844, 0xd1d24a0c, 0x337c447a, 0x22b55cff, 0xb5c9c74b, 0x00000001,
+ 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4,
+ 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200,
+ 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
+ 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000,
+ 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004,
+ 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001,
+ 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003,
+ 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000,
+ 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
+ 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000,
+ 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
+ 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001,
+ 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
+ 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
+ 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001,
+ 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106,
+ 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000,
+ 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f,
+ 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f,
+ 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001,
+ 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5,
+ 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000,
+ 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036,
+ 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2,
+ 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e,
+ 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003,
+ 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003,
+ 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000,
+ 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61,
+ 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478,
+ 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
+ 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036,
+ 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
+ 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
+ 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
+ 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
+ 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
+ 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
+ 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_NV12_BT601[] = {
+ 0x43425844, 0x84b8b692, 0x589b9edd, 0x51ef2f0b, 0xf7247962, 0x00000001,
+ 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
+ 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
+ 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
+ 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001,
+ 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001,
+ 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
+ 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000,
+ 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
+ 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
+ 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
+ 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
+ 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
+ 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081,
+ 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
+ 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010,
+ 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f,
+ 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
+ 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000,
+ 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
+ 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
+ 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
+ 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
+ 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
+ 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
+ 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
+ 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
+ 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
+ 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
+ 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
+ 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_NV12_BT709.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureUV : register(t1);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
+ const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
+ const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_NV12_BT709[] = {
+ 0x43425844, 0x40d1b8d5, 0xaf4b78b5, 0x907fd0b5, 0xa2d23686, 0x00000001,
+ 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4,
+ 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200,
+ 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
+ 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000,
+ 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004,
+ 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001,
+ 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003,
+ 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000,
+ 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
+ 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000,
+ 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
+ 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001,
+ 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
+ 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
+ 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001,
+ 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106,
+ 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000,
+ 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f,
+ 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f,
+ 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001,
+ 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22,
+ 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000,
+ 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036,
+ 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2,
+ 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e,
+ 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003,
+ 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003,
+ 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
+ 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000,
+ 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61,
+ 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478,
+ 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
+ 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036,
+ 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
+ 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
+ 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
+ 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
+ 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
+ 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
+ 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_NV12_BT709[] = {
+ 0x43425844, 0xa3bba187, 0x71b6afa9, 0x15998682, 0x2d545cae, 0x00000001,
+ 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
+ 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
+ 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
+ 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001,
+ 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001,
+ 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
+ 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000,
+ 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
+ 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
+ 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
+ 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
+ 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
+ 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081,
+ 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
+ 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010,
+ 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f,
+ 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
+ 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000,
+ 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
+ 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
+ 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
+ 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
+ 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
+ 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
+ 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
+ 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
+ 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
+ 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
+ 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
+ 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_NV21_JPEG.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureUV : register(t1);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {0.0, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
+ const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
+ const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_NV21_JPEG[] = {
+ 0x43425844, 0x9c41f579, 0xfd1019d8, 0x7c27e3ae, 0x52e3a5ff, 0x00000001,
+ 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0,
+ 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200,
+ 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
+ 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
+ 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001,
+ 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000,
+ 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001,
+ 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a,
+ 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001,
+ 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001,
+ 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040,
+ 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000,
+ 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555,
+ 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
+ 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
+ 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
+ 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072,
+ 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081,
+ 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086,
+ 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000,
+ 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002,
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042,
+ 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5,
+ 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001,
+ 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001,
+ 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a,
+ 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4,
+ 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100,
+ 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001,
+ 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
+ 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f,
+ 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+ 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349,
+ 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
+ 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c,
+ 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_NV21_JPEG[] = {
+ 0x43425844, 0x5705ccc9, 0xeb57571d, 0x8ce556e0, 0x2adef743, 0x00000001,
+ 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
+ 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
+ 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
+ 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001,
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
+ 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001,
+ 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000,
+ 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001,
+ 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000,
+ 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
+ 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
+ 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
+ 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
+ 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
+ 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081,
+ 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
+ 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010,
+ 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000,
+ 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
+ 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000,
+ 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
+ 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
+ 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
+ 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
+ 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
+ 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
+ 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
+ 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
+ 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
+ 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
+ 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
+ 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_NV21_BT601.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureUV : register(t1);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
+ const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
+ const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_NV21_BT601[] = {
+ 0x43425844, 0x7fc6cfdc, 0xba87a4ff, 0xa72685a6, 0xa051b38c, 0x00000001,
+ 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0,
+ 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200,
+ 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
+ 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001,
+ 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000,
+ 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001,
+ 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a,
+ 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001,
+ 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001,
+ 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040,
+ 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000,
+ 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555,
+ 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
+ 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
+ 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
+ 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072,
+ 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081,
+ 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086,
+ 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000,
+ 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002,
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042,
+ 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce,
+ 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001,
+ 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001,
+ 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a,
+ 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4,
+ 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100,
+ 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001,
+ 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
+ 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f,
+ 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+ 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349,
+ 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
+ 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c,
+ 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_NV21_BT601[] = {
+ 0x43425844, 0x1e92bca4, 0xfeb04e20, 0x3f4226b1, 0xc89c58ad, 0x00000001,
+ 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
+ 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
+ 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
+ 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001,
+ 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001,
+ 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
+ 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000,
+ 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
+ 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
+ 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
+ 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
+ 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
+ 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081,
+ 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
+ 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010,
+ 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f,
+ 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
+ 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000,
+ 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
+ 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
+ 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
+ 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
+ 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
+ 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
+ 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
+ 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
+ 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
+ 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
+ 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
+ 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The yuv-rendering pixel shader:
+
+ --- D3D11_PixelShader_NV21_BT709.hlsl ---
+ Texture2D theTextureY : register(t0);
+ Texture2D theTextureUV : register(t1);
+ SamplerState theSampler : register(s0);
+
+ struct PixelShaderInput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ float4 main(PixelShaderInput input) : SV_TARGET
+ {
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
+ const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
+ const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
+ const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
+
+ float4 Output;
+
+ float3 yuv;
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
+ yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
+
+ yuv += offset;
+ Output.r = dot(yuv, Rcoeff);
+ Output.g = dot(yuv, Gcoeff);
+ Output.b = dot(yuv, Bcoeff);
+ Output.a = 1.0f;
+
+ return Output * input.color;
+ }
+
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_PixelShader_NV21_BT709[] = {
+ 0x43425844, 0x754ba6c4, 0xe321a747, 0x23680787, 0x6bb1bdcc, 0x00000001,
+ 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0,
+ 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200,
+ 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
+ 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
+ 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001,
+ 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000,
+ 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001,
+ 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a,
+ 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001,
+ 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001,
+ 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040,
+ 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000,
+ 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555,
+ 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
+ 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
+ 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
+ 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
+ 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
+ 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072,
+ 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081,
+ 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086,
+ 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000,
+ 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002,
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042,
+ 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190,
+ 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001,
+ 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001,
+ 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a,
+ 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4,
+ 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100,
+ 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005,
+ 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093,
+ 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001,
+ 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
+ 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f,
+ 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+ 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349,
+ 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
+ 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c,
+ 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_PixelShader_NV21_BT709[] = {
+ 0x43425844, 0xb6219b20, 0xb71bbcf7, 0xf361cc45, 0xc4d5f5be, 0x00000001,
+ 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
+ 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
+ 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
+ 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
+ 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001,
+ 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002,
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000,
+ 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
+ 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
+ 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001,
+ 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001,
+ 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
+ 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000,
+ 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
+ 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
+ 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
+ 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
+ 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
+ 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
+ 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
+ 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
+ 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
+ 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
+ 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081,
+ 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
+ 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010,
+ 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f,
+ 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
+ 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000,
+ 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
+ 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
+ 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
+ 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
+ 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
+ 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
+ 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
+ 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
+ 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
+ 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
+ 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
+ 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
+ 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
+};
+#else
+#error "An appropriate 'yuv' pixel shader is not defined."
+#endif
+
+/* The sole vertex shader:
+
+ --- D3D11_VertexShader.hlsl ---
+ #pragma pack_matrix( row_major )
+
+ cbuffer VertexShaderConstants : register(b0)
+ {
+ matrix model;
+ matrix projectionAndView;
+ };
+
+ struct VertexShaderInput
+ {
+ float3 pos : POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ struct VertexShaderOutput
+ {
+ float4 pos : SV_POSITION;
+ float2 tex : TEXCOORD0;
+ float4 color : COLOR0;
+ };
+
+ VertexShaderOutput main(VertexShaderInput input)
+ {
+ VertexShaderOutput output;
+ float4 pos = float4(input.pos, 1.0f);
+
+ // Transform the vertex position into projected space.
+ pos = mul(pos, model);
+ pos = mul(pos, projectionAndView);
+ output.pos = pos;
+
+ // Pass through texture coordinates and color values without transformation
+ output.tex = input.tex;
+ output.color = input.color;
+
+ return output;
+ }
+*/
+#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
+static const DWORD D3D11_VertexShader[] = {
+ 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001,
+ 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
+ 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
+ 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
+ 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200,
+ 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
+ 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
+ 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
+ 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
+ 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
+ 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
+ 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
+ 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
+ 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
+ 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
+ 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
+ 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
+ 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
+ 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
+ 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
+ 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
+ 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
+ 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
+ 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
+ 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
+ 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
+ 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
+ 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
+ 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
+ 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
+ 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
+ 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
+ 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
+ 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
+ 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
+ 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
+ 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
+ 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
+ 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
+ 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
+ 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
+};
+#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
+static const DWORD D3D11_VertexShader[] = {
+ 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001,
+ 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
+ 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
+ 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
+ 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201,
+ 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
+ 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
+ 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
+ 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
+ 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
+ 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
+ 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
+ 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
+ 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
+ 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
+ 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
+ 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
+ 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
+ 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
+ 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
+ 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
+ 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
+ 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
+ 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
+ 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
+ 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
+ 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
+ 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
+ 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
+ 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
+ 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
+ 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
+ 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
+ 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
+ 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
+ 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
+ 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
+ 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
+ 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
+ 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
+ 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
+ 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
+ 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
+ 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
+};
+#else
+#error "An appropriate vertex shader is not defined."
+#endif
+
+static struct
+{
+ const void *shader_data;
+ SIZE_T shader_size;
+} D3D11_shaders[] = {
+ { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) },
+ { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) },
+ { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) },
+ { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) },
+ { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) },
+ { D3D11_PixelShader_NV12_JPEG, sizeof(D3D11_PixelShader_NV12_JPEG) },
+ { D3D11_PixelShader_NV12_BT601, sizeof(D3D11_PixelShader_NV12_BT601) },
+ { D3D11_PixelShader_NV12_BT709, sizeof(D3D11_PixelShader_NV12_BT709) },
+ { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) },
+ { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) },
+ { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) },
+};
+
+int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout)
+{
+ /* Declare how the input layout for SDL's vertex shader will be setup: */
+ const D3D11_INPUT_ELEMENT_DESC vertexDesc[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+ HRESULT result;
+
+ /* Load in SDL's one and only vertex shader: */
+ result = ID3D11Device_CreateVertexShader(d3dDevice,
+ D3D11_VertexShader,
+ sizeof(D3D11_VertexShader),
+ NULL,
+ vertexShader
+ );
+ if (FAILED(result)) {
+ return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result);
+ }
+
+ /* Create an input layout for SDL's vertex shader: */
+ result = ID3D11Device_CreateInputLayout(d3dDevice,
+ vertexDesc,
+ ARRAYSIZE(vertexDesc),
+ D3D11_VertexShader,
+ sizeof(D3D11_VertexShader),
+ inputLayout
+ );
+ if (FAILED(result)) {
+ return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result);
+ }
+ return 0;
+}
+
+int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader)
+{
+ HRESULT result;
+
+ result = ID3D11Device_CreatePixelShader(d3dDevice,
+ D3D11_shaders[shader].shader_data,
+ D3D11_shaders[shader].shader_size,
+ NULL,
+ pixelShader
+ );
+ if (FAILED(result)) {
+ return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader"), result);
+ }
+ return 0;
+}
+
+#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h b/src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h
new file mode 100644
index 0000000..b28b572
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h
@@ -0,0 +1,43 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* D3D11 shader implementation */
+
+typedef enum {
+ SHADER_SOLID,
+ SHADER_RGB,
+ SHADER_YUV_JPEG,
+ SHADER_YUV_BT601,
+ SHADER_YUV_BT709,
+ SHADER_NV12_JPEG,
+ SHADER_NV12_BT601,
+ SHADER_NV12_BT709,
+ SHADER_NV21_JPEG,
+ SHADER_NV21_BT601,
+ SHADER_NV21_BT709,
+ NUM_SHADERS
+} D3D11_Shader;
+
+extern int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout);
+extern int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/metal/SDL_render_metal.m b/src/3rdparty/SDL2/src/render/metal/SDL_render_metal.m
new file mode 100644
index 0000000..f7af72d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/metal/SDL_render_metal.m
@@ -0,0 +1,1429 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED
+
+#include "SDL_hints.h"
+#include "SDL_log.h"
+#include "SDL_assert.h"
+#include "SDL_syswm.h"
+#include "../SDL_sysrender.h"
+
+#ifdef __MACOSX__
+#include "../../video/cocoa/SDL_cocoametalview.h"
+#else
+#include "../../video/uikit/SDL_uikitmetalview.h"
+#endif
+#include <Availability.h>
+#import <Metal/Metal.h>
+#import <QuartzCore/CAMetalLayer.h>
+
+/* Regenerate these with build-metal-shaders.sh */
+#ifdef __MACOSX__
+#include "SDL_shaders_metal_osx.h"
+#else
+#include "SDL_shaders_metal_ios.h"
+#endif
+
+/* Apple Metal renderer implementation */
+
+static SDL_Renderer *METAL_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void METAL_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static int METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
+static SDL_bool METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
+static int METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+static int METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+static int METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+static int METAL_UpdateViewport(SDL_Renderer * renderer);
+static int METAL_UpdateClipRect(SDL_Renderer * renderer);
+static int METAL_RenderClear(SDL_Renderer * renderer);
+static int METAL_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int METAL_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int METAL_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
+static int METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
+static int METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch);
+static void METAL_RenderPresent(SDL_Renderer * renderer);
+static void METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static void METAL_DestroyRenderer(SDL_Renderer * renderer);
+static void *METAL_GetMetalLayer(SDL_Renderer * renderer);
+static void *METAL_GetMetalCommandEncoder(SDL_Renderer * renderer);
+
+SDL_RenderDriver METAL_RenderDriver = {
+ METAL_CreateRenderer,
+ {
+ "metal",
+ (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
+ 6,
+ {
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_ABGR8888,
+ SDL_PIXELFORMAT_YV12,
+ SDL_PIXELFORMAT_IYUV,
+ SDL_PIXELFORMAT_NV12,
+ SDL_PIXELFORMAT_NV21
+ },
+ 0, 0,
+ }
+};
+
+/* macOS requires constants in a buffer to have a 256 byte alignment. */
+#ifdef __MACOSX__
+#define CONSTANT_ALIGN 256
+#else
+#define CONSTANT_ALIGN 4
+#endif
+
+#define ALIGN_CONSTANTS(size) ((size + CONSTANT_ALIGN - 1) & (~(CONSTANT_ALIGN - 1)))
+
+static const size_t CONSTANTS_OFFSET_IDENTITY = 0;
+static const size_t CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM = ALIGN_CONSTANTS(CONSTANTS_OFFSET_IDENTITY + sizeof(float) * 16);
+static const size_t CONSTANTS_OFFSET_DECODE_JPEG = ALIGN_CONSTANTS(CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM + sizeof(float) * 16);
+static const size_t CONSTANTS_OFFSET_DECODE_BT601 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_JPEG + sizeof(float) * 4 * 4);
+static const size_t CONSTANTS_OFFSET_DECODE_BT709 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT601 + sizeof(float) * 4 * 4);
+static const size_t CONSTANTS_OFFSET_CLEAR_VERTS = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT709 + sizeof(float) * 4 * 4);
+static const size_t CONSTANTS_LENGTH = CONSTANTS_OFFSET_CLEAR_VERTS + sizeof(float) * 6;
+
+typedef enum SDL_MetalVertexFunction
+{
+ SDL_METAL_VERTEX_SOLID,
+ SDL_METAL_VERTEX_COPY,
+} SDL_MetalVertexFunction;
+
+typedef enum SDL_MetalFragmentFunction
+{
+ SDL_METAL_FRAGMENT_SOLID = 0,
+ SDL_METAL_FRAGMENT_COPY,
+ SDL_METAL_FRAGMENT_YUV,
+ SDL_METAL_FRAGMENT_NV12,
+ SDL_METAL_FRAGMENT_NV21,
+ SDL_METAL_FRAGMENT_COUNT,
+} SDL_MetalFragmentFunction;
+
+typedef struct METAL_PipelineState
+{
+ SDL_BlendMode blendMode;
+ void *pipe;
+} METAL_PipelineState;
+
+typedef struct METAL_PipelineCache
+{
+ METAL_PipelineState *states;
+ int count;
+ SDL_MetalVertexFunction vertexFunction;
+ SDL_MetalFragmentFunction fragmentFunction;
+ MTLPixelFormat renderTargetFormat;
+ const char *label;
+} METAL_PipelineCache;
+
+/* Each shader combination used by drawing functions has a separate pipeline
+ * cache, and we have a separate list of caches for each render target pixel
+ * format. This is more efficient than iterating over a global cache to find
+ * the pipeline based on the specified shader combination and RT pixel format,
+ * since we know what the RT pixel format is when we set the render target, and
+ * we know what the shader combination is inside each drawing function's code. */
+typedef struct METAL_ShaderPipelines
+{
+ MTLPixelFormat renderTargetFormat;
+ METAL_PipelineCache caches[SDL_METAL_FRAGMENT_COUNT];
+} METAL_ShaderPipelines;
+
+@interface METAL_RenderData : NSObject
+ @property (nonatomic, retain) id<MTLDevice> mtldevice;
+ @property (nonatomic, retain) id<MTLCommandQueue> mtlcmdqueue;
+ @property (nonatomic, retain) id<MTLCommandBuffer> mtlcmdbuffer;
+ @property (nonatomic, retain) id<MTLRenderCommandEncoder> mtlcmdencoder;
+ @property (nonatomic, retain) id<MTLLibrary> mtllibrary;
+ @property (nonatomic, retain) id<CAMetalDrawable> mtlbackbuffer;
+ @property (nonatomic, retain) id<MTLSamplerState> mtlsamplernearest;
+ @property (nonatomic, retain) id<MTLSamplerState> mtlsamplerlinear;
+ @property (nonatomic, retain) id<MTLBuffer> mtlbufconstants;
+ @property (nonatomic, retain) CAMetalLayer *mtllayer;
+ @property (nonatomic, retain) MTLRenderPassDescriptor *mtlpassdesc;
+ @property (nonatomic, assign) METAL_ShaderPipelines *activepipelines;
+ @property (nonatomic, assign) METAL_ShaderPipelines *allpipelines;
+ @property (nonatomic, assign) int pipelinescount;
+@end
+
+@implementation METAL_RenderData
+#if !__has_feature(objc_arc)
+- (void)dealloc
+{
+ [_mtldevice release];
+ [_mtlcmdqueue release];
+ [_mtlcmdbuffer release];
+ [_mtlcmdencoder release];
+ [_mtllibrary release];
+ [_mtlbackbuffer release];
+ [_mtlsamplernearest release];
+ [_mtlsamplerlinear release];
+ [_mtlbufconstants release];
+ [_mtllayer release];
+ [_mtlpassdesc release];
+ [super dealloc];
+}
+#endif
+@end
+
+@interface METAL_TextureData : NSObject
+ @property (nonatomic, retain) id<MTLTexture> mtltexture;
+ @property (nonatomic, retain) id<MTLTexture> mtltexture_uv;
+ @property (nonatomic, retain) id<MTLSamplerState> mtlsampler;
+ @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction;
+ @property (nonatomic, assign) BOOL yuv;
+ @property (nonatomic, assign) BOOL nv12;
+ @property (nonatomic, assign) size_t conversionBufferOffset;
+@end
+
+@implementation METAL_TextureData
+#if !__has_feature(objc_arc)
+- (void)dealloc
+{
+ [_mtltexture release];
+ [_mtltexture_uv release];
+ [_mtlsampler release];
+ [super dealloc];
+}
+#endif
+@end
+
+static int
+IsMetalAvailable(const SDL_SysWMinfo *syswm)
+{
+ if (syswm->subsystem != SDL_SYSWM_COCOA && syswm->subsystem != SDL_SYSWM_UIKIT) {
+ return SDL_SetError("Metal render target only supports Cocoa and UIKit video targets at the moment.");
+ }
+
+ // this checks a weak symbol.
+#if (defined(__MACOSX__) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100))
+ if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower.
+ return SDL_SetError("Metal framework not available on this system");
+ }
+#endif
+
+ return 0;
+}
+
+static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF;
+static const MTLBlendFactor invalidBlendFactor = (MTLBlendFactor)0xFFFFFFFF;
+
+static MTLBlendOperation
+GetBlendOperation(SDL_BlendOperation operation)
+{
+ switch (operation) {
+ case SDL_BLENDOPERATION_ADD: return MTLBlendOperationAdd;
+ case SDL_BLENDOPERATION_SUBTRACT: return MTLBlendOperationSubtract;
+ case SDL_BLENDOPERATION_REV_SUBTRACT: return MTLBlendOperationReverseSubtract;
+ case SDL_BLENDOPERATION_MINIMUM: return MTLBlendOperationMin;
+ case SDL_BLENDOPERATION_MAXIMUM: return MTLBlendOperationMax;
+ default: return invalidBlendOperation;
+ }
+}
+
+static MTLBlendFactor
+GetBlendFactor(SDL_BlendFactor factor)
+{
+ switch (factor) {
+ case SDL_BLENDFACTOR_ZERO: return MTLBlendFactorZero;
+ case SDL_BLENDFACTOR_ONE: return MTLBlendFactorOne;
+ case SDL_BLENDFACTOR_SRC_COLOR: return MTLBlendFactorSourceColor;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: return MTLBlendFactorOneMinusSourceColor;
+ case SDL_BLENDFACTOR_SRC_ALPHA: return MTLBlendFactorSourceAlpha;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: return MTLBlendFactorOneMinusSourceAlpha;
+ case SDL_BLENDFACTOR_DST_COLOR: return MTLBlendFactorDestinationColor;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: return MTLBlendFactorOneMinusDestinationColor;
+ case SDL_BLENDFACTOR_DST_ALPHA: return MTLBlendFactorDestinationAlpha;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return MTLBlendFactorOneMinusDestinationAlpha;
+ default: return invalidBlendFactor;
+ }
+}
+
+static NSString *
+GetVertexFunctionName(SDL_MetalVertexFunction function)
+{
+ switch (function) {
+ case SDL_METAL_VERTEX_SOLID: return @"SDL_Solid_vertex";
+ case SDL_METAL_VERTEX_COPY: return @"SDL_Copy_vertex";
+ default: return nil;
+ }
+}
+
+static NSString *
+GetFragmentFunctionName(SDL_MetalFragmentFunction function)
+{
+ switch (function) {
+ case SDL_METAL_FRAGMENT_SOLID: return @"SDL_Solid_fragment";
+ case SDL_METAL_FRAGMENT_COPY: return @"SDL_Copy_fragment";
+ case SDL_METAL_FRAGMENT_YUV: return @"SDL_YUV_fragment";
+ case SDL_METAL_FRAGMENT_NV12: return @"SDL_NV12_fragment";
+ case SDL_METAL_FRAGMENT_NV21: return @"SDL_NV21_fragment";
+ default: return nil;
+ }
+}
+
+static id<MTLRenderPipelineState>
+MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache,
+ NSString *blendlabel, SDL_BlendMode blendmode)
+{
+ id<MTLFunction> mtlvertfn = [data.mtllibrary newFunctionWithName:GetVertexFunctionName(cache->vertexFunction)];
+ id<MTLFunction> mtlfragfn = [data.mtllibrary newFunctionWithName:GetFragmentFunctionName(cache->fragmentFunction)];
+ SDL_assert(mtlvertfn != nil);
+ SDL_assert(mtlfragfn != nil);
+
+ MTLRenderPipelineDescriptor *mtlpipedesc = [[MTLRenderPipelineDescriptor alloc] init];
+ mtlpipedesc.vertexFunction = mtlvertfn;
+ mtlpipedesc.fragmentFunction = mtlfragfn;
+
+ MTLRenderPipelineColorAttachmentDescriptor *rtdesc = mtlpipedesc.colorAttachments[0];
+
+ rtdesc.pixelFormat = cache->renderTargetFormat;
+
+ if (blendmode != SDL_BLENDMODE_NONE) {
+ rtdesc.blendingEnabled = YES;
+ rtdesc.sourceRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcColorFactor(blendmode));
+ rtdesc.destinationRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeDstColorFactor(blendmode));
+ rtdesc.rgbBlendOperation = GetBlendOperation(SDL_GetBlendModeColorOperation(blendmode));
+ rtdesc.sourceAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcAlphaFactor(blendmode));
+ rtdesc.destinationAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeDstAlphaFactor(blendmode));
+ rtdesc.alphaBlendOperation = GetBlendOperation(SDL_GetBlendModeAlphaOperation(blendmode));
+ } else {
+ rtdesc.blendingEnabled = NO;
+ }
+
+ mtlpipedesc.label = [@(cache->label) stringByAppendingString:blendlabel];
+
+ NSError *err = nil;
+ id<MTLRenderPipelineState> state = [data.mtldevice newRenderPipelineStateWithDescriptor:mtlpipedesc error:&err];
+ SDL_assert(err == nil);
+
+ METAL_PipelineState pipeline;
+ pipeline.blendMode = blendmode;
+ pipeline.pipe = (void *)CFBridgingRetain(state);
+
+ METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline));
+
+#if !__has_feature(objc_arc)
+ [mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it?
+ [mtlvertfn release];
+ [mtlfragfn release];
+ [state release];
+#endif
+
+ if (states) {
+ states[cache->count++] = pipeline;
+ cache->states = states;
+ return (__bridge id<MTLRenderPipelineState>)pipeline.pipe;
+ } else {
+ CFBridgingRelease(pipeline.pipe);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+}
+
+static void
+MakePipelineCache(METAL_RenderData *data, METAL_PipelineCache *cache, const char *label,
+ MTLPixelFormat rtformat, SDL_MetalVertexFunction vertfn, SDL_MetalFragmentFunction fragfn)
+{
+ SDL_zerop(cache);
+
+ cache->vertexFunction = vertfn;
+ cache->fragmentFunction = fragfn;
+ cache->renderTargetFormat = rtformat;
+ cache->label = label;
+
+ /* Create pipeline states for the default blend modes. Custom blend modes
+ * will be added to the cache on-demand. */
+ MakePipelineState(data, cache, @" (blend=none)", SDL_BLENDMODE_NONE);
+ MakePipelineState(data, cache, @" (blend=blend)", SDL_BLENDMODE_BLEND);
+ MakePipelineState(data, cache, @" (blend=add)", SDL_BLENDMODE_ADD);
+ MakePipelineState(data, cache, @" (blend=mod)", SDL_BLENDMODE_MOD);
+}
+
+static void
+DestroyPipelineCache(METAL_PipelineCache *cache)
+{
+ if (cache != NULL) {
+ for (int i = 0; i < cache->count; i++) {
+ CFBridgingRelease(cache->states[i].pipe);
+ }
+
+ SDL_free(cache->states);
+ }
+}
+
+void
+MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, MTLPixelFormat rtformat)
+{
+ SDL_zerop(pipelines);
+
+ pipelines->renderTargetFormat = rtformat;
+
+ MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_SOLID], "SDL primitives pipeline", rtformat, SDL_METAL_VERTEX_SOLID, SDL_METAL_FRAGMENT_SOLID);
+ MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_COPY], "SDL copy pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_COPY);
+ MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_YUV], "SDL YUV pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_YUV);
+ MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV12], "SDL NV12 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV12);
+ MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV21], "SDL NV21 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV21);
+}
+
+static METAL_ShaderPipelines *
+ChooseShaderPipelines(METAL_RenderData *data, MTLPixelFormat rtformat)
+{
+ METAL_ShaderPipelines *allpipelines = data.allpipelines;
+ int count = data.pipelinescount;
+
+ for (int i = 0; i < count; i++) {
+ if (allpipelines[i].renderTargetFormat == rtformat) {
+ return &allpipelines[i];
+ }
+ }
+
+ allpipelines = SDL_realloc(allpipelines, (count + 1) * sizeof(METAL_ShaderPipelines));
+
+ if (allpipelines == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ MakeShaderPipelines(data, &allpipelines[count], rtformat);
+
+ data.allpipelines = allpipelines;
+ data.pipelinescount = count + 1;
+
+ return &data.allpipelines[count];
+}
+
+static void
+DestroyAllPipelines(METAL_ShaderPipelines *allpipelines, int count)
+{
+ if (allpipelines != NULL) {
+ for (int i = 0; i < count; i++) {
+ for (int cache = 0; cache < SDL_METAL_FRAGMENT_COUNT; cache++) {
+ DestroyPipelineCache(&allpipelines[i].caches[cache]);
+ }
+ }
+
+ SDL_free(allpipelines);
+ }
+}
+
+static inline id<MTLRenderPipelineState>
+ChoosePipelineState(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, SDL_MetalFragmentFunction fragfn, SDL_BlendMode blendmode)
+{
+ METAL_PipelineCache *cache = &pipelines->caches[fragfn];
+
+ for (int i = 0; i < cache->count; i++) {
+ if (cache->states[i].blendMode == blendmode) {
+ return (__bridge id<MTLRenderPipelineState>)cache->states[i].pipe;
+ }
+ }
+
+ return MakePipelineState(data, cache, [NSString stringWithFormat:@" (blend=custom 0x%x)", blendmode], blendmode);
+}
+
+static SDL_Renderer *
+METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
+{ @autoreleasepool {
+ SDL_Renderer *renderer = NULL;
+ METAL_RenderData *data = NULL;
+ id<MTLDevice> mtldevice = nil;
+ SDL_SysWMinfo syswm;
+
+ SDL_VERSION(&syswm.version);
+ if (!SDL_GetWindowWMInfo(window, &syswm)) {
+ return NULL;
+ }
+
+ if (IsMetalAvailable(&syswm) == -1) {
+ return NULL;
+ }
+
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ // !!! FIXME: MTLCopyAllDevices() can find other GPUs on macOS...
+ mtldevice = MTLCreateSystemDefaultDevice();
+
+ if (mtldevice == nil) {
+ SDL_free(renderer);
+ SDL_SetError("Failed to obtain Metal device");
+ return NULL;
+ }
+
+ // !!! FIXME: error checking on all of this.
+ data = [[METAL_RenderData alloc] init];
+
+ renderer->driverdata = (void*)CFBridgingRetain(data);
+ renderer->window = window;
+
+#ifdef __MACOSX__
+ NSView *view = Cocoa_Mtl_AddMetalView(window);
+ CAMetalLayer *layer = (CAMetalLayer *)[view layer];
+
+ layer.device = mtldevice;
+
+ //layer.colorspace = nil;
+
+#else
+ UIView *view = UIKit_Mtl_AddMetalView(window);
+ CAMetalLayer *layer = (CAMetalLayer *)[view layer];
+#endif
+
+ // Necessary for RenderReadPixels.
+ layer.framebufferOnly = NO;
+
+ data.mtldevice = layer.device;
+ data.mtllayer = layer;
+ id<MTLCommandQueue> mtlcmdqueue = [data.mtldevice newCommandQueue];
+ data.mtlcmdqueue = mtlcmdqueue;
+ data.mtlcmdqueue.label = @"SDL Metal Renderer";
+ data.mtlpassdesc = [MTLRenderPassDescriptor renderPassDescriptor];
+
+ NSError *err = nil;
+
+ // The compiled .metallib is embedded in a static array in a header file
+ // but the original shader source code is in SDL_shaders_metal.metal.
+ dispatch_data_t mtllibdata = dispatch_data_create(sdl_metallib, sdl_metallib_len, dispatch_get_global_queue(0, 0), ^{});
+ id<MTLLibrary> mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err];
+ data.mtllibrary = mtllibrary;
+ SDL_assert(err == nil);
+#if !__has_feature(objc_arc)
+ dispatch_release(mtllibdata);
+#endif
+ data.mtllibrary.label = @"SDL Metal renderer shader library";
+
+ /* Do some shader pipeline state loading up-front rather than on demand. */
+ data.pipelinescount = 0;
+ data.allpipelines = NULL;
+ ChooseShaderPipelines(data, MTLPixelFormatBGRA8Unorm);
+
+ MTLSamplerDescriptor *samplerdesc = [[MTLSamplerDescriptor alloc] init];
+
+ samplerdesc.minFilter = MTLSamplerMinMagFilterNearest;
+ samplerdesc.magFilter = MTLSamplerMinMagFilterNearest;
+ id<MTLSamplerState> mtlsamplernearest = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc];
+ data.mtlsamplernearest = mtlsamplernearest;
+
+ samplerdesc.minFilter = MTLSamplerMinMagFilterLinear;
+ samplerdesc.magFilter = MTLSamplerMinMagFilterLinear;
+ id<MTLSamplerState> mtlsamplerlinear = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc];
+ data.mtlsamplerlinear = mtlsamplerlinear;
+
+ /* Note: matrices are column major. */
+ float identitytransform[16] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+ };
+
+ float halfpixeltransform[16] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.5f, 0.5f, 0.0f, 1.0f,
+ };
+
+ /* Metal pads float3s to 16 bytes. */
+ float decodetransformJPEG[4*4] = {
+ 0.0, -0.501960814, -0.501960814, 0.0, /* offset */
+ 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */
+ 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */
+ 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */
+ };
+
+ float decodetransformBT601[4*4] = {
+ -0.0627451017, -0.501960814, -0.501960814, 0.0, /* offset */
+ 1.1644, 0.0000, 1.5960, 0.0, /* Rcoeff */
+ 1.1644, -0.3918, -0.8130, 0.0, /* Gcoeff */
+ 1.1644, 2.0172, 0.0000, 0.0, /* Bcoeff */
+ };
+
+ float decodetransformBT709[4*4] = {
+ 0.0, -0.501960814, -0.501960814, 0.0, /* offset */
+ 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */
+ 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */
+ 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */
+ };
+
+ float clearverts[6] = {0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.0f};
+
+ id<MTLBuffer> mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared];
+ mtlbufconstantstaging.label = @"SDL constant staging data";
+
+ id<MTLBuffer> mtlbufconstants = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModePrivate];
+ data.mtlbufconstants = mtlbufconstants;
+ data.mtlbufconstants.label = @"SDL constant data";
+
+ char *constantdata = [mtlbufconstantstaging contents];
+ SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform));
+ SDL_memcpy(constantdata + CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, halfpixeltransform, sizeof(halfpixeltransform));
+ SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_JPEG, decodetransformJPEG, sizeof(decodetransformJPEG));
+ SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT601, decodetransformBT601, sizeof(decodetransformBT601));
+ SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT709, decodetransformBT709, sizeof(decodetransformBT709));
+ SDL_memcpy(constantdata + CONSTANTS_OFFSET_CLEAR_VERTS, clearverts, sizeof(clearverts));
+
+ id<MTLCommandBuffer> cmdbuffer = [data.mtlcmdqueue commandBuffer];
+ id<MTLBlitCommandEncoder> blitcmd = [cmdbuffer blitCommandEncoder];
+
+ [blitcmd copyFromBuffer:mtlbufconstantstaging sourceOffset:0 toBuffer:data.mtlbufconstants destinationOffset:0 size:CONSTANTS_LENGTH];
+
+ [blitcmd endEncoding];
+ [cmdbuffer commit];
+
+ // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed.
+
+ renderer->WindowEvent = METAL_WindowEvent;
+ renderer->GetOutputSize = METAL_GetOutputSize;
+ renderer->SupportsBlendMode = METAL_SupportsBlendMode;
+ renderer->CreateTexture = METAL_CreateTexture;
+ renderer->UpdateTexture = METAL_UpdateTexture;
+ renderer->UpdateTextureYUV = METAL_UpdateTextureYUV;
+ renderer->LockTexture = METAL_LockTexture;
+ renderer->UnlockTexture = METAL_UnlockTexture;
+ renderer->SetRenderTarget = METAL_SetRenderTarget;
+ renderer->UpdateViewport = METAL_UpdateViewport;
+ renderer->UpdateClipRect = METAL_UpdateClipRect;
+ renderer->RenderClear = METAL_RenderClear;
+ renderer->RenderDrawPoints = METAL_RenderDrawPoints;
+ renderer->RenderDrawLines = METAL_RenderDrawLines;
+ renderer->RenderFillRects = METAL_RenderFillRects;
+ renderer->RenderCopy = METAL_RenderCopy;
+ renderer->RenderCopyEx = METAL_RenderCopyEx;
+ renderer->RenderReadPixels = METAL_RenderReadPixels;
+ renderer->RenderPresent = METAL_RenderPresent;
+ renderer->DestroyTexture = METAL_DestroyTexture;
+ renderer->DestroyRenderer = METAL_DestroyRenderer;
+ renderer->GetMetalLayer = METAL_GetMetalLayer;
+ renderer->GetMetalCommandEncoder = METAL_GetMetalCommandEncoder;
+
+ renderer->info = METAL_RenderDriver.info;
+ renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
+
+#if defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13)
+ if (@available(macOS 10.13, *)) {
+ data.mtllayer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0;
+ } else
+#endif
+ {
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+
+ /* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */
+ int maxtexsize = 4096;
+#if defined(__MACOSX__)
+ maxtexsize = 16384;
+#elif defined(__TVOS__)
+ maxtexsize = 8192;
+#ifdef __TVOS_11_0
+ if (@available(tvOS 11.0, *)) {
+ if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) {
+ maxtexsize = 16384;
+ }
+ }
+#endif
+#else
+#ifdef __IPHONE_11_0
+ if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) {
+ maxtexsize = 16384;
+ } else
+#endif
+#ifdef __IPHONE_10_0
+ if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) {
+ maxtexsize = 16384;
+ } else
+#endif
+ if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) {
+ maxtexsize = 8192;
+ } else {
+ maxtexsize = 4096;
+ }
+#endif
+
+ renderer->info.max_texture_width = maxtexsize;
+ renderer->info.max_texture_height = maxtexsize;
+
+#if !__has_feature(objc_arc)
+ [mtlcmdqueue release];
+ [mtllibrary release];
+ [samplerdesc release];
+ [mtlsamplernearest release];
+ [mtlsamplerlinear release];
+ [mtlbufconstants release];
+ [view release];
+ [data release];
+ [mtldevice release];
+#endif
+
+ return renderer;
+}}
+
+static void
+METAL_ActivateRenderCommandEncoder(SDL_Renderer * renderer, MTLLoadAction load)
+{
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+
+ /* Our SetRenderTarget just signals that the next render operation should
+ * set up a new render pass. This is where that work happens. */
+ if (data.mtlcmdencoder == nil) {
+ id<MTLTexture> mtltexture = nil;
+
+ if (renderer->target != NULL) {
+ METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->driverdata;
+ mtltexture = texdata.mtltexture;
+ } else {
+ if (data.mtlbackbuffer == nil) {
+ /* The backbuffer's contents aren't guaranteed to persist after
+ * presenting, so we can leave it undefined when loading it. */
+ data.mtlbackbuffer = [data.mtllayer nextDrawable];
+ if (load == MTLLoadActionLoad) {
+ load = MTLLoadActionDontCare;
+ }
+ }
+ mtltexture = data.mtlbackbuffer.texture;
+ }
+
+ SDL_assert(mtltexture);
+
+ if (load == MTLLoadActionClear) {
+ MTLClearColor color = MTLClearColorMake(renderer->r/255.0, renderer->g/255.0, renderer->b/255.0, renderer->a/255.0);
+ data.mtlpassdesc.colorAttachments[0].clearColor = color;
+ }
+
+ data.mtlpassdesc.colorAttachments[0].loadAction = load;
+ data.mtlpassdesc.colorAttachments[0].texture = mtltexture;
+
+ data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer];
+ data.mtlcmdencoder = [data.mtlcmdbuffer renderCommandEncoderWithDescriptor:data.mtlpassdesc];
+
+ if (data.mtlbackbuffer != nil && mtltexture == data.mtlbackbuffer.texture) {
+ data.mtlcmdencoder.label = @"SDL metal renderer backbuffer";
+ } else {
+ data.mtlcmdencoder.label = @"SDL metal renderer render target";
+ }
+
+ data.activepipelines = ChooseShaderPipelines(data, mtltexture.pixelFormat);
+
+ /* Make sure the viewport and clip rect are set on the new render pass. */
+ METAL_UpdateViewport(renderer);
+ METAL_UpdateClipRect(renderer);
+ }
+}
+
+static void
+METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
+ event->event == SDL_WINDOWEVENT_SHOWN ||
+ event->event == SDL_WINDOWEVENT_HIDDEN) {
+ // !!! FIXME: write me
+ }
+}
+
+static int
+METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ if (w) {
+ *w = (int)data.mtllayer.drawableSize.width;
+ }
+ if (h) {
+ *h = (int)data.mtllayer.drawableSize.height;
+ }
+ return 0;
+}}
+
+static SDL_bool
+METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+
+ if (GetBlendFactor(srcColorFactor) == invalidBlendFactor ||
+ GetBlendFactor(srcAlphaFactor) == invalidBlendFactor ||
+ GetBlendOperation(colorOperation) == invalidBlendOperation ||
+ GetBlendFactor(dstColorFactor) == invalidBlendFactor ||
+ GetBlendFactor(dstAlphaFactor) == invalidBlendFactor ||
+ GetBlendOperation(alphaOperation) == invalidBlendOperation) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static int
+METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ MTLPixelFormat pixfmt;
+
+ switch (texture->format) {
+ case SDL_PIXELFORMAT_ABGR8888:
+ pixfmt = MTLPixelFormatRGBA8Unorm;
+ break;
+ case SDL_PIXELFORMAT_ARGB8888:
+ pixfmt = MTLPixelFormatBGRA8Unorm;
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ pixfmt = MTLPixelFormatR8Unorm;
+ break;
+ default:
+ return SDL_SetError("Texture format %s not supported by Metal", SDL_GetPixelFormatName(texture->format));
+ }
+
+ MTLTextureDescriptor *mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixfmt
+ width:(NSUInteger)texture->w height:(NSUInteger)texture->h mipmapped:NO];
+
+ /* Not available in iOS 8. */
+ if ([mtltexdesc respondsToSelector:@selector(usage)]) {
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget;
+ } else {
+ mtltexdesc.usage = MTLTextureUsageShaderRead;
+ }
+ }
+
+ id<MTLTexture> mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
+ if (mtltexture == nil) {
+ return SDL_SetError("Texture allocation failed");
+ }
+
+ id<MTLTexture> mtltexture_uv = nil;
+
+ BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12);
+ BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21);
+
+ if (yuv) {
+ mtltexdesc.pixelFormat = MTLPixelFormatR8Unorm;
+ mtltexdesc.width = (texture->w + 1) / 2;
+ mtltexdesc.height = (texture->h + 1) / 2;
+ mtltexdesc.textureType = MTLTextureType2DArray;
+ mtltexdesc.arrayLength = 2;
+ mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
+ } else if (nv12) {
+ mtltexdesc.pixelFormat = MTLPixelFormatRG8Unorm;
+ mtltexdesc.width = (texture->w + 1) / 2;
+ mtltexdesc.height = (texture->h + 1) / 2;
+ mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
+ }
+
+ METAL_TextureData *texturedata = [[METAL_TextureData alloc] init];
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ texturedata.mtlsampler = data.mtlsamplernearest;
+ } else {
+ texturedata.mtlsampler = data.mtlsamplerlinear;
+ }
+ texturedata.mtltexture = mtltexture;
+ texturedata.mtltexture_uv = mtltexture_uv;
+
+ texturedata.yuv = yuv;
+ texturedata.nv12 = nv12;
+
+ if (yuv) {
+ texturedata.fragmentFunction = SDL_METAL_FRAGMENT_YUV;
+ } else if (texture->format == SDL_PIXELFORMAT_NV12) {
+ texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12;
+ } else if (texture->format == SDL_PIXELFORMAT_NV21) {
+ texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21;
+ } else {
+ texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY;
+ }
+
+ if (yuv || nv12) {
+ size_t offset = 0;
+ SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h);
+ switch (mode) {
+ case SDL_YUV_CONVERSION_JPEG: offset = CONSTANTS_OFFSET_DECODE_JPEG; break;
+ case SDL_YUV_CONVERSION_BT601: offset = CONSTANTS_OFFSET_DECODE_BT601; break;
+ case SDL_YUV_CONVERSION_BT709: offset = CONSTANTS_OFFSET_DECODE_BT709; break;
+ default: offset = 0; break;
+ }
+ texturedata.conversionBufferOffset = offset;
+ }
+
+ texture->driverdata = (void*)CFBridgingRetain(texturedata);
+
+#if !__has_feature(objc_arc)
+ [texturedata release];
+ [mtltexture release];
+ [mtltexture_uv release];
+#endif
+
+ return 0;
+}}
+
+static int
+METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{ @autoreleasepool {
+ METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
+
+ /* !!! FIXME: replaceRegion does not do any synchronization, so it might
+ * !!! FIXME: stomp on a previous frame's data that's currently being read
+ * !!! FIXME: by the GPU. */
+ [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h)
+ mipmapLevel:0
+ withBytes:pixels
+ bytesPerRow:pitch];
+
+ if (texturedata.yuv) {
+ int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0;
+ int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1;
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+ [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2)
+ mipmapLevel:0
+ slice:Uslice
+ withBytes:pixels
+ bytesPerRow:(pitch + 1) / 2
+ bytesPerImage:0];
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2));
+ [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2)
+ mipmapLevel:0
+ slice:Vslice
+ withBytes:pixels
+ bytesPerRow:(pitch + 1) / 2
+ bytesPerImage:0];
+ }
+
+ if (texturedata.nv12) {
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+ [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2)
+ mipmapLevel:0
+ slice:0
+ withBytes:pixels
+ bytesPerRow:2 * ((pitch + 1) / 2)
+ bytesPerImage:0];
+ }
+
+ return 0;
+}}
+
+static int
+METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{ @autoreleasepool {
+ METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
+ int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0;
+ int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1;
+
+ /* Bail out if we're supposed to update an empty rectangle */
+ if (rect->w <= 0 || rect->h <= 0) {
+ return 0;
+ }
+
+ [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h)
+ mipmapLevel:0
+ withBytes:Yplane
+ bytesPerRow:Ypitch];
+
+ [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2)
+ mipmapLevel:0
+ slice:Uslice
+ withBytes:Uplane
+ bytesPerRow:Upitch
+ bytesPerImage:0];
+
+ [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2)
+ mipmapLevel:0
+ slice:Vslice
+ withBytes:Vplane
+ bytesPerRow:Vpitch
+ bytesPerImage:0];
+
+ return 0;
+}}
+
+static int
+METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ return SDL_Unsupported(); // !!! FIXME: write me
+}
+
+static void
+METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ // !!! FIXME: write me
+}
+
+static int
+METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+
+ if (data.mtlcmdencoder) {
+ /* End encoding for the previous render target so we can set up a new
+ * render pass for this one. */
+ [data.mtlcmdencoder endEncoding];
+ [data.mtlcmdbuffer commit];
+
+ data.mtlcmdencoder = nil;
+ data.mtlcmdbuffer = nil;
+ }
+
+ /* We don't begin a new render pass right away - we delay it until an actual
+ * draw or clear happens. That way we can use hardware clears when possible,
+ * which are only available when beginning a new render pass. */
+ return 0;
+}}
+
+static int
+METAL_SetOrthographicProjection(SDL_Renderer *renderer, int w, int h)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ float projection[4][4];
+
+ if (!w || !h) {
+ return 0;
+ }
+
+ /* Prepare an orthographic projection */
+ projection[0][0] = 2.0f / w;
+ projection[0][1] = 0.0f;
+ projection[0][2] = 0.0f;
+ projection[0][3] = 0.0f;
+ projection[1][0] = 0.0f;
+ projection[1][1] = -2.0f / h;
+ projection[1][2] = 0.0f;
+ projection[1][3] = 0.0f;
+ projection[2][0] = 0.0f;
+ projection[2][1] = 0.0f;
+ projection[2][2] = 0.0f;
+ projection[2][3] = 0.0f;
+ projection[3][0] = -1.0f;
+ projection[3][1] = 1.0f;
+ projection[3][2] = 0.0f;
+ projection[3][3] = 1.0f;
+
+ // !!! FIXME: This should be in a buffer...
+ [data.mtlcmdencoder setVertexBytes:projection length:sizeof(float)*16 atIndex:2];
+ return 0;
+}}
+
+static int
+METAL_UpdateViewport(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ if (data.mtlcmdencoder) {
+ MTLViewport viewport;
+ viewport.originX = renderer->viewport.x;
+ viewport.originY = renderer->viewport.y;
+ viewport.width = renderer->viewport.w;
+ viewport.height = renderer->viewport.h;
+ viewport.znear = 0.0;
+ viewport.zfar = 1.0;
+ [data.mtlcmdencoder setViewport:viewport];
+ METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h);
+ }
+ return 0;
+}}
+
+static int
+METAL_UpdateClipRect(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ if (data.mtlcmdencoder) {
+ MTLScissorRect mtlrect;
+ // !!! FIXME: should this care about the viewport?
+ if (renderer->clipping_enabled) {
+ const SDL_Rect *rect = &renderer->clip_rect;
+ mtlrect.x = renderer->viewport.x + rect->x;
+ mtlrect.y = renderer->viewport.x + rect->y;
+ mtlrect.width = rect->w;
+ mtlrect.height = rect->h;
+ } else {
+ mtlrect.x = renderer->viewport.x;
+ mtlrect.y = renderer->viewport.y;
+ mtlrect.width = renderer->viewport.w;
+ mtlrect.height = renderer->viewport.h;
+ }
+ if (mtlrect.width > 0 && mtlrect.height > 0) {
+ [data.mtlcmdencoder setScissorRect:mtlrect];
+ }
+ }
+ return 0;
+}}
+
+static int
+METAL_RenderClear(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+
+ /* Since we set up the render command encoder lazily when a draw is
+ * requested, we can do the fast path hardware clear if no draws have
+ * happened since the last SetRenderTarget. */
+ if (data.mtlcmdencoder == nil) {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionClear);
+ } else {
+ // !!! FIXME: render color should live in a dedicated uniform buffer.
+ const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f };
+
+ MTLViewport viewport; // RenderClear ignores the viewport state, though, so reset that.
+ viewport.originX = viewport.originY = 0.0;
+ viewport.width = data.mtlpassdesc.colorAttachments[0].texture.width;
+ viewport.height = data.mtlpassdesc.colorAttachments[0].texture.height;
+ viewport.znear = 0.0;
+ viewport.zfar = 1.0;
+
+ // Slow path for clearing: draw a filled fullscreen triangle.
+ METAL_SetOrthographicProjection(renderer, 1, 1);
+ [data.mtlcmdencoder setViewport:viewport];
+ [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, SDL_BLENDMODE_NONE)];
+ [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_CLEAR_VERTS atIndex:0];
+ [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3];
+ [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0];
+ [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:3];
+
+ // reset the viewport for the rest of our usual drawing work...
+ viewport.originX = renderer->viewport.x;
+ viewport.originY = renderer->viewport.y;
+ viewport.width = renderer->viewport.w;
+ viewport.height = renderer->viewport.h;
+ viewport.znear = 0.0;
+ viewport.zfar = 1.0;
+ [data.mtlcmdencoder setViewport:viewport];
+ METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h);
+ }
+
+ return 0;
+}}
+
+// normalize a value from 0.0f to len into 0.0f to 1.0f.
+static inline float
+normtex(const float _val, const float len)
+{
+ return _val / len;
+}
+
+static int
+DrawVerts(SDL_Renderer * renderer, const SDL_FPoint * points, int count,
+ const MTLPrimitiveType primtype)
+{ @autoreleasepool {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
+
+ const size_t vertlen = (sizeof (float) * 2) * count;
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+
+ // !!! FIXME: render color should live in a dedicated uniform buffer.
+ const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f };
+
+ [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)];
+ [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0];
+
+ [data.mtlcmdencoder setVertexBytes:points length:vertlen atIndex:0];
+ [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM atIndex:3];
+ [data.mtlcmdencoder drawPrimitives:primtype vertexStart:0 vertexCount:count];
+
+ return 0;
+}}
+
+static int
+METAL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count)
+{
+ return DrawVerts(renderer, points, count, MTLPrimitiveTypePoint);
+}
+
+static int
+METAL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, int count)
+{
+ return DrawVerts(renderer, points, count, MTLPrimitiveTypeLineStrip);
+}
+
+static int
+METAL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count)
+{ @autoreleasepool {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+
+ // !!! FIXME: render color should live in a dedicated uniform buffer.
+ const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f };
+
+ [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)];
+ [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0];
+ [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3];
+
+ for (int i = 0; i < count; i++, rects++) {
+ if ((rects->w <= 0.0f) || (rects->h <= 0.0f)) continue;
+
+ const float verts[] = {
+ rects->x, rects->y + rects->h,
+ rects->x, rects->y,
+ rects->x + rects->w, rects->y + rects->h,
+ rects->x + rects->w, rects->y
+ };
+
+ [data.mtlcmdencoder setVertexBytes:verts length:sizeof(verts) atIndex:0];
+ [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];
+ }
+
+ return 0;
+}}
+
+static void
+METAL_SetupRenderCopy(METAL_RenderData *data, SDL_Texture *texture, METAL_TextureData *texturedata)
+{
+ float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ if (texture->modMode) {
+ color[0] = ((float)texture->r) / 255.0f;
+ color[1] = ((float)texture->g) / 255.0f;
+ color[2] = ((float)texture->b) / 255.0f;
+ color[3] = ((float)texture->a) / 255.0f;
+ }
+
+ [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, texturedata.fragmentFunction, texture->blendMode)];
+ [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0];
+ [data.mtlcmdencoder setFragmentSamplerState:texturedata.mtlsampler atIndex:0];
+
+ [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0];
+
+ if (texturedata.yuv || texturedata.nv12) {
+ [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1];
+ [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1];
+ }
+}
+
+static int
+METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{ @autoreleasepool {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
+ const float texw = (float) texturedata.mtltexture.width;
+ const float texh = (float) texturedata.mtltexture.height;
+
+ METAL_SetupRenderCopy(data, texture, texturedata);
+
+ const float xy[] = {
+ dstrect->x, dstrect->y + dstrect->h,
+ dstrect->x, dstrect->y,
+ dstrect->x + dstrect->w, dstrect->y + dstrect->h,
+ dstrect->x + dstrect->w, dstrect->y
+ };
+
+ const float uv[] = {
+ normtex(srcrect->x, texw), normtex(srcrect->y + srcrect->h, texh),
+ normtex(srcrect->x, texw), normtex(srcrect->y, texh),
+ normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y + srcrect->h, texh),
+ normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y, texh)
+ };
+
+ [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0];
+ [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1];
+ [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3];
+ [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];
+
+ return 0;
+}}
+
+static int
+METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
+{ @autoreleasepool {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
+ const float texw = (float) texturedata.mtltexture.width;
+ const float texh = (float) texturedata.mtltexture.height;
+ float transform[16];
+ float minu, maxu, minv, maxv;
+
+ METAL_SetupRenderCopy(data, texture, texturedata);
+
+ minu = normtex(srcrect->x, texw);
+ maxu = normtex(srcrect->x + srcrect->w, texw);
+ minv = normtex(srcrect->y, texh);
+ maxv = normtex(srcrect->y + srcrect->h, texh);
+
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ float tmp = maxu;
+ maxu = minu;
+ minu = tmp;
+ }
+ if (flip & SDL_FLIP_VERTICAL) {
+ float tmp = maxv;
+ maxv = minv;
+ minv = tmp;
+ }
+
+ const float uv[] = {
+ minu, maxv,
+ minu, minv,
+ maxu, maxv,
+ maxu, minv
+ };
+
+ const float xy[] = {
+ -center->x, dstrect->h - center->y,
+ -center->x, -center->y,
+ dstrect->w - center->x, dstrect->h - center->y,
+ dstrect->w - center->x, -center->y
+ };
+
+ {
+ float rads = (float)(M_PI * (float) angle / 180.0f);
+ float c = cosf(rads), s = sinf(rads);
+ SDL_memset(transform, 0, sizeof(transform));
+
+ transform[10] = transform[15] = 1.0f;
+
+ /* Rotation */
+ transform[0] = c;
+ transform[1] = s;
+ transform[4] = -s;
+ transform[5] = c;
+
+ /* Translation */
+ transform[12] = dstrect->x + center->x;
+ transform[13] = dstrect->y + center->y;
+ }
+
+ [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0];
+ [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1];
+ [data.mtlcmdencoder setVertexBytes:transform length:sizeof(transform) atIndex:3];
+ [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];
+
+ return 0;
+}}
+
+static int
+METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch)
+{ @autoreleasepool {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
+
+ // !!! FIXME: this probably needs to commit the current command buffer, and probably waitUntilCompleted
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ id<MTLTexture> mtltexture = data.mtlpassdesc.colorAttachments[0].texture;
+ MTLRegion mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h);
+
+ // we only do BGRA8 or RGBA8 at the moment, so 4 will do.
+ const int temp_pitch = rect->w * 4;
+ void *temp_pixels = SDL_malloc(temp_pitch * rect->h);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+
+ [mtltexture getBytes:temp_pixels bytesPerRow:temp_pitch fromRegion:mtlregion mipmapLevel:0];
+
+ const Uint32 temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888;
+ const int status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch);
+ SDL_free(temp_pixels);
+ return status;
+}}
+
+static void
+METAL_RenderPresent(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+
+ if (data.mtlcmdencoder != nil) {
+ [data.mtlcmdencoder endEncoding];
+ }
+ if (data.mtlbackbuffer != nil) {
+ [data.mtlcmdbuffer presentDrawable:data.mtlbackbuffer];
+ }
+ if (data.mtlcmdbuffer != nil) {
+ [data.mtlcmdbuffer commit];
+ }
+ data.mtlcmdencoder = nil;
+ data.mtlcmdbuffer = nil;
+ data.mtlbackbuffer = nil;
+}}
+
+static void
+METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{ @autoreleasepool {
+ CFBridgingRelease(texture->driverdata);
+ texture->driverdata = NULL;
+}}
+
+static void
+METAL_DestroyRenderer(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ if (renderer->driverdata) {
+ METAL_RenderData *data = CFBridgingRelease(renderer->driverdata);
+
+ if (data.mtlcmdencoder != nil) {
+ [data.mtlcmdencoder endEncoding];
+ }
+
+ DestroyAllPipelines(data.allpipelines, data.pipelinescount);
+ }
+
+ SDL_free(renderer);
+}}
+
+static void *
+METAL_GetMetalLayer(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ return (__bridge void*)data.mtllayer;
+}}
+
+static void *
+METAL_GetMetalCommandEncoder(SDL_Renderer * renderer)
+{ @autoreleasepool {
+ METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad);
+ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
+ return (__bridge void*)data.mtlcmdencoder;
+}}
+
+#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal.metal b/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal.metal
new file mode 100644
index 0000000..8df3b75
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal.metal
@@ -0,0 +1,109 @@
+#include <metal_texture>
+#include <metal_matrix>
+
+using namespace metal;
+
+struct SolidVertexOutput
+{
+ float4 position [[position]];
+ float pointSize [[point_size]];
+};
+
+vertex SolidVertexOutput SDL_Solid_vertex(const device float2 *position [[buffer(0)]],
+ constant float4x4 &projection [[buffer(2)]],
+ constant float4x4 &transform [[buffer(3)]],
+ uint vid [[vertex_id]])
+{
+ SolidVertexOutput v;
+ v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f);
+ v.pointSize = 1.0f;
+ return v;
+}
+
+fragment float4 SDL_Solid_fragment(constant float4 &col [[buffer(0)]])
+{
+ return col;
+}
+
+struct CopyVertexOutput
+{
+ float4 position [[position]];
+ float2 texcoord;
+};
+
+vertex CopyVertexOutput SDL_Copy_vertex(const device float2 *position [[buffer(0)]],
+ const device float2 *texcoords [[buffer(1)]],
+ constant float4x4 &projection [[buffer(2)]],
+ constant float4x4 &transform [[buffer(3)]],
+ uint vid [[vertex_id]])
+{
+ CopyVertexOutput v;
+ v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f);
+ v.texcoord = texcoords[vid];
+ return v;
+}
+
+fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]],
+ constant float4 &col [[buffer(0)]],
+ texture2d<float> tex [[texture(0)]],
+ sampler s [[sampler(0)]])
+{
+ return tex.sample(s, vert.texcoord) * col;
+}
+
+struct YUVDecode
+{
+ float3 offset;
+ float3 Rcoeff;
+ float3 Gcoeff;
+ float3 Bcoeff;
+};
+
+fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
+ constant float4 &col [[buffer(0)]],
+ constant YUVDecode &decode [[buffer(1)]],
+ texture2d<float> texY [[texture(0)]],
+ texture2d_array<float> texUV [[texture(1)]],
+ sampler s [[sampler(0)]])
+{
+ float3 yuv;
+ yuv.x = texY.sample(s, vert.texcoord).r;
+ yuv.y = texUV.sample(s, vert.texcoord, 0).r;
+ yuv.z = texUV.sample(s, vert.texcoord, 1).r;
+
+ yuv += decode.offset;
+
+ return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0);
+}
+
+fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]],
+ constant float4 &col [[buffer(0)]],
+ constant YUVDecode &decode [[buffer(1)]],
+ texture2d<float> texY [[texture(0)]],
+ texture2d<float> texUV [[texture(1)]],
+ sampler s [[sampler(0)]])
+{
+ float3 yuv;
+ yuv.x = texY.sample(s, vert.texcoord).r;
+ yuv.yz = texUV.sample(s, vert.texcoord).rg;
+
+ yuv += decode.offset;
+
+ return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0);
+}
+
+fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]],
+ constant float4 &col [[buffer(0)]],
+ constant YUVDecode &decode [[buffer(1)]],
+ texture2d<float> texY [[texture(0)]],
+ texture2d<float> texUV [[texture(1)]],
+ sampler s [[sampler(0)]])
+{
+ float3 yuv;
+ yuv.x = texY.sample(s, vert.texcoord).r;
+ yuv.yz = texUV.sample(s, vert.texcoord).gr;
+
+ yuv += decode.offset;
+
+ return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0);
+}
diff --git a/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_ios.h b/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_ios.h
new file mode 100644
index 0000000..1c93252
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_ios.h
@@ -0,0 +1,1899 @@
+const unsigned char sdl_metallib[] = {
+ 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xd8, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x54, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
+ 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f,
+ 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54,
+ 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00,
+ 0xa1, 0x91, 0x35, 0x76, 0xce, 0x36, 0x38, 0x71, 0xba, 0x1c, 0x81, 0x62,
+ 0xda, 0x7c, 0x6b, 0x94, 0xc7, 0x88, 0x39, 0xd4, 0x91, 0xc2, 0xe7, 0xf9,
+ 0x21, 0x8c, 0x74, 0x25, 0xa9, 0xb0, 0x81, 0x85, 0x4f, 0x46, 0x46, 0x54,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00,
+ 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f,
+ 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59,
+ 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0x71,
+ 0xbb, 0x07, 0x58, 0x1b, 0x7c, 0x44, 0xaa, 0x03, 0xc8, 0xab, 0x11, 0xe4,
+ 0x63, 0xdb, 0xe3, 0xe6, 0xce, 0x52, 0x97, 0x34, 0x82, 0xf0, 0x46, 0x70,
+ 0xaa, 0xa9, 0x31, 0x51, 0x3c, 0xe8, 0x39, 0x4f, 0x46, 0x46, 0x54, 0x18,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e,
+ 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c,
+ 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00,
+ 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20,
+ 0x00, 0x4a, 0x07, 0x48, 0xd3, 0xb7, 0x7a, 0x3a, 0x01, 0x6c, 0xaa, 0x80,
+ 0xde, 0x84, 0x6e, 0x3c, 0x9a, 0xdd, 0x55, 0x90, 0x43, 0xa6, 0xdd, 0xbb,
+ 0xd6, 0xeb, 0xea, 0x81, 0x62, 0xf6, 0x50, 0x04, 0x95, 0x4f, 0x46, 0x46,
+ 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x16, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08,
+ 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00,
+ 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43,
+ 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74,
+ 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48,
+ 0x20, 0x00, 0x4c, 0xaa, 0x05, 0x27, 0x1a, 0x40, 0x5c, 0xe3, 0xd5, 0x46,
+ 0x38, 0xad, 0x07, 0xe7, 0x70, 0xdf, 0xde, 0x83, 0x74, 0x96, 0x26, 0x6e,
+ 0x35, 0x7b, 0xc9, 0xc5, 0x46, 0x08, 0x51, 0xb4, 0x13, 0xa8, 0x4f, 0x46,
+ 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x1f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00,
+ 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00,
+ 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f,
+ 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74,
+ 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48,
+ 0x20, 0x00, 0xc9, 0x73, 0x33, 0x9a, 0x36, 0x6d, 0x15, 0x10, 0xa2, 0x81,
+ 0xaa, 0xbf, 0x27, 0xb1, 0x22, 0xc6, 0x0a, 0x7b, 0x68, 0x66, 0xdb, 0xe9,
+ 0xab, 0x19, 0x22, 0x40, 0x87, 0x6b, 0x10, 0x93, 0xc5, 0xf5, 0x4f, 0x46,
+ 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2a, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00,
+ 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00,
+ 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f,
+ 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e,
+ 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53,
+ 0x48, 0x20, 0x00, 0x59, 0x54, 0x77, 0x75, 0xe5, 0xb6, 0xd5, 0x2e, 0xf7,
+ 0xb1, 0x9d, 0xd1, 0x75, 0x39, 0x4c, 0x97, 0x0f, 0x40, 0x58, 0xaa, 0xc9,
+ 0x42, 0xe8, 0x03, 0x29, 0x1e, 0x93, 0x63, 0x0c, 0x91, 0x38, 0xc8, 0x4f,
+ 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x38, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01,
+ 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79,
+ 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c,
+ 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65,
+ 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41,
+ 0x53, 0x48, 0x20, 0x00, 0x77, 0x01, 0x3e, 0x26, 0x2e, 0xc2, 0xe2, 0x34,
+ 0x70, 0xcf, 0x0c, 0x9e, 0x0d, 0xed, 0x69, 0xa4, 0x2a, 0x9c, 0x80, 0x06,
+ 0x52, 0xd1, 0x4b, 0x77, 0x6d, 0xda, 0x29, 0x27, 0x51, 0x25, 0xf4, 0x92,
+ 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x46,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00,
+ 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x30, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00,
+ 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39,
+ 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62,
+ 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
+ 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21,
+ 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48,
+ 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00,
+ 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18,
+ 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3,
+ 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee,
+ 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9,
+ 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80,
+ 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3,
+ 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43,
+ 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03,
+ 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5,
+ 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9,
+ 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4,
+ 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43,
+ 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3,
+ 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03,
+ 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0,
+ 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5,
+ 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef,
+ 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee,
+ 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6,
+ 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83,
+ 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43,
+ 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43,
+ 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00,
+ 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00,
+ 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1,
+ 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43,
+ 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41,
+ 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3,
+ 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d,
+ 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef,
+ 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04,
+ 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43,
+ 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d,
+ 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3,
+ 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed,
+ 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03,
+ 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03,
+ 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6,
+ 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94,
+ 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4,
+ 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18,
+ 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0,
+ 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84,
+ 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4,
+ 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94,
+ 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30,
+ 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47,
+ 0x10, 0x50, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03,
+ 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83,
+ 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83,
+ 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10,
+ 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0,
+ 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80,
+ 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20,
+ 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60,
+ 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0,
+ 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90,
+ 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50,
+ 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20,
+ 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60,
+ 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0,
+ 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20,
+ 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10,
+ 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x2c, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42,
+ 0x25, 0x30, 0x02, 0x50, 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06,
+ 0xd4, 0x46, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00,
+ 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84,
+ 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d,
+ 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c,
+ 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26,
+ 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1,
+ 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44,
+ 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56,
+ 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73,
+ 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd,
+ 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d,
+ 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10,
+ 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2,
+ 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56,
+ 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16,
+ 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2,
+ 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85,
+ 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72,
+ 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6,
+ 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61,
+ 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a,
+ 0x65, 0x2c, 0xcc, 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9,
+ 0xd1, 0x4d, 0xa5, 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a,
+ 0x81, 0x96, 0x6a, 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce,
+ 0x45, 0xac, 0xce, 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b,
+ 0xdb, 0xdb, 0x58, 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59,
+ 0x19, 0x1e, 0x91, 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46,
+ 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65,
+ 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4,
+ 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc,
+ 0xbe, 0xe6, 0xd2, 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9,
+ 0x0c, 0xe1, 0x10, 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96,
+ 0x0d, 0x21, 0x16, 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8,
+ 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd,
+ 0xa5, 0xe9, 0x95, 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3,
+ 0xa1, 0x02, 0x27, 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36,
+ 0x04, 0x0c, 0x90, 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90,
+ 0x60, 0xd1, 0x96, 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83,
+ 0x05, 0x5a, 0xc2, 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b,
+ 0x5c, 0xdb, 0x10, 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32,
+ 0xe4, 0x40, 0x82, 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c,
+ 0x05, 0x0c, 0x16, 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76,
+ 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc,
+ 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5,
+ 0x59, 0xcc, 0x60, 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06,
+ 0x0b, 0x19, 0x2c, 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80,
+ 0xcf, 0x5b, 0x9b, 0x5b, 0x1a, 0xdc, 0x1b, 0x5d, 0x99, 0x1b, 0x1d, 0xc8,
+ 0x18, 0x5a, 0x98, 0x1c, 0x9f, 0xa9, 0xb4, 0x36, 0x38, 0xb6, 0x32, 0x90,
+ 0xa1, 0x95, 0x15, 0x10, 0x2a, 0xa1, 0xa0, 0xa0, 0x21, 0xc2, 0xc2, 0x06,
+ 0x43, 0x8c, 0x65, 0x0d, 0x96, 0x36, 0x68, 0x90, 0x21, 0xc6, 0xe2, 0x06,
+ 0x8b, 0x1b, 0x34, 0xc8, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1,
+ 0x0d, 0xd2, 0x81, 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c,
+ 0x58, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61,
+ 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21,
+ 0x1d, 0xe4, 0xc1, 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21,
+ 0x1c, 0xce, 0xa1, 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21,
+ 0x1d, 0xde, 0xc1, 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41,
+ 0x1e, 0xdc, 0x60, 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1,
+ 0x1c, 0x7e, 0xe1, 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61,
+ 0x1e, 0xa6, 0x10, 0x06, 0xa2, 0x30, 0x23, 0x94, 0x70, 0x48, 0x07, 0x79,
+ 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, 0xa0, 0x87, 0x72, 0xc0, 0x87, 0x29,
+ 0x81, 0x1a, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88,
+ 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73,
+ 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e,
+ 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30,
+ 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8,
+ 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b,
+ 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76,
+ 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e,
+ 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e,
+ 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61,
+ 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4,
+ 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76,
+ 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37,
+ 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76,
+ 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71,
+ 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e,
+ 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1,
+ 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61,
+ 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90,
+ 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8,
+ 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc,
+ 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7,
+ 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78,
+ 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f,
+ 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f,
+ 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1,
+ 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0,
+ 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0,
+ 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b,
+ 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c,
+ 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82,
+ 0x0c, 0x7f, 0x45, 0x44, 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00,
+ 0x69, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x84, 0x60, 0x9a, 0x46, 0x00,
+ 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x98, 0x01, 0xa0, 0x31,
+ 0x03, 0x40, 0x62, 0x06, 0x80, 0xc2, 0x0c, 0x00, 0x81, 0x11, 0x80, 0x31,
+ 0x02, 0x10, 0x04, 0x41, 0xfc, 0x03, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12,
+ 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0xd1, 0x94, 0x4d, 0x14,
+ 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, 0xe0, 0x0c, 0x86, 0x0b,
+ 0x9a, 0x8c, 0x47, 0x50, 0x57, 0x17, 0x50, 0x50, 0x06, 0x19, 0x82, 0x65,
+ 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x90, 0x42, 0x50,
+ 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31,
+ 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x51, 0x76, 0x45, 0x93, 0xf1, 0x88,
+ 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, 0xc8, 0xc7, 0x02, 0x04,
+ 0x3e, 0xa6, 0xb0, 0x01, 0x0c, 0x86, 0x1b, 0x02, 0x0e, 0x0c, 0x66, 0x19,
+ 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xce, 0xa0, 0x0d, 0xa2, 0xc1, 0x88, 0x80,
+ 0x28, 0x00, 0x9b, 0xde, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x07, 0x06, 0xb3,
+ 0x0c, 0x44, 0x10, 0x8c, 0x47, 0x64, 0x6a, 0x00, 0x07, 0x6a, 0x40, 0x41,
+ 0x19, 0x8f, 0xd8, 0xd8, 0x40, 0x0e, 0xc6, 0x80, 0x82, 0x32, 0x1e, 0xd1,
+ 0xb9, 0x01, 0x1d, 0x98, 0x01, 0x05, 0x65, 0x3c, 0xe2, 0x83, 0x03, 0x3b,
+ 0x48, 0x03, 0x0a, 0xca, 0x78, 0x04, 0x18, 0xc8, 0x01, 0x1e, 0xc8, 0xc1,
+ 0x60, 0x44, 0x80, 0x14, 0xc0, 0x78, 0x44, 0x18, 0xcc, 0x41, 0x1e, 0xa8,
+ 0xc1, 0x60, 0x44, 0x70, 0x14, 0xc0, 0x78, 0x84, 0x18, 0xd0, 0x81, 0x1e,
+ 0xb0, 0xc1, 0x60, 0x44, 0x60, 0x14, 0xc0, 0x78, 0xc4, 0x18, 0xd4, 0xc1,
+ 0x1e, 0xb8, 0xc1, 0x60, 0x44, 0x50, 0x14, 0xc0, 0xc9, 0x41, 0x8b, 0xf1,
+ 0x04, 0x3b, 0x08, 0x28, 0x20, 0x83, 0x0c, 0x41, 0x1b, 0xd0, 0xc1, 0x1c,
+ 0x43, 0xb0, 0x06, 0x7d, 0x30, 0xc7, 0x10, 0xac, 0x01, 0x1f, 0x0c, 0x32,
+ 0x04, 0x6e, 0x60, 0x07, 0x16, 0x48, 0xf2, 0x99, 0x25, 0x28, 0x06, 0x2a,
+ 0x10, 0x95, 0x20, 0xaa, 0x62, 0xa0, 0x22, 0x20, 0x88, 0xa8, 0x18, 0x43,
+ 0x28, 0x84, 0x39, 0x86, 0x39, 0x08, 0x4e, 0x61, 0x90, 0x21, 0xa0, 0x03,
+ 0x3e, 0xb8, 0xa2, 0xc9, 0x78, 0x84, 0x1c, 0x90, 0x82, 0x2a, 0x04, 0x14,
+ 0x14, 0x0b, 0x08, 0xf9, 0x58, 0x80, 0xc0, 0xc7, 0x94, 0x57, 0x80, 0xc1,
+ 0x70, 0x43, 0xf0, 0x07, 0x60, 0x30, 0xcb, 0x60, 0x14, 0xc1, 0x6c, 0x43,
+ 0x1f, 0x0c, 0xc0, 0x6c, 0x43, 0xb0, 0x07, 0x41, 0x06, 0x01, 0x31, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12,
+ 0xbc, 0xc1, 0x96, 0x61, 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0,
+ 0x65, 0x80, 0x83, 0xe0, 0x0d, 0xb6, 0x0c, 0x7e, 0x10, 0xbc, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x88, 0x0b, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00,
+ 0xdf, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49,
+ 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19,
+ 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42,
+ 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24,
+ 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72,
+ 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0,
+ 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00,
+ 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00,
+ 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c,
+ 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09,
+ 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a,
+ 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72,
+ 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72,
+ 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73,
+ 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21,
+ 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21,
+ 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81,
+ 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73,
+ 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79,
+ 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79,
+ 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80,
+ 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0,
+ 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21,
+ 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21,
+ 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77,
+ 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36,
+ 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36,
+ 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77,
+ 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77,
+ 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78,
+ 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1,
+ 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1,
+ 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61,
+ 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77,
+ 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73,
+ 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41,
+ 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21,
+ 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41,
+ 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21,
+ 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72,
+ 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78,
+ 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79,
+ 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36,
+ 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21,
+ 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21,
+ 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73,
+ 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70,
+ 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70,
+ 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2,
+ 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1,
+ 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70,
+ 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7,
+ 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44,
+ 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16,
+ 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e,
+ 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e,
+ 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e,
+ 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c,
+ 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18,
+ 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23,
+ 0x08, 0x28, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03,
+ 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83,
+ 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83,
+ 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10,
+ 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0,
+ 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80,
+ 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20,
+ 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60,
+ 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0,
+ 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90,
+ 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50,
+ 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20,
+ 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60,
+ 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0,
+ 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20,
+ 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10,
+ 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x2c, 0x10, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42,
+ 0x25, 0x50, 0x10, 0x23, 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06,
+ 0x85, 0x40, 0x6d, 0x04, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0xd3, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e,
+ 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e,
+ 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5,
+ 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25,
+ 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40,
+ 0x04, 0x64, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06,
+ 0x24, 0x40, 0x02, 0x64, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6,
+ 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36,
+ 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a,
+ 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
+ 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65,
+ 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5,
+ 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9,
+ 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95,
+ 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11,
+ 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97,
+ 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6,
+ 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56,
+ 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4,
+ 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68,
+ 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09,
+ 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97,
+ 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05,
+ 0x5a, 0x22, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65,
+ 0x78, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc,
+ 0xca, 0xe4, 0xc2, 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6,
+ 0xde, 0xde, 0xe4, 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98,
+ 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b,
+ 0x93, 0x23, 0x1b, 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0,
+ 0x62, 0x0d, 0x21, 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b,
+ 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3,
+ 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c,
+ 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b,
+ 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9,
+ 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7,
+ 0x5c, 0x9a, 0x5e, 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01,
+ 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a,
+ 0x81, 0x96, 0x88, 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9,
+ 0xdc, 0x10, 0x0e, 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d,
+ 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f,
+ 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7,
+ 0x5c, 0x9a, 0x5e, 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c,
+ 0x1a, 0x2a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+ 0x43, 0xc0, 0x00, 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4,
+ 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45,
+ 0x0c, 0x16, 0x68, 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66,
+ 0x6f, 0x72, 0x6d, 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84,
+ 0x58, 0x34, 0xe4, 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4,
+ 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72,
+ 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea,
+ 0xd2, 0xdc, 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39,
+ 0x83, 0xc5, 0x59, 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde,
+ 0x02, 0x06, 0x0b, 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01,
+ 0x16, 0x6c, 0x59, 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74,
+ 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda,
+ 0xe0, 0xd8, 0xca, 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82,
+ 0x86, 0x08, 0x8b, 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49,
+ 0x86, 0x18, 0x0b, 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60,
+ 0x07, 0x7b, 0x68, 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0,
+ 0x87, 0x29, 0x41, 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0,
+ 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81,
+ 0x30, 0x82, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70,
+ 0x87, 0x73, 0xa8, 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28,
+ 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23,
+ 0xa6, 0x70, 0x48, 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80,
+ 0x87, 0x74, 0x60, 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48,
+ 0x87, 0x77, 0x70, 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50,
+ 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e,
+ 0xca, 0x01, 0x1f, 0xa6, 0x04, 0x6c, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66,
+ 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07,
+ 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10,
+ 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce,
+ 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b,
+ 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c,
+ 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07,
+ 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11,
+ 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0,
+ 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8,
+ 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b,
+ 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87,
+ 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07,
+ 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87,
+ 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81,
+ 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30,
+ 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4,
+ 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca,
+ 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39,
+ 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b,
+ 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b,
+ 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83,
+ 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87,
+ 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90,
+ 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20,
+ 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc,
+ 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66,
+ 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24,
+ 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07,
+ 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00,
+ 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d,
+ 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c,
+ 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x86,
+ 0x80, 0xa2, 0x46, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x19,
+ 0x00, 0x1a, 0x33, 0x00, 0x24, 0x66, 0x00, 0x28, 0xcc, 0x00, 0x10, 0x18,
+ 0x23, 0x00, 0x41, 0x10, 0xc4, 0xbf, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11,
+ 0xd0, 0x94, 0x4d, 0x14, 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03,
+ 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x4c, 0x57, 0x17, 0x50, 0x50,
+ 0x06, 0x19, 0x82, 0x45, 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50,
+ 0x81, 0x98, 0x42, 0x50, 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18,
+ 0x42, 0x21, 0xcc, 0x31, 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x11, 0x76,
+ 0x45, 0x93, 0xf1, 0x08, 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40,
+ 0xc8, 0xc7, 0x02, 0x04, 0x3e, 0xa6, 0xb4, 0x01, 0x0c, 0x86, 0x1b, 0x82,
+ 0x33, 0x00, 0x83, 0x59, 0x86, 0x41, 0x08, 0xc6, 0x23, 0xac, 0x33, 0x68,
+ 0x83, 0x68, 0x30, 0x22, 0x20, 0x0a, 0xc0, 0x26, 0x38, 0x80, 0xc1, 0x70,
+ 0x43, 0xa0, 0x06, 0x60, 0x30, 0xcb, 0x40, 0x04, 0xc1, 0x78, 0x44, 0xa6,
+ 0x06, 0x70, 0xa0, 0x06, 0x14, 0x94, 0xf1, 0x88, 0x8d, 0x0d, 0xe4, 0x40,
+ 0x0c, 0x28, 0x28, 0xe3, 0x11, 0x9d, 0x1b, 0xd0, 0x41, 0x19, 0x50, 0x50,
+ 0xc6, 0x23, 0x3e, 0x38, 0xb0, 0x03, 0x34, 0xa0, 0xa0, 0x8c, 0x47, 0x80,
+ 0x81, 0x1c, 0xe0, 0x81, 0x1c, 0x0c, 0x46, 0x04, 0x48, 0x01, 0x8c, 0x47,
+ 0x84, 0xc1, 0x1c, 0xe4, 0x41, 0x1a, 0x0c, 0x46, 0x04, 0x47, 0x01, 0x8c,
+ 0x47, 0x88, 0x01, 0x1d, 0xe8, 0xc1, 0x1a, 0x0c, 0x46, 0x04, 0x46, 0x01,
+ 0x8c, 0x47, 0x8c, 0x41, 0x1d, 0xec, 0x41, 0x1b, 0x0c, 0x46, 0x04, 0x45,
+ 0x01, 0x5c, 0x1c, 0xb4, 0x18, 0x4f, 0xb0, 0x83, 0x80, 0x02, 0x32, 0xc8,
+ 0x10, 0xb0, 0xc1, 0x1c, 0xcc, 0x31, 0x04, 0x6a, 0xe0, 0x07, 0x73, 0x0c,
+ 0x01, 0x1b, 0xf4, 0xc1, 0x20, 0x43, 0xe0, 0x06, 0x75, 0x60, 0x81, 0x24,
+ 0x9f, 0x59, 0x82, 0x62, 0xa0, 0x02, 0x61, 0x09, 0xa2, 0x2a, 0x06, 0x2a,
+ 0x02, 0x82, 0x88, 0x8a, 0x31, 0x84, 0x42, 0x98, 0x63, 0x98, 0x83, 0xe0,
+ 0x14, 0x06, 0x19, 0x02, 0x3a, 0xd8, 0x83, 0x2b, 0x9a, 0x8c, 0x47, 0xc8,
+ 0x01, 0x29, 0xa8, 0x42, 0x40, 0x41, 0xb1, 0x80, 0x90, 0x8f, 0x05, 0x08,
+ 0x7c, 0x4c, 0x81, 0x05, 0x18, 0x0c, 0x37, 0x04, 0xaa, 0x00, 0x06, 0xb3,
+ 0x0c, 0x46, 0x11, 0x8c, 0x27, 0xa0, 0x02, 0x45, 0x01, 0x99, 0x6d, 0x00,
+ 0x85, 0x02, 0x98, 0x6d, 0x08, 0x84, 0x20, 0x83, 0x80, 0x18, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12,
+ 0xc4, 0xc1, 0x96, 0x61, 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0,
+ 0x65, 0x80, 0x83, 0x20, 0x0e, 0xb6, 0x0c, 0x7e, 0x10, 0xc4, 0xc1, 0x96,
+ 0xa1, 0x14, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x08, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00,
+ 0x21, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49,
+ 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19,
+ 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42,
+ 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24,
+ 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72,
+ 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0,
+ 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00,
+ 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, 0x2e, 0xc2, 0xff, 0xff,
+ 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, 0xbc, 0x83, 0x3c, 0xc8,
+ 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, 0xb4, 0x81, 0x3c, 0xbc,
+ 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, 0xb4, 0x01, 0x39, 0xa4,
+ 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, 0xcc, 0x43, 0x3c, 0xc8,
+ 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0,
+ 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x10,
+ 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0, 0x0e, 0xe5, 0xd0, 0x06,
+ 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30, 0x0e, 0xe1, 0xc0, 0x0e,
+ 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00,
+ 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b, 0xc0, 0x83, 0x3c, 0x94,
+ 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4,
+ 0x43, 0x38, 0x90, 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00, 0x10,
+ 0xee, 0xf0, 0x0e, 0x6d, 0x60, 0x0e, 0xf2, 0x10, 0x0e, 0xed, 0x50, 0x0e,
+ 0x6d, 0x00, 0x0f, 0xef, 0x90, 0x0e, 0xee, 0x40, 0x0f, 0xe5, 0x20, 0x0f,
+ 0x6d, 0x50, 0x0e, 0xec, 0x90, 0x0e, 0xed, 0x00, 0xd0, 0x83, 0x3c, 0xd4,
+ 0x43, 0x39, 0x00, 0x83, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c, 0x84,
+ 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b, 0xd0,
+ 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b, 0xb4,
+ 0x81, 0x3b, 0xbc, 0x83, 0x3b, 0xb4, 0x01, 0x3b, 0x94, 0x43, 0x38, 0x98,
+ 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0x41, 0x3a, 0xb8, 0x83, 0x39, 0xcc,
+ 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d, 0xa0,
+ 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00, 0x10, 0xee, 0xf0, 0x0e,
+ 0x6d, 0xa0, 0x0e, 0xf5, 0xd0, 0x0e, 0xf0, 0xd0, 0x06, 0xf4, 0x10, 0x0e,
+ 0xe2, 0xc0, 0x0e, 0xe5, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc,
+ 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xb8, 0x43, 0x38, 0xb8,
+ 0xc3, 0x3c, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0,
+ 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0x00, 0xe1, 0x0e,
+ 0xef, 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xe7, 0xe0, 0x0e, 0xe5, 0x40, 0x0e,
+ 0x6d, 0xa0, 0x0f, 0xe5, 0x20, 0x0f, 0xef, 0x30, 0x0f, 0x6d, 0x60, 0x0e,
+ 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84,
+ 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0xc4, 0x3c, 0xd0, 0x43, 0x38, 0x8c,
+ 0xc3, 0x3a, 0xb4, 0x01, 0x3c, 0xc8, 0xc3, 0x3b, 0xd0, 0x43, 0x39, 0x8c,
+ 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xb4, 0x81, 0x38, 0xd4, 0x83, 0x39, 0x98,
+ 0x43, 0x39, 0xc8, 0x43, 0x1b, 0xcc, 0x43, 0x3a, 0xe8, 0x43, 0x39, 0x00,
+ 0x78, 0x00, 0x10, 0xf4, 0x10, 0x0e, 0xf2, 0x70, 0x0e, 0xe5, 0x40, 0x0f,
+ 0x6d, 0x60, 0x0e, 0xe5, 0x10, 0x0e, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e,
+ 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c, 0xd8, 0x01, 0x40, 0xd4,
+ 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39, 0xb4, 0x81, 0x39, 0xc0,
+ 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f,
+ 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50, 0x0e, 0x6d, 0x30, 0x0f,
+ 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e,
+ 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c, 0x94, 0x03, 0x00, 0x00,
+ 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x84, 0x40, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c,
+ 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x88, 0x10, 0x08, 0x45,
+ 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, 0x39, 0x02, 0x50, 0x18,
+ 0x01, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03,
+ 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83,
+ 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83,
+ 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10,
+ 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0,
+ 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80,
+ 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20,
+ 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60,
+ 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0,
+ 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90,
+ 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50,
+ 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20,
+ 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60,
+ 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0,
+ 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20,
+ 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10,
+ 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x43, 0x18, 0x02, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x2c, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2,
+ 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10,
+ 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09,
+ 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6,
+ 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05,
+ 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00,
+ 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6,
+ 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26,
+ 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6,
+ 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56,
+ 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61,
+ 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2,
+ 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1,
+ 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95,
+ 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89,
+ 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32,
+ 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66,
+ 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, 0x72,
+ 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67,
+ 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8,
+ 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd,
+ 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78, 0x86,
+ 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, 0xcc, 0xac,
+ 0x4c, 0x8e, 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99,
+ 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb6,
+ 0xb7, 0xb1, 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xaf, 0x34, 0x37, 0xb2, 0x32,
+ 0x3c, 0x22, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x8c, 0xc2,
+ 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe,
+ 0xe6, 0xd2, 0xf4, 0xca, 0x78, 0x85, 0xa5, 0xc9, 0xb9, 0x84, 0xc9, 0x9d,
+ 0x7d, 0xd1, 0xe5, 0xc1, 0x95, 0x7d, 0x85, 0xb1, 0xa5, 0x9d, 0xb9, 0x7d,
+ 0xcd, 0xa5, 0xe9, 0x95, 0x91, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b,
+ 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0xe3, 0x30, 0xf6, 0xc6, 0x36, 0x04, 0x0c,
+ 0x8c, 0xa0, 0x90, 0x8a, 0xc9, 0x18, 0x0a, 0xca, 0x08, 0x0c, 0xa1, 0xa8,
+ 0x0a, 0xcb, 0x18, 0x8a, 0xcb, 0x18, 0x0a, 0xa7, 0x78, 0x0a, 0xac, 0xc8,
+ 0x86, 0x08, 0x85, 0x36, 0xc4, 0x20, 0x80, 0x22, 0x2a, 0x36, 0x3e, 0x6f,
+ 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68,
+ 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, 0x86, 0x56,
+ 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x85, 0x37, 0xc4, 0x28,
+ 0xba, 0xe2, 0x3b, 0x8a, 0x21, 0x46, 0x01, 0x06, 0x05, 0x18, 0x1c, 0xc5,
+ 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81, 0x1c,
+ 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, 0x1d,
+ 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, 0x1d,
+ 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d,
+ 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, 0x1c,
+ 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, 0x1d,
+ 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, 0x1c,
+ 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, 0x1d,
+ 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, 0x06,
+ 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73, 0x90,
+ 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x01,
+ 0x07, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88,
+ 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73,
+ 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e,
+ 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30,
+ 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8,
+ 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b,
+ 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76,
+ 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e,
+ 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e,
+ 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61,
+ 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4,
+ 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76,
+ 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37,
+ 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76,
+ 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71,
+ 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e,
+ 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1,
+ 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61,
+ 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90,
+ 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8,
+ 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc,
+ 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7,
+ 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78,
+ 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f,
+ 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f,
+ 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1,
+ 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0,
+ 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0,
+ 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b,
+ 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c,
+ 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82,
+ 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05,
+ 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x60, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde,
+ 0x21, 0x0c, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91,
+ 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c,
+ 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02,
+ 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49,
+ 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80,
+ 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0,
+ 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00,
+ 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60,
+ 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, 0xfe, 0xff, 0xff, 0xff,
+ 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4,
+ 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde,
+ 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2,
+ 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4,
+ 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8,
+ 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08,
+ 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03,
+ 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07,
+ 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00,
+ 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca,
+ 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda,
+ 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08,
+ 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87,
+ 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87,
+ 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea,
+ 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2,
+ 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8,
+ 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda,
+ 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc,
+ 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6,
+ 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0,
+ 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87,
+ 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, 0x03, 0x7a, 0x08, 0x07,
+ 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6,
+ 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xdc, 0x21, 0x1c, 0xdc,
+ 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8,
+ 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0x70, 0x87,
+ 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, 0x87, 0x72, 0x20, 0x87,
+ 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, 0x87, 0x36, 0x30, 0x07,
+ 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0xc0, 0x1c, 0xc2,
+ 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, 0xe8, 0x21, 0x1c, 0xc6,
+ 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, 0xe8, 0xa1, 0x1c, 0xc6,
+ 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, 0xea, 0xc1, 0x1c, 0xcc,
+ 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xf4, 0xa1, 0x1c, 0x00,
+ 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, 0x87, 0x72, 0xa0, 0x87,
+ 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x87,
+ 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, 0xec, 0x00, 0x20, 0xea,
+ 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87,
+ 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, 0x87, 0x36, 0x98, 0x87,
+ 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, 0x07,
+ 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0xd8, 0x40,
+ 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, 0x36, 0x20, 0xc6, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, 0x05, 0x00, 0x00, 0x00,
+ 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x86, 0x40, 0x18,
+ 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00,
+ 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04,
+ 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14,
+ 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x48, 0x33, 0x00,
+ 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x70, 0x94,
+ 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, 0x13, 0x15, 0x11, 0xbf,
+ 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, 0x04, 0x17, 0x49, 0x53,
+ 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, 0x44, 0xf4, 0x4f, 0x63,
+ 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, 0x31, 0xca, 0x21, 0x34,
+ 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, 0xb0, 0x14, 0x24, 0x94,
+ 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, 0x01, 0x28, 0x8c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03,
+ 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83,
+ 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83,
+ 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10,
+ 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0,
+ 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80,
+ 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20,
+ 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60,
+ 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0,
+ 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0,
+ 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60,
+ 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90,
+ 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50,
+ 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20,
+ 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60,
+ 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0,
+ 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20,
+ 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10,
+ 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0,
+ 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0,
+ 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x43, 0x98, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x21, 0x8c, 0x03, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a,
+ 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04,
+ 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
+ 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84,
+ 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d,
+ 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c,
+ 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26,
+ 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1,
+ 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65,
+ 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56,
+ 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73,
+ 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x43, 0x84, 0xe7, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd,
+ 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d,
+ 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, 0x10,
+ 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2,
+ 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56,
+ 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x16,
+ 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f,
+ 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2,
+ 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca,
+ 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66, 0x19,
+ 0x1e, 0xe7, 0x79, 0x86, 0x08, 0x0f, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05,
+ 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c,
+ 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17,
+ 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34,
+ 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc,
+ 0x86, 0x40, 0xcb, 0xf0, 0x48, 0xcf, 0xf4, 0x50, 0x8f, 0xf3, 0x3c, 0x4f,
+ 0xf5, 0x58, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda,
+ 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95,
+ 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1,
+ 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0,
+ 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3,
+ 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84,
+ 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0xb4, 0x08, 0x0f,
+ 0xf6, 0x64, 0xcf, 0xf4, 0x68, 0x8f, 0xf3, 0x6c, 0x4f, 0xf5, 0x70, 0x54,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84,
+ 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5,
+ 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3,
+ 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96,
+ 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25,
+ 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf,
+ 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e,
+ 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e,
+ 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0xb0, 0x18, 0x8f, 0xf7, 0x7c,
+ 0x0b, 0xf1, 0x80, 0xc1, 0x32, 0x2c, 0xc2, 0x13, 0x06, 0x8f, 0x18, 0x2c,
+ 0xc4, 0x33, 0x06, 0x0b, 0xf1, 0x38, 0xcf, 0xf3, 0x54, 0x0f, 0x19, 0x70,
+ 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b, 0xa3,
+ 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46, 0x8c,
+ 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c, 0xed,
+ 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc, 0x87,
+ 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, 0x60,
+ 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, 0x34,
+ 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26,
+ 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10,
+ 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, 0x1e,
+ 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, 0x19,
+ 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, 0x03,
+ 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20,
+ 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40,
+ 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, 0x1c,
+ 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, 0x1d,
+ 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07,
+ 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, 0x30,
+ 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, 0x87,
+ 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, 0x87,
+ 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, 0x87,
+ 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87,
+ 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, 0x07,
+ 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, 0x87,
+ 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, 0x87,
+ 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, 0xe4,
+ 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, 0xdc,
+ 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66,
+ 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07,
+ 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10,
+ 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce,
+ 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b,
+ 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c,
+ 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07,
+ 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11,
+ 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0,
+ 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8,
+ 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b,
+ 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87,
+ 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07,
+ 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87,
+ 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81,
+ 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30,
+ 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4,
+ 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca,
+ 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39,
+ 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b,
+ 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b,
+ 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83,
+ 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87,
+ 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90,
+ 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20,
+ 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc,
+ 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66,
+ 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24,
+ 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07,
+ 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00,
+ 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d,
+ 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16,
+ 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7,
+ 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48,
+ 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10,
+ 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93,
+ 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x6c, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde,
+ 0x21, 0x0c, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91,
+ 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c,
+ 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02,
+ 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49,
+ 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80,
+ 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0,
+ 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00,
+ 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60,
+ 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36,
+ 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31,
+ 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90,
+ 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40,
+ 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0,
+ 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b,
+ 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38,
+ 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b,
+ 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0,
+ 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0,
+ 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0,
+ 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c,
+ 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c,
+ 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b,
+ 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, 0xe0, 0x0e, 0xef, 0xd0,
+ 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, 0xd0, 0x06, 0xf0, 0xf0,
+ 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xe5, 0xc0,
+ 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, 0xe0, 0x0e, 0x6d, 0xc0,
+ 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x90,
+ 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0x6d, 0xd0,
+ 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39,
+ 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, 0x3d, 0xb4, 0x03, 0x3c,
+ 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xcc, 0x03, 0x60,
+ 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0,
+ 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d,
+ 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, 0x3c, 0xa4, 0xc3, 0x39,
+ 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, 0x39, 0xc8, 0xc3, 0x3b,
+ 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d,
+ 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0x31,
+ 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, 0x00, 0x0f, 0xf2, 0xf0,
+ 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, 0x0f, 0x6d, 0x20,
+ 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xf3, 0x90,
+ 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, 0x3d, 0x84, 0x83, 0x3c,
+ 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, 0x39, 0x84, 0x03, 0x3d,
+ 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10,
+ 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50,
+ 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80,
+ 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c,
+ 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39,
+ 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30,
+ 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07,
+ 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8,
+ 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca,
+ 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca,
+ 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07,
+ 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07,
+ 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87,
+ 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2,
+ 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6,
+ 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca,
+ 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07,
+ 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07,
+ 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07,
+ 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87,
+ 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde,
+ 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0,
+ 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca,
+ 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda,
+ 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda,
+ 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda,
+ 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87,
+ 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87,
+ 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07,
+ 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde,
+ 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda,
+ 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07,
+ 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87,
+ 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07,
+ 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87,
+ 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0,
+ 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda,
+ 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6,
+ 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07,
+ 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87,
+ 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea,
+ 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde,
+ 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8,
+ 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61,
+ 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff,
+ 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff,
+ 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31,
+ 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04,
+ 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14,
+ 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00,
+ 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c,
+ 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47,
+ 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28,
+ 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e,
+ 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x4e, 0x93, 0xa6,
+ 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, 0x22, 0xe2, 0xb7, 0x87,
+ 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, 0x60, 0x10, 0x21, 0x09,
+ 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88,
+ 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, 0x28, 0x48, 0x08, 0x62,
+ 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, 0xcd, 0x11, 0x80, 0xc1,
+ 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, 0x8a, 0x89, 0x28, 0xa7,
+ 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, 0x40, 0x76, 0x20, 0x60,
+ 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, 0x00, 0x14, 0x06, 0x11,
+ 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48,
+ 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60,
+ 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80,
+ 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74,
+ 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d,
+ 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9,
+ 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76,
+ 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a,
+ 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72,
+ 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74,
+ 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78,
+ 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76,
+ 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6,
+ 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a,
+ 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74,
+ 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6,
+ 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71,
+ 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76,
+ 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75,
+ 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75,
+ 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75,
+ 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6,
+ 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72,
+ 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6,
+ 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71,
+ 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76,
+ 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x07, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x21, 0x0c, 0x04, 0x04, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0x10, 0xa6, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x60, 0x08, 0x73, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x90, 0x05, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a,
+ 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06,
+ 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10,
+ 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09,
+ 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6,
+ 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05,
+ 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01,
+ 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6,
+ 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26,
+ 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6,
+ 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56,
+ 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61,
+ 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec,
+ 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1,
+ 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95,
+ 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89,
+ 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32,
+ 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66,
+ 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, 0x72,
+ 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67,
+ 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8,
+ 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd,
+ 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, 0x86,
+ 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d,
+ 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b,
+ 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8,
+ 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61,
+ 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44,
+ 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11, 0x81,
+ 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94, 0xc2,
+ 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, 0xbe,
+ 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, 0x85,
+ 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, 0xc9,
+ 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, 0x73,
+ 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, 0xa3,
+ 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, 0xec,
+ 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x14, 0x15, 0x18, 0x86, 0x65, 0xd8, 0x84,
+ 0x69, 0x98, 0x83, 0x6d, 0x58, 0x85, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c,
+ 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a,
+ 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb,
+ 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57,
+ 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b,
+ 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a,
+ 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18,
+ 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37,
+ 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, 0x41,
+ 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, 0x91,
+ 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73,
+ 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb,
+ 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43,
+ 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99,
+ 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63,
+ 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, 0xb0,
+ 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd2,
+ 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, 0x22,
+ 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51,
+ 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2,
+ 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, 0x54,
+ 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, 0x74,
+ 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, 0xc0,
+ 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c,
+ 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31,
+ 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6,
+ 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f,
+ 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, 0x03,
+ 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, 0xc2,
+ 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, 0xd9,
+ 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, 0x1d,
+ 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, 0x32,
+ 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, 0x54,
+ 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, 0xc0,
+ 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e,
+ 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, 0x52,
+ 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, 0x79,
+ 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, 0xc0,
+ 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38, 0x00,
+ 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d, 0xae,
+ 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a, 0x1b,
+ 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50, 0xd0,
+ 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c, 0xd0,
+ 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e, 0xec,
+ 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e, 0xf4,
+ 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xf6,
+ 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25, 0x10,
+ 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e, 0xee,
+ 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f, 0xe5,
+ 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62, 0xc4,
+ 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e, 0xf0,
+ 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f, 0xe9,
+ 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11, 0x4c,
+ 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, 0x43,
+ 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c,
+ 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3,
+ 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6,
+ 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e,
+ 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43,
+ 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03,
+ 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48,
+ 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20,
+ 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e,
+ 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d,
+ 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89,
+ 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83,
+ 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90,
+ 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78,
+ 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98,
+ 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5,
+ 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c,
+ 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c,
+ 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43,
+ 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43,
+ 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82,
+ 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58,
+ 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18,
+ 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2,
+ 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec,
+ 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e,
+ 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d,
+ 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83,
+ 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60,
+ 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0,
+ 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f,
+ 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9,
+ 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9,
+ 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c,
+ 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1,
+ 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44,
+ 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00,
+ 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf,
+ 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a,
+ 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19,
+ 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00,
+ 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23,
+ 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30,
+ 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20,
+ 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34,
+ 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20,
+ 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8,
+ 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1,
+ 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0,
+ 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19,
+ 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23,
+ 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c,
+ 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c,
+ 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73,
+ 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95,
+ 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x79, 0x03, 0x00, 0x00,
+ 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39,
+ 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62,
+ 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
+ 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21,
+ 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48,
+ 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00,
+ 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38,
+ 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3,
+ 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee,
+ 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9,
+ 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80,
+ 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3,
+ 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43,
+ 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03,
+ 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5,
+ 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9,
+ 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4,
+ 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43,
+ 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3,
+ 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03,
+ 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0,
+ 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5,
+ 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef,
+ 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee,
+ 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6,
+ 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83,
+ 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43,
+ 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43,
+ 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00,
+ 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00,
+ 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1,
+ 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43,
+ 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41,
+ 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3,
+ 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d,
+ 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef,
+ 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04,
+ 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43,
+ 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d,
+ 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3,
+ 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed,
+ 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03,
+ 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03,
+ 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6,
+ 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff,
+ 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c,
+ 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e,
+ 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e,
+ 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48,
+ 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08,
+ 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98,
+ 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d,
+ 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c,
+ 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c,
+ 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78,
+ 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80,
+ 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28,
+ 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c,
+ 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d,
+ 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c,
+ 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d,
+ 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20,
+ 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d,
+ 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0,
+ 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70,
+ 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68,
+ 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c,
+ 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d,
+ 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0,
+ 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0,
+ 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8,
+ 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0,
+ 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c,
+ 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e,
+ 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0,
+ 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68,
+ 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00,
+ 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c,
+ 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d,
+ 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28,
+ 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9,
+ 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5,
+ 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00,
+ 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18,
+ 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83,
+ 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93,
+ 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06,
+ 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8,
+ 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1,
+ 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59,
+ 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08,
+ 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04,
+ 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17,
+ 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34,
+ 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70,
+ 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79,
+ 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e,
+ 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07,
+ 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07,
+ 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07,
+ 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07,
+ 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07,
+ 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07,
+ 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06,
+ 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07,
+ 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07,
+ 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07,
+ 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06,
+ 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07,
+ 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07,
+ 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07,
+ 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07,
+ 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06,
+ 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07,
+ 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07,
+ 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07,
+ 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07,
+ 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07,
+ 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06,
+ 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07,
+ 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07,
+ 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07,
+ 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07,
+ 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07,
+ 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07,
+ 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07,
+ 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04,
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00,
+ 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47,
+ 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50,
+ 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40,
+ 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00,
+ 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84,
+ 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d,
+ 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c,
+ 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26,
+ 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1,
+ 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68,
+ 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56,
+ 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73,
+ 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd,
+ 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d,
+ 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10,
+ 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2,
+ 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56,
+ 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16,
+ 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f,
+ 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2,
+ 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca,
+ 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a,
+ 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05,
+ 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c,
+ 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17,
+ 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34,
+ 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc,
+ 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, 0x51, 0x94, 0x43, 0x3d, 0x54,
+ 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda,
+ 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95,
+ 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1,
+ 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0,
+ 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3,
+ 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84,
+ 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x04, 0x11, 0x14,
+ 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, 0x6d, 0x54, 0x45, 0x71, 0x54,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84,
+ 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5,
+ 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3,
+ 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96,
+ 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25,
+ 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf,
+ 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e,
+ 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e,
+ 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d,
+ 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40,
+ 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90,
+ 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2,
+ 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6,
+ 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86,
+ 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33,
+ 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a,
+ 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a,
+ 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0,
+ 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49,
+ 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2,
+ 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90,
+ 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c,
+ 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01,
+ 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f,
+ 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b,
+ 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19,
+ 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36,
+ 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88,
+ 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87,
+ 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5,
+ 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a,
+ 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26,
+ 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac,
+ 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b,
+ 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a,
+ 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1,
+ 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d,
+ 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07,
+ 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c,
+ 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9,
+ 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81,
+ 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76,
+ 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04,
+ 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79,
+ 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70,
+ 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a,
+ 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79,
+ 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74,
+ 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76,
+ 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77,
+ 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41,
+ 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1,
+ 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66,
+ 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07,
+ 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10,
+ 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce,
+ 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b,
+ 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c,
+ 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07,
+ 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11,
+ 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0,
+ 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8,
+ 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b,
+ 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87,
+ 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07,
+ 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87,
+ 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81,
+ 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30,
+ 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4,
+ 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca,
+ 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39,
+ 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b,
+ 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b,
+ 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83,
+ 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87,
+ 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90,
+ 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20,
+ 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc,
+ 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66,
+ 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24,
+ 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07,
+ 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00,
+ 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48,
+ 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48,
+ 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4,
+ 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff,
+ 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c,
+ 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06,
+ 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xdd,
+ 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, 0x80, 0xe0, 0x0c, 0x00,
+ 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, 0x10, 0x99, 0x01, 0xa0,
+ 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, 0x10, 0xff, 0x46, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, 0x88, 0x01, 0xe4, 0x4c,
+ 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, 0x01, 0xf4, 0x50, 0xca,
+ 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, 0x08, 0x86, 0x33, 0xc8,
+ 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, 0x8d, 0xa5, 0xa0, 0xd8,
+ 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, 0xcf, 0x78, 0x03, 0x07,
+ 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, 0x43, 0x10, 0x4d, 0x23,
+ 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, 0x4c, 0x41, 0x1c, 0x8c,
+ 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c,
+ 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, 0x4b, 0x30, 0xc7, 0x60,
+ 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, 0x07, 0x17, 0x8c, 0xa5,
+ 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, 0x10, 0x81, 0x1f, 0x44,
+ 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, 0xf0, 0xe1, 0x81, 0x05,
+ 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00,
+ 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39,
+ 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62,
+ 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
+ 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21,
+ 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48,
+ 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00,
+ 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38,
+ 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3,
+ 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee,
+ 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9,
+ 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80,
+ 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3,
+ 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43,
+ 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03,
+ 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5,
+ 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9,
+ 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4,
+ 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43,
+ 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3,
+ 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03,
+ 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0,
+ 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5,
+ 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef,
+ 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee,
+ 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6,
+ 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83,
+ 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43,
+ 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43,
+ 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00,
+ 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00,
+ 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1,
+ 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43,
+ 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41,
+ 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3,
+ 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d,
+ 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef,
+ 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04,
+ 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43,
+ 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d,
+ 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3,
+ 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed,
+ 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03,
+ 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03,
+ 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6,
+ 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff,
+ 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c,
+ 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e,
+ 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e,
+ 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48,
+ 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08,
+ 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98,
+ 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d,
+ 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c,
+ 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c,
+ 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78,
+ 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80,
+ 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28,
+ 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c,
+ 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d,
+ 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c,
+ 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d,
+ 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20,
+ 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d,
+ 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0,
+ 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70,
+ 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68,
+ 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c,
+ 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d,
+ 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0,
+ 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0,
+ 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8,
+ 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0,
+ 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c,
+ 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e,
+ 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0,
+ 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68,
+ 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00,
+ 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c,
+ 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d,
+ 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28,
+ 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9,
+ 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5,
+ 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00,
+ 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18,
+ 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83,
+ 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93,
+ 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06,
+ 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8,
+ 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1,
+ 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59,
+ 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08,
+ 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04,
+ 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17,
+ 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34,
+ 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70,
+ 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79,
+ 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e,
+ 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07,
+ 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07,
+ 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07,
+ 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07,
+ 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07,
+ 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07,
+ 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06,
+ 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07,
+ 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07,
+ 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07,
+ 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06,
+ 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07,
+ 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07,
+ 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07,
+ 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07,
+ 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06,
+ 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07,
+ 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07,
+ 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07,
+ 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07,
+ 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07,
+ 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06,
+ 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07,
+ 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07,
+ 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07,
+ 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07,
+ 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07,
+ 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07,
+ 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07,
+ 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04,
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00,
+ 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47,
+ 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50,
+ 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40,
+ 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00,
+ 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84,
+ 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d,
+ 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c,
+ 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26,
+ 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1,
+ 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68,
+ 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56,
+ 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73,
+ 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd,
+ 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d,
+ 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10,
+ 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2,
+ 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56,
+ 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16,
+ 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f,
+ 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2,
+ 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca,
+ 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a,
+ 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05,
+ 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c,
+ 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17,
+ 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34,
+ 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc,
+ 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, 0x51, 0x94, 0x43, 0x3d, 0x54,
+ 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda,
+ 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95,
+ 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1,
+ 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0,
+ 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3,
+ 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84,
+ 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x04, 0x11, 0x14,
+ 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, 0x6d, 0x54, 0x45, 0x71, 0x54,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84,
+ 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5,
+ 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3,
+ 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96,
+ 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25,
+ 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf,
+ 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e,
+ 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e,
+ 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d,
+ 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40,
+ 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90,
+ 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2,
+ 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6,
+ 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86,
+ 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33,
+ 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a,
+ 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a,
+ 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0,
+ 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49,
+ 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2,
+ 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90,
+ 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c,
+ 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01,
+ 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f,
+ 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b,
+ 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19,
+ 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36,
+ 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88,
+ 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87,
+ 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5,
+ 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a,
+ 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26,
+ 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac,
+ 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b,
+ 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a,
+ 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1,
+ 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d,
+ 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07,
+ 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c,
+ 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9,
+ 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81,
+ 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76,
+ 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04,
+ 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79,
+ 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70,
+ 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a,
+ 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79,
+ 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74,
+ 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76,
+ 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77,
+ 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41,
+ 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1,
+ 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66,
+ 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07,
+ 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10,
+ 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce,
+ 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b,
+ 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c,
+ 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07,
+ 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11,
+ 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0,
+ 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8,
+ 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b,
+ 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87,
+ 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07,
+ 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87,
+ 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81,
+ 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30,
+ 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4,
+ 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca,
+ 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39,
+ 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b,
+ 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b,
+ 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83,
+ 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87,
+ 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90,
+ 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20,
+ 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc,
+ 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66,
+ 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24,
+ 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07,
+ 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00,
+ 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48,
+ 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48,
+ 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4,
+ 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff,
+ 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c,
+ 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06,
+ 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xde,
+ 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, 0xd0, 0xab, 0x81, 0x11,
+ 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, 0x12, 0x02, 0x80, 0xc8,
+ 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40,
+ 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10,
+ 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, 0x06, 0xca, 0x10, 0x94,
+ 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, 0x41, 0x81, 0x0c, 0x32,
+ 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, 0x83, 0x10, 0x4c, 0x83,
+ 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, 0x43, 0x00, 0x1f, 0xf2,
+ 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, 0x18, 0xb8, 0xc1, 0x05,
+ 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, 0x18, 0x14, 0x44, 0x50,
+ 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, 0xde, 0x50, 0x06, 0x69,
+ 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x18, 0x18, 0x8c,
+ 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x79, 0x30,
+ 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32,
+ 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, 0x0a, 0x51, 0x30, 0xc7,
+ 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, 0x1e, 0x58, 0x50, 0xc9,
+ 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x25, 0x08,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+const unsigned int sdl_metallib_len = 22744;
diff --git a/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_osx.h b/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_osx.h
new file mode 100644
index 0000000..787c6fe
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/metal/SDL_shaders_metal_osx.h
@@ -0,0 +1,1903 @@
+const unsigned char sdl_metallib[] = {
+ 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x80, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x54, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
+ 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f,
+ 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54,
+ 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00,
+ 0xcb, 0x86, 0x8e, 0x78, 0x90, 0x1d, 0xa9, 0xc3, 0xb9, 0xec, 0xcd, 0xec,
+ 0x69, 0xba, 0x3d, 0x7e, 0x97, 0xb5, 0xa9, 0x05, 0x01, 0xbe, 0x87, 0xd8,
+ 0x0c, 0xca, 0x1a, 0xb4, 0x91, 0x54, 0x7e, 0x29, 0x4f, 0x46, 0x46, 0x54,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00,
+ 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f,
+ 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59,
+ 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0xf5,
+ 0xc6, 0xe3, 0x26, 0x71, 0xe3, 0x1c, 0x45, 0x4d, 0xb1, 0xdb, 0x0e, 0x1a,
+ 0x29, 0x85, 0x9d, 0xa7, 0x04, 0x40, 0x91, 0x18, 0x99, 0x5c, 0x9f, 0xdb,
+ 0x7c, 0x30, 0xd1, 0x67, 0x59, 0xd8, 0xa4, 0x4f, 0x46, 0x46, 0x54, 0x18,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e,
+ 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c,
+ 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00,
+ 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20,
+ 0x00, 0x31, 0xa8, 0x6b, 0xb7, 0x4d, 0x8a, 0x56, 0xc7, 0x91, 0xa4, 0x37,
+ 0xfd, 0xa6, 0xbf, 0x79, 0xd1, 0x55, 0x8c, 0xd5, 0x1b, 0x88, 0x69, 0x8e,
+ 0x6c, 0xf0, 0x53, 0x1b, 0xd3, 0x35, 0xfe, 0x3f, 0x01, 0x4f, 0x46, 0x46,
+ 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08,
+ 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00,
+ 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43,
+ 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74,
+ 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48,
+ 0x20, 0x00, 0x52, 0xe7, 0xfc, 0x67, 0x4e, 0xed, 0x7a, 0xa8, 0x44, 0x82,
+ 0xb2, 0x41, 0x3c, 0xdb, 0x9e, 0xe8, 0x5b, 0xbb, 0x30, 0x60, 0xf8, 0xa1,
+ 0x94, 0xac, 0xb4, 0x80, 0xaa, 0x08, 0xa6, 0xa0, 0xe6, 0xfd, 0x4f, 0x46,
+ 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00,
+ 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00,
+ 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f,
+ 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74,
+ 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48,
+ 0x20, 0x00, 0x28, 0x59, 0x9d, 0x20, 0x32, 0xc7, 0x94, 0x63, 0xa8, 0xda,
+ 0x9c, 0xac, 0x28, 0xb8, 0x01, 0xc3, 0x5f, 0x48, 0xf6, 0x74, 0x09, 0x1a,
+ 0xd9, 0x84, 0x91, 0x19, 0xc6, 0xe7, 0x4e, 0x94, 0x47, 0xce, 0x4f, 0x46,
+ 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2a, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00,
+ 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00,
+ 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f,
+ 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e,
+ 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53,
+ 0x48, 0x20, 0x00, 0x08, 0x35, 0xd4, 0x21, 0x2f, 0xca, 0x8d, 0x22, 0xb2,
+ 0xa3, 0x9a, 0xd8, 0xd9, 0x46, 0x6d, 0x01, 0x7d, 0x06, 0x95, 0x04, 0x7a,
+ 0x94, 0xdf, 0x2b, 0xd2, 0x21, 0xea, 0x99, 0x9f, 0x2b, 0xda, 0x65, 0x4f,
+ 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01,
+ 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79,
+ 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c,
+ 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65,
+ 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41,
+ 0x53, 0x48, 0x20, 0x00, 0xe0, 0x53, 0xda, 0x06, 0xef, 0x80, 0x49, 0x61,
+ 0xf6, 0x9e, 0xee, 0xfe, 0x49, 0xb6, 0xd2, 0xce, 0xb8, 0xea, 0x5f, 0x9a,
+ 0xf4, 0x77, 0x35, 0xe7, 0xd3, 0xfc, 0x0f, 0xf6, 0x01, 0xe5, 0x90, 0xd6,
+ 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x46,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00,
+ 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54,
+ 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00,
+ 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x38, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xcb, 0x02, 0x00, 0x00,
+ 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39,
+ 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62,
+ 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
+ 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21,
+ 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48,
+ 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00,
+ 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18,
+ 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3,
+ 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee,
+ 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9,
+ 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80,
+ 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3,
+ 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43,
+ 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03,
+ 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5,
+ 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9,
+ 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4,
+ 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43,
+ 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3,
+ 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03,
+ 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0,
+ 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5,
+ 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef,
+ 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee,
+ 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6,
+ 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83,
+ 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43,
+ 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43,
+ 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00,
+ 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00,
+ 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1,
+ 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43,
+ 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41,
+ 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3,
+ 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d,
+ 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef,
+ 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04,
+ 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43,
+ 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d,
+ 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3,
+ 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed,
+ 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03,
+ 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03,
+ 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6,
+ 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94,
+ 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4,
+ 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18,
+ 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0,
+ 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84,
+ 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4,
+ 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94,
+ 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30,
+ 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47,
+ 0x10, 0x50, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03,
+ 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83,
+ 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03,
+ 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0,
+ 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0,
+ 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80,
+ 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60,
+ 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10,
+ 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60,
+ 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60,
+ 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0,
+ 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60,
+ 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40,
+ 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20,
+ 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20,
+ 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20,
+ 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60,
+ 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0,
+ 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20,
+ 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20,
+ 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10,
+ 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40,
+ 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90,
+ 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x30, 0x02, 0x50,
+ 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, 0xd4, 0x46, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10,
+ 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09,
+ 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6,
+ 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05,
+ 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00,
+ 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6,
+ 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, 0xe0, 0x16, 0x96, 0x26,
+ 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6,
+ 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56,
+ 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61,
+ 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5,
+ 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1,
+ 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95,
+ 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85,
+ 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7,
+ 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97,
+ 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96,
+ 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69,
+ 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2,
+ 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe,
+ 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90,
+ 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b,
+ 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59,
+ 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, 0x69, 0x72, 0x2e,
+ 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x2c, 0xcc,
+ 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, 0xd1, 0x4d, 0xa5,
+ 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, 0x81, 0x96, 0x6a,
+ 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce,
+ 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, 0xdb, 0xdb, 0x58,
+ 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, 0x19, 0x1e, 0x91,
+ 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, 0x61, 0x69, 0x72,
+ 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x69,
+ 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8,
+ 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, 0xbe, 0xe6, 0xd2,
+ 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x0c, 0xe1, 0x10,
+ 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, 0x0d, 0x21, 0x16,
+ 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, 0x84, 0xa5, 0xc9,
+ 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95,
+ 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, 0xa1, 0x02, 0x27,
+ 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x04, 0x0c, 0x90,
+ 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, 0x60, 0xd1, 0x96,
+ 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, 0x05, 0x5a, 0xc2,
+ 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, 0x5c, 0xdb, 0x10,
+ 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, 0xe4, 0x40, 0x82,
+ 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, 0x05, 0x0c, 0x16,
+ 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74,
+ 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, 0x38, 0xd8,
+ 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5, 0x59, 0xcc, 0x60,
+ 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06, 0x0b, 0x19, 0x2c,
+ 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80, 0xcf, 0x5b, 0x9b,
+ 0x5b, 0x1a, 0xdc, 0x1b, 0x5d, 0x99, 0x1b, 0x1d, 0xc8, 0x18, 0x5a, 0x98,
+ 0x1c, 0x9f, 0xa9, 0xb4, 0x36, 0x38, 0xb6, 0x32, 0x90, 0xa1, 0x95, 0x15,
+ 0x10, 0x2a, 0xa1, 0xa0, 0xa0, 0x21, 0xc2, 0xc2, 0x06, 0x43, 0x8c, 0x65,
+ 0x0d, 0x96, 0x36, 0x68, 0x90, 0x21, 0xc6, 0xe2, 0x06, 0x8b, 0x1b, 0x34,
+ 0xc8, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81,
+ 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21,
+ 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1,
+ 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1,
+ 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1,
+ 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1,
+ 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60,
+ 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1,
+ 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10,
+ 0x06, 0xa2, 0x30, 0x23, 0x94, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b,
+ 0x28, 0x07, 0x79, 0xa0, 0x87, 0x72, 0xc0, 0x87, 0x29, 0x81, 0x1a, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c,
+ 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3,
+ 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6,
+ 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e,
+ 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43,
+ 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03,
+ 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48,
+ 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20,
+ 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e,
+ 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d,
+ 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89,
+ 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83,
+ 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90,
+ 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78,
+ 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98,
+ 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5,
+ 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c,
+ 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c,
+ 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43,
+ 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43,
+ 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82,
+ 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58,
+ 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18,
+ 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2,
+ 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec,
+ 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e,
+ 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d,
+ 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83,
+ 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60,
+ 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0,
+ 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, 0x0c, 0x7f, 0x45, 0x44,
+ 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00,
+ 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x20,
+ 0x31, 0x03, 0x40, 0x61, 0x06, 0x80, 0xc0, 0x08, 0xc0, 0x18, 0x01, 0x08,
+ 0x82, 0x20, 0xfe, 0x01, 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c,
+ 0x12, 0x14, 0xe3, 0x11, 0x0e, 0x64, 0x41, 0x14, 0x94, 0x59, 0x82, 0x60,
+ 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x44,
+ 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x25, 0xb2, 0xc0, 0x90, 0xcf,
+ 0x2c, 0x81, 0x30, 0x50, 0x81, 0xf8, 0x41, 0x50, 0x09, 0x03, 0x15, 0x01,
+ 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, 0x40, 0x41, 0x18, 0x0c,
+ 0x32, 0x04, 0xd1, 0x75, 0x45, 0x93, 0xf1, 0x08, 0xce, 0x23, 0x83, 0x80,
+ 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, 0x98, 0x92, 0x06, 0x30,
+ 0x18, 0x6e, 0x08, 0x34, 0x30, 0x98, 0x65, 0x18, 0x84, 0x60, 0x3c, 0xc2,
+ 0x22, 0x03, 0x35, 0x88, 0x06, 0x23, 0x02, 0xa2, 0x00, 0x6c, 0x62, 0x03,
+ 0x18, 0x0c, 0x37, 0x04, 0x1d, 0x18, 0xcc, 0x32, 0x10, 0x41, 0x30, 0x1e,
+ 0x91, 0x9d, 0x41, 0x1b, 0x9c, 0x01, 0x05, 0x65, 0x3c, 0x62, 0x4b, 0x83,
+ 0x37, 0x08, 0x03, 0x0a, 0xca, 0x78, 0x44, 0xb7, 0x06, 0x71, 0x40, 0x06,
+ 0x14, 0x94, 0xf1, 0x88, 0xaf, 0x0d, 0xe6, 0xe0, 0x0c, 0x28, 0x28, 0xe3,
+ 0x11, 0x60, 0xf0, 0x06, 0x75, 0xf0, 0x06, 0x83, 0x11, 0x01, 0x52, 0x00,
+ 0xe3, 0x11, 0x61, 0x00, 0x07, 0x76, 0x80, 0x06, 0x83, 0x11, 0xc1, 0x51,
+ 0x00, 0xe3, 0x11, 0x62, 0x10, 0x07, 0x77, 0xa0, 0x06, 0x83, 0x11, 0x81,
+ 0x51, 0x00, 0xe3, 0x11, 0x63, 0x20, 0x07, 0x78, 0xc0, 0x06, 0x83, 0x11,
+ 0x41, 0x51, 0x00, 0xf7, 0x06, 0x2d, 0xc6, 0x13, 0xe6, 0x20, 0xa0, 0x80,
+ 0x8c, 0x21, 0x04, 0x7c, 0x30, 0xc7, 0xc0, 0x06, 0x41, 0x1f, 0x8c, 0x21,
+ 0x0c, 0x7f, 0x30, 0xc7, 0x20, 0x04, 0xa0, 0x30, 0xc7, 0x10, 0xb8, 0x41,
+ 0x1f, 0xcc, 0x31, 0x04, 0x6e, 0xc0, 0x07, 0x83, 0x0c, 0x41, 0x1c, 0xdc,
+ 0x81, 0x05, 0x95, 0x7c, 0x66, 0x09, 0x8a, 0x81, 0x0a, 0x44, 0x25, 0x88,
+ 0xaa, 0x18, 0xa8, 0x08, 0x08, 0x22, 0x2a, 0xc6, 0x10, 0x0a, 0x61, 0x8e,
+ 0xc1, 0x0e, 0x82, 0x53, 0x18, 0x64, 0x08, 0xee, 0xa0, 0x0f, 0xae, 0x68,
+ 0x32, 0x1e, 0x51, 0x07, 0xa4, 0xa0, 0x0a, 0x01, 0x05, 0xc5, 0x02, 0x42,
+ 0x3e, 0x16, 0x20, 0xf0, 0x31, 0xe5, 0x15, 0x60, 0x30, 0xdc, 0x10, 0x80,
+ 0x02, 0x18, 0xcc, 0x32, 0x18, 0x45, 0x30, 0xdb, 0x00, 0x0a, 0x03, 0x30,
+ 0xdb, 0x10, 0xf8, 0x41, 0x90, 0x41, 0x40, 0x0c, 0x08, 0x00, 0x00, 0x00,
+ 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, 0xbc, 0xc1, 0x96, 0x61,
+ 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, 0x65, 0x80, 0x83, 0xe0,
+ 0x0d, 0xb6, 0x0c, 0xa1, 0x10, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00,
+ 0xe1, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49,
+ 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19,
+ 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42,
+ 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24,
+ 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72,
+ 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0,
+ 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00,
+ 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00,
+ 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c,
+ 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09,
+ 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a,
+ 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72,
+ 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72,
+ 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73,
+ 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21,
+ 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21,
+ 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81,
+ 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73,
+ 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79,
+ 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79,
+ 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80,
+ 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0,
+ 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21,
+ 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21,
+ 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77,
+ 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36,
+ 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36,
+ 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77,
+ 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77,
+ 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78,
+ 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1,
+ 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1,
+ 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61,
+ 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77,
+ 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73,
+ 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41,
+ 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21,
+ 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41,
+ 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21,
+ 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72,
+ 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78,
+ 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79,
+ 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36,
+ 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21,
+ 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21,
+ 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73,
+ 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70,
+ 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70,
+ 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2,
+ 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1,
+ 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70,
+ 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7,
+ 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44,
+ 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16,
+ 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e,
+ 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e,
+ 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e,
+ 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c,
+ 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18,
+ 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23,
+ 0x08, 0x28, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03,
+ 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83,
+ 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03,
+ 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0,
+ 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0,
+ 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80,
+ 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60,
+ 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20,
+ 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0,
+ 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10,
+ 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60,
+ 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60,
+ 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0,
+ 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30,
+ 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80,
+ 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60,
+ 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40,
+ 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20,
+ 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20,
+ 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20,
+ 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60,
+ 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0,
+ 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20,
+ 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20,
+ 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10,
+ 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40,
+ 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80,
+ 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0,
+ 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90,
+ 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x50, 0x10, 0x23,
+ 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, 0x85, 0x40, 0x6d, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00,
+ 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84,
+ 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d,
+ 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c,
+ 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26,
+ 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x04, 0x64, 0x60, 0xd1,
+ 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x64,
+ 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56,
+ 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73,
+ 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x43, 0x84, 0xe5, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd,
+ 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d,
+ 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61,
+ 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6,
+ 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6,
+ 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58,
+ 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8,
+ 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd,
+ 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb,
+ 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6,
+ 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x46,
+ 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x6f,
+ 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, 0xca, 0xe4, 0xc2,
+ 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, 0xde, 0xde, 0xe4,
+ 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, 0xb1, 0xbd, 0x85,
+ 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, 0x93, 0x23, 0x1b,
+ 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0, 0x62, 0x0d, 0x21,
+ 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99,
+ 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3,
+ 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96,
+ 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25,
+ 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf,
+ 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e,
+ 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e,
+ 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01, 0x09, 0x96, 0x6d,
+ 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x88,
+ 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9, 0xdc, 0x10, 0x0e,
+ 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61,
+ 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f, 0x4f, 0x58, 0x9a,
+ 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7, 0x5c, 0x9a, 0x5e,
+ 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c, 0x1a, 0x2a, 0x70,
+ 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0xc0, 0x00,
+ 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, 0x40, 0x82, 0x65,
+ 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68,
+ 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d,
+ 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xe4,
+ 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45,
+ 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65,
+ 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8,
+ 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, 0x83, 0xc5, 0x59,
+ 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, 0x02, 0x06, 0x0b,
+ 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, 0x16, 0x6c, 0x59,
+ 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74,
+ 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca,
+ 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8b,
+ 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, 0x86, 0x18, 0x0b,
+ 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41,
+ 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90,
+ 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a,
+ 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8,
+ 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98,
+ 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48,
+ 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60,
+ 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70,
+ 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, 0xc2, 0x21, 0x1d,
+ 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, 0xca, 0x01, 0x1f,
+ 0xa6, 0x04, 0x6c, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88,
+ 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73,
+ 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e,
+ 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30,
+ 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8,
+ 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b,
+ 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76,
+ 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e,
+ 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e,
+ 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61,
+ 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4,
+ 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76,
+ 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37,
+ 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76,
+ 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71,
+ 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e,
+ 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1,
+ 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61,
+ 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90,
+ 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8,
+ 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc,
+ 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7,
+ 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78,
+ 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f,
+ 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f,
+ 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1,
+ 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0,
+ 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0,
+ 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b,
+ 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c,
+ 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, 0xf9, 0x73, 0xce, 0x83,
+ 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00,
+ 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94,
+ 0x00, 0x8d, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, 0x10,
+ 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12,
+ 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0x0d, 0x64, 0x41, 0x14,
+ 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b,
+ 0x9a, 0x8c, 0x47, 0x40, 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x05,
+ 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x80, 0x42, 0x50,
+ 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31,
+ 0x40, 0x41, 0x18, 0x0c, 0x32, 0x04, 0x91, 0x75, 0x45, 0x93, 0xf1, 0x88,
+ 0xcd, 0x23, 0x83, 0x80, 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8,
+ 0x98, 0xa2, 0x06, 0x30, 0x18, 0x6e, 0x08, 0xc8, 0x00, 0x0c, 0x66, 0x19,
+ 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xc8, 0x40, 0x0d, 0xa2, 0xc1, 0x88, 0x80,
+ 0x28, 0x00, 0x9b, 0xda, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x19, 0x80, 0xc1,
+ 0x2c, 0x03, 0x11, 0x04, 0xe3, 0x11, 0xd9, 0x19, 0xb4, 0xc1, 0x19, 0x50,
+ 0x50, 0xc6, 0x23, 0xb6, 0x34, 0x78, 0x03, 0x30, 0xa0, 0xa0, 0x8c, 0x47,
+ 0x74, 0x6b, 0x10, 0x07, 0x63, 0x40, 0x41, 0x19, 0x8f, 0xf8, 0xda, 0x60,
+ 0x0e, 0xcc, 0x80, 0x82, 0x32, 0x1e, 0x01, 0x06, 0x6f, 0x50, 0x07, 0x6f,
+ 0x30, 0x18, 0x11, 0x20, 0x05, 0x30, 0x1e, 0x11, 0x06, 0x70, 0x60, 0x07,
+ 0x67, 0x30, 0x18, 0x11, 0x1c, 0x05, 0x30, 0x1e, 0x21, 0x06, 0x71, 0x70,
+ 0x07, 0x69, 0x30, 0x18, 0x11, 0x18, 0x05, 0x30, 0x1e, 0x31, 0x06, 0x72,
+ 0x80, 0x07, 0x6b, 0x30, 0x18, 0x11, 0x14, 0x05, 0x70, 0x6e, 0xd0, 0x62,
+ 0x3c, 0x61, 0x0e, 0x02, 0x0a, 0xc8, 0x18, 0x42, 0xc0, 0x07, 0x73, 0x0c,
+ 0x6c, 0x10, 0xf4, 0xc1, 0x18, 0xc2, 0x00, 0x0a, 0x73, 0x0c, 0x42, 0x10,
+ 0x0a, 0x73, 0x0c, 0x41, 0x1b, 0xf8, 0xc1, 0x1c, 0x43, 0xf0, 0x06, 0x7d,
+ 0x30, 0xc8, 0x10, 0xc4, 0x81, 0x1d, 0x58, 0x50, 0xc9, 0x67, 0x96, 0xa0,
+ 0x18, 0xa8, 0x40, 0x58, 0x82, 0xa8, 0x8a, 0x81, 0x8a, 0x80, 0x20, 0xa2,
+ 0x62, 0x0c, 0xa1, 0x10, 0xe6, 0x18, 0xec, 0x20, 0x38, 0x85, 0x41, 0x86,
+ 0xe0, 0x0e, 0xf8, 0xe0, 0x8a, 0x26, 0xe3, 0x11, 0x75, 0x40, 0x0a, 0xaa,
+ 0x10, 0x50, 0x50, 0x2c, 0x20, 0xe4, 0x63, 0x01, 0x02, 0x1f, 0x53, 0x60,
+ 0x01, 0x06, 0xc3, 0x0d, 0x81, 0x2a, 0x80, 0xc1, 0x2c, 0x83, 0x51, 0x04,
+ 0xe3, 0x09, 0xa8, 0x70, 0x51, 0x40, 0x66, 0x1b, 0x44, 0xa1, 0x00, 0x66,
+ 0x1b, 0x02, 0x21, 0xc8, 0x20, 0x20, 0x06, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, 0xc4, 0xc1, 0x96, 0x61,
+ 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, 0x65, 0x80, 0x83, 0x20,
+ 0x0e, 0xb6, 0x0c, 0xa1, 0x10, 0xc4, 0xc1, 0x96, 0x01, 0x15, 0x82, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x98, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde,
+ 0x21, 0x0c, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91,
+ 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c,
+ 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02,
+ 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49,
+ 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80,
+ 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0,
+ 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00,
+ 0x81, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40,
+ 0x2e, 0xc2, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38,
+ 0xbc, 0x83, 0x3c, 0xc8, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e,
+ 0xb4, 0x81, 0x3c, 0xbc, 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39,
+ 0xb4, 0x01, 0x39, 0xa4, 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b,
+ 0xcc, 0x43, 0x3c, 0xc8, 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b,
+ 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30,
+ 0x0f, 0xe5, 0x00, 0x10, 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0,
+ 0x0e, 0xe5, 0xd0, 0x06, 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30,
+ 0x0e, 0xe1, 0xc0, 0x0e, 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b,
+ 0xcc, 0x43, 0x39, 0x00, 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b,
+ 0xc0, 0x83, 0x3c, 0x94, 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b,
+ 0x98, 0x03, 0x3c, 0xb4, 0x43, 0x38, 0x90, 0x03, 0x40, 0x0f, 0xf2, 0x50,
+ 0x0f, 0xe5, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x60, 0x0e, 0xf2, 0x10,
+ 0x0e, 0xed, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0xef, 0x90, 0x0e, 0xee, 0x40,
+ 0x0f, 0xe5, 0x20, 0x0f, 0x6d, 0x50, 0x0e, 0xec, 0x90, 0x0e, 0xed, 0x00,
+ 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x83, 0x3b, 0xbc, 0x43, 0x1b,
+ 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b,
+ 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b,
+ 0xa4, 0x43, 0x3b, 0xb4, 0x81, 0x3b, 0xbc, 0x83, 0x3b, 0xb4, 0x01, 0x3b,
+ 0x94, 0x43, 0x38, 0x98, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0x41, 0x3a,
+ 0xb8, 0x83, 0x39, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b,
+ 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00,
+ 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0xa0, 0x0e, 0xf5, 0xd0, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xf4, 0x10, 0x0e, 0xe2, 0xc0, 0x0e, 0xe5, 0x30, 0x0f, 0x80, 0x39,
+ 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b,
+ 0xb8, 0x43, 0x38, 0xb8, 0xc3, 0x3c, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b,
+ 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50,
+ 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xe7, 0xe0,
+ 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0xa0, 0x0f, 0xe5, 0x20, 0x0f, 0xef, 0x30,
+ 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80,
+ 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0xc4, 0x3c,
+ 0xd0, 0x43, 0x38, 0x8c, 0xc3, 0x3a, 0xb4, 0x01, 0x3c, 0xc8, 0xc3, 0x3b,
+ 0xd0, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xb4, 0x81, 0x38,
+ 0xd4, 0x83, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0xcc, 0x43, 0x3a,
+ 0xe8, 0x43, 0x39, 0x00, 0x78, 0x00, 0x10, 0xf4, 0x10, 0x0e, 0xf2, 0x70,
+ 0x0e, 0xe5, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xe5, 0x10, 0x0e, 0xf4, 0x50,
+ 0x0f, 0xf2, 0x50, 0x0e, 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c,
+ 0xd8, 0x01, 0x40, 0xd4, 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39,
+ 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a,
+ 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50,
+ 0x0e, 0x6d, 0x30, 0x0f, 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0,
+ 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c,
+ 0x94, 0x03, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x13, 0x84, 0x40, 0x00, 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84,
+ 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c,
+ 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30,
+ 0x88, 0x10, 0x08, 0x45, 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83,
+ 0x39, 0x02, 0x50, 0x18, 0x01, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48,
+ 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60,
+ 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0,
+ 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8,
+ 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71,
+ 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a,
+ 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78,
+ 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72,
+ 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76,
+ 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a,
+ 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74,
+ 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78,
+ 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79,
+ 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75,
+ 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72,
+ 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72,
+ 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71,
+ 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0x30, 0x84, 0x21, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8,
+ 0x02, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2,
+ 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10,
+ 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09,
+ 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6,
+ 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05,
+ 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00,
+ 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6,
+ 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26,
+ 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6,
+ 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56,
+ 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61,
+ 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2,
+ 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1,
+ 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95,
+ 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85,
+ 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7,
+ 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97,
+ 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96,
+ 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69,
+ 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72,
+ 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe,
+ 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1,
+ 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78,
+ 0x86, 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, 0xcc,
+ 0xac, 0x4c, 0x8e, 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59,
+ 0x99, 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0xa5, 0xb0, 0x34, 0x39, 0x17,
+ 0xb6, 0xb7, 0xb1, 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xaf, 0x34, 0x37, 0xb2,
+ 0x32, 0x3c, 0x22, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x8c,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca,
+ 0xbe, 0xe6, 0xd2, 0xf4, 0xca, 0x78, 0x85, 0xa5, 0xc9, 0xb9, 0x84, 0xc9,
+ 0x9d, 0x7d, 0xd1, 0xe5, 0xc1, 0x95, 0x7d, 0x85, 0xb1, 0xa5, 0x9d, 0xb9,
+ 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x91, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93,
+ 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0xe3, 0x30, 0xf6, 0xc6, 0x36, 0x04,
+ 0x0c, 0x8c, 0xa0, 0x90, 0x8a, 0xc9, 0x18, 0x0a, 0xca, 0x08, 0x0c, 0xa1,
+ 0xa8, 0x0a, 0xcb, 0x18, 0x8a, 0xcb, 0x18, 0x0a, 0xa7, 0x78, 0x0a, 0xac,
+ 0xc8, 0x86, 0x08, 0x85, 0x36, 0xc4, 0x20, 0x80, 0x22, 0x2a, 0x36, 0x3e,
+ 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x63,
+ 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, 0x86,
+ 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x85, 0x37, 0xc4,
+ 0x28, 0xba, 0xe2, 0x3b, 0x8a, 0x21, 0x46, 0x01, 0x06, 0x05, 0x18, 0x1c,
+ 0xc5, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81,
+ 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21,
+ 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1,
+ 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1,
+ 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1,
+ 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1,
+ 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60,
+ 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1,
+ 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10,
+ 0x06, 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73,
+ 0x90, 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29,
+ 0x01, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88,
+ 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73,
+ 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e,
+ 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30,
+ 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8,
+ 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b,
+ 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76,
+ 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e,
+ 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e,
+ 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61,
+ 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4,
+ 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76,
+ 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37,
+ 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76,
+ 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71,
+ 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e,
+ 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1,
+ 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61,
+ 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90,
+ 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8,
+ 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc,
+ 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7,
+ 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78,
+ 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f,
+ 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f,
+ 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1,
+ 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0,
+ 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0,
+ 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b,
+ 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c,
+ 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82,
+ 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05,
+ 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x68, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x97, 0x02, 0x00, 0x00,
+ 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39,
+ 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62,
+ 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
+ 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21,
+ 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48,
+ 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x51, 0x18, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00,
+ 0x16, 0xa0, 0xda, 0x60, 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19,
+ 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c,
+ 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f,
+ 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c,
+ 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d,
+ 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d,
+ 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98,
+ 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60,
+ 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18,
+ 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d,
+ 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d,
+ 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d,
+ 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8,
+ 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08,
+ 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0,
+ 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00,
+ 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d,
+ 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d,
+ 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d,
+ 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d,
+ 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d,
+ 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d,
+ 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00,
+ 0x08, 0x77, 0x78, 0x87, 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68,
+ 0x03, 0x7a, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c,
+ 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d,
+ 0xdc, 0x21, 0x1c, 0xdc, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d,
+ 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28,
+ 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70,
+ 0x87, 0x72, 0x20, 0x87, 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98,
+ 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40,
+ 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e,
+ 0xe8, 0x21, 0x1c, 0xc6, 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d,
+ 0xe8, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c,
+ 0xea, 0xc1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d,
+ 0xf4, 0xa1, 0x1c, 0x00, 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38,
+ 0x87, 0x72, 0xa0, 0x87, 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8,
+ 0x07, 0x79, 0x28, 0x87, 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e,
+ 0xec, 0x00, 0x20, 0xea, 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28,
+ 0x87, 0x36, 0x98, 0x87, 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60,
+ 0x87, 0x77, 0x08, 0x07, 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e,
+ 0xca, 0x01, 0xd8, 0x40, 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58,
+ 0x36, 0x20, 0xc6, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40,
+ 0x05, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x13, 0x86, 0x40, 0x18, 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x48, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83,
+ 0x08, 0x81, 0x70, 0x94, 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c,
+ 0x13, 0x15, 0x11, 0xbf, 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40,
+ 0x04, 0x17, 0x49, 0x53, 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c,
+ 0x44, 0xf4, 0x4f, 0x63, 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04,
+ 0x31, 0xca, 0x21, 0x34, 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82,
+ 0xb0, 0x14, 0x24, 0x94, 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c,
+ 0x01, 0x28, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48,
+ 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60,
+ 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0,
+ 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8,
+ 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71,
+ 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a,
+ 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78,
+ 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72,
+ 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76,
+ 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a,
+ 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74,
+ 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78,
+ 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79,
+ 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75,
+ 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72,
+ 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72,
+ 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71,
+ 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0x30, 0x84, 0x49, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
+ 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x81,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a,
+ 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04,
+ 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
+ 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84,
+ 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d,
+ 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c,
+ 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26,
+ 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1,
+ 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65,
+ 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56,
+ 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36,
+ 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73,
+ 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x43, 0x84, 0xe7, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd,
+ 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89,
+ 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d,
+ 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61,
+ 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6,
+ 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6,
+ 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78,
+ 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72,
+ 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c,
+ 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda,
+ 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66,
+ 0x19, 0x1e, 0xe7, 0x79, 0x86, 0x08, 0x0f, 0x44, 0x26, 0x2c, 0x4d, 0xce,
+ 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a,
+ 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39,
+ 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba,
+ 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f,
+ 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde,
+ 0xdc, 0x86, 0x40, 0xcb, 0xf0, 0x48, 0xcf, 0xf4, 0x50, 0x8f, 0xf3, 0x3c,
+ 0x4f, 0xf5, 0x58, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce,
+ 0xda, 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d,
+ 0x95, 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95,
+ 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5,
+ 0xf0, 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b,
+ 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43,
+ 0x84, 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0xb4, 0x08,
+ 0x0f, 0xf6, 0x64, 0xcf, 0xf4, 0x68, 0x8f, 0xf3, 0x6c, 0x4f, 0xf5, 0x70,
+ 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8,
+ 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd,
+ 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b,
+ 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12,
+ 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce,
+ 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d,
+ 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d,
+ 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a,
+ 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0xb0, 0x18, 0x8f, 0xf7,
+ 0x7c, 0x0b, 0xf1, 0x80, 0xc1, 0x32, 0x2c, 0xc2, 0x13, 0x06, 0x8f, 0x18,
+ 0x2c, 0xc4, 0x33, 0x06, 0x0b, 0xf1, 0x38, 0xcf, 0xf3, 0x54, 0x0f, 0x19,
+ 0x70, 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b,
+ 0xa3, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46,
+ 0x8c, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c,
+ 0xed, 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc,
+ 0x87, 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0,
+ 0x60, 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e,
+ 0x34, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56,
+ 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc,
+ 0x10, 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71,
+ 0x1e, 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f,
+ 0x19, 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79,
+ 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74,
+ 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca,
+ 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f,
+ 0x1c, 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f,
+ 0x1d, 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41,
+ 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90,
+ 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a,
+ 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8,
+ 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98,
+ 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48,
+ 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60,
+ 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70,
+ 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d,
+ 0xe4, 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c,
+ 0xdc, 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66,
+ 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07,
+ 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10,
+ 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce,
+ 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b,
+ 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c,
+ 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07,
+ 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11,
+ 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0,
+ 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8,
+ 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b,
+ 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87,
+ 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07,
+ 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87,
+ 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81,
+ 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30,
+ 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4,
+ 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca,
+ 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39,
+ 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b,
+ 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b,
+ 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83,
+ 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87,
+ 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90,
+ 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20,
+ 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc,
+ 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66,
+ 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24,
+ 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07,
+ 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00,
+ 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d,
+ 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16,
+ 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7,
+ 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00,
+ 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48,
+ 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10,
+ 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93,
+ 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x74, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x9a, 0x03, 0x00, 0x00,
+ 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39,
+ 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62,
+ 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
+ 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21,
+ 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48,
+ 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00,
+ 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38,
+ 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3,
+ 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee,
+ 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9,
+ 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80,
+ 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3,
+ 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43,
+ 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03,
+ 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5,
+ 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9,
+ 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4,
+ 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43,
+ 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3,
+ 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03,
+ 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0,
+ 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5,
+ 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef,
+ 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee,
+ 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6,
+ 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83,
+ 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43,
+ 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43,
+ 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00,
+ 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d,
+ 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00,
+ 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1,
+ 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43,
+ 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41,
+ 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3,
+ 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d,
+ 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef,
+ 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2,
+ 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04,
+ 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43,
+ 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d,
+ 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3,
+ 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed,
+ 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03,
+ 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03,
+ 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6,
+ 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff,
+ 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c,
+ 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e,
+ 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e,
+ 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48,
+ 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08,
+ 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98,
+ 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d,
+ 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c,
+ 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c,
+ 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78,
+ 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80,
+ 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28,
+ 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c,
+ 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d,
+ 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c,
+ 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d,
+ 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20,
+ 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d,
+ 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0,
+ 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70,
+ 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68,
+ 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c,
+ 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d,
+ 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e,
+ 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d,
+ 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0,
+ 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0,
+ 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8,
+ 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0,
+ 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c,
+ 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e,
+ 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0,
+ 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68,
+ 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00,
+ 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c,
+ 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d,
+ 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28,
+ 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9,
+ 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5,
+ 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00,
+ 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18,
+ 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00,
+ 0x89, 0x20, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09,
+ 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3,
+ 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c,
+ 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83,
+ 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93,
+ 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06,
+ 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8,
+ 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1,
+ 0x08, 0x4e, 0x93, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2,
+ 0x22, 0xe2, 0xb7, 0x87, 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02,
+ 0x60, 0x10, 0x21, 0x09, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97,
+ 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45,
+ 0x28, 0x48, 0x08, 0x62, 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8,
+ 0xcd, 0x11, 0x80, 0xc1, 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09,
+ 0x8a, 0x89, 0x28, 0xa7, 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a,
+ 0x40, 0x76, 0x20, 0x60, 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e,
+ 0x00, 0x14, 0x06, 0x11, 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70,
+ 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71,
+ 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38,
+ 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07,
+ 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07,
+ 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06,
+ 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e,
+ 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07,
+ 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07,
+ 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07,
+ 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07,
+ 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e,
+ 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07,
+ 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07,
+ 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07,
+ 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f,
+ 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07,
+ 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07,
+ 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07,
+ 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07,
+ 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f,
+ 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07,
+ 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07,
+ 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06,
+ 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07,
+ 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07,
+ 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07,
+ 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07,
+ 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f,
+ 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07,
+ 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e,
+ 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07,
+ 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07,
+ 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x71, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x18, 0xc2, 0x40, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0c, 0x61, 0x2a, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x86, 0x30, 0x17, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x59, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14,
+ 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a,
+ 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06,
+ 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10,
+ 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09,
+ 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6,
+ 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05,
+ 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01,
+ 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6,
+ 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26,
+ 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6,
+ 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56,
+ 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61,
+ 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec,
+ 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1,
+ 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95,
+ 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85,
+ 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7,
+ 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97,
+ 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96,
+ 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69,
+ 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72,
+ 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe,
+ 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1,
+ 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b,
+ 0x86, 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e,
+ 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99,
+ 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f,
+ 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32,
+ 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
+ 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11,
+ 0x81, 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8,
+ 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9,
+ 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd,
+ 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93,
+ 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b,
+ 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f,
+ 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x14, 0x15, 0x18, 0x86, 0x65, 0xd8,
+ 0x84, 0x69, 0x98, 0x83, 0x6d, 0x58, 0x85, 0x71, 0x54, 0xc2, 0xd2, 0xe4,
+ 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9,
+ 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51,
+ 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73,
+ 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22,
+ 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec,
+ 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58,
+ 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57,
+ 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1,
+ 0x37, 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81,
+ 0x41, 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06,
+ 0x91, 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93,
+ 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b,
+ 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37,
+ 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b,
+ 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42,
+ 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22,
+ 0xb0, 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0,
+ 0xd2, 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62,
+ 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15,
+ 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2,
+ 0xb2, 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41,
+ 0x54, 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41,
+ 0x74, 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e,
+ 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae,
+ 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19,
+ 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33,
+ 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32,
+ 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00,
+ 0x03, 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac,
+ 0xc2, 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c,
+ 0xd9, 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18,
+ 0x1d, 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba,
+ 0x32, 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41,
+ 0x54, 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76,
+ 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c,
+ 0x8e, 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21,
+ 0x52, 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60,
+ 0x79, 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32,
+ 0xc0, 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38,
+ 0x00, 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d,
+ 0xae, 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a,
+ 0x1b, 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50,
+ 0xd0, 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c,
+ 0xd0, 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e,
+ 0xec, 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e,
+ 0xf4, 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06,
+ 0xf6, 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25,
+ 0x10, 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e,
+ 0xee, 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f,
+ 0xe5, 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62,
+ 0xc4, 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e,
+ 0xf0, 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f,
+ 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11,
+ 0x4c, 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c,
+ 0x43, 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c,
+ 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3,
+ 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6,
+ 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e,
+ 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43,
+ 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03,
+ 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48,
+ 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20,
+ 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e,
+ 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d,
+ 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89,
+ 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83,
+ 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90,
+ 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78,
+ 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98,
+ 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5,
+ 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c,
+ 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c,
+ 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43,
+ 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43,
+ 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82,
+ 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58,
+ 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18,
+ 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2,
+ 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec,
+ 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e,
+ 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d,
+ 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83,
+ 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60,
+ 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0,
+ 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f,
+ 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9,
+ 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9,
+ 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c,
+ 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1,
+ 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44,
+ 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00,
+ 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf,
+ 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a,
+ 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19,
+ 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00,
+ 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23,
+ 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30,
+ 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20,
+ 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34,
+ 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20,
+ 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8,
+ 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1,
+ 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0,
+ 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19,
+ 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23,
+ 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c,
+ 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c,
+ 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73,
+ 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95,
+ 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde,
+ 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91,
+ 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c,
+ 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02,
+ 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49,
+ 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80,
+ 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0,
+ 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00,
+ 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60,
+ 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36,
+ 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31,
+ 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90,
+ 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40,
+ 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0,
+ 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b,
+ 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38,
+ 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b,
+ 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0,
+ 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0,
+ 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0,
+ 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c,
+ 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c,
+ 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b,
+ 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, 0xe0, 0x0e, 0xef, 0xd0,
+ 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, 0xd0, 0x06, 0xf0, 0xf0,
+ 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xe5, 0xc0,
+ 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, 0xe0, 0x0e, 0x6d, 0xc0,
+ 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x90,
+ 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0x6d, 0xd0,
+ 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39,
+ 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, 0x3d, 0xb4, 0x03, 0x3c,
+ 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xcc, 0x03, 0x60,
+ 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0,
+ 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d,
+ 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, 0x3c, 0xa4, 0xc3, 0x39,
+ 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, 0x39, 0xc8, 0xc3, 0x3b,
+ 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d,
+ 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0x31,
+ 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, 0x00, 0x0f, 0xf2, 0xf0,
+ 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, 0x0f, 0x6d, 0x20,
+ 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xf3, 0x90,
+ 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, 0x3d, 0x84, 0x83, 0x3c,
+ 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, 0x39, 0x84, 0x03, 0x3d,
+ 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10,
+ 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50,
+ 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80,
+ 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c,
+ 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39,
+ 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30,
+ 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07,
+ 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8,
+ 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca,
+ 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca,
+ 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07,
+ 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07,
+ 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87,
+ 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2,
+ 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6,
+ 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca,
+ 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07,
+ 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07,
+ 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07,
+ 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87,
+ 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde,
+ 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0,
+ 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca,
+ 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda,
+ 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda,
+ 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda,
+ 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87,
+ 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87,
+ 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07,
+ 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde,
+ 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda,
+ 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07,
+ 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87,
+ 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07,
+ 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87,
+ 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0,
+ 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda,
+ 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6,
+ 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07,
+ 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87,
+ 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea,
+ 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde,
+ 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8,
+ 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61,
+ 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff,
+ 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff,
+ 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31,
+ 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04,
+ 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14,
+ 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00,
+ 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c,
+ 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47,
+ 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28,
+ 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e,
+ 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6,
+ 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6,
+ 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14,
+ 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30,
+ 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10,
+ 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83,
+ 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48,
+ 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60,
+ 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0,
+ 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8,
+ 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71,
+ 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a,
+ 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78,
+ 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72,
+ 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76,
+ 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a,
+ 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74,
+ 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78,
+ 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79,
+ 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75,
+ 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72,
+ 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72,
+ 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71,
+ 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
+ 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61,
+ 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90,
+ 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50,
+ 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85,
+ 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e,
+ 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e,
+ 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5,
+ 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25,
+ 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80,
+ 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06,
+ 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6,
+ 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36,
+ 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a,
+ 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
+ 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65,
+ 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5,
+ 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9,
+ 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95,
+ 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d,
+ 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06,
+ 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45,
+ 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6,
+ 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65,
+ 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca,
+ 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1,
+ 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44,
+ 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd,
+ 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c,
+ 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39,
+ 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e,
+ 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6,
+ 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44,
+ 0x51, 0x94, 0x43, 0x3d, 0x54, 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c,
+ 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0,
+ 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91,
+ 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9,
+ 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93,
+ 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6,
+ 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e,
+ 0x6c, 0x88, 0x04, 0x11, 0x14, 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43,
+ 0x6d, 0x54, 0x45, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc,
+ 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99,
+ 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73,
+ 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23,
+ 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6,
+ 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae,
+ 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98,
+ 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99,
+ 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60,
+ 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04,
+ 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4,
+ 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93,
+ 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33,
+ 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc,
+ 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d,
+ 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66,
+ 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0,
+ 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0,
+ 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8,
+ 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b,
+ 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00,
+ 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15,
+ 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00,
+ 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d,
+ 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a,
+ 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c,
+ 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a,
+ 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65,
+ 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80,
+ 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05,
+ 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0,
+ 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8,
+ 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56,
+ 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc,
+ 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72,
+ 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54,
+ 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31,
+ 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7,
+ 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a,
+ 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28,
+ 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f,
+ 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61,
+ 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70,
+ 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70,
+ 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98,
+ 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08,
+ 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0,
+ 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01,
+ 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68,
+ 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0,
+ 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc,
+ 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c,
+ 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c,
+ 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3,
+ 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6,
+ 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e,
+ 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43,
+ 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03,
+ 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48,
+ 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20,
+ 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e,
+ 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d,
+ 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89,
+ 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83,
+ 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90,
+ 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78,
+ 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98,
+ 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5,
+ 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c,
+ 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c,
+ 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43,
+ 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43,
+ 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82,
+ 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58,
+ 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18,
+ 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2,
+ 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec,
+ 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e,
+ 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d,
+ 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83,
+ 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60,
+ 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0,
+ 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
+ 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb,
+ 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11,
+ 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00,
+ 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10,
+ 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00,
+ 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+ 0x64, 0xe7, 0x20, 0x06, 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31,
+ 0xc7, 0x30, 0x10, 0xdd, 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04,
+ 0x80, 0xe0, 0x0c, 0x00, 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20,
+ 0x10, 0x99, 0x01, 0xa0, 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41,
+ 0x10, 0xff, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10,
+ 0x88, 0x01, 0xe4, 0x4c, 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c,
+ 0x01, 0xf4, 0x50, 0xca, 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32,
+ 0x08, 0x86, 0x33, 0xc8, 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77,
+ 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34,
+ 0xcf, 0x78, 0x03, 0x07, 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20,
+ 0x43, 0x10, 0x4d, 0x23, 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31,
+ 0x4c, 0x41, 0x1c, 0x8c, 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63,
+ 0x29, 0x28, 0x83, 0x0c, 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07,
+ 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20,
+ 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50,
+ 0x10, 0x81, 0x1f, 0x44, 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43,
+ 0xf0, 0xe1, 0x81, 0x05, 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde,
+ 0x21, 0x0c, 0x00, 0x00, 0x7d, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91,
+ 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c,
+ 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02,
+ 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49,
+ 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80,
+ 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0,
+ 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00,
+ 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60,
+ 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36,
+ 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31,
+ 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90,
+ 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40,
+ 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0,
+ 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b,
+ 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38,
+ 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b,
+ 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0,
+ 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0,
+ 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0,
+ 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c,
+ 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c,
+ 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b,
+ 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b,
+ 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, 0xe0, 0x0e, 0xef, 0xd0,
+ 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, 0xd0, 0x06, 0xf0, 0xf0,
+ 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xe5, 0xc0,
+ 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, 0xe0, 0x0e, 0x6d, 0xc0,
+ 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x90,
+ 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0x6d, 0xd0,
+ 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39,
+ 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, 0x3d, 0xb4, 0x03, 0x3c,
+ 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xcc, 0x03, 0x60,
+ 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0,
+ 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0,
+ 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d,
+ 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, 0x3c, 0xa4, 0xc3, 0x39,
+ 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, 0x39, 0xc8, 0xc3, 0x3b,
+ 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d,
+ 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0x31,
+ 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, 0x00, 0x0f, 0xf2, 0xf0,
+ 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, 0x0f, 0x6d, 0x20,
+ 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xf3, 0x90,
+ 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, 0x3d, 0x84, 0x83, 0x3c,
+ 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, 0x39, 0x84, 0x03, 0x3d,
+ 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10,
+ 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50,
+ 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80,
+ 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c,
+ 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39,
+ 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30,
+ 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07,
+ 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8,
+ 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca,
+ 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca,
+ 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07,
+ 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07,
+ 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87,
+ 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2,
+ 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6,
+ 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca,
+ 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07,
+ 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07,
+ 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07,
+ 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87,
+ 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde,
+ 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0,
+ 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca,
+ 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda,
+ 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda,
+ 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda,
+ 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87,
+ 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87,
+ 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07,
+ 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde,
+ 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda,
+ 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0,
+ 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07,
+ 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87,
+ 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07,
+ 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87,
+ 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0,
+ 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda,
+ 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6,
+ 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07,
+ 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87,
+ 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea,
+ 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde,
+ 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8,
+ 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61,
+ 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff,
+ 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff,
+ 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31,
+ 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04,
+ 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14,
+ 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00,
+ 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c,
+ 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47,
+ 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28,
+ 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e,
+ 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6,
+ 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6,
+ 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14,
+ 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30,
+ 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10,
+ 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83,
+ 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48,
+ 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60,
+ 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0,
+ 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8,
+ 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71,
+ 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a,
+ 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a,
+ 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78,
+ 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72,
+ 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76,
+ 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a,
+ 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73,
+ 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d,
+ 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76,
+ 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74,
+ 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78,
+ 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79,
+ 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75,
+ 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72,
+ 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a,
+ 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72,
+ 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71,
+ 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a,
+ 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d,
+ 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72,
+ 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
+ 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61,
+ 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90,
+ 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50,
+ 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85,
+ 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
+ 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e,
+ 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e,
+ 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5,
+ 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25,
+ 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80,
+ 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06,
+ 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6,
+ 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36,
+ 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a,
+ 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
+ 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65,
+ 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5,
+ 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9,
+ 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95,
+ 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d,
+ 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06,
+ 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45,
+ 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6,
+ 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65,
+ 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c,
+ 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca,
+ 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1,
+ 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44,
+ 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd,
+ 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c,
+ 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39,
+ 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e,
+ 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6,
+ 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44,
+ 0x51, 0x94, 0x43, 0x3d, 0x54, 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c,
+ 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0,
+ 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91,
+ 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9,
+ 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93,
+ 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6,
+ 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e,
+ 0x6c, 0x88, 0x04, 0x11, 0x14, 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43,
+ 0x6d, 0x54, 0x45, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc,
+ 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99,
+ 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73,
+ 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23,
+ 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6,
+ 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae,
+ 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98,
+ 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99,
+ 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60,
+ 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04,
+ 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4,
+ 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93,
+ 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33,
+ 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc,
+ 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d,
+ 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66,
+ 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0,
+ 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0,
+ 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8,
+ 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b,
+ 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00,
+ 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15,
+ 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00,
+ 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d,
+ 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a,
+ 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c,
+ 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a,
+ 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65,
+ 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80,
+ 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05,
+ 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0,
+ 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8,
+ 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56,
+ 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc,
+ 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72,
+ 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54,
+ 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31,
+ 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7,
+ 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a,
+ 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28,
+ 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f,
+ 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61,
+ 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70,
+ 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70,
+ 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98,
+ 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08,
+ 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0,
+ 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01,
+ 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68,
+ 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0,
+ 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc,
+ 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c,
+ 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00,
+ 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c,
+ 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3,
+ 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6,
+ 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e,
+ 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43,
+ 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03,
+ 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48,
+ 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20,
+ 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e,
+ 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d,
+ 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89,
+ 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83,
+ 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
+ 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90,
+ 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78,
+ 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98,
+ 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5,
+ 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c,
+ 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c,
+ 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43,
+ 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43,
+ 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82,
+ 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58,
+ 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18,
+ 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2,
+ 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec,
+ 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e,
+ 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d,
+ 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83,
+ 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60,
+ 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0,
+ 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
+ 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb,
+ 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11,
+ 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00,
+ 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10,
+ 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
+ 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x64, 0xe7, 0x20, 0x06, 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31,
+ 0xc7, 0x30, 0x10, 0xde, 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20,
+ 0xd0, 0xab, 0x81, 0x11, 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6,
+ 0x12, 0x02, 0x80, 0xc8, 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00,
+ 0x04, 0xc6, 0x08, 0x40, 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00,
+ 0x23, 0x06, 0xca, 0x10, 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23,
+ 0x06, 0xca, 0x10, 0x94, 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c,
+ 0x41, 0x81, 0x0c, 0x32, 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20,
+ 0x83, 0x10, 0x4c, 0x83, 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62,
+ 0x43, 0x00, 0x1f, 0xf2, 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf,
+ 0x18, 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d,
+ 0x18, 0x14, 0x44, 0x50, 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30,
+ 0xde, 0x50, 0x06, 0x69, 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32,
+ 0x04, 0x18, 0x18, 0x8c, 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7,
+ 0x60, 0x04, 0x79, 0x30, 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c,
+ 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10,
+ 0x0a, 0x51, 0x30, 0xc7, 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1,
+ 0x1e, 0x58, 0x50, 0xc9, 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00,
+ 0x5b, 0x06, 0x25, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+const unsigned int sdl_metallib_len = 22792;
diff --git a/src/3rdparty/SDL2/src/render/metal/build-metal-shaders.sh b/src/3rdparty/SDL2/src/render/metal/build-metal-shaders.sh
new file mode 100644
index 0000000..8ebf63e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/metal/build-metal-shaders.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -x
+set -e
+cd `dirname "$0"`
+
+generate_shaders()
+{
+ platform=$1
+ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=$platform-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $?
+ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $?
+ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $?
+ xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h
+ rm -f sdl.air sdl.metalar sdl.metallib
+}
+
+generate_shaders osx
+generate_shaders ios
diff --git a/src/3rdparty/SDL2/src/render/opengl/SDL_glfuncs.h b/src/3rdparty/SDL2/src/render/opengl/SDL_glfuncs.h
new file mode 100644
index 0000000..02be0e1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengl/SDL_glfuncs.h
@@ -0,0 +1,478 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* list of OpenGL functions sorted alphabetically
+ If you need to use a GL function from the SDL video subsystem,
+ change its entry from SDL_PROC_UNUSED to SDL_PROC and rebuild.
+*/
+#define SDL_PROC_UNUSED(ret,func,params)
+
+SDL_PROC_UNUSED(void, glAccum, (GLenum, GLfloat))
+SDL_PROC_UNUSED(void, glAlphaFunc, (GLenum, GLclampf))
+SDL_PROC_UNUSED(GLboolean, glAreTexturesResident,
+ (GLsizei, const GLuint *, GLboolean *))
+SDL_PROC_UNUSED(void, glArrayElement, (GLint))
+SDL_PROC(void, glBegin, (GLenum))
+SDL_PROC(void, glBindTexture, (GLenum, GLuint))
+SDL_PROC_UNUSED(void, glBitmap,
+ (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat,
+ const GLubyte *))
+SDL_PROC(void, glBlendEquation, (GLenum))
+SDL_PROC_UNUSED(void, glBlendFunc, (GLenum, GLenum))
+SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum))
+SDL_PROC_UNUSED(void, glCallList, (GLuint))
+SDL_PROC_UNUSED(void, glCallLists, (GLsizei, GLenum, const GLvoid *))
+SDL_PROC(void, glClear, (GLbitfield))
+SDL_PROC_UNUSED(void, glClearAccum, (GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf))
+SDL_PROC_UNUSED(void, glClearDepth, (GLclampd))
+SDL_PROC_UNUSED(void, glClearIndex, (GLfloat))
+SDL_PROC_UNUSED(void, glClearStencil, (GLint))
+SDL_PROC_UNUSED(void, glClipPlane, (GLenum, const GLdouble *))
+SDL_PROC_UNUSED(void, glColor3b, (GLbyte, GLbyte, GLbyte))
+SDL_PROC_UNUSED(void, glColor3bv, (const GLbyte *))
+SDL_PROC_UNUSED(void, glColor3d, (GLdouble, GLdouble, GLdouble))
+SDL_PROC_UNUSED(void, glColor3dv, (const GLdouble *))
+SDL_PROC_UNUSED(void, glColor3f, (GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glColor3fv, (const GLfloat *))
+SDL_PROC_UNUSED(void, glColor3i, (GLint, GLint, GLint))
+SDL_PROC_UNUSED(void, glColor3iv, (const GLint *))
+SDL_PROC_UNUSED(void, glColor3s, (GLshort, GLshort, GLshort))
+SDL_PROC_UNUSED(void, glColor3sv, (const GLshort *))
+SDL_PROC_UNUSED(void, glColor3ub, (GLubyte, GLubyte, GLubyte))
+SDL_PROC_UNUSED(void, glColor3ubv, (const GLubyte *))
+SDL_PROC_UNUSED(void, glColor3ui, (GLuint, GLuint, GLuint))
+SDL_PROC_UNUSED(void, glColor3uiv, (const GLuint *))
+SDL_PROC_UNUSED(void, glColor3us, (GLushort, GLushort, GLushort))
+SDL_PROC_UNUSED(void, glColor3usv, (const GLushort *))
+SDL_PROC_UNUSED(void, glColor4b, (GLbyte, GLbyte, GLbyte, GLbyte))
+SDL_PROC_UNUSED(void, glColor4bv, (const GLbyte *))
+SDL_PROC_UNUSED(void, glColor4d, (GLdouble, GLdouble, GLdouble, GLdouble))
+SDL_PROC_UNUSED(void, glColor4dv, (const GLdouble *))
+SDL_PROC(void, glColor4f, (GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC_UNUSED(void, glColor4fv, (const GLfloat *))
+SDL_PROC_UNUSED(void, glColor4i, (GLint, GLint, GLint, GLint))
+SDL_PROC_UNUSED(void, glColor4iv, (const GLint *))
+SDL_PROC_UNUSED(void, glColor4s, (GLshort, GLshort, GLshort, GLshort))
+SDL_PROC_UNUSED(void, glColor4sv, (const GLshort *))
+SDL_PROC_UNUSED(void, glColor4ub,
+ (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
+SDL_PROC_UNUSED(void, glColor4ubv, (const GLubyte * v))
+SDL_PROC_UNUSED(void, glColor4ui,
+ (GLuint red, GLuint green, GLuint blue, GLuint alpha))
+SDL_PROC_UNUSED(void, glColor4uiv, (const GLuint * v))
+SDL_PROC_UNUSED(void, glColor4us,
+ (GLushort red, GLushort green, GLushort blue, GLushort alpha))
+SDL_PROC_UNUSED(void, glColor4usv, (const GLushort * v))
+SDL_PROC_UNUSED(void, glColorMask,
+ (GLboolean red, GLboolean green, GLboolean blue,
+ GLboolean alpha))
+SDL_PROC_UNUSED(void, glColorMaterial, (GLenum face, GLenum mode))
+SDL_PROC_UNUSED(void, glColorPointer,
+ (GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer))
+SDL_PROC_UNUSED(void, glCopyPixels,
+ (GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum type))
+SDL_PROC_UNUSED(void, glCopyTexImage1D,
+ (GLenum target, GLint level, GLenum internalFormat, GLint x,
+ GLint y, GLsizei width, GLint border))
+SDL_PROC_UNUSED(void, glCopyTexImage2D,
+ (GLenum target, GLint level, GLenum internalFormat, GLint x,
+ GLint y, GLsizei width, GLsizei height, GLint border))
+SDL_PROC_UNUSED(void, glCopyTexSubImage1D,
+ (GLenum target, GLint level, GLint xoffset, GLint x, GLint y,
+ GLsizei width))
+SDL_PROC_UNUSED(void, glCopyTexSubImage2D,
+ (GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height))
+SDL_PROC_UNUSED(void, glCullFace, (GLenum mode))
+SDL_PROC_UNUSED(void, glDeleteLists, (GLuint list, GLsizei range))
+SDL_PROC(void, glDeleteTextures, (GLsizei n, const GLuint * textures))
+SDL_PROC(void, glDepthFunc, (GLenum func))
+SDL_PROC_UNUSED(void, glDepthMask, (GLboolean flag))
+SDL_PROC_UNUSED(void, glDepthRange, (GLclampd zNear, GLclampd zFar))
+SDL_PROC(void, glDisable, (GLenum cap))
+SDL_PROC_UNUSED(void, glDisableClientState, (GLenum array))
+SDL_PROC_UNUSED(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
+SDL_PROC_UNUSED(void, glDrawBuffer, (GLenum mode))
+SDL_PROC_UNUSED(void, glDrawElements,
+ (GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices))
+SDL_PROC(void, glDrawPixels,
+ (GLsizei width, GLsizei height, GLenum format, GLenum type,
+ const GLvoid * pixels))
+SDL_PROC_UNUSED(void, glEdgeFlag, (GLboolean flag))
+SDL_PROC_UNUSED(void, glEdgeFlagPointer,
+ (GLsizei stride, const GLvoid * pointer))
+SDL_PROC_UNUSED(void, glEdgeFlagv, (const GLboolean * flag))
+SDL_PROC(void, glEnable, (GLenum cap))
+SDL_PROC_UNUSED(void, glEnableClientState, (GLenum array))
+SDL_PROC(void, glEnd, (void))
+SDL_PROC_UNUSED(void, glEndList, (void))
+SDL_PROC_UNUSED(void, glEvalCoord1d, (GLdouble u))
+SDL_PROC_UNUSED(void, glEvalCoord1dv, (const GLdouble * u))
+SDL_PROC_UNUSED(void, glEvalCoord1f, (GLfloat u))
+SDL_PROC_UNUSED(void, glEvalCoord1fv, (const GLfloat * u))
+SDL_PROC_UNUSED(void, glEvalCoord2d, (GLdouble u, GLdouble v))
+SDL_PROC_UNUSED(void, glEvalCoord2dv, (const GLdouble * u))
+SDL_PROC_UNUSED(void, glEvalCoord2f, (GLfloat u, GLfloat v))
+SDL_PROC_UNUSED(void, glEvalCoord2fv, (const GLfloat * u))
+SDL_PROC_UNUSED(void, glEvalMesh1, (GLenum mode, GLint i1, GLint i2))
+SDL_PROC_UNUSED(void, glEvalMesh2,
+ (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2))
+SDL_PROC_UNUSED(void, glEvalPoint1, (GLint i))
+SDL_PROC_UNUSED(void, glEvalPoint2, (GLint i, GLint j))
+SDL_PROC_UNUSED(void, glFeedbackBuffer,
+ (GLsizei size, GLenum type, GLfloat * buffer))
+SDL_PROC_UNUSED(void, glFinish, (void))
+SDL_PROC_UNUSED(void, glFlush, (void))
+SDL_PROC_UNUSED(void, glFogf, (GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glFogfv, (GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glFogi, (GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glFogiv, (GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glFrontFace, (GLenum mode))
+SDL_PROC_UNUSED(void, glFrustum,
+ (GLdouble left, GLdouble right, GLdouble bottom,
+ GLdouble top, GLdouble zNear, GLdouble zFar))
+SDL_PROC_UNUSED(GLuint, glGenLists, (GLsizei range))
+SDL_PROC(void, glGenTextures, (GLsizei n, GLuint * textures))
+SDL_PROC_UNUSED(void, glGetBooleanv, (GLenum pname, GLboolean * params))
+SDL_PROC_UNUSED(void, glGetClipPlane, (GLenum plane, GLdouble * equation))
+SDL_PROC_UNUSED(void, glGetDoublev, (GLenum pname, GLdouble * params))
+SDL_PROC(GLenum, glGetError, (void))
+SDL_PROC_UNUSED(void, glGetFloatv, (GLenum pname, GLfloat * params))
+SDL_PROC(void, glGetIntegerv, (GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetLightfv,
+ (GLenum light, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetLightiv,
+ (GLenum light, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetMapdv, (GLenum target, GLenum query, GLdouble * v))
+SDL_PROC_UNUSED(void, glGetMapfv, (GLenum target, GLenum query, GLfloat * v))
+SDL_PROC_UNUSED(void, glGetMapiv, (GLenum target, GLenum query, GLint * v))
+SDL_PROC_UNUSED(void, glGetMaterialfv,
+ (GLenum face, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetMaterialiv,
+ (GLenum face, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetPixelMapfv, (GLenum map, GLfloat * values))
+SDL_PROC_UNUSED(void, glGetPixelMapuiv, (GLenum map, GLuint * values))
+SDL_PROC_UNUSED(void, glGetPixelMapusv, (GLenum map, GLushort * values))
+SDL_PROC(void, glGetPointerv, (GLenum pname, GLvoid * *params))
+SDL_PROC_UNUSED(void, glGetPolygonStipple, (GLubyte * mask))
+SDL_PROC(const GLubyte *, glGetString, (GLenum name))
+SDL_PROC_UNUSED(void, glGetTexEnvfv,
+ (GLenum target, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetTexEnviv,
+ (GLenum target, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetTexGendv,
+ (GLenum coord, GLenum pname, GLdouble * params))
+SDL_PROC_UNUSED(void, glGetTexGenfv,
+ (GLenum coord, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetTexGeniv,
+ (GLenum coord, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetTexImage,
+ (GLenum target, GLint level, GLenum format, GLenum type,
+ GLvoid * pixels))
+SDL_PROC_UNUSED(void, glGetTexLevelParameterfv,
+ (GLenum target, GLint level, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetTexLevelParameteriv,
+ (GLenum target, GLint level, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetTexParameterfv,
+ (GLenum target, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetTexParameteriv,
+ (GLenum target, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glHint, (GLenum target, GLenum mode))
+SDL_PROC_UNUSED(void, glIndexMask, (GLuint mask))
+SDL_PROC_UNUSED(void, glIndexPointer,
+ (GLenum type, GLsizei stride, const GLvoid * pointer))
+SDL_PROC_UNUSED(void, glIndexd, (GLdouble c))
+SDL_PROC_UNUSED(void, glIndexdv, (const GLdouble * c))
+SDL_PROC_UNUSED(void, glIndexf, (GLfloat c))
+SDL_PROC_UNUSED(void, glIndexfv, (const GLfloat * c))
+SDL_PROC_UNUSED(void, glIndexi, (GLint c))
+SDL_PROC_UNUSED(void, glIndexiv, (const GLint * c))
+SDL_PROC_UNUSED(void, glIndexs, (GLshort c))
+SDL_PROC_UNUSED(void, glIndexsv, (const GLshort * c))
+SDL_PROC_UNUSED(void, glIndexub, (GLubyte c))
+SDL_PROC_UNUSED(void, glIndexubv, (const GLubyte * c))
+SDL_PROC_UNUSED(void, glInitNames, (void))
+SDL_PROC_UNUSED(void, glInterleavedArrays,
+ (GLenum format, GLsizei stride, const GLvoid * pointer))
+SDL_PROC_UNUSED(GLboolean, glIsEnabled, (GLenum cap))
+SDL_PROC_UNUSED(GLboolean, glIsList, (GLuint list))
+SDL_PROC_UNUSED(GLboolean, glIsTexture, (GLuint texture))
+SDL_PROC_UNUSED(void, glLightModelf, (GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glLightModelfv, (GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glLightModeli, (GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glLightModeliv, (GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glLightf, (GLenum light, GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glLightfv,
+ (GLenum light, GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glLighti, (GLenum light, GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glLightiv,
+ (GLenum light, GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glLineStipple, (GLint factor, GLushort pattern))
+SDL_PROC(void, glLineWidth, (GLfloat width))
+SDL_PROC_UNUSED(void, glListBase, (GLuint base))
+SDL_PROC(void, glLoadIdentity, (void))
+SDL_PROC_UNUSED(void, glLoadMatrixd, (const GLdouble * m))
+SDL_PROC_UNUSED(void, glLoadMatrixf, (const GLfloat * m))
+SDL_PROC_UNUSED(void, glLoadName, (GLuint name))
+SDL_PROC_UNUSED(void, glLogicOp, (GLenum opcode))
+SDL_PROC_UNUSED(void, glMap1d,
+ (GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+ GLint order, const GLdouble * points))
+SDL_PROC_UNUSED(void, glMap1f,
+ (GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+ GLint order, const GLfloat * points))
+SDL_PROC_UNUSED(void, glMap2d,
+ (GLenum target, GLdouble u1, GLdouble u2, GLint ustride,
+ GLint uorder, GLdouble v1, GLdouble v2, GLint vstride,
+ GLint vorder, const GLdouble * points))
+SDL_PROC_UNUSED(void, glMap2f,
+ (GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
+ GLint uorder, GLfloat v1, GLfloat v2, GLint vstride,
+ GLint vorder, const GLfloat * points))
+SDL_PROC_UNUSED(void, glMapGrid1d, (GLint un, GLdouble u1, GLdouble u2))
+SDL_PROC_UNUSED(void, glMapGrid1f, (GLint un, GLfloat u1, GLfloat u2))
+SDL_PROC_UNUSED(void, glMapGrid2d,
+ (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1,
+ GLdouble v2))
+SDL_PROC_UNUSED(void, glMapGrid2f,
+ (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1,
+ GLfloat v2))
+SDL_PROC_UNUSED(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glMaterialfv,
+ (GLenum face, GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glMateriali, (GLenum face, GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glMaterialiv,
+ (GLenum face, GLenum pname, const GLint * params))
+SDL_PROC(void, glMatrixMode, (GLenum mode))
+SDL_PROC_UNUSED(void, glMultMatrixd, (const GLdouble * m))
+SDL_PROC_UNUSED(void, glMultMatrixf, (const GLfloat * m))
+SDL_PROC_UNUSED(void, glNewList, (GLuint list, GLenum mode))
+SDL_PROC_UNUSED(void, glNormal3b, (GLbyte nx, GLbyte ny, GLbyte nz))
+SDL_PROC_UNUSED(void, glNormal3bv, (const GLbyte * v))
+SDL_PROC_UNUSED(void, glNormal3d, (GLdouble nx, GLdouble ny, GLdouble nz))
+SDL_PROC_UNUSED(void, glNormal3dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz))
+SDL_PROC_UNUSED(void, glNormal3fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glNormal3i, (GLint nx, GLint ny, GLint nz))
+SDL_PROC_UNUSED(void, glNormal3iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glNormal3s, (GLshort nx, GLshort ny, GLshort nz))
+SDL_PROC_UNUSED(void, glNormal3sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glNormalPointer,
+ (GLenum type, GLsizei stride, const GLvoid * pointer))
+SDL_PROC(void, glOrtho,
+ (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
+ GLdouble zNear, GLdouble zFar))
+SDL_PROC_UNUSED(void, glPassThrough, (GLfloat token))
+SDL_PROC_UNUSED(void, glPixelMapfv,
+ (GLenum map, GLsizei mapsize, const GLfloat * values))
+SDL_PROC_UNUSED(void, glPixelMapuiv,
+ (GLenum map, GLsizei mapsize, const GLuint * values))
+SDL_PROC_UNUSED(void, glPixelMapusv,
+ (GLenum map, GLsizei mapsize, const GLushort * values))
+SDL_PROC_UNUSED(void, glPixelStoref, (GLenum pname, GLfloat param))
+SDL_PROC(void, glPixelStorei, (GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glPixelTransferf, (GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glPixelTransferi, (GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glPixelZoom, (GLfloat xfactor, GLfloat yfactor))
+SDL_PROC(void, glPointSize, (GLfloat size))
+SDL_PROC_UNUSED(void, glPolygonMode, (GLenum face, GLenum mode))
+SDL_PROC_UNUSED(void, glPolygonOffset, (GLfloat factor, GLfloat units))
+SDL_PROC_UNUSED(void, glPolygonStipple, (const GLubyte * mask))
+SDL_PROC_UNUSED(void, glPopAttrib, (void))
+SDL_PROC_UNUSED(void, glPopClientAttrib, (void))
+SDL_PROC(void, glPopMatrix, (void))
+SDL_PROC_UNUSED(void, glPopName, (void))
+SDL_PROC_UNUSED(void, glPrioritizeTextures,
+ (GLsizei n, const GLuint * textures,
+ const GLclampf * priorities))
+SDL_PROC_UNUSED(void, glPushAttrib, (GLbitfield mask))
+SDL_PROC_UNUSED(void, glPushClientAttrib, (GLbitfield mask))
+SDL_PROC(void, glPushMatrix, (void))
+SDL_PROC_UNUSED(void, glPushName, (GLuint name))
+SDL_PROC_UNUSED(void, glRasterPos2d, (GLdouble x, GLdouble y))
+SDL_PROC_UNUSED(void, glRasterPos2dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glRasterPos2f, (GLfloat x, GLfloat y))
+SDL_PROC_UNUSED(void, glRasterPos2fv, (const GLfloat * v))
+SDL_PROC(void, glRasterPos2i, (GLint x, GLint y))
+SDL_PROC_UNUSED(void, glRasterPos2iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glRasterPos2s, (GLshort x, GLshort y))
+SDL_PROC_UNUSED(void, glRasterPos2sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glRasterPos3d, (GLdouble x, GLdouble y, GLdouble z))
+SDL_PROC_UNUSED(void, glRasterPos3dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glRasterPos3f, (GLfloat x, GLfloat y, GLfloat z))
+SDL_PROC_UNUSED(void, glRasterPos3fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glRasterPos3i, (GLint x, GLint y, GLint z))
+SDL_PROC_UNUSED(void, glRasterPos3iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glRasterPos3s, (GLshort x, GLshort y, GLshort z))
+SDL_PROC_UNUSED(void, glRasterPos3sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glRasterPos4d,
+ (GLdouble x, GLdouble y, GLdouble z, GLdouble w))
+SDL_PROC_UNUSED(void, glRasterPos4dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glRasterPos4f,
+ (GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+SDL_PROC_UNUSED(void, glRasterPos4fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glRasterPos4i, (GLint x, GLint y, GLint z, GLint w))
+SDL_PROC_UNUSED(void, glRasterPos4iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glRasterPos4s,
+ (GLshort x, GLshort y, GLshort z, GLshort w))
+SDL_PROC_UNUSED(void, glRasterPos4sv, (const GLshort * v))
+SDL_PROC(void, glReadBuffer, (GLenum mode))
+SDL_PROC(void, glReadPixels,
+ (GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid * pixels))
+SDL_PROC_UNUSED(void, glRectd,
+ (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2))
+SDL_PROC_UNUSED(void, glRectdv, (const GLdouble * v1, const GLdouble * v2))
+SDL_PROC(void, glRectf,
+ (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2))
+SDL_PROC_UNUSED(void, glRectfv, (const GLfloat * v1, const GLfloat * v2))
+SDL_PROC_UNUSED(void, glRecti, (GLint x1, GLint y1, GLint x2, GLint y2))
+SDL_PROC_UNUSED(void, glRectiv, (const GLint * v1, const GLint * v2))
+SDL_PROC_UNUSED(void, glRects,
+ (GLshort x1, GLshort y1, GLshort x2, GLshort y2))
+SDL_PROC_UNUSED(void, glRectsv, (const GLshort * v1, const GLshort * v2))
+SDL_PROC_UNUSED(GLint, glRenderMode, (GLenum mode))
+SDL_PROC(void, glRotated,
+ (GLdouble angle, GLdouble x, GLdouble y, GLdouble z))
+SDL_PROC(void, glRotatef,
+ (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
+SDL_PROC_UNUSED(void, glScaled, (GLdouble x, GLdouble y, GLdouble z))
+SDL_PROC_UNUSED(void, glScalef, (GLfloat x, GLfloat y, GLfloat z))
+SDL_PROC(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height))
+SDL_PROC_UNUSED(void, glSelectBuffer, (GLsizei size, GLuint * buffer))
+SDL_PROC(void, glShadeModel, (GLenum mode))
+SDL_PROC_UNUSED(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
+SDL_PROC_UNUSED(void, glStencilMask, (GLuint mask))
+SDL_PROC_UNUSED(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
+SDL_PROC_UNUSED(void, glTexCoord1d, (GLdouble s))
+SDL_PROC_UNUSED(void, glTexCoord1dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glTexCoord1f, (GLfloat s))
+SDL_PROC_UNUSED(void, glTexCoord1fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glTexCoord1i, (GLint s))
+SDL_PROC_UNUSED(void, glTexCoord1iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glTexCoord1s, (GLshort s))
+SDL_PROC_UNUSED(void, glTexCoord1sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glTexCoord2d, (GLdouble s, GLdouble t))
+SDL_PROC_UNUSED(void, glTexCoord2dv, (const GLdouble * v))
+SDL_PROC(void, glTexCoord2f, (GLfloat s, GLfloat t))
+SDL_PROC_UNUSED(void, glTexCoord2fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glTexCoord2i, (GLint s, GLint t))
+SDL_PROC_UNUSED(void, glTexCoord2iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glTexCoord2s, (GLshort s, GLshort t))
+SDL_PROC_UNUSED(void, glTexCoord2sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glTexCoord3d, (GLdouble s, GLdouble t, GLdouble r))
+SDL_PROC_UNUSED(void, glTexCoord3dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glTexCoord3f, (GLfloat s, GLfloat t, GLfloat r))
+SDL_PROC_UNUSED(void, glTexCoord3fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glTexCoord3i, (GLint s, GLint t, GLint r))
+SDL_PROC_UNUSED(void, glTexCoord3iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glTexCoord3s, (GLshort s, GLshort t, GLshort r))
+SDL_PROC_UNUSED(void, glTexCoord3sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glTexCoord4d,
+ (GLdouble s, GLdouble t, GLdouble r, GLdouble q))
+SDL_PROC_UNUSED(void, glTexCoord4dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glTexCoord4f,
+ (GLfloat s, GLfloat t, GLfloat r, GLfloat q))
+SDL_PROC_UNUSED(void, glTexCoord4fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glTexCoord4i, (GLint s, GLint t, GLint r, GLint q))
+SDL_PROC_UNUSED(void, glTexCoord4iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glTexCoord4s,
+ (GLshort s, GLshort t, GLshort r, GLshort q))
+SDL_PROC_UNUSED(void, glTexCoord4sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glTexCoordPointer,
+ (GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer))
+SDL_PROC(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glTexEnvfv,
+ (GLenum target, GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glTexEnvi, (GLenum target, GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glTexEnviv,
+ (GLenum target, GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glTexGend, (GLenum coord, GLenum pname, GLdouble param))
+SDL_PROC_UNUSED(void, glTexGendv,
+ (GLenum coord, GLenum pname, const GLdouble * params))
+SDL_PROC_UNUSED(void, glTexGenf, (GLenum coord, GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glTexGenfv,
+ (GLenum coord, GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glTexGeni, (GLenum coord, GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glTexGeniv,
+ (GLenum coord, GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glTexImage1D,
+ (GLenum target, GLint level, GLint internalformat,
+ GLsizei width, GLint border, GLenum format, GLenum type,
+ const GLvoid * pixels))
+SDL_PROC(void, glTexImage2D,
+ (GLenum target, GLint level, GLint internalformat, GLsizei width,
+ GLsizei height, GLint border, GLenum format, GLenum type,
+ const GLvoid * pixels))
+SDL_PROC_UNUSED(void, glTexParameterf,
+ (GLenum target, GLenum pname, GLfloat param))
+SDL_PROC_UNUSED(void, glTexParameterfv,
+ (GLenum target, GLenum pname, const GLfloat * params))
+SDL_PROC(void, glTexParameteri, (GLenum target, GLenum pname, GLint param))
+SDL_PROC_UNUSED(void, glTexParameteriv,
+ (GLenum target, GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glTexSubImage1D,
+ (GLenum target, GLint level, GLint xoffset, GLsizei width,
+ GLenum format, GLenum type, const GLvoid * pixels))
+SDL_PROC(void, glTexSubImage2D,
+ (GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format, GLenum type,
+ const GLvoid * pixels))
+SDL_PROC_UNUSED(void, glTranslated, (GLdouble x, GLdouble y, GLdouble z))
+SDL_PROC(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z))
+SDL_PROC_UNUSED(void, glVertex2d, (GLdouble x, GLdouble y))
+SDL_PROC_UNUSED(void, glVertex2dv, (const GLdouble * v))
+SDL_PROC(void, glVertex2f, (GLfloat x, GLfloat y))
+SDL_PROC_UNUSED(void, glVertex2fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glVertex2i, (GLint x, GLint y))
+SDL_PROC_UNUSED(void, glVertex2iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glVertex2s, (GLshort x, GLshort y))
+SDL_PROC_UNUSED(void, glVertex2sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glVertex3d, (GLdouble x, GLdouble y, GLdouble z))
+SDL_PROC_UNUSED(void, glVertex3dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glVertex3f, (GLfloat x, GLfloat y, GLfloat z))
+SDL_PROC(void, glVertex3fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glVertex3i, (GLint x, GLint y, GLint z))
+SDL_PROC_UNUSED(void, glVertex3iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glVertex3s, (GLshort x, GLshort y, GLshort z))
+SDL_PROC_UNUSED(void, glVertex3sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glVertex4d,
+ (GLdouble x, GLdouble y, GLdouble z, GLdouble w))
+SDL_PROC_UNUSED(void, glVertex4dv, (const GLdouble * v))
+SDL_PROC_UNUSED(void, glVertex4f,
+ (GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+SDL_PROC_UNUSED(void, glVertex4fv, (const GLfloat * v))
+SDL_PROC_UNUSED(void, glVertex4i, (GLint x, GLint y, GLint z, GLint w))
+SDL_PROC_UNUSED(void, glVertex4iv, (const GLint * v))
+SDL_PROC_UNUSED(void, glVertex4s,
+ (GLshort x, GLshort y, GLshort z, GLshort w))
+SDL_PROC_UNUSED(void, glVertex4sv, (const GLshort * v))
+SDL_PROC_UNUSED(void, glVertexPointer,
+ (GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer))
+SDL_PROC(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengl/SDL_render_gl.c b/src/3rdparty/SDL2/src/render/opengl/SDL_render_gl.c
new file mode 100644
index 0000000..1c379eb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengl/SDL_render_gl.c
@@ -0,0 +1,1690 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
+
+#include "SDL_hints.h"
+#include "SDL_log.h"
+#include "SDL_assert.h"
+#include "SDL_opengl.h"
+#include "../SDL_sysrender.h"
+#include "SDL_shaders_gl.h"
+
+#ifdef __MACOSX__
+#include <OpenGL/OpenGL.h>
+#endif
+
+/* To prevent unnecessary window recreation,
+ * these should match the defaults selected in SDL_GL_ResetAttributes
+ */
+
+#define RENDERER_CONTEXT_MAJOR 2
+#define RENDERER_CONTEXT_MINOR 1
+
+/* OpenGL renderer implementation */
+
+/* Details on optimizing the texture path on Mac OS X:
+ http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/opengl_texturedata.html
+*/
+
+/* Used to re-create the window with OpenGL capability */
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
+
+static const float inv255f = 1.0f / 255.0f;
+
+static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void GL_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
+static SDL_bool GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
+static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+static int GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+static int GL_UpdateViewport(SDL_Renderer * renderer);
+static int GL_UpdateClipRect(SDL_Renderer * renderer);
+static int GL_RenderClear(SDL_Renderer * renderer);
+static int GL_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int GL_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int GL_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
+static int GL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
+static int GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch);
+static void GL_RenderPresent(SDL_Renderer * renderer);
+static void GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static void GL_DestroyRenderer(SDL_Renderer * renderer);
+static int GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
+static int GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture);
+
+SDL_RenderDriver GL_RenderDriver = {
+ GL_CreateRenderer,
+ {
+ "opengl",
+ (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
+ 1,
+ {SDL_PIXELFORMAT_ARGB8888},
+ 0,
+ 0}
+};
+
+typedef struct GL_FBOList GL_FBOList;
+
+struct GL_FBOList
+{
+ Uint32 w, h;
+ GLuint FBO;
+ GL_FBOList *next;
+};
+
+typedef struct
+{
+ SDL_GLContext context;
+
+ SDL_bool debug_enabled;
+ SDL_bool GL_ARB_debug_output_supported;
+ int errors;
+ char **error_messages;
+ GLDEBUGPROCARB next_error_callback;
+ GLvoid *next_error_userparam;
+
+ SDL_bool GL_ARB_texture_non_power_of_two_supported;
+ SDL_bool GL_ARB_texture_rectangle_supported;
+ struct {
+ GL_Shader shader;
+ Uint32 color;
+ SDL_BlendMode blendMode;
+ } current;
+
+ SDL_bool GL_EXT_framebuffer_object_supported;
+ GL_FBOList *framebuffers;
+
+ /* OpenGL functions */
+#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
+#include "SDL_glfuncs.h"
+#undef SDL_PROC
+
+ /* Multitexture support */
+ SDL_bool GL_ARB_multitexture_supported;
+ PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
+ GLint num_texture_units;
+
+ PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
+ PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
+ PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
+ PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
+ PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
+
+ /* Shader support */
+ GL_ShaderContext *shaders;
+
+} GL_RenderData;
+
+typedef struct
+{
+ GLuint texture;
+ GLenum type;
+ GLfloat texw;
+ GLfloat texh;
+ GLenum format;
+ GLenum formattype;
+ void *pixels;
+ int pitch;
+ SDL_Rect locked_rect;
+
+ /* YUV texture support */
+ SDL_bool yuv;
+ SDL_bool nv12;
+ GLuint utexture;
+ GLuint vtexture;
+
+ GL_FBOList *fbo;
+} GL_TextureData;
+
+SDL_FORCE_INLINE const char*
+GL_TranslateError (GLenum error)
+{
+#define GL_ERROR_TRANSLATE(e) case e: return #e;
+ switch (error) {
+ GL_ERROR_TRANSLATE(GL_INVALID_ENUM)
+ GL_ERROR_TRANSLATE(GL_INVALID_VALUE)
+ GL_ERROR_TRANSLATE(GL_INVALID_OPERATION)
+ GL_ERROR_TRANSLATE(GL_OUT_OF_MEMORY)
+ GL_ERROR_TRANSLATE(GL_NO_ERROR)
+ GL_ERROR_TRANSLATE(GL_STACK_OVERFLOW)
+ GL_ERROR_TRANSLATE(GL_STACK_UNDERFLOW)
+ GL_ERROR_TRANSLATE(GL_TABLE_TOO_LARGE)
+ default:
+ return "UNKNOWN";
+}
+#undef GL_ERROR_TRANSLATE
+}
+
+SDL_FORCE_INLINE void
+GL_ClearErrors(SDL_Renderer *renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (!data->debug_enabled)
+ {
+ return;
+ }
+ if (data->GL_ARB_debug_output_supported) {
+ if (data->errors) {
+ int i;
+ for (i = 0; i < data->errors; ++i) {
+ SDL_free(data->error_messages[i]);
+ }
+ SDL_free(data->error_messages);
+
+ data->errors = 0;
+ data->error_messages = NULL;
+ }
+ } else {
+ while (data->glGetError() != GL_NO_ERROR) {
+ continue;
+ }
+ }
+}
+
+SDL_FORCE_INLINE int
+GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ int ret = 0;
+
+ if (!data->debug_enabled)
+ {
+ return 0;
+ }
+ if (data->GL_ARB_debug_output_supported) {
+ if (data->errors) {
+ int i;
+ for (i = 0; i < data->errors; ++i) {
+ SDL_SetError("%s: %s (%d): %s %s", prefix, file, line, function, data->error_messages[i]);
+ ret = -1;
+ }
+ GL_ClearErrors(renderer);
+ }
+ } else {
+ /* check gl errors (can return multiple errors) */
+ for (;;) {
+ GLenum error = data->glGetError();
+ if (error != GL_NO_ERROR) {
+ if (prefix == NULL || prefix[0] == '\0') {
+ prefix = "generic";
+ }
+ SDL_SetError("%s: %s (%d): %s %s (0x%X)", prefix, file, line, function, GL_TranslateError(error), error);
+ ret = -1;
+ } else {
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+#if 0
+#define GL_CheckError(prefix, renderer)
+#else
+#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION)
+#endif
+
+static int
+GL_LoadFunctions(GL_RenderData * data)
+{
+#ifdef __SDL_NOGETPROCADDR__
+#define SDL_PROC(ret,func,params) data->func=func;
+#else
+#define SDL_PROC(ret,func,params) \
+ do { \
+ data->func = SDL_GL_GetProcAddress(#func); \
+ if ( ! data->func ) { \
+ return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
+ } \
+ } while ( 0 );
+#endif /* __SDL_NOGETPROCADDR__ */
+
+#include "SDL_glfuncs.h"
+#undef SDL_PROC
+ return 0;
+}
+
+static SDL_GLContext SDL_CurrentContext = NULL;
+
+static int
+GL_ActivateRenderer(SDL_Renderer * renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context ||
+ SDL_GL_GetCurrentContext() != data->context) {
+ if (SDL_GL_MakeCurrent(renderer->window, data->context) < 0) {
+ return -1;
+ }
+ SDL_CurrentContext = data->context;
+
+ GL_UpdateViewport(renderer);
+ }
+
+ GL_ClearErrors(renderer);
+
+ return 0;
+}
+
+/* This is called if we need to invalidate all of the SDL OpenGL state */
+static void
+GL_ResetState(SDL_Renderer *renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (SDL_GL_GetCurrentContext() == data->context) {
+ GL_UpdateViewport(renderer);
+ } else {
+ GL_ActivateRenderer(renderer);
+ }
+
+ data->current.shader = SHADER_NONE;
+ data->current.color = 0xffffffff;
+ data->current.blendMode = SDL_BLENDMODE_INVALID;
+
+ data->glDisable(GL_DEPTH_TEST);
+ data->glDisable(GL_CULL_FACE);
+ /* This ended up causing video discrepancies between OpenGL and Direct3D */
+ /* data->glEnable(GL_LINE_SMOOTH); */
+
+ data->glMatrixMode(GL_MODELVIEW);
+ data->glLoadIdentity();
+
+ GL_CheckError("", renderer);
+}
+
+static void APIENTRY
+GL_HandleDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam)
+{
+ SDL_Renderer *renderer = (SDL_Renderer *) userParam;
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (type == GL_DEBUG_TYPE_ERROR_ARB) {
+ /* Record this error */
+ int errors = data->errors + 1;
+ char **error_messages = SDL_realloc(data->error_messages, errors * sizeof(*data->error_messages));
+ if (error_messages) {
+ data->errors = errors;
+ data->error_messages = error_messages;
+ data->error_messages[data->errors-1] = SDL_strdup(message);
+ }
+ }
+
+ /* If there's another error callback, pass it along, otherwise log it */
+ if (data->next_error_callback) {
+ data->next_error_callback(source, type, id, severity, length, message, data->next_error_userparam);
+ } else {
+ if (type == GL_DEBUG_TYPE_ERROR_ARB) {
+ SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", message);
+ } else {
+ SDL_LogDebug(SDL_LOG_CATEGORY_RENDER, "%s", message);
+ }
+ }
+}
+
+static GL_FBOList *
+GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h)
+{
+ GL_FBOList *result = data->framebuffers;
+
+ while (result && ((result->w != w) || (result->h != h))) {
+ result = result->next;
+ }
+
+ if (!result) {
+ result = SDL_malloc(sizeof(GL_FBOList));
+ if (result) {
+ result->w = w;
+ result->h = h;
+ data->glGenFramebuffersEXT(1, &result->FBO);
+ result->next = data->framebuffers;
+ data->framebuffers = result;
+ }
+ }
+ return result;
+}
+
+SDL_Renderer *
+GL_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+ SDL_Renderer *renderer;
+ GL_RenderData *data;
+ GLint value;
+ Uint32 window_flags;
+ int profile_mask = 0, major = 0, minor = 0;
+ SDL_bool changed_window = SDL_FALSE;
+
+ SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask);
+ SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major);
+ SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor);
+
+ window_flags = SDL_GetWindowFlags(window);
+ if (!(window_flags & SDL_WINDOW_OPENGL) ||
+ profile_mask == SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) {
+
+ changed_window = SDL_TRUE;
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);
+
+ if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) {
+ goto error;
+ }
+ }
+
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ goto error;
+ }
+
+ data = (GL_RenderData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ GL_DestroyRenderer(renderer);
+ SDL_OutOfMemory();
+ goto error;
+ }
+
+ renderer->WindowEvent = GL_WindowEvent;
+ renderer->GetOutputSize = GL_GetOutputSize;
+ renderer->SupportsBlendMode = GL_SupportsBlendMode;
+ renderer->CreateTexture = GL_CreateTexture;
+ renderer->UpdateTexture = GL_UpdateTexture;
+ renderer->UpdateTextureYUV = GL_UpdateTextureYUV;
+ renderer->LockTexture = GL_LockTexture;
+ renderer->UnlockTexture = GL_UnlockTexture;
+ renderer->SetRenderTarget = GL_SetRenderTarget;
+ renderer->UpdateViewport = GL_UpdateViewport;
+ renderer->UpdateClipRect = GL_UpdateClipRect;
+ renderer->RenderClear = GL_RenderClear;
+ renderer->RenderDrawPoints = GL_RenderDrawPoints;
+ renderer->RenderDrawLines = GL_RenderDrawLines;
+ renderer->RenderFillRects = GL_RenderFillRects;
+ renderer->RenderCopy = GL_RenderCopy;
+ renderer->RenderCopyEx = GL_RenderCopyEx;
+ renderer->RenderReadPixels = GL_RenderReadPixels;
+ renderer->RenderPresent = GL_RenderPresent;
+ renderer->DestroyTexture = GL_DestroyTexture;
+ renderer->DestroyRenderer = GL_DestroyRenderer;
+ renderer->GL_BindTexture = GL_BindTexture;
+ renderer->GL_UnbindTexture = GL_UnbindTexture;
+ renderer->info = GL_RenderDriver.info;
+ renderer->info.flags = SDL_RENDERER_ACCELERATED;
+ renderer->driverdata = data;
+ renderer->window = window;
+
+ data->context = SDL_GL_CreateContext(window);
+ if (!data->context) {
+ GL_DestroyRenderer(renderer);
+ goto error;
+ }
+ if (SDL_GL_MakeCurrent(window, data->context) < 0) {
+ GL_DestroyRenderer(renderer);
+ goto error;
+ }
+
+ if (GL_LoadFunctions(data) < 0) {
+ GL_DestroyRenderer(renderer);
+ goto error;
+ }
+
+#ifdef __MACOSX__
+ /* Enable multi-threaded rendering */
+ /* Disabled until Ryan finishes his VBO/PBO code...
+ CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine);
+ */
+#endif
+
+ if (flags & SDL_RENDERER_PRESENTVSYNC) {
+ SDL_GL_SetSwapInterval(1);
+ } else {
+ SDL_GL_SetSwapInterval(0);
+ }
+ if (SDL_GL_GetSwapInterval() > 0) {
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+
+ /* Check for debug output support */
+ if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_FLAGS, &value) == 0 &&
+ (value & SDL_GL_CONTEXT_DEBUG_FLAG)) {
+ data->debug_enabled = SDL_TRUE;
+ }
+ if (data->debug_enabled && SDL_GL_ExtensionSupported("GL_ARB_debug_output")) {
+ PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
+
+ data->GL_ARB_debug_output_supported = SDL_TRUE;
+ data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)(char *)&data->next_error_callback);
+ data->glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM_ARB, &data->next_error_userparam);
+ glDebugMessageCallbackARBFunc(GL_HandleDebugMessage, renderer);
+
+ /* Make sure our callback is called when errors actually happen */
+ data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+ }
+
+ if (SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) {
+ data->GL_ARB_texture_non_power_of_two_supported = SDL_TRUE;
+ } else if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") ||
+ SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
+ data->GL_ARB_texture_rectangle_supported = SDL_TRUE;
+ }
+ if (data->GL_ARB_texture_rectangle_supported) {
+ data->glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &value);
+ renderer->info.max_texture_width = value;
+ renderer->info.max_texture_height = value;
+ } else {
+ data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
+ renderer->info.max_texture_width = value;
+ renderer->info.max_texture_height = value;
+ }
+
+ /* Check for multitexture support */
+ if (SDL_GL_ExtensionSupported("GL_ARB_multitexture")) {
+ data->glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
+ if (data->glActiveTextureARB) {
+ data->GL_ARB_multitexture_supported = SDL_TRUE;
+ data->glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &data->num_texture_units);
+ }
+ }
+
+ /* Check for shader support */
+ if (SDL_GetHintBoolean(SDL_HINT_RENDER_OPENGL_SHADERS, SDL_TRUE)) {
+ data->shaders = GL_CreateShaderContext();
+ }
+ SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s",
+ data->shaders ? "ENABLED" : "DISABLED");
+
+ /* We support YV12 textures using 3 textures and a shader */
+ if (data->shaders && data->num_texture_units >= 3) {
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
+ }
+
+#ifdef __MACOSX__
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
+#endif
+
+ if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
+ data->GL_EXT_framebuffer_object_supported = SDL_TRUE;
+ data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)
+ SDL_GL_GetProcAddress("glGenFramebuffersEXT");
+ data->glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)
+ SDL_GL_GetProcAddress("glDeleteFramebuffersEXT");
+ data->glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
+ SDL_GL_GetProcAddress("glFramebufferTexture2DEXT");
+ data->glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)
+ SDL_GL_GetProcAddress("glBindFramebufferEXT");
+ data->glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
+ SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT");
+ renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE;
+ }
+ data->framebuffers = NULL;
+
+ /* Set up parameters for rendering */
+ GL_ResetState(renderer);
+
+ return renderer;
+
+error:
+ if (changed_window) {
+ /* Uh oh, better try to put it back... */
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile_mask);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor);
+ SDL_RecreateWindow(window, window_flags);
+ }
+ return NULL;
+}
+
+static void
+GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
+ event->event == SDL_WINDOWEVENT_SHOWN ||
+ event->event == SDL_WINDOWEVENT_HIDDEN) {
+ /* Rebind the context to the window area and update matrices */
+ SDL_CurrentContext = NULL;
+ }
+}
+
+static int
+GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
+{
+ SDL_GL_GetDrawableSize(renderer->window, w, h);
+ return 0;
+}
+
+static GLenum GetBlendFunc(SDL_BlendFactor factor)
+{
+ switch (factor) {
+ case SDL_BLENDFACTOR_ZERO:
+ return GL_ZERO;
+ case SDL_BLENDFACTOR_ONE:
+ return GL_ONE;
+ case SDL_BLENDFACTOR_SRC_COLOR:
+ return GL_SRC_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
+ return GL_ONE_MINUS_SRC_COLOR;
+ case SDL_BLENDFACTOR_SRC_ALPHA:
+ return GL_SRC_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ case SDL_BLENDFACTOR_DST_COLOR:
+ return GL_DST_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
+ return GL_ONE_MINUS_DST_COLOR;
+ case SDL_BLENDFACTOR_DST_ALPHA:
+ return GL_DST_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
+ return GL_ONE_MINUS_DST_ALPHA;
+ default:
+ return GL_INVALID_ENUM;
+ }
+}
+
+static GLenum GetBlendEquation(SDL_BlendOperation operation)
+{
+ switch (operation) {
+ case SDL_BLENDOPERATION_ADD:
+ return GL_FUNC_ADD;
+ case SDL_BLENDOPERATION_SUBTRACT:
+ return GL_FUNC_SUBTRACT;
+ case SDL_BLENDOPERATION_REV_SUBTRACT:
+ return GL_FUNC_REVERSE_SUBTRACT;
+ default:
+ return GL_INVALID_ENUM;
+ }
+}
+
+static SDL_bool
+GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+
+ if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM ||
+ GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM ||
+ GetBlendEquation(colorOperation) == GL_INVALID_ENUM ||
+ GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM ||
+ GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM ||
+ GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) {
+ return SDL_FALSE;
+ }
+ if (colorOperation != alphaOperation) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+SDL_FORCE_INLINE int
+power_of_2(int input)
+{
+ int value = 1;
+
+ while (value < input) {
+ value <<= 1;
+ }
+ return value;
+}
+
+SDL_FORCE_INLINE SDL_bool
+convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
+ GLint* internalFormat, GLenum* format, GLenum* type)
+{
+ switch (pixel_format) {
+ case SDL_PIXELFORMAT_ARGB8888:
+ *internalFormat = GL_RGBA8;
+ *format = GL_BGRA;
+ *type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ *internalFormat = GL_LUMINANCE;
+ *format = GL_LUMINANCE;
+ *type = GL_UNSIGNED_BYTE;
+ break;
+#ifdef __MACOSX__
+ case SDL_PIXELFORMAT_UYVY:
+ *internalFormat = GL_RGB8;
+ *format = GL_YCBCR_422_APPLE;
+ *type = GL_UNSIGNED_SHORT_8_8_APPLE;
+ break;
+#endif
+ default:
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static GLenum
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return GL_NEAREST;
+ } else {
+ return GL_LINEAR;
+ }
+}
+
+static int
+GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *data;
+ GLint internalFormat;
+ GLenum format, type;
+ int texture_w, texture_h;
+ GLenum scaleMode;
+
+ GL_ActivateRenderer(renderer);
+
+ if (texture->access == SDL_TEXTUREACCESS_TARGET &&
+ !renderdata->GL_EXT_framebuffer_object_supported) {
+ return SDL_SetError("Render targets not supported by OpenGL");
+ }
+
+ if (!convert_format(renderdata, texture->format, &internalFormat,
+ &format, &type)) {
+ return SDL_SetError("Texture format %s not supported by OpenGL",
+ SDL_GetPixelFormatName(texture->format));
+ }
+
+ data = (GL_TextureData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ size_t size;
+ data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
+ size = texture->h * data->pitch;
+ if (texture->format == SDL_PIXELFORMAT_YV12 ||
+ texture->format == SDL_PIXELFORMAT_IYUV) {
+ /* Need to add size for the U and V planes */
+ size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2);
+ }
+ if (texture->format == SDL_PIXELFORMAT_NV12 ||
+ texture->format == SDL_PIXELFORMAT_NV21) {
+ /* Need to add size for the U/V plane */
+ size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2);
+ }
+ data->pixels = SDL_calloc(1, size);
+ if (!data->pixels) {
+ SDL_free(data);
+ return SDL_OutOfMemory();
+ }
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ data->fbo = GL_GetFBO(renderdata, texture->w, texture->h);
+ } else {
+ data->fbo = NULL;
+ }
+
+ GL_CheckError("", renderer);
+ renderdata->glGenTextures(1, &data->texture);
+ if (GL_CheckError("glGenTextures()", renderer) < 0) {
+ if (data->pixels) {
+ SDL_free(data->pixels);
+ }
+ SDL_free(data);
+ return -1;
+ }
+ texture->driverdata = data;
+
+ if (renderdata->GL_ARB_texture_non_power_of_two_supported) {
+ data->type = GL_TEXTURE_2D;
+ texture_w = texture->w;
+ texture_h = texture->h;
+ data->texw = 1.0f;
+ data->texh = 1.0f;
+ } else if (renderdata->GL_ARB_texture_rectangle_supported) {
+ data->type = GL_TEXTURE_RECTANGLE_ARB;
+ texture_w = texture->w;
+ texture_h = texture->h;
+ data->texw = (GLfloat) texture_w;
+ data->texh = (GLfloat) texture_h;
+ } else {
+ data->type = GL_TEXTURE_2D;
+ texture_w = power_of_2(texture->w);
+ texture_h = power_of_2(texture->h);
+ data->texw = (GLfloat) (texture->w) / texture_w;
+ data->texh = (GLfloat) texture->h / texture_h;
+ }
+
+ data->format = format;
+ data->formattype = type;
+ scaleMode = GetScaleQuality();
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode);
+ /* According to the spec, CLAMP_TO_EDGE is the default for TEXTURE_RECTANGLE
+ and setting it causes an INVALID_ENUM error in the latest NVidia drivers.
+ */
+ if (data->type != GL_TEXTURE_RECTANGLE_ARB) {
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE);
+ }
+#ifdef __MACOSX__
+#ifndef GL_TEXTURE_STORAGE_HINT_APPLE
+#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
+#endif
+#ifndef STORAGE_CACHED_APPLE
+#define STORAGE_CACHED_APPLE 0x85BE
+#endif
+#ifndef STORAGE_SHARED_APPLE
+#define STORAGE_SHARED_APPLE 0x85BF
+#endif
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
+ GL_STORAGE_SHARED_APPLE);
+ } else {
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
+ GL_STORAGE_CACHED_APPLE);
+ }
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING
+ && texture->format == SDL_PIXELFORMAT_ARGB8888
+ && (texture->w % 8) == 0) {
+ renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
+ renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
+ (data->pitch / SDL_BYTESPERPIXEL(texture->format)));
+ renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
+ texture_h, 0, format, type, data->pixels);
+ renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
+ }
+ else
+#endif
+ {
+ renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
+ texture_h, 0, format, type, NULL);
+ }
+ renderdata->glDisable(data->type);
+ if (GL_CheckError("glTexImage2D()", renderer) < 0) {
+ return -1;
+ }
+
+ if (texture->format == SDL_PIXELFORMAT_YV12 ||
+ texture->format == SDL_PIXELFORMAT_IYUV) {
+ data->yuv = SDL_TRUE;
+
+ renderdata->glGenTextures(1, &data->utexture);
+ renderdata->glGenTextures(1, &data->vtexture);
+ renderdata->glEnable(data->type);
+
+ renderdata->glBindTexture(data->type, data->utexture);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
+ scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
+ scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2,
+ (texture_h+1)/2, 0, format, type, NULL);
+
+ renderdata->glBindTexture(data->type, data->vtexture);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
+ scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
+ scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2,
+ (texture_h+1)/2, 0, format, type, NULL);
+
+ renderdata->glDisable(data->type);
+ }
+
+ if (texture->format == SDL_PIXELFORMAT_NV12 ||
+ texture->format == SDL_PIXELFORMAT_NV21) {
+ data->nv12 = SDL_TRUE;
+
+ renderdata->glGenTextures(1, &data->utexture);
+ renderdata->glEnable(data->type);
+
+ renderdata->glBindTexture(data->type, data->utexture);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
+ scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
+ scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE);
+ renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, (texture_w+1)/2,
+ (texture_h+1)/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
+ renderdata->glDisable(data->type);
+ }
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{
+ GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *data = (GL_TextureData *) texture->driverdata;
+ const int texturebpp = SDL_BYTESPERPIXEL(texture->format);
+
+ SDL_assert(texturebpp != 0); /* otherwise, division by zero later. */
+
+ GL_ActivateRenderer(renderer);
+
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / texturebpp));
+ renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
+ rect->h, data->format, data->formattype,
+ pixels);
+ if (data->yuv) {
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2));
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+ if (texture->format == SDL_PIXELFORMAT_YV12) {
+ renderdata->glBindTexture(data->type, data->vtexture);
+ } else {
+ renderdata->glBindTexture(data->type, data->utexture);
+ }
+ renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+ (rect->w+1)/2, (rect->h+1)/2,
+ data->format, data->formattype, pixels);
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2));
+ if (texture->format == SDL_PIXELFORMAT_YV12) {
+ renderdata->glBindTexture(data->type, data->utexture);
+ } else {
+ renderdata->glBindTexture(data->type, data->vtexture);
+ }
+ renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+ (rect->w+1)/2, (rect->h+1)/2,
+ data->format, data->formattype, pixels);
+ }
+
+ if (data->nv12) {
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2));
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+ renderdata->glBindTexture(data->type, data->utexture);
+ renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+ (rect->w + 1)/2, (rect->h + 1)/2,
+ GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, pixels);
+ }
+ renderdata->glDisable(data->type);
+
+ return GL_CheckError("glTexSubImage2D()", renderer);
+}
+
+static int
+GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *data = (GL_TextureData *) texture->driverdata;
+
+ GL_ActivateRenderer(renderer);
+
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Ypitch);
+ renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
+ rect->h, data->format, data->formattype,
+ Yplane);
+
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Upitch);
+ renderdata->glBindTexture(data->type, data->utexture);
+ renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+ (rect->w + 1)/2, (rect->h + 1)/2,
+ data->format, data->formattype, Uplane);
+
+ renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Vpitch);
+ renderdata->glBindTexture(data->type, data->vtexture);
+ renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2,
+ (rect->w + 1)/2, (rect->h + 1)/2,
+ data->format, data->formattype, Vplane);
+ renderdata->glDisable(data->type);
+
+ return GL_CheckError("glTexSubImage2D()", renderer);
+}
+
+static int
+GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ GL_TextureData *data = (GL_TextureData *) texture->driverdata;
+
+ data->locked_rect = *rect;
+ *pixels =
+ (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = data->pitch;
+ return 0;
+}
+
+static void
+GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GL_TextureData *data = (GL_TextureData *) texture->driverdata;
+ const SDL_Rect *rect;
+ void *pixels;
+
+ rect = &data->locked_rect;
+ pixels =
+ (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ GL_UpdateTexture(renderer, texture, rect, pixels, data->pitch);
+}
+
+static int
+GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *texturedata;
+ GLenum status;
+
+ GL_ActivateRenderer(renderer);
+
+ if (!data->GL_EXT_framebuffer_object_supported) {
+ return SDL_SetError("Render targets not supported by OpenGL");
+ }
+
+ if (texture == NULL) {
+ data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ return 0;
+ }
+
+ texturedata = (GL_TextureData *) texture->driverdata;
+ data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, texturedata->fbo->FBO);
+ /* TODO: check if texture pixel format allows this operation */
+ data->glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, texturedata->type, texturedata->texture, 0);
+ /* Check FBO status */
+ status = data->glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ return SDL_SetError("glFramebufferTexture2DEXT() failed");
+ }
+ return 0;
+}
+
+static int
+GL_UpdateViewport(SDL_Renderer * renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ /* We'll update the viewport after we rebind the context */
+ return 0;
+ }
+
+ if (renderer->target) {
+ data->glViewport(renderer->viewport.x, renderer->viewport.y,
+ renderer->viewport.w, renderer->viewport.h);
+ } else {
+ int w, h;
+
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
+ renderer->viewport.w, renderer->viewport.h);
+ }
+
+ data->glMatrixMode(GL_PROJECTION);
+ data->glLoadIdentity();
+ if (renderer->viewport.w && renderer->viewport.h) {
+ if (renderer->target) {
+ data->glOrtho((GLdouble) 0,
+ (GLdouble) renderer->viewport.w,
+ (GLdouble) 0,
+ (GLdouble) renderer->viewport.h,
+ 0.0, 1.0);
+ } else {
+ data->glOrtho((GLdouble) 0,
+ (GLdouble) renderer->viewport.w,
+ (GLdouble) renderer->viewport.h,
+ (GLdouble) 0,
+ 0.0, 1.0);
+ }
+ }
+ data->glMatrixMode(GL_MODELVIEW);
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GL_UpdateClipRect(SDL_Renderer * renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (renderer->clipping_enabled) {
+ const SDL_Rect *rect = &renderer->clip_rect;
+ data->glEnable(GL_SCISSOR_TEST);
+ if (renderer->target) {
+ data->glScissor(renderer->viewport.x + rect->x, renderer->viewport.y + rect->y, rect->w, rect->h);
+ } else {
+ int w, h;
+
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
+ }
+ } else {
+ data->glDisable(GL_SCISSOR_TEST);
+ }
+ return 0;
+}
+
+static void
+GL_SetShader(GL_RenderData * data, GL_Shader shader)
+{
+ if (data->shaders && shader != data->current.shader) {
+ GL_SelectShader(data->shaders, shader);
+ data->current.shader = shader;
+ }
+}
+
+static void
+GL_SetColor(GL_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ Uint32 color = ((a << 24) | (r << 16) | (g << 8) | b);
+
+ if (color != data->current.color) {
+ data->glColor4f((GLfloat) r * inv255f,
+ (GLfloat) g * inv255f,
+ (GLfloat) b * inv255f,
+ (GLfloat) a * inv255f);
+ data->current.color = color;
+ }
+}
+
+static void
+GL_SetBlendMode(GL_RenderData * data, SDL_BlendMode blendMode)
+{
+ if (blendMode != data->current.blendMode) {
+ if (blendMode == SDL_BLENDMODE_NONE) {
+ data->glDisable(GL_BLEND);
+ } else {
+ data->glEnable(GL_BLEND);
+ data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode)));
+ data->glBlendEquation(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)));
+ }
+ data->current.blendMode = blendMode;
+ }
+}
+
+static void
+GL_SetDrawingState(SDL_Renderer * renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ GL_ActivateRenderer(renderer);
+
+ GL_SetColor(data, renderer->r,
+ renderer->g,
+ renderer->b,
+ renderer->a);
+
+ GL_SetBlendMode(data, renderer->blendMode);
+
+ GL_SetShader(data, SHADER_SOLID);
+}
+
+static int
+GL_RenderClear(SDL_Renderer * renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ GL_ActivateRenderer(renderer);
+
+ data->glClearColor((GLfloat) renderer->r * inv255f,
+ (GLfloat) renderer->g * inv255f,
+ (GLfloat) renderer->b * inv255f,
+ (GLfloat) renderer->a * inv255f);
+
+ if (renderer->clipping_enabled) {
+ data->glDisable(GL_SCISSOR_TEST);
+ }
+
+ data->glClear(GL_COLOR_BUFFER_BIT);
+
+ if (renderer->clipping_enabled) {
+ data->glEnable(GL_SCISSOR_TEST);
+ }
+
+ return 0;
+}
+
+static int
+GL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ int i;
+
+ GL_SetDrawingState(renderer);
+
+ data->glBegin(GL_POINTS);
+ for (i = 0; i < count; ++i) {
+ data->glVertex2f(0.5f + points[i].x, 0.5f + points[i].y);
+ }
+ data->glEnd();
+
+ return 0;
+}
+
+static int
+GL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ int i;
+
+ GL_SetDrawingState(renderer);
+
+ if (count > 2 &&
+ points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
+ data->glBegin(GL_LINE_LOOP);
+ /* GL_LINE_LOOP takes care of the final segment */
+ --count;
+ for (i = 0; i < count; ++i) {
+ data->glVertex2f(0.5f + points[i].x, 0.5f + points[i].y);
+ }
+ data->glEnd();
+ } else {
+#if defined(__MACOSX__) || defined(__WIN32__)
+#else
+ int x1, y1, x2, y2;
+#endif
+
+ data->glBegin(GL_LINE_STRIP);
+ for (i = 0; i < count; ++i) {
+ data->glVertex2f(0.5f + points[i].x, 0.5f + points[i].y);
+ }
+ data->glEnd();
+
+ /* The line is half open, so we need one more point to complete it.
+ * http://www.opengl.org/documentation/specs/version1.1/glspec1.1/node47.html
+ * If we have to, we can use vertical line and horizontal line textures
+ * for vertical and horizontal lines, and then create custom textures
+ * for diagonal lines and software render those. It's terrible, but at
+ * least it would be pixel perfect.
+ */
+ data->glBegin(GL_POINTS);
+#if defined(__MACOSX__) || defined(__WIN32__)
+ /* Mac OS X and Windows seem to always leave the last point open */
+ data->glVertex2f(0.5f + points[count-1].x, 0.5f + points[count-1].y);
+#else
+ /* Linux seems to leave the right-most or bottom-most point open */
+ x1 = points[0].x;
+ y1 = points[0].y;
+ x2 = points[count-1].x;
+ y2 = points[count-1].y;
+
+ if (x1 > x2) {
+ data->glVertex2f(0.5f + x1, 0.5f + y1);
+ } else if (x2 > x1) {
+ data->glVertex2f(0.5f + x2, 0.5f + y2);
+ }
+ if (y1 > y2) {
+ data->glVertex2f(0.5f + x1, 0.5f + y1);
+ } else if (y2 > y1) {
+ data->glVertex2f(0.5f + x2, 0.5f + y2);
+ }
+#endif
+ data->glEnd();
+ }
+ return GL_CheckError("", renderer);
+}
+
+static int
+GL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ int i;
+
+ GL_SetDrawingState(renderer);
+
+ for (i = 0; i < count; ++i) {
+ const SDL_FRect *rect = &rects[i];
+
+ data->glRectf(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
+ }
+ return GL_CheckError("", renderer);
+}
+
+static int
+GL_SetupCopy(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
+
+ data->glEnable(texturedata->type);
+ if (texturedata->yuv) {
+ data->glActiveTextureARB(GL_TEXTURE2_ARB);
+ data->glBindTexture(texturedata->type, texturedata->vtexture);
+
+ data->glActiveTextureARB(GL_TEXTURE1_ARB);
+ data->glBindTexture(texturedata->type, texturedata->utexture);
+
+ data->glActiveTextureARB(GL_TEXTURE0_ARB);
+ }
+ if (texturedata->nv12) {
+ data->glActiveTextureARB(GL_TEXTURE1_ARB);
+ data->glBindTexture(texturedata->type, texturedata->utexture);
+
+ data->glActiveTextureARB(GL_TEXTURE0_ARB);
+ }
+ data->glBindTexture(texturedata->type, texturedata->texture);
+
+ if (texture->modMode) {
+ GL_SetColor(data, texture->r, texture->g, texture->b, texture->a);
+ } else {
+ GL_SetColor(data, 255, 255, 255, 255);
+ }
+
+ GL_SetBlendMode(data, texture->blendMode);
+
+ if (texturedata->yuv || texturedata->nv12) {
+ switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ if (texturedata->yuv) {
+ GL_SetShader(data, SHADER_YUV_JPEG);
+ } else if (texture->format == SDL_PIXELFORMAT_NV12) {
+ GL_SetShader(data, SHADER_NV12_JPEG);
+ } else {
+ GL_SetShader(data, SHADER_NV21_JPEG);
+ }
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ if (texturedata->yuv) {
+ GL_SetShader(data, SHADER_YUV_BT601);
+ } else if (texture->format == SDL_PIXELFORMAT_NV12) {
+ GL_SetShader(data, SHADER_NV12_BT601);
+ } else {
+ GL_SetShader(data, SHADER_NV21_BT601);
+ }
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ if (texturedata->yuv) {
+ GL_SetShader(data, SHADER_YUV_BT709);
+ } else if (texture->format == SDL_PIXELFORMAT_NV12) {
+ GL_SetShader(data, SHADER_NV12_BT709);
+ } else {
+ GL_SetShader(data, SHADER_NV21_BT709);
+ }
+ break;
+ default:
+ return SDL_SetError("Unsupported YUV conversion mode");
+ }
+ } else {
+ GL_SetShader(data, SHADER_RGB);
+ }
+ return 0;
+}
+
+static int
+GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
+ GLfloat minx, miny, maxx, maxy;
+ GLfloat minu, maxu, minv, maxv;
+
+ GL_ActivateRenderer(renderer);
+
+ if (GL_SetupCopy(renderer, texture) < 0) {
+ return -1;
+ }
+
+ minx = dstrect->x;
+ miny = dstrect->y;
+ maxx = dstrect->x + dstrect->w;
+ maxy = dstrect->y + dstrect->h;
+
+ minu = (GLfloat) srcrect->x / texture->w;
+ minu *= texturedata->texw;
+ maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
+ maxu *= texturedata->texw;
+ minv = (GLfloat) srcrect->y / texture->h;
+ minv *= texturedata->texh;
+ maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
+ maxv *= texturedata->texh;
+
+ data->glBegin(GL_TRIANGLE_STRIP);
+ data->glTexCoord2f(minu, minv);
+ data->glVertex2f(minx, miny);
+ data->glTexCoord2f(maxu, minv);
+ data->glVertex2f(maxx, miny);
+ data->glTexCoord2f(minu, maxv);
+ data->glVertex2f(minx, maxy);
+ data->glTexCoord2f(maxu, maxv);
+ data->glVertex2f(maxx, maxy);
+ data->glEnd();
+
+ data->glDisable(texturedata->type);
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
+ GLfloat minx, miny, maxx, maxy;
+ GLfloat centerx, centery;
+ GLfloat minu, maxu, minv, maxv;
+
+ GL_ActivateRenderer(renderer);
+
+ if (GL_SetupCopy(renderer, texture) < 0) {
+ return -1;
+ }
+
+ centerx = center->x;
+ centery = center->y;
+
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ minx = dstrect->w - centerx;
+ maxx = -centerx;
+ }
+ else {
+ minx = -centerx;
+ maxx = dstrect->w - centerx;
+ }
+
+ if (flip & SDL_FLIP_VERTICAL) {
+ miny = dstrect->h - centery;
+ maxy = -centery;
+ }
+ else {
+ miny = -centery;
+ maxy = dstrect->h - centery;
+ }
+
+ minu = (GLfloat) srcrect->x / texture->w;
+ minu *= texturedata->texw;
+ maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
+ maxu *= texturedata->texw;
+ minv = (GLfloat) srcrect->y / texture->h;
+ minv *= texturedata->texh;
+ maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
+ maxv *= texturedata->texh;
+
+ /* Translate to flip, rotate, translate to position */
+ data->glPushMatrix();
+ data->glTranslatef((GLfloat)dstrect->x + centerx, (GLfloat)dstrect->y + centery, (GLfloat)0.0);
+ data->glRotated(angle, (GLdouble)0.0, (GLdouble)0.0, (GLdouble)1.0);
+
+ data->glBegin(GL_TRIANGLE_STRIP);
+ data->glTexCoord2f(minu, minv);
+ data->glVertex2f(minx, miny);
+ data->glTexCoord2f(maxu, minv);
+ data->glVertex2f(maxx, miny);
+ data->glTexCoord2f(minu, maxv);
+ data->glVertex2f(minx, maxy);
+ data->glTexCoord2f(maxu, maxv);
+ data->glVertex2f(maxx, maxy);
+ data->glEnd();
+ data->glPopMatrix();
+
+ data->glDisable(texturedata->type);
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
+ void *temp_pixels;
+ int temp_pitch;
+ GLint internalFormat;
+ GLenum format, type;
+ Uint8 *src, *dst, *tmp;
+ int w, h, length, rows;
+ int status;
+
+ GL_ActivateRenderer(renderer);
+
+ if (!convert_format(data, temp_format, &internalFormat, &format, &type)) {
+ return SDL_SetError("Texture format %s not supported by OpenGL",
+ SDL_GetPixelFormatName(temp_format));
+ }
+
+ if (!rect->w || !rect->h) {
+ return 0; /* nothing to do. */
+ }
+
+ temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
+ temp_pixels = SDL_malloc(rect->h * temp_pitch);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_GetRendererOutputSize(renderer, &w, &h);
+
+ data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ data->glPixelStorei(GL_PACK_ROW_LENGTH,
+ (temp_pitch / SDL_BYTESPERPIXEL(temp_format)));
+
+ data->glReadPixels(rect->x, renderer->target ? rect->y : (h-rect->y)-rect->h,
+ rect->w, rect->h, format, type, temp_pixels);
+
+ if (GL_CheckError("glReadPixels()", renderer) < 0) {
+ SDL_free(temp_pixels);
+ return -1;
+ }
+
+ /* Flip the rows to be top-down if necessary */
+ if (!renderer->target) {
+ length = rect->w * SDL_BYTESPERPIXEL(temp_format);
+ src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch;
+ dst = (Uint8*)temp_pixels;
+ tmp = SDL_stack_alloc(Uint8, length);
+ rows = rect->h / 2;
+ while (rows--) {
+ SDL_memcpy(tmp, dst, length);
+ SDL_memcpy(dst, src, length);
+ SDL_memcpy(src, tmp, length);
+ dst += temp_pitch;
+ src -= temp_pitch;
+ }
+ SDL_stack_free(tmp);
+ }
+
+ status = SDL_ConvertPixels(rect->w, rect->h,
+ temp_format, temp_pixels, temp_pitch,
+ pixel_format, pixels, pitch);
+ SDL_free(temp_pixels);
+
+ return status;
+}
+
+static void
+GL_RenderPresent(SDL_Renderer * renderer)
+{
+ GL_ActivateRenderer(renderer);
+
+ SDL_GL_SwapWindow(renderer->window);
+}
+
+static void
+GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *data = (GL_TextureData *) texture->driverdata;
+
+ GL_ActivateRenderer(renderer);
+
+ if (!data) {
+ return;
+ }
+ if (data->texture) {
+ renderdata->glDeleteTextures(1, &data->texture);
+ }
+ if (data->yuv) {
+ renderdata->glDeleteTextures(1, &data->utexture);
+ renderdata->glDeleteTextures(1, &data->vtexture);
+ }
+ SDL_free(data->pixels);
+ SDL_free(data);
+ texture->driverdata = NULL;
+}
+
+static void
+GL_DestroyRenderer(SDL_Renderer * renderer)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+
+ if (data) {
+ if (data->context != NULL) {
+ /* make sure we delete the right resources! */
+ GL_ActivateRenderer(renderer);
+ }
+
+ GL_ClearErrors(renderer);
+ if (data->GL_ARB_debug_output_supported) {
+ PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
+
+ /* Uh oh, we don't have a safe way of removing ourselves from the callback chain, if it changed after we set our callback. */
+ /* For now, just always replace the callback with the original one */
+ glDebugMessageCallbackARBFunc(data->next_error_callback, data->next_error_userparam);
+ }
+ if (data->shaders) {
+ GL_DestroyShaderContext(data->shaders);
+ }
+ if (data->context) {
+ while (data->framebuffers) {
+ GL_FBOList *nextnode = data->framebuffers->next;
+ /* delete the framebuffer object */
+ data->glDeleteFramebuffersEXT(1, &data->framebuffers->FBO);
+ GL_CheckError("", renderer);
+ SDL_free(data->framebuffers);
+ data->framebuffers = nextnode;
+ }
+ SDL_GL_DeleteContext(data->context);
+ }
+ SDL_free(data);
+ }
+ SDL_free(renderer);
+}
+
+static int
+GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
+ GL_ActivateRenderer(renderer);
+
+ data->glEnable(texturedata->type);
+ if (texturedata->yuv) {
+ data->glActiveTextureARB(GL_TEXTURE2_ARB);
+ data->glBindTexture(texturedata->type, texturedata->vtexture);
+
+ data->glActiveTextureARB(GL_TEXTURE1_ARB);
+ data->glBindTexture(texturedata->type, texturedata->utexture);
+
+ data->glActiveTextureARB(GL_TEXTURE0_ARB);
+ }
+ data->glBindTexture(texturedata->type, texturedata->texture);
+
+ if(texw) *texw = (float)texturedata->texw;
+ if(texh) *texh = (float)texturedata->texh;
+
+ return 0;
+}
+
+static int
+GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
+{
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
+ GL_ActivateRenderer(renderer);
+
+ if (texturedata->yuv) {
+ data->glActiveTextureARB(GL_TEXTURE2_ARB);
+ data->glDisable(texturedata->type);
+
+ data->glActiveTextureARB(GL_TEXTURE1_ARB);
+ data->glDisable(texturedata->type);
+
+ data->glActiveTextureARB(GL_TEXTURE0_ARB);
+ }
+
+ data->glDisable(texturedata->type);
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.c b/src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.c
new file mode 100644
index 0000000..251b54d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.c
@@ -0,0 +1,524 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
+
+#include "SDL_stdinc.h"
+#include "SDL_log.h"
+#include "SDL_opengl.h"
+#include "SDL_video.h"
+#include "SDL_shaders_gl.h"
+
+/* OpenGL shader implementation */
+
+/* #define DEBUG_SHADERS */
+
+typedef struct
+{
+ GLhandleARB program;
+ GLhandleARB vert_shader;
+ GLhandleARB frag_shader;
+} GL_ShaderData;
+
+struct GL_ShaderContext
+{
+ GLenum (*glGetError)(void);
+
+ PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
+ PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
+ PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
+ PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
+ PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
+ PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
+ PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
+ PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
+ PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
+ PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
+ PFNGLUNIFORM1IARBPROC glUniform1iARB;
+ PFNGLUNIFORM1FARBPROC glUniform1fARB;
+ PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
+
+ SDL_bool GL_ARB_texture_rectangle_supported;
+
+ GL_ShaderData shaders[NUM_SHADERS];
+};
+
+#define COLOR_VERTEX_SHADER \
+"varying vec4 v_color;\n" \
+"\n" \
+"void main()\n" \
+"{\n" \
+" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \
+" v_color = gl_Color;\n" \
+"}" \
+
+#define TEXTURE_VERTEX_SHADER \
+"varying vec4 v_color;\n" \
+"varying vec2 v_texCoord;\n" \
+"\n" \
+"void main()\n" \
+"{\n" \
+" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \
+" v_color = gl_Color;\n" \
+" v_texCoord = vec2(gl_MultiTexCoord0);\n" \
+"}" \
+
+#define JPEG_SHADER_CONSTANTS \
+"// YUV offset \n" \
+"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \
+"\n" \
+"// RGB coefficients \n" \
+"const vec3 Rcoeff = vec3(1, 0.000, 1.402);\n" \
+"const vec3 Gcoeff = vec3(1, -0.3441, -0.7141);\n" \
+"const vec3 Bcoeff = vec3(1, 1.772, 0.000);\n" \
+
+#define BT601_SHADER_CONSTANTS \
+"// YUV offset \n" \
+"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
+"\n" \
+"// RGB coefficients \n" \
+"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.596);\n" \
+"const vec3 Gcoeff = vec3(1.1644, -0.3918, -0.813);\n" \
+"const vec3 Bcoeff = vec3(1.1644, 2.0172, 0.000);\n" \
+
+#define BT709_SHADER_CONSTANTS \
+"// YUV offset \n" \
+"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
+"\n" \
+"// RGB coefficients \n" \
+"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);\n" \
+"const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);\n" \
+"const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);\n" \
+
+#define YUV_SHADER_PROLOGUE \
+"varying vec4 v_color;\n" \
+"varying vec2 v_texCoord;\n" \
+"uniform sampler2D tex0; // Y \n" \
+"uniform sampler2D tex1; // U \n" \
+"uniform sampler2D tex2; // V \n" \
+"\n" \
+
+#define YUV_SHADER_BODY \
+"\n" \
+"void main()\n" \
+"{\n" \
+" vec2 tcoord;\n" \
+" vec3 yuv, rgb;\n" \
+"\n" \
+" // Get the Y value \n" \
+" tcoord = v_texCoord;\n" \
+" yuv.x = texture2D(tex0, tcoord).r;\n" \
+"\n" \
+" // Get the U and V values \n" \
+" tcoord *= UVCoordScale;\n" \
+" yuv.y = texture2D(tex1, tcoord).r;\n" \
+" yuv.z = texture2D(tex2, tcoord).r;\n" \
+"\n" \
+" // Do the color transform \n" \
+" yuv += offset;\n" \
+" rgb.r = dot(yuv, Rcoeff);\n" \
+" rgb.g = dot(yuv, Gcoeff);\n" \
+" rgb.b = dot(yuv, Bcoeff);\n" \
+"\n" \
+" // That was easy. :) \n" \
+" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \
+"}" \
+
+#define NV12_SHADER_PROLOGUE \
+"varying vec4 v_color;\n" \
+"varying vec2 v_texCoord;\n" \
+"uniform sampler2D tex0; // Y \n" \
+"uniform sampler2D tex1; // U/V \n" \
+"\n" \
+
+#define NV12_SHADER_BODY \
+"\n" \
+"void main()\n" \
+"{\n" \
+" vec2 tcoord;\n" \
+" vec3 yuv, rgb;\n" \
+"\n" \
+" // Get the Y value \n" \
+" tcoord = v_texCoord;\n" \
+" yuv.x = texture2D(tex0, tcoord).r;\n" \
+"\n" \
+" // Get the U and V values \n" \
+" tcoord *= UVCoordScale;\n" \
+" yuv.yz = texture2D(tex1, tcoord).ra;\n" \
+"\n" \
+" // Do the color transform \n" \
+" yuv += offset;\n" \
+" rgb.r = dot(yuv, Rcoeff);\n" \
+" rgb.g = dot(yuv, Gcoeff);\n" \
+" rgb.b = dot(yuv, Bcoeff);\n" \
+"\n" \
+" // That was easy. :) \n" \
+" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \
+"}" \
+
+#define NV21_SHADER_PROLOGUE \
+"varying vec4 v_color;\n" \
+"varying vec2 v_texCoord;\n" \
+"uniform sampler2D tex0; // Y \n" \
+"uniform sampler2D tex1; // U/V \n" \
+"\n" \
+
+#define NV21_SHADER_BODY \
+"\n" \
+"void main()\n" \
+"{\n" \
+" vec2 tcoord;\n" \
+" vec3 yuv, rgb;\n" \
+"\n" \
+" // Get the Y value \n" \
+" tcoord = v_texCoord;\n" \
+" yuv.x = texture2D(tex0, tcoord).r;\n" \
+"\n" \
+" // Get the U and V values \n" \
+" tcoord *= UVCoordScale;\n" \
+" yuv.yz = texture2D(tex1, tcoord).ar;\n" \
+"\n" \
+" // Do the color transform \n" \
+" yuv += offset;\n" \
+" rgb.r = dot(yuv, Rcoeff);\n" \
+" rgb.g = dot(yuv, Gcoeff);\n" \
+" rgb.b = dot(yuv, Bcoeff);\n" \
+"\n" \
+" // That was easy. :) \n" \
+" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \
+"}" \
+
+/*
+ * NOTE: Always use sampler2D, etc here. We'll #define them to the
+ * texture_rectangle versions if we choose to use that extension.
+ */
+static const char *shader_source[NUM_SHADERS][2] =
+{
+ /* SHADER_NONE */
+ { NULL, NULL },
+
+ /* SHADER_SOLID */
+ {
+ /* vertex shader */
+ COLOR_VERTEX_SHADER,
+ /* fragment shader */
+"varying vec4 v_color;\n"
+"\n"
+"void main()\n"
+"{\n"
+" gl_FragColor = v_color;\n"
+"}"
+ },
+
+ /* SHADER_RGB */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+"varying vec4 v_color;\n"
+"varying vec2 v_texCoord;\n"
+"uniform sampler2D tex0;\n"
+"\n"
+"void main()\n"
+"{\n"
+" gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n"
+"}"
+ },
+
+ /* SHADER_YUV_JPEG */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ YUV_SHADER_PROLOGUE
+ JPEG_SHADER_CONSTANTS
+ YUV_SHADER_BODY
+ },
+ /* SHADER_YUV_BT601 */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ YUV_SHADER_PROLOGUE
+ BT601_SHADER_CONSTANTS
+ YUV_SHADER_BODY
+ },
+ /* SHADER_YUV_BT709 */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ YUV_SHADER_PROLOGUE
+ BT709_SHADER_CONSTANTS
+ YUV_SHADER_BODY
+ },
+ /* SHADER_NV12_JPEG */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ NV12_SHADER_PROLOGUE
+ JPEG_SHADER_CONSTANTS
+ NV12_SHADER_BODY
+ },
+ /* SHADER_NV12_BT601 */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ NV12_SHADER_PROLOGUE
+ BT601_SHADER_CONSTANTS
+ NV12_SHADER_BODY
+ },
+ /* SHADER_NV12_BT709 */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ NV12_SHADER_PROLOGUE
+ BT709_SHADER_CONSTANTS
+ NV12_SHADER_BODY
+ },
+ /* SHADER_NV21_JPEG */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ NV21_SHADER_PROLOGUE
+ JPEG_SHADER_CONSTANTS
+ NV21_SHADER_BODY
+ },
+ /* SHADER_NV21_BT601 */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ NV21_SHADER_PROLOGUE
+ BT601_SHADER_CONSTANTS
+ NV21_SHADER_BODY
+ },
+ /* SHADER_NV21_BT709 */
+ {
+ /* vertex shader */
+ TEXTURE_VERTEX_SHADER,
+ /* fragment shader */
+ NV21_SHADER_PROLOGUE
+ BT709_SHADER_CONSTANTS
+ NV21_SHADER_BODY
+ },
+};
+
+static SDL_bool
+CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char *defines, const char *source)
+{
+ GLint status;
+ const char *sources[2];
+
+ sources[0] = defines;
+ sources[1] = source;
+
+ ctx->glShaderSourceARB(shader, SDL_arraysize(sources), sources, NULL);
+ ctx->glCompileShaderARB(shader);
+ ctx->glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
+ if (status == 0) {
+ GLint length;
+ char *info;
+
+ ctx->glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
+ info = SDL_stack_alloc(char, length+1);
+ ctx->glGetInfoLogARB(shader, length, NULL, info);
+ SDL_LogError(SDL_LOG_CATEGORY_RENDER,
+ "Failed to compile shader:\n%s%s\n%s", defines, source, info);
+#ifdef DEBUG_SHADERS
+ fprintf(stderr,
+ "Failed to compile shader:\n%s%s\n%s", defines, source, info);
+#endif
+ SDL_stack_free(info);
+
+ return SDL_FALSE;
+ } else {
+ return SDL_TRUE;
+ }
+}
+
+static SDL_bool
+CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data)
+{
+ const int num_tmus_bound = 4;
+ const char *vert_defines = "";
+ const char *frag_defines = "";
+ int i;
+ GLint location;
+
+ if (index == SHADER_NONE) {
+ return SDL_TRUE;
+ }
+
+ ctx->glGetError();
+
+ /* Make sure we use the correct sampler type for our texture type */
+ if (ctx->GL_ARB_texture_rectangle_supported) {
+ frag_defines =
+"#define sampler2D sampler2DRect\n"
+"#define texture2D texture2DRect\n"
+"#define UVCoordScale 0.5\n";
+ } else {
+ frag_defines =
+"#define UVCoordScale 1.0\n";
+ }
+
+ /* Create one program object to rule them all */
+ data->program = ctx->glCreateProgramObjectARB();
+
+ /* Create the vertex shader */
+ data->vert_shader = ctx->glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
+ if (!CompileShader(ctx, data->vert_shader, vert_defines, shader_source[index][0])) {
+ return SDL_FALSE;
+ }
+
+ /* Create the fragment shader */
+ data->frag_shader = ctx->glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
+ if (!CompileShader(ctx, data->frag_shader, frag_defines, shader_source[index][1])) {
+ return SDL_FALSE;
+ }
+
+ /* ... and in the darkness bind them */
+ ctx->glAttachObjectARB(data->program, data->vert_shader);
+ ctx->glAttachObjectARB(data->program, data->frag_shader);
+ ctx->glLinkProgramARB(data->program);
+
+ /* Set up some uniform variables */
+ ctx->glUseProgramObjectARB(data->program);
+ for (i = 0; i < num_tmus_bound; ++i) {
+ char tex_name[10];
+ SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i);
+ location = ctx->glGetUniformLocationARB(data->program, tex_name);
+ if (location >= 0) {
+ ctx->glUniform1iARB(location, i);
+ }
+ }
+ ctx->glUseProgramObjectARB(0);
+
+ return (ctx->glGetError() == GL_NO_ERROR);
+}
+
+static void
+DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data)
+{
+ ctx->glDeleteObjectARB(data->vert_shader);
+ ctx->glDeleteObjectARB(data->frag_shader);
+ ctx->glDeleteObjectARB(data->program);
+}
+
+GL_ShaderContext *
+GL_CreateShaderContext(void)
+{
+ GL_ShaderContext *ctx;
+ SDL_bool shaders_supported;
+ int i;
+
+ ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx));
+ if (!ctx) {
+ return NULL;
+ }
+
+ if (!SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two") &&
+ (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") ||
+ SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle"))) {
+ ctx->GL_ARB_texture_rectangle_supported = SDL_TRUE;
+ }
+
+ /* Check for shader support */
+ shaders_supported = SDL_FALSE;
+ if (SDL_GL_ExtensionSupported("GL_ARB_shader_objects") &&
+ SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") &&
+ SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") &&
+ SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) {
+ ctx->glGetError = (GLenum (*)(void)) SDL_GL_GetProcAddress("glGetError");
+ ctx->glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB");
+ ctx->glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB");
+ ctx->glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB");
+ ctx->glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB");
+ ctx->glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB");
+ ctx->glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB");
+ ctx->glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB");
+ ctx->glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB");
+ ctx->glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB");
+ ctx->glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB");
+ ctx->glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB");
+ ctx->glUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB");
+ ctx->glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB");
+ if (ctx->glGetError &&
+ ctx->glAttachObjectARB &&
+ ctx->glCompileShaderARB &&
+ ctx->glCreateProgramObjectARB &&
+ ctx->glCreateShaderObjectARB &&
+ ctx->glDeleteObjectARB &&
+ ctx->glGetInfoLogARB &&
+ ctx->glGetObjectParameterivARB &&
+ ctx->glGetUniformLocationARB &&
+ ctx->glLinkProgramARB &&
+ ctx->glShaderSourceARB &&
+ ctx->glUniform1iARB &&
+ ctx->glUniform1fARB &&
+ ctx->glUseProgramObjectARB) {
+ shaders_supported = SDL_TRUE;
+ }
+ }
+
+ if (!shaders_supported) {
+ SDL_free(ctx);
+ return NULL;
+ }
+
+ /* Compile all the shaders */
+ for (i = 0; i < NUM_SHADERS; ++i) {
+ if (!CompileShaderProgram(ctx, i, &ctx->shaders[i])) {
+ GL_DestroyShaderContext(ctx);
+ return NULL;
+ }
+ }
+
+ /* We're done! */
+ return ctx;
+}
+
+void
+GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader)
+{
+ ctx->glUseProgramObjectARB(ctx->shaders[shader].program);
+}
+
+void
+GL_DestroyShaderContext(GL_ShaderContext *ctx)
+{
+ int i;
+
+ for (i = 0; i < NUM_SHADERS; ++i) {
+ DestroyShaderProgram(ctx, &ctx->shaders[i]);
+ }
+ SDL_free(ctx);
+}
+
+#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.h b/src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.h
new file mode 100644
index 0000000..9805c59
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengl/SDL_shaders_gl.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* OpenGL shader implementation */
+
+typedef enum {
+ SHADER_NONE,
+ SHADER_SOLID,
+ SHADER_RGB,
+ SHADER_YUV_JPEG,
+ SHADER_YUV_BT601,
+ SHADER_YUV_BT709,
+ SHADER_NV12_JPEG,
+ SHADER_NV12_BT601,
+ SHADER_NV12_BT709,
+ SHADER_NV21_JPEG,
+ SHADER_NV21_BT601,
+ SHADER_NV21_BT709,
+ NUM_SHADERS
+} GL_Shader;
+
+typedef struct GL_ShaderContext GL_ShaderContext;
+
+extern GL_ShaderContext * GL_CreateShaderContext(void);
+extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader);
+extern void GL_DestroyShaderContext(GL_ShaderContext *ctx);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengles/SDL_glesfuncs.h b/src/3rdparty/SDL2/src/render/opengles/SDL_glesfuncs.h
new file mode 100644
index 0000000..e00982b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengles/SDL_glesfuncs.h
@@ -0,0 +1,65 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+SDL_PROC(void, glBindTexture, (GLenum, GLuint))
+SDL_PROC(void, glBlendFunc, (GLenum, GLenum))
+SDL_PROC_OES(void, glBlendEquationOES, (GLenum))
+SDL_PROC_OES(void, glBlendEquationSeparateOES, (GLenum, GLenum))
+SDL_PROC_OES(void, glBlendFuncSeparateOES, (GLenum, GLenum, GLenum, GLenum))
+SDL_PROC(void, glClear, (GLbitfield))
+SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf))
+SDL_PROC(void, glColor4f, (GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *))
+SDL_PROC(void, glDisable, (GLenum))
+SDL_PROC(void, glDisableClientState, (GLenum array))
+SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei))
+SDL_PROC_OES(void, glDrawTexfOES, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glEnable, (GLenum))
+SDL_PROC(void, glEnableClientState, (GLenum))
+SDL_PROC(void, glFinish, (void))
+SDL_PROC_OES(void, glGenFramebuffersOES, (GLsizei, GLuint *))
+SDL_PROC(void, glGenTextures, (GLsizei, GLuint *))
+SDL_PROC(GLenum, glGetError, (void))
+SDL_PROC(void, glGetIntegerv, (GLenum, GLint *))
+SDL_PROC(void, glLoadIdentity, (void))
+SDL_PROC(void, glMatrixMode, (GLenum))
+SDL_PROC(void, glOrthof, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glPixelStorei, (GLenum, GLint))
+SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
+SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glTexCoordPointer, (GLint, GLenum, GLsizei, const GLvoid *))
+SDL_PROC(void, glTexEnvf, (GLenum, GLenum, GLfloat))
+SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))
+SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint))
+SDL_PROC(void, glTexParameteriv, (GLenum, GLenum, const GLint *))
+SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))
+SDL_PROC(void, glVertexPointer, (GLint, GLenum, GLsizei, const GLvoid *))
+SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC_OES(void, glBindFramebufferOES, (GLenum, GLuint))
+SDL_PROC_OES(void, glFramebufferTexture2DOES, (GLenum, GLenum, GLenum, GLuint, GLint))
+SDL_PROC_OES(GLenum, glCheckFramebufferStatusOES, (GLenum))
+SDL_PROC(void, glPushMatrix, (void))
+SDL_PROC(void, glTranslatef, (GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glRotatef, (GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glPopMatrix, (void))
+SDL_PROC_OES(void, glDeleteFramebuffersOES, (GLsizei, const GLuint*))
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengles/SDL_render_gles.c b/src/3rdparty/SDL2/src/render/opengles/SDL_render_gles.c
new file mode 100644
index 0000000..d6bfca5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengles/SDL_render_gles.c
@@ -0,0 +1,1290 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
+
+#include "SDL_hints.h"
+#include "SDL_opengles.h"
+#include "../SDL_sysrender.h"
+
+/* To prevent unnecessary window recreation,
+ * these should match the defaults selected in SDL_GL_ResetAttributes
+ */
+
+#define RENDERER_CONTEXT_MAJOR 1
+#define RENDERER_CONTEXT_MINOR 1
+
+#if defined(SDL_VIDEO_DRIVER_PANDORA)
+
+/* Empty function stub to get OpenGL ES 1.x support without */
+/* OpenGL ES extension GL_OES_draw_texture supported */
+GL_API void GL_APIENTRY
+glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ return;
+}
+
+#endif /* SDL_VIDEO_DRIVER_PANDORA */
+
+/* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
+
+/* Used to re-create the window with OpenGL ES capability */
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
+
+static const float inv255f = 1.0f / 255.0f;
+
+static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void GLES_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static int GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
+static SDL_bool GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
+static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void GLES_UnlockTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int GLES_SetRenderTarget(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int GLES_UpdateViewport(SDL_Renderer * renderer);
+static int GLES_UpdateClipRect(SDL_Renderer * renderer);
+static int GLES_RenderClear(SDL_Renderer * renderer);
+static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int GLES_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int GLES_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect);
+static int GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
+static int GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch);
+static void GLES_RenderPresent(SDL_Renderer * renderer);
+static void GLES_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static void GLES_DestroyRenderer(SDL_Renderer * renderer);
+static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
+static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture);
+
+typedef struct GLES_FBOList GLES_FBOList;
+
+struct GLES_FBOList
+{
+ Uint32 w, h;
+ GLuint FBO;
+ GLES_FBOList *next;
+};
+
+
+SDL_RenderDriver GLES_RenderDriver = {
+ GLES_CreateRenderer,
+ {
+ "opengles",
+ (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
+ 1,
+ {SDL_PIXELFORMAT_ABGR8888},
+ 0,
+ 0}
+};
+
+typedef struct
+{
+ SDL_GLContext context;
+ struct {
+ Uint32 color;
+ SDL_BlendMode blendMode;
+ SDL_bool tex_coords;
+ } current;
+
+#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
+#define SDL_PROC_OES SDL_PROC
+#include "SDL_glesfuncs.h"
+#undef SDL_PROC
+#undef SDL_PROC_OES
+ SDL_bool GL_OES_framebuffer_object_supported;
+ GLES_FBOList *framebuffers;
+ GLuint window_framebuffer;
+
+ SDL_bool GL_OES_blend_func_separate_supported;
+ SDL_bool GL_OES_blend_equation_separate_supported;
+ SDL_bool GL_OES_blend_subtract_supported;
+} GLES_RenderData;
+
+typedef struct
+{
+ GLuint texture;
+ GLenum type;
+ GLfloat texw;
+ GLfloat texh;
+ GLenum format;
+ GLenum formattype;
+ void *pixels;
+ int pitch;
+ GLES_FBOList *fbo;
+} GLES_TextureData;
+
+static int
+GLES_SetError(const char *prefix, GLenum result)
+{
+ const char *error;
+
+ switch (result) {
+ case GL_NO_ERROR:
+ error = "GL_NO_ERROR";
+ break;
+ case GL_INVALID_ENUM:
+ error = "GL_INVALID_ENUM";
+ break;
+ case GL_INVALID_VALUE:
+ error = "GL_INVALID_VALUE";
+ break;
+ case GL_INVALID_OPERATION:
+ error = "GL_INVALID_OPERATION";
+ break;
+ case GL_STACK_OVERFLOW:
+ error = "GL_STACK_OVERFLOW";
+ break;
+ case GL_STACK_UNDERFLOW:
+ error = "GL_STACK_UNDERFLOW";
+ break;
+ case GL_OUT_OF_MEMORY:
+ error = "GL_OUT_OF_MEMORY";
+ break;
+ default:
+ error = "UNKNOWN";
+ break;
+ }
+ return SDL_SetError("%s: %s", prefix, error);
+}
+
+static int GLES_LoadFunctions(GLES_RenderData * data)
+{
+#if SDL_VIDEO_DRIVER_UIKIT
+#define __SDL_NOGETPROCADDR__
+#elif SDL_VIDEO_DRIVER_ANDROID
+#define __SDL_NOGETPROCADDR__
+#elif SDL_VIDEO_DRIVER_PANDORA
+#define __SDL_NOGETPROCADDR__
+#endif
+
+#ifdef __SDL_NOGETPROCADDR__
+#define SDL_PROC(ret,func,params) data->func=func;
+#define SDL_PROC_OES(ret,func,params) data->func=func;
+#else
+#define SDL_PROC(ret,func,params) \
+ do { \
+ data->func = SDL_GL_GetProcAddress(#func); \
+ if ( ! data->func ) { \
+ return SDL_SetError("Couldn't load GLES function %s: %s", #func, SDL_GetError()); \
+ } \
+ } while ( 0 );
+#define SDL_PROC_OES(ret,func,params) \
+ do { \
+ data->func = SDL_GL_GetProcAddress(#func); \
+ } while ( 0 );
+#endif /* __SDL_NOGETPROCADDR__ */
+
+#include "SDL_glesfuncs.h"
+#undef SDL_PROC
+#undef SDL_PROC_OES
+ return 0;
+}
+
+static SDL_GLContext SDL_CurrentContext = NULL;
+
+static GLES_FBOList *
+GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h)
+{
+ GLES_FBOList *result = data->framebuffers;
+ while ((result) && ((result->w != w) || (result->h != h)) ) {
+ result = result->next;
+ }
+ if (result == NULL) {
+ result = SDL_malloc(sizeof(GLES_FBOList));
+ result->w = w;
+ result->h = h;
+ data->glGenFramebuffersOES(1, &result->FBO);
+ result->next = data->framebuffers;
+ data->framebuffers = result;
+ }
+ return result;
+}
+
+
+static int
+GLES_ActivateRenderer(SDL_Renderer * renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ if (SDL_GL_MakeCurrent(renderer->window, data->context) < 0) {
+ return -1;
+ }
+ SDL_CurrentContext = data->context;
+
+ GLES_UpdateViewport(renderer);
+ }
+ return 0;
+}
+
+/* This is called if we need to invalidate all of the SDL OpenGL state */
+static void
+GLES_ResetState(SDL_Renderer *renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ if (SDL_CurrentContext == data->context) {
+ GLES_UpdateViewport(renderer);
+ } else {
+ GLES_ActivateRenderer(renderer);
+ }
+
+ data->current.color = 0xffffffff;
+ data->current.blendMode = SDL_BLENDMODE_INVALID;
+ data->current.tex_coords = SDL_FALSE;
+
+ data->glDisable(GL_DEPTH_TEST);
+ data->glDisable(GL_CULL_FACE);
+
+ data->glMatrixMode(GL_MODELVIEW);
+ data->glLoadIdentity();
+
+ data->glEnableClientState(GL_VERTEX_ARRAY);
+ data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+}
+
+SDL_Renderer *
+GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+
+ SDL_Renderer *renderer;
+ GLES_RenderData *data;
+ GLint value;
+ Uint32 window_flags;
+ int profile_mask = 0, major = 0, minor = 0;
+ SDL_bool changed_window = SDL_FALSE;
+
+ SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask);
+ SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major);
+ SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor);
+
+ window_flags = SDL_GetWindowFlags(window);
+ if (!(window_flags & SDL_WINDOW_OPENGL) ||
+ profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) {
+
+ changed_window = SDL_TRUE;
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);
+
+ if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) {
+ goto error;
+ }
+ }
+
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ goto error;
+ }
+
+ data = (GLES_RenderData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ GLES_DestroyRenderer(renderer);
+ SDL_OutOfMemory();
+ goto error;
+ }
+
+ renderer->WindowEvent = GLES_WindowEvent;
+ renderer->GetOutputSize = GLES_GetOutputSize;
+ renderer->SupportsBlendMode = GLES_SupportsBlendMode;
+ renderer->CreateTexture = GLES_CreateTexture;
+ renderer->UpdateTexture = GLES_UpdateTexture;
+ renderer->LockTexture = GLES_LockTexture;
+ renderer->UnlockTexture = GLES_UnlockTexture;
+ renderer->SetRenderTarget = GLES_SetRenderTarget;
+ renderer->UpdateViewport = GLES_UpdateViewport;
+ renderer->UpdateClipRect = GLES_UpdateClipRect;
+ renderer->RenderClear = GLES_RenderClear;
+ renderer->RenderDrawPoints = GLES_RenderDrawPoints;
+ renderer->RenderDrawLines = GLES_RenderDrawLines;
+ renderer->RenderFillRects = GLES_RenderFillRects;
+ renderer->RenderCopy = GLES_RenderCopy;
+ renderer->RenderCopyEx = GLES_RenderCopyEx;
+ renderer->RenderReadPixels = GLES_RenderReadPixels;
+ renderer->RenderPresent = GLES_RenderPresent;
+ renderer->DestroyTexture = GLES_DestroyTexture;
+ renderer->DestroyRenderer = GLES_DestroyRenderer;
+ renderer->GL_BindTexture = GLES_BindTexture;
+ renderer->GL_UnbindTexture = GLES_UnbindTexture;
+ renderer->info = GLES_RenderDriver.info;
+ renderer->info.flags = SDL_RENDERER_ACCELERATED;
+ renderer->driverdata = data;
+ renderer->window = window;
+
+ data->context = SDL_GL_CreateContext(window);
+ if (!data->context) {
+ GLES_DestroyRenderer(renderer);
+ goto error;
+ }
+ if (SDL_GL_MakeCurrent(window, data->context) < 0) {
+ GLES_DestroyRenderer(renderer);
+ goto error;
+ }
+
+ if (GLES_LoadFunctions(data) < 0) {
+ GLES_DestroyRenderer(renderer);
+ goto error;
+ }
+
+ if (flags & SDL_RENDERER_PRESENTVSYNC) {
+ SDL_GL_SetSwapInterval(1);
+ } else {
+ SDL_GL_SetSwapInterval(0);
+ }
+ if (SDL_GL_GetSwapInterval() > 0) {
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+
+ value = 0;
+ data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
+ renderer->info.max_texture_width = value;
+ value = 0;
+ data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
+ renderer->info.max_texture_height = value;
+
+ /* Android does not report GL_OES_framebuffer_object but the functionality seems to be there anyway */
+ if (SDL_GL_ExtensionSupported("GL_OES_framebuffer_object") || data->glGenFramebuffersOES) {
+ data->GL_OES_framebuffer_object_supported = SDL_TRUE;
+ renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE;
+
+ value = 0;
+ data->glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &value);
+ data->window_framebuffer = (GLuint)value;
+ }
+ data->framebuffers = NULL;
+
+ if (SDL_GL_ExtensionSupported("GL_OES_blend_func_separate")) {
+ data->GL_OES_blend_func_separate_supported = SDL_TRUE;
+ }
+ if (SDL_GL_ExtensionSupported("GL_OES_blend_equation_separate")) {
+ data->GL_OES_blend_equation_separate_supported = SDL_TRUE;
+ }
+ if (SDL_GL_ExtensionSupported("GL_OES_blend_subtract")) {
+ data->GL_OES_blend_subtract_supported = SDL_TRUE;
+ }
+
+ /* Set up parameters for rendering */
+ GLES_ResetState(renderer);
+
+ return renderer;
+
+error:
+ if (changed_window) {
+ /* Uh oh, better try to put it back... */
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile_mask);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor);
+ SDL_RecreateWindow(window, window_flags);
+ }
+ return NULL;
+}
+
+static void
+GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
+ event->event == SDL_WINDOWEVENT_SHOWN ||
+ event->event == SDL_WINDOWEVENT_HIDDEN) {
+ /* Rebind the context to the window area and update matrices */
+ SDL_CurrentContext = NULL;
+ }
+
+ if (event->event == SDL_WINDOWEVENT_MINIMIZED) {
+ /* According to Apple documentation, we need to finish drawing NOW! */
+ data->glFinish();
+ }
+}
+
+static int
+GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
+{
+ SDL_GL_GetDrawableSize(renderer->window, w, h);
+ return 0;
+}
+
+static GLenum GetBlendFunc(SDL_BlendFactor factor)
+{
+ switch (factor) {
+ case SDL_BLENDFACTOR_ZERO:
+ return GL_ZERO;
+ case SDL_BLENDFACTOR_ONE:
+ return GL_ONE;
+ case SDL_BLENDFACTOR_SRC_COLOR:
+ return GL_SRC_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
+ return GL_ONE_MINUS_SRC_COLOR;
+ case SDL_BLENDFACTOR_SRC_ALPHA:
+ return GL_SRC_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ case SDL_BLENDFACTOR_DST_COLOR:
+ return GL_DST_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
+ return GL_ONE_MINUS_DST_COLOR;
+ case SDL_BLENDFACTOR_DST_ALPHA:
+ return GL_DST_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
+ return GL_ONE_MINUS_DST_ALPHA;
+ default:
+ return GL_INVALID_ENUM;
+ }
+}
+
+static GLenum GetBlendEquation(SDL_BlendOperation operation)
+{
+ switch (operation) {
+ case SDL_BLENDOPERATION_ADD:
+ return GL_FUNC_ADD_OES;
+ case SDL_BLENDOPERATION_SUBTRACT:
+ return GL_FUNC_SUBTRACT_OES;
+ case SDL_BLENDOPERATION_REV_SUBTRACT:
+ return GL_FUNC_REVERSE_SUBTRACT_OES;
+ default:
+ return GL_INVALID_ENUM;
+ }
+}
+
+static SDL_bool
+GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+
+ if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM ||
+ GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM ||
+ GetBlendEquation(colorOperation) == GL_INVALID_ENUM ||
+ GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM ||
+ GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM ||
+ GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) {
+ return SDL_FALSE;
+ }
+ if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->GL_OES_blend_func_separate_supported) {
+ return SDL_FALSE;
+ }
+ if (colorOperation != alphaOperation && !data->GL_OES_blend_equation_separate_supported) {
+ return SDL_FALSE;
+ }
+ if (colorOperation != SDL_BLENDOPERATION_ADD && !data->GL_OES_blend_subtract_supported) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static SDL_INLINE int
+power_of_2(int input)
+{
+ int value = 1;
+
+ while (value < input) {
+ value <<= 1;
+ }
+ return value;
+}
+
+static GLenum
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return GL_NEAREST;
+ } else {
+ return GL_LINEAR;
+ }
+}
+
+static int
+GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *data;
+ GLint internalFormat;
+ GLenum format, type;
+ int texture_w, texture_h;
+ GLenum scaleMode;
+ GLenum result;
+
+ GLES_ActivateRenderer(renderer);
+
+ switch (texture->format) {
+ case SDL_PIXELFORMAT_ABGR8888:
+ internalFormat = GL_RGBA;
+ format = GL_RGBA;
+ type = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ return SDL_SetError("Texture format not supported");
+ }
+
+ data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
+ data->pixels = SDL_calloc(1, texture->h * data->pitch);
+ if (!data->pixels) {
+ SDL_free(data);
+ return SDL_OutOfMemory();
+ }
+ }
+
+
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ if (!renderdata->GL_OES_framebuffer_object_supported) {
+ SDL_free(data);
+ return SDL_SetError("GL_OES_framebuffer_object not supported");
+ }
+ data->fbo = GLES_GetFBO(renderer->driverdata, texture->w, texture->h);
+ } else {
+ data->fbo = NULL;
+ }
+
+
+ renderdata->glGetError();
+ renderdata->glEnable(GL_TEXTURE_2D);
+ renderdata->glGenTextures(1, &data->texture);
+ result = renderdata->glGetError();
+ if (result != GL_NO_ERROR) {
+ SDL_free(data);
+ return GLES_SetError("glGenTextures()", result);
+ }
+
+ data->type = GL_TEXTURE_2D;
+ /* no NPOV textures allowed in OpenGL ES (yet) */
+ texture_w = power_of_2(texture->w);
+ texture_h = power_of_2(texture->h);
+ data->texw = (GLfloat) texture->w / texture_w;
+ data->texh = (GLfloat) texture->h / texture_h;
+
+ data->format = format;
+ data->formattype = type;
+ scaleMode = GetScaleQuality();
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
+ texture_h, 0, format, type, NULL);
+ renderdata->glDisable(GL_TEXTURE_2D);
+
+ result = renderdata->glGetError();
+ if (result != GL_NO_ERROR) {
+ SDL_free(data);
+ return GLES_SetError("glTexImage2D()", result);
+ }
+
+ texture->driverdata = data;
+ return 0;
+}
+
+static int
+GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{
+ GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
+ Uint8 *blob = NULL;
+ Uint8 *src;
+ int srcPitch;
+ int y;
+
+ GLES_ActivateRenderer(renderer);
+
+ /* Bail out if we're supposed to update an empty rectangle */
+ if (rect->w <= 0 || rect->h <= 0) {
+ return 0;
+ }
+
+ /* Reformat the texture data into a tightly packed array */
+ srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format);
+ src = (Uint8 *)pixels;
+ if (pitch != srcPitch) {
+ blob = (Uint8 *)SDL_malloc(srcPitch * rect->h);
+ if (!blob) {
+ return SDL_OutOfMemory();
+ }
+ src = blob;
+ for (y = 0; y < rect->h; ++y) {
+ SDL_memcpy(src, pixels, srcPitch);
+ src += srcPitch;
+ pixels = (Uint8 *)pixels + pitch;
+ }
+ src = blob;
+ }
+
+ /* Create a texture subimage with the supplied data */
+ renderdata->glGetError();
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ renderdata->glTexSubImage2D(data->type,
+ 0,
+ rect->x,
+ rect->y,
+ rect->w,
+ rect->h,
+ data->format,
+ data->formattype,
+ src);
+ renderdata->glDisable(data->type);
+ SDL_free(blob);
+
+ if (renderdata->glGetError() != GL_NO_ERROR) {
+ return SDL_SetError("Failed to update texture");
+ }
+ return 0;
+}
+
+static int
+GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
+
+ *pixels =
+ (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = data->pitch;
+ return 0;
+}
+
+static void
+GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
+ SDL_Rect rect;
+
+ /* We do whole texture updates, at least for now */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = texture->w;
+ rect.h = texture->h;
+ GLES_UpdateTexture(renderer, texture, &rect, data->pixels, data->pitch);
+}
+
+static int
+GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *texturedata = NULL;
+ GLenum status;
+
+ if (!data->GL_OES_framebuffer_object_supported) {
+ return SDL_SetError("Can't enable render target support in this renderer");
+ }
+
+ if (texture == NULL) {
+ data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, data->window_framebuffer);
+ return 0;
+ }
+
+ texturedata = (GLES_TextureData *) texture->driverdata;
+ data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, texturedata->fbo->FBO);
+ /* TODO: check if texture pixel format allows this operation */
+ data->glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, texturedata->type, texturedata->texture, 0);
+ /* Check FBO status */
+ status = data->glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
+ if (status != GL_FRAMEBUFFER_COMPLETE_OES) {
+ return SDL_SetError("glFramebufferTexture2DOES() failed");
+ }
+ return 0;
+}
+
+static int
+GLES_UpdateViewport(SDL_Renderer * renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ /* We'll update the viewport after we rebind the context */
+ return 0;
+ }
+
+ if (renderer->target) {
+ data->glViewport(renderer->viewport.x, renderer->viewport.y,
+ renderer->viewport.w, renderer->viewport.h);
+ } else {
+ int w, h;
+
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
+ renderer->viewport.w, renderer->viewport.h);
+ }
+
+ data->glMatrixMode(GL_PROJECTION);
+ data->glLoadIdentity();
+ if (renderer->viewport.w && renderer->viewport.h) {
+ if (renderer->target) {
+ data->glOrthof((GLfloat) 0,
+ (GLfloat) renderer->viewport.w,
+ (GLfloat) 0,
+ (GLfloat) renderer->viewport.h,
+ 0.0, 1.0);
+ } else {
+ data->glOrthof((GLfloat) 0,
+ (GLfloat) renderer->viewport.w,
+ (GLfloat) renderer->viewport.h,
+ (GLfloat) 0,
+ 0.0, 1.0);
+ }
+ }
+ data->glMatrixMode(GL_MODELVIEW);
+
+ return 0;
+}
+
+static int
+GLES_UpdateClipRect(SDL_Renderer * renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ /* We'll update the clip rect after we rebind the context */
+ return 0;
+ }
+
+ if (renderer->clipping_enabled) {
+ const SDL_Rect *rect = &renderer->clip_rect;
+ data->glEnable(GL_SCISSOR_TEST);
+ if (renderer->target) {
+ data->glScissor(renderer->viewport.x + rect->x, renderer->viewport.y + rect->y, rect->w, rect->h);
+ } else {
+ int w, h;
+
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
+ }
+ } else {
+ data->glDisable(GL_SCISSOR_TEST);
+ }
+ return 0;
+}
+
+static void
+GLES_SetColor(GLES_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ Uint32 color = ((a << 24) | (r << 16) | (g << 8) | b);
+
+ if (color != data->current.color) {
+ data->glColor4f((GLfloat) r * inv255f,
+ (GLfloat) g * inv255f,
+ (GLfloat) b * inv255f,
+ (GLfloat) a * inv255f);
+ data->current.color = color;
+ }
+}
+
+static void
+GLES_SetBlendMode(GLES_RenderData * data, SDL_BlendMode blendMode)
+{
+ if (blendMode != data->current.blendMode) {
+ if (blendMode == SDL_BLENDMODE_NONE) {
+ data->glDisable(GL_BLEND);
+ } else {
+ data->glEnable(GL_BLEND);
+ if (data->GL_OES_blend_func_separate_supported) {
+ data->glBlendFuncSeparateOES(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode)));
+ } else {
+ data->glBlendFunc(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)));
+ }
+ if (data->GL_OES_blend_equation_separate_supported) {
+ data->glBlendEquationSeparateOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)),
+ GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode)));
+ } else if (data->GL_OES_blend_subtract_supported) {
+ data->glBlendEquationOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)));
+ }
+ }
+ data->current.blendMode = blendMode;
+ }
+}
+
+static void
+GLES_SetTexCoords(GLES_RenderData * data, SDL_bool enabled)
+{
+ if (enabled != data->current.tex_coords) {
+ if (enabled) {
+ data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ } else {
+ data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+ data->current.tex_coords = enabled;
+ }
+}
+
+static void
+GLES_SetDrawingState(SDL_Renderer * renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ GLES_ActivateRenderer(renderer);
+
+ GLES_SetColor(data, (GLfloat) renderer->r,
+ (GLfloat) renderer->g,
+ (GLfloat) renderer->b,
+ (GLfloat) renderer->a);
+
+ GLES_SetBlendMode(data, renderer->blendMode);
+
+ GLES_SetTexCoords(data, SDL_FALSE);
+}
+
+static int
+GLES_RenderClear(SDL_Renderer * renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ GLES_ActivateRenderer(renderer);
+
+ data->glClearColor((GLfloat) renderer->r * inv255f,
+ (GLfloat) renderer->g * inv255f,
+ (GLfloat) renderer->b * inv255f,
+ (GLfloat) renderer->a * inv255f);
+
+ if (renderer->clipping_enabled) {
+ data->glDisable(GL_SCISSOR_TEST);
+ }
+
+ data->glClear(GL_COLOR_BUFFER_BIT);
+
+ if (renderer->clipping_enabled) {
+ data->glEnable(GL_SCISSOR_TEST);
+ }
+
+ return 0;
+}
+
+static int
+GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLfloat *vertices;
+ int idx;
+
+ GLES_SetDrawingState(renderer);
+
+ /* Emit the specified vertices as points */
+ vertices = SDL_stack_alloc(GLfloat, count * 2);
+ for (idx = 0; idx < count; ++idx) {
+ GLfloat x = points[idx].x + 0.5f;
+ GLfloat y = points[idx].y + 0.5f;
+
+ vertices[idx * 2] = x;
+ vertices[(idx * 2) + 1] = y;
+ }
+
+ data->glVertexPointer(2, GL_FLOAT, 0, vertices);
+ data->glDrawArrays(GL_POINTS, 0, count);
+ SDL_stack_free(vertices);
+ return 0;
+}
+
+static int
+GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLfloat *vertices;
+ int idx;
+
+ GLES_SetDrawingState(renderer);
+
+ /* Emit a line strip including the specified vertices */
+ vertices = SDL_stack_alloc(GLfloat, count * 2);
+ for (idx = 0; idx < count; ++idx) {
+ GLfloat x = points[idx].x + 0.5f;
+ GLfloat y = points[idx].y + 0.5f;
+
+ vertices[idx * 2] = x;
+ vertices[(idx * 2) + 1] = y;
+ }
+
+ data->glVertexPointer(2, GL_FLOAT, 0, vertices);
+ if (count > 2 &&
+ points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
+ /* GL_LINE_LOOP takes care of the final segment */
+ --count;
+ data->glDrawArrays(GL_LINE_LOOP, 0, count);
+ } else {
+ data->glDrawArrays(GL_LINE_STRIP, 0, count);
+ /* We need to close the endpoint of the line */
+ data->glDrawArrays(GL_POINTS, count-1, 1);
+ }
+ SDL_stack_free(vertices);
+
+ return 0;
+}
+
+static int
+GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects,
+ int count)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ int i;
+
+ GLES_SetDrawingState(renderer);
+
+ for (i = 0; i < count; ++i) {
+ const SDL_FRect *rect = &rects[i];
+ GLfloat minx = rect->x;
+ GLfloat maxx = rect->x + rect->w;
+ GLfloat miny = rect->y;
+ GLfloat maxy = rect->y + rect->h;
+ GLfloat vertices[8];
+ vertices[0] = minx;
+ vertices[1] = miny;
+ vertices[2] = maxx;
+ vertices[3] = miny;
+ vertices[4] = minx;
+ vertices[5] = maxy;
+ vertices[6] = maxx;
+ vertices[7] = maxy;
+
+ data->glVertexPointer(2, GL_FLOAT, 0, vertices);
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ }
+
+ return 0;
+}
+
+static int
+GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
+ GLfloat minx, miny, maxx, maxy;
+ GLfloat minu, maxu, minv, maxv;
+ GLfloat vertices[8];
+ GLfloat texCoords[8];
+
+ GLES_ActivateRenderer(renderer);
+
+ data->glEnable(GL_TEXTURE_2D);
+
+ data->glBindTexture(texturedata->type, texturedata->texture);
+
+ if (texture->modMode) {
+ GLES_SetColor(data, texture->r, texture->g, texture->b, texture->a);
+ } else {
+ GLES_SetColor(data, 255, 255, 255, 255);
+ }
+
+ GLES_SetBlendMode(data, texture->blendMode);
+
+ GLES_SetTexCoords(data, SDL_TRUE);
+
+ minx = dstrect->x;
+ miny = dstrect->y;
+ maxx = dstrect->x + dstrect->w;
+ maxy = dstrect->y + dstrect->h;
+
+ minu = (GLfloat) srcrect->x / texture->w;
+ minu *= texturedata->texw;
+ maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
+ maxu *= texturedata->texw;
+ minv = (GLfloat) srcrect->y / texture->h;
+ minv *= texturedata->texh;
+ maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
+ maxv *= texturedata->texh;
+
+ vertices[0] = minx;
+ vertices[1] = miny;
+ vertices[2] = maxx;
+ vertices[3] = miny;
+ vertices[4] = minx;
+ vertices[5] = maxy;
+ vertices[6] = maxx;
+ vertices[7] = maxy;
+
+ texCoords[0] = minu;
+ texCoords[1] = minv;
+ texCoords[2] = maxu;
+ texCoords[3] = minv;
+ texCoords[4] = minu;
+ texCoords[5] = maxv;
+ texCoords[6] = maxu;
+ texCoords[7] = maxv;
+
+ data->glVertexPointer(2, GL_FLOAT, 0, vertices);
+ data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ data->glDisable(GL_TEXTURE_2D);
+
+ return 0;
+}
+
+static int
+GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
+{
+
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
+ GLfloat minx, miny, maxx, maxy;
+ GLfloat minu, maxu, minv, maxv;
+ GLfloat centerx, centery;
+ GLfloat vertices[8];
+ GLfloat texCoords[8];
+
+
+ GLES_ActivateRenderer(renderer);
+
+ data->glEnable(GL_TEXTURE_2D);
+
+ data->glBindTexture(texturedata->type, texturedata->texture);
+
+ if (texture->modMode) {
+ GLES_SetColor(data, texture->r, texture->g, texture->b, texture->a);
+ } else {
+ GLES_SetColor(data, 255, 255, 255, 255);
+ }
+
+ GLES_SetBlendMode(data, texture->blendMode);
+
+ GLES_SetTexCoords(data, SDL_TRUE);
+
+ centerx = center->x;
+ centery = center->y;
+
+ /* Rotate and translate */
+ data->glPushMatrix();
+ data->glTranslatef(dstrect->x + centerx, dstrect->y + centery, 0.0f);
+ data->glRotatef((GLfloat)angle, 0.0f, 0.0f, 1.0f);
+
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ minx = dstrect->w - centerx;
+ maxx = -centerx;
+ } else {
+ minx = -centerx;
+ maxx = dstrect->w - centerx;
+ }
+
+ if (flip & SDL_FLIP_VERTICAL) {
+ miny = dstrect->h - centery;
+ maxy = -centery;
+ } else {
+ miny = -centery;
+ maxy = dstrect->h - centery;
+ }
+
+ minu = (GLfloat) srcrect->x / texture->w;
+ minu *= texturedata->texw;
+ maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
+ maxu *= texturedata->texw;
+ minv = (GLfloat) srcrect->y / texture->h;
+ minv *= texturedata->texh;
+ maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
+ maxv *= texturedata->texh;
+
+ vertices[0] = minx;
+ vertices[1] = miny;
+ vertices[2] = maxx;
+ vertices[3] = miny;
+ vertices[4] = minx;
+ vertices[5] = maxy;
+ vertices[6] = maxx;
+ vertices[7] = maxy;
+
+ texCoords[0] = minu;
+ texCoords[1] = minv;
+ texCoords[2] = maxu;
+ texCoords[3] = minv;
+ texCoords[4] = minu;
+ texCoords[5] = maxv;
+ texCoords[6] = maxu;
+ texCoords[7] = maxv;
+ data->glVertexPointer(2, GL_FLOAT, 0, vertices);
+ data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ data->glPopMatrix();
+ data->glDisable(GL_TEXTURE_2D);
+
+ return 0;
+}
+
+static int
+GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
+ void *temp_pixels;
+ int temp_pitch;
+ Uint8 *src, *dst, *tmp;
+ int w, h, length, rows;
+ int status;
+
+ GLES_ActivateRenderer(renderer);
+
+ temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
+ temp_pixels = SDL_malloc(rect->h * temp_pitch);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_GetRendererOutputSize(renderer, &w, &h);
+
+ data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
+
+ data->glReadPixels(rect->x, renderer->target ? rect->y : (h-rect->y)-rect->h,
+ rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels);
+
+ /* Flip the rows to be top-down if necessary */
+ if (!renderer->target) {
+ length = rect->w * SDL_BYTESPERPIXEL(temp_format);
+ src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch;
+ dst = (Uint8*)temp_pixels;
+ tmp = SDL_stack_alloc(Uint8, length);
+ rows = rect->h / 2;
+ while (rows--) {
+ SDL_memcpy(tmp, dst, length);
+ SDL_memcpy(dst, src, length);
+ SDL_memcpy(src, tmp, length);
+ dst += temp_pitch;
+ src -= temp_pitch;
+ }
+ SDL_stack_free(tmp);
+ }
+
+ status = SDL_ConvertPixels(rect->w, rect->h,
+ temp_format, temp_pixels, temp_pitch,
+ pixel_format, pixels, pitch);
+ SDL_free(temp_pixels);
+
+ return status;
+}
+
+static void
+GLES_RenderPresent(SDL_Renderer * renderer)
+{
+ GLES_ActivateRenderer(renderer);
+
+ SDL_GL_SwapWindow(renderer->window);
+}
+
+static void
+GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
+
+ GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
+
+ GLES_ActivateRenderer(renderer);
+
+ if (!data) {
+ return;
+ }
+ if (data->texture) {
+ renderdata->glDeleteTextures(1, &data->texture);
+ }
+ SDL_free(data->pixels);
+ SDL_free(data);
+ texture->driverdata = NULL;
+}
+
+static void
+GLES_DestroyRenderer(SDL_Renderer * renderer)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ if (data) {
+ if (data->context) {
+ while (data->framebuffers) {
+ GLES_FBOList *nextnode = data->framebuffers->next;
+ data->glDeleteFramebuffersOES(1, &data->framebuffers->FBO);
+ SDL_free(data->framebuffers);
+ data->framebuffers = nextnode;
+ }
+ SDL_GL_DeleteContext(data->context);
+ }
+ SDL_free(data);
+ }
+ SDL_free(renderer);
+}
+
+static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
+ GLES_ActivateRenderer(renderer);
+
+ data->glEnable(GL_TEXTURE_2D);
+ data->glBindTexture(texturedata->type, texturedata->texture);
+
+ if (texw) {
+ *texw = (float)texturedata->texw;
+ }
+ if (texh) {
+ *texh = (float)texturedata->texh;
+ }
+
+ return 0;
+}
+
+static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
+{
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+ GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
+ GLES_ActivateRenderer(renderer);
+ data->glDisable(texturedata->type);
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengles2/SDL_gles2funcs.h b/src/3rdparty/SDL2/src/render/opengles2/SDL_gles2funcs.h
new file mode 100644
index 0000000..b6a1436
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengles2/SDL_gles2funcs.h
@@ -0,0 +1,80 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+SDL_PROC(void, glActiveTexture, (GLenum))
+SDL_PROC(void, glAttachShader, (GLuint, GLuint))
+SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *))
+SDL_PROC(void, glBindTexture, (GLenum, GLuint))
+SDL_PROC(void, glBlendEquationSeparate, (GLenum, GLenum))
+SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum))
+SDL_PROC(void, glClear, (GLbitfield))
+SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf))
+SDL_PROC(void, glCompileShader, (GLuint))
+SDL_PROC(GLuint, glCreateProgram, (void))
+SDL_PROC(GLuint, glCreateShader, (GLenum))
+SDL_PROC(void, glDeleteProgram, (GLuint))
+SDL_PROC(void, glDeleteShader, (GLuint))
+SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *))
+SDL_PROC(void, glDisable, (GLenum))
+SDL_PROC(void, glDisableVertexAttribArray, (GLuint))
+SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei))
+SDL_PROC(void, glEnable, (GLenum))
+SDL_PROC(void, glEnableVertexAttribArray, (GLuint))
+SDL_PROC(void, glFinish, (void))
+SDL_PROC(void, glGenFramebuffers, (GLsizei, GLuint *))
+SDL_PROC(void, glGenTextures, (GLsizei, GLuint *))
+SDL_PROC(void, glGetBooleanv, (GLenum, GLboolean *))
+SDL_PROC(const GLubyte *, glGetString, (GLenum))
+SDL_PROC(GLenum, glGetError, (void))
+SDL_PROC(void, glGetIntegerv, (GLenum, GLint *))
+SDL_PROC(void, glGetProgramiv, (GLuint, GLenum, GLint *))
+SDL_PROC(void, glGetShaderInfoLog, (GLuint, GLsizei, GLsizei *, char *))
+SDL_PROC(void, glGetShaderiv, (GLuint, GLenum, GLint *))
+SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *))
+SDL_PROC(void, glLinkProgram, (GLuint))
+SDL_PROC(void, glPixelStorei, (GLenum, GLint))
+SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
+SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
+#if __NACL__ || __ANDROID__
+SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *))
+#else
+SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *))
+#endif
+SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
+SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint))
+SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))
+SDL_PROC(void, glUniform1i, (GLint, GLint))
+SDL_PROC(void, glUniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glUniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *))
+SDL_PROC(void, glUseProgram, (GLuint))
+SDL_PROC(void, glVertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const void *))
+SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint))
+SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint))
+SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum))
+SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *))
+SDL_PROC(GLint, glGetAttribLocation, (GLuint, const GLchar *))
+SDL_PROC(void, glGetProgramInfoLog, (GLuint, GLsizei, GLsizei*, GLchar*))
+SDL_PROC(void, glGenBuffers, (GLsizei, GLuint *))
+SDL_PROC(void, glBindBuffer, (GLenum, GLuint))
+SDL_PROC(void, glBufferData, (GLenum, GLsizeiptr, const GLvoid *, GLenum))
+SDL_PROC(void, glBufferSubData, (GLenum, GLintptr, GLsizeiptr, const GLvoid *))
diff --git a/src/3rdparty/SDL2/src/render/opengles2/SDL_render_gles2.c b/src/3rdparty/SDL2/src/render/opengles2/SDL_render_gles2.c
new file mode 100644
index 0000000..0cd388c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengles2/SDL_render_gles2.c
@@ -0,0 +1,2258 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
+
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_opengles2.h"
+#include "../SDL_sysrender.h"
+#include "../../video/SDL_blit.h"
+#include "SDL_shaders_gles2.h"
+
+/* !!! FIXME: Emscripten makes these into WebGL calls, and WebGL doesn't offer
+ !!! FIXME: client-side arrays (without an Emscripten compatibility hack,
+ !!! FIXME: at least), but the current VBO code here is dramatically
+ !!! FIXME: slower on actual iOS devices, even though the iOS Simulator
+ !!! FIXME: is okay. Some time after 2.0.4 ships, we should revisit this,
+ !!! FIXME: fix the performance bottleneck, and make everything use VBOs.
+*/
+#ifdef __EMSCRIPTEN__
+#define SDL_GLES2_USE_VBOS 1
+#else
+#define SDL_GLES2_USE_VBOS 0
+#endif
+
+/* To prevent unnecessary window recreation,
+ * these should match the defaults selected in SDL_GL_ResetAttributes
+ */
+#define RENDERER_CONTEXT_MAJOR 2
+#define RENDERER_CONTEXT_MINOR 0
+
+/* Used to re-create the window with OpenGL ES capability */
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
+
+/*************************************************************************************************
+ * Bootstrap data *
+ *************************************************************************************************/
+
+static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags);
+
+SDL_RenderDriver GLES2_RenderDriver = {
+ GLES2_CreateRenderer,
+ {
+ "opengles2",
+ (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
+ 4,
+ {
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_ABGR8888,
+ SDL_PIXELFORMAT_RGB888,
+ SDL_PIXELFORMAT_BGR888
+ },
+ 0,
+ 0
+ }
+};
+
+/*************************************************************************************************
+ * Context structures *
+ *************************************************************************************************/
+
+typedef struct GLES2_FBOList GLES2_FBOList;
+
+struct GLES2_FBOList
+{
+ Uint32 w, h;
+ GLuint FBO;
+ GLES2_FBOList *next;
+};
+
+typedef struct GLES2_TextureData
+{
+ GLenum texture;
+ GLenum texture_type;
+ GLenum pixel_format;
+ GLenum pixel_type;
+ void *pixel_data;
+ int pitch;
+ /* YUV texture support */
+ SDL_bool yuv;
+ SDL_bool nv12;
+ GLenum texture_v;
+ GLenum texture_u;
+ GLES2_FBOList *fbo;
+} GLES2_TextureData;
+
+typedef struct GLES2_ShaderCacheEntry
+{
+ GLuint id;
+ GLES2_ShaderType type;
+ const GLES2_ShaderInstance *instance;
+ int references;
+ Uint8 modulation_r, modulation_g, modulation_b, modulation_a;
+ struct GLES2_ShaderCacheEntry *prev;
+ struct GLES2_ShaderCacheEntry *next;
+} GLES2_ShaderCacheEntry;
+
+typedef struct GLES2_ShaderCache
+{
+ int count;
+ GLES2_ShaderCacheEntry *head;
+} GLES2_ShaderCache;
+
+typedef struct GLES2_ProgramCacheEntry
+{
+ GLuint id;
+ GLES2_ShaderCacheEntry *vertex_shader;
+ GLES2_ShaderCacheEntry *fragment_shader;
+ GLuint uniform_locations[16];
+ Uint8 color_r, color_g, color_b, color_a;
+ Uint8 modulation_r, modulation_g, modulation_b, modulation_a;
+ GLfloat projection[4][4];
+ struct GLES2_ProgramCacheEntry *prev;
+ struct GLES2_ProgramCacheEntry *next;
+} GLES2_ProgramCacheEntry;
+
+typedef struct GLES2_ProgramCache
+{
+ int count;
+ GLES2_ProgramCacheEntry *head;
+ GLES2_ProgramCacheEntry *tail;
+} GLES2_ProgramCache;
+
+typedef enum
+{
+ GLES2_ATTRIBUTE_POSITION = 0,
+ GLES2_ATTRIBUTE_TEXCOORD = 1,
+ GLES2_ATTRIBUTE_ANGLE = 2,
+ GLES2_ATTRIBUTE_CENTER = 3,
+} GLES2_Attribute;
+
+typedef enum
+{
+ GLES2_UNIFORM_PROJECTION,
+ GLES2_UNIFORM_TEXTURE,
+ GLES2_UNIFORM_MODULATION,
+ GLES2_UNIFORM_COLOR,
+ GLES2_UNIFORM_TEXTURE_U,
+ GLES2_UNIFORM_TEXTURE_V
+} GLES2_Uniform;
+
+typedef enum
+{
+ GLES2_IMAGESOURCE_SOLID,
+ GLES2_IMAGESOURCE_TEXTURE_ABGR,
+ GLES2_IMAGESOURCE_TEXTURE_ARGB,
+ GLES2_IMAGESOURCE_TEXTURE_RGB,
+ GLES2_IMAGESOURCE_TEXTURE_BGR,
+ GLES2_IMAGESOURCE_TEXTURE_YUV,
+ GLES2_IMAGESOURCE_TEXTURE_NV12,
+ GLES2_IMAGESOURCE_TEXTURE_NV21,
+ GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES
+} GLES2_ImageSource;
+
+typedef struct GLES2_DriverContext
+{
+ SDL_GLContext *context;
+
+ SDL_bool debug_enabled;
+
+ struct {
+ SDL_BlendMode blendMode;
+ SDL_bool tex_coords;
+ } current;
+
+#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
+#include "SDL_gles2funcs.h"
+#undef SDL_PROC
+ GLES2_FBOList *framebuffers;
+ GLuint window_framebuffer;
+
+ int shader_format_count;
+ GLenum *shader_formats;
+ GLES2_ShaderCache shader_cache;
+ GLES2_ProgramCache program_cache;
+ GLES2_ProgramCacheEntry *current_program;
+ Uint8 clear_r, clear_g, clear_b, clear_a;
+
+#if SDL_GLES2_USE_VBOS
+ GLuint vertex_buffers[4];
+ GLsizeiptr vertex_buffer_size[4];
+#endif
+} GLES2_DriverContext;
+
+#define GLES2_MAX_CACHED_PROGRAMS 8
+
+
+SDL_FORCE_INLINE const char*
+GL_TranslateError (GLenum error)
+{
+#define GL_ERROR_TRANSLATE(e) case e: return #e;
+ switch (error) {
+ GL_ERROR_TRANSLATE(GL_INVALID_ENUM)
+ GL_ERROR_TRANSLATE(GL_INVALID_VALUE)
+ GL_ERROR_TRANSLATE(GL_INVALID_OPERATION)
+ GL_ERROR_TRANSLATE(GL_OUT_OF_MEMORY)
+ GL_ERROR_TRANSLATE(GL_NO_ERROR)
+ default:
+ return "UNKNOWN";
+}
+#undef GL_ERROR_TRANSLATE
+}
+
+SDL_FORCE_INLINE void
+GL_ClearErrors(SDL_Renderer *renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata;
+
+ if (!data->debug_enabled) {
+ return;
+ }
+ while (data->glGetError() != GL_NO_ERROR) {
+ continue;
+ }
+}
+
+SDL_FORCE_INLINE int
+GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata;
+ int ret = 0;
+
+ if (!data->debug_enabled) {
+ return 0;
+ }
+ /* check gl errors (can return multiple errors) */
+ for (;;) {
+ GLenum error = data->glGetError();
+ if (error != GL_NO_ERROR) {
+ if (prefix == NULL || prefix[0] == '\0') {
+ prefix = "generic";
+ }
+ SDL_SetError("%s: %s (%d): %s %s (0x%X)", prefix, file, line, function, GL_TranslateError(error), error);
+ ret = -1;
+ } else {
+ break;
+ }
+ }
+ return ret;
+}
+
+#if 0
+#define GL_CheckError(prefix, renderer)
+#else
+#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION)
+#endif
+
+
+/*************************************************************************************************
+ * Renderer state APIs *
+ *************************************************************************************************/
+
+static int GLES2_ActivateRenderer(SDL_Renderer *renderer);
+static void GLES2_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static int GLES2_UpdateViewport(SDL_Renderer * renderer);
+static void GLES2_DestroyRenderer(SDL_Renderer *renderer);
+static int GLES2_SetOrthographicProjection(SDL_Renderer *renderer);
+
+
+static SDL_GLContext SDL_CurrentContext = NULL;
+
+static int GLES2_LoadFunctions(GLES2_DriverContext * data)
+{
+#if SDL_VIDEO_DRIVER_UIKIT
+#define __SDL_NOGETPROCADDR__
+#elif SDL_VIDEO_DRIVER_ANDROID
+#define __SDL_NOGETPROCADDR__
+#elif SDL_VIDEO_DRIVER_PANDORA
+#define __SDL_NOGETPROCADDR__
+#endif
+
+#if defined __SDL_NOGETPROCADDR__
+#define SDL_PROC(ret,func,params) data->func=func;
+#else
+#define SDL_PROC(ret,func,params) \
+ do { \
+ data->func = SDL_GL_GetProcAddress(#func); \
+ if ( ! data->func ) { \
+ return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
+ } \
+ } while ( 0 );
+#endif /* __SDL_NOGETPROCADDR__ */
+
+#include "SDL_gles2funcs.h"
+#undef SDL_PROC
+ return 0;
+}
+
+static GLES2_FBOList *
+GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h)
+{
+ GLES2_FBOList *result = data->framebuffers;
+ while ((result) && ((result->w != w) || (result->h != h)) ) {
+ result = result->next;
+ }
+ if (result == NULL) {
+ result = SDL_malloc(sizeof(GLES2_FBOList));
+ result->w = w;
+ result->h = h;
+ data->glGenFramebuffers(1, &result->FBO);
+ result->next = data->framebuffers;
+ data->framebuffers = result;
+ }
+ return result;
+}
+
+static int
+GLES2_ActivateRenderer(SDL_Renderer * renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ /* Null out the current program to ensure we set it again */
+ data->current_program = NULL;
+
+ if (SDL_GL_MakeCurrent(renderer->window, data->context) < 0) {
+ return -1;
+ }
+ SDL_CurrentContext = data->context;
+
+ GLES2_UpdateViewport(renderer);
+ }
+
+ GL_ClearErrors(renderer);
+
+ return 0;
+}
+
+static void
+GLES2_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
+ event->event == SDL_WINDOWEVENT_SHOWN ||
+ event->event == SDL_WINDOWEVENT_HIDDEN) {
+ /* Rebind the context to the window area */
+ SDL_CurrentContext = NULL;
+ }
+
+ if (event->event == SDL_WINDOWEVENT_MINIMIZED) {
+ /* According to Apple documentation, we need to finish drawing NOW! */
+ data->glFinish();
+ }
+}
+
+static int
+GLES2_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
+{
+ SDL_GL_GetDrawableSize(renderer->window, w, h);
+ return 0;
+}
+
+static GLenum GetBlendFunc(SDL_BlendFactor factor)
+{
+ switch (factor) {
+ case SDL_BLENDFACTOR_ZERO:
+ return GL_ZERO;
+ case SDL_BLENDFACTOR_ONE:
+ return GL_ONE;
+ case SDL_BLENDFACTOR_SRC_COLOR:
+ return GL_SRC_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
+ return GL_ONE_MINUS_SRC_COLOR;
+ case SDL_BLENDFACTOR_SRC_ALPHA:
+ return GL_SRC_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ case SDL_BLENDFACTOR_DST_COLOR:
+ return GL_DST_COLOR;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
+ return GL_ONE_MINUS_DST_COLOR;
+ case SDL_BLENDFACTOR_DST_ALPHA:
+ return GL_DST_ALPHA;
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
+ return GL_ONE_MINUS_DST_ALPHA;
+ default:
+ return GL_INVALID_ENUM;
+ }
+}
+
+static GLenum GetBlendEquation(SDL_BlendOperation operation)
+{
+ switch (operation) {
+ case SDL_BLENDOPERATION_ADD:
+ return GL_FUNC_ADD;
+ case SDL_BLENDOPERATION_SUBTRACT:
+ return GL_FUNC_SUBTRACT;
+ case SDL_BLENDOPERATION_REV_SUBTRACT:
+ return GL_FUNC_REVERSE_SUBTRACT;
+ default:
+ return GL_INVALID_ENUM;
+ }
+}
+
+static SDL_bool
+GLES2_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
+{
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
+
+ if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM ||
+ GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM ||
+ GetBlendEquation(colorOperation) == GL_INVALID_ENUM ||
+ GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM ||
+ GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM ||
+ GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static int
+GLES2_UpdateViewport(SDL_Renderer * renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ /* We'll update the viewport after we rebind the context */
+ return 0;
+ }
+
+ if (renderer->target) {
+ data->glViewport(renderer->viewport.x, renderer->viewport.y,
+ renderer->viewport.w, renderer->viewport.h);
+ } else {
+ int w, h;
+
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
+ renderer->viewport.w, renderer->viewport.h);
+ }
+
+ if (data->current_program) {
+ GLES2_SetOrthographicProjection(renderer);
+ }
+ return GL_CheckError("", renderer);
+}
+
+static int
+GLES2_UpdateClipRect(SDL_Renderer * renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ if (SDL_CurrentContext != data->context) {
+ /* We'll update the clip rect after we rebind the context */
+ return 0;
+ }
+
+ if (renderer->clipping_enabled) {
+ const SDL_Rect *rect = &renderer->clip_rect;
+ data->glEnable(GL_SCISSOR_TEST);
+ if (renderer->target) {
+ data->glScissor(renderer->viewport.x + rect->x, renderer->viewport.y + rect->y, rect->w, rect->h);
+ } else {
+ int w, h;
+
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
+ }
+ } else {
+ data->glDisable(GL_SCISSOR_TEST);
+ }
+ return 0;
+}
+
+static void
+GLES2_DestroyRenderer(SDL_Renderer *renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ /* Deallocate everything */
+ if (data) {
+ GLES2_ActivateRenderer(renderer);
+
+ {
+ GLES2_ShaderCacheEntry *entry;
+ GLES2_ShaderCacheEntry *next;
+ entry = data->shader_cache.head;
+ while (entry) {
+ data->glDeleteShader(entry->id);
+ next = entry->next;
+ SDL_free(entry);
+ entry = next;
+ }
+ }
+ {
+ GLES2_ProgramCacheEntry *entry;
+ GLES2_ProgramCacheEntry *next;
+ entry = data->program_cache.head;
+ while (entry) {
+ data->glDeleteProgram(entry->id);
+ next = entry->next;
+ SDL_free(entry);
+ entry = next;
+ }
+ }
+ if (data->context) {
+ while (data->framebuffers) {
+ GLES2_FBOList *nextnode = data->framebuffers->next;
+ data->glDeleteFramebuffers(1, &data->framebuffers->FBO);
+ GL_CheckError("", renderer);
+ SDL_free(data->framebuffers);
+ data->framebuffers = nextnode;
+ }
+ SDL_GL_DeleteContext(data->context);
+ }
+ SDL_free(data->shader_formats);
+ SDL_free(data);
+ }
+ SDL_free(renderer);
+}
+
+/*************************************************************************************************
+ * Texture APIs *
+ *************************************************************************************************/
+
+static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture);
+static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
+ const void *pixels, int pitch);
+static int GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch);
+static int GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
+ void **pixels, int *pitch);
+static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture);
+static int GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture);
+
+static GLenum
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return GL_NEAREST;
+ } else {
+ return GL_LINEAR;
+ }
+}
+
+static int
+GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
+{
+ GLES2_DriverContext *renderdata = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *data;
+ GLenum format;
+ GLenum type;
+ GLenum scaleMode;
+
+ GLES2_ActivateRenderer(renderer);
+
+ /* Determine the corresponding GLES texture format params */
+ switch (texture->format)
+ {
+ case SDL_PIXELFORMAT_ARGB8888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_BGR888:
+ format = GL_RGBA;
+ type = GL_UNSIGNED_BYTE;
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ format = GL_LUMINANCE;
+ type = GL_UNSIGNED_BYTE;
+ break;
+#ifdef GL_TEXTURE_EXTERNAL_OES
+ case SDL_PIXELFORMAT_EXTERNAL_OES:
+ format = GL_NONE;
+ type = GL_NONE;
+ break;
+#endif
+ default:
+ return SDL_SetError("Texture format not supported");
+ }
+
+ if (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES &&
+ texture->access != SDL_TEXTUREACCESS_STATIC) {
+ return SDL_SetError("Unsupported texture access for SDL_PIXELFORMAT_EXTERNAL_OES");
+ }
+
+ /* Allocate a texture struct */
+ data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+ data->texture = 0;
+#ifdef GL_TEXTURE_EXTERNAL_OES
+ data->texture_type = (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES) ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
+#else
+ data->texture_type = GL_TEXTURE_2D;
+#endif
+ data->pixel_format = format;
+ data->pixel_type = type;
+ data->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12));
+ data->nv12 = ((texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21));
+ data->texture_u = 0;
+ data->texture_v = 0;
+ scaleMode = GetScaleQuality();
+
+ /* Allocate a blob for image renderdata */
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ size_t size;
+ data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
+ size = texture->h * data->pitch;
+ if (data->yuv) {
+ /* Need to add size for the U and V planes */
+ size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2);
+ }
+ if (data->nv12) {
+ /* Need to add size for the U/V plane */
+ size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2);
+ }
+ data->pixel_data = SDL_calloc(1, size);
+ if (!data->pixel_data) {
+ SDL_free(data);
+ return SDL_OutOfMemory();
+ }
+ }
+
+ /* Allocate the texture */
+ GL_CheckError("", renderer);
+
+ if (data->yuv) {
+ renderdata->glGenTextures(1, &data->texture_v);
+ if (GL_CheckError("glGenTexures()", renderer) < 0) {
+ return -1;
+ }
+ renderdata->glActiveTexture(GL_TEXTURE2);
+ renderdata->glBindTexture(data->texture_type, data->texture_v);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL);
+
+ renderdata->glGenTextures(1, &data->texture_u);
+ if (GL_CheckError("glGenTexures()", renderer) < 0) {
+ return -1;
+ }
+ renderdata->glActiveTexture(GL_TEXTURE1);
+ renderdata->glBindTexture(data->texture_type, data->texture_u);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL);
+ if (GL_CheckError("glTexImage2D()", renderer) < 0) {
+ return -1;
+ }
+ }
+
+ if (data->nv12) {
+ renderdata->glGenTextures(1, &data->texture_u);
+ if (GL_CheckError("glGenTexures()", renderer) < 0) {
+ return -1;
+ }
+ renderdata->glActiveTexture(GL_TEXTURE1);
+ renderdata->glBindTexture(data->texture_type, data->texture_u);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
+ if (GL_CheckError("glTexImage2D()", renderer) < 0) {
+ return -1;
+ }
+ }
+
+ renderdata->glGenTextures(1, &data->texture);
+ if (GL_CheckError("glGenTexures()", renderer) < 0) {
+ return -1;
+ }
+ texture->driverdata = data;
+ renderdata->glActiveTexture(GL_TEXTURE0);
+ renderdata->glBindTexture(data->texture_type, data->texture);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ if (texture->format != SDL_PIXELFORMAT_EXTERNAL_OES) {
+ renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL);
+ if (GL_CheckError("glTexImage2D()", renderer) < 0) {
+ return -1;
+ }
+ }
+
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+ data->fbo = GLES2_GetFBO(renderer->driverdata, texture->w, texture->h);
+ } else {
+ data->fbo = NULL;
+ }
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GLES2_TexSubImage2D(GLES2_DriverContext *data, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, GLint pitch, GLint bpp)
+{
+ Uint8 *blob = NULL;
+ Uint8 *src;
+ int src_pitch;
+ int y;
+
+ /* Reformat the texture data into a tightly packed array */
+ src_pitch = width * bpp;
+ src = (Uint8 *)pixels;
+ if (pitch != src_pitch) {
+ blob = (Uint8 *)SDL_malloc(src_pitch * height);
+ if (!blob) {
+ return SDL_OutOfMemory();
+ }
+ src = blob;
+ for (y = 0; y < height; ++y)
+ {
+ SDL_memcpy(src, pixels, src_pitch);
+ src += src_pitch;
+ pixels = (Uint8 *)pixels + pitch;
+ }
+ src = blob;
+ }
+
+ data->glTexSubImage2D(target, 0, xoffset, yoffset, width, height, format, type, src);
+ if (blob) {
+ SDL_free(blob);
+ }
+ return 0;
+}
+
+static int
+GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
+ const void *pixels, int pitch)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
+
+ GLES2_ActivateRenderer(renderer);
+
+ /* Bail out if we're supposed to update an empty rectangle */
+ if (rect->w <= 0 || rect->h <= 0) {
+ return 0;
+ }
+
+ /* Create a texture subimage with the supplied data */
+ data->glBindTexture(tdata->texture_type, tdata->texture);
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x,
+ rect->y,
+ rect->w,
+ rect->h,
+ tdata->pixel_format,
+ tdata->pixel_type,
+ pixels, pitch, SDL_BYTESPERPIXEL(texture->format));
+
+ if (tdata->yuv) {
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+ if (texture->format == SDL_PIXELFORMAT_YV12) {
+ data->glBindTexture(tdata->texture_type, tdata->texture_v);
+ } else {
+ data->glBindTexture(tdata->texture_type, tdata->texture_u);
+ }
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x / 2,
+ rect->y / 2,
+ (rect->w + 1) / 2,
+ (rect->h + 1) / 2,
+ tdata->pixel_format,
+ tdata->pixel_type,
+ pixels, (pitch + 1) / 2, 1);
+
+
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2));
+ if (texture->format == SDL_PIXELFORMAT_YV12) {
+ data->glBindTexture(tdata->texture_type, tdata->texture_u);
+ } else {
+ data->glBindTexture(tdata->texture_type, tdata->texture_v);
+ }
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x / 2,
+ rect->y / 2,
+ (rect->w + 1) / 2,
+ (rect->h + 1) / 2,
+ tdata->pixel_format,
+ tdata->pixel_type,
+ pixels, (pitch + 1) / 2, 1);
+ }
+
+ if (tdata->nv12) {
+ /* Skip to the correct offset into the next texture */
+ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
+ data->glBindTexture(tdata->texture_type, tdata->texture_u);
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x / 2,
+ rect->y / 2,
+ (rect->w + 1) / 2,
+ (rect->h + 1) / 2,
+ GL_LUMINANCE_ALPHA,
+ GL_UNSIGNED_BYTE,
+ pixels, 2 * ((pitch + 1) / 2), 2);
+ }
+
+ return GL_CheckError("glTexSubImage2D()", renderer);
+}
+
+static int
+GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const Uint8 *Yplane, int Ypitch,
+ const Uint8 *Uplane, int Upitch,
+ const Uint8 *Vplane, int Vpitch)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
+
+ GLES2_ActivateRenderer(renderer);
+
+ /* Bail out if we're supposed to update an empty rectangle */
+ if (rect->w <= 0 || rect->h <= 0) {
+ return 0;
+ }
+
+ data->glBindTexture(tdata->texture_type, tdata->texture_v);
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x / 2,
+ rect->y / 2,
+ (rect->w + 1) / 2,
+ (rect->h + 1) / 2,
+ tdata->pixel_format,
+ tdata->pixel_type,
+ Vplane, Vpitch, 1);
+
+ data->glBindTexture(tdata->texture_type, tdata->texture_u);
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x / 2,
+ rect->y / 2,
+ (rect->w + 1) / 2,
+ (rect->h + 1) / 2,
+ tdata->pixel_format,
+ tdata->pixel_type,
+ Uplane, Upitch, 1);
+
+ data->glBindTexture(tdata->texture_type, tdata->texture);
+ GLES2_TexSubImage2D(data, tdata->texture_type,
+ rect->x,
+ rect->y,
+ rect->w,
+ rect->h,
+ tdata->pixel_format,
+ tdata->pixel_type,
+ Yplane, Ypitch, 1);
+
+ return GL_CheckError("glTexSubImage2D()", renderer);
+}
+
+static int
+GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
+ void **pixels, int *pitch)
+{
+ GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
+
+ /* Retrieve the buffer/pitch for the specified region */
+ *pixels = (Uint8 *)tdata->pixel_data +
+ (tdata->pitch * rect->y) +
+ (rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = tdata->pitch;
+
+ return 0;
+}
+
+static void
+GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
+{
+ GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
+ SDL_Rect rect;
+
+ /* We do whole texture updates, at least for now */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = texture->w;
+ rect.h = texture->h;
+ GLES2_UpdateTexture(renderer, texture, &rect, tdata->pixel_data, tdata->pitch);
+}
+
+static int
+GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata;
+ GLES2_TextureData *texturedata = NULL;
+ GLenum status;
+
+ if (texture == NULL) {
+ data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer);
+ } else {
+ texturedata = (GLES2_TextureData *) texture->driverdata;
+ data->glBindFramebuffer(GL_FRAMEBUFFER, texturedata->fbo->FBO);
+ /* TODO: check if texture pixel format allows this operation */
+ data->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texturedata->texture_type, texturedata->texture, 0);
+ /* Check FBO status */
+ status = data->glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ return SDL_SetError("glFramebufferTexture2D() failed");
+ }
+ }
+ return 0;
+}
+
+static void
+GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
+
+ GLES2_ActivateRenderer(renderer);
+
+ /* Destroy the texture */
+ if (tdata) {
+ data->glDeleteTextures(1, &tdata->texture);
+ if (tdata->texture_v) {
+ data->glDeleteTextures(1, &tdata->texture_v);
+ }
+ if (tdata->texture_u) {
+ data->glDeleteTextures(1, &tdata->texture_u);
+ }
+ SDL_free(tdata->pixel_data);
+ SDL_free(tdata);
+ texture->driverdata = NULL;
+ }
+}
+
+/*************************************************************************************************
+ * Shader management functions *
+ *************************************************************************************************/
+
+static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type);
+static void GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry);
+static GLES2_ProgramCacheEntry *GLES2_CacheProgram(SDL_Renderer *renderer,
+ GLES2_ShaderCacheEntry *vertex,
+ GLES2_ShaderCacheEntry *fragment);
+static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h);
+
+static GLES2_ProgramCacheEntry *
+GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex,
+ GLES2_ShaderCacheEntry *fragment)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_ProgramCacheEntry *entry;
+ GLES2_ShaderCacheEntry *shaderEntry;
+ GLint linkSuccessful;
+
+ /* Check if we've already cached this program */
+ entry = data->program_cache.head;
+ while (entry) {
+ if (entry->vertex_shader == vertex && entry->fragment_shader == fragment) {
+ break;
+ }
+ entry = entry->next;
+ }
+ if (entry) {
+ if (data->program_cache.head != entry) {
+ if (entry->next) {
+ entry->next->prev = entry->prev;
+ }
+ if (entry->prev) {
+ entry->prev->next = entry->next;
+ }
+ entry->prev = NULL;
+ entry->next = data->program_cache.head;
+ data->program_cache.head->prev = entry;
+ data->program_cache.head = entry;
+ }
+ return entry;
+ }
+
+ /* Create a program cache entry */
+ entry = (GLES2_ProgramCacheEntry *)SDL_calloc(1, sizeof(GLES2_ProgramCacheEntry));
+ if (!entry) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ entry->vertex_shader = vertex;
+ entry->fragment_shader = fragment;
+
+ /* Create the program and link it */
+ entry->id = data->glCreateProgram();
+ data->glAttachShader(entry->id, vertex->id);
+ data->glAttachShader(entry->id, fragment->id);
+ data->glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_POSITION, "a_position");
+ data->glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_TEXCOORD, "a_texCoord");
+ data->glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_ANGLE, "a_angle");
+ data->glBindAttribLocation(entry->id, GLES2_ATTRIBUTE_CENTER, "a_center");
+ data->glLinkProgram(entry->id);
+ data->glGetProgramiv(entry->id, GL_LINK_STATUS, &linkSuccessful);
+ if (!linkSuccessful) {
+ data->glDeleteProgram(entry->id);
+ SDL_free(entry);
+ SDL_SetError("Failed to link shader program");
+ return NULL;
+ }
+
+ /* Predetermine locations of uniform variables */
+ entry->uniform_locations[GLES2_UNIFORM_PROJECTION] =
+ data->glGetUniformLocation(entry->id, "u_projection");
+ entry->uniform_locations[GLES2_UNIFORM_TEXTURE_V] =
+ data->glGetUniformLocation(entry->id, "u_texture_v");
+ entry->uniform_locations[GLES2_UNIFORM_TEXTURE_U] =
+ data->glGetUniformLocation(entry->id, "u_texture_u");
+ entry->uniform_locations[GLES2_UNIFORM_TEXTURE] =
+ data->glGetUniformLocation(entry->id, "u_texture");
+ entry->uniform_locations[GLES2_UNIFORM_MODULATION] =
+ data->glGetUniformLocation(entry->id, "u_modulation");
+ entry->uniform_locations[GLES2_UNIFORM_COLOR] =
+ data->glGetUniformLocation(entry->id, "u_color");
+
+ entry->modulation_r = entry->modulation_g = entry->modulation_b = entry->modulation_a = 255;
+ entry->color_r = entry->color_g = entry->color_b = entry->color_a = 255;
+
+ data->glUseProgram(entry->id);
+ data->glUniform1i(entry->uniform_locations[GLES2_UNIFORM_TEXTURE_V], 2); /* always texture unit 2. */
+ data->glUniform1i(entry->uniform_locations[GLES2_UNIFORM_TEXTURE_U], 1); /* always texture unit 1. */
+ data->glUniform1i(entry->uniform_locations[GLES2_UNIFORM_TEXTURE], 0); /* always texture unit 0. */
+ data->glUniformMatrix4fv(entry->uniform_locations[GLES2_UNIFORM_PROJECTION], 1, GL_FALSE, (GLfloat *)entry->projection);
+ data->glUniform4f(entry->uniform_locations[GLES2_UNIFORM_MODULATION], 1.0f, 1.0f, 1.0f, 1.0f);
+ data->glUniform4f(entry->uniform_locations[GLES2_UNIFORM_COLOR], 1.0f, 1.0f, 1.0f, 1.0f);
+
+ /* Cache the linked program */
+ if (data->program_cache.head) {
+ entry->next = data->program_cache.head;
+ data->program_cache.head->prev = entry;
+ } else {
+ data->program_cache.tail = entry;
+ }
+ data->program_cache.head = entry;
+ ++data->program_cache.count;
+
+ /* Increment the refcount of the shaders we're using */
+ ++vertex->references;
+ ++fragment->references;
+
+ /* Evict the last entry from the cache if we exceed the limit */
+ if (data->program_cache.count > GLES2_MAX_CACHED_PROGRAMS) {
+ shaderEntry = data->program_cache.tail->vertex_shader;
+ if (--shaderEntry->references <= 0) {
+ GLES2_EvictShader(renderer, shaderEntry);
+ }
+ shaderEntry = data->program_cache.tail->fragment_shader;
+ if (--shaderEntry->references <= 0) {
+ GLES2_EvictShader(renderer, shaderEntry);
+ }
+ data->glDeleteProgram(data->program_cache.tail->id);
+ data->program_cache.tail = data->program_cache.tail->prev;
+ SDL_free(data->program_cache.tail->next);
+ data->program_cache.tail->next = NULL;
+ --data->program_cache.count;
+ }
+ return entry;
+}
+
+static GLES2_ShaderCacheEntry *
+GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ const GLES2_Shader *shader;
+ const GLES2_ShaderInstance *instance = NULL;
+ GLES2_ShaderCacheEntry *entry = NULL;
+ GLint compileSuccessful = GL_FALSE;
+ int i, j;
+
+ /* Find the corresponding shader */
+ shader = GLES2_GetShader(type);
+ if (!shader) {
+ SDL_SetError("No shader matching the requested characteristics was found");
+ return NULL;
+ }
+
+ /* Find a matching shader instance that's supported on this hardware */
+ for (i = 0; i < shader->instance_count && !instance; ++i) {
+ for (j = 0; j < data->shader_format_count && !instance; ++j) {
+ if (!shader->instances[i]) {
+ continue;
+ }
+ if (shader->instances[i]->format != data->shader_formats[j]) {
+ continue;
+ }
+ instance = shader->instances[i];
+ }
+ }
+ if (!instance) {
+ SDL_SetError("The specified shader cannot be loaded on the current platform");
+ return NULL;
+ }
+
+ /* Check if we've already cached this shader */
+ entry = data->shader_cache.head;
+ while (entry) {
+ if (entry->instance == instance) {
+ break;
+ }
+ entry = entry->next;
+ }
+ if (entry) {
+ return entry;
+ }
+
+ /* Create a shader cache entry */
+ entry = (GLES2_ShaderCacheEntry *)SDL_calloc(1, sizeof(GLES2_ShaderCacheEntry));
+ if (!entry) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ entry->type = type;
+ entry->instance = instance;
+
+ /* Compile or load the selected shader instance */
+ entry->id = data->glCreateShader(instance->type);
+ if (instance->format == (GLenum)-1) {
+ data->glShaderSource(entry->id, 1, (const char **)(char *)&instance->data, NULL);
+ data->glCompileShader(entry->id);
+ data->glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful);
+ } else {
+ data->glShaderBinary(1, &entry->id, instance->format, instance->data, instance->length);
+ compileSuccessful = GL_TRUE;
+ }
+ if (!compileSuccessful) {
+ char *info = NULL;
+ int length = 0;
+
+ data->glGetShaderiv(entry->id, GL_INFO_LOG_LENGTH, &length);
+ if (length > 0) {
+ info = SDL_stack_alloc(char, length);
+ if (info) {
+ data->glGetShaderInfoLog(entry->id, length, &length, info);
+ }
+ }
+ if (info) {
+ SDL_SetError("Failed to load the shader: %s", info);
+ SDL_stack_free(info);
+ } else {
+ SDL_SetError("Failed to load the shader");
+ }
+ data->glDeleteShader(entry->id);
+ SDL_free(entry);
+ return NULL;
+ }
+
+ /* Link the shader entry in at the front of the cache */
+ if (data->shader_cache.head) {
+ entry->next = data->shader_cache.head;
+ data->shader_cache.head->prev = entry;
+ }
+ data->shader_cache.head = entry;
+ ++data->shader_cache.count;
+ return entry;
+}
+
+static void
+GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ /* Unlink the shader from the cache */
+ if (entry->next) {
+ entry->next->prev = entry->prev;
+ }
+ if (entry->prev) {
+ entry->prev->next = entry->next;
+ }
+ if (data->shader_cache.head == entry) {
+ data->shader_cache.head = entry->next;
+ }
+ --data->shader_cache.count;
+
+ /* Deallocate the shader */
+ data->glDeleteShader(entry->id);
+ SDL_free(entry);
+}
+
+static int
+GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_ShaderCacheEntry *vertex = NULL;
+ GLES2_ShaderCacheEntry *fragment = NULL;
+ GLES2_ShaderType vtype, ftype;
+ GLES2_ProgramCacheEntry *program;
+
+ /* Select an appropriate shader pair for the specified modes */
+ vtype = GLES2_SHADER_VERTEX_DEFAULT;
+ switch (source) {
+ case GLES2_IMAGESOURCE_SOLID:
+ ftype = GLES2_SHADER_FRAGMENT_SOLID_SRC;
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_ABGR:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC;
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_ARGB:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC;
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_RGB:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC;
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_BGR:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC;
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_YUV:
+ switch (SDL_GetYUVConversionModeForResolution(w, h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC;
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC;
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC;
+ break;
+ default:
+ SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h));
+ goto fault;
+ }
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_NV12:
+ switch (SDL_GetYUVConversionModeForResolution(w, h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC;
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC;
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC;
+ break;
+ default:
+ SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h));
+ goto fault;
+ }
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_NV21:
+ switch (SDL_GetYUVConversionModeForResolution(w, h)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC;
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC;
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC;
+ break;
+ default:
+ SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h));
+ goto fault;
+ }
+ break;
+ case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES:
+ ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC;
+ break;
+ default:
+ goto fault;
+ }
+
+ /* Load the requested shaders */
+ vertex = GLES2_CacheShader(renderer, vtype);
+ if (!vertex) {
+ goto fault;
+ }
+ fragment = GLES2_CacheShader(renderer, ftype);
+ if (!fragment) {
+ goto fault;
+ }
+
+ /* Check if we need to change programs at all */
+ if (data->current_program &&
+ data->current_program->vertex_shader == vertex &&
+ data->current_program->fragment_shader == fragment) {
+ return 0;
+ }
+
+ /* Generate a matching program */
+ program = GLES2_CacheProgram(renderer, vertex, fragment);
+ if (!program) {
+ goto fault;
+ }
+
+ /* Select that program in OpenGL */
+ data->glUseProgram(program->id);
+
+ /* Set the current program */
+ data->current_program = program;
+
+ /* Activate an orthographic projection */
+ if (GLES2_SetOrthographicProjection(renderer) < 0) {
+ goto fault;
+ }
+
+ /* Clean up and return */
+ return 0;
+fault:
+ if (vertex && vertex->references <= 0) {
+ GLES2_EvictShader(renderer, vertex);
+ }
+ if (fragment && fragment->references <= 0) {
+ GLES2_EvictShader(renderer, fragment);
+ }
+ data->current_program = NULL;
+ return -1;
+}
+
+static int
+GLES2_SetOrthographicProjection(SDL_Renderer *renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLfloat projection[4][4];
+
+ if (!renderer->viewport.w || !renderer->viewport.h) {
+ return 0;
+ }
+
+ /* Prepare an orthographic projection */
+ projection[0][0] = 2.0f / renderer->viewport.w;
+ projection[0][1] = 0.0f;
+ projection[0][2] = 0.0f;
+ projection[0][3] = 0.0f;
+ projection[1][0] = 0.0f;
+ if (renderer->target) {
+ projection[1][1] = 2.0f / renderer->viewport.h;
+ } else {
+ projection[1][1] = -2.0f / renderer->viewport.h;
+ }
+ projection[1][2] = 0.0f;
+ projection[1][3] = 0.0f;
+ projection[2][0] = 0.0f;
+ projection[2][1] = 0.0f;
+ projection[2][2] = 0.0f;
+ projection[2][3] = 0.0f;
+ projection[3][0] = -1.0f;
+ if (renderer->target) {
+ projection[3][1] = -1.0f;
+ } else {
+ projection[3][1] = 1.0f;
+ }
+ projection[3][2] = 0.0f;
+ projection[3][3] = 1.0f;
+
+ /* Set the projection matrix */
+ if (SDL_memcmp(data->current_program->projection, projection, sizeof (projection)) != 0) {
+ const GLuint locProjection = data->current_program->uniform_locations[GLES2_UNIFORM_PROJECTION];
+ data->glUniformMatrix4fv(locProjection, 1, GL_FALSE, (GLfloat *)projection);
+ SDL_memcpy(data->current_program->projection, projection, sizeof (projection));
+ }
+
+ return 0;
+}
+
+/*************************************************************************************************
+ * Rendering functions *
+ *************************************************************************************************/
+
+static const float inv255f = 1.0f / 255.0f;
+
+static int GLES2_RenderClear(SDL_Renderer *renderer);
+static int GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
+static int GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
+static int GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
+static int GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
+ const SDL_FRect *dstrect);
+static int GLES2_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
+static int GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch);
+static void GLES2_RenderPresent(SDL_Renderer *renderer);
+
+static SDL_bool
+CompareColors(Uint8 r1, Uint8 g1, Uint8 b1, Uint8 a1,
+ Uint8 r2, Uint8 g2, Uint8 b2, Uint8 a2)
+{
+ Uint32 Pixel1, Pixel2;
+ RGBA8888_FROM_RGBA(Pixel1, r1, g1, b1, a1);
+ RGBA8888_FROM_RGBA(Pixel2, r2, g2, b2, a2);
+ return (Pixel1 == Pixel2);
+}
+
+static int
+GLES2_RenderClear(SDL_Renderer * renderer)
+{
+ Uint8 r, g, b, a;
+
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+ GLES2_ActivateRenderer(renderer);
+
+ if (!CompareColors(data->clear_r, data->clear_g, data->clear_b, data->clear_a,
+ renderer->r, renderer->g, renderer->b, renderer->a)) {
+
+ /* Select the color to clear with */
+ g = renderer->g;
+ a = renderer->a;
+
+ if (renderer->target &&
+ (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 ||
+ renderer->target->format == SDL_PIXELFORMAT_RGB888)) {
+ r = renderer->b;
+ b = renderer->r;
+ } else {
+ r = renderer->r;
+ b = renderer->b;
+ }
+
+ data->glClearColor((GLfloat) r * inv255f,
+ (GLfloat) g * inv255f,
+ (GLfloat) b * inv255f,
+ (GLfloat) a * inv255f);
+ data->clear_r = renderer->r;
+ data->clear_g = renderer->g;
+ data->clear_b = renderer->b;
+ data->clear_a = renderer->a;
+ }
+
+ if (renderer->clipping_enabled) {
+ data->glDisable(GL_SCISSOR_TEST);
+ }
+
+ data->glClear(GL_COLOR_BUFFER_BIT);
+
+ if (renderer->clipping_enabled) {
+ data->glEnable(GL_SCISSOR_TEST);
+ }
+
+ return 0;
+}
+
+static void
+GLES2_SetBlendMode(GLES2_DriverContext *data, SDL_BlendMode blendMode)
+{
+ if (blendMode != data->current.blendMode) {
+ if (blendMode == SDL_BLENDMODE_NONE) {
+ data->glDisable(GL_BLEND);
+ } else {
+ data->glEnable(GL_BLEND);
+ data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)),
+ GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode)));
+ data->glBlendEquationSeparate(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)),
+ GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode)));
+ }
+ data->current.blendMode = blendMode;
+ }
+}
+
+static void
+GLES2_SetTexCoords(GLES2_DriverContext * data, SDL_bool enabled)
+{
+ if (enabled != data->current.tex_coords) {
+ if (enabled) {
+ data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD);
+ } else {
+ data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD);
+ }
+ data->current.tex_coords = enabled;
+ }
+}
+
+static int
+GLES2_SetDrawingState(SDL_Renderer * renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_ProgramCacheEntry *program;
+ Uint8 r, g, b, a;
+
+ GLES2_ActivateRenderer(renderer);
+
+ GLES2_SetBlendMode(data, renderer->blendMode);
+
+ GLES2_SetTexCoords(data, SDL_FALSE);
+
+ /* Activate an appropriate shader and set the projection matrix */
+ if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, 0, 0) < 0) {
+ return -1;
+ }
+
+ /* Select the color to draw with */
+ g = renderer->g;
+ a = renderer->a;
+
+ if (renderer->target &&
+ (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 ||
+ renderer->target->format == SDL_PIXELFORMAT_RGB888)) {
+ r = renderer->b;
+ b = renderer->r;
+ } else {
+ r = renderer->r;
+ b = renderer->b;
+ }
+
+ program = data->current_program;
+ if (!CompareColors(program->color_r, program->color_g, program->color_b, program->color_a, r, g, b, a)) {
+ /* Select the color to draw with */
+ data->glUniform4f(program->uniform_locations[GLES2_UNIFORM_COLOR], r * inv255f, g * inv255f, b * inv255f, a * inv255f);
+ program->color_r = r;
+ program->color_g = g;
+ program->color_b = b;
+ program->color_a = a;
+ }
+
+ return 0;
+}
+
+static int
+GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr,
+ const void *vertexData, size_t dataSizeInBytes)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+
+#if !SDL_GLES2_USE_VBOS
+ data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, vertexData);
+#else
+ if (!data->vertex_buffers[attr]) {
+ data->glGenBuffers(1, &data->vertex_buffers[attr]);
+ }
+
+ data->glBindBuffer(GL_ARRAY_BUFFER, data->vertex_buffers[attr]);
+
+ if (data->vertex_buffer_size[attr] < dataSizeInBytes) {
+ data->glBufferData(GL_ARRAY_BUFFER, dataSizeInBytes, vertexData, GL_STREAM_DRAW);
+ data->vertex_buffer_size[attr] = dataSizeInBytes;
+ } else {
+ data->glBufferSubData(GL_ARRAY_BUFFER, 0, dataSizeInBytes, vertexData);
+ }
+
+ data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, 0);
+#endif
+
+ return 0;
+}
+
+static int
+GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLfloat *vertices;
+ int idx;
+
+ if (GLES2_SetDrawingState(renderer) < 0) {
+ return -1;
+ }
+
+ /* Emit the specified vertices as points */
+ vertices = SDL_stack_alloc(GLfloat, count * 2);
+ for (idx = 0; idx < count; ++idx) {
+ GLfloat x = points[idx].x + 0.5f;
+ GLfloat y = points[idx].y + 0.5f;
+
+ vertices[idx * 2] = x;
+ vertices[(idx * 2) + 1] = y;
+ }
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, count * 2 * sizeof(GLfloat));
+ data->glDrawArrays(GL_POINTS, 0, count);
+ SDL_stack_free(vertices);
+ return 0;
+}
+
+static int
+GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLfloat *vertices;
+ int idx;
+
+ if (GLES2_SetDrawingState(renderer) < 0) {
+ return -1;
+ }
+
+ /* Emit a line strip including the specified vertices */
+ vertices = SDL_stack_alloc(GLfloat, count * 2);
+ for (idx = 0; idx < count; ++idx) {
+ GLfloat x = points[idx].x + 0.5f;
+ GLfloat y = points[idx].y + 0.5f;
+
+ vertices[idx * 2] = x;
+ vertices[(idx * 2) + 1] = y;
+ }
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, count * 2 * sizeof(GLfloat));
+ data->glDrawArrays(GL_LINE_STRIP, 0, count);
+
+ /* We need to close the endpoint of the line */
+ if (count == 2 ||
+ points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
+ data->glDrawArrays(GL_POINTS, count-1, 1);
+ }
+ SDL_stack_free(vertices);
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLfloat vertices[8];
+ int idx;
+
+ if (GLES2_SetDrawingState(renderer) < 0) {
+ return -1;
+ }
+
+ /* Emit a line loop for each rectangle */
+ for (idx = 0; idx < count; ++idx) {
+ const SDL_FRect *rect = &rects[idx];
+
+ GLfloat xMin = rect->x;
+ GLfloat xMax = (rect->x + rect->w);
+ GLfloat yMin = rect->y;
+ GLfloat yMax = (rect->y + rect->h);
+
+ vertices[0] = xMin;
+ vertices[1] = yMin;
+ vertices[2] = xMax;
+ vertices[3] = yMin;
+ vertices[4] = xMin;
+ vertices[5] = yMax;
+ vertices[6] = xMax;
+ vertices[7] = yMax;
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, 8 * sizeof(GLfloat));
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ }
+ return GL_CheckError("", renderer);
+}
+
+static int
+GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
+ GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
+ GLES2_ProgramCacheEntry *program;
+ Uint8 r, g, b, a;
+
+ /* Activate an appropriate shader and set the projection matrix */
+ if (renderer->target) {
+ /* Check if we need to do color mapping between the source and render target textures */
+ if (renderer->target->format != texture->format) {
+ switch (texture->format) {
+ case SDL_PIXELFORMAT_ARGB8888:
+ switch (renderer->target->format) {
+ case SDL_PIXELFORMAT_ABGR8888:
+ case SDL_PIXELFORMAT_BGR888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
+ break;
+ case SDL_PIXELFORMAT_RGB888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_ABGR8888:
+ switch (renderer->target->format) {
+ case SDL_PIXELFORMAT_ARGB8888:
+ case SDL_PIXELFORMAT_RGB888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
+ break;
+ case SDL_PIXELFORMAT_BGR888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_RGB888:
+ switch (renderer->target->format) {
+ case SDL_PIXELFORMAT_ABGR8888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
+ break;
+ case SDL_PIXELFORMAT_ARGB8888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
+ break;
+ case SDL_PIXELFORMAT_BGR888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_BGR888:
+ switch (renderer->target->format) {
+ case SDL_PIXELFORMAT_ABGR8888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
+ break;
+ case SDL_PIXELFORMAT_ARGB8888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB;
+ break;
+ case SDL_PIXELFORMAT_RGB888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_YV12:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV;
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_NV12;
+ break;
+ case SDL_PIXELFORMAT_NV21:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21;
+ break;
+ case SDL_PIXELFORMAT_EXTERNAL_OES:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES;
+ break;
+ default:
+ return SDL_SetError("Unsupported texture format");
+ }
+ } else {
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
+ }
+ } else {
+ switch (texture->format) {
+ case SDL_PIXELFORMAT_ARGB8888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB;
+ break;
+ case SDL_PIXELFORMAT_ABGR8888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
+ break;
+ case SDL_PIXELFORMAT_RGB888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB;
+ break;
+ case SDL_PIXELFORMAT_BGR888:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_YV12:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV;
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_NV12;
+ break;
+ case SDL_PIXELFORMAT_NV21:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21;
+ break;
+ case SDL_PIXELFORMAT_EXTERNAL_OES:
+ sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES;
+ break;
+ default:
+ return SDL_SetError("Unsupported texture format");
+ }
+ }
+
+ if (GLES2_SelectProgram(renderer, sourceType, texture->w, texture->h) < 0) {
+ return -1;
+ }
+
+ /* Select the target texture */
+ if (tdata->yuv) {
+ data->glActiveTexture(GL_TEXTURE2);
+ data->glBindTexture(tdata->texture_type, tdata->texture_v);
+
+ data->glActiveTexture(GL_TEXTURE1);
+ data->glBindTexture(tdata->texture_type, tdata->texture_u);
+
+ data->glActiveTexture(GL_TEXTURE0);
+ }
+ if (tdata->nv12) {
+ data->glActiveTexture(GL_TEXTURE1);
+ data->glBindTexture(tdata->texture_type, tdata->texture_u);
+
+ data->glActiveTexture(GL_TEXTURE0);
+ }
+ data->glBindTexture(tdata->texture_type, tdata->texture);
+
+ /* Configure color modulation */
+ g = texture->g;
+ a = texture->a;
+
+ if (renderer->target &&
+ (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 ||
+ renderer->target->format == SDL_PIXELFORMAT_RGB888)) {
+ r = texture->b;
+ b = texture->r;
+ } else {
+ r = texture->r;
+ b = texture->b;
+ }
+
+ program = data->current_program;
+
+ if (!CompareColors(program->modulation_r, program->modulation_g, program->modulation_b, program->modulation_a, r, g, b, a)) {
+ data->glUniform4f(program->uniform_locations[GLES2_UNIFORM_MODULATION], r * inv255f, g * inv255f, b * inv255f, a * inv255f);
+ program->modulation_r = r;
+ program->modulation_g = g;
+ program->modulation_b = b;
+ program->modulation_a = a;
+ }
+
+ /* Configure texture blending */
+ GLES2_SetBlendMode(data, texture->blendMode);
+
+ GLES2_SetTexCoords(data, SDL_TRUE);
+ return 0;
+}
+
+static int
+GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
+ const SDL_FRect *dstrect)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLfloat vertices[8];
+ GLfloat texCoords[8];
+
+ GLES2_ActivateRenderer(renderer);
+
+ if (GLES2_SetupCopy(renderer, texture) < 0) {
+ return -1;
+ }
+
+ /* Emit the textured quad */
+ vertices[0] = dstrect->x;
+ vertices[1] = dstrect->y;
+ vertices[2] = (dstrect->x + dstrect->w);
+ vertices[3] = dstrect->y;
+ vertices[4] = dstrect->x;
+ vertices[5] = (dstrect->y + dstrect->h);
+ vertices[6] = (dstrect->x + dstrect->w);
+ vertices[7] = (dstrect->y + dstrect->h);
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, 8 * sizeof(GLfloat));
+ texCoords[0] = srcrect->x / (GLfloat)texture->w;
+ texCoords[1] = srcrect->y / (GLfloat)texture->h;
+ texCoords[2] = (srcrect->x + srcrect->w) / (GLfloat)texture->w;
+ texCoords[3] = srcrect->y / (GLfloat)texture->h;
+ texCoords[4] = srcrect->x / (GLfloat)texture->w;
+ texCoords[5] = (srcrect->y + srcrect->h) / (GLfloat)texture->h;
+ texCoords[6] = (srcrect->x + srcrect->w) / (GLfloat)texture->w;
+ texCoords[7] = (srcrect->y + srcrect->h) / (GLfloat)texture->h;
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, texCoords);*/
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_TEXCOORD, texCoords, 8 * sizeof(GLfloat));
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
+ const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLfloat vertices[8];
+ GLfloat texCoords[8];
+ GLfloat translate[8];
+ GLfloat fAngle[4];
+ GLfloat tmp;
+
+ GLES2_ActivateRenderer(renderer);
+
+ if (GLES2_SetupCopy(renderer, texture) < 0) {
+ return -1;
+ }
+
+ data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
+ data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
+ fAngle[0] = fAngle[1] = fAngle[2] = fAngle[3] = (GLfloat)(360.0f - angle);
+ /* Calculate the center of rotation */
+ translate[0] = translate[2] = translate[4] = translate[6] = (center->x + dstrect->x);
+ translate[1] = translate[3] = translate[5] = translate[7] = (center->y + dstrect->y);
+
+ /* Emit the textured quad */
+ vertices[0] = dstrect->x;
+ vertices[1] = dstrect->y;
+ vertices[2] = (dstrect->x + dstrect->w);
+ vertices[3] = dstrect->y;
+ vertices[4] = dstrect->x;
+ vertices[5] = (dstrect->y + dstrect->h);
+ vertices[6] = (dstrect->x + dstrect->w);
+ vertices[7] = (dstrect->y + dstrect->h);
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ tmp = vertices[0];
+ vertices[0] = vertices[4] = vertices[2];
+ vertices[2] = vertices[6] = tmp;
+ }
+ if (flip & SDL_FLIP_VERTICAL) {
+ tmp = vertices[1];
+ vertices[1] = vertices[3] = vertices[5];
+ vertices[5] = vertices[7] = tmp;
+ }
+
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 1, GL_FLOAT, GL_FALSE, 0, &fAngle);
+ data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, translate);
+ data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/
+
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_ANGLE, fAngle, 4 * sizeof(GLfloat));
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_CENTER, translate, 8 * sizeof(GLfloat));
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, 8 * sizeof(GLfloat));
+
+ texCoords[0] = srcrect->x / (GLfloat)texture->w;
+ texCoords[1] = srcrect->y / (GLfloat)texture->h;
+ texCoords[2] = (srcrect->x + srcrect->w) / (GLfloat)texture->w;
+ texCoords[3] = srcrect->y / (GLfloat)texture->h;
+ texCoords[4] = srcrect->x / (GLfloat)texture->w;
+ texCoords[5] = (srcrect->y + srcrect->h) / (GLfloat)texture->h;
+ texCoords[6] = (srcrect->x + srcrect->w) / (GLfloat)texture->w;
+ texCoords[7] = (srcrect->y + srcrect->h) / (GLfloat)texture->h;
+ /*data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, texCoords);*/
+ GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_TEXCOORD, texCoords, 8 * sizeof(GLfloat));
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
+ data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
+
+ return GL_CheckError("", renderer);
+}
+
+static int
+GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
+ void *temp_pixels;
+ int temp_pitch;
+ Uint8 *src, *dst, *tmp;
+ int w, h, length, rows;
+ int status;
+
+ GLES2_ActivateRenderer(renderer);
+
+ temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
+ temp_pixels = SDL_malloc(rect->h * temp_pitch);
+ if (!temp_pixels) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_GetRendererOutputSize(renderer, &w, &h);
+
+ data->glReadPixels(rect->x, renderer->target ? rect->y : (h-rect->y)-rect->h,
+ rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels);
+ if (GL_CheckError("glReadPixels()", renderer) < 0) {
+ return -1;
+ }
+
+ /* Flip the rows to be top-down if necessary */
+ if (!renderer->target) {
+ length = rect->w * SDL_BYTESPERPIXEL(temp_format);
+ src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch;
+ dst = (Uint8*)temp_pixels;
+ tmp = SDL_stack_alloc(Uint8, length);
+ rows = rect->h / 2;
+ while (rows--) {
+ SDL_memcpy(tmp, dst, length);
+ SDL_memcpy(dst, src, length);
+ SDL_memcpy(src, tmp, length);
+ dst += temp_pitch;
+ src -= temp_pitch;
+ }
+ SDL_stack_free(tmp);
+ }
+
+ status = SDL_ConvertPixels(rect->w, rect->h,
+ temp_format, temp_pixels, temp_pitch,
+ pixel_format, pixels, pitch);
+ SDL_free(temp_pixels);
+
+ return status;
+}
+
+static void
+GLES2_RenderPresent(SDL_Renderer *renderer)
+{
+ GLES2_ActivateRenderer(renderer);
+
+ /* Tell the video driver to swap buffers */
+ SDL_GL_SwapWindow(renderer->window);
+}
+
+
+/*************************************************************************************************
+ * Bind/unbinding of textures
+ *************************************************************************************************/
+static int GLES2_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
+static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture);
+
+static int GLES2_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
+ GLES2_ActivateRenderer(renderer);
+
+ data->glBindTexture(texturedata->texture_type, texturedata->texture);
+
+ if (texw) {
+ *texw = 1.0;
+ }
+ if (texh) {
+ *texh = 1.0;
+ }
+
+ return 0;
+}
+
+static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
+ GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
+ GLES2_ActivateRenderer(renderer);
+
+ data->glBindTexture(texturedata->texture_type, 0);
+
+ return 0;
+}
+
+
+/*************************************************************************************************
+ * Renderer instantiation *
+ *************************************************************************************************/
+
+#ifdef ZUNE_HD
+#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B
+#endif
+
+static void
+GLES2_ResetState(SDL_Renderer *renderer)
+{
+ GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata;
+
+ if (SDL_CurrentContext == data->context) {
+ GLES2_UpdateViewport(renderer);
+ } else {
+ GLES2_ActivateRenderer(renderer);
+ }
+
+ data->current.blendMode = SDL_BLENDMODE_INVALID;
+ data->current.tex_coords = SDL_FALSE;
+
+ data->glActiveTexture(GL_TEXTURE0);
+ data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ data->glClearColor((GLfloat) data->clear_r * inv255f,
+ (GLfloat) data->clear_g * inv255f,
+ (GLfloat) data->clear_b * inv255f,
+ (GLfloat) data->clear_a * inv255f);
+
+ data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION);
+ data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD);
+
+ GL_CheckError("", renderer);
+}
+
+static SDL_Renderer *
+GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
+{
+ SDL_Renderer *renderer;
+ GLES2_DriverContext *data;
+ GLint nFormats;
+#ifndef ZUNE_HD
+ GLboolean hasCompiler;
+#endif
+ Uint32 window_flags = 0; /* -Wconditional-uninitialized */
+ GLint window_framebuffer;
+ GLint value;
+ int profile_mask = 0, major = 0, minor = 0;
+ SDL_bool changed_window = SDL_FALSE;
+
+ if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask) < 0) {
+ goto error;
+ }
+ if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major) < 0) {
+ goto error;
+ }
+ if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor) < 0) {
+ goto error;
+ }
+
+ window_flags = SDL_GetWindowFlags(window);
+ /* OpenGL ES 3.0 is a superset of OpenGL ES 2.0 */
+ if (!(window_flags & SDL_WINDOW_OPENGL) ||
+ profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major < RENDERER_CONTEXT_MAJOR) {
+
+ changed_window = SDL_TRUE;
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);
+
+ if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) {
+ goto error;
+ }
+ }
+
+ /* Create the renderer struct */
+ renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(SDL_Renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ goto error;
+ }
+
+ data = (GLES2_DriverContext *)SDL_calloc(1, sizeof(GLES2_DriverContext));
+ if (!data) {
+ GLES2_DestroyRenderer(renderer);
+ SDL_OutOfMemory();
+ goto error;
+ }
+ renderer->info = GLES2_RenderDriver.info;
+ renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
+ renderer->driverdata = data;
+ renderer->window = window;
+
+ /* Create an OpenGL ES 2.0 context */
+ data->context = SDL_GL_CreateContext(window);
+ if (!data->context) {
+ GLES2_DestroyRenderer(renderer);
+ goto error;
+ }
+ if (SDL_GL_MakeCurrent(window, data->context) < 0) {
+ GLES2_DestroyRenderer(renderer);
+ goto error;
+ }
+
+ if (GLES2_LoadFunctions(data) < 0) {
+ GLES2_DestroyRenderer(renderer);
+ goto error;
+ }
+
+#if __WINRT__
+ /* DLudwig, 2013-11-29: ANGLE for WinRT doesn't seem to work unless VSync
+ * is turned on. Not doing so will freeze the screen's contents to that
+ * of the first drawn frame.
+ */
+ flags |= SDL_RENDERER_PRESENTVSYNC;
+#endif
+
+ if (flags & SDL_RENDERER_PRESENTVSYNC) {
+ SDL_GL_SetSwapInterval(1);
+ } else {
+ SDL_GL_SetSwapInterval(0);
+ }
+ if (SDL_GL_GetSwapInterval() > 0) {
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+
+ /* Check for debug output support */
+ if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_FLAGS, &value) == 0 &&
+ (value & SDL_GL_CONTEXT_DEBUG_FLAG)) {
+ data->debug_enabled = SDL_TRUE;
+ }
+
+ value = 0;
+ data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
+ renderer->info.max_texture_width = value;
+ value = 0;
+ data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
+ renderer->info.max_texture_height = value;
+
+ /* Determine supported shader formats */
+ /* HACK: glGetInteger is broken on the Zune HD's compositor, so we just hardcode this */
+#ifdef ZUNE_HD
+ nFormats = 1;
+#else /* !ZUNE_HD */
+ data->glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &nFormats);
+ data->glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler);
+ if (hasCompiler) {
+ ++nFormats;
+ }
+#endif /* ZUNE_HD */
+ data->shader_formats = (GLenum *)SDL_calloc(nFormats, sizeof(GLenum));
+ if (!data->shader_formats) {
+ GLES2_DestroyRenderer(renderer);
+ SDL_OutOfMemory();
+ goto error;
+ }
+ data->shader_format_count = nFormats;
+#ifdef ZUNE_HD
+ data->shader_formats[0] = GL_NVIDIA_PLATFORM_BINARY_NV;
+#else /* !ZUNE_HD */
+ data->glGetIntegerv(GL_SHADER_BINARY_FORMATS, (GLint *)data->shader_formats);
+ if (hasCompiler) {
+ data->shader_formats[nFormats - 1] = (GLenum)-1;
+ }
+#endif /* ZUNE_HD */
+
+ data->framebuffers = NULL;
+ data->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &window_framebuffer);
+ data->window_framebuffer = (GLuint)window_framebuffer;
+
+ /* Populate the function pointers for the module */
+ renderer->WindowEvent = GLES2_WindowEvent;
+ renderer->GetOutputSize = GLES2_GetOutputSize;
+ renderer->SupportsBlendMode = GLES2_SupportsBlendMode;
+ renderer->CreateTexture = GLES2_CreateTexture;
+ renderer->UpdateTexture = GLES2_UpdateTexture;
+ renderer->UpdateTextureYUV = GLES2_UpdateTextureYUV;
+ renderer->LockTexture = GLES2_LockTexture;
+ renderer->UnlockTexture = GLES2_UnlockTexture;
+ renderer->SetRenderTarget = GLES2_SetRenderTarget;
+ renderer->UpdateViewport = GLES2_UpdateViewport;
+ renderer->UpdateClipRect = GLES2_UpdateClipRect;
+ renderer->RenderClear = GLES2_RenderClear;
+ renderer->RenderDrawPoints = GLES2_RenderDrawPoints;
+ renderer->RenderDrawLines = GLES2_RenderDrawLines;
+ renderer->RenderFillRects = GLES2_RenderFillRects;
+ renderer->RenderCopy = GLES2_RenderCopy;
+ renderer->RenderCopyEx = GLES2_RenderCopyEx;
+ renderer->RenderReadPixels = GLES2_RenderReadPixels;
+ renderer->RenderPresent = GLES2_RenderPresent;
+ renderer->DestroyTexture = GLES2_DestroyTexture;
+ renderer->DestroyRenderer = GLES2_DestroyRenderer;
+ renderer->GL_BindTexture = GLES2_BindTexture;
+ renderer->GL_UnbindTexture = GLES2_UnbindTexture;
+
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12;
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
+#ifdef GL_TEXTURE_EXTERNAL_OES
+ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES;
+#endif
+
+ GLES2_ResetState(renderer);
+
+ return renderer;
+
+error:
+ if (changed_window) {
+ /* Uh oh, better try to put it back... */
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile_mask);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor);
+ SDL_RecreateWindow(window, window_flags);
+ }
+ return NULL;
+}
+
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.c
new file mode 100644
index 0000000..b0bcdff
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.c
@@ -0,0 +1,569 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
+
+#include "SDL_video.h"
+#include "SDL_opengles2.h"
+#include "SDL_shaders_gles2.h"
+#include "SDL_stdinc.h"
+
+/*************************************************************************************************
+ * Vertex/fragment shader source *
+ *************************************************************************************************/
+
+static const Uint8 GLES2_VertexSrc_Default_[] = " \
+ uniform mat4 u_projection; \
+ attribute vec2 a_position; \
+ attribute vec2 a_texCoord; \
+ attribute float a_angle; \
+ attribute vec2 a_center; \
+ varying vec2 v_texCoord; \
+ \
+ void main() \
+ { \
+ float angle = radians(a_angle); \
+ float c = cos(angle); \
+ float s = sin(angle); \
+ mat2 rotationMatrix = mat2(c, -s, s, c); \
+ vec2 position = rotationMatrix * (a_position - a_center) + a_center; \
+ v_texCoord = a_texCoord; \
+ gl_Position = u_projection * vec4(position, 0.0, 1.0);\
+ gl_PointSize = 1.0; \
+ } \
+";
+
+static const Uint8 GLES2_FragmentSrc_SolidSrc_[] = " \
+ precision mediump float; \
+ uniform vec4 u_color; \
+ \
+ void main() \
+ { \
+ gl_FragColor = u_color; \
+ } \
+";
+
+static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \
+ precision mediump float; \
+ uniform sampler2D u_texture; \
+ uniform vec4 u_modulation; \
+ varying vec2 v_texCoord; \
+ \
+ void main() \
+ { \
+ gl_FragColor = texture2D(u_texture, v_texCoord); \
+ gl_FragColor *= u_modulation; \
+ } \
+";
+
+/* ARGB to ABGR conversion */
+static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \
+ precision mediump float; \
+ uniform sampler2D u_texture; \
+ uniform vec4 u_modulation; \
+ varying vec2 v_texCoord; \
+ \
+ void main() \
+ { \
+ vec4 abgr = texture2D(u_texture, v_texCoord); \
+ gl_FragColor = abgr; \
+ gl_FragColor.r = abgr.b; \
+ gl_FragColor.b = abgr.r; \
+ gl_FragColor *= u_modulation; \
+ } \
+";
+
+/* RGB to ABGR conversion */
+static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \
+ precision mediump float; \
+ uniform sampler2D u_texture; \
+ uniform vec4 u_modulation; \
+ varying vec2 v_texCoord; \
+ \
+ void main() \
+ { \
+ vec4 abgr = texture2D(u_texture, v_texCoord); \
+ gl_FragColor = abgr; \
+ gl_FragColor.r = abgr.b; \
+ gl_FragColor.b = abgr.r; \
+ gl_FragColor.a = 1.0; \
+ gl_FragColor *= u_modulation; \
+ } \
+";
+
+/* BGR to ABGR conversion */
+static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \
+ precision mediump float; \
+ uniform sampler2D u_texture; \
+ uniform vec4 u_modulation; \
+ varying vec2 v_texCoord; \
+ \
+ void main() \
+ { \
+ vec4 abgr = texture2D(u_texture, v_texCoord); \
+ gl_FragColor = abgr; \
+ gl_FragColor.a = 1.0; \
+ gl_FragColor *= u_modulation; \
+ } \
+";
+
+#define JPEG_SHADER_CONSTANTS \
+"// YUV offset \n" \
+"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \
+"\n" \
+"// RGB coefficients \n" \
+"const mat3 matrix = mat3( 1, 1, 1,\n" \
+" 0, -0.3441, 1.772,\n" \
+" 1.402, -0.7141, 0);\n" \
+
+#define BT601_SHADER_CONSTANTS \
+"// YUV offset \n" \
+"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
+"\n" \
+"// RGB coefficients \n" \
+"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \
+" 0, -0.3918, 2.0172,\n" \
+" 1.596, -0.813, 0);\n" \
+
+#define BT709_SHADER_CONSTANTS \
+"// YUV offset \n" \
+"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
+"\n" \
+"// RGB coefficients \n" \
+"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \
+" 0, -0.2132, 2.1124,\n" \
+" 1.7927, -0.5329, 0);\n" \
+
+
+#define YUV_SHADER_PROLOGUE \
+"precision mediump float;\n" \
+"uniform sampler2D u_texture;\n" \
+"uniform sampler2D u_texture_u;\n" \
+"uniform sampler2D u_texture_v;\n" \
+"uniform vec4 u_modulation;\n" \
+"varying vec2 v_texCoord;\n" \
+"\n" \
+
+#define YUV_SHADER_BODY \
+"\n" \
+"void main()\n" \
+"{\n" \
+" mediump vec3 yuv;\n" \
+" lowp vec3 rgb;\n" \
+"\n" \
+" // Get the YUV values \n" \
+" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \
+" yuv.y = texture2D(u_texture_u, v_texCoord).r;\n" \
+" yuv.z = texture2D(u_texture_v, v_texCoord).r;\n" \
+"\n" \
+" // Do the color transform \n" \
+" yuv += offset;\n" \
+" rgb = matrix * yuv;\n" \
+"\n" \
+" // That was easy. :) \n" \
+" gl_FragColor = vec4(rgb, 1);\n" \
+" gl_FragColor *= u_modulation;\n" \
+"}" \
+
+#define NV12_SHADER_BODY \
+"\n" \
+"void main()\n" \
+"{\n" \
+" mediump vec3 yuv;\n" \
+" lowp vec3 rgb;\n" \
+"\n" \
+" // Get the YUV values \n" \
+" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \
+" yuv.yz = texture2D(u_texture_u, v_texCoord).ra;\n" \
+"\n" \
+" // Do the color transform \n" \
+" yuv += offset;\n" \
+" rgb = matrix * yuv;\n" \
+"\n" \
+" // That was easy. :) \n" \
+" gl_FragColor = vec4(rgb, 1);\n" \
+" gl_FragColor *= u_modulation;\n" \
+"}" \
+
+#define NV21_SHADER_BODY \
+"\n" \
+"void main()\n" \
+"{\n" \
+" mediump vec3 yuv;\n" \
+" lowp vec3 rgb;\n" \
+"\n" \
+" // Get the YUV values \n" \
+" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \
+" yuv.yz = texture2D(u_texture_u, v_texCoord).ar;\n" \
+"\n" \
+" // Do the color transform \n" \
+" yuv += offset;\n" \
+" rgb = matrix * yuv;\n" \
+"\n" \
+" // That was easy. :) \n" \
+" gl_FragColor = vec4(rgb, 1);\n" \
+" gl_FragColor *= u_modulation;\n" \
+"}" \
+
+/* YUV to ABGR conversion */
+static const Uint8 GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \
+ YUV_SHADER_PROLOGUE \
+ JPEG_SHADER_CONSTANTS \
+ YUV_SHADER_BODY \
+;
+static const Uint8 GLES2_FragmentSrc_TextureYUVBT601Src_[] = \
+ YUV_SHADER_PROLOGUE \
+ BT601_SHADER_CONSTANTS \
+ YUV_SHADER_BODY \
+;
+static const Uint8 GLES2_FragmentSrc_TextureYUVBT709Src_[] = \
+ YUV_SHADER_PROLOGUE \
+ BT709_SHADER_CONSTANTS \
+ YUV_SHADER_BODY \
+;
+
+/* NV12 to ABGR conversion */
+static const Uint8 GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \
+ YUV_SHADER_PROLOGUE \
+ JPEG_SHADER_CONSTANTS \
+ NV12_SHADER_BODY \
+;
+static const Uint8 GLES2_FragmentSrc_TextureNV12BT601Src_[] = \
+ YUV_SHADER_PROLOGUE \
+ BT601_SHADER_CONSTANTS \
+ NV12_SHADER_BODY \
+;
+static const Uint8 GLES2_FragmentSrc_TextureNV12BT709Src_[] = \
+ YUV_SHADER_PROLOGUE \
+ BT709_SHADER_CONSTANTS \
+ NV12_SHADER_BODY \
+;
+
+/* NV21 to ABGR conversion */
+static const Uint8 GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \
+ YUV_SHADER_PROLOGUE \
+ JPEG_SHADER_CONSTANTS \
+ NV21_SHADER_BODY \
+;
+static const Uint8 GLES2_FragmentSrc_TextureNV21BT601Src_[] = \
+ YUV_SHADER_PROLOGUE \
+ BT601_SHADER_CONSTANTS \
+ NV21_SHADER_BODY \
+;
+static const Uint8 GLES2_FragmentSrc_TextureNV21BT709Src_[] = \
+ YUV_SHADER_PROLOGUE \
+ BT709_SHADER_CONSTANTS \
+ NV21_SHADER_BODY \
+;
+
+/* Custom Android video format texture */
+static const Uint8 GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \
+ #extension GL_OES_EGL_image_external : require\n\
+ precision mediump float; \
+ uniform samplerExternalOES u_texture; \
+ uniform vec4 u_modulation; \
+ varying vec2 v_texCoord; \
+ \
+ void main() \
+ { \
+ gl_FragColor = texture2D(u_texture, v_texCoord); \
+ gl_FragColor *= u_modulation; \
+ } \
+";
+
+static const GLES2_ShaderInstance GLES2_VertexSrc_Default = {
+ GL_VERTEX_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_VertexSrc_Default_),
+ GLES2_VertexSrc_Default_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_SolidSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_SolidSrc_),
+ GLES2_FragmentSrc_SolidSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureABGRSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureABGRSrc_),
+ GLES2_FragmentSrc_TextureABGRSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureARGBSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureARGBSrc_),
+ GLES2_FragmentSrc_TextureARGBSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureRGBSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureRGBSrc_),
+ GLES2_FragmentSrc_TextureRGBSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureBGRSrc_),
+ GLES2_FragmentSrc_TextureBGRSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVJPEGSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureYUVJPEGSrc_),
+ GLES2_FragmentSrc_TextureYUVJPEGSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT601Src = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureYUVBT601Src_),
+ GLES2_FragmentSrc_TextureYUVBT601Src_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT709Src = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureYUVBT709Src_),
+ GLES2_FragmentSrc_TextureYUVBT709Src_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12JPEGSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureNV12JPEGSrc_),
+ GLES2_FragmentSrc_TextureNV12JPEGSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT601Src = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureNV12BT601Src_),
+ GLES2_FragmentSrc_TextureNV12BT601Src_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT709Src = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureNV21BT709Src_),
+ GLES2_FragmentSrc_TextureNV21BT709Src_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21JPEGSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureNV21JPEGSrc_),
+ GLES2_FragmentSrc_TextureNV21JPEGSrc_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT601Src = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureNV21BT601Src_),
+ GLES2_FragmentSrc_TextureNV21BT601Src_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT709Src = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureNV12BT709Src_),
+ GLES2_FragmentSrc_TextureNV12BT709Src_
+};
+
+static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureExternalOESSrc = {
+ GL_FRAGMENT_SHADER,
+ GLES2_SOURCE_SHADER,
+ sizeof(GLES2_FragmentSrc_TextureExternalOESSrc_),
+ GLES2_FragmentSrc_TextureExternalOESSrc_
+};
+
+
+/*************************************************************************************************
+ * Vertex/fragment shader definitions *
+ *************************************************************************************************/
+
+static GLES2_Shader GLES2_VertexShader_Default = {
+ 1,
+ {
+ &GLES2_VertexSrc_Default
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_SolidSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_SolidSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureABGRSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureABGRSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureARGBSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureARGBSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureRGBSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureRGBSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureBGRSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureBGRSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureYUVJPEGSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureYUVJPEGSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureYUVBT601Src = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureYUVBT601Src
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureYUVBT709Src = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureYUVBT709Src
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureNV12JPEGSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureNV12JPEGSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureNV12BT601Src = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureNV12BT601Src
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureNV12BT709Src = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureNV12BT709Src
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureNV21JPEGSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureNV21JPEGSrc
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureNV21BT601Src = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureNV21BT601Src
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureNV21BT709Src = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureNV21BT709Src
+ }
+};
+
+static GLES2_Shader GLES2_FragmentShader_TextureExternalOESSrc = {
+ 1,
+ {
+ &GLES2_FragmentSrc_TextureExternalOESSrc
+ }
+};
+
+
+/*************************************************************************************************
+ * Shader selector *
+ *************************************************************************************************/
+
+const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type)
+{
+ switch (type) {
+ case GLES2_SHADER_VERTEX_DEFAULT:
+ return &GLES2_VertexShader_Default;
+ case GLES2_SHADER_FRAGMENT_SOLID_SRC:
+ return &GLES2_FragmentShader_SolidSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC:
+ return &GLES2_FragmentShader_TextureABGRSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC:
+ return &GLES2_FragmentShader_TextureARGBSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC:
+ return &GLES2_FragmentShader_TextureRGBSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC:
+ return &GLES2_FragmentShader_TextureBGRSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC:
+ return &GLES2_FragmentShader_TextureYUVJPEGSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC:
+ return &GLES2_FragmentShader_TextureYUVBT601Src;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC:
+ return &GLES2_FragmentShader_TextureYUVBT709Src;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC:
+ return &GLES2_FragmentShader_TextureNV12JPEGSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC:
+ return &GLES2_FragmentShader_TextureNV12BT601Src;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC:
+ return &GLES2_FragmentShader_TextureNV12BT709Src;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC:
+ return &GLES2_FragmentShader_TextureNV21JPEGSrc;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC:
+ return &GLES2_FragmentShader_TextureNV21BT601Src;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC:
+ return &GLES2_FragmentShader_TextureNV21BT709Src;
+ case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC:
+ return &GLES2_FragmentShader_TextureExternalOESSrc;
+ default:
+ return NULL;
+ }
+}
+
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.h b/src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.h
new file mode 100644
index 0000000..c16ce12
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/opengles2/SDL_shaders_gles2.h
@@ -0,0 +1,70 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_shaders_gles2_h_
+#define SDL_shaders_gles2_h_
+
+#if SDL_VIDEO_RENDER_OGL_ES2
+
+typedef struct GLES2_ShaderInstance
+{
+ GLenum type;
+ GLenum format;
+ int length;
+ const void *data;
+} GLES2_ShaderInstance;
+
+typedef struct GLES2_Shader
+{
+ int instance_count;
+ const GLES2_ShaderInstance *instances[4];
+} GLES2_Shader;
+
+typedef enum
+{
+ GLES2_SHADER_VERTEX_DEFAULT,
+ GLES2_SHADER_FRAGMENT_SOLID_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC,
+ GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC
+} GLES2_ShaderType;
+
+#define GLES2_SOURCE_SHADER (GLenum)-1
+
+const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type);
+
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
+
+#endif /* SDL_shaders_gles2_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/psp/SDL_render_psp.c b/src/3rdparty/SDL2/src/render/psp/SDL_render_psp.c
new file mode 100644
index 0000000..38f893e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/psp/SDL_render_psp.c
@@ -0,0 +1,1028 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_RENDER_PSP
+
+#include "SDL_hints.h"
+#include "../SDL_sysrender.h"
+
+#include <pspkernel.h>
+#include <pspdisplay.h>
+#include <pspgu.h>
+#include <pspgum.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <pspge.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <vram.h>
+
+
+
+
+/* PSP renderer implementation, based on the PGE */
+
+
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
+
+
+static SDL_Renderer *PSP_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void PSP_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static int PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int PSP_SetTextureColorMod(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+static int PSP_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void PSP_UnlockTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int PSP_SetRenderTarget(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int PSP_UpdateViewport(SDL_Renderer * renderer);
+static int PSP_RenderClear(SDL_Renderer * renderer);
+static int PSP_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int PSP_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int PSP_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int PSP_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect);
+static int PSP_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch);
+static int PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
+static void PSP_RenderPresent(SDL_Renderer * renderer);
+static void PSP_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static void PSP_DestroyRenderer(SDL_Renderer * renderer);
+
+/*
+SDL_RenderDriver PSP_RenderDriver = {
+ PSP_CreateRenderer,
+ {
+ "PSP",
+ (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
+ 1,
+ {SDL_PIXELFORMAT_ABGR8888},
+ 0,
+ 0}
+};
+*/
+SDL_RenderDriver PSP_RenderDriver = {
+ .CreateRenderer = PSP_CreateRenderer,
+ .info = {
+ .name = "PSP",
+ .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE,
+ .num_texture_formats = 4,
+ .texture_formats = { [0] = SDL_PIXELFORMAT_BGR565,
+ [1] = SDL_PIXELFORMAT_ABGR1555,
+ [2] = SDL_PIXELFORMAT_ABGR4444,
+ [3] = SDL_PIXELFORMAT_ABGR8888,
+ },
+ .max_texture_width = 512,
+ .max_texture_height = 512,
+ }
+};
+
+#define PSP_SCREEN_WIDTH 480
+#define PSP_SCREEN_HEIGHT 272
+
+#define PSP_FRAME_BUFFER_WIDTH 512
+#define PSP_FRAME_BUFFER_SIZE (PSP_FRAME_BUFFER_WIDTH*PSP_SCREEN_HEIGHT)
+
+static unsigned int __attribute__((aligned(16))) DisplayList[262144];
+
+
+#define COL5650(r,g,b,a) ((r>>3) | ((g>>2)<<5) | ((b>>3)<<11))
+#define COL5551(r,g,b,a) ((r>>3) | ((g>>3)<<5) | ((b>>3)<<10) | (a>0?0x7000:0))
+#define COL4444(r,g,b,a) ((r>>4) | ((g>>4)<<4) | ((b>>4)<<8) | ((a>>4)<<12))
+#define COL8888(r,g,b,a) ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24))
+
+
+typedef struct
+{
+ void* frontbuffer ;
+ void* backbuffer ;
+ SDL_bool initialized ;
+ SDL_bool displayListAvail ;
+ unsigned int psm ;
+ unsigned int bpp ;
+
+ SDL_bool vsync;
+ unsigned int currentColor;
+ int currentBlendMode;
+
+} PSP_RenderData;
+
+
+typedef struct
+{
+ void *data; /**< Image data. */
+ unsigned int size; /**< Size of data in bytes. */
+ unsigned int width; /**< Image width. */
+ unsigned int height; /**< Image height. */
+ unsigned int textureWidth; /**< Texture width (power of two). */
+ unsigned int textureHeight; /**< Texture height (power of two). */
+ unsigned int bits; /**< Image bits per pixel. */
+ unsigned int format; /**< Image format - one of ::pgePixelFormat. */
+ unsigned int pitch;
+ SDL_bool swizzled; /**< Is image swizzled. */
+
+} PSP_TextureData;
+
+typedef struct
+{
+ float x, y, z;
+} VertV;
+
+
+typedef struct
+{
+ float u, v;
+ float x, y, z;
+
+} VertTV;
+
+
+/* Return next power of 2 */
+static int
+TextureNextPow2(unsigned int w)
+{
+ if(w == 0)
+ return 0;
+
+ unsigned int n = 2;
+
+ while(w > n)
+ n <<= 1;
+
+ return n;
+}
+
+
+static int
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return GU_NEAREST; /* GU_NEAREST good for tile-map */
+ } else {
+ return GU_LINEAR; /* GU_LINEAR good for scaling */
+ }
+}
+
+static int
+PixelFormatToPSPFMT(Uint32 format)
+{
+ switch (format) {
+ case SDL_PIXELFORMAT_BGR565:
+ return GU_PSM_5650;
+ case SDL_PIXELFORMAT_ABGR1555:
+ return GU_PSM_5551;
+ case SDL_PIXELFORMAT_ABGR4444:
+ return GU_PSM_4444;
+ case SDL_PIXELFORMAT_ABGR8888:
+ return GU_PSM_8888;
+ default:
+ return GU_PSM_8888;
+ }
+}
+
+void
+StartDrawing(SDL_Renderer * renderer)
+{
+ PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
+ if(data->displayListAvail)
+ return;
+
+ sceGuStart(GU_DIRECT, DisplayList);
+ data->displayListAvail = SDL_TRUE;
+}
+
+
+int
+TextureSwizzle(PSP_TextureData *psp_texture)
+{
+ if(psp_texture->swizzled)
+ return 1;
+
+ int bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
+ int height = psp_texture->size / bytewidth;
+
+ int rowblocks = (bytewidth>>4);
+ int rowblocksadd = (rowblocks-1)<<7;
+ unsigned int blockaddress = 0;
+ unsigned int *src = (unsigned int*) psp_texture->data;
+
+ unsigned char *data = NULL;
+ data = malloc(psp_texture->size);
+
+ int j;
+
+ for(j = 0; j < height; j++, blockaddress += 16)
+ {
+ unsigned int *block;
+
+ block = (unsigned int*)&data[blockaddress];
+
+ int i;
+
+ for(i = 0; i < rowblocks; i++)
+ {
+ *block++ = *src++;
+ *block++ = *src++;
+ *block++ = *src++;
+ *block++ = *src++;
+ block += 28;
+ }
+
+ if((j & 0x7) == 0x7)
+ blockaddress += rowblocksadd;
+ }
+
+ free(psp_texture->data);
+ psp_texture->data = data;
+ psp_texture->swizzled = SDL_TRUE;
+
+ return 1;
+}
+int TextureUnswizzle(PSP_TextureData *psp_texture)
+{
+ if(!psp_texture->swizzled)
+ return 1;
+
+ int blockx, blocky;
+
+ int bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
+ int height = psp_texture->size / bytewidth;
+
+ int widthblocks = bytewidth/16;
+ int heightblocks = height/8;
+
+ int dstpitch = (bytewidth - 16)/4;
+ int dstrow = bytewidth * 8;
+
+ unsigned int *src = (unsigned int*) psp_texture->data;
+
+ unsigned char *data = NULL;
+
+ data = malloc(psp_texture->size);
+
+ if(!data)
+ return 0;
+
+ sceKernelDcacheWritebackAll();
+
+ int j;
+
+ unsigned char *ydst = (unsigned char *)data;
+
+ for(blocky = 0; blocky < heightblocks; ++blocky)
+ {
+ unsigned char *xdst = ydst;
+
+ for(blockx = 0; blockx < widthblocks; ++blockx)
+ {
+ unsigned int *block;
+
+ block = (unsigned int*)xdst;
+
+ for(j = 0; j < 8; ++j)
+ {
+ *(block++) = *(src++);
+ *(block++) = *(src++);
+ *(block++) = *(src++);
+ *(block++) = *(src++);
+ block += dstpitch;
+ }
+
+ xdst += 16;
+ }
+
+ ydst += dstrow;
+ }
+
+ free(psp_texture->data);
+
+ psp_texture->data = data;
+
+ psp_texture->swizzled = SDL_FALSE;
+
+ return 1;
+}
+
+SDL_Renderer *
+PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+
+ SDL_Renderer *renderer;
+ PSP_RenderData *data;
+ int pixelformat;
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ data = (PSP_RenderData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ PSP_DestroyRenderer(renderer);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+
+ renderer->WindowEvent = PSP_WindowEvent;
+ renderer->CreateTexture = PSP_CreateTexture;
+ renderer->SetTextureColorMod = PSP_SetTextureColorMod;
+ renderer->UpdateTexture = PSP_UpdateTexture;
+ renderer->LockTexture = PSP_LockTexture;
+ renderer->UnlockTexture = PSP_UnlockTexture;
+ renderer->SetRenderTarget = PSP_SetRenderTarget;
+ renderer->UpdateViewport = PSP_UpdateViewport;
+ renderer->RenderClear = PSP_RenderClear;
+ renderer->RenderDrawPoints = PSP_RenderDrawPoints;
+ renderer->RenderDrawLines = PSP_RenderDrawLines;
+ renderer->RenderFillRects = PSP_RenderFillRects;
+ renderer->RenderCopy = PSP_RenderCopy;
+ renderer->RenderReadPixels = PSP_RenderReadPixels;
+ renderer->RenderCopyEx = PSP_RenderCopyEx;
+ renderer->RenderPresent = PSP_RenderPresent;
+ renderer->DestroyTexture = PSP_DestroyTexture;
+ renderer->DestroyRenderer = PSP_DestroyRenderer;
+ renderer->info = PSP_RenderDriver.info;
+ renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
+ renderer->driverdata = data;
+ renderer->window = window;
+
+ if (data->initialized != SDL_FALSE)
+ return 0;
+ data->initialized = SDL_TRUE;
+
+ if (flags & SDL_RENDERER_PRESENTVSYNC) {
+ data->vsync = SDL_TRUE;
+ } else {
+ data->vsync = SDL_FALSE;
+ }
+
+ pixelformat=PixelFormatToPSPFMT(SDL_GetWindowPixelFormat(window));
+ switch(pixelformat)
+ {
+ case GU_PSM_4444:
+ case GU_PSM_5650:
+ case GU_PSM_5551:
+ data->frontbuffer = (unsigned int *)(PSP_FRAME_BUFFER_SIZE<<1);
+ data->backbuffer = (unsigned int *)(0);
+ data->bpp = 2;
+ data->psm = pixelformat;
+ break;
+ default:
+ data->frontbuffer = (unsigned int *)(PSP_FRAME_BUFFER_SIZE<<2);
+ data->backbuffer = (unsigned int *)(0);
+ data->bpp = 4;
+ data->psm = GU_PSM_8888;
+ break;
+ }
+
+ sceGuInit();
+ /* setup GU */
+ sceGuStart(GU_DIRECT, DisplayList);
+ sceGuDrawBuffer(data->psm, data->frontbuffer, PSP_FRAME_BUFFER_WIDTH);
+ sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, data->backbuffer, PSP_FRAME_BUFFER_WIDTH);
+
+
+ sceGuOffset(2048 - (PSP_SCREEN_WIDTH>>1), 2048 - (PSP_SCREEN_HEIGHT>>1));
+ sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
+
+ data->frontbuffer = vabsptr(data->frontbuffer);
+ data->backbuffer = vabsptr(data->backbuffer);
+
+ /* Scissoring */
+ sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
+ sceGuEnable(GU_SCISSOR_TEST);
+
+ /* Backface culling */
+ sceGuFrontFace(GU_CCW);
+ sceGuEnable(GU_CULL_FACE);
+
+ /* Texturing */
+ sceGuEnable(GU_TEXTURE_2D);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuTexWrap(GU_REPEAT, GU_REPEAT);
+
+ /* Blending */
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
+
+ sceGuTexFilter(GU_LINEAR,GU_LINEAR);
+
+ sceGuFinish();
+ sceGuSync(0,0);
+ sceDisplayWaitVblankStartCB();
+ sceGuDisplay(GU_TRUE);
+
+ return renderer;
+}
+
+static void
+PSP_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+
+}
+
+
+static int
+PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+/* PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata; */
+ PSP_TextureData* psp_texture = (PSP_TextureData*) SDL_calloc(1, sizeof(*psp_texture));
+
+ if(!psp_texture)
+ return -1;
+
+ psp_texture->swizzled = SDL_FALSE;
+ psp_texture->width = texture->w;
+ psp_texture->height = texture->h;
+ psp_texture->textureHeight = TextureNextPow2(texture->h);
+ psp_texture->textureWidth = TextureNextPow2(texture->w);
+ psp_texture->format = PixelFormatToPSPFMT(texture->format);
+
+ switch(psp_texture->format)
+ {
+ case GU_PSM_5650:
+ case GU_PSM_5551:
+ case GU_PSM_4444:
+ psp_texture->bits = 16;
+ break;
+
+ case GU_PSM_8888:
+ psp_texture->bits = 32;
+ break;
+
+ default:
+ return -1;
+ }
+
+ psp_texture->pitch = psp_texture->textureWidth * SDL_BYTESPERPIXEL(texture->format);
+ psp_texture->size = psp_texture->textureHeight*psp_texture->pitch;
+ psp_texture->data = SDL_calloc(1, psp_texture->size);
+
+ if(!psp_texture->data)
+ {
+ SDL_free(psp_texture);
+ return SDL_OutOfMemory();
+ }
+ texture->driverdata = psp_texture;
+
+ return 0;
+}
+
+static int
+PSP_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ return SDL_Unsupported();
+}
+
+void
+TextureActivate(SDL_Texture * texture)
+{
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+ int scaleMode = GetScaleQuality();
+
+ /* Swizzling is useless with small textures. */
+ if (texture->w >= 16 || texture->h >= 16)
+ {
+ TextureSwizzle(psp_texture);
+ }
+
+ sceGuEnable(GU_TEXTURE_2D);
+ sceGuTexWrap(GU_REPEAT, GU_REPEAT);
+ sceGuTexMode(psp_texture->format, 0, 0, psp_texture->swizzled);
+ sceGuTexFilter(scaleMode, scaleMode); /* GU_NEAREST good for tile-map */
+ /* GU_LINEAR good for scaling */
+ sceGuTexImage(0, psp_texture->textureWidth, psp_texture->textureHeight, psp_texture->textureWidth, psp_texture->data);
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+}
+
+
+static int
+PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{
+/* PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata; */
+ const Uint8 *src;
+ Uint8 *dst;
+ int row, length,dpitch;
+ src = pixels;
+
+ PSP_LockTexture(renderer, texture,rect,(void **)&dst, &dpitch);
+ length = rect->w * SDL_BYTESPERPIXEL(texture->format);
+ if (length == pitch && length == dpitch) {
+ SDL_memcpy(dst, src, length*rect->h);
+ } else {
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += dpitch;
+ }
+ }
+
+ sceKernelDcacheWritebackAll();
+ return 0;
+}
+
+static int
+PSP_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+
+ *pixels =
+ (void *) ((Uint8 *) psp_texture->data + rect->y * psp_texture->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = psp_texture->pitch;
+ return 0;
+}
+
+static void
+PSP_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+ SDL_Rect rect;
+
+ /* We do whole texture updates, at least for now */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = texture->w;
+ rect.h = texture->h;
+ PSP_UpdateTexture(renderer, texture, &rect, psp_texture->data, psp_texture->pitch);
+}
+
+static int
+PSP_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+
+ return 0;
+}
+
+static int
+PSP_UpdateViewport(SDL_Renderer * renderer)
+{
+
+ return 0;
+}
+
+
+static void
+PSP_SetBlendMode(SDL_Renderer * renderer, int blendMode)
+{
+ PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
+ if (blendMode != data-> currentBlendMode) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_NONE:
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ sceGuDisable(GU_BLEND);
+ break;
+ case SDL_BLENDMODE_BLEND:
+ sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0 );
+ break;
+ case SDL_BLENDMODE_ADD:
+ sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_FIX, 0, 0x00FFFFFF );
+ break;
+ case SDL_BLENDMODE_MOD:
+ sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc( GU_ADD, GU_FIX, GU_SRC_COLOR, 0, 0);
+ break;
+ }
+ data->currentBlendMode = blendMode;
+ }
+}
+
+
+
+static int
+PSP_RenderClear(SDL_Renderer * renderer)
+{
+ /* start list */
+ StartDrawing(renderer);
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ sceGuClearColor(color);
+ sceGuClearDepth(0);
+ sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT|GU_FAST_CLEAR_BIT);
+
+ return 0;
+}
+
+static int
+PSP_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ int i;
+ StartDrawing(renderer);
+ VertV* vertices = (VertV*)sceGuGetMemory(count*sizeof(VertV));
+
+ for (i = 0; i < count; ++i) {
+ vertices[i].x = points[i].x;
+ vertices[i].y = points[i].y;
+ vertices[i].z = 0.0f;
+ }
+ sceGuDisable(GU_TEXTURE_2D);
+ sceGuColor(color);
+ sceGuShadeModel(GU_FLAT);
+ sceGuDrawArray(GU_POINTS, GU_VERTEX_32BITF|GU_TRANSFORM_2D, count, 0, vertices);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuEnable(GU_TEXTURE_2D);
+
+ return 0;
+}
+
+static int
+PSP_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ int i;
+ StartDrawing(renderer);
+ VertV* vertices = (VertV*)sceGuGetMemory(count*sizeof(VertV));
+
+ for (i = 0; i < count; ++i) {
+ vertices[i].x = points[i].x;
+ vertices[i].y = points[i].y;
+ vertices[i].z = 0.0f;
+ }
+
+ sceGuDisable(GU_TEXTURE_2D);
+ sceGuColor(color);
+ sceGuShadeModel(GU_FLAT);
+ sceGuDrawArray(GU_LINE_STRIP, GU_VERTEX_32BITF|GU_TRANSFORM_2D, count, 0, vertices);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuEnable(GU_TEXTURE_2D);
+
+ return 0;
+}
+
+static int
+PSP_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects,
+ int count)
+{
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ int i;
+ StartDrawing(renderer);
+
+ for (i = 0; i < count; ++i) {
+ const SDL_FRect *rect = &rects[i];
+ VertV* vertices = (VertV*)sceGuGetMemory((sizeof(VertV)<<1));
+ vertices[0].x = rect->x;
+ vertices[0].y = rect->y;
+ vertices[0].z = 0.0f;
+
+ vertices[1].x = rect->x + rect->w;
+ vertices[1].y = rect->y + rect->h;
+ vertices[1].z = 0.0f;
+
+ sceGuDisable(GU_TEXTURE_2D);
+ sceGuColor(color);
+ sceGuShadeModel(GU_FLAT);
+ sceGuDrawArray(GU_SPRITES, GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuEnable(GU_TEXTURE_2D);
+ }
+
+ return 0;
+}
+
+
+#define PI 3.14159265358979f
+
+#define radToDeg(x) ((x)*180.f/PI)
+#define degToRad(x) ((x)*PI/180.f)
+
+float MathAbs(float x)
+{
+ float result;
+
+ __asm__ volatile (
+ "mtv %1, S000\n"
+ "vabs.s S000, S000\n"
+ "mfv %0, S000\n"
+ : "=r"(result) : "r"(x));
+
+ return result;
+}
+
+void MathSincos(float r, float *s, float *c)
+{
+ __asm__ volatile (
+ "mtv %2, S002\n"
+ "vcst.s S003, VFPU_2_PI\n"
+ "vmul.s S002, S002, S003\n"
+ "vrot.p C000, S002, [s, c]\n"
+ "mfv %0, S000\n"
+ "mfv %1, S001\n"
+ : "=r"(*s), "=r"(*c): "r"(r));
+}
+
+void Swap(float *a, float *b)
+{
+ float n=*a;
+ *a = *b;
+ *b = n;
+}
+
+static int
+PSP_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ float x, y, width, height;
+ float u0, v0, u1, v1;
+ unsigned char alpha;
+
+ x = dstrect->x;
+ y = dstrect->y;
+ width = dstrect->w;
+ height = dstrect->h;
+
+ u0 = srcrect->x;
+ v0 = srcrect->y;
+ u1 = srcrect->x + srcrect->w;
+ v1 = srcrect->y + srcrect->h;
+
+ alpha = texture->a;
+
+ StartDrawing(renderer);
+ TextureActivate(texture);
+ PSP_SetBlendMode(renderer, renderer->blendMode);
+
+ if(alpha != 255)
+ {
+ sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
+ sceGuColor(GU_RGBA(255, 255, 255, alpha));
+ }else{
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ sceGuColor(0xFFFFFFFF);
+ }
+
+ if((MathAbs(u1) - MathAbs(u0)) < 64.0f)
+ {
+ VertTV* vertices = (VertTV*)sceGuGetMemory((sizeof(VertTV))<<1);
+
+ vertices[0].u = u0;
+ vertices[0].v = v0;
+ vertices[0].x = x;
+ vertices[0].y = y;
+ vertices[0].z = 0;
+
+ vertices[1].u = u1;
+ vertices[1].v = v1;
+ vertices[1].x = x + width;
+ vertices[1].y = y + height;
+ vertices[1].z = 0;
+
+ sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+ }
+ else
+ {
+ float start, end;
+ float curU = u0;
+ float curX = x;
+ float endX = x + width;
+ float slice = 64.0f;
+ float ustep = (u1 - u0)/width * slice;
+
+ if(ustep < 0.0f)
+ ustep = -ustep;
+
+ for(start = 0, end = width; start < end; start += slice)
+ {
+ VertTV* vertices = (VertTV*)sceGuGetMemory((sizeof(VertTV))<<1);
+
+ float polyWidth = ((curX + slice) > endX) ? (endX - curX) : slice;
+ float sourceWidth = ((curU + ustep) > u1) ? (u1 - curU) : ustep;
+
+ vertices[0].u = curU;
+ vertices[0].v = v0;
+ vertices[0].x = curX;
+ vertices[0].y = y;
+ vertices[0].z = 0;
+
+ curU += sourceWidth;
+ curX += polyWidth;
+
+ vertices[1].u = curU;
+ vertices[1].v = v1;
+ vertices[1].x = curX;
+ vertices[1].y = (y + height);
+ vertices[1].z = 0;
+
+ sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+ }
+ }
+
+ if(alpha != 255)
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ return 0;
+}
+
+static int
+PSP_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 pixel_format, void * pixels, int pitch)
+
+{
+ return SDL_Unsupported();
+}
+
+
+static int
+PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
+{
+ float x, y, width, height;
+ float u0, v0, u1, v1;
+ unsigned char alpha;
+ float centerx, centery;
+
+ x = dstrect->x;
+ y = dstrect->y;
+ width = dstrect->w;
+ height = dstrect->h;
+
+ u0 = srcrect->x;
+ v0 = srcrect->y;
+ u1 = srcrect->x + srcrect->w;
+ v1 = srcrect->y + srcrect->h;
+
+ centerx = center->x;
+ centery = center->y;
+
+ alpha = texture->a;
+
+ StartDrawing(renderer);
+ TextureActivate(texture);
+ PSP_SetBlendMode(renderer, renderer->blendMode);
+
+ if(alpha != 255)
+ {
+ sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
+ sceGuColor(GU_RGBA(255, 255, 255, alpha));
+ }else{
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ sceGuColor(0xFFFFFFFF);
+ }
+
+/* x += width * 0.5f; */
+/* y += height * 0.5f; */
+ x += centerx;
+ y += centery;
+
+ float c, s;
+
+ MathSincos(degToRad(angle), &s, &c);
+
+/* width *= 0.5f; */
+/* height *= 0.5f; */
+ width -= centerx;
+ height -= centery;
+
+
+ float cw = c*width;
+ float sw = s*width;
+ float ch = c*height;
+ float sh = s*height;
+
+ VertTV* vertices = (VertTV*)sceGuGetMemory(sizeof(VertTV)<<2);
+
+ vertices[0].u = u0;
+ vertices[0].v = v0;
+ vertices[0].x = x - cw + sh;
+ vertices[0].y = y - sw - ch;
+ vertices[0].z = 0;
+
+ vertices[1].u = u0;
+ vertices[1].v = v1;
+ vertices[1].x = x - cw - sh;
+ vertices[1].y = y - sw + ch;
+ vertices[1].z = 0;
+
+ vertices[2].u = u1;
+ vertices[2].v = v1;
+ vertices[2].x = x + cw - sh;
+ vertices[2].y = y + sw + ch;
+ vertices[2].z = 0;
+
+ vertices[3].u = u1;
+ vertices[3].v = v0;
+ vertices[3].x = x + cw + sh;
+ vertices[3].y = y + sw - ch;
+ vertices[3].z = 0;
+
+ if (flip & SDL_FLIP_VERTICAL) {
+ Swap(&vertices[0].v, &vertices[2].v);
+ Swap(&vertices[1].v, &vertices[3].v);
+ }
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ Swap(&vertices[0].u, &vertices[2].u);
+ Swap(&vertices[1].u, &vertices[3].u);
+ }
+
+ sceGuDrawArray(GU_TRIANGLE_FAN, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
+
+ if(alpha != 255)
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ return 0;
+}
+
+static void
+PSP_RenderPresent(SDL_Renderer * renderer)
+{
+ PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
+ if(!data->displayListAvail)
+ return;
+
+ data->displayListAvail = SDL_FALSE;
+ sceGuFinish();
+ sceGuSync(0,0);
+
+/* if(data->vsync) */
+ sceDisplayWaitVblankStart();
+
+ data->backbuffer = data->frontbuffer;
+ data->frontbuffer = vabsptr(sceGuSwapBuffers());
+
+}
+
+static void
+PSP_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+
+ if (renderdata == 0)
+ return;
+
+ if(psp_texture == 0)
+ return;
+
+ SDL_free(psp_texture->data);
+ SDL_free(psp_texture);
+ texture->driverdata = NULL;
+}
+
+static void
+PSP_DestroyRenderer(SDL_Renderer * renderer)
+{
+ PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
+ if (data) {
+ if (!data->initialized)
+ return;
+
+ StartDrawing(renderer);
+
+ sceGuTerm();
+/* vfree(data->backbuffer); */
+/* vfree(data->frontbuffer); */
+
+ data->initialized = SDL_FALSE;
+ data->displayListAvail = SDL_FALSE;
+ SDL_free(data);
+ }
+ SDL_free(renderer);
+}
+
+#endif /* SDL_VIDEO_RENDER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.c b/src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.c
new file mode 100644
index 0000000..8a3f750
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.c
@@ -0,0 +1,336 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if !SDL_RENDER_DISABLED
+
+#include "SDL_draw.h"
+#include "SDL_blendfillrect.h"
+
+
+static int
+SDL_BlendFillRect_RGB555(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB555);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB555);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB555);
+ break;
+ default:
+ FILLRECT(Uint16, DRAW_SETPIXEL_RGB555);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendFillRect_RGB565(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB565);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB565);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB565);
+ break;
+ default:
+ FILLRECT(Uint16, DRAW_SETPIXEL_RGB565);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendFillRect_RGB888(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB888);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB888);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB888);
+ break;
+ default:
+ FILLRECT(Uint32, DRAW_SETPIXEL_RGB888);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendFillRect_ARGB8888(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_ADD_ARGB8888);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_MOD_ARGB8888);
+ break;
+ default:
+ FILLRECT(Uint32, DRAW_SETPIXEL_ARGB8888);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendFillRect_RGB(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ SDL_PixelFormat *fmt = dst->format;
+ unsigned inva = 0xff - a;
+
+ switch (fmt->BytesPerPixel) {
+ case 2:
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB);
+ break;
+ default:
+ FILLRECT(Uint16, DRAW_SETPIXEL_RGB);
+ break;
+ }
+ return 0;
+ case 4:
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB);
+ break;
+ default:
+ FILLRECT(Uint32, DRAW_SETPIXEL_RGB);
+ break;
+ }
+ return 0;
+ default:
+ return SDL_Unsupported();
+ }
+}
+
+static int
+SDL_BlendFillRect_RGBA(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ SDL_PixelFormat *fmt = dst->format;
+ unsigned inva = 0xff - a;
+
+ switch (fmt->BytesPerPixel) {
+ case 4:
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGBA);
+ break;
+ case SDL_BLENDMODE_ADD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGBA);
+ break;
+ case SDL_BLENDMODE_MOD:
+ FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGBA);
+ break;
+ default:
+ FILLRECT(Uint32, DRAW_SETPIXEL_RGBA);
+ break;
+ }
+ return 0;
+ default:
+ return SDL_Unsupported();
+ }
+}
+
+int
+SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ SDL_Rect clipped;
+
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
+ }
+
+ /* If 'rect' == NULL, then fill the whole surface */
+ if (rect) {
+ /* Perform clipping */
+ if (!SDL_IntersectRect(rect, &dst->clip_rect, &clipped)) {
+ return 0;
+ }
+ rect = &clipped;
+ } else {
+ rect = &dst->clip_rect;
+ }
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(r, a);
+ g = DRAW_MUL(g, a);
+ b = DRAW_MUL(b, a);
+ }
+
+ switch (dst->format->BitsPerPixel) {
+ case 15:
+ switch (dst->format->Rmask) {
+ case 0x7C00:
+ return SDL_BlendFillRect_RGB555(dst, rect, blendMode, r, g, b, a);
+ }
+ break;
+ case 16:
+ switch (dst->format->Rmask) {
+ case 0xF800:
+ return SDL_BlendFillRect_RGB565(dst, rect, blendMode, r, g, b, a);
+ }
+ break;
+ case 32:
+ switch (dst->format->Rmask) {
+ case 0x00FF0000:
+ if (!dst->format->Amask) {
+ return SDL_BlendFillRect_RGB888(dst, rect, blendMode, r, g, b, a);
+ } else {
+ return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a);
+ }
+ /* break; -Wunreachable-code-break */
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!dst->format->Amask) {
+ return SDL_BlendFillRect_RGB(dst, rect, blendMode, r, g, b, a);
+ } else {
+ return SDL_BlendFillRect_RGBA(dst, rect, blendMode, r, g, b, a);
+ }
+}
+
+int
+SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ SDL_Rect rect;
+ int i;
+ int (*func)(SDL_Surface * dst, const SDL_Rect * rect,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
+ int status = 0;
+
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
+ }
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(r, a);
+ g = DRAW_MUL(g, a);
+ b = DRAW_MUL(b, a);
+ }
+
+ /* FIXME: Does this function pointer slow things down significantly? */
+ switch (dst->format->BitsPerPixel) {
+ case 15:
+ switch (dst->format->Rmask) {
+ case 0x7C00:
+ func = SDL_BlendFillRect_RGB555;
+ }
+ break;
+ case 16:
+ switch (dst->format->Rmask) {
+ case 0xF800:
+ func = SDL_BlendFillRect_RGB565;
+ }
+ break;
+ case 32:
+ switch (dst->format->Rmask) {
+ case 0x00FF0000:
+ if (!dst->format->Amask) {
+ func = SDL_BlendFillRect_RGB888;
+ } else {
+ func = SDL_BlendFillRect_ARGB8888;
+ }
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!func) {
+ if (!dst->format->Amask) {
+ func = SDL_BlendFillRect_RGB;
+ } else {
+ func = SDL_BlendFillRect_RGBA;
+ }
+ }
+
+ for (i = 0; i < count; ++i) {
+ /* Perform clipping */
+ if (!SDL_IntersectRect(&rects[i], &dst->clip_rect, &rect)) {
+ continue;
+ }
+ status = func(dst, &rect, blendMode, r, g, b, a);
+ }
+ return status;
+}
+
+#endif /* !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.h b/src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.h
new file mode 100644
index 0000000..262210f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_blendfillrect.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+
+extern int SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern int SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_blendline.c b/src/3rdparty/SDL2/src/render/software/SDL_blendline.c
new file mode 100644
index 0000000..0ed0ccd
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_blendline.c
@@ -0,0 +1,777 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if !SDL_RENDER_DISABLED
+
+#include "SDL_draw.h"
+#include "SDL_blendline.h"
+#include "SDL_blendpoint.h"
+
+
+static void
+SDL_BlendLine_RGB2(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ const SDL_PixelFormat *fmt = dst->format;
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint16, DRAW_SETPIXEL_ADD_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint16, DRAW_SETPIXEL_MOD_RGB, draw_end);
+ break;
+ default:
+ HLINE(Uint16, DRAW_SETPIXEL_RGB, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint16, DRAW_SETPIXEL_ADD_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint16, DRAW_SETPIXEL_MOD_RGB, draw_end);
+ break;
+ default:
+ VLINE(Uint16, DRAW_SETPIXEL_RGB, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint16, DRAW_SETPIXEL_ADD_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint16, DRAW_SETPIXEL_MOD_RGB, draw_end);
+ break;
+ default:
+ DLINE(Uint16, DRAW_SETPIXEL_RGB, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY2_BLEND_RGB, DRAW_SETPIXELXY2_BLEND_RGB,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY2_ADD_RGB, DRAW_SETPIXELXY2_ADD_RGB,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY2_MOD_RGB, DRAW_SETPIXELXY2_MOD_RGB,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY2_RGB, DRAW_SETPIXELXY2_BLEND_RGB,
+ draw_end);
+ break;
+ }
+ }
+}
+
+static void
+SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB555, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint16, DRAW_SETPIXEL_ADD_RGB555, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint16, DRAW_SETPIXEL_MOD_RGB555, draw_end);
+ break;
+ default:
+ HLINE(Uint16, DRAW_SETPIXEL_RGB555, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB555, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint16, DRAW_SETPIXEL_ADD_RGB555, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint16, DRAW_SETPIXEL_MOD_RGB555, draw_end);
+ break;
+ default:
+ VLINE(Uint16, DRAW_SETPIXEL_RGB555, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB555, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint16, DRAW_SETPIXEL_ADD_RGB555, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint16, DRAW_SETPIXEL_MOD_RGB555, draw_end);
+ break;
+ default:
+ DLINE(Uint16, DRAW_SETPIXEL_RGB555, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_BLEND_RGB555, DRAW_SETPIXELXY_BLEND_RGB555,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_ADD_RGB555, DRAW_SETPIXELXY_ADD_RGB555,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_MOD_RGB555, DRAW_SETPIXELXY_MOD_RGB555,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_RGB555, DRAW_SETPIXELXY_BLEND_RGB555,
+ draw_end);
+ break;
+ }
+ }
+}
+
+static void
+SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB565, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint16, DRAW_SETPIXEL_ADD_RGB565, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint16, DRAW_SETPIXEL_MOD_RGB565, draw_end);
+ break;
+ default:
+ HLINE(Uint16, DRAW_SETPIXEL_RGB565, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB565, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint16, DRAW_SETPIXEL_ADD_RGB565, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint16, DRAW_SETPIXEL_MOD_RGB565, draw_end);
+ break;
+ default:
+ VLINE(Uint16, DRAW_SETPIXEL_RGB565, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint16, DRAW_SETPIXEL_BLEND_RGB565, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint16, DRAW_SETPIXEL_ADD_RGB565, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint16, DRAW_SETPIXEL_MOD_RGB565, draw_end);
+ break;
+ default:
+ DLINE(Uint16, DRAW_SETPIXEL_RGB565, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_BLEND_RGB565, DRAW_SETPIXELXY_BLEND_RGB565,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_ADD_RGB565, DRAW_SETPIXELXY_ADD_RGB565,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_MOD_RGB565, DRAW_SETPIXELXY_MOD_RGB565,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_RGB565, DRAW_SETPIXELXY_BLEND_RGB565,
+ draw_end);
+ break;
+ }
+ }
+}
+
+static void
+SDL_BlendLine_RGB4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ const SDL_PixelFormat *fmt = dst->format;
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint32, DRAW_SETPIXEL_ADD_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint32, DRAW_SETPIXEL_MOD_RGB, draw_end);
+ break;
+ default:
+ HLINE(Uint32, DRAW_SETPIXEL_RGB, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint32, DRAW_SETPIXEL_ADD_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint32, DRAW_SETPIXEL_MOD_RGB, draw_end);
+ break;
+ default:
+ VLINE(Uint32, DRAW_SETPIXEL_RGB, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint32, DRAW_SETPIXEL_ADD_RGB, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint32, DRAW_SETPIXEL_MOD_RGB, draw_end);
+ break;
+ default:
+ DLINE(Uint32, DRAW_SETPIXEL_RGB, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_BLEND_RGB, DRAW_SETPIXELXY4_BLEND_RGB,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_ADD_RGB, DRAW_SETPIXELXY4_ADD_RGB,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_MOD_RGB, DRAW_SETPIXELXY4_MOD_RGB,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_RGB, DRAW_SETPIXELXY4_BLEND_RGB,
+ draw_end);
+ break;
+ }
+ }
+}
+
+static void
+SDL_BlendLine_RGBA4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ const SDL_PixelFormat *fmt = dst->format;
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint32, DRAW_SETPIXEL_BLEND_RGBA, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint32, DRAW_SETPIXEL_ADD_RGBA, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint32, DRAW_SETPIXEL_MOD_RGBA, draw_end);
+ break;
+ default:
+ HLINE(Uint32, DRAW_SETPIXEL_RGBA, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint32, DRAW_SETPIXEL_BLEND_RGBA, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint32, DRAW_SETPIXEL_ADD_RGBA, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint32, DRAW_SETPIXEL_MOD_RGBA, draw_end);
+ break;
+ default:
+ VLINE(Uint32, DRAW_SETPIXEL_RGBA, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint32, DRAW_SETPIXEL_BLEND_RGBA, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint32, DRAW_SETPIXEL_ADD_RGBA, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint32, DRAW_SETPIXEL_MOD_RGBA, draw_end);
+ break;
+ default:
+ DLINE(Uint32, DRAW_SETPIXEL_RGBA, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_BLEND_RGBA, DRAW_SETPIXELXY4_BLEND_RGBA,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_ADD_RGBA, DRAW_SETPIXELXY4_ADD_RGBA,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_MOD_RGBA, DRAW_SETPIXELXY4_MOD_RGBA,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY4_RGBA, DRAW_SETPIXELXY4_BLEND_RGBA,
+ draw_end);
+ break;
+ }
+ }
+}
+
+static void
+SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
+ break;
+ default:
+ HLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
+ break;
+ default:
+ VLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint32, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
+ break;
+ default:
+ DLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_BLEND_RGB888, DRAW_SETPIXELXY_BLEND_RGB888,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_ADD_RGB888, DRAW_SETPIXELXY_ADD_RGB888,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_MOD_RGB888, DRAW_SETPIXELXY_MOD_RGB888,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_RGB888, DRAW_SETPIXELXY_BLEND_RGB888,
+ draw_end);
+ break;
+ }
+ }
+}
+
+static void
+SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
+ SDL_bool draw_end)
+{
+ unsigned r, g, b, a, inva;
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(_r, _a);
+ g = DRAW_MUL(_g, _a);
+ b = DRAW_MUL(_b, _a);
+ a = _a;
+ } else {
+ r = _r;
+ g = _g;
+ b = _b;
+ a = _a;
+ }
+ inva = (a ^ 0xff);
+
+ if (y1 == y2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ HLINE(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ HLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ HLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
+ break;
+ default:
+ HLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
+ break;
+ }
+ } else if (x1 == x2) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ VLINE(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ VLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ VLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
+ break;
+ default:
+ VLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
+ break;
+ }
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DLINE(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888, draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
+ break;
+ default:
+ DLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
+ break;
+ }
+ } else {
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_BLEND_ARGB8888, DRAW_SETPIXELXY_BLEND_ARGB8888,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_ADD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_ADD_ARGB8888, DRAW_SETPIXELXY_ADD_ARGB8888,
+ draw_end);
+ break;
+ case SDL_BLENDMODE_MOD:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_MOD_ARGB8888, DRAW_SETPIXELXY_MOD_ARGB8888,
+ draw_end);
+ break;
+ default:
+ AALINE(x1, y1, x2, y2,
+ DRAW_SETPIXELXY_ARGB8888, DRAW_SETPIXELXY_BLEND_ARGB8888,
+ draw_end);
+ break;
+ }
+ }
+}
+
+typedef void (*BlendLineFunc) (SDL_Surface * dst,
+ int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode,
+ Uint8 r, Uint8 g, Uint8 b, Uint8 a,
+ SDL_bool draw_end);
+
+static BlendLineFunc
+SDL_CalculateBlendLineFunc(const SDL_PixelFormat * fmt)
+{
+ switch (fmt->BytesPerPixel) {
+ case 2:
+ if (fmt->Rmask == 0x7C00) {
+ return SDL_BlendLine_RGB555;
+ } else if (fmt->Rmask == 0xF800) {
+ return SDL_BlendLine_RGB565;
+ } else {
+ return SDL_BlendLine_RGB2;
+ }
+ /* break; -Wunreachable-code-break */
+ case 4:
+ if (fmt->Rmask == 0x00FF0000) {
+ if (fmt->Amask) {
+ return SDL_BlendLine_ARGB8888;
+ } else {
+ return SDL_BlendLine_RGB888;
+ }
+ } else {
+ if (fmt->Amask) {
+ return SDL_BlendLine_RGBA4;
+ } else {
+ return SDL_BlendLine_RGB4;
+ }
+ }
+ }
+ return NULL;
+}
+
+int
+SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ BlendLineFunc func;
+
+ if (!dst) {
+ return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface");
+ }
+
+ func = SDL_CalculateBlendLineFunc(dst->format);
+ if (!func) {
+ return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
+ }
+
+ /* Perform clipping */
+ /* FIXME: We don't actually want to clip, as it may change line slope */
+ if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
+ return 0;
+ }
+
+ func(dst, x1, y1, x2, y2, blendMode, r, g, b, a, SDL_TRUE);
+ return 0;
+}
+
+int
+SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ int i;
+ int x1, y1;
+ int x2, y2;
+ SDL_bool draw_end;
+ BlendLineFunc func;
+
+ if (!dst) {
+ return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
+ }
+
+ func = SDL_CalculateBlendLineFunc(dst->format);
+ if (!func) {
+ return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
+ }
+
+ for (i = 1; i < count; ++i) {
+ x1 = points[i-1].x;
+ y1 = points[i-1].y;
+ x2 = points[i].x;
+ y2 = points[i].y;
+
+ /* Perform clipping */
+ /* FIXME: We don't actually want to clip, as it may change line slope */
+ if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
+ continue;
+ }
+
+ /* Draw the end if it was clipped */
+ draw_end = (x2 != points[i].x || y2 != points[i].y);
+
+ func(dst, x1, y1, x2, y2, blendMode, r, g, b, a, draw_end);
+ }
+ if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
+ SDL_BlendPoint(dst, points[count-1].x, points[count-1].y,
+ blendMode, r, g, b, a);
+ }
+ return 0;
+}
+
+#endif /* !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_blendline.h b/src/3rdparty/SDL2/src/render/software/SDL_blendline.h
new file mode 100644
index 0000000..82072cb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_blendline.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+
+extern int SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern int SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_blendpoint.c b/src/3rdparty/SDL2/src/render/software/SDL_blendpoint.c
new file mode 100644
index 0000000..37fb498
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_blendpoint.c
@@ -0,0 +1,341 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if !SDL_RENDER_DISABLED
+
+#include "SDL_draw.h"
+#include "SDL_blendpoint.h"
+
+
+static int
+SDL_BlendPoint_RGB555(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
+ Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY_BLEND_RGB555(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY_ADD_RGB555(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY_MOD_RGB555(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY_RGB555(x, y);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendPoint_RGB565(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
+ Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY_BLEND_RGB565(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY_ADD_RGB565(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY_MOD_RGB565(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY_RGB565(x, y);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendPoint_RGB888(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
+ Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY_BLEND_RGB888(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY_ADD_RGB888(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY_MOD_RGB888(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY_RGB888(x, y);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendPoint_ARGB8888(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode,
+ Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ unsigned inva = 0xff - a;
+
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY_BLEND_ARGB8888(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY_ADD_ARGB8888(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY_MOD_ARGB8888(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY_ARGB8888(x, y);
+ break;
+ }
+ return 0;
+}
+
+static int
+SDL_BlendPoint_RGB(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
+ Uint8 g, Uint8 b, Uint8 a)
+{
+ SDL_PixelFormat *fmt = dst->format;
+ unsigned inva = 0xff - a;
+
+ switch (fmt->BytesPerPixel) {
+ case 2:
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY2_BLEND_RGB(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY2_ADD_RGB(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY2_MOD_RGB(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY2_RGB(x, y);
+ break;
+ }
+ return 0;
+ case 4:
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY4_BLEND_RGB(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY4_ADD_RGB(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY4_MOD_RGB(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY4_RGB(x, y);
+ break;
+ }
+ return 0;
+ default:
+ return SDL_Unsupported();
+ }
+}
+
+static int
+SDL_BlendPoint_RGBA(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
+ Uint8 g, Uint8 b, Uint8 a)
+{
+ SDL_PixelFormat *fmt = dst->format;
+ unsigned inva = 0xff - a;
+
+ switch (fmt->BytesPerPixel) {
+ case 4:
+ switch (blendMode) {
+ case SDL_BLENDMODE_BLEND:
+ DRAW_SETPIXELXY4_BLEND_RGBA(x, y);
+ break;
+ case SDL_BLENDMODE_ADD:
+ DRAW_SETPIXELXY4_ADD_RGBA(x, y);
+ break;
+ case SDL_BLENDMODE_MOD:
+ DRAW_SETPIXELXY4_MOD_RGBA(x, y);
+ break;
+ default:
+ DRAW_SETPIXELXY4_RGBA(x, y);
+ break;
+ }
+ return 0;
+ default:
+ return SDL_Unsupported();
+ }
+}
+
+int
+SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
+ Uint8 g, Uint8 b, Uint8 a)
+{
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
+ }
+
+ /* Perform clipping */
+ if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
+ x >= (dst->clip_rect.x + dst->clip_rect.w) ||
+ y >= (dst->clip_rect.y + dst->clip_rect.h)) {
+ return 0;
+ }
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(r, a);
+ g = DRAW_MUL(g, a);
+ b = DRAW_MUL(b, a);
+ }
+
+ switch (dst->format->BitsPerPixel) {
+ case 15:
+ switch (dst->format->Rmask) {
+ case 0x7C00:
+ return SDL_BlendPoint_RGB555(dst, x, y, blendMode, r, g, b, a);
+ }
+ break;
+ case 16:
+ switch (dst->format->Rmask) {
+ case 0xF800:
+ return SDL_BlendPoint_RGB565(dst, x, y, blendMode, r, g, b, a);
+ }
+ break;
+ case 32:
+ switch (dst->format->Rmask) {
+ case 0x00FF0000:
+ if (!dst->format->Amask) {
+ return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a);
+ } else {
+ return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a);
+ }
+ /* break; -Wunreachable-code-break */
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!dst->format->Amask) {
+ return SDL_BlendPoint_RGB(dst, x, y, blendMode, r, g, b, a);
+ } else {
+ return SDL_BlendPoint_RGBA(dst, x, y, blendMode, r, g, b, a);
+ }
+}
+
+int
+SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ int minx, miny;
+ int maxx, maxy;
+ int i;
+ int x, y;
+ int (*func)(SDL_Surface * dst, int x, int y,
+ SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
+ int status = 0;
+
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
+ }
+
+ if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
+ r = DRAW_MUL(r, a);
+ g = DRAW_MUL(g, a);
+ b = DRAW_MUL(b, a);
+ }
+
+ /* FIXME: Does this function pointer slow things down significantly? */
+ switch (dst->format->BitsPerPixel) {
+ case 15:
+ switch (dst->format->Rmask) {
+ case 0x7C00:
+ func = SDL_BlendPoint_RGB555;
+ break;
+ }
+ break;
+ case 16:
+ switch (dst->format->Rmask) {
+ case 0xF800:
+ func = SDL_BlendPoint_RGB565;
+ break;
+ }
+ break;
+ case 32:
+ switch (dst->format->Rmask) {
+ case 0x00FF0000:
+ if (!dst->format->Amask) {
+ func = SDL_BlendPoint_RGB888;
+ } else {
+ func = SDL_BlendPoint_ARGB8888;
+ }
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!func) {
+ if (!dst->format->Amask) {
+ func = SDL_BlendPoint_RGB;
+ } else {
+ func = SDL_BlendPoint_RGBA;
+ }
+ }
+
+ minx = dst->clip_rect.x;
+ maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
+ miny = dst->clip_rect.y;
+ maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
+
+ for (i = 0; i < count; ++i) {
+ x = points[i].x;
+ y = points[i].y;
+
+ if (x < minx || x > maxx || y < miny || y > maxy) {
+ continue;
+ }
+ status = func(dst, x, y, blendMode, r, g, b, a);
+ }
+ return status;
+}
+
+#endif /* !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_blendpoint.h b/src/3rdparty/SDL2/src/render/software/SDL_blendpoint.h
new file mode 100644
index 0000000..dd9e49c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_blendpoint.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+
+extern int SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern int SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_draw.h b/src/3rdparty/SDL2/src/render/software/SDL_draw.h
new file mode 100644
index 0000000..945f2bc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_draw.h
@@ -0,0 +1,576 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "../../video/SDL_blit.h"
+
+/* This code assumes that r, g, b, a are the source color,
+ * and in the blend and add case, the RGB values are premultiplied by a.
+ */
+
+#define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/255)
+
+#define DRAW_FASTSETPIXEL(type) \
+ *pixel = (type) color
+
+#define DRAW_FASTSETPIXEL1 DRAW_FASTSETPIXEL(Uint8)
+#define DRAW_FASTSETPIXEL2 DRAW_FASTSETPIXEL(Uint16)
+#define DRAW_FASTSETPIXEL4 DRAW_FASTSETPIXEL(Uint32)
+
+#define DRAW_FASTSETPIXELXY(x, y, type, bpp, color) \
+ *(type *)((Uint8 *)dst->pixels + (y) * dst->pitch \
+ + (x) * bpp) = (type) color
+
+#define DRAW_FASTSETPIXELXY1(x, y) DRAW_FASTSETPIXELXY(x, y, Uint8, 1, color)
+#define DRAW_FASTSETPIXELXY2(x, y) DRAW_FASTSETPIXELXY(x, y, Uint16, 2, color)
+#define DRAW_FASTSETPIXELXY4(x, y) DRAW_FASTSETPIXELXY(x, y, Uint32, 4, color)
+
+#define DRAW_SETPIXEL(setpixel) \
+do { \
+ unsigned sr = r, sg = g, sb = b, sa = a; (void) sa; \
+ setpixel; \
+} while (0)
+
+#define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
+do { \
+ unsigned sr, sg, sb, sa = 0xFF; \
+ getpixel; \
+ sr = DRAW_MUL(inva, sr) + r; \
+ sg = DRAW_MUL(inva, sg) + g; \
+ sb = DRAW_MUL(inva, sb) + b; \
+ sa = DRAW_MUL(inva, sa) + a; \
+ setpixel; \
+} while (0)
+
+#define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
+do { \
+ unsigned sr, sg, sb, sa; (void) sa; \
+ getpixel; \
+ sr += r; if (sr > 0xff) sr = 0xff; \
+ sg += g; if (sg > 0xff) sg = 0xff; \
+ sb += b; if (sb > 0xff) sb = 0xff; \
+ setpixel; \
+} while (0)
+
+#define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
+do { \
+ unsigned sr, sg, sb, sa; (void) sa; \
+ getpixel; \
+ sr = DRAW_MUL(sr, r); \
+ sg = DRAW_MUL(sg, g); \
+ sb = DRAW_MUL(sb, b); \
+ setpixel; \
+} while (0)
+
+#define DRAW_SETPIXELXY(x, y, type, bpp, op) \
+do { \
+ type *pixel = (type *)((Uint8 *)dst->pixels + (y) * dst->pitch \
+ + (x) * bpp); \
+ op; \
+} while (0)
+
+/*
+ * Define draw operators for RGB555
+ */
+
+#define DRAW_SETPIXEL_RGB555 \
+ DRAW_SETPIXEL(RGB555_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_BLEND_RGB555 \
+ DRAW_SETPIXEL_BLEND(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
+ RGB555_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_ADD_RGB555 \
+ DRAW_SETPIXEL_ADD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
+ RGB555_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_MOD_RGB555 \
+ DRAW_SETPIXEL_MOD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
+ RGB555_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXELXY_RGB555(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_RGB555)
+
+#define DRAW_SETPIXELXY_BLEND_RGB555(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_BLEND_RGB555)
+
+#define DRAW_SETPIXELXY_ADD_RGB555(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_ADD_RGB555)
+
+#define DRAW_SETPIXELXY_MOD_RGB555(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_MOD_RGB555)
+
+/*
+ * Define draw operators for RGB565
+ */
+
+#define DRAW_SETPIXEL_RGB565 \
+ DRAW_SETPIXEL(RGB565_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_BLEND_RGB565 \
+ DRAW_SETPIXEL_BLEND(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
+ RGB565_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_ADD_RGB565 \
+ DRAW_SETPIXEL_ADD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
+ RGB565_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_MOD_RGB565 \
+ DRAW_SETPIXEL_MOD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
+ RGB565_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXELXY_RGB565(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_RGB565)
+
+#define DRAW_SETPIXELXY_BLEND_RGB565(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_BLEND_RGB565)
+
+#define DRAW_SETPIXELXY_ADD_RGB565(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_ADD_RGB565)
+
+#define DRAW_SETPIXELXY_MOD_RGB565(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_MOD_RGB565)
+
+/*
+ * Define draw operators for RGB888
+ */
+
+#define DRAW_SETPIXEL_RGB888 \
+ DRAW_SETPIXEL(RGB888_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_BLEND_RGB888 \
+ DRAW_SETPIXEL_BLEND(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
+ RGB888_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_ADD_RGB888 \
+ DRAW_SETPIXEL_ADD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
+ RGB888_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXEL_MOD_RGB888 \
+ DRAW_SETPIXEL_MOD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
+ RGB888_FROM_RGB(*pixel, sr, sg, sb))
+
+#define DRAW_SETPIXELXY_RGB888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGB888)
+
+#define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGB888)
+
+#define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGB888)
+
+#define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGB888)
+
+/*
+ * Define draw operators for ARGB8888
+ */
+
+#define DRAW_SETPIXEL_ARGB8888 \
+ DRAW_SETPIXEL(ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
+
+#define DRAW_SETPIXEL_BLEND_ARGB8888 \
+ DRAW_SETPIXEL_BLEND(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
+ ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
+
+#define DRAW_SETPIXEL_ADD_ARGB8888 \
+ DRAW_SETPIXEL_ADD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
+ ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
+
+#define DRAW_SETPIXEL_MOD_ARGB8888 \
+ DRAW_SETPIXEL_MOD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
+ ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
+
+#define DRAW_SETPIXELXY_ARGB8888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ARGB8888)
+
+#define DRAW_SETPIXELXY_BLEND_ARGB8888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_ARGB8888)
+
+#define DRAW_SETPIXELXY_ADD_ARGB8888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_ARGB8888)
+
+#define DRAW_SETPIXELXY_MOD_ARGB8888(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_ARGB8888)
+
+/*
+ * Define draw operators for general RGB
+ */
+
+#define DRAW_SETPIXEL_RGB \
+ DRAW_SETPIXEL(PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
+
+#define DRAW_SETPIXEL_BLEND_RGB \
+ DRAW_SETPIXEL_BLEND(RGB_FROM_PIXEL(*pixel, fmt, sr, sg, sb), \
+ PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
+
+#define DRAW_SETPIXEL_ADD_RGB \
+ DRAW_SETPIXEL_ADD(RGB_FROM_PIXEL(*pixel, fmt, sr, sg, sb), \
+ PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
+
+#define DRAW_SETPIXEL_MOD_RGB \
+ DRAW_SETPIXEL_MOD(RGB_FROM_PIXEL(*pixel, fmt, sr, sg, sb), \
+ PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
+
+#define DRAW_SETPIXELXY2_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_RGB)
+
+#define DRAW_SETPIXELXY4_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGB)
+
+#define DRAW_SETPIXELXY2_BLEND_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_BLEND_RGB)
+
+#define DRAW_SETPIXELXY4_BLEND_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGB)
+
+#define DRAW_SETPIXELXY2_ADD_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_ADD_RGB)
+
+#define DRAW_SETPIXELXY4_ADD_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGB)
+
+#define DRAW_SETPIXELXY2_MOD_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_MOD_RGB)
+
+#define DRAW_SETPIXELXY4_MOD_RGB(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGB)
+
+
+/*
+ * Define draw operators for general RGBA
+ */
+
+#define DRAW_SETPIXEL_RGBA \
+ DRAW_SETPIXEL(PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
+
+#define DRAW_SETPIXEL_BLEND_RGBA \
+ DRAW_SETPIXEL_BLEND(RGBA_FROM_PIXEL(*pixel, fmt, sr, sg, sb, sa), \
+ PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
+
+#define DRAW_SETPIXEL_ADD_RGBA \
+ DRAW_SETPIXEL_ADD(RGBA_FROM_PIXEL(*pixel, fmt, sr, sg, sb, sa), \
+ PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
+
+#define DRAW_SETPIXEL_MOD_RGBA \
+ DRAW_SETPIXEL_MOD(RGBA_FROM_PIXEL(*pixel, fmt, sr, sg, sb, sa), \
+ PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
+
+#define DRAW_SETPIXELXY4_RGBA(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGBA)
+
+#define DRAW_SETPIXELXY4_BLEND_RGBA(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGBA)
+
+#define DRAW_SETPIXELXY4_ADD_RGBA(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGBA)
+
+#define DRAW_SETPIXELXY4_MOD_RGBA(x, y) \
+ DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGBA)
+
+/*
+ * Define line drawing macro
+ */
+
+#define ABS(_x) ((_x) < 0 ? -(_x) : (_x))
+
+/* Horizontal line */
+#define HLINE(type, op, draw_end) \
+{ \
+ int length; \
+ int pitch = (dst->pitch / dst->format->BytesPerPixel); \
+ type *pixel; \
+ if (x1 <= x2) { \
+ pixel = (type *)dst->pixels + y1 * pitch + x1; \
+ length = draw_end ? (x2-x1+1) : (x2-x1); \
+ } else { \
+ pixel = (type *)dst->pixels + y1 * pitch + x2; \
+ if (!draw_end) { \
+ ++pixel; \
+ } \
+ length = draw_end ? (x1-x2+1) : (x1-x2); \
+ } \
+ while (length--) { \
+ op; \
+ ++pixel; \
+ } \
+}
+
+/* Vertical line */
+#define VLINE(type, op, draw_end) \
+{ \
+ int length; \
+ int pitch = (dst->pitch / dst->format->BytesPerPixel); \
+ type *pixel; \
+ if (y1 <= y2) { \
+ pixel = (type *)dst->pixels + y1 * pitch + x1; \
+ length = draw_end ? (y2-y1+1) : (y2-y1); \
+ } else { \
+ pixel = (type *)dst->pixels + y2 * pitch + x1; \
+ if (!draw_end) { \
+ pixel += pitch; \
+ } \
+ length = draw_end ? (y1-y2+1) : (y1-y2); \
+ } \
+ while (length--) { \
+ op; \
+ pixel += pitch; \
+ } \
+}
+
+/* Diagonal line */
+#define DLINE(type, op, draw_end) \
+{ \
+ int length; \
+ int pitch = (dst->pitch / dst->format->BytesPerPixel); \
+ type *pixel; \
+ if (y1 <= y2) { \
+ pixel = (type *)dst->pixels + y1 * pitch + x1; \
+ if (x1 <= x2) { \
+ ++pitch; \
+ } else { \
+ --pitch; \
+ } \
+ length = (y2-y1); \
+ } else { \
+ pixel = (type *)dst->pixels + y2 * pitch + x2; \
+ if (x2 <= x1) { \
+ ++pitch; \
+ } else { \
+ --pitch; \
+ } \
+ if (!draw_end) { \
+ pixel += pitch; \
+ } \
+ length = (y1-y2); \
+ } \
+ if (draw_end) { \
+ ++length; \
+ } \
+ while (length--) { \
+ op; \
+ pixel += pitch; \
+ } \
+}
+
+/* Bresenham's line algorithm */
+#define BLINE(x1, y1, x2, y2, op, draw_end) \
+{ \
+ int i, deltax, deltay, numpixels; \
+ int d, dinc1, dinc2; \
+ int x, xinc1, xinc2; \
+ int y, yinc1, yinc2; \
+ \
+ deltax = ABS(x2 - x1); \
+ deltay = ABS(y2 - y1); \
+ \
+ if (deltax >= deltay) { \
+ numpixels = deltax + 1; \
+ d = (2 * deltay) - deltax; \
+ dinc1 = deltay * 2; \
+ dinc2 = (deltay - deltax) * 2; \
+ xinc1 = 1; \
+ xinc2 = 1; \
+ yinc1 = 0; \
+ yinc2 = 1; \
+ } else { \
+ numpixels = deltay + 1; \
+ d = (2 * deltax) - deltay; \
+ dinc1 = deltax * 2; \
+ dinc2 = (deltax - deltay) * 2; \
+ xinc1 = 0; \
+ xinc2 = 1; \
+ yinc1 = 1; \
+ yinc2 = 1; \
+ } \
+ \
+ if (x1 > x2) { \
+ xinc1 = -xinc1; \
+ xinc2 = -xinc2; \
+ } \
+ if (y1 > y2) { \
+ yinc1 = -yinc1; \
+ yinc2 = -yinc2; \
+ } \
+ \
+ x = x1; \
+ y = y1; \
+ \
+ if (!draw_end) { \
+ --numpixels; \
+ } \
+ for (i = 0; i < numpixels; ++i) { \
+ op(x, y); \
+ if (d < 0) { \
+ d += dinc1; \
+ x += xinc1; \
+ y += yinc1; \
+ } else { \
+ d += dinc2; \
+ x += xinc2; \
+ y += yinc2; \
+ } \
+ } \
+}
+
+/* Xiaolin Wu's line algorithm, based on Michael Abrash's implementation */
+#define WULINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
+{ \
+ Uint16 ErrorAdj, ErrorAcc; \
+ Uint16 ErrorAccTemp, Weighting; \
+ int DeltaX, DeltaY, Temp, XDir; \
+ unsigned r, g, b, a, inva; \
+ \
+ /* Draw the initial pixel, which is always exactly intersected by \
+ the line and so needs no weighting */ \
+ opaque_op(x1, y1); \
+ \
+ /* Draw the final pixel, which is always exactly intersected by the line \
+ and so needs no weighting */ \
+ if (draw_end) { \
+ opaque_op(x2, y2); \
+ } \
+ \
+ /* Make sure the line runs top to bottom */ \
+ if (y1 > y2) { \
+ Temp = y1; y1 = y2; y2 = Temp; \
+ Temp = x1; x1 = x2; x2 = Temp; \
+ } \
+ DeltaY = y2 - y1; \
+ \
+ if ((DeltaX = x2 - x1) >= 0) { \
+ XDir = 1; \
+ } else { \
+ XDir = -1; \
+ DeltaX = -DeltaX; /* make DeltaX positive */ \
+ } \
+ \
+ /* line is not horizontal, diagonal, or vertical */ \
+ ErrorAcc = 0; /* initialize the line error accumulator to 0 */ \
+ \
+ /* Is this an X-major or Y-major line? */ \
+ if (DeltaY > DeltaX) { \
+ /* Y-major line; calculate 16-bit fixed-point fractional part of a \
+ pixel that X advances each time Y advances 1 pixel, truncating the \
+ result so that we won't overrun the endpoint along the X axis */ \
+ ErrorAdj = ((unsigned long) DeltaX << 16) / (unsigned long) DeltaY; \
+ /* Draw all pixels other than the first and last */ \
+ while (--DeltaY) { \
+ ErrorAccTemp = ErrorAcc; /* remember currrent accumulated error */ \
+ ErrorAcc += ErrorAdj; /* calculate error for next pixel */ \
+ if (ErrorAcc <= ErrorAccTemp) { \
+ /* The error accumulator turned over, so advance the X coord */ \
+ x1 += XDir; \
+ } \
+ y1++; /* Y-major, so always advance Y */ \
+ /* The IntensityBits most significant bits of ErrorAcc give us the \
+ intensity weighting for this pixel, and the complement of the \
+ weighting for the paired pixel */ \
+ Weighting = ErrorAcc >> 8; \
+ { \
+ a = DRAW_MUL(_a, (Weighting ^ 255)); \
+ r = DRAW_MUL(_r, a); \
+ g = DRAW_MUL(_g, a); \
+ b = DRAW_MUL(_b, a); \
+ inva = (a ^ 0xFF); \
+ blend_op(x1, y1); \
+ } \
+ { \
+ a = DRAW_MUL(_a, Weighting); \
+ r = DRAW_MUL(_r, a); \
+ g = DRAW_MUL(_g, a); \
+ b = DRAW_MUL(_b, a); \
+ inva = (a ^ 0xFF); \
+ blend_op(x1 + XDir, y1); \
+ } \
+ } \
+ } else { \
+ /* X-major line; calculate 16-bit fixed-point fractional part of a \
+ pixel that Y advances each time X advances 1 pixel, truncating the \
+ result to avoid overrunning the endpoint along the X axis */ \
+ ErrorAdj = ((unsigned long) DeltaY << 16) / (unsigned long) DeltaX; \
+ /* Draw all pixels other than the first and last */ \
+ while (--DeltaX) { \
+ ErrorAccTemp = ErrorAcc; /* remember currrent accumulated error */ \
+ ErrorAcc += ErrorAdj; /* calculate error for next pixel */ \
+ if (ErrorAcc <= ErrorAccTemp) { \
+ /* The error accumulator turned over, so advance the Y coord */ \
+ y1++; \
+ } \
+ x1 += XDir; /* X-major, so always advance X */ \
+ /* The IntensityBits most significant bits of ErrorAcc give us the \
+ intensity weighting for this pixel, and the complement of the \
+ weighting for the paired pixel */ \
+ Weighting = ErrorAcc >> 8; \
+ { \
+ a = DRAW_MUL(_a, (Weighting ^ 255)); \
+ r = DRAW_MUL(_r, a); \
+ g = DRAW_MUL(_g, a); \
+ b = DRAW_MUL(_b, a); \
+ inva = (a ^ 0xFF); \
+ blend_op(x1, y1); \
+ } \
+ { \
+ a = DRAW_MUL(_a, Weighting); \
+ r = DRAW_MUL(_r, a); \
+ g = DRAW_MUL(_g, a); \
+ b = DRAW_MUL(_b, a); \
+ inva = (a ^ 0xFF); \
+ blend_op(x1, y1 + 1); \
+ } \
+ } \
+ } \
+}
+
+#ifdef AA_LINES
+#define AALINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
+ WULINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end)
+#else
+#define AALINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
+ BLINE(x1, y1, x2, y2, opaque_op, draw_end)
+#endif
+
+/*
+ * Define fill rect macro
+ */
+
+#define FILLRECT(type, op) \
+do { \
+ int width = rect->w; \
+ int height = rect->h; \
+ int pitch = (dst->pitch / dst->format->BytesPerPixel); \
+ int skip = pitch - width; \
+ type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
+ while (height--) { \
+ { int n = (width+3)/4; \
+ switch (width & 3) { \
+ case 0: do { op; pixel++; /* fallthrough */ \
+ case 3: op; pixel++; /* fallthrough */ \
+ case 2: op; pixel++; /* fallthrough */ \
+ case 1: op; pixel++; /* fallthrough */ \
+ } while ( --n > 0 ); \
+ } \
+ } \
+ pixel += skip; \
+ } \
+} while (0)
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_drawline.c b/src/3rdparty/SDL2/src/render/software/SDL_drawline.c
new file mode 100644
index 0000000..eeb54ed
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_drawline.c
@@ -0,0 +1,209 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if !SDL_RENDER_DISABLED
+
+#include "SDL_draw.h"
+#include "SDL_drawline.h"
+#include "SDL_drawpoint.h"
+
+
+static void
+SDL_DrawLine1(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color,
+ SDL_bool draw_end)
+{
+ if (y1 == y2) {
+ int length;
+ int pitch = (dst->pitch / dst->format->BytesPerPixel);
+ Uint8 *pixel;
+ if (x1 <= x2) {
+ pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
+ length = draw_end ? (x2-x1+1) : (x2-x1);
+ } else {
+ pixel = (Uint8 *)dst->pixels + y1 * pitch + x2;
+ if (!draw_end) {
+ ++pixel;
+ }
+ length = draw_end ? (x1-x2+1) : (x1-x2);
+ }
+ SDL_memset(pixel, color, length);
+ } else if (x1 == x2) {
+ VLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end);
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ DLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end);
+ } else {
+ BLINE(x1, y1, x2, y2, DRAW_FASTSETPIXELXY1, draw_end);
+ }
+}
+
+static void
+SDL_DrawLine2(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color,
+ SDL_bool draw_end)
+{
+ if (y1 == y2) {
+ HLINE(Uint16, DRAW_FASTSETPIXEL2, draw_end);
+ } else if (x1 == x2) {
+ VLINE(Uint16, DRAW_FASTSETPIXEL2, draw_end);
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ DLINE(Uint16, DRAW_FASTSETPIXEL2, draw_end);
+ } else {
+ Uint8 _r, _g, _b, _a;
+ const SDL_PixelFormat * fmt = dst->format;
+ SDL_GetRGBA(color, fmt, &_r, &_g, &_b, &_a);
+ if (fmt->Rmask == 0x7C00) {
+ AALINE(x1, y1, x2, y2,
+ DRAW_FASTSETPIXELXY2, DRAW_SETPIXELXY_BLEND_RGB555,
+ draw_end);
+ } else if (fmt->Rmask == 0xF800) {
+ AALINE(x1, y1, x2, y2,
+ DRAW_FASTSETPIXELXY2, DRAW_SETPIXELXY_BLEND_RGB565,
+ draw_end);
+ } else {
+ AALINE(x1, y1, x2, y2,
+ DRAW_FASTSETPIXELXY2, DRAW_SETPIXELXY2_BLEND_RGB,
+ draw_end);
+ }
+ }
+}
+
+static void
+SDL_DrawLine4(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color,
+ SDL_bool draw_end)
+{
+ if (y1 == y2) {
+ HLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
+ } else if (x1 == x2) {
+ VLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
+ } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+ DLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
+ } else {
+ Uint8 _r, _g, _b, _a;
+ const SDL_PixelFormat * fmt = dst->format;
+ SDL_GetRGBA(color, fmt, &_r, &_g, &_b, &_a);
+ if (fmt->Rmask == 0x00FF0000) {
+ if (!fmt->Amask) {
+ AALINE(x1, y1, x2, y2,
+ DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY_BLEND_RGB888,
+ draw_end);
+ } else {
+ AALINE(x1, y1, x2, y2,
+ DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY_BLEND_ARGB8888,
+ draw_end);
+ }
+ } else {
+ AALINE(x1, y1, x2, y2,
+ DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY4_BLEND_RGB,
+ draw_end);
+ }
+ }
+}
+
+typedef void (*DrawLineFunc) (SDL_Surface * dst,
+ int x1, int y1, int x2, int y2,
+ Uint32 color, SDL_bool draw_end);
+
+static DrawLineFunc
+SDL_CalculateDrawLineFunc(const SDL_PixelFormat * fmt)
+{
+ switch (fmt->BytesPerPixel) {
+ case 1:
+ if (fmt->BitsPerPixel < 8) {
+ break;
+ }
+ return SDL_DrawLine1;
+ case 2:
+ return SDL_DrawLine2;
+ case 4:
+ return SDL_DrawLine4;
+ }
+ return NULL;
+}
+
+int
+SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color)
+{
+ DrawLineFunc func;
+
+ if (!dst) {
+ return SDL_SetError("SDL_DrawLine(): Passed NULL destination surface");
+ }
+
+ func = SDL_CalculateDrawLineFunc(dst->format);
+ if (!func) {
+ return SDL_SetError("SDL_DrawLine(): Unsupported surface format");
+ }
+
+ /* Perform clipping */
+ /* FIXME: We don't actually want to clip, as it may change line slope */
+ if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
+ return 0;
+ }
+
+ func(dst, x1, y1, x2, y2, color, SDL_TRUE);
+ return 0;
+}
+
+int
+SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count,
+ Uint32 color)
+{
+ int i;
+ int x1, y1;
+ int x2, y2;
+ SDL_bool draw_end;
+ DrawLineFunc func;
+
+ if (!dst) {
+ return SDL_SetError("SDL_DrawLines(): Passed NULL destination surface");
+ }
+
+ func = SDL_CalculateDrawLineFunc(dst->format);
+ if (!func) {
+ return SDL_SetError("SDL_DrawLines(): Unsupported surface format");
+ }
+
+ for (i = 1; i < count; ++i) {
+ x1 = points[i-1].x;
+ y1 = points[i-1].y;
+ x2 = points[i].x;
+ y2 = points[i].y;
+
+ /* Perform clipping */
+ /* FIXME: We don't actually want to clip, as it may change line slope */
+ if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
+ continue;
+ }
+
+ /* Draw the end if it was clipped */
+ draw_end = (x2 != points[i].x || y2 != points[i].y);
+
+ func(dst, x1, y1, x2, y2, color, draw_end);
+ }
+ if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
+ SDL_DrawPoint(dst, points[count-1].x, points[count-1].y, color);
+ }
+ return 0;
+}
+
+#endif /* !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_drawline.h b/src/3rdparty/SDL2/src/render/software/SDL_drawline.h
new file mode 100644
index 0000000..9395d50
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_drawline.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+
+extern int SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color);
+extern int SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_drawpoint.c b/src/3rdparty/SDL2/src/render/software/SDL_drawpoint.c
new file mode 100644
index 0000000..64a4e52
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_drawpoint.c
@@ -0,0 +1,114 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if !SDL_RENDER_DISABLED
+
+#include "SDL_draw.h"
+#include "SDL_drawpoint.h"
+
+
+int
+SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color)
+{
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
+ }
+
+ /* Perform clipping */
+ if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
+ x >= (dst->clip_rect.x + dst->clip_rect.w) ||
+ y >= (dst->clip_rect.y + dst->clip_rect.h)) {
+ return 0;
+ }
+
+ switch (dst->format->BytesPerPixel) {
+ case 1:
+ DRAW_FASTSETPIXELXY1(x, y);
+ break;
+ case 2:
+ DRAW_FASTSETPIXELXY2(x, y);
+ break;
+ case 3:
+ return SDL_Unsupported();
+ case 4:
+ DRAW_FASTSETPIXELXY4(x, y);
+ break;
+ }
+ return 0;
+}
+
+int
+SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count,
+ Uint32 color)
+{
+ int minx, miny;
+ int maxx, maxy;
+ int i;
+ int x, y;
+
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
+ }
+
+ minx = dst->clip_rect.x;
+ maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
+ miny = dst->clip_rect.y;
+ maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
+
+ for (i = 0; i < count; ++i) {
+ x = points[i].x;
+ y = points[i].y;
+
+ if (x < minx || x > maxx || y < miny || y > maxy) {
+ continue;
+ }
+
+ switch (dst->format->BytesPerPixel) {
+ case 1:
+ DRAW_FASTSETPIXELXY1(x, y);
+ break;
+ case 2:
+ DRAW_FASTSETPIXELXY2(x, y);
+ break;
+ case 3:
+ return SDL_Unsupported();
+ case 4:
+ DRAW_FASTSETPIXELXY4(x, y);
+ break;
+ }
+ }
+ return 0;
+}
+
+#endif /* !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_drawpoint.h b/src/3rdparty/SDL2/src/render/software/SDL_drawpoint.h
new file mode 100644
index 0000000..c366700
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_drawpoint.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+
+extern int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color);
+extern int SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_render_sw.c b/src/3rdparty/SDL2/src/render/software/SDL_render_sw.c
new file mode 100644
index 0000000..89e54b8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_render_sw.c
@@ -0,0 +1,894 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if !SDL_RENDER_DISABLED
+
+#include "../SDL_sysrender.h"
+#include "SDL_render_sw_c.h"
+#include "SDL_hints.h"
+
+#include "SDL_draw.h"
+#include "SDL_blendfillrect.h"
+#include "SDL_blendline.h"
+#include "SDL_blendpoint.h"
+#include "SDL_drawline.h"
+#include "SDL_drawpoint.h"
+#include "SDL_rotate.h"
+
+/* SDL surface based renderer implementation */
+
+static SDL_Renderer *SW_CreateRenderer(SDL_Window * window, Uint32 flags);
+static void SW_WindowEvent(SDL_Renderer * renderer,
+ const SDL_WindowEvent *event);
+static int SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
+static int SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int SW_SetTextureColorMod(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int SW_SetTextureAlphaMod(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int SW_SetTextureBlendMode(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch);
+static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static int SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+static int SW_UpdateViewport(SDL_Renderer * renderer);
+static int SW_UpdateClipRect(SDL_Renderer * renderer);
+static int SW_RenderClear(SDL_Renderer * renderer);
+static int SW_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int SW_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int SW_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
+static int SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
+static int SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch);
+static void SW_RenderPresent(SDL_Renderer * renderer);
+static void SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static void SW_DestroyRenderer(SDL_Renderer * renderer);
+
+
+SDL_RenderDriver SW_RenderDriver = {
+ SW_CreateRenderer,
+ {
+ "software",
+ SDL_RENDERER_SOFTWARE | SDL_RENDERER_TARGETTEXTURE,
+ 8,
+ {
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_PIXELFORMAT_ABGR8888,
+ SDL_PIXELFORMAT_RGBA8888,
+ SDL_PIXELFORMAT_BGRA8888,
+ SDL_PIXELFORMAT_RGB888,
+ SDL_PIXELFORMAT_BGR888,
+ SDL_PIXELFORMAT_RGB565,
+ SDL_PIXELFORMAT_RGB555
+ },
+ 0,
+ 0}
+};
+
+typedef struct
+{
+ SDL_Surface *surface;
+ SDL_Surface *window;
+} SW_RenderData;
+
+
+static SDL_Surface *
+SW_ActivateRenderer(SDL_Renderer * renderer)
+{
+ SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+
+ if (!data->surface) {
+ data->surface = data->window;
+ }
+ if (!data->surface) {
+ SDL_Surface *surface = SDL_GetWindowSurface(renderer->window);
+ if (surface) {
+ data->surface = data->window = surface;
+
+ SW_UpdateViewport(renderer);
+ SW_UpdateClipRect(renderer);
+ }
+ }
+ return data->surface;
+}
+
+SDL_Renderer *
+SW_CreateRendererForSurface(SDL_Surface * surface)
+{
+ SDL_Renderer *renderer;
+ SW_RenderData *data;
+
+ if (!surface) {
+ SDL_SetError("Can't create renderer for NULL surface");
+ return NULL;
+ }
+
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
+ if (!renderer) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ data = (SW_RenderData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ SW_DestroyRenderer(renderer);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ data->surface = surface;
+ data->window = surface;
+
+ renderer->WindowEvent = SW_WindowEvent;
+ renderer->GetOutputSize = SW_GetOutputSize;
+ renderer->CreateTexture = SW_CreateTexture;
+ renderer->SetTextureColorMod = SW_SetTextureColorMod;
+ renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod;
+ renderer->SetTextureBlendMode = SW_SetTextureBlendMode;
+ renderer->UpdateTexture = SW_UpdateTexture;
+ renderer->LockTexture = SW_LockTexture;
+ renderer->UnlockTexture = SW_UnlockTexture;
+ renderer->SetRenderTarget = SW_SetRenderTarget;
+ renderer->UpdateViewport = SW_UpdateViewport;
+ renderer->UpdateClipRect = SW_UpdateClipRect;
+ renderer->RenderClear = SW_RenderClear;
+ renderer->RenderDrawPoints = SW_RenderDrawPoints;
+ renderer->RenderDrawLines = SW_RenderDrawLines;
+ renderer->RenderFillRects = SW_RenderFillRects;
+ renderer->RenderCopy = SW_RenderCopy;
+ renderer->RenderCopyEx = SW_RenderCopyEx;
+ renderer->RenderReadPixels = SW_RenderReadPixels;
+ renderer->RenderPresent = SW_RenderPresent;
+ renderer->DestroyTexture = SW_DestroyTexture;
+ renderer->DestroyRenderer = SW_DestroyRenderer;
+ renderer->info = SW_RenderDriver.info;
+ renderer->driverdata = data;
+
+ SW_ActivateRenderer(renderer);
+
+ return renderer;
+}
+
+SDL_Renderer *
+SW_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+ SDL_Surface *surface;
+
+ surface = SDL_GetWindowSurface(window);
+ if (!surface) {
+ return NULL;
+ }
+ return SW_CreateRendererForSurface(surface);
+}
+
+static void
+SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
+ data->surface = NULL;
+ data->window = NULL;
+ }
+}
+
+static int
+SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+
+ if (surface) {
+ if (w) {
+ *w = surface->w;
+ }
+ if (h) {
+ *h = surface->h;
+ }
+ return 0;
+ } else {
+ SDL_SetError("Software renderer doesn't have an output surface");
+ return -1;
+ }
+}
+
+static int
+SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ if (!SDL_PixelFormatEnumToMasks
+ (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
+ return SDL_SetError("Unknown texture format");
+ }
+
+ texture->driverdata =
+ SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask,
+ Bmask, Amask);
+ SDL_SetSurfaceColorMod(texture->driverdata, texture->r, texture->g,
+ texture->b);
+ SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a);
+ SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode);
+
+ /* Only RLE encode textures without an alpha channel since the RLE coder
+ * discards the color values of pixels with an alpha value of zero.
+ */
+ if (texture->access == SDL_TEXTUREACCESS_STATIC && !Amask) {
+ SDL_SetSurfaceRLE(texture->driverdata, 1);
+ }
+
+ if (!texture->driverdata) {
+ return -1;
+ }
+ return 0;
+}
+
+static int
+SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ /* If the color mod is ever enabled (non-white), permanently disable RLE (which doesn't support
+ * color mod) to avoid potentially frequent RLE encoding/decoding.
+ */
+ if ((texture->r & texture->g & texture->b) != 255) {
+ SDL_SetSurfaceRLE(surface, 0);
+ }
+ return SDL_SetSurfaceColorMod(surface, texture->r, texture->g,
+ texture->b);
+}
+
+static int
+SW_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ /* If the texture ever has multiple alpha values (surface alpha plus alpha channel), permanently
+ * disable RLE (which doesn't support this) to avoid potentially frequent RLE encoding/decoding.
+ */
+ if (texture->a != 255 && surface->format->Amask) {
+ SDL_SetSurfaceRLE(surface, 0);
+ }
+ return SDL_SetSurfaceAlphaMod(surface, texture->a);
+}
+
+static int
+SW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ /* If add or mod blending are ever enabled, permanently disable RLE (which doesn't support
+ * them) to avoid potentially frequent RLE encoding/decoding.
+ */
+ if ((texture->blendMode == SDL_BLENDMODE_ADD || texture->blendMode == SDL_BLENDMODE_MOD)) {
+ SDL_SetSurfaceRLE(surface, 0);
+ }
+ return SDL_SetSurfaceBlendMode(surface, texture->blendMode);
+}
+
+static int
+SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ Uint8 *src, *dst;
+ int row;
+ size_t length;
+
+ if(SDL_MUSTLOCK(surface))
+ SDL_LockSurface(surface);
+ src = (Uint8 *) pixels;
+ dst = (Uint8 *) surface->pixels +
+ rect->y * surface->pitch +
+ rect->x * surface->format->BytesPerPixel;
+ length = rect->w * surface->format->BytesPerPixel;
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += surface->pitch;
+ }
+ if(SDL_MUSTLOCK(surface))
+ SDL_UnlockSurface(surface);
+ return 0;
+}
+
+static int
+SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+
+ *pixels =
+ (void *) ((Uint8 *) surface->pixels + rect->y * surface->pitch +
+ rect->x * surface->format->BytesPerPixel);
+ *pitch = surface->pitch;
+ return 0;
+}
+
+static void
+SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+}
+
+static int
+SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+
+ if (texture ) {
+ data->surface = (SDL_Surface *) texture->driverdata;
+ } else {
+ data->surface = data->window;
+ }
+ return 0;
+}
+
+static int
+SW_UpdateViewport(SDL_Renderer * renderer)
+{
+ SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+ SDL_Surface *surface = data->surface;
+
+ if (!surface) {
+ /* We'll update the viewport after we recreate the surface */
+ return 0;
+ }
+
+ SDL_SetClipRect(data->surface, &renderer->viewport);
+ return 0;
+}
+
+static int
+SW_UpdateClipRect(SDL_Renderer * renderer)
+{
+ SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+ SDL_Surface *surface = data->surface;
+ if (surface) {
+ if (renderer->clipping_enabled) {
+ SDL_Rect clip_rect;
+ clip_rect = renderer->clip_rect;
+ clip_rect.x += renderer->viewport.x;
+ clip_rect.y += renderer->viewport.y;
+ SDL_IntersectRect(&renderer->viewport, &clip_rect, &clip_rect);
+ SDL_SetClipRect(surface, &clip_rect);
+ } else {
+ SDL_SetClipRect(surface, &renderer->viewport);
+ }
+ }
+ return 0;
+}
+
+static int
+SW_RenderClear(SDL_Renderer * renderer)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ Uint32 color;
+ SDL_Rect clip_rect;
+
+ if (!surface) {
+ return -1;
+ }
+
+ color = SDL_MapRGBA(surface->format,
+ renderer->r, renderer->g, renderer->b, renderer->a);
+
+ /* By definition the clear ignores the clip rect */
+ clip_rect = surface->clip_rect;
+ SDL_SetClipRect(surface, NULL);
+ SDL_FillRect(surface, NULL, color);
+ SDL_SetClipRect(surface, &clip_rect);
+ return 0;
+}
+
+static int
+SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ SDL_Point *final_points;
+ int i, status;
+
+ if (!surface) {
+ return -1;
+ }
+
+ final_points = SDL_stack_alloc(SDL_Point, count);
+ if (!final_points) {
+ return SDL_OutOfMemory();
+ }
+ if (renderer->viewport.x || renderer->viewport.y) {
+ int x = renderer->viewport.x;
+ int y = renderer->viewport.y;
+
+ for (i = 0; i < count; ++i) {
+ final_points[i].x = (int)(x + points[i].x);
+ final_points[i].y = (int)(y + points[i].y);
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ final_points[i].x = (int)points[i].x;
+ final_points[i].y = (int)points[i].y;
+ }
+ }
+
+ /* Draw the points! */
+ if (renderer->blendMode == SDL_BLENDMODE_NONE) {
+ Uint32 color = SDL_MapRGBA(surface->format,
+ renderer->r, renderer->g, renderer->b,
+ renderer->a);
+
+ status = SDL_DrawPoints(surface, final_points, count, color);
+ } else {
+ status = SDL_BlendPoints(surface, final_points, count,
+ renderer->blendMode,
+ renderer->r, renderer->g, renderer->b,
+ renderer->a);
+ }
+ SDL_stack_free(final_points);
+
+ return status;
+}
+
+static int
+SW_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
+ int count)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ SDL_Point *final_points;
+ int i, status;
+
+ if (!surface) {
+ return -1;
+ }
+
+ final_points = SDL_stack_alloc(SDL_Point, count);
+ if (!final_points) {
+ return SDL_OutOfMemory();
+ }
+ if (renderer->viewport.x || renderer->viewport.y) {
+ int x = renderer->viewport.x;
+ int y = renderer->viewport.y;
+
+ for (i = 0; i < count; ++i) {
+ final_points[i].x = (int)(x + points[i].x);
+ final_points[i].y = (int)(y + points[i].y);
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ final_points[i].x = (int)points[i].x;
+ final_points[i].y = (int)points[i].y;
+ }
+ }
+
+ /* Draw the lines! */
+ if (renderer->blendMode == SDL_BLENDMODE_NONE) {
+ Uint32 color = SDL_MapRGBA(surface->format,
+ renderer->r, renderer->g, renderer->b,
+ renderer->a);
+
+ status = SDL_DrawLines(surface, final_points, count, color);
+ } else {
+ status = SDL_BlendLines(surface, final_points, count,
+ renderer->blendMode,
+ renderer->r, renderer->g, renderer->b,
+ renderer->a);
+ }
+ SDL_stack_free(final_points);
+
+ return status;
+}
+
+static int
+SW_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ SDL_Rect *final_rects;
+ int i, status;
+
+ if (!surface) {
+ return -1;
+ }
+
+ final_rects = SDL_stack_alloc(SDL_Rect, count);
+ if (!final_rects) {
+ return SDL_OutOfMemory();
+ }
+ if (renderer->viewport.x || renderer->viewport.y) {
+ int x = renderer->viewport.x;
+ int y = renderer->viewport.y;
+
+ for (i = 0; i < count; ++i) {
+ final_rects[i].x = (int)(x + rects[i].x);
+ final_rects[i].y = (int)(y + rects[i].y);
+ final_rects[i].w = SDL_max((int)rects[i].w, 1);
+ final_rects[i].h = SDL_max((int)rects[i].h, 1);
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ final_rects[i].x = (int)rects[i].x;
+ final_rects[i].y = (int)rects[i].y;
+ final_rects[i].w = SDL_max((int)rects[i].w, 1);
+ final_rects[i].h = SDL_max((int)rects[i].h, 1);
+ }
+ }
+
+ if (renderer->blendMode == SDL_BLENDMODE_NONE) {
+ Uint32 color = SDL_MapRGBA(surface->format,
+ renderer->r, renderer->g, renderer->b,
+ renderer->a);
+ status = SDL_FillRects(surface, final_rects, count, color);
+ } else {
+ status = SDL_BlendFillRects(surface, final_rects, count,
+ renderer->blendMode,
+ renderer->r, renderer->g, renderer->b,
+ renderer->a);
+ }
+ SDL_stack_free(final_rects);
+
+ return status;
+}
+
+static int
+SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ SDL_Surface *src = (SDL_Surface *) texture->driverdata;
+ SDL_Rect final_rect;
+
+ if (!surface) {
+ return -1;
+ }
+
+ if (renderer->viewport.x || renderer->viewport.y) {
+ final_rect.x = (int)(renderer->viewport.x + dstrect->x);
+ final_rect.y = (int)(renderer->viewport.y + dstrect->y);
+ } else {
+ final_rect.x = (int)dstrect->x;
+ final_rect.y = (int)dstrect->y;
+ }
+ final_rect.w = (int)dstrect->w;
+ final_rect.h = (int)dstrect->h;
+
+ if ( srcrect->w == final_rect.w && srcrect->h == final_rect.h ) {
+ return SDL_BlitSurface(src, srcrect, surface, &final_rect);
+ } else {
+ /* If scaling is ever done, permanently disable RLE (which doesn't support scaling)
+ * to avoid potentially frequent RLE encoding/decoding.
+ */
+ SDL_SetSurfaceRLE(surface, 0);
+ return SDL_BlitScaled(src, srcrect, surface, &final_rect);
+ }
+}
+
+static int
+GetScaleQuality(void)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+ if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+static int
+SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ SDL_Surface *src = (SDL_Surface *) texture->driverdata;
+ SDL_Rect final_rect, tmp_rect;
+ SDL_Surface *src_clone, *src_rotated, *src_scaled;
+ SDL_Surface *mask = NULL, *mask_rotated = NULL;
+ int retval = 0, dstwidth, dstheight, abscenterx, abscentery;
+ double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y;
+ SDL_BlendMode blendmode;
+ Uint8 alphaMod, rMod, gMod, bMod;
+ int applyModulation = SDL_FALSE;
+ int blitRequired = SDL_FALSE;
+ int isOpaque = SDL_FALSE;
+
+ if (!surface) {
+ return -1;
+ }
+
+ if (renderer->viewport.x || renderer->viewport.y) {
+ final_rect.x = (int)(renderer->viewport.x + dstrect->x);
+ final_rect.y = (int)(renderer->viewport.y + dstrect->y);
+ } else {
+ final_rect.x = (int)dstrect->x;
+ final_rect.y = (int)dstrect->y;
+ }
+ final_rect.w = (int)dstrect->w;
+ final_rect.h = (int)dstrect->h;
+
+ tmp_rect = final_rect;
+ tmp_rect.x = 0;
+ tmp_rect.y = 0;
+
+ /* It is possible to encounter an RLE encoded surface here and locking it is
+ * necessary because this code is going to access the pixel buffer directly.
+ */
+ if (SDL_MUSTLOCK(src)) {
+ SDL_LockSurface(src);
+ }
+
+ /* Clone the source surface but use its pixel buffer directly.
+ * The original source surface must be treated as read-only.
+ */
+ src_clone = SDL_CreateRGBSurfaceFrom(src->pixels, src->w, src->h, src->format->BitsPerPixel, src->pitch,
+ src->format->Rmask, src->format->Gmask,
+ src->format->Bmask, src->format->Amask);
+ if (src_clone == NULL) {
+ if (SDL_MUSTLOCK(src)) {
+ SDL_UnlockSurface(src);
+ }
+ return -1;
+ }
+
+ SDL_GetSurfaceBlendMode(src, &blendmode);
+ SDL_GetSurfaceAlphaMod(src, &alphaMod);
+ SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
+
+ /* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */
+ if (src->format->BitsPerPixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) {
+ blitRequired = SDL_TRUE;
+ }
+
+ /* If scaling and cropping is necessary, it has to be taken care of before the rotation. */
+ if (!(srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0)) {
+ blitRequired = SDL_TRUE;
+ }
+
+ /* The color and alpha modulation has to be applied before the rotation when using the NONE and MOD blend modes. */
+ if ((blendmode == SDL_BLENDMODE_NONE || blendmode == SDL_BLENDMODE_MOD) && (alphaMod & rMod & gMod & bMod) != 255) {
+ applyModulation = SDL_TRUE;
+ SDL_SetSurfaceAlphaMod(src_clone, alphaMod);
+ SDL_SetSurfaceColorMod(src_clone, rMod, gMod, bMod);
+ }
+
+ /* Opaque surfaces are much easier to handle with the NONE blend mode. */
+ if (blendmode == SDL_BLENDMODE_NONE && !src->format->Amask && alphaMod == 255) {
+ isOpaque = SDL_TRUE;
+ }
+
+ /* The NONE blend mode requires a mask for non-opaque surfaces. This mask will be used
+ * to clear the pixels in the destination surface. The other steps are explained below.
+ */
+ if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) {
+ mask = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32,
+ 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
+ if (mask == NULL) {
+ retval = -1;
+ } else {
+ SDL_SetSurfaceBlendMode(mask, SDL_BLENDMODE_MOD);
+ }
+ }
+
+ /* Create a new surface should there be a format mismatch or if scaling, cropping,
+ * or modulation is required. It's possible to use the source surface directly otherwise.
+ */
+ if (!retval && (blitRequired || applyModulation)) {
+ SDL_Rect scale_rect = tmp_rect;
+ src_scaled = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32,
+ 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
+ if (src_scaled == NULL) {
+ retval = -1;
+ } else {
+ SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE);
+ retval = SDL_BlitScaled(src_clone, srcrect, src_scaled, &scale_rect);
+ SDL_FreeSurface(src_clone);
+ src_clone = src_scaled;
+ src_scaled = NULL;
+ }
+ }
+
+ /* SDLgfx_rotateSurface is going to make decisions depending on the blend mode. */
+ SDL_SetSurfaceBlendMode(src_clone, blendmode);
+
+ if (!retval) {
+ SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle);
+ src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
+ if (src_rotated == NULL) {
+ retval = -1;
+ }
+ if (!retval && mask != NULL) {
+ /* The mask needed for the NONE blend mode gets rotated with the same parameters. */
+ mask_rotated = SDLgfx_rotateSurface(mask, angle, dstwidth/2, dstheight/2, SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle);
+ if (mask_rotated == NULL) {
+ retval = -1;
+ }
+ }
+ if (!retval) {
+ /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */
+ abscenterx = final_rect.x + (int)center->x;
+ abscentery = final_rect.y + (int)center->y;
+ /* Compensate the angle inversion to match the behaviour of the other backends */
+ sangle = -sangle;
+
+ /* Top Left */
+ px = final_rect.x - abscenterx;
+ py = final_rect.y - abscentery;
+ p1x = px * cangle - py * sangle + abscenterx;
+ p1y = px * sangle + py * cangle + abscentery;
+
+ /* Top Right */
+ px = final_rect.x + final_rect.w - abscenterx;
+ py = final_rect.y - abscentery;
+ p2x = px * cangle - py * sangle + abscenterx;
+ p2y = px * sangle + py * cangle + abscentery;
+
+ /* Bottom Left */
+ px = final_rect.x - abscenterx;
+ py = final_rect.y + final_rect.h - abscentery;
+ p3x = px * cangle - py * sangle + abscenterx;
+ p3y = px * sangle + py * cangle + abscentery;
+
+ /* Bottom Right */
+ px = final_rect.x + final_rect.w - abscenterx;
+ py = final_rect.y + final_rect.h - abscentery;
+ p4x = px * cangle - py * sangle + abscenterx;
+ p4y = px * sangle + py * cangle + abscentery;
+
+ tmp_rect.x = (int)MIN(MIN(p1x, p2x), MIN(p3x, p4x));
+ tmp_rect.y = (int)MIN(MIN(p1y, p2y), MIN(p3y, p4y));
+ tmp_rect.w = dstwidth;
+ tmp_rect.h = dstheight;
+
+ /* The NONE blend mode needs some special care with non-opaque surfaces.
+ * Other blend modes or opaque surfaces can be blitted directly.
+ */
+ if (blendmode != SDL_BLENDMODE_NONE || isOpaque) {
+ if (applyModulation == SDL_FALSE) {
+ /* If the modulation wasn't already applied, make it happen now. */
+ SDL_SetSurfaceAlphaMod(src_rotated, alphaMod);
+ SDL_SetSurfaceColorMod(src_rotated, rMod, gMod, bMod);
+ }
+ retval = SDL_BlitSurface(src_rotated, NULL, surface, &tmp_rect);
+ } else {
+ /* The NONE blend mode requires three steps to get the pixels onto the destination surface.
+ * First, the area where the rotated pixels will be blitted to get set to zero.
+ * This is accomplished by simply blitting a mask with the NONE blend mode.
+ * The colorkey set by the rotate function will discard the correct pixels.
+ */
+ SDL_Rect mask_rect = tmp_rect;
+ SDL_SetSurfaceBlendMode(mask_rotated, SDL_BLENDMODE_NONE);
+ retval = SDL_BlitSurface(mask_rotated, NULL, surface, &mask_rect);
+ if (!retval) {
+ /* The next step copies the alpha value. This is done with the BLEND blend mode and
+ * by modulating the source colors with 0. Since the destination is all zeros, this
+ * will effectively set the destination alpha to the source alpha.
+ */
+ SDL_SetSurfaceColorMod(src_rotated, 0, 0, 0);
+ mask_rect = tmp_rect;
+ retval = SDL_BlitSurface(src_rotated, NULL, surface, &mask_rect);
+ if (!retval) {
+ /* The last step gets the color values in place. The ADD blend mode simply adds them to
+ * the destination (where the color values are all zero). However, because the ADD blend
+ * mode modulates the colors with the alpha channel, a surface without an alpha mask needs
+ * to be created. This makes all source pixels opaque and the colors get copied correctly.
+ */
+ SDL_Surface *src_rotated_rgb;
+ src_rotated_rgb = SDL_CreateRGBSurfaceFrom(src_rotated->pixels, src_rotated->w, src_rotated->h,
+ src_rotated->format->BitsPerPixel, src_rotated->pitch,
+ src_rotated->format->Rmask, src_rotated->format->Gmask,
+ src_rotated->format->Bmask, 0);
+ if (src_rotated_rgb == NULL) {
+ retval = -1;
+ } else {
+ SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD);
+ retval = SDL_BlitSurface(src_rotated_rgb, NULL, surface, &tmp_rect);
+ SDL_FreeSurface(src_rotated_rgb);
+ }
+ }
+ }
+ SDL_FreeSurface(mask_rotated);
+ }
+ if (src_rotated != NULL) {
+ SDL_FreeSurface(src_rotated);
+ }
+ }
+ }
+
+ if (SDL_MUSTLOCK(src)) {
+ SDL_UnlockSurface(src);
+ }
+ if (mask != NULL) {
+ SDL_FreeSurface(mask);
+ }
+ if (src_clone != NULL) {
+ SDL_FreeSurface(src_clone);
+ }
+ return retval;
+}
+
+static int
+SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch)
+{
+ SDL_Surface *surface = SW_ActivateRenderer(renderer);
+ Uint32 src_format;
+ void *src_pixels;
+
+ if (!surface) {
+ return -1;
+ }
+
+ /* NOTE: The rect is already adjusted according to the viewport by
+ * SDL_RenderReadPixels.
+ */
+
+ if (rect->x < 0 || rect->x+rect->w > surface->w ||
+ rect->y < 0 || rect->y+rect->h > surface->h) {
+ return SDL_SetError("Tried to read outside of surface bounds");
+ }
+
+ src_format = surface->format->format;
+ src_pixels = (void*)((Uint8 *) surface->pixels +
+ rect->y * surface->pitch +
+ rect->x * surface->format->BytesPerPixel);
+
+ return SDL_ConvertPixels(rect->w, rect->h,
+ src_format, src_pixels, surface->pitch,
+ format, pixels, pitch);
+}
+
+static void
+SW_RenderPresent(SDL_Renderer * renderer)
+{
+ SDL_Window *window = renderer->window;
+
+ if (window) {
+ SDL_UpdateWindowSurface(window);
+ }
+}
+
+static void
+SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+
+ SDL_FreeSurface(surface);
+}
+
+static void
+SW_DestroyRenderer(SDL_Renderer * renderer)
+{
+ SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+
+ SDL_free(data);
+ SDL_free(renderer);
+}
+
+#endif /* !SDL_RENDER_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_render_sw_c.h b/src/3rdparty/SDL2/src/render/software/SDL_render_sw_c.h
new file mode 100644
index 0000000..8f065de
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_render_sw_c.h
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+extern SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface * surface);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_rotate.c b/src/3rdparty/SDL2/src/render/software/SDL_rotate.c
new file mode 100644
index 0000000..4476204
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_rotate.c
@@ -0,0 +1,530 @@
+/*
+
+SDL_rotate.c: rotates 32bit or 8bit surfaces
+
+Shamelessly stolen from SDL_gfx by Andreas Schiffler. Original copyright follows:
+
+Copyright (C) 2001-2011 Andreas Schiffler
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source
+ distribution.
+
+Andreas Schiffler -- aschiffler at ferzkopp dot net
+
+*/
+#include "../../SDL_internal.h"
+
+#if defined(__WIN32__)
+#include "../../core/windows/SDL_windows.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "SDL.h"
+#include "SDL_rotate.h"
+
+/* ---- Internally used structures */
+
+/* !
+\brief A 32 bit RGBA pixel.
+*/
+typedef struct tColorRGBA {
+ Uint8 r;
+ Uint8 g;
+ Uint8 b;
+ Uint8 a;
+} tColorRGBA;
+
+/* !
+\brief A 8bit Y/palette pixel.
+*/
+typedef struct tColorY {
+ Uint8 y;
+} tColorY;
+
+/* !
+\brief Returns maximum of two numbers a and b.
+*/
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+
+/* !
+\brief Number of guard rows added to destination surfaces.
+
+This is a simple but effective workaround for observed issues.
+These rows allocate extra memory and are then hidden from the surface.
+Rows are added to the end of destination surfaces when they are allocated.
+This catches any potential overflows which seem to happen with
+just the right src image dimensions and scale/rotation and can lead
+to a situation where the program can segfault.
+*/
+#define GUARD_ROWS (2)
+
+/* !
+\brief Returns colorkey info for a surface
+*/
+static Uint32
+_colorkey(SDL_Surface *src)
+{
+ Uint32 key = 0;
+ SDL_GetColorKey(src, &key);
+ return key;
+}
+
+
+/* !
+\brief Internal target surface sizing function for rotations with trig result return.
+
+\param width The source surface width.
+\param height The source surface height.
+\param angle The angle to rotate in degrees.
+\param dstwidth The calculated width of the destination surface.
+\param dstheight The calculated height of the destination surface.
+\param cangle The sine of the angle
+\param sangle The cosine of the angle
+
+*/
+void
+SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle,
+ int *dstwidth, int *dstheight,
+ double *cangle, double *sangle)
+{
+ /* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */
+ int angle90 = (int)(angle/90);
+ if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */
+ angle90 %= 4;
+ if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
+ if(angle90 & 1) {
+ *dstwidth = height;
+ *dstheight = width;
+ *cangle = 0;
+ *sangle = angle90 == 1 ? -1 : 1; /* reversed because our rotations are clockwise */
+ } else {
+ *dstwidth = width;
+ *dstheight = height;
+ *cangle = angle90 == 0 ? 1 : -1;
+ *sangle = 0;
+ }
+ } else {
+ double x, y, cx, cy, sx, sy;
+ double radangle;
+ int dstwidthhalf, dstheighthalf;
+ /*
+ * Determine destination width and height by rotating a centered source box
+ */
+ radangle = angle * (M_PI / -180.0); /* reverse the angle because our rotations are clockwise */
+ *sangle = SDL_sin(radangle);
+ *cangle = SDL_cos(radangle);
+ x = (double)(width / 2);
+ y = (double)(height / 2);
+ cx = *cangle * x;
+ cy = *cangle * y;
+ sx = *sangle * x;
+ sy = *sangle * y;
+
+ dstwidthhalf = MAX((int)
+ SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1);
+ dstheighthalf = MAX((int)
+ SDL_ceil(MAX(MAX(MAX(SDL_fabs(sx + cy), SDL_fabs(sx - cy)), SDL_fabs(-sx + cy)), SDL_fabs(-sx - cy))), 1);
+ *dstwidth = 2 * dstwidthhalf;
+ *dstheight = 2 * dstheighthalf;
+ }
+}
+
+/* Computes source pointer X/Y increments for a rotation that's a multiple of 90 degrees. */
+static void
+computeSourceIncrements90(SDL_Surface * src, int bpp, int angle, int flipx, int flipy,
+ int *sincx, int *sincy, int *signx, int *signy)
+{
+ int pitch = flipy ? -src->pitch : src->pitch;
+ if (flipx) {
+ bpp = -bpp;
+ }
+ switch (angle) { /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
+ case 0: *sincx = bpp; *sincy = pitch - src->w * *sincx; *signx = *signy = 1; break;
+ case 1: *sincx = -pitch; *sincy = bpp - *sincx * src->h; *signx = 1; *signy = -1; break;
+ case 2: *sincx = -bpp; *sincy = -src->w * *sincx - pitch; *signx = *signy = -1; break;
+ case 3: default: *sincx = pitch; *sincy = -*sincx * src->h - bpp; *signx = -1; *signy = 1; break;
+ }
+ if (flipx) {
+ *signx = -*signx;
+ }
+ if (flipy) {
+ *signy = -*signy;
+ }
+}
+
+/* Performs a relatively fast rotation/flip when the angle is a multiple of 90 degrees. */
+#define TRANSFORM_SURFACE_90(pixelType) \
+ int dy, dincy = dst->pitch - dst->w*sizeof(pixelType), sincx, sincy, signx, signy; \
+ Uint8 *sp = (Uint8*)src->pixels, *dp = (Uint8*)dst->pixels, *de; \
+ \
+ computeSourceIncrements90(src, sizeof(pixelType), angle, flipx, flipy, &sincx, &sincy, &signx, &signy); \
+ if (signx < 0) sp += (src->w-1)*sizeof(pixelType); \
+ if (signy < 0) sp += (src->h-1)*src->pitch; \
+ \
+ for (dy = 0; dy < dst->h; sp += sincy, dp += dincy, dy++) { \
+ if (sincx == sizeof(pixelType)) { /* if advancing src and dest equally, use memcpy */ \
+ SDL_memcpy(dp, sp, dst->w*sizeof(pixelType)); \
+ sp += dst->w*sizeof(pixelType); \
+ dp += dst->w*sizeof(pixelType); \
+ } else { \
+ for (de = dp + dst->w*sizeof(pixelType); dp != de; sp += sincx, dp += sizeof(pixelType)) { \
+ *(pixelType*)dp = *(pixelType*)sp; \
+ } \
+ } \
+ }
+
+static void
+transformSurfaceRGBA90(SDL_Surface * src, SDL_Surface * dst, int angle, int flipx, int flipy)
+{
+ TRANSFORM_SURFACE_90(tColorRGBA);
+}
+
+static void
+transformSurfaceY90(SDL_Surface * src, SDL_Surface * dst, int angle, int flipx, int flipy)
+{
+ TRANSFORM_SURFACE_90(tColorY);
+}
+
+#undef TRANSFORM_SURFACE_90
+
+/* !
+\brief Internal 32 bit rotozoomer with optional anti-aliasing.
+
+Rotates and zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control
+parameters by scanning the destination surface and applying optionally anti-aliasing
+by bilinear interpolation.
+Assumes src and dst surfaces are of 32 bit depth.
+Assumes dst surface was allocated with the correct dimensions.
+
+\param src Source surface.
+\param dst Destination surface.
+\param cx Horizontal center coordinate.
+\param cy Vertical center coordinate.
+\param isin Integer version of sine of angle.
+\param icos Integer version of cosine of angle.
+\param flipx Flag indicating horizontal mirroring should be applied.
+\param flipy Flag indicating vertical mirroring should be applied.
+\param smooth Flag indicating anti-aliasing should be used.
+*/
+static void
+_transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
+{
+ int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
+ tColorRGBA c00, c01, c10, c11, cswap;
+ tColorRGBA *pc, *sp;
+ int gap;
+
+ /*
+ * Variable setup
+ */
+ xd = ((src->w - dst->w) << 15);
+ yd = ((src->h - dst->h) << 15);
+ ax = (cx << 16) - (icos * cx);
+ ay = (cy << 16) - (isin * cx);
+ sw = src->w - 1;
+ sh = src->h - 1;
+ pc = (tColorRGBA*) dst->pixels;
+ gap = dst->pitch - dst->w * 4;
+
+ /*
+ * Switch between interpolating and non-interpolating code
+ */
+ if (smooth) {
+ for (y = 0; y < dst->h; y++) {
+ dy = cy - y;
+ sdx = (ax + (isin * dy)) + xd;
+ sdy = (ay - (icos * dy)) + yd;
+ for (x = 0; x < dst->w; x++) {
+ dx = (sdx >> 16);
+ dy = (sdy >> 16);
+ if (flipx) dx = sw - dx;
+ if (flipy) dy = sh - dy;
+ if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
+ sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy) + dx;
+ c00 = *sp;
+ sp += 1;
+ c01 = *sp;
+ sp += (src->pitch/4);
+ c11 = *sp;
+ sp -= 1;
+ c10 = *sp;
+ if (flipx) {
+ cswap = c00; c00=c01; c01=cswap;
+ cswap = c10; c10=c11; c11=cswap;
+ }
+ if (flipy) {
+ cswap = c00; c00=c10; c10=cswap;
+ cswap = c01; c01=c11; c11=cswap;
+ }
+ /*
+ * Interpolate colors
+ */
+ ex = (sdx & 0xffff);
+ ey = (sdy & 0xffff);
+ t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
+ t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
+ pc->r = (((t2 - t1) * ey) >> 16) + t1;
+ t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
+ t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
+ pc->g = (((t2 - t1) * ey) >> 16) + t1;
+ t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
+ t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
+ pc->b = (((t2 - t1) * ey) >> 16) + t1;
+ t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
+ t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
+ pc->a = (((t2 - t1) * ey) >> 16) + t1;
+ }
+ sdx += icos;
+ sdy += isin;
+ pc++;
+ }
+ pc = (tColorRGBA *) ((Uint8 *) pc + gap);
+ }
+ } else {
+ for (y = 0; y < dst->h; y++) {
+ dy = cy - y;
+ sdx = (ax + (isin * dy)) + xd;
+ sdy = (ay - (icos * dy)) + yd;
+ for (x = 0; x < dst->w; x++) {
+ dx = (sdx >> 16);
+ dy = (sdy >> 16);
+ if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) {
+ if(flipx) dx = sw - dx;
+ if(flipy) dy = sh - dy;
+ *pc = *((tColorRGBA *)((Uint8 *)src->pixels + src->pitch * dy) + dx);
+ }
+ sdx += icos;
+ sdy += isin;
+ pc++;
+ }
+ pc = (tColorRGBA *) ((Uint8 *) pc + gap);
+ }
+ }
+}
+
+/* !
+
+\brief Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.
+
+Rotates and zooms 8 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control
+parameters by scanning the destination surface.
+Assumes src and dst surfaces are of 8 bit depth.
+Assumes dst surface was allocated with the correct dimensions.
+
+\param src Source surface.
+\param dst Destination surface.
+\param cx Horizontal center coordinate.
+\param cy Vertical center coordinate.
+\param isin Integer version of sine of angle.
+\param icos Integer version of cosine of angle.
+\param flipx Flag indicating horizontal mirroring should be applied.
+\param flipy Flag indicating vertical mirroring should be applied.
+*/
+static void
+transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
+{
+ int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay;
+ tColorY *pc;
+ int gap;
+
+ /*
+ * Variable setup
+ */
+ xd = ((src->w - dst->w) << 15);
+ yd = ((src->h - dst->h) << 15);
+ ax = (cx << 16) - (icos * cx);
+ ay = (cy << 16) - (isin * cx);
+ pc = (tColorY*) dst->pixels;
+ gap = dst->pitch - dst->w;
+ /*
+ * Clear surface to colorkey
+ */
+ SDL_memset(pc, (int)(_colorkey(src) & 0xff), dst->pitch * dst->h);
+ /*
+ * Iterate through destination surface
+ */
+ for (y = 0; y < dst->h; y++) {
+ dy = cy - y;
+ sdx = (ax + (isin * dy)) + xd;
+ sdy = (ay - (icos * dy)) + yd;
+ for (x = 0; x < dst->w; x++) {
+ dx = (sdx >> 16);
+ dy = (sdy >> 16);
+ if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) {
+ if (flipx) dx = (src->w-1)-dx;
+ if (flipy) dy = (src->h-1)-dy;
+ *pc = *((tColorY *)src->pixels + src->pitch * dy + dx);
+ }
+ sdx += icos;
+ sdy += isin;
+ pc++;
+ }
+ pc += gap;
+ }
+}
+
+
+/* !
+\brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
+
+Rotates a 32-bit or 8-bit 'src' surface to newly created 'dst' surface.
+'angle' is the rotation in degrees, 'centerx' and 'centery' the rotation center. If 'smooth' is set
+then the destination 32-bit surface is anti-aliased. 8-bit surfaces must have a colorkey. 32-bit
+surfaces must have a 8888 layout with red, green, blue and alpha masks (any ordering goes).
+The blend mode of the 'src' surface has some effects on generation of the 'dst' surface: The NONE
+mode will set the BLEND mode on the 'dst' surface. The MOD mode either generates a white 'dst'
+surface and sets the colorkey or fills the it with the colorkey before copying the pixels.
+When using the NONE and MOD modes, color and alpha modulation must be applied before using this function.
+
+\param src The surface to rotozoom.
+\param angle The angle to rotate in degrees.
+\param centerx The horizontal coordinate of the center of rotation
+\param zoomy The vertical coordinate of the center of rotation
+\param smooth Antialiasing flag; set to SMOOTHING_ON to enable.
+\param flipx Set to 1 to flip the image horizontally
+\param flipy Set to 1 to flip the image vertically
+\param dstwidth The destination surface width
+\param dstheight The destination surface height
+\param cangle The angle cosine
+\param sangle The angle sine
+\return The new rotated surface.
+
+*/
+
+SDL_Surface *
+SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle)
+{
+ SDL_Surface *rz_dst;
+ int is8bit, angle90;
+ int i;
+ SDL_BlendMode blendmode;
+ Uint32 colorkey = 0;
+ int colorKeyAvailable = SDL_FALSE;
+ double sangleinv, cangleinv;
+
+ /* Sanity check */
+ if (src == NULL)
+ return NULL;
+
+ if (SDL_GetColorKey(src, &colorkey) == 0) {
+ colorKeyAvailable = SDL_TRUE;
+ }
+
+ /* This function requires a 32-bit surface or 8-bit surface with a colorkey */
+ is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable;
+ if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask)))
+ return NULL;
+
+ /* Calculate target factors from sin/cos and zoom */
+ sangleinv = sangle*65536.0;
+ cangleinv = cangle*65536.0;
+
+ /* Alloc space to completely contain the rotated surface */
+ rz_dst = NULL;
+ if (is8bit) {
+ /* Target surface is 8 bit */
+ rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
+ if (rz_dst != NULL) {
+ for (i = 0; i < src->format->palette->ncolors; i++) {
+ rz_dst->format->palette->colors[i] = src->format->palette->colors[i];
+ }
+ rz_dst->format->palette->ncolors = src->format->palette->ncolors;
+ }
+ } else {
+ /* Target surface is 32 bit with source RGBA ordering */
+ rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 32,
+ src->format->Rmask, src->format->Gmask,
+ src->format->Bmask, src->format->Amask);
+ }
+
+ /* Check target */
+ if (rz_dst == NULL)
+ return NULL;
+
+ /* Adjust for guard rows */
+ rz_dst->h = dstheight;
+
+ SDL_GetSurfaceBlendMode(src, &blendmode);
+
+ if (colorKeyAvailable == SDL_TRUE) {
+ /* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */
+ SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey);
+ SDL_FillRect(rz_dst, NULL, colorkey);
+ } else if (blendmode == SDL_BLENDMODE_NONE) {
+ blendmode = SDL_BLENDMODE_BLEND;
+ } else if (blendmode == SDL_BLENDMODE_MOD) {
+ /* Without a colorkey, the target texture has to be white for the MOD blend mode so
+ * that the pixels outside the rotated area don't affect the destination surface.
+ */
+ colorkey = SDL_MapRGBA(rz_dst->format, 255, 255, 255, 0);
+ SDL_FillRect(rz_dst, NULL, colorkey);
+ /* Setting a white colorkey for the destination surface makes the final blit discard
+ * all pixels outside of the rotated area. This doesn't interfere with anything because
+ * white pixels are already a no-op and the MOD blend mode does not interact with alpha.
+ */
+ SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey);
+ }
+
+ SDL_SetSurfaceBlendMode(rz_dst, blendmode);
+
+ /* Lock source surface */
+ if (SDL_MUSTLOCK(src)) {
+ SDL_LockSurface(src);
+ }
+
+ /* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce
+ * the off-by-one problem in _transformSurfaceRGBA that expresses itself when the rotation is near
+ * multiples of 90 degrees.
+ */
+ angle90 = (int)(angle/90);
+ if (angle90 == angle/90) {
+ angle90 %= 4;
+ if (angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */
+ } else {
+ angle90 = -1;
+ }
+
+ if (is8bit) {
+ /* Call the 8-bit transformation routine to do the rotation */
+ if(angle90 >= 0) {
+ transformSurfaceY90(src, rz_dst, angle90, flipx, flipy);
+ } else {
+ transformSurfaceY(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv,
+ flipx, flipy);
+ }
+ } else {
+ /* Call the 32-bit transformation routine to do the rotation */
+ if (angle90 >= 0) {
+ transformSurfaceRGBA90(src, rz_dst, angle90, flipx, flipy);
+ } else {
+ _transformSurfaceRGBA(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv,
+ flipx, flipy, smooth);
+ }
+ }
+
+ /* Unlock source surface */
+ if (SDL_MUSTLOCK(src)) {
+ SDL_UnlockSurface(src);
+ }
+
+ /* Return rotated surface */
+ return rz_dst;
+}
diff --git a/src/3rdparty/SDL2/src/render/software/SDL_rotate.h b/src/3rdparty/SDL2/src/render/software/SDL_rotate.h
new file mode 100644
index 0000000..2bf2ea8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/render/software/SDL_rotate.h
@@ -0,0 +1,28 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle);
+extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle);
+
diff --git a/src/3rdparty/SDL2/src/stdlib/SDL_getenv.c b/src/3rdparty/SDL2/src/stdlib/SDL_getenv.c
new file mode 100644
index 0000000..591a314
--- /dev/null
+++ b/src/3rdparty/SDL2/src/stdlib/SDL_getenv.c
@@ -0,0 +1,315 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+#if defined(__WIN32__)
+#include "../core/windows/SDL_windows.h"
+#endif
+
+#if defined(__ANDROID__)
+#include "../core/android/SDL_android.h"
+#endif
+
+#include "SDL_stdinc.h"
+
+#if defined(__WIN32__) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV))
+/* Note this isn't thread-safe! */
+static char *SDL_envmem = NULL; /* Ugh, memory leak */
+static size_t SDL_envmemlen = 0;
+#endif
+
+/* Put a variable into the environment */
+/* Note: Name may not contain a '=' character. (Reference: http://www.unix.com/man-page/Linux/3/setenv/) */
+#if defined(HAVE_SETENV)
+int
+SDL_setenv(const char *name, const char *value, int overwrite)
+{
+ /* Input validation */
+ if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ return (-1);
+ }
+
+ return setenv(name, value, overwrite);
+}
+#elif defined(__WIN32__)
+int
+SDL_setenv(const char *name, const char *value, int overwrite)
+{
+ /* Input validation */
+ if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ return (-1);
+ }
+
+ if (!overwrite) {
+ if (GetEnvironmentVariableA(name, NULL, 0) > 0) {
+ return 0; /* asked not to overwrite existing value. */
+ }
+ }
+ if (!SetEnvironmentVariableA(name, *value ? value : NULL)) {
+ return -1;
+ }
+ return 0;
+}
+/* We have a real environment table, but no real setenv? Fake it w/ putenv. */
+#elif (defined(HAVE_GETENV) && defined(HAVE_PUTENV) && !defined(HAVE_SETENV))
+int
+SDL_setenv(const char *name, const char *value, int overwrite)
+{
+ size_t len;
+ char *new_variable;
+
+ /* Input validation */
+ if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ return (-1);
+ }
+
+ if (getenv(name) != NULL) {
+ if (overwrite) {
+ unsetenv(name);
+ } else {
+ return 0; /* leave the existing one there. */
+ }
+ }
+
+ /* This leaks. Sorry. Get a better OS so we don't have to do this. */
+ len = SDL_strlen(name) + SDL_strlen(value) + 2;
+ new_variable = (char *) SDL_malloc(len);
+ if (!new_variable) {
+ return (-1);
+ }
+
+ SDL_snprintf(new_variable, len, "%s=%s", name, value);
+ return putenv(new_variable);
+}
+#else /* roll our own */
+static char **SDL_env = (char **) 0;
+int
+SDL_setenv(const char *name, const char *value, int overwrite)
+{
+ int added;
+ int len, i;
+ char **new_env;
+ char *new_variable;
+
+ /* Input validation */
+ if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
+ return (-1);
+ }
+
+ /* See if it already exists */
+ if (!overwrite && SDL_getenv(name)) {
+ return 0;
+ }
+
+ /* Allocate memory for the variable */
+ len = SDL_strlen(name) + SDL_strlen(value) + 2;
+ new_variable = (char *) SDL_malloc(len);
+ if (!new_variable) {
+ return (-1);
+ }
+
+ SDL_snprintf(new_variable, len, "%s=%s", name, value);
+ value = new_variable + SDL_strlen(name) + 1;
+ name = new_variable;
+
+ /* Actually put it into the environment */
+ added = 0;
+ i = 0;
+ if (SDL_env) {
+ /* Check to see if it's already there... */
+ len = (value - name);
+ for (; SDL_env[i]; ++i) {
+ if (SDL_strncmp(SDL_env[i], name, len) == 0) {
+ break;
+ }
+ }
+ /* If we found it, just replace the entry */
+ if (SDL_env[i]) {
+ SDL_free(SDL_env[i]);
+ SDL_env[i] = new_variable;
+ added = 1;
+ }
+ }
+
+ /* Didn't find it in the environment, expand and add */
+ if (!added) {
+ new_env = SDL_realloc(SDL_env, (i + 2) * sizeof(char *));
+ if (new_env) {
+ SDL_env = new_env;
+ SDL_env[i++] = new_variable;
+ SDL_env[i++] = (char *) 0;
+ added = 1;
+ } else {
+ SDL_free(new_variable);
+ }
+ }
+ return (added ? 0 : -1);
+}
+#endif
+
+/* Retrieve a variable named "name" from the environment */
+#if defined(HAVE_GETENV)
+char *
+SDL_getenv(const char *name)
+{
+#if defined(__ANDROID__)
+ /* Make sure variables from the application manifest are available */
+ Android_JNI_GetManifestEnvironmentVariables();
+#endif
+
+ /* Input validation */
+ if (!name || !*name) {
+ return NULL;
+ }
+
+ return getenv(name);
+}
+#elif defined(__WIN32__)
+char *
+SDL_getenv(const char *name)
+{
+ size_t bufferlen;
+
+ /* Input validation */
+ if (!name || SDL_strlen(name)==0) {
+ return NULL;
+ }
+
+ bufferlen =
+ GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen);
+ if (bufferlen == 0) {
+ return NULL;
+ }
+ if (bufferlen > SDL_envmemlen) {
+ char *newmem = (char *) SDL_realloc(SDL_envmem, bufferlen);
+ if (newmem == NULL) {
+ return NULL;
+ }
+ SDL_envmem = newmem;
+ SDL_envmemlen = bufferlen;
+ GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen);
+ }
+ return SDL_envmem;
+}
+#else
+char *
+SDL_getenv(const char *name)
+{
+ int len, i;
+ char *value;
+
+ /* Input validation */
+ if (!name || SDL_strlen(name)==0) {
+ return NULL;
+ }
+
+ value = (char *) 0;
+ if (SDL_env) {
+ len = SDL_strlen(name);
+ for (i = 0; SDL_env[i] && !value; ++i) {
+ if ((SDL_strncmp(SDL_env[i], name, len) == 0) &&
+ (SDL_env[i][len] == '=')) {
+ value = &SDL_env[i][len + 1];
+ }
+ }
+ }
+ return value;
+}
+#endif
+
+
+#ifdef TEST_MAIN
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+ char *value;
+
+ printf("Checking for non-existent variable... ");
+ fflush(stdout);
+ if (!SDL_getenv("EXISTS")) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Setting FIRST=VALUE1 in the environment... ");
+ fflush(stdout);
+ if (SDL_setenv("FIRST", "VALUE1", 0) == 0) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Getting FIRST from the environment... ");
+ fflush(stdout);
+ value = SDL_getenv("FIRST");
+ if (value && (SDL_strcmp(value, "VALUE1") == 0)) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Setting SECOND=VALUE2 in the environment... ");
+ fflush(stdout);
+ if (SDL_setenv("SECOND", "VALUE2", 0) == 0) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Getting SECOND from the environment... ");
+ fflush(stdout);
+ value = SDL_getenv("SECOND");
+ if (value && (SDL_strcmp(value, "VALUE2") == 0)) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Setting FIRST=NOVALUE in the environment... ");
+ fflush(stdout);
+ if (SDL_setenv("FIRST", "NOVALUE", 1) == 0) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Getting FIRST from the environment... ");
+ fflush(stdout);
+ value = SDL_getenv("FIRST");
+ if (value && (SDL_strcmp(value, "NOVALUE") == 0)) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ printf("Checking for non-existent variable... ");
+ fflush(stdout);
+ if (!SDL_getenv("EXISTS")) {
+ printf("okay\n");
+ } else {
+ printf("failed\n");
+ }
+ return (0);
+}
+#endif /* TEST_MAIN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/stdlib/SDL_iconv.c b/src/3rdparty/SDL2/src/stdlib/SDL_iconv.c
new file mode 100644
index 0000000..f8dbc9f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/stdlib/SDL_iconv.c
@@ -0,0 +1,934 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+/* This file contains portable iconv functions for SDL */
+
+#include "SDL_stdinc.h"
+#include "SDL_endian.h"
+
+#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
+#include <iconv.h>
+
+/* Depending on which standard the iconv() was implemented with,
+ iconv() may or may not use const char ** for the inbuf param.
+ If we get this wrong, it's just a warning, so no big deal.
+*/
+#if defined(_XGP6) || defined(__APPLE__) || \
+ defined(__EMSCRIPTEN__) || \
+ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
+ (defined(_NEWLIB_VERSION)))
+#define ICONV_INBUF_NONCONST
+#endif
+
+#include <errno.h>
+
+SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof (iconv_t) <= sizeof (SDL_iconv_t));
+
+SDL_iconv_t
+SDL_iconv_open(const char *tocode, const char *fromcode)
+{
+ return (SDL_iconv_t) ((size_t) iconv_open(tocode, fromcode));
+}
+
+int
+SDL_iconv_close(SDL_iconv_t cd)
+{
+ return iconv_close((iconv_t) ((size_t) cd));
+}
+
+size_t
+SDL_iconv(SDL_iconv_t cd,
+ const char **inbuf, size_t * inbytesleft,
+ char **outbuf, size_t * outbytesleft)
+{
+ size_t retCode;
+#ifdef ICONV_INBUF_NONCONST
+ retCode = iconv((iconv_t) ((size_t) cd), (char **) inbuf, inbytesleft, outbuf, outbytesleft);
+#else
+ retCode = iconv((iconv_t) ((size_t) cd), inbuf, inbytesleft, outbuf, outbytesleft);
+#endif
+ if (retCode == (size_t) - 1) {
+ switch (errno) {
+ case E2BIG:
+ return SDL_ICONV_E2BIG;
+ case EILSEQ:
+ return SDL_ICONV_EILSEQ;
+ case EINVAL:
+ return SDL_ICONV_EINVAL;
+ default:
+ return SDL_ICONV_ERROR;
+ }
+ }
+ return retCode;
+}
+
+#else
+
+/* Lots of useful information on Unicode at:
+ http://www.cl.cam.ac.uk/~mgk25/unicode.html
+*/
+
+#define UNICODE_BOM 0xFEFF
+
+#define UNKNOWN_ASCII '?'
+#define UNKNOWN_UNICODE 0xFFFD
+
+enum
+{
+ ENCODING_UNKNOWN,
+ ENCODING_ASCII,
+ ENCODING_LATIN1,
+ ENCODING_UTF8,
+ ENCODING_UTF16, /* Needs byte order marker */
+ ENCODING_UTF16BE,
+ ENCODING_UTF16LE,
+ ENCODING_UTF32, /* Needs byte order marker */
+ ENCODING_UTF32BE,
+ ENCODING_UTF32LE,
+ ENCODING_UCS2BE,
+ ENCODING_UCS2LE,
+ ENCODING_UCS4BE,
+ ENCODING_UCS4LE,
+};
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+#define ENCODING_UTF16NATIVE ENCODING_UTF16BE
+#define ENCODING_UTF32NATIVE ENCODING_UTF32BE
+#define ENCODING_UCS2NATIVE ENCODING_UCS2BE
+#define ENCODING_UCS4NATIVE ENCODING_UCS4BE
+#else
+#define ENCODING_UTF16NATIVE ENCODING_UTF16LE
+#define ENCODING_UTF32NATIVE ENCODING_UTF32LE
+#define ENCODING_UCS2NATIVE ENCODING_UCS2LE
+#define ENCODING_UCS4NATIVE ENCODING_UCS4LE
+#endif
+
+struct _SDL_iconv_t
+{
+ int src_fmt;
+ int dst_fmt;
+};
+
+static struct
+{
+ const char *name;
+ int format;
+} encodings[] = {
+/* *INDENT-OFF* */
+ { "ASCII", ENCODING_ASCII },
+ { "US-ASCII", ENCODING_ASCII },
+ { "8859-1", ENCODING_LATIN1 },
+ { "ISO-8859-1", ENCODING_LATIN1 },
+ { "UTF8", ENCODING_UTF8 },
+ { "UTF-8", ENCODING_UTF8 },
+ { "UTF16", ENCODING_UTF16 },
+ { "UTF-16", ENCODING_UTF16 },
+ { "UTF16BE", ENCODING_UTF16BE },
+ { "UTF-16BE", ENCODING_UTF16BE },
+ { "UTF16LE", ENCODING_UTF16LE },
+ { "UTF-16LE", ENCODING_UTF16LE },
+ { "UTF32", ENCODING_UTF32 },
+ { "UTF-32", ENCODING_UTF32 },
+ { "UTF32BE", ENCODING_UTF32BE },
+ { "UTF-32BE", ENCODING_UTF32BE },
+ { "UTF32LE", ENCODING_UTF32LE },
+ { "UTF-32LE", ENCODING_UTF32LE },
+ { "UCS2", ENCODING_UCS2BE },
+ { "UCS-2", ENCODING_UCS2BE },
+ { "UCS-2LE", ENCODING_UCS2LE },
+ { "UCS-2BE", ENCODING_UCS2BE },
+ { "UCS-2-INTERNAL", ENCODING_UCS2NATIVE },
+ { "UCS4", ENCODING_UCS4BE },
+ { "UCS-4", ENCODING_UCS4BE },
+ { "UCS-4LE", ENCODING_UCS4LE },
+ { "UCS-4BE", ENCODING_UCS4BE },
+ { "UCS-4-INTERNAL", ENCODING_UCS4NATIVE },
+/* *INDENT-ON* */
+};
+
+static const char *
+getlocale(char *buffer, size_t bufsize)
+{
+ const char *lang;
+ char *ptr;
+
+ lang = SDL_getenv("LC_ALL");
+ if (!lang) {
+ lang = SDL_getenv("LC_CTYPE");
+ }
+ if (!lang) {
+ lang = SDL_getenv("LC_MESSAGES");
+ }
+ if (!lang) {
+ lang = SDL_getenv("LANG");
+ }
+ if (!lang || !*lang || SDL_strcmp(lang, "C") == 0) {
+ lang = "ASCII";
+ }
+
+ /* We need to trim down strings like "en_US.UTF-8@blah" to "UTF-8" */
+ ptr = SDL_strchr(lang, '.');
+ if (ptr != NULL) {
+ lang = ptr + 1;
+ }
+
+ SDL_strlcpy(buffer, lang, bufsize);
+ ptr = SDL_strchr(buffer, '@');
+ if (ptr != NULL) {
+ *ptr = '\0'; /* chop end of string. */
+ }
+
+ return buffer;
+}
+
+SDL_iconv_t
+SDL_iconv_open(const char *tocode, const char *fromcode)
+{
+ int src_fmt = ENCODING_UNKNOWN;
+ int dst_fmt = ENCODING_UNKNOWN;
+ int i;
+ char fromcode_buffer[64];
+ char tocode_buffer[64];
+
+ if (!fromcode || !*fromcode) {
+ fromcode = getlocale(fromcode_buffer, sizeof(fromcode_buffer));
+ }
+ if (!tocode || !*tocode) {
+ tocode = getlocale(tocode_buffer, sizeof(tocode_buffer));
+ }
+ for (i = 0; i < SDL_arraysize(encodings); ++i) {
+ if (SDL_strcasecmp(fromcode, encodings[i].name) == 0) {
+ src_fmt = encodings[i].format;
+ if (dst_fmt != ENCODING_UNKNOWN) {
+ break;
+ }
+ }
+ if (SDL_strcasecmp(tocode, encodings[i].name) == 0) {
+ dst_fmt = encodings[i].format;
+ if (src_fmt != ENCODING_UNKNOWN) {
+ break;
+ }
+ }
+ }
+ if (src_fmt != ENCODING_UNKNOWN && dst_fmt != ENCODING_UNKNOWN) {
+ SDL_iconv_t cd = (SDL_iconv_t) SDL_malloc(sizeof(*cd));
+ if (cd) {
+ cd->src_fmt = src_fmt;
+ cd->dst_fmt = dst_fmt;
+ return cd;
+ }
+ }
+ return (SDL_iconv_t) - 1;
+}
+
+size_t
+SDL_iconv(SDL_iconv_t cd,
+ const char **inbuf, size_t * inbytesleft,
+ char **outbuf, size_t * outbytesleft)
+{
+ /* For simplicity, we'll convert everything to and from UCS-4 */
+ const char *src;
+ char *dst;
+ size_t srclen, dstlen;
+ Uint32 ch = 0;
+ size_t total;
+
+ if (!inbuf || !*inbuf) {
+ /* Reset the context */
+ return 0;
+ }
+ if (!outbuf || !*outbuf || !outbytesleft || !*outbytesleft) {
+ return SDL_ICONV_E2BIG;
+ }
+ src = *inbuf;
+ srclen = (inbytesleft ? *inbytesleft : 0);
+ dst = *outbuf;
+ dstlen = *outbytesleft;
+
+ switch (cd->src_fmt) {
+ case ENCODING_UTF16:
+ /* Scan for a byte order marker */
+ {
+ Uint8 *p = (Uint8 *) src;
+ size_t n = srclen / 2;
+ while (n) {
+ if (p[0] == 0xFF && p[1] == 0xFE) {
+ cd->src_fmt = ENCODING_UTF16BE;
+ break;
+ } else if (p[0] == 0xFE && p[1] == 0xFF) {
+ cd->src_fmt = ENCODING_UTF16LE;
+ break;
+ }
+ p += 2;
+ --n;
+ }
+ if (n == 0) {
+ /* We can't tell, default to host order */
+ cd->src_fmt = ENCODING_UTF16NATIVE;
+ }
+ }
+ break;
+ case ENCODING_UTF32:
+ /* Scan for a byte order marker */
+ {
+ Uint8 *p = (Uint8 *) src;
+ size_t n = srclen / 4;
+ while (n) {
+ if (p[0] == 0xFF && p[1] == 0xFE &&
+ p[2] == 0x00 && p[3] == 0x00) {
+ cd->src_fmt = ENCODING_UTF32BE;
+ break;
+ } else if (p[0] == 0x00 && p[1] == 0x00 &&
+ p[2] == 0xFE && p[3] == 0xFF) {
+ cd->src_fmt = ENCODING_UTF32LE;
+ break;
+ }
+ p += 4;
+ --n;
+ }
+ if (n == 0) {
+ /* We can't tell, default to host order */
+ cd->src_fmt = ENCODING_UTF32NATIVE;
+ }
+ }
+ break;
+ }
+
+ switch (cd->dst_fmt) {
+ case ENCODING_UTF16:
+ /* Default to host order, need to add byte order marker */
+ if (dstlen < 2) {
+ return SDL_ICONV_E2BIG;
+ }
+ *(Uint16 *) dst = UNICODE_BOM;
+ dst += 2;
+ dstlen -= 2;
+ cd->dst_fmt = ENCODING_UTF16NATIVE;
+ break;
+ case ENCODING_UTF32:
+ /* Default to host order, need to add byte order marker */
+ if (dstlen < 4) {
+ return SDL_ICONV_E2BIG;
+ }
+ *(Uint32 *) dst = UNICODE_BOM;
+ dst += 4;
+ dstlen -= 4;
+ cd->dst_fmt = ENCODING_UTF32NATIVE;
+ break;
+ }
+
+ total = 0;
+ while (srclen > 0) {
+ /* Decode a character */
+ switch (cd->src_fmt) {
+ case ENCODING_ASCII:
+ {
+ Uint8 *p = (Uint8 *) src;
+ ch = (Uint32) (p[0] & 0x7F);
+ ++src;
+ --srclen;
+ }
+ break;
+ case ENCODING_LATIN1:
+ {
+ Uint8 *p = (Uint8 *) src;
+ ch = (Uint32) p[0];
+ ++src;
+ --srclen;
+ }
+ break;
+ case ENCODING_UTF8: /* RFC 3629 */
+ {
+ Uint8 *p = (Uint8 *) src;
+ size_t left = 0;
+ SDL_bool overlong = SDL_FALSE;
+ if (p[0] >= 0xFC) {
+ if ((p[0] & 0xFE) != 0xFC) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ } else {
+ if (p[0] == 0xFC && srclen > 1 && (p[1] & 0xFC) == 0x80) {
+ overlong = SDL_TRUE;
+ }
+ ch = (Uint32) (p[0] & 0x01);
+ left = 5;
+ }
+ } else if (p[0] >= 0xF8) {
+ if ((p[0] & 0xFC) != 0xF8) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ } else {
+ if (p[0] == 0xF8 && srclen > 1 && (p[1] & 0xF8) == 0x80) {
+ overlong = SDL_TRUE;
+ }
+ ch = (Uint32) (p[0] & 0x03);
+ left = 4;
+ }
+ } else if (p[0] >= 0xF0) {
+ if ((p[0] & 0xF8) != 0xF0) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ } else {
+ if (p[0] == 0xF0 && srclen > 1 && (p[1] & 0xF0) == 0x80) {
+ overlong = SDL_TRUE;
+ }
+ ch = (Uint32) (p[0] & 0x07);
+ left = 3;
+ }
+ } else if (p[0] >= 0xE0) {
+ if ((p[0] & 0xF0) != 0xE0) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ } else {
+ if (p[0] == 0xE0 && srclen > 1 && (p[1] & 0xE0) == 0x80) {
+ overlong = SDL_TRUE;
+ }
+ ch = (Uint32) (p[0] & 0x0F);
+ left = 2;
+ }
+ } else if (p[0] >= 0xC0) {
+ if ((p[0] & 0xE0) != 0xC0) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ } else {
+ if ((p[0] & 0xDE) == 0xC0) {
+ overlong = SDL_TRUE;
+ }
+ ch = (Uint32) (p[0] & 0x1F);
+ left = 1;
+ }
+ } else {
+ if ((p[0] & 0x80) != 0x00) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ } else {
+ ch = (Uint32) p[0];
+ }
+ }
+ ++src;
+ --srclen;
+ if (srclen < left) {
+ return SDL_ICONV_EINVAL;
+ }
+ while (left--) {
+ ++p;
+ if ((p[0] & 0xC0) != 0x80) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ break;
+ }
+ ch <<= 6;
+ ch |= (p[0] & 0x3F);
+ ++src;
+ --srclen;
+ }
+ if (overlong) {
+ /* Potential security risk
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ }
+ if ((ch >= 0xD800 && ch <= 0xDFFF) ||
+ (ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ }
+ }
+ break;
+ case ENCODING_UTF16BE: /* RFC 2781 */
+ {
+ Uint8 *p = (Uint8 *) src;
+ Uint16 W1, W2;
+ if (srclen < 2) {
+ return SDL_ICONV_EINVAL;
+ }
+ W1 = ((Uint16) p[0] << 8) | (Uint16) p[1];
+ src += 2;
+ srclen -= 2;
+ if (W1 < 0xD800 || W1 > 0xDFFF) {
+ ch = (Uint32) W1;
+ break;
+ }
+ if (W1 > 0xDBFF) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ break;
+ }
+ if (srclen < 2) {
+ return SDL_ICONV_EINVAL;
+ }
+ p = (Uint8 *) src;
+ W2 = ((Uint16) p[0] << 8) | (Uint16) p[1];
+ src += 2;
+ srclen -= 2;
+ if (W2 < 0xDC00 || W2 > 0xDFFF) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ break;
+ }
+ ch = (((Uint32) (W1 & 0x3FF) << 10) |
+ (Uint32) (W2 & 0x3FF)) + 0x10000;
+ }
+ break;
+ case ENCODING_UTF16LE: /* RFC 2781 */
+ {
+ Uint8 *p = (Uint8 *) src;
+ Uint16 W1, W2;
+ if (srclen < 2) {
+ return SDL_ICONV_EINVAL;
+ }
+ W1 = ((Uint16) p[1] << 8) | (Uint16) p[0];
+ src += 2;
+ srclen -= 2;
+ if (W1 < 0xD800 || W1 > 0xDFFF) {
+ ch = (Uint32) W1;
+ break;
+ }
+ if (W1 > 0xDBFF) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ break;
+ }
+ if (srclen < 2) {
+ return SDL_ICONV_EINVAL;
+ }
+ p = (Uint8 *) src;
+ W2 = ((Uint16) p[1] << 8) | (Uint16) p[0];
+ src += 2;
+ srclen -= 2;
+ if (W2 < 0xDC00 || W2 > 0xDFFF) {
+ /* Skip illegal sequences
+ return SDL_ICONV_EILSEQ;
+ */
+ ch = UNKNOWN_UNICODE;
+ break;
+ }
+ ch = (((Uint32) (W1 & 0x3FF) << 10) |
+ (Uint32) (W2 & 0x3FF)) + 0x10000;
+ }
+ break;
+ case ENCODING_UCS2LE:
+ {
+ Uint8 *p = (Uint8 *) src;
+ if (srclen < 2) {
+ return SDL_ICONV_EINVAL;
+ }
+ ch = ((Uint32) p[1] << 8) | (Uint32) p[0];
+ src += 2;
+ srclen -= 2;
+ }
+ break;
+ case ENCODING_UCS2BE:
+ {
+ Uint8 *p = (Uint8 *) src;
+ if (srclen < 2) {
+ return SDL_ICONV_EINVAL;
+ }
+ ch = ((Uint32) p[0] << 8) | (Uint32) p[1];
+ src += 2;
+ srclen -= 2;
+ }
+ break;
+ case ENCODING_UCS4BE:
+ case ENCODING_UTF32BE:
+ {
+ Uint8 *p = (Uint8 *) src;
+ if (srclen < 4) {
+ return SDL_ICONV_EINVAL;
+ }
+ ch = ((Uint32) p[0] << 24) |
+ ((Uint32) p[1] << 16) |
+ ((Uint32) p[2] << 8) | (Uint32) p[3];
+ src += 4;
+ srclen -= 4;
+ }
+ break;
+ case ENCODING_UCS4LE:
+ case ENCODING_UTF32LE:
+ {
+ Uint8 *p = (Uint8 *) src;
+ if (srclen < 4) {
+ return SDL_ICONV_EINVAL;
+ }
+ ch = ((Uint32) p[3] << 24) |
+ ((Uint32) p[2] << 16) |
+ ((Uint32) p[1] << 8) | (Uint32) p[0];
+ src += 4;
+ srclen -= 4;
+ }
+ break;
+ }
+
+ /* Encode a character */
+ switch (cd->dst_fmt) {
+ case ENCODING_ASCII:
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (dstlen < 1) {
+ return SDL_ICONV_E2BIG;
+ }
+ if (ch > 0x7F) {
+ *p = UNKNOWN_ASCII;
+ } else {
+ *p = (Uint8) ch;
+ }
+ ++dst;
+ --dstlen;
+ }
+ break;
+ case ENCODING_LATIN1:
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (dstlen < 1) {
+ return SDL_ICONV_E2BIG;
+ }
+ if (ch > 0xFF) {
+ *p = UNKNOWN_ASCII;
+ } else {
+ *p = (Uint8) ch;
+ }
+ ++dst;
+ --dstlen;
+ }
+ break;
+ case ENCODING_UTF8: /* RFC 3629 */
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (ch > 0x10FFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ if (ch <= 0x7F) {
+ if (dstlen < 1) {
+ return SDL_ICONV_E2BIG;
+ }
+ *p = (Uint8) ch;
+ ++dst;
+ --dstlen;
+ } else if (ch <= 0x7FF) {
+ if (dstlen < 2) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
+ p[1] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 2;
+ dstlen -= 2;
+ } else if (ch <= 0xFFFF) {
+ if (dstlen < 3) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
+ p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[2] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 3;
+ dstlen -= 3;
+ } else if (ch <= 0x1FFFFF) {
+ if (dstlen < 4) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
+ p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
+ p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[3] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 4;
+ dstlen -= 4;
+ } else if (ch <= 0x3FFFFFF) {
+ if (dstlen < 5) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
+ p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
+ p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
+ p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[4] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 5;
+ dstlen -= 5;
+ } else {
+ if (dstlen < 6) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
+ p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
+ p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
+ p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
+ p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
+ p[5] = 0x80 | (Uint8) (ch & 0x3F);
+ dst += 6;
+ dstlen -= 6;
+ }
+ }
+ break;
+ case ENCODING_UTF16BE: /* RFC 2781 */
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (ch > 0x10FFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ if (ch < 0x10000) {
+ if (dstlen < 2) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = (Uint8) (ch >> 8);
+ p[1] = (Uint8) ch;
+ dst += 2;
+ dstlen -= 2;
+ } else {
+ Uint16 W1, W2;
+ if (dstlen < 4) {
+ return SDL_ICONV_E2BIG;
+ }
+ ch = ch - 0x10000;
+ W1 = 0xD800 | (Uint16) ((ch >> 10) & 0x3FF);
+ W2 = 0xDC00 | (Uint16) (ch & 0x3FF);
+ p[0] = (Uint8) (W1 >> 8);
+ p[1] = (Uint8) W1;
+ p[2] = (Uint8) (W2 >> 8);
+ p[3] = (Uint8) W2;
+ dst += 4;
+ dstlen -= 4;
+ }
+ }
+ break;
+ case ENCODING_UTF16LE: /* RFC 2781 */
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (ch > 0x10FFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ if (ch < 0x10000) {
+ if (dstlen < 2) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[1] = (Uint8) (ch >> 8);
+ p[0] = (Uint8) ch;
+ dst += 2;
+ dstlen -= 2;
+ } else {
+ Uint16 W1, W2;
+ if (dstlen < 4) {
+ return SDL_ICONV_E2BIG;
+ }
+ ch = ch - 0x10000;
+ W1 = 0xD800 | (Uint16) ((ch >> 10) & 0x3FF);
+ W2 = 0xDC00 | (Uint16) (ch & 0x3FF);
+ p[1] = (Uint8) (W1 >> 8);
+ p[0] = (Uint8) W1;
+ p[3] = (Uint8) (W2 >> 8);
+ p[2] = (Uint8) W2;
+ dst += 4;
+ dstlen -= 4;
+ }
+ }
+ break;
+ case ENCODING_UCS2BE:
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (ch > 0xFFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ if (dstlen < 2) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = (Uint8) (ch >> 8);
+ p[1] = (Uint8) ch;
+ dst += 2;
+ dstlen -= 2;
+ }
+ break;
+ case ENCODING_UCS2LE:
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (ch > 0xFFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ if (dstlen < 2) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[1] = (Uint8) (ch >> 8);
+ p[0] = (Uint8) ch;
+ dst += 2;
+ dstlen -= 2;
+ }
+ break;
+ case ENCODING_UTF32BE:
+ if (ch > 0x10FFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ /* fallthrough */
+ case ENCODING_UCS4BE:
+ if (ch > 0x7FFFFFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (dstlen < 4) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[0] = (Uint8) (ch >> 24);
+ p[1] = (Uint8) (ch >> 16);
+ p[2] = (Uint8) (ch >> 8);
+ p[3] = (Uint8) ch;
+ dst += 4;
+ dstlen -= 4;
+ }
+ break;
+ case ENCODING_UTF32LE:
+ if (ch > 0x10FFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ /* fallthrough */
+ case ENCODING_UCS4LE:
+ if (ch > 0x7FFFFFFF) {
+ ch = UNKNOWN_UNICODE;
+ }
+ {
+ Uint8 *p = (Uint8 *) dst;
+ if (dstlen < 4) {
+ return SDL_ICONV_E2BIG;
+ }
+ p[3] = (Uint8) (ch >> 24);
+ p[2] = (Uint8) (ch >> 16);
+ p[1] = (Uint8) (ch >> 8);
+ p[0] = (Uint8) ch;
+ dst += 4;
+ dstlen -= 4;
+ }
+ break;
+ }
+
+ /* Update state */
+ *inbuf = src;
+ *inbytesleft = srclen;
+ *outbuf = dst;
+ *outbytesleft = dstlen;
+ ++total;
+ }
+ return total;
+}
+
+int
+SDL_iconv_close(SDL_iconv_t cd)
+{
+ if (cd != (SDL_iconv_t)-1) {
+ SDL_free(cd);
+ }
+ return 0;
+}
+
+#endif /* !HAVE_ICONV */
+
+char *
+SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
+ size_t inbytesleft)
+{
+ SDL_iconv_t cd;
+ char *string;
+ size_t stringsize;
+ char *outbuf;
+ size_t outbytesleft;
+ size_t retCode = 0;
+
+ cd = SDL_iconv_open(tocode, fromcode);
+ if (cd == (SDL_iconv_t) - 1) {
+ /* See if we can recover here (fixes iconv on Solaris 11) */
+ if (!tocode || !*tocode) {
+ tocode = "UTF-8";
+ }
+ if (!fromcode || !*fromcode) {
+ fromcode = "UTF-8";
+ }
+ cd = SDL_iconv_open(tocode, fromcode);
+ }
+ if (cd == (SDL_iconv_t) - 1) {
+ return NULL;
+ }
+
+ stringsize = inbytesleft > 4 ? inbytesleft : 4;
+ string = SDL_malloc(stringsize);
+ if (!string) {
+ SDL_iconv_close(cd);
+ return NULL;
+ }
+ outbuf = string;
+ outbytesleft = stringsize;
+ SDL_memset(outbuf, 0, 4);
+
+ while (inbytesleft > 0) {
+ retCode = SDL_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+ switch (retCode) {
+ case SDL_ICONV_E2BIG:
+ {
+ char *oldstring = string;
+ stringsize *= 2;
+ string = SDL_realloc(string, stringsize);
+ if (!string) {
+ SDL_iconv_close(cd);
+ return NULL;
+ }
+ outbuf = string + (outbuf - oldstring);
+ outbytesleft = stringsize - (outbuf - string);
+ SDL_memset(outbuf, 0, 4);
+ }
+ break;
+ case SDL_ICONV_EILSEQ:
+ /* Try skipping some input data - not perfect, but... */
+ ++inbuf;
+ --inbytesleft;
+ break;
+ case SDL_ICONV_EINVAL:
+ case SDL_ICONV_ERROR:
+ /* We can't continue... */
+ inbytesleft = 0;
+ break;
+ }
+ }
+ SDL_iconv_close(cd);
+
+ return string;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/stdlib/SDL_malloc.c b/src/3rdparty/SDL2/src/stdlib/SDL_malloc.c
new file mode 100644
index 0000000..ace76bf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/stdlib/SDL_malloc.c
@@ -0,0 +1,5376 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+/* This file contains portable memory management functions for SDL */
+#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
+#include "SDL_error.h"
+
+#ifndef HAVE_MALLOC
+#define LACKS_SYS_TYPES_H
+#define LACKS_STDIO_H
+#define LACKS_STRINGS_H
+#define LACKS_STRING_H
+#define LACKS_STDLIB_H
+#define ABORT
+#define USE_LOCKS 1
+#define USE_DL_PREFIX
+
+/*
+ This is a version (aka dlmalloc) of malloc/free/realloc written by
+ Doug Lea and released to the public domain, as explained at
+ http://creativecommons.org/licenses/publicdomain. Send questions,
+ comments, complaints, performance data, etc to dl@cs.oswego.edu
+
+* Version 2.8.3 Thu Sep 22 11:16:15 2005 Doug Lea (dl at gee)
+
+ Note: There may be an updated version of this malloc obtainable at
+ ftp://gee.cs.oswego.edu/pub/misc/malloc.c
+ Check before installing!
+
+* Quickstart
+
+ This library is all in one file to simplify the most common usage:
+ ftp it, compile it (-O3), and link it into another program. All of
+ the compile-time options default to reasonable values for use on
+ most platforms. You might later want to step through various
+ compile-time and dynamic tuning options.
+
+ For convenience, an include file for code using this malloc is at:
+ ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.3.h
+ You don't really need this .h file unless you call functions not
+ defined in your system include files. The .h file contains only the
+ excerpts from this file needed for using this malloc on ANSI C/C++
+ systems, so long as you haven't changed compile-time options about
+ naming and tuning parameters. If you do, then you can create your
+ own malloc.h that does include all settings by cutting at the point
+ indicated below. Note that you may already by default be using a C
+ library containing a malloc that is based on some version of this
+ malloc (for example in linux). You might still want to use the one
+ in this file to customize settings or to avoid overheads associated
+ with library versions.
+
+* Vital statistics:
+
+ Supported pointer/size_t representation: 4 or 8 bytes
+ size_t MUST be an unsigned type of the same width as
+ pointers. (If you are using an ancient system that declares
+ size_t as a signed type, or need it to be a different width
+ than pointers, you can use a previous release of this malloc
+ (e.g. 2.7.2) supporting these.)
+
+ Alignment: 8 bytes (default)
+ This suffices for nearly all current machines and C compilers.
+ However, you can define MALLOC_ALIGNMENT to be wider than this
+ if necessary (up to 128bytes), at the expense of using more space.
+
+ Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes)
+ 8 or 16 bytes (if 8byte sizes)
+ Each malloced chunk has a hidden word of overhead holding size
+ and status information, and additional cross-check word
+ if FOOTERS is defined.
+
+ Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead)
+ 8-byte ptrs: 32 bytes (including overhead)
+
+ Even a request for zero bytes (i.e., malloc(0)) returns a
+ pointer to something of the minimum allocatable size.
+ The maximum overhead wastage (i.e., number of extra bytes
+ allocated than were requested in malloc) is less than or equal
+ to the minimum size, except for requests >= mmap_threshold that
+ are serviced via mmap(), where the worst case wastage is about
+ 32 bytes plus the remainder from a system page (the minimal
+ mmap unit); typically 4096 or 8192 bytes.
+
+ Security: static-safe; optionally more or less
+ The "security" of malloc refers to the ability of malicious
+ code to accentuate the effects of errors (for example, freeing
+ space that is not currently malloc'ed or overwriting past the
+ ends of chunks) in code that calls malloc. This malloc
+ guarantees not to modify any memory locations below the base of
+ heap, i.e., static variables, even in the presence of usage
+ errors. The routines additionally detect most improper frees
+ and reallocs. All this holds as long as the static bookkeeping
+ for malloc itself is not corrupted by some other means. This
+ is only one aspect of security -- these checks do not, and
+ cannot, detect all possible programming errors.
+
+ If FOOTERS is defined nonzero, then each allocated chunk
+ carries an additional check word to verify that it was malloced
+ from its space. These check words are the same within each
+ execution of a program using malloc, but differ across
+ executions, so externally crafted fake chunks cannot be
+ freed. This improves security by rejecting frees/reallocs that
+ could corrupt heap memory, in addition to the checks preventing
+ writes to statics that are always on. This may further improve
+ security at the expense of time and space overhead. (Note that
+ FOOTERS may also be worth using with MSPACES.)
+
+ By default detected errors cause the program to abort (calling
+ "abort()"). You can override this to instead proceed past
+ errors by defining PROCEED_ON_ERROR. In this case, a bad free
+ has no effect, and a malloc that encounters a bad address
+ caused by user overwrites will ignore the bad address by
+ dropping pointers and indices to all known memory. This may
+ be appropriate for programs that should continue if at all
+ possible in the face of programming errors, although they may
+ run out of memory because dropped memory is never reclaimed.
+
+ If you don't like either of these options, you can define
+ CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything
+ else. And if if you are sure that your program using malloc has
+ no errors or vulnerabilities, you can define INSECURE to 1,
+ which might (or might not) provide a small performance improvement.
+
+ Thread-safety: NOT thread-safe unless USE_LOCKS defined
+ When USE_LOCKS is defined, each public call to malloc, free,
+ etc is surrounded with either a pthread mutex or a win32
+ spinlock (depending on WIN32). This is not especially fast, and
+ can be a major bottleneck. It is designed only to provide
+ minimal protection in concurrent environments, and to provide a
+ basis for extensions. If you are using malloc in a concurrent
+ program, consider instead using ptmalloc, which is derived from
+ a version of this malloc. (See http://www.malloc.de).
+
+ System requirements: Any combination of MORECORE and/or MMAP/MUNMAP
+ This malloc can use unix sbrk or any emulation (invoked using
+ the CALL_MORECORE macro) and/or mmap/munmap or any emulation
+ (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system
+ memory. On most unix systems, it tends to work best if both
+ MORECORE and MMAP are enabled. On Win32, it uses emulations
+ based on VirtualAlloc. It also uses common C library functions
+ like memset.
+
+ Compliance: I believe it is compliant with the Single Unix Specification
+ (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably
+ others as well.
+
+* Overview of algorithms
+
+ This is not the fastest, most space-conserving, most portable, or
+ most tunable malloc ever written. However it is among the fastest
+ while also being among the most space-conserving, portable and
+ tunable. Consistent balance across these factors results in a good
+ general-purpose allocator for malloc-intensive programs.
+
+ In most ways, this malloc is a best-fit allocator. Generally, it
+ chooses the best-fitting existing chunk for a request, with ties
+ broken in approximately least-recently-used order. (This strategy
+ normally maintains low fragmentation.) However, for requests less
+ than 256bytes, it deviates from best-fit when there is not an
+ exactly fitting available chunk by preferring to use space adjacent
+ to that used for the previous small request, as well as by breaking
+ ties in approximately most-recently-used order. (These enhance
+ locality of series of small allocations.) And for very large requests
+ (>= 256Kb by default), it relies on system memory mapping
+ facilities, if supported. (This helps avoid carrying around and
+ possibly fragmenting memory used only for large chunks.)
+
+ All operations (except malloc_stats and mallinfo) have execution
+ times that are bounded by a constant factor of the number of bits in
+ a size_t, not counting any clearing in calloc or copying in realloc,
+ or actions surrounding MORECORE and MMAP that have times
+ proportional to the number of non-contiguous regions returned by
+ system allocation routines, which is often just 1.
+
+ The implementation is not very modular and seriously overuses
+ macros. Perhaps someday all C compilers will do as good a job
+ inlining modular code as can now be done by brute-force expansion,
+ but now, enough of them seem not to.
+
+ Some compilers issue a lot of warnings about code that is
+ dead/unreachable only on some platforms, and also about intentional
+ uses of negation on unsigned types. All known cases of each can be
+ ignored.
+
+ For a longer but out of date high-level description, see
+ http://gee.cs.oswego.edu/dl/html/malloc.html
+
+* MSPACES
+ If MSPACES is defined, then in addition to malloc, free, etc.,
+ this file also defines mspace_malloc, mspace_free, etc. These
+ are versions of malloc routines that take an "mspace" argument
+ obtained using create_mspace, to control all internal bookkeeping.
+ If ONLY_MSPACES is defined, only these versions are compiled.
+ So if you would like to use this allocator for only some allocations,
+ and your system malloc for others, you can compile with
+ ONLY_MSPACES and then do something like...
+ static mspace mymspace = create_mspace(0,0); // for example
+ #define mymalloc(bytes) mspace_malloc(mymspace, bytes)
+
+ (Note: If you only need one instance of an mspace, you can instead
+ use "USE_DL_PREFIX" to relabel the global malloc.)
+
+ You can similarly create thread-local allocators by storing
+ mspaces as thread-locals. For example:
+ static __thread mspace tlms = 0;
+ void* tlmalloc(size_t bytes) {
+ if (tlms == 0) tlms = create_mspace(0, 0);
+ return mspace_malloc(tlms, bytes);
+ }
+ void tlfree(void* mem) { mspace_free(tlms, mem); }
+
+ Unless FOOTERS is defined, each mspace is completely independent.
+ You cannot allocate from one and free to another (although
+ conformance is only weakly checked, so usage errors are not always
+ caught). If FOOTERS is defined, then each chunk carries around a tag
+ indicating its originating mspace, and frees are directed to their
+ originating spaces.
+
+ ------------------------- Compile-time options ---------------------------
+
+Be careful in setting #define values for numerical constants of type
+size_t. On some systems, literal values are not automatically extended
+to size_t precision unless they are explicitly casted.
+
+WIN32 default: defined if _WIN32 defined
+ Defining WIN32 sets up defaults for MS environment and compilers.
+ Otherwise defaults are for unix.
+
+MALLOC_ALIGNMENT default: (size_t)8
+ Controls the minimum alignment for malloc'ed chunks. It must be a
+ power of two and at least 8, even on machines for which smaller
+ alignments would suffice. It may be defined as larger than this
+ though. Note however that code and data structures are optimized for
+ the case of 8-byte alignment.
+
+MSPACES default: 0 (false)
+ If true, compile in support for independent allocation spaces.
+ This is only supported if HAVE_MMAP is true.
+
+ONLY_MSPACES default: 0 (false)
+ If true, only compile in mspace versions, not regular versions.
+
+USE_LOCKS default: 0 (false)
+ Causes each call to each public routine to be surrounded with
+ pthread or WIN32 mutex lock/unlock. (If set true, this can be
+ overridden on a per-mspace basis for mspace versions.)
+
+FOOTERS default: 0
+ If true, provide extra checking and dispatching by placing
+ information in the footers of allocated chunks. This adds
+ space and time overhead.
+
+INSECURE default: 0
+ If true, omit checks for usage errors and heap space overwrites.
+
+USE_DL_PREFIX default: NOT defined
+ Causes compiler to prefix all public routines with the string 'dl'.
+ This can be useful when you only want to use this malloc in one part
+ of a program, using your regular system malloc elsewhere.
+
+ABORT default: defined as abort()
+ Defines how to abort on failed checks. On most systems, a failed
+ check cannot die with an "assert" or even print an informative
+ message, because the underlying print routines in turn call malloc,
+ which will fail again. Generally, the best policy is to simply call
+ abort(). It's not very useful to do more than this because many
+ errors due to overwriting will show up as address faults (null, odd
+ addresses etc) rather than malloc-triggered checks, so will also
+ abort. Also, most compilers know that abort() does not return, so
+ can better optimize code conditionally calling it.
+
+PROCEED_ON_ERROR default: defined as 0 (false)
+ Controls whether detected bad addresses cause them to bypassed
+ rather than aborting. If set, detected bad arguments to free and
+ realloc are ignored. And all bookkeeping information is zeroed out
+ upon a detected overwrite of freed heap space, thus losing the
+ ability to ever return it from malloc again, but enabling the
+ application to proceed. If PROCEED_ON_ERROR is defined, the
+ static variable malloc_corruption_error_count is compiled in
+ and can be examined to see if errors have occurred. This option
+ generates slower code than the default abort policy.
+
+DEBUG default: NOT defined
+ The DEBUG setting is mainly intended for people trying to modify
+ this code or diagnose problems when porting to new platforms.
+ However, it may also be able to better isolate user errors than just
+ using runtime checks. The assertions in the check routines spell
+ out in more detail the assumptions and invariants underlying the
+ algorithms. The checking is fairly extensive, and will slow down
+ execution noticeably. Calling malloc_stats or mallinfo with DEBUG
+ set will attempt to check every non-mmapped allocated and free chunk
+ in the course of computing the summaries.
+
+ABORT_ON_ASSERT_FAILURE default: defined as 1 (true)
+ Debugging assertion failures can be nearly impossible if your
+ version of the assert macro causes malloc to be called, which will
+ lead to a cascade of further failures, blowing the runtime stack.
+ ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(),
+ which will usually make debugging easier.
+
+MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32
+ The action to take before "return 0" when malloc fails to be able to
+ return memory because there is none available.
+
+HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES
+ True if this system supports sbrk or an emulation of it.
+
+MORECORE default: sbrk
+ The name of the sbrk-style system routine to call to obtain more
+ memory. See below for guidance on writing custom MORECORE
+ functions. The type of the argument to sbrk/MORECORE varies across
+ systems. It cannot be size_t, because it supports negative
+ arguments, so it is normally the signed type of the same width as
+ size_t (sometimes declared as "intptr_t"). It doesn't much matter
+ though. Internally, we only call it with arguments less than half
+ the max value of a size_t, which should work across all reasonable
+ possibilities, although sometimes generating compiler warnings. See
+ near the end of this file for guidelines for creating a custom
+ version of MORECORE.
+
+MORECORE_CONTIGUOUS default: 1 (true)
+ If true, take advantage of fact that consecutive calls to MORECORE
+ with positive arguments always return contiguous increasing
+ addresses. This is true of unix sbrk. It does not hurt too much to
+ set it true anyway, since malloc copes with non-contiguities.
+ Setting it false when definitely non-contiguous saves time
+ and possibly wasted space it would take to discover this though.
+
+MORECORE_CANNOT_TRIM default: NOT defined
+ True if MORECORE cannot release space back to the system when given
+ negative arguments. This is generally necessary only if you are
+ using a hand-crafted MORECORE function that cannot handle negative
+ arguments.
+
+HAVE_MMAP default: 1 (true)
+ True if this system supports mmap or an emulation of it. If so, and
+ HAVE_MORECORE is not true, MMAP is used for all system
+ allocation. If set and HAVE_MORECORE is true as well, MMAP is
+ primarily used to directly allocate very large blocks. It is also
+ used as a backup strategy in cases where MORECORE fails to provide
+ space from system. Note: A single call to MUNMAP is assumed to be
+ able to unmap memory that may have be allocated using multiple calls
+ to MMAP, so long as they are adjacent.
+
+HAVE_MREMAP default: 1 on linux, else 0
+ If true realloc() uses mremap() to re-allocate large blocks and
+ extend or shrink allocation spaces.
+
+MMAP_CLEARS default: 1 on unix
+ True if mmap clears memory so calloc doesn't need to. This is true
+ for standard unix mmap using /dev/zero.
+
+USE_BUILTIN_FFS default: 0 (i.e., not used)
+ Causes malloc to use the builtin ffs() function to compute indices.
+ Some compilers may recognize and intrinsify ffs to be faster than the
+ supplied C version. Also, the case of x86 using gcc is special-cased
+ to an asm instruction, so is already as fast as it can be, and so
+ this setting has no effect. (On most x86s, the asm version is only
+ slightly faster than the C version.)
+
+malloc_getpagesize default: derive from system includes, or 4096.
+ The system page size. To the extent possible, this malloc manages
+ memory from the system in page-size units. This may be (and
+ usually is) a function rather than a constant. This is ignored
+ if WIN32, where page size is determined using getSystemInfo during
+ initialization.
+
+USE_DEV_RANDOM default: 0 (i.e., not used)
+ Causes malloc to use /dev/random to initialize secure magic seed for
+ stamping footers. Otherwise, the current time is used.
+
+NO_MALLINFO default: 0
+ If defined, don't compile "mallinfo". This can be a simple way
+ of dealing with mismatches between system declarations and
+ those in this file.
+
+MALLINFO_FIELD_TYPE default: size_t
+ The type of the fields in the mallinfo struct. This was originally
+ defined as "int" in SVID etc, but is more usefully defined as
+ size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set
+
+REALLOC_ZERO_BYTES_FREES default: not defined
+ This should be set if a call to realloc with zero bytes should
+ be the same as a call to free. Some people think it should. Otherwise,
+ since this malloc returns a unique pointer for malloc(0), so does
+ realloc(p, 0).
+
+LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H
+LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H
+LACKS_STDLIB_H default: NOT defined unless on WIN32
+ Define these if your system does not have these header files.
+ You might need to manually insert some of the declarations they provide.
+
+DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS,
+ system_info.dwAllocationGranularity in WIN32,
+ otherwise 64K.
+ Also settable using mallopt(M_GRANULARITY, x)
+ The unit for allocating and deallocating memory from the system. On
+ most systems with contiguous MORECORE, there is no reason to
+ make this more than a page. However, systems with MMAP tend to
+ either require or encourage larger granularities. You can increase
+ this value to prevent system allocation functions to be called so
+ often, especially if they are slow. The value must be at least one
+ page and must be a power of two. Setting to 0 causes initialization
+ to either page size or win32 region size. (Note: In previous
+ versions of malloc, the equivalent of this option was called
+ "TOP_PAD")
+
+DEFAULT_TRIM_THRESHOLD default: 2MB
+ Also settable using mallopt(M_TRIM_THRESHOLD, x)
+ The maximum amount of unused top-most memory to keep before
+ releasing via malloc_trim in free(). Automatic trimming is mainly
+ useful in long-lived programs using contiguous MORECORE. Because
+ trimming via sbrk can be slow on some systems, and can sometimes be
+ wasteful (in cases where programs immediately afterward allocate
+ more large chunks) the value should be high enough so that your
+ overall system performance would improve by releasing this much
+ memory. As a rough guide, you might set to a value close to the
+ average size of a process (program) running on your system.
+ Releasing this much memory would allow such a process to run in
+ memory. Generally, it is worth tuning trim thresholds when a
+ program undergoes phases where several large chunks are allocated
+ and released in ways that can reuse each other's storage, perhaps
+ mixed with phases where there are no such chunks at all. The trim
+ value must be greater than page size to have any useful effect. To
+ disable trimming completely, you can set to MAX_SIZE_T. Note that the trick
+ some people use of mallocing a huge space and then freeing it at
+ program startup, in an attempt to reserve system memory, doesn't
+ have the intended effect under automatic trimming, since that memory
+ will immediately be returned to the system.
+
+DEFAULT_MMAP_THRESHOLD default: 256K
+ Also settable using mallopt(M_MMAP_THRESHOLD, x)
+ The request size threshold for using MMAP to directly service a
+ request. Requests of at least this size that cannot be allocated
+ using already-existing space will be serviced via mmap. (If enough
+ normal freed space already exists it is used instead.) Using mmap
+ segregates relatively large chunks of memory so that they can be
+ individually obtained and released from the host system. A request
+ serviced through mmap is never reused by any other request (at least
+ not directly; the system may just so happen to remap successive
+ requests to the same locations). Segregating space in this way has
+ the benefits that: Mmapped space can always be individually released
+ back to the system, which helps keep the system level memory demands
+ of a long-lived program low. Also, mapped memory doesn't become
+ `locked' between other chunks, as can happen with normally allocated
+ chunks, which means that even trimming via malloc_trim would not
+ release them. However, it has the disadvantage that the space
+ cannot be reclaimed, consolidated, and then used to service later
+ requests, as happens with normal chunks. The advantages of mmap
+ nearly always outweigh disadvantages for "large" chunks, but the
+ value of "large" may vary across systems. The default is an
+ empirically derived value that works well in most systems. You can
+ disable mmap by setting to MAX_SIZE_T.
+
+*/
+
+#ifndef WIN32
+#ifdef _WIN32
+#define WIN32 1
+#endif /* _WIN32 */
+#endif /* WIN32 */
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#define HAVE_MMAP 1
+#define HAVE_MORECORE 0
+#define LACKS_UNISTD_H
+#define LACKS_SYS_PARAM_H
+#define LACKS_SYS_MMAN_H
+#define LACKS_STRING_H
+#define LACKS_STRINGS_H
+#define LACKS_SYS_TYPES_H
+#define LACKS_ERRNO_H
+#define LACKS_FCNTL_H
+#define MALLOC_FAILURE_ACTION
+#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */
+#endif /* WIN32 */
+
+#if defined(DARWIN) || defined(_DARWIN)
+/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
+#ifndef HAVE_MORECORE
+#define HAVE_MORECORE 0
+#define HAVE_MMAP 1
+#endif /* HAVE_MORECORE */
+#endif /* DARWIN */
+
+#ifndef LACKS_SYS_TYPES_H
+#include <sys/types.h> /* For size_t */
+#endif /* LACKS_SYS_TYPES_H */
+
+/* The maximum possible size_t value has all bits set */
+#define MAX_SIZE_T (~(size_t)0)
+
+#ifndef ONLY_MSPACES
+#define ONLY_MSPACES 0
+#endif /* ONLY_MSPACES */
+#ifndef MSPACES
+#if ONLY_MSPACES
+#define MSPACES 1
+#else /* ONLY_MSPACES */
+#define MSPACES 0
+#endif /* ONLY_MSPACES */
+#endif /* MSPACES */
+#ifndef MALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT ((size_t)8U)
+#endif /* MALLOC_ALIGNMENT */
+#ifndef FOOTERS
+#define FOOTERS 0
+#endif /* FOOTERS */
+#ifndef ABORT
+#define ABORT abort()
+#endif /* ABORT */
+#ifndef ABORT_ON_ASSERT_FAILURE
+#define ABORT_ON_ASSERT_FAILURE 1
+#endif /* ABORT_ON_ASSERT_FAILURE */
+#ifndef PROCEED_ON_ERROR
+#define PROCEED_ON_ERROR 0
+#endif /* PROCEED_ON_ERROR */
+#ifndef USE_LOCKS
+#define USE_LOCKS 0
+#endif /* USE_LOCKS */
+#ifndef INSECURE
+#define INSECURE 0
+#endif /* INSECURE */
+#ifndef HAVE_MMAP
+#define HAVE_MMAP 1
+#endif /* HAVE_MMAP */
+#ifndef MMAP_CLEARS
+#define MMAP_CLEARS 1
+#endif /* MMAP_CLEARS */
+#ifndef HAVE_MREMAP
+#ifdef linux
+#define HAVE_MREMAP 1
+#else /* linux */
+#define HAVE_MREMAP 0
+#endif /* linux */
+#endif /* HAVE_MREMAP */
+#ifndef MALLOC_FAILURE_ACTION
+#define MALLOC_FAILURE_ACTION errno = ENOMEM;
+#endif /* MALLOC_FAILURE_ACTION */
+#ifndef HAVE_MORECORE
+#if ONLY_MSPACES
+#define HAVE_MORECORE 0
+#else /* ONLY_MSPACES */
+#define HAVE_MORECORE 1
+#endif /* ONLY_MSPACES */
+#endif /* HAVE_MORECORE */
+#if !HAVE_MORECORE
+#define MORECORE_CONTIGUOUS 0
+#else /* !HAVE_MORECORE */
+#ifndef MORECORE
+#define MORECORE sbrk
+#endif /* MORECORE */
+#ifndef MORECORE_CONTIGUOUS
+#define MORECORE_CONTIGUOUS 1
+#endif /* MORECORE_CONTIGUOUS */
+#endif /* HAVE_MORECORE */
+#ifndef DEFAULT_GRANULARITY
+#if MORECORE_CONTIGUOUS
+#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
+#else /* MORECORE_CONTIGUOUS */
+#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
+#endif /* MORECORE_CONTIGUOUS */
+#endif /* DEFAULT_GRANULARITY */
+#ifndef DEFAULT_TRIM_THRESHOLD
+#ifndef MORECORE_CANNOT_TRIM
+#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
+#else /* MORECORE_CANNOT_TRIM */
+#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
+#endif /* MORECORE_CANNOT_TRIM */
+#endif /* DEFAULT_TRIM_THRESHOLD */
+#ifndef DEFAULT_MMAP_THRESHOLD
+#if HAVE_MMAP
+#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
+#else /* HAVE_MMAP */
+#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
+#endif /* HAVE_MMAP */
+#endif /* DEFAULT_MMAP_THRESHOLD */
+#ifndef USE_BUILTIN_FFS
+#define USE_BUILTIN_FFS 0
+#endif /* USE_BUILTIN_FFS */
+#ifndef USE_DEV_RANDOM
+#define USE_DEV_RANDOM 0
+#endif /* USE_DEV_RANDOM */
+#ifndef NO_MALLINFO
+#define NO_MALLINFO 0
+#endif /* NO_MALLINFO */
+#ifndef MALLINFO_FIELD_TYPE
+#define MALLINFO_FIELD_TYPE size_t
+#endif /* MALLINFO_FIELD_TYPE */
+
+#ifndef memset
+#define memset SDL_memset
+#endif
+#ifndef memcpy
+#define memcpy SDL_memcpy
+#endif
+
+/*
+ mallopt tuning options. SVID/XPG defines four standard parameter
+ numbers for mallopt, normally defined in malloc.h. None of these
+ are used in this malloc, so setting them has no effect. But this
+ malloc does support the following options.
+*/
+
+#define M_TRIM_THRESHOLD (-1)
+#define M_GRANULARITY (-2)
+#define M_MMAP_THRESHOLD (-3)
+
+/* ------------------------ Mallinfo declarations ------------------------ */
+
+#if !NO_MALLINFO
+/*
+ This version of malloc supports the standard SVID/XPG mallinfo
+ routine that returns a struct containing usage properties and
+ statistics. It should work on any system that has a
+ /usr/include/malloc.h defining struct mallinfo. The main
+ declaration needed is the mallinfo struct that is returned (by-copy)
+ by mallinfo(). The malloinfo struct contains a bunch of fields that
+ are not even meaningful in this version of malloc. These fields are
+ are instead filled by mallinfo() with other numbers that might be of
+ interest.
+
+ HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
+ /usr/include/malloc.h file that includes a declaration of struct
+ mallinfo. If so, it is included; else a compliant version is
+ declared below. These must be precisely the same for mallinfo() to
+ work. The original SVID version of this struct, defined on most
+ systems with mallinfo, declares all fields as ints. But some others
+ define as unsigned long. If your system defines the fields using a
+ type of different width than listed here, you MUST #include your
+ system version and #define HAVE_USR_INCLUDE_MALLOC_H.
+*/
+
+/* #define HAVE_USR_INCLUDE_MALLOC_H */
+
+#ifdef HAVE_USR_INCLUDE_MALLOC_H
+#include "/usr/include/malloc.h"
+#else /* HAVE_USR_INCLUDE_MALLOC_H */
+
+struct mallinfo
+{
+ MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */
+ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */
+ MALLINFO_FIELD_TYPE smblks; /* always 0 */
+ MALLINFO_FIELD_TYPE hblks; /* always 0 */
+ MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */
+ MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */
+ MALLINFO_FIELD_TYPE fsmblks; /* always 0 */
+ MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
+ MALLINFO_FIELD_TYPE fordblks; /* total free space */
+ MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
+};
+
+#endif /* HAVE_USR_INCLUDE_MALLOC_H */
+#endif /* NO_MALLINFO */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#if !ONLY_MSPACES
+
+/* ------------------- Declarations of public routines ------------------- */
+
+#ifndef USE_DL_PREFIX
+#define dlcalloc calloc
+#define dlfree free
+#define dlmalloc malloc
+#define dlmemalign memalign
+#define dlrealloc realloc
+#define dlvalloc valloc
+#define dlpvalloc pvalloc
+#define dlmallinfo mallinfo
+#define dlmallopt mallopt
+#define dlmalloc_trim malloc_trim
+#define dlmalloc_stats malloc_stats
+#define dlmalloc_usable_size malloc_usable_size
+#define dlmalloc_footprint malloc_footprint
+#define dlmalloc_max_footprint malloc_max_footprint
+#define dlindependent_calloc independent_calloc
+#define dlindependent_comalloc independent_comalloc
+#endif /* USE_DL_PREFIX */
+
+
+/*
+ malloc(size_t n)
+ Returns a pointer to a newly allocated chunk of at least n bytes, or
+ null if no space is available, in which case errno is set to ENOMEM
+ on ANSI C systems.
+
+ If n is zero, malloc returns a minimum-sized chunk. (The minimum
+ size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
+ systems.) Note that size_t is an unsigned type, so calls with
+ arguments that would be negative if signed are interpreted as
+ requests for huge amounts of space, which will often fail. The
+ maximum supported value of n differs across systems, but is in all
+ cases less than the maximum representable value of a size_t.
+*/
+ void *dlmalloc(size_t);
+
+/*
+ free(void* p)
+ Releases the chunk of memory pointed to by p, that had been previously
+ allocated using malloc or a related routine such as realloc.
+ It has no effect if p is null. If p was not malloced or already
+ freed, free(p) will by default cause the current program to abort.
+*/
+ void dlfree(void *);
+
+/*
+ calloc(size_t n_elements, size_t element_size);
+ Returns a pointer to n_elements * element_size bytes, with all locations
+ set to zero.
+*/
+ void *dlcalloc(size_t, size_t);
+
+/*
+ realloc(void* p, size_t n)
+ Returns a pointer to a chunk of size n that contains the same data
+ as does chunk p up to the minimum of (n, p's size) bytes, or null
+ if no space is available.
+
+ The returned pointer may or may not be the same as p. The algorithm
+ prefers extending p in most cases when possible, otherwise it
+ employs the equivalent of a malloc-copy-free sequence.
+
+ If p is null, realloc is equivalent to malloc.
+
+ If space is not available, realloc returns null, errno is set (if on
+ ANSI) and p is NOT freed.
+
+ if n is for fewer bytes than already held by p, the newly unused
+ space is lopped off and freed if possible. realloc with a size
+ argument of zero (re)allocates a minimum-sized chunk.
+
+ The old unix realloc convention of allowing the last-free'd chunk
+ to be used as an argument to realloc is not supported.
+*/
+
+ void *dlrealloc(void *, size_t);
+
+/*
+ memalign(size_t alignment, size_t n);
+ Returns a pointer to a newly allocated chunk of n bytes, aligned
+ in accord with the alignment argument.
+
+ The alignment argument should be a power of two. If the argument is
+ not a power of two, the nearest greater power is used.
+ 8-byte alignment is guaranteed by normal malloc calls, so don't
+ bother calling memalign with an argument of 8 or less.
+
+ Overreliance on memalign is a sure way to fragment space.
+*/
+ void *dlmemalign(size_t, size_t);
+
+/*
+ valloc(size_t n);
+ Equivalent to memalign(pagesize, n), where pagesize is the page
+ size of the system. If the pagesize is unknown, 4096 is used.
+*/
+ void *dlvalloc(size_t);
+
+/*
+ mallopt(int parameter_number, int parameter_value)
+ Sets tunable parameters The format is to provide a
+ (parameter-number, parameter-value) pair. mallopt then sets the
+ corresponding parameter to the argument value if it can (i.e., so
+ long as the value is meaningful), and returns 1 if successful else
+ 0. SVID/XPG/ANSI defines four standard param numbers for mallopt,
+ normally defined in malloc.h. None of these are use in this malloc,
+ so setting them has no effect. But this malloc also supports other
+ options in mallopt. See below for details. Briefly, supported
+ parameters are as follows (listed defaults are for "typical"
+ configurations).
+
+ Symbol param # default allowed param values
+ M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables)
+ M_GRANULARITY -2 page size any power of 2 >= page size
+ M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
+*/
+ int dlmallopt(int, int);
+
+/*
+ malloc_footprint();
+ Returns the number of bytes obtained from the system. The total
+ number of bytes allocated by malloc, realloc etc., is less than this
+ value. Unlike mallinfo, this function returns only a precomputed
+ result, so can be called frequently to monitor memory consumption.
+ Even if locks are otherwise defined, this function does not use them,
+ so results might not be up to date.
+*/
+ size_t dlmalloc_footprint(void);
+
+/*
+ malloc_max_footprint();
+ Returns the maximum number of bytes obtained from the system. This
+ value will be greater than current footprint if deallocated space
+ has been reclaimed by the system. The peak number of bytes allocated
+ by malloc, realloc etc., is less than this value. Unlike mallinfo,
+ this function returns only a precomputed result, so can be called
+ frequently to monitor memory consumption. Even if locks are
+ otherwise defined, this function does not use them, so results might
+ not be up to date.
+*/
+ size_t dlmalloc_max_footprint(void);
+
+#if !NO_MALLINFO
+/*
+ mallinfo()
+ Returns (by copy) a struct containing various summary statistics:
+
+ arena: current total non-mmapped bytes allocated from system
+ ordblks: the number of free chunks
+ smblks: always zero.
+ hblks: current number of mmapped regions
+ hblkhd: total bytes held in mmapped regions
+ usmblks: the maximum total allocated space. This will be greater
+ than current total if trimming has occurred.
+ fsmblks: always zero
+ uordblks: current total allocated space (normal or mmapped)
+ fordblks: total free space
+ keepcost: the maximum number of bytes that could ideally be released
+ back to system via malloc_trim. ("ideally" means that
+ it ignores page restrictions etc.)
+
+ Because these fields are ints, but internal bookkeeping may
+ be kept as longs, the reported values may wrap around zero and
+ thus be inaccurate.
+*/
+ struct mallinfo dlmallinfo(void);
+#endif /* NO_MALLINFO */
+
+/*
+ independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
+
+ independent_calloc is similar to calloc, but instead of returning a
+ single cleared space, it returns an array of pointers to n_elements
+ independent elements that can hold contents of size elem_size, each
+ of which starts out cleared, and can be independently freed,
+ realloc'ed etc. The elements are guaranteed to be adjacently
+ allocated (this is not guaranteed to occur with multiple callocs or
+ mallocs), which may also improve cache locality in some
+ applications.
+
+ The "chunks" argument is optional (i.e., may be null, which is
+ probably the most typical usage). If it is null, the returned array
+ is itself dynamically allocated and should also be freed when it is
+ no longer needed. Otherwise, the chunks array must be of at least
+ n_elements in length. It is filled in with the pointers to the
+ chunks.
+
+ In either case, independent_calloc returns this pointer array, or
+ null if the allocation failed. If n_elements is zero and "chunks"
+ is null, it returns a chunk representing an array with zero elements
+ (which should be freed if not wanted).
+
+ Each element must be individually freed when it is no longer
+ needed. If you'd like to instead be able to free all at once, you
+ should instead use regular calloc and assign pointers into this
+ space to represent elements. (In this case though, you cannot
+ independently free elements.)
+
+ independent_calloc simplifies and speeds up implementations of many
+ kinds of pools. It may also be useful when constructing large data
+ structures that initially have a fixed number of fixed-sized nodes,
+ but the number is not known at compile time, and some of the nodes
+ may later need to be freed. For example:
+
+ struct Node { int item; struct Node* next; };
+
+ struct Node* build_list() {
+ struct Node** pool;
+ int n = read_number_of_nodes_needed();
+ if (n <= 0) return 0;
+ pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
+ if (pool == 0) die();
+ // organize into a linked list...
+ struct Node* first = pool[0];
+ for (i = 0; i < n-1; ++i)
+ pool[i]->next = pool[i+1];
+ free(pool); // Can now free the array (or not, if it is needed later)
+ return first;
+ }
+*/
+ void **dlindependent_calloc(size_t, size_t, void **);
+
+/*
+ independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
+
+ independent_comalloc allocates, all at once, a set of n_elements
+ chunks with sizes indicated in the "sizes" array. It returns
+ an array of pointers to these elements, each of which can be
+ independently freed, realloc'ed etc. The elements are guaranteed to
+ be adjacently allocated (this is not guaranteed to occur with
+ multiple callocs or mallocs), which may also improve cache locality
+ in some applications.
+
+ The "chunks" argument is optional (i.e., may be null). If it is null
+ the returned array is itself dynamically allocated and should also
+ be freed when it is no longer needed. Otherwise, the chunks array
+ must be of at least n_elements in length. It is filled in with the
+ pointers to the chunks.
+
+ In either case, independent_comalloc returns this pointer array, or
+ null if the allocation failed. If n_elements is zero and chunks is
+ null, it returns a chunk representing an array with zero elements
+ (which should be freed if not wanted).
+
+ Each element must be individually freed when it is no longer
+ needed. If you'd like to instead be able to free all at once, you
+ should instead use a single regular malloc, and assign pointers at
+ particular offsets in the aggregate space. (In this case though, you
+ cannot independently free elements.)
+
+ independent_comallac differs from independent_calloc in that each
+ element may have a different size, and also that it does not
+ automatically clear elements.
+
+ independent_comalloc can be used to speed up allocation in cases
+ where several structs or objects must always be allocated at the
+ same time. For example:
+
+ struct Head { ... }
+ struct Foot { ... }
+
+ void send_message(char* msg) {
+ int msglen = strlen(msg);
+ size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
+ void* chunks[3];
+ if (independent_comalloc(3, sizes, chunks) == 0)
+ die();
+ struct Head* head = (struct Head*)(chunks[0]);
+ char* body = (char*)(chunks[1]);
+ struct Foot* foot = (struct Foot*)(chunks[2]);
+ // ...
+ }
+
+ In general though, independent_comalloc is worth using only for
+ larger values of n_elements. For small values, you probably won't
+ detect enough difference from series of malloc calls to bother.
+
+ Overuse of independent_comalloc can increase overall memory usage,
+ since it cannot reuse existing noncontiguous small chunks that
+ might be available for some of the elements.
+*/
+ void **dlindependent_comalloc(size_t, size_t *, void **);
+
+
+/*
+ pvalloc(size_t n);
+ Equivalent to valloc(minimum-page-that-holds(n)), that is,
+ round up n to nearest pagesize.
+ */
+ void *dlpvalloc(size_t);
+
+/*
+ malloc_trim(size_t pad);
+
+ If possible, gives memory back to the system (via negative arguments
+ to sbrk) if there is unused memory at the `high' end of the malloc
+ pool or in unused MMAP segments. You can call this after freeing
+ large blocks of memory to potentially reduce the system-level memory
+ requirements of a program. However, it cannot guarantee to reduce
+ memory. Under some allocation patterns, some large free blocks of
+ memory will be locked between two used chunks, so they cannot be
+ given back to the system.
+
+ The `pad' argument to malloc_trim represents the amount of free
+ trailing space to leave untrimmed. If this argument is zero, only
+ the minimum amount of memory to maintain internal data structures
+ will be left. Non-zero arguments can be supplied to maintain enough
+ trailing space to service future expected allocations without having
+ to re-obtain memory from the system.
+
+ Malloc_trim returns 1 if it actually released any memory, else 0.
+*/
+ int dlmalloc_trim(size_t);
+
+/*
+ malloc_usable_size(void* p);
+
+ Returns the number of bytes you can actually use in
+ an allocated chunk, which may be more than you requested (although
+ often not) due to alignment and minimum size constraints.
+ You can use this many bytes without worrying about
+ overwriting other allocated objects. This is not a particularly great
+ programming practice. malloc_usable_size can be more useful in
+ debugging and assertions, for example:
+
+ p = malloc(n);
+ assert(malloc_usable_size(p) >= 256);
+*/
+ size_t dlmalloc_usable_size(void *);
+
+/*
+ malloc_stats();
+ Prints on stderr the amount of space obtained from the system (both
+ via sbrk and mmap), the maximum amount (which may be more than
+ current if malloc_trim and/or munmap got called), and the current
+ number of bytes allocated via malloc (or realloc, etc) but not yet
+ freed. Note that this is the number of bytes allocated, not the
+ number requested. It will be larger than the number requested
+ because of alignment and bookkeeping overhead. Because it includes
+ alignment wastage as being in use, this figure may be greater than
+ zero even when no user-level chunks are allocated.
+
+ The reported current and maximum system memory can be inaccurate if
+ a program makes other calls to system memory allocation functions
+ (normally sbrk) outside of malloc.
+
+ malloc_stats prints only the most commonly interesting statistics.
+ More information can be obtained by calling mallinfo.
+*/
+ void dlmalloc_stats(void);
+
+#endif /* ONLY_MSPACES */
+
+#if MSPACES
+
+/*
+ mspace is an opaque type representing an independent
+ region of space that supports mspace_malloc, etc.
+*/
+ typedef void *mspace;
+
+/*
+ create_mspace creates and returns a new independent space with the
+ given initial capacity, or, if 0, the default granularity size. It
+ returns null if there is no system memory available to create the
+ space. If argument locked is non-zero, the space uses a separate
+ lock to control access. The capacity of the space will grow
+ dynamically as needed to service mspace_malloc requests. You can
+ control the sizes of incremental increases of this space by
+ compiling with a different DEFAULT_GRANULARITY or dynamically
+ setting with mallopt(M_GRANULARITY, value).
+*/
+ mspace create_mspace(size_t capacity, int locked);
+
+/*
+ destroy_mspace destroys the given space, and attempts to return all
+ of its memory back to the system, returning the total number of
+ bytes freed. After destruction, the results of access to all memory
+ used by the space become undefined.
+*/
+ size_t destroy_mspace(mspace msp);
+
+/*
+ create_mspace_with_base uses the memory supplied as the initial base
+ of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
+ space is used for bookkeeping, so the capacity must be at least this
+ large. (Otherwise 0 is returned.) When this initial space is
+ exhausted, additional memory will be obtained from the system.
+ Destroying this space will deallocate all additionally allocated
+ space (if possible) but not the initial base.
+*/
+ mspace create_mspace_with_base(void *base, size_t capacity, int locked);
+
+/*
+ mspace_malloc behaves as malloc, but operates within
+ the given space.
+*/
+ void *mspace_malloc(mspace msp, size_t bytes);
+
+/*
+ mspace_free behaves as free, but operates within
+ the given space.
+
+ If compiled with FOOTERS==1, mspace_free is not actually needed.
+ free may be called instead of mspace_free because freed chunks from
+ any space are handled by their originating spaces.
+*/
+ void mspace_free(mspace msp, void *mem);
+
+/*
+ mspace_realloc behaves as realloc, but operates within
+ the given space.
+
+ If compiled with FOOTERS==1, mspace_realloc is not actually
+ needed. realloc may be called instead of mspace_realloc because
+ realloced chunks from any space are handled by their originating
+ spaces.
+*/
+ void *mspace_realloc(mspace msp, void *mem, size_t newsize);
+
+/*
+ mspace_calloc behaves as calloc, but operates within
+ the given space.
+*/
+ void *mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
+
+/*
+ mspace_memalign behaves as memalign, but operates within
+ the given space.
+*/
+ void *mspace_memalign(mspace msp, size_t alignment, size_t bytes);
+
+/*
+ mspace_independent_calloc behaves as independent_calloc, but
+ operates within the given space.
+*/
+ void **mspace_independent_calloc(mspace msp, size_t n_elements,
+ size_t elem_size, void *chunks[]);
+
+/*
+ mspace_independent_comalloc behaves as independent_comalloc, but
+ operates within the given space.
+*/
+ void **mspace_independent_comalloc(mspace msp, size_t n_elements,
+ size_t sizes[], void *chunks[]);
+
+/*
+ mspace_footprint() returns the number of bytes obtained from the
+ system for this space.
+*/
+ size_t mspace_footprint(mspace msp);
+
+/*
+ mspace_max_footprint() returns the peak number of bytes obtained from the
+ system for this space.
+*/
+ size_t mspace_max_footprint(mspace msp);
+
+
+#if !NO_MALLINFO
+/*
+ mspace_mallinfo behaves as mallinfo, but reports properties of
+ the given space.
+*/
+ struct mallinfo mspace_mallinfo(mspace msp);
+#endif /* NO_MALLINFO */
+
+/*
+ mspace_malloc_stats behaves as malloc_stats, but reports
+ properties of the given space.
+*/
+ void mspace_malloc_stats(mspace msp);
+
+/*
+ mspace_trim behaves as malloc_trim, but
+ operates within the given space.
+*/
+ int mspace_trim(mspace msp, size_t pad);
+
+/*
+ An alias for mallopt.
+*/
+ int mspace_mallopt(int, int);
+
+#endif /* MSPACES */
+
+#ifdef __cplusplus
+}; /* end of extern "C" */
+#endif /* __cplusplus */
+
+/*
+ ========================================================================
+ To make a fully customizable malloc.h header file, cut everything
+ above this line, put into file malloc.h, edit to suit, and #include it
+ on the next line, as well as in programs that use this malloc.
+ ========================================================================
+*/
+
+/* #include "malloc.h" */
+
+/*------------------------------ internal #includes ---------------------- */
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
+#endif /* _MSC_VER */
+
+#ifndef LACKS_STDIO_H
+#include <stdio.h> /* for printing in malloc_stats */
+#endif
+
+#ifndef LACKS_ERRNO_H
+#include <errno.h> /* for MALLOC_FAILURE_ACTION */
+#endif /* LACKS_ERRNO_H */
+#if FOOTERS
+#include <time.h> /* for magic initialization */
+#endif /* FOOTERS */
+#ifndef LACKS_STDLIB_H
+#include <stdlib.h> /* for abort() */
+#endif /* LACKS_STDLIB_H */
+#ifdef DEBUG
+#if ABORT_ON_ASSERT_FAILURE
+#define assert(x) if(!(x)) ABORT
+#else /* ABORT_ON_ASSERT_FAILURE */
+#include <assert.h>
+#endif /* ABORT_ON_ASSERT_FAILURE */
+#else /* DEBUG */
+#define assert(x)
+#endif /* DEBUG */
+#ifndef LACKS_STRING_H
+#include <string.h> /* for memset etc */
+#endif /* LACKS_STRING_H */
+#if USE_BUILTIN_FFS
+#ifndef LACKS_STRINGS_H
+#include <strings.h> /* for ffs */
+#endif /* LACKS_STRINGS_H */
+#endif /* USE_BUILTIN_FFS */
+#if HAVE_MMAP
+#ifndef LACKS_SYS_MMAN_H
+#include <sys/mman.h> /* for mmap */
+#endif /* LACKS_SYS_MMAN_H */
+#ifndef LACKS_FCNTL_H
+#include <fcntl.h>
+#endif /* LACKS_FCNTL_H */
+#endif /* HAVE_MMAP */
+#if HAVE_MORECORE
+#ifndef LACKS_UNISTD_H
+#include <unistd.h> /* for sbrk */
+#else /* LACKS_UNISTD_H */
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+extern void *sbrk(ptrdiff_t);
+#endif /* FreeBSD etc */
+#endif /* LACKS_UNISTD_H */
+#endif /* HAVE_MMAP */
+
+#ifndef WIN32
+#ifndef malloc_getpagesize
+# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
+# ifndef _SC_PAGE_SIZE
+# define _SC_PAGE_SIZE _SC_PAGESIZE
+# endif
+# endif
+# ifdef _SC_PAGE_SIZE
+# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
+# else
+# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
+extern size_t getpagesize();
+# define malloc_getpagesize getpagesize()
+# else
+# ifdef WIN32 /* use supplied emulation of getpagesize */
+# define malloc_getpagesize getpagesize()
+# else
+# ifndef LACKS_SYS_PARAM_H
+# include <sys/param.h>
+# endif
+# ifdef EXEC_PAGESIZE
+# define malloc_getpagesize EXEC_PAGESIZE
+# else
+# ifdef NBPG
+# ifndef CLSIZE
+# define malloc_getpagesize NBPG
+# else
+# define malloc_getpagesize (NBPG * CLSIZE)
+# endif
+# else
+# ifdef NBPC
+# define malloc_getpagesize NBPC
+# else
+# ifdef PAGESIZE
+# define malloc_getpagesize PAGESIZE
+# else /* just guess */
+# define malloc_getpagesize ((size_t)4096U)
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
+#endif
+#endif
+
+/* ------------------- size_t and alignment properties -------------------- */
+
+/* The byte and bit size of a size_t */
+#define SIZE_T_SIZE (sizeof(size_t))
+#define SIZE_T_BITSIZE (sizeof(size_t) << 3)
+
+/* Some constants coerced to size_t */
+/* Annoying but necessary to avoid errors on some plaftorms */
+#define SIZE_T_ZERO ((size_t)0)
+#define SIZE_T_ONE ((size_t)1)
+#define SIZE_T_TWO ((size_t)2)
+#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1)
+#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2)
+#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
+#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U)
+
+/* The bit mask value corresponding to MALLOC_ALIGNMENT */
+#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE)
+
+/* True if address a has acceptable alignment */
+#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
+
+/* the number of bytes to offset an address to align it */
+#define align_offset(A)\
+ ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
+ ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
+
+/* -------------------------- MMAP preliminaries ------------------------- */
+
+/*
+ If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
+ checks to fail so compiler optimizer can delete code rather than
+ using so many "#if"s.
+*/
+
+
+/* MORECORE and MMAP must return MFAIL on failure */
+#define MFAIL ((void*)(MAX_SIZE_T))
+#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */
+
+#if !HAVE_MMAP
+#define IS_MMAPPED_BIT (SIZE_T_ZERO)
+#define USE_MMAP_BIT (SIZE_T_ZERO)
+#define CALL_MMAP(s) MFAIL
+#define CALL_MUNMAP(a, s) (-1)
+#define DIRECT_MMAP(s) MFAIL
+
+#else /* HAVE_MMAP */
+#define IS_MMAPPED_BIT (SIZE_T_ONE)
+#define USE_MMAP_BIT (SIZE_T_ONE)
+
+#ifndef WIN32
+#define CALL_MUNMAP(a, s) munmap((a), (s))
+#define MMAP_PROT (PROT_READ|PROT_WRITE)
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif /* MAP_ANON */
+#ifdef MAP_ANONYMOUS
+#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
+#define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0)
+#else /* MAP_ANONYMOUS */
+/*
+ Nearly all versions of mmap support MAP_ANONYMOUS, so the following
+ is unlikely to be needed, but is supplied just in case.
+*/
+#define MMAP_FLAGS (MAP_PRIVATE)
+static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
+#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \
+ (dev_zero_fd = open("/dev/zero", O_RDWR), \
+ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
+ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
+#endif /* MAP_ANONYMOUS */
+
+#define DIRECT_MMAP(s) CALL_MMAP(s)
+#else /* WIN32 */
+
+/* Win32 MMAP via VirtualAlloc */
+static void *
+win32mmap(size_t size)
+{
+ void *ptr =
+ VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+ return (ptr != 0) ? ptr : MFAIL;
+}
+
+/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
+static void *
+win32direct_mmap(size_t size)
+{
+ void *ptr = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+ PAGE_READWRITE);
+ return (ptr != 0) ? ptr : MFAIL;
+}
+
+/* This function supports releasing coalesed segments */
+static int
+win32munmap(void *ptr, size_t size)
+{
+ MEMORY_BASIC_INFORMATION minfo;
+ char *cptr = ptr;
+ while (size) {
+ if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
+ return -1;
+ if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
+ minfo.State != MEM_COMMIT || minfo.RegionSize > size)
+ return -1;
+ if (VirtualFree(cptr, 0, MEM_RELEASE) == 0)
+ return -1;
+ cptr += minfo.RegionSize;
+ size -= minfo.RegionSize;
+ }
+ return 0;
+}
+
+#define CALL_MMAP(s) win32mmap(s)
+#define CALL_MUNMAP(a, s) win32munmap((a), (s))
+#define DIRECT_MMAP(s) win32direct_mmap(s)
+#endif /* WIN32 */
+#endif /* HAVE_MMAP */
+
+#if HAVE_MMAP && HAVE_MREMAP
+#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#else /* HAVE_MMAP && HAVE_MREMAP */
+#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif /* HAVE_MMAP && HAVE_MREMAP */
+
+#if HAVE_MORECORE
+#define CALL_MORECORE(S) MORECORE(S)
+#else /* HAVE_MORECORE */
+#define CALL_MORECORE(S) MFAIL
+#endif /* HAVE_MORECORE */
+
+/* mstate bit set if continguous morecore disabled or failed */
+#define USE_NONCONTIGUOUS_BIT (4U)
+
+/* segment bit set in create_mspace_with_base */
+#define EXTERN_BIT (8U)
+
+
+/* --------------------------- Lock preliminaries ------------------------ */
+
+#if USE_LOCKS
+
+/*
+ When locks are defined, there are up to two global locks:
+
+ * If HAVE_MORECORE, morecore_mutex protects sequences of calls to
+ MORECORE. In many cases sys_alloc requires two calls, that should
+ not be interleaved with calls by other threads. This does not
+ protect against direct calls to MORECORE by other threads not
+ using this lock, so there is still code to cope the best we can on
+ interference.
+
+ * magic_init_mutex ensures that mparams.magic and other
+ unique mparams values are initialized only once.
+*/
+
+#ifndef WIN32
+/* By default use posix locks */
+#include <pthread.h>
+#define MLOCK_T pthread_mutex_t
+#define INITIAL_LOCK(l) pthread_mutex_init(l, NULL)
+#define ACQUIRE_LOCK(l) pthread_mutex_lock(l)
+#define RELEASE_LOCK(l) pthread_mutex_unlock(l)
+
+#if HAVE_MORECORE
+static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif /* HAVE_MORECORE */
+
+static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+#else /* WIN32 */
+/*
+ Because lock-protected regions have bounded times, and there
+ are no recursive lock calls, we can use simple spinlocks.
+*/
+
+#define MLOCK_T long
+static int
+win32_acquire_lock(MLOCK_T * sl)
+{
+ for (;;) {
+#ifdef InterlockedCompareExchangePointer
+ if (!InterlockedCompareExchange(sl, 1, 0))
+ return 0;
+#else /* Use older void* version */
+ if (!InterlockedCompareExchange((void **) sl, (void *) 1, (void *) 0))
+ return 0;
+#endif /* InterlockedCompareExchangePointer */
+ Sleep(0);
+ }
+}
+
+static void
+win32_release_lock(MLOCK_T * sl)
+{
+ InterlockedExchange(sl, 0);
+}
+
+#define INITIAL_LOCK(l) *(l)=0
+#define ACQUIRE_LOCK(l) win32_acquire_lock(l)
+#define RELEASE_LOCK(l) win32_release_lock(l)
+#if HAVE_MORECORE
+static MLOCK_T morecore_mutex;
+#endif /* HAVE_MORECORE */
+static MLOCK_T magic_init_mutex;
+#endif /* WIN32 */
+
+#define USE_LOCK_BIT (2U)
+#else /* USE_LOCKS */
+#define USE_LOCK_BIT (0U)
+#define INITIAL_LOCK(l)
+#endif /* USE_LOCKS */
+
+#if USE_LOCKS && HAVE_MORECORE
+#define ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex);
+#define RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex);
+#else /* USE_LOCKS && HAVE_MORECORE */
+#define ACQUIRE_MORECORE_LOCK()
+#define RELEASE_MORECORE_LOCK()
+#endif /* USE_LOCKS && HAVE_MORECORE */
+
+#if USE_LOCKS
+#define ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex);
+#define RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex);
+#else /* USE_LOCKS */
+#define ACQUIRE_MAGIC_INIT_LOCK()
+#define RELEASE_MAGIC_INIT_LOCK()
+#endif /* USE_LOCKS */
+
+
+/* ----------------------- Chunk representations ------------------------ */
+
+/*
+ (The following includes lightly edited explanations by Colin Plumb.)
+
+ The malloc_chunk declaration below is misleading (but accurate and
+ necessary). It declares a "view" into memory allowing access to
+ necessary fields at known offsets from a given base.
+
+ Chunks of memory are maintained using a `boundary tag' method as
+ originally described by Knuth. (See the paper by Paul Wilson
+ ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such
+ techniques.) Sizes of free chunks are stored both in the front of
+ each chunk and at the end. This makes consolidating fragmented
+ chunks into bigger chunks fast. The head fields also hold bits
+ representing whether chunks are free or in use.
+
+ Here are some pictures to make it clearer. They are "exploded" to
+ show that the state of a chunk can be thought of as extending from
+ the high 31 bits of the head field of its header through the
+ prev_foot and PINUSE_BIT bit of the following chunk header.
+
+ A chunk that's in use looks like:
+
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of previous chunk (if P = 1) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
+ | Size of this chunk 1| +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | |
+ +- -+
+ | |
+ +- -+
+ | :
+ +- size - sizeof(size_t) available payload bytes -+
+ : |
+ chunk-> +- -+
+ | |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1|
+ | Size of next chunk (may or may not be in use) | +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ And if it's free, it looks like this:
+
+ chunk-> +- -+
+ | User payload (must be in use, or we would have merged!) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
+ | Size of this chunk 0| +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Next pointer |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Prev pointer |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | :
+ +- size - sizeof(struct chunk) unused bytes -+
+ : |
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of this chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|
+ | Size of next chunk (must be in use, or we would have merged)| +-+
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | :
+ +- User payload -+
+ : |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |0|
+ +-+
+ Note that since we always merge adjacent free chunks, the chunks
+ adjacent to a free chunk must be in use.
+
+ Given a pointer to a chunk (which can be derived trivially from the
+ payload pointer) we can, in O(1) time, find out whether the adjacent
+ chunks are free, and if so, unlink them from the lists that they
+ are on and merge them with the current chunk.
+
+ Chunks always begin on even word boundaries, so the mem portion
+ (which is returned to the user) is also on an even word boundary, and
+ thus at least double-word aligned.
+
+ The P (PINUSE_BIT) bit, stored in the unused low-order bit of the
+ chunk size (which is always a multiple of two words), is an in-use
+ bit for the *previous* chunk. If that bit is *clear*, then the
+ word before the current chunk size contains the previous chunk
+ size, and can be used to find the front of the previous chunk.
+ The very first chunk allocated always has this bit set, preventing
+ access to non-existent (or non-owned) memory. If pinuse is set for
+ any given chunk, then you CANNOT determine the size of the
+ previous chunk, and might even get a memory addressing fault when
+ trying to do so.
+
+ The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of
+ the chunk size redundantly records whether the current chunk is
+ inuse. This redundancy enables usage checks within free and realloc,
+ and reduces indirection when freeing and consolidating chunks.
+
+ Each freshly allocated chunk must have both cinuse and pinuse set.
+ That is, each allocated chunk borders either a previously allocated
+ and still in-use chunk, or the base of its memory arena. This is
+ ensured by making all allocations from the the `lowest' part of any
+ found chunk. Further, no free chunk physically borders another one,
+ so each free chunk is known to be preceded and followed by either
+ inuse chunks or the ends of memory.
+
+ Note that the `foot' of the current chunk is actually represented
+ as the prev_foot of the NEXT chunk. This makes it easier to
+ deal with alignments etc but can be very confusing when trying
+ to extend or adapt this code.
+
+ The exceptions to all this are
+
+ 1. The special chunk `top' is the top-most available chunk (i.e.,
+ the one bordering the end of available memory). It is treated
+ specially. Top is never included in any bin, is used only if
+ no other chunk is available, and is released back to the
+ system if it is very large (see M_TRIM_THRESHOLD). In effect,
+ the top chunk is treated as larger (and thus less well
+ fitting) than any other available chunk. The top chunk
+ doesn't update its trailing size field since there is no next
+ contiguous chunk that would have to index off it. However,
+ space is still allocated for it (TOP_FOOT_SIZE) to enable
+ separation or merging when space is extended.
+
+ 3. Chunks allocated via mmap, which have the lowest-order bit
+ (IS_MMAPPED_BIT) set in their prev_foot fields, and do not set
+ PINUSE_BIT in their head fields. Because they are allocated
+ one-by-one, each must carry its own prev_foot field, which is
+ also used to hold the offset this chunk has within its mmapped
+ region, which is needed to preserve alignment. Each mmapped
+ chunk is trailed by the first two fields of a fake next-chunk
+ for sake of usage checks.
+
+*/
+
+struct malloc_chunk
+{
+ size_t prev_foot; /* Size of previous chunk (if free). */
+ size_t head; /* Size and inuse bits. */
+ struct malloc_chunk *fd; /* double links -- used only if free. */
+ struct malloc_chunk *bk;
+};
+
+typedef struct malloc_chunk mchunk;
+typedef struct malloc_chunk *mchunkptr;
+typedef struct malloc_chunk *sbinptr; /* The type of bins of chunks */
+typedef size_t bindex_t; /* Described below */
+typedef unsigned int binmap_t; /* Described below */
+typedef unsigned int flag_t; /* The type of various bit flag sets */
+
+/* ------------------- Chunks sizes and alignments ----------------------- */
+
+#define MCHUNK_SIZE (sizeof(mchunk))
+
+#if FOOTERS
+#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
+#else /* FOOTERS */
+#define CHUNK_OVERHEAD (SIZE_T_SIZE)
+#endif /* FOOTERS */
+
+/* MMapped chunks need a second word of overhead ... */
+#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
+/* ... and additional padding for fake next-chunk at foot */
+#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES)
+
+/* The smallest size we can malloc is an aligned minimal chunk */
+#define MIN_CHUNK_SIZE\
+ ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* conversion from malloc headers to user pointers, and back */
+#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
+#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
+/* chunk associated with aligned address A */
+#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
+
+/* Bounds on request (not chunk) sizes. */
+#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2)
+#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
+
+/* pad request bytes into a usable size */
+#define pad_request(req) \
+ (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* pad request, checking for minimum (but not maximum) */
+#define request2size(req) \
+ (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
+
+
+/* ------------------ Operations on head and foot fields ----------------- */
+
+/*
+ The head field of a chunk is or'ed with PINUSE_BIT when previous
+ adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
+ use. If the chunk was obtained with mmap, the prev_foot field has
+ IS_MMAPPED_BIT set, otherwise holding the offset of the base of the
+ mmapped region to the base of the chunk.
+*/
+
+#define PINUSE_BIT (SIZE_T_ONE)
+#define CINUSE_BIT (SIZE_T_TWO)
+#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT)
+
+/* Head value for fenceposts */
+#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE)
+
+/* extraction of fields from head words */
+#define cinuse(p) ((p)->head & CINUSE_BIT)
+#define pinuse(p) ((p)->head & PINUSE_BIT)
+#define chunksize(p) ((p)->head & ~(INUSE_BITS))
+
+#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT)
+#define clear_cinuse(p) ((p)->head &= ~CINUSE_BIT)
+
+/* Treat space at ptr +/- offset as a chunk */
+#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
+#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s)))
+
+/* Ptr to next or previous physical malloc_chunk. */
+#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS)))
+#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))
+
+/* extract next chunk's pinuse bit */
+#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT)
+
+/* Get/set size at footer */
+#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot)
+#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))
+
+/* Set size, pinuse bit, and foot */
+#define set_size_and_pinuse_of_free_chunk(p, s)\
+ ((p)->head = (s|PINUSE_BIT), set_foot(p, s))
+
+/* Set size, pinuse bit, foot, and clear next pinuse */
+#define set_free_with_pinuse(p, s, n)\
+ (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
+
+#define is_mmapped(p)\
+ (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT))
+
+/* Get the internal overhead associated with chunk p */
+#define overhead_for(p)\
+ (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
+
+/* Return true if malloced space is not necessarily cleared */
+#if MMAP_CLEARS
+#define calloc_must_clear(p) (!is_mmapped(p))
+#else /* MMAP_CLEARS */
+#define calloc_must_clear(p) (1)
+#endif /* MMAP_CLEARS */
+
+/* ---------------------- Overlaid data structures ----------------------- */
+
+/*
+ When chunks are not in use, they are treated as nodes of either
+ lists or trees.
+
+ "Small" chunks are stored in circular doubly-linked lists, and look
+ like this:
+
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of previous chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `head:' | Size of chunk, in bytes |P|
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Forward pointer to next chunk in list |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Back pointer to previous chunk in list |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Unused space (may be 0 bytes long) .
+ . .
+ . |
+nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `foot:' | Size of chunk, in bytes |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ Larger chunks are kept in a form of bitwise digital trees (aka
+ tries) keyed on chunksizes. Because malloc_tree_chunks are only for
+ free chunks greater than 256 bytes, their size doesn't impose any
+ constraints on user chunk sizes. Each node looks like:
+
+ chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Size of previous chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `head:' | Size of chunk, in bytes |P|
+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Forward pointer to next chunk of same size |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Back pointer to previous chunk of same size |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Pointer to left child (child[0]) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Pointer to right child (child[1]) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Pointer to parent |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | bin index of this chunk |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Unused space .
+ . |
+nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ `foot:' | Size of chunk, in bytes |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ Each tree holding treenodes is a tree of unique chunk sizes. Chunks
+ of the same size are arranged in a circularly-linked list, with only
+ the oldest chunk (the next to be used, in our FIFO ordering)
+ actually in the tree. (Tree members are distinguished by a non-null
+ parent pointer.) If a chunk with the same size an an existing node
+ is inserted, it is linked off the existing node using pointers that
+ work in the same way as fd/bk pointers of small chunks.
+
+ Each tree contains a power of 2 sized range of chunk sizes (the
+ smallest is 0x100 <= x < 0x180), which is is divided in half at each
+ tree level, with the chunks in the smaller half of the range (0x100
+ <= x < 0x140 for the top nose) in the left subtree and the larger
+ half (0x140 <= x < 0x180) in the right subtree. This is, of course,
+ done by inspecting individual bits.
+
+ Using these rules, each node's left subtree contains all smaller
+ sizes than its right subtree. However, the node at the root of each
+ subtree has no particular ordering relationship to either. (The
+ dividing line between the subtree sizes is based on trie relation.)
+ If we remove the last chunk of a given size from the interior of the
+ tree, we need to replace it with a leaf node. The tree ordering
+ rules permit a node to be replaced by any leaf below it.
+
+ The smallest chunk in a tree (a common operation in a best-fit
+ allocator) can be found by walking a path to the leftmost leaf in
+ the tree. Unlike a usual binary tree, where we follow left child
+ pointers until we reach a null, here we follow the right child
+ pointer any time the left one is null, until we reach a leaf with
+ both child pointers null. The smallest chunk in the tree will be
+ somewhere along that path.
+
+ The worst case number of steps to add, find, or remove a node is
+ bounded by the number of bits differentiating chunks within
+ bins. Under current bin calculations, this ranges from 6 up to 21
+ (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case
+ is of course much better.
+*/
+
+struct malloc_tree_chunk
+{
+ /* The first four fields must be compatible with malloc_chunk */
+ size_t prev_foot;
+ size_t head;
+ struct malloc_tree_chunk *fd;
+ struct malloc_tree_chunk *bk;
+
+ struct malloc_tree_chunk *child[2];
+ struct malloc_tree_chunk *parent;
+ bindex_t index;
+};
+
+typedef struct malloc_tree_chunk tchunk;
+typedef struct malloc_tree_chunk *tchunkptr;
+typedef struct malloc_tree_chunk *tbinptr; /* The type of bins of trees */
+
+/* A little helper macro for trees */
+#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
+
+/* ----------------------------- Segments -------------------------------- */
+
+/*
+ Each malloc space may include non-contiguous segments, held in a
+ list headed by an embedded malloc_segment record representing the
+ top-most space. Segments also include flags holding properties of
+ the space. Large chunks that are directly allocated by mmap are not
+ included in this list. They are instead independently created and
+ destroyed without otherwise keeping track of them.
+
+ Segment management mainly comes into play for spaces allocated by
+ MMAP. Any call to MMAP might or might not return memory that is
+ adjacent to an existing segment. MORECORE normally contiguously
+ extends the current space, so this space is almost always adjacent,
+ which is simpler and faster to deal with. (This is why MORECORE is
+ used preferentially to MMAP when both are available -- see
+ sys_alloc.) When allocating using MMAP, we don't use any of the
+ hinting mechanisms (inconsistently) supported in various
+ implementations of unix mmap, or distinguish reserving from
+ committing memory. Instead, we just ask for space, and exploit
+ contiguity when we get it. It is probably possible to do
+ better than this on some systems, but no general scheme seems
+ to be significantly better.
+
+ Management entails a simpler variant of the consolidation scheme
+ used for chunks to reduce fragmentation -- new adjacent memory is
+ normally prepended or appended to an existing segment. However,
+ there are limitations compared to chunk consolidation that mostly
+ reflect the fact that segment processing is relatively infrequent
+ (occurring only when getting memory from system) and that we
+ don't expect to have huge numbers of segments:
+
+ * Segments are not indexed, so traversal requires linear scans. (It
+ would be possible to index these, but is not worth the extra
+ overhead and complexity for most programs on most platforms.)
+ * New segments are only appended to old ones when holding top-most
+ memory; if they cannot be prepended to others, they are held in
+ different segments.
+
+ Except for the top-most segment of an mstate, each segment record
+ is kept at the tail of its segment. Segments are added by pushing
+ segment records onto the list headed by &mstate.seg for the
+ containing mstate.
+
+ Segment flags control allocation/merge/deallocation policies:
+ * If EXTERN_BIT set, then we did not allocate this segment,
+ and so should not try to deallocate or merge with others.
+ (This currently holds only for the initial segment passed
+ into create_mspace_with_base.)
+ * If IS_MMAPPED_BIT set, the segment may be merged with
+ other surrounding mmapped segments and trimmed/de-allocated
+ using munmap.
+ * If neither bit is set, then the segment was obtained using
+ MORECORE so can be merged with surrounding MORECORE'd segments
+ and deallocated/trimmed using MORECORE with negative arguments.
+*/
+
+struct malloc_segment
+{
+ char *base; /* base address */
+ size_t size; /* allocated size */
+ struct malloc_segment *next; /* ptr to next segment */
+ flag_t sflags; /* mmap and extern flag */
+};
+
+#define is_mmapped_segment(S) ((S)->sflags & IS_MMAPPED_BIT)
+#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT)
+
+typedef struct malloc_segment msegment;
+typedef struct malloc_segment *msegmentptr;
+
+/* ---------------------------- malloc_state ----------------------------- */
+
+/*
+ A malloc_state holds all of the bookkeeping for a space.
+ The main fields are:
+
+ Top
+ The topmost chunk of the currently active segment. Its size is
+ cached in topsize. The actual size of topmost space is
+ topsize+TOP_FOOT_SIZE, which includes space reserved for adding
+ fenceposts and segment records if necessary when getting more
+ space from the system. The size at which to autotrim top is
+ cached from mparams in trim_check, except that it is disabled if
+ an autotrim fails.
+
+ Designated victim (dv)
+ This is the preferred chunk for servicing small requests that
+ don't have exact fits. It is normally the chunk split off most
+ recently to service another small request. Its size is cached in
+ dvsize. The link fields of this chunk are not maintained since it
+ is not kept in a bin.
+
+ SmallBins
+ An array of bin headers for free chunks. These bins hold chunks
+ with sizes less than MIN_LARGE_SIZE bytes. Each bin contains
+ chunks of all the same size, spaced 8 bytes apart. To simplify
+ use in double-linked lists, each bin header acts as a malloc_chunk
+ pointing to the real first node, if it exists (else pointing to
+ itself). This avoids special-casing for headers. But to avoid
+ waste, we allocate only the fd/bk pointers of bins, and then use
+ repositioning tricks to treat these as the fields of a chunk.
+
+ TreeBins
+ Treebins are pointers to the roots of trees holding a range of
+ sizes. There are 2 equally spaced treebins for each power of two
+ from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything
+ larger.
+
+ Bin maps
+ There is one bit map for small bins ("smallmap") and one for
+ treebins ("treemap). Each bin sets its bit when non-empty, and
+ clears the bit when empty. Bit operations are then used to avoid
+ bin-by-bin searching -- nearly all "search" is done without ever
+ looking at bins that won't be selected. The bit maps
+ conservatively use 32 bits per map word, even if on 64bit system.
+ For a good description of some of the bit-based techniques used
+ here, see Henry S. Warren Jr's book "Hacker's Delight" (and
+ supplement at http://hackersdelight.org/). Many of these are
+ intended to reduce the branchiness of paths through malloc etc, as
+ well as to reduce the number of memory locations read or written.
+
+ Segments
+ A list of segments headed by an embedded malloc_segment record
+ representing the initial space.
+
+ Address check support
+ The least_addr field is the least address ever obtained from
+ MORECORE or MMAP. Attempted frees and reallocs of any address less
+ than this are trapped (unless INSECURE is defined).
+
+ Magic tag
+ A cross-check field that should always hold same value as mparams.magic.
+
+ Flags
+ Bits recording whether to use MMAP, locks, or contiguous MORECORE
+
+ Statistics
+ Each space keeps track of current and maximum system memory
+ obtained via MORECORE or MMAP.
+
+ Locking
+ If USE_LOCKS is defined, the "mutex" lock is acquired and released
+ around every public call using this mspace.
+*/
+
+/* Bin types, widths and sizes */
+#define NSMALLBINS (32U)
+#define NTREEBINS (32U)
+#define SMALLBIN_SHIFT (3U)
+#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT)
+#define TREEBIN_SHIFT (8U)
+#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT)
+#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE)
+#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
+
+struct malloc_state
+{
+ binmap_t smallmap;
+ binmap_t treemap;
+ size_t dvsize;
+ size_t topsize;
+ char *least_addr;
+ mchunkptr dv;
+ mchunkptr top;
+ size_t trim_check;
+ size_t magic;
+ mchunkptr smallbins[(NSMALLBINS + 1) * 2];
+ tbinptr treebins[NTREEBINS];
+ size_t footprint;
+ size_t max_footprint;
+ flag_t mflags;
+#if USE_LOCKS
+ MLOCK_T mutex; /* locate lock among fields that rarely change */
+#endif /* USE_LOCKS */
+ msegment seg;
+};
+
+typedef struct malloc_state *mstate;
+
+/* ------------- Global malloc_state and malloc_params ------------------- */
+
+/*
+ malloc_params holds global properties, including those that can be
+ dynamically set using mallopt. There is a single instance, mparams,
+ initialized in init_mparams.
+*/
+
+struct malloc_params
+{
+ size_t magic;
+ size_t page_size;
+ size_t granularity;
+ size_t mmap_threshold;
+ size_t trim_threshold;
+ flag_t default_mflags;
+};
+
+static struct malloc_params mparams;
+
+/* The global malloc_state used for all non-"mspace" calls */
+static struct malloc_state _gm_;
+#define gm (&_gm_)
+#define is_global(M) ((M) == &_gm_)
+#define is_initialized(M) ((M)->top != 0)
+
+/* -------------------------- system alloc setup ------------------------- */
+
+/* Operations on mflags */
+
+#define use_lock(M) ((M)->mflags & USE_LOCK_BIT)
+#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT)
+#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT)
+
+#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT)
+#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT)
+#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT)
+
+#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT)
+#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
+
+#define set_lock(M,L)\
+ ((M)->mflags = (L)?\
+ ((M)->mflags | USE_LOCK_BIT) :\
+ ((M)->mflags & ~USE_LOCK_BIT))
+
+/* page-align a size */
+#define page_align(S)\
+ (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE))
+
+/* granularity-align a size */
+#define granularity_align(S)\
+ (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE))
+
+#define is_page_aligned(S)\
+ (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
+#define is_granularity_aligned(S)\
+ (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
+
+/* True if segment S holds address A */
+#define segment_holds(S, A)\
+ ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
+
+/* Return segment holding given address */
+static msegmentptr
+segment_holding(mstate m, char *addr)
+{
+ msegmentptr sp = &m->seg;
+ for (;;) {
+ if (addr >= sp->base && addr < sp->base + sp->size)
+ return sp;
+ if ((sp = sp->next) == 0)
+ return 0;
+ }
+}
+
+/* Return true if segment contains a segment link */
+static int
+has_segment_link(mstate m, msegmentptr ss)
+{
+ msegmentptr sp = &m->seg;
+ for (;;) {
+ if ((char *) sp >= ss->base && (char *) sp < ss->base + ss->size)
+ return 1;
+ if ((sp = sp->next) == 0)
+ return 0;
+ }
+}
+
+#ifndef MORECORE_CANNOT_TRIM
+#define should_trim(M,s) ((s) > (M)->trim_check)
+#else /* MORECORE_CANNOT_TRIM */
+#define should_trim(M,s) (0)
+#endif /* MORECORE_CANNOT_TRIM */
+
+/*
+ TOP_FOOT_SIZE is padding at the end of a segment, including space
+ that may be needed to place segment records and fenceposts when new
+ noncontiguous segments are added.
+*/
+#define TOP_FOOT_SIZE\
+ (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
+
+
+/* ------------------------------- Hooks -------------------------------- */
+
+/*
+ PREACTION should be defined to return 0 on success, and nonzero on
+ failure. If you are not using locking, you can redefine these to do
+ anything you like.
+*/
+
+#if USE_LOCKS
+
+/* Ensure locks are initialized */
+#define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams())
+
+#define PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0)
+#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); }
+#else /* USE_LOCKS */
+
+#ifndef PREACTION
+#define PREACTION(M) (0)
+#endif /* PREACTION */
+
+#ifndef POSTACTION
+#define POSTACTION(M)
+#endif /* POSTACTION */
+
+#endif /* USE_LOCKS */
+
+/*
+ CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
+ USAGE_ERROR_ACTION is triggered on detected bad frees and
+ reallocs. The argument p is an address that might have triggered the
+ fault. It is ignored by the two predefined actions, but might be
+ useful in custom actions that try to help diagnose errors.
+*/
+
+#if PROCEED_ON_ERROR
+
+/* A count of the number of corruption errors causing resets */
+int malloc_corruption_error_count;
+
+/* default corruption action */
+static void reset_on_error(mstate m);
+
+#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m)
+#define USAGE_ERROR_ACTION(m, p)
+
+#else /* PROCEED_ON_ERROR */
+
+#ifndef CORRUPTION_ERROR_ACTION
+#define CORRUPTION_ERROR_ACTION(m) ABORT
+#endif /* CORRUPTION_ERROR_ACTION */
+
+#ifndef USAGE_ERROR_ACTION
+#define USAGE_ERROR_ACTION(m,p) ABORT
+#endif /* USAGE_ERROR_ACTION */
+
+#endif /* PROCEED_ON_ERROR */
+
+/* -------------------------- Debugging setup ---------------------------- */
+
+#if ! DEBUG
+
+#define check_free_chunk(M,P)
+#define check_inuse_chunk(M,P)
+#define check_malloced_chunk(M,P,N)
+#define check_mmapped_chunk(M,P)
+#define check_malloc_state(M)
+#define check_top_chunk(M,P)
+
+#else /* DEBUG */
+#define check_free_chunk(M,P) do_check_free_chunk(M,P)
+#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P)
+#define check_top_chunk(M,P) do_check_top_chunk(M,P)
+#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
+#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P)
+#define check_malloc_state(M) do_check_malloc_state(M)
+
+static void do_check_any_chunk(mstate m, mchunkptr p);
+static void do_check_top_chunk(mstate m, mchunkptr p);
+static void do_check_mmapped_chunk(mstate m, mchunkptr p);
+static void do_check_inuse_chunk(mstate m, mchunkptr p);
+static void do_check_free_chunk(mstate m, mchunkptr p);
+static void do_check_malloced_chunk(mstate m, void *mem, size_t s);
+static void do_check_tree(mstate m, tchunkptr t);
+static void do_check_treebin(mstate m, bindex_t i);
+static void do_check_smallbin(mstate m, bindex_t i);
+static void do_check_malloc_state(mstate m);
+static int bin_find(mstate m, mchunkptr x);
+static size_t traverse_and_check(mstate m);
+#endif /* DEBUG */
+
+/* ---------------------------- Indexing Bins ---------------------------- */
+
+#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
+#define small_index(s) ((s) >> SMALLBIN_SHIFT)
+#define small_index2size(i) ((i) << SMALLBIN_SHIFT)
+#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE))
+
+/* addressing by index. See above about smallbin repositioning */
+#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))
+#define treebin_at(M,i) (&((M)->treebins[i]))
+
+/* assign tree index for size S to variable I */
+#if defined(__GNUC__) && defined(i386)
+#define compute_tree_index(S, I)\
+{\
+ size_t X = S >> TREEBIN_SHIFT;\
+ if (X == 0)\
+ I = 0;\
+ else if (X > 0xFFFF)\
+ I = NTREEBINS-1;\
+ else {\
+ unsigned int K;\
+ __asm__("bsrl %1,%0\n\t" : "=r" (K) : "rm" (X));\
+ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
+ }\
+}
+#else /* GNUC */
+#define compute_tree_index(S, I)\
+{\
+ size_t X = S >> TREEBIN_SHIFT;\
+ if (X == 0)\
+ I = 0;\
+ else if (X > 0xFFFF)\
+ I = NTREEBINS-1;\
+ else {\
+ unsigned int Y = (unsigned int)X;\
+ unsigned int N = ((Y - 0x100) >> 16) & 8;\
+ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\
+ N += K;\
+ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\
+ K = 14 - N + ((Y <<= K) >> 15);\
+ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\
+ }\
+}
+#endif /* GNUC */
+
+/* Bit representing maximum resolved size in a treebin at i */
+#define bit_for_tree_index(i) \
+ (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
+
+/* Shift placing maximum resolved bit in a treebin at i as sign bit */
+#define leftshift_for_tree_index(i) \
+ ((i == NTREEBINS-1)? 0 : \
+ ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
+
+/* The size of the smallest chunk held in bin with index i */
+#define minsize_for_tree_index(i) \
+ ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
+ (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
+
+
+/* ------------------------ Operations on bin maps ----------------------- */
+
+/* bit corresponding to given index */
+#define idx2bit(i) ((binmap_t)(1) << (i))
+
+/* Mark/Clear bits with given index */
+#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i))
+#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i))
+#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i))
+
+#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i))
+#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i))
+#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i))
+
+/* index corresponding to given bit */
+
+#if defined(__GNUC__) && defined(i386)
+#define compute_bit2idx(X, I)\
+{\
+ unsigned int J;\
+ __asm__("bsfl %1,%0\n\t" : "=r" (J) : "rm" (X));\
+ I = (bindex_t)J;\
+}
+
+#else /* GNUC */
+#if USE_BUILTIN_FFS
+#define compute_bit2idx(X, I) I = ffs(X)-1
+
+#else /* USE_BUILTIN_FFS */
+#define compute_bit2idx(X, I)\
+{\
+ unsigned int Y = X - 1;\
+ unsigned int K = Y >> (16-4) & 16;\
+ unsigned int N = K; Y >>= K;\
+ N += K = Y >> (8-3) & 8; Y >>= K;\
+ N += K = Y >> (4-2) & 4; Y >>= K;\
+ N += K = Y >> (2-1) & 2; Y >>= K;\
+ N += K = Y >> (1-0) & 1; Y >>= K;\
+ I = (bindex_t)(N + Y);\
+}
+#endif /* USE_BUILTIN_FFS */
+#endif /* GNUC */
+
+/* isolate the least set bit of a bitmap */
+#define least_bit(x) ((x) & -(x))
+
+/* mask with all bits to left of least bit of x on */
+#define left_bits(x) ((x<<1) | -(x<<1))
+
+/* mask with all bits to left of or equal to least bit of x on */
+#define same_or_left_bits(x) ((x) | -(x))
+
+
+/* ----------------------- Runtime Check Support ------------------------- */
+
+/*
+ For security, the main invariant is that malloc/free/etc never
+ writes to a static address other than malloc_state, unless static
+ malloc_state itself has been corrupted, which cannot occur via
+ malloc (because of these checks). In essence this means that we
+ believe all pointers, sizes, maps etc held in malloc_state, but
+ check all of those linked or offsetted from other embedded data
+ structures. These checks are interspersed with main code in a way
+ that tends to minimize their run-time cost.
+
+ When FOOTERS is defined, in addition to range checking, we also
+ verify footer fields of inuse chunks, which can be used guarantee
+ that the mstate controlling malloc/free is intact. This is a
+ streamlined version of the approach described by William Robertson
+ et al in "Run-time Detection of Heap-based Overflows" LISA'03
+ http://www.usenix.org/events/lisa03/tech/robertson.html The footer
+ of an inuse chunk holds the xor of its mstate and a random seed,
+ that is checked upon calls to free() and realloc(). This is
+ (probablistically) unguessable from outside the program, but can be
+ computed by any code successfully malloc'ing any chunk, so does not
+ itself provide protection against code that has already broken
+ security through some other means. Unlike Robertson et al, we
+ always dynamically check addresses of all offset chunks (previous,
+ next, etc). This turns out to be cheaper than relying on hashes.
+*/
+
+#if !INSECURE
+/* Check if address a is at least as high as any from MORECORE or MMAP */
+#define ok_address(M, a) ((char*)(a) >= (M)->least_addr)
+/* Check if address of next chunk n is higher than base chunk p */
+#define ok_next(p, n) ((char*)(p) < (char*)(n))
+/* Check if p has its cinuse bit on */
+#define ok_cinuse(p) cinuse(p)
+/* Check if p has its pinuse bit on */
+#define ok_pinuse(p) pinuse(p)
+
+#else /* !INSECURE */
+#define ok_address(M, a) (1)
+#define ok_next(b, n) (1)
+#define ok_cinuse(p) (1)
+#define ok_pinuse(p) (1)
+#endif /* !INSECURE */
+
+#if (FOOTERS && !INSECURE)
+/* Check if (alleged) mstate m has expected magic field */
+#define ok_magic(M) ((M)->magic == mparams.magic)
+#else /* (FOOTERS && !INSECURE) */
+#define ok_magic(M) (1)
+#endif /* (FOOTERS && !INSECURE) */
+
+
+/* In gcc, use __builtin_expect to minimize impact of checks */
+#if !INSECURE
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define RTCHECK(e) __builtin_expect(e, 1)
+#else /* GNUC */
+#define RTCHECK(e) (e)
+#endif /* GNUC */
+#else /* !INSECURE */
+#define RTCHECK(e) (1)
+#endif /* !INSECURE */
+
+/* macros to set up inuse chunks with or without footers */
+
+#if !FOOTERS
+
+#define mark_inuse_foot(M,p,s)
+
+/* Set cinuse bit and pinuse bit of next chunk */
+#define set_inuse(M,p,s)\
+ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
+ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
+
+/* Set cinuse and pinuse of this chunk and pinuse of next chunk */
+#define set_inuse_and_pinuse(M,p,s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
+
+/* Set size, cinuse and pinuse bit of this chunk */
+#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
+
+#else /* FOOTERS */
+
+/* Set foot of inuse chunk to be xor of mstate and seed */
+#define mark_inuse_foot(M,p,s)\
+ (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
+
+#define get_mstate_for(p)\
+ ((mstate)(((mchunkptr)((char*)(p) +\
+ (chunksize(p))))->prev_foot ^ mparams.magic))
+
+#define set_inuse(M,p,s)\
+ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
+ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \
+ mark_inuse_foot(M,p,s))
+
+#define set_inuse_and_pinuse(M,p,s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\
+ mark_inuse_foot(M,p,s))
+
+#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
+ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+ mark_inuse_foot(M, p, s))
+
+#endif /* !FOOTERS */
+
+/* ---------------------------- setting mparams -------------------------- */
+
+/* Initialize mparams */
+static int
+init_mparams(void)
+{
+ if (mparams.page_size == 0) {
+ size_t s;
+
+ mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
+ mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD;
+#if MORECORE_CONTIGUOUS
+ mparams.default_mflags = USE_LOCK_BIT | USE_MMAP_BIT;
+#else /* MORECORE_CONTIGUOUS */
+ mparams.default_mflags =
+ USE_LOCK_BIT | USE_MMAP_BIT | USE_NONCONTIGUOUS_BIT;
+#endif /* MORECORE_CONTIGUOUS */
+
+#if (FOOTERS && !INSECURE)
+ {
+#if USE_DEV_RANDOM
+ int fd;
+ unsigned char buf[sizeof(size_t)];
+ /* Try to use /dev/urandom, else fall back on using time */
+ if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 &&
+ read(fd, buf, sizeof(buf)) == sizeof(buf)) {
+ s = *((size_t *) buf);
+ close(fd);
+ } else
+#endif /* USE_DEV_RANDOM */
+ s = (size_t) (time(0) ^ (size_t) 0x55555555U);
+
+ s |= (size_t) 8U; /* ensure nonzero */
+ s &= ~(size_t) 7U; /* improve chances of fault for bad values */
+
+ }
+#else /* (FOOTERS && !INSECURE) */
+ s = (size_t) 0x58585858U;
+#endif /* (FOOTERS && !INSECURE) */
+ ACQUIRE_MAGIC_INIT_LOCK();
+ if (mparams.magic == 0) {
+ mparams.magic = s;
+ /* Set up lock for main malloc area */
+ INITIAL_LOCK(&gm->mutex);
+ gm->mflags = mparams.default_mflags;
+ }
+ RELEASE_MAGIC_INIT_LOCK();
+
+#ifndef WIN32
+ mparams.page_size = malloc_getpagesize;
+ mparams.granularity = ((DEFAULT_GRANULARITY != 0) ?
+ DEFAULT_GRANULARITY : mparams.page_size);
+#else /* WIN32 */
+ {
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ mparams.page_size = system_info.dwPageSize;
+ mparams.granularity = system_info.dwAllocationGranularity;
+ }
+#endif /* WIN32 */
+
+ /* Sanity-check configuration:
+ size_t must be unsigned and as wide as pointer type.
+ ints must be at least 4 bytes.
+ alignment must be at least 8.
+ Alignment, min chunk size, and page size must all be powers of 2.
+ */
+ if ((sizeof(size_t) != sizeof(char *)) ||
+ (MAX_SIZE_T < MIN_CHUNK_SIZE) ||
+ (sizeof(int) < 4) ||
+ (MALLOC_ALIGNMENT < (size_t) 8U) ||
+ ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT - SIZE_T_ONE)) != 0) ||
+ ((MCHUNK_SIZE & (MCHUNK_SIZE - SIZE_T_ONE)) != 0) ||
+ ((mparams.granularity & (mparams.granularity - SIZE_T_ONE)) != 0)
+ || ((mparams.page_size & (mparams.page_size - SIZE_T_ONE)) != 0))
+ ABORT;
+ }
+ return 0;
+}
+
+/* support for mallopt */
+static int
+change_mparam(int param_number, int value)
+{
+ size_t val = (size_t) value;
+ init_mparams();
+ switch (param_number) {
+ case M_TRIM_THRESHOLD:
+ mparams.trim_threshold = val;
+ return 1;
+ case M_GRANULARITY:
+ if (val >= mparams.page_size && ((val & (val - 1)) == 0)) {
+ mparams.granularity = val;
+ return 1;
+ } else
+ return 0;
+ case M_MMAP_THRESHOLD:
+ mparams.mmap_threshold = val;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+#if DEBUG
+/* ------------------------- Debugging Support --------------------------- */
+
+/* Check properties of any chunk, whether free, inuse, mmapped etc */
+static void
+do_check_any_chunk(mstate m, mchunkptr p)
+{
+ assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
+ assert(ok_address(m, p));
+}
+
+/* Check properties of top chunk */
+static void
+do_check_top_chunk(mstate m, mchunkptr p)
+{
+ msegmentptr sp = segment_holding(m, (char *) p);
+ size_t sz = chunksize(p);
+ assert(sp != 0);
+ assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
+ assert(ok_address(m, p));
+ assert(sz == m->topsize);
+ assert(sz > 0);
+ assert(sz == ((sp->base + sp->size) - (char *) p) - TOP_FOOT_SIZE);
+ assert(pinuse(p));
+ assert(!next_pinuse(p));
+}
+
+/* Check properties of (inuse) mmapped chunks */
+static void
+do_check_mmapped_chunk(mstate m, mchunkptr p)
+{
+ size_t sz = chunksize(p);
+ size_t len = (sz + (p->prev_foot & ~IS_MMAPPED_BIT) + MMAP_FOOT_PAD);
+ assert(is_mmapped(p));
+ assert(use_mmap(m));
+ assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
+ assert(ok_address(m, p));
+ assert(!is_small(sz));
+ assert((len & (mparams.page_size - SIZE_T_ONE)) == 0);
+ assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD);
+ assert(chunk_plus_offset(p, sz + SIZE_T_SIZE)->head == 0);
+}
+
+/* Check properties of inuse chunks */
+static void
+do_check_inuse_chunk(mstate m, mchunkptr p)
+{
+ do_check_any_chunk(m, p);
+ assert(cinuse(p));
+ assert(next_pinuse(p));
+ /* If not pinuse and not mmapped, previous chunk has OK offset */
+ assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p);
+ if (is_mmapped(p))
+ do_check_mmapped_chunk(m, p);
+}
+
+/* Check properties of free chunks */
+static void
+do_check_free_chunk(mstate m, mchunkptr p)
+{
+ size_t sz = p->head & ~(PINUSE_BIT | CINUSE_BIT);
+ mchunkptr next = chunk_plus_offset(p, sz);
+ do_check_any_chunk(m, p);
+ assert(!cinuse(p));
+ assert(!next_pinuse(p));
+ assert(!is_mmapped(p));
+ if (p != m->dv && p != m->top) {
+ if (sz >= MIN_CHUNK_SIZE) {
+ assert((sz & CHUNK_ALIGN_MASK) == 0);
+ assert(is_aligned(chunk2mem(p)));
+ assert(next->prev_foot == sz);
+ assert(pinuse(p));
+ assert(next == m->top || cinuse(next));
+ assert(p->fd->bk == p);
+ assert(p->bk->fd == p);
+ } else /* markers are always of size SIZE_T_SIZE */
+ assert(sz == SIZE_T_SIZE);
+ }
+}
+
+/* Check properties of malloced chunks at the point they are malloced */
+static void
+do_check_malloced_chunk(mstate m, void *mem, size_t s)
+{
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+ size_t sz = p->head & ~(PINUSE_BIT | CINUSE_BIT);
+ do_check_inuse_chunk(m, p);
+ assert((sz & CHUNK_ALIGN_MASK) == 0);
+ assert(sz >= MIN_CHUNK_SIZE);
+ assert(sz >= s);
+ /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */
+ assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE));
+ }
+}
+
+/* Check a tree and its subtrees. */
+static void
+do_check_tree(mstate m, tchunkptr t)
+{
+ tchunkptr head = 0;
+ tchunkptr u = t;
+ bindex_t tindex = t->index;
+ size_t tsize = chunksize(t);
+ bindex_t idx;
+ compute_tree_index(tsize, idx);
+ assert(tindex == idx);
+ assert(tsize >= MIN_LARGE_SIZE);
+ assert(tsize >= minsize_for_tree_index(idx));
+ assert((idx == NTREEBINS - 1)
+ || (tsize < minsize_for_tree_index((idx + 1))));
+
+ do { /* traverse through chain of same-sized nodes */
+ do_check_any_chunk(m, ((mchunkptr) u));
+ assert(u->index == tindex);
+ assert(chunksize(u) == tsize);
+ assert(!cinuse(u));
+ assert(!next_pinuse(u));
+ assert(u->fd->bk == u);
+ assert(u->bk->fd == u);
+ if (u->parent == 0) {
+ assert(u->child[0] == 0);
+ assert(u->child[1] == 0);
+ } else {
+ assert(head == 0); /* only one node on chain has parent */
+ head = u;
+ assert(u->parent != u);
+ assert(u->parent->child[0] == u ||
+ u->parent->child[1] == u ||
+ *((tbinptr *) (u->parent)) == u);
+ if (u->child[0] != 0) {
+ assert(u->child[0]->parent == u);
+ assert(u->child[0] != u);
+ do_check_tree(m, u->child[0]);
+ }
+ if (u->child[1] != 0) {
+ assert(u->child[1]->parent == u);
+ assert(u->child[1] != u);
+ do_check_tree(m, u->child[1]);
+ }
+ if (u->child[0] != 0 && u->child[1] != 0) {
+ assert(chunksize(u->child[0]) < chunksize(u->child[1]));
+ }
+ }
+ u = u->fd;
+ } while (u != t);
+ assert(head != 0);
+}
+
+/* Check all the chunks in a treebin. */
+static void
+do_check_treebin(mstate m, bindex_t i)
+{
+ tbinptr *tb = treebin_at(m, i);
+ tchunkptr t = *tb;
+ int empty = (m->treemap & (1U << i)) == 0;
+ if (t == 0)
+ assert(empty);
+ if (!empty)
+ do_check_tree(m, t);
+}
+
+/* Check all the chunks in a smallbin. */
+static void
+do_check_smallbin(mstate m, bindex_t i)
+{
+ sbinptr b = smallbin_at(m, i);
+ mchunkptr p = b->bk;
+ unsigned int empty = (m->smallmap & (1U << i)) == 0;
+ if (p == b)
+ assert(empty);
+ if (!empty) {
+ for (; p != b; p = p->bk) {
+ size_t size = chunksize(p);
+ mchunkptr q;
+ /* each chunk claims to be free */
+ do_check_free_chunk(m, p);
+ /* chunk belongs in bin */
+ assert(small_index(size) == i);
+ assert(p->bk == b || chunksize(p->bk) == chunksize(p));
+ /* chunk is followed by an inuse chunk */
+ q = next_chunk(p);
+ if (q->head != FENCEPOST_HEAD)
+ do_check_inuse_chunk(m, q);
+ }
+ }
+}
+
+/* Find x in a bin. Used in other check functions. */
+static int
+bin_find(mstate m, mchunkptr x)
+{
+ size_t size = chunksize(x);
+ if (is_small(size)) {
+ bindex_t sidx = small_index(size);
+ sbinptr b = smallbin_at(m, sidx);
+ if (smallmap_is_marked(m, sidx)) {
+ mchunkptr p = b;
+ do {
+ if (p == x)
+ return 1;
+ } while ((p = p->fd) != b);
+ }
+ } else {
+ bindex_t tidx;
+ compute_tree_index(size, tidx);
+ if (treemap_is_marked(m, tidx)) {
+ tchunkptr t = *treebin_at(m, tidx);
+ size_t sizebits = size << leftshift_for_tree_index(tidx);
+ while (t != 0 && chunksize(t) != size) {
+ t = t->child[(sizebits >> (SIZE_T_BITSIZE - SIZE_T_ONE)) & 1];
+ sizebits <<= 1;
+ }
+ if (t != 0) {
+ tchunkptr u = t;
+ do {
+ if (u == (tchunkptr) x)
+ return 1;
+ } while ((u = u->fd) != t);
+ }
+ }
+ }
+ return 0;
+}
+
+/* Traverse each chunk and check it; return total */
+static size_t
+traverse_and_check(mstate m)
+{
+ size_t sum = 0;
+ if (is_initialized(m)) {
+ msegmentptr s = &m->seg;
+ sum += m->topsize + TOP_FOOT_SIZE;
+ while (s != 0) {
+ mchunkptr q = align_as_chunk(s->base);
+ mchunkptr lastq = 0;
+ assert(pinuse(q));
+ while (segment_holds(s, q) &&
+ q != m->top && q->head != FENCEPOST_HEAD) {
+ sum += chunksize(q);
+ if (cinuse(q)) {
+ assert(!bin_find(m, q));
+ do_check_inuse_chunk(m, q);
+ } else {
+ assert(q == m->dv || bin_find(m, q));
+ assert(lastq == 0 || cinuse(lastq)); /* Not 2 consecutive free */
+ do_check_free_chunk(m, q);
+ }
+ lastq = q;
+ q = next_chunk(q);
+ }
+ s = s->next;
+ }
+ }
+ return sum;
+}
+
+/* Check all properties of malloc_state. */
+static void
+do_check_malloc_state(mstate m)
+{
+ bindex_t i;
+ size_t total;
+ /* check bins */
+ for (i = 0; i < NSMALLBINS; ++i)
+ do_check_smallbin(m, i);
+ for (i = 0; i < NTREEBINS; ++i)
+ do_check_treebin(m, i);
+
+ if (m->dvsize != 0) { /* check dv chunk */
+ do_check_any_chunk(m, m->dv);
+ assert(m->dvsize == chunksize(m->dv));
+ assert(m->dvsize >= MIN_CHUNK_SIZE);
+ assert(bin_find(m, m->dv) == 0);
+ }
+
+ if (m->top != 0) { /* check top chunk */
+ do_check_top_chunk(m, m->top);
+ assert(m->topsize == chunksize(m->top));
+ assert(m->topsize > 0);
+ assert(bin_find(m, m->top) == 0);
+ }
+
+ total = traverse_and_check(m);
+ assert(total <= m->footprint);
+ assert(m->footprint <= m->max_footprint);
+}
+#endif /* DEBUG */
+
+/* ----------------------------- statistics ------------------------------ */
+
+#if !NO_MALLINFO
+static struct mallinfo
+internal_mallinfo(mstate m)
+{
+ struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ if (!PREACTION(m)) {
+ check_malloc_state(m);
+ if (is_initialized(m)) {
+ size_t nfree = SIZE_T_ONE; /* top always free */
+ size_t mfree = m->topsize + TOP_FOOT_SIZE;
+ size_t sum = mfree;
+ msegmentptr s = &m->seg;
+ while (s != 0) {
+ mchunkptr q = align_as_chunk(s->base);
+ while (segment_holds(s, q) &&
+ q != m->top && q->head != FENCEPOST_HEAD) {
+ size_t sz = chunksize(q);
+ sum += sz;
+ if (!cinuse(q)) {
+ mfree += sz;
+ ++nfree;
+ }
+ q = next_chunk(q);
+ }
+ s = s->next;
+ }
+
+ nm.arena = sum;
+ nm.ordblks = nfree;
+ nm.hblkhd = m->footprint - sum;
+ nm.usmblks = m->max_footprint;
+ nm.uordblks = m->footprint - mfree;
+ nm.fordblks = mfree;
+ nm.keepcost = m->topsize;
+ }
+
+ POSTACTION(m);
+ }
+ return nm;
+}
+#endif /* !NO_MALLINFO */
+
+static void
+internal_malloc_stats(mstate m)
+{
+ if (!PREACTION(m)) {
+#ifndef LACKS_STDIO_H
+ size_t maxfp = 0;
+#endif
+ size_t fp = 0;
+ size_t used = 0;
+ check_malloc_state(m);
+ if (is_initialized(m)) {
+ msegmentptr s = &m->seg;
+#ifndef LACKS_STDIO_H
+ maxfp = m->max_footprint;
+#endif
+ fp = m->footprint;
+ used = fp - (m->topsize + TOP_FOOT_SIZE);
+
+ while (s != 0) {
+ mchunkptr q = align_as_chunk(s->base);
+ while (segment_holds(s, q) &&
+ q != m->top && q->head != FENCEPOST_HEAD) {
+ if (!cinuse(q))
+ used -= chunksize(q);
+ q = next_chunk(q);
+ }
+ s = s->next;
+ }
+ }
+#ifndef LACKS_STDIO_H
+ fprintf(stderr, "max system bytes = %10lu\n",
+ (unsigned long) (maxfp));
+ fprintf(stderr, "system bytes = %10lu\n", (unsigned long) (fp));
+ fprintf(stderr, "in use bytes = %10lu\n", (unsigned long) (used));
+#endif
+
+ POSTACTION(m);
+ }
+}
+
+/* ----------------------- Operations on smallbins ----------------------- */
+
+/*
+ Various forms of linking and unlinking are defined as macros. Even
+ the ones for trees, which are very long but have very short typical
+ paths. This is ugly but reduces reliance on inlining support of
+ compilers.
+*/
+
+/* Link a free chunk into a smallbin */
+#define insert_small_chunk(M, P, S) {\
+ bindex_t I = small_index(S);\
+ mchunkptr B = smallbin_at(M, I);\
+ mchunkptr F = B;\
+ assert(S >= MIN_CHUNK_SIZE);\
+ if (!smallmap_is_marked(M, I))\
+ mark_smallmap(M, I);\
+ else if (RTCHECK(ok_address(M, B->fd)))\
+ F = B->fd;\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ B->fd = P;\
+ F->bk = P;\
+ P->fd = F;\
+ P->bk = B;\
+}
+
+/* Unlink a chunk from a smallbin */
+#define unlink_small_chunk(M, P, S) {\
+ mchunkptr F = P->fd;\
+ mchunkptr B = P->bk;\
+ bindex_t I = small_index(S);\
+ assert(P != B);\
+ assert(P != F);\
+ assert(chunksize(P) == small_index2size(I));\
+ if (F == B)\
+ clear_smallmap(M, I);\
+ else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\
+ (B == smallbin_at(M,I) || ok_address(M, B)))) {\
+ F->bk = B;\
+ B->fd = F;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+}
+
+/* Unlink the first chunk from a smallbin */
+#define unlink_first_small_chunk(M, B, P, I) {\
+ mchunkptr F = P->fd;\
+ assert(P != B);\
+ assert(P != F);\
+ assert(chunksize(P) == small_index2size(I));\
+ if (B == F)\
+ clear_smallmap(M, I);\
+ else if (RTCHECK(ok_address(M, F))) {\
+ B->fd = F;\
+ F->bk = B;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+}
+
+/* Replace dv node, binning the old one */
+/* Used only when dvsize known to be small */
+#define replace_dv(M, P, S) {\
+ size_t DVS = M->dvsize;\
+ if (DVS != 0) {\
+ mchunkptr DV = M->dv;\
+ assert(is_small(DVS));\
+ insert_small_chunk(M, DV, DVS);\
+ }\
+ M->dvsize = S;\
+ M->dv = P;\
+}
+
+/* ------------------------- Operations on trees ------------------------- */
+
+/* Insert chunk into tree */
+#define insert_large_chunk(M, X, S) {\
+ tbinptr* H;\
+ bindex_t I;\
+ compute_tree_index(S, I);\
+ H = treebin_at(M, I);\
+ X->index = I;\
+ X->child[0] = X->child[1] = 0;\
+ if (!treemap_is_marked(M, I)) {\
+ mark_treemap(M, I);\
+ *H = X;\
+ X->parent = (tchunkptr)H;\
+ X->fd = X->bk = X;\
+ }\
+ else {\
+ tchunkptr T = *H;\
+ size_t K = S << leftshift_for_tree_index(I);\
+ for (;;) {\
+ if (chunksize(T) != S) {\
+ tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\
+ K <<= 1;\
+ if (*C != 0)\
+ T = *C;\
+ else if (RTCHECK(ok_address(M, C))) {\
+ *C = X;\
+ X->parent = T;\
+ X->fd = X->bk = X;\
+ break;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ break;\
+ }\
+ }\
+ else {\
+ tchunkptr F = T->fd;\
+ if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\
+ T->fd = F->bk = X;\
+ X->fd = F;\
+ X->bk = T;\
+ X->parent = 0;\
+ break;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ break;\
+ }\
+ }\
+ }\
+ }\
+}
+
+/*
+ Unlink steps:
+
+ 1. If x is a chained node, unlink it from its same-sized fd/bk links
+ and choose its bk node as its replacement.
+ 2. If x was the last node of its size, but not a leaf node, it must
+ be replaced with a leaf node (not merely one with an open left or
+ right), to make sure that lefts and rights of descendents
+ correspond properly to bit masks. We use the rightmost descendent
+ of x. We could use any other leaf, but this is easy to locate and
+ tends to counteract removal of leftmosts elsewhere, and so keeps
+ paths shorter than minimally guaranteed. This doesn't loop much
+ because on average a node in a tree is near the bottom.
+ 3. If x is the base of a chain (i.e., has parent links) relink
+ x's parent and children to x's replacement (or null if none).
+*/
+
+#define unlink_large_chunk(M, X) {\
+ tchunkptr XP = X->parent;\
+ tchunkptr R;\
+ if (X->bk != X) {\
+ tchunkptr F = X->fd;\
+ R = X->bk;\
+ if (RTCHECK(ok_address(M, F))) {\
+ F->bk = R;\
+ R->fd = F;\
+ }\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+ else {\
+ tchunkptr* RP;\
+ if (((R = *(RP = &(X->child[1]))) != 0) ||\
+ ((R = *(RP = &(X->child[0]))) != 0)) {\
+ tchunkptr* CP;\
+ while ((*(CP = &(R->child[1])) != 0) ||\
+ (*(CP = &(R->child[0])) != 0)) {\
+ R = *(RP = CP);\
+ }\
+ if (RTCHECK(ok_address(M, RP)))\
+ *RP = 0;\
+ else {\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+ }\
+ if (XP != 0) {\
+ tbinptr* H = treebin_at(M, X->index);\
+ if (X == *H) {\
+ if ((*H = R) == 0) \
+ clear_treemap(M, X->index);\
+ }\
+ else if (RTCHECK(ok_address(M, XP))) {\
+ if (XP->child[0] == X) \
+ XP->child[0] = R;\
+ else \
+ XP->child[1] = R;\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ if (R != 0) {\
+ if (RTCHECK(ok_address(M, R))) {\
+ tchunkptr C0, C1;\
+ R->parent = XP;\
+ if ((C0 = X->child[0]) != 0) {\
+ if (RTCHECK(ok_address(M, C0))) {\
+ R->child[0] = C0;\
+ C0->parent = R;\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ if ((C1 = X->child[1]) != 0) {\
+ if (RTCHECK(ok_address(M, C1))) {\
+ R->child[1] = C1;\
+ C1->parent = R;\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+ else\
+ CORRUPTION_ERROR_ACTION(M);\
+ }\
+ }\
+}
+
+/* Relays to large vs small bin operations */
+
+#define insert_chunk(M, P, S)\
+ if (is_small(S)) insert_small_chunk(M, P, S)\
+ else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }
+
+#define unlink_chunk(M, P, S)\
+ if (is_small(S)) unlink_small_chunk(M, P, S)\
+ else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }
+
+
+/* Relays to internal calls to malloc/free from realloc, memalign etc */
+
+#if ONLY_MSPACES
+#define internal_malloc(m, b) mspace_malloc(m, b)
+#define internal_free(m, mem) mspace_free(m,mem);
+#else /* ONLY_MSPACES */
+#if MSPACES
+#define internal_malloc(m, b)\
+ (m == gm)? dlmalloc(b) : mspace_malloc(m, b)
+#define internal_free(m, mem)\
+ if (m == gm) dlfree(mem); else mspace_free(m,mem);
+#else /* MSPACES */
+#define internal_malloc(m, b) dlmalloc(b)
+#define internal_free(m, mem) dlfree(mem)
+#endif /* MSPACES */
+#endif /* ONLY_MSPACES */
+
+/* ----------------------- Direct-mmapping chunks ----------------------- */
+
+/*
+ Directly mmapped chunks are set up with an offset to the start of
+ the mmapped region stored in the prev_foot field of the chunk. This
+ allows reconstruction of the required argument to MUNMAP when freed,
+ and also allows adjustment of the returned chunk to meet alignment
+ requirements (especially in memalign). There is also enough space
+ allocated to hold a fake next chunk of size SIZE_T_SIZE to maintain
+ the PINUSE bit so frees can be checked.
+*/
+
+/* Malloc using mmap */
+static void *
+mmap_alloc(mstate m, size_t nb)
+{
+ size_t mmsize =
+ granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+ if (mmsize > nb) { /* Check for wrap around 0 */
+ char *mm = (char *) (DIRECT_MMAP(mmsize));
+ if (mm != CMFAIL) {
+ size_t offset = align_offset(chunk2mem(mm));
+ size_t psize = mmsize - offset - MMAP_FOOT_PAD;
+ mchunkptr p = (mchunkptr) (mm + offset);
+ p->prev_foot = offset | IS_MMAPPED_BIT;
+ (p)->head = (psize | CINUSE_BIT);
+ mark_inuse_foot(m, p, psize);
+ chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
+ chunk_plus_offset(p, psize + SIZE_T_SIZE)->head = 0;
+
+ if (mm < m->least_addr)
+ m->least_addr = mm;
+ if ((m->footprint += mmsize) > m->max_footprint)
+ m->max_footprint = m->footprint;
+ assert(is_aligned(chunk2mem(p)));
+ check_mmapped_chunk(m, p);
+ return chunk2mem(p);
+ }
+ }
+ return 0;
+}
+
+/* Realloc using mmap */
+static mchunkptr
+mmap_resize(mstate m, mchunkptr oldp, size_t nb)
+{
+ size_t oldsize = chunksize(oldp);
+ if (is_small(nb)) /* Can't shrink mmap regions below small size */
+ return 0;
+ /* Keep old chunk if big enough but not too big */
+ if (oldsize >= nb + SIZE_T_SIZE &&
+ (oldsize - nb) <= (mparams.granularity << 1))
+ return oldp;
+ else {
+ size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT;
+ size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
+ size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES +
+ CHUNK_ALIGN_MASK);
+ char *cp = (char *) CALL_MREMAP((char *) oldp - offset,
+ oldmmsize, newmmsize, 1);
+ if (cp != CMFAIL) {
+ mchunkptr newp = (mchunkptr) (cp + offset);
+ size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
+ newp->head = (psize | CINUSE_BIT);
+ mark_inuse_foot(m, newp, psize);
+ chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
+ chunk_plus_offset(newp, psize + SIZE_T_SIZE)->head = 0;
+
+ if (cp < m->least_addr)
+ m->least_addr = cp;
+ if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
+ m->max_footprint = m->footprint;
+ check_mmapped_chunk(m, newp);
+ return newp;
+ }
+ }
+ return 0;
+}
+
+/* -------------------------- mspace management -------------------------- */
+
+/* Initialize top chunk and its size */
+static void
+init_top(mstate m, mchunkptr p, size_t psize)
+{
+ /* Ensure alignment */
+ size_t offset = align_offset(chunk2mem(p));
+ p = (mchunkptr) ((char *) p + offset);
+ psize -= offset;
+
+ m->top = p;
+ m->topsize = psize;
+ p->head = psize | PINUSE_BIT;
+ /* set size of fake trailing chunk holding overhead space only once */
+ chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
+ m->trim_check = mparams.trim_threshold; /* reset on each update */
+}
+
+/* Initialize bins for a new mstate that is otherwise zeroed out */
+static void
+init_bins(mstate m)
+{
+ /* Establish circular links for smallbins */
+ bindex_t i;
+ for (i = 0; i < NSMALLBINS; ++i) {
+ sbinptr bin = smallbin_at(m, i);
+ bin->fd = bin->bk = bin;
+ }
+}
+
+#if PROCEED_ON_ERROR
+
+/* default corruption action */
+static void
+reset_on_error(mstate m)
+{
+ int i;
+ ++malloc_corruption_error_count;
+ /* Reinitialize fields to forget about all memory */
+ m->smallbins = m->treebins = 0;
+ m->dvsize = m->topsize = 0;
+ m->seg.base = 0;
+ m->seg.size = 0;
+ m->seg.next = 0;
+ m->top = m->dv = 0;
+ for (i = 0; i < NTREEBINS; ++i)
+ *treebin_at(m, i) = 0;
+ init_bins(m);
+}
+#endif /* PROCEED_ON_ERROR */
+
+/* Allocate chunk and prepend remainder with chunk in successor base. */
+static void *
+prepend_alloc(mstate m, char *newbase, char *oldbase, size_t nb)
+{
+ mchunkptr p = align_as_chunk(newbase);
+ mchunkptr oldfirst = align_as_chunk(oldbase);
+ size_t psize = (char *) oldfirst - (char *) p;
+ mchunkptr q = chunk_plus_offset(p, nb);
+ size_t qsize = psize - nb;
+ set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+
+ assert((char *) oldfirst > (char *) q);
+ assert(pinuse(oldfirst));
+ assert(qsize >= MIN_CHUNK_SIZE);
+
+ /* consolidate remainder with first chunk of old base */
+ if (oldfirst == m->top) {
+ size_t tsize = m->topsize += qsize;
+ m->top = q;
+ q->head = tsize | PINUSE_BIT;
+ check_top_chunk(m, q);
+ } else if (oldfirst == m->dv) {
+ size_t dsize = m->dvsize += qsize;
+ m->dv = q;
+ set_size_and_pinuse_of_free_chunk(q, dsize);
+ } else {
+ if (!cinuse(oldfirst)) {
+ size_t nsize = chunksize(oldfirst);
+ unlink_chunk(m, oldfirst, nsize);
+ oldfirst = chunk_plus_offset(oldfirst, nsize);
+ qsize += nsize;
+ }
+ set_free_with_pinuse(q, qsize, oldfirst);
+ insert_chunk(m, q, qsize);
+ check_free_chunk(m, q);
+ }
+
+ check_malloced_chunk(m, chunk2mem(p), nb);
+ return chunk2mem(p);
+}
+
+
+/* Add a segment to hold a new noncontiguous region */
+static void
+add_segment(mstate m, char *tbase, size_t tsize, flag_t mmapped)
+{
+ /* Determine locations and sizes of segment, fenceposts, old top */
+ char *old_top = (char *) m->top;
+ msegmentptr oldsp = segment_holding(m, old_top);
+ char *old_end = oldsp->base + oldsp->size;
+ size_t ssize = pad_request(sizeof(struct malloc_segment));
+ char *rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+ size_t offset = align_offset(chunk2mem(rawsp));
+ char *asp = rawsp + offset;
+ char *csp = (asp < (old_top + MIN_CHUNK_SIZE)) ? old_top : asp;
+ mchunkptr sp = (mchunkptr) csp;
+ msegmentptr ss = (msegmentptr) (chunk2mem(sp));
+ mchunkptr tnext = chunk_plus_offset(sp, ssize);
+ mchunkptr p = tnext;
+ int nfences = 0;
+
+ /* reset top to new space */
+ init_top(m, (mchunkptr) tbase, tsize - TOP_FOOT_SIZE);
+
+ /* Set up segment record */
+ assert(is_aligned(ss));
+ set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
+ *ss = m->seg; /* Push current record */
+ m->seg.base = tbase;
+ m->seg.size = tsize;
+ m->seg.sflags = mmapped;
+ m->seg.next = ss;
+
+ /* Insert trailing fenceposts */
+ for (;;) {
+ mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
+ p->head = FENCEPOST_HEAD;
+ ++nfences;
+ if ((char *) (&(nextp->head)) < old_end)
+ p = nextp;
+ else
+ break;
+ }
+ assert(nfences >= 2);
+
+ /* Insert the rest of old top into a bin as an ordinary free chunk */
+ if (csp != old_top) {
+ mchunkptr q = (mchunkptr) old_top;
+ size_t psize = csp - old_top;
+ mchunkptr tn = chunk_plus_offset(q, psize);
+ set_free_with_pinuse(q, psize, tn);
+ insert_chunk(m, q, psize);
+ }
+
+ check_top_chunk(m, m->top);
+}
+
+/* -------------------------- System allocation -------------------------- */
+
+/* Get memory from system using MORECORE or MMAP */
+static void *
+sys_alloc(mstate m, size_t nb)
+{
+ char *tbase = CMFAIL;
+ size_t tsize = 0;
+ flag_t mmap_flag = 0;
+
+ init_mparams();
+
+ /* Directly map large chunks */
+ if (use_mmap(m) && nb >= mparams.mmap_threshold) {
+ void *mem = mmap_alloc(m, nb);
+ if (mem != 0)
+ return mem;
+ }
+
+ /*
+ Try getting memory in any of three ways (in most-preferred to
+ least-preferred order):
+ 1. A call to MORECORE that can normally contiguously extend memory.
+ (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
+ or main space is mmapped or a previous contiguous call failed)
+ 2. A call to MMAP new space (disabled if not HAVE_MMAP).
+ Note that under the default settings, if MORECORE is unable to
+ fulfill a request, and HAVE_MMAP is true, then mmap is
+ used as a noncontiguous system allocator. This is a useful backup
+ strategy for systems with holes in address spaces -- in this case
+ sbrk cannot contiguously expand the heap, but mmap may be able to
+ find space.
+ 3. A call to MORECORE that cannot usually contiguously extend memory.
+ (disabled if not HAVE_MORECORE)
+ */
+
+ if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) {
+ char *br = CMFAIL;
+ msegmentptr ss =
+ (m->top == 0) ? 0 : segment_holding(m, (char *) m->top);
+ size_t asize = 0;
+ ACQUIRE_MORECORE_LOCK();
+
+ if (ss == 0) { /* First time through or recovery */
+ char *base = (char *) CALL_MORECORE(0);
+ if (base != CMFAIL) {
+ asize =
+ granularity_align(nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT +
+ SIZE_T_ONE);
+ /* Adjust to end on a page boundary */
+ if (!is_page_aligned(base))
+ asize += (page_align((size_t) base) - (size_t) base);
+ /* Can't call MORECORE if size is negative when treated as signed */
+ if (asize < HALF_MAX_SIZE_T &&
+ (br = (char *) (CALL_MORECORE(asize))) == base) {
+ tbase = base;
+ tsize = asize;
+ }
+ }
+ } else {
+ /* Subtract out existing available top space from MORECORE request. */
+ asize =
+ granularity_align(nb - m->topsize + TOP_FOOT_SIZE +
+ MALLOC_ALIGNMENT + SIZE_T_ONE);
+ /* Use mem here only if it did continuously extend old space */
+ if (asize < HALF_MAX_SIZE_T &&
+ (br =
+ (char *) (CALL_MORECORE(asize))) == ss->base + ss->size) {
+ tbase = br;
+ tsize = asize;
+ }
+ }
+
+ if (tbase == CMFAIL) { /* Cope with partial failure */
+ if (br != CMFAIL) { /* Try to use/extend the space we did get */
+ if (asize < HALF_MAX_SIZE_T &&
+ asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) {
+ size_t esize =
+ granularity_align(nb + TOP_FOOT_SIZE +
+ MALLOC_ALIGNMENT + SIZE_T_ONE -
+ asize);
+ if (esize < HALF_MAX_SIZE_T) {
+ char *end = (char *) CALL_MORECORE(esize);
+ if (end != CMFAIL)
+ asize += esize;
+ else { /* Can't use; try to release */
+ end = (char *) CALL_MORECORE(-asize);
+ br = CMFAIL;
+ }
+ }
+ }
+ }
+ if (br != CMFAIL) { /* Use the space we did get */
+ tbase = br;
+ tsize = asize;
+ } else
+ disable_contiguous(m); /* Don't try contiguous path in the future */
+ }
+
+ RELEASE_MORECORE_LOCK();
+ }
+
+ if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */
+ size_t req = nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT + SIZE_T_ONE;
+ size_t rsize = granularity_align(req);
+ if (rsize > nb) { /* Fail if wraps around zero */
+ char *mp = (char *) (CALL_MMAP(rsize));
+ if (mp != CMFAIL) {
+ tbase = mp;
+ tsize = rsize;
+ mmap_flag = IS_MMAPPED_BIT;
+ }
+ }
+ }
+
+ if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
+ size_t asize =
+ granularity_align(nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT +
+ SIZE_T_ONE);
+ if (asize < HALF_MAX_SIZE_T) {
+ char *br = CMFAIL;
+ char *end = CMFAIL;
+ ACQUIRE_MORECORE_LOCK();
+ br = (char *) (CALL_MORECORE(asize));
+ end = (char *) (CALL_MORECORE(0));
+ RELEASE_MORECORE_LOCK();
+ if (br != CMFAIL && end != CMFAIL && br < end) {
+ size_t ssize = end - br;
+ if (ssize > nb + TOP_FOOT_SIZE) {
+ tbase = br;
+ tsize = ssize;
+ }
+ }
+ }
+ }
+
+ if (tbase != CMFAIL) {
+
+ if ((m->footprint += tsize) > m->max_footprint)
+ m->max_footprint = m->footprint;
+
+ if (!is_initialized(m)) { /* first-time initialization */
+ m->seg.base = m->least_addr = tbase;
+ m->seg.size = tsize;
+ m->seg.sflags = mmap_flag;
+ m->magic = mparams.magic;
+ init_bins(m);
+ if (is_global(m))
+ init_top(m, (mchunkptr) tbase, tsize - TOP_FOOT_SIZE);
+ else {
+ /* Offset top by embedded malloc_state */
+ mchunkptr mn = next_chunk(mem2chunk(m));
+ init_top(m, mn,
+ (size_t) ((tbase + tsize) - (char *) mn) -
+ TOP_FOOT_SIZE);
+ }
+ }
+
+ else {
+ /* Try to merge with an existing segment */
+ msegmentptr sp = &m->seg;
+ while (sp != 0 && tbase != sp->base + sp->size)
+ sp = sp->next;
+ if (sp != 0 && !is_extern_segment(sp) && (sp->sflags & IS_MMAPPED_BIT) == mmap_flag && segment_holds(sp, m->top)) { /* append */
+ sp->size += tsize;
+ init_top(m, m->top, m->topsize + tsize);
+ } else {
+ if (tbase < m->least_addr)
+ m->least_addr = tbase;
+ sp = &m->seg;
+ while (sp != 0 && sp->base != tbase + tsize)
+ sp = sp->next;
+ if (sp != 0 &&
+ !is_extern_segment(sp) &&
+ (sp->sflags & IS_MMAPPED_BIT) == mmap_flag) {
+ char *oldbase = sp->base;
+ sp->base = tbase;
+ sp->size += tsize;
+ return prepend_alloc(m, tbase, oldbase, nb);
+ } else
+ add_segment(m, tbase, tsize, mmap_flag);
+ }
+ }
+
+ if (nb < m->topsize) { /* Allocate from new or extended top space */
+ size_t rsize = m->topsize -= nb;
+ mchunkptr p = m->top;
+ mchunkptr r = m->top = chunk_plus_offset(p, nb);
+ r->head = rsize | PINUSE_BIT;
+ set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+ check_top_chunk(m, m->top);
+ check_malloced_chunk(m, chunk2mem(p), nb);
+ return chunk2mem(p);
+ }
+ }
+
+ MALLOC_FAILURE_ACTION;
+ return 0;
+}
+
+/* ----------------------- system deallocation -------------------------- */
+
+/* Unmap and unlink any mmapped segments that don't contain used chunks */
+static size_t
+release_unused_segments(mstate m)
+{
+ size_t released = 0;
+ msegmentptr pred = &m->seg;
+ msegmentptr sp = pred->next;
+ while (sp != 0) {
+ char *base = sp->base;
+ size_t size = sp->size;
+ msegmentptr next = sp->next;
+ if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
+ mchunkptr p = align_as_chunk(base);
+ size_t psize = chunksize(p);
+ /* Can unmap if first chunk holds entire segment and not pinned */
+ if (!cinuse(p)
+ && (char *) p + psize >= base + size - TOP_FOOT_SIZE) {
+ tchunkptr tp = (tchunkptr) p;
+ assert(segment_holds(sp, (char *) sp));
+ if (p == m->dv) {
+ m->dv = 0;
+ m->dvsize = 0;
+ } else {
+ unlink_large_chunk(m, tp);
+ }
+ if (CALL_MUNMAP(base, size) == 0) {
+ released += size;
+ m->footprint -= size;
+ /* unlink obsoleted record */
+ sp = pred;
+ sp->next = next;
+ } else { /* back out if cannot unmap */
+ insert_large_chunk(m, tp, psize);
+ }
+ }
+ }
+ pred = sp;
+ sp = next;
+ }
+ return released;
+}
+
+static int
+sys_trim(mstate m, size_t pad)
+{
+ size_t released = 0;
+ if (pad < MAX_REQUEST && is_initialized(m)) {
+ pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
+
+ if (m->topsize > pad) {
+ /* Shrink top space in granularity-size units, keeping at least one */
+ size_t unit = mparams.granularity;
+ size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit -
+ SIZE_T_ONE) * unit;
+ msegmentptr sp = segment_holding(m, (char *) m->top);
+
+ if (!is_extern_segment(sp)) {
+ if (is_mmapped_segment(sp)) {
+ if (HAVE_MMAP && sp->size >= extra && !has_segment_link(m, sp)) { /* can't shrink if pinned */
+ size_t newsize = sp->size - extra;
+ /* Prefer mremap, fall back to munmap */
+ if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) !=
+ MFAIL)
+ || (CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
+ released = extra;
+ }
+ }
+ } else if (HAVE_MORECORE) {
+ if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
+ extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit;
+ ACQUIRE_MORECORE_LOCK();
+ {
+ /* Make sure end of memory is where we last set it. */
+ char *old_br = (char *) (CALL_MORECORE(0));
+ if (old_br == sp->base + sp->size) {
+ char *rel_br = (char *) (CALL_MORECORE(-extra));
+ char *new_br = (char *) (CALL_MORECORE(0));
+ if (rel_br != CMFAIL && new_br < old_br)
+ released = old_br - new_br;
+ }
+ }
+ RELEASE_MORECORE_LOCK();
+ }
+ }
+
+ if (released != 0) {
+ sp->size -= released;
+ m->footprint -= released;
+ init_top(m, m->top, m->topsize - released);
+ check_top_chunk(m, m->top);
+ }
+ }
+
+ /* Unmap any unused mmapped segments */
+ if (HAVE_MMAP)
+ released += release_unused_segments(m);
+
+ /* On failure, disable autotrim to avoid repeated failed future calls */
+ if (released == 0)
+ m->trim_check = MAX_SIZE_T;
+ }
+
+ return (released != 0) ? 1 : 0;
+}
+
+/* ---------------------------- malloc support --------------------------- */
+
+/* allocate a large request from the best fitting chunk in a treebin */
+static void *
+tmalloc_large(mstate m, size_t nb)
+{
+ tchunkptr v = 0;
+ size_t rsize = -nb; /* Unsigned negation */
+ tchunkptr t;
+ bindex_t idx;
+ compute_tree_index(nb, idx);
+
+ if ((t = *treebin_at(m, idx)) != 0) {
+ /* Traverse tree for this bin looking for node with size == nb */
+ size_t sizebits = nb << leftshift_for_tree_index(idx);
+ tchunkptr rst = 0; /* The deepest untaken right subtree */
+ for (;;) {
+ tchunkptr rt;
+ size_t trem = chunksize(t) - nb;
+ if (trem < rsize) {
+ v = t;
+ if ((rsize = trem) == 0)
+ break;
+ }
+ rt = t->child[1];
+ t = t->child[(sizebits >> (SIZE_T_BITSIZE - SIZE_T_ONE)) & 1];
+ if (rt != 0 && rt != t)
+ rst = rt;
+ if (t == 0) {
+ t = rst; /* set t to least subtree holding sizes > nb */
+ break;
+ }
+ sizebits <<= 1;
+ }
+ }
+
+ if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
+ binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
+ if (leftbits != 0) {
+ bindex_t i;
+ binmap_t leastbit = least_bit(leftbits);
+ compute_bit2idx(leastbit, i);
+ t = *treebin_at(m, i);
+ }
+ }
+
+ while (t != 0) { /* find smallest of tree or subtree */
+ size_t trem = chunksize(t) - nb;
+ if (trem < rsize) {
+ rsize = trem;
+ v = t;
+ }
+ t = leftmost_child(t);
+ }
+
+ /* If dv is a better fit, return 0 so malloc will use it */
+ if (v != 0 && rsize < (size_t) (m->dvsize - nb)) {
+ if (RTCHECK(ok_address(m, v))) { /* split */
+ mchunkptr r = chunk_plus_offset(v, nb);
+ assert(chunksize(v) == rsize + nb);
+ if (RTCHECK(ok_next(v, r))) {
+ unlink_large_chunk(m, v);
+ if (rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(m, v, (rsize + nb));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ insert_chunk(m, r, rsize);
+ }
+ return chunk2mem(v);
+ }
+ }
+ CORRUPTION_ERROR_ACTION(m);
+ }
+ return 0;
+}
+
+/* allocate a small request from the best fitting chunk in a treebin */
+static void *
+tmalloc_small(mstate m, size_t nb)
+{
+ tchunkptr t, v;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leastbit = least_bit(m->treemap);
+ compute_bit2idx(leastbit, i);
+
+ v = t = *treebin_at(m, i);
+ rsize = chunksize(t) - nb;
+
+ while ((t = leftmost_child(t)) != 0) {
+ size_t trem = chunksize(t) - nb;
+ if (trem < rsize) {
+ rsize = trem;
+ v = t;
+ }
+ }
+
+ if (RTCHECK(ok_address(m, v))) {
+ mchunkptr r = chunk_plus_offset(v, nb);
+ assert(chunksize(v) == rsize + nb);
+ if (RTCHECK(ok_next(v, r))) {
+ unlink_large_chunk(m, v);
+ if (rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(m, v, (rsize + nb));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ replace_dv(m, r, rsize);
+ }
+ return chunk2mem(v);
+ }
+ }
+
+ CORRUPTION_ERROR_ACTION(m);
+ return 0;
+}
+
+/* --------------------------- realloc support --------------------------- */
+
+static void *
+internal_realloc(mstate m, void *oldmem, size_t bytes)
+{
+ if (bytes >= MAX_REQUEST) {
+ MALLOC_FAILURE_ACTION;
+ return 0;
+ }
+ if (!PREACTION(m)) {
+ mchunkptr oldp = mem2chunk(oldmem);
+ size_t oldsize = chunksize(oldp);
+ mchunkptr next = chunk_plus_offset(oldp, oldsize);
+ mchunkptr newp = 0;
+ void *extra = 0;
+
+ /* Try to either shrink or extend into top. Else malloc-copy-free */
+
+ if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) &&
+ ok_next(oldp, next) && ok_pinuse(next))) {
+ size_t nb = request2size(bytes);
+ if (is_mmapped(oldp))
+ newp = mmap_resize(m, oldp, nb);
+ else if (oldsize >= nb) { /* already big enough */
+ size_t rsize = oldsize - nb;
+ newp = oldp;
+ if (rsize >= MIN_CHUNK_SIZE) {
+ mchunkptr remainder = chunk_plus_offset(newp, nb);
+ set_inuse(m, newp, nb);
+ set_inuse(m, remainder, rsize);
+ extra = chunk2mem(remainder);
+ }
+ } else if (next == m->top && oldsize + m->topsize > nb) {
+ /* Expand into top */
+ size_t newsize = oldsize + m->topsize;
+ size_t newtopsize = newsize - nb;
+ mchunkptr newtop = chunk_plus_offset(oldp, nb);
+ set_inuse(m, oldp, nb);
+ newtop->head = newtopsize | PINUSE_BIT;
+ m->top = newtop;
+ m->topsize = newtopsize;
+ newp = oldp;
+ }
+ } else {
+ USAGE_ERROR_ACTION(m, oldmem);
+ POSTACTION(m);
+ return 0;
+ }
+
+ POSTACTION(m);
+
+ if (newp != 0) {
+ if (extra != 0) {
+ internal_free(m, extra);
+ }
+ check_inuse_chunk(m, newp);
+ return chunk2mem(newp);
+ } else {
+ void *newmem = internal_malloc(m, bytes);
+ if (newmem != 0) {
+ size_t oc = oldsize - overhead_for(oldp);
+ memcpy(newmem, oldmem, (oc < bytes) ? oc : bytes);
+ internal_free(m, oldmem);
+ }
+ return newmem;
+ }
+ }
+ return 0;
+}
+
+/* --------------------------- memalign support -------------------------- */
+
+static void *
+internal_memalign(mstate m, size_t alignment, size_t bytes)
+{
+ if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */
+ return internal_malloc(m, bytes);
+ if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */
+ alignment = MIN_CHUNK_SIZE;
+ if ((alignment & (alignment - SIZE_T_ONE)) != 0) { /* Ensure a power of 2 */
+ size_t a = MALLOC_ALIGNMENT << 1;
+ while (a < alignment)
+ a <<= 1;
+ alignment = a;
+ }
+
+ if (bytes >= MAX_REQUEST - alignment) {
+ if (m != 0) { /* Test isn't needed but avoids compiler warning */
+ MALLOC_FAILURE_ACTION;
+ }
+ } else {
+ size_t nb = request2size(bytes);
+ size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD;
+ char *mem = (char *) internal_malloc(m, req);
+ if (mem != 0) {
+ void *leader = 0;
+ void *trailer = 0;
+ mchunkptr p = mem2chunk(mem);
+
+ if (PREACTION(m))
+ return 0;
+ if ((((size_t) (mem)) % alignment) != 0) { /* misaligned */
+ /*
+ Find an aligned spot inside chunk. Since we need to give
+ back leading space in a chunk of at least MIN_CHUNK_SIZE, if
+ the first calculation places us at a spot with less than
+ MIN_CHUNK_SIZE leader, we can move to the next aligned spot.
+ We've allocated enough total room so that this is always
+ possible.
+ */
+ char *br = (char *) mem2chunk((size_t) (((size_t) (mem +
+ alignment -
+ SIZE_T_ONE))
+ & -alignment));
+ char *pos =
+ ((size_t) (br - (char *) (p)) >=
+ MIN_CHUNK_SIZE) ? br : br + alignment;
+ mchunkptr newp = (mchunkptr) pos;
+ size_t leadsize = pos - (char *) (p);
+ size_t newsize = chunksize(p) - leadsize;
+
+ if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */
+ newp->prev_foot = p->prev_foot + leadsize;
+ newp->head = (newsize | CINUSE_BIT);
+ } else { /* Otherwise, give back leader, use the rest */
+ set_inuse(m, newp, newsize);
+ set_inuse(m, p, leadsize);
+ leader = chunk2mem(p);
+ }
+ p = newp;
+ }
+
+ /* Give back spare room at the end */
+ if (!is_mmapped(p)) {
+ size_t size = chunksize(p);
+ if (size > nb + MIN_CHUNK_SIZE) {
+ size_t remainder_size = size - nb;
+ mchunkptr remainder = chunk_plus_offset(p, nb);
+ set_inuse(m, p, nb);
+ set_inuse(m, remainder, remainder_size);
+ trailer = chunk2mem(remainder);
+ }
+ }
+
+ assert(chunksize(p) >= nb);
+ assert((((size_t) (chunk2mem(p))) % alignment) == 0);
+ check_inuse_chunk(m, p);
+ POSTACTION(m);
+ if (leader != 0) {
+ internal_free(m, leader);
+ }
+ if (trailer != 0) {
+ internal_free(m, trailer);
+ }
+ return chunk2mem(p);
+ }
+ }
+ return 0;
+}
+
+/* ------------------------ comalloc/coalloc support --------------------- */
+
+static void **
+ialloc(mstate m, size_t n_elements, size_t * sizes, int opts, void *chunks[])
+{
+ /*
+ This provides common support for independent_X routines, handling
+ all of the combinations that can result.
+
+ The opts arg has:
+ bit 0 set if all elements are same size (using sizes[0])
+ bit 1 set if elements should be zeroed
+ */
+
+ size_t element_size; /* chunksize of each element, if all same */
+ size_t contents_size; /* total size of elements */
+ size_t array_size; /* request size of pointer array */
+ void *mem; /* malloced aggregate space */
+ mchunkptr p; /* corresponding chunk */
+ size_t remainder_size; /* remaining bytes while splitting */
+ void **marray; /* either "chunks" or malloced ptr array */
+ mchunkptr array_chunk; /* chunk for malloced ptr array */
+ flag_t was_enabled; /* to disable mmap */
+ size_t size;
+ size_t i;
+
+ /* compute array length, if needed */
+ if (chunks != 0) {
+ if (n_elements == 0)
+ return chunks; /* nothing to do */
+ marray = chunks;
+ array_size = 0;
+ } else {
+ /* if empty req, must still return chunk representing empty array */
+ if (n_elements == 0)
+ return (void **) internal_malloc(m, 0);
+ marray = 0;
+ array_size = request2size(n_elements * (sizeof(void *)));
+ }
+
+ /* compute total element size */
+ if (opts & 0x1) { /* all-same-size */
+ element_size = request2size(*sizes);
+ contents_size = n_elements * element_size;
+ } else { /* add up all the sizes */
+ element_size = 0;
+ contents_size = 0;
+ for (i = 0; i != n_elements; ++i)
+ contents_size += request2size(sizes[i]);
+ }
+
+ size = contents_size + array_size;
+
+ /*
+ Allocate the aggregate chunk. First disable direct-mmapping so
+ malloc won't use it, since we would not be able to later
+ free/realloc space internal to a segregated mmap region.
+ */
+ was_enabled = use_mmap(m);
+ disable_mmap(m);
+ mem = internal_malloc(m, size - CHUNK_OVERHEAD);
+ if (was_enabled)
+ enable_mmap(m);
+ if (mem == 0)
+ return 0;
+
+ if (PREACTION(m))
+ return 0;
+ p = mem2chunk(mem);
+ remainder_size = chunksize(p);
+
+ assert(!is_mmapped(p));
+
+ if (opts & 0x2) { /* optionally clear the elements */
+ memset((size_t *) mem, 0, remainder_size - SIZE_T_SIZE - array_size);
+ }
+
+ /* If not provided, allocate the pointer array as final part of chunk */
+ if (marray == 0) {
+ size_t array_chunk_size;
+ array_chunk = chunk_plus_offset(p, contents_size);
+ array_chunk_size = remainder_size - contents_size;
+ marray = (void **) (chunk2mem(array_chunk));
+ set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size);
+ remainder_size = contents_size;
+ }
+
+ /* split out elements */
+ for (i = 0;; ++i) {
+ marray[i] = chunk2mem(p);
+ if (i != n_elements - 1) {
+ if (element_size != 0)
+ size = element_size;
+ else
+ size = request2size(sizes[i]);
+ remainder_size -= size;
+ set_size_and_pinuse_of_inuse_chunk(m, p, size);
+ p = chunk_plus_offset(p, size);
+ } else { /* the final element absorbs any overallocation slop */
+ set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size);
+ break;
+ }
+ }
+
+#if DEBUG
+ if (marray != chunks) {
+ /* final element must have exactly exhausted chunk */
+ if (element_size != 0) {
+ assert(remainder_size == element_size);
+ } else {
+ assert(remainder_size == request2size(sizes[i]));
+ }
+ check_inuse_chunk(m, mem2chunk(marray));
+ }
+ for (i = 0; i != n_elements; ++i)
+ check_inuse_chunk(m, mem2chunk(marray[i]));
+
+#endif /* DEBUG */
+
+ POSTACTION(m);
+ return marray;
+}
+
+
+/* -------------------------- public routines ---------------------------- */
+
+#if !ONLY_MSPACES
+
+void *
+dlmalloc(size_t bytes)
+{
+ /*
+ Basic algorithm:
+ If a small request (< 256 bytes minus per-chunk overhead):
+ 1. If one exists, use a remainderless chunk in associated smallbin.
+ (Remainderless means that there are too few excess bytes to
+ represent as a chunk.)
+ 2. If it is big enough, use the dv chunk, which is normally the
+ chunk adjacent to the one used for the most recent small request.
+ 3. If one exists, split the smallest available chunk in a bin,
+ saving remainder in dv.
+ 4. If it is big enough, use the top chunk.
+ 5. If available, get memory from system and use it
+ Otherwise, for a large request:
+ 1. Find the smallest available binned chunk that fits, and use it
+ if it is better fitting than dv chunk, splitting if necessary.
+ 2. If better fitting than any binned chunk, use the dv chunk.
+ 3. If it is big enough, use the top chunk.
+ 4. If request size >= mmap threshold, try to directly mmap this chunk.
+ 5. If available, get memory from system and use it
+
+ The ugly goto's here ensure that postaction occurs along all paths.
+ */
+
+ if (!PREACTION(gm)) {
+ void *mem;
+ size_t nb;
+ if (bytes <= MAX_SMALL_REQUEST) {
+ bindex_t idx;
+ binmap_t smallbits;
+ nb = (bytes < MIN_REQUEST) ? MIN_CHUNK_SIZE : pad_request(bytes);
+ idx = small_index(nb);
+ smallbits = gm->smallmap >> idx;
+
+ if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
+ mchunkptr b, p;
+ idx += ~smallbits & 1; /* Uses next bin if idx empty */
+ b = smallbin_at(gm, idx);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(idx));
+ unlink_first_small_chunk(gm, b, p, idx);
+ set_inuse_and_pinuse(gm, p, small_index2size(idx));
+ mem = chunk2mem(p);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb > gm->dvsize) {
+ if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
+ mchunkptr b, p, r;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leftbits =
+ (smallbits << idx) & left_bits(idx2bit(idx));
+ binmap_t leastbit = least_bit(leftbits);
+ compute_bit2idx(leastbit, i);
+ b = smallbin_at(gm, i);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(i));
+ unlink_first_small_chunk(gm, b, p, i);
+ rsize = small_index2size(i) - nb;
+ /* Fit here cannot be remainderless if 4byte sizes */
+ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(gm, p, small_index2size(i));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+ r = chunk_plus_offset(p, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ replace_dv(gm, r, rsize);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ else if (gm->treemap != 0
+ && (mem = tmalloc_small(gm, nb)) != 0) {
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+ }
+ } else if (bytes >= MAX_REQUEST)
+ nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+ else {
+ nb = pad_request(bytes);
+ if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+ }
+
+ if (nb <= gm->dvsize) {
+ size_t rsize = gm->dvsize - nb;
+ mchunkptr p = gm->dv;
+ if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
+ mchunkptr r = gm->dv = chunk_plus_offset(p, nb);
+ gm->dvsize = rsize;
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+ } else { /* exhaust dv */
+ size_t dvs = gm->dvsize;
+ gm->dvsize = 0;
+ gm->dv = 0;
+ set_inuse_and_pinuse(gm, p, dvs);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb < gm->topsize) { /* Split top */
+ size_t rsize = gm->topsize -= nb;
+ mchunkptr p = gm->top;
+ mchunkptr r = gm->top = chunk_plus_offset(p, nb);
+ r->head = rsize | PINUSE_BIT;
+ set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+ mem = chunk2mem(p);
+ check_top_chunk(gm, gm->top);
+ check_malloced_chunk(gm, mem, nb);
+ goto postaction;
+ }
+
+ mem = sys_alloc(gm, nb);
+
+ postaction:
+ POSTACTION(gm);
+ return mem;
+ }
+
+ return 0;
+}
+
+void
+dlfree(void *mem)
+{
+ /*
+ Consolidate freed chunks with preceeding or succeeding bordering
+ free chunks, if they exist, and then place in a bin. Intermixed
+ with special cases for top, dv, mmapped chunks, and usage errors.
+ */
+
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+#if FOOTERS
+ mstate fm = get_mstate_for(p);
+ if (!ok_magic(fm)) {
+ USAGE_ERROR_ACTION(fm, p);
+ return;
+ }
+#else /* FOOTERS */
+#define fm gm
+#endif /* FOOTERS */
+ if (!PREACTION(fm)) {
+ check_inuse_chunk(fm, p);
+ if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) {
+ size_t psize = chunksize(p);
+ mchunkptr next = chunk_plus_offset(p, psize);
+ if (!pinuse(p)) {
+ size_t prevsize = p->prev_foot;
+ if ((prevsize & IS_MMAPPED_BIT) != 0) {
+ prevsize &= ~IS_MMAPPED_BIT;
+ psize += prevsize + MMAP_FOOT_PAD;
+ if (CALL_MUNMAP((char *) p - prevsize, psize) == 0)
+ fm->footprint -= psize;
+ goto postaction;
+ } else {
+ mchunkptr prev = chunk_minus_offset(p, prevsize);
+ psize += prevsize;
+ p = prev;
+ if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
+ if (p != fm->dv) {
+ unlink_chunk(fm, p, prevsize);
+ } else if ((next->head & INUSE_BITS) ==
+ INUSE_BITS) {
+ fm->dvsize = psize;
+ set_free_with_pinuse(p, psize, next);
+ goto postaction;
+ }
+ } else
+ goto erroraction;
+ }
+ }
+
+ if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
+ if (!cinuse(next)) { /* consolidate forward */
+ if (next == fm->top) {
+ size_t tsize = fm->topsize += psize;
+ fm->top = p;
+ p->head = tsize | PINUSE_BIT;
+ if (p == fm->dv) {
+ fm->dv = 0;
+ fm->dvsize = 0;
+ }
+ if (should_trim(fm, tsize))
+ sys_trim(fm, 0);
+ goto postaction;
+ } else if (next == fm->dv) {
+ size_t dsize = fm->dvsize += psize;
+ fm->dv = p;
+ set_size_and_pinuse_of_free_chunk(p, dsize);
+ goto postaction;
+ } else {
+ size_t nsize = chunksize(next);
+ psize += nsize;
+ unlink_chunk(fm, next, nsize);
+ set_size_and_pinuse_of_free_chunk(p, psize);
+ if (p == fm->dv) {
+ fm->dvsize = psize;
+ goto postaction;
+ }
+ }
+ } else
+ set_free_with_pinuse(p, psize, next);
+ insert_chunk(fm, p, psize);
+ check_free_chunk(fm, p);
+ goto postaction;
+ }
+ }
+ erroraction:
+ USAGE_ERROR_ACTION(fm, p);
+ postaction:
+ POSTACTION(fm);
+ }
+ }
+#if !FOOTERS
+#undef fm
+#endif /* FOOTERS */
+}
+
+void *
+dlcalloc(size_t n_elements, size_t elem_size)
+{
+ void *mem;
+ size_t req = 0;
+ if (n_elements != 0) {
+ req = n_elements * elem_size;
+ if (((n_elements | elem_size) & ~(size_t) 0xffff) &&
+ (req / n_elements != elem_size))
+ req = MAX_SIZE_T; /* force downstream failure on overflow */
+ }
+ mem = dlmalloc(req);
+ if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
+ memset(mem, 0, req);
+ return mem;
+}
+
+void *
+dlrealloc(void *oldmem, size_t bytes)
+{
+ if (oldmem == 0)
+ return dlmalloc(bytes);
+#ifdef REALLOC_ZERO_BYTES_FREES
+ if (bytes == 0) {
+ dlfree(oldmem);
+ return 0;
+ }
+#endif /* REALLOC_ZERO_BYTES_FREES */
+ else {
+#if ! FOOTERS
+ mstate m = gm;
+#else /* FOOTERS */
+ mstate m = get_mstate_for(mem2chunk(oldmem));
+ if (!ok_magic(m)) {
+ USAGE_ERROR_ACTION(m, oldmem);
+ return 0;
+ }
+#endif /* FOOTERS */
+ return internal_realloc(m, oldmem, bytes);
+ }
+}
+
+void *
+dlmemalign(size_t alignment, size_t bytes)
+{
+ return internal_memalign(gm, alignment, bytes);
+}
+
+void **
+dlindependent_calloc(size_t n_elements, size_t elem_size, void *chunks[])
+{
+ size_t sz = elem_size; /* serves as 1-element array */
+ return ialloc(gm, n_elements, &sz, 3, chunks);
+}
+
+void **
+dlindependent_comalloc(size_t n_elements, size_t sizes[], void *chunks[])
+{
+ return ialloc(gm, n_elements, sizes, 0, chunks);
+}
+
+void *
+dlvalloc(size_t bytes)
+{
+ size_t pagesz;
+ init_mparams();
+ pagesz = mparams.page_size;
+ return dlmemalign(pagesz, bytes);
+}
+
+void *
+dlpvalloc(size_t bytes)
+{
+ size_t pagesz;
+ init_mparams();
+ pagesz = mparams.page_size;
+ return dlmemalign(pagesz,
+ (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE));
+}
+
+int
+dlmalloc_trim(size_t pad)
+{
+ int result = 0;
+ if (!PREACTION(gm)) {
+ result = sys_trim(gm, pad);
+ POSTACTION(gm);
+ }
+ return result;
+}
+
+size_t
+dlmalloc_footprint(void)
+{
+ return gm->footprint;
+}
+
+size_t
+dlmalloc_max_footprint(void)
+{
+ return gm->max_footprint;
+}
+
+#if !NO_MALLINFO
+struct mallinfo
+dlmallinfo(void)
+{
+ return internal_mallinfo(gm);
+}
+#endif /* NO_MALLINFO */
+
+void
+dlmalloc_stats()
+{
+ internal_malloc_stats(gm);
+}
+
+size_t
+dlmalloc_usable_size(void *mem)
+{
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+ if (cinuse(p))
+ return chunksize(p) - overhead_for(p);
+ }
+ return 0;
+}
+
+int
+dlmallopt(int param_number, int value)
+{
+ return change_mparam(param_number, value);
+}
+
+#endif /* !ONLY_MSPACES */
+
+/* ----------------------------- user mspaces ---------------------------- */
+
+#if MSPACES
+
+static mstate
+init_user_mstate(char *tbase, size_t tsize)
+{
+ size_t msize = pad_request(sizeof(struct malloc_state));
+ mchunkptr mn;
+ mchunkptr msp = align_as_chunk(tbase);
+ mstate m = (mstate) (chunk2mem(msp));
+ memset(m, 0, msize);
+ INITIAL_LOCK(&m->mutex);
+ msp->head = (msize | PINUSE_BIT | CINUSE_BIT);
+ m->seg.base = m->least_addr = tbase;
+ m->seg.size = m->footprint = m->max_footprint = tsize;
+ m->magic = mparams.magic;
+ m->mflags = mparams.default_mflags;
+ disable_contiguous(m);
+ init_bins(m);
+ mn = next_chunk(mem2chunk(m));
+ init_top(m, mn, (size_t) ((tbase + tsize) - (char *) mn) - TOP_FOOT_SIZE);
+ check_top_chunk(m, m->top);
+ return m;
+}
+
+mspace
+create_mspace(size_t capacity, int locked)
+{
+ mstate m = 0;
+ size_t msize = pad_request(sizeof(struct malloc_state));
+ init_mparams(); /* Ensure pagesize etc initialized */
+
+ if (capacity < (size_t) - (msize + TOP_FOOT_SIZE + mparams.page_size)) {
+ size_t rs = ((capacity == 0) ? mparams.granularity :
+ (capacity + TOP_FOOT_SIZE + msize));
+ size_t tsize = granularity_align(rs);
+ char *tbase = (char *) (CALL_MMAP(tsize));
+ if (tbase != CMFAIL) {
+ m = init_user_mstate(tbase, tsize);
+ m->seg.sflags = IS_MMAPPED_BIT;
+ set_lock(m, locked);
+ }
+ }
+ return (mspace) m;
+}
+
+mspace
+create_mspace_with_base(void *base, size_t capacity, int locked)
+{
+ mstate m = 0;
+ size_t msize = pad_request(sizeof(struct malloc_state));
+ init_mparams(); /* Ensure pagesize etc initialized */
+
+ if (capacity > msize + TOP_FOOT_SIZE &&
+ capacity < (size_t) - (msize + TOP_FOOT_SIZE + mparams.page_size)) {
+ m = init_user_mstate((char *) base, capacity);
+ m->seg.sflags = EXTERN_BIT;
+ set_lock(m, locked);
+ }
+ return (mspace) m;
+}
+
+size_t
+destroy_mspace(mspace msp)
+{
+ size_t freed = 0;
+ mstate ms = (mstate) msp;
+ if (ok_magic(ms)) {
+ msegmentptr sp = &ms->seg;
+ while (sp != 0) {
+ char *base = sp->base;
+ size_t size = sp->size;
+ flag_t flag = sp->sflags;
+ sp = sp->next;
+ if ((flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) &&
+ CALL_MUNMAP(base, size) == 0)
+ freed += size;
+ }
+ } else {
+ USAGE_ERROR_ACTION(ms, ms);
+ }
+ return freed;
+}
+
+/*
+ mspace versions of routines are near-clones of the global
+ versions. This is not so nice but better than the alternatives.
+*/
+
+
+void *
+mspace_malloc(mspace msp, size_t bytes)
+{
+ mstate ms = (mstate) msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ return 0;
+ }
+ if (!PREACTION(ms)) {
+ void *mem;
+ size_t nb;
+ if (bytes <= MAX_SMALL_REQUEST) {
+ bindex_t idx;
+ binmap_t smallbits;
+ nb = (bytes < MIN_REQUEST) ? MIN_CHUNK_SIZE : pad_request(bytes);
+ idx = small_index(nb);
+ smallbits = ms->smallmap >> idx;
+
+ if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
+ mchunkptr b, p;
+ idx += ~smallbits & 1; /* Uses next bin if idx empty */
+ b = smallbin_at(ms, idx);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(idx));
+ unlink_first_small_chunk(ms, b, p, idx);
+ set_inuse_and_pinuse(ms, p, small_index2size(idx));
+ mem = chunk2mem(p);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb > ms->dvsize) {
+ if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
+ mchunkptr b, p, r;
+ size_t rsize;
+ bindex_t i;
+ binmap_t leftbits =
+ (smallbits << idx) & left_bits(idx2bit(idx));
+ binmap_t leastbit = least_bit(leftbits);
+ compute_bit2idx(leastbit, i);
+ b = smallbin_at(ms, i);
+ p = b->fd;
+ assert(chunksize(p) == small_index2size(i));
+ unlink_first_small_chunk(ms, b, p, i);
+ rsize = small_index2size(i) - nb;
+ /* Fit here cannot be remainderless if 4byte sizes */
+ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
+ set_inuse_and_pinuse(ms, p, small_index2size(i));
+ else {
+ set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
+ r = chunk_plus_offset(p, nb);
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ replace_dv(ms, r, rsize);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ else if (ms->treemap != 0
+ && (mem = tmalloc_small(ms, nb)) != 0) {
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+ }
+ } else if (bytes >= MAX_REQUEST)
+ nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+ else {
+ nb = pad_request(bytes);
+ if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) {
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+ }
+
+ if (nb <= ms->dvsize) {
+ size_t rsize = ms->dvsize - nb;
+ mchunkptr p = ms->dv;
+ if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
+ mchunkptr r = ms->dv = chunk_plus_offset(p, nb);
+ ms->dvsize = rsize;
+ set_size_and_pinuse_of_free_chunk(r, rsize);
+ set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
+ } else { /* exhaust dv */
+ size_t dvs = ms->dvsize;
+ ms->dvsize = 0;
+ ms->dv = 0;
+ set_inuse_and_pinuse(ms, p, dvs);
+ }
+ mem = chunk2mem(p);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ else if (nb < ms->topsize) { /* Split top */
+ size_t rsize = ms->topsize -= nb;
+ mchunkptr p = ms->top;
+ mchunkptr r = ms->top = chunk_plus_offset(p, nb);
+ r->head = rsize | PINUSE_BIT;
+ set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
+ mem = chunk2mem(p);
+ check_top_chunk(ms, ms->top);
+ check_malloced_chunk(ms, mem, nb);
+ goto postaction;
+ }
+
+ mem = sys_alloc(ms, nb);
+
+ postaction:
+ POSTACTION(ms);
+ return mem;
+ }
+
+ return 0;
+}
+
+void
+mspace_free(mspace msp, void *mem)
+{
+ if (mem != 0) {
+ mchunkptr p = mem2chunk(mem);
+#if FOOTERS
+ mstate fm = get_mstate_for(p);
+#else /* FOOTERS */
+ mstate fm = (mstate) msp;
+#endif /* FOOTERS */
+ if (!ok_magic(fm)) {
+ USAGE_ERROR_ACTION(fm, p);
+ return;
+ }
+ if (!PREACTION(fm)) {
+ check_inuse_chunk(fm, p);
+ if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) {
+ size_t psize = chunksize(p);
+ mchunkptr next = chunk_plus_offset(p, psize);
+ if (!pinuse(p)) {
+ size_t prevsize = p->prev_foot;
+ if ((prevsize & IS_MMAPPED_BIT) != 0) {
+ prevsize &= ~IS_MMAPPED_BIT;
+ psize += prevsize + MMAP_FOOT_PAD;
+ if (CALL_MUNMAP((char *) p - prevsize, psize) == 0)
+ fm->footprint -= psize;
+ goto postaction;
+ } else {
+ mchunkptr prev = chunk_minus_offset(p, prevsize);
+ psize += prevsize;
+ p = prev;
+ if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
+ if (p != fm->dv) {
+ unlink_chunk(fm, p, prevsize);
+ } else if ((next->head & INUSE_BITS) ==
+ INUSE_BITS) {
+ fm->dvsize = psize;
+ set_free_with_pinuse(p, psize, next);
+ goto postaction;
+ }
+ } else
+ goto erroraction;
+ }
+ }
+
+ if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
+ if (!cinuse(next)) { /* consolidate forward */
+ if (next == fm->top) {
+ size_t tsize = fm->topsize += psize;
+ fm->top = p;
+ p->head = tsize | PINUSE_BIT;
+ if (p == fm->dv) {
+ fm->dv = 0;
+ fm->dvsize = 0;
+ }
+ if (should_trim(fm, tsize))
+ sys_trim(fm, 0);
+ goto postaction;
+ } else if (next == fm->dv) {
+ size_t dsize = fm->dvsize += psize;
+ fm->dv = p;
+ set_size_and_pinuse_of_free_chunk(p, dsize);
+ goto postaction;
+ } else {
+ size_t nsize = chunksize(next);
+ psize += nsize;
+ unlink_chunk(fm, next, nsize);
+ set_size_and_pinuse_of_free_chunk(p, psize);
+ if (p == fm->dv) {
+ fm->dvsize = psize;
+ goto postaction;
+ }
+ }
+ } else
+ set_free_with_pinuse(p, psize, next);
+ insert_chunk(fm, p, psize);
+ check_free_chunk(fm, p);
+ goto postaction;
+ }
+ }
+ erroraction:
+ USAGE_ERROR_ACTION(fm, p);
+ postaction:
+ POSTACTION(fm);
+ }
+ }
+}
+
+void *
+mspace_calloc(mspace msp, size_t n_elements, size_t elem_size)
+{
+ void *mem;
+ size_t req = 0;
+ mstate ms = (mstate) msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ return 0;
+ }
+ if (n_elements != 0) {
+ req = n_elements * elem_size;
+ if (((n_elements | elem_size) & ~(size_t) 0xffff) &&
+ (req / n_elements != elem_size))
+ req = MAX_SIZE_T; /* force downstream failure on overflow */
+ }
+ mem = internal_malloc(ms, req);
+ if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
+ memset(mem, 0, req);
+ return mem;
+}
+
+void *
+mspace_realloc(mspace msp, void *oldmem, size_t bytes)
+{
+ if (oldmem == 0)
+ return mspace_malloc(msp, bytes);
+#ifdef REALLOC_ZERO_BYTES_FREES
+ if (bytes == 0) {
+ mspace_free(msp, oldmem);
+ return 0;
+ }
+#endif /* REALLOC_ZERO_BYTES_FREES */
+ else {
+#if FOOTERS
+ mchunkptr p = mem2chunk(oldmem);
+ mstate ms = get_mstate_for(p);
+#else /* FOOTERS */
+ mstate ms = (mstate) msp;
+#endif /* FOOTERS */
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ return 0;
+ }
+ return internal_realloc(ms, oldmem, bytes);
+ }
+}
+
+void *
+mspace_memalign(mspace msp, size_t alignment, size_t bytes)
+{
+ mstate ms = (mstate) msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ return 0;
+ }
+ return internal_memalign(ms, alignment, bytes);
+}
+
+void **
+mspace_independent_calloc(mspace msp, size_t n_elements,
+ size_t elem_size, void *chunks[])
+{
+ size_t sz = elem_size; /* serves as 1-element array */
+ mstate ms = (mstate) msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ return 0;
+ }
+ return ialloc(ms, n_elements, &sz, 3, chunks);
+}
+
+void **
+mspace_independent_comalloc(mspace msp, size_t n_elements,
+ size_t sizes[], void *chunks[])
+{
+ mstate ms = (mstate) msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ return 0;
+ }
+ return ialloc(ms, n_elements, sizes, 0, chunks);
+}
+
+int
+mspace_trim(mspace msp, size_t pad)
+{
+ int result = 0;
+ mstate ms = (mstate) msp;
+ if (ok_magic(ms)) {
+ if (!PREACTION(ms)) {
+ result = sys_trim(ms, pad);
+ POSTACTION(ms);
+ }
+ } else {
+ USAGE_ERROR_ACTION(ms, ms);
+ }
+ return result;
+}
+
+void
+mspace_malloc_stats(mspace msp)
+{
+ mstate ms = (mstate) msp;
+ if (ok_magic(ms)) {
+ internal_malloc_stats(ms);
+ } else {
+ USAGE_ERROR_ACTION(ms, ms);
+ }
+}
+
+size_t
+mspace_footprint(mspace msp)
+{
+ size_t result;
+ mstate ms = (mstate) msp;
+ if (ok_magic(ms)) {
+ result = ms->footprint;
+ }
+ USAGE_ERROR_ACTION(ms, ms);
+ return result;
+}
+
+
+size_t
+mspace_max_footprint(mspace msp)
+{
+ size_t result;
+ mstate ms = (mstate) msp;
+ if (ok_magic(ms)) {
+ result = ms->max_footprint;
+ }
+ USAGE_ERROR_ACTION(ms, ms);
+ return result;
+}
+
+
+#if !NO_MALLINFO
+struct mallinfo
+mspace_mallinfo(mspace msp)
+{
+ mstate ms = (mstate) msp;
+ if (!ok_magic(ms)) {
+ USAGE_ERROR_ACTION(ms, ms);
+ }
+ return internal_mallinfo(ms);
+}
+#endif /* NO_MALLINFO */
+
+int
+mspace_mallopt(int param_number, int value)
+{
+ return change_mparam(param_number, value);
+}
+
+#endif /* MSPACES */
+
+/* -------------------- Alternative MORECORE functions ------------------- */
+
+/*
+ Guidelines for creating a custom version of MORECORE:
+
+ * For best performance, MORECORE should allocate in multiples of pagesize.
+ * MORECORE may allocate more memory than requested. (Or even less,
+ but this will usually result in a malloc failure.)
+ * MORECORE must not allocate memory when given argument zero, but
+ instead return one past the end address of memory from previous
+ nonzero call.
+ * For best performance, consecutive calls to MORECORE with positive
+ arguments should return increasing addresses, indicating that
+ space has been contiguously extended.
+ * Even though consecutive calls to MORECORE need not return contiguous
+ addresses, it must be OK for malloc'ed chunks to span multiple
+ regions in those cases where they do happen to be contiguous.
+ * MORECORE need not handle negative arguments -- it may instead
+ just return MFAIL when given negative arguments.
+ Negative arguments are always multiples of pagesize. MORECORE
+ must not misinterpret negative args as large positive unsigned
+ args. You can suppress all such calls from even occurring by defining
+ MORECORE_CANNOT_TRIM,
+
+ As an example alternative MORECORE, here is a custom allocator
+ kindly contributed for pre-OSX macOS. It uses virtually but not
+ necessarily physically contiguous non-paged memory (locked in,
+ present and won't get swapped out). You can use it by uncommenting
+ this section, adding some #includes, and setting up the appropriate
+ defines above:
+
+ #define MORECORE osMoreCore
+
+ There is also a shutdown routine that should somehow be called for
+ cleanup upon program exit.
+
+ #define MAX_POOL_ENTRIES 100
+ #define MINIMUM_MORECORE_SIZE (64 * 1024U)
+ static int next_os_pool;
+ void *our_os_pools[MAX_POOL_ENTRIES];
+
+ void *osMoreCore(int size)
+ {
+ void *ptr = 0;
+ static void *sbrk_top = 0;
+
+ if (size > 0)
+ {
+ if (size < MINIMUM_MORECORE_SIZE)
+ size = MINIMUM_MORECORE_SIZE;
+ if (CurrentExecutionLevel() == kTaskLevel)
+ ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
+ if (ptr == 0)
+ {
+ return (void *) MFAIL;
+ }
+ // save ptrs so they can be freed during cleanup
+ our_os_pools[next_os_pool] = ptr;
+ next_os_pool++;
+ ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
+ sbrk_top = (char *) ptr + size;
+ return ptr;
+ }
+ else if (size < 0)
+ {
+ // we don't currently support shrink behavior
+ return (void *) MFAIL;
+ }
+ else
+ {
+ return sbrk_top;
+ }
+ }
+
+ // cleanup any allocated memory pools
+ // called as last thing before shutting down driver
+
+ void osCleanupMem(void)
+ {
+ void **ptr;
+
+ for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
+ if (*ptr)
+ {
+ PoolDeallocate(*ptr);
+ *ptr = 0;
+ }
+ }
+
+*/
+
+
+/* -----------------------------------------------------------------------
+History:
+ V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee)
+ * Add max_footprint functions
+ * Ensure all appropriate literals are size_t
+ * Fix conditional compilation problem for some #define settings
+ * Avoid concatenating segments with the one provided
+ in create_mspace_with_base
+ * Rename some variables to avoid compiler shadowing warnings
+ * Use explicit lock initialization.
+ * Better handling of sbrk interference.
+ * Simplify and fix segment insertion, trimming and mspace_destroy
+ * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x
+ * Thanks especially to Dennis Flanagan for help on these.
+
+ V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee)
+ * Fix memalign brace error.
+
+ V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee)
+ * Fix improper #endif nesting in C++
+ * Add explicit casts needed for C++
+
+ V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee)
+ * Use trees for large bins
+ * Support mspaces
+ * Use segments to unify sbrk-based and mmap-based system allocation,
+ removing need for emulation on most platforms without sbrk.
+ * Default safety checks
+ * Optional footer checks. Thanks to William Robertson for the idea.
+ * Internal code refactoring
+ * Incorporate suggestions and platform-specific changes.
+ Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas,
+ Aaron Bachmann, Emery Berger, and others.
+ * Speed up non-fastbin processing enough to remove fastbins.
+ * Remove useless cfree() to avoid conflicts with other apps.
+ * Remove internal memcpy, memset. Compilers handle builtins better.
+ * Remove some options that no one ever used and rename others.
+
+ V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)
+ * Fix malloc_state bitmap array misdeclaration
+
+ V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee)
+ * Allow tuning of FIRST_SORTED_BIN_SIZE
+ * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte.
+ * Better detection and support for non-contiguousness of MORECORE.
+ Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger
+ * Bypass most of malloc if no frees. Thanks To Emery Berger.
+ * Fix freeing of old top non-contiguous chunk im sysmalloc.
+ * Raised default trim and map thresholds to 256K.
+ * Fix mmap-related #defines. Thanks to Lubos Lunak.
+ * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield.
+ * Branch-free bin calculation
+ * Default trim and mmap thresholds now 256K.
+
+ V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee)
+ * Introduce independent_comalloc and independent_calloc.
+ Thanks to Michael Pachos for motivation and help.
+ * Make optional .h file available
+ * Allow > 2GB requests on 32bit systems.
+ * new WIN32 sbrk, mmap, munmap, lock code from <Walter@GeNeSys-e.de>.
+ Thanks also to Andreas Mueller <a.mueller at paradatec.de>,
+ and Anonymous.
+ * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for
+ helping test this.)
+ * memalign: check alignment arg
+ * realloc: don't try to shift chunks backwards, since this
+ leads to more fragmentation in some programs and doesn't
+ seem to help in any others.
+ * Collect all cases in malloc requiring system memory into sysmalloc
+ * Use mmap as backup to sbrk
+ * Place all internal state in malloc_state
+ * Introduce fastbins (although similar to 2.5.1)
+ * Many minor tunings and cosmetic improvements
+ * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK
+ * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
+ Thanks to Tony E. Bennett <tbennett@nvidia.com> and others.
+ * Include errno.h to support default failure action.
+
+ V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee)
+ * return null for negative arguments
+ * Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
+ * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
+ (e.g. WIN32 platforms)
+ * Cleanup header file inclusion for WIN32 platforms
+ * Cleanup code to avoid Microsoft Visual C++ compiler complaints
+ * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
+ memory allocation routines
+ * Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
+ * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
+ usage of 'assert' in non-WIN32 code
+ * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
+ avoid infinite loop
+ * Always call 'fREe()' rather than 'free()'
+
+ V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee)
+ * Fixed ordering problem with boundary-stamping
+
+ V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
+ * Added pvalloc, as recommended by H.J. Liu
+ * Added 64bit pointer support mainly from Wolfram Gloger
+ * Added anonymously donated WIN32 sbrk emulation
+ * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
+ * malloc_extend_top: fix mask error that caused wastage after
+ foreign sbrks
+ * Add linux mremap support code from HJ Liu
+
+ V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
+ * Integrated most documentation with the code.
+ * Add support for mmap, with help from
+ Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
+ * Use last_remainder in more cases.
+ * Pack bins using idea from colin@nyx10.cs.du.edu
+ * Use ordered bins instead of best-fit threshhold
+ * Eliminate block-local decls to simplify tracing and debugging.
+ * Support another case of realloc via move into top
+ * Fix error occuring when initial sbrk_base not word-aligned.
+ * Rely on page size for units instead of SBRK_UNIT to
+ avoid surprises about sbrk alignment conventions.
+ * Add mallinfo, mallopt. Thanks to Raymond Nijssen
+ (raymond@es.ele.tue.nl) for the suggestion.
+ * Add `pad' argument to malloc_trim and top_pad mallopt parameter.
+ * More precautions for cases where other routines call sbrk,
+ courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
+ * Added macros etc., allowing use in linux libc from
+ H.J. Lu (hjl@gnu.ai.mit.edu)
+ * Inverted this history list
+
+ V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
+ * Re-tuned and fixed to behave more nicely with V2.6.0 changes.
+ * Removed all preallocation code since under current scheme
+ the work required to undo bad preallocations exceeds
+ the work saved in good cases for most test programs.
+ * No longer use return list or unconsolidated bins since
+ no scheme using them consistently outperforms those that don't
+ given above changes.
+ * Use best fit for very large chunks to prevent some worst-cases.
+ * Added some support for debugging
+
+ V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
+ * Removed footers when chunks are in use. Thanks to
+ Paul Wilson (wilson@cs.texas.edu) for the suggestion.
+
+ V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
+ * Added malloc_trim, with help from Wolfram Gloger
+ (wmglo@Dent.MED.Uni-Muenchen.DE).
+
+ V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
+
+ V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
+ * realloc: try to expand in both directions
+ * malloc: swap order of clean-bin strategy;
+ * realloc: only conditionally expand backwards
+ * Try not to scavenge used bins
+ * Use bin counts as a guide to preallocation
+ * Occasionally bin return list chunks in first scan
+ * Add a few optimizations from colin@nyx10.cs.du.edu
+
+ V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
+ * faster bin computation & slightly different binning
+ * merged all consolidations to one part of malloc proper
+ (eliminating old malloc_find_space & malloc_clean_bin)
+ * Scan 2 returns chunks (not just 1)
+ * Propagate failure in realloc if malloc returns 0
+ * Add stuff to allow compilation on non-ANSI compilers
+ from kpv@research.att.com
+
+ V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
+ * removed potential for odd address access in prev_chunk
+ * removed dependency on getpagesize.h
+ * misc cosmetics and a bit more internal documentation
+ * anticosmetics: mangled names in macros to evade debugger strangeness
+ * tested on sparc, hp-700, dec-mips, rs6000
+ with gcc & native cc (hp, dec only) allowing
+ Detlefs & Zorn comparison study (in SIGPLAN Notices.)
+
+ Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
+ * Based loosely on libg++-1.2X malloc. (It retains some of the overall
+ structure of old version, but most details differ.)
+
+*/
+
+#endif /* !HAVE_MALLOC */
+
+#ifdef HAVE_MALLOC
+#define real_malloc malloc
+#define real_calloc calloc
+#define real_realloc realloc
+#define real_free free
+#else
+#define real_malloc dlmalloc
+#define real_calloc dlcalloc
+#define real_realloc dlrealloc
+#define real_free dlfree
+#endif
+
+/* Memory functions used by SDL that can be replaced by the application */
+static struct
+{
+ SDL_malloc_func malloc_func;
+ SDL_calloc_func calloc_func;
+ SDL_realloc_func realloc_func;
+ SDL_free_func free_func;
+ SDL_atomic_t num_allocations;
+} s_mem = {
+ real_malloc, real_calloc, real_realloc, real_free, { 0 }
+};
+
+void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+ SDL_calloc_func *calloc_func,
+ SDL_realloc_func *realloc_func,
+ SDL_free_func *free_func)
+{
+ if (malloc_func) {
+ *malloc_func = s_mem.malloc_func;
+ }
+ if (calloc_func) {
+ *calloc_func = s_mem.calloc_func;
+ }
+ if (realloc_func) {
+ *realloc_func = s_mem.realloc_func;
+ }
+ if (free_func) {
+ *free_func = s_mem.free_func;
+ }
+}
+
+int SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+ SDL_calloc_func calloc_func,
+ SDL_realloc_func realloc_func,
+ SDL_free_func free_func)
+{
+ if (!malloc_func) {
+ return SDL_InvalidParamError("malloc_func");
+ }
+ if (!calloc_func) {
+ return SDL_InvalidParamError("calloc_func");
+ }
+ if (!realloc_func) {
+ return SDL_InvalidParamError("realloc_func");
+ }
+ if (!free_func) {
+ return SDL_InvalidParamError("free_func");
+ }
+
+ s_mem.malloc_func = malloc_func;
+ s_mem.calloc_func = calloc_func;
+ s_mem.realloc_func = realloc_func;
+ s_mem.free_func = free_func;
+ return 0;
+}
+
+int SDL_GetNumAllocations(void)
+{
+ return SDL_AtomicGet(&s_mem.num_allocations);
+}
+
+void *SDL_malloc(size_t size)
+{
+ void *mem;
+
+ if (!size) {
+ size = 1;
+ }
+
+ mem = s_mem.malloc_func(size);
+ if (mem) {
+ SDL_AtomicIncRef(&s_mem.num_allocations);
+ }
+ return mem;
+}
+
+void *SDL_calloc(size_t nmemb, size_t size)
+{
+ void *mem;
+
+ if (!nmemb || !size) {
+ nmemb = 1;
+ size = 1;
+ }
+
+ mem = s_mem.calloc_func(nmemb, size);
+ if (mem) {
+ SDL_AtomicIncRef(&s_mem.num_allocations);
+ }
+ return mem;
+}
+
+void *SDL_realloc(void *ptr, size_t size)
+{
+ void *mem;
+
+ if (!ptr && !size) {
+ size = 1;
+ }
+
+ mem = s_mem.realloc_func(ptr, size);
+ if (mem && !ptr) {
+ SDL_AtomicIncRef(&s_mem.num_allocations);
+ }
+ return mem;
+}
+
+void SDL_free(void *ptr)
+{
+ if (!ptr) {
+ return;
+ }
+
+ s_mem.free_func(ptr);
+ (void)SDL_AtomicDecRef(&s_mem.num_allocations);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/stdlib/SDL_qsort.c b/src/3rdparty/SDL2/src/stdlib/SDL_qsort.c
new file mode 100644
index 0000000..700b9da
--- /dev/null
+++ b/src/3rdparty/SDL2/src/stdlib/SDL_qsort.c
@@ -0,0 +1,534 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+
+#if defined(HAVE_QSORT)
+void
+SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *))
+{
+ qsort(base, nmemb, size, compare);
+}
+
+#else
+
+#ifdef assert
+#undef assert
+#endif
+#define assert SDL_assert
+#ifdef malloc
+#undef malloc
+#endif
+#define malloc SDL_malloc
+#ifdef free
+#undef free
+#endif
+#define free SDL_free
+#ifdef memcpy
+#undef memcpy
+#endif
+#define memcpy SDL_memcpy
+#ifdef memmove
+#undef memmove
+#endif
+#define memmove SDL_memmove
+#ifdef qsortG
+#undef qsortG
+#endif
+#define qsortG SDL_qsort
+
+/*
+This code came from Gareth McCaughan, under the zlib license.
+Specifically this: https://www.mccaughan.org.uk/software/qsort.c-1.14
+
+Everything below this comment until the HAVE_QSORT #endif was from Gareth
+(any minor changes will be noted inline).
+
+Thank you to Gareth for relicensing this code under the zlib license for our
+benefit!
+
+--ryan.
+*/
+
+/* This is a drop-in replacement for the C library's |qsort()| routine.
+ *
+ * It is intended for use where you know or suspect that your
+ * platform's qsort is bad. If that isn't the case, then you
+ * should probably use the qsort your system gives you in preference
+ * to mine -- it will likely have been tested and tuned better.
+ *
+ * Features:
+ * - Median-of-three pivoting (and more)
+ * - Truncation and final polishing by a single insertion sort
+ * - Early truncation when no swaps needed in pivoting step
+ * - Explicit recursion, guaranteed not to overflow
+ * - A few little wrinkles stolen from the GNU |qsort()|.
+ * (For the avoidance of doubt, no code was stolen, only
+ * broad ideas.)
+ * - separate code for non-aligned / aligned / word-size objects
+ *
+ * Earlier releases of this code used an idiosyncratic licence
+ * I wrote myself, because I'm an idiot. The code is now released
+ * under the "zlib/libpng licence"; you will find the actual
+ * terms in the next comment. I request (but do not require)
+ * that if you make any changes beyond the name of the exported
+ * routine and reasonable tweaks to the TRUNC_* and
+ * PIVOT_THRESHOLD values, you modify the _ID string so as
+ * to make it clear that you have changed the code.
+ *
+ * If you find problems with this code, or find ways of
+ * making it significantly faster, please let me know!
+ * My e-mail address, valid as of early 2016 and for the
+ * foreseeable future, is
+ * gareth.mccaughan@pobox.com
+ * Thanks!
+ *
+ * Gareth McCaughan
+ */
+
+/* Copyright (c) 1998-2016 Gareth McCaughan
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any
+ * damages arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented;
+ * you must not claim that you wrote the original software.
+ * If you use this software in a product, an acknowledgment
+ * in the product documentation would be appreciated but
+ * is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such,
+ * and must not be misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ */
+
+/* Revision history since release:
+ * 1998-03-19 v1.12 First release I have any records of.
+ * 2007-09-02 v1.13 Fix bug kindly reported by Dan Bodoh
+ * (premature termination of recursion).
+ * Add a few clarifying comments.
+ * Minor improvements to debug output.
+ * 2016-02-21 v1.14 Replace licence with 2-clause BSD,
+ * and clarify a couple of things in
+ * comments. No code changes.
+ */
+
+/* BEGIN SDL CHANGE ... commented this out with an #if 0 block. --ryan. */
+#if 0
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define DEBUG_QSORT
+
+static char _ID[]="<qsort.c gjm 1.14 2016-02-21>";
+#endif
+/* END SDL CHANGE ... commented this out with an #if 0 block. --ryan. */
+
+/* How many bytes are there per word? (Must be a power of 2,
+ * and must in fact equal sizeof(int).)
+ */
+#define WORD_BYTES sizeof(int)
+
+/* How big does our stack need to be? Answer: one entry per
+ * bit in a |size_t|.
+ */
+#define STACK_SIZE (8*sizeof(size_t))
+
+/* Different situations have slightly different requirements,
+ * and we make life epsilon easier by using different truncation
+ * points for the three different cases.
+ * So far, I have tuned TRUNC_words and guessed that the same
+ * value might work well for the other two cases. Of course
+ * what works well on my machine might work badly on yours.
+ */
+#define TRUNC_nonaligned 12
+#define TRUNC_aligned 12
+#define TRUNC_words 12*WORD_BYTES /* nb different meaning */
+
+/* We use a simple pivoting algorithm for shortish sub-arrays
+ * and a more complicated one for larger ones. The threshold
+ * is PIVOT_THRESHOLD.
+ */
+#define PIVOT_THRESHOLD 40
+
+typedef struct { char * first; char * last; } stack_entry;
+#define pushLeft {stack[stacktop].first=ffirst;stack[stacktop++].last=last;}
+#define pushRight {stack[stacktop].first=first;stack[stacktop++].last=llast;}
+#define doLeft {first=ffirst;llast=last;continue;}
+#define doRight {ffirst=first;last=llast;continue;}
+#define pop {if (--stacktop<0) break;\
+ first=ffirst=stack[stacktop].first;\
+ last=llast=stack[stacktop].last;\
+ continue;}
+
+/* Some comments on the implementation.
+ * 1. When we finish partitioning the array into "low"
+ * and "high", we forget entirely about short subarrays,
+ * because they'll be done later by insertion sort.
+ * Doing lots of little insertion sorts might be a win
+ * on large datasets for locality-of-reference reasons,
+ * but it makes the code much nastier and increases
+ * bookkeeping overhead.
+ * 2. We always save the shorter and get to work on the
+ * longer. This guarantees that every time we push
+ * an item onto the stack its size is <= 1/2 of that
+ * of its parent; so the stack can't need more than
+ * log_2(max-array-size) entries.
+ * 3. We choose a pivot by looking at the first, last
+ * and middle elements. We arrange them into order
+ * because it's easy to do that in conjunction with
+ * choosing the pivot, and it makes things a little
+ * easier in the partitioning step. Anyway, the pivot
+ * is the middle of these three. It's still possible
+ * to construct datasets where the algorithm takes
+ * time of order n^2, but it simply never happens in
+ * practice.
+ * 3' Newsflash: On further investigation I find that
+ * it's easy to construct datasets where median-of-3
+ * simply isn't good enough. So on large-ish subarrays
+ * we do a more sophisticated pivoting: we take three
+ * sets of 3 elements, find their medians, and then
+ * take the median of those.
+ * 4. We copy the pivot element to a separate place
+ * because that way we can always do our comparisons
+ * directly against a pointer to that separate place,
+ * and don't have to wonder "did we move the pivot
+ * element?". This makes the inner loop better.
+ * 5. It's possible to make the pivoting even more
+ * reliable by looking at more candidates when n
+ * is larger. (Taking this to its logical conclusion
+ * results in a variant of quicksort that doesn't
+ * have that n^2 worst case.) However, the overhead
+ * from the extra bookkeeping means that it's just
+ * not worth while.
+ * 6. This is pretty clean and portable code. Here are
+ * all the potential portability pitfalls and problems
+ * I know of:
+ * - In one place (the insertion sort) I construct
+ * a pointer that points just past the end of the
+ * supplied array, and assume that (a) it won't
+ * compare equal to any pointer within the array,
+ * and (b) it will compare equal to a pointer
+ * obtained by stepping off the end of the array.
+ * These might fail on some segmented architectures.
+ * - I assume that there are 8 bits in a |char| when
+ * computing the size of stack needed. This would
+ * fail on machines with 9-bit or 16-bit bytes.
+ * - I assume that if |((int)base&(sizeof(int)-1))==0|
+ * and |(size&(sizeof(int)-1))==0| then it's safe to
+ * get at array elements via |int*|s, and that if
+ * actually |size==sizeof(int)| as well then it's
+ * safe to treat the elements as |int|s. This might
+ * fail on systems that convert pointers to integers
+ * in non-standard ways.
+ * - I assume that |8*sizeof(size_t)<=INT_MAX|. This
+ * would be false on a machine with 8-bit |char|s,
+ * 16-bit |int|s and 4096-bit |size_t|s. :-)
+ */
+
+/* The recursion logic is the same in each case.
+ * We keep chopping up until we reach subarrays of size
+ * strictly less than Trunc; we leave these unsorted. */
+#define Recurse(Trunc) \
+ { size_t l=last-ffirst,r=llast-first; \
+ if (l<Trunc) { \
+ if (r>=Trunc) doRight \
+ else pop \
+ } \
+ else if (l<=r) { pushLeft; doRight } \
+ else if (r>=Trunc) { pushRight; doLeft }\
+ else doLeft \
+ }
+
+/* and so is the pivoting logic (note: last is inclusive): */
+#define Pivot(swapper,sz) \
+ if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\
+ else { \
+ if (compare(first,mid)<0) { \
+ if (compare(mid,last)>0) { \
+ swapper(mid,last); \
+ if (compare(first,mid)>0) swapper(first,mid);\
+ } \
+ } \
+ else { \
+ if (compare(mid,last)>0) swapper(first,last)\
+ else { \
+ swapper(first,mid); \
+ if (compare(mid,last)>0) swapper(mid,last);\
+ } \
+ } \
+ first+=sz; last-=sz; \
+ }
+
+#ifdef DEBUG_QSORT
+#include <stdio.h>
+#endif
+
+/* and so is the partitioning logic: */
+#define Partition(swapper,sz) { \
+ do { \
+ while (compare(first,pivot)<0) first+=sz; \
+ while (compare(pivot,last)<0) last-=sz; \
+ if (first<last) { \
+ swapper(first,last); \
+ first+=sz; last-=sz; } \
+ else if (first==last) { first+=sz; last-=sz; break; }\
+ } while (first<=last); \
+}
+
+/* and so is the pre-insertion-sort operation of putting
+ * the smallest element into place as a sentinel.
+ * Doing this makes the inner loop nicer. I got this
+ * idea from the GNU implementation of qsort().
+ * We find the smallest element from the first |nmemb|,
+ * or the first |limit|, whichever is smaller;
+ * therefore we must have ensured that the globally smallest
+ * element is in the first |limit|.
+ */
+#define PreInsertion(swapper,limit,sz) \
+ first=base; \
+ last=first + ((nmemb>limit ? limit : nmemb)-1)*sz;\
+ while (last!=base) { \
+ if (compare(first,last)>0) first=last; \
+ last-=sz; } \
+ if (first!=base) swapper(first,(char*)base);
+
+/* and so is the insertion sort, in the first two cases: */
+#define Insertion(swapper) \
+ last=((char*)base)+nmemb*size; \
+ for (first=((char*)base)+size;first!=last;first+=size) { \
+ char *test; \
+ /* Find the right place for |first|. \
+ * My apologies for var reuse. */ \
+ for (test=first-size;compare(test,first)>0;test-=size) ; \
+ test+=size; \
+ if (test!=first) { \
+ /* Shift everything in [test,first) \
+ * up by one, and place |first| \
+ * where |test| is. */ \
+ memcpy(pivot,first,size); \
+ memmove(test+size,test,first-test); \
+ memcpy(test,pivot,size); \
+ } \
+ }
+
+#define SWAP_nonaligned(a,b) { \
+ register char *aa=(a),*bb=(b); \
+ register size_t sz=size; \
+ do { register char t=*aa; *aa++=*bb; *bb++=t; } while (--sz); }
+
+#define SWAP_aligned(a,b) { \
+ register int *aa=(int*)(a),*bb=(int*)(b); \
+ register size_t sz=size; \
+ do { register int t=*aa;*aa++=*bb; *bb++=t; } while (sz-=WORD_BYTES); }
+
+#define SWAP_words(a,b) { \
+ register int t=*((int*)a); *((int*)a)=*((int*)b); *((int*)b)=t; }
+
+/* ---------------------------------------------------------------------- */
+
+static char * pivot_big(char *first, char *mid, char *last, size_t size,
+ int compare(const void *, const void *)) {
+ size_t d=(((last-first)/size)>>3)*size;
+#ifdef DEBUG_QSORT
+fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size));
+#endif
+ char *m1,*m2,*m3;
+ { char *a=first, *b=first+d, *c=first+2*d;
+#ifdef DEBUG_QSORT
+fprintf(stderr,"< %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c);
+#endif
+ m1 = compare(a,b)<0 ?
+ (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a))
+ : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b));
+ }
+ { char *a=mid-d, *b=mid, *c=mid+d;
+#ifdef DEBUG_QSORT
+fprintf(stderr,". %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c);
+#endif
+ m2 = compare(a,b)<0 ?
+ (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a))
+ : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b));
+ }
+ { char *a=last-2*d, *b=last-d, *c=last;
+#ifdef DEBUG_QSORT
+fprintf(stderr,"> %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c);
+#endif
+ m3 = compare(a,b)<0 ?
+ (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a))
+ : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b));
+ }
+#ifdef DEBUG_QSORT
+fprintf(stderr,"-> %d %d %d @ %p %p %p\n",*(int*)m1,*(int*)m2,*(int*)m3, m1,m2,m3);
+#endif
+ return compare(m1,m2)<0 ?
+ (compare(m2,m3)<0 ? m2 : (compare(m1,m3)<0 ? m3 : m1))
+ : (compare(m1,m3)<0 ? m1 : (compare(m2,m3)<0 ? m3 : m2));
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void qsort_nonaligned(void *base, size_t nmemb, size_t size,
+ int (*compare)(const void *, const void *)) {
+
+ stack_entry stack[STACK_SIZE];
+ int stacktop=0;
+ char *first,*last;
+ char *pivot=malloc(size);
+ size_t trunc=TRUNC_nonaligned*size;
+ assert(pivot!=0);
+
+ first=(char*)base; last=first+(nmemb-1)*size;
+
+ if ((size_t)(last-first)>=trunc) {
+ char *ffirst=first, *llast=last;
+ while (1) {
+ /* Select pivot */
+ { char * mid=first+size*((last-first)/size >> 1);
+ Pivot(SWAP_nonaligned,size);
+ memcpy(pivot,mid,size);
+ }
+ /* Partition. */
+ Partition(SWAP_nonaligned,size);
+ /* Prepare to recurse/iterate. */
+ Recurse(trunc)
+ }
+ }
+ PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size);
+ Insertion(SWAP_nonaligned);
+ free(pivot);
+}
+
+static void qsort_aligned(void *base, size_t nmemb, size_t size,
+ int (*compare)(const void *, const void *)) {
+
+ stack_entry stack[STACK_SIZE];
+ int stacktop=0;
+ char *first,*last;
+ char *pivot=malloc(size);
+ size_t trunc=TRUNC_aligned*size;
+ assert(pivot!=0);
+
+ first=(char*)base; last=first+(nmemb-1)*size;
+
+ if ((size_t)(last-first)>=trunc) {
+ char *ffirst=first,*llast=last;
+ while (1) {
+ /* Select pivot */
+ { char * mid=first+size*((last-first)/size >> 1);
+ Pivot(SWAP_aligned,size);
+ memcpy(pivot,mid,size);
+ }
+ /* Partition. */
+ Partition(SWAP_aligned,size);
+ /* Prepare to recurse/iterate. */
+ Recurse(trunc)
+ }
+ }
+ PreInsertion(SWAP_aligned,TRUNC_aligned,size);
+ Insertion(SWAP_aligned);
+ free(pivot);
+}
+
+static void qsort_words(void *base, size_t nmemb,
+ int (*compare)(const void *, const void *)) {
+
+ stack_entry stack[STACK_SIZE];
+ int stacktop=0;
+ char *first,*last;
+ char *pivot=malloc(WORD_BYTES);
+ assert(pivot!=0);
+
+ first=(char*)base; last=first+(nmemb-1)*WORD_BYTES;
+
+ if (last-first>=TRUNC_words) {
+ char *ffirst=first, *llast=last;
+ while (1) {
+#ifdef DEBUG_QSORT
+fprintf(stderr,"Doing %d:%d: ",
+ (first-(char*)base)/WORD_BYTES,
+ (last-(char*)base)/WORD_BYTES);
+#endif
+ /* Select pivot */
+ { char * mid=first+WORD_BYTES*((last-first) / (2*WORD_BYTES));
+ Pivot(SWAP_words,WORD_BYTES);
+ *(int*)pivot=*(int*)mid;
+#ifdef DEBUG_QSORT
+fprintf(stderr,"pivot = %p = #%lu = %d\n", mid, (unsigned long)(((int*)mid)-((int*)base)), *(int*)mid);
+#endif
+ }
+ /* Partition. */
+ Partition(SWAP_words,WORD_BYTES);
+#ifdef DEBUG_QSORT
+fprintf(stderr, "after partitioning first=#%lu last=#%lu\n", (first-(char*)base)/4lu, (last-(char*)base)/4lu);
+#endif
+ /* Prepare to recurse/iterate. */
+ Recurse(TRUNC_words)
+ }
+ }
+ PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES),WORD_BYTES);
+ /* Now do insertion sort. */
+ last=((char*)base)+nmemb*WORD_BYTES;
+ for (first=((char*)base)+WORD_BYTES;first!=last;first+=WORD_BYTES) {
+ /* Find the right place for |first|. My apologies for var reuse */
+ int *pl=(int*)(first-WORD_BYTES),*pr=(int*)first;
+ *(int*)pivot=*(int*)first;
+ for (;compare(pl,pivot)>0;pr=pl,--pl) {
+ *pr=*pl; }
+ if (pr!=(int*)first) *pr=*(int*)pivot;
+ }
+ free(pivot);
+}
+
+/* ---------------------------------------------------------------------- */
+
+extern void qsortG(void *base, size_t nmemb, size_t size,
+ int (*compare)(const void *, const void *)) {
+
+ if (nmemb<=1) return;
+ if (((size_t)base|size)&(WORD_BYTES-1))
+ qsort_nonaligned(base,nmemb,size,compare);
+ else if (size!=WORD_BYTES)
+ qsort_aligned(base,nmemb,size,compare);
+ else
+ qsort_words(base,nmemb,compare);
+}
+
+
+#endif /* HAVE_QSORT */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/stdlib/SDL_stdlib.c b/src/3rdparty/SDL2/src/stdlib/SDL_stdlib.c
new file mode 100644
index 0000000..b36d83c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/stdlib/SDL_stdlib.c
@@ -0,0 +1,1131 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+/* This file contains portable stdlib functions for SDL */
+
+#include "SDL_stdinc.h"
+#include "../libm/math_libm.h"
+
+
+double
+SDL_atan(double x)
+{
+#if defined(HAVE_ATAN)
+ return atan(x);
+#else
+ return SDL_uclibc_atan(x);
+#endif
+}
+
+float
+SDL_atanf(float x)
+{
+#if defined(HAVE_ATANF)
+ return atanf(x);
+#else
+ return (float)SDL_atan((double)x);
+#endif
+}
+
+double
+SDL_atan2(double x, double y)
+{
+#if defined(HAVE_ATAN2)
+ return atan2(x, y);
+#else
+ return SDL_uclibc_atan2(x, y);
+#endif
+}
+
+float
+SDL_atan2f(float x, float y)
+{
+#if defined(HAVE_ATAN2F)
+ return atan2f(x, y);
+#else
+ return (float)SDL_atan2((double)x, (double)y);
+#endif
+}
+
+double
+SDL_acos(double val)
+{
+#if defined(HAVE_ACOS)
+ return acos(val);
+#else
+ double result;
+ if (val == -1.0) {
+ result = M_PI;
+ } else {
+ result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
+ if (result < 0.0)
+ {
+ result += M_PI;
+ }
+ }
+ return result;
+#endif
+}
+
+float
+SDL_acosf(float val)
+{
+#if defined(HAVE_ACOSF)
+ return acosf(val);
+#else
+ return (float)SDL_acos((double)val);
+#endif
+}
+
+double
+SDL_asin(double val)
+{
+#if defined(HAVE_ASIN)
+ return asin(val);
+#else
+ double result;
+ if (val == -1.0) {
+ result = -(M_PI / 2.0);
+ } else {
+ result = (M_PI / 2.0) - SDL_acos(val);
+ }
+ return result;
+#endif
+}
+
+float
+SDL_asinf(float val)
+{
+#if defined(HAVE_ASINF)
+ return asinf(val);
+#else
+ return (float)SDL_asin((double)val);
+#endif
+}
+
+double
+SDL_ceil(double x)
+{
+#if defined(HAVE_CEIL)
+ return ceil(x);
+#else
+ double integer = SDL_floor(x);
+ double fraction = x - integer;
+ if (fraction > 0.0) {
+ integer += 1.0;
+ }
+ return integer;
+#endif /* HAVE_CEIL */
+}
+
+float
+SDL_ceilf(float x)
+{
+#if defined(HAVE_CEILF)
+ return ceilf(x);
+#else
+ return (float)SDL_ceil((float)x);
+#endif
+}
+
+double
+SDL_copysign(double x, double y)
+{
+#if defined(HAVE_COPYSIGN)
+ return copysign(x, y);
+#elif defined(HAVE__COPYSIGN)
+ return _copysign(x, y);
+#elif defined(__WATCOMC__) && defined(__386__)
+ /* this is nasty as hell, but it works.. */
+ unsigned int *xi = (unsigned int *) &x,
+ *yi = (unsigned int *) &y;
+ xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff);
+ return x;
+#else
+ return SDL_uclibc_copysign(x, y);
+#endif /* HAVE_COPYSIGN */
+}
+
+float
+SDL_copysignf(float x, float y)
+{
+#if defined(HAVE_COPYSIGNF)
+ return copysignf(x, y);
+#else
+ return (float)SDL_copysign((double)x, (double)y);
+#endif
+}
+
+double
+SDL_cos(double x)
+{
+#if defined(HAVE_COS)
+ return cos(x);
+#else
+ return SDL_uclibc_cos(x);
+#endif
+}
+
+float
+SDL_cosf(float x)
+{
+#if defined(HAVE_COSF)
+ return cosf(x);
+#else
+ return (float)SDL_cos((double)x);
+#endif
+}
+
+double
+SDL_fabs(double x)
+{
+#if defined(HAVE_FABS)
+ return fabs(x);
+#else
+ return SDL_uclibc_fabs(x);
+#endif
+}
+
+float
+SDL_fabsf(float x)
+{
+#if defined(HAVE_FABSF)
+ return fabsf(x);
+#else
+ return (float)SDL_fabs((double)x);
+#endif
+}
+
+double
+SDL_floor(double x)
+{
+#if defined(HAVE_FLOOR)
+ return floor(x);
+#else
+ return SDL_uclibc_floor(x);
+#endif
+}
+
+float
+SDL_floorf(float x)
+{
+#if defined(HAVE_FLOORF)
+ return floorf(x);
+#else
+ return (float)SDL_floor((double)x);
+#endif
+}
+
+double
+SDL_fmod(double x, double y)
+{
+#if defined(HAVE_FMOD)
+ return fmod(x, y);
+#else
+ return SDL_uclibc_fmod(x, y);
+#endif
+}
+
+float
+SDL_fmodf(float x, float y)
+{
+#if defined(HAVE_FMODF)
+ return fmodf(x, y);
+#else
+ return (float)SDL_fmod((double)x, (double)y);
+#endif
+}
+
+double
+SDL_log(double x)
+{
+#if defined(HAVE_LOG)
+ return log(x);
+#else
+ return SDL_uclibc_log(x);
+#endif
+}
+
+float
+SDL_logf(float x)
+{
+#if defined(HAVE_LOGF)
+ return logf(x);
+#else
+ return (float)SDL_log((double)x);
+#endif
+}
+
+double
+SDL_log10(double x)
+{
+#if defined(HAVE_LOG10)
+ return log10(x);
+#else
+ return SDL_uclibc_log10(x);
+#endif
+}
+
+float
+SDL_log10f(float x)
+{
+#if defined(HAVE_LOG10F)
+ return log10f(x);
+#else
+ return (float)SDL_log10((double)x);
+#endif
+}
+
+double
+SDL_pow(double x, double y)
+{
+#if defined(HAVE_POW)
+ return pow(x, y);
+#else
+ return SDL_uclibc_pow(x, y);
+#endif
+}
+
+float
+SDL_powf(float x, float y)
+{
+#if defined(HAVE_POWF)
+ return powf(x, y);
+#else
+ return (float)SDL_pow((double)x, (double)y);
+#endif
+}
+
+double
+SDL_scalbn(double x, int n)
+{
+#if defined(HAVE_SCALBN)
+ return scalbn(x, n);
+#elif defined(HAVE__SCALB)
+ return _scalb(x, n);
+#elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2)
+/* from scalbn(3): If FLT_RADIX equals 2 (which is
+ * usual), then scalbn() is equivalent to ldexp(3). */
+ return ldexp(x, n);
+#else
+ return SDL_uclibc_scalbn(x, n);
+#endif
+}
+
+float
+SDL_scalbnf(float x, int n)
+{
+#if defined(HAVE_SCALBNF)
+ return scalbnf(x, n);
+#else
+ return (float)SDL_scalbn((double)x, n);
+#endif
+}
+
+double
+SDL_sin(double x)
+{
+#if defined(HAVE_SIN)
+ return sin(x);
+#else
+ return SDL_uclibc_sin(x);
+#endif
+}
+
+float
+SDL_sinf(float x)
+{
+#if defined(HAVE_SINF)
+ return sinf(x);
+#else
+ return (float)SDL_sin((double)x);
+#endif
+}
+
+double
+SDL_sqrt(double x)
+{
+#if defined(HAVE_SQRT)
+ return sqrt(x);
+#else
+ return SDL_uclibc_sqrt(x);
+#endif
+}
+
+float
+SDL_sqrtf(float x)
+{
+#if defined(HAVE_SQRTF)
+ return sqrtf(x);
+#else
+ return (float)SDL_sqrt((double)x);
+#endif
+}
+
+double
+SDL_tan(double x)
+{
+#if defined(HAVE_TAN)
+ return tan(x);
+#else
+ return SDL_uclibc_tan(x);
+#endif
+}
+
+float
+SDL_tanf(float x)
+{
+#if defined(HAVE_TANF)
+ return tanf(x);
+#else
+ return (float)SDL_tan((double)x);
+#endif
+}
+
+int SDL_abs(int x)
+{
+#if defined(HAVE_ABS)
+ return abs(x);
+#else
+ return ((x) < 0 ? -(x) : (x));
+#endif
+}
+
+#if defined(HAVE_CTYPE_H)
+int SDL_isdigit(int x) { return isdigit(x); }
+int SDL_isspace(int x) { return isspace(x); }
+int SDL_toupper(int x) { return toupper(x); }
+int SDL_tolower(int x) { return tolower(x); }
+#else
+int SDL_isdigit(int x) { return ((x) >= '0') && ((x) <= '9'); }
+int SDL_isspace(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n') || ((x) == '\f') || ((x) == '\v'); }
+int SDL_toupper(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
+int SDL_tolower(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
+#endif
+
+
+#ifndef HAVE_LIBC
+/* These are some C runtime intrinsics that need to be defined */
+
+#if defined(_MSC_VER)
+
+#ifndef __FLTUSED__
+#define __FLTUSED__
+__declspec(selectany) int _fltused = 1;
+#endif
+
+/* The optimizer on Visual Studio 2005 and later generates memcpy() calls */
+#if (_MSC_VER >= 1400) && defined(_WIN64) && !defined(_DEBUG) && !(_MSC_VER >= 1900 && defined(_MT))
+#include <intrin.h>
+
+#pragma function(memcpy)
+void * memcpy ( void * destination, const void * source, size_t num )
+{
+ const Uint8 *src = (const Uint8 *)source;
+ Uint8 *dst = (Uint8 *)destination;
+ size_t i;
+
+ /* All WIN64 architectures have SSE, right? */
+ if (!((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
+ __m128 values[4];
+ for (i = num / 64; i--;) {
+ _mm_prefetch(src, _MM_HINT_NTA);
+ values[0] = *(__m128 *) (src + 0);
+ values[1] = *(__m128 *) (src + 16);
+ values[2] = *(__m128 *) (src + 32);
+ values[3] = *(__m128 *) (src + 48);
+ _mm_stream_ps((float *) (dst + 0), values[0]);
+ _mm_stream_ps((float *) (dst + 16), values[1]);
+ _mm_stream_ps((float *) (dst + 32), values[2]);
+ _mm_stream_ps((float *) (dst + 48), values[3]);
+ src += 64;
+ dst += 64;
+ }
+ num &= 63;
+ }
+
+ while (num--) {
+ *dst++ = *src++;
+ }
+ return destination;
+}
+#endif /* _MSC_VER == 1600 && defined(_WIN64) && !defined(_DEBUG) */
+
+#ifdef _M_IX86
+
+/* Float to long */
+void
+__declspec(naked)
+_ftol()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebp
+ mov ebp,esp
+ sub esp,20h
+ and esp,0FFFFFFF0h
+ fld st(0)
+ fst dword ptr [esp+18h]
+ fistp qword ptr [esp+10h]
+ fild qword ptr [esp+10h]
+ mov edx,dword ptr [esp+18h]
+ mov eax,dword ptr [esp+10h]
+ test eax,eax
+ je integer_QnaN_or_zero
+arg_is_not_integer_QnaN:
+ fsubp st(1),st
+ test edx,edx
+ jns positive
+ fstp dword ptr [esp]
+ mov ecx,dword ptr [esp]
+ xor ecx,80000000h
+ add ecx,7FFFFFFFh
+ adc eax,0
+ mov edx,dword ptr [esp+14h]
+ adc edx,0
+ jmp localexit
+positive:
+ fstp dword ptr [esp]
+ mov ecx,dword ptr [esp]
+ add ecx,7FFFFFFFh
+ sbb eax,0
+ mov edx,dword ptr [esp+14h]
+ sbb edx,0
+ jmp localexit
+integer_QnaN_or_zero:
+ mov edx,dword ptr [esp+14h]
+ test edx,7FFFFFFFh
+ jne arg_is_not_integer_QnaN
+ fstp dword ptr [esp+18h]
+ fstp dword ptr [esp+18h]
+localexit:
+ leave
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+void
+_ftol2_sse()
+{
+ _ftol();
+}
+
+/* 64-bit math operators for 32-bit systems */
+void
+__declspec(naked)
+_allmul()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ mov eax, dword ptr[esp+8]
+ mov ecx, dword ptr[esp+10h]
+ or ecx, eax
+ mov ecx, dword ptr[esp+0Ch]
+ jne hard
+ mov eax, dword ptr[esp+4]
+ mul ecx
+ ret 10h
+hard:
+ push ebx
+ mul ecx
+ mov ebx, eax
+ mov eax, dword ptr[esp+8]
+ mul dword ptr[esp+14h]
+ add ebx, eax
+ mov eax, dword ptr[esp+8]
+ mul ecx
+ add edx, ebx
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_alldiv()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push edi
+ push esi
+ push ebx
+ xor edi,edi
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jge L1
+ inc edi
+ mov edx,dword ptr [esp+10h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+14h],eax
+ mov dword ptr [esp+10h],edx
+L1:
+ mov eax,dword ptr [esp+1Ch]
+ or eax,eax
+ jge L2
+ inc edi
+ mov edx,dword ptr [esp+18h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+1Ch],eax
+ mov dword ptr [esp+18h],edx
+L2:
+ or eax,eax
+ jne L3
+ mov ecx,dword ptr [esp+18h]
+ mov eax,dword ptr [esp+14h]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+10h]
+ div ecx
+ mov edx,ebx
+ jmp L4
+L3:
+ mov ebx,eax
+ mov ecx,dword ptr [esp+18h]
+ mov edx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+L5:
+ shr ebx,1
+ rcr ecx,1
+ shr edx,1
+ rcr eax,1
+ or ebx,ebx
+ jne L5
+ div ecx
+ mov esi,eax
+ mul dword ptr [esp+1Ch]
+ mov ecx,eax
+ mov eax,dword ptr [esp+18h]
+ mul esi
+ add edx,ecx
+ jb L6
+ cmp edx,dword ptr [esp+14h]
+ ja L6
+ jb L7
+ cmp eax,dword ptr [esp+10h]
+ jbe L7
+L6:
+ dec esi
+L7:
+ xor edx,edx
+ mov eax,esi
+L4:
+ dec edi
+ jne L8
+ neg edx
+ neg eax
+ sbb edx,0
+L8:
+ pop ebx
+ pop esi
+ pop edi
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aulldiv()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebx
+ push esi
+ mov eax,dword ptr [esp+18h]
+ or eax,eax
+ jne L1
+ mov ecx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+0Ch]
+ div ecx
+ mov edx,ebx
+ jmp L2
+L1:
+ mov ecx,eax
+ mov ebx,dword ptr [esp+14h]
+ mov edx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jne L3
+ div ebx
+ mov esi,eax
+ mul dword ptr [esp+18h]
+ mov ecx,eax
+ mov eax,dword ptr [esp+14h]
+ mul esi
+ add edx,ecx
+ jb L4
+ cmp edx,dword ptr [esp+10h]
+ ja L4
+ jb L5
+ cmp eax,dword ptr [esp+0Ch]
+ jbe L5
+L4:
+ dec esi
+L5:
+ xor edx,edx
+ mov eax,esi
+L2:
+ pop esi
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_allrem()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebx
+ push edi
+ xor edi,edi
+ mov eax,dword ptr [esp+10h]
+ or eax,eax
+ jge L1
+ inc edi
+ mov edx,dword ptr [esp+0Ch]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+10h],eax
+ mov dword ptr [esp+0Ch],edx
+L1:
+ mov eax,dword ptr [esp+18h]
+ or eax,eax
+ jge L2
+ mov edx,dword ptr [esp+14h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+18h],eax
+ mov dword ptr [esp+14h],edx
+L2:
+ or eax,eax
+ jne L3
+ mov ecx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+ xor edx,edx
+ div ecx
+ mov eax,dword ptr [esp+0Ch]
+ div ecx
+ mov eax,edx
+ xor edx,edx
+ dec edi
+ jns L4
+ jmp L8
+L3:
+ mov ebx,eax
+ mov ecx,dword ptr [esp+14h]
+ mov edx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+L5:
+ shr ebx,1
+ rcr ecx,1
+ shr edx,1
+ rcr eax,1
+ or ebx,ebx
+ jne L5
+ div ecx
+ mov ecx,eax
+ mul dword ptr [esp+18h]
+ xchg eax,ecx
+ mul dword ptr [esp+14h]
+ add edx,ecx
+ jb L6
+ cmp edx,dword ptr [esp+10h]
+ ja L6
+ jb L7
+ cmp eax,dword ptr [esp+0Ch]
+ jbe L7
+L6:
+ sub eax,dword ptr [esp+14h]
+ sbb edx,dword ptr [esp+18h]
+L7:
+ sub eax,dword ptr [esp+0Ch]
+ sbb edx,dword ptr [esp+10h]
+ dec edi
+ jns L8
+L4:
+ neg edx
+ neg eax
+ sbb edx,0
+L8:
+ pop edi
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aullrem()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebx
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jne L1
+ mov ecx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+ xor edx,edx
+ div ecx
+ mov eax,dword ptr [esp+8]
+ div ecx
+ mov eax,edx
+ xor edx,edx
+ jmp L2
+L1:
+ mov ecx,eax
+ mov ebx,dword ptr [esp+10h]
+ mov edx,dword ptr [esp+0Ch]
+ mov eax,dword ptr [esp+8]
+L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jne L3
+ div ebx
+ mov ecx,eax
+ mul dword ptr [esp+14h]
+ xchg eax,ecx
+ mul dword ptr [esp+10h]
+ add edx,ecx
+ jb L4
+ cmp edx,dword ptr [esp+0Ch]
+ ja L4
+ jb L5
+ cmp eax,dword ptr [esp+8]
+ jbe L5
+L4:
+ sub eax,dword ptr [esp+10h]
+ sbb edx,dword ptr [esp+14h]
+L5:
+ sub eax,dword ptr [esp+8]
+ sbb edx,dword ptr [esp+0Ch]
+ neg edx
+ neg eax
+ sbb edx,0
+L2:
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_alldvrm()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push edi
+ push esi
+ push ebp
+ xor edi,edi
+ xor ebp,ebp
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jge L1
+ inc edi
+ inc ebp
+ mov edx,dword ptr [esp+10h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+14h],eax
+ mov dword ptr [esp+10h],edx
+L1:
+ mov eax,dword ptr [esp+1Ch]
+ or eax,eax
+ jge L2
+ inc edi
+ mov edx,dword ptr [esp+18h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+1Ch],eax
+ mov dword ptr [esp+18h],edx
+L2:
+ or eax,eax
+ jne L3
+ mov ecx,dword ptr [esp+18h]
+ mov eax,dword ptr [esp+14h]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+10h]
+ div ecx
+ mov esi,eax
+ mov eax,ebx
+ mul dword ptr [esp+18h]
+ mov ecx,eax
+ mov eax,esi
+ mul dword ptr [esp+18h]
+ add edx,ecx
+ jmp L4
+L3:
+ mov ebx,eax
+ mov ecx,dword ptr [esp+18h]
+ mov edx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+L5:
+ shr ebx,1
+ rcr ecx,1
+ shr edx,1
+ rcr eax,1
+ or ebx,ebx
+ jne L5
+ div ecx
+ mov esi,eax
+ mul dword ptr [esp+1Ch]
+ mov ecx,eax
+ mov eax,dword ptr [esp+18h]
+ mul esi
+ add edx,ecx
+ jb L6
+ cmp edx,dword ptr [esp+14h]
+ ja L6
+ jb L7
+ cmp eax,dword ptr [esp+10h]
+ jbe L7
+L6:
+ dec esi
+ sub eax,dword ptr [esp+18h]
+ sbb edx,dword ptr [esp+1Ch]
+L7:
+ xor ebx,ebx
+L4:
+ sub eax,dword ptr [esp+10h]
+ sbb edx,dword ptr [esp+14h]
+ dec ebp
+ jns L9
+ neg edx
+ neg eax
+ sbb edx,0
+L9:
+ mov ecx,edx
+ mov edx,ebx
+ mov ebx,ecx
+ mov ecx,eax
+ mov eax,esi
+ dec edi
+ jne L8
+ neg edx
+ neg eax
+ sbb edx,0
+L8:
+ pop ebp
+ pop esi
+ pop edi
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aulldvrm()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push esi
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jne L1
+ mov ecx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+8]
+ div ecx
+ mov esi,eax
+ mov eax,ebx
+ mul dword ptr [esp+10h]
+ mov ecx,eax
+ mov eax,esi
+ mul dword ptr [esp+10h]
+ add edx,ecx
+ jmp L2
+L1:
+ mov ecx,eax
+ mov ebx,dword ptr [esp+10h]
+ mov edx,dword ptr [esp+0Ch]
+ mov eax,dword ptr [esp+8]
+L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jne L3
+ div ebx
+ mov esi,eax
+ mul dword ptr [esp+14h]
+ mov ecx,eax
+ mov eax,dword ptr [esp+10h]
+ mul esi
+ add edx,ecx
+ jb L4
+ cmp edx,dword ptr [esp+0Ch]
+ ja L4
+ jb L5
+ cmp eax,dword ptr [esp+8]
+ jbe L5
+L4:
+ dec esi
+ sub eax,dword ptr [esp+10h]
+ sbb edx,dword ptr [esp+14h]
+L5:
+ xor ebx,ebx
+L2:
+ sub eax,dword ptr [esp+8]
+ sbb edx,dword ptr [esp+0Ch]
+ neg edx
+ neg eax
+ sbb edx,0
+ mov ecx,edx
+ mov edx,ebx
+ mov ebx,ecx
+ mov ecx,eax
+ mov eax,esi
+ pop esi
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_allshl()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ cmp cl,40h
+ jae RETZERO
+ cmp cl,20h
+ jae MORE32
+ shld edx,eax,cl
+ shl eax,cl
+ ret
+MORE32:
+ mov edx,eax
+ xor eax,eax
+ and cl,1Fh
+ shl edx,cl
+ ret
+RETZERO:
+ xor eax,eax
+ xor edx,edx
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_allshr()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ cmp cl,3Fh
+ jae RETSIGN
+ cmp cl,20h
+ jae MORE32
+ shrd eax,edx,cl
+ sar edx,cl
+ ret
+MORE32:
+ mov eax,edx
+ sar edx,1Fh
+ and cl,1Fh
+ sar eax,cl
+ ret
+RETSIGN:
+ sar edx,1Fh
+ mov eax,edx
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aullshr()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ cmp cl,40h
+ jae RETZERO
+ cmp cl,20h
+ jae MORE32
+ shrd eax,edx,cl
+ shr edx,cl
+ ret
+MORE32:
+ mov eax,edx
+ xor edx,edx
+ and cl,1Fh
+ shr eax,cl
+ ret
+RETZERO:
+ xor eax,eax
+ xor edx,edx
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+#endif /* _M_IX86 */
+
+#endif /* MSC_VER */
+
+#endif /* !HAVE_LIBC */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/stdlib/SDL_string.c b/src/3rdparty/SDL2/src/stdlib/SDL_string.c
new file mode 100644
index 0000000..444ae6d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/stdlib/SDL_string.c
@@ -0,0 +1,1715 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#if defined(__clang_analyzer__)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+/* This file contains portable string manipulation functions for SDL */
+
+#include "SDL_stdinc.h"
+
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) || !defined(HAVE_STRTOD)
+#define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F'))
+#define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f'))
+#endif
+
+#define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4)
+#define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)
+
+static int UTF8_TrailingBytes(unsigned char c)
+{
+ if (c >= 0xC0 && c <= 0xDF)
+ return 1;
+ else if (c >= 0xE0 && c <= 0xEF)
+ return 2;
+ else if (c >= 0xF0 && c <= 0xF4)
+ return 3;
+ else
+ return 0;
+}
+
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL)
+static size_t
+SDL_ScanLong(const char *text, int radix, long *valuep)
+{
+ const char *textstart = text;
+ long value = 0;
+ SDL_bool negative = SDL_FALSE;
+
+ if (*text == '-') {
+ negative = SDL_TRUE;
+ ++text;
+ }
+ if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
+ text += 2;
+ }
+ for (;;) {
+ int v;
+ if (SDL_isdigit((unsigned char) *text)) {
+ v = *text - '0';
+ } else if (radix == 16 && SDL_isupperhex(*text)) {
+ v = 10 + (*text - 'A');
+ } else if (radix == 16 && SDL_islowerhex(*text)) {
+ v = 10 + (*text - 'a');
+ } else {
+ break;
+ }
+ value *= radix;
+ value += v;
+ ++text;
+ }
+ if (valuep && text > textstart) {
+ if (negative && value) {
+ *valuep = -value;
+ } else {
+ *valuep = value;
+ }
+ }
+ return (text - textstart);
+}
+#endif
+
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD)
+static size_t
+SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
+{
+ const char *textstart = text;
+ unsigned long value = 0;
+
+ if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
+ text += 2;
+ }
+ for (;;) {
+ int v;
+ if (SDL_isdigit((unsigned char) *text)) {
+ v = *text - '0';
+ } else if (radix == 16 && SDL_isupperhex(*text)) {
+ v = 10 + (*text - 'A');
+ } else if (radix == 16 && SDL_islowerhex(*text)) {
+ v = 10 + (*text - 'a');
+ } else {
+ break;
+ }
+ value *= radix;
+ value += v;
+ ++text;
+ }
+ if (valuep && text > textstart) {
+ *valuep = value;
+ }
+ return (text - textstart);
+}
+#endif
+
+#ifndef HAVE_VSSCANF
+static size_t
+SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep)
+{
+ const char *textstart = text;
+ uintptr_t value = 0;
+
+ if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
+ text += 2;
+ }
+ for (;;) {
+ int v;
+ if (SDL_isdigit((unsigned char) *text)) {
+ v = *text - '0';
+ } else if (radix == 16 && SDL_isupperhex(*text)) {
+ v = 10 + (*text - 'A');
+ } else if (radix == 16 && SDL_islowerhex(*text)) {
+ v = 10 + (*text - 'a');
+ } else {
+ break;
+ }
+ value *= radix;
+ value += v;
+ ++text;
+ }
+ if (valuep && text > textstart) {
+ *valuep = value;
+ }
+ return (text - textstart);
+}
+#endif
+
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOLL)
+static size_t
+SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep)
+{
+ const char *textstart = text;
+ Sint64 value = 0;
+ SDL_bool negative = SDL_FALSE;
+
+ if (*text == '-') {
+ negative = SDL_TRUE;
+ ++text;
+ }
+ if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
+ text += 2;
+ }
+ for (;;) {
+ int v;
+ if (SDL_isdigit((unsigned char) *text)) {
+ v = *text - '0';
+ } else if (radix == 16 && SDL_isupperhex(*text)) {
+ v = 10 + (*text - 'A');
+ } else if (radix == 16 && SDL_islowerhex(*text)) {
+ v = 10 + (*text - 'a');
+ } else {
+ break;
+ }
+ value *= radix;
+ value += v;
+ ++text;
+ }
+ if (valuep && text > textstart) {
+ if (negative && value) {
+ *valuep = -value;
+ } else {
+ *valuep = value;
+ }
+ }
+ return (text - textstart);
+}
+#endif
+
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOULL)
+static size_t
+SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep)
+{
+ const char *textstart = text;
+ Uint64 value = 0;
+
+ if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
+ text += 2;
+ }
+ for (;;) {
+ int v;
+ if (SDL_isdigit((unsigned char) *text)) {
+ v = *text - '0';
+ } else if (radix == 16 && SDL_isupperhex(*text)) {
+ v = 10 + (*text - 'A');
+ } else if (radix == 16 && SDL_islowerhex(*text)) {
+ v = 10 + (*text - 'a');
+ } else {
+ break;
+ }
+ value *= radix;
+ value += v;
+ ++text;
+ }
+ if (valuep && text > textstart) {
+ *valuep = value;
+ }
+ return (text - textstart);
+}
+#endif
+
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOD)
+static size_t
+SDL_ScanFloat(const char *text, double *valuep)
+{
+ const char *textstart = text;
+ unsigned long lvalue = 0;
+ double value = 0.0;
+ SDL_bool negative = SDL_FALSE;
+
+ if (*text == '-') {
+ negative = SDL_TRUE;
+ ++text;
+ }
+ text += SDL_ScanUnsignedLong(text, 10, &lvalue);
+ value += lvalue;
+ if (*text == '.') {
+ int mult = 10;
+ ++text;
+ while (SDL_isdigit((unsigned char) *text)) {
+ lvalue = *text - '0';
+ value += (double) lvalue / mult;
+ mult *= 10;
+ ++text;
+ }
+ }
+ if (valuep && text > textstart) {
+ if (negative && value) {
+ *valuep = -value;
+ } else {
+ *valuep = value;
+ }
+ }
+ return (text - textstart);
+}
+#endif
+
+void *
+SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
+{
+#if defined(HAVE_MEMSET)
+ return memset(dst, c, len);
+#else
+ size_t left;
+ Uint32 *dstp4;
+ Uint8 *dstp1 = (Uint8 *) dst;
+ Uint32 value4 = (c | (c << 8) | (c << 16) | (c << 24));
+ Uint8 value1 = (Uint8) c;
+
+ /* The destination pointer needs to be aligned on a 4-byte boundary to
+ * execute a 32-bit set. Set first bytes manually if needed until it is
+ * aligned. */
+ while ((intptr_t)dstp1 & 0x3) {
+ if (len--) {
+ *dstp1++ = value1;
+ } else {
+ return dst;
+ }
+ }
+
+ dstp4 = (Uint32 *) dstp1;
+ left = (len % 4);
+ len /= 4;
+ while (len--) {
+ *dstp4++ = value4;
+ }
+
+ dstp1 = (Uint8 *) dstp4;
+ switch (left) {
+ case 3:
+ *dstp1++ = value1;
+ case 2:
+ *dstp1++ = value1;
+ case 1:
+ *dstp1++ = value1;
+ }
+
+ return dst;
+#endif /* HAVE_MEMSET */
+}
+
+void *
+SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
+{
+#ifdef __GNUC__
+ /* Presumably this is well tuned for speed.
+ On my machine this is twice as fast as the C code below.
+ */
+ return __builtin_memcpy(dst, src, len);
+#elif defined(HAVE_MEMCPY)
+ return memcpy(dst, src, len);
+#elif defined(HAVE_BCOPY)
+ bcopy(src, dst, len);
+ return dst;
+#else
+ /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop
+ using Uint32* pointers, so we need to make sure the pointers are
+ aligned before we loop using them.
+ */
+ if (((intptr_t)src & 0x3) || ((intptr_t)dst & 0x3)) {
+ /* Do an unaligned byte copy */
+ Uint8 *srcp1 = (Uint8 *)src;
+ Uint8 *dstp1 = (Uint8 *)dst;
+
+ while (len--) {
+ *dstp1++ = *srcp1++;
+ }
+ } else {
+ size_t left = (len % 4);
+ Uint32 *srcp4, *dstp4;
+ Uint8 *srcp1, *dstp1;
+
+ srcp4 = (Uint32 *) src;
+ dstp4 = (Uint32 *) dst;
+ len /= 4;
+ while (len--) {
+ *dstp4++ = *srcp4++;
+ }
+
+ srcp1 = (Uint8 *) srcp4;
+ dstp1 = (Uint8 *) dstp4;
+ switch (left) {
+ case 3:
+ *dstp1++ = *srcp1++;
+ case 2:
+ *dstp1++ = *srcp1++;
+ case 1:
+ *dstp1++ = *srcp1++;
+ }
+ }
+ return dst;
+#endif /* __GNUC__ */
+}
+
+void *
+SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
+{
+#if defined(HAVE_MEMMOVE)
+ return memmove(dst, src, len);
+#else
+ char *srcp = (char *) src;
+ char *dstp = (char *) dst;
+
+ if (src < dst) {
+ srcp += len - 1;
+ dstp += len - 1;
+ while (len--) {
+ *dstp-- = *srcp--;
+ }
+ } else {
+ while (len--) {
+ *dstp++ = *srcp++;
+ }
+ }
+ return dst;
+#endif /* HAVE_MEMMOVE */
+}
+
+int
+SDL_memcmp(const void *s1, const void *s2, size_t len)
+{
+#if defined(HAVE_MEMCMP)
+ return memcmp(s1, s2, len);
+#else
+ char *s1p = (char *) s1;
+ char *s2p = (char *) s2;
+ while (len--) {
+ if (*s1p != *s2p) {
+ return (*s1p - *s2p);
+ }
+ ++s1p;
+ ++s2p;
+ }
+ return 0;
+#endif /* HAVE_MEMCMP */
+}
+
+size_t
+SDL_strlen(const char *string)
+{
+#if defined(HAVE_STRLEN)
+ return strlen(string);
+#else
+ size_t len = 0;
+ while (*string++) {
+ ++len;
+ }
+ return len;
+#endif /* HAVE_STRLEN */
+}
+
+size_t
+SDL_wcslen(const wchar_t * string)
+{
+#if defined(HAVE_WCSLEN)
+ return wcslen(string);
+#else
+ size_t len = 0;
+ while (*string++) {
+ ++len;
+ }
+ return len;
+#endif /* HAVE_WCSLEN */
+}
+
+size_t
+SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
+{
+#if defined(HAVE_WCSLCPY)
+ return wcslcpy(dst, src, maxlen);
+#else
+ size_t srclen = SDL_wcslen(src);
+ if (maxlen > 0) {
+ size_t len = SDL_min(srclen, maxlen - 1);
+ SDL_memcpy(dst, src, len * sizeof(wchar_t));
+ dst[len] = '\0';
+ }
+ return srclen;
+#endif /* HAVE_WCSLCPY */
+}
+
+size_t
+SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
+{
+#if defined(HAVE_WCSLCAT)
+ return wcslcat(dst, src, maxlen);
+#else
+ size_t dstlen = SDL_wcslen(dst);
+ size_t srclen = SDL_wcslen(src);
+ if (dstlen < maxlen) {
+ SDL_wcslcpy(dst + dstlen, src, maxlen - dstlen);
+ }
+ return dstlen + srclen;
+#endif /* HAVE_WCSLCAT */
+}
+
+int
+SDL_wcscmp(const wchar_t *str1, const wchar_t *str2)
+{
+#if defined(HAVE_WCSCMP)
+ return wcscmp(str1, str2);
+#else
+ while (*str1 && *str2) {
+ if (*str1 != *str2)
+ break;
+ ++str1;
+ ++str2;
+ }
+ return (int)(*str1 - *str2);
+#endif /* HAVE_WCSCMP */
+}
+
+size_t
+SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
+{
+#if defined(HAVE_STRLCPY)
+ return strlcpy(dst, src, maxlen);
+#else
+ size_t srclen = SDL_strlen(src);
+ if (maxlen > 0) {
+ size_t len = SDL_min(srclen, maxlen - 1);
+ SDL_memcpy(dst, src, len);
+ dst[len] = '\0';
+ }
+ return srclen;
+#endif /* HAVE_STRLCPY */
+}
+
+size_t
+SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)
+{
+ size_t src_bytes = SDL_strlen(src);
+ size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
+ size_t i = 0;
+ char trailing_bytes = 0;
+ if (bytes)
+ {
+ unsigned char c = (unsigned char)src[bytes - 1];
+ if (UTF8_IsLeadByte(c))
+ --bytes;
+ else if (UTF8_IsTrailingByte(c))
+ {
+ for (i = bytes - 1; i != 0; --i)
+ {
+ c = (unsigned char)src[i];
+ trailing_bytes = UTF8_TrailingBytes(c);
+ if (trailing_bytes)
+ {
+ if (bytes - i != trailing_bytes + 1)
+ bytes = i;
+
+ break;
+ }
+ }
+ }
+ SDL_memcpy(dst, src, bytes);
+ }
+ dst[bytes] = '\0';
+ return bytes;
+}
+
+size_t
+SDL_utf8strlen(const char *str)
+{
+ size_t retval = 0;
+ const char *p = str;
+ char ch;
+
+ while ((ch = *(p++))) {
+ /* if top two bits are 1 and 0, it's a continuation byte. */
+ if ((ch & 0xc0) != 0x80) {
+ retval++;
+ }
+ }
+
+ return retval;
+}
+
+size_t
+SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
+{
+#if defined(HAVE_STRLCAT)
+ return strlcat(dst, src, maxlen);
+#else
+ size_t dstlen = SDL_strlen(dst);
+ size_t srclen = SDL_strlen(src);
+ if (dstlen < maxlen) {
+ SDL_strlcpy(dst + dstlen, src, maxlen - dstlen);
+ }
+ return dstlen + srclen;
+#endif /* HAVE_STRLCAT */
+}
+
+char *
+SDL_strdup(const char *string)
+{
+ size_t len = SDL_strlen(string) + 1;
+ char *newstr = SDL_malloc(len);
+ if (newstr) {
+ SDL_memcpy(newstr, string, len);
+ }
+ return newstr;
+}
+
+char *
+SDL_strrev(char *string)
+{
+#if defined(HAVE__STRREV)
+ return _strrev(string);
+#else
+ size_t len = SDL_strlen(string);
+ char *a = &string[0];
+ char *b = &string[len - 1];
+ len /= 2;
+ while (len--) {
+ char c = *a;
+ *a++ = *b;
+ *b-- = c;
+ }
+ return string;
+#endif /* HAVE__STRREV */
+}
+
+char *
+SDL_strupr(char *string)
+{
+#if defined(HAVE__STRUPR)
+ return _strupr(string);
+#else
+ char *bufp = string;
+ while (*bufp) {
+ *bufp = SDL_toupper((unsigned char) *bufp);
+ ++bufp;
+ }
+ return string;
+#endif /* HAVE__STRUPR */
+}
+
+char *
+SDL_strlwr(char *string)
+{
+#if defined(HAVE__STRLWR)
+ return _strlwr(string);
+#else
+ char *bufp = string;
+ while (*bufp) {
+ *bufp = SDL_tolower((unsigned char) *bufp);
+ ++bufp;
+ }
+ return string;
+#endif /* HAVE__STRLWR */
+}
+
+char *
+SDL_strchr(const char *string, int c)
+{
+#ifdef HAVE_STRCHR
+ return SDL_const_cast(char*,strchr(string, c));
+#elif defined(HAVE_INDEX)
+ return SDL_const_cast(char*,index(string, c));
+#else
+ while (*string) {
+ if (*string == c) {
+ return (char *) string;
+ }
+ ++string;
+ }
+ return NULL;
+#endif /* HAVE_STRCHR */
+}
+
+char *
+SDL_strrchr(const char *string, int c)
+{
+#ifdef HAVE_STRRCHR
+ return SDL_const_cast(char*,strrchr(string, c));
+#elif defined(HAVE_RINDEX)
+ return SDL_const_cast(char*,rindex(string, c));
+#else
+ const char *bufp = string + SDL_strlen(string) - 1;
+ while (bufp >= string) {
+ if (*bufp == c) {
+ return (char *) bufp;
+ }
+ --bufp;
+ }
+ return NULL;
+#endif /* HAVE_STRRCHR */
+}
+
+char *
+SDL_strstr(const char *haystack, const char *needle)
+{
+#if defined(HAVE_STRSTR)
+ return SDL_const_cast(char*,strstr(haystack, needle));
+#else
+ size_t length = SDL_strlen(needle);
+ while (*haystack) {
+ if (SDL_strncmp(haystack, needle, length) == 0) {
+ return (char *) haystack;
+ }
+ ++haystack;
+ }
+ return NULL;
+#endif /* HAVE_STRSTR */
+}
+
+#if !defined(HAVE__LTOA) || !defined(HAVE__I64TOA) || \
+ !defined(HAVE__ULTOA) || !defined(HAVE__UI64TOA)
+static const char ntoa_table[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'Y', 'Z'
+};
+#endif /* ntoa() conversion table */
+
+char *
+SDL_itoa(int value, char *string, int radix)
+{
+#ifdef HAVE_ITOA
+ return itoa(value, string, radix);
+#else
+ return SDL_ltoa((long)value, string, radix);
+#endif /* HAVE_ITOA */
+}
+
+char *
+SDL_uitoa(unsigned int value, char *string, int radix)
+{
+#ifdef HAVE__UITOA
+ return _uitoa(value, string, radix);
+#else
+ return SDL_ultoa((unsigned long)value, string, radix);
+#endif /* HAVE__UITOA */
+}
+
+char *
+SDL_ltoa(long value, char *string, int radix)
+{
+#if defined(HAVE__LTOA)
+ return _ltoa(value, string, radix);
+#else
+ char *bufp = string;
+
+ if (value < 0) {
+ *bufp++ = '-';
+ SDL_ultoa(-value, bufp, radix);
+ } else {
+ SDL_ultoa(value, bufp, radix);
+ }
+
+ return string;
+#endif /* HAVE__LTOA */
+}
+
+char *
+SDL_ultoa(unsigned long value, char *string, int radix)
+{
+#if defined(HAVE__ULTOA)
+ return _ultoa(value, string, radix);
+#else
+ char *bufp = string;
+
+ if (value) {
+ while (value > 0) {
+ *bufp++ = ntoa_table[value % radix];
+ value /= radix;
+ }
+ } else {
+ *bufp++ = '0';
+ }
+ *bufp = '\0';
+
+ /* The numbers went into the string backwards. :) */
+ SDL_strrev(string);
+
+ return string;
+#endif /* HAVE__ULTOA */
+}
+
+char *
+SDL_lltoa(Sint64 value, char *string, int radix)
+{
+#if defined(HAVE__I64TOA)
+ return _i64toa(value, string, radix);
+#else
+ char *bufp = string;
+
+ if (value < 0) {
+ *bufp++ = '-';
+ SDL_ulltoa(-value, bufp, radix);
+ } else {
+ SDL_ulltoa(value, bufp, radix);
+ }
+
+ return string;
+#endif /* HAVE__I64TOA */
+}
+
+char *
+SDL_ulltoa(Uint64 value, char *string, int radix)
+{
+#if defined(HAVE__UI64TOA)
+ return _ui64toa(value, string, radix);
+#else
+ char *bufp = string;
+
+ if (value) {
+ while (value > 0) {
+ *bufp++ = ntoa_table[value % radix];
+ value /= radix;
+ }
+ } else {
+ *bufp++ = '0';
+ }
+ *bufp = '\0';
+
+ /* The numbers went into the string backwards. :) */
+ SDL_strrev(string);
+
+ return string;
+#endif /* HAVE__UI64TOA */
+}
+
+int SDL_atoi(const char *string)
+{
+#ifdef HAVE_ATOI
+ return atoi(string);
+#else
+ return SDL_strtol(string, NULL, 0);
+#endif /* HAVE_ATOI */
+}
+
+double SDL_atof(const char *string)
+{
+#ifdef HAVE_ATOF
+ return (double) atof(string);
+#else
+ return SDL_strtod(string, NULL);
+#endif /* HAVE_ATOF */
+}
+
+long
+SDL_strtol(const char *string, char **endp, int base)
+{
+#if defined(HAVE_STRTOL)
+ return strtol(string, endp, base);
+#else
+ size_t len;
+ long value = 0;
+
+ if (!base) {
+ if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
+ base = 16;
+ } else {
+ base = 10;
+ }
+ }
+
+ len = SDL_ScanLong(string, base, &value);
+ if (endp) {
+ *endp = (char *) string + len;
+ }
+ return value;
+#endif /* HAVE_STRTOL */
+}
+
+unsigned long
+SDL_strtoul(const char *string, char **endp, int base)
+{
+#if defined(HAVE_STRTOUL)
+ return strtoul(string, endp, base);
+#else
+ size_t len;
+ unsigned long value = 0;
+
+ if (!base) {
+ if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
+ base = 16;
+ } else {
+ base = 10;
+ }
+ }
+
+ len = SDL_ScanUnsignedLong(string, base, &value);
+ if (endp) {
+ *endp = (char *) string + len;
+ }
+ return value;
+#endif /* HAVE_STRTOUL */
+}
+
+Sint64
+SDL_strtoll(const char *string, char **endp, int base)
+{
+#if defined(HAVE_STRTOLL)
+ return strtoll(string, endp, base);
+#else
+ size_t len;
+ Sint64 value = 0;
+
+ if (!base) {
+ if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
+ base = 16;
+ } else {
+ base = 10;
+ }
+ }
+
+ len = SDL_ScanLongLong(string, base, &value);
+ if (endp) {
+ *endp = (char *) string + len;
+ }
+ return value;
+#endif /* HAVE_STRTOLL */
+}
+
+Uint64
+SDL_strtoull(const char *string, char **endp, int base)
+{
+#if defined(HAVE_STRTOULL)
+ return strtoull(string, endp, base);
+#else
+ size_t len;
+ Uint64 value = 0;
+
+ if (!base) {
+ if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
+ base = 16;
+ } else {
+ base = 10;
+ }
+ }
+
+ len = SDL_ScanUnsignedLongLong(string, base, &value);
+ if (endp) {
+ *endp = (char *) string + len;
+ }
+ return value;
+#endif /* HAVE_STRTOULL */
+}
+
+double
+SDL_strtod(const char *string, char **endp)
+{
+#if defined(HAVE_STRTOD)
+ return strtod(string, endp);
+#else
+ size_t len;
+ double value = 0.0;
+
+ len = SDL_ScanFloat(string, &value);
+ if (endp) {
+ *endp = (char *) string + len;
+ }
+ return value;
+#endif /* HAVE_STRTOD */
+}
+
+int
+SDL_strcmp(const char *str1, const char *str2)
+{
+#if defined(HAVE_STRCMP)
+ return strcmp(str1, str2);
+#else
+ while (*str1 && *str2) {
+ if (*str1 != *str2)
+ break;
+ ++str1;
+ ++str2;
+ }
+ return (int)((unsigned char) *str1 - (unsigned char) *str2);
+#endif /* HAVE_STRCMP */
+}
+
+int
+SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
+{
+#if defined(HAVE_STRNCMP)
+ return strncmp(str1, str2, maxlen);
+#else
+ while (*str1 && *str2 && maxlen) {
+ if (*str1 != *str2)
+ break;
+ ++str1;
+ ++str2;
+ --maxlen;
+ }
+ if (!maxlen) {
+ return 0;
+ }
+ return (int) ((unsigned char) *str1 - (unsigned char) *str2);
+#endif /* HAVE_STRNCMP */
+}
+
+int
+SDL_strcasecmp(const char *str1, const char *str2)
+{
+#ifdef HAVE_STRCASECMP
+ return strcasecmp(str1, str2);
+#elif defined(HAVE__STRICMP)
+ return _stricmp(str1, str2);
+#else
+ char a = 0;
+ char b = 0;
+ while (*str1 && *str2) {
+ a = SDL_toupper((unsigned char) *str1);
+ b = SDL_toupper((unsigned char) *str2);
+ if (a != b)
+ break;
+ ++str1;
+ ++str2;
+ }
+ a = SDL_toupper(*str1);
+ b = SDL_toupper(*str2);
+ return (int) ((unsigned char) a - (unsigned char) b);
+#endif /* HAVE_STRCASECMP */
+}
+
+int
+SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
+{
+#ifdef HAVE_STRNCASECMP
+ return strncasecmp(str1, str2, maxlen);
+#elif defined(HAVE__STRNICMP)
+ return _strnicmp(str1, str2, maxlen);
+#else
+ char a = 0;
+ char b = 0;
+ while (*str1 && *str2 && maxlen) {
+ a = SDL_tolower((unsigned char) *str1);
+ b = SDL_tolower((unsigned char) *str2);
+ if (a != b)
+ break;
+ ++str1;
+ ++str2;
+ --maxlen;
+ }
+ if (maxlen == 0) {
+ return 0;
+ } else {
+ a = SDL_tolower((unsigned char) *str1);
+ b = SDL_tolower((unsigned char) *str2);
+ return (int) ((unsigned char) a - (unsigned char) b);
+ }
+#endif /* HAVE_STRNCASECMP */
+}
+
+int
+SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...)
+{
+ int rc;
+ va_list ap;
+ va_start(ap, fmt);
+ rc = SDL_vsscanf(text, fmt, ap);
+ va_end(ap);
+ return rc;
+}
+
+#ifdef HAVE_VSSCANF
+int
+SDL_vsscanf(const char *text, const char *fmt, va_list ap)
+{
+ return vsscanf(text, fmt, ap);
+}
+#else
+int
+SDL_vsscanf(const char *text, const char *fmt, va_list ap)
+{
+ int retval = 0;
+
+ if (!text || !*text) {
+ return -1;
+ }
+
+ while (*fmt) {
+ if (*fmt == ' ') {
+ while (SDL_isspace((unsigned char) *text)) {
+ ++text;
+ }
+ ++fmt;
+ continue;
+ }
+ if (*fmt == '%') {
+ SDL_bool done = SDL_FALSE;
+ long count = 0;
+ int radix = 10;
+ enum
+ {
+ DO_SHORT,
+ DO_INT,
+ DO_LONG,
+ DO_LONGLONG
+ } inttype = DO_INT;
+ size_t advance;
+ SDL_bool suppress = SDL_FALSE;
+
+ ++fmt;
+ if (*fmt == '%') {
+ if (*text == '%') {
+ ++text;
+ ++fmt;
+ continue;
+ }
+ break;
+ }
+ if (*fmt == '*') {
+ suppress = SDL_TRUE;
+ ++fmt;
+ }
+ fmt += SDL_ScanLong(fmt, 10, &count);
+
+ if (*fmt == 'c') {
+ if (!count) {
+ count = 1;
+ }
+ if (suppress) {
+ while (count--) {
+ ++text;
+ }
+ } else {
+ char *valuep = va_arg(ap, char *);
+ while (count--) {
+ *valuep++ = *text++;
+ }
+ ++retval;
+ }
+ continue;
+ }
+
+ while (SDL_isspace((unsigned char) *text)) {
+ ++text;
+ }
+
+ /* FIXME: implement more of the format specifiers */
+ while (!done) {
+ switch (*fmt) {
+ case '*':
+ suppress = SDL_TRUE;
+ break;
+ case 'h':
+ if (inttype > DO_SHORT) {
+ ++inttype;
+ }
+ break;
+ case 'l':
+ if (inttype < DO_LONGLONG) {
+ ++inttype;
+ }
+ break;
+ case 'I':
+ if (SDL_strncmp(fmt, "I64", 3) == 0) {
+ fmt += 2;
+ inttype = DO_LONGLONG;
+ }
+ break;
+ case 'i':
+ {
+ int index = 0;
+ if (text[index] == '-') {
+ ++index;
+ }
+ if (text[index] == '0') {
+ if (SDL_tolower((unsigned char) text[index + 1]) == 'x') {
+ radix = 16;
+ } else {
+ radix = 8;
+ }
+ }
+ }
+ /* Fall through to %d handling */
+ case 'd':
+ if (inttype == DO_LONGLONG) {
+ Sint64 value;
+ advance = SDL_ScanLongLong(text, radix, &value);
+ text += advance;
+ if (advance && !suppress) {
+ Sint64 *valuep = va_arg(ap, Sint64 *);
+ *valuep = value;
+ ++retval;
+ }
+ } else {
+ long value;
+ advance = SDL_ScanLong(text, radix, &value);
+ text += advance;
+ if (advance && !suppress) {
+ switch (inttype) {
+ case DO_SHORT:
+ {
+ short *valuep = va_arg(ap, short *);
+ *valuep = (short) value;
+ }
+ break;
+ case DO_INT:
+ {
+ int *valuep = va_arg(ap, int *);
+ *valuep = (int) value;
+ }
+ break;
+ case DO_LONG:
+ {
+ long *valuep = va_arg(ap, long *);
+ *valuep = value;
+ }
+ break;
+ case DO_LONGLONG:
+ /* Handled above */
+ break;
+ }
+ ++retval;
+ }
+ }
+ done = SDL_TRUE;
+ break;
+ case 'o':
+ if (radix == 10) {
+ radix = 8;
+ }
+ /* Fall through to unsigned handling */
+ case 'x':
+ case 'X':
+ if (radix == 10) {
+ radix = 16;
+ }
+ /* Fall through to unsigned handling */
+ case 'u':
+ if (inttype == DO_LONGLONG) {
+ Uint64 value = 0;
+ advance = SDL_ScanUnsignedLongLong(text, radix, &value);
+ text += advance;
+ if (advance && !suppress) {
+ Uint64 *valuep = va_arg(ap, Uint64 *);
+ *valuep = value;
+ ++retval;
+ }
+ } else {
+ unsigned long value = 0;
+ advance = SDL_ScanUnsignedLong(text, radix, &value);
+ text += advance;
+ if (advance && !suppress) {
+ switch (inttype) {
+ case DO_SHORT:
+ {
+ short *valuep = va_arg(ap, short *);
+ *valuep = (short) value;
+ }
+ break;
+ case DO_INT:
+ {
+ int *valuep = va_arg(ap, int *);
+ *valuep = (int) value;
+ }
+ break;
+ case DO_LONG:
+ {
+ long *valuep = va_arg(ap, long *);
+ *valuep = value;
+ }
+ break;
+ case DO_LONGLONG:
+ /* Handled above */
+ break;
+ }
+ ++retval;
+ }
+ }
+ done = SDL_TRUE;
+ break;
+ case 'p':
+ {
+ uintptr_t value = 0;
+ advance = SDL_ScanUintPtrT(text, 16, &value);
+ text += advance;
+ if (advance && !suppress) {
+ void **valuep = va_arg(ap, void **);
+ *valuep = (void *) value;
+ ++retval;
+ }
+ }
+ done = SDL_TRUE;
+ break;
+ case 'f':
+ {
+ double value;
+ advance = SDL_ScanFloat(text, &value);
+ text += advance;
+ if (advance && !suppress) {
+ float *valuep = va_arg(ap, float *);
+ *valuep = (float) value;
+ ++retval;
+ }
+ }
+ done = SDL_TRUE;
+ break;
+ case 's':
+ if (suppress) {
+ while (!SDL_isspace((unsigned char) *text)) {
+ ++text;
+ if (count) {
+ if (--count == 0) {
+ break;
+ }
+ }
+ }
+ } else {
+ char *valuep = va_arg(ap, char *);
+ while (!SDL_isspace((unsigned char) *text)) {
+ *valuep++ = *text++;
+ if (count) {
+ if (--count == 0) {
+ break;
+ }
+ }
+ }
+ *valuep = '\0';
+ ++retval;
+ }
+ done = SDL_TRUE;
+ break;
+ default:
+ done = SDL_TRUE;
+ break;
+ }
+ ++fmt;
+ }
+ continue;
+ }
+ if (*text == *fmt) {
+ ++text;
+ ++fmt;
+ continue;
+ }
+ /* Text didn't match format specifier */
+ break;
+ }
+
+ return retval;
+}
+#endif /* HAVE_VSSCANF */
+
+int
+SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list ap;
+ int retval;
+
+ va_start(ap, fmt);
+ retval = SDL_vsnprintf(text, maxlen, fmt, ap);
+ va_end(ap);
+
+ return retval;
+}
+
+#ifdef HAVE_VSNPRINTF
+int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
+{
+ if (!fmt) {
+ fmt = "";
+ }
+ return vsnprintf(text, maxlen, fmt, ap);
+}
+#else
+ /* FIXME: implement more of the format specifiers */
+typedef enum
+{
+ SDL_CASE_NOCHANGE,
+ SDL_CASE_LOWER,
+ SDL_CASE_UPPER
+} SDL_letter_case;
+
+typedef struct
+{
+ SDL_bool left_justify;
+ SDL_bool force_sign;
+ SDL_bool force_type;
+ SDL_bool pad_zeroes;
+ SDL_letter_case force_case;
+ int width;
+ int radix;
+ int precision;
+} SDL_FormatInfo;
+
+static size_t
+SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
+{
+ size_t length = 0;
+ size_t slen;
+
+ if (string == NULL) {
+ string = "(null)";
+ }
+
+ if (info && info->width && (size_t)info->width > SDL_strlen(string)) {
+ char fill = info->pad_zeroes ? '0' : ' ';
+ size_t width = info->width - SDL_strlen(string);
+ while (width-- > 0 && maxlen > 0) {
+ *text++ = fill;
+ ++length;
+ --maxlen;
+ }
+ }
+
+ slen = SDL_strlcpy(text, string, maxlen);
+ length += SDL_min(slen, maxlen);
+
+ if (info) {
+ if (info->force_case == SDL_CASE_LOWER) {
+ SDL_strlwr(text);
+ } else if (info->force_case == SDL_CASE_UPPER) {
+ SDL_strupr(text);
+ }
+ }
+ return length;
+}
+
+static size_t
+SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
+{
+ char num[130];
+
+ SDL_ltoa(value, num, info ? info->radix : 10);
+ return SDL_PrintString(text, maxlen, info, num);
+}
+
+static size_t
+SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
+{
+ char num[130];
+
+ SDL_ultoa(value, num, info ? info->radix : 10);
+ return SDL_PrintString(text, maxlen, info, num);
+}
+
+static size_t
+SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
+{
+ char num[130];
+
+ SDL_lltoa(value, num, info ? info->radix : 10);
+ return SDL_PrintString(text, maxlen, info, num);
+}
+
+static size_t
+SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
+{
+ char num[130];
+
+ SDL_ulltoa(value, num, info ? info->radix : 10);
+ return SDL_PrintString(text, maxlen, info, num);
+}
+
+static size_t
+SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
+{
+ int width;
+ size_t len;
+ size_t left = maxlen;
+ char *textstart = text;
+
+ if (arg) {
+ /* This isn't especially accurate, but hey, it's easy. :) */
+ unsigned long value;
+
+ if (arg < 0) {
+ if (left > 1) {
+ *text = '-';
+ --left;
+ }
+ ++text;
+ arg = -arg;
+ } else if (info->force_sign) {
+ if (left > 1) {
+ *text = '+';
+ --left;
+ }
+ ++text;
+ }
+ value = (unsigned long) arg;
+ len = SDL_PrintUnsignedLong(text, left, NULL, value);
+ if (len >= left) {
+ text += (left > 1) ? left - 1 : 0;
+ left = SDL_min(left, 1);
+ } else {
+ text += len;
+ left -= len;
+ }
+ arg -= value;
+ if (info->precision < 0) {
+ info->precision = 6;
+ }
+ if (info->force_type || info->precision > 0) {
+ int mult = 10;
+ if (left > 1) {
+ *text = '.';
+ --left;
+ }
+ ++text;
+ while (info->precision-- > 0) {
+ value = (unsigned long) (arg * mult);
+ len = SDL_PrintUnsignedLong(text, left, NULL, value);
+ if (len >= left) {
+ text += (left > 1) ? left - 1 : 0;
+ left = SDL_min(left, 1);
+ } else {
+ text += len;
+ left -= len;
+ }
+ arg -= (double) value / mult;
+ mult *= 10;
+ }
+ }
+ } else {
+ if (left > 1) {
+ *text = '0';
+ --left;
+ }
+ ++text;
+ if (info->force_type) {
+ if (left > 1) {
+ *text = '.';
+ --left;
+ }
+ ++text;
+ }
+ }
+
+ width = info->width - (int)(text - textstart);
+ if (width > 0) {
+ char fill = info->pad_zeroes ? '0' : ' ';
+ char *end = text+left-1;
+ len = (text - textstart);
+ for (len = (text - textstart); len--; ) {
+ if ((textstart+len+width) < end) {
+ *(textstart+len+width) = *(textstart+len);
+ }
+ }
+ len = (size_t)width;
+ if (len >= left) {
+ text += (left > 1) ? left - 1 : 0;
+ left = SDL_min(left, 1);
+ } else {
+ text += len;
+ left -= len;
+ }
+ while (len--) {
+ if (textstart+len < end) {
+ textstart[len] = fill;
+ }
+ }
+ }
+
+ return (text - textstart);
+}
+
+int
+SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
+{
+ size_t left = maxlen;
+ char *textstart = text;
+
+ if (!fmt) {
+ fmt = "";
+ }
+ while (*fmt && left > 1) {
+ if (*fmt == '%') {
+ SDL_bool done = SDL_FALSE;
+ size_t len = 0;
+ SDL_bool check_flag;
+ SDL_FormatInfo info;
+ enum
+ {
+ DO_INT,
+ DO_LONG,
+ DO_LONGLONG
+ } inttype = DO_INT;
+
+ SDL_zero(info);
+ info.radix = 10;
+ info.precision = -1;
+
+ check_flag = SDL_TRUE;
+ while (check_flag) {
+ ++fmt;
+ switch (*fmt) {
+ case '-':
+ info.left_justify = SDL_TRUE;
+ break;
+ case '+':
+ info.force_sign = SDL_TRUE;
+ break;
+ case '#':
+ info.force_type = SDL_TRUE;
+ break;
+ case '0':
+ info.pad_zeroes = SDL_TRUE;
+ break;
+ default:
+ check_flag = SDL_FALSE;
+ break;
+ }
+ }
+
+ if (*fmt >= '0' && *fmt <= '9') {
+ info.width = SDL_strtol(fmt, (char **)&fmt, 0);
+ }
+
+ if (*fmt == '.') {
+ ++fmt;
+ if (*fmt >= '0' && *fmt <= '9') {
+ info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
+ } else {
+ info.precision = 0;
+ }
+ }
+
+ while (!done) {
+ switch (*fmt) {
+ case '%':
+ if (left > 1) {
+ *text = '%';
+ }
+ len = 1;
+ done = SDL_TRUE;
+ break;
+ case 'c':
+ /* char is promoted to int when passed through (...) */
+ if (left > 1) {
+ *text = (char) va_arg(ap, int);
+ }
+ len = 1;
+ done = SDL_TRUE;
+ break;
+ case 'h':
+ /* short is promoted to int when passed through (...) */
+ break;
+ case 'l':
+ if (inttype < DO_LONGLONG) {
+ ++inttype;
+ }
+ break;
+ case 'I':
+ if (SDL_strncmp(fmt, "I64", 3) == 0) {
+ fmt += 2;
+ inttype = DO_LONGLONG;
+ }
+ break;
+ case 'i':
+ case 'd':
+ switch (inttype) {
+ case DO_INT:
+ len = SDL_PrintLong(text, left, &info,
+ (long) va_arg(ap, int));
+ break;
+ case DO_LONG:
+ len = SDL_PrintLong(text, left, &info,
+ va_arg(ap, long));
+ break;
+ case DO_LONGLONG:
+ len = SDL_PrintLongLong(text, left, &info,
+ va_arg(ap, Sint64));
+ break;
+ }
+ done = SDL_TRUE;
+ break;
+ case 'p':
+ case 'x':
+ info.force_case = SDL_CASE_LOWER;
+ /* Fall through to 'X' handling */
+ case 'X':
+ if (info.force_case == SDL_CASE_NOCHANGE) {
+ info.force_case = SDL_CASE_UPPER;
+ }
+ if (info.radix == 10) {
+ info.radix = 16;
+ }
+ if (*fmt == 'p') {
+ inttype = DO_LONG;
+ }
+ /* Fall through to unsigned handling */
+ case 'o':
+ if (info.radix == 10) {
+ info.radix = 8;
+ }
+ /* Fall through to unsigned handling */
+ case 'u':
+ info.pad_zeroes = SDL_TRUE;
+ switch (inttype) {
+ case DO_INT:
+ len = SDL_PrintUnsignedLong(text, left, &info,
+ (unsigned long)
+ va_arg(ap, unsigned int));
+ break;
+ case DO_LONG:
+ len = SDL_PrintUnsignedLong(text, left, &info,
+ va_arg(ap, unsigned long));
+ break;
+ case DO_LONGLONG:
+ len = SDL_PrintUnsignedLongLong(text, left, &info,
+ va_arg(ap, Uint64));
+ break;
+ }
+ done = SDL_TRUE;
+ break;
+ case 'f':
+ len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
+ done = SDL_TRUE;
+ break;
+ case 'S':
+ {
+ /* In practice this is used on Windows for WCHAR strings */
+ wchar_t *wide_arg = va_arg(ap, wchar_t *);
+ char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
+ len = SDL_PrintString(text, left, &info, arg);
+ SDL_free(arg);
+ done = SDL_TRUE;
+ }
+ break;
+ case 's':
+ len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
+ done = SDL_TRUE;
+ break;
+ default:
+ done = SDL_TRUE;
+ break;
+ }
+ ++fmt;
+ }
+ if (len >= left) {
+ text += (left > 1) ? left - 1 : 0;
+ left = SDL_min(left, 1);
+ } else {
+ text += len;
+ left -= len;
+ }
+ } else {
+ *text++ = *fmt++;
+ --left;
+ }
+ }
+ if (left > 0) {
+ *text = '\0';
+ }
+ return (int)(text - textstart);
+}
+#endif /* HAVE_VSNPRINTF */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_assert.c b/src/3rdparty/SDL2/src/test/SDL_test_assert.c
new file mode 100644
index 0000000..4b57285
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_assert.c
@@ -0,0 +1,152 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+
+ Used by the test framework and test cases.
+
+*/
+
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* Assert check message format */
+#define SDLTEST_ASSERT_CHECK_FORMAT "Assert '%s': %s"
+
+/* Assert summary message format */
+#define SDLTEST_ASSERT_SUMMARY_FORMAT "Assert Summary: Total=%d Passed=%d Failed=%d"
+
+/* ! \brief counts the failed asserts */
+static Uint32 SDLTest_AssertsFailed = 0;
+
+/* ! \brief counts the passed asserts */
+static Uint32 SDLTest_AssertsPassed = 0;
+
+/*
+ * Assert that logs and break execution flow on failures (i.e. for harness errors).
+ */
+void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...)
+{
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print assert description into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, assertDescription);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
+ va_end(list);
+
+ /* Log, then assert and break on failure */
+ SDL_assert((SDLTest_AssertCheck(assertCondition, "%s", logMessage)));
+}
+
+/*
+ * Assert that logs but does not break execution flow on failures (i.e. for test cases).
+ */
+int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...)
+{
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print assert description into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, assertDescription);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
+ va_end(list);
+
+ /* Log pass or fail message */
+ if (assertCondition == ASSERT_FAIL)
+ {
+ SDLTest_AssertsFailed++;
+ SDLTest_LogError(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Failed");
+ }
+ else
+ {
+ SDLTest_AssertsPassed++;
+ SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Passed");
+ }
+
+ return assertCondition;
+}
+
+/*
+ * Explicitly passing Assert that logs (i.e. for test cases).
+ */
+void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...)
+{
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print assert description into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, assertDescription);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
+ va_end(list);
+
+ /* Log pass message */
+ SDLTest_AssertsPassed++;
+ SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Pass");
+}
+
+/*
+ * Resets the assert summary counters to zero.
+ */
+void SDLTest_ResetAssertSummary()
+{
+ SDLTest_AssertsPassed = 0;
+ SDLTest_AssertsFailed = 0;
+}
+
+/*
+ * Logs summary of all assertions (total, pass, fail) since last reset
+ * as INFO (failed==0) or ERROR (failed > 0).
+ */
+void SDLTest_LogAssertSummary()
+{
+ Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
+ if (SDLTest_AssertsFailed == 0)
+ {
+ SDLTest_Log(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
+ }
+ else
+ {
+ SDLTest_LogError(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
+ }
+}
+
+/*
+ * Converts the current assert state into a test result
+ */
+int SDLTest_AssertSummaryToTestResult()
+{
+ if (SDLTest_AssertsFailed > 0) {
+ return TEST_RESULT_FAILED;
+ } else {
+ if (SDLTest_AssertsPassed > 0) {
+ return TEST_RESULT_PASSED;
+ } else {
+ return TEST_RESULT_NO_ASSERT;
+ }
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_common.c b/src/3rdparty/SDL2/src/test/SDL_test_common.c
new file mode 100644
index 0000000..b7e294a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_common.c
@@ -0,0 +1,1783 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* Ported from original test\common.c file. */
+
+#include "SDL_config.h"
+#include "SDL_test.h"
+
+#include <stdio.h>
+
+#define VIDEO_USAGE \
+"[--video driver] [--renderer driver] [--gldebug] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--min-geometry WxH] [--max-geometry WxH] [--logical WxH] [--scale N] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--allow-highdpi]"
+
+#define AUDIO_USAGE \
+"[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
+
+static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... )
+{
+ size_t length = SDL_strlen(text);
+ va_list ap;
+
+ va_start(ap, fmt);
+ text += length;
+ maxlen -= length;
+ SDL_vsnprintf(text, maxlen, fmt, ap);
+ va_end(ap);
+}
+
+SDLTest_CommonState *
+SDLTest_CommonCreateState(char **argv, Uint32 flags)
+{
+ int i;
+ SDLTest_CommonState *state;
+
+ /* Do this first so we catch all allocations */
+ for (i = 1; argv[i]; ++i) {
+ if (SDL_strcasecmp(argv[i], "--trackmem") == 0) {
+ SDLTest_TrackAllocations();
+ break;
+ }
+ }
+
+ state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state));
+ if (!state) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize some defaults */
+ state->argv = argv;
+ state->flags = flags;
+ state->window_title = argv[0];
+ state->window_flags = 0;
+ state->window_x = SDL_WINDOWPOS_UNDEFINED;
+ state->window_y = SDL_WINDOWPOS_UNDEFINED;
+ state->window_w = DEFAULT_WINDOW_WIDTH;
+ state->window_h = DEFAULT_WINDOW_HEIGHT;
+ state->num_windows = 1;
+ state->audiospec.freq = 22050;
+ state->audiospec.format = AUDIO_S16;
+ state->audiospec.channels = 2;
+ state->audiospec.samples = 2048;
+
+ /* Set some very sane GL defaults */
+ state->gl_red_size = 3;
+ state->gl_green_size = 3;
+ state->gl_blue_size = 2;
+ state->gl_alpha_size = 0;
+ state->gl_buffer_size = 0;
+ state->gl_depth_size = 16;
+ state->gl_stencil_size = 0;
+ state->gl_double_buffer = 1;
+ state->gl_accum_red_size = 0;
+ state->gl_accum_green_size = 0;
+ state->gl_accum_blue_size = 0;
+ state->gl_accum_alpha_size = 0;
+ state->gl_stereo = 0;
+ state->gl_multisamplebuffers = 0;
+ state->gl_multisamplesamples = 0;
+ state->gl_retained_backing = 1;
+ state->gl_accelerated = -1;
+ state->gl_debug = 0;
+
+ return state;
+}
+
+int
+SDLTest_CommonArg(SDLTest_CommonState * state, int index)
+{
+ char **argv = state->argv;
+
+ if (SDL_strcasecmp(argv[index], "--video") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->videodriver = argv[index];
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--renderer") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->renderdriver = argv[index];
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--gldebug") == 0) {
+ state->gl_debug = 1;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--info") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ if (SDL_strcasecmp(argv[index], "all") == 0) {
+ state->verbose |=
+ (VERBOSE_VIDEO | VERBOSE_MODES | VERBOSE_RENDER |
+ VERBOSE_EVENT);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "video") == 0) {
+ state->verbose |= VERBOSE_VIDEO;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "modes") == 0) {
+ state->verbose |= VERBOSE_MODES;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "render") == 0) {
+ state->verbose |= VERBOSE_RENDER;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "event") == 0) {
+ state->verbose |= VERBOSE_EVENT;
+ return 2;
+ }
+ return -1;
+ }
+ if (SDL_strcasecmp(argv[index], "--log") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ if (SDL_strcasecmp(argv[index], "all") == 0) {
+ SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "error") == 0) {
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "system") == 0) {
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "audio") == 0) {
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "video") == 0) {
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "render") == 0) {
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "input") == 0) {
+ SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
+ return 2;
+ }
+ return -1;
+ }
+ if (SDL_strcasecmp(argv[index], "--display") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->display = SDL_atoi(argv[index]);
+ if (SDL_WINDOWPOS_ISUNDEFINED(state->window_x)) {
+ state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
+ state->window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
+ }
+ if (SDL_WINDOWPOS_ISCENTERED(state->window_x)) {
+ state->window_x = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
+ state->window_y = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
+ }
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
+ state->window_flags |= SDL_WINDOW_FULLSCREEN;
+ state->num_windows = 1;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
+ state->window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+ state->num_windows = 1;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--allow-highdpi") == 0) {
+ state->window_flags |= SDL_WINDOW_ALLOW_HIGHDPI;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--windows") == 0) {
+ ++index;
+ if (!argv[index] || !SDL_isdigit(*argv[index])) {
+ return -1;
+ }
+ if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
+ state->num_windows = SDL_atoi(argv[index]);
+ }
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--title") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->window_title = argv[index];
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--icon") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->window_icon = argv[index];
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--center") == 0) {
+ state->window_x = SDL_WINDOWPOS_CENTERED;
+ state->window_y = SDL_WINDOWPOS_CENTERED;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--position") == 0) {
+ char *x, *y;
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ x = argv[index];
+ y = argv[index];
+ while (*y && *y != ',') {
+ ++y;
+ }
+ if (!*y) {
+ return -1;
+ }
+ *y++ = '\0';
+ state->window_x = SDL_atoi(x);
+ state->window_y = SDL_atoi(y);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--geometry") == 0) {
+ char *w, *h;
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ w = argv[index];
+ h = argv[index];
+ while (*h && *h != 'x') {
+ ++h;
+ }
+ if (!*h) {
+ return -1;
+ }
+ *h++ = '\0';
+ state->window_w = SDL_atoi(w);
+ state->window_h = SDL_atoi(h);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) {
+ char *w, *h;
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ w = argv[index];
+ h = argv[index];
+ while (*h && *h != 'x') {
+ ++h;
+ }
+ if (!*h) {
+ return -1;
+ }
+ *h++ = '\0';
+ state->window_minW = SDL_atoi(w);
+ state->window_minH = SDL_atoi(h);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) {
+ char *w, *h;
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ w = argv[index];
+ h = argv[index];
+ while (*h && *h != 'x') {
+ ++h;
+ }
+ if (!*h) {
+ return -1;
+ }
+ *h++ = '\0';
+ state->window_maxW = SDL_atoi(w);
+ state->window_maxH = SDL_atoi(h);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--logical") == 0) {
+ char *w, *h;
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ w = argv[index];
+ h = argv[index];
+ while (*h && *h != 'x') {
+ ++h;
+ }
+ if (!*h) {
+ return -1;
+ }
+ *h++ = '\0';
+ state->logical_w = SDL_atoi(w);
+ state->logical_h = SDL_atoi(h);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--scale") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->scale = (float)SDL_atof(argv[index]);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--depth") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->depth = SDL_atoi(argv[index]);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--refresh") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->refresh_rate = SDL_atoi(argv[index]);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
+ state->render_flags |= SDL_RENDERER_PRESENTVSYNC;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--noframe") == 0) {
+ state->window_flags |= SDL_WINDOW_BORDERLESS;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--resize") == 0) {
+ state->window_flags |= SDL_WINDOW_RESIZABLE;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--minimize") == 0) {
+ state->window_flags |= SDL_WINDOW_MINIMIZED;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--maximize") == 0) {
+ state->window_flags |= SDL_WINDOW_MAXIMIZED;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--grab") == 0) {
+ state->window_flags |= SDL_WINDOW_INPUT_GRABBED;
+ return 1;
+ }
+ if (SDL_strcasecmp(argv[index], "--rate") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->audiospec.freq = SDL_atoi(argv[index]);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--format") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ if (SDL_strcasecmp(argv[index], "U8") == 0) {
+ state->audiospec.format = AUDIO_U8;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "S8") == 0) {
+ state->audiospec.format = AUDIO_S8;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "U16") == 0) {
+ state->audiospec.format = AUDIO_U16;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "U16LE") == 0) {
+ state->audiospec.format = AUDIO_U16LSB;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "U16BE") == 0) {
+ state->audiospec.format = AUDIO_U16MSB;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "S16") == 0) {
+ state->audiospec.format = AUDIO_S16;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "S16LE") == 0) {
+ state->audiospec.format = AUDIO_S16LSB;
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "S16BE") == 0) {
+ state->audiospec.format = AUDIO_S16MSB;
+ return 2;
+ }
+ return -1;
+ }
+ if (SDL_strcasecmp(argv[index], "--channels") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->audiospec.channels = (Uint8) SDL_atoi(argv[index]);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--samples") == 0) {
+ ++index;
+ if (!argv[index]) {
+ return -1;
+ }
+ state->audiospec.samples = (Uint16) SDL_atoi(argv[index]);
+ return 2;
+ }
+ if (SDL_strcasecmp(argv[index], "--trackmem") == 0) {
+ /* Already handled in SDLTest_CommonCreateState() */
+ return 1;
+ }
+ if ((SDL_strcasecmp(argv[index], "-h") == 0)
+ || (SDL_strcasecmp(argv[index], "--help") == 0)) {
+ /* Print the usage message */
+ return -1;
+ }
+ if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
+ /* Debug flag sent by Xcode */
+ return 2;
+ }
+ return 0;
+}
+
+const char *
+SDLTest_CommonUsage(SDLTest_CommonState * state)
+{
+ switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
+ case SDL_INIT_VIDEO:
+ return "[--trackmem] " VIDEO_USAGE;
+ case SDL_INIT_AUDIO:
+ return "[--trackmem] " AUDIO_USAGE;
+ case (SDL_INIT_VIDEO | SDL_INIT_AUDIO):
+ return "[--trackmem] " VIDEO_USAGE " " AUDIO_USAGE;
+ default:
+ return "[--trackmem]";
+ }
+}
+
+static void
+SDLTest_PrintRendererFlag(char *text, size_t maxlen, Uint32 flag)
+{
+ switch (flag) {
+ case SDL_RENDERER_SOFTWARE:
+ SDL_snprintfcat(text, maxlen, "Software");
+ break;
+ case SDL_RENDERER_ACCELERATED:
+ SDL_snprintfcat(text, maxlen, "Accelerated");
+ break;
+ case SDL_RENDERER_PRESENTVSYNC:
+ SDL_snprintfcat(text, maxlen, "PresentVSync");
+ break;
+ case SDL_RENDERER_TARGETTEXTURE:
+ SDL_snprintfcat(text, maxlen, "TargetTexturesSupported");
+ break;
+ default:
+ SDL_snprintfcat(text, maxlen, "0x%8.8x", flag);
+ break;
+ }
+}
+
+static void
+SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format)
+{
+ switch (format) {
+ case SDL_PIXELFORMAT_UNKNOWN:
+ SDL_snprintfcat(text, maxlen, "Unknown");
+ break;
+ case SDL_PIXELFORMAT_INDEX1LSB:
+ SDL_snprintfcat(text, maxlen, "Index1LSB");
+ break;
+ case SDL_PIXELFORMAT_INDEX1MSB:
+ SDL_snprintfcat(text, maxlen, "Index1MSB");
+ break;
+ case SDL_PIXELFORMAT_INDEX4LSB:
+ SDL_snprintfcat(text, maxlen, "Index4LSB");
+ break;
+ case SDL_PIXELFORMAT_INDEX4MSB:
+ SDL_snprintfcat(text, maxlen, "Index4MSB");
+ break;
+ case SDL_PIXELFORMAT_INDEX8:
+ SDL_snprintfcat(text, maxlen, "Index8");
+ break;
+ case SDL_PIXELFORMAT_RGB332:
+ SDL_snprintfcat(text, maxlen, "RGB332");
+ break;
+ case SDL_PIXELFORMAT_RGB444:
+ SDL_snprintfcat(text, maxlen, "RGB444");
+ break;
+ case SDL_PIXELFORMAT_RGB555:
+ SDL_snprintfcat(text, maxlen, "RGB555");
+ break;
+ case SDL_PIXELFORMAT_BGR555:
+ SDL_snprintfcat(text, maxlen, "BGR555");
+ break;
+ case SDL_PIXELFORMAT_ARGB4444:
+ SDL_snprintfcat(text, maxlen, "ARGB4444");
+ break;
+ case SDL_PIXELFORMAT_ABGR4444:
+ SDL_snprintfcat(text, maxlen, "ABGR4444");
+ break;
+ case SDL_PIXELFORMAT_ARGB1555:
+ SDL_snprintfcat(text, maxlen, "ARGB1555");
+ break;
+ case SDL_PIXELFORMAT_ABGR1555:
+ SDL_snprintfcat(text, maxlen, "ABGR1555");
+ break;
+ case SDL_PIXELFORMAT_RGB565:
+ SDL_snprintfcat(text, maxlen, "RGB565");
+ break;
+ case SDL_PIXELFORMAT_BGR565:
+ SDL_snprintfcat(text, maxlen, "BGR565");
+ break;
+ case SDL_PIXELFORMAT_RGB24:
+ SDL_snprintfcat(text, maxlen, "RGB24");
+ break;
+ case SDL_PIXELFORMAT_BGR24:
+ SDL_snprintfcat(text, maxlen, "BGR24");
+ break;
+ case SDL_PIXELFORMAT_RGB888:
+ SDL_snprintfcat(text, maxlen, "RGB888");
+ break;
+ case SDL_PIXELFORMAT_BGR888:
+ SDL_snprintfcat(text, maxlen, "BGR888");
+ break;
+ case SDL_PIXELFORMAT_ARGB8888:
+ SDL_snprintfcat(text, maxlen, "ARGB8888");
+ break;
+ case SDL_PIXELFORMAT_RGBA8888:
+ SDL_snprintfcat(text, maxlen, "RGBA8888");
+ break;
+ case SDL_PIXELFORMAT_ABGR8888:
+ SDL_snprintfcat(text, maxlen, "ABGR8888");
+ break;
+ case SDL_PIXELFORMAT_BGRA8888:
+ SDL_snprintfcat(text, maxlen, "BGRA8888");
+ break;
+ case SDL_PIXELFORMAT_ARGB2101010:
+ SDL_snprintfcat(text, maxlen, "ARGB2101010");
+ break;
+ case SDL_PIXELFORMAT_YV12:
+ SDL_snprintfcat(text, maxlen, "YV12");
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ SDL_snprintfcat(text, maxlen, "IYUV");
+ break;
+ case SDL_PIXELFORMAT_YUY2:
+ SDL_snprintfcat(text, maxlen, "YUY2");
+ break;
+ case SDL_PIXELFORMAT_UYVY:
+ SDL_snprintfcat(text, maxlen, "UYVY");
+ break;
+ case SDL_PIXELFORMAT_YVYU:
+ SDL_snprintfcat(text, maxlen, "YVYU");
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ SDL_snprintfcat(text, maxlen, "NV12");
+ break;
+ case SDL_PIXELFORMAT_NV21:
+ SDL_snprintfcat(text, maxlen, "NV21");
+ break;
+ default:
+ SDL_snprintfcat(text, maxlen, "0x%8.8x", format);
+ break;
+ }
+}
+
+static void
+SDLTest_PrintRenderer(SDL_RendererInfo * info)
+{
+ int i, count;
+ char text[1024];
+
+ SDL_Log(" Renderer %s:\n", info->name);
+
+ SDL_snprintf(text, sizeof(text), " Flags: 0x%8.8X", info->flags);
+ SDL_snprintfcat(text, sizeof(text), " (");
+ count = 0;
+ for (i = 0; i < sizeof(info->flags) * 8; ++i) {
+ Uint32 flag = (1 << i);
+ if (info->flags & flag) {
+ if (count > 0) {
+ SDL_snprintfcat(text, sizeof(text), " | ");
+ }
+ SDLTest_PrintRendererFlag(text, sizeof(text), flag);
+ ++count;
+ }
+ }
+ SDL_snprintfcat(text, sizeof(text), ")");
+ SDL_Log("%s\n", text);
+
+ SDL_snprintf(text, sizeof(text), " Texture formats (%d): ", info->num_texture_formats);
+ for (i = 0; i < (int) info->num_texture_formats; ++i) {
+ if (i > 0) {
+ SDL_snprintfcat(text, sizeof(text), ", ");
+ }
+ SDLTest_PrintPixelFormat(text, sizeof(text), info->texture_formats[i]);
+ }
+ SDL_Log("%s\n", text);
+
+ if (info->max_texture_width || info->max_texture_height) {
+ SDL_Log(" Max Texture Size: %dx%d\n",
+ info->max_texture_width, info->max_texture_height);
+ }
+}
+
+static SDL_Surface *
+SDLTest_LoadIcon(const char *file)
+{
+ SDL_Surface *icon;
+
+ /* Load the icon surface */
+ icon = SDL_LoadBMP(file);
+ if (icon == NULL) {
+ SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError());
+ return (NULL);
+ }
+
+ if (icon->format->palette) {
+ /* Set the colorkey */
+ SDL_SetColorKey(icon, 1, *((Uint8 *) icon->pixels));
+ }
+
+ return (icon);
+}
+
+static SDL_HitTestResult SDLCALL
+SDLTest_ExampleHitTestCallback(SDL_Window *win, const SDL_Point *area, void *data)
+{
+ int w, h;
+ const int RESIZE_BORDER = 8;
+ const int DRAGGABLE_TITLE = 32;
+
+ /*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/
+
+ SDL_GetWindowSize(win, &w, &h);
+
+ if (area->x < RESIZE_BORDER) {
+ if (area->y < RESIZE_BORDER) {
+ SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n");
+ return SDL_HITTEST_RESIZE_TOPLEFT;
+ } else if (area->y >= (h-RESIZE_BORDER)) {
+ SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n");
+ return SDL_HITTEST_RESIZE_BOTTOMLEFT;
+ } else {
+ SDL_Log("SDL_HITTEST_RESIZE_LEFT\n");
+ return SDL_HITTEST_RESIZE_LEFT;
+ }
+ } else if (area->x >= (w-RESIZE_BORDER)) {
+ if (area->y < RESIZE_BORDER) {
+ SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n");
+ return SDL_HITTEST_RESIZE_TOPRIGHT;
+ } else if (area->y >= (h-RESIZE_BORDER)) {
+ SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n");
+ return SDL_HITTEST_RESIZE_BOTTOMRIGHT;
+ } else {
+ SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n");
+ return SDL_HITTEST_RESIZE_RIGHT;
+ }
+ } else if (area->y >= (h-RESIZE_BORDER)) {
+ SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n");
+ return SDL_HITTEST_RESIZE_BOTTOM;
+ } else if (area->y < RESIZE_BORDER) {
+ SDL_Log("SDL_HITTEST_RESIZE_TOP\n");
+ return SDL_HITTEST_RESIZE_TOP;
+ } else if (area->y < DRAGGABLE_TITLE) {
+ SDL_Log("SDL_HITTEST_DRAGGABLE\n");
+ return SDL_HITTEST_DRAGGABLE;
+ }
+ return SDL_HITTEST_NORMAL;
+}
+
+SDL_bool
+SDLTest_CommonInit(SDLTest_CommonState * state)
+{
+ int i, j, m, n, w, h;
+ SDL_DisplayMode fullscreen_mode;
+ char text[1024];
+
+ if (state->flags & SDL_INIT_VIDEO) {
+ if (state->verbose & VERBOSE_VIDEO) {
+ n = SDL_GetNumVideoDrivers();
+ if (n == 0) {
+ SDL_Log("No built-in video drivers\n");
+ } else {
+ SDL_snprintf(text, sizeof(text), "Built-in video drivers:");
+ for (i = 0; i < n; ++i) {
+ if (i > 0) {
+ SDL_snprintfcat(text, sizeof(text), ",");
+ }
+ SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i));
+ }
+ SDL_Log("%s\n", text);
+ }
+ }
+ if (SDL_VideoInit(state->videodriver) < 0) {
+ SDL_Log("Couldn't initialize video driver: %s\n",
+ SDL_GetError());
+ return SDL_FALSE;
+ }
+ if (state->verbose & VERBOSE_VIDEO) {
+ SDL_Log("Video driver: %s\n",
+ SDL_GetCurrentVideoDriver());
+ }
+
+ /* Upload GL settings */
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, state->gl_red_size);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, state->gl_green_size);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, state->gl_blue_size);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, state->gl_alpha_size);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, state->gl_double_buffer);
+ SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, state->gl_buffer_size);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, state->gl_depth_size);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, state->gl_stencil_size);
+ SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, state->gl_accum_red_size);
+ SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, state->gl_accum_green_size);
+ SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size);
+ SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size);
+ SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples);
+ if (state->gl_accelerated >= 0) {
+ SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,
+ state->gl_accelerated);
+ }
+ SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, state->gl_retained_backing);
+ if (state->gl_major_version) {
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version);
+ }
+ if (state->gl_debug) {
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
+ }
+ if (state->gl_profile_mask) {
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, state->gl_profile_mask);
+ }
+
+ if (state->verbose & VERBOSE_MODES) {
+ SDL_Rect bounds, usablebounds;
+ float hdpi = 0;
+ float vdpi = 0;
+ SDL_DisplayMode mode;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+#if SDL_VIDEO_DRIVER_WINDOWS
+ int adapterIndex = 0;
+ int outputIndex = 0;
+#endif
+ n = SDL_GetNumVideoDisplays();
+ SDL_Log("Number of displays: %d\n", n);
+ for (i = 0; i < n; ++i) {
+ SDL_Log("Display %d: %s\n", i, SDL_GetDisplayName(i));
+
+ SDL_zero(bounds);
+ SDL_GetDisplayBounds(i, &bounds);
+
+ SDL_zero(usablebounds);
+ SDL_GetDisplayUsableBounds(i, &usablebounds);
+
+ SDL_GetDisplayDPI(i, NULL, &hdpi, &vdpi);
+
+ SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y);
+ SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
+ SDL_Log("DPI: %fx%f\n", hdpi, vdpi);
+
+ SDL_GetDesktopDisplayMode(i, &mode);
+ SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
+ &Bmask, &Amask);
+ SDL_Log(" Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
+ mode.w, mode.h, mode.refresh_rate, bpp,
+ SDL_GetPixelFormatName(mode.format));
+ if (Rmask || Gmask || Bmask) {
+ SDL_Log(" Red Mask = 0x%.8x\n", Rmask);
+ SDL_Log(" Green Mask = 0x%.8x\n", Gmask);
+ SDL_Log(" Blue Mask = 0x%.8x\n", Bmask);
+ if (Amask)
+ SDL_Log(" Alpha Mask = 0x%.8x\n", Amask);
+ }
+
+ /* Print available fullscreen video modes */
+ m = SDL_GetNumDisplayModes(i);
+ if (m == 0) {
+ SDL_Log("No available fullscreen video modes\n");
+ } else {
+ SDL_Log(" Fullscreen video modes:\n");
+ for (j = 0; j < m; ++j) {
+ SDL_GetDisplayMode(i, j, &mode);
+ SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
+ &Gmask, &Bmask, &Amask);
+ SDL_Log(" Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
+ j, mode.w, mode.h, mode.refresh_rate, bpp,
+ SDL_GetPixelFormatName(mode.format));
+ if (Rmask || Gmask || Bmask) {
+ SDL_Log(" Red Mask = 0x%.8x\n",
+ Rmask);
+ SDL_Log(" Green Mask = 0x%.8x\n",
+ Gmask);
+ SDL_Log(" Blue Mask = 0x%.8x\n",
+ Bmask);
+ if (Amask)
+ SDL_Log(" Alpha Mask = 0x%.8x\n",
+ Amask);
+ }
+ }
+ }
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+ /* Print the D3D9 adapter index */
+ adapterIndex = SDL_Direct3D9GetAdapterIndex( i );
+ SDL_Log("D3D9 Adapter Index: %d", adapterIndex);
+
+ /* Print the DXGI adapter and output indices */
+ SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex);
+ SDL_Log("DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex);
+#endif
+ }
+ }
+
+ if (state->verbose & VERBOSE_RENDER) {
+ SDL_RendererInfo info;
+
+ n = SDL_GetNumRenderDrivers();
+ if (n == 0) {
+ SDL_Log("No built-in render drivers\n");
+ } else {
+ SDL_Log("Built-in render drivers:\n");
+ for (i = 0; i < n; ++i) {
+ SDL_GetRenderDriverInfo(i, &info);
+ SDLTest_PrintRenderer(&info);
+ }
+ }
+ }
+
+ SDL_zero(fullscreen_mode);
+ switch (state->depth) {
+ case 8:
+ fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8;
+ break;
+ case 15:
+ fullscreen_mode.format = SDL_PIXELFORMAT_RGB555;
+ break;
+ case 16:
+ fullscreen_mode.format = SDL_PIXELFORMAT_RGB565;
+ break;
+ case 24:
+ fullscreen_mode.format = SDL_PIXELFORMAT_RGB24;
+ break;
+ default:
+ fullscreen_mode.format = SDL_PIXELFORMAT_RGB888;
+ break;
+ }
+ fullscreen_mode.refresh_rate = state->refresh_rate;
+
+ state->windows =
+ (SDL_Window **) SDL_calloc(state->num_windows,
+ sizeof(*state->windows));
+ state->renderers =
+ (SDL_Renderer **) SDL_calloc(state->num_windows,
+ sizeof(*state->renderers));
+ state->targets =
+ (SDL_Texture **) SDL_calloc(state->num_windows,
+ sizeof(*state->targets));
+ if (!state->windows || !state->renderers) {
+ SDL_Log("Out of memory!\n");
+ return SDL_FALSE;
+ }
+ for (i = 0; i < state->num_windows; ++i) {
+ char title[1024];
+
+ if (state->num_windows > 1) {
+ SDL_snprintf(title, SDL_arraysize(title), "%s %d",
+ state->window_title, i + 1);
+ } else {
+ SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
+ }
+ state->windows[i] =
+ SDL_CreateWindow(title, state->window_x, state->window_y,
+ state->window_w, state->window_h,
+ state->window_flags);
+ if (!state->windows[i]) {
+ SDL_Log("Couldn't create window: %s\n",
+ SDL_GetError());
+ return SDL_FALSE;
+ }
+ if (state->window_minW || state->window_minH) {
+ SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH);
+ }
+ if (state->window_maxW || state->window_maxH) {
+ SDL_SetWindowMaximumSize(state->windows[i], state->window_maxW, state->window_maxH);
+ }
+ SDL_GetWindowSize(state->windows[i], &w, &h);
+ if (!(state->window_flags & SDL_WINDOW_RESIZABLE) &&
+ (w != state->window_w || h != state->window_h)) {
+ printf("Window requested size %dx%d, got %dx%d\n", state->window_w, state->window_h, w, h);
+ state->window_w = w;
+ state->window_h = h;
+ }
+ if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) {
+ SDL_Log("Can't set up fullscreen display mode: %s\n",
+ SDL_GetError());
+ return SDL_FALSE;
+ }
+
+ /* Add resize/drag areas for windows that are borderless and resizable */
+ if ((state->window_flags & (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) ==
+ (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) {
+ SDL_SetWindowHitTest(state->windows[i], SDLTest_ExampleHitTestCallback, NULL);
+ }
+
+ if (state->window_icon) {
+ SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon);
+ if (icon) {
+ SDL_SetWindowIcon(state->windows[i], icon);
+ SDL_FreeSurface(icon);
+ }
+ }
+
+ SDL_ShowWindow(state->windows[i]);
+
+ if (!state->skip_renderer
+ && (state->renderdriver
+ || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) {
+ m = -1;
+ if (state->renderdriver) {
+ SDL_RendererInfo info;
+ n = SDL_GetNumRenderDrivers();
+ for (j = 0; j < n; ++j) {
+ SDL_GetRenderDriverInfo(j, &info);
+ if (SDL_strcasecmp(info.name, state->renderdriver) ==
+ 0) {
+ m = j;
+ break;
+ }
+ }
+ if (m == -1) {
+ SDL_Log("Couldn't find render driver named %s",
+ state->renderdriver);
+ return SDL_FALSE;
+ }
+ }
+ state->renderers[i] = SDL_CreateRenderer(state->windows[i],
+ m, state->render_flags);
+ if (!state->renderers[i]) {
+ SDL_Log("Couldn't create renderer: %s\n",
+ SDL_GetError());
+ return SDL_FALSE;
+ }
+ if (state->logical_w && state->logical_h) {
+ SDL_RenderSetLogicalSize(state->renderers[i], state->logical_w, state->logical_h);
+ } else if (state->scale) {
+ SDL_RenderSetScale(state->renderers[i], state->scale, state->scale);
+ }
+ if (state->verbose & VERBOSE_RENDER) {
+ SDL_RendererInfo info;
+
+ SDL_Log("Current renderer:\n");
+ SDL_GetRendererInfo(state->renderers[i], &info);
+ SDLTest_PrintRenderer(&info);
+ }
+ }
+ }
+ }
+
+ if (state->flags & SDL_INIT_AUDIO) {
+ if (state->verbose & VERBOSE_AUDIO) {
+ n = SDL_GetNumAudioDrivers();
+ if (n == 0) {
+ SDL_Log("No built-in audio drivers\n");
+ } else {
+ SDL_snprintf(text, sizeof(text), "Built-in audio drivers:");
+ for (i = 0; i < n; ++i) {
+ if (i > 0) {
+ SDL_snprintfcat(text, sizeof(text), ",");
+ }
+ SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i));
+ }
+ SDL_Log("%s\n", text);
+ }
+ }
+ if (SDL_AudioInit(state->audiodriver) < 0) {
+ SDL_Log("Couldn't initialize audio driver: %s\n",
+ SDL_GetError());
+ return SDL_FALSE;
+ }
+ if (state->verbose & VERBOSE_VIDEO) {
+ SDL_Log("Audio driver: %s\n",
+ SDL_GetCurrentAudioDriver());
+ }
+
+ if (SDL_OpenAudio(&state->audiospec, NULL) < 0) {
+ SDL_Log("Couldn't open audio: %s\n", SDL_GetError());
+ return SDL_FALSE;
+ }
+ }
+
+ return SDL_TRUE;
+}
+
+static const char *
+ControllerAxisName(const SDL_GameControllerAxis axis)
+{
+ switch (axis)
+ {
+#define AXIS_CASE(ax) case SDL_CONTROLLER_AXIS_##ax: return #ax
+ AXIS_CASE(INVALID);
+ AXIS_CASE(LEFTX);
+ AXIS_CASE(LEFTY);
+ AXIS_CASE(RIGHTX);
+ AXIS_CASE(RIGHTY);
+ AXIS_CASE(TRIGGERLEFT);
+ AXIS_CASE(TRIGGERRIGHT);
+#undef AXIS_CASE
+default: return "???";
+ }
+}
+
+static const char *
+ControllerButtonName(const SDL_GameControllerButton button)
+{
+ switch (button)
+ {
+#define BUTTON_CASE(btn) case SDL_CONTROLLER_BUTTON_##btn: return #btn
+ BUTTON_CASE(INVALID);
+ BUTTON_CASE(A);
+ BUTTON_CASE(B);
+ BUTTON_CASE(X);
+ BUTTON_CASE(Y);
+ BUTTON_CASE(BACK);
+ BUTTON_CASE(GUIDE);
+ BUTTON_CASE(START);
+ BUTTON_CASE(LEFTSTICK);
+ BUTTON_CASE(RIGHTSTICK);
+ BUTTON_CASE(LEFTSHOULDER);
+ BUTTON_CASE(RIGHTSHOULDER);
+ BUTTON_CASE(DPAD_UP);
+ BUTTON_CASE(DPAD_DOWN);
+ BUTTON_CASE(DPAD_LEFT);
+ BUTTON_CASE(DPAD_RIGHT);
+#undef BUTTON_CASE
+default: return "???";
+ }
+}
+
+static void
+SDLTest_PrintEvent(SDL_Event * event)
+{
+ if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
+ /* Mouse and finger motion are really spammy */
+ return;
+ }
+
+ switch (event->type) {
+ case SDL_WINDOWEVENT:
+ switch (event->window.event) {
+ case SDL_WINDOWEVENT_SHOWN:
+ SDL_Log("SDL EVENT: Window %d shown", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_HIDDEN:
+ SDL_Log("SDL EVENT: Window %d hidden", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_EXPOSED:
+ SDL_Log("SDL EVENT: Window %d exposed", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_MOVED:
+ SDL_Log("SDL EVENT: Window %d moved to %d,%d",
+ event->window.windowID, event->window.data1,
+ event->window.data2);
+ break;
+ case SDL_WINDOWEVENT_RESIZED:
+ SDL_Log("SDL EVENT: Window %d resized to %dx%d",
+ event->window.windowID, event->window.data1,
+ event->window.data2);
+ break;
+ case SDL_WINDOWEVENT_SIZE_CHANGED:
+ SDL_Log("SDL EVENT: Window %d changed size to %dx%d",
+ event->window.windowID, event->window.data1,
+ event->window.data2);
+ break;
+ case SDL_WINDOWEVENT_MINIMIZED:
+ SDL_Log("SDL EVENT: Window %d minimized", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_MAXIMIZED:
+ SDL_Log("SDL EVENT: Window %d maximized", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_RESTORED:
+ SDL_Log("SDL EVENT: Window %d restored", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_ENTER:
+ SDL_Log("SDL EVENT: Mouse entered window %d",
+ event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_LEAVE:
+ SDL_Log("SDL EVENT: Mouse left window %d", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_GAINED:
+ SDL_Log("SDL EVENT: Window %d gained keyboard focus",
+ event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_LOST:
+ SDL_Log("SDL EVENT: Window %d lost keyboard focus",
+ event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_CLOSE:
+ SDL_Log("SDL EVENT: Window %d closed", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_TAKE_FOCUS:
+ SDL_Log("SDL EVENT: Window %d take focus", event->window.windowID);
+ break;
+ case SDL_WINDOWEVENT_HIT_TEST:
+ SDL_Log("SDL EVENT: Window %d hit test", event->window.windowID);
+ break;
+ default:
+ SDL_Log("SDL EVENT: Window %d got unknown event 0x%4.4x",
+ event->window.windowID, event->window.event);
+ break;
+ }
+ break;
+ case SDL_KEYDOWN:
+ SDL_Log("SDL EVENT: Keyboard: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
+ event->key.windowID,
+ event->key.keysym.scancode,
+ SDL_GetScancodeName(event->key.keysym.scancode),
+ event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
+ break;
+ case SDL_KEYUP:
+ SDL_Log("SDL EVENT: Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
+ event->key.windowID,
+ event->key.keysym.scancode,
+ SDL_GetScancodeName(event->key.keysym.scancode),
+ event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
+ break;
+ case SDL_TEXTEDITING:
+ SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %d",
+ event->edit.text, event->edit.windowID);
+ break;
+ case SDL_TEXTINPUT:
+ SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %d",
+ event->text.text, event->text.windowID);
+ break;
+ case SDL_KEYMAPCHANGED:
+ SDL_Log("SDL EVENT: Keymap changed");
+ break;
+ case SDL_MOUSEMOTION:
+ SDL_Log("SDL EVENT: Mouse: moved to %d,%d (%d,%d) in window %d",
+ event->motion.x, event->motion.y,
+ event->motion.xrel, event->motion.yrel,
+ event->motion.windowID);
+ break;
+ case SDL_MOUSEBUTTONDOWN:
+ SDL_Log("SDL EVENT: Mouse: button %d pressed at %d,%d with click count %d in window %d",
+ event->button.button, event->button.x, event->button.y, event->button.clicks,
+ event->button.windowID);
+ break;
+ case SDL_MOUSEBUTTONUP:
+ SDL_Log("SDL EVENT: Mouse: button %d released at %d,%d with click count %d in window %d",
+ event->button.button, event->button.x, event->button.y, event->button.clicks,
+ event->button.windowID);
+ break;
+ case SDL_MOUSEWHEEL:
+ SDL_Log("SDL EVENT: Mouse: wheel scrolled %d in x and %d in y (reversed: %d) in window %d",
+ event->wheel.x, event->wheel.y, event->wheel.direction, event->wheel.windowID);
+ break;
+ case SDL_JOYDEVICEADDED:
+ SDL_Log("SDL EVENT: Joystick index %d attached",
+ event->jdevice.which);
+ break;
+ case SDL_JOYDEVICEREMOVED:
+ SDL_Log("SDL EVENT: Joystick %d removed",
+ event->jdevice.which);
+ break;
+ case SDL_JOYBALLMOTION:
+ SDL_Log("SDL EVENT: Joystick %d: ball %d moved by %d,%d",
+ event->jball.which, event->jball.ball, event->jball.xrel,
+ event->jball.yrel);
+ break;
+ case SDL_JOYHATMOTION:
+ {
+ const char *position = "UNKNOWN";
+ switch (event->jhat.value) {
+ case SDL_HAT_CENTERED:
+ position = "CENTER";
+ break;
+ case SDL_HAT_UP:
+ position = "UP";
+ break;
+ case SDL_HAT_RIGHTUP:
+ position = "RIGHTUP";
+ break;
+ case SDL_HAT_RIGHT:
+ position = "RIGHT";
+ break;
+ case SDL_HAT_RIGHTDOWN:
+ position = "RIGHTDOWN";
+ break;
+ case SDL_HAT_DOWN:
+ position = "DOWN";
+ break;
+ case SDL_HAT_LEFTDOWN:
+ position = "LEFTDOWN";
+ break;
+ case SDL_HAT_LEFT:
+ position = "LEFT";
+ break;
+ case SDL_HAT_LEFTUP:
+ position = "LEFTUP";
+ break;
+ }
+ SDL_Log("SDL EVENT: Joystick %d: hat %d moved to %s", event->jhat.which,
+ event->jhat.hat, position);
+ }
+ break;
+ case SDL_JOYBUTTONDOWN:
+ SDL_Log("SDL EVENT: Joystick %d: button %d pressed",
+ event->jbutton.which, event->jbutton.button);
+ break;
+ case SDL_JOYBUTTONUP:
+ SDL_Log("SDL EVENT: Joystick %d: button %d released",
+ event->jbutton.which, event->jbutton.button);
+ break;
+ case SDL_CONTROLLERDEVICEADDED:
+ SDL_Log("SDL EVENT: Controller index %d attached",
+ event->cdevice.which);
+ break;
+ case SDL_CONTROLLERDEVICEREMOVED:
+ SDL_Log("SDL EVENT: Controller %d removed",
+ event->cdevice.which);
+ break;
+ case SDL_CONTROLLERAXISMOTION:
+ SDL_Log("SDL EVENT: Controller %d axis %d ('%s') value: %d",
+ event->caxis.which,
+ event->caxis.axis,
+ ControllerAxisName((SDL_GameControllerAxis)event->caxis.axis),
+ event->caxis.value);
+ break;
+ case SDL_CONTROLLERBUTTONDOWN:
+ SDL_Log("SDL EVENT: Controller %d button %d ('%s') down",
+ event->cbutton.which, event->cbutton.button,
+ ControllerButtonName((SDL_GameControllerButton)event->cbutton.button));
+ break;
+ case SDL_CONTROLLERBUTTONUP:
+ SDL_Log("SDL EVENT: Controller %d button %d ('%s') up",
+ event->cbutton.which, event->cbutton.button,
+ ControllerButtonName((SDL_GameControllerButton)event->cbutton.button));
+ break;
+ case SDL_CLIPBOARDUPDATE:
+ SDL_Log("SDL EVENT: Clipboard updated");
+ break;
+
+ case SDL_FINGERMOTION:
+ SDL_Log("SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
+ (long) event->tfinger.touchId,
+ (long) event->tfinger.fingerId,
+ event->tfinger.x, event->tfinger.y,
+ event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
+ break;
+ case SDL_FINGERDOWN:
+ case SDL_FINGERUP:
+ SDL_Log("SDL EVENT: Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
+ (event->type == SDL_FINGERDOWN) ? "down" : "up",
+ (long) event->tfinger.touchId,
+ (long) event->tfinger.fingerId,
+ event->tfinger.x, event->tfinger.y,
+ event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
+ break;
+ case SDL_DOLLARGESTURE:
+ SDL_Log("SDL_EVENT: Dollar gesture detect: %ld", (long) event->dgesture.gestureId);
+ break;
+ case SDL_DOLLARRECORD:
+ SDL_Log("SDL_EVENT: Dollar gesture record: %ld", (long) event->dgesture.gestureId);
+ break;
+ case SDL_MULTIGESTURE:
+ SDL_Log("SDL_EVENT: Multi gesture fingers: %d", event->mgesture.numFingers);
+ break;
+
+ case SDL_RENDER_DEVICE_RESET:
+ SDL_Log("SDL EVENT: render device reset");
+ break;
+ case SDL_RENDER_TARGETS_RESET:
+ SDL_Log("SDL EVENT: render targets reset");
+ break;
+
+ case SDL_APP_TERMINATING:
+ SDL_Log("SDL EVENT: App terminating");
+ break;
+ case SDL_APP_LOWMEMORY:
+ SDL_Log("SDL EVENT: App running low on memory");
+ break;
+ case SDL_APP_WILLENTERBACKGROUND:
+ SDL_Log("SDL EVENT: App will enter the background");
+ break;
+ case SDL_APP_DIDENTERBACKGROUND:
+ SDL_Log("SDL EVENT: App entered the background");
+ break;
+ case SDL_APP_WILLENTERFOREGROUND:
+ SDL_Log("SDL EVENT: App will enter the foreground");
+ break;
+ case SDL_APP_DIDENTERFOREGROUND:
+ SDL_Log("SDL EVENT: App entered the foreground");
+ break;
+
+ case SDL_QUIT:
+ SDL_Log("SDL EVENT: Quit requested");
+ break;
+ case SDL_USEREVENT:
+ SDL_Log("SDL EVENT: User event %d", event->user.code);
+ break;
+ default:
+ SDL_Log("Unknown event 0x%4.4x", event->type);
+ break;
+ }
+}
+
+static void
+SDLTest_ScreenShot(SDL_Renderer *renderer)
+{
+ SDL_Rect viewport;
+ SDL_Surface *surface;
+
+ if (!renderer) {
+ return;
+ }
+
+ SDL_RenderGetViewport(renderer, &viewport);
+ surface = SDL_CreateRGBSurface(0, viewport.w, viewport.h, 24,
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ 0x00FF0000, 0x0000FF00, 0x000000FF,
+#else
+ 0x000000FF, 0x0000FF00, 0x00FF0000,
+#endif
+ 0x00000000);
+ if (!surface) {
+ SDL_Log("Couldn't create surface: %s\n", SDL_GetError());
+ return;
+ }
+
+ if (SDL_RenderReadPixels(renderer, NULL, surface->format->format,
+ surface->pixels, surface->pitch) < 0) {
+ SDL_Log("Couldn't read screen: %s\n", SDL_GetError());
+ SDL_free(surface);
+ return;
+ }
+
+ if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) {
+ SDL_Log("Couldn't save screenshot.bmp: %s\n", SDL_GetError());
+ SDL_free(surface);
+ return;
+ }
+}
+
+static void
+FullscreenTo(int index, int windowId)
+{
+ Uint32 flags;
+ struct SDL_Rect rect = { 0, 0, 0, 0 };
+ SDL_Window *window = SDL_GetWindowFromID(windowId);
+ if (!window) {
+ return;
+ }
+
+ SDL_GetDisplayBounds( index, &rect );
+
+ flags = SDL_GetWindowFlags(window);
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_SetWindowFullscreen( window, SDL_FALSE );
+ SDL_Delay( 15 );
+ }
+
+ SDL_SetWindowPosition( window, rect.x, rect.y );
+ SDL_SetWindowFullscreen( window, SDL_TRUE );
+}
+
+void
+SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
+{
+ int i;
+ static SDL_MouseMotionEvent lastEvent;
+
+ if (state->verbose & VERBOSE_EVENT) {
+ SDLTest_PrintEvent(event);
+ }
+
+ switch (event->type) {
+ case SDL_WINDOWEVENT:
+ switch (event->window.event) {
+ case SDL_WINDOWEVENT_CLOSE:
+ {
+ SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
+ if (window) {
+ for (i = 0; i < state->num_windows; ++i) {
+ if (window == state->windows[i]) {
+ if (state->targets[i]) {
+ SDL_DestroyTexture(state->targets[i]);
+ state->targets[i] = NULL;
+ }
+ if (state->renderers[i]) {
+ SDL_DestroyRenderer(state->renderers[i]);
+ state->renderers[i] = NULL;
+ }
+ SDL_DestroyWindow(state->windows[i]);
+ state->windows[i] = NULL;
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ break;
+ case SDL_KEYDOWN: {
+ SDL_bool withControl = !!(event->key.keysym.mod & KMOD_CTRL);
+ SDL_bool withShift = !!(event->key.keysym.mod & KMOD_SHIFT);
+ SDL_bool withAlt = !!(event->key.keysym.mod & KMOD_ALT);
+
+ switch (event->key.keysym.sym) {
+ /* Add hotkeys here */
+ case SDLK_PRINTSCREEN: {
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ for (i = 0; i < state->num_windows; ++i) {
+ if (window == state->windows[i]) {
+ SDLTest_ScreenShot(state->renderers[i]);
+ }
+ }
+ }
+ }
+ break;
+ case SDLK_EQUALS:
+ if (withControl) {
+ /* Ctrl-+ double the size of the window */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ int w, h;
+ SDL_GetWindowSize(window, &w, &h);
+ SDL_SetWindowSize(window, w*2, h*2);
+ }
+ }
+ break;
+ case SDLK_MINUS:
+ if (withControl) {
+ /* Ctrl-- half the size of the window */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ int w, h;
+ SDL_GetWindowSize(window, &w, &h);
+ SDL_SetWindowSize(window, w/2, h/2);
+ }
+ }
+ break;
+ case SDLK_UP:
+ case SDLK_DOWN:
+ case SDLK_LEFT:
+ case SDLK_RIGHT:
+ if (withAlt) {
+ /* Alt-Up/Down/Left/Right switches between displays */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ int currentIndex = SDL_GetWindowDisplayIndex(window);
+ int numDisplays = SDL_GetNumVideoDisplays();
+
+ if (currentIndex >= 0 && numDisplays >= 1) {
+ int dest;
+ if (event->key.keysym.sym == SDLK_UP || event->key.keysym.sym == SDLK_LEFT) {
+ dest = (currentIndex + numDisplays - 1) % numDisplays;
+ } else {
+ dest = (currentIndex + numDisplays + 1) % numDisplays;
+ }
+ SDL_Log("Centering on display %d\n", dest);
+ SDL_SetWindowPosition(window,
+ SDL_WINDOWPOS_CENTERED_DISPLAY(dest),
+ SDL_WINDOWPOS_CENTERED_DISPLAY(dest));
+ }
+ }
+ }
+ if (withShift) {
+ /* Shift-Up/Down/Left/Right shift the window by 100px */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ const int delta = 100;
+ int x, y;
+ SDL_GetWindowPosition(window, &x, &y);
+
+ if (event->key.keysym.sym == SDLK_UP) y -= delta;
+ if (event->key.keysym.sym == SDLK_DOWN) y += delta;
+ if (event->key.keysym.sym == SDLK_LEFT) x -= delta;
+ if (event->key.keysym.sym == SDLK_RIGHT) x += delta;
+
+ SDL_Log("Setting position to (%d, %d)\n", x, y);
+ SDL_SetWindowPosition(window, x, y);
+ }
+ }
+ break;
+ case SDLK_o:
+ if (withControl) {
+ /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ float opacity;
+ if (SDL_GetWindowOpacity(window, &opacity) == 0) {
+ if (withShift) {
+ opacity += 0.20f;
+ } else {
+ opacity -= 0.20f;
+ }
+ SDL_SetWindowOpacity(window, opacity);
+ }
+ }
+ }
+ break;
+
+ case SDLK_c:
+ if (withControl) {
+ /* Ctrl-C copy awesome text! */
+ SDL_SetClipboardText("SDL rocks!\nYou know it!");
+ printf("Copied text to clipboard\n");
+ }
+ if (withAlt) {
+ /* Alt-C toggle a render clip rectangle */
+ for (i = 0; i < state->num_windows; ++i) {
+ int w, h;
+ if (state->renderers[i]) {
+ SDL_Rect clip;
+ SDL_GetWindowSize(state->windows[i], &w, &h);
+ SDL_RenderGetClipRect(state->renderers[i], &clip);
+ if (SDL_RectEmpty(&clip)) {
+ clip.x = w/4;
+ clip.y = h/4;
+ clip.w = w/2;
+ clip.h = h/2;
+ SDL_RenderSetClipRect(state->renderers[i], &clip);
+ } else {
+ SDL_RenderSetClipRect(state->renderers[i], NULL);
+ }
+ }
+ }
+ }
+ if (withShift) {
+ SDL_Window *current_win = SDL_GetKeyboardFocus();
+ if (current_win) {
+ const SDL_bool shouldCapture = (SDL_GetWindowFlags(current_win) & SDL_WINDOW_MOUSE_CAPTURE) == 0;
+ const int rc = SDL_CaptureMouse(shouldCapture);
+ SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", (rc == 0) ? "succeeded" : "failed");
+ }
+ }
+ break;
+ case SDLK_v:
+ if (withControl) {
+ /* Ctrl-V paste awesome text! */
+ char *text = SDL_GetClipboardText();
+ if (*text) {
+ printf("Clipboard: %s\n", text);
+ } else {
+ printf("Clipboard is empty\n");
+ }
+ SDL_free(text);
+ }
+ break;
+ case SDLK_g:
+ if (withControl) {
+ /* Ctrl-G toggle grab */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window) ? SDL_TRUE : SDL_FALSE);
+ }
+ }
+ break;
+ case SDLK_m:
+ if (withControl) {
+ /* Ctrl-M maximize */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ Uint32 flags = SDL_GetWindowFlags(window);
+ if (flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_RestoreWindow(window);
+ } else {
+ SDL_MaximizeWindow(window);
+ }
+ }
+ }
+ break;
+ case SDLK_r:
+ if (withControl) {
+ /* Ctrl-R toggle mouse relative mode */
+ SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode() ? SDL_TRUE : SDL_FALSE);
+ }
+ break;
+ case SDLK_z:
+ if (withControl) {
+ /* Ctrl-Z minimize */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ SDL_MinimizeWindow(window);
+ }
+ }
+ break;
+ case SDLK_RETURN:
+ if (withControl) {
+ /* Ctrl-Enter toggle fullscreen */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ Uint32 flags = SDL_GetWindowFlags(window);
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_SetWindowFullscreen(window, SDL_FALSE);
+ } else {
+ SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
+ }
+ }
+ } else if (withAlt) {
+ /* Alt-Enter toggle fullscreen desktop */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ Uint32 flags = SDL_GetWindowFlags(window);
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_SetWindowFullscreen(window, SDL_FALSE);
+ } else {
+ SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+ }
+ }
+ } else if (withShift) {
+ /* Shift-Enter toggle fullscreen desktop / fullscreen */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ Uint32 flags = SDL_GetWindowFlags(window);
+ if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
+ } else {
+ SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+ }
+ }
+ }
+
+ break;
+ case SDLK_b:
+ if (withControl) {
+ /* Ctrl-B toggle window border */
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ if (window) {
+ const Uint32 flags = SDL_GetWindowFlags(window);
+ const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0) ? SDL_TRUE : SDL_FALSE;
+ SDL_SetWindowBordered(window, b);
+ }
+ }
+ break;
+ case SDLK_a:
+ if (withControl) {
+ /* Ctrl-A reports absolute mouse position. */
+ int x, y;
+ const Uint32 mask = SDL_GetGlobalMouseState(&x, &y);
+ SDL_Log("ABSOLUTE MOUSE: (%d, %d)%s%s%s%s%s\n", x, y,
+ (mask & SDL_BUTTON_LMASK) ? " [LBUTTON]" : "",
+ (mask & SDL_BUTTON_MMASK) ? " [MBUTTON]" : "",
+ (mask & SDL_BUTTON_RMASK) ? " [RBUTTON]" : "",
+ (mask & SDL_BUTTON_X1MASK) ? " [X2BUTTON]" : "",
+ (mask & SDL_BUTTON_X2MASK) ? " [X2BUTTON]" : "");
+ }
+ break;
+ case SDLK_0:
+ if (withControl) {
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window);
+ }
+ break;
+ case SDLK_1:
+ if (withControl) {
+ FullscreenTo(0, event->key.windowID);
+ }
+ break;
+ case SDLK_2:
+ if (withControl) {
+ FullscreenTo(1, event->key.windowID);
+ }
+ break;
+ case SDLK_ESCAPE:
+ *done = 1;
+ break;
+ case SDLK_SPACE:
+ {
+ char message[256];
+ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+
+ SDL_snprintf(message, sizeof(message), "(%i, %i), rel (%i, %i)\n", lastEvent.x, lastEvent.y, lastEvent.xrel, lastEvent.yrel);
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Last mouse position", message, window);
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+ }
+ case SDL_QUIT:
+ *done = 1;
+ break;
+ case SDL_MOUSEMOTION:
+ lastEvent = event->motion;
+ break;
+ }
+}
+
+void
+SDLTest_CommonQuit(SDLTest_CommonState * state)
+{
+ int i;
+
+ SDL_free(state->windows);
+ if (state->targets) {
+ for (i = 0; i < state->num_windows; ++i) {
+ if (state->targets[i]) {
+ SDL_DestroyTexture(state->targets[i]);
+ }
+ }
+ SDL_free(state->targets);
+ }
+ if (state->renderers) {
+ for (i = 0; i < state->num_windows; ++i) {
+ if (state->renderers[i]) {
+ SDL_DestroyRenderer(state->renderers[i]);
+ }
+ }
+ SDL_free(state->renderers);
+ }
+ if (state->flags & SDL_INIT_VIDEO) {
+ SDL_VideoQuit();
+ }
+ if (state->flags & SDL_INIT_AUDIO) {
+ SDL_AudioQuit();
+ }
+ SDL_free(state);
+ SDL_Quit();
+ SDLTest_LogAllocations();
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_compare.c b/src/3rdparty/SDL2/src/test/SDL_test_compare.c
new file mode 100644
index 0000000..d4e3e71
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_compare.c
@@ -0,0 +1,117 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+
+ Based on automated SDL_Surface tests originally written by Edgar Simo 'bobbens'.
+
+ Rewritten for test lib by Andreas Schiffler.
+
+*/
+
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+
+/* Counter for _CompareSurface calls; used for filename creation when comparisons fail */
+static int _CompareSurfaceCount = 0;
+
+/* Compare surfaces */
+int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
+{
+ int ret;
+ int i,j;
+ int bpp, bpp_reference;
+ Uint8 *p, *p_reference;
+ int dist;
+ int sampleErrorX = 0, sampleErrorY = 0, sampleDist = 0;
+ Uint8 R, G, B, A;
+ Uint8 Rd, Gd, Bd, Ad;
+ char imageFilename[128];
+ char referenceFilename[128];
+
+ /* Validate input surfaces */
+ if (surface == NULL || referenceSurface == NULL) {
+ return -1;
+ }
+
+ /* Make sure surface size is the same. */
+ if ((surface->w != referenceSurface->w) || (surface->h != referenceSurface->h)) {
+ return -2;
+ }
+
+ /* Sanitize input value */
+ if (allowable_error<0) {
+ allowable_error = 0;
+ }
+
+ SDL_LockSurface( surface );
+ SDL_LockSurface( referenceSurface );
+
+ ret = 0;
+ bpp = surface->format->BytesPerPixel;
+ bpp_reference = referenceSurface->format->BytesPerPixel;
+ /* Compare image - should be same format. */
+ for (j=0; j<surface->h; j++) {
+ for (i=0; i<surface->w; i++) {
+ p = (Uint8 *)surface->pixels + j * surface->pitch + i * bpp;
+ p_reference = (Uint8 *)referenceSurface->pixels + j * referenceSurface->pitch + i * bpp_reference;
+
+ SDL_GetRGBA(*(Uint32*)p, surface->format, &R, &G, &B, &A);
+ SDL_GetRGBA(*(Uint32*)p_reference, referenceSurface->format, &Rd, &Gd, &Bd, &Ad);
+
+ dist = 0;
+ dist += (R-Rd)*(R-Rd);
+ dist += (G-Gd)*(G-Gd);
+ dist += (B-Bd)*(B-Bd);
+
+ /* Allow some difference in blending accuracy */
+ if (dist > allowable_error) {
+ ret++;
+ if (ret == 1) {
+ sampleErrorX = i;
+ sampleErrorY = j;
+ sampleDist = dist;
+ }
+ }
+ }
+ }
+
+ SDL_UnlockSurface( surface );
+ SDL_UnlockSurface( referenceSurface );
+
+ /* Save test image and reference for analysis on failures */
+ _CompareSurfaceCount++;
+ if (ret != 0) {
+ SDLTest_LogError("Comparison of pixels with allowable error of %i failed %i times.", allowable_error, ret);
+ SDLTest_LogError("First detected occurrence at position %i,%i with a squared RGB-difference of %i.", sampleErrorX, sampleErrorY, sampleDist);
+ SDL_snprintf(imageFilename, 127, "CompareSurfaces%04d_TestOutput.bmp", _CompareSurfaceCount);
+ SDL_SaveBMP(surface, imageFilename);
+ SDL_snprintf(referenceFilename, 127, "CompareSurfaces%04d_Reference.bmp", _CompareSurfaceCount);
+ SDL_SaveBMP(referenceSurface, referenceFilename);
+ SDLTest_LogError("Surfaces from failed comparison saved as '%s' and '%s'", imageFilename, referenceFilename);
+ }
+
+ return ret;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_crc32.c b/src/3rdparty/SDL2/src/test/SDL_test_crc32.c
new file mode 100644
index 0000000..ea6b0a8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_crc32.c
@@ -0,0 +1,166 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+
+ Used by the test execution component.
+ Original source code contributed by A. Schiffler for GSOC project.
+
+*/
+
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+
+int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
+{
+ int i,j;
+ CrcUint32 c;
+
+ /* Sanity check context pointer */
+ if (crcContext==NULL) {
+ return -1;
+ }
+
+ /*
+ * Build auxiliary table for parallel byte-at-a-time CRC-32
+ */
+#ifdef ORIGINAL_METHOD
+ for (i = 0; i < 256; ++i) {
+ for (c = i << 24, j = 8; j > 0; --j) {
+ c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1);
+ }
+ crcContext->crc32_table[i] = c;
+ }
+#else
+ for (i=0; i<256; i++) {
+ c = i;
+ for (j=8; j>0; j--) {
+ if (c & 1) {
+ c = (c >> 1) ^ CRC32_POLY;
+ } else {
+ c >>= 1;
+ }
+ }
+ crcContext->crc32_table[i] = c;
+ }
+#endif
+
+ return 0;
+}
+
+/* Complete CRC32 calculation on a memory block */
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
+{
+ if (SDLTest_Crc32CalcStart(crcContext,crc32)) {
+ return -1;
+ }
+
+ if (SDLTest_Crc32CalcBuffer(crcContext, inBuf, inLen, crc32)) {
+ return -1;
+ }
+
+ if (SDLTest_Crc32CalcEnd(crcContext, crc32)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Start crc calculation */
+
+int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32)
+{
+ /* Sanity check pointers */
+ if (crcContext==NULL) {
+ *crc32=0;
+ return -1;
+ }
+
+ /*
+ * Preload shift register, per CRC-32 spec
+ */
+ *crc32 = 0xffffffff;
+
+ return 0;
+}
+
+/* Finish crc calculation */
+
+int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32)
+{
+ /* Sanity check pointers */
+ if (crcContext==NULL) {
+ *crc32=0;
+ return -1;
+ }
+
+ /*
+ * Return complement, per CRC-32 spec
+ */
+ *crc32 = (~(*crc32));
+
+ return 0;
+}
+
+/* Include memory block in crc */
+
+int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
+{
+ CrcUint8 *p;
+ register CrcUint32 crc;
+
+ if (crcContext==NULL) {
+ *crc32=0;
+ return -1;
+ }
+
+ if (inBuf==NULL) {
+ return -1;
+ }
+
+ /*
+ * Calculate CRC from data
+ */
+ crc = *crc32;
+ for (p = inBuf; inLen > 0; ++p, --inLen) {
+#ifdef ORIGINAL_METHOD
+ crc = (crc << 8) ^ crcContext->crc32_table[(crc >> 24) ^ *p];
+#else
+ crc = ((crc >> 8) & 0x00FFFFFF) ^ crcContext->crc32_table[ (crc ^ *p) & 0xFF ];
+#endif
+ }
+ *crc32 = crc;
+
+ return 0;
+}
+
+int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext)
+{
+ if (crcContext==NULL) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_font.c b/src/3rdparty/SDL2/src/test/SDL_test_font.c
new file mode 100644
index 0000000..7825cc6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_font.c
@@ -0,0 +1,3250 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* ---- 8x8 font definition ---- */
+
+/* Originally part of SDL2_gfx */
+
+/* ZLIB (c) A. Schiffler 2012 */
+
+#define SDL_TESTFONTDATAMAX (8*256)
+
+static unsigned char SDLTest_FontData[SDL_TESTFONTDATAMAX] = {
+
+ /*
+ * 0 0x00 '^@'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 1 0x01 '^A'
+ */
+ 0x7e, /* 01111110 */
+ 0x81, /* 10000001 */
+ 0xa5, /* 10100101 */
+ 0x81, /* 10000001 */
+ 0xbd, /* 10111101 */
+ 0x99, /* 10011001 */
+ 0x81, /* 10000001 */
+ 0x7e, /* 01111110 */
+
+ /*
+ * 2 0x02 '^B'
+ */
+ 0x7e, /* 01111110 */
+ 0xff, /* 11111111 */
+ 0xdb, /* 11011011 */
+ 0xff, /* 11111111 */
+ 0xc3, /* 11000011 */
+ 0xe7, /* 11100111 */
+ 0xff, /* 11111111 */
+ 0x7e, /* 01111110 */
+
+ /*
+ * 3 0x03 '^C'
+ */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0x10, /* 00010000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 4 0x04 '^D'
+ */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0x10, /* 00010000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 5 0x05 '^E'
+ */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+
+ /*
+ * 6 0x06 '^F'
+ */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+
+ /*
+ * 7 0x07 '^G'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 8 0x08 '^H'
+ */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xe7, /* 11100111 */
+ 0xc3, /* 11000011 */
+ 0xc3, /* 11000011 */
+ 0xe7, /* 11100111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 9 0x09 '^I'
+ */
+ 0x00, /* 00000000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x42, /* 01000010 */
+ 0x42, /* 01000010 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 10 0x0a '^J'
+ */
+ 0xff, /* 11111111 */
+ 0xc3, /* 11000011 */
+ 0x99, /* 10011001 */
+ 0xbd, /* 10111101 */
+ 0xbd, /* 10111101 */
+ 0x99, /* 10011001 */
+ 0xc3, /* 11000011 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 11 0x0b '^K'
+ */
+ 0x0f, /* 00001111 */
+ 0x07, /* 00000111 */
+ 0x0f, /* 00001111 */
+ 0x7d, /* 01111101 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x78, /* 01111000 */
+
+ /*
+ * 12 0x0c '^L'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 13 0x0d '^M'
+ */
+ 0x3f, /* 00111111 */
+ 0x33, /* 00110011 */
+ 0x3f, /* 00111111 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x70, /* 01110000 */
+ 0xf0, /* 11110000 */
+ 0xe0, /* 11100000 */
+
+ /*
+ * 14 0x0e '^N'
+ */
+ 0x7f, /* 01111111 */
+ 0x63, /* 01100011 */
+ 0x7f, /* 01111111 */
+ 0x63, /* 01100011 */
+ 0x63, /* 01100011 */
+ 0x67, /* 01100111 */
+ 0xe6, /* 11100110 */
+ 0xc0, /* 11000000 */
+
+ /*
+ * 15 0x0f '^O'
+ */
+ 0x18, /* 00011000 */
+ 0xdb, /* 11011011 */
+ 0x3c, /* 00111100 */
+ 0xe7, /* 11100111 */
+ 0xe7, /* 11100111 */
+ 0x3c, /* 00111100 */
+ 0xdb, /* 11011011 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 16 0x10 '^P'
+ */
+ 0x80, /* 10000000 */
+ 0xe0, /* 11100000 */
+ 0xf8, /* 11111000 */
+ 0xfe, /* 11111110 */
+ 0xf8, /* 11111000 */
+ 0xe0, /* 11100000 */
+ 0x80, /* 10000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 17 0x11 '^Q'
+ */
+ 0x02, /* 00000010 */
+ 0x0e, /* 00001110 */
+ 0x3e, /* 00111110 */
+ 0xfe, /* 11111110 */
+ 0x3e, /* 00111110 */
+ 0x0e, /* 00001110 */
+ 0x02, /* 00000010 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 18 0x12 '^R'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 19 0x13 '^S'
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 20 0x14 '^T'
+ */
+ 0x7f, /* 01111111 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7b, /* 01111011 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 21 0x15 '^U'
+ */
+ 0x3e, /* 00111110 */
+ 0x61, /* 01100001 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x86, /* 10000110 */
+ 0x7c, /* 01111100 */
+
+ /*
+ * 22 0x16 '^V'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 23 0x17 '^W'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 24 0x18 '^X'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 25 0x19 '^Y'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 26 0x1a '^Z'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 27 0x1b '^['
+ */
+ 0x00, /* 00000000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xfe, /* 11111110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 28 0x1c '^\'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 29 0x1d '^]'
+ */
+ 0x00, /* 00000000 */
+ 0x24, /* 00100100 */
+ 0x66, /* 01100110 */
+ 0xff, /* 11111111 */
+ 0x66, /* 01100110 */
+ 0x24, /* 00100100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 30 0x1e '^^'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 31 0x1f '^_'
+ */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 32 0x20 ' '
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 33 0x21 '!'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 34 0x22 '"'
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x24, /* 00100100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 35 0x23 '#'
+ */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 36 0x24 '$'
+ */
+ 0x18, /* 00011000 */
+ 0x3e, /* 00111110 */
+ 0x60, /* 01100000 */
+ 0x3c, /* 00111100 */
+ 0x06, /* 00000110 */
+ 0x7c, /* 01111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 37 0x25 '%'
+ */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x66, /* 01100110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 38 0x26 '&'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 39 0x27 '''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 40 0x28 '('
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 41 0x29 ')'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 42 0x2a '*'
+ */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0xff, /* 11111111 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 43 0x2b '+'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 44 0x2c ','
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+
+ /*
+ * 45 0x2d '-'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 46 0x2e '.'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 47 0x2f '/'
+ */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+ 0x80, /* 10000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 48 0x30 '0'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 49 0x31 '1'
+ */
+ 0x18, /* 00011000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 50 0x32 '2'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x06, /* 00000110 */
+ 0x1c, /* 00011100 */
+ 0x30, /* 00110000 */
+ 0x66, /* 01100110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 51 0x33 '3'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x06, /* 00000110 */
+ 0x3c, /* 00111100 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 52 0x34 '4'
+ */
+ 0x1c, /* 00011100 */
+ 0x3c, /* 00111100 */
+ 0x6c, /* 01101100 */
+ 0xcc, /* 11001100 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x1e, /* 00011110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 53 0x35 '5'
+ */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 54 0x36 '6'
+ */
+ 0x38, /* 00111000 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 55 0x37 '7'
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 56 0x38 '8'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 57 0x39 '9'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x78, /* 01111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 58 0x3a ':'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 59 0x3b ';'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+
+ /*
+ * 60 0x3c '<'
+ */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 61 0x3d '='
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 62 0x3e '>'
+ */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 63 0x3f '?'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 64 0x40 '@'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xde, /* 11011110 */
+ 0xde, /* 11011110 */
+ 0xde, /* 11011110 */
+ 0xc0, /* 11000000 */
+ 0x78, /* 01111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 65 0x41 'A'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 66 0x42 'B'
+ */
+ 0xfc, /* 11111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 67 0x43 'C'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 68 0x44 'D'
+ */
+ 0xf8, /* 11111000 */
+ 0x6c, /* 01101100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x6c, /* 01101100 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 69 0x45 'E'
+ */
+ 0xfe, /* 11111110 */
+ 0x62, /* 01100010 */
+ 0x68, /* 01101000 */
+ 0x78, /* 01111000 */
+ 0x68, /* 01101000 */
+ 0x62, /* 01100010 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 70 0x46 'F'
+ */
+ 0xfe, /* 11111110 */
+ 0x62, /* 01100010 */
+ 0x68, /* 01101000 */
+ 0x78, /* 01111000 */
+ 0x68, /* 01101000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 71 0x47 'G'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xce, /* 11001110 */
+ 0x66, /* 01100110 */
+ 0x3a, /* 00111010 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 72 0x48 'H'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 73 0x49 'I'
+ */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 74 0x4a 'J'
+ */
+ 0x1e, /* 00011110 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x78, /* 01111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 75 0x4b 'K'
+ */
+ 0xe6, /* 11100110 */
+ 0x66, /* 01100110 */
+ 0x6c, /* 01101100 */
+ 0x78, /* 01111000 */
+ 0x6c, /* 01101100 */
+ 0x66, /* 01100110 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 76 0x4c 'L'
+ */
+ 0xf0, /* 11110000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x62, /* 01100010 */
+ 0x66, /* 01100110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 77 0x4d 'M'
+ */
+ 0xc6, /* 11000110 */
+ 0xee, /* 11101110 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 78 0x4e 'N'
+ */
+ 0xc6, /* 11000110 */
+ 0xe6, /* 11100110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0xce, /* 11001110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 79 0x4f 'O'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 80 0x50 'P'
+ */
+ 0xfc, /* 11111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 81 0x51 'Q'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xce, /* 11001110 */
+ 0x7c, /* 01111100 */
+ 0x0e, /* 00001110 */
+
+ /*
+ * 82 0x52 'R'
+ */
+ 0xfc, /* 11111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x6c, /* 01101100 */
+ 0x66, /* 01100110 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 83 0x53 'S'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 84 0x54 'T'
+ */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x5a, /* 01011010 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 85 0x55 'U'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 86 0x56 'V'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 87 0x57 'W'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 88 0x58 'X'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 89 0x59 'Y'
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 90 0x5a 'Z'
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x8c, /* 10001100 */
+ 0x18, /* 00011000 */
+ 0x32, /* 00110010 */
+ 0x66, /* 01100110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 91 0x5b '['
+ */
+ 0x3c, /* 00111100 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 92 0x5c '\'
+ */
+ 0xc0, /* 11000000 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x06, /* 00000110 */
+ 0x02, /* 00000010 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 93 0x5d ']'
+ */
+ 0x3c, /* 00111100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 94 0x5e '^'
+ */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 95 0x5f '_'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 96 0x60 '`'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 97 0x61 'a'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 98 0x62 'b'
+ */
+ 0xe0, /* 11100000 */
+ 0x60, /* 01100000 */
+ 0x7c, /* 01111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 99 0x63 'c'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 100 0x64 'd'
+ */
+ 0x1c, /* 00011100 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 101 0x65 'e'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 102 0x66 'f'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x60, /* 01100000 */
+ 0xf8, /* 11111000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 103 0x67 'g'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0xf8, /* 11111000 */
+
+ /*
+ * 104 0x68 'h'
+ */
+ 0xe0, /* 11100000 */
+ 0x60, /* 01100000 */
+ 0x6c, /* 01101100 */
+ 0x76, /* 01110110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 105 0x69 'i'
+ */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 106 0x6a 'j'
+ */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+
+ /*
+ * 107 0x6b 'k'
+ */
+ 0xe0, /* 11100000 */
+ 0x60, /* 01100000 */
+ 0x66, /* 01100110 */
+ 0x6c, /* 01101100 */
+ 0x78, /* 01111000 */
+ 0x6c, /* 01101100 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 108 0x6c 'l'
+ */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 109 0x6d 'm'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xec, /* 11101100 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 110 0x6e 'n'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 111 0x6f 'o'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 112 0x70 'p'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+
+ /*
+ * 113 0x71 'q'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0x1e, /* 00011110 */
+
+ /*
+ * 114 0x72 'r'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x76, /* 01110110 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 115 0x73 's'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 116 0x74 't'
+ */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0xfc, /* 11111100 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x36, /* 00110110 */
+ 0x1c, /* 00011100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 117 0x75 'u'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 118 0x76 'v'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 119 0x77 'w'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 120 0x78 'x'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 121 0x79 'y'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+
+ /*
+ * 122 0x7a 'z'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x4c, /* 01001100 */
+ 0x18, /* 00011000 */
+ 0x32, /* 00110010 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 123 0x7b '{'
+ */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x70, /* 01110000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0e, /* 00001110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 124 0x7c '|'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 125 0x7d '}'
+ */
+ 0x70, /* 01110000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 126 0x7e '~'
+ */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 127 0x7f ''
+ */
+ 0x00, /* 00000000 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 128 0x80 ''
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0x78, /* 01111000 */
+
+ /*
+ * 129 0x81 ''
+ */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 130 0x82 ''
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 131 0x83 ''
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 132 0x84 ''
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 133 0x85 ''
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 134 0x86 ''
+ */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 135 0x87 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x7e, /* 01111110 */
+ 0x0c, /* 00001100 */
+ 0x38, /* 00111000 */
+
+ /*
+ * 136 0x88 ''
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 137 0x89 ''
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 138 0x8a ''
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 139 0x8b ''
+ */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 140 0x8c ''
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 141 0x8d ''
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 142 0x8e ''
+ */
+ 0xc6, /* 11000110 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 143 0x8f ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 144 0x90 ''
+ */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xf8, /* 11111000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 145 0x91 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0xd8, /* 11011000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 146 0x92 ''
+ */
+ 0x3e, /* 00111110 */
+ 0x6c, /* 01101100 */
+ 0xcc, /* 11001100 */
+ 0xfe, /* 11111110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xce, /* 11001110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 147 0x93 ''
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 148 0x94 ''
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 149 0x95 ''
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 150 0x96 ''
+ */
+ 0x78, /* 01111000 */
+ 0x84, /* 10000100 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 151 0x97 ''
+ */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 152 0x98 ''
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+
+ /*
+ * 153 0x99 ''
+ */
+ 0xc6, /* 11000110 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 154 0x9a ''
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 155 0x9b ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 156 0x9c ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x64, /* 01100100 */
+ 0xf0, /* 11110000 */
+ 0x60, /* 01100000 */
+ 0x66, /* 01100110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 157 0x9d ''
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 158 0x9e ''
+ */
+ 0xf8, /* 11111000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xfa, /* 11111010 */
+ 0xc6, /* 11000110 */
+ 0xcf, /* 11001111 */
+ 0xc6, /* 11000110 */
+ 0xc7, /* 11000111 */
+
+ /*
+ * 159 0x9f ''
+ */
+ 0x0e, /* 00001110 */
+ 0x1b, /* 00011011 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 160 0xa0 ''
+ */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 161 0xa1 ''
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 162 0xa2 ''
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 163 0xa3 ''
+ */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 164 0xa4 ''
+ */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 165 0xa5 ''
+ */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0xe6, /* 11100110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0xce, /* 11001110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 166 0xa6 ''
+ */
+ 0x3c, /* 00111100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x3e, /* 00111110 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 167 0xa7 ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 168 0xa8 ''
+ */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x63, /* 01100011 */
+ 0x3e, /* 00111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 169 0xa9 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 170 0xaa ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 171 0xab ''
+ */
+ 0x63, /* 01100011 */
+ 0xe6, /* 11100110 */
+ 0x6c, /* 01101100 */
+ 0x7e, /* 01111110 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x0f, /* 00001111 */
+
+ /*
+ * 172 0xac ''
+ */
+ 0x63, /* 01100011 */
+ 0xe6, /* 11100110 */
+ 0x6c, /* 01101100 */
+ 0x7a, /* 01111010 */
+ 0x36, /* 00110110 */
+ 0x6a, /* 01101010 */
+ 0xdf, /* 11011111 */
+ 0x06, /* 00000110 */
+
+ /*
+ * 173 0xad ''
+ */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 174 0xae ''
+ */
+ 0x00, /* 00000000 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x66, /* 01100110 */
+ 0x33, /* 00110011 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 175 0xaf ''
+ */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0x66, /* 01100110 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 176 0xb0 ''
+ */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+
+ /*
+ * 177 0xb1 ''
+ */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+
+ /*
+ * 178 0xb2 ''
+ */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+
+ /*
+ * 179 0xb3 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 180 0xb4 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 181 0xb5 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 182 0xb6 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 183 0xb7 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 184 0xb8 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 185 0xb9 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x06, /* 00000110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 186 0xba ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 187 0xbb ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 188 0xbc ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x06, /* 00000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 189 0xbd ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 190 0xbe ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 191 0xbf ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 192 0xc0 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 193 0xc1 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 194 0xc2 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 195 0xc3 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 196 0xc4 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 197 0xc5 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 198 0xc6 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 199 0xc7 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 200 0xc8 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x30, /* 00110000 */
+ 0x3f, /* 00111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 201 0xc9 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3f, /* 00111111 */
+ 0x30, /* 00110000 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 202 0xca ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf7, /* 11110111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 203 0xcb ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xf7, /* 11110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 204 0xcc ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x30, /* 00110000 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 205 0xcd ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 206 0xce ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf7, /* 11110111 */
+ 0x00, /* 00000000 */
+ 0xf7, /* 11110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 207 0xcf ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 208 0xd0 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 209 0xd1 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 210 0xd2 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 211 0xd3 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x3f, /* 00111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 212 0xd4 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 213 0xd5 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 214 0xd6 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3f, /* 00111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 215 0xd7 ''
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xff, /* 11111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 216 0xd8 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 217 0xd9 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 218 0xda ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 219 0xdb ''
+ */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 220 0xdc ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 221 0xdd ''
+ */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+
+ /*
+ * 222 0xde ''
+ */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+
+ /*
+ * 223 0xdf ''
+ */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 224 0xe0 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0xc8, /* 11001000 */
+ 0xdc, /* 11011100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 225 0xe1 ''
+ */
+ 0x78, /* 01111000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xd8, /* 11011000 */
+ 0xcc, /* 11001100 */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 226 0xe2 ''
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 227 0xe3 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 228 0xe4 ''
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 229 0xe5 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 230 0xe6 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0xc0, /* 11000000 */
+
+ /*
+ * 231 0xe7 ''
+ */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 232 0xe8 ''
+ */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+
+ /*
+ * 233 0xe9 ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 234 0xea ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0xee, /* 11101110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 235 0xeb ''
+ */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x3e, /* 00111110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 236 0xec ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 237 0xed ''
+ */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x7e, /* 01111110 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7e, /* 01111110 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+
+ /*
+ * 238 0xee ''
+ */
+ 0x1e, /* 00011110 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x7e, /* 01111110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x1e, /* 00011110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 239 0xef ''
+ */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 240 0xf0 ''
+ */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 241 0xf1 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 242 0xf2 ''
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 243 0xf3 ''
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 244 0xf4 ''
+ */
+ 0x0e, /* 00001110 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 245 0xf5 ''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+
+ /*
+ * 246 0xf6 ''
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 247 0xf7 ''
+ */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 248 0xf8 ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 249 0xf9 ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 250 0xfa ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 251 0xfb ''
+ */
+ 0x0f, /* 00001111 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0xec, /* 11101100 */
+ 0x6c, /* 01101100 */
+ 0x3c, /* 00111100 */
+ 0x1c, /* 00011100 */
+
+ /*
+ * 252 0xfc ''
+ */
+ 0x6c, /* 01101100 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 253 0xfd ''
+ */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 254 0xfe ''
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 255 0xff ' '
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+};
+
+
+/* ---- Character */
+
+/*!
+\brief Global cache for 8x8 pixel font textures created at runtime.
+*/
+static SDL_Texture *SDLTest_CharTextureCache[256];
+
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c)
+{
+ const Uint32 charWidth = FONT_CHARACTER_SIZE;
+ const Uint32 charHeight = FONT_CHARACTER_SIZE;
+ const Uint32 charSize = FONT_CHARACTER_SIZE;
+ SDL_Rect srect;
+ SDL_Rect drect;
+ int result;
+ Uint32 ix, iy;
+ const unsigned char *charpos;
+ Uint8 *curpos;
+ Uint8 patt, mask;
+ Uint8 *linepos;
+ Uint32 pitch;
+ SDL_Surface *character;
+ Uint32 ci;
+ Uint8 r, g, b, a;
+
+ /*
+ * Setup source rectangle
+ */
+ srect.x = 0;
+ srect.y = 0;
+ srect.w = charWidth;
+ srect.h = charHeight;
+
+ /*
+ * Setup destination rectangle
+ */
+ drect.x = x;
+ drect.y = y;
+ drect.w = charWidth;
+ drect.h = charHeight;
+
+ /* Character index in cache */
+ ci = (unsigned char)c;
+
+ /*
+ * Create new charWidth x charHeight bitmap surface if not already present.
+ */
+ if (SDLTest_CharTextureCache[ci] == NULL) {
+ /*
+ * Redraw character into surface
+ */
+ character = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ charWidth, charHeight, 32,
+ 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
+ if (character == NULL) {
+ return (-1);
+ }
+
+ charpos = SDLTest_FontData + ci * charSize;
+ linepos = (Uint8 *)character->pixels;
+ pitch = character->pitch;
+
+ /*
+ * Drawing loop
+ */
+ patt = 0;
+ for (iy = 0; iy < charWidth; iy++) {
+ mask = 0x00;
+ curpos = linepos;
+ for (ix = 0; ix < charWidth; ix++) {
+ if (!(mask >>= 1)) {
+ patt = *charpos++;
+ mask = 0x80;
+ }
+ if (patt & mask) {
+ *(Uint32 *)curpos = 0xffffffff;
+ } else {
+ *(Uint32 *)curpos = 0;
+ }
+ curpos += 4;
+ }
+ linepos += pitch;
+ }
+
+ /* Convert temp surface into texture */
+ SDLTest_CharTextureCache[ci] = SDL_CreateTextureFromSurface(renderer, character);
+ SDL_FreeSurface(character);
+
+ /*
+ * Check pointer
+ */
+ if (SDLTest_CharTextureCache[ci] == NULL) {
+ return (-1);
+ }
+ }
+
+ /*
+ * Set color
+ */
+ result = 0;
+ result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a);
+ result |= SDL_SetTextureColorMod(SDLTest_CharTextureCache[ci], r, g, b);
+ result |= SDL_SetTextureAlphaMod(SDLTest_CharTextureCache[ci], a);
+
+ /*
+ * Draw texture onto destination
+ */
+ result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect);
+
+ return (result);
+}
+
+int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s)
+{
+ const Uint32 charWidth = FONT_CHARACTER_SIZE;
+ int result = 0;
+ int curx = x;
+ int cury = y;
+ const char *curchar = s;
+
+ while (*curchar && !result) {
+ result |= SDLTest_DrawCharacter(renderer, curx, cury, *curchar);
+ curx += charWidth;
+ curchar++;
+ }
+
+ return (result);
+}
+
+void SDLTest_CleanupTextDrawing(void)
+{
+ unsigned int i;
+ for (i = 0; i < SDL_arraysize(SDLTest_CharTextureCache); ++i) {
+ if (SDLTest_CharTextureCache[i]) {
+ SDL_DestroyTexture(SDLTest_CharTextureCache[i]);
+ SDLTest_CharTextureCache[i] = NULL;
+ }
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_fuzzer.c b/src/3rdparty/SDL2/src/test/SDL_test_fuzzer.c
new file mode 100644
index 0000000..eee56a9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_fuzzer.c
@@ -0,0 +1,534 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+
+ Data generators for fuzzing test data in a reproducible way.
+
+*/
+
+#include "SDL_config.h"
+
+#include <limits.h>
+/* Visual Studio 2008 doesn't have stdint.h */
+#if defined(_MSC_VER) && _MSC_VER <= 1500
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define INT64_MIN _I64_MIN
+#define INT64_MAX _I64_MAX
+#define UINT64_MAX _UI64_MAX
+#else
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "SDL_test.h"
+
+/**
+ * Counter for fuzzer invocations
+ */
+static int fuzzerInvocationCounter = 0;
+
+/**
+ * Context for shared random number generator
+ */
+static SDLTest_RandomContext rndContext;
+
+/*
+ * Note: doxygen documentation markup for functions is in the header file.
+ */
+
+void
+SDLTest_FuzzerInit(Uint64 execKey)
+{
+ Uint32 a = (execKey >> 32) & 0x00000000FFFFFFFF;
+ Uint32 b = execKey & 0x00000000FFFFFFFF;
+ SDL_memset((void *)&rndContext, 0, sizeof(SDLTest_RandomContext));
+ SDLTest_RandomInit(&rndContext, a, b);
+ fuzzerInvocationCounter = 0;
+}
+
+int
+SDLTest_GetFuzzerInvocationCount()
+{
+ return fuzzerInvocationCounter;
+}
+
+Uint8
+SDLTest_RandomUint8()
+{
+ fuzzerInvocationCounter++;
+
+ return (Uint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
+}
+
+Sint8
+SDLTest_RandomSint8()
+{
+ fuzzerInvocationCounter++;
+
+ return (Sint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
+}
+
+Uint16
+SDLTest_RandomUint16()
+{
+ fuzzerInvocationCounter++;
+
+ return (Uint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
+}
+
+Sint16
+SDLTest_RandomSint16()
+{
+ fuzzerInvocationCounter++;
+
+ return (Sint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
+}
+
+Sint32
+SDLTest_RandomSint32()
+{
+ fuzzerInvocationCounter++;
+
+ return (Sint32) SDLTest_RandomInt(&rndContext);
+}
+
+Uint32
+SDLTest_RandomUint32()
+{
+ fuzzerInvocationCounter++;
+
+ return (Uint32) SDLTest_RandomInt(&rndContext);
+}
+
+Uint64
+SDLTest_RandomUint64()
+{
+ union {
+ Uint64 v64;
+ Uint32 v32[2];
+ } value;
+ value.v64 = 0;
+
+ fuzzerInvocationCounter++;
+
+ value.v32[0] = SDLTest_RandomSint32();
+ value.v32[1] = SDLTest_RandomSint32();
+
+ return value.v64;
+}
+
+Sint64
+SDLTest_RandomSint64()
+{
+ union {
+ Uint64 v64;
+ Uint32 v32[2];
+ } value;
+ value.v64 = 0;
+
+ fuzzerInvocationCounter++;
+
+ value.v32[0] = SDLTest_RandomSint32();
+ value.v32[1] = SDLTest_RandomSint32();
+
+ return (Sint64)value.v64;
+}
+
+
+
+Sint32
+SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
+{
+ Sint64 min = pMin;
+ Sint64 max = pMax;
+ Sint64 temp;
+ Sint64 number;
+
+ if(pMin > pMax) {
+ temp = min;
+ min = max;
+ max = temp;
+ } else if(pMin == pMax) {
+ return (Sint32)min;
+ }
+
+ number = SDLTest_RandomUint32();
+ /* invocation count increment in preceeding call */
+
+ return (Sint32)((number % ((max + 1) - min)) + min);
+}
+
+/* !
+ * Generates a unsigned boundary value between the given boundaries.
+ * Boundary values are inclusive. See the examples below.
+ * If boundary2 < boundary1, the values are swapped.
+ * If boundary1 == boundary2, value of boundary1 will be returned
+ *
+ * Generating boundary values for Uint8:
+ * BoundaryValues(UINT8_MAX, 10, 20, True) -> [10,11,19,20]
+ * BoundaryValues(UINT8_MAX, 10, 20, False) -> [9,21]
+ * BoundaryValues(UINT8_MAX, 0, 15, True) -> [0, 1, 14, 15]
+ * BoundaryValues(UINT8_MAX, 0, 15, False) -> [16]
+ * BoundaryValues(UINT8_MAX, 0, 0xFF, False) -> [0], error set
+ *
+ * Generator works the same for other types of unsigned integers.
+ *
+ * \param maxValue The biggest value that is acceptable for this data type.
+ * For instance, for Uint8 -> 255, Uint16 -> 65536 etc.
+ * \param boundary1 defines lower boundary
+ * \param boundary2 defines upper boundary
+ * \param validDomain Generate only for valid domain (for the data type)
+ *
+ * \returns Returns a random boundary value for the domain or 0 in case of error
+ */
+static Uint64
+SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
+{
+ Uint64 b1, b2;
+ Uint64 delta;
+ Uint64 tempBuf[4];
+ Uint8 index;
+
+ /* Maybe swap */
+ if (boundary1 > boundary2) {
+ b1 = boundary2;
+ b2 = boundary1;
+ } else {
+ b1 = boundary1;
+ b2 = boundary2;
+ }
+
+ index = 0;
+ if (validDomain == SDL_TRUE) {
+ if (b1 == b2) {
+ return b1;
+ }
+
+ /* Generate up to 4 values within bounds */
+ delta = b2 - b1;
+ if (delta < 4) {
+ do {
+ tempBuf[index] = b1 + index;
+ index++;
+ } while (index < delta);
+ } else {
+ tempBuf[index] = b1;
+ index++;
+ tempBuf[index] = b1 + 1;
+ index++;
+ tempBuf[index] = b2 - 1;
+ index++;
+ tempBuf[index] = b2;
+ index++;
+ }
+ } else {
+ /* Generate up to 2 values outside of bounds */
+ if (b1 > 0) {
+ tempBuf[index] = b1 - 1;
+ index++;
+ }
+
+ if (b2 < maxValue) {
+ tempBuf[index] = b2 + 1;
+ index++;
+ }
+ }
+
+ if (index == 0) {
+ /* There are no valid boundaries */
+ SDL_Unsupported();
+ return 0;
+ }
+
+ return tempBuf[SDLTest_RandomUint8() % index];
+}
+
+
+Uint8
+SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)
+{
+ /* max value for Uint8 */
+ const Uint64 maxValue = UCHAR_MAX;
+ return (Uint8)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
+}
+
+Uint16
+SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain)
+{
+ /* max value for Uint16 */
+ const Uint64 maxValue = USHRT_MAX;
+ return (Uint16)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
+}
+
+Uint32
+SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain)
+{
+ /* max value for Uint32 */
+ #if ((ULONG_MAX) == (UINT_MAX))
+ const Uint64 maxValue = ULONG_MAX;
+ #else
+ const Uint64 maxValue = UINT_MAX;
+ #endif
+ return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
+}
+
+Uint64
+SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
+{
+ /* max value for Uint64 */
+ const Uint64 maxValue = UINT64_MAX;
+ return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
+}
+
+/* !
+ * Generates a signed boundary value between the given boundaries.
+ * Boundary values are inclusive. See the examples below.
+ * If boundary2 < boundary1, the values are swapped.
+ * If boundary1 == boundary2, value of boundary1 will be returned
+ *
+ * Generating boundary values for Sint8:
+ * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -10, 20, True) -> [-10,-9,19,20]
+ * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -10, 20, False) -> [-11,21]
+ * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -30, -15, True) -> [-30, -29, -16, -15]
+ * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -127, 15, False) -> [16]
+ * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -127, 127, False) -> [0], error set
+ *
+ * Generator works the same for other types of signed integers.
+ *
+ * \param minValue The smallest value that is acceptable for this data type.
+ * For instance, for Uint8 -> -127, etc.
+ * \param maxValue The biggest value that is acceptable for this data type.
+ * For instance, for Uint8 -> 127, etc.
+ * \param boundary1 defines lower boundary
+ * \param boundary2 defines upper boundary
+ * \param validDomain Generate only for valid domain (for the data type)
+ *
+ * \returns Returns a random boundary value for the domain or 0 in case of error
+ */
+static Sint64
+SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
+{
+ Sint64 b1, b2;
+ Sint64 delta;
+ Sint64 tempBuf[4];
+ Uint8 index;
+
+ /* Maybe swap */
+ if (boundary1 > boundary2) {
+ b1 = boundary2;
+ b2 = boundary1;
+ } else {
+ b1 = boundary1;
+ b2 = boundary2;
+ }
+
+ index = 0;
+ if (validDomain == SDL_TRUE) {
+ if (b1 == b2) {
+ return b1;
+ }
+
+ /* Generate up to 4 values within bounds */
+ delta = b2 - b1;
+ if (delta < 4) {
+ do {
+ tempBuf[index] = b1 + index;
+ index++;
+ } while (index < delta);
+ } else {
+ tempBuf[index] = b1;
+ index++;
+ tempBuf[index] = b1 + 1;
+ index++;
+ tempBuf[index] = b2 - 1;
+ index++;
+ tempBuf[index] = b2;
+ index++;
+ }
+ } else {
+ /* Generate up to 2 values outside of bounds */
+ if (b1 > minValue) {
+ tempBuf[index] = b1 - 1;
+ index++;
+ }
+
+ if (b2 < maxValue) {
+ tempBuf[index] = b2 + 1;
+ index++;
+ }
+ }
+
+ if (index == 0) {
+ /* There are no valid boundaries */
+ SDL_Unsupported();
+ return minValue;
+ }
+
+ return tempBuf[SDLTest_RandomUint8() % index];
+}
+
+
+Sint8
+SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)
+{
+ /* min & max values for Sint8 */
+ const Sint64 maxValue = SCHAR_MAX;
+ const Sint64 minValue = SCHAR_MIN;
+ return (Sint8)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ (Sint64) boundary1, (Sint64) boundary2,
+ validDomain);
+}
+
+Sint16
+SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain)
+{
+ /* min & max values for Sint16 */
+ const Sint64 maxValue = SHRT_MAX;
+ const Sint64 minValue = SHRT_MIN;
+ return (Sint16)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ (Sint64) boundary1, (Sint64) boundary2,
+ validDomain);
+}
+
+Sint32
+SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain)
+{
+ /* min & max values for Sint32 */
+ #if ((ULONG_MAX) == (UINT_MAX))
+ const Sint64 maxValue = LONG_MAX;
+ const Sint64 minValue = LONG_MIN;
+ #else
+ const Sint64 maxValue = INT_MAX;
+ const Sint64 minValue = INT_MIN;
+ #endif
+ return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ (Sint64) boundary1, (Sint64) boundary2,
+ validDomain);
+}
+
+Sint64
+SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
+{
+ /* min & max values for Sint64 */
+ const Sint64 maxValue = INT64_MAX;
+ const Sint64 minValue = INT64_MIN;
+ return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ boundary1, boundary2,
+ validDomain);
+}
+
+float
+SDLTest_RandomUnitFloat()
+{
+ return SDLTest_RandomUint32() / (float) UINT_MAX;
+}
+
+float
+SDLTest_RandomFloat()
+{
+ return (float) (SDLTest_RandomUnitDouble() * (double)2.0 * (double)FLT_MAX - (double)(FLT_MAX));
+}
+
+double
+SDLTest_RandomUnitDouble()
+{
+ return (double) (SDLTest_RandomUint64() >> 11) * (1.0/9007199254740992.0);
+}
+
+double
+SDLTest_RandomDouble()
+{
+ double r = 0.0;
+ double s = 1.0;
+ do {
+ s /= UINT_MAX + 1.0;
+ r += (double)SDLTest_RandomInt(&rndContext) * s;
+ } while (s > DBL_EPSILON);
+
+ fuzzerInvocationCounter++;
+
+ return r;
+}
+
+
+char *
+SDLTest_RandomAsciiString()
+{
+ return SDLTest_RandomAsciiStringWithMaximumLength(255);
+}
+
+char *
+SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
+{
+ int size;
+
+ if(maxLength < 1) {
+ SDL_InvalidParamError("maxLength");
+ return NULL;
+ }
+
+ size = (SDLTest_RandomUint32() % (maxLength + 1));
+
+ return SDLTest_RandomAsciiStringOfSize(size);
+}
+
+char *
+SDLTest_RandomAsciiStringOfSize(int size)
+{
+ char *string;
+ int counter;
+
+
+ if(size < 1) {
+ SDL_InvalidParamError("size");
+ return NULL;
+ }
+
+ string = (char *)SDL_malloc((size + 1) * sizeof(char));
+ if (string==NULL) {
+ return NULL;
+ }
+
+ for(counter = 0; counter < size; ++counter) {
+ string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
+ }
+
+ string[counter] = '\0';
+
+ fuzzerInvocationCounter++;
+
+ return string;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_harness.c b/src/3rdparty/SDL2/src/test/SDL_test_harness.c
new file mode 100644
index 0000000..15021c6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_harness.c
@@ -0,0 +1,680 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/* Invalid test name/description message format */
+#define SDLTEST_INVALID_NAME_FORMAT "(Invalid)"
+
+/* Log summary message format */
+#define SDLTEST_LOG_SUMMARY_FORMAT "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d"
+
+/* Final result message format */
+#define SDLTEST_FINAL_RESULT_FORMAT ">>> %s '%s': %s\n"
+
+/* ! \brief Timeout for single test case execution */
+static Uint32 SDLTest_TestCaseTimeout = 3600;
+
+/**
+* Generates a random run seed string for the harness. The generated seed
+* will contain alphanumeric characters (0-9A-Z).
+*
+* Note: The returned string needs to be deallocated by the caller.
+*
+* \param length The length of the seed string to generate
+*
+* \returns The generated seed string
+*/
+char *
+SDLTest_GenerateRunSeed(const int length)
+{
+ char *seed = NULL;
+ SDLTest_RandomContext randomContext;
+ int counter;
+
+ /* Sanity check input */
+ if (length <= 0) {
+ SDLTest_LogError("The length of the harness seed must be >0.");
+ return NULL;
+ }
+
+ /* Allocate output buffer */
+ seed = (char *)SDL_malloc((length + 1) * sizeof(char));
+ if (seed == NULL) {
+ SDLTest_LogError("SDL_malloc for run seed output buffer failed.");
+ SDL_Error(SDL_ENOMEM);
+ return NULL;
+ }
+
+ /* Generate a random string of alphanumeric characters */
+ SDLTest_RandomInitTime(&randomContext);
+ for (counter = 0; counter < length; counter++) {
+ unsigned int number = SDLTest_Random(&randomContext);
+ char ch = (char) (number % (91 - 48)) + 48;
+ if (ch >= 58 && ch <= 64) {
+ ch = 65;
+ }
+ seed[counter] = ch;
+ }
+ seed[length] = '\0';
+
+ return seed;
+}
+
+/**
+* Generates an execution key for the fuzzer.
+*
+* \param runSeed The run seed to use
+* \param suiteName The name of the test suite
+* \param testName The name of the test
+* \param iteration The iteration count
+*
+* \returns The generated execution key to initialize the fuzzer with.
+*
+*/
+static Uint64
+SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration)
+{
+ SDLTest_Md5Context md5Context;
+ Uint64 *keys;
+ char iterationString[16];
+ size_t runSeedLength;
+ size_t suiteNameLength;
+ size_t testNameLength;
+ size_t iterationStringLength;
+ size_t entireStringLength;
+ char *buffer;
+
+ if (runSeed == NULL || runSeed[0] == '\0') {
+ SDLTest_LogError("Invalid runSeed string.");
+ return -1;
+ }
+
+ if (suiteName == NULL || suiteName[0] == '\0') {
+ SDLTest_LogError("Invalid suiteName string.");
+ return -1;
+ }
+
+ if (testName == NULL || testName[0] == '\0') {
+ SDLTest_LogError("Invalid testName string.");
+ return -1;
+ }
+
+ if (iteration <= 0) {
+ SDLTest_LogError("Invalid iteration count.");
+ return -1;
+ }
+
+ /* Convert iteration number into a string */
+ SDL_memset(iterationString, 0, sizeof(iterationString));
+ SDL_snprintf(iterationString, sizeof(iterationString) - 1, "%d", iteration);
+
+ /* Combine the parameters into single string */
+ runSeedLength = SDL_strlen(runSeed);
+ suiteNameLength = SDL_strlen(suiteName);
+ testNameLength = SDL_strlen(testName);
+ iterationStringLength = SDL_strlen(iterationString);
+ entireStringLength = runSeedLength + suiteNameLength + testNameLength + iterationStringLength + 1;
+ buffer = (char *)SDL_malloc(entireStringLength);
+ if (buffer == NULL) {
+ SDLTest_LogError("Failed to allocate buffer for execKey generation.");
+ SDL_Error(SDL_ENOMEM);
+ return 0;
+ }
+ SDL_snprintf(buffer, entireStringLength, "%s%s%s%d", runSeed, suiteName, testName, iteration);
+
+ /* Hash string and use half of the digest as 64bit exec key */
+ SDLTest_Md5Init(&md5Context);
+ SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, (unsigned int) entireStringLength);
+ SDLTest_Md5Final(&md5Context);
+ SDL_free(buffer);
+ keys = (Uint64 *)md5Context.digest;
+
+ return keys[0];
+}
+
+/**
+* \brief Set timeout handler for test.
+*
+* Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before.
+*
+* \param timeout Timeout interval in seconds.
+* \param callback Function that will be called after timeout has elapsed.
+*
+* \return Timer id or -1 on failure.
+*/
+static SDL_TimerID
+SDLTest_SetTestTimeout(int timeout, void (*callback)())
+{
+ Uint32 timeoutInMilliseconds;
+ SDL_TimerID timerID;
+
+ if (callback == NULL) {
+ SDLTest_LogError("Timeout callback can't be NULL");
+ return -1;
+ }
+
+ if (timeout < 0) {
+ SDLTest_LogError("Timeout value must be bigger than zero.");
+ return -1;
+ }
+
+ /* Init SDL timer if not initialized before */
+ if (SDL_WasInit(SDL_INIT_TIMER) == 0) {
+ if (SDL_InitSubSystem(SDL_INIT_TIMER)) {
+ SDLTest_LogError("Failed to init timer subsystem: %s", SDL_GetError());
+ return -1;
+ }
+ }
+
+ /* Set timer */
+ timeoutInMilliseconds = timeout * 1000;
+ timerID = SDL_AddTimer(timeoutInMilliseconds, (SDL_TimerCallback)callback, 0x0);
+ if (timerID == 0) {
+ SDLTest_LogError("Creation of SDL timer failed: %s", SDL_GetError());
+ return -1;
+ }
+
+ return timerID;
+}
+
+/**
+* \brief Timeout handler. Aborts test run and exits harness process.
+*/
+static SDL_NORETURN void
+SDLTest_BailOut()
+{
+ SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
+ exit(TEST_ABORTED); /* bail out from the test */
+}
+
+/**
+* \brief Execute a test using the given execution key.
+*
+* \param testSuite Suite containing the test case.
+* \param testCase Case to execute.
+* \param execKey Execution key for the fuzzer.
+* \param forceTestRun Force test to run even if test was disabled in suite.
+*
+* \returns Test case result.
+*/
+static int
+SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
+{
+ SDL_TimerID timer = 0;
+ int testCaseResult = 0;
+ int testResult = 0;
+ int fuzzerCount;
+
+ if (testSuite==NULL || testCase==NULL || testSuite->name==NULL || testCase->name==NULL)
+ {
+ SDLTest_LogError("Setup failure: testSuite or testCase references NULL");
+ return TEST_RESULT_SETUP_FAILURE;
+ }
+
+ if (!testCase->enabled && forceTestRun == SDL_FALSE)
+ {
+ SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Skipped (Disabled)");
+ return TEST_RESULT_SKIPPED;
+ }
+
+ /* Initialize fuzzer */
+ SDLTest_FuzzerInit(execKey);
+
+ /* Reset assert tracker */
+ SDLTest_ResetAssertSummary();
+
+ /* Set timeout timer */
+ timer = SDLTest_SetTestTimeout(SDLTest_TestCaseTimeout, SDLTest_BailOut);
+
+ /* Maybe run suite initalizer function */
+ if (testSuite->testSetUp) {
+ testSuite->testSetUp(0x0);
+ if (SDLTest_AssertSummaryToTestResult() == TEST_RESULT_FAILED) {
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Suite Setup", testSuite->name, "Failed");
+ return TEST_RESULT_SETUP_FAILURE;
+ }
+ }
+
+ /* Run test case function */
+ testCaseResult = testCase->testCase(0x0);
+
+ /* Convert test execution result into harness result */
+ if (testCaseResult == TEST_SKIPPED) {
+ /* Test was programatically skipped */
+ testResult = TEST_RESULT_SKIPPED;
+ } else if (testCaseResult == TEST_STARTED) {
+ /* Test did not return a TEST_COMPLETED value; assume it failed */
+ testResult = TEST_RESULT_FAILED;
+ } else if (testCaseResult == TEST_ABORTED) {
+ /* Test was aborted early; assume it failed */
+ testResult = TEST_RESULT_FAILED;
+ } else {
+ /* Perform failure analysis based on asserts */
+ testResult = SDLTest_AssertSummaryToTestResult();
+ }
+
+ /* Maybe run suite cleanup function (ignore failed asserts) */
+ if (testSuite->testTearDown) {
+ testSuite->testTearDown(0x0);
+ }
+
+ /* Cancel timeout timer */
+ if (timer) {
+ SDL_RemoveTimer(timer);
+ }
+
+ /* Report on asserts and fuzzer usage */
+ fuzzerCount = SDLTest_GetFuzzerInvocationCount();
+ if (fuzzerCount > 0) {
+ SDLTest_Log("Fuzzer invocations: %d", fuzzerCount);
+ }
+
+ /* Final log based on test execution result */
+ if (testCaseResult == TEST_SKIPPED) {
+ /* Test was programatically skipped */
+ SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Skipped (Programmatically)");
+ } else if (testCaseResult == TEST_STARTED) {
+ /* Test did not return a TEST_COMPLETED value; assume it failed */
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Failed (test started, but did not return TEST_COMPLETED)");
+ } else if (testCaseResult == TEST_ABORTED) {
+ /* Test was aborted early; assume it failed */
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Failed (Aborted)");
+ } else {
+ SDLTest_LogAssertSummary();
+ }
+
+ return testResult;
+}
+
+/* Prints summary of all suites/tests contained in the given reference */
+#if 0
+static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
+{
+ int suiteCounter;
+ int testCounter;
+ SDLTest_TestSuiteReference *testSuite;
+ SDLTest_TestCaseReference *testCase;
+
+ /* Loop over all suites */
+ suiteCounter = 0;
+ while(&testSuites[suiteCounter]) {
+ testSuite=&testSuites[suiteCounter];
+ suiteCounter++;
+ SDLTest_Log("Test Suite %i - %s\n", suiteCounter,
+ (testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
+
+ /* Loop over all test cases */
+ testCounter = 0;
+ while(testSuite->testCases[testCounter])
+ {
+ testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
+ testCounter++;
+ SDLTest_Log(" Test Case %i - %s: %s", testCounter,
+ (testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT,
+ (testCase->description) ? testCase->description : SDLTEST_INVALID_NAME_FORMAT);
+ }
+ }
+}
+#endif
+
+/* Gets a timer value in seconds */
+static float GetClock()
+{
+ float currentClock = clock() / (float) CLOCKS_PER_SEC;
+ return currentClock;
+}
+
+/**
+* \brief Execute a test suite using the given run seed and execution key.
+*
+* The filter string is matched to the suite name (full comparison) to select a single suite,
+* or if no suite matches, it is matched to the test names (full comparison) to select a single test.
+*
+* \param testSuites Suites containing the test case.
+* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
+* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
+* \param filter Filter specification. NULL disables. Case sensitive.
+* \param testIterations Number of iterations to run each test case.
+*
+* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
+*/
+int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations)
+{
+ int totalNumberOfTests = 0;
+ int failedNumberOfTests = 0;
+ int suiteCounter;
+ int testCounter;
+ int iterationCounter;
+ SDLTest_TestSuiteReference *testSuite;
+ const SDLTest_TestCaseReference *testCase;
+ const char *runSeed = NULL;
+ char *currentSuiteName;
+ char *currentTestName;
+ Uint64 execKey;
+ float runStartSeconds;
+ float suiteStartSeconds;
+ float testStartSeconds;
+ float runEndSeconds;
+ float suiteEndSeconds;
+ float testEndSeconds;
+ float runtime;
+ int suiteFilter = 0;
+ char *suiteFilterName = NULL;
+ int testFilter = 0;
+ char *testFilterName = NULL;
+ SDL_bool forceTestRun = SDL_FALSE;
+ int testResult = 0;
+ int runResult = 0;
+ Uint32 totalTestFailedCount = 0;
+ Uint32 totalTestPassedCount = 0;
+ Uint32 totalTestSkippedCount = 0;
+ Uint32 testFailedCount = 0;
+ Uint32 testPassedCount = 0;
+ Uint32 testSkippedCount = 0;
+ Uint32 countSum = 0;
+ const SDLTest_TestCaseReference **failedTests;
+
+ /* Sanitize test iterations */
+ if (testIterations < 1) {
+ testIterations = 1;
+ }
+
+ /* Generate run see if we don't have one already */
+ if (userRunSeed == NULL || userRunSeed[0] == '\0') {
+ runSeed = SDLTest_GenerateRunSeed(16);
+ if (runSeed == NULL) {
+ SDLTest_LogError("Generating a random seed failed");
+ return 2;
+ }
+ } else {
+ runSeed = userRunSeed;
+ }
+
+
+ /* Reset per-run counters */
+ totalTestFailedCount = 0;
+ totalTestPassedCount = 0;
+ totalTestSkippedCount = 0;
+
+ /* Take time - run start */
+ runStartSeconds = GetClock();
+
+ /* Log run with fuzzer parameters */
+ SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
+
+ /* Count the total number of tests */
+ suiteCounter = 0;
+ while (testSuites[suiteCounter]) {
+ testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ suiteCounter++;
+ testCounter = 0;
+ while (testSuite->testCases[testCounter])
+ {
+ testCounter++;
+ totalNumberOfTests++;
+ }
+ }
+
+ /* Pre-allocate an array for tracking failed tests (potentially all test cases) */
+ failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *));
+ if (failedTests == NULL) {
+ SDLTest_LogError("Unable to allocate cache for failed tests");
+ SDL_Error(SDL_ENOMEM);
+ return -1;
+ }
+
+ /* Initialize filtering */
+ if (filter != NULL && filter[0] != '\0') {
+ /* Loop over all suites to check if we have a filter match */
+ suiteCounter = 0;
+ while (testSuites[suiteCounter] && suiteFilter == 0) {
+ testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ suiteCounter++;
+ if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
+ /* Matched a suite name */
+ suiteFilter = 1;
+ suiteFilterName = testSuite->name;
+ SDLTest_Log("Filtering: running only suite '%s'", suiteFilterName);
+ break;
+ }
+
+ /* Within each suite, loop over all test cases to check if we have a filter match */
+ testCounter = 0;
+ while (testSuite->testCases[testCounter] && testFilter == 0)
+ {
+ testCase = testSuite->testCases[testCounter];
+ testCounter++;
+ if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
+ /* Matched a test name */
+ suiteFilter = 1;
+ suiteFilterName = testSuite->name;
+ testFilter = 1;
+ testFilterName = testCase->name;
+ SDLTest_Log("Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);
+ break;
+ }
+ }
+ }
+
+ if (suiteFilter == 0 && testFilter == 0) {
+ SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter);
+ SDLTest_Log("Exit code: 2");
+ SDL_free((void *) failedTests);
+ return 2;
+ }
+ }
+
+ /* Loop over all suites */
+ suiteCounter = 0;
+ while(testSuites[suiteCounter]) {
+ testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
+ suiteCounter++;
+
+ /* Filter suite if flag set and we have a name */
+ if (suiteFilter == 1 && suiteFilterName != NULL && testSuite->name != NULL &&
+ SDL_strcmp(suiteFilterName, testSuite->name) != 0) {
+ /* Skip suite */
+ SDLTest_Log("===== Test Suite %i: '%s' skipped\n",
+ suiteCounter,
+ currentSuiteName);
+ } else {
+
+ /* Reset per-suite counters */
+ testFailedCount = 0;
+ testPassedCount = 0;
+ testSkippedCount = 0;
+
+ /* Take time - suite start */
+ suiteStartSeconds = GetClock();
+
+ /* Log suite started */
+ SDLTest_Log("===== Test Suite %i: '%s' started\n",
+ suiteCounter,
+ currentSuiteName);
+
+ /* Loop over all test cases */
+ testCounter = 0;
+ while(testSuite->testCases[testCounter])
+ {
+ testCase = testSuite->testCases[testCounter];
+ currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
+ testCounter++;
+
+ /* Filter tests if flag set and we have a name */
+ if (testFilter == 1 && testFilterName != NULL && testCase->name != NULL &&
+ SDL_strcmp(testFilterName, testCase->name) != 0) {
+ /* Skip test */
+ SDLTest_Log("===== Test Case %i.%i: '%s' skipped\n",
+ suiteCounter,
+ testCounter,
+ currentTestName);
+ } else {
+ /* Override 'disabled' flag if we specified a test filter (i.e. force run for debugging) */
+ if (testFilter == 1 && !testCase->enabled) {
+ SDLTest_Log("Force run of disabled test since test filter was set");
+ forceTestRun = SDL_TRUE;
+ }
+
+ /* Take time - test start */
+ testStartSeconds = GetClock();
+
+ /* Log test started */
+ SDLTest_Log("----- Test Case %i.%i: '%s' started",
+ suiteCounter,
+ testCounter,
+ currentTestName);
+ if (testCase->description != NULL && testCase->description[0] != '\0') {
+ SDLTest_Log("Test Description: '%s'",
+ (testCase->description) ? testCase->description : SDLTEST_INVALID_NAME_FORMAT);
+ }
+
+ /* Loop over all iterations */
+ iterationCounter = 0;
+ while(iterationCounter < testIterations)
+ {
+ iterationCounter++;
+
+ if (userExecKey != 0) {
+ execKey = userExecKey;
+ } else {
+ execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
+ }
+
+ SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
+ testResult = SDLTest_RunTest(testSuite, testCase, execKey, forceTestRun);
+
+ if (testResult == TEST_RESULT_PASSED) {
+ testPassedCount++;
+ totalTestPassedCount++;
+ } else if (testResult == TEST_RESULT_SKIPPED) {
+ testSkippedCount++;
+ totalTestSkippedCount++;
+ } else {
+ testFailedCount++;
+ totalTestFailedCount++;
+ }
+ }
+
+ /* Take time - test end */
+ testEndSeconds = GetClock();
+ runtime = testEndSeconds - testStartSeconds;
+ if (runtime < 0.0f) runtime = 0.0f;
+
+ if (testIterations > 1) {
+ /* Log test runtime */
+ SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
+ SDLTest_Log("Average Test runtime: %.5f sec", runtime / (float)testIterations);
+ } else {
+ /* Log test runtime */
+ SDLTest_Log("Total Test runtime: %.1f sec", runtime);
+ }
+
+ /* Log final test result */
+ switch (testResult) {
+ case TEST_RESULT_PASSED:
+ SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", currentTestName, "Passed");
+ break;
+ case TEST_RESULT_FAILED:
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Test", currentTestName, "Failed");
+ break;
+ case TEST_RESULT_NO_ASSERT:
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT,"Test", currentTestName, "No Asserts");
+ break;
+ }
+
+ /* Collect failed test case references for repro-step display */
+ if (testResult == TEST_RESULT_FAILED) {
+ failedTests[failedNumberOfTests] = testCase;
+ failedNumberOfTests++;
+ }
+ }
+ }
+
+ /* Take time - suite end */
+ suiteEndSeconds = GetClock();
+ runtime = suiteEndSeconds - suiteStartSeconds;
+ if (runtime < 0.0f) runtime = 0.0f;
+
+ /* Log suite runtime */
+ SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
+
+ /* Log summary and final Suite result */
+ countSum = testPassedCount + testFailedCount + testSkippedCount;
+ if (testFailedCount == 0)
+ {
+ SDLTest_Log(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
+ SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, "Passed");
+ }
+ else
+ {
+ SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, "Failed");
+ }
+
+ }
+ }
+
+ /* Take time - run end */
+ runEndSeconds = GetClock();
+ runtime = runEndSeconds - runStartSeconds;
+ if (runtime < 0.0f) runtime = 0.0f;
+
+ /* Log total runtime */
+ SDLTest_Log("Total Run runtime: %.1f sec", runtime);
+
+ /* Log summary and final run result */
+ countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
+ if (totalTestFailedCount == 0)
+ {
+ runResult = 0;
+ SDLTest_Log(SDLTEST_LOG_SUMMARY_FORMAT, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
+ SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Run /w seed", runSeed, "Passed");
+ }
+ else
+ {
+ runResult = 1;
+ SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
+ SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Run /w seed", runSeed, "Failed");
+ }
+
+ /* Print repro steps for failed tests */
+ if (failedNumberOfTests > 0) {
+ SDLTest_Log("Harness input to repro failures:");
+ for (testCounter = 0; testCounter < failedNumberOfTests; testCounter++) {
+ SDLTest_Log(" --seed %s --filter %s", runSeed, failedTests[testCounter]->name);
+ }
+ }
+ SDL_free((void *) failedTests);
+
+ SDLTest_Log("Exit code: %d", runResult);
+ return runResult;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_imageBlit.c b/src/3rdparty/SDL2/src/test/SDL_test_imageBlit.c
new file mode 100644
index 0000000..f5c251a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_imageBlit.c
@@ -0,0 +1,1559 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* GIMP RGB C-Source image dump (blit.c) */
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377"
+ "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0"
+ "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0"
+ "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377"
+ "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0"
+ "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377"
+ "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377"
+ "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0",
+};
+
+/**
+ * \brief Returns the Blit test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlit()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlit.pixel_data,
+ SDLTest_imageBlit.width,
+ SDLTest_imageBlit.height,
+ SDLTest_imageBlit.bytes_per_pixel * 8,
+ SDLTest_imageBlit.width * SDLTest_imageBlit.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\24\0\0\0\0\0\0"
+ "\0\0(\0\0(\0\0\0\0\0\0\0\0<\0\0<\0\0\0\0\0\0\0\0P\0\0P\0\0\0\0\0\0\0\0d\0"
+ "\0d\0\0\0\0\0\0\0\0x\0\0x\0\0\0\0\0\0\0\0\214\0\0\214\0\0\0\0\0\0\0\0\240"
+ "\0\0\240\0\0\0\0\0\0\0\0\264\0\0\264\0\0\0\0\0\0\0\0\310\0\0\310\0\0\0\0"
+ "\0\0\0\0\334\0\0\334\0\0\0\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360"
+ "\0\0\360\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\24\0\0\24\0\0\0\0\0(\0\0"
+ "(\0\0(\0\0\0\0\0<\0\0<\0\0<\0\0\0\0\0P\0\0P\0\0P\0\0\0\0\0d\0\0d\0\0d\0\0"
+ "\0\0\0x\0\0x\0\0x\0\0\0\0\0\214\0\0\214\0\0\214\0\0\0\0\0\240\0\0\240\0\0"
+ "\240\0\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\310\0\0\310\0\0\310\0\0\0\0"
+ "\0\334\0\0\334\0\0\334\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0"
+ "\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\24\0\0\24\0\0\0"
+ "\0\0(\0\0(\0\0(\0\0\0\0\0<\0\0<\0\0<\0\0\0\0\0P\0\0P\0\0P\0\0\0\0\0d\0\0"
+ "d\0\0d\0\0\0\0\0x\0\0x\0\0x\0\0\0\0\0\214\0\0\214\0\0\214\0\0\0\0\0\240\0"
+ "\0\240\0\0\240\0\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\310\0\0\310\0\0\310"
+ "\0\0\0\0\0\334\0\0\334\0\0\334\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0"
+ "\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0\0\0\0\0\0\0$\24\0"
+ "$\24\0\0\0\0\0\0\0$(\0$(\0\0\0\0\0\0\0$<\0$<\0\0\0\0\0\0\0$P\0$P\0\0\0\0"
+ "\0\0\0$d\0$d\0\0\0\0\0\0\0$x\0$x\0\0\0\0\0\0\0$\214\0$\214\0\0\0\0\0\0\0"
+ "$\240\0$\240\0\0\0\0\0\0\0$\264\0$\264\0\0\0\0\0\0\0$\310\0$\310\0\0\0\0"
+ "\0\0\0$\334\0$\334\0\0\0\0\0\0\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360"
+ "\0$\360\0$\360\0\0\0\0\0\0\0\0\360\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0$\0\0$\0\0$\0\0\0\0\0$\24\0$\24\0$\24\0\0\0\0$(\0$(\0$(\0\0\0\0"
+ "$<\0$<\0$<\0\0\0\0$P\0$P\0$P\0\0\0\0$d\0$d\0$d\0\0\0\0$x\0$x\0$x\0\0\0\0"
+ "$\214\0$\214\0$\214\0\0\0\0$\240\0$\240\0$\240\0\0\0\0$\264\0$\264\0$\264"
+ "\0\0\0\0$\310\0$\310\0$\310\0\0\0\0$\334\0$\334\0$\334\0\0\0\0$\360\0$\360"
+ "\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0"
+ "\0\0\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0$\0\0\0\0\0$\24\0"
+ "$\24\0$\24\0\0\0\0$(\0$(\0$(\0\0\0\0$<\0$<\0$<\0\0\0\0$P\0$P\0$P\0\0\0\0"
+ "$d\0$d\0$d\0\0\0\0$x\0$x\0$x\0\0\0\0$\214\0$\214\0$\214\0\0\0\0$\240\0$\240"
+ "\0$\240\0\0\0\0$\264\0$\264\0$\264\0\0\0\0$\310\0$\310\0$\310\0\0\0\0$\334"
+ "\0$\334\0$\334\0\0\0\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$"
+ "\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0\0\0\0\0\360\0\0\360\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0$\0\0$\0\0$\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0$\360\0$\360\0$\360\0$\360\0\0\0\0\0\360\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0$\0\0\0\0"
+ "\0\0\0\0H\0\0H\0\0\0\0\0\0\0\0H\24\0H\24\0\0\0\0\0\0\0H(\0H(\0\0\0\0\0\0"
+ "\0H<\0H<\0\0\0\0\0\0\0HP\0HP\0\0\0\0\0\0\0Hd\0Hd\0\0\0\0\0\0\0Hx\0Hx\0\0"
+ "\0\0\0\0\0H\214\0H\214\0\0\0\0\0\0\0H\240\0H\240\0\0\0\0\0\0\0H\264\0H\264"
+ "\0\0\0\0\0\0\0H\310\0H\310\0\0\0\0\0\0\0H\334\0H\334\0\0\0\0\0\0\0H\360\0"
+ "H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0\0\0\0\0\0\0$\360\0$\360"
+ "\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0\0\0\0H\0\0H\0\0H\0\0\0\0\0H\24\0H\24\0H\24"
+ "\0\0\0\0H(\0H(\0H(\0\0\0\0H<\0H<\0H<\0\0\0\0HP\0HP\0HP\0\0\0\0Hd\0Hd\0Hd"
+ "\0\0\0\0Hx\0Hx\0Hx\0\0\0\0H\214\0H\214\0H\214\0\0\0\0H\240\0H\240\0H\240"
+ "\0\0\0\0H\264\0H\264\0H\264\0\0\0\0H\310\0H\310\0H\310\0\0\0\0H\334\0H\334"
+ "\0H\334\0\0\0\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H"
+ "\360\0H\360\0H\360\0H\360\0\0\0\0$\360\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0\0\0\0H\0\0"
+ "H\0\0H\0\0\0\0\0H\24\0H\24\0H\24\0\0\0\0H(\0H(\0H(\0\0\0\0H<\0H<\0H<\0\0"
+ "\0\0HP\0HP\0HP\0\0\0\0Hd\0Hd\0Hd\0\0\0\0Hx\0Hx\0Hx\0\0\0\0H\214\0H\214\0"
+ "H\214\0\0\0\0H\240\0H\240\0H\240\0\0\0\0H\264\0H\264\0H\264\0\0\0\0H\310"
+ "\0H\310\0H\310\0\0\0\0H\334\0H\334\0H\334\0\0\0\0H\360\0H\360\0H\360\0H\360"
+ "\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0"
+ "\0\0\0$\360\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0$\0\0\0\0\0H\0\0H\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\360\0H\360\0H\360\0H\360\0\0\0\0$\360\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0H\0\0H\0\0H\0\0\0\0\0\0\0\0l\0\0l\0\0\0\0\0\0\0\0l\24\0l\24\0\0\0\0\0\0"
+ "\0l(\0l(\0\0\0\0\0\0\0l<\0l<\0\0\0\0\0\0\0lP\0lP\0\0\0\0\0\0\0ld\0ld\0\0"
+ "\0\0\0\0\0lx\0lx\0\0\0\0\0\0\0l\214\0l\214\0\0\0\0\0\0\0l\240\0l\240\0\0"
+ "\0\0\0\0\0l\264\0l\264\0\0\0\0\0\0\0l\310\0l\310\0\0\0\0\0\0\0l\334\0l\334"
+ "\0\0\0\0\0\0\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0\0"
+ "\0\0\0\0\0H\360\0H\360\0H\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0\0H\0\0\0\0\0l\0\0l\0\0l\0\0"
+ "\0\0\0l\24\0l\24\0l\24\0\0\0\0l(\0l(\0l(\0\0\0\0l<\0l<\0l<\0\0\0\0lP\0lP"
+ "\0lP\0\0\0\0ld\0ld\0ld\0\0\0\0lx\0lx\0lx\0\0\0\0l\214\0l\214\0l\214\0\0\0"
+ "\0l\240\0l\240\0l\240\0\0\0\0l\264\0l\264\0l\264\0\0\0\0l\310\0l\310\0l\310"
+ "\0\0\0\0l\334\0l\334\0l\334\0\0\0\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360"
+ "\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0\0\0\0H\360\0H\360\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0"
+ "\0H\0\0\0\0\0l\0\0l\0\0l\0\0\0\0\0l\24\0l\24\0l\24\0\0\0\0l(\0l(\0l(\0\0"
+ "\0\0l<\0l<\0l<\0\0\0\0lP\0lP\0lP\0\0\0\0ld\0ld\0ld\0\0\0\0lx\0lx\0lx\0\0"
+ "\0\0l\214\0l\214\0l\214\0\0\0\0l\240\0l\240\0l\240\0\0\0\0l\264\0l\264\0"
+ "l\264\0\0\0\0l\310\0l\310\0l\310\0\0\0\0l\334\0l\334\0l\334\0\0\0\0l\360"
+ "\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0"
+ "l\360\0l\360\0l\360\0\0\0\0H\360\0H\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0\0\0\0\0l\0\0l\0\0l\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0l\360\0l\360\0l\360\0l\360"
+ "\0\0\0\0H\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0l\0\0l\0\0l\0\0\0\0\0\0\0\0\220\0\0\220\0\0\0\0\0\0\0"
+ "\0\220\24\0\220\24\0\0\0\0\0\0\0\220(\0\220(\0\0\0\0\0\0\0\220<\0\220<\0"
+ "\0\0\0\0\0\0\220P\0\220P\0\0\0\0\0\0\0\220d\0\220d\0\0\0\0\0\0\0\220x\0\220"
+ "x\0\0\0\0\0\0\0\220\214\0\220\214\0\0\0\0\0\0\0\220\240\0\220\240\0\0\0\0"
+ "\0\0\0\220\264\0\220\264\0\0\0\0\0\0\0\220\310\0\220\310\0\0\0\0\0\0\0\220"
+ "\334\0\220\334\0\0\0\0\0\0\0\220\360\0\220\360\0\220\360\0\220\360\0\220"
+ "\360\0\220\360\0\220\360\0\220\360\0\0\0\0\0\0\0l\360\0l\360\0l\360\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0l\0\0l\0\0\0\0\0\220\0\0\220\0\0\220\0\0\0\0\0\220\24\0\220\24\0"
+ "\220\24\0\0\0\0\220(\0\220(\0\220(\0\0\0\0\220<\0\220<\0\220<\0\0\0\0\220"
+ "P\0\220P\0\220P\0\0\0\0\220d\0\220d\0\220d\0\0\0\0\220x\0\220x\0\220x\0\0"
+ "\0\0\220\214\0\220\214\0\220\214\0\0\0\0\220\240\0\220\240\0\220\240\0\0"
+ "\0\0\220\264\0\220\264\0\220\264\0\0\0\0\220\310\0\220\310\0\220\310\0\0"
+ "\0\0\220\334\0\220\334\0\220\334\0\0\0\0\220\360\0\220\360\0\220\360\0\220"
+ "\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360"
+ "\0\220\360\0\0\0\0l\360\0l\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0l\0\0l\0\0\0\0\0\220\0\0\220\0\0\220"
+ "\0\0\0\0\0\220\24\0\220\24\0\220\24\0\0\0\0\220(\0\220(\0\220(\0\0\0\0\220"
+ "<\0\220<\0\220<\0\0\0\0\220P\0\220P\0\220P\0\0\0\0\220d\0\220d\0\220d\0\0"
+ "\0\0\220x\0\220x\0\220x\0\0\0\0\220\214\0\220\214\0\220\214\0\0\0\0\220\240"
+ "\0\220\240\0\220\240\0\0\0\0\220\264\0\220\264\0\220\264\0\0\0\0\220\310"
+ "\0\220\310\0\220\310\0\0\0\0\220\334\0\220\334\0\220\334\0\0\0\0\220\360"
+ "\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0"
+ "\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\0\0\0l\360\0"
+ "l\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0l\0\0\0\0\0\220\0\0\220\0\0\220\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\220\360\0\220\360\0\220\360\0\220\360\0\0\0\0l\360"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\220\0\0\220\0\0\220\0\0\0\0\0\0\0\0\264\0\0\264\0\0\0\0\0\0\0\0"
+ "\264\24\0\264\24\0\0\0\0\0\0\0\264(\0\264(\0\0\0\0\0\0\0\264<\0\264<\0\0"
+ "\0\0\0\0\0\264P\0\264P\0\0\0\0\0\0\0\264d\0\264d\0\0\0\0\0\0\0\264x\0\264"
+ "x\0\0\0\0\0\0\0\264\214\0\264\214\0\0\0\0\0\0\0\264\240\0\264\240\0\0\0\0"
+ "\0\0\0\264\264\0\264\264\0\0\0\0\0\0\0\264\310\0\264\310\0\0\0\0\0\0\0\264"
+ "\334\0\264\334\0\0\0\0\0\0\0\264\360\0\264\360\0\264\360\0\264\360\0\264"
+ "\360\0\264\360\0\264\360\0\264\360\0\0\0\0\0\0\0\220\360\0\220\360\0\220"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\220\0\0\220\0\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\264"
+ "\24\0\264\24\0\264\24\0\0\0\0\264(\0\264(\0\264(\0\0\0\0\264<\0\264<\0\264"
+ "<\0\0\0\0\264P\0\264P\0\264P\0\0\0\0\264d\0\264d\0\264d\0\0\0\0\264x\0\264"
+ "x\0\264x\0\0\0\0\264\214\0\264\214\0\264\214\0\0\0\0\264\240\0\264\240\0"
+ "\264\240\0\0\0\0\264\264\0\264\264\0\264\264\0\0\0\0\264\310\0\264\310\0"
+ "\264\310\0\0\0\0\264\334\0\264\334\0\264\334\0\0\0\0\264\360\0\264\360\0"
+ "\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264"
+ "\360\0\264\360\0\264\360\0\0\0\0\220\360\0\220\360\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\220\0\0\220\0"
+ "\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\264\24\0\264\24\0\264\24\0\0\0\0\264"
+ "(\0\264(\0\264(\0\0\0\0\264<\0\264<\0\264<\0\0\0\0\264P\0\264P\0\264P\0\0"
+ "\0\0\264d\0\264d\0\264d\0\0\0\0\264x\0\264x\0\264x\0\0\0\0\264\214\0\264"
+ "\214\0\264\214\0\0\0\0\264\240\0\264\240\0\264\240\0\0\0\0\264\264\0\264"
+ "\264\0\264\264\0\0\0\0\264\310\0\264\310\0\264\310\0\0\0\0\264\334\0\264"
+ "\334\0\264\334\0\0\0\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0"
+ "\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264"
+ "\360\0\264\360\0\0\0\0\220\360\0\220\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\220\0\0\0\0\0\264\0\0\264\0\0"
+ "\264\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\360\0"
+ "\264\360\0\264\360\0\264\360\0\0\0\0\220\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\0\0\264\0\0\264"
+ "\0\0\0\0\0\0\0\0\330\0\0\330\0\0\0\0\0\0\0\0\330\24\0\330\24\0\0\0\0\0\0"
+ "\0\330(\0\330(\0\0\0\0\0\0\0\330<\0\330<\0\0\0\0\0\0\0\330P\0\330P\0\0\0"
+ "\0\0\0\0\330d\0\330d\0\0\0\0\0\0\0\330x\0\330x\0\0\0\0\0\0\0\330\214\0\330"
+ "\214\0\0\0\0\0\0\0\330\240\0\330\240\0\0\0\0\0\0\0\330\264\0\330\264\0\0"
+ "\0\0\0\0\0\330\310\0\330\310\0\0\0\0\0\0\0\330\334\0\330\334\0\0\0\0\0\0"
+ "\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0"
+ "\330\360\0\0\0\0\0\0\0\264\360\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\0\0"
+ "\264\0\0\0\0\0\330\0\0\330\0\0\330\0\0\0\0\0\330\24\0\330\24\0\330\24\0\0"
+ "\0\0\330(\0\330(\0\330(\0\0\0\0\330<\0\330<\0\330<\0\0\0\0\330P\0\330P\0"
+ "\330P\0\0\0\0\330d\0\330d\0\330d\0\0\0\0\330x\0\330x\0\330x\0\0\0\0\330\214"
+ "\0\330\214\0\330\214\0\0\0\0\330\240\0\330\240\0\330\240\0\0\0\0\330\264"
+ "\0\330\264\0\330\264\0\0\0\0\330\310\0\330\310\0\330\310\0\0\0\0\330\334"
+ "\0\330\334\0\330\334\0\0\0\0\330\360\0\330\360\0\330\360\0\330\360\0\330"
+ "\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360"
+ "\0\0\0\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\0\0\264\0\0\0\0\0\330\0\0\330\0\0"
+ "\330\0\0\0\0\0\330\24\0\330\24\0\330\24\0\0\0\0\330(\0\330(\0\330(\0\0\0"
+ "\0\330<\0\330<\0\330<\0\0\0\0\330P\0\330P\0\330P\0\0\0\0\330d\0\330d\0\330"
+ "d\0\0\0\0\330x\0\330x\0\330x\0\0\0\0\330\214\0\330\214\0\330\214\0\0\0\0"
+ "\330\240\0\330\240\0\330\240\0\0\0\0\330\264\0\330\264\0\330\264\0\0\0\0"
+ "\330\310\0\330\310\0\330\310\0\0\0\0\330\334\0\330\334\0\330\334\0\0\0\0"
+ "\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330"
+ "\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\0\0\0"
+ "\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\264\0\0\0\0\0\330\0\0\330\0\0\330\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\360\0\330\360\0\330\360\0\330"
+ "\360\0\0\0\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\0\0\330\0\0\330\0\0\0\0\0\0\0\0\374\0\0"
+ "\374\0\0\0\0\0\0\0\0\374\24\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0"
+ "\0\0\374<\0\374<\0\0\0\0\0\0\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0"
+ "\0\0\0\0\0\374x\0\374x\0\0\0\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374"
+ "\240\0\374\240\0\0\0\0\0\0\0\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374"
+ "\310\0\0\0\0\0\0\0\374\334\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\330"
+ "\360\0\330\360\0\330\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\0\0\330\0\0\0\0\0\374\0\0\374"
+ "\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0"
+ "\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d"
+ "\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0"
+ "\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0"
+ "\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0"
+ "\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\330"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\330\0\0\330\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0"
+ "\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0"
+ "\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x"
+ "\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374"
+ "\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374"
+ "\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\330\360\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330"
+ "\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0"
+ "\374(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374"
+ "P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0"
+ "\374\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0"
+ "\374\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0"
+ "\374\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374"
+ "\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0"
+ "\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d"
+ "\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0"
+ "\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0"
+ "\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0"
+ "\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374"
+ "\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374"
+ "<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0"
+ "\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240"
+ "\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310"
+ "\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360"
+ "\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374"
+ "(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374"
+ "d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374"
+ "\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374"
+ "\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374"
+ "\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\374\334"
+ "\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\374\334\0\0"
+ "\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0"
+ "\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374<\0\374"
+ "<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374"
+ "x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240\0\374"
+ "\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310\0\374"
+ "\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374"
+ "(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0"
+ "\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374"
+ "\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374"
+ "\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374"
+ "\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0"
+ "\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0"
+ "\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214"
+ "\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264"
+ "\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334"
+ "\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374"
+ "(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374"
+ "d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374"
+ "\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374"
+ "\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374"
+ "\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374"
+ "\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0"
+ "\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d"
+ "\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0"
+ "\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0"
+ "\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0"
+ "\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374"
+ "\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374"
+ "<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0"
+ "\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240"
+ "\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310"
+ "\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374"
+ "\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374"
+ "<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0"
+ "\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240"
+ "\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310"
+ "\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0\0\0\0\0\0\374\24"
+ "\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0\374<\0\0\0\0\0\0"
+ "\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374x\0\374x\0\0\0"
+ "\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240\0\0\0\0\0\0\0"
+ "\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0\0\0\0\374\334"
+ "\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0"
+ "\0\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0"
+ "\0\0\0\0\0\374\24\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0"
+ "\374<\0\0\0\0\0\0\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374"
+ "x\0\374x\0\0\0\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240"
+ "\0\0\0\0\0\0\0\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0"
+ "\0\0\0\374\334\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0\0\0\0\0\0\374\24\0"
+ "\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0\374<\0\0\0\0\0\0\0"
+ "\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374x\0\374x\0\0\0\0"
+ "\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240\0\0\0\0\0\0\0\374"
+ "\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0\0\0\0\374\334\0\374"
+ "\334\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0"
+ "\0\0\0\374(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P"
+ "\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374"
+ "\214\0\374\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374"
+ "\264\0\374\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374"
+ "\334\0\374\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0\0\0\0\0\0"
+ "\374\24\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0\374<\0\0"
+ "\0\0\0\0\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374x\0\374"
+ "x\0\0\0\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240\0\0\0\0"
+ "\0\0\0\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0\0\0\0\374"
+ "\334\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+};
+
+/**
+ * \brief Returns the BlitColor test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitColor()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitColor.pixel_data,
+ SDLTest_imageBlitColor.width,
+ SDLTest_imageBlitColor.height,
+ SDLTest_imageBlitColor.bytes_per_pixel * 8,
+ SDLTest_imageBlitColor.width * SDLTest_imageBlitColor.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\20\20\0"
+ "\20\20\0""88\0""88\0**\0**\0ZZ\0ZZ\0==\0==\0yy\0yy\0II\0II\0\224\224\0\224"
+ "\224\0NN\0NN\0\254\254\0\254\254\0MM\0MM\0\302\302\0\302\302\0HH\0HH\0\324"
+ "\324\0\324\324\0>>\0>>\0\343\343\0\343\343\0""00\0""00\0\356\356\0\356\356"
+ "\0\40\40\0\40\40\0\367\367\0\367\367\0\16\16\0\16\16\0\374\374\0\374\374"
+ "\0\374\374\0\374\374\0\360\360\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\24\24\0\24\24\0\24\24\0\20\20\0""88\0""88\0""88\0**\0ff\0ff\0ff\0FF\0"
+ "\215\215\0\215\215\0\215\215\0UU\0\255\255\0\255\255\0\255\255\0[[\0\306"
+ "\306\0\306\306\0\306\306\0YY\0\331\331\0\331\331\0\331\331\0PP\0\350\350"
+ "\0\350\350\0\350\350\0DD\0\362\362\0\362\362\0\362\362\0""44\0\370\370\0"
+ "\370\370\0\370\370\0\"\"\0\374\374\0\374\374\0\374\374\0\16\16\0\376\376"
+ "\0\376\376\0\376\376\0\376\376\0\374\374\0\374\374\0\374\374\0\374\374\0"
+ "\360\360\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\24\24\0\20\20\0""88\0"
+ """88\0""88\0**\0ff\0ff\0ff\0FF\0\226\226\0\226\226\0\215\215\0UU\0\271\271"
+ "\0\271\271\0\255\255\0[[\0\323\323\0\323\323\0\306\306\0YY\0\345\345\0\345"
+ "\345\0\331\331\0PP\0\360\360\0\360\360\0\350\350\0DD\0\370\370\0\370\370"
+ "\0\362\362\0""44\0\374\374\0\374\374\0\370\370\0\"\"\0\376\376\0\376\376"
+ "\0\374\374\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\374\374\0\374\374\0\374\374\0\374\374\0\360\360\0\360\360\0\360\360"
+ "\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24"
+ "\0\24\24\0\24\24\0\20\20\0""33\0""33\0""33\0&&\0OO\0OO\0OO\0""55\0``\0``"
+ "\0``\0::\0``\0``\0``\0""22\0WW\0WW\0WW\0''\0II\0II\0II\0\33\33\0""99\0""9"
+ "9\0""99\0\20\20\0))\0))\0))\0\10\10\0\33\33\0\33\33\0\33\33\0\3\3\0\17\17"
+ "\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0"
+ "\16\16\0\16\16\0\16\16\0\16\16\0\360\360\0\360\360\0\360\360\0\360\360\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\24\24\0\16\16"
+ "\0""33\0GG\0GG\0""00\0``\0\210\210\0\210\210\0TT\0\204\204\0\263\263\0\263"
+ "\263\0ee\0\222\222\0\315\315\0\312\312\0gg\0\216\216\0\331\331\0\327\327"
+ "\0cc\0\202\202\0\340\340\0\337\337\0YY\0qq\0\345\345\0\344\344\0NN\0^^\0"
+ "\352\352\0\352\352\0@@\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364"
+ "\364\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375"
+ "\0\376\376\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16"
+ "\16\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24"
+ "\24\0\24\24\0\22\22\0\24\24\0""88\0""88\0//\0BB\0pp\0pp\0UU\0ss\0\242\242"
+ "\0\242\242\0oo\0\230\230\0\306\306\0\306\306\0ww\0\265\265\0\335\335\0\335"
+ "\335\0ss\0\313\313\0\353\353\0\353\353\0ii\0\333\333\0\364\364\0\364\364"
+ "\0ZZ\0\351\351\0\371\371\0\371\371\0II\0\362\362\0\374\374\0\374\374\0""6"
+ "6\0\370\370\0\376\376\0\376\376\0\"\"\0\374\374\0\376\376\0\376\376\0\16"
+ "\16\0\376\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376"
+ "\0\376\376\0\360\360\0\360\360\0\360\360\0\360\360\0\16\16\0\360\360\0\360"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\22\22\0\"\"\0""88\0"
+ """88\0//\0OO\0pp\0pp\0WW\0\203\203\0\242\242\0\242\242\0qq\0\256\256\0\312"
+ "\312\0\301\301\0||\0\313\313\0\342\342\0\325\325\0yy\0\336\336\0\360\360"
+ "\0\342\342\0mm\0\353\353\0\367\367\0\354\354\0\\\\\0\363\363\0\373\373\0"
+ "\362\362\0JJ\0\371\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373"
+ "\373\0\"\"\0\376\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376"
+ "\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375"
+ "\0\360\360\0\374\374\0\360\360\0\376\376\0\16\16\0\360\360\0\360\360\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\24\24\0\22\22\0&&\0\"\"\0""88\0//\0PP\0HH\0gg\0NN"
+ "\0pp\0ee\0}}\0VV\0{{\0oo\0\202\202\0NN\0qq\0jj\0vv\0>>\0``\0\\\\\0cc\0,,"
+ "\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33\33\0"
+ "\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7\0\7"
+ "\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360\0\360"
+ "\360\0\376\376\0\376\376\0\16\16\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22"
+ "\0&&\0&&\0\"\"\0""66\0[[\0oo\0ee\0``\0\220\220\0\270\270\0\250\250\0xx\0"
+ "\250\250\0\327\327\0\311\311\0zz\0\246\246\0\341\341\0\325\325\0rr\0\230"
+ "\230\0\343\343\0\334\334\0gg\0\205\205\0\344\344\0\340\340\0[[\0rr\0\346"
+ "\346\0\344\344\0NN\0^^\0\352\352\0\352\352\0AA\0JJ\0\357\357\0\357\357\0"
+ """11\0""66\0\364\364\0\364\364\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16"
+ "\0\16\16\0\375\375\0\375\375\0\376\376\0\376\376\0\362\362\0\362\362\0\376"
+ "\376\0\376\376\0\16\16\0\16\16\0\376\376\0\376\376\0\376\376\0\16\16\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\22\22\0&&\0&&\0\37\37\0;;\0``\0``\0HH\0qq\0\237\237"
+ "\0\237\237\0nn\0\227\227\0\306\306\0\306\306\0}}\0\254\254\0\334\334\0\334"
+ "\334\0}}\0\275\275\0\347\347\0\347\347\0vv\0\316\316\0\357\357\0\357\357"
+ "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II"
+ "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\""
+ "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360"
+ "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "&&\0&&\0##\0--\0``\0``\0TT\0cc\0\237\237\0\231\231\0||\0\223\223\0\306\306"
+ "\0\301\301\0\217\217\0\267\267\0\336\336\0\322\322\0\220\220\0\317\317\0"
+ "\352\352\0\334\334\0\202\202\0\337\337\0\362\362\0\345\345\0qq\0\353\353"
+ "\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371\371\0\375"
+ "\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376\376\0\376"
+ "\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376"
+ "\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0\376\376\0"
+ "\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "&&\0##\0""77\0--\0``\0PP\0nn\0[[\0\222\222\0kk\0\211\211\0qq\0\231\231\0"
+ "ff\0\210\210\0uu\0\217\217\0UU\0vv\0ll\0zz\0@@\0aa\0]]\0dd\0,,\0MM\0KK\0"
+ "OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33\33\0\33\33\0\33"
+ "\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7\0\7\7\0\2\2\0\2"
+ "\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360\0\360\360\0\376"
+ "\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0##\0""77\0""77"
+ "\0--\0UU\0zz\0\216\216\0ww\0}}\0\254\254\0\324\324\0\264\264\0\207\207\0"
+ "\266\266\0\345\345\0\316\316\0\177\177\0\254\254\0\346\346\0\326\326\0rr"
+ "\0\231\231\0\344\344\0\334\334\0gg\0\206\206\0\344\344\0\340\340\0[[\0rr"
+ "\0\346\346\0\344\344\0NN\0^^\0\352\352\0\352\352\0AA\0JJ\0\357\357\0\357"
+ "\357\0""11\0""66\0\364\364\0\364\364\0\40\40\0\"\"\0\371\371\0\371\371\0"
+ "\16\16\0\16\16\0\375\375\0\375\375\0\376\376\0\376\376\0\362\362\0\362\362"
+ "\0\376\376\0\376\376\0\16\16\0\16\16\0\376\376\0\376\376\0\376\376\0\16\16"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0""77\0--\0CC\0~~\0~~\0\\\\\0||\0"
+ "\274\274\0\274\274\0||\0\235\235\0\325\325\0\325\325\0\204\204\0\256\256"
+ "\0\340\340\0\340\340\0\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316"
+ "\0\360\360\0\360\360\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371"
+ "\371\0\371\371\0II\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376"
+ "\0\376\376\0\"\"\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0"
+ "\360\360\0\360\360\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0&&\0""77\0""22\0--\0``\0vv\0pp\0gg\0\243\243\0\255\255"
+ "\0\225\225\0\231\231\0\311\311\0\314\314\0\235\235\0\271\271\0\337\337\0"
+ "\326\326\0\224\224\0\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362"
+ "\362\0\345\345\0qq\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373"
+ "\0\362\362\0JJ\0\371\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0"
+ "\373\373\0\"\"\0\376\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0"
+ "\375\375\0\360\360\0\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376"
+ "\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222"
+ "\222\0kk\0\222\222\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm"
+ "\0zz\0@@\0bb\0]]\0dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0"
+ "))\0**\0\10\10\0\33\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0"
+ "\0\0\7\7\0\7\7\0\7\7\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16"
+ "\0\16\16\0\360\360\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203"
+ "\203\0\254\254\0\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317"
+ "\0\200\200\0\254\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334"
+ "\0gg\0\206\206\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0"
+ "\352\352\0\352\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364"
+ "\364\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375"
+ "\0\376\376\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16"
+ "\16\0\376\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22"
+ "\0""77\0""77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302"
+ "\302\0||\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341"
+ "\341\0\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360"
+ "\360\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371"
+ "\0II\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0"
+ "\"\"\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376"
+ "\0\376\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0"
+ "\360\360\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235"
+ "\0\234\234\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0"
+ "\225\225\0\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345"
+ "\345\0qq\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362"
+ "\0JJ\0\371\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0"
+ "\"\"\0\376\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0"
+ "\360\360\0\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222\222\0kk"
+ "\0\222\222\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm\0zz\0@@"
+ "\0bb\0]]\0dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0"
+ "\10\10\0\33\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7"
+ "\0\7\7\0\7\7\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16"
+ "\0\360\360\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203\203\0"
+ "\254\254\0\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317\0\200"
+ "\200\0\254\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334\0gg"
+ "\0\206\206\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0\352"
+ "\352\0\352\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364\364"
+ "\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375\0"
+ "\376\376\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16"
+ "\0\376\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0"
+ """77\0""77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302\302"
+ "\0||\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341\341"
+ "\0\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360\360"
+ "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II"
+ "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\""
+ "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360"
+ "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235\0\234\234"
+ "\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0\225\225\0"
+ "\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345\345\0qq"
+ "\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371"
+ "\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376"
+ "\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0"
+ "\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222\222\0kk\0\222\222"
+ "\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm\0zz\0@@\0bb\0]]\0"
+ "dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33"
+ "\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7"
+ "\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360"
+ "\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203\203\0\254\254\0"
+ "\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317\0\200\200\0\254"
+ "\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334\0gg\0\206\206"
+ "\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0\352\352\0\352"
+ "\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364\364\0\40\40"
+ "\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375\0\376\376"
+ "\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16\0\376"
+ "\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0"
+ """77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302\302\0||"
+ "\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341\341\0"
+ "\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360\360"
+ "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II"
+ "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\""
+ "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360"
+ "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235\0\234\234"
+ "\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0\225\225\0"
+ "\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345\345\0qq"
+ "\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371"
+ "\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376"
+ "\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0"
+ "\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222\222\0kk\0\222\222"
+ "\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm\0zz\0@@\0bb\0]]\0"
+ "dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33"
+ "\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7"
+ "\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360"
+ "\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203\203\0\254\254\0"
+ "\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317\0\200\200\0\254"
+ "\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334\0gg\0\206\206"
+ "\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0\352\352\0\352"
+ "\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364\364\0\40\40"
+ "\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375\0\376\376"
+ "\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16\0\376"
+ "\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0"
+ """77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302\302\0||"
+ "\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341\341\0"
+ "\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360\360"
+ "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II"
+ "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\""
+ "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360"
+ "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235\0\234\234"
+ "\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0\225\225\0"
+ "\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345\345\0qq"
+ "\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371"
+ "\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376"
+ "\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0"
+ "\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\213\213\0mm\0\237\237\0uu\0\275\275"
+ "\0\232\232\0\306\306\0\204\204\0\331\331\0\272\272\0\336\336\0\205\205\0"
+ "\345\345\0\320\320\0\352\352\0{{\0\355\355\0\337\337\0\362\362\0mm\0\363"
+ "\363\0\353\353\0\370\370\0\\\\\0\367\367\0\363\363\0\373\373\0II\0\373\373"
+ "\0\371\371\0\375\375\0""66\0\375\375\0\374\374\0\376\376\0\"\"\0\376\376"
+ "\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\375\375\0\375\375"
+ "\0\360\360\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0##\0""77\0""77\0""99\0gg\0\205\205\0\205\205\0ww\0\224\224\0"
+ "\310\310\0\310\310\0\247\247\0\240\240\0\354\354\0\354\354\0\306\306\0\227"
+ "\227\0\372\372\0\372\372\0\325\325\0\205\205\0\375\375\0\375\375\0\342\342"
+ "\0rr\0\376\376\0\376\376\0\354\354\0^^\0\376\376\0\376\376\0\363\363\0JJ"
+ "\0\376\376\0\376\376\0\370\370\0""66\0\376\376\0\376\376\0\374\374\0\"\""
+ "\0\376\376\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\375\375"
+ "\0\376\376\0\376\376\0\376\376\0\362\362\0\376\376\0\376\376\0\376\376\0"
+ "\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0""77\0""11\0>>\0~~\0~~\0bb"
+ "\0__\0\261\261\0\261\261\0\212\212\0``\0\277\277\0\277\277\0\230\230\0SS"
+ "\0\275\275\0\275\275\0\233\233\0@@\0\273\273\0\273\273\0\240\240\0//\0\274"
+ "\274\0\274\274\0\252\252\0!!\0\301\301\0\301\301\0\266\266\0\25\25\0\311"
+ "\311\0\311\311\0\303\303\0\14\14\0\324\324\0\324\324\0\322\322\0\6\6\0\342"
+ "\342\0\342\342\0\341\341\0\1\1\0\361\361\0\361\361\0\361\361\0\15\15\0\15"
+ "\15\0\15\15\0\15\15\0\362\362\0\362\362\0\362\362\0\360\360\0\16\16\0\16"
+ "\16\0\16\16\0\2\2\0\376\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0&&\0""77\0""77\0\34\34\0SS\0kk\0\206\206\0BB\0\214\214\0\232\232"
+ "\0\302\302\0YY\0\250\250\0\255\255\0\340\340\0XX\0\264\264\0\264\264\0\355"
+ "\355\0SS\0\265\265\0\266\266\0\364\364\0JJ\0\270\270\0\272\272\0\371\371"
+ "\0AA\0\277\277\0\300\300\0\374\374\0""66\0\310\310\0\311\311\0\375\375\0"
+ "**\0\324\324\0\324\324\0\376\376\0\34\34\0\341\341\0\342\342\0\376\376\0"
+ "\15\15\0\361\361\0\361\361\0\376\376\0\361\361\0\15\15\0\15\15\0\376\376"
+ "\0\15\15\0\361\361\0\361\361\0\373\373\0\362\362\0\15\15\0\16\16\0\376\376"
+ "\0\16\16\0\361\361\0\376\376\0\376\376\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0&&\0&&\0""77\0))\0SS\0SS\0kk\0DD\0\205\205\0}}\0\222\222\0WW\0\241\241"
+ "\0\230\230\0\245\245\0XX\0\261\261\0\252\252\0\261\261\0SS\0\264\264\0\263"
+ "\263\0\265\265\0JJ\0\270\270\0\271\271\0\272\272\0AA\0\276\276\0\300\300"
+ "\0\300\300\0""66\0\310\310\0\311\311\0\311\311\0**\0\324\324\0\324\324\0"
+ "\324\324\0\34\34\0\341\341\0\342\342\0\342\342\0\15\15\0\361\361\0\361\361"
+ "\0\361\361\0\361\361\0\15\15\0\15\15\0\15\15\0\15\15\0\361\361\0\361\361"
+ "\0\361\361\0\362\362\0\15\15\0\16\16\0\16\16\0\16\16\0\361\361\0\376\376"
+ "\0\376\376\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&&\0&&\0&&\0))\0pp\0cc\0cc"
+ "\0QQ\0\261\261\0\244\244\0\244\244\0ll\0\335\335\0\323\323\0\323\323\0ww"
+ "\0\364\364\0\356\356\0\356\356\0ss\0\370\370\0\371\371\0\371\371\0ii\0\372"
+ "\372\0\375\375\0\375\375\0YY\0\374\374\0\376\376\0\376\376\0HH\0\375\375"
+ "\0\376\376\0\376\376\0""66\0\376\376\0\376\376\0\376\376\0\"\"\0\376\376"
+ "\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376"
+ "\0\375\375\0\376\376\0\376\376\0\376\376\0\361\361\0\376\376\0\376\376\0"
+ "\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0&&\0&&\0\40\40\0QQ\0pp\0pp\0KK"
+ "\0\215\215\0\261\261\0\261\261\0pp\0\274\274\0\337\337\0\337\337\0\200\200"
+ "\0\332\332\0\364\364\0\364\364\0}}\0\350\350\0\373\373\0\373\373\0oo\0\361"
+ "\361\0\375\375\0\375\375\0]]\0\367\367\0\376\376\0\376\376\0JJ\0\373\373"
+ "\0\376\376\0\376\376\0""66\0\375\375\0\376\376\0\376\376\0\"\"\0\376\376"
+ "\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376"
+ "\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376"
+ "\0\375\375\0\376\376\0\376\376\0\376\376\0\361\361\0\376\376\0\376\376\0"
+ "\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0&&\0&&\0\20\20\0""88\0WW\0pp\0"
+ "==\0ss\0\212\212\0\252\252\0dd\0\250\250\0\264\264\0\312\312\0rr\0\313\313"
+ "\0\315\315\0\331\331\0rr\0\340\340\0\331\331\0\340\340\0hh\0\355\355\0\341"
+ "\341\0\345\345\0YY\0\366\366\0\350\350\0\352\352\0HH\0\372\372\0\356\356"
+ "\0\357\357\0""66\0\375\375\0\364\364\0\364\364\0\"\"\0\376\376\0\371\371"
+ "\0\371\371\0\16\16\0\376\376\0\375\375\0\375\375\0\376\376\0\376\376\0\361"
+ "\361\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16\0\376\376\0\375\375\0"
+ "\376\376\0\375\375\0\374\374\0\360\360\0\376\376\0\376\376\0\360\360\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0&&\0\40\40\0""88\0""88\0WW\0BB\0ff"
+ "\0ZZ\0}}\0^^\0\226\226\0\201\201\0\241\241\0nn\0\301\301\0\246\246\0\277"
+ "\277\0rr\0\333\333\0\301\301\0\321\321\0ii\0\353\353\0\323\323\0\335\335"
+ "\0[[\0\365\365\0\341\341\0\346\346\0II\0\372\372\0\353\353\0\356\356\0""6"
+ "6\0\375\375\0\363\363\0\364\364\0\"\"\0\376\376\0\371\371\0\371\371\0\16"
+ "\16\0\376\376\0\375\375\0\375\375\0\376\376\0\376\376\0\361\361\0\361\361"
+ "\0\376\376\0\376\376\0\16\16\0\16\16\0\376\376\0\374\374\0\375\375\0\374"
+ "\374\0\374\374\0\361\361\0\376\376\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\24\24\0\24\24\0\24\24\0\40\40\0HH\0""88\0""88\0BB\0~~\0ff\0ff\0"
+ "^^\0\256\256\0\226\226\0\226\226\0qq\0\325\325\0\277\277\0\277\277\0ss\0"
+ "\350\350\0\331\331\0\331\331\0jj\0\363\363\0\353\353\0\353\353\0[[\0\371"
+ "\371\0\365\365\0\365\365\0II\0\374\374\0\372\372\0\372\372\0""66\0\375\375"
+ "\0\375\375\0\375\375\0\"\"\0\376\376\0\376\376\0\376\376\0\16\16\0\376\376"
+ "\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0"
+ "\376\376\0\376\376\0\376\376\0\376\376\0\374\374\0\374\374\0\374\374\0\376"
+ "\376\0\361\361\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\24\24\0\24\24\0\24\24\0\40\40\0HH\0HH\0""88\0BB\0~~\0~~\0ff\0^^\0\263"
+ "\263\0\263\263\0\231\231\0nn\0\330\330\0\330\330\0\274\274\0pp\0\353\353"
+ "\0\353\353\0\324\324\0hh\0\365\365\0\365\365\0\345\345\0ZZ\0\373\373\0\373"
+ "\373\0\361\361\0II\0\375\375\0\375\375\0\370\370\0""66\0\376\376\0\376\376"
+ "\0\374\374\0\"\"\0\376\376\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376"
+ "\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0"
+ "\376\376\0\374\374\0\374\374\0\376\376\0\376\376\0\361\361\0\360\360\0\360"
+ "\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\0\0"
+ "\0\0\0\0((\0HH\0\40\40\0\25\25\0QQ\0\207\207\0KK\0--\0}}\0\262\262\0bb\0"
+ """44\0\235\235\0\320\320\0ff\0""00\0\257\257\0\341\341\0cc\0))\0\272\272"
+ "\0\354\354\0ZZ\0\37\37\0\303\303\0\363\363\0OO\0\26\26\0\314\314\0\370\370"
+ "\0AA\0\15\15\0\326\326\0\373\373\0""22\0\6\6\0\343\343\0\375\375\0!!\0\1"
+ "\1\0\362\362\0\376\376\0\16\16\0\16\16\0\16\16\0\375\375\0\375\375\0\375"
+ "\375\0\376\376\0\362\362\0\360\360\0\361\361\0\376\376\0\14\14\0\0\0\0\0"
+ "\0\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24"
+ "\0\24\24\0\0\0\0\0\0\0((\0((\0\0\0\0\0\0\0<<\0<<\0\0\0\0\0\0\0PP\0PP\0\10"
+ "\10\0\4\4\0dd\0dd\0\14\14\0\6\6\0xx\0xx\0\14\14\0\5\5\0\214\214\0\214\214"
+ "\0\13\13\0\4\4\0\240\240\0\240\240\0\10\10\0\2\2\0\264\264\0\264\264\0\5"
+ "\5\0\1\1\0\310\310\0\310\310\0\3\3\0\0\0\0\334\334\0\334\334\0\1\1\0\0\0"
+ "\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\0\1\1\0\0\0\0\0\0\0\14"
+ "\14\0\14\14\0\0\0\0\0\0\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\0\0\0\0\0\0((\0((\0\0\0\0\0\0"
+ "\0<<\0<<\0\0\0\0\0\0\0XX\0XX\0\0\0\0\0\0\0pp\0pp\0\0\0\0\0\0\0\204\204\0"
+ "\204\204\0\0\0\0\0\0\0\227\227\0\227\227\0\0\0\0\0\0\0\250\250\0\250\250"
+ "\0\0\0\0\0\0\0\271\271\0\271\271\0\0\0\0\0\0\0\313\313\0\313\313\0\0\0\0"
+ "\0\0\0\335\335\0\335\335\0\0\0\0\0\0\0\360\360\0\360\360\0\0\0\0\0\0\0\1"
+ "\1\0\1\1\0\0\0\0\0\0\0\14\14\0\14\14\0\0\0\0\0\0\0\360\360\0\360\360\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0"
+ "\24\24\0\24\24\0\0\0\0((\0((\0((\0\0\0\0<<\0HH\0HH\0\10\10\0PP\0dd\0dd\0"
+ "\14\14\0dd\0||\0||\0\14\14\0xx\0\221\221\0\221\221\0\13\13\0\214\214\0\243"
+ "\243\0\243\243\0\10\10\0\240\240\0\264\264\0\264\264\0\5\5\0\264\264\0\303"
+ "\303\0\303\303\0\3\3\0\310\310\0\322\322\0\322\322\0\1\1\0\334\334\0\341"
+ "\341\0\341\341\0\0\0\0\360\360\0\361\361\0\361\361\0\1\1\0\0\0\0\14\14\0"
+ "\14\14\0\14\14\0\0\0\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0"
+ "\24\24\0\20\20\0\20\20\0""88\0""88\0**\0**\0ZZ\0ZZ\0==\0==\0yy\0yy\0II\0"
+ "II\0\224\224\0\224\224\0NN\0NN\0\254\254\0\254\254\0MM\0MM\0\302\302\0\302"
+ "\302\0HH\0HH\0\324\324\0\324\324\0>>\0>>\0\343\343\0\343\343\0""00\0""00"
+ "\0\356\356\0\356\356\0\40\40\0\40\40\0\367\367\0\367\367\0\16\16\0\16\16"
+ "\0\374\374\0\374\374\0\374\374\0\374\374\0\360\360\0\360\360\0\360\360\0"
+ "\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+};
+
+/**
+ * \brief Returns the BlitAlpha test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitAlpha()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitAlpha.pixel_data,
+ SDLTest_imageBlitAlpha.width,
+ SDLTest_imageBlitAlpha.height,
+ SDLTest_imageBlitAlpha.bytes_per_pixel * 8,
+ SDLTest_imageBlitAlpha.width * SDLTest_imageBlitAlpha.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_imageBlitBlend.c b/src/3rdparty/SDL2/src/test/SDL_test_imageBlitBlend.c
new file mode 100644
index 0000000..cf2d4af
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_imageBlitBlend.c
@@ -0,0 +1,2845 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* GIMP RGB C-Source image dump (alpha.c) */
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310"
+ "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310"
+ "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0"
+ "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310"
+ "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310"
+ "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0"
+ "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310"
+ "\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310\310\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310"
+ "\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310\310"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\310\310\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd"
+ "\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0"
+ "\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310"
+ "\310\0\310\310\0\310\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0"
+ "dd\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0"
+ "dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd"
+ "\0\310\310\0\310\310\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310"
+ "\310\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\310\310\0\310\310"
+ "\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310"
+ "\310\0\310\310\0\310\310\0\310\310\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310\310\0\310"
+ "\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\310\310\0\310\310\0\310\310\0dd\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310"
+ "\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\310\310\0dd\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310"
+ "\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310"
+ "\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310"
+ "\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310"
+ "\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310"
+ "\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310"
+ "\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310"
+ "\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\310"
+ "\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310"
+ "\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\310\310"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\310\310\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\310\310"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\310\310\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310"
+ "\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310\310\0\310\310\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310"
+ "\310\0\310\310\0\310\310\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310\310\0dd\0\310\310\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0"
+ "dd\0\310\310\0\310\310\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310\310"
+ "\0\377\377\0\377\377\0\377\377\0\310\310\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\310\310\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\310"
+ "\310\0\310\310\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0\310\310\0\377\377\0\310\310\0\310\310"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\377\377\0\310\310\0dd"
+ "\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0dd\0dd\0dd\0\310\310\0\377\377\0\377\377\0\310\310\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\310\310\0\377\377\0\377\377\0\310\310\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd"
+ "\0\0\0\0\0\0\0dd\0\377\377\0\310\310\0\310\310\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\377\377\0dd\0\0"
+ "\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0"
+ "\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0"
+ "dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0"
+ "dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0"
+ "dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0"
+ "\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0"
+ "\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310"
+ "\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310"
+ "\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0"
+ "\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0"
+ "\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0\0\0\0dd\0dd\0dd\0\0\0\0dd\0\310\310\0\310"
+ "\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310"
+ "\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0"
+ "dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310"
+ "\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0"
+ "\0\0\0dd\0dd\0dd\0\0\0\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310"
+ "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310"
+ "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0"
+ "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310"
+ "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310"
+ "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0"
+ "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310"
+ "\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+};
+
+/**
+ * \brief Returns the BlitBlendAdd test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitBlendAdd()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitBlendAdd.pixel_data,
+ SDLTest_imageBlitBlendAdd.width,
+ SDLTest_imageBlitBlendAdd.height,
+ SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendAdd.width * SDLTest_imageBlitBlendAdd.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0<<\0<<\0\240\240\0\240\240\0aa\0aa\0\240"
+ "\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0"
+ "aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240"
+ "\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0"
+ "aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240"
+ "\240\0\240\240\0\240\240\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0<<\0\240\240\0\240\240\0\240\240"
+ "\0aa\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww"
+ "\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305"
+ "\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305\305"
+ "\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305"
+ "\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305"
+ "\0\305\305\0\305\305\0\240\240\0\240\240\0\240\240\0\240\240\0dd\0dd\0dd"
+ "\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0<<\0\240\240"
+ "\0\240\240\0\240\240\0aa\0\305\305\0\305\305\0\305\305\0ww\0\333\333\0\333"
+ "\333\0\305\305\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333"
+ "\0\305\305\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333\0\305"
+ "\305\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333\0\305\305"
+ "\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333\0\305\305\0ww"
+ "\0\333\333\0\333\333\0\305\305\0\305\305\0\305\305\0\305\305\0\240\240\0"
+ "\240\240\0\240\240\0\240\240\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0dd\0dd\0dd\0<<\0aa\0aa\0aa\0::\0HH\0HH\0HH\0++\0PP\0PP\0PP\0""00\0PP"
+ "\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP"
+ "\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP"
+ "\0PP\0PP\0PP\0HH\0HH\0HH\0HH\0aa\0aa\0aa\0aa\0dd\0dd\0dd\0dd\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0dd\0dd\0dd\0$$\0aa\0\305\305\0\305\305\0``\0\205\205\0\351\351\0"
+ "\351\351\0||\0\222\222\0\321\321\0\321\321\0\177\177\0\225\225\0\324\324"
+ "\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0\177\177\0\225\225\0"
+ "\324\324\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0\177\177\0\225"
+ "\225\0\324\324\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0\177\177"
+ "\0\225\225\0\324\324\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0"
+ "\177\177\0\225\225\0\324\324\0\321\321\0\222\222\0\222\222\0\321\321\0\314"
+ "\314\0\351\351\0\351\351\0\254\254\0\236\236\0\305\305\0\305\305\0aa\0<<"
+ "\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0<<\0dd\0\240\240\0\240\240\0aa\0\255\255"
+ "\0\322\322\0\322\322\0\177\177\0\315\315\0\343\343\0\343\343\0\211\211\0"
+ "\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346\346\0\346\346\0\211"
+ "\211\0\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346\346\0\346\346"
+ "\0\211\211\0\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346\346\0"
+ "\346\346\0\211\211\0\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346"
+ "\346\0\346\346\0\211\211\0\313\313\0\346\346\0\346\346\0\211\211\0\320\320"
+ "\0\327\327\0\327\327\0\322\322\0\276\276\0\322\322\0\322\322\0\305\305\0"
+ "yy\0\210\210\0\210\210\0dd\0<<\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0<<\0\210\210\0\240"
+ "\240\0\240\240\0aa\0\266\266\0\322\322\0\322\322\0\205\205\0\327\327\0\343"
+ "\343\0\343\343\0\215\215\0\346\346\0\357\357\0\331\331\0\222\222\0\347\347"
+ "\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0\331\331\0\222\222\0"
+ "\347\347\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0\331\331\0\222"
+ "\222\0\347\347\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0\331\331"
+ "\0\222\222\0\347\347\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0"
+ "\331\331\0\222\222\0\357\357\0\346\346\0\320\320\0\351\351\0\327\327\0\343"
+ "\343\0\276\276\0\333\333\0\322\322\0\266\266\0yy\0\240\240\0\210\210\0\240"
+ "\240\0<<\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0dd\0<<\0\240\240\0\210\210\0\240\240\0aa\0ww\0nn\0\177"
+ "\177\0MM\0SS\0OO\0SS\0""22\0WW\0TT\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0"
+ "XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0"
+ "XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0XX\0TT\0TT\0LL\0OO\0SS"
+ "\0SS\0ss\0\177\177\0nn\0nn\0yy\0\210\210\0\240\240\0\240\240\0<<\0dd\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<"
+ "\0\240\240\0\240\240\0\210\210\0HH\0\205\205\0\351\351\0\333\333\0pp\0\225"
+ "\225\0\371\371\0\363\363\0\202\202\0\231\231\0\330\330\0\325\325\0\203\203"
+ "\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0"
+ "\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324"
+ "\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331"
+ "\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0"
+ "\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\325\325\0\231\231\0\231"
+ "\231\0\330\330\0\323\323\0\371\371\0\371\371\0\274\274\0\257\257\0\351\351"
+ "\0\351\351\0\205\205\0``\0\240\240\0\240\240\0\240\240\0<<\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\240\240"
+ "\0\240\240\0RR\0\207\207\0\304\304\0\304\304\0nn\0\275\275\0\343\343\0\343"
+ "\343\0\205\205\0\324\324\0\352\352\0\352\352\0\214\214\0\316\316\0\352\352"
+ "\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0\213\213\0\316\316\0"
+ "\352\352\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0\213\213\0\316"
+ "\316\0\352\352\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0\213\213"
+ "\0\316\316\0\352\352\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0"
+ "\213\213\0\316\316\0\352\352\0\352\352\0\214\214\0\324\324\0\336\336\0\336"
+ "\336\0\331\331\0\310\310\0\343\343\0\343\343\0\325\325\0\217\217\0\254\254"
+ "\0\254\254\0\207\207\0aa\0\240\240\0\240\240\0<<\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\240\240\0aa"
+ "\0\225\225\0\304\304\0\304\304\0\205\205\0\276\276\0\343\343\0\340\340\0"
+ "\222\222\0\333\333\0\352\352\0\351\351\0\226\226\0\347\347\0\362\362\0\333"
+ "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361"
+ "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0"
+ "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351"
+ "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230"
+ "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0"
+ "\366\366\0\336\336\0\351\351\0\304\304\0\351\351\0\343\343\0\304\304\0\217"
+ "\217\0\333\333\0\254\254\0\266\266\0aa\0\240\240\0\240\240\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa"
+ "\0\305\305\0\225\225\0\304\304\0ww\0\205\205\0ss\0\211\211\0RR\0VV\0PP\0"
+ "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211"
+ "\0ww\0||\0\217\217\0\254\254\0\266\266\0\305\305\0aa\0\240\240\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305"
+ "\305\0\305\305\0\225\225\0UU\0\222\222\0\366\366\0\340\340\0tt\0\231\231"
+ "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0"
+ "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203"
+ "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324"
+ "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0"
+ "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331"
+ "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231"
+ "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0"
+ "\366\366\0\222\222\0mm\0\266\266\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0"
+ "\305\305\0``\0\214\214\0\321\321\0\321\321\0rr\0\277\277\0\346\346\0\346"
+ "\346\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353"
+ "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0"
+ "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316"
+ "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213"
+ "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0"
+ "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337"
+ "\337\0\331\331\0\312\312\0\346\346\0\346\346\0\330\330\0\224\224\0\271\271"
+ "\0\271\271\0\217\217\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww"
+ "\0\225\225\0\304\304\0\314\314\0\222\222\0\277\277\0\343\343\0\342\342\0"
+ "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333"
+ "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361"
+ "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0"
+ "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351"
+ "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230"
+ "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0"
+ "\370\370\0\336\336\0\352\352\0\306\306\0\354\354\0\344\344\0\305\305\0\227"
+ "\227\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa"
+ "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0"
+ "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211"
+ "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305"
+ "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231"
+ "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0"
+ "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203"
+ "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324"
+ "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0"
+ "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331"
+ "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231"
+ "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0"
+ "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0"
+ "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347"
+ "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353"
+ "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0"
+ "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316"
+ "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213"
+ "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0"
+ "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337"
+ "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274"
+ "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww"
+ "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0"
+ "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333"
+ "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361"
+ "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0"
+ "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351"
+ "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230"
+ "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0"
+ "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231"
+ "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa"
+ "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0"
+ "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211"
+ "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305"
+ "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231"
+ "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0"
+ "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203"
+ "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324"
+ "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0"
+ "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331"
+ "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231"
+ "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0"
+ "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0"
+ "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347"
+ "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353"
+ "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0"
+ "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316"
+ "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213"
+ "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0"
+ "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337"
+ "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274"
+ "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww"
+ "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0"
+ "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333"
+ "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361"
+ "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0"
+ "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351"
+ "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230"
+ "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0"
+ "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231"
+ "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa"
+ "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0"
+ "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211"
+ "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305"
+ "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231"
+ "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0"
+ "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203"
+ "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324"
+ "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0"
+ "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331"
+ "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231"
+ "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0"
+ "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0"
+ "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347"
+ "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353"
+ "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0"
+ "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316"
+ "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213"
+ "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0"
+ "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337"
+ "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274"
+ "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww"
+ "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0"
+ "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333"
+ "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361"
+ "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0"
+ "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351"
+ "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230"
+ "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0"
+ "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231"
+ "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa"
+ "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0"
+ "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0"
+ "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211"
+ "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305"
+ "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231"
+ "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0"
+ "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203"
+ "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324"
+ "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0"
+ "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331"
+ "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231"
+ "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0"
+ "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0"
+ "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347"
+ "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353"
+ "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0"
+ "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316"
+ "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213"
+ "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0"
+ "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337"
+ "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274"
+ "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww"
+ "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0"
+ "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333"
+ "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361"
+ "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0"
+ "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351"
+ "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230"
+ "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0"
+ "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231"
+ "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa"
+ "\0\333\333\0\236\236\0\304\304\0ww\0\340\340\0\300\300\0\343\343\0\210\210"
+ "\0\354\354\0\333\333\0\352\352\0\215\215\0\361\361\0\350\350\0\362\362\0"
+ "\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351\351\0\351\351\0\361"
+ "\361\0\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351\351\0\351\351"
+ "\0\361\361\0\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351\351\0"
+ "\351\351\0\361\361\0\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351"
+ "\351\0\351\351\0\361\361\0\223\223\0\351\351\0\362\362\0\351\351\0\351\351"
+ "\0\323\323\0\336\336\0\351\351\0\351\351\0\304\304\0\343\343\0\305\305\0"
+ "\317\317\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305"
+ "\305\0\305\305\0\236\236\0\222\222\0\361\361\0\361\361\0\316\316\0\230\230"
+ "\0\373\373\0\373\373\0\344\344\0\231\231\0\375\375\0\375\375\0\357\357\0"
+ "\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375\375\0\375\375\0\347"
+ "\347\0\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375\375\0\375\375"
+ "\0\347\347\0\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375\375\0"
+ "\375\375\0\347\347\0\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375"
+ "\375\0\375\375\0\347\347\0\231\231\0\375\375\0\375\375\0\360\360\0\373\373"
+ "\0\375\375\0\375\375\0\347\347\0\367\367\0\373\373\0\373\373\0\326\326\0"
+ "\351\351\0\361\361\0\361\361\0\271\271\0\276\276\0\305\305\0\305\305\0aa"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0<<\0\305\305\0\305\305\0\236\236\0HH\0\271\271\0\271\271\0\224\224\0VV"
+ "\0\277\277\0\277\277\0\251\251\0DD\0\252\252\0\252\252\0\235\235\0FF\0\253"
+ "\253\0\253\253\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253"
+ "\0\253\253\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253\0\253"
+ "\253\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253\0\253\253"
+ "\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253\0\253\253\0\235"
+ "\235\0rr\0uu\0uu\0^^\0\272\272\0\277\277\0\277\277\0\230\230\0\205\205\0"
+ "\222\222\0\222\222\0MM\0\266\266\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305"
+ "\305\0\305\305\0RR\0\236\236\0\254\254\0\361\361\0VV\0\267\267\0\263\263"
+ "\0\356\356\0ee\0\247\247\0\244\244\0\356\356\0^^\0\251\251\0\247\247\0\365"
+ "\365\0bb\0\242\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365"
+ "\0bb\0\242\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365\0bb"
+ "\0\242\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365\0bb\0\242"
+ "\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365\0\252\252\0ee"
+ "\0jj\0\345\345\0tt\0\246\246\0\251\251\0\321\321\0\272\272\0ff\0\222\222"
+ "\0\322\322\0ww\0\210\210\0\305\305\0\305\305\0\240\240\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\240\240"
+ "\0\305\305\0``\0\236\236\0\236\236\0\254\254\0VV\0\264\264\0\254\254\0\261"
+ "\261\0dd\0\246\246\0\240\240\0\243\243\0^^\0\251\251\0\246\246\0\246\246"
+ "\0bb\0\242\242\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0bb"
+ "\0\242\242\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0bb\0\242"
+ "\242\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0bb\0\242\242"
+ "\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0\251\251\0dd\0hh"
+ "\0hh\0pp\0\243\243\0\240\240\0\236\236\0\264\264\0cc\0\177\177\0ww\0ww\0"
+ "\225\225\0\305\305\0\240\240\0\240\240\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\240\240\0\240\240\0``"
+ "\0\351\351\0\333\333\0\333\333\0||\0\366\366\0\361\361\0\361\361\0\211\211"
+ "\0\373\373\0\371\371\0\371\371\0\221\221\0\375\375\0\374\374\0\374\374\0"
+ "\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365\365\0\374\374\0\374"
+ "\374\0\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365\365\0\374\374"
+ "\0\374\374\0\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365\365\0"
+ "\374\374\0\374\374\0\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365"
+ "\365\0\374\374\0\374\374\0\375\375\0\356\356\0\371\371\0\371\371\0\372\372"
+ "\0\340\340\0\361\361\0\361\361\0\364\364\0\307\307\0\333\333\0\333\333\0"
+ "\351\351\0\225\225\0\240\240\0\240\240\0\240\240\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\240\240\0\240\240"
+ "\0aa\0\304\304\0\351\351\0\351\351\0\205\205\0\340\340\0\366\366\0\366\366"
+ "\0\222\222\0\355\355\0\373\373\0\373\373\0\227\227\0\364\364\0\375\375\0"
+ "\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230\230\0\360\360\0\375"
+ "\375\0\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230\230\0\360\360"
+ "\0\375\375\0\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230\230\0"
+ "\360\360\0\375\375\0\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230"
+ "\230\0\360\360\0\375\375\0\375\375\0\373\373\0\356\356\0\373\373\0\373\373"
+ "\0\367\367\0\340\340\0\364\364\0\364\364\0\354\354\0\304\304\0\351\351\0"
+ "\351\351\0\322\322\0\210\210\0\240\240\0\240\240\0dd\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\240\240\0\240"
+ "\240\0<<\0\240\240\0\305\305\0\351\351\0ww\0\320\320\0\301\301\0\324\324"
+ "\0\211\211\0\345\345\0\316\316\0\324\324\0\217\217\0\356\356\0\323\323\0"
+ "\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223\223\0\354\354\0\323"
+ "\323\0\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223\223\0\354\354"
+ "\0\323\323\0\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223\223\0"
+ "\354\354\0\323\323\0\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223"
+ "\223\0\354\354\0\323\323\0\326\326\0\362\362\0\344\344\0\261\261\0\272\272"
+ "\0\364\364\0\340\340\0\225\225\0\205\205\0\340\340\0\276\276\0\351\351\0"
+ "\266\266\0\240\240\0dd\0\240\240\0\240\240\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\240\240\0aa\0\240"
+ "\240\0\240\240\0\305\305\0ww\0\305\305\0\240\240\0\266\266\0\205\205\0\333"
+ "\333\0\266\266\0\304\304\0\215\215\0\352\352\0\305\305\0\314\314\0\222\222"
+ "\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0\305\305\0\314\314\0"
+ "\222\222\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0\305\305\0\314"
+ "\314\0\222\222\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0\305\305"
+ "\0\314\314\0\222\222\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0"
+ "\305\305\0\314\314\0\361\361\0\335\335\0\242\242\0\236\236\0\333\333\0\312"
+ "\312\0ii\0aa\0\305\305\0\255\255\0\266\266\0\240\240\0\240\240\0\210\210"
+ "\0\240\240\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0aa\0\305\305\0\240\240\0\240\240\0ww\0\333"
+ "\333\0\305\305\0\305\305\0\205\205\0\351\351\0\333\333\0\333\333\0\217\217"
+ "\0\363\363\0\351\351\0\351\351\0\223\223\0\357\357\0\351\351\0\351\351\0"
+ "\223\223\0\357\357\0\351\351\0\351\351\0\223\223\0\357\357\0\351\351\0\351"
+ "\351\0\223\223\0\357\357\0\351\351\0\351\351\0\223\223\0\357\357\0\351\351"
+ "\0\351\351\0\223\223\0\357\357\0\351\351\0\351\351\0\223\223\0\357\357\0"
+ "\351\351\0\351\351\0\223\223\0\357\357\0\351\351\0\351\351\0\363\363\0\345"
+ "\345\0\333\333\0\333\333\0\340\340\0\312\312\0\305\305\0\305\305\0\322\322"
+ "\0\255\255\0\240\240\0\240\240\0\305\305\0\210\210\0dd\0dd\0dd\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd"
+ "\0dd\0dd\0aa\0\305\305\0\305\305\0\240\240\0ww\0\333\333\0\333\333\0\305"
+ "\305\0\205\205\0\355\355\0\355\355\0\336\336\0\215\215\0\364\364\0\364\364"
+ "\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0\215\215\0\364\364\0"
+ "\364\364\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0\215\215\0\364"
+ "\364\0\364\364\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0\215\215"
+ "\0\364\364\0\364\364\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0"
+ "\215\215\0\364\364\0\364\364\0\335\335\0\351\351\0\355\355\0\355\355\0\312"
+ "\312\0\305\305\0\322\322\0\322\322\0\255\255\0\240\240\0\305\305\0\305\305"
+ "\0\210\210\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0\305\305\0aa"
+ "\0""11\0\225\225\0\351\351\0\205\205\0HH\0\254\254\0\333\333\0ww\0BB\0\264"
+ "\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0"
+ "nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264"
+ "\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0"
+ "BB\0\264\264\0\340\340\0nn\0nn\0\205\205\0\314\314\0\266\266\0\304\304\0"
+ "\351\351\0\236\236\0yy\0\210\210\0\305\305\0<<\0\0\0\0\0\0\0dd\0dd\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0"
+ "\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14"
+ "\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14"
+ "\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14"
+ "\0dd\0dd\0\25\25\0\25\25\0\0\0\0\0\0\0$$\0$$\0\0\0\0\0\0\0<<\0<<\0\0\0\0"
+ "\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0"
+ "\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0"
+ "yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0"
+ "\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0"
+ "yy\0\0\0\0\0\0\0$$\0$$\0\0\0\0\0\0\0<<\0<<\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0\0\0\0dd\0dd\0dd\0\0\0\0dd"
+ "\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210"
+ "\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210"
+ "\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25"
+ "\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210"
+ "\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0$$\0\0\0\0<<\0<<\0<<\0\0"
+ "\0\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0dd\0dd\0<<\0<<\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0"
+ "aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240"
+ "\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240"
+ "\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0"
+ "aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0\240\240\0\240\240"
+ "\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+};
+
+/**
+ * \brief Returns the BlitBlend test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitBlend()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitBlend.pixel_data,
+ SDLTest_imageBlitBlend.width,
+ SDLTest_imageBlitBlend.height,
+ SDLTest_imageBlitBlend.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlend.width * SDLTest_imageBlitBlend.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+};
+
+/**
+ * \brief Returns the BlitBlendMod test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitBlendMod()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitBlendMod.pixel_data,
+ SDLTest_imageBlitBlendMod.width,
+ SDLTest_imageBlitBlendMod.height,
+ SDLTest_imageBlitBlendMod.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendMod.width * SDLTest_imageBlitBlendMod.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
+ 80, 60, 3,
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0"
+ "\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\0\0\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\0\0\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377"
+ "\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377\377"
+ "\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377"
+ "\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0"
+ "\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377"
+ "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377",
+};
+
+/**
+ * \brief Returns the BlitBlendNone test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitBlendNone()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitBlendNone.pixel_data,
+ SDLTest_imageBlitBlendNone.width,
+ SDLTest_imageBlitBlendNone.height,
+ SDLTest_imageBlitBlendNone.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendNone.width * SDLTest_imageBlitBlendNone.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
+ 80, 60, 3,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\0\0\0\0\0"
+ "\0\11\0\0\11\0\0\0\0\0\0\0\0\16\0\0\16\0\0\0\0\0\0\0\0\11\0\0\11\0\0\0\0"
+ "\0\0\0\0\14\0\0\14\0\0\0\0\0\0\0\0\17\0\0\17\0\0\0\0\0\0\0\0\21\0\0\21\0"
+ "\0\0\0\0\0\0\0K\0\0K\0\0\0\0\0\0\0\0T\0\0T\0\0\0\0\0\0\0\0^\0\0^\0\0\0\0"
+ "\0\0\0\0g\0\0g\0\0\0\0\0\0\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317"
+ "\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\4\0\0\0\0\0\11\0\0\11\0\0\11"
+ "\0\0\0\0\0\16\0\0\16\0\0\16\0\0\0\0\0\22\0\0\22\0\0\11\0\0\0\0\0\14\0\0\14"
+ "\0\0\14\0\0\0\0\0\17\0\0\17\0\0\17\0\0\0\0\0\21\0\0\21\0\0\21\0\0\0\0\0\24"
+ "\0\0\24\0\0K\0\0\0\0\0T\0\0T\0\0T\0\0\0\0\0^\0\0^\0\0^\0\0\0\0\0g\0\0g\0"
+ "\0g\0\0\0\0\0q\0\0q\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317"
+ "\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\4\0\0\0\0\0\11\0\0\11\0\0\11\0\0\0\0\0"
+ "\16\0\0\16\0\0\16\0\0\0\0\0\22\0\0\22\0\0\22\0\0\0\0\0\14\0\0\14\0\0\14\0"
+ "\0\0\0\0\17\0\0\17\0\0\17\0\0\0\0\0\21\0\0\21\0\0\21\0\0\0\0\0\24\0\0\24"
+ "\0\0\24\0\0\0\0\0T\0\0T\0\0T\0\0\0\0\0^\0\0^\0\0^\0\0\0\0\0g\0\0g\0\0g\0"
+ "\0\0\0\0q\0\0q\0\0q\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317"
+ "\0\0\317\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\4\0\0\0\0\0\10\0\0\10\0\0\10\0\0\0\0\0\15"
+ "\0\0\15\0\0\15\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\16\0\0\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0J\0\0J\0\0J\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\317"
+ "\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\1\0\0\1\0\0\1\0\0\1"
+ "\0\0\4\0\0\4\0\0\0\0\0\0\0\0\7\0\0\7\0\0\0\0\0\0\0\0&\0\0&\0\0\32\0\0\32"
+ "\0\0&\0\0&\0\0&\0\0&\0\0C\0\0C\0\0\0\0\0\0\0\0^\0\0^\0\0\0\0\0\0\0\17\251"
+ "\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\0\0\0\0"
+ "\0\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\6\2\0\6\2\0\0\1\0\0\0\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1\0\0"
+ "\17\0\0\0\0\0\4\0\0\11\0\0\11\0\0\0\0\6+\0\6+\0\0&\0\0\32\0\0&\0\0&\0\0&"
+ "\0\0&\0\0""5\0\0""5\0\2\210\0\0\0\0\0C\0\0|\0\0|\0\0\0\0\17\251\0\17\251"
+ "\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251"
+ "\0$\360\0$\360\0\0\0\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1"
+ "\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\6\2\0\6\2\0\6\2\0\0\0\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1"
+ "\0\0\1\0\0\0\0\0\17\0\0\17\0\0\4\0\0\0\0\6+\0\6+\0\6+\0\0\32\0\0&\0\0&\0"
+ "\0&\0\0&\0\0""5\0\0""5\0\0""5\0\0\0\0\2\210\0\2\210\0\0C\0\0\0\0\17\251\0"
+ "\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0"
+ "\17\251\0\17\251\0$\360\0$\360\0$\360\0\0\0\0\0\317\0\0\317\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "$\360\0$\360\0$\360\0$\360\0\0\0\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0"
+ "\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\14\1\0\14\1\0\14\1"
+ "\0\14\1\0\15\1\0\15\1\0\0\0\0\0\0\0\14\2\0\14\2\0\14\2\0\14\2\0\16\2\0\16"
+ "\2\0\0\0\0\0\0\0\14!\0\14!\0\14!\0\14!\0\17(\0\17(\0\0\0\0\0\0\0\14+\0\14"
+ "+\0\14+\0\14+\0\20""9\0\20""9\0\0\0\0\0\0\0\36\215\0\36\215\0\36\215\0\36"
+ "\215\0(\264\0(\264\0\0\0\0\0\0\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251"
+ "\0\36\251\0\36\251\0\36\251\0\0\0\0\0\0\0$\360\0$\360\0$\360\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\36\3"
+ "\0\36\3\0\14\1\0\14\1\0\15\1\0\15\1\0\15\1\0\0\0\0\14\2\0\14\2\0\14\2\0\14"
+ "\2\0\16\2\0\16\2\0\16\2\0\0\0\0\14\3\0\14\3\0\14!\0\14!\0\17(\0\17(\0\17"
+ "(\0\0\0\0\14+\0\14+\0\14+\0\14+\0\20""9\0\20""9\0\20""9\0\0\0\0\14""7\0\14"
+ """7\0\36\215\0\36\215\0(\264\0(\264\0(\264\0\0\0\0\36\251\0\36\251\0\36\251"
+ "\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0H\360\0"
+ "H\360\0\0\0\0$\360\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\36\3\0\36\3\0\36\3\0\14\1\0\15\1\0\15\1\0\15\1"
+ "\0\0\0\0\14\2\0\14\2\0\14\2\0\14\2\0\16\2\0\16\2\0\16\2\0\0\0\0\14\3\0\14"
+ "\3\0\14\3\0\14!\0\17(\0\17(\0\17(\0\0\0\0\14+\0\14+\0\14+\0\14+\0\20""9\0"
+ "\20""9\0\20""9\0\0\0\0\14""7\0\14""7\0\14""7\0\36\215\0(\264\0(\264\0(\264"
+ "\0\0\0\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36"
+ "\251\0\36\251\0\36\251\0\36\251\0H\360\0H\360\0H\360\0\0\0\0$\360\0$\360"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\13\1\0\13\1\0\13\1\0\13\1\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\11!\0"
+ "\11!\0\11!\0\11!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\23n\0\23n\0\23n\0\23n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0H\360\0H\360\0H\360\0H\360\0\0\0\0$\360\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\1\0\1\1\0\0\0\0\0\0\0\0\0\0\0\0\0\25\0\0\25\0\0\25\0\0\27\0"
+ "\0\13\0\0\13\0\0\1\0\0\11\0\0\4\0\0\4\0\0\0\0\0\0\0\0\25\3\0\25\3\0\0\0\0"
+ "\0\0\0\25\3\0\25\3\0\25\3\0\25\3\0\3\1\0\3\1\0\2\1\0\7\5\0\7\3\0\7\3\0\0"
+ "\0\0\0\0\0\25""4\0\25""4\0\0\0\0\0\0\0\25""4\0\25""4\0\25""4\0\25""4\0\20"
+ "\35\0\20\35\0\11\22\0\23F\0\34""6\0\34""6\0\0\0\0\0\0\0L\317\0L\317\0L\317"
+ "\0L\317\0L\317\0L\317\0L\317\0L\317\0\0\0\0\0\0\0""2\317\0""2\317\0""2\317"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\0\0\0\0\0\0\0\0\0\0\25\0\0\25"
+ "\0\0\25\0\0\4\0\0\5\0\0\2\0\0\1\0\0\4\0\0\14\0\0\14\0\0\0\0\0\37\7\0\37\7"
+ "\0\25\3\0\0\0\0\25\3\0\25\3\0\25\3\0\25\3\0\37\6\0\37\6\0\15\4\0\11\3\0\7"
+ "\3\0\14\10\0\14\10\0\0\0\0\25\16\0\25\16\0\25""4\0\0\0\0\25""4\0\25""4\0"
+ "\25""4\0\25""4\0&Q\0&Q\0&Q\0\31""5\0\34""6\0&j\0&j\0\0\0\0""5q\0""5q\0L\317"
+ "\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0\0\0\0""2"
+ "\317\0""2\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\1\0\0\0\0\0\0\0\25\0"
+ "\0\25\0\0\25\0\0\31\1\0\5\0\0\5\0\0\2\0\0\4\0\0\14\0\0\14\0\0\0\0\0\37\7"
+ "\0\37\7\0\37\7\0\0\0\0\25\3\0\25\3\0\25\3\0\25\3\0\37\6\0\37\6\0\37\6\0\11"
+ "\3\0\16\6\0\16\6\0\7\3\0\0\0\0\25\16\0\25\16\0\25\16\0\0\0\0\25""4\0\25""4"
+ "\0\25""4\0\25""4\0&Q\0&Q\0&Q\0\31""5\0+X\0+X\0\34""6\0\0\0\0""5q\0""5q\0"
+ """5q\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317"
+ "\0L\317\0\0\0\0""2\317\0""2\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0"
+ "\0\0\0\0\25\0\0\25\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0L\317\0L\317\0L\317\0L\317"
+ "\0\0\0\0""2\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0e\4\0e\4\0\0\0\0\0\0\0e\11\0e\11\0\0\0\0\0\0\0e\16\0e\16\0\0\0\0\0\0"
+ "\0G\11\0G\11\0\0\0\0\0\0\0G\14\0G\14\0\0\0\0\0\0\0G\17\0G\17\0\0\0\0\0\0"
+ "\0G\21\0G\21\0\0\0\0\0\0\0GK\0GK\0\0\0\0\0\0\0GT\0GT\0\0\0\0\0\0\0G^\0G^"
+ "\0\0\0\0\0\0\0Gg\0Gg\0\0\0\0\0\0\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317"
+ "\0e\317\0e\317\0\0\0\0\0\0\0L\317\0L\317\0L\317\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0e\4\0e\4\0e\4\0\0\0\0e\11\0e\11\0e\11\0\0\0"
+ "\0e\16\0e\16\0e\16\0\0\0\0e\22\0e\22\0G\11\0\0\0\0G\14\0G\14\0G\14\0\0\0"
+ "\0G\17\0G\17\0G\17\0\0\0\0G\21\0G\21\0G\21\0\0\0\0G\24\0G\24\0GK\0\0\0\0"
+ "GT\0GT\0GT\0\0\0\0G^\0G^\0G^\0\0\0\0Gg\0Gg\0Gg\0\0\0\0Gq\0Gq\0e\317\0e\317"
+ "\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0\0\0\0L\317\0L"
+ "\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0e\4\0e\4\0e\4\0\0\0"
+ "\0e\11\0e\11\0e\11\0\0\0\0e\16\0e\16\0e\16\0\0\0\0e\22\0e\22\0e\22\0\0\0"
+ "\0G\14\0G\14\0G\14\0\0\0\0G\17\0G\17\0G\17\0\0\0\0G\21\0G\21\0G\21\0\0\0"
+ "\0G\24\0G\24\0G\24\0\0\0\0GT\0GT\0GT\0\0\0\0G^\0G^\0G^\0\0\0\0Gg\0Gg\0Gg"
+ "\0\0\0\0Gq\0Gq\0Gq\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317"
+ "\0e\317\0e\317\0e\317\0\0\0\0L\317\0L\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0e\4\0e\4\0e\4\0\0\0\0b\10\0b\10\0b\10\0\0\0\0b\15\0b\15\0b\15\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0<\16\0<\16\0<\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0""2J\0""2J\0""2J\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\317\0e\317\0e\317\0e"
+ "\317\0\0\0\0L\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0c\0\0c\0\0\0\0\0"
+ "`\0\0c\0\0c\0\0\2\0\0c\1\0i\0\0i\0\0\0\0\0\0\0\0e\0\0e\0\0\0\0\0\0\0\0{\1"
+ "\0{\1\0f\0\0f\0\0z\1\0z\1\0z\1\0z\1\0)\4\0)\4\0\0\0\0\0\0\0Q\7\0Q\7\0\0\0"
+ "\0\0\0\0{&\0{&\0W\32\0W\32\0z&\0z&\0z&\0z&\0IC\0IC\0\0\0\0\0\0\0X^\0X^\0"
+ "\0\0\0\0\0\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0"
+ "\261\251\0\261\251\0\0\0\0\0\0\0e\317\0e\317\0e\317\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\216\1\0c\0\0`\0\0\2\0\0c\0\0c\0\0c\0\0\12\0\0k\1\0i\0\0"
+ "\0\0\0\11\0\0i\0\0i\0\0\0\0\0\256\2\0\256\2\0{\1\0f\0\0z\1\0z\1\0z\1\0z\1"
+ "\0\221\1\0\221\1\0\221\17\0\0\0\0)\4\0c\11\0c\11\0\0\0\0\256+\0\256+\0{&"
+ "\0W\32\0z&\0z&\0z&\0z&\0\2415\0\2415\0\243\210\0\0\0\0IC\0{|\0{|\0\0\0\0"
+ "\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261"
+ "\251\0\261\251\0\261\251\0\264\360\0\264\360\0\0\0\0e\317\0e\317\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0\216\1\0`\0\0\2\0\0c\0\0c\0\0c\0\0\12\0\0"
+ "k\1\0k\1\0\0\0\0\11\0\0i\0\0i\0\0\0\0\0\256\2\0\256\2\0\256\2\0f\0\0z\1\0"
+ "z\1\0z\1\0z\1\0\221\1\0\221\1\0\221\1\0\0\0\0\221\17\0\221\17\0)\4\0\0\0"
+ "\0\256+\0\256+\0\256+\0W\32\0z&\0z&\0z&\0z&\0\2415\0\2415\0\2415\0\0\0\0"
+ "\243\210\0\243\210\0IC\0\0\0\0\261\251\0\261\251\0\261\251\0\261\251\0\261"
+ "\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\264\360"
+ "\0\264\360\0\264\360\0\0\0\0e\317\0e\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1"
+ "\0\211\1\0c\0\0\2\0\0c\0\0c\0\0k\0\0\12\0\0k\1\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\360\0\264\360"
+ "\0\264\360\0\264\360\0\0\0\0e\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\211\1\0\216\1"
+ "\0c\0\0\2\0\0c\0\0k\0\0q\0\0\20\0\0\0\0\0\0\0\0\322\1\0\322\1\0\322\1\0\322"
+ "\1\0\346\1\0\346\1\0\0\0\0\0\0\0\322\2\0\322\2\0\322\2\0\322\2\0\363\2\0"
+ "\363\2\0\0\0\0\0\0\0\322!\0\322!\0\322!\0\322!\0\371(\0\371(\0\0\0\0\0\0"
+ "\0\322+\0\322+\0\322+\0\322+\0\3719\0\3719\0\0\0\0\0\0\0\325\215\0\325\215"
+ "\0\325\215\0\325\215\0\374\264\0\374\264\0\0\0\0\0\0\0\325\251\0\325\251"
+ "\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\0\0\0\0\0"
+ "\0\264\360\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\211\1\0\216"
+ "\1\0c\0\0\2\0\0f\0\0m\0\0m\0\0\0\0\0\325\3\0\325\3\0\322\1\0\322\1\0\346"
+ "\1\0\346\1\0\346\1\0\0\0\0\322\2\0\322\2\0\322\2\0\322\2\0\363\2\0\363\2"
+ "\0\363\2\0\0\0\0\322\3\0\322\3\0\322!\0\322!\0\371(\0\371(\0\371(\0\0\0\0"
+ "\322+\0\322+\0\322+\0\322+\0\3719\0\3719\0\3719\0\0\0\0\3227\0\3227\0\325"
+ "\215\0\325\215\0\374\264\0\374\264\0\374\264\0\0\0\0\325\251\0\325\251\0"
+ "\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325"
+ "\251\0\330\360\0\330\360\0\0\0\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\216\1\0\216\1\0c\0\0\10\0\0m\0\0m\0\0\0\0\0\325\3\0\325\3\0\325"
+ "\3\0\322\1\0\346\1\0\346\1\0\346\1\0\0\0\0\322\2\0\322\2\0\322\2\0\322\2"
+ "\0\363\2\0\363\2\0\363\2\0\0\0\0\322\3\0\322\3\0\322\3\0\322!\0\371(\0\371"
+ "(\0\371(\0\0\0\0\322+\0\322+\0\322+\0\322+\0\3719\0\3719\0\3719\0\0\0\0\322"
+ "7\0\3227\0\3227\0\325\215\0\374\264\0\374\264\0\374\264\0\0\0\0\325\251\0"
+ "\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325"
+ "\251\0\325\251\0\325\251\0\330\360\0\330\360\0\330\360\0\0\0\0\264\360\0"
+ "\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0\216\1\0i\0\0\10\0\0m\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\275\1\0\275\1\0\275\1\0"
+ "\275\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\244!\0\244!\0\244!\0\244!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\213n\0\213n\0\213n\0\213n\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\360\0\330\360\0\330\360\0\330"
+ "\360\0\0\0\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0\224\1\0i\0\0\10\0"
+ "\0\0\0\0\0\0\0\325\3\0\325\3\0\325\3\0\351\3\0\365\1\0\365\1\0\14\0\0\313"
+ "\2\0#\2\0#\2\0\0\0\0\0\0\0\371\37\0\371\37\0\0\0\0\0\0\0\371\37\0\371\37"
+ "\0\371\37\0\371\37\0.\17\0.\17\0#\14\0\304-\0Y!\0Y!\0\0\0\0\0\0\0\371p\0"
+ "\371p\0\0\0\0\0\0\0\371p\0\371p\0\371p\0\371p\0O>\0O>\0""3(\0\247\227\0\211"
+ "s\0\211s\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\330\360\0\330\360\0\330\360\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\224\1\0i\0\0\0\0\0\0\0\0\325\3\0\325"
+ "\3\0\325\3\0\17\2\0\"\2\0!\0\0\35\0\0#\2\0\342\4\0\342\4\0\0\0\0\371\37\0"
+ "\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0\3775"
+ "\0\374%\0\304\34\0Y!\0\373C\0\373C\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371"
+ "p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0\247q\0\211s\0\375"
+ "\342\0\375\342\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0"
+ "\0\0\330\360\0\330\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\12\0\0\224\1\0\0\0"
+ "\0\0\0\0\325\3\0\325\3\0\325\3\0\344\5\0\"\2\0\"\2\0\200\0\0#\2\0\342\4\0"
+ "\342\4\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37"
+ "\0\371\37\0\3775\0\3775\0\3775\0\304\34\0\3732\0\3732\0Y!\0\0\0\0\371p\0"
+ "\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377"
+ "\256\0\247q\0\375\274\0\375\274\0\211s\0\0\0\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\330\360\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\12\0\0\0\0\0i\0\0\0\0\0\325\3\0\325\3\0\344\5\0\344\5"
+ "\0\"\2\0\36\1\0""4\2\0#\2\0\342\4\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0"
+ "\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0\3775\0\3775\0\307)\0\3732\0"
+ "\3732\0\3732\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371"
+ "p\0\377\256\0\377\256\0\377\256\0\247q\0\375\274\0\375\274\0\375\274\0\0"
+ "\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\0\0\0\330\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\12\0\0"
+ "\10\0\0\0\0\0\325\3\0\344\5\0\344\5\0\344\5\0\340\4\0\367\11\0\364\3\0#\2"
+ "\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371"
+ "\37\0\3775\0\3775\0\3775\0\307)\0\376G\0\3732\0\3732\0\0\0\0\371p\0\371p"
+ "\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0"
+ "\247q\0\375\274\0\375\274\0\375\274\0\0\0\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\12\0\0\10\0\0\0\0\0\0\0\0\17\2\0\17"
+ "\2\0\17\2\0\323\2\0\352\7\0\347\2\0\26\1\0\0\0\0\371\37\0\371\37\0\371\37"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0/\26\0\0\0\0""7\36\0""6\25\0"
+ """6\25\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0O>\0O>\0"
+ "O>\0\0\0\0VK\0VK\0VK\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\12\0"
+ "\0\10\0\0\0\0\0\17\2\0\17\2\0\344\5\0\15\1\0\352\7\0\352\7\0\347\2\0\0\0"
+ "\0\371\37\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\362\4\0\0\0\0/\26\0/\26\0"
+ "\3775\0$\21\0""7\36\0""7\36\0\3672\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\0\0"
+ "\0\0\0\0\370A\0\0\0\0O>\0O>\0\377\256\0""3(\0VK\0VK\0\372\264\0\0\0\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\341\271\0\0\0\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\343\350\0\0\0\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\5\0\0\10\0\0\0\0"
+ "\0\17\2\0\17\2\0\17\2\0\15\1\0\352\7\0\352\7\0\347\2\0\0\0\0\371\37\0\371"
+ "\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0/\26\0$\21\0""7\36"
+ "\0""7\36\0""6\25\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0O>\0O>\0O>\0""3(\0VK\0VK\0VK\0\0\0\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\5\0\0\5\0\0\5\0\0\0\0\0\344\5\0\344\5\0\344\5\0\316\4\0\367"
+ "\11\0\367\11\0\364\3\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371"
+ "\37\0\371\37\0\371\37\0\3775\0\3775\0\3775\0\307)\0\376G\0\376G\0\3732\0"
+ "\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377"
+ "\256\0\377\256\0\247q\0\375\274\0\375\274\0\375\274\0\0\0\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5"
+ "\0\0\5\0\0\5\0\0\17\2\0\344\5\0\344\5\0\316\4\0\345\11\0\367\11\0\364\3\0"
+ "\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37"
+ "\0\3775\0\3775\0\3775\0\307)\0\376G\0\376G\0\3732\0\0\0\0\371p\0\371p\0\371"
+ "p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0\247q"
+ "\0\375\274\0\375\274\0\375\274\0\0\0\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\5\0\0\0\0\0\17\2"
+ "\0\344\5\0\344\5\0\15\1\0$\6\0$\6\0#\2\0\0\0\0\371\37\0\371\37\0\371\37\0"
+ "\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0/\26\0/\26\0\307)\0\376"
+ "G\0[/\0Y!\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0"
+ "\377\256\0O>\0O>\0\247q\0\375\274\0\211s\0\211s\0\0\0\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0"
+ "\5\0\0\17\2\0\17\2\0\344\5\0\316\4\0$\6\0$\6\0#\2\0\0\0\0\371\37\0\371\37"
+ "\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0/\26\0/\26\0"
+ "\307)\0\376G\0[/\0Y!\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371"
+ "p\0\371p\0\377\256\0O>\0O>\0\247q\0\375\274\0\211s\0\211s\0\0\0\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\5\0\0\24\2\0\17\2\0\17\2\0\316\4\0\345\11\0$\6\0#\2\0\0\0\0\371"
+ "\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0"
+ "\3775\0\3775\0\307)\0\376G\0\376G\0\3732\0\0\0\0\371p\0\371p\0\371p\0\0\0"
+ "\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0\247q\0\375\274"
+ "\0\375\274\0\375\274\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0"
+ "\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\24\2\0\24"
+ "\2\0\17\2\0\316\4\0\345\11\0\342\3\0#\2\0\0\0\0\371\37\0\371\37\0\371\37"
+ "\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0\3775\0\3775\0\307)\0"
+ "\376G\0\3732\0\3732\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371"
+ "p\0\371p\0\377\256\0\377\256\0\377\256\0\247q\0\375\274\0\375\274\0\375\274"
+ "\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\17\2\0\24\2\0\5\0\0\0\0\0\27\5\0\342\3\0\313"
+ "\1\0\0\0\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\371\37\0\0\0\0\0\0\0/\26\0"
+ "\3775\0\371\37\0\302\30\0\3716\0Y!\0#\14\0\0\0\0\371p\0\371p\0\0\0\0\0\0"
+ "\0\0\0\0\371p\0\0\0\0\0\0\0O>\0\377\256\0\371p\0\243I\0\371\224\0\211s\0"
+ """3(\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374"
+ "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0"
+ "\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\17\2\0\17\2\0\0\0\0\0\0\0\26\1\0\26\1\0\0\0\0\0\0\0\371"
+ "\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0\0\0\0\0\0"
+ "\0""6\25\0""6\25\0\0\0\0\0\0\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0O>\0O>\0\0\0\0\0\0\0VK\0VK\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374"
+ "\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\17\2\0\17\2\0\0\0\0\0\0\0\26\1\0\26\1\0\0\0\0\0\0"
+ "\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0\0\0"
+ "\0\0\0\0""6\25\0""6\25\0\0\0\0\0\0\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0O>\0O>\0\0\0\0\0\0\0VK\0VK\0\0\0\0\0\0\0\374\360\0\374\360"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0"
+ "\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\17\2\0\17\2\0\16\0\0\0\0\0\26\1\0\26\1\0\26"
+ "\1\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0"
+ "/\26\0.\17\0\0\0\0""6\25\0""6\25\0""6\25\0\0\0\0\371p\0\371p\0\371p\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0O>\0O>\0O>\0\0\0\0VK\0VK\0VK\0\0\0\0\374\360\0"
+ "\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360"
+ "\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\16\0\0\14\0\0\14"
+ "\0\0#\2\0#\2\0\0\0\0\0\0\0\371\37\0\371\37\0\0\0\0\0\0\0\371\37\0\371\37"
+ "\0\371\37\0\371\37\0.\17\0.\17\0#\14\0#\14\0Y!\0Y!\0\0\0\0\0\0\0\371p\0\371"
+ "p\0\0\0\0\0\0\0\371p\0\371p\0\371p\0\371p\0O>\0O>\0""3(\0""3(\0\211s\0\211"
+ "s\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360"
+ "\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+};
+
+/**
+ * \brief Returns the BlitBlendAll test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageBlitBlendAll()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageBlitBlendAll.pixel_data,
+ SDLTest_imageBlitBlendAll.width,
+ SDLTest_imageBlitBlendAll.height,
+ SDLTest_imageBlitBlendAll.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendAll.width * SDLTest_imageBlitBlendAll.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_imageFace.c b/src/3rdparty/SDL2/src/test/SDL_test_imageFace.c
new file mode 100644
index 0000000..9b43637
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_imageFace.c
@@ -0,0 +1,247 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* GIMP RGBA C-Source image dump (face.c) */
+
+static const SDLTest_SurfaceImage_t SDLTest_imageFace = {
+ 32, 32, 4,
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0"
+ "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+ "\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\0\0\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377"
+ "\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\0\0\0\377\0\0\0\377\377\377\377\0\0\0\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0"
+ "\377\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0"
+ "\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0"
+ "\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0"
+ "\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377"
+ "\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0"
+ "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377"
+ "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+ "\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377"
+ "\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0"
+ "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0"
+ "\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\0\0\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0"
+ "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
+ "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377"
+ "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0"
+ "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
+ "\377\377\0\377\377\377\0",
+};
+
+/**
+ * \brief Returns the Face test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImageFace()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imageFace.pixel_data,
+ SDLTest_imageFace.width,
+ SDLTest_imageFace.height,
+ SDLTest_imageFace.bytes_per_pixel * 8,
+ SDLTest_imageFace.width * SDLTest_imageFace.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_imagePrimitives.c b/src/3rdparty/SDL2/src/test/SDL_test_imagePrimitives.c
new file mode 100644
index 0000000..17597c6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_imagePrimitives.c
@@ -0,0 +1,514 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* GIMP RGB C-Source image dump (primitives.c) */
+
+static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
+ 80, 60, 3,
+ "\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15"
+ "I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310"
+ "\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0"
+ "\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0"
+ "\0\5ii\0\0\0\5ii\0\0\0\3\1\1\0\0\0\5\2\1\0\0\0\7\3\2\0\0\0\11\4\3\0\0\0\13"
+ "\5\3\0\0\0\15\6\4\0\0\0\17\7\5\0\0\0\21\10\5\0\0\0\23\11\6\0\0\0\25\12\7"
+ "\0\0\0\27\13\7\0\0\0\31\14\10\0\0\0\33\15\11\0\0\0\35\16\11\0\0\0\37\17\12"
+ "\0\0\0!\20\13\0\0\0#\21\13\0\0\0%\22\14\0\0\0'\23\15\15I\310)\24\15\15I\310"
+ "+\25\16\15I\310-\26\17\15I\310/\27\17\15I\3101\30\20\15I\3103\31\21\15I\310"
+ "5\32\21\15I\3107\33\22\15I\3109\34\23\15I\310;\35\23\15I\310=\36\24\15I\310"
+ "?\37\25\15I\310A\40\25\15I\310C!\26\15I\310E\"\27\15I\310G#\27\15I\310I$"
+ "\30\15I\310K%\31\15I\310M&\31\5iiO'\32\0\0\0\0\0\0\5ii\0\0\0\10\4\2\0\0\0"
+ "\14\6\4\0\0\0\20\10\5\0\0\0\24\12\6\0\0\0\30\14\10\0\0\0\34\16\11\0\0\0\40"
+ "\20\12\0\0\0$\22\14\0\0\0(\24\15\0\0\0,\26\16\0\0\0""0\30\20\0\0\0""4\32"
+ "\21\0\0\0""8\34\22\0\0\0<\36\24\0\0\0@\40\25\0\0\0D\"\26\0\0\0H$\30\0\0\0"
+ "L&\31\0\0\0P(\32\15I\310T*\34\15I\310X,\35\15I\310\\.\36\15I\310`0\40\15"
+ "I\310d2!\15I\310h4\"\15I\310l6$\15I\310p8%\15I\310t:&\15I\310x<(\15I\310"
+ "|>)\15I\310\200@*\15I\310\204B,\15I\310\210D-\15I\310\214F.\15I\310\220H"
+ "0\15I\310\224J1\15I\310\230L2\5ii\234N4\15I\310\0\0\0\0\0\0\0\0\0\5ii\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii"
+ "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d"
+ "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\5ii\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\5ii\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d"
+ "\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d"
+ "\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d"
+ "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5"
+ "ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d"
+ "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d"
+ "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0"
+ "\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0"
+ "\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0"
+ "\0\377\0\0\377\0\0\377\0\0\377\0\5ii\0\377\0\0\377\0\0\377\0\0\377\0\0\377"
+ "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0""77\5\0\377\0\0\377\0\0\377\0"
+ "\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\5ii\0\377\0\0\377\0\0\377"
+ "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377"
+ "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377"
+ "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5"
+ "ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d"
+ "\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5i"
+ "i\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310"
+ "\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\5ii\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310"
+ "\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\5ii\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\5ii\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15"
+ "I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d7"
+ "7\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0"
+ "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310"
+ "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310"
+ "\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5"
+ "ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310"
+ "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\0\0\0\0"
+ "\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\5ii\15I\310\15I\310\15I\310\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii"
+ "\15I\310\15I\310\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\5ii\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I"
+ "\310\15I\310\15I\310\15I\310\15I\310\5ii",
+};
+
+/**
+ * \brief Returns the Primitives test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImagePrimitives()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imagePrimitives.pixel_data,
+ SDLTest_imagePrimitives.width,
+ SDLTest_imagePrimitives.height,
+ SDLTest_imagePrimitives.bytes_per_pixel * 8,
+ SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_imagePrimitivesBlend.c b/src/3rdparty/SDL2/src/test/SDL_test_imagePrimitivesBlend.c
new file mode 100644
index 0000000..aa50662
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_imagePrimitivesBlend.c
@@ -0,0 +1,696 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* GIMP RGB C-Source image dump (alpha.c) */
+
+static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
+ 80, 60, 3,
+ "\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321"
+ ",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377"
+ "\377\377\377\377\311\324\311\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\0H\0\377\377\377\377\377\377\256\307\256\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\0c\0\377\377\377\377\377\377"
+ "\223\300\223\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\0~\0\377\377\377\377\377\377x\277x\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\0\231\0\377\377\377\377\377\377]\303]\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\0\264\0\377\377\377\377\377"
+ "\377B\316B\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0"
+ "\317\0\377\377\377\377\377\377'\335'\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\0\352\0\377\377\377#\262\6\260d\15\260e\15\224\357"
+ "/&\262\6\34\300\5.\314\22\40\315\12[\3747M\332/\27\331\12\27\331\12K\374"
+ "5K\3745K\3745D\3471D\3471D\3471D\3471D\3471D\3502D\3502D\3502D\3502D\350"
+ "2D\3502D\3502D\3502D\3502D\3502\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377,\372\27\273\3465\327"
+ "Q.\260d\15\213\213\40\241\3601\200\366*=\265\13?\301\25s\375<Y\316-X\320"
+ "-!\315\13]\3749]\3749O\3321O\3321P\3342P\3342P\3342\371\377\364\371\377\364"
+ "\371\377\364\371\377\364\371\377\364\362\375\360\362\375\360\362\375\360"
+ "\362\375\360\362\375\360D\3471D\3471D\3471D\3502D\3502D\3502D\3502D\3502"
+ "D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "K\3745&\262\6\213\213\40\11\2\0\260`\15\241~#m}\11\273\363AQ\247\15S\266"
+ "\31\212\373@e\302,\4\33\2s\375<\\\3161M\260*\\\3202X\320-\366\377\354\364"
+ "\377\352O\3321\3""5\2O\3321O\3321<\261&P\3342P\3342S\3655\377\377\377\377"
+ "\377\377\14Z\14\377\377\377\377\377\377\234\302\231\371\377\364\362\375\360"
+ "\367\377\365\362\375\360\362\375\360\13t\13\362\375\360\362\375\360\177\275"
+ "~\362\375\360\362\375\360\370\377\366\362\375\360\377\377\377\14\220\14\377"
+ "\377\377D\3502\"\267\33D\3502D\3502K\3779D\3502D\3502\3\233\2D\3502D\350"
+ "2\34\303\26D\3502D\3502L\377:D\3502D\3502\3\264\2D\3502D\3502\25\323\22\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\14\341\14\377\377"
+ "\377\377\377\377\40\353\40\377\377\377D\3471\34\300\5e\247\33\356\336?\277"
+ "f)\260P\17\260i\16\356\336?\331\353C\274\363GQ\247\15\243\370Cp\270)\212"
+ "\373@h\3021h\3042c\304+\364\377\336\\\3161\\\3161\\\3202\\\3202\\\3202\377"
+ "\377\377\364\377\352\364\377\352\346\371\342\346\371\342O\3321O\3321P\334"
+ "2P\3342P\3342P\3342P\3342P\3342\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\362\375\360\362\375\360\362\375\360\362\375\360\362\375"
+ "\360\362\375\360\362\375\360\362\375\360\362\375\360\362\375\360\362\375"
+ "\360\362\375\360\362\375\360\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502D\3502\40"
+ "\315\12=\265\13f\230\14\237y\15\274Y\17\327Q.\260X\14\243\177$\220\214\""
+ "\215\235*\274\363G\177\252+\243\370Cu\2661p\270)\367\377\324h\3021h\3021"
+ "h\3042\364\377\336\364\377\336\335\364\323\\\3161\\\3161\\\3202\\\3202\\"
+ "\3202\377\377\377\377\377\377\364\377\352\364\377\352\346\371\342\346\371"
+ "\342\346\371\342\346\371\342O\3321P\3342P\3342P\3342P\3342P\3342P\3342P\334"
+ "2\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\362\375\360\362\375\360"
+ "\362\375\360\362\375\360\362\375\360\362\375\360\362\375\360\362\375\360"
+ "\362\375\360\362\375\360\362\375\360\362\375\360\362\375\360\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\6\0\4[\3747?\301\25N\241\14\331\353C\243\177$\275Z\21\377\254W\260Q\17\30"
+ "\26\7\370\343N\201\210\16|\213-\274\363G\200\2521\202\263+\243\370Cu\266"
+ "1\12&\4\367\377\324h\3021S\241)h\3042h\3042\377\377\377\364\377\336\335\364"
+ "\323\24M\23\\\3161\\\3202C\245(\\\3202\\\3202\377\377\377\377\377\377\377"
+ "\377\377\30l\30\346\371\342\346\371\342\207\273\205\346\371\342\346\371\342"
+ "\361\377\355\377\377\377P\3342\7t\4P\3342P\3342/\260\"P\3342P\3342^\377@"
+ "\377\377\377\377\377\377\30\242\30\377\377\377\377\377\377d\306d\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\30\275\30\377\377\377"
+ "\377\377\377K\322K\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\30\330\30\362\375\360\362\375\3601\3431\362\375\360\362\375\360\377"
+ "\377\377\362\375\360D\3502M\332/s\375<>\265\14\177\252+\201\210\16\245\204"
+ "*\377\314U\312\\,\224'\11\260i\17\244\210\40\232\2211\331\353J\215\2351\377"
+ "\377\276\200\2521\200\2542\375\377\310u\2661t\2702t\2702\367\377\324\325"
+ "\355\305h\3021h\3042h\3042\377\377\377\377\377\377\364\377\336\335\364\323"
+ "\335\364\323\335\364\323\\\3202\\\3202\\\3202\\\3202\\\3202\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\346\371\342\346\371\342\346"
+ "\371\342\346\371\342\346\371\342\346\371\342\346\371\342\377\377\377\377"
+ "\377\377P\3342P\3342P\3342P\3342P\3342P\3342P\3342P\3342\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\27\331\12Y\316-h\3021\243\370Cg\230\15\230\224\"\245"
+ "\204*\377\314U\310J\21\327Q.\260b\21\245\2041\370\343N\230\2242\331\353J"
+ "\214\2402\377\377\276\200\2521\200\2542\375\377\310\317\344\266u\2661t\270"
+ "2\377\377\377\367\377\324\325\355\305h\3021h\3042h\3042h\3042\377\377\377"
+ "\377\377\377\364\377\336\335\364\323\335\364\323\335\364\323\335\364\323"
+ "\\\3202\\\3202\\\3202\\\3202\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\346\371\342\346\371"
+ "\342\346\371\342\346\371\342\346\371\342\346\371\342\377\377\377\377\377"
+ "\377\377\377\377\377\377\377P\3342P\3342P\3342P\3342P\3342P\3342P\3342P\334"
+ "2\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377K\3745!\315\13d\304,p\270)\177\252+\23\13\6\232\2211\245\204"
+ "1\347\270O\377\277Y\324<\22\265V\24\377\330Q\244\210\40#(\13\230\224\"\331"
+ "\353Ju\211.\377\377\276\200\2521\210\273:\200\2542\375\377\310\20""3\6u\266"
+ "1t\2702\271\307\271\367\377\324\325\355\305\341\377\321h\3021h\3042\16L\7"
+ "h\3042\377\377\377\242\300\242\377\377\377\335\364\323\355\377\343\335\364"
+ "\323\335\364\323\14f\7\\\3202\\\3202>\250*\\\3202\377\377\377\377\377\377"
+ "\377\377\377\377\377\377$\231$\377\377\377\377\377\377s\303s\377\377\377"
+ "\346\371\342\376\377\372\346\371\342\346\371\342\40\257\37\346\371\342\346"
+ "\371\342\\\316\\\377\377\377\377\377\377\377\377\377\377\377\377P\3342\13"
+ "\262\7P\3342P\3342*\327%P\3342P\3342o\377Q\377\377\377\377\377\377$\352$"
+ "\377\377\377\377\377\377K\3745]\3749s\375<\212\373@\243\370C\274\363G\331"
+ "\353J\370\343N\377\330Q\377\314U\377\277Y\377\260\\\224(\11\260|\36\245\204"
+ "1\377\377\250\232\2211\230\224\"\215\2351\214\2402\377\377\276\312\332\250"
+ "\200\2521\200\2542\377\377\377\317\344\266u\2661t\2702t\2702\377\377\377"
+ "\377\377\377\325\355\305\325\355\305\325\355\305h\3042h\3042h\3042\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\335\364\323\335\364\323\335\364"
+ "\323\335\364\323\335\364\323\\\3202\\\3202\\\3202\\\3202\\\3202\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\346\371\342\346\371\342"
+ "\346\371\342\346\371\342\346\371\342\346\371\342\346\371\342\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377P\3342P\3342"
+ "P\3342P\3342\377\377\377K\3745O\3321\\\3161h\3021t\2702~\254'\214\240%\377"
+ "\377\262\370\343N\377\330Q\262x1\277l1\312`1\327R.\260X\23\377\330Q\244\210"
+ "2\377\377\250\230\2242\377\377\262\215\2351\214\2402\377\377\377\312\332"
+ "\250\200\2521\200\2542\377\377\377\375\377\310\317\344\266u\2661t\2702t\270"
+ "2\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305h\3042h\304"
+ "2h\3042h\3042\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\335\364\323\335\364\323\335\364\323\335\364\323\377\377\377\\\3202\\\320"
+ "2\\\3202\\\3202\\\3202\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\346\371\342\346\371\342\346\371\342\346"
+ "\371\342\346\371\342\346\371\342\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377D\3471O\3321\21\7\11c\304+\367\377\324o\2520\200\252"
+ "1\214\2402\235\226'\377\377\250\377\330Q!\20\11\277l1\310d2\266?\33\224("
+ "\11\260|\36\257\217;\377\377\250\232\2211\34$\11\377\377\262\215\2351q\206"
+ "0\377\377\377\312\332\250\217\303@\200\2542\200\25420Z0\317\344\266\317\344"
+ "\266X\2260t\2702t\2702\377\377\377\377\377\377\325\355\305(l%\325\355\305"
+ "\325\355\305K\2410h\3042h\3042\377\377\377\377\377\377\377\377\3770\2200"
+ "\377\377\377\377\377\377t\274p\335\364\323\335\364\323\373\377\361\377\377"
+ "\377\377\377\377\21\213\11\\\3202\\\3202<\274/\\\3202\377\377\377\377\377"
+ "\377\377\377\377\377\377\3770\3060\377\377\377\377\377\377V\330V\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\3770\3410\346\371\342\346"
+ "\371\342>\352>\346\371\342\377\377\377D\3471P\3342\364\377\352s\375<h\302"
+ "1t\2702~\254'\377\377\276\215\2351\230\2242\244\210\40\377\377\234\262x1"
+ "\277l1\310W\32\377\260\\\327T1\260|2\377\330Q\244\2102\377\377\250\232\221"
+ "1\230\2242\377\377\262\215\2351\214\2402\377\377\377\377\377\276\312\332"
+ "\250\200\2542\200\2542\377\377\377\375\377\310\317\344\266\317\344\266t\270"
+ "2t\2702t\2702\377\377\377\377\377\377\377\377\377\325\355\305\325\355\305"
+ "\325\355\305h\3042h\3042h\3042h\3042\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\335\364\323\335\364\323\335\364\323"
+ "\335\364\323\335\364\323\377\377\377\377\377\377\\\3202\\\3202\\\3202\\\320"
+ "2\\\3202\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377D\3471P\3342\364\377\352\\\3161h\3042\367"
+ "\377\324u\2661\200\2542\214\240%\377\377\262\232\2211\244\2102\377\377\234"
+ "\262x1\274p2\377\337\207\377\260\\\327T1\227/\14\377\377\234\245\2041\244"
+ "\2102\307\300\213\230\2242\377\377\377\377\377\262\215\2351\214\2402\377"
+ "\377\377\377\377\276\312\332\250\200\2542\200\2542\377\377\377\377\377\377"
+ "\317\344\266\317\344\266\317\344\266t\2702t\2702\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305\377\377\377"
+ "h\3042h\3042h\3042h\3042\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\335\364\323\335\364\323\335\364\323"
+ "\335\364\323\377\377\377\377\377\377\377\377\377\\\3202\\\3202\\\3202\\\320"
+ "2\\\3202\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377<\0<D\3502\371\377\364N\3221\\\3202\364\377"
+ "\336l\3035t\2702\375\377\310\36\22\13\214\2402\377\377\262\214\2012\244\210"
+ "2\377\377\234\274\177;\274p2\377\337\207/\24\13\324X2\227/\14\222l3\307\260"
+ "|\244\2102\377\377\270\232\2211\230\2242<Q<\310\316\231\215\2351o\2065\377"
+ "\377\377\377\377\276\341\377\277\200\2521\200\2542\36H\13\377\377\377\377"
+ "\377\377\213\260}\317\344\266t\2702\221\366Ot\2702\377\377\377<\207<\377"
+ "\377\377\377\377\377}\270v\325\355\305\325\355\305\371\377\351\377\377\377"
+ "h\3042\30|\13h\3042\377\377\377|\306|\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377<\275<\335\364\323\335\364\323_\317]\335\364\323"
+ "\335\364\323\377\377\377\377\377\377\377\377\377\25\260\13\\\3202\\\3202"
+ ">\3369\\\3202\377\377\377\377\377\377\377\377\377\377\377\377D\3502\371\377"
+ "\364O\3321\\\3202\364\377\336h\3042\367\377\324u\2661\200\2542\377\377\276"
+ "\215\2351\230\2242\307\300\213\244\2102\377\377\234\262x1\274p2\377\337\207"
+ "\312`1\324E\30\327T1\260|2\377\377\234\245\2041\244\2102\377\377\250\232"
+ "\2211\230\2242\377\377\377\310\316\231\215\2351\214\2402\377\377\377\377"
+ "\377\377\312\332\250\312\332\250\200\2542\200\2542\377\377\377\377\377\377"
+ "\317\344\266\317\344\266\317\344\266t\2702t\2702t\2702\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\325\355\305\325\355\305\325\355"
+ "\305\377\377\377h\3042h\3042h\3042h\3042\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\335\364\323\335\364\323\335\364\323\335\364\323\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\\\3202\\\3202\\\3202\377\377\377D\3502\371\377"
+ "\364O\3321\377\377\377\\\3161h\3042\367\377\324t\2702\375\377\310\200\252"
+ "1\377\377\377\215\2351\230\2242\377\377\250\244\2102\377\377\234\262x1\274"
+ "p2\316\214_\310d2\377\310|\327T1\227/\14\377\377\377\307\260|\244\2102\377"
+ "\377\377\307\300\213\230\2242\230\2242\377\377\377\310\316\231\214\2402\214"
+ "\2402\377\377\377\377\377\377\312\332\250\312\332\250\200\2542\200\2542\377"
+ "\377\377\377\377\377\377\377\377\317\344\266\317\344\266\317\344\266t\270"
+ "2t\2702t\2702\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\325\355\305\325\355\305\325\355\305\377\377\377\377\377\377h\3042h\3042"
+ "h\3042\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\335\364\323\335\364"
+ "\323\335\364\323\335\364\323\377\377\377\377\377\377\377\377\377\377\377"
+ "\377D\3502\371\377\364R\3344\364\377\352\\\3161H\22Hh\3021\377\377\377o\244"
+ "2\200\2542\312\332\250\226\245<\377\377\262\230\2242H-/\245\2041\377\377"
+ "\377\233i5\274p2\277l1\331sC\377\310|\324X2*\15\3\260|2\377\377\234\206s"
+ "7\244\2102\377\377\250\340\337\244\230\2242\377\377\377Hc2\310\316\231\214"
+ "\2402n\211:\377\377\377\377\377\377\353\377\311\312\332\250\200\2542$T\16"
+ "\377\377\377\377\377\377\236\277\236\377\377\377\317\344\266\367\377\336"
+ "\377\377\377t\2702\40n\16t\2702\377\377\377\212\303\212\377\377\377\377\377"
+ "\377\377\377\377\325\355\305\325\355\305<\2477\377\377\377\377\377\377O\276"
+ "Ah\3042h\3042\237\377i\377\377\377\377\377\377H\317H\377\377\377\377\377"
+ "\377c\335c\377\377\377\377\377\377\377\377\377\377\377\377\335\364\323>\337"
+ ";\335\364\323\377\377\377D\3502\362\375\360P\3342\346\371\342\\\3202\364"
+ "\377\336h\3042\367\377\324t\2702\375\377\310\200\2542\377\377\276\214\240"
+ "2\377\377\262\232\2211\377\377\377\245\2041\377\377\377\262x1\377\377\377"
+ "\277l1\310d2\312`1\324X2\327T1\260|2\377\377\377\307\260|\244\2102\377\377"
+ "\377\307\300\213\232\2211\230\2242\377\377\377\377\377\262\310\316\231\214"
+ "\2402\214\2402\377\377\377\377\377\377\312\332\250\312\332\250\200\2542\200"
+ "\2542\200\2542\377\377\377\377\377\377\377\377\377\317\344\266\317\344\266"
+ "\317\344\266\377\377\377t\2702t\2702t\2702\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305\325\355"
+ "\305\377\377\377\377\377\377h\3042h\3042h\3042h\3042\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377D\3502\362\375\360P\3342\346\371\342\\\3202\335"
+ "\364\323h\3042\325\355\305t\2702\317\344\266\377\377\377\200\2521\377\377"
+ "\377\215\2351\377\377\377\232\2211\377\377\377\245\2041\377\377\377\262x"
+ "1\377\377\377\277l1\377\377\377\312`1\377\310|\327T1\227/\14\377\377\377"
+ "\307\260|\244\2102\244\2102\377\377\377\307\300\213\230\2242\230\2242\377"
+ "\377\377\310\316\231\310\316\231\214\2402\214\2402\377\377\377\377\377\377"
+ "\312\332\250\312\332\250\377\377\377\200\2542\200\2542\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\317\344\266\317\344\266\377\377\377\377\377"
+ "\377t\2702t\2702\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305\377\377"
+ "\377\377\377\377\377\377\377h\3042h\3042h\3042\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377D\3502\362\375\360"
+ "T\11TO\3321\377\377\377Z\3002\377\377\377h\3042\377\377\334t\2702\375\377"
+ "\310*\30\20\312\332\250\214\2402\262\260\214\230\2242\307\300\213\377\377"
+ "\377\245\2041\377\377\377:\35\20\377\377\377\277l1\316\264w\310d2\377\310"
+ "|\356qL\227/\14\260|2TZ3\307\260|\244\2102\274\302\274\307\300\213\307\300"
+ "\213\273\301U\377\377\377\377\377\377A^2\310\316\231\214\2402o\216B\377\377"
+ "\377\377\377\377\366\377\324\312\332\250\312\332\250*a\20\200\2542\377\377"
+ "\377\230\301\230\377\377\377\377\377\377\377\377\353\317\344\266\317\344"
+ "\266T\253Tt\2702t\2702]\265I\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377T\306T\377\377\377\325\355\305l\324i\325\355\305\377\377"
+ "\377\377\377\377\377\377\377h\3042\"\254\20h\3042h\3042b\353b\377\377\377"
+ "\377\377\377D\3502\362\375\360\377\377\377O\3321\377\377\377\\\3202\364\377"
+ "\336h\3042\325\355\305t\2702\317\344\266\377\377\377\200\2521\377\377\377"
+ "\214\2402\377\377\262\230\2242\307\300\213\244\2102\307\260|\377\377\377"
+ "\262x1\377\377\377\274p2\377\337\207\310d2\377\310|\324X2\333bB\260|2\377"
+ "\377\377\307\260|\244\2102\244\2102\377\377\377\307\300\213\232\2211\230"
+ "\2242\377\377\377\377\377\377\310\316\231\310\316\231\214\2402\214\2402\377"
+ "\377\377\377\377\377\377\377\377\312\332\250\312\332\250\200\2542\200\254"
+ "2\200\2542\377\377\377\377\377\377\377\377\377\377\377\377\317\344\266\317"
+ "\344\266\317\344\266\377\377\377t\2702t\2702t\2702\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\325\355\305"
+ "\325\355\305\325\355\305\325\355\305\377\377\377\377\377\377\377\377\377"
+ "h\3042h\3042\377\377\377\377\377\377D\3471\377\377\377P\3342\364\377\352"
+ "\\\3202\335\364\323\377\377\377h\3021\377\377\377t\2702\375\377\310\200\254"
+ "2\312\332\250\377\377\377\215\2351\377\377\377\230\2242\377\377\250\244\210"
+ "2\307\260|\377\377\377\262x1\377\377\377\274p2\377\337\207\310d2\323xQ\324"
+ "X2\327T1\227/\14\260|2\377\377\234\307\260|\244\2102\377\377\377\377\377"
+ "\377\307\300\213\230\2242\230\2242\377\377\377\377\377\377\310\316\231\310"
+ "\316\231\214\2402\214\2402\377\377\377\377\377\377\377\377\377\312\332\250"
+ "\312\332\250\377\377\377\200\2542\200\2542\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\317\344\266\317\344\266\377\377\377\377\377"
+ "\377t\2702t\2702t\2702\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\325\355\305\325\355\305\325"
+ "\355\305\377\377\377\377\377\377`\0`\377\377\377D\3471\371\366\371P\3342"
+ "\346\371\342\377\377\377\\\3161\377\377\377'\24\22\325\355\305t\2702\276"
+ "\310\251\377\377\377\200\2542\377\377\316\214\2402\310\316\231`6`\230\224"
+ "2\377\377\250\222u<\307\260|\377\377\377\315\214L\377\377\377\274p2M,#\310"
+ "d2\312`1\306\304\306\324X2\333bB\325\242W\377\377\377\307\260|=9\22\244\210"
+ "2\377\377\377\227\234w\307\300\213\230\2242\307\322a\377\377\377\377\377"
+ "\377Km9\310\316\231\214\2402r\226K\377\377\377\377\377\377\377\377\377\312"
+ "\332\250\312\332\250`\242`\200\2542\200\2542\224\306\224\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\317\344\266M\250D\317\344\266\377\377\377"
+ "\203\322\203t\2702t\2702\301\377\177\377\377\377\377\377\377`\330`\377\377"
+ "\377\377\377\377r\344r\377\377\377\377\377\377\377\377\377\325\355\305\377"
+ "\377\377\377\377\377D\3502\371\377\364P\3342\346\371\342\377\377\377\\\320"
+ "2\364\377\336h\3042\325\355\305\377\377\377t\2702\317\344\266\200\2542\312"
+ "\332\250\377\377\377\214\2402\310\316\231\230\2242\307\300\213\377\377\377"
+ "\244\2102\307\260|\377\377\377\200U0\220^\377\7\4/\227U[\246]\377\255Q1\377"
+ "\242y\10\3/\306M@\6\4/{^\377mVvmVv\6\5/h\\\377h\\\377\\U\204\12\12\360\5"
+ "\5/VX\377VX\377\12\12\360LR\221\12\12\360\5\6/\214\2402\377\377\377\377\377"
+ "\377\377\377\377\312\332\250\312\332\250\377\377\377\200\2542\200\2542\200"
+ "\2542\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\317\344"
+ "\266\317\344\266\317\344\266\377\377\377\377\377\377t\2702t\2702\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377D\3502\362\375\360P\3342\346\371"
+ "\342\377\377\377\\\3202\335\364\323\377\377\377h\3042\367\377\324t\2702\317"
+ "\344\266\377\377\377\200\2542\312\332\250\377\377\377\214\2402\377\377\262"
+ "\230\2242\307\300\213\377\377\377\244\2102\307\260|{^\377\200U0\220^\377"
+ "\7\4/\227U[\246]\377\7\3/\377\242y\236\37""2\306M0\210%\14T-2{^\377mVv\6"
+ "\5/\6\5/h\\\377\\U\204\\U\204\5\5/\5\5/VX\377VX\377LR\221LR\221\377\377\377"
+ "\214\2402\214\2402\377\377\377\377\377\377\377\377\377\312\332\250\312\332"
+ "\250\312\332\250\377\377\377\200\2542\200\2542\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\317\344\266\317\344\266\377"
+ "\377\377\377\377\377t\2702t\2702t\2702\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377D\3502\365\375\363\377\377"
+ "\377O\3321l\22l\\\3202\335\364\323\357\346\357h\3042\325\355\305\377\377"
+ "\377t\2702\317\344\266l-l\200\2521\377\377\377\204\211=\310\316\231\377\377"
+ "\377\262\243L\307\300\213\377\377\377E&\25mVv{^\377ySB\220^\377\7\4/\275"
+ "t\201\246]\377\7\3/I\37!\277Z\377\10\3/\237YQ\6\4/{^\377\236\213\247mVv\6"
+ "\5/,-lh\\\377\\U\204dow\5\5/\5\5/\222\251\377VX\377\310\316\231T{@\377\377"
+ "\377\214\2402w\240V\377\377\377\377\377\377\377\377\377\377\377\377\312\332"
+ "\250U\231G\377\377\377\200\2542q\270\\\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377l\317l\317\344\266\317\344\266z\330v\377\377\377"
+ "\377\377\377\323\377\221t\2702t\2702l\352l\377\377\377\377\377\377\377\377"
+ "\377D\3502\362\375\360\377\377\377P\3342\346\371\342\377\377\377\\\3202\364"
+ "\377\336h\3042\325\355\305\377\377\377t\2702\317\344\266\377\377\377\200"
+ "\2542\312\332\250\377\377\377\214\2402\310\316\231\377\377\377\230\2242\307"
+ "\300\213\377\377\377\6\5/mVv{^\377\200U0\220^\377\7\4/\227U[\246]\377\7\3"
+ "/\255RN\277Z\377\10\3/\306M@\6\4/{^\377{^\377mVv\6\5/\6\5/h\\\377h\\\377"
+ "\\U\204\12\12\360\5\5/\12\12\360\377\377\377\377\377\377\310\316\231\310"
+ "\316\231\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\312\332\250\312\332\250\377\377\377\200\2542\200\2542\200\254"
+ "2\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\317\344\266\317\344\266\317\344\266\377\377\377\377\377\377t\2702t\2702"
+ "\377\377\377\377\377\377D\3502\362\375\360\377\377\377P\3342\346\371\342"
+ "\377\377\377\\\3202\335\364\323\377\377\377h\3042\325\355\305\377\377\377"
+ "t\2702\317\344\266\377\377\377\200\2542\312\332\250\377\377\377\214\2402"
+ "\310\316\231\377\377\377\230\2242\307\300\213h\\\377\6\5/mVv{^\377\200U0"
+ "\220^\377\7\4/\227U[\246]\377\7\3/\255RN\277Z\377\10\3/\306M@\6\4/\6\4/{"
+ "^\377mVvmVv\6\5/\12\12\360h\\\377\\U\204\\U\204\5\5/\230\2242\377\377\377"
+ "\377\377\377\377\377\377\310\316\231\310\316\231\377\377\377\214\2402\214"
+ "\2402\377\377\377\377\377\377\377\377\377\377\377\377\312\332\250\312\332"
+ "\250\377\377\377\377\377\377\200\2542\200\2542\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\317\344\266\317"
+ "\344\266\377\377\377\377\377\377\377\377\377\377\377\377D\3502q\10p\377\377"
+ "\377P\3342\335\350\332\377\377\377\\\3202\351\366\337\377\377\377h\3042d"
+ "!\\\377\377\377t\2702\277\302\252\377\377\377\200\2542\343\345\301\377\377"
+ "\377\214\2402^2H\377\377\377\230\2242\257\235\204h\\\377\6\5/\223o\234{^"
+ "\377\6\4/<\36""1\377\252\215j)2\211XK\377\250\203\202$2\337~c\377\242y\236"
+ "\37""2]#\26\306M@\6\4/ym\274{^\377mVvELn\6\5/h\\\37703x\\U\204\307\300\213"
+ "\204\226\\\230\2242\377\377\377\377\377\377\377\377\377\310\316\231^\212"
+ "H\377\377\377\214\2402}\256b\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\312\332\250_\251O\377\377\377\377\377\377y\310j\200\2542\377\377\377"
+ "\377\377\377\377\377\377\377\377\377x\341x\377\377\377\377\377\377\177\350"
+ "|\317\344\266\377\377\377\377\377\377D\3502\362\375\360\377\377\377P\334"
+ "2\346\371\342\377\377\377\\\3202\335\364\323\377\377\377\377\377\377h\304"
+ "2\325\355\305\377\377\377t\2702\317\344\266\377\377\377\200\2542\312\332"
+ "\250\377\377\377\214\2402\310\316\231\377\377\377\230\2242\\U\204h\\\377"
+ "\6\5/mVv{^\377\6\4/\12\12\360\201Vi\220^\377\7\4/\227U[\246]\377\7\3/\255"
+ "RN\277Z\377\10\3/\306M@\6\4/\12\12\360{^\377mVvmVv\6\5/\12\12\360h\\\377"
+ "\377\377\377\307\300\213\377\377\377\230\2242\230\2242\377\377\377\377\377"
+ "\377\377\377\377\310\316\231\310\316\231\377\377\377\214\2402\214\2402\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\312\332\250\312\332\250\312"
+ "\332\250\377\377\377\200\2542\200\2542\200\2542\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377D\350"
+ "2\362\375\360\377\377\377P\3342\377\377\377\346\371\342\377\377\377\\\320"
+ "2\335\364\323\377\377\377h\3042\325\355\305\377\377\377t\2702\317\344\266"
+ "\377\377\377\200\2542\377\377\377\312\332\250\377\377\377\214\2402\310\316"
+ "\231\377\377\377\5\5/\\U\204h\\\377\6\5/mVv{^\377\6\4/\12\12\360\201Vi\220"
+ "^\377\7\4/\227U[\246]\377\7\3/\255RN\277Z\377\10\3/\306M@\6\4/\6\4/{^\377"
+ "\12\12\360mVv\6\5/\6\5/\377\377\377\377\377\377\307\300\213\307\300\213\377"
+ "\377\377\230\2242\377\377\377\377\377\377\377\377\377\377\377\377\310\316"
+ "\231\310\316\231\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\312\332\250\312\332\250\377\377\377\377"
+ "\377\377\200\2542\200\2542\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\204\0\204\377\377\377D\3502\355\364\353\377\377\377\377\377\377Y\335;\346"
+ "\371\342\377\377\377/\26\31\335\364\323\377\377\377k\255<\325\355\305\377"
+ "\377\377\377\377\377t\2702\317\344\266\2046\204\200\2542\312\332\250\340"
+ "\317\340\214\2402\310\316\231\377\377\377VX\377\5\5//\33Dh\\\377\6\5/tVz"
+ "{^\377\6\4/=0\377\201Vi\220^\377\3\1\30\227U[\246]\377?6U\255RN\277Z\377"
+ "\337]s\306M0\306M@\3\2\30{^\377{^\377yv}mVv\244\2102\377\377\377\377\377"
+ "\377\377\377\377gyG\307\300\213\230\2242\212\242h\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\310\316\231g\230O\377\377\377\214\2402\205\274q"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377h\270V\312\332"
+ "\250\377\377\377\222\344\222\200\2542\200\2542\377\377\377\377\377\377\377"
+ "\377\377\377\377\377D\3502\362\375\360\377\377\377\377\377\377P\3342\346"
+ "\371\342\377\377\377\\\3202\335\364\323\377\377\377\377\377\377h\3042\325"
+ "\355\305\377\377\377t\2702\317\344\266\377\377\377\377\377\377\200\2542\312"
+ "\332\250\377\377\377\214\2402\310\316\231VX\377\12\12\360\5\5/\\U\204h\\"
+ "\377\6\5/mVv{^\377\6\4/\12\12\360\201Vi\220^\377\7\4/\227U[\246]\377\7\3"
+ "/\255RN\255RN\277Z\377\10\3/\306M@\6\4/\12\12\360{^\377\12\12\360\307\260"
+ "|\244\2102\244\2102\377\377\377\377\377\377\377\377\377\307\300\213\377\377"
+ "\377\230\2242\230\2242\377\377\377\377\377\377\377\377\377\377\377\377\310"
+ "\316\231\377\377\377\377\377\377\214\2402\214\2402\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\312\332\250\312\332\250\377\377\377"
+ "\377\377\377\200\2542\200\2542\377\377\377\377\377\377D\3502\377\377\377"
+ "\362\375\360\377\377\377P\3342\346\371\342\377\377\377\\\3202\377\377\377"
+ "\335\364\323\377\377\377h\3042\325\355\305\377\377\377\377\377\377t\2702"
+ "\317\344\266\377\377\377\200\2542\312\332\250\377\377\377\377\377\377\214"
+ "\2402LR\221VX\377\5\5/\\U\204\12\12\360h\\\377\6\5/mVv{^\377\6\4/\12\12\360"
+ "\201Vi\220^\377\7\4/\227U[\246]\377\7\3/\7\3/\255RN\277Z\377\10\3/\306M@"
+ "\6\4/\6\4/{^\377\377\377\377\307\260|\377\377\377\244\2102\377\377\377\377"
+ "\377\377\377\377\377\307\300\213\307\300\213\377\377\377\230\2242\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\310\316\231\310\316\231\377\377"
+ "\377\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\312\332\250\312\332\250\377\377\377\377\377\377\377"
+ "\377\377\377\377\377D\3502\377\377\377\362\375\360\377\377\377-\17\34\346"
+ "\371\342\377\377\377\363\346\363\\\3202\335\364\323\377\377\377h\3042\377"
+ "\377\377x)o\377\377\377t\2702\301\276\255\377\377\377\377\377\377\243\273"
+ "U\312\332\250\377\377\377O-\34\12\12\360LR\221gU\333\5\5/\\U\204<)\377h\\"
+ "\377\6\5/=!B{^\377\6\4/A2\306\201Vi\220^\377I9q\227U[\246]\377]-\220\7\3"
+ "/\255RN\245q\304\10\3/\306M0\377\236\221\6\4/\377\377\377\220\231\220\307"
+ "\260|\307\260|\226\227m\244\2102\377\377\377\377\377\377\377\377\377\307"
+ "\300\213p\207N\230\2242\230\2242\254\316\254\377\377\377\377\377\377\377"
+ "\377\377\310\316\231\310\316\231\220\317\220\377\377\377\214\2402\216\316"
+ "\200\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377r\310^\312"
+ "\332\250\377\377\377\377\377\377\377\377\377D\3502\362\375\360\377\377\377"
+ "P\3342\377\377\377\346\371\342\377\377\377\\\3202\335\364\323\377\377\377"
+ "\377\377\377h\3042\325\355\305\377\377\377\377\377\377t\2702\317\344\266"
+ "\377\377\377\200\2542\377\377\377\312\332\250\377\377\377\5\6/LR\221\12\12"
+ "\360VX\377\5\5/\\U\204h\\\377\12\12\360\6\5/mVv{^\377\6\4/\12\12\360\201"
+ "Vi\220^\377\7\4/\227U[\12\12\360\246]\377\7\3/\255RN\277Z\377\277Z\377\10"
+ "\3/\306M@\260|2\260|2\377\377\377\377\377\377\307\260|\377\377\377\244\210"
+ "2\377\377\377\377\377\377\377\377\377\377\377\377\307\300\213\377\377\377"
+ "\230\2242\230\2242\377\377\377\377\377\377\377\377\377\377\377\377\310\316"
+ "\231\310\316\231\377\377\377\377\377\377\214\2402\214\2402\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377D\3502\362\375\360\377\377\377P\3342\377\377\377\346\371\342\377"
+ "\377\377\\\3202\377\377\377\335\364\323\377\377\377h\3042\325\355\305\377"
+ "\377\377\377\377\377t\2702\317\344\266\377\377\377\377\377\377\200\2542\312"
+ "\332\250\377\377\377\12\12\360\5\6/LR\221VX\377\12\12\360\5\5/\\U\204h\\"
+ "\377\6\5/\12\12\360mVv{^\377\6\4/\12\12\360\201Vi\220^\377\7\4/\227U[\227"
+ "U[\246]\377\7\3/\255RN\12\12\360\277Z\377\10\3/\333bB\377\377\377\260|2\377"
+ "\377\377\377\377\377\307\260|\307\260|\244\2102\244\2102\377\377\377\377"
+ "\377\377\377\377\377\307\300\213\307\300\213\377\377\377\230\2242\230\224"
+ "2\377\377\377\377\377\377\377\377\377\377\377\377\310\316\231\310\316\231"
+ "\377\377\377\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377)\10\36\362\375\360\377\377\377\370"
+ "\356\370P\3342\346\371\342\377\377\377\377\377\377\\\3202\207\"\201\377\377"
+ "\377\377\377\377p\250D\325\355\305\377\377\377\377\377\377t\2702\317\344"
+ "\266\234?\234\200\2542\377\377\377\274\260\244FS\377\5\6/;#\377LR\221VX\377"
+ "\3\1\34\12\12\360\\U\204{^\330\6\5/\12\12\360\257\203\270{^\377\6\4/\6\4"
+ "\222\201Vi\220^\377P@d\12\12\360\227U[\370\244\377\7\3/\255RNi./\277Z\377"
+ "\324X2\264\202w\333bB\260|2\377\377\377\377\377\377\377\377\377yvK\377\377"
+ "\377\244\2102\236\247|\377\377\377\377\377\377\377\377\377\307\300\213\307"
+ "\300\213\234\306\234\230\2242\377\377\377\256\330\256\377\377\377\377\377"
+ "\377\377\377\377\310\316\231\310\316\231\234\341\234\377\377\377\214\240"
+ "2\232\343\223\377\377\377\377\377\377\377\377\377\377\377\377D\3502\362\375"
+ "\360\377\377\377\377\377\377P\3342\346\371\342\377\377\377\377\377\377\\"
+ "\3202\335\364\323\377\377\377\377\377\377h\3042\325\355\305\377\377\377\377"
+ "\377\377t\2702\317\344\266\377\377\377\377\377\377\200\2542\312\332\250\12"
+ "\12\360FS\377\5\6/LR\221\12\12\360RW\255\3\5\35\6\11\224ZT\\d[\261\3\4\35"
+ "\6\11\224lVTw]\264\4\4\35\6\11\224\200VN\214]\270\4\3\35\6\11\224\226UG\242"
+ "\\\274\4\3\35\4\3\35\254R@\377\377\311\203U\36\203U\36\323a:my\36my\36\377"
+ "\377\276\377\377\276\243\255X\243\255X\236\371\236e\204\36\236\371\236\374"
+ "\377\273\236\371\236\236\371\236\234\275`\236\371\236^\220\36^\220\36\236"
+ "\371\236\352\377\267\352\377\267\236\371\236\236\371\236\310\316\231\310"
+ "\316\231\377\377\377\377\377\377\214\2402\377\377\377\377\377\377\377\377"
+ "\377D\3502\362\375\360\377\377\377\377\377\377P\3342\346\371\342\377\377"
+ "\377\377\377\377\\\3202\377\377\377\335\364\323\377\377\377h\3042\377\377"
+ "\377\325\355\305\377\377\377t\2702\377\377\377\317\344\266\377\377\377\377"
+ "\377\377\200\2542<L\237FS\377\12\12\360\5\6/LR\221\6\11\224RW\255\3\5\35"
+ "ZT\\\6\11\224d[\261\3\4\35\6\11\224lVTw]\264\4\4\35\6\11\224\200VN\214]\270"
+ "\4\3\35\4\3\35\226UG\242\\\274\6\11\224\4\3\35\304wB\377\377\311\377\377"
+ "\311\203U\36\323a:\236\371\236my\36\236\371\236\377\377\276\236\371\236\243"
+ "\255X\236\371\236e\204\36e\204\36\374\377\273\374\377\273\236\371\236\234"
+ "\275`\234\275`\236\371\236^\220\36^\220\36\236\371\236\352\377\267\352\377"
+ "\267\377\377\377\377\377\377\310\316\231\310\316\231\377\377\377\250\0\250"
+ "\377\377\377\377\377\377F\3375\362\375\360\377\377\377\377\377\377P\3342"
+ "\377\377\377\227\32\224\377\377\377\\\3202\362\340\362\335\364\323\377\377"
+ "\377\377\377\377h\3042\325\355\305\2506\250\377\377\377t\2702\304\272\262"
+ "\377\377\377\377\377\377\257\300a\12\12\360<L\237.\32\250\5\6/\12\12\360"
+ "jSzRW\255\6\11\224D+^ZT\\\6\11\224A&t\3\4\35lVTP9\235w]\264\4\4\35YG\347"
+ "\200VN\214]\270\3\4a\4\3\35\226UG\244y\257\6\11\224{a\36\377\322\246\236"
+ "\371\236\377\377\311V6\23\323a:\323a:\223\231y\236\371\236\377\377\276\377"
+ "\377\377\243\255X\243\255Xh\270he\204\36\236\371\236\272\322\253\374\377"
+ "\273\236\371\236\377\377\350\236\371\236\236\371\236=y\23\236\371\236\236"
+ "\371\236\262\344\262\377\377\377\377\377\377\377\377\377\310\316\231\377"
+ "\377\377\377\377\377\377\377\377D\3502\362\375\360\377\377\377\377\377\377"
+ "P\3342\377\377\377\346\371\342\377\377\377\377\377\377\\\3202\335\364\323"
+ "\377\377\377\377\377\377h\3042\325\355\305\377\377\377\377\377\377t\2702"
+ "\377\377\377\317\344\266\377\377\377\377\377\377\5\6/<L\237\12\12\360FS\377"
+ "\5\6/\6\11\224JQbRW\255\6\11\224\3\5\35ZT\\d[\261\6\11\224\3\4\35lVT\6\11"
+ "\224w]\264\4\4\35\6\11\224\200VN\214]\270\6\11\224\4\3\35\226UG\242\\\274"
+ "\377\377\306{a\36\304wB\304wB\377\377\311\203U\36\203U\36\323a:my\36my\36"
+ "\377\377\276\377\377\276\236\371\236\243\255X\236\371\236e\204\36e\204\36"
+ "\236\371\236\374\377\273\236\371\236\234\275`\234\275`\236\371\236^\220\36"
+ "^\220\36\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377D\3502\362\375\360\377\377\377\377\377\377"
+ "P\3342\377\377\377\346\371\342\377\377\377\377\377\377\\\3202\335\364\323"
+ "\377\377\377\377\377\377h\3042\377\377\377\325\355\305\377\377\377\377\377"
+ "\377t\2702\317\344\266\377\377\377\377\377\377\5\6/\12\12\360<L\237FS\377"
+ "\12\12\360\3\5\35JQb\6\11\224RW\255\3\5\35\6\11\224ZT\\d[\261\6\11\224\3"
+ "\4\35lVT\6\11\224w]\264\4\4\35\6\11\224\200VN\214]\270\6\11\224\4\3\35\226"
+ "UG\236\371\236\377\377\306{a\36\236\371\236\304wB\377\377\311\236\371\236"
+ "\203U\36\323a:\236\371\236my\36\236\371\236\377\377\276\236\371\236\243\255"
+ "X\243\255X\236\371\236e\204\36\236\371\236\374\377\273\374\377\273\236\371"
+ "\236\234\275`\234\275`\236\371\236\230\2242\230\2242\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377J\3508\377\377\377\362"
+ "\375\360\264\22\264\377\377\377P\3342\340\340\335\377\377\377\377\377\377"
+ "u\325K\377\377\377\335\364\323\264-\264\377\377\377h\3042\315\305\301\377"
+ "\377\377\377\377\377\240\307^\377\377\377\317\344\266\264H\264\12\12\360"
+ "\5\6/aL\245\12\12\360FS\377E(\323\3\5\35JQb\4\3hRW\255\3\5\35O2\241ZT\\d"
+ "[\261X>\346\3\4\35lVT\4\4hw]\264\4\4\35aK\244\200VN\214]\270kZ\371\4\3\35"
+ "\270\212Io\225o\377\377\306{a\36\253\300\253\304wB\377\377\311\377\377\377"
+ "\203U\36\323a:\224D(my\36\236\371\236\307\316\266\377\377\276\236\371\236"
+ "\377\377\343\236\371\236e\204\36Gk\25\236\371\236\374\377\273\260\334\260"
+ "\236\371\236\234\275`\377\377\377\377\377\377\230\2242k\207#\377\377\377"
+ "\377\377\377\377\377\377\377\377\377D\3502\377\377\377\362\375\360\377\377"
+ "\377\377\377\377P\3342\346\371\342\377\377\377\377\377\377\\\3202\377\377"
+ "\377\335\364\323\377\377\377\377\377\377h\3042\377\377\377\325\355\305\377"
+ "\377\377\377\377\377t\2702\317\344\266\377\377\3778L\377\12\12\360\5\6/<"
+ "L\237\12\12\360BR\252\3\5\35\6\11\224JQbRW\255\6\11\224\3\5\35ZT\\\6\11\224"
+ "d[\261\6\11\224\3\4\35lVT\6\11\224w]\264\4\4\35\6\11\224\200VN\214]\270\6"
+ "\11\224tm\36\270\212I\270\212I\377\377\306{a\36{a\36\304wB\236\371\236\377"
+ "\377\311\203U\36\236\371\236\323a:my\36my\36\236\371\236\377\377\276\236"
+ "\371\236\243\255X\243\255X\236\371\236e\204\36\236\371\236\374\377\273\374"
+ "\377\273\236\371\236\307\300\213\307\300\213\377\377\377\377\377\377\230"
+ "\2242\377\377\377\377\377\377\377\377\377D\3502\377\377\377\362\375\360\377"
+ "\377\377\377\377\377P\3342\377\377\377\346\371\342\377\377\377\377\377\377"
+ "\\\3202\335\364\323\377\377\377\377\377\377\377\377\377h\3042\325\355\305"
+ "\377\377\377\377\377\377t\2702\377\377\377\317\344\2668L\377\12\12\360\5"
+ "\6/\12\12\360<L\237BR\252\6\11\224\3\5\35JQb\6\11\224RW\255\6\11\224\3\5"
+ "\35ZT\\\6\11\224d[\261\3\4\35\6\11\224lVT\6\11\224w]\264\4\4\35\6\11\224"
+ "\200VN\214]\270\236\371\236tm\36\236\371\236\270\212I\377\377\306\236\371"
+ "\236{a\36\304wB\236\371\236\377\377\311\203U\36\203U\36\323a:\236\371\236"
+ "my\36\236\371\236\377\377\276\377\377\276\236\371\236\243\255X\236\371\236"
+ "e\204\36e\204\36\236\371\236\374\377\273\377\377\377\377\377\377\307\300"
+ "\213\307\300\213\377\377\377\377\377\377\377\377\377\377\377\3773\10%\377"
+ "\377\377\362\375\360\372\356\372\377\377\377P\3342\377\377\377\346\371\342"
+ "\377\377\377\300$\300\\\3202\377\377\377\327\317\316\377\377\377\377\377"
+ "\377\220\317Z\377\377\377\325\355\305\300?\300\377\377\377t\2702\312\267"
+ "\270\12\12\3608L\377F#\377\5\6/<L\237\4\3oBR\252\6\11\224K)[JQb\6\11\224"
+ "\243\204\376\3\5\35\6\11\224C&E\6\11\224d[\261_@l\6\11\224lVTkP\371w]\264"
+ "\4\4\35\4\5o\200VN\377\377\302\262\276\262tm\36\236\371\236\377\360\302\377"
+ "\377\306\236\371\236\\A\26\304wB\304wB\322\312\302\236\371\236\203U\36\377"
+ "\355\310\323a:my\36R]\26\236\371\236\377\377\276\270\326\270\243\255X\236"
+ "\371\236\377\377\377e\204\36\236\371\236\300\341\300\377\377\377\377\377"
+ "\377\305\353\305\307\300\213\377\377\377\377\377\377\377\377\377D\3502\377"
+ "\377\377\362\375\360\377\377\377\377\377\377P\3342\377\377\377\346\371\342"
+ "\377\377\377\377\377\377\\\3202\377\377\377\335\364\323\377\377\377\377\377"
+ "\377h\3042\377\377\377\325\355\305\377\377\377\377\377\377t\2702\377\377"
+ "\3770E\254\12\12\3608L\377\5\6/\12\12\360:Lj\6\11\224BR\252\3\5\35\6\11\224"
+ "JQb\6\11\224RW\255\3\5\35\6\11\224ZT\\\6\11\224d[\261\3\4\35\6\11\224lVT"
+ "\6\11\224w]\264\4\4\35\6\11\224\255\235Q\377\377\302\377\377\302tm\36\236"
+ "\371\236\270\212I\377\377\306\377\377\306{a\36\236\371\236\304wB\377\377"
+ "\311\377\377\311\203U\36\236\371\236\323a:\236\371\236my\36\236\371\236\377"
+ "\377\276\236\371\236\243\255X\243\255X\236\371\236e\204\36\244\2102\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377D\3502\377\377\377\362\375\360\377\377\377\377\377\377P\3342\377\377"
+ "\377\346\371\342\377\377\377\377\377\377\377\377\377\\\3202\335\364\323\377"
+ "\377\377\377\377\377\377\377\377h\3042\325\355\305\377\377\377\377\377\377"
+ "\377\377\377t\2702\317\344\266\377\377\377\377\377\377\377\377\377\200\254"
+ "2\236\371\236\222\326p\332\377\264\236\371\236V\234\36\236\371\236\226\312"
+ "g\352\377\267\236\371\236^\220\36\236\371\236\234\275`\374\377\273\236\371"
+ "\236e\204\36\236\371\236\243\255X\377\377\276\236\371\236my\36\236\371\236"
+ "\255\235Q\236\371\236\377\377\302tm\36\236\371\236\270\212I\236\371\236\377"
+ "\377\306{a\36\236\371\236\304wB\236\371\236\377\377\311\203U\36\203U\36\323"
+ "a:\236\371\236my\36\236\371\236\377\377\276\377\377\276\236\371\236\243\255"
+ "X\236\371\236\377\377\377\244\2102\377\377\377\377\377\377\377\377\377\314"
+ "\0\314\377\377\377\377\377\377H\3377\377\377\377\362\375\360\377\377\377"
+ "\377\377\377\377\377\377@\27(\346\371\342\377\377\377\367\340\367\377\377"
+ "\377\\\3202\377\377\377\335\364\323\377\377\377\3146\314h\3042\377\377\377"
+ "\322\301\306\377\377\377\377\377\377\255\314k\377\377\377\317\344\266\314"
+ "Q\314\377\377\377\200\2542\256\300\256\222\326p\236\371\236\377\377\377\236"
+ "\371\236V\234\36xUR\236\371\236\352\377\267\262\273\262^\220\36\234\275`"
+ "\377\377\377\374\377\273\236\371\236PE\30\236\371\236\243\255X\342\300\305"
+ "\236\371\236my\36\377\377\377\255\235Q\236\371\236\314\242\233tm\36\236\371"
+ "\236\304\237\240\236\371\236\377\377\306\377\340\256{a\36\304wB~\270~\377"
+ "\377\311\236\371\236\273\254\244\323a:\323a:\377\377\303my\36\236\371\236"
+ "\314\330\230\236\371\236\243\255X\313\332\302\377\377\377\244\2102\377\377"
+ "\355\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377D\3502\362"
+ "\375\360\377\377\377\377\377\377\377\377\377P\3342\377\377\377\346\371\342"
+ "\377\377\377\377\377\377\\\3202\377\377\377\335\364\323\377\377\377\377\377"
+ "\377h\3042\377\377\377\325\355\305\377\377\377\377\377\377\377\377\377t\270"
+ "2\317\344\266\377\377\377\377\377\377\377\377\377O\247\36\236\371\236\222"
+ "\326p\332\377\264\236\371\236V\234\36\236\371\236\226\312g\236\371\236\352"
+ "\377\267\236\371\236^\220\36\234\275`\236\371\236\374\377\273\236\371\236"
+ "e\204\36\236\371\236\243\255X\377\377\276\236\371\236my\36\236\371\236\255"
+ "\235Q\236\371\236\377\377\302tm\36\236\371\236\270\212I\236\371\236\377\377"
+ "\306\236\371\236{a\36\304wB\304wB\377\377\311\236\371\236\203U\36\236\371"
+ "\236\323a:\236\371\236my\36\236\371\236\377\377\276\377\377\276\377\377\377"
+ "\307\260|\377\377\377\377\377\377\244\2102\377\377\377\377\377\377\377\377"
+ "\377\377\377\377D\3502\362\375\360\377\377\377\377\377\377\377\377\377P\334"
+ "2\377\377\377\346\371\342\377\377\377\377\377\377\\\3202\377\377\377\335"
+ "\364\323\377\377\377\377\377\377\377\377\377h\3042\377\377\377\325\355\305"
+ "\377\377\377\377\377\377t\2702\377\377\377\317\344\266\377\377\377\377\377"
+ "\377\236\371\236O\247\36\222\326p\236\371\236\332\377\264\236\371\236V\234"
+ "\36\236\371\236\226\312g\236\371\236\352\377\267^\220\36\236\371\236\234"
+ "\275`\236\371\236\374\377\273\236\371\236e\204\36\236\371\236\243\255X\377"
+ "\377\276\236\371\236my\36\236\371\236\255\235Q\236\371\236\377\377\302tm"
+ "\36tm\36\270\212I\236\371\236\377\377\306\236\371\236{a\36\236\371\236\304"
+ "wB\377\377\311\377\377\311\203U\36\236\371\236\323a:\236\371\236my\36\236"
+ "\371\236\236\371\236\377\377\377\377\377\377\307\260|\307\260|\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377D\3502\362\375\360\330\22"
+ "\330\377\377\377\377\377\377]\306B\377\377\377\346\371\342\377\377\377\377"
+ "\377\377\377\377\377M$*\335\364\323\377\377\377\366\324\366\377\377\377h"
+ "\3042\377\377\377\325\355\305\377\377\377\330H\330\377\377\377t\2702\321"
+ "\264\300\377\377\377\377\377\377\352\377\352O\247\36\236\371\236{S^\236\371"
+ "\236\332\377\264\266\274\266V\234\36\226\312g\377\377\377\352\377\267\236"
+ "\371\236OG\31\236\371\236\234\275`\274\274\274\374\377\273\236\371\236\336"
+ "\325\227\243\255X\236\371\236\330\231\240\236\371\236my\36\302\300\302\255"
+ "\235Q\236\371\236\377\377\377\236\371\236tm\36\233a=\236\371\236\377\377"
+ "\306\310\314\310{a\36\236\371\236\377\377\351\236\371\236\377\377\311nE\31"
+ "\203U\36\323a:\326\304\276my\36my\36\377\377\377\377\377\377\377\377\377"
+ "\330\352\330\307\260|\377\377\377\377\377\377\377\377\377\377\377\377D\350"
+ "2\377\377\377\362\375\360\377\377\377\377\377\377P\3342\377\377\377\346\371"
+ "\342\377\377\377\377\377\377\377\377\377\\\3202\377\377\377\335\364\323\377"
+ "\377\377\377\377\377\377\377\377h\3042\325\355\305\377\377\377\377\377\377"
+ "\377\377\377t\2702\377\377\377\317\344\266\377\377\377\377\377\377\377\377"
+ "\377\200\2542\377\377\377\312\332\250\377\377\377\377\377\377\214\2402\377"
+ "\377\377\310\316\231\377\377\377\377\377\377\377\377\377\230\2242\377\377"
+ "\377\307\300\213\377\377\377\377\377\377\244\2102\377\377\377\307\260|\377"
+ "\377\377\377\377\377\377\377\377\260|2\377\377\377\312\237n\377\377\377\377"
+ "\377\377\377\377\377\274p2\316\214_\316\214_\377\377\377\377\377\377\310"
+ "d2\377\377\377\323xQ\377\377\377\377\377\377\377\377\377\324X2\377\377\377"
+ "\333bB\377\377\377\260|2\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\377\377\377\377\377\377\377\377\377D\3502\377\377\377\362\375"
+ "\360\377\377\377\377\377\377P\3342\377\377\377\346\371\342\377\377\377\377"
+ "\377\377\377\377\377\\\3202\377\377\377\335\364\323\377\377\377\377\377\377"
+ "\377\377\377h\3042\377\377\377\325\355\305\377\377\377\377\377\377\377\377"
+ "\377t\2702\317\344\266\377\377\377\377\377\377\377\377\377\200\2542\377\377"
+ "\377\312\332\250\377\377\377\377\377\377\377\377\377\214\2402\377\377\377"
+ "\310\316\231\377\377\377\377\377\377\377\377\377\230\2242\377\377\377\307"
+ "\300\213\377\377\377\377\377\377\244\2102\377\377\377\307\260|\377\377\377"
+ "\377\377\377\377\377\377\260|2\377\377\377\312\237n\377\377\377\377\377\377"
+ "\377\377\377\274p2\377\377\377\316\214_\377\377\377\377\377\377\310d2\310"
+ "d2\323xQ\377\377\377\377\377\377\377\377\377\324X2\377\377\377\333bB\377"
+ "\377\377\260|2\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
+ "\377\377\377\344\11\344D\3502\377\377\377\360\354\357\377\377\377\377\377"
+ "\377\377\377\377P\3342\377\377\377\315#\312\377\377\377\377\377\377s\262"
+ "Q\377\377\377\335\364\323\377\377\377\377\377\377\377\377\377\\0,\377\377"
+ "\377\325\355\305\367\313\367\377\377\377\377\377\377\274\321z\377\377\377"
+ "\317\344\266\344Z\344\377\377\377\377\377\377\246\217v\377\377\377\312\332"
+ "\250\377\377\377\377\377\377\377\377\377}I,\377\377\377\310\316\231\361\277"
+ "\361\377\377\377\230\2242\377\377\377\307\300\213\377\377\377\344\220\344"
+ "\377\377\377\244\2102\356\301\356\307\260|\377\377\377\377\377\377\377\377"
+ "\377\260|2\344\253\344\312\237n\377\377\377\353\312\353\377\377\377\274p"
+ "2\377\377\377\316\214_\377\377\377\344\306\344\377\377\377\310d2\340\276"
+ "\310\323xQ\377\377\377\377\377\377\324X2\324X2\303V;\333bB\260|2\337\340"
+ "\325\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377D\3502\377"
+ "\377\377\362\375\360\377\377\377\377\377\377\377\377\377P\3342\377\377\377"
+ "\346\371\342\377\377\377\377\377\377\377\377\377\\\3202\377\377\377\335\364"
+ "\323\377\377\377\377\377\377\377\377\377h\3042\377\377\377\325\355\305\377"
+ "\377\377\377\377\377\377\377\377t\2702\317\344\266\377\377\377\377\377\377"
+ "\377\377\377\200\2542\377\377\377\312\332\250\377\377\377\377\377\377\377"
+ "\377\377\214\2402\377\377\377\310\316\231\377\377\377\377\377\377\377\377"
+ "\377\230\2242\377\377\377\307\300\213\377\377\377\377\377\377\377\377\377"
+ "\244\2102\377\377\377\307\260|\377\377\377\377\377\377\377\377\377\260|2"
+ "\377\377\377\312\237n\377\377\377\377\377\377\377\377\377\274p2\377\377\377"
+ "\316\214_\377\377\377\377\377\377\377\377\377\310d2\377\377\377\323xQ\377"
+ "\377\377\377\377\377\377\377\377\324X2\377\377\377\333bB\377\377\377\260"
+ "|2\377\377\377\377\377\377\377\377\377\377\377\377D\3502\377\377\377\362"
+ "\375\360\377\377\377\377\377\377\377\377\377P\3342\377\377\377\346\371\342"
+ "\377\377\377\377\377\377\377\377\377\\\3202\377\377\377\335\364\323\377\377"
+ "\377\377\377\377\377\377\377h\3042\377\377\377\325\355\305\377\377\377\377"
+ "\377\377\377\377\377t\2702\377\377\377\317\344\266\377\377\377\377\377\377"
+ "\377\377\377\200\2542\377\377\377\312\332\250\377\377\377\377\377\377\377"
+ "\377\377\214\2402\377\377\377\310\316\231\377\377\377\377\377\377\377\377"
+ "\377\230\2242\377\377\377\307\300\213\377\377\377\377\377\377\377\377\377"
+ "\244\2102\377\377\377\307\260|\377\377\377\377\377\377\377\377\377\260|2"
+ "\377\377\377\312\237n\377\377\377\377\377\377\377\377\377\274p2\377\377\377"
+ "\316\214_\377\377\377\377\377\377\377\377\377\310d2\377\377\377\323xQ\377"
+ "\377\377\377\377\377\377\377\377\324X2\377\377\377\333bB\377\377\377",
+};
+
+/**
+ * \brief Returns the PrimitivesBlend test image as SDL_Surface.
+ */
+SDL_Surface *SDLTest_ImagePrimitivesBlend()
+{
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ (void*)SDLTest_imagePrimitivesBlend.pixel_data,
+ SDLTest_imagePrimitivesBlend.width,
+ SDLTest_imagePrimitivesBlend.height,
+ SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8,
+ SDLTest_imagePrimitivesBlend.width * SDLTest_imagePrimitivesBlend.bytes_per_pixel,
+#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ 0xff000000, /* Red bit mask. */
+ 0x00ff0000, /* Green bit mask. */
+ 0x0000ff00, /* Blue bit mask. */
+ 0x000000ff /* Alpha bit mask. */
+#else
+ 0x000000ff, /* Red bit mask. */
+ 0x0000ff00, /* Green bit mask. */
+ 0x00ff0000, /* Blue bit mask. */
+ 0xff000000 /* Alpha bit mask. */
+#endif
+ );
+ return surface;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_log.c b/src/3rdparty/SDL2/src/test/SDL_test_log.c
new file mode 100644
index 0000000..5d6ff24
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_log.c
@@ -0,0 +1,118 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+
+ Used by the test framework and test cases.
+
+*/
+
+/* quiet windows compiler warnings */
+#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
+# define _CRT_SECURE_NO_WARNINGS
+#endif
+
+#include "SDL_config.h"
+
+#include <stdarg.h> /* va_list */
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#include "SDL.h"
+
+#include "SDL_test.h"
+
+/* work around compiler warning on older GCCs. */
+#if (defined(__GNUC__) && (__GNUC__ <= 2))
+static size_t
+strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
+{
+ return strftime(s, max, fmt, tm);
+}
+#ifdef strftime
+#undef strftime
+#endif
+#define strftime strftime_gcc2_workaround
+#endif
+
+/* !
+ * Converts unix timestamp to its ascii representation in localtime
+ *
+ * Note: Uses a static buffer internally, so the return value
+ * isn't valid after the next call of this function. If you
+ * want to retain the return value, make a copy of it.
+ *
+ * \param timestamp A Timestamp, i.e. time(0)
+ *
+ * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
+ */
+static char *SDLTest_TimestampToString(const time_t timestamp)
+{
+ time_t copy;
+ static char buffer[64];
+ struct tm *local;
+
+ SDL_memset(buffer, 0, sizeof(buffer));
+ copy = timestamp;
+ local = localtime(&copy);
+ strftime(buffer, sizeof(buffer), "%x %X", local);
+
+ return buffer;
+}
+
+/*
+ * Prints given message with a timestamp in the TEST category and INFO priority.
+ */
+void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print log message into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, fmt);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
+ va_end(list);
+
+ /* Log with timestamp and newline */
+ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
+}
+
+/*
+ * Prints given message with a timestamp in the TEST category and the ERROR priority.
+ */
+void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
+{
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print log message into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, fmt);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
+ va_end(list);
+
+ /* Log with timestamp and newline */
+ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_md5.c b/src/3rdparty/SDL2/src/test/SDL_test_md5.c
new file mode 100644
index 0000000..c0d05a4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_md5.c
@@ -0,0 +1,338 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ ***********************************************************************
+ ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
+ ** Created: 2/17/90 RLR **
+ ** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
+ ** **
+ ** License to copy and use this software is granted provided that **
+ ** it is identified as the "RSA Data Security, Inc. MD5 Message- **
+ ** Digest Algorithm" in all material mentioning or referencing this **
+ ** software or this function. **
+ ** **
+ ** License is also granted to make and use derivative works **
+ ** provided that such works are identified as "derived from the RSA **
+ ** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
+ ** material mentioning or referencing the derived work. **
+ ** **
+ ** RSA Data Security, Inc. makes no representations concerning **
+ ** either the merchantability of this software or the suitability **
+ ** of this software for any particular purpose. It is provided "as **
+ ** is" without express or implied warranty of any kind. **
+ ** **
+ ** These notices must be retained in any copies of any part of this **
+ ** documentation and/or software. **
+ ***********************************************************************
+ */
+
+#include "SDL_config.h"
+
+#include "SDL_test.h"
+
+/* Forward declaration of static helper function */
+static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in);
+
+static unsigned char MD5PADDING[64] = {
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/* F, G, H and I are basic MD5 functions */
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define I(x, y, z) ((y) ^ ((x) | (~z)))
+
+/* ROTATE_LEFT rotates x left n bits */
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+
+/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
+
+/* Rotation is separate from addition to prevent recomputation */
+#define FF(a, b, c, d, x, s, ac) \
+ {(a) += F ((b), (c), (d)) + (x) + (MD5UINT4)(ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+#define GG(a, b, c, d, x, s, ac) \
+ {(a) += G ((b), (c), (d)) + (x) + (MD5UINT4)(ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+#define HH(a, b, c, d, x, s, ac) \
+ {(a) += H ((b), (c), (d)) + (x) + (MD5UINT4)(ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+#define II(a, b, c, d, x, s, ac) \
+ {(a) += I ((b), (c), (d)) + (x) + (MD5UINT4)(ac); \
+ (a) = ROTATE_LEFT ((a), (s)); \
+ (a) += (b); \
+ }
+
+/*
+ The routine MD5Init initializes the message-digest context
+ mdContext. All fields are set to zero.
+*/
+
+void SDLTest_Md5Init(SDLTest_Md5Context * mdContext)
+{
+ if (mdContext==NULL) return;
+
+ mdContext->i[0] = mdContext->i[1] = (MD5UINT4) 0;
+
+ /*
+ * Load magic initialization constants.
+ */
+ mdContext->buf[0] = (MD5UINT4) 0x67452301;
+ mdContext->buf[1] = (MD5UINT4) 0xefcdab89;
+ mdContext->buf[2] = (MD5UINT4) 0x98badcfe;
+ mdContext->buf[3] = (MD5UINT4) 0x10325476;
+}
+
+/*
+ The routine MD5Update updates the message-digest context to
+ account for the presence of each of the characters inBuf[0..inLen-1]
+ in the message whose digest is being computed.
+*/
+
+void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
+ unsigned int inLen)
+{
+ MD5UINT4 in[16];
+ int mdi;
+ unsigned int i, ii;
+
+ if (mdContext == NULL) return;
+ if (inBuf == NULL || inLen < 1) return;
+
+ /*
+ * compute number of bytes mod 64
+ */
+ mdi = (int) ((mdContext->i[0] >> 3) & 0x3F);
+
+ /*
+ * update number of bits
+ */
+ if ((mdContext->i[0] + ((MD5UINT4) inLen << 3)) < mdContext->i[0])
+ mdContext->i[1]++;
+ mdContext->i[0] += ((MD5UINT4) inLen << 3);
+ mdContext->i[1] += ((MD5UINT4) inLen >> 29);
+
+ while (inLen--) {
+ /*
+ * add new character to buffer, increment mdi
+ */
+ mdContext->in[mdi++] = *inBuf++;
+
+ /*
+ * transform if necessary
+ */
+ if (mdi == 0x40) {
+ for (i = 0, ii = 0; i < 16; i++, ii += 4)
+ in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
+ (((MD5UINT4) mdContext->in[ii + 2]) << 16) |
+ (((MD5UINT4) mdContext->in[ii + 1]) << 8) |
+ ((MD5UINT4) mdContext->in[ii]);
+ SDLTest_Md5Transform(mdContext->buf, in);
+ mdi = 0;
+ }
+ }
+}
+
+/*
+ The routine MD5Final terminates the message-digest computation and
+ ends with the desired message digest in mdContext->digest[0...15].
+*/
+
+void SDLTest_Md5Final(SDLTest_Md5Context * mdContext)
+{
+ MD5UINT4 in[16];
+ int mdi;
+ unsigned int i, ii;
+ unsigned int padLen;
+
+ if (mdContext == NULL) return;
+
+ /*
+ * save number of bits
+ */
+ in[14] = mdContext->i[0];
+ in[15] = mdContext->i[1];
+
+ /*
+ * compute number of bytes mod 64
+ */
+ mdi = (int) ((mdContext->i[0] >> 3) & 0x3F);
+
+ /*
+ * pad out to 56 mod 64
+ */
+ padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
+ SDLTest_Md5Update(mdContext, MD5PADDING, padLen);
+
+ /*
+ * append length in bits and transform
+ */
+ for (i = 0, ii = 0; i < 14; i++, ii += 4)
+ in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
+ (((MD5UINT4) mdContext->in[ii + 2]) << 16) |
+ (((MD5UINT4) mdContext->in[ii + 1]) << 8) |
+ ((MD5UINT4) mdContext->in[ii]);
+ SDLTest_Md5Transform(mdContext->buf, in);
+
+ /*
+ * store buffer in digest
+ */
+ for (i = 0, ii = 0; i < 4; i++, ii += 4) {
+ mdContext->digest[ii] = (unsigned char) (mdContext->buf[i] & 0xFF);
+ mdContext->digest[ii + 1] =
+ (unsigned char) ((mdContext->buf[i] >> 8) & 0xFF);
+ mdContext->digest[ii + 2] =
+ (unsigned char) ((mdContext->buf[i] >> 16) & 0xFF);
+ mdContext->digest[ii + 3] =
+ (unsigned char) ((mdContext->buf[i] >> 24) & 0xFF);
+ }
+}
+
+/* Basic MD5 step. Transforms buf based on in.
+ */
+static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in)
+{
+ MD5UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
+
+ /*
+ * Round 1
+ */
+#define S11 7
+#define S12 12
+#define S13 17
+#define S14 22
+ FF(a, b, c, d, in[0], S11, 3614090360u); /* 1 */
+ FF(d, a, b, c, in[1], S12, 3905402710u); /* 2 */
+ FF(c, d, a, b, in[2], S13, 606105819u); /* 3 */
+ FF(b, c, d, a, in[3], S14, 3250441966u); /* 4 */
+ FF(a, b, c, d, in[4], S11, 4118548399u); /* 5 */
+ FF(d, a, b, c, in[5], S12, 1200080426u); /* 6 */
+ FF(c, d, a, b, in[6], S13, 2821735955u); /* 7 */
+ FF(b, c, d, a, in[7], S14, 4249261313u); /* 8 */
+ FF(a, b, c, d, in[8], S11, 1770035416u); /* 9 */
+ FF(d, a, b, c, in[9], S12, 2336552879u); /* 10 */
+ FF(c, d, a, b, in[10], S13, 4294925233u); /* 11 */
+ FF(b, c, d, a, in[11], S14, 2304563134u); /* 12 */
+ FF(a, b, c, d, in[12], S11, 1804603682u); /* 13 */
+ FF(d, a, b, c, in[13], S12, 4254626195u); /* 14 */
+ FF(c, d, a, b, in[14], S13, 2792965006u); /* 15 */
+ FF(b, c, d, a, in[15], S14, 1236535329u); /* 16 */
+
+ /*
+ * Round 2
+ */
+#define S21 5
+#define S22 9
+#define S23 14
+#define S24 20
+ GG(a, b, c, d, in[1], S21, 4129170786u); /* 17 */
+ GG(d, a, b, c, in[6], S22, 3225465664u); /* 18 */
+ GG(c, d, a, b, in[11], S23, 643717713u); /* 19 */
+ GG(b, c, d, a, in[0], S24, 3921069994u); /* 20 */
+ GG(a, b, c, d, in[5], S21, 3593408605u); /* 21 */
+ GG(d, a, b, c, in[10], S22, 38016083u); /* 22 */
+ GG(c, d, a, b, in[15], S23, 3634488961u); /* 23 */
+ GG(b, c, d, a, in[4], S24, 3889429448u); /* 24 */
+ GG(a, b, c, d, in[9], S21, 568446438u); /* 25 */
+ GG(d, a, b, c, in[14], S22, 3275163606u); /* 26 */
+ GG(c, d, a, b, in[3], S23, 4107603335u); /* 27 */
+ GG(b, c, d, a, in[8], S24, 1163531501u); /* 28 */
+ GG(a, b, c, d, in[13], S21, 2850285829u); /* 29 */
+ GG(d, a, b, c, in[2], S22, 4243563512u); /* 30 */
+ GG(c, d, a, b, in[7], S23, 1735328473u); /* 31 */
+ GG(b, c, d, a, in[12], S24, 2368359562u); /* 32 */
+
+ /*
+ * Round 3
+ */
+#define S31 4
+#define S32 11
+#define S33 16
+#define S34 23
+ HH(a, b, c, d, in[5], S31, 4294588738u); /* 33 */
+ HH(d, a, b, c, in[8], S32, 2272392833u); /* 34 */
+ HH(c, d, a, b, in[11], S33, 1839030562u); /* 35 */
+ HH(b, c, d, a, in[14], S34, 4259657740u); /* 36 */
+ HH(a, b, c, d, in[1], S31, 2763975236u); /* 37 */
+ HH(d, a, b, c, in[4], S32, 1272893353u); /* 38 */
+ HH(c, d, a, b, in[7], S33, 4139469664u); /* 39 */
+ HH(b, c, d, a, in[10], S34, 3200236656u); /* 40 */
+ HH(a, b, c, d, in[13], S31, 681279174u); /* 41 */
+ HH(d, a, b, c, in[0], S32, 3936430074u); /* 42 */
+ HH(c, d, a, b, in[3], S33, 3572445317u); /* 43 */
+ HH(b, c, d, a, in[6], S34, 76029189u); /* 44 */
+ HH(a, b, c, d, in[9], S31, 3654602809u); /* 45 */
+ HH(d, a, b, c, in[12], S32, 3873151461u); /* 46 */
+ HH(c, d, a, b, in[15], S33, 530742520u); /* 47 */
+ HH(b, c, d, a, in[2], S34, 3299628645u); /* 48 */
+
+ /*
+ * Round 4
+ */
+#define S41 6
+#define S42 10
+#define S43 15
+#define S44 21
+ II(a, b, c, d, in[0], S41, 4096336452u); /* 49 */
+ II(d, a, b, c, in[7], S42, 1126891415u); /* 50 */
+ II(c, d, a, b, in[14], S43, 2878612391u); /* 51 */
+ II(b, c, d, a, in[5], S44, 4237533241u); /* 52 */
+ II(a, b, c, d, in[12], S41, 1700485571u); /* 53 */
+ II(d, a, b, c, in[3], S42, 2399980690u); /* 54 */
+ II(c, d, a, b, in[10], S43, 4293915773u); /* 55 */
+ II(b, c, d, a, in[1], S44, 2240044497u); /* 56 */
+ II(a, b, c, d, in[8], S41, 1873313359u); /* 57 */
+ II(d, a, b, c, in[15], S42, 4264355552u); /* 58 */
+ II(c, d, a, b, in[6], S43, 2734768916u); /* 59 */
+ II(b, c, d, a, in[13], S44, 1309151649u); /* 60 */
+ II(a, b, c, d, in[4], S41, 4149444226u); /* 61 */
+ II(d, a, b, c, in[11], S42, 3174756917u); /* 62 */
+ II(c, d, a, b, in[2], S43, 718787259u); /* 63 */
+ II(b, c, d, a, in[9], S44, 3951481745u); /* 64 */
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_memory.c b/src/3rdparty/SDL2/src/test/SDL_test_memory.c
new file mode 100644
index 0000000..6ce72f6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_memory.c
@@ -0,0 +1,274 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+#include "SDL_assert.h"
+#include "SDL_stdinc.h"
+#include "SDL_log.h"
+#include "SDL_test_crc32.h"
+#include "SDL_test_memory.h"
+
+#ifdef HAVE_LIBUNWIND_H
+#include <libunwind.h>
+#endif
+
+/* This is a simple tracking allocator to demonstrate the use of SDL's
+ memory allocation replacement functionality.
+
+ It gets slow with large numbers of allocations and shouldn't be used
+ for production code.
+*/
+
+typedef struct SDL_tracked_allocation
+{
+ void *mem;
+ size_t size;
+ Uint64 stack[10];
+ char stack_names[10][256];
+ struct SDL_tracked_allocation *next;
+} SDL_tracked_allocation;
+
+static SDLTest_Crc32Context s_crc32_context;
+static SDL_malloc_func SDL_malloc_orig = NULL;
+static SDL_calloc_func SDL_calloc_orig = NULL;
+static SDL_realloc_func SDL_realloc_orig = NULL;
+static SDL_free_func SDL_free_orig = NULL;
+static int s_previous_allocations = 0;
+static SDL_tracked_allocation *s_tracked_allocations[256];
+
+static unsigned int get_allocation_bucket(void *mem)
+{
+ CrcUint32 crc_value;
+ unsigned int index;
+ SDLTest_Crc32Calc(&s_crc32_context, (CrcUint8 *)&mem, sizeof(mem), &crc_value);
+ index = (crc_value & (SDL_arraysize(s_tracked_allocations) - 1));
+ return index;
+}
+
+static SDL_bool SDL_IsAllocationTracked(void *mem)
+{
+ SDL_tracked_allocation *entry;
+ int index = get_allocation_bucket(mem);
+ for (entry = s_tracked_allocations[index]; entry; entry = entry->next) {
+ if (mem == entry->mem) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static void SDL_TrackAllocation(void *mem, size_t size)
+{
+ SDL_tracked_allocation *entry;
+ int index = get_allocation_bucket(mem);
+
+ if (SDL_IsAllocationTracked(mem)) {
+ return;
+ }
+ entry = (SDL_tracked_allocation *)SDL_malloc_orig(sizeof(*entry));
+ if (!entry) {
+ return;
+ }
+ entry->mem = mem;
+ entry->size = size;
+
+ /* Generate the stack trace for the allocation */
+ SDL_zero(entry->stack);
+#ifdef HAVE_LIBUNWIND_H
+ {
+ int stack_index;
+ unw_cursor_t cursor;
+ unw_context_t context;
+
+ unw_getcontext(&context);
+ unw_init_local(&cursor, &context);
+
+ stack_index = 0;
+ while (unw_step(&cursor) > 0) {
+ unw_word_t offset, pc;
+ char sym[256];
+
+ unw_get_reg(&cursor, UNW_REG_IP, &pc);
+ entry->stack[stack_index] = pc;
+
+ if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) {
+ snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, offset);
+ }
+ ++stack_index;
+
+ if (stack_index == SDL_arraysize(entry->stack)) {
+ break;
+ }
+ }
+ }
+#endif /* HAVE_LIBUNWIND_H */
+
+ entry->next = s_tracked_allocations[index];
+ s_tracked_allocations[index] = entry;
+}
+
+static void SDL_UntrackAllocation(void *mem)
+{
+ SDL_tracked_allocation *entry, *prev;
+ int index = get_allocation_bucket(mem);
+
+ prev = NULL;
+ for (entry = s_tracked_allocations[index]; entry; entry = entry->next) {
+ if (mem == entry->mem) {
+ if (prev) {
+ prev->next = entry->next;
+ } else {
+ s_tracked_allocations[index] = entry->next;
+ }
+ SDL_free_orig(entry);
+ return;
+ }
+ prev = entry;
+ }
+}
+
+static void * SDLCALL SDLTest_TrackedMalloc(size_t size)
+{
+ void *mem;
+
+ mem = SDL_malloc_orig(size);
+ if (mem) {
+ SDL_TrackAllocation(mem, size);
+ }
+ return mem;
+}
+
+static void * SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size)
+{
+ void *mem;
+
+ mem = SDL_calloc_orig(nmemb, size);
+ if (mem) {
+ SDL_TrackAllocation(mem, nmemb * size);
+ }
+ return mem;
+}
+
+static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size)
+{
+ void *mem;
+
+ SDL_assert(!ptr || SDL_IsAllocationTracked(ptr));
+ mem = SDL_realloc_orig(ptr, size);
+ if (mem && mem != ptr) {
+ if (ptr) {
+ SDL_UntrackAllocation(ptr);
+ }
+ SDL_TrackAllocation(mem, size);
+ }
+ return mem;
+}
+
+static void SDLCALL SDLTest_TrackedFree(void *ptr)
+{
+ if (!ptr) {
+ return;
+ }
+
+ if (!s_previous_allocations) {
+ SDL_assert(SDL_IsAllocationTracked(ptr));
+ }
+ SDL_UntrackAllocation(ptr);
+ SDL_free_orig(ptr);
+}
+
+int SDLTest_TrackAllocations()
+{
+ if (SDL_malloc_orig) {
+ return 0;
+ }
+
+ SDLTest_Crc32Init(&s_crc32_context);
+
+ s_previous_allocations = SDL_GetNumAllocations();
+ if (s_previous_allocations != 0) {
+ SDL_Log("SDLTest_TrackAllocations(): There are %d previous allocations, disabling free() validation", s_previous_allocations);
+ }
+
+ SDL_GetMemoryFunctions(&SDL_malloc_orig,
+ &SDL_calloc_orig,
+ &SDL_realloc_orig,
+ &SDL_free_orig);
+
+ SDL_SetMemoryFunctions(SDLTest_TrackedMalloc,
+ SDLTest_TrackedCalloc,
+ SDLTest_TrackedRealloc,
+ SDLTest_TrackedFree);
+ return 0;
+}
+
+void SDLTest_LogAllocations()
+{
+ char *message = NULL;
+ size_t message_size = 0;
+ char line[128], *tmp;
+ SDL_tracked_allocation *entry;
+ int index, count, stack_index;
+ Uint64 total_allocated;
+
+ if (!SDL_malloc_orig) {
+ return;
+ }
+
+#define ADD_LINE() \
+ message_size += (SDL_strlen(line) + 1); \
+ tmp = (char *)SDL_realloc_orig(message, message_size); \
+ if (!tmp) { \
+ return; \
+ } \
+ message = tmp; \
+ SDL_strlcat(message, line, message_size)
+
+ SDL_strlcpy(line, "Memory allocations:\n", sizeof(line));
+ ADD_LINE();
+ SDL_strlcpy(line, "Expect 2 allocations from within SDL_GetErrBuf()\n", sizeof(line));
+ ADD_LINE();
+
+ count = 0;
+ total_allocated = 0;
+ for (index = 0; index < SDL_arraysize(s_tracked_allocations); ++index) {
+ for (entry = s_tracked_allocations[index]; entry; entry = entry->next) {
+ SDL_snprintf(line, sizeof(line), "Allocation %d: %d bytes\n", count, (int)entry->size);
+ ADD_LINE();
+ /* Start at stack index 1 to skip our tracking functions */
+ for (stack_index = 1; stack_index < SDL_arraysize(entry->stack); ++stack_index) {
+ if (!entry->stack[stack_index]) {
+ break;
+ }
+ SDL_snprintf(line, sizeof(line), "\t0x%"SDL_PRIx64": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]);
+ ADD_LINE();
+ }
+ total_allocated += entry->size;
+ ++count;
+ }
+ }
+ SDL_snprintf(line, sizeof(line), "Total: %.2f Kb in %d allocations\n", (float)total_allocated / 1024, count);
+ ADD_LINE();
+#undef ADD_LINE
+
+ SDL_Log("%s", message);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/test/SDL_test_random.c b/src/3rdparty/SDL2/src/test/SDL_test_random.c
new file mode 100644
index 0000000..9e0f1df
--- /dev/null
+++ b/src/3rdparty/SDL2/src/test/SDL_test_random.c
@@ -0,0 +1,96 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+
+ A portable "32-bit Multiply with carry" random number generator.
+
+ Used by the fuzzer component.
+ Original source code contributed by A. Schiffler for GSOC project.
+
+*/
+
+#include "SDL_config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "SDL_test.h"
+
+/* Initialize random number generator with two integer variables */
+
+void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, unsigned int ci)
+{
+ if (rndContext==NULL) return;
+
+ /*
+ * Choose a value for 'a' from this list
+ * 1791398085 1929682203 1683268614 1965537969 1675393560
+ * 1967773755 1517746329 1447497129 1655692410 1606218150
+ * 2051013963 1075433238 1557985959 1781943330 1893513180
+ * 1631296680 2131995753 2083801278 1873196400 1554115554
+ */
+ rndContext->a = 1655692410;
+ rndContext->x = 30903;
+ rndContext->c = 0;
+ if (xi != 0) {
+ rndContext->x = xi;
+ }
+ rndContext->c = ci;
+ rndContext->ah = rndContext->a >> 16;
+ rndContext->al = rndContext->a & 65535;
+}
+
+/* Initialize random number generator from system time */
+
+void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext)
+{
+ int a, b;
+
+ if (rndContext==NULL) return;
+
+ srand((unsigned int)time(NULL));
+ a=rand();
+ srand((unsigned int)clock());
+ b=rand();
+ SDLTest_RandomInit(rndContext, a, b);
+}
+
+/* Returns random numbers */
+
+unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext)
+{
+ unsigned int xh, xl;
+
+ if (rndContext==NULL) return -1;
+
+ xh = rndContext->x >> 16, xl = rndContext->x & 65535;
+ rndContext->x = rndContext->x * rndContext->a + rndContext->c;
+ rndContext->c =
+ xh * rndContext->ah + ((xh * rndContext->al) >> 16) +
+ ((xl * rndContext->ah) >> 16);
+ if (xl * rndContext->al >= (~rndContext->c + 1))
+ rndContext->c++;
+ return (rndContext->x);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/SDL_systhread.h b/src/3rdparty/SDL2/src/thread/SDL_systhread.h
new file mode 100644
index 0000000..1862b23
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/SDL_systhread.h
@@ -0,0 +1,70 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* These are functions that need to be implemented by a port of SDL */
+
+#ifndef SDL_systhread_h_
+#define SDL_systhread_h_
+
+#include "SDL_thread.h"
+#include "SDL_thread_c.h"
+
+/* This function creates a thread, passing args to SDL_RunThread(),
+ saves a system-dependent thread id in thread->id, and returns 0
+ on success.
+*/
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+extern int SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+#else
+extern int SDL_SYS_CreateThread(SDL_Thread * thread, void *args);
+#endif
+
+/* This function does any necessary setup in the child thread */
+extern void SDL_SYS_SetupThread(const char *name);
+
+/* This function sets the current thread priority */
+extern int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority);
+
+/* This function waits for the thread to finish and frees any data
+ allocated by SDL_SYS_CreateThread()
+ */
+extern void SDL_SYS_WaitThread(SDL_Thread * thread);
+
+/* Mark thread as cleaned up as soon as it exits, without joining. */
+extern void SDL_SYS_DetachThread(SDL_Thread * thread);
+
+/* Get the thread local storage for this thread */
+extern SDL_TLSData *SDL_SYS_GetTLSData(void);
+
+/* Set the thread local storage for this thread */
+extern int SDL_SYS_SetTLSData(SDL_TLSData *data);
+
+/* This is for internal SDL use, so we don't need #ifdefs everywhere. */
+extern SDL_Thread *
+SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name,
+ const size_t stacksize, void *data);
+
+#endif /* SDL_systhread_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/SDL_thread.c b/src/3rdparty/SDL2/src/thread/SDL_thread.c
new file mode 100644
index 0000000..84b72d5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/SDL_thread.c
@@ -0,0 +1,503 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* System independent thread management routines for SDL */
+
+#include "SDL_assert.h"
+#include "SDL_thread.h"
+#include "SDL_thread_c.h"
+#include "SDL_systhread.h"
+#include "SDL_hints.h"
+#include "../SDL_error_c.h"
+
+
+SDL_TLSID
+SDL_TLSCreate()
+{
+ static SDL_atomic_t SDL_tls_id;
+ return SDL_AtomicIncRef(&SDL_tls_id)+1;
+}
+
+void *
+SDL_TLSGet(SDL_TLSID id)
+{
+ SDL_TLSData *storage;
+
+ storage = SDL_SYS_GetTLSData();
+ if (!storage || id == 0 || id > storage->limit) {
+ return NULL;
+ }
+ return storage->array[id-1].data;
+}
+
+int
+SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *))
+{
+ SDL_TLSData *storage;
+
+ if (id == 0) {
+ return SDL_InvalidParamError("id");
+ }
+
+ storage = SDL_SYS_GetTLSData();
+ if (!storage || (id > storage->limit)) {
+ unsigned int i, oldlimit, newlimit;
+
+ oldlimit = storage ? storage->limit : 0;
+ newlimit = (id + TLS_ALLOC_CHUNKSIZE);
+ storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage)+(newlimit-1)*sizeof(storage->array[0]));
+ if (!storage) {
+ return SDL_OutOfMemory();
+ }
+ storage->limit = newlimit;
+ for (i = oldlimit; i < newlimit; ++i) {
+ storage->array[i].data = NULL;
+ storage->array[i].destructor = NULL;
+ }
+ if (SDL_SYS_SetTLSData(storage) != 0) {
+ return -1;
+ }
+ }
+
+ storage->array[id-1].data = SDL_const_cast(void*, value);
+ storage->array[id-1].destructor = destructor;
+ return 0;
+}
+
+static void
+SDL_TLSCleanup()
+{
+ SDL_TLSData *storage;
+
+ storage = SDL_SYS_GetTLSData();
+ if (storage) {
+ unsigned int i;
+ for (i = 0; i < storage->limit; ++i) {
+ if (storage->array[i].destructor) {
+ storage->array[i].destructor(storage->array[i].data);
+ }
+ }
+ SDL_SYS_SetTLSData(NULL);
+ SDL_free(storage);
+ }
+}
+
+
+/* This is a generic implementation of thread-local storage which doesn't
+ require additional OS support.
+
+ It is not especially efficient and doesn't clean up thread-local storage
+ as threads exit. If there is a real OS that doesn't support thread-local
+ storage this implementation should be improved to be production quality.
+*/
+
+typedef struct SDL_TLSEntry {
+ SDL_threadID thread;
+ SDL_TLSData *storage;
+ struct SDL_TLSEntry *next;
+} SDL_TLSEntry;
+
+static SDL_mutex *SDL_generic_TLS_mutex;
+static SDL_TLSEntry *SDL_generic_TLS;
+
+
+SDL_TLSData *
+SDL_Generic_GetTLSData(void)
+{
+ SDL_threadID thread = SDL_ThreadID();
+ SDL_TLSEntry *entry;
+ SDL_TLSData *storage = NULL;
+
+#if !SDL_THREADS_DISABLED
+ if (!SDL_generic_TLS_mutex) {
+ static SDL_SpinLock tls_lock;
+ SDL_AtomicLock(&tls_lock);
+ if (!SDL_generic_TLS_mutex) {
+ SDL_mutex *mutex = SDL_CreateMutex();
+ SDL_MemoryBarrierRelease();
+ SDL_generic_TLS_mutex = mutex;
+ if (!SDL_generic_TLS_mutex) {
+ SDL_AtomicUnlock(&tls_lock);
+ return NULL;
+ }
+ }
+ SDL_AtomicUnlock(&tls_lock);
+ }
+#endif /* SDL_THREADS_DISABLED */
+
+ SDL_MemoryBarrierAcquire();
+ SDL_LockMutex(SDL_generic_TLS_mutex);
+ for (entry = SDL_generic_TLS; entry; entry = entry->next) {
+ if (entry->thread == thread) {
+ storage = entry->storage;
+ break;
+ }
+ }
+#if !SDL_THREADS_DISABLED
+ SDL_UnlockMutex(SDL_generic_TLS_mutex);
+#endif
+
+ return storage;
+}
+
+int
+SDL_Generic_SetTLSData(SDL_TLSData *storage)
+{
+ SDL_threadID thread = SDL_ThreadID();
+ SDL_TLSEntry *prev, *entry;
+
+ /* SDL_Generic_GetTLSData() is always called first, so we can assume SDL_generic_TLS_mutex */
+ SDL_LockMutex(SDL_generic_TLS_mutex);
+ prev = NULL;
+ for (entry = SDL_generic_TLS; entry; entry = entry->next) {
+ if (entry->thread == thread) {
+ if (storage) {
+ entry->storage = storage;
+ } else {
+ if (prev) {
+ prev->next = entry->next;
+ } else {
+ SDL_generic_TLS = entry->next;
+ }
+ SDL_free(entry);
+ }
+ break;
+ }
+ prev = entry;
+ }
+ if (!entry) {
+ entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry));
+ if (entry) {
+ entry->thread = thread;
+ entry->storage = storage;
+ entry->next = SDL_generic_TLS;
+ SDL_generic_TLS = entry;
+ }
+ }
+ SDL_UnlockMutex(SDL_generic_TLS_mutex);
+
+ if (!entry) {
+ return SDL_OutOfMemory();
+ }
+ return 0;
+}
+
+/* Routine to get the thread-specific error variable */
+SDL_error *
+SDL_GetErrBuf(void)
+{
+ static SDL_SpinLock tls_lock;
+ static SDL_bool tls_being_created;
+ static SDL_TLSID tls_errbuf;
+ static SDL_error SDL_global_errbuf;
+ const SDL_error *ALLOCATION_IN_PROGRESS = (SDL_error *)-1;
+ SDL_error *errbuf;
+
+ /* tls_being_created is there simply to prevent recursion if SDL_TLSCreate() fails.
+ It also means it's possible for another thread to also use SDL_global_errbuf,
+ but that's very unlikely and hopefully won't cause issues.
+ */
+ if (!tls_errbuf && !tls_being_created) {
+ SDL_AtomicLock(&tls_lock);
+ if (!tls_errbuf) {
+ SDL_TLSID slot;
+ tls_being_created = SDL_TRUE;
+ slot = SDL_TLSCreate();
+ tls_being_created = SDL_FALSE;
+ SDL_MemoryBarrierRelease();
+ tls_errbuf = slot;
+ }
+ SDL_AtomicUnlock(&tls_lock);
+ }
+ if (!tls_errbuf) {
+ return &SDL_global_errbuf;
+ }
+
+ SDL_MemoryBarrierAcquire();
+ errbuf = (SDL_error *)SDL_TLSGet(tls_errbuf);
+ if (errbuf == ALLOCATION_IN_PROGRESS) {
+ return &SDL_global_errbuf;
+ }
+ if (!errbuf) {
+ /* Mark that we're in the middle of allocating our buffer */
+ SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL);
+ errbuf = (SDL_error *)SDL_malloc(sizeof(*errbuf));
+ if (!errbuf) {
+ SDL_TLSSet(tls_errbuf, NULL, NULL);
+ return &SDL_global_errbuf;
+ }
+ SDL_zerop(errbuf);
+ SDL_TLSSet(tls_errbuf, errbuf, SDL_free);
+ }
+ return errbuf;
+}
+
+
+/* Arguments and callback to setup and run the user thread function */
+typedef struct
+{
+ int (SDLCALL * func) (void *);
+ void *data;
+ SDL_Thread *info;
+ SDL_sem *wait;
+} thread_args;
+
+void
+SDL_RunThread(void *data)
+{
+ thread_args *args = (thread_args *) data;
+ int (SDLCALL * userfunc) (void *) = args->func;
+ void *userdata = args->data;
+ SDL_Thread *thread = args->info;
+ int *statusloc = &thread->status;
+
+ /* Perform any system-dependent setup - this function may not fail */
+ SDL_SYS_SetupThread(thread->name);
+
+ /* Get the thread id */
+ thread->threadid = SDL_ThreadID();
+
+ /* Wake up the parent thread */
+ SDL_SemPost(args->wait);
+
+ /* Run the function */
+ *statusloc = userfunc(userdata);
+
+ /* Clean up thread-local storage */
+ SDL_TLSCleanup();
+
+ /* Mark us as ready to be joined (or detached) */
+ if (!SDL_AtomicCAS(&thread->state, SDL_THREAD_STATE_ALIVE, SDL_THREAD_STATE_ZOMBIE)) {
+ /* Clean up if something already detached us. */
+ if (SDL_AtomicCAS(&thread->state, SDL_THREAD_STATE_DETACHED, SDL_THREAD_STATE_CLEANED)) {
+ if (thread->name) {
+ SDL_free(thread->name);
+ }
+ SDL_free(thread);
+ }
+ }
+}
+
+#ifdef SDL_CreateThread
+#undef SDL_CreateThread
+#endif
+#if SDL_DYNAMIC_API
+#define SDL_CreateThread SDL_CreateThread_REAL
+#endif
+
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+static SDL_Thread *
+SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+ const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread)
+#else
+static SDL_Thread *
+SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+ const char *name, const size_t stacksize, void *data)
+#endif
+{
+ SDL_Thread *thread;
+ thread_args *args;
+ int ret;
+
+ /* Allocate memory for the thread info structure */
+ thread = (SDL_Thread *) SDL_malloc(sizeof(*thread));
+ if (thread == NULL) {
+ SDL_OutOfMemory();
+ return (NULL);
+ }
+ SDL_zerop(thread);
+ thread->status = -1;
+ SDL_AtomicSet(&thread->state, SDL_THREAD_STATE_ALIVE);
+
+ /* Set up the arguments for the thread */
+ if (name != NULL) {
+ thread->name = SDL_strdup(name);
+ if (thread->name == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(thread);
+ return (NULL);
+ }
+ }
+
+ /* Set up the arguments for the thread */
+ args = (thread_args *) SDL_malloc(sizeof(*args));
+ if (args == NULL) {
+ SDL_OutOfMemory();
+ if (thread->name) {
+ SDL_free(thread->name);
+ }
+ SDL_free(thread);
+ return (NULL);
+ }
+ args->func = fn;
+ args->data = data;
+ args->info = thread;
+ args->wait = SDL_CreateSemaphore(0);
+ if (args->wait == NULL) {
+ if (thread->name) {
+ SDL_free(thread->name);
+ }
+ SDL_free(thread);
+ SDL_free(args);
+ return (NULL);
+ }
+
+ thread->stacksize = stacksize;
+
+ /* Create the thread and go! */
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+ ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread);
+#else
+ ret = SDL_SYS_CreateThread(thread, args);
+#endif
+ if (ret >= 0) {
+ /* Wait for the thread function to use arguments */
+ SDL_SemWait(args->wait);
+ } else {
+ /* Oops, failed. Gotta free everything */
+ if (thread->name) {
+ SDL_free(thread->name);
+ }
+ SDL_free(thread);
+ thread = NULL;
+ }
+ SDL_DestroySemaphore(args->wait);
+ SDL_free(args);
+
+ /* Everything is running now */
+ return (thread);
+}
+
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(int (SDLCALL * fn) (void *),
+ const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread)
+#else
+DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(int (SDLCALL * fn) (void *),
+ const char *name, void *data)
+#endif
+{
+ /* !!! FIXME: in 2.1, just make stackhint part of the usual API. */
+ const char *stackhint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE);
+ size_t stacksize = 0;
+
+ /* If the SDL_HINT_THREAD_STACK_SIZE exists, use it */
+ if (stackhint != NULL) {
+ char *endp = NULL;
+ const Sint64 hintval = SDL_strtoll(stackhint, &endp, 10);
+ if ((*stackhint != '\0') && (*endp == '\0')) { /* a valid number? */
+ if (hintval > 0) { /* reject bogus values. */
+ stacksize = (size_t) hintval;
+ }
+ }
+ }
+
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+ return SDL_CreateThreadWithStackSize(fn, name, stacksize, data, pfnBeginThread, pfnEndThread);
+#else
+ return SDL_CreateThreadWithStackSize(fn, name, stacksize, data);
+#endif
+}
+
+SDL_Thread *
+SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name,
+ const size_t stacksize, void *data) {
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+ return SDL_CreateThreadWithStackSize(fn, name, stacksize, data, NULL, NULL);
+#else
+ return SDL_CreateThreadWithStackSize(fn, name, stacksize, data);
+#endif
+}
+
+SDL_threadID
+SDL_GetThreadID(SDL_Thread * thread)
+{
+ SDL_threadID id;
+
+ if (thread) {
+ id = thread->threadid;
+ } else {
+ id = SDL_ThreadID();
+ }
+ return id;
+}
+
+const char *
+SDL_GetThreadName(SDL_Thread * thread)
+{
+ if (thread) {
+ return thread->name;
+ } else {
+ return NULL;
+ }
+}
+
+int
+SDL_SetThreadPriority(SDL_ThreadPriority priority)
+{
+ return SDL_SYS_SetThreadPriority(priority);
+}
+
+void
+SDL_WaitThread(SDL_Thread * thread, int *status)
+{
+ if (thread) {
+ SDL_SYS_WaitThread(thread);
+ if (status) {
+ *status = thread->status;
+ }
+ if (thread->name) {
+ SDL_free(thread->name);
+ }
+ SDL_free(thread);
+ }
+}
+
+void
+SDL_DetachThread(SDL_Thread * thread)
+{
+ if (!thread) {
+ return;
+ }
+
+ /* Grab dibs if the state is alive+joinable. */
+ if (SDL_AtomicCAS(&thread->state, SDL_THREAD_STATE_ALIVE, SDL_THREAD_STATE_DETACHED)) {
+ SDL_SYS_DetachThread(thread);
+ } else {
+ /* all other states are pretty final, see where we landed. */
+ const int thread_state = SDL_AtomicGet(&thread->state);
+ if ((thread_state == SDL_THREAD_STATE_DETACHED) || (thread_state == SDL_THREAD_STATE_CLEANED)) {
+ return; /* already detached (you shouldn't call this twice!) */
+ } else if (thread_state == SDL_THREAD_STATE_ZOMBIE) {
+ SDL_WaitThread(thread, NULL); /* already done, clean it up. */
+ } else {
+ SDL_assert(0 && "Unexpected thread state");
+ }
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/SDL_thread_c.h b/src/3rdparty/SDL2/src/thread/SDL_thread_c.h
new file mode 100644
index 0000000..b68f90e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/SDL_thread_c.h
@@ -0,0 +1,95 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_thread_c_h_
+#define SDL_thread_c_h_
+
+#include "SDL_thread.h"
+
+/* Need the definitions of SYS_ThreadHandle */
+#if SDL_THREADS_DISABLED
+#include "generic/SDL_systhread_c.h"
+#elif SDL_THREAD_PTHREAD
+#include "pthread/SDL_systhread_c.h"
+#elif SDL_THREAD_WINDOWS
+#include "windows/SDL_systhread_c.h"
+#elif SDL_THREAD_PSP
+#include "psp/SDL_systhread_c.h"
+#elif SDL_THREAD_STDCPP
+#include "stdcpp/SDL_systhread_c.h"
+#else
+#error Need thread implementation for this platform
+#include "generic/SDL_systhread_c.h"
+#endif
+#include "../SDL_error_c.h"
+
+typedef enum SDL_ThreadState
+{
+ SDL_THREAD_STATE_ALIVE,
+ SDL_THREAD_STATE_DETACHED,
+ SDL_THREAD_STATE_ZOMBIE,
+ SDL_THREAD_STATE_CLEANED,
+} SDL_ThreadState;
+
+/* This is the system-independent thread info structure */
+struct SDL_Thread
+{
+ SDL_threadID threadid;
+ SYS_ThreadHandle handle;
+ int status;
+ SDL_atomic_t state; /* SDL_THREAD_STATE_* */
+ SDL_error errbuf;
+ char *name;
+ size_t stacksize; /* 0 for default, >0 for user-specified stack size. */
+ void *data;
+};
+
+/* This is the function called to run a thread */
+extern void SDL_RunThread(void *data);
+
+/* This is the system-independent thread local storage structure */
+typedef struct {
+ unsigned int limit;
+ struct {
+ void *data;
+ void (SDLCALL *destructor)(void*);
+ } array[1];
+} SDL_TLSData;
+
+/* This is how many TLS entries we allocate at once */
+#define TLS_ALLOC_CHUNKSIZE 4
+
+/* Get cross-platform, slow, thread local storage for this thread.
+ This is only intended as a fallback if getting real thread-local
+ storage fails or isn't supported on this platform.
+ */
+extern SDL_TLSData *SDL_Generic_GetTLSData(void);
+
+/* Set cross-platform, slow, thread local storage for this thread.
+ This is only intended as a fallback if getting real thread-local
+ storage fails or isn't supported on this platform.
+ */
+extern int SDL_Generic_SetTLSData(SDL_TLSData *data);
+
+#endif /* SDL_thread_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_syscond.c b/src/3rdparty/SDL2/src/thread/generic/SDL_syscond.c
new file mode 100644
index 0000000..34b9893
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_syscond.c
@@ -0,0 +1,220 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* An implementation of condition variables using semaphores and mutexes */
+/*
+ This implementation borrows heavily from the BeOS condition variable
+ implementation, written by Christopher Tate and Owen Smith. Thanks!
+ */
+
+#include "SDL_thread.h"
+
+struct SDL_cond
+{
+ SDL_mutex *lock;
+ int waiting;
+ int signals;
+ SDL_sem *wait_sem;
+ SDL_sem *wait_done;
+};
+
+/* Create a condition variable */
+SDL_cond *
+SDL_CreateCond(void)
+{
+ SDL_cond *cond;
+
+ cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond));
+ if (cond) {
+ cond->lock = SDL_CreateMutex();
+ cond->wait_sem = SDL_CreateSemaphore(0);
+ cond->wait_done = SDL_CreateSemaphore(0);
+ cond->waiting = cond->signals = 0;
+ if (!cond->lock || !cond->wait_sem || !cond->wait_done) {
+ SDL_DestroyCond(cond);
+ cond = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return (cond);
+}
+
+/* Destroy a condition variable */
+void
+SDL_DestroyCond(SDL_cond * cond)
+{
+ if (cond) {
+ if (cond->wait_sem) {
+ SDL_DestroySemaphore(cond->wait_sem);
+ }
+ if (cond->wait_done) {
+ SDL_DestroySemaphore(cond->wait_done);
+ }
+ if (cond->lock) {
+ SDL_DestroyMutex(cond->lock);
+ }
+ SDL_free(cond);
+ }
+}
+
+/* Restart one of the threads that are waiting on the condition variable */
+int
+SDL_CondSignal(SDL_cond * cond)
+{
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ /* If there are waiting threads not already signalled, then
+ signal the condition and wait for the thread to respond.
+ */
+ SDL_LockMutex(cond->lock);
+ if (cond->waiting > cond->signals) {
+ ++cond->signals;
+ SDL_SemPost(cond->wait_sem);
+ SDL_UnlockMutex(cond->lock);
+ SDL_SemWait(cond->wait_done);
+ } else {
+ SDL_UnlockMutex(cond->lock);
+ }
+
+ return 0;
+}
+
+/* Restart all threads that are waiting on the condition variable */
+int
+SDL_CondBroadcast(SDL_cond * cond)
+{
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ /* If there are waiting threads not already signalled, then
+ signal the condition and wait for the thread to respond.
+ */
+ SDL_LockMutex(cond->lock);
+ if (cond->waiting > cond->signals) {
+ int i, num_waiting;
+
+ num_waiting = (cond->waiting - cond->signals);
+ cond->signals = cond->waiting;
+ for (i = 0; i < num_waiting; ++i) {
+ SDL_SemPost(cond->wait_sem);
+ }
+ /* Now all released threads are blocked here, waiting for us.
+ Collect them all (and win fabulous prizes!) :-)
+ */
+ SDL_UnlockMutex(cond->lock);
+ for (i = 0; i < num_waiting; ++i) {
+ SDL_SemWait(cond->wait_done);
+ }
+ } else {
+ SDL_UnlockMutex(cond->lock);
+ }
+
+ return 0;
+}
+
+/* Wait on the condition variable for at most 'ms' milliseconds.
+ The mutex must be locked before entering this function!
+ The mutex is unlocked during the wait, and locked again after the wait.
+
+Typical use:
+
+Thread A:
+ SDL_LockMutex(lock);
+ while ( ! condition ) {
+ SDL_CondWait(cond, lock);
+ }
+ SDL_UnlockMutex(lock);
+
+Thread B:
+ SDL_LockMutex(lock);
+ ...
+ condition = true;
+ ...
+ SDL_CondSignal(cond);
+ SDL_UnlockMutex(lock);
+ */
+int
+SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
+{
+ int retval;
+
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ /* Obtain the protection mutex, and increment the number of waiters.
+ This allows the signal mechanism to only perform a signal if there
+ are waiting threads.
+ */
+ SDL_LockMutex(cond->lock);
+ ++cond->waiting;
+ SDL_UnlockMutex(cond->lock);
+
+ /* Unlock the mutex, as is required by condition variable semantics */
+ SDL_UnlockMutex(mutex);
+
+ /* Wait for a signal */
+ if (ms == SDL_MUTEX_MAXWAIT) {
+ retval = SDL_SemWait(cond->wait_sem);
+ } else {
+ retval = SDL_SemWaitTimeout(cond->wait_sem, ms);
+ }
+
+ /* Let the signaler know we have completed the wait, otherwise
+ the signaler can race ahead and get the condition semaphore
+ if we are stopped between the mutex unlock and semaphore wait,
+ giving a deadlock. See the following URL for details:
+ http://web.archive.org/web/20010914175514/http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html#Workshop
+ */
+ SDL_LockMutex(cond->lock);
+ if (cond->signals > 0) {
+ /* If we timed out, we need to eat a condition signal */
+ if (retval > 0) {
+ SDL_SemWait(cond->wait_sem);
+ }
+ /* We always notify the signal thread that we are done */
+ SDL_SemPost(cond->wait_done);
+
+ /* Signal handshake complete */
+ --cond->signals;
+ }
+ --cond->waiting;
+ SDL_UnlockMutex(cond->lock);
+
+ /* Lock the mutex, as is required by condition variable semantics */
+ SDL_LockMutex(mutex);
+
+ return retval;
+}
+
+/* Wait on the condition variable forever */
+int
+SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
+{
+ return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex.c b/src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex.c
new file mode 100644
index 0000000..df78ca9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex.c
@@ -0,0 +1,165 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* An implementation of mutexes using semaphores */
+
+#include "SDL_thread.h"
+#include "SDL_systhread_c.h"
+
+
+struct SDL_mutex
+{
+ int recursive;
+ SDL_threadID owner;
+ SDL_sem *sem;
+};
+
+/* Create a mutex */
+SDL_mutex *
+SDL_CreateMutex(void)
+{
+ SDL_mutex *mutex;
+
+ /* Allocate mutex memory */
+ mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
+ if (mutex) {
+ /* Create the mutex semaphore, with initial value 1 */
+ mutex->sem = SDL_CreateSemaphore(1);
+ mutex->recursive = 0;
+ mutex->owner = 0;
+ if (!mutex->sem) {
+ SDL_free(mutex);
+ mutex = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return mutex;
+}
+
+/* Free the mutex */
+void
+SDL_DestroyMutex(SDL_mutex * mutex)
+{
+ if (mutex) {
+ if (mutex->sem) {
+ SDL_DestroySemaphore(mutex->sem);
+ }
+ SDL_free(mutex);
+ }
+}
+
+/* Lock the mutex */
+int
+SDL_LockMutex(SDL_mutex * mutex)
+{
+#if SDL_THREADS_DISABLED
+ return 0;
+#else
+ SDL_threadID this_thread;
+
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ this_thread = SDL_ThreadID();
+ if (mutex->owner == this_thread) {
+ ++mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ We set the locking thread id after we obtain the lock
+ so unlocks from other threads will fail.
+ */
+ SDL_SemWait(mutex->sem);
+ mutex->owner = this_thread;
+ mutex->recursive = 0;
+ }
+
+ return 0;
+#endif /* SDL_THREADS_DISABLED */
+}
+
+/* try Lock the mutex */
+int
+SDL_TryLockMutex(SDL_mutex * mutex)
+{
+#if SDL_THREADS_DISABLED
+ return 0;
+#else
+ int retval = 0;
+ SDL_threadID this_thread;
+
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ this_thread = SDL_ThreadID();
+ if (mutex->owner == this_thread) {
+ ++mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ We set the locking thread id after we obtain the lock
+ so unlocks from other threads will fail.
+ */
+ retval = SDL_SemWait(mutex->sem);
+ if (retval == 0) {
+ mutex->owner = this_thread;
+ mutex->recursive = 0;
+ }
+ }
+
+ return retval;
+#endif /* SDL_THREADS_DISABLED */
+}
+
+/* Unlock the mutex */
+int
+SDL_mutexV(SDL_mutex * mutex)
+{
+#if SDL_THREADS_DISABLED
+ return 0;
+#else
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ /* If we don't own the mutex, we can't unlock it */
+ if (SDL_ThreadID() != mutex->owner) {
+ return SDL_SetError("mutex not owned by this thread");
+ }
+
+ if (mutex->recursive) {
+ --mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ First reset the owner so another thread doesn't lock
+ the mutex and set the ownership before we reset it,
+ then release the lock semaphore.
+ */
+ mutex->owner = 0;
+ SDL_SemPost(mutex->sem);
+ }
+ return 0;
+#endif /* SDL_THREADS_DISABLED */
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex_c.h b/src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex_c.h
new file mode 100644
index 0000000..2979437
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_sysmutex_c.h
@@ -0,0 +1,22 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_syssem.c b/src/3rdparty/SDL2/src/thread/generic/SDL_syssem.c
new file mode 100644
index 0000000..30ff824
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_syssem.c
@@ -0,0 +1,217 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* An implementation of semaphores using mutexes and condition variables */
+
+#include "SDL_timer.h"
+#include "SDL_thread.h"
+#include "SDL_systhread_c.h"
+
+
+#if SDL_THREADS_DISABLED
+
+SDL_sem *
+SDL_CreateSemaphore(Uint32 initial_value)
+{
+ SDL_SetError("SDL not built with thread support");
+ return (SDL_sem *) 0;
+}
+
+void
+SDL_DestroySemaphore(SDL_sem * sem)
+{
+}
+
+int
+SDL_SemTryWait(SDL_sem * sem)
+{
+ return SDL_SetError("SDL not built with thread support");
+}
+
+int
+SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
+{
+ return SDL_SetError("SDL not built with thread support");
+}
+
+int
+SDL_SemWait(SDL_sem * sem)
+{
+ return SDL_SetError("SDL not built with thread support");
+}
+
+Uint32
+SDL_SemValue(SDL_sem * sem)
+{
+ return 0;
+}
+
+int
+SDL_SemPost(SDL_sem * sem)
+{
+ return SDL_SetError("SDL not built with thread support");
+}
+
+#else
+
+struct SDL_semaphore
+{
+ Uint32 count;
+ Uint32 waiters_count;
+ SDL_mutex *count_lock;
+ SDL_cond *count_nonzero;
+};
+
+SDL_sem *
+SDL_CreateSemaphore(Uint32 initial_value)
+{
+ SDL_sem *sem;
+
+ sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
+ if (!sem) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ sem->count = initial_value;
+ sem->waiters_count = 0;
+
+ sem->count_lock = SDL_CreateMutex();
+ sem->count_nonzero = SDL_CreateCond();
+ if (!sem->count_lock || !sem->count_nonzero) {
+ SDL_DestroySemaphore(sem);
+ return NULL;
+ }
+
+ return sem;
+}
+
+/* WARNING:
+ You cannot call this function when another thread is using the semaphore.
+*/
+void
+SDL_DestroySemaphore(SDL_sem * sem)
+{
+ if (sem) {
+ sem->count = 0xFFFFFFFF;
+ while (sem->waiters_count > 0) {
+ SDL_CondSignal(sem->count_nonzero);
+ SDL_Delay(10);
+ }
+ SDL_DestroyCond(sem->count_nonzero);
+ if (sem->count_lock) {
+ SDL_LockMutex(sem->count_lock);
+ SDL_UnlockMutex(sem->count_lock);
+ SDL_DestroyMutex(sem->count_lock);
+ }
+ SDL_free(sem);
+ }
+}
+
+int
+SDL_SemTryWait(SDL_sem * sem)
+{
+ int retval;
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+
+ retval = SDL_MUTEX_TIMEDOUT;
+ SDL_LockMutex(sem->count_lock);
+ if (sem->count > 0) {
+ --sem->count;
+ retval = 0;
+ }
+ SDL_UnlockMutex(sem->count_lock);
+
+ return retval;
+}
+
+int
+SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
+{
+ int retval;
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+
+ /* A timeout of 0 is an easy case */
+ if (timeout == 0) {
+ return SDL_SemTryWait(sem);
+ }
+
+ SDL_LockMutex(sem->count_lock);
+ ++sem->waiters_count;
+ retval = 0;
+ while ((sem->count == 0) && (retval != SDL_MUTEX_TIMEDOUT)) {
+ retval = SDL_CondWaitTimeout(sem->count_nonzero,
+ sem->count_lock, timeout);
+ }
+ --sem->waiters_count;
+ if (retval == 0) {
+ --sem->count;
+ }
+ SDL_UnlockMutex(sem->count_lock);
+
+ return retval;
+}
+
+int
+SDL_SemWait(SDL_sem * sem)
+{
+ return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
+}
+
+Uint32
+SDL_SemValue(SDL_sem * sem)
+{
+ Uint32 value;
+
+ value = 0;
+ if (sem) {
+ SDL_LockMutex(sem->count_lock);
+ value = sem->count;
+ SDL_UnlockMutex(sem->count_lock);
+ }
+ return value;
+}
+
+int
+SDL_SemPost(SDL_sem * sem)
+{
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+
+ SDL_LockMutex(sem->count_lock);
+ if (sem->waiters_count > 0) {
+ SDL_CondSignal(sem->count_nonzero);
+ }
+ ++sem->count;
+ SDL_UnlockMutex(sem->count_lock);
+
+ return 0;
+}
+
+#endif /* SDL_THREADS_DISABLED */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_systhread.c b/src/3rdparty/SDL2/src/thread/generic/SDL_systhread.c
new file mode 100644
index 0000000..7a19b78
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_systhread.c
@@ -0,0 +1,71 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* Thread management routines for SDL */
+
+#include "SDL_thread.h"
+#include "../SDL_systhread.h"
+
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread)
+#else
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
+#endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
+{
+ return SDL_SetError("Threads are not supported on this platform");
+}
+
+void
+SDL_SYS_SetupThread(const char *name)
+{
+ return;
+}
+
+SDL_threadID
+SDL_ThreadID(void)
+{
+ return (0);
+}
+
+int
+SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
+{
+ return (0);
+}
+
+void
+SDL_SYS_WaitThread(SDL_Thread * thread)
+{
+ return;
+}
+
+void
+SDL_SYS_DetachThread(SDL_Thread * thread)
+{
+ return;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_systhread_c.h b/src/3rdparty/SDL2/src/thread/generic/SDL_systhread_c.h
new file mode 100644
index 0000000..13db579
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_systhread_c.h
@@ -0,0 +1,26 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* Stub until we implement threads on this platform */
+typedef int SYS_ThreadHandle;
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/generic/SDL_systls.c b/src/3rdparty/SDL2/src/thread/generic/SDL_systls.c
new file mode 100644
index 0000000..241862e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/generic/SDL_systls.c
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#include "../SDL_thread_c.h"
+
+
+SDL_TLSData *
+SDL_SYS_GetTLSData(void)
+{
+ return SDL_Generic_GetTLSData();
+}
+
+int
+SDL_SYS_SetTLSData(SDL_TLSData *data)
+{
+ return SDL_Generic_SetTLSData(data);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/psp/SDL_syscond.c b/src/3rdparty/SDL2/src/thread/psp/SDL_syscond.c
new file mode 100644
index 0000000..4ed73e0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/psp/SDL_syscond.c
@@ -0,0 +1,224 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_PSP
+
+/* An implementation of condition variables using semaphores and mutexes */
+/*
+ This implementation borrows heavily from the BeOS condition variable
+ implementation, written by Christopher Tate and Owen Smith. Thanks!
+ */
+
+#include "SDL_thread.h"
+
+struct SDL_cond
+{
+ SDL_mutex *lock;
+ int waiting;
+ int signals;
+ SDL_sem *wait_sem;
+ SDL_sem *wait_done;
+};
+
+/* Create a condition variable */
+SDL_cond *
+SDL_CreateCond(void)
+{
+ SDL_cond *cond;
+
+ cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond));
+ if (cond) {
+ cond->lock = SDL_CreateMutex();
+ cond->wait_sem = SDL_CreateSemaphore(0);
+ cond->wait_done = SDL_CreateSemaphore(0);
+ cond->waiting = cond->signals = 0;
+ if (!cond->lock || !cond->wait_sem || !cond->wait_done) {
+ SDL_DestroyCond(cond);
+ cond = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return (cond);
+}
+
+/* Destroy a condition variable */
+void
+SDL_DestroyCond(SDL_cond * cond)
+{
+ if (cond) {
+ if (cond->wait_sem) {
+ SDL_DestroySemaphore(cond->wait_sem);
+ }
+ if (cond->wait_done) {
+ SDL_DestroySemaphore(cond->wait_done);
+ }
+ if (cond->lock) {
+ SDL_DestroyMutex(cond->lock);
+ }
+ SDL_free(cond);
+ }
+}
+
+/* Restart one of the threads that are waiting on the condition variable */
+int
+SDL_CondSignal(SDL_cond * cond)
+{
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ /* If there are waiting threads not already signalled, then
+ signal the condition and wait for the thread to respond.
+ */
+ SDL_LockMutex(cond->lock);
+ if (cond->waiting > cond->signals) {
+ ++cond->signals;
+ SDL_SemPost(cond->wait_sem);
+ SDL_UnlockMutex(cond->lock);
+ SDL_SemWait(cond->wait_done);
+ } else {
+ SDL_UnlockMutex(cond->lock);
+ }
+
+ return 0;
+}
+
+/* Restart all threads that are waiting on the condition variable */
+int
+SDL_CondBroadcast(SDL_cond * cond)
+{
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ /* If there are waiting threads not already signalled, then
+ signal the condition and wait for the thread to respond.
+ */
+ SDL_LockMutex(cond->lock);
+ if (cond->waiting > cond->signals) {
+ int i, num_waiting;
+
+ num_waiting = (cond->waiting - cond->signals);
+ cond->signals = cond->waiting;
+ for (i = 0; i < num_waiting; ++i) {
+ SDL_SemPost(cond->wait_sem);
+ }
+ /* Now all released threads are blocked here, waiting for us.
+ Collect them all (and win fabulous prizes!) :-)
+ */
+ SDL_UnlockMutex(cond->lock);
+ for (i = 0; i < num_waiting; ++i) {
+ SDL_SemWait(cond->wait_done);
+ }
+ } else {
+ SDL_UnlockMutex(cond->lock);
+ }
+
+ return 0;
+}
+
+/* Wait on the condition variable for at most 'ms' milliseconds.
+ The mutex must be locked before entering this function!
+ The mutex is unlocked during the wait, and locked again after the wait.
+
+Typical use:
+
+Thread A:
+ SDL_LockMutex(lock);
+ while ( ! condition ) {
+ SDL_CondWait(cond, lock);
+ }
+ SDL_UnlockMutex(lock);
+
+Thread B:
+ SDL_LockMutex(lock);
+ ...
+ condition = true;
+ ...
+ SDL_CondSignal(cond);
+ SDL_UnlockMutex(lock);
+ */
+int
+SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
+{
+ int retval;
+
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ /* Obtain the protection mutex, and increment the number of waiters.
+ This allows the signal mechanism to only perform a signal if there
+ are waiting threads.
+ */
+ SDL_LockMutex(cond->lock);
+ ++cond->waiting;
+ SDL_UnlockMutex(cond->lock);
+
+ /* Unlock the mutex, as is required by condition variable semantics */
+ SDL_UnlockMutex(mutex);
+
+ /* Wait for a signal */
+ if (ms == SDL_MUTEX_MAXWAIT) {
+ retval = SDL_SemWait(cond->wait_sem);
+ } else {
+ retval = SDL_SemWaitTimeout(cond->wait_sem, ms);
+ }
+
+ /* Let the signaler know we have completed the wait, otherwise
+ the signaler can race ahead and get the condition semaphore
+ if we are stopped between the mutex unlock and semaphore wait,
+ giving a deadlock. See the following URL for details:
+ http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html
+ */
+ SDL_LockMutex(cond->lock);
+ if (cond->signals > 0) {
+ /* If we timed out, we need to eat a condition signal */
+ if (retval > 0) {
+ SDL_SemWait(cond->wait_sem);
+ }
+ /* We always notify the signal thread that we are done */
+ SDL_SemPost(cond->wait_done);
+
+ /* Signal handshake complete */
+ --cond->signals;
+ }
+ --cond->waiting;
+ SDL_UnlockMutex(cond->lock);
+
+ /* Lock the mutex, as is required by condition variable semantics */
+ SDL_LockMutex(mutex);
+
+ return retval;
+}
+
+/* Wait on the condition variable forever */
+int
+SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
+{
+ return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT);
+}
+
+#endif /* SDL_THREAD_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex.c b/src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex.c
new file mode 100644
index 0000000..e2db5eb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex.c
@@ -0,0 +1,136 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_PSP
+
+/* An implementation of mutexes using semaphores */
+
+#include "SDL_thread.h"
+#include "SDL_systhread_c.h"
+
+
+struct SDL_mutex
+{
+ int recursive;
+ SDL_threadID owner;
+ SDL_sem *sem;
+};
+
+/* Create a mutex */
+SDL_mutex *
+SDL_CreateMutex(void)
+{
+ SDL_mutex *mutex;
+
+ /* Allocate mutex memory */
+ mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
+ if (mutex) {
+ /* Create the mutex semaphore, with initial value 1 */
+ mutex->sem = SDL_CreateSemaphore(1);
+ mutex->recursive = 0;
+ mutex->owner = 0;
+ if (!mutex->sem) {
+ SDL_free(mutex);
+ mutex = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return mutex;
+}
+
+/* Free the mutex */
+void
+SDL_DestroyMutex(SDL_mutex * mutex)
+{
+ if (mutex) {
+ if (mutex->sem) {
+ SDL_DestroySemaphore(mutex->sem);
+ }
+ SDL_free(mutex);
+ }
+}
+
+/* Lock the semaphore */
+int
+SDL_mutexP(SDL_mutex * mutex)
+{
+#if SDL_THREADS_DISABLED
+ return 0;
+#else
+ SDL_threadID this_thread;
+
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ this_thread = SDL_ThreadID();
+ if (mutex->owner == this_thread) {
+ ++mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ We set the locking thread id after we obtain the lock
+ so unlocks from other threads will fail.
+ */
+ SDL_SemWait(mutex->sem);
+ mutex->owner = this_thread;
+ mutex->recursive = 0;
+ }
+
+ return 0;
+#endif /* SDL_THREADS_DISABLED */
+}
+
+/* Unlock the mutex */
+int
+SDL_mutexV(SDL_mutex * mutex)
+{
+#if SDL_THREADS_DISABLED
+ return 0;
+#else
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ /* If we don't own the mutex, we can't unlock it */
+ if (SDL_ThreadID() != mutex->owner) {
+ return SDL_SetError("mutex not owned by this thread");
+ }
+
+ if (mutex->recursive) {
+ --mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ First reset the owner so another thread doesn't lock
+ the mutex and set the ownership before we reset it,
+ then release the lock semaphore.
+ */
+ mutex->owner = 0;
+ SDL_SemPost(mutex->sem);
+ }
+ return 0;
+#endif /* SDL_THREADS_DISABLED */
+}
+
+#endif /* SDL_THREAD_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex_c.h b/src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex_c.h
new file mode 100644
index 0000000..2979437
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/psp/SDL_sysmutex_c.h
@@ -0,0 +1,22 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/psp/SDL_syssem.c b/src/3rdparty/SDL2/src/thread/psp/SDL_syssem.c
new file mode 100644
index 0000000..0c36434
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/psp/SDL_syssem.c
@@ -0,0 +1,161 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_PSP
+
+/* Semaphore functions for the PSP. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "SDL_error.h"
+#include "SDL_thread.h"
+
+#include <pspthreadman.h>
+#include <pspkerror.h>
+
+struct SDL_semaphore {
+ SceUID semid;
+};
+
+
+/* Create a semaphore */
+SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
+{
+ SDL_sem *sem;
+
+ sem = (SDL_sem *) malloc(sizeof(*sem));
+ if (sem != NULL) {
+ /* TODO: Figure out the limit on the maximum value. */
+ sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
+ if (sem->semid < 0) {
+ SDL_SetError("Couldn't create semaphore");
+ free(sem);
+ sem = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return sem;
+}
+
+/* Free the semaphore */
+void SDL_DestroySemaphore(SDL_sem *sem)
+{
+ if (sem != NULL) {
+ if (sem->semid > 0) {
+ sceKernelDeleteSema(sem->semid);
+ sem->semid = 0;
+ }
+
+ free(sem);
+ }
+}
+
+/* TODO: This routine is a bit overloaded.
+ * If the timeout is 0 then just poll the semaphore; if it's SDL_MUTEX_MAXWAIT, pass
+ * NULL to sceKernelWaitSema() so that it waits indefinitely; and if the timeout
+ * is specified, convert it to microseconds. */
+int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
+{
+ Uint32 *pTimeout;
+ int res;
+
+ if (sem == NULL) {
+ SDL_SetError("Passed a NULL sem");
+ return 0;
+ }
+
+ if (timeout == 0) {
+ res = sceKernelPollSema(sem->semid, 1);
+ if (res < 0) {
+ return SDL_MUTEX_TIMEDOUT;
+ }
+ return 0;
+ }
+
+ if (timeout == SDL_MUTEX_MAXWAIT) {
+ pTimeout = NULL;
+ } else {
+ timeout *= 1000; /* Convert to microseconds. */
+ pTimeout = &timeout;
+ }
+
+ res = sceKernelWaitSema(sem->semid, 1, pTimeout);
+ switch (res) {
+ case SCE_KERNEL_ERROR_OK:
+ return 0;
+ case SCE_KERNEL_ERROR_WAIT_TIMEOUT:
+ return SDL_MUTEX_TIMEDOUT;
+ default:
+ return SDL_SetError("sceKernelWaitSema() failed");
+ }
+}
+
+int SDL_SemTryWait(SDL_sem *sem)
+{
+ return SDL_SemWaitTimeout(sem, 0);
+}
+
+int SDL_SemWait(SDL_sem *sem)
+{
+ return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
+}
+
+/* Returns the current count of the semaphore */
+Uint32 SDL_SemValue(SDL_sem *sem)
+{
+ SceKernelSemaInfo info;
+
+ if (sem == NULL) {
+ SDL_SetError("Passed a NULL sem");
+ return 0;
+ }
+
+ if (sceKernelReferSemaStatus(sem->semid, &info) >= 0) {
+ return info.currentCount;
+ }
+
+ return 0;
+}
+
+int SDL_SemPost(SDL_sem *sem)
+{
+ int res;
+
+ if (sem == NULL) {
+ return SDL_SetError("Passed a NULL sem");
+ }
+
+ res = sceKernelSignalSema(sem->semid, 1);
+ if (res < 0) {
+ return SDL_SetError("sceKernelSignalSema() failed");
+ }
+
+ return 0;
+}
+
+#endif /* SDL_THREAD_PSP */
+
+/* vim: ts=4 sw=4
+ */
diff --git a/src/3rdparty/SDL2/src/thread/psp/SDL_systhread.c b/src/3rdparty/SDL2/src/thread/psp/SDL_systhread.c
new file mode 100644
index 0000000..9286be5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/psp/SDL_systhread.c
@@ -0,0 +1,112 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_PSP
+
+/* PSP thread management routines for SDL */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "SDL_error.h"
+#include "SDL_thread.h"
+#include "../SDL_systhread.h"
+#include "../SDL_thread_c.h"
+#include <pspkerneltypes.h>
+#include <pspthreadman.h>
+
+
+static int ThreadEntry(SceSize args, void *argp)
+{
+ SDL_RunThread(*(void **) argp);
+ return 0;
+}
+
+int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
+{
+ SceKernelThreadInfo status;
+ int priority = 32;
+
+ /* Set priority of new thread to the same as the current thread */
+ status.size = sizeof(SceKernelThreadInfo);
+ if (sceKernelReferThreadStatus(sceKernelGetThreadId(), &status) == 0) {
+ priority = status.currentPriority;
+ }
+
+ thread->handle = sceKernelCreateThread(thread->name, ThreadEntry,
+ priority, thread->stacksize ? ((int) thread->stacksize) : 0x8000,
+ PSP_THREAD_ATTR_VFPU, NULL);
+ if (thread->handle < 0) {
+ return SDL_SetError("sceKernelCreateThread() failed");
+ }
+
+ sceKernelStartThread(thread->handle, 4, &args);
+ return 0;
+}
+
+void SDL_SYS_SetupThread(const char *name)
+{
+ /* Do nothing. */
+}
+
+SDL_threadID SDL_ThreadID(void)
+{
+ return (SDL_threadID) sceKernelGetThreadId();
+}
+
+void SDL_SYS_WaitThread(SDL_Thread *thread)
+{
+ sceKernelWaitThreadEnd(thread->handle, NULL);
+ sceKernelDeleteThread(thread->handle);
+}
+
+void SDL_SYS_DetachThread(SDL_Thread *thread)
+{
+ /* !!! FIXME: is this correct? */
+ sceKernelDeleteThread(thread->handle);
+}
+
+void SDL_SYS_KillThread(SDL_Thread *thread)
+{
+ sceKernelTerminateDeleteThread(thread->handle);
+}
+
+int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
+{
+ int value;
+
+ if (priority == SDL_THREAD_PRIORITY_LOW) {
+ value = 19;
+ } else if (priority == SDL_THREAD_PRIORITY_HIGH) {
+ value = -20;
+ } else {
+ value = 0;
+ }
+
+ return sceKernelChangeThreadPriority(sceKernelGetThreadId(),value);
+
+}
+
+#endif /* SDL_THREAD_PSP */
+
+/* vim: ts=4 sw=4
+ */
diff --git a/src/3rdparty/SDL2/src/thread/psp/SDL_systhread_c.h b/src/3rdparty/SDL2/src/thread/psp/SDL_systhread_c.h
new file mode 100644
index 0000000..ea26f81
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/psp/SDL_systhread_c.h
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include <pspkerneltypes.h>
+
+typedef SceUID SYS_ThreadHandle;
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_syscond.c b/src/3rdparty/SDL2/src/thread/pthread/SDL_syscond.c
new file mode 100644
index 0000000..d235780
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_syscond.c
@@ -0,0 +1,158 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include "SDL_thread.h"
+#include "SDL_sysmutex_c.h"
+
+struct SDL_cond
+{
+ pthread_cond_t cond;
+};
+
+/* Create a condition variable */
+SDL_cond *
+SDL_CreateCond(void)
+{
+ SDL_cond *cond;
+
+ cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond));
+ if (cond) {
+ if (pthread_cond_init(&cond->cond, NULL) != 0) {
+ SDL_SetError("pthread_cond_init() failed");
+ SDL_free(cond);
+ cond = NULL;
+ }
+ }
+ return (cond);
+}
+
+/* Destroy a condition variable */
+void
+SDL_DestroyCond(SDL_cond * cond)
+{
+ if (cond) {
+ pthread_cond_destroy(&cond->cond);
+ SDL_free(cond);
+ }
+}
+
+/* Restart one of the threads that are waiting on the condition variable */
+int
+SDL_CondSignal(SDL_cond * cond)
+{
+ int retval;
+
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ retval = 0;
+ if (pthread_cond_signal(&cond->cond) != 0) {
+ return SDL_SetError("pthread_cond_signal() failed");
+ }
+ return retval;
+}
+
+/* Restart all threads that are waiting on the condition variable */
+int
+SDL_CondBroadcast(SDL_cond * cond)
+{
+ int retval;
+
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+ retval = 0;
+ if (pthread_cond_broadcast(&cond->cond) != 0) {
+ return SDL_SetError("pthread_cond_broadcast() failed");
+ }
+ return retval;
+}
+
+int
+SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
+{
+ int retval;
+#ifndef HAVE_CLOCK_GETTIME
+ struct timeval delta;
+#endif
+ struct timespec abstime;
+
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ }
+
+#ifdef HAVE_CLOCK_GETTIME
+ clock_gettime(CLOCK_REALTIME, &abstime);
+
+ abstime.tv_nsec += (ms % 1000) * 1000000;
+ abstime.tv_sec += ms / 1000;
+#else
+ gettimeofday(&delta, NULL);
+
+ abstime.tv_sec = delta.tv_sec + (ms / 1000);
+ abstime.tv_nsec = (delta.tv_usec + (ms % 1000) * 1000) * 1000;
+#endif
+ if (abstime.tv_nsec > 1000000000) {
+ abstime.tv_sec += 1;
+ abstime.tv_nsec -= 1000000000;
+ }
+
+ tryagain:
+ retval = pthread_cond_timedwait(&cond->cond, &mutex->id, &abstime);
+ switch (retval) {
+ case EINTR:
+ goto tryagain;
+ /* break; -Wunreachable-code-break */
+ case ETIMEDOUT:
+ retval = SDL_MUTEX_TIMEDOUT;
+ break;
+ case 0:
+ break;
+ default:
+ retval = SDL_SetError("pthread_cond_timedwait() failed");
+ }
+ return retval;
+}
+
+/* Wait on the condition variable, unlocking the provided mutex.
+ The mutex must be locked before entering this function!
+ */
+int
+SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
+{
+ if (!cond) {
+ return SDL_SetError("Passed a NULL condition variable");
+ } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) {
+ return SDL_SetError("pthread_cond_wait() failed");
+ }
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex.c b/src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex.c
new file mode 100644
index 0000000..e7b5b5c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex.c
@@ -0,0 +1,192 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include <errno.h>
+#include <pthread.h>
+
+#include "SDL_thread.h"
+
+#if !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX && \
+ !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
+#define FAKE_RECURSIVE_MUTEX 1
+#endif
+
+struct SDL_mutex
+{
+ pthread_mutex_t id;
+#if FAKE_RECURSIVE_MUTEX
+ int recursive;
+ pthread_t owner;
+#endif
+};
+
+SDL_mutex *
+SDL_CreateMutex(void)
+{
+ SDL_mutex *mutex;
+ pthread_mutexattr_t attr;
+
+ /* Allocate the structure */
+ mutex = (SDL_mutex *) SDL_calloc(1, sizeof(*mutex));
+ if (mutex) {
+ pthread_mutexattr_init(&attr);
+#if SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+#elif SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
+ pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+#else
+ /* No extra attributes necessary */
+#endif
+ if (pthread_mutex_init(&mutex->id, &attr) != 0) {
+ SDL_SetError("pthread_mutex_init() failed");
+ SDL_free(mutex);
+ mutex = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return (mutex);
+}
+
+void
+SDL_DestroyMutex(SDL_mutex * mutex)
+{
+ if (mutex) {
+ pthread_mutex_destroy(&mutex->id);
+ SDL_free(mutex);
+ }
+}
+
+/* Lock the mutex */
+int
+SDL_LockMutex(SDL_mutex * mutex)
+{
+#if FAKE_RECURSIVE_MUTEX
+ pthread_t this_thread;
+#endif
+
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+#if FAKE_RECURSIVE_MUTEX
+ this_thread = pthread_self();
+ if (mutex->owner == this_thread) {
+ ++mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ We set the locking thread id after we obtain the lock
+ so unlocks from other threads will fail.
+ */
+ if (pthread_mutex_lock(&mutex->id) == 0) {
+ mutex->owner = this_thread;
+ mutex->recursive = 0;
+ } else {
+ return SDL_SetError("pthread_mutex_lock() failed");
+ }
+ }
+#else
+ if (pthread_mutex_lock(&mutex->id) != 0) {
+ return SDL_SetError("pthread_mutex_lock() failed");
+ }
+#endif
+ return 0;
+}
+
+int
+SDL_TryLockMutex(SDL_mutex * mutex)
+{
+ int retval;
+#if FAKE_RECURSIVE_MUTEX
+ pthread_t this_thread;
+#endif
+
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ retval = 0;
+#if FAKE_RECURSIVE_MUTEX
+ this_thread = pthread_self();
+ if (mutex->owner == this_thread) {
+ ++mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ We set the locking thread id after we obtain the lock
+ so unlocks from other threads will fail.
+ */
+ if (pthread_mutex_trylock(&mutex->id) == 0) {
+ mutex->owner = this_thread;
+ mutex->recursive = 0;
+ } else if (errno == EBUSY) {
+ retval = SDL_MUTEX_TIMEDOUT;
+ } else {
+ retval = SDL_SetError("pthread_mutex_trylock() failed");
+ }
+ }
+#else
+ if (pthread_mutex_trylock(&mutex->id) != 0) {
+ if (errno == EBUSY) {
+ retval = SDL_MUTEX_TIMEDOUT;
+ } else {
+ retval = SDL_SetError("pthread_mutex_trylock() failed");
+ }
+ }
+#endif
+ return retval;
+}
+
+int
+SDL_UnlockMutex(SDL_mutex * mutex)
+{
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+#if FAKE_RECURSIVE_MUTEX
+ /* We can only unlock the mutex if we own it */
+ if (pthread_self() == mutex->owner) {
+ if (mutex->recursive) {
+ --mutex->recursive;
+ } else {
+ /* The order of operations is important.
+ First reset the owner so another thread doesn't lock
+ the mutex and set the ownership before we reset it,
+ then release the lock semaphore.
+ */
+ mutex->owner = 0;
+ pthread_mutex_unlock(&mutex->id);
+ }
+ } else {
+ return SDL_SetError("mutex not owned by this thread");
+ }
+
+#else
+ if (pthread_mutex_unlock(&mutex->id) != 0) {
+ return SDL_SetError("pthread_mutex_unlock() failed");
+ }
+#endif /* FAKE_RECURSIVE_MUTEX */
+
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex_c.h b/src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex_c.h
new file mode 100644
index 0000000..27ac1da
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_sysmutex_c.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_mutex_c_h_
+#define SDL_mutex_c_h_
+
+struct SDL_mutex
+{
+ pthread_mutex_t id;
+};
+
+#endif /* SDL_mutex_c_h_ */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_syssem.c b/src/3rdparty/SDL2/src/thread/pthread/SDL_syssem.c
new file mode 100644
index 0000000..bdebf13
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_syssem.c
@@ -0,0 +1,209 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <sys/time.h>
+#include <time.h>
+
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+
+/* Wrapper around POSIX 1003.1b semaphores */
+
+#if defined(__MACOSX__) || defined(__IPHONEOS__)
+/* Mac OS X doesn't support sem_getvalue() as of version 10.4 */
+#include "../generic/SDL_syssem.c"
+#else
+
+struct SDL_semaphore
+{
+ sem_t sem;
+};
+
+/* Create a semaphore, initialized with value */
+SDL_sem *
+SDL_CreateSemaphore(Uint32 initial_value)
+{
+ SDL_sem *sem = (SDL_sem *) SDL_malloc(sizeof(SDL_sem));
+ if (sem) {
+ if (sem_init(&sem->sem, 0, initial_value) < 0) {
+ SDL_SetError("sem_init() failed");
+ SDL_free(sem);
+ sem = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return sem;
+}
+
+void
+SDL_DestroySemaphore(SDL_sem * sem)
+{
+ if (sem) {
+ sem_destroy(&sem->sem);
+ SDL_free(sem);
+ }
+}
+
+int
+SDL_SemTryWait(SDL_sem * sem)
+{
+ int retval;
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+ retval = SDL_MUTEX_TIMEDOUT;
+ if (sem_trywait(&sem->sem) == 0) {
+ retval = 0;
+ }
+ return retval;
+}
+
+int
+SDL_SemWait(SDL_sem * sem)
+{
+ int retval;
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+
+ do {
+ retval = sem_wait(&sem->sem);
+ } while (retval < 0 && errno == EINTR);
+
+ if (retval < 0) {
+ retval = SDL_SetError("sem_wait() failed");
+ }
+ return retval;
+}
+
+int
+SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
+{
+ int retval;
+#ifdef HAVE_SEM_TIMEDWAIT
+#ifndef HAVE_CLOCK_GETTIME
+ struct timeval now;
+#endif
+ struct timespec ts_timeout;
+#else
+ Uint32 end;
+#endif
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+
+ /* Try the easy cases first */
+ if (timeout == 0) {
+ return SDL_SemTryWait(sem);
+ }
+ if (timeout == SDL_MUTEX_MAXWAIT) {
+ return SDL_SemWait(sem);
+ }
+
+#ifdef HAVE_SEM_TIMEDWAIT
+ /* Setup the timeout. sem_timedwait doesn't wait for
+ * a lapse of time, but until we reach a certain time.
+ * This time is now plus the timeout.
+ */
+#ifdef HAVE_CLOCK_GETTIME
+ clock_gettime(CLOCK_REALTIME, &ts_timeout);
+
+ /* Add our timeout to current time */
+ ts_timeout.tv_nsec += (timeout % 1000) * 1000000;
+ ts_timeout.tv_sec += timeout / 1000;
+#else
+ gettimeofday(&now, NULL);
+
+ /* Add our timeout to current time */
+ ts_timeout.tv_sec = now.tv_sec + (timeout / 1000);
+ ts_timeout.tv_nsec = (now.tv_usec + (timeout % 1000) * 1000) * 1000;
+#endif
+
+ /* Wrap the second if needed */
+ if (ts_timeout.tv_nsec > 1000000000) {
+ ts_timeout.tv_sec += 1;
+ ts_timeout.tv_nsec -= 1000000000;
+ }
+
+ /* Wait. */
+ do {
+ retval = sem_timedwait(&sem->sem, &ts_timeout);
+ } while (retval < 0 && errno == EINTR);
+
+ if (retval < 0) {
+ if (errno == ETIMEDOUT) {
+ retval = SDL_MUTEX_TIMEDOUT;
+ } else {
+ SDL_SetError("sem_timedwait returned an error: %s", strerror(errno));
+ }
+ }
+#else
+ end = SDL_GetTicks() + timeout;
+ while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {
+ if (SDL_TICKS_PASSED(SDL_GetTicks(), end)) {
+ break;
+ }
+ SDL_Delay(1);
+ }
+#endif /* HAVE_SEM_TIMEDWAIT */
+
+ return retval;
+}
+
+Uint32
+SDL_SemValue(SDL_sem * sem)
+{
+ int ret = 0;
+ if (sem) {
+ sem_getvalue(&sem->sem, &ret);
+ if (ret < 0) {
+ ret = 0;
+ }
+ }
+ return (Uint32) ret;
+}
+
+int
+SDL_SemPost(SDL_sem * sem)
+{
+ int retval;
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL semaphore");
+ }
+
+ retval = sem_post(&sem->sem);
+ if (retval < 0) {
+ SDL_SetError("sem_post() failed");
+ }
+ return retval;
+}
+
+#endif /* __MACOSX__ */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_systhread.c b/src/3rdparty/SDL2/src/thread/pthread/SDL_systhread.c
new file mode 100644
index 0000000..0354840
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_systhread.c
@@ -0,0 +1,246 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#include <pthread.h>
+
+#if HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+
+#include <signal.h>
+
+#ifdef __LINUX__
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#endif /* __LINUX__ */
+
+#if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)
+#include <dlfcn.h>
+#ifndef RTLD_DEFAULT
+#define RTLD_DEFAULT NULL
+#endif
+#endif
+
+#include "SDL_platform.h"
+#include "SDL_thread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
+#ifdef __ANDROID__
+#include "../../core/android/SDL_android.h"
+#endif
+
+#ifdef __HAIKU__
+#include <kernel/OS.h>
+#endif
+
+#include "SDL_assert.h"
+
+#ifndef __NACL__
+/* List of signals to mask in the subthreads */
+static const int sig_list[] = {
+ SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
+ SIGVTALRM, SIGPROF, 0
+};
+#endif
+
+static void *
+RunThread(void *data)
+{
+#ifdef __ANDROID__
+ Android_JNI_SetupThread();
+#endif
+ SDL_RunThread(data);
+ return NULL;
+}
+
+#if defined(__MACOSX__) || defined(__IPHONEOS__)
+static SDL_bool checked_setname = SDL_FALSE;
+static int (*ppthread_setname_np)(const char*) = NULL;
+#elif defined(__LINUX__)
+static SDL_bool checked_setname = SDL_FALSE;
+static int (*ppthread_setname_np)(pthread_t, const char*) = NULL;
+#endif
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
+{
+ pthread_attr_t type;
+
+ /* do this here before any threads exist, so there's no race condition. */
+ #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
+ if (!checked_setname) {
+ void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
+ #if defined(__MACOSX__) || defined(__IPHONEOS__)
+ ppthread_setname_np = (int(*)(const char*)) fn;
+ #elif defined(__LINUX__)
+ ppthread_setname_np = (int(*)(pthread_t, const char*)) fn;
+ #endif
+ checked_setname = SDL_TRUE;
+ }
+ #endif
+
+ /* Set the thread attributes */
+ if (pthread_attr_init(&type) != 0) {
+ return SDL_SetError("Couldn't initialize pthread attributes");
+ }
+ pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
+
+ /* Set caller-requested stack size. Otherwise: use the system default. */
+ if (thread->stacksize) {
+ pthread_attr_setstacksize(&type, (size_t) thread->stacksize);
+ }
+
+ /* Create the thread and go! */
+ if (pthread_create(&thread->handle, &type, RunThread, args) != 0) {
+ return SDL_SetError("Not enough resources to create thread");
+ }
+
+ return 0;
+}
+
+void
+SDL_SYS_SetupThread(const char *name)
+{
+#if !defined(__NACL__)
+ int i;
+ sigset_t mask;
+#endif /* !__NACL__ */
+
+ if (name != NULL) {
+ #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
+ SDL_assert(checked_setname);
+ if (ppthread_setname_np != NULL) {
+ #if defined(__MACOSX__) || defined(__IPHONEOS__)
+ ppthread_setname_np(name);
+ #elif defined(__LINUX__)
+ ppthread_setname_np(pthread_self(), name);
+ #endif
+ }
+ #elif HAVE_PTHREAD_SETNAME_NP
+ #if defined(__NETBSD__)
+ pthread_setname_np(pthread_self(), "%s", name);
+ #else
+ pthread_setname_np(pthread_self(), name);
+ #endif
+ #elif HAVE_PTHREAD_SET_NAME_NP
+ pthread_set_name_np(pthread_self(), name);
+ #elif defined(__HAIKU__)
+ /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
+ char namebuf[B_OS_NAME_LENGTH];
+ SDL_snprintf(namebuf, sizeof (namebuf), "%s", name);
+ namebuf[sizeof (namebuf) - 1] = '\0';
+ rename_thread(find_thread(NULL), namebuf);
+ #endif
+ }
+
+ /* NativeClient does not yet support signals.*/
+#if !defined(__NACL__)
+ /* Mask asynchronous signals for this thread */
+ sigemptyset(&mask);
+ for (i = 0; sig_list[i]; ++i) {
+ sigaddset(&mask, sig_list[i]);
+ }
+ pthread_sigmask(SIG_BLOCK, &mask, 0);
+#endif /* !__NACL__ */
+
+
+#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
+ /* Allow ourselves to be asynchronously cancelled */
+ {
+ int oldstate;
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate);
+ }
+#endif
+}
+
+SDL_threadID
+SDL_ThreadID(void)
+{
+ return ((SDL_threadID) pthread_self());
+}
+
+int
+SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
+{
+#if __NACL__
+ /* FIXME: Setting thread priority does not seem to be supported in NACL */
+ return 0;
+#elif __LINUX__
+ int value;
+
+ if (priority == SDL_THREAD_PRIORITY_LOW) {
+ value = 19;
+ } else if (priority == SDL_THREAD_PRIORITY_HIGH) {
+ value = -20;
+ } else {
+ value = 0;
+ }
+ if (setpriority(PRIO_PROCESS, syscall(SYS_gettid), value) < 0) {
+ /* Note that this fails if you're trying to set high priority
+ and you don't have root permission. BUT DON'T RUN AS ROOT!
+
+ You can grant the ability to increase thread priority by
+ running the following command on your application binary:
+ sudo setcap 'cap_sys_nice=eip' <application>
+ */
+ return SDL_SetError("setpriority() failed");
+ }
+ return 0;
+#else
+ struct sched_param sched;
+ int policy;
+ pthread_t thread = pthread_self();
+
+ if (pthread_getschedparam(thread, &policy, &sched) != 0) {
+ return SDL_SetError("pthread_getschedparam() failed");
+ }
+ if (priority == SDL_THREAD_PRIORITY_LOW) {
+ sched.sched_priority = sched_get_priority_min(policy);
+ } else if (priority == SDL_THREAD_PRIORITY_HIGH) {
+ sched.sched_priority = sched_get_priority_max(policy);
+ } else {
+ int min_priority = sched_get_priority_min(policy);
+ int max_priority = sched_get_priority_max(policy);
+ sched.sched_priority = (min_priority + (max_priority - min_priority) / 2);
+ }
+ if (pthread_setschedparam(thread, policy, &sched) != 0) {
+ return SDL_SetError("pthread_setschedparam() failed");
+ }
+ return 0;
+#endif /* linux */
+}
+
+void
+SDL_SYS_WaitThread(SDL_Thread * thread)
+{
+ pthread_join(thread->handle, 0);
+}
+
+void
+SDL_SYS_DetachThread(SDL_Thread * thread)
+{
+ pthread_detach(thread->handle);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_systhread_c.h b/src/3rdparty/SDL2/src/thread/pthread/SDL_systhread_c.h
new file mode 100644
index 0000000..898c219
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_systhread_c.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include <pthread.h>
+
+typedef pthread_t SYS_ThreadHandle;
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/pthread/SDL_systls.c b/src/3rdparty/SDL2/src/thread/pthread/SDL_systls.c
new file mode 100644
index 0000000..c580595
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/pthread/SDL_systls.c
@@ -0,0 +1,70 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "SDL_thread.h"
+#include "../SDL_systhread.h"
+#include "../SDL_thread_c.h"
+
+#include <pthread.h>
+
+
+#define INVALID_PTHREAD_KEY ((pthread_key_t)-1)
+
+static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY;
+static SDL_bool generic_local_storage = SDL_FALSE;
+
+SDL_TLSData *
+SDL_SYS_GetTLSData(void)
+{
+ if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) {
+ static SDL_SpinLock lock;
+ SDL_AtomicLock(&lock);
+ if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) {
+ pthread_key_t storage;
+ if (pthread_key_create(&storage, NULL) == 0) {
+ SDL_MemoryBarrierRelease();
+ thread_local_storage = storage;
+ } else {
+ generic_local_storage = SDL_TRUE;
+ }
+ }
+ SDL_AtomicUnlock(&lock);
+ }
+ if (generic_local_storage) {
+ return SDL_Generic_GetTLSData();
+ }
+ SDL_MemoryBarrierAcquire();
+ return (SDL_TLSData *)pthread_getspecific(thread_local_storage);
+}
+
+int
+SDL_SYS_SetTLSData(SDL_TLSData *data)
+{
+ if (generic_local_storage) {
+ return SDL_Generic_SetTLSData(data);
+ }
+ if (pthread_setspecific(thread_local_storage, data) != 0) {
+ return SDL_SetError("pthread_setspecific() failed");
+ }
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/stdcpp/SDL_syscond.cpp b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_syscond.cpp
new file mode 100644
index 0000000..32c7c4b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_syscond.cpp
@@ -0,0 +1,164 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+extern "C" {
+#include "SDL_thread.h"
+}
+
+#include <chrono>
+#include <condition_variable>
+#include <ratio>
+#include <system_error>
+
+#include "SDL_sysmutex_c.h"
+
+struct SDL_cond
+{
+ std::condition_variable_any cpp_cond;
+};
+
+/* Create a condition variable */
+extern "C"
+SDL_cond *
+SDL_CreateCond(void)
+{
+ /* Allocate and initialize the condition variable */
+ try {
+ SDL_cond * cond = new SDL_cond;
+ return cond;
+ } catch (std::system_error & ex) {
+ SDL_SetError("unable to create a C++ condition variable: code=%d; %s", ex.code(), ex.what());
+ return NULL;
+ } catch (std::bad_alloc &) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+}
+
+/* Destroy a condition variable */
+extern "C"
+void
+SDL_DestroyCond(SDL_cond * cond)
+{
+ if (cond) {
+ delete cond;
+ }
+}
+
+/* Restart one of the threads that are waiting on the condition variable */
+extern "C"
+int
+SDL_CondSignal(SDL_cond * cond)
+{
+ if (!cond) {
+ SDL_SetError("Passed a NULL condition variable");
+ return -1;
+ }
+
+ cond->cpp_cond.notify_one();
+ return 0;
+}
+
+/* Restart all threads that are waiting on the condition variable */
+extern "C"
+int
+SDL_CondBroadcast(SDL_cond * cond)
+{
+ if (!cond) {
+ SDL_SetError("Passed a NULL condition variable");
+ return -1;
+ }
+
+ cond->cpp_cond.notify_all();
+ return 0;
+}
+
+/* Wait on the condition variable for at most 'ms' milliseconds.
+ The mutex must be locked before entering this function!
+ The mutex is unlocked during the wait, and locked again after the wait.
+
+Typical use:
+
+Thread A:
+ SDL_LockMutex(lock);
+ while ( ! condition ) {
+ SDL_CondWait(cond, lock);
+ }
+ SDL_UnlockMutex(lock);
+
+Thread B:
+ SDL_LockMutex(lock);
+ ...
+ condition = true;
+ ...
+ SDL_CondSignal(cond);
+ SDL_UnlockMutex(lock);
+ */
+extern "C"
+int
+SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
+{
+ if (!cond) {
+ SDL_SetError("Passed a NULL condition variable");
+ return -1;
+ }
+
+ if (!mutex) {
+ SDL_SetError("Passed a NULL mutex variable");
+ return -1;
+ }
+
+ try {
+ std::unique_lock<std::recursive_mutex> cpp_lock(mutex->cpp_mutex, std::adopt_lock_t());
+ if (ms == SDL_MUTEX_MAXWAIT) {
+ cond->cpp_cond.wait(
+ cpp_lock
+ );
+ cpp_lock.release();
+ return 0;
+ } else {
+ auto wait_result = cond->cpp_cond.wait_for(
+ cpp_lock,
+ std::chrono::duration<Uint32, std::milli>(ms)
+ );
+ cpp_lock.release();
+ if (wait_result == std::cv_status::timeout) {
+ return SDL_MUTEX_TIMEDOUT;
+ } else {
+ return 0;
+ }
+ }
+ } catch (std::system_error & ex) {
+ SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what());
+ return -1;
+ }
+}
+
+/* Wait on the condition variable forever */
+extern "C"
+int
+SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
+{
+ return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp
new file mode 100644
index 0000000..667d36b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp
@@ -0,0 +1,111 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+extern "C" {
+#include "SDL_thread.h"
+#include "SDL_systhread_c.h"
+#include "SDL_log.h"
+}
+
+#include <system_error>
+
+#include "SDL_sysmutex_c.h"
+#include <Windows.h>
+
+
+/* Create a mutex */
+extern "C"
+SDL_mutex *
+SDL_CreateMutex(void)
+{
+ /* Allocate and initialize the mutex */
+ try {
+ SDL_mutex * mutex = new SDL_mutex;
+ return mutex;
+ } catch (std::system_error & ex) {
+ SDL_SetError("unable to create a C++ mutex: code=%d; %s", ex.code(), ex.what());
+ return NULL;
+ } catch (std::bad_alloc &) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+}
+
+/* Free the mutex */
+extern "C"
+void
+SDL_DestroyMutex(SDL_mutex * mutex)
+{
+ if (mutex) {
+ delete mutex;
+ }
+}
+
+/* Lock the semaphore */
+extern "C"
+int
+SDL_mutexP(SDL_mutex * mutex)
+{
+ if (mutex == NULL) {
+ SDL_SetError("Passed a NULL mutex");
+ return -1;
+ }
+
+ try {
+ mutex->cpp_mutex.lock();
+ return 0;
+ } catch (std::system_error & ex) {
+ SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what());
+ return -1;
+ }
+}
+
+/* TryLock the mutex */
+int
+SDL_TryLockMutex(SDL_mutex * mutex)
+{
+ int retval = 0;
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ if (mutex->cpp_mutex.try_lock() == false) {
+ retval = SDL_MUTEX_TIMEDOUT;
+ }
+ return retval;
+}
+
+/* Unlock the mutex */
+extern "C"
+int
+SDL_mutexV(SDL_mutex * mutex)
+{
+ if (mutex == NULL) {
+ SDL_SetError("Passed a NULL mutex");
+ return -1;
+ }
+
+ mutex->cpp_mutex.unlock();
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h
new file mode 100644
index 0000000..000288f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#include <mutex>
+
+struct SDL_mutex
+{
+ std::recursive_mutex cpp_mutex;
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread.cpp b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread.cpp
new file mode 100644
index 0000000..3020f1c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread.cpp
@@ -0,0 +1,168 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* Thread management routines for SDL */
+
+extern "C" {
+#include "SDL_thread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
+#include "SDL_log.h"
+}
+
+#include <mutex>
+#include <thread>
+#include <system_error>
+
+#ifdef __WINRT__
+#include <Windows.h>
+#endif
+
+static void
+RunThread(void *args)
+{
+ SDL_RunThread(args);
+}
+
+extern "C"
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
+{
+ try {
+ // !!! FIXME: no way to set a thread stack size here.
+ std::thread cpp_thread(RunThread, args);
+ thread->handle = (void *) new std::thread(std::move(cpp_thread));
+ return 0;
+ } catch (std::system_error & ex) {
+ SDL_SetError("unable to start a C++ thread: code=%d; %s", ex.code(), ex.what());
+ return -1;
+ } catch (std::bad_alloc &) {
+ SDL_OutOfMemory();
+ return -1;
+ }
+}
+
+extern "C"
+void
+SDL_SYS_SetupThread(const char *name)
+{
+ // Make sure a thread ID gets assigned ASAP, for debugging purposes:
+ SDL_ThreadID();
+ return;
+}
+
+extern "C"
+SDL_threadID
+SDL_ThreadID(void)
+{
+#ifdef __WINRT__
+ return GetCurrentThreadId();
+#else
+ // HACK: Mimick a thread ID, if one isn't otherwise available.
+ static thread_local SDL_threadID current_thread_id = 0;
+ static SDL_threadID next_thread_id = 1;
+ static std::mutex next_thread_id_mutex;
+
+ if (current_thread_id == 0) {
+ std::lock_guard<std::mutex> lock(next_thread_id_mutex);
+ current_thread_id = next_thread_id;
+ ++next_thread_id;
+ }
+
+ return current_thread_id;
+#endif
+}
+
+extern "C"
+int
+SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
+{
+ // Thread priorities do not look to be settable via C++11's thread
+ // interface, at least as of this writing (Nov 2012). std::thread does
+ // provide access to the OS' native handle, however, and some form of
+ // priority-setting could, in theory, be done through this interface.
+ //
+ // WinRT: UPDATE (Aug 20, 2013): thread priorities cannot be changed
+ // on WinRT, at least not for any thread that's already been created.
+ // WinRT threads appear to be based off of the WinRT class,
+ // ThreadPool, more info on which can be found at:
+ // http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.threading.threadpool.aspx
+ //
+ // For compatibility sake, 0 will be returned here.
+ return (0);
+}
+
+extern "C"
+void
+SDL_SYS_WaitThread(SDL_Thread * thread)
+{
+ if ( ! thread) {
+ return;
+ }
+
+ try {
+ std::thread * cpp_thread = (std::thread *) thread->handle;
+ if (cpp_thread->joinable()) {
+ cpp_thread->join();
+ }
+ } catch (std::system_error &) {
+ // An error occurred when joining the thread. SDL_WaitThread does not,
+ // however, seem to provide a means to report errors to its callers
+ // though!
+ }
+}
+
+extern "C"
+void
+SDL_SYS_DetachThread(SDL_Thread * thread)
+{
+ if ( ! thread) {
+ return;
+ }
+
+ try {
+ std::thread * cpp_thread = (std::thread *) thread->handle;
+ if (cpp_thread->joinable()) {
+ cpp_thread->detach();
+ }
+ } catch (std::system_error &) {
+ // An error occurred when detaching the thread. SDL_DetachThread does not,
+ // however, seem to provide a means to report errors to its callers
+ // though!
+ }
+}
+
+extern "C"
+SDL_TLSData *
+SDL_SYS_GetTLSData(void)
+{
+ return SDL_Generic_GetTLSData();
+}
+
+extern "C"
+int
+SDL_SYS_SetTLSData(SDL_TLSData *data)
+{
+ return SDL_Generic_SetTLSData(data);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread_c.h b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread_c.h
new file mode 100644
index 0000000..ee4764d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/stdcpp/SDL_systhread_c.h
@@ -0,0 +1,26 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+/* For a thread handle, use a void pointer to a std::thread */
+typedef void * SYS_ThreadHandle;
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/windows/SDL_sysmutex.c b/src/3rdparty/SDL2/src/thread/windows/SDL_sysmutex.c
new file mode 100644
index 0000000..119e62b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/windows/SDL_sysmutex.c
@@ -0,0 +1,110 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_WINDOWS
+
+/* Mutex functions using the Win32 API */
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_mutex.h"
+
+
+struct SDL_mutex
+{
+ CRITICAL_SECTION cs;
+};
+
+/* Create a mutex */
+SDL_mutex *
+SDL_CreateMutex(void)
+{
+ SDL_mutex *mutex;
+
+ /* Allocate mutex memory */
+ mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
+ if (mutex) {
+ /* Initialize */
+ /* On SMP systems, a non-zero spin count generally helps performance */
+#if __WINRT__
+ InitializeCriticalSectionEx(&mutex->cs, 2000, 0);
+#else
+ InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
+#endif
+ } else {
+ SDL_OutOfMemory();
+ }
+ return (mutex);
+}
+
+/* Free the mutex */
+void
+SDL_DestroyMutex(SDL_mutex * mutex)
+{
+ if (mutex) {
+ DeleteCriticalSection(&mutex->cs);
+ SDL_free(mutex);
+ }
+}
+
+/* Lock the mutex */
+int
+SDL_LockMutex(SDL_mutex * mutex)
+{
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ EnterCriticalSection(&mutex->cs);
+ return (0);
+}
+
+/* TryLock the mutex */
+int
+SDL_TryLockMutex(SDL_mutex * mutex)
+{
+ int retval = 0;
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ if (TryEnterCriticalSection(&mutex->cs) == 0) {
+ retval = SDL_MUTEX_TIMEDOUT;
+ }
+ return retval;
+}
+
+/* Unlock the mutex */
+int
+SDL_UnlockMutex(SDL_mutex * mutex)
+{
+ if (mutex == NULL) {
+ return SDL_SetError("Passed a NULL mutex");
+ }
+
+ LeaveCriticalSection(&mutex->cs);
+ return (0);
+}
+
+#endif /* SDL_THREAD_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/windows/SDL_syssem.c b/src/3rdparty/SDL2/src/thread/windows/SDL_syssem.c
new file mode 100644
index 0000000..dcb36fa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/windows/SDL_syssem.c
@@ -0,0 +1,152 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_WINDOWS
+
+/* Semaphore functions using the Win32 API */
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_thread.h"
+
+struct SDL_semaphore
+{
+ HANDLE id;
+ LONG count;
+};
+
+
+/* Create a semaphore */
+SDL_sem *
+SDL_CreateSemaphore(Uint32 initial_value)
+{
+ SDL_sem *sem;
+
+ /* Allocate sem memory */
+ sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
+ if (sem) {
+ /* Create the semaphore, with max value 32K */
+#if __WINRT__
+ sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
+#else
+ sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
+#endif
+ sem->count = initial_value;
+ if (!sem->id) {
+ SDL_SetError("Couldn't create semaphore");
+ SDL_free(sem);
+ sem = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return (sem);
+}
+
+/* Free the semaphore */
+void
+SDL_DestroySemaphore(SDL_sem * sem)
+{
+ if (sem) {
+ if (sem->id) {
+ CloseHandle(sem->id);
+ sem->id = 0;
+ }
+ SDL_free(sem);
+ }
+}
+
+int
+SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
+{
+ int retval;
+ DWORD dwMilliseconds;
+
+ if (!sem) {
+ return SDL_SetError("Passed a NULL sem");
+ }
+
+ if (timeout == SDL_MUTEX_MAXWAIT) {
+ dwMilliseconds = INFINITE;
+ } else {
+ dwMilliseconds = (DWORD) timeout;
+ }
+ switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) {
+ case WAIT_OBJECT_0:
+ InterlockedDecrement(&sem->count);
+ retval = 0;
+ break;
+ case WAIT_TIMEOUT:
+ retval = SDL_MUTEX_TIMEDOUT;
+ break;
+ default:
+ retval = SDL_SetError("WaitForSingleObject() failed");
+ break;
+ }
+ return retval;
+}
+
+int
+SDL_SemTryWait(SDL_sem * sem)
+{
+ return SDL_SemWaitTimeout(sem, 0);
+}
+
+int
+SDL_SemWait(SDL_sem * sem)
+{
+ return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
+}
+
+/* Returns the current count of the semaphore */
+Uint32
+SDL_SemValue(SDL_sem * sem)
+{
+ if (!sem) {
+ SDL_SetError("Passed a NULL sem");
+ return 0;
+ }
+ return (Uint32)sem->count;
+}
+
+int
+SDL_SemPost(SDL_sem * sem)
+{
+ if (!sem) {
+ return SDL_SetError("Passed a NULL sem");
+ }
+ /* Increase the counter in the first place, because
+ * after a successful release the semaphore may
+ * immediately get destroyed by another thread which
+ * is waiting for this semaphore.
+ */
+ InterlockedIncrement(&sem->count);
+ if (ReleaseSemaphore(sem->id, 1, NULL) == FALSE) {
+ InterlockedDecrement(&sem->count); /* restore */
+ return SDL_SetError("ReleaseSemaphore() failed");
+ }
+ return 0;
+}
+
+#endif /* SDL_THREAD_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/windows/SDL_systhread.c b/src/3rdparty/SDL2/src/thread/windows/SDL_systhread.c
new file mode 100644
index 0000000..90036c9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/windows/SDL_systhread.c
@@ -0,0 +1,258 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_WINDOWS
+
+/* Win32 thread management routines for SDL */
+
+#include "SDL_hints.h"
+#include "SDL_thread.h"
+#include "../SDL_thread_c.h"
+#include "../SDL_systhread.h"
+#include "SDL_systhread_c.h"
+
+#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+/* We'll use the C library from this DLL */
+#include <process.h>
+
+#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
+#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000
+#endif
+
+/* Cygwin gcc-3 ... MingW64 (even with a i386 host) does this like MSVC. */
+#if (defined(__MINGW32__) && (__GNUC__ < 4))
+typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
+ unsigned (__stdcall *func)(void *), void *arg,
+ unsigned, unsigned *threadID);
+typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
+
+#elif defined(__WATCOMC__)
+/* This is for Watcom targets except OS2 */
+#if __WATCOMC__ < 1240
+#define __watcall
+#endif
+typedef unsigned long (__watcall * pfnSDL_CurrentBeginThread) (void *,
+ unsigned,
+ unsigned
+ (__stdcall *
+ func) (void
+ *),
+ void *arg,
+ unsigned,
+ unsigned
+ *threadID);
+typedef void (__watcall * pfnSDL_CurrentEndThread) (unsigned code);
+
+#else
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
+ unsigned (__stdcall *
+ func) (void
+ *),
+ void *arg, unsigned,
+ unsigned *threadID);
+typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
+#endif
+#endif /* !SDL_PASSED_BEGINTHREAD_ENDTHREAD */
+
+
+typedef struct ThreadStartParms
+{
+ void *args;
+ pfnSDL_CurrentEndThread pfnCurrentEndThread;
+} tThreadStartParms, *pThreadStartParms;
+
+static DWORD
+RunThread(void *data)
+{
+ pThreadStartParms pThreadParms = (pThreadStartParms) data;
+ pfnSDL_CurrentEndThread pfnEndThread = pThreadParms->pfnCurrentEndThread;
+ void *args = pThreadParms->args;
+ SDL_free(pThreadParms);
+ SDL_RunThread(args);
+ if (pfnEndThread != NULL)
+ pfnEndThread(0);
+ return (0);
+}
+
+static DWORD WINAPI
+RunThreadViaCreateThread(LPVOID data)
+{
+ return RunThread(data);
+}
+
+static unsigned __stdcall
+RunThreadViaBeginThreadEx(void *data)
+{
+ return (unsigned) RunThread(data);
+}
+
+#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread)
+{
+#elif defined(__CYGWIN__) || defined(__WINRT__)
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
+{
+ pfnSDL_CurrentBeginThread pfnBeginThread = NULL;
+ pfnSDL_CurrentEndThread pfnEndThread = NULL;
+#else
+int
+SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
+{
+ pfnSDL_CurrentBeginThread pfnBeginThread = (pfnSDL_CurrentBeginThread)_beginthreadex;
+ pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread)_endthreadex;
+#endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
+ pThreadStartParms pThreadParms =
+ (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms));
+ const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0;
+ if (!pThreadParms) {
+ return SDL_OutOfMemory();
+ }
+ /* Save the function which we will have to call to clear the RTL of calling app! */
+ pThreadParms->pfnCurrentEndThread = pfnEndThread;
+ /* Also save the real parameters we have to pass to thread function */
+ pThreadParms->args = args;
+
+ /* thread->stacksize == 0 means "system default", same as win32 expects */
+ if (pfnBeginThread) {
+ unsigned threadid = 0;
+ thread->handle = (SYS_ThreadHandle)
+ ((size_t) pfnBeginThread(NULL, (unsigned int) thread->stacksize,
+ RunThreadViaBeginThreadEx,
+ pThreadParms, flags, &threadid));
+ } else {
+ DWORD threadid = 0;
+ thread->handle = CreateThread(NULL, thread->stacksize,
+ RunThreadViaCreateThread,
+ pThreadParms, flags, &threadid);
+ }
+ if (thread->handle == NULL) {
+ return SDL_SetError("Not enough resources to create thread");
+ }
+ return 0;
+}
+
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+ DWORD dwType; /* must be 0x1000 */
+ LPCSTR szName; /* pointer to name (in user addr space) */
+ DWORD dwThreadID; /* thread ID (-1=caller thread) */
+ DWORD dwFlags; /* reserved for future use, must be zero */
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+
+typedef HRESULT (WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR);
+
+void
+SDL_SYS_SetupThread(const char *name)
+{
+ if (name != NULL) {
+ #ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */
+ static pfnSetThreadDescription pSetThreadDescription = NULL;
+ static HMODULE kernel32 = 0;
+
+ if (!kernel32) {
+ kernel32 = LoadLibraryW(L"kernel32.dll");
+ if (kernel32) {
+ pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
+ }
+ }
+
+ if (pSetThreadDescription != NULL) {
+ WCHAR *strw = WIN_UTF8ToString(name);
+ if (strw) {
+ pSetThreadDescription(GetCurrentThread(), strw);
+ SDL_free(strw);
+ }
+ }
+ #endif
+
+ /* Presumably some version of Visual Studio will understand SetThreadDescription(),
+ but we still need to deal with older OSes and debuggers. Set it with the arcane
+ exception magic, too. */
+
+ if (IsDebuggerPresent()) {
+ THREADNAME_INFO inf;
+
+ /* C# and friends will try to catch this Exception, let's avoid it. */
+ if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_TRUE)) {
+ return;
+ }
+
+ /* This magic tells the debugger to name a thread if it's listening. */
+ SDL_zero(inf);
+ inf.dwType = 0x1000;
+ inf.szName = name;
+ inf.dwThreadID = (DWORD) -1;
+ inf.dwFlags = 0;
+
+ /* The debugger catches this, renames the thread, continues on. */
+ RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf);
+ }
+ }
+}
+
+SDL_threadID
+SDL_ThreadID(void)
+{
+ return ((SDL_threadID) GetCurrentThreadId());
+}
+
+int
+SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
+{
+ int value;
+
+ if (priority == SDL_THREAD_PRIORITY_LOW) {
+ value = THREAD_PRIORITY_LOWEST;
+ } else if (priority == SDL_THREAD_PRIORITY_HIGH) {
+ value = THREAD_PRIORITY_HIGHEST;
+ } else {
+ value = THREAD_PRIORITY_NORMAL;
+ }
+ if (!SetThreadPriority(GetCurrentThread(), value)) {
+ return WIN_SetError("SetThreadPriority()");
+ }
+ return 0;
+}
+
+void
+SDL_SYS_WaitThread(SDL_Thread * thread)
+{
+ WaitForSingleObjectEx(thread->handle, INFINITE, FALSE);
+ CloseHandle(thread->handle);
+}
+
+void
+SDL_SYS_DetachThread(SDL_Thread * thread)
+{
+ CloseHandle(thread->handle);
+}
+
+#endif /* SDL_THREAD_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/windows/SDL_systhread_c.h b/src/3rdparty/SDL2/src/thread/windows/SDL_systhread_c.h
new file mode 100644
index 0000000..65d5a1b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/windows/SDL_systhread_c.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_systhread_c_h_
+#define SDL_systhread_c_h_
+
+#include "../../core/windows/SDL_windows.h"
+
+typedef HANDLE SYS_ThreadHandle;
+
+#endif /* SDL_systhread_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/thread/windows/SDL_systls.c b/src/3rdparty/SDL2/src/thread/windows/SDL_systls.c
new file mode 100644
index 0000000..888fd74
--- /dev/null
+++ b/src/3rdparty/SDL2/src/thread/windows/SDL_systls.c
@@ -0,0 +1,72 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_THREAD_WINDOWS
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_thread.h"
+#include "../SDL_thread_c.h"
+
+static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
+static SDL_bool generic_local_storage = SDL_FALSE;
+
+SDL_TLSData *
+SDL_SYS_GetTLSData(void)
+{
+ if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) {
+ static SDL_SpinLock lock;
+ SDL_AtomicLock(&lock);
+ if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) {
+ DWORD storage = TlsAlloc();
+ if (storage != TLS_OUT_OF_INDEXES) {
+ SDL_MemoryBarrierRelease();
+ thread_local_storage = storage;
+ } else {
+ generic_local_storage = SDL_TRUE;
+ }
+ }
+ SDL_AtomicUnlock(&lock);
+ }
+ if (generic_local_storage) {
+ return SDL_Generic_GetTLSData();
+ }
+ SDL_MemoryBarrierAcquire();
+ return (SDL_TLSData *)TlsGetValue(thread_local_storage);
+}
+
+int
+SDL_SYS_SetTLSData(SDL_TLSData *data)
+{
+ if (generic_local_storage) {
+ return SDL_Generic_SetTLSData(data);
+ }
+ if (!TlsSetValue(thread_local_storage, data)) {
+ return SDL_SetError("TlsSetValue() failed");
+ }
+ return 0;
+}
+
+#endif /* SDL_THREAD_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/timer/SDL_timer.c b/src/3rdparty/SDL2/src/timer/SDL_timer.c
new file mode 100644
index 0000000..f4a13f4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/SDL_timer.c
@@ -0,0 +1,373 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_timer.h"
+#include "SDL_timer_c.h"
+#include "SDL_atomic.h"
+#include "SDL_cpuinfo.h"
+#include "../thread/SDL_systhread.h"
+
+/* #define DEBUG_TIMERS */
+
+typedef struct _SDL_Timer
+{
+ int timerID;
+ SDL_TimerCallback callback;
+ void *param;
+ Uint32 interval;
+ Uint32 scheduled;
+ SDL_atomic_t canceled;
+ struct _SDL_Timer *next;
+} SDL_Timer;
+
+typedef struct _SDL_TimerMap
+{
+ int timerID;
+ SDL_Timer *timer;
+ struct _SDL_TimerMap *next;
+} SDL_TimerMap;
+
+/* The timers are kept in a sorted list */
+typedef struct {
+ /* Data used by the main thread */
+ SDL_Thread *thread;
+ SDL_atomic_t nextID;
+ SDL_TimerMap *timermap;
+ SDL_mutex *timermap_lock;
+
+ /* Padding to separate cache lines between threads */
+ char cache_pad[SDL_CACHELINE_SIZE];
+
+ /* Data used to communicate with the timer thread */
+ SDL_SpinLock lock;
+ SDL_sem *sem;
+ SDL_Timer *pending;
+ SDL_Timer *freelist;
+ SDL_atomic_t active;
+
+ /* List of timers - this is only touched by the timer thread */
+ SDL_Timer *timers;
+} SDL_TimerData;
+
+static SDL_TimerData SDL_timer_data;
+
+/* The idea here is that any thread might add a timer, but a single
+ * thread manages the active timer queue, sorted by scheduling time.
+ *
+ * Timers are removed by simply setting a canceled flag
+ */
+
+static void
+SDL_AddTimerInternal(SDL_TimerData *data, SDL_Timer *timer)
+{
+ SDL_Timer *prev, *curr;
+
+ prev = NULL;
+ for (curr = data->timers; curr; prev = curr, curr = curr->next) {
+ if ((Sint32)(timer->scheduled-curr->scheduled) < 0) {
+ break;
+ }
+ }
+
+ /* Insert the timer here! */
+ if (prev) {
+ prev->next = timer;
+ } else {
+ data->timers = timer;
+ }
+ timer->next = curr;
+}
+
+static int SDLCALL
+SDL_TimerThread(void *_data)
+{
+ SDL_TimerData *data = (SDL_TimerData *)_data;
+ SDL_Timer *pending;
+ SDL_Timer *current;
+ SDL_Timer *freelist_head = NULL;
+ SDL_Timer *freelist_tail = NULL;
+ Uint32 tick, now, interval, delay;
+
+ /* Threaded timer loop:
+ * 1. Queue timers added by other threads
+ * 2. Handle any timers that should dispatch this cycle
+ * 3. Wait until next dispatch time or new timer arrives
+ */
+ for ( ; ; ) {
+ /* Pending and freelist maintenance */
+ SDL_AtomicLock(&data->lock);
+ {
+ /* Get any timers ready to be queued */
+ pending = data->pending;
+ data->pending = NULL;
+
+ /* Make any unused timer structures available */
+ if (freelist_head) {
+ freelist_tail->next = data->freelist;
+ data->freelist = freelist_head;
+ }
+ }
+ SDL_AtomicUnlock(&data->lock);
+
+ /* Sort the pending timers into our list */
+ while (pending) {
+ current = pending;
+ pending = pending->next;
+ SDL_AddTimerInternal(data, current);
+ }
+ freelist_head = NULL;
+ freelist_tail = NULL;
+
+ /* Check to see if we're still running, after maintenance */
+ if (!SDL_AtomicGet(&data->active)) {
+ break;
+ }
+
+ /* Initial delay if there are no timers */
+ delay = SDL_MUTEX_MAXWAIT;
+
+ tick = SDL_GetTicks();
+
+ /* Process all the pending timers for this tick */
+ while (data->timers) {
+ current = data->timers;
+
+ if ((Sint32)(tick-current->scheduled) < 0) {
+ /* Scheduled for the future, wait a bit */
+ delay = (current->scheduled - tick);
+ break;
+ }
+
+ /* We're going to do something with this timer */
+ data->timers = current->next;
+
+ if (SDL_AtomicGet(&current->canceled)) {
+ interval = 0;
+ } else {
+ interval = current->callback(current->interval, current->param);
+ }
+
+ if (interval > 0) {
+ /* Reschedule this timer */
+ current->interval = interval;
+ current->scheduled = tick + interval;
+ SDL_AddTimerInternal(data, current);
+ } else {
+ if (!freelist_head) {
+ freelist_head = current;
+ }
+ if (freelist_tail) {
+ freelist_tail->next = current;
+ }
+ freelist_tail = current;
+
+ SDL_AtomicSet(&current->canceled, 1);
+ }
+ }
+
+ /* Adjust the delay based on processing time */
+ now = SDL_GetTicks();
+ interval = (now - tick);
+ if (interval > delay) {
+ delay = 0;
+ } else {
+ delay -= interval;
+ }
+
+ /* Note that each time a timer is added, this will return
+ immediately, but we process the timers added all at once.
+ That's okay, it just means we run through the loop a few
+ extra times.
+ */
+ SDL_SemWaitTimeout(data->sem, delay);
+ }
+ return 0;
+}
+
+int
+SDL_TimerInit(void)
+{
+ SDL_TimerData *data = &SDL_timer_data;
+
+ if (!SDL_AtomicGet(&data->active)) {
+ const char *name = "SDLTimer";
+ data->timermap_lock = SDL_CreateMutex();
+ if (!data->timermap_lock) {
+ return -1;
+ }
+
+ data->sem = SDL_CreateSemaphore(0);
+ if (!data->sem) {
+ SDL_DestroyMutex(data->timermap_lock);
+ return -1;
+ }
+
+ SDL_AtomicSet(&data->active, 1);
+
+ /* Timer threads use a callback into the app, so we can't set a limited stack size here. */
+ data->thread = SDL_CreateThreadInternal(SDL_TimerThread, name, 0, data);
+ if (!data->thread) {
+ SDL_TimerQuit();
+ return -1;
+ }
+
+ SDL_AtomicSet(&data->nextID, 1);
+ }
+ return 0;
+}
+
+void
+SDL_TimerQuit(void)
+{
+ SDL_TimerData *data = &SDL_timer_data;
+ SDL_Timer *timer;
+ SDL_TimerMap *entry;
+
+ if (SDL_AtomicCAS(&data->active, 1, 0)) { /* active? Move to inactive. */
+ /* Shutdown the timer thread */
+ if (data->thread) {
+ SDL_SemPost(data->sem);
+ SDL_WaitThread(data->thread, NULL);
+ data->thread = NULL;
+ }
+
+ SDL_DestroySemaphore(data->sem);
+ data->sem = NULL;
+
+ /* Clean up the timer entries */
+ while (data->timers) {
+ timer = data->timers;
+ data->timers = timer->next;
+ SDL_free(timer);
+ }
+ while (data->freelist) {
+ timer = data->freelist;
+ data->freelist = timer->next;
+ SDL_free(timer);
+ }
+ while (data->timermap) {
+ entry = data->timermap;
+ data->timermap = entry->next;
+ SDL_free(entry);
+ }
+
+ SDL_DestroyMutex(data->timermap_lock);
+ data->timermap_lock = NULL;
+ }
+}
+
+SDL_TimerID
+SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
+{
+ SDL_TimerData *data = &SDL_timer_data;
+ SDL_Timer *timer;
+ SDL_TimerMap *entry;
+
+ SDL_AtomicLock(&data->lock);
+ if (!SDL_AtomicGet(&data->active)) {
+ if (SDL_TimerInit() < 0) {
+ SDL_AtomicUnlock(&data->lock);
+ return 0;
+ }
+ }
+
+ timer = data->freelist;
+ if (timer) {
+ data->freelist = timer->next;
+ }
+ SDL_AtomicUnlock(&data->lock);
+
+ if (timer) {
+ SDL_RemoveTimer(timer->timerID);
+ } else {
+ timer = (SDL_Timer *)SDL_malloc(sizeof(*timer));
+ if (!timer) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ }
+ timer->timerID = SDL_AtomicIncRef(&data->nextID);
+ timer->callback = callback;
+ timer->param = param;
+ timer->interval = interval;
+ timer->scheduled = SDL_GetTicks() + interval;
+ SDL_AtomicSet(&timer->canceled, 0);
+
+ entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
+ if (!entry) {
+ SDL_free(timer);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ entry->timer = timer;
+ entry->timerID = timer->timerID;
+
+ SDL_LockMutex(data->timermap_lock);
+ entry->next = data->timermap;
+ data->timermap = entry;
+ SDL_UnlockMutex(data->timermap_lock);
+
+ /* Add the timer to the pending list for the timer thread */
+ SDL_AtomicLock(&data->lock);
+ timer->next = data->pending;
+ data->pending = timer;
+ SDL_AtomicUnlock(&data->lock);
+
+ /* Wake up the timer thread if necessary */
+ SDL_SemPost(data->sem);
+
+ return entry->timerID;
+}
+
+SDL_bool
+SDL_RemoveTimer(SDL_TimerID id)
+{
+ SDL_TimerData *data = &SDL_timer_data;
+ SDL_TimerMap *prev, *entry;
+ SDL_bool canceled = SDL_FALSE;
+
+ /* Find the timer */
+ SDL_LockMutex(data->timermap_lock);
+ prev = NULL;
+ for (entry = data->timermap; entry; prev = entry, entry = entry->next) {
+ if (entry->timerID == id) {
+ if (prev) {
+ prev->next = entry->next;
+ } else {
+ data->timermap = entry->next;
+ }
+ break;
+ }
+ }
+ SDL_UnlockMutex(data->timermap_lock);
+
+ if (entry) {
+ if (!SDL_AtomicGet(&entry->timer->canceled)) {
+ SDL_AtomicSet(&entry->timer->canceled, 1);
+ canceled = SDL_TRUE;
+ }
+ SDL_free(entry);
+ }
+ return canceled;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/timer/SDL_timer_c.h b/src/3rdparty/SDL2/src/timer/SDL_timer_c.h
new file mode 100644
index 0000000..f83bdde
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/SDL_timer_c.h
@@ -0,0 +1,34 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Useful functions and variables from SDL_timer.c */
+#include "SDL_timer.h"
+
+#define ROUND_RESOLUTION(X) \
+ (((X+TIMER_RESOLUTION-1)/TIMER_RESOLUTION)*TIMER_RESOLUTION)
+
+extern void SDL_TicksInit(void);
+extern void SDL_TicksQuit(void);
+extern int SDL_TimerInit(void);
+extern void SDL_TimerQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/timer/dummy/SDL_systimer.c b/src/3rdparty/SDL2/src/timer/dummy/SDL_systimer.c
new file mode 100644
index 0000000..aff145b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/dummy/SDL_systimer.c
@@ -0,0 +1,75 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if defined(SDL_TIMER_DUMMY) || defined(SDL_TIMERS_DISABLED)
+
+#include "SDL_timer.h"
+
+static SDL_bool ticks_started = SDL_FALSE;
+
+void
+SDL_TicksInit(void)
+{
+ if (ticks_started) {
+ return;
+ }
+ ticks_started = SDL_TRUE;
+}
+
+void
+SDL_TicksQuit(void)
+{
+ ticks_started = SDL_FALSE;
+}
+
+Uint32
+SDL_GetTicks(void)
+{
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ SDL_Unsupported();
+ return 0;
+}
+
+Uint64
+SDL_GetPerformanceCounter(void)
+{
+ return SDL_GetTicks();
+}
+
+Uint64
+SDL_GetPerformanceFrequency(void)
+{
+ return 1000;
+}
+
+void
+SDL_Delay(Uint32 ms)
+{
+ SDL_Unsupported();
+}
+
+#endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/timer/haiku/SDL_systimer.c b/src/3rdparty/SDL2/src/timer/haiku/SDL_systimer.c
new file mode 100644
index 0000000..16f49c0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/haiku/SDL_systimer.c
@@ -0,0 +1,80 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_TIMER_HAIKU
+
+#include <kernel/OS.h>
+
+#include "SDL_timer.h"
+
+static bigtime_t start;
+static SDL_bool ticks_started = SDL_FALSE;
+
+void
+SDL_TicksInit(void)
+{
+ if (ticks_started) {
+ return;
+ }
+ ticks_started = SDL_TRUE;
+
+ /* Set first ticks value */
+ start = system_time();
+}
+
+void
+SDL_TicksQuit(void)
+{
+ ticks_started = SDL_FALSE;
+}
+
+Uint32
+SDL_GetTicks(void)
+{
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ return ((system_time() - start) / 1000);
+}
+
+Uint64
+SDL_GetPerformanceCounter(void)
+{
+ return system_time();
+}
+
+Uint64
+SDL_GetPerformanceFrequency(void)
+{
+ return 1000000;
+}
+
+void
+SDL_Delay(Uint32 ms)
+{
+ snooze(ms * 1000);
+}
+
+#endif /* SDL_TIMER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/timer/psp/SDL_systimer.c b/src/3rdparty/SDL2/src/timer/psp/SDL_systimer.c
new file mode 100644
index 0000000..e39d800
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/psp/SDL_systimer.c
@@ -0,0 +1,91 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_TIMERS_PSP
+
+#include "SDL_thread.h"
+#include "SDL_timer.h"
+#include "SDL_error.h"
+#include "../SDL_timer_c.h"
+#include <stdlib.h>
+#include <time.h>
+#include <sys/time.h>
+#include <pspthreadman.h>
+
+static struct timeval start;
+static SDL_bool ticks_started = SDL_FALSE;
+
+void
+SDL_TicksInit(void)
+{
+ if (ticks_started) {
+ return;
+ }
+ ticks_started = SDL_TRUE;
+
+ gettimeofday(&start, NULL);
+}
+
+void
+SDL_TicksQuit(void)
+{
+ ticks_started = SDL_FALSE;
+}
+
+Uint32 SDL_GetTicks(void)
+{
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ struct timeval now;
+ Uint32 ticks;
+
+ gettimeofday(&now, NULL);
+ ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
+ return(ticks);
+}
+
+Uint64
+SDL_GetPerformanceCounter(void)
+{
+ return SDL_GetTicks();
+}
+
+Uint64
+SDL_GetPerformanceFrequency(void)
+{
+ return 1000;
+}
+
+void SDL_Delay(Uint32 ms)
+{
+ const Uint32 max_delay = 0xffffffffUL / 1000;
+ if(ms > max_delay)
+ ms = max_delay;
+ sceKernelDelayThreadCB(ms * 1000);
+}
+
+#endif /* SDL_TIMERS_PSP */
+
+/* vim: ts=4 sw=4
+ */
diff --git a/src/3rdparty/SDL2/src/timer/unix/SDL_systimer.c b/src/3rdparty/SDL2/src/timer/unix/SDL_systimer.c
new file mode 100644
index 0000000..5045996
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/unix/SDL_systimer.c
@@ -0,0 +1,232 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_TIMER_UNIX
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "SDL_timer.h"
+#include "SDL_assert.h"
+#include "../SDL_timer_c.h"
+
+/* The clock_gettime provides monotonous time, so we should use it if
+ it's available. The clock_gettime function is behind ifdef
+ for __USE_POSIX199309
+ Tommi Kyntola (tommi.kyntola@ray.fi) 27/09/2005
+*/
+/* Reworked monotonic clock to not assume the current system has one
+ as not all linux kernels provide a monotonic clock (yeah recent ones
+ probably do)
+ Also added OS X Monotonic clock support
+ Based on work in https://github.com/ThomasHabets/monotonic_clock
+ */
+#if HAVE_NANOSLEEP || HAVE_CLOCK_GETTIME
+#include <time.h>
+#endif
+#ifdef __APPLE__
+#include <mach/mach_time.h>
+#endif
+
+/* Use CLOCK_MONOTONIC_RAW, if available, which is not subject to adjustment by NTP */
+#if HAVE_CLOCK_GETTIME
+#ifdef CLOCK_MONOTONIC_RAW
+#define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC_RAW
+#else
+#define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC
+#endif
+#endif
+
+/* The first ticks value of the application */
+#if HAVE_CLOCK_GETTIME
+static struct timespec start_ts;
+#elif defined(__APPLE__)
+static uint64_t start_mach;
+mach_timebase_info_data_t mach_base_info;
+#endif
+static SDL_bool has_monotonic_time = SDL_FALSE;
+static struct timeval start_tv;
+static SDL_bool ticks_started = SDL_FALSE;
+
+void
+SDL_TicksInit(void)
+{
+ if (ticks_started) {
+ return;
+ }
+ ticks_started = SDL_TRUE;
+
+ /* Set first ticks value */
+#if HAVE_CLOCK_GETTIME
+ if (clock_gettime(SDL_MONOTONIC_CLOCK, &start_ts) == 0) {
+ has_monotonic_time = SDL_TRUE;
+ } else
+#elif defined(__APPLE__)
+ kern_return_t ret = mach_timebase_info(&mach_base_info);
+ if (ret == 0) {
+ has_monotonic_time = SDL_TRUE;
+ start_mach = mach_absolute_time();
+ } else
+#endif
+ {
+ gettimeofday(&start_tv, NULL);
+ }
+}
+
+void
+SDL_TicksQuit(void)
+{
+ ticks_started = SDL_FALSE;
+}
+
+Uint32
+SDL_GetTicks(void)
+{
+ Uint32 ticks;
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ if (has_monotonic_time) {
+#if HAVE_CLOCK_GETTIME
+ struct timespec now;
+ clock_gettime(SDL_MONOTONIC_CLOCK, &now);
+ ticks = (now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec -
+ start_ts.tv_nsec) / 1000000;
+#elif defined(__APPLE__)
+ uint64_t now = mach_absolute_time();
+ ticks = (Uint32)((((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000);
+#else
+ SDL_assert(SDL_FALSE);
+ ticks = 0;
+#endif
+ } else {
+ struct timeval now;
+
+ gettimeofday(&now, NULL);
+ ticks = (Uint32)((now.tv_sec - start_tv.tv_sec) * 1000 + (now.tv_usec - start_tv.tv_usec) / 1000);
+ }
+ return (ticks);
+}
+
+Uint64
+SDL_GetPerformanceCounter(void)
+{
+ Uint64 ticks;
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ if (has_monotonic_time) {
+#if HAVE_CLOCK_GETTIME
+ struct timespec now;
+
+ clock_gettime(SDL_MONOTONIC_CLOCK, &now);
+ ticks = now.tv_sec;
+ ticks *= 1000000000;
+ ticks += now.tv_nsec;
+#elif defined(__APPLE__)
+ ticks = mach_absolute_time();
+#else
+ SDL_assert(SDL_FALSE);
+ ticks = 0;
+#endif
+ } else {
+ struct timeval now;
+
+ gettimeofday(&now, NULL);
+ ticks = now.tv_sec;
+ ticks *= 1000000;
+ ticks += now.tv_usec;
+ }
+ return (ticks);
+}
+
+Uint64
+SDL_GetPerformanceFrequency(void)
+{
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ if (has_monotonic_time) {
+#if HAVE_CLOCK_GETTIME
+ return 1000000000;
+#elif defined(__APPLE__)
+ Uint64 freq = mach_base_info.denom;
+ freq *= 1000000000;
+ freq /= mach_base_info.numer;
+ return freq;
+#endif
+ }
+
+ return 1000000;
+}
+
+void
+SDL_Delay(Uint32 ms)
+{
+ int was_error;
+
+#if HAVE_NANOSLEEP
+ struct timespec elapsed, tv;
+#else
+ struct timeval tv;
+ Uint32 then, now, elapsed;
+#endif
+
+ /* Set the timeout interval */
+#if HAVE_NANOSLEEP
+ elapsed.tv_sec = ms / 1000;
+ elapsed.tv_nsec = (ms % 1000) * 1000000;
+#else
+ then = SDL_GetTicks();
+#endif
+ do {
+ errno = 0;
+
+#if HAVE_NANOSLEEP
+ tv.tv_sec = elapsed.tv_sec;
+ tv.tv_nsec = elapsed.tv_nsec;
+ was_error = nanosleep(&tv, &elapsed);
+#else
+ /* Calculate the time interval left (in case of interrupt) */
+ now = SDL_GetTicks();
+ elapsed = (now - then);
+ then = now;
+ if (elapsed >= ms) {
+ break;
+ }
+ ms -= elapsed;
+ tv.tv_sec = ms / 1000;
+ tv.tv_usec = (ms % 1000) * 1000;
+
+ was_error = select(0, NULL, NULL, NULL, &tv);
+#endif /* HAVE_NANOSLEEP */
+ } while (was_error && (errno == EINTR));
+}
+
+#endif /* SDL_TIMER_UNIX */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/timer/windows/SDL_systimer.c b/src/3rdparty/SDL2/src/timer/windows/SDL_systimer.c
new file mode 100644
index 0000000..3f5413b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/timer/windows/SDL_systimer.c
@@ -0,0 +1,200 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_TIMER_WINDOWS
+
+#include "../../core/windows/SDL_windows.h"
+#include <mmsystem.h>
+
+#include "SDL_timer.h"
+#include "SDL_hints.h"
+
+
+/* The first (low-resolution) ticks value of the application */
+static DWORD start = 0;
+static BOOL ticks_started = FALSE;
+
+/* Store if a high-resolution performance counter exists on the system */
+static BOOL hires_timer_available;
+/* The first high-resolution ticks value of the application */
+static LARGE_INTEGER hires_start_ticks;
+/* The number of ticks per second of the high-resolution performance counter */
+static LARGE_INTEGER hires_ticks_per_second;
+
+static void
+SDL_SetSystemTimerResolution(const UINT uPeriod)
+{
+#ifndef __WINRT__
+ static UINT timer_period = 0;
+
+ if (uPeriod != timer_period) {
+ if (timer_period) {
+ timeEndPeriod(timer_period);
+ }
+
+ timer_period = uPeriod;
+
+ if (timer_period) {
+ timeBeginPeriod(timer_period);
+ }
+ }
+#endif
+}
+
+static void SDLCALL
+SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ UINT uPeriod;
+
+ /* Unless the hint says otherwise, let's have good sleep precision */
+ if (hint && *hint) {
+ uPeriod = SDL_atoi(hint);
+ } else {
+ uPeriod = 1;
+ }
+ if (uPeriod || oldValue != hint) {
+ SDL_SetSystemTimerResolution(uPeriod);
+ }
+}
+
+void
+SDL_TicksInit(void)
+{
+ if (ticks_started) {
+ return;
+ }
+ ticks_started = SDL_TRUE;
+
+ /* if we didn't set a precision, set it high. This affects lots of things
+ on Windows besides the SDL timers, like audio callbacks, etc. */
+ SDL_AddHintCallback(SDL_HINT_TIMER_RESOLUTION,
+ SDL_TimerResolutionChanged, NULL);
+
+ /* Set first ticks value */
+ /* QueryPerformanceCounter has had problems in the past, but lots of games
+ use it, so we'll rely on it here.
+ */
+ if (QueryPerformanceFrequency(&hires_ticks_per_second) == TRUE) {
+ hires_timer_available = TRUE;
+ QueryPerformanceCounter(&hires_start_ticks);
+ } else {
+ hires_timer_available = FALSE;
+#ifndef __WINRT__
+ start = timeGetTime();
+#endif /* __WINRT__ */
+ }
+}
+
+void
+SDL_TicksQuit(void)
+{
+ SDL_DelHintCallback(SDL_HINT_TIMER_RESOLUTION,
+ SDL_TimerResolutionChanged, NULL);
+
+ SDL_SetSystemTimerResolution(0); /* always release our timer resolution request. */
+
+ start = 0;
+ ticks_started = SDL_FALSE;
+}
+
+Uint32
+SDL_GetTicks(void)
+{
+ DWORD now = 0;
+ LARGE_INTEGER hires_now;
+
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ if (hires_timer_available) {
+ QueryPerformanceCounter(&hires_now);
+
+ hires_now.QuadPart -= hires_start_ticks.QuadPart;
+ hires_now.QuadPart *= 1000;
+ hires_now.QuadPart /= hires_ticks_per_second.QuadPart;
+
+ return (DWORD) hires_now.QuadPart;
+ } else {
+#ifndef __WINRT__
+ now = timeGetTime();
+#endif /* __WINRT__ */
+ }
+
+ return (now - start);
+}
+
+Uint64
+SDL_GetPerformanceCounter(void)
+{
+ LARGE_INTEGER counter;
+
+ if (!QueryPerformanceCounter(&counter)) {
+ return SDL_GetTicks();
+ }
+ return counter.QuadPart;
+}
+
+Uint64
+SDL_GetPerformanceFrequency(void)
+{
+ LARGE_INTEGER frequency;
+
+ if (!QueryPerformanceFrequency(&frequency)) {
+ return 1000;
+ }
+ return frequency.QuadPart;
+}
+
+void
+SDL_Delay(Uint32 ms)
+{
+ /* Sleep() is not publicly available to apps in early versions of WinRT.
+ *
+ * Visual C++ 2013 Update 4 re-introduced Sleep() for Windows 8.1 and
+ * Windows Phone 8.1.
+ *
+ * Use the compiler version to determine availability.
+ *
+ * NOTE #1: _MSC_FULL_VER == 180030723 for Visual C++ 2013 Update 3.
+ * NOTE #2: Visual C++ 2013, when compiling for Windows 8.0 and
+ * Windows Phone 8.0, uses the Visual C++ 2012 compiler to build
+ * apps and libraries.
+ */
+#if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723)
+ static HANDLE mutex = 0;
+ if (!mutex) {
+ mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);
+ }
+ WaitForSingleObjectEx(mutex, ms, FALSE);
+#else
+ if (!ticks_started) {
+ SDL_TicksInit();
+ }
+
+ Sleep(ms);
+#endif
+}
+
+#endif /* SDL_TIMER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_RLEaccel.c b/src/3rdparty/SDL2/src/video/SDL_RLEaccel.c
new file mode 100644
index 0000000..661cb1f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_RLEaccel.c
@@ -0,0 +1,1581 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/*
+ * RLE encoding for software colorkey and alpha-channel acceleration
+ *
+ * Original version by Sam Lantinga
+ *
+ * Mattias Engdegrd (Yorick): Rewrite. New encoding format, encoder and
+ * decoder. Added per-surface alpha blitter. Added per-pixel alpha
+ * format, encoder and blitter.
+ *
+ * Many thanks to Xark and johns for hints, benchmarks and useful comments
+ * leading to this code.
+ *
+ * Welcome to Macro Mayhem.
+ */
+
+/*
+ * The encoding translates the image data to a stream of segments of the form
+ *
+ * <skip> <run> <data>
+ *
+ * where <skip> is the number of transparent pixels to skip,
+ * <run> is the number of opaque pixels to blit,
+ * and <data> are the pixels themselves.
+ *
+ * This basic structure is used both for colorkeyed surfaces, used for simple
+ * binary transparency and for per-surface alpha blending, and for surfaces
+ * with per-pixel alpha. The details differ, however:
+ *
+ * Encoding of colorkeyed surfaces:
+ *
+ * Encoded pixels always have the same format as the target surface.
+ * <skip> and <run> are unsigned 8 bit integers, except for 32 bit depth
+ * where they are 16 bit. This makes the pixel data aligned at all times.
+ * Segments never wrap around from one scan line to the next.
+ *
+ * The end of the sequence is marked by a zero <skip>,<run> pair at the *
+ * beginning of a line.
+ *
+ * Encoding of surfaces with per-pixel alpha:
+ *
+ * The sequence begins with a struct RLEDestFormat describing the target
+ * pixel format, to provide reliable un-encoding.
+ *
+ * Each scan line is encoded twice: First all completely opaque pixels,
+ * encoded in the target format as described above, and then all
+ * partially transparent (translucent) pixels (where 1 <= alpha <= 254),
+ * in the following 32-bit format:
+ *
+ * For 32-bit targets, each pixel has the target RGB format but with
+ * the alpha value occupying the highest 8 bits. The <skip> and <run>
+ * counts are 16 bit.
+ *
+ * For 16-bit targets, each pixel has the target RGB format, but with
+ * the middle component (usually green) shifted 16 steps to the left,
+ * and the hole filled with the 5 most significant bits of the alpha value.
+ * i.e. if the target has the format rrrrrggggggbbbbb,
+ * the encoded pixel will be 00000gggggg00000rrrrr0aaaaabbbbb.
+ * The <skip> and <run> counts are 8 bit for the opaque lines, 16 bit
+ * for the translucent lines. Two padding bytes may be inserted
+ * before each translucent line to keep them 32-bit aligned.
+ *
+ * The end of the sequence is marked by a zero <skip>,<run> pair at the
+ * beginning of an opaque line.
+ */
+
+#include "SDL_video.h"
+#include "SDL_sysvideo.h"
+#include "SDL_blit.h"
+#include "SDL_RLEaccel_c.h"
+
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+#define PIXEL_COPY(to, from, len, bpp) \
+ SDL_memcpy(to, from, (size_t)(len) * (bpp))
+
+/*
+ * Various colorkey blit methods, for opaque and per-surface alpha
+ */
+
+#define OPAQUE_BLIT(to, from, length, bpp, alpha) \
+ PIXEL_COPY(to, from, length, bpp)
+
+/*
+ * For 32bpp pixels on the form 0x00rrggbb:
+ * If we treat the middle component separately, we can process the two
+ * remaining in parallel. This is safe to do because of the gap to the left
+ * of each component, so the bits from the multiplication don't collide.
+ * This can be used for any RGB permutation of course.
+ */
+#define ALPHA_BLIT32_888(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint32 *src = (Uint32 *)(from); \
+ Uint32 *dst = (Uint32 *)(to); \
+ for (i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ Uint32 s1 = s & 0xff00ff; \
+ Uint32 d1 = d & 0xff00ff; \
+ d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
+ s &= 0xff00; \
+ d &= 0xff00; \
+ d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
+ *dst++ = d1 | d; \
+ } \
+ } while (0)
+
+/*
+ * For 16bpp pixels we can go a step further: put the middle component
+ * in the high 16 bits of a 32 bit word, and process all three RGB
+ * components at the same time. Since the smallest gap is here just
+ * 5 bits, we have to scale alpha down to 5 bits as well.
+ */
+#define ALPHA_BLIT16_565(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint16 *src = (Uint16 *)(from); \
+ Uint16 *dst = (Uint16 *)(to); \
+ Uint32 ALPHA = alpha >> 3; \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ s = (s | s << 16) & 0x07e0f81f; \
+ d = (d | d << 16) & 0x07e0f81f; \
+ d += (s - d) * ALPHA >> 5; \
+ d &= 0x07e0f81f; \
+ *dst++ = (Uint16)(d | d >> 16); \
+ } \
+ } while(0)
+
+#define ALPHA_BLIT16_555(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint16 *src = (Uint16 *)(from); \
+ Uint16 *dst = (Uint16 *)(to); \
+ Uint32 ALPHA = alpha >> 3; \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ s = (s | s << 16) & 0x03e07c1f; \
+ d = (d | d << 16) & 0x03e07c1f; \
+ d += (s - d) * ALPHA >> 5; \
+ d &= 0x03e07c1f; \
+ *dst++ = (Uint16)(d | d >> 16); \
+ } \
+ } while(0)
+
+/*
+ * The general slow catch-all function, for remaining depths and formats
+ */
+#define ALPHA_BLIT_ANY(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint8 *src = from; \
+ Uint8 *dst = to; \
+ for (i = 0; i < (int)(length); i++) { \
+ Uint32 s, d; \
+ unsigned rs, gs, bs, rd, gd, bd; \
+ switch (bpp) { \
+ case 2: \
+ s = *(Uint16 *)src; \
+ d = *(Uint16 *)dst; \
+ break; \
+ case 3: \
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
+ s = (src[0] << 16) | (src[1] << 8) | src[2]; \
+ d = (dst[0] << 16) | (dst[1] << 8) | dst[2]; \
+ } else { \
+ s = (src[2] << 16) | (src[1] << 8) | src[0]; \
+ d = (dst[2] << 16) | (dst[1] << 8) | dst[0]; \
+ } \
+ break; \
+ case 4: \
+ s = *(Uint32 *)src; \
+ d = *(Uint32 *)dst; \
+ break; \
+ } \
+ RGB_FROM_PIXEL(s, fmt, rs, gs, bs); \
+ RGB_FROM_PIXEL(d, fmt, rd, gd, bd); \
+ rd += (rs - rd) * alpha >> 8; \
+ gd += (gs - gd) * alpha >> 8; \
+ bd += (bs - bd) * alpha >> 8; \
+ PIXEL_FROM_RGB(d, fmt, rd, gd, bd); \
+ switch (bpp) { \
+ case 2: \
+ *(Uint16 *)dst = (Uint16)d; \
+ break; \
+ case 3: \
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
+ dst[0] = (Uint8)(d >> 16); \
+ dst[1] = (Uint8)(d >> 8); \
+ dst[2] = (Uint8)(d); \
+ } else { \
+ dst[0] = (Uint8)d; \
+ dst[1] = (Uint8)(d >> 8); \
+ dst[2] = (Uint8)(d >> 16); \
+ } \
+ break; \
+ case 4: \
+ *(Uint32 *)dst = d; \
+ break; \
+ } \
+ src += bpp; \
+ dst += bpp; \
+ } \
+ } while(0)
+
+/*
+ * Special case: 50% alpha (alpha=128)
+ * This is treated specially because it can be optimized very well, and
+ * since it is good for many cases of semi-translucency.
+ * The theory is to do all three components at the same time:
+ * First zero the lowest bit of each component, which gives us room to
+ * add them. Then shift right and add the sum of the lowest bits.
+ */
+#define ALPHA_BLIT32_888_50(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint32 *src = (Uint32 *)(from); \
+ Uint32 *dst = (Uint32 *)(to); \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ *dst++ = (((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) \
+ + (s & d & 0x00010101); \
+ } \
+ } while(0)
+
+/*
+ * For 16bpp, we can actually blend two pixels in parallel, if we take
+ * care to shift before we add, not after.
+ */
+
+/* helper: blend a single 16 bit pixel at 50% */
+#define BLEND16_50(dst, src, mask) \
+ do { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ *dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) + \
+ (s & d & (~mask & 0xffff))); \
+ } while(0)
+
+/* basic 16bpp blender. mask is the pixels to keep when adding. */
+#define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask) \
+ do { \
+ unsigned n = (length); \
+ Uint16 *src = (Uint16 *)(from); \
+ Uint16 *dst = (Uint16 *)(to); \
+ if (((uintptr_t)src ^ (uintptr_t)dst) & 3) { \
+ /* source and destination not in phase, blit one by one */ \
+ while (n--) \
+ BLEND16_50(dst, src, mask); \
+ } else { \
+ if ((uintptr_t)src & 3) { \
+ /* first odd pixel */ \
+ BLEND16_50(dst, src, mask); \
+ n--; \
+ } \
+ for (; n > 1; n -= 2) { \
+ Uint32 s = *(Uint32 *)src; \
+ Uint32 d = *(Uint32 *)dst; \
+ *(Uint32 *)dst = ((s & (mask | mask << 16)) >> 1) \
+ + ((d & (mask | mask << 16)) >> 1) \
+ + (s & d & (~(mask | mask << 16))); \
+ src += 2; \
+ dst += 2; \
+ } \
+ if (n) \
+ BLEND16_50(dst, src, mask); /* last odd pixel */ \
+ } \
+ } while(0)
+
+#define ALPHA_BLIT16_565_50(to, from, length, bpp, alpha) \
+ ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7de)
+
+#define ALPHA_BLIT16_555_50(to, from, length, bpp, alpha) \
+ ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xfbde)
+
+#define CHOOSE_BLIT(blitter, alpha, fmt) \
+ do { \
+ if (alpha == 255) { \
+ switch (fmt->BytesPerPixel) { \
+ case 1: blitter(1, Uint8, OPAQUE_BLIT); break; \
+ case 2: blitter(2, Uint8, OPAQUE_BLIT); break; \
+ case 3: blitter(3, Uint8, OPAQUE_BLIT); break; \
+ case 4: blitter(4, Uint16, OPAQUE_BLIT); break; \
+ } \
+ } else { \
+ switch (fmt->BytesPerPixel) { \
+ case 1: \
+ /* No 8bpp alpha blitting */ \
+ break; \
+ \
+ case 2: \
+ switch (fmt->Rmask | fmt->Gmask | fmt->Bmask) { \
+ case 0xffff: \
+ if (fmt->Gmask == 0x07e0 \
+ || fmt->Rmask == 0x07e0 \
+ || fmt->Bmask == 0x07e0) { \
+ if (alpha == 128) { \
+ blitter(2, Uint8, ALPHA_BLIT16_565_50); \
+ } else { \
+ blitter(2, Uint8, ALPHA_BLIT16_565); \
+ } \
+ } else \
+ goto general16; \
+ break; \
+ \
+ case 0x7fff: \
+ if (fmt->Gmask == 0x03e0 \
+ || fmt->Rmask == 0x03e0 \
+ || fmt->Bmask == 0x03e0) { \
+ if (alpha == 128) { \
+ blitter(2, Uint8, ALPHA_BLIT16_555_50); \
+ } else { \
+ blitter(2, Uint8, ALPHA_BLIT16_555); \
+ } \
+ break; \
+ } else \
+ goto general16; \
+ break; \
+ \
+ default: \
+ general16: \
+ blitter(2, Uint8, ALPHA_BLIT_ANY); \
+ } \
+ break; \
+ \
+ case 3: \
+ blitter(3, Uint8, ALPHA_BLIT_ANY); \
+ break; \
+ \
+ case 4: \
+ if ((fmt->Rmask | fmt->Gmask | fmt->Bmask) == 0x00ffffff \
+ && (fmt->Gmask == 0xff00 || fmt->Rmask == 0xff00 \
+ || fmt->Bmask == 0xff00)) { \
+ if (alpha == 128) { \
+ blitter(4, Uint16, ALPHA_BLIT32_888_50); \
+ } else { \
+ blitter(4, Uint16, ALPHA_BLIT32_888); \
+ } \
+ } else \
+ blitter(4, Uint16, ALPHA_BLIT_ANY); \
+ break; \
+ } \
+ } \
+ } while(0)
+
+/*
+ * Set a pixel value using the given format, except that the alpha value is
+ * placed in the top byte. This is the format used for RLE with alpha.
+ */
+#define RLEPIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
+{ \
+ Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
+ ((g>>fmt->Gloss)<<fmt->Gshift)| \
+ ((b>>fmt->Bloss)<<fmt->Bshift)| \
+ (a<<24); \
+}
+
+/*
+ * This takes care of the case when the surface is clipped on the left and/or
+ * right. Top clipping has already been taken care of.
+ */
+static void
+RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
+ Uint8 * dstbuf, SDL_Rect * srcrect, unsigned alpha)
+{
+ SDL_PixelFormat *fmt = surf_dst->format;
+
+#define RLECLIPBLIT(bpp, Type, do_blit) \
+ do { \
+ int linecount = srcrect->h; \
+ int ofs = 0; \
+ int left = srcrect->x; \
+ int right = left + srcrect->w; \
+ dstbuf -= left * bpp; \
+ for (;;) { \
+ int run; \
+ ofs += *(Type *)srcbuf; \
+ run = ((Type *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Type); \
+ if (run) { \
+ /* clip to left and right borders */ \
+ if (ofs < right) { \
+ int start = 0; \
+ int len = run; \
+ int startcol; \
+ if (left - ofs > 0) { \
+ start = left - ofs; \
+ len -= start; \
+ if (len <= 0) \
+ goto nocopy ## bpp ## do_blit; \
+ } \
+ startcol = ofs + start; \
+ if (len > right - startcol) \
+ len = right - startcol; \
+ do_blit(dstbuf + startcol * bpp, srcbuf + start * bpp, \
+ len, bpp, alpha); \
+ } \
+ nocopy ## bpp ## do_blit: \
+ srcbuf += run * bpp; \
+ ofs += run; \
+ } else if (!ofs) \
+ break; \
+ \
+ if (ofs == w) { \
+ ofs = 0; \
+ dstbuf += surf_dst->pitch; \
+ if (!--linecount) \
+ break; \
+ } \
+ } \
+ } while(0)
+
+ CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
+
+#undef RLECLIPBLIT
+
+}
+
+
+/* blit a colorkeyed RLE surface */
+int SDLCALL
+SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
+ SDL_Surface * surf_dst, SDL_Rect * dstrect)
+{
+ Uint8 *dstbuf;
+ Uint8 *srcbuf;
+ int x, y;
+ int w = surf_src->w;
+ unsigned alpha;
+
+ /* Lock the destination if necessary */
+ if (SDL_MUSTLOCK(surf_dst)) {
+ if (SDL_LockSurface(surf_dst) < 0) {
+ return (-1);
+ }
+ }
+
+ /* Set up the source and destination pointers */
+ x = dstrect->x;
+ y = dstrect->y;
+ dstbuf = (Uint8 *) surf_dst->pixels
+ + y * surf_dst->pitch + x * surf_src->format->BytesPerPixel;
+ srcbuf = (Uint8 *) surf_src->map->data;
+
+ {
+ /* skip lines at the top if necessary */
+ int vskip = srcrect->y;
+ int ofs = 0;
+ if (vskip) {
+
+#define RLESKIP(bpp, Type) \
+ for(;;) { \
+ int run; \
+ ofs += *(Type *)srcbuf; \
+ run = ((Type *)srcbuf)[1]; \
+ srcbuf += sizeof(Type) * 2; \
+ if(run) { \
+ srcbuf += run * bpp; \
+ ofs += run; \
+ } else if(!ofs) \
+ goto done; \
+ if(ofs == w) { \
+ ofs = 0; \
+ if(!--vskip) \
+ break; \
+ } \
+ }
+
+ switch (surf_src->format->BytesPerPixel) {
+ case 1:
+ RLESKIP(1, Uint8);
+ break;
+ case 2:
+ RLESKIP(2, Uint8);
+ break;
+ case 3:
+ RLESKIP(3, Uint8);
+ break;
+ case 4:
+ RLESKIP(4, Uint16);
+ break;
+ }
+
+#undef RLESKIP
+
+ }
+ }
+
+ alpha = surf_src->map->info.a;
+ /* if left or right edge clipping needed, call clip blit */
+ if (srcrect->x || srcrect->w != surf_src->w) {
+ RLEClipBlit(w, srcbuf, surf_dst, dstbuf, srcrect, alpha);
+ } else {
+ SDL_PixelFormat *fmt = surf_src->format;
+
+#define RLEBLIT(bpp, Type, do_blit) \
+ do { \
+ int linecount = srcrect->h; \
+ int ofs = 0; \
+ for(;;) { \
+ unsigned run; \
+ ofs += *(Type *)srcbuf; \
+ run = ((Type *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Type); \
+ if(run) { \
+ do_blit(dstbuf + ofs * bpp, srcbuf, run, bpp, alpha); \
+ srcbuf += run * bpp; \
+ ofs += run; \
+ } else if(!ofs) \
+ break; \
+ if(ofs == w) { \
+ ofs = 0; \
+ dstbuf += surf_dst->pitch; \
+ if(!--linecount) \
+ break; \
+ } \
+ } \
+ } while(0)
+
+ CHOOSE_BLIT(RLEBLIT, alpha, fmt);
+
+#undef RLEBLIT
+ }
+
+ done:
+ /* Unlock the destination if necessary */
+ if (SDL_MUSTLOCK(surf_dst)) {
+ SDL_UnlockSurface(surf_dst);
+ }
+ return (0);
+}
+
+#undef OPAQUE_BLIT
+
+/*
+ * Per-pixel blitting macros for translucent pixels:
+ * These use the same techniques as the per-surface blitting macros
+ */
+
+/*
+ * For 32bpp pixels, we have made sure the alpha is stored in the top
+ * 8 bits, so proceed as usual
+ */
+#define BLIT_TRANSL_888(src, dst) \
+ do { \
+ Uint32 s = src; \
+ Uint32 d = dst; \
+ unsigned alpha = s >> 24; \
+ Uint32 s1 = s & 0xff00ff; \
+ Uint32 d1 = d & 0xff00ff; \
+ d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
+ s &= 0xff00; \
+ d &= 0xff00; \
+ d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
+ dst = d1 | d | 0xff000000; \
+ } while(0)
+
+/*
+ * For 16bpp pixels, we have stored the 5 most significant alpha bits in
+ * bits 5-10. As before, we can process all 3 RGB components at the same time.
+ */
+#define BLIT_TRANSL_565(src, dst) \
+ do { \
+ Uint32 s = src; \
+ Uint32 d = dst; \
+ unsigned alpha = (s & 0x3e0) >> 5; \
+ s &= 0x07e0f81f; \
+ d = (d | d << 16) & 0x07e0f81f; \
+ d += (s - d) * alpha >> 5; \
+ d &= 0x07e0f81f; \
+ dst = (Uint16)(d | d >> 16); \
+ } while(0)
+
+#define BLIT_TRANSL_555(src, dst) \
+ do { \
+ Uint32 s = src; \
+ Uint32 d = dst; \
+ unsigned alpha = (s & 0x3e0) >> 5; \
+ s &= 0x03e07c1f; \
+ d = (d | d << 16) & 0x03e07c1f; \
+ d += (s - d) * alpha >> 5; \
+ d &= 0x03e07c1f; \
+ dst = (Uint16)(d | d >> 16); \
+ } while(0)
+
+/* used to save the destination format in the encoding. Designed to be
+ macro-compatible with SDL_PixelFormat but without the unneeded fields */
+typedef struct
+{
+ Uint8 BytesPerPixel;
+ Uint8 padding[3];
+ Uint32 Rmask;
+ Uint32 Gmask;
+ Uint32 Bmask;
+ Uint32 Amask;
+ Uint8 Rloss;
+ Uint8 Gloss;
+ Uint8 Bloss;
+ Uint8 Aloss;
+ Uint8 Rshift;
+ Uint8 Gshift;
+ Uint8 Bshift;
+ Uint8 Ashift;
+} RLEDestFormat;
+
+/* blit a pixel-alpha RLE surface clipped at the right and/or left edges */
+static void
+RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
+ Uint8 * dstbuf, SDL_Rect * srcrect)
+{
+ SDL_PixelFormat *df = surf_dst->format;
+ /*
+ * clipped blitter: Ptype is the destination pixel type,
+ * Ctype the translucent count type, and do_blend the macro
+ * to blend one pixel.
+ */
+#define RLEALPHACLIPBLIT(Ptype, Ctype, do_blend) \
+ do { \
+ int linecount = srcrect->h; \
+ int left = srcrect->x; \
+ int right = left + srcrect->w; \
+ dstbuf -= left * sizeof(Ptype); \
+ do { \
+ int ofs = 0; \
+ /* blit opaque pixels on one line */ \
+ do { \
+ unsigned run; \
+ ofs += ((Ctype *)srcbuf)[0]; \
+ run = ((Ctype *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Ctype); \
+ if(run) { \
+ /* clip to left and right borders */ \
+ int cofs = ofs; \
+ int crun = run; \
+ if(left - cofs > 0) { \
+ crun -= left - cofs; \
+ cofs = left; \
+ } \
+ if(crun > right - cofs) \
+ crun = right - cofs; \
+ if(crun > 0) \
+ PIXEL_COPY(dstbuf + cofs * sizeof(Ptype), \
+ srcbuf + (cofs - ofs) * sizeof(Ptype), \
+ (unsigned)crun, sizeof(Ptype)); \
+ srcbuf += run * sizeof(Ptype); \
+ ofs += run; \
+ } else if(!ofs) \
+ return; \
+ } while(ofs < w); \
+ /* skip padding if necessary */ \
+ if(sizeof(Ptype) == 2) \
+ srcbuf += (uintptr_t)srcbuf & 2; \
+ /* blit translucent pixels on the same line */ \
+ ofs = 0; \
+ do { \
+ unsigned run; \
+ ofs += ((Uint16 *)srcbuf)[0]; \
+ run = ((Uint16 *)srcbuf)[1]; \
+ srcbuf += 4; \
+ if(run) { \
+ /* clip to left and right borders */ \
+ int cofs = ofs; \
+ int crun = run; \
+ if(left - cofs > 0) { \
+ crun -= left - cofs; \
+ cofs = left; \
+ } \
+ if(crun > right - cofs) \
+ crun = right - cofs; \
+ if(crun > 0) { \
+ Ptype *dst = (Ptype *)dstbuf + cofs; \
+ Uint32 *src = (Uint32 *)srcbuf + (cofs - ofs); \
+ int i; \
+ for(i = 0; i < crun; i++) \
+ do_blend(src[i], dst[i]); \
+ } \
+ srcbuf += run * 4; \
+ ofs += run; \
+ } \
+ } while(ofs < w); \
+ dstbuf += surf_dst->pitch; \
+ } while(--linecount); \
+ } while(0)
+
+ switch (df->BytesPerPixel) {
+ case 2:
+ if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0)
+ RLEALPHACLIPBLIT(Uint16, Uint8, BLIT_TRANSL_565);
+ else
+ RLEALPHACLIPBLIT(Uint16, Uint8, BLIT_TRANSL_555);
+ break;
+ case 4:
+ RLEALPHACLIPBLIT(Uint32, Uint16, BLIT_TRANSL_888);
+ break;
+ }
+}
+
+/* blit a pixel-alpha RLE surface */
+int SDLCALL
+SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
+ SDL_Surface * surf_dst, SDL_Rect * dstrect)
+{
+ int x, y;
+ int w = surf_src->w;
+ Uint8 *srcbuf, *dstbuf;
+ SDL_PixelFormat *df = surf_dst->format;
+
+ /* Lock the destination if necessary */
+ if (SDL_MUSTLOCK(surf_dst)) {
+ if (SDL_LockSurface(surf_dst) < 0) {
+ return -1;
+ }
+ }
+
+ x = dstrect->x;
+ y = dstrect->y;
+ dstbuf = (Uint8 *) surf_dst->pixels + y * surf_dst->pitch + x * df->BytesPerPixel;
+ srcbuf = (Uint8 *) surf_src->map->data + sizeof(RLEDestFormat);
+
+ {
+ /* skip lines at the top if necessary */
+ int vskip = srcrect->y;
+ if (vskip) {
+ int ofs;
+ if (df->BytesPerPixel == 2) {
+ /* the 16/32 interleaved format */
+ do {
+ /* skip opaque line */
+ ofs = 0;
+ do {
+ int run;
+ ofs += srcbuf[0];
+ run = srcbuf[1];
+ srcbuf += 2;
+ if (run) {
+ srcbuf += 2 * run;
+ ofs += run;
+ } else if (!ofs)
+ goto done;
+ } while (ofs < w);
+
+ /* skip padding */
+ srcbuf += (uintptr_t) srcbuf & 2;
+
+ /* skip translucent line */
+ ofs = 0;
+ do {
+ int run;
+ ofs += ((Uint16 *) srcbuf)[0];
+ run = ((Uint16 *) srcbuf)[1];
+ srcbuf += 4 * (run + 1);
+ ofs += run;
+ } while (ofs < w);
+ } while (--vskip);
+ } else {
+ /* the 32/32 interleaved format */
+ vskip <<= 1; /* opaque and translucent have same format */
+ do {
+ ofs = 0;
+ do {
+ int run;
+ ofs += ((Uint16 *) srcbuf)[0];
+ run = ((Uint16 *) srcbuf)[1];
+ srcbuf += 4;
+ if (run) {
+ srcbuf += 4 * run;
+ ofs += run;
+ } else if (!ofs)
+ goto done;
+ } while (ofs < w);
+ } while (--vskip);
+ }
+ }
+ }
+
+ /* if left or right edge clipping needed, call clip blit */
+ if (srcrect->x || srcrect->w != surf_src->w) {
+ RLEAlphaClipBlit(w, srcbuf, surf_dst, dstbuf, srcrect);
+ } else {
+
+ /*
+ * non-clipped blitter. Ptype is the destination pixel type,
+ * Ctype the translucent count type, and do_blend the
+ * macro to blend one pixel.
+ */
+#define RLEALPHABLIT(Ptype, Ctype, do_blend) \
+ do { \
+ int linecount = srcrect->h; \
+ do { \
+ int ofs = 0; \
+ /* blit opaque pixels on one line */ \
+ do { \
+ unsigned run; \
+ ofs += ((Ctype *)srcbuf)[0]; \
+ run = ((Ctype *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Ctype); \
+ if(run) { \
+ PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
+ run, sizeof(Ptype)); \
+ srcbuf += run * sizeof(Ptype); \
+ ofs += run; \
+ } else if(!ofs) \
+ goto done; \
+ } while(ofs < w); \
+ /* skip padding if necessary */ \
+ if(sizeof(Ptype) == 2) \
+ srcbuf += (uintptr_t)srcbuf & 2; \
+ /* blit translucent pixels on the same line */ \
+ ofs = 0; \
+ do { \
+ unsigned run; \
+ ofs += ((Uint16 *)srcbuf)[0]; \
+ run = ((Uint16 *)srcbuf)[1]; \
+ srcbuf += 4; \
+ if(run) { \
+ Ptype *dst = (Ptype *)dstbuf + ofs; \
+ unsigned i; \
+ for(i = 0; i < run; i++) { \
+ Uint32 src = *(Uint32 *)srcbuf; \
+ do_blend(src, *dst); \
+ srcbuf += 4; \
+ dst++; \
+ } \
+ ofs += run; \
+ } \
+ } while(ofs < w); \
+ dstbuf += surf_dst->pitch; \
+ } while(--linecount); \
+ } while(0)
+
+ switch (df->BytesPerPixel) {
+ case 2:
+ if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0
+ || df->Bmask == 0x07e0)
+ RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_565);
+ else
+ RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_555);
+ break;
+ case 4:
+ RLEALPHABLIT(Uint32, Uint16, BLIT_TRANSL_888);
+ break;
+ }
+ }
+
+ done:
+ /* Unlock the destination if necessary */
+ if (SDL_MUSTLOCK(surf_dst)) {
+ SDL_UnlockSurface(surf_dst);
+ }
+ return 0;
+}
+
+/*
+ * Auxiliary functions:
+ * The encoding functions take 32bpp rgb + a, and
+ * return the number of bytes copied to the destination.
+ * The decoding functions copy to 32bpp rgb + a, and
+ * return the number of bytes copied from the source.
+ * These are only used in the encoder and un-RLE code and are therefore not
+ * highly optimised.
+ */
+
+/* encode 32bpp rgb + a into 16bpp rgb, losing alpha */
+static int
+copy_opaque_16(void *dst, Uint32 * src, int n,
+ SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint16 *d = dst;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b;
+ RGB_FROM_PIXEL(*src, sfmt, r, g, b);
+ PIXEL_FROM_RGB(*d, dfmt, r, g, b);
+ src++;
+ d++;
+ }
+ return n * 2;
+}
+
+/* decode opaque pixels from 16bpp to 32bpp rgb + a */
+static int
+uncopy_opaque_16(Uint32 * dst, void *src, int n,
+ RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint16 *s = src;
+ unsigned alpha = dfmt->Amask ? 255 : 0;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b;
+ RGB_FROM_PIXEL(*s, sfmt, r, g, b);
+ PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, alpha);
+ s++;
+ dst++;
+ }
+ return n * 2;
+}
+
+
+
+/* encode 32bpp rgb + a into 32bpp G0RAB format for blitting into 565 */
+static int
+copy_transl_565(void *dst, Uint32 * src, int n,
+ SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint32 *d = dst;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b, a;
+ Uint16 pix;
+ RGBA_FROM_8888(*src, sfmt, r, g, b, a);
+ PIXEL_FROM_RGB(pix, dfmt, r, g, b);
+ *d = ((pix & 0x7e0) << 16) | (pix & 0xf81f) | ((a << 2) & 0x7e0);
+ src++;
+ d++;
+ }
+ return n * 4;
+}
+
+/* encode 32bpp rgb + a into 32bpp G0RAB format for blitting into 555 */
+static int
+copy_transl_555(void *dst, Uint32 * src, int n,
+ SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint32 *d = dst;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b, a;
+ Uint16 pix;
+ RGBA_FROM_8888(*src, sfmt, r, g, b, a);
+ PIXEL_FROM_RGB(pix, dfmt, r, g, b);
+ *d = ((pix & 0x3e0) << 16) | (pix & 0xfc1f) | ((a << 2) & 0x3e0);
+ src++;
+ d++;
+ }
+ return n * 4;
+}
+
+/* decode translucent pixels from 32bpp GORAB to 32bpp rgb + a */
+static int
+uncopy_transl_16(Uint32 * dst, void *src, int n,
+ RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint32 *s = src;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b, a;
+ Uint32 pix = *s++;
+ a = (pix & 0x3e0) >> 2;
+ pix = (pix & ~0x3e0) | pix >> 16;
+ RGB_FROM_PIXEL(pix, sfmt, r, g, b);
+ PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);
+ dst++;
+ }
+ return n * 4;
+}
+
+/* encode 32bpp rgba into 32bpp rgba, keeping alpha (dual purpose) */
+static int
+copy_32(void *dst, Uint32 * src, int n,
+ SDL_PixelFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint32 *d = dst;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b, a;
+ RGBA_FROM_8888(*src, sfmt, r, g, b, a);
+ RLEPIXEL_FROM_RGBA(*d, dfmt, r, g, b, a);
+ d++;
+ src++;
+ }
+ return n * 4;
+}
+
+/* decode 32bpp rgba into 32bpp rgba, keeping alpha (dual purpose) */
+static int
+uncopy_32(Uint32 * dst, void *src, int n,
+ RLEDestFormat * sfmt, SDL_PixelFormat * dfmt)
+{
+ int i;
+ Uint32 *s = src;
+ for (i = 0; i < n; i++) {
+ unsigned r, g, b, a;
+ Uint32 pixel = *s++;
+ RGB_FROM_PIXEL(pixel, sfmt, r, g, b);
+ a = pixel >> 24;
+ PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);
+ dst++;
+ }
+ return n * 4;
+}
+
+#define ISOPAQUE(pixel, fmt) ((((pixel) & fmt->Amask) >> fmt->Ashift) == 255)
+
+#define ISTRANSL(pixel, fmt) \
+ ((unsigned)((((pixel) & fmt->Amask) >> fmt->Ashift) - 1U) < 254U)
+
+/* convert surface to be quickly alpha-blittable onto dest, if possible */
+static int
+RLEAlphaSurface(SDL_Surface * surface)
+{
+ SDL_Surface *dest;
+ SDL_PixelFormat *df;
+ int maxsize = 0;
+ int max_opaque_run;
+ int max_transl_run = 65535;
+ unsigned masksum;
+ Uint8 *rlebuf, *dst;
+ int (*copy_opaque) (void *, Uint32 *, int,
+ SDL_PixelFormat *, SDL_PixelFormat *);
+ int (*copy_transl) (void *, Uint32 *, int,
+ SDL_PixelFormat *, SDL_PixelFormat *);
+
+ dest = surface->map->dst;
+ if (!dest)
+ return -1;
+ df = dest->format;
+ if (surface->format->BitsPerPixel != 32)
+ return -1; /* only 32bpp source supported */
+
+ /* find out whether the destination is one we support,
+ and determine the max size of the encoded result */
+ masksum = df->Rmask | df->Gmask | df->Bmask;
+ switch (df->BytesPerPixel) {
+ case 2:
+ /* 16bpp: only support 565 and 555 formats */
+ switch (masksum) {
+ case 0xffff:
+ if (df->Gmask == 0x07e0
+ || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
+ copy_opaque = copy_opaque_16;
+ copy_transl = copy_transl_565;
+ } else
+ return -1;
+ break;
+ case 0x7fff:
+ if (df->Gmask == 0x03e0
+ || df->Rmask == 0x03e0 || df->Bmask == 0x03e0) {
+ copy_opaque = copy_opaque_16;
+ copy_transl = copy_transl_555;
+ } else
+ return -1;
+ break;
+ default:
+ return -1;
+ }
+ max_opaque_run = 255; /* runs stored as bytes */
+
+ /* worst case is alternating opaque and translucent pixels,
+ with room for alignment padding between lines */
+ maxsize = surface->h * (2 + (4 + 2) * (surface->w + 1)) + 2;
+ break;
+ case 4:
+ if (masksum != 0x00ffffff)
+ return -1; /* requires unused high byte */
+ copy_opaque = copy_32;
+ copy_transl = copy_32;
+ max_opaque_run = 255; /* runs stored as short ints */
+
+ /* worst case is alternating opaque and translucent pixels */
+ maxsize = surface->h * 2 * 4 * (surface->w + 1) + 4;
+ break;
+ default:
+ return -1; /* anything else unsupported right now */
+ }
+
+ maxsize += sizeof(RLEDestFormat);
+ rlebuf = (Uint8 *) SDL_malloc(maxsize);
+ if (!rlebuf) {
+ return SDL_OutOfMemory();
+ }
+ {
+ /* save the destination format so we can undo the encoding later */
+ RLEDestFormat *r = (RLEDestFormat *) rlebuf;
+ r->BytesPerPixel = df->BytesPerPixel;
+ r->Rmask = df->Rmask;
+ r->Gmask = df->Gmask;
+ r->Bmask = df->Bmask;
+ r->Amask = df->Amask;
+ r->Rloss = df->Rloss;
+ r->Gloss = df->Gloss;
+ r->Bloss = df->Bloss;
+ r->Aloss = df->Aloss;
+ r->Rshift = df->Rshift;
+ r->Gshift = df->Gshift;
+ r->Bshift = df->Bshift;
+ r->Ashift = df->Ashift;
+ }
+ dst = rlebuf + sizeof(RLEDestFormat);
+
+ /* Do the actual encoding */
+ {
+ int x, y;
+ int h = surface->h, w = surface->w;
+ SDL_PixelFormat *sf = surface->format;
+ Uint32 *src = (Uint32 *) surface->pixels;
+ Uint8 *lastline = dst; /* end of last non-blank line */
+
+ /* opaque counts are 8 or 16 bits, depending on target depth */
+#define ADD_OPAQUE_COUNTS(n, m) \
+ if(df->BytesPerPixel == 4) { \
+ ((Uint16 *)dst)[0] = n; \
+ ((Uint16 *)dst)[1] = m; \
+ dst += 4; \
+ } else { \
+ dst[0] = n; \
+ dst[1] = m; \
+ dst += 2; \
+ }
+
+ /* translucent counts are always 16 bit */
+#define ADD_TRANSL_COUNTS(n, m) \
+ (((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)
+
+ for (y = 0; y < h; y++) {
+ int runstart, skipstart;
+ int blankline = 0;
+ /* First encode all opaque pixels of a scan line */
+ x = 0;
+ do {
+ int run, skip, len;
+ skipstart = x;
+ while (x < w && !ISOPAQUE(src[x], sf))
+ x++;
+ runstart = x;
+ while (x < w && ISOPAQUE(src[x], sf))
+ x++;
+ skip = runstart - skipstart;
+ if (skip == w)
+ blankline = 1;
+ run = x - runstart;
+ while (skip > max_opaque_run) {
+ ADD_OPAQUE_COUNTS(max_opaque_run, 0);
+ skip -= max_opaque_run;
+ }
+ len = MIN(run, max_opaque_run);
+ ADD_OPAQUE_COUNTS(skip, len);
+ dst += copy_opaque(dst, src + runstart, len, sf, df);
+ runstart += len;
+ run -= len;
+ while (run) {
+ len = MIN(run, max_opaque_run);
+ ADD_OPAQUE_COUNTS(0, len);
+ dst += copy_opaque(dst, src + runstart, len, sf, df);
+ runstart += len;
+ run -= len;
+ }
+ } while (x < w);
+
+ /* Make sure the next output address is 32-bit aligned */
+ dst += (uintptr_t) dst & 2;
+
+ /* Next, encode all translucent pixels of the same scan line */
+ x = 0;
+ do {
+ int run, skip, len;
+ skipstart = x;
+ while (x < w && !ISTRANSL(src[x], sf))
+ x++;
+ runstart = x;
+ while (x < w && ISTRANSL(src[x], sf))
+ x++;
+ skip = runstart - skipstart;
+ blankline &= (skip == w);
+ run = x - runstart;
+ while (skip > max_transl_run) {
+ ADD_TRANSL_COUNTS(max_transl_run, 0);
+ skip -= max_transl_run;
+ }
+ len = MIN(run, max_transl_run);
+ ADD_TRANSL_COUNTS(skip, len);
+ dst += copy_transl(dst, src + runstart, len, sf, df);
+ runstart += len;
+ run -= len;
+ while (run) {
+ len = MIN(run, max_transl_run);
+ ADD_TRANSL_COUNTS(0, len);
+ dst += copy_transl(dst, src + runstart, len, sf, df);
+ runstart += len;
+ run -= len;
+ }
+ if (!blankline)
+ lastline = dst;
+ } while (x < w);
+
+ src += surface->pitch >> 2;
+ }
+ dst = lastline; /* back up past trailing blank lines */
+ ADD_OPAQUE_COUNTS(0, 0);
+ }
+
+#undef ADD_OPAQUE_COUNTS
+#undef ADD_TRANSL_COUNTS
+
+ /* Now that we have it encoded, release the original pixels */
+ if (!(surface->flags & SDL_PREALLOC)) {
+ SDL_free(surface->pixels);
+ surface->pixels = NULL;
+ }
+
+ /* realloc the buffer to release unused memory */
+ {
+ Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
+ if (!p)
+ p = rlebuf;
+ surface->map->data = p;
+ }
+
+ return 0;
+}
+
+static Uint32
+getpix_8(Uint8 * srcbuf)
+{
+ return *srcbuf;
+}
+
+static Uint32
+getpix_16(Uint8 * srcbuf)
+{
+ return *(Uint16 *) srcbuf;
+}
+
+static Uint32
+getpix_24(Uint8 * srcbuf)
+{
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ return srcbuf[0] + (srcbuf[1] << 8) + (srcbuf[2] << 16);
+#else
+ return (srcbuf[0] << 16) + (srcbuf[1] << 8) + srcbuf[2];
+#endif
+}
+
+static Uint32
+getpix_32(Uint8 * srcbuf)
+{
+ return *(Uint32 *) srcbuf;
+}
+
+typedef Uint32(*getpix_func) (Uint8 *);
+
+static const getpix_func getpixes[4] = {
+ getpix_8, getpix_16, getpix_24, getpix_32
+};
+
+static int
+RLEColorkeySurface(SDL_Surface * surface)
+{
+ Uint8 *rlebuf, *dst;
+ int maxn;
+ int y;
+ Uint8 *srcbuf, *lastline;
+ int maxsize = 0;
+ const int bpp = surface->format->BytesPerPixel;
+ getpix_func getpix;
+ Uint32 ckey, rgbmask;
+ int w, h;
+
+ /* calculate the worst case size for the compressed surface */
+ switch (bpp) {
+ case 1:
+ /* worst case is alternating opaque and transparent pixels,
+ starting with an opaque pixel */
+ maxsize = surface->h * 3 * (surface->w / 2 + 1) + 2;
+ break;
+ case 2:
+ case 3:
+ /* worst case is solid runs, at most 255 pixels wide */
+ maxsize = surface->h * (2 * (surface->w / 255 + 1)
+ + surface->w * bpp) + 2;
+ break;
+ case 4:
+ /* worst case is solid runs, at most 65535 pixels wide */
+ maxsize = surface->h * (4 * (surface->w / 65535 + 1)
+ + surface->w * 4) + 4;
+ break;
+
+ default:
+ return -1;
+ }
+
+ rlebuf = (Uint8 *) SDL_malloc(maxsize);
+ if (rlebuf == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Set up the conversion */
+ srcbuf = (Uint8 *) surface->pixels;
+ maxn = bpp == 4 ? 65535 : 255;
+ dst = rlebuf;
+ rgbmask = ~surface->format->Amask;
+ ckey = surface->map->info.colorkey & rgbmask;
+ lastline = dst;
+ getpix = getpixes[bpp - 1];
+ w = surface->w;
+ h = surface->h;
+
+#define ADD_COUNTS(n, m) \
+ if(bpp == 4) { \
+ ((Uint16 *)dst)[0] = n; \
+ ((Uint16 *)dst)[1] = m; \
+ dst += 4; \
+ } else { \
+ dst[0] = n; \
+ dst[1] = m; \
+ dst += 2; \
+ }
+
+ for (y = 0; y < h; y++) {
+ int x = 0;
+ int blankline = 0;
+ do {
+ int run, skip, len;
+ int runstart;
+ int skipstart = x;
+
+ /* find run of transparent, then opaque pixels */
+ while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) == ckey)
+ x++;
+ runstart = x;
+ while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) != ckey)
+ x++;
+ skip = runstart - skipstart;
+ if (skip == w)
+ blankline = 1;
+ run = x - runstart;
+
+ /* encode segment */
+ while (skip > maxn) {
+ ADD_COUNTS(maxn, 0);
+ skip -= maxn;
+ }
+ len = MIN(run, maxn);
+ ADD_COUNTS(skip, len);
+ SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
+ dst += len * bpp;
+ run -= len;
+ runstart += len;
+ while (run) {
+ len = MIN(run, maxn);
+ ADD_COUNTS(0, len);
+ SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
+ dst += len * bpp;
+ runstart += len;
+ run -= len;
+ }
+ if (!blankline)
+ lastline = dst;
+ } while (x < w);
+
+ srcbuf += surface->pitch;
+ }
+ dst = lastline; /* back up bast trailing blank lines */
+ ADD_COUNTS(0, 0);
+
+#undef ADD_COUNTS
+
+ /* Now that we have it encoded, release the original pixels */
+ if (!(surface->flags & SDL_PREALLOC)) {
+ SDL_free(surface->pixels);
+ surface->pixels = NULL;
+ }
+
+ /* realloc the buffer to release unused memory */
+ {
+ /* If realloc returns NULL, the original block is left intact */
+ Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
+ if (!p)
+ p = rlebuf;
+ surface->map->data = p;
+ }
+
+ return 0;
+}
+
+int
+SDL_RLESurface(SDL_Surface * surface)
+{
+ int flags;
+
+ /* Clear any previous RLE conversion */
+ if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
+ SDL_UnRLESurface(surface, 1);
+ }
+
+ /* We don't support RLE encoding of bitmaps */
+ if (surface->format->BitsPerPixel < 8) {
+ return -1;
+ }
+
+ /* Make sure the pixels are available */
+ if (!surface->pixels) {
+ return -1;
+ }
+
+ /* If we don't have colorkey or blending, nothing to do... */
+ flags = surface->map->info.flags;
+ if (!(flags & (SDL_COPY_COLORKEY | SDL_COPY_BLEND))) {
+ return -1;
+ }
+
+ /* Pass on combinations not supported */
+ if ((flags & SDL_COPY_MODULATE_COLOR) ||
+ ((flags & SDL_COPY_MODULATE_ALPHA) && surface->format->Amask) ||
+ (flags & (SDL_COPY_ADD | SDL_COPY_MOD)) ||
+ (flags & SDL_COPY_NEAREST)) {
+ return -1;
+ }
+
+ /* Encode and set up the blit */
+ if (!surface->format->Amask || !(flags & SDL_COPY_BLEND)) {
+ if (!surface->map->identity) {
+ return -1;
+ }
+ if (RLEColorkeySurface(surface) < 0) {
+ return -1;
+ }
+ surface->map->blit = SDL_RLEBlit;
+ surface->map->info.flags |= SDL_COPY_RLE_COLORKEY;
+ } else {
+ if (RLEAlphaSurface(surface) < 0) {
+ return -1;
+ }
+ surface->map->blit = SDL_RLEAlphaBlit;
+ surface->map->info.flags |= SDL_COPY_RLE_ALPHAKEY;
+ }
+
+ /* The surface is now accelerated */
+ surface->flags |= SDL_RLEACCEL;
+
+ return (0);
+}
+
+/*
+ * Un-RLE a surface with pixel alpha
+ * This may not give back exactly the image before RLE-encoding; all
+ * completely transparent pixels will be lost, and color and alpha depth
+ * may have been reduced (when encoding for 16bpp targets).
+ */
+static SDL_bool
+UnRLEAlpha(SDL_Surface * surface)
+{
+ Uint8 *srcbuf;
+ Uint32 *dst;
+ SDL_PixelFormat *sf = surface->format;
+ RLEDestFormat *df = surface->map->data;
+ int (*uncopy_opaque) (Uint32 *, void *, int,
+ RLEDestFormat *, SDL_PixelFormat *);
+ int (*uncopy_transl) (Uint32 *, void *, int,
+ RLEDestFormat *, SDL_PixelFormat *);
+ int w = surface->w;
+ int bpp = df->BytesPerPixel;
+
+ if (bpp == 2) {
+ uncopy_opaque = uncopy_opaque_16;
+ uncopy_transl = uncopy_transl_16;
+ } else {
+ uncopy_opaque = uncopy_transl = uncopy_32;
+ }
+
+ surface->pixels = SDL_malloc(surface->h * surface->pitch);
+ if (!surface->pixels) {
+ return (SDL_FALSE);
+ }
+ /* fill background with transparent pixels */
+ SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
+
+ dst = surface->pixels;
+ srcbuf = (Uint8 *) (df + 1);
+ for (;;) {
+ /* copy opaque pixels */
+ int ofs = 0;
+ do {
+ unsigned run;
+ if (bpp == 2) {
+ ofs += srcbuf[0];
+ run = srcbuf[1];
+ srcbuf += 2;
+ } else {
+ ofs += ((Uint16 *) srcbuf)[0];
+ run = ((Uint16 *) srcbuf)[1];
+ srcbuf += 4;
+ }
+ if (run) {
+ srcbuf += uncopy_opaque(dst + ofs, srcbuf, run, df, sf);
+ ofs += run;
+ } else if (!ofs)
+ return (SDL_TRUE);
+ } while (ofs < w);
+
+ /* skip padding if needed */
+ if (bpp == 2)
+ srcbuf += (uintptr_t) srcbuf & 2;
+
+ /* copy translucent pixels */
+ ofs = 0;
+ do {
+ unsigned run;
+ ofs += ((Uint16 *) srcbuf)[0];
+ run = ((Uint16 *) srcbuf)[1];
+ srcbuf += 4;
+ if (run) {
+ srcbuf += uncopy_transl(dst + ofs, srcbuf, run, df, sf);
+ ofs += run;
+ }
+ } while (ofs < w);
+ dst += surface->pitch >> 2;
+ }
+ /* Make the compiler happy */
+ return (SDL_TRUE);
+}
+
+void
+SDL_UnRLESurface(SDL_Surface * surface, int recode)
+{
+ if (surface->flags & SDL_RLEACCEL) {
+ surface->flags &= ~SDL_RLEACCEL;
+
+ if (recode && !(surface->flags & SDL_PREALLOC)) {
+ if (surface->map->info.flags & SDL_COPY_RLE_COLORKEY) {
+ SDL_Rect full;
+
+ /* re-create the original surface */
+ surface->pixels = SDL_malloc(surface->h * surface->pitch);
+ if (!surface->pixels) {
+ /* Oh crap... */
+ surface->flags |= SDL_RLEACCEL;
+ return;
+ }
+
+ /* fill it with the background color */
+ SDL_FillRect(surface, NULL, surface->map->info.colorkey);
+
+ /* now render the encoded surface */
+ full.x = full.y = 0;
+ full.w = surface->w;
+ full.h = surface->h;
+ SDL_RLEBlit(surface, &full, surface, &full);
+ } else {
+ if (!UnRLEAlpha(surface)) {
+ /* Oh crap... */
+ surface->flags |= SDL_RLEACCEL;
+ return;
+ }
+ }
+ }
+ surface->map->info.flags &=
+ ~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
+
+ SDL_free(surface->map->data);
+ surface->map->data = NULL;
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_RLEaccel_c.h b/src/3rdparty/SDL2/src/video/SDL_RLEaccel_c.h
new file mode 100644
index 0000000..fe41835
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_RLEaccel_c.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Useful functions and variables from SDL_RLEaccel.c */
+
+extern int SDL_RLESurface(SDL_Surface * surface);
+extern int SDLCALL SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+extern void SDL_UnRLESurface(SDL_Surface * surface, int recode);
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit.c b/src/3rdparty/SDL2/src/video/SDL_blit.c
new file mode 100644
index 0000000..0d4e2fd
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit.c
@@ -0,0 +1,296 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_sysvideo.h"
+#include "SDL_blit.h"
+#include "SDL_blit_auto.h"
+#include "SDL_blit_copy.h"
+#include "SDL_blit_slow.h"
+#include "SDL_RLEaccel_c.h"
+#include "SDL_pixels_c.h"
+
+/* The general purpose software blit routine */
+static int SDLCALL
+SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect)
+{
+ int okay;
+ int src_locked;
+ int dst_locked;
+
+ /* Everything is okay at the beginning... */
+ okay = 1;
+
+ /* Lock the destination if it's in hardware */
+ dst_locked = 0;
+ if (SDL_MUSTLOCK(dst)) {
+ if (SDL_LockSurface(dst) < 0) {
+ okay = 0;
+ } else {
+ dst_locked = 1;
+ }
+ }
+ /* Lock the source if it's in hardware */
+ src_locked = 0;
+ if (SDL_MUSTLOCK(src)) {
+ if (SDL_LockSurface(src) < 0) {
+ okay = 0;
+ } else {
+ src_locked = 1;
+ }
+ }
+
+ /* Set up source and destination buffer pointers, and BLIT! */
+ if (okay && !SDL_RectEmpty(srcrect)) {
+ SDL_BlitFunc RunBlit;
+ SDL_BlitInfo *info = &src->map->info;
+
+ /* Set up the blit information */
+ info->src = (Uint8 *) src->pixels +
+ (Uint16) srcrect->y * src->pitch +
+ (Uint16) srcrect->x * info->src_fmt->BytesPerPixel;
+ info->src_w = srcrect->w;
+ info->src_h = srcrect->h;
+ info->src_pitch = src->pitch;
+ info->src_skip =
+ info->src_pitch - info->src_w * info->src_fmt->BytesPerPixel;
+ info->dst =
+ (Uint8 *) dst->pixels + (Uint16) dstrect->y * dst->pitch +
+ (Uint16) dstrect->x * info->dst_fmt->BytesPerPixel;
+ info->dst_w = dstrect->w;
+ info->dst_h = dstrect->h;
+ info->dst_pitch = dst->pitch;
+ info->dst_skip =
+ info->dst_pitch - info->dst_w * info->dst_fmt->BytesPerPixel;
+ RunBlit = (SDL_BlitFunc) src->map->data;
+
+ /* Run the actual software blit */
+ RunBlit(info);
+ }
+
+ /* We need to unlock the surfaces if they're locked */
+ if (dst_locked) {
+ SDL_UnlockSurface(dst);
+ }
+ if (src_locked) {
+ SDL_UnlockSurface(src);
+ }
+ /* Blit is done! */
+ return (okay ? 0 : -1);
+}
+
+#ifdef __MACOSX__
+#include <sys/sysctl.h>
+
+static SDL_bool
+SDL_UseAltivecPrefetch()
+{
+ const char key[] = "hw.l3cachesize";
+ u_int64_t result = 0;
+ size_t typeSize = sizeof(result);
+
+ if (sysctlbyname(key, &result, &typeSize, NULL, 0) == 0 && result > 0) {
+ return SDL_TRUE;
+ } else {
+ return SDL_FALSE;
+ }
+}
+#else
+static SDL_bool
+SDL_UseAltivecPrefetch()
+{
+ /* Just guess G4 */
+ return SDL_TRUE;
+}
+#endif /* __MACOSX__ */
+
+static SDL_BlitFunc
+SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags,
+ SDL_BlitFuncEntry * entries)
+{
+ int i, flagcheck;
+ static Uint32 features = 0xffffffff;
+
+ /* Get the available CPU features */
+ if (features == 0xffffffff) {
+ const char *override = SDL_getenv("SDL_BLIT_CPU_FEATURES");
+
+ features = SDL_CPU_ANY;
+
+ /* Allow an override for testing .. */
+ if (override) {
+ SDL_sscanf(override, "%u", &features);
+ } else {
+ if (SDL_HasMMX()) {
+ features |= SDL_CPU_MMX;
+ }
+ if (SDL_Has3DNow()) {
+ features |= SDL_CPU_3DNOW;
+ }
+ if (SDL_HasSSE()) {
+ features |= SDL_CPU_SSE;
+ }
+ if (SDL_HasSSE2()) {
+ features |= SDL_CPU_SSE2;
+ }
+ if (SDL_HasAltiVec()) {
+ if (SDL_UseAltivecPrefetch()) {
+ features |= SDL_CPU_ALTIVEC_PREFETCH;
+ } else {
+ features |= SDL_CPU_ALTIVEC_NOPREFETCH;
+ }
+ }
+ }
+ }
+
+ for (i = 0; entries[i].func; ++i) {
+ /* Check for matching pixel formats */
+ if (src_format != entries[i].src_format) {
+ continue;
+ }
+ if (dst_format != entries[i].dst_format) {
+ continue;
+ }
+
+ /* Check modulation flags */
+ flagcheck =
+ (flags & (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA));
+ if ((flagcheck & entries[i].flags) != flagcheck) {
+ continue;
+ }
+
+ /* Check blend flags */
+ flagcheck =
+ (flags &
+ (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD));
+ if ((flagcheck & entries[i].flags) != flagcheck) {
+ continue;
+ }
+
+ /* Check colorkey flag */
+ flagcheck = (flags & SDL_COPY_COLORKEY);
+ if ((flagcheck & entries[i].flags) != flagcheck) {
+ continue;
+ }
+
+ /* Check scaling flags */
+ flagcheck = (flags & SDL_COPY_NEAREST);
+ if ((flagcheck & entries[i].flags) != flagcheck) {
+ continue;
+ }
+
+ /* Check CPU features */
+ flagcheck = entries[i].cpu;
+ if ((flagcheck & features) != flagcheck) {
+ continue;
+ }
+
+ /* We found the best one! */
+ return entries[i].func;
+ }
+ return NULL;
+}
+
+/* Figure out which of many blit routines to set up on a surface */
+int
+SDL_CalculateBlit(SDL_Surface * surface)
+{
+ SDL_BlitFunc blit = NULL;
+ SDL_BlitMap *map = surface->map;
+ SDL_Surface *dst = map->dst;
+
+ /* We don't currently support blitting to < 8 bpp surfaces */
+ if (dst->format->BitsPerPixel < 8) {
+ SDL_InvalidateMap(map);
+ return SDL_SetError("Blit combination not supported");
+ }
+
+ /* Clean everything out to start */
+ if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
+ SDL_UnRLESurface(surface, 1);
+ }
+ map->blit = SDL_SoftBlit;
+ map->info.src_fmt = surface->format;
+ map->info.src_pitch = surface->pitch;
+ map->info.dst_fmt = dst->format;
+ map->info.dst_pitch = dst->pitch;
+
+ /* See if we can do RLE acceleration */
+ if (map->info.flags & SDL_COPY_RLE_DESIRED) {
+ if (SDL_RLESurface(surface) == 0) {
+ return 0;
+ }
+ }
+
+ /* Choose a standard blit function */
+ if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) {
+ blit = SDL_BlitCopy;
+ } else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) {
+ /* Greater than 8 bits per channel not supported yet */
+ SDL_InvalidateMap(map);
+ return SDL_SetError("Blit combination not supported");
+ } else if (surface->format->BitsPerPixel < 8 &&
+ SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
+ blit = SDL_CalculateBlit0(surface);
+ } else if (surface->format->BytesPerPixel == 1 &&
+ SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
+ blit = SDL_CalculateBlit1(surface);
+ } else if (map->info.flags & SDL_COPY_BLEND) {
+ blit = SDL_CalculateBlitA(surface);
+ } else {
+ blit = SDL_CalculateBlitN(surface);
+ }
+ if (blit == NULL) {
+ Uint32 src_format = surface->format->format;
+ Uint32 dst_format = dst->format->format;
+
+ blit =
+ SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags,
+ SDL_GeneratedBlitFuncTable);
+ }
+#ifndef TEST_SLOW_BLIT
+ if (blit == NULL)
+#endif
+ {
+ Uint32 src_format = surface->format->format;
+ Uint32 dst_format = dst->format->format;
+
+ if (!SDL_ISPIXELFORMAT_INDEXED(src_format) &&
+ !SDL_ISPIXELFORMAT_FOURCC(src_format) &&
+ !SDL_ISPIXELFORMAT_INDEXED(dst_format) &&
+ !SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
+ blit = SDL_Blit_Slow;
+ }
+ }
+ map->data = blit;
+
+ /* Make sure we have a blit function */
+ if (blit == NULL) {
+ SDL_InvalidateMap(map);
+ return SDL_SetError("Blit combination not supported");
+ }
+
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit.h b/src/3rdparty/SDL2/src/video/SDL_blit.h
new file mode 100644
index 0000000..ca10534
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit.h
@@ -0,0 +1,553 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_blit_h_
+#define SDL_blit_h_
+
+#include "SDL_cpuinfo.h"
+#include "SDL_endian.h"
+#include "SDL_surface.h"
+
+/* Table to do pixel byte expansion */
+extern Uint8* SDL_expand_byte[9];
+
+/* SDL blit copy flags */
+#define SDL_COPY_MODULATE_COLOR 0x00000001
+#define SDL_COPY_MODULATE_ALPHA 0x00000002
+#define SDL_COPY_BLEND 0x00000010
+#define SDL_COPY_ADD 0x00000020
+#define SDL_COPY_MOD 0x00000040
+#define SDL_COPY_COLORKEY 0x00000100
+#define SDL_COPY_NEAREST 0x00000200
+#define SDL_COPY_RLE_DESIRED 0x00001000
+#define SDL_COPY_RLE_COLORKEY 0x00002000
+#define SDL_COPY_RLE_ALPHAKEY 0x00004000
+#define SDL_COPY_RLE_MASK (SDL_COPY_RLE_DESIRED|SDL_COPY_RLE_COLORKEY|SDL_COPY_RLE_ALPHAKEY)
+
+/* SDL blit CPU flags */
+#define SDL_CPU_ANY 0x00000000
+#define SDL_CPU_MMX 0x00000001
+#define SDL_CPU_3DNOW 0x00000002
+#define SDL_CPU_SSE 0x00000004
+#define SDL_CPU_SSE2 0x00000008
+#define SDL_CPU_ALTIVEC_PREFETCH 0x00000010
+#define SDL_CPU_ALTIVEC_NOPREFETCH 0x00000020
+
+typedef struct
+{
+ Uint8 *src;
+ int src_w, src_h;
+ int src_pitch;
+ int src_skip;
+ Uint8 *dst;
+ int dst_w, dst_h;
+ int dst_pitch;
+ int dst_skip;
+ SDL_PixelFormat *src_fmt;
+ SDL_PixelFormat *dst_fmt;
+ Uint8 *table;
+ int flags;
+ Uint32 colorkey;
+ Uint8 r, g, b, a;
+} SDL_BlitInfo;
+
+typedef void (*SDL_BlitFunc) (SDL_BlitInfo *info);
+
+
+typedef struct
+{
+ Uint32 src_format;
+ Uint32 dst_format;
+ int flags;
+ int cpu;
+ SDL_BlitFunc func;
+} SDL_BlitFuncEntry;
+
+/* Blit mapping definition */
+typedef struct SDL_BlitMap
+{
+ SDL_Surface *dst;
+ int identity;
+ SDL_blit blit;
+ void *data;
+ SDL_BlitInfo info;
+
+ /* the version count matches the destination; mismatch indicates
+ an invalid mapping */
+ Uint32 dst_palette_version;
+ Uint32 src_palette_version;
+} SDL_BlitMap;
+
+/* Functions found in SDL_blit.c */
+extern int SDL_CalculateBlit(SDL_Surface * surface);
+
+/* Functions found in SDL_blit_*.c */
+extern SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface);
+extern SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface * surface);
+extern SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface * surface);
+extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
+
+/*
+ * Useful macros for blitting routines
+ */
+
+#if defined(__GNUC__)
+#define DECLARE_ALIGNED(t,v,a) t __attribute__((aligned(a))) v
+#elif defined(_MSC_VER)
+#define DECLARE_ALIGNED(t,v,a) __declspec(align(a)) t v
+#else
+#define DECLARE_ALIGNED(t,v,a) t v
+#endif
+
+/* Load pixel of the specified format from a buffer and get its R-G-B values */
+#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b) \
+{ \
+ r = SDL_expand_byte[fmt->Rloss][((Pixel&fmt->Rmask)>>fmt->Rshift)]; \
+ g = SDL_expand_byte[fmt->Gloss][((Pixel&fmt->Gmask)>>fmt->Gshift)]; \
+ b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
+}
+#define RGB_FROM_RGB565(Pixel, r, g, b) \
+ { \
+ r = SDL_expand_byte[3][((Pixel&0xF800)>>11)]; \
+ g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)]; \
+ b = SDL_expand_byte[3][(Pixel&0x001F)]; \
+}
+#define RGB_FROM_RGB555(Pixel, r, g, b) \
+{ \
+ r = SDL_expand_byte[3][((Pixel&0x7C00)>>10)]; \
+ g = SDL_expand_byte[3][((Pixel&0x03E0)>>5)]; \
+ b = SDL_expand_byte[3][(Pixel&0x001F)]; \
+}
+#define RGB_FROM_RGB888(Pixel, r, g, b) \
+{ \
+ r = ((Pixel&0xFF0000)>>16); \
+ g = ((Pixel&0xFF00)>>8); \
+ b = (Pixel&0xFF); \
+}
+#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel) \
+do { \
+ switch (bpp) { \
+ case 1: \
+ Pixel = *((Uint8 *)(buf)); \
+ break; \
+ \
+ case 2: \
+ Pixel = *((Uint16 *)(buf)); \
+ break; \
+ \
+ case 3: { \
+ Uint8 *B = (Uint8 *)(buf); \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
+ } else { \
+ Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
+ } \
+ } \
+ break; \
+ \
+ case 4: \
+ Pixel = *((Uint32 *)(buf)); \
+ break; \
+ \
+ default: \
+ Pixel = 0; /* stop gcc complaints */ \
+ break; \
+ } \
+} while (0)
+
+#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b) \
+do { \
+ switch (bpp) { \
+ case 1: \
+ Pixel = *((Uint8 *)(buf)); \
+ RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
+ break; \
+ \
+ case 2: \
+ Pixel = *((Uint16 *)(buf)); \
+ RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
+ break; \
+ \
+ case 3: { \
+ Pixel = 0; \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ r = *((buf)+fmt->Rshift/8); \
+ g = *((buf)+fmt->Gshift/8); \
+ b = *((buf)+fmt->Bshift/8); \
+ } else { \
+ r = *((buf)+2-fmt->Rshift/8); \
+ g = *((buf)+2-fmt->Gshift/8); \
+ b = *((buf)+2-fmt->Bshift/8); \
+ } \
+ } \
+ break; \
+ \
+ case 4: \
+ Pixel = *((Uint32 *)(buf)); \
+ RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
+ break; \
+ \
+ default: \
+ /* stop gcc complaints */ \
+ Pixel = 0; \
+ r = g = b = 0; \
+ break; \
+ } \
+} while (0)
+
+/* Assemble R-G-B values into a specified pixel format and store them */
+#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \
+{ \
+ Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
+ ((g>>fmt->Gloss)<<fmt->Gshift)| \
+ ((b>>fmt->Bloss)<<fmt->Bshift)| \
+ fmt->Amask; \
+}
+#define RGB565_FROM_RGB(Pixel, r, g, b) \
+{ \
+ Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \
+}
+#define RGB555_FROM_RGB(Pixel, r, g, b) \
+{ \
+ Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3); \
+}
+#define RGB888_FROM_RGB(Pixel, r, g, b) \
+{ \
+ Pixel = (r<<16)|(g<<8)|b; \
+}
+#define ARGB8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (a<<24)|(r<<16)|(g<<8)|b; \
+}
+#define RGBA8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (r<<24)|(g<<16)|(b<<8)|a; \
+}
+#define ABGR8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (a<<24)|(b<<16)|(g<<8)|r; \
+}
+#define BGRA8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (b<<24)|(g<<16)|(r<<8)|a; \
+}
+#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ r = r ? ((r << 2) | 0x3) : 0; \
+ g = g ? ((g << 2) | 0x3) : 0; \
+ b = b ? ((b << 2) | 0x3) : 0; \
+ a = (a * 3) / 255; \
+ Pixel = (a<<30)|(r<<20)|(g<<10)|b; \
+}
+#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) \
+{ \
+ switch (bpp) { \
+ case 1: { \
+ Uint8 Pixel; \
+ \
+ PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
+ *((Uint8 *)(buf)) = Pixel; \
+ } \
+ break; \
+ \
+ case 2: { \
+ Uint16 Pixel; \
+ \
+ PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
+ *((Uint16 *)(buf)) = Pixel; \
+ } \
+ break; \
+ \
+ case 3: { \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ *((buf)+fmt->Rshift/8) = r; \
+ *((buf)+fmt->Gshift/8) = g; \
+ *((buf)+fmt->Bshift/8) = b; \
+ } else { \
+ *((buf)+2-fmt->Rshift/8) = r; \
+ *((buf)+2-fmt->Gshift/8) = g; \
+ *((buf)+2-fmt->Bshift/8) = b; \
+ } \
+ } \
+ break; \
+ \
+ case 4: { \
+ Uint32 Pixel; \
+ \
+ PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
+ *((Uint32 *)(buf)) = Pixel; \
+ } \
+ break; \
+ } \
+}
+
+/* FIXME: Should we rescale alpha into 0..255 here? */
+#define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a) \
+{ \
+ r = SDL_expand_byte[fmt->Rloss][((Pixel&fmt->Rmask)>>fmt->Rshift)]; \
+ g = SDL_expand_byte[fmt->Gloss][((Pixel&fmt->Gmask)>>fmt->Gshift)]; \
+ b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
+ a = SDL_expand_byte[fmt->Aloss][((Pixel&fmt->Amask)>>fmt->Ashift)]; \
+}
+#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a) \
+{ \
+ r = (Pixel&fmt->Rmask)>>fmt->Rshift; \
+ g = (Pixel&fmt->Gmask)>>fmt->Gshift; \
+ b = (Pixel&fmt->Bmask)>>fmt->Bshift; \
+ a = (Pixel&fmt->Amask)>>fmt->Ashift; \
+}
+#define RGBA_FROM_RGBA8888(Pixel, r, g, b, a) \
+{ \
+ r = (Pixel>>24); \
+ g = ((Pixel>>16)&0xFF); \
+ b = ((Pixel>>8)&0xFF); \
+ a = (Pixel&0xFF); \
+}
+#define RGBA_FROM_ARGB8888(Pixel, r, g, b, a) \
+{ \
+ r = ((Pixel>>16)&0xFF); \
+ g = ((Pixel>>8)&0xFF); \
+ b = (Pixel&0xFF); \
+ a = (Pixel>>24); \
+}
+#define RGBA_FROM_ABGR8888(Pixel, r, g, b, a) \
+{ \
+ r = (Pixel&0xFF); \
+ g = ((Pixel>>8)&0xFF); \
+ b = ((Pixel>>16)&0xFF); \
+ a = (Pixel>>24); \
+}
+#define RGBA_FROM_BGRA8888(Pixel, r, g, b, a) \
+{ \
+ r = ((Pixel>>8)&0xFF); \
+ g = ((Pixel>>16)&0xFF); \
+ b = (Pixel>>24); \
+ a = (Pixel&0xFF); \
+}
+#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a) \
+{ \
+ r = ((Pixel>>22)&0xFF); \
+ g = ((Pixel>>12)&0xFF); \
+ b = ((Pixel>>2)&0xFF); \
+ a = SDL_expand_byte[6][(Pixel>>30)]; \
+}
+#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a) \
+do { \
+ switch (bpp) { \
+ case 1: \
+ Pixel = *((Uint8 *)(buf)); \
+ RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
+ break; \
+ \
+ case 2: \
+ Pixel = *((Uint16 *)(buf)); \
+ RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
+ break; \
+ \
+ case 3: { \
+ Pixel = 0; \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ r = *((buf)+fmt->Rshift/8); \
+ g = *((buf)+fmt->Gshift/8); \
+ b = *((buf)+fmt->Bshift/8); \
+ } else { \
+ r = *((buf)+2-fmt->Rshift/8); \
+ g = *((buf)+2-fmt->Gshift/8); \
+ b = *((buf)+2-fmt->Bshift/8); \
+ } \
+ a = 0xFF; \
+ } \
+ break; \
+ \
+ case 4: \
+ Pixel = *((Uint32 *)(buf)); \
+ RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
+ break; \
+ \
+ default: \
+ /* stop gcc complaints */ \
+ Pixel = 0; \
+ r = g = b = a = 0; \
+ break; \
+ } \
+} while (0)
+
+/* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
+#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
+{ \
+ Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
+ ((g>>fmt->Gloss)<<fmt->Gshift)| \
+ ((b>>fmt->Bloss)<<fmt->Bshift)| \
+ ((a>>fmt->Aloss)<<fmt->Ashift); \
+}
+#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
+{ \
+ switch (bpp) { \
+ case 1: { \
+ Uint8 _pixel; \
+ \
+ PIXEL_FROM_RGBA(_pixel, fmt, r, g, b, a); \
+ *((Uint8 *)(buf)) = _pixel; \
+ } \
+ break; \
+ \
+ case 2: { \
+ Uint16 _pixel; \
+ \
+ PIXEL_FROM_RGBA(_pixel, fmt, r, g, b, a); \
+ *((Uint16 *)(buf)) = _pixel; \
+ } \
+ break; \
+ \
+ case 3: { \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ *((buf)+fmt->Rshift/8) = r; \
+ *((buf)+fmt->Gshift/8) = g; \
+ *((buf)+fmt->Bshift/8) = b; \
+ } else { \
+ *((buf)+2-fmt->Rshift/8) = r; \
+ *((buf)+2-fmt->Gshift/8) = g; \
+ *((buf)+2-fmt->Bshift/8) = b; \
+ } \
+ } \
+ break; \
+ \
+ case 4: { \
+ Uint32 _pixel; \
+ \
+ PIXEL_FROM_RGBA(_pixel, fmt, r, g, b, a); \
+ *((Uint32 *)(buf)) = _pixel; \
+ } \
+ break; \
+ } \
+}
+
+/* Blend the RGB values of two pixels with an alpha value */
+#define ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB) \
+do { \
+ dR = (Uint8)((((int)(sR-dR)*(int)A)/255)+dR); \
+ dG = (Uint8)((((int)(sG-dG)*(int)A)/255)+dG); \
+ dB = (Uint8)((((int)(sB-dB)*(int)A)/255)+dB); \
+} while(0)
+
+
+/* Blend the RGBA values of two pixels */
+#define ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA) \
+do { \
+ dR = (Uint8)((((int)(sR-dR)*(int)sA)/255)+dR); \
+ dG = (Uint8)((((int)(sG-dG)*(int)sA)/255)+dG); \
+ dB = (Uint8)((((int)(sB-dB)*(int)sA)/255)+dB); \
+ dA = (Uint8)((int)sA+dA-((int)sA*dA)/255); \
+} while(0)
+
+
+/* This is a very useful loop for optimizing blitters */
+#if defined(_MSC_VER) && (_MSC_VER == 1300)
+/* There's a bug in the Visual C++ 7 optimizer when compiling this code */
+#else
+#define USE_DUFFS_LOOP
+#endif
+#ifdef USE_DUFFS_LOOP
+
+/* 8-times unrolled loop */
+#define DUFFS_LOOP8(pixel_copy_increment, width) \
+{ int n = (width+7)/8; \
+ switch (width & 7) { \
+ case 0: do { pixel_copy_increment; /* fallthrough */ \
+ case 7: pixel_copy_increment; /* fallthrough */ \
+ case 6: pixel_copy_increment; /* fallthrough */ \
+ case 5: pixel_copy_increment; /* fallthrough */ \
+ case 4: pixel_copy_increment; /* fallthrough */ \
+ case 3: pixel_copy_increment; /* fallthrough */ \
+ case 2: pixel_copy_increment; /* fallthrough */ \
+ case 1: pixel_copy_increment; /* fallthrough */ \
+ } while ( --n > 0 ); \
+ } \
+}
+
+/* 4-times unrolled loop */
+#define DUFFS_LOOP4(pixel_copy_increment, width) \
+{ int n = (width+3)/4; \
+ switch (width & 3) { \
+ case 0: do { pixel_copy_increment; /* fallthrough */ \
+ case 3: pixel_copy_increment; /* fallthrough */ \
+ case 2: pixel_copy_increment; /* fallthrough */ \
+ case 1: pixel_copy_increment; /* fallthrough */ \
+ } while (--n > 0); \
+ } \
+}
+
+/* Use the 8-times version of the loop by default */
+#define DUFFS_LOOP(pixel_copy_increment, width) \
+ DUFFS_LOOP8(pixel_copy_increment, width)
+
+/* Special version of Duff's device for even more optimization */
+#define DUFFS_LOOP_124(pixel_copy_increment1, \
+ pixel_copy_increment2, \
+ pixel_copy_increment4, width) \
+{ int n = width; \
+ if (n & 1) { \
+ pixel_copy_increment1; n -= 1; \
+ } \
+ if (n & 2) { \
+ pixel_copy_increment2; n -= 2; \
+ } \
+ if (n & 4) { \
+ pixel_copy_increment4; n -= 4; \
+ } \
+ if (n) { \
+ n /= 8; \
+ do { \
+ pixel_copy_increment4; \
+ pixel_copy_increment4; \
+ } while (--n > 0); \
+ } \
+}
+
+#else
+
+/* Don't use Duff's device to unroll loops */
+#define DUFFS_LOOP(pixel_copy_increment, width) \
+{ int n; \
+ for ( n=width; n > 0; --n ) { \
+ pixel_copy_increment; \
+ } \
+}
+#define DUFFS_LOOP8(pixel_copy_increment, width) \
+ DUFFS_LOOP(pixel_copy_increment, width)
+#define DUFFS_LOOP4(pixel_copy_increment, width) \
+ DUFFS_LOOP(pixel_copy_increment, width)
+#define DUFFS_LOOP_124(pixel_copy_increment1, \
+ pixel_copy_increment2, \
+ pixel_copy_increment4, width) \
+ DUFFS_LOOP(pixel_copy_increment1, width)
+
+#endif /* USE_DUFFS_LOOP */
+
+/* Prevent Visual C++ 6.0 from printing out stupid warnings */
+#if defined(_MSC_VER) && (_MSC_VER >= 600)
+#pragma warning(disable: 4550)
+#endif
+
+#endif /* SDL_blit_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_0.c b/src/3rdparty/SDL2/src/video/SDL_blit_0.c
new file mode 100644
index 0000000..b5c8efb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_0.c
@@ -0,0 +1,483 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+
+/* Functions to blit from bitmaps to other surfaces */
+
+static void
+BlitBto1(SDL_BlitInfo * info)
+{
+ int c;
+ int width, height;
+ Uint8 *src, *map, *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+ srcskip += width - (width + 7) / 8;
+
+ if (map) {
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (1) {
+ *dst = map[bit];
+ }
+ dst++;
+ byte <<= 1;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (1) {
+ *dst = bit;
+ }
+ dst++;
+ byte <<= 1;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+static void
+BlitBto2(SDL_BlitInfo * info)
+{
+ int c;
+ int width, height;
+ Uint8 *src;
+ Uint16 *map, *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = (Uint16 *) info->dst;
+ dstskip = info->dst_skip / 2;
+ map = (Uint16 *) info->table;
+ srcskip += width - (width + 7) / 8;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (1) {
+ *dst = map[bit];
+ }
+ byte <<= 1;
+ dst++;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitBto3(SDL_BlitInfo * info)
+{
+ int c, o;
+ int width, height;
+ Uint8 *src, *map, *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+ srcskip += width - (width + 7) / 8;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (1) {
+ o = bit * 4;
+ dst[0] = map[o++];
+ dst[1] = map[o++];
+ dst[2] = map[o++];
+ }
+ byte <<= 1;
+ dst += 3;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitBto4(SDL_BlitInfo * info)
+{
+ int width, height;
+ Uint8 *src;
+ Uint32 *map, *dst;
+ int srcskip, dstskip;
+ int c;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = (Uint32 *) info->dst;
+ dstskip = info->dst_skip / 4;
+ map = (Uint32 *) info->table;
+ srcskip += width - (width + 7) / 8;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (1) {
+ *dst = map[bit];
+ }
+ byte <<= 1;
+ dst++;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitBto1Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ Uint8 *dst = info->dst;
+ int srcskip = info->src_skip;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ Uint8 *palmap = info->table;
+ int c;
+
+ /* Set up some basic variables */
+ srcskip += width - (width + 7) / 8;
+
+ if (palmap) {
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (bit != ckey) {
+ *dst = palmap[bit];
+ }
+ dst++;
+ byte <<= 1;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (bit != ckey) {
+ *dst = bit;
+ }
+ dst++;
+ byte <<= 1;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+static void
+BlitBto2Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int srcskip = info->src_skip;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ Uint8 *palmap = info->table;
+ int c;
+
+ /* Set up some basic variables */
+ srcskip += width - (width + 7) / 8;
+ dstskip /= 2;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (bit != ckey) {
+ *dstp = ((Uint16 *) palmap)[bit];
+ }
+ byte <<= 1;
+ dstp++;
+ }
+ src += srcskip;
+ dstp += dstskip;
+ }
+}
+
+static void
+BlitBto3Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ Uint8 *dst = info->dst;
+ int srcskip = info->src_skip;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ Uint8 *palmap = info->table;
+ int c;
+
+ /* Set up some basic variables */
+ srcskip += width - (width + 7) / 8;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (bit != ckey) {
+ SDL_memcpy(dst, &palmap[bit * 4], 3);
+ }
+ byte <<= 1;
+ dst += 3;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitBto4Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int srcskip = info->src_skip;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ Uint8 *palmap = info->table;
+ int c;
+
+ /* Set up some basic variables */
+ srcskip += width - (width + 7) / 8;
+ dstskip /= 4;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (bit != ckey) {
+ *dstp = ((Uint32 *) palmap)[bit];
+ }
+ byte <<= 1;
+ dstp++;
+ }
+ src += srcskip;
+ dstp += dstskip;
+ }
+}
+
+static void
+BlitBtoNAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ Uint8 *dst = info->dst;
+ int srcskip = info->src_skip;
+ int dstskip = info->dst_skip;
+ const SDL_Color *srcpal = info->src_fmt->palette->colors;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int dstbpp;
+ int c;
+ Uint32 pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB, dA;
+ const unsigned A = info->a;
+
+ /* Set up some basic variables */
+ dstbpp = dstfmt->BytesPerPixel;
+ srcskip += width - (width + 7) / 8;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (1) {
+ sR = srcpal[bit].r;
+ sG = srcpal[bit].g;
+ sB = srcpal[bit].b;
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ }
+ byte <<= 1;
+ dst += dstbpp;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitBtoNAlphaKey(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ Uint8 *dst = info->dst;
+ int srcskip = info->src_skip;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ const SDL_Color *srcpal = srcfmt->palette->colors;
+ int dstbpp;
+ int c;
+ Uint32 pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB, dA;
+ const unsigned A = info->a;
+ Uint32 ckey = info->colorkey;
+
+ /* Set up some basic variables */
+ dstbpp = dstfmt->BytesPerPixel;
+ srcskip += width - (width + 7) / 8;
+
+ while (height--) {
+ Uint8 byte = 0, bit;
+ for (c = 0; c < width; ++c) {
+ if ((c & 7) == 0) {
+ byte = *src++;
+ }
+ bit = (byte & 0x80) >> 7;
+ if (bit != ckey) {
+ sR = srcpal[bit].r;
+ sG = srcpal[bit].g;
+ sB = srcpal[bit].b;
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ }
+ byte <<= 1;
+ dst += dstbpp;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static const SDL_BlitFunc bitmap_blit[] = {
+ (SDL_BlitFunc) NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
+};
+
+static const SDL_BlitFunc colorkey_blit[] = {
+ (SDL_BlitFunc) NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
+};
+
+SDL_BlitFunc
+SDL_CalculateBlit0(SDL_Surface * surface)
+{
+ int which;
+
+ if (surface->format->BitsPerPixel != 1) {
+ /* We don't support sub 8-bit packed pixel modes */
+ return (SDL_BlitFunc) NULL;
+ }
+ if (surface->map->dst->format->BitsPerPixel < 8) {
+ which = 0;
+ } else {
+ which = surface->map->dst->format->BytesPerPixel;
+ }
+ switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
+ case 0:
+ return bitmap_blit[which];
+
+ case SDL_COPY_COLORKEY:
+ return colorkey_blit[which];
+
+ case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
+ return which >= 2 ? BlitBtoNAlpha : (SDL_BlitFunc) NULL;
+
+ case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
+ return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL;
+ }
+ return (SDL_BlitFunc) NULL;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_1.c b/src/3rdparty/SDL2/src/video/SDL_blit_1.c
new file mode 100644
index 0000000..b7c5412
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_1.c
@@ -0,0 +1,552 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+#include "SDL_sysvideo.h"
+#include "SDL_endian.h"
+
+/* Functions to blit from 8-bit surfaces to other surfaces */
+
+static void
+Blit1to1(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint8 *src, *map, *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ *dst = map[*src];
+ }
+ dst++;
+ src++;
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width; c; --c) {
+ *dst = map[*src];
+ dst++;
+ src++;
+ }
+#endif
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* This is now endian dependent */
+#ifndef USE_DUFFS_LOOP
+# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
+# define HI 1
+# define LO 0
+# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
+# define HI 0
+# define LO 1
+# endif
+#endif
+static void
+Blit1to2(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint8 *src, *dst;
+ Uint16 *map;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = (Uint16 *) info->table;
+
+#ifdef USE_DUFFS_LOOP
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ *(Uint16 *)dst = map[*src++];
+ dst += 2;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+#else
+ /* Memory align at 4-byte boundary, if necessary */
+ if ((long) dst & 0x03) {
+ /* Don't do anything if width is 0 */
+ if (width == 0) {
+ return;
+ }
+ --width;
+
+ while (height--) {
+ /* Perform copy alignment */
+ *(Uint16 *) dst = map[*src++];
+ dst += 2;
+
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
+ src += 2;
+ dst += 4;
+ *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
+ src += 2;
+ dst += 4;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ *(Uint16 *) dst = map[*src++];
+ dst += 2;
+ case 2:
+ *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
+ src += 2;
+ dst += 4;
+ break;
+ case 1:
+ *(Uint16 *) dst = map[*src++];
+ dst += 2;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
+ src += 2;
+ dst += 4;
+ *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
+ src += 2;
+ dst += 4;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ *(Uint16 *) dst = map[*src++];
+ dst += 2;
+ case 2:
+ *(Uint32 *) dst = (map[src[HI]] << 16) | (map[src[LO]]);
+ src += 2;
+ dst += 4;
+ break;
+ case 1:
+ *(Uint16 *) dst = map[*src++];
+ dst += 2;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+#endif /* USE_DUFFS_LOOP */
+}
+
+static void
+Blit1to3(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int o;
+ int width, height;
+ Uint8 *src, *map, *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ o = *src * 4;
+ dst[0] = map[o++];
+ dst[1] = map[o++];
+ dst[2] = map[o++];
+ }
+ src++;
+ dst += 3;
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width; c; --c) {
+ o = *src * 4;
+ dst[0] = map[o++];
+ dst[1] = map[o++];
+ dst[2] = map[o++];
+ src++;
+ dst += 3;
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+Blit1to4(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint8 *src;
+ Uint32 *map, *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = (Uint32 *) info->dst;
+ dstskip = info->dst_skip / 4;
+ map = (Uint32 *) info->table;
+
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ *dst++ = map[*src++];
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width / 4; c; --c) {
+ *dst++ = map[*src++];
+ *dst++ = map[*src++];
+ *dst++ = map[*src++];
+ *dst++ = map[*src++];
+ }
+ switch (width & 3) {
+ case 3:
+ *dst++ = map[*src++];
+ case 2:
+ *dst++ = map[*src++];
+ case 1:
+ *dst++ = map[*src++];
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+Blit1to1Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint8 *palmap = info->table;
+ Uint32 ckey = info->colorkey;
+
+ if (palmap) {
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( *src != ckey ) {
+ *dst = palmap[*src];
+ }
+ dst++;
+ src++;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( *src != ckey ) {
+ *dst = *src;
+ }
+ dst++;
+ src++;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+static void
+Blit1to2Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip;
+ Uint16 *palmap = (Uint16 *) info->table;
+ Uint32 ckey = info->colorkey;
+
+ /* Set up some basic variables */
+ dstskip /= 2;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( *src != ckey ) {
+ *dstp=palmap[*src];
+ }
+ src++;
+ dstp++;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dstp += dstskip;
+ }
+}
+
+static void
+Blit1to3Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint8 *palmap = info->table;
+ Uint32 ckey = info->colorkey;
+ int o;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( *src != ckey ) {
+ o = *src * 4;
+ dst[0] = palmap[o++];
+ dst[1] = palmap[o++];
+ dst[2] = palmap[o++];
+ }
+ src++;
+ dst += 3;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+Blit1to4Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip;
+ Uint32 *palmap = (Uint32 *) info->table;
+ Uint32 ckey = info->colorkey;
+
+ /* Set up some basic variables */
+ dstskip /= 4;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( *src != ckey ) {
+ *dstp = palmap[*src];
+ }
+ src++;
+ dstp++;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dstp += dstskip;
+ }
+}
+
+static void
+Blit1toNAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ const SDL_Color *srcpal = info->src_fmt->palette->colors;
+ int dstbpp;
+ Uint32 pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB, dA;
+ const unsigned A = info->a;
+
+ /* Set up some basic variables */
+ dstbpp = dstfmt->BytesPerPixel;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4(
+ {
+ sR = srcpal[*src].r;
+ sG = srcpal[*src].g;
+ sB = srcpal[*src].b;
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ src++;
+ dst += dstbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+Blit1toNAlphaKey(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ const SDL_Color *srcpal = info->src_fmt->palette->colors;
+ Uint32 ckey = info->colorkey;
+ int dstbpp;
+ Uint32 pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB, dA;
+ const unsigned A = info->a;
+
+ /* Set up some basic variables */
+ dstbpp = dstfmt->BytesPerPixel;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( *src != ckey ) {
+ sR = srcpal[*src].r;
+ sG = srcpal[*src].g;
+ sB = srcpal[*src].b;
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ }
+ src++;
+ dst += dstbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static const SDL_BlitFunc one_blit[] = {
+ (SDL_BlitFunc) NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
+};
+
+static const SDL_BlitFunc one_blitkey[] = {
+ (SDL_BlitFunc) NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
+};
+
+SDL_BlitFunc
+SDL_CalculateBlit1(SDL_Surface * surface)
+{
+ int which;
+ SDL_PixelFormat *dstfmt;
+
+ dstfmt = surface->map->dst->format;
+ if (dstfmt->BitsPerPixel < 8) {
+ which = 0;
+ } else {
+ which = dstfmt->BytesPerPixel;
+ }
+ switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
+ case 0:
+ return one_blit[which];
+
+ case SDL_COPY_COLORKEY:
+ return one_blitkey[which];
+
+ case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
+ /* Supporting 8bpp->8bpp alpha is doable but requires lots of
+ tables which consume space and takes time to precompute,
+ so is better left to the user */
+ return which >= 2 ? Blit1toNAlpha : (SDL_BlitFunc) NULL;
+
+ case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
+ return which >= 2 ? Blit1toNAlphaKey : (SDL_BlitFunc) NULL;
+ }
+ return (SDL_BlitFunc) NULL;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_A.c b/src/3rdparty/SDL2/src/video/SDL_blit_A.c
new file mode 100644
index 0000000..1e9c9d8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_A.c
@@ -0,0 +1,1388 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+
+/* Functions to perform alpha blended blitting */
+
+/* N->1 blending with per-surface alpha */
+static void
+BlitNto1SurfaceAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint8 *palmap = info->table;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ Uint32 Pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB;
+ const unsigned A = info->a;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4(
+ {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+ dR = dstfmt->palette->colors[*dst].r;
+ dG = dstfmt->palette->colors[*dst].g;
+ dB = dstfmt->palette->colors[*dst].b;
+ ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB);
+ dR &= 0xff;
+ dG &= 0xff;
+ dB &= 0xff;
+ /* Pack RGB into 8bit pixel */
+ if ( palmap == NULL ) {
+ *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
+ } else {
+ *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
+ }
+ dst++;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* N->1 blending with pixel alpha */
+static void
+BlitNto1PixelAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint8 *palmap = info->table;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ Uint32 Pixel;
+ unsigned sR, sG, sB, sA;
+ unsigned dR, dG, dB;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4(
+ {
+ DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA);
+ dR = dstfmt->palette->colors[*dst].r;
+ dG = dstfmt->palette->colors[*dst].g;
+ dB = dstfmt->palette->colors[*dst].b;
+ ALPHA_BLEND_RGB(sR, sG, sB, sA, dR, dG, dB);
+ dR &= 0xff;
+ dG &= 0xff;
+ dB &= 0xff;
+ /* Pack RGB into 8bit pixel */
+ if ( palmap == NULL ) {
+ *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
+ } else {
+ *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
+ }
+ dst++;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* colorkeyed N->1 blending with per-surface alpha */
+static void
+BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint8 *palmap = info->table;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ Uint32 ckey = info->colorkey;
+ Uint32 Pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB;
+ const unsigned A = info->a;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+ if ( Pixel != ckey ) {
+ dR = dstfmt->palette->colors[*dst].r;
+ dG = dstfmt->palette->colors[*dst].g;
+ dB = dstfmt->palette->colors[*dst].b;
+ ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB);
+ dR &= 0xff;
+ dG &= 0xff;
+ dB &= 0xff;
+ /* Pack RGB into 8bit pixel */
+ if ( palmap == NULL ) {
+ *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
+ } else {
+ *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
+ }
+ }
+ dst++;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+#ifdef __MMX__
+
+/* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
+static void
+BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+ Uint32 dalpha = info->dst_fmt->Amask;
+
+ __m64 src1, src2, dst1, dst2, lmask, hmask, dsta;
+
+ hmask = _mm_set_pi32(0x00fefefe, 0x00fefefe); /* alpha128 mask -> hmask */
+ lmask = _mm_set_pi32(0x00010101, 0x00010101); /* !alpha128 mask -> lmask */
+ dsta = _mm_set_pi32(dalpha, dalpha); /* dst alpha mask -> dsta */
+
+ while (height--) {
+ int n = width;
+ if (n & 1) {
+ Uint32 s = *srcp++;
+ Uint32 d = *dstp;
+ *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1)
+ + (s & d & 0x00010101)) | dalpha;
+ n--;
+ }
+
+ for (n >>= 1; n > 0; --n) {
+ dst1 = *(__m64 *) dstp; /* 2 x dst -> dst1(ARGBARGB) */
+ dst2 = dst1; /* 2 x dst -> dst2(ARGBARGB) */
+
+ src1 = *(__m64 *) srcp; /* 2 x src -> src1(ARGBARGB) */
+ src2 = src1; /* 2 x src -> src2(ARGBARGB) */
+
+ dst2 = _mm_and_si64(dst2, hmask); /* dst & mask -> dst2 */
+ src2 = _mm_and_si64(src2, hmask); /* src & mask -> src2 */
+ src2 = _mm_add_pi32(src2, dst2); /* dst2 + src2 -> src2 */
+ src2 = _mm_srli_pi32(src2, 1); /* src2 >> 1 -> src2 */
+
+ dst1 = _mm_and_si64(dst1, src1); /* src & dst -> dst1 */
+ dst1 = _mm_and_si64(dst1, lmask); /* dst1 & !mask -> dst1 */
+ dst1 = _mm_add_pi32(dst1, src2); /* src2 + dst1 -> dst1 */
+ dst1 = _mm_or_si64(dst1, dsta); /* dsta(full alpha) | dst1 -> dst1 */
+
+ *(__m64 *) dstp = dst1; /* dst1 -> 2 x dst pixels */
+ dstp += 2;
+ srcp += 2;
+ }
+
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ _mm_empty();
+}
+
+/* fast RGB888->(A)RGB888 blending with surface alpha */
+static void
+BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info)
+{
+ SDL_PixelFormat *df = info->dst_fmt;
+ Uint32 chanmask;
+ unsigned alpha = info->a;
+
+ if (alpha == 128 && (df->Rmask | df->Gmask | df->Bmask) == 0x00FFFFFF) {
+ /* only call a128 version when R,G,B occupy lower bits */
+ BlitRGBtoRGBSurfaceAlpha128MMX(info);
+ } else {
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+ Uint32 dalpha = df->Amask;
+ Uint32 amult;
+
+ __m64 src1, src2, dst1, dst2, mm_alpha, mm_zero, dsta;
+
+ mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
+ /* form the alpha mult */
+ amult = alpha | (alpha << 8);
+ amult = amult | (amult << 16);
+ chanmask =
+ (0xff << df->Rshift) | (0xff << df->
+ Gshift) | (0xff << df->Bshift);
+ mm_alpha = _mm_set_pi32(0, amult & chanmask); /* 0000AAAA -> mm_alpha, minus 1 chan */
+ mm_alpha = _mm_unpacklo_pi8(mm_alpha, mm_zero); /* 0A0A0A0A -> mm_alpha, minus 1 chan */
+ /* at this point mm_alpha can be 000A0A0A or 0A0A0A00 or another combo */
+ dsta = _mm_set_pi32(dalpha, dalpha); /* dst alpha mask -> dsta */
+
+ while (height--) {
+ int n = width;
+ if (n & 1) {
+ /* One Pixel Blend */
+ src2 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src2 (0000ARGB) */
+ src2 = _mm_unpacklo_pi8(src2, mm_zero); /* 0A0R0G0B -> src2 */
+
+ dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
+ dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
+
+ src2 = _mm_sub_pi16(src2, dst1); /* src2 - dst2 -> src2 */
+ src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_srli_pi16(src2, 8); /* src2 >> 8 -> src2 */
+ dst1 = _mm_add_pi8(src2, dst1); /* src2 + dst1 -> dst1 */
+
+ dst1 = _mm_packs_pu16(dst1, mm_zero); /* 0000ARGB -> dst1 */
+ dst1 = _mm_or_si64(dst1, dsta); /* dsta | dst1 -> dst1 */
+ *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
+
+ ++srcp;
+ ++dstp;
+
+ n--;
+ }
+
+ for (n >>= 1; n > 0; --n) {
+ /* Two Pixels Blend */
+ src1 = *(__m64 *) srcp; /* 2 x src -> src1(ARGBARGB) */
+ src2 = src1; /* 2 x src -> src2(ARGBARGB) */
+ src1 = _mm_unpacklo_pi8(src1, mm_zero); /* low - 0A0R0G0B -> src1 */
+ src2 = _mm_unpackhi_pi8(src2, mm_zero); /* high - 0A0R0G0B -> src2 */
+
+ dst1 = *(__m64 *) dstp; /* 2 x dst -> dst1(ARGBARGB) */
+ dst2 = dst1; /* 2 x dst -> dst2(ARGBARGB) */
+ dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* low - 0A0R0G0B -> dst1 */
+ dst2 = _mm_unpackhi_pi8(dst2, mm_zero); /* high - 0A0R0G0B -> dst2 */
+
+ src1 = _mm_sub_pi16(src1, dst1); /* src1 - dst1 -> src1 */
+ src1 = _mm_mullo_pi16(src1, mm_alpha); /* src1 * alpha -> src1 */
+ src1 = _mm_srli_pi16(src1, 8); /* src1 >> 8 -> src1 */
+ dst1 = _mm_add_pi8(src1, dst1); /* src1 + dst1(dst1) -> dst1 */
+
+ src2 = _mm_sub_pi16(src2, dst2); /* src2 - dst2 -> src2 */
+ src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_srli_pi16(src2, 8); /* src2 >> 8 -> src2 */
+ dst2 = _mm_add_pi8(src2, dst2); /* src2 + dst2(dst2) -> dst2 */
+
+ dst1 = _mm_packs_pu16(dst1, dst2); /* 0A0R0G0B(res1), 0A0R0G0B(res2) -> dst1(ARGBARGB) */
+ dst1 = _mm_or_si64(dst1, dsta); /* dsta | dst1 -> dst1 */
+
+ *(__m64 *) dstp = dst1; /* dst1 -> 2 x pixel */
+
+ srcp += 2;
+ dstp += 2;
+ }
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ _mm_empty();
+ }
+}
+
+/* fast ARGB888->(A)RGB888 blending with pixel alpha */
+static void
+BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+ SDL_PixelFormat *sf = info->src_fmt;
+ Uint32 amask = sf->Amask;
+ Uint32 ashift = sf->Ashift;
+ Uint64 multmask, multmask2;
+
+ __m64 src1, dst1, mm_alpha, mm_zero, mm_alpha2;
+
+ mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
+ multmask = 0x00FF;
+ multmask <<= (ashift * 2);
+ multmask2 = 0x00FF00FF00FF00FFULL;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 alpha = *srcp & amask;
+ if (alpha == 0) {
+ /* do nothing */
+ } else if (alpha == amask) {
+ *dstp = *srcp;
+ } else {
+ src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
+ src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
+
+ dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
+ dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
+
+ mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
+ mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
+ mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
+ mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
+ mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */
+ mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */
+
+ /* blend */
+ src1 = _mm_mullo_pi16(src1, mm_alpha);
+ src1 = _mm_srli_pi16(src1, 8);
+ dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
+ dst1 = _mm_srli_pi16(dst1, 8);
+ dst1 = _mm_add_pi16(src1, dst1);
+ dst1 = _mm_packs_pu16(dst1, mm_zero);
+
+ *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
+ }
+ ++srcp;
+ ++dstp;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ _mm_empty();
+}
+
+#endif /* __MMX__ */
+
+/* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */
+static void
+BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 s = *srcp++;
+ Uint32 d = *dstp;
+ *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1)
+ + (s & d & 0x00010101)) | 0xff000000;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+}
+
+/* fast RGB888->(A)RGB888 blending with surface alpha */
+static void
+BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
+{
+ unsigned alpha = info->a;
+ if (alpha == 128) {
+ BlitRGBtoRGBSurfaceAlpha128(info);
+ } else {
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+ Uint32 s;
+ Uint32 d;
+ Uint32 s1;
+ Uint32 d1;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ s = *srcp;
+ d = *dstp;
+ s1 = s & 0xff00ff;
+ d1 = d & 0xff00ff;
+ d1 = (d1 + ((s1 - d1) * alpha >> 8))
+ & 0xff00ff;
+ s &= 0xff00;
+ d &= 0xff00;
+ d = (d + ((s - d) * alpha >> 8)) & 0xff00;
+ *dstp = d1 | d | 0xff000000;
+ ++srcp;
+ ++dstp;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ }
+}
+
+/* fast ARGB888->(A)RGB888 blending with pixel alpha */
+static void
+BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 dalpha;
+ Uint32 d;
+ Uint32 s1;
+ Uint32 d1;
+ Uint32 s = *srcp;
+ Uint32 alpha = s >> 24;
+ /* FIXME: Here we special-case opaque alpha since the
+ compositioning used (>>8 instead of /255) doesn't handle
+ it correctly. Also special-case alpha=0 for speed?
+ Benchmark this! */
+ if (alpha) {
+ if (alpha == SDL_ALPHA_OPAQUE) {
+ *dstp = *srcp;
+ } else {
+ /*
+ * take out the middle component (green), and process
+ * the other two in parallel. One multiply less.
+ */
+ d = *dstp;
+ dalpha = d >> 24;
+ s1 = s & 0xff00ff;
+ d1 = d & 0xff00ff;
+ d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff;
+ s &= 0xff00;
+ d &= 0xff00;
+ d = (d + ((s - d) * alpha >> 8)) & 0xff00;
+ dalpha = alpha + (dalpha * (alpha ^ 0xFF) >> 8);
+ *dstp = d1 | d | (dalpha << 24);
+ }
+ }
+ ++srcp;
+ ++dstp;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+}
+
+#ifdef __3dNOW__
+/* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */
+static void
+BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip >> 2;
+ SDL_PixelFormat *sf = info->src_fmt;
+ Uint32 amask = sf->Amask;
+ Uint32 ashift = sf->Ashift;
+ Uint64 multmask, multmask2;
+
+ __m64 src1, dst1, mm_alpha, mm_zero, mm_alpha2;
+
+ mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
+ multmask = 0x00FF;
+ multmask <<= (ashift * 2);
+ multmask2 = 0x00FF00FF00FF00FFULL;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 alpha;
+
+ _m_prefetch(srcp + 16);
+ _m_prefetch(dstp + 16);
+
+ alpha = *srcp & amask;
+ if (alpha == 0) {
+ /* do nothing */
+ } else if (alpha == amask) {
+ *dstp = *srcp;
+ } else {
+ src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
+ src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
+
+ dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
+ dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
+
+ mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
+ mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
+ mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
+ mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
+ mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */
+ mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */
+
+
+ /* blend */
+ src1 = _mm_mullo_pi16(src1, mm_alpha);
+ src1 = _mm_srli_pi16(src1, 8);
+ dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
+ dst1 = _mm_srli_pi16(dst1, 8);
+ dst1 = _mm_add_pi16(src1, dst1);
+ dst1 = _mm_packs_pu16(dst1, mm_zero);
+
+ *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
+ }
+ ++srcp;
+ ++dstp;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ _mm_empty();
+}
+
+#endif /* __3dNOW__ */
+
+/* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */
+
+/* blend a single 16 bit pixel at 50% */
+#define BLEND16_50(d, s, mask) \
+ ((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff)))
+
+/* blend two 16 bit pixels at 50% */
+#define BLEND2x16_50(d, s, mask) \
+ (((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \
+ + (s & d & (~(mask | mask << 16))))
+
+static void
+Blit16to16SurfaceAlpha128(SDL_BlitInfo * info, Uint16 mask)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint16 *srcp = (Uint16 *) info->src;
+ int srcskip = info->src_skip >> 1;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+
+ while (height--) {
+ if (((uintptr_t) srcp ^ (uintptr_t) dstp) & 2) {
+ /*
+ * Source and destination not aligned, pipeline it.
+ * This is mostly a win for big blits but no loss for
+ * small ones
+ */
+ Uint32 prev_sw;
+ int w = width;
+
+ /* handle odd destination */
+ if ((uintptr_t) dstp & 2) {
+ Uint16 d = *dstp, s = *srcp;
+ *dstp = BLEND16_50(d, s, mask);
+ dstp++;
+ srcp++;
+ w--;
+ }
+ srcp++; /* srcp is now 32-bit aligned */
+
+ /* bootstrap pipeline with first halfword */
+ prev_sw = ((Uint32 *) srcp)[-1];
+
+ while (w > 1) {
+ Uint32 sw, dw, s;
+ sw = *(Uint32 *) srcp;
+ dw = *(Uint32 *) dstp;
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ s = (prev_sw << 16) + (sw >> 16);
+#else
+ s = (prev_sw >> 16) + (sw << 16);
+#endif
+ prev_sw = sw;
+ *(Uint32 *) dstp = BLEND2x16_50(dw, s, mask);
+ dstp += 2;
+ srcp += 2;
+ w -= 2;
+ }
+
+ /* final pixel if any */
+ if (w) {
+ Uint16 d = *dstp, s;
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ s = (Uint16) prev_sw;
+#else
+ s = (Uint16) (prev_sw >> 16);
+#endif
+ *dstp = BLEND16_50(d, s, mask);
+ srcp++;
+ dstp++;
+ }
+ srcp += srcskip - 1;
+ dstp += dstskip;
+ } else {
+ /* source and destination are aligned */
+ int w = width;
+
+ /* first odd pixel? */
+ if ((uintptr_t) srcp & 2) {
+ Uint16 d = *dstp, s = *srcp;
+ *dstp = BLEND16_50(d, s, mask);
+ srcp++;
+ dstp++;
+ w--;
+ }
+ /* srcp and dstp are now 32-bit aligned */
+
+ while (w > 1) {
+ Uint32 sw = *(Uint32 *) srcp;
+ Uint32 dw = *(Uint32 *) dstp;
+ *(Uint32 *) dstp = BLEND2x16_50(dw, sw, mask);
+ srcp += 2;
+ dstp += 2;
+ w -= 2;
+ }
+
+ /* last odd pixel? */
+ if (w) {
+ Uint16 d = *dstp, s = *srcp;
+ *dstp = BLEND16_50(d, s, mask);
+ srcp++;
+ dstp++;
+ }
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ }
+}
+
+#ifdef __MMX__
+
+/* fast RGB565->RGB565 blending with surface alpha */
+static void
+Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
+{
+ unsigned alpha = info->a;
+ if (alpha == 128) {
+ Blit16to16SurfaceAlpha128(info, 0xf7de);
+ } else {
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint16 *srcp = (Uint16 *) info->src;
+ int srcskip = info->src_skip >> 1;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+ Uint32 s, d;
+
+ __m64 src1, dst1, src2, dst2, gmask, bmask, mm_res, mm_alpha;
+
+ alpha &= ~(1 + 2 + 4); /* cut alpha to get the exact same behaviour */
+ mm_alpha = _mm_set_pi32(0, alpha); /* 0000000A -> mm_alpha */
+ alpha >>= 3; /* downscale alpha to 5 bits */
+
+ mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
+ mm_alpha = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha */
+ /* position alpha to allow for mullo and mulhi on diff channels
+ to reduce the number of operations */
+ mm_alpha = _mm_slli_si64(mm_alpha, 3);
+
+ /* Setup the 565 color channel masks */
+ gmask = _mm_set_pi32(0x07E007E0, 0x07E007E0); /* MASKGREEN -> gmask */
+ bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP_124(
+ {
+ s = *srcp++;
+ d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x07e0f81f;
+ d = (d | d << 16) & 0x07e0f81f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x07e0f81f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ },{
+ s = *srcp++;
+ d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x07e0f81f;
+ d = (d | d << 16) & 0x07e0f81f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x07e0f81f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ s = *srcp++;
+ d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x07e0f81f;
+ d = (d | d << 16) & 0x07e0f81f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x07e0f81f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ },{
+ src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */
+ dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */
+
+ /* red */
+ src2 = src1;
+ src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 [000r 000r 000r 000r] */
+
+ dst2 = dst1;
+ dst2 = _mm_srli_pi16(dst2, 11); /* dst2 >> 11 -> dst2 [000r 000r 000r 000r] */
+
+ /* blend */
+ src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+ src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
+ dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+ dst2 = _mm_slli_pi16(dst2, 11); /* dst2 << 11 -> dst2 */
+
+ mm_res = dst2; /* RED -> mm_res */
+
+ /* green -- process the bits in place */
+ src2 = src1;
+ src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */
+
+ dst2 = dst1;
+ dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */
+
+ /* blend */
+ src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+ src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
+ dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+
+ mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */
+
+ /* blue */
+ src2 = src1;
+ src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */
+
+ dst2 = dst1;
+ dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */
+
+ /* blend */
+ src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+ src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
+ dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+ dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */
+
+ mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */
+
+ *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */
+
+ srcp += 4;
+ dstp += 4;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ _mm_empty();
+ }
+}
+
+/* fast RGB555->RGB555 blending with surface alpha */
+static void
+Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
+{
+ unsigned alpha = info->a;
+ if (alpha == 128) {
+ Blit16to16SurfaceAlpha128(info, 0xfbde);
+ } else {
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint16 *srcp = (Uint16 *) info->src;
+ int srcskip = info->src_skip >> 1;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+ Uint32 s, d;
+
+ __m64 src1, dst1, src2, dst2, rmask, gmask, bmask, mm_res, mm_alpha;
+
+ alpha &= ~(1 + 2 + 4); /* cut alpha to get the exact same behaviour */
+ mm_alpha = _mm_set_pi32(0, alpha); /* 0000000A -> mm_alpha */
+ alpha >>= 3; /* downscale alpha to 5 bits */
+
+ mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
+ mm_alpha = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha */
+ /* position alpha to allow for mullo and mulhi on diff channels
+ to reduce the number of operations */
+ mm_alpha = _mm_slli_si64(mm_alpha, 3);
+
+ /* Setup the 555 color channel masks */
+ rmask = _mm_set_pi32(0x7C007C00, 0x7C007C00); /* MASKRED -> rmask */
+ gmask = _mm_set_pi32(0x03E003E0, 0x03E003E0); /* MASKGREEN -> gmask */
+ bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP_124(
+ {
+ s = *srcp++;
+ d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x03e07c1f;
+ d = (d | d << 16) & 0x03e07c1f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x03e07c1f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ },{
+ s = *srcp++;
+ d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x03e07c1f;
+ d = (d | d << 16) & 0x03e07c1f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x03e07c1f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ s = *srcp++;
+ d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x03e07c1f;
+ d = (d | d << 16) & 0x03e07c1f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x03e07c1f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ },{
+ src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */
+ dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */
+
+ /* red -- process the bits in place */
+ src2 = src1;
+ src2 = _mm_and_si64(src2, rmask); /* src & MASKRED -> src2 */
+
+ dst2 = dst1;
+ dst2 = _mm_and_si64(dst2, rmask); /* dst & MASKRED -> dst2 */
+
+ /* blend */
+ src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+ src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
+ dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+ dst2 = _mm_and_si64(dst2, rmask); /* dst2 & MASKRED -> dst2 */
+
+ mm_res = dst2; /* RED -> mm_res */
+
+ /* green -- process the bits in place */
+ src2 = src1;
+ src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */
+
+ dst2 = dst1;
+ dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */
+
+ /* blend */
+ src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+ src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
+ dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+
+ mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */
+
+ /* blue */
+ src2 = src1; /* src -> src2 */
+ src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */
+
+ dst2 = dst1; /* dst -> dst2 */
+ dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */
+
+ /* blend */
+ src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+ src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+ src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
+ dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+ dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */
+
+ mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */
+
+ *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */
+
+ srcp += 4;
+ dstp += 4;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ _mm_empty();
+ }
+}
+
+#endif /* __MMX__ */
+
+/* fast RGB565->RGB565 blending with surface alpha */
+static void
+Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
+{
+ unsigned alpha = info->a;
+ if (alpha == 128) {
+ Blit16to16SurfaceAlpha128(info, 0xf7de);
+ } else {
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint16 *srcp = (Uint16 *) info->src;
+ int srcskip = info->src_skip >> 1;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+ alpha >>= 3; /* downscale alpha to 5 bits */
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 s = *srcp++;
+ Uint32 d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x07e0f81f;
+ d = (d | d << 16) & 0x07e0f81f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x07e0f81f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ }
+}
+
+/* fast RGB555->RGB555 blending with surface alpha */
+static void
+Blit555to555SurfaceAlpha(SDL_BlitInfo * info)
+{
+ unsigned alpha = info->a; /* downscale alpha to 5 bits */
+ if (alpha == 128) {
+ Blit16to16SurfaceAlpha128(info, 0xfbde);
+ } else {
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint16 *srcp = (Uint16 *) info->src;
+ int srcskip = info->src_skip >> 1;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+ alpha >>= 3; /* downscale alpha to 5 bits */
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 s = *srcp++;
+ Uint32 d = *dstp;
+ /*
+ * shift out the middle component (green) to
+ * the high 16 bits, and process all three RGB
+ * components at the same time.
+ */
+ s = (s | s << 16) & 0x03e07c1f;
+ d = (d | d << 16) & 0x03e07c1f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x03e07c1f;
+ *dstp++ = (Uint16)(d | d >> 16);
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ }
+}
+
+/* fast ARGB8888->RGB565 blending with pixel alpha */
+static void
+BlitARGBto565PixelAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ Uint32 s = *srcp;
+ unsigned alpha = s >> 27; /* downscale alpha to 5 bits */
+ /* FIXME: Here we special-case opaque alpha since the
+ compositioning used (>>8 instead of /255) doesn't handle
+ it correctly. Also special-case alpha=0 for speed?
+ Benchmark this! */
+ if(alpha) {
+ if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
+ *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f));
+ } else {
+ Uint32 d = *dstp;
+ /*
+ * convert source and destination to G0RAB65565
+ * and blend all components at the same time
+ */
+ s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800)
+ + (s >> 3 & 0x1f);
+ d = (d | d << 16) & 0x07e0f81f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x07e0f81f;
+ *dstp = (Uint16)(d | d >> 16);
+ }
+ }
+ srcp++;
+ dstp++;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+}
+
+/* fast ARGB8888->RGB555 blending with pixel alpha */
+static void
+BlitARGBto555PixelAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip >> 2;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip >> 1;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4({
+ unsigned alpha;
+ Uint32 s = *srcp;
+ alpha = s >> 27; /* downscale alpha to 5 bits */
+ /* FIXME: Here we special-case opaque alpha since the
+ compositioning used (>>8 instead of /255) doesn't handle
+ it correctly. Also special-case alpha=0 for speed?
+ Benchmark this! */
+ if(alpha) {
+ if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
+ *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f));
+ } else {
+ Uint32 d = *dstp;
+ /*
+ * convert source and destination to G0RAB65565
+ * and blend all components at the same time
+ */
+ s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00)
+ + (s >> 3 & 0x1f);
+ d = (d | d << 16) & 0x03e07c1f;
+ d += (s - d) * alpha >> 5;
+ d &= 0x03e07c1f;
+ *dstp = (Uint16)(d | d >> 16);
+ }
+ }
+ srcp++;
+ dstp++;
+ }, width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+}
+
+/* General (slow) N->N blending with per-surface alpha */
+static void
+BlitNtoNSurfaceAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ int dstbpp = dstfmt->BytesPerPixel;
+ Uint32 Pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB, dA;
+ const unsigned sA = info->a;
+
+ if (sA) {
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4(
+ {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ src += srcbpp;
+ dst += dstbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+/* General (slow) colorkeyed N->N blending with per-surface alpha */
+static void
+BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ Uint32 ckey = info->colorkey;
+ int srcbpp = srcfmt->BytesPerPixel;
+ int dstbpp = dstfmt->BytesPerPixel;
+ Uint32 Pixel;
+ unsigned sR, sG, sB;
+ unsigned dR, dG, dB, dA;
+ const unsigned sA = info->a;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4(
+ {
+ RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
+ if(sA && Pixel != ckey) {
+ RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ }
+ src += srcbpp;
+ dst += dstbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* General (slow) N->N blending with pixel alpha */
+static void
+BlitNtoNPixelAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int srcbpp;
+ int dstbpp;
+ Uint32 Pixel;
+ unsigned sR, sG, sB, sA;
+ unsigned dR, dG, dB, dA;
+
+ /* Set up some basic variables */
+ srcbpp = srcfmt->BytesPerPixel;
+ dstbpp = dstfmt->BytesPerPixel;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP4(
+ {
+ DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
+ if(sA) {
+ DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
+ ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+ }
+ src += srcbpp;
+ dst += dstbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+
+SDL_BlitFunc
+SDL_CalculateBlitA(SDL_Surface * surface)
+{
+ SDL_PixelFormat *sf = surface->format;
+ SDL_PixelFormat *df = surface->map->dst->format;
+
+ switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
+ case SDL_COPY_BLEND:
+ /* Per-pixel alpha blits */
+ switch (df->BytesPerPixel) {
+ case 1:
+ return BlitNto1PixelAlpha;
+
+ case 2:
+ if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000
+ && sf->Gmask == 0xff00
+ && ((sf->Rmask == 0xff && df->Rmask == 0x1f)
+ || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
+ if (df->Gmask == 0x7e0)
+ return BlitARGBto565PixelAlpha;
+ else if (df->Gmask == 0x3e0)
+ return BlitARGBto555PixelAlpha;
+ }
+ return BlitNtoNPixelAlpha;
+
+ case 4:
+ if (sf->Rmask == df->Rmask
+ && sf->Gmask == df->Gmask
+ && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
+#if defined(__MMX__) || defined(__3dNOW__)
+ if (sf->Rshift % 8 == 0
+ && sf->Gshift % 8 == 0
+ && sf->Bshift % 8 == 0
+ && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
+#ifdef __3dNOW__
+ if (SDL_Has3DNow())
+ return BlitRGBtoRGBPixelAlphaMMX3DNOW;
+#endif
+#ifdef __MMX__
+ if (SDL_HasMMX())
+ return BlitRGBtoRGBPixelAlphaMMX;
+#endif
+ }
+#endif /* __MMX__ || __3dNOW__ */
+ if (sf->Amask == 0xff000000) {
+ return BlitRGBtoRGBPixelAlpha;
+ }
+ }
+ return BlitNtoNPixelAlpha;
+
+ case 3:
+ default:
+ break;
+ }
+ return BlitNtoNPixelAlpha;
+
+ case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
+ if (sf->Amask == 0) {
+ /* Per-surface alpha blits */
+ switch (df->BytesPerPixel) {
+ case 1:
+ return BlitNto1SurfaceAlpha;
+
+ case 2:
+ if (surface->map->identity) {
+ if (df->Gmask == 0x7e0) {
+#ifdef __MMX__
+ if (SDL_HasMMX())
+ return Blit565to565SurfaceAlphaMMX;
+ else
+#endif
+ return Blit565to565SurfaceAlpha;
+ } else if (df->Gmask == 0x3e0) {
+#ifdef __MMX__
+ if (SDL_HasMMX())
+ return Blit555to555SurfaceAlphaMMX;
+ else
+#endif
+ return Blit555to555SurfaceAlpha;
+ }
+ }
+ return BlitNtoNSurfaceAlpha;
+
+ case 4:
+ if (sf->Rmask == df->Rmask
+ && sf->Gmask == df->Gmask
+ && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
+#ifdef __MMX__
+ if (sf->Rshift % 8 == 0
+ && sf->Gshift % 8 == 0
+ && sf->Bshift % 8 == 0 && SDL_HasMMX())
+ return BlitRGBtoRGBSurfaceAlphaMMX;
+#endif
+ if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
+ return BlitRGBtoRGBSurfaceAlpha;
+ }
+ }
+ return BlitNtoNSurfaceAlpha;
+
+ case 3:
+ default:
+ return BlitNtoNSurfaceAlpha;
+ }
+ }
+ break;
+
+ case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
+ if (sf->Amask == 0) {
+ if (df->BytesPerPixel == 1) {
+ return BlitNto1SurfaceAlphaKey;
+ } else {
+ return BlitNtoNSurfaceAlphaKey;
+ }
+ }
+ break;
+ }
+
+ return NULL;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_N.c b/src/3rdparty/SDL2/src/video/SDL_blit_N.c
new file mode 100644
index 0000000..441cd9a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_N.c
@@ -0,0 +1,2647 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_endian.h"
+#include "SDL_cpuinfo.h"
+#include "SDL_blit.h"
+
+#include "SDL_assert.h"
+
+/* Functions to blit from N-bit surfaces to other surfaces */
+
+#if SDL_ALTIVEC_BLITTERS
+#ifdef HAVE_ALTIVEC_H
+#include <altivec.h>
+#endif
+#ifdef __MACOSX__
+#include <sys/sysctl.h>
+static size_t
+GetL3CacheSize(void)
+{
+ const char key[] = "hw.l3cachesize";
+ u_int64_t result = 0;
+ size_t typeSize = sizeof(result);
+
+
+ int err = sysctlbyname(key, &result, &typeSize, NULL, 0);
+ if (0 != err)
+ return 0;
+
+ return result;
+}
+#else
+static size_t
+GetL3CacheSize(void)
+{
+ /* XXX: Just guess G4 */
+ return 2097152;
+}
+#endif /* __MACOSX__ */
+
+#if (defined(__MACOSX__) && (__GNUC__ < 4))
+#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
+ (vector unsigned char) ( a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p )
+#define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
+ (vector unsigned short) ( a,b,c,d,e,f,g,h )
+#else
+#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
+ (vector unsigned char) { a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p }
+#define VECUINT16_LITERAL(a,b,c,d,e,f,g,h) \
+ (vector unsigned short) { a,b,c,d,e,f,g,h }
+#endif
+
+#define UNALIGNED_PTR(x) (((size_t) x) & 0x0000000F)
+#define VSWIZZLE32(a,b,c,d) (vector unsigned char) \
+ ( 0x00+a, 0x00+b, 0x00+c, 0x00+d, \
+ 0x04+a, 0x04+b, 0x04+c, 0x04+d, \
+ 0x08+a, 0x08+b, 0x08+c, 0x08+d, \
+ 0x0C+a, 0x0C+b, 0x0C+c, 0x0C+d )
+
+#define MAKE8888(dstfmt, r, g, b, a) \
+ ( ((r<<dstfmt->Rshift)&dstfmt->Rmask) | \
+ ((g<<dstfmt->Gshift)&dstfmt->Gmask) | \
+ ((b<<dstfmt->Bshift)&dstfmt->Bmask) | \
+ ((a<<dstfmt->Ashift)&dstfmt->Amask) )
+
+/*
+ * Data Stream Touch...Altivec cache prefetching.
+ *
+ * Don't use this on a G5...however, the speed boost is very significant
+ * on a G4.
+ */
+#define DST_CHAN_SRC 1
+#define DST_CHAN_DEST 2
+
+/* macro to set DST control word value... */
+#define DST_CTRL(size, count, stride) \
+ (((size) << 24) | ((count) << 16) | (stride))
+
+#define VEC_ALIGNER(src) ((UNALIGNED_PTR(src)) \
+ ? vec_lvsl(0, src) \
+ : vec_add(vec_lvsl(8, src), vec_splat_u8(8)))
+
+/* Calculate the permute vector used for 32->32 swizzling */
+static vector unsigned char
+calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt)
+{
+ /*
+ * We have to assume that the bits that aren't used by other
+ * colors is alpha, and it's one complete byte, since some formats
+ * leave alpha with a zero mask, but we should still swizzle the bits.
+ */
+ /* ARGB */
+ const static const struct SDL_PixelFormat default_pixel_format = {
+ 0, NULL, 0, 0,
+ {0, 0},
+ 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
+ 0, 0, 0, 0,
+ 16, 8, 0, 24,
+ 0, NULL
+ };
+ const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x04, 0x04, 0x04,
+ 0x08, 0x08, 0x08, 0x08,
+ 0x0C, 0x0C, 0x0C,
+ 0x0C);
+ vector unsigned char vswiz;
+ vector unsigned int srcvec;
+ Uint32 rmask, gmask, bmask, amask;
+
+ if (!srcfmt) {
+ srcfmt = &default_pixel_format;
+ }
+ if (!dstfmt) {
+ dstfmt = &default_pixel_format;
+ }
+
+#define RESHIFT(X) (3 - ((X) >> 3))
+ rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
+ gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
+ bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
+
+ /* Use zero for alpha if either surface doesn't have alpha */
+ if (dstfmt->Amask) {
+ amask =
+ ((srcfmt->Amask) ? RESHIFT(srcfmt->
+ Ashift) : 0x10) << (dstfmt->Ashift);
+ } else {
+ amask =
+ 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^
+ 0xFFFFFFFF);
+ }
+#undef RESHIFT
+
+ ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask);
+ vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0));
+ return (vswiz);
+}
+
+static void Blit_RGB888_RGB565(SDL_BlitInfo * info);
+static void
+Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
+{
+ int height = info->dst_h;
+ Uint8 *src = (Uint8 *) info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = (Uint8 *) info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ vector unsigned char valpha = vec_splat_u8(0);
+ vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
+ vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
+ 0x00, 0x0a, 0x00, 0x0e,
+ 0x00, 0x12, 0x00, 0x16,
+ 0x00, 0x1a, 0x00, 0x1e);
+ vector unsigned short v1 = vec_splat_u16(1);
+ vector unsigned short v3 = vec_splat_u16(3);
+ vector unsigned short v3f =
+ VECUINT16_LITERAL(0x003f, 0x003f, 0x003f, 0x003f,
+ 0x003f, 0x003f, 0x003f, 0x003f);
+ vector unsigned short vfc =
+ VECUINT16_LITERAL(0x00fc, 0x00fc, 0x00fc, 0x00fc,
+ 0x00fc, 0x00fc, 0x00fc, 0x00fc);
+ vector unsigned short vf800 = (vector unsigned short) vec_splat_u8(-7);
+ vf800 = vec_sl(vf800, vec_splat_u16(8));
+
+ while (height--) {
+ vector unsigned char valigner;
+ vector unsigned char voverflow;
+ vector unsigned char vsrc;
+
+ int width = info->dst_w;
+ int extrawidth;
+
+ /* do scalar until we can align... */
+#define ONE_PIXEL_BLEND(condition, widthvar) \
+ while (condition) { \
+ Uint32 Pixel; \
+ unsigned sR, sG, sB, sA; \
+ DISEMBLE_RGBA((Uint8 *)src, 4, srcfmt, Pixel, \
+ sR, sG, sB, sA); \
+ *(Uint16 *)(dst) = (((sR << 8) & 0x0000F800) | \
+ ((sG << 3) & 0x000007E0) | \
+ ((sB >> 3) & 0x0000001F)); \
+ dst += 2; \
+ src += 4; \
+ widthvar--; \
+ }
+
+ ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width);
+
+ /* After all that work, here's the vector part! */
+ extrawidth = (width % 8); /* trailing unaligned stores */
+ width -= extrawidth;
+ vsrc = vec_ld(0, src);
+ valigner = VEC_ALIGNER(src);
+
+ while (width) {
+ vector unsigned short vpixel, vrpixel, vgpixel, vbpixel;
+ vector unsigned int vsrc1, vsrc2;
+ vector unsigned char vdst;
+
+ voverflow = vec_ld(15, src);
+ vsrc = vec_perm(vsrc, voverflow, valigner);
+ vsrc1 = (vector unsigned int) vec_perm(vsrc, valpha, vpermute);
+ src += 16;
+ vsrc = voverflow;
+ voverflow = vec_ld(15, src);
+ vsrc = vec_perm(vsrc, voverflow, valigner);
+ vsrc2 = (vector unsigned int) vec_perm(vsrc, valpha, vpermute);
+ /* 1555 */
+ vpixel = (vector unsigned short) vec_packpx(vsrc1, vsrc2);
+ vgpixel = (vector unsigned short) vec_perm(vsrc1, vsrc2, vgmerge);
+ vgpixel = vec_and(vgpixel, vfc);
+ vgpixel = vec_sl(vgpixel, v3);
+ vrpixel = vec_sl(vpixel, v1);
+ vrpixel = vec_and(vrpixel, vf800);
+ vbpixel = vec_and(vpixel, v3f);
+ vdst =
+ vec_or((vector unsigned char) vrpixel,
+ (vector unsigned char) vgpixel);
+ /* 565 */
+ vdst = vec_or(vdst, (vector unsigned char) vbpixel);
+ vec_st(vdst, 0, dst);
+
+ width -= 8;
+ src += 16;
+ dst += 16;
+ vsrc = voverflow;
+ }
+
+ SDL_assert(width == 0);
+
+ /* do scalar until we can align... */
+ ONE_PIXEL_BLEND((extrawidth), extrawidth);
+#undef ONE_PIXEL_BLEND
+
+ src += srcskip; /* move to next row, accounting for pitch. */
+ dst += dstskip;
+ }
+
+
+}
+
+static void
+Blit_RGB565_32Altivec(SDL_BlitInfo * info)
+{
+ int height = info->dst_h;
+ Uint8 *src = (Uint8 *) info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = (Uint8 *) info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ unsigned alpha;
+ vector unsigned char valpha;
+ vector unsigned char vpermute;
+ vector unsigned short vf800;
+ vector unsigned int v8 = vec_splat_u32(8);
+ vector unsigned int v16 = vec_add(v8, v8);
+ vector unsigned short v2 = vec_splat_u16(2);
+ vector unsigned short v3 = vec_splat_u16(3);
+ /*
+ 0x10 - 0x1f is the alpha
+ 0x00 - 0x0e evens are the red
+ 0x01 - 0x0f odds are zero
+ */
+ vector unsigned char vredalpha1 = VECUINT8_LITERAL(0x10, 0x00, 0x01, 0x01,
+ 0x10, 0x02, 0x01, 0x01,
+ 0x10, 0x04, 0x01, 0x01,
+ 0x10, 0x06, 0x01,
+ 0x01);
+ vector unsigned char vredalpha2 =
+ (vector unsigned
+ char) (vec_add((vector unsigned int) vredalpha1, vec_sl(v8, v16))
+ );
+ /*
+ 0x00 - 0x0f is ARxx ARxx ARxx ARxx
+ 0x11 - 0x0f odds are blue
+ */
+ vector unsigned char vblue1 = VECUINT8_LITERAL(0x00, 0x01, 0x02, 0x11,
+ 0x04, 0x05, 0x06, 0x13,
+ 0x08, 0x09, 0x0a, 0x15,
+ 0x0c, 0x0d, 0x0e, 0x17);
+ vector unsigned char vblue2 =
+ (vector unsigned char) (vec_add((vector unsigned int) vblue1, v8)
+ );
+ /*
+ 0x00 - 0x0f is ARxB ARxB ARxB ARxB
+ 0x10 - 0x0e evens are green
+ */
+ vector unsigned char vgreen1 = VECUINT8_LITERAL(0x00, 0x01, 0x10, 0x03,
+ 0x04, 0x05, 0x12, 0x07,
+ 0x08, 0x09, 0x14, 0x0b,
+ 0x0c, 0x0d, 0x16, 0x0f);
+ vector unsigned char vgreen2 =
+ (vector unsigned
+ char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
+ );
+
+ SDL_assert(srcfmt->BytesPerPixel == 2);
+ SDL_assert(dstfmt->BytesPerPixel == 4);
+
+ vf800 = (vector unsigned short) vec_splat_u8(-7);
+ vf800 = vec_sl(vf800, vec_splat_u16(8));
+
+ if (dstfmt->Amask && info->a) {
+ ((unsigned char *) &valpha)[0] = alpha = info->a;
+ valpha = vec_splat(valpha, 0);
+ } else {
+ alpha = 0;
+ valpha = vec_splat_u8(0);
+ }
+
+ vpermute = calc_swizzle32(NULL, dstfmt);
+ while (height--) {
+ vector unsigned char valigner;
+ vector unsigned char voverflow;
+ vector unsigned char vsrc;
+
+ int width = info->dst_w;
+ int extrawidth;
+
+ /* do scalar until we can align... */
+#define ONE_PIXEL_BLEND(condition, widthvar) \
+ while (condition) { \
+ unsigned sR, sG, sB; \
+ unsigned short Pixel = *((unsigned short *)src); \
+ sR = (Pixel >> 8) & 0xf8; \
+ sG = (Pixel >> 3) & 0xfc; \
+ sB = (Pixel << 3) & 0xf8; \
+ ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \
+ src += 2; \
+ dst += 4; \
+ widthvar--; \
+ }
+ ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width);
+
+ /* After all that work, here's the vector part! */
+ extrawidth = (width % 8); /* trailing unaligned stores */
+ width -= extrawidth;
+ vsrc = vec_ld(0, src);
+ valigner = VEC_ALIGNER(src);
+
+ while (width) {
+ vector unsigned short vR, vG, vB;
+ vector unsigned char vdst1, vdst2;
+
+ voverflow = vec_ld(15, src);
+ vsrc = vec_perm(vsrc, voverflow, valigner);
+
+ vR = vec_and((vector unsigned short) vsrc, vf800);
+ vB = vec_sl((vector unsigned short) vsrc, v3);
+ vG = vec_sl(vB, v2);
+
+ vdst1 =
+ (vector unsigned char) vec_perm((vector unsigned char) vR,
+ valpha, vredalpha1);
+ vdst1 = vec_perm(vdst1, (vector unsigned char) vB, vblue1);
+ vdst1 = vec_perm(vdst1, (vector unsigned char) vG, vgreen1);
+ vdst1 = vec_perm(vdst1, valpha, vpermute);
+ vec_st(vdst1, 0, dst);
+
+ vdst2 =
+ (vector unsigned char) vec_perm((vector unsigned char) vR,
+ valpha, vredalpha2);
+ vdst2 = vec_perm(vdst2, (vector unsigned char) vB, vblue2);
+ vdst2 = vec_perm(vdst2, (vector unsigned char) vG, vgreen2);
+ vdst2 = vec_perm(vdst2, valpha, vpermute);
+ vec_st(vdst2, 16, dst);
+
+ width -= 8;
+ dst += 32;
+ src += 16;
+ vsrc = voverflow;
+ }
+
+ SDL_assert(width == 0);
+
+
+ /* do scalar until we can align... */
+ ONE_PIXEL_BLEND((extrawidth), extrawidth);
+#undef ONE_PIXEL_BLEND
+
+ src += srcskip; /* move to next row, accounting for pitch. */
+ dst += dstskip;
+ }
+
+}
+
+
+static void
+Blit_RGB555_32Altivec(SDL_BlitInfo * info)
+{
+ int height = info->dst_h;
+ Uint8 *src = (Uint8 *) info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = (Uint8 *) info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ unsigned alpha;
+ vector unsigned char valpha;
+ vector unsigned char vpermute;
+ vector unsigned short vf800;
+ vector unsigned int v8 = vec_splat_u32(8);
+ vector unsigned int v16 = vec_add(v8, v8);
+ vector unsigned short v1 = vec_splat_u16(1);
+ vector unsigned short v3 = vec_splat_u16(3);
+ /*
+ 0x10 - 0x1f is the alpha
+ 0x00 - 0x0e evens are the red
+ 0x01 - 0x0f odds are zero
+ */
+ vector unsigned char vredalpha1 = VECUINT8_LITERAL(0x10, 0x00, 0x01, 0x01,
+ 0x10, 0x02, 0x01, 0x01,
+ 0x10, 0x04, 0x01, 0x01,
+ 0x10, 0x06, 0x01,
+ 0x01);
+ vector unsigned char vredalpha2 =
+ (vector unsigned
+ char) (vec_add((vector unsigned int) vredalpha1, vec_sl(v8, v16))
+ );
+ /*
+ 0x00 - 0x0f is ARxx ARxx ARxx ARxx
+ 0x11 - 0x0f odds are blue
+ */
+ vector unsigned char vblue1 = VECUINT8_LITERAL(0x00, 0x01, 0x02, 0x11,
+ 0x04, 0x05, 0x06, 0x13,
+ 0x08, 0x09, 0x0a, 0x15,
+ 0x0c, 0x0d, 0x0e, 0x17);
+ vector unsigned char vblue2 =
+ (vector unsigned char) (vec_add((vector unsigned int) vblue1, v8)
+ );
+ /*
+ 0x00 - 0x0f is ARxB ARxB ARxB ARxB
+ 0x10 - 0x0e evens are green
+ */
+ vector unsigned char vgreen1 = VECUINT8_LITERAL(0x00, 0x01, 0x10, 0x03,
+ 0x04, 0x05, 0x12, 0x07,
+ 0x08, 0x09, 0x14, 0x0b,
+ 0x0c, 0x0d, 0x16, 0x0f);
+ vector unsigned char vgreen2 =
+ (vector unsigned
+ char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
+ );
+
+ SDL_assert(srcfmt->BytesPerPixel == 2);
+ SDL_assert(dstfmt->BytesPerPixel == 4);
+
+ vf800 = (vector unsigned short) vec_splat_u8(-7);
+ vf800 = vec_sl(vf800, vec_splat_u16(8));
+
+ if (dstfmt->Amask && info->a) {
+ ((unsigned char *) &valpha)[0] = alpha = info->a;
+ valpha = vec_splat(valpha, 0);
+ } else {
+ alpha = 0;
+ valpha = vec_splat_u8(0);
+ }
+
+ vpermute = calc_swizzle32(NULL, dstfmt);
+ while (height--) {
+ vector unsigned char valigner;
+ vector unsigned char voverflow;
+ vector unsigned char vsrc;
+
+ int width = info->dst_w;
+ int extrawidth;
+
+ /* do scalar until we can align... */
+#define ONE_PIXEL_BLEND(condition, widthvar) \
+ while (condition) { \
+ unsigned sR, sG, sB; \
+ unsigned short Pixel = *((unsigned short *)src); \
+ sR = (Pixel >> 7) & 0xf8; \
+ sG = (Pixel >> 2) & 0xf8; \
+ sB = (Pixel << 3) & 0xf8; \
+ ASSEMBLE_RGBA(dst, 4, dstfmt, sR, sG, sB, alpha); \
+ src += 2; \
+ dst += 4; \
+ widthvar--; \
+ }
+ ONE_PIXEL_BLEND(((UNALIGNED_PTR(dst)) && (width)), width);
+
+ /* After all that work, here's the vector part! */
+ extrawidth = (width % 8); /* trailing unaligned stores */
+ width -= extrawidth;
+ vsrc = vec_ld(0, src);
+ valigner = VEC_ALIGNER(src);
+
+ while (width) {
+ vector unsigned short vR, vG, vB;
+ vector unsigned char vdst1, vdst2;
+
+ voverflow = vec_ld(15, src);
+ vsrc = vec_perm(vsrc, voverflow, valigner);
+
+ vR = vec_and(vec_sl((vector unsigned short) vsrc, v1), vf800);
+ vB = vec_sl((vector unsigned short) vsrc, v3);
+ vG = vec_sl(vB, v3);
+
+ vdst1 =
+ (vector unsigned char) vec_perm((vector unsigned char) vR,
+ valpha, vredalpha1);
+ vdst1 = vec_perm(vdst1, (vector unsigned char) vB, vblue1);
+ vdst1 = vec_perm(vdst1, (vector unsigned char) vG, vgreen1);
+ vdst1 = vec_perm(vdst1, valpha, vpermute);
+ vec_st(vdst1, 0, dst);
+
+ vdst2 =
+ (vector unsigned char) vec_perm((vector unsigned char) vR,
+ valpha, vredalpha2);
+ vdst2 = vec_perm(vdst2, (vector unsigned char) vB, vblue2);
+ vdst2 = vec_perm(vdst2, (vector unsigned char) vG, vgreen2);
+ vdst2 = vec_perm(vdst2, valpha, vpermute);
+ vec_st(vdst2, 16, dst);
+
+ width -= 8;
+ dst += 32;
+ src += 16;
+ vsrc = voverflow;
+ }
+
+ SDL_assert(width == 0);
+
+
+ /* do scalar until we can align... */
+ ONE_PIXEL_BLEND((extrawidth), extrawidth);
+#undef ONE_PIXEL_BLEND
+
+ src += srcskip; /* move to next row, accounting for pitch. */
+ dst += dstskip;
+ }
+
+}
+
+static void BlitNtoNKey(SDL_BlitInfo * info);
+static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info);
+static void
+Blit32to32KeyAltivec(SDL_BlitInfo * info)
+{
+ int height = info->dst_h;
+ Uint32 *srcp = (Uint32 *) info->src;
+ int srcskip = info->src_skip / 4;
+ Uint32 *dstp = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip / 4;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int dstbpp = dstfmt->BytesPerPixel;
+ int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
+ unsigned alpha = dstfmt->Amask ? info->a : 0;
+ Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
+ Uint32 ckey = info->colorkey;
+ vector unsigned int valpha;
+ vector unsigned char vpermute;
+ vector unsigned char vzero;
+ vector unsigned int vckey;
+ vector unsigned int vrgbmask;
+ vpermute = calc_swizzle32(srcfmt, dstfmt);
+ if (info->dst_w < 16) {
+ if (copy_alpha) {
+ BlitNtoNKeyCopyAlpha(info);
+ } else {
+ BlitNtoNKey(info);
+ }
+ return;
+ }
+ vzero = vec_splat_u8(0);
+ if (alpha) {
+ ((unsigned char *) &valpha)[0] = (unsigned char) alpha;
+ valpha =
+ (vector unsigned int) vec_splat((vector unsigned char) valpha, 0);
+ } else {
+ valpha = (vector unsigned int) vzero;
+ }
+ ckey &= rgbmask;
+ ((unsigned int *) (char *) &vckey)[0] = ckey;
+ vckey = vec_splat(vckey, 0);
+ ((unsigned int *) (char *) &vrgbmask)[0] = rgbmask;
+ vrgbmask = vec_splat(vrgbmask, 0);
+
+ while (height--) {
+#define ONE_PIXEL_BLEND(condition, widthvar) \
+ if (copy_alpha) { \
+ while (condition) { \
+ Uint32 Pixel; \
+ unsigned sR, sG, sB, sA; \
+ DISEMBLE_RGBA((Uint8 *)srcp, srcbpp, srcfmt, Pixel, \
+ sR, sG, sB, sA); \
+ if ( (Pixel & rgbmask) != ckey ) { \
+ ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \
+ sR, sG, sB, sA); \
+ } \
+ dstp = (Uint32 *) (((Uint8 *) dstp) + dstbpp); \
+ srcp = (Uint32 *) (((Uint8 *) srcp) + srcbpp); \
+ widthvar--; \
+ } \
+ } else { \
+ while (condition) { \
+ Uint32 Pixel; \
+ unsigned sR, sG, sB; \
+ RETRIEVE_RGB_PIXEL((Uint8 *)srcp, srcbpp, Pixel); \
+ if ( Pixel != ckey ) { \
+ RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); \
+ ASSEMBLE_RGBA((Uint8 *)dstp, dstbpp, dstfmt, \
+ sR, sG, sB, alpha); \
+ } \
+ dstp = (Uint32 *) (((Uint8 *)dstp) + dstbpp); \
+ srcp = (Uint32 *) (((Uint8 *)srcp) + srcbpp); \
+ widthvar--; \
+ } \
+ }
+ int width = info->dst_w;
+ ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
+ SDL_assert(width > 0);
+ if (width > 0) {
+ int extrawidth = (width % 4);
+ vector unsigned char valigner = VEC_ALIGNER(srcp);
+ vector unsigned int vs = vec_ld(0, srcp);
+ width -= extrawidth;
+ SDL_assert(width >= 4);
+ while (width) {
+ vector unsigned char vsel;
+ vector unsigned int vd;
+ vector unsigned int voverflow = vec_ld(15, srcp);
+ /* load the source vec */
+ vs = vec_perm(vs, voverflow, valigner);
+ /* vsel is set for items that match the key */
+ vsel = (vector unsigned char) vec_and(vs, vrgbmask);
+ vsel = (vector unsigned char) vec_cmpeq(vs, vckey);
+ /* permute the src vec to the dest format */
+ vs = vec_perm(vs, valpha, vpermute);
+ /* load the destination vec */
+ vd = vec_ld(0, dstp);
+ /* select the source and dest into vs */
+ vd = (vector unsigned int) vec_sel((vector unsigned char) vs,
+ (vector unsigned char) vd,
+ vsel);
+
+ vec_st(vd, 0, dstp);
+ srcp += 4;
+ width -= 4;
+ dstp += 4;
+ vs = voverflow;
+ }
+ ONE_PIXEL_BLEND((extrawidth), extrawidth);
+#undef ONE_PIXEL_BLEND
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+ }
+}
+
+/* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */
+/* Use this on a G5 */
+static void
+ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
+{
+ int height = info->dst_h;
+ Uint32 *src = (Uint32 *) info->src;
+ int srcskip = info->src_skip / 4;
+ Uint32 *dst = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip / 4;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ vector unsigned int vzero = vec_splat_u32(0);
+ vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
+ if (dstfmt->Amask && !srcfmt->Amask) {
+ if (info->a) {
+ vector unsigned char valpha;
+ ((unsigned char *) &valpha)[0] = info->a;
+ vzero = (vector unsigned int) vec_splat(valpha, 0);
+ }
+ }
+
+ SDL_assert(srcfmt->BytesPerPixel == 4);
+ SDL_assert(dstfmt->BytesPerPixel == 4);
+
+ while (height--) {
+ vector unsigned char valigner;
+ vector unsigned int vbits;
+ vector unsigned int voverflow;
+ Uint32 bits;
+ Uint8 r, g, b, a;
+
+ int width = info->dst_w;
+ int extrawidth;
+
+ /* do scalar until we can align... */
+ while ((UNALIGNED_PTR(dst)) && (width)) {
+ bits = *(src++);
+ RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = info->a;
+ *(dst++) = MAKE8888(dstfmt, r, g, b, a);
+ width--;
+ }
+
+ /* After all that work, here's the vector part! */
+ extrawidth = (width % 4);
+ width -= extrawidth;
+ valigner = VEC_ALIGNER(src);
+ vbits = vec_ld(0, src);
+
+ while (width) {
+ voverflow = vec_ld(15, src);
+ src += 4;
+ width -= 4;
+ vbits = vec_perm(vbits, voverflow, valigner); /* src is ready. */
+ vbits = vec_perm(vbits, vzero, vpermute); /* swizzle it. */
+ vec_st(vbits, 0, dst); /* store it back out. */
+ dst += 4;
+ vbits = voverflow;
+ }
+
+ SDL_assert(width == 0);
+
+ /* cover pixels at the end of the row that didn't fit in 16 bytes. */
+ while (extrawidth) {
+ bits = *(src++); /* max 7 pixels, don't bother with prefetch. */
+ RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = info->a;
+ *(dst++) = MAKE8888(dstfmt, r, g, b, a);
+ extrawidth--;
+ }
+
+ src += srcskip;
+ dst += dstskip;
+ }
+
+}
+
+/* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */
+/* Use this on a G4 */
+static void
+ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
+{
+ const int scalar_dst_lead = sizeof(Uint32) * 4;
+ const int vector_dst_lead = sizeof(Uint32) * 16;
+
+ int height = info->dst_h;
+ Uint32 *src = (Uint32 *) info->src;
+ int srcskip = info->src_skip / 4;
+ Uint32 *dst = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip / 4;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ vector unsigned int vzero = vec_splat_u32(0);
+ vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
+ if (dstfmt->Amask && !srcfmt->Amask) {
+ if (info->a) {
+ vector unsigned char valpha;
+ ((unsigned char *) &valpha)[0] = info->a;
+ vzero = (vector unsigned int) vec_splat(valpha, 0);
+ }
+ }
+
+ SDL_assert(srcfmt->BytesPerPixel == 4);
+ SDL_assert(dstfmt->BytesPerPixel == 4);
+
+ while (height--) {
+ vector unsigned char valigner;
+ vector unsigned int vbits;
+ vector unsigned int voverflow;
+ Uint32 bits;
+ Uint8 r, g, b, a;
+
+ int width = info->dst_w;
+ int extrawidth;
+
+ /* do scalar until we can align... */
+ while ((UNALIGNED_PTR(dst)) && (width)) {
+ vec_dstt(src + scalar_dst_lead, DST_CTRL(2, 32, 1024),
+ DST_CHAN_SRC);
+ vec_dstst(dst + scalar_dst_lead, DST_CTRL(2, 32, 1024),
+ DST_CHAN_DEST);
+ bits = *(src++);
+ RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = info->a;
+ *(dst++) = MAKE8888(dstfmt, r, g, b, a);
+ width--;
+ }
+
+ /* After all that work, here's the vector part! */
+ extrawidth = (width % 4);
+ width -= extrawidth;
+ valigner = VEC_ALIGNER(src);
+ vbits = vec_ld(0, src);
+
+ while (width) {
+ vec_dstt(src + vector_dst_lead, DST_CTRL(2, 32, 1024),
+ DST_CHAN_SRC);
+ vec_dstst(dst + vector_dst_lead, DST_CTRL(2, 32, 1024),
+ DST_CHAN_DEST);
+ voverflow = vec_ld(15, src);
+ src += 4;
+ width -= 4;
+ vbits = vec_perm(vbits, voverflow, valigner); /* src is ready. */
+ vbits = vec_perm(vbits, vzero, vpermute); /* swizzle it. */
+ vec_st(vbits, 0, dst); /* store it back out. */
+ dst += 4;
+ vbits = voverflow;
+ }
+
+ SDL_assert(width == 0);
+
+ /* cover pixels at the end of the row that didn't fit in 16 bytes. */
+ while (extrawidth) {
+ bits = *(src++); /* max 7 pixels, don't bother with prefetch. */
+ RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = info->a;
+ *(dst++) = MAKE8888(dstfmt, r, g, b, a);
+ extrawidth--;
+ }
+
+ src += srcskip;
+ dst += dstskip;
+ }
+
+ vec_dss(DST_CHAN_SRC);
+ vec_dss(DST_CHAN_DEST);
+}
+
+static Uint32
+GetBlitFeatures(void)
+{
+ static Uint32 features = 0xffffffff;
+ if (features == 0xffffffff) {
+ /* Provide an override for testing .. */
+ char *override = SDL_getenv("SDL_ALTIVEC_BLIT_FEATURES");
+ if (override) {
+ features = 0;
+ SDL_sscanf(override, "%u", &features);
+ } else {
+ features = (0
+ /* Feature 1 is has-MMX */
+ | ((SDL_HasMMX())? 1 : 0)
+ /* Feature 2 is has-AltiVec */
+ | ((SDL_HasAltiVec())? 2 : 0)
+ /* Feature 4 is dont-use-prefetch */
+ /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */
+ | ((GetL3CacheSize() == 0) ? 4 : 0)
+ );
+ }
+ }
+ return features;
+}
+
+#if __MWERKS__
+#pragma altivec_model off
+#endif
+#else
+/* Feature 1 is has-MMX */
+#define GetBlitFeatures() ((Uint32)(SDL_HasMMX() ? 1 : 0))
+#endif
+
+/* This is now endian dependent */
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+#define HI 1
+#define LO 0
+#else /* SDL_BYTEORDER == SDL_BIG_ENDIAN */
+#define HI 0
+#define LO 1
+#endif
+
+/* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */
+#define RGB888_RGB332(dst, src) { \
+ dst = (Uint8)((((src)&0x00E00000)>>16)| \
+ (((src)&0x0000E000)>>11)| \
+ (((src)&0x000000C0)>>6)); \
+}
+static void
+Blit_RGB888_index8(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint32 *src;
+ const Uint8 *map;
+ Uint8 *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = (Uint32 *) info->src;
+ srcskip = info->src_skip / 4;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+
+ if (map == NULL) {
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ RGB888_RGB332(*dst++, *src);
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width / 4; c; --c) {
+ /* Pack RGB into 8bit pixel */
+ ++src;
+ RGB888_RGB332(*dst++, *src);
+ ++src;
+ RGB888_RGB332(*dst++, *src);
+ ++src;
+ RGB888_RGB332(*dst++, *src);
+ ++src;
+ }
+ switch (width & 3) {
+ case 3:
+ RGB888_RGB332(*dst++, *src);
+ ++src;
+ case 2:
+ RGB888_RGB332(*dst++, *src);
+ ++src;
+ case 1:
+ RGB888_RGB332(*dst++, *src);
+ ++src;
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ int Pixel;
+
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width / 4; c; --c) {
+ /* Pack RGB into 8bit pixel */
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ }
+ switch (width & 3) {
+ case 3:
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ case 2:
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ case 1:
+ RGB888_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+/* Special optimized blit for RGB 10-10-10 --> RGB 3-3-2 */
+#define RGB101010_RGB332(dst, src) { \
+ dst = (Uint8)((((src)&0x38000000)>>22)| \
+ (((src)&0x000E0000)>>15)| \
+ (((src)&0x00000300)>>8)); \
+}
+static void
+Blit_RGB101010_index8(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint32 *src;
+ const Uint8 *map;
+ Uint8 *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = (Uint32 *) info->src;
+ srcskip = info->src_skip / 4;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+
+ if (map == NULL) {
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ RGB101010_RGB332(*dst++, *src);
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width / 4; c; --c) {
+ /* Pack RGB into 8bit pixel */
+ ++src;
+ RGB101010_RGB332(*dst++, *src);
+ ++src;
+ RGB101010_RGB332(*dst++, *src);
+ ++src;
+ RGB101010_RGB332(*dst++, *src);
+ ++src;
+ }
+ switch (width & 3) {
+ case 3:
+ RGB101010_RGB332(*dst++, *src);
+ ++src;
+ case 2:
+ RGB101010_RGB332(*dst++, *src);
+ ++src;
+ case 1:
+ RGB101010_RGB332(*dst++, *src);
+ ++src;
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ int Pixel;
+
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width / 4; c; --c) {
+ /* Pack RGB into 8bit pixel */
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ }
+ switch (width & 3) {
+ case 3:
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ case 2:
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ case 1:
+ RGB101010_RGB332(Pixel, *src);
+ *dst++ = map[Pixel];
+ ++src;
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+/* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */
+#define RGB888_RGB555(dst, src) { \
+ *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
+ (((*src)&0x0000F800)>>6)| \
+ (((*src)&0x000000F8)>>3)); \
+}
+#ifndef USE_DUFFS_LOOP
+#define RGB888_RGB555_TWO(dst, src) { \
+ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \
+ (((src[HI])&0x0000F800)>>6)| \
+ (((src[HI])&0x000000F8)>>3))<<16)| \
+ (((src[LO])&0x00F80000)>>9)| \
+ (((src[LO])&0x0000F800)>>6)| \
+ (((src[LO])&0x000000F8)>>3); \
+}
+#endif
+static void
+Blit_RGB888_RGB555(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint32 *src;
+ Uint16 *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = (Uint32 *) info->src;
+ srcskip = info->src_skip / 4;
+ dst = (Uint16 *) info->dst;
+ dstskip = info->dst_skip / 2;
+
+#ifdef USE_DUFFS_LOOP
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ RGB888_RGB555(dst, src);
+ ++src;
+ ++dst;
+ , width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+#else
+ /* Memory align at 4-byte boundary, if necessary */
+ if ((long) dst & 0x03) {
+ /* Don't do anything if width is 0 */
+ if (width == 0) {
+ return;
+ }
+ --width;
+
+ while (height--) {
+ /* Perform copy alignment */
+ RGB888_RGB555(dst, src);
+ ++src;
+ ++dst;
+
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ RGB888_RGB555_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ RGB888_RGB555_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ RGB888_RGB555(dst, src);
+ ++src;
+ ++dst;
+ case 2:
+ RGB888_RGB555_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ break;
+ case 1:
+ RGB888_RGB555(dst, src);
+ ++src;
+ ++dst;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ RGB888_RGB555_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ RGB888_RGB555_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ RGB888_RGB555(dst, src);
+ ++src;
+ ++dst;
+ case 2:
+ RGB888_RGB555_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ break;
+ case 1:
+ RGB888_RGB555(dst, src);
+ ++src;
+ ++dst;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+#endif /* USE_DUFFS_LOOP */
+}
+
+/* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */
+#define RGB888_RGB565(dst, src) { \
+ *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
+ (((*src)&0x0000FC00)>>5)| \
+ (((*src)&0x000000F8)>>3)); \
+}
+#ifndef USE_DUFFS_LOOP
+#define RGB888_RGB565_TWO(dst, src) { \
+ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \
+ (((src[HI])&0x0000FC00)>>5)| \
+ (((src[HI])&0x000000F8)>>3))<<16)| \
+ (((src[LO])&0x00F80000)>>8)| \
+ (((src[LO])&0x0000FC00)>>5)| \
+ (((src[LO])&0x000000F8)>>3); \
+}
+#endif
+static void
+Blit_RGB888_RGB565(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint32 *src;
+ Uint16 *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = (Uint32 *) info->src;
+ srcskip = info->src_skip / 4;
+ dst = (Uint16 *) info->dst;
+ dstskip = info->dst_skip / 2;
+
+#ifdef USE_DUFFS_LOOP
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ RGB888_RGB565(dst, src);
+ ++src;
+ ++dst;
+ , width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+#else
+ /* Memory align at 4-byte boundary, if necessary */
+ if ((long) dst & 0x03) {
+ /* Don't do anything if width is 0 */
+ if (width == 0) {
+ return;
+ }
+ --width;
+
+ while (height--) {
+ /* Perform copy alignment */
+ RGB888_RGB565(dst, src);
+ ++src;
+ ++dst;
+
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ RGB888_RGB565_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ RGB888_RGB565_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ RGB888_RGB565(dst, src);
+ ++src;
+ ++dst;
+ case 2:
+ RGB888_RGB565_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ break;
+ case 1:
+ RGB888_RGB565(dst, src);
+ ++src;
+ ++dst;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ RGB888_RGB565_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ RGB888_RGB565_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ RGB888_RGB565(dst, src);
+ ++src;
+ ++dst;
+ case 2:
+ RGB888_RGB565_TWO(dst, src);
+ src += 2;
+ dst += 2;
+ break;
+ case 1:
+ RGB888_RGB565(dst, src);
+ ++src;
+ ++dst;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+#endif /* USE_DUFFS_LOOP */
+}
+
+
+/* Special optimized blit for RGB 5-6-5 --> 32-bit RGB surfaces */
+#define RGB565_32(dst, src, map) (map[src[LO]*2] + map[src[HI]*2+1])
+static void
+Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint8 *src;
+ Uint32 *dst;
+ int srcskip, dstskip;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = (Uint8 *) info->src;
+ srcskip = info->src_skip;
+ dst = (Uint32 *) info->dst;
+ dstskip = info->dst_skip / 4;
+
+#ifdef USE_DUFFS_LOOP
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+#else
+ while (height--) {
+ /* Copy in 4 pixel chunks */
+ for (c = width / 4; c; --c) {
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ }
+ /* Get any leftovers */
+ switch (width & 3) {
+ case 3:
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ case 2:
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ case 1:
+ *dst++ = RGB565_32(dst, src, map);
+ src += 2;
+ break;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+#endif /* USE_DUFFS_LOOP */
+}
+
+/* Special optimized blit for RGB 5-6-5 --> ARGB 8-8-8-8 */
+static const Uint32 RGB565_ARGB8888_LUT[512] = {
+ 0x00000000, 0xff000000, 0x00000008, 0xff002000,
+ 0x00000010, 0xff004000, 0x00000018, 0xff006100,
+ 0x00000020, 0xff008100, 0x00000029, 0xff00a100,
+ 0x00000031, 0xff00c200, 0x00000039, 0xff00e200,
+ 0x00000041, 0xff080000, 0x0000004a, 0xff082000,
+ 0x00000052, 0xff084000, 0x0000005a, 0xff086100,
+ 0x00000062, 0xff088100, 0x0000006a, 0xff08a100,
+ 0x00000073, 0xff08c200, 0x0000007b, 0xff08e200,
+ 0x00000083, 0xff100000, 0x0000008b, 0xff102000,
+ 0x00000094, 0xff104000, 0x0000009c, 0xff106100,
+ 0x000000a4, 0xff108100, 0x000000ac, 0xff10a100,
+ 0x000000b4, 0xff10c200, 0x000000bd, 0xff10e200,
+ 0x000000c5, 0xff180000, 0x000000cd, 0xff182000,
+ 0x000000d5, 0xff184000, 0x000000de, 0xff186100,
+ 0x000000e6, 0xff188100, 0x000000ee, 0xff18a100,
+ 0x000000f6, 0xff18c200, 0x000000ff, 0xff18e200,
+ 0x00000400, 0xff200000, 0x00000408, 0xff202000,
+ 0x00000410, 0xff204000, 0x00000418, 0xff206100,
+ 0x00000420, 0xff208100, 0x00000429, 0xff20a100,
+ 0x00000431, 0xff20c200, 0x00000439, 0xff20e200,
+ 0x00000441, 0xff290000, 0x0000044a, 0xff292000,
+ 0x00000452, 0xff294000, 0x0000045a, 0xff296100,
+ 0x00000462, 0xff298100, 0x0000046a, 0xff29a100,
+ 0x00000473, 0xff29c200, 0x0000047b, 0xff29e200,
+ 0x00000483, 0xff310000, 0x0000048b, 0xff312000,
+ 0x00000494, 0xff314000, 0x0000049c, 0xff316100,
+ 0x000004a4, 0xff318100, 0x000004ac, 0xff31a100,
+ 0x000004b4, 0xff31c200, 0x000004bd, 0xff31e200,
+ 0x000004c5, 0xff390000, 0x000004cd, 0xff392000,
+ 0x000004d5, 0xff394000, 0x000004de, 0xff396100,
+ 0x000004e6, 0xff398100, 0x000004ee, 0xff39a100,
+ 0x000004f6, 0xff39c200, 0x000004ff, 0xff39e200,
+ 0x00000800, 0xff410000, 0x00000808, 0xff412000,
+ 0x00000810, 0xff414000, 0x00000818, 0xff416100,
+ 0x00000820, 0xff418100, 0x00000829, 0xff41a100,
+ 0x00000831, 0xff41c200, 0x00000839, 0xff41e200,
+ 0x00000841, 0xff4a0000, 0x0000084a, 0xff4a2000,
+ 0x00000852, 0xff4a4000, 0x0000085a, 0xff4a6100,
+ 0x00000862, 0xff4a8100, 0x0000086a, 0xff4aa100,
+ 0x00000873, 0xff4ac200, 0x0000087b, 0xff4ae200,
+ 0x00000883, 0xff520000, 0x0000088b, 0xff522000,
+ 0x00000894, 0xff524000, 0x0000089c, 0xff526100,
+ 0x000008a4, 0xff528100, 0x000008ac, 0xff52a100,
+ 0x000008b4, 0xff52c200, 0x000008bd, 0xff52e200,
+ 0x000008c5, 0xff5a0000, 0x000008cd, 0xff5a2000,
+ 0x000008d5, 0xff5a4000, 0x000008de, 0xff5a6100,
+ 0x000008e6, 0xff5a8100, 0x000008ee, 0xff5aa100,
+ 0x000008f6, 0xff5ac200, 0x000008ff, 0xff5ae200,
+ 0x00000c00, 0xff620000, 0x00000c08, 0xff622000,
+ 0x00000c10, 0xff624000, 0x00000c18, 0xff626100,
+ 0x00000c20, 0xff628100, 0x00000c29, 0xff62a100,
+ 0x00000c31, 0xff62c200, 0x00000c39, 0xff62e200,
+ 0x00000c41, 0xff6a0000, 0x00000c4a, 0xff6a2000,
+ 0x00000c52, 0xff6a4000, 0x00000c5a, 0xff6a6100,
+ 0x00000c62, 0xff6a8100, 0x00000c6a, 0xff6aa100,
+ 0x00000c73, 0xff6ac200, 0x00000c7b, 0xff6ae200,
+ 0x00000c83, 0xff730000, 0x00000c8b, 0xff732000,
+ 0x00000c94, 0xff734000, 0x00000c9c, 0xff736100,
+ 0x00000ca4, 0xff738100, 0x00000cac, 0xff73a100,
+ 0x00000cb4, 0xff73c200, 0x00000cbd, 0xff73e200,
+ 0x00000cc5, 0xff7b0000, 0x00000ccd, 0xff7b2000,
+ 0x00000cd5, 0xff7b4000, 0x00000cde, 0xff7b6100,
+ 0x00000ce6, 0xff7b8100, 0x00000cee, 0xff7ba100,
+ 0x00000cf6, 0xff7bc200, 0x00000cff, 0xff7be200,
+ 0x00001000, 0xff830000, 0x00001008, 0xff832000,
+ 0x00001010, 0xff834000, 0x00001018, 0xff836100,
+ 0x00001020, 0xff838100, 0x00001029, 0xff83a100,
+ 0x00001031, 0xff83c200, 0x00001039, 0xff83e200,
+ 0x00001041, 0xff8b0000, 0x0000104a, 0xff8b2000,
+ 0x00001052, 0xff8b4000, 0x0000105a, 0xff8b6100,
+ 0x00001062, 0xff8b8100, 0x0000106a, 0xff8ba100,
+ 0x00001073, 0xff8bc200, 0x0000107b, 0xff8be200,
+ 0x00001083, 0xff940000, 0x0000108b, 0xff942000,
+ 0x00001094, 0xff944000, 0x0000109c, 0xff946100,
+ 0x000010a4, 0xff948100, 0x000010ac, 0xff94a100,
+ 0x000010b4, 0xff94c200, 0x000010bd, 0xff94e200,
+ 0x000010c5, 0xff9c0000, 0x000010cd, 0xff9c2000,
+ 0x000010d5, 0xff9c4000, 0x000010de, 0xff9c6100,
+ 0x000010e6, 0xff9c8100, 0x000010ee, 0xff9ca100,
+ 0x000010f6, 0xff9cc200, 0x000010ff, 0xff9ce200,
+ 0x00001400, 0xffa40000, 0x00001408, 0xffa42000,
+ 0x00001410, 0xffa44000, 0x00001418, 0xffa46100,
+ 0x00001420, 0xffa48100, 0x00001429, 0xffa4a100,
+ 0x00001431, 0xffa4c200, 0x00001439, 0xffa4e200,
+ 0x00001441, 0xffac0000, 0x0000144a, 0xffac2000,
+ 0x00001452, 0xffac4000, 0x0000145a, 0xffac6100,
+ 0x00001462, 0xffac8100, 0x0000146a, 0xffaca100,
+ 0x00001473, 0xffacc200, 0x0000147b, 0xfface200,
+ 0x00001483, 0xffb40000, 0x0000148b, 0xffb42000,
+ 0x00001494, 0xffb44000, 0x0000149c, 0xffb46100,
+ 0x000014a4, 0xffb48100, 0x000014ac, 0xffb4a100,
+ 0x000014b4, 0xffb4c200, 0x000014bd, 0xffb4e200,
+ 0x000014c5, 0xffbd0000, 0x000014cd, 0xffbd2000,
+ 0x000014d5, 0xffbd4000, 0x000014de, 0xffbd6100,
+ 0x000014e6, 0xffbd8100, 0x000014ee, 0xffbda100,
+ 0x000014f6, 0xffbdc200, 0x000014ff, 0xffbde200,
+ 0x00001800, 0xffc50000, 0x00001808, 0xffc52000,
+ 0x00001810, 0xffc54000, 0x00001818, 0xffc56100,
+ 0x00001820, 0xffc58100, 0x00001829, 0xffc5a100,
+ 0x00001831, 0xffc5c200, 0x00001839, 0xffc5e200,
+ 0x00001841, 0xffcd0000, 0x0000184a, 0xffcd2000,
+ 0x00001852, 0xffcd4000, 0x0000185a, 0xffcd6100,
+ 0x00001862, 0xffcd8100, 0x0000186a, 0xffcda100,
+ 0x00001873, 0xffcdc200, 0x0000187b, 0xffcde200,
+ 0x00001883, 0xffd50000, 0x0000188b, 0xffd52000,
+ 0x00001894, 0xffd54000, 0x0000189c, 0xffd56100,
+ 0x000018a4, 0xffd58100, 0x000018ac, 0xffd5a100,
+ 0x000018b4, 0xffd5c200, 0x000018bd, 0xffd5e200,
+ 0x000018c5, 0xffde0000, 0x000018cd, 0xffde2000,
+ 0x000018d5, 0xffde4000, 0x000018de, 0xffde6100,
+ 0x000018e6, 0xffde8100, 0x000018ee, 0xffdea100,
+ 0x000018f6, 0xffdec200, 0x000018ff, 0xffdee200,
+ 0x00001c00, 0xffe60000, 0x00001c08, 0xffe62000,
+ 0x00001c10, 0xffe64000, 0x00001c18, 0xffe66100,
+ 0x00001c20, 0xffe68100, 0x00001c29, 0xffe6a100,
+ 0x00001c31, 0xffe6c200, 0x00001c39, 0xffe6e200,
+ 0x00001c41, 0xffee0000, 0x00001c4a, 0xffee2000,
+ 0x00001c52, 0xffee4000, 0x00001c5a, 0xffee6100,
+ 0x00001c62, 0xffee8100, 0x00001c6a, 0xffeea100,
+ 0x00001c73, 0xffeec200, 0x00001c7b, 0xffeee200,
+ 0x00001c83, 0xfff60000, 0x00001c8b, 0xfff62000,
+ 0x00001c94, 0xfff64000, 0x00001c9c, 0xfff66100,
+ 0x00001ca4, 0xfff68100, 0x00001cac, 0xfff6a100,
+ 0x00001cb4, 0xfff6c200, 0x00001cbd, 0xfff6e200,
+ 0x00001cc5, 0xffff0000, 0x00001ccd, 0xffff2000,
+ 0x00001cd5, 0xffff4000, 0x00001cde, 0xffff6100,
+ 0x00001ce6, 0xffff8100, 0x00001cee, 0xffffa100,
+ 0x00001cf6, 0xffffc200, 0x00001cff, 0xffffe200
+};
+
+static void
+Blit_RGB565_ARGB8888(SDL_BlitInfo * info)
+{
+ Blit_RGB565_32(info, RGB565_ARGB8888_LUT);
+}
+
+/* Special optimized blit for RGB 5-6-5 --> ABGR 8-8-8-8 */
+static const Uint32 RGB565_ABGR8888_LUT[512] = {
+ 0xff000000, 0x00000000, 0xff080000, 0x00002000,
+ 0xff100000, 0x00004000, 0xff180000, 0x00006100,
+ 0xff200000, 0x00008100, 0xff290000, 0x0000a100,
+ 0xff310000, 0x0000c200, 0xff390000, 0x0000e200,
+ 0xff410000, 0x00000008, 0xff4a0000, 0x00002008,
+ 0xff520000, 0x00004008, 0xff5a0000, 0x00006108,
+ 0xff620000, 0x00008108, 0xff6a0000, 0x0000a108,
+ 0xff730000, 0x0000c208, 0xff7b0000, 0x0000e208,
+ 0xff830000, 0x00000010, 0xff8b0000, 0x00002010,
+ 0xff940000, 0x00004010, 0xff9c0000, 0x00006110,
+ 0xffa40000, 0x00008110, 0xffac0000, 0x0000a110,
+ 0xffb40000, 0x0000c210, 0xffbd0000, 0x0000e210,
+ 0xffc50000, 0x00000018, 0xffcd0000, 0x00002018,
+ 0xffd50000, 0x00004018, 0xffde0000, 0x00006118,
+ 0xffe60000, 0x00008118, 0xffee0000, 0x0000a118,
+ 0xfff60000, 0x0000c218, 0xffff0000, 0x0000e218,
+ 0xff000400, 0x00000020, 0xff080400, 0x00002020,
+ 0xff100400, 0x00004020, 0xff180400, 0x00006120,
+ 0xff200400, 0x00008120, 0xff290400, 0x0000a120,
+ 0xff310400, 0x0000c220, 0xff390400, 0x0000e220,
+ 0xff410400, 0x00000029, 0xff4a0400, 0x00002029,
+ 0xff520400, 0x00004029, 0xff5a0400, 0x00006129,
+ 0xff620400, 0x00008129, 0xff6a0400, 0x0000a129,
+ 0xff730400, 0x0000c229, 0xff7b0400, 0x0000e229,
+ 0xff830400, 0x00000031, 0xff8b0400, 0x00002031,
+ 0xff940400, 0x00004031, 0xff9c0400, 0x00006131,
+ 0xffa40400, 0x00008131, 0xffac0400, 0x0000a131,
+ 0xffb40400, 0x0000c231, 0xffbd0400, 0x0000e231,
+ 0xffc50400, 0x00000039, 0xffcd0400, 0x00002039,
+ 0xffd50400, 0x00004039, 0xffde0400, 0x00006139,
+ 0xffe60400, 0x00008139, 0xffee0400, 0x0000a139,
+ 0xfff60400, 0x0000c239, 0xffff0400, 0x0000e239,
+ 0xff000800, 0x00000041, 0xff080800, 0x00002041,
+ 0xff100800, 0x00004041, 0xff180800, 0x00006141,
+ 0xff200800, 0x00008141, 0xff290800, 0x0000a141,
+ 0xff310800, 0x0000c241, 0xff390800, 0x0000e241,
+ 0xff410800, 0x0000004a, 0xff4a0800, 0x0000204a,
+ 0xff520800, 0x0000404a, 0xff5a0800, 0x0000614a,
+ 0xff620800, 0x0000814a, 0xff6a0800, 0x0000a14a,
+ 0xff730800, 0x0000c24a, 0xff7b0800, 0x0000e24a,
+ 0xff830800, 0x00000052, 0xff8b0800, 0x00002052,
+ 0xff940800, 0x00004052, 0xff9c0800, 0x00006152,
+ 0xffa40800, 0x00008152, 0xffac0800, 0x0000a152,
+ 0xffb40800, 0x0000c252, 0xffbd0800, 0x0000e252,
+ 0xffc50800, 0x0000005a, 0xffcd0800, 0x0000205a,
+ 0xffd50800, 0x0000405a, 0xffde0800, 0x0000615a,
+ 0xffe60800, 0x0000815a, 0xffee0800, 0x0000a15a,
+ 0xfff60800, 0x0000c25a, 0xffff0800, 0x0000e25a,
+ 0xff000c00, 0x00000062, 0xff080c00, 0x00002062,
+ 0xff100c00, 0x00004062, 0xff180c00, 0x00006162,
+ 0xff200c00, 0x00008162, 0xff290c00, 0x0000a162,
+ 0xff310c00, 0x0000c262, 0xff390c00, 0x0000e262,
+ 0xff410c00, 0x0000006a, 0xff4a0c00, 0x0000206a,
+ 0xff520c00, 0x0000406a, 0xff5a0c00, 0x0000616a,
+ 0xff620c00, 0x0000816a, 0xff6a0c00, 0x0000a16a,
+ 0xff730c00, 0x0000c26a, 0xff7b0c00, 0x0000e26a,
+ 0xff830c00, 0x00000073, 0xff8b0c00, 0x00002073,
+ 0xff940c00, 0x00004073, 0xff9c0c00, 0x00006173,
+ 0xffa40c00, 0x00008173, 0xffac0c00, 0x0000a173,
+ 0xffb40c00, 0x0000c273, 0xffbd0c00, 0x0000e273,
+ 0xffc50c00, 0x0000007b, 0xffcd0c00, 0x0000207b,
+ 0xffd50c00, 0x0000407b, 0xffde0c00, 0x0000617b,
+ 0xffe60c00, 0x0000817b, 0xffee0c00, 0x0000a17b,
+ 0xfff60c00, 0x0000c27b, 0xffff0c00, 0x0000e27b,
+ 0xff001000, 0x00000083, 0xff081000, 0x00002083,
+ 0xff101000, 0x00004083, 0xff181000, 0x00006183,
+ 0xff201000, 0x00008183, 0xff291000, 0x0000a183,
+ 0xff311000, 0x0000c283, 0xff391000, 0x0000e283,
+ 0xff411000, 0x0000008b, 0xff4a1000, 0x0000208b,
+ 0xff521000, 0x0000408b, 0xff5a1000, 0x0000618b,
+ 0xff621000, 0x0000818b, 0xff6a1000, 0x0000a18b,
+ 0xff731000, 0x0000c28b, 0xff7b1000, 0x0000e28b,
+ 0xff831000, 0x00000094, 0xff8b1000, 0x00002094,
+ 0xff941000, 0x00004094, 0xff9c1000, 0x00006194,
+ 0xffa41000, 0x00008194, 0xffac1000, 0x0000a194,
+ 0xffb41000, 0x0000c294, 0xffbd1000, 0x0000e294,
+ 0xffc51000, 0x0000009c, 0xffcd1000, 0x0000209c,
+ 0xffd51000, 0x0000409c, 0xffde1000, 0x0000619c,
+ 0xffe61000, 0x0000819c, 0xffee1000, 0x0000a19c,
+ 0xfff61000, 0x0000c29c, 0xffff1000, 0x0000e29c,
+ 0xff001400, 0x000000a4, 0xff081400, 0x000020a4,
+ 0xff101400, 0x000040a4, 0xff181400, 0x000061a4,
+ 0xff201400, 0x000081a4, 0xff291400, 0x0000a1a4,
+ 0xff311400, 0x0000c2a4, 0xff391400, 0x0000e2a4,
+ 0xff411400, 0x000000ac, 0xff4a1400, 0x000020ac,
+ 0xff521400, 0x000040ac, 0xff5a1400, 0x000061ac,
+ 0xff621400, 0x000081ac, 0xff6a1400, 0x0000a1ac,
+ 0xff731400, 0x0000c2ac, 0xff7b1400, 0x0000e2ac,
+ 0xff831400, 0x000000b4, 0xff8b1400, 0x000020b4,
+ 0xff941400, 0x000040b4, 0xff9c1400, 0x000061b4,
+ 0xffa41400, 0x000081b4, 0xffac1400, 0x0000a1b4,
+ 0xffb41400, 0x0000c2b4, 0xffbd1400, 0x0000e2b4,
+ 0xffc51400, 0x000000bd, 0xffcd1400, 0x000020bd,
+ 0xffd51400, 0x000040bd, 0xffde1400, 0x000061bd,
+ 0xffe61400, 0x000081bd, 0xffee1400, 0x0000a1bd,
+ 0xfff61400, 0x0000c2bd, 0xffff1400, 0x0000e2bd,
+ 0xff001800, 0x000000c5, 0xff081800, 0x000020c5,
+ 0xff101800, 0x000040c5, 0xff181800, 0x000061c5,
+ 0xff201800, 0x000081c5, 0xff291800, 0x0000a1c5,
+ 0xff311800, 0x0000c2c5, 0xff391800, 0x0000e2c5,
+ 0xff411800, 0x000000cd, 0xff4a1800, 0x000020cd,
+ 0xff521800, 0x000040cd, 0xff5a1800, 0x000061cd,
+ 0xff621800, 0x000081cd, 0xff6a1800, 0x0000a1cd,
+ 0xff731800, 0x0000c2cd, 0xff7b1800, 0x0000e2cd,
+ 0xff831800, 0x000000d5, 0xff8b1800, 0x000020d5,
+ 0xff941800, 0x000040d5, 0xff9c1800, 0x000061d5,
+ 0xffa41800, 0x000081d5, 0xffac1800, 0x0000a1d5,
+ 0xffb41800, 0x0000c2d5, 0xffbd1800, 0x0000e2d5,
+ 0xffc51800, 0x000000de, 0xffcd1800, 0x000020de,
+ 0xffd51800, 0x000040de, 0xffde1800, 0x000061de,
+ 0xffe61800, 0x000081de, 0xffee1800, 0x0000a1de,
+ 0xfff61800, 0x0000c2de, 0xffff1800, 0x0000e2de,
+ 0xff001c00, 0x000000e6, 0xff081c00, 0x000020e6,
+ 0xff101c00, 0x000040e6, 0xff181c00, 0x000061e6,
+ 0xff201c00, 0x000081e6, 0xff291c00, 0x0000a1e6,
+ 0xff311c00, 0x0000c2e6, 0xff391c00, 0x0000e2e6,
+ 0xff411c00, 0x000000ee, 0xff4a1c00, 0x000020ee,
+ 0xff521c00, 0x000040ee, 0xff5a1c00, 0x000061ee,
+ 0xff621c00, 0x000081ee, 0xff6a1c00, 0x0000a1ee,
+ 0xff731c00, 0x0000c2ee, 0xff7b1c00, 0x0000e2ee,
+ 0xff831c00, 0x000000f6, 0xff8b1c00, 0x000020f6,
+ 0xff941c00, 0x000040f6, 0xff9c1c00, 0x000061f6,
+ 0xffa41c00, 0x000081f6, 0xffac1c00, 0x0000a1f6,
+ 0xffb41c00, 0x0000c2f6, 0xffbd1c00, 0x0000e2f6,
+ 0xffc51c00, 0x000000ff, 0xffcd1c00, 0x000020ff,
+ 0xffd51c00, 0x000040ff, 0xffde1c00, 0x000061ff,
+ 0xffe61c00, 0x000081ff, 0xffee1c00, 0x0000a1ff,
+ 0xfff61c00, 0x0000c2ff, 0xffff1c00, 0x0000e2ff
+};
+
+static void
+Blit_RGB565_ABGR8888(SDL_BlitInfo * info)
+{
+ Blit_RGB565_32(info, RGB565_ABGR8888_LUT);
+}
+
+/* Special optimized blit for RGB 5-6-5 --> RGBA 8-8-8-8 */
+static const Uint32 RGB565_RGBA8888_LUT[512] = {
+ 0x000000ff, 0x00000000, 0x000008ff, 0x00200000,
+ 0x000010ff, 0x00400000, 0x000018ff, 0x00610000,
+ 0x000020ff, 0x00810000, 0x000029ff, 0x00a10000,
+ 0x000031ff, 0x00c20000, 0x000039ff, 0x00e20000,
+ 0x000041ff, 0x08000000, 0x00004aff, 0x08200000,
+ 0x000052ff, 0x08400000, 0x00005aff, 0x08610000,
+ 0x000062ff, 0x08810000, 0x00006aff, 0x08a10000,
+ 0x000073ff, 0x08c20000, 0x00007bff, 0x08e20000,
+ 0x000083ff, 0x10000000, 0x00008bff, 0x10200000,
+ 0x000094ff, 0x10400000, 0x00009cff, 0x10610000,
+ 0x0000a4ff, 0x10810000, 0x0000acff, 0x10a10000,
+ 0x0000b4ff, 0x10c20000, 0x0000bdff, 0x10e20000,
+ 0x0000c5ff, 0x18000000, 0x0000cdff, 0x18200000,
+ 0x0000d5ff, 0x18400000, 0x0000deff, 0x18610000,
+ 0x0000e6ff, 0x18810000, 0x0000eeff, 0x18a10000,
+ 0x0000f6ff, 0x18c20000, 0x0000ffff, 0x18e20000,
+ 0x000400ff, 0x20000000, 0x000408ff, 0x20200000,
+ 0x000410ff, 0x20400000, 0x000418ff, 0x20610000,
+ 0x000420ff, 0x20810000, 0x000429ff, 0x20a10000,
+ 0x000431ff, 0x20c20000, 0x000439ff, 0x20e20000,
+ 0x000441ff, 0x29000000, 0x00044aff, 0x29200000,
+ 0x000452ff, 0x29400000, 0x00045aff, 0x29610000,
+ 0x000462ff, 0x29810000, 0x00046aff, 0x29a10000,
+ 0x000473ff, 0x29c20000, 0x00047bff, 0x29e20000,
+ 0x000483ff, 0x31000000, 0x00048bff, 0x31200000,
+ 0x000494ff, 0x31400000, 0x00049cff, 0x31610000,
+ 0x0004a4ff, 0x31810000, 0x0004acff, 0x31a10000,
+ 0x0004b4ff, 0x31c20000, 0x0004bdff, 0x31e20000,
+ 0x0004c5ff, 0x39000000, 0x0004cdff, 0x39200000,
+ 0x0004d5ff, 0x39400000, 0x0004deff, 0x39610000,
+ 0x0004e6ff, 0x39810000, 0x0004eeff, 0x39a10000,
+ 0x0004f6ff, 0x39c20000, 0x0004ffff, 0x39e20000,
+ 0x000800ff, 0x41000000, 0x000808ff, 0x41200000,
+ 0x000810ff, 0x41400000, 0x000818ff, 0x41610000,
+ 0x000820ff, 0x41810000, 0x000829ff, 0x41a10000,
+ 0x000831ff, 0x41c20000, 0x000839ff, 0x41e20000,
+ 0x000841ff, 0x4a000000, 0x00084aff, 0x4a200000,
+ 0x000852ff, 0x4a400000, 0x00085aff, 0x4a610000,
+ 0x000862ff, 0x4a810000, 0x00086aff, 0x4aa10000,
+ 0x000873ff, 0x4ac20000, 0x00087bff, 0x4ae20000,
+ 0x000883ff, 0x52000000, 0x00088bff, 0x52200000,
+ 0x000894ff, 0x52400000, 0x00089cff, 0x52610000,
+ 0x0008a4ff, 0x52810000, 0x0008acff, 0x52a10000,
+ 0x0008b4ff, 0x52c20000, 0x0008bdff, 0x52e20000,
+ 0x0008c5ff, 0x5a000000, 0x0008cdff, 0x5a200000,
+ 0x0008d5ff, 0x5a400000, 0x0008deff, 0x5a610000,
+ 0x0008e6ff, 0x5a810000, 0x0008eeff, 0x5aa10000,
+ 0x0008f6ff, 0x5ac20000, 0x0008ffff, 0x5ae20000,
+ 0x000c00ff, 0x62000000, 0x000c08ff, 0x62200000,
+ 0x000c10ff, 0x62400000, 0x000c18ff, 0x62610000,
+ 0x000c20ff, 0x62810000, 0x000c29ff, 0x62a10000,
+ 0x000c31ff, 0x62c20000, 0x000c39ff, 0x62e20000,
+ 0x000c41ff, 0x6a000000, 0x000c4aff, 0x6a200000,
+ 0x000c52ff, 0x6a400000, 0x000c5aff, 0x6a610000,
+ 0x000c62ff, 0x6a810000, 0x000c6aff, 0x6aa10000,
+ 0x000c73ff, 0x6ac20000, 0x000c7bff, 0x6ae20000,
+ 0x000c83ff, 0x73000000, 0x000c8bff, 0x73200000,
+ 0x000c94ff, 0x73400000, 0x000c9cff, 0x73610000,
+ 0x000ca4ff, 0x73810000, 0x000cacff, 0x73a10000,
+ 0x000cb4ff, 0x73c20000, 0x000cbdff, 0x73e20000,
+ 0x000cc5ff, 0x7b000000, 0x000ccdff, 0x7b200000,
+ 0x000cd5ff, 0x7b400000, 0x000cdeff, 0x7b610000,
+ 0x000ce6ff, 0x7b810000, 0x000ceeff, 0x7ba10000,
+ 0x000cf6ff, 0x7bc20000, 0x000cffff, 0x7be20000,
+ 0x001000ff, 0x83000000, 0x001008ff, 0x83200000,
+ 0x001010ff, 0x83400000, 0x001018ff, 0x83610000,
+ 0x001020ff, 0x83810000, 0x001029ff, 0x83a10000,
+ 0x001031ff, 0x83c20000, 0x001039ff, 0x83e20000,
+ 0x001041ff, 0x8b000000, 0x00104aff, 0x8b200000,
+ 0x001052ff, 0x8b400000, 0x00105aff, 0x8b610000,
+ 0x001062ff, 0x8b810000, 0x00106aff, 0x8ba10000,
+ 0x001073ff, 0x8bc20000, 0x00107bff, 0x8be20000,
+ 0x001083ff, 0x94000000, 0x00108bff, 0x94200000,
+ 0x001094ff, 0x94400000, 0x00109cff, 0x94610000,
+ 0x0010a4ff, 0x94810000, 0x0010acff, 0x94a10000,
+ 0x0010b4ff, 0x94c20000, 0x0010bdff, 0x94e20000,
+ 0x0010c5ff, 0x9c000000, 0x0010cdff, 0x9c200000,
+ 0x0010d5ff, 0x9c400000, 0x0010deff, 0x9c610000,
+ 0x0010e6ff, 0x9c810000, 0x0010eeff, 0x9ca10000,
+ 0x0010f6ff, 0x9cc20000, 0x0010ffff, 0x9ce20000,
+ 0x001400ff, 0xa4000000, 0x001408ff, 0xa4200000,
+ 0x001410ff, 0xa4400000, 0x001418ff, 0xa4610000,
+ 0x001420ff, 0xa4810000, 0x001429ff, 0xa4a10000,
+ 0x001431ff, 0xa4c20000, 0x001439ff, 0xa4e20000,
+ 0x001441ff, 0xac000000, 0x00144aff, 0xac200000,
+ 0x001452ff, 0xac400000, 0x00145aff, 0xac610000,
+ 0x001462ff, 0xac810000, 0x00146aff, 0xaca10000,
+ 0x001473ff, 0xacc20000, 0x00147bff, 0xace20000,
+ 0x001483ff, 0xb4000000, 0x00148bff, 0xb4200000,
+ 0x001494ff, 0xb4400000, 0x00149cff, 0xb4610000,
+ 0x0014a4ff, 0xb4810000, 0x0014acff, 0xb4a10000,
+ 0x0014b4ff, 0xb4c20000, 0x0014bdff, 0xb4e20000,
+ 0x0014c5ff, 0xbd000000, 0x0014cdff, 0xbd200000,
+ 0x0014d5ff, 0xbd400000, 0x0014deff, 0xbd610000,
+ 0x0014e6ff, 0xbd810000, 0x0014eeff, 0xbda10000,
+ 0x0014f6ff, 0xbdc20000, 0x0014ffff, 0xbde20000,
+ 0x001800ff, 0xc5000000, 0x001808ff, 0xc5200000,
+ 0x001810ff, 0xc5400000, 0x001818ff, 0xc5610000,
+ 0x001820ff, 0xc5810000, 0x001829ff, 0xc5a10000,
+ 0x001831ff, 0xc5c20000, 0x001839ff, 0xc5e20000,
+ 0x001841ff, 0xcd000000, 0x00184aff, 0xcd200000,
+ 0x001852ff, 0xcd400000, 0x00185aff, 0xcd610000,
+ 0x001862ff, 0xcd810000, 0x00186aff, 0xcda10000,
+ 0x001873ff, 0xcdc20000, 0x00187bff, 0xcde20000,
+ 0x001883ff, 0xd5000000, 0x00188bff, 0xd5200000,
+ 0x001894ff, 0xd5400000, 0x00189cff, 0xd5610000,
+ 0x0018a4ff, 0xd5810000, 0x0018acff, 0xd5a10000,
+ 0x0018b4ff, 0xd5c20000, 0x0018bdff, 0xd5e20000,
+ 0x0018c5ff, 0xde000000, 0x0018cdff, 0xde200000,
+ 0x0018d5ff, 0xde400000, 0x0018deff, 0xde610000,
+ 0x0018e6ff, 0xde810000, 0x0018eeff, 0xdea10000,
+ 0x0018f6ff, 0xdec20000, 0x0018ffff, 0xdee20000,
+ 0x001c00ff, 0xe6000000, 0x001c08ff, 0xe6200000,
+ 0x001c10ff, 0xe6400000, 0x001c18ff, 0xe6610000,
+ 0x001c20ff, 0xe6810000, 0x001c29ff, 0xe6a10000,
+ 0x001c31ff, 0xe6c20000, 0x001c39ff, 0xe6e20000,
+ 0x001c41ff, 0xee000000, 0x001c4aff, 0xee200000,
+ 0x001c52ff, 0xee400000, 0x001c5aff, 0xee610000,
+ 0x001c62ff, 0xee810000, 0x001c6aff, 0xeea10000,
+ 0x001c73ff, 0xeec20000, 0x001c7bff, 0xeee20000,
+ 0x001c83ff, 0xf6000000, 0x001c8bff, 0xf6200000,
+ 0x001c94ff, 0xf6400000, 0x001c9cff, 0xf6610000,
+ 0x001ca4ff, 0xf6810000, 0x001cacff, 0xf6a10000,
+ 0x001cb4ff, 0xf6c20000, 0x001cbdff, 0xf6e20000,
+ 0x001cc5ff, 0xff000000, 0x001ccdff, 0xff200000,
+ 0x001cd5ff, 0xff400000, 0x001cdeff, 0xff610000,
+ 0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000,
+ 0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000,
+};
+
+static void
+Blit_RGB565_RGBA8888(SDL_BlitInfo * info)
+{
+ Blit_RGB565_32(info, RGB565_RGBA8888_LUT);
+}
+
+/* Special optimized blit for RGB 5-6-5 --> BGRA 8-8-8-8 */
+static const Uint32 RGB565_BGRA8888_LUT[512] = {
+ 0x00000000, 0x000000ff, 0x08000000, 0x002000ff,
+ 0x10000000, 0x004000ff, 0x18000000, 0x006100ff,
+ 0x20000000, 0x008100ff, 0x29000000, 0x00a100ff,
+ 0x31000000, 0x00c200ff, 0x39000000, 0x00e200ff,
+ 0x41000000, 0x000008ff, 0x4a000000, 0x002008ff,
+ 0x52000000, 0x004008ff, 0x5a000000, 0x006108ff,
+ 0x62000000, 0x008108ff, 0x6a000000, 0x00a108ff,
+ 0x73000000, 0x00c208ff, 0x7b000000, 0x00e208ff,
+ 0x83000000, 0x000010ff, 0x8b000000, 0x002010ff,
+ 0x94000000, 0x004010ff, 0x9c000000, 0x006110ff,
+ 0xa4000000, 0x008110ff, 0xac000000, 0x00a110ff,
+ 0xb4000000, 0x00c210ff, 0xbd000000, 0x00e210ff,
+ 0xc5000000, 0x000018ff, 0xcd000000, 0x002018ff,
+ 0xd5000000, 0x004018ff, 0xde000000, 0x006118ff,
+ 0xe6000000, 0x008118ff, 0xee000000, 0x00a118ff,
+ 0xf6000000, 0x00c218ff, 0xff000000, 0x00e218ff,
+ 0x00040000, 0x000020ff, 0x08040000, 0x002020ff,
+ 0x10040000, 0x004020ff, 0x18040000, 0x006120ff,
+ 0x20040000, 0x008120ff, 0x29040000, 0x00a120ff,
+ 0x31040000, 0x00c220ff, 0x39040000, 0x00e220ff,
+ 0x41040000, 0x000029ff, 0x4a040000, 0x002029ff,
+ 0x52040000, 0x004029ff, 0x5a040000, 0x006129ff,
+ 0x62040000, 0x008129ff, 0x6a040000, 0x00a129ff,
+ 0x73040000, 0x00c229ff, 0x7b040000, 0x00e229ff,
+ 0x83040000, 0x000031ff, 0x8b040000, 0x002031ff,
+ 0x94040000, 0x004031ff, 0x9c040000, 0x006131ff,
+ 0xa4040000, 0x008131ff, 0xac040000, 0x00a131ff,
+ 0xb4040000, 0x00c231ff, 0xbd040000, 0x00e231ff,
+ 0xc5040000, 0x000039ff, 0xcd040000, 0x002039ff,
+ 0xd5040000, 0x004039ff, 0xde040000, 0x006139ff,
+ 0xe6040000, 0x008139ff, 0xee040000, 0x00a139ff,
+ 0xf6040000, 0x00c239ff, 0xff040000, 0x00e239ff,
+ 0x00080000, 0x000041ff, 0x08080000, 0x002041ff,
+ 0x10080000, 0x004041ff, 0x18080000, 0x006141ff,
+ 0x20080000, 0x008141ff, 0x29080000, 0x00a141ff,
+ 0x31080000, 0x00c241ff, 0x39080000, 0x00e241ff,
+ 0x41080000, 0x00004aff, 0x4a080000, 0x00204aff,
+ 0x52080000, 0x00404aff, 0x5a080000, 0x00614aff,
+ 0x62080000, 0x00814aff, 0x6a080000, 0x00a14aff,
+ 0x73080000, 0x00c24aff, 0x7b080000, 0x00e24aff,
+ 0x83080000, 0x000052ff, 0x8b080000, 0x002052ff,
+ 0x94080000, 0x004052ff, 0x9c080000, 0x006152ff,
+ 0xa4080000, 0x008152ff, 0xac080000, 0x00a152ff,
+ 0xb4080000, 0x00c252ff, 0xbd080000, 0x00e252ff,
+ 0xc5080000, 0x00005aff, 0xcd080000, 0x00205aff,
+ 0xd5080000, 0x00405aff, 0xde080000, 0x00615aff,
+ 0xe6080000, 0x00815aff, 0xee080000, 0x00a15aff,
+ 0xf6080000, 0x00c25aff, 0xff080000, 0x00e25aff,
+ 0x000c0000, 0x000062ff, 0x080c0000, 0x002062ff,
+ 0x100c0000, 0x004062ff, 0x180c0000, 0x006162ff,
+ 0x200c0000, 0x008162ff, 0x290c0000, 0x00a162ff,
+ 0x310c0000, 0x00c262ff, 0x390c0000, 0x00e262ff,
+ 0x410c0000, 0x00006aff, 0x4a0c0000, 0x00206aff,
+ 0x520c0000, 0x00406aff, 0x5a0c0000, 0x00616aff,
+ 0x620c0000, 0x00816aff, 0x6a0c0000, 0x00a16aff,
+ 0x730c0000, 0x00c26aff, 0x7b0c0000, 0x00e26aff,
+ 0x830c0000, 0x000073ff, 0x8b0c0000, 0x002073ff,
+ 0x940c0000, 0x004073ff, 0x9c0c0000, 0x006173ff,
+ 0xa40c0000, 0x008173ff, 0xac0c0000, 0x00a173ff,
+ 0xb40c0000, 0x00c273ff, 0xbd0c0000, 0x00e273ff,
+ 0xc50c0000, 0x00007bff, 0xcd0c0000, 0x00207bff,
+ 0xd50c0000, 0x00407bff, 0xde0c0000, 0x00617bff,
+ 0xe60c0000, 0x00817bff, 0xee0c0000, 0x00a17bff,
+ 0xf60c0000, 0x00c27bff, 0xff0c0000, 0x00e27bff,
+ 0x00100000, 0x000083ff, 0x08100000, 0x002083ff,
+ 0x10100000, 0x004083ff, 0x18100000, 0x006183ff,
+ 0x20100000, 0x008183ff, 0x29100000, 0x00a183ff,
+ 0x31100000, 0x00c283ff, 0x39100000, 0x00e283ff,
+ 0x41100000, 0x00008bff, 0x4a100000, 0x00208bff,
+ 0x52100000, 0x00408bff, 0x5a100000, 0x00618bff,
+ 0x62100000, 0x00818bff, 0x6a100000, 0x00a18bff,
+ 0x73100000, 0x00c28bff, 0x7b100000, 0x00e28bff,
+ 0x83100000, 0x000094ff, 0x8b100000, 0x002094ff,
+ 0x94100000, 0x004094ff, 0x9c100000, 0x006194ff,
+ 0xa4100000, 0x008194ff, 0xac100000, 0x00a194ff,
+ 0xb4100000, 0x00c294ff, 0xbd100000, 0x00e294ff,
+ 0xc5100000, 0x00009cff, 0xcd100000, 0x00209cff,
+ 0xd5100000, 0x00409cff, 0xde100000, 0x00619cff,
+ 0xe6100000, 0x00819cff, 0xee100000, 0x00a19cff,
+ 0xf6100000, 0x00c29cff, 0xff100000, 0x00e29cff,
+ 0x00140000, 0x0000a4ff, 0x08140000, 0x0020a4ff,
+ 0x10140000, 0x0040a4ff, 0x18140000, 0x0061a4ff,
+ 0x20140000, 0x0081a4ff, 0x29140000, 0x00a1a4ff,
+ 0x31140000, 0x00c2a4ff, 0x39140000, 0x00e2a4ff,
+ 0x41140000, 0x0000acff, 0x4a140000, 0x0020acff,
+ 0x52140000, 0x0040acff, 0x5a140000, 0x0061acff,
+ 0x62140000, 0x0081acff, 0x6a140000, 0x00a1acff,
+ 0x73140000, 0x00c2acff, 0x7b140000, 0x00e2acff,
+ 0x83140000, 0x0000b4ff, 0x8b140000, 0x0020b4ff,
+ 0x94140000, 0x0040b4ff, 0x9c140000, 0x0061b4ff,
+ 0xa4140000, 0x0081b4ff, 0xac140000, 0x00a1b4ff,
+ 0xb4140000, 0x00c2b4ff, 0xbd140000, 0x00e2b4ff,
+ 0xc5140000, 0x0000bdff, 0xcd140000, 0x0020bdff,
+ 0xd5140000, 0x0040bdff, 0xde140000, 0x0061bdff,
+ 0xe6140000, 0x0081bdff, 0xee140000, 0x00a1bdff,
+ 0xf6140000, 0x00c2bdff, 0xff140000, 0x00e2bdff,
+ 0x00180000, 0x0000c5ff, 0x08180000, 0x0020c5ff,
+ 0x10180000, 0x0040c5ff, 0x18180000, 0x0061c5ff,
+ 0x20180000, 0x0081c5ff, 0x29180000, 0x00a1c5ff,
+ 0x31180000, 0x00c2c5ff, 0x39180000, 0x00e2c5ff,
+ 0x41180000, 0x0000cdff, 0x4a180000, 0x0020cdff,
+ 0x52180000, 0x0040cdff, 0x5a180000, 0x0061cdff,
+ 0x62180000, 0x0081cdff, 0x6a180000, 0x00a1cdff,
+ 0x73180000, 0x00c2cdff, 0x7b180000, 0x00e2cdff,
+ 0x83180000, 0x0000d5ff, 0x8b180000, 0x0020d5ff,
+ 0x94180000, 0x0040d5ff, 0x9c180000, 0x0061d5ff,
+ 0xa4180000, 0x0081d5ff, 0xac180000, 0x00a1d5ff,
+ 0xb4180000, 0x00c2d5ff, 0xbd180000, 0x00e2d5ff,
+ 0xc5180000, 0x0000deff, 0xcd180000, 0x0020deff,
+ 0xd5180000, 0x0040deff, 0xde180000, 0x0061deff,
+ 0xe6180000, 0x0081deff, 0xee180000, 0x00a1deff,
+ 0xf6180000, 0x00c2deff, 0xff180000, 0x00e2deff,
+ 0x001c0000, 0x0000e6ff, 0x081c0000, 0x0020e6ff,
+ 0x101c0000, 0x0040e6ff, 0x181c0000, 0x0061e6ff,
+ 0x201c0000, 0x0081e6ff, 0x291c0000, 0x00a1e6ff,
+ 0x311c0000, 0x00c2e6ff, 0x391c0000, 0x00e2e6ff,
+ 0x411c0000, 0x0000eeff, 0x4a1c0000, 0x0020eeff,
+ 0x521c0000, 0x0040eeff, 0x5a1c0000, 0x0061eeff,
+ 0x621c0000, 0x0081eeff, 0x6a1c0000, 0x00a1eeff,
+ 0x731c0000, 0x00c2eeff, 0x7b1c0000, 0x00e2eeff,
+ 0x831c0000, 0x0000f6ff, 0x8b1c0000, 0x0020f6ff,
+ 0x941c0000, 0x0040f6ff, 0x9c1c0000, 0x0061f6ff,
+ 0xa41c0000, 0x0081f6ff, 0xac1c0000, 0x00a1f6ff,
+ 0xb41c0000, 0x00c2f6ff, 0xbd1c0000, 0x00e2f6ff,
+ 0xc51c0000, 0x0000ffff, 0xcd1c0000, 0x0020ffff,
+ 0xd51c0000, 0x0040ffff, 0xde1c0000, 0x0061ffff,
+ 0xe61c0000, 0x0081ffff, 0xee1c0000, 0x00a1ffff,
+ 0xf61c0000, 0x00c2ffff, 0xff1c0000, 0x00e2ffff
+};
+
+static void
+Blit_RGB565_BGRA8888(SDL_BlitInfo * info)
+{
+ Blit_RGB565_32(info, RGB565_BGRA8888_LUT);
+}
+
+static void
+BlitNto1(SDL_BlitInfo * info)
+{
+#ifndef USE_DUFFS_LOOP
+ int c;
+#endif
+ int width, height;
+ Uint8 *src;
+ const Uint8 *map;
+ Uint8 *dst;
+ int srcskip, dstskip;
+ int srcbpp;
+ Uint32 Pixel;
+ int sR, sG, sB;
+ SDL_PixelFormat *srcfmt;
+
+ /* Set up some basic variables */
+ width = info->dst_w;
+ height = info->dst_h;
+ src = info->src;
+ srcskip = info->src_skip;
+ dst = info->dst;
+ dstskip = info->dst_skip;
+ map = info->table;
+ srcfmt = info->src_fmt;
+ srcbpp = srcfmt->BytesPerPixel;
+
+ if (map == NULL) {
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
+ sR, sG, sB);
+ if ( 1 ) {
+ /* Pack RGB into 8bit pixel */
+ *dst = ((sR>>5)<<(3+2))|
+ ((sG>>5)<<(2)) |
+ ((sB>>6)<<(0)) ;
+ }
+ dst++;
+ src += srcbpp;
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width; c; --c) {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+ if (1) {
+ /* Pack RGB into 8bit pixel */
+ *dst = ((sR >> 5) << (3 + 2)) |
+ ((sG >> 5) << (2)) | ((sB >> 6) << (0));
+ }
+ dst++;
+ src += srcbpp;
+ }
+#endif
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+#ifdef USE_DUFFS_LOOP
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
+ sR, sG, sB);
+ if ( 1 ) {
+ /* Pack RGB into 8bit pixel */
+ *dst = map[((sR>>5)<<(3+2))|
+ ((sG>>5)<<(2)) |
+ ((sB>>6)<<(0)) ];
+ }
+ dst++;
+ src += srcbpp;
+ , width);
+ /* *INDENT-ON* */
+#else
+ for (c = width; c; --c) {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+ if (1) {
+ /* Pack RGB into 8bit pixel */
+ *dst = map[((sR >> 5) << (3 + 2)) |
+ ((sG >> 5) << (2)) | ((sB >> 6) << (0))];
+ }
+ dst++;
+ src += srcbpp;
+ }
+#endif /* USE_DUFFS_LOOP */
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+/* blits 32 bit RGB<->RGBA with both surfaces having the same R,G,B fields */
+static void
+Blit4to4MaskAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *src = (Uint32 *) info->src;
+ int srcskip = info->src_skip;
+ Uint32 *dst = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+
+ if (dstfmt->Amask) {
+ /* RGB->RGBA, SET_ALPHA */
+ Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ *dst = *src | mask;
+ ++dst;
+ ++src;
+ },
+ width);
+ /* *INDENT-ON* */
+ src = (Uint32 *) ((Uint8 *) src + srcskip);
+ dst = (Uint32 *) ((Uint8 *) dst + dstskip);
+ }
+ } else {
+ /* RGBA->RGB, NO_ALPHA */
+ Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ *dst = *src & mask;
+ ++dst;
+ ++src;
+ },
+ width);
+ /* *INDENT-ON* */
+ src = (Uint32 *) ((Uint8 *) src + srcskip);
+ dst = (Uint32 *) ((Uint8 *) dst + dstskip);
+ }
+ }
+}
+
+/* blits 32 bit RGBA<->RGBA with both surfaces having the same R,G,B,A fields */
+static void
+Blit4to4CopyAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint32 *src = (Uint32 *) info->src;
+ int srcskip = info->src_skip;
+ Uint32 *dst = (Uint32 *) info->dst;
+ int dstskip = info->dst_skip;
+
+ /* RGBA->RGBA, COPY_ALPHA */
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ *dst = *src;
+ ++dst;
+ ++src;
+ },
+ width);
+ /* *INDENT-ON* */
+ src = (Uint32 *) ((Uint8 *) src + srcskip);
+ dst = (Uint32 *) ((Uint8 *) dst + dstskip);
+ }
+}
+
+static void
+BlitNtoN(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int dstbpp = dstfmt->BytesPerPixel;
+ unsigned alpha = dstfmt->Amask ? info->a : 0;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ Uint32 Pixel;
+ unsigned sR;
+ unsigned sG;
+ unsigned sB;
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
+ dst += dstbpp;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitNtoNCopyAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int dstbpp = dstfmt->BytesPerPixel;
+ int c;
+
+ while (height--) {
+ for (c = width; c; --c) {
+ Uint32 Pixel;
+ unsigned sR, sG, sB, sA;
+ DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
+ dst += dstbpp;
+ src += srcbpp;
+ }
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitNto1Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ const Uint8 *palmap = info->table;
+ Uint32 ckey = info->colorkey;
+ Uint32 rgbmask = ~srcfmt->Amask;
+ int srcbpp;
+ Uint32 Pixel;
+ unsigned sR, sG, sB;
+
+ /* Set up some basic variables */
+ srcbpp = srcfmt->BytesPerPixel;
+ ckey &= rgbmask;
+
+ if (palmap == NULL) {
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
+ sR, sG, sB);
+ if ( (Pixel & rgbmask) != ckey ) {
+ /* Pack RGB into 8bit pixel */
+ *dst = (Uint8)(((sR>>5)<<(3+2))|
+ ((sG>>5)<<(2)) |
+ ((sB>>6)<<(0)));
+ }
+ dst++;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
+ sR, sG, sB);
+ if ( (Pixel & rgbmask) != ckey ) {
+ /* Pack RGB into 8bit pixel */
+ *dst = (Uint8)palmap[((sR>>5)<<(3+2))|
+ ((sG>>5)<<(2)) |
+ ((sB>>6)<<(0)) ];
+ }
+ dst++;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+ }
+}
+
+static void
+Blit2to2Key(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint16 *srcp = (Uint16 *) info->src;
+ int srcskip = info->src_skip;
+ Uint16 *dstp = (Uint16 *) info->dst;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ Uint32 rgbmask = ~info->src_fmt->Amask;
+
+ /* Set up some basic variables */
+ srcskip /= 2;
+ dstskip /= 2;
+ ckey &= rgbmask;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ if ( (*srcp & rgbmask) != ckey ) {
+ *dstp = *srcp;
+ }
+ dstp++;
+ srcp++;
+ },
+ width);
+ /* *INDENT-ON* */
+ srcp += srcskip;
+ dstp += dstskip;
+ }
+}
+
+static void
+BlitNtoNKey(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ int dstbpp = dstfmt->BytesPerPixel;
+ unsigned alpha = dstfmt->Amask ? info->a : 0;
+ Uint32 rgbmask = ~srcfmt->Amask;
+
+ /* Set up some basic variables */
+ ckey &= rgbmask;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ Uint32 Pixel;
+ unsigned sR;
+ unsigned sG;
+ unsigned sB;
+ RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
+ if ( (Pixel & rgbmask) != ckey ) {
+ RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
+ }
+ dst += dstbpp;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+static void
+BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ Uint32 ckey = info->colorkey;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ Uint32 rgbmask = ~srcfmt->Amask;
+
+ Uint8 srcbpp;
+ Uint8 dstbpp;
+ Uint32 Pixel;
+ unsigned sR, sG, sB, sA;
+
+ /* Set up some basic variables */
+ srcbpp = srcfmt->BytesPerPixel;
+ dstbpp = dstfmt->BytesPerPixel;
+ ckey &= rgbmask;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
+ if ( (Pixel & rgbmask) != ckey ) {
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
+ }
+ dst += dstbpp;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* Special optimized blit for ARGB 2-10-10-10 --> RGBA */
+static void
+Blit2101010toN(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *dstfmt = info->dst_fmt;
+ int dstbpp = dstfmt->BytesPerPixel;
+ Uint32 Pixel;
+ unsigned sR, sG, sB, sA;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ Pixel = *(Uint32 *)src;
+ RGBA_FROM_ARGB2101010(Pixel, sR, sG, sB, sA);
+ ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
+ dst += dstbpp;
+ src += 4;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* Special optimized blit for RGBA --> ARGB 2-10-10-10 */
+static void
+BlitNto2101010(SDL_BlitInfo * info)
+{
+ int width = info->dst_w;
+ int height = info->dst_h;
+ Uint8 *src = info->src;
+ int srcskip = info->src_skip;
+ Uint8 *dst = info->dst;
+ int dstskip = info->dst_skip;
+ SDL_PixelFormat *srcfmt = info->src_fmt;
+ int srcbpp = srcfmt->BytesPerPixel;
+ Uint32 Pixel;
+ unsigned sR, sG, sB, sA;
+
+ while (height--) {
+ /* *INDENT-OFF* */
+ DUFFS_LOOP(
+ {
+ DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
+ ARGB2101010_FROM_RGBA(Pixel, sR, sG, sB, sA);
+ *(Uint32 *)dst = Pixel;
+ dst += 4;
+ src += srcbpp;
+ },
+ width);
+ /* *INDENT-ON* */
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* Normal N to N optimized blitters */
+#define NO_ALPHA 1
+#define SET_ALPHA 2
+#define COPY_ALPHA 4
+struct blit_table
+{
+ Uint32 srcR, srcG, srcB;
+ int dstbpp;
+ Uint32 dstR, dstG, dstB;
+ Uint32 blit_features;
+ SDL_BlitFunc blitfunc;
+ Uint32 alpha; /* bitwise NO_ALPHA, SET_ALPHA, COPY_ALPHA */
+};
+static const struct blit_table normal_blit_1[] = {
+ /* Default for 8-bit RGB source, never optimized */
+ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
+};
+
+static const struct blit_table normal_blit_2[] = {
+#if SDL_ALTIVEC_BLITTERS
+ /* has-altivec */
+ {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000, 0x00000000,
+ 2, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+ {0x00007C00, 0x000003E0, 0x0000001F, 4, 0x00000000, 0x00000000, 0x00000000,
+ 2, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+#endif
+ {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00FF0000, 0x0000FF00, 0x000000FF,
+ 0, Blit_RGB565_ARGB8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+ {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x000000FF, 0x0000FF00, 0x00FF0000,
+ 0, Blit_RGB565_ABGR8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+ {0x0000F800, 0x000007E0, 0x0000001F, 4, 0xFF000000, 0x00FF0000, 0x0000FF00,
+ 0, Blit_RGB565_RGBA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+ {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x0000FF00, 0x00FF0000, 0xFF000000,
+ 0, Blit_RGB565_BGRA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+
+ /* Default for 16-bit RGB source, used if no other blitter matches */
+ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
+};
+
+static const struct blit_table normal_blit_3[] = {
+ /* Default for 24-bit RGB source, never optimized */
+ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
+};
+
+static const struct blit_table normal_blit_4[] = {
+#if SDL_ALTIVEC_BLITTERS
+ /* has-altivec | dont-use-prefetch */
+ {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000, 0x00000000,
+ 6, ConvertAltivec32to32_noprefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+ /* has-altivec */
+ {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000, 0x00000000,
+ 2, ConvertAltivec32to32_prefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
+ /* has-altivec */
+ {0x00000000, 0x00000000, 0x00000000, 2, 0x0000F800, 0x000007E0, 0x0000001F,
+ 2, Blit_RGB888_RGB565Altivec, NO_ALPHA},
+#endif
+ {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x0000F800, 0x000007E0, 0x0000001F,
+ 0, Blit_RGB888_RGB565, NO_ALPHA},
+ {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x00007C00, 0x000003E0, 0x0000001F,
+ 0, Blit_RGB888_RGB555, NO_ALPHA},
+ /* Default for 32-bit RGB source, used if no other blitter matches */
+ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
+};
+
+static const struct blit_table *const normal_blit[] = {
+ normal_blit_1, normal_blit_2, normal_blit_3, normal_blit_4
+};
+
+/* Mask matches table, or table entry is zero */
+#define MASKOK(x, y) (((x) == (y)) || ((y) == 0x00000000))
+
+SDL_BlitFunc
+SDL_CalculateBlitN(SDL_Surface * surface)
+{
+ SDL_PixelFormat *srcfmt;
+ SDL_PixelFormat *dstfmt;
+ const struct blit_table *table;
+ int which;
+ SDL_BlitFunc blitfun;
+
+ /* Set up data for choosing the blit */
+ srcfmt = surface->format;
+ dstfmt = surface->map->dst->format;
+
+ /* We don't support destinations less than 8-bits */
+ if (dstfmt->BitsPerPixel < 8) {
+ return (NULL);
+ }
+
+ switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
+ case 0:
+ blitfun = NULL;
+ if (dstfmt->BitsPerPixel == 8) {
+ if ((srcfmt->BytesPerPixel == 4) &&
+ (srcfmt->Rmask == 0x00FF0000) &&
+ (srcfmt->Gmask == 0x0000FF00) &&
+ (srcfmt->Bmask == 0x000000FF)) {
+ blitfun = Blit_RGB888_index8;
+ } else if ((srcfmt->BytesPerPixel == 4) &&
+ (srcfmt->Rmask == 0x3FF00000) &&
+ (srcfmt->Gmask == 0x000FFC00) &&
+ (srcfmt->Bmask == 0x000003FF)) {
+ blitfun = Blit_RGB101010_index8;
+ } else {
+ blitfun = BlitNto1;
+ }
+ } else {
+ /* Now the meat, choose the blitter we want */
+ int a_need = NO_ALPHA;
+ if (dstfmt->Amask)
+ a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
+ table = normal_blit[srcfmt->BytesPerPixel - 1];
+ for (which = 0; table[which].dstbpp; ++which) {
+ if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
+ MASKOK(srcfmt->Gmask, table[which].srcG) &&
+ MASKOK(srcfmt->Bmask, table[which].srcB) &&
+ MASKOK(dstfmt->Rmask, table[which].dstR) &&
+ MASKOK(dstfmt->Gmask, table[which].dstG) &&
+ MASKOK(dstfmt->Bmask, table[which].dstB) &&
+ dstfmt->BytesPerPixel == table[which].dstbpp &&
+ (a_need & table[which].alpha) == a_need &&
+ ((table[which].blit_features & GetBlitFeatures()) ==
+ table[which].blit_features))
+ break;
+ }
+ blitfun = table[which].blitfunc;
+
+ if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
+ if (srcfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
+ blitfun = Blit2101010toN;
+ } else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
+ blitfun = BlitNto2101010;
+ } else if (srcfmt->BytesPerPixel == 4 &&
+ dstfmt->BytesPerPixel == 4 &&
+ srcfmt->Rmask == dstfmt->Rmask &&
+ srcfmt->Gmask == dstfmt->Gmask &&
+ srcfmt->Bmask == dstfmt->Bmask) {
+ if (a_need == COPY_ALPHA) {
+ if (srcfmt->Amask == dstfmt->Amask) {
+ /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
+ blitfun = Blit4to4CopyAlpha;
+ } else {
+ blitfun = BlitNtoNCopyAlpha;
+ }
+ } else {
+ /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
+ blitfun = Blit4to4MaskAlpha;
+ }
+ } else if (a_need == COPY_ALPHA) {
+ blitfun = BlitNtoNCopyAlpha;
+ }
+ }
+ }
+ return (blitfun);
+
+ case SDL_COPY_COLORKEY:
+ /* colorkey blit: Here we don't have too many options, mostly
+ because RLE is the preferred fast way to deal with this.
+ If a particular case turns out to be useful we'll add it. */
+
+ if (srcfmt->BytesPerPixel == 2 && surface->map->identity)
+ return Blit2to2Key;
+ else if (dstfmt->BytesPerPixel == 1)
+ return BlitNto1Key;
+ else {
+#if SDL_ALTIVEC_BLITTERS
+ if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
+ && SDL_HasAltiVec()) {
+ return Blit32to32KeyAltivec;
+ } else
+#endif
+ if (srcfmt->Amask && dstfmt->Amask) {
+ return BlitNtoNKeyCopyAlpha;
+ } else {
+ return BlitNtoNKey;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_auto.c b/src/3rdparty/SDL2/src/video/SDL_blit_auto.c
new file mode 100644
index 0000000..d9d266f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_auto.c
@@ -0,0 +1,7419 @@
+/* DO NOT EDIT! This file is generated by sdlgenblit.pl */
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* *INDENT-OFF* */
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+#include "SDL_blit_auto.h"
+
+static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info)
+{
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ *dst = *src;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info)
+{
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ *dst = *src;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info)
+{
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ *dst = *src;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = (Uint8)(pixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = (Uint8)(pixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = (Uint8)(srcpixel >> 24);
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ Uint32 pixel;
+ Uint32 R, G, B;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info)
+{
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Modulate(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 pixel;
+ Uint32 R, G, B, A;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ pixel = *src;
+ B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ R = (R * modulateR) / 255;
+ G = (G * modulateG) / 255;
+ B = (B * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ A = (A * modulateA) / 255;
+ }
+ pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
+ *dst = pixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+
+ while (info->dst_h--) {
+ Uint32 *src = (Uint32 *)info->src;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+}
+
+static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint32 *src = 0;
+ Uint32 *dst = (Uint32 *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
+ }
+ srcpixel = *src;
+ srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
+ dstpixel = *dst;
+ dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR; if (dstR > 255) dstR = 255;
+ dstG = srcG + dstG; if (dstG > 255) dstG = 255;
+ dstB = srcB + dstB; if (dstB > 255) dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ dstpixel = ((Uint32)dstA << 24) | ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
+ *dst = dstpixel;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Blend_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Scale },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend },
+ { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Blend_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Scale },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend },
+ { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend },
+ { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend },
+ { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend },
+ { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend },
+ { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale },
+ { 0, 0, 0, 0, NULL }
+};
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_auto.h b/src/3rdparty/SDL2/src/video/SDL_blit_auto.h
new file mode 100644
index 0000000..41a6a32
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_auto.h
@@ -0,0 +1,30 @@
+/* DO NOT EDIT! This file is generated by sdlgenblit.pl */
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* *INDENT-OFF* */
+
+extern SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[];
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_copy.c b/src/3rdparty/SDL2/src/video/SDL_blit_copy.c
new file mode 100644
index 0000000..e862898
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_copy.c
@@ -0,0 +1,162 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+#include "SDL_blit_copy.h"
+
+
+#ifdef __SSE__
+/* This assumes 16-byte aligned src and dst */
+static SDL_INLINE void
+SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
+{
+ int i;
+
+ __m128 values[4];
+ for (i = len / 64; i--;) {
+ _mm_prefetch(src, _MM_HINT_NTA);
+ values[0] = *(__m128 *) (src + 0);
+ values[1] = *(__m128 *) (src + 16);
+ values[2] = *(__m128 *) (src + 32);
+ values[3] = *(__m128 *) (src + 48);
+ _mm_stream_ps((float *) (dst + 0), values[0]);
+ _mm_stream_ps((float *) (dst + 16), values[1]);
+ _mm_stream_ps((float *) (dst + 32), values[2]);
+ _mm_stream_ps((float *) (dst + 48), values[3]);
+ src += 64;
+ dst += 64;
+ }
+
+ if (len & 63)
+ SDL_memcpy(dst, src, len & 63);
+}
+#endif /* __SSE__ */
+
+#ifdef __MMX__
+#ifdef _MSC_VER
+#pragma warning(disable:4799)
+#endif
+static SDL_INLINE void
+SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
+{
+ const int remain = (len & 63);
+ int i;
+
+ __m64* d64 = (__m64*)dst;
+ __m64* s64 = (__m64*)src;
+
+ for(i= len / 64; i--;) {
+ d64[0] = s64[0];
+ d64[1] = s64[1];
+ d64[2] = s64[2];
+ d64[3] = s64[3];
+ d64[4] = s64[4];
+ d64[5] = s64[5];
+ d64[6] = s64[6];
+ d64[7] = s64[7];
+
+ d64 += 8;
+ s64 += 8;
+ }
+
+ if (remain)
+ {
+ const int skip = len - remain;
+ SDL_memcpy(dst + skip, src + skip, remain);
+ }
+}
+#endif /* __MMX__ */
+
+void
+SDL_BlitCopy(SDL_BlitInfo * info)
+{
+ SDL_bool overlap;
+ Uint8 *src, *dst;
+ int w, h;
+ int srcskip, dstskip;
+
+ w = info->dst_w * info->dst_fmt->BytesPerPixel;
+ h = info->dst_h;
+ src = info->src;
+ dst = info->dst;
+ srcskip = info->src_pitch;
+ dstskip = info->dst_pitch;
+
+ /* Properly handle overlapping blits */
+ if (src < dst) {
+ overlap = (dst < (src + h*srcskip));
+ } else {
+ overlap = (src < (dst + h*dstskip));
+ }
+ if (overlap) {
+ if ( dst < src ) {
+ while ( h-- ) {
+ SDL_memmove(dst, src, w);
+ src += srcskip;
+ dst += dstskip;
+ }
+ } else {
+ src += ((h-1) * srcskip);
+ dst += ((h-1) * dstskip);
+ while ( h-- ) {
+ SDL_memmove(dst, src, w);
+ src -= srcskip;
+ dst -= dstskip;
+ }
+ }
+ return;
+ }
+
+#ifdef __SSE__
+ if (SDL_HasSSE() &&
+ !((uintptr_t) src & 15) && !(srcskip & 15) &&
+ !((uintptr_t) dst & 15) && !(dstskip & 15)) {
+ while (h--) {
+ SDL_memcpySSE(dst, src, w);
+ src += srcskip;
+ dst += dstskip;
+ }
+ return;
+ }
+#endif
+
+#ifdef __MMX__
+ if (SDL_HasMMX() && !(srcskip & 7) && !(dstskip & 7)) {
+ while (h--) {
+ SDL_memcpyMMX(dst, src, w);
+ src += srcskip;
+ dst += dstskip;
+ }
+ _mm_empty();
+ return;
+ }
+#endif
+
+ while (h--) {
+ SDL_memcpy(dst, src, w);
+ src += srcskip;
+ dst += dstskip;
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_copy.h b/src/3rdparty/SDL2/src/video/SDL_blit_copy.h
new file mode 100644
index 0000000..4665179
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_copy.h
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+void SDL_BlitCopy(SDL_BlitInfo * info);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_slow.c b/src/3rdparty/SDL2/src/video/SDL_blit_slow.c
new file mode 100644
index 0000000..20ca8ab
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_slow.c
@@ -0,0 +1,164 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+#include "SDL_blit_slow.h"
+
+/* The ONE TRUE BLITTER
+ * This puppy has to handle all the unoptimized cases - yes, it's slow.
+ */
+void
+SDL_Blit_Slow(SDL_BlitInfo * info)
+{
+ const int flags = info->flags;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+ const Uint32 modulateA = info->a;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+ Uint32 dstR, dstG, dstB, dstA;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+ SDL_PixelFormat *src_fmt = info->src_fmt;
+ SDL_PixelFormat *dst_fmt = info->dst_fmt;
+ int srcbpp = src_fmt->BytesPerPixel;
+ int dstbpp = dst_fmt->BytesPerPixel;
+ Uint32 rgbmask = ~src_fmt->Amask;
+ Uint32 ckey = info->colorkey & rgbmask;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ Uint8 *src = 0;
+ Uint8 *dst = (Uint8 *) info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src =
+ (info->src + (srcy * info->src_pitch) + (srcx * srcbpp));
+ }
+ if (src_fmt->Amask) {
+ DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG,
+ srcB, srcA);
+ } else {
+ DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG,
+ srcB);
+ srcA = 0xFF;
+ }
+ if (flags & SDL_COPY_COLORKEY) {
+ /* srcpixel isn't set for 24 bpp */
+ if (srcbpp == 3) {
+ srcpixel = (srcR << src_fmt->Rshift) |
+ (srcG << src_fmt->Gshift) | (srcB << src_fmt->Bshift);
+ }
+ if ((srcpixel & rgbmask) == ckey) {
+ posx += incx;
+ dst += dstbpp;
+ continue;
+ }
+ }
+ if (dst_fmt->Amask) {
+ DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG,
+ dstB, dstA);
+ } else {
+ DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG,
+ dstB);
+ dstA = 0xFF;
+ }
+
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ srcR = (srcR * modulateR) / 255;
+ srcG = (srcG * modulateG) / 255;
+ srcB = (srcB * modulateB) / 255;
+ }
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ srcA = (srcA * modulateA) / 255;
+ }
+ if (flags & (SDL_COPY_BLEND | SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (srcA < 255) {
+ srcR = (srcR * srcA) / 255;
+ srcG = (srcG * srcA) / 255;
+ srcB = (srcB * srcA) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD)) {
+ case 0:
+ dstR = srcR;
+ dstG = srcG;
+ dstB = srcB;
+ dstA = srcA;
+ break;
+ case SDL_COPY_BLEND:
+ dstR = srcR + ((255 - srcA) * dstR) / 255;
+ dstG = srcG + ((255 - srcA) * dstG) / 255;
+ dstB = srcB + ((255 - srcA) * dstB) / 255;
+ dstA = srcA + ((255 - srcA) * dstA) / 255;
+ break;
+ case SDL_COPY_ADD:
+ dstR = srcR + dstR;
+ if (dstR > 255)
+ dstR = 255;
+ dstG = srcG + dstG;
+ if (dstG > 255)
+ dstG = 255;
+ dstB = srcB + dstB;
+ if (dstB > 255)
+ dstB = 255;
+ break;
+ case SDL_COPY_MOD:
+ dstR = (srcR * dstR) / 255;
+ dstG = (srcG * dstG) / 255;
+ dstB = (srcB * dstB) / 255;
+ break;
+ }
+ if (dst_fmt->Amask) {
+ ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA);
+ } else {
+ ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB);
+ }
+ posx += incx;
+ dst += dstbpp;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_blit_slow.h b/src/3rdparty/SDL2/src/video/SDL_blit_slow.h
new file mode 100644
index 0000000..02d360a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_blit_slow.h
@@ -0,0 +1,25 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+extern void SDL_Blit_Slow(SDL_BlitInfo * info);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_bmp.c b/src/3rdparty/SDL2/src/video/SDL_bmp.c
new file mode 100644
index 0000000..ba908a6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_bmp.c
@@ -0,0 +1,702 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/*
+ Code to load and save surfaces in Windows BMP format.
+
+ Why support BMP format? Well, it's a native format for Windows, and
+ most image processing programs can read and write it. It would be nice
+ to be able to have at least one image format that we can natively load
+ and save, and since PNG is so complex that it would bloat the library,
+ BMP is a good alternative.
+
+ This code currently supports Win32 DIBs in uncompressed 8 and 24 bpp.
+*/
+
+#include "SDL_hints.h"
+#include "SDL_video.h"
+#include "SDL_assert.h"
+#include "SDL_endian.h"
+#include "SDL_pixels_c.h"
+
+#define SAVE_32BIT_BMP
+
+/* Compression encodings for BMP files */
+#ifndef BI_RGB
+#define BI_RGB 0
+#define BI_RLE8 1
+#define BI_RLE4 2
+#define BI_BITFIELDS 3
+#endif
+
+/* Logical color space values for BMP files */
+#ifndef LCS_WINDOWS_COLOR_SPACE
+/* 0x57696E20 == "Win " */
+#define LCS_WINDOWS_COLOR_SPACE 0x57696E20
+#endif
+
+static void CorrectAlphaChannel(SDL_Surface *surface)
+{
+ /* Check to see if there is any alpha channel data */
+ SDL_bool hasAlpha = SDL_FALSE;
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ int alphaChannelOffset = 0;
+#else
+ int alphaChannelOffset = 3;
+#endif
+ Uint8 *alpha = ((Uint8*)surface->pixels) + alphaChannelOffset;
+ Uint8 *end = alpha + surface->h * surface->pitch;
+
+ while (alpha < end) {
+ if (*alpha != 0) {
+ hasAlpha = SDL_TRUE;
+ break;
+ }
+ alpha += 4;
+ }
+
+ if (!hasAlpha) {
+ alpha = ((Uint8*)surface->pixels) + alphaChannelOffset;
+ while (alpha < end) {
+ *alpha = SDL_ALPHA_OPAQUE;
+ alpha += 4;
+ }
+ }
+}
+
+SDL_Surface *
+SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
+{
+ SDL_bool was_error;
+ Sint64 fp_offset = 0;
+ int bmpPitch;
+ int i, pad;
+ SDL_Surface *surface;
+ Uint32 Rmask = 0;
+ Uint32 Gmask = 0;
+ Uint32 Bmask = 0;
+ Uint32 Amask = 0;
+ SDL_Palette *palette;
+ Uint8 *bits;
+ Uint8 *top, *end;
+ SDL_bool topDown;
+ int ExpandBMP;
+ SDL_bool haveRGBMasks = SDL_FALSE;
+ SDL_bool haveAlphaMask = SDL_FALSE;
+ SDL_bool correctAlpha = SDL_FALSE;
+
+ /* The Win32 BMP file header (14 bytes) */
+ char magic[2];
+ /* Uint32 bfSize = 0; */
+ /* Uint16 bfReserved1 = 0; */
+ /* Uint16 bfReserved2 = 0; */
+ Uint32 bfOffBits = 0;
+
+ /* The Win32 BITMAPINFOHEADER struct (40 bytes) */
+ Uint32 biSize = 0;
+ Sint32 biWidth = 0;
+ Sint32 biHeight = 0;
+ /* Uint16 biPlanes = 0; */
+ Uint16 biBitCount = 0;
+ Uint32 biCompression = 0;
+ /* Uint32 biSizeImage = 0; */
+ /* Sint32 biXPelsPerMeter = 0; */
+ /* Sint32 biYPelsPerMeter = 0; */
+ Uint32 biClrUsed = 0;
+ /* Uint32 biClrImportant = 0; */
+
+ (void) haveRGBMasks;
+ (void) haveAlphaMask;
+
+ /* Make sure we are passed a valid data source */
+ surface = NULL;
+ was_error = SDL_FALSE;
+ if (src == NULL) {
+ was_error = SDL_TRUE;
+ goto done;
+ }
+
+ /* Read in the BMP file header */
+ fp_offset = SDL_RWtell(src);
+ SDL_ClearError();
+ if (SDL_RWread(src, magic, 1, 2) != 2) {
+ SDL_Error(SDL_EFREAD);
+ was_error = SDL_TRUE;
+ goto done;
+ }
+ if (SDL_strncmp(magic, "BM", 2) != 0) {
+ SDL_SetError("File is not a Windows BMP file");
+ was_error = SDL_TRUE;
+ goto done;
+ }
+ /* bfSize = */ SDL_ReadLE32(src);
+ /* bfReserved1 = */ SDL_ReadLE16(src);
+ /* bfReserved2 = */ SDL_ReadLE16(src);
+ bfOffBits = SDL_ReadLE32(src);
+
+ /* Read the Win32 BITMAPINFOHEADER */
+ biSize = SDL_ReadLE32(src);
+ if (biSize == 12) { /* really old BITMAPCOREHEADER */
+ biWidth = (Uint32) SDL_ReadLE16(src);
+ biHeight = (Uint32) SDL_ReadLE16(src);
+ /* biPlanes = */ SDL_ReadLE16(src);
+ biBitCount = SDL_ReadLE16(src);
+ biCompression = BI_RGB;
+ } else if (biSize >= 40) { /* some version of BITMAPINFOHEADER */
+ Uint32 headerSize;
+ biWidth = SDL_ReadLE32(src);
+ biHeight = SDL_ReadLE32(src);
+ /* biPlanes = */ SDL_ReadLE16(src);
+ biBitCount = SDL_ReadLE16(src);
+ biCompression = SDL_ReadLE32(src);
+ /* biSizeImage = */ SDL_ReadLE32(src);
+ /* biXPelsPerMeter = */ SDL_ReadLE32(src);
+ /* biYPelsPerMeter = */ SDL_ReadLE32(src);
+ biClrUsed = SDL_ReadLE32(src);
+ /* biClrImportant = */ SDL_ReadLE32(src);
+
+ /* 64 == BITMAPCOREHEADER2, an incompatible OS/2 2.x extension. Skip this stuff for now. */
+ if (biSize == 64) {
+ /* ignore these extra fields. */
+ if (biCompression == BI_BITFIELDS) {
+ /* this value is actually huffman compression in this variant. */
+ SDL_SetError("Compressed BMP files not supported");
+ was_error = SDL_TRUE;
+ goto done;
+ }
+ } else {
+ /* This is complicated. If compression is BI_BITFIELDS, then
+ we have 3 DWORDS that specify the RGB masks. This is either
+ stored here in an BITMAPV2INFOHEADER (which only differs in
+ that it adds these RGB masks) and biSize >= 52, or we've got
+ these masks stored in the exact same place, but strictly
+ speaking, this is the bmiColors field in BITMAPINFO immediately
+ following the legacy v1 info header, just past biSize. */
+ if (biCompression == BI_BITFIELDS) {
+ haveRGBMasks = SDL_TRUE;
+ Rmask = SDL_ReadLE32(src);
+ Gmask = SDL_ReadLE32(src);
+ Bmask = SDL_ReadLE32(src);
+
+ /* ...v3 adds an alpha mask. */
+ if (biSize >= 56) { /* BITMAPV3INFOHEADER; adds alpha mask */
+ haveAlphaMask = SDL_TRUE;
+ Amask = SDL_ReadLE32(src);
+ }
+ } else {
+ /* the mask fields are ignored for v2+ headers if not BI_BITFIELD. */
+ if (biSize >= 52) { /* BITMAPV2INFOHEADER; adds RGB masks */
+ /*Rmask = */ SDL_ReadLE32(src);
+ /*Gmask = */ SDL_ReadLE32(src);
+ /*Bmask = */ SDL_ReadLE32(src);
+ }
+ if (biSize >= 56) { /* BITMAPV3INFOHEADER; adds alpha mask */
+ /*Amask = */ SDL_ReadLE32(src);
+ }
+ }
+
+ /* Insert other fields here; Wikipedia and MSDN say we're up to
+ v5 of this header, but we ignore those for now (they add gamma,
+ color spaces, etc). Ignoring the weird OS/2 2.x format, we
+ currently parse up to v3 correctly (hopefully!). */
+ }
+
+ /* skip any header bytes we didn't handle... */
+ headerSize = (Uint32) (SDL_RWtell(src) - (fp_offset + 14));
+ if (biSize > headerSize) {
+ SDL_RWseek(src, (biSize - headerSize), RW_SEEK_CUR);
+ }
+ }
+ if (biHeight < 0) {
+ topDown = SDL_TRUE;
+ biHeight = -biHeight;
+ } else {
+ topDown = SDL_FALSE;
+ }
+
+ /* Check for read error */
+ if (SDL_strcmp(SDL_GetError(), "") != 0) {
+ was_error = SDL_TRUE;
+ goto done;
+ }
+
+ /* Expand 1 and 4 bit bitmaps to 8 bits per pixel */
+ switch (biBitCount) {
+ case 1:
+ case 4:
+ ExpandBMP = biBitCount;
+ biBitCount = 8;
+ break;
+ default:
+ ExpandBMP = 0;
+ break;
+ }
+
+ /* We don't support any BMP compression right now */
+ switch (biCompression) {
+ case BI_RGB:
+ /* If there are no masks, use the defaults */
+ SDL_assert(!haveRGBMasks);
+ SDL_assert(!haveAlphaMask);
+ /* Default values for the BMP format */
+ switch (biBitCount) {
+ case 15:
+ case 16:
+ Rmask = 0x7C00;
+ Gmask = 0x03E0;
+ Bmask = 0x001F;
+ break;
+ case 24:
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ Rmask = 0x000000FF;
+ Gmask = 0x0000FF00;
+ Bmask = 0x00FF0000;
+#else
+ Rmask = 0x00FF0000;
+ Gmask = 0x0000FF00;
+ Bmask = 0x000000FF;
+#endif
+ break;
+ case 32:
+ /* We don't know if this has alpha channel or not */
+ correctAlpha = SDL_TRUE;
+ Amask = 0xFF000000;
+ Rmask = 0x00FF0000;
+ Gmask = 0x0000FF00;
+ Bmask = 0x000000FF;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case BI_BITFIELDS:
+ break; /* we handled this in the info header. */
+
+ default:
+ SDL_SetError("Compressed BMP files not supported");
+ was_error = SDL_TRUE;
+ goto done;
+ }
+
+ /* Create a compatible surface, note that the colors are RGB ordered */
+ surface =
+ SDL_CreateRGBSurface(0, biWidth, biHeight, biBitCount, Rmask, Gmask,
+ Bmask, Amask);
+ if (surface == NULL) {
+ was_error = SDL_TRUE;
+ goto done;
+ }
+
+ /* Load the palette, if any */
+ palette = (surface->format)->palette;
+ if (palette) {
+ SDL_assert(biBitCount <= 8);
+ if (biClrUsed == 0) {
+ biClrUsed = 1 << biBitCount;
+ }
+ if ((int) biClrUsed > palette->ncolors) {
+ SDL_Color *colors;
+ int ncolors = biClrUsed;
+ colors =
+ (SDL_Color *) SDL_realloc(palette->colors,
+ ncolors *
+ sizeof(*palette->colors));
+ if (!colors) {
+ SDL_OutOfMemory();
+ was_error = SDL_TRUE;
+ goto done;
+ }
+ palette->ncolors = ncolors;
+ palette->colors = colors;
+ } else if ((int) biClrUsed < palette->ncolors) {
+ palette->ncolors = biClrUsed;
+ }
+ if (biSize == 12) {
+ for (i = 0; i < (int) biClrUsed; ++i) {
+ SDL_RWread(src, &palette->colors[i].b, 1, 1);
+ SDL_RWread(src, &palette->colors[i].g, 1, 1);
+ SDL_RWread(src, &palette->colors[i].r, 1, 1);
+ palette->colors[i].a = SDL_ALPHA_OPAQUE;
+ }
+ } else {
+ for (i = 0; i < (int) biClrUsed; ++i) {
+ SDL_RWread(src, &palette->colors[i].b, 1, 1);
+ SDL_RWread(src, &palette->colors[i].g, 1, 1);
+ SDL_RWread(src, &palette->colors[i].r, 1, 1);
+ SDL_RWread(src, &palette->colors[i].a, 1, 1);
+
+ /* According to Microsoft documentation, the fourth element
+ is reserved and must be zero, so we shouldn't treat it as
+ alpha.
+ */
+ palette->colors[i].a = SDL_ALPHA_OPAQUE;
+ }
+ }
+ }
+
+ /* Read the surface pixels. Note that the bmp image is upside down */
+ if (SDL_RWseek(src, fp_offset + bfOffBits, RW_SEEK_SET) < 0) {
+ SDL_Error(SDL_EFSEEK);
+ was_error = SDL_TRUE;
+ goto done;
+ }
+ top = (Uint8 *)surface->pixels;
+ end = (Uint8 *)surface->pixels+(surface->h*surface->pitch);
+ switch (ExpandBMP) {
+ case 1:
+ bmpPitch = (biWidth + 7) >> 3;
+ pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
+ break;
+ case 4:
+ bmpPitch = (biWidth + 1) >> 1;
+ pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
+ break;
+ default:
+ pad = ((surface->pitch % 4) ? (4 - (surface->pitch % 4)) : 0);
+ break;
+ }
+ if (topDown) {
+ bits = top;
+ } else {
+ bits = end - surface->pitch;
+ }
+ while (bits >= top && bits < end) {
+ switch (ExpandBMP) {
+ case 1:
+ case 4:{
+ Uint8 pixel = 0;
+ int shift = (8 - ExpandBMP);
+ for (i = 0; i < surface->w; ++i) {
+ if (i % (8 / ExpandBMP) == 0) {
+ if (!SDL_RWread(src, &pixel, 1, 1)) {
+ SDL_SetError("Error reading from BMP");
+ was_error = SDL_TRUE;
+ goto done;
+ }
+ }
+ *(bits + i) = (pixel >> shift);
+ pixel <<= ExpandBMP;
+ }
+ }
+ break;
+
+ default:
+ if (SDL_RWread(src, bits, 1, surface->pitch)
+ != surface->pitch) {
+ SDL_Error(SDL_EFREAD);
+ was_error = SDL_TRUE;
+ goto done;
+ }
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ /* Byte-swap the pixels if needed. Note that the 24bpp
+ case has already been taken care of above. */
+ switch (biBitCount) {
+ case 15:
+ case 16:{
+ Uint16 *pix = (Uint16 *) bits;
+ for (i = 0; i < surface->w; i++)
+ pix[i] = SDL_Swap16(pix[i]);
+ break;
+ }
+
+ case 32:{
+ Uint32 *pix = (Uint32 *) bits;
+ for (i = 0; i < surface->w; i++)
+ pix[i] = SDL_Swap32(pix[i]);
+ break;
+ }
+ }
+#endif
+ break;
+ }
+ /* Skip padding bytes, ugh */
+ if (pad) {
+ Uint8 padbyte;
+ for (i = 0; i < pad; ++i) {
+ SDL_RWread(src, &padbyte, 1, 1);
+ }
+ }
+ if (topDown) {
+ bits += surface->pitch;
+ } else {
+ bits -= surface->pitch;
+ }
+ }
+ if (correctAlpha) {
+ CorrectAlphaChannel(surface);
+ }
+ done:
+ if (was_error) {
+ if (src) {
+ SDL_RWseek(src, fp_offset, RW_SEEK_SET);
+ }
+ SDL_FreeSurface(surface);
+ surface = NULL;
+ }
+ if (freesrc && src) {
+ SDL_RWclose(src);
+ }
+ return (surface);
+}
+
+int
+SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
+{
+ Sint64 fp_offset;
+ int i, pad;
+ SDL_Surface *surface;
+ Uint8 *bits;
+ SDL_bool save32bit = SDL_FALSE;
+ SDL_bool saveLegacyBMP = SDL_FALSE;
+
+ /* The Win32 BMP file header (14 bytes) */
+ char magic[2] = { 'B', 'M' };
+ Uint32 bfSize;
+ Uint16 bfReserved1;
+ Uint16 bfReserved2;
+ Uint32 bfOffBits;
+
+ /* The Win32 BITMAPINFOHEADER struct (40 bytes) */
+ Uint32 biSize;
+ Sint32 biWidth;
+ Sint32 biHeight;
+ Uint16 biPlanes;
+ Uint16 biBitCount;
+ Uint32 biCompression;
+ Uint32 biSizeImage;
+ Sint32 biXPelsPerMeter;
+ Sint32 biYPelsPerMeter;
+ Uint32 biClrUsed;
+ Uint32 biClrImportant;
+
+ /* The additional header members from the Win32 BITMAPV4HEADER struct (108 bytes in total) */
+ Uint32 bV4RedMask = 0;
+ Uint32 bV4GreenMask = 0;
+ Uint32 bV4BlueMask = 0;
+ Uint32 bV4AlphaMask = 0;
+ Uint32 bV4CSType = 0;
+ Sint32 bV4Endpoints[3 * 3] = {0};
+ Uint32 bV4GammaRed = 0;
+ Uint32 bV4GammaGreen = 0;
+ Uint32 bV4GammaBlue = 0;
+
+ /* Make sure we have somewhere to save */
+ surface = NULL;
+ if (dst) {
+#ifdef SAVE_32BIT_BMP
+ /* We can save alpha information in a 32-bit BMP */
+ if (saveme->format->BitsPerPixel >= 8 && (saveme->format->Amask ||
+ saveme->map->info.flags & SDL_COPY_COLORKEY)) {
+ save32bit = SDL_TRUE;
+ }
+#endif /* SAVE_32BIT_BMP */
+
+ if (saveme->format->palette && !save32bit) {
+ if (saveme->format->BitsPerPixel == 8) {
+ surface = saveme;
+ } else {
+ SDL_SetError("%d bpp BMP files not supported",
+ saveme->format->BitsPerPixel);
+ }
+ } else if ((saveme->format->BitsPerPixel == 24) && !save32bit &&
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ (saveme->format->Rmask == 0x00FF0000) &&
+ (saveme->format->Gmask == 0x0000FF00) &&
+ (saveme->format->Bmask == 0x000000FF)
+#else
+ (saveme->format->Rmask == 0x000000FF) &&
+ (saveme->format->Gmask == 0x0000FF00) &&
+ (saveme->format->Bmask == 0x00FF0000)
+#endif
+ ) {
+ surface = saveme;
+ } else {
+ SDL_PixelFormat format;
+
+ /* If the surface has a colorkey or alpha channel we'll save a
+ 32-bit BMP with alpha channel, otherwise save a 24-bit BMP. */
+ if (save32bit) {
+ SDL_InitFormat(&format, SDL_PIXELFORMAT_BGRA32);
+ } else {
+ SDL_InitFormat(&format, SDL_PIXELFORMAT_BGR24);
+ }
+ surface = SDL_ConvertSurface(saveme, &format, 0);
+ if (!surface) {
+ SDL_SetError("Couldn't convert image to %d bpp",
+ format.BitsPerPixel);
+ }
+ }
+ } else {
+ /* Set no error here because it may overwrite a more useful message from
+ SDL_RWFromFile() if SDL_SaveBMP_RW() is called from SDL_SaveBMP(). */
+ return -1;
+ }
+
+ if (save32bit) {
+ saveLegacyBMP = SDL_GetHintBoolean(SDL_HINT_BMP_SAVE_LEGACY_FORMAT, SDL_FALSE);
+ }
+
+ if (surface && (SDL_LockSurface(surface) == 0)) {
+ const int bw = surface->w * surface->format->BytesPerPixel;
+
+ /* Set the BMP file header values */
+ bfSize = 0; /* We'll write this when we're done */
+ bfReserved1 = 0;
+ bfReserved2 = 0;
+ bfOffBits = 0; /* We'll write this when we're done */
+
+ /* Write the BMP file header values */
+ fp_offset = SDL_RWtell(dst);
+ SDL_ClearError();
+ SDL_RWwrite(dst, magic, 2, 1);
+ SDL_WriteLE32(dst, bfSize);
+ SDL_WriteLE16(dst, bfReserved1);
+ SDL_WriteLE16(dst, bfReserved2);
+ SDL_WriteLE32(dst, bfOffBits);
+
+ /* Set the BMP info values */
+ biSize = 40;
+ biWidth = surface->w;
+ biHeight = surface->h;
+ biPlanes = 1;
+ biBitCount = surface->format->BitsPerPixel;
+ biCompression = BI_RGB;
+ biSizeImage = surface->h * surface->pitch;
+ biXPelsPerMeter = 0;
+ biYPelsPerMeter = 0;
+ if (surface->format->palette) {
+ biClrUsed = surface->format->palette->ncolors;
+ } else {
+ biClrUsed = 0;
+ }
+ biClrImportant = 0;
+
+ /* Set the BMP info values for the version 4 header */
+ if (save32bit && !saveLegacyBMP) {
+ biSize = 108;
+ biCompression = BI_BITFIELDS;
+ /* The BMP format is always little endian, these masks stay the same */
+ bV4RedMask = 0x00ff0000;
+ bV4GreenMask = 0x0000ff00;
+ bV4BlueMask = 0x000000ff;
+ bV4AlphaMask = 0xff000000;
+ bV4CSType = LCS_WINDOWS_COLOR_SPACE;
+ bV4GammaRed = 0;
+ bV4GammaGreen = 0;
+ bV4GammaBlue = 0;
+ }
+
+ /* Write the BMP info values */
+ SDL_WriteLE32(dst, biSize);
+ SDL_WriteLE32(dst, biWidth);
+ SDL_WriteLE32(dst, biHeight);
+ SDL_WriteLE16(dst, biPlanes);
+ SDL_WriteLE16(dst, biBitCount);
+ SDL_WriteLE32(dst, biCompression);
+ SDL_WriteLE32(dst, biSizeImage);
+ SDL_WriteLE32(dst, biXPelsPerMeter);
+ SDL_WriteLE32(dst, biYPelsPerMeter);
+ SDL_WriteLE32(dst, biClrUsed);
+ SDL_WriteLE32(dst, biClrImportant);
+
+ /* Write the BMP info values for the version 4 header */
+ if (save32bit && !saveLegacyBMP) {
+ SDL_WriteLE32(dst, bV4RedMask);
+ SDL_WriteLE32(dst, bV4GreenMask);
+ SDL_WriteLE32(dst, bV4BlueMask);
+ SDL_WriteLE32(dst, bV4AlphaMask);
+ SDL_WriteLE32(dst, bV4CSType);
+ for (i = 0; i < 3 * 3; i++) {
+ SDL_WriteLE32(dst, bV4Endpoints[i]);
+ }
+ SDL_WriteLE32(dst, bV4GammaRed);
+ SDL_WriteLE32(dst, bV4GammaGreen);
+ SDL_WriteLE32(dst, bV4GammaBlue);
+ }
+
+ /* Write the palette (in BGR color order) */
+ if (surface->format->palette) {
+ SDL_Color *colors;
+ int ncolors;
+
+ colors = surface->format->palette->colors;
+ ncolors = surface->format->palette->ncolors;
+ for (i = 0; i < ncolors; ++i) {
+ SDL_RWwrite(dst, &colors[i].b, 1, 1);
+ SDL_RWwrite(dst, &colors[i].g, 1, 1);
+ SDL_RWwrite(dst, &colors[i].r, 1, 1);
+ SDL_RWwrite(dst, &colors[i].a, 1, 1);
+ }
+ }
+
+ /* Write the bitmap offset */
+ bfOffBits = (Uint32)(SDL_RWtell(dst) - fp_offset);
+ if (SDL_RWseek(dst, fp_offset + 10, RW_SEEK_SET) < 0) {
+ SDL_Error(SDL_EFSEEK);
+ }
+ SDL_WriteLE32(dst, bfOffBits);
+ if (SDL_RWseek(dst, fp_offset + bfOffBits, RW_SEEK_SET) < 0) {
+ SDL_Error(SDL_EFSEEK);
+ }
+
+ /* Write the bitmap image upside down */
+ bits = (Uint8 *) surface->pixels + (surface->h * surface->pitch);
+ pad = ((bw % 4) ? (4 - (bw % 4)) : 0);
+ while (bits > (Uint8 *) surface->pixels) {
+ bits -= surface->pitch;
+ if (SDL_RWwrite(dst, bits, 1, bw) != bw) {
+ SDL_Error(SDL_EFWRITE);
+ break;
+ }
+ if (pad) {
+ const Uint8 padbyte = 0;
+ for (i = 0; i < pad; ++i) {
+ SDL_RWwrite(dst, &padbyte, 1, 1);
+ }
+ }
+ }
+
+ /* Write the BMP file size */
+ bfSize = (Uint32)(SDL_RWtell(dst) - fp_offset);
+ if (SDL_RWseek(dst, fp_offset + 2, RW_SEEK_SET) < 0) {
+ SDL_Error(SDL_EFSEEK);
+ }
+ SDL_WriteLE32(dst, bfSize);
+ if (SDL_RWseek(dst, fp_offset + bfSize, RW_SEEK_SET) < 0) {
+ SDL_Error(SDL_EFSEEK);
+ }
+
+ /* Close it up.. */
+ SDL_UnlockSurface(surface);
+ if (surface != saveme) {
+ SDL_FreeSurface(surface);
+ }
+ }
+
+ if (freedst && dst) {
+ SDL_RWclose(dst);
+ }
+ return ((SDL_strcmp(SDL_GetError(), "") == 0) ? 0 : -1);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_clipboard.c b/src/3rdparty/SDL2/src/video/SDL_clipboard.c
new file mode 100644
index 0000000..0dd6a05
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_clipboard.c
@@ -0,0 +1,90 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_clipboard.h"
+#include "SDL_sysvideo.h"
+
+
+int
+SDL_SetClipboardText(const char *text)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ if (!_this) {
+ return SDL_SetError("Video subsystem must be initialized to set clipboard text");
+ }
+
+ if (!text) {
+ text = "";
+ }
+ if (_this->SetClipboardText) {
+ return _this->SetClipboardText(_this, text);
+ } else {
+ SDL_free(_this->clipboard_text);
+ _this->clipboard_text = SDL_strdup(text);
+ return 0;
+ }
+}
+
+char *
+SDL_GetClipboardText(void)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ if (!_this) {
+ SDL_SetError("Video subsystem must be initialized to get clipboard text");
+ return SDL_strdup("");
+ }
+
+ if (_this->GetClipboardText) {
+ return _this->GetClipboardText(_this);
+ } else {
+ const char *text = _this->clipboard_text;
+ if (!text) {
+ text = "";
+ }
+ return SDL_strdup(text);
+ }
+}
+
+SDL_bool
+SDL_HasClipboardText(void)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ if (!_this) {
+ SDL_SetError("Video subsystem must be initialized to check clipboard text");
+ return SDL_FALSE;
+ }
+
+ if (_this->HasClipboardText) {
+ return _this->HasClipboardText(_this);
+ } else {
+ if (_this->clipboard_text && _this->clipboard_text[0] != '\0') {
+ return SDL_TRUE;
+ } else {
+ return SDL_FALSE;
+ }
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_egl.c b/src/3rdparty/SDL2/src/video/SDL_egl.c
new file mode 100644
index 0000000..0daf98a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_egl.c
@@ -0,0 +1,838 @@
+/*
+ * Simple DirectMedia Layer
+ * Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ */
+#include "../SDL_internal.h"
+
+#if SDL_VIDEO_OPENGL_EGL
+
+#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
+#include "../core/windows/SDL_windows.h"
+#endif
+#if SDL_VIDEO_DRIVER_ANDROID
+#include <android/native_window.h>
+#endif
+
+#include "SDL_sysvideo.h"
+#include "SDL_log.h"
+#include "SDL_egl_c.h"
+#include "SDL_loadso.h"
+#include "SDL_hints.h"
+
+#ifdef EGL_KHR_create_context
+/* EGL_OPENGL_ES3_BIT_KHR was added in version 13 of the extension. */
+#ifndef EGL_OPENGL_ES3_BIT_KHR
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif
+#endif /* EGL_KHR_create_context */
+
+#if SDL_VIDEO_DRIVER_RPI
+/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
+#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
+#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" )
+#define ALT_EGL "libEGL.so"
+#define ALT_OGL_ES2 "libGLESv2.so"
+#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so" )
+#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so" )
+
+#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
+/* Android */
+#define DEFAULT_EGL "libEGL.so"
+#define DEFAULT_OGL_ES2 "libGLESv2.so"
+#define DEFAULT_OGL_ES_PVR "libGLES_CM.so"
+#define DEFAULT_OGL_ES "libGLESv1_CM.so"
+
+#elif SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
+/* EGL AND OpenGL ES support via ANGLE */
+#define DEFAULT_EGL "libEGL.dll"
+#define DEFAULT_OGL_ES2 "libGLESv2.dll"
+#define DEFAULT_OGL_ES_PVR "libGLES_CM.dll"
+#define DEFAULT_OGL_ES "libGLESv1_CM.dll"
+
+#elif SDL_VIDEO_DRIVER_COCOA
+/* EGL AND OpenGL ES support via ANGLE */
+#define DEFAULT_EGL "libEGL.dylib"
+#define DEFAULT_OGL_ES2 "libGLESv2.dylib"
+#define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //???
+#define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //???
+
+#else
+/* Desktop Linux */
+#define DEFAULT_OGL "libGL.so.1"
+#define DEFAULT_EGL "libEGL.so.1"
+#define DEFAULT_OGL_ES2 "libGLESv2.so.2"
+#define DEFAULT_OGL_ES_PVR "libGLES_CM.so.1"
+#define DEFAULT_OGL_ES "libGLESv1_CM.so.1"
+#endif /* SDL_VIDEO_DRIVER_RPI */
+
+#ifdef SDL_VIDEO_STATIC_ANGLE
+#define LOAD_FUNC(NAME) \
+_this->egl_data->NAME = (void *)NAME;
+#else
+#define LOAD_FUNC(NAME) \
+_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
+if (!_this->egl_data->NAME) \
+{ \
+ return SDL_SetError("Could not retrieve EGL function " #NAME); \
+}
+#endif
+
+static const char * SDL_EGL_GetErrorName(EGLint eglErrorCode)
+{
+#define SDL_EGL_ERROR_TRANSLATE(e) case e: return #e;
+ switch (eglErrorCode) {
+ SDL_EGL_ERROR_TRANSLATE(EGL_SUCCESS);
+ SDL_EGL_ERROR_TRANSLATE(EGL_NOT_INITIALIZED);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ACCESS);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ALLOC);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ATTRIBUTE);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONTEXT);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONFIG);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CURRENT_SURFACE);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_DISPLAY);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_SURFACE);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_MATCH);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_PARAMETER);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_PIXMAP);
+ SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_WINDOW);
+ SDL_EGL_ERROR_TRANSLATE(EGL_CONTEXT_LOST);
+ }
+ return "";
+}
+
+int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode)
+{
+ const char * errorText = SDL_EGL_GetErrorName(eglErrorCode);
+ char altErrorText[32];
+ if (errorText[0] == '\0') {
+ /* An unknown-to-SDL error code was reported. Report its hexadecimal value, instead of its name. */
+ SDL_snprintf(altErrorText, SDL_arraysize(altErrorText), "0x%x", (unsigned int)eglErrorCode);
+ errorText = altErrorText;
+ }
+ return SDL_SetError("%s (call to %s failed, reporting an error of %s)", message, eglFunctionName, errorText);
+}
+
+/* EGL implementation of SDL OpenGL ES support */
+typedef enum {
+ SDL_EGL_DISPLAY_EXTENSION,
+ SDL_EGL_CLIENT_EXTENSION
+} SDL_EGL_ExtensionType;
+
+static SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext)
+{
+ size_t ext_len;
+ const char *ext_override;
+ const char *egl_extstr;
+ const char *ext_start;
+
+ /* Invalid extensions can be rejected early */
+ if (ext == NULL || *ext == 0 || SDL_strchr(ext, ' ') != NULL) {
+ /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid EGL extension"); */
+ return SDL_FALSE;
+ }
+
+ /* Extensions can be masked with an environment variable.
+ * Unlike the OpenGL override, this will use the set bits of an integer
+ * to disable the extension.
+ * Bit Action
+ * 0 If set, the display extension is masked and not present to SDL.
+ * 1 If set, the client extension is masked and not present to SDL.
+ */
+ ext_override = SDL_getenv(ext);
+ if (ext_override != NULL) {
+ int disable_ext = SDL_atoi(ext_override);
+ if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) {
+ return SDL_FALSE;
+ } else if (disable_ext & 0x02 && type == SDL_EGL_CLIENT_EXTENSION) {
+ return SDL_FALSE;
+ }
+ }
+
+ ext_len = SDL_strlen(ext);
+ switch (type) {
+ case SDL_EGL_DISPLAY_EXTENSION:
+ egl_extstr = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS);
+ break;
+ case SDL_EGL_CLIENT_EXTENSION:
+ /* EGL_EXT_client_extensions modifies eglQueryString to return client extensions
+ * if EGL_NO_DISPLAY is passed. Implementations without it are required to return NULL.
+ * This behavior is included in EGL 1.5.
+ */
+ egl_extstr = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ break;
+ default:
+ /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid extension type"); */
+ return SDL_FALSE;
+ }
+
+ if (egl_extstr != NULL) {
+ ext_start = egl_extstr;
+
+ while (*ext_start) {
+ ext_start = SDL_strstr(ext_start, ext);
+ if (ext_start == NULL) {
+ return SDL_FALSE;
+ }
+ /* Check if the match is not just a substring of one of the extensions */
+ if (ext_start == egl_extstr || *(ext_start - 1) == ' ') {
+ if (ext_start[ext_len] == ' ' || ext_start[ext_len] == 0) {
+ return SDL_TRUE;
+ }
+ }
+ /* If the search stopped in the middle of an extension, skip to the end of it */
+ ext_start += ext_len;
+ while (*ext_start != ' ' && *ext_start != 0) {
+ ext_start++;
+ }
+ }
+ }
+
+ return SDL_FALSE;
+}
+
+void *
+SDL_EGL_GetProcAddress(_THIS, const char *proc)
+{
+ static char procname[1024];
+ void *retval;
+
+ /* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */
+#if !defined(SDL_VIDEO_DRIVER_ANDROID)
+ if (_this->egl_data->eglGetProcAddress) {
+ retval = _this->egl_data->eglGetProcAddress(proc);
+ if (retval) {
+ return retval;
+ }
+ }
+#endif
+
+ retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, proc);
+ if (!retval && SDL_strlen(proc) <= 1022) {
+ procname[0] = '_';
+ SDL_strlcpy(procname + 1, proc, 1022);
+ retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname);
+ }
+ return retval;
+}
+
+void
+SDL_EGL_UnloadLibrary(_THIS)
+{
+ if (_this->egl_data) {
+ if (_this->egl_data->egl_display) {
+ _this->egl_data->eglTerminate(_this->egl_data->egl_display);
+ _this->egl_data->egl_display = NULL;
+ }
+
+ if (_this->egl_data->dll_handle) {
+ SDL_UnloadObject(_this->egl_data->dll_handle);
+ _this->egl_data->dll_handle = NULL;
+ }
+ if (_this->egl_data->egl_dll_handle) {
+ SDL_UnloadObject(_this->egl_data->egl_dll_handle);
+ _this->egl_data->egl_dll_handle = NULL;
+ }
+
+ SDL_free(_this->egl_data);
+ _this->egl_data = NULL;
+ }
+}
+
+int
+SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform)
+{
+ void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */
+ const char *path = NULL;
+ int egl_version_major = 0, egl_version_minor = 0;
+#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
+ const char *d3dcompiler;
+#endif
+#if SDL_VIDEO_DRIVER_RPI
+ SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
+#endif
+
+ if (_this->egl_data) {
+ return SDL_SetError("EGL context already created");
+ }
+
+ _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData));
+ if (!_this->egl_data) {
+ return SDL_OutOfMemory();
+ }
+
+#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
+ d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER);
+ if (!d3dcompiler) {
+ if (WIN_IsWindowsVistaOrGreater()) {
+ d3dcompiler = "d3dcompiler_46.dll";
+ } else {
+ d3dcompiler = "d3dcompiler_43.dll";
+ }
+ }
+ if (SDL_strcasecmp(d3dcompiler, "none") != 0) {
+ if (SDL_LoadObject(d3dcompiler) == NULL) {
+ SDL_ClearError();
+ }
+ }
+#endif
+
+#ifndef SDL_VIDEO_STATIC_ANGLE
+ /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */
+ path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
+ if (path != NULL) {
+ egl_dll_handle = SDL_LoadObject(path);
+ }
+
+ if (egl_dll_handle == NULL) {
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
+ if (_this->gl_config.major_version > 1) {
+ path = DEFAULT_OGL_ES2;
+ egl_dll_handle = SDL_LoadObject(path);
+#ifdef ALT_OGL_ES2
+ if (egl_dll_handle == NULL && !vc4) {
+ path = ALT_OGL_ES2;
+ egl_dll_handle = SDL_LoadObject(path);
+ }
+#endif
+
+ } else {
+ path = DEFAULT_OGL_ES;
+ egl_dll_handle = SDL_LoadObject(path);
+ if (egl_dll_handle == NULL) {
+ path = DEFAULT_OGL_ES_PVR;
+ egl_dll_handle = SDL_LoadObject(path);
+ }
+#ifdef ALT_OGL_ES2
+ if (egl_dll_handle == NULL && !vc4) {
+ path = ALT_OGL_ES2;
+ egl_dll_handle = SDL_LoadObject(path);
+ }
+#endif
+ }
+ }
+#ifdef DEFAULT_OGL
+ else {
+ path = DEFAULT_OGL;
+ egl_dll_handle = SDL_LoadObject(path);
+ }
+#endif
+ }
+ _this->egl_data->egl_dll_handle = egl_dll_handle;
+
+ if (egl_dll_handle == NULL) {
+ return SDL_SetError("Could not initialize OpenGL / GLES library");
+ }
+
+ /* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */
+ if (egl_path != NULL) {
+ dll_handle = SDL_LoadObject(egl_path);
+ }
+ /* Try loading a EGL symbol, if it does not work try the default library paths */
+ if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
+ if (dll_handle != NULL) {
+ SDL_UnloadObject(dll_handle);
+ }
+ path = SDL_getenv("SDL_VIDEO_EGL_DRIVER");
+ if (path == NULL) {
+ path = DEFAULT_EGL;
+ }
+ dll_handle = SDL_LoadObject(path);
+
+#ifdef ALT_EGL
+ if (dll_handle == NULL && !vc4) {
+ path = ALT_EGL;
+ dll_handle = SDL_LoadObject(path);
+ }
+#endif
+
+ if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
+ if (dll_handle != NULL) {
+ SDL_UnloadObject(dll_handle);
+ }
+ return SDL_SetError("Could not load EGL library");
+ }
+ SDL_ClearError();
+ }
+#endif
+
+ _this->egl_data->dll_handle = dll_handle;
+
+ /* Load new function pointers */
+ LOAD_FUNC(eglGetDisplay);
+ LOAD_FUNC(eglInitialize);
+ LOAD_FUNC(eglTerminate);
+ LOAD_FUNC(eglGetProcAddress);
+ LOAD_FUNC(eglChooseConfig);
+ LOAD_FUNC(eglGetConfigAttrib);
+ LOAD_FUNC(eglCreateContext);
+ LOAD_FUNC(eglDestroyContext);
+ LOAD_FUNC(eglCreatePbufferSurface);
+ LOAD_FUNC(eglCreateWindowSurface);
+ LOAD_FUNC(eglDestroySurface);
+ LOAD_FUNC(eglMakeCurrent);
+ LOAD_FUNC(eglSwapBuffers);
+ LOAD_FUNC(eglSwapInterval);
+ LOAD_FUNC(eglWaitNative);
+ LOAD_FUNC(eglWaitGL);
+ LOAD_FUNC(eglBindAPI);
+ LOAD_FUNC(eglQueryString);
+ LOAD_FUNC(eglGetError);
+
+ if (_this->egl_data->eglQueryString) {
+ /* EGL 1.5 allows querying for client version */
+ const char *egl_version = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_VERSION);
+ if (egl_version != NULL) {
+ if (SDL_sscanf(egl_version, "%d.%d", &egl_version_major, &egl_version_minor) != 2) {
+ egl_version_major = 0;
+ egl_version_minor = 0;
+ SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not parse EGL version string: %s", egl_version);
+ }
+ }
+ }
+
+ if (egl_version_major == 1 && egl_version_minor == 5) {
+ LOAD_FUNC(eglGetPlatformDisplay);
+ }
+
+ _this->egl_data->egl_display = EGL_NO_DISPLAY;
+#if !defined(__WINRT__)
+ if (platform) {
+ if (egl_version_major == 1 && egl_version_minor == 5) {
+ _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL);
+ } else {
+ if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) {
+ _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT");
+ if (_this->egl_data->eglGetPlatformDisplayEXT) {
+ _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL);
+ }
+ }
+ }
+ }
+ /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */
+ if (_this->egl_data->egl_display == EGL_NO_DISPLAY) {
+ _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display);
+ }
+ if (_this->egl_data->egl_display == EGL_NO_DISPLAY) {
+ return SDL_SetError("Could not get EGL display");
+ }
+
+ if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
+ return SDL_SetError("Could not initialize EGL");
+ }
+#endif
+
+ if (path) {
+ SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1);
+ } else {
+ *_this->gl_config.driver_path = '\0';
+ }
+
+ return 0;
+}
+
+int
+SDL_EGL_ChooseConfig(_THIS)
+{
+/* 64 seems nice. */
+ EGLint attribs[64];
+ EGLint found_configs = 0, value;
+#ifdef SDL_VIDEO_DRIVER_KMSDRM
+ /* Intel EGL on KMS/DRM (al least) returns invalid configs that confuse the bitdiff search used */
+ /* later in this function, so we simply use the first one when using the KMSDRM driver for now. */
+ EGLConfig configs[1];
+#else
+ /* 128 seems even nicer here */
+ EGLConfig configs[128];
+#endif
+ int i, j, best_bitdiff = -1, bitdiff;
+
+ if (!_this->egl_data) {
+ /* The EGL library wasn't loaded, SDL_GetError() should have info */
+ return -1;
+ }
+
+ /* Get a valid EGL configuration */
+ i = 0;
+ attribs[i++] = EGL_RED_SIZE;
+ attribs[i++] = _this->gl_config.red_size;
+ attribs[i++] = EGL_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.green_size;
+ attribs[i++] = EGL_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.blue_size;
+
+ if (_this->gl_config.alpha_size) {
+ attribs[i++] = EGL_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.alpha_size;
+ }
+
+ if (_this->gl_config.buffer_size) {
+ attribs[i++] = EGL_BUFFER_SIZE;
+ attribs[i++] = _this->gl_config.buffer_size;
+ }
+
+ attribs[i++] = EGL_DEPTH_SIZE;
+ attribs[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.stencil_size) {
+ attribs[i++] = EGL_STENCIL_SIZE;
+ attribs[i++] = _this->gl_config.stencil_size;
+ }
+
+ if (_this->gl_config.multisamplebuffers) {
+ attribs[i++] = EGL_SAMPLE_BUFFERS;
+ attribs[i++] = _this->gl_config.multisamplebuffers;
+ }
+
+ if (_this->gl_config.multisamplesamples) {
+ attribs[i++] = EGL_SAMPLES;
+ attribs[i++] = _this->gl_config.multisamplesamples;
+ }
+
+ attribs[i++] = EGL_RENDERABLE_TYPE;
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
+#ifdef EGL_KHR_create_context
+ if (_this->gl_config.major_version >= 3 &&
+ SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) {
+ attribs[i++] = EGL_OPENGL_ES3_BIT_KHR;
+ } else
+#endif
+ if (_this->gl_config.major_version >= 2) {
+ attribs[i++] = EGL_OPENGL_ES2_BIT;
+ } else {
+ attribs[i++] = EGL_OPENGL_ES_BIT;
+ }
+ _this->egl_data->eglBindAPI(EGL_OPENGL_ES_API);
+ } else {
+ attribs[i++] = EGL_OPENGL_BIT;
+ _this->egl_data->eglBindAPI(EGL_OPENGL_API);
+ }
+
+ if (_this->egl_data->egl_surfacetype) {
+ attribs[i++] = EGL_SURFACE_TYPE;
+ attribs[i++] = _this->egl_data->egl_surfacetype;
+ }
+
+ attribs[i++] = EGL_NONE;
+
+ if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display,
+ attribs,
+ configs, SDL_arraysize(configs),
+ &found_configs) == EGL_FALSE ||
+ found_configs == 0) {
+ return SDL_EGL_SetError("Couldn't find matching EGL config", "eglChooseConfig");
+ }
+
+ /* eglChooseConfig returns a number of configurations that match or exceed the requested attribs. */
+ /* From those, we select the one that matches our requirements more closely via a makeshift algorithm */
+
+ for (i = 0; i < found_configs; i++ ) {
+ bitdiff = 0;
+ for (j = 0; j < SDL_arraysize(attribs) - 1; j += 2) {
+ if (attribs[j] == EGL_NONE) {
+ break;
+ }
+
+ if ( attribs[j+1] != EGL_DONT_CARE && (
+ attribs[j] == EGL_RED_SIZE ||
+ attribs[j] == EGL_GREEN_SIZE ||
+ attribs[j] == EGL_BLUE_SIZE ||
+ attribs[j] == EGL_ALPHA_SIZE ||
+ attribs[j] == EGL_DEPTH_SIZE ||
+ attribs[j] == EGL_STENCIL_SIZE)) {
+ _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, configs[i], attribs[j], &value);
+ bitdiff += value - attribs[j + 1]; /* value is always >= attrib */
+ }
+ }
+
+ if (bitdiff < best_bitdiff || best_bitdiff == -1) {
+ _this->egl_data->egl_config = configs[i];
+
+ best_bitdiff = bitdiff;
+ }
+
+ if (bitdiff == 0) {
+ break; /* we found an exact match! */
+ }
+ }
+
+ return 0;
+}
+
+SDL_GLContext
+SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
+{
+ /* max 14 values plus terminator. */
+ EGLint attribs[15];
+ int attr = 0;
+
+ EGLContext egl_context, share_context = EGL_NO_CONTEXT;
+ EGLint profile_mask = _this->gl_config.profile_mask;
+ EGLint major_version = _this->gl_config.major_version;
+ EGLint minor_version = _this->gl_config.minor_version;
+ SDL_bool profile_es = (profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
+
+ if (!_this->egl_data) {
+ /* The EGL library wasn't loaded, SDL_GetError() should have info */
+ return NULL;
+ }
+
+ if (_this->gl_config.share_with_current_context) {
+ share_context = (EGLContext)SDL_GL_GetCurrentContext();
+ }
+
+ /* Set the context version and other attributes. */
+ if ((major_version < 3 || (minor_version == 0 && profile_es)) &&
+ _this->gl_config.flags == 0 &&
+ (profile_mask == 0 || profile_es)) {
+ /* Create a context without using EGL_KHR_create_context attribs.
+ * When creating a GLES context without EGL_KHR_create_context we can
+ * only specify the major version. When creating a desktop GL context
+ * we can't specify any version, so we only try in that case when the
+ * version is less than 3.0 (matches SDL's GLX/WGL behavior.)
+ */
+ if (profile_es) {
+ attribs[attr++] = EGL_CONTEXT_CLIENT_VERSION;
+ attribs[attr++] = SDL_max(major_version, 1);
+ }
+ } else {
+#ifdef EGL_KHR_create_context
+ /* The Major/minor version, context profiles, and context flags can
+ * only be specified when this extension is available.
+ */
+ if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) {
+ attribs[attr++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+ attribs[attr++] = major_version;
+ attribs[attr++] = EGL_CONTEXT_MINOR_VERSION_KHR;
+ attribs[attr++] = minor_version;
+
+ /* SDL profile bits match EGL profile bits. */
+ if (profile_mask != 0 && profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
+ attribs[attr++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
+ attribs[attr++] = profile_mask;
+ }
+
+ /* SDL flags match EGL flags. */
+ if (_this->gl_config.flags != 0) {
+ attribs[attr++] = EGL_CONTEXT_FLAGS_KHR;
+ attribs[attr++] = _this->gl_config.flags;
+ }
+ } else
+#endif /* EGL_KHR_create_context */
+ {
+ SDL_SetError("Could not create EGL context (context attributes are not supported)");
+ return NULL;
+ }
+ }
+
+ if (_this->gl_config.no_error) {
+#ifdef EGL_KHR_create_context_no_error
+ if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context_no_error")) {
+ attribs[attr++] = EGL_CONTEXT_OPENGL_NO_ERROR_KHR;
+ attribs[attr++] = _this->gl_config.no_error;
+ } else
+#endif
+ {
+ SDL_SetError("EGL implementation does not support no_error contexts");
+ return NULL;
+ }
+ }
+
+ attribs[attr++] = EGL_NONE;
+
+ /* Bind the API */
+ if (profile_es) {
+ _this->egl_data->eglBindAPI(EGL_OPENGL_ES_API);
+ } else {
+ _this->egl_data->eglBindAPI(EGL_OPENGL_API);
+ }
+
+ egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ share_context, attribs);
+
+ if (egl_context == EGL_NO_CONTEXT) {
+ SDL_EGL_SetError("Could not create EGL context", "eglCreateContext");
+ return NULL;
+ }
+
+ _this->egl_data->egl_swapinterval = 0;
+
+ if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) {
+ /* Save the SDL error set by SDL_EGL_MakeCurrent */
+ char errorText[1024];
+ SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText));
+
+ /* Delete the context, which may alter the value returned by SDL_GetError() */
+ SDL_EGL_DeleteContext(_this, egl_context);
+
+ /* Restore the SDL error */
+ SDL_SetError("%s", errorText);
+
+ return NULL;
+ }
+
+ return (SDL_GLContext) egl_context;
+}
+
+int
+SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
+{
+ EGLContext egl_context = (EGLContext) context;
+
+ if (!_this->egl_data) {
+ return SDL_SetError("OpenGL not initialized");
+ }
+
+ /* The android emulator crashes badly if you try to eglMakeCurrent
+ * with a valid context and invalid surface, so we have to check for both here.
+ */
+ if (!egl_context || !egl_surface) {
+ _this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ } else {
+ if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display,
+ egl_surface, egl_surface, egl_context)) {
+ return SDL_EGL_SetError("Unable to make EGL context current", "eglMakeCurrent");
+ }
+ }
+
+ return 0;
+}
+
+int
+SDL_EGL_SetSwapInterval(_THIS, int interval)
+{
+ EGLBoolean status;
+
+ if (!_this->egl_data) {
+ return SDL_SetError("EGL not initialized");
+ }
+
+ status = _this->egl_data->eglSwapInterval(_this->egl_data->egl_display, interval);
+ if (status == EGL_TRUE) {
+ _this->egl_data->egl_swapinterval = interval;
+ return 0;
+ }
+
+ return SDL_EGL_SetError("Unable to set the EGL swap interval", "eglSwapInterval");
+}
+
+int
+SDL_EGL_GetSwapInterval(_THIS)
+{
+ if (!_this->egl_data) {
+ SDL_SetError("EGL not initialized");
+ return 0;
+ }
+
+ return _this->egl_data->egl_swapinterval;
+}
+
+int
+SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
+{
+ if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface)) {
+ return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers");
+ }
+ return 0;
+}
+
+void
+SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ EGLContext egl_context = (EGLContext) context;
+
+ /* Clean up GLES and EGL */
+ if (!_this->egl_data) {
+ return;
+ }
+
+ if (egl_context != NULL && egl_context != EGL_NO_CONTEXT) {
+ SDL_EGL_MakeCurrent(_this, NULL, NULL);
+ _this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
+ }
+
+}
+
+EGLSurface *
+SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
+{
+ /* max 2 values plus terminator. */
+ EGLint attribs[3];
+ int attr = 0;
+
+ EGLSurface * surface;
+
+ if (SDL_EGL_ChooseConfig(_this) != 0) {
+ return EGL_NO_SURFACE;
+ }
+
+#if SDL_VIDEO_DRIVER_ANDROID
+ {
+ /* Android docs recommend doing this!
+ * Ref: http://developer.android.com/reference/android/app/NativeActivity.html
+ */
+ EGLint format;
+ _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ EGL_NATIVE_VISUAL_ID, &format);
+
+ ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
+ }
+#endif
+ if (_this->gl_config.framebuffer_srgb_capable) {
+#ifdef EGL_KHR_gl_colorspace
+ if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_gl_colorspace")) {
+ attribs[attr++] = EGL_GL_COLORSPACE_KHR;
+ attribs[attr++] = EGL_GL_COLORSPACE_SRGB_KHR;
+ } else
+#endif
+ {
+ SDL_SetError("EGL implementation does not support sRGB system framebuffers");
+ return EGL_NO_SURFACE;
+ }
+ }
+
+ attribs[attr++] = EGL_NONE;
+
+ surface = _this->egl_data->eglCreateWindowSurface(
+ _this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ nw, &attribs[0]);
+ if (surface == EGL_NO_SURFACE) {
+ SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface");
+ }
+ return surface;
+}
+
+void
+SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface)
+{
+ if (!_this->egl_data) {
+ return;
+ }
+
+ if (egl_surface != EGL_NO_SURFACE) {
+ _this->egl_data->eglDestroySurface(_this->egl_data->egl_display, egl_surface);
+ }
+}
+
+#endif /* SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/SDL_egl_c.h b/src/3rdparty/SDL2/src/video/SDL_egl_c.h
new file mode 100644
index 0000000..80b1319
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_egl_c.h
@@ -0,0 +1,149 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_egl_h_
+#define SDL_egl_h_
+
+#if SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_egl.h"
+
+#include "SDL_sysvideo.h"
+
+typedef struct SDL_EGL_VideoData
+{
+ void *egl_dll_handle, *dll_handle;
+ EGLDisplay egl_display;
+ EGLConfig egl_config;
+ int egl_swapinterval;
+ int egl_surfacetype;
+
+ EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display);
+ EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list);
+ EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT) (EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list);
+ EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major,
+ EGLint * minor);
+ EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy);
+
+ void *(EGLAPIENTRY *eglGetProcAddress) (const char * procName);
+
+ EGLBoolean(EGLAPIENTRY *eglChooseConfig) (EGLDisplay dpy,
+ const EGLint * attrib_list,
+ EGLConfig * configs,
+ EGLint config_size, EGLint * num_config);
+
+ EGLContext(EGLAPIENTRY *eglCreateContext) (EGLDisplay dpy,
+ EGLConfig config,
+ EGLContext share_list,
+ const EGLint * attrib_list);
+
+ EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx);
+
+ EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config,
+ EGLint const* attrib_list);
+
+ EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy,
+ EGLConfig config,
+ NativeWindowType window,
+ const EGLint * attrib_list);
+ EGLBoolean(EGLAPIENTRY *eglDestroySurface) (EGLDisplay dpy, EGLSurface surface);
+
+ EGLBoolean(EGLAPIENTRY *eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx);
+
+ EGLBoolean(EGLAPIENTRY *eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw);
+
+ EGLBoolean(EGLAPIENTRY *eglSwapInterval) (EGLDisplay dpy, EGLint interval);
+
+ const char *(EGLAPIENTRY *eglQueryString) (EGLDisplay dpy, EGLint name);
+
+ EGLBoolean(EGLAPIENTRY *eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint * value);
+
+ EGLBoolean(EGLAPIENTRY *eglWaitNative) (EGLint engine);
+
+ EGLBoolean(EGLAPIENTRY *eglWaitGL)(void);
+
+ EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum);
+
+ EGLint(EGLAPIENTRY *eglGetError)(void);
+
+} SDL_EGL_VideoData;
+
+/* OpenGLES functions */
+extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
+/* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*)
+ * or, if 0 is passed, let the implementation decide.
+ */
+extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform);
+extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc);
+extern void SDL_EGL_UnloadLibrary(_THIS);
+extern int SDL_EGL_ChooseConfig(_THIS);
+extern int SDL_EGL_SetSwapInterval(_THIS, int interval);
+extern int SDL_EGL_GetSwapInterval(_THIS);
+extern void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
+extern EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw);
+extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface);
+
+/* These need to be wrapped to get the surface for the window by the platform GLES implementation */
+extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface);
+extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context);
+extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface);
+
+/* SDL Error-reporting */
+extern int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode);
+#define SDL_EGL_SetError(message, eglFunctionName) SDL_EGL_SetErrorEx(message, eglFunctionName, _this->egl_data->eglGetError())
+
+/* A few of useful macros */
+
+#define SDL_EGL_SwapWindow_impl(BACKEND) int \
+BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \
+{\
+ return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\
+}
+
+#define SDL_EGL_MakeCurrent_impl(BACKEND) int \
+BACKEND ## _GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) \
+{\
+ if (window && context) { \
+ return SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context); \
+ }\
+ else {\
+ return SDL_EGL_MakeCurrent(_this, NULL, NULL);\
+ }\
+}
+
+#define SDL_EGL_CreateContext_impl(BACKEND) SDL_GLContext \
+BACKEND ## _GLES_CreateContext(_THIS, SDL_Window * window) \
+{\
+ return SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\
+}
+
+#endif /* SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_egl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_fillrect.c b/src/3rdparty/SDL2/src/video/SDL_fillrect.c
new file mode 100644
index 0000000..63f5fcb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_fillrect.c
@@ -0,0 +1,343 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+
+
+#ifdef __SSE__
+/* *INDENT-OFF* */
+
+#ifdef _MSC_VER
+#define SSE_BEGIN \
+ __m128 c128; \
+ c128.m128_u32[0] = color; \
+ c128.m128_u32[1] = color; \
+ c128.m128_u32[2] = color; \
+ c128.m128_u32[3] = color;
+#else
+#define SSE_BEGIN \
+ __m128 c128; \
+ DECLARE_ALIGNED(Uint32, cccc[4], 16); \
+ cccc[0] = color; \
+ cccc[1] = color; \
+ cccc[2] = color; \
+ cccc[3] = color; \
+ c128 = *(__m128 *)cccc;
+#endif
+
+#define SSE_WORK \
+ for (i = n / 64; i--;) { \
+ _mm_stream_ps((float *)(p+0), c128); \
+ _mm_stream_ps((float *)(p+16), c128); \
+ _mm_stream_ps((float *)(p+32), c128); \
+ _mm_stream_ps((float *)(p+48), c128); \
+ p += 64; \
+ }
+
+#define SSE_END
+
+#define DEFINE_SSE_FILLRECT(bpp, type) \
+static void \
+SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
+{ \
+ int i, n; \
+ Uint8 *p = NULL; \
+ \
+ SSE_BEGIN; \
+ \
+ while (h--) { \
+ n = w * bpp; \
+ p = pixels; \
+ \
+ if (n > 63) { \
+ int adjust = 16 - ((uintptr_t)p & 15); \
+ if (adjust < 16) { \
+ n -= adjust; \
+ adjust /= bpp; \
+ while (adjust--) { \
+ *((type *)p) = (type)color; \
+ p += bpp; \
+ } \
+ } \
+ SSE_WORK; \
+ } \
+ if (n & 63) { \
+ int remainder = (n & 63); \
+ remainder /= bpp; \
+ while (remainder--) { \
+ *((type *)p) = (type)color; \
+ p += bpp; \
+ } \
+ } \
+ pixels += pitch; \
+ } \
+ \
+ SSE_END; \
+}
+
+static void
+SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
+{
+ int i, n;
+
+ SSE_BEGIN;
+ while (h--) {
+ Uint8 *p = pixels;
+ n = w;
+
+ if (n > 63) {
+ int adjust = 16 - ((uintptr_t)p & 15);
+ if (adjust) {
+ n -= adjust;
+ SDL_memset(p, color, adjust);
+ p += adjust;
+ }
+ SSE_WORK;
+ }
+ if (n & 63) {
+ int remainder = (n & 63);
+ SDL_memset(p, color, remainder);
+ }
+ pixels += pitch;
+ }
+
+ SSE_END;
+}
+/* DEFINE_SSE_FILLRECT(1, Uint8) */
+DEFINE_SSE_FILLRECT(2, Uint16)
+DEFINE_SSE_FILLRECT(4, Uint32)
+
+/* *INDENT-ON* */
+#endif /* __SSE__ */
+
+static void
+SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
+{
+ int n;
+ Uint8 *p = NULL;
+
+ while (h--) {
+ n = w;
+ p = pixels;
+
+ if (n > 3) {
+ switch ((uintptr_t) p & 3) {
+ case 1:
+ *p++ = (Uint8) color;
+ --n; /* fallthrough */
+ case 2:
+ *p++ = (Uint8) color;
+ --n; /* fallthrough */
+ case 3:
+ *p++ = (Uint8) color;
+ --n; /* fallthrough */
+ }
+ SDL_memset4(p, color, (n >> 2));
+ }
+ if (n & 3) {
+ p += (n & ~3);
+ switch (n & 3) {
+ case 3:
+ *p++ = (Uint8) color; /* fallthrough */
+ case 2:
+ *p++ = (Uint8) color; /* fallthrough */
+ case 1:
+ *p++ = (Uint8) color; /* fallthrough */
+ }
+ }
+ pixels += pitch;
+ }
+}
+
+static void
+SDL_FillRect2(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
+{
+ int n;
+ Uint16 *p = NULL;
+
+ while (h--) {
+ n = w;
+ p = (Uint16 *) pixels;
+
+ if (n > 1) {
+ if ((uintptr_t) p & 2) {
+ *p++ = (Uint16) color;
+ --n;
+ }
+ SDL_memset4(p, color, (n >> 1));
+ }
+ if (n & 1) {
+ p[n - 1] = (Uint16) color;
+ }
+ pixels += pitch;
+ }
+}
+
+static void
+SDL_FillRect3(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
+{
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ Uint8 b1 = (Uint8) (color & 0xFF);
+ Uint8 b2 = (Uint8) ((color >> 8) & 0xFF);
+ Uint8 b3 = (Uint8) ((color >> 16) & 0xFF);
+#elif SDL_BYTEORDER == SDL_BIG_ENDIAN
+ Uint8 b1 = (Uint8) ((color >> 16) & 0xFF);
+ Uint8 b2 = (Uint8) ((color >> 8) & 0xFF);
+ Uint8 b3 = (Uint8) (color & 0xFF);
+#endif
+ int n;
+ Uint8 *p = NULL;
+
+ while (h--) {
+ n = w;
+ p = pixels;
+
+ while (n--) {
+ *p++ = b1;
+ *p++ = b2;
+ *p++ = b3;
+ }
+ pixels += pitch;
+ }
+}
+
+static void
+SDL_FillRect4(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
+{
+ while (h--) {
+ SDL_memset4(pixels, color, w);
+ pixels += pitch;
+ }
+}
+
+/*
+ * This function performs a fast fill of the given rectangle with 'color'
+ */
+int
+SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
+{
+ SDL_Rect clipped;
+ Uint8 *pixels;
+
+ if (!dst) {
+ return SDL_SetError("Passed NULL destination surface");
+ }
+
+ /* This function doesn't work on surfaces < 8 bpp */
+ if (dst->format->BitsPerPixel < 8) {
+ return SDL_SetError("SDL_FillRect(): Unsupported surface format");
+ }
+
+ /* If 'rect' == NULL, then fill the whole surface */
+ if (rect) {
+ /* Perform clipping */
+ if (!SDL_IntersectRect(rect, &dst->clip_rect, &clipped)) {
+ return 0;
+ }
+ rect = &clipped;
+ } else {
+ rect = &dst->clip_rect;
+ /* Don't attempt to fill if the surface's clip_rect is empty */
+ if (SDL_RectEmpty(rect)) {
+ return 0;
+ }
+ }
+
+ /* Perform software fill */
+ if (!dst->pixels) {
+ return SDL_SetError("SDL_FillRect(): You must lock the surface");
+ }
+
+ pixels = (Uint8 *) dst->pixels + rect->y * dst->pitch +
+ rect->x * dst->format->BytesPerPixel;
+
+ switch (dst->format->BytesPerPixel) {
+ case 1:
+ {
+ color |= (color << 8);
+ color |= (color << 16);
+#ifdef __SSE__
+ if (SDL_HasSSE()) {
+ SDL_FillRect1SSE(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+#endif
+ SDL_FillRect1(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+
+ case 2:
+ {
+ color |= (color << 16);
+#ifdef __SSE__
+ if (SDL_HasSSE()) {
+ SDL_FillRect2SSE(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+#endif
+ SDL_FillRect2(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+
+ case 3:
+ /* 24-bit RGB is a slow path, at least for now. */
+ {
+ SDL_FillRect3(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+
+ case 4:
+ {
+#ifdef __SSE__
+ if (SDL_HasSSE()) {
+ SDL_FillRect4SSE(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+#endif
+ SDL_FillRect4(pixels, dst->pitch, color, rect->w, rect->h);
+ break;
+ }
+ }
+
+ /* We're done! */
+ return 0;
+}
+
+int
+SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
+ Uint32 color)
+{
+ int i;
+ int status = 0;
+
+ if (!rects) {
+ return SDL_SetError("SDL_FillRects() passed NULL rects");
+ }
+
+ for (i = 0; i < count; ++i) {
+ status += SDL_FillRect(dst, &rects[i], color);
+ }
+ return status;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_pixels.c b/src/3rdparty/SDL2/src/video/SDL_pixels.c
new file mode 100644
index 0000000..2e26395
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_pixels.c
@@ -0,0 +1,1125 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* General (mostly internal) pixel/color manipulation routines for SDL */
+
+#include "SDL_endian.h"
+#include "SDL_video.h"
+#include "SDL_sysvideo.h"
+#include "SDL_blit.h"
+#include "SDL_pixels_c.h"
+#include "SDL_RLEaccel_c.h"
+
+
+/* Lookup tables to expand partial bytes to the full 0..255 range */
+
+static Uint8 lookup_0[] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
+};
+
+static Uint8 lookup_1[] = {
+0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 255
+};
+
+static Uint8 lookup_2[] = {
+0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230, 234, 238, 242, 246, 250, 255
+};
+
+static Uint8 lookup_3[] = {
+0, 8, 16, 24, 32, 41, 49, 57, 65, 74, 82, 90, 98, 106, 115, 123, 131, 139, 148, 156, 164, 172, 180, 189, 197, 205, 213, 222, 230, 238, 246, 255
+};
+
+static Uint8 lookup_4[] = {
+0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255
+};
+
+static Uint8 lookup_5[] = {
+0, 36, 72, 109, 145, 182, 218, 255
+};
+
+static Uint8 lookup_6[] = {
+0, 85, 170, 255
+};
+
+static Uint8 lookup_7[] = {
+0, 255
+};
+
+static Uint8 lookup_8[] = {
+255
+};
+
+Uint8* SDL_expand_byte[9] = {
+ lookup_0,
+ lookup_1,
+ lookup_2,
+ lookup_3,
+ lookup_4,
+ lookup_5,
+ lookup_6,
+ lookup_7,
+ lookup_8
+};
+
+/* Helper functions */
+
+const char*
+SDL_GetPixelFormatName(Uint32 format)
+{
+ switch (format) {
+#define CASE(X) case X: return #X;
+ CASE(SDL_PIXELFORMAT_INDEX1LSB)
+ CASE(SDL_PIXELFORMAT_INDEX1MSB)
+ CASE(SDL_PIXELFORMAT_INDEX4LSB)
+ CASE(SDL_PIXELFORMAT_INDEX4MSB)
+ CASE(SDL_PIXELFORMAT_INDEX8)
+ CASE(SDL_PIXELFORMAT_RGB332)
+ CASE(SDL_PIXELFORMAT_RGB444)
+ CASE(SDL_PIXELFORMAT_RGB555)
+ CASE(SDL_PIXELFORMAT_BGR555)
+ CASE(SDL_PIXELFORMAT_ARGB4444)
+ CASE(SDL_PIXELFORMAT_RGBA4444)
+ CASE(SDL_PIXELFORMAT_ABGR4444)
+ CASE(SDL_PIXELFORMAT_BGRA4444)
+ CASE(SDL_PIXELFORMAT_ARGB1555)
+ CASE(SDL_PIXELFORMAT_RGBA5551)
+ CASE(SDL_PIXELFORMAT_ABGR1555)
+ CASE(SDL_PIXELFORMAT_BGRA5551)
+ CASE(SDL_PIXELFORMAT_RGB565)
+ CASE(SDL_PIXELFORMAT_BGR565)
+ CASE(SDL_PIXELFORMAT_RGB24)
+ CASE(SDL_PIXELFORMAT_BGR24)
+ CASE(SDL_PIXELFORMAT_RGB888)
+ CASE(SDL_PIXELFORMAT_RGBX8888)
+ CASE(SDL_PIXELFORMAT_BGR888)
+ CASE(SDL_PIXELFORMAT_BGRX8888)
+ CASE(SDL_PIXELFORMAT_ARGB8888)
+ CASE(SDL_PIXELFORMAT_RGBA8888)
+ CASE(SDL_PIXELFORMAT_ABGR8888)
+ CASE(SDL_PIXELFORMAT_BGRA8888)
+ CASE(SDL_PIXELFORMAT_ARGB2101010)
+ CASE(SDL_PIXELFORMAT_YV12)
+ CASE(SDL_PIXELFORMAT_IYUV)
+ CASE(SDL_PIXELFORMAT_YUY2)
+ CASE(SDL_PIXELFORMAT_UYVY)
+ CASE(SDL_PIXELFORMAT_YVYU)
+ CASE(SDL_PIXELFORMAT_NV12)
+ CASE(SDL_PIXELFORMAT_NV21)
+#undef CASE
+ default:
+ return "SDL_PIXELFORMAT_UNKNOWN";
+ }
+}
+
+SDL_bool
+SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
+ Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask)
+{
+ Uint32 masks[4];
+
+ /* This function doesn't work with FourCC pixel formats */
+ if (SDL_ISPIXELFORMAT_FOURCC(format)) {
+ SDL_SetError("FOURCC pixel formats are not supported");
+ return SDL_FALSE;
+ }
+
+ /* Initialize the values here */
+ if (SDL_BYTESPERPIXEL(format) <= 2) {
+ *bpp = SDL_BITSPERPIXEL(format);
+ } else {
+ *bpp = SDL_BYTESPERPIXEL(format) * 8;
+ }
+ *Rmask = *Gmask = *Bmask = *Amask = 0;
+
+ if (format == SDL_PIXELFORMAT_RGB24) {
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ *Rmask = 0x00FF0000;
+ *Gmask = 0x0000FF00;
+ *Bmask = 0x000000FF;
+#else
+ *Rmask = 0x000000FF;
+ *Gmask = 0x0000FF00;
+ *Bmask = 0x00FF0000;
+#endif
+ return SDL_TRUE;
+ }
+
+ if (format == SDL_PIXELFORMAT_BGR24) {
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ *Rmask = 0x000000FF;
+ *Gmask = 0x0000FF00;
+ *Bmask = 0x00FF0000;
+#else
+ *Rmask = 0x00FF0000;
+ *Gmask = 0x0000FF00;
+ *Bmask = 0x000000FF;
+#endif
+ return SDL_TRUE;
+ }
+
+ if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 &&
+ SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 &&
+ SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED32) {
+ /* Not a format that uses masks */
+ return SDL_TRUE;
+ }
+
+ switch (SDL_PIXELLAYOUT(format)) {
+ case SDL_PACKEDLAYOUT_332:
+ masks[0] = 0x00000000;
+ masks[1] = 0x000000E0;
+ masks[2] = 0x0000001C;
+ masks[3] = 0x00000003;
+ break;
+ case SDL_PACKEDLAYOUT_4444:
+ masks[0] = 0x0000F000;
+ masks[1] = 0x00000F00;
+ masks[2] = 0x000000F0;
+ masks[3] = 0x0000000F;
+ break;
+ case SDL_PACKEDLAYOUT_1555:
+ masks[0] = 0x00008000;
+ masks[1] = 0x00007C00;
+ masks[2] = 0x000003E0;
+ masks[3] = 0x0000001F;
+ break;
+ case SDL_PACKEDLAYOUT_5551:
+ masks[0] = 0x0000F800;
+ masks[1] = 0x000007C0;
+ masks[2] = 0x0000003E;
+ masks[3] = 0x00000001;
+ break;
+ case SDL_PACKEDLAYOUT_565:
+ masks[0] = 0x00000000;
+ masks[1] = 0x0000F800;
+ masks[2] = 0x000007E0;
+ masks[3] = 0x0000001F;
+ break;
+ case SDL_PACKEDLAYOUT_8888:
+ masks[0] = 0xFF000000;
+ masks[1] = 0x00FF0000;
+ masks[2] = 0x0000FF00;
+ masks[3] = 0x000000FF;
+ break;
+ case SDL_PACKEDLAYOUT_2101010:
+ masks[0] = 0xC0000000;
+ masks[1] = 0x3FF00000;
+ masks[2] = 0x000FFC00;
+ masks[3] = 0x000003FF;
+ break;
+ case SDL_PACKEDLAYOUT_1010102:
+ masks[0] = 0xFFC00000;
+ masks[1] = 0x003FF000;
+ masks[2] = 0x00000FFC;
+ masks[3] = 0x00000003;
+ break;
+ default:
+ SDL_SetError("Unknown pixel format");
+ return SDL_FALSE;
+ }
+
+ switch (SDL_PIXELORDER(format)) {
+ case SDL_PACKEDORDER_XRGB:
+ *Rmask = masks[1];
+ *Gmask = masks[2];
+ *Bmask = masks[3];
+ break;
+ case SDL_PACKEDORDER_RGBX:
+ *Rmask = masks[0];
+ *Gmask = masks[1];
+ *Bmask = masks[2];
+ break;
+ case SDL_PACKEDORDER_ARGB:
+ *Amask = masks[0];
+ *Rmask = masks[1];
+ *Gmask = masks[2];
+ *Bmask = masks[3];
+ break;
+ case SDL_PACKEDORDER_RGBA:
+ *Rmask = masks[0];
+ *Gmask = masks[1];
+ *Bmask = masks[2];
+ *Amask = masks[3];
+ break;
+ case SDL_PACKEDORDER_XBGR:
+ *Bmask = masks[1];
+ *Gmask = masks[2];
+ *Rmask = masks[3];
+ break;
+ case SDL_PACKEDORDER_BGRX:
+ *Bmask = masks[0];
+ *Gmask = masks[1];
+ *Rmask = masks[2];
+ break;
+ case SDL_PACKEDORDER_BGRA:
+ *Bmask = masks[0];
+ *Gmask = masks[1];
+ *Rmask = masks[2];
+ *Amask = masks[3];
+ break;
+ case SDL_PACKEDORDER_ABGR:
+ *Amask = masks[0];
+ *Bmask = masks[1];
+ *Gmask = masks[2];
+ *Rmask = masks[3];
+ break;
+ default:
+ SDL_SetError("Unknown pixel format");
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+Uint32
+SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
+ Uint32 Amask)
+{
+ switch (bpp) {
+ case 1:
+ /* SDL defaults to MSB ordering */
+ return SDL_PIXELFORMAT_INDEX1MSB;
+ case 4:
+ /* SDL defaults to MSB ordering */
+ return SDL_PIXELFORMAT_INDEX4MSB;
+ case 8:
+ if (Rmask == 0) {
+ return SDL_PIXELFORMAT_INDEX8;
+ }
+ if (Rmask == 0xE0 &&
+ Gmask == 0x1C &&
+ Bmask == 0x03 &&
+ Amask == 0x00) {
+ return SDL_PIXELFORMAT_RGB332;
+ }
+ break;
+ case 12:
+ if (Rmask == 0) {
+ return SDL_PIXELFORMAT_RGB444;
+ }
+ if (Rmask == 0x0F00 &&
+ Gmask == 0x00F0 &&
+ Bmask == 0x000F &&
+ Amask == 0x0000) {
+ return SDL_PIXELFORMAT_RGB444;
+ }
+ break;
+ case 15:
+ if (Rmask == 0) {
+ return SDL_PIXELFORMAT_RGB555;
+ }
+ /* fallthrough */
+ case 16:
+ if (Rmask == 0) {
+ return SDL_PIXELFORMAT_RGB565;
+ }
+ if (Rmask == 0x7C00 &&
+ Gmask == 0x03E0 &&
+ Bmask == 0x001F &&
+ Amask == 0x0000) {
+ return SDL_PIXELFORMAT_RGB555;
+ }
+ if (Rmask == 0x001F &&
+ Gmask == 0x03E0 &&
+ Bmask == 0x7C00 &&
+ Amask == 0x0000) {
+ return SDL_PIXELFORMAT_BGR555;
+ }
+ if (Rmask == 0x0F00 &&
+ Gmask == 0x00F0 &&
+ Bmask == 0x000F &&
+ Amask == 0xF000) {
+ return SDL_PIXELFORMAT_ARGB4444;
+ }
+ if (Rmask == 0xF000 &&
+ Gmask == 0x0F00 &&
+ Bmask == 0x00F0 &&
+ Amask == 0x000F) {
+ return SDL_PIXELFORMAT_RGBA4444;
+ }
+ if (Rmask == 0x000F &&
+ Gmask == 0x00F0 &&
+ Bmask == 0x0F00 &&
+ Amask == 0xF000) {
+ return SDL_PIXELFORMAT_ABGR4444;
+ }
+ if (Rmask == 0x00F0 &&
+ Gmask == 0x0F00 &&
+ Bmask == 0xF000 &&
+ Amask == 0x000F) {
+ return SDL_PIXELFORMAT_BGRA4444;
+ }
+ if (Rmask == 0x7C00 &&
+ Gmask == 0x03E0 &&
+ Bmask == 0x001F &&
+ Amask == 0x8000) {
+ return SDL_PIXELFORMAT_ARGB1555;
+ }
+ if (Rmask == 0xF800 &&
+ Gmask == 0x07C0 &&
+ Bmask == 0x003E &&
+ Amask == 0x0001) {
+ return SDL_PIXELFORMAT_RGBA5551;
+ }
+ if (Rmask == 0x001F &&
+ Gmask == 0x03E0 &&
+ Bmask == 0x7C00 &&
+ Amask == 0x8000) {
+ return SDL_PIXELFORMAT_ABGR1555;
+ }
+ if (Rmask == 0x003E &&
+ Gmask == 0x07C0 &&
+ Bmask == 0xF800 &&
+ Amask == 0x0001) {
+ return SDL_PIXELFORMAT_BGRA5551;
+ }
+ if (Rmask == 0xF800 &&
+ Gmask == 0x07E0 &&
+ Bmask == 0x001F &&
+ Amask == 0x0000) {
+ return SDL_PIXELFORMAT_RGB565;
+ }
+ if (Rmask == 0x001F &&
+ Gmask == 0x07E0 &&
+ Bmask == 0xF800 &&
+ Amask == 0x0000) {
+ return SDL_PIXELFORMAT_BGR565;
+ }
+ if (Rmask == 0x003F &&
+ Gmask == 0x07C0 &&
+ Bmask == 0xF800 &&
+ Amask == 0x0000) {
+ /* Technically this would be BGR556, but Witek says this works in bug 3158 */
+ return SDL_PIXELFORMAT_RGB565;
+ }
+ break;
+ case 24:
+ switch (Rmask) {
+ case 0:
+ case 0x00FF0000:
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ return SDL_PIXELFORMAT_RGB24;
+#else
+ return SDL_PIXELFORMAT_BGR24;
+#endif
+ case 0x000000FF:
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ return SDL_PIXELFORMAT_BGR24;
+#else
+ return SDL_PIXELFORMAT_RGB24;
+#endif
+ }
+ case 32:
+ if (Rmask == 0) {
+ return SDL_PIXELFORMAT_RGB888;
+ }
+ if (Rmask == 0x00FF0000 &&
+ Gmask == 0x0000FF00 &&
+ Bmask == 0x000000FF &&
+ Amask == 0x00000000) {
+ return SDL_PIXELFORMAT_RGB888;
+ }
+ if (Rmask == 0xFF000000 &&
+ Gmask == 0x00FF0000 &&
+ Bmask == 0x0000FF00 &&
+ Amask == 0x00000000) {
+ return SDL_PIXELFORMAT_RGBX8888;
+ }
+ if (Rmask == 0x000000FF &&
+ Gmask == 0x0000FF00 &&
+ Bmask == 0x00FF0000 &&
+ Amask == 0x00000000) {
+ return SDL_PIXELFORMAT_BGR888;
+ }
+ if (Rmask == 0x0000FF00 &&
+ Gmask == 0x00FF0000 &&
+ Bmask == 0xFF000000 &&
+ Amask == 0x00000000) {
+ return SDL_PIXELFORMAT_BGRX8888;
+ }
+ if (Rmask == 0x00FF0000 &&
+ Gmask == 0x0000FF00 &&
+ Bmask == 0x000000FF &&
+ Amask == 0xFF000000) {
+ return SDL_PIXELFORMAT_ARGB8888;
+ }
+ if (Rmask == 0xFF000000 &&
+ Gmask == 0x00FF0000 &&
+ Bmask == 0x0000FF00 &&
+ Amask == 0x000000FF) {
+ return SDL_PIXELFORMAT_RGBA8888;
+ }
+ if (Rmask == 0x000000FF &&
+ Gmask == 0x0000FF00 &&
+ Bmask == 0x00FF0000 &&
+ Amask == 0xFF000000) {
+ return SDL_PIXELFORMAT_ABGR8888;
+ }
+ if (Rmask == 0x0000FF00 &&
+ Gmask == 0x00FF0000 &&
+ Bmask == 0xFF000000 &&
+ Amask == 0x000000FF) {
+ return SDL_PIXELFORMAT_BGRA8888;
+ }
+ if (Rmask == 0x3FF00000 &&
+ Gmask == 0x000FFC00 &&
+ Bmask == 0x000003FF &&
+ Amask == 0xC0000000) {
+ return SDL_PIXELFORMAT_ARGB2101010;
+ }
+ }
+ return SDL_PIXELFORMAT_UNKNOWN;
+}
+
+static SDL_PixelFormat *formats;
+static SDL_SpinLock formats_lock = 0;
+
+SDL_PixelFormat *
+SDL_AllocFormat(Uint32 pixel_format)
+{
+ SDL_PixelFormat *format;
+
+ SDL_AtomicLock(&formats_lock);
+
+ /* Look it up in our list of previously allocated formats */
+ for (format = formats; format; format = format->next) {
+ if (pixel_format == format->format) {
+ ++format->refcount;
+ SDL_AtomicUnlock(&formats_lock);
+ return format;
+ }
+ }
+
+ /* Allocate an empty pixel format structure, and initialize it */
+ format = SDL_malloc(sizeof(*format));
+ if (format == NULL) {
+ SDL_AtomicUnlock(&formats_lock);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ if (SDL_InitFormat(format, pixel_format) < 0) {
+ SDL_AtomicUnlock(&formats_lock);
+ SDL_free(format);
+ SDL_InvalidParamError("format");
+ return NULL;
+ }
+
+ if (!SDL_ISPIXELFORMAT_INDEXED(pixel_format)) {
+ /* Cache the RGB formats */
+ format->next = formats;
+ formats = format;
+ }
+
+ SDL_AtomicUnlock(&formats_lock);
+
+ return format;
+}
+
+int
+SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
+{
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+ Uint32 mask;
+
+ if (!SDL_PixelFormatEnumToMasks(pixel_format, &bpp,
+ &Rmask, &Gmask, &Bmask, &Amask)) {
+ return -1;
+ }
+
+ /* Set up the format */
+ SDL_zerop(format);
+ format->format = pixel_format;
+ format->BitsPerPixel = bpp;
+ format->BytesPerPixel = (bpp + 7) / 8;
+
+ format->Rmask = Rmask;
+ format->Rshift = 0;
+ format->Rloss = 8;
+ if (Rmask) {
+ for (mask = Rmask; !(mask & 0x01); mask >>= 1)
+ ++format->Rshift;
+ for (; (mask & 0x01); mask >>= 1)
+ --format->Rloss;
+ }
+
+ format->Gmask = Gmask;
+ format->Gshift = 0;
+ format->Gloss = 8;
+ if (Gmask) {
+ for (mask = Gmask; !(mask & 0x01); mask >>= 1)
+ ++format->Gshift;
+ for (; (mask & 0x01); mask >>= 1)
+ --format->Gloss;
+ }
+
+ format->Bmask = Bmask;
+ format->Bshift = 0;
+ format->Bloss = 8;
+ if (Bmask) {
+ for (mask = Bmask; !(mask & 0x01); mask >>= 1)
+ ++format->Bshift;
+ for (; (mask & 0x01); mask >>= 1)
+ --format->Bloss;
+ }
+
+ format->Amask = Amask;
+ format->Ashift = 0;
+ format->Aloss = 8;
+ if (Amask) {
+ for (mask = Amask; !(mask & 0x01); mask >>= 1)
+ ++format->Ashift;
+ for (; (mask & 0x01); mask >>= 1)
+ --format->Aloss;
+ }
+
+ format->palette = NULL;
+ format->refcount = 1;
+ format->next = NULL;
+
+ return 0;
+}
+
+void
+SDL_FreeFormat(SDL_PixelFormat *format)
+{
+ SDL_PixelFormat *prev;
+
+ if (!format) {
+ SDL_InvalidParamError("format");
+ return;
+ }
+
+ SDL_AtomicLock(&formats_lock);
+
+ if (--format->refcount > 0) {
+ SDL_AtomicUnlock(&formats_lock);
+ return;
+ }
+
+ /* Remove this format from our list */
+ if (format == formats) {
+ formats = format->next;
+ } else if (formats) {
+ for (prev = formats; prev->next; prev = prev->next) {
+ if (prev->next == format) {
+ prev->next = format->next;
+ break;
+ }
+ }
+ }
+
+ SDL_AtomicUnlock(&formats_lock);
+
+ if (format->palette) {
+ SDL_FreePalette(format->palette);
+ }
+ SDL_free(format);
+}
+
+SDL_Palette *
+SDL_AllocPalette(int ncolors)
+{
+ SDL_Palette *palette;
+
+ /* Input validation */
+ if (ncolors < 1) {
+ SDL_InvalidParamError("ncolors");
+ return NULL;
+ }
+
+ palette = (SDL_Palette *) SDL_malloc(sizeof(*palette));
+ if (!palette) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ palette->colors =
+ (SDL_Color *) SDL_malloc(ncolors * sizeof(*palette->colors));
+ if (!palette->colors) {
+ SDL_free(palette);
+ return NULL;
+ }
+ palette->ncolors = ncolors;
+ palette->version = 1;
+ palette->refcount = 1;
+
+ SDL_memset(palette->colors, 0xFF, ncolors * sizeof(*palette->colors));
+
+ return palette;
+}
+
+int
+SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette)
+{
+ if (!format) {
+ return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format");
+ }
+
+ if (palette && palette->ncolors > (1 << format->BitsPerPixel)) {
+ return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format");
+ }
+
+ if (format->palette == palette) {
+ return 0;
+ }
+
+ if (format->palette) {
+ SDL_FreePalette(format->palette);
+ }
+
+ format->palette = palette;
+
+ if (format->palette) {
+ ++format->palette->refcount;
+ }
+
+ return 0;
+}
+
+int
+SDL_SetPaletteColors(SDL_Palette * palette, const SDL_Color * colors,
+ int firstcolor, int ncolors)
+{
+ int status = 0;
+
+ /* Verify the parameters */
+ if (!palette) {
+ return -1;
+ }
+ if (ncolors > (palette->ncolors - firstcolor)) {
+ ncolors = (palette->ncolors - firstcolor);
+ status = -1;
+ }
+
+ if (colors != (palette->colors + firstcolor)) {
+ SDL_memcpy(palette->colors + firstcolor, colors,
+ ncolors * sizeof(*colors));
+ }
+ ++palette->version;
+ if (!palette->version) {
+ palette->version = 1;
+ }
+
+ return status;
+}
+
+void
+SDL_FreePalette(SDL_Palette * palette)
+{
+ if (!palette) {
+ SDL_InvalidParamError("palette");
+ return;
+ }
+ if (--palette->refcount > 0) {
+ return;
+ }
+ SDL_free(palette->colors);
+ SDL_free(palette);
+}
+
+/*
+ * Calculate an 8-bit (3 red, 3 green, 2 blue) dithered palette of colors
+ */
+void
+SDL_DitherColors(SDL_Color * colors, int bpp)
+{
+ int i;
+ if (bpp != 8)
+ return; /* only 8bpp supported right now */
+
+ for (i = 0; i < 256; i++) {
+ int r, g, b;
+ /* map each bit field to the full [0, 255] interval,
+ so 0 is mapped to (0, 0, 0) and 255 to (255, 255, 255) */
+ r = i & 0xe0;
+ r |= r >> 3 | r >> 6;
+ colors[i].r = r;
+ g = (i << 3) & 0xe0;
+ g |= g >> 3 | g >> 6;
+ colors[i].g = g;
+ b = i & 0x3;
+ b |= b << 2;
+ b |= b << 4;
+ colors[i].b = b;
+ colors[i].a = SDL_ALPHA_OPAQUE;
+ }
+}
+
+/*
+ * Match an RGB value to a particular palette index
+ */
+Uint8
+SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+{
+ /* Do colorspace distance matching */
+ unsigned int smallest;
+ unsigned int distance;
+ int rd, gd, bd, ad;
+ int i;
+ Uint8 pixel = 0;
+
+ smallest = ~0;
+ for (i = 0; i < pal->ncolors; ++i) {
+ rd = pal->colors[i].r - r;
+ gd = pal->colors[i].g - g;
+ bd = pal->colors[i].b - b;
+ ad = pal->colors[i].a - a;
+ distance = (rd * rd) + (gd * gd) + (bd * bd) + (ad * ad);
+ if (distance < smallest) {
+ pixel = i;
+ if (distance == 0) { /* Perfect match! */
+ break;
+ }
+ smallest = distance;
+ }
+ }
+ return (pixel);
+}
+
+/* Find the opaque pixel value corresponding to an RGB triple */
+Uint32
+SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b)
+{
+ if (format->palette == NULL) {
+ return (r >> format->Rloss) << format->Rshift
+ | (g >> format->Gloss) << format->Gshift
+ | (b >> format->Bloss) << format->Bshift | format->Amask;
+ } else {
+ return SDL_FindColor(format->palette, r, g, b, SDL_ALPHA_OPAQUE);
+ }
+}
+
+/* Find the pixel value corresponding to an RGBA quadruple */
+Uint32
+SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a)
+{
+ if (format->palette == NULL) {
+ return (r >> format->Rloss) << format->Rshift
+ | (g >> format->Gloss) << format->Gshift
+ | (b >> format->Bloss) << format->Bshift
+ | ((a >> format->Aloss) << format->Ashift & format->Amask);
+ } else {
+ return SDL_FindColor(format->palette, r, g, b, a);
+ }
+}
+
+void
+SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g,
+ Uint8 * b)
+{
+ if (format->palette == NULL) {
+ unsigned v;
+ v = (pixel & format->Rmask) >> format->Rshift;
+ *r = SDL_expand_byte[format->Rloss][v];
+ v = (pixel & format->Gmask) >> format->Gshift;
+ *g = SDL_expand_byte[format->Gloss][v];
+ v = (pixel & format->Bmask) >> format->Bshift;
+ *b = SDL_expand_byte[format->Bloss][v];
+ } else {
+ if (pixel < (unsigned)format->palette->ncolors) {
+ *r = format->palette->colors[pixel].r;
+ *g = format->palette->colors[pixel].g;
+ *b = format->palette->colors[pixel].b;
+ } else {
+ *r = *g = *b = 0;
+ }
+ }
+}
+
+void
+SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
+{
+ if (format->palette == NULL) {
+ unsigned v;
+ v = (pixel & format->Rmask) >> format->Rshift;
+ *r = SDL_expand_byte[format->Rloss][v];
+ v = (pixel & format->Gmask) >> format->Gshift;
+ *g = SDL_expand_byte[format->Gloss][v];
+ v = (pixel & format->Bmask) >> format->Bshift;
+ *b = SDL_expand_byte[format->Bloss][v];
+ v = (pixel & format->Amask) >> format->Ashift;
+ *a = SDL_expand_byte[format->Aloss][v];
+ } else {
+ if (pixel < (unsigned)format->palette->ncolors) {
+ *r = format->palette->colors[pixel].r;
+ *g = format->palette->colors[pixel].g;
+ *b = format->palette->colors[pixel].b;
+ *a = format->palette->colors[pixel].a;
+ } else {
+ *r = *g = *b = *a = 0;
+ }
+ }
+}
+
+/* Map from Palette to Palette */
+static Uint8 *
+Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
+{
+ Uint8 *map;
+ int i;
+
+ if (identical) {
+ if (src->ncolors <= dst->ncolors) {
+ /* If an identical palette, no need to map */
+ if (src == dst
+ ||
+ (SDL_memcmp
+ (src->colors, dst->colors,
+ src->ncolors * sizeof(SDL_Color)) == 0)) {
+ *identical = 1;
+ return (NULL);
+ }
+ }
+ *identical = 0;
+ }
+ map = (Uint8 *) SDL_malloc(src->ncolors);
+ if (map == NULL) {
+ SDL_OutOfMemory();
+ return (NULL);
+ }
+ for (i = 0; i < src->ncolors; ++i) {
+ map[i] = SDL_FindColor(dst,
+ src->colors[i].r, src->colors[i].g,
+ src->colors[i].b, src->colors[i].a);
+ }
+ return (map);
+}
+
+/* Map from Palette to BitField */
+static Uint8 *
+Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
+ SDL_PixelFormat * dst)
+{
+ Uint8 *map;
+ int i;
+ int bpp;
+ SDL_Palette *pal = src->palette;
+
+ bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
+ map = (Uint8 *) SDL_malloc(pal->ncolors * bpp);
+ if (map == NULL) {
+ SDL_OutOfMemory();
+ return (NULL);
+ }
+
+ /* We memory copy to the pixel map so the endianness is preserved */
+ for (i = 0; i < pal->ncolors; ++i) {
+ Uint8 R = (Uint8) ((pal->colors[i].r * Rmod) / 255);
+ Uint8 G = (Uint8) ((pal->colors[i].g * Gmod) / 255);
+ Uint8 B = (Uint8) ((pal->colors[i].b * Bmod) / 255);
+ Uint8 A = (Uint8) ((pal->colors[i].a * Amod) / 255);
+ ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A);
+ }
+ return (map);
+}
+
+/* Map from BitField to Dithered-Palette to Palette */
+static Uint8 *
+MapNto1(SDL_PixelFormat * src, SDL_PixelFormat * dst, int *identical)
+{
+ /* Generate a 256 color dither palette */
+ SDL_Palette dithered;
+ SDL_Color colors[256];
+ SDL_Palette *pal = dst->palette;
+
+ dithered.ncolors = 256;
+ SDL_DitherColors(colors, 8);
+ dithered.colors = colors;
+ return (Map1to1(&dithered, pal, identical));
+}
+
+SDL_BlitMap *
+SDL_AllocBlitMap(void)
+{
+ SDL_BlitMap *map;
+
+ /* Allocate the empty map */
+ map = (SDL_BlitMap *) SDL_calloc(1, sizeof(*map));
+ if (map == NULL) {
+ SDL_OutOfMemory();
+ return (NULL);
+ }
+ map->info.r = 0xFF;
+ map->info.g = 0xFF;
+ map->info.b = 0xFF;
+ map->info.a = 0xFF;
+
+ /* It's ready to go */
+ return (map);
+}
+
+void
+SDL_InvalidateMap(SDL_BlitMap * map)
+{
+ if (!map) {
+ return;
+ }
+ if (map->dst) {
+ /* Release our reference to the surface - see the note below */
+ if (--map->dst->refcount <= 0) {
+ SDL_FreeSurface(map->dst);
+ }
+ }
+ map->dst = NULL;
+ map->src_palette_version = 0;
+ map->dst_palette_version = 0;
+ SDL_free(map->info.table);
+ map->info.table = NULL;
+}
+
+int
+SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
+{
+ SDL_PixelFormat *srcfmt;
+ SDL_PixelFormat *dstfmt;
+ SDL_BlitMap *map;
+
+ /* Clear out any previous mapping */
+ map = src->map;
+ if ((src->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
+ SDL_UnRLESurface(src, 1);
+ }
+ SDL_InvalidateMap(map);
+
+ /* Figure out what kind of mapping we're doing */
+ map->identity = 0;
+ srcfmt = src->format;
+ dstfmt = dst->format;
+ if (SDL_ISPIXELFORMAT_INDEXED(srcfmt->format)) {
+ if (SDL_ISPIXELFORMAT_INDEXED(dstfmt->format)) {
+ /* Palette --> Palette */
+ map->info.table =
+ Map1to1(srcfmt->palette, dstfmt->palette, &map->identity);
+ if (!map->identity) {
+ if (map->info.table == NULL) {
+ return (-1);
+ }
+ }
+ if (srcfmt->BitsPerPixel != dstfmt->BitsPerPixel)
+ map->identity = 0;
+ } else {
+ /* Palette --> BitField */
+ map->info.table =
+ Map1toN(srcfmt, src->map->info.r, src->map->info.g,
+ src->map->info.b, src->map->info.a, dstfmt);
+ if (map->info.table == NULL) {
+ return (-1);
+ }
+ }
+ } else {
+ if (SDL_ISPIXELFORMAT_INDEXED(dstfmt->format)) {
+ /* BitField --> Palette */
+ map->info.table = MapNto1(srcfmt, dstfmt, &map->identity);
+ if (!map->identity) {
+ if (map->info.table == NULL) {
+ return (-1);
+ }
+ }
+ map->identity = 0; /* Don't optimize to copy */
+ } else {
+ /* BitField --> BitField */
+ if (srcfmt == dstfmt) {
+ map->identity = 1;
+ }
+ }
+ }
+
+ map->dst = dst;
+
+ if (map->dst) {
+ /* Keep a reference to this surface so it doesn't get deleted
+ while we're still pointing at it.
+
+ A better method would be for the destination surface to keep
+ track of surfaces that are mapped to it and automatically
+ invalidate them when it is freed, but this will do for now.
+ */
+ ++map->dst->refcount;
+ }
+
+ if (dstfmt->palette) {
+ map->dst_palette_version = dstfmt->palette->version;
+ } else {
+ map->dst_palette_version = 0;
+ }
+
+ if (srcfmt->palette) {
+ map->src_palette_version = srcfmt->palette->version;
+ } else {
+ map->src_palette_version = 0;
+ }
+
+ /* Choose your blitters wisely */
+ return (SDL_CalculateBlit(src));
+}
+
+void
+SDL_FreeBlitMap(SDL_BlitMap * map)
+{
+ if (map) {
+ SDL_InvalidateMap(map);
+ SDL_free(map);
+ }
+}
+
+void
+SDL_CalculateGammaRamp(float gamma, Uint16 * ramp)
+{
+ int i;
+
+ /* Input validation */
+ if (gamma < 0.0f ) {
+ SDL_InvalidParamError("gamma");
+ return;
+ }
+ if (ramp == NULL) {
+ SDL_InvalidParamError("ramp");
+ return;
+ }
+
+ /* 0.0 gamma is all black */
+ if (gamma == 0.0f) {
+ SDL_memset(ramp, 0, 256 * sizeof(Uint16));
+ return;
+ } else if (gamma == 1.0f) {
+ /* 1.0 gamma is identity */
+ for (i = 0; i < 256; ++i) {
+ ramp[i] = (i << 8) | i;
+ }
+ return;
+ } else {
+ /* Calculate a real gamma ramp */
+ int value;
+ gamma = 1.0f / gamma;
+ for (i = 0; i < 256; ++i) {
+ value =
+ (int) (SDL_pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
+ if (value > 65535) {
+ value = 65535;
+ }
+ ramp[i] = (Uint16) value;
+ }
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_pixels_c.h b/src/3rdparty/SDL2/src/video/SDL_pixels_c.h
new file mode 100644
index 0000000..900f0b0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_pixels_c.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* Useful functions and variables from SDL_pixel.c */
+
+#include "SDL_blit.h"
+
+/* Pixel format functions */
+extern int SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format);
+
+/* Blit mapping functions */
+extern SDL_BlitMap *SDL_AllocBlitMap(void);
+extern void SDL_InvalidateMap(SDL_BlitMap * map);
+extern int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst);
+extern void SDL_FreeBlitMap(SDL_BlitMap * map);
+
+/* Miscellaneous functions */
+extern void SDL_DitherColors(SDL_Color * colors, int bpp);
+extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_rect.c b/src/3rdparty/SDL2/src/video/SDL_rect.c
new file mode 100644
index 0000000..8c6ff2d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_rect.c
@@ -0,0 +1,531 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_rect.h"
+#include "SDL_rect_c.h"
+#include "SDL_assert.h"
+
+SDL_bool
+SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B)
+{
+ int Amin, Amax, Bmin, Bmax;
+
+ if (!A) {
+ SDL_InvalidParamError("A");
+ return SDL_FALSE;
+ }
+
+ if (!B) {
+ SDL_InvalidParamError("B");
+ return SDL_FALSE;
+ }
+
+ /* Special cases for empty rects */
+ if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) {
+ return SDL_FALSE;
+ }
+
+ /* Horizontal intersection */
+ Amin = A->x;
+ Amax = Amin + A->w;
+ Bmin = B->x;
+ Bmax = Bmin + B->w;
+ if (Bmin > Amin)
+ Amin = Bmin;
+ if (Bmax < Amax)
+ Amax = Bmax;
+ if (Amax <= Amin)
+ return SDL_FALSE;
+
+ /* Vertical intersection */
+ Amin = A->y;
+ Amax = Amin + A->h;
+ Bmin = B->y;
+ Bmax = Bmin + B->h;
+ if (Bmin > Amin)
+ Amin = Bmin;
+ if (Bmax < Amax)
+ Amax = Bmax;
+ if (Amax <= Amin)
+ return SDL_FALSE;
+
+ return SDL_TRUE;
+}
+
+SDL_bool
+SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
+{
+ int Amin, Amax, Bmin, Bmax;
+
+ if (!A) {
+ SDL_InvalidParamError("A");
+ return SDL_FALSE;
+ }
+
+ if (!B) {
+ SDL_InvalidParamError("B");
+ return SDL_FALSE;
+ }
+
+ if (!result) {
+ SDL_InvalidParamError("result");
+ return SDL_FALSE;
+ }
+
+ /* Special cases for empty rects */
+ if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) {
+ result->w = 0;
+ result->h = 0;
+ return SDL_FALSE;
+ }
+
+ /* Horizontal intersection */
+ Amin = A->x;
+ Amax = Amin + A->w;
+ Bmin = B->x;
+ Bmax = Bmin + B->w;
+ if (Bmin > Amin)
+ Amin = Bmin;
+ result->x = Amin;
+ if (Bmax < Amax)
+ Amax = Bmax;
+ result->w = Amax - Amin;
+
+ /* Vertical intersection */
+ Amin = A->y;
+ Amax = Amin + A->h;
+ Bmin = B->y;
+ Bmax = Bmin + B->h;
+ if (Bmin > Amin)
+ Amin = Bmin;
+ result->y = Amin;
+ if (Bmax < Amax)
+ Amax = Bmax;
+ result->h = Amax - Amin;
+
+ return !SDL_RectEmpty(result);
+}
+
+void
+SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
+{
+ int Amin, Amax, Bmin, Bmax;
+
+ if (!A) {
+ SDL_InvalidParamError("A");
+ return;
+ }
+
+ if (!B) {
+ SDL_InvalidParamError("B");
+ return;
+ }
+
+ if (!result) {
+ SDL_InvalidParamError("result");
+ return;
+ }
+
+ /* Special cases for empty Rects */
+ if (SDL_RectEmpty(A)) {
+ if (SDL_RectEmpty(B)) {
+ /* A and B empty */
+ return;
+ } else {
+ /* A empty, B not empty */
+ *result = *B;
+ return;
+ }
+ } else {
+ if (SDL_RectEmpty(B)) {
+ /* A not empty, B empty */
+ *result = *A;
+ return;
+ }
+ }
+
+ /* Horizontal union */
+ Amin = A->x;
+ Amax = Amin + A->w;
+ Bmin = B->x;
+ Bmax = Bmin + B->w;
+ if (Bmin < Amin)
+ Amin = Bmin;
+ result->x = Amin;
+ if (Bmax > Amax)
+ Amax = Bmax;
+ result->w = Amax - Amin;
+
+ /* Vertical union */
+ Amin = A->y;
+ Amax = Amin + A->h;
+ Bmin = B->y;
+ Bmax = Bmin + B->h;
+ if (Bmin < Amin)
+ Amin = Bmin;
+ result->y = Amin;
+ if (Bmax > Amax)
+ Amax = Bmax;
+ result->h = Amax - Amin;
+}
+
+SDL_bool
+SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
+ SDL_Rect * result)
+{
+ int minx = 0;
+ int miny = 0;
+ int maxx = 0;
+ int maxy = 0;
+ int x, y, i;
+
+ if (!points) {
+ SDL_InvalidParamError("points");
+ return SDL_FALSE;
+ }
+
+ if (count < 1) {
+ SDL_InvalidParamError("count");
+ return SDL_FALSE;
+ }
+
+ if (clip) {
+ SDL_bool added = SDL_FALSE;
+ const int clip_minx = clip->x;
+ const int clip_miny = clip->y;
+ const int clip_maxx = clip->x+clip->w-1;
+ const int clip_maxy = clip->y+clip->h-1;
+
+ /* Special case for empty rectangle */
+ if (SDL_RectEmpty(clip)) {
+ return SDL_FALSE;
+ }
+
+ for (i = 0; i < count; ++i) {
+ x = points[i].x;
+ y = points[i].y;
+
+ if (x < clip_minx || x > clip_maxx ||
+ y < clip_miny || y > clip_maxy) {
+ continue;
+ }
+ if (!added) {
+ /* Special case: if no result was requested, we are done */
+ if (result == NULL) {
+ return SDL_TRUE;
+ }
+
+ /* First point added */
+ minx = maxx = x;
+ miny = maxy = y;
+ added = SDL_TRUE;
+ continue;
+ }
+ if (x < minx) {
+ minx = x;
+ } else if (x > maxx) {
+ maxx = x;
+ }
+ if (y < miny) {
+ miny = y;
+ } else if (y > maxy) {
+ maxy = y;
+ }
+ }
+ if (!added) {
+ return SDL_FALSE;
+ }
+ } else {
+ /* Special case: if no result was requested, we are done */
+ if (result == NULL) {
+ return SDL_TRUE;
+ }
+
+ /* No clipping, always add the first point */
+ minx = maxx = points[0].x;
+ miny = maxy = points[0].y;
+
+ for (i = 1; i < count; ++i) {
+ x = points[i].x;
+ y = points[i].y;
+
+ if (x < minx) {
+ minx = x;
+ } else if (x > maxx) {
+ maxx = x;
+ }
+ if (y < miny) {
+ miny = y;
+ } else if (y > maxy) {
+ maxy = y;
+ }
+ }
+ }
+
+ if (result) {
+ result->x = minx;
+ result->y = miny;
+ result->w = (maxx-minx)+1;
+ result->h = (maxy-miny)+1;
+ }
+ return SDL_TRUE;
+}
+
+/* Use the Cohen-Sutherland algorithm for line clipping */
+#define CODE_BOTTOM 1
+#define CODE_TOP 2
+#define CODE_LEFT 4
+#define CODE_RIGHT 8
+
+static int
+ComputeOutCode(const SDL_Rect * rect, int x, int y)
+{
+ int code = 0;
+ if (y < rect->y) {
+ code |= CODE_TOP;
+ } else if (y >= rect->y + rect->h) {
+ code |= CODE_BOTTOM;
+ }
+ if (x < rect->x) {
+ code |= CODE_LEFT;
+ } else if (x >= rect->x + rect->w) {
+ code |= CODE_RIGHT;
+ }
+ return code;
+}
+
+SDL_bool
+SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2,
+ int *Y2)
+{
+ int x = 0;
+ int y = 0;
+ int x1, y1;
+ int x2, y2;
+ int rectx1;
+ int recty1;
+ int rectx2;
+ int recty2;
+ int outcode1, outcode2;
+
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return SDL_FALSE;
+ }
+
+ if (!X1) {
+ SDL_InvalidParamError("X1");
+ return SDL_FALSE;
+ }
+
+ if (!Y1) {
+ SDL_InvalidParamError("Y1");
+ return SDL_FALSE;
+ }
+
+ if (!X2) {
+ SDL_InvalidParamError("X2");
+ return SDL_FALSE;
+ }
+
+ if (!Y2) {
+ SDL_InvalidParamError("Y2");
+ return SDL_FALSE;
+ }
+
+ /* Special case for empty rect */
+ if (SDL_RectEmpty(rect)) {
+ return SDL_FALSE;
+ }
+
+ x1 = *X1;
+ y1 = *Y1;
+ x2 = *X2;
+ y2 = *Y2;
+ rectx1 = rect->x;
+ recty1 = rect->y;
+ rectx2 = rect->x + rect->w - 1;
+ recty2 = rect->y + rect->h - 1;
+
+ /* Check to see if entire line is inside rect */
+ if (x1 >= rectx1 && x1 <= rectx2 && x2 >= rectx1 && x2 <= rectx2 &&
+ y1 >= recty1 && y1 <= recty2 && y2 >= recty1 && y2 <= recty2) {
+ return SDL_TRUE;
+ }
+
+ /* Check to see if entire line is to one side of rect */
+ if ((x1 < rectx1 && x2 < rectx1) || (x1 > rectx2 && x2 > rectx2) ||
+ (y1 < recty1 && y2 < recty1) || (y1 > recty2 && y2 > recty2)) {
+ return SDL_FALSE;
+ }
+
+ if (y1 == y2) {
+ /* Horizontal line, easy to clip */
+ if (x1 < rectx1) {
+ *X1 = rectx1;
+ } else if (x1 > rectx2) {
+ *X1 = rectx2;
+ }
+ if (x2 < rectx1) {
+ *X2 = rectx1;
+ } else if (x2 > rectx2) {
+ *X2 = rectx2;
+ }
+ return SDL_TRUE;
+ }
+
+ if (x1 == x2) {
+ /* Vertical line, easy to clip */
+ if (y1 < recty1) {
+ *Y1 = recty1;
+ } else if (y1 > recty2) {
+ *Y1 = recty2;
+ }
+ if (y2 < recty1) {
+ *Y2 = recty1;
+ } else if (y2 > recty2) {
+ *Y2 = recty2;
+ }
+ return SDL_TRUE;
+ }
+
+ /* More complicated Cohen-Sutherland algorithm */
+ outcode1 = ComputeOutCode(rect, x1, y1);
+ outcode2 = ComputeOutCode(rect, x2, y2);
+ while (outcode1 || outcode2) {
+ if (outcode1 & outcode2) {
+ return SDL_FALSE;
+ }
+
+ if (outcode1) {
+ if (outcode1 & CODE_TOP) {
+ y = recty1;
+ x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1);
+ } else if (outcode1 & CODE_BOTTOM) {
+ y = recty2;
+ x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1);
+ } else if (outcode1 & CODE_LEFT) {
+ x = rectx1;
+ y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1);
+ } else if (outcode1 & CODE_RIGHT) {
+ x = rectx2;
+ y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1);
+ }
+ x1 = x;
+ y1 = y;
+ outcode1 = ComputeOutCode(rect, x, y);
+ } else {
+ if (outcode2 & CODE_TOP) {
+ y = recty1;
+ x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1);
+ } else if (outcode2 & CODE_BOTTOM) {
+ y = recty2;
+ x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1);
+ } else if (outcode2 & CODE_LEFT) {
+ /* If this assertion ever fires, here's the static analysis that warned about it:
+ http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */
+ SDL_assert(x2 != x1); /* if equal: division by zero. */
+ x = rectx1;
+ y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1);
+ } else if (outcode2 & CODE_RIGHT) {
+ /* If this assertion ever fires, here's the static analysis that warned about it:
+ http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */
+ SDL_assert(x2 != x1); /* if equal: division by zero. */
+ x = rectx2;
+ y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1);
+ }
+ x2 = x;
+ y2 = y;
+ outcode2 = ComputeOutCode(rect, x, y);
+ }
+ }
+ *X1 = x1;
+ *Y1 = y1;
+ *X2 = x2;
+ *Y2 = y2;
+ return SDL_TRUE;
+}
+
+SDL_bool
+SDL_GetSpanEnclosingRect(int width, int height,
+ int numrects, const SDL_Rect * rects, SDL_Rect *span)
+{
+ int i;
+ int span_y1, span_y2;
+ int rect_y1, rect_y2;
+
+ if (width < 1) {
+ SDL_InvalidParamError("width");
+ return SDL_FALSE;
+ }
+
+ if (height < 1) {
+ SDL_InvalidParamError("height");
+ return SDL_FALSE;
+ }
+
+ if (!rects) {
+ SDL_InvalidParamError("rects");
+ return SDL_FALSE;
+ }
+
+ if (!span) {
+ SDL_InvalidParamError("span");
+ return SDL_FALSE;
+ }
+
+ if (numrects < 1) {
+ SDL_InvalidParamError("numrects");
+ return SDL_FALSE;
+ }
+
+ /* Initialize to empty rect */
+ span_y1 = height;
+ span_y2 = 0;
+
+ for (i = 0; i < numrects; ++i) {
+ rect_y1 = rects[i].y;
+ rect_y2 = rect_y1 + rects[i].h;
+
+ /* Clip out of bounds rectangles, and expand span rect */
+ if (rect_y1 < 0) {
+ span_y1 = 0;
+ } else if (rect_y1 < span_y1) {
+ span_y1 = rect_y1;
+ }
+ if (rect_y2 > height) {
+ span_y2 = height;
+ } else if (rect_y2 > span_y2) {
+ span_y2 = rect_y2;
+ }
+ }
+ if (span_y2 > span_y1) {
+ span->x = 0;
+ span->y = span_y1;
+ span->w = width;
+ span->h = (span_y2 - span_y1);
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_rect_c.h b/src/3rdparty/SDL2/src/video/SDL_rect_c.h
new file mode 100644
index 0000000..d67e493
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_rect_c.h
@@ -0,0 +1,25 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+extern SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect * rects, SDL_Rect *span);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_shape.c b/src/3rdparty/SDL2/src/video/SDL_shape.c
new file mode 100644
index 0000000..6f029bc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_shape.c
@@ -0,0 +1,309 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL.h"
+#include "SDL_assert.h"
+#include "SDL_video.h"
+#include "SDL_sysvideo.h"
+#include "SDL_pixels.h"
+#include "SDL_surface.h"
+#include "SDL_shape.h"
+#include "SDL_shape_internals.h"
+
+SDL_Window*
+SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags)
+{
+ SDL_Window *result = NULL;
+ result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */);
+ if(result != NULL) {
+ if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) {
+ SDL_DestroyWindow(result);
+ return NULL;
+ }
+ result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result);
+ if(result->shaper != NULL) {
+ result->shaper->userx = x;
+ result->shaper->usery = y;
+ result->shaper->mode.mode = ShapeModeDefault;
+ result->shaper->mode.parameters.binarizationCutoff = 1;
+ result->shaper->hasshape = SDL_FALSE;
+ return result;
+ }
+ else {
+ SDL_DestroyWindow(result);
+ return NULL;
+ }
+ }
+ else
+ return NULL;
+}
+
+SDL_bool
+SDL_IsShapedWindow(const SDL_Window *window)
+{
+ if(window == NULL)
+ return SDL_FALSE;
+ else
+ return (SDL_bool)(window->shaper != NULL);
+}
+
+/* REQUIRES that bitmap point to a w-by-h bitmap with ppb pixels-per-byte. */
+void
+SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb)
+{
+ int x = 0;
+ int y = 0;
+ Uint8 r = 0,g = 0,b = 0,alpha = 0;
+ Uint8* pixel = NULL;
+ Uint32 pixel_value = 0,mask_value = 0;
+ int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb;
+ Uint8 *bitmap_scanline;
+ SDL_Color key;
+ if(SDL_MUSTLOCK(shape))
+ SDL_LockSurface(shape);
+ for(y = 0;y<shape->h;y++) {
+ bitmap_scanline = bitmap + y * bytes_per_scanline;
+ for(x=0;x<shape->w;x++) {
+ alpha = 0;
+ pixel_value = 0;
+ pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
+ switch(shape->format->BytesPerPixel) {
+ case(1):
+ pixel_value = *(Uint8*)pixel;
+ break;
+ case(2):
+ pixel_value = *(Uint16*)pixel;
+ break;
+ case(3):
+ pixel_value = *(Uint32*)pixel & (~shape->format->Amask);
+ break;
+ case(4):
+ pixel_value = *(Uint32*)pixel;
+ break;
+ }
+ SDL_GetRGBA(pixel_value,shape->format,&r,&g,&b,&alpha);
+ switch(mode.mode) {
+ case(ShapeModeDefault):
+ mask_value = (alpha >= 1 ? 1 : 0);
+ break;
+ case(ShapeModeBinarizeAlpha):
+ mask_value = (alpha >= mode.parameters.binarizationCutoff ? 1 : 0);
+ break;
+ case(ShapeModeReverseBinarizeAlpha):
+ mask_value = (alpha <= mode.parameters.binarizationCutoff ? 1 : 0);
+ break;
+ case(ShapeModeColorKey):
+ key = mode.parameters.colorKey;
+ mask_value = ((key.r != r || key.g != g || key.b != b) ? 1 : 0);
+ break;
+ }
+ bitmap_scanline[x / ppb] |= mask_value << (x % ppb);
+ }
+ }
+ if(SDL_MUSTLOCK(shape))
+ SDL_UnlockSurface(shape);
+}
+
+static SDL_ShapeTree*
+RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rect dimensions) {
+ int x = 0,y = 0;
+ Uint8* pixel = NULL;
+ Uint32 pixel_value = 0;
+ Uint8 r = 0,g = 0,b = 0,a = 0;
+ SDL_bool pixel_opaque = SDL_FALSE;
+ int last_opaque = -1;
+ SDL_Color key;
+ SDL_ShapeTree* result = (SDL_ShapeTree*)SDL_malloc(sizeof(SDL_ShapeTree));
+ SDL_Rect next = {0,0,0,0};
+
+ for(y=dimensions.y;y<dimensions.y + dimensions.h;y++) {
+ for(x=dimensions.x;x<dimensions.x + dimensions.w;x++) {
+ pixel_value = 0;
+ pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
+ switch(mask->format->BytesPerPixel) {
+ case(1):
+ pixel_value = *(Uint8*)pixel;
+ break;
+ case(2):
+ pixel_value = *(Uint16*)pixel;
+ break;
+ case(3):
+ pixel_value = *(Uint32*)pixel & (~mask->format->Amask);
+ break;
+ case(4):
+ pixel_value = *(Uint32*)pixel;
+ break;
+ }
+ SDL_GetRGBA(pixel_value,mask->format,&r,&g,&b,&a);
+ switch(mode.mode) {
+ case(ShapeModeDefault):
+ pixel_opaque = (a >= 1 ? SDL_TRUE : SDL_FALSE);
+ break;
+ case(ShapeModeBinarizeAlpha):
+ pixel_opaque = (a >= mode.parameters.binarizationCutoff ? SDL_TRUE : SDL_FALSE);
+ break;
+ case(ShapeModeReverseBinarizeAlpha):
+ pixel_opaque = (a <= mode.parameters.binarizationCutoff ? SDL_TRUE : SDL_FALSE);
+ break;
+ case(ShapeModeColorKey):
+ key = mode.parameters.colorKey;
+ pixel_opaque = ((key.r != r || key.g != g || key.b != b) ? SDL_TRUE : SDL_FALSE);
+ break;
+ }
+ if(last_opaque == -1)
+ last_opaque = pixel_opaque;
+ if(last_opaque != pixel_opaque) {
+ const int halfwidth = dimensions.w / 2;
+ const int halfheight = dimensions.h / 2;
+
+ result->kind = QuadShape;
+
+ next.x = dimensions.x;
+ next.y = dimensions.y;
+ next.w = halfwidth;
+ next.h = halfheight;
+ result->data.children.upleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
+
+ next.x = dimensions.x + halfwidth;
+ next.w = dimensions.w - halfwidth;
+ result->data.children.upright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
+
+ next.x = dimensions.x;
+ next.w = halfwidth;
+ next.y = dimensions.y + halfheight;
+ next.h = dimensions.h - halfheight;
+ result->data.children.downleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
+
+ next.x = dimensions.x + halfwidth;
+ next.w = dimensions.w - halfwidth;
+ result->data.children.downright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
+
+ return result;
+ }
+ }
+ }
+
+
+ /* If we never recursed, all the pixels in this quadrant have the same "value". */
+ result->kind = (last_opaque == SDL_TRUE ? OpaqueShape : TransparentShape);
+ result->data.shape = dimensions;
+ return result;
+}
+
+SDL_ShapeTree*
+SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape)
+{
+ SDL_Rect dimensions;
+ SDL_ShapeTree* result = NULL;
+
+ dimensions.x = 0;
+ dimensions.y = 0;
+ dimensions.w = shape->w;
+ dimensions.h = shape->h;
+
+ if(SDL_MUSTLOCK(shape))
+ SDL_LockSurface(shape);
+ result = RecursivelyCalculateShapeTree(mode,shape,dimensions);
+ if(SDL_MUSTLOCK(shape))
+ SDL_UnlockSurface(shape);
+ return result;
+}
+
+void
+SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure)
+{
+ SDL_assert(tree != NULL);
+ if(tree->kind == QuadShape) {
+ SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft,function,closure);
+ SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upright,function,closure);
+ SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.downleft,function,closure);
+ SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.downright,function,closure);
+ }
+ else
+ function(tree,closure);
+}
+
+void
+SDL_FreeShapeTree(SDL_ShapeTree** shape_tree)
+{
+ if((*shape_tree)->kind == QuadShape) {
+ SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upleft);
+ SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upright);
+ SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downleft);
+ SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downright);
+ }
+ SDL_free(*shape_tree);
+ *shape_tree = NULL;
+}
+
+int
+SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode)
+{
+ int result;
+ if(window == NULL || !SDL_IsShapedWindow(window))
+ /* The window given was not a shapeable window. */
+ return SDL_NONSHAPEABLE_WINDOW;
+ if(shape == NULL)
+ /* Invalid shape argument. */
+ return SDL_INVALID_SHAPE_ARGUMENT;
+
+ if(shape_mode != NULL)
+ window->shaper->mode = *shape_mode;
+ result = SDL_GetVideoDevice()->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
+ window->shaper->hasshape = SDL_TRUE;
+ if(window->shaper->userx != 0 && window->shaper->usery != 0) {
+ SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery);
+ window->shaper->userx = 0;
+ window->shaper->usery = 0;
+ }
+ return result;
+}
+
+static SDL_bool
+SDL_WindowHasAShape(SDL_Window *window)
+{
+ if (window == NULL || !SDL_IsShapedWindow(window))
+ return SDL_FALSE;
+ return window->shaper->hasshape;
+}
+
+int
+SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode)
+{
+ if(window != NULL && SDL_IsShapedWindow(window)) {
+ if(shape_mode == NULL) {
+ if(SDL_WindowHasAShape(window))
+ /* The window given has a shape. */
+ return 0;
+ else
+ /* The window given is shapeable but lacks a shape. */
+ return SDL_WINDOW_LACKS_SHAPE;
+ }
+ else {
+ *shape_mode = window->shaper->mode;
+ return 0;
+ }
+ }
+ else
+ /* The window given is not a valid shapeable window. */
+ return SDL_NONSHAPEABLE_WINDOW;
+}
diff --git a/src/3rdparty/SDL2/src/video/SDL_shape_internals.h b/src/3rdparty/SDL2/src/video/SDL_shape_internals.h
new file mode 100644
index 0000000..3af175c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_shape_internals.h
@@ -0,0 +1,69 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_shape_internals_h_
+#define SDL_shape_internals_h_
+
+#include "SDL_rect.h"
+#include "SDL_shape.h"
+#include "SDL_surface.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+typedef struct {
+ struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
+} SDL_QuadTreeChildren;
+
+typedef union {
+ SDL_QuadTreeChildren children;
+ SDL_Rect shape;
+} SDL_ShapeUnion;
+
+typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind;
+
+typedef struct {
+ SDL_ShapeKind kind;
+ SDL_ShapeUnion data;
+} SDL_ShapeTree;
+
+typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*);
+
+extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb);
+extern SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape);
+extern void SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure);
+extern void SDL_FreeShapeTree(SDL_ShapeTree** shape_tree);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/SDL_stretch.c b/src/3rdparty/SDL2/src/video/SDL_stretch.c
new file mode 100644
index 0000000..8cc6bf3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_stretch.c
@@ -0,0 +1,353 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* This a stretch blit implementation based on ideas given to me by
+ Tomasz Cejner - thanks! :)
+
+ April 27, 2000 - Sam Lantinga
+*/
+
+#include "SDL_video.h"
+#include "SDL_blit.h"
+
+/* This isn't ready for general consumption yet - it should be folded
+ into the general blitting mechanism.
+*/
+
+#if ((defined(_MSC_VER) && defined(_M_IX86)) || \
+ (defined(__WATCOMC__) && defined(__386__)) || \
+ (defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES
+/* There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct
+ * value after the first scanline. FIXME? */
+/* #define USE_ASM_STRETCH */
+#endif
+
+#ifdef USE_ASM_STRETCH
+
+#ifdef HAVE_MPROTECT
+#include <sys/types.h>
+#include <sys/mman.h>
+#endif
+#ifdef __GNUC__
+#define PAGE_ALIGNED __attribute__((__aligned__(4096)))
+#else
+#define PAGE_ALIGNED
+#endif
+
+#if defined(_M_IX86) || defined(__i386__) || defined(__386__)
+#define PREFIX16 0x66
+#define STORE_BYTE 0xAA
+#define STORE_WORD 0xAB
+#define LOAD_BYTE 0xAC
+#define LOAD_WORD 0xAD
+#define RETURN 0xC3
+#else
+#error Need assembly opcodes for this architecture
+#endif
+
+static unsigned char copy_row[4096] PAGE_ALIGNED;
+
+static int
+generate_rowbytes(int src_w, int dst_w, int bpp)
+{
+ static struct
+ {
+ int bpp;
+ int src_w;
+ int dst_w;
+ int status;
+ } last;
+
+ int i;
+ int pos, inc;
+ unsigned char *eip, *fence;
+ unsigned char load, store;
+
+ /* See if we need to regenerate the copy buffer */
+ if ((src_w == last.src_w) && (dst_w == last.dst_w) && (bpp == last.bpp)) {
+ return (last.status);
+ }
+ last.bpp = bpp;
+ last.src_w = src_w;
+ last.dst_w = dst_w;
+ last.status = -1;
+
+ switch (bpp) {
+ case 1:
+ load = LOAD_BYTE;
+ store = STORE_BYTE;
+ break;
+ case 2:
+ case 4:
+ load = LOAD_WORD;
+ store = STORE_WORD;
+ break;
+ default:
+ return SDL_SetError("ASM stretch of %d bytes isn't supported", bpp);
+ }
+#ifdef HAVE_MPROTECT
+ /* Make the code writeable */
+ if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_WRITE) < 0) {
+ return SDL_SetError("Couldn't make copy buffer writeable");
+ }
+#endif
+ pos = 0x10000;
+ inc = (src_w << 16) / dst_w;
+ eip = copy_row;
+ fence = copy_row + sizeof(copy_row)-2;
+ for (i = 0; i < dst_w; ++i) {
+ while (pos >= 0x10000L) {
+ if (eip == fence) {
+ return -1;
+ }
+ if (bpp == 2) {
+ *eip++ = PREFIX16;
+ }
+ *eip++ = load;
+ pos -= 0x10000L;
+ }
+ if (eip == fence) {
+ return -1;
+ }
+ if (bpp == 2) {
+ *eip++ = PREFIX16;
+ }
+ *eip++ = store;
+ pos += inc;
+ }
+ *eip++ = RETURN;
+
+#ifdef HAVE_MPROTECT
+ /* Make the code executable but not writeable */
+ if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_EXEC) < 0) {
+ return SDL_SetError("Couldn't make copy buffer executable");
+ }
+#endif
+ last.status = 0;
+ return (0);
+}
+
+#endif /* USE_ASM_STRETCH */
+
+#define DEFINE_COPY_ROW(name, type) \
+static void name(type *src, int src_w, type *dst, int dst_w) \
+{ \
+ int i; \
+ int pos, inc; \
+ type pixel = 0; \
+ \
+ pos = 0x10000; \
+ inc = (src_w << 16) / dst_w; \
+ for ( i=dst_w; i>0; --i ) { \
+ while ( pos >= 0x10000L ) { \
+ pixel = *src++; \
+ pos -= 0x10000L; \
+ } \
+ *dst++ = pixel; \
+ pos += inc; \
+ } \
+}
+/* *INDENT-OFF* */
+DEFINE_COPY_ROW(copy_row1, Uint8)
+DEFINE_COPY_ROW(copy_row2, Uint16)
+DEFINE_COPY_ROW(copy_row4, Uint32)
+/* *INDENT-ON* */
+
+/* The ASM code doesn't handle 24-bpp stretch blits */
+static void
+copy_row3(Uint8 * src, int src_w, Uint8 * dst, int dst_w)
+{
+ int i;
+ int pos, inc;
+ Uint8 pixel[3] = { 0, 0, 0 };
+
+ pos = 0x10000;
+ inc = (src_w << 16) / dst_w;
+ for (i = dst_w; i > 0; --i) {
+ while (pos >= 0x10000L) {
+ pixel[0] = *src++;
+ pixel[1] = *src++;
+ pixel[2] = *src++;
+ pos -= 0x10000L;
+ }
+ *dst++ = pixel[0];
+ *dst++ = pixel[1];
+ *dst++ = pixel[2];
+ pos += inc;
+ }
+}
+
+/* Perform a stretch blit between two surfaces of the same format.
+ NOTE: This function is not safe to call from multiple threads!
+*/
+int
+SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, const SDL_Rect * dstrect)
+{
+ int src_locked;
+ int dst_locked;
+ int pos, inc;
+ int dst_maxrow;
+ int src_row, dst_row;
+ Uint8 *srcp = NULL;
+ Uint8 *dstp;
+ SDL_Rect full_src;
+ SDL_Rect full_dst;
+#ifdef USE_ASM_STRETCH
+ SDL_bool use_asm = SDL_TRUE;
+#ifdef __GNUC__
+ int u1, u2;
+#endif
+#endif /* USE_ASM_STRETCH */
+ const int bpp = dst->format->BytesPerPixel;
+
+ if (src->format->format != dst->format->format) {
+ return SDL_SetError("Only works with same format surfaces");
+ }
+
+ /* Verify the blit rectangles */
+ if (srcrect) {
+ if ((srcrect->x < 0) || (srcrect->y < 0) ||
+ ((srcrect->x + srcrect->w) > src->w) ||
+ ((srcrect->y + srcrect->h) > src->h)) {
+ return SDL_SetError("Invalid source blit rectangle");
+ }
+ } else {
+ full_src.x = 0;
+ full_src.y = 0;
+ full_src.w = src->w;
+ full_src.h = src->h;
+ srcrect = &full_src;
+ }
+ if (dstrect) {
+ if ((dstrect->x < 0) || (dstrect->y < 0) ||
+ ((dstrect->x + dstrect->w) > dst->w) ||
+ ((dstrect->y + dstrect->h) > dst->h)) {
+ return SDL_SetError("Invalid destination blit rectangle");
+ }
+ } else {
+ full_dst.x = 0;
+ full_dst.y = 0;
+ full_dst.w = dst->w;
+ full_dst.h = dst->h;
+ dstrect = &full_dst;
+ }
+
+ /* Lock the destination if it's in hardware */
+ dst_locked = 0;
+ if (SDL_MUSTLOCK(dst)) {
+ if (SDL_LockSurface(dst) < 0) {
+ return SDL_SetError("Unable to lock destination surface");
+ }
+ dst_locked = 1;
+ }
+ /* Lock the source if it's in hardware */
+ src_locked = 0;
+ if (SDL_MUSTLOCK(src)) {
+ if (SDL_LockSurface(src) < 0) {
+ if (dst_locked) {
+ SDL_UnlockSurface(dst);
+ }
+ return SDL_SetError("Unable to lock source surface");
+ }
+ src_locked = 1;
+ }
+
+ /* Set up the data... */
+ pos = 0x10000;
+ inc = (srcrect->h << 16) / dstrect->h;
+ src_row = srcrect->y;
+ dst_row = dstrect->y;
+
+#ifdef USE_ASM_STRETCH
+ /* Write the opcodes for this stretch */
+ if ((bpp == 3) || (generate_rowbytes(srcrect->w, dstrect->w, bpp) < 0)) {
+ use_asm = SDL_FALSE;
+ }
+#endif
+
+ /* Perform the stretch blit */
+ for (dst_maxrow = dst_row + dstrect->h; dst_row < dst_maxrow; ++dst_row) {
+ dstp = (Uint8 *) dst->pixels + (dst_row * dst->pitch)
+ + (dstrect->x * bpp);
+ while (pos >= 0x10000L) {
+ srcp = (Uint8 *) src->pixels + (src_row * src->pitch)
+ + (srcrect->x * bpp);
+ ++src_row;
+ pos -= 0x10000L;
+ }
+#ifdef USE_ASM_STRETCH
+ if (use_asm) {
+#ifdef __GNUC__
+ __asm__ __volatile__("call *%4":"=&D"(u1), "=&S"(u2)
+ :"0"(dstp), "1"(srcp), "r"(copy_row)
+ :"memory");
+#elif defined(_MSC_VER) || defined(__WATCOMC__)
+ /* *INDENT-OFF* */
+ {
+ void *code = copy_row;
+ __asm {
+ push edi
+ push esi
+ mov edi, dstp
+ mov esi, srcp
+ call dword ptr code
+ pop esi
+ pop edi
+ }
+ }
+ /* *INDENT-ON* */
+#else
+#error Need inline assembly for this compiler
+#endif
+ } else
+#endif
+ switch (bpp) {
+ case 1:
+ copy_row1(srcp, srcrect->w, dstp, dstrect->w);
+ break;
+ case 2:
+ copy_row2((Uint16 *) srcp, srcrect->w,
+ (Uint16 *) dstp, dstrect->w);
+ break;
+ case 3:
+ copy_row3(srcp, srcrect->w, dstp, dstrect->w);
+ break;
+ case 4:
+ copy_row4((Uint32 *) srcp, srcrect->w,
+ (Uint32 *) dstp, dstrect->w);
+ break;
+ }
+ pos += inc;
+ }
+
+ /* We need to unlock the surfaces if they're locked */
+ if (dst_locked) {
+ SDL_UnlockSurface(dst);
+ }
+ if (src_locked) {
+ SDL_UnlockSurface(src);
+ }
+ return (0);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_surface.c b/src/3rdparty/SDL2/src/video/SDL_surface.c
new file mode 100644
index 0000000..719f831
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_surface.c
@@ -0,0 +1,1232 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_video.h"
+#include "SDL_sysvideo.h"
+#include "SDL_blit.h"
+#include "SDL_RLEaccel_c.h"
+#include "SDL_pixels_c.h"
+#include "SDL_yuv_c.h"
+
+
+/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
+SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
+ sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32));
+
+/* Public routines */
+
+/*
+ * Calculate the pad-aligned scanline width of a surface
+ */
+int
+SDL_CalculatePitch(Uint32 format, int width)
+{
+ int pitch;
+
+ /* Surface should be 4-byte aligned for speed */
+ pitch = width * SDL_BYTESPERPIXEL(format);
+ switch (SDL_BITSPERPIXEL(format)) {
+ case 1:
+ pitch = (pitch + 7) / 8;
+ break;
+ case 4:
+ pitch = (pitch + 1) / 2;
+ break;
+ default:
+ break;
+ }
+ pitch = (pitch + 3) & ~3; /* 4-byte aligning */
+ return pitch;
+}
+
+/*
+ * Create an empty RGB surface of the appropriate depth using the given
+ * enum SDL_PIXELFORMAT_* format
+ */
+SDL_Surface *
+SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
+ Uint32 format)
+{
+ SDL_Surface *surface;
+
+ /* The flags are no longer used, make the compiler happy */
+ (void)flags;
+
+ /* Allocate the surface */
+ surface = (SDL_Surface *) SDL_calloc(1, sizeof(*surface));
+ if (surface == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ surface->format = SDL_AllocFormat(format);
+ if (!surface->format) {
+ SDL_FreeSurface(surface);
+ return NULL;
+ }
+ surface->w = width;
+ surface->h = height;
+ surface->pitch = SDL_CalculatePitch(format, width);
+ SDL_SetClipRect(surface, NULL);
+
+ if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
+ SDL_Palette *palette =
+ SDL_AllocPalette((1 << surface->format->BitsPerPixel));
+ if (!palette) {
+ SDL_FreeSurface(surface);
+ return NULL;
+ }
+ if (palette->ncolors == 2) {
+ /* Create a black and white bitmap palette */
+ palette->colors[0].r = 0xFF;
+ palette->colors[0].g = 0xFF;
+ palette->colors[0].b = 0xFF;
+ palette->colors[1].r = 0x00;
+ palette->colors[1].g = 0x00;
+ palette->colors[1].b = 0x00;
+ }
+ SDL_SetSurfacePalette(surface, palette);
+ SDL_FreePalette(palette);
+ }
+
+ /* Get the pixels */
+ if (surface->w && surface->h) {
+ /* Assumptions checked in surface_size_assumptions assert above */
+ Sint64 size = ((Sint64)surface->h * surface->pitch);
+ if (size < 0 || size > SDL_MAX_SINT32) {
+ /* Overflow... */
+ SDL_FreeSurface(surface);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ surface->pixels = SDL_malloc((size_t)size);
+ if (!surface->pixels) {
+ SDL_FreeSurface(surface);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ /* This is important for bitmaps */
+ SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
+ }
+
+ /* Allocate an empty mapping */
+ surface->map = SDL_AllocBlitMap();
+ if (!surface->map) {
+ SDL_FreeSurface(surface);
+ return NULL;
+ }
+
+ /* By default surface with an alpha mask are set up for blending */
+ if (surface->format->Amask) {
+ SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
+ }
+
+ /* The surface is ready to go */
+ surface->refcount = 1;
+ return surface;
+}
+
+/*
+ * Create an empty RGB surface of the appropriate depth
+ */
+SDL_Surface *
+SDL_CreateRGBSurface(Uint32 flags,
+ int width, int height, int depth,
+ Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
+{
+ Uint32 format;
+
+ /* Get the pixel format */
+ format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask);
+ if (format == SDL_PIXELFORMAT_UNKNOWN) {
+ SDL_SetError("Unknown pixel format");
+ return NULL;
+ }
+
+ return SDL_CreateRGBSurfaceWithFormat(flags, width, height, depth, format);
+}
+
+/*
+ * Create an RGB surface from an existing memory buffer
+ */
+SDL_Surface *
+SDL_CreateRGBSurfaceFrom(void *pixels,
+ int width, int height, int depth, int pitch,
+ Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
+ Uint32 Amask)
+{
+ SDL_Surface *surface;
+
+ surface = SDL_CreateRGBSurface(0, 0, 0, depth, Rmask, Gmask, Bmask, Amask);
+ if (surface != NULL) {
+ surface->flags |= SDL_PREALLOC;
+ surface->pixels = pixels;
+ surface->w = width;
+ surface->h = height;
+ surface->pitch = pitch;
+ SDL_SetClipRect(surface, NULL);
+ }
+ return surface;
+}
+
+/*
+ * Create an RGB surface from an existing memory buffer using the given given
+ * enum SDL_PIXELFORMAT_* format
+ */
+SDL_Surface *
+SDL_CreateRGBSurfaceWithFormatFrom(void *pixels,
+ int width, int height, int depth, int pitch,
+ Uint32 format)
+{
+ SDL_Surface *surface;
+
+ surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format);
+ if (surface != NULL) {
+ surface->flags |= SDL_PREALLOC;
+ surface->pixels = pixels;
+ surface->w = width;
+ surface->h = height;
+ surface->pitch = pitch;
+ SDL_SetClipRect(surface, NULL);
+ }
+ return surface;
+}
+
+int
+SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette)
+{
+ if (!surface) {
+ return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface");
+ }
+ if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) {
+ return -1;
+ }
+ SDL_InvalidateMap(surface->map);
+
+ return 0;
+}
+
+int
+SDL_SetSurfaceRLE(SDL_Surface * surface, int flag)
+{
+ int flags;
+
+ if (!surface) {
+ return -1;
+ }
+
+ flags = surface->map->info.flags;
+ if (flag) {
+ surface->map->info.flags |= SDL_COPY_RLE_DESIRED;
+ } else {
+ surface->map->info.flags &= ~SDL_COPY_RLE_DESIRED;
+ }
+ if (surface->map->info.flags != flags) {
+ SDL_InvalidateMap(surface->map);
+ }
+ return 0;
+}
+
+int
+SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key)
+{
+ int flags;
+
+ if (!surface) {
+ return SDL_InvalidParamError("surface");
+ }
+
+ if (surface->format->palette && key >= ((Uint32) surface->format->palette->ncolors)) {
+ return SDL_InvalidParamError("key");
+ }
+
+ if (flag & SDL_RLEACCEL) {
+ SDL_SetSurfaceRLE(surface, 1);
+ }
+
+ flags = surface->map->info.flags;
+ if (flag) {
+ surface->map->info.flags |= SDL_COPY_COLORKEY;
+ surface->map->info.colorkey = key;
+ if (surface->format->palette) {
+ surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_TRANSPARENT;
+ ++surface->format->palette->version;
+ if (!surface->format->palette->version) {
+ surface->format->palette->version = 1;
+ }
+ }
+ } else {
+ if (surface->format->palette) {
+ surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_OPAQUE;
+ ++surface->format->palette->version;
+ if (!surface->format->palette->version) {
+ surface->format->palette->version = 1;
+ }
+ }
+ surface->map->info.flags &= ~SDL_COPY_COLORKEY;
+ }
+ if (surface->map->info.flags != flags) {
+ SDL_InvalidateMap(surface->map);
+ }
+
+ return 0;
+}
+
+int
+SDL_GetColorKey(SDL_Surface * surface, Uint32 * key)
+{
+ if (!surface) {
+ return SDL_InvalidParamError("surface");
+ }
+
+ if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) {
+ return SDL_SetError("Surface doesn't have a colorkey");
+ }
+
+ if (key) {
+ *key = surface->map->info.colorkey;
+ }
+ return 0;
+}
+
+/* This is a fairly slow function to switch from colorkey to alpha */
+static void
+SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
+{
+ int x, y;
+
+ if (!surface) {
+ return;
+ }
+
+ if (!(surface->map->info.flags & SDL_COPY_COLORKEY) ||
+ !surface->format->Amask) {
+ return;
+ }
+
+ SDL_LockSurface(surface);
+
+ switch (surface->format->BytesPerPixel) {
+ case 2:
+ {
+ Uint16 *row, *spot;
+ Uint16 ckey = (Uint16) surface->map->info.colorkey;
+ Uint16 mask = (Uint16) (~surface->format->Amask);
+
+ /* Ignore alpha in colorkey comparison */
+ ckey &= mask;
+ row = (Uint16 *) surface->pixels;
+ for (y = surface->h; y--;) {
+ spot = row;
+ for (x = surface->w; x--;) {
+ if ((*spot & mask) == ckey) {
+ *spot &= mask;
+ }
+ ++spot;
+ }
+ row += surface->pitch / 2;
+ }
+ }
+ break;
+ case 3:
+ /* FIXME */
+ break;
+ case 4:
+ {
+ Uint32 *row, *spot;
+ Uint32 ckey = surface->map->info.colorkey;
+ Uint32 mask = ~surface->format->Amask;
+
+ /* Ignore alpha in colorkey comparison */
+ ckey &= mask;
+ row = (Uint32 *) surface->pixels;
+ for (y = surface->h; y--;) {
+ spot = row;
+ for (x = surface->w; x--;) {
+ if ((*spot & mask) == ckey) {
+ *spot &= mask;
+ }
+ ++spot;
+ }
+ row += surface->pitch / 4;
+ }
+ }
+ break;
+ }
+
+ SDL_UnlockSurface(surface);
+
+ SDL_SetColorKey(surface, 0, 0);
+ SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
+}
+
+int
+SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b)
+{
+ int flags;
+
+ if (!surface) {
+ return -1;
+ }
+
+ surface->map->info.r = r;
+ surface->map->info.g = g;
+ surface->map->info.b = b;
+
+ flags = surface->map->info.flags;
+ if (r != 0xFF || g != 0xFF || b != 0xFF) {
+ surface->map->info.flags |= SDL_COPY_MODULATE_COLOR;
+ } else {
+ surface->map->info.flags &= ~SDL_COPY_MODULATE_COLOR;
+ }
+ if (surface->map->info.flags != flags) {
+ SDL_InvalidateMap(surface->map);
+ }
+ return 0;
+}
+
+
+int
+SDL_GetSurfaceColorMod(SDL_Surface * surface, Uint8 * r, Uint8 * g, Uint8 * b)
+{
+ if (!surface) {
+ return -1;
+ }
+
+ if (r) {
+ *r = surface->map->info.r;
+ }
+ if (g) {
+ *g = surface->map->info.g;
+ }
+ if (b) {
+ *b = surface->map->info.b;
+ }
+ return 0;
+}
+
+int
+SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha)
+{
+ int flags;
+
+ if (!surface) {
+ return -1;
+ }
+
+ surface->map->info.a = alpha;
+
+ flags = surface->map->info.flags;
+ if (alpha != 0xFF) {
+ surface->map->info.flags |= SDL_COPY_MODULATE_ALPHA;
+ } else {
+ surface->map->info.flags &= ~SDL_COPY_MODULATE_ALPHA;
+ }
+ if (surface->map->info.flags != flags) {
+ SDL_InvalidateMap(surface->map);
+ }
+ return 0;
+}
+
+int
+SDL_GetSurfaceAlphaMod(SDL_Surface * surface, Uint8 * alpha)
+{
+ if (!surface) {
+ return -1;
+ }
+
+ if (alpha) {
+ *alpha = surface->map->info.a;
+ }
+ return 0;
+}
+
+int
+SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode)
+{
+ int flags, status;
+
+ if (!surface) {
+ return -1;
+ }
+
+ status = 0;
+ flags = surface->map->info.flags;
+ surface->map->info.flags &=
+ ~(SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD);
+ switch (blendMode) {
+ case SDL_BLENDMODE_NONE:
+ break;
+ case SDL_BLENDMODE_BLEND:
+ surface->map->info.flags |= SDL_COPY_BLEND;
+ break;
+ case SDL_BLENDMODE_ADD:
+ surface->map->info.flags |= SDL_COPY_ADD;
+ break;
+ case SDL_BLENDMODE_MOD:
+ surface->map->info.flags |= SDL_COPY_MOD;
+ break;
+ default:
+ status = SDL_Unsupported();
+ break;
+ }
+
+ if (surface->map->info.flags != flags) {
+ SDL_InvalidateMap(surface->map);
+ }
+
+ return status;
+}
+
+int
+SDL_GetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode *blendMode)
+{
+ if (!surface) {
+ return -1;
+ }
+
+ if (!blendMode) {
+ return 0;
+ }
+
+ switch (surface->map->
+ info.flags & (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ *blendMode = SDL_BLENDMODE_BLEND;
+ break;
+ case SDL_COPY_ADD:
+ *blendMode = SDL_BLENDMODE_ADD;
+ break;
+ case SDL_COPY_MOD:
+ *blendMode = SDL_BLENDMODE_MOD;
+ break;
+ default:
+ *blendMode = SDL_BLENDMODE_NONE;
+ break;
+ }
+ return 0;
+}
+
+SDL_bool
+SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect)
+{
+ SDL_Rect full_rect;
+
+ /* Don't do anything if there's no surface to act on */
+ if (!surface) {
+ return SDL_FALSE;
+ }
+
+ /* Set up the full surface rectangle */
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = surface->w;
+ full_rect.h = surface->h;
+
+ /* Set the clipping rectangle */
+ if (!rect) {
+ surface->clip_rect = full_rect;
+ return SDL_TRUE;
+ }
+ return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect);
+}
+
+void
+SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect)
+{
+ if (surface && rect) {
+ *rect = surface->clip_rect;
+ }
+}
+
+/*
+ * Set up a blit between two surfaces -- split into three parts:
+ * The upper part, SDL_UpperBlit(), performs clipping and rectangle
+ * verification. The lower part is a pointer to a low level
+ * accelerated blitting function.
+ *
+ * These parts are separated out and each used internally by this
+ * library in the optimimum places. They are exported so that if
+ * you know exactly what you are doing, you can optimize your code
+ * by calling the one(s) you need.
+ */
+int
+SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect)
+{
+ /* Check to make sure the blit mapping is valid */
+ if ((src->map->dst != dst) ||
+ (dst->format->palette &&
+ src->map->dst_palette_version != dst->format->palette->version) ||
+ (src->format->palette &&
+ src->map->src_palette_version != src->format->palette->version)) {
+ if (SDL_MapSurface(src, dst) < 0) {
+ return (-1);
+ }
+ /* just here for debugging */
+/* printf */
+/* ("src = 0x%08X src->flags = %08X src->map->info.flags = %08x\ndst = 0x%08X dst->flags = %08X dst->map->info.flags = %08X\nsrc->map->blit = 0x%08x\n", */
+/* src, dst->flags, src->map->info.flags, dst, dst->flags, */
+/* dst->map->info.flags, src->map->blit); */
+ }
+ return (src->map->blit(src, srcrect, dst, dstrect));
+}
+
+
+int
+SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect)
+{
+ SDL_Rect fulldst;
+ int srcx, srcy, w, h;
+
+ /* Make sure the surfaces aren't locked */
+ if (!src || !dst) {
+ return SDL_SetError("SDL_UpperBlit: passed a NULL surface");
+ }
+ if (src->locked || dst->locked) {
+ return SDL_SetError("Surfaces must not be locked during blit");
+ }
+
+ /* If the destination rectangle is NULL, use the entire dest surface */
+ if (dstrect == NULL) {
+ fulldst.x = fulldst.y = 0;
+ fulldst.w = dst->w;
+ fulldst.h = dst->h;
+ dstrect = &fulldst;
+ }
+
+ /* clip the source rectangle to the source surface */
+ if (srcrect) {
+ int maxw, maxh;
+
+ srcx = srcrect->x;
+ w = srcrect->w;
+ if (srcx < 0) {
+ w += srcx;
+ dstrect->x -= srcx;
+ srcx = 0;
+ }
+ maxw = src->w - srcx;
+ if (maxw < w)
+ w = maxw;
+
+ srcy = srcrect->y;
+ h = srcrect->h;
+ if (srcy < 0) {
+ h += srcy;
+ dstrect->y -= srcy;
+ srcy = 0;
+ }
+ maxh = src->h - srcy;
+ if (maxh < h)
+ h = maxh;
+
+ } else {
+ srcx = srcy = 0;
+ w = src->w;
+ h = src->h;
+ }
+
+ /* clip the destination rectangle against the clip rectangle */
+ {
+ SDL_Rect *clip = &dst->clip_rect;
+ int dx, dy;
+
+ dx = clip->x - dstrect->x;
+ if (dx > 0) {
+ w -= dx;
+ dstrect->x += dx;
+ srcx += dx;
+ }
+ dx = dstrect->x + w - clip->x - clip->w;
+ if (dx > 0)
+ w -= dx;
+
+ dy = clip->y - dstrect->y;
+ if (dy > 0) {
+ h -= dy;
+ dstrect->y += dy;
+ srcy += dy;
+ }
+ dy = dstrect->y + h - clip->y - clip->h;
+ if (dy > 0)
+ h -= dy;
+ }
+
+ /* Switch back to a fast blit if we were previously stretching */
+ if (src->map->info.flags & SDL_COPY_NEAREST) {
+ src->map->info.flags &= ~SDL_COPY_NEAREST;
+ SDL_InvalidateMap(src->map);
+ }
+
+ if (w > 0 && h > 0) {
+ SDL_Rect sr;
+ sr.x = srcx;
+ sr.y = srcy;
+ sr.w = dstrect->w = w;
+ sr.h = dstrect->h = h;
+ return SDL_LowerBlit(src, &sr, dst, dstrect);
+ }
+ dstrect->w = dstrect->h = 0;
+ return 0;
+}
+
+int
+SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect)
+{
+ double src_x0, src_y0, src_x1, src_y1;
+ double dst_x0, dst_y0, dst_x1, dst_y1;
+ SDL_Rect final_src, final_dst;
+ double scaling_w, scaling_h;
+ int src_w, src_h;
+ int dst_w, dst_h;
+
+ /* Make sure the surfaces aren't locked */
+ if (!src || !dst) {
+ return SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface");
+ }
+ if (src->locked || dst->locked) {
+ return SDL_SetError("Surfaces must not be locked during blit");
+ }
+
+ if (NULL == srcrect) {
+ src_w = src->w;
+ src_h = src->h;
+ } else {
+ src_w = srcrect->w;
+ src_h = srcrect->h;
+ }
+
+ if (NULL == dstrect) {
+ dst_w = dst->w;
+ dst_h = dst->h;
+ } else {
+ dst_w = dstrect->w;
+ dst_h = dstrect->h;
+ }
+
+ if (dst_w == src_w && dst_h == src_h) {
+ /* No scaling, defer to regular blit */
+ return SDL_BlitSurface(src, srcrect, dst, dstrect);
+ }
+
+ scaling_w = (double)dst_w / src_w;
+ scaling_h = (double)dst_h / src_h;
+
+ if (NULL == dstrect) {
+ dst_x0 = 0;
+ dst_y0 = 0;
+ dst_x1 = dst_w - 1;
+ dst_y1 = dst_h - 1;
+ } else {
+ dst_x0 = dstrect->x;
+ dst_y0 = dstrect->y;
+ dst_x1 = dst_x0 + dst_w - 1;
+ dst_y1 = dst_y0 + dst_h - 1;
+ }
+
+ if (NULL == srcrect) {
+ src_x0 = 0;
+ src_y0 = 0;
+ src_x1 = src_w - 1;
+ src_y1 = src_h - 1;
+ } else {
+ src_x0 = srcrect->x;
+ src_y0 = srcrect->y;
+ src_x1 = src_x0 + src_w - 1;
+ src_y1 = src_y0 + src_h - 1;
+
+ /* Clip source rectangle to the source surface */
+
+ if (src_x0 < 0) {
+ dst_x0 -= src_x0 * scaling_w;
+ src_x0 = 0;
+ }
+
+ if (src_x1 >= src->w) {
+ dst_x1 -= (src_x1 - src->w + 1) * scaling_w;
+ src_x1 = src->w - 1;
+ }
+
+ if (src_y0 < 0) {
+ dst_y0 -= src_y0 * scaling_h;
+ src_y0 = 0;
+ }
+
+ if (src_y1 >= src->h) {
+ dst_y1 -= (src_y1 - src->h + 1) * scaling_h;
+ src_y1 = src->h - 1;
+ }
+ }
+
+ /* Clip destination rectangle to the clip rectangle */
+
+ /* Translate to clip space for easier calculations */
+ dst_x0 -= dst->clip_rect.x;
+ dst_x1 -= dst->clip_rect.x;
+ dst_y0 -= dst->clip_rect.y;
+ dst_y1 -= dst->clip_rect.y;
+
+ if (dst_x0 < 0) {
+ src_x0 -= dst_x0 / scaling_w;
+ dst_x0 = 0;
+ }
+
+ if (dst_x1 >= dst->clip_rect.w) {
+ src_x1 -= (dst_x1 - dst->clip_rect.w + 1) / scaling_w;
+ dst_x1 = dst->clip_rect.w - 1;
+ }
+
+ if (dst_y0 < 0) {
+ src_y0 -= dst_y0 / scaling_h;
+ dst_y0 = 0;
+ }
+
+ if (dst_y1 >= dst->clip_rect.h) {
+ src_y1 -= (dst_y1 - dst->clip_rect.h + 1) / scaling_h;
+ dst_y1 = dst->clip_rect.h - 1;
+ }
+
+ /* Translate back to surface coordinates */
+ dst_x0 += dst->clip_rect.x;
+ dst_x1 += dst->clip_rect.x;
+ dst_y0 += dst->clip_rect.y;
+ dst_y1 += dst->clip_rect.y;
+
+ final_src.x = (int)SDL_floor(src_x0 + 0.5);
+ final_src.y = (int)SDL_floor(src_y0 + 0.5);
+ final_src.w = (int)SDL_floor(src_x1 + 1 + 0.5) - (int)SDL_floor(src_x0 + 0.5);
+ final_src.h = (int)SDL_floor(src_y1 + 1 + 0.5) - (int)SDL_floor(src_y0 + 0.5);
+
+ final_dst.x = (int)SDL_floor(dst_x0 + 0.5);
+ final_dst.y = (int)SDL_floor(dst_y0 + 0.5);
+ final_dst.w = (int)SDL_floor(dst_x1 - dst_x0 + 1.5);
+ final_dst.h = (int)SDL_floor(dst_y1 - dst_y0 + 1.5);
+
+ if (final_dst.w < 0)
+ final_dst.w = 0;
+ if (final_dst.h < 0)
+ final_dst.h = 0;
+
+ if (dstrect)
+ *dstrect = final_dst;
+
+ if (final_dst.w == 0 || final_dst.h == 0 ||
+ final_src.w <= 0 || final_src.h <= 0) {
+ /* No-op. */
+ return 0;
+ }
+
+ return SDL_LowerBlitScaled(src, &final_src, dst, &final_dst);
+}
+
+/**
+ * This is a semi-private blit function and it performs low-level surface
+ * scaled blitting only.
+ */
+int
+SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect)
+{
+ static const Uint32 complex_copy_flags = (
+ SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA |
+ SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD |
+ SDL_COPY_COLORKEY
+ );
+
+ if (!(src->map->info.flags & SDL_COPY_NEAREST)) {
+ src->map->info.flags |= SDL_COPY_NEAREST;
+ SDL_InvalidateMap(src->map);
+ }
+
+ if ( !(src->map->info.flags & complex_copy_flags) &&
+ src->format->format == dst->format->format &&
+ !SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
+ return SDL_SoftStretch( src, srcrect, dst, dstrect );
+ } else {
+ return SDL_LowerBlit( src, srcrect, dst, dstrect );
+ }
+}
+
+/*
+ * Lock a surface to directly access the pixels
+ */
+int
+SDL_LockSurface(SDL_Surface * surface)
+{
+ if (!surface->locked) {
+ /* Perform the lock */
+ if (surface->flags & SDL_RLEACCEL) {
+ SDL_UnRLESurface(surface, 1);
+ surface->flags |= SDL_RLEACCEL; /* save accel'd state */
+ }
+ }
+
+ /* Increment the surface lock count, for recursive locks */
+ ++surface->locked;
+
+ /* Ready to go.. */
+ return (0);
+}
+
+/*
+ * Unlock a previously locked surface
+ */
+void
+SDL_UnlockSurface(SDL_Surface * surface)
+{
+ /* Only perform an unlock if we are locked */
+ if (!surface->locked || (--surface->locked > 0)) {
+ return;
+ }
+
+ /* Update RLE encoded surface with new data */
+ if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
+ surface->flags &= ~SDL_RLEACCEL; /* stop lying */
+ SDL_RLESurface(surface);
+ }
+}
+
+/*
+ * Creates a new surface identical to the existing surface
+ */
+SDL_Surface *
+SDL_DuplicateSurface(SDL_Surface * surface)
+{
+ return SDL_ConvertSurface(surface, surface->format, surface->flags);
+}
+
+/*
+ * Convert a surface into the specified pixel format.
+ */
+SDL_Surface *
+SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
+ Uint32 flags)
+{
+ SDL_Surface *convert;
+ Uint32 copy_flags;
+ SDL_Color copy_color;
+ SDL_Rect bounds;
+
+ if (!surface) {
+ SDL_InvalidParamError("surface");
+ return NULL;
+ }
+ if (!format) {
+ SDL_InvalidParamError("format");
+ return NULL;
+ }
+
+ /* Check for empty destination palette! (results in empty image) */
+ if (format->palette != NULL) {
+ int i;
+ for (i = 0; i < format->palette->ncolors; ++i) {
+ if ((format->palette->colors[i].r != 0xFF) ||
+ (format->palette->colors[i].g != 0xFF) ||
+ (format->palette->colors[i].b != 0xFF))
+ break;
+ }
+ if (i == format->palette->ncolors) {
+ SDL_SetError("Empty destination palette");
+ return (NULL);
+ }
+ }
+
+ /* Create a new surface with the desired format */
+ convert = SDL_CreateRGBSurface(flags, surface->w, surface->h,
+ format->BitsPerPixel, format->Rmask,
+ format->Gmask, format->Bmask,
+ format->Amask);
+ if (convert == NULL) {
+ return (NULL);
+ }
+
+ /* Copy the palette if any */
+ if (format->palette && convert->format->palette) {
+ SDL_memcpy(convert->format->palette->colors,
+ format->palette->colors,
+ format->palette->ncolors * sizeof(SDL_Color));
+ convert->format->palette->ncolors = format->palette->ncolors;
+ }
+
+ /* Save the original copy flags */
+ copy_flags = surface->map->info.flags;
+ copy_color.r = surface->map->info.r;
+ copy_color.g = surface->map->info.g;
+ copy_color.b = surface->map->info.b;
+ copy_color.a = surface->map->info.a;
+ surface->map->info.r = 0xFF;
+ surface->map->info.g = 0xFF;
+ surface->map->info.b = 0xFF;
+ surface->map->info.a = 0xFF;
+ surface->map->info.flags = 0;
+ SDL_InvalidateMap(surface->map);
+
+ /* Copy over the image data */
+ bounds.x = 0;
+ bounds.y = 0;
+ bounds.w = surface->w;
+ bounds.h = surface->h;
+ SDL_LowerBlit(surface, &bounds, convert, &bounds);
+
+ /* Clean up the original surface, and update converted surface */
+ convert->map->info.r = copy_color.r;
+ convert->map->info.g = copy_color.g;
+ convert->map->info.b = copy_color.b;
+ convert->map->info.a = copy_color.a;
+ convert->map->info.flags =
+ (copy_flags &
+ ~(SDL_COPY_COLORKEY | SDL_COPY_BLEND
+ | SDL_COPY_RLE_DESIRED | SDL_COPY_RLE_COLORKEY |
+ SDL_COPY_RLE_ALPHAKEY));
+ surface->map->info.r = copy_color.r;
+ surface->map->info.g = copy_color.g;
+ surface->map->info.b = copy_color.b;
+ surface->map->info.a = copy_color.a;
+ surface->map->info.flags = copy_flags;
+ SDL_InvalidateMap(surface->map);
+ if (copy_flags & SDL_COPY_COLORKEY) {
+ SDL_bool set_colorkey_by_color = SDL_FALSE;
+
+ if (surface->format->palette) {
+ if (format->palette &&
+ surface->format->palette->ncolors <= format->palette->ncolors &&
+ (SDL_memcmp(surface->format->palette->colors, format->palette->colors,
+ surface->format->palette->ncolors * sizeof(SDL_Color)) == 0)) {
+ /* The palette is identical, just set the same colorkey */
+ SDL_SetColorKey(convert, 1, surface->map->info.colorkey);
+ } else if (format->Amask) {
+ /* The alpha was set in the destination from the palette */
+ } else {
+ set_colorkey_by_color = SDL_TRUE;
+ }
+ } else {
+ set_colorkey_by_color = SDL_TRUE;
+ }
+
+ if (set_colorkey_by_color) {
+ SDL_Surface *tmp;
+ SDL_Surface *tmp2;
+ int converted_colorkey = 0;
+
+ /* Create a dummy surface to get the colorkey converted */
+ tmp = SDL_CreateRGBSurface(0, 1, 1,
+ surface->format->BitsPerPixel, surface->format->Rmask,
+ surface->format->Gmask, surface->format->Bmask,
+ surface->format->Amask);
+
+ /* Share the palette, if any */
+ if (surface->format->palette) {
+ SDL_SetSurfacePalette(tmp, surface->format->palette);
+ }
+
+ SDL_FillRect(tmp, NULL, surface->map->info.colorkey);
+
+ tmp->map->info.flags &= ~SDL_COPY_COLORKEY;
+
+ /* Convertion of the colorkey */
+ tmp2 = SDL_ConvertSurface(tmp, format, 0);
+
+ /* Get the converted colorkey */
+ SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel);
+
+ SDL_FreeSurface(tmp);
+ SDL_FreeSurface(tmp2);
+
+ /* Set the converted colorkey on the new surface */
+ SDL_SetColorKey(convert, 1, converted_colorkey);
+
+ /* This is needed when converting for 3D texture upload */
+ SDL_ConvertColorkeyToAlpha(convert);
+ }
+ }
+ SDL_SetClipRect(convert, &surface->clip_rect);
+
+ /* Enable alpha blending by default if the new surface has an
+ * alpha channel or alpha modulation */
+ if ((surface->format->Amask && format->Amask) ||
+ (copy_flags & SDL_COPY_MODULATE_ALPHA)) {
+ SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
+ }
+ if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) {
+ SDL_SetSurfaceRLE(convert, SDL_RLEACCEL);
+ }
+
+ /* We're ready to go! */
+ return (convert);
+}
+
+SDL_Surface *
+SDL_ConvertSurfaceFormat(SDL_Surface * surface, Uint32 pixel_format,
+ Uint32 flags)
+{
+ SDL_PixelFormat *fmt;
+ SDL_Surface *convert = NULL;
+
+ fmt = SDL_AllocFormat(pixel_format);
+ if (fmt) {
+ convert = SDL_ConvertSurface(surface, fmt, flags);
+ SDL_FreeFormat(fmt);
+ }
+ return convert;
+}
+
+/*
+ * Create a surface on the stack for quick blit operations
+ */
+static SDL_INLINE SDL_bool
+SDL_CreateSurfaceOnStack(int width, int height, Uint32 pixel_format,
+ void * pixels, int pitch, SDL_Surface * surface,
+ SDL_PixelFormat * format, SDL_BlitMap * blitmap)
+{
+ if (SDL_ISPIXELFORMAT_INDEXED(pixel_format)) {
+ SDL_SetError("Indexed pixel formats not supported");
+ return SDL_FALSE;
+ }
+ if (SDL_InitFormat(format, pixel_format) < 0) {
+ return SDL_FALSE;
+ }
+
+ SDL_zerop(surface);
+ surface->flags = SDL_PREALLOC;
+ surface->format = format;
+ surface->pixels = pixels;
+ surface->w = width;
+ surface->h = height;
+ surface->pitch = pitch;
+ /* We don't actually need to set up the clip rect for our purposes */
+ /* SDL_SetClipRect(surface, NULL); */
+
+ /* Allocate an empty mapping */
+ SDL_zerop(blitmap);
+ blitmap->info.r = 0xFF;
+ blitmap->info.g = 0xFF;
+ blitmap->info.b = 0xFF;
+ blitmap->info.a = 0xFF;
+ surface->map = blitmap;
+
+ /* The surface is ready to go */
+ surface->refcount = 1;
+ return SDL_TRUE;
+}
+
+/*
+ * Copy a block of pixels of one format to another format
+ */
+int SDL_ConvertPixels(int width, int height,
+ Uint32 src_format, const void * src, int src_pitch,
+ Uint32 dst_format, void * dst, int dst_pitch)
+{
+ SDL_Surface src_surface, dst_surface;
+ SDL_PixelFormat src_fmt, dst_fmt;
+ SDL_BlitMap src_blitmap, dst_blitmap;
+ SDL_Rect rect;
+ void *nonconst_src = (void *) src;
+
+ /* Check to make sure we are blitting somewhere, so we don't crash */
+ if (!dst) {
+ return SDL_InvalidParamError("dst");
+ }
+ if (!dst_pitch) {
+ return SDL_InvalidParamError("dst_pitch");
+ }
+
+ if (SDL_ISPIXELFORMAT_FOURCC(src_format) && SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
+ return SDL_ConvertPixels_YUV_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ } else if (SDL_ISPIXELFORMAT_FOURCC(src_format)) {
+ return SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ } else if (SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
+ return SDL_ConvertPixels_RGB_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ }
+
+ /* Fast path for same format copy */
+ if (src_format == dst_format) {
+ int i;
+ const int bpp = SDL_BYTESPERPIXEL(src_format);
+ width *= bpp;
+ for (i = height; i--;) {
+ SDL_memcpy(dst, src, width);
+ src = (const Uint8*)src + src_pitch;
+ dst = (Uint8*)dst + dst_pitch;
+ }
+ return 0;
+ }
+
+ if (!SDL_CreateSurfaceOnStack(width, height, src_format, nonconst_src,
+ src_pitch,
+ &src_surface, &src_fmt, &src_blitmap)) {
+ return -1;
+ }
+ if (!SDL_CreateSurfaceOnStack(width, height, dst_format, dst, dst_pitch,
+ &dst_surface, &dst_fmt, &dst_blitmap)) {
+ return -1;
+ }
+
+ /* Set up the rect and go! */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = width;
+ rect.h = height;
+ return SDL_LowerBlit(&src_surface, &rect, &dst_surface, &rect);
+}
+
+/*
+ * Free a surface created by the above function.
+ */
+void
+SDL_FreeSurface(SDL_Surface * surface)
+{
+ if (surface == NULL) {
+ return;
+ }
+ if (surface->flags & SDL_DONTFREE) {
+ return;
+ }
+ SDL_InvalidateMap(surface->map);
+
+ if (--surface->refcount > 0) {
+ return;
+ }
+ while (surface->locked > 0) {
+ SDL_UnlockSurface(surface);
+ }
+ if (surface->flags & SDL_RLEACCEL) {
+ SDL_UnRLESurface(surface, 0);
+ }
+ if (surface->format) {
+ SDL_SetSurfacePalette(surface, NULL);
+ SDL_FreeFormat(surface->format);
+ surface->format = NULL;
+ }
+ if (!(surface->flags & SDL_PREALLOC)) {
+ SDL_free(surface->pixels);
+ }
+ if (surface->map) {
+ SDL_FreeBlitMap(surface->map);
+ }
+ SDL_free(surface);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_sysvideo.h b/src/3rdparty/SDL2/src/video/SDL_sysvideo.h
new file mode 100644
index 0000000..9df71c9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_sysvideo.h
@@ -0,0 +1,459 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#ifndef SDL_sysvideo_h_
+#define SDL_sysvideo_h_
+
+#include "SDL_messagebox.h"
+#include "SDL_shape.h"
+#include "SDL_thread.h"
+
+#include "SDL_vulkan_internal.h"
+
+/* The SDL video driver */
+
+typedef struct SDL_WindowShaper SDL_WindowShaper;
+typedef struct SDL_ShapeDriver SDL_ShapeDriver;
+typedef struct SDL_VideoDisplay SDL_VideoDisplay;
+typedef struct SDL_VideoDevice SDL_VideoDevice;
+
+/* Define the SDL window-shaper structure */
+struct SDL_WindowShaper
+{
+ /* The window associated with the shaper */
+ SDL_Window *window;
+
+ /* The user's specified coordinates for the window, for once we give it a shape. */
+ Uint32 userx,usery;
+
+ /* The parameters for shape calculation. */
+ SDL_WindowShapeMode mode;
+
+ /* Has this window been assigned a shape? */
+ SDL_bool hasshape;
+
+ void *driverdata;
+};
+
+/* Define the SDL shape driver structure */
+struct SDL_ShapeDriver
+{
+ SDL_WindowShaper *(*CreateShaper)(SDL_Window * window);
+ int (*SetWindowShape)(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
+ int (*ResizeWindowShape)(SDL_Window *window);
+};
+
+typedef struct SDL_WindowUserData
+{
+ char *name;
+ void *data;
+ struct SDL_WindowUserData *next;
+} SDL_WindowUserData;
+
+/* Define the SDL window structure, corresponding to toplevel windows */
+struct SDL_Window
+{
+ const void *magic;
+ Uint32 id;
+ char *title;
+ SDL_Surface *icon;
+ int x, y;
+ int w, h;
+ int min_w, min_h;
+ int max_w, max_h;
+ Uint32 flags;
+ Uint32 last_fullscreen_flags;
+
+ /* Stored position and size for windowed mode */
+ SDL_Rect windowed;
+
+ SDL_DisplayMode fullscreen_mode;
+
+ float opacity;
+
+ float brightness;
+ Uint16 *gamma;
+ Uint16 *saved_gamma; /* (just offset into gamma) */
+
+ SDL_Surface *surface;
+ SDL_bool surface_valid;
+
+ SDL_bool is_hiding;
+ SDL_bool is_destroying;
+ SDL_bool is_dropping; /* drag/drop in progress, expecting SDL_SendDropComplete(). */
+
+ SDL_WindowShaper *shaper;
+
+ SDL_HitTest hit_test;
+ void *hit_test_data;
+
+ SDL_WindowUserData *data;
+
+ void *driverdata;
+
+ SDL_Window *prev;
+ SDL_Window *next;
+};
+#define FULLSCREEN_VISIBLE(W) \
+ (((W)->flags & SDL_WINDOW_FULLSCREEN) && \
+ ((W)->flags & SDL_WINDOW_SHOWN) && \
+ !((W)->flags & SDL_WINDOW_MINIMIZED))
+
+/*
+ * Define the SDL display structure This corresponds to physical monitors
+ * attached to the system.
+ */
+struct SDL_VideoDisplay
+{
+ char *name;
+ int max_display_modes;
+ int num_display_modes;
+ SDL_DisplayMode *display_modes;
+ SDL_DisplayMode desktop_mode;
+ SDL_DisplayMode current_mode;
+
+ SDL_Window *fullscreen_window;
+
+ SDL_VideoDevice *device;
+
+ void *driverdata;
+};
+
+/* Forward declaration */
+struct SDL_SysWMinfo;
+
+/* Define the SDL video driver structure */
+#define _THIS SDL_VideoDevice *_this
+
+struct SDL_VideoDevice
+{
+ /* * * */
+ /* The name of this video driver */
+ const char *name;
+
+ /* * * */
+ /* Initialization/Query functions */
+
+ /*
+ * Initialize the native video subsystem, filling in the list of
+ * displays for this driver, returning 0 or -1 if there's an error.
+ */
+ int (*VideoInit) (_THIS);
+
+ /*
+ * Reverse the effects VideoInit() -- called if VideoInit() fails or
+ * if the application is shutting down the video subsystem.
+ */
+ void (*VideoQuit) (_THIS);
+
+ /*
+ * Reinitialize the touch devices -- called if an unknown touch ID occurs.
+ */
+ void (*ResetTouch) (_THIS);
+
+ /* * * */
+ /*
+ * Display functions
+ */
+
+ /*
+ * Get the bounds of a display
+ */
+ int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+
+ /*
+ * Get the dots/pixels-per-inch of a display
+ */
+ int (*GetDisplayDPI) (_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi);
+
+ /*
+ * Get the usable bounds of a display (bounds minus menubar or whatever)
+ */
+ int (*GetDisplayUsableBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+
+ /*
+ * Get a list of the available display modes for a display.
+ */
+ void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);
+
+ /*
+ * Setting the display mode is independent of creating windows, so
+ * when the display mode is changed, all existing windows should have
+ * their data updated accordingly, including the display surfaces
+ * associated with them.
+ */
+ int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+
+ /* * * */
+ /*
+ * Window functions
+ */
+ int (*CreateSDLWindow) (_THIS, SDL_Window * window);
+ int (*CreateSDLWindowFrom) (_THIS, SDL_Window * window, const void *data);
+ void (*SetWindowTitle) (_THIS, SDL_Window * window);
+ void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon);
+ void (*SetWindowPosition) (_THIS, SDL_Window * window);
+ void (*SetWindowSize) (_THIS, SDL_Window * window);
+ void (*SetWindowMinimumSize) (_THIS, SDL_Window * window);
+ void (*SetWindowMaximumSize) (_THIS, SDL_Window * window);
+ int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
+ int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity);
+ int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
+ int (*SetWindowInputFocus) (_THIS, SDL_Window * window);
+ void (*ShowWindow) (_THIS, SDL_Window * window);
+ void (*HideWindow) (_THIS, SDL_Window * window);
+ void (*RaiseWindow) (_THIS, SDL_Window * window);
+ void (*MaximizeWindow) (_THIS, SDL_Window * window);
+ void (*MinimizeWindow) (_THIS, SDL_Window * window);
+ void (*RestoreWindow) (_THIS, SDL_Window * window);
+ void (*SetWindowBordered) (_THIS, SDL_Window * window, SDL_bool bordered);
+ void (*SetWindowResizable) (_THIS, SDL_Window * window, SDL_bool resizable);
+ void (*SetWindowFullscreen) (_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+ int (*SetWindowGammaRamp) (_THIS, SDL_Window * window, const Uint16 * ramp);
+ int (*GetWindowGammaRamp) (_THIS, SDL_Window * window, Uint16 * ramp);
+ void (*SetWindowGrab) (_THIS, SDL_Window * window, SDL_bool grabbed);
+ void (*DestroyWindow) (_THIS, SDL_Window * window);
+ int (*CreateWindowFramebuffer) (_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch);
+ int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects);
+ void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window);
+ void (*OnWindowEnter) (_THIS, SDL_Window * window);
+
+ /* * * */
+ /*
+ * Shaped-window functions
+ */
+ SDL_ShapeDriver shape_driver;
+
+ /* Get some platform dependent window information */
+ SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo * info);
+
+ /* * * */
+ /*
+ * OpenGL support
+ */
+ int (*GL_LoadLibrary) (_THIS, const char *path);
+ void *(*GL_GetProcAddress) (_THIS, const char *proc);
+ void (*GL_UnloadLibrary) (_THIS);
+ SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
+ int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
+ void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h);
+ int (*GL_SetSwapInterval) (_THIS, int interval);
+ int (*GL_GetSwapInterval) (_THIS);
+ int (*GL_SwapWindow) (_THIS, SDL_Window * window);
+ void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
+ void (*GL_DefaultProfileConfig) (_THIS, int *mask, int *major, int *minor);
+
+ /* * * */
+ /*
+ * Vulkan support
+ */
+ int (*Vulkan_LoadLibrary) (_THIS, const char *path);
+ void (*Vulkan_UnloadLibrary) (_THIS);
+ SDL_bool (*Vulkan_GetInstanceExtensions) (_THIS, SDL_Window *window, unsigned *count, const char **names);
+ SDL_bool (*Vulkan_CreateSurface) (_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
+ void (*Vulkan_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h);
+
+ /* * * */
+ /*
+ * Event manager functions
+ */
+ void (*PumpEvents) (_THIS);
+
+ /* Suspend the screensaver */
+ void (*SuspendScreenSaver) (_THIS);
+
+ /* Text input */
+ void (*StartTextInput) (_THIS);
+ void (*StopTextInput) (_THIS);
+ void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
+
+ /* Screen keyboard */
+ SDL_bool (*HasScreenKeyboardSupport) (_THIS);
+ void (*ShowScreenKeyboard) (_THIS, SDL_Window *window);
+ void (*HideScreenKeyboard) (_THIS, SDL_Window *window);
+ SDL_bool (*IsScreenKeyboardShown) (_THIS, SDL_Window *window);
+
+ /* Clipboard */
+ int (*SetClipboardText) (_THIS, const char *text);
+ char * (*GetClipboardText) (_THIS);
+ SDL_bool (*HasClipboardText) (_THIS);
+
+ /* MessageBox */
+ int (*ShowMessageBox) (_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+ /* Hit-testing */
+ int (*SetWindowHitTest)(SDL_Window * window, SDL_bool enabled);
+
+ /* * * */
+ /* Data common to all drivers */
+ SDL_bool is_dummy;
+ SDL_bool suspend_screensaver;
+ int num_displays;
+ SDL_VideoDisplay *displays;
+ SDL_Window *windows;
+ SDL_Window *grabbed_window;
+ Uint8 window_magic;
+ Uint32 next_object_id;
+ char *clipboard_text;
+
+ /* * * */
+ /* Data used by the GL drivers */
+ struct
+ {
+ int red_size;
+ int green_size;
+ int blue_size;
+ int alpha_size;
+ int depth_size;
+ int buffer_size;
+ int stencil_size;
+ int double_buffer;
+ int accum_red_size;
+ int accum_green_size;
+ int accum_blue_size;
+ int accum_alpha_size;
+ int stereo;
+ int multisamplebuffers;
+ int multisamplesamples;
+ int accelerated;
+ int major_version;
+ int minor_version;
+ int flags;
+ int profile_mask;
+ int share_with_current_context;
+ int release_behavior;
+ int reset_notification;
+ int framebuffer_srgb_capable;
+ int no_error;
+ int retained_backing;
+ int driver_loaded;
+ char driver_path[256];
+ void *dll_handle;
+ } gl_config;
+
+ /* * * */
+ /* Cache current GL context; don't call the OS when it hasn't changed. */
+ /* We have the global pointers here so Cocoa continues to work the way
+ it always has, and the thread-local storage for the general case.
+ */
+ SDL_Window *current_glwin;
+ SDL_GLContext current_glctx;
+ SDL_TLSID current_glwin_tls;
+ SDL_TLSID current_glctx_tls;
+
+ /* * * */
+ /* Data used by the Vulkan drivers */
+ struct
+ {
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
+ PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
+ int loader_loaded;
+ char loader_path[256];
+ void *loader_handle;
+ } vulkan_config;
+
+ /* * * */
+ /* Data private to this driver */
+ void *driverdata;
+ struct SDL_GLDriverData *gl_data;
+
+#if SDL_VIDEO_OPENGL_EGL
+ struct SDL_EGL_VideoData *egl_data;
+#endif
+
+#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ struct SDL_PrivateGLESData *gles_data;
+#endif
+
+ /* * * */
+ /* The function used to dispose of this structure */
+ void (*free) (_THIS);
+};
+
+typedef struct VideoBootStrap
+{
+ const char *name;
+ const char *desc;
+ int (*available) (void);
+ SDL_VideoDevice *(*create) (int devindex);
+} VideoBootStrap;
+
+/* Not all of these are available in a given build. Use #ifdefs, etc. */
+extern VideoBootStrap COCOA_bootstrap;
+extern VideoBootStrap X11_bootstrap;
+extern VideoBootStrap MIR_bootstrap;
+extern VideoBootStrap DirectFB_bootstrap;
+extern VideoBootStrap WINDOWS_bootstrap;
+extern VideoBootStrap WINRT_bootstrap;
+extern VideoBootStrap HAIKU_bootstrap;
+extern VideoBootStrap PND_bootstrap;
+extern VideoBootStrap UIKIT_bootstrap;
+extern VideoBootStrap Android_bootstrap;
+extern VideoBootStrap PSP_bootstrap;
+extern VideoBootStrap RPI_bootstrap;
+extern VideoBootStrap KMSDRM_bootstrap;
+extern VideoBootStrap DUMMY_bootstrap;
+extern VideoBootStrap Wayland_bootstrap;
+extern VideoBootStrap NACL_bootstrap;
+extern VideoBootStrap VIVANTE_bootstrap;
+extern VideoBootStrap Emscripten_bootstrap;
+extern VideoBootStrap QNX_bootstrap;
+
+extern SDL_VideoDevice *SDL_GetVideoDevice(void);
+extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
+extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
+extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
+extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window);
+extern void *SDL_GetDisplayDriverData( int displayIndex );
+
+extern void SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor);
+
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
+extern SDL_bool SDL_HasWindows(void);
+
+extern void SDL_OnWindowShown(SDL_Window * window);
+extern void SDL_OnWindowHidden(SDL_Window * window);
+extern void SDL_OnWindowResized(SDL_Window * window);
+extern void SDL_OnWindowMinimized(SDL_Window * window);
+extern void SDL_OnWindowRestored(SDL_Window * window);
+extern void SDL_OnWindowEnter(SDL_Window * window);
+extern void SDL_OnWindowLeave(SDL_Window * window);
+extern void SDL_OnWindowFocusGained(SDL_Window * window);
+extern void SDL_OnWindowFocusLost(SDL_Window * window);
+extern void SDL_UpdateWindowGrab(SDL_Window * window);
+extern SDL_Window * SDL_GetFocusWindow(void);
+
+extern SDL_bool SDL_ShouldAllowTopmost(void);
+
+extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches);
+
+extern void SDL_OnApplicationWillTerminate(void);
+extern void SDL_OnApplicationDidReceiveMemoryWarning(void);
+extern void SDL_OnApplicationWillResignActive(void);
+extern void SDL_OnApplicationDidEnterBackground(void);
+extern void SDL_OnApplicationWillEnterForeground(void);
+extern void SDL_OnApplicationDidBecomeActive(void);
+
+#endif /* SDL_sysvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_video.c b/src/3rdparty/SDL2/src/video/SDL_video.c
new file mode 100644
index 0000000..8cf195d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_video.c
@@ -0,0 +1,4077 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* The high-level video driver subsystem */
+
+#include "SDL.h"
+#include "SDL_video.h"
+#include "SDL_sysvideo.h"
+#include "SDL_blit.h"
+#include "SDL_pixels_c.h"
+#include "SDL_rect_c.h"
+#include "../events/SDL_events_c.h"
+#include "../timer/SDL_timer_c.h"
+
+#include "SDL_syswm.h"
+
+#if SDL_VIDEO_OPENGL
+#include "SDL_opengl.h"
+#endif /* SDL_VIDEO_OPENGL */
+
+#if SDL_VIDEO_OPENGL_ES
+#include "SDL_opengles.h"
+#endif /* SDL_VIDEO_OPENGL_ES */
+
+/* GL and GLES2 headers conflict on Linux 32 bits */
+#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL
+#include "SDL_opengles2.h"
+#endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */
+
+#if !SDL_VIDEO_OPENGL
+#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR
+#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
+#endif
+#endif
+
+#ifdef __EMSCRIPTEN__
+#include <emscripten.h>
+#endif
+
+/* Available video drivers */
+static VideoBootStrap *bootstrap[] = {
+#if SDL_VIDEO_DRIVER_COCOA
+ &COCOA_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_X11
+ &X11_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_MIR
+ &MIR_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_WAYLAND
+ &Wayland_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_VIVANTE
+ &VIVANTE_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_DIRECTFB
+ &DirectFB_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_WINDOWS
+ &WINDOWS_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_WINRT
+ &WINRT_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_HAIKU
+ &HAIKU_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_PANDORA
+ &PND_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_UIKIT
+ &UIKIT_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_ANDROID
+ &Android_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_PSP
+ &PSP_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_KMSDRM
+ &KMSDRM_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_RPI
+ &RPI_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_NACL
+ &NACL_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN
+ &Emscripten_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_QNX
+ &QNX_bootstrap,
+#endif
+#if SDL_VIDEO_DRIVER_DUMMY
+ &DUMMY_bootstrap,
+#endif
+ NULL
+};
+
+static SDL_VideoDevice *_this = NULL;
+
+#define CHECK_WINDOW_MAGIC(window, retval) \
+ if (!_this) { \
+ SDL_UninitializedVideo(); \
+ return retval; \
+ } \
+ SDL_assert(window && window->magic == &_this->window_magic); \
+ if (!window || window->magic != &_this->window_magic) { \
+ SDL_SetError("Invalid window"); \
+ return retval; \
+ }
+
+#define CHECK_DISPLAY_INDEX(displayIndex, retval) \
+ if (!_this) { \
+ SDL_UninitializedVideo(); \
+ return retval; \
+ } \
+ SDL_assert(_this->displays != NULL); \
+ SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \
+ if (displayIndex < 0 || displayIndex >= _this->num_displays) { \
+ SDL_SetError("displayIndex must be in the range 0 - %d", \
+ _this->num_displays - 1); \
+ return retval; \
+ }
+
+#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
+
+#ifdef __MACOSX__
+/* Support for Mac OS X fullscreen spaces */
+extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window * window);
+extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state);
+#endif
+
+
+/* Support for framebuffer emulation using an accelerated renderer */
+
+#define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
+
+typedef struct {
+ SDL_Renderer *renderer;
+ SDL_Texture *texture;
+ void *pixels;
+ int pitch;
+ int bytes_per_pixel;
+} SDL_WindowTextureData;
+
+static SDL_bool
+ShouldUseTextureFramebuffer()
+{
+ const char *hint;
+
+ /* If there's no native framebuffer support then there's no option */
+ if (!_this->CreateWindowFramebuffer) {
+ return SDL_TRUE;
+ }
+
+ /* If this is the dummy driver there is no texture support */
+ if (_this->is_dummy) {
+ return SDL_FALSE;
+ }
+
+ /* If the user has specified a software renderer we can't use a
+ texture framebuffer, or renderer creation will go recursive.
+ */
+ hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
+ if (hint && SDL_strcasecmp(hint, "software") == 0) {
+ return SDL_FALSE;
+ }
+
+ /* See if the user or application wants a specific behavior */
+ hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION);
+ if (hint) {
+ if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
+ return SDL_FALSE;
+ } else {
+ return SDL_TRUE;
+ }
+ }
+
+ /* Each platform has different performance characteristics */
+#if defined(__WIN32__)
+ /* GDI BitBlt() is way faster than Direct3D dynamic textures right now.
+ */
+ return SDL_FALSE;
+
+#elif defined(__MACOSX__)
+ /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */
+ return SDL_TRUE;
+
+#elif defined(__LINUX__)
+ /* Properly configured OpenGL drivers are faster than MIT-SHM */
+#if SDL_VIDEO_OPENGL
+ /* Ugh, find a way to cache this value! */
+ {
+ SDL_Window *window;
+ SDL_GLContext context;
+ SDL_bool hasAcceleratedOpenGL = SDL_FALSE;
+
+ window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN);
+ if (window) {
+ context = SDL_GL_CreateContext(window);
+ if (context) {
+ const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
+ const char *vendor = NULL;
+
+ glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ if (glGetStringFunc) {
+ vendor = (const char *) glGetStringFunc(GL_VENDOR);
+ }
+ /* Add more vendors here at will... */
+ if (vendor &&
+ (SDL_strstr(vendor, "ATI Technologies") ||
+ SDL_strstr(vendor, "NVIDIA"))) {
+ hasAcceleratedOpenGL = SDL_TRUE;
+ }
+ SDL_GL_DeleteContext(context);
+ }
+ SDL_DestroyWindow(window);
+ }
+ return hasAcceleratedOpenGL;
+ }
+#elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ /* Let's be optimistic about this! */
+ return SDL_TRUE;
+#else
+ return SDL_FALSE;
+#endif
+
+#else
+ /* Play it safe, assume that if there is a framebuffer driver that it's
+ optimized for the current platform.
+ */
+ return SDL_FALSE;
+#endif
+}
+
+static int
+SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch)
+{
+ SDL_WindowTextureData *data;
+
+ data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
+ if (!data) {
+ SDL_Renderer *renderer = NULL;
+ int i;
+ const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION);
+
+ /* Check to see if there's a specific driver requested */
+ if (hint && *hint != '0' && *hint != '1' &&
+ SDL_strcasecmp(hint, "true") != 0 &&
+ SDL_strcasecmp(hint, "false") != 0 &&
+ SDL_strcasecmp(hint, "software") != 0) {
+ for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
+ SDL_RendererInfo info;
+ SDL_GetRenderDriverInfo(i, &info);
+ if (SDL_strcasecmp(info.name, hint) == 0) {
+ renderer = SDL_CreateRenderer(window, i, 0);
+ break;
+ }
+ }
+ }
+
+ if (!renderer) {
+ for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
+ SDL_RendererInfo info;
+ SDL_GetRenderDriverInfo(i, &info);
+ if (SDL_strcmp(info.name, "software") != 0) {
+ renderer = SDL_CreateRenderer(window, i, 0);
+ if (renderer) {
+ break;
+ }
+ }
+ }
+ }
+ if (!renderer) {
+ return SDL_SetError("No hardware accelerated renderers available");
+ }
+
+ /* Create the data after we successfully create the renderer (bug #1116) */
+ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ SDL_DestroyRenderer(renderer);
+ return SDL_OutOfMemory();
+ }
+ SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data);
+
+ data->renderer = renderer;
+ }
+
+ /* Free any old texture and pixel data */
+ if (data->texture) {
+ SDL_DestroyTexture(data->texture);
+ data->texture = NULL;
+ }
+ SDL_free(data->pixels);
+ data->pixels = NULL;
+
+ {
+ SDL_RendererInfo info;
+ Uint32 i;
+
+ if (SDL_GetRendererInfo(data->renderer, &info) < 0) {
+ return -1;
+ }
+
+ /* Find the first format without an alpha channel */
+ *format = info.texture_formats[0];
+
+ for (i = 0; i < info.num_texture_formats; ++i) {
+ if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) &&
+ !SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) {
+ *format = info.texture_formats[i];
+ break;
+ }
+ }
+ }
+
+ data->texture = SDL_CreateTexture(data->renderer, *format,
+ SDL_TEXTUREACCESS_STREAMING,
+ window->w, window->h);
+ if (!data->texture) {
+ return -1;
+ }
+
+ /* Create framebuffer data */
+ data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format);
+ data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3);
+
+ {
+ /* Make static analysis happy about potential malloc(0) calls. */
+ const size_t allocsize = window->h * data->pitch;
+ data->pixels = SDL_malloc((allocsize > 0) ? allocsize : 1);
+ if (!data->pixels) {
+ return SDL_OutOfMemory();
+ }
+ }
+
+ *pixels = data->pixels;
+ *pitch = data->pitch;
+
+ /* Make sure we're not double-scaling the viewport */
+ SDL_RenderSetViewport(data->renderer, NULL);
+
+ return 0;
+}
+
+static int
+SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, const SDL_Rect * rects, int numrects)
+{
+ SDL_WindowTextureData *data;
+ SDL_Rect rect;
+ void *src;
+
+ data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
+ if (!data || !data->texture) {
+ return SDL_SetError("No window texture data");
+ }
+
+ /* Update a single rect that contains subrects for best DMA performance */
+ if (SDL_GetSpanEnclosingRect(window->w, window->h, numrects, rects, &rect)) {
+ src = (void *)((Uint8 *)data->pixels +
+ rect.y * data->pitch +
+ rect.x * data->bytes_per_pixel);
+ if (SDL_UpdateTexture(data->texture, &rect, src, data->pitch) < 0) {
+ return -1;
+ }
+
+ if (SDL_RenderCopy(data->renderer, data->texture, NULL, NULL) < 0) {
+ return -1;
+ }
+
+ SDL_RenderPresent(data->renderer);
+ }
+ return 0;
+}
+
+static void
+SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window * window)
+{
+ SDL_WindowTextureData *data;
+
+ data = SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, NULL);
+ if (!data) {
+ return;
+ }
+ if (data->texture) {
+ SDL_DestroyTexture(data->texture);
+ }
+ if (data->renderer) {
+ SDL_DestroyRenderer(data->renderer);
+ }
+ SDL_free(data->pixels);
+ SDL_free(data);
+}
+
+
+static int
+cmpmodes(const void *A, const void *B)
+{
+ const SDL_DisplayMode *a = (const SDL_DisplayMode *) A;
+ const SDL_DisplayMode *b = (const SDL_DisplayMode *) B;
+ if (a == b) {
+ return 0;
+ } else if (a->w != b->w) {
+ return b->w - a->w;
+ } else if (a->h != b->h) {
+ return b->h - a->h;
+ } else if (SDL_BITSPERPIXEL(a->format) != SDL_BITSPERPIXEL(b->format)) {
+ return SDL_BITSPERPIXEL(b->format) - SDL_BITSPERPIXEL(a->format);
+ } else if (SDL_PIXELLAYOUT(a->format) != SDL_PIXELLAYOUT(b->format)) {
+ return SDL_PIXELLAYOUT(b->format) - SDL_PIXELLAYOUT(a->format);
+ } else if (a->refresh_rate != b->refresh_rate) {
+ return b->refresh_rate - a->refresh_rate;
+ }
+ return 0;
+}
+
+static int
+SDL_UninitializedVideo()
+{
+ return SDL_SetError("Video subsystem has not been initialized");
+}
+
+int
+SDL_GetNumVideoDrivers(void)
+{
+ return SDL_arraysize(bootstrap) - 1;
+}
+
+const char *
+SDL_GetVideoDriver(int index)
+{
+ if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
+ return bootstrap[index]->name;
+ }
+ return NULL;
+}
+
+/*
+ * Initialize the video and event subsystems -- determine native pixel format
+ */
+int
+SDL_VideoInit(const char *driver_name)
+{
+ SDL_VideoDevice *video;
+ int index;
+ int i;
+
+ /* Check to make sure we don't overwrite '_this' */
+ if (_this != NULL) {
+ SDL_VideoQuit();
+ }
+
+#if !SDL_TIMERS_DISABLED
+ SDL_TicksInit();
+#endif
+
+ /* Start the event loop */
+ if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0 ||
+ SDL_KeyboardInit() < 0 ||
+ SDL_MouseInit() < 0 ||
+ SDL_TouchInit() < 0) {
+ return -1;
+ }
+
+ /* Select the proper video driver */
+ index = 0;
+ video = NULL;
+ if (driver_name == NULL) {
+ driver_name = SDL_getenv("SDL_VIDEODRIVER");
+ }
+ if (driver_name != NULL) {
+ for (i = 0; bootstrap[i]; ++i) {
+ if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
+ if (bootstrap[i]->available()) {
+ video = bootstrap[i]->create(index);
+ break;
+ }
+ }
+ }
+ } else {
+ for (i = 0; bootstrap[i]; ++i) {
+ if (bootstrap[i]->available()) {
+ video = bootstrap[i]->create(index);
+ if (video != NULL) {
+ break;
+ }
+ }
+ }
+ }
+ if (video == NULL) {
+ if (driver_name) {
+ return SDL_SetError("%s not available", driver_name);
+ }
+ return SDL_SetError("No available video device");
+ }
+ _this = video;
+ _this->name = bootstrap[i]->name;
+ _this->next_object_id = 1;
+
+
+ /* Set some very sane GL defaults */
+ _this->gl_config.driver_loaded = 0;
+ _this->gl_config.dll_handle = NULL;
+ SDL_GL_ResetAttributes();
+
+ _this->current_glwin_tls = SDL_TLSCreate();
+ _this->current_glctx_tls = SDL_TLSCreate();
+
+ /* Initialize the video subsystem */
+ if (_this->VideoInit(_this) < 0) {
+ SDL_VideoQuit();
+ return -1;
+ }
+
+ /* Make sure some displays were added */
+ if (_this->num_displays == 0) {
+ SDL_VideoQuit();
+ return SDL_SetError("The video driver did not add any displays");
+ }
+
+ /* Add the renderer framebuffer emulation if desired */
+ if (ShouldUseTextureFramebuffer()) {
+ _this->CreateWindowFramebuffer = SDL_CreateWindowTexture;
+ _this->UpdateWindowFramebuffer = SDL_UpdateWindowTexture;
+ _this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture;
+ }
+
+ /* Disable the screen saver by default. This is a change from <= 2.0.1,
+ but most things using SDL are games or media players; you wouldn't
+ want a screensaver to trigger if you're playing exclusively with a
+ joystick, or passively watching a movie. Things that use SDL but
+ function more like a normal desktop app should explicitly reenable the
+ screensaver. */
+ if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, SDL_FALSE)) {
+ SDL_DisableScreenSaver();
+ }
+
+ /* If we don't use a screen keyboard, turn on text input by default,
+ otherwise programs that expect to get text events without enabling
+ UNICODE input won't get any events.
+
+ Actually, come to think of it, you needed to call SDL_EnableUNICODE(1)
+ in SDL 1.2 before you got text input events. Hmm...
+ */
+ if (!SDL_HasScreenKeyboardSupport()) {
+ SDL_StartTextInput();
+ }
+
+ /* We're ready to go! */
+ return 0;
+}
+
+const char *
+SDL_GetCurrentVideoDriver()
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ return _this->name;
+}
+
+SDL_VideoDevice *
+SDL_GetVideoDevice(void)
+{
+ return _this;
+}
+
+int
+SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode)
+{
+ SDL_VideoDisplay display;
+
+ SDL_zero(display);
+ if (desktop_mode) {
+ display.desktop_mode = *desktop_mode;
+ }
+ display.current_mode = display.desktop_mode;
+
+ return SDL_AddVideoDisplay(&display);
+}
+
+int
+SDL_AddVideoDisplay(const SDL_VideoDisplay * display)
+{
+ SDL_VideoDisplay *displays;
+ int index = -1;
+
+ displays =
+ SDL_realloc(_this->displays,
+ (_this->num_displays + 1) * sizeof(*displays));
+ if (displays) {
+ index = _this->num_displays++;
+ displays[index] = *display;
+ displays[index].device = _this;
+ _this->displays = displays;
+
+ if (display->name) {
+ displays[index].name = SDL_strdup(display->name);
+ } else {
+ char name[32];
+
+ SDL_itoa(index, name, 10);
+ displays[index].name = SDL_strdup(name);
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+ return index;
+}
+
+int
+SDL_GetNumVideoDisplays(void)
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return 0;
+ }
+ return _this->num_displays;
+}
+
+static int
+SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
+{
+ int displayIndex;
+
+ for (displayIndex = 0; displayIndex < _this->num_displays; ++displayIndex) {
+ if (display == &_this->displays[displayIndex]) {
+ return displayIndex;
+ }
+ }
+
+ /* Couldn't find the display, just use index 0 */
+ return 0;
+}
+
+void *
+SDL_GetDisplayDriverData(int displayIndex)
+{
+ CHECK_DISPLAY_INDEX(displayIndex, NULL);
+
+ return _this->displays[displayIndex].driverdata;
+}
+
+const char *
+SDL_GetDisplayName(int displayIndex)
+{
+ CHECK_DISPLAY_INDEX(displayIndex, NULL);
+
+ return _this->displays[displayIndex].name;
+}
+
+int
+SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
+{
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ if (rect) {
+ SDL_VideoDisplay *display = &_this->displays[displayIndex];
+
+ if (_this->GetDisplayBounds) {
+ if (_this->GetDisplayBounds(_this, display, rect) == 0) {
+ return 0;
+ }
+ }
+
+ /* Assume that the displays are left to right */
+ if (displayIndex == 0) {
+ rect->x = 0;
+ rect->y = 0;
+ } else {
+ SDL_GetDisplayBounds(displayIndex-1, rect);
+ rect->x += rect->w;
+ }
+ rect->w = display->current_mode.w;
+ rect->h = display->current_mode.h;
+ }
+ return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
+}
+
+int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect)
+{
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ if (rect) {
+ SDL_VideoDisplay *display = &_this->displays[displayIndex];
+
+ if (_this->GetDisplayUsableBounds) {
+ if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) {
+ return 0;
+ }
+ }
+
+ /* Oh well, just give the entire display bounds. */
+ return SDL_GetDisplayBounds(displayIndex, rect);
+ }
+ return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
+}
+
+int
+SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ display = &_this->displays[displayIndex];
+
+ if (_this->GetDisplayDPI) {
+ if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) {
+ return 0;
+ }
+ } else {
+ return SDL_Unsupported();
+ }
+
+ return -1;
+}
+
+SDL_bool
+SDL_AddDisplayMode(SDL_VideoDisplay * display, const SDL_DisplayMode * mode)
+{
+ SDL_DisplayMode *modes;
+ int i, nmodes;
+
+ /* Make sure we don't already have the mode in the list */
+ modes = display->display_modes;
+ nmodes = display->num_display_modes;
+ for (i = 0; i < nmodes; ++i) {
+ if (cmpmodes(mode, &modes[i]) == 0) {
+ return SDL_FALSE;
+ }
+ }
+
+ /* Go ahead and add the new mode */
+ if (nmodes == display->max_display_modes) {
+ modes =
+ SDL_realloc(modes,
+ (display->max_display_modes + 32) * sizeof(*modes));
+ if (!modes) {
+ return SDL_FALSE;
+ }
+ display->display_modes = modes;
+ display->max_display_modes += 32;
+ }
+ modes[nmodes] = *mode;
+ display->num_display_modes++;
+
+ /* Re-sort video modes */
+ SDL_qsort(display->display_modes, display->num_display_modes,
+ sizeof(SDL_DisplayMode), cmpmodes);
+
+ return SDL_TRUE;
+}
+
+static int
+SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display)
+{
+ if (!display->num_display_modes && _this->GetDisplayModes) {
+ _this->GetDisplayModes(_this, display);
+ SDL_qsort(display->display_modes, display->num_display_modes,
+ sizeof(SDL_DisplayMode), cmpmodes);
+ }
+ return display->num_display_modes;
+}
+
+int
+SDL_GetNumDisplayModes(int displayIndex)
+{
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ return SDL_GetNumDisplayModesForDisplay(&_this->displays[displayIndex]);
+}
+
+int
+SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode * mode)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ display = &_this->displays[displayIndex];
+ if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) {
+ return SDL_SetError("index must be in the range of 0 - %d",
+ SDL_GetNumDisplayModesForDisplay(display) - 1);
+ }
+ if (mode) {
+ *mode = display->display_modes[index];
+ }
+ return 0;
+}
+
+int
+SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ display = &_this->displays[displayIndex];
+ if (mode) {
+ *mode = display->desktop_mode;
+ }
+ return 0;
+}
+
+int
+SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_DISPLAY_INDEX(displayIndex, -1);
+
+ display = &_this->displays[displayIndex];
+ if (mode) {
+ *mode = display->current_mode;
+ }
+ return 0;
+}
+
+static SDL_DisplayMode *
+SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display,
+ const SDL_DisplayMode * mode,
+ SDL_DisplayMode * closest)
+{
+ Uint32 target_format;
+ int target_refresh_rate;
+ int i;
+ SDL_DisplayMode *current, *match;
+
+ if (!mode || !closest) {
+ SDL_SetError("Missing desired mode or closest mode parameter");
+ return NULL;
+ }
+
+ /* Default to the desktop format */
+ if (mode->format) {
+ target_format = mode->format;
+ } else {
+ target_format = display->desktop_mode.format;
+ }
+
+ /* Default to the desktop refresh rate */
+ if (mode->refresh_rate) {
+ target_refresh_rate = mode->refresh_rate;
+ } else {
+ target_refresh_rate = display->desktop_mode.refresh_rate;
+ }
+
+ match = NULL;
+ for (i = 0; i < SDL_GetNumDisplayModesForDisplay(display); ++i) {
+ current = &display->display_modes[i];
+
+ if (current->w && (current->w < mode->w)) {
+ /* Out of sorted modes large enough here */
+ break;
+ }
+ if (current->h && (current->h < mode->h)) {
+ if (current->w && (current->w == mode->w)) {
+ /* Out of sorted modes large enough here */
+ break;
+ }
+ /* Wider, but not tall enough, due to a different
+ aspect ratio. This mode must be skipped, but closer
+ modes may still follow. */
+ continue;
+ }
+ if (!match || current->w < match->w || current->h < match->h) {
+ match = current;
+ continue;
+ }
+ if (current->format != match->format) {
+ /* Sorted highest depth to lowest */
+ if (current->format == target_format ||
+ (SDL_BITSPERPIXEL(current->format) >=
+ SDL_BITSPERPIXEL(target_format)
+ && SDL_PIXELTYPE(current->format) ==
+ SDL_PIXELTYPE(target_format))) {
+ match = current;
+ }
+ continue;
+ }
+ if (current->refresh_rate != match->refresh_rate) {
+ /* Sorted highest refresh to lowest */
+ if (current->refresh_rate >= target_refresh_rate) {
+ match = current;
+ }
+ }
+ }
+ if (match) {
+ if (match->format) {
+ closest->format = match->format;
+ } else {
+ closest->format = mode->format;
+ }
+ if (match->w && match->h) {
+ closest->w = match->w;
+ closest->h = match->h;
+ } else {
+ closest->w = mode->w;
+ closest->h = mode->h;
+ }
+ if (match->refresh_rate) {
+ closest->refresh_rate = match->refresh_rate;
+ } else {
+ closest->refresh_rate = mode->refresh_rate;
+ }
+ closest->driverdata = match->driverdata;
+
+ /*
+ * Pick some reasonable defaults if the app and driver don't
+ * care
+ */
+ if (!closest->format) {
+ closest->format = SDL_PIXELFORMAT_RGB888;
+ }
+ if (!closest->w) {
+ closest->w = 640;
+ }
+ if (!closest->h) {
+ closest->h = 480;
+ }
+ return closest;
+ }
+ return NULL;
+}
+
+SDL_DisplayMode *
+SDL_GetClosestDisplayMode(int displayIndex,
+ const SDL_DisplayMode * mode,
+ SDL_DisplayMode * closest)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_DISPLAY_INDEX(displayIndex, NULL);
+
+ display = &_this->displays[displayIndex];
+ return SDL_GetClosestDisplayModeForDisplay(display, mode, closest);
+}
+
+static int
+SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode)
+{
+ SDL_DisplayMode display_mode;
+ SDL_DisplayMode current_mode;
+
+ if (mode) {
+ display_mode = *mode;
+
+ /* Default to the current mode */
+ if (!display_mode.format) {
+ display_mode.format = display->current_mode.format;
+ }
+ if (!display_mode.w) {
+ display_mode.w = display->current_mode.w;
+ }
+ if (!display_mode.h) {
+ display_mode.h = display->current_mode.h;
+ }
+ if (!display_mode.refresh_rate) {
+ display_mode.refresh_rate = display->current_mode.refresh_rate;
+ }
+
+ /* Get a good video mode, the closest one possible */
+ if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) {
+ return SDL_SetError("No video mode large enough for %dx%d",
+ display_mode.w, display_mode.h);
+ }
+ } else {
+ display_mode = display->desktop_mode;
+ }
+
+ /* See if there's anything left to do */
+ current_mode = display->current_mode;
+ if (SDL_memcmp(&display_mode, &current_mode, sizeof(display_mode)) == 0) {
+ return 0;
+ }
+
+ /* Actually change the display mode */
+ if (!_this->SetDisplayMode) {
+ return SDL_SetError("Video driver doesn't support changing display mode");
+ }
+ if (_this->SetDisplayMode(_this, display, &display_mode) < 0) {
+ return -1;
+ }
+ display->current_mode = display_mode;
+ return 0;
+}
+
+int
+SDL_GetWindowDisplayIndex(SDL_Window * window)
+{
+ int displayIndex;
+ int i, dist;
+ int closest = -1;
+ int closest_dist = 0x7FFFFFFF;
+ SDL_Point center;
+ SDL_Point delta;
+ SDL_Rect rect;
+
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (SDL_WINDOWPOS_ISUNDEFINED(window->x) ||
+ SDL_WINDOWPOS_ISCENTERED(window->x)) {
+ displayIndex = (window->x & 0xFFFF);
+ if (displayIndex >= _this->num_displays) {
+ displayIndex = 0;
+ }
+ return displayIndex;
+ }
+ if (SDL_WINDOWPOS_ISUNDEFINED(window->y) ||
+ SDL_WINDOWPOS_ISCENTERED(window->y)) {
+ displayIndex = (window->y & 0xFFFF);
+ if (displayIndex >= _this->num_displays) {
+ displayIndex = 0;
+ }
+ return displayIndex;
+ }
+
+ /* Find the display containing the window */
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+
+ if (display->fullscreen_window == window) {
+ return i;
+ }
+ }
+ center.x = window->x + window->w / 2;
+ center.y = window->y + window->h / 2;
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_GetDisplayBounds(i, &rect);
+ if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
+ return i;
+ }
+
+ delta.x = center.x - (rect.x + rect.w / 2);
+ delta.y = center.y - (rect.y + rect.h / 2);
+ dist = (delta.x*delta.x + delta.y*delta.y);
+ if (dist < closest_dist) {
+ closest = i;
+ closest_dist = dist;
+ }
+ }
+ if (closest < 0) {
+ SDL_SetError("Couldn't find any displays");
+ }
+ return closest;
+}
+
+SDL_VideoDisplay *
+SDL_GetDisplayForWindow(SDL_Window *window)
+{
+ int displayIndex = SDL_GetWindowDisplayIndex(window);
+ if (displayIndex >= 0) {
+ return &_this->displays[displayIndex];
+ } else {
+ return NULL;
+ }
+}
+
+int
+SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (mode) {
+ window->fullscreen_mode = *mode;
+ } else {
+ SDL_zero(window->fullscreen_mode);
+ }
+
+ if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ SDL_DisplayMode fullscreen_mode;
+ if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
+ SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode);
+ }
+ }
+ return 0;
+}
+
+int
+SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
+{
+ SDL_DisplayMode fullscreen_mode;
+ SDL_VideoDisplay *display;
+
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!mode) {
+ return SDL_InvalidParamError("mode");
+ }
+
+ fullscreen_mode = window->fullscreen_mode;
+ if (!fullscreen_mode.w) {
+ fullscreen_mode.w = window->windowed.w;
+ }
+ if (!fullscreen_mode.h) {
+ fullscreen_mode.h = window->windowed.h;
+ }
+
+ display = SDL_GetDisplayForWindow(window);
+
+ /* if in desktop size mode, just return the size of the desktop */
+ if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ fullscreen_mode = display->desktop_mode;
+ } else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
+ &fullscreen_mode,
+ &fullscreen_mode)) {
+ return SDL_SetError("Couldn't find display mode match");
+ }
+
+ if (mode) {
+ *mode = fullscreen_mode;
+ }
+ return 0;
+}
+
+Uint32
+SDL_GetWindowPixelFormat(SDL_Window * window)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_WINDOW_MAGIC(window, SDL_PIXELFORMAT_UNKNOWN);
+
+ display = SDL_GetDisplayForWindow(window);
+ return display->current_mode.format;
+}
+
+static void
+SDL_RestoreMousePosition(SDL_Window *window)
+{
+ int x, y;
+
+ if (window == SDL_GetMouseFocus()) {
+ SDL_GetMouseState(&x, &y);
+ SDL_WarpMouseInWindow(window, x, y);
+ }
+}
+
+#if __WINRT__
+extern Uint32 WINRT_DetectWindowFlags(SDL_Window * window);
+#endif
+
+static int
+SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
+{
+ SDL_VideoDisplay *display;
+ SDL_Window *other;
+
+ CHECK_WINDOW_MAGIC(window,-1);
+
+ /* if we are in the process of hiding don't go back to fullscreen */
+ if (window->is_hiding && fullscreen) {
+ return 0;
+ }
+
+#ifdef __MACOSX__
+ /* if the window is going away and no resolution change is necessary,
+ do nothing, or else we may trigger an ugly double-transition
+ */
+ if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
+ if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
+ return 0;
+
+ /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
+ if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
+ if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
+ return -1;
+ }
+ } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
+ display = SDL_GetDisplayForWindow(window);
+ SDL_SetDisplayModeForDisplay(display, NULL);
+ if (_this->SetWindowFullscreen) {
+ _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
+ }
+ }
+
+ if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
+ if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
+ return -1;
+ }
+ window->last_fullscreen_flags = window->flags;
+ return 0;
+ }
+ }
+#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
+ /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
+ or not. The user can choose this, via OS-provided UI, but this can't
+ be set programmatically.
+
+ Just look at what SDL's WinRT video backend code detected with regards
+ to fullscreen (being active, or not), and figure out a return/error code
+ from that.
+ */
+ if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) {
+ /* Uh oh, either:
+ 1. fullscreen was requested, and we're already windowed
+ 2. windowed-mode was requested, and we're already fullscreen
+
+ WinRT 8.x can't resolve either programmatically, so we're
+ giving up.
+ */
+ return -1;
+ } else {
+ /* Whatever was requested, fullscreen or windowed mode, is already
+ in-place.
+ */
+ return 0;
+ }
+#endif
+
+ display = SDL_GetDisplayForWindow(window);
+
+ if (fullscreen) {
+ /* Hide any other fullscreen windows */
+ if (display->fullscreen_window &&
+ display->fullscreen_window != window) {
+ SDL_MinimizeWindow(display->fullscreen_window);
+ }
+ }
+
+ /* See if anything needs to be done now */
+ if ((display->fullscreen_window == window) == fullscreen) {
+ if ((window->last_fullscreen_flags & FULLSCREEN_MASK) == (window->flags & FULLSCREEN_MASK)) {
+ return 0;
+ }
+ }
+
+ /* See if there are any fullscreen windows */
+ for (other = _this->windows; other; other = other->next) {
+ SDL_bool setDisplayMode = SDL_FALSE;
+
+ if (other == window) {
+ setDisplayMode = fullscreen;
+ } else if (FULLSCREEN_VISIBLE(other) &&
+ SDL_GetDisplayForWindow(other) == display) {
+ setDisplayMode = SDL_TRUE;
+ }
+
+ if (setDisplayMode) {
+ SDL_DisplayMode fullscreen_mode;
+
+ SDL_zero(fullscreen_mode);
+
+ if (SDL_GetWindowDisplayMode(other, &fullscreen_mode) == 0) {
+ SDL_bool resized = SDL_TRUE;
+
+ if (other->w == fullscreen_mode.w && other->h == fullscreen_mode.h) {
+ resized = SDL_FALSE;
+ }
+
+ /* only do the mode change if we want exclusive fullscreen */
+ if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) {
+ return -1;
+ }
+ } else {
+ if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) {
+ return -1;
+ }
+ }
+
+ if (_this->SetWindowFullscreen) {
+ _this->SetWindowFullscreen(_this, other, display, SDL_TRUE);
+ }
+ display->fullscreen_window = other;
+
+ /* Generate a mode change event here */
+ if (resized) {
+ SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED,
+ fullscreen_mode.w, fullscreen_mode.h);
+ } else {
+ SDL_OnWindowResized(other);
+ }
+
+ SDL_RestoreMousePosition(other);
+
+ window->last_fullscreen_flags = window->flags;
+ return 0;
+ }
+ }
+ }
+
+ /* Nope, restore the desktop mode */
+ SDL_SetDisplayModeForDisplay(display, NULL);
+
+ if (_this->SetWindowFullscreen) {
+ _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
+ }
+ display->fullscreen_window = NULL;
+
+ /* Generate a mode change event here */
+ SDL_OnWindowResized(window);
+
+ /* Restore the cursor position */
+ SDL_RestoreMousePosition(window);
+
+ window->last_fullscreen_flags = window->flags;
+ return 0;
+}
+
+#define CREATE_FLAGS \
+ (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN)
+
+static void
+SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
+{
+ if (flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_MaximizeWindow(window);
+ }
+ if (flags & SDL_WINDOW_MINIMIZED) {
+ SDL_MinimizeWindow(window);
+ }
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_SetWindowFullscreen(window, flags);
+ }
+ if (flags & SDL_WINDOW_INPUT_GRABBED) {
+ SDL_SetWindowGrab(window, SDL_TRUE);
+ }
+ if (!(flags & SDL_WINDOW_HIDDEN)) {
+ SDL_ShowWindow(window);
+ }
+}
+
+SDL_Window *
+SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
+{
+ SDL_Window *window;
+
+ if (!_this) {
+ /* Initialize the video system if needed */
+ if (SDL_VideoInit(NULL) < 0) {
+ return NULL;
+ }
+ }
+
+ if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) {
+ SDL_SetError("Conflicting window flags specified");
+ return NULL;
+ }
+
+ /* Some platforms can't create zero-sized windows */
+ if (w < 1) {
+ w = 1;
+ }
+ if (h < 1) {
+ h = 1;
+ }
+
+ /* Some platforms blow up if the windows are too large. Raise it later? */
+ if ((w > 16384) || (h > 16384)) {
+ SDL_SetError("Window is too large.");
+ return NULL;
+ }
+
+ /* Some platforms have OpenGL enabled by default */
+#if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
+ if (!_this->is_dummy && !(flags & SDL_WINDOW_VULKAN)) {
+ flags |= SDL_WINDOW_OPENGL;
+ }
+#endif
+ if (flags & SDL_WINDOW_OPENGL) {
+ if (!_this->GL_CreateContext) {
+ SDL_SetError("No OpenGL support in video driver");
+ return NULL;
+ }
+ if (SDL_GL_LoadLibrary(NULL) < 0) {
+ return NULL;
+ }
+ }
+
+ if (flags & SDL_WINDOW_VULKAN) {
+ if (!_this->Vulkan_CreateSurface) {
+ SDL_SetError("Vulkan support is either not configured in SDL "
+ "or not available in video driver");
+ return NULL;
+ }
+ if (flags & SDL_WINDOW_OPENGL) {
+ SDL_SetError("Vulkan and OpenGL not supported on same window");
+ return NULL;
+ }
+ if (SDL_Vulkan_LoadLibrary(NULL) < 0) {
+ return NULL;
+ }
+ }
+
+ /* Unless the user has specified the high-DPI disabling hint, respect the
+ * SDL_WINDOW_ALLOW_HIGHDPI flag.
+ */
+ if (flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ if (SDL_GetHintBoolean(SDL_HINT_VIDEO_HIGHDPI_DISABLED, SDL_FALSE)) {
+ flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
+ }
+ }
+
+ window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
+ if (!window) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ window->magic = &_this->window_magic;
+ window->id = _this->next_object_id++;
+ window->x = x;
+ window->y = y;
+ window->w = w;
+ window->h = h;
+ if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISUNDEFINED(y) ||
+ SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ int displayIndex;
+ SDL_Rect bounds;
+
+ displayIndex = SDL_GetIndexOfDisplay(display);
+ SDL_GetDisplayBounds(displayIndex, &bounds);
+ if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) {
+ window->x = bounds.x + (bounds.w - w) / 2;
+ }
+ if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) {
+ window->y = bounds.y + (bounds.h - h) / 2;
+ }
+ }
+ window->windowed.x = window->x;
+ window->windowed.y = window->y;
+ window->windowed.w = window->w;
+ window->windowed.h = window->h;
+
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ int displayIndex;
+ SDL_Rect bounds;
+
+ displayIndex = SDL_GetIndexOfDisplay(display);
+ SDL_GetDisplayBounds(displayIndex, &bounds);
+
+ window->x = bounds.x;
+ window->y = bounds.y;
+ window->w = bounds.w;
+ window->h = bounds.h;
+ }
+
+ window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
+ window->last_fullscreen_flags = window->flags;
+ window->opacity = 1.0f;
+ window->brightness = 1.0f;
+ window->next = _this->windows;
+ window->is_destroying = SDL_FALSE;
+
+ if (_this->windows) {
+ _this->windows->prev = window;
+ }
+ _this->windows = window;
+
+ if (_this->CreateSDLWindow && _this->CreateSDLWindow(_this, window) < 0) {
+ SDL_DestroyWindow(window);
+ return NULL;
+ }
+
+#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
+ /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
+ or not. The user can choose this, via OS-provided UI, but this can't
+ be set programmatically.
+
+ Just look at what SDL's WinRT video backend code detected with regards
+ to fullscreen (being active, or not), and figure out a return/error code
+ from that.
+ */
+ flags = window->flags;
+#endif
+
+ if (title) {
+ SDL_SetWindowTitle(window, title);
+ }
+ SDL_FinishWindowCreation(window, flags);
+
+ /* If the window was created fullscreen, make sure the mode code matches */
+ SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
+
+ return window;
+}
+
+SDL_Window *
+SDL_CreateWindowFrom(const void *data)
+{
+ SDL_Window *window;
+
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ if (!_this->CreateSDLWindowFrom) {
+ SDL_Unsupported();
+ return NULL;
+ }
+ window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
+ if (!window) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ window->magic = &_this->window_magic;
+ window->id = _this->next_object_id++;
+ window->flags = SDL_WINDOW_FOREIGN;
+ window->last_fullscreen_flags = window->flags;
+ window->is_destroying = SDL_FALSE;
+ window->opacity = 1.0f;
+ window->brightness = 1.0f;
+ window->next = _this->windows;
+ if (_this->windows) {
+ _this->windows->prev = window;
+ }
+ _this->windows = window;
+
+ if (_this->CreateSDLWindowFrom(_this, window, data) < 0) {
+ SDL_DestroyWindow(window);
+ return NULL;
+ }
+ return window;
+}
+
+int
+SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
+{
+ SDL_bool loaded_opengl = SDL_FALSE;
+
+ if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
+ return SDL_SetError("No OpenGL support in video driver");
+ }
+
+ if (window->flags & SDL_WINDOW_FOREIGN) {
+ /* Can't destroy and re-create foreign windows, hrm */
+ flags |= SDL_WINDOW_FOREIGN;
+ } else {
+ flags &= ~SDL_WINDOW_FOREIGN;
+ }
+
+ /* Restore video mode, etc. */
+ SDL_HideWindow(window);
+
+ /* Tear down the old native window */
+ if (window->surface) {
+ window->surface->flags &= ~SDL_DONTFREE;
+ SDL_FreeSurface(window->surface);
+ window->surface = NULL;
+ }
+ if (_this->DestroyWindowFramebuffer) {
+ _this->DestroyWindowFramebuffer(_this, window);
+ }
+ if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
+ _this->DestroyWindow(_this, window);
+ }
+
+ if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) {
+ if (flags & SDL_WINDOW_OPENGL) {
+ if (SDL_GL_LoadLibrary(NULL) < 0) {
+ return -1;
+ }
+ loaded_opengl = SDL_TRUE;
+ } else {
+ SDL_GL_UnloadLibrary();
+ }
+ }
+
+ if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) {
+ SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag");
+ return -1;
+ }
+
+ if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) {
+ SDL_SetError("Vulkan and OpenGL not supported on same window");
+ return -1;
+ }
+
+ window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
+ window->last_fullscreen_flags = window->flags;
+ window->is_destroying = SDL_FALSE;
+
+ if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) {
+ if (_this->CreateSDLWindow(_this, window) < 0) {
+ if (loaded_opengl) {
+ SDL_GL_UnloadLibrary();
+ window->flags &= ~SDL_WINDOW_OPENGL;
+ }
+ return -1;
+ }
+ }
+
+ if (flags & SDL_WINDOW_FOREIGN) {
+ window->flags |= SDL_WINDOW_FOREIGN;
+ }
+
+ if (_this->SetWindowTitle && window->title) {
+ _this->SetWindowTitle(_this, window);
+ }
+
+ if (_this->SetWindowIcon && window->icon) {
+ _this->SetWindowIcon(_this, window, window->icon);
+ }
+
+ if (window->hit_test) {
+ _this->SetWindowHitTest(window, SDL_TRUE);
+ }
+
+ SDL_FinishWindowCreation(window, flags);
+
+ return 0;
+}
+
+SDL_bool
+SDL_HasWindows(void)
+{
+ return (_this && _this->windows != NULL);
+}
+
+Uint32
+SDL_GetWindowID(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, 0);
+
+ return window->id;
+}
+
+SDL_Window *
+SDL_GetWindowFromID(Uint32 id)
+{
+ SDL_Window *window;
+
+ if (!_this) {
+ return NULL;
+ }
+ for (window = _this->windows; window; window = window->next) {
+ if (window->id == id) {
+ return window;
+ }
+ }
+ return NULL;
+}
+
+Uint32
+SDL_GetWindowFlags(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, 0);
+
+ return window->flags;
+}
+
+void
+SDL_SetWindowTitle(SDL_Window * window, const char *title)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (title == window->title) {
+ return;
+ }
+ SDL_free(window->title);
+
+ window->title = SDL_strdup(title ? title : "");
+
+ if (_this->SetWindowTitle) {
+ _this->SetWindowTitle(_this, window);
+ }
+}
+
+const char *
+SDL_GetWindowTitle(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, "");
+
+ return window->title ? window->title : "";
+}
+
+void
+SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (!icon) {
+ return;
+ }
+
+ SDL_FreeSurface(window->icon);
+
+ /* Convert the icon into ARGB8888 */
+ window->icon = SDL_ConvertSurfaceFormat(icon, SDL_PIXELFORMAT_ARGB8888, 0);
+ if (!window->icon) {
+ return;
+ }
+
+ if (_this->SetWindowIcon) {
+ _this->SetWindowIcon(_this, window, window->icon);
+ }
+}
+
+void*
+SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata)
+{
+ SDL_WindowUserData *prev, *data;
+
+ CHECK_WINDOW_MAGIC(window, NULL);
+
+ /* Input validation */
+ if (name == NULL || name[0] == '\0') {
+ SDL_InvalidParamError("name");
+ return NULL;
+ }
+
+ /* See if the named data already exists */
+ prev = NULL;
+ for (data = window->data; data; prev = data, data = data->next) {
+ if (data->name && SDL_strcmp(data->name, name) == 0) {
+ void *last_value = data->data;
+
+ if (userdata) {
+ /* Set the new value */
+ data->data = userdata;
+ } else {
+ /* Delete this value */
+ if (prev) {
+ prev->next = data->next;
+ } else {
+ window->data = data->next;
+ }
+ SDL_free(data->name);
+ SDL_free(data);
+ }
+ return last_value;
+ }
+ }
+
+ /* Add new data to the window */
+ if (userdata) {
+ data = (SDL_WindowUserData *)SDL_malloc(sizeof(*data));
+ data->name = SDL_strdup(name);
+ data->data = userdata;
+ data->next = window->data;
+ window->data = data;
+ }
+ return NULL;
+}
+
+void *
+SDL_GetWindowData(SDL_Window * window, const char *name)
+{
+ SDL_WindowUserData *data;
+
+ CHECK_WINDOW_MAGIC(window, NULL);
+
+ /* Input validation */
+ if (name == NULL || name[0] == '\0') {
+ SDL_InvalidParamError("name");
+ return NULL;
+ }
+
+ for (data = window->data; data; data = data->next) {
+ if (data->name && SDL_strcmp(data->name, name) == 0) {
+ return data->data;
+ }
+ }
+ return NULL;
+}
+
+void
+SDL_SetWindowPosition(SDL_Window * window, int x, int y)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
+ int displayIndex = (x & 0xFFFF);
+ SDL_Rect bounds;
+ if (displayIndex >= _this->num_displays) {
+ displayIndex = 0;
+ }
+
+ SDL_zero(bounds);
+
+ SDL_GetDisplayBounds(displayIndex, &bounds);
+ if (SDL_WINDOWPOS_ISCENTERED(x)) {
+ x = bounds.x + (bounds.w - window->w) / 2;
+ }
+ if (SDL_WINDOWPOS_ISCENTERED(y)) {
+ y = bounds.y + (bounds.h - window->h) / 2;
+ }
+ }
+
+ if ((window->flags & SDL_WINDOW_FULLSCREEN)) {
+ if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
+ window->windowed.x = x;
+ }
+ if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
+ window->windowed.y = y;
+ }
+ } else {
+ if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
+ window->x = x;
+ }
+ if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
+ window->y = y;
+ }
+
+ if (_this->SetWindowPosition) {
+ _this->SetWindowPosition(_this, window);
+ }
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
+ }
+}
+
+void
+SDL_GetWindowPosition(SDL_Window * window, int *x, int *y)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ /* Fullscreen windows are always at their display's origin */
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ int displayIndex;
+
+ if (x) {
+ *x = 0;
+ }
+ if (y) {
+ *y = 0;
+ }
+
+ /* Find the window's monitor and update to the
+ monitor offset. */
+ displayIndex = SDL_GetWindowDisplayIndex(window);
+ if (displayIndex >= 0) {
+ SDL_Rect bounds;
+
+ SDL_zero(bounds);
+
+ SDL_GetDisplayBounds(displayIndex, &bounds);
+ if (x) {
+ *x = bounds.x;
+ }
+ if (y) {
+ *y = bounds.y;
+ }
+ }
+ } else {
+ if (x) {
+ *x = window->x;
+ }
+ if (y) {
+ *y = window->y;
+ }
+ }
+}
+
+void
+SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ const int want = (bordered != SDL_FALSE); /* normalize the flag. */
+ const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
+ if ((want != have) && (_this->SetWindowBordered)) {
+ if (want) {
+ window->flags &= ~SDL_WINDOW_BORDERLESS;
+ } else {
+ window->flags |= SDL_WINDOW_BORDERLESS;
+ }
+ _this->SetWindowBordered(_this, window, (SDL_bool) want);
+ }
+ }
+}
+
+void
+SDL_SetWindowResizable(SDL_Window * window, SDL_bool resizable)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ const int want = (resizable != SDL_FALSE); /* normalize the flag. */
+ const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
+ if ((want != have) && (_this->SetWindowResizable)) {
+ if (want) {
+ window->flags |= SDL_WINDOW_RESIZABLE;
+ } else {
+ window->flags &= ~SDL_WINDOW_RESIZABLE;
+ }
+ _this->SetWindowResizable(_this, window, (SDL_bool) want);
+ }
+ }
+}
+
+void
+SDL_SetWindowSize(SDL_Window * window, int w, int h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (w <= 0) {
+ SDL_InvalidParamError("w");
+ return;
+ }
+ if (h <= 0) {
+ SDL_InvalidParamError("h");
+ return;
+ }
+
+ /* Make sure we don't exceed any window size limits */
+ if (window->min_w && w < window->min_w) {
+ w = window->min_w;
+ }
+ if (window->max_w && w > window->max_w) {
+ w = window->max_w;
+ }
+ if (window->min_h && h < window->min_h) {
+ h = window->min_h;
+ }
+ if (window->max_h && h > window->max_h) {
+ h = window->max_h;
+ }
+
+ window->windowed.w = w;
+ window->windowed.h = h;
+
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ window->last_fullscreen_flags = 0;
+ SDL_UpdateFullscreenMode(window, SDL_TRUE);
+ }
+ } else {
+ window->w = w;
+ window->h = h;
+ if (_this->SetWindowSize) {
+ _this->SetWindowSize(_this, window);
+ }
+ if (window->w == w && window->h == h) {
+ /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
+ SDL_OnWindowResized(window);
+ }
+ }
+}
+
+void
+SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (w) {
+ *w = window->w;
+ }
+ if (h) {
+ *h = window->h;
+ }
+}
+
+int
+SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right)
+{
+ int dummy = 0;
+
+ if (!top) { top = &dummy; }
+ if (!left) { left = &dummy; }
+ if (!right) { right = &dummy; }
+ if (!bottom) { bottom = &dummy; }
+
+ /* Always initialize, so applications don't have to care */
+ *top = *left = *bottom = *right = 0;
+
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!_this->GetWindowBordersSize) {
+ return SDL_Unsupported();
+ }
+
+ return _this->GetWindowBordersSize(_this, window, top, left, bottom, right);
+}
+
+void
+SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (min_w <= 0) {
+ SDL_InvalidParamError("min_w");
+ return;
+ }
+ if (min_h <= 0) {
+ SDL_InvalidParamError("min_h");
+ return;
+ }
+
+ if ((window->max_w && min_w >= window->max_w) ||
+ (window->max_h && min_h >= window->max_h)) {
+ SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size");
+ return;
+ }
+
+ window->min_w = min_w;
+ window->min_h = min_h;
+
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ if (_this->SetWindowMinimumSize) {
+ _this->SetWindowMinimumSize(_this, window);
+ }
+ /* Ensure that window is not smaller than minimal size */
+ SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h));
+ }
+}
+
+void
+SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (min_w) {
+ *min_w = window->min_w;
+ }
+ if (min_h) {
+ *min_h = window->min_h;
+ }
+}
+
+void
+SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (max_w <= 0) {
+ SDL_InvalidParamError("max_w");
+ return;
+ }
+ if (max_h <= 0) {
+ SDL_InvalidParamError("max_h");
+ return;
+ }
+
+ if (max_w <= window->min_w || max_h <= window->min_h) {
+ SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size");
+ return;
+ }
+
+ window->max_w = max_w;
+ window->max_h = max_h;
+
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ if (_this->SetWindowMaximumSize) {
+ _this->SetWindowMaximumSize(_this, window);
+ }
+ /* Ensure that window is not larger than maximal size */
+ SDL_SetWindowSize(window, SDL_min(window->w, window->max_w), SDL_min(window->h, window->max_h));
+ }
+}
+
+void
+SDL_GetWindowMaximumSize(SDL_Window * window, int *max_w, int *max_h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+ if (max_w) {
+ *max_w = window->max_w;
+ }
+ if (max_h) {
+ *max_h = window->max_h;
+ }
+}
+
+void
+SDL_ShowWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (window->flags & SDL_WINDOW_SHOWN) {
+ return;
+ }
+
+ if (_this->ShowWindow) {
+ _this->ShowWindow(_this, window);
+ }
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+}
+
+void
+SDL_HideWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (!(window->flags & SDL_WINDOW_SHOWN)) {
+ return;
+ }
+
+ window->is_hiding = SDL_TRUE;
+ SDL_UpdateFullscreenMode(window, SDL_FALSE);
+
+ if (_this->HideWindow) {
+ _this->HideWindow(_this, window);
+ }
+ window->is_hiding = SDL_FALSE;
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+}
+
+void
+SDL_RaiseWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (!(window->flags & SDL_WINDOW_SHOWN)) {
+ return;
+ }
+ if (_this->RaiseWindow) {
+ _this->RaiseWindow(_this, window);
+ }
+}
+
+void
+SDL_MaximizeWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (window->flags & SDL_WINDOW_MAXIMIZED) {
+ return;
+ }
+
+ /* !!! FIXME: should this check if the window is resizable? */
+
+ if (_this->MaximizeWindow) {
+ _this->MaximizeWindow(_this, window);
+ }
+}
+
+void
+SDL_MinimizeWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (window->flags & SDL_WINDOW_MINIMIZED) {
+ return;
+ }
+
+ SDL_UpdateFullscreenMode(window, SDL_FALSE);
+
+ if (_this->MinimizeWindow) {
+ _this->MinimizeWindow(_this, window);
+ }
+}
+
+void
+SDL_RestoreWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (!(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
+ return;
+ }
+
+ if (_this->RestoreWindow) {
+ _this->RestoreWindow(_this, window);
+ }
+}
+
+int
+SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
+{
+ Uint32 oldflags;
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ flags &= FULLSCREEN_MASK;
+
+ if (flags == (window->flags & FULLSCREEN_MASK)) {
+ return 0;
+ }
+
+ /* clear the previous flags and OR in the new ones */
+ oldflags = window->flags & FULLSCREEN_MASK;
+ window->flags &= ~FULLSCREEN_MASK;
+ window->flags |= flags;
+
+ if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) {
+ return 0;
+ }
+
+ window->flags &= ~FULLSCREEN_MASK;
+ window->flags |= oldflags;
+ return -1;
+}
+
+static SDL_Surface *
+SDL_CreateWindowFramebuffer(SDL_Window * window)
+{
+ Uint32 format;
+ void *pixels;
+ int pitch;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) {
+ return NULL;
+ }
+
+ if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) {
+ return NULL;
+ }
+
+ if (!SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
+ return NULL;
+ }
+
+ return SDL_CreateRGBSurfaceFrom(pixels, window->w, window->h, bpp, pitch, Rmask, Gmask, Bmask, Amask);
+}
+
+SDL_Surface *
+SDL_GetWindowSurface(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, NULL);
+
+ if (!window->surface_valid) {
+ if (window->surface) {
+ window->surface->flags &= ~SDL_DONTFREE;
+ SDL_FreeSurface(window->surface);
+ }
+ window->surface = SDL_CreateWindowFramebuffer(window);
+ if (window->surface) {
+ window->surface_valid = SDL_TRUE;
+ window->surface->flags |= SDL_DONTFREE;
+ }
+ }
+ return window->surface;
+}
+
+int
+SDL_UpdateWindowSurface(SDL_Window * window)
+{
+ SDL_Rect full_rect;
+
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = window->w;
+ full_rect.h = window->h;
+ return SDL_UpdateWindowSurfaceRects(window, &full_rect, 1);
+}
+
+int
+SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects,
+ int numrects)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!window->surface_valid) {
+ return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");
+ }
+
+ return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
+}
+
+int
+SDL_SetWindowBrightness(SDL_Window * window, float brightness)
+{
+ Uint16 ramp[256];
+ int status;
+
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ SDL_CalculateGammaRamp(brightness, ramp);
+ status = SDL_SetWindowGammaRamp(window, ramp, ramp, ramp);
+ if (status == 0) {
+ window->brightness = brightness;
+ }
+ return status;
+}
+
+float
+SDL_GetWindowBrightness(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, 1.0f);
+
+ return window->brightness;
+}
+
+int
+SDL_SetWindowOpacity(SDL_Window * window, float opacity)
+{
+ int retval;
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!_this->SetWindowOpacity) {
+ return SDL_Unsupported();
+ }
+
+ if (opacity < 0.0f) {
+ opacity = 0.0f;
+ } else if (opacity > 1.0f) {
+ opacity = 1.0f;
+ }
+
+ retval = _this->SetWindowOpacity(_this, window, opacity);
+ if (retval == 0) {
+ window->opacity = opacity;
+ }
+
+ return retval;
+}
+
+int
+SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (out_opacity) {
+ *out_opacity = window->opacity;
+ }
+
+ return 0;
+}
+
+int
+SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window)
+{
+ CHECK_WINDOW_MAGIC(modal_window, -1);
+ CHECK_WINDOW_MAGIC(parent_window, -1);
+
+ if (!_this->SetWindowModalFor) {
+ return SDL_Unsupported();
+ }
+
+ return _this->SetWindowModalFor(_this, modal_window, parent_window);
+}
+
+int
+SDL_SetWindowInputFocus(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!_this->SetWindowInputFocus) {
+ return SDL_Unsupported();
+ }
+
+ return _this->SetWindowInputFocus(_this, window);
+}
+
+
+int
+SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red,
+ const Uint16 * green,
+ const Uint16 * blue)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!_this->SetWindowGammaRamp) {
+ return SDL_Unsupported();
+ }
+
+ if (!window->gamma) {
+ if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
+ return -1;
+ }
+ SDL_assert(window->gamma != NULL);
+ }
+
+ if (red) {
+ SDL_memcpy(&window->gamma[0*256], red, 256*sizeof(Uint16));
+ }
+ if (green) {
+ SDL_memcpy(&window->gamma[1*256], green, 256*sizeof(Uint16));
+ }
+ if (blue) {
+ SDL_memcpy(&window->gamma[2*256], blue, 256*sizeof(Uint16));
+ }
+ if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
+ return _this->SetWindowGammaRamp(_this, window, window->gamma);
+ } else {
+ return 0;
+ }
+}
+
+int
+SDL_GetWindowGammaRamp(SDL_Window * window, Uint16 * red,
+ Uint16 * green,
+ Uint16 * blue)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!window->gamma) {
+ int i;
+
+ window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16));
+ if (!window->gamma) {
+ return SDL_OutOfMemory();
+ }
+ window->saved_gamma = window->gamma + 3*256;
+
+ if (_this->GetWindowGammaRamp) {
+ if (_this->GetWindowGammaRamp(_this, window, window->gamma) < 0) {
+ return -1;
+ }
+ } else {
+ /* Create an identity gamma ramp */
+ for (i = 0; i < 256; ++i) {
+ Uint16 value = (Uint16)((i << 8) | i);
+
+ window->gamma[0*256+i] = value;
+ window->gamma[1*256+i] = value;
+ window->gamma[2*256+i] = value;
+ }
+ }
+ SDL_memcpy(window->saved_gamma, window->gamma, 3*256*sizeof(Uint16));
+ }
+
+ if (red) {
+ SDL_memcpy(red, &window->gamma[0*256], 256*sizeof(Uint16));
+ }
+ if (green) {
+ SDL_memcpy(green, &window->gamma[1*256], 256*sizeof(Uint16));
+ }
+ if (blue) {
+ SDL_memcpy(blue, &window->gamma[2*256], 256*sizeof(Uint16));
+ }
+ return 0;
+}
+
+void
+SDL_UpdateWindowGrab(SDL_Window * window)
+{
+ SDL_Window *grabbed_window;
+ SDL_bool grabbed;
+ if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
+ (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
+ grabbed = SDL_TRUE;
+ } else {
+ grabbed = SDL_FALSE;
+ }
+
+ grabbed_window = _this->grabbed_window;
+ if (grabbed) {
+ if (grabbed_window && (grabbed_window != window)) {
+ /* stealing a grab from another window! */
+ grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
+ if (_this->SetWindowGrab) {
+ _this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
+ }
+ }
+ _this->grabbed_window = window;
+ } else if (grabbed_window == window) {
+ _this->grabbed_window = NULL; /* ungrabbing. */
+ }
+
+ if (_this->SetWindowGrab) {
+ _this->SetWindowGrab(_this, window, grabbed);
+ }
+}
+
+void
+SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
+ return;
+ }
+ if (grabbed) {
+ window->flags |= SDL_WINDOW_INPUT_GRABBED;
+ } else {
+ window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
+ }
+ SDL_UpdateWindowGrab(window);
+}
+
+SDL_bool
+SDL_GetWindowGrab(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window, SDL_FALSE);
+ SDL_assert(!_this->grabbed_window || ((_this->grabbed_window->flags & SDL_WINDOW_INPUT_GRABBED) != 0));
+ return window == _this->grabbed_window;
+}
+
+SDL_Window *
+SDL_GetGrabbedWindow(void)
+{
+ SDL_assert(!_this->grabbed_window || ((_this->grabbed_window->flags & SDL_WINDOW_INPUT_GRABBED) != 0));
+ return _this->grabbed_window;
+}
+
+void
+SDL_OnWindowShown(SDL_Window * window)
+{
+ SDL_OnWindowRestored(window);
+}
+
+void
+SDL_OnWindowHidden(SDL_Window * window)
+{
+ SDL_UpdateFullscreenMode(window, SDL_FALSE);
+}
+
+void
+SDL_OnWindowResized(SDL_Window * window)
+{
+ window->surface_valid = SDL_FALSE;
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
+}
+
+void
+SDL_OnWindowMinimized(SDL_Window * window)
+{
+ SDL_UpdateFullscreenMode(window, SDL_FALSE);
+}
+
+void
+SDL_OnWindowRestored(SDL_Window * window)
+{
+ /*
+ * FIXME: Is this fine to just remove this, or should it be preserved just
+ * for the fullscreen case? In principle it seems like just hiding/showing
+ * windows shouldn't affect the stacking order; maybe the right fix is to
+ * re-decouple OnWindowShown and OnWindowRestored.
+ */
+ /*SDL_RaiseWindow(window);*/
+
+ if (FULLSCREEN_VISIBLE(window)) {
+ SDL_UpdateFullscreenMode(window, SDL_TRUE);
+ }
+}
+
+void
+SDL_OnWindowEnter(SDL_Window * window)
+{
+ if (_this->OnWindowEnter) {
+ _this->OnWindowEnter(_this, window);
+ }
+}
+
+void
+SDL_OnWindowLeave(SDL_Window * window)
+{
+}
+
+void
+SDL_OnWindowFocusGained(SDL_Window * window)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (window->gamma && _this->SetWindowGammaRamp) {
+ _this->SetWindowGammaRamp(_this, window, window->gamma);
+ }
+
+ if (mouse && mouse->relative_mode) {
+ SDL_SetMouseFocus(window);
+ SDL_WarpMouseInWindow(window, window->w/2, window->h/2);
+ }
+
+ SDL_UpdateWindowGrab(window);
+}
+
+static SDL_bool
+ShouldMinimizeOnFocusLoss(SDL_Window * window)
+{
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) {
+ return SDL_FALSE;
+ }
+
+#ifdef __MACOSX__
+ if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
+ if (Cocoa_IsWindowInFullscreenSpace(window)) {
+ return SDL_FALSE;
+ }
+ }
+#endif
+
+ return SDL_GetHintBoolean(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_TRUE);
+}
+
+void
+SDL_OnWindowFocusLost(SDL_Window * window)
+{
+ if (window->gamma && _this->SetWindowGammaRamp) {
+ _this->SetWindowGammaRamp(_this, window, window->saved_gamma);
+ }
+
+ SDL_UpdateWindowGrab(window);
+
+ if (ShouldMinimizeOnFocusLoss(window)) {
+ SDL_MinimizeWindow(window);
+ }
+}
+
+/* !!! FIXME: is this different than SDL_GetKeyboardFocus()?
+ !!! FIXME: Also, SDL_GetKeyboardFocus() is O(1), this isn't. */
+SDL_Window *
+SDL_GetFocusWindow(void)
+{
+ SDL_Window *window;
+
+ if (!_this) {
+ return NULL;
+ }
+ for (window = _this->windows; window; window = window->next) {
+ if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
+ return window;
+ }
+ }
+ return NULL;
+}
+
+void
+SDL_DestroyWindow(SDL_Window * window)
+{
+ SDL_VideoDisplay *display;
+
+ CHECK_WINDOW_MAGIC(window,);
+
+ window->is_destroying = SDL_TRUE;
+
+ /* Restore video mode, etc. */
+ SDL_HideWindow(window);
+
+ /* Make sure this window no longer has focus */
+ if (SDL_GetKeyboardFocus() == window) {
+ SDL_SetKeyboardFocus(NULL);
+ }
+ if (SDL_GetMouseFocus() == window) {
+ SDL_SetMouseFocus(NULL);
+ }
+
+ /* make no context current if this is the current context window. */
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ if (_this->current_glwin == window) {
+ SDL_GL_MakeCurrent(window, NULL);
+ }
+ }
+
+ if (window->surface) {
+ window->surface->flags &= ~SDL_DONTFREE;
+ SDL_FreeSurface(window->surface);
+ }
+ if (_this->DestroyWindowFramebuffer) {
+ _this->DestroyWindowFramebuffer(_this, window);
+ }
+ if (_this->DestroyWindow) {
+ _this->DestroyWindow(_this, window);
+ }
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ SDL_GL_UnloadLibrary();
+ }
+ if (window->flags & SDL_WINDOW_VULKAN) {
+ SDL_Vulkan_UnloadLibrary();
+ }
+
+ display = SDL_GetDisplayForWindow(window);
+ if (display->fullscreen_window == window) {
+ display->fullscreen_window = NULL;
+ }
+
+ /* Now invalidate magic */
+ window->magic = NULL;
+
+ /* Free memory associated with the window */
+ SDL_free(window->title);
+ SDL_FreeSurface(window->icon);
+ SDL_free(window->gamma);
+ while (window->data) {
+ SDL_WindowUserData *data = window->data;
+
+ window->data = data->next;
+ SDL_free(data->name);
+ SDL_free(data);
+ }
+
+ /* Unlink the window from the list */
+ if (window->next) {
+ window->next->prev = window->prev;
+ }
+ if (window->prev) {
+ window->prev->next = window->next;
+ } else {
+ _this->windows = window->next;
+ }
+
+ SDL_free(window);
+}
+
+SDL_bool
+SDL_IsScreenSaverEnabled()
+{
+ if (!_this) {
+ return SDL_TRUE;
+ }
+ return _this->suspend_screensaver ? SDL_FALSE : SDL_TRUE;
+}
+
+void
+SDL_EnableScreenSaver()
+{
+ if (!_this) {
+ return;
+ }
+ if (!_this->suspend_screensaver) {
+ return;
+ }
+ _this->suspend_screensaver = SDL_FALSE;
+ if (_this->SuspendScreenSaver) {
+ _this->SuspendScreenSaver(_this);
+ }
+}
+
+void
+SDL_DisableScreenSaver()
+{
+ if (!_this) {
+ return;
+ }
+ if (_this->suspend_screensaver) {
+ return;
+ }
+ _this->suspend_screensaver = SDL_TRUE;
+ if (_this->SuspendScreenSaver) {
+ _this->SuspendScreenSaver(_this);
+ }
+}
+
+void
+SDL_VideoQuit(void)
+{
+ int i, j;
+
+ if (!_this) {
+ return;
+ }
+
+ /* Halt event processing before doing anything else */
+ SDL_TouchQuit();
+ SDL_MouseQuit();
+ SDL_KeyboardQuit();
+ SDL_QuitSubSystem(SDL_INIT_EVENTS);
+
+ SDL_EnableScreenSaver();
+
+ /* Clean up the system video */
+ while (_this->windows) {
+ SDL_DestroyWindow(_this->windows);
+ }
+ _this->VideoQuit(_this);
+
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ for (j = display->num_display_modes; j--;) {
+ SDL_free(display->display_modes[j].driverdata);
+ display->display_modes[j].driverdata = NULL;
+ }
+ SDL_free(display->display_modes);
+ display->display_modes = NULL;
+ SDL_free(display->desktop_mode.driverdata);
+ display->desktop_mode.driverdata = NULL;
+ SDL_free(display->driverdata);
+ display->driverdata = NULL;
+ }
+ if (_this->displays) {
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_free(_this->displays[i].name);
+ }
+ SDL_free(_this->displays);
+ _this->displays = NULL;
+ _this->num_displays = 0;
+ }
+ SDL_free(_this->clipboard_text);
+ _this->clipboard_text = NULL;
+ _this->free(_this);
+ _this = NULL;
+}
+
+int
+SDL_GL_LoadLibrary(const char *path)
+{
+ int retval;
+
+ if (!_this) {
+ return SDL_UninitializedVideo();
+ }
+ if (_this->gl_config.driver_loaded) {
+ if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) {
+ return SDL_SetError("OpenGL library already loaded");
+ }
+ retval = 0;
+ } else {
+ if (!_this->GL_LoadLibrary) {
+ return SDL_SetError("No dynamic GL support in video driver");
+ }
+ retval = _this->GL_LoadLibrary(_this, path);
+ }
+ if (retval == 0) {
+ ++_this->gl_config.driver_loaded;
+ } else {
+ if (_this->GL_UnloadLibrary) {
+ _this->GL_UnloadLibrary(_this);
+ }
+ }
+ return (retval);
+}
+
+void *
+SDL_GL_GetProcAddress(const char *proc)
+{
+ void *func;
+
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ func = NULL;
+ if (_this->GL_GetProcAddress) {
+ if (_this->gl_config.driver_loaded) {
+ func = _this->GL_GetProcAddress(_this, proc);
+ } else {
+ SDL_SetError("No GL driver has been loaded");
+ }
+ } else {
+ SDL_SetError("No dynamic GL support in video driver");
+ }
+ return func;
+}
+
+void
+SDL_GL_UnloadLibrary(void)
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return;
+ }
+ if (_this->gl_config.driver_loaded > 0) {
+ if (--_this->gl_config.driver_loaded > 0) {
+ return;
+ }
+ if (_this->GL_UnloadLibrary) {
+ _this->GL_UnloadLibrary(_this);
+ }
+ }
+}
+
+#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+static SDL_INLINE SDL_bool
+isAtLeastGL3(const char *verstr)
+{
+ return (verstr && (SDL_atoi(verstr) >= 3));
+}
+#endif
+
+SDL_bool
+SDL_GL_ExtensionSupported(const char *extension)
+{
+#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
+ const char *extensions;
+ const char *start;
+ const char *where, *terminator;
+
+ /* Extension names should not have spaces. */
+ where = SDL_strchr(extension, ' ');
+ if (where || *extension == '\0') {
+ return SDL_FALSE;
+ }
+ /* See if there's an environment variable override */
+ start = SDL_getenv(extension);
+ if (start && *start == '0') {
+ return SDL_FALSE;
+ }
+
+ /* Lookup the available extensions */
+
+ glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ if (!glGetStringFunc) {
+ return SDL_FALSE;
+ }
+
+ if (isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
+ const GLubyte *(APIENTRY * glGetStringiFunc) (GLenum, GLuint);
+ void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
+ GLint num_exts = 0;
+ GLint i;
+
+ glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
+ glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+ if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
+ return SDL_FALSE;
+ }
+
+ #ifndef GL_NUM_EXTENSIONS
+ #define GL_NUM_EXTENSIONS 0x821D
+ #endif
+ glGetIntegervFunc(GL_NUM_EXTENSIONS, &num_exts);
+ for (i = 0; i < num_exts; i++) {
+ const char *thisext = (const char *) glGetStringiFunc(GL_EXTENSIONS, i);
+ if (SDL_strcmp(thisext, extension) == 0) {
+ return SDL_TRUE;
+ }
+ }
+
+ return SDL_FALSE;
+ }
+
+ /* Try the old way with glGetString(GL_EXTENSIONS) ... */
+
+ extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
+ if (!extensions) {
+ return SDL_FALSE;
+ }
+ /*
+ * It takes a bit of care to be fool-proof about parsing the OpenGL
+ * extensions string. Don't be fooled by sub-strings, etc.
+ */
+
+ start = extensions;
+
+ for (;;) {
+ where = SDL_strstr(start, extension);
+ if (!where)
+ break;
+
+ terminator = where + SDL_strlen(extension);
+ if (where == extensions || *(where - 1) == ' ')
+ if (*terminator == ' ' || *terminator == '\0')
+ return SDL_TRUE;
+
+ start = terminator;
+ }
+ return SDL_FALSE;
+#else
+ return SDL_FALSE;
+#endif
+}
+
+/* Deduce supported ES profile versions from the supported
+ ARB_ES*_compatibility extensions. There is no direct query.
+
+ This is normally only called when the OpenGL driver supports
+ {GLX,WGL}_EXT_create_context_es2_profile.
+ */
+void
+SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor)
+{
+/* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */
+/* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */
+#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ /* XXX This is fragile; it will break in the event of release of
+ * new versions of OpenGL ES.
+ */
+ if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) {
+ *major = 3;
+ *minor = 2;
+ } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) {
+ *major = 3;
+ *minor = 1;
+ } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) {
+ *major = 3;
+ *minor = 0;
+ } else {
+ *major = 2;
+ *minor = 0;
+ }
+#endif
+}
+
+void
+SDL_GL_ResetAttributes()
+{
+ if (!_this) {
+ return;
+ }
+
+ _this->gl_config.red_size = 3;
+ _this->gl_config.green_size = 3;
+ _this->gl_config.blue_size = 2;
+ _this->gl_config.alpha_size = 0;
+ _this->gl_config.buffer_size = 0;
+ _this->gl_config.depth_size = 16;
+ _this->gl_config.stencil_size = 0;
+ _this->gl_config.double_buffer = 1;
+ _this->gl_config.accum_red_size = 0;
+ _this->gl_config.accum_green_size = 0;
+ _this->gl_config.accum_blue_size = 0;
+ _this->gl_config.accum_alpha_size = 0;
+ _this->gl_config.stereo = 0;
+ _this->gl_config.multisamplebuffers = 0;
+ _this->gl_config.multisamplesamples = 0;
+ _this->gl_config.retained_backing = 1;
+ _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
+
+ if (_this->GL_DefaultProfileConfig) {
+ _this->GL_DefaultProfileConfig(_this, &_this->gl_config.profile_mask,
+ &_this->gl_config.major_version,
+ &_this->gl_config.minor_version);
+ } else {
+#if SDL_VIDEO_OPENGL
+ _this->gl_config.major_version = 2;
+ _this->gl_config.minor_version = 1;
+ _this->gl_config.profile_mask = 0;
+#elif SDL_VIDEO_OPENGL_ES2
+ _this->gl_config.major_version = 2;
+ _this->gl_config.minor_version = 0;
+ _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
+#elif SDL_VIDEO_OPENGL_ES
+ _this->gl_config.major_version = 1;
+ _this->gl_config.minor_version = 1;
+ _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
+#endif
+ }
+
+ _this->gl_config.flags = 0;
+ _this->gl_config.framebuffer_srgb_capable = 0;
+ _this->gl_config.no_error = 0;
+ _this->gl_config.release_behavior = SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
+ _this->gl_config.reset_notification = SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
+
+ _this->gl_config.share_with_current_context = 0;
+}
+
+int
+SDL_GL_SetAttribute(SDL_GLattr attr, int value)
+{
+#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ int retval;
+
+ if (!_this) {
+ return SDL_UninitializedVideo();
+ }
+ retval = 0;
+ switch (attr) {
+ case SDL_GL_RED_SIZE:
+ _this->gl_config.red_size = value;
+ break;
+ case SDL_GL_GREEN_SIZE:
+ _this->gl_config.green_size = value;
+ break;
+ case SDL_GL_BLUE_SIZE:
+ _this->gl_config.blue_size = value;
+ break;
+ case SDL_GL_ALPHA_SIZE:
+ _this->gl_config.alpha_size = value;
+ break;
+ case SDL_GL_DOUBLEBUFFER:
+ _this->gl_config.double_buffer = value;
+ break;
+ case SDL_GL_BUFFER_SIZE:
+ _this->gl_config.buffer_size = value;
+ break;
+ case SDL_GL_DEPTH_SIZE:
+ _this->gl_config.depth_size = value;
+ break;
+ case SDL_GL_STENCIL_SIZE:
+ _this->gl_config.stencil_size = value;
+ break;
+ case SDL_GL_ACCUM_RED_SIZE:
+ _this->gl_config.accum_red_size = value;
+ break;
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ _this->gl_config.accum_green_size = value;
+ break;
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ _this->gl_config.accum_blue_size = value;
+ break;
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ _this->gl_config.accum_alpha_size = value;
+ break;
+ case SDL_GL_STEREO:
+ _this->gl_config.stereo = value;
+ break;
+ case SDL_GL_MULTISAMPLEBUFFERS:
+ _this->gl_config.multisamplebuffers = value;
+ break;
+ case SDL_GL_MULTISAMPLESAMPLES:
+ _this->gl_config.multisamplesamples = value;
+ break;
+ case SDL_GL_ACCELERATED_VISUAL:
+ _this->gl_config.accelerated = value;
+ break;
+ case SDL_GL_RETAINED_BACKING:
+ _this->gl_config.retained_backing = value;
+ break;
+ case SDL_GL_CONTEXT_MAJOR_VERSION:
+ _this->gl_config.major_version = value;
+ break;
+ case SDL_GL_CONTEXT_MINOR_VERSION:
+ _this->gl_config.minor_version = value;
+ break;
+ case SDL_GL_CONTEXT_EGL:
+ /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
+ if (value != 0) {
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
+ } else {
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0);
+ };
+ break;
+ case SDL_GL_CONTEXT_FLAGS:
+ if (value & ~(SDL_GL_CONTEXT_DEBUG_FLAG |
+ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG |
+ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG |
+ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG)) {
+ retval = SDL_SetError("Unknown OpenGL context flag %d", value);
+ break;
+ }
+ _this->gl_config.flags = value;
+ break;
+ case SDL_GL_CONTEXT_PROFILE_MASK:
+ if (value != 0 &&
+ value != SDL_GL_CONTEXT_PROFILE_CORE &&
+ value != SDL_GL_CONTEXT_PROFILE_COMPATIBILITY &&
+ value != SDL_GL_CONTEXT_PROFILE_ES) {
+ retval = SDL_SetError("Unknown OpenGL context profile %d", value);
+ break;
+ }
+ _this->gl_config.profile_mask = value;
+ break;
+ case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
+ _this->gl_config.share_with_current_context = value;
+ break;
+ case SDL_GL_FRAMEBUFFER_SRGB_CAPABLE:
+ _this->gl_config.framebuffer_srgb_capable = value;
+ break;
+ case SDL_GL_CONTEXT_RELEASE_BEHAVIOR:
+ _this->gl_config.release_behavior = value;
+ break;
+ case SDL_GL_CONTEXT_RESET_NOTIFICATION:
+ _this->gl_config.reset_notification = value;
+ break;
+ case SDL_GL_CONTEXT_NO_ERROR:
+ _this->gl_config.no_error = value;
+ break;
+ default:
+ retval = SDL_SetError("Unknown OpenGL attribute");
+ break;
+ }
+ return retval;
+#else
+ return SDL_Unsupported();
+#endif /* SDL_VIDEO_OPENGL */
+}
+
+int
+SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
+{
+#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ GLenum (APIENTRY *glGetErrorFunc) (void);
+ GLenum attrib = 0;
+ GLenum error = 0;
+
+ /*
+ * Some queries in Core Profile desktop OpenGL 3+ contexts require
+ * glGetFramebufferAttachmentParameteriv instead of glGetIntegerv. Note that
+ * the enums we use for the former function don't exist in OpenGL ES 2, and
+ * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2.
+ */
+#if SDL_VIDEO_OPENGL
+ const GLubyte *(APIENTRY *glGetStringFunc) (GLenum name);
+ void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+ GLenum attachment = GL_BACK_LEFT;
+ GLenum attachmentattrib = 0;
+#endif
+
+ if (!value) {
+ return SDL_InvalidParamError("value");
+ }
+
+ /* Clear value in any case */
+ *value = 0;
+
+ if (!_this) {
+ return SDL_UninitializedVideo();
+ }
+
+ switch (attr) {
+ case SDL_GL_RED_SIZE:
+#if SDL_VIDEO_OPENGL
+ attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE;
+#endif
+ attrib = GL_RED_BITS;
+ break;
+ case SDL_GL_BLUE_SIZE:
+#if SDL_VIDEO_OPENGL
+ attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE;
+#endif
+ attrib = GL_BLUE_BITS;
+ break;
+ case SDL_GL_GREEN_SIZE:
+#if SDL_VIDEO_OPENGL
+ attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE;
+#endif
+ attrib = GL_GREEN_BITS;
+ break;
+ case SDL_GL_ALPHA_SIZE:
+#if SDL_VIDEO_OPENGL
+ attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE;
+#endif
+ attrib = GL_ALPHA_BITS;
+ break;
+ case SDL_GL_DOUBLEBUFFER:
+#if SDL_VIDEO_OPENGL
+ attrib = GL_DOUBLEBUFFER;
+ break;
+#else
+ /* OpenGL ES 1.0 and above specifications have EGL_SINGLE_BUFFER */
+ /* parameter which switches double buffer to single buffer. OpenGL ES */
+ /* SDL driver must set proper value after initialization */
+ *value = _this->gl_config.double_buffer;
+ return 0;
+#endif
+ case SDL_GL_DEPTH_SIZE:
+#if SDL_VIDEO_OPENGL
+ attachment = GL_DEPTH;
+ attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE;
+#endif
+ attrib = GL_DEPTH_BITS;
+ break;
+ case SDL_GL_STENCIL_SIZE:
+#if SDL_VIDEO_OPENGL
+ attachment = GL_STENCIL;
+ attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE;
+#endif
+ attrib = GL_STENCIL_BITS;
+ break;
+#if SDL_VIDEO_OPENGL
+ case SDL_GL_ACCUM_RED_SIZE:
+ attrib = GL_ACCUM_RED_BITS;
+ break;
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ attrib = GL_ACCUM_GREEN_BITS;
+ break;
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ attrib = GL_ACCUM_BLUE_BITS;
+ break;
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ attrib = GL_ACCUM_ALPHA_BITS;
+ break;
+ case SDL_GL_STEREO:
+ attrib = GL_STEREO;
+ break;
+#else
+ case SDL_GL_ACCUM_RED_SIZE:
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ case SDL_GL_STEREO:
+ /* none of these are supported in OpenGL ES */
+ *value = 0;
+ return 0;
+#endif
+ case SDL_GL_MULTISAMPLEBUFFERS:
+ attrib = GL_SAMPLE_BUFFERS;
+ break;
+ case SDL_GL_MULTISAMPLESAMPLES:
+ attrib = GL_SAMPLES;
+ break;
+ case SDL_GL_CONTEXT_RELEASE_BEHAVIOR:
+#if SDL_VIDEO_OPENGL
+ attrib = GL_CONTEXT_RELEASE_BEHAVIOR;
+#else
+ attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR;
+#endif
+ break;
+ case SDL_GL_BUFFER_SIZE:
+ {
+ int rsize = 0, gsize = 0, bsize = 0, asize = 0;
+
+ /* There doesn't seem to be a single flag in OpenGL for this! */
+ if (SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &rsize) < 0) {
+ return -1;
+ }
+ if (SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &gsize) < 0) {
+ return -1;
+ }
+ if (SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &bsize) < 0) {
+ return -1;
+ }
+ if (SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &asize) < 0) {
+ return -1;
+ }
+
+ *value = rsize + gsize + bsize + asize;
+ return 0;
+ }
+ case SDL_GL_ACCELERATED_VISUAL:
+ {
+ /* FIXME: How do we get this information? */
+ *value = (_this->gl_config.accelerated != 0);
+ return 0;
+ }
+ case SDL_GL_RETAINED_BACKING:
+ {
+ *value = _this->gl_config.retained_backing;
+ return 0;
+ }
+ case SDL_GL_CONTEXT_MAJOR_VERSION:
+ {
+ *value = _this->gl_config.major_version;
+ return 0;
+ }
+ case SDL_GL_CONTEXT_MINOR_VERSION:
+ {
+ *value = _this->gl_config.minor_version;
+ return 0;
+ }
+ case SDL_GL_CONTEXT_EGL:
+ /* FIXME: SDL_GL_CONTEXT_EGL to be deprecated in SDL 2.1 */
+ {
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
+ *value = 1;
+ }
+ else {
+ *value = 0;
+ }
+ return 0;
+ }
+ case SDL_GL_CONTEXT_FLAGS:
+ {
+ *value = _this->gl_config.flags;
+ return 0;
+ }
+ case SDL_GL_CONTEXT_PROFILE_MASK:
+ {
+ *value = _this->gl_config.profile_mask;
+ return 0;
+ }
+ case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
+ {
+ *value = _this->gl_config.share_with_current_context;
+ return 0;
+ }
+ case SDL_GL_FRAMEBUFFER_SRGB_CAPABLE:
+ {
+ *value = _this->gl_config.framebuffer_srgb_capable;
+ return 0;
+ }
+ case SDL_GL_CONTEXT_NO_ERROR:
+ {
+ *value = _this->gl_config.no_error;
+ return 0;
+ }
+ default:
+ return SDL_SetError("Unknown OpenGL attribute");
+ }
+
+#if SDL_VIDEO_OPENGL
+ glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ if (!glGetStringFunc) {
+ return -1;
+ }
+
+ if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
+ glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
+
+ if (glGetFramebufferAttachmentParameterivFunc) {
+ glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
+ } else {
+ return -1;
+ }
+ } else
+#endif
+ {
+ void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
+ glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+ if (glGetIntegervFunc) {
+ glGetIntegervFunc(attrib, (GLint *) value);
+ } else {
+ return -1;
+ }
+ }
+
+ glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
+ if (!glGetErrorFunc) {
+ return -1;
+ }
+
+ error = glGetErrorFunc();
+ if (error != GL_NO_ERROR) {
+ if (error == GL_INVALID_ENUM) {
+ return SDL_SetError("OpenGL error: GL_INVALID_ENUM");
+ } else if (error == GL_INVALID_VALUE) {
+ return SDL_SetError("OpenGL error: GL_INVALID_VALUE");
+ }
+ return SDL_SetError("OpenGL error: %08X", error);
+ }
+ return 0;
+#else
+ return SDL_Unsupported();
+#endif /* SDL_VIDEO_OPENGL */
+}
+
+SDL_GLContext
+SDL_GL_CreateContext(SDL_Window * window)
+{
+ SDL_GLContext ctx = NULL;
+ CHECK_WINDOW_MAGIC(window, NULL);
+
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ SDL_SetError("The specified window isn't an OpenGL window");
+ return NULL;
+ }
+
+ ctx = _this->GL_CreateContext(_this, window);
+
+ /* Creating a context is assumed to make it current in the SDL driver. */
+ if (ctx) {
+ _this->current_glwin = window;
+ _this->current_glctx = ctx;
+ SDL_TLSSet(_this->current_glwin_tls, window, NULL);
+ SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
+ }
+ return ctx;
+}
+
+int
+SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
+{
+ int retval;
+
+ if (window == SDL_GL_GetCurrentWindow() &&
+ ctx == SDL_GL_GetCurrentContext()) {
+ /* We're already current. */
+ return 0;
+ }
+
+ if (!ctx) {
+ window = NULL;
+ } else {
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ return SDL_SetError("The specified window isn't an OpenGL window");
+ }
+ }
+
+ retval = _this->GL_MakeCurrent(_this, window, ctx);
+ if (retval == 0) {
+ _this->current_glwin = window;
+ _this->current_glctx = ctx;
+ SDL_TLSSet(_this->current_glwin_tls, window, NULL);
+ SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
+ }
+ return retval;
+}
+
+SDL_Window *
+SDL_GL_GetCurrentWindow(void)
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ return (SDL_Window *)SDL_TLSGet(_this->current_glwin_tls);
+}
+
+SDL_GLContext
+SDL_GL_GetCurrentContext(void)
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls);
+}
+
+void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (_this->GL_GetDrawableSize) {
+ _this->GL_GetDrawableSize(_this, window, w, h);
+ } else {
+ SDL_GetWindowSize(window, w, h);
+ }
+}
+
+int
+SDL_GL_SetSwapInterval(int interval)
+{
+ if (!_this) {
+ return SDL_UninitializedVideo();
+ } else if (SDL_GL_GetCurrentContext() == NULL) {
+ return SDL_SetError("No OpenGL context has been made current");
+ } else if (_this->GL_SetSwapInterval) {
+ return _this->GL_SetSwapInterval(_this, interval);
+ } else {
+ return SDL_SetError("Setting the swap interval is not supported");
+ }
+}
+
+int
+SDL_GL_GetSwapInterval(void)
+{
+ if (!_this) {
+ return 0;
+ } else if (SDL_GL_GetCurrentContext() == NULL) {
+ return 0;
+ } else if (_this->GL_GetSwapInterval) {
+ return _this->GL_GetSwapInterval(_this);
+ } else {
+ return 0;
+ }
+}
+
+void
+SDL_GL_SwapWindow(SDL_Window * window)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ SDL_SetError("The specified window isn't an OpenGL window");
+ return;
+ }
+
+ if (SDL_GL_GetCurrentWindow() != window) {
+ SDL_SetError("The specified window has not been made current");
+ return;
+ }
+
+ _this->GL_SwapWindow(_this, window);
+}
+
+void
+SDL_GL_DeleteContext(SDL_GLContext context)
+{
+ if (!_this || !context) {
+ return;
+ }
+
+ if (SDL_GL_GetCurrentContext() == context) {
+ SDL_GL_MakeCurrent(NULL, NULL);
+ }
+
+ _this->GL_DeleteContext(_this, context);
+}
+
+#if 0 /* FIXME */
+/*
+ * Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
+ * & 2 for alpha channel.
+ */
+static void
+CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
+{
+ int x, y;
+ Uint32 colorkey;
+#define SET_MASKBIT(icon, x, y, mask) \
+ mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
+
+ colorkey = icon->format->colorkey;
+ switch (icon->format->BytesPerPixel) {
+ case 1:
+ {
+ Uint8 *pixels;
+ for (y = 0; y < icon->h; ++y) {
+ pixels = (Uint8 *) icon->pixels + y * icon->pitch;
+ for (x = 0; x < icon->w; ++x) {
+ if (*pixels++ == colorkey) {
+ SET_MASKBIT(icon, x, y, mask);
+ }
+ }
+ }
+ }
+ break;
+
+ case 2:
+ {
+ Uint16 *pixels;
+ for (y = 0; y < icon->h; ++y) {
+ pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2;
+ for (x = 0; x < icon->w; ++x) {
+ if ((flags & 1) && *pixels == colorkey) {
+ SET_MASKBIT(icon, x, y, mask);
+ } else if ((flags & 2)
+ && (*pixels & icon->format->Amask) == 0) {
+ SET_MASKBIT(icon, x, y, mask);
+ }
+ pixels++;
+ }
+ }
+ }
+ break;
+
+ case 4:
+ {
+ Uint32 *pixels;
+ for (y = 0; y < icon->h; ++y) {
+ pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4;
+ for (x = 0; x < icon->w; ++x) {
+ if ((flags & 1) && *pixels == colorkey) {
+ SET_MASKBIT(icon, x, y, mask);
+ } else if ((flags & 2)
+ && (*pixels & icon->format->Amask) == 0) {
+ SET_MASKBIT(icon, x, y, mask);
+ }
+ pixels++;
+ }
+ }
+ }
+ break;
+ }
+}
+
+/*
+ * Sets the window manager icon for the display window.
+ */
+void
+SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
+{
+ if (icon && _this->SetIcon) {
+ /* Generate a mask if necessary, and create the icon! */
+ if (mask == NULL) {
+ int mask_len = icon->h * (icon->w + 7) / 8;
+ int flags = 0;
+ mask = (Uint8 *) SDL_malloc(mask_len);
+ if (mask == NULL) {
+ return;
+ }
+ SDL_memset(mask, ~0, mask_len);
+ if (icon->flags & SDL_SRCCOLORKEY)
+ flags |= 1;
+ if (icon->flags & SDL_SRCALPHA)
+ flags |= 2;
+ if (flags) {
+ CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
+ }
+ _this->SetIcon(_this, icon, mask);
+ SDL_free(mask);
+ } else {
+ _this->SetIcon(_this, icon, mask);
+ }
+ }
+}
+#endif
+
+SDL_bool
+SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ CHECK_WINDOW_MAGIC(window, SDL_FALSE);
+
+ if (!info) {
+ SDL_InvalidParamError("info");
+ return SDL_FALSE;
+ }
+ info->subsystem = SDL_SYSWM_UNKNOWN;
+
+ if (!_this->GetWindowWMInfo) {
+ SDL_Unsupported();
+ return SDL_FALSE;
+ }
+ return (_this->GetWindowWMInfo(_this, window, info));
+}
+
+void
+SDL_StartTextInput(void)
+{
+ SDL_Window *window;
+
+ /* First, enable text events */
+ SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
+ SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE);
+
+ /* Then show the on-screen keyboard, if any */
+ window = SDL_GetFocusWindow();
+ if (window && _this && _this->ShowScreenKeyboard) {
+ _this->ShowScreenKeyboard(_this, window);
+ }
+
+ /* Finally start the text input system */
+ if (_this && _this->StartTextInput) {
+ _this->StartTextInput(_this);
+ }
+}
+
+SDL_bool
+SDL_IsTextInputActive(void)
+{
+ return (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE);
+}
+
+void
+SDL_StopTextInput(void)
+{
+ SDL_Window *window;
+
+ /* Stop the text input system */
+ if (_this && _this->StopTextInput) {
+ _this->StopTextInput(_this);
+ }
+
+ /* Hide the on-screen keyboard, if any */
+ window = SDL_GetFocusWindow();
+ if (window && _this && _this->HideScreenKeyboard) {
+ _this->HideScreenKeyboard(_this, window);
+ }
+
+ /* Finally disable text events */
+ SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
+ SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
+}
+
+void
+SDL_SetTextInputRect(SDL_Rect *rect)
+{
+ if (_this && _this->SetTextInputRect) {
+ _this->SetTextInputRect(_this, rect);
+ }
+}
+
+SDL_bool
+SDL_HasScreenKeyboardSupport(void)
+{
+ if (_this && _this->HasScreenKeyboardSupport) {
+ return _this->HasScreenKeyboardSupport(_this);
+ }
+ return SDL_FALSE;
+}
+
+SDL_bool
+SDL_IsScreenKeyboardShown(SDL_Window *window)
+{
+ if (window && _this && _this->IsScreenKeyboardShown) {
+ return _this->IsScreenKeyboardShown(_this, window);
+ }
+ return SDL_FALSE;
+}
+
+#if SDL_VIDEO_DRIVER_ANDROID
+#include "android/SDL_androidmessagebox.h"
+#endif
+#if SDL_VIDEO_DRIVER_WINDOWS
+#include "windows/SDL_windowsmessagebox.h"
+#endif
+#if SDL_VIDEO_DRIVER_WINRT
+#include "winrt/SDL_winrtmessagebox.h"
+#endif
+#if SDL_VIDEO_DRIVER_COCOA
+#include "cocoa/SDL_cocoamessagebox.h"
+#endif
+#if SDL_VIDEO_DRIVER_UIKIT
+#include "uikit/SDL_uikitmessagebox.h"
+#endif
+#if SDL_VIDEO_DRIVER_X11
+#include "x11/SDL_x11messagebox.h"
+#endif
+
+
+#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11
+static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
+{
+ SDL_SysWMinfo info;
+ SDL_Window *window = messageboxdata->window;
+
+ if (!window) {
+ return SDL_TRUE;
+ }
+
+ SDL_VERSION(&info.version);
+ if (!SDL_GetWindowWMInfo(window, &info)) {
+ return SDL_TRUE;
+ } else {
+ return (info.subsystem == drivertype);
+ }
+}
+#endif
+
+int
+SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ int dummybutton;
+ int retval = -1;
+ SDL_bool relative_mode;
+ int show_cursor_prev;
+ SDL_bool mouse_captured;
+ SDL_Window *current_window;
+
+ if (!messageboxdata) {
+ return SDL_InvalidParamError("messageboxdata");
+ }
+
+ current_window = SDL_GetKeyboardFocus();
+ mouse_captured = current_window && ((SDL_GetWindowFlags(current_window) & SDL_WINDOW_MOUSE_CAPTURE) != 0);
+ relative_mode = SDL_GetRelativeMouseMode();
+ SDL_CaptureMouse(SDL_FALSE);
+ SDL_SetRelativeMouseMode(SDL_FALSE);
+ show_cursor_prev = SDL_ShowCursor(1);
+ SDL_ResetKeyboard();
+
+ if (!buttonid) {
+ buttonid = &dummybutton;
+ }
+
+ if (_this && _this->ShowMessageBox) {
+ retval = _this->ShowMessageBox(_this, messageboxdata, buttonid);
+ }
+
+ /* It's completely fine to call this function before video is initialized */
+#if SDL_VIDEO_DRIVER_ANDROID
+ if (retval == -1 &&
+ Android_ShowMessageBox(messageboxdata, buttonid) == 0) {
+ retval = 0;
+ }
+#endif
+#if SDL_VIDEO_DRIVER_WINDOWS
+ if (retval == -1 &&
+ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) &&
+ WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
+ retval = 0;
+ }
+#endif
+#if SDL_VIDEO_DRIVER_WINRT
+ if (retval == -1 &&
+ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) &&
+ WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
+ retval = 0;
+ }
+#endif
+#if SDL_VIDEO_DRIVER_COCOA
+ if (retval == -1 &&
+ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) &&
+ Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
+ retval = 0;
+ }
+#endif
+#if SDL_VIDEO_DRIVER_UIKIT
+ if (retval == -1 &&
+ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) &&
+ UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
+ retval = 0;
+ }
+#endif
+#if SDL_VIDEO_DRIVER_X11
+ if (retval == -1 &&
+ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) &&
+ X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
+ retval = 0;
+ }
+#endif
+ if (retval == -1) {
+ SDL_SetError("No message system available");
+ }
+
+ if (current_window) {
+ SDL_RaiseWindow(current_window);
+ if (mouse_captured) {
+ SDL_CaptureMouse(SDL_TRUE);
+ }
+ }
+
+ SDL_ShowCursor(show_cursor_prev);
+ SDL_SetRelativeMouseMode(relative_mode);
+
+ return retval;
+}
+
+int
+SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
+{
+#ifdef __EMSCRIPTEN__
+ /* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */
+ /* Web browsers don't (currently) have an API for a custom message box
+ that can block, but for the most common case (SDL_ShowSimpleMessageBox),
+ we can use the standard Javascript alert() function. */
+ EM_ASM_({
+ alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1));
+ }, title, message);
+ return 0;
+#else
+ SDL_MessageBoxData data;
+ SDL_MessageBoxButtonData button;
+
+ SDL_zero(data);
+ data.flags = flags;
+ data.title = title;
+ data.message = message;
+ data.numbuttons = 1;
+ data.buttons = &button;
+ data.window = window;
+
+ SDL_zero(button);
+ button.flags |= SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
+ button.flags |= SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
+ button.text = "OK";
+
+ return SDL_ShowMessageBox(&data, NULL);
+#endif
+}
+
+SDL_bool
+SDL_ShouldAllowTopmost(void)
+{
+ return SDL_GetHintBoolean(SDL_HINT_ALLOW_TOPMOST, SDL_TRUE);
+}
+
+int
+SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *userdata)
+{
+ CHECK_WINDOW_MAGIC(window, -1);
+
+ if (!_this->SetWindowHitTest) {
+ return SDL_Unsupported();
+ } else if (_this->SetWindowHitTest(window, callback != NULL) == -1) {
+ return -1;
+ }
+
+ window->hit_test = callback;
+ window->hit_test_data = userdata;
+
+ return 0;
+}
+
+float
+SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
+{
+ float den2 = hinches * hinches + vinches * vinches;
+ if (den2 <= 0.0f) {
+ return 0.0f;
+ }
+
+ return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) /
+ SDL_sqrt((double)den2));
+}
+
+/*
+ * Functions used by iOS application delegates
+ */
+void SDL_OnApplicationWillTerminate(void)
+{
+ SDL_SendAppEvent(SDL_APP_TERMINATING);
+}
+
+void SDL_OnApplicationDidReceiveMemoryWarning(void)
+{
+ SDL_SendAppEvent(SDL_APP_LOWMEMORY);
+}
+
+void SDL_OnApplicationWillResignActive(void)
+{
+ if (_this) {
+ SDL_Window *window;
+ for (window = _this->windows; window != NULL; window = window->next) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+ }
+ }
+ SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
+}
+
+void SDL_OnApplicationDidEnterBackground(void)
+{
+ SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
+}
+
+void SDL_OnApplicationWillEnterForeground(void)
+{
+ SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
+}
+
+void SDL_OnApplicationDidBecomeActive(void)
+{
+ SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
+
+ if (_this) {
+ SDL_Window *window;
+ for (window = _this->windows; window != NULL; window = window->next) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ }
+ }
+}
+
+#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window"
+
+int SDL_Vulkan_LoadLibrary(const char *path)
+{
+ int retval;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (_this->vulkan_config.loader_loaded) {
+ if (path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0) {
+ return SDL_SetError("Vulkan loader library already loaded");
+ }
+ retval = 0;
+ } else {
+ if (!_this->Vulkan_LoadLibrary) {
+ return SDL_SetError("No Vulkan support in video driver");
+ }
+ retval = _this->Vulkan_LoadLibrary(_this, path);
+ }
+ if (retval == 0) {
+ _this->vulkan_config.loader_loaded++;
+ }
+ return retval;
+}
+
+void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ if (!_this->vulkan_config.loader_loaded) {
+ SDL_SetError("No Vulkan loader has been loaded");
+ return NULL;
+ }
+ return _this->vulkan_config.vkGetInstanceProcAddr;
+}
+
+void SDL_Vulkan_UnloadLibrary(void)
+{
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return;
+ }
+ if (_this->vulkan_config.loader_loaded > 0) {
+ if (--_this->vulkan_config.loader_loaded > 0) {
+ return;
+ }
+ if (_this->Vulkan_UnloadLibrary) {
+ _this->Vulkan_UnloadLibrary(_this);
+ }
+ }
+}
+
+SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names)
+{
+ CHECK_WINDOW_MAGIC(window, SDL_FALSE);
+
+ if (!(window->flags & SDL_WINDOW_VULKAN)) {
+ SDL_SetError(NOT_A_VULKAN_WINDOW);
+ return SDL_FALSE;
+ }
+
+ if (!count) {
+ SDL_InvalidParamError("count");
+ return SDL_FALSE;
+ }
+
+ return _this->Vulkan_GetInstanceExtensions(_this, window, count, names);
+}
+
+SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ CHECK_WINDOW_MAGIC(window, SDL_FALSE);
+
+ if (!(window->flags & SDL_WINDOW_VULKAN)) {
+ SDL_SetError(NOT_A_VULKAN_WINDOW);
+ return SDL_FALSE;
+ }
+
+ if (!instance) {
+ SDL_InvalidParamError("instance");
+ return SDL_FALSE;
+ }
+
+ if (!surface) {
+ SDL_InvalidParamError("surface");
+ return SDL_FALSE;
+ }
+
+ return _this->Vulkan_CreateSurface(_this, window, instance, surface);
+}
+
+void SDL_Vulkan_GetDrawableSize(SDL_Window * window, int *w, int *h)
+{
+ CHECK_WINDOW_MAGIC(window,);
+
+ if (_this->Vulkan_GetDrawableSize) {
+ _this->Vulkan_GetDrawableSize(_this, window, w, h);
+ } else {
+ SDL_GetWindowSize(window, w, h);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_vulkan_internal.h b/src/3rdparty/SDL2/src/video/SDL_vulkan_internal.h
new file mode 100644
index 0000000..cdf464e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_vulkan_internal.h
@@ -0,0 +1,91 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_vulkan_internal_h_
+#define SDL_vulkan_internal_h_
+
+#include "../SDL_internal.h"
+
+#include "SDL_stdinc.h"
+
+#if defined(SDL_LOADSO_DISABLED)
+#undef SDL_VIDEO_VULKAN
+#define SDL_VIDEO_VULKAN 0
+#endif
+
+#if SDL_VIDEO_VULKAN
+
+#if SDL_VIDEO_DRIVER_ANDROID
+#define VK_USE_PLATFORM_ANDROID_KHR
+#endif
+#if SDL_VIDEO_DRIVER_COCOA
+#define VK_USE_PLATFORM_MACOS_MVK
+#endif
+#if SDL_VIDEO_DRIVER_MIR
+#define VK_USE_PLATFORM_MIR_KHR
+#endif
+#if SDL_VIDEO_DRIVER_UIKIT
+#define VK_USE_PLATFORM_IOS_MVK
+#endif
+#if SDL_VIDEO_DRIVER_WAYLAND
+#define VK_USE_PLATFORM_WAYLAND_KHR
+#include "wayland/SDL_waylanddyn.h"
+#endif
+#if SDL_VIDEO_DRIVER_WINDOWS
+#define VK_USE_PLATFORM_WIN32_KHR
+#include "../core/windows/SDL_windows.h"
+#endif
+#if SDL_VIDEO_DRIVER_X11
+#define VK_USE_PLATFORM_XLIB_KHR
+#define VK_USE_PLATFORM_XCB_KHR
+#endif
+
+#define VK_NO_PROTOTYPES
+#include "./khronos/vulkan/vulkan.h"
+
+#include "SDL_vulkan.h"
+
+
+extern const char *SDL_Vulkan_GetResultString(VkResult result);
+
+extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
+ PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
+ Uint32 *extensionCount); /* free returned list with SDL_free */
+
+/* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of
+ * names passed in nameCount and names. */
+extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
+ const char **userNames,
+ unsigned nameCount,
+ const char *const *names);
+
+#else
+
+/* No SDL Vulkan support, just include the header for typedefs */
+#include "SDL_vulkan.h"
+
+typedef void (*PFN_vkGetInstanceProcAddr) (void);
+typedef int (*PFN_vkEnumerateInstanceExtensionProperties) (void);
+
+#endif /* SDL_VIDEO_VULKAN */
+
+#endif /* SDL_vulkan_internal_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_vulkan_utils.c b/src/3rdparty/SDL2/src/video/SDL_vulkan_utils.c
new file mode 100644
index 0000000..d4cbed4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_vulkan_utils.c
@@ -0,0 +1,172 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_vulkan_internal.h"
+#include "SDL_error.h"
+
+#if SDL_VIDEO_VULKAN
+
+const char *SDL_Vulkan_GetResultString(VkResult result)
+{
+ switch((int)result)
+ {
+ case VK_SUCCESS:
+ return "VK_SUCCESS";
+ case VK_NOT_READY:
+ return "VK_NOT_READY";
+ case VK_TIMEOUT:
+ return "VK_TIMEOUT";
+ case VK_EVENT_SET:
+ return "VK_EVENT_SET";
+ case VK_EVENT_RESET:
+ return "VK_EVENT_RESET";
+ case VK_INCOMPLETE:
+ return "VK_INCOMPLETE";
+ case VK_ERROR_OUT_OF_HOST_MEMORY:
+ return "VK_ERROR_OUT_OF_HOST_MEMORY";
+ case VK_ERROR_OUT_OF_DEVICE_MEMORY:
+ return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
+ case VK_ERROR_INITIALIZATION_FAILED:
+ return "VK_ERROR_INITIALIZATION_FAILED";
+ case VK_ERROR_DEVICE_LOST:
+ return "VK_ERROR_DEVICE_LOST";
+ case VK_ERROR_MEMORY_MAP_FAILED:
+ return "VK_ERROR_MEMORY_MAP_FAILED";
+ case VK_ERROR_LAYER_NOT_PRESENT:
+ return "VK_ERROR_LAYER_NOT_PRESENT";
+ case VK_ERROR_EXTENSION_NOT_PRESENT:
+ return "VK_ERROR_EXTENSION_NOT_PRESENT";
+ case VK_ERROR_FEATURE_NOT_PRESENT:
+ return "VK_ERROR_FEATURE_NOT_PRESENT";
+ case VK_ERROR_INCOMPATIBLE_DRIVER:
+ return "VK_ERROR_INCOMPATIBLE_DRIVER";
+ case VK_ERROR_TOO_MANY_OBJECTS:
+ return "VK_ERROR_TOO_MANY_OBJECTS";
+ case VK_ERROR_FORMAT_NOT_SUPPORTED:
+ return "VK_ERROR_FORMAT_NOT_SUPPORTED";
+ case VK_ERROR_FRAGMENTED_POOL:
+ return "VK_ERROR_FRAGMENTED_POOL";
+ case VK_ERROR_SURFACE_LOST_KHR:
+ return "VK_ERROR_SURFACE_LOST_KHR";
+ case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
+ return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
+ case VK_SUBOPTIMAL_KHR:
+ return "VK_SUBOPTIMAL_KHR";
+ case VK_ERROR_OUT_OF_DATE_KHR:
+ return "VK_ERROR_OUT_OF_DATE_KHR";
+ case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
+ return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
+ case VK_ERROR_VALIDATION_FAILED_EXT:
+ return "VK_ERROR_VALIDATION_FAILED_EXT";
+ case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
+ return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
+ case VK_ERROR_INVALID_SHADER_NV:
+ return "VK_ERROR_INVALID_SHADER_NV";
+ case VK_RESULT_MAX_ENUM:
+ case VK_RESULT_RANGE_SIZE:
+ break;
+ }
+ if(result < 0)
+ return "VK_ERROR_<Unknown>";
+ return "VK_<Unknown>";
+}
+
+VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
+ PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties,
+ Uint32 *extensionCount)
+{
+ Uint32 count = 0;
+ VkResult result = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
+ VkExtensionProperties *retval;
+ if(result == VK_ERROR_INCOMPATIBLE_DRIVER)
+ {
+ /* Avoid the ERR_MAX_STRLEN limit by passing part of the message
+ * as a string argument.
+ */
+ SDL_SetError(
+ "You probably don't have a working Vulkan driver installed. %s %s %s(%d)",
+ "Getting Vulkan extensions failed:",
+ "vkEnumerateInstanceExtensionProperties returned",
+ SDL_Vulkan_GetResultString(result),
+ (int)result);
+ return NULL;
+ }
+ else if(result != VK_SUCCESS)
+ {
+ SDL_SetError(
+ "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned "
+ "%s(%d)",
+ SDL_Vulkan_GetResultString(result),
+ (int)result);
+ return NULL;
+ }
+ if(count == 0)
+ {
+ retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null
+ }
+ else
+ {
+ retval = SDL_calloc(count, sizeof(VkExtensionProperties));
+ }
+ if(!retval)
+ {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ result = vkEnumerateInstanceExtensionProperties(NULL, &count, retval);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError(
+ "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned "
+ "%s(%d)",
+ SDL_Vulkan_GetResultString(result),
+ (int)result);
+ SDL_free(retval);
+ return NULL;
+ }
+ *extensionCount = count;
+ return retval;
+}
+
+SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
+ const char **userNames,
+ unsigned nameCount,
+ const char *const *names)
+{
+ if (userNames) {
+ unsigned i;
+
+ if (*userCount < nameCount) {
+ SDL_SetError("Output array for SDL_Vulkan_GetInstanceExtensions needs to be at least %d big", nameCount);
+ return SDL_FALSE;
+ }
+ for (i = 0; i < nameCount; i++) {
+ userNames[i] = names[i];
+ }
+ }
+ *userCount = nameCount;
+ return SDL_TRUE;
+}
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_yuv.c b/src/3rdparty/SDL2/src/video/SDL_yuv.c
new file mode 100644
index 0000000..50910a5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_yuv.c
@@ -0,0 +1,1834 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+#include "SDL_endian.h"
+#include "SDL_video.h"
+#include "SDL_pixels_c.h"
+
+#include "yuv2rgb/yuv_rgb.h"
+
+#define SDL_YUV_SD_THRESHOLD 576
+
+
+static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode = SDL_YUV_CONVERSION_BT601;
+
+
+void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode)
+{
+ SDL_YUV_ConversionMode = mode;
+}
+
+SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode()
+{
+ return SDL_YUV_ConversionMode;
+}
+
+SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height)
+{
+ SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionMode();
+ if (mode == SDL_YUV_CONVERSION_AUTOMATIC) {
+ if (height <= SDL_YUV_SD_THRESHOLD) {
+ mode = SDL_YUV_CONVERSION_BT601;
+ } else {
+ mode = SDL_YUV_CONVERSION_BT709;
+ }
+ }
+ return mode;
+}
+
+static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type)
+{
+ switch (SDL_GetYUVConversionModeForResolution(width, height)) {
+ case SDL_YUV_CONVERSION_JPEG:
+ *yuv_type = YCBCR_JPEG;
+ break;
+ case SDL_YUV_CONVERSION_BT601:
+ *yuv_type = YCBCR_601;
+ break;
+ case SDL_YUV_CONVERSION_BT709:
+ *yuv_type = YCBCR_709;
+ break;
+ default:
+ return SDL_SetError("Unexpected YUV conversion mode");
+ }
+ return 0;
+}
+
+static SDL_bool IsPlanar2x2Format(Uint32 format)
+{
+ return (format == SDL_PIXELFORMAT_YV12 ||
+ format == SDL_PIXELFORMAT_IYUV ||
+ format == SDL_PIXELFORMAT_NV12 ||
+ format == SDL_PIXELFORMAT_NV21);
+}
+
+static SDL_bool IsPacked4Format(Uint32 format)
+{
+ return (format == SDL_PIXELFORMAT_YUY2 ||
+ format == SDL_PIXELFORMAT_UYVY ||
+ format == SDL_PIXELFORMAT_YVYU);
+}
+
+static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch,
+ const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride)
+{
+ const Uint8 *planes[3] = { NULL, NULL, NULL };
+ int pitches[3] = { 0, 0, 0 };
+
+ switch (format) {
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ pitches[0] = yuv_pitch;
+ pitches[1] = (pitches[0] + 1) / 2;
+ pitches[2] = (pitches[0] + 1) / 2;
+ planes[0] = (const Uint8 *)yuv;
+ planes[1] = planes[0] + pitches[0] * height;
+ planes[2] = planes[1] + pitches[1] * ((height + 1) / 2);
+ break;
+ case SDL_PIXELFORMAT_YUY2:
+ case SDL_PIXELFORMAT_UYVY:
+ case SDL_PIXELFORMAT_YVYU:
+ pitches[0] = yuv_pitch;
+ planes[0] = (const Uint8 *)yuv;
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ pitches[0] = yuv_pitch;
+ pitches[1] = 2 * ((pitches[0] + 1) / 2);
+ planes[0] = (const Uint8 *)yuv;
+ planes[1] = planes[0] + pitches[0] * height;
+ break;
+ default:
+ return SDL_SetError("GetYUVPlanes(): Unsupported YUV format: %s", SDL_GetPixelFormatName(format));
+ }
+
+ switch (format) {
+ case SDL_PIXELFORMAT_YV12:
+ *y = planes[0];
+ *y_stride = pitches[0];
+ *v = planes[1];
+ *u = planes[2];
+ *uv_stride = pitches[1];
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ *y = planes[0];
+ *y_stride = pitches[0];
+ *v = planes[2];
+ *u = planes[1];
+ *uv_stride = pitches[1];
+ break;
+ case SDL_PIXELFORMAT_YUY2:
+ *y = planes[0];
+ *y_stride = pitches[0];
+ *v = *y + 3;
+ *u = *y + 1;
+ *uv_stride = pitches[0];
+ break;
+ case SDL_PIXELFORMAT_UYVY:
+ *y = planes[0] + 1;
+ *y_stride = pitches[0];
+ *v = *y + 1;
+ *u = *y - 1;
+ *uv_stride = pitches[0];
+ break;
+ case SDL_PIXELFORMAT_YVYU:
+ *y = planes[0];
+ *y_stride = pitches[0];
+ *v = *y + 1;
+ *u = *y + 3;
+ *uv_stride = pitches[0];
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ *y = planes[0];
+ *y_stride = pitches[0];
+ *u = planes[1];
+ *v = *u + 1;
+ *uv_stride = pitches[1];
+ break;
+ case SDL_PIXELFORMAT_NV21:
+ *y = planes[0];
+ *y_stride = pitches[0];
+ *v = planes[1];
+ *u = *v + 1;
+ *uv_stride = pitches[1];
+ break;
+ default:
+ /* Should have caught this above */
+ return SDL_SetError("GetYUVPlanes[2]: Unsupported YUV format: %s", SDL_GetPixelFormatName(format));
+ }
+ return 0;
+}
+
+static SDL_bool yuv_rgb_sse(
+ Uint32 src_format, Uint32 dst_format,
+ Uint32 width, Uint32 height,
+ const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
+ Uint8 *rgb, Uint32 rgb_stride,
+ YCbCrType yuv_type)
+{
+#ifdef __SSE2__
+ if (!SDL_HasSSE2()) {
+ return SDL_FALSE;
+ }
+
+ if (src_format == SDL_PIXELFORMAT_YV12 ||
+ src_format == SDL_PIXELFORMAT_IYUV) {
+
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_RGB565:
+ yuv420_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB24:
+ yuv420_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGBX8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ yuv420_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGRX8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ yuv420_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_ARGB8888:
+ yuv420_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ yuv420_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ default:
+ break;
+ }
+ }
+
+ if (src_format == SDL_PIXELFORMAT_YUY2 ||
+ src_format == SDL_PIXELFORMAT_UYVY ||
+ src_format == SDL_PIXELFORMAT_YVYU) {
+
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_RGB565:
+ yuv422_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB24:
+ yuv422_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGBX8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ yuv422_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGRX8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ yuv422_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_ARGB8888:
+ yuv422_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ yuv422_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ default:
+ break;
+ }
+ }
+
+ if (src_format == SDL_PIXELFORMAT_NV12 ||
+ src_format == SDL_PIXELFORMAT_NV21) {
+
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_RGB565:
+ yuvnv12_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB24:
+ yuvnv12_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGBX8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ yuvnv12_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGRX8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ yuvnv12_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_ARGB8888:
+ yuvnv12_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ yuvnv12_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ default:
+ break;
+ }
+ }
+#endif
+ return SDL_FALSE;
+}
+
+static SDL_bool yuv_rgb_std(
+ Uint32 src_format, Uint32 dst_format,
+ Uint32 width, Uint32 height,
+ const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
+ Uint8 *rgb, Uint32 rgb_stride,
+ YCbCrType yuv_type)
+{
+ if (src_format == SDL_PIXELFORMAT_YV12 ||
+ src_format == SDL_PIXELFORMAT_IYUV) {
+
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_RGB565:
+ yuv420_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB24:
+ yuv420_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGBX8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ yuv420_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGRX8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ yuv420_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_ARGB8888:
+ yuv420_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ yuv420_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ default:
+ break;
+ }
+ }
+
+ if (src_format == SDL_PIXELFORMAT_YUY2 ||
+ src_format == SDL_PIXELFORMAT_UYVY ||
+ src_format == SDL_PIXELFORMAT_YVYU) {
+
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_RGB565:
+ yuv422_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB24:
+ yuv422_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGBX8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ yuv422_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGRX8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ yuv422_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_ARGB8888:
+ yuv422_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ yuv422_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ default:
+ break;
+ }
+ }
+
+ if (src_format == SDL_PIXELFORMAT_NV12 ||
+ src_format == SDL_PIXELFORMAT_NV21) {
+
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_RGB565:
+ yuvnv12_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB24:
+ yuvnv12_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGBX8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ yuvnv12_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGRX8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ yuvnv12_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_ARGB8888:
+ yuvnv12_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ yuvnv12_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+ return SDL_TRUE;
+ default:
+ break;
+ }
+ }
+ return SDL_FALSE;
+}
+
+int
+SDL_ConvertPixels_YUV_to_RGB(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+ const Uint8 *y = NULL;
+ const Uint8 *u = NULL;
+ const Uint8 *v = NULL;
+ Uint32 y_stride = 0;
+ Uint32 uv_stride = 0;
+ YCbCrType yuv_type = YCBCR_601;
+
+ if (GetYUVPlanes(width, height, src_format, src, src_pitch, &y, &u, &v, &y_stride, &uv_stride) < 0) {
+ return -1;
+ }
+
+ if (GetYUVConversionType(width, height, &yuv_type) < 0) {
+ return -1;
+ }
+
+ if (yuv_rgb_sse(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) {
+ return 0;
+ }
+
+ if (yuv_rgb_std(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) {
+ return 0;
+ }
+
+ /* No fast path for the RGB format, instead convert using an intermediate buffer */
+ if (dst_format != SDL_PIXELFORMAT_ARGB8888) {
+ int ret;
+ void *tmp;
+ int tmp_pitch = (width * sizeof(Uint32));
+
+ tmp = SDL_malloc(tmp_pitch * height);
+ if (tmp == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* convert src/src_format to tmp/ARGB8888 */
+ ret = SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch);
+ if (ret < 0) {
+ SDL_free(tmp);
+ return ret;
+ }
+
+ /* convert tmp/ARGB8888 to dst/RGB */
+ ret = SDL_ConvertPixels(width, height, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch, dst_format, dst, dst_pitch);
+ SDL_free(tmp);
+ return ret;
+ }
+
+ return SDL_SetError("Unsupported YUV conversion");
+}
+
+struct RGB2YUVFactors
+{
+ int y_offset;
+ float y[3]; /* Rfactor, Gfactor, Bfactor */
+ float u[3]; /* Rfactor, Gfactor, Bfactor */
+ float v[3]; /* Rfactor, Gfactor, Bfactor */
+};
+
+static int
+SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
+{
+ const int src_pitch_x_2 = src_pitch * 2;
+ const int height_half = height / 2;
+ const int height_remainder = (height & 0x1);
+ const int width_half = width / 2;
+ const int width_remainder = (width & 0x1);
+ int i, j;
+
+ static struct RGB2YUVFactors RGB2YUVFactorTables[SDL_YUV_CONVERSION_BT709 + 1] =
+ {
+ /* ITU-T T.871 (JPEG) */
+ {
+ 0,
+ { 0.2990f, 0.5870f, 0.1140f },
+ { -0.1687f, -0.3313f, 0.5000f },
+ { 0.5000f, -0.4187f, -0.0813f },
+ },
+ /* ITU-R BT.601-7 */
+ {
+ 16,
+ { 0.2568f, 0.5041f, 0.0979f },
+ { -0.1482f, -0.2910f, 0.4392f },
+ { 0.4392f, -0.3678f, -0.0714f },
+ },
+ /* ITU-R BT.709-6 */
+ {
+ 16,
+ { 0.1826f, 0.6142f, 0.0620f },
+ {-0.1006f, -0.3386f, 0.4392f },
+ { 0.4392f, -0.3989f, -0.0403f },
+ },
+ };
+ const struct RGB2YUVFactors *cvt = &RGB2YUVFactorTables[SDL_GetYUVConversionModeForResolution(width, height)];
+
+#define MAKE_Y(r, g, b) (Uint8)((int)(cvt->y[0] * (r) + cvt->y[1] * (g) + cvt->y[2] * (b) + 0.5f) + cvt->y_offset)
+#define MAKE_U(r, g, b) (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128)
+#define MAKE_V(r, g, b) (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128)
+
+#define READ_2x2_PIXELS \
+ const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
+ const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \
+ const Uint32 p3 = ((const Uint32 *)next_row)[2 * i]; \
+ const Uint32 p4 = ((const Uint32 *)next_row)[2 * i + 1]; \
+ const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000) + (p3 & 0x00ff0000) + (p4 & 0x00ff0000)) >> 18; \
+ const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00) + (p3 & 0x0000ff00) + (p4 & 0x0000ff00)) >> 10; \
+ const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff) + (p3 & 0x000000ff) + (p4 & 0x000000ff)) >> 2; \
+
+#define READ_2x1_PIXELS \
+ const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
+ const Uint32 p2 = ((const Uint32 *)next_row)[2 * i]; \
+ const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \
+ const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \
+ const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \
+
+#define READ_1x2_PIXELS \
+ const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
+ const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \
+ const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \
+ const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \
+ const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \
+
+#define READ_1x1_PIXEL \
+ const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \
+ const Uint32 r = (p & 0x00ff0000) >> 16; \
+ const Uint32 g = (p & 0x0000ff00) >> 8; \
+ const Uint32 b = (p & 0x000000ff); \
+
+#define READ_TWO_RGB_PIXELS \
+ const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \
+ const Uint32 r = (p & 0x00ff0000) >> 16; \
+ const Uint32 g = (p & 0x0000ff00) >> 8; \
+ const Uint32 b = (p & 0x000000ff); \
+ const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i + 1]; \
+ const Uint32 r1 = (p1 & 0x00ff0000) >> 16; \
+ const Uint32 g1 = (p1 & 0x0000ff00) >> 8; \
+ const Uint32 b1 = (p1 & 0x000000ff); \
+ const Uint32 R = (r + r1)/2; \
+ const Uint32 G = (g + g1)/2; \
+ const Uint32 B = (b + b1)/2; \
+
+#define READ_ONE_RGB_PIXEL READ_1x1_PIXEL
+
+ switch (dst_format)
+ {
+ case SDL_PIXELFORMAT_YV12:
+ case SDL_PIXELFORMAT_IYUV:
+ case SDL_PIXELFORMAT_NV12:
+ case SDL_PIXELFORMAT_NV21:
+ {
+ const Uint8 *curr_row, *next_row;
+
+ Uint8 *plane_y;
+ Uint8 *plane_u;
+ Uint8 *plane_v;
+ Uint8 *plane_interleaved_uv;
+ Uint32 y_stride, uv_stride, y_skip, uv_skip;
+
+ GetYUVPlanes(width, height, dst_format, dst, dst_pitch,
+ (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v,
+ &y_stride, &uv_stride);
+ plane_interleaved_uv = (plane_y + height * y_stride);
+ y_skip = (y_stride - width);
+
+ curr_row = (const Uint8*)src;
+
+ /* Write Y plane */
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ const Uint32 p1 = ((const Uint32 *)curr_row)[i];
+ const Uint32 r = (p1 & 0x00ff0000) >> 16;
+ const Uint32 g = (p1 & 0x0000ff00) >> 8;
+ const Uint32 b = (p1 & 0x000000ff);
+ *plane_y++ = MAKE_Y(r, g, b);
+ }
+ plane_y += y_skip;
+ curr_row += src_pitch;
+ }
+
+ curr_row = (const Uint8*)src;
+ next_row = (const Uint8*)src;
+ next_row += src_pitch;
+
+ if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV)
+ {
+ /* Write UV planes, not interleaved */
+ uv_skip = (uv_stride - (width + 1)/2);
+ for (j = 0; j < height_half; j++) {
+ for (i = 0; i < width_half; i++) {
+ READ_2x2_PIXELS;
+ *plane_u++ = MAKE_U(r, g, b);
+ *plane_v++ = MAKE_V(r, g, b);
+ }
+ if (width_remainder) {
+ READ_2x1_PIXELS;
+ *plane_u++ = MAKE_U(r, g, b);
+ *plane_v++ = MAKE_V(r, g, b);
+ }
+ plane_u += uv_skip;
+ plane_v += uv_skip;
+ curr_row += src_pitch_x_2;
+ next_row += src_pitch_x_2;
+ }
+ if (height_remainder) {
+ for (i = 0; i < width_half; i++) {
+ READ_1x2_PIXELS;
+ *plane_u++ = MAKE_U(r, g, b);
+ *plane_v++ = MAKE_V(r, g, b);
+ }
+ if (width_remainder) {
+ READ_1x1_PIXEL;
+ *plane_u++ = MAKE_U(r, g, b);
+ *plane_v++ = MAKE_V(r, g, b);
+ }
+ plane_u += uv_skip;
+ plane_v += uv_skip;
+ }
+ }
+ else if (dst_format == SDL_PIXELFORMAT_NV12)
+ {
+ uv_skip = (uv_stride - ((width + 1)/2)*2);
+ for (j = 0; j < height_half; j++) {
+ for (i = 0; i < width_half; i++) {
+ READ_2x2_PIXELS;
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ }
+ if (width_remainder) {
+ READ_2x1_PIXELS;
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ }
+ plane_interleaved_uv += uv_skip;
+ curr_row += src_pitch_x_2;
+ next_row += src_pitch_x_2;
+ }
+ if (height_remainder) {
+ for (i = 0; i < width_half; i++) {
+ READ_1x2_PIXELS;
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ }
+ if (width_remainder) {
+ READ_1x1_PIXEL;
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ }
+ }
+ }
+ else /* dst_format == SDL_PIXELFORMAT_NV21 */
+ {
+ uv_skip = (uv_stride - ((width + 1)/2)*2);
+ for (j = 0; j < height_half; j++) {
+ for (i = 0; i < width_half; i++) {
+ READ_2x2_PIXELS;
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ }
+ if (width_remainder) {
+ READ_2x1_PIXELS;
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ }
+ plane_interleaved_uv += uv_skip;
+ curr_row += src_pitch_x_2;
+ next_row += src_pitch_x_2;
+ }
+ if (height_remainder) {
+ for (i = 0; i < width_half; i++) {
+ READ_1x2_PIXELS;
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ }
+ if (width_remainder) {
+ READ_1x1_PIXEL;
+ *plane_interleaved_uv++ = MAKE_V(r, g, b);
+ *plane_interleaved_uv++ = MAKE_U(r, g, b);
+ }
+ }
+ }
+ }
+ break;
+
+ case SDL_PIXELFORMAT_YUY2:
+ case SDL_PIXELFORMAT_UYVY:
+ case SDL_PIXELFORMAT_YVYU:
+ {
+ const Uint8 *curr_row = (const Uint8*) src;
+ Uint8 *plane = (Uint8*) dst;
+ const int row_size = (4 * ((width + 1) / 2));
+ int plane_skip;
+
+ if (dst_pitch < row_size) {
+ return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size);
+ }
+ plane_skip = (dst_pitch - row_size);
+
+ /* Write YUV plane, packed */
+ if (dst_format == SDL_PIXELFORMAT_YUY2)
+ {
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width_half; i++) {
+ READ_TWO_RGB_PIXELS;
+ /* Y U Y1 V */
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_U(R, G, B);
+ *plane++ = MAKE_Y(r1, g1, b1);
+ *plane++ = MAKE_V(R, G, B);
+ }
+ if (width_remainder) {
+ READ_ONE_RGB_PIXEL;
+ /* Y U Y V */
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_U(r, g, b);
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_V(r, g, b);
+ }
+ plane += plane_skip;
+ curr_row += src_pitch;
+ }
+ }
+ else if (dst_format == SDL_PIXELFORMAT_UYVY)
+ {
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width_half; i++) {
+ READ_TWO_RGB_PIXELS;
+ /* U Y V Y1 */
+ *plane++ = MAKE_U(R, G, B);
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_V(R, G, B);
+ *plane++ = MAKE_Y(r1, g1, b1);
+ }
+ if (width_remainder) {
+ READ_ONE_RGB_PIXEL;
+ /* U Y V Y */
+ *plane++ = MAKE_U(r, g, b);
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_V(r, g, b);
+ *plane++ = MAKE_Y(r, g, b);
+ }
+ plane += plane_skip;
+ curr_row += src_pitch;
+ }
+ }
+ else if (dst_format == SDL_PIXELFORMAT_YVYU)
+ {
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width_half; i++) {
+ READ_TWO_RGB_PIXELS;
+ /* Y V Y1 U */
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_V(R, G, B);
+ *plane++ = MAKE_Y(r1, g1, b1);
+ *plane++ = MAKE_U(R, G, B);
+ }
+ if (width_remainder) {
+ READ_ONE_RGB_PIXEL;
+ /* Y V Y U */
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_V(r, g, b);
+ *plane++ = MAKE_Y(r, g, b);
+ *plane++ = MAKE_U(r, g, b);
+ }
+ plane += plane_skip;
+ curr_row += src_pitch;
+ }
+ }
+ }
+ break;
+
+ default:
+ return SDL_SetError("Unsupported YUV destination format: %s", SDL_GetPixelFormatName(dst_format));
+ }
+#undef MAKE_Y
+#undef MAKE_U
+#undef MAKE_V
+#undef READ_2x2_PIXELS
+#undef READ_2x1_PIXELS
+#undef READ_1x2_PIXELS
+#undef READ_1x1_PIXEL
+#undef READ_TWO_RGB_PIXELS
+#undef READ_ONE_RGB_PIXEL
+ return 0;
+}
+
+int
+SDL_ConvertPixels_RGB_to_YUV(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+#if 0 /* Doesn't handle odd widths */
+ /* RGB24 to FOURCC */
+ if (src_format == SDL_PIXELFORMAT_RGB24) {
+ Uint8 *y;
+ Uint8 *u;
+ Uint8 *v;
+ Uint32 y_stride;
+ Uint32 uv_stride;
+ YCbCrType yuv_type;
+
+ if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, (const Uint8 **)&y, (const Uint8 **)&u, (const Uint8 **)&v, &y_stride, &uv_stride) < 0) {
+ return -1;
+ }
+
+ if (GetYUVConversionType(width, height, &yuv_type) < 0) {
+ return -1;
+ }
+
+ rgb24_yuv420_std(width, height, src, src_pitch, y, u, v, y_stride, uv_stride, yuv_type);
+ return 0;
+ }
+#endif
+
+ /* ARGB8888 to FOURCC */
+ if (src_format == SDL_PIXELFORMAT_ARGB8888) {
+ return SDL_ConvertPixels_ARGB8888_to_YUV(width, height, src, src_pitch, dst_format, dst, dst_pitch);
+ }
+
+ /* not ARGB8888 to FOURCC : need an intermediate conversion */
+ {
+ int ret;
+ void *tmp;
+ int tmp_pitch = (width * sizeof(Uint32));
+
+ tmp = SDL_malloc(tmp_pitch * height);
+ if (tmp == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* convert src/src_format to tmp/ARGB8888 */
+ ret = SDL_ConvertPixels(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch);
+ if (ret == -1) {
+ SDL_free(tmp);
+ return ret;
+ }
+
+ /* convert tmp/ARGB8888 to dst/FOURCC */
+ ret = SDL_ConvertPixels_ARGB8888_to_YUV(width, height, tmp, tmp_pitch, dst_format, dst, dst_pitch);
+ SDL_free(tmp);
+ return ret;
+ }
+}
+
+static int
+SDL_ConvertPixels_YUV_to_YUV_Copy(int width, int height, Uint32 format,
+ const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int i;
+
+ if (IsPlanar2x2Format(format)) {
+ /* Y plane */
+ for (i = height; i--;) {
+ SDL_memcpy(dst, src, width);
+ src = (const Uint8*)src + src_pitch;
+ dst = (Uint8*)dst + dst_pitch;
+ }
+
+ if (format == SDL_PIXELFORMAT_YV12 || format == SDL_PIXELFORMAT_IYUV) {
+ /* U and V planes are a quarter the size of the Y plane, rounded up */
+ width = (width + 1) / 2;
+ height = (height + 1) / 2;
+ src_pitch = (src_pitch + 1) / 2;
+ dst_pitch = (dst_pitch + 1) / 2;
+ for (i = height * 2; i--;) {
+ SDL_memcpy(dst, src, width);
+ src = (const Uint8*)src + src_pitch;
+ dst = (Uint8*)dst + dst_pitch;
+ }
+ } else if (format == SDL_PIXELFORMAT_NV12 || format == SDL_PIXELFORMAT_NV21) {
+ /* U/V plane is half the height of the Y plane, rounded up */
+ height = (height + 1) / 2;
+ width = ((width + 1) / 2)*2;
+ src_pitch = ((src_pitch + 1) / 2)*2;
+ dst_pitch = ((dst_pitch + 1) / 2)*2;
+ for (i = height; i--;) {
+ SDL_memcpy(dst, src, width);
+ src = (const Uint8*)src + src_pitch;
+ dst = (Uint8*)dst + dst_pitch;
+ }
+ }
+ return 0;
+ }
+
+ if (IsPacked4Format(format)) {
+ /* Packed planes */
+ width = 4 * ((width + 1) / 2);
+ for (i = height; i--;) {
+ SDL_memcpy(dst, src, width);
+ src = (const Uint8*)src + src_pitch;
+ dst = (Uint8*)dst + dst_pitch;
+ }
+ return 0;
+ }
+
+ return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV_Copy: Unsupported YUV format: %s", SDL_GetPixelFormatName(format));
+}
+
+static int
+SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int y;
+ const int UVwidth = (width + 1)/2;
+ const int UVheight = (height + 1)/2;
+
+ /* Skip the Y plane */
+ src = (const Uint8 *)src + height * src_pitch;
+ dst = (Uint8 *)dst + height * dst_pitch;
+
+ if (src == dst) {
+ int UVpitch = (dst_pitch + 1)/2;
+ Uint8 *tmp;
+ Uint8 *row1 = dst;
+ Uint8 *row2 = (Uint8 *)dst + UVheight * UVpitch;
+
+ /* Allocate a temporary row for the swap */
+ tmp = (Uint8 *)SDL_malloc(UVwidth);
+ if (!tmp) {
+ return SDL_OutOfMemory();
+ }
+ for (y = 0; y < UVheight; ++y) {
+ SDL_memcpy(tmp, row1, UVwidth);
+ SDL_memcpy(row1, row2, UVwidth);
+ SDL_memcpy(row2, tmp, UVwidth);
+ row1 += UVpitch;
+ row2 += UVpitch;
+ }
+ SDL_free(tmp);
+ } else {
+ const Uint8 *srcUV;
+ Uint8 *dstUV;
+ int srcUVPitch = ((src_pitch + 1)/2);
+ int dstUVPitch = ((dst_pitch + 1)/2);
+
+ /* Copy the first plane */
+ srcUV = (const Uint8 *)src;
+ dstUV = (Uint8 *)dst + UVheight * dstUVPitch;
+ for (y = 0; y < UVheight; ++y) {
+ SDL_memcpy(dstUV, srcUV, UVwidth);
+ srcUV += srcUVPitch;
+ dstUV += dstUVPitch;
+ }
+
+ /* Copy the second plane */
+ dstUV = (Uint8 *)dst;
+ for (y = 0; y < UVheight; ++y) {
+ SDL_memcpy(dstUV, srcUV, UVwidth);
+ srcUV += srcUVPitch;
+ dstUV += dstUVPitch;
+ }
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
+{
+ int x, y;
+ const int UVwidth = (width + 1)/2;
+ const int UVheight = (height + 1)/2;
+ const int srcUVPitch = ((src_pitch + 1)/2);
+ const int srcUVPitchLeft = srcUVPitch - UVwidth;
+ const int dstUVPitch = ((dst_pitch + 1)/2)*2;
+ const int dstUVPitchLeft = dstUVPitch - UVwidth*2;
+ const Uint8 *src1, *src2;
+ Uint8 *dstUV;
+ Uint8 *tmp = NULL;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ /* Skip the Y plane */
+ src = (const Uint8 *)src + height * src_pitch;
+ dst = (Uint8 *)dst + height * dst_pitch;
+
+ if (src == dst) {
+ /* Need to make a copy of the buffer so we don't clobber it while converting */
+ tmp = (Uint8 *)SDL_malloc(2*UVheight*srcUVPitch);
+ if (!tmp) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memcpy(tmp, src, 2*UVheight*srcUVPitch);
+ src = tmp;
+ }
+
+ if (reverseUV) {
+ src2 = (const Uint8 *)src;
+ src1 = src2 + UVheight * srcUVPitch;
+ } else {
+ src1 = (const Uint8 *)src;
+ src2 = src1 + UVheight * srcUVPitch;
+ }
+ dstUV = (Uint8 *)dst;
+
+ y = UVheight;
+ while (y--) {
+ x = UVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ while (x >= 16) {
+ __m128i u = _mm_loadu_si128((__m128i *)src1);
+ __m128i v = _mm_loadu_si128((__m128i *)src2);
+ __m128i uv1 = _mm_unpacklo_epi8(u, v);
+ __m128i uv2 = _mm_unpackhi_epi8(u, v);
+ _mm_storeu_si128((__m128i*)dstUV, uv1);
+ _mm_storeu_si128((__m128i*)(dstUV + 16), uv2);
+ src1 += 16;
+ src2 += 16;
+ dstUV += 32;
+ x -= 16;
+ }
+ }
+#endif
+ while (x--) {
+ *dstUV++ = *src1++;
+ *dstUV++ = *src2++;
+ }
+ src1 += srcUVPitchLeft;
+ src2 += srcUVPitchLeft;
+ dstUV += dstUVPitchLeft;
+ }
+
+ if (tmp) {
+ SDL_free(tmp);
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
+{
+ int x, y;
+ const int UVwidth = (width + 1)/2;
+ const int UVheight = (height + 1)/2;
+ const int srcUVPitch = ((src_pitch + 1)/2)*2;
+ const int srcUVPitchLeft = srcUVPitch - UVwidth*2;
+ const int dstUVPitch = ((dst_pitch + 1)/2);
+ const int dstUVPitchLeft = dstUVPitch - UVwidth;
+ const Uint8 *srcUV;
+ Uint8 *dst1, *dst2;
+ Uint8 *tmp = NULL;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ /* Skip the Y plane */
+ src = (const Uint8 *)src + height * src_pitch;
+ dst = (Uint8 *)dst + height * dst_pitch;
+
+ if (src == dst) {
+ /* Need to make a copy of the buffer so we don't clobber it while converting */
+ tmp = (Uint8 *)SDL_malloc(UVheight*srcUVPitch);
+ if (!tmp) {
+ return SDL_OutOfMemory();
+ }
+ SDL_memcpy(tmp, src, UVheight*srcUVPitch);
+ src = tmp;
+ }
+
+ if (reverseUV) {
+ dst2 = (Uint8 *)dst;
+ dst1 = dst2 + UVheight * dstUVPitch;
+ } else {
+ dst1 = (Uint8 *)dst;
+ dst2 = dst1 + UVheight * dstUVPitch;
+ }
+ srcUV = (const Uint8 *)src;
+
+ y = UVheight;
+ while (y--) {
+ x = UVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ __m128i mask = _mm_set1_epi16(0x00FF);
+ while (x >= 16) {
+ __m128i uv1 = _mm_loadu_si128((__m128i*)srcUV);
+ __m128i uv2 = _mm_loadu_si128((__m128i*)(srcUV+16));
+ __m128i u1 = _mm_and_si128(uv1, mask);
+ __m128i u2 = _mm_and_si128(uv2, mask);
+ __m128i u = _mm_packus_epi16(u1, u2);
+ __m128i v1 = _mm_srli_epi16(uv1, 8);
+ __m128i v2 = _mm_srli_epi16(uv2, 8);
+ __m128i v = _mm_packus_epi16(v1, v2);
+ _mm_storeu_si128((__m128i*)dst1, u);
+ _mm_storeu_si128((__m128i*)dst2, v);
+ srcUV += 32;
+ dst1 += 16;
+ dst2 += 16;
+ x -= 16;
+ }
+ }
+#endif
+ while (x--) {
+ *dst1++ = *srcUV++;
+ *dst2++ = *srcUV++;
+ }
+ srcUV += srcUVPitchLeft;
+ dst1 += dstUVPitchLeft;
+ dst2 += dstUVPitchLeft;
+ }
+
+ if (tmp) {
+ SDL_free(tmp);
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int UVwidth = (width + 1)/2;
+ const int UVheight = (height + 1)/2;
+ const int srcUVPitch = ((src_pitch + 1)/2)*2;
+ const int srcUVPitchLeft = (srcUVPitch - UVwidth*2)/sizeof(Uint16);
+ const int dstUVPitch = ((dst_pitch + 1)/2)*2;
+ const int dstUVPitchLeft = (dstUVPitch - UVwidth*2)/sizeof(Uint16);
+ const Uint16 *srcUV;
+ Uint16 *dstUV;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ /* Skip the Y plane */
+ src = (const Uint8 *)src + height * src_pitch;
+ dst = (Uint8 *)dst + height * dst_pitch;
+
+ srcUV = (const Uint16 *)src;
+ dstUV = (Uint16 *)dst;
+ y = UVheight;
+ while (y--) {
+ x = UVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ while (x >= 8) {
+ __m128i uv = _mm_loadu_si128((__m128i*)srcUV);
+ __m128i v = _mm_slli_epi16(uv, 8);
+ __m128i u = _mm_srli_epi16(uv, 8);
+ __m128i vu = _mm_or_si128(v, u);
+ _mm_storeu_si128((__m128i*)dstUV, vu);
+ srcUV += 8;
+ dstUV += 8;
+ x -= 8;
+ }
+ }
+#endif
+ while (x--) {
+ *dstUV++ = SDL_Swap16(*srcUV++);
+ }
+ srcUV += srcUVPitchLeft;
+ dstUV += dstUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+ if (src != dst) {
+ /* Copy Y plane */
+ int i;
+ const Uint8 *srcY = (const Uint8 *)src;
+ Uint8 *dstY = (Uint8 *)dst;
+ for (i = height; i--; ) {
+ SDL_memcpy(dstY, srcY, width);
+ srcY += src_pitch;
+ dstY += dst_pitch;
+ }
+ }
+
+ switch (src_format) {
+ case SDL_PIXELFORMAT_YV12:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_IYUV:
+ return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch);
+ case SDL_PIXELFORMAT_NV12:
+ return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE);
+ case SDL_PIXELFORMAT_NV21:
+ return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE);
+ default:
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_IYUV:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_YV12:
+ return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch);
+ case SDL_PIXELFORMAT_NV12:
+ return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE);
+ case SDL_PIXELFORMAT_NV21:
+ return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE);
+ default:
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_NV12:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_YV12:
+ return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE);
+ case SDL_PIXELFORMAT_IYUV:
+ return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE);
+ case SDL_PIXELFORMAT_NV21:
+ return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch);
+ default:
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_NV21:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_YV12:
+ return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE);
+ case SDL_PIXELFORMAT_IYUV:
+ return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE);
+ case SDL_PIXELFORMAT_NV12:
+ return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch);
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return SDL_SetError("SDL_ConvertPixels_Planar2x2_to_Planar2x2: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
+}
+
+#define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \
+ while (x >= 4) { \
+ __m128i yuv = _mm_loadu_si128((__m128i*)srcYUV); \
+ __m128i lo = _mm_unpacklo_epi8(yuv, _mm_setzero_si128()); \
+ __m128i hi = _mm_unpackhi_epi8(yuv, _mm_setzero_si128()); \
+ lo = _mm_shufflelo_epi16(lo, shuffle); \
+ lo = _mm_shufflehi_epi16(lo, shuffle); \
+ hi = _mm_shufflelo_epi16(hi, shuffle); \
+ hi = _mm_shufflehi_epi16(hi, shuffle); \
+ yuv = _mm_packus_epi16(lo, hi); \
+ _mm_storeu_si128((__m128i*)dstYUV, yuv); \
+ srcYUV += 16; \
+ dstYUV += 16; \
+ x -= 4; \
+ } \
+
+static int
+SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int YUVwidth = (width + 1)/2;
+ const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
+ const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
+ const Uint8 *srcYUV = (const Uint8 *)src;
+ Uint8 *dstYUV = (Uint8 *)dst;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ y = height;
+ while (y--) {
+ x = YUVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1));
+ }
+#endif
+ while (x--) {
+ Uint8 Y1, U, Y2, V;
+
+ Y1 = srcYUV[0];
+ U = srcYUV[1];
+ Y2 = srcYUV[2];
+ V = srcYUV[3];
+ srcYUV += 4;
+
+ dstYUV[0] = U;
+ dstYUV[1] = Y1;
+ dstYUV[2] = V;
+ dstYUV[3] = Y2;
+ dstYUV += 4;
+ }
+ srcYUV += srcYUVPitchLeft;
+ dstYUV += dstYUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int YUVwidth = (width + 1)/2;
+ const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
+ const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
+ const Uint8 *srcYUV = (const Uint8 *)src;
+ Uint8 *dstYUV = (Uint8 *)dst;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ y = height;
+ while (y--) {
+ x = YUVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0));
+ }
+#endif
+ while (x--) {
+ Uint8 Y1, U, Y2, V;
+
+ Y1 = srcYUV[0];
+ U = srcYUV[1];
+ Y2 = srcYUV[2];
+ V = srcYUV[3];
+ srcYUV += 4;
+
+ dstYUV[0] = Y1;
+ dstYUV[1] = V;
+ dstYUV[2] = Y2;
+ dstYUV[3] = U;
+ dstYUV += 4;
+ }
+ srcYUV += srcYUVPitchLeft;
+ dstYUV += dstYUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int YUVwidth = (width + 1)/2;
+ const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
+ const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
+ const Uint8 *srcYUV = (const Uint8 *)src;
+ Uint8 *dstYUV = (Uint8 *)dst;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ y = height;
+ while (y--) {
+ x = YUVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1));
+ }
+#endif
+ while (x--) {
+ Uint8 Y1, U, Y2, V;
+
+ U = srcYUV[0];
+ Y1 = srcYUV[1];
+ V = srcYUV[2];
+ Y2 = srcYUV[3];
+ srcYUV += 4;
+
+ dstYUV[0] = Y1;
+ dstYUV[1] = U;
+ dstYUV[2] = Y2;
+ dstYUV[3] = V;
+ dstYUV += 4;
+ }
+ srcYUV += srcYUVPitchLeft;
+ dstYUV += dstYUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int YUVwidth = (width + 1)/2;
+ const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
+ const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
+ const Uint8 *srcYUV = (const Uint8 *)src;
+ Uint8 *dstYUV = (Uint8 *)dst;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ y = height;
+ while (y--) {
+ x = YUVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(0, 3, 2, 1));
+ }
+#endif
+ while (x--) {
+ Uint8 Y1, U, Y2, V;
+
+ U = srcYUV[0];
+ Y1 = srcYUV[1];
+ V = srcYUV[2];
+ Y2 = srcYUV[3];
+ srcYUV += 4;
+
+ dstYUV[0] = Y1;
+ dstYUV[1] = V;
+ dstYUV[2] = Y2;
+ dstYUV[3] = U;
+ dstYUV += 4;
+ }
+ srcYUV += srcYUVPitchLeft;
+ dstYUV += dstYUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int YUVwidth = (width + 1)/2;
+ const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
+ const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
+ const Uint8 *srcYUV = (const Uint8 *)src;
+ Uint8 *dstYUV = (Uint8 *)dst;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ y = height;
+ while (y--) {
+ x = YUVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0));
+ }
+#endif
+ while (x--) {
+ Uint8 Y1, U, Y2, V;
+
+ Y1 = srcYUV[0];
+ V = srcYUV[1];
+ Y2 = srcYUV[2];
+ U = srcYUV[3];
+ srcYUV += 4;
+
+ dstYUV[0] = Y1;
+ dstYUV[1] = U;
+ dstYUV[2] = Y2;
+ dstYUV[3] = V;
+ dstYUV += 4;
+ }
+ srcYUV += srcYUVPitchLeft;
+ dstYUV += dstYUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
+{
+ int x, y;
+ const int YUVwidth = (width + 1)/2;
+ const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
+ const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
+ const Uint8 *srcYUV = (const Uint8 *)src;
+ Uint8 *dstYUV = (Uint8 *)dst;
+#ifdef __SSE2__
+ const SDL_bool use_SSE2 = SDL_HasSSE2();
+#endif
+
+ y = height;
+ while (y--) {
+ x = YUVwidth;
+#ifdef __SSE2__
+ if (use_SSE2) {
+ PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 1, 0, 3));
+ }
+#endif
+ while (x--) {
+ Uint8 Y1, U, Y2, V;
+
+ Y1 = srcYUV[0];
+ V = srcYUV[1];
+ Y2 = srcYUV[2];
+ U = srcYUV[3];
+ srcYUV += 4;
+
+ dstYUV[0] = U;
+ dstYUV[1] = Y1;
+ dstYUV[2] = V;
+ dstYUV[3] = Y2;
+ dstYUV += 4;
+ }
+ srcYUV += srcYUVPitchLeft;
+ dstYUV += dstYUVPitchLeft;
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_Packed4_to_Packed4(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+ switch (src_format) {
+ case SDL_PIXELFORMAT_YUY2:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_UYVY:
+ return SDL_ConvertPixels_YUY2_to_UYVY(width, height, src, src_pitch, dst, dst_pitch);
+ case SDL_PIXELFORMAT_YVYU:
+ return SDL_ConvertPixels_YUY2_to_YVYU(width, height, src, src_pitch, dst, dst_pitch);
+ default:
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_UYVY:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_YUY2:
+ return SDL_ConvertPixels_UYVY_to_YUY2(width, height, src, src_pitch, dst, dst_pitch);
+ case SDL_PIXELFORMAT_YVYU:
+ return SDL_ConvertPixels_UYVY_to_YVYU(width, height, src, src_pitch, dst, dst_pitch);
+ default:
+ break;
+ }
+ break;
+ case SDL_PIXELFORMAT_YVYU:
+ switch (dst_format) {
+ case SDL_PIXELFORMAT_YUY2:
+ return SDL_ConvertPixels_YVYU_to_YUY2(width, height, src, src_pitch, dst, dst_pitch);
+ case SDL_PIXELFORMAT_UYVY:
+ return SDL_ConvertPixels_YVYU_to_UYVY(width, height, src, src_pitch, dst, dst_pitch);
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return SDL_SetError("SDL_ConvertPixels_Packed4_to_Packed4: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
+}
+
+static int
+SDL_ConvertPixels_Planar2x2_to_Packed4(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+ int x, y;
+ const Uint8 *srcY1, *srcY2, *srcU, *srcV;
+ Uint32 srcY_pitch, srcUV_pitch;
+ Uint32 srcY_pitch_left, srcUV_pitch_left, srcUV_pixel_stride;
+ Uint8 *dstY1, *dstY2, *dstU1, *dstU2, *dstV1, *dstV2;
+ Uint32 dstY_pitch, dstUV_pitch;
+ Uint32 dst_pitch_left;
+
+ if (src == dst) {
+ return SDL_SetError("Can't change YUV plane types in-place");
+ }
+
+ if (GetYUVPlanes(width, height, src_format, src, src_pitch,
+ &srcY1, &srcU, &srcV, &srcY_pitch, &srcUV_pitch) < 0) {
+ return -1;
+ }
+ srcY2 = srcY1 + srcY_pitch;
+ srcY_pitch_left = (srcY_pitch - width);
+
+ if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) {
+ srcUV_pixel_stride = 2;
+ srcUV_pitch_left = (srcUV_pitch - 2*((width + 1)/2));
+ } else {
+ srcUV_pixel_stride = 1;
+ srcUV_pitch_left = (srcUV_pitch - ((width + 1)/2));
+ }
+
+ if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch,
+ (const Uint8 **)&dstY1, (const Uint8 **)&dstU1, (const Uint8 **)&dstV1,
+ &dstY_pitch, &dstUV_pitch) < 0) {
+ return -1;
+ }
+ dstY2 = dstY1 + dstY_pitch;
+ dstU2 = dstU1 + dstUV_pitch;
+ dstV2 = dstV1 + dstUV_pitch;
+ dst_pitch_left = (dstY_pitch - 4*((width + 1)/2));
+
+ /* Copy 2x2 blocks of pixels at a time */
+ for (y = 0; y < (height - 1); y += 2) {
+ for (x = 0; x < (width - 1); x += 2) {
+ /* Row 1 */
+ *dstY1 = *srcY1++;
+ dstY1 += 2;
+ *dstY1 = *srcY1++;
+ dstY1 += 2;
+ *dstU1 = *srcU;
+ *dstV1 = *srcV;
+
+ /* Row 2 */
+ *dstY2 = *srcY2++;
+ dstY2 += 2;
+ *dstY2 = *srcY2++;
+ dstY2 += 2;
+ *dstU2 = *srcU;
+ *dstV2 = *srcV;
+
+ srcU += srcUV_pixel_stride;
+ srcV += srcUV_pixel_stride;
+ dstU1 += 4;
+ dstU2 += 4;
+ dstV1 += 4;
+ dstV2 += 4;
+ }
+
+ /* Last column */
+ if (x == (width - 1)) {
+ /* Row 1 */
+ *dstY1 = *srcY1;
+ dstY1 += 2;
+ *dstY1 = *srcY1++;
+ dstY1 += 2;
+ *dstU1 = *srcU;
+ *dstV1 = *srcV;
+
+ /* Row 2 */
+ *dstY2 = *srcY2;
+ dstY2 += 2;
+ *dstY2 = *srcY2++;
+ dstY2 += 2;
+ *dstU2 = *srcU;
+ *dstV2 = *srcV;
+
+ srcU += srcUV_pixel_stride;
+ srcV += srcUV_pixel_stride;
+ dstU1 += 4;
+ dstU2 += 4;
+ dstV1 += 4;
+ dstV2 += 4;
+ }
+
+ srcY1 += srcY_pitch_left + srcY_pitch;
+ srcY2 += srcY_pitch_left + srcY_pitch;
+ srcU += srcUV_pitch_left;
+ srcV += srcUV_pitch_left;
+ dstY1 += dst_pitch_left + dstY_pitch;
+ dstY2 += dst_pitch_left + dstY_pitch;
+ dstU1 += dst_pitch_left + dstUV_pitch;
+ dstU2 += dst_pitch_left + dstUV_pitch;
+ dstV1 += dst_pitch_left + dstUV_pitch;
+ dstV2 += dst_pitch_left + dstUV_pitch;
+ }
+
+ /* Last row */
+ if (y == (height - 1)) {
+ for (x = 0; x < (width - 1); x += 2) {
+ /* Row 1 */
+ *dstY1 = *srcY1++;
+ dstY1 += 2;
+ *dstY1 = *srcY1++;
+ dstY1 += 2;
+ *dstU1 = *srcU;
+ *dstV1 = *srcV;
+
+ srcU += srcUV_pixel_stride;
+ srcV += srcUV_pixel_stride;
+ dstU1 += 4;
+ dstV1 += 4;
+ }
+
+ /* Last column */
+ if (x == (width - 1)) {
+ /* Row 1 */
+ *dstY1 = *srcY1;
+ dstY1 += 2;
+ *dstY1 = *srcY1++;
+ dstY1 += 2;
+ *dstU1 = *srcU;
+ *dstV1 = *srcV;
+
+ srcU += srcUV_pixel_stride;
+ srcV += srcUV_pixel_stride;
+ dstU1 += 4;
+ dstV1 += 4;
+ }
+ }
+ return 0;
+}
+
+static int
+SDL_ConvertPixels_Packed4_to_Planar2x2(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+ int x, y;
+ const Uint8 *srcY1, *srcY2, *srcU1, *srcU2, *srcV1, *srcV2;
+ Uint32 srcY_pitch, srcUV_pitch;
+ Uint32 src_pitch_left;
+ Uint8 *dstY1, *dstY2, *dstU, *dstV;
+ Uint32 dstY_pitch, dstUV_pitch;
+ Uint32 dstY_pitch_left, dstUV_pitch_left, dstUV_pixel_stride;
+
+ if (src == dst) {
+ return SDL_SetError("Can't change YUV plane types in-place");
+ }
+
+ if (GetYUVPlanes(width, height, src_format, src, src_pitch,
+ &srcY1, &srcU1, &srcV1, &srcY_pitch, &srcUV_pitch) < 0) {
+ return -1;
+ }
+ srcY2 = srcY1 + srcY_pitch;
+ srcU2 = srcU1 + srcUV_pitch;
+ srcV2 = srcV1 + srcUV_pitch;
+ src_pitch_left = (srcY_pitch - 4*((width + 1)/2));
+
+ if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch,
+ (const Uint8 **)&dstY1, (const Uint8 **)&dstU, (const Uint8 **)&dstV,
+ &dstY_pitch, &dstUV_pitch) < 0) {
+ return -1;
+ }
+ dstY2 = dstY1 + dstY_pitch;
+ dstY_pitch_left = (dstY_pitch - width);
+
+ if (dst_format == SDL_PIXELFORMAT_NV12 || dst_format == SDL_PIXELFORMAT_NV21) {
+ dstUV_pixel_stride = 2;
+ dstUV_pitch_left = (dstUV_pitch - 2*((width + 1)/2));
+ } else {
+ dstUV_pixel_stride = 1;
+ dstUV_pitch_left = (dstUV_pitch - ((width + 1)/2));
+ }
+
+ /* Copy 2x2 blocks of pixels at a time */
+ for (y = 0; y < (height - 1); y += 2) {
+ for (x = 0; x < (width - 1); x += 2) {
+ /* Row 1 */
+ *dstY1++ = *srcY1;
+ srcY1 += 2;
+ *dstY1++ = *srcY1;
+ srcY1 += 2;
+
+ /* Row 2 */
+ *dstY2++ = *srcY2;
+ srcY2 += 2;
+ *dstY2++ = *srcY2;
+ srcY2 += 2;
+
+ *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2);
+ *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2);
+
+ srcU1 += 4;
+ srcU2 += 4;
+ srcV1 += 4;
+ srcV2 += 4;
+ dstU += dstUV_pixel_stride;
+ dstV += dstUV_pixel_stride;
+ }
+
+ /* Last column */
+ if (x == (width - 1)) {
+ /* Row 1 */
+ *dstY1 = *srcY1;
+ srcY1 += 2;
+ *dstY1++ = *srcY1;
+ srcY1 += 2;
+
+ /* Row 2 */
+ *dstY2 = *srcY2;
+ srcY2 += 2;
+ *dstY2++ = *srcY2;
+ srcY2 += 2;
+
+ *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2);
+ *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2);
+
+ srcU1 += 4;
+ srcU2 += 4;
+ srcV1 += 4;
+ srcV2 += 4;
+ dstU += dstUV_pixel_stride;
+ dstV += dstUV_pixel_stride;
+ }
+
+ srcY1 += src_pitch_left + srcY_pitch;
+ srcY2 += src_pitch_left + srcY_pitch;
+ srcU1 += src_pitch_left + srcUV_pitch;
+ srcU2 += src_pitch_left + srcUV_pitch;
+ srcV1 += src_pitch_left + srcUV_pitch;
+ srcV2 += src_pitch_left + srcUV_pitch;
+ dstY1 += dstY_pitch_left + dstY_pitch;
+ dstY2 += dstY_pitch_left + dstY_pitch;
+ dstU += dstUV_pitch_left;
+ dstV += dstUV_pitch_left;
+ }
+
+ /* Last row */
+ if (y == (height - 1)) {
+ for (x = 0; x < (width - 1); x += 2) {
+ *dstY1++ = *srcY1;
+ srcY1 += 2;
+ *dstY1++ = *srcY1;
+ srcY1 += 2;
+
+ *dstU = *srcU1;
+ *dstV = *srcV1;
+
+ srcU1 += 4;
+ srcV1 += 4;
+ dstU += dstUV_pixel_stride;
+ dstV += dstUV_pixel_stride;
+ }
+
+ /* Last column */
+ if (x == (width - 1)) {
+ *dstY1 = *srcY1;
+ *dstU = *srcU1;
+ *dstV = *srcV1;
+ }
+ }
+ return 0;
+}
+
+int
+SDL_ConvertPixels_YUV_to_YUV(int width, int height,
+ Uint32 src_format, const void *src, int src_pitch,
+ Uint32 dst_format, void *dst, int dst_pitch)
+{
+ if (src_format == dst_format) {
+ if (src == dst) {
+ /* Nothing to do */
+ return 0;
+ }
+ return SDL_ConvertPixels_YUV_to_YUV_Copy(width, height, src_format, src, src_pitch, dst, dst_pitch);
+ }
+
+ if (IsPlanar2x2Format(src_format) && IsPlanar2x2Format(dst_format)) {
+ return SDL_ConvertPixels_Planar2x2_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ } else if (IsPacked4Format(src_format) && IsPacked4Format(dst_format)) {
+ return SDL_ConvertPixels_Packed4_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ } else if (IsPlanar2x2Format(src_format) && IsPacked4Format(dst_format)) {
+ return SDL_ConvertPixels_Planar2x2_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ } else if (IsPacked4Format(src_format) && IsPlanar2x2Format(dst_format)) {
+ return SDL_ConvertPixels_Packed4_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
+ } else {
+ return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/SDL_yuv_c.h b/src/3rdparty/SDL2/src/video/SDL_yuv_c.h
new file mode 100644
index 0000000..6fe02b0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/SDL_yuv_c.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+
+/* YUV conversion functions */
+
+extern int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch);
+extern int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch);
+extern int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.c b/src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.c
new file mode 100644
index 0000000..c913af5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.c
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+#include "SDL_androidvideo.h"
+#include "SDL_androidclipboard.h"
+#include "../../core/android/SDL_android.h"
+
+int
+Android_SetClipboardText(_THIS, const char *text)
+{
+ return Android_JNI_SetClipboardText(text);
+}
+
+char *
+Android_GetClipboardText(_THIS)
+{
+ return Android_JNI_GetClipboardText();
+}
+
+SDL_bool Android_HasClipboardText(_THIS)
+{
+ return Android_JNI_HasClipboardText();
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.h b/src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.h
new file mode 100644
index 0000000..7f48b0e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidclipboard.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_androidclipboard_h_
+#define SDL_androidclipboard_h_
+
+extern int Android_SetClipboardText(_THIS, const char *text);
+extern char *Android_GetClipboardText(_THIS);
+extern SDL_bool Android_HasClipboardText(_THIS);
+
+#endif /* SDL_androidclipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidevents.c b/src/3rdparty/SDL2/src/video/android/SDL_androidevents.c
new file mode 100644
index 0000000..6cf9af2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidevents.c
@@ -0,0 +1,123 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+/* We're going to do this by default */
+#define SDL_ANDROID_BLOCK_ON_PAUSE 1
+
+#include "SDL_androidevents.h"
+#include "SDL_events.h"
+#include "SDL_androidwindow.h"
+
+#if !SDL_AUDIO_DISABLED
+/* Can't include sysaudio "../../audio/android/SDL_androidaudio.h"
+ * because of THIS redefinition */
+extern void ANDROIDAUDIO_ResumeDevices(void);
+extern void ANDROIDAUDIO_PauseDevices(void);
+#else
+static void ANDROIDAUDIO_ResumeDevices(void) {}
+static void ANDROIDAUDIO_PauseDevices(void) {}
+#endif
+
+static void
+android_egl_context_restore()
+{
+ SDL_Event event;
+ SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
+ if (SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context) < 0) {
+ /* The context is no longer valid, create a new one */
+ data->egl_context = (EGLContext) SDL_GL_CreateContext(Android_Window);
+ SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context);
+ event.type = SDL_RENDER_DEVICE_RESET;
+ SDL_PushEvent(&event);
+ }
+}
+
+static void
+android_egl_context_backup()
+{
+ /* Keep a copy of the EGL Context so we can try to restore it when we resume */
+ SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
+ data->egl_context = SDL_GL_GetCurrentContext();
+ /* We need to do this so the EGLSurface can be freed */
+ SDL_GL_MakeCurrent(Android_Window, NULL);
+}
+
+void
+Android_PumpEvents(_THIS)
+{
+ static int isPaused = 0;
+#if SDL_ANDROID_BLOCK_ON_PAUSE
+ static int isPausing = 0;
+#endif
+ /* No polling necessary */
+
+ /*
+ * Android_ResumeSem and Android_PauseSem are signaled from Java_org_libsdl_app_SDLActivity_nativePause and Java_org_libsdl_app_SDLActivity_nativeResume
+ * When the pause semaphore is signaled, if SDL_ANDROID_BLOCK_ON_PAUSE is defined the event loop will block until the resume signal is emitted.
+ */
+
+#if SDL_ANDROID_BLOCK_ON_PAUSE
+ if (isPaused && !isPausing) {
+ /* Make sure this is the last thing we do before pausing */
+ android_egl_context_backup();
+ ANDROIDAUDIO_PauseDevices();
+ if(SDL_SemWait(Android_ResumeSem) == 0) {
+#else
+ if (isPaused) {
+ if(SDL_SemTryWait(Android_ResumeSem) == 0) {
+#endif
+ isPaused = 0;
+ ANDROIDAUDIO_ResumeDevices();
+ /* Restore the GL Context from here, as this operation is thread dependent */
+ if (!SDL_HasEvent(SDL_QUIT)) {
+ android_egl_context_restore();
+ }
+ }
+ }
+ else {
+#if SDL_ANDROID_BLOCK_ON_PAUSE
+ if( isPausing || SDL_SemTryWait(Android_PauseSem) == 0 ) {
+ /* We've been signaled to pause, but before we block ourselves,
+ we need to make sure that certain key events have reached the app */
+ if (SDL_HasEvent(SDL_WINDOWEVENT) || SDL_HasEvent(SDL_APP_WILLENTERBACKGROUND) || SDL_HasEvent(SDL_APP_DIDENTERBACKGROUND) ) {
+ isPausing = 1;
+ }
+ else {
+ isPausing = 0;
+ isPaused = 1;
+ }
+ }
+#else
+ if(SDL_SemTryWait(Android_PauseSem) == 0) {
+ android_egl_context_backup();
+ ANDROIDAUDIO_PauseDevices();
+ isPaused = 1;
+ }
+#endif
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidevents.h b/src/3rdparty/SDL2/src/video/android/SDL_androidevents.h
new file mode 100644
index 0000000..00e7427
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidevents.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_androidvideo.h"
+
+extern void Android_PumpEvents(_THIS);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidgl.c b/src/3rdparty/SDL2/src/video/android/SDL_androidgl.c
new file mode 100644
index 0000000..859b46e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidgl.c
@@ -0,0 +1,62 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+/* Android SDL video driver implementation */
+
+#include "SDL_video.h"
+#include "../SDL_egl_c.h"
+#include "SDL_androidwindow.h"
+
+#include "SDL_androidvideo.h"
+#include "SDL_androidgl.h"
+#include "../../core/android/SDL_android.h"
+
+#include <android/log.h>
+
+#include <dlfcn.h>
+
+SDL_EGL_CreateContext_impl(Android)
+SDL_EGL_MakeCurrent_impl(Android)
+
+int
+Android_GLES_SwapWindow(_THIS, SDL_Window * window)
+{
+ /* The following two calls existed in the original Java code
+ * If you happen to have a device that's affected by their removal,
+ * please report to Bugzilla. -- Gabriel
+ */
+
+ /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
+ _this->egl_data->eglWaitGL();*/
+ return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+}
+
+int
+Android_GLES_LoadLibrary(_THIS, const char *path) {
+ return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0, 0);
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidgl.h b/src/3rdparty/SDL2/src/video/android/SDL_androidgl.h
new file mode 100644
index 0000000..1dab5a6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidgl.h
@@ -0,0 +1,34 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_androidgl_h_
+#define SDL_androidgl_h_
+
+SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window);
+int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+int Android_GLES_SwapWindow(_THIS, SDL_Window * window);
+int Android_GLES_LoadLibrary(_THIS, const char *path);
+
+
+#endif /* SDL_androidgl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.c b/src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.c
new file mode 100644
index 0000000..6c94cac
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.c
@@ -0,0 +1,391 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+#include <android/log.h>
+
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_androidkeyboard.h"
+
+#include "../../core/android/SDL_android.h"
+
+void Android_InitKeyboard(void)
+{
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+
+ /* Add default scancode to key mapping */
+ SDL_GetDefaultKeymap(keymap);
+ SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+}
+
+static SDL_Scancode Android_Keycodes[] = {
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_UNKNOWN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_LEFT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_RIGHT */
+ SDL_SCANCODE_AC_HOME, /* AKEYCODE_HOME */
+ SDL_SCANCODE_AC_BACK, /* AKEYCODE_BACK */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CALL */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_ENDCALL */
+ SDL_SCANCODE_0, /* AKEYCODE_0 */
+ SDL_SCANCODE_1, /* AKEYCODE_1 */
+ SDL_SCANCODE_2, /* AKEYCODE_2 */
+ SDL_SCANCODE_3, /* AKEYCODE_3 */
+ SDL_SCANCODE_4, /* AKEYCODE_4 */
+ SDL_SCANCODE_5, /* AKEYCODE_5 */
+ SDL_SCANCODE_6, /* AKEYCODE_6 */
+ SDL_SCANCODE_7, /* AKEYCODE_7 */
+ SDL_SCANCODE_8, /* AKEYCODE_8 */
+ SDL_SCANCODE_9, /* AKEYCODE_9 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STAR */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_POUND */
+ SDL_SCANCODE_UP, /* AKEYCODE_DPAD_UP */
+ SDL_SCANCODE_DOWN, /* AKEYCODE_DPAD_DOWN */
+ SDL_SCANCODE_LEFT, /* AKEYCODE_DPAD_LEFT */
+ SDL_SCANCODE_RIGHT, /* AKEYCODE_DPAD_RIGHT */
+ SDL_SCANCODE_SELECT, /* AKEYCODE_DPAD_CENTER */
+ SDL_SCANCODE_VOLUMEUP, /* AKEYCODE_VOLUME_UP */
+ SDL_SCANCODE_VOLUMEDOWN, /* AKEYCODE_VOLUME_DOWN */
+ SDL_SCANCODE_POWER, /* AKEYCODE_POWER */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CAMERA */
+ SDL_SCANCODE_CLEAR, /* AKEYCODE_CLEAR */
+ SDL_SCANCODE_A, /* AKEYCODE_A */
+ SDL_SCANCODE_B, /* AKEYCODE_B */
+ SDL_SCANCODE_C, /* AKEYCODE_C */
+ SDL_SCANCODE_D, /* AKEYCODE_D */
+ SDL_SCANCODE_E, /* AKEYCODE_E */
+ SDL_SCANCODE_F, /* AKEYCODE_F */
+ SDL_SCANCODE_G, /* AKEYCODE_G */
+ SDL_SCANCODE_H, /* AKEYCODE_H */
+ SDL_SCANCODE_I, /* AKEYCODE_I */
+ SDL_SCANCODE_J, /* AKEYCODE_J */
+ SDL_SCANCODE_K, /* AKEYCODE_K */
+ SDL_SCANCODE_L, /* AKEYCODE_L */
+ SDL_SCANCODE_M, /* AKEYCODE_M */
+ SDL_SCANCODE_N, /* AKEYCODE_N */
+ SDL_SCANCODE_O, /* AKEYCODE_O */
+ SDL_SCANCODE_P, /* AKEYCODE_P */
+ SDL_SCANCODE_Q, /* AKEYCODE_Q */
+ SDL_SCANCODE_R, /* AKEYCODE_R */
+ SDL_SCANCODE_S, /* AKEYCODE_S */
+ SDL_SCANCODE_T, /* AKEYCODE_T */
+ SDL_SCANCODE_U, /* AKEYCODE_U */
+ SDL_SCANCODE_V, /* AKEYCODE_V */
+ SDL_SCANCODE_W, /* AKEYCODE_W */
+ SDL_SCANCODE_X, /* AKEYCODE_X */
+ SDL_SCANCODE_Y, /* AKEYCODE_Y */
+ SDL_SCANCODE_Z, /* AKEYCODE_Z */
+ SDL_SCANCODE_COMMA, /* AKEYCODE_COMMA */
+ SDL_SCANCODE_PERIOD, /* AKEYCODE_PERIOD */
+ SDL_SCANCODE_LALT, /* AKEYCODE_ALT_LEFT */
+ SDL_SCANCODE_RALT, /* AKEYCODE_ALT_RIGHT */
+ SDL_SCANCODE_LSHIFT, /* AKEYCODE_SHIFT_LEFT */
+ SDL_SCANCODE_RSHIFT, /* AKEYCODE_SHIFT_RIGHT */
+ SDL_SCANCODE_TAB, /* AKEYCODE_TAB */
+ SDL_SCANCODE_SPACE, /* AKEYCODE_SPACE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SYM */
+ SDL_SCANCODE_WWW, /* AKEYCODE_EXPLORER */
+ SDL_SCANCODE_MAIL, /* AKEYCODE_ENVELOPE */
+ SDL_SCANCODE_RETURN, /* AKEYCODE_ENTER */
+ SDL_SCANCODE_BACKSPACE, /* AKEYCODE_DEL */
+ SDL_SCANCODE_GRAVE, /* AKEYCODE_GRAVE */
+ SDL_SCANCODE_MINUS, /* AKEYCODE_MINUS */
+ SDL_SCANCODE_EQUALS, /* AKEYCODE_EQUALS */
+ SDL_SCANCODE_LEFTBRACKET, /* AKEYCODE_LEFT_BRACKET */
+ SDL_SCANCODE_RIGHTBRACKET, /* AKEYCODE_RIGHT_BRACKET */
+ SDL_SCANCODE_BACKSLASH, /* AKEYCODE_BACKSLASH */
+ SDL_SCANCODE_SEMICOLON, /* AKEYCODE_SEMICOLON */
+ SDL_SCANCODE_APOSTROPHE, /* AKEYCODE_APOSTROPHE */
+ SDL_SCANCODE_SLASH, /* AKEYCODE_SLASH */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_AT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NUM */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_HEADSETHOOK */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_FOCUS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PLUS */
+ SDL_SCANCODE_MENU, /* AKEYCODE_MENU */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NOTIFICATION */
+ SDL_SCANCODE_AC_SEARCH, /* AKEYCODE_SEARCH */
+ SDL_SCANCODE_AUDIOPLAY, /* AKEYCODE_MEDIA_PLAY_PAUSE */
+ SDL_SCANCODE_AUDIOSTOP, /* AKEYCODE_MEDIA_STOP */
+ SDL_SCANCODE_AUDIONEXT, /* AKEYCODE_MEDIA_NEXT */
+ SDL_SCANCODE_AUDIOPREV, /* AKEYCODE_MEDIA_PREVIOUS */
+ SDL_SCANCODE_AUDIOREWIND, /* AKEYCODE_MEDIA_REWIND */
+ SDL_SCANCODE_AUDIOFASTFORWARD, /* AKEYCODE_MEDIA_FAST_FORWARD */
+ SDL_SCANCODE_MUTE, /* AKEYCODE_MUTE */
+ SDL_SCANCODE_PAGEUP, /* AKEYCODE_PAGE_UP */
+ SDL_SCANCODE_PAGEDOWN, /* AKEYCODE_PAGE_DOWN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PICTSYMBOLS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SWITCH_CHARSET */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_A */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_B */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_C */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_X */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_Y */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_Z */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_L1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_R1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_L2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_R2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_THUMBL */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_THUMBR */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_START */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_SELECT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_MODE */
+ SDL_SCANCODE_ESCAPE, /* AKEYCODE_ESCAPE */
+ SDL_SCANCODE_DELETE, /* AKEYCODE_FORWARD_DEL */
+ SDL_SCANCODE_LCTRL, /* AKEYCODE_CTRL_LEFT */
+ SDL_SCANCODE_RCTRL, /* AKEYCODE_CTRL_RIGHT */
+ SDL_SCANCODE_CAPSLOCK, /* AKEYCODE_CAPS_LOCK */
+ SDL_SCANCODE_SCROLLLOCK, /* AKEYCODE_SCROLL_LOCK */
+ SDL_SCANCODE_LGUI, /* AKEYCODE_META_LEFT */
+ SDL_SCANCODE_RGUI, /* AKEYCODE_META_RIGHT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_FUNCTION */
+ SDL_SCANCODE_PRINTSCREEN, /* AKEYCODE_SYSRQ */
+ SDL_SCANCODE_PAUSE, /* AKEYCODE_BREAK */
+ SDL_SCANCODE_HOME, /* AKEYCODE_MOVE_HOME */
+ SDL_SCANCODE_END, /* AKEYCODE_MOVE_END */
+ SDL_SCANCODE_INSERT, /* AKEYCODE_INSERT */
+ SDL_SCANCODE_AC_FORWARD, /* AKEYCODE_FORWARD */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_PLAY */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_PAUSE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_CLOSE */
+ SDL_SCANCODE_EJECT, /* AKEYCODE_MEDIA_EJECT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_RECORD */
+ SDL_SCANCODE_F1, /* AKEYCODE_F1 */
+ SDL_SCANCODE_F2, /* AKEYCODE_F2 */
+ SDL_SCANCODE_F3, /* AKEYCODE_F3 */
+ SDL_SCANCODE_F4, /* AKEYCODE_F4 */
+ SDL_SCANCODE_F5, /* AKEYCODE_F5 */
+ SDL_SCANCODE_F6, /* AKEYCODE_F6 */
+ SDL_SCANCODE_F7, /* AKEYCODE_F7 */
+ SDL_SCANCODE_F8, /* AKEYCODE_F8 */
+ SDL_SCANCODE_F9, /* AKEYCODE_F9 */
+ SDL_SCANCODE_F10, /* AKEYCODE_F10 */
+ SDL_SCANCODE_F11, /* AKEYCODE_F11 */
+ SDL_SCANCODE_F12, /* AKEYCODE_F12 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NUM_LOCK */
+ SDL_SCANCODE_KP_0, /* AKEYCODE_NUMPAD_0 */
+ SDL_SCANCODE_KP_1, /* AKEYCODE_NUMPAD_1 */
+ SDL_SCANCODE_KP_2, /* AKEYCODE_NUMPAD_2 */
+ SDL_SCANCODE_KP_3, /* AKEYCODE_NUMPAD_3 */
+ SDL_SCANCODE_KP_4, /* AKEYCODE_NUMPAD_4 */
+ SDL_SCANCODE_KP_5, /* AKEYCODE_NUMPAD_5 */
+ SDL_SCANCODE_KP_6, /* AKEYCODE_NUMPAD_6 */
+ SDL_SCANCODE_KP_7, /* AKEYCODE_NUMPAD_7 */
+ SDL_SCANCODE_KP_8, /* AKEYCODE_NUMPAD_8 */
+ SDL_SCANCODE_KP_9, /* AKEYCODE_NUMPAD_9 */
+ SDL_SCANCODE_KP_DIVIDE, /* AKEYCODE_NUMPAD_DIVIDE */
+ SDL_SCANCODE_KP_MULTIPLY, /* AKEYCODE_NUMPAD_MULTIPLY */
+ SDL_SCANCODE_KP_MINUS, /* AKEYCODE_NUMPAD_SUBTRACT */
+ SDL_SCANCODE_KP_PLUS, /* AKEYCODE_NUMPAD_ADD */
+ SDL_SCANCODE_KP_PERIOD, /* AKEYCODE_NUMPAD_DOT */
+ SDL_SCANCODE_KP_COMMA, /* AKEYCODE_NUMPAD_COMMA */
+ SDL_SCANCODE_KP_ENTER, /* AKEYCODE_NUMPAD_ENTER */
+ SDL_SCANCODE_KP_EQUALS, /* AKEYCODE_NUMPAD_EQUALS */
+ SDL_SCANCODE_KP_LEFTPAREN, /* AKEYCODE_NUMPAD_LEFT_PAREN */
+ SDL_SCANCODE_KP_RIGHTPAREN, /* AKEYCODE_NUMPAD_RIGHT_PAREN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_VOLUME_MUTE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_INFO */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CHANNEL_UP */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CHANNEL_DOWN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_ZOOM_IN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_ZOOM_OUT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_WINDOW */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_GUIDE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DVR */
+ SDL_SCANCODE_AC_BOOKMARKS, /* AKEYCODE_BOOKMARK */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CAPTIONS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SETTINGS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_POWER */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STB_POWER */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STB_INPUT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_AVR_POWER */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_AVR_INPUT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PROG_RED */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PROG_GREEN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PROG_YELLOW */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PROG_BLUE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_APP_SWITCH */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_3 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_4 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_5 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_6 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_7 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_8 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_9 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_10 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_11 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_12 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_13 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_14 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_15 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_BUTTON_16 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_LANGUAGE_SWITCH */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MANNER_MODE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_3D_MODE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CONTACTS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CALENDAR */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MUSIC */
+ SDL_SCANCODE_CALCULATOR, /* AKEYCODE_CALCULATOR */
+ SDL_SCANCODE_LANG5, /* AKEYCODE_ZENKAKU_HANKAKU */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_EISU */
+ SDL_SCANCODE_INTERNATIONAL5, /* AKEYCODE_MUHENKAN */
+ SDL_SCANCODE_INTERNATIONAL4, /* AKEYCODE_HENKAN */
+ SDL_SCANCODE_LANG3, /* AKEYCODE_KATAKANA_HIRAGANA */
+ SDL_SCANCODE_INTERNATIONAL3, /* AKEYCODE_YEN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_RO */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_KANA */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_ASSIST */
+ SDL_SCANCODE_BRIGHTNESSDOWN, /* AKEYCODE_BRIGHTNESS_DOWN */
+ SDL_SCANCODE_BRIGHTNESSUP, /* AKEYCODE_BRIGHTNESS_UP */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_AUDIO_TRACK */
+ SDL_SCANCODE_SLEEP, /* AKEYCODE_SLEEP */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_WAKEUP */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_PAIRING */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_TOP_MENU */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_11 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_12 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_LAST_CHANNEL */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_DATA_SERVICE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_VOICE_ASSIST */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_RADIO_SERVICE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_TELETEXT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_NUMBER_ENTRY */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_TERRESTRIAL_ANALOG */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_TERRESTRIAL_DIGITAL */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_SATELLITE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_SATELLITE_BS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_SATELLITE_CS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_SATELLITE_SERVICE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_NETWORK */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_ANTENNA_CABLE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_HDMI_1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_HDMI_2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_HDMI_3 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_HDMI_4 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_COMPOSITE_1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_COMPOSITE_2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_COMPONENT_1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_COMPONENT_2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_INPUT_VGA_1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_AUDIO_DESCRIPTION */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_ZOOM_MODE */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_CONTENTS_MENU */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_MEDIA_CONTEXT_MENU */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_TIMER_PROGRAMMING */
+ SDL_SCANCODE_HELP, /* AKEYCODE_HELP */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_PREVIOUS */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_NEXT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_IN */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_OUT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_PRIMARY */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_1 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_2 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_3 */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_UP_LEFT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_DOWN_LEFT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_UP_RIGHT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_DOWN_RIGHT */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_SKIP_FORWARD */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_SKIP_BACKWARD */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_STEP_FORWARD */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_STEP_BACKWARD */
+ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_SLEEP */
+ SDL_SCANCODE_CUT, /* AKEYCODE_CUT */
+ SDL_SCANCODE_COPY, /* AKEYCODE_COPY */
+ SDL_SCANCODE_PASTE, /* AKEYCODE_PASTE */
+};
+
+static SDL_Scancode
+TranslateKeycode(int keycode)
+{
+ SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
+
+ if (keycode < SDL_arraysize(Android_Keycodes)) {
+ scancode = Android_Keycodes[keycode];
+ }
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ __android_log_print(ANDROID_LOG_INFO, "SDL", "Unknown keycode %d", keycode);
+ }
+ return scancode;
+}
+
+int
+Android_OnKeyDown(int keycode)
+{
+ return SDL_SendKeyboardKey(SDL_PRESSED, TranslateKeycode(keycode));
+}
+
+int
+Android_OnKeyUp(int keycode)
+{
+ return SDL_SendKeyboardKey(SDL_RELEASED, TranslateKeycode(keycode));
+}
+
+SDL_bool
+Android_HasScreenKeyboardSupport(_THIS)
+{
+ return SDL_TRUE;
+}
+
+SDL_bool
+Android_IsScreenKeyboardShown(_THIS, SDL_Window * window)
+{
+ return Android_JNI_IsScreenKeyboardShown();
+}
+
+void
+Android_StartTextInput(_THIS)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ Android_JNI_ShowTextInput(&videodata->textRect);
+}
+
+void
+Android_StopTextInput(_THIS)
+{
+ Android_JNI_HideTextInput();
+}
+
+void
+Android_SetTextInputRect(_THIS, SDL_Rect *rect)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return;
+ }
+
+ videodata->textRect = *rect;
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.h b/src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.h
new file mode 100644
index 0000000..a1a10f5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidkeyboard.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_androidvideo.h"
+
+extern void Android_InitKeyboard(void);
+extern int Android_OnKeyDown(int keycode);
+extern int Android_OnKeyUp(int keycode);
+
+extern SDL_bool Android_HasScreenKeyboardSupport(_THIS);
+extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window * window);
+
+extern void Android_StartTextInput(_THIS);
+extern void Android_StopTextInput(_THIS);
+extern void Android_SetTextInputRect(_THIS, SDL_Rect *rect);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.c b/src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.c
new file mode 100644
index 0000000..1716024
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.c
@@ -0,0 +1,37 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+#include "SDL_messagebox.h"
+#include "SDL_androidmessagebox.h"
+#include "../../core/android/SDL_android.h"
+
+int
+Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ return Android_JNI_ShowMessageBox(messageboxdata, buttonid);
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.h b/src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.h
new file mode 100644
index 0000000..2c3a44f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidmessagebox.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+extern int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidmouse.c b/src/3rdparty/SDL2/src/video/android/SDL_androidmouse.c
new file mode 100644
index 0000000..1c075fb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidmouse.c
@@ -0,0 +1,117 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+#include "SDL_androidmouse.h"
+
+#include "SDL_events.h"
+#include "../../events/SDL_mouse_c.h"
+
+#include "../../core/android/SDL_android.h"
+
+/* See Android's MotionEvent class for constants */
+#define ACTION_DOWN 0
+#define ACTION_UP 1
+#define ACTION_MOVE 2
+#define ACTION_HOVER_MOVE 7
+#define ACTION_SCROLL 8
+#define BUTTON_PRIMARY 1
+#define BUTTON_SECONDARY 2
+#define BUTTON_TERTIARY 4
+#define BUTTON_BACK 8
+#define BUTTON_FORWARD 16
+
+/* Last known Android mouse button state (includes all buttons) */
+static int last_state;
+
+void
+Android_InitMouse(void)
+{
+ last_state = 0;
+}
+
+/* Translate Android mouse button state to SDL mouse button */
+static Uint8
+TranslateButton(int state)
+{
+ if (state & BUTTON_PRIMARY) {
+ return SDL_BUTTON_LEFT;
+ } else if (state & BUTTON_SECONDARY) {
+ return SDL_BUTTON_RIGHT;
+ } else if (state & BUTTON_TERTIARY) {
+ return SDL_BUTTON_MIDDLE;
+ } else if (state & BUTTON_FORWARD) {
+ return SDL_BUTTON_X1;
+ } else if (state & BUTTON_BACK) {
+ return SDL_BUTTON_X2;
+ } else {
+ return 0;
+ }
+}
+
+void
+Android_OnMouse(int state, int action, float x, float y)
+{
+ int changes;
+ Uint8 button;
+
+ if (!Android_Window) {
+ return;
+ }
+
+ switch(action) {
+ case ACTION_DOWN:
+ changes = state & ~last_state;
+ button = TranslateButton(changes);
+ last_state = state;
+ SDL_SendMouseMotion(Android_Window, 0, 0, x, y);
+ SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, button);
+ break;
+
+ case ACTION_UP:
+ changes = last_state & ~state;
+ button = TranslateButton(changes);
+ last_state = state;
+ SDL_SendMouseMotion(Android_Window, 0, 0, x, y);
+ SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, button);
+ break;
+
+ case ACTION_MOVE:
+ case ACTION_HOVER_MOVE:
+ SDL_SendMouseMotion(Android_Window, 0, 0, x, y);
+ break;
+
+ case ACTION_SCROLL:
+ SDL_SendMouseWheel(Android_Window, 0, x, y, SDL_MOUSEWHEEL_NORMAL);
+ break;
+
+ default:
+ break;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidmouse.h b/src/3rdparty/SDL2/src/video/android/SDL_androidmouse.h
new file mode 100644
index 0000000..f201fad
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidmouse.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_androidmouse_h_
+#define SDL_androidmouse_h_
+
+#include "SDL_androidvideo.h"
+
+extern void Android_InitMouse(void);
+extern void Android_OnMouse( int button, int action, float x, float y);
+
+#endif /* SDL_androidmouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidtouch.c b/src/3rdparty/SDL2/src/video/android/SDL_androidtouch.c
new file mode 100644
index 0000000..5c3e4aa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidtouch.c
@@ -0,0 +1,151 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+#include <android/log.h>
+
+#include "SDL_hints.h"
+#include "SDL_events.h"
+#include "SDL_log.h"
+#include "SDL_androidtouch.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+#include "../../core/android/SDL_android.h"
+
+#define ACTION_DOWN 0
+#define ACTION_UP 1
+#define ACTION_MOVE 2
+#define ACTION_CANCEL 3
+#define ACTION_OUTSIDE 4
+#define ACTION_POINTER_DOWN 5
+#define ACTION_POINTER_UP 6
+
+static void Android_GetWindowCoordinates(float x, float y,
+ int *window_x, int *window_y)
+{
+ int window_w, window_h;
+
+ SDL_GetWindowSize(Android_Window, &window_w, &window_h);
+ *window_x = (int)(x * window_w);
+ *window_y = (int)(y * window_h);
+}
+
+static SDL_bool separate_mouse_and_touch = SDL_FALSE;
+
+static void SDLCALL
+SeparateEventsHintWatcher(void *userdata, const char *name,
+ const char *oldValue, const char *newValue)
+{
+ separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0));
+
+ Android_JNI_SetSeparateMouseAndTouch(separate_mouse_and_touch);
+}
+
+void Android_InitTouch(void)
+{
+ int i;
+ int* ids;
+ const int number = Android_JNI_GetTouchDeviceIds(&ids);
+
+ SDL_AddHintCallback(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH,
+ SeparateEventsHintWatcher, NULL);
+
+ if (0 < number) {
+ for (i = 0; i < number; ++i) {
+ SDL_AddTouch((SDL_TouchID) ids[i], ""); /* no error handling */
+ }
+ SDL_free(ids);
+ }
+}
+
+void Android_QuitTouch(void)
+{
+ SDL_DelHintCallback(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH,
+ SeparateEventsHintWatcher, NULL);
+ separate_mouse_and_touch = SDL_FALSE;
+}
+
+void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p)
+{
+ SDL_TouchID touchDeviceId = 0;
+ SDL_FingerID fingerId = 0;
+ int window_x, window_y;
+ static SDL_FingerID pointerFingerID = 0;
+
+ if (!Android_Window) {
+ return;
+ }
+
+ touchDeviceId = (SDL_TouchID)touch_device_id_in;
+ if (SDL_AddTouch(touchDeviceId, "") < 0) {
+ SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
+ }
+
+ fingerId = (SDL_FingerID)pointer_finger_id_in;
+ switch (action) {
+ case ACTION_DOWN:
+ /* Primary pointer down */
+ if (!separate_mouse_and_touch) {
+ Android_GetWindowCoordinates(x, y, &window_x, &window_y);
+ /* send moved event */
+ SDL_SendMouseMotion(Android_Window, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
+ /* send mouse down event */
+ SDL_SendMouseButton(Android_Window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
+ }
+ pointerFingerID = fingerId;
+ case ACTION_POINTER_DOWN:
+ /* Non primary pointer down */
+ SDL_SendTouch(touchDeviceId, fingerId, SDL_TRUE, x, y, p);
+ break;
+
+ case ACTION_MOVE:
+ if (!pointerFingerID) {
+ if (!separate_mouse_and_touch) {
+ Android_GetWindowCoordinates(x, y, &window_x, &window_y);
+ /* send moved event */
+ SDL_SendMouseMotion(Android_Window, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
+ }
+ }
+ SDL_SendTouchMotion(touchDeviceId, fingerId, x, y, p);
+ break;
+
+ case ACTION_UP:
+ /* Primary pointer up */
+ if (!separate_mouse_and_touch) {
+ /* send mouse up */
+ SDL_SendMouseButton(Android_Window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
+ }
+ pointerFingerID = (SDL_FingerID) 0;
+ case ACTION_POINTER_UP:
+ /* Non primary pointer up */
+ SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
+ break;
+
+ default:
+ break;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidtouch.h b/src/3rdparty/SDL2/src/video/android/SDL_androidtouch.h
new file mode 100644
index 0000000..e10be4f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidtouch.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_androidvideo.h"
+
+extern void Android_InitTouch(void);
+extern void Android_QuitTouch(void);
+extern void Android_OnTouch( int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidvideo.c b/src/3rdparty/SDL2/src/video/android/SDL_androidvideo.c
new file mode 100644
index 0000000..357f5cf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidvideo.c
@@ -0,0 +1,254 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+/* Android SDL video driver implementation
+*/
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_windowevents_c.h"
+
+#include "SDL_androidvideo.h"
+#include "SDL_androidgl.h"
+#include "SDL_androidclipboard.h"
+#include "SDL_androidevents.h"
+#include "SDL_androidkeyboard.h"
+#include "SDL_androidmouse.h"
+#include "SDL_androidtouch.h"
+#include "SDL_androidwindow.h"
+#include "SDL_androidvulkan.h"
+
+#define ANDROID_VID_DRIVER_NAME "Android"
+
+/* Initialization/Query functions */
+static int Android_VideoInit(_THIS);
+static void Android_VideoQuit(_THIS);
+int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi);
+
+#include "../SDL_egl_c.h"
+#define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define Android_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define Android_GLES_DeleteContext SDL_EGL_DeleteContext
+
+/* Android driver bootstrap functions */
+
+
+/* These are filled in with real values in Android_SetScreenResolution on init (before SDL_main()) */
+int Android_ScreenWidth = 0;
+int Android_ScreenHeight = 0;
+Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN;
+static int Android_ScreenRate = 0;
+
+SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL;
+
+/* Currently only one window */
+SDL_Window *Android_Window = NULL;
+
+static int
+Android_Available(void)
+{
+ return 1;
+}
+
+static void
+Android_SuspendScreenSaver(_THIS)
+{
+ Android_JNI_SuspendScreenSaver(_this->suspend_screensaver);
+}
+
+static void
+Android_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_free(device->driverdata);
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+Android_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ data = (SDL_VideoData*) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (!data) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+
+ device->driverdata = data;
+
+ /* Set the function pointers */
+ device->VideoInit = Android_VideoInit;
+ device->VideoQuit = Android_VideoQuit;
+ device->PumpEvents = Android_PumpEvents;
+
+ device->GetDisplayDPI = Android_GetDisplayDPI;
+
+ device->CreateSDLWindow = Android_CreateWindow;
+ device->SetWindowTitle = Android_SetWindowTitle;
+ device->SetWindowFullscreen = Android_SetWindowFullscreen;
+ device->DestroyWindow = Android_DestroyWindow;
+ device->GetWindowWMInfo = Android_GetWindowWMInfo;
+
+ device->free = Android_DeleteDevice;
+
+ /* GL pointers */
+ device->GL_LoadLibrary = Android_GLES_LoadLibrary;
+ device->GL_GetProcAddress = Android_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = Android_GLES_UnloadLibrary;
+ device->GL_CreateContext = Android_GLES_CreateContext;
+ device->GL_MakeCurrent = Android_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = Android_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = Android_GLES_GetSwapInterval;
+ device->GL_SwapWindow = Android_GLES_SwapWindow;
+ device->GL_DeleteContext = Android_GLES_DeleteContext;
+
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = Android_Vulkan_CreateSurface;
+#endif
+
+ /* Screensaver */
+ device->SuspendScreenSaver = Android_SuspendScreenSaver;
+
+ /* Text input */
+ device->StartTextInput = Android_StartTextInput;
+ device->StopTextInput = Android_StopTextInput;
+ device->SetTextInputRect = Android_SetTextInputRect;
+
+ /* Screen keyboard */
+ device->HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport;
+ device->IsScreenKeyboardShown = Android_IsScreenKeyboardShown;
+
+ /* Clipboard */
+ device->SetClipboardText = Android_SetClipboardText;
+ device->GetClipboardText = Android_GetClipboardText;
+ device->HasClipboardText = Android_HasClipboardText;
+
+ return device;
+}
+
+VideoBootStrap Android_bootstrap = {
+ ANDROID_VID_DRIVER_NAME, "SDL Android video driver",
+ Android_Available, Android_CreateDevice
+};
+
+
+int
+Android_VideoInit(_THIS)
+{
+ SDL_DisplayMode mode;
+
+ mode.format = Android_ScreenFormat;
+ mode.w = Android_ScreenWidth;
+ mode.h = Android_ScreenHeight;
+ mode.refresh_rate = Android_ScreenRate;
+ mode.driverdata = NULL;
+ if (SDL_AddBasicVideoDisplay(&mode) < 0) {
+ return -1;
+ }
+
+ SDL_AddDisplayMode(&_this->displays[0], &mode);
+
+ Android_InitKeyboard();
+
+ Android_InitTouch();
+
+ Android_InitMouse();
+
+ /* We're done! */
+ return 0;
+}
+
+void
+Android_VideoQuit(_THIS)
+{
+ Android_QuitTouch();
+}
+
+int
+Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi)
+{
+ return Android_JNI_GetDisplayDPI(ddpi, hdpi, vdpi);
+}
+
+void
+Android_SetScreenResolution(int width, int height, Uint32 format, float rate)
+{
+ SDL_VideoDevice* device;
+ SDL_VideoDisplay *display;
+ Android_ScreenWidth = width;
+ Android_ScreenHeight = height;
+ Android_ScreenFormat = format;
+ Android_ScreenRate = rate;
+
+ /*
+ Update the resolution of the desktop mode, so that the window
+ can be properly resized. The screen resolution change can for
+ example happen when the Activity enters or exits immersive mode,
+ which can happen after VideoInit().
+ */
+ device = SDL_GetVideoDevice();
+ if (device && device->num_displays > 0)
+ {
+ display = &device->displays[0];
+ display->desktop_mode.format = Android_ScreenFormat;
+ display->desktop_mode.w = Android_ScreenWidth;
+ display->desktop_mode.h = Android_ScreenHeight;
+ display->desktop_mode.refresh_rate = Android_ScreenRate;
+ }
+
+ if (Android_Window) {
+ /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event
+ * will fall back to the old mode */
+ display = SDL_GetDisplayForWindow(Android_Window);
+
+ display->display_modes[0].format = format;
+ display->display_modes[0].w = width;
+ display->display_modes[0].h = height;
+ display->display_modes[0].refresh_rate = rate;
+ display->current_mode = display->display_modes[0];
+
+ SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height);
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidvideo.h b/src/3rdparty/SDL2/src/video/android/SDL_androidvideo.h
new file mode 100644
index 0000000..a62c983
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidvideo.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_androidvideo_h_
+#define SDL_androidvideo_h_
+
+#include "SDL_mutex.h"
+#include "SDL_rect.h"
+#include "../SDL_sysvideo.h"
+
+/* Called by the JNI layer when the screen changes size or format */
+extern void Android_SetScreenResolution(int width, int height, Uint32 format, float rate);
+
+/* Private display data */
+
+typedef struct SDL_VideoData
+{
+ SDL_Rect textRect;
+} SDL_VideoData;
+
+extern int Android_ScreenWidth;
+extern int Android_ScreenHeight;
+extern Uint32 Android_ScreenFormat;
+extern SDL_sem *Android_PauseSem, *Android_ResumeSem;
+extern SDL_Window *Android_Window;
+
+
+#endif /* SDL_androidvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.c b/src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.c
new file mode 100644
index 0000000..e013034
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.c
@@ -0,0 +1,175 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.c.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID
+
+#include "SDL_androidvideo.h"
+#include "SDL_androidwindow.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_androidvulkan.h"
+#include "SDL_syswm.h"
+
+int Android_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ VkExtensionProperties *extensions = NULL;
+ Uint32 i, extensionCount = 0;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasAndroidSurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+ if(_this->vulkan_config.loader_handle)
+ return SDL_SetError("Vulkan already loaded");
+
+ /* Load the Vulkan loader library */
+ if(!path)
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ if(!path)
+ path = "libvulkan.so";
+ _this->vulkan_config.loader_handle = SDL_LoadObject(path);
+ if(!_this->vulkan_config.loader_handle)
+ return -1;
+ SDL_strlcpy(_this->vulkan_config.loader_path, path,
+ SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ if(!vkGetInstanceProcAddr)
+ goto fail;
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ goto fail;
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+ if(!extensions)
+ goto fail;
+ for(i = 0; i < extensionCount; i++)
+ {
+ if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasSurfaceExtension = SDL_TRUE;
+ else if(SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasAndroidSurfaceExtension = SDL_TRUE;
+ }
+ SDL_free(extensions);
+ if(!hasSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ }
+ else if(!hasAndroidSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "extension");
+ goto fail;
+ }
+ return 0;
+
+fail:
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void Android_Vulkan_UnloadLibrary(_THIS)
+{
+ if(_this->vulkan_config.loader_handle)
+ {
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ static const char *const extensionsForAndroid[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
+ };
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForAndroid),
+ extensionsForAndroid);
+}
+
+SDL_bool Android_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR =
+ (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr(
+ (VkInstance)instance,
+ "vkCreateAndroidSurfaceKHR");
+ VkAndroidSurfaceCreateInfoKHR createInfo;
+ VkResult result;
+
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ if(!vkCreateAndroidSurfaceKHR)
+ {
+ SDL_SetError(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ SDL_zero(createInfo);
+ createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.window = windowData->native_window;
+ result = vkCreateAndroidSurfaceKHR(instance, &createInfo,
+ NULL, surface);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError("vkCreateAndroidSurfaceKHR failed: %s",
+ SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.h b/src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.h
new file mode 100644
index 0000000..2634c61
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidvulkan.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.h.
+ */
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_androidvulkan_h_
+#define SDL_androidvulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID
+
+int Android_Vulkan_LoadLibrary(_THIS, const char *path);
+void Android_Vulkan_UnloadLibrary(_THIS);
+SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool Android_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+#endif
+
+#endif /* SDL_androidvulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidwindow.c b/src/3rdparty/SDL2/src/video/android/SDL_androidwindow.c
new file mode 100644
index 0000000..f1cbf58
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidwindow.c
@@ -0,0 +1,152 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_ANDROID
+
+#include "SDL_syswm.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_mouse_c.h"
+
+#include "SDL_androidvideo.h"
+#include "SDL_androidwindow.h"
+#include "SDL_hints.h"
+
+int
+Android_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data;
+
+ if (Android_Window) {
+ return SDL_SetError("Android only supports one window");
+ }
+
+ Android_PauseSem = SDL_CreateSemaphore(0);
+ Android_ResumeSem = SDL_CreateSemaphore(0);
+
+ /* Set orientation */
+ Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS));
+
+ /* Adjust the window data to match the screen */
+ window->x = 0;
+ window->y = 0;
+ window->w = Android_ScreenWidth;
+ window->h = Android_ScreenHeight;
+
+ window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */
+ window->flags &= ~SDL_WINDOW_HIDDEN;
+ window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */
+ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */
+
+ /* One window, it always has focus */
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+
+ data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+
+ data->native_window = Android_JNI_GetNativeWindow();
+
+ if (!data->native_window) {
+ SDL_free(data);
+ return SDL_SetError("Could not fetch native window");
+ }
+
+ /* Do not create EGLSurface for Vulkan window since it will then make the window
+ incompatible with vkCreateAndroidSurfaceKHR */
+ if ((window->flags & SDL_WINDOW_VULKAN) == 0) {
+ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window);
+
+ if (data->egl_surface == EGL_NO_SURFACE) {
+ ANativeWindow_release(data->native_window);
+ SDL_free(data);
+ return SDL_SetError("Could not create GLES window surface");
+ }
+ }
+
+ window->driverdata = data;
+ Android_Window = window;
+
+ return 0;
+}
+
+void
+Android_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ Android_JNI_SetActivityTitle(window->title);
+}
+
+void
+Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{
+ Android_JNI_SetWindowStyle(fullscreen);
+}
+
+void
+Android_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data;
+
+ if (window == Android_Window) {
+ Android_Window = NULL;
+ if (Android_PauseSem) SDL_DestroySemaphore(Android_PauseSem);
+ if (Android_ResumeSem) SDL_DestroySemaphore(Android_ResumeSem);
+ Android_PauseSem = NULL;
+ Android_ResumeSem = NULL;
+
+ if(window->driverdata) {
+ data = (SDL_WindowData *) window->driverdata;
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ }
+ if (data->native_window) {
+ ANativeWindow_release(data->native_window);
+ }
+ SDL_free(window->driverdata);
+ window->driverdata = NULL;
+ }
+ }
+}
+
+SDL_bool
+Android_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (info->version.major == SDL_MAJOR_VERSION &&
+ info->version.minor == SDL_MINOR_VERSION) {
+ info->subsystem = SDL_SYSWM_ANDROID;
+ info->info.android.window = data->native_window;
+ info->info.android.surface = data->egl_surface;
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_ANDROID */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/android/SDL_androidwindow.h b/src/3rdparty/SDL2/src/video/android/SDL_androidwindow.h
new file mode 100644
index 0000000..df99567
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/android/SDL_androidwindow.h
@@ -0,0 +1,45 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_androidwindow_h_
+#define SDL_androidwindow_h_
+
+#include "../../core/android/SDL_android.h"
+#include "../SDL_egl_c.h"
+
+extern int Android_CreateWindow(_THIS, SDL_Window * window);
+extern void Android_SetWindowTitle(_THIS, SDL_Window * window);
+extern void Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+extern void Android_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info);
+
+typedef struct
+{
+ EGLSurface egl_surface;
+ EGLContext egl_context; /* We use this to preserve the context when losing focus */
+ ANativeWindow* native_window;
+
+} SDL_WindowData;
+
+#endif /* SDL_androidwindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.h
new file mode 100644
index 0000000..54e4c88
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoaclipboard_h_
+#define SDL_cocoaclipboard_h_
+
+/* Forward declaration */
+struct SDL_VideoData;
+
+extern int Cocoa_SetClipboardText(_THIS, const char *text);
+extern char *Cocoa_GetClipboardText(_THIS);
+extern SDL_bool Cocoa_HasClipboardText(_THIS);
+extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data);
+
+#endif /* SDL_cocoaclipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.m
new file mode 100644
index 0000000..9c96634
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaclipboard.m
@@ -0,0 +1,103 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_cocoavideo.h"
+#include "../../events/SDL_clipboardevents_c.h"
+
+int
+Cocoa_SetClipboardText(_THIS, const char *text)
+{ @autoreleasepool
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ NSPasteboard *pasteboard;
+ NSString *format = NSPasteboardTypeString;
+
+ pasteboard = [NSPasteboard generalPasteboard];
+ data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
+ [pasteboard setString:[NSString stringWithUTF8String:text] forType:format];
+
+ return 0;
+}}
+
+char *
+Cocoa_GetClipboardText(_THIS)
+{ @autoreleasepool
+{
+ NSPasteboard *pasteboard;
+ NSString *format = NSPasteboardTypeString;
+ NSString *available;
+ char *text;
+
+ pasteboard = [NSPasteboard generalPasteboard];
+ available = [pasteboard availableTypeFromArray:[NSArray arrayWithObject:format]];
+ if ([available isEqualToString:format]) {
+ NSString* string;
+ const char *utf8;
+
+ string = [pasteboard stringForType:format];
+ if (string == nil) {
+ utf8 = "";
+ } else {
+ utf8 = [string UTF8String];
+ }
+ text = SDL_strdup(utf8);
+ } else {
+ text = SDL_strdup("");
+ }
+
+ return text;
+}}
+
+SDL_bool
+Cocoa_HasClipboardText(_THIS)
+{
+ SDL_bool result = SDL_FALSE;
+ char *text = Cocoa_GetClipboardText(_this);
+ if (text) {
+ result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
+ SDL_free(text);
+ }
+ return result;
+}
+
+void
+Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
+{ @autoreleasepool
+{
+ NSPasteboard *pasteboard;
+ NSInteger count;
+
+ pasteboard = [NSPasteboard generalPasteboard];
+ count = [pasteboard changeCount];
+ if (count != data->clipboard_count) {
+ if (data->clipboard_count) {
+ SDL_SendClipboardUpdate();
+ }
+ data->clipboard_count = count;
+ }
+}}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.h
new file mode 100644
index 0000000..986168e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoaevents_h_
+#define SDL_cocoaevents_h_
+
+extern void Cocoa_RegisterApp(void);
+extern void Cocoa_PumpEvents(_THIS);
+extern void Cocoa_SuspendScreenSaver(_THIS);
+
+#endif /* SDL_cocoaevents_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.m
new file mode 100644
index 0000000..38f4ba6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.m
@@ -0,0 +1,483 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+#include "SDL_timer.h"
+
+#include "SDL_cocoavideo.h"
+#include "../../events/SDL_events_c.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+
+/* This define was added in the 10.9 SDK. */
+#ifndef kIOPMAssertPreventUserIdleDisplaySleep
+#define kIOPMAssertPreventUserIdleDisplaySleep kIOPMAssertionTypePreventUserIdleDisplaySleep
+#endif
+
+@interface SDLApplication : NSApplication
+
+- (void)terminate:(id)sender;
+- (void)sendEvent:(NSEvent *)theEvent;
+
++ (void)registerUserDefaults;
+
+@end
+
+@implementation SDLApplication
+
+// Override terminate to handle Quit and System Shutdown smoothly.
+- (void)terminate:(id)sender
+{
+ SDL_SendQuit();
+}
+
+static SDL_bool s_bShouldHandleEventsInSDLApplication = SDL_FALSE;
+
+static void Cocoa_DispatchEvent(NSEvent *theEvent)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ switch ([theEvent type]) {
+ case NSEventTypeLeftMouseDown:
+ case NSEventTypeOtherMouseDown:
+ case NSEventTypeRightMouseDown:
+ case NSEventTypeLeftMouseUp:
+ case NSEventTypeOtherMouseUp:
+ case NSEventTypeRightMouseUp:
+ case NSEventTypeLeftMouseDragged:
+ case NSEventTypeRightMouseDragged:
+ case NSEventTypeOtherMouseDragged: /* usually middle mouse dragged */
+ case NSEventTypeMouseMoved:
+ case NSEventTypeScrollWheel:
+ Cocoa_HandleMouseEvent(_this, theEvent);
+ break;
+ case NSEventTypeKeyDown:
+ case NSEventTypeKeyUp:
+ case NSEventTypeFlagsChanged:
+ Cocoa_HandleKeyEvent(_this, theEvent);
+ break;
+ default:
+ break;
+ }
+}
+
+// Dispatch events here so that we can handle events caught by
+// nextEventMatchingMask in SDL, as well as events caught by other
+// processes (such as CEF) that are passed down to NSApp.
+- (void)sendEvent:(NSEvent *)theEvent
+{
+ if (s_bShouldHandleEventsInSDLApplication) {
+ Cocoa_DispatchEvent(theEvent);
+ }
+
+ [super sendEvent:theEvent];
+}
+
++ (void)registerUserDefaults
+{
+ NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported",
+ [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled",
+ [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState",
+ nil];
+ [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
+ [appDefaults release];
+}
+
+@end // SDLApplication
+
+/* setAppleMenu disappeared from the headers in 10.4 */
+@interface NSApplication(NSAppleMenu)
+- (void)setAppleMenu:(NSMenu *)menu;
+@end
+
+@interface SDLAppDelegate : NSObject <NSApplicationDelegate> {
+@public
+ BOOL seenFirstActivate;
+}
+
+- (id)init;
+@end
+
+@implementation SDLAppDelegate : NSObject
+- (id)init
+{
+ self = [super init];
+ if (self) {
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+
+ seenFirstActivate = NO;
+
+ [center addObserver:self
+ selector:@selector(windowWillClose:)
+ name:NSWindowWillCloseNotification
+ object:nil];
+
+ [center addObserver:self
+ selector:@selector(focusSomeWindow:)
+ name:NSApplicationDidBecomeActiveNotification
+ object:nil];
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+
+ [center removeObserver:self name:NSWindowWillCloseNotification object:nil];
+ [center removeObserver:self name:NSApplicationDidBecomeActiveNotification object:nil];
+
+ [super dealloc];
+}
+
+- (void)windowWillClose:(NSNotification *)notification;
+{
+ NSWindow *win = (NSWindow*)[notification object];
+
+ if (![win isKeyWindow]) {
+ return;
+ }
+
+ /* HACK: Make the next window in the z-order key when the key window is
+ * closed. The custom event loop and/or windowing code we have seems to
+ * prevent the normal behavior: https://bugzilla.libsdl.org/show_bug.cgi?id=1825
+ */
+
+ /* +[NSApp orderedWindows] never includes the 'About' window, but we still
+ * want to try its list first since the behavior in other apps is to only
+ * make the 'About' window key if no other windows are on-screen.
+ */
+ for (NSWindow *window in [NSApp orderedWindows]) {
+ if (window != win && [window canBecomeKeyWindow]) {
+ if (![window isOnActiveSpace]) {
+ continue;
+ }
+ [window makeKeyAndOrderFront:self];
+ return;
+ }
+ }
+
+ /* If a window wasn't found above, iterate through all visible windows in
+ * the active Space in z-order (including the 'About' window, if it's shown)
+ * and make the first one key.
+ */
+ for (NSNumber *num in [NSWindow windowNumbersWithOptions:0]) {
+ NSWindow *window = [NSApp windowWithWindowNumber:[num integerValue]];
+ if (window && window != win && [window canBecomeKeyWindow]) {
+ [window makeKeyAndOrderFront:self];
+ return;
+ }
+ }
+}
+
+- (void)focusSomeWindow:(NSNotification *)aNotification
+{
+ /* HACK: Ignore the first call. The application gets a
+ * applicationDidBecomeActive: a little bit after the first window is
+ * created, and if we don't ignore it, a window that has been created with
+ * SDL_WINDOW_MINIMIZED will ~immediately be restored.
+ */
+ if (!seenFirstActivate) {
+ seenFirstActivate = YES;
+ return;
+ }
+
+ SDL_VideoDevice *device = SDL_GetVideoDevice();
+ if (device && device->windows) {
+ SDL_Window *window = device->windows;
+ int i;
+ for (i = 0; i < device->num_displays; ++i) {
+ SDL_Window *fullscreen_window = device->displays[i].fullscreen_window;
+ if (fullscreen_window) {
+ if (fullscreen_window->flags & SDL_WINDOW_MINIMIZED) {
+ SDL_RestoreWindow(fullscreen_window);
+ }
+ return;
+ }
+ }
+
+ if (window->flags & SDL_WINDOW_MINIMIZED) {
+ SDL_RestoreWindow(window);
+ } else {
+ SDL_RaiseWindow(window);
+ }
+ }
+}
+
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+ return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL);
+}
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notification
+{
+ /* The menu bar of SDL apps which don't have the typical .app bundle
+ * structure fails to work the first time a window is created (until it's
+ * de-focused and re-focused), if this call is in Cocoa_RegisterApp instead
+ * of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051
+ */
+ if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
+ [NSApp activateIgnoringOtherApps:YES];
+ }
+
+ /* If we call this before NSApp activation, macOS might print a complaint
+ * about ApplePersistenceIgnoreState. */
+ [SDLApplication registerUserDefaults];
+}
+@end
+
+static SDLAppDelegate *appDelegate = nil;
+
+static NSString *
+GetApplicationName(void)
+{
+ NSString *appName;
+
+ /* Determine the application name */
+ appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
+ if (!appName) {
+ appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
+ }
+
+ if (![appName length]) {
+ appName = [[NSProcessInfo processInfo] processName];
+ }
+
+ return appName;
+}
+
+static void
+CreateApplicationMenus(void)
+{
+ NSString *appName;
+ NSString *title;
+ NSMenu *appleMenu;
+ NSMenu *serviceMenu;
+ NSMenu *windowMenu;
+ NSMenu *viewMenu;
+ NSMenuItem *menuItem;
+ NSMenu *mainMenu;
+
+ if (NSApp == nil) {
+ return;
+ }
+
+ mainMenu = [[NSMenu alloc] init];
+
+ /* Create the main menu bar */
+ [NSApp setMainMenu:mainMenu];
+
+ [mainMenu release]; /* we're done with it, let NSApp own it. */
+ mainMenu = nil;
+
+ /* Create the application menu */
+ appName = GetApplicationName();
+ appleMenu = [[NSMenu alloc] initWithTitle:@""];
+
+ /* Add menu items */
+ title = [@"About " stringByAppendingString:appName];
+ [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ [appleMenu addItemWithTitle:@"Preferences…" action:nil keyEquivalent:@","];
+
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ serviceMenu = [[NSMenu alloc] initWithTitle:@""];
+ menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:serviceMenu];
+
+ [NSApp setServicesMenu:serviceMenu];
+ [serviceMenu release];
+
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ title = [@"Hide " stringByAppendingString:appName];
+ [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
+
+ menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
+ [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)];
+
+ [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
+
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ title = [@"Quit " stringByAppendingString:appName];
+ [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
+
+ /* Put menu into the menubar */
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:appleMenu];
+ [[NSApp mainMenu] addItem:menuItem];
+ [menuItem release];
+
+ /* Tell the application object that this is now the application menu */
+ [NSApp setAppleMenu:appleMenu];
+ [appleMenu release];
+
+
+ /* Create the window menu */
+ windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
+
+ /* Add menu items */
+ [windowMenu addItemWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
+
+ [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""];
+
+ /* Put menu into the menubar */
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:windowMenu];
+ [[NSApp mainMenu] addItem:menuItem];
+ [menuItem release];
+
+ /* Tell the application object that this is now the window menu */
+ [NSApp setWindowsMenu:windowMenu];
+ [windowMenu release];
+
+
+ /* Add the fullscreen view toggle menu option, if supported */
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
+ /* Create the view menu */
+ viewMenu = [[NSMenu alloc] initWithTitle:@"View"];
+
+ /* Add menu items */
+ menuItem = [viewMenu addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"];
+ [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
+
+ /* Put menu into the menubar */
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:viewMenu];
+ [[NSApp mainMenu] addItem:menuItem];
+ [menuItem release];
+
+ [viewMenu release];
+ }
+}
+
+void
+Cocoa_RegisterApp(void)
+{ @autoreleasepool
+{
+ /* This can get called more than once! Be careful what you initialize! */
+
+ if (NSApp == nil) {
+ [SDLApplication sharedApplication];
+ SDL_assert(NSApp != nil);
+
+ s_bShouldHandleEventsInSDLApplication = SDL_TRUE;
+
+ if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+ }
+
+ if ([NSApp mainMenu] == nil) {
+ CreateApplicationMenus();
+ }
+ [NSApp finishLaunching];
+ if ([NSApp delegate]) {
+ /* The SDL app delegate calls this in didFinishLaunching if it's
+ * attached to the NSApp, otherwise we need to call it manually.
+ */
+ [SDLApplication registerUserDefaults];
+ }
+ }
+ if (NSApp && !appDelegate) {
+ appDelegate = [[SDLAppDelegate alloc] init];
+
+ /* If someone else has an app delegate, it means we can't turn a
+ * termination into SDL_Quit, and we can't handle application:openFile:
+ */
+ if (![NSApp delegate]) {
+ [(NSApplication *)NSApp setDelegate:appDelegate];
+ } else {
+ appDelegate->seenFirstActivate = YES;
+ }
+ }
+}}
+
+void
+Cocoa_PumpEvents(_THIS)
+{ @autoreleasepool
+{
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+ /* Update activity every 30 seconds to prevent screensaver */
+ SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
+ if (_this->suspend_screensaver && !data->screensaver_use_iopm) {
+ Uint32 now = SDL_GetTicks();
+ if (!data->screensaver_activity ||
+ SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) {
+ UpdateSystemActivity(UsrActivity);
+ data->screensaver_activity = now;
+ }
+ }
+#endif
+
+ for ( ; ; ) {
+ NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
+ if ( event == nil ) {
+ break;
+ }
+
+ if (!s_bShouldHandleEventsInSDLApplication) {
+ Cocoa_DispatchEvent(event);
+ }
+
+ // Pass events down to SDLApplication to be handled in sendEvent:
+ [NSApp sendEvent:event];
+ }
+}}
+
+void
+Cocoa_SuspendScreenSaver(_THIS)
+{ @autoreleasepool
+{
+ SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
+
+ if (!data->screensaver_use_iopm) {
+ return;
+ }
+
+ if (data->screensaver_assertion) {
+ IOPMAssertionRelease(data->screensaver_assertion);
+ data->screensaver_assertion = 0;
+ }
+
+ if (_this->suspend_screensaver) {
+ /* FIXME: this should ideally describe the real reason why the game
+ * called SDL_DisableScreenSaver. Note that the name is only meant to be
+ * seen by OS X power users. there's an additional optional human-readable
+ * (localized) reason parameter which we don't set.
+ */
+ NSString *name = [GetApplicationName() stringByAppendingString:@" using SDL_DisableScreenSaver"];
+ IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep,
+ (CFStringRef) name,
+ NULL, NULL, NULL, 0, NULL,
+ &data->screensaver_assertion);
+ }
+}}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.h
new file mode 100644
index 0000000..7d89523
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoakeyboard_h_
+#define SDL_cocoakeyboard_h_
+
+extern void Cocoa_InitKeyboard(_THIS);
+extern void Cocoa_HandleKeyEvent(_THIS, NSEvent * event);
+extern void Cocoa_QuitKeyboard(_THIS);
+
+extern void Cocoa_StartTextInput(_THIS);
+extern void Cocoa_StopTextInput(_THIS);
+extern void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect);
+
+#endif /* SDL_cocoakeyboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.m
new file mode 100644
index 0000000..8436047
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoakeyboard.m
@@ -0,0 +1,720 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_cocoavideo.h"
+
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/scancodes_darwin.h"
+
+#include <Carbon/Carbon.h>
+#include <IOKit/hid/IOHIDLib.h>
+
+/*#define DEBUG_IME NSLog */
+#define DEBUG_IME(...)
+
+@interface SDLTranslatorResponder : NSView <NSTextInputClient> {
+ NSString *_markedText;
+ NSRange _markedRange;
+ NSRange _selectedRange;
+ SDL_Rect _inputRect;
+}
+- (void)doCommandBySelector:(SEL)myselector;
+- (void)setInputRect:(SDL_Rect *)rect;
+@end
+
+@implementation SDLTranslatorResponder
+
+- (void)setInputRect:(SDL_Rect *)rect
+{
+ _inputRect = *rect;
+}
+
+- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
+{
+ /* TODO: Make use of replacementRange? */
+
+ const char *str;
+
+ DEBUG_IME(@"insertText: %@", aString);
+
+ /* Could be NSString or NSAttributedString, so we have
+ * to test and convert it before return as SDL event */
+ if ([aString isKindOfClass: [NSAttributedString class]]) {
+ str = [[aString string] UTF8String];
+ } else {
+ str = [aString UTF8String];
+ }
+
+ SDL_SendKeyboardText(str);
+}
+
+- (void)doCommandBySelector:(SEL)myselector
+{
+ /* No need to do anything since we are not using Cocoa
+ selectors to handle special keys, instead we use SDL
+ key events to do the same job.
+ */
+}
+
+- (BOOL)hasMarkedText
+{
+ return _markedText != nil;
+}
+
+- (NSRange)markedRange
+{
+ return _markedRange;
+}
+
+- (NSRange)selectedRange
+{
+ return _selectedRange;
+}
+
+- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
+{
+ if ([aString isKindOfClass:[NSAttributedString class]]) {
+ aString = [aString string];
+ }
+
+ if ([aString length] == 0) {
+ [self unmarkText];
+ return;
+ }
+
+ if (_markedText != aString) {
+ [_markedText release];
+ _markedText = [aString retain];
+ }
+
+ _selectedRange = selectedRange;
+ _markedRange = NSMakeRange(0, [aString length]);
+
+ SDL_SendEditingText([aString UTF8String],
+ (int) selectedRange.location, (int) selectedRange.length);
+
+ DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
+ selRange.location, selRange.length);
+}
+
+- (void)unmarkText
+{
+ [_markedText release];
+ _markedText = nil;
+
+ SDL_SendEditingText("", 0, 0);
+}
+
+- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
+{
+ NSWindow *window = [self window];
+ NSRect contentRect = [window contentRectForFrameRect:[window frame]];
+ float windowHeight = contentRect.size.height;
+ NSRect rect = NSMakeRect(_inputRect.x, windowHeight - _inputRect.y - _inputRect.h,
+ _inputRect.w, _inputRect.h);
+
+ if (actualRange) {
+ *actualRange = aRange;
+ }
+
+ DEBUG_IME(@"firstRectForCharacterRange: (%d, %d): windowHeight = %g, rect = %@",
+ aRange.location, aRange.length, windowHeight,
+ NSStringFromRect(rect));
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+ if (![window respondsToSelector:@selector(convertRectToScreen:)]) {
+ rect.origin = [window convertBaseToScreen:rect.origin];
+ } else
+#endif
+ {
+ rect = [window convertRectToScreen:rect];
+ }
+
+ return rect;
+}
+
+- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
+{
+ DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", aRange.location, aRange.length);
+ return nil;
+}
+
+- (NSInteger)conversationIdentifier
+{
+ return (NSInteger) self;
+}
+
+/* This method returns the index for character that is
+ * nearest to thePoint. thPoint is in screen coordinate system.
+ */
+- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint
+{
+ DEBUG_IME(@"characterIndexForPoint: (%g, %g)", thePoint.x, thePoint.y);
+ return 0;
+}
+
+/* This method is the key to attribute extension.
+ * We could add new attributes through this method.
+ * NSInputServer examines the return value of this
+ * method & constructs appropriate attributed string.
+ */
+- (NSArray *)validAttributesForMarkedText
+{
+ return [NSArray array];
+}
+
+@end
+
+/*------------------------------------------------------------------------------
+Set up a HID callback to properly detect Caps Lock up/down events.
+Derived from:
+http://stackoverflow.com/questions/7190852/using-iohidmanager-to-get-modifier-key-events
+*/
+
+static IOHIDManagerRef s_hidManager = NULL;
+
+static void
+HIDCallback(void *context, IOReturn result, void *sender, IOHIDValueRef value)
+{
+ if (context != s_hidManager) {
+ /* An old callback, ignore it (related to bug 2157 below) */
+ return;
+ }
+
+ IOHIDElementRef elem = IOHIDValueGetElement(value);
+ if (IOHIDElementGetUsagePage(elem) != kHIDPage_KeyboardOrKeypad
+ || IOHIDElementGetUsage(elem) != kHIDUsage_KeyboardCapsLock) {
+ return;
+ }
+ CFIndex pressed = IOHIDValueGetIntegerValue(value);
+ SDL_SendKeyboardKey(pressed ? SDL_PRESSED : SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
+}
+
+static CFDictionaryRef
+CreateHIDDeviceMatchingDictionary(UInt32 usagePage, UInt32 usage)
+{
+ CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault,
+ 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ if (dict) {
+ CFNumberRef number = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usagePage);
+ if (number) {
+ CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), number);
+ CFRelease(number);
+ number = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
+ if (number) {
+ CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), number);
+ CFRelease(number);
+ return dict;
+ }
+ }
+ CFRelease(dict);
+ }
+ return NULL;
+}
+
+static void
+QuitHIDCallback()
+{
+ if (!s_hidManager) {
+ return;
+ }
+
+#if 0 /* Releasing here causes a crash on Mac OS X 10.10 and earlier,
+ * so just leak it for now. See bug 2157 for details.
+ */
+ IOHIDManagerUnscheduleFromRunLoop(s_hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ IOHIDManagerRegisterInputValueCallback(s_hidManager, NULL, NULL);
+ IOHIDManagerClose(s_hidManager, 0);
+
+ CFRelease(s_hidManager);
+#endif
+ s_hidManager = NULL;
+}
+
+static void
+InitHIDCallback()
+{
+ s_hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
+ if (!s_hidManager) {
+ return;
+ }
+ CFDictionaryRef keyboard = NULL, keypad = NULL;
+ CFArrayRef matches = NULL;
+ keyboard = CreateHIDDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard);
+ if (!keyboard) {
+ goto fail;
+ }
+ keypad = CreateHIDDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Keypad);
+ if (!keypad) {
+ goto fail;
+ }
+ CFDictionaryRef matchesList[] = { keyboard, keypad };
+ matches = CFArrayCreate(kCFAllocatorDefault, (const void **)matchesList, 2, NULL);
+ if (!matches) {
+ goto fail;
+ }
+ IOHIDManagerSetDeviceMatchingMultiple(s_hidManager, matches);
+ IOHIDManagerRegisterInputValueCallback(s_hidManager, HIDCallback, s_hidManager);
+ IOHIDManagerScheduleWithRunLoop(s_hidManager, CFRunLoopGetMain(), kCFRunLoopDefaultMode);
+ if (IOHIDManagerOpen(s_hidManager, kIOHIDOptionsTypeNone) == kIOReturnSuccess) {
+ goto cleanup;
+ }
+
+fail:
+ QuitHIDCallback();
+
+cleanup:
+ if (matches) {
+ CFRelease(matches);
+ }
+ if (keypad) {
+ CFRelease(keypad);
+ }
+ if (keyboard) {
+ CFRelease(keyboard);
+ }
+}
+
+/* This is a helper function for HandleModifierSide. This
+ * function reverts back to behavior before the distinction between
+ * sides was made.
+ */
+static void
+HandleNonDeviceModifier(unsigned int device_independent_mask,
+ unsigned int oldMods,
+ unsigned int newMods,
+ SDL_Scancode scancode)
+{
+ unsigned int oldMask, newMask;
+
+ /* Isolate just the bits we care about in the depedent bits so we can
+ * figure out what changed
+ */
+ oldMask = oldMods & device_independent_mask;
+ newMask = newMods & device_independent_mask;
+
+ if (oldMask && oldMask != newMask) {
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ } else if (newMask && oldMask != newMask) {
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+ }
+}
+
+/* This is a helper function for HandleModifierSide.
+ * This function sets the actual SDL_PrivateKeyboard event.
+ */
+static void
+HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
+ SDL_Scancode scancode,
+ unsigned int sided_device_dependent_mask)
+{
+ unsigned int old_dep_mask, new_dep_mask;
+
+ /* Isolate just the bits we care about in the depedent bits so we can
+ * figure out what changed
+ */
+ old_dep_mask = oldMods & sided_device_dependent_mask;
+ new_dep_mask = newMods & sided_device_dependent_mask;
+
+ /* We now know that this side bit flipped. But we don't know if
+ * it went pressed to released or released to pressed, so we must
+ * find out which it is.
+ */
+ if (new_dep_mask && old_dep_mask != new_dep_mask) {
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+ } else {
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+}
+
+/* This is a helper function for DoSidedModifiers.
+ * This function will figure out if the modifier key is the left or right side,
+ * e.g. left-shift vs right-shift.
+ */
+static void
+HandleModifierSide(int device_independent_mask,
+ unsigned int oldMods, unsigned int newMods,
+ SDL_Scancode left_scancode,
+ SDL_Scancode right_scancode,
+ unsigned int left_device_dependent_mask,
+ unsigned int right_device_dependent_mask)
+{
+ unsigned int device_dependent_mask = (left_device_dependent_mask |
+ right_device_dependent_mask);
+ unsigned int diff_mod;
+
+ /* On the basis that the device independent mask is set, but there are
+ * no device dependent flags set, we'll assume that we can't detect this
+ * keyboard and revert to the unsided behavior.
+ */
+ if ((device_dependent_mask & newMods) == 0) {
+ /* Revert to the old behavior */
+ HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode);
+ return;
+ }
+
+ /* XOR the previous state against the new state to see if there's a change */
+ diff_mod = (device_dependent_mask & oldMods) ^
+ (device_dependent_mask & newMods);
+ if (diff_mod) {
+ /* A change in state was found. Isolate the left and right bits
+ * to handle them separately just in case the values can simulataneously
+ * change or if the bits don't both exist.
+ */
+ if (left_device_dependent_mask & diff_mod) {
+ HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask);
+ }
+ if (right_device_dependent_mask & diff_mod) {
+ HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask);
+ }
+ }
+}
+
+/* This is a helper function for DoSidedModifiers.
+ * This function will release a key press in the case that
+ * it is clear that the modifier has been released (i.e. one side
+ * can't still be down).
+ */
+static void
+ReleaseModifierSide(unsigned int device_independent_mask,
+ unsigned int oldMods, unsigned int newMods,
+ SDL_Scancode left_scancode,
+ SDL_Scancode right_scancode,
+ unsigned int left_device_dependent_mask,
+ unsigned int right_device_dependent_mask)
+{
+ unsigned int device_dependent_mask = (left_device_dependent_mask |
+ right_device_dependent_mask);
+
+ /* On the basis that the device independent mask is set, but there are
+ * no device dependent flags set, we'll assume that we can't detect this
+ * keyboard and revert to the unsided behavior.
+ */
+ if ((device_dependent_mask & oldMods) == 0) {
+ /* In this case, we can't detect the keyboard, so use the left side
+ * to represent both, and release it.
+ */
+ SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
+ return;
+ }
+
+ /*
+ * This could have been done in an if-else case because at this point,
+ * we know that all keys have been released when calling this function.
+ * But I'm being paranoid so I want to handle each separately,
+ * so I hope this doesn't cause other problems.
+ */
+ if ( left_device_dependent_mask & oldMods ) {
+ SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
+ }
+ if ( right_device_dependent_mask & oldMods ) {
+ SDL_SendKeyboardKey(SDL_RELEASED, right_scancode);
+ }
+}
+
+/* This function will handle the modifier keys and also determine the
+ * correct side of the key.
+ */
+static void
+DoSidedModifiers(unsigned short scancode,
+ unsigned int oldMods, unsigned int newMods)
+{
+ /* Set up arrays for the key syms for the left and right side. */
+ const SDL_Scancode left_mapping[] = {
+ SDL_SCANCODE_LSHIFT,
+ SDL_SCANCODE_LCTRL,
+ SDL_SCANCODE_LALT,
+ SDL_SCANCODE_LGUI
+ };
+ const SDL_Scancode right_mapping[] = {
+ SDL_SCANCODE_RSHIFT,
+ SDL_SCANCODE_RCTRL,
+ SDL_SCANCODE_RALT,
+ SDL_SCANCODE_RGUI
+ };
+ /* Set up arrays for the device dependent masks with indices that
+ * correspond to the _mapping arrays
+ */
+ const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK };
+ const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK };
+
+ unsigned int i, bit;
+
+ /* Iterate through the bits, testing each against the old modifiers */
+ for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) {
+ unsigned int oldMask, newMask;
+
+ oldMask = oldMods & bit;
+ newMask = newMods & bit;
+
+ /* If the bit is set, we must always examine it because the left
+ * and right side keys may alternate or both may be pressed.
+ */
+ if (newMask) {
+ HandleModifierSide(bit, oldMods, newMods,
+ left_mapping[i], right_mapping[i],
+ left_device_mapping[i], right_device_mapping[i]);
+ }
+ /* If the state changed from pressed to unpressed, we must examine
+ * the device dependent bits to release the correct keys.
+ */
+ else if (oldMask && oldMask != newMask) {
+ ReleaseModifierSide(bit, oldMods, newMods,
+ left_mapping[i], right_mapping[i],
+ left_device_mapping[i], right_device_mapping[i]);
+ }
+ }
+}
+
+static void
+HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ if (modifierFlags == data->modifierFlags) {
+ return;
+ }
+
+ DoSidedModifiers(scancode, data->modifierFlags, modifierFlags);
+ data->modifierFlags = modifierFlags;
+}
+
+static void
+UpdateKeymap(SDL_VideoData *data, SDL_bool send_event)
+{
+ TISInputSourceRef key_layout;
+ const void *chr_data;
+ int i;
+ SDL_Scancode scancode;
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+
+ /* See if the keymap needs to be updated */
+ key_layout = TISCopyCurrentKeyboardLayoutInputSource();
+ if (key_layout == data->key_layout) {
+ return;
+ }
+ data->key_layout = key_layout;
+
+ SDL_GetDefaultKeymap(keymap);
+
+ /* Try Unicode data first */
+ CFDataRef uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData);
+ if (uchrDataRef) {
+ chr_data = CFDataGetBytePtr(uchrDataRef);
+ } else {
+ goto cleanup;
+ }
+
+ if (chr_data) {
+ UInt32 keyboard_type = LMGetKbdType();
+ OSStatus err;
+
+ for (i = 0; i < SDL_arraysize(darwin_scancode_table); i++) {
+ UniChar s[8];
+ UniCharCount len;
+ UInt32 dead_key_state;
+
+ /* Make sure this scancode is a valid character scancode */
+ scancode = darwin_scancode_table[i];
+ if (scancode == SDL_SCANCODE_UNKNOWN ||
+ (keymap[scancode] & SDLK_SCANCODE_MASK)) {
+ continue;
+ }
+
+ dead_key_state = 0;
+ err = UCKeyTranslate ((UCKeyboardLayout *) chr_data,
+ i, kUCKeyActionDown,
+ 0, keyboard_type,
+ kUCKeyTranslateNoDeadKeysMask,
+ &dead_key_state, 8, &len, s);
+ if (err != noErr) {
+ continue;
+ }
+
+ if (len > 0 && s[0] != 0x10) {
+ keymap[scancode] = s[0];
+ }
+ }
+ SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+ if (send_event) {
+ SDL_SendKeymapChangedEvent();
+ }
+ return;
+ }
+
+cleanup:
+ CFRelease(key_layout);
+}
+
+void
+Cocoa_InitKeyboard(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ UpdateKeymap(data, SDL_FALSE);
+
+ /* Set our own names for the platform-dependent but layout-independent keys */
+ /* This key is NumLock on the MacBook keyboard. :) */
+ /*SDL_SetScancodeName(SDL_SCANCODE_NUMLOCKCLEAR, "Clear");*/
+ SDL_SetScancodeName(SDL_SCANCODE_LALT, "Left Option");
+ SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command");
+ SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option");
+ SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");
+
+ data->modifierFlags = [NSEvent modifierFlags];
+ SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0);
+
+ InitHIDCallback();
+}
+
+void
+Cocoa_StartTextInput(_THIS)
+{ @autoreleasepool
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ SDL_Window *window = SDL_GetKeyboardFocus();
+ NSWindow *nswindow = nil;
+ if (window) {
+ nswindow = ((SDL_WindowData*)window->driverdata)->nswindow;
+ }
+
+ NSView *parentView = [nswindow contentView];
+
+ /* We only keep one field editor per process, since only the front most
+ * window can receive text input events, so it make no sense to keep more
+ * than one copy. When we switched to another window and requesting for
+ * text input, simply remove the field editor from its superview then add
+ * it to the front most window's content view */
+ if (!data->fieldEdit) {
+ data->fieldEdit =
+ [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)];
+ }
+
+ if (![[data->fieldEdit superview] isEqual:parentView]) {
+ /* DEBUG_IME(@"add fieldEdit to window contentView"); */
+ [data->fieldEdit removeFromSuperview];
+ [parentView addSubview: data->fieldEdit];
+ [nswindow makeFirstResponder: data->fieldEdit];
+ }
+}}
+
+void
+Cocoa_StopTextInput(_THIS)
+{ @autoreleasepool
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ if (data && data->fieldEdit) {
+ [data->fieldEdit removeFromSuperview];
+ [data->fieldEdit release];
+ data->fieldEdit = nil;
+ }
+}}
+
+void
+Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return;
+ }
+
+ [data->fieldEdit setInputRect:rect];
+}
+
+void
+Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
+{
+ SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL;
+ if (!data) {
+ return; /* can happen when returning from fullscreen Space on shutdown */
+ }
+
+ unsigned short scancode = [event keyCode];
+ SDL_Scancode code;
+#if 0
+ const char *text;
+#endif
+
+ if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) {
+ /* see comments in SDL_cocoakeys.h */
+ scancode = 60 - scancode;
+ }
+
+ if (scancode < SDL_arraysize(darwin_scancode_table)) {
+ code = darwin_scancode_table[scancode];
+ } else {
+ /* Hmm, does this ever happen? If so, need to extend the keymap... */
+ code = SDL_SCANCODE_UNKNOWN;
+ }
+
+ switch ([event type]) {
+ case NSEventTypeKeyDown:
+ if (![event isARepeat]) {
+ /* See if we need to rebuild the keyboard layout */
+ UpdateKeymap(data, SDL_TRUE);
+ }
+
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+#if 1
+ if (code == SDL_SCANCODE_UNKNOWN) {
+ fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list <https://discourse.libsdl.org/> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode);
+ }
+#endif
+ if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+ /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */
+ [data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
+#if 0
+ text = [[event characters] UTF8String];
+ if(text && *text) {
+ SDL_SendKeyboardText(text);
+ [data->fieldEdit setString:@""];
+ }
+#endif
+ }
+ break;
+ case NSEventTypeKeyUp:
+ SDL_SendKeyboardKey(SDL_RELEASED, code);
+ break;
+ case NSEventTypeFlagsChanged:
+ /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */
+ HandleModifiers(_this, scancode, [event modifierFlags]);
+ break;
+ default: /* just to avoid compiler warnings */
+ break;
+ }
+}
+
+void
+Cocoa_QuitKeyboard(_THIS)
+{
+ QuitHIDCallback();
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.h
new file mode 100644
index 0000000..74a815a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+extern int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.m
new file mode 100644
index 0000000..a98237f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamessagebox.m
@@ -0,0 +1,145 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_events.h"
+#include "SDL_timer.h"
+#include "SDL_messagebox.h"
+#include "SDL_cocoavideo.h"
+
+@interface SDLMessageBoxPresenter : NSObject {
+@public
+ NSInteger clicked;
+ NSWindow *nswindow;
+}
+- (id) initWithParentWindow:(SDL_Window *)window;
+- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+@end
+
+@implementation SDLMessageBoxPresenter
+- (id) initWithParentWindow:(SDL_Window *)window
+{
+ self = [super init];
+ if (self) {
+ clicked = -1;
+
+ /* Retain the NSWindow because we'll show the alert later on the main thread */
+ if (window) {
+ nswindow = [((SDL_WindowData *) window->driverdata)->nswindow retain];
+ } else {
+ nswindow = NULL;
+ }
+ }
+
+ return self;
+}
+
+- (void)showAlert:(NSAlert*)alert
+{
+ if (nswindow) {
+#ifdef MAC_OS_X_VERSION_10_9
+ if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) {
+ [alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) {
+ clicked = returnCode;
+ }];
+ } else
+#endif
+ {
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+ [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];
+#endif
+ }
+
+ while (clicked < 0) {
+ SDL_PumpEvents();
+ SDL_Delay(100);
+ }
+
+ [nswindow release];
+ } else {
+ clicked = [alert runModal];
+ }
+}
+
+- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+ clicked = returnCode;
+}
+
+@end
+
+
+/* Display a Cocoa message box */
+int
+Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{ @autoreleasepool
+{
+ Cocoa_RegisterApp();
+
+ NSAlert* alert = [[[NSAlert alloc] init] autorelease];
+
+ if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) {
+ [alert setAlertStyle:NSAlertStyleCritical];
+ } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) {
+ [alert setAlertStyle:NSAlertStyleWarning];
+ } else {
+ [alert setAlertStyle:NSAlertStyleInformational];
+ }
+
+ [alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]];
+ [alert setInformativeText:[NSString stringWithUTF8String:messageboxdata->message]];
+
+ const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
+ int i;
+ for (i = 0; i < messageboxdata->numbuttons; ++i) {
+ NSButton *button = [alert addButtonWithTitle:[NSString stringWithUTF8String:buttons[i].text]];
+ if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
+ [button setKeyEquivalent:@"\r"];
+ } else if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
+ [button setKeyEquivalent:@"\033"];
+ } else {
+ [button setKeyEquivalent:@""];
+ }
+ }
+
+ SDLMessageBoxPresenter* presenter = [[[SDLMessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window] autorelease];
+
+ [presenter performSelectorOnMainThread:@selector(showAlert:)
+ withObject:alert
+ waitUntilDone:YES];
+
+ int returnValue = 0;
+ NSInteger clicked = presenter->clicked;
+ if (clicked >= NSAlertFirstButtonReturn) {
+ clicked -= NSAlertFirstButtonReturn;
+ *buttonid = buttons[clicked].buttonid;
+ } else {
+ returnValue = SDL_SetError("Did not get a valid `clicked button' id: %ld", (long)clicked);
+ }
+
+ return returnValue;
+}}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.h
new file mode 100644
index 0000000..c0a582f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.h
@@ -0,0 +1,63 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+/*
+ * @author Mark Callow, www.edgewise-consulting.com.
+ *
+ * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing
+ * how to add a CAMetalLayer backed view.
+ */
+
+#ifndef SDL_cocoametalview_h_
+#define SDL_cocoametalview_h_
+
+#import "../SDL_sysvideo.h"
+#import "SDL_cocoawindow.h"
+
+#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL)
+
+#import <Cocoa/Cocoa.h>
+#import <Metal/Metal.h>
+#import <QuartzCore/CAMetalLayer.h>
+
+#define METALVIEW_TAG 255
+
+@interface SDL_cocoametalview : NSView {
+ NSInteger _tag;
+}
+
+- (instancetype)initWithFrame:(NSRect)frame
+ scale:(CGFloat)scale;
+
+/* Override superclass tag so this class can set it. */
+@property (assign, readonly) NSInteger tag;
+
+@end
+
+SDL_cocoametalview* Cocoa_Mtl_AddMetalView(SDL_Window* window);
+
+void Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h);
+
+#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */
+
+#endif /* SDL_cocoametalview_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.m
new file mode 100644
index 0000000..e9c08a0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoametalview.m
@@ -0,0 +1,135 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+/*
+ * @author Mark Callow, www.edgewise-consulting.com.
+ *
+ * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing
+ * how to add a CAMetalLayer backed view.
+ */
+
+#import "SDL_cocoametalview.h"
+
+#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL)
+
+#include "SDL_assert.h"
+
+@implementation SDL_cocoametalview
+
+/* The synthesized getter should be called by super's viewWithTag. */
+@synthesize tag = _tag;
+
+/* Return a Metal-compatible layer. */
++ (Class)layerClass
+{
+ return NSClassFromString(@"CAMetalLayer");
+}
+
+/* Indicate the view wants to draw using a backing layer instead of drawRect. */
+- (BOOL)wantsUpdateLayer
+{
+ return YES;
+}
+
+/* When the wantsLayer property is set to YES, this method will be invoked to
+ * return a layer instance.
+ */
+- (CALayer*)makeBackingLayer
+{
+ return [self.class.layerClass layer];
+}
+
+- (instancetype)initWithFrame:(NSRect)frame
+ scale:(CGFloat)scale
+{
+ if ((self = [super initWithFrame:frame])) {
+ _tag = METALVIEW_TAG;
+ self.wantsLayer = YES;
+
+ /* Allow resize. */
+ self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
+
+ /* Set the desired scale. The default drawableSize of a CAMetalLayer
+ * is its bounds x its scale so nothing further needs to be done.
+ */
+ self.layer.contentsScale = scale;
+ }
+
+ return self;
+}
+
+/* Set the size of the metal drawables when the view is resized. */
+- (void)resizeWithOldSuperviewSize:(NSSize)oldSize
+{
+ [super resizeWithOldSuperviewSize:oldSize];
+}
+
+@end
+
+SDL_cocoametalview*
+Cocoa_Mtl_AddMetalView(SDL_Window* window)
+{
+ SDL_WindowData* data = (__bridge SDL_WindowData *)window->driverdata;
+ NSView *view = data->nswindow.contentView;
+ CGFloat scale = 1.0;
+
+ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ /* Set the scale to the natural scale factor of the screen - then
+ * the backing dimensions of the Metal view will match the pixel
+ * dimensions of the screen rather than the dimensions in points
+ * yielding high resolution on retine displays.
+ *
+ * N.B. In order for backingScaleFactor to be > 1,
+ * NSHighResolutionCapable must be set to true in the app's Info.plist.
+ */
+ NSWindow* nswindow = data->nswindow;
+ if ([nswindow.screen respondsToSelector:@selector(backingScaleFactor)])
+ scale = data->nswindow.screen.backingScaleFactor;
+ }
+
+ SDL_cocoametalview *metalview
+ = [[SDL_cocoametalview alloc] initWithFrame:view.frame scale:scale];
+ [view addSubview:metalview];
+ return metalview;
+}
+
+void
+Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h)
+{
+ SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+ NSView *view = data->nswindow.contentView;
+ SDL_cocoametalview* metalview = [view viewWithTag:METALVIEW_TAG];
+ if (metalview) {
+ CAMetalLayer *layer = (CAMetalLayer*)metalview.layer;
+ assert(layer != NULL);
+ if (w) {
+ *w = layer.drawableSize.width;
+ }
+ if (h) {
+ *h = layer.drawableSize.height;
+ }
+ } else {
+ SDL_GetWindowSize(window, w, h);
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.h
new file mode 100644
index 0000000..05482e8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.h
@@ -0,0 +1,46 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoamodes_h_
+#define SDL_cocoamodes_h_
+
+typedef struct
+{
+ CGDirectDisplayID display;
+} SDL_DisplayData;
+
+typedef struct
+{
+ CGDisplayModeRef moderef;
+} SDL_DisplayModeData;
+
+extern void Cocoa_InitModes(_THIS);
+extern int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+extern int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+extern void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+extern int Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hpdi, float * vdpi);
+extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+extern void Cocoa_QuitModes(_THIS);
+
+#endif /* SDL_cocoamodes_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.m
new file mode 100644
index 0000000..97ccd94
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamodes.m
@@ -0,0 +1,490 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "SDL_assert.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_cocoavideo.h"
+
+/* We need this for IODisplayCreateInfoDictionary and kIODisplayOnlyPreferredName */
+#include <IOKit/graphics/IOGraphicsLib.h>
+
+/* We need this for CVDisplayLinkGetNominalOutputVideoRefreshPeriod */
+#include <CoreVideo/CVBase.h>
+#include <CoreVideo/CVDisplayLink.h>
+
+/* we need this for ShowMenuBar() and HideMenuBar(). */
+#include <Carbon/Carbon.h>
+
+/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
+#include <AvailabilityMacros.h>
+
+
+static void
+Cocoa_ToggleMenuBar(const BOOL show)
+{
+ /* !!! FIXME: keep an eye on this.
+ * ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries.
+ * It happens to work, as of 10.7, but we're going to see if
+ * we can just simply do without it on newer OSes...
+ */
+#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) && !defined(__LP64__)
+ if (show) {
+ ShowMenuBar();
+ } else {
+ HideMenuBar();
+ }
+#endif
+}
+
+static int
+CG_SetError(const char *prefix, CGDisplayErr result)
+{
+ const char *error;
+
+ switch (result) {
+ case kCGErrorFailure:
+ error = "kCGErrorFailure";
+ break;
+ case kCGErrorIllegalArgument:
+ error = "kCGErrorIllegalArgument";
+ break;
+ case kCGErrorInvalidConnection:
+ error = "kCGErrorInvalidConnection";
+ break;
+ case kCGErrorInvalidContext:
+ error = "kCGErrorInvalidContext";
+ break;
+ case kCGErrorCannotComplete:
+ error = "kCGErrorCannotComplete";
+ break;
+ case kCGErrorNotImplemented:
+ error = "kCGErrorNotImplemented";
+ break;
+ case kCGErrorRangeCheck:
+ error = "kCGErrorRangeCheck";
+ break;
+ case kCGErrorTypeCheck:
+ error = "kCGErrorTypeCheck";
+ break;
+ case kCGErrorInvalidOperation:
+ error = "kCGErrorInvalidOperation";
+ break;
+ case kCGErrorNoneAvailable:
+ error = "kCGErrorNoneAvailable";
+ break;
+ default:
+ error = "Unknown Error";
+ break;
+ }
+ return SDL_SetError("%s: %s", prefix, error);
+}
+
+static SDL_bool
+GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode)
+{
+ SDL_DisplayModeData *data;
+ int width = 0;
+ int height = 0;
+ int bpp = 0;
+ int refreshRate = 0;
+ CFStringRef fmt;
+
+ data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
+ if (!data) {
+ return SDL_FALSE;
+ }
+ data->moderef = vidmode;
+
+ fmt = CGDisplayModeCopyPixelEncoding(vidmode);
+ width = (int) CGDisplayModeGetWidth(vidmode);
+ height = (int) CGDisplayModeGetHeight(vidmode);
+ refreshRate = (int) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
+
+ if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+ bpp = 32;
+ } else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels),
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+ bpp = 16;
+ } else if (CFStringCompare(fmt, CFSTR(kIO30BitDirectPixels),
+ kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
+ bpp = 30;
+ } else {
+ bpp = 0; /* ignore 8-bit and such for now. */
+ }
+
+ CFRelease(fmt);
+
+ /* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */
+ if (refreshRate == 0 && link != NULL) {
+ CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
+ if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) {
+ refreshRate = (int) ((time.timeScale / (double) time.timeValue) + 0.5);
+ }
+ }
+
+ mode->format = SDL_PIXELFORMAT_UNKNOWN;
+ switch (bpp) {
+ case 16:
+ mode->format = SDL_PIXELFORMAT_ARGB1555;
+ break;
+ case 30:
+ mode->format = SDL_PIXELFORMAT_ARGB2101010;
+ break;
+ case 32:
+ mode->format = SDL_PIXELFORMAT_ARGB8888;
+ break;
+ case 8: /* We don't support palettized modes now */
+ default: /* Totally unrecognizable bit depth. */
+ SDL_free(data);
+ return SDL_FALSE;
+ }
+ mode->w = width;
+ mode->h = height;
+ mode->refresh_rate = refreshRate;
+ mode->driverdata = data;
+ return SDL_TRUE;
+}
+
+static const char *
+Cocoa_GetDisplayName(CGDirectDisplayID displayID)
+{
+ CFDictionaryRef deviceInfo = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID), kIODisplayOnlyPreferredName);
+ NSDictionary *localizedNames = [(NSDictionary *)deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]];
+ const char* displayName = NULL;
+
+ if ([localizedNames count] > 0) {
+ displayName = SDL_strdup([[localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]] UTF8String]);
+ }
+ CFRelease(deviceInfo);
+ return displayName;
+}
+
+void
+Cocoa_InitModes(_THIS)
+{ @autoreleasepool
+{
+ CGDisplayErr result;
+ CGDirectDisplayID *displays;
+ CGDisplayCount numDisplays;
+ int pass, i;
+
+ result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
+ if (result != kCGErrorSuccess) {
+ CG_SetError("CGGetOnlineDisplayList()", result);
+ return;
+ }
+ displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays);
+ result = CGGetOnlineDisplayList(numDisplays, displays, &numDisplays);
+ if (result != kCGErrorSuccess) {
+ CG_SetError("CGGetOnlineDisplayList()", result);
+ SDL_stack_free(displays);
+ return;
+ }
+
+ /* Pick up the primary display in the first pass, then get the rest */
+ for (pass = 0; pass < 2; ++pass) {
+ for (i = 0; i < numDisplays; ++i) {
+ SDL_VideoDisplay display;
+ SDL_DisplayData *displaydata;
+ SDL_DisplayMode mode;
+ CGDisplayModeRef moderef = NULL;
+ CVDisplayLinkRef link = NULL;
+
+ if (pass == 0) {
+ if (!CGDisplayIsMain(displays[i])) {
+ continue;
+ }
+ } else {
+ if (CGDisplayIsMain(displays[i])) {
+ continue;
+ }
+ }
+
+ if (CGDisplayMirrorsDisplay(displays[i]) != kCGNullDirectDisplay) {
+ continue;
+ }
+
+ moderef = CGDisplayCopyDisplayMode(displays[i]);
+
+ if (!moderef) {
+ continue;
+ }
+
+ displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
+ if (!displaydata) {
+ CGDisplayModeRelease(moderef);
+ continue;
+ }
+ displaydata->display = displays[i];
+
+ CVDisplayLinkCreateWithCGDisplay(displays[i], &link);
+
+ SDL_zero(display);
+ /* this returns a stddup'ed string */
+ display.name = (char *)Cocoa_GetDisplayName(displays[i]);
+ if (!GetDisplayMode(_this, moderef, link, &mode)) {
+ CVDisplayLinkRelease(link);
+ CGDisplayModeRelease(moderef);
+ SDL_free(display.name);
+ SDL_free(displaydata);
+ continue;
+ }
+
+ CVDisplayLinkRelease(link);
+
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ display.driverdata = displaydata;
+ SDL_AddVideoDisplay(&display);
+ SDL_free(display.name);
+ }
+ }
+ SDL_stack_free(displays);
+}}
+
+int
+Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
+{
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
+ CGRect cgrect;
+
+ cgrect = CGDisplayBounds(displaydata->display);
+ rect->x = (int)cgrect.origin.x;
+ rect->y = (int)cgrect.origin.y;
+ rect->w = (int)cgrect.size.width;
+ rect->h = (int)cgrect.size.height;
+ return 0;
+}
+
+int
+Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
+{
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
+ const CGDirectDisplayID cgdisplay = displaydata->display;
+ NSArray *screens = [NSScreen screens];
+ NSScreen *screen = nil;
+
+ /* !!! FIXME: maybe track the NSScreen in SDL_DisplayData? */
+ for (NSScreen *i in screens) {
+ const CGDirectDisplayID thisDisplay = (CGDirectDisplayID) [[[i deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
+ if (thisDisplay == cgdisplay) {
+ screen = i;
+ break;
+ }
+ }
+
+ SDL_assert(screen != nil); /* didn't find it?! */
+ if (screen == nil) {
+ return -1;
+ }
+
+ const CGRect cgrect = CGDisplayBounds(cgdisplay);
+ const NSRect frame = [screen visibleFrame];
+
+ // !!! FIXME: I assume -[NSScreen visibleFrame] is relative to the origin of the screen in question and not the whole desktop.
+ // !!! FIXME: The math vs CGDisplayBounds might be incorrect if that's not the case, though. Check this.
+ rect->x = (int)(cgrect.origin.x + frame.origin.x);
+ rect->y = (int)(cgrect.origin.y + frame.origin.y);
+ rect->w = (int)frame.size.width;
+ rect->h = (int)frame.size.height;
+
+ return 0;
+}
+
+int
+Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi)
+{
+ const float MM_IN_INCH = 25.4f;
+
+ SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
+
+ CGSize displaySize = CGDisplayScreenSize(data->display);
+ int pixelWidth = (int) CGDisplayPixelsWide(data->display);
+ int pixelHeight = (int) CGDisplayPixelsHigh(data->display);
+
+ if (ddpi) {
+ *ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH);
+ }
+ if (hdpi) {
+ *hdpi = pixelWidth * MM_IN_INCH / displaySize.width;
+ }
+ if (vdpi) {
+ *vdpi = pixelHeight * MM_IN_INCH / displaySize.height;
+ }
+
+ return 0;
+}
+
+void
+Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
+ CVDisplayLinkRef link = NULL;
+ CGDisplayModeRef desktopmoderef;
+ SDL_DisplayMode desktopmode;
+ CFArrayRef modes;
+
+ CVDisplayLinkCreateWithCGDisplay(data->display, &link);
+
+ desktopmoderef = CGDisplayCopyDisplayMode(data->display);
+
+ /* CopyAllDisplayModes won't always contain the desktop display mode (if
+ * NULL is passed in) - for example on a retina 15" MBP, System Preferences
+ * allows choosing 1920x1200 but it's not in the list. AddDisplayMode makes
+ * sure there are no duplicates so it's safe to always add the desktop mode
+ * even in cases where it is in the CopyAllDisplayModes list.
+ */
+ if (desktopmoderef && GetDisplayMode(_this, desktopmoderef, link, &desktopmode)) {
+ if (!SDL_AddDisplayMode(display, &desktopmode)) {
+ CGDisplayModeRelease(desktopmoderef);
+ SDL_free(desktopmode.driverdata);
+ }
+ } else {
+ CGDisplayModeRelease(desktopmoderef);
+ }
+
+ modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
+
+ if (modes) {
+ CFIndex i;
+ const CFIndex count = CFArrayGetCount(modes);
+
+ for (i = 0; i < count; i++) {
+ CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
+ SDL_DisplayMode mode;
+
+ if (GetDisplayMode(_this, moderef, link, &mode)) {
+ if (SDL_AddDisplayMode(display, &mode)) {
+ CGDisplayModeRetain(moderef);
+ } else {
+ SDL_free(mode.driverdata);
+ }
+ }
+ }
+
+ CFRelease(modes);
+ }
+
+ CVDisplayLinkRelease(link);
+}
+
+int
+Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
+ SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
+ CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken;
+ CGError result;
+
+ /* Fade to black to hide resolution-switching flicker */
+ if (CGAcquireDisplayFadeReservation(5, &fade_token) == kCGErrorSuccess) {
+ CGDisplayFade(fade_token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE);
+ }
+
+ if (data == display->desktop_mode.driverdata) {
+ /* Restoring desktop mode */
+ CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL);
+
+ if (CGDisplayIsMain(displaydata->display)) {
+ CGReleaseAllDisplays();
+ } else {
+ CGDisplayRelease(displaydata->display);
+ }
+
+ if (CGDisplayIsMain(displaydata->display)) {
+ Cocoa_ToggleMenuBar(YES);
+ }
+ } else {
+ /* Put up the blanking window (a window above all other windows) */
+ if (CGDisplayIsMain(displaydata->display)) {
+ /* If we don't capture all displays, Cocoa tries to rearrange windows... *sigh* */
+ result = CGCaptureAllDisplays();
+ } else {
+ result = CGDisplayCapture(displaydata->display);
+ }
+ if (result != kCGErrorSuccess) {
+ CG_SetError("CGDisplayCapture()", result);
+ goto ERR_NO_CAPTURE;
+ }
+
+ /* Do the physical switch */
+ result = CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL);
+ if (result != kCGErrorSuccess) {
+ CG_SetError("CGDisplaySwitchToMode()", result);
+ goto ERR_NO_SWITCH;
+ }
+
+ /* Hide the menu bar so it doesn't intercept events */
+ if (CGDisplayIsMain(displaydata->display)) {
+ Cocoa_ToggleMenuBar(NO);
+ }
+ }
+
+ /* Fade in again (asynchronously) */
+ if (fade_token != kCGDisplayFadeReservationInvalidToken) {
+ CGDisplayFade(fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
+ CGReleaseDisplayFadeReservation(fade_token);
+ }
+
+ return 0;
+
+ /* Since the blanking window covers *all* windows (even force quit) correct recovery is crucial */
+ERR_NO_SWITCH:
+ CGDisplayRelease(displaydata->display);
+ERR_NO_CAPTURE:
+ if (fade_token != kCGDisplayFadeReservationInvalidToken) {
+ CGDisplayFade (fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
+ CGReleaseDisplayFadeReservation(fade_token);
+ }
+ return -1;
+}
+
+void
+Cocoa_QuitModes(_THIS)
+{
+ int i, j;
+
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ SDL_DisplayModeData *mode;
+
+ if (display->current_mode.driverdata != display->desktop_mode.driverdata) {
+ Cocoa_SetDisplayMode(_this, display, &display->desktop_mode);
+ }
+
+ mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata;
+ CGDisplayModeRelease(mode->moderef);
+
+ for (j = 0; j < display->num_display_modes; j++) {
+ mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata;
+ CGDisplayModeRelease(mode->moderef);
+ }
+
+ }
+ Cocoa_ToggleMenuBar(YES);
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.h
new file mode 100644
index 0000000..b79a3cf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoamouse_h_
+#define SDL_cocoamouse_h_
+
+#include "SDL_cocoavideo.h"
+
+extern void Cocoa_InitMouse(_THIS);
+extern void Cocoa_HandleMouseEvent(_THIS, NSEvent * event);
+extern void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent * event);
+extern void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y);
+extern void Cocoa_QuitMouse(_THIS);
+
+typedef struct {
+ /* Wether we've seen a cursor warp since the last move event. */
+ SDL_bool seenWarp;
+ /* What location our last cursor warp was to. */
+ CGFloat lastWarpX;
+ CGFloat lastWarpY;
+ /* What location we last saw the cursor move to. */
+ CGFloat lastMoveX;
+ CGFloat lastMoveY;
+ void *tapdata;
+} SDL_MouseData;
+
+@interface NSCursor (InvisibleCursor)
++ (NSCursor *)invisibleCursor;
+@end
+
+#endif /* SDL_cocoamouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.m
new file mode 100644
index 0000000..029a318
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamouse.m
@@ -0,0 +1,467 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_assert.h"
+#include "SDL_events.h"
+#include "SDL_cocoamouse.h"
+#include "SDL_cocoamousetap.h"
+#include "SDL_cocoavideo.h"
+
+#include "../../events/SDL_mouse_c.h"
+
+/* #define DEBUG_COCOAMOUSE */
+
+#ifdef DEBUG_COCOAMOUSE
+#define DLog(fmt, ...) printf("%s: " fmt "\n", __func__, ##__VA_ARGS__)
+#else
+#define DLog(...) do { } while (0)
+#endif
+
+@implementation NSCursor (InvisibleCursor)
++ (NSCursor *)invisibleCursor
+{
+ static NSCursor *invisibleCursor = NULL;
+ if (!invisibleCursor) {
+ /* RAW 16x16 transparent GIF */
+ static unsigned char cursorBytes[] = {
+ 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04,
+ 0x01, 0x00, 0x00, 0x01, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x10,
+ 0x00, 0x10, 0x00, 0x00, 0x02, 0x0E, 0x8C, 0x8F, 0xA9, 0xCB, 0xED,
+ 0x0F, 0xA3, 0x9C, 0xB4, 0xDA, 0x8B, 0xB3, 0x3E, 0x05, 0x00, 0x3B
+ };
+
+ NSData *cursorData = [NSData dataWithBytesNoCopy:&cursorBytes[0]
+ length:sizeof(cursorBytes)
+ freeWhenDone:NO];
+ NSImage *cursorImage = [[[NSImage alloc] initWithData:cursorData] autorelease];
+ invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage
+ hotSpot:NSZeroPoint];
+ }
+
+ return invisibleCursor;
+}
+@end
+
+
+static SDL_Cursor *
+Cocoa_CreateDefaultCursor()
+{ @autoreleasepool
+{
+ NSCursor *nscursor;
+ SDL_Cursor *cursor = NULL;
+
+ nscursor = [NSCursor arrowCursor];
+
+ if (nscursor) {
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ cursor->driverdata = nscursor;
+ [nscursor retain];
+ }
+ }
+
+ return cursor;
+}}
+
+static SDL_Cursor *
+Cocoa_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{ @autoreleasepool
+{
+ NSImage *nsimage;
+ NSCursor *nscursor = NULL;
+ SDL_Cursor *cursor = NULL;
+
+ nsimage = Cocoa_CreateImage(surface);
+ if (nsimage) {
+ nscursor = [[NSCursor alloc] initWithImage: nsimage hotSpot: NSMakePoint(hot_x, hot_y)];
+ }
+
+ if (nscursor) {
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ cursor->driverdata = nscursor;
+ } else {
+ [nscursor release];
+ }
+ }
+
+ return cursor;
+}}
+
+static SDL_Cursor *
+Cocoa_CreateSystemCursor(SDL_SystemCursor id)
+{ @autoreleasepool
+{
+ NSCursor *nscursor = NULL;
+ SDL_Cursor *cursor = NULL;
+
+ switch(id) {
+ case SDL_SYSTEM_CURSOR_ARROW:
+ nscursor = [NSCursor arrowCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_IBEAM:
+ nscursor = [NSCursor IBeamCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_WAIT:
+ nscursor = [NSCursor arrowCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR:
+ nscursor = [NSCursor crosshairCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_WAITARROW:
+ nscursor = [NSCursor arrowCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE:
+ case SDL_SYSTEM_CURSOR_SIZENESW:
+ nscursor = [NSCursor closedHandCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEWE:
+ nscursor = [NSCursor resizeLeftRightCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENS:
+ nscursor = [NSCursor resizeUpDownCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEALL:
+ nscursor = [NSCursor closedHandCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_NO:
+ nscursor = [NSCursor operationNotAllowedCursor];
+ break;
+ case SDL_SYSTEM_CURSOR_HAND:
+ nscursor = [NSCursor pointingHandCursor];
+ break;
+ default:
+ SDL_assert(!"Unknown system cursor");
+ return NULL;
+ }
+
+ if (nscursor) {
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ /* We'll free it later, so retain it here */
+ [nscursor retain];
+ cursor->driverdata = nscursor;
+ }
+ }
+
+ return cursor;
+}}
+
+static void
+Cocoa_FreeCursor(SDL_Cursor * cursor)
+{ @autoreleasepool
+{
+ NSCursor *nscursor = (NSCursor *)cursor->driverdata;
+
+ [nscursor release];
+ SDL_free(cursor);
+}}
+
+static int
+Cocoa_ShowCursor(SDL_Cursor * cursor)
+{ @autoreleasepool
+{
+ SDL_VideoDevice *device = SDL_GetVideoDevice();
+ SDL_Window *window = (device ? device->windows : NULL);
+ for (; window != NULL; window = window->next) {
+ SDL_WindowData *driverdata = (SDL_WindowData *)window->driverdata;
+ if (driverdata) {
+ [driverdata->nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:)
+ withObject:[driverdata->nswindow contentView]
+ waitUntilDone:NO];
+ }
+ }
+ return 0;
+}}
+
+static SDL_Window *
+SDL_FindWindowAtPoint(const int x, const int y)
+{
+ const SDL_Point pt = { x, y };
+ SDL_Window *i;
+ for (i = SDL_GetVideoDevice()->windows; i; i = i->next) {
+ const SDL_Rect r = { i->x, i->y, i->w, i->h };
+ if (SDL_PointInRect(&pt, &r)) {
+ return i;
+ }
+ }
+
+ return NULL;
+}
+
+static int
+Cocoa_WarpMouseGlobal(int x, int y)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (mouse->focus) {
+ SDL_WindowData *data = (SDL_WindowData *) mouse->focus->driverdata;
+ if ([data->listener isMoving]) {
+ DLog("Postponing warp, window being moved.");
+ [data->listener setPendingMoveX:x Y:y];
+ return 0;
+ }
+ }
+ const CGPoint point = CGPointMake((float)x, (float)y);
+
+ Cocoa_HandleMouseWarp(point.x, point.y);
+
+ CGWarpMouseCursorPosition(point);
+
+ /* CGWarpMouse causes a short delay by default, which is preventable by
+ * Calling this directly after. CGSetLocalEventsSuppressionInterval can also
+ * prevent it, but it's deprecated as of OS X 10.6.
+ */
+ if (!mouse->relative_mode) {
+ CGAssociateMouseAndMouseCursorPosition(YES);
+ }
+
+ /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
+ * other implementations' APIs. Send what's appropriate.
+ */
+ if (!mouse->relative_mode) {
+ SDL_Window *win = SDL_FindWindowAtPoint(x, y);
+ SDL_SetMouseFocus(win);
+ if (win) {
+ SDL_assert(win == mouse->focus);
+ SDL_SendMouseMotion(win, mouse->mouseID, 0, x - win->x, y - win->y);
+ }
+ }
+
+ return 0;
+}
+
+static void
+Cocoa_WarpMouse(SDL_Window * window, int x, int y)
+{
+ Cocoa_WarpMouseGlobal(x + window->x, y + window->y);
+}
+
+static int
+Cocoa_SetRelativeMouseMode(SDL_bool enabled)
+{
+ /* We will re-apply the relative mode when the window gets focus, if it
+ * doesn't have focus right now.
+ */
+ SDL_Window *window = SDL_GetMouseFocus();
+ if (!window) {
+ return 0;
+ }
+
+ /* We will re-apply the relative mode when the window finishes being moved,
+ * if it is being moved right now.
+ */
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ if ([data->listener isMoving]) {
+ return 0;
+ }
+
+ CGError result;
+ if (enabled) {
+ DLog("Turning on.");
+ result = CGAssociateMouseAndMouseCursorPosition(NO);
+ } else {
+ DLog("Turning off.");
+ result = CGAssociateMouseAndMouseCursorPosition(YES);
+ }
+ if (result != kCGErrorSuccess) {
+ return SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed");
+ }
+
+ /* The hide/unhide calls are redundant most of the time, but they fix
+ * https://bugzilla.libsdl.org/show_bug.cgi?id=2550
+ */
+ if (enabled) {
+ [NSCursor hide];
+ } else {
+ [NSCursor unhide];
+ }
+ return 0;
+}
+
+static int
+Cocoa_CaptureMouse(SDL_Window *window)
+{
+ /* our Cocoa event code already tracks the mouse outside the window,
+ so all we have to do here is say "okay" and do what we always do. */
+ return 0;
+}
+
+static Uint32
+Cocoa_GetGlobalMouseState(int *x, int *y)
+{
+ const NSUInteger cocoaButtons = [NSEvent pressedMouseButtons];
+ const NSPoint cocoaLocation = [NSEvent mouseLocation];
+ Uint32 retval = 0;
+
+ for (NSScreen *screen in [NSScreen screens]) {
+ NSRect frame = [screen frame];
+ if (NSMouseInRect(cocoaLocation, frame, NO)) {
+ *x = (int) cocoaLocation.x;
+ *y = (int) ((frame.origin.y + frame.size.height) - cocoaLocation.y);
+ break;
+ }
+ }
+
+ retval |= (cocoaButtons & (1 << 0)) ? SDL_BUTTON_LMASK : 0;
+ retval |= (cocoaButtons & (1 << 1)) ? SDL_BUTTON_RMASK : 0;
+ retval |= (cocoaButtons & (1 << 2)) ? SDL_BUTTON_MMASK : 0;
+ retval |= (cocoaButtons & (1 << 3)) ? SDL_BUTTON_X1MASK : 0;
+ retval |= (cocoaButtons & (1 << 4)) ? SDL_BUTTON_X2MASK : 0;
+
+ return retval;
+}
+
+void
+Cocoa_InitMouse(_THIS)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->driverdata = SDL_calloc(1, sizeof(SDL_MouseData));
+
+ mouse->CreateCursor = Cocoa_CreateCursor;
+ mouse->CreateSystemCursor = Cocoa_CreateSystemCursor;
+ mouse->ShowCursor = Cocoa_ShowCursor;
+ mouse->FreeCursor = Cocoa_FreeCursor;
+ mouse->WarpMouse = Cocoa_WarpMouse;
+ mouse->WarpMouseGlobal = Cocoa_WarpMouseGlobal;
+ mouse->SetRelativeMouseMode = Cocoa_SetRelativeMouseMode;
+ mouse->CaptureMouse = Cocoa_CaptureMouse;
+ mouse->GetGlobalMouseState = Cocoa_GetGlobalMouseState;
+
+ SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());
+
+ Cocoa_InitMouseEventTap(mouse->driverdata);
+
+ SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata;
+ const NSPoint location = [NSEvent mouseLocation];
+ driverdata->lastMoveX = location.x;
+ driverdata->lastMoveY = location.y;
+}
+
+void
+Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
+{
+ switch ([event type]) {
+ case NSEventTypeMouseMoved:
+ case NSEventTypeLeftMouseDragged:
+ case NSEventTypeRightMouseDragged:
+ case NSEventTypeOtherMouseDragged:
+ break;
+
+ default:
+ /* Ignore any other events. */
+ return;
+ }
+
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata;
+ if (!driverdata) {
+ return; /* can happen when returning from fullscreen Space on shutdown */
+ }
+
+ const SDL_bool seenWarp = driverdata->seenWarp;
+ driverdata->seenWarp = NO;
+
+ const NSPoint location = [NSEvent mouseLocation];
+ const CGFloat lastMoveX = driverdata->lastMoveX;
+ const CGFloat lastMoveY = driverdata->lastMoveY;
+ driverdata->lastMoveX = location.x;
+ driverdata->lastMoveY = location.y;
+ DLog("Last seen mouse: (%g, %g)", location.x, location.y);
+
+ /* Non-relative movement is handled in -[Cocoa_WindowListener mouseMoved:] */
+ if (!mouse->relative_mode) {
+ return;
+ }
+
+ /* Ignore events that aren't inside the client area (i.e. title bar.) */
+ if ([event window]) {
+ NSRect windowRect = [[[event window] contentView] frame];
+ if (!NSMouseInRect([event locationInWindow], windowRect, NO)) {
+ return;
+ }
+ }
+
+ float deltaX = [event deltaX];
+ float deltaY = [event deltaY];
+
+ if (seenWarp) {
+ deltaX += (lastMoveX - driverdata->lastWarpX);
+ deltaY += ((CGDisplayPixelsHigh(kCGDirectMainDisplay) - lastMoveY) - driverdata->lastWarpY);
+
+ DLog("Motion was (%g, %g), offset to (%g, %g)", [event deltaX], [event deltaY], deltaX, deltaY);
+ }
+
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 1, (int)deltaX, (int)deltaY);
+}
+
+void
+Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ CGFloat x = -[event deltaX];
+ CGFloat y = [event deltaY];
+ SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL;
+
+ if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) {
+ if ([event isDirectionInvertedFromDevice] == YES) {
+ direction = SDL_MOUSEWHEEL_FLIPPED;
+ }
+ }
+
+ SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction);
+}
+
+void
+Cocoa_HandleMouseWarp(CGFloat x, CGFloat y)
+{
+ /* This makes Cocoa_HandleMouseEvent ignore the delta caused by the warp,
+ * since it gets included in the next movement event.
+ */
+ SDL_MouseData *driverdata = (SDL_MouseData*)SDL_GetMouse()->driverdata;
+ driverdata->lastWarpX = x;
+ driverdata->lastWarpY = y;
+ driverdata->seenWarp = SDL_TRUE;
+
+ DLog("(%g, %g)", x, y);
+}
+
+void
+Cocoa_QuitMouse(_THIS)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (mouse) {
+ if (mouse->driverdata) {
+ Cocoa_QuitMouseEventTap(((SDL_MouseData*)mouse->driverdata));
+ }
+
+ SDL_free(mouse->driverdata);
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.h
new file mode 100644
index 0000000..40ce386
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.h
@@ -0,0 +1,34 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoamousetap_h_
+#define SDL_cocoamousetap_h_
+
+#include "SDL_cocoamouse.h"
+
+extern void Cocoa_InitMouseEventTap(SDL_MouseData *driverdata);
+extern void Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled);
+extern void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata);
+
+#endif /* SDL_cocoamousetap_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.m
new file mode 100644
index 0000000..3c4fcf2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoamousetap.m
@@ -0,0 +1,279 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_cocoamousetap.h"
+
+/* Event taps are forbidden in the Mac App Store, so we can only enable this
+ * code if your app doesn't need to ship through the app store.
+ * This code makes it so that a grabbed cursor cannot "leak" a mouse click
+ * past the edge of the window if moving the cursor too fast.
+ */
+#if SDL_MAC_NO_SANDBOX
+
+#include "SDL_keyboard.h"
+#include "SDL_cocoavideo.h"
+#include "../../thread/SDL_systhread.h"
+
+#include "../../events/SDL_mouse_c.h"
+
+typedef struct {
+ CFMachPortRef tap;
+ CFRunLoopRef runloop;
+ CFRunLoopSourceRef runloopSource;
+ SDL_Thread *thread;
+ SDL_sem *runloopStartedSemaphore;
+} SDL_MouseEventTapData;
+
+static const CGEventMask movementEventsMask =
+ CGEventMaskBit(kCGEventLeftMouseDragged)
+ | CGEventMaskBit(kCGEventRightMouseDragged)
+ | CGEventMaskBit(kCGEventMouseMoved);
+
+static const CGEventMask allGrabbedEventsMask =
+ CGEventMaskBit(kCGEventLeftMouseDown) | CGEventMaskBit(kCGEventLeftMouseUp)
+ | CGEventMaskBit(kCGEventRightMouseDown) | CGEventMaskBit(kCGEventRightMouseUp)
+ | CGEventMaskBit(kCGEventOtherMouseDown) | CGEventMaskBit(kCGEventOtherMouseUp)
+ | CGEventMaskBit(kCGEventLeftMouseDragged) | CGEventMaskBit(kCGEventRightMouseDragged)
+ | CGEventMaskBit(kCGEventMouseMoved);
+
+static CGEventRef
+Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
+{
+ SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Window *window = SDL_GetKeyboardFocus();
+ NSWindow *nswindow;
+ NSRect windowRect;
+ CGPoint eventLocation;
+
+ switch (type) {
+ case kCGEventTapDisabledByTimeout:
+ {
+ CGEventTapEnable(tapdata->tap, true);
+ return NULL;
+ }
+ case kCGEventTapDisabledByUserInput:
+ {
+ return NULL;
+ }
+ default:
+ break;
+ }
+
+
+ if (!window || !mouse) {
+ return event;
+ }
+
+ if (mouse->relative_mode) {
+ return event;
+ }
+
+ if (!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
+ return event;
+ }
+
+ /* This is the same coordinate system as Cocoa uses. */
+ nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
+ eventLocation = CGEventGetUnflippedLocation(event);
+ windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
+
+ if (!NSMouseInRect(NSPointFromCGPoint(eventLocation), windowRect, NO)) {
+
+ /* This is in CGs global screenspace coordinate system, which has a
+ * flipped Y.
+ */
+ CGPoint newLocation = CGEventGetLocation(event);
+
+ if (eventLocation.x < NSMinX(windowRect)) {
+ newLocation.x = NSMinX(windowRect);
+ } else if (eventLocation.x >= NSMaxX(windowRect)) {
+ newLocation.x = NSMaxX(windowRect) - 1.0;
+ }
+
+ if (eventLocation.y <= NSMinY(windowRect)) {
+ newLocation.y -= (NSMinY(windowRect) - eventLocation.y + 1);
+ } else if (eventLocation.y > NSMaxY(windowRect)) {
+ newLocation.y += (eventLocation.y - NSMaxY(windowRect));
+ }
+
+ CGWarpMouseCursorPosition(newLocation);
+ CGAssociateMouseAndMouseCursorPosition(YES);
+
+ if ((CGEventMaskBit(type) & movementEventsMask) == 0) {
+ /* For click events, we just constrain the event to the window, so
+ * no other app receives the click event. We can't due the same to
+ * movement events, since they mean that our warp cursor above
+ * behaves strangely.
+ */
+ CGEventSetLocation(event, newLocation);
+ }
+ }
+
+ return event;
+}
+
+static void
+SemaphorePostCallback(CFRunLoopTimerRef timer, void *info)
+{
+ SDL_SemPost((SDL_sem*)info);
+}
+
+static int
+Cocoa_MouseTapThread(void *data)
+{
+ SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)data;
+
+ /* Tap was created on main thread but we own it now. */
+ CFMachPortRef eventTap = tapdata->tap;
+ if (eventTap) {
+ /* Try to create a runloop source we can schedule. */
+ CFRunLoopSourceRef runloopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0);
+ if (runloopSource) {
+ tapdata->runloopSource = runloopSource;
+ } else {
+ CFRelease(eventTap);
+ SDL_SemPost(tapdata->runloopStartedSemaphore);
+ /* TODO: Both here and in the return below, set some state in
+ * tapdata to indicate that initialization failed, which we should
+ * check in InitMouseEventTap, after we move the semaphore check
+ * from Quit to Init.
+ */
+ return 1;
+ }
+ } else {
+ SDL_SemPost(tapdata->runloopStartedSemaphore);
+ return 1;
+ }
+
+ tapdata->runloop = CFRunLoopGetCurrent();
+ CFRunLoopAddSource(tapdata->runloop, tapdata->runloopSource, kCFRunLoopCommonModes);
+ CFRunLoopTimerContext context = {.info = tapdata->runloopStartedSemaphore};
+ /* We signal the runloop started semaphore *after* the run loop has started, indicating it's safe to CFRunLoopStop it. */
+ CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent(), 0, 0, 0, &SemaphorePostCallback, &context);
+ CFRunLoopAddTimer(tapdata->runloop, timer, kCFRunLoopCommonModes);
+ CFRelease(timer);
+
+ /* Run the event loop to handle events in the event tap. */
+ CFRunLoopRun();
+ /* Make sure this is signaled so that SDL_QuitMouseEventTap knows it can safely SDL_WaitThread for us. */
+ if (SDL_SemValue(tapdata->runloopStartedSemaphore) < 1) {
+ SDL_SemPost(tapdata->runloopStartedSemaphore);
+ }
+ CFRunLoopRemoveSource(tapdata->runloop, tapdata->runloopSource, kCFRunLoopCommonModes);
+
+ /* Clean up. */
+ CGEventTapEnable(tapdata->tap, false);
+ CFRelease(tapdata->runloopSource);
+ CFRelease(tapdata->tap);
+ tapdata->runloopSource = NULL;
+ tapdata->tap = NULL;
+
+ return 0;
+}
+
+void
+Cocoa_InitMouseEventTap(SDL_MouseData* driverdata)
+{
+ SDL_MouseEventTapData *tapdata;
+ driverdata->tapdata = SDL_calloc(1, sizeof(SDL_MouseEventTapData));
+ tapdata = (SDL_MouseEventTapData*)driverdata->tapdata;
+
+ tapdata->runloopStartedSemaphore = SDL_CreateSemaphore(0);
+ if (tapdata->runloopStartedSemaphore) {
+ tapdata->tap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap,
+ kCGEventTapOptionDefault, allGrabbedEventsMask,
+ &Cocoa_MouseTapCallback, tapdata);
+ if (tapdata->tap) {
+ /* Tap starts disabled, until app requests mouse grab */
+ CGEventTapEnable(tapdata->tap, false);
+ tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata);
+ if (tapdata->thread) {
+ /* Success - early out. Ownership transferred to thread. */
+ return;
+ }
+ CFRelease(tapdata->tap);
+ }
+ SDL_DestroySemaphore(tapdata->runloopStartedSemaphore);
+ }
+ SDL_free(driverdata->tapdata);
+ driverdata->tapdata = NULL;
+}
+
+void
+Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled)
+{
+ SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata;
+ if (tapdata && tapdata->tap)
+ {
+ CGEventTapEnable(tapdata->tap, !!enabled);
+ }
+}
+
+void
+Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata)
+{
+ SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata;
+ int status;
+
+ /* Ensure that the runloop has been started first.
+ * TODO: Move this to InitMouseEventTap, check for error conditions that can
+ * happen in Cocoa_MouseTapThread, and fall back to the non-EventTap way of
+ * grabbing the mouse if it fails to Init.
+ */
+ status = SDL_SemWaitTimeout(tapdata->runloopStartedSemaphore, 5000);
+ if (status > -1) {
+ /* Then stop it, which will cause Cocoa_MouseTapThread to return. */
+ CFRunLoopStop(tapdata->runloop);
+ /* And then wait for Cocoa_MouseTapThread to finish cleaning up. It
+ * releases some of the pointers in tapdata. */
+ SDL_WaitThread(tapdata->thread, &status);
+ }
+
+ SDL_free(driverdata->tapdata);
+ driverdata->tapdata = NULL;
+}
+
+#else /* SDL_MAC_NO_SANDBOX */
+
+void
+Cocoa_InitMouseEventTap(SDL_MouseData *unused)
+{
+}
+
+void
+Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled)
+{
+}
+
+void
+Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata)
+{
+}
+
+#endif /* !SDL_MAC_NO_SANDBOX */
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.h
new file mode 100644
index 0000000..81ca5ed
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.h
@@ -0,0 +1,68 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoaopengl_h_
+#define SDL_cocoaopengl_h_
+
+#if SDL_VIDEO_OPENGL_CGL
+
+#include "SDL_atomic.h"
+#import <Cocoa/Cocoa.h>
+
+struct SDL_GLDriverData
+{
+ int initialized;
+};
+
+@interface SDLOpenGLContext : NSOpenGLContext {
+ SDL_atomic_t dirty;
+ SDL_Window *window;
+}
+
+- (id)initWithFormat:(NSOpenGLPixelFormat *)format
+ shareContext:(NSOpenGLContext *)share;
+- (void)scheduleUpdate;
+- (void)updateIfNeeded;
+- (void)setWindow:(SDL_Window *)window;
+
+@end
+
+
+/* OpenGL functions */
+extern int Cocoa_GL_LoadLibrary(_THIS, const char *path);
+extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc);
+extern void Cocoa_GL_UnloadLibrary(_THIS);
+extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window);
+extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window,
+ SDL_GLContext context);
+extern void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window,
+ int * w, int * h);
+extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
+extern int Cocoa_GL_GetSwapInterval(_THIS);
+extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
+extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
+
+#endif /* SDL_VIDEO_OPENGL_CGL */
+
+#endif /* SDL_cocoaopengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.m
new file mode 100644
index 0000000..5f18a2e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengl.m
@@ -0,0 +1,428 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/* NSOpenGL implementation of SDL OpenGL support */
+
+#if SDL_VIDEO_OPENGL_CGL
+#include "SDL_cocoavideo.h"
+#include "SDL_cocoaopengl.h"
+#include "SDL_cocoaopengles.h"
+
+#include <OpenGL/CGLTypes.h>
+#include <OpenGL/OpenGL.h>
+#include <OpenGL/CGLRenderers.h>
+
+#include "SDL_loadso.h"
+#include "SDL_opengl.h"
+
+#define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
+
+@implementation SDLOpenGLContext : NSOpenGLContext
+
+- (id)initWithFormat:(NSOpenGLPixelFormat *)format
+ shareContext:(NSOpenGLContext *)share
+{
+ self = [super initWithFormat:format shareContext:share];
+ if (self) {
+ SDL_AtomicSet(&self->dirty, 0);
+ self->window = NULL;
+ }
+ return self;
+}
+
+- (void)scheduleUpdate
+{
+ SDL_AtomicAdd(&self->dirty, 1);
+}
+
+/* This should only be called on the thread on which a user is using the context. */
+- (void)updateIfNeeded
+{
+ int value = SDL_AtomicSet(&self->dirty, 0);
+ if (value > 0) {
+ /* We call the real underlying update here, since -[SDLOpenGLContext update] just calls us. */
+ [super update];
+ }
+}
+
+/* This should only be called on the thread on which a user is using the context. */
+- (void)update
+{
+ /* This ensures that regular 'update' calls clear the atomic dirty flag. */
+ [self scheduleUpdate];
+ [self updateIfNeeded];
+}
+
+/* Updates the drawable for the contexts and manages related state. */
+- (void)setWindow:(SDL_Window *)newWindow
+{
+ if (self->window) {
+ SDL_WindowData *oldwindowdata = (SDL_WindowData *)self->window->driverdata;
+
+ /* Make sure to remove us from the old window's context list, or we'll get scheduled updates from it too. */
+ NSMutableArray *contexts = oldwindowdata->nscontexts;
+ @synchronized (contexts) {
+ [contexts removeObject:self];
+ }
+ }
+
+ self->window = newWindow;
+
+ if (newWindow) {
+ SDL_WindowData *windowdata = (SDL_WindowData *)newWindow->driverdata;
+
+ /* Now sign up for scheduled updates for the new window. */
+ NSMutableArray *contexts = windowdata->nscontexts;
+ @synchronized (contexts) {
+ [contexts addObject:self];
+ }
+
+ if ([self view] != [windowdata->nswindow contentView]) {
+ [self setView:[windowdata->nswindow contentView]];
+ if (self == [NSOpenGLContext currentContext]) {
+ [self update];
+ } else {
+ [self scheduleUpdate];
+ }
+ }
+ } else {
+ [self clearDrawable];
+ if (self == [NSOpenGLContext currentContext]) {
+ [self update];
+ } else {
+ [self scheduleUpdate];
+ }
+ }
+}
+
+@end
+
+
+int
+Cocoa_GL_LoadLibrary(_THIS, const char *path)
+{
+ /* Load the OpenGL library */
+ if (path == NULL) {
+ path = SDL_getenv("SDL_OPENGL_LIBRARY");
+ }
+ if (path == NULL) {
+ path = DEFAULT_OPENGL;
+ }
+ _this->gl_config.dll_handle = SDL_LoadObject(path);
+ if (!_this->gl_config.dll_handle) {
+ return -1;
+ }
+ SDL_strlcpy(_this->gl_config.driver_path, path,
+ SDL_arraysize(_this->gl_config.driver_path));
+ return 0;
+}
+
+void *
+Cocoa_GL_GetProcAddress(_THIS, const char *proc)
+{
+ return SDL_LoadFunction(_this->gl_config.dll_handle, proc);
+}
+
+void
+Cocoa_GL_UnloadLibrary(_THIS)
+{
+ SDL_UnloadObject(_this->gl_config.dll_handle);
+ _this->gl_config.dll_handle = NULL;
+}
+
+SDL_GLContext
+Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
+ SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
+ NSOpenGLPixelFormatAttribute attr[32];
+ NSOpenGLPixelFormat *fmt;
+ SDLOpenGLContext *context;
+ NSOpenGLContext *share_context = nil;
+ int i = 0;
+ const char *glversion;
+ int glversion_major;
+ int glversion_minor;
+
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
+#if SDL_VIDEO_OPENGL_EGL
+ /* Switch to EGL based functions */
+ Cocoa_GL_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary;
+ _this->GL_GetProcAddress = Cocoa_GLES_GetProcAddress;
+ _this->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary;
+ _this->GL_CreateContext = Cocoa_GLES_CreateContext;
+ _this->GL_MakeCurrent = Cocoa_GLES_MakeCurrent;
+ _this->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval;
+ _this->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
+ _this->GL_SwapWindow = Cocoa_GLES_SwapWindow;
+ _this->GL_DeleteContext = Cocoa_GLES_DeleteContext;
+
+ if (Cocoa_GLES_LoadLibrary(_this, NULL) != 0) {
+ return NULL;
+ }
+ return Cocoa_GLES_CreateContext(_this, window);
+#else
+ SDL_SetError("SDL not configured with EGL support");
+ return NULL;
+#endif
+ }
+ if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) {
+ SDL_SetError ("OpenGL Core Profile is not supported on this platform version");
+ return NULL;
+ }
+
+ attr[i++] = NSOpenGLPFAAllowOfflineRenderers;
+
+ /* specify a profile if we're on Lion (10.7) or later. */
+ if (lion_or_later) {
+ NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
+ profile = NSOpenGLProfileVersion3_2Core;
+ }
+ attr[i++] = NSOpenGLPFAOpenGLProfile;
+ attr[i++] = profile;
+ }
+
+ attr[i++] = NSOpenGLPFAColorSize;
+ attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8;
+
+ attr[i++] = NSOpenGLPFADepthSize;
+ attr[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.double_buffer) {
+ attr[i++] = NSOpenGLPFADoubleBuffer;
+ }
+
+ if (_this->gl_config.stereo) {
+ attr[i++] = NSOpenGLPFAStereo;
+ }
+
+ if (_this->gl_config.stencil_size) {
+ attr[i++] = NSOpenGLPFAStencilSize;
+ attr[i++] = _this->gl_config.stencil_size;
+ }
+
+ if ((_this->gl_config.accum_red_size +
+ _this->gl_config.accum_green_size +
+ _this->gl_config.accum_blue_size +
+ _this->gl_config.accum_alpha_size) > 0) {
+ attr[i++] = NSOpenGLPFAAccumSize;
+ attr[i++] = _this->gl_config.accum_red_size + _this->gl_config.accum_green_size + _this->gl_config.accum_blue_size + _this->gl_config.accum_alpha_size;
+ }
+
+ if (_this->gl_config.multisamplebuffers) {
+ attr[i++] = NSOpenGLPFASampleBuffers;
+ attr[i++] = _this->gl_config.multisamplebuffers;
+ }
+
+ if (_this->gl_config.multisamplesamples) {
+ attr[i++] = NSOpenGLPFASamples;
+ attr[i++] = _this->gl_config.multisamplesamples;
+ attr[i++] = NSOpenGLPFANoRecovery;
+ }
+
+ if (_this->gl_config.accelerated >= 0) {
+ if (_this->gl_config.accelerated) {
+ attr[i++] = NSOpenGLPFAAccelerated;
+ } else {
+ attr[i++] = NSOpenGLPFARendererID;
+ attr[i++] = kCGLRendererGenericFloatID;
+ }
+ }
+
+ attr[i++] = NSOpenGLPFAScreenMask;
+ attr[i++] = CGDisplayIDToOpenGLDisplayMask(displaydata->display);
+ attr[i] = 0;
+
+ fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
+ if (fmt == nil) {
+ SDL_SetError("Failed creating OpenGL pixel format");
+ return NULL;
+ }
+
+ if (_this->gl_config.share_with_current_context) {
+ share_context = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
+ }
+
+ context = [[SDLOpenGLContext alloc] initWithFormat:fmt shareContext:share_context];
+
+ [fmt release];
+
+ if (context == nil) {
+ SDL_SetError("Failed creating OpenGL context");
+ return NULL;
+ }
+
+ if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
+ Cocoa_GL_DeleteContext(_this, context);
+ SDL_SetError("Failed making OpenGL context current");
+ return NULL;
+ }
+
+ if (_this->gl_config.major_version < 3 &&
+ _this->gl_config.profile_mask == 0 &&
+ _this->gl_config.flags == 0) {
+ /* This is a legacy profile, so to match other backends, we're done. */
+ } else {
+ const GLubyte *(APIENTRY * glGetStringFunc)(GLenum);
+
+ glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString");
+ if (!glGetStringFunc) {
+ Cocoa_GL_DeleteContext(_this, context);
+ SDL_SetError ("Failed getting OpenGL glGetString entry point");
+ return NULL;
+ }
+
+ glversion = (const char *)glGetStringFunc(GL_VERSION);
+ if (glversion == NULL) {
+ Cocoa_GL_DeleteContext(_this, context);
+ SDL_SetError ("Failed getting OpenGL context version");
+ return NULL;
+ }
+
+ if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) {
+ Cocoa_GL_DeleteContext(_this, context);
+ SDL_SetError ("Failed parsing OpenGL context version");
+ return NULL;
+ }
+
+ if ((glversion_major < _this->gl_config.major_version) ||
+ ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) {
+ Cocoa_GL_DeleteContext(_this, context);
+ SDL_SetError ("Failed creating OpenGL context at version requested");
+ return NULL;
+ }
+
+ /* In the future we'll want to do this, but to match other platforms
+ we'll leave the OpenGL version the way it is for now
+ */
+ /*_this->gl_config.major_version = glversion_major;*/
+ /*_this->gl_config.minor_version = glversion_minor;*/
+ }
+ return context;
+}}
+
+int
+Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{ @autoreleasepool
+{
+ if (context) {
+ SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
+ [nscontext setWindow:window];
+ [nscontext updateIfNeeded];
+ [nscontext makeCurrentContext];
+ } else {
+ [NSOpenGLContext clearCurrentContext];
+ }
+
+ return 0;
+}}
+
+void
+Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
+{
+ SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
+ NSView *contentView = [windata->nswindow contentView];
+ NSRect viewport = [contentView bounds];
+
+ /* This gives us the correct viewport for a Retina-enabled view, only
+ * supported on 10.7+. */
+ if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
+ viewport = [contentView convertRectToBacking:viewport];
+ }
+
+ if (w) {
+ *w = viewport.size.width;
+ }
+
+ if (h) {
+ *h = viewport.size.height;
+ }
+}
+
+int
+Cocoa_GL_SetSwapInterval(_THIS, int interval)
+{ @autoreleasepool
+{
+ NSOpenGLContext *nscontext;
+ GLint value;
+ int status;
+
+ if (interval < 0) { /* no extension for this on Mac OS X at the moment. */
+ return SDL_SetError("Late swap tearing currently unsupported");
+ }
+
+ nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
+ if (nscontext != nil) {
+ value = interval;
+ [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval];
+ status = 0;
+ } else {
+ status = SDL_SetError("No current OpenGL context");
+ }
+
+ return status;
+}}
+
+int
+Cocoa_GL_GetSwapInterval(_THIS)
+{ @autoreleasepool
+{
+ NSOpenGLContext *nscontext;
+ GLint value;
+ int status = 0;
+
+ nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext();
+ if (nscontext != nil) {
+ [nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval];
+ status = (int)value;
+ }
+
+ return status;
+}}
+
+int
+Cocoa_GL_SwapWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext();
+ [nscontext flushBuffer];
+ [nscontext updateIfNeeded];
+ return 0;
+}}
+
+void
+Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
+{ @autoreleasepool
+{
+ SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context;
+
+ [nscontext setWindow:NULL];
+ [nscontext release];
+}}
+
+#endif /* SDL_VIDEO_OPENGL_CGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.h
new file mode 100644
index 0000000..fc7f5c0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoaopengles_h_
+#define SDL_cocoaopengles_h_
+
+#if SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define Cocoa_GLES_GetAttribute SDL_EGL_GetAttribute
+#define Cocoa_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define Cocoa_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define Cocoa_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define Cocoa_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+
+extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window);
+
+#endif /* SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_cocoaopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.m
new file mode 100644
index 0000000..e0a05a1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoaopengles.m
@@ -0,0 +1,132 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_cocoavideo.h"
+#include "SDL_cocoaopengles.h"
+#include "SDL_cocoaopengl.h"
+#include "SDL_log.h"
+
+/* EGL implementation of SDL OpenGL support */
+
+int
+Cocoa_GLES_LoadLibrary(_THIS, const char *path) {
+
+ /* If the profile requested is not GL ES, switch over to WIN_GL functions */
+ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
+#if SDL_VIDEO_OPENGL_CGL
+ Cocoa_GLES_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
+ _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
+ _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary;
+ _this->GL_CreateContext = Cocoa_GL_CreateContext;
+ _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent;
+ _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval;
+ _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
+ _this->GL_SwapWindow = Cocoa_GL_SwapWindow;
+ _this->GL_DeleteContext = Cocoa_GL_DeleteContext;
+ return Cocoa_GL_LoadLibrary(_this, path);
+#else
+ return SDL_SetError("SDL not configured with OpenGL/CGL support");
+#endif
+ }
+
+ if (_this->egl_data == NULL) {
+ return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0);
+ }
+
+ return 0;
+}
+
+SDL_GLContext
+Cocoa_GLES_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_GLContext context;
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+
+#if SDL_VIDEO_OPENGL_CGL
+ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
+ /* Switch to CGL based functions */
+ Cocoa_GLES_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
+ _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
+ _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary;
+ _this->GL_CreateContext = Cocoa_GL_CreateContext;
+ _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent;
+ _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval;
+ _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
+ _this->GL_SwapWindow = Cocoa_GL_SwapWindow;
+ _this->GL_DeleteContext = Cocoa_GL_DeleteContext;
+
+ if (Cocoa_GL_LoadLibrary(_this, NULL) != 0) {
+ return NULL;
+ }
+
+ return Cocoa_GL_CreateContext(_this, window);
+ }
+#endif
+
+ context = SDL_EGL_CreateContext(_this, data->egl_surface);
+ return context;
+}
+
+void
+Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context)
+{
+ SDL_EGL_DeleteContext(_this, context);
+ Cocoa_GLES_UnloadLibrary(_this);
+}
+
+SDL_EGL_SwapWindow_impl(Cocoa)
+SDL_EGL_MakeCurrent_impl(Cocoa)
+
+int
+Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window)
+{
+ /* The current context is lost in here; save it and reset it. */
+ SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
+ SDL_Window *current_win = SDL_GL_GetCurrentWindow();
+ SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
+
+
+ if (_this->egl_data == NULL) {
+ if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) {
+ SDL_EGL_UnloadLibrary(_this);
+ return -1;
+ }
+ }
+
+ /* Create the GLES window surface */
+ NSView* v = windowdata->nswindow.contentView;
+ windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)[v layer]);
+
+ if (windowdata->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("Could not create GLES window surface");
+ }
+
+ return Cocoa_GLES_MakeCurrent(_this, current_win, current_ctx);
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.h
new file mode 100644
index 0000000..da1b5eb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.h
@@ -0,0 +1,45 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoashape_h_
+#define SDL_cocoashape_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_video.h"
+#include "SDL_shape.h"
+#include "../SDL_shape_internals.h"
+
+typedef struct {
+ NSGraphicsContext* context;
+ SDL_bool saved;
+
+ SDL_ShapeTree* shape;
+} SDL_ShapeData;
+
+extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window);
+extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
+extern int Cocoa_ResizeWindowShape(SDL_Window *window);
+
+#endif /* SDL_cocoashape_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.m
new file mode 100644
index 0000000..7a2f04f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoashape.m
@@ -0,0 +1,113 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_cocoavideo.h"
+#include "SDL_shape.h"
+#include "SDL_cocoashape.h"
+#include "../SDL_sysvideo.h"
+#include "SDL_assert.h"
+
+SDL_WindowShaper*
+Cocoa_CreateShaper(SDL_Window* window)
+{
+ SDL_WindowData* windata = (SDL_WindowData*)window->driverdata;
+ [windata->nswindow setOpaque:NO];
+
+ [windata->nswindow setStyleMask:NSWindowStyleMaskBorderless];
+
+ SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper));
+ result->window = window;
+ result->mode.mode = ShapeModeDefault;
+ result->mode.parameters.binarizationCutoff = 1;
+ result->userx = result->usery = 0;
+ window->shaper = result;
+
+ SDL_ShapeData* data = malloc(sizeof(SDL_ShapeData));
+ result->driverdata = data;
+ data->context = [windata->nswindow graphicsContext];
+ data->saved = SDL_FALSE;
+ data->shape = NULL;
+
+ int resized_properly = Cocoa_ResizeWindowShape(window);
+ SDL_assert(resized_properly == 0);
+ return result;
+}
+
+typedef struct {
+ NSView* view;
+ NSBezierPath* path;
+ SDL_Window* window;
+} SDL_CocoaClosure;
+
+void
+ConvertRects(SDL_ShapeTree* tree, void* closure)
+{
+ SDL_CocoaClosure* data = (SDL_CocoaClosure*)closure;
+ if(tree->kind == OpaqueShape) {
+ NSRect rect = NSMakeRect(tree->data.shape.x,data->window->h - tree->data.shape.y,tree->data.shape.w,tree->data.shape.h);
+ [data->path appendBezierPathWithRect:[data->view convertRect:rect toView:nil]];
+ }
+}
+
+int
+Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
+{ @autoreleasepool
+{
+ SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
+ SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
+ SDL_CocoaClosure closure;
+ if(data->saved == SDL_TRUE) {
+ [data->context restoreGraphicsState];
+ data->saved = SDL_FALSE;
+ }
+
+ /*[data->context saveGraphicsState];*/
+ /*data->saved = SDL_TRUE;*/
+ [NSGraphicsContext setCurrentContext:data->context];
+
+ [[NSColor clearColor] set];
+ NSRectFill([[windata->nswindow contentView] frame]);
+ data->shape = SDL_CalculateShapeTree(*shape_mode,shape);
+
+ closure.view = [windata->nswindow contentView];
+ closure.path = [NSBezierPath bezierPath];
+ closure.window = shaper->window;
+ SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
+ [closure.path addClip];
+
+ return 0;
+}}
+
+int
+Cocoa_ResizeWindowShape(SDL_Window *window)
+{
+ SDL_ShapeData* data = window->shaper->driverdata;
+ SDL_assert(data != NULL);
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.h
new file mode 100644
index 0000000..05bbd34
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.h
@@ -0,0 +1,118 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoavideo_h_
+#define SDL_cocoavideo_h_
+
+#include "SDL_opengl.h"
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <IOKit/pwr_mgt/IOPMLib.h>
+#include <Cocoa/Cocoa.h>
+
+#include "SDL_keycode.h"
+#include "../SDL_sysvideo.h"
+
+#include "SDL_cocoaclipboard.h"
+#include "SDL_cocoaevents.h"
+#include "SDL_cocoakeyboard.h"
+#include "SDL_cocoamodes.h"
+#include "SDL_cocoamouse.h"
+#include "SDL_cocoaopengl.h"
+#include "SDL_cocoawindow.h"
+
+#ifndef MAC_OS_X_VERSION_10_12
+#define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name
+DECLARE_EVENT(LeftMouseDown);
+DECLARE_EVENT(LeftMouseUp);
+DECLARE_EVENT(RightMouseDown);
+DECLARE_EVENT(RightMouseUp);
+DECLARE_EVENT(OtherMouseDown);
+DECLARE_EVENT(OtherMouseUp);
+DECLARE_EVENT(MouseMoved);
+DECLARE_EVENT(LeftMouseDragged);
+DECLARE_EVENT(RightMouseDragged);
+DECLARE_EVENT(OtherMouseDragged);
+DECLARE_EVENT(ScrollWheel);
+DECLARE_EVENT(KeyDown);
+DECLARE_EVENT(KeyUp);
+DECLARE_EVENT(FlagsChanged);
+#undef DECLARE_EVENT
+
+static const NSEventMask NSEventMaskAny = NSAnyEventMask;
+
+#define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask
+DECLARE_MODIFIER_FLAG(Shift);
+DECLARE_MODIFIER_FLAG(Control);
+DECLARE_MODIFIER_FLAG(Command);
+DECLARE_MODIFIER_FLAG(NumericPad);
+DECLARE_MODIFIER_FLAG(Help);
+DECLARE_MODIFIER_FLAG(Function);
+#undef DECLARE_MODIFIER_FLAG
+static const NSUInteger NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask;
+static const NSUInteger NSEventModifierFlagOption = NSAlternateKeyMask;
+
+#define DECLARE_WINDOW_MASK(name) static const unsigned int NSWindowStyleMask##name = NS##name##WindowMask
+DECLARE_WINDOW_MASK(Borderless);
+DECLARE_WINDOW_MASK(Titled);
+DECLARE_WINDOW_MASK(Closable);
+DECLARE_WINDOW_MASK(Miniaturizable);
+DECLARE_WINDOW_MASK(Resizable);
+DECLARE_WINDOW_MASK(TexturedBackground);
+DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar);
+DECLARE_WINDOW_MASK(FullScreen);
+/*DECLARE_WINDOW_MASK(FullSizeContentView);*/ /* Not used, fails compile on older SDKs */
+static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask;
+static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask;
+static const unsigned int NSWindowStyleMaskHUDWindow = NSHUDWindowMask;
+#undef DECLARE_WINDOW_MASK
+
+#define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle
+DECLARE_ALERT_STYLE(Warning);
+DECLARE_ALERT_STYLE(Informational);
+DECLARE_ALERT_STYLE(Critical);
+#undef DECLARE_ALERT_STYLE
+#endif
+
+/* Private display data */
+
+@class SDLTranslatorResponder;
+
+typedef struct SDL_VideoData
+{
+ int allow_spaces;
+ unsigned int modifierFlags;
+ void *key_layout;
+ SDLTranslatorResponder *fieldEdit;
+ NSInteger clipboard_count;
+ Uint32 screensaver_activity;
+ BOOL screensaver_use_iopm;
+ IOPMAssertionID screensaver_assertion;
+
+} SDL_VideoData;
+
+/* Utility functions */
+extern NSImage * Cocoa_CreateImage(SDL_Surface * surface);
+
+#endif /* SDL_cocoavideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.m
new file mode 100644
index 0000000..545dc1e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavideo.m
@@ -0,0 +1,253 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL.h"
+#include "SDL_endian.h"
+#include "SDL_cocoavideo.h"
+#include "SDL_cocoashape.h"
+#include "SDL_cocoavulkan.h"
+#include "SDL_assert.h"
+
+/* Initialization/Query functions */
+static int Cocoa_VideoInit(_THIS);
+static void Cocoa_VideoQuit(_THIS);
+
+/* Cocoa driver bootstrap functions */
+
+static int
+Cocoa_Available(void)
+{
+ return (1);
+}
+
+static void
+Cocoa_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_free(device->driverdata);
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+Cocoa_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+
+ Cocoa_RegisterApp();
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device) {
+ data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ } else {
+ data = NULL;
+ }
+ if (!data) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+ device->driverdata = data;
+
+ /* Set the function pointers */
+ device->VideoInit = Cocoa_VideoInit;
+ device->VideoQuit = Cocoa_VideoQuit;
+ device->GetDisplayBounds = Cocoa_GetDisplayBounds;
+ device->GetDisplayUsableBounds = Cocoa_GetDisplayUsableBounds;
+ device->GetDisplayDPI = Cocoa_GetDisplayDPI;
+ device->GetDisplayModes = Cocoa_GetDisplayModes;
+ device->SetDisplayMode = Cocoa_SetDisplayMode;
+ device->PumpEvents = Cocoa_PumpEvents;
+ device->SuspendScreenSaver = Cocoa_SuspendScreenSaver;
+
+ device->CreateSDLWindow = Cocoa_CreateWindow;
+ device->CreateSDLWindowFrom = Cocoa_CreateWindowFrom;
+ device->SetWindowTitle = Cocoa_SetWindowTitle;
+ device->SetWindowIcon = Cocoa_SetWindowIcon;
+ device->SetWindowPosition = Cocoa_SetWindowPosition;
+ device->SetWindowSize = Cocoa_SetWindowSize;
+ device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize;
+ device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize;
+ device->SetWindowOpacity = Cocoa_SetWindowOpacity;
+ device->ShowWindow = Cocoa_ShowWindow;
+ device->HideWindow = Cocoa_HideWindow;
+ device->RaiseWindow = Cocoa_RaiseWindow;
+ device->MaximizeWindow = Cocoa_MaximizeWindow;
+ device->MinimizeWindow = Cocoa_MinimizeWindow;
+ device->RestoreWindow = Cocoa_RestoreWindow;
+ device->SetWindowBordered = Cocoa_SetWindowBordered;
+ device->SetWindowResizable = Cocoa_SetWindowResizable;
+ device->SetWindowFullscreen = Cocoa_SetWindowFullscreen;
+ device->SetWindowGammaRamp = Cocoa_SetWindowGammaRamp;
+ device->GetWindowGammaRamp = Cocoa_GetWindowGammaRamp;
+ device->SetWindowGrab = Cocoa_SetWindowGrab;
+ device->DestroyWindow = Cocoa_DestroyWindow;
+ device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
+ device->SetWindowHitTest = Cocoa_SetWindowHitTest;
+
+ device->shape_driver.CreateShaper = Cocoa_CreateShaper;
+ device->shape_driver.SetWindowShape = Cocoa_SetWindowShape;
+ device->shape_driver.ResizeWindowShape = Cocoa_ResizeWindowShape;
+
+#if SDL_VIDEO_OPENGL_CGL
+ device->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
+ device->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
+ device->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary;
+ device->GL_CreateContext = Cocoa_GL_CreateContext;
+ device->GL_MakeCurrent = Cocoa_GL_MakeCurrent;
+ device->GL_GetDrawableSize = Cocoa_GL_GetDrawableSize;
+ device->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
+ device->GL_SwapWindow = Cocoa_GL_SwapWindow;
+ device->GL_DeleteContext = Cocoa_GL_DeleteContext;
+#elif SDL_VIDEO_OPENGL_EGL
+ device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary;
+ device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary;
+ device->GL_CreateContext = Cocoa_GLES_CreateContext;
+ device->GL_MakeCurrent = Cocoa_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
+ device->GL_SwapWindow = Cocoa_GLES_SwapWindow;
+ device->GL_DeleteContext = Cocoa_GLES_DeleteContext;
+#endif
+
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = Cocoa_Vulkan_CreateSurface;
+ device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize;
+#endif
+
+ device->StartTextInput = Cocoa_StartTextInput;
+ device->StopTextInput = Cocoa_StopTextInput;
+ device->SetTextInputRect = Cocoa_SetTextInputRect;
+
+ device->SetClipboardText = Cocoa_SetClipboardText;
+ device->GetClipboardText = Cocoa_GetClipboardText;
+ device->HasClipboardText = Cocoa_HasClipboardText;
+
+ device->free = Cocoa_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap COCOA_bootstrap = {
+ "cocoa", "SDL Cocoa video driver",
+ Cocoa_Available, Cocoa_CreateDevice
+};
+
+
+int
+Cocoa_VideoInit(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ Cocoa_InitModes(_this);
+ Cocoa_InitKeyboard(_this);
+ Cocoa_InitMouse(_this);
+
+ data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE));
+
+ /* The IOPM assertion API can disable the screensaver as of 10.7. */
+ data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
+
+ return 0;
+}
+
+void
+Cocoa_VideoQuit(_THIS)
+{
+ Cocoa_QuitModes(_this);
+ Cocoa_QuitKeyboard(_this);
+ Cocoa_QuitMouse(_this);
+}
+
+/* This function assumes that it's called from within an autorelease pool */
+NSImage *
+Cocoa_CreateImage(SDL_Surface * surface)
+{
+ SDL_Surface *converted;
+ NSBitmapImageRep *imgrep;
+ Uint8 *pixels;
+ int i;
+ NSImage *img;
+
+ converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA32, 0);
+ if (!converted) {
+ return nil;
+ }
+
+ imgrep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL
+ pixelsWide: converted->w
+ pixelsHigh: converted->h
+ bitsPerSample: 8
+ samplesPerPixel: 4
+ hasAlpha: YES
+ isPlanar: NO
+ colorSpaceName: NSDeviceRGBColorSpace
+ bytesPerRow: converted->pitch
+ bitsPerPixel: converted->format->BitsPerPixel] autorelease];
+ if (imgrep == nil) {
+ SDL_FreeSurface(converted);
+ return nil;
+ }
+
+ /* Copy the pixels */
+ pixels = [imgrep bitmapData];
+ SDL_memcpy(pixels, converted->pixels, converted->h * converted->pitch);
+ SDL_FreeSurface(converted);
+
+ /* Premultiply the alpha channel */
+ for (i = (surface->h * surface->w); i--; ) {
+ Uint8 alpha = pixels[3];
+ pixels[0] = (Uint8)(((Uint16)pixels[0] * alpha) / 255);
+ pixels[1] = (Uint8)(((Uint16)pixels[1] * alpha) / 255);
+ pixels[2] = (Uint8)(((Uint16)pixels[2] * alpha) / 255);
+ pixels += 4;
+ }
+
+ img = [[[NSImage alloc] initWithSize: NSMakeSize(surface->w, surface->h)] autorelease];
+ if (img != nil) {
+ [img addRepresentation: imgrep];
+ }
+ return img;
+}
+
+/*
+ * Mac OS X log support.
+ *
+ * This doesn't really have aything to do with the interfaces of the SDL video
+ * subsystem, but we need to stuff this into an Objective-C source code file.
+ */
+
+void SDL_NSLog(const char *text)
+{
+ NSLog(@"%s", text);
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.h
new file mode 100644
index 0000000..a49c148
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.h
@@ -0,0 +1,55 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.h.
+ */
+
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoavulkan_h_
+#define SDL_cocoavulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA
+
+int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path);
+void Cocoa_Vulkan_UnloadLibrary(_THIS);
+SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool Cocoa_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
+
+#endif
+
+#endif /* SDL_cocoavulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.m
new file mode 100644
index 0000000..2cf55bb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoavulkan.m
@@ -0,0 +1,231 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.c.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA
+
+#include "SDL_cocoavideo.h"
+#include "SDL_cocoawindow.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_cocoametalview.h"
+#include "SDL_cocoavulkan.h"
+#include "SDL_syswm.h"
+
+#include <dlfcn.h>
+
+const char* defaultPaths[] = {
+ "vulkan.framework/vulkan",
+ "libvulkan.1.dylib",
+ "MoltenVK.framework/MoltenVK",
+ "libMoltenVK.dylib"
+};
+
+/* Since libSDL is most likely a .dylib, need RTLD_DEFAULT not RTLD_SELF. */
+#define DEFAULT_HANDLE RTLD_DEFAULT
+
+int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ VkExtensionProperties *extensions = NULL;
+ Uint32 extensionCount = 0;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasMacOSSurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+
+ if (_this->vulkan_config.loader_handle) {
+ SDL_SetError("Vulkan/MoltenVK already loaded");
+ return -1;
+ }
+
+ /* Load the Vulkan loader library */
+ if (!path) {
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ }
+
+ if (!path) {
+ /* MoltenVK framework, currently, v0.17.0, has a static library and is
+ * the recommended way to use the package. There is likely no object to
+ * load. */
+ vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE,
+ "vkGetInstanceProcAddr");
+ }
+
+ if (vkGetInstanceProcAddr) {
+ _this->vulkan_config.loader_handle = DEFAULT_HANDLE;
+ } else {
+ const char** paths;
+ int numPaths;
+ int i;
+
+ if (path) {
+ paths = &path;
+ numPaths = 1;
+ } else {
+ /* Look for framework or .dylib packaged with the application
+ * instead. */
+ paths = defaultPaths;
+ numPaths = SDL_arraysize(defaultPaths);
+ }
+
+ for (i=0; i < numPaths; i++) {
+ _this->vulkan_config.loader_handle = SDL_LoadObject(paths[i]);
+ if (_this->vulkan_config.loader_handle)
+ break;
+ else
+ continue;
+ }
+ if (i == numPaths)
+ return -1;
+
+ SDL_strlcpy(_this->vulkan_config.loader_path, paths[i],
+ SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ }
+
+ if (!vkGetInstanceProcAddr) {
+ SDL_SetError("Failed to find %s in either executable or %s: %s",
+ "vkGetInstanceProcAddr",
+ _this->vulkan_config.loader_path,
+ (const char *) dlerror());
+ goto fail;
+ }
+
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
+ goto fail;
+ }
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+ if (!extensions) {
+ goto fail;
+ }
+ for (Uint32 i = 0; i < extensionCount; i++) {
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
+ hasSurfaceExtension = SDL_TRUE;
+ } else if (SDL_strcmp(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
+ hasMacOSSurfaceExtension = SDL_TRUE;
+ }
+ }
+ SDL_free(extensions);
+ if (!hasSurfaceExtension) {
+ SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ } else if (!hasMacOSSurfaceExtension) {
+ SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the "
+ VK_MVK_MACOS_SURFACE_EXTENSION_NAME "extension");
+ goto fail;
+ }
+ return 0;
+
+fail:
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void Cocoa_Vulkan_UnloadLibrary(_THIS)
+{
+ if (_this->vulkan_config.loader_handle) {
+ if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) {
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ }
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ static const char *const extensionsForCocoa[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_EXTENSION_NAME
+ };
+ if (!_this->vulkan_config.loader_handle) {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForCocoa),
+ extensionsForCocoa);
+}
+
+SDL_bool Cocoa_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK =
+ (PFN_vkCreateMacOSSurfaceMVK)vkGetInstanceProcAddr(
+ (VkInstance)instance,
+ "vkCreateMacOSSurfaceMVK");
+ VkMacOSSurfaceCreateInfoMVK createInfo = {};
+ VkResult result;
+
+ if (!_this->vulkan_config.loader_handle) {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ if (!vkCreateMacOSSurfaceMVK) {
+ SDL_SetError(VK_MVK_MACOS_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.pView = Cocoa_Mtl_AddMetalView(window);
+ result = vkCreateMacOSSurfaceMVK(instance, &createInfo,
+ NULL, surface);
+ if (result != VK_SUCCESS) {
+ SDL_SetError("vkCreateMacOSSurfaceMVK failed: %s",
+ SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
+{
+ Cocoa_Mtl_GetDrawableSize(window, w, h);
+}
+
+#endif
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.h b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.h
new file mode 100644
index 0000000..df6f173
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.h
@@ -0,0 +1,154 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_cocoawindow_h_
+#define SDL_cocoawindow_h_
+
+#import <Cocoa/Cocoa.h>
+
+#if SDL_VIDEO_OPENGL_EGL
+#include "../SDL_egl_c.h"
+#endif
+
+typedef struct SDL_WindowData SDL_WindowData;
+
+typedef enum
+{
+ PENDING_OPERATION_NONE,
+ PENDING_OPERATION_ENTER_FULLSCREEN,
+ PENDING_OPERATION_LEAVE_FULLSCREEN,
+ PENDING_OPERATION_MINIMIZE
+} PendingWindowOperation;
+
+@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
+ SDL_WindowData *_data;
+ BOOL observingVisible;
+ BOOL wasCtrlLeft;
+ BOOL wasVisible;
+ BOOL isFullscreenSpace;
+ BOOL inFullscreenTransition;
+ PendingWindowOperation pendingWindowOperation;
+ BOOL isMoving;
+ int pendingWindowWarpX, pendingWindowWarpY;
+ BOOL isDragAreaRunning;
+}
+
+-(void) listen:(SDL_WindowData *) data;
+-(void) pauseVisibleObservation;
+-(void) resumeVisibleObservation;
+-(BOOL) setFullscreenSpace:(BOOL) state;
+-(BOOL) isInFullscreenSpace;
+-(BOOL) isInFullscreenSpaceTransition;
+-(void) addPendingWindowOperation:(PendingWindowOperation) operation;
+-(void) close;
+
+-(BOOL) isMoving;
+-(void) setPendingMoveX:(int)x Y:(int)y;
+-(void) windowDidFinishMoving;
+
+/* Window delegate functionality */
+-(BOOL) windowShouldClose:(id) sender;
+-(void) windowDidExpose:(NSNotification *) aNotification;
+-(void) windowDidMove:(NSNotification *) aNotification;
+-(void) windowDidResize:(NSNotification *) aNotification;
+-(void) windowDidMiniaturize:(NSNotification *) aNotification;
+-(void) windowDidDeminiaturize:(NSNotification *) aNotification;
+-(void) windowDidBecomeKey:(NSNotification *) aNotification;
+-(void) windowDidResignKey:(NSNotification *) aNotification;
+-(void) windowDidChangeBackingProperties:(NSNotification *) aNotification;
+-(void) windowWillEnterFullScreen:(NSNotification *) aNotification;
+-(void) windowDidEnterFullScreen:(NSNotification *) aNotification;
+-(void) windowWillExitFullScreen:(NSNotification *) aNotification;
+-(void) windowDidExitFullScreen:(NSNotification *) aNotification;
+-(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
+
+/* See if event is in a drag area, toggle on window dragging. */
+-(BOOL) processHitTest:(NSEvent *)theEvent;
+
+/* Window event handling */
+-(void) mouseDown:(NSEvent *) theEvent;
+-(void) rightMouseDown:(NSEvent *) theEvent;
+-(void) otherMouseDown:(NSEvent *) theEvent;
+-(void) mouseUp:(NSEvent *) theEvent;
+-(void) rightMouseUp:(NSEvent *) theEvent;
+-(void) otherMouseUp:(NSEvent *) theEvent;
+-(void) mouseMoved:(NSEvent *) theEvent;
+-(void) mouseDragged:(NSEvent *) theEvent;
+-(void) rightMouseDragged:(NSEvent *) theEvent;
+-(void) otherMouseDragged:(NSEvent *) theEvent;
+-(void) scrollWheel:(NSEvent *) theEvent;
+-(void) touchesBeganWithEvent:(NSEvent *) theEvent;
+-(void) touchesMovedWithEvent:(NSEvent *) theEvent;
+-(void) touchesEndedWithEvent:(NSEvent *) theEvent;
+-(void) touchesCancelledWithEvent:(NSEvent *) theEvent;
+
+/* Touch event handling */
+-(void) handleTouches:(NSTouchPhase) phase withEvent:(NSEvent*) theEvent;
+
+@end
+/* *INDENT-ON* */
+
+@class SDLOpenGLContext;
+
+struct SDL_WindowData
+{
+ SDL_Window *window;
+ NSWindow *nswindow;
+ NSMutableArray *nscontexts;
+ SDL_bool created;
+ SDL_bool inWindowMove;
+ Cocoa_WindowListener *listener;
+ struct SDL_VideoData *videodata;
+#if SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+};
+
+extern int Cocoa_CreateWindow(_THIS, SDL_Window * window);
+extern int Cocoa_CreateWindowFrom(_THIS, SDL_Window * window,
+ const void *data);
+extern void Cocoa_SetWindowTitle(_THIS, SDL_Window * window);
+extern void Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window);
+extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window);
+extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window);
+extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window);
+extern int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
+extern void Cocoa_ShowWindow(_THIS, SDL_Window * window);
+extern void Cocoa_HideWindow(_THIS, SDL_Window * window);
+extern void Cocoa_RaiseWindow(_THIS, SDL_Window * window);
+extern void Cocoa_MaximizeWindow(_THIS, SDL_Window * window);
+extern void Cocoa_MinimizeWindow(_THIS, SDL_Window * window);
+extern void Cocoa_RestoreWindow(_THIS, SDL_Window * window);
+extern void Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
+extern void Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable);
+extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+extern int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
+extern int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
+extern void Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info);
+extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
+
+#endif /* SDL_cocoawindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.m b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.m
new file mode 100644
index 0000000..b1a5b46
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/cocoa/SDL_cocoawindow.m
@@ -0,0 +1,1877 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+# error SDL for Mac OS X must be built with a 10.7 SDK or above.
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */
+
+#include "SDL_syswm.h"
+#include "SDL_timer.h" /* For SDL_GetTicks() */
+#include "SDL_hints.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+#include "../../events/SDL_windowevents_c.h"
+#include "../../events/SDL_dropevents_c.h"
+#include "SDL_cocoavideo.h"
+#include "SDL_cocoashape.h"
+#include "SDL_cocoamouse.h"
+#include "SDL_cocoamousetap.h"
+#include "SDL_cocoaopengl.h"
+#include "SDL_cocoaopengles.h"
+#include "SDL_assert.h"
+
+/* #define DEBUG_COCOAWINDOW */
+
+#ifdef DEBUG_COCOAWINDOW
+#define DLog(fmt, ...) printf("%s: " fmt "\n", __func__, ##__VA_ARGS__)
+#else
+#define DLog(...) do { } while (0)
+#endif
+
+
+#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
+
+
+@interface SDLWindow : NSWindow <NSDraggingDestination>
+/* These are needed for borderless/fullscreen windows */
+- (BOOL)canBecomeKeyWindow;
+- (BOOL)canBecomeMainWindow;
+- (void)sendEvent:(NSEvent *)event;
+- (void)doCommandBySelector:(SEL)aSelector;
+
+/* Handle drag-and-drop of files onto the SDL window. */
+- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
+- (BOOL)wantsPeriodicDraggingUpdates;
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem;
+
+- (SDL_Window*)findSDLWindow;
+@end
+
+@implementation SDLWindow
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ /* Only allow using the macOS native fullscreen toggle menubar item if the
+ * window is resizable and not in a SDL fullscreen mode.
+ */
+ if ([menuItem action] == @selector(toggleFullScreen:)) {
+ SDL_Window *window = [self findSDLWindow];
+ if (window == NULL) {
+ return NO;
+ } else if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) {
+ return NO;
+ } else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) {
+ return NO;
+ }
+ }
+ return [super validateMenuItem:menuItem];
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
+- (BOOL)canBecomeMainWindow
+{
+ return YES;
+}
+
+- (void)sendEvent:(NSEvent *)event
+{
+ [super sendEvent:event];
+
+ if ([event type] != NSEventTypeLeftMouseUp) {
+ return;
+ }
+
+ id delegate = [self delegate];
+ if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) {
+ return;
+ }
+
+ if ([delegate isMoving]) {
+ [delegate windowDidFinishMoving];
+ }
+}
+
+/* We'll respond to selectors by doing nothing so we don't beep.
+ * The escape key gets converted to a "cancel" selector, etc.
+ */
+- (void)doCommandBySelector:(SEL)aSelector
+{
+ /*NSLog(@"doCommandBySelector: %@\n", NSStringFromSelector(aSelector));*/
+}
+
+- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+{
+ if (([sender draggingSourceOperationMask] & NSDragOperationGeneric) == NSDragOperationGeneric) {
+ return NSDragOperationGeneric;
+ }
+
+ return NSDragOperationNone; /* no idea what to do with this, reject it. */
+}
+
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
+{ @autoreleasepool
+{
+ NSPasteboard *pasteboard = [sender draggingPasteboard];
+ NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType];
+ NSString *desiredType = [pasteboard availableTypeFromArray:types];
+ SDL_Window *sdlwindow = [self findSDLWindow];
+
+ if (desiredType == nil) {
+ return NO; /* can't accept anything that's being dropped here. */
+ }
+
+ NSData *data = [pasteboard dataForType:desiredType];
+ if (data == nil) {
+ return NO;
+ }
+
+ SDL_assert([desiredType isEqualToString:NSFilenamesPboardType]);
+ NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"];
+
+ for (NSString *path in array) {
+ NSURL *fileURL = [NSURL fileURLWithPath:path];
+ NSNumber *isAlias = nil;
+
+ [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil];
+
+ /* If the URL is an alias, resolve it. */
+ if ([isAlias boolValue]) {
+ NSURLBookmarkResolutionOptions opts = NSURLBookmarkResolutionWithoutMounting | NSURLBookmarkResolutionWithoutUI;
+ NSData *bookmark = [NSURL bookmarkDataWithContentsOfURL:fileURL error:nil];
+ if (bookmark != nil) {
+ NSURL *resolvedURL = [NSURL URLByResolvingBookmarkData:bookmark
+ options:opts
+ relativeToURL:nil
+ bookmarkDataIsStale:nil
+ error:nil];
+
+ if (resolvedURL != nil) {
+ fileURL = resolvedURL;
+ }
+ }
+ }
+
+ if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) {
+ return NO;
+ }
+ }
+
+ SDL_SendDropComplete(sdlwindow);
+ return YES;
+}}
+
+- (BOOL)wantsPeriodicDraggingUpdates
+{
+ return NO;
+}
+
+- (SDL_Window*)findSDLWindow
+{
+ SDL_Window *sdlwindow = NULL;
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ /* !!! FIXME: is there a better way to do this? */
+ if (_this) {
+ for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) {
+ NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow;
+ if (nswindow == self) {
+ break;
+ }
+ }
+ }
+
+ return sdlwindow;
+}
+
+@end
+
+
+static Uint32 s_moveHack;
+
+static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
+{
+ r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
+}
+
+static void
+ScheduleContextUpdates(SDL_WindowData *data)
+{
+ NSOpenGLContext *currentContext = [NSOpenGLContext currentContext];
+ NSMutableArray *contexts = data->nscontexts;
+ @synchronized (contexts) {
+ for (SDLOpenGLContext *context in contexts) {
+ if (context == currentContext) {
+ [context update];
+ } else {
+ [context scheduleUpdate];
+ }
+ }
+ }
+}
+
+/* !!! FIXME: this should use a hint callback. */
+static int
+GetHintCtrlClickEmulateRightClick()
+{
+ return SDL_GetHintBoolean(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, SDL_FALSE);
+}
+
+static NSUInteger
+GetWindowStyle(SDL_Window * window)
+{
+ NSUInteger style = 0;
+
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ style = NSWindowStyleMaskBorderless;
+ } else {
+ if (window->flags & SDL_WINDOW_BORDERLESS) {
+ style = NSWindowStyleMaskBorderless;
+ } else {
+ style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable);
+ }
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ style |= NSWindowStyleMaskResizable;
+ }
+ }
+ return style;
+}
+
+static SDL_bool
+SetWindowStyle(SDL_Window * window, NSUInteger style)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = data->nswindow;
+
+ /* The view responder chain gets messed with during setStyleMask */
+ if ([[nswindow contentView] nextResponder] == data->listener) {
+ [[nswindow contentView] setNextResponder:nil];
+ }
+
+ [nswindow setStyleMask:style];
+
+ /* The view responder chain gets messed with during setStyleMask */
+ if ([[nswindow contentView] nextResponder] != data->listener) {
+ [[nswindow contentView] setNextResponder:data->listener];
+ }
+
+ return SDL_TRUE;
+}
+
+
+@implementation Cocoa_WindowListener
+
+- (void)listen:(SDL_WindowData *)data
+{
+ NSNotificationCenter *center;
+ NSWindow *window = data->nswindow;
+ NSView *view = [window contentView];
+
+ _data = data;
+ observingVisible = YES;
+ wasCtrlLeft = NO;
+ wasVisible = [window isVisible];
+ isFullscreenSpace = NO;
+ inFullscreenTransition = NO;
+ pendingWindowOperation = PENDING_OPERATION_NONE;
+ isMoving = NO;
+ isDragAreaRunning = NO;
+
+ center = [NSNotificationCenter defaultCenter];
+
+ if ([window delegate] != nil) {
+ [center addObserver:self selector:@selector(windowDidExpose:) name:NSWindowDidExposeNotification object:window];
+ [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:window];
+ [center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:window];
+ [center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:window];
+ [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window];
+ [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window];
+ [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window];
+ [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window];
+ [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window];
+ [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window];
+ [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window];
+ [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
+ [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window];
+ [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window];
+ } else {
+ [window setDelegate:self];
+ }
+
+ /* Haven't found a delegate / notification that triggers when the window is
+ * ordered out (is not visible any more). You can be ordered out without
+ * minimizing, so DidMiniaturize doesn't work. (e.g. -[NSWindow orderOut:])
+ */
+ [window addObserver:self
+ forKeyPath:@"visible"
+ options:NSKeyValueObservingOptionNew
+ context:NULL];
+
+ [window setNextResponder:self];
+ [window setAcceptsMouseMovedEvents:YES];
+
+ [view setNextResponder:self];
+
+ [view setAcceptsTouchEvents:YES];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)object
+ change:(NSDictionary *)change
+ context:(void *)context
+{
+ if (!observingVisible) {
+ return;
+ }
+
+ if (object == _data->nswindow && [keyPath isEqualToString:@"visible"]) {
+ int newVisibility = [[change objectForKey:@"new"] intValue];
+ if (newVisibility) {
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ } else {
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+ }
+ }
+}
+
+-(void) pauseVisibleObservation
+{
+ observingVisible = NO;
+ wasVisible = [_data->nswindow isVisible];
+}
+
+-(void) resumeVisibleObservation
+{
+ BOOL isVisible = [_data->nswindow isVisible];
+ observingVisible = YES;
+ if (wasVisible != isVisible) {
+ if (isVisible) {
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ } else {
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+ }
+
+ wasVisible = isVisible;
+ }
+}
+
+-(BOOL) setFullscreenSpace:(BOOL) state
+{
+ SDL_Window *window = _data->window;
+ NSWindow *nswindow = _data->nswindow;
+ SDL_VideoData *videodata = ((SDL_WindowData *) window->driverdata)->videodata;
+
+ if (!videodata->allow_spaces) {
+ return NO; /* Spaces are forcibly disabled. */
+ } else if (state && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) {
+ return NO; /* we only allow you to make a Space on FULLSCREEN_DESKTOP windows. */
+ } else if (!state && ((window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) {
+ return NO; /* we only handle leaving the Space on windows that were previously FULLSCREEN_DESKTOP. */
+ } else if (state == isFullscreenSpace) {
+ return YES; /* already there. */
+ }
+
+ if (inFullscreenTransition) {
+ if (state) {
+ [self addPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN];
+ } else {
+ [self addPendingWindowOperation:PENDING_OPERATION_LEAVE_FULLSCREEN];
+ }
+ return YES;
+ }
+ inFullscreenTransition = YES;
+
+ /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */
+ [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+ [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO];
+ return YES;
+}
+
+-(BOOL) isInFullscreenSpace
+{
+ return isFullscreenSpace;
+}
+
+-(BOOL) isInFullscreenSpaceTransition
+{
+ return inFullscreenTransition;
+}
+
+-(void) addPendingWindowOperation:(PendingWindowOperation) operation
+{
+ pendingWindowOperation = operation;
+}
+
+- (void)close
+{
+ NSNotificationCenter *center;
+ NSWindow *window = _data->nswindow;
+ NSView *view = [window contentView];
+
+ center = [NSNotificationCenter defaultCenter];
+
+ if ([window delegate] != self) {
+ [center removeObserver:self name:NSWindowDidExposeNotification object:window];
+ [center removeObserver:self name:NSWindowDidMoveNotification object:window];
+ [center removeObserver:self name:NSWindowDidResizeNotification object:window];
+ [center removeObserver:self name:NSWindowDidMiniaturizeNotification object:window];
+ [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
+ [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window];
+ [center removeObserver:self name:NSWindowDidResignKeyNotification object:window];
+ [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window];
+ [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window];
+ [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window];
+ [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window];
+ [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
+ [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window];
+ [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window];
+ } else {
+ [window setDelegate:nil];
+ }
+
+ [window removeObserver:self forKeyPath:@"visible"];
+
+ if ([window nextResponder] == self) {
+ [window setNextResponder:nil];
+ }
+ if ([view nextResponder] == self) {
+ [view setNextResponder:nil];
+ }
+}
+
+- (BOOL)isMoving
+{
+ return isMoving;
+}
+
+-(void) setPendingMoveX:(int)x Y:(int)y
+{
+ pendingWindowWarpX = x;
+ pendingWindowWarpY = y;
+}
+
+- (void)windowDidFinishMoving
+{
+ if ([self isMoving]) {
+ isMoving = NO;
+
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (pendingWindowWarpX != INT_MAX && pendingWindowWarpY != INT_MAX) {
+ mouse->WarpMouseGlobal(pendingWindowWarpX, pendingWindowWarpY);
+ pendingWindowWarpX = pendingWindowWarpY = INT_MAX;
+ }
+ if (mouse->relative_mode && !mouse->relative_mode_warp && mouse->focus == _data->window) {
+ mouse->SetRelativeMouseMode(SDL_TRUE);
+ }
+ }
+}
+
+- (BOOL)windowShouldClose:(id)sender
+{
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
+ return NO;
+}
+
+- (void)windowDidExpose:(NSNotification *)aNotification
+{
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
+}
+
+- (void)windowWillMove:(NSNotification *)aNotification
+{
+ if ([_data->nswindow isKindOfClass:[SDLWindow class]]) {
+ pendingWindowWarpX = pendingWindowWarpY = INT_MAX;
+ isMoving = YES;
+ }
+}
+
+- (void)windowDidMove:(NSNotification *)aNotification
+{
+ int x, y;
+ SDL_Window *window = _data->window;
+ NSWindow *nswindow = _data->nswindow;
+ BOOL fullscreen = window->flags & FULLSCREEN_MASK;
+ NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
+ ConvertNSRect([nswindow screen], fullscreen, &rect);
+
+ if (inFullscreenTransition) {
+ /* We'll take care of this at the end of the transition */
+ return;
+ }
+
+ if (s_moveHack) {
+ SDL_bool blockMove = ((SDL_GetTicks() - s_moveHack) < 500);
+
+ s_moveHack = 0;
+
+ if (blockMove) {
+ /* Cocoa is adjusting the window in response to a mode change */
+ rect.origin.x = window->x;
+ rect.origin.y = window->y;
+ ConvertNSRect([nswindow screen], fullscreen, &rect);
+ [nswindow setFrameOrigin:rect.origin];
+ return;
+ }
+ }
+
+ x = (int)rect.origin.x;
+ y = (int)rect.origin.y;
+
+ ScheduleContextUpdates(_data);
+
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
+}
+
+- (void)windowDidResize:(NSNotification *)aNotification
+{
+ if (inFullscreenTransition) {
+ /* We'll take care of this at the end of the transition */
+ return;
+ }
+
+ SDL_Window *window = _data->window;
+ NSWindow *nswindow = _data->nswindow;
+ int x, y, w, h;
+ NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
+ ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);
+ x = (int)rect.origin.x;
+ y = (int)rect.origin.y;
+ w = (int)rect.size.width;
+ h = (int)rect.size.height;
+
+ if (SDL_IsShapedWindow(window)) {
+ Cocoa_ResizeWindowShape(window);
+ }
+
+ ScheduleContextUpdates(_data);
+
+ /* The window can move during a resize event, such as when maximizing
+ or resizing from a corner */
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
+
+ const BOOL zoomed = [nswindow isZoomed];
+ if (!zoomed) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ } else if (zoomed) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+ }
+}
+
+- (void)windowDidMiniaturize:(NSNotification *)aNotification
+{
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+}
+
+- (void)windowDidDeminiaturize:(NSNotification *)aNotification
+{
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+}
+
+- (void)windowDidBecomeKey:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ /* We're going to get keyboard events, since we're key. */
+ /* This needs to be done before restoring the relative mouse mode. */
+ SDL_SetKeyboardFocus(window);
+
+ if (mouse->relative_mode && !mouse->relative_mode_warp && ![self isMoving]) {
+ mouse->SetRelativeMouseMode(SDL_TRUE);
+ }
+
+ /* If we just gained focus we need the updated mouse position */
+ if (!mouse->relative_mode) {
+ NSPoint point;
+ int x, y;
+
+ point = [_data->nswindow mouseLocationOutsideOfEventStream];
+ x = (int)point.x;
+ y = (int)(window->h - point.y);
+
+ if (x >= 0 && x < window->w && y >= 0 && y < window->h) {
+ SDL_SendMouseMotion(window, 0, 0, x, y);
+ }
+ }
+
+ /* Check to see if someone updated the clipboard */
+ Cocoa_CheckClipboardUpdate(_data->videodata);
+
+ if ((isFullscreenSpace) && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
+ [NSMenu setMenuBarVisible:NO];
+ }
+
+ const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock;
+ _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags;
+ SDL_ToggleModState(KMOD_CAPS, newflags != 0);
+}
+
+- (void)windowDidResignKey:(NSNotification *)aNotification
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (mouse->relative_mode && !mouse->relative_mode_warp) {
+ mouse->SetRelativeMouseMode(SDL_FALSE);
+ }
+
+ /* Some other window will get mouse events, since we're not key. */
+ if (SDL_GetMouseFocus() == _data->window) {
+ SDL_SetMouseFocus(NULL);
+ }
+
+ /* Some other window will get keyboard events, since we're not key. */
+ if (SDL_GetKeyboardFocus() == _data->window) {
+ SDL_SetKeyboardFocus(NULL);
+ }
+
+ if (isFullscreenSpace) {
+ [NSMenu setMenuBarVisible:YES];
+ }
+}
+
+- (void)windowDidChangeBackingProperties:(NSNotification *)aNotification
+{
+ NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey];
+
+ if (inFullscreenTransition) {
+ return;
+ }
+
+ if ([oldscale doubleValue] != [_data->nswindow backingScaleFactor]) {
+ /* Force a resize event when the backing scale factor changes. */
+ _data->window->w = 0;
+ _data->window->h = 0;
+ [self windowDidResize:aNotification];
+ }
+}
+
+- (void)windowWillEnterFullScreen:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+
+ SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable));
+
+ isFullscreenSpace = YES;
+ inFullscreenTransition = YES;
+}
+
+- (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+
+ if (window->is_destroying) {
+ return;
+ }
+
+ SetWindowStyle(window, GetWindowStyle(window));
+
+ isFullscreenSpace = NO;
+ inFullscreenTransition = NO;
+
+ [self windowDidExitFullScreen:nil];
+}
+
+- (void)windowDidEnterFullScreen:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = data->nswindow;
+
+ inFullscreenTransition = NO;
+
+ if (pendingWindowOperation == PENDING_OPERATION_LEAVE_FULLSCREEN) {
+ pendingWindowOperation = PENDING_OPERATION_NONE;
+ [self setFullscreenSpace:NO];
+ } else {
+ /* Unset the resizable flag.
+ This is a workaround for https://bugzilla.libsdl.org/show_bug.cgi?id=3697
+ */
+ SetWindowStyle(window, [nswindow styleMask] & (~NSWindowStyleMaskResizable));
+
+ if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ [NSMenu setMenuBarVisible:NO];
+ }
+
+ pendingWindowOperation = PENDING_OPERATION_NONE;
+ /* Force the size change event in case it was delivered earlier
+ while the window was still animating into place.
+ */
+ window->w = 0;
+ window->h = 0;
+ [self windowDidMove:aNotification];
+ [self windowDidResize:aNotification];
+ }
+}
+
+- (void)windowWillExitFullScreen:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+
+ isFullscreenSpace = NO;
+ inFullscreenTransition = YES;
+
+ /* As of OS X 10.11, the window seems to need to be resizable when exiting
+ a Space, in order for it to resize back to its windowed-mode size.
+ */
+ SetWindowStyle(window, GetWindowStyle(window) | NSWindowStyleMaskResizable);
+}
+
+- (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+
+ if (window->is_destroying) {
+ return;
+ }
+
+ SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable));
+
+ isFullscreenSpace = YES;
+ inFullscreenTransition = NO;
+
+ [self windowDidEnterFullScreen:nil];
+}
+
+- (void)windowDidExitFullScreen:(NSNotification *)aNotification
+{
+ SDL_Window *window = _data->window;
+ NSWindow *nswindow = _data->nswindow;
+
+ inFullscreenTransition = NO;
+
+ SetWindowStyle(window, GetWindowStyle(window));
+
+ [nswindow setLevel:kCGNormalWindowLevel];
+
+ if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) {
+ pendingWindowOperation = PENDING_OPERATION_NONE;
+ [self setFullscreenSpace:YES];
+ } else if (pendingWindowOperation == PENDING_OPERATION_MINIMIZE) {
+ pendingWindowOperation = PENDING_OPERATION_NONE;
+ [nswindow miniaturize:nil];
+ } else {
+ /* Adjust the fullscreen toggle button and readd menu now that we're here. */
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
+ [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+ } else {
+ [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged];
+ }
+ [NSMenu setMenuBarVisible:YES];
+
+ pendingWindowOperation = PENDING_OPERATION_NONE;
+
+#if 0
+/* This fixed bug 3719, which is that changing window size while fullscreen
+ doesn't take effect when leaving fullscreen, but introduces bug 3809,
+ which is that a maximized window doesn't go back to normal size when
+ restored, so this code is disabled until we can properly handle the
+ beginning and end of maximize and restore.
+ */
+ /* Restore windowed size and position in case it changed while fullscreen */
+ {
+ NSRect rect;
+ rect.origin.x = window->windowed.x;
+ rect.origin.y = window->windowed.y;
+ rect.size.width = window->windowed.w;
+ rect.size.height = window->windowed.h;
+ ConvertNSRect([nswindow screen], NO, &rect);
+
+ s_moveHack = 0;
+ [nswindow setContentSize:rect.size];
+ [nswindow setFrameOrigin:rect.origin];
+ s_moveHack = SDL_GetTicks();
+ }
+#endif /* 0 */
+
+ /* Force the size change event in case it was delivered earlier
+ while the window was still animating into place.
+ */
+ window->w = 0;
+ window->h = 0;
+ [self windowDidMove:aNotification];
+ [self windowDidResize:aNotification];
+
+ /* FIXME: Why does the window get hidden? */
+ if (window->flags & SDL_WINDOW_SHOWN) {
+ Cocoa_ShowWindow(SDL_GetVideoDevice(), window);
+ }
+ }
+}
+
+-(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
+{
+ if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
+ return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
+ } else {
+ return proposedOptions;
+ }
+}
+
+
+/* We'll respond to key events by doing nothing so we don't beep.
+ * We could handle key messages here, but we lose some in the NSApp dispatch,
+ * where they get converted to action messages, etc.
+ */
+- (void)flagsChanged:(NSEvent *)theEvent
+{
+ /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/
+}
+- (void)keyDown:(NSEvent *)theEvent
+{
+ /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/
+}
+- (void)keyUp:(NSEvent *)theEvent
+{
+ /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/
+}
+
+/* We'll respond to selectors by doing nothing so we don't beep.
+ * The escape key gets converted to a "cancel" selector, etc.
+ */
+- (void)doCommandBySelector:(SEL)aSelector
+{
+ /*NSLog(@"doCommandBySelector: %@\n", NSStringFromSelector(aSelector));*/
+}
+
+- (BOOL)processHitTest:(NSEvent *)theEvent
+{
+ SDL_assert(isDragAreaRunning == [_data->nswindow isMovableByWindowBackground]);
+
+ if (_data->window->hit_test) { /* if no hit-test, skip this. */
+ const NSPoint location = [theEvent locationInWindow];
+ const SDL_Point point = { (int) location.x, _data->window->h - (((int) location.y)-1) };
+ const SDL_HitTestResult rc = _data->window->hit_test(_data->window, &point, _data->window->hit_test_data);
+ if (rc == SDL_HITTEST_DRAGGABLE) {
+ if (!isDragAreaRunning) {
+ isDragAreaRunning = YES;
+ [_data->nswindow setMovableByWindowBackground:YES];
+ }
+ return YES; /* dragging! */
+ }
+ }
+
+ if (isDragAreaRunning) {
+ isDragAreaRunning = NO;
+ [_data->nswindow setMovableByWindowBackground:NO];
+ return YES; /* was dragging, drop event. */
+ }
+
+ return NO; /* not a special area, carry on. */
+}
+
+- (void)mouseDown:(NSEvent *)theEvent
+{
+ int button;
+ int clicks;
+
+ /* Ignore events that aren't inside the client area (i.e. title bar.) */
+ if ([theEvent window]) {
+ NSRect windowRect = [[[theEvent window] contentView] frame];
+ if (!NSMouseInRect([theEvent locationInWindow], windowRect, NO)) {
+ return;
+ }
+ }
+
+ if ([self processHitTest:theEvent]) {
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
+ return; /* dragging, drop event. */
+ }
+
+ switch ([theEvent buttonNumber]) {
+ case 0:
+ if (([theEvent modifierFlags] & NSEventModifierFlagControl) &&
+ GetHintCtrlClickEmulateRightClick()) {
+ wasCtrlLeft = YES;
+ button = SDL_BUTTON_RIGHT;
+ } else {
+ wasCtrlLeft = NO;
+ button = SDL_BUTTON_LEFT;
+ }
+ break;
+ case 1:
+ button = SDL_BUTTON_RIGHT;
+ break;
+ case 2:
+ button = SDL_BUTTON_MIDDLE;
+ break;
+ default:
+ button = (int) [theEvent buttonNumber] + 1;
+ break;
+ }
+
+ clicks = (int) [theEvent clickCount];
+ SDL_SendMouseButtonClicks(_data->window, 0, SDL_PRESSED, button, clicks);
+}
+
+- (void)rightMouseDown:(NSEvent *)theEvent
+{
+ [self mouseDown:theEvent];
+}
+
+- (void)otherMouseDown:(NSEvent *)theEvent
+{
+ [self mouseDown:theEvent];
+}
+
+- (void)mouseUp:(NSEvent *)theEvent
+{
+ int button;
+ int clicks;
+
+ if ([self processHitTest:theEvent]) {
+ SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
+ return; /* stopped dragging, drop event. */
+ }
+
+ switch ([theEvent buttonNumber]) {
+ case 0:
+ if (wasCtrlLeft) {
+ button = SDL_BUTTON_RIGHT;
+ wasCtrlLeft = NO;
+ } else {
+ button = SDL_BUTTON_LEFT;
+ }
+ break;
+ case 1:
+ button = SDL_BUTTON_RIGHT;
+ break;
+ case 2:
+ button = SDL_BUTTON_MIDDLE;
+ break;
+ default:
+ button = (int) [theEvent buttonNumber] + 1;
+ break;
+ }
+
+ clicks = (int) [theEvent clickCount];
+ SDL_SendMouseButtonClicks(_data->window, 0, SDL_RELEASED, button, clicks);
+}
+
+- (void)rightMouseUp:(NSEvent *)theEvent
+{
+ [self mouseUp:theEvent];
+}
+
+- (void)otherMouseUp:(NSEvent *)theEvent
+{
+ [self mouseUp:theEvent];
+}
+
+- (void)mouseMoved:(NSEvent *)theEvent
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Window *window = _data->window;
+ NSPoint point;
+ int x, y;
+
+ if ([self processHitTest:theEvent]) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
+ return; /* dragging, drop event. */
+ }
+
+ if (mouse->relative_mode) {
+ return;
+ }
+
+ point = [theEvent locationInWindow];
+ x = (int)point.x;
+ y = (int)(window->h - point.y);
+
+ if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
+ if (x < 0 || x >= window->w || y < 0 || y >= window->h) {
+ if (x < 0) {
+ x = 0;
+ } else if (x >= window->w) {
+ x = window->w - 1;
+ }
+ if (y < 0) {
+ y = 0;
+ } else if (y >= window->h) {
+ y = window->h - 1;
+ }
+
+#if !SDL_MAC_NO_SANDBOX
+ CGPoint cgpoint;
+
+ /* When SDL_MAC_NO_SANDBOX is set, this is handled by
+ * SDL_cocoamousetap.m.
+ */
+
+ cgpoint.x = window->x + x;
+ cgpoint.y = window->y + y;
+
+ CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
+ CGAssociateMouseAndMouseCursorPosition(YES);
+
+ Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y);
+#endif
+ }
+ }
+ SDL_SendMouseMotion(window, 0, 0, x, y);
+}
+
+- (void)mouseDragged:(NSEvent *)theEvent
+{
+ [self mouseMoved:theEvent];
+}
+
+- (void)rightMouseDragged:(NSEvent *)theEvent
+{
+ [self mouseMoved:theEvent];
+}
+
+- (void)otherMouseDragged:(NSEvent *)theEvent
+{
+ [self mouseMoved:theEvent];
+}
+
+- (void)scrollWheel:(NSEvent *)theEvent
+{
+ Cocoa_HandleMouseWheel(_data->window, theEvent);
+}
+
+- (void)touchesBeganWithEvent:(NSEvent *) theEvent
+{
+ NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil];
+ int existingTouchCount = 0;
+
+ for (NSTouch* touch in touches) {
+ if ([touch phase] != NSTouchPhaseBegan) {
+ existingTouchCount++;
+ }
+ }
+ if (existingTouchCount == 0) {
+ SDL_TouchID touchID = (SDL_TouchID)(intptr_t)[[touches anyObject] device];
+ int numFingers = SDL_GetNumTouchFingers(touchID);
+ DLog("Reset Lost Fingers: %d", numFingers);
+ for (--numFingers; numFingers >= 0; --numFingers) {
+ SDL_Finger* finger = SDL_GetTouchFinger(touchID, numFingers);
+ SDL_SendTouch(touchID, finger->id, SDL_FALSE, 0, 0, 0);
+ }
+ }
+
+ DLog("Began Fingers: %lu .. existing: %d", (unsigned long)[touches count], existingTouchCount);
+ [self handleTouches:NSTouchPhaseBegan withEvent:theEvent];
+}
+
+- (void)touchesMovedWithEvent:(NSEvent *) theEvent
+{
+ [self handleTouches:NSTouchPhaseMoved withEvent:theEvent];
+}
+
+- (void)touchesEndedWithEvent:(NSEvent *) theEvent
+{
+ [self handleTouches:NSTouchPhaseEnded withEvent:theEvent];
+}
+
+- (void)touchesCancelledWithEvent:(NSEvent *) theEvent
+{
+ [self handleTouches:NSTouchPhaseCancelled withEvent:theEvent];
+}
+
+- (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent
+{
+ NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil];
+
+ for (NSTouch *touch in touches) {
+ const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device];
+ if (SDL_AddTouch(touchId, "") < 0) {
+ return;
+ }
+
+ const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity];
+ float x = [touch normalizedPosition].x;
+ float y = [touch normalizedPosition].y;
+ /* Make the origin the upper left instead of the lower left */
+ y = 1.0f - y;
+
+ switch (phase) {
+ case NSTouchPhaseBegan:
+ SDL_SendTouch(touchId, fingerId, SDL_TRUE, x, y, 1.0f);
+ break;
+ case NSTouchPhaseEnded:
+ case NSTouchPhaseCancelled:
+ SDL_SendTouch(touchId, fingerId, SDL_FALSE, x, y, 1.0f);
+ break;
+ case NSTouchPhaseMoved:
+ SDL_SendTouchMotion(touchId, fingerId, x, y, 1.0f);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+@end
+
+@interface SDLView : NSView {
+ SDL_Window *_sdlWindow;
+}
+
+- (void)setSDLWindow:(SDL_Window*)window;
+
+/* The default implementation doesn't pass rightMouseDown to responder chain */
+- (void)rightMouseDown:(NSEvent *)theEvent;
+- (BOOL)mouseDownCanMoveWindow;
+- (void)drawRect:(NSRect)dirtyRect;
+- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent;
+@end
+
+@implementation SDLView
+- (void)setSDLWindow:(SDL_Window*)window
+{
+ _sdlWindow = window;
+}
+
+- (void)drawRect:(NSRect)dirtyRect
+{
+ /* Force the graphics context to clear to black so we don't get a flash of
+ white until the app is ready to draw. In practice on modern macOS, this
+ only gets called for window creation and other extraordinary events. */
+ [[NSColor blackColor] setFill];
+ NSRectFill(dirtyRect);
+ SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
+}
+
+- (void)rightMouseDown:(NSEvent *)theEvent
+{
+ [[self nextResponder] rightMouseDown:theEvent];
+}
+
+- (BOOL)mouseDownCanMoveWindow
+{
+ /* Always say YES, but this doesn't do anything until we call
+ -[NSWindow setMovableByWindowBackground:YES], which we ninja-toggle
+ during mouse events when we're using a drag area. */
+ return YES;
+}
+
+- (void)resetCursorRects
+{
+ [super resetCursorRects];
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) {
+ [self addCursorRect:[self bounds]
+ cursor:mouse->cur_cursor->driverdata];
+ } else {
+ [self addCursorRect:[self bounds]
+ cursor:[NSCursor invisibleCursor]];
+ }
+}
+
+- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
+{
+ if (SDL_GetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH)) {
+ return SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE);
+ } else {
+ return SDL_GetHintBoolean("SDL_MAC_MOUSE_FOCUS_CLICKTHROUGH", SDL_FALSE);
+ }
+}
+@end
+
+static int
+SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created)
+{ @autoreleasepool
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *data;
+
+ /* Allocate the window data */
+ window->driverdata = data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+ data->window = window;
+ data->nswindow = nswindow;
+ data->created = created;
+ data->videodata = videodata;
+ data->nscontexts = [[NSMutableArray alloc] init];
+
+ /* Create an event listener for the window */
+ data->listener = [[Cocoa_WindowListener alloc] init];
+
+ /* Fill in the SDL window with the window data */
+ {
+ NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
+ ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);
+ window->x = (int)rect.origin.x;
+ window->y = (int)rect.origin.y;
+ window->w = (int)rect.size.width;
+ window->h = (int)rect.size.height;
+ }
+
+ /* Set up the listener after we create the view */
+ [data->listener listen:data];
+
+ if ([nswindow isVisible]) {
+ window->flags |= SDL_WINDOW_SHOWN;
+ } else {
+ window->flags &= ~SDL_WINDOW_SHOWN;
+ }
+
+ {
+ unsigned long style = [nswindow styleMask];
+
+ if (style == NSWindowStyleMaskBorderless) {
+ window->flags |= SDL_WINDOW_BORDERLESS;
+ } else {
+ window->flags &= ~SDL_WINDOW_BORDERLESS;
+ }
+ if (style & NSWindowStyleMaskResizable) {
+ window->flags |= SDL_WINDOW_RESIZABLE;
+ } else {
+ window->flags &= ~SDL_WINDOW_RESIZABLE;
+ }
+ }
+
+ /* isZoomed always returns true if the window is not resizable */
+ if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
+ window->flags |= SDL_WINDOW_MAXIMIZED;
+ } else {
+ window->flags &= ~SDL_WINDOW_MAXIMIZED;
+ }
+
+ if ([nswindow isMiniaturized]) {
+ window->flags |= SDL_WINDOW_MINIMIZED;
+ } else {
+ window->flags &= ~SDL_WINDOW_MINIMIZED;
+ }
+
+ if ([nswindow isKeyWindow]) {
+ window->flags |= SDL_WINDOW_INPUT_FOCUS;
+ SDL_SetKeyboardFocus(data->window);
+ }
+
+ /* Prevents the window's "window device" from being destroyed when it is
+ * hidden. See http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html
+ */
+ [nswindow setOneShot:NO];
+
+ /* All done! */
+ window->driverdata = data;
+ return 0;
+}}
+
+int
+Cocoa_CreateWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ NSWindow *nswindow;
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ NSRect rect;
+ SDL_Rect bounds;
+ NSUInteger style;
+ NSArray *screens = [NSScreen screens];
+
+ Cocoa_GetDisplayBounds(_this, display, &bounds);
+ rect.origin.x = window->x;
+ rect.origin.y = window->y;
+ rect.size.width = window->w;
+ rect.size.height = window->h;
+ ConvertNSRect([screens objectAtIndex:0], (window->flags & FULLSCREEN_MASK), &rect);
+
+ style = GetWindowStyle(window);
+
+ /* Figure out which screen to place this window */
+ NSScreen *screen = nil;
+ for (NSScreen *candidate in screens) {
+ NSRect screenRect = [candidate frame];
+ if (rect.origin.x >= screenRect.origin.x &&
+ rect.origin.x < screenRect.origin.x + screenRect.size.width &&
+ rect.origin.y >= screenRect.origin.y &&
+ rect.origin.y < screenRect.origin.y + screenRect.size.height) {
+ screen = candidate;
+ rect.origin.x -= screenRect.origin.x;
+ rect.origin.y -= screenRect.origin.y;
+ }
+ }
+
+ @try {
+ nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
+ }
+ @catch (NSException *e) {
+ return SDL_SetError("%s", [[e reason] UTF8String]);
+ }
+
+ if (videodata->allow_spaces) {
+ SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6);
+ SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]);
+ /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
+ [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+ }
+ }
+
+ /* Create a default view for this window */
+ rect = [nswindow contentRectForFrameRect:[nswindow frame]];
+ SDLView *contentView = [[SDLView alloc] initWithFrame:rect];
+ [contentView setSDLWindow:window];
+
+ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
+ [contentView setWantsBestResolutionOpenGLSurface:YES];
+ }
+ }
+#if SDL_VIDEO_OPENGL_ES2
+#if SDL_VIDEO_OPENGL_EGL
+ if ((window->flags & SDL_WINDOW_OPENGL) &&
+ _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
+ [contentView setWantsLayer:TRUE];
+ }
+#endif /* SDL_VIDEO_OPENGL_EGL */
+#endif /* SDL_VIDEO_OPENGL_ES2 */
+ [nswindow setContentView:contentView];
+ [contentView release];
+
+ /* Allow files and folders to be dragged onto the window by users */
+ [nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]];
+
+ if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
+ [nswindow release];
+ return -1;
+ }
+
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ return 0;
+ }
+
+ /* The rest of this macro mess is for OpenGL or OpenGL ES windows */
+#if SDL_VIDEO_OPENGL_ES2
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
+#if SDL_VIDEO_OPENGL_EGL
+ if (Cocoa_GLES_SetupWindow(_this, window) < 0) {
+ Cocoa_DestroyWindow(_this, window);
+ return -1;
+ }
+ return 0;
+#else
+ return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
+#endif /* SDL_VIDEO_OPENGL_EGL */
+ }
+#endif /* SDL_VIDEO_OPENGL_ES2 */
+ return 0;
+}}
+
+int
+Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{ @autoreleasepool
+{
+ NSWindow *nswindow = (NSWindow *) data;
+ NSString *title;
+
+ /* Query the title from the existing window */
+ title = [nswindow title];
+ if (title) {
+ window->title = SDL_strdup([title UTF8String]);
+ }
+
+ return SetupWindowData(_this, window, nswindow, SDL_FALSE);
+}}
+
+void
+Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ const char *title = window->title ? window->title : "";
+ NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
+ NSString *string = [[NSString alloc] initWithUTF8String:title];
+ [nswindow setTitle:string];
+ [string release];
+}}
+
+void
+Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{ @autoreleasepool
+{
+ NSImage *nsimage = Cocoa_CreateImage(icon);
+
+ if (nsimage) {
+ [NSApp setApplicationIconImage:nsimage];
+ }
+}}
+
+void
+Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = windata->nswindow;
+ NSRect rect;
+ Uint32 moveHack;
+
+ rect.origin.x = window->x;
+ rect.origin.y = window->y;
+ rect.size.width = window->w;
+ rect.size.height = window->h;
+ ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);
+
+ moveHack = s_moveHack;
+ s_moveHack = 0;
+ [nswindow setFrameOrigin:rect.origin];
+ s_moveHack = moveHack;
+
+ ScheduleContextUpdates(windata);
+}}
+
+void
+Cocoa_SetWindowSize(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = windata->nswindow;
+ NSRect rect;
+ Uint32 moveHack;
+
+ /* Cocoa will resize the window from the bottom-left rather than the
+ * top-left when -[nswindow setContentSize:] is used, so we must set the
+ * entire frame based on the new size, in order to preserve the position.
+ */
+ rect.origin.x = window->x;
+ rect.origin.y = window->y;
+ rect.size.width = window->w;
+ rect.size.height = window->h;
+ ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);
+
+ moveHack = s_moveHack;
+ s_moveHack = 0;
+ [nswindow setFrame:[nswindow frameRectForContentRect:rect] display:YES];
+ s_moveHack = moveHack;
+
+ ScheduleContextUpdates(windata);
+}}
+
+void
+Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
+
+ NSSize minSize;
+ minSize.width = window->min_w;
+ minSize.height = window->min_h;
+
+ [windata->nswindow setContentMinSize:minSize];
+}}
+
+void
+Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
+
+ NSSize maxSize;
+ maxSize.width = window->max_w;
+ maxSize.height = window->max_h;
+
+ [windata->nswindow setContentMaxSize:maxSize];
+}}
+
+void
+Cocoa_ShowWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
+ NSWindow *nswindow = windowData->nswindow;
+
+ if (![nswindow isMiniaturized]) {
+ [windowData->listener pauseVisibleObservation];
+ [nswindow makeKeyAndOrderFront:nil];
+ [windowData->listener resumeVisibleObservation];
+ }
+}}
+
+void
+Cocoa_HideWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
+
+ [nswindow orderOut:nil];
+}}
+
+void
+Cocoa_RaiseWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata);
+ NSWindow *nswindow = windowData->nswindow;
+
+ /* makeKeyAndOrderFront: has the side-effect of deminiaturizing and showing
+ a minimized or hidden window, so check for that before showing it.
+ */
+ [windowData->listener pauseVisibleObservation];
+ if (![nswindow isMiniaturized] && [nswindow isVisible]) {
+ [NSApp activateIgnoringOtherApps:YES];
+ [nswindow makeKeyAndOrderFront:nil];
+ }
+ [windowData->listener resumeVisibleObservation];
+}}
+
+void
+Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = windata->nswindow;
+
+ [nswindow zoom:nil];
+
+ ScheduleContextUpdates(windata);
+}}
+
+void
+Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = data->nswindow;
+
+ if ([data->listener isInFullscreenSpaceTransition]) {
+ [data->listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE];
+ } else {
+ [nswindow miniaturize:nil];
+ }
+}}
+
+void
+Cocoa_RestoreWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
+
+ if ([nswindow isMiniaturized]) {
+ [nswindow deminiaturize:nil];
+ } else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
+ [nswindow zoom:nil];
+ }
+}}
+
+void
+Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
+{ @autoreleasepool
+{
+ if (SetWindowStyle(window, GetWindowStyle(window))) {
+ if (bordered) {
+ Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
+ }
+ }
+}}
+
+void
+Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
+{ @autoreleasepool
+{
+ /* Don't set this if we're in a space!
+ * The window will get permanently stuck if resizable is false.
+ * -flibit
+ */
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Cocoa_WindowListener *listener = data->listener;
+ if (![listener isInFullscreenSpace]) {
+ SetWindowStyle(window, GetWindowStyle(window));
+ }
+}}
+
+void
+Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{ @autoreleasepool
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ NSWindow *nswindow = data->nswindow;
+ NSRect rect;
+
+ /* The view responder chain gets messed with during setStyleMask */
+ if ([[nswindow contentView] nextResponder] == data->listener) {
+ [[nswindow contentView] setNextResponder:nil];
+ }
+
+ if (fullscreen) {
+ SDL_Rect bounds;
+
+ Cocoa_GetDisplayBounds(_this, display, &bounds);
+ rect.origin.x = bounds.x;
+ rect.origin.y = bounds.y;
+ rect.size.width = bounds.w;
+ rect.size.height = bounds.h;
+ ConvertNSRect([nswindow screen], fullscreen, &rect);
+
+ /* Hack to fix origin on Mac OS X 10.4 */
+ NSRect screenRect = [[nswindow screen] frame];
+ if (screenRect.size.height >= 1.0f) {
+ rect.origin.y += (screenRect.size.height - rect.size.height);
+ }
+
+ [nswindow setStyleMask:NSWindowStyleMaskBorderless];
+ } else {
+ rect.origin.x = window->windowed.x;
+ rect.origin.y = window->windowed.y;
+ rect.size.width = window->windowed.w;
+ rect.size.height = window->windowed.h;
+ ConvertNSRect([nswindow screen], fullscreen, &rect);
+
+ [nswindow setStyleMask:GetWindowStyle(window)];
+
+ /* Hack to restore window decorations on Mac OS X 10.10 */
+ NSRect frameRect = [nswindow frame];
+ [nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO];
+ [nswindow setFrame:frameRect display:NO];
+ }
+
+ /* The view responder chain gets messed with during setStyleMask */
+ if ([[nswindow contentView] nextResponder] != data->listener) {
+ [[nswindow contentView] setNextResponder:data->listener];
+ }
+
+ s_moveHack = 0;
+ [nswindow setContentSize:rect.size];
+ [nswindow setFrameOrigin:rect.origin];
+ s_moveHack = SDL_GetTicks();
+
+ /* When the window style changes the title is cleared */
+ if (!fullscreen) {
+ Cocoa_SetWindowTitle(_this, window);
+ }
+
+ if (SDL_ShouldAllowTopmost() && fullscreen) {
+ /* OpenGL is rendering to the window, so make it visible! */
+ [nswindow setLevel:CGShieldingWindowLevel()];
+ } else {
+ [nswindow setLevel:kCGNormalWindowLevel];
+ }
+
+ if ([nswindow isVisible] || fullscreen) {
+ [data->listener pauseVisibleObservation];
+ [nswindow makeKeyAndOrderFront:nil];
+ [data->listener resumeVisibleObservation];
+ }
+
+ ScheduleContextUpdates(data);
+}}
+
+int
+Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ CGDirectDisplayID display_id = ((SDL_DisplayData *)display->driverdata)->display;
+ const uint32_t tableSize = 256;
+ CGGammaValue redTable[tableSize];
+ CGGammaValue greenTable[tableSize];
+ CGGammaValue blueTable[tableSize];
+ uint32_t i;
+ float inv65535 = 1.0f / 65535.0f;
+
+ /* Extract gamma values into separate tables, convert to floats between 0.0 and 1.0 */
+ for (i = 0; i < 256; i++) {
+ redTable[i] = ramp[0*256+i] * inv65535;
+ greenTable[i] = ramp[1*256+i] * inv65535;
+ blueTable[i] = ramp[2*256+i] * inv65535;
+ }
+
+ if (CGSetDisplayTransferByTable(display_id, tableSize,
+ redTable, greenTable, blueTable) != CGDisplayNoErr) {
+ return SDL_SetError("CGSetDisplayTransferByTable()");
+ }
+ return 0;
+}
+
+int
+Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ CGDirectDisplayID display_id = ((SDL_DisplayData *)display->driverdata)->display;
+ const uint32_t tableSize = 256;
+ CGGammaValue redTable[tableSize];
+ CGGammaValue greenTable[tableSize];
+ CGGammaValue blueTable[tableSize];
+ uint32_t i, tableCopied;
+
+ if (CGGetDisplayTransferByTable(display_id, tableSize,
+ redTable, greenTable, blueTable, &tableCopied) != CGDisplayNoErr) {
+ return SDL_SetError("CGGetDisplayTransferByTable()");
+ }
+
+ for (i = 0; i < tableCopied; i++) {
+ ramp[0*256+i] = (Uint16)(redTable[i] * 65535.0f);
+ ramp[1*256+i] = (Uint16)(greenTable[i] * 65535.0f);
+ ramp[2*256+i] = (Uint16)(blueTable[i] * 65535.0f);
+ }
+ return 0;
+}
+
+void
+Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ /* Enable or disable the event tap as necessary */
+ Cocoa_EnableMouseEventTap(mouse->driverdata, grabbed);
+
+ /* Move the cursor to the nearest point in the window */
+ if (grabbed && data && ![data->listener isMoving]) {
+ int x, y;
+ CGPoint cgpoint;
+
+ SDL_GetMouseState(&x, &y);
+ cgpoint.x = window->x + x;
+ cgpoint.y = window->y + y;
+
+ Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y);
+
+ DLog("Returning cursor to (%g, %g)", cgpoint.x, cgpoint.y);
+ CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
+ }
+
+ if ( data && (window->flags & SDL_WINDOW_FULLSCREEN) ) {
+ if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)
+ && ![data->listener isInFullscreenSpace]) {
+ /* OpenGL is rendering to the window, so make it visible! */
+ /* Doing this in 10.11 while in a Space breaks things (bug #3152) */
+ [data->nswindow setLevel:CGShieldingWindowLevel()];
+ } else {
+ [data->nswindow setLevel:kCGNormalWindowLevel];
+ }
+ }
+}
+
+void
+Cocoa_DestroyWindow(_THIS, SDL_Window * window)
+{ @autoreleasepool
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (data) {
+ if ([data->listener isInFullscreenSpace]) {
+ [NSMenu setMenuBarVisible:YES];
+ }
+ [data->listener close];
+ [data->listener release];
+ if (data->created) {
+ [data->nswindow close];
+ }
+
+ NSArray *contexts = [[data->nscontexts copy] autorelease];
+ for (SDLOpenGLContext *context in contexts) {
+ /* Calling setWindow:NULL causes the context to remove itself from the context list. */
+ [context setWindow:NULL];
+ }
+ [data->nscontexts release];
+
+ SDL_free(data);
+ }
+ window->driverdata = NULL;
+}}
+
+SDL_bool
+Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
+
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ info->subsystem = SDL_SYSWM_COCOA;
+ info->info.cocoa.window = nswindow;
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+}
+
+SDL_bool
+Cocoa_IsWindowInFullscreenSpace(SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if ([data->listener isInFullscreenSpace]) {
+ return SDL_TRUE;
+ } else {
+ return SDL_FALSE;
+ }
+}
+
+SDL_bool
+Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state)
+{ @autoreleasepool
+{
+ SDL_bool succeeded = SDL_FALSE;
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if ([data->listener setFullscreenSpace:(state ? YES : NO)]) {
+ const int maxattempts = 3;
+ int attempt = 0;
+ while (++attempt <= maxattempts) {
+ /* Wait for the transition to complete, so application changes
+ take effect properly (e.g. setting the window size, etc.)
+ */
+ const int limit = 10000;
+ int count = 0;
+ while ([data->listener isInFullscreenSpaceTransition]) {
+ if ( ++count == limit ) {
+ /* Uh oh, transition isn't completing. Should we assert? */
+ break;
+ }
+ SDL_Delay(1);
+ SDL_PumpEvents();
+ }
+ if ([data->listener isInFullscreenSpace] == (state ? YES : NO))
+ break;
+ /* Try again, the last attempt was interrupted by user gestures */
+ if (![data->listener setFullscreenSpace:(state ? YES : NO)])
+ break; /* ??? */
+ }
+ /* Return TRUE to prevent non-space fullscreen logic from running */
+ succeeded = SDL_TRUE;
+ }
+
+ return succeeded;
+}}
+
+int
+Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)
+{
+ return 0; /* just succeed, the real work is done elsewhere. */
+}
+
+int
+Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ [data->nswindow setAlphaValue:opacity];
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.c
new file mode 100644
index 0000000..d9d0c3a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.c
@@ -0,0 +1,413 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_window.h"
+
+#include "../../events/SDL_windowevents_c.h"
+
+#define COLOR_EXPAND(col) col.r, col.g, col.b, col.a
+
+static DFB_Theme theme_std = {
+ 4, 4, 8, 8,
+ {255, 200, 200, 200},
+ 24,
+ {255, 0, 0, 255},
+ 16,
+ {255, 255, 255, 255},
+ "/usr/share/fonts/truetype/freefont/FreeSans.ttf",
+ {255, 255, 0, 0},
+ {255, 255, 255, 0},
+};
+
+static DFB_Theme theme_none = {
+ 0, 0, 0, 0,
+ {0, 0, 0, 0},
+ 0,
+ {0, 0, 0, 0},
+ 0,
+ {0, 0, 0, 0},
+ NULL
+};
+
+static void
+DrawTriangle(IDirectFBSurface * s, int down, int x, int y, int w)
+{
+ int x1, x2, x3;
+ int y1, y2, y3;
+
+ if (down) {
+ x1 = x + w / 2;
+ x2 = x;
+ x3 = x + w;
+ y1 = y + w;
+ y2 = y;
+ y3 = y;
+ } else {
+ x1 = x + w / 2;
+ x2 = x;
+ x3 = x + w;
+ y1 = y;
+ y2 = y + w;
+ y3 = y + w;
+ }
+ s->FillTriangle(s, x1, y1, x2, y2, x3, y3);
+}
+
+static void
+LoadFont(_THIS, SDL_Window * window)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(window);
+
+ if (windata->font != NULL) {
+ SDL_DFB_RELEASE(windata->font);
+ windata->font = NULL;
+ SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
+ }
+
+ if (windata->theme.font != NULL)
+ {
+ DFBFontDescription fdesc;
+
+ SDL_zero(fdesc);
+ fdesc.flags = DFDESC_HEIGHT;
+ fdesc.height = windata->theme.font_size;
+ SDL_DFB_CHECK(devdata->
+ dfb->CreateFont(devdata->dfb, windata->theme.font,
+ &fdesc, &windata->font));
+ SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
+ }
+}
+
+static void
+DrawCraption(_THIS, IDirectFBSurface * s, int x, int y, char *text)
+{
+ DFBSurfaceTextFlags flags;
+
+ flags = DSTF_CENTER | DSTF_TOP;
+
+ s->DrawString(s, text, -1, x, y, flags);
+}
+
+void
+DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ IDirectFBSurface *s = windata->window_surface;
+ DFB_Theme *t = &windata->theme;
+ int i;
+ int d = (t->caption_size - t->font_size) / 2;
+ int x, y, w;
+
+
+ if (!windata->is_managed || (window->flags & SDL_WINDOW_FULLSCREEN))
+ return;
+
+ SDL_DFB_CHECK(s->SetSrcBlendFunction(s, DSBF_ONE));
+ SDL_DFB_CHECK(s->SetDstBlendFunction(s, DSBF_ZERO));
+ SDL_DFB_CHECK(s->SetDrawingFlags(s, DSDRAW_NOFX));
+ SDL_DFB_CHECK(s->SetBlittingFlags(s, DSBLIT_NOFX));
+
+ LoadFont(_this, window);
+ /* s->SetDrawingFlags(s, DSDRAW_BLEND); */
+ s->SetColor(s, COLOR_EXPAND(t->frame_color));
+ /* top */
+ for (i = 0; i < t->top_size; i++)
+ s->DrawLine(s, 0, i, windata->size.w, i);
+ /* bottom */
+ for (i = windata->size.h - t->bottom_size; i < windata->size.h; i++)
+ s->DrawLine(s, 0, i, windata->size.w, i);
+ /* left */
+ for (i = 0; i < t->left_size; i++)
+ s->DrawLine(s, i, 0, i, windata->size.h);
+ /* right */
+ for (i = windata->size.w - t->right_size; i < windata->size.w; i++)
+ s->DrawLine(s, i, 0, i, windata->size.h);
+ /* Caption */
+ s->SetColor(s, COLOR_EXPAND(t->caption_color));
+ s->FillRectangle(s, t->left_size, t->top_size, windata->client.w,
+ t->caption_size);
+ /* Close Button */
+ w = t->caption_size;
+ x = windata->size.w - t->right_size - w + d;
+ y = t->top_size + d;
+ s->SetColor(s, COLOR_EXPAND(t->close_color));
+ DrawTriangle(s, 1, x, y, w - 2 * d);
+ /* Max Button */
+ s->SetColor(s, COLOR_EXPAND(t->max_color));
+ DrawTriangle(s, window->flags & SDL_WINDOW_MAXIMIZED ? 1 : 0, x - w,
+ y, w - 2 * d);
+
+ /* Caption */
+ if (*window->title) {
+ s->SetColor(s, COLOR_EXPAND(t->font_color));
+ DrawCraption(_this, s, (x - w) / 2, t->top_size + d, window->title);
+ }
+ /* Icon */
+ if (windata->icon) {
+ DFBRectangle dr;
+
+ dr.x = t->left_size + d;
+ dr.y = t->top_size + d;
+ dr.w = w - 2 * d;
+ dr.h = w - 2 * d;
+ s->SetBlittingFlags(s, DSBLIT_BLEND_ALPHACHANNEL);
+
+ s->StretchBlit(s, windata->icon, NULL, &dr);
+ }
+ windata->wm_needs_redraw = 0;
+}
+
+DFBResult
+DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch)
+{
+ SDL_DFB_WINDOWDATA(window);
+ IDirectFBWindow *dfbwin = windata->dfbwin;
+
+ SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, cw, ch));
+ dfbwin->GetSize(dfbwin, cw, ch);
+ *cw -= windata->theme.left_size + windata->theme.right_size;
+ *ch -=
+ windata->theme.top_size + windata->theme.caption_size +
+ windata->theme.bottom_size;
+ return DFB_OK;
+}
+
+void
+DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h)
+{
+ SDL_DFB_WINDOWDATA(window);
+
+ if (!windata->is_managed)
+ windata->theme = theme_none;
+ else if (flags & SDL_WINDOW_BORDERLESS)
+ /* desc.caps |= DWCAPS_NODECORATION;) */
+ windata->theme = theme_none;
+ else if (flags & SDL_WINDOW_FULLSCREEN) {
+ windata->theme = theme_none;
+ } else if (flags & SDL_WINDOW_MAXIMIZED) {
+ windata->theme = theme_std;
+ windata->theme.left_size = 0;
+ windata->theme.right_size = 0;
+ windata->theme.top_size = 0;
+ windata->theme.bottom_size = 0;
+ } else {
+ windata->theme = theme_std;
+ }
+
+ windata->client.x = windata->theme.left_size;
+ windata->client.y = windata->theme.top_size + windata->theme.caption_size;
+ windata->client.w = w;
+ windata->client.h = h;
+ windata->size.w =
+ w + windata->theme.left_size + windata->theme.right_size;
+ windata->size.h =
+ h + windata->theme.top_size +
+ windata->theme.caption_size + windata->theme.bottom_size;
+}
+
+
+enum
+{
+ WM_POS_NONE = 0x00,
+ WM_POS_CAPTION = 0x01,
+ WM_POS_CLOSE = 0x02,
+ WM_POS_MAX = 0x04,
+ WM_POS_LEFT = 0x08,
+ WM_POS_RIGHT = 0x10,
+ WM_POS_TOP = 0x20,
+ WM_POS_BOTTOM = 0x40,
+};
+
+static int
+WMIsClient(DFB_WindowData * p, int x, int y)
+{
+ x -= p->client.x;
+ y -= p->client.y;
+ if (x < 0 || y < 0)
+ return 0;
+ if (x >= p->client.w || y >= p->client.h)
+ return 0;
+ return 1;
+}
+
+static int
+WMPos(DFB_WindowData * p, int x, int y)
+{
+ int pos = WM_POS_NONE;
+
+ if (!WMIsClient(p, x, y)) {
+ if (y < p->theme.top_size) {
+ pos |= WM_POS_TOP;
+ } else if (y < p->client.y) {
+ if (x <
+ p->size.w - p->theme.right_size - 2 * p->theme.caption_size) {
+ pos |= WM_POS_CAPTION;
+ } else if (x <
+ p->size.w - p->theme.right_size -
+ p->theme.caption_size) {
+ pos |= WM_POS_MAX;
+ } else {
+ pos |= WM_POS_CLOSE;
+ }
+ } else if (y >= p->size.h - p->theme.bottom_size) {
+ pos |= WM_POS_BOTTOM;
+ }
+ if (x < p->theme.left_size) {
+ pos |= WM_POS_LEFT;
+ } else if (x >= p->size.w - p->theme.right_size) {
+ pos |= WM_POS_RIGHT;
+ }
+ }
+ return pos;
+}
+
+int
+DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(window);
+ DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
+ IDirectFBWindow *dfbwin = windata->dfbwin;
+ DFBWindowOptions wopts;
+
+ if (!windata->is_managed)
+ return 0;
+
+ SDL_DFB_CHECK(dfbwin->GetOptions(dfbwin, &wopts));
+
+ switch (evt->type) {
+ case DWET_BUTTONDOWN:
+ if (evt->buttons & DIBM_LEFT) {
+ int pos = WMPos(windata, evt->x, evt->y);
+ switch (pos) {
+ case WM_POS_NONE:
+ return 0;
+ case WM_POS_CLOSE:
+ windata->wm_grab = WM_POS_NONE;
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0,
+ 0);
+ return 1;
+ case WM_POS_MAX:
+ windata->wm_grab = WM_POS_NONE;
+ if (window->flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_RestoreWindow(window);
+ } else {
+ SDL_MaximizeWindow(window);
+ }
+ return 1;
+ case WM_POS_CAPTION:
+ if (!(wopts & DWOP_KEEP_STACKING)) {
+ DirectFB_RaiseWindow(_this, window);
+ }
+ if (window->flags & SDL_WINDOW_MAXIMIZED)
+ return 1;
+ /* fall through */
+ default:
+ windata->wm_grab = pos;
+ if (gwindata != NULL)
+ SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
+ SDL_DFB_CHECK(dfbwin->GrabPointer(dfbwin));
+ windata->wm_lastx = evt->cx;
+ windata->wm_lasty = evt->cy;
+ }
+ }
+ return 1;
+ case DWET_BUTTONUP:
+ if (!windata->wm_grab)
+ return 0;
+ if (!(evt->buttons & DIBM_LEFT)) {
+ if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
+ int dx = evt->cx - windata->wm_lastx;
+ int dy = evt->cy - windata->wm_lasty;
+
+ if (!(wopts & DWOP_KEEP_SIZE)) {
+ int cw, ch;
+ if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
+ dx = 0;
+ else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
+ dy = 0;
+ SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
+
+ /* necessary to trigger an event - ugly */
+ SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
+ SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx + 1, ch + dy));
+ SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
+
+ SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
+ }
+ }
+ SDL_DFB_CHECK(dfbwin->UngrabPointer(dfbwin));
+ if (gwindata != NULL)
+ SDL_DFB_CHECK(gwindata->dfbwin->GrabPointer(gwindata->dfbwin));
+ windata->wm_grab = WM_POS_NONE;
+ return 1;
+ }
+ break;
+ case DWET_MOTION:
+ if (!windata->wm_grab)
+ return 0;
+ if (evt->buttons & DIBM_LEFT) {
+ int dx = evt->cx - windata->wm_lastx;
+ int dy = evt->cy - windata->wm_lasty;
+
+ if (windata->wm_grab & WM_POS_CAPTION) {
+ if (!(wopts & DWOP_KEEP_POSITION))
+ SDL_DFB_CHECK(dfbwin->Move(dfbwin, dx, dy));
+ }
+ if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
+ if (!(wopts & DWOP_KEEP_SIZE)) {
+ int cw, ch;
+
+ /* Make sure all events are disabled for this operation ! */
+ SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
+
+ if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
+ dx = 0;
+ else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
+ dy = 0;
+
+ SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
+ SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
+
+ SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
+ }
+ }
+ windata->wm_lastx = evt->cx;
+ windata->wm_lasty = evt->cy;
+ return 1;
+ }
+ break;
+ case DWET_KEYDOWN:
+ break;
+ case DWET_KEYUP:
+ break;
+ default:
+ ;
+ }
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.h
new file mode 100644
index 0000000..98d943f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_WM.h
@@ -0,0 +1,56 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_directfb_wm_h_
+#define SDL_directfb_wm_h_
+
+#include "SDL_DirectFB_video.h"
+
+typedef struct _DFB_Theme DFB_Theme;
+struct _DFB_Theme
+{
+ int left_size;
+ int right_size;
+ int top_size;
+ int bottom_size;
+ DFBColor frame_color;
+ int caption_size;
+ DFBColor caption_color;
+ int font_size;
+ DFBColor font_color;
+ char *font;
+ DFBColor close_color;
+ DFBColor max_color;
+};
+
+extern void DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h);
+extern void DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window);
+
+extern int DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window,
+ DFBWindowEvent * evt);
+
+extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window,
+ int *cw, int *ch);
+
+
+#endif /* SDL_directfb_wm_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.c
new file mode 100644
index 0000000..12cf21a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.c
@@ -0,0 +1,117 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_dyn.h"
+
+#ifdef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+#define DFB_SYM(ret, name, args, al, func) ret (*name) args;
+static struct _SDL_DirectFB_Symbols
+{
+ DFB_SYMS
+ const unsigned int *directfb_major_version;
+ const unsigned int *directfb_minor_version;
+ const unsigned int *directfb_micro_version;
+} SDL_DirectFB_Symbols;
+#undef DFB_SYM
+
+#define DFB_SYM(ret, name, args, al, func) ret name args { func SDL_DirectFB_Symbols.name al ; }
+DFB_SYMS
+#undef DFB_SYM
+
+static void *handle = NULL;
+
+int
+SDL_DirectFB_LoadLibrary(void)
+{
+ int retval = 0;
+
+ if (handle == NULL) {
+ handle = SDL_LoadObject(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC);
+ if (handle != NULL) {
+ retval = 1;
+#define DFB_SYM(ret, name, args, al, func) if (!(SDL_DirectFB_Symbols.name = SDL_LoadFunction(handle, # name))) retval = 0;
+ DFB_SYMS
+#undef DFB_SYM
+ if (!
+ (SDL_DirectFB_Symbols.directfb_major_version =
+ SDL_LoadFunction(handle, "directfb_major_version")))
+ retval = 0;
+ if (!
+ (SDL_DirectFB_Symbols.directfb_minor_version =
+ SDL_LoadFunction(handle, "directfb_minor_version")))
+ retval = 0;
+ if (!
+ (SDL_DirectFB_Symbols.directfb_micro_version =
+ SDL_LoadFunction(handle, "directfb_micro_version")))
+ retval = 0;
+ }
+ }
+ if (retval) {
+ const char *stemp = DirectFBCheckVersion(DIRECTFB_MAJOR_VERSION,
+ DIRECTFB_MINOR_VERSION,
+ DIRECTFB_MICRO_VERSION);
+ /* Version Check */
+ if (stemp != NULL) {
+ fprintf(stderr,
+ "DirectFB Lib: Version mismatch. Compiled: %d.%d.%d Library %d.%d.%d\n",
+ DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION,
+ DIRECTFB_MICRO_VERSION,
+ *SDL_DirectFB_Symbols.directfb_major_version,
+ *SDL_DirectFB_Symbols.directfb_minor_version,
+ *SDL_DirectFB_Symbols.directfb_micro_version);
+ retval = 0;
+ }
+ }
+ if (!retval)
+ SDL_DirectFB_UnLoadLibrary();
+ return retval;
+}
+
+void
+SDL_DirectFB_UnLoadLibrary(void)
+{
+ if (handle != NULL) {
+ SDL_UnloadObject(handle);
+ handle = NULL;
+ }
+}
+
+#else
+int
+SDL_DirectFB_LoadLibrary(void)
+{
+ return 1;
+}
+
+void
+SDL_DirectFB_UnLoadLibrary(void)
+{
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.h
new file mode 100644
index 0000000..1a370c6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_dyn.h
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_DirectFB_dyn_h_
+#define SDL_DirectFB_dyn_h_
+
+#define DFB_SYMS \
+ DFB_SYM(DFBResult, DirectFBError, (const char *msg, DFBResult result), (msg, result), return) \
+ DFB_SYM(DFBResult, DirectFBErrorFatal, (const char *msg, DFBResult result), (msg, result), return) \
+ DFB_SYM(const char *, DirectFBErrorString, (DFBResult result), (result), return) \
+ DFB_SYM(const char *, DirectFBUsageString, ( void ), (), return) \
+ DFB_SYM(DFBResult, DirectFBInit, (int *argc, char *(*argv[]) ), (argc, argv), return) \
+ DFB_SYM(DFBResult, DirectFBSetOption, (const char *name, const char *value), (name, value), return) \
+ DFB_SYM(DFBResult, DirectFBCreate, (IDirectFB **interface), (interface), return) \
+ DFB_SYM(const char *, DirectFBCheckVersion, (unsigned int required_major, unsigned int required_minor, unsigned int required_micro), \
+ (required_major, required_minor, required_micro), return)
+
+int SDL_DirectFB_LoadLibrary(void);
+void SDL_DirectFB_UnLoadLibrary(void);
+
+#endif /* SDL_DirectFB_dyn_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.c
new file mode 100644
index 0000000..27cf19f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.c
@@ -0,0 +1,748 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+/* Handle the event stream, converting DirectFB input events into SDL events */
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_window.h"
+#include "SDL_DirectFB_modes.h"
+
+#include "SDL_syswm.h"
+
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_windowevents_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/scancodes_linux.h"
+#include "../../events/scancodes_xfree86.h"
+
+#include "SDL_DirectFB_events.h"
+
+#if USE_MULTI_API
+#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y, p)
+#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button)
+#define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode)
+#define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text)
+#else
+#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y)
+#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button)
+#define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode)
+#define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text)
+#endif
+
+typedef struct _cb_data cb_data;
+struct _cb_data
+{
+ DFB_DeviceData *devdata;
+ int sys_ids;
+ int sys_kbd;
+};
+
+/* The translation tables from a DirectFB keycode to a SDL keysym */
+static SDL_Scancode oskeymap[256];
+
+
+static SDL_Keysym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt,
+ SDL_Keysym * keysym, Uint32 *unicode);
+static SDL_Keysym *DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
+ SDL_Keysym * keysym, Uint32 *unicode);
+
+static void DirectFB_InitOSKeymap(_THIS, SDL_Scancode * keypmap, int numkeys);
+static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
+
+static void UnicodeToUtf8( Uint16 w , char *utf8buf)
+{
+ unsigned char *utf8s = (unsigned char *) utf8buf;
+
+ if ( w < 0x0080 ) {
+ utf8s[0] = ( unsigned char ) w;
+ utf8s[1] = 0;
+ }
+ else if ( w < 0x0800 ) {
+ utf8s[0] = 0xc0 | (( w ) >> 6 );
+ utf8s[1] = 0x80 | (( w ) & 0x3f );
+ utf8s[2] = 0;
+ }
+ else {
+ utf8s[0] = 0xe0 | (( w ) >> 12 );
+ utf8s[1] = 0x80 | (( ( w ) >> 6 ) & 0x3f );
+ utf8s[2] = 0x80 | (( w ) & 0x3f );
+ utf8s[3] = 0;
+ }
+}
+
+static void
+FocusAllMice(_THIS, SDL_Window *window)
+{
+#if USE_MULTI_API
+ SDL_DFB_DEVICEDATA(_this);
+ int index;
+
+ for (index = 0; index < devdata->num_mice; index++)
+ SDL_SetMouseFocus(devdata->mouse_id[index], id);
+#else
+ SDL_SetMouseFocus(window);
+#endif
+}
+
+
+static void
+FocusAllKeyboards(_THIS, SDL_Window *window)
+{
+#if USE_MULTI_API
+ SDL_DFB_DEVICEDATA(_this);
+ int index;
+
+ for (index = 0; index < devdata->num_keyboard; index++)
+ SDL_SetKeyboardFocus(index, id);
+#else
+ SDL_SetKeyboardFocus(window);
+#endif
+}
+
+static void
+MotionAllMice(_THIS, int x, int y)
+{
+#if USE_MULTI_API
+ SDL_DFB_DEVICEDATA(_this);
+ int index;
+
+ for (index = 0; index < devdata->num_mice; index++) {
+ SDL_Mouse *mouse = SDL_GetMouse(index);
+ mouse->x = mouse->last_x = x;
+ mouse->y = mouse->last_y = y;
+ /* SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0); */
+ }
+#endif
+}
+
+static int
+KbdIndex(_THIS, int id)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ int index;
+
+ for (index = 0; index < devdata->num_keyboard; index++) {
+ if (devdata->keyboard[index].id == id)
+ return index;
+ }
+ return -1;
+}
+
+static int
+ClientXY(DFB_WindowData * p, int *x, int *y)
+{
+ int cx, cy;
+
+ cx = *x;
+ cy = *y;
+
+ cx -= p->client.x;
+ cy -= p->client.y;
+
+ if (cx < 0 || cy < 0)
+ return 0;
+ if (cx >= p->client.w || cy >= p->client.h)
+ return 0;
+ *x = cx;
+ *y = cy;
+ return 1;
+}
+
+static void
+ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(sdlwin);
+ SDL_Keysym keysym;
+ Uint32 unicode;
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+
+ if (evt->clazz == DFEC_WINDOW) {
+ switch (evt->type) {
+ case DWET_BUTTONDOWN:
+ if (ClientXY(windata, &evt->x, &evt->y)) {
+ if (!devdata->use_linux_input) {
+ SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0, evt->x,
+ evt->y, 0);
+ SDL_SendMouseButton_ex(sdlwin, devdata->mouse_id[0],
+ SDL_PRESSED,
+ DirectFB_TranslateButton
+ (evt->button));
+ } else {
+ MotionAllMice(_this, evt->x, evt->y);
+ }
+ }
+ break;
+ case DWET_BUTTONUP:
+ if (ClientXY(windata, &evt->x, &evt->y)) {
+ if (!devdata->use_linux_input) {
+ SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0, evt->x,
+ evt->y, 0);
+ SDL_SendMouseButton_ex(sdlwin, devdata->mouse_id[0],
+ SDL_RELEASED,
+ DirectFB_TranslateButton
+ (evt->button));
+ } else {
+ MotionAllMice(_this, evt->x, evt->y);
+ }
+ }
+ break;
+ case DWET_MOTION:
+ if (ClientXY(windata, &evt->x, &evt->y)) {
+ if (!devdata->use_linux_input) {
+ if (!(sdlwin->flags & SDL_WINDOW_INPUT_GRABBED))
+ SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0,
+ evt->x, evt->y, 0);
+ } else {
+ /* relative movements are not exact!
+ * This code should limit the number of events sent.
+ * However it kills MAME axis recognition ... */
+ static int cnt = 0;
+ if (1 && ++cnt > 20) {
+ MotionAllMice(_this, evt->x, evt->y);
+ cnt = 0;
+ }
+ }
+ if (!(sdlwin->flags & SDL_WINDOW_MOUSE_FOCUS))
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0,
+ 0);
+ }
+ break;
+ case DWET_KEYDOWN:
+ if (!devdata->use_linux_input) {
+ DirectFB_TranslateKey(_this, evt, &keysym, &unicode);
+ /* printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */
+ SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
+ if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+ SDL_zero(text);
+ UnicodeToUtf8(unicode, text);
+ if (*text) {
+ SDL_SendKeyboardText_ex(0, text);
+ }
+ }
+ }
+ break;
+ case DWET_KEYUP:
+ if (!devdata->use_linux_input) {
+ DirectFB_TranslateKey(_this, evt, &keysym, &unicode);
+ SDL_SendKeyboardKey_ex(0, SDL_RELEASED, keysym.scancode);
+ }
+ break;
+ case DWET_POSITION:
+ if (ClientXY(windata, &evt->x, &evt->y)) {
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_MOVED,
+ evt->x, evt->y);
+ }
+ break;
+ case DWET_POSITION_SIZE:
+ if (ClientXY(windata, &evt->x, &evt->y)) {
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_MOVED,
+ evt->x, evt->y);
+ }
+ /* fall throught */
+ case DWET_SIZE:
+ /* FIXME: what about < 0 */
+ evt->w -= (windata->theme.right_size + windata->theme.left_size);
+ evt->h -=
+ (windata->theme.top_size + windata->theme.bottom_size +
+ windata->theme.caption_size);
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_RESIZED,
+ evt->w, evt->h);
+ break;
+ case DWET_CLOSE:
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_CLOSE, 0, 0);
+ break;
+ case DWET_GOTFOCUS:
+ DirectFB_SetContext(_this, sdlwin);
+ FocusAllKeyboards(_this, sdlwin);
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_FOCUS_GAINED,
+ 0, 0);
+ break;
+ case DWET_LOSTFOCUS:
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
+ FocusAllKeyboards(_this, 0);
+ break;
+ case DWET_ENTER:
+ /* SDL_DirectFB_ReshowCursor(_this, 0); */
+ FocusAllMice(_this, sdlwin);
+ /* FIXME: when do we really enter ? */
+ if (ClientXY(windata, &evt->x, &evt->y))
+ MotionAllMice(_this, evt->x, evt->y);
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0, 0);
+ break;
+ case DWET_LEAVE:
+ SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_LEAVE, 0, 0);
+ FocusAllMice(_this, 0);
+ /* SDL_DirectFB_ReshowCursor(_this, 1); */
+ break;
+ default:
+ ;
+ }
+ } else
+ printf("Event Clazz %d\n", evt->clazz);
+}
+
+static void
+ProcessInputEvent(_THIS, DFBInputEvent * ievt)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_Keysym keysym;
+ int kbd_idx;
+ Uint32 unicode;
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+
+ if (!devdata->use_linux_input) {
+ if (ievt->type == DIET_AXISMOTION) {
+ if ((devdata->grabbed_window != NULL) && (ievt->flags & DIEF_AXISREL)) {
+ if (ievt->axis == DIAI_X)
+ SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1,
+ ievt->axisrel, 0, 0);
+ else if (ievt->axis == DIAI_Y)
+ SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1, 0,
+ ievt->axisrel, 0);
+ }
+ }
+ } else {
+ static int last_x, last_y;
+
+ switch (ievt->type) {
+ case DIET_AXISMOTION:
+ if (ievt->flags & DIEF_AXISABS) {
+ if (ievt->axis == DIAI_X)
+ last_x = ievt->axisabs;
+ else if (ievt->axis == DIAI_Y)
+ last_y = ievt->axisabs;
+ if (!(ievt->flags & DIEF_FOLLOW)) {
+#if USE_MULTI_API
+ SDL_Mouse *mouse = SDL_GetMouse(ievt->device_id);
+ SDL_Window *window = SDL_GetWindowFromID(mouse->focus);
+#else
+ SDL_Window *window = devdata->grabbed_window;
+#endif
+ if (window) {
+ DFB_WindowData *windata =
+ (DFB_WindowData *) window->driverdata;
+ int x, y;
+
+ windata->dfbwin->GetPosition(windata->dfbwin, &x, &y);
+ SDL_SendMouseMotion_ex(window, ievt->device_id, 0,
+ last_x - (x +
+ windata->client.x),
+ last_y - (y +
+ windata->client.y), 0);
+ } else {
+ SDL_SendMouseMotion_ex(window, ievt->device_id, 0, last_x,
+ last_y, 0);
+ }
+ }
+ } else if (ievt->flags & DIEF_AXISREL) {
+ if (ievt->axis == DIAI_X)
+ SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1,
+ ievt->axisrel, 0, 0);
+ else if (ievt->axis == DIAI_Y)
+ SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1, 0,
+ ievt->axisrel, 0);
+ }
+ break;
+ case DIET_KEYPRESS:
+ kbd_idx = KbdIndex(_this, ievt->device_id);
+ DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym, &unicode);
+ /* printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */
+ SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
+ if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+ SDL_zero(text);
+ UnicodeToUtf8(unicode, text);
+ if (*text) {
+ SDL_SendKeyboardText_ex(kbd_idx, text);
+ }
+ }
+ break;
+ case DIET_KEYRELEASE:
+ kbd_idx = KbdIndex(_this, ievt->device_id);
+ DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym, &unicode);
+ SDL_SendKeyboardKey_ex(kbd_idx, SDL_RELEASED, keysym.scancode);
+ break;
+ case DIET_BUTTONPRESS:
+ if (ievt->buttons & DIBM_LEFT)
+ SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 1);
+ if (ievt->buttons & DIBM_MIDDLE)
+ SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 2);
+ if (ievt->buttons & DIBM_RIGHT)
+ SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 3);
+ break;
+ case DIET_BUTTONRELEASE:
+ if (!(ievt->buttons & DIBM_LEFT))
+ SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 1);
+ if (!(ievt->buttons & DIBM_MIDDLE))
+ SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 2);
+ if (!(ievt->buttons & DIBM_RIGHT))
+ SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 3);
+ break;
+ default:
+ break; /* please gcc */
+ }
+ }
+}
+
+void
+DirectFB_PumpEventsWindow(_THIS)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ DFBInputEvent ievt;
+ SDL_Window *w;
+
+ for (w = devdata->firstwin; w != NULL; w = w->next) {
+ SDL_DFB_WINDOWDATA(w);
+ DFBWindowEvent evt;
+
+ while (windata->eventbuffer->GetEvent(windata->eventbuffer,
+ DFB_EVENT(&evt)) == DFB_OK) {
+ if (!DirectFB_WM_ProcessEvent(_this, w, &evt)) {
+ /* Send a SDL_SYSWMEVENT if the application wants them */
+ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
+ SDL_SysWMmsg wmmsg;
+ SDL_VERSION(&wmmsg.version);
+ wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
+ wmmsg.msg.dfb.event.window = evt;
+ SDL_SendSysWMEvent(&wmmsg);
+ }
+ ProcessWindowEvent(_this, w, &evt);
+ }
+ }
+ }
+
+ /* Now get relative events in case we need them */
+ while (devdata->events->GetEvent(devdata->events,
+ DFB_EVENT(&ievt)) == DFB_OK) {
+
+ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
+ SDL_SysWMmsg wmmsg;
+ SDL_VERSION(&wmmsg.version);
+ wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
+ wmmsg.msg.dfb.event.input = ievt;
+ SDL_SendSysWMEvent(&wmmsg);
+ }
+ ProcessInputEvent(_this, &ievt);
+ }
+}
+
+void
+DirectFB_InitOSKeymap(_THIS, SDL_Scancode * keymap, int numkeys)
+{
+ int i;
+
+ /* Initialize the DirectFB key translation table */
+ for (i = 0; i < numkeys; ++i)
+ keymap[i] = SDL_SCANCODE_UNKNOWN;
+
+ keymap[DIKI_A - DIKI_UNKNOWN] = SDL_SCANCODE_A;
+ keymap[DIKI_B - DIKI_UNKNOWN] = SDL_SCANCODE_B;
+ keymap[DIKI_C - DIKI_UNKNOWN] = SDL_SCANCODE_C;
+ keymap[DIKI_D - DIKI_UNKNOWN] = SDL_SCANCODE_D;
+ keymap[DIKI_E - DIKI_UNKNOWN] = SDL_SCANCODE_E;
+ keymap[DIKI_F - DIKI_UNKNOWN] = SDL_SCANCODE_F;
+ keymap[DIKI_G - DIKI_UNKNOWN] = SDL_SCANCODE_G;
+ keymap[DIKI_H - DIKI_UNKNOWN] = SDL_SCANCODE_H;
+ keymap[DIKI_I - DIKI_UNKNOWN] = SDL_SCANCODE_I;
+ keymap[DIKI_J - DIKI_UNKNOWN] = SDL_SCANCODE_J;
+ keymap[DIKI_K - DIKI_UNKNOWN] = SDL_SCANCODE_K;
+ keymap[DIKI_L - DIKI_UNKNOWN] = SDL_SCANCODE_L;
+ keymap[DIKI_M - DIKI_UNKNOWN] = SDL_SCANCODE_M;
+ keymap[DIKI_N - DIKI_UNKNOWN] = SDL_SCANCODE_N;
+ keymap[DIKI_O - DIKI_UNKNOWN] = SDL_SCANCODE_O;
+ keymap[DIKI_P - DIKI_UNKNOWN] = SDL_SCANCODE_P;
+ keymap[DIKI_Q - DIKI_UNKNOWN] = SDL_SCANCODE_Q;
+ keymap[DIKI_R - DIKI_UNKNOWN] = SDL_SCANCODE_R;
+ keymap[DIKI_S - DIKI_UNKNOWN] = SDL_SCANCODE_S;
+ keymap[DIKI_T - DIKI_UNKNOWN] = SDL_SCANCODE_T;
+ keymap[DIKI_U - DIKI_UNKNOWN] = SDL_SCANCODE_U;
+ keymap[DIKI_V - DIKI_UNKNOWN] = SDL_SCANCODE_V;
+ keymap[DIKI_W - DIKI_UNKNOWN] = SDL_SCANCODE_W;
+ keymap[DIKI_X - DIKI_UNKNOWN] = SDL_SCANCODE_X;
+ keymap[DIKI_Y - DIKI_UNKNOWN] = SDL_SCANCODE_Y;
+ keymap[DIKI_Z - DIKI_UNKNOWN] = SDL_SCANCODE_Z;
+
+ keymap[DIKI_0 - DIKI_UNKNOWN] = SDL_SCANCODE_0;
+ keymap[DIKI_1 - DIKI_UNKNOWN] = SDL_SCANCODE_1;
+ keymap[DIKI_2 - DIKI_UNKNOWN] = SDL_SCANCODE_2;
+ keymap[DIKI_3 - DIKI_UNKNOWN] = SDL_SCANCODE_3;
+ keymap[DIKI_4 - DIKI_UNKNOWN] = SDL_SCANCODE_4;
+ keymap[DIKI_5 - DIKI_UNKNOWN] = SDL_SCANCODE_5;
+ keymap[DIKI_6 - DIKI_UNKNOWN] = SDL_SCANCODE_6;
+ keymap[DIKI_7 - DIKI_UNKNOWN] = SDL_SCANCODE_7;
+ keymap[DIKI_8 - DIKI_UNKNOWN] = SDL_SCANCODE_8;
+ keymap[DIKI_9 - DIKI_UNKNOWN] = SDL_SCANCODE_9;
+
+ keymap[DIKI_F1 - DIKI_UNKNOWN] = SDL_SCANCODE_F1;
+ keymap[DIKI_F2 - DIKI_UNKNOWN] = SDL_SCANCODE_F2;
+ keymap[DIKI_F3 - DIKI_UNKNOWN] = SDL_SCANCODE_F3;
+ keymap[DIKI_F4 - DIKI_UNKNOWN] = SDL_SCANCODE_F4;
+ keymap[DIKI_F5 - DIKI_UNKNOWN] = SDL_SCANCODE_F5;
+ keymap[DIKI_F6 - DIKI_UNKNOWN] = SDL_SCANCODE_F6;
+ keymap[DIKI_F7 - DIKI_UNKNOWN] = SDL_SCANCODE_F7;
+ keymap[DIKI_F8 - DIKI_UNKNOWN] = SDL_SCANCODE_F8;
+ keymap[DIKI_F9 - DIKI_UNKNOWN] = SDL_SCANCODE_F9;
+ keymap[DIKI_F10 - DIKI_UNKNOWN] = SDL_SCANCODE_F10;
+ keymap[DIKI_F11 - DIKI_UNKNOWN] = SDL_SCANCODE_F11;
+ keymap[DIKI_F12 - DIKI_UNKNOWN] = SDL_SCANCODE_F12;
+
+ keymap[DIKI_ESCAPE - DIKI_UNKNOWN] = SDL_SCANCODE_ESCAPE;
+ keymap[DIKI_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_LEFT;
+ keymap[DIKI_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_RIGHT;
+ keymap[DIKI_UP - DIKI_UNKNOWN] = SDL_SCANCODE_UP;
+ keymap[DIKI_DOWN - DIKI_UNKNOWN] = SDL_SCANCODE_DOWN;
+ keymap[DIKI_CONTROL_L - DIKI_UNKNOWN] = SDL_SCANCODE_LCTRL;
+ keymap[DIKI_CONTROL_R - DIKI_UNKNOWN] = SDL_SCANCODE_RCTRL;
+ keymap[DIKI_SHIFT_L - DIKI_UNKNOWN] = SDL_SCANCODE_LSHIFT;
+ keymap[DIKI_SHIFT_R - DIKI_UNKNOWN] = SDL_SCANCODE_RSHIFT;
+ keymap[DIKI_ALT_L - DIKI_UNKNOWN] = SDL_SCANCODE_LALT;
+ keymap[DIKI_ALT_R - DIKI_UNKNOWN] = SDL_SCANCODE_RALT;
+ keymap[DIKI_META_L - DIKI_UNKNOWN] = SDL_SCANCODE_LGUI;
+ keymap[DIKI_META_R - DIKI_UNKNOWN] = SDL_SCANCODE_RGUI;
+ keymap[DIKI_SUPER_L - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
+ keymap[DIKI_SUPER_R - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
+ /* FIXME:Do we read hyper keys ?
+ * keymap[DIKI_HYPER_L - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
+ * keymap[DIKI_HYPER_R - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
+ */
+ keymap[DIKI_TAB - DIKI_UNKNOWN] = SDL_SCANCODE_TAB;
+ keymap[DIKI_ENTER - DIKI_UNKNOWN] = SDL_SCANCODE_RETURN;
+ keymap[DIKI_SPACE - DIKI_UNKNOWN] = SDL_SCANCODE_SPACE;
+ keymap[DIKI_BACKSPACE - DIKI_UNKNOWN] = SDL_SCANCODE_BACKSPACE;
+ keymap[DIKI_INSERT - DIKI_UNKNOWN] = SDL_SCANCODE_INSERT;
+ keymap[DIKI_DELETE - DIKI_UNKNOWN] = SDL_SCANCODE_DELETE;
+ keymap[DIKI_HOME - DIKI_UNKNOWN] = SDL_SCANCODE_HOME;
+ keymap[DIKI_END - DIKI_UNKNOWN] = SDL_SCANCODE_END;
+ keymap[DIKI_PAGE_UP - DIKI_UNKNOWN] = SDL_SCANCODE_PAGEUP;
+ keymap[DIKI_PAGE_DOWN - DIKI_UNKNOWN] = SDL_SCANCODE_PAGEDOWN;
+ keymap[DIKI_CAPS_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_CAPSLOCK;
+ keymap[DIKI_NUM_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_NUMLOCKCLEAR;
+ keymap[DIKI_SCROLL_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_SCROLLLOCK;
+ keymap[DIKI_PRINT - DIKI_UNKNOWN] = SDL_SCANCODE_PRINTSCREEN;
+ keymap[DIKI_PAUSE - DIKI_UNKNOWN] = SDL_SCANCODE_PAUSE;
+
+ keymap[DIKI_KP_EQUAL - DIKI_UNKNOWN] = SDL_SCANCODE_KP_EQUALS;
+ keymap[DIKI_KP_DECIMAL - DIKI_UNKNOWN] = SDL_SCANCODE_KP_PERIOD;
+ keymap[DIKI_KP_0 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_0;
+ keymap[DIKI_KP_1 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_1;
+ keymap[DIKI_KP_2 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_2;
+ keymap[DIKI_KP_3 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_3;
+ keymap[DIKI_KP_4 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_4;
+ keymap[DIKI_KP_5 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_5;
+ keymap[DIKI_KP_6 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_6;
+ keymap[DIKI_KP_7 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_7;
+ keymap[DIKI_KP_8 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_8;
+ keymap[DIKI_KP_9 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_9;
+ keymap[DIKI_KP_DIV - DIKI_UNKNOWN] = SDL_SCANCODE_KP_DIVIDE;
+ keymap[DIKI_KP_MULT - DIKI_UNKNOWN] = SDL_SCANCODE_KP_MULTIPLY;
+ keymap[DIKI_KP_MINUS - DIKI_UNKNOWN] = SDL_SCANCODE_KP_MINUS;
+ keymap[DIKI_KP_PLUS - DIKI_UNKNOWN] = SDL_SCANCODE_KP_PLUS;
+ keymap[DIKI_KP_ENTER - DIKI_UNKNOWN] = SDL_SCANCODE_KP_ENTER;
+
+ keymap[DIKI_QUOTE_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_GRAVE; /* TLDE */
+ keymap[DIKI_MINUS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_MINUS; /* AE11 */
+ keymap[DIKI_EQUALS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_EQUALS; /* AE12 */
+ keymap[DIKI_BRACKET_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_RIGHTBRACKET; /* AD11 */
+ keymap[DIKI_BRACKET_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_LEFTBRACKET; /* AD12 */
+ keymap[DIKI_BACKSLASH - DIKI_UNKNOWN] = SDL_SCANCODE_BACKSLASH; /* BKSL */
+ keymap[DIKI_SEMICOLON - DIKI_UNKNOWN] = SDL_SCANCODE_SEMICOLON; /* AC10 */
+ keymap[DIKI_QUOTE_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_APOSTROPHE; /* AC11 */
+ keymap[DIKI_COMMA - DIKI_UNKNOWN] = SDL_SCANCODE_COMMA; /* AB08 */
+ keymap[DIKI_PERIOD - DIKI_UNKNOWN] = SDL_SCANCODE_PERIOD; /* AB09 */
+ keymap[DIKI_SLASH - DIKI_UNKNOWN] = SDL_SCANCODE_SLASH; /* AB10 */
+ keymap[DIKI_LESS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_NONUSBACKSLASH; /* 103rd */
+
+}
+
+static SDL_Keysym *
+DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_Keysym * keysym, Uint32 *unicode)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ int kbd_idx = 0; /* Window events lag the device source KbdIndex(_this, evt->device_id); */
+ DFB_KeyboardData *kbd = &devdata->keyboard[kbd_idx];
+
+ keysym->scancode = SDL_SCANCODE_UNKNOWN;
+
+ if (kbd->map && evt->key_code >= kbd->map_adjust &&
+ evt->key_code < kbd->map_size + kbd->map_adjust)
+ keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
+
+ if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
+ devdata->keyboard[kbd_idx].is_generic) {
+ if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
+ keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
+ else
+ keysym->scancode = SDL_SCANCODE_UNKNOWN;
+ }
+
+ *unicode =
+ (DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
+ if (*unicode == 0 &&
+ (evt->key_symbol > 0 && evt->key_symbol < 255))
+ *unicode = evt->key_symbol;
+
+ return keysym;
+}
+
+static SDL_Keysym *
+DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
+ SDL_Keysym * keysym, Uint32 *unicode)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ int kbd_idx = KbdIndex(_this, evt->device_id);
+ DFB_KeyboardData *kbd = &devdata->keyboard[kbd_idx];
+
+ keysym->scancode = SDL_SCANCODE_UNKNOWN;
+
+ if (kbd->map && evt->key_code >= kbd->map_adjust &&
+ evt->key_code < kbd->map_size + kbd->map_adjust)
+ keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
+
+ if (keysym->scancode == SDL_SCANCODE_UNKNOWN || devdata->keyboard[kbd_idx].is_generic) {
+ if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
+ keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
+ else
+ keysym->scancode = SDL_SCANCODE_UNKNOWN;
+ }
+
+ *unicode =
+ (DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
+ if (*unicode == 0 &&
+ (evt->key_symbol > 0 && evt->key_symbol < 255))
+ *unicode = evt->key_symbol;
+
+ return keysym;
+}
+
+static int
+DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button)
+{
+ switch (button) {
+ case DIBI_LEFT:
+ return 1;
+ case DIBI_MIDDLE:
+ return 2;
+ case DIBI_RIGHT:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+static DFBEnumerationResult
+EnumKeyboards(DFBInputDeviceID device_id,
+ DFBInputDeviceDescription desc, void *callbackdata)
+{
+ cb_data *cb = callbackdata;
+ DFB_DeviceData *devdata = cb->devdata;
+#if USE_MULTI_API
+ SDL_Keyboard keyboard;
+#endif
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+
+ if (!cb->sys_kbd) {
+ if (cb->sys_ids) {
+ if (device_id >= 0x10)
+ return DFENUM_OK;
+ } else {
+ if (device_id < 0x10)
+ return DFENUM_OK;
+ }
+ } else {
+ if (device_id != DIDID_KEYBOARD)
+ return DFENUM_OK;
+ }
+
+ if ((desc.caps & DIDTF_KEYBOARD)) {
+#if USE_MULTI_API
+ SDL_zero(keyboard);
+ SDL_AddKeyboard(&keyboard, devdata->num_keyboard);
+#endif
+ devdata->keyboard[devdata->num_keyboard].id = device_id;
+ devdata->keyboard[devdata->num_keyboard].is_generic = 0;
+ if (!strncmp("X11", desc.name, 3))
+ {
+ devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2;
+ devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2);
+ devdata->keyboard[devdata->num_keyboard].map_adjust = 8;
+ } else {
+ devdata->keyboard[devdata->num_keyboard].map = linux_scancode_table;
+ devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(linux_scancode_table);
+ devdata->keyboard[devdata->num_keyboard].map_adjust = 0;
+ }
+
+ SDL_DFB_LOG("Keyboard %d - %s\n", device_id, desc.name);
+
+ SDL_GetDefaultKeymap(keymap);
+#if USE_MULTI_API
+ SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES);
+#else
+ SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+#endif
+ devdata->num_keyboard++;
+
+ if (cb->sys_kbd)
+ return DFENUM_CANCEL;
+ }
+ return DFENUM_OK;
+}
+
+void
+DirectFB_InitKeyboard(_THIS)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ cb_data cb;
+
+ DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
+
+ devdata->num_keyboard = 0;
+ cb.devdata = devdata;
+
+ if (devdata->use_linux_input) {
+ cb.sys_kbd = 0;
+ cb.sys_ids = 0;
+ SDL_DFB_CHECK(devdata->dfb->
+ EnumInputDevices(devdata->dfb, EnumKeyboards, &cb));
+ if (devdata->num_keyboard == 0) {
+ cb.sys_ids = 1;
+ SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
+ EnumKeyboards,
+ &cb));
+ }
+ } else {
+ cb.sys_kbd = 1;
+ SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
+ EnumKeyboards,
+ &cb));
+ }
+}
+
+void
+DirectFB_QuitKeyboard(_THIS)
+{
+ /* SDL_DFB_DEVICEDATA(_this); */
+}
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.h
new file mode 100644
index 0000000..ccbdb0a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_events.h
@@ -0,0 +1,34 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_DirectFB_events_h_
+#define SDL_DirectFB_events_h_
+
+#include "../SDL_sysvideo.h"
+
+/* Functions to be exported */
+extern void DirectFB_InitKeyboard(_THIS);
+extern void DirectFB_QuitKeyboard(_THIS);
+extern void DirectFB_PumpEventsWindow(_THIS);
+
+#endif /* SDL_DirectFB_events_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.c
new file mode 100644
index 0000000..a3b8b45
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.c
@@ -0,0 +1,414 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_modes.h"
+
+#define DFB_MAX_MODES 200
+
+struct screen_callback_t
+{
+ int numscreens;
+ DFBScreenID screenid[DFB_MAX_SCREENS];
+ DFBDisplayLayerID gralayer[DFB_MAX_SCREENS];
+ DFBDisplayLayerID vidlayer[DFB_MAX_SCREENS];
+ int aux; /* auxiliary integer for callbacks */
+};
+
+struct modes_callback_t
+{
+ int nummodes;
+ SDL_DisplayMode *modelist;
+};
+
+static DFBEnumerationResult
+EnumModesCallback(int width, int height, int bpp, void *data)
+{
+ struct modes_callback_t *modedata = (struct modes_callback_t *) data;
+ SDL_DisplayMode mode;
+
+ mode.w = width;
+ mode.h = height;
+ mode.refresh_rate = 0;
+ mode.driverdata = NULL;
+ mode.format = SDL_PIXELFORMAT_UNKNOWN;
+
+ if (modedata->nummodes < DFB_MAX_MODES) {
+ modedata->modelist[modedata->nummodes++] = mode;
+ }
+
+ return DFENUM_OK;
+}
+
+static DFBEnumerationResult
+EnumScreensCallback(DFBScreenID screen_id, DFBScreenDescription desc,
+ void *callbackdata)
+{
+ struct screen_callback_t *devdata = (struct screen_callback_t *) callbackdata;
+
+ devdata->screenid[devdata->numscreens++] = screen_id;
+ return DFENUM_OK;
+}
+
+static DFBEnumerationResult
+EnumLayersCallback(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc,
+ void *callbackdata)
+{
+ struct screen_callback_t *devdata = (struct screen_callback_t *) callbackdata;
+
+ if (desc.caps & DLCAPS_SURFACE) {
+ if ((desc.type & DLTF_GRAPHICS) && (desc.type & DLTF_VIDEO)) {
+ if (devdata->vidlayer[devdata->aux] == -1)
+ devdata->vidlayer[devdata->aux] = layer_id;
+ } else if (desc.type & DLTF_GRAPHICS) {
+ if (devdata->gralayer[devdata->aux] == -1)
+ devdata->gralayer[devdata->aux] = layer_id;
+ }
+ }
+ return DFENUM_OK;
+}
+
+static void
+CheckSetDisplayMode(_THIS, SDL_VideoDisplay * display, DFB_DisplayData * data, SDL_DisplayMode * mode)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ DFBDisplayLayerConfig config;
+ DFBDisplayLayerConfigFlags failed;
+
+ SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
+ DLSCL_ADMINISTRATIVE));
+ config.width = mode->w;
+ config.height = mode->h;
+ config.pixelformat = DirectFB_SDLToDFBPixelFormat(mode->format);
+ config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
+ if (devdata->use_yuv_underlays) {
+ config.flags |= DLCONF_OPTIONS;
+ config.options = DLOP_ALPHACHANNEL;
+ }
+ failed = 0;
+ data->layer->TestConfiguration(data->layer, &config, &failed);
+ SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
+ DLSCL_SHARED));
+ if (failed == 0)
+ {
+ SDL_AddDisplayMode(display, mode);
+ SDL_DFB_LOG("Mode %d x %d Added\n", mode->w, mode->h);
+ }
+ else
+ SDL_DFB_ERR("Mode %d x %d not available: %x\n", mode->w,
+ mode->h, failed);
+
+ return;
+ error:
+ return;
+}
+
+
+void
+DirectFB_SetContext(_THIS, SDL_Window *window)
+{
+#if (DFB_VERSION_ATLEAST(1,0,0))
+ /* FIXME: does not work on 1.0/1.2 with radeon driver
+ * the approach did work with the matrox driver
+ * This has simply no effect.
+ */
+
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+
+ /* FIXME: should we handle the error */
+ if (dispdata->vidIDinuse)
+ SDL_DFB_CHECK(dispdata->vidlayer->SwitchContext(dispdata->vidlayer,
+ DFB_TRUE));
+#endif
+}
+
+void
+DirectFB_InitModes(_THIS)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ IDirectFBDisplayLayer *layer = NULL;
+ SDL_VideoDisplay display;
+ DFB_DisplayData *dispdata = NULL;
+ SDL_DisplayMode mode;
+ DFBGraphicsDeviceDescription caps;
+ DFBDisplayLayerConfig dlc;
+ struct screen_callback_t *screencbdata;
+
+ int tcw[DFB_MAX_SCREENS];
+ int tch[DFB_MAX_SCREENS];
+ int i;
+ DFBResult ret;
+
+ SDL_DFB_ALLOC_CLEAR(screencbdata, sizeof(*screencbdata));
+
+ screencbdata->numscreens = 0;
+
+ for (i = 0; i < DFB_MAX_SCREENS; i++) {
+ screencbdata->gralayer[i] = -1;
+ screencbdata->vidlayer[i] = -1;
+ }
+
+ SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &EnumScreensCallback,
+ screencbdata));
+
+ for (i = 0; i < screencbdata->numscreens; i++) {
+ IDirectFBScreen *screen;
+
+ SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb,
+ screencbdata->screenid
+ [i], &screen));
+
+ screencbdata->aux = i;
+ SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &EnumLayersCallback,
+ screencbdata));
+ screen->GetSize(screen, &tcw[i], &tch[i]);
+
+ screen->Release(screen);
+ }
+
+ /* Query card capabilities */
+
+ devdata->dfb->GetDeviceDescription(devdata->dfb, &caps);
+
+ for (i = 0; i < screencbdata->numscreens; i++) {
+ SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
+ screencbdata->gralayer
+ [i], &layer));
+
+ SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer,
+ DLSCL_ADMINISTRATIVE));
+ layer->EnableCursor(layer, 1);
+ SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0));
+
+ if (devdata->use_yuv_underlays) {
+ dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
+ dlc.pixelformat = DSPF_ARGB;
+ dlc.options = DLOP_ALPHACHANNEL;
+
+ ret = layer->SetConfiguration(layer, &dlc);
+ if (ret != DFB_OK) {
+ /* try AiRGB if the previous failed */
+ dlc.pixelformat = DSPF_AiRGB;
+ SDL_DFB_CHECKERR(layer->SetConfiguration(layer, &dlc));
+ }
+ }
+
+ /* Query layer configuration to determine the current mode and pixelformat */
+ dlc.flags = DLCONF_ALL;
+ SDL_DFB_CHECKERR(layer->GetConfiguration(layer, &dlc));
+
+ mode.format = DirectFB_DFBToSDLPixelFormat(dlc.pixelformat);
+
+ if (mode.format == SDL_PIXELFORMAT_UNKNOWN) {
+ SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat);
+ goto error;
+ }
+
+ mode.w = dlc.width;
+ mode.h = dlc.height;
+ mode.refresh_rate = 0;
+ mode.driverdata = NULL;
+
+ SDL_DFB_ALLOC_CLEAR(dispdata, sizeof(*dispdata));
+
+ dispdata->layer = layer;
+ dispdata->pixelformat = dlc.pixelformat;
+ dispdata->cw = tcw[i];
+ dispdata->ch = tch[i];
+
+ /* YUV - Video layer */
+
+ dispdata->vidID = screencbdata->vidlayer[i];
+ dispdata->vidIDinuse = 0;
+
+ SDL_zero(display);
+
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ display.driverdata = dispdata;
+
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ dlc.flags =
+ DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
+ DLCONF_OPTIONS;
+ ret = layer->SetConfiguration(layer, &dlc);
+#endif
+
+ SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
+
+ SDL_AddVideoDisplay(&display);
+ }
+ SDL_DFB_FREE(screencbdata);
+ return;
+ error:
+ /* FIXME: Cleanup not complete, Free existing displays */
+ SDL_DFB_FREE(dispdata);
+ SDL_DFB_RELEASE(layer);
+ return;
+}
+
+void
+DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+ SDL_DisplayMode mode;
+ struct modes_callback_t data;
+ int i;
+
+ data.nummodes = 0;
+ /* Enumerate the available fullscreen modes */
+ SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode));
+ SDL_DFB_CHECKERR(devdata->dfb->EnumVideoModes(devdata->dfb,
+ EnumModesCallback, &data));
+
+ for (i = 0; i < data.nummodes; ++i) {
+ mode = data.modelist[i];
+
+ mode.format = SDL_PIXELFORMAT_ARGB8888;
+ CheckSetDisplayMode(_this, display, dispdata, &mode);
+ mode.format = SDL_PIXELFORMAT_RGB888;
+ CheckSetDisplayMode(_this, display, dispdata, &mode);
+ mode.format = SDL_PIXELFORMAT_RGB24;
+ CheckSetDisplayMode(_this, display, dispdata, &mode);
+ mode.format = SDL_PIXELFORMAT_RGB565;
+ CheckSetDisplayMode(_this, display, dispdata, &mode);
+ mode.format = SDL_PIXELFORMAT_INDEX8;
+ CheckSetDisplayMode(_this, display, dispdata, &mode);
+ }
+
+ SDL_DFB_FREE(data.modelist);
+error:
+ return;
+}
+
+int
+DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ /*
+ * FIXME: video mode switch is currently broken for 1.2.0
+ *
+ */
+
+ SDL_DFB_DEVICEDATA(_this);
+ DFB_DisplayData *data = (DFB_DisplayData *) display->driverdata;
+ DFBDisplayLayerConfig config, rconfig;
+ DFBDisplayLayerConfigFlags fail = 0;
+
+ SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
+ DLSCL_ADMINISTRATIVE));
+
+ SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config));
+ config.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
+ if (mode->format != SDL_PIXELFORMAT_UNKNOWN) {
+ config.flags |= DLCONF_PIXELFORMAT;
+ config.pixelformat = DirectFB_SDLToDFBPixelFormat(mode->format);
+ data->pixelformat = config.pixelformat;
+ }
+ config.width = mode->w;
+ config.height = mode->h;
+
+ if (devdata->use_yuv_underlays) {
+ config.flags |= DLCONF_OPTIONS;
+ config.options = DLOP_ALPHACHANNEL;
+ }
+
+ data->layer->TestConfiguration(data->layer, &config, &fail);
+
+ if (fail &
+ (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
+ DLCONF_OPTIONS)) {
+ SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
+ mode->format);
+ return -1;
+ }
+
+ config.flags &= ~fail;
+ SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ /* Need to call this twice ! */
+ SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
+#endif
+
+ /* Double check */
+ SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig));
+ SDL_DFB_CHECKERR(data->
+ layer->SetCooperativeLevel(data->layer, DLSCL_SHARED));
+
+ if ((config.width != rconfig.width) || (config.height != rconfig.height)
+ || ((mode->format != SDL_PIXELFORMAT_UNKNOWN)
+ && (config.pixelformat != rconfig.pixelformat))) {
+ SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
+ mode->format);
+ return -1;
+ }
+
+ data->pixelformat = rconfig.pixelformat;
+ data->cw = config.width;
+ data->ch = config.height;
+ display->current_mode = *mode;
+
+ return 0;
+ error:
+ return -1;
+}
+
+void
+DirectFB_QuitModes(_THIS)
+{
+ SDL_DisplayMode tmode;
+ int i;
+
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+
+ SDL_GetDesktopDisplayMode(i, &tmode);
+ tmode.format = SDL_PIXELFORMAT_UNKNOWN;
+ DirectFB_SetDisplayMode(_this, display, &tmode);
+
+ SDL_GetDesktopDisplayMode(i, &tmode);
+ DirectFB_SetDisplayMode(_this, display, &tmode);
+
+ if (dispdata->layer) {
+ SDL_DFB_CHECK(dispdata->
+ layer->SetCooperativeLevel(dispdata->layer,
+ DLSCL_ADMINISTRATIVE));
+ SDL_DFB_CHECK(dispdata->
+ layer->SetCursorOpacity(dispdata->layer, 0x00));
+ SDL_DFB_CHECK(dispdata->
+ layer->SetCooperativeLevel(dispdata->layer,
+ DLSCL_SHARED));
+ }
+
+ SDL_DFB_RELEASE(dispdata->layer);
+ SDL_DFB_RELEASE(dispdata->vidlayer);
+
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.h
new file mode 100644
index 0000000..75d8bbf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_modes.h
@@ -0,0 +1,59 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_directfb_modes_h_
+#define SDL_directfb_modes_h_
+
+#include <directfb.h>
+
+#include "../SDL_sysvideo.h"
+
+#define SDL_DFB_DISPLAYDATA(win) DFB_DisplayData *dispdata = ((win) ? (DFB_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata : NULL)
+
+typedef struct _DFB_DisplayData DFB_DisplayData;
+struct _DFB_DisplayData
+{
+ IDirectFBDisplayLayer *layer;
+ DFBSurfacePixelFormat pixelformat;
+ /* FIXME: support for multiple video layer.
+ * However, I do not know any card supporting
+ * more than one
+ */
+ DFBDisplayLayerID vidID;
+ IDirectFBDisplayLayer *vidlayer;
+
+ int vidIDinuse;
+
+ int cw;
+ int ch;
+};
+
+
+extern void DirectFB_InitModes(_THIS);
+extern void DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+extern int DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+extern void DirectFB_QuitModes(_THIS);
+
+extern void DirectFB_SetContext(_THIS, SDL_Window *window);
+
+#endif /* SDL_directfb_modes_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.c
new file mode 100644
index 0000000..a2b3e41
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.c
@@ -0,0 +1,389 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_assert.h"
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_mouse.h"
+#include "SDL_DirectFB_modes.h"
+#include "SDL_DirectFB_window.h"
+
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_mouse_c.h"
+
+static SDL_Cursor *DirectFB_CreateDefaultCursor(void);
+static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface,
+ int hot_x, int hot_y);
+static int DirectFB_ShowCursor(SDL_Cursor * cursor);
+static void DirectFB_FreeCursor(SDL_Cursor * cursor);
+static void DirectFB_WarpMouse(SDL_Window * window, int x, int y);
+
+static const char *arrow[] = {
+ /* pixels */
+ "X ",
+ "XX ",
+ "X.X ",
+ "X..X ",
+ "X...X ",
+ "X....X ",
+ "X.....X ",
+ "X......X ",
+ "X.......X ",
+ "X........X ",
+ "X.....XXXXX ",
+ "X..X..X ",
+ "X.X X..X ",
+ "XX X..X ",
+ "X X..X ",
+ " X..X ",
+ " X..X ",
+ " X..X ",
+ " XX ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+};
+
+static SDL_Cursor *
+DirectFB_CreateDefaultCursor(void)
+{
+ SDL_VideoDevice *dev = SDL_GetVideoDevice();
+
+ SDL_DFB_DEVICEDATA(dev);
+ DFB_CursorData *curdata;
+ DFBSurfaceDescription dsc;
+ SDL_Cursor *cursor;
+ Uint32 *dest;
+ int pitch, i, j;
+
+ SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor));
+ SDL_DFB_ALLOC_CLEAR(curdata, sizeof(*curdata));
+
+ dsc.flags =
+ DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
+ dsc.caps = DSCAPS_VIDEOONLY;
+ dsc.width = 32;
+ dsc.height = 32;
+ dsc.pixelformat = DSPF_ARGB;
+
+ SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
+ &curdata->surf));
+ curdata->hotx = 0;
+ curdata->hoty = 0;
+ cursor->driverdata = curdata;
+
+ SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
+ (void *) &dest, &pitch));
+
+ /* Relies on the fact that this is only called with ARGB surface. */
+ for (i = 0; i < 32; i++)
+ {
+ for (j = 0; j < 32; j++)
+ {
+ switch (arrow[i][j])
+ {
+ case ' ': dest[j] = 0x00000000; break;
+ case '.': dest[j] = 0xffffffff; break;
+ case 'X': dest[j] = 0xff000000; break;
+ }
+ }
+ dest += (pitch >> 2);
+ }
+
+ curdata->surf->Unlock(curdata->surf);
+ return cursor;
+ error:
+ return NULL;
+}
+
+/* Create a cursor from a surface */
+static SDL_Cursor *
+DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ SDL_VideoDevice *dev = SDL_GetVideoDevice();
+
+ SDL_DFB_DEVICEDATA(dev);
+ DFB_CursorData *curdata;
+ DFBSurfaceDescription dsc;
+ SDL_Cursor *cursor;
+ Uint32 *dest;
+ Uint32 *p;
+ int pitch, i;
+
+ SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+ SDL_assert(surface->pitch == surface->w * 4);
+
+ SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor));
+ SDL_DFB_ALLOC_CLEAR(curdata, sizeof(*curdata));
+
+ dsc.flags =
+ DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
+ dsc.caps = DSCAPS_VIDEOONLY;
+ dsc.width = surface->w;
+ dsc.height = surface->h;
+ dsc.pixelformat = DSPF_ARGB;
+
+ SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
+ &curdata->surf));
+ curdata->hotx = hot_x;
+ curdata->hoty = hot_y;
+ cursor->driverdata = curdata;
+
+ SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
+ (void *) &dest, &pitch));
+
+ p = surface->pixels;
+ for (i = 0; i < surface->h; i++)
+ memcpy((char *) dest + i * pitch,
+ (char *) p + i * surface->pitch, 4 * surface->w);
+
+ curdata->surf->Unlock(curdata->surf);
+ return cursor;
+ error:
+ return NULL;
+}
+
+/* Show the specified cursor, or hide if cursor is NULL */
+static int
+DirectFB_ShowCursor(SDL_Cursor * cursor)
+{
+ SDL_DFB_CURSORDATA(cursor);
+ SDL_Window *window;
+
+ window = SDL_GetFocusWindow();
+ if (!window)
+ return -1;
+ else {
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+
+ if (display) {
+ DFB_DisplayData *dispdata =
+ (DFB_DisplayData *) display->driverdata;
+ DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
+
+ if (cursor)
+ SDL_DFB_CHECKERR(windata->dfbwin->
+ SetCursorShape(windata->dfbwin,
+ curdata->surf, curdata->hotx,
+ curdata->hoty));
+
+ SDL_DFB_CHECKERR(dispdata->layer->
+ SetCooperativeLevel(dispdata->layer,
+ DLSCL_ADMINISTRATIVE));
+ SDL_DFB_CHECKERR(dispdata->layer->
+ SetCursorOpacity(dispdata->layer,
+ cursor ? 0xC0 : 0x00));
+ SDL_DFB_CHECKERR(dispdata->layer->
+ SetCooperativeLevel(dispdata->layer,
+ DLSCL_SHARED));
+ }
+ }
+
+ return 0;
+ error:
+ return -1;
+}
+
+/* Free a window manager cursor */
+static void
+DirectFB_FreeCursor(SDL_Cursor * cursor)
+{
+ SDL_DFB_CURSORDATA(cursor);
+
+ SDL_DFB_RELEASE(curdata->surf);
+ SDL_DFB_FREE(cursor->driverdata);
+ SDL_DFB_FREE(cursor);
+}
+
+/* Warp the mouse to (x,y) */
+static void
+DirectFB_WarpMouse(SDL_Window * window, int x, int y)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+ DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
+ int cx, cy;
+
+ SDL_DFB_CHECKERR(windata->dfbwin->GetPosition(windata->dfbwin, &cx, &cy));
+ SDL_DFB_CHECKERR(dispdata->layer->WarpCursor(dispdata->layer,
+ cx + x + windata->client.x,
+ cy + y + windata->client.y));
+
+ error:
+ return;
+}
+
+#if USE_MULTI_API
+
+static void DirectFB_MoveCursor(SDL_Cursor * cursor);
+static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window,
+ int x, int y);
+static void DirectFB_FreeMouse(SDL_Mouse * mouse);
+
+static int id_mask;
+
+static DFBEnumerationResult
+EnumMice(DFBInputDeviceID device_id, DFBInputDeviceDescription desc,
+ void *callbackdata)
+{
+ DFB_DeviceData *devdata = callbackdata;
+
+ if ((desc.type & DIDTF_MOUSE) && (device_id & id_mask)) {
+ SDL_Mouse mouse;
+
+ SDL_zero(mouse);
+ mouse.id = device_id;
+ mouse.CreateCursor = DirectFB_CreateCursor;
+ mouse.ShowCursor = DirectFB_ShowCursor;
+ mouse.MoveCursor = DirectFB_MoveCursor;
+ mouse.FreeCursor = DirectFB_FreeCursor;
+ mouse.WarpMouse = DirectFB_WarpMouse;
+ mouse.FreeMouse = DirectFB_FreeMouse;
+ mouse.cursor_shown = 1;
+
+ SDL_AddMouse(&mouse, desc.name, 0, 0, 1);
+ devdata->mouse_id[devdata->num_mice++] = device_id;
+ }
+ return DFENUM_OK;
+}
+
+void
+DirectFB_InitMouse(_THIS)
+{
+ SDL_DFB_DEVICEDATA(_this);
+
+ devdata->num_mice = 0;
+ if (devdata->use_linux_input) {
+ /* try non-core devices first */
+ id_mask = 0xF0;
+ devdata->dfb->EnumInputDevices(devdata->dfb, EnumMice, devdata);
+ if (devdata->num_mice == 0) {
+ /* try core devices */
+ id_mask = 0x0F;
+ devdata->dfb->EnumInputDevices(devdata->dfb, EnumMice, devdata);
+ }
+ }
+ if (devdata->num_mice == 0) {
+ SDL_Mouse mouse;
+
+ SDL_zero(mouse);
+ mouse.CreateCursor = DirectFB_CreateCursor;
+ mouse.ShowCursor = DirectFB_ShowCursor;
+ mouse.MoveCursor = DirectFB_MoveCursor;
+ mouse.FreeCursor = DirectFB_FreeCursor;
+ mouse.WarpMouse = DirectFB_WarpMouse;
+ mouse.FreeMouse = DirectFB_FreeMouse;
+ mouse.cursor_shown = 1;
+
+ SDL_AddMouse(&mouse, "Mouse", 0, 0, 1);
+ devdata->num_mice = 1;
+ }
+}
+
+void
+DirectFB_QuitMouse(_THIS)
+{
+ SDL_DFB_DEVICEDATA(_this);
+
+ if (devdata->use_linux_input) {
+ SDL_MouseQuit();
+ } else {
+ SDL_DelMouse(0);
+ }
+}
+
+
+/* This is called when a mouse motion event occurs */
+static void
+DirectFB_MoveCursor(SDL_Cursor * cursor)
+{
+
+}
+
+/* Warp the mouse to (x,y) */
+static void
+DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+ DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
+ DFBResult ret;
+ int cx, cy;
+
+ SDL_DFB_CHECKERR(windata->dfbwin->GetPosition(windata->dfbwin, &cx, &cy));
+ SDL_DFB_CHECKERR(dispdata->layer->WarpCursor(dispdata->layer,
+ cx + x + windata->client.x,
+ cy + y + windata->client.y));
+
+ error:
+ return;
+}
+
+/* Free the mouse when it's time */
+static void
+DirectFB_FreeMouse(SDL_Mouse * mouse)
+{
+ /* nothing yet */
+}
+
+#else /* USE_MULTI_API */
+
+void
+DirectFB_InitMouse(_THIS)
+{
+ SDL_DFB_DEVICEDATA(_this);
+
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = DirectFB_CreateCursor;
+ mouse->ShowCursor = DirectFB_ShowCursor;
+ mouse->WarpMouse = DirectFB_WarpMouse;
+ mouse->FreeCursor = DirectFB_FreeCursor;
+
+ SDL_SetDefaultCursor(DirectFB_CreateDefaultCursor());
+
+ devdata->num_mice = 1;
+}
+
+void
+DirectFB_QuitMouse(_THIS)
+{
+}
+
+
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.h
new file mode 100644
index 0000000..e1236a0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_mouse.h
@@ -0,0 +1,44 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_DirectFB_mouse_h_
+#define SDL_DirectFB_mouse_h_
+
+#include <directfb.h>
+
+#include "../SDL_sysvideo.h"
+
+typedef struct _DFB_CursorData DFB_CursorData;
+struct _DFB_CursorData
+{
+ IDirectFBSurface *surf;
+ int hotx;
+ int hoty;
+};
+
+#define SDL_DFB_CURSORDATA(curs) DFB_CursorData *curdata = (DFB_CursorData *) ((curs) ? (curs)->driverdata : NULL)
+
+extern void DirectFB_InitMouse(_THIS);
+extern void DirectFB_QuitMouse(_THIS);
+
+#endif /* SDL_DirectFB_mouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.c
new file mode 100644
index 0000000..93d2fde
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.c
@@ -0,0 +1,332 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_DirectFB_video.h"
+
+#if SDL_DIRECTFB_OPENGL
+
+#include "SDL_DirectFB_opengl.h"
+#include "SDL_DirectFB_window.h"
+
+#include <directfbgl.h>
+#include "SDL_loadso.h"
+#endif
+
+#if SDL_DIRECTFB_OPENGL
+
+struct SDL_GLDriverData
+{
+ int gl_active; /* to stop switching drivers while we have a valid context */
+ int initialized;
+ DirectFB_GLContext *firstgl; /* linked list */
+
+ /* OpenGL */
+ void (*glFinish) (void);
+ void (*glFlush) (void);
+};
+
+#define OPENGL_REQUIRS_DLOPEN
+#if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
+#include <dlfcn.h>
+#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
+#define GL_LoadFunction dlsym
+#define GL_UnloadObject dlclose
+#else
+#define GL_LoadObject SDL_LoadObject
+#define GL_LoadFunction SDL_LoadFunction
+#define GL_UnloadObject SDL_UnloadObject
+#endif
+
+static void DirectFB_GL_UnloadLibrary(_THIS);
+
+int
+DirectFB_GL_Initialize(_THIS)
+{
+ if (_this->gl_data) {
+ return 0;
+ }
+
+ _this->gl_data =
+ (struct SDL_GLDriverData *) SDL_calloc(1,
+ sizeof(struct
+ SDL_GLDriverData));
+ if (!_this->gl_data) {
+ return SDL_OutOfMemory();
+ }
+ _this->gl_data->initialized = 0;
+
+ ++_this->gl_data->initialized;
+ _this->gl_data->firstgl = NULL;
+
+ if (DirectFB_GL_LoadLibrary(_this, NULL) < 0) {
+ return -1;
+ }
+
+ /* Initialize extensions */
+ /* FIXME needed?
+ * X11_GL_InitExtensions(_this);
+ */
+
+ return 0;
+}
+
+void
+DirectFB_GL_Shutdown(_THIS)
+{
+ if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
+ return;
+ }
+
+ DirectFB_GL_UnloadLibrary(_this);
+
+ SDL_free(_this->gl_data);
+ _this->gl_data = NULL;
+}
+
+int
+DirectFB_GL_LoadLibrary(_THIS, const char *path)
+{
+ void *handle = NULL;
+
+ SDL_DFB_DEBUG("Loadlibrary : %s\n", path);
+
+ if (_this->gl_data->gl_active) {
+ return SDL_SetError("OpenGL context already created");
+ }
+
+
+ if (path == NULL) {
+ path = SDL_getenv("SDL_OPENGL_LIBRARY");
+ if (path == NULL) {
+ path = "libGL.so.1";
+ }
+ }
+
+ handle = GL_LoadObject(path);
+ if (handle == NULL) {
+ SDL_DFB_ERR("Library not found: %s\n", path);
+ /* SDL_LoadObject() will call SDL_SetError() for us. */
+ return -1;
+ }
+
+ SDL_DFB_DEBUG("Loaded library: %s\n", path);
+
+ _this->gl_config.dll_handle = handle;
+ if (path) {
+ SDL_strlcpy(_this->gl_config.driver_path, path,
+ SDL_arraysize(_this->gl_config.driver_path));
+ } else {
+ *_this->gl_config.driver_path = '\0';
+ }
+
+ _this->gl_data->glFinish = DirectFB_GL_GetProcAddress(_this, "glFinish");
+ _this->gl_data->glFlush = DirectFB_GL_GetProcAddress(_this, "glFlush");
+
+ return 0;
+}
+
+static void
+DirectFB_GL_UnloadLibrary(_THIS)
+{
+ #if 0
+ int ret = GL_UnloadObject(_this->gl_config.dll_handle);
+ if (ret)
+ SDL_DFB_ERR("Error #%d trying to unload library.\n", ret);
+ _this->gl_config.dll_handle = NULL;
+#endif
+ /* Free OpenGL memory */
+ SDL_free(_this->gl_data);
+ _this->gl_data = NULL;
+}
+
+void *
+DirectFB_GL_GetProcAddress(_THIS, const char *proc)
+{
+ void *handle;
+
+ handle = _this->gl_config.dll_handle;
+ return GL_LoadFunction(handle, proc);
+}
+
+SDL_GLContext
+DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ DirectFB_GLContext *context;
+
+ SDL_DFB_ALLOC_CLEAR(context, sizeof(DirectFB_GLContext));
+
+ SDL_DFB_CHECKERR(windata->surface->GetGL(windata->surface,
+ &context->context));
+
+ if (!context->context)
+ return NULL;
+
+ context->is_locked = 0;
+ context->sdl_window = window;
+
+ context->next = _this->gl_data->firstgl;
+ _this->gl_data->firstgl = context;
+
+ SDL_DFB_CHECK(context->context->Unlock(context->context));
+
+ if (DirectFB_GL_MakeCurrent(_this, window, context) < 0) {
+ DirectFB_GL_DeleteContext(_this, context);
+ return NULL;
+ }
+
+ return context;
+
+ error:
+ return NULL;
+}
+
+int
+DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ DirectFB_GLContext *ctx = (DirectFB_GLContext *) context;
+ DirectFB_GLContext *p;
+
+ for (p = _this->gl_data->firstgl; p; p = p->next)
+ {
+ if (p->is_locked) {
+ SDL_DFB_CHECKERR(p->context->Unlock(p->context));
+ p->is_locked = 0;
+ }
+
+ }
+
+ if (ctx != NULL) {
+ SDL_DFB_CHECKERR(ctx->context->Lock(ctx->context));
+ ctx->is_locked = 1;
+ }
+
+ return 0;
+ error:
+ return -1;
+}
+
+int
+DirectFB_GL_SetSwapInterval(_THIS, int interval)
+{
+ return SDL_Unsupported();
+}
+
+int
+DirectFB_GL_GetSwapInterval(_THIS)
+{
+ return 0;
+}
+
+int
+DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ DirectFB_GLContext *p;
+
+#if 0
+ if (devdata->glFinish)
+ devdata->glFinish();
+ else if (devdata->glFlush)
+ devdata->glFlush();
+#endif
+
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window && p->is_locked)
+ {
+ SDL_DFB_CHECKERR(p->context->Unlock(p->context));
+ p->is_locked = 0;
+ }
+
+ SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL, DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC ));
+ return 0;
+ error:
+ return -1;
+}
+
+void
+DirectFB_GL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ DirectFB_GLContext *ctx = (DirectFB_GLContext *) context;
+ DirectFB_GLContext *p;
+
+ if (ctx->is_locked)
+ SDL_DFB_CHECK(ctx->context->Unlock(ctx->context));
+ SDL_DFB_RELEASE(ctx->context);
+
+ for (p = _this->gl_data->firstgl; p && p->next != ctx; p = p->next)
+ ;
+ if (p)
+ p->next = ctx->next;
+ else
+ _this->gl_data->firstgl = ctx->next;
+
+ SDL_DFB_FREE(ctx);
+}
+
+void
+DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window)
+{
+ DirectFB_GLContext *p;
+
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window)
+ {
+ if (p->is_locked)
+ SDL_DFB_CHECK(p->context->Unlock(p->context));
+ SDL_DFB_RELEASE(p->context);
+ }
+}
+
+void
+DirectFB_GL_ReAllocWindowContexts(_THIS, SDL_Window * window)
+{
+ DirectFB_GLContext *p;
+
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window)
+ {
+ SDL_DFB_WINDOWDATA(window);
+ SDL_DFB_CHECK(windata->surface->GetGL(windata->surface,
+ &p->context));
+ if (p->is_locked)
+ SDL_DFB_CHECK(p->context->Lock(p->context));
+ }
+}
+
+void
+DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window)
+{
+ DirectFB_GLContext *p;
+
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window)
+ DirectFB_GL_DeleteContext(_this, p);
+}
+
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.h
new file mode 100644
index 0000000..9463e1b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_opengl.h
@@ -0,0 +1,64 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+#ifndef SDL_directfb_opengl_h_
+#define SDL_directfb_opengl_h_
+
+#include "SDL_DirectFB_video.h"
+
+#if SDL_DIRECTFB_OPENGL
+
+#include "SDL_opengl.h"
+
+typedef struct _DirectFB_GLContext DirectFB_GLContext;
+struct _DirectFB_GLContext
+{
+ IDirectFBGL *context;
+ DirectFB_GLContext *next;
+
+ SDL_Window *sdl_window;
+ int is_locked;
+};
+
+/* OpenGL functions */
+extern int DirectFB_GL_Initialize(_THIS);
+extern void DirectFB_GL_Shutdown(_THIS);
+
+extern int DirectFB_GL_LoadLibrary(_THIS, const char *path);
+extern void *DirectFB_GL_GetProcAddress(_THIS, const char *proc);
+extern SDL_GLContext DirectFB_GL_CreateContext(_THIS, SDL_Window * window);
+extern int DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window,
+ SDL_GLContext context);
+extern int DirectFB_GL_SetSwapInterval(_THIS, int interval);
+extern int DirectFB_GL_GetSwapInterval(_THIS);
+extern int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window);
+extern void DirectFB_GL_DeleteContext(_THIS, SDL_GLContext context);
+
+extern void DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window);
+extern void DirectFB_GL_ReAllocWindowContexts(_THIS, SDL_Window * window);
+extern void DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window);
+
+#endif /* SDL_DIRECTFB_OPENGL */
+
+#endif /* SDL_directfb_opengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.c
new file mode 100644
index 0000000..4054f73
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.c
@@ -0,0 +1,1335 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+#include "SDL_DirectFB_window.h"
+#include "SDL_DirectFB_modes.h"
+
+#include "SDL_syswm.h"
+#include "SDL_DirectFB_shape.h"
+
+#include "../SDL_sysvideo.h"
+#include "../../render/SDL_sysrender.h"
+
+#ifndef DFB_VERSION_ATLEAST
+
+#define DFB_VERSIONNUM(X, Y, Z) \
+ ((X)*1000 + (Y)*100 + (Z))
+
+#define DFB_COMPILEDVERSION \
+ DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
+
+#define DFB_VERSION_ATLEAST(X, Y, Z) \
+ (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
+
+#define SDL_DFB_CHECK(x) x
+
+#endif
+
+/* the following is not yet tested ... */
+#define USE_DISPLAY_PALETTE (0)
+
+
+#define SDL_DFB_RENDERERDATA(rend) DirectFB_RenderData *renddata = ((rend) ? (DirectFB_RenderData *) (rend)->driverdata : NULL)
+
+
+/* DirectFB renderer implementation */
+
+static SDL_Renderer *DirectFB_CreateRenderer(SDL_Window * window,
+ Uint32 flags);
+static void DirectFB_ActivateRenderer(SDL_Renderer * renderer);
+static int DirectFB_CreateTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int DirectFB_QueryTexturePixels(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ void **pixels, int *pitch);
+static int DirectFB_SetTexturePalette(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Color * colors,
+ int firstcolor, int ncolors);
+static int DirectFB_GetTexturePalette(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ SDL_Color * colors,
+ int firstcolor, int ncolors);
+static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int DirectFB_SetTextureBlendMode(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static int DirectFB_UpdateTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const void *pixels, int pitch);
+static int DirectFB_LockTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * rect,
+ void **pixels, int *pitch);
+static void DirectFB_UnlockTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static void DirectFB_DirtyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture, int numrects,
+ const SDL_Rect * rects);
+static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer);
+static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count);
+static int DirectFB_RenderDrawRects(SDL_Renderer * renderer,
+ const SDL_Rect ** rects, int count);
+static int DirectFB_RenderFillRects(SDL_Renderer * renderer,
+ const SDL_FRect * rects, int count);
+static int DirectFB_RenderCopy(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect);
+static void DirectFB_RenderPresent(SDL_Renderer * renderer);
+static void DirectFB_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
+static void DirectFB_DestroyRenderer(SDL_Renderer * renderer);
+static int DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch);
+static int DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, const void * pixels, int pitch);
+static int DirectFB_UpdateViewport(SDL_Renderer * renderer);
+static int DirectFB_UpdateClipRect(SDL_Renderer * renderer);
+static int DirectFB_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
+
+static int PrepareDraw(SDL_Renderer * renderer);
+
+
+#define SDL_DFB_WINDOWSURFACE(win) IDirectFBSurface *destsurf = ((DFB_WindowData *) ((win)->driverdata))->surface;
+
+SDL_RenderDriver DirectFB_RenderDriver = {
+ DirectFB_CreateRenderer,
+ {
+ "directfb",
+ (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
+ /* (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
+ SDL_TEXTUREMODULATE_ALPHA),
+ (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND |
+ SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
+ (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST |
+ SDL_SCALEMODE_SLOW | SDL_SCALEMODE_BEST), */
+ 0,
+ {
+ /* formats filled in later */
+ },
+ 0,
+ 0}
+};
+
+typedef struct
+{
+ SDL_Window *window;
+ DFBSurfaceFlipFlags flipflags;
+ int size_changed;
+ int lastBlendMode;
+ DFBSurfaceBlittingFlags blitFlags;
+ DFBSurfaceDrawingFlags drawFlags;
+ IDirectFBSurface* target;
+} DirectFB_RenderData;
+
+typedef struct
+{
+ IDirectFBSurface *surface;
+ Uint32 format;
+ void *pixels;
+ int pitch;
+ IDirectFBPalette *palette;
+ int isDirty;
+
+ SDL_VideoDisplay *display; /* only for yuv textures */
+
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ DFBSurfaceRenderOptions render_options;
+#endif
+} DirectFB_TextureData;
+
+static SDL_INLINE void
+SDLtoDFBRect(const SDL_Rect * sr, DFBRectangle * dr)
+{
+ dr->x = sr->x;
+ dr->y = sr->y;
+ dr->h = sr->h;
+ dr->w = sr->w;
+}
+static SDL_INLINE void
+SDLtoDFBRect_Float(const SDL_FRect * sr, DFBRectangle * dr)
+{
+ dr->x = sr->x;
+ dr->y = sr->y;
+ dr->h = sr->h;
+ dr->w = sr->w;
+}
+
+
+static int
+TextureHasAlpha(DirectFB_TextureData * data)
+{
+ /* Drawing primitive ? */
+ if (!data)
+ return 0;
+
+ return (DFB_PIXELFORMAT_HAS_ALPHA(DirectFB_SDLToDFBPixelFormat(data->format)) ? 1 : 0);
+#if 0
+ switch (data->format) {
+ case SDL_PIXELFORMAT_INDEX4LSB:
+ case SDL_PIXELFORMAT_INDEX4MSB:
+ case SDL_PIXELFORMAT_ARGB4444:
+ case SDL_PIXELFORMAT_ARGB1555:
+ case SDL_PIXELFORMAT_ARGB8888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ case SDL_PIXELFORMAT_ABGR8888:
+ case SDL_PIXELFORMAT_BGRA8888:
+ case SDL_PIXELFORMAT_ARGB2101010:
+ return 1;
+ default:
+ return 0;
+ }
+#endif
+}
+
+static SDL_INLINE IDirectFBSurface *get_dfb_surface(SDL_Window *window)
+{
+ SDL_SysWMinfo wm_info;
+ SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo));
+
+ SDL_VERSION(&wm_info.version);
+ if (!SDL_GetWindowWMInfo(window, &wm_info)) {
+ return NULL;
+ }
+
+ return wm_info.info.dfb.surface;
+}
+
+static SDL_INLINE IDirectFBWindow *get_dfb_window(SDL_Window *window)
+{
+ SDL_SysWMinfo wm_info;
+ SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo));
+
+ SDL_VERSION(&wm_info.version);
+ if (!SDL_GetWindowWMInfo(window, &wm_info)) {
+ return NULL;
+ }
+
+ return wm_info.info.dfb.window;
+}
+
+static void
+SetBlendMode(DirectFB_RenderData * data, int blendMode,
+ DirectFB_TextureData * source)
+{
+ IDirectFBSurface *destsurf = data->target;
+
+ /* FIXME: check for format change */
+ if (1 || data->lastBlendMode != blendMode) {
+ switch (blendMode) {
+ case SDL_BLENDMODE_NONE:
+ /**< No blending */
+ data->blitFlags = DSBLIT_NOFX;
+ data->drawFlags = DSDRAW_NOFX;
+ SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE));
+ SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO));
+ break;
+#if 0
+ case SDL_BLENDMODE_MASK:
+ data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
+ data->drawFlags = DSDRAW_BLEND;
+ SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
+ SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA));
+ break;
+#endif
+ case SDL_BLENDMODE_BLEND:
+ data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
+ data->drawFlags = DSDRAW_BLEND;
+ SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
+ SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA));
+ break;
+ case SDL_BLENDMODE_ADD:
+ data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
+ data->drawFlags = DSDRAW_BLEND;
+ /* FIXME: SRCALPHA kills performance on radeon ...
+ * It will be cheaper to copy the surface to a temporary surface and premultiply
+ */
+ if (source && TextureHasAlpha(source))
+ SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
+ else
+ SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE));
+ SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ONE));
+ break;
+ case SDL_BLENDMODE_MOD:
+ data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
+ data->drawFlags = DSDRAW_BLEND;
+ SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ZERO));
+ SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_SRCCOLOR));
+
+ break;
+ }
+ data->lastBlendMode = blendMode;
+ }
+}
+
+static int
+DisplayPaletteChanged(void *userdata, SDL_Palette * palette)
+{
+#if USE_DISPLAY_PALETTE
+ DirectFB_RenderData *data = (DirectFB_RenderData *) userdata;
+ SDL_DFB_WINDOWSURFACE(data->window);
+ IDirectFBPalette *surfpal;
+
+ int i;
+ int ncolors;
+ DFBColor entries[256];
+
+ SDL_DFB_CHECKERR(destsurf->GetPalette(destsurf, &surfpal));
+
+ /* FIXME: number of colors */
+ ncolors = (palette->ncolors < 256 ? palette->ncolors : 256);
+
+ for (i = 0; i < ncolors; ++i) {
+ entries[i].r = palette->colors[i].r;
+ entries[i].g = palette->colors[i].g;
+ entries[i].b = palette->colors[i].b;
+ entries[i].a = palette->colors[i].a;
+ }
+ SDL_DFB_CHECKERR(surfpal->SetEntries(surfpal, entries, ncolors, 0));
+ return 0;
+ error:
+#else
+ SDL_Unsupported();
+#endif
+ return -1;
+}
+
+static void
+DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
+{
+ SDL_DFB_RENDERERDATA(renderer);
+
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
+ /* Rebind the context to the window area and update matrices */
+ /* SDL_CurrentContext = NULL; */
+ /* data->updateSize = SDL_TRUE; */
+ renddata->size_changed = SDL_TRUE;
+ }
+}
+
+static int
+DirectFB_RenderClear(SDL_Renderer * renderer)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ PrepareDraw(renderer);
+
+ destsurf->Clear(destsurf, renderer->r, renderer->g, renderer->b, renderer->a);
+
+ return 0;
+}
+
+SDL_Renderer *
+DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
+{
+ IDirectFBSurface *winsurf = get_dfb_surface(window);
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_Renderer *renderer = NULL;
+ DirectFB_RenderData *data = NULL;
+ DFBSurfaceCapabilities scaps;
+
+ if (!winsurf) {
+ return NULL;
+ }
+
+ SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer));
+ SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
+
+ renderer->WindowEvent = DirectFB_WindowEvent;
+ renderer->CreateTexture = DirectFB_CreateTexture;
+ renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod;
+ renderer->SetTextureColorMod = DirectFB_SetTextureColorMod;
+ renderer->SetTextureBlendMode = DirectFB_SetTextureBlendMode;
+ renderer->UpdateTexture = DirectFB_UpdateTexture;
+ renderer->LockTexture = DirectFB_LockTexture;
+ renderer->RenderClear = DirectFB_RenderClear;
+ renderer->UnlockTexture = DirectFB_UnlockTexture;
+ renderer->RenderDrawPoints = DirectFB_RenderDrawPoints;
+ renderer->RenderDrawLines = DirectFB_RenderDrawLines;
+ /* SetDrawColor - no needed */
+ renderer->RenderFillRects = DirectFB_RenderFillRects;
+
+ renderer->RenderCopy = DirectFB_RenderCopy;
+ renderer->RenderPresent = DirectFB_RenderPresent;
+
+ /* FIXME: Yet to be tested */
+ renderer->RenderReadPixels = DirectFB_RenderReadPixels;
+ /* renderer->RenderWritePixels = DirectFB_RenderWritePixels; */
+
+ renderer->DestroyTexture = DirectFB_DestroyTexture;
+ renderer->DestroyRenderer = DirectFB_DestroyRenderer;
+ renderer->UpdateViewport = DirectFB_UpdateViewport;
+ renderer->UpdateClipRect = DirectFB_UpdateClipRect;
+ renderer->SetRenderTarget = DirectFB_SetRenderTarget;
+
+#if 0
+ renderer->QueryTexturePixels = DirectFB_QueryTexturePixels;
+ renderer->SetTexturePalette = DirectFB_SetTexturePalette;
+ renderer->GetTexturePalette = DirectFB_GetTexturePalette;
+ renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode;
+ renderer->DirtyTexture = DirectFB_DirtyTexture;
+ renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode;
+ renderer->RenderDrawRects = DirectFB_RenderDrawRects;
+#endif
+
+ renderer->info = DirectFB_RenderDriver.info;
+ renderer->window = window; /* SDL window */
+ renderer->driverdata = data;
+
+ renderer->info.flags =
+ SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
+
+ data->window = window;
+ data->target = winsurf;
+
+ data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT;
+
+ if (flags & SDL_RENDERER_PRESENTVSYNC) {
+ data->flipflags |= DSFLIP_WAITFORSYNC | DSFLIP_ONSYNC;
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
+ } else
+ data->flipflags |= DSFLIP_ONSYNC;
+
+ SDL_DFB_CHECKERR(winsurf->GetCapabilities(winsurf, &scaps));
+
+#if 0
+ if (scaps & DSCAPS_DOUBLE)
+ renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2;
+ else if (scaps & DSCAPS_TRIPLE)
+ renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3;
+ else
+ renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
+#endif
+
+ DirectFB_SetSupportedPixelFormats(&renderer->info);
+
+#if 0
+ /* Set up a palette watch on the display palette */
+ if (display-> palette) {
+ SDL_AddPaletteWatch(display->palette, DisplayPaletteChanged, data);
+ }
+#endif
+
+ return renderer;
+
+ error:
+ SDL_DFB_FREE(renderer);
+ SDL_DFB_FREE(data);
+ return NULL;
+}
+
+static void
+DirectFB_ActivateRenderer(SDL_Renderer * renderer)
+{
+ SDL_DFB_RENDERERDATA(renderer);
+ SDL_Window *window = renderer->window;
+ SDL_DFB_WINDOWDATA(window);
+
+ if (renddata->size_changed /* || windata->wm_needs_redraw */) {
+ renddata->size_changed = SDL_FALSE;
+ }
+}
+
+
+static int
+DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SDL_Window *window = renderer->window;
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DFB_DEVICEDATA(display->device);
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+ DirectFB_TextureData *data = texture->driverdata;
+ DFBDisplayLayerConfig layconf;
+ DFBResult ret;
+
+ if (devdata->use_yuv_direct && (dispdata->vidID >= 0)
+ && (!dispdata->vidIDinuse)
+ && SDL_ISPIXELFORMAT_FOURCC(data->format)) {
+ layconf.flags =
+ DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
+ DLCONF_SURFACE_CAPS;
+ layconf.width = texture->w;
+ layconf.height = texture->h;
+ layconf.pixelformat = DirectFB_SDLToDFBPixelFormat(data->format);
+ layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE;
+
+ SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
+ dispdata->vidID,
+ &dispdata->vidlayer));
+ SDL_DFB_CHECKERR(dispdata->
+ vidlayer->SetCooperativeLevel(dispdata->vidlayer,
+ DLSCL_EXCLUSIVE));
+
+ if (devdata->use_yuv_underlays) {
+ ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1);
+ if (ret != DFB_OK)
+ SDL_DFB_DEBUG("Underlay Setlevel not supported\n");
+ }
+ SDL_DFB_CHECKERR(dispdata->
+ vidlayer->SetConfiguration(dispdata->vidlayer,
+ &layconf));
+ SDL_DFB_CHECKERR(dispdata->
+ vidlayer->GetSurface(dispdata->vidlayer,
+ &data->surface));
+ dispdata->vidIDinuse = 1;
+ data->display = display;
+ return 0;
+ }
+ return 1;
+ error:
+ if (dispdata->vidlayer) {
+ SDL_DFB_RELEASE(data->surface);
+ SDL_DFB_CHECKERR(dispdata->
+ vidlayer->SetCooperativeLevel(dispdata->vidlayer,
+ DLSCL_ADMINISTRATIVE));
+ SDL_DFB_RELEASE(dispdata->vidlayer);
+ }
+ return 1;
+}
+
+static int
+DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ SDL_Window *window = renderer->window;
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DFB_DEVICEDATA(display->device);
+ DirectFB_TextureData *data;
+ DFBSurfaceDescription dsc;
+ DFBSurfacePixelFormat pixelformat;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
+ texture->driverdata = data;
+
+ /* find the right pixelformat */
+ pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format);
+ if (pixelformat == DSPF_UNKNOWN) {
+ SDL_SetError("Unknown pixel format %d", data->format);
+ goto error;
+ }
+
+ data->format = texture->format;
+ data->pitch = texture->w * DFB_BYTES_PER_PIXEL(pixelformat);
+
+ if (DirectFB_AcquireVidLayer(renderer, texture) != 0) {
+ /* fill surface description */
+ dsc.flags =
+ DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
+ dsc.width = texture->w;
+ dsc.height = texture->h;
+ if(texture->format == SDL_PIXELFORMAT_YV12 ||
+ texture->format == SDL_PIXELFORMAT_IYUV) {
+ /* dfb has problems with odd sizes -make them even internally */
+ dsc.width += (dsc.width % 2);
+ dsc.height += (dsc.height % 2);
+ }
+ /* <1.2 Never use DSCAPS_VIDEOONLY here. It kills performance
+ * No DSCAPS_SYSTEMONLY either - let dfb decide
+ * 1.2: DSCAPS_SYSTEMONLY boosts performance by factor ~8
+ * Depends on other settings as well. Let dfb decide.
+ */
+ dsc.caps = DSCAPS_PREMULTIPLIED;
+#if 0
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING)
+ dsc.caps |= DSCAPS_SYSTEMONLY;
+ else
+ dsc.caps |= DSCAPS_VIDEOONLY;
+#endif
+
+ dsc.pixelformat = pixelformat;
+ data->pixels = NULL;
+
+ /* Create the surface */
+ SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
+ &data->surface));
+ if (SDL_ISPIXELFORMAT_INDEXED(data->format)
+ && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
+#if 1
+ SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, &data->palette));
+#else
+ /* DFB has issues with blitting LUT8 surfaces.
+ * Creating a new palette does not help.
+ */
+ DFBPaletteDescription pal_desc;
+ pal_desc.flags = DPDESC_SIZE; /* | DPDESC_ENTRIES */
+ pal_desc.size = 256;
+ SDL_DFB_CHECKERR(devdata->dfb->CreatePalette(devdata->dfb, &pal_desc,&data->palette));
+ SDL_DFB_CHECKERR(data->surface->SetPalette(data->surface, data->palette));
+#endif
+ }
+
+ }
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ data->render_options = DSRO_NONE;
+#endif
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ /* 3 plane YUVs return 1 bpp, but we need more space for other planes */
+ if(texture->format == SDL_PIXELFORMAT_YV12 ||
+ texture->format == SDL_PIXELFORMAT_IYUV) {
+ SDL_DFB_ALLOC_CLEAR(data->pixels, (texture->h * data->pitch + ((texture->h + texture->h % 2) * (data->pitch + data->pitch % 2) * 2) / 4));
+ } else {
+ SDL_DFB_ALLOC_CLEAR(data->pixels, texture->h * data->pitch);
+ }
+ }
+
+ return 0;
+
+ error:
+ SDL_DFB_RELEASE(data->palette);
+ SDL_DFB_RELEASE(data->surface);
+ SDL_DFB_FREE(texture->driverdata);
+ return -1;
+}
+
+static int
+DirectFB_QueryTexturePixels(SDL_Renderer * renderer,
+ SDL_Texture * texture, void **pixels, int *pitch)
+{
+ DirectFB_TextureData *texturedata =
+ (DirectFB_TextureData *) texture->driverdata;
+
+ if (texturedata->display) {
+ return -1;
+ } else {
+ *pixels = texturedata->pixels;
+ *pitch = texturedata->pitch;
+ }
+ return 0;
+}
+
+static int
+DirectFB_SetTexturePalette(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Color * colors, int firstcolor,
+ int ncolors)
+{
+ DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
+ if (SDL_ISPIXELFORMAT_INDEXED(data->format)
+ && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
+ DFBColor entries[256];
+ int i;
+
+ if (ncolors > 256)
+ ncolors = 256;
+
+ for (i = 0; i < ncolors; ++i) {
+ entries[i].r = colors[i].r;
+ entries[i].g = colors[i].g;
+ entries[i].b = colors[i].b;
+ entries[i].a = 0xff;
+ }
+ SDL_DFB_CHECKERR(data->
+ palette->SetEntries(data->palette, entries, ncolors, firstcolor));
+ return 0;
+ } else {
+ return SDL_SetError("YUV textures don't have a palette");
+ }
+ error:
+ return -1;
+}
+
+static int
+DirectFB_GetTexturePalette(SDL_Renderer * renderer,
+ SDL_Texture * texture, SDL_Color * colors,
+ int firstcolor, int ncolors)
+{
+ DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
+
+ if (SDL_ISPIXELFORMAT_INDEXED(data->format)
+ && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
+ DFBColor entries[256];
+ int i;
+
+ SDL_DFB_CHECKERR(data->
+ palette->GetEntries(data->palette, entries, ncolors,
+ firstcolor));
+
+ for (i = 0; i < ncolors; ++i) {
+ colors[i].r = entries[i].r;
+ colors[i].g = entries[i].g;
+ colors[i].b = entries[i].b;
+ colors[i].a = SDL_ALPHA_OPAQUE;
+ }
+ return 0;
+ } else {
+ return SDL_SetError("YUV textures don't have a palette");
+ }
+ error:
+ return -1;
+}
+
+static int
+DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ return 0;
+}
+
+static int
+DirectFB_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ return 0;
+}
+
+static int
+DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ switch (texture->blendMode) {
+ case SDL_BLENDMODE_NONE:
+ /* case SDL_BLENDMODE_MASK: */
+ case SDL_BLENDMODE_BLEND:
+ case SDL_BLENDMODE_ADD:
+ case SDL_BLENDMODE_MOD:
+ return 0;
+ default:
+ texture->blendMode = SDL_BLENDMODE_NONE;
+ return SDL_Unsupported();
+ }
+}
+
+static int
+DirectFB_SetDrawBlendMode(SDL_Renderer * renderer)
+{
+ switch (renderer->blendMode) {
+ case SDL_BLENDMODE_NONE:
+ /* case SDL_BLENDMODE_MASK: */
+ case SDL_BLENDMODE_BLEND:
+ case SDL_BLENDMODE_ADD:
+ case SDL_BLENDMODE_MOD:
+ return 0;
+ default:
+ renderer->blendMode = SDL_BLENDMODE_NONE;
+ return SDL_Unsupported();
+ }
+}
+
+#if 0
+static int
+DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+#if (DFB_VERSION_ATLEAST(1,2,0))
+
+ DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
+
+ switch (texture->scaleMode) {
+ case SDL_SCALEMODE_NONE:
+ case SDL_SCALEMODE_FAST:
+ data->render_options = DSRO_NONE;
+ break;
+ case SDL_SCALEMODE_SLOW:
+ data->render_options = DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE;
+ break;
+ case SDL_SCALEMODE_BEST:
+ data->render_options =
+ DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE | DSRO_ANTIALIAS;
+ break;
+ default:
+ data->render_options = DSRO_NONE;
+ texture->scaleMode = SDL_SCALEMODE_NONE;
+ return SDL_Unsupported();
+ }
+#endif
+ return 0;
+}
+#endif
+
+static int
+DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels, int pitch)
+{
+ DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
+ Uint8 *dpixels;
+ int dpitch;
+ Uint8 *src, *dst;
+ int row;
+ size_t length;
+ int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
+ /* FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes */
+
+ DirectFB_ActivateRenderer(renderer);
+
+ if ((texture->format == SDL_PIXELFORMAT_YV12) ||
+ (texture->format == SDL_PIXELFORMAT_IYUV)) {
+ bpp = 1;
+ }
+
+ SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
+ DSLF_WRITE | DSLF_READ,
+ ((void **) &dpixels), &dpitch));
+ src = (Uint8 *) pixels;
+ dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
+ length = rect->w * bpp;
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += dpitch;
+ }
+ /* copy other planes for 3 plane formats */
+ if ((texture->format == SDL_PIXELFORMAT_YV12) ||
+ (texture->format == SDL_PIXELFORMAT_IYUV)) {
+ src = (Uint8 *) pixels + texture->h * pitch;
+ dst = (Uint8 *) dpixels + texture->h * dpitch + rect->y * dpitch / 4 + rect->x * bpp / 2;
+ for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
+ SDL_memcpy(dst, src, length / 2);
+ src += pitch / 2;
+ dst += dpitch / 2;
+ }
+ src = (Uint8 *) pixels + texture->h * pitch + texture->h * pitch / 4;
+ dst = (Uint8 *) dpixels + texture->h * dpitch + texture->h * dpitch / 4 + rect->y * dpitch / 4 + rect->x * bpp / 2;
+ for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
+ SDL_memcpy(dst, src, length / 2);
+ src += pitch / 2;
+ dst += dpitch / 2;
+ }
+ }
+ SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
+ data->isDirty = 0;
+ return 0;
+ error:
+ return 1;
+
+}
+
+static int
+DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, void **pixels, int *pitch)
+{
+ DirectFB_TextureData *texturedata =
+ (DirectFB_TextureData *) texture->driverdata;
+
+ DirectFB_ActivateRenderer(renderer);
+
+#if 0
+ if (markDirty) {
+ SDL_AddDirtyRect(&texturedata->dirty, rect);
+ }
+#endif
+
+ if (texturedata->display) {
+ void *fdata;
+ int fpitch;
+
+ SDL_DFB_CHECKERR(texturedata->surface->Lock(texturedata->surface,
+ DSLF_WRITE | DSLF_READ,
+ &fdata, &fpitch));
+ *pitch = fpitch;
+ *pixels = fdata;
+ } else {
+ *pixels =
+ (void *) ((Uint8 *) texturedata->pixels +
+ rect->y * texturedata->pitch +
+ rect->x * DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format)));
+ *pitch = texturedata->pitch;
+ texturedata->isDirty = 1;
+ }
+ return 0;
+
+ error:
+ return -1;
+}
+
+static void
+DirectFB_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ DirectFB_TextureData *texturedata =
+ (DirectFB_TextureData *) texture->driverdata;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ if (texturedata->display) {
+ SDL_DFB_CHECK(texturedata->surface->Unlock(texturedata->surface));
+ texturedata->pixels = NULL;
+ }
+}
+
+#if 0
+static void
+DirectFB_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ int numrects, const SDL_Rect * rects)
+{
+ DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
+ int i;
+
+ for (i = 0; i < numrects; ++i) {
+ SDL_AddDirtyRect(&data->dirty, &rects[i]);
+ }
+}
+#endif
+
+static int DirectFB_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ DirectFB_TextureData *tex_data = NULL;
+
+ DirectFB_ActivateRenderer(renderer);
+ if (texture) {
+ tex_data = (DirectFB_TextureData *) texture->driverdata;
+ data->target = tex_data->surface;
+ } else {
+ data->target = get_dfb_surface(data->window);
+ }
+ data->lastBlendMode = 0;
+ return 0;
+}
+
+
+static int
+PrepareDraw(SDL_Renderer * renderer)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+
+ Uint8 r, g, b, a;
+
+ r = renderer->r;
+ g = renderer->g;
+ b = renderer->b;
+ a = renderer->a;
+
+ SetBlendMode(data, renderer->blendMode, NULL);
+ SDL_DFB_CHECKERR(destsurf->SetDrawingFlags(destsurf, data->drawFlags));
+
+ switch (renderer->blendMode) {
+ case SDL_BLENDMODE_NONE:
+ /* case SDL_BLENDMODE_MASK: */
+ case SDL_BLENDMODE_BLEND:
+ break;
+ case SDL_BLENDMODE_ADD:
+ case SDL_BLENDMODE_MOD:
+ r = ((int) r * (int) a) / 255;
+ g = ((int) g * (int) a) / 255;
+ b = ((int) b * (int) a) / 255;
+ a = 255;
+ break;
+ }
+
+ SDL_DFB_CHECKERR(destsurf->SetColor(destsurf, r, g, b, a));
+ return 0;
+ error:
+ return -1;
+}
+
+static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+ DFBRegion clip_region;
+ int i;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ PrepareDraw(renderer);
+ destsurf->GetClip(destsurf, &clip_region);
+ for (i=0; i < count; i++) {
+ int x = points[i].x + clip_region.x1;
+ int y = points[i].y + clip_region.y1;
+ SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x, y, x, y));
+ }
+ return 0;
+ error:
+ return -1;
+}
+
+static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
+ const SDL_FPoint * points, int count)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+ DFBRegion clip_region;
+ int i;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ PrepareDraw(renderer);
+ /* Use antialiasing when available */
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS));
+#endif
+
+ destsurf->GetClip(destsurf, &clip_region);
+ for (i=0; i < count - 1; i++) {
+ int x1 = points[i].x + clip_region.x1;
+ int y1 = points[i].y + clip_region.y1;
+ int x2 = points[i + 1].x + clip_region.x1;
+ int y2 = points[i + 1].y + clip_region.y1;
+ SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2));
+ }
+
+ return 0;
+ error:
+ return -1;
+}
+
+static int
+DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+ DFBRegion clip_region;
+ int i;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ PrepareDraw(renderer);
+
+ destsurf->GetClip(destsurf, &clip_region);
+ for (i=0; i<count; i++) {
+ SDL_Rect dst = {rects[i]->x, rects[i]->y, rects[i]->w, rects[i]->h};
+ dst.x += clip_region.x1;
+ dst.y += clip_region.y1;
+ SDL_DFB_CHECKERR(destsurf->DrawRectangle(destsurf, dst.x, dst.y,
+ dst.w, dst.h));
+ }
+
+ return 0;
+ error:
+ return -1;
+}
+
+static int
+DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+ DFBRegion clip_region;
+ int i;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ PrepareDraw(renderer);
+
+ destsurf->GetClip(destsurf, &clip_region);
+ for (i=0; i<count; i++) {
+ SDL_Rect dst = {rects[i].x, rects[i].y, rects[i].w, rects[i].h};
+ dst.x += clip_region.x1;
+ dst.y += clip_region.y1;
+ SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, dst.x, dst.y,
+ dst.w, dst.h));
+ }
+
+ return 0;
+ error:
+ return -1;
+}
+
+static int
+DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = data->target;
+ DirectFB_TextureData *texturedata =
+ (DirectFB_TextureData *) texture->driverdata;
+ Uint8 alpha, r, g, b;
+ DFBRegion clip_region;
+ DFBRectangle sr, dr;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ SDLtoDFBRect(srcrect, &sr);
+ SDLtoDFBRect_Float(dstrect, &dr);
+
+ destsurf->GetClip(destsurf, &clip_region);
+ dr.x += clip_region.x1;
+ dr.y += clip_region.y1;
+
+ if (texturedata->display) {
+ int px, py;
+ SDL_Window *window = renderer->window;
+ IDirectFBWindow *dfbwin = get_dfb_window(window);
+ SDL_DFB_WINDOWDATA(window);
+ SDL_VideoDisplay *display = texturedata->display;
+ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
+
+ SDL_DFB_CHECKERR(dispdata->
+ vidlayer->SetSourceRectangle(dispdata->vidlayer,
+ sr.x, sr.y, sr.w, sr.h));
+ dfbwin->GetPosition(dfbwin, &px, &py);
+ px += windata->client.x;
+ py += windata->client.y;
+ SDL_DFB_CHECKERR(dispdata->
+ vidlayer->SetScreenRectangle(dispdata->vidlayer,
+ px + dr.x,
+ py + dr.y,
+ dr.w,
+ dr.h));
+ } else {
+ DFBSurfaceBlittingFlags flags = 0;
+
+#if 0
+ if (texturedata->dirty.list) {
+ SDL_DirtyRect *dirty;
+ void *pixels;
+ int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
+ int pitch = texturedata->pitch;
+
+ for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
+ SDL_Rect *rect = &dirty->rect;
+ pixels =
+ (void *) ((Uint8 *) texturedata->pixels +
+ rect->y * pitch + rect->x * bpp);
+ DirectFB_UpdateTexture(renderer, texture, rect,
+ pixels,
+ texturedata->pitch);
+ }
+ SDL_ClearDirtyRects(&texturedata->dirty);
+ }
+#endif
+ if (texturedata->isDirty)
+ {
+ SDL_Rect rect;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = texture->w;
+ rect.h = texture->h;
+
+ DirectFB_UpdateTexture(renderer, texture, &rect, texturedata->pixels, texturedata->pitch);
+ }
+
+ alpha = r = g = b = 0xff;
+ if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA){
+ alpha = texture->a;
+ flags |= DSBLIT_BLEND_COLORALPHA;
+ }
+
+ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
+ r = texture->r;
+ g = texture->g;
+ b = texture->b;
+ flags |= DSBLIT_COLORIZE;
+ }
+ SDL_DFB_CHECKERR(destsurf->
+ SetColor(destsurf, r, g, b, alpha));
+
+ /* ???? flags |= DSBLIT_SRC_PREMULTCOLOR; */
+
+ SetBlendMode(data, texture->blendMode, texturedata);
+
+ SDL_DFB_CHECKERR(destsurf->SetBlittingFlags(destsurf,
+ data->blitFlags | flags));
+
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
+ texturedata->
+ render_options));
+#endif
+
+ if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
+ SDL_DFB_CHECKERR(destsurf->Blit(destsurf,
+ texturedata->surface,
+ &sr, dr.x, dr.y));
+ } else {
+ SDL_DFB_CHECKERR(destsurf->StretchBlit(destsurf,
+ texturedata->surface,
+ &sr, &dr));
+ }
+ }
+ return 0;
+ error:
+ return -1;
+}
+
+static void
+DirectFB_RenderPresent(SDL_Renderer * renderer)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ SDL_Window *window = renderer->window;
+ SDL_DFB_WINDOWDATA(window);
+ SDL_ShapeData *shape_data = (window->shaper ? window->shaper->driverdata : NULL);
+
+ DirectFB_ActivateRenderer(renderer);
+
+ if (shape_data && shape_data->surface) {
+ /* saturate the window surface alpha channel */
+ SDL_DFB_CHECK(windata->window_surface->SetSrcBlendFunction(windata->window_surface, DSBF_ONE));
+ SDL_DFB_CHECK(windata->window_surface->SetDstBlendFunction(windata->window_surface, DSBF_ONE));
+ SDL_DFB_CHECK(windata->window_surface->SetDrawingFlags(windata->window_surface, DSDRAW_BLEND));
+ SDL_DFB_CHECK(windata->window_surface->SetColor(windata->window_surface, 0, 0, 0, 0xff));
+ SDL_DFB_CHECK(windata->window_surface->FillRectangle(windata->window_surface, 0,0, windata->size.w, windata->size.h));
+
+ /* blit the mask */
+ SDL_DFB_CHECK(windata->surface->SetSrcBlendFunction(windata->surface, DSBF_DESTCOLOR));
+ SDL_DFB_CHECK(windata->surface->SetDstBlendFunction(windata->surface, DSBF_ZERO));
+ SDL_DFB_CHECK(windata->surface->SetBlittingFlags(windata->surface, DSBLIT_BLEND_ALPHACHANNEL));
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ SDL_DFB_CHECK(windata->surface->SetRenderOptions(windata->surface, DSRO_NONE));
+#endif
+ SDL_DFB_CHECK(windata->surface->Blit(windata->surface, shape_data->surface, NULL, 0, 0));
+ }
+
+ /* Send the data to the display */
+ SDL_DFB_CHECK(windata->window_surface->Flip(windata->window_surface, NULL,
+ data->flipflags));
+}
+
+static void
+DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
+{
+ DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ if (!data) {
+ return;
+ }
+ SDL_DFB_RELEASE(data->palette);
+ SDL_DFB_RELEASE(data->surface);
+ if (data->display) {
+ DFB_DisplayData *dispdata =
+ (DFB_DisplayData *) data->display->driverdata;
+ dispdata->vidIDinuse = 0;
+ /* FIXME: Shouldn't we reset the cooperative level */
+ SDL_DFB_CHECK(dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer,
+ DLSCL_ADMINISTRATIVE));
+ SDL_DFB_RELEASE(dispdata->vidlayer);
+ }
+ SDL_DFB_FREE(data->pixels);
+ SDL_free(data);
+ texture->driverdata = NULL;
+}
+
+static void
+DirectFB_DestroyRenderer(SDL_Renderer * renderer)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(data->window);
+#if 0
+ if (display->palette) {
+ SDL_DelPaletteWatch(display->palette, DisplayPaletteChanged, data);
+ }
+#endif
+
+ SDL_free(data);
+ SDL_free(renderer);
+}
+
+static int
+DirectFB_UpdateViewport(SDL_Renderer * renderer)
+{
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *winsurf = data->target;
+ DFBRegion dreg;
+
+ dreg.x1 = renderer->viewport.x;
+ dreg.y1 = renderer->viewport.y;
+ dreg.x2 = dreg.x1 + renderer->viewport.w - 1;
+ dreg.y2 = dreg.y1 + renderer->viewport.h - 1;
+
+ winsurf->SetClip(winsurf, &dreg);
+ return 0;
+}
+
+static int
+DirectFB_UpdateClipRect(SDL_Renderer * renderer)
+{
+ const SDL_Rect *rect = &renderer->clip_rect;
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *destsurf = get_dfb_surface(data->window);
+ DFBRegion region;
+
+ if (!SDL_RectEmpty(rect)) {
+ region.x1 = rect->x;
+ region.x2 = rect->x + rect->w;
+ region.y1 = rect->y;
+ region.y2 = rect->y + rect->h;
+ SDL_DFB_CHECKERR(destsurf->SetClip(destsurf, &region));
+ } else {
+ SDL_DFB_CHECKERR(destsurf->SetClip(destsurf, NULL));
+ }
+ return 0;
+ error:
+ return -1;
+}
+
+static int
+DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, void * pixels, int pitch)
+{
+ Uint32 sdl_format;
+ unsigned char* laypixels;
+ int laypitch;
+ DFBSurfacePixelFormat dfb_format;
+ DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
+ IDirectFBSurface *winsurf = data->target;
+
+ DirectFB_ActivateRenderer(renderer);
+
+ winsurf->GetPixelFormat(winsurf, &dfb_format);
+ sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
+ winsurf->Lock(winsurf, DSLF_READ, (void **) &laypixels, &laypitch);
+
+ laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
+ SDL_ConvertPixels(rect->w, rect->h,
+ sdl_format, laypixels, laypitch,
+ format, pixels, pitch);
+
+ winsurf->Unlock(winsurf);
+
+ return 0;
+}
+
+#if 0
+static int
+DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
+ Uint32 format, const void * pixels, int pitch)
+{
+ SDL_Window *window = renderer->window;
+ SDL_DFB_WINDOWDATA(window);
+ Uint32 sdl_format;
+ unsigned char* laypixels;
+ int laypitch;
+ DFBSurfacePixelFormat dfb_format;
+
+ SDL_DFB_CHECK(windata->surface->GetPixelFormat(windata->surface, &dfb_format));
+ sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
+
+ SDL_DFB_CHECK(windata->surface->Lock(windata->surface, DSLF_WRITE, (void **) &laypixels, &laypitch));
+
+ laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
+ SDL_ConvertPixels(rect->w, rect->h,
+ format, pixels, pitch,
+ sdl_format, laypixels, laypitch);
+
+ SDL_DFB_CHECK(windata->surface->Unlock(windata->surface));
+
+ return 0;
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.h
new file mode 100644
index 0000000..bc3c075
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_render.h
@@ -0,0 +1,25 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+/* SDL surface based renderer implementation */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.c
new file mode 100644
index 0000000..3655931
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.c
@@ -0,0 +1,131 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_assert.h"
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_shape.h"
+#include "SDL_DirectFB_window.h"
+
+#include "../SDL_shape_internals.h"
+
+SDL_WindowShaper*
+DirectFB_CreateShaper(SDL_Window* window) {
+ SDL_WindowShaper* result = NULL;
+ SDL_ShapeData* data;
+ int resized_properly;
+
+ result = malloc(sizeof(SDL_WindowShaper));
+ result->window = window;
+ result->mode.mode = ShapeModeDefault;
+ result->mode.parameters.binarizationCutoff = 1;
+ result->userx = result->usery = 0;
+ data = SDL_malloc(sizeof(SDL_ShapeData));
+ result->driverdata = data;
+ data->surface = NULL;
+ window->shaper = result;
+ resized_properly = DirectFB_ResizeWindowShape(window);
+ SDL_assert(resized_properly == 0);
+
+ return result;
+}
+
+int
+DirectFB_ResizeWindowShape(SDL_Window* window) {
+ SDL_ShapeData* data = window->shaper->driverdata;
+ SDL_assert(data != NULL);
+
+ if (window->x != -1000)
+ {
+ window->shaper->userx = window->x;
+ window->shaper->usery = window->y;
+ }
+ SDL_SetWindowPosition(window,-1000,-1000);
+
+ return 0;
+}
+
+int
+DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
+
+ if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
+ return -1;
+ if(shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode))
+ return -2;
+ if(shape->w != shaper->window->w || shape->h != shaper->window->h)
+ return -3;
+
+ {
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(shaper->window);
+ SDL_DFB_DEVICEDATA(display->device);
+ Uint32 *pixels;
+ Sint32 pitch;
+ Uint32 h,w;
+ Uint8 *src, *bitmap;
+ DFBSurfaceDescription dsc;
+
+ SDL_ShapeData *data = shaper->driverdata;
+
+ SDL_DFB_RELEASE(data->surface);
+
+ dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
+ dsc.width = shape->w;
+ dsc.height = shape->h;
+ dsc.caps = DSCAPS_PREMULTIPLIED;
+ dsc.pixelformat = DSPF_ARGB;
+
+ SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, &data->surface));
+
+ /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
+ SDL_DFB_ALLOC_CLEAR(bitmap, shape->w * shape->h);
+ SDL_CalculateShapeBitmap(shaper->mode,shape,bitmap,1);
+
+ src = bitmap;
+
+ SDL_DFB_CHECK(data->surface->Lock(data->surface, DSLF_WRITE | DSLF_READ, (void **) &pixels, &pitch));
+
+ h = shaper->window->h;
+ while (h--) {
+ for (w = 0; w < shaper->window->w; w++) {
+ if (*src)
+ pixels[w] = 0xFFFFFFFF;
+ else
+ pixels[w] = 0;
+ src++;
+
+ }
+ pixels += (pitch >> 2);
+ }
+ SDL_DFB_CHECK(data->surface->Unlock(data->surface));
+ SDL_DFB_FREE(bitmap);
+
+ /* FIXME: Need to call this here - Big ?? */
+ DirectFB_WM_RedrawLayout(SDL_GetDisplayForWindow(shaper->window)->device, shaper->window);
+ }
+
+ return 0;
+error:
+ return -1;
+}
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.h
new file mode 100644
index 0000000..f0a418d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_shape.h
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_DirectFB_shape_h_
+#define SDL_DirectFB_shape_h_
+
+#include <directfb.h>
+
+#include "../SDL_sysvideo.h"
+#include "SDL_shape.h"
+
+typedef struct {
+ IDirectFBSurface *surface;
+} SDL_ShapeData;
+
+extern SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window);
+extern int DirectFB_ResizeWindowShape(SDL_Window* window);
+extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
+
+#endif /* SDL_DirectFB_shape_h_ */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.c
new file mode 100644
index 0000000..45fa81d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.c
@@ -0,0 +1,418 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+/*
+ * #include "SDL_DirectFB_keyboard.h"
+ */
+#include "SDL_DirectFB_modes.h"
+#include "SDL_DirectFB_opengl.h"
+#include "SDL_DirectFB_window.h"
+#include "SDL_DirectFB_WM.h"
+
+
+/* DirectFB video driver implementation.
+*/
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <directfb.h>
+#include <directfb_version.h>
+#include <directfb_strings.h>
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_events.h"
+#include "SDL_DirectFB_render.h"
+#include "SDL_DirectFB_mouse.h"
+#include "SDL_DirectFB_shape.h"
+
+
+#include "SDL_DirectFB_dyn.h"
+
+/* Initialization/Query functions */
+static int DirectFB_VideoInit(_THIS);
+static void DirectFB_VideoQuit(_THIS);
+
+static int DirectFB_Available(void);
+static SDL_VideoDevice *DirectFB_CreateDevice(int devindex);
+
+VideoBootStrap DirectFB_bootstrap = {
+ "directfb", "DirectFB",
+ DirectFB_Available, DirectFB_CreateDevice
+};
+
+static const DirectFBSurfaceDrawingFlagsNames(drawing_flags);
+static const DirectFBSurfaceBlittingFlagsNames(blitting_flags);
+static const DirectFBAccelerationMaskNames(acceleration_mask);
+
+/* DirectFB driver bootstrap functions */
+
+static int
+DirectFB_Available(void)
+{
+ if (!SDL_DirectFB_LoadLibrary())
+ return 0;
+ SDL_DirectFB_UnLoadLibrary();
+ return 1;
+}
+
+static void
+DirectFB_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_DirectFB_UnLoadLibrary();
+ SDL_DFB_FREE(device->driverdata);
+ SDL_DFB_FREE(device);
+}
+
+static SDL_VideoDevice *
+DirectFB_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ if (!SDL_DirectFB_LoadLibrary()) {
+ return NULL;
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+ SDL_DFB_ALLOC_CLEAR(device, sizeof(SDL_VideoDevice));
+
+ /* Set the function pointers */
+ device->VideoInit = DirectFB_VideoInit;
+ device->VideoQuit = DirectFB_VideoQuit;
+ device->GetDisplayModes = DirectFB_GetDisplayModes;
+ device->SetDisplayMode = DirectFB_SetDisplayMode;
+ device->PumpEvents = DirectFB_PumpEventsWindow;
+ device->CreateSDLWindow = DirectFB_CreateWindow;
+ device->CreateSDLWindowFrom = DirectFB_CreateWindowFrom;
+ device->SetWindowTitle = DirectFB_SetWindowTitle;
+ device->SetWindowIcon = DirectFB_SetWindowIcon;
+ device->SetWindowPosition = DirectFB_SetWindowPosition;
+ device->SetWindowSize = DirectFB_SetWindowSize;
+ device->SetWindowOpacity = DirectFB_SetWindowOpacity;
+ device->ShowWindow = DirectFB_ShowWindow;
+ device->HideWindow = DirectFB_HideWindow;
+ device->RaiseWindow = DirectFB_RaiseWindow;
+ device->MaximizeWindow = DirectFB_MaximizeWindow;
+ device->MinimizeWindow = DirectFB_MinimizeWindow;
+ device->RestoreWindow = DirectFB_RestoreWindow;
+ device->SetWindowGrab = DirectFB_SetWindowGrab;
+ device->DestroyWindow = DirectFB_DestroyWindow;
+ device->GetWindowWMInfo = DirectFB_GetWindowWMInfo;
+
+ /* !!! FIXME: implement SetWindowBordered */
+
+#if SDL_DIRECTFB_OPENGL
+ device->GL_LoadLibrary = DirectFB_GL_LoadLibrary;
+ device->GL_GetProcAddress = DirectFB_GL_GetProcAddress;
+ device->GL_MakeCurrent = DirectFB_GL_MakeCurrent;
+
+ device->GL_CreateContext = DirectFB_GL_CreateContext;
+ device->GL_SetSwapInterval = DirectFB_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = DirectFB_GL_GetSwapInterval;
+ device->GL_SwapWindow = DirectFB_GL_SwapWindow;
+ device->GL_DeleteContext = DirectFB_GL_DeleteContext;
+
+#endif
+
+ /* Shaped window support */
+ device->shape_driver.CreateShaper = DirectFB_CreateShaper;
+ device->shape_driver.SetWindowShape = DirectFB_SetWindowShape;
+ device->shape_driver.ResizeWindowShape = DirectFB_ResizeWindowShape;
+
+ device->free = DirectFB_DeleteDevice;
+
+ return device;
+ error:
+ if (device)
+ SDL_free(device);
+ return (0);
+}
+
+static void
+DirectFB_DeviceInformation(IDirectFB * dfb)
+{
+ DFBGraphicsDeviceDescription desc;
+ int n;
+
+ dfb->GetDeviceDescription(dfb, &desc);
+
+ SDL_DFB_LOG( "DirectFB Device Information");
+ SDL_DFB_LOG( "===========================");
+ SDL_DFB_LOG( "Name: %s", desc.name);
+ SDL_DFB_LOG( "Vendor: %s", desc.vendor);
+ SDL_DFB_LOG( "Driver Name: %s", desc.driver.name);
+ SDL_DFB_LOG( "Driver Vendor: %s", desc.driver.vendor);
+ SDL_DFB_LOG( "Driver Version: %d.%d", desc.driver.major,
+ desc.driver.minor);
+
+ SDL_DFB_LOG( "Video memory: %d", desc.video_memory);
+
+ SDL_DFB_LOG( "Blitting flags:");
+ for (n = 0; blitting_flags[n].flag; n++) {
+ if (desc.blitting_flags & blitting_flags[n].flag)
+ SDL_DFB_LOG( " %s", blitting_flags[n].name);
+ }
+
+ SDL_DFB_LOG( "Drawing flags:");
+ for (n = 0; drawing_flags[n].flag; n++) {
+ if (desc.drawing_flags & drawing_flags[n].flag)
+ SDL_DFB_LOG( " %s", drawing_flags[n].name);
+ }
+
+
+ SDL_DFB_LOG( "Acceleration flags:");
+ for (n = 0; acceleration_mask[n].mask; n++) {
+ if (desc.acceleration_mask & acceleration_mask[n].mask)
+ SDL_DFB_LOG( " %s", acceleration_mask[n].name);
+ }
+
+
+}
+
+static int readBoolEnv(const char *env_name, int def_val)
+{
+ char *stemp;
+
+ stemp = SDL_getenv(env_name);
+ if (stemp)
+ return atoi(stemp);
+ else
+ return def_val;
+}
+
+static int
+DirectFB_VideoInit(_THIS)
+{
+ IDirectFB *dfb = NULL;
+ DFB_DeviceData *devdata = NULL;
+ DFBResult ret;
+
+ SDL_DFB_ALLOC_CLEAR(devdata, sizeof(*devdata));
+
+ SDL_DFB_CHECKERR(DirectFBInit(NULL, NULL));
+
+ /* avoid switching to the framebuffer when we
+ * are running X11 */
+ ret = readBoolEnv(DFBENV_USE_X11_CHECK , 1);
+ if (ret) {
+ if (SDL_getenv("DISPLAY"))
+ DirectFBSetOption("system", "x11");
+ else
+ DirectFBSetOption("disable-module", "x11input");
+ }
+
+ devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 1); /* default: on */
+
+ if (!devdata->use_linux_input)
+ {
+ SDL_DFB_LOG("Disabling linux input\n");
+ DirectFBSetOption("disable-module", "linux_input");
+ }
+
+ SDL_DFB_CHECKERR(DirectFBCreate(&dfb));
+
+ DirectFB_DeviceInformation(dfb);
+
+ devdata->use_yuv_underlays = readBoolEnv(DFBENV_USE_YUV_UNDERLAY, 0); /* default: off */
+ devdata->use_yuv_direct = readBoolEnv(DFBENV_USE_YUV_DIRECT, 0); /* default is off! */
+
+ /* Create global Eventbuffer for axis events */
+ if (devdata->use_linux_input) {
+ SDL_DFB_CHECKERR(dfb->CreateInputEventBuffer(dfb, DICAPS_ALL,
+ DFB_TRUE,
+ &devdata->events));
+ } else {
+ SDL_DFB_CHECKERR(dfb->CreateInputEventBuffer(dfb, DICAPS_AXES
+ /* DICAPS_ALL */ ,
+ DFB_TRUE,
+ &devdata->events));
+ }
+
+ /* simple window manager support */
+ devdata->has_own_wm = readBoolEnv(DFBENV_USE_WM, 0);
+
+ devdata->initialized = 1;
+
+ devdata->dfb = dfb;
+ devdata->firstwin = NULL;
+ devdata->grabbed_window = NULL;
+
+ _this->driverdata = devdata;
+
+ DirectFB_InitModes(_this);
+
+#if SDL_DIRECTFB_OPENGL
+ DirectFB_GL_Initialize(_this);
+#endif
+
+ DirectFB_InitMouse(_this);
+ DirectFB_InitKeyboard(_this);
+
+ return 0;
+
+
+ error:
+ SDL_DFB_FREE(devdata);
+ SDL_DFB_RELEASE(dfb);
+ return -1;
+}
+
+static void
+DirectFB_VideoQuit(_THIS)
+{
+ DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata;
+
+ DirectFB_QuitModes(_this);
+ DirectFB_QuitKeyboard(_this);
+ DirectFB_QuitMouse(_this);
+
+ devdata->events->Reset(devdata->events);
+ SDL_DFB_RELEASE(devdata->events);
+ SDL_DFB_RELEASE(devdata->dfb);
+
+#if SDL_DIRECTFB_OPENGL
+ DirectFB_GL_Shutdown(_this);
+#endif
+
+ devdata->initialized = 0;
+}
+
+/* DirectFB driver general support functions */
+
+static const struct {
+ DFBSurfacePixelFormat dfb;
+ Uint32 sdl;
+} pixelformat_tab[] =
+{
+ { DSPF_RGB32, SDL_PIXELFORMAT_RGB888 }, /* 24 bit RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */
+ { DSPF_ARGB, SDL_PIXELFORMAT_ARGB8888 }, /* 32 bit ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */
+ { DSPF_RGB16, SDL_PIXELFORMAT_RGB565 }, /* 16 bit RGB (2 byte, red 5@11, green 6@5, blue 5@0) */
+ { DSPF_RGB332, SDL_PIXELFORMAT_RGB332 }, /* 8 bit RGB (1 byte, red 3@5, green 3@2, blue 2@0) */
+ { DSPF_ARGB4444, SDL_PIXELFORMAT_ARGB4444 }, /* 16 bit ARGB (2 byte, alpha 4@12, red 4@8, green 4@4, blue 4@0) */
+ { DSPF_ARGB1555, SDL_PIXELFORMAT_ARGB1555 }, /* 16 bit ARGB (2 byte, alpha 1@15, red 5@10, green 5@5, blue 5@0) */
+ { DSPF_RGB24, SDL_PIXELFORMAT_RGB24 }, /* 24 bit RGB (3 byte, red 8@16, green 8@8, blue 8@0) */
+ { DSPF_RGB444, SDL_PIXELFORMAT_RGB444 }, /* 16 bit RGB (2 byte, nothing @12, red 4@8, green 4@4, blue 4@0) */
+ { DSPF_YV12, SDL_PIXELFORMAT_YV12 }, /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size V/U planes) */
+ { DSPF_I420,SDL_PIXELFORMAT_IYUV }, /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size U/V planes) */
+ { DSPF_YUY2, SDL_PIXELFORMAT_YUY2 }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
+ { DSPF_UYVY, SDL_PIXELFORMAT_UYVY }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
+ { DSPF_RGB555, SDL_PIXELFORMAT_RGB555 }, /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
+#if (ENABLE_LUT8)
+ { DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */
+#endif
+
+#if (DFB_VERSION_ATLEAST(1,2,0))
+ { DSPF_BGR555, SDL_PIXELFORMAT_BGR555 }, /* 16 bit BGR (2 byte, nothing @15, blue 5@10, green 5@5, red 5@0) */
+#else
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR555 },
+#endif
+
+ /* Pfff ... nonmatching formats follow */
+
+ { DSPF_ALUT44, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit ALUT (1 byte, alpha 4@4, color lookup 4@0) */
+ { DSPF_A8, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
+ { DSPF_AiRGB, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
+ { DSPF_A1, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
+ { DSPF_NV12, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane) */
+ { DSPF_NV16, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane) */
+ { DSPF_ARGB2554, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
+ { DSPF_NV21, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane) */
+ { DSPF_AYUV, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
+ { DSPF_A4, SDL_PIXELFORMAT_UNKNOWN }, /* 4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
+ { DSPF_ARGB1666, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (3 byte/ alpha 1@18, red 6@16, green 6@6, blue 6@0) */
+ { DSPF_ARGB6666, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit alpha (3 byte/ alpha 6@18, red 6@16, green 6@6, blue 6@0) */
+ { DSPF_RGB18, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit RGB (3 byte/ red 6@16, green 6@6, blue 6@0) */
+ { DSPF_LUT2, SDL_PIXELFORMAT_UNKNOWN }, /* 2 bit LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
+
+#if (DFB_VERSION_ATLEAST(1,3,0))
+ { DSPF_RGBA4444, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
+#endif
+
+#if (DFB_VERSION_ATLEAST(1,4,3))
+ { DSPF_RGBA5551, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */
+ { DSPF_YUV444P, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an 8 bit Cr plane) */
+ { DSPF_ARGB8565, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */
+ { DSPF_AVYU, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */
+ { DSPF_VYU, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */
+#endif
+
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1MSB },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4LSB },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4MSB },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR24 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR888 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_RGBA8888 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR8888 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGRA8888 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_ARGB2101010 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR4444 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR1555 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR565 },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_YVYU }, /**< Packed mode: Y0+V0+Y1+U0 (1 pla */
+};
+
+Uint32
+DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
+{
+ int i;
+
+ for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
+ if (pixelformat_tab[i].dfb == pixelformat)
+ {
+ return pixelformat_tab[i].sdl;
+ }
+ return SDL_PIXELFORMAT_UNKNOWN;
+}
+
+DFBSurfacePixelFormat
+DirectFB_SDLToDFBPixelFormat(Uint32 format)
+{
+ int i;
+
+ for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
+ if (pixelformat_tab[i].sdl == format)
+ {
+ return pixelformat_tab[i].dfb;
+ }
+ return DSPF_UNKNOWN;
+}
+
+void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo* ri)
+{
+ int i, j;
+
+ for (i=0, j=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
+ if (pixelformat_tab[i].sdl != SDL_PIXELFORMAT_UNKNOWN)
+ ri->texture_formats[j++] = pixelformat_tab[i].sdl;
+ ri->num_texture_formats = j;
+}
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.h
new file mode 100644
index 0000000..f019031
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_video.h
@@ -0,0 +1,170 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_DirectFB_video_h_
+#define SDL_DirectFB_video_h_
+
+#include <directfb.h>
+#include <directfb_version.h>
+
+#include "../SDL_sysvideo.h"
+#include "SDL_scancode.h"
+#include "SDL_render.h"
+
+#include "SDL_log.h"
+
+#define DFB_VERSIONNUM(X, Y, Z) \
+ ((X)*1000 + (Y)*100 + (Z))
+
+#define DFB_COMPILEDVERSION \
+ DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
+
+#define DFB_VERSION_ATLEAST(X, Y, Z) \
+ (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
+
+#if (DFB_VERSION_ATLEAST(1,0,0))
+#ifdef SDL_VIDEO_OPENGL
+#define SDL_DIRECTFB_OPENGL 1
+#endif
+#else
+#error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0"
+#endif
+
+/* Set below to 1 to compile with (old) multi mice/keyboard api. Code left in
+ * in case we see this again ...
+ */
+
+#define USE_MULTI_API (0)
+
+/* Support for LUT8/INDEX8 pixel format.
+ * This is broken in DirectFB 1.4.3. It works in 1.4.0 and 1.4.5
+ * occurred.
+ */
+
+#if (DFB_COMPILEDVERSION == DFB_VERSIONNUM(1, 4, 3))
+#define ENABLE_LUT8 (0)
+#else
+#define ENABLE_LUT8 (1)
+#endif
+
+#define DIRECTFB_DEBUG 1
+
+#define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY" /* Default: off */
+#define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT" /* Default: off */
+#define DFBENV_USE_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */
+#define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */
+#define DFBENV_USE_WM "SDL_DIRECTFB_WM" /* Default: off */
+
+#define SDL_DFB_RELEASE(x) do { if ( (x) != NULL ) { SDL_DFB_CHECK(x->Release(x)); x = NULL; } } while (0)
+#define SDL_DFB_FREE(x) do { SDL_free((x)); (x) = NULL; } while (0)
+#define SDL_DFB_UNLOCK(x) do { if ( (x) != NULL ) { x->Unlock(x); } } while (0)
+
+#define SDL_DFB_CONTEXT "SDL_DirectFB"
+
+#define SDL_DFB_ERR(x...) SDL_LogError(SDL_LOG_CATEGORY_ERROR, x)
+
+#if (DIRECTFB_DEBUG)
+#define SDL_DFB_LOG(x...) SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, x)
+
+#define SDL_DFB_DEBUG(x...) SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, x)
+
+static SDL_INLINE DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int src_line) {
+ if (ret != DFB_OK) {
+ SDL_DFB_LOG("%s (%d):%s", src_file, src_line, DirectFBErrorString (ret) );
+ SDL_SetError("%s:%s", SDL_DFB_CONTEXT, DirectFBErrorString (ret) );
+ }
+ return ret;
+}
+
+#define SDL_DFB_CHECK(x...) do { sdl_dfb_check( x, __FILE__, __LINE__); } while (0)
+#define SDL_DFB_CHECKERR(x...) do { if ( sdl_dfb_check( x, __FILE__, __LINE__) != DFB_OK ) goto error; } while (0)
+
+#else
+
+#define SDL_DFB_CHECK(x...) x
+#define SDL_DFB_CHECKERR(x...) do { if (x != DFB_OK ) goto error; } while (0)
+#define SDL_DFB_LOG(x...) do {} while (0)
+#define SDL_DFB_DEBUG(x...) do {} while (0)
+
+#endif
+
+
+#define SDL_DFB_CALLOC(r, n, s) \
+ do { \
+ r = SDL_calloc (n, s); \
+ if (!(r)) { \
+ SDL_DFB_ERR("Out of memory"); \
+ SDL_OutOfMemory(); \
+ goto error; \
+ } \
+ } while (0)
+
+#define SDL_DFB_ALLOC_CLEAR(r, s) SDL_DFB_CALLOC(r, 1, s)
+
+/* Private display data */
+
+#define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (dev ? (DFB_DeviceData *) ((dev)->driverdata) : NULL)
+
+#define DFB_MAX_SCREENS 10
+
+typedef struct _DFB_KeyboardData DFB_KeyboardData;
+struct _DFB_KeyboardData
+{
+ const SDL_Scancode *map; /* keyboard scancode map */
+ int map_size; /* size of map */
+ int map_adjust; /* index adjust */
+ int is_generic; /* generic keyboard */
+ int id;
+};
+
+typedef struct _DFB_DeviceData DFB_DeviceData;
+struct _DFB_DeviceData
+{
+ int initialized;
+
+ IDirectFB *dfb;
+ int num_mice;
+ int mouse_id[0x100];
+ int num_keyboard;
+ DFB_KeyboardData keyboard[10];
+ SDL_Window *firstwin;
+
+ int use_yuv_underlays;
+ int use_yuv_direct;
+ int use_linux_input;
+ int has_own_wm;
+
+
+ /* window grab */
+ SDL_Window *grabbed_window;
+
+ /* global events */
+ IDirectFBEventBuffer *events;
+};
+
+Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat);
+DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format);
+void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri);
+
+
+#endif /* SDL_DirectFB_video_h_ */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.c b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.c
new file mode 100644
index 0000000..55171ed
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.c
@@ -0,0 +1,565 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DIRECTFB
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_modes.h"
+#include "SDL_DirectFB_window.h"
+#include "SDL_DirectFB_shape.h"
+
+#if SDL_DIRECTFB_OPENGL
+#include "SDL_DirectFB_opengl.h"
+#endif
+
+#include "SDL_syswm.h"
+
+#include "../SDL_pixels_c.h"
+
+int
+DirectFB_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_DISPLAYDATA(window);
+ DFB_WindowData *windata = NULL;
+ DFBWindowOptions wopts;
+ DFBWindowDescription desc;
+ int x, y;
+ int bshaped = 0;
+
+ SDL_DFB_ALLOC_CLEAR(window->driverdata, sizeof(DFB_WindowData));
+ SDL_memset(&desc, 0, sizeof(DFBWindowDescription));
+ windata = (DFB_WindowData *) window->driverdata;
+
+ windata->is_managed = devdata->has_own_wm;
+#if 1
+ SDL_DFB_CHECKERR(devdata->dfb->SetCooperativeLevel(devdata->dfb,
+ DFSCL_NORMAL));
+ SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
+ DLSCL_ADMINISTRATIVE));
+#endif
+ /* FIXME ... ughh, ugly */
+ if (window->x == -1000 && window->y == -1000)
+ bshaped = 1;
+
+ /* Fill the window description. */
+ x = window->x;
+ y = window->y;
+
+ DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
+
+ /* Create Window */
+ desc.caps = 0;
+ desc.flags =
+ DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_SURFACE_CAPS;
+
+ if (bshaped) {
+ desc.flags |= DWDESC_CAPS;
+ desc.caps |= DWCAPS_ALPHACHANNEL;
+ }
+ else
+ {
+ desc.flags |= DWDESC_PIXELFORMAT;
+ }
+
+ if (!(window->flags & SDL_WINDOW_BORDERLESS))
+ desc.caps |= DWCAPS_NODECORATION;
+
+ desc.posx = x;
+ desc.posy = y;
+ desc.width = windata->size.w;
+ desc.height = windata->size.h;
+ desc.pixelformat = dispdata->pixelformat;
+ desc.surface_caps = DSCAPS_PREMULTIPLIED;
+#if DIRECTFB_MAJOR_VERSION == 1 && DIRECTFB_MINOR_VERSION >= 6
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ desc.surface_caps |= DSCAPS_GL;
+ }
+#endif
+
+ /* Create the window. */
+ SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc,
+ &windata->dfbwin));
+
+ /* Set Options */
+ SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts));
+
+ /* explicit rescaling of surface */
+ wopts |= DWOP_SCALE;
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ wopts &= ~DWOP_KEEP_SIZE;
+ }
+ else {
+ wopts |= DWOP_KEEP_SIZE;
+ }
+
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
+ SDL_DFB_CHECK(windata->dfbwin->SetStackingClass(windata->dfbwin, DWSC_UPPER));
+ }
+
+ if (bshaped) {
+ wopts |= DWOP_SHAPED | DWOP_ALPHACHANNEL;
+ wopts &= ~DWOP_OPAQUE_REGION;
+ }
+
+ SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
+
+ /* See what we got */
+ SDL_DFB_CHECK(DirectFB_WM_GetClientSize
+ (_this, window, &window->w, &window->h));
+
+ /* Get the window's surface. */
+ SDL_DFB_CHECKERR(windata->dfbwin->GetSurface(windata->dfbwin,
+ &windata->window_surface));
+
+ /* And get a subsurface for rendering */
+ SDL_DFB_CHECKERR(windata->window_surface->
+ GetSubSurface(windata->window_surface, &windata->client,
+ &windata->surface));
+
+ SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, 0xFF));
+
+ /* Create Eventbuffer */
+
+ SDL_DFB_CHECKERR(windata->dfbwin->CreateEventBuffer(windata->dfbwin,
+ &windata->
+ eventbuffer));
+ SDL_DFB_CHECKERR(windata->dfbwin->
+ EnableEvents(windata->dfbwin, DWET_ALL));
+
+ /* Create a font */
+ /* FIXME: once during Video_Init */
+ windata->font = NULL;
+
+ /* Make it the top most window. */
+ SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin));
+
+ /* remember parent */
+ /* windata->sdlwin = window; */
+
+ /* Add to list ... */
+
+ windata->next = devdata->firstwin;
+ windata->opacity = 0xFF;
+ devdata->firstwin = window;
+
+ /* Draw Frame */
+ DirectFB_WM_RedrawLayout(_this, window);
+
+ return 0;
+ error:
+ SDL_DFB_RELEASE(windata->surface);
+ SDL_DFB_RELEASE(windata->dfbwin);
+ return -1;
+}
+
+int
+DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ return SDL_Unsupported();
+}
+
+void
+DirectFB_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+
+ if (windata->is_managed) {
+ windata->wm_needs_redraw = 1;
+ DirectFB_WM_RedrawLayout(_this, window);
+ } else {
+ SDL_Unsupported();
+ }
+}
+
+void
+DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(window);
+ SDL_Surface *surface = NULL;
+
+ if (icon) {
+ SDL_PixelFormat format;
+ DFBSurfaceDescription dsc;
+ Uint32 *dest;
+ Uint32 *p;
+ int pitch, i;
+
+ /* Convert the icon to ARGB for modern window managers */
+ SDL_InitFormat(&format, SDL_PIXELFORMAT_ARGB8888);
+ surface = SDL_ConvertSurface(icon, &format, 0);
+ if (!surface) {
+ return;
+ }
+ dsc.flags =
+ DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
+ dsc.caps = DSCAPS_VIDEOONLY;
+ dsc.width = surface->w;
+ dsc.height = surface->h;
+ dsc.pixelformat = DSPF_ARGB;
+
+ SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
+ &windata->icon));
+
+ SDL_DFB_CHECKERR(windata->icon->Lock(windata->icon, DSLF_WRITE,
+ (void *) &dest, &pitch));
+
+ p = surface->pixels;
+ for (i = 0; i < surface->h; i++)
+ memcpy((char *) dest + i * pitch,
+ (char *) p + i * surface->pitch, 4 * surface->w);
+
+ SDL_DFB_CHECK(windata->icon->Unlock(windata->icon));
+ SDL_FreeSurface(surface);
+ } else {
+ SDL_DFB_RELEASE(windata->icon);
+ }
+ return;
+ error:
+ SDL_FreeSurface(surface);
+ SDL_DFB_RELEASE(windata->icon);
+ return;
+}
+
+void
+DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ int x, y;
+
+ x = window->x;
+ y = window->y;
+
+ DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
+ SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, x, y));
+}
+
+void
+DirectFB_SetWindowSize(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+
+ if(SDL_IsShapedWindow(window))
+ DirectFB_ResizeWindowShape(window);
+
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ int cw;
+ int ch;
+
+ /* Make sure all events are disabled for this operation ! */
+ SDL_DFB_CHECKERR(windata->dfbwin->DisableEvents(windata->dfbwin,
+ DWET_ALL));
+ SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize(_this, window, &cw, &ch));
+
+ if (cw != window->w || ch != window->h) {
+
+ DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
+ SDL_DFB_CHECKERR(windata->dfbwin->Resize(windata->dfbwin,
+ windata->size.w,
+ windata->size.h));
+ }
+
+ SDL_DFB_CHECKERR(DirectFB_WM_GetClientSize
+ (_this, window, &window->w, &window->h));
+ DirectFB_AdjustWindowSurface(window);
+
+ SDL_DFB_CHECKERR(windata->dfbwin->EnableEvents(windata->dfbwin,
+ DWET_ALL));
+
+ }
+ return;
+ error:
+ SDL_DFB_CHECK(windata->dfbwin->EnableEvents(windata->dfbwin, DWET_ALL));
+ return;
+}
+
+void
+DirectFB_ShowWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+
+ SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, windata->opacity));
+
+}
+
+void
+DirectFB_HideWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+
+ SDL_DFB_CHECK(windata->dfbwin->GetOpacity(windata->dfbwin, &windata->opacity));
+ SDL_DFB_CHECK(windata->dfbwin->SetOpacity(windata->dfbwin, 0));
+}
+
+void
+DirectFB_RaiseWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+
+ SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin));
+ SDL_DFB_CHECK(windata->dfbwin->RequestFocus(windata->dfbwin));
+}
+
+void
+DirectFB_MaximizeWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ DFBWindowOptions wopts;
+
+ SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin,
+ &windata->restore.x, &windata->restore.y));
+ SDL_DFB_CHECK(windata->dfbwin->GetSize(windata->dfbwin, &windata->restore.w,
+ &windata->restore.h));
+
+ DirectFB_WM_AdjustWindowLayout(window, window->flags | SDL_WINDOW_MAXIMIZED, display->current_mode.w, display->current_mode.h) ;
+
+ SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, 0, 0));
+ SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin,
+ display->current_mode.w, display->current_mode.h));
+
+ /* Set Options */
+ SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts));
+ wopts |= DWOP_KEEP_SIZE | DWOP_KEEP_POSITION;
+ SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
+}
+
+void
+DirectFB_MinimizeWindow(_THIS, SDL_Window * window)
+{
+ /* FIXME: Size to 32x32 ? */
+
+ SDL_Unsupported();
+}
+
+void
+DirectFB_RestoreWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ DFBWindowOptions wopts;
+
+ /* Set Options */
+ SDL_DFB_CHECK(windata->dfbwin->GetOptions(windata->dfbwin, &wopts));
+ wopts &= ~(DWOP_KEEP_SIZE | DWOP_KEEP_POSITION);
+ SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
+
+ /* Window layout */
+ DirectFB_WM_AdjustWindowLayout(window, window->flags & ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED),
+ windata->restore.w, windata->restore.h);
+ SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin, windata->restore.w,
+ windata->restore.h));
+ SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, windata->restore.x,
+ windata->restore.y));
+
+ if (!(window->flags & SDL_WINDOW_RESIZABLE))
+ wopts |= DWOP_KEEP_SIZE;
+
+ if (window->flags & SDL_WINDOW_FULLSCREEN)
+ wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_SIZE;
+ SDL_DFB_CHECK(windata->dfbwin->SetOptions(windata->dfbwin, wopts));
+
+
+}
+
+void
+DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(window);
+ DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
+
+ if ((window->flags & SDL_WINDOW_INPUT_GRABBED)) {
+ if (gwindata != NULL)
+ {
+ SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
+ SDL_DFB_CHECK(gwindata->dfbwin->UngrabKeyboard(gwindata->dfbwin));
+ }
+ SDL_DFB_CHECK(windata->dfbwin->GrabPointer(windata->dfbwin));
+ SDL_DFB_CHECK(windata->dfbwin->GrabKeyboard(windata->dfbwin));
+ devdata->grabbed_window = window;
+ } else {
+ SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin));
+ SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin));
+ devdata->grabbed_window = NULL;
+ }
+}
+
+void
+DirectFB_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(window);
+ DFB_WindowData *p;
+
+ /* Some cleanups */
+ SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin));
+ SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin));
+
+#if SDL_DIRECTFB_OPENGL
+ DirectFB_GL_DestroyWindowContexts(_this, window);
+#endif
+
+ if (window->shaper)
+ {
+ SDL_ShapeData *data = window->shaper->driverdata;
+ SDL_DFB_CHECK(data->surface->ReleaseSource(data->surface));
+ SDL_DFB_RELEASE(data->surface);
+ SDL_DFB_FREE(data);
+ SDL_DFB_FREE(window->shaper);
+ }
+
+ SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, NULL));
+ SDL_DFB_CHECK(windata->surface->ReleaseSource(windata->surface));
+ SDL_DFB_CHECK(windata->window_surface->ReleaseSource(windata->window_surface));
+ SDL_DFB_RELEASE(windata->icon);
+ SDL_DFB_RELEASE(windata->font);
+ SDL_DFB_RELEASE(windata->eventbuffer);
+ SDL_DFB_RELEASE(windata->surface);
+ SDL_DFB_RELEASE(windata->window_surface);
+
+ SDL_DFB_RELEASE(windata->dfbwin);
+
+ /* Remove from list ... */
+
+ p = devdata->firstwin->driverdata;
+
+ while (p && p->next != window)
+ p = (p->next ? p->next->driverdata : NULL);
+ if (p)
+ p->next = windata->next;
+ else
+ devdata->firstwin = windata->next;
+ SDL_free(windata);
+ return;
+}
+
+SDL_bool
+DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo * info)
+{
+ const Uint32 version = ((((Uint32) info->version.major) * 1000000) +
+ (((Uint32) info->version.minor) * 10000) +
+ (((Uint32) info->version.patch)));
+
+ SDL_DFB_DEVICEDATA(_this);
+ SDL_DFB_WINDOWDATA(window);
+
+ /* Before 2.0.6, it was possible to build an SDL with DirectFB support
+ (SDL_SysWMinfo will be large enough to hold DirectFB info), but build
+ your app against SDL headers that didn't have DirectFB support
+ (SDL_SysWMinfo could be smaller than DirectFB needs. This would lead
+ to an app properly using SDL_GetWindowWMInfo() but we'd accidentally
+ overflow memory on the stack or heap. To protect against this, we've
+ padded out the struct unconditionally in the headers and DirectFB will
+ just return an error for older apps using this function. Those apps
+ will need to be recompiled against newer headers or not use DirectFB,
+ maybe by forcing SDL_VIDEODRIVER=x11. */
+ if (version < 2000006) {
+ info->subsystem = SDL_SYSWM_UNKNOWN;
+ SDL_SetError("Version must be 2.0.6 or newer");
+ return SDL_FALSE;
+ }
+
+ if (info->version.major == SDL_MAJOR_VERSION &&
+ info->version.minor == SDL_MINOR_VERSION) {
+ info->subsystem = SDL_SYSWM_DIRECTFB;
+ info->info.dfb.dfb = devdata->dfb;
+ info->info.dfb.window = windata->dfbwin;
+ info->info.dfb.surface = windata->surface;
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+}
+
+void
+DirectFB_AdjustWindowSurface(SDL_Window * window)
+{
+ SDL_DFB_WINDOWDATA(window);
+ int adjust = windata->wm_needs_redraw;
+ int cw, ch;
+
+ DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
+
+ SDL_DFB_CHECKERR(windata->
+ window_surface->GetSize(windata->window_surface, &cw,
+ &ch));
+ if (cw != windata->size.w || ch != windata->size.h) {
+ adjust = 1;
+ }
+
+ if (adjust) {
+#if SDL_DIRECTFB_OPENGL
+ DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window);
+#endif
+
+#if (DFB_VERSION_ATLEAST(1,2,1))
+ SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin,
+ windata->size.w,
+ windata->size.h));
+ SDL_DFB_CHECKERR(windata->surface->MakeSubSurface(windata->surface,
+ windata->
+ window_surface,
+ &windata->client));
+#else
+ DFBWindowOptions opts;
+
+ SDL_DFB_CHECKERR(windata->dfbwin->GetOptions(windata->dfbwin, &opts));
+ /* recreate subsurface */
+ SDL_DFB_RELEASE(windata->surface);
+
+ if (opts & DWOP_SCALE)
+ SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin,
+ windata->size.w,
+ windata->size.h));
+ SDL_DFB_CHECKERR(windata->window_surface->
+ GetSubSurface(windata->window_surface,
+ &windata->client, &windata->surface));
+#endif
+ DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window);
+
+#if SDL_DIRECTFB_OPENGL
+ DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window);
+#endif
+ }
+ error:
+ return;
+}
+
+int
+DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
+{
+ const Uint8 alpha = (Uint8) ((unsigned int) (opacity * 255.0f));
+ SDL_DFB_WINDOWDATA(window);
+ SDL_DFB_CHECKERR(windata->dfbwin->SetOpacity(windata->dfbwin, alpha));
+ windata->opacity = alpha;
+ return 0;
+
+error:
+ return -1;
+}
+
+#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.h b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.h
new file mode 100644
index 0000000..f03aab2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/directfb/SDL_DirectFB_window.h
@@ -0,0 +1,82 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_directfb_window_h_
+#define SDL_directfb_window_h_
+
+#include "SDL_DirectFB_video.h"
+#include "SDL_DirectFB_WM.h"
+
+#define SDL_DFB_WINDOWDATA(win) DFB_WindowData *windata = ((win) ? (DFB_WindowData *) ((win)->driverdata) : NULL)
+
+typedef struct _DFB_WindowData DFB_WindowData;
+struct _DFB_WindowData
+{
+ IDirectFBSurface *window_surface; /* window surface */
+ IDirectFBSurface *surface; /* client drawing surface */
+ IDirectFBWindow *dfbwin;
+ IDirectFBEventBuffer *eventbuffer;
+ /* SDL_Window *sdlwin; */
+ SDL_Window *next;
+ Uint8 opacity;
+ DFBRectangle client;
+ DFBDimension size;
+ DFBRectangle restore;
+
+ /* WM extras */
+ int is_managed;
+ int wm_needs_redraw;
+ IDirectFBSurface *icon;
+ IDirectFBFont *font;
+ DFB_Theme theme;
+
+ /* WM moving and sizing */
+ int wm_grab;
+ int wm_lastx;
+ int wm_lasty;
+};
+
+extern int DirectFB_CreateWindow(_THIS, SDL_Window * window);
+extern int DirectFB_CreateWindowFrom(_THIS, SDL_Window * window,
+ const void *data);
+extern void DirectFB_SetWindowTitle(_THIS, SDL_Window * window);
+extern void DirectFB_SetWindowIcon(_THIS, SDL_Window * window,
+ SDL_Surface * icon);
+
+extern void DirectFB_SetWindowPosition(_THIS, SDL_Window * window);
+extern void DirectFB_SetWindowSize(_THIS, SDL_Window * window);
+extern void DirectFB_ShowWindow(_THIS, SDL_Window * window);
+extern void DirectFB_HideWindow(_THIS, SDL_Window * window);
+extern void DirectFB_RaiseWindow(_THIS, SDL_Window * window);
+extern void DirectFB_MaximizeWindow(_THIS, SDL_Window * window);
+extern void DirectFB_MinimizeWindow(_THIS, SDL_Window * window);
+extern void DirectFB_RestoreWindow(_THIS, SDL_Window * window);
+extern void DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+extern void DirectFB_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+extern void DirectFB_AdjustWindowSurface(SDL_Window * window);
+extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
+
+#endif /* SDL_directfb_window_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/dummy/SDL_nullevents.c b/src/3rdparty/SDL2/src/video/dummy/SDL_nullevents.c
new file mode 100644
index 0000000..e9918bd
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/dummy/SDL_nullevents.c
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DUMMY
+
+/* Being a null driver, there's no event stream. We just define stubs for
+ most of the API. */
+
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_nullvideo.h"
+#include "SDL_nullevents_c.h"
+
+void
+DUMMY_PumpEvents(_THIS)
+{
+ /* do nothing. */
+}
+
+#endif /* SDL_VIDEO_DRIVER_DUMMY */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/dummy/SDL_nullevents_c.h b/src/3rdparty/SDL2/src/video/dummy/SDL_nullevents_c.h
new file mode 100644
index 0000000..a5636be
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/dummy/SDL_nullevents_c.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_nullvideo.h"
+
+extern void DUMMY_PumpEvents(_THIS);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer.c b/src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer.c
new file mode 100644
index 0000000..64c7781
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer.c
@@ -0,0 +1,89 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DUMMY
+
+#include "../SDL_sysvideo.h"
+#include "SDL_nullframebuffer_c.h"
+
+
+#define DUMMY_SURFACE "_SDL_DummySurface"
+
+int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch)
+{
+ SDL_Surface *surface;
+ const Uint32 surface_format = SDL_PIXELFORMAT_RGB888;
+ int w, h;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ /* Free the old framebuffer surface */
+ surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE);
+ SDL_FreeSurface(surface);
+
+ /* Create a new one */
+ SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask);
+ SDL_GetWindowSize(window, &w, &h);
+ surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
+ if (!surface) {
+ return -1;
+ }
+
+ /* Save the info and return! */
+ SDL_SetWindowData(window, DUMMY_SURFACE, surface);
+ *format = surface_format;
+ *pixels = surface->pixels;
+ *pitch = surface->pitch;
+ return 0;
+}
+
+int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects)
+{
+ static int frame_number;
+ SDL_Surface *surface;
+
+ surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE);
+ if (!surface) {
+ return SDL_SetError("Couldn't find dummy surface for window");
+ }
+
+ /* Send the data to the display */
+ if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
+ char file[128];
+ SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
+ SDL_GetWindowID(window), ++frame_number);
+ SDL_SaveBMP(surface, file);
+ }
+ return 0;
+}
+
+void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
+{
+ SDL_Surface *surface;
+
+ surface = (SDL_Surface *) SDL_SetWindowData(window, DUMMY_SURFACE, NULL);
+ SDL_FreeSurface(surface);
+}
+
+#endif /* SDL_VIDEO_DRIVER_DUMMY */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer_c.h b/src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer_c.h
new file mode 100644
index 0000000..5d6b7ae
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/dummy/SDL_nullframebuffer_c.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+extern int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch);
+extern int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects);
+extern void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.c b/src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.c
new file mode 100644
index 0000000..317faf4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.c
@@ -0,0 +1,144 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_DUMMY
+
+/* Dummy SDL video driver implementation; this is just enough to make an
+ * SDL-based application THINK it's got a working video driver, for
+ * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it,
+ * and also for use as a collection of stubs when porting SDL to a new
+ * platform for which you haven't yet written a valid video driver.
+ *
+ * This is also a great way to determine bottlenecks: if you think that SDL
+ * is a performance problem for a given platform, enable this driver, and
+ * then see if your application runs faster without video overhead.
+ *
+ * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion
+ * of this was cut-and-pasted from Stephane Peter's work in the AAlib
+ * SDL video driver. Renamed to "DUMMY" by Sam Lantinga.
+ */
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_nullvideo.h"
+#include "SDL_nullevents_c.h"
+#include "SDL_nullframebuffer_c.h"
+
+#define DUMMYVID_DRIVER_NAME "dummy"
+
+/* Initialization/Query functions */
+static int DUMMY_VideoInit(_THIS);
+static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+static void DUMMY_VideoQuit(_THIS);
+
+/* DUMMY driver bootstrap functions */
+
+static int
+DUMMY_Available(void)
+{
+ const char *envr = SDL_getenv("SDL_VIDEODRIVER");
+ if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) {
+ return (1);
+ }
+
+ return (0);
+}
+
+static void
+DUMMY_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+DUMMY_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_OutOfMemory();
+ return (0);
+ }
+ device->is_dummy = SDL_TRUE;
+
+ /* Set the function pointers */
+ device->VideoInit = DUMMY_VideoInit;
+ device->VideoQuit = DUMMY_VideoQuit;
+ device->SetDisplayMode = DUMMY_SetDisplayMode;
+ device->PumpEvents = DUMMY_PumpEvents;
+ device->CreateWindowFramebuffer = SDL_DUMMY_CreateWindowFramebuffer;
+ device->UpdateWindowFramebuffer = SDL_DUMMY_UpdateWindowFramebuffer;
+ device->DestroyWindowFramebuffer = SDL_DUMMY_DestroyWindowFramebuffer;
+
+ device->free = DUMMY_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap DUMMY_bootstrap = {
+ DUMMYVID_DRIVER_NAME, "SDL dummy video driver",
+ DUMMY_Available, DUMMY_CreateDevice
+};
+
+
+int
+DUMMY_VideoInit(_THIS)
+{
+ SDL_DisplayMode mode;
+
+ /* Use a fake 32-bpp desktop mode */
+ mode.format = SDL_PIXELFORMAT_RGB888;
+ mode.w = 1024;
+ mode.h = 768;
+ mode.refresh_rate = 0;
+ mode.driverdata = NULL;
+ if (SDL_AddBasicVideoDisplay(&mode) < 0) {
+ return -1;
+ }
+
+ SDL_zero(mode);
+ SDL_AddDisplayMode(&_this->displays[0], &mode);
+
+ /* We're done! */
+ return 0;
+}
+
+static int
+DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+void
+DUMMY_VideoQuit(_THIS)
+{
+}
+
+#endif /* SDL_VIDEO_DRIVER_DUMMY */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.h b/src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.h
new file mode 100644
index 0000000..c770349
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/dummy/SDL_nullvideo.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_nullvideo_h_
+#define SDL_nullvideo_h_
+
+#include "../SDL_sysvideo.h"
+
+#endif /* SDL_nullvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.c b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.c
new file mode 100644
index 0000000..14bc240
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.c
@@ -0,0 +1,716 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN
+
+#include <emscripten/html5.h>
+
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_touch_c.h"
+
+#include "SDL_emscriptenevents.h"
+#include "SDL_emscriptenvideo.h"
+
+#include "SDL_hints.h"
+
+#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
+
+/*
+.keyCode to scancode
+https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
+https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
+*/
+static const SDL_Scancode emscripten_scancode_table[] = {
+ /* 0 */ SDL_SCANCODE_UNKNOWN,
+ /* 1 */ SDL_SCANCODE_UNKNOWN,
+ /* 2 */ SDL_SCANCODE_UNKNOWN,
+ /* 3 */ SDL_SCANCODE_CANCEL,
+ /* 4 */ SDL_SCANCODE_UNKNOWN,
+ /* 5 */ SDL_SCANCODE_UNKNOWN,
+ /* 6 */ SDL_SCANCODE_HELP,
+ /* 7 */ SDL_SCANCODE_UNKNOWN,
+ /* 8 */ SDL_SCANCODE_BACKSPACE,
+ /* 9 */ SDL_SCANCODE_TAB,
+ /* 10 */ SDL_SCANCODE_UNKNOWN,
+ /* 11 */ SDL_SCANCODE_UNKNOWN,
+ /* 12 */ SDL_SCANCODE_UNKNOWN,
+ /* 13 */ SDL_SCANCODE_RETURN,
+ /* 14 */ SDL_SCANCODE_UNKNOWN,
+ /* 15 */ SDL_SCANCODE_UNKNOWN,
+ /* 16 */ SDL_SCANCODE_LSHIFT,
+ /* 17 */ SDL_SCANCODE_LCTRL,
+ /* 18 */ SDL_SCANCODE_LALT,
+ /* 19 */ SDL_SCANCODE_PAUSE,
+ /* 20 */ SDL_SCANCODE_CAPSLOCK,
+ /* 21 */ SDL_SCANCODE_UNKNOWN,
+ /* 22 */ SDL_SCANCODE_UNKNOWN,
+ /* 23 */ SDL_SCANCODE_UNKNOWN,
+ /* 24 */ SDL_SCANCODE_UNKNOWN,
+ /* 25 */ SDL_SCANCODE_UNKNOWN,
+ /* 26 */ SDL_SCANCODE_UNKNOWN,
+ /* 27 */ SDL_SCANCODE_ESCAPE,
+ /* 28 */ SDL_SCANCODE_UNKNOWN,
+ /* 29 */ SDL_SCANCODE_UNKNOWN,
+ /* 30 */ SDL_SCANCODE_UNKNOWN,
+ /* 31 */ SDL_SCANCODE_UNKNOWN,
+ /* 32 */ SDL_SCANCODE_SPACE,
+ /* 33 */ SDL_SCANCODE_PAGEUP,
+ /* 34 */ SDL_SCANCODE_PAGEDOWN,
+ /* 35 */ SDL_SCANCODE_END,
+ /* 36 */ SDL_SCANCODE_HOME,
+ /* 37 */ SDL_SCANCODE_LEFT,
+ /* 38 */ SDL_SCANCODE_UP,
+ /* 39 */ SDL_SCANCODE_RIGHT,
+ /* 40 */ SDL_SCANCODE_DOWN,
+ /* 41 */ SDL_SCANCODE_UNKNOWN,
+ /* 42 */ SDL_SCANCODE_UNKNOWN,
+ /* 43 */ SDL_SCANCODE_UNKNOWN,
+ /* 44 */ SDL_SCANCODE_UNKNOWN,
+ /* 45 */ SDL_SCANCODE_INSERT,
+ /* 46 */ SDL_SCANCODE_DELETE,
+ /* 47 */ SDL_SCANCODE_UNKNOWN,
+ /* 48 */ SDL_SCANCODE_0,
+ /* 49 */ SDL_SCANCODE_1,
+ /* 50 */ SDL_SCANCODE_2,
+ /* 51 */ SDL_SCANCODE_3,
+ /* 52 */ SDL_SCANCODE_4,
+ /* 53 */ SDL_SCANCODE_5,
+ /* 54 */ SDL_SCANCODE_6,
+ /* 55 */ SDL_SCANCODE_7,
+ /* 56 */ SDL_SCANCODE_8,
+ /* 57 */ SDL_SCANCODE_9,
+ /* 58 */ SDL_SCANCODE_UNKNOWN,
+ /* 59 */ SDL_SCANCODE_SEMICOLON,
+ /* 60 */ SDL_SCANCODE_UNKNOWN,
+ /* 61 */ SDL_SCANCODE_EQUALS,
+ /* 62 */ SDL_SCANCODE_UNKNOWN,
+ /* 63 */ SDL_SCANCODE_UNKNOWN,
+ /* 64 */ SDL_SCANCODE_UNKNOWN,
+ /* 65 */ SDL_SCANCODE_A,
+ /* 66 */ SDL_SCANCODE_B,
+ /* 67 */ SDL_SCANCODE_C,
+ /* 68 */ SDL_SCANCODE_D,
+ /* 69 */ SDL_SCANCODE_E,
+ /* 70 */ SDL_SCANCODE_F,
+ /* 71 */ SDL_SCANCODE_G,
+ /* 72 */ SDL_SCANCODE_H,
+ /* 73 */ SDL_SCANCODE_I,
+ /* 74 */ SDL_SCANCODE_J,
+ /* 75 */ SDL_SCANCODE_K,
+ /* 76 */ SDL_SCANCODE_L,
+ /* 77 */ SDL_SCANCODE_M,
+ /* 78 */ SDL_SCANCODE_N,
+ /* 79 */ SDL_SCANCODE_O,
+ /* 80 */ SDL_SCANCODE_P,
+ /* 81 */ SDL_SCANCODE_Q,
+ /* 82 */ SDL_SCANCODE_R,
+ /* 83 */ SDL_SCANCODE_S,
+ /* 84 */ SDL_SCANCODE_T,
+ /* 85 */ SDL_SCANCODE_U,
+ /* 86 */ SDL_SCANCODE_V,
+ /* 87 */ SDL_SCANCODE_W,
+ /* 88 */ SDL_SCANCODE_X,
+ /* 89 */ SDL_SCANCODE_Y,
+ /* 90 */ SDL_SCANCODE_Z,
+ /* 91 */ SDL_SCANCODE_LGUI,
+ /* 92 */ SDL_SCANCODE_UNKNOWN,
+ /* 93 */ SDL_SCANCODE_APPLICATION,
+ /* 94 */ SDL_SCANCODE_UNKNOWN,
+ /* 95 */ SDL_SCANCODE_UNKNOWN,
+ /* 96 */ SDL_SCANCODE_KP_0,
+ /* 97 */ SDL_SCANCODE_KP_1,
+ /* 98 */ SDL_SCANCODE_KP_2,
+ /* 99 */ SDL_SCANCODE_KP_3,
+ /* 100 */ SDL_SCANCODE_KP_4,
+ /* 101 */ SDL_SCANCODE_KP_5,
+ /* 102 */ SDL_SCANCODE_KP_6,
+ /* 103 */ SDL_SCANCODE_KP_7,
+ /* 104 */ SDL_SCANCODE_KP_8,
+ /* 105 */ SDL_SCANCODE_KP_9,
+ /* 106 */ SDL_SCANCODE_KP_MULTIPLY,
+ /* 107 */ SDL_SCANCODE_KP_PLUS,
+ /* 108 */ SDL_SCANCODE_UNKNOWN,
+ /* 109 */ SDL_SCANCODE_KP_MINUS,
+ /* 110 */ SDL_SCANCODE_KP_PERIOD,
+ /* 111 */ SDL_SCANCODE_KP_DIVIDE,
+ /* 112 */ SDL_SCANCODE_F1,
+ /* 113 */ SDL_SCANCODE_F2,
+ /* 114 */ SDL_SCANCODE_F3,
+ /* 115 */ SDL_SCANCODE_F4,
+ /* 116 */ SDL_SCANCODE_F5,
+ /* 117 */ SDL_SCANCODE_F6,
+ /* 118 */ SDL_SCANCODE_F7,
+ /* 119 */ SDL_SCANCODE_F8,
+ /* 120 */ SDL_SCANCODE_F9,
+ /* 121 */ SDL_SCANCODE_F10,
+ /* 122 */ SDL_SCANCODE_F11,
+ /* 123 */ SDL_SCANCODE_F12,
+ /* 124 */ SDL_SCANCODE_F13,
+ /* 125 */ SDL_SCANCODE_F14,
+ /* 126 */ SDL_SCANCODE_F15,
+ /* 127 */ SDL_SCANCODE_F16,
+ /* 128 */ SDL_SCANCODE_F17,
+ /* 129 */ SDL_SCANCODE_F18,
+ /* 130 */ SDL_SCANCODE_F19,
+ /* 131 */ SDL_SCANCODE_F20,
+ /* 132 */ SDL_SCANCODE_F21,
+ /* 133 */ SDL_SCANCODE_F22,
+ /* 134 */ SDL_SCANCODE_F23,
+ /* 135 */ SDL_SCANCODE_F24,
+ /* 136 */ SDL_SCANCODE_UNKNOWN,
+ /* 137 */ SDL_SCANCODE_UNKNOWN,
+ /* 138 */ SDL_SCANCODE_UNKNOWN,
+ /* 139 */ SDL_SCANCODE_UNKNOWN,
+ /* 140 */ SDL_SCANCODE_UNKNOWN,
+ /* 141 */ SDL_SCANCODE_UNKNOWN,
+ /* 142 */ SDL_SCANCODE_UNKNOWN,
+ /* 143 */ SDL_SCANCODE_UNKNOWN,
+ /* 144 */ SDL_SCANCODE_NUMLOCKCLEAR,
+ /* 145 */ SDL_SCANCODE_SCROLLLOCK,
+ /* 146 */ SDL_SCANCODE_UNKNOWN,
+ /* 147 */ SDL_SCANCODE_UNKNOWN,
+ /* 148 */ SDL_SCANCODE_UNKNOWN,
+ /* 149 */ SDL_SCANCODE_UNKNOWN,
+ /* 150 */ SDL_SCANCODE_UNKNOWN,
+ /* 151 */ SDL_SCANCODE_UNKNOWN,
+ /* 152 */ SDL_SCANCODE_UNKNOWN,
+ /* 153 */ SDL_SCANCODE_UNKNOWN,
+ /* 154 */ SDL_SCANCODE_UNKNOWN,
+ /* 155 */ SDL_SCANCODE_UNKNOWN,
+ /* 156 */ SDL_SCANCODE_UNKNOWN,
+ /* 157 */ SDL_SCANCODE_UNKNOWN,
+ /* 158 */ SDL_SCANCODE_UNKNOWN,
+ /* 159 */ SDL_SCANCODE_UNKNOWN,
+ /* 160 */ SDL_SCANCODE_UNKNOWN,
+ /* 161 */ SDL_SCANCODE_UNKNOWN,
+ /* 162 */ SDL_SCANCODE_UNKNOWN,
+ /* 163 */ SDL_SCANCODE_UNKNOWN,
+ /* 164 */ SDL_SCANCODE_UNKNOWN,
+ /* 165 */ SDL_SCANCODE_UNKNOWN,
+ /* 166 */ SDL_SCANCODE_UNKNOWN,
+ /* 167 */ SDL_SCANCODE_UNKNOWN,
+ /* 168 */ SDL_SCANCODE_UNKNOWN,
+ /* 169 */ SDL_SCANCODE_UNKNOWN,
+ /* 170 */ SDL_SCANCODE_UNKNOWN,
+ /* 171 */ SDL_SCANCODE_UNKNOWN,
+ /* 172 */ SDL_SCANCODE_UNKNOWN,
+ /* 173 */ SDL_SCANCODE_MINUS, /*FX*/
+ /* 174 */ SDL_SCANCODE_VOLUMEDOWN, /*IE, Chrome*/
+ /* 175 */ SDL_SCANCODE_VOLUMEUP, /*IE, Chrome*/
+ /* 176 */ SDL_SCANCODE_AUDIONEXT, /*IE, Chrome*/
+ /* 177 */ SDL_SCANCODE_AUDIOPREV, /*IE, Chrome*/
+ /* 178 */ SDL_SCANCODE_UNKNOWN,
+ /* 179 */ SDL_SCANCODE_AUDIOPLAY, /*IE, Chrome*/
+ /* 180 */ SDL_SCANCODE_UNKNOWN,
+ /* 181 */ SDL_SCANCODE_AUDIOMUTE, /*FX*/
+ /* 182 */ SDL_SCANCODE_VOLUMEDOWN, /*FX*/
+ /* 183 */ SDL_SCANCODE_VOLUMEUP, /*FX*/
+ /* 184 */ SDL_SCANCODE_UNKNOWN,
+ /* 185 */ SDL_SCANCODE_UNKNOWN,
+ /* 186 */ SDL_SCANCODE_SEMICOLON, /*IE, Chrome, D3E legacy*/
+ /* 187 */ SDL_SCANCODE_EQUALS, /*IE, Chrome, D3E legacy*/
+ /* 188 */ SDL_SCANCODE_COMMA,
+ /* 189 */ SDL_SCANCODE_MINUS, /*IE, Chrome, D3E legacy*/
+ /* 190 */ SDL_SCANCODE_PERIOD,
+ /* 191 */ SDL_SCANCODE_SLASH,
+ /* 192 */ SDL_SCANCODE_GRAVE, /*FX, D3E legacy (SDL_SCANCODE_APOSTROPHE in IE/Chrome)*/
+ /* 193 */ SDL_SCANCODE_UNKNOWN,
+ /* 194 */ SDL_SCANCODE_UNKNOWN,
+ /* 195 */ SDL_SCANCODE_UNKNOWN,
+ /* 196 */ SDL_SCANCODE_UNKNOWN,
+ /* 197 */ SDL_SCANCODE_UNKNOWN,
+ /* 198 */ SDL_SCANCODE_UNKNOWN,
+ /* 199 */ SDL_SCANCODE_UNKNOWN,
+ /* 200 */ SDL_SCANCODE_UNKNOWN,
+ /* 201 */ SDL_SCANCODE_UNKNOWN,
+ /* 202 */ SDL_SCANCODE_UNKNOWN,
+ /* 203 */ SDL_SCANCODE_UNKNOWN,
+ /* 204 */ SDL_SCANCODE_UNKNOWN,
+ /* 205 */ SDL_SCANCODE_UNKNOWN,
+ /* 206 */ SDL_SCANCODE_UNKNOWN,
+ /* 207 */ SDL_SCANCODE_UNKNOWN,
+ /* 208 */ SDL_SCANCODE_UNKNOWN,
+ /* 209 */ SDL_SCANCODE_UNKNOWN,
+ /* 210 */ SDL_SCANCODE_UNKNOWN,
+ /* 211 */ SDL_SCANCODE_UNKNOWN,
+ /* 212 */ SDL_SCANCODE_UNKNOWN,
+ /* 213 */ SDL_SCANCODE_UNKNOWN,
+ /* 214 */ SDL_SCANCODE_UNKNOWN,
+ /* 215 */ SDL_SCANCODE_UNKNOWN,
+ /* 216 */ SDL_SCANCODE_UNKNOWN,
+ /* 217 */ SDL_SCANCODE_UNKNOWN,
+ /* 218 */ SDL_SCANCODE_UNKNOWN,
+ /* 219 */ SDL_SCANCODE_LEFTBRACKET,
+ /* 220 */ SDL_SCANCODE_BACKSLASH,
+ /* 221 */ SDL_SCANCODE_RIGHTBRACKET,
+ /* 222 */ SDL_SCANCODE_APOSTROPHE, /*FX, D3E legacy*/
+};
+
+
+/* "borrowed" from SDL_windowsevents.c */
+static int
+Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text)
+{
+ if (codepoint <= 0x7F) {
+ text[0] = (char) codepoint;
+ text[1] = '\0';
+ } else if (codepoint <= 0x7FF) {
+ text[0] = 0xC0 | (char) ((codepoint >> 6) & 0x1F);
+ text[1] = 0x80 | (char) (codepoint & 0x3F);
+ text[2] = '\0';
+ } else if (codepoint <= 0xFFFF) {
+ text[0] = 0xE0 | (char) ((codepoint >> 12) & 0x0F);
+ text[1] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
+ text[2] = 0x80 | (char) (codepoint & 0x3F);
+ text[3] = '\0';
+ } else if (codepoint <= 0x10FFFF) {
+ text[0] = 0xF0 | (char) ((codepoint >> 18) & 0x0F);
+ text[1] = 0x80 | (char) ((codepoint >> 12) & 0x3F);
+ text[2] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
+ text[3] = 0x80 | (char) (codepoint & 0x3F);
+ text[4] = '\0';
+ } else {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static EM_BOOL
+Emscripten_HandlePointerLockChange(int eventType, const EmscriptenPointerlockChangeEvent *changeEvent, void *userData)
+{
+ SDL_WindowData *window_data = (SDL_WindowData *) userData;
+ /* keep track of lock losses, so we can regrab if/when appropriate. */
+ window_data->has_pointer_lock = changeEvent->isActive;
+ return 0;
+}
+
+
+static EM_BOOL
+Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ const int isPointerLocked = window_data->has_pointer_lock;
+ int mx, my;
+ static double residualx = 0, residualy = 0;
+
+ /* rescale (in case canvas is being scaled)*/
+ double client_w, client_h, xscale, yscale;
+ emscripten_get_element_css_size(NULL, &client_w, &client_h);
+ xscale = window_data->window->w / client_w;
+ yscale = window_data->window->h / client_h;
+
+ if (isPointerLocked) {
+ residualx += mouseEvent->movementX * xscale;
+ residualy += mouseEvent->movementY * yscale;
+ /* Let slow sub-pixel motion accumulate. Don't lose it. */
+ mx = residualx;
+ residualx -= mx;
+ my = residualy;
+ residualy -= my;
+ } else {
+ mx = mouseEvent->canvasX * xscale;
+ my = mouseEvent->canvasY * yscale;
+ }
+
+ SDL_SendMouseMotion(window_data->window, 0, isPointerLocked, mx, my);
+ return 0;
+}
+
+static EM_BOOL
+Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ Uint8 sdl_button;
+ Uint8 sdl_button_state;
+ SDL_EventType sdl_event_type;
+
+ switch (mouseEvent->button) {
+ case 0:
+ sdl_button = SDL_BUTTON_LEFT;
+ break;
+ case 1:
+ sdl_button = SDL_BUTTON_MIDDLE;
+ break;
+ case 2:
+ sdl_button = SDL_BUTTON_RIGHT;
+ break;
+ default:
+ return 0;
+ }
+
+ if (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN) {
+ if (SDL_GetMouse()->relative_mode && !window_data->has_pointer_lock) {
+ emscripten_request_pointerlock(NULL, 0); /* try to regrab lost pointer lock. */
+ }
+ sdl_button_state = SDL_PRESSED;
+ sdl_event_type = SDL_MOUSEBUTTONDOWN;
+ } else {
+ sdl_button_state = SDL_RELEASED;
+ sdl_event_type = SDL_MOUSEBUTTONUP;
+ }
+ SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button);
+ return SDL_GetEventState(sdl_event_type) == SDL_ENABLE;
+}
+
+static EM_BOOL
+Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+
+ int mx = mouseEvent->canvasX, my = mouseEvent->canvasY;
+ const int isPointerLocked = window_data->has_pointer_lock;
+
+ if (!isPointerLocked) {
+ /* rescale (in case canvas is being scaled)*/
+ double client_w, client_h;
+ emscripten_get_element_css_size(NULL, &client_w, &client_h);
+
+ mx = mx * (window_data->window->w / client_w);
+ my = my * (window_data->window->h / client_h);
+ SDL_SendMouseMotion(window_data->window, 0, isPointerLocked, mx, my);
+ }
+
+ SDL_SetMouseFocus(eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? window_data->window : NULL);
+ return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE;
+}
+
+static EM_BOOL
+Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
+ return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE;
+}
+
+static EM_BOOL
+Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ /* If the user switches away while keys are pressed (such as
+ * via Alt+Tab), key release events won't be received. */
+ if (eventType == EMSCRIPTEN_EVENT_BLUR) {
+ SDL_ResetKeyboard();
+ }
+
+
+ SDL_SendWindowEvent(window_data->window, eventType == EMSCRIPTEN_EVENT_FOCUS ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
+ return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE;
+}
+
+static EM_BOOL
+Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ int i;
+ double client_w, client_h;
+ int preventDefault = 0;
+
+ SDL_TouchID deviceId = 1;
+ if (SDL_AddTouch(deviceId, "") < 0) {
+ return 0;
+ }
+
+ emscripten_get_element_css_size(NULL, &client_w, &client_h);
+
+ for (i = 0; i < touchEvent->numTouches; i++) {
+ SDL_FingerID id;
+ float x, y;
+ int mx, my;
+
+ if (!touchEvent->touches[i].isChanged)
+ continue;
+
+ id = touchEvent->touches[i].identifier;
+ x = touchEvent->touches[i].canvasX / client_w;
+ y = touchEvent->touches[i].canvasY / client_h;
+
+ mx = x * window_data->window->w;
+ my = y * window_data->window->h;
+
+ if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) {
+ if (!window_data->finger_touching) {
+ window_data->finger_touching = SDL_TRUE;
+ window_data->first_finger = id;
+ SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my);
+ SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
+ }
+ SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f);
+
+ if (!preventDefault && SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
+ preventDefault = 1;
+ }
+ } else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
+ if ((window_data->finger_touching) && (window_data->first_finger == id)) {
+ SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my);
+ }
+ SDL_SendTouchMotion(deviceId, id, x, y, 1.0f);
+
+ if (!preventDefault && SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
+ preventDefault = 1;
+ }
+ } else {
+ if ((window_data->finger_touching) && (window_data->first_finger == id)) {
+ SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
+ window_data->finger_touching = SDL_FALSE;
+ }
+ SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f);
+
+ if (!preventDefault && SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
+ preventDefault = 1;
+ }
+ }
+ }
+
+ return preventDefault;
+}
+
+static EM_BOOL
+Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
+{
+ Uint32 scancode;
+ SDL_bool prevent_default;
+ SDL_bool is_nav_key;
+
+ /* .keyCode is deprecated, but still the most reliable way to get keys */
+ if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) {
+ scancode = emscripten_scancode_table[keyEvent->keyCode];
+
+ if (scancode != SDL_SCANCODE_UNKNOWN) {
+
+ if (keyEvent->location == DOM_KEY_LOCATION_RIGHT) {
+ switch (scancode) {
+ case SDL_SCANCODE_LSHIFT:
+ scancode = SDL_SCANCODE_RSHIFT;
+ break;
+ case SDL_SCANCODE_LCTRL:
+ scancode = SDL_SCANCODE_RCTRL;
+ break;
+ case SDL_SCANCODE_LALT:
+ scancode = SDL_SCANCODE_RALT;
+ break;
+ case SDL_SCANCODE_LGUI:
+ scancode = SDL_SCANCODE_RGUI;
+ break;
+ }
+ }
+ SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode);
+ }
+ }
+
+ prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE;
+
+ /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress
+ * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX
+ */
+ is_nav_key = keyEvent->keyCode == 8 /* backspace */ ||
+ keyEvent->keyCode == 9 /* tab */ ||
+ keyEvent->keyCode == 37 /* left */ ||
+ keyEvent->keyCode == 38 /* up */ ||
+ keyEvent->keyCode == 39 /* right */ ||
+ keyEvent->keyCode == 40 /* down */;
+
+ if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && !is_nav_key)
+ prevent_default = SDL_FALSE;
+
+ return prevent_default;
+}
+
+static EM_BOOL
+Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
+{
+ char text[5];
+ if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
+ SDL_SendKeyboardText(text);
+ }
+ return SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE;
+}
+
+static EM_BOOL
+Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ if(fullscreenChangeEvent->isFullscreen)
+ {
+ window_data->window->flags |= window_data->requested_fullscreen_mode;
+
+ window_data->requested_fullscreen_mode = 0;
+
+ if(!window_data->requested_fullscreen_mode)
+ window_data->window->flags |= SDL_WINDOW_FULLSCREEN; /*we didn't reqest fullscreen*/
+ }
+ else
+ {
+ window_data->window->flags &= ~FULLSCREEN_MASK;
+ }
+
+ return 0;
+}
+
+static EM_BOOL
+Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+
+ /* update pixel ratio */
+ if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ window_data->pixel_ratio = emscripten_get_device_pixel_ratio();
+ }
+
+ if(!(window_data->window->flags & FULLSCREEN_MASK))
+ {
+ /* this will only work if the canvas size is set through css */
+ if(window_data->window->flags & SDL_WINDOW_RESIZABLE)
+ {
+ double w = window_data->window->w;
+ double h = window_data->window->h;
+
+ if(window_data->external_size) {
+ emscripten_get_element_css_size(NULL, &w, &h);
+ }
+
+ emscripten_set_canvas_size(w * window_data->pixel_ratio, h * window_data->pixel_ratio);
+
+ /* set_canvas_size unsets this */
+ if (!window_data->external_size && window_data->pixel_ratio != 1.0f) {
+ emscripten_set_element_css_size(NULL, w, h);
+ }
+
+ SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
+ }
+ }
+
+ return 0;
+}
+
+EM_BOOL
+Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userData)
+{
+ /*this is used during fullscreen changes*/
+ SDL_WindowData *window_data = userData;
+
+ if(window_data->fullscreen_resize)
+ {
+ double css_w, css_h;
+ emscripten_get_element_css_size(NULL, &css_w, &css_h);
+ SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, css_w, css_h);
+ }
+
+ return 0;
+}
+
+static EM_BOOL
+Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData)
+{
+ SDL_WindowData *window_data = userData;
+ SDL_SendWindowEvent(window_data->window, visEvent->hidden ? SDL_WINDOWEVENT_HIDDEN : SDL_WINDOWEVENT_SHOWN, 0, 0);
+ return 0;
+}
+
+void
+Emscripten_RegisterEventHandlers(SDL_WindowData *data)
+{
+ const char *keyElement;
+
+ /* There is only one window and that window is the canvas */
+ emscripten_set_mousemove_callback("#canvas", data, 0, Emscripten_HandleMouseMove);
+
+ emscripten_set_mousedown_callback("#canvas", data, 0, Emscripten_HandleMouseButton);
+ emscripten_set_mouseup_callback("#document", data, 0, Emscripten_HandleMouseButton);
+
+ emscripten_set_mouseenter_callback("#canvas", data, 0, Emscripten_HandleMouseFocus);
+ emscripten_set_mouseleave_callback("#canvas", data, 0, Emscripten_HandleMouseFocus);
+
+ emscripten_set_wheel_callback("#canvas", data, 0, Emscripten_HandleWheel);
+
+ emscripten_set_focus_callback("#window", data, 0, Emscripten_HandleFocus);
+ emscripten_set_blur_callback("#window", data, 0, Emscripten_HandleFocus);
+
+ emscripten_set_touchstart_callback("#canvas", data, 0, Emscripten_HandleTouch);
+ emscripten_set_touchend_callback("#canvas", data, 0, Emscripten_HandleTouch);
+ emscripten_set_touchmove_callback("#canvas", data, 0, Emscripten_HandleTouch);
+ emscripten_set_touchcancel_callback("#canvas", data, 0, Emscripten_HandleTouch);
+
+ emscripten_set_pointerlockchange_callback("#document", data, 0, Emscripten_HandlePointerLockChange);
+
+ /* Keyboard events are awkward */
+ keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
+ if (!keyElement) keyElement = "#window";
+
+ emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey);
+ emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey);
+ emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress);
+
+ emscripten_set_fullscreenchange_callback("#document", data, 0, Emscripten_HandleFullscreenChange);
+
+ emscripten_set_resize_callback("#window", data, 0, Emscripten_HandleResize);
+
+ emscripten_set_visibilitychange_callback(data, 0, Emscripten_HandleVisibilityChange);
+}
+
+void
+Emscripten_UnregisterEventHandlers(SDL_WindowData *data)
+{
+ const char *target;
+
+ /* only works due to having one window */
+ emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL);
+
+ emscripten_set_mousedown_callback("#canvas", NULL, 0, NULL);
+ emscripten_set_mouseup_callback("#document", NULL, 0, NULL);
+
+ emscripten_set_mouseenter_callback("#canvas", NULL, 0, NULL);
+ emscripten_set_mouseleave_callback("#canvas", NULL, 0, NULL);
+
+ emscripten_set_wheel_callback("#canvas", NULL, 0, NULL);
+
+ emscripten_set_focus_callback("#window", NULL, 0, NULL);
+ emscripten_set_blur_callback("#window", NULL, 0, NULL);
+
+ emscripten_set_touchstart_callback("#canvas", NULL, 0, NULL);
+ emscripten_set_touchend_callback("#canvas", NULL, 0, NULL);
+ emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL);
+ emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL);
+
+ emscripten_set_pointerlockchange_callback("#document", NULL, 0, NULL);
+
+ target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
+ if (!target) {
+ target = "#window";
+ }
+
+ emscripten_set_keydown_callback(target, NULL, 0, NULL);
+ emscripten_set_keyup_callback(target, NULL, 0, NULL);
+ emscripten_set_keypress_callback(target, NULL, 0, NULL);
+
+ emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL);
+
+ emscripten_set_resize_callback("#window", NULL, 0, NULL);
+
+ emscripten_set_visibilitychange_callback(NULL, 0, NULL);
+}
+
+#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.h b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.h
new file mode 100644
index 0000000..3a4e058
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenevents.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+#ifndef SDL_emscriptenevents_h_
+#define SDL_emscriptenevents_h_
+
+#include "SDL_emscriptenvideo.h"
+
+extern void
+Emscripten_RegisterEventHandlers(SDL_WindowData *data);
+
+extern void
+Emscripten_UnregisterEventHandlers(SDL_WindowData *data);
+
+extern EM_BOOL
+Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userData);
+
+#endif /* SDL_emscriptenevents_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c
new file mode 100644
index 0000000..bfdec3b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c
@@ -0,0 +1,178 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN
+
+#include "SDL_emscriptenvideo.h"
+#include "SDL_emscriptenframebuffer.h"
+
+
+int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch)
+{
+ SDL_Surface *surface;
+ const Uint32 surface_format = SDL_PIXELFORMAT_BGR888;
+ int w, h;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ /* Free the old framebuffer surface */
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ surface = data->surface;
+ SDL_FreeSurface(surface);
+
+ /* Create a new one */
+ SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask);
+ SDL_GetWindowSize(window, &w, &h);
+
+ surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
+ if (!surface) {
+ return -1;
+ }
+
+ /* Save the info and return! */
+ data->surface = surface;
+ *format = surface_format;
+ *pixels = surface->pixels;
+ *pitch = surface->pitch;
+ return 0;
+}
+
+int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects)
+{
+ SDL_Surface *surface;
+
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ surface = data->surface;
+ if (!surface) {
+ return SDL_SetError("Couldn't find framebuffer surface for window");
+ }
+
+ /* Send the data to the display */
+
+ EM_ASM_INT({
+ var w = $0;
+ var h = $1;
+ var pixels = $2;
+
+ if (!Module['SDL2']) Module['SDL2'] = {};
+ var SDL2 = Module['SDL2'];
+ if (SDL2.ctxCanvas !== Module['canvas']) {
+ SDL2.ctx = Module['createContext'](Module['canvas'], false, true);
+ SDL2.ctxCanvas = Module['canvas'];
+ }
+ if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) {
+ SDL2.image = SDL2.ctx.createImageData(w, h);
+ SDL2.w = w;
+ SDL2.h = h;
+ SDL2.imageCtx = SDL2.ctx;
+ }
+ var data = SDL2.image.data;
+ var src = pixels >> 2;
+ var dst = 0;
+ var num;
+ if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) {
+ // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray,
+ // not UInt8ClampedArray. These don't have buffers, so we need to revert
+ // to copying a byte at a time. We do the undefined check because modern
+ // browsers do not define CanvasPixelArray anymore.
+ num = data.length;
+ while (dst < num) {
+ var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}};
+ data[dst ] = val & 0xff;
+ data[dst+1] = (val >> 8) & 0xff;
+ data[dst+2] = (val >> 16) & 0xff;
+ data[dst+3] = 0xff;
+ src++;
+ dst += 4;
+ }
+ } else {
+ if (SDL2.data32Data !== data) {
+ SDL2.data32 = new Int32Array(data.buffer);
+ SDL2.data8 = new Uint8Array(data.buffer);
+ }
+ var data32 = SDL2.data32;
+ num = data32.length;
+ // logically we need to do
+ // while (dst < num) {
+ // data32[dst++] = HEAP32[src++] | 0xff000000
+ // }
+ // the following code is faster though, because
+ // .set() is almost free - easily 10x faster due to
+ // native memcpy efficiencies, and the remaining loop
+ // just stores, not load + store, so it is faster
+ data32.set(HEAP32.subarray(src, src + num));
+ var data8 = SDL2.data8;
+ var i = 3;
+ var j = i + 4*num;
+ if (num % 8 == 0) {
+ // unrolling gives big speedups
+ while (i < j) {
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ }
+ } else {
+ while (i < j) {
+ data8[i] = 0xff;
+ i = i + 4 | 0;
+ }
+ }
+ }
+
+ SDL2.ctx.putImageData(SDL2.image, 0, 0);
+ return 0;
+ }, surface->w, surface->h, surface->pixels);
+
+ /*if (SDL_getenv("SDL_VIDEO_Emscripten_SAVE_FRAMES")) {
+ static int frame_number = 0;
+ char file[128];
+ SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
+ SDL_GetWindowID(window), ++frame_number);
+ SDL_SaveBMP(surface, file);
+ }*/
+ return 0;
+}
+
+void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ SDL_FreeSurface(data->surface);
+ data->surface = NULL;
+}
+
+#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h
new file mode 100644
index 0000000..49a215a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_emscriptenframebuffer_h_
+#define SDL_emscriptenframebuffer_h_
+
+extern int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch);
+extern int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects);
+extern void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
+
+#endif /* SDL_emscriptenframebuffer_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.c b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.c
new file mode 100644
index 0000000..490f5b0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.c
@@ -0,0 +1,274 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN
+
+#include <emscripten/emscripten.h>
+#include <emscripten/html5.h>
+
+#include "SDL_emscriptenmouse.h"
+
+#include "../../events/SDL_mouse_c.h"
+#include "SDL_assert.h"
+
+static SDL_Cursor*
+Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom)
+{
+ SDL_Cursor* cursor;
+ Emscripten_CursorData *curdata;
+
+ cursor = SDL_calloc(1, sizeof(SDL_Cursor));
+ if (cursor) {
+ curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata));
+ if (!curdata) {
+ SDL_OutOfMemory();
+ SDL_free(cursor);
+ return NULL;
+ }
+
+ curdata->system_cursor = cursor_str;
+ curdata->is_custom = is_custom;
+ cursor->driverdata = curdata;
+ }
+ else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor*
+Emscripten_CreateDefaultCursor()
+{
+ return Emscripten_CreateCursorFromString("default", SDL_FALSE);
+}
+
+static SDL_Cursor*
+Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
+{
+ const char *cursor_url = NULL;
+ SDL_Surface *conv_surf;
+
+ conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0);
+
+ if (!conv_surf) {
+ return NULL;
+ }
+
+ cursor_url = (const char *)EM_ASM_INT({
+ var w = $0;
+ var h = $1;
+ var hot_x = $2;
+ var hot_y = $3;
+ var pixels = $4;
+
+ var canvas = document.createElement("canvas");
+ canvas.width = w;
+ canvas.height = h;
+
+ var ctx = canvas.getContext("2d");
+
+ var image = ctx.createImageData(w, h);
+ var data = image.data;
+ var src = pixels >> 2;
+ var dst = 0;
+ var num;
+ if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) {
+ // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray,
+ // not UInt8ClampedArray. These don't have buffers, so we need to revert
+ // to copying a byte at a time. We do the undefined check because modern
+ // browsers do not define CanvasPixelArray anymore.
+ num = data.length;
+ while (dst < num) {
+ var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}};
+ data[dst ] = val & 0xff;
+ data[dst+1] = (val >> 8) & 0xff;
+ data[dst+2] = (val >> 16) & 0xff;
+ data[dst+3] = (val >> 24) & 0xff;
+ src++;
+ dst += 4;
+ }
+ } else {
+ var data32 = new Int32Array(data.buffer);
+ num = data32.length;
+ data32.set(HEAP32.subarray(src, src + num));
+ }
+
+ ctx.putImageData(image, 0, 0);
+ var url = hot_x === 0 && hot_y === 0
+ ? "url(" + canvas.toDataURL() + "), auto"
+ : "url(" + canvas.toDataURL() + ") " + hot_x + " " + hot_y + ", auto";
+
+ var urlBuf = _malloc(url.length + 1);
+ stringToUTF8(url, urlBuf, url.length + 1);
+
+ return urlBuf;
+ }, surface->w, surface->h, hot_x, hot_y, conv_surf->pixels);
+
+ SDL_FreeSurface(conv_surf);
+
+ return Emscripten_CreateCursorFromString(cursor_url, SDL_TRUE);
+}
+
+static SDL_Cursor*
+Emscripten_CreateSystemCursor(SDL_SystemCursor id)
+{
+ const char *cursor_name = NULL;
+
+ switch(id) {
+ case SDL_SYSTEM_CURSOR_ARROW:
+ cursor_name = "default";
+ break;
+ case SDL_SYSTEM_CURSOR_IBEAM:
+ cursor_name = "text";
+ break;
+ case SDL_SYSTEM_CURSOR_WAIT:
+ cursor_name = "wait";
+ break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR:
+ cursor_name = "crosshair";
+ break;
+ case SDL_SYSTEM_CURSOR_WAITARROW:
+ cursor_name = "progress";
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE:
+ cursor_name = "nwse-resize";
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENESW:
+ cursor_name = "nesw-resize";
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEWE:
+ cursor_name = "ew-resize";
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENS:
+ cursor_name = "ns-resize";
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEALL:
+ break;
+ case SDL_SYSTEM_CURSOR_NO:
+ cursor_name = "not-allowed";
+ break;
+ case SDL_SYSTEM_CURSOR_HAND:
+ cursor_name = "pointer";
+ break;
+ default:
+ SDL_assert(0);
+ return NULL;
+ }
+
+ return Emscripten_CreateCursorFromString(cursor_name, SDL_FALSE);
+}
+
+static void
+Emscripten_FreeCursor(SDL_Cursor* cursor)
+{
+ Emscripten_CursorData *curdata;
+ if (cursor) {
+ curdata = (Emscripten_CursorData *) cursor->driverdata;
+
+ if (curdata != NULL) {
+ if (curdata->is_custom) {
+ SDL_free((char *)curdata->system_cursor);
+ }
+ SDL_free(cursor->driverdata);
+ }
+
+ SDL_free(cursor);
+ }
+}
+
+static int
+Emscripten_ShowCursor(SDL_Cursor* cursor)
+{
+ Emscripten_CursorData *curdata;
+ if (SDL_GetMouseFocus() != NULL) {
+ if(cursor && cursor->driverdata) {
+ curdata = (Emscripten_CursorData *) cursor->driverdata;
+
+ if(curdata->system_cursor) {
+ EM_ASM_INT({
+ if (Module['canvas']) {
+ Module['canvas'].style['cursor'] = Module['Pointer_stringify']($0);
+ }
+ return 0;
+ }, curdata->system_cursor);
+ }
+ }
+ else {
+ EM_ASM(
+ if (Module['canvas']) {
+ Module['canvas'].style['cursor'] = 'none';
+ }
+ );
+ }
+ }
+ return 0;
+}
+
+static void
+Emscripten_WarpMouse(SDL_Window* window, int x, int y)
+{
+ SDL_Unsupported();
+}
+
+static int
+Emscripten_SetRelativeMouseMode(SDL_bool enabled)
+{
+ /* TODO: pointer lock isn't actually enabled yet */
+ if(enabled) {
+ if(emscripten_request_pointerlock(NULL, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
+ return 0;
+ }
+ } else {
+ if(emscripten_exit_pointerlock() >= EMSCRIPTEN_RESULT_SUCCESS) {
+ return 0;
+ }
+ }
+ return -1;
+}
+
+void
+Emscripten_InitMouse()
+{
+ SDL_Mouse* mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = Emscripten_CreateCursor;
+ mouse->ShowCursor = Emscripten_ShowCursor;
+ mouse->FreeCursor = Emscripten_FreeCursor;
+ mouse->WarpMouse = Emscripten_WarpMouse;
+ mouse->CreateSystemCursor = Emscripten_CreateSystemCursor;
+ mouse->SetRelativeMouseMode = Emscripten_SetRelativeMouseMode;
+
+ SDL_SetDefaultCursor(Emscripten_CreateDefaultCursor());
+}
+
+void
+Emscripten_FiniMouse()
+{
+}
+
+#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.h b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.h
new file mode 100644
index 0000000..d6cd492
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenmouse.h
@@ -0,0 +1,42 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+
+#ifndef SDL_emscriptenmouse_h_
+#define SDL_emscriptenmouse_h_
+
+#include "SDL_stdinc.h"
+
+typedef struct _Emscripten_CursorData
+{
+ const char *system_cursor;
+ SDL_bool is_custom;
+} Emscripten_CursorData;
+
+extern void
+Emscripten_InitMouse();
+
+extern void
+Emscripten_FiniMouse();
+
+#endif /* SDL_emscriptenmouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.c b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.c
new file mode 100644
index 0000000..a6609ed
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.c
@@ -0,0 +1,119 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL
+
+#include <emscripten/emscripten.h>
+#include <GLES2/gl2.h>
+
+#include "SDL_emscriptenvideo.h"
+#include "SDL_emscriptenopengles.h"
+
+#define LOAD_FUNC(NAME) _this->egl_data->NAME = NAME;
+
+/* EGL implementation of SDL OpenGL support */
+
+int
+Emscripten_GLES_LoadLibrary(_THIS, const char *path) {
+ /*we can't load EGL dynamically*/
+ _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData));
+ if (!_this->egl_data) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Emscripten forces you to manually cast eglGetProcAddress to the real
+ function type; grep for "__eglMustCastToProperFunctionPointerType" in
+ Emscripten's egl.h for details. */
+ _this->egl_data->eglGetProcAddress = (void *(EGLAPIENTRY *)(const char *)) eglGetProcAddress;
+
+ LOAD_FUNC(eglGetDisplay);
+ LOAD_FUNC(eglInitialize);
+ LOAD_FUNC(eglTerminate);
+ LOAD_FUNC(eglChooseConfig);
+ LOAD_FUNC(eglGetConfigAttrib);
+ LOAD_FUNC(eglCreateContext);
+ LOAD_FUNC(eglDestroyContext);
+ LOAD_FUNC(eglCreateWindowSurface);
+ LOAD_FUNC(eglDestroySurface);
+ LOAD_FUNC(eglMakeCurrent);
+ LOAD_FUNC(eglSwapBuffers);
+ LOAD_FUNC(eglSwapInterval);
+ LOAD_FUNC(eglWaitNative);
+ LOAD_FUNC(eglWaitGL);
+ LOAD_FUNC(eglBindAPI);
+
+ _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (!_this->egl_data->egl_display) {
+ return SDL_SetError("Could not get EGL display");
+ }
+
+ if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
+ return SDL_SetError("Could not initialize EGL");
+ }
+
+ if (path) {
+ SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1);
+ } else {
+ *_this->gl_config.driver_path = '\0';
+ }
+
+ return 0;
+}
+
+void
+Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context)
+{
+ /*
+ WebGL contexts can't actually be deleted, so we need to reset it.
+ ES2 renderer resets state on init anyway, clearing the canvas should be enough
+ */
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+
+ SDL_EGL_DeleteContext(_this, context);
+}
+
+SDL_EGL_CreateContext_impl(Emscripten)
+SDL_EGL_SwapWindow_impl(Emscripten)
+SDL_EGL_MakeCurrent_impl(Emscripten)
+
+void
+Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
+{
+ SDL_WindowData *data;
+ if (window->driverdata) {
+ data = (SDL_WindowData *) window->driverdata;
+
+ if (w) {
+ *w = window->w * data->pixel_ratio;
+ }
+
+ if (h) {
+ *h = window->h * data->pixel_ratio;
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.h b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.h
new file mode 100644
index 0000000..fbd93cb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenopengles.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_emscriptenopengles_h_
+#define SDL_emscriptenopengles_h_
+
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define Emscripten_GLES_GetAttribute SDL_EGL_GetAttribute
+#define Emscripten_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define Emscripten_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define Emscripten_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define Emscripten_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+
+extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path);
+extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern void Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h);
+
+#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_emscriptenopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.c b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.c
new file mode 100644
index 0000000..cbb933d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.c
@@ -0,0 +1,354 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_EMSCRIPTEN
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_hints.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../SDL_egl_c.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_emscriptenvideo.h"
+#include "SDL_emscriptenopengles.h"
+#include "SDL_emscriptenframebuffer.h"
+#include "SDL_emscriptenevents.h"
+#include "SDL_emscriptenmouse.h"
+
+#define EMSCRIPTENVID_DRIVER_NAME "emscripten"
+
+/* Initialization/Query functions */
+static int Emscripten_VideoInit(_THIS);
+static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+static void Emscripten_VideoQuit(_THIS);
+
+static int Emscripten_CreateWindow(_THIS, SDL_Window * window);
+static void Emscripten_SetWindowSize(_THIS, SDL_Window * window);
+static void Emscripten_DestroyWindow(_THIS, SDL_Window * window);
+static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+static void Emscripten_PumpEvents(_THIS);
+static void Emscripten_SetWindowTitle(_THIS, SDL_Window * window);
+
+
+/* Emscripten driver bootstrap functions */
+
+static int
+Emscripten_Available(void)
+{
+ return (1);
+}
+
+static void
+Emscripten_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+Emscripten_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_OutOfMemory();
+ return (0);
+ }
+
+ /* Firefox sends blur event which would otherwise prevent full screen
+ * when the user clicks to allow full screen.
+ * See https://bugzilla.mozilla.org/show_bug.cgi?id=1144964
+ */
+ SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
+
+ /* Set the function pointers */
+ device->VideoInit = Emscripten_VideoInit;
+ device->VideoQuit = Emscripten_VideoQuit;
+ device->SetDisplayMode = Emscripten_SetDisplayMode;
+
+
+ device->PumpEvents = Emscripten_PumpEvents;
+
+ device->CreateSDLWindow = Emscripten_CreateWindow;
+ device->SetWindowTitle = Emscripten_SetWindowTitle;
+ /*device->SetWindowIcon = Emscripten_SetWindowIcon;
+ device->SetWindowPosition = Emscripten_SetWindowPosition;*/
+ device->SetWindowSize = Emscripten_SetWindowSize;
+ /*device->ShowWindow = Emscripten_ShowWindow;
+ device->HideWindow = Emscripten_HideWindow;
+ device->RaiseWindow = Emscripten_RaiseWindow;
+ device->MaximizeWindow = Emscripten_MaximizeWindow;
+ device->MinimizeWindow = Emscripten_MinimizeWindow;
+ device->RestoreWindow = Emscripten_RestoreWindow;
+ device->SetWindowGrab = Emscripten_SetWindowGrab;*/
+ device->DestroyWindow = Emscripten_DestroyWindow;
+ device->SetWindowFullscreen = Emscripten_SetWindowFullscreen;
+
+ device->CreateWindowFramebuffer = Emscripten_CreateWindowFramebuffer;
+ device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer;
+ device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer;
+
+#if SDL_VIDEO_OPENGL_EGL
+ device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary;
+ device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary;
+ device->GL_CreateContext = Emscripten_GLES_CreateContext;
+ device->GL_MakeCurrent = Emscripten_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = Emscripten_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = Emscripten_GLES_GetSwapInterval;
+ device->GL_SwapWindow = Emscripten_GLES_SwapWindow;
+ device->GL_DeleteContext = Emscripten_GLES_DeleteContext;
+ device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize;
+#endif
+
+ device->free = Emscripten_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap Emscripten_bootstrap = {
+ EMSCRIPTENVID_DRIVER_NAME, "SDL emscripten video driver",
+ Emscripten_Available, Emscripten_CreateDevice
+};
+
+
+int
+Emscripten_VideoInit(_THIS)
+{
+ SDL_DisplayMode mode;
+
+ /* Use a fake 32-bpp desktop mode */
+ mode.format = SDL_PIXELFORMAT_RGB888;
+
+ mode.w = EM_ASM_INT_V({
+ return screen.width;
+ });
+
+ mode.h = EM_ASM_INT_V({
+ return screen.height;
+ });
+
+ mode.refresh_rate = 0;
+ mode.driverdata = NULL;
+ if (SDL_AddBasicVideoDisplay(&mode) < 0) {
+ return -1;
+ }
+
+ SDL_zero(mode);
+ SDL_AddDisplayMode(&_this->displays[0], &mode);
+
+ Emscripten_InitMouse();
+
+ /* We're done! */
+ return 0;
+}
+
+static int
+Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ /* can't do this */
+ return 0;
+}
+
+static void
+Emscripten_VideoQuit(_THIS)
+{
+ Emscripten_FiniMouse();
+}
+
+static void
+Emscripten_PumpEvents(_THIS)
+{
+ /* do nothing. */
+}
+
+static int
+Emscripten_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wdata;
+ double scaled_w, scaled_h;
+ double css_w, css_h;
+
+ /* Allocate window internal data */
+ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (wdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ wdata->pixel_ratio = emscripten_get_device_pixel_ratio();
+ } else {
+ wdata->pixel_ratio = 1.0f;
+ }
+
+ scaled_w = SDL_floor(window->w * wdata->pixel_ratio);
+ scaled_h = SDL_floor(window->h * wdata->pixel_ratio);
+
+ emscripten_set_canvas_size(scaled_w, scaled_h);
+
+ emscripten_get_element_css_size(NULL, &css_w, &css_h);
+
+ wdata->external_size = SDL_floor(css_w) != scaled_w || SDL_floor(css_h) != scaled_h;
+
+ if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) {
+ /* external css has resized us */
+ scaled_w = css_w * wdata->pixel_ratio;
+ scaled_h = css_h * wdata->pixel_ratio;
+
+ emscripten_set_canvas_size(scaled_w, scaled_h);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, css_w, css_h);
+ }
+
+ /* if the size is not being controlled by css, we need to scale down for hidpi */
+ if (!wdata->external_size) {
+ if (wdata->pixel_ratio != 1.0f) {
+ /*scale canvas down*/
+ emscripten_set_element_css_size(NULL, window->w, window->h);
+ }
+ }
+
+#if SDL_VIDEO_OPENGL_EGL
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ if (!_this->egl_data) {
+ if (SDL_GL_LoadLibrary(NULL) < 0) {
+ return -1;
+ }
+ }
+ wdata->egl_surface = SDL_EGL_CreateSurface(_this, 0);
+
+ if (wdata->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("Could not create GLES window surface");
+ }
+ }
+#endif
+
+ wdata->window = window;
+
+ /* Setup driver data for this window */
+ window->driverdata = wdata;
+
+ /* One window, it always has focus */
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+
+ Emscripten_RegisterEventHandlers(wdata);
+
+ /* Window has been successfully created */
+ return 0;
+}
+
+static void Emscripten_SetWindowSize(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data;
+
+ if (window->driverdata) {
+ data = (SDL_WindowData *) window->driverdata;
+ /* update pixel ratio */
+ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ data->pixel_ratio = emscripten_get_device_pixel_ratio();
+ }
+ emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio);
+
+ /*scale canvas down*/
+ if (!data->external_size && data->pixel_ratio != 1.0f) {
+ emscripten_set_element_css_size(NULL, window->w, window->h);
+ }
+ }
+}
+
+static void
+Emscripten_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data;
+
+ if(window->driverdata) {
+ data = (SDL_WindowData *) window->driverdata;
+
+ Emscripten_UnregisterEventHandlers(data);
+#if SDL_VIDEO_OPENGL_EGL
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ data->egl_surface = EGL_NO_SURFACE;
+ }
+#endif
+ SDL_free(window->driverdata);
+ window->driverdata = NULL;
+ }
+}
+
+static void
+Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{
+ SDL_WindowData *data;
+ if(window->driverdata) {
+ data = (SDL_WindowData *) window->driverdata;
+
+ if(fullscreen) {
+ EmscriptenFullscreenStrategy strategy;
+ SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
+ int res;
+
+ strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
+
+ if(!is_desktop_fullscreen) {
+ strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE;
+ } else if(window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF;
+ } else {
+ strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
+ }
+
+ strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
+
+ strategy.canvasResizedCallback = Emscripten_HandleCanvasResize;
+ strategy.canvasResizedCallbackUserData = data;
+
+ data->requested_fullscreen_mode = window->flags & (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
+ data->fullscreen_resize = is_desktop_fullscreen;
+
+ res = emscripten_request_fullscreen_strategy(NULL, 1, &strategy);
+ if(res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
+ /* unset flags, fullscreen failed */
+ window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
+ }
+ }
+ else
+ emscripten_exit_fullscreen();
+ }
+}
+
+static void
+Emscripten_SetWindowTitle(_THIS, SDL_Window * window) {
+ EM_ASM_INT({
+ if (typeof Module['setWindowTitle'] !== 'undefined') {
+ Module['setWindowTitle'](Module['Pointer_stringify']($0));
+ }
+ return 0;
+ }, window->title);
+}
+
+#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.h b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.h
new file mode 100644
index 0000000..c2001b0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/emscripten/SDL_emscriptenvideo.h
@@ -0,0 +1,58 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_emscriptenvideo_h_
+#define SDL_emscriptenvideo_h_
+
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_touch_c.h"
+#include <emscripten/emscripten.h>
+#include <emscripten/html5.h>
+
+#if SDL_VIDEO_OPENGL_EGL
+#include <EGL/egl.h>
+#endif
+
+typedef struct SDL_WindowData
+{
+#if SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+ SDL_Window *window;
+ SDL_Surface *surface;
+
+ float pixel_ratio;
+
+ SDL_bool external_size;
+
+ int requested_fullscreen_mode;
+ SDL_bool fullscreen_resize;
+
+ SDL_bool finger_touching; /* for mapping touch events to mice */
+ SDL_FingerID first_finger;
+
+ SDL_bool has_pointer_lock;
+} SDL_WindowData;
+
+#endif /* SDL_emscriptenvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_BWin.h b/src/3rdparty/SDL2/src/video/haiku/SDL_BWin.h
new file mode 100644
index 0000000..3e61888
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_BWin.h
@@ -0,0 +1,679 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BWin_h_
+#define SDL_BWin_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../SDL_internal.h"
+#include "SDL.h"
+#include "SDL_syswm.h"
+#include "SDL_bframebuffer.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <stdio.h>
+#include <AppKit.h>
+#include <InterfaceKit.h>
+#include <game/DirectWindow.h>
+#if SDL_VIDEO_OPENGL
+#include <opengl/GLView.h>
+#endif
+#include "SDL_events.h"
+#include "../../main/haiku/SDL_BApp.h"
+
+
+enum WinCommands {
+ BWIN_MOVE_WINDOW,
+ BWIN_RESIZE_WINDOW,
+ BWIN_SHOW_WINDOW,
+ BWIN_HIDE_WINDOW,
+ BWIN_MAXIMIZE_WINDOW,
+ BWIN_MINIMIZE_WINDOW,
+ BWIN_RESTORE_WINDOW,
+ BWIN_SET_TITLE,
+ BWIN_SET_BORDERED,
+ BWIN_SET_RESIZABLE,
+ BWIN_FULLSCREEN
+};
+
+
+class SDL_BWin:public BDirectWindow
+{
+ public:
+ /* Constructor/Destructor */
+ SDL_BWin(BRect bounds, window_look look, uint32 flags)
+ : BDirectWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags)
+ {
+ _last_buttons = 0;
+
+#if SDL_VIDEO_OPENGL
+ _SDL_GLView = NULL;
+ _gl_type = 0;
+#endif
+ _shown = false;
+ _inhibit_resize = false;
+ _mouse_focused = false;
+ _prev_frame = NULL;
+
+ /* Handle framebuffer stuff */
+ _connected = _connection_disabled = false;
+ _buffer_created = _buffer_dirty = false;
+ _trash_window_buffer = false;
+ _buffer_locker = new BLocker();
+ _bitmap = NULL;
+ _clips = NULL;
+
+#ifdef DRAWTHREAD
+ _draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread",
+ B_NORMAL_PRIORITY, (void*) this);
+ resume_thread(_draw_thread_id);
+#endif
+ }
+
+ virtual ~ SDL_BWin()
+ {
+ Lock();
+ _connection_disabled = true;
+ int32 result;
+
+#if SDL_VIDEO_OPENGL
+ if (_SDL_GLView) {
+ _SDL_GLView->UnlockGL();
+ RemoveChild(_SDL_GLView); /* Why was this outside the if
+ statement before? */
+ }
+
+#endif
+ Unlock();
+#if SDL_VIDEO_OPENGL
+ if (_SDL_GLView) {
+ delete _SDL_GLView;
+ }
+#endif
+
+ delete _prev_frame;
+
+ /* Clean up framebuffer stuff */
+ _buffer_locker->Lock();
+#ifdef DRAWTHREAD
+ wait_for_thread(_draw_thread_id, &result);
+#endif
+ free(_clips);
+ delete _buffer_locker;
+ }
+
+
+ /* * * * * OpenGL functionality * * * * */
+#if SDL_VIDEO_OPENGL
+ virtual BGLView *CreateGLView(Uint32 gl_flags) {
+ Lock();
+ if (_SDL_GLView == NULL) {
+ _SDL_GLView = new BGLView(Bounds(), "SDL GLView",
+ B_FOLLOW_ALL_SIDES,
+ (B_WILL_DRAW | B_FRAME_EVENTS),
+ gl_flags);
+ _gl_type = gl_flags;
+ }
+ AddChild(_SDL_GLView);
+ _SDL_GLView->EnableDirectMode(true);
+ _SDL_GLView->LockGL(); /* "New" GLViews are created */
+ Unlock();
+ return (_SDL_GLView);
+ }
+
+ virtual void RemoveGLView() {
+ Lock();
+ if(_SDL_GLView) {
+ _SDL_GLView->UnlockGL();
+ RemoveChild(_SDL_GLView);
+ }
+ Unlock();
+ }
+
+ virtual void SwapBuffers(void) {
+ _SDL_GLView->UnlockGL();
+ _SDL_GLView->LockGL();
+ _SDL_GLView->SwapBuffers();
+ }
+#endif
+
+ /* * * * * Framebuffering* * * * */
+ virtual void DirectConnected(direct_buffer_info *info) {
+ if(!_connected && _connection_disabled) {
+ return;
+ }
+
+ /* Determine if the pixel buffer is usable after this update */
+ _trash_window_buffer = _trash_window_buffer
+ || ((info->buffer_state & B_BUFFER_RESIZED)
+ || (info->buffer_state & B_BUFFER_RESET)
+ || (info->driver_state == B_MODE_CHANGED));
+ LockBuffer();
+
+ switch(info->buffer_state & B_DIRECT_MODE_MASK) {
+ case B_DIRECT_START:
+ _connected = true;
+
+ case B_DIRECT_MODIFY:
+ if(_clips) {
+ free(_clips);
+ _clips = NULL;
+ }
+
+ _num_clips = info->clip_list_count;
+ _clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
+ if(_clips) {
+ memcpy(_clips, info->clip_list,
+ _num_clips*sizeof(clipping_rect));
+
+ _bits = (uint8*) info->bits;
+ _row_bytes = info->bytes_per_row;
+ _bounds = info->window_bounds;
+ _bytes_per_px = info->bits_per_pixel / 8;
+ _buffer_dirty = true;
+ }
+ break;
+
+ case B_DIRECT_STOP:
+ _connected = false;
+ break;
+ }
+#if SDL_VIDEO_OPENGL
+ if(_SDL_GLView) {
+ _SDL_GLView->DirectConnected(info);
+ }
+#endif
+
+
+ /* Call the base object directconnected */
+ BDirectWindow::DirectConnected(info);
+
+ UnlockBuffer();
+
+ }
+
+
+
+
+ /* * * * * Event sending * * * * */
+ /* Hook functions */
+ virtual void FrameMoved(BPoint origin) {
+ /* Post a message to the BApp so that it can handle the window event */
+ BMessage msg(BAPP_WINDOW_MOVED);
+ msg.AddInt32("window-x", (int)origin.x);
+ msg.AddInt32("window-y", (int)origin.y);
+ _PostWindowEvent(msg);
+
+ /* Perform normal hook operations */
+ BDirectWindow::FrameMoved(origin);
+ }
+
+ virtual void FrameResized(float width, float height) {
+ /* Post a message to the BApp so that it can handle the window event */
+ BMessage msg(BAPP_WINDOW_RESIZED);
+
+ msg.AddInt32("window-w", (int)width + 1);
+ msg.AddInt32("window-h", (int)height + 1);
+ _PostWindowEvent(msg);
+
+ /* Perform normal hook operations */
+ BDirectWindow::FrameResized(width, height);
+ }
+
+ virtual bool QuitRequested() {
+ BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
+ _PostWindowEvent(msg);
+
+ /* We won't allow a quit unless asked by DestroyWindow() */
+ return false;
+ }
+
+ virtual void WindowActivated(bool active) {
+ BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */
+ msg.AddBool("focusGained", active);
+ _PostWindowEvent(msg);
+ }
+
+ virtual void Zoom(BPoint origin,
+ float width,
+ float height) {
+ BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */
+ _PostWindowEvent(msg);
+
+ /* Before the window zooms, record its size */
+ if( !_prev_frame )
+ _prev_frame = new BRect(Frame());
+
+ /* Perform normal hook operations */
+ BDirectWindow::Zoom(origin, width, height);
+ }
+
+ /* Member functions */
+ virtual void Show() {
+ while(IsHidden()) {
+ BDirectWindow::Show();
+ }
+ _shown = true;
+
+ BMessage msg(BAPP_SHOW);
+ _PostWindowEvent(msg);
+ }
+
+ virtual void Hide() {
+ BDirectWindow::Hide();
+ _shown = false;
+
+ BMessage msg(BAPP_HIDE);
+ _PostWindowEvent(msg);
+ }
+
+ virtual void Minimize(bool minimize) {
+ BDirectWindow::Minimize(minimize);
+ int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE);
+
+ BMessage msg(minState);
+ _PostWindowEvent(msg);
+ }
+
+
+ /* BView message interruption */
+ virtual void DispatchMessage(BMessage * msg, BHandler * target)
+ {
+ BPoint where; /* Used by mouse moved */
+ int32 buttons; /* Used for mouse button events */
+ int32 key; /* Used for key events */
+
+ switch (msg->what) {
+ case B_MOUSE_MOVED:
+ int32 transit;
+ if (msg->FindPoint("where", &where) == B_OK
+ && msg->FindInt32("be:transit", &transit) == B_OK) {
+ _MouseMotionEvent(where, transit);
+ }
+
+ /* FIXME: Apparently a button press/release event might be dropped
+ if made before before a different button is released. Does
+ B_MOUSE_MOVED have the data needed to check if a mouse button
+ state has changed? */
+ if (msg->FindInt32("buttons", &buttons) == B_OK) {
+ _MouseButtonEvent(buttons);
+ }
+ break;
+
+ case B_MOUSE_DOWN:
+ case B_MOUSE_UP:
+ /* _MouseButtonEvent() detects any and all buttons that may have
+ changed state, as well as that button's new state */
+ if (msg->FindInt32("buttons", &buttons) == B_OK) {
+ _MouseButtonEvent(buttons);
+ }
+ break;
+
+ case B_MOUSE_WHEEL_CHANGED:
+ float x, y;
+ if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK
+ && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
+ _MouseWheelEvent((int)x, (int)y);
+ }
+ break;
+
+ case B_KEY_DOWN:
+ {
+ int32 i = 0;
+ int8 byte;
+ int8 bytes[4] = { 0, 0, 0, 0 };
+ while (i < 4 && msg->FindInt8("byte", i, &byte) == B_OK) {
+ bytes[i] = byte;
+ i++;
+ }
+ if (msg->FindInt32("key", &key) == B_OK) {
+ _KeyEvent((SDL_Scancode)key, &bytes[0], i, SDL_PRESSED);
+ }
+ }
+ break;
+
+ case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
+ if (msg->FindInt32("key", &key) == B_OK) {
+ _KeyEvent((SDL_Scancode)key, NULL, 0, SDL_PRESSED);
+ }
+ break;
+
+ case B_KEY_UP:
+ case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */
+ if (msg->FindInt32("key", &key) == B_OK) {
+ _KeyEvent(key, NULL, 0, SDL_RELEASED);
+ }
+ break;
+
+ default:
+ /* move it after switch{} so it's always handled
+ that way we keep Haiku features like:
+ - CTRL+Q to close window (and other shortcuts)
+ - PrintScreen to make screenshot into /boot/home
+ - etc.. */
+ /* BDirectWindow::DispatchMessage(msg, target); */
+ break;
+ }
+
+ BDirectWindow::DispatchMessage(msg, target);
+ }
+
+ /* Handle command messages */
+ virtual void MessageReceived(BMessage* message) {
+ switch (message->what) {
+ /* Handle commands from SDL */
+ case BWIN_SET_TITLE:
+ _SetTitle(message);
+ break;
+ case BWIN_MOVE_WINDOW:
+ _MoveTo(message);
+ break;
+ case BWIN_RESIZE_WINDOW:
+ _ResizeTo(message);
+ break;
+ case BWIN_SET_BORDERED:
+ _SetBordered(message);
+ break;
+ case BWIN_SET_RESIZABLE:
+ _SetResizable(message);
+ break;
+ case BWIN_SHOW_WINDOW:
+ Show();
+ break;
+ case BWIN_HIDE_WINDOW:
+ Hide();
+ break;
+ case BWIN_MAXIMIZE_WINDOW:
+ BWindow::Zoom();
+ break;
+ case BWIN_MINIMIZE_WINDOW:
+ Minimize(true);
+ break;
+ case BWIN_RESTORE_WINDOW:
+ _Restore();
+ break;
+ case BWIN_FULLSCREEN:
+ _SetFullScreen(message);
+ break;
+ default:
+ /* Perform normal message handling */
+ BDirectWindow::MessageReceived(message);
+ break;
+ }
+
+ }
+
+
+
+ /* Accessor methods */
+ bool IsShown() { return _shown; }
+ int32 GetID() { return _id; }
+ uint32 GetRowBytes() { return _row_bytes; }
+ int32 GetFbX() { return _bounds.left; }
+ int32 GetFbY() { return _bounds.top; }
+ bool ConnectionEnabled() { return !_connection_disabled; }
+ bool Connected() { return _connected; }
+ clipping_rect *GetClips() { return _clips; }
+ int32 GetNumClips() { return _num_clips; }
+ uint8* GetBufferPx() { return _bits; }
+ int32 GetBytesPerPx() { return _bytes_per_px; }
+ bool CanTrashWindowBuffer() { return _trash_window_buffer; }
+ bool BufferExists() { return _buffer_created; }
+ bool BufferIsDirty() { return _buffer_dirty; }
+ BBitmap *GetBitmap() { return _bitmap; }
+#if SDL_VIDEO_OPENGL
+ BGLView *GetGLView() { return _SDL_GLView; }
+ Uint32 GetGLType() { return _gl_type; }
+#endif
+
+ /* Setter methods */
+ void SetID(int32 id) { _id = id; }
+ void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; }
+ void LockBuffer() { _buffer_locker->Lock(); }
+ void UnlockBuffer() { _buffer_locker->Unlock(); }
+ void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; }
+ void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; }
+ void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; }
+
+
+private:
+ /* Event redirection */
+ void _MouseMotionEvent(BPoint &where, int32 transit) {
+ if(transit == B_EXITED_VIEW) {
+ /* Change mouse focus */
+ if(_mouse_focused) {
+ _MouseFocusEvent(false);
+ }
+ } else {
+ /* Change mouse focus */
+ if (!_mouse_focused) {
+ _MouseFocusEvent(true);
+ }
+ BMessage msg(BAPP_MOUSE_MOVED);
+ msg.AddInt32("x", (int)where.x);
+ msg.AddInt32("y", (int)where.y);
+
+ _PostWindowEvent(msg);
+ }
+ }
+
+ void _MouseFocusEvent(bool focusGained) {
+ _mouse_focused = focusGained;
+ BMessage msg(BAPP_MOUSE_FOCUS);
+ msg.AddBool("focusGained", focusGained);
+ _PostWindowEvent(msg);
+
+/* FIXME: Why were these here?
+ if false: be_app->SetCursor(B_HAND_CURSOR);
+ if true: SDL_SetCursor(NULL); */
+ }
+
+ void _MouseButtonEvent(int32 buttons) {
+ int32 buttonStateChange = buttons ^ _last_buttons;
+
+ /* Make sure at least one button has changed state */
+ if( !(buttonStateChange) ) {
+ return;
+ }
+
+ /* Add any mouse button events */
+ if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
+ _SendMouseButton(SDL_BUTTON_LEFT, buttons &
+ B_PRIMARY_MOUSE_BUTTON);
+ }
+ if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
+ _SendMouseButton(SDL_BUTTON_RIGHT, buttons &
+ B_PRIMARY_MOUSE_BUTTON);
+ }
+ if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
+ _SendMouseButton(SDL_BUTTON_MIDDLE, buttons &
+ B_PRIMARY_MOUSE_BUTTON);
+ }
+
+ _last_buttons = buttons;
+ }
+
+ void _SendMouseButton(int32 button, int32 state) {
+ BMessage msg(BAPP_MOUSE_BUTTON);
+ msg.AddInt32("button-id", button);
+ msg.AddInt32("button-state", state);
+ _PostWindowEvent(msg);
+ }
+
+ void _MouseWheelEvent(int32 x, int32 y) {
+ /* Create a message to pass along to the BeApp thread */
+ BMessage msg(BAPP_MOUSE_WHEEL);
+ msg.AddInt32("xticks", x);
+ msg.AddInt32("yticks", y);
+ _PostWindowEvent(msg);
+ }
+
+ void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t & len, int32 keyState) {
+ /* Create a message to pass along to the BeApp thread */
+ BMessage msg(BAPP_KEY);
+ msg.AddInt32("key-state", keyState);
+ msg.AddInt32("key-scancode", keyCode);
+ if (keyUtf8 != NULL) {
+ msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len);
+ }
+ be_app->PostMessage(&msg);
+ }
+
+ void _RepaintEvent() {
+ /* Force a repaint: Call the SDL exposed event */
+ BMessage msg(BAPP_REPAINT);
+ _PostWindowEvent(msg);
+ }
+ void _PostWindowEvent(BMessage &msg) {
+ msg.AddInt32("window-id", _id);
+ be_app->PostMessage(&msg);
+ }
+
+ /* Command methods (functions called upon by SDL) */
+ void _SetTitle(BMessage *msg) {
+ const char *title;
+ if(
+ msg->FindString("window-title", &title) != B_OK
+ ) {
+ return;
+ }
+ SetTitle(title);
+ }
+
+ void _MoveTo(BMessage *msg) {
+ int32 x, y;
+ if(
+ msg->FindInt32("window-x", &x) != B_OK ||
+ msg->FindInt32("window-y", &y) != B_OK
+ ) {
+ return;
+ }
+ MoveTo(x, y);
+ }
+
+ void _ResizeTo(BMessage *msg) {
+ int32 w, h;
+ if(
+ msg->FindInt32("window-w", &w) != B_OK ||
+ msg->FindInt32("window-h", &h) != B_OK
+ ) {
+ return;
+ }
+ ResizeTo(w, h);
+ }
+
+ void _SetBordered(BMessage *msg) {
+ bool bEnabled;
+ if(msg->FindBool("window-border", &bEnabled) != B_OK) {
+ return;
+ }
+ SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
+ }
+
+ void _SetResizable(BMessage *msg) {
+ bool bEnabled;
+ if(msg->FindBool("window-resizable", &bEnabled) != B_OK) {
+ return;
+ }
+ if (bEnabled) {
+ SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
+ } else {
+ SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
+ }
+ }
+
+ void _Restore() {
+ if(IsMinimized()) {
+ Minimize(false);
+ } else if(IsHidden()) {
+ Show();
+ } else if(_prev_frame != NULL) { /* Zoomed */
+ MoveTo(_prev_frame->left, _prev_frame->top);
+ ResizeTo(_prev_frame->Width(), _prev_frame->Height());
+ }
+ }
+
+ void _SetFullScreen(BMessage *msg) {
+ bool fullscreen;
+ if(
+ msg->FindBool("fullscreen", &fullscreen) != B_OK
+ ) {
+ return;
+ }
+ SetFullScreen(fullscreen);
+ }
+
+ /* Members */
+#if SDL_VIDEO_OPENGL
+ BGLView * _SDL_GLView;
+ Uint32 _gl_type;
+#endif
+
+ int32 _last_buttons;
+ int32 _id; /* Window id used by SDL_BApp */
+ bool _mouse_focused; /* Does this window have mouse focus? */
+ bool _shown;
+ bool _inhibit_resize;
+
+ BRect *_prev_frame; /* Previous position and size of the window */
+
+ /* Framebuffer members */
+ bool _connected,
+ _connection_disabled,
+ _buffer_created,
+ _buffer_dirty,
+ _trash_window_buffer;
+ uint8 *_bits;
+ uint32 _row_bytes;
+ clipping_rect _bounds;
+ BLocker *_buffer_locker;
+ clipping_rect *_clips;
+ int32 _num_clips;
+ int32 _bytes_per_px;
+ thread_id _draw_thread_id;
+
+ BBitmap *_bitmap;
+};
+
+
+/* FIXME:
+ * An explanation of framebuffer flags.
+ *
+ * _connected - Original variable used to let the drawing thread know
+ * when changes are being made to the other framebuffer
+ * members.
+ * _connection_disabled - Used to signal to the drawing thread that the window
+ * is closing, and the thread should exit.
+ * _buffer_created - True if the current buffer is valid
+ * _buffer_dirty - True if the window should be redrawn.
+ * _trash_window_buffer - True if the window buffer needs to be trashed partway
+ * through a draw cycle. Occurs when the previous
+ * buffer provided by DirectConnected() is invalidated.
+ */
+#endif /* SDL_BWin_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.cc
new file mode 100644
index 0000000..e7d01b9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.cc
@@ -0,0 +1,95 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+
+/* BWindow based clipboard implementation */
+
+#include <unistd.h>
+#include <TypeConstants.h>
+
+#include "SDL_BWin.h"
+#include "SDL_timer.h"
+#include "../SDL_sysvideo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int BE_SetClipboardText(_THIS, const char *text) {
+ BMessage *clip = NULL;
+ if(be_clipboard->Lock()) {
+ be_clipboard->Clear();
+ if((clip = be_clipboard->Data())) {
+ /* Presumably the string of characters is ascii-format */
+ ssize_t asciiLength = 0;
+ for(; text[asciiLength] != 0; ++asciiLength) {}
+ clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
+ be_clipboard->Commit();
+ }
+ be_clipboard->Unlock();
+ }
+ return 0;
+}
+
+char *BE_GetClipboardText(_THIS) {
+ BMessage *clip = NULL;
+ const char *text = NULL;
+ ssize_t length;
+ char *result;
+ if(be_clipboard->Lock()) {
+ if((clip = be_clipboard->Data())) {
+ /* Presumably the string of characters is ascii-format */
+ clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
+ &length);
+ }
+ be_clipboard->Unlock();
+ }
+
+ if (!text) {
+ result = SDL_strdup("");
+ } else {
+ /* Copy the data and pass on to SDL */
+ result = (char *)SDL_malloc((length + 1) * sizeof(char));
+ SDL_strlcpy(result, text, length + 1);
+ }
+
+ return result;
+}
+
+SDL_bool BE_HasClipboardText(_THIS) {
+ SDL_bool result = SDL_FALSE;
+ char *text = BE_GetClipboardText(_this);
+ if (text) {
+ result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
+ SDL_free(text);
+ }
+ return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.h
new file mode 100644
index 0000000..2f7a1c2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bclipboard.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_BCLIPBOARD_H
+#define SDL_BCLIPBOARD_H
+
+extern int BE_SetClipboardText(_THIS, const char *text);
+extern char *BE_GetClipboardText(_THIS);
+extern SDL_bool BE_HasClipboardText(_THIS);
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bevents.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bevents.cc
new file mode 100644
index 0000000..c716731
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bevents.cc
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+
+#include "SDL_bevents.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void BE_PumpEvents(_THIS) {
+ /* Since the event thread is its own thread, this isn't really necessary */
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bevents.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bevents.h
new file mode 100644
index 0000000..3c090c8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bevents.h
@@ -0,0 +1,39 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BEVENTS_H
+#define SDL_BEVENTS_H
+
+#include "../SDL_sysvideo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void BE_PumpEvents(_THIS);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.cc
new file mode 100644
index 0000000..f53c500
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.cc
@@ -0,0 +1,259 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+
+#include "SDL_bframebuffer.h"
+
+#include <AppKit.h>
+#include <InterfaceKit.h>
+#include "SDL_bmodes.h"
+#include "SDL_BWin.h"
+
+#include "../../main/haiku/SDL_BApp.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef DRAWTHREAD
+static int32 BE_UpdateOnce(SDL_Window *window);
+#endif
+
+static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
+ return ((SDL_BWin*)(window->driverdata));
+}
+
+static SDL_INLINE SDL_BApp *_GetBeApp() {
+ return ((SDL_BApp*)be_app);
+}
+
+int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
+ Uint32 * format,
+ void ** pixels, int *pitch) {
+ SDL_BWin *bwin = _ToBeWin(window);
+ BScreen bscreen;
+ if(!bscreen.IsValid()) {
+ return -1;
+ }
+
+ while(!bwin->Connected()) { snooze(100); }
+
+ /* Make sure we have exclusive access to frame buffer data */
+ bwin->LockBuffer();
+
+ /* format */
+ display_mode bmode;
+ bscreen.GetMode(&bmode);
+ int32 bpp = BE_ColorSpaceToBitsPerPixel(bmode.space);
+ *format = BE_BPPToSDLPxFormat(bpp);
+
+ /* Create the new bitmap object */
+ BBitmap *bitmap = bwin->GetBitmap();
+
+ if(bitmap) {
+ delete bitmap;
+ }
+ bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
+ false, /* Views not accepted */
+ true); /* Contiguous memory required */
+
+ if(bitmap->InitCheck() != B_OK) {
+ delete bitmap;
+ return SDL_SetError("Could not initialize back buffer!");
+ }
+
+
+ bwin->SetBitmap(bitmap);
+
+ /* Set the pixel pointer */
+ *pixels = bitmap->Bits();
+
+ /* pitch = width of window, in bytes */
+ *pitch = bitmap->BytesPerRow();
+
+ bwin->SetBufferExists(true);
+ bwin->SetTrashBuffer(false);
+ bwin->UnlockBuffer();
+ return 0;
+}
+
+
+
+int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
+ const SDL_Rect * rects, int numrects) {
+ if(!window)
+ return 0;
+
+ SDL_BWin *bwin = _ToBeWin(window);
+
+#ifdef DRAWTHREAD
+ bwin->LockBuffer();
+ bwin->SetBufferDirty(true);
+ bwin->UnlockBuffer();
+#else
+ bwin->SetBufferDirty(true);
+ BE_UpdateOnce(window);
+#endif
+
+ return 0;
+}
+
+int32 BE_DrawThread(void *data) {
+ SDL_BWin *bwin = (SDL_BWin*)data;
+
+ BScreen bscreen;
+ if(!bscreen.IsValid()) {
+ return -1;
+ }
+
+ while(bwin->ConnectionEnabled()) {
+ if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
+ bwin->LockBuffer();
+ BBitmap *bitmap = NULL;
+ bitmap = bwin->GetBitmap();
+ int32 windowPitch = bitmap->BytesPerRow();
+ int32 bufferPitch = bwin->GetRowBytes();
+ uint8 *windowpx;
+ uint8 *bufferpx;
+
+ int32 BPP = bwin->GetBytesPerPx();
+ int32 windowSub = bwin->GetFbX() * BPP +
+ bwin->GetFbY() * windowPitch;
+ clipping_rect *clips = bwin->GetClips();
+ int32 numClips = bwin->GetNumClips();
+ int i, y;
+
+ /* Blit each clipping rectangle */
+ bscreen.WaitForRetrace();
+ for(i = 0; i < numClips; ++i) {
+ /* Get addresses of the start of each clipping rectangle */
+ int32 width = clips[i].right - clips[i].left + 1;
+ int32 height = clips[i].bottom - clips[i].top + 1;
+ bufferpx = bwin->GetBufferPx() +
+ clips[i].top * bufferPitch + clips[i].left * BPP;
+ windowpx = (uint8*)bitmap->Bits() +
+ clips[i].top * windowPitch + clips[i].left * BPP -
+ windowSub;
+
+ /* Copy each row of pixels from the window buffer into the frame
+ buffer */
+ for(y = 0; y < height; ++y)
+ {
+
+ if(bwin->CanTrashWindowBuffer()) {
+ goto escape; /* Break out before the buffer is killed */
+ }
+
+ memcpy(bufferpx, windowpx, width * BPP);
+ bufferpx += bufferPitch;
+ windowpx += windowPitch;
+ }
+ }
+
+ bwin->SetBufferDirty(false);
+escape:
+ bwin->UnlockBuffer();
+ } else {
+ snooze(16000);
+ }
+ }
+
+ return B_OK;
+}
+
+void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
+ SDL_BWin *bwin = _ToBeWin(window);
+
+ bwin->LockBuffer();
+
+ /* Free and clear the window buffer */
+ BBitmap *bitmap = bwin->GetBitmap();
+ delete bitmap;
+ bwin->SetBitmap(NULL);
+ bwin->SetBufferExists(false);
+ bwin->UnlockBuffer();
+}
+
+
+/*
+ * TODO:
+ * This was written to test if certain errors were caused by threading issues.
+ * The specific issues have since become rare enough that they may have been
+ * solved, but I doubt it- they were pretty sporadic before now.
+ */
+#ifndef DRAWTHREAD
+static int32 BE_UpdateOnce(SDL_Window *window) {
+ SDL_BWin *bwin = _ToBeWin(window);
+ BScreen bscreen;
+ if(!bscreen.IsValid()) {
+ return -1;
+ }
+
+ if(bwin->ConnectionEnabled() && bwin->Connected()) {
+ bwin->LockBuffer();
+ int32 windowPitch = window->surface->pitch;
+ int32 bufferPitch = bwin->GetRowBytes();
+ uint8 *windowpx;
+ uint8 *bufferpx;
+
+ int32 BPP = bwin->GetBytesPerPx();
+ uint8 *windowBaseAddress = (uint8*)window->surface->pixels;
+ int32 windowSub = bwin->GetFbX() * BPP +
+ bwin->GetFbY() * windowPitch;
+ clipping_rect *clips = bwin->GetClips();
+ int32 numClips = bwin->GetNumClips();
+ int i, y;
+
+ /* Blit each clipping rectangle */
+ bscreen.WaitForRetrace();
+ for(i = 0; i < numClips; ++i) {
+ /* Get addresses of the start of each clipping rectangle */
+ int32 width = clips[i].right - clips[i].left + 1;
+ int32 height = clips[i].bottom - clips[i].top + 1;
+ bufferpx = bwin->GetBufferPx() +
+ clips[i].top * bufferPitch + clips[i].left * BPP;
+ windowpx = windowBaseAddress +
+ clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
+
+ /* Copy each row of pixels from the window buffer into the frame
+ buffer */
+ for(y = 0; y < height; ++y)
+ {
+ memcpy(bufferpx, windowpx, width * BPP);
+ bufferpx += bufferPitch;
+ windowpx += windowPitch;
+ }
+ }
+ bwin->UnlockBuffer();
+ }
+ return 0;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.h
new file mode 100644
index 0000000..ce0fc62
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bframebuffer.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BFRAMEBUFFER_H
+#define SDL_BFRAMEBUFFER_H
+#include <SupportDefs.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DRAWTHREAD
+
+#include "../SDL_sysvideo.h"
+
+extern int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
+ Uint32 * format,
+ void ** pixels, int *pitch);
+extern int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
+ const SDL_Rect * rects, int numrects);
+extern void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
+extern int32 BE_DrawThread(void *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.cc
new file mode 100644
index 0000000..5c72ecf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.cc
@@ -0,0 +1,190 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+
+#include <SupportDefs.h>
+#include <support/UTF8.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "SDL_events.h"
+#include "SDL_keycode.h"
+
+#include "SDL_bkeyboard.h"
+
+
+#define KEYMAP_SIZE 128
+
+
+static SDL_Scancode keymap[KEYMAP_SIZE];
+static int8 keystate[KEYMAP_SIZE];
+
+void BE_InitOSKeymap(void) {
+ for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
+ keymap[i] = SDL_SCANCODE_UNKNOWN;
+ }
+
+ for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
+ keystate[i] = SDL_RELEASED;
+ }
+
+ keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE);
+ keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1);
+ keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2);
+ keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3);
+ keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4);
+ keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5);
+ keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6);
+ keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7);
+ keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8);
+ keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9);
+ keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10);
+ keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11);
+ keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12);
+ keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN);
+ keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK);
+ keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE);
+ keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE);
+ keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1);
+ keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2);
+ keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3);
+ keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4);
+ keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5);
+ keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6);
+ keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7);
+ keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8);
+ keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9);
+ keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0);
+ keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS);
+ keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS);
+ keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
+ keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT);
+ keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME);
+ keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP);
+ keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR);
+ keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE);
+ keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY);
+ keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS);
+ keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB);
+ keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q);
+ keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w);
+ keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e);
+ keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r);
+ keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t);
+ keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y);
+ keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u);
+ keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i);
+ keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o);
+ keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p);
+ keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET);
+ keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET);
+ keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH);
+ keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE);
+ keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END);
+ keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
+ keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7);
+ keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8);
+ keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9);
+ keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS);
+ keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK);
+ keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a);
+ keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s);
+ keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d);
+ keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f);
+ keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g);
+ keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h);
+ keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j);
+ keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k);
+ keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l);
+ keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON);
+ keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE);
+ keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN);
+ keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4);
+ keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5);
+ keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6);
+ keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT);
+ keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z);
+ keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x);
+ keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c);
+ keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v);
+ keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b);
+ keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n);
+ keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m);
+ keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA);
+ keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD);
+ keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH);
+ keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT);
+ keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP);
+ keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1);
+ keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2);
+ keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3);
+ keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER);
+ keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL);
+ keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT);
+ keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE);
+ keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT);
+ keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL);
+ keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT);
+ keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN);
+ keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT);
+ keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0);
+ keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD);
+ keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI);
+ keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI);
+ keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU);
+ keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
+ keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
+ keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER);
+}
+
+SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey) {
+ if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
+ return keymap[bkey];
+ } else {
+ return SDL_SCANCODE_UNKNOWN;
+ }
+}
+
+int8 BE_GetKeyState(int32 bkey) {
+ if(bkey > 0 && bkey < KEYMAP_SIZE) {
+ return keystate[bkey];
+ } else {
+ return SDL_RELEASED;
+ }
+}
+
+void BE_SetKeyState(int32 bkey, int8 state) {
+ if(bkey > 0 && bkey < KEYMAP_SIZE) {
+ keystate[bkey] = state;
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.h
new file mode 100644
index 0000000..9620c9b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bkeyboard.h
@@ -0,0 +1,44 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BKEYBOARD_H
+#define SDL_BKEYBOARD_H
+
+#include <SupportDefs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../../include/SDL_keyboard.h"
+
+extern void BE_InitOSKeymap(void);
+extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey);
+extern int8 BE_GetKeyState(int32 bkey);
+extern void BE_SetKeyState(int32 bkey, int8 state);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.cc
new file mode 100644
index 0000000..1105342
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.cc
@@ -0,0 +1,333 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+
+#include <AppKit.h>
+#include <InterfaceKit.h>
+#include "SDL_bmodes.h"
+#include "SDL_BWin.h"
+
+#if SDL_VIDEO_OPENGL
+#include "SDL_bopengl.h"
+#endif
+
+#include "../../main/haiku/SDL_BApp.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define WRAP_BMODE 1 /* FIXME: Some debate as to whether this is necessary */
+
+#if WRAP_BMODE
+/* This wrapper is here so that the driverdata can be freed without freeing
+ the display_mode structure */
+struct SDL_DisplayModeData {
+ display_mode *bmode;
+};
+#endif
+
+static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
+ return ((SDL_BWin*)(window->driverdata));
+}
+
+static SDL_INLINE SDL_BApp *_GetBeApp() {
+ return ((SDL_BApp*)be_app);
+}
+
+static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
+#if WRAP_BMODE
+ return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
+#else
+ return (display_mode*)(mode->driverdata);
+#endif
+}
+
+/* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */
+static float get_refresh_rate(display_mode &mode) {
+ return float(mode.timing.pixel_clock * 1000)
+ / float(mode.timing.h_total * mode.timing.v_total);
+}
+
+
+#if 0
+/* TODO:
+ * This is a useful debugging tool. Uncomment and insert into code as needed.
+ */
+void _SpoutModeData(display_mode *bmode) {
+ printf("BMode:\n");
+ printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
+ printf("\th,v = (%i,%i)\n", bmode->h_display_start,
+ bmode->v_display_start);
+ if(bmode->flags) {
+ printf("\tFlags:\n");
+ if(bmode->flags & B_SCROLL) {
+ printf("\t\tB_SCROLL\n");
+ }
+ if(bmode->flags & B_8_BIT_DAC) {
+ printf("\t\tB_8_BIT_DAC\n");
+ }
+ if(bmode->flags & B_HARDWARE_CURSOR) {
+ printf("\t\tB_HARDWARE_CURSOR\n");
+ }
+ if(bmode->flags & B_PARALLEL_ACCESS) {
+ printf("\t\tB_PARALLEL_ACCESS\n");
+ }
+ if(bmode->flags & B_DPMS) {
+ printf("\t\tB_DPMS\n");
+ }
+ if(bmode->flags & B_IO_FB_NA) {
+ printf("\t\tB_IO_FB_NA\n");
+ }
+ }
+ printf("\tTiming:\n");
+ printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
+ printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
+ bmode->timing.h_display, bmode->timing.h_sync_start,
+ bmode->timing.h_sync_end, bmode->timing.h_total);
+ printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
+ bmode->timing.v_display, bmode->timing.v_sync_start,
+ bmode->timing.v_sync_end, bmode->timing.v_total);
+ if(bmode->timing.flags) {
+ printf("\t\tFlags:\n");
+ if(bmode->timing.flags & B_BLANK_PEDESTAL) {
+ printf("\t\t\tB_BLANK_PEDESTAL\n");
+ }
+ if(bmode->timing.flags & B_TIMING_INTERLACED) {
+ printf("\t\t\tB_TIMING_INTERLACED\n");
+ }
+ if(bmode->timing.flags & B_POSITIVE_HSYNC) {
+ printf("\t\t\tB_POSITIVE_HSYNC\n");
+ }
+ if(bmode->timing.flags & B_POSITIVE_VSYNC) {
+ printf("\t\t\tB_POSITIVE_VSYNC\n");
+ }
+ if(bmode->timing.flags & B_SYNC_ON_GREEN) {
+ printf("\t\t\tB_SYNC_ON_GREEN\n");
+ }
+ }
+}
+#endif
+
+
+
+int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace)
+{
+ int bitsperpixel;
+
+ bitsperpixel = 0;
+ switch (colorspace) {
+ case B_CMAP8:
+ bitsperpixel = 8;
+ break;
+ case B_RGB15:
+ case B_RGBA15:
+ case B_RGB15_BIG:
+ case B_RGBA15_BIG:
+ bitsperpixel = 15;
+ break;
+ case B_RGB16:
+ case B_RGB16_BIG:
+ bitsperpixel = 16;
+ break;
+ case B_RGB32:
+ case B_RGBA32:
+ case B_RGB32_BIG:
+ case B_RGBA32_BIG:
+ bitsperpixel = 32;
+ break;
+ default:
+ break;
+ }
+ return(bitsperpixel);
+}
+
+int32 BE_BPPToSDLPxFormat(int32 bpp) {
+ /* Translation taken from SDL_windowsmodes.c */
+ switch (bpp) {
+ case 32:
+ return SDL_PIXELFORMAT_RGB888;
+ break;
+ case 24: /* May not be supported by Haiku */
+ return SDL_PIXELFORMAT_RGB24;
+ break;
+ case 16:
+ return SDL_PIXELFORMAT_RGB565;
+ break;
+ case 15:
+ return SDL_PIXELFORMAT_RGB555;
+ break;
+ case 8:
+ return SDL_PIXELFORMAT_INDEX8;
+ break;
+ case 4: /* May not be supported by Haiku */
+ return SDL_PIXELFORMAT_INDEX4LSB;
+ break;
+ }
+
+ /* May never get here, but safer and needed to shut up compiler */
+ SDL_SetError("Invalid bpp value");
+ return 0;
+}
+
+static void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
+ SDL_DisplayMode *mode) {
+ mode->w = bmode->virtual_width;
+ mode->h = bmode->virtual_height;
+ mode->refresh_rate = (int)get_refresh_rate(*bmode);
+
+#if WRAP_BMODE
+ SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
+ sizeof(SDL_DisplayModeData));
+ data->bmode = bmode;
+
+ mode->driverdata = data;
+
+#else
+
+ mode->driverdata = bmode;
+#endif
+
+ /* Set the format */
+ int32 bpp = BE_ColorSpaceToBitsPerPixel(bmode->space);
+ mode->format = BE_BPPToSDLPxFormat(bpp);
+}
+
+/* Later, there may be more than one monitor available */
+static void _AddDisplay(BScreen *screen) {
+ SDL_VideoDisplay display;
+ SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
+ sizeof(SDL_DisplayMode));
+ display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
+ screen->GetMode(bmode);
+
+ _BDisplayModeToSdlDisplayMode(bmode, mode);
+
+ SDL_zero(display);
+ display.desktop_mode = *mode;
+ display.current_mode = *mode;
+
+ SDL_AddVideoDisplay(&display);
+}
+
+/*
+ * Functions called by SDL
+ */
+
+int BE_InitModes(_THIS) {
+ BScreen screen;
+
+ /* TODO: When Haiku supports multiple display screens, call
+ _AddDisplayScreen() for each of them. */
+ _AddDisplay(&screen);
+ return 0;
+}
+
+int BE_QuitModes(_THIS) {
+ /* FIXME: Nothing really needs to be done here at the moment? */
+ return 0;
+}
+
+
+int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
+ BScreen bscreen;
+ BRect rc = bscreen.Frame();
+ rect->x = (int)rc.left;
+ rect->y = (int)rc.top;
+ rect->w = (int)rc.Width() + 1;
+ rect->h = (int)rc.Height() + 1;
+ return 0;
+}
+
+void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
+ /* Get the current screen */
+ BScreen bscreen;
+
+ /* Iterate through all of the modes */
+ SDL_DisplayMode mode;
+ display_mode this_bmode;
+ display_mode *bmodes;
+ uint32 count, i;
+
+ /* Get graphics-hardware supported modes */
+ bscreen.GetModeList(&bmodes, &count);
+ bscreen.GetMode(&this_bmode);
+
+ for(i = 0; i < count; ++i) {
+ // FIXME: Apparently there are errors with colorspace changes
+ if (bmodes[i].space == this_bmode.space) {
+ _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
+ SDL_AddDisplayMode(display, &mode);
+ }
+ }
+ free(bmodes);
+}
+
+
+int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
+ /* Get the current screen */
+ BScreen bscreen;
+ if(!bscreen.IsValid()) {
+ printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
+ }
+
+ /* Set the mode using the driver data */
+ display_mode *bmode = _ExtractBMode(mode);
+
+
+ /* FIXME: Is the first option always going to be the right one? */
+ uint32 c = 0, i;
+ display_mode *bmode_list;
+ bscreen.GetModeList(&bmode_list, &c);
+ for(i = 0; i < c; ++i) {
+ if( bmode_list[i].space == bmode->space &&
+ bmode_list[i].virtual_width == bmode->virtual_width &&
+ bmode_list[i].virtual_height == bmode->virtual_height ) {
+ bmode = &bmode_list[i];
+ break;
+ }
+ }
+
+ if(bscreen.SetMode(bmode) != B_OK) {
+ return SDL_SetError("Bad video mode");
+ }
+
+ free(bmode_list);
+
+#if SDL_VIDEO_OPENGL
+ /* FIXME: Is there some way to reboot the OpenGL context? This doesn't
+ help */
+// BE_GL_RebootContexts(_this);
+#endif
+
+ return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.h
new file mode 100644
index 0000000..38f4b58
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bmodes.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BMODES_H
+#define SDL_BMODES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../SDL_sysvideo.h"
+
+extern int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace);
+extern int32 BE_BPPToSDLPxFormat(int32 bpp);
+
+extern int BE_InitModes(_THIS);
+extern int BE_QuitModes(_THIS);
+extern int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display,
+ SDL_Rect *rect);
+extern void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
+ SDL_DisplayMode *mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.cc
new file mode 100644
index 0000000..3456932
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.cc
@@ -0,0 +1,176 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL
+
+#include "SDL_bopengl.h"
+
+#include <unistd.h>
+#include <KernelKit.h>
+#include <OpenGLKit.h>
+#include "SDL_BWin.h"
+#include "../../main/haiku/SDL_BApp.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
+ return ((SDL_BWin*)(window->driverdata));
+}
+
+static SDL_INLINE SDL_BApp *_GetBeApp() {
+ return ((SDL_BApp*)be_app);
+}
+
+/* Passing a NULL path means load pointers from the application */
+int BE_GL_LoadLibrary(_THIS, const char *path)
+{
+/* FIXME: Is this working correctly? */
+ image_info info;
+ int32 cookie = 0;
+ while (get_next_image_info(0, &cookie, &info) == B_OK) {
+ void *location = NULL;
+ if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
+ &location) == B_OK) {
+
+ _this->gl_config.dll_handle = (void *) (size_t) info.id;
+ _this->gl_config.driver_loaded = 1;
+ SDL_strlcpy(_this->gl_config.driver_path, "libGL.so",
+ SDL_arraysize(_this->gl_config.driver_path));
+ }
+ }
+ return 0;
+}
+
+void *BE_GL_GetProcAddress(_THIS, const char *proc)
+{
+ if (_this->gl_config.dll_handle != NULL) {
+ void *location = NULL;
+ status_t err;
+ if ((err =
+ get_image_symbol((image_id) (size_t) _this->gl_config.dll_handle,
+ proc, B_SYMBOL_TYPE_ANY,
+ &location)) == B_OK) {
+ return location;
+ } else {
+ SDL_SetError("Couldn't find OpenGL symbol");
+ return NULL;
+ }
+ } else {
+ SDL_SetError("OpenGL library not loaded");
+ return NULL;
+ }
+}
+
+
+
+
+int BE_GL_SwapWindow(_THIS, SDL_Window * window) {
+ _ToBeWin(window)->SwapBuffers();
+ return 0;
+}
+
+int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
+ SDL_BWin* win = (SDL_BWin*)context;
+ _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL);
+ return 0;
+}
+
+
+SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
+ /* FIXME: Not sure what flags should be included here; may want to have
+ most of them */
+ SDL_BWin *bwin = _ToBeWin(window);
+ Uint32 gl_flags = BGL_RGB;
+ if (_this->gl_config.alpha_size) {
+ gl_flags |= BGL_ALPHA;
+ }
+ if (_this->gl_config.depth_size) {
+ gl_flags |= BGL_DEPTH;
+ }
+ if (_this->gl_config.stencil_size) {
+ gl_flags |= BGL_STENCIL;
+ }
+ if (_this->gl_config.double_buffer) {
+ gl_flags |= BGL_DOUBLE;
+ } else {
+ gl_flags |= BGL_SINGLE;
+ }
+ if (_this->gl_config.accum_red_size ||
+ _this->gl_config.accum_green_size ||
+ _this->gl_config.accum_blue_size ||
+ _this->gl_config.accum_alpha_size) {
+ gl_flags |= BGL_ACCUM;
+ }
+ bwin->CreateGLView(gl_flags);
+ return (SDL_GLContext)(bwin);
+}
+
+void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
+ /* Currently, automatically unlocks the view */
+ ((SDL_BWin*)context)->RemoveGLView();
+}
+
+
+int BE_GL_SetSwapInterval(_THIS, int interval) {
+ /* TODO: Implement this, if necessary? */
+ return SDL_Unsupported();
+}
+
+int BE_GL_GetSwapInterval(_THIS) {
+ /* TODO: Implement this, if necessary? */
+ return 0;
+}
+
+
+void BE_GL_UnloadLibrary(_THIS) {
+ /* TODO: Implement this, if necessary? */
+}
+
+
+/* FIXME: This function is meant to clear the OpenGL context when the video
+ mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
+ currently in use. */
+void BE_GL_RebootContexts(_THIS) {
+ SDL_Window *window = _this->windows;
+ while(window) {
+ SDL_BWin *bwin = _ToBeWin(window);
+ if(bwin->GetGLView()) {
+ bwin->LockLooper();
+ bwin->RemoveGLView();
+ bwin->CreateGLView(bwin->GetGLType());
+ bwin->UnlockLooper();
+ }
+ window = window->next;
+ }
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.h
new file mode 100644
index 0000000..bc0798c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bopengl.h
@@ -0,0 +1,55 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BOPENGL_H
+#define SDL_BOPENGL_H
+
+#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../SDL_sysvideo.h"
+
+
+extern int BE_GL_LoadLibrary(_THIS, const char *path); /* FIXME */
+extern void *BE_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */
+extern void BE_GL_UnloadLibrary(_THIS); /* TODO */
+extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window,
+ SDL_GLContext context);
+extern int BE_GL_SetSwapInterval(_THIS, int interval); /* TODO */
+extern int BE_GL_GetSwapInterval(_THIS); /* TODO */
+extern int BE_GL_SwapWindow(_THIS, SDL_Window * window);
+extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window);
+extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context);
+
+extern void BE_GL_RebootContexts(_THIS);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.cc
new file mode 100644
index 0000000..afe20e3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.cc
@@ -0,0 +1,178 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "SDL_bkeyboard.h"
+#include "SDL_bwindow.h"
+#include "SDL_bclipboard.h"
+#include "SDL_bvideo.h"
+#include "SDL_bopengl.h"
+#include "SDL_bmodes.h"
+#include "SDL_bframebuffer.h"
+#include "SDL_bevents.h"
+
+/* FIXME: Undefined functions */
+// #define BE_PumpEvents NULL
+ #define BE_StartTextInput NULL
+ #define BE_StopTextInput NULL
+ #define BE_SetTextInputRect NULL
+
+// #define BE_DeleteDevice NULL
+
+/* End undefined functions */
+
+static SDL_VideoDevice *
+BE_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+ /*SDL_VideoData *data;*/
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+
+ device->driverdata = NULL; /* FIXME: Is this the cause of some of the
+ SDL_Quit() errors? */
+
+/* TODO: Figure out if any initialization needs to go here */
+
+ /* Set the function pointers */
+ device->VideoInit = BE_VideoInit;
+ device->VideoQuit = BE_VideoQuit;
+ device->GetDisplayBounds = BE_GetDisplayBounds;
+ device->GetDisplayModes = BE_GetDisplayModes;
+ device->SetDisplayMode = BE_SetDisplayMode;
+ device->PumpEvents = BE_PumpEvents;
+
+ device->CreateSDLWindow = BE_CreateWindow;
+ device->CreateSDLWindowFrom = BE_CreateWindowFrom;
+ device->SetWindowTitle = BE_SetWindowTitle;
+ device->SetWindowIcon = BE_SetWindowIcon;
+ device->SetWindowPosition = BE_SetWindowPosition;
+ device->SetWindowSize = BE_SetWindowSize;
+ device->ShowWindow = BE_ShowWindow;
+ device->HideWindow = BE_HideWindow;
+ device->RaiseWindow = BE_RaiseWindow;
+ device->MaximizeWindow = BE_MaximizeWindow;
+ device->MinimizeWindow = BE_MinimizeWindow;
+ device->RestoreWindow = BE_RestoreWindow;
+ device->SetWindowBordered = BE_SetWindowBordered;
+ device->SetWindowResizable = BE_SetWindowResizable;
+ device->SetWindowFullscreen = BE_SetWindowFullscreen;
+ device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
+ device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
+ device->SetWindowGrab = BE_SetWindowGrab;
+ device->DestroyWindow = BE_DestroyWindow;
+ device->GetWindowWMInfo = BE_GetWindowWMInfo;
+ device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer;
+ device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer;
+ device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer;
+
+ device->shape_driver.CreateShaper = NULL;
+ device->shape_driver.SetWindowShape = NULL;
+ device->shape_driver.ResizeWindowShape = NULL;
+
+#if SDL_VIDEO_OPENGL
+ device->GL_LoadLibrary = BE_GL_LoadLibrary;
+ device->GL_GetProcAddress = BE_GL_GetProcAddress;
+ device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
+ device->GL_CreateContext = BE_GL_CreateContext;
+ device->GL_MakeCurrent = BE_GL_MakeCurrent;
+ device->GL_SetSwapInterval = BE_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
+ device->GL_SwapWindow = BE_GL_SwapWindow;
+ device->GL_DeleteContext = BE_GL_DeleteContext;
+#endif
+
+ device->StartTextInput = BE_StartTextInput;
+ device->StopTextInput = BE_StopTextInput;
+ device->SetTextInputRect = BE_SetTextInputRect;
+
+ device->SetClipboardText = BE_SetClipboardText;
+ device->GetClipboardText = BE_GetClipboardText;
+ device->HasClipboardText = BE_HasClipboardText;
+
+ device->free = BE_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap HAIKU_bootstrap = {
+ "haiku", "Haiku graphics",
+ BE_Available, BE_CreateDevice
+};
+
+void BE_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_free(device->driverdata);
+ SDL_free(device);
+}
+
+int BE_VideoInit(_THIS)
+{
+ /* Initialize the Be Application for appserver interaction */
+ if (SDL_InitBeApp() < 0) {
+ return -1;
+ }
+
+ /* Initialize video modes */
+ BE_InitModes(_this);
+
+ /* Init the keymap */
+ BE_InitOSKeymap();
+
+
+#if SDL_VIDEO_OPENGL
+ /* testgl application doesn't load library, just tries to load symbols */
+ /* is it correct? if so we have to load library here */
+ BE_GL_LoadLibrary(_this, NULL);
+#endif
+
+ /* We're done! */
+ return (0);
+}
+
+int BE_Available(void)
+{
+ return (1);
+}
+
+void BE_VideoQuit(_THIS)
+{
+
+ BE_QuitModes(_this);
+
+ SDL_QuitBeApp();
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.h
new file mode 100644
index 0000000..0e28220
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bvideo.h
@@ -0,0 +1,44 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef BVIDEO_H
+#define BVIDEO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../main/haiku/SDL_BeApp.h"
+#include "../SDL_sysvideo.h"
+
+
+extern void BE_VideoQuit(_THIS);
+extern int BE_VideoInit(_THIS);
+extern void BE_DeleteDevice(_THIS);
+extern int BE_Available(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.cc b/src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.cc
new file mode 100644
index 0000000..0931abe
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.cc
@@ -0,0 +1,233 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_HAIKU
+#include "../SDL_sysvideo.h"
+
+#include "SDL_BWin.h"
+#include <new>
+
+/* Define a path to window's BWIN data */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
+ return ((SDL_BWin*)(window->driverdata));
+}
+
+static SDL_INLINE SDL_BApp *_GetBeApp() {
+ return ((SDL_BApp*)be_app);
+}
+
+static int _InitWindow(_THIS, SDL_Window *window) {
+ uint32 flags = 0;
+ window_look look = B_TITLED_WINDOW_LOOK;
+
+ BRect bounds(
+ window->x,
+ window->y,
+ window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing
+ window->y + window->h - 1
+ );
+
+ if(window->flags & SDL_WINDOW_FULLSCREEN) {
+ /* TODO: Add support for this flag */
+ printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
+ }
+ if(window->flags & SDL_WINDOW_OPENGL) {
+ /* TODO: Add support for this flag */
+ }
+ if(!(window->flags & SDL_WINDOW_RESIZABLE)) {
+ flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
+ }
+ if(window->flags & SDL_WINDOW_BORDERLESS) {
+ look = B_NO_BORDER_WINDOW_LOOK;
+ }
+
+ SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags);
+ if(bwin == NULL)
+ return -1;
+
+ window->driverdata = bwin;
+ int32 winID = _GetBeApp()->GetID(window);
+ bwin->SetID(winID);
+
+ return 0;
+}
+
+int BE_CreateWindow(_THIS, SDL_Window *window) {
+ if (_InitWindow(_this, window) < 0) {
+ return -1;
+ }
+
+ /* Start window loop */
+ _ToBeWin(window)->Show();
+ return 0;
+}
+
+int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
+
+ SDL_BWin *otherBWin = (SDL_BWin*)data;
+ if(!otherBWin->LockLooper())
+ return -1;
+
+ /* Create the new window and initialize its members */
+ window->x = (int)otherBWin->Frame().left;
+ window->y = (int)otherBWin->Frame().top;
+ window->w = (int)otherBWin->Frame().Width();
+ window->h = (int)otherBWin->Frame().Height();
+
+ /* Set SDL flags */
+ if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
+ window->flags |= SDL_WINDOW_RESIZABLE;
+ }
+
+ /* If we are out of memory, return the error code */
+ if (_InitWindow(_this, window) < 0) {
+ return -1;
+ }
+
+ /* TODO: Add any other SDL-supported window attributes here */
+ _ToBeWin(window)->SetTitle(otherBWin->Title());
+
+ /* Start window loop and unlock the other window */
+ _ToBeWin(window)->Show();
+
+ otherBWin->UnlockLooper();
+ return 0;
+}
+
+void BE_SetWindowTitle(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_SET_TITLE);
+ msg.AddString("window-title", window->title);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
+ /* FIXME: Icons not supported by Haiku */
+}
+
+void BE_SetWindowPosition(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_MOVE_WINDOW);
+ msg.AddInt32("window-x", window->x);
+ msg.AddInt32("window-y", window->y);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowSize(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_RESIZE_WINDOW);
+ msg.AddInt32("window-w", window->w - 1);
+ msg.AddInt32("window-h", window->h - 1);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
+ BMessage msg(BWIN_SET_BORDERED);
+ msg.AddBool("window-border", bordered != SDL_FALSE);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
+ BMessage msg(BWIN_SET_RESIZABLE);
+ msg.AddBool("window-resizable", resizable != SDL_FALSE);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_ShowWindow(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_SHOW_WINDOW);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_HideWindow(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_HIDE_WINDOW);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_RaiseWindow(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_MaximizeWindow(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_MAXIMIZE_WINDOW);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_MinimizeWindow(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_MINIMIZE_WINDOW);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_RestoreWindow(_THIS, SDL_Window * window) {
+ BMessage msg(BWIN_RESTORE_WINDOW);
+ _ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowFullscreen(_THIS, SDL_Window * window,
+ SDL_VideoDisplay * display, SDL_bool fullscreen) {
+ /* Haiku tracks all video display information */
+ BMessage msg(BWIN_FULLSCREEN);
+ msg.AddBool("fullscreen", fullscreen);
+ _ToBeWin(window)->PostMessage(&msg);
+
+}
+
+int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
+ /* FIXME: Not Haiku supported */
+ return -1;
+}
+
+int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
+ /* FIXME: Not Haiku supported */
+ return -1;
+}
+
+
+void BE_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
+ /* TODO: Implement this! */
+}
+
+void BE_DestroyWindow(_THIS, SDL_Window * window) {
+ _ToBeWin(window)->LockLooper(); /* This MUST be locked */
+ _GetBeApp()->ClearID(_ToBeWin(window));
+ _ToBeWin(window)->Quit();
+ window->driverdata = NULL;
+}
+
+SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info) {
+ /* FIXME: What is the point of this? What information should be included? */
+ return SDL_FALSE;
+}
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_HAIKU */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.h b/src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.h
new file mode 100644
index 0000000..100ffed
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/haiku/SDL_bwindow.h
@@ -0,0 +1,55 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_BWINDOW_H
+#define SDL_BWINDOW_H
+
+
+#include "../SDL_sysvideo.h"
+
+
+extern int BE_CreateWindow(_THIS, SDL_Window *window);
+extern int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+extern void BE_SetWindowTitle(_THIS, SDL_Window * window);
+extern void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+extern void BE_SetWindowPosition(_THIS, SDL_Window * window);
+extern void BE_SetWindowSize(_THIS, SDL_Window * window);
+extern void BE_ShowWindow(_THIS, SDL_Window * window);
+extern void BE_HideWindow(_THIS, SDL_Window * window);
+extern void BE_RaiseWindow(_THIS, SDL_Window * window);
+extern void BE_MaximizeWindow(_THIS, SDL_Window * window);
+extern void BE_MinimizeWindow(_THIS, SDL_Window * window);
+extern void BE_RestoreWindow(_THIS, SDL_Window * window);
+extern void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
+extern void BE_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable);
+extern void BE_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+extern int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
+extern int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
+extern void BE_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+extern void BE_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/khronos/EGL/egl.h b/src/3rdparty/SDL2/src/video/khronos/EGL/egl.h
new file mode 100644
index 0000000..93a2187
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/EGL/egl.h
@@ -0,0 +1,303 @@
+#ifndef __egl_h_
+#define __egl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.khronos.org/registry/egl
+**
+** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $
+*/
+
+#include <EGL/eglplatform.h>
+
+/* Generated on date 20170627 */
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
+typedef unsigned int EGLBoolean;
+typedef void *EGLDisplay;
+#include <KHR/khrplatform.h>
+#include <EGL/eglplatform.h>
+typedef void *EGLConfig;
+typedef void *EGLSurface;
+typedef void *EGLContext;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
+#define EGL_DRAW 0x3059
+#define EGL_EXTENSIONS 0x3055
+#define EGL_FALSE 0
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_HEIGHT 0x3056
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_NONE 0x3038
+#define EGL_NON_CONFORMANT_CONFIG 0x3051
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
+#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
+#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
+#define EGL_PBUFFER_BIT 0x0001
+#define EGL_PIXMAP_BIT 0x0002
+#define EGL_READ 0x305A
+#define EGL_RED_SIZE 0x3024
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SLOW_CONFIG 0x3050
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_SUCCESS 0x3000
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_TRANSPARENT_RGB 0x3052
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRUE 1
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_WIDTH 0x3057
+#define EGL_WINDOW_BIT 0x0004
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
+EGLAPI EGLint EGLAPIENTRY eglGetError (void);
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
+#endif /* EGL_VERSION_1_0 */
+
+#ifndef EGL_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_CONTEXT_LOST 0x300E
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_2D 0x305F
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_TARGET 0x3081
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
+#endif /* EGL_VERSION_1_1 */
+
+#ifndef EGL_VERSION_1_2
+#define EGL_VERSION_1_2 1
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#define EGL_ALPHA_FORMAT 0x3088
+#define EGL_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_ALPHA_FORMAT_PRE 0x308C
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_BUFFER_PRESERVED 0x3094
+#define EGL_BUFFER_DESTROYED 0x3095
+#define EGL_CLIENT_APIS 0x308D
+#define EGL_COLORSPACE 0x3087
+#define EGL_COLORSPACE_sRGB 0x3089
+#define EGL_COLORSPACE_LINEAR 0x308A
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+#define EGL_DISPLAY_SCALING 10000
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_LUMINANCE_BUFFER 0x308F
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_OPENGL_ES_BIT 0x0001
+#define EGL_OPENVG_BIT 0x0002
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENVG_IMAGE 0x3096
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_RGB_BUFFER 0x308E
+#define EGL_SINGLE_BUFFER 0x3085
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
+#define EGL_VERTICAL_RESOLUTION 0x3091
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
+#endif /* EGL_VERSION_1_2 */
+
+#ifndef EGL_VERSION_1_3
+#define EGL_VERSION_1_3 1
+#define EGL_CONFORMANT 0x3042
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041
+#define EGL_OPENGL_ES2_BIT 0x0004
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_COLORSPACE_sRGB 0x3089
+#define EGL_VG_COLORSPACE_LINEAR 0x308A
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
+#endif /* EGL_VERSION_1_3 */
+
+#ifndef EGL_VERSION_1_4
+#define EGL_VERSION_1_4 1
+#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
+#define EGL_OPENGL_API 0x30A2
+#define EGL_OPENGL_BIT 0x0008
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
+#endif /* EGL_VERSION_1_4 */
+
+#ifndef EGL_VERSION_1_5
+#define EGL_VERSION_1_5 1
+typedef void *EGLSync;
+typedef intptr_t EGLAttrib;
+typedef khronos_utime_nanoseconds_t EGLTime;
+typedef void *EGLImage;
+#define EGL_CONTEXT_MAJOR_VERSION 0x3098
+#define EGL_CONTEXT_MINOR_VERSION 0x30FB
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
+#define EGL_NO_RESET_NOTIFICATION 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
+#define EGL_OPENGL_ES3_BIT 0x00000040
+#define EGL_CL_EVENT_HANDLE 0x309C
+#define EGL_SYNC_CL_EVENT 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
+#define EGL_SYNC_TYPE 0x30F7
+#define EGL_SYNC_STATUS 0x30F1
+#define EGL_SYNC_CONDITION 0x30F8
+#define EGL_SIGNALED 0x30F2
+#define EGL_UNSIGNALED 0x30F3
+#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
+#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED 0x30F5
+#define EGL_CONDITION_SATISFIED 0x30F6
+#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
+#define EGL_SYNC_FENCE 0x30F9
+#define EGL_GL_COLORSPACE 0x309D
+#define EGL_GL_COLORSPACE_SRGB 0x3089
+#define EGL_GL_COLORSPACE_LINEAR 0x308A
+#define EGL_GL_RENDERBUFFER 0x30B9
+#define EGL_GL_TEXTURE_2D 0x30B1
+#define EGL_GL_TEXTURE_LEVEL 0x30BC
+#define EGL_GL_TEXTURE_3D 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
+#define EGL_IMAGE_PRESERVED 0x30D2
+#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
+EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#endif /* EGL_VERSION_1_5 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/khronos/EGL/eglext.h b/src/3rdparty/SDL2/src/video/khronos/EGL/eglext.h
new file mode 100644
index 0000000..d2def03
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/EGL/eglext.h
@@ -0,0 +1,1241 @@
+#ifndef __eglext_h_
+#define __eglext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.khronos.org/registry/egl
+**
+** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $
+*/
+
+#include <EGL/eglplatform.h>
+
+#define EGL_EGLEXT_VERSION 20170627
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR 0x309C
+#define EGL_SYNC_CL_EVENT_KHR 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
+#endif /* EGL_KHR_cl_event */
+
+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#endif
+#endif /* EGL_KHR_cl_event2 */
+
+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
+#endif /* EGL_KHR_config_attribs */
+
+#ifndef EGL_KHR_context_flush_control
+#define EGL_KHR_context_flush_control 1
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
+#endif /* EGL_KHR_context_flush_control */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif /* EGL_KHR_create_context */
+
+#ifndef EGL_KHR_create_context_no_error
+#define EGL_KHR_create_context_no_error 1
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
+#endif /* EGL_KHR_create_context_no_error */
+
+#ifndef EGL_KHR_debug
+#define EGL_KHR_debug 1
+typedef void *EGLLabelKHR;
+typedef void *EGLObjectKHR;
+typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
+#define EGL_OBJECT_THREAD_KHR 0x33B0
+#define EGL_OBJECT_DISPLAY_KHR 0x33B1
+#define EGL_OBJECT_CONTEXT_KHR 0x33B2
+#define EGL_OBJECT_SURFACE_KHR 0x33B3
+#define EGL_OBJECT_IMAGE_KHR 0x33B4
+#define EGL_OBJECT_SYNC_KHR 0x33B5
+#define EGL_OBJECT_STREAM_KHR 0x33B6
+#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9
+#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA
+#define EGL_DEBUG_MSG_WARN_KHR 0x33BB
+#define EGL_DEBUG_MSG_INFO_KHR 0x33BC
+#define EGL_DEBUG_CALLBACK_KHR 0x33B8
+typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value);
+typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value);
+EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
+#endif
+#endif /* EGL_KHR_debug */
+
+#ifndef EGL_KHR_display_reference
+#define EGL_KHR_display_reference 1
+#define EGL_TRACK_REFERENCES_KHR 0x3352
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value);
+#endif
+#endif /* EGL_KHR_display_reference */
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR 0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
+#endif /* EGL_KHR_gl_colorspace */
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif
+#endif /* EGL_KHR_image */
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif /* EGL_KHR_image_base */
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+#endif /* EGL_KHR_image_pixmap */
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
+#define EGL_MATCH_FORMAT_KHR 0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
+#define EGL_FORMAT_RGB_565_KHR 0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
+#define EGL_BITMAP_POINTER_KHR 0x30C6
+#define EGL_BITMAP_PITCH_KHR 0x30C7
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR 0x30CE
+#define EGL_UPPER_LEFT_KHR 0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
+#endif
+#endif /* EGL_KHR_lock_surface */
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+#endif /* EGL_KHR_lock_surface2 */
+
+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#endif
+#endif /* EGL_KHR_lock_surface3 */
+
+#ifndef EGL_KHR_mutable_render_buffer
+#define EGL_KHR_mutable_render_buffer 1
+#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000
+#endif /* EGL_KHR_mutable_render_buffer */
+
+#ifndef EGL_KHR_no_config_context
+#define EGL_KHR_no_config_context 1
+#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0)
+#endif /* EGL_KHR_no_config_context */
+
+#ifndef EGL_KHR_partial_update
+#define EGL_KHR_partial_update 1
+#define EGL_BUFFER_AGE_KHR 0x313D
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_partial_update */
+
+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR 0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR 0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0)
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
+
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void *EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+#define EGL_PRODUCER_FRAME_KHR 0x3212
+#define EGL_CONSUMER_FRAME_KHR 0x3213
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
+
+#ifndef EGL_KHR_stream_attrib
+#define EGL_KHR_stream_attrib 1
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream_attrib */
+
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
+
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1)
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
+
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
+
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
+
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR 0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+#endif /* EGL_KHR_surfaceless_context */
+
+#ifndef EGL_KHR_swap_buffers_with_damage
+#define EGL_KHR_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_swap_buffers_with_damage */
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
+#endif /* EGL_KHR_vg_parent_image */
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+#endif /* EGL_KHR_wait_sync */
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+#endif /* EGL_ANDROID_blob_cache */
+
+#ifndef EGL_ANDROID_create_native_client_buffer
+#define EGL_ANDROID_create_native_client_buffer 1
+#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143
+#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001
+#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002
+#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004
+typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list);
+#endif
+#endif /* EGL_ANDROID_create_native_client_buffer */
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
+
+#ifndef EGL_ANDROID_front_buffer_auto_refresh
+#define EGL_ANDROID_front_buffer_auto_refresh 1
+#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C
+#endif /* EGL_ANDROID_front_buffer_auto_refresh */
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
+#endif
+#endif /* EGL_ANDROID_native_fence_sync */
+
+#ifndef EGL_ANDROID_presentation_time
+#define EGL_ANDROID_presentation_time 1
+typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
+#endif
+#endif /* EGL_ANDROID_presentation_time */
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_device_d3d
+#define EGL_ANGLE_device_d3d 1
+#define EGL_D3D9_DEVICE_ANGLE 0x33A0
+#define EGL_D3D11_DEVICE_ANGLE 0x33A1
+#endif /* EGL_ANGLE_device_d3d */
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+#endif /* EGL_ANGLE_query_surface_pointer */
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE 0x3201
+#endif /* EGL_ANGLE_window_fixed_size */
+
+#ifndef EGL_ARM_implicit_external_sync
+#define EGL_ARM_implicit_external_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A
+#endif /* EGL_ARM_implicit_external_sync */
+
+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM 0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
+
+#ifndef EGL_EXT_bind_to_front
+#define EGL_EXT_bind_to_front 1
+#define EGL_FRONT_BUFFER_EXT 0x3464
+#endif /* EGL_EXT_bind_to_front */
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif /* EGL_EXT_buffer_age */
+
+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
+
+#ifndef EGL_EXT_compositor
+#define EGL_EXT_compositor 1
+#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460
+#define EGL_EXTERNAL_REF_ID_EXT 0x3461
+#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462
+#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy);
+#endif
+#endif /* EGL_EXT_compositor */
+
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
+#endif /* EGL_EXT_create_context_robustness */
+
+#ifndef EGL_EXT_device_base
+#define EGL_EXT_device_base 1
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0)
+#define EGL_BAD_DEVICE_EXT 0x322B
+#define EGL_DEVICE_EXT 0x322C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#endif
+#endif /* EGL_EXT_device_base */
+
+#ifndef EGL_EXT_device_drm
+#define EGL_EXT_device_drm 1
+#define EGL_DRM_DEVICE_FILE_EXT 0x3233
+#endif /* EGL_EXT_device_drm */
+
+#ifndef EGL_EXT_device_enumeration
+#define EGL_EXT_device_enumeration 1
+#endif /* EGL_EXT_device_enumeration */
+
+#ifndef EGL_EXT_device_openwf
+#define EGL_EXT_device_openwf 1
+#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
+#endif /* EGL_EXT_device_openwf */
+
+#ifndef EGL_EXT_device_query
+#define EGL_EXT_device_query 1
+#endif /* EGL_EXT_device_query */
+
+#ifndef EGL_EXT_gl_colorspace_bt2020_linear
+#define EGL_EXT_gl_colorspace_bt2020_linear 1
+#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F
+#endif /* EGL_EXT_gl_colorspace_bt2020_linear */
+
+#ifndef EGL_EXT_gl_colorspace_bt2020_pq
+#define EGL_EXT_gl_colorspace_bt2020_pq 1
+#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340
+#endif /* EGL_EXT_gl_colorspace_bt2020_pq */
+
+#ifndef EGL_EXT_gl_colorspace_display_p3
+#define EGL_EXT_gl_colorspace_display_p3 1
+#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363
+#endif /* EGL_EXT_gl_colorspace_display_p3 */
+
+#ifndef EGL_EXT_gl_colorspace_display_p3_linear
+#define EGL_EXT_gl_colorspace_display_p3_linear 1
+#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362
+#endif /* EGL_EXT_gl_colorspace_display_p3_linear */
+
+#ifndef EGL_EXT_gl_colorspace_scrgb
+#define EGL_EXT_gl_colorspace_scrgb 1
+#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351
+#endif /* EGL_EXT_gl_colorspace_scrgb */
+
+#ifndef EGL_EXT_gl_colorspace_scrgb_linear
+#define EGL_EXT_gl_colorspace_scrgb_linear 1
+#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350
+#endif /* EGL_EXT_gl_colorspace_scrgb_linear */
+
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT 0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT 0x327F
+#define EGL_ITU_REC709_EXT 0x3280
+#define EGL_ITU_REC2020_EXT 0x3281
+#define EGL_YUV_FULL_RANGE_EXT 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
+
+#ifndef EGL_EXT_image_dma_buf_import_modifiers
+#define EGL_EXT_image_dma_buf_import_modifiers 1
+#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
+#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
+#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
+#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
+#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
+#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
+#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
+#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
+#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
+#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
+#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
+#endif
+#endif /* EGL_EXT_image_dma_buf_import_modifiers */
+
+#ifndef EGL_EXT_image_implicit_sync_control
+#define EGL_EXT_image_implicit_sync_control 1
+#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470
+#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471
+#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472
+#endif /* EGL_EXT_image_implicit_sync_control */
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_output_base
+#define EGL_EXT_output_base 1
+typedef void *EGLOutputLayerEXT;
+typedef void *EGLOutputPortEXT;
+#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0)
+#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0)
+#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
+#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
+#define EGL_SWAP_INTERVAL_EXT 0x322F
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#endif
+#endif /* EGL_EXT_output_base */
+
+#ifndef EGL_EXT_output_drm
+#define EGL_EXT_output_drm 1
+#define EGL_DRM_CRTC_EXT 0x3234
+#define EGL_DRM_PLANE_EXT 0x3235
+#define EGL_DRM_CONNECTOR_EXT 0x3236
+#endif /* EGL_EXT_output_drm */
+
+#ifndef EGL_EXT_output_openwf
+#define EGL_EXT_output_openwf 1
+#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
+#define EGL_OPENWF_PORT_ID_EXT 0x3239
+#endif /* EGL_EXT_output_openwf */
+
+#ifndef EGL_EXT_pixel_format_float
+#define EGL_EXT_pixel_format_float 1
+#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339
+#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A
+#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B
+#endif /* EGL_EXT_pixel_format_float */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#endif
+#endif /* EGL_EXT_platform_base */
+
+#ifndef EGL_EXT_platform_device
+#define EGL_EXT_platform_device 1
+#define EGL_PLATFORM_DEVICE_EXT 0x313F
+#endif /* EGL_EXT_platform_device */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
+#endif /* EGL_EXT_platform_x11 */
+
+#ifndef EGL_EXT_protected_content
+#define EGL_EXT_protected_content 1
+#define EGL_PROTECTED_CONTENT_EXT 0x32C0
+#endif /* EGL_EXT_protected_content */
+
+#ifndef EGL_EXT_protected_surface
+#define EGL_EXT_protected_surface 1
+#endif /* EGL_EXT_protected_surface */
+
+#ifndef EGL_EXT_stream_consumer_egloutput
+#define EGL_EXT_stream_consumer_egloutput 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#endif
+#endif /* EGL_EXT_stream_consumer_egloutput */
+
+#ifndef EGL_EXT_surface_CTA861_3_metadata
+#define EGL_EXT_surface_CTA861_3_metadata 1
+#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360
+#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361
+#endif /* EGL_EXT_surface_CTA861_3_metadata */
+
+#ifndef EGL_EXT_surface_SMPTE2086_metadata
+#define EGL_EXT_surface_SMPTE2086_metadata 1
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346
+#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347
+#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348
+#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349
+#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A
+#define EGL_METADATA_SCALING_EXT 50000
+#endif /* EGL_EXT_surface_SMPTE2086_metadata */
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
+#ifndef EGL_EXT_yuv_surface
+#define EGL_EXT_yuv_surface 1
+#define EGL_YUV_ORDER_EXT 0x3301
+#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
+#define EGL_YUV_SUBSAMPLE_EXT 0x3312
+#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
+#define EGL_YUV_CSC_STANDARD_EXT 0x330A
+#define EGL_YUV_PLANE_BPP_EXT 0x331A
+#define EGL_YUV_BUFFER_EXT 0x3300
+#define EGL_YUV_ORDER_YUV_EXT 0x3302
+#define EGL_YUV_ORDER_YVU_EXT 0x3303
+#define EGL_YUV_ORDER_YUYV_EXT 0x3304
+#define EGL_YUV_ORDER_UYVY_EXT 0x3305
+#define EGL_YUV_ORDER_YVYU_EXT 0x3306
+#define EGL_YUV_ORDER_VYUY_EXT 0x3307
+#define EGL_YUV_ORDER_AYUV_EXT 0x3308
+#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
+#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
+#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
+#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
+#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
+#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
+#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
+#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
+#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
+#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
+#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
+#endif /* EGL_EXT_yuv_surface */
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+ void *pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#endif
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI 0x8F70
+#define EGL_COLOR_RGB_HI 0x8F71
+#define EGL_COLOR_RGBA_HI 0x8F72
+#define EGL_COLOR_ARGB_HI 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif /* EGL_IMG_context_priority */
+
+#ifndef EGL_IMG_image_plane_attribs
+#define EGL_IMG_image_plane_attribs 1
+#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105
+#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106
+#endif /* EGL_IMG_image_plane_attribs */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
+#define EGL_DRM_BUFFER_USE_MESA 0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA 0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+#endif /* EGL_MESA_drm_image */
+
+#ifndef EGL_MESA_image_dma_buf_export
+#define EGL_MESA_image_dma_buf_export 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#endif
+#endif /* EGL_MESA_image_dma_buf_export */
+
+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA 0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_MESA_platform_surfaceless
+#define EGL_MESA_platform_surfaceless 1
+#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
+#endif /* EGL_MESA_platform_surfaceless */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region */
+
+#ifndef EGL_NOK_swap_region2
+#define EGL_NOK_swap_region2 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region2 */
+
+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+#define EGL_Y_INVERTED_NOK 0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif /* EGL_NV_3dvision_surface */
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif /* EGL_NV_coverage_sample */
+
+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_cuda_event
+#define EGL_NV_cuda_event 1
+#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
+#define EGL_SYNC_CUDA_EVENT_NV 0x323C
+#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
+#endif /* EGL_NV_cuda_event */
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_device_cuda
+#define EGL_NV_device_cuda 1
+#define EGL_CUDA_DEVICE_NV 0x323A
+#endif /* EGL_NV_device_cuda */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#endif
+#endif /* EGL_NV_native_query */
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+#endif /* EGL_NV_post_sub_buffer */
+
+#ifndef EGL_NV_robustness_video_memory_purge
+#define EGL_NV_robustness_video_memory_purge 1
+#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C
+#endif /* EGL_NV_robustness_video_memory_purge */
+
+#ifndef EGL_NV_stream_consumer_gltexture_yuv
+#define EGL_NV_stream_consumer_gltexture_yuv 1
+#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C
+#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D
+#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list);
+#endif
+#endif /* EGL_NV_stream_consumer_gltexture_yuv */
+
+#ifndef EGL_NV_stream_cross_display
+#define EGL_NV_stream_cross_display 1
+#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E
+#endif /* EGL_NV_stream_cross_display */
+
+#ifndef EGL_NV_stream_cross_object
+#define EGL_NV_stream_cross_object 1
+#define EGL_STREAM_CROSS_OBJECT_NV 0x334D
+#endif /* EGL_NV_stream_cross_object */
+
+#ifndef EGL_NV_stream_cross_partition
+#define EGL_NV_stream_cross_partition 1
+#define EGL_STREAM_CROSS_PARTITION_NV 0x323F
+#endif /* EGL_NV_stream_cross_partition */
+
+#ifndef EGL_NV_stream_cross_process
+#define EGL_NV_stream_cross_process 1
+#define EGL_STREAM_CROSS_PROCESS_NV 0x3245
+#endif /* EGL_NV_stream_cross_process */
+
+#ifndef EGL_NV_stream_cross_system
+#define EGL_NV_stream_cross_system 1
+#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F
+#endif /* EGL_NV_stream_cross_system */
+
+#ifndef EGL_NV_stream_fifo_next
+#define EGL_NV_stream_fifo_next 1
+#define EGL_PENDING_FRAME_NV 0x3329
+#define EGL_STREAM_TIME_PENDING_NV 0x332A
+#endif /* EGL_NV_stream_fifo_next */
+
+#ifndef EGL_NV_stream_fifo_synchronous
+#define EGL_NV_stream_fifo_synchronous 1
+#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336
+#endif /* EGL_NV_stream_fifo_synchronous */
+
+#ifndef EGL_NV_stream_frame_limits
+#define EGL_NV_stream_frame_limits 1
+#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337
+#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338
+#endif /* EGL_NV_stream_frame_limits */
+
+#ifndef EGL_NV_stream_metadata
+#define EGL_NV_stream_metadata 1
+#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250
+#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251
+#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252
+#define EGL_PRODUCER_METADATA_NV 0x3253
+#define EGL_CONSUMER_METADATA_NV 0x3254
+#define EGL_PENDING_METADATA_NV 0x3328
+#define EGL_METADATA0_SIZE_NV 0x3255
+#define EGL_METADATA1_SIZE_NV 0x3256
+#define EGL_METADATA2_SIZE_NV 0x3257
+#define EGL_METADATA3_SIZE_NV 0x3258
+#define EGL_METADATA0_TYPE_NV 0x3259
+#define EGL_METADATA1_TYPE_NV 0x325A
+#define EGL_METADATA2_TYPE_NV 0x325B
+#define EGL_METADATA3_TYPE_NV 0x325C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
+#endif
+#endif /* EGL_NV_stream_metadata */
+
+#ifndef EGL_NV_stream_remote
+#define EGL_NV_stream_remote 1
+#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240
+#define EGL_STREAM_TYPE_NV 0x3241
+#define EGL_STREAM_PROTOCOL_NV 0x3242
+#define EGL_STREAM_ENDPOINT_NV 0x3243
+#define EGL_STREAM_LOCAL_NV 0x3244
+#define EGL_STREAM_PRODUCER_NV 0x3247
+#define EGL_STREAM_CONSUMER_NV 0x3248
+#define EGL_STREAM_PROTOCOL_FD_NV 0x3246
+#endif /* EGL_NV_stream_remote */
+
+#ifndef EGL_NV_stream_reset
+#define EGL_NV_stream_reset 1
+#define EGL_SUPPORT_RESET_NV 0x3334
+#define EGL_SUPPORT_REUSE_NV 0x3335
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_NV_stream_reset */
+
+#ifndef EGL_NV_stream_socket
+#define EGL_NV_stream_socket 1
+#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B
+#define EGL_SOCKET_HANDLE_NV 0x324C
+#define EGL_SOCKET_TYPE_NV 0x324D
+#endif /* EGL_NV_stream_socket */
+
+#ifndef EGL_NV_stream_socket_inet
+#define EGL_NV_stream_socket_inet 1
+#define EGL_SOCKET_TYPE_INET_NV 0x324F
+#endif /* EGL_NV_stream_socket_inet */
+
+#ifndef EGL_NV_stream_socket_unix
+#define EGL_NV_stream_socket_unix 1
+#define EGL_SOCKET_TYPE_UNIX_NV 0x324E
+#endif /* EGL_NV_stream_socket_unix */
+
+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV 0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#endif
+#endif /* EGL_NV_stream_sync */
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0)
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
+
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
+
+#ifndef EGL_TIZEN_image_native_buffer
+#define EGL_TIZEN_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
+#endif /* EGL_TIZEN_image_native_buffer */
+
+#ifndef EGL_TIZEN_image_native_surface
+#define EGL_TIZEN_image_native_surface 1
+#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
+#endif /* EGL_TIZEN_image_native_surface */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/khronos/EGL/eglplatform.h b/src/3rdparty/SDL2/src/video/khronos/EGL/eglplatform.h
new file mode 100644
index 0000000..c77c333
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/EGL/eglplatform.h
@@ -0,0 +1,132 @@
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2016 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "EGL" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+/* Macros used in EGL function prototype declarations.
+ *
+ * EGL functions should be prototyped as:
+ *
+ * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+ * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+ *
+ * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+ */
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+ * are aliases of window-system-dependent types, such as X Display * or
+ * Windows Device Context. They must be defined in platform-specific
+ * code below. The EGL-prefixed versions of Native*Type are the same
+ * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+ *
+ * Khronos STRONGLY RECOMMENDS that you use the default definitions
+ * provided below, since these changes affect both binary and source
+ * portability of applications using EGL running on different EGL
+ * implementations.
+ */
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND EGLNativeWindowType;
+
+#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(__ANDROID__) || defined(ANDROID)
+
+struct ANativeWindow;
+struct egl_native_pixmap_t;
+
+typedef struct ANativeWindow* EGLNativeWindowType;
+typedef struct egl_native_pixmap_t* EGLNativePixmapType;
+typedef void* EGLNativeDisplayType;
+
+#elif defined(__unix__)
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other. While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+
+/* C++ / C typecast macros for special EGL handle values */
+#if defined(__cplusplus)
+#define EGL_CAST(type, value) (static_cast<type>(value))
+#else
+#define EGL_CAST(type, value) ((type) (value))
+#endif
+
+#endif /* __eglplatform_h */
diff --git a/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2.h b/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2.h
new file mode 100644
index 0000000..8ba1642
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2.h
@@ -0,0 +1,675 @@
+#ifndef __gl2_h_
+#define __gl2_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#include <GLES2/gl2platform.h>
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+#ifndef GL_GLES_PROTOTYPES
+#define GL_GLES_PROTOTYPES 1
+#endif
+
+/* Generated on date 20170817 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TEXTURE 0x1702
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_NONE 0
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
+typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2ext.h b/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2ext.h
new file mode 100644
index 0000000..4e1488c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2ext.h
@@ -0,0 +1,3505 @@
+#ifndef __gl2ext_h_
+#define __gl2ext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* Generated on date 20170817 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: _nomatch_^
+ * Default extensions included: gles2
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_KHR_blend_equation_advanced
+#define GL_KHR_blend_equation_advanced 1
+#define GL_MULTIPLY_KHR 0x9294
+#define GL_SCREEN_KHR 0x9295
+#define GL_OVERLAY_KHR 0x9296
+#define GL_DARKEN_KHR 0x9297
+#define GL_LIGHTEN_KHR 0x9298
+#define GL_COLORDODGE_KHR 0x9299
+#define GL_COLORBURN_KHR 0x929A
+#define GL_HARDLIGHT_KHR 0x929B
+#define GL_SOFTLIGHT_KHR 0x929C
+#define GL_DIFFERENCE_KHR 0x929E
+#define GL_EXCLUSION_KHR 0x92A0
+#define GL_HSL_HUE_KHR 0x92AD
+#define GL_HSL_SATURATION_KHR 0x92AE
+#define GL_HSL_COLOR_KHR 0x92AF
+#define GL_HSL_LUMINOSITY_KHR 0x92B0
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
+#endif
+#endif /* GL_KHR_blend_equation_advanced */
+
+#ifndef GL_KHR_blend_equation_advanced_coherent
+#define GL_KHR_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
+#endif /* GL_KHR_blend_equation_advanced_coherent */
+
+#ifndef GL_KHR_context_flush_control
+#define GL_KHR_context_flush_control 1
+#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
+#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC
+#endif /* GL_KHR_context_flush_control */
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+#define GL_SAMPLER 0x82E6
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
+#define GL_DEBUG_SOURCE_API_KHR 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
+#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
+#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
+#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
+#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
+#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
+#define GL_BUFFER_KHR 0x82E0
+#define GL_SHADER_KHR 0x82E1
+#define GL_PROGRAM_KHR 0x82E2
+#define GL_VERTEX_ARRAY_KHR 0x8074
+#define GL_QUERY_KHR 0x82E3
+#define GL_PROGRAM_PIPELINE_KHR 0x82E4
+#define GL_SAMPLER_KHR 0x82E6
+#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
+#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
+#define GL_DEBUG_OUTPUT_KHR 0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
+#define GL_STACK_OVERFLOW_KHR 0x0503
+#define GL_STACK_UNDERFLOW_KHR 0x0504
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
+GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
+#endif
+#endif /* GL_KHR_debug */
+
+#ifndef GL_KHR_no_error
+#define GL_KHR_no_error 1
+#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
+#endif /* GL_KHR_no_error */
+
+#ifndef GL_KHR_parallel_shader_compile
+#define GL_KHR_parallel_shader_compile 1
+#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0
+#define GL_COMPLETION_STATUS_KHR 0x91B1
+typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count);
+#endif
+#endif /* GL_KHR_parallel_shader_compile */
+
+#ifndef GL_KHR_robust_buffer_access_behavior
+#define GL_KHR_robust_buffer_access_behavior 1
+#endif /* GL_KHR_robust_buffer_access_behavior */
+
+#ifndef GL_KHR_robustness
+#define GL_KHR_robustness 1
+#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
+#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
+#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
+#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
+#define GL_CONTEXT_LOST_KHR 0x0507
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#endif
+#endif /* GL_KHR_robustness */
+
+#ifndef GL_KHR_texture_compression_astc_hdr
+#define GL_KHR_texture_compression_astc_hdr 1
+#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
+#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
+#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
+#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
+#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
+#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
+#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
+#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
+#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
+#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
+#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
+#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+#endif /* GL_KHR_texture_compression_astc_hdr */
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif /* GL_KHR_texture_compression_astc_ldr */
+
+#ifndef GL_KHR_texture_compression_astc_sliced_3d
+#define GL_KHR_texture_compression_astc_sliced_3d 1
+#endif /* GL_KHR_texture_compression_astc_sliced_3d */
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+typedef void *GLeglImageOES;
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+#endif /* GL_OES_EGL_image */
+
+#ifndef GL_OES_EGL_image_external
+#define GL_OES_EGL_image_external 1
+#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
+#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
+#define GL_SAMPLER_EXTERNAL_OES 0x8D66
+#endif /* GL_OES_EGL_image_external */
+
+#ifndef GL_OES_EGL_image_external_essl3
+#define GL_OES_EGL_image_external_essl3 1
+#endif /* GL_OES_EGL_image_external_essl3 */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
+#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
+#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif /* GL_OES_compressed_ETC1_RGB8_texture */
+
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif /* GL_OES_compressed_paletted_texture */
+
+#ifndef GL_OES_copy_image
+#define GL_OES_copy_image 1
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+#endif /* GL_OES_copy_image */
+
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif /* GL_OES_depth24 */
+
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif /* GL_OES_depth32 */
+
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif /* GL_OES_depth_texture */
+
+#ifndef GL_OES_draw_buffers_indexed
+#define GL_OES_draw_buffers_indexed 1
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index);
+#endif
+#endif /* GL_OES_draw_buffers_indexed */
+
+#ifndef GL_OES_draw_elements_base_vertex
+#define GL_OES_draw_elements_base_vertex 1
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
+#endif
+#endif /* GL_OES_draw_elements_base_vertex */
+
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif /* GL_OES_element_index_uint */
+
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif /* GL_OES_fbo_render_mipmap */
+
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif /* GL_OES_fragment_precision_high */
+
+#ifndef GL_OES_geometry_point_size
+#define GL_OES_geometry_point_size 1
+#endif /* GL_OES_geometry_point_size */
+
+#ifndef GL_OES_geometry_shader
+#define GL_OES_geometry_shader 1
+#define GL_GEOMETRY_SHADER_OES 0x8DD9
+#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004
+#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916
+#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917
+#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F
+#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E
+#define GL_LINES_ADJACENCY_OES 0x000A
+#define GL_LINE_STRIP_ADJACENCY_OES 0x000B
+#define GL_TRIANGLES_ADJACENCY_OES 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E
+#define GL_UNDEFINED_VERTEX_OES 0x8260
+#define GL_PRIMITIVES_GENERATED_OES 0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+#endif /* GL_OES_geometry_shader */
+
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#endif
+#endif /* GL_OES_get_program_binary */
+
+#ifndef GL_OES_gpu_shader5
+#define GL_OES_gpu_shader5 1
+#endif /* GL_OES_gpu_shader5 */
+
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
+#endif
+#endif /* GL_OES_mapbuffer */
+
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif /* GL_OES_packed_depth_stencil */
+
+#ifndef GL_OES_primitive_bounding_box
+#define GL_OES_primitive_bounding_box 1
+#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#endif
+#endif /* GL_OES_primitive_bounding_box */
+
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#define GL_ALPHA8_OES 0x803C
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+#define GL_LUMINANCE4_ALPHA4_OES 0x8043
+#define GL_LUMINANCE8_ALPHA8_OES 0x8045
+#define GL_LUMINANCE8_OES 0x8040
+#define GL_RGBA4_OES 0x8056
+#define GL_RGB5_A1_OES 0x8057
+#define GL_RGB565_OES 0x8D62
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#define GL_RGB10_EXT 0x8052
+#define GL_RGB10_A2_EXT 0x8059
+#endif /* GL_OES_required_internalformat */
+
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif /* GL_OES_rgb8_rgba8 */
+
+#ifndef GL_OES_sample_shading
+#define GL_OES_sample_shading 1
+#define GL_SAMPLE_SHADING_OES 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37
+typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
+#endif
+#endif /* GL_OES_sample_shading */
+
+#ifndef GL_OES_sample_variables
+#define GL_OES_sample_variables 1
+#endif /* GL_OES_sample_variables */
+
+#ifndef GL_OES_shader_image_atomic
+#define GL_OES_shader_image_atomic 1
+#endif /* GL_OES_shader_image_atomic */
+
+#ifndef GL_OES_shader_io_blocks
+#define GL_OES_shader_io_blocks 1
+#endif /* GL_OES_shader_io_blocks */
+
+#ifndef GL_OES_shader_multisample_interpolation
+#define GL_OES_shader_multisample_interpolation 1
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
+#endif /* GL_OES_shader_multisample_interpolation */
+
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif /* GL_OES_standard_derivatives */
+
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif /* GL_OES_stencil1 */
+
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif /* GL_OES_stencil4 */
+
+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+#endif /* GL_OES_surfaceless_context */
+
+#ifndef GL_OES_tessellation_point_size
+#define GL_OES_tessellation_point_size 1
+#endif /* GL_OES_tessellation_point_size */
+
+#ifndef GL_OES_tessellation_shader
+#define GL_OES_tessellation_shader 1
+#define GL_PATCHES_OES 0x000E
+#define GL_PATCH_VERTICES_OES 0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75
+#define GL_TESS_GEN_MODE_OES 0x8E76
+#define GL_TESS_GEN_SPACING_OES 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78
+#define GL_TESS_GEN_POINT_MODE_OES 0x8E79
+#define GL_ISOLINES_OES 0x8E7A
+#define GL_QUADS_OES 0x0007
+#define GL_FRACTIONAL_ODD_OES 0x8E7B
+#define GL_FRACTIONAL_EVEN_OES 0x8E7C
+#define GL_MAX_PATCH_VERTICES_OES 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221
+#define GL_IS_PER_PATCH_OES 0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308
+#define GL_TESS_CONTROL_SHADER_OES 0x8E88
+#define GL_TESS_EVALUATION_SHADER_OES 0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value);
+#endif
+#endif /* GL_OES_tessellation_shader */
+
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#define GL_TEXTURE_WRAP_R_OES 0x8072
+#define GL_TEXTURE_3D_OES 0x806F
+#define GL_TEXTURE_BINDING_3D_OES 0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+#define GL_SAMPLER_3D_OES 0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+#endif /* GL_OES_texture_3D */
+
+#ifndef GL_OES_texture_border_clamp
+#define GL_OES_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_OES 0x1004
+#define GL_CLAMP_TO_BORDER_OES 0x812D
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+#endif /* GL_OES_texture_border_clamp */
+
+#ifndef GL_OES_texture_buffer
+#define GL_OES_texture_buffer 1
+#define GL_TEXTURE_BUFFER_OES 0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F
+#define GL_SAMPLER_BUFFER_OES 0x8DC2
+#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8
+#define GL_IMAGE_BUFFER_OES 0x9051
+#define GL_INT_IMAGE_BUFFER_OES 0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067
+#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D
+#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E
+typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+#endif /* GL_OES_texture_buffer */
+
+#ifndef GL_OES_texture_compression_astc
+#define GL_OES_texture_compression_astc 1
+#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
+#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
+#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
+#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
+#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
+#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
+#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
+#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
+#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
+#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
+#endif /* GL_OES_texture_compression_astc */
+
+#ifndef GL_OES_texture_cube_map_array
+#define GL_OES_texture_cube_map_array 1
+#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A
+#endif /* GL_OES_texture_cube_map_array */
+
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif /* GL_OES_texture_float */
+
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif /* GL_OES_texture_float_linear */
+
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif /* GL_OES_texture_half_float */
+
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif /* GL_OES_texture_half_float_linear */
+
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif /* GL_OES_texture_npot */
+
+#ifndef GL_OES_texture_stencil8
+#define GL_OES_texture_stencil8 1
+#define GL_STENCIL_INDEX_OES 0x1901
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif /* GL_OES_texture_stencil8 */
+
+#ifndef GL_OES_texture_storage_multisample_2d_array
+#define GL_OES_texture_storage_multisample_2d_array 1
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_OES_texture_storage_multisample_2d_array */
+
+#ifndef GL_OES_texture_view
+#define GL_OES_texture_view 1
+#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+#endif /* GL_OES_texture_view */
+
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+#endif /* GL_OES_vertex_array_object */
+
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif /* GL_OES_vertex_half_float */
+
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+#define GL_INT_10_10_10_2_OES 0x8DF7
+#endif /* GL_OES_vertex_type_10_10_10_2 */
+
+#ifndef GL_OES_viewport_array
+#define GL_OES_viewport_array 1
+#define GL_MAX_VIEWPORTS_OES 0x825B
+#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C
+#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F
+typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v);
+GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data);
+#endif
+#endif /* GL_OES_viewport_array */
+
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif /* GL_AMD_compressed_3DC_texture */
+
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif /* GL_AMD_compressed_ATC_texture */
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+#endif /* GL_AMD_performance_monitor */
+
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#define GL_Z400_BINARY_AMD 0x8740
+#endif /* GL_AMD_program_binary_Z400 */
+
+#ifndef GL_ANDROID_extension_pack_es31a
+#define GL_ANDROID_extension_pack_es31a 1
+#endif /* GL_ANDROID_extension_pack_es31a */
+
+#ifndef GL_ANGLE_depth_texture
+#define GL_ANGLE_depth_texture 1
+#endif /* GL_ANGLE_depth_texture */
+
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_ANGLE_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_ANGLE_framebuffer_blit */
+
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_ANGLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+#define GL_MAX_SAMPLES_ANGLE 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ANGLE_framebuffer_multisample */
+
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_ANGLE_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_ANGLE_instanced_arrays */
+
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_ANGLE_pack_reverse_row_order 1
+#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
+#endif /* GL_ANGLE_pack_reverse_row_order */
+
+#ifndef GL_ANGLE_program_binary
+#define GL_ANGLE_program_binary 1
+#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+#endif /* GL_ANGLE_program_binary */
+
+#ifndef GL_ANGLE_texture_compression_dxt3
+#define GL_ANGLE_texture_compression_dxt3 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
+#endif /* GL_ANGLE_texture_compression_dxt3 */
+
+#ifndef GL_ANGLE_texture_compression_dxt5
+#define GL_ANGLE_texture_compression_dxt5 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
+#endif /* GL_ANGLE_texture_compression_dxt5 */
+
+#ifndef GL_ANGLE_texture_usage
+#define GL_ANGLE_texture_usage 1
+#define GL_TEXTURE_USAGE_ANGLE 0x93A2
+#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
+#endif /* GL_ANGLE_texture_usage */
+
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#endif
+#endif /* GL_ANGLE_translated_shader_source */
+
+#ifndef GL_APPLE_clip_distance
+#define GL_APPLE_clip_distance 1
+#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32
+#define GL_CLIP_DISTANCE0_APPLE 0x3000
+#define GL_CLIP_DISTANCE1_APPLE 0x3001
+#define GL_CLIP_DISTANCE2_APPLE 0x3002
+#define GL_CLIP_DISTANCE3_APPLE 0x3003
+#define GL_CLIP_DISTANCE4_APPLE 0x3004
+#define GL_CLIP_DISTANCE5_APPLE 0x3005
+#define GL_CLIP_DISTANCE6_APPLE 0x3006
+#define GL_CLIP_DISTANCE7_APPLE 0x3007
+#endif /* GL_APPLE_clip_distance */
+
+#ifndef GL_APPLE_color_buffer_packed_float
+#define GL_APPLE_color_buffer_packed_float 1
+#endif /* GL_APPLE_color_buffer_packed_float */
+
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+#endif /* GL_APPLE_copy_texture_levels */
+
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE 0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif
+#endif /* GL_APPLE_framebuffer_multisample */
+
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#define GL_RGB_422_APPLE 0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#define GL_RGB_RAW_422_APPLE 0x8A51
+#endif /* GL_APPLE_rgb_422 */
+
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#define GL_SYNC_OBJECT_APPLE 0x8A53
+#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
+#define GL_OBJECT_TYPE_APPLE 0x9112
+#define GL_SYNC_CONDITION_APPLE 0x9113
+#define GL_SYNC_STATUS_APPLE 0x9114
+#define GL_SYNC_FLAGS_APPLE 0x9115
+#define GL_SYNC_FENCE_APPLE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
+#define GL_UNSIGNALED_APPLE 0x9118
+#define GL_SIGNALED_APPLE 0x9119
+#define GL_ALREADY_SIGNALED_APPLE 0x911A
+#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
+#define GL_CONDITION_SATISFIED_APPLE 0x911C
+#define GL_WAIT_FAILED_APPLE 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
+#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+#endif /* GL_APPLE_sync */
+
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#define GL_BGRA_EXT 0x80E1
+#define GL_BGRA8_EXT 0x93A1
+#endif /* GL_APPLE_texture_format_BGRA8888 */
+
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+#endif /* GL_APPLE_texture_max_level */
+
+#ifndef GL_APPLE_texture_packed_float
+#define GL_APPLE_texture_packed_float 1
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B
+#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E
+#define GL_R11F_G11F_B10F_APPLE 0x8C3A
+#define GL_RGB9_E5_APPLE 0x8C3D
+#endif /* GL_APPLE_texture_packed_float */
+
+#ifndef GL_ARM_mali_program_binary
+#define GL_ARM_mali_program_binary 1
+#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
+#endif /* GL_ARM_mali_program_binary */
+
+#ifndef GL_ARM_mali_shader_binary
+#define GL_ARM_mali_shader_binary 1
+#define GL_MALI_SHADER_BINARY_ARM 0x8F60
+#endif /* GL_ARM_mali_shader_binary */
+
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif /* GL_ARM_rgba8 */
+
+#ifndef GL_ARM_shader_framebuffer_fetch
+#define GL_ARM_shader_framebuffer_fetch 1
+#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
+#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
+#endif /* GL_ARM_shader_framebuffer_fetch */
+
+#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
+#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
+#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
+
+#ifndef GL_DMP_program_binary
+#define GL_DMP_program_binary 1
+#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251
+#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252
+#define GL_DMP_PROGRAM_BINARY_DMP 0x9253
+#endif /* GL_DMP_program_binary */
+
+#ifndef GL_DMP_shader_binary
+#define GL_DMP_shader_binary 1
+#define GL_SHADER_BINARY_DMP 0x9250
+#endif /* GL_DMP_shader_binary */
+
+#ifndef GL_EXT_EGL_image_array
+#define GL_EXT_EGL_image_array 1
+#endif /* GL_EXT_EGL_image_array */
+
+#ifndef GL_EXT_YUV_target
+#define GL_EXT_YUV_target 1
+#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7
+#endif /* GL_EXT_YUV_target */
+
+#ifndef GL_EXT_base_instance
+#define GL_EXT_base_instance 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
+#endif
+#endif /* GL_EXT_base_instance */
+
+#ifndef GL_EXT_blend_func_extended
+#define GL_EXT_blend_func_extended 1
+#define GL_SRC1_COLOR_EXT 0x88F9
+#define GL_SRC1_ALPHA_EXT 0x8589
+#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA
+#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB
+#define GL_SRC_ALPHA_SATURATE_EXT 0x0308
+#define GL_LOCATION_INDEX_EXT 0x930F
+#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC
+typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
+typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name);
+#endif
+#endif /* GL_EXT_blend_func_extended */
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif /* GL_EXT_blend_minmax */
+
+#ifndef GL_EXT_buffer_storage
+#define GL_EXT_buffer_storage 1
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_PERSISTENT_BIT_EXT 0x0040
+#define GL_MAP_COHERENT_BIT_EXT 0x0080
+#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100
+#define GL_CLIENT_STORAGE_BIT_EXT 0x0200
+#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000
+#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F
+#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
+#endif
+#endif /* GL_EXT_buffer_storage */
+
+#ifndef GL_EXT_clear_texture
+#define GL_EXT_clear_texture 1
+typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
+typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
+GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
+#endif
+#endif /* GL_EXT_clear_texture */
+
+#ifndef GL_EXT_clip_control
+#define GL_EXT_clip_control 1
+#define GL_LOWER_LEFT_EXT 0x8CA1
+#define GL_UPPER_LEFT_EXT 0x8CA2
+#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E
+#define GL_ZERO_TO_ONE_EXT 0x935F
+#define GL_CLIP_ORIGIN_EXT 0x935C
+#define GL_CLIP_DEPTH_MODE_EXT 0x935D
+typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth);
+#endif
+#endif /* GL_EXT_clip_control */
+
+#ifndef GL_EXT_clip_cull_distance
+#define GL_EXT_clip_cull_distance 1
+#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32
+#define GL_MAX_CULL_DISTANCES_EXT 0x82F9
+#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA
+#define GL_CLIP_DISTANCE0_EXT 0x3000
+#define GL_CLIP_DISTANCE1_EXT 0x3001
+#define GL_CLIP_DISTANCE2_EXT 0x3002
+#define GL_CLIP_DISTANCE3_EXT 0x3003
+#define GL_CLIP_DISTANCE4_EXT 0x3004
+#define GL_CLIP_DISTANCE5_EXT 0x3005
+#define GL_CLIP_DISTANCE6_EXT 0x3006
+#define GL_CLIP_DISTANCE7_EXT 0x3007
+#endif /* GL_EXT_clip_cull_distance */
+
+#ifndef GL_EXT_color_buffer_float
+#define GL_EXT_color_buffer_float 1
+#endif /* GL_EXT_color_buffer_float */
+
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_EXT_color_buffer_half_float 1
+#define GL_RGBA16F_EXT 0x881A
+#define GL_RGB16F_EXT 0x881B
+#define GL_RG16F_EXT 0x822F
+#define GL_R16F_EXT 0x822D
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
+#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
+#endif /* GL_EXT_color_buffer_half_float */
+
+#ifndef GL_EXT_conservative_depth
+#define GL_EXT_conservative_depth 1
+#endif /* GL_EXT_conservative_depth */
+
+#ifndef GL_EXT_copy_image
+#define GL_EXT_copy_image 1
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+#endif /* GL_EXT_copy_image */
+
+#ifndef GL_EXT_debug_label
+#define GL_EXT_debug_label 1
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
+#define GL_PROGRAM_OBJECT_EXT 0x8B40
+#define GL_SHADER_OBJECT_EXT 0x8B48
+#define GL_BUFFER_OBJECT_EXT 0x9151
+#define GL_QUERY_OBJECT_EXT 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+#endif /* GL_EXT_debug_label */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+#endif /* GL_EXT_debug_marker */
+
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+#endif /* GL_EXT_discard_framebuffer */
+
+#ifndef GL_EXT_disjoint_timer_query
+#define GL_EXT_disjoint_timer_query 1
+#define GL_QUERY_COUNTER_BITS_EXT 0x8864
+#define GL_CURRENT_QUERY_EXT 0x8865
+#define GL_QUERY_RESULT_EXT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
+#define GL_TIME_ELAPSED_EXT 0x88BF
+#define GL_TIMESTAMP_EXT 0x8E28
+#define GL_GPU_DISJOINT_EXT 0x8FBB
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
+#endif
+#endif /* GL_EXT_disjoint_timer_query */
+
+#ifndef GL_EXT_draw_buffers
+#define GL_EXT_draw_buffers 1
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
+#define GL_DRAW_BUFFER0_EXT 0x8825
+#define GL_DRAW_BUFFER1_EXT 0x8826
+#define GL_DRAW_BUFFER2_EXT 0x8827
+#define GL_DRAW_BUFFER3_EXT 0x8828
+#define GL_DRAW_BUFFER4_EXT 0x8829
+#define GL_DRAW_BUFFER5_EXT 0x882A
+#define GL_DRAW_BUFFER6_EXT 0x882B
+#define GL_DRAW_BUFFER7_EXT 0x882C
+#define GL_DRAW_BUFFER8_EXT 0x882D
+#define GL_DRAW_BUFFER9_EXT 0x882E
+#define GL_DRAW_BUFFER10_EXT 0x882F
+#define GL_DRAW_BUFFER11_EXT 0x8830
+#define GL_DRAW_BUFFER12_EXT 0x8831
+#define GL_DRAW_BUFFER13_EXT 0x8832
+#define GL_DRAW_BUFFER14_EXT 0x8833
+#define GL_DRAW_BUFFER15_EXT 0x8834
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_EXT_draw_buffers */
+
+#ifndef GL_EXT_draw_buffers_indexed
+#define GL_EXT_draw_buffers_indexed 1
+typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index);
+#endif
+#endif /* GL_EXT_draw_buffers_indexed */
+
+#ifndef GL_EXT_draw_elements_base_vertex
+#define GL_EXT_draw_elements_base_vertex 1
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+#endif
+#endif /* GL_EXT_draw_elements_base_vertex */
+
+#ifndef GL_EXT_draw_instanced
+#define GL_EXT_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_draw_instanced */
+
+#ifndef GL_EXT_draw_transform_feedback
+#define GL_EXT_draw_transform_feedback 1
+typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id);
+typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id);
+GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount);
+#endif
+#endif /* GL_EXT_draw_transform_feedback */
+
+#ifndef GL_EXT_external_buffer
+#define GL_EXT_external_buffer 1
+typedef void *GLeglClientBufferEXT;
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+#endif
+#endif /* GL_EXT_external_buffer */
+
+#ifndef GL_EXT_float_blend
+#define GL_EXT_float_blend 1
+#endif /* GL_EXT_float_blend */
+
+#ifndef GL_EXT_geometry_point_size
+#define GL_EXT_geometry_point_size 1
+#endif /* GL_EXT_geometry_point_size */
+
+#ifndef GL_EXT_geometry_shader
+#define GL_EXT_geometry_shader 1
+#define GL_GEOMETRY_SHADER_EXT 0x8DD9
+#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004
+#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916
+#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917
+#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F
+#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E
+#define GL_LINES_ADJACENCY_EXT 0x000A
+#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
+#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_UNDEFINED_VERTEX_EXT 0x8260
+#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+#endif /* GL_EXT_geometry_shader */
+
+#ifndef GL_EXT_gpu_shader5
+#define GL_EXT_gpu_shader5 1
+#endif /* GL_EXT_gpu_shader5 */
+
+#ifndef GL_EXT_instanced_arrays
+#define GL_EXT_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_EXT_instanced_arrays */
+
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#define GL_MAP_READ_BIT_EXT 0x0001
+#define GL_MAP_WRITE_BIT_EXT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+#endif /* GL_EXT_map_buffer_range */
+
+#ifndef GL_EXT_memory_object
+#define GL_EXT_memory_object 1
+#define GL_TEXTURE_TILING_EXT 0x9580
+#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581
+#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B
+#define GL_NUM_TILING_TYPES_EXT 0x9582
+#define GL_TILING_TYPES_EXT 0x9583
+#define GL_OPTIMAL_TILING_EXT 0x9584
+#define GL_LINEAR_TILING_EXT 0x9585
+#define GL_NUM_DEVICE_UUIDS_EXT 0x9596
+#define GL_DEVICE_UUID_EXT 0x9597
+#define GL_DRIVER_UUID_EXT 0x9598
+#define GL_UUID_SIZE_EXT 16
+typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data);
+typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data);
+typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects);
+typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject);
+typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects);
+typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data);
+GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data);
+GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects);
+GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject);
+GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects);
+GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
+#endif
+#endif /* GL_EXT_memory_object */
+
+#ifndef GL_EXT_memory_object_fd
+#define GL_EXT_memory_object_fd 1
+#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
+#endif
+#endif /* GL_EXT_memory_object_fd */
+
+#ifndef GL_EXT_memory_object_win32
+#define GL_EXT_memory_object_win32 1
+#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587
+#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588
+#define GL_DEVICE_LUID_EXT 0x9599
+#define GL_DEVICE_NODE_MASK_EXT 0x959A
+#define GL_LUID_SIZE_EXT 8
+#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589
+#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A
+#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B
+#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
+GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
+#endif
+#endif /* GL_EXT_memory_object_win32 */
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_multi_draw_arrays */
+
+#ifndef GL_EXT_multi_draw_indirect
+#define GL_EXT_multi_draw_indirect 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
+#endif
+#endif /* GL_EXT_multi_draw_indirect */
+
+#ifndef GL_EXT_multisampled_compatibility
+#define GL_EXT_multisampled_compatibility 1
+#define GL_MULTISAMPLE_EXT 0x809D
+#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
+#endif /* GL_EXT_multisampled_compatibility */
+
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_EXT_multisampled_render_to_texture */
+
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_EXT_multiview_draw_buffers 1
+#define GL_COLOR_ATTACHMENT_EXT 0x90F0
+#define GL_MULTIVIEW_EXT 0x90F1
+#define GL_DRAW_BUFFER_EXT 0x0C01
+#define GL_READ_BUFFER_EXT 0x0C02
+#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
+typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
+GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
+#endif
+#endif /* GL_EXT_multiview_draw_buffers */
+
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_EXT_occlusion_query_boolean 1
+#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
+#endif /* GL_EXT_occlusion_query_boolean */
+
+#ifndef GL_EXT_polygon_offset_clamp
+#define GL_EXT_polygon_offset_clamp 1
+#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp);
+#endif
+#endif /* GL_EXT_polygon_offset_clamp */
+
+#ifndef GL_EXT_post_depth_coverage
+#define GL_EXT_post_depth_coverage 1
+#endif /* GL_EXT_post_depth_coverage */
+
+#ifndef GL_EXT_primitive_bounding_box
+#define GL_EXT_primitive_bounding_box 1
+#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#endif
+#endif /* GL_EXT_primitive_bounding_box */
+
+#ifndef GL_EXT_protected_textures
+#define GL_EXT_protected_textures 1
+#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010
+#define GL_TEXTURE_PROTECTED_EXT 0x8BFA
+#endif /* GL_EXT_protected_textures */
+
+#ifndef GL_EXT_pvrtc_sRGB
+#define GL_EXT_pvrtc_sRGB 1
+#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
+#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
+#endif /* GL_EXT_pvrtc_sRGB */
+
+#ifndef GL_EXT_raster_multisample
+#define GL_EXT_raster_multisample 1
+#define GL_RASTER_MULTISAMPLE_EXT 0x9327
+#define GL_RASTER_SAMPLES_EXT 0x9328
+#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
+#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
+#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
+#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
+typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_EXT_raster_multisample */
+
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif /* GL_EXT_read_format_bgra */
+
+#ifndef GL_EXT_render_snorm
+#define GL_EXT_render_snorm 1
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_R16_SNORM_EXT 0x8F98
+#define GL_RG16_SNORM_EXT 0x8F99
+#define GL_RGBA16_SNORM_EXT 0x8F9B
+#endif /* GL_EXT_render_snorm */
+
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_EXT_robustness */
+
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+#endif /* GL_EXT_sRGB */
+
+#ifndef GL_EXT_sRGB_write_control
+#define GL_EXT_sRGB_write_control 1
+#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
+#endif /* GL_EXT_sRGB_write_control */
+
+#ifndef GL_EXT_semaphore
+#define GL_EXT_semaphore 1
+#define GL_LAYOUT_GENERAL_EXT 0x958D
+#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E
+#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F
+#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590
+#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591
+#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592
+#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593
+typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores);
+typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores);
+typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore);
+typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
+typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores);
+GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores);
+GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore);
+GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params);
+GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params);
+GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
+GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
+#endif
+#endif /* GL_EXT_semaphore */
+
+#ifndef GL_EXT_semaphore_fd
+#define GL_EXT_semaphore_fd 1
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd);
+#endif
+#endif /* GL_EXT_semaphore_fd */
+
+#ifndef GL_EXT_semaphore_win32
+#define GL_EXT_semaphore_win32 1
+#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594
+#define GL_D3D12_FENCE_VALUE_EXT 0x9595
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle);
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle);
+GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name);
+#endif
+#endif /* GL_EXT_semaphore_win32 */
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#define GL_ACTIVE_PROGRAM_EXT 0x8259
+#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
+#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE_EXT 0x8258
+#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_EXT_separate_shader_objects */
+
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_EXT_shader_framebuffer_fetch 1
+#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+#endif /* GL_EXT_shader_framebuffer_fetch */
+
+#ifndef GL_EXT_shader_group_vote
+#define GL_EXT_shader_group_vote 1
+#endif /* GL_EXT_shader_group_vote */
+
+#ifndef GL_EXT_shader_implicit_conversions
+#define GL_EXT_shader_implicit_conversions 1
+#endif /* GL_EXT_shader_implicit_conversions */
+
+#ifndef GL_EXT_shader_integer_mix
+#define GL_EXT_shader_integer_mix 1
+#endif /* GL_EXT_shader_integer_mix */
+
+#ifndef GL_EXT_shader_io_blocks
+#define GL_EXT_shader_io_blocks 1
+#endif /* GL_EXT_shader_io_blocks */
+
+#ifndef GL_EXT_shader_non_constant_global_initializers
+#define GL_EXT_shader_non_constant_global_initializers 1
+#endif /* GL_EXT_shader_non_constant_global_initializers */
+
+#ifndef GL_EXT_shader_pixel_local_storage
+#define GL_EXT_shader_pixel_local_storage 1
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
+#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
+#endif /* GL_EXT_shader_pixel_local_storage */
+
+#ifndef GL_EXT_shader_pixel_local_storage2
+#define GL_EXT_shader_pixel_local_storage2 1
+#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650
+#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651
+#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size);
+typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target);
+typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size);
+GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target);
+GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values);
+#endif
+#endif /* GL_EXT_shader_pixel_local_storage2 */
+
+#ifndef GL_EXT_shader_texture_lod
+#define GL_EXT_shader_texture_lod 1
+#endif /* GL_EXT_shader_texture_lod */
+
+#ifndef GL_EXT_shadow_samplers
+#define GL_EXT_shadow_samplers 1
+#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
+#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
+#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
+#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
+#endif /* GL_EXT_shadow_samplers */
+
+#ifndef GL_EXT_sparse_texture
+#define GL_EXT_sparse_texture 1
+#define GL_TEXTURE_SPARSE_EXT 0x91A6
+#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7
+#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA
+#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8
+#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195
+#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196
+#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_3D 0x806F
+#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198
+#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199
+#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A
+#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9
+typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
+#endif
+#endif /* GL_EXT_sparse_texture */
+
+#ifndef GL_EXT_sparse_texture2
+#define GL_EXT_sparse_texture2 1
+#endif /* GL_EXT_sparse_texture2 */
+
+#ifndef GL_EXT_tessellation_point_size
+#define GL_EXT_tessellation_point_size 1
+#endif /* GL_EXT_tessellation_point_size */
+
+#ifndef GL_EXT_tessellation_shader
+#define GL_EXT_tessellation_shader 1
+#define GL_PATCHES_EXT 0x000E
+#define GL_PATCH_VERTICES_EXT 0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75
+#define GL_TESS_GEN_MODE_EXT 0x8E76
+#define GL_TESS_GEN_SPACING_EXT 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78
+#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79
+#define GL_ISOLINES_EXT 0x8E7A
+#define GL_QUADS_EXT 0x0007
+#define GL_FRACTIONAL_ODD_EXT 0x8E7B
+#define GL_FRACTIONAL_EVEN_EXT 0x8E7C
+#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
+#define GL_IS_PER_PATCH_EXT 0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308
+#define GL_TESS_CONTROL_SHADER_EXT 0x8E88
+#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value);
+#endif
+#endif /* GL_EXT_tessellation_shader */
+
+#ifndef GL_EXT_texture_border_clamp
+#define GL_EXT_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004
+#define GL_CLAMP_TO_BORDER_EXT 0x812D
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+#endif /* GL_EXT_texture_border_clamp */
+
+#ifndef GL_EXT_texture_buffer
+#define GL_EXT_texture_buffer 1
+#define GL_TEXTURE_BUFFER_EXT 0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F
+#define GL_SAMPLER_BUFFER_EXT 0x8DC2
+#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
+#define GL_IMAGE_BUFFER_EXT 0x9051
+#define GL_INT_IMAGE_BUFFER_EXT 0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
+#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D
+#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E
+typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+#endif /* GL_EXT_texture_buffer */
+
+#ifndef GL_EXT_texture_compression_astc_decode_mode
+#define GL_EXT_texture_compression_astc_decode_mode 1
+#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69
+#endif /* GL_EXT_texture_compression_astc_decode_mode */
+
+#ifndef GL_EXT_texture_compression_bptc
+#define GL_EXT_texture_compression_bptc 1
+#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C
+#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D
+#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E
+#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F
+#endif /* GL_EXT_texture_compression_bptc */
+
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif /* GL_EXT_texture_compression_dxt1 */
+
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_EXT_texture_compression_rgtc 1
+#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
+#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
+#endif /* GL_EXT_texture_compression_rgtc */
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif /* GL_EXT_texture_compression_s3tc */
+
+#ifndef GL_EXT_texture_compression_s3tc_srgb
+#define GL_EXT_texture_compression_s3tc_srgb 1
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif /* GL_EXT_texture_compression_s3tc_srgb */
+
+#ifndef GL_EXT_texture_cube_map_array
+#define GL_EXT_texture_cube_map_array 1
+#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
+#endif /* GL_EXT_texture_cube_map_array */
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif /* GL_EXT_texture_filter_anisotropic */
+
+#ifndef GL_EXT_texture_filter_minmax
+#define GL_EXT_texture_filter_minmax 1
+#endif /* GL_EXT_texture_filter_minmax */
+
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif /* GL_EXT_texture_format_BGRA8888 */
+
+#ifndef GL_EXT_texture_norm16
+#define GL_EXT_texture_norm16 1
+#define GL_R16_EXT 0x822A
+#define GL_RG16_EXT 0x822C
+#define GL_RGBA16_EXT 0x805B
+#define GL_RGB16_EXT 0x8054
+#define GL_RGB16_SNORM_EXT 0x8F9A
+#endif /* GL_EXT_texture_norm16 */
+
+#ifndef GL_EXT_texture_rg
+#define GL_EXT_texture_rg 1
+#define GL_RED_EXT 0x1903
+#define GL_RG_EXT 0x8227
+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#endif /* GL_EXT_texture_rg */
+
+#ifndef GL_EXT_texture_sRGB_R8
+#define GL_EXT_texture_sRGB_R8 1
+#define GL_SR8_EXT 0x8FBD
+#endif /* GL_EXT_texture_sRGB_R8 */
+
+#ifndef GL_EXT_texture_sRGB_RG8
+#define GL_EXT_texture_sRGB_RG8 1
+#define GL_SRG8_EXT 0x8FBE
+#endif /* GL_EXT_texture_sRGB_RG8 */
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
+#define GL_DECODE_EXT 0x8A49
+#define GL_SKIP_DECODE_EXT 0x8A4A
+#endif /* GL_EXT_texture_sRGB_decode */
+
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
+#define GL_ALPHA8_EXT 0x803C
+#define GL_LUMINANCE8_EXT 0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+#define GL_RGBA32F_EXT 0x8814
+#define GL_RGB32F_EXT 0x8815
+#define GL_ALPHA32F_EXT 0x8816
+#define GL_LUMINANCE32F_EXT 0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
+#define GL_ALPHA16F_EXT 0x881C
+#define GL_LUMINANCE16F_EXT 0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
+#define GL_R32F_EXT 0x822E
+#define GL_RG32F_EXT 0x8230
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* GL_EXT_texture_storage */
+
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif /* GL_EXT_texture_type_2_10_10_10_REV */
+
+#ifndef GL_EXT_texture_view
+#define GL_EXT_texture_view 1
+#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE
+typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+#endif /* GL_EXT_texture_view */
+
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
+#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
+#endif /* GL_EXT_unpack_subimage */
+
+#ifndef GL_EXT_win32_keyed_mutex
+#define GL_EXT_win32_keyed_mutex 1
+typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout);
+typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout);
+GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key);
+#endif
+#endif /* GL_EXT_win32_keyed_mutex */
+
+#ifndef GL_EXT_window_rectangles
+#define GL_EXT_window_rectangles 1
+#define GL_INCLUSIVE_EXT 0x8F10
+#define GL_EXCLUSIVE_EXT 0x8F11
+#define GL_WINDOW_RECTANGLE_EXT 0x8F12
+#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
+#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
+#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
+typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
+#endif
+#endif /* GL_EXT_window_rectangles */
+
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
+#endif /* GL_FJ_shader_binary_GCCSO */
+
+#ifndef GL_IMG_bindless_texture
+#define GL_IMG_bindless_texture 1
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture);
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture);
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler);
+GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+#endif
+#endif /* GL_IMG_bindless_texture */
+
+#ifndef GL_IMG_framebuffer_downsample
+#define GL_IMG_framebuffer_downsample 1
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C
+#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D
+#define GL_DOWNSAMPLE_SCALES_IMG 0x913E
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
+#endif
+#endif /* GL_IMG_framebuffer_downsample */
+
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG 0x9135
+#define GL_TEXTURE_SAMPLES_IMG 0x9136
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_IMG_multisampled_render_to_texture */
+
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+#endif /* GL_IMG_program_binary */
+
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif /* GL_IMG_read_format */
+
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif /* GL_IMG_shader_binary */
+
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif /* GL_IMG_texture_compression_pvrtc */
+
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_IMG_texture_compression_pvrtc2 1
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+#endif /* GL_IMG_texture_compression_pvrtc2 */
+
+#ifndef GL_IMG_texture_filter_cubic
+#define GL_IMG_texture_filter_cubic 1
+#define GL_CUBIC_IMG 0x9139
+#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A
+#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B
+#endif /* GL_IMG_texture_filter_cubic */
+
+#ifndef GL_INTEL_conservative_rasterization
+#define GL_INTEL_conservative_rasterization 1
+#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
+#endif /* GL_INTEL_conservative_rasterization */
+
+#ifndef GL_INTEL_framebuffer_CMAA
+#define GL_INTEL_framebuffer_CMAA 1
+typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void);
+#endif
+#endif /* GL_INTEL_framebuffer_CMAA */
+
+#ifndef GL_INTEL_performance_query
+#define GL_INTEL_performance_query 1
+#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
+#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
+#define GL_PERFQUERY_WAIT_INTEL 0x83FB
+#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
+#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
+#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
+#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
+#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
+#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
+#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
+#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
+#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
+#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
+#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
+#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
+#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
+#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
+#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
+#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
+#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
+typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
+GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
+GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
+GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#endif
+#endif /* GL_INTEL_performance_query */
+
+#ifndef GL_MESA_shader_integer_functions
+#define GL_MESA_shader_integer_functions 1
+#endif /* GL_MESA_shader_integer_functions */
+
+#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers
+#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1
+#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */
+
+#ifndef GL_NV_bindless_texture
+#define GL_NV_bindless_texture 1
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
+typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
+typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
+typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
+typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
+typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture);
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
+GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
+GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
+GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
+GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
+GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
+GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
+GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
+#endif
+#endif /* GL_NV_bindless_texture */
+
+#ifndef GL_NV_blend_equation_advanced
+#define GL_NV_blend_equation_advanced 1
+#define GL_BLEND_OVERLAP_NV 0x9281
+#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
+#define GL_BLUE_NV 0x1905
+#define GL_COLORBURN_NV 0x929A
+#define GL_COLORDODGE_NV 0x9299
+#define GL_CONJOINT_NV 0x9284
+#define GL_CONTRAST_NV 0x92A1
+#define GL_DARKEN_NV 0x9297
+#define GL_DIFFERENCE_NV 0x929E
+#define GL_DISJOINT_NV 0x9283
+#define GL_DST_ATOP_NV 0x928F
+#define GL_DST_IN_NV 0x928B
+#define GL_DST_NV 0x9287
+#define GL_DST_OUT_NV 0x928D
+#define GL_DST_OVER_NV 0x9289
+#define GL_EXCLUSION_NV 0x92A0
+#define GL_GREEN_NV 0x1904
+#define GL_HARDLIGHT_NV 0x929B
+#define GL_HARDMIX_NV 0x92A9
+#define GL_HSL_COLOR_NV 0x92AF
+#define GL_HSL_HUE_NV 0x92AD
+#define GL_HSL_LUMINOSITY_NV 0x92B0
+#define GL_HSL_SATURATION_NV 0x92AE
+#define GL_INVERT_OVG_NV 0x92B4
+#define GL_INVERT_RGB_NV 0x92A3
+#define GL_LIGHTEN_NV 0x9298
+#define GL_LINEARBURN_NV 0x92A5
+#define GL_LINEARDODGE_NV 0x92A4
+#define GL_LINEARLIGHT_NV 0x92A7
+#define GL_MINUS_CLAMPED_NV 0x92B3
+#define GL_MINUS_NV 0x929F
+#define GL_MULTIPLY_NV 0x9294
+#define GL_OVERLAY_NV 0x9296
+#define GL_PINLIGHT_NV 0x92A8
+#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
+#define GL_PLUS_CLAMPED_NV 0x92B1
+#define GL_PLUS_DARKER_NV 0x9292
+#define GL_PLUS_NV 0x9291
+#define GL_RED_NV 0x1903
+#define GL_SCREEN_NV 0x9295
+#define GL_SOFTLIGHT_NV 0x929C
+#define GL_SRC_ATOP_NV 0x928E
+#define GL_SRC_IN_NV 0x928A
+#define GL_SRC_NV 0x9286
+#define GL_SRC_OUT_NV 0x928C
+#define GL_SRC_OVER_NV 0x9288
+#define GL_UNCORRELATED_NV 0x9282
+#define GL_VIVIDLIGHT_NV 0x92A6
+#define GL_XOR_NV 0x1506
+typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
+#endif
+#endif /* GL_NV_blend_equation_advanced */
+
+#ifndef GL_NV_blend_equation_advanced_coherent
+#define GL_NV_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
+#endif /* GL_NV_blend_equation_advanced_coherent */
+
+#ifndef GL_NV_blend_minmax_factor
+#define GL_NV_blend_minmax_factor 1
+#define GL_FACTOR_MIN_AMD 0x901C
+#define GL_FACTOR_MAX_AMD 0x901D
+#endif /* GL_NV_blend_minmax_factor */
+
+#ifndef GL_NV_conditional_render
+#define GL_NV_conditional_render 1
+#define GL_QUERY_WAIT_NV 0x8E13
+#define GL_QUERY_NO_WAIT_NV 0x8E14
+#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
+#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
+typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
+GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void);
+#endif
+#endif /* GL_NV_conditional_render */
+
+#ifndef GL_NV_conservative_raster
+#define GL_NV_conservative_raster 1
+#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
+#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
+#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
+#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
+typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits);
+#endif
+#endif /* GL_NV_conservative_raster */
+
+#ifndef GL_NV_conservative_raster_pre_snap_triangles
+#define GL_NV_conservative_raster_pre_snap_triangles 1
+#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
+#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
+#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
+typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
+#endif
+#endif /* GL_NV_conservative_raster_pre_snap_triangles */
+
+#ifndef GL_NV_copy_buffer
+#define GL_NV_copy_buffer 1
+#define GL_COPY_READ_BUFFER_NV 0x8F36
+#define GL_COPY_WRITE_BUFFER_NV 0x8F37
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+#endif /* GL_NV_copy_buffer */
+
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+#endif /* GL_NV_coverage_sample */
+
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif /* GL_NV_depth_nonlinear */
+
+#ifndef GL_NV_draw_buffers
+#define GL_NV_draw_buffers 1
+#define GL_MAX_DRAW_BUFFERS_NV 0x8824
+#define GL_DRAW_BUFFER0_NV 0x8825
+#define GL_DRAW_BUFFER1_NV 0x8826
+#define GL_DRAW_BUFFER2_NV 0x8827
+#define GL_DRAW_BUFFER3_NV 0x8828
+#define GL_DRAW_BUFFER4_NV 0x8829
+#define GL_DRAW_BUFFER5_NV 0x882A
+#define GL_DRAW_BUFFER6_NV 0x882B
+#define GL_DRAW_BUFFER7_NV 0x882C
+#define GL_DRAW_BUFFER8_NV 0x882D
+#define GL_DRAW_BUFFER9_NV 0x882E
+#define GL_DRAW_BUFFER10_NV 0x882F
+#define GL_DRAW_BUFFER11_NV 0x8830
+#define GL_DRAW_BUFFER12_NV 0x8831
+#define GL_DRAW_BUFFER13_NV 0x8832
+#define GL_DRAW_BUFFER14_NV 0x8833
+#define GL_DRAW_BUFFER15_NV 0x8834
+#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
+#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
+#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
+#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
+#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
+#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
+#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
+#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
+#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
+#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
+#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
+#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
+#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
+#define GL_COLOR_ATTACHMENT13_NV 0x8CED
+#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
+#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_NV_draw_buffers */
+
+#ifndef GL_NV_draw_instanced
+#define GL_NV_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_NV_draw_instanced */
+
+#ifndef GL_NV_draw_vulkan_image
+#define GL_NV_draw_vulkan_image 1
+typedef void (GL_APIENTRY *GLVULKANPROCNV)(void);
+typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
+typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
+typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
+typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
+GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name);
+GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
+GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
+GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
+#endif
+#endif /* GL_NV_draw_vulkan_image */
+
+#ifndef GL_NV_explicit_attrib_location
+#define GL_NV_explicit_attrib_location 1
+#endif /* GL_NV_explicit_attrib_location */
+
+#ifndef GL_NV_fbo_color_attachments
+#define GL_NV_fbo_color_attachments 1
+#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
+#endif /* GL_NV_fbo_color_attachments */
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif
+#endif /* GL_NV_fence */
+
+#ifndef GL_NV_fill_rectangle
+#define GL_NV_fill_rectangle 1
+#define GL_FILL_RECTANGLE_NV 0x933C
+#endif /* GL_NV_fill_rectangle */
+
+#ifndef GL_NV_fragment_coverage_to_color
+#define GL_NV_fragment_coverage_to_color 1
+#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD
+#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE
+typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color);
+#endif
+#endif /* GL_NV_fragment_coverage_to_color */
+
+#ifndef GL_NV_fragment_shader_interlock
+#define GL_NV_fragment_shader_interlock 1
+#endif /* GL_NV_fragment_shader_interlock */
+
+#ifndef GL_NV_framebuffer_blit
+#define GL_NV_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_NV 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_NV_framebuffer_blit */
+
+#ifndef GL_NV_framebuffer_mixed_samples
+#define GL_NV_framebuffer_mixed_samples 1
+#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
+#define GL_COLOR_SAMPLES_NV 0x8E20
+#define GL_DEPTH_SAMPLES_NV 0x932D
+#define GL_STENCIL_SAMPLES_NV 0x932E
+#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
+#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
+#define GL_COVERAGE_MODULATION_NV 0x9332
+#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v);
+GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components);
+#endif
+#endif /* GL_NV_framebuffer_mixed_samples */
+
+#ifndef GL_NV_framebuffer_multisample
+#define GL_NV_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+#define GL_MAX_SAMPLES_NV 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_NV_framebuffer_multisample */
+
+#ifndef GL_NV_generate_mipmap_sRGB
+#define GL_NV_generate_mipmap_sRGB 1
+#endif /* GL_NV_generate_mipmap_sRGB */
+
+#ifndef GL_NV_geometry_shader_passthrough
+#define GL_NV_geometry_shader_passthrough 1
+#endif /* GL_NV_geometry_shader_passthrough */
+
+#ifndef GL_NV_gpu_shader5
+#define GL_NV_gpu_shader5 1
+typedef khronos_int64_t GLint64EXT;
+typedef khronos_uint64_t GLuint64EXT;
+#define GL_INT64_NV 0x140E
+#define GL_UNSIGNED_INT64_NV 0x140F
+#define GL_INT8_NV 0x8FE0
+#define GL_INT8_VEC2_NV 0x8FE1
+#define GL_INT8_VEC3_NV 0x8FE2
+#define GL_INT8_VEC4_NV 0x8FE3
+#define GL_INT16_NV 0x8FE4
+#define GL_INT16_VEC2_NV 0x8FE5
+#define GL_INT16_VEC3_NV 0x8FE6
+#define GL_INT16_VEC4_NV 0x8FE7
+#define GL_INT64_VEC2_NV 0x8FE9
+#define GL_INT64_VEC3_NV 0x8FEA
+#define GL_INT64_VEC4_NV 0x8FEB
+#define GL_UNSIGNED_INT8_NV 0x8FEC
+#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
+#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
+#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
+#define GL_UNSIGNED_INT16_NV 0x8FF0
+#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
+#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
+#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
+#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
+#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
+#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
+#define GL_FLOAT16_NV 0x8FF8
+#define GL_FLOAT16_VEC2_NV 0x8FF9
+#define GL_FLOAT16_VEC3_NV 0x8FFA
+#define GL_FLOAT16_VEC4_NV 0x8FFB
+#define GL_PATCHES 0x000E
+typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
+GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
+GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
+GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
+GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
+GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif
+#endif /* GL_NV_gpu_shader5 */
+
+#ifndef GL_NV_image_formats
+#define GL_NV_image_formats 1
+#endif /* GL_NV_image_formats */
+
+#ifndef GL_NV_instanced_arrays
+#define GL_NV_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_NV_instanced_arrays */
+
+#ifndef GL_NV_internalformat_sample_query
+#define GL_NV_internalformat_sample_query 1
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_MULTISAMPLES_NV 0x9371
+#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372
+#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373
+#define GL_CONFORMANT_NV 0x9374
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_NV_internalformat_sample_query */
+
+#ifndef GL_NV_non_square_matrices
+#define GL_NV_non_square_matrices 1
+#define GL_FLOAT_MAT2x3_NV 0x8B65
+#define GL_FLOAT_MAT2x4_NV 0x8B66
+#define GL_FLOAT_MAT3x2_NV 0x8B67
+#define GL_FLOAT_MAT3x4_NV 0x8B68
+#define GL_FLOAT_MAT4x2_NV 0x8B69
+#define GL_FLOAT_MAT4x3_NV 0x8B6A
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_NV_non_square_matrices */
+
+#ifndef GL_NV_path_rendering
+#define GL_NV_path_rendering 1
+#define GL_PATH_FORMAT_SVG_NV 0x9070
+#define GL_PATH_FORMAT_PS_NV 0x9071
+#define GL_STANDARD_FONT_NAME_NV 0x9072
+#define GL_SYSTEM_FONT_NAME_NV 0x9073
+#define GL_FILE_NAME_NV 0x9074
+#define GL_PATH_STROKE_WIDTH_NV 0x9075
+#define GL_PATH_END_CAPS_NV 0x9076
+#define GL_PATH_INITIAL_END_CAP_NV 0x9077
+#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
+#define GL_PATH_JOIN_STYLE_NV 0x9079
+#define GL_PATH_MITER_LIMIT_NV 0x907A
+#define GL_PATH_DASH_CAPS_NV 0x907B
+#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
+#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
+#define GL_PATH_DASH_OFFSET_NV 0x907E
+#define GL_PATH_CLIENT_LENGTH_NV 0x907F
+#define GL_PATH_FILL_MODE_NV 0x9080
+#define GL_PATH_FILL_MASK_NV 0x9081
+#define GL_PATH_FILL_COVER_MODE_NV 0x9082
+#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
+#define GL_PATH_STROKE_MASK_NV 0x9084
+#define GL_COUNT_UP_NV 0x9088
+#define GL_COUNT_DOWN_NV 0x9089
+#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
+#define GL_CONVEX_HULL_NV 0x908B
+#define GL_BOUNDING_BOX_NV 0x908D
+#define GL_TRANSLATE_X_NV 0x908E
+#define GL_TRANSLATE_Y_NV 0x908F
+#define GL_TRANSLATE_2D_NV 0x9090
+#define GL_TRANSLATE_3D_NV 0x9091
+#define GL_AFFINE_2D_NV 0x9092
+#define GL_AFFINE_3D_NV 0x9094
+#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
+#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
+#define GL_UTF8_NV 0x909A
+#define GL_UTF16_NV 0x909B
+#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
+#define GL_PATH_COMMAND_COUNT_NV 0x909D
+#define GL_PATH_COORD_COUNT_NV 0x909E
+#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
+#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
+#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
+#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
+#define GL_SQUARE_NV 0x90A3
+#define GL_ROUND_NV 0x90A4
+#define GL_TRIANGULAR_NV 0x90A5
+#define GL_BEVEL_NV 0x90A6
+#define GL_MITER_REVERT_NV 0x90A7
+#define GL_MITER_TRUNCATE_NV 0x90A8
+#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
+#define GL_USE_MISSING_GLYPH_NV 0x90AA
+#define GL_PATH_ERROR_POSITION_NV 0x90AB
+#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
+#define GL_ADJACENT_PAIRS_NV 0x90AE
+#define GL_FIRST_TO_REST_NV 0x90AF
+#define GL_PATH_GEN_MODE_NV 0x90B0
+#define GL_PATH_GEN_COEFF_NV 0x90B1
+#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
+#define GL_PATH_STENCIL_FUNC_NV 0x90B7
+#define GL_PATH_STENCIL_REF_NV 0x90B8
+#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
+#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
+#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
+#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
+#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
+#define GL_MOVE_TO_RESETS_NV 0x90B5
+#define GL_MOVE_TO_CONTINUES_NV 0x90B6
+#define GL_CLOSE_PATH_NV 0x00
+#define GL_MOVE_TO_NV 0x02
+#define GL_RELATIVE_MOVE_TO_NV 0x03
+#define GL_LINE_TO_NV 0x04
+#define GL_RELATIVE_LINE_TO_NV 0x05
+#define GL_HORIZONTAL_LINE_TO_NV 0x06
+#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
+#define GL_VERTICAL_LINE_TO_NV 0x08
+#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
+#define GL_QUADRATIC_CURVE_TO_NV 0x0A
+#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
+#define GL_CUBIC_CURVE_TO_NV 0x0C
+#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
+#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
+#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
+#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
+#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
+#define GL_SMALL_CCW_ARC_TO_NV 0x12
+#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
+#define GL_SMALL_CW_ARC_TO_NV 0x14
+#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
+#define GL_LARGE_CCW_ARC_TO_NV 0x16
+#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
+#define GL_LARGE_CW_ARC_TO_NV 0x18
+#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
+#define GL_RESTART_PATH_NV 0xF0
+#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
+#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
+#define GL_RECT_NV 0xF6
+#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
+#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
+#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
+#define GL_ARC_TO_NV 0xFE
+#define GL_RELATIVE_ARC_TO_NV 0xFF
+#define GL_BOLD_BIT_NV 0x01
+#define GL_ITALIC_BIT_NV 0x02
+#define GL_GLYPH_WIDTH_BIT_NV 0x01
+#define GL_GLYPH_HEIGHT_BIT_NV 0x02
+#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
+#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
+#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
+#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
+#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
+#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
+#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
+#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
+#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
+#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
+#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
+#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
+#define GL_FONT_ASCENDER_BIT_NV 0x00200000
+#define GL_FONT_DESCENDER_BIT_NV 0x00400000
+#define GL_FONT_HEIGHT_BIT_NV 0x00800000
+#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
+#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
+#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
+#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
+#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
+#define GL_ROUNDED_RECT_NV 0xE8
+#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
+#define GL_ROUNDED_RECT2_NV 0xEA
+#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
+#define GL_ROUNDED_RECT4_NV 0xEC
+#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
+#define GL_ROUNDED_RECT8_NV 0xEE
+#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
+#define GL_RELATIVE_RECT_NV 0xF7
+#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
+#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
+#define GL_FONT_UNAVAILABLE_NV 0x936A
+#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
+#define GL_CONIC_CURVE_TO_NV 0x1A
+#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
+#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
+#define GL_STANDARD_FONT_FORMAT_NV 0x936C
+#define GL_PATH_PROJECTION_NV 0x1701
+#define GL_PATH_MODELVIEW_NV 0x1700
+#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3
+#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6
+#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36
+#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3
+#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4
+#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7
+#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38
+#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4
+#define GL_FRAGMENT_INPUT_NV 0x936D
+typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
+typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
+typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
+typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
+typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
+typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
+typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
+typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
+typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
+typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
+typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
+typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
+typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
+typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
+typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
+typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
+typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
+typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
+typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
+typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
+typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range);
+GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
+GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path);
+GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString);
+GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
+GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
+GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
+GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
+GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
+GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
+GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func);
+GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
+GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
+GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
+GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
+GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
+GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
+GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
+GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
+GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
+GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
+GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
+GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
+GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
+GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
+GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
+#endif
+#endif /* GL_NV_path_rendering */
+
+#ifndef GL_NV_path_rendering_shared_edge
+#define GL_NV_path_rendering_shared_edge 1
+#define GL_SHARED_EDGE_NV 0xC0
+#endif /* GL_NV_path_rendering_shared_edge */
+
+#ifndef GL_NV_pixel_buffer_object
+#define GL_NV_pixel_buffer_object 1
+#define GL_PIXEL_PACK_BUFFER_NV 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF
+#endif /* GL_NV_pixel_buffer_object */
+
+#ifndef GL_NV_polygon_mode
+#define GL_NV_polygon_mode 1
+#define GL_POLYGON_MODE_NV 0x0B40
+#define GL_POLYGON_OFFSET_POINT_NV 0x2A01
+#define GL_POLYGON_OFFSET_LINE_NV 0x2A02
+#define GL_POINT_NV 0x1B00
+#define GL_LINE_NV 0x1B01
+#define GL_FILL_NV 0x1B02
+typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode);
+#endif
+#endif /* GL_NV_polygon_mode */
+
+#ifndef GL_NV_read_buffer
+#define GL_NV_read_buffer 1
+#define GL_READ_BUFFER_NV 0x0C02
+typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
+#endif
+#endif /* GL_NV_read_buffer */
+
+#ifndef GL_NV_read_buffer_front
+#define GL_NV_read_buffer_front 1
+#endif /* GL_NV_read_buffer_front */
+
+#ifndef GL_NV_read_depth
+#define GL_NV_read_depth 1
+#endif /* GL_NV_read_depth */
+
+#ifndef GL_NV_read_depth_stencil
+#define GL_NV_read_depth_stencil 1
+#endif /* GL_NV_read_depth_stencil */
+
+#ifndef GL_NV_read_stencil
+#define GL_NV_read_stencil 1
+#endif /* GL_NV_read_stencil */
+
+#ifndef GL_NV_sRGB_formats
+#define GL_NV_sRGB_formats 1
+#define GL_SLUMINANCE_NV 0x8C46
+#define GL_SLUMINANCE_ALPHA_NV 0x8C44
+#define GL_SRGB8_NV 0x8C41
+#define GL_SLUMINANCE8_NV 0x8C47
+#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
+#define GL_ETC1_SRGB8_NV 0x88EE
+#endif /* GL_NV_sRGB_formats */
+
+#ifndef GL_NV_sample_locations
+#define GL_NV_sample_locations 1
+#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
+#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E
+#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F
+#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340
+#define GL_SAMPLE_LOCATION_NV 0x8E50
+#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341
+#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342
+#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void);
+#endif
+#endif /* GL_NV_sample_locations */
+
+#ifndef GL_NV_sample_mask_override_coverage
+#define GL_NV_sample_mask_override_coverage 1
+#endif /* GL_NV_sample_mask_override_coverage */
+
+#ifndef GL_NV_shader_atomic_fp16_vector
+#define GL_NV_shader_atomic_fp16_vector 1
+#endif /* GL_NV_shader_atomic_fp16_vector */
+
+#ifndef GL_NV_shader_noperspective_interpolation
+#define GL_NV_shader_noperspective_interpolation 1
+#endif /* GL_NV_shader_noperspective_interpolation */
+
+#ifndef GL_NV_shadow_samplers_array
+#define GL_NV_shadow_samplers_array 1
+#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
+#endif /* GL_NV_shadow_samplers_array */
+
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_NV_shadow_samplers_cube 1
+#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
+#endif /* GL_NV_shadow_samplers_cube */
+
+#ifndef GL_NV_texture_border_clamp
+#define GL_NV_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
+#define GL_CLAMP_TO_BORDER_NV 0x812D
+#endif /* GL_NV_texture_border_clamp */
+
+#ifndef GL_NV_texture_compression_s3tc_update
+#define GL_NV_texture_compression_s3tc_update 1
+#endif /* GL_NV_texture_compression_s3tc_update */
+
+#ifndef GL_NV_texture_npot_2D_mipmap
+#define GL_NV_texture_npot_2D_mipmap 1
+#endif /* GL_NV_texture_npot_2D_mipmap */
+
+#ifndef GL_NV_viewport_array
+#define GL_NV_viewport_array 1
+#define GL_MAX_VIEWPORTS_NV 0x825B
+#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C
+#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F
+typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v);
+GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data);
+GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index);
+#endif
+#endif /* GL_NV_viewport_array */
+
+#ifndef GL_NV_viewport_array2
+#define GL_NV_viewport_array2 1
+#endif /* GL_NV_viewport_array2 */
+
+#ifndef GL_NV_viewport_swizzle
+#define GL_NV_viewport_swizzle 1
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
+#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
+#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
+#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
+#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
+typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
+#endif
+#endif /* GL_NV_viewport_swizzle */
+
+#ifndef GL_OVR_multiview
+#define GL_OVR_multiview 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
+#define GL_MAX_VIEWS_OVR 0x9631
+#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+#endif
+#endif /* GL_OVR_multiview */
+
+#ifndef GL_OVR_multiview2
+#define GL_OVR_multiview2 1
+#endif /* GL_OVR_multiview2 */
+
+#ifndef GL_OVR_multiview_multisampled_render_to_texture
+#define GL_OVR_multiview_multisampled_render_to_texture 1
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
+#endif
+#endif /* GL_OVR_multiview_multisampled_render_to_texture */
+
+#ifndef GL_QCOM_alpha_test
+#define GL_QCOM_alpha_test 1
+#define GL_ALPHA_TEST_QCOM 0x0BC0
+#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
+#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
+#endif
+#endif /* GL_QCOM_alpha_test */
+
+#ifndef GL_QCOM_binning_control
+#define GL_QCOM_binning_control 1
+#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
+#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
+#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
+#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
+#endif /* GL_QCOM_binning_control */
+
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+#endif /* GL_QCOM_driver_control */
+
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
+#endif
+#endif /* GL_QCOM_extended_get */
+
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+#endif /* GL_QCOM_extended_get2 */
+
+#ifndef GL_QCOM_framebuffer_foveated
+#define GL_QCOM_framebuffer_foveated 1
+#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001
+#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
+GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
+#endif
+#endif /* GL_QCOM_framebuffer_foveated */
+
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif /* GL_QCOM_perfmon_global_mode */
+
+#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent
+#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1
+#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void);
+#endif
+#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */
+
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+#endif /* GL_QCOM_tiled_rendering */
+
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif /* GL_QCOM_writeonly_rendering */
+
+#ifndef GL_VIV_shader_binary
+#define GL_VIV_shader_binary 1
+#define GL_SHADER_BINARY_VIV 0x8FC4
+#endif /* GL_VIV_shader_binary */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2platform.h b/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2platform.h
new file mode 100644
index 0000000..eb318dc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/GLES2/gl2platform.h
@@ -0,0 +1,38 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/*
+** Copyright (c) 2017 The Khronos Group Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * Please contribute modifications back to Khronos as pull requests on the
+ * public github repository:
+ * https://github.com/KhronosGroup/OpenGL-Registry
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl2platform_h_ */
diff --git a/src/3rdparty/SDL2/src/video/khronos/KHR/khrplatform.h b/src/3rdparty/SDL2/src/video/khronos/KHR/khrplatform.h
new file mode 100644
index 0000000..1ad3554
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/KHR/khrplatform.h
@@ -0,0 +1,284 @@
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by sending them to the public Khronos Bugzilla
+ * (http://khronos.org/bugzilla) by filing a bug against product
+ * "Khronos (general)" component "Registry".
+ *
+ * A predefined template which fills in some of the bug fields can be
+ * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+ * must create a Bugzilla login first.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include <KHR/khrplatform.h>
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ * khronos_int8_t signed 8 bit
+ * khronos_uint8_t unsigned 8 bit
+ * khronos_int16_t signed 16 bit
+ * khronos_uint16_t unsigned 16 bit
+ * khronos_int32_t signed 32 bit
+ * khronos_uint32_t unsigned 32 bit
+ * khronos_int64_t signed 64 bit
+ * khronos_uint64_t unsigned 64 bit
+ * khronos_intptr_t signed same number of bits as a pointer
+ * khronos_uintptr_t unsigned same number of bits as a pointer
+ * khronos_ssize_t signed size
+ * khronos_usize_t unsigned size
+ * khronos_float_t signed 32 bit floating point
+ * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ * nanoseconds
+ * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ * khronos_boolean_enum_t enumerated boolean type. This should
+ * only be used as a base type when a client API's boolean type is
+ * an enum. Client APIs which use an integer or other type for
+ * booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ * KHRONOS_APICALL
+ * KHRONOS_APIENTRY
+ * KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+ * int arg1,
+ * int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#elif defined(__ANDROID__)
+# define KHRONOS_APICALL __attribute__((visibility("default")))
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+ /* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using <stdint.h>
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using <inttypes.h>
+ */
+#include <inttypes.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
diff --git a/src/3rdparty/SDL2/src/video/khronos/vulkan/vk_platform.h b/src/3rdparty/SDL2/src/video/khronos/vulkan/vk_platform.h
new file mode 100644
index 0000000..72f8049
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/vulkan/vk_platform.h
@@ -0,0 +1,120 @@
+//
+// File: vk_platform.h
+//
+/*
+** Copyright (c) 2014-2017 The Khronos Group Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+
+#ifndef VK_PLATFORM_H_
+#define VK_PLATFORM_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+/*
+***************************************************************************************************
+* Platform-specific directives and type declarations
+***************************************************************************************************
+*/
+
+/* Platform-specific calling convention macros.
+ *
+ * Platforms should define these so that Vulkan clients call Vulkan commands
+ * with the same calling conventions that the Vulkan implementation expects.
+ *
+ * VKAPI_ATTR - Placed before the return type in function declarations.
+ * Useful for C++11 and GCC/Clang-style function attribute syntax.
+ * VKAPI_CALL - Placed after the return type in function declarations.
+ * Useful for MSVC-style calling convention syntax.
+ * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
+ *
+ * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
+ * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
+ */
+#if defined(_WIN32)
+ // On Windows, Vulkan commands use the stdcall convention
+ #define VKAPI_ATTR
+ #define VKAPI_CALL __stdcall
+ #define VKAPI_PTR VKAPI_CALL
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
+ #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
+ // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
+ // calling convention, i.e. float parameters are passed in registers. This
+ // is true even if the rest of the application passes floats on the stack,
+ // as it does by default when compiling for the armeabi-v7a NDK ABI.
+ #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
+ #define VKAPI_CALL
+ #define VKAPI_PTR VKAPI_ATTR
+#else
+ // On other platforms, use the default calling convention
+ #define VKAPI_ATTR
+ #define VKAPI_CALL
+ #define VKAPI_PTR
+#endif
+
+#include <stddef.h>
+
+#if !defined(VK_NO_STDINT_H)
+ #if defined(_MSC_VER) && (_MSC_VER < 1600)
+ typedef signed __int8 int8_t;
+ typedef unsigned __int8 uint8_t;
+ typedef signed __int16 int16_t;
+ typedef unsigned __int16 uint16_t;
+ typedef signed __int32 int32_t;
+ typedef unsigned __int32 uint32_t;
+ typedef signed __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+ #else
+ #include <stdint.h>
+ #endif
+#endif // !defined(VK_NO_STDINT_H)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+// Platform-specific headers required by platform window system extensions.
+// These are enabled prior to #including "vulkan.h". The same enable then
+// controls inclusion of the extension interfaces in vulkan.h.
+
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+#include <android/native_window.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_MIR_KHR
+#include <mir_toolkit/client_types.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+#include <wayland-client.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#include <windows.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+#include <X11/Xlib.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_XCB_KHR
+#include <xcb/xcb.h>
+#endif
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/khronos/vulkan/vulkan.h b/src/3rdparty/SDL2/src/video/khronos/vulkan/vulkan.h
new file mode 100644
index 0000000..04495fa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/khronos/vulkan/vulkan.h
@@ -0,0 +1,6458 @@
+#ifndef VULKAN_H_
+#define VULKAN_H_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2015-2017 The Khronos Group Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#define VK_VERSION_1_0 1
+#include "./vk_platform.h"
+
+#define VK_MAKE_VERSION(major, minor, patch) \
+ (((major) << 22) | ((minor) << 12) | (patch))
+
+// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead.
+//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0
+
+// Vulkan 1.0 version number
+#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)// Patch version should always be set to 0
+
+#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
+#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
+#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
+// Version of this file
+#define VK_HEADER_VERSION 59
+
+
+#define VK_NULL_HANDLE 0
+
+
+
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+
+#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE)
+#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+ #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+ #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+#endif
+
+
+
+typedef uint32_t VkFlags;
+typedef uint32_t VkBool32;
+typedef uint64_t VkDeviceSize;
+typedef uint32_t VkSampleMask;
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_HANDLE(VkPhysicalDevice)
+VK_DEFINE_HANDLE(VkDevice)
+VK_DEFINE_HANDLE(VkQueue)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore)
+VK_DEFINE_HANDLE(VkCommandBuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool)
+
+#define VK_LOD_CLAMP_NONE 1000.0f
+#define VK_REMAINING_MIP_LEVELS (~0U)
+#define VK_REMAINING_ARRAY_LAYERS (~0U)
+#define VK_WHOLE_SIZE (~0ULL)
+#define VK_ATTACHMENT_UNUSED (~0U)
+#define VK_TRUE 1
+#define VK_FALSE 0
+#define VK_QUEUE_FAMILY_IGNORED (~0U)
+#define VK_SUBPASS_EXTERNAL (~0U)
+#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
+#define VK_UUID_SIZE 16
+#define VK_MAX_MEMORY_TYPES 32
+#define VK_MAX_MEMORY_HEAPS 16
+#define VK_MAX_EXTENSION_NAME_SIZE 256
+#define VK_MAX_DESCRIPTION_SIZE 256
+
+
+typedef enum VkPipelineCacheHeaderVersion {
+ VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1,
+ VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE,
+ VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE,
+ VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = (VK_PIPELINE_CACHE_HEADER_VERSION_ONE - VK_PIPELINE_CACHE_HEADER_VERSION_ONE + 1),
+ VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF
+} VkPipelineCacheHeaderVersion;
+
+typedef enum VkResult {
+ VK_SUCCESS = 0,
+ VK_NOT_READY = 1,
+ VK_TIMEOUT = 2,
+ VK_EVENT_SET = 3,
+ VK_EVENT_RESET = 4,
+ VK_INCOMPLETE = 5,
+ VK_ERROR_OUT_OF_HOST_MEMORY = -1,
+ VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
+ VK_ERROR_INITIALIZATION_FAILED = -3,
+ VK_ERROR_DEVICE_LOST = -4,
+ VK_ERROR_MEMORY_MAP_FAILED = -5,
+ VK_ERROR_LAYER_NOT_PRESENT = -6,
+ VK_ERROR_EXTENSION_NOT_PRESENT = -7,
+ VK_ERROR_FEATURE_NOT_PRESENT = -8,
+ VK_ERROR_INCOMPATIBLE_DRIVER = -9,
+ VK_ERROR_TOO_MANY_OBJECTS = -10,
+ VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
+ VK_ERROR_FRAGMENTED_POOL = -12,
+ VK_ERROR_SURFACE_LOST_KHR = -1000000000,
+ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
+ VK_SUBOPTIMAL_KHR = 1000001003,
+ VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
+ VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
+ VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
+ VK_ERROR_INVALID_SHADER_NV = -1000012000,
+ VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000,
+ VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = -1000072003,
+ VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL,
+ VK_RESULT_END_RANGE = VK_INCOMPLETE,
+ VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FRAGMENTED_POOL + 1),
+ VK_RESULT_MAX_ENUM = 0x7FFFFFFF
+} VkResult;
+
+typedef enum VkStructureType {
+ VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
+ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
+ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
+ VK_STRUCTURE_TYPE_SUBMIT_INFO = 4,
+ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5,
+ VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6,
+ VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7,
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8,
+ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9,
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
+ VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11,
+ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12,
+ VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13,
+ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14,
+ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15,
+ VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16,
+ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17,
+ VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18,
+ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19,
+ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20,
+ VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22,
+ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23,
+ VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24,
+ VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25,
+ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26,
+ VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27,
+ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28,
+ VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29,
+ VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30,
+ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31,
+ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32,
+ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
+ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34,
+ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35,
+ VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36,
+ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37,
+ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38,
+ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39,
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40,
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41,
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42,
+ VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
+ VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44,
+ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45,
+ VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46,
+ VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47,
+ VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48,
+ VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000,
+ VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001,
+ VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000,
+ VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001,
+ VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000,
+ VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
+ VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
+ VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
+ VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
+ VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
+ VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
+ VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000,
+ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000,
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001,
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002,
+ VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000,
+ VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001,
+ VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002,
+ VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000,
+ VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHX = 1000053000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHX = 1000053001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX = 1000053002,
+ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000,
+ VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001,
+ VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000,
+ VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001,
+ VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001,
+ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002,
+ VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004,
+ VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006,
+ VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008,
+ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHX = 1000060000,
+ VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX = 1000060001,
+ VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX = 1000060002,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHX = 1000060003,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHX = 1000060004,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHX = 1000060005,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHX = 1000060006,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHX = 1000060007,
+ VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHX = 1000060008,
+ VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHX = 1000060009,
+ VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX = 1000060010,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHX = 1000060011,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHX = 1000060012,
+ VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000,
+ VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX = 1000070000,
+ VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX = 1000070001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000,
+ VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002,
+ VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004,
+ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = 1000072000,
+ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = 1000072001,
+ VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = 1000072002,
+ VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000,
+ VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001,
+ VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002,
+ VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003,
+ VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000,
+ VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001,
+ VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002,
+ VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000,
+ VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001,
+ VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = 1000077000,
+ VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000,
+ VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001,
+ VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002,
+ VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003,
+ VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000,
+ VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000,
+ VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000,
+ VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = 1000085000,
+ VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000,
+ VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001,
+ VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002,
+ VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003,
+ VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004,
+ VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000,
+ VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000,
+ VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000,
+ VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001,
+ VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002,
+ VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003,
+ VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000,
+ VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000,
+ VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001,
+ VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000,
+ VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000,
+ VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001,
+ VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = 1000113000,
+ VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000,
+ VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001,
+ VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002,
+ VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000,
+ VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000,
+ VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001,
+ VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000,
+ VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000,
+ VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
+ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000,
+ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000,
+ VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = 1000130001,
+ VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146000,
+ VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146001,
+ VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146002,
+ VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = 1000146003,
+ VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = 1000146004,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001,
+ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002,
+ VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000,
+ VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000,
+ VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
+ VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
+ VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
+ VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkStructureType;
+
+typedef enum VkSystemAllocationScope {
+ VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1,
+ VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2,
+ VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3,
+ VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4,
+ VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND,
+ VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE,
+ VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = (VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND + 1),
+ VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF
+} VkSystemAllocationScope;
+
+typedef enum VkInternalAllocationType {
+ VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0,
+ VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE,
+ VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE,
+ VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = (VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE + 1),
+ VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkInternalAllocationType;
+
+typedef enum VkFormat {
+ VK_FORMAT_UNDEFINED = 0,
+ VK_FORMAT_R4G4_UNORM_PACK8 = 1,
+ VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2,
+ VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3,
+ VK_FORMAT_R5G6B5_UNORM_PACK16 = 4,
+ VK_FORMAT_B5G6R5_UNORM_PACK16 = 5,
+ VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6,
+ VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7,
+ VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
+ VK_FORMAT_R8_UNORM = 9,
+ VK_FORMAT_R8_SNORM = 10,
+ VK_FORMAT_R8_USCALED = 11,
+ VK_FORMAT_R8_SSCALED = 12,
+ VK_FORMAT_R8_UINT = 13,
+ VK_FORMAT_R8_SINT = 14,
+ VK_FORMAT_R8_SRGB = 15,
+ VK_FORMAT_R8G8_UNORM = 16,
+ VK_FORMAT_R8G8_SNORM = 17,
+ VK_FORMAT_R8G8_USCALED = 18,
+ VK_FORMAT_R8G8_SSCALED = 19,
+ VK_FORMAT_R8G8_UINT = 20,
+ VK_FORMAT_R8G8_SINT = 21,
+ VK_FORMAT_R8G8_SRGB = 22,
+ VK_FORMAT_R8G8B8_UNORM = 23,
+ VK_FORMAT_R8G8B8_SNORM = 24,
+ VK_FORMAT_R8G8B8_USCALED = 25,
+ VK_FORMAT_R8G8B8_SSCALED = 26,
+ VK_FORMAT_R8G8B8_UINT = 27,
+ VK_FORMAT_R8G8B8_SINT = 28,
+ VK_FORMAT_R8G8B8_SRGB = 29,
+ VK_FORMAT_B8G8R8_UNORM = 30,
+ VK_FORMAT_B8G8R8_SNORM = 31,
+ VK_FORMAT_B8G8R8_USCALED = 32,
+ VK_FORMAT_B8G8R8_SSCALED = 33,
+ VK_FORMAT_B8G8R8_UINT = 34,
+ VK_FORMAT_B8G8R8_SINT = 35,
+ VK_FORMAT_B8G8R8_SRGB = 36,
+ VK_FORMAT_R8G8B8A8_UNORM = 37,
+ VK_FORMAT_R8G8B8A8_SNORM = 38,
+ VK_FORMAT_R8G8B8A8_USCALED = 39,
+ VK_FORMAT_R8G8B8A8_SSCALED = 40,
+ VK_FORMAT_R8G8B8A8_UINT = 41,
+ VK_FORMAT_R8G8B8A8_SINT = 42,
+ VK_FORMAT_R8G8B8A8_SRGB = 43,
+ VK_FORMAT_B8G8R8A8_UNORM = 44,
+ VK_FORMAT_B8G8R8A8_SNORM = 45,
+ VK_FORMAT_B8G8R8A8_USCALED = 46,
+ VK_FORMAT_B8G8R8A8_SSCALED = 47,
+ VK_FORMAT_B8G8R8A8_UINT = 48,
+ VK_FORMAT_B8G8R8A8_SINT = 49,
+ VK_FORMAT_B8G8R8A8_SRGB = 50,
+ VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51,
+ VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52,
+ VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53,
+ VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54,
+ VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55,
+ VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56,
+ VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57,
+ VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58,
+ VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59,
+ VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60,
+ VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61,
+ VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62,
+ VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63,
+ VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64,
+ VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65,
+ VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66,
+ VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67,
+ VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68,
+ VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69,
+ VK_FORMAT_R16_UNORM = 70,
+ VK_FORMAT_R16_SNORM = 71,
+ VK_FORMAT_R16_USCALED = 72,
+ VK_FORMAT_R16_SSCALED = 73,
+ VK_FORMAT_R16_UINT = 74,
+ VK_FORMAT_R16_SINT = 75,
+ VK_FORMAT_R16_SFLOAT = 76,
+ VK_FORMAT_R16G16_UNORM = 77,
+ VK_FORMAT_R16G16_SNORM = 78,
+ VK_FORMAT_R16G16_USCALED = 79,
+ VK_FORMAT_R16G16_SSCALED = 80,
+ VK_FORMAT_R16G16_UINT = 81,
+ VK_FORMAT_R16G16_SINT = 82,
+ VK_FORMAT_R16G16_SFLOAT = 83,
+ VK_FORMAT_R16G16B16_UNORM = 84,
+ VK_FORMAT_R16G16B16_SNORM = 85,
+ VK_FORMAT_R16G16B16_USCALED = 86,
+ VK_FORMAT_R16G16B16_SSCALED = 87,
+ VK_FORMAT_R16G16B16_UINT = 88,
+ VK_FORMAT_R16G16B16_SINT = 89,
+ VK_FORMAT_R16G16B16_SFLOAT = 90,
+ VK_FORMAT_R16G16B16A16_UNORM = 91,
+ VK_FORMAT_R16G16B16A16_SNORM = 92,
+ VK_FORMAT_R16G16B16A16_USCALED = 93,
+ VK_FORMAT_R16G16B16A16_SSCALED = 94,
+ VK_FORMAT_R16G16B16A16_UINT = 95,
+ VK_FORMAT_R16G16B16A16_SINT = 96,
+ VK_FORMAT_R16G16B16A16_SFLOAT = 97,
+ VK_FORMAT_R32_UINT = 98,
+ VK_FORMAT_R32_SINT = 99,
+ VK_FORMAT_R32_SFLOAT = 100,
+ VK_FORMAT_R32G32_UINT = 101,
+ VK_FORMAT_R32G32_SINT = 102,
+ VK_FORMAT_R32G32_SFLOAT = 103,
+ VK_FORMAT_R32G32B32_UINT = 104,
+ VK_FORMAT_R32G32B32_SINT = 105,
+ VK_FORMAT_R32G32B32_SFLOAT = 106,
+ VK_FORMAT_R32G32B32A32_UINT = 107,
+ VK_FORMAT_R32G32B32A32_SINT = 108,
+ VK_FORMAT_R32G32B32A32_SFLOAT = 109,
+ VK_FORMAT_R64_UINT = 110,
+ VK_FORMAT_R64_SINT = 111,
+ VK_FORMAT_R64_SFLOAT = 112,
+ VK_FORMAT_R64G64_UINT = 113,
+ VK_FORMAT_R64G64_SINT = 114,
+ VK_FORMAT_R64G64_SFLOAT = 115,
+ VK_FORMAT_R64G64B64_UINT = 116,
+ VK_FORMAT_R64G64B64_SINT = 117,
+ VK_FORMAT_R64G64B64_SFLOAT = 118,
+ VK_FORMAT_R64G64B64A64_UINT = 119,
+ VK_FORMAT_R64G64B64A64_SINT = 120,
+ VK_FORMAT_R64G64B64A64_SFLOAT = 121,
+ VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122,
+ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123,
+ VK_FORMAT_D16_UNORM = 124,
+ VK_FORMAT_X8_D24_UNORM_PACK32 = 125,
+ VK_FORMAT_D32_SFLOAT = 126,
+ VK_FORMAT_S8_UINT = 127,
+ VK_FORMAT_D16_UNORM_S8_UINT = 128,
+ VK_FORMAT_D24_UNORM_S8_UINT = 129,
+ VK_FORMAT_D32_SFLOAT_S8_UINT = 130,
+ VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131,
+ VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132,
+ VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133,
+ VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134,
+ VK_FORMAT_BC2_UNORM_BLOCK = 135,
+ VK_FORMAT_BC2_SRGB_BLOCK = 136,
+ VK_FORMAT_BC3_UNORM_BLOCK = 137,
+ VK_FORMAT_BC3_SRGB_BLOCK = 138,
+ VK_FORMAT_BC4_UNORM_BLOCK = 139,
+ VK_FORMAT_BC4_SNORM_BLOCK = 140,
+ VK_FORMAT_BC5_UNORM_BLOCK = 141,
+ VK_FORMAT_BC5_SNORM_BLOCK = 142,
+ VK_FORMAT_BC6H_UFLOAT_BLOCK = 143,
+ VK_FORMAT_BC6H_SFLOAT_BLOCK = 144,
+ VK_FORMAT_BC7_UNORM_BLOCK = 145,
+ VK_FORMAT_BC7_SRGB_BLOCK = 146,
+ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147,
+ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148,
+ VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149,
+ VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150,
+ VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151,
+ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152,
+ VK_FORMAT_EAC_R11_UNORM_BLOCK = 153,
+ VK_FORMAT_EAC_R11_SNORM_BLOCK = 154,
+ VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155,
+ VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156,
+ VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157,
+ VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158,
+ VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159,
+ VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160,
+ VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161,
+ VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162,
+ VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163,
+ VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164,
+ VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165,
+ VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166,
+ VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167,
+ VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168,
+ VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169,
+ VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170,
+ VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171,
+ VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172,
+ VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173,
+ VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174,
+ VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175,
+ VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176,
+ VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177,
+ VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178,
+ VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179,
+ VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180,
+ VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181,
+ VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182,
+ VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183,
+ VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
+ VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000,
+ VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001,
+ VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002,
+ VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003,
+ VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004,
+ VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005,
+ VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006,
+ VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007,
+ VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED,
+ VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
+ VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1),
+ VK_FORMAT_MAX_ENUM = 0x7FFFFFFF
+} VkFormat;
+
+typedef enum VkImageType {
+ VK_IMAGE_TYPE_1D = 0,
+ VK_IMAGE_TYPE_2D = 1,
+ VK_IMAGE_TYPE_3D = 2,
+ VK_IMAGE_TYPE_BEGIN_RANGE = VK_IMAGE_TYPE_1D,
+ VK_IMAGE_TYPE_END_RANGE = VK_IMAGE_TYPE_3D,
+ VK_IMAGE_TYPE_RANGE_SIZE = (VK_IMAGE_TYPE_3D - VK_IMAGE_TYPE_1D + 1),
+ VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkImageType;
+
+typedef enum VkImageTiling {
+ VK_IMAGE_TILING_OPTIMAL = 0,
+ VK_IMAGE_TILING_LINEAR = 1,
+ VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL,
+ VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR,
+ VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1),
+ VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF
+} VkImageTiling;
+
+typedef enum VkPhysicalDeviceType {
+ VK_PHYSICAL_DEVICE_TYPE_OTHER = 0,
+ VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1,
+ VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2,
+ VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3,
+ VK_PHYSICAL_DEVICE_TYPE_CPU = 4,
+ VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = VK_PHYSICAL_DEVICE_TYPE_OTHER,
+ VK_PHYSICAL_DEVICE_TYPE_END_RANGE = VK_PHYSICAL_DEVICE_TYPE_CPU,
+ VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = (VK_PHYSICAL_DEVICE_TYPE_CPU - VK_PHYSICAL_DEVICE_TYPE_OTHER + 1),
+ VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkPhysicalDeviceType;
+
+typedef enum VkQueryType {
+ VK_QUERY_TYPE_OCCLUSION = 0,
+ VK_QUERY_TYPE_PIPELINE_STATISTICS = 1,
+ VK_QUERY_TYPE_TIMESTAMP = 2,
+ VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION,
+ VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP,
+ VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1),
+ VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkQueryType;
+
+typedef enum VkSharingMode {
+ VK_SHARING_MODE_EXCLUSIVE = 0,
+ VK_SHARING_MODE_CONCURRENT = 1,
+ VK_SHARING_MODE_BEGIN_RANGE = VK_SHARING_MODE_EXCLUSIVE,
+ VK_SHARING_MODE_END_RANGE = VK_SHARING_MODE_CONCURRENT,
+ VK_SHARING_MODE_RANGE_SIZE = (VK_SHARING_MODE_CONCURRENT - VK_SHARING_MODE_EXCLUSIVE + 1),
+ VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSharingMode;
+
+typedef enum VkImageLayout {
+ VK_IMAGE_LAYOUT_UNDEFINED = 0,
+ VK_IMAGE_LAYOUT_GENERAL = 1,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4,
+ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5,
+ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6,
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7,
+ VK_IMAGE_LAYOUT_PREINITIALIZED = 8,
+ VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002,
+ VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000,
+ VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED,
+ VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED,
+ VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1),
+ VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF
+} VkImageLayout;
+
+typedef enum VkImageViewType {
+ VK_IMAGE_VIEW_TYPE_1D = 0,
+ VK_IMAGE_VIEW_TYPE_2D = 1,
+ VK_IMAGE_VIEW_TYPE_3D = 2,
+ VK_IMAGE_VIEW_TYPE_CUBE = 3,
+ VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4,
+ VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5,
+ VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6,
+ VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = VK_IMAGE_VIEW_TYPE_1D,
+ VK_IMAGE_VIEW_TYPE_END_RANGE = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY,
+ VK_IMAGE_VIEW_TYPE_RANGE_SIZE = (VK_IMAGE_VIEW_TYPE_CUBE_ARRAY - VK_IMAGE_VIEW_TYPE_1D + 1),
+ VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkImageViewType;
+
+typedef enum VkComponentSwizzle {
+ VK_COMPONENT_SWIZZLE_IDENTITY = 0,
+ VK_COMPONENT_SWIZZLE_ZERO = 1,
+ VK_COMPONENT_SWIZZLE_ONE = 2,
+ VK_COMPONENT_SWIZZLE_R = 3,
+ VK_COMPONENT_SWIZZLE_G = 4,
+ VK_COMPONENT_SWIZZLE_B = 5,
+ VK_COMPONENT_SWIZZLE_A = 6,
+ VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY,
+ VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A,
+ VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1),
+ VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF
+} VkComponentSwizzle;
+
+typedef enum VkVertexInputRate {
+ VK_VERTEX_INPUT_RATE_VERTEX = 0,
+ VK_VERTEX_INPUT_RATE_INSTANCE = 1,
+ VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX,
+ VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE,
+ VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1),
+ VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF
+} VkVertexInputRate;
+
+typedef enum VkPrimitiveTopology {
+ VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0,
+ VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1,
+ VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2,
+ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3,
+ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4,
+ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5,
+ VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6,
+ VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7,
+ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8,
+ VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9,
+ VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10,
+ VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
+ VK_PRIMITIVE_TOPOLOGY_END_RANGE = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST,
+ VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = (VK_PRIMITIVE_TOPOLOGY_PATCH_LIST - VK_PRIMITIVE_TOPOLOGY_POINT_LIST + 1),
+ VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF
+} VkPrimitiveTopology;
+
+typedef enum VkPolygonMode {
+ VK_POLYGON_MODE_FILL = 0,
+ VK_POLYGON_MODE_LINE = 1,
+ VK_POLYGON_MODE_POINT = 2,
+ VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000,
+ VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL,
+ VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT,
+ VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1),
+ VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkPolygonMode;
+
+typedef enum VkFrontFace {
+ VK_FRONT_FACE_COUNTER_CLOCKWISE = 0,
+ VK_FRONT_FACE_CLOCKWISE = 1,
+ VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE,
+ VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE,
+ VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1),
+ VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF
+} VkFrontFace;
+
+typedef enum VkCompareOp {
+ VK_COMPARE_OP_NEVER = 0,
+ VK_COMPARE_OP_LESS = 1,
+ VK_COMPARE_OP_EQUAL = 2,
+ VK_COMPARE_OP_LESS_OR_EQUAL = 3,
+ VK_COMPARE_OP_GREATER = 4,
+ VK_COMPARE_OP_NOT_EQUAL = 5,
+ VK_COMPARE_OP_GREATER_OR_EQUAL = 6,
+ VK_COMPARE_OP_ALWAYS = 7,
+ VK_COMPARE_OP_BEGIN_RANGE = VK_COMPARE_OP_NEVER,
+ VK_COMPARE_OP_END_RANGE = VK_COMPARE_OP_ALWAYS,
+ VK_COMPARE_OP_RANGE_SIZE = (VK_COMPARE_OP_ALWAYS - VK_COMPARE_OP_NEVER + 1),
+ VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF
+} VkCompareOp;
+
+typedef enum VkStencilOp {
+ VK_STENCIL_OP_KEEP = 0,
+ VK_STENCIL_OP_ZERO = 1,
+ VK_STENCIL_OP_REPLACE = 2,
+ VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3,
+ VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4,
+ VK_STENCIL_OP_INVERT = 5,
+ VK_STENCIL_OP_INCREMENT_AND_WRAP = 6,
+ VK_STENCIL_OP_DECREMENT_AND_WRAP = 7,
+ VK_STENCIL_OP_BEGIN_RANGE = VK_STENCIL_OP_KEEP,
+ VK_STENCIL_OP_END_RANGE = VK_STENCIL_OP_DECREMENT_AND_WRAP,
+ VK_STENCIL_OP_RANGE_SIZE = (VK_STENCIL_OP_DECREMENT_AND_WRAP - VK_STENCIL_OP_KEEP + 1),
+ VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF
+} VkStencilOp;
+
+typedef enum VkLogicOp {
+ VK_LOGIC_OP_CLEAR = 0,
+ VK_LOGIC_OP_AND = 1,
+ VK_LOGIC_OP_AND_REVERSE = 2,
+ VK_LOGIC_OP_COPY = 3,
+ VK_LOGIC_OP_AND_INVERTED = 4,
+ VK_LOGIC_OP_NO_OP = 5,
+ VK_LOGIC_OP_XOR = 6,
+ VK_LOGIC_OP_OR = 7,
+ VK_LOGIC_OP_NOR = 8,
+ VK_LOGIC_OP_EQUIVALENT = 9,
+ VK_LOGIC_OP_INVERT = 10,
+ VK_LOGIC_OP_OR_REVERSE = 11,
+ VK_LOGIC_OP_COPY_INVERTED = 12,
+ VK_LOGIC_OP_OR_INVERTED = 13,
+ VK_LOGIC_OP_NAND = 14,
+ VK_LOGIC_OP_SET = 15,
+ VK_LOGIC_OP_BEGIN_RANGE = VK_LOGIC_OP_CLEAR,
+ VK_LOGIC_OP_END_RANGE = VK_LOGIC_OP_SET,
+ VK_LOGIC_OP_RANGE_SIZE = (VK_LOGIC_OP_SET - VK_LOGIC_OP_CLEAR + 1),
+ VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF
+} VkLogicOp;
+
+typedef enum VkBlendFactor {
+ VK_BLEND_FACTOR_ZERO = 0,
+ VK_BLEND_FACTOR_ONE = 1,
+ VK_BLEND_FACTOR_SRC_COLOR = 2,
+ VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3,
+ VK_BLEND_FACTOR_DST_COLOR = 4,
+ VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5,
+ VK_BLEND_FACTOR_SRC_ALPHA = 6,
+ VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7,
+ VK_BLEND_FACTOR_DST_ALPHA = 8,
+ VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9,
+ VK_BLEND_FACTOR_CONSTANT_COLOR = 10,
+ VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11,
+ VK_BLEND_FACTOR_CONSTANT_ALPHA = 12,
+ VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13,
+ VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14,
+ VK_BLEND_FACTOR_SRC1_COLOR = 15,
+ VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16,
+ VK_BLEND_FACTOR_SRC1_ALPHA = 17,
+ VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18,
+ VK_BLEND_FACTOR_BEGIN_RANGE = VK_BLEND_FACTOR_ZERO,
+ VK_BLEND_FACTOR_END_RANGE = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA,
+ VK_BLEND_FACTOR_RANGE_SIZE = (VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA - VK_BLEND_FACTOR_ZERO + 1),
+ VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF
+} VkBlendFactor;
+
+typedef enum VkBlendOp {
+ VK_BLEND_OP_ADD = 0,
+ VK_BLEND_OP_SUBTRACT = 1,
+ VK_BLEND_OP_REVERSE_SUBTRACT = 2,
+ VK_BLEND_OP_MIN = 3,
+ VK_BLEND_OP_MAX = 4,
+ VK_BLEND_OP_ZERO_EXT = 1000148000,
+ VK_BLEND_OP_SRC_EXT = 1000148001,
+ VK_BLEND_OP_DST_EXT = 1000148002,
+ VK_BLEND_OP_SRC_OVER_EXT = 1000148003,
+ VK_BLEND_OP_DST_OVER_EXT = 1000148004,
+ VK_BLEND_OP_SRC_IN_EXT = 1000148005,
+ VK_BLEND_OP_DST_IN_EXT = 1000148006,
+ VK_BLEND_OP_SRC_OUT_EXT = 1000148007,
+ VK_BLEND_OP_DST_OUT_EXT = 1000148008,
+ VK_BLEND_OP_SRC_ATOP_EXT = 1000148009,
+ VK_BLEND_OP_DST_ATOP_EXT = 1000148010,
+ VK_BLEND_OP_XOR_EXT = 1000148011,
+ VK_BLEND_OP_MULTIPLY_EXT = 1000148012,
+ VK_BLEND_OP_SCREEN_EXT = 1000148013,
+ VK_BLEND_OP_OVERLAY_EXT = 1000148014,
+ VK_BLEND_OP_DARKEN_EXT = 1000148015,
+ VK_BLEND_OP_LIGHTEN_EXT = 1000148016,
+ VK_BLEND_OP_COLORDODGE_EXT = 1000148017,
+ VK_BLEND_OP_COLORBURN_EXT = 1000148018,
+ VK_BLEND_OP_HARDLIGHT_EXT = 1000148019,
+ VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020,
+ VK_BLEND_OP_DIFFERENCE_EXT = 1000148021,
+ VK_BLEND_OP_EXCLUSION_EXT = 1000148022,
+ VK_BLEND_OP_INVERT_EXT = 1000148023,
+ VK_BLEND_OP_INVERT_RGB_EXT = 1000148024,
+ VK_BLEND_OP_LINEARDODGE_EXT = 1000148025,
+ VK_BLEND_OP_LINEARBURN_EXT = 1000148026,
+ VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027,
+ VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028,
+ VK_BLEND_OP_PINLIGHT_EXT = 1000148029,
+ VK_BLEND_OP_HARDMIX_EXT = 1000148030,
+ VK_BLEND_OP_HSL_HUE_EXT = 1000148031,
+ VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032,
+ VK_BLEND_OP_HSL_COLOR_EXT = 1000148033,
+ VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034,
+ VK_BLEND_OP_PLUS_EXT = 1000148035,
+ VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036,
+ VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037,
+ VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038,
+ VK_BLEND_OP_MINUS_EXT = 1000148039,
+ VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040,
+ VK_BLEND_OP_CONTRAST_EXT = 1000148041,
+ VK_BLEND_OP_INVERT_OVG_EXT = 1000148042,
+ VK_BLEND_OP_RED_EXT = 1000148043,
+ VK_BLEND_OP_GREEN_EXT = 1000148044,
+ VK_BLEND_OP_BLUE_EXT = 1000148045,
+ VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD,
+ VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX,
+ VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1),
+ VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF
+} VkBlendOp;
+
+typedef enum VkDynamicState {
+ VK_DYNAMIC_STATE_VIEWPORT = 0,
+ VK_DYNAMIC_STATE_SCISSOR = 1,
+ VK_DYNAMIC_STATE_LINE_WIDTH = 2,
+ VK_DYNAMIC_STATE_DEPTH_BIAS = 3,
+ VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4,
+ VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5,
+ VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6,
+ VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7,
+ VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8,
+ VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000,
+ VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000,
+ VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT,
+ VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE,
+ VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1),
+ VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF
+} VkDynamicState;
+
+typedef enum VkFilter {
+ VK_FILTER_NEAREST = 0,
+ VK_FILTER_LINEAR = 1,
+ VK_FILTER_CUBIC_IMG = 1000015000,
+ VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST,
+ VK_FILTER_END_RANGE = VK_FILTER_LINEAR,
+ VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1),
+ VK_FILTER_MAX_ENUM = 0x7FFFFFFF
+} VkFilter;
+
+typedef enum VkSamplerMipmapMode {
+ VK_SAMPLER_MIPMAP_MODE_NEAREST = 0,
+ VK_SAMPLER_MIPMAP_MODE_LINEAR = 1,
+ VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_NEAREST,
+ VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR,
+ VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_NEAREST + 1),
+ VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSamplerMipmapMode;
+
+typedef enum VkSamplerAddressMode {
+ VK_SAMPLER_ADDRESS_MODE_REPEAT = 0,
+ VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1,
+ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2,
+ VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
+ VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
+ VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT,
+ VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
+ VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
+ VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSamplerAddressMode;
+
+typedef enum VkBorderColor {
+ VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0,
+ VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1,
+ VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2,
+ VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3,
+ VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4,
+ VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5,
+ VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK,
+ VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE,
+ VK_BORDER_COLOR_RANGE_SIZE = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1),
+ VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF
+} VkBorderColor;
+
+typedef enum VkDescriptorType {
+ VK_DESCRIPTOR_TYPE_SAMPLER = 0,
+ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1,
+ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2,
+ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3,
+ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4,
+ VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5,
+ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6,
+ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7,
+ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8,
+ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9,
+ VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10,
+ VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER,
+ VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
+ VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1),
+ VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkDescriptorType;
+
+typedef enum VkAttachmentLoadOp {
+ VK_ATTACHMENT_LOAD_OP_LOAD = 0,
+ VK_ATTACHMENT_LOAD_OP_CLEAR = 1,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2,
+ VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = VK_ATTACHMENT_LOAD_OP_LOAD,
+ VK_ATTACHMENT_LOAD_OP_END_RANGE = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = (VK_ATTACHMENT_LOAD_OP_DONT_CARE - VK_ATTACHMENT_LOAD_OP_LOAD + 1),
+ VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF
+} VkAttachmentLoadOp;
+
+typedef enum VkAttachmentStoreOp {
+ VK_ATTACHMENT_STORE_OP_STORE = 0,
+ VK_ATTACHMENT_STORE_OP_DONT_CARE = 1,
+ VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = VK_ATTACHMENT_STORE_OP_STORE,
+ VK_ATTACHMENT_STORE_OP_END_RANGE = VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_STORE_OP_RANGE_SIZE = (VK_ATTACHMENT_STORE_OP_DONT_CARE - VK_ATTACHMENT_STORE_OP_STORE + 1),
+ VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF
+} VkAttachmentStoreOp;
+
+typedef enum VkPipelineBindPoint {
+ VK_PIPELINE_BIND_POINT_GRAPHICS = 0,
+ VK_PIPELINE_BIND_POINT_COMPUTE = 1,
+ VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS,
+ VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE,
+ VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1),
+ VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF
+} VkPipelineBindPoint;
+
+typedef enum VkCommandBufferLevel {
+ VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0,
+ VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1,
+ VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
+ VK_COMMAND_BUFFER_LEVEL_END_RANGE = VK_COMMAND_BUFFER_LEVEL_SECONDARY,
+ VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = (VK_COMMAND_BUFFER_LEVEL_SECONDARY - VK_COMMAND_BUFFER_LEVEL_PRIMARY + 1),
+ VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF
+} VkCommandBufferLevel;
+
+typedef enum VkIndexType {
+ VK_INDEX_TYPE_UINT16 = 0,
+ VK_INDEX_TYPE_UINT32 = 1,
+ VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16,
+ VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32,
+ VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1),
+ VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkIndexType;
+
+typedef enum VkSubpassContents {
+ VK_SUBPASS_CONTENTS_INLINE = 0,
+ VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1,
+ VK_SUBPASS_CONTENTS_BEGIN_RANGE = VK_SUBPASS_CONTENTS_INLINE,
+ VK_SUBPASS_CONTENTS_END_RANGE = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS,
+ VK_SUBPASS_CONTENTS_RANGE_SIZE = (VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS - VK_SUBPASS_CONTENTS_INLINE + 1),
+ VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF
+} VkSubpassContents;
+
+typedef enum VkObjectType {
+ VK_OBJECT_TYPE_UNKNOWN = 0,
+ VK_OBJECT_TYPE_INSTANCE = 1,
+ VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2,
+ VK_OBJECT_TYPE_DEVICE = 3,
+ VK_OBJECT_TYPE_QUEUE = 4,
+ VK_OBJECT_TYPE_SEMAPHORE = 5,
+ VK_OBJECT_TYPE_COMMAND_BUFFER = 6,
+ VK_OBJECT_TYPE_FENCE = 7,
+ VK_OBJECT_TYPE_DEVICE_MEMORY = 8,
+ VK_OBJECT_TYPE_BUFFER = 9,
+ VK_OBJECT_TYPE_IMAGE = 10,
+ VK_OBJECT_TYPE_EVENT = 11,
+ VK_OBJECT_TYPE_QUERY_POOL = 12,
+ VK_OBJECT_TYPE_BUFFER_VIEW = 13,
+ VK_OBJECT_TYPE_IMAGE_VIEW = 14,
+ VK_OBJECT_TYPE_SHADER_MODULE = 15,
+ VK_OBJECT_TYPE_PIPELINE_CACHE = 16,
+ VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17,
+ VK_OBJECT_TYPE_RENDER_PASS = 18,
+ VK_OBJECT_TYPE_PIPELINE = 19,
+ VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20,
+ VK_OBJECT_TYPE_SAMPLER = 21,
+ VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22,
+ VK_OBJECT_TYPE_DESCRIPTOR_SET = 23,
+ VK_OBJECT_TYPE_FRAMEBUFFER = 24,
+ VK_OBJECT_TYPE_COMMAND_POOL = 25,
+ VK_OBJECT_TYPE_SURFACE_KHR = 1000000000,
+ VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000,
+ VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000,
+ VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001,
+ VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000,
+ VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000,
+ VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000,
+ VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001,
+ VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN,
+ VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_COMMAND_POOL,
+ VK_OBJECT_TYPE_RANGE_SIZE = (VK_OBJECT_TYPE_COMMAND_POOL - VK_OBJECT_TYPE_UNKNOWN + 1),
+ VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkObjectType;
+
+typedef VkFlags VkInstanceCreateFlags;
+
+typedef enum VkFormatFeatureFlagBits {
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001,
+ VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002,
+ VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004,
+ VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008,
+ VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010,
+ VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020,
+ VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040,
+ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080,
+ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100,
+ VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200,
+ VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400,
+ VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800,
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000,
+ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000,
+ VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000,
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 0x00010000,
+ VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkFormatFeatureFlagBits;
+typedef VkFlags VkFormatFeatureFlags;
+
+typedef enum VkImageUsageFlagBits {
+ VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001,
+ VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002,
+ VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004,
+ VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008,
+ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010,
+ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
+ VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
+ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
+ VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkImageUsageFlagBits;
+typedef VkFlags VkImageUsageFlags;
+
+typedef enum VkImageCreateFlagBits {
+ VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001,
+ VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
+ VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
+ VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008,
+ VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010,
+ VK_IMAGE_CREATE_BIND_SFR_BIT_KHX = 0x00000040,
+ VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 0x00000020,
+ VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkImageCreateFlagBits;
+typedef VkFlags VkImageCreateFlags;
+
+typedef enum VkSampleCountFlagBits {
+ VK_SAMPLE_COUNT_1_BIT = 0x00000001,
+ VK_SAMPLE_COUNT_2_BIT = 0x00000002,
+ VK_SAMPLE_COUNT_4_BIT = 0x00000004,
+ VK_SAMPLE_COUNT_8_BIT = 0x00000008,
+ VK_SAMPLE_COUNT_16_BIT = 0x00000010,
+ VK_SAMPLE_COUNT_32_BIT = 0x00000020,
+ VK_SAMPLE_COUNT_64_BIT = 0x00000040,
+ VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkSampleCountFlagBits;
+typedef VkFlags VkSampleCountFlags;
+
+typedef enum VkQueueFlagBits {
+ VK_QUEUE_GRAPHICS_BIT = 0x00000001,
+ VK_QUEUE_COMPUTE_BIT = 0x00000002,
+ VK_QUEUE_TRANSFER_BIT = 0x00000004,
+ VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
+ VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkQueueFlagBits;
+typedef VkFlags VkQueueFlags;
+
+typedef enum VkMemoryPropertyFlagBits {
+ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
+ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
+ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
+ VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
+ VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
+ VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkMemoryPropertyFlagBits;
+typedef VkFlags VkMemoryPropertyFlags;
+
+typedef enum VkMemoryHeapFlagBits {
+ VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
+ VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHX = 0x00000002,
+ VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkMemoryHeapFlagBits;
+typedef VkFlags VkMemoryHeapFlags;
+typedef VkFlags VkDeviceCreateFlags;
+typedef VkFlags VkDeviceQueueCreateFlags;
+
+typedef enum VkPipelineStageFlagBits {
+ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001,
+ VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002,
+ VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004,
+ VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008,
+ VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010,
+ VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020,
+ VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040,
+ VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080,
+ VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100,
+ VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200,
+ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400,
+ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800,
+ VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000,
+ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000,
+ VK_PIPELINE_STAGE_HOST_BIT = 0x00004000,
+ VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000,
+ VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000,
+ VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX = 0x00020000,
+ VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkPipelineStageFlagBits;
+typedef VkFlags VkPipelineStageFlags;
+typedef VkFlags VkMemoryMapFlags;
+
+typedef enum VkImageAspectFlagBits {
+ VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
+ VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
+ VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
+ VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
+ VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkImageAspectFlagBits;
+typedef VkFlags VkImageAspectFlags;
+
+typedef enum VkSparseImageFormatFlagBits {
+ VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001,
+ VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002,
+ VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004,
+ VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkSparseImageFormatFlagBits;
+typedef VkFlags VkSparseImageFormatFlags;
+
+typedef enum VkSparseMemoryBindFlagBits {
+ VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
+ VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkSparseMemoryBindFlagBits;
+typedef VkFlags VkSparseMemoryBindFlags;
+
+typedef enum VkFenceCreateFlagBits {
+ VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
+ VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkFenceCreateFlagBits;
+typedef VkFlags VkFenceCreateFlags;
+typedef VkFlags VkSemaphoreCreateFlags;
+typedef VkFlags VkEventCreateFlags;
+typedef VkFlags VkQueryPoolCreateFlags;
+
+typedef enum VkQueryPipelineStatisticFlagBits {
+ VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001,
+ VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002,
+ VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004,
+ VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008,
+ VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010,
+ VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020,
+ VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040,
+ VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080,
+ VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100,
+ VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200,
+ VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400,
+ VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkQueryPipelineStatisticFlagBits;
+typedef VkFlags VkQueryPipelineStatisticFlags;
+
+typedef enum VkQueryResultFlagBits {
+ VK_QUERY_RESULT_64_BIT = 0x00000001,
+ VK_QUERY_RESULT_WAIT_BIT = 0x00000002,
+ VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004,
+ VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008,
+ VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkQueryResultFlagBits;
+typedef VkFlags VkQueryResultFlags;
+
+typedef enum VkBufferCreateFlagBits {
+ VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
+ VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
+ VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
+ VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkBufferCreateFlagBits;
+typedef VkFlags VkBufferCreateFlags;
+
+typedef enum VkBufferUsageFlagBits {
+ VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001,
+ VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002,
+ VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004,
+ VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008,
+ VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010,
+ VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020,
+ VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040,
+ VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
+ VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
+ VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkBufferUsageFlagBits;
+typedef VkFlags VkBufferUsageFlags;
+typedef VkFlags VkBufferViewCreateFlags;
+typedef VkFlags VkImageViewCreateFlags;
+typedef VkFlags VkShaderModuleCreateFlags;
+typedef VkFlags VkPipelineCacheCreateFlags;
+
+typedef enum VkPipelineCreateFlagBits {
+ VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
+ VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
+ VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
+ VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHX = 0x00000008,
+ VK_PIPELINE_CREATE_DISPATCH_BASE_KHX = 0x00000010,
+ VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkPipelineCreateFlagBits;
+typedef VkFlags VkPipelineCreateFlags;
+typedef VkFlags VkPipelineShaderStageCreateFlags;
+
+typedef enum VkShaderStageFlagBits {
+ VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
+ VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
+ VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
+ VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
+ VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
+ VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
+ VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
+ VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
+ VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkShaderStageFlagBits;
+typedef VkFlags VkPipelineVertexInputStateCreateFlags;
+typedef VkFlags VkPipelineInputAssemblyStateCreateFlags;
+typedef VkFlags VkPipelineTessellationStateCreateFlags;
+typedef VkFlags VkPipelineViewportStateCreateFlags;
+typedef VkFlags VkPipelineRasterizationStateCreateFlags;
+
+typedef enum VkCullModeFlagBits {
+ VK_CULL_MODE_NONE = 0,
+ VK_CULL_MODE_FRONT_BIT = 0x00000001,
+ VK_CULL_MODE_BACK_BIT = 0x00000002,
+ VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
+ VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkCullModeFlagBits;
+typedef VkFlags VkCullModeFlags;
+typedef VkFlags VkPipelineMultisampleStateCreateFlags;
+typedef VkFlags VkPipelineDepthStencilStateCreateFlags;
+typedef VkFlags VkPipelineColorBlendStateCreateFlags;
+
+typedef enum VkColorComponentFlagBits {
+ VK_COLOR_COMPONENT_R_BIT = 0x00000001,
+ VK_COLOR_COMPONENT_G_BIT = 0x00000002,
+ VK_COLOR_COMPONENT_B_BIT = 0x00000004,
+ VK_COLOR_COMPONENT_A_BIT = 0x00000008,
+ VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkColorComponentFlagBits;
+typedef VkFlags VkColorComponentFlags;
+typedef VkFlags VkPipelineDynamicStateCreateFlags;
+typedef VkFlags VkPipelineLayoutCreateFlags;
+typedef VkFlags VkShaderStageFlags;
+typedef VkFlags VkSamplerCreateFlags;
+
+typedef enum VkDescriptorSetLayoutCreateFlagBits {
+ VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001,
+ VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkDescriptorSetLayoutCreateFlagBits;
+typedef VkFlags VkDescriptorSetLayoutCreateFlags;
+
+typedef enum VkDescriptorPoolCreateFlagBits {
+ VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
+ VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkDescriptorPoolCreateFlagBits;
+typedef VkFlags VkDescriptorPoolCreateFlags;
+typedef VkFlags VkDescriptorPoolResetFlags;
+typedef VkFlags VkFramebufferCreateFlags;
+typedef VkFlags VkRenderPassCreateFlags;
+
+typedef enum VkAttachmentDescriptionFlagBits {
+ VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001,
+ VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkAttachmentDescriptionFlagBits;
+typedef VkFlags VkAttachmentDescriptionFlags;
+
+typedef enum VkSubpassDescriptionFlagBits {
+ VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = 0x00000001,
+ VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = 0x00000002,
+ VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkSubpassDescriptionFlagBits;
+typedef VkFlags VkSubpassDescriptionFlags;
+
+typedef enum VkAccessFlagBits {
+ VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001,
+ VK_ACCESS_INDEX_READ_BIT = 0x00000002,
+ VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004,
+ VK_ACCESS_UNIFORM_READ_BIT = 0x00000008,
+ VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010,
+ VK_ACCESS_SHADER_READ_BIT = 0x00000020,
+ VK_ACCESS_SHADER_WRITE_BIT = 0x00000040,
+ VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080,
+ VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100,
+ VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200,
+ VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400,
+ VK_ACCESS_TRANSFER_READ_BIT = 0x00000800,
+ VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000,
+ VK_ACCESS_HOST_READ_BIT = 0x00002000,
+ VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
+ VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
+ VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
+ VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000,
+ VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000,
+ VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000,
+ VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkAccessFlagBits;
+typedef VkFlags VkAccessFlags;
+
+typedef enum VkDependencyFlagBits {
+ VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
+ VK_DEPENDENCY_VIEW_LOCAL_BIT_KHX = 0x00000002,
+ VK_DEPENDENCY_DEVICE_GROUP_BIT_KHX = 0x00000004,
+ VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkDependencyFlagBits;
+typedef VkFlags VkDependencyFlags;
+
+typedef enum VkCommandPoolCreateFlagBits {
+ VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001,
+ VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002,
+ VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkCommandPoolCreateFlagBits;
+typedef VkFlags VkCommandPoolCreateFlags;
+
+typedef enum VkCommandPoolResetFlagBits {
+ VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
+ VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkCommandPoolResetFlagBits;
+typedef VkFlags VkCommandPoolResetFlags;
+
+typedef enum VkCommandBufferUsageFlagBits {
+ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
+ VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
+ VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
+ VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkCommandBufferUsageFlagBits;
+typedef VkFlags VkCommandBufferUsageFlags;
+
+typedef enum VkQueryControlFlagBits {
+ VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
+ VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkQueryControlFlagBits;
+typedef VkFlags VkQueryControlFlags;
+
+typedef enum VkCommandBufferResetFlagBits {
+ VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
+ VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkCommandBufferResetFlagBits;
+typedef VkFlags VkCommandBufferResetFlags;
+
+typedef enum VkStencilFaceFlagBits {
+ VK_STENCIL_FACE_FRONT_BIT = 0x00000001,
+ VK_STENCIL_FACE_BACK_BIT = 0x00000002,
+ VK_STENCIL_FRONT_AND_BACK = 0x00000003,
+ VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VkStencilFaceFlagBits;
+typedef VkFlags VkStencilFaceFlags;
+
+typedef struct VkApplicationInfo {
+ VkStructureType sType;
+ const void* pNext;
+ const char* pApplicationName;
+ uint32_t applicationVersion;
+ const char* pEngineName;
+ uint32_t engineVersion;
+ uint32_t apiVersion;
+} VkApplicationInfo;
+
+typedef struct VkInstanceCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkInstanceCreateFlags flags;
+ const VkApplicationInfo* pApplicationInfo;
+ uint32_t enabledLayerCount;
+ const char* const* ppEnabledLayerNames;
+ uint32_t enabledExtensionCount;
+ const char* const* ppEnabledExtensionNames;
+} VkInstanceCreateInfo;
+
+typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)(
+ void* pUserData,
+ size_t size,
+ size_t alignment,
+ VkSystemAllocationScope allocationScope);
+
+typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)(
+ void* pUserData,
+ void* pOriginal,
+ size_t size,
+ size_t alignment,
+ VkSystemAllocationScope allocationScope);
+
+typedef void (VKAPI_PTR *PFN_vkFreeFunction)(
+ void* pUserData,
+ void* pMemory);
+
+typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)(
+ void* pUserData,
+ size_t size,
+ VkInternalAllocationType allocationType,
+ VkSystemAllocationScope allocationScope);
+
+typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)(
+ void* pUserData,
+ size_t size,
+ VkInternalAllocationType allocationType,
+ VkSystemAllocationScope allocationScope);
+
+typedef struct VkAllocationCallbacks {
+ void* pUserData;
+ PFN_vkAllocationFunction pfnAllocation;
+ PFN_vkReallocationFunction pfnReallocation;
+ PFN_vkFreeFunction pfnFree;
+ PFN_vkInternalAllocationNotification pfnInternalAllocation;
+ PFN_vkInternalFreeNotification pfnInternalFree;
+} VkAllocationCallbacks;
+
+typedef struct VkPhysicalDeviceFeatures {
+ VkBool32 robustBufferAccess;
+ VkBool32 fullDrawIndexUint32;
+ VkBool32 imageCubeArray;
+ VkBool32 independentBlend;
+ VkBool32 geometryShader;
+ VkBool32 tessellationShader;
+ VkBool32 sampleRateShading;
+ VkBool32 dualSrcBlend;
+ VkBool32 logicOp;
+ VkBool32 multiDrawIndirect;
+ VkBool32 drawIndirectFirstInstance;
+ VkBool32 depthClamp;
+ VkBool32 depthBiasClamp;
+ VkBool32 fillModeNonSolid;
+ VkBool32 depthBounds;
+ VkBool32 wideLines;
+ VkBool32 largePoints;
+ VkBool32 alphaToOne;
+ VkBool32 multiViewport;
+ VkBool32 samplerAnisotropy;
+ VkBool32 textureCompressionETC2;
+ VkBool32 textureCompressionASTC_LDR;
+ VkBool32 textureCompressionBC;
+ VkBool32 occlusionQueryPrecise;
+ VkBool32 pipelineStatisticsQuery;
+ VkBool32 vertexPipelineStoresAndAtomics;
+ VkBool32 fragmentStoresAndAtomics;
+ VkBool32 shaderTessellationAndGeometryPointSize;
+ VkBool32 shaderImageGatherExtended;
+ VkBool32 shaderStorageImageExtendedFormats;
+ VkBool32 shaderStorageImageMultisample;
+ VkBool32 shaderStorageImageReadWithoutFormat;
+ VkBool32 shaderStorageImageWriteWithoutFormat;
+ VkBool32 shaderUniformBufferArrayDynamicIndexing;
+ VkBool32 shaderSampledImageArrayDynamicIndexing;
+ VkBool32 shaderStorageBufferArrayDynamicIndexing;
+ VkBool32 shaderStorageImageArrayDynamicIndexing;
+ VkBool32 shaderClipDistance;
+ VkBool32 shaderCullDistance;
+ VkBool32 shaderFloat64;
+ VkBool32 shaderInt64;
+ VkBool32 shaderInt16;
+ VkBool32 shaderResourceResidency;
+ VkBool32 shaderResourceMinLod;
+ VkBool32 sparseBinding;
+ VkBool32 sparseResidencyBuffer;
+ VkBool32 sparseResidencyImage2D;
+ VkBool32 sparseResidencyImage3D;
+ VkBool32 sparseResidency2Samples;
+ VkBool32 sparseResidency4Samples;
+ VkBool32 sparseResidency8Samples;
+ VkBool32 sparseResidency16Samples;
+ VkBool32 sparseResidencyAliased;
+ VkBool32 variableMultisampleRate;
+ VkBool32 inheritedQueries;
+} VkPhysicalDeviceFeatures;
+
+typedef struct VkFormatProperties {
+ VkFormatFeatureFlags linearTilingFeatures;
+ VkFormatFeatureFlags optimalTilingFeatures;
+ VkFormatFeatureFlags bufferFeatures;
+} VkFormatProperties;
+
+typedef struct VkExtent3D {
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth;
+} VkExtent3D;
+
+typedef struct VkImageFormatProperties {
+ VkExtent3D maxExtent;
+ uint32_t maxMipLevels;
+ uint32_t maxArrayLayers;
+ VkSampleCountFlags sampleCounts;
+ VkDeviceSize maxResourceSize;
+} VkImageFormatProperties;
+
+typedef struct VkPhysicalDeviceLimits {
+ uint32_t maxImageDimension1D;
+ uint32_t maxImageDimension2D;
+ uint32_t maxImageDimension3D;
+ uint32_t maxImageDimensionCube;
+ uint32_t maxImageArrayLayers;
+ uint32_t maxTexelBufferElements;
+ uint32_t maxUniformBufferRange;
+ uint32_t maxStorageBufferRange;
+ uint32_t maxPushConstantsSize;
+ uint32_t maxMemoryAllocationCount;
+ uint32_t maxSamplerAllocationCount;
+ VkDeviceSize bufferImageGranularity;
+ VkDeviceSize sparseAddressSpaceSize;
+ uint32_t maxBoundDescriptorSets;
+ uint32_t maxPerStageDescriptorSamplers;
+ uint32_t maxPerStageDescriptorUniformBuffers;
+ uint32_t maxPerStageDescriptorStorageBuffers;
+ uint32_t maxPerStageDescriptorSampledImages;
+ uint32_t maxPerStageDescriptorStorageImages;
+ uint32_t maxPerStageDescriptorInputAttachments;
+ uint32_t maxPerStageResources;
+ uint32_t maxDescriptorSetSamplers;
+ uint32_t maxDescriptorSetUniformBuffers;
+ uint32_t maxDescriptorSetUniformBuffersDynamic;
+ uint32_t maxDescriptorSetStorageBuffers;
+ uint32_t maxDescriptorSetStorageBuffersDynamic;
+ uint32_t maxDescriptorSetSampledImages;
+ uint32_t maxDescriptorSetStorageImages;
+ uint32_t maxDescriptorSetInputAttachments;
+ uint32_t maxVertexInputAttributes;
+ uint32_t maxVertexInputBindings;
+ uint32_t maxVertexInputAttributeOffset;
+ uint32_t maxVertexInputBindingStride;
+ uint32_t maxVertexOutputComponents;
+ uint32_t maxTessellationGenerationLevel;
+ uint32_t maxTessellationPatchSize;
+ uint32_t maxTessellationControlPerVertexInputComponents;
+ uint32_t maxTessellationControlPerVertexOutputComponents;
+ uint32_t maxTessellationControlPerPatchOutputComponents;
+ uint32_t maxTessellationControlTotalOutputComponents;
+ uint32_t maxTessellationEvaluationInputComponents;
+ uint32_t maxTessellationEvaluationOutputComponents;
+ uint32_t maxGeometryShaderInvocations;
+ uint32_t maxGeometryInputComponents;
+ uint32_t maxGeometryOutputComponents;
+ uint32_t maxGeometryOutputVertices;
+ uint32_t maxGeometryTotalOutputComponents;
+ uint32_t maxFragmentInputComponents;
+ uint32_t maxFragmentOutputAttachments;
+ uint32_t maxFragmentDualSrcAttachments;
+ uint32_t maxFragmentCombinedOutputResources;
+ uint32_t maxComputeSharedMemorySize;
+ uint32_t maxComputeWorkGroupCount[3];
+ uint32_t maxComputeWorkGroupInvocations;
+ uint32_t maxComputeWorkGroupSize[3];
+ uint32_t subPixelPrecisionBits;
+ uint32_t subTexelPrecisionBits;
+ uint32_t mipmapPrecisionBits;
+ uint32_t maxDrawIndexedIndexValue;
+ uint32_t maxDrawIndirectCount;
+ float maxSamplerLodBias;
+ float maxSamplerAnisotropy;
+ uint32_t maxViewports;
+ uint32_t maxViewportDimensions[2];
+ float viewportBoundsRange[2];
+ uint32_t viewportSubPixelBits;
+ size_t minMemoryMapAlignment;
+ VkDeviceSize minTexelBufferOffsetAlignment;
+ VkDeviceSize minUniformBufferOffsetAlignment;
+ VkDeviceSize minStorageBufferOffsetAlignment;
+ int32_t minTexelOffset;
+ uint32_t maxTexelOffset;
+ int32_t minTexelGatherOffset;
+ uint32_t maxTexelGatherOffset;
+ float minInterpolationOffset;
+ float maxInterpolationOffset;
+ uint32_t subPixelInterpolationOffsetBits;
+ uint32_t maxFramebufferWidth;
+ uint32_t maxFramebufferHeight;
+ uint32_t maxFramebufferLayers;
+ VkSampleCountFlags framebufferColorSampleCounts;
+ VkSampleCountFlags framebufferDepthSampleCounts;
+ VkSampleCountFlags framebufferStencilSampleCounts;
+ VkSampleCountFlags framebufferNoAttachmentsSampleCounts;
+ uint32_t maxColorAttachments;
+ VkSampleCountFlags sampledImageColorSampleCounts;
+ VkSampleCountFlags sampledImageIntegerSampleCounts;
+ VkSampleCountFlags sampledImageDepthSampleCounts;
+ VkSampleCountFlags sampledImageStencilSampleCounts;
+ VkSampleCountFlags storageImageSampleCounts;
+ uint32_t maxSampleMaskWords;
+ VkBool32 timestampComputeAndGraphics;
+ float timestampPeriod;
+ uint32_t maxClipDistances;
+ uint32_t maxCullDistances;
+ uint32_t maxCombinedClipAndCullDistances;
+ uint32_t discreteQueuePriorities;
+ float pointSizeRange[2];
+ float lineWidthRange[2];
+ float pointSizeGranularity;
+ float lineWidthGranularity;
+ VkBool32 strictLines;
+ VkBool32 standardSampleLocations;
+ VkDeviceSize optimalBufferCopyOffsetAlignment;
+ VkDeviceSize optimalBufferCopyRowPitchAlignment;
+ VkDeviceSize nonCoherentAtomSize;
+} VkPhysicalDeviceLimits;
+
+typedef struct VkPhysicalDeviceSparseProperties {
+ VkBool32 residencyStandard2DBlockShape;
+ VkBool32 residencyStandard2DMultisampleBlockShape;
+ VkBool32 residencyStandard3DBlockShape;
+ VkBool32 residencyAlignedMipSize;
+ VkBool32 residencyNonResidentStrict;
+} VkPhysicalDeviceSparseProperties;
+
+typedef struct VkPhysicalDeviceProperties {
+ uint32_t apiVersion;
+ uint32_t driverVersion;
+ uint32_t vendorID;
+ uint32_t deviceID;
+ VkPhysicalDeviceType deviceType;
+ char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
+ uint8_t pipelineCacheUUID[VK_UUID_SIZE];
+ VkPhysicalDeviceLimits limits;
+ VkPhysicalDeviceSparseProperties sparseProperties;
+} VkPhysicalDeviceProperties;
+
+typedef struct VkQueueFamilyProperties {
+ VkQueueFlags queueFlags;
+ uint32_t queueCount;
+ uint32_t timestampValidBits;
+ VkExtent3D minImageTransferGranularity;
+} VkQueueFamilyProperties;
+
+typedef struct VkMemoryType {
+ VkMemoryPropertyFlags propertyFlags;
+ uint32_t heapIndex;
+} VkMemoryType;
+
+typedef struct VkMemoryHeap {
+ VkDeviceSize size;
+ VkMemoryHeapFlags flags;
+} VkMemoryHeap;
+
+typedef struct VkPhysicalDeviceMemoryProperties {
+ uint32_t memoryTypeCount;
+ VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES];
+ uint32_t memoryHeapCount;
+ VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS];
+} VkPhysicalDeviceMemoryProperties;
+
+typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void);
+typedef struct VkDeviceQueueCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceQueueCreateFlags flags;
+ uint32_t queueFamilyIndex;
+ uint32_t queueCount;
+ const float* pQueuePriorities;
+} VkDeviceQueueCreateInfo;
+
+typedef struct VkDeviceCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceCreateFlags flags;
+ uint32_t queueCreateInfoCount;
+ const VkDeviceQueueCreateInfo* pQueueCreateInfos;
+ uint32_t enabledLayerCount;
+ const char* const* ppEnabledLayerNames;
+ uint32_t enabledExtensionCount;
+ const char* const* ppEnabledExtensionNames;
+ const VkPhysicalDeviceFeatures* pEnabledFeatures;
+} VkDeviceCreateInfo;
+
+typedef struct VkExtensionProperties {
+ char extensionName[VK_MAX_EXTENSION_NAME_SIZE];
+ uint32_t specVersion;
+} VkExtensionProperties;
+
+typedef struct VkLayerProperties {
+ char layerName[VK_MAX_EXTENSION_NAME_SIZE];
+ uint32_t specVersion;
+ uint32_t implementationVersion;
+ char description[VK_MAX_DESCRIPTION_SIZE];
+} VkLayerProperties;
+
+typedef struct VkSubmitInfo {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreCount;
+ const VkSemaphore* pWaitSemaphores;
+ const VkPipelineStageFlags* pWaitDstStageMask;
+ uint32_t commandBufferCount;
+ const VkCommandBuffer* pCommandBuffers;
+ uint32_t signalSemaphoreCount;
+ const VkSemaphore* pSignalSemaphores;
+} VkSubmitInfo;
+
+typedef struct VkMemoryAllocateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceSize allocationSize;
+ uint32_t memoryTypeIndex;
+} VkMemoryAllocateInfo;
+
+typedef struct VkMappedMemoryRange {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceMemory memory;
+ VkDeviceSize offset;
+ VkDeviceSize size;
+} VkMappedMemoryRange;
+
+typedef struct VkMemoryRequirements {
+ VkDeviceSize size;
+ VkDeviceSize alignment;
+ uint32_t memoryTypeBits;
+} VkMemoryRequirements;
+
+typedef struct VkSparseImageFormatProperties {
+ VkImageAspectFlags aspectMask;
+ VkExtent3D imageGranularity;
+ VkSparseImageFormatFlags flags;
+} VkSparseImageFormatProperties;
+
+typedef struct VkSparseImageMemoryRequirements {
+ VkSparseImageFormatProperties formatProperties;
+ uint32_t imageMipTailFirstLod;
+ VkDeviceSize imageMipTailSize;
+ VkDeviceSize imageMipTailOffset;
+ VkDeviceSize imageMipTailStride;
+} VkSparseImageMemoryRequirements;
+
+typedef struct VkSparseMemoryBind {
+ VkDeviceSize resourceOffset;
+ VkDeviceSize size;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ VkSparseMemoryBindFlags flags;
+} VkSparseMemoryBind;
+
+typedef struct VkSparseBufferMemoryBindInfo {
+ VkBuffer buffer;
+ uint32_t bindCount;
+ const VkSparseMemoryBind* pBinds;
+} VkSparseBufferMemoryBindInfo;
+
+typedef struct VkSparseImageOpaqueMemoryBindInfo {
+ VkImage image;
+ uint32_t bindCount;
+ const VkSparseMemoryBind* pBinds;
+} VkSparseImageOpaqueMemoryBindInfo;
+
+typedef struct VkImageSubresource {
+ VkImageAspectFlags aspectMask;
+ uint32_t mipLevel;
+ uint32_t arrayLayer;
+} VkImageSubresource;
+
+typedef struct VkOffset3D {
+ int32_t x;
+ int32_t y;
+ int32_t z;
+} VkOffset3D;
+
+typedef struct VkSparseImageMemoryBind {
+ VkImageSubresource subresource;
+ VkOffset3D offset;
+ VkExtent3D extent;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ VkSparseMemoryBindFlags flags;
+} VkSparseImageMemoryBind;
+
+typedef struct VkSparseImageMemoryBindInfo {
+ VkImage image;
+ uint32_t bindCount;
+ const VkSparseImageMemoryBind* pBinds;
+} VkSparseImageMemoryBindInfo;
+
+typedef struct VkBindSparseInfo {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreCount;
+ const VkSemaphore* pWaitSemaphores;
+ uint32_t bufferBindCount;
+ const VkSparseBufferMemoryBindInfo* pBufferBinds;
+ uint32_t imageOpaqueBindCount;
+ const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds;
+ uint32_t imageBindCount;
+ const VkSparseImageMemoryBindInfo* pImageBinds;
+ uint32_t signalSemaphoreCount;
+ const VkSemaphore* pSignalSemaphores;
+} VkBindSparseInfo;
+
+typedef struct VkFenceCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkFenceCreateFlags flags;
+} VkFenceCreateInfo;
+
+typedef struct VkSemaphoreCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkSemaphoreCreateFlags flags;
+} VkSemaphoreCreateInfo;
+
+typedef struct VkEventCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkEventCreateFlags flags;
+} VkEventCreateInfo;
+
+typedef struct VkQueryPoolCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkQueryPoolCreateFlags flags;
+ VkQueryType queryType;
+ uint32_t queryCount;
+ VkQueryPipelineStatisticFlags pipelineStatistics;
+} VkQueryPoolCreateInfo;
+
+typedef struct VkBufferCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkBufferCreateFlags flags;
+ VkDeviceSize size;
+ VkBufferUsageFlags usage;
+ VkSharingMode sharingMode;
+ uint32_t queueFamilyIndexCount;
+ const uint32_t* pQueueFamilyIndices;
+} VkBufferCreateInfo;
+
+typedef struct VkBufferViewCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkBufferViewCreateFlags flags;
+ VkBuffer buffer;
+ VkFormat format;
+ VkDeviceSize offset;
+ VkDeviceSize range;
+} VkBufferViewCreateInfo;
+
+typedef struct VkImageCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkImageCreateFlags flags;
+ VkImageType imageType;
+ VkFormat format;
+ VkExtent3D extent;
+ uint32_t mipLevels;
+ uint32_t arrayLayers;
+ VkSampleCountFlagBits samples;
+ VkImageTiling tiling;
+ VkImageUsageFlags usage;
+ VkSharingMode sharingMode;
+ uint32_t queueFamilyIndexCount;
+ const uint32_t* pQueueFamilyIndices;
+ VkImageLayout initialLayout;
+} VkImageCreateInfo;
+
+typedef struct VkSubresourceLayout {
+ VkDeviceSize offset;
+ VkDeviceSize size;
+ VkDeviceSize rowPitch;
+ VkDeviceSize arrayPitch;
+ VkDeviceSize depthPitch;
+} VkSubresourceLayout;
+
+typedef struct VkComponentMapping {
+ VkComponentSwizzle r;
+ VkComponentSwizzle g;
+ VkComponentSwizzle b;
+ VkComponentSwizzle a;
+} VkComponentMapping;
+
+typedef struct VkImageSubresourceRange {
+ VkImageAspectFlags aspectMask;
+ uint32_t baseMipLevel;
+ uint32_t levelCount;
+ uint32_t baseArrayLayer;
+ uint32_t layerCount;
+} VkImageSubresourceRange;
+
+typedef struct VkImageViewCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkImageViewCreateFlags flags;
+ VkImage image;
+ VkImageViewType viewType;
+ VkFormat format;
+ VkComponentMapping components;
+ VkImageSubresourceRange subresourceRange;
+} VkImageViewCreateInfo;
+
+typedef struct VkShaderModuleCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkShaderModuleCreateFlags flags;
+ size_t codeSize;
+ const uint32_t* pCode;
+} VkShaderModuleCreateInfo;
+
+typedef struct VkPipelineCacheCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCacheCreateFlags flags;
+ size_t initialDataSize;
+ const void* pInitialData;
+} VkPipelineCacheCreateInfo;
+
+typedef struct VkSpecializationMapEntry {
+ uint32_t constantID;
+ uint32_t offset;
+ size_t size;
+} VkSpecializationMapEntry;
+
+typedef struct VkSpecializationInfo {
+ uint32_t mapEntryCount;
+ const VkSpecializationMapEntry* pMapEntries;
+ size_t dataSize;
+ const void* pData;
+} VkSpecializationInfo;
+
+typedef struct VkPipelineShaderStageCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineShaderStageCreateFlags flags;
+ VkShaderStageFlagBits stage;
+ VkShaderModule module;
+ const char* pName;
+ const VkSpecializationInfo* pSpecializationInfo;
+} VkPipelineShaderStageCreateInfo;
+
+typedef struct VkVertexInputBindingDescription {
+ uint32_t binding;
+ uint32_t stride;
+ VkVertexInputRate inputRate;
+} VkVertexInputBindingDescription;
+
+typedef struct VkVertexInputAttributeDescription {
+ uint32_t location;
+ uint32_t binding;
+ VkFormat format;
+ uint32_t offset;
+} VkVertexInputAttributeDescription;
+
+typedef struct VkPipelineVertexInputStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineVertexInputStateCreateFlags flags;
+ uint32_t vertexBindingDescriptionCount;
+ const VkVertexInputBindingDescription* pVertexBindingDescriptions;
+ uint32_t vertexAttributeDescriptionCount;
+ const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
+} VkPipelineVertexInputStateCreateInfo;
+
+typedef struct VkPipelineInputAssemblyStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineInputAssemblyStateCreateFlags flags;
+ VkPrimitiveTopology topology;
+ VkBool32 primitiveRestartEnable;
+} VkPipelineInputAssemblyStateCreateInfo;
+
+typedef struct VkPipelineTessellationStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineTessellationStateCreateFlags flags;
+ uint32_t patchControlPoints;
+} VkPipelineTessellationStateCreateInfo;
+
+typedef struct VkViewport {
+ float x;
+ float y;
+ float width;
+ float height;
+ float minDepth;
+ float maxDepth;
+} VkViewport;
+
+typedef struct VkOffset2D {
+ int32_t x;
+ int32_t y;
+} VkOffset2D;
+
+typedef struct VkExtent2D {
+ uint32_t width;
+ uint32_t height;
+} VkExtent2D;
+
+typedef struct VkRect2D {
+ VkOffset2D offset;
+ VkExtent2D extent;
+} VkRect2D;
+
+typedef struct VkPipelineViewportStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineViewportStateCreateFlags flags;
+ uint32_t viewportCount;
+ const VkViewport* pViewports;
+ uint32_t scissorCount;
+ const VkRect2D* pScissors;
+} VkPipelineViewportStateCreateInfo;
+
+typedef struct VkPipelineRasterizationStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineRasterizationStateCreateFlags flags;
+ VkBool32 depthClampEnable;
+ VkBool32 rasterizerDiscardEnable;
+ VkPolygonMode polygonMode;
+ VkCullModeFlags cullMode;
+ VkFrontFace frontFace;
+ VkBool32 depthBiasEnable;
+ float depthBiasConstantFactor;
+ float depthBiasClamp;
+ float depthBiasSlopeFactor;
+ float lineWidth;
+} VkPipelineRasterizationStateCreateInfo;
+
+typedef struct VkPipelineMultisampleStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineMultisampleStateCreateFlags flags;
+ VkSampleCountFlagBits rasterizationSamples;
+ VkBool32 sampleShadingEnable;
+ float minSampleShading;
+ const VkSampleMask* pSampleMask;
+ VkBool32 alphaToCoverageEnable;
+ VkBool32 alphaToOneEnable;
+} VkPipelineMultisampleStateCreateInfo;
+
+typedef struct VkStencilOpState {
+ VkStencilOp failOp;
+ VkStencilOp passOp;
+ VkStencilOp depthFailOp;
+ VkCompareOp compareOp;
+ uint32_t compareMask;
+ uint32_t writeMask;
+ uint32_t reference;
+} VkStencilOpState;
+
+typedef struct VkPipelineDepthStencilStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineDepthStencilStateCreateFlags flags;
+ VkBool32 depthTestEnable;
+ VkBool32 depthWriteEnable;
+ VkCompareOp depthCompareOp;
+ VkBool32 depthBoundsTestEnable;
+ VkBool32 stencilTestEnable;
+ VkStencilOpState front;
+ VkStencilOpState back;
+ float minDepthBounds;
+ float maxDepthBounds;
+} VkPipelineDepthStencilStateCreateInfo;
+
+typedef struct VkPipelineColorBlendAttachmentState {
+ VkBool32 blendEnable;
+ VkBlendFactor srcColorBlendFactor;
+ VkBlendFactor dstColorBlendFactor;
+ VkBlendOp colorBlendOp;
+ VkBlendFactor srcAlphaBlendFactor;
+ VkBlendFactor dstAlphaBlendFactor;
+ VkBlendOp alphaBlendOp;
+ VkColorComponentFlags colorWriteMask;
+} VkPipelineColorBlendAttachmentState;
+
+typedef struct VkPipelineColorBlendStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineColorBlendStateCreateFlags flags;
+ VkBool32 logicOpEnable;
+ VkLogicOp logicOp;
+ uint32_t attachmentCount;
+ const VkPipelineColorBlendAttachmentState* pAttachments;
+ float blendConstants[4];
+} VkPipelineColorBlendStateCreateInfo;
+
+typedef struct VkPipelineDynamicStateCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineDynamicStateCreateFlags flags;
+ uint32_t dynamicStateCount;
+ const VkDynamicState* pDynamicStates;
+} VkPipelineDynamicStateCreateInfo;
+
+typedef struct VkGraphicsPipelineCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCreateFlags flags;
+ uint32_t stageCount;
+ const VkPipelineShaderStageCreateInfo* pStages;
+ const VkPipelineVertexInputStateCreateInfo* pVertexInputState;
+ const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState;
+ const VkPipelineTessellationStateCreateInfo* pTessellationState;
+ const VkPipelineViewportStateCreateInfo* pViewportState;
+ const VkPipelineRasterizationStateCreateInfo* pRasterizationState;
+ const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
+ const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
+ const VkPipelineColorBlendStateCreateInfo* pColorBlendState;
+ const VkPipelineDynamicStateCreateInfo* pDynamicState;
+ VkPipelineLayout layout;
+ VkRenderPass renderPass;
+ uint32_t subpass;
+ VkPipeline basePipelineHandle;
+ int32_t basePipelineIndex;
+} VkGraphicsPipelineCreateInfo;
+
+typedef struct VkComputePipelineCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCreateFlags flags;
+ VkPipelineShaderStageCreateInfo stage;
+ VkPipelineLayout layout;
+ VkPipeline basePipelineHandle;
+ int32_t basePipelineIndex;
+} VkComputePipelineCreateInfo;
+
+typedef struct VkPushConstantRange {
+ VkShaderStageFlags stageFlags;
+ uint32_t offset;
+ uint32_t size;
+} VkPushConstantRange;
+
+typedef struct VkPipelineLayoutCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineLayoutCreateFlags flags;
+ uint32_t setLayoutCount;
+ const VkDescriptorSetLayout* pSetLayouts;
+ uint32_t pushConstantRangeCount;
+ const VkPushConstantRange* pPushConstantRanges;
+} VkPipelineLayoutCreateInfo;
+
+typedef struct VkSamplerCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkSamplerCreateFlags flags;
+ VkFilter magFilter;
+ VkFilter minFilter;
+ VkSamplerMipmapMode mipmapMode;
+ VkSamplerAddressMode addressModeU;
+ VkSamplerAddressMode addressModeV;
+ VkSamplerAddressMode addressModeW;
+ float mipLodBias;
+ VkBool32 anisotropyEnable;
+ float maxAnisotropy;
+ VkBool32 compareEnable;
+ VkCompareOp compareOp;
+ float minLod;
+ float maxLod;
+ VkBorderColor borderColor;
+ VkBool32 unnormalizedCoordinates;
+} VkSamplerCreateInfo;
+
+typedef struct VkDescriptorSetLayoutBinding {
+ uint32_t binding;
+ VkDescriptorType descriptorType;
+ uint32_t descriptorCount;
+ VkShaderStageFlags stageFlags;
+ const VkSampler* pImmutableSamplers;
+} VkDescriptorSetLayoutBinding;
+
+typedef struct VkDescriptorSetLayoutCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorSetLayoutCreateFlags flags;
+ uint32_t bindingCount;
+ const VkDescriptorSetLayoutBinding* pBindings;
+} VkDescriptorSetLayoutCreateInfo;
+
+typedef struct VkDescriptorPoolSize {
+ VkDescriptorType type;
+ uint32_t descriptorCount;
+} VkDescriptorPoolSize;
+
+typedef struct VkDescriptorPoolCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorPoolCreateFlags flags;
+ uint32_t maxSets;
+ uint32_t poolSizeCount;
+ const VkDescriptorPoolSize* pPoolSizes;
+} VkDescriptorPoolCreateInfo;
+
+typedef struct VkDescriptorSetAllocateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorPool descriptorPool;
+ uint32_t descriptorSetCount;
+ const VkDescriptorSetLayout* pSetLayouts;
+} VkDescriptorSetAllocateInfo;
+
+typedef struct VkDescriptorImageInfo {
+ VkSampler sampler;
+ VkImageView imageView;
+ VkImageLayout imageLayout;
+} VkDescriptorImageInfo;
+
+typedef struct VkDescriptorBufferInfo {
+ VkBuffer buffer;
+ VkDeviceSize offset;
+ VkDeviceSize range;
+} VkDescriptorBufferInfo;
+
+typedef struct VkWriteDescriptorSet {
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorSet dstSet;
+ uint32_t dstBinding;
+ uint32_t dstArrayElement;
+ uint32_t descriptorCount;
+ VkDescriptorType descriptorType;
+ const VkDescriptorImageInfo* pImageInfo;
+ const VkDescriptorBufferInfo* pBufferInfo;
+ const VkBufferView* pTexelBufferView;
+} VkWriteDescriptorSet;
+
+typedef struct VkCopyDescriptorSet {
+ VkStructureType sType;
+ const void* pNext;
+ VkDescriptorSet srcSet;
+ uint32_t srcBinding;
+ uint32_t srcArrayElement;
+ VkDescriptorSet dstSet;
+ uint32_t dstBinding;
+ uint32_t dstArrayElement;
+ uint32_t descriptorCount;
+} VkCopyDescriptorSet;
+
+typedef struct VkFramebufferCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkFramebufferCreateFlags flags;
+ VkRenderPass renderPass;
+ uint32_t attachmentCount;
+ const VkImageView* pAttachments;
+ uint32_t width;
+ uint32_t height;
+ uint32_t layers;
+} VkFramebufferCreateInfo;
+
+typedef struct VkAttachmentDescription {
+ VkAttachmentDescriptionFlags flags;
+ VkFormat format;
+ VkSampleCountFlagBits samples;
+ VkAttachmentLoadOp loadOp;
+ VkAttachmentStoreOp storeOp;
+ VkAttachmentLoadOp stencilLoadOp;
+ VkAttachmentStoreOp stencilStoreOp;
+ VkImageLayout initialLayout;
+ VkImageLayout finalLayout;
+} VkAttachmentDescription;
+
+typedef struct VkAttachmentReference {
+ uint32_t attachment;
+ VkImageLayout layout;
+} VkAttachmentReference;
+
+typedef struct VkSubpassDescription {
+ VkSubpassDescriptionFlags flags;
+ VkPipelineBindPoint pipelineBindPoint;
+ uint32_t inputAttachmentCount;
+ const VkAttachmentReference* pInputAttachments;
+ uint32_t colorAttachmentCount;
+ const VkAttachmentReference* pColorAttachments;
+ const VkAttachmentReference* pResolveAttachments;
+ const VkAttachmentReference* pDepthStencilAttachment;
+ uint32_t preserveAttachmentCount;
+ const uint32_t* pPreserveAttachments;
+} VkSubpassDescription;
+
+typedef struct VkSubpassDependency {
+ uint32_t srcSubpass;
+ uint32_t dstSubpass;
+ VkPipelineStageFlags srcStageMask;
+ VkPipelineStageFlags dstStageMask;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+ VkDependencyFlags dependencyFlags;
+} VkSubpassDependency;
+
+typedef struct VkRenderPassCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkRenderPassCreateFlags flags;
+ uint32_t attachmentCount;
+ const VkAttachmentDescription* pAttachments;
+ uint32_t subpassCount;
+ const VkSubpassDescription* pSubpasses;
+ uint32_t dependencyCount;
+ const VkSubpassDependency* pDependencies;
+} VkRenderPassCreateInfo;
+
+typedef struct VkCommandPoolCreateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkCommandPoolCreateFlags flags;
+ uint32_t queueFamilyIndex;
+} VkCommandPoolCreateInfo;
+
+typedef struct VkCommandBufferAllocateInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkCommandPool commandPool;
+ VkCommandBufferLevel level;
+ uint32_t commandBufferCount;
+} VkCommandBufferAllocateInfo;
+
+typedef struct VkCommandBufferInheritanceInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkRenderPass renderPass;
+ uint32_t subpass;
+ VkFramebuffer framebuffer;
+ VkBool32 occlusionQueryEnable;
+ VkQueryControlFlags queryFlags;
+ VkQueryPipelineStatisticFlags pipelineStatistics;
+} VkCommandBufferInheritanceInfo;
+
+typedef struct VkCommandBufferBeginInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkCommandBufferUsageFlags flags;
+ const VkCommandBufferInheritanceInfo* pInheritanceInfo;
+} VkCommandBufferBeginInfo;
+
+typedef struct VkBufferCopy {
+ VkDeviceSize srcOffset;
+ VkDeviceSize dstOffset;
+ VkDeviceSize size;
+} VkBufferCopy;
+
+typedef struct VkImageSubresourceLayers {
+ VkImageAspectFlags aspectMask;
+ uint32_t mipLevel;
+ uint32_t baseArrayLayer;
+ uint32_t layerCount;
+} VkImageSubresourceLayers;
+
+typedef struct VkImageCopy {
+ VkImageSubresourceLayers srcSubresource;
+ VkOffset3D srcOffset;
+ VkImageSubresourceLayers dstSubresource;
+ VkOffset3D dstOffset;
+ VkExtent3D extent;
+} VkImageCopy;
+
+typedef struct VkImageBlit {
+ VkImageSubresourceLayers srcSubresource;
+ VkOffset3D srcOffsets[2];
+ VkImageSubresourceLayers dstSubresource;
+ VkOffset3D dstOffsets[2];
+} VkImageBlit;
+
+typedef struct VkBufferImageCopy {
+ VkDeviceSize bufferOffset;
+ uint32_t bufferRowLength;
+ uint32_t bufferImageHeight;
+ VkImageSubresourceLayers imageSubresource;
+ VkOffset3D imageOffset;
+ VkExtent3D imageExtent;
+} VkBufferImageCopy;
+
+typedef union VkClearColorValue {
+ float float32[4];
+ int32_t int32[4];
+ uint32_t uint32[4];
+} VkClearColorValue;
+
+typedef struct VkClearDepthStencilValue {
+ float depth;
+ uint32_t stencil;
+} VkClearDepthStencilValue;
+
+typedef union VkClearValue {
+ VkClearColorValue color;
+ VkClearDepthStencilValue depthStencil;
+} VkClearValue;
+
+typedef struct VkClearAttachment {
+ VkImageAspectFlags aspectMask;
+ uint32_t colorAttachment;
+ VkClearValue clearValue;
+} VkClearAttachment;
+
+typedef struct VkClearRect {
+ VkRect2D rect;
+ uint32_t baseArrayLayer;
+ uint32_t layerCount;
+} VkClearRect;
+
+typedef struct VkImageResolve {
+ VkImageSubresourceLayers srcSubresource;
+ VkOffset3D srcOffset;
+ VkImageSubresourceLayers dstSubresource;
+ VkOffset3D dstOffset;
+ VkExtent3D extent;
+} VkImageResolve;
+
+typedef struct VkMemoryBarrier {
+ VkStructureType sType;
+ const void* pNext;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+} VkMemoryBarrier;
+
+typedef struct VkBufferMemoryBarrier {
+ VkStructureType sType;
+ const void* pNext;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+ uint32_t srcQueueFamilyIndex;
+ uint32_t dstQueueFamilyIndex;
+ VkBuffer buffer;
+ VkDeviceSize offset;
+ VkDeviceSize size;
+} VkBufferMemoryBarrier;
+
+typedef struct VkImageMemoryBarrier {
+ VkStructureType sType;
+ const void* pNext;
+ VkAccessFlags srcAccessMask;
+ VkAccessFlags dstAccessMask;
+ VkImageLayout oldLayout;
+ VkImageLayout newLayout;
+ uint32_t srcQueueFamilyIndex;
+ uint32_t dstQueueFamilyIndex;
+ VkImage image;
+ VkImageSubresourceRange subresourceRange;
+} VkImageMemoryBarrier;
+
+typedef struct VkRenderPassBeginInfo {
+ VkStructureType sType;
+ const void* pNext;
+ VkRenderPass renderPass;
+ VkFramebuffer framebuffer;
+ VkRect2D renderArea;
+ uint32_t clearValueCount;
+ const VkClearValue* pClearValues;
+} VkRenderPassBeginInfo;
+
+typedef struct VkDispatchIndirectCommand {
+ uint32_t x;
+ uint32_t y;
+ uint32_t z;
+} VkDispatchIndirectCommand;
+
+typedef struct VkDrawIndexedIndirectCommand {
+ uint32_t indexCount;
+ uint32_t instanceCount;
+ uint32_t firstIndex;
+ int32_t vertexOffset;
+ uint32_t firstInstance;
+} VkDrawIndexedIndirectCommand;
+
+typedef struct VkDrawIndirectCommand {
+ uint32_t vertexCount;
+ uint32_t instanceCount;
+ uint32_t firstVertex;
+ uint32_t firstInstance;
+} VkDrawIndirectCommand;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
+typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName);
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
+typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
+typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
+typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
+typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue);
+typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device);
+typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
+typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
+typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory);
+typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes);
+typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
+typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences);
+typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence);
+typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore);
+typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent);
+typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event);
+typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event);
+typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool);
+typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer);
+typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView);
+typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage);
+typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView);
+typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule);
+typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache);
+typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData);
+typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout);
+typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler);
+typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout);
+typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool);
+typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags);
+typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets);
+typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets);
+typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer);
+typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
+typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool);
+typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags);
+typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
+typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer);
+typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags);
+typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
+typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports);
+typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors);
+typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth);
+typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
+typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]);
+typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds);
+typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask);
+typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask);
+typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference);
+typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
+typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
+typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
+typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ);
+typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData);
+typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data);
+typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects);
+typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers);
+typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers);
+typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags);
+typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query);
+typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount);
+typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags);
+typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues);
+typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
+typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents);
+typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer);
+typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
+ const VkInstanceCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkInstance* pInstance);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
+ VkInstance instance,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(
+ VkInstance instance,
+ uint32_t* pPhysicalDeviceCount,
+ VkPhysicalDevice* pPhysicalDevices);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceFeatures* pFeatures);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkFormatProperties* pFormatProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkImageType type,
+ VkImageTiling tiling,
+ VkImageUsageFlags usage,
+ VkImageCreateFlags flags,
+ VkImageFormatProperties* pImageFormatProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceProperties* pProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pQueueFamilyPropertyCount,
+ VkQueueFamilyProperties* pQueueFamilyProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceMemoryProperties* pMemoryProperties);
+
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(
+ VkInstance instance,
+ const char* pName);
+
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(
+ VkDevice device,
+ const char* pName);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
+ VkPhysicalDevice physicalDevice,
+ const VkDeviceCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDevice* pDevice);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(
+ VkDevice device,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(
+ const char* pLayerName,
+ uint32_t* pPropertyCount,
+ VkExtensionProperties* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(
+ VkPhysicalDevice physicalDevice,
+ const char* pLayerName,
+ uint32_t* pPropertyCount,
+ VkExtensionProperties* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(
+ uint32_t* pPropertyCount,
+ VkLayerProperties* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkLayerProperties* pProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(
+ VkDevice device,
+ uint32_t queueFamilyIndex,
+ uint32_t queueIndex,
+ VkQueue* pQueue);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(
+ VkQueue queue,
+ uint32_t submitCount,
+ const VkSubmitInfo* pSubmits,
+ VkFence fence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(
+ VkQueue queue);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(
+ VkDevice device);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(
+ VkDevice device,
+ const VkMemoryAllocateInfo* pAllocateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDeviceMemory* pMemory);
+
+VKAPI_ATTR void VKAPI_CALL vkFreeMemory(
+ VkDevice device,
+ VkDeviceMemory memory,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(
+ VkDevice device,
+ VkDeviceMemory memory,
+ VkDeviceSize offset,
+ VkDeviceSize size,
+ VkMemoryMapFlags flags,
+ void** ppData);
+
+VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(
+ VkDevice device,
+ VkDeviceMemory memory);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(
+ VkDevice device,
+ uint32_t memoryRangeCount,
+ const VkMappedMemoryRange* pMemoryRanges);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(
+ VkDevice device,
+ uint32_t memoryRangeCount,
+ const VkMappedMemoryRange* pMemoryRanges);
+
+VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(
+ VkDevice device,
+ VkDeviceMemory memory,
+ VkDeviceSize* pCommittedMemoryInBytes);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(
+ VkDevice device,
+ VkBuffer buffer,
+ VkDeviceMemory memory,
+ VkDeviceSize memoryOffset);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(
+ VkDevice device,
+ VkImage image,
+ VkDeviceMemory memory,
+ VkDeviceSize memoryOffset);
+
+VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(
+ VkDevice device,
+ VkBuffer buffer,
+ VkMemoryRequirements* pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(
+ VkDevice device,
+ VkImage image,
+ VkMemoryRequirements* pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
+ VkDevice device,
+ VkImage image,
+ uint32_t* pSparseMemoryRequirementCount,
+ VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkImageType type,
+ VkSampleCountFlagBits samples,
+ VkImageUsageFlags usage,
+ VkImageTiling tiling,
+ uint32_t* pPropertyCount,
+ VkSparseImageFormatProperties* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(
+ VkQueue queue,
+ uint32_t bindInfoCount,
+ const VkBindSparseInfo* pBindInfo,
+ VkFence fence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(
+ VkDevice device,
+ const VkFenceCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkFence* pFence);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyFence(
+ VkDevice device,
+ VkFence fence,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(
+ VkDevice device,
+ uint32_t fenceCount,
+ const VkFence* pFences);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(
+ VkDevice device,
+ VkFence fence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(
+ VkDevice device,
+ uint32_t fenceCount,
+ const VkFence* pFences,
+ VkBool32 waitAll,
+ uint64_t timeout);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(
+ VkDevice device,
+ const VkSemaphoreCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSemaphore* pSemaphore);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(
+ VkDevice device,
+ VkSemaphore semaphore,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(
+ VkDevice device,
+ const VkEventCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkEvent* pEvent);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(
+ VkDevice device,
+ VkEvent event,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(
+ VkDevice device,
+ VkEvent event);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(
+ VkDevice device,
+ VkEvent event);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(
+ VkDevice device,
+ VkEvent event);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(
+ VkDevice device,
+ const VkQueryPoolCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkQueryPool* pQueryPool);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(
+ VkDevice device,
+ VkQueryPool queryPool,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(
+ VkDevice device,
+ VkQueryPool queryPool,
+ uint32_t firstQuery,
+ uint32_t queryCount,
+ size_t dataSize,
+ void* pData,
+ VkDeviceSize stride,
+ VkQueryResultFlags flags);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(
+ VkDevice device,
+ const VkBufferCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkBuffer* pBuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(
+ VkDevice device,
+ VkBuffer buffer,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(
+ VkDevice device,
+ const VkBufferViewCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkBufferView* pView);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(
+ VkDevice device,
+ VkBufferView bufferView,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(
+ VkDevice device,
+ const VkImageCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkImage* pImage);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyImage(
+ VkDevice device,
+ VkImage image,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(
+ VkDevice device,
+ VkImage image,
+ const VkImageSubresource* pSubresource,
+ VkSubresourceLayout* pLayout);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(
+ VkDevice device,
+ const VkImageViewCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkImageView* pView);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(
+ VkDevice device,
+ VkImageView imageView,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(
+ VkDevice device,
+ const VkShaderModuleCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkShaderModule* pShaderModule);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(
+ VkDevice device,
+ VkShaderModule shaderModule,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(
+ VkDevice device,
+ const VkPipelineCacheCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkPipelineCache* pPipelineCache);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(
+ VkDevice device,
+ VkPipelineCache pipelineCache,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(
+ VkDevice device,
+ VkPipelineCache pipelineCache,
+ size_t* pDataSize,
+ void* pData);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(
+ VkDevice device,
+ VkPipelineCache dstCache,
+ uint32_t srcCacheCount,
+ const VkPipelineCache* pSrcCaches);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(
+ VkDevice device,
+ VkPipelineCache pipelineCache,
+ uint32_t createInfoCount,
+ const VkGraphicsPipelineCreateInfo* pCreateInfos,
+ const VkAllocationCallbacks* pAllocator,
+ VkPipeline* pPipelines);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(
+ VkDevice device,
+ VkPipelineCache pipelineCache,
+ uint32_t createInfoCount,
+ const VkComputePipelineCreateInfo* pCreateInfos,
+ const VkAllocationCallbacks* pAllocator,
+ VkPipeline* pPipelines);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(
+ VkDevice device,
+ VkPipeline pipeline,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(
+ VkDevice device,
+ const VkPipelineLayoutCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkPipelineLayout* pPipelineLayout);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(
+ VkDevice device,
+ VkPipelineLayout pipelineLayout,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(
+ VkDevice device,
+ const VkSamplerCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSampler* pSampler);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroySampler(
+ VkDevice device,
+ VkSampler sampler,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(
+ VkDevice device,
+ const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDescriptorSetLayout* pSetLayout);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(
+ VkDevice device,
+ VkDescriptorSetLayout descriptorSetLayout,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(
+ VkDevice device,
+ const VkDescriptorPoolCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDescriptorPool* pDescriptorPool);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(
+ VkDevice device,
+ VkDescriptorPool descriptorPool,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(
+ VkDevice device,
+ VkDescriptorPool descriptorPool,
+ VkDescriptorPoolResetFlags flags);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(
+ VkDevice device,
+ const VkDescriptorSetAllocateInfo* pAllocateInfo,
+ VkDescriptorSet* pDescriptorSets);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(
+ VkDevice device,
+ VkDescriptorPool descriptorPool,
+ uint32_t descriptorSetCount,
+ const VkDescriptorSet* pDescriptorSets);
+
+VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(
+ VkDevice device,
+ uint32_t descriptorWriteCount,
+ const VkWriteDescriptorSet* pDescriptorWrites,
+ uint32_t descriptorCopyCount,
+ const VkCopyDescriptorSet* pDescriptorCopies);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(
+ VkDevice device,
+ const VkFramebufferCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkFramebuffer* pFramebuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(
+ VkDevice device,
+ VkFramebuffer framebuffer,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(
+ VkDevice device,
+ const VkRenderPassCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkRenderPass* pRenderPass);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(
+ VkDevice device,
+ VkRenderPass renderPass,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(
+ VkDevice device,
+ VkRenderPass renderPass,
+ VkExtent2D* pGranularity);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(
+ VkDevice device,
+ const VkCommandPoolCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkCommandPool* pCommandPool);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(
+ VkDevice device,
+ VkCommandPool commandPool,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(
+ VkDevice device,
+ VkCommandPool commandPool,
+ VkCommandPoolResetFlags flags);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(
+ VkDevice device,
+ const VkCommandBufferAllocateInfo* pAllocateInfo,
+ VkCommandBuffer* pCommandBuffers);
+
+VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(
+ VkDevice device,
+ VkCommandPool commandPool,
+ uint32_t commandBufferCount,
+ const VkCommandBuffer* pCommandBuffers);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(
+ VkCommandBuffer commandBuffer,
+ const VkCommandBufferBeginInfo* pBeginInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(
+ VkCommandBuffer commandBuffer);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(
+ VkCommandBuffer commandBuffer,
+ VkCommandBufferResetFlags flags);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(
+ VkCommandBuffer commandBuffer,
+ VkPipelineBindPoint pipelineBindPoint,
+ VkPipeline pipeline);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstViewport,
+ uint32_t viewportCount,
+ const VkViewport* pViewports);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstScissor,
+ uint32_t scissorCount,
+ const VkRect2D* pScissors);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(
+ VkCommandBuffer commandBuffer,
+ float lineWidth);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(
+ VkCommandBuffer commandBuffer,
+ float depthBiasConstantFactor,
+ float depthBiasClamp,
+ float depthBiasSlopeFactor);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(
+ VkCommandBuffer commandBuffer,
+ const float blendConstants[4]);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(
+ VkCommandBuffer commandBuffer,
+ float minDepthBounds,
+ float maxDepthBounds);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(
+ VkCommandBuffer commandBuffer,
+ VkStencilFaceFlags faceMask,
+ uint32_t compareMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(
+ VkCommandBuffer commandBuffer,
+ VkStencilFaceFlags faceMask,
+ uint32_t writeMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(
+ VkCommandBuffer commandBuffer,
+ VkStencilFaceFlags faceMask,
+ uint32_t reference);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
+ VkCommandBuffer commandBuffer,
+ VkPipelineBindPoint pipelineBindPoint,
+ VkPipelineLayout layout,
+ uint32_t firstSet,
+ uint32_t descriptorSetCount,
+ const VkDescriptorSet* pDescriptorSets,
+ uint32_t dynamicOffsetCount,
+ const uint32_t* pDynamicOffsets);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkIndexType indexType);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstBinding,
+ uint32_t bindingCount,
+ const VkBuffer* pBuffers,
+ const VkDeviceSize* pOffsets);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDraw(
+ VkCommandBuffer commandBuffer,
+ uint32_t vertexCount,
+ uint32_t instanceCount,
+ uint32_t firstVertex,
+ uint32_t firstInstance);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(
+ VkCommandBuffer commandBuffer,
+ uint32_t indexCount,
+ uint32_t instanceCount,
+ uint32_t firstIndex,
+ int32_t vertexOffset,
+ uint32_t firstInstance);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ uint32_t drawCount,
+ uint32_t stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ uint32_t drawCount,
+ uint32_t stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(
+ VkCommandBuffer commandBuffer,
+ uint32_t groupCountX,
+ uint32_t groupCountY,
+ uint32_t groupCountZ);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(
+ VkCommandBuffer commandBuffer,
+ VkBuffer srcBuffer,
+ VkBuffer dstBuffer,
+ uint32_t regionCount,
+ const VkBufferCopy* pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(
+ VkCommandBuffer commandBuffer,
+ VkImage srcImage,
+ VkImageLayout srcImageLayout,
+ VkImage dstImage,
+ VkImageLayout dstImageLayout,
+ uint32_t regionCount,
+ const VkImageCopy* pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(
+ VkCommandBuffer commandBuffer,
+ VkImage srcImage,
+ VkImageLayout srcImageLayout,
+ VkImage dstImage,
+ VkImageLayout dstImageLayout,
+ uint32_t regionCount,
+ const VkImageBlit* pRegions,
+ VkFilter filter);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(
+ VkCommandBuffer commandBuffer,
+ VkBuffer srcBuffer,
+ VkImage dstImage,
+ VkImageLayout dstImageLayout,
+ uint32_t regionCount,
+ const VkBufferImageCopy* pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(
+ VkCommandBuffer commandBuffer,
+ VkImage srcImage,
+ VkImageLayout srcImageLayout,
+ VkBuffer dstBuffer,
+ uint32_t regionCount,
+ const VkBufferImageCopy* pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(
+ VkCommandBuffer commandBuffer,
+ VkBuffer dstBuffer,
+ VkDeviceSize dstOffset,
+ VkDeviceSize dataSize,
+ const void* pData);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(
+ VkCommandBuffer commandBuffer,
+ VkBuffer dstBuffer,
+ VkDeviceSize dstOffset,
+ VkDeviceSize size,
+ uint32_t data);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(
+ VkCommandBuffer commandBuffer,
+ VkImage image,
+ VkImageLayout imageLayout,
+ const VkClearColorValue* pColor,
+ uint32_t rangeCount,
+ const VkImageSubresourceRange* pRanges);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(
+ VkCommandBuffer commandBuffer,
+ VkImage image,
+ VkImageLayout imageLayout,
+ const VkClearDepthStencilValue* pDepthStencil,
+ uint32_t rangeCount,
+ const VkImageSubresourceRange* pRanges);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(
+ VkCommandBuffer commandBuffer,
+ uint32_t attachmentCount,
+ const VkClearAttachment* pAttachments,
+ uint32_t rectCount,
+ const VkClearRect* pRects);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(
+ VkCommandBuffer commandBuffer,
+ VkImage srcImage,
+ VkImageLayout srcImageLayout,
+ VkImage dstImage,
+ VkImageLayout dstImageLayout,
+ uint32_t regionCount,
+ const VkImageResolve* pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(
+ VkCommandBuffer commandBuffer,
+ VkEvent event,
+ VkPipelineStageFlags stageMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(
+ VkCommandBuffer commandBuffer,
+ VkEvent event,
+ VkPipelineStageFlags stageMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(
+ VkCommandBuffer commandBuffer,
+ uint32_t eventCount,
+ const VkEvent* pEvents,
+ VkPipelineStageFlags srcStageMask,
+ VkPipelineStageFlags dstStageMask,
+ uint32_t memoryBarrierCount,
+ const VkMemoryBarrier* pMemoryBarriers,
+ uint32_t bufferMemoryBarrierCount,
+ const VkBufferMemoryBarrier* pBufferMemoryBarriers,
+ uint32_t imageMemoryBarrierCount,
+ const VkImageMemoryBarrier* pImageMemoryBarriers);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
+ VkCommandBuffer commandBuffer,
+ VkPipelineStageFlags srcStageMask,
+ VkPipelineStageFlags dstStageMask,
+ VkDependencyFlags dependencyFlags,
+ uint32_t memoryBarrierCount,
+ const VkMemoryBarrier* pMemoryBarriers,
+ uint32_t bufferMemoryBarrierCount,
+ const VkBufferMemoryBarrier* pBufferMemoryBarriers,
+ uint32_t imageMemoryBarrierCount,
+ const VkImageMemoryBarrier* pImageMemoryBarriers);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(
+ VkCommandBuffer commandBuffer,
+ VkQueryPool queryPool,
+ uint32_t query,
+ VkQueryControlFlags flags);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(
+ VkCommandBuffer commandBuffer,
+ VkQueryPool queryPool,
+ uint32_t query);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(
+ VkCommandBuffer commandBuffer,
+ VkQueryPool queryPool,
+ uint32_t firstQuery,
+ uint32_t queryCount);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(
+ VkCommandBuffer commandBuffer,
+ VkPipelineStageFlagBits pipelineStage,
+ VkQueryPool queryPool,
+ uint32_t query);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(
+ VkCommandBuffer commandBuffer,
+ VkQueryPool queryPool,
+ uint32_t firstQuery,
+ uint32_t queryCount,
+ VkBuffer dstBuffer,
+ VkDeviceSize dstOffset,
+ VkDeviceSize stride,
+ VkQueryResultFlags flags);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(
+ VkCommandBuffer commandBuffer,
+ VkPipelineLayout layout,
+ VkShaderStageFlags stageFlags,
+ uint32_t offset,
+ uint32_t size,
+ const void* pValues);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(
+ VkCommandBuffer commandBuffer,
+ const VkRenderPassBeginInfo* pRenderPassBegin,
+ VkSubpassContents contents);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(
+ VkCommandBuffer commandBuffer,
+ VkSubpassContents contents);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(
+ VkCommandBuffer commandBuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(
+ VkCommandBuffer commandBuffer,
+ uint32_t commandBufferCount,
+ const VkCommandBuffer* pCommandBuffers);
+#endif
+
+#define VK_KHR_surface 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#define VK_KHR_SURFACE_SPEC_VERSION 25
+#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
+#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
+
+
+typedef enum VkColorSpaceKHR {
+ VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0,
+ VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001,
+ VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002,
+ VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104003,
+ VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004,
+ VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005,
+ VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006,
+ VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007,
+ VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008,
+ VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009,
+ VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010,
+ VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011,
+ VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012,
+ VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013,
+ VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014,
+ VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
+ VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
+ VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
+ VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkColorSpaceKHR;
+
+typedef enum VkPresentModeKHR {
+ VK_PRESENT_MODE_IMMEDIATE_KHR = 0,
+ VK_PRESENT_MODE_MAILBOX_KHR = 1,
+ VK_PRESENT_MODE_FIFO_KHR = 2,
+ VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3,
+ VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000,
+ VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001,
+ VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR,
+ VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
+ VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
+ VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkPresentModeKHR;
+
+
+typedef enum VkSurfaceTransformFlagBitsKHR {
+ VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001,
+ VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002,
+ VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004,
+ VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008,
+ VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010,
+ VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020,
+ VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
+ VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
+ VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
+ VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkSurfaceTransformFlagBitsKHR;
+typedef VkFlags VkSurfaceTransformFlagsKHR;
+
+typedef enum VkCompositeAlphaFlagBitsKHR {
+ VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
+ VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
+ VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
+ VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
+ VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkCompositeAlphaFlagBitsKHR;
+typedef VkFlags VkCompositeAlphaFlagsKHR;
+
+typedef struct VkSurfaceCapabilitiesKHR {
+ uint32_t minImageCount;
+ uint32_t maxImageCount;
+ VkExtent2D currentExtent;
+ VkExtent2D minImageExtent;
+ VkExtent2D maxImageExtent;
+ uint32_t maxImageArrayLayers;
+ VkSurfaceTransformFlagsKHR supportedTransforms;
+ VkSurfaceTransformFlagBitsKHR currentTransform;
+ VkCompositeAlphaFlagsKHR supportedCompositeAlpha;
+ VkImageUsageFlags supportedUsageFlags;
+} VkSurfaceCapabilitiesKHR;
+
+typedef struct VkSurfaceFormatKHR {
+ VkFormat format;
+ VkColorSpaceKHR colorSpace;
+} VkSurfaceFormatKHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(
+ VkInstance instance,
+ VkSurfaceKHR surface,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ VkSurfaceKHR surface,
+ VkBool32* pSupported);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
+ VkPhysicalDevice physicalDevice,
+ VkSurfaceKHR surface,
+ VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(
+ VkPhysicalDevice physicalDevice,
+ VkSurfaceKHR surface,
+ uint32_t* pSurfaceFormatCount,
+ VkSurfaceFormatKHR* pSurfaceFormats);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(
+ VkPhysicalDevice physicalDevice,
+ VkSurfaceKHR surface,
+ uint32_t* pPresentModeCount,
+ VkPresentModeKHR* pPresentModes);
+#endif
+
+#define VK_KHR_swapchain 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR)
+
+#define VK_KHR_SWAPCHAIN_SPEC_VERSION 68
+#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
+
+
+typedef enum VkSwapchainCreateFlagBitsKHR {
+ VK_SWAPCHAIN_CREATE_BIND_SFR_BIT_KHX = 0x00000001,
+ VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkSwapchainCreateFlagBitsKHR;
+typedef VkFlags VkSwapchainCreateFlagsKHR;
+
+typedef struct VkSwapchainCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkSwapchainCreateFlagsKHR flags;
+ VkSurfaceKHR surface;
+ uint32_t minImageCount;
+ VkFormat imageFormat;
+ VkColorSpaceKHR imageColorSpace;
+ VkExtent2D imageExtent;
+ uint32_t imageArrayLayers;
+ VkImageUsageFlags imageUsage;
+ VkSharingMode imageSharingMode;
+ uint32_t queueFamilyIndexCount;
+ const uint32_t* pQueueFamilyIndices;
+ VkSurfaceTransformFlagBitsKHR preTransform;
+ VkCompositeAlphaFlagBitsKHR compositeAlpha;
+ VkPresentModeKHR presentMode;
+ VkBool32 clipped;
+ VkSwapchainKHR oldSwapchain;
+} VkSwapchainCreateInfoKHR;
+
+typedef struct VkPresentInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreCount;
+ const VkSemaphore* pWaitSemaphores;
+ uint32_t swapchainCount;
+ const VkSwapchainKHR* pSwapchains;
+ const uint32_t* pImageIndices;
+ VkResult* pResults;
+} VkPresentInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain);
+typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages);
+typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex);
+typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
+ VkDevice device,
+ const VkSwapchainCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSwapchainKHR* pSwapchain);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint32_t* pSwapchainImageCount,
+ VkImage* pSwapchainImages);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ VkFence fence,
+ uint32_t* pImageIndex);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(
+ VkQueue queue,
+ const VkPresentInfoKHR* pPresentInfo);
+#endif
+
+#define VK_KHR_display 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR)
+
+#define VK_KHR_DISPLAY_SPEC_VERSION 21
+#define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display"
+
+
+typedef enum VkDisplayPlaneAlphaFlagBitsKHR {
+ VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
+ VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
+ VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
+ VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
+ VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkDisplayPlaneAlphaFlagBitsKHR;
+typedef VkFlags VkDisplayPlaneAlphaFlagsKHR;
+typedef VkFlags VkDisplayModeCreateFlagsKHR;
+typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;
+
+typedef struct VkDisplayPropertiesKHR {
+ VkDisplayKHR display;
+ const char* displayName;
+ VkExtent2D physicalDimensions;
+ VkExtent2D physicalResolution;
+ VkSurfaceTransformFlagsKHR supportedTransforms;
+ VkBool32 planeReorderPossible;
+ VkBool32 persistentContent;
+} VkDisplayPropertiesKHR;
+
+typedef struct VkDisplayModeParametersKHR {
+ VkExtent2D visibleRegion;
+ uint32_t refreshRate;
+} VkDisplayModeParametersKHR;
+
+typedef struct VkDisplayModePropertiesKHR {
+ VkDisplayModeKHR displayMode;
+ VkDisplayModeParametersKHR parameters;
+} VkDisplayModePropertiesKHR;
+
+typedef struct VkDisplayModeCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplayModeCreateFlagsKHR flags;
+ VkDisplayModeParametersKHR parameters;
+} VkDisplayModeCreateInfoKHR;
+
+typedef struct VkDisplayPlaneCapabilitiesKHR {
+ VkDisplayPlaneAlphaFlagsKHR supportedAlpha;
+ VkOffset2D minSrcPosition;
+ VkOffset2D maxSrcPosition;
+ VkExtent2D minSrcExtent;
+ VkExtent2D maxSrcExtent;
+ VkOffset2D minDstPosition;
+ VkOffset2D maxDstPosition;
+ VkExtent2D minDstExtent;
+ VkExtent2D maxDstExtent;
+} VkDisplayPlaneCapabilitiesKHR;
+
+typedef struct VkDisplayPlanePropertiesKHR {
+ VkDisplayKHR currentDisplay;
+ uint32_t currentStackIndex;
+} VkDisplayPlanePropertiesKHR;
+
+typedef struct VkDisplaySurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplaySurfaceCreateFlagsKHR flags;
+ VkDisplayModeKHR displayMode;
+ uint32_t planeIndex;
+ uint32_t planeStackIndex;
+ VkSurfaceTransformFlagBitsKHR transform;
+ float globalAlpha;
+ VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
+ VkExtent2D imageExtent;
+} VkDisplaySurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkDisplayPropertiesKHR* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkDisplayPlanePropertiesKHR* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t planeIndex,
+ uint32_t* pDisplayCount,
+ VkDisplayKHR* pDisplays);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayKHR display,
+ uint32_t* pPropertyCount,
+ VkDisplayModePropertiesKHR* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayKHR display,
+ const VkDisplayModeCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDisplayModeKHR* pMode);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayModeKHR mode,
+ uint32_t planeIndex,
+ VkDisplayPlaneCapabilitiesKHR* pCapabilities);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR(
+ VkInstance instance,
+ const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+#endif
+
+#define VK_KHR_display_swapchain 1
+#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9
+#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain"
+
+typedef struct VkDisplayPresentInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkRect2D srcRect;
+ VkRect2D dstRect;
+ VkBool32 persistent;
+} VkDisplayPresentInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(
+ VkDevice device,
+ uint32_t swapchainCount,
+ const VkSwapchainCreateInfoKHR* pCreateInfos,
+ const VkAllocationCallbacks* pAllocator,
+ VkSwapchainKHR* pSwapchains);
+#endif
+
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+#define VK_KHR_xlib_surface 1
+#include <X11/Xlib.h>
+
+#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
+#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
+
+typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
+
+typedef struct VkXlibSurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkXlibSurfaceCreateFlagsKHR flags;
+ Display* dpy;
+ Window window;
+} VkXlibSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
+ VkInstance instance,
+ const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ Display* dpy,
+ VisualID visualID);
+#endif
+#endif /* VK_USE_PLATFORM_XLIB_KHR */
+
+#ifdef VK_USE_PLATFORM_XCB_KHR
+#define VK_KHR_xcb_surface 1
+#include <xcb/xcb.h>
+
+#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
+#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
+
+typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
+
+typedef struct VkXcbSurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkXcbSurfaceCreateFlagsKHR flags;
+ xcb_connection_t* connection;
+ xcb_window_t window;
+} VkXcbSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
+ VkInstance instance,
+ const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ xcb_connection_t* connection,
+ xcb_visualid_t visual_id);
+#endif
+#endif /* VK_USE_PLATFORM_XCB_KHR */
+
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+#define VK_KHR_wayland_surface 1
+#include <wayland-client.h>
+
+#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
+#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
+
+typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
+
+typedef struct VkWaylandSurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkWaylandSurfaceCreateFlagsKHR flags;
+ struct wl_display* display;
+ struct wl_surface* surface;
+} VkWaylandSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
+ VkInstance instance,
+ const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ struct wl_display* display);
+#endif
+#endif /* VK_USE_PLATFORM_WAYLAND_KHR */
+
+#ifdef VK_USE_PLATFORM_MIR_KHR
+#define VK_KHR_mir_surface 1
+#include <mir_toolkit/client_types.h>
+
+#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4
+#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface"
+
+typedef VkFlags VkMirSurfaceCreateFlagsKHR;
+
+typedef struct VkMirSurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkMirSurfaceCreateFlagsKHR flags;
+ MirConnection* connection;
+ MirSurface* mirSurface;
+} VkMirSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(
+ VkInstance instance,
+ const VkMirSurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ MirConnection* connection);
+#endif
+#endif /* VK_USE_PLATFORM_MIR_KHR */
+
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+#define VK_KHR_android_surface 1
+#include <android/native_window.h>
+
+#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
+#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
+
+typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
+
+typedef struct VkAndroidSurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkAndroidSurfaceCreateFlagsKHR flags;
+ ANativeWindow* window;
+} VkAndroidSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
+ VkInstance instance,
+ const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+#endif
+#endif /* VK_USE_PLATFORM_ANDROID_KHR */
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_KHR_win32_surface 1
+#include <windows.h>
+
+#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
+#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
+
+typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
+
+typedef struct VkWin32SurfaceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkWin32SurfaceCreateFlagsKHR flags;
+ HINSTANCE hinstance;
+ HWND hwnd;
+} VkWin32SurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
+ VkInstance instance,
+ const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex);
+#endif
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_KHR_sampler_mirror_clamp_to_edge 1
+#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
+#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge"
+
+
+#define VK_KHR_get_physical_device_properties2 1
+#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1
+#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2"
+
+typedef struct VkPhysicalDeviceFeatures2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkPhysicalDeviceFeatures features;
+} VkPhysicalDeviceFeatures2KHR;
+
+typedef struct VkPhysicalDeviceProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkPhysicalDeviceProperties properties;
+} VkPhysicalDeviceProperties2KHR;
+
+typedef struct VkFormatProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkFormatProperties formatProperties;
+} VkFormatProperties2KHR;
+
+typedef struct VkImageFormatProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkImageFormatProperties imageFormatProperties;
+} VkImageFormatProperties2KHR;
+
+typedef struct VkPhysicalDeviceImageFormatInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkFormat format;
+ VkImageType type;
+ VkImageTiling tiling;
+ VkImageUsageFlags usage;
+ VkImageCreateFlags flags;
+} VkPhysicalDeviceImageFormatInfo2KHR;
+
+typedef struct VkQueueFamilyProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkQueueFamilyProperties queueFamilyProperties;
+} VkQueueFamilyProperties2KHR;
+
+typedef struct VkPhysicalDeviceMemoryProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkPhysicalDeviceMemoryProperties memoryProperties;
+} VkPhysicalDeviceMemoryProperties2KHR;
+
+typedef struct VkSparseImageFormatProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkSparseImageFormatProperties properties;
+} VkSparseImageFormatProperties2KHR;
+
+typedef struct VkPhysicalDeviceSparseImageFormatInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkFormat format;
+ VkImageType type;
+ VkSampleCountFlagBits samples;
+ VkImageUsageFlags usage;
+ VkImageTiling tiling;
+} VkPhysicalDeviceSparseImageFormatInfo2KHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR* pFeatures);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR* pProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, VkImageFormatProperties2KHR* pImageFormatProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR* pQueueFamilyProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2KHR* pProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceFeatures2KHR* pFeatures);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceProperties2KHR* pProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkFormatProperties2KHR* pFormatProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
+ VkImageFormatProperties2KHR* pImageFormatProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pQueueFamilyPropertyCount,
+ VkQueueFamilyProperties2KHR* pQueueFamilyProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo,
+ uint32_t* pPropertyCount,
+ VkSparseImageFormatProperties2KHR* pProperties);
+#endif
+
+#define VK_KHR_shader_draw_parameters 1
+#define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1
+#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters"
+
+
+#define VK_KHR_maintenance1 1
+#define VK_KHR_MAINTENANCE1_SPEC_VERSION 1
+#define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1"
+
+typedef VkFlags VkCommandPoolTrimFlagsKHR;
+
+typedef void (VKAPI_PTR *PFN_vkTrimCommandPoolKHR)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR(
+ VkDevice device,
+ VkCommandPool commandPool,
+ VkCommandPoolTrimFlagsKHR flags);
+#endif
+
+#define VK_KHR_external_memory_capabilities 1
+#define VK_LUID_SIZE_KHR 8
+#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities"
+
+
+typedef enum VkExternalMemoryHandleTypeFlagBitsKHR {
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = 0x00000008,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkExternalMemoryHandleTypeFlagBitsKHR;
+typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR;
+
+typedef enum VkExternalMemoryFeatureFlagBitsKHR {
+ VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = 0x00000001,
+ VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = 0x00000002,
+ VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = 0x00000004,
+ VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkExternalMemoryFeatureFlagBitsKHR;
+typedef VkFlags VkExternalMemoryFeatureFlagsKHR;
+
+typedef struct VkExternalMemoryPropertiesKHR {
+ VkExternalMemoryFeatureFlagsKHR externalMemoryFeatures;
+ VkExternalMemoryHandleTypeFlagsKHR exportFromImportedHandleTypes;
+ VkExternalMemoryHandleTypeFlagsKHR compatibleHandleTypes;
+} VkExternalMemoryPropertiesKHR;
+
+typedef struct VkPhysicalDeviceExternalImageFormatInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType;
+} VkPhysicalDeviceExternalImageFormatInfoKHR;
+
+typedef struct VkExternalImageFormatPropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkExternalMemoryPropertiesKHR externalMemoryProperties;
+} VkExternalImageFormatPropertiesKHR;
+
+typedef struct VkPhysicalDeviceExternalBufferInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkBufferCreateFlags flags;
+ VkBufferUsageFlags usage;
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType;
+} VkPhysicalDeviceExternalBufferInfoKHR;
+
+typedef struct VkExternalBufferPropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkExternalMemoryPropertiesKHR externalMemoryProperties;
+} VkExternalBufferPropertiesKHR;
+
+typedef struct VkPhysicalDeviceIDPropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ uint8_t deviceUUID[VK_UUID_SIZE];
+ uint8_t driverUUID[VK_UUID_SIZE];
+ uint8_t deviceLUID[VK_LUID_SIZE_KHR];
+ uint32_t deviceNodeMask;
+ VkBool32 deviceLUIDValid;
+} VkPhysicalDeviceIDPropertiesKHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, VkExternalBufferPropertiesKHR* pExternalBufferProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo,
+ VkExternalBufferPropertiesKHR* pExternalBufferProperties);
+#endif
+
+#define VK_KHR_external_memory 1
+#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory"
+#define VK_QUEUE_FAMILY_EXTERNAL_KHR (~0U-1)
+
+typedef struct VkExternalMemoryImageCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagsKHR handleTypes;
+} VkExternalMemoryImageCreateInfoKHR;
+
+typedef struct VkExternalMemoryBufferCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagsKHR handleTypes;
+} VkExternalMemoryBufferCreateInfoKHR;
+
+typedef struct VkExportMemoryAllocateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagsKHR handleTypes;
+} VkExportMemoryAllocateInfoKHR;
+
+
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_KHR_external_memory_win32 1
+#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
+
+typedef struct VkImportMemoryWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType;
+ HANDLE handle;
+ LPCWSTR name;
+} VkImportMemoryWin32HandleInfoKHR;
+
+typedef struct VkExportMemoryWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ const SECURITY_ATTRIBUTES* pAttributes;
+ DWORD dwAccess;
+ LPCWSTR name;
+} VkExportMemoryWin32HandleInfoKHR;
+
+typedef struct VkMemoryWin32HandlePropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t memoryTypeBits;
+} VkMemoryWin32HandlePropertiesKHR;
+
+typedef struct VkMemoryGetWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceMemory memory;
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType;
+} VkMemoryGetWin32HandleInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(
+ VkDevice device,
+ const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
+ HANDLE* pHandle);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
+ VkDevice device,
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType,
+ HANDLE handle,
+ VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
+#endif
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_KHR_external_memory_fd 1
+#define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd"
+
+typedef struct VkImportMemoryFdInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType;
+ int fd;
+} VkImportMemoryFdInfoKHR;
+
+typedef struct VkMemoryFdPropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t memoryTypeBits;
+} VkMemoryFdPropertiesKHR;
+
+typedef struct VkMemoryGetFdInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceMemory memory;
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType;
+} VkMemoryGetFdInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHR)(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd);
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR(
+ VkDevice device,
+ const VkMemoryGetFdInfoKHR* pGetFdInfo,
+ int* pFd);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR(
+ VkDevice device,
+ VkExternalMemoryHandleTypeFlagBitsKHR handleType,
+ int fd,
+ VkMemoryFdPropertiesKHR* pMemoryFdProperties);
+#endif
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_KHR_win32_keyed_mutex 1
+#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
+#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
+
+typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t acquireCount;
+ const VkDeviceMemory* pAcquireSyncs;
+ const uint64_t* pAcquireKeys;
+ const uint32_t* pAcquireTimeouts;
+ uint32_t releaseCount;
+ const VkDeviceMemory* pReleaseSyncs;
+ const uint64_t* pReleaseKeys;
+} VkWin32KeyedMutexAcquireReleaseInfoKHR;
+
+
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_KHR_external_semaphore_capabilities 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities"
+
+
+typedef enum VkExternalSemaphoreHandleTypeFlagBitsKHR {
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001,
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002,
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004,
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 0x00000008,
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000010,
+ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkExternalSemaphoreHandleTypeFlagBitsKHR;
+typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHR;
+
+typedef enum VkExternalSemaphoreFeatureFlagBitsKHR {
+ VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001,
+ VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002,
+ VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkExternalSemaphoreFeatureFlagBitsKHR;
+typedef VkFlags VkExternalSemaphoreFeatureFlagsKHR;
+
+typedef struct VkPhysicalDeviceExternalSemaphoreInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalSemaphoreHandleTypeFlagBitsKHR handleType;
+} VkPhysicalDeviceExternalSemaphoreInfoKHR;
+
+typedef struct VkExternalSemaphorePropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkExternalSemaphoreHandleTypeFlagsKHR exportFromImportedHandleTypes;
+ VkExternalSemaphoreHandleTypeFlagsKHR compatibleHandleTypes;
+ VkExternalSemaphoreFeatureFlagsKHR externalSemaphoreFeatures;
+} VkExternalSemaphorePropertiesKHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo,
+ VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties);
+#endif
+
+#define VK_KHR_external_semaphore 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore"
+
+
+typedef enum VkSemaphoreImportFlagBitsKHR {
+ VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001,
+ VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkSemaphoreImportFlagBitsKHR;
+typedef VkFlags VkSemaphoreImportFlagsKHR;
+
+typedef struct VkExportSemaphoreCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalSemaphoreHandleTypeFlagsKHR handleTypes;
+} VkExportSemaphoreCreateInfoKHR;
+
+
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_KHR_external_semaphore_win32 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
+
+typedef struct VkImportSemaphoreWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkSemaphore semaphore;
+ VkSemaphoreImportFlagsKHR flags;
+ VkExternalSemaphoreHandleTypeFlagBitsKHR handleType;
+ HANDLE handle;
+ LPCWSTR name;
+} VkImportSemaphoreWin32HandleInfoKHR;
+
+typedef struct VkExportSemaphoreWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ const SECURITY_ATTRIBUTES* pAttributes;
+ DWORD dwAccess;
+ LPCWSTR name;
+} VkExportSemaphoreWin32HandleInfoKHR;
+
+typedef struct VkD3D12FenceSubmitInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreValuesCount;
+ const uint64_t* pWaitSemaphoreValues;
+ uint32_t signalSemaphoreValuesCount;
+ const uint64_t* pSignalSemaphoreValues;
+} VkD3D12FenceSubmitInfoKHR;
+
+typedef struct VkSemaphoreGetWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkSemaphore semaphore;
+ VkExternalSemaphoreHandleTypeFlagBitsKHR handleType;
+} VkSemaphoreGetWin32HandleInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR(
+ VkDevice device,
+ const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
+ VkDevice device,
+ const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
+ HANDLE* pHandle);
+#endif
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_KHR_external_semaphore_fd 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd"
+
+typedef struct VkImportSemaphoreFdInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkSemaphore semaphore;
+ VkSemaphoreImportFlagsKHR flags;
+ VkExternalSemaphoreHandleTypeFlagBitsKHR handleType;
+ int fd;
+} VkImportSemaphoreFdInfoKHR;
+
+typedef struct VkSemaphoreGetFdInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkSemaphore semaphore;
+ VkExternalSemaphoreHandleTypeFlagBitsKHR handleType;
+} VkSemaphoreGetFdInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHR)(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHR)(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR(
+ VkDevice device,
+ const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR(
+ VkDevice device,
+ const VkSemaphoreGetFdInfoKHR* pGetFdInfo,
+ int* pFd);
+#endif
+
+#define VK_KHR_push_descriptor 1
+#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 1
+#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor"
+
+typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t maxPushDescriptors;
+} VkPhysicalDevicePushDescriptorPropertiesKHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetKHR)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR(
+ VkCommandBuffer commandBuffer,
+ VkPipelineBindPoint pipelineBindPoint,
+ VkPipelineLayout layout,
+ uint32_t set,
+ uint32_t descriptorWriteCount,
+ const VkWriteDescriptorSet* pDescriptorWrites);
+#endif
+
+#define VK_KHR_16bit_storage 1
+#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1
+#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage"
+
+typedef struct VkPhysicalDevice16BitStorageFeaturesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 storageBuffer16BitAccess;
+ VkBool32 uniformAndStorageBuffer16BitAccess;
+ VkBool32 storagePushConstant16;
+ VkBool32 storageInputOutput16;
+} VkPhysicalDevice16BitStorageFeaturesKHR;
+
+
+
+#define VK_KHR_incremental_present 1
+#define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1
+#define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present"
+
+typedef struct VkRectLayerKHR {
+ VkOffset2D offset;
+ VkExtent2D extent;
+ uint32_t layer;
+} VkRectLayerKHR;
+
+typedef struct VkPresentRegionKHR {
+ uint32_t rectangleCount;
+ const VkRectLayerKHR* pRectangles;
+} VkPresentRegionKHR;
+
+typedef struct VkPresentRegionsKHR {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t swapchainCount;
+ const VkPresentRegionKHR* pRegions;
+} VkPresentRegionsKHR;
+
+
+
+#define VK_KHR_descriptor_update_template 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplateKHR)
+
+#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION 1
+#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME "VK_KHR_descriptor_update_template"
+
+
+typedef enum VkDescriptorUpdateTemplateTypeKHR {
+ VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = 0,
+ VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1,
+ VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR,
+ VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR,
+ VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE_KHR = (VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR + 1),
+ VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkDescriptorUpdateTemplateTypeKHR;
+
+typedef VkFlags VkDescriptorUpdateTemplateCreateFlagsKHR;
+
+typedef struct VkDescriptorUpdateTemplateEntryKHR {
+ uint32_t dstBinding;
+ uint32_t dstArrayElement;
+ uint32_t descriptorCount;
+ VkDescriptorType descriptorType;
+ size_t offset;
+ size_t stride;
+} VkDescriptorUpdateTemplateEntryKHR;
+
+typedef struct VkDescriptorUpdateTemplateCreateInfoKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkDescriptorUpdateTemplateCreateFlagsKHR flags;
+ uint32_t descriptorUpdateEntryCount;
+ const VkDescriptorUpdateTemplateEntryKHR* pDescriptorUpdateEntries;
+ VkDescriptorUpdateTemplateTypeKHR templateType;
+ VkDescriptorSetLayout descriptorSetLayout;
+ VkPipelineBindPoint pipelineBindPoint;
+ VkPipelineLayout pipelineLayout;
+ uint32_t set;
+} VkDescriptorUpdateTemplateCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplateKHR)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate);
+typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void* pData);
+typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR(
+ VkDevice device,
+ const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR(
+ VkDevice device,
+ VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR(
+ VkDevice device,
+ VkDescriptorSet descriptorSet,
+ VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate,
+ const void* pData);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR(
+ VkCommandBuffer commandBuffer,
+ VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate,
+ VkPipelineLayout layout,
+ uint32_t set,
+ const void* pData);
+#endif
+
+#define VK_KHR_shared_presentable_image 1
+#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1
+#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image"
+
+typedef struct VkSharedPresentSurfaceCapabilitiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkImageUsageFlags sharedPresentSupportedUsageFlags;
+} VkSharedPresentSurfaceCapabilitiesKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR(
+ VkDevice device,
+ VkSwapchainKHR swapchain);
+#endif
+
+#define VK_KHR_external_fence_capabilities 1
+#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities"
+
+
+typedef enum VkExternalFenceHandleTypeFlagBitsKHR {
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001,
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002,
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004,
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000008,
+ VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkExternalFenceHandleTypeFlagBitsKHR;
+typedef VkFlags VkExternalFenceHandleTypeFlagsKHR;
+
+typedef enum VkExternalFenceFeatureFlagBitsKHR {
+ VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001,
+ VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002,
+ VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkExternalFenceFeatureFlagBitsKHR;
+typedef VkFlags VkExternalFenceFeatureFlagsKHR;
+
+typedef struct VkPhysicalDeviceExternalFenceInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalFenceHandleTypeFlagBitsKHR handleType;
+} VkPhysicalDeviceExternalFenceInfoKHR;
+
+typedef struct VkExternalFencePropertiesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkExternalFenceHandleTypeFlagsKHR exportFromImportedHandleTypes;
+ VkExternalFenceHandleTypeFlagsKHR compatibleHandleTypes;
+ VkExternalFenceFeatureFlagsKHR externalFenceFeatures;
+} VkExternalFencePropertiesKHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, VkExternalFencePropertiesKHR* pExternalFenceProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo,
+ VkExternalFencePropertiesKHR* pExternalFenceProperties);
+#endif
+
+#define VK_KHR_external_fence 1
+#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence"
+
+
+typedef enum VkFenceImportFlagBitsKHR {
+ VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001,
+ VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
+} VkFenceImportFlagBitsKHR;
+typedef VkFlags VkFenceImportFlagsKHR;
+
+typedef struct VkExportFenceCreateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalFenceHandleTypeFlagsKHR handleTypes;
+} VkExportFenceCreateInfoKHR;
+
+
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_KHR_external_fence_win32 1
+#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
+
+typedef struct VkImportFenceWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkFence fence;
+ VkFenceImportFlagsKHR flags;
+ VkExternalFenceHandleTypeFlagBitsKHR handleType;
+ HANDLE handle;
+ LPCWSTR name;
+} VkImportFenceWin32HandleInfoKHR;
+
+typedef struct VkExportFenceWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ const SECURITY_ATTRIBUTES* pAttributes;
+ DWORD dwAccess;
+ LPCWSTR name;
+} VkExportFenceWin32HandleInfoKHR;
+
+typedef struct VkFenceGetWin32HandleInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkFence fence;
+ VkExternalFenceHandleTypeFlagBitsKHR handleType;
+} VkFenceGetWin32HandleInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR(
+ VkDevice device,
+ const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(
+ VkDevice device,
+ const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo,
+ HANDLE* pHandle);
+#endif
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_KHR_external_fence_fd 1
+#define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd"
+
+typedef struct VkImportFenceFdInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkFence fence;
+ VkFenceImportFlagsKHR flags;
+ VkExternalFenceHandleTypeFlagBitsKHR handleType;
+ int fd;
+} VkImportFenceFdInfoKHR;
+
+typedef struct VkFenceGetFdInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkFence fence;
+ VkExternalFenceHandleTypeFlagBitsKHR handleType;
+} VkFenceGetFdInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkImportFenceFdKHR)(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkGetFenceFdKHR)(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR(
+ VkDevice device,
+ const VkImportFenceFdInfoKHR* pImportFenceFdInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR(
+ VkDevice device,
+ const VkFenceGetFdInfoKHR* pGetFdInfo,
+ int* pFd);
+#endif
+
+#define VK_KHR_get_surface_capabilities2 1
+#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1
+#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2"
+
+typedef struct VkPhysicalDeviceSurfaceInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkSurfaceKHR surface;
+} VkPhysicalDeviceSurfaceInfo2KHR;
+
+typedef struct VkSurfaceCapabilities2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkSurfaceCapabilitiesKHR surfaceCapabilities;
+} VkSurfaceCapabilities2KHR;
+
+typedef struct VkSurfaceFormat2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkSurfaceFormatKHR surfaceFormat;
+} VkSurfaceFormat2KHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
+ VkSurfaceCapabilities2KHR* pSurfaceCapabilities);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
+ uint32_t* pSurfaceFormatCount,
+ VkSurfaceFormat2KHR* pSurfaceFormats);
+#endif
+
+#define VK_KHR_variable_pointers 1
+#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1
+#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers"
+
+typedef struct VkPhysicalDeviceVariablePointerFeaturesKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 variablePointersStorageBuffer;
+ VkBool32 variablePointers;
+} VkPhysicalDeviceVariablePointerFeaturesKHR;
+
+
+
+#define VK_KHR_dedicated_allocation 1
+#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3
+#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation"
+
+typedef struct VkMemoryDedicatedRequirementsKHR {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 prefersDedicatedAllocation;
+ VkBool32 requiresDedicatedAllocation;
+} VkMemoryDedicatedRequirementsKHR;
+
+typedef struct VkMemoryDedicatedAllocateInfoKHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkImage image;
+ VkBuffer buffer;
+} VkMemoryDedicatedAllocateInfoKHR;
+
+
+
+#define VK_KHR_storage_buffer_storage_class 1
+#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1
+#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class"
+
+
+#define VK_KHR_relaxed_block_layout 1
+#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1
+#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout"
+
+
+#define VK_KHR_get_memory_requirements2 1
+#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1
+#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2"
+
+typedef struct VkBufferMemoryRequirementsInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkBuffer buffer;
+} VkBufferMemoryRequirementsInfo2KHR;
+
+typedef struct VkImageMemoryRequirementsInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkImage image;
+} VkImageMemoryRequirementsInfo2KHR;
+
+typedef struct VkImageSparseMemoryRequirementsInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkImage image;
+} VkImageSparseMemoryRequirementsInfo2KHR;
+
+typedef struct VkMemoryRequirements2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkMemoryRequirements memoryRequirements;
+} VkMemoryRequirements2KHR;
+
+typedef struct VkSparseImageMemoryRequirements2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkSparseImageMemoryRequirements memoryRequirements;
+} VkSparseImageMemoryRequirements2KHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice device, const VkImageMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice device, const VkBufferMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR(
+ VkDevice device,
+ const VkImageMemoryRequirementsInfo2KHR* pInfo,
+ VkMemoryRequirements2KHR* pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR(
+ VkDevice device,
+ const VkBufferMemoryRequirementsInfo2KHR* pInfo,
+ VkMemoryRequirements2KHR* pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR(
+ VkDevice device,
+ const VkImageSparseMemoryRequirementsInfo2KHR* pInfo,
+ uint32_t* pSparseMemoryRequirementCount,
+ VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements);
+#endif
+
+#define VK_EXT_debug_report 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
+
+#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 8
+#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
+#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT
+#define VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT
+
+
+typedef enum VkDebugReportObjectTypeEXT {
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0,
+ VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10,
+ VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17,
+ VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30,
+ VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31,
+ VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = 1000085000,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1),
+ VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkDebugReportObjectTypeEXT;
+
+
+typedef enum VkDebugReportFlagBitsEXT {
+ VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001,
+ VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002,
+ VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
+ VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
+ VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkDebugReportFlagBitsEXT;
+typedef VkFlags VkDebugReportFlagsEXT;
+
+typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage,
+ void* pUserData);
+
+typedef struct VkDebugReportCallbackCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportFlagsEXT flags;
+ PFN_vkDebugReportCallbackEXT pfnCallback;
+ void* pUserData;
+} VkDebugReportCallbackCreateInfoEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
+typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackEXT* pCallback);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(
+ VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
+ VkInstance instance,
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage);
+#endif
+
+#define VK_NV_glsl_shader 1
+#define VK_NV_GLSL_SHADER_SPEC_VERSION 1
+#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader"
+
+
+#define VK_EXT_depth_range_unrestricted 1
+#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1
+#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted"
+
+
+#define VK_IMG_filter_cubic 1
+#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1
+#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic"
+
+
+#define VK_AMD_rasterization_order 1
+#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1
+#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order"
+
+
+typedef enum VkRasterizationOrderAMD {
+ VK_RASTERIZATION_ORDER_STRICT_AMD = 0,
+ VK_RASTERIZATION_ORDER_RELAXED_AMD = 1,
+ VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = VK_RASTERIZATION_ORDER_STRICT_AMD,
+ VK_RASTERIZATION_ORDER_END_RANGE_AMD = VK_RASTERIZATION_ORDER_RELAXED_AMD,
+ VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = (VK_RASTERIZATION_ORDER_RELAXED_AMD - VK_RASTERIZATION_ORDER_STRICT_AMD + 1),
+ VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF
+} VkRasterizationOrderAMD;
+
+typedef struct VkPipelineRasterizationStateRasterizationOrderAMD {
+ VkStructureType sType;
+ const void* pNext;
+ VkRasterizationOrderAMD rasterizationOrder;
+} VkPipelineRasterizationStateRasterizationOrderAMD;
+
+
+
+#define VK_AMD_shader_trinary_minmax 1
+#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1
+#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax"
+
+
+#define VK_AMD_shader_explicit_vertex_parameter 1
+#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1
+#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter"
+
+
+#define VK_EXT_debug_marker 1
+#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4
+#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker"
+
+typedef struct VkDebugMarkerObjectNameInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportObjectTypeEXT objectType;
+ uint64_t object;
+ const char* pObjectName;
+} VkDebugMarkerObjectNameInfoEXT;
+
+typedef struct VkDebugMarkerObjectTagInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportObjectTypeEXT objectType;
+ uint64_t object;
+ uint64_t tagName;
+ size_t tagSize;
+ const void* pTag;
+} VkDebugMarkerObjectTagInfoEXT;
+
+typedef struct VkDebugMarkerMarkerInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ const char* pMarkerName;
+ float color[4];
+} VkDebugMarkerMarkerInfoEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(
+ VkDevice device,
+ const VkDebugMarkerObjectTagInfoEXT* pTagInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(
+ VkDevice device,
+ const VkDebugMarkerObjectNameInfoEXT* pNameInfo);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT(
+ VkCommandBuffer commandBuffer,
+ const VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT(
+ VkCommandBuffer commandBuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(
+ VkCommandBuffer commandBuffer,
+ const VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+#endif
+
+#define VK_AMD_gcn_shader 1
+#define VK_AMD_GCN_SHADER_SPEC_VERSION 1
+#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader"
+
+
+#define VK_NV_dedicated_allocation 1
+#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1
+#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation"
+
+typedef struct VkDedicatedAllocationImageCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 dedicatedAllocation;
+} VkDedicatedAllocationImageCreateInfoNV;
+
+typedef struct VkDedicatedAllocationBufferCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 dedicatedAllocation;
+} VkDedicatedAllocationBufferCreateInfoNV;
+
+typedef struct VkDedicatedAllocationMemoryAllocateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkImage image;
+ VkBuffer buffer;
+} VkDedicatedAllocationMemoryAllocateInfoNV;
+
+
+
+#define VK_AMD_draw_indirect_count 1
+#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
+#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count"
+
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ uint32_t maxDrawCount,
+ uint32_t stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ uint32_t maxDrawCount,
+ uint32_t stride);
+#endif
+
+#define VK_AMD_negative_viewport_height 1
+#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1
+#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height"
+
+
+#define VK_AMD_gpu_shader_half_float 1
+#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1
+#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float"
+
+
+#define VK_AMD_shader_ballot 1
+#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1
+#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot"
+
+
+#define VK_AMD_texture_gather_bias_lod 1
+#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1
+#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod"
+
+typedef struct VkTextureLODGatherFormatPropertiesAMD {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 supportsTextureGatherLODBiasAMD;
+} VkTextureLODGatherFormatPropertiesAMD;
+
+
+
+#define VK_KHX_multiview 1
+#define VK_KHX_MULTIVIEW_SPEC_VERSION 1
+#define VK_KHX_MULTIVIEW_EXTENSION_NAME "VK_KHX_multiview"
+
+typedef struct VkRenderPassMultiviewCreateInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t subpassCount;
+ const uint32_t* pViewMasks;
+ uint32_t dependencyCount;
+ const int32_t* pViewOffsets;
+ uint32_t correlationMaskCount;
+ const uint32_t* pCorrelationMasks;
+} VkRenderPassMultiviewCreateInfoKHX;
+
+typedef struct VkPhysicalDeviceMultiviewFeaturesKHX {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 multiview;
+ VkBool32 multiviewGeometryShader;
+ VkBool32 multiviewTessellationShader;
+} VkPhysicalDeviceMultiviewFeaturesKHX;
+
+typedef struct VkPhysicalDeviceMultiviewPropertiesKHX {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t maxMultiviewViewCount;
+ uint32_t maxMultiviewInstanceIndex;
+} VkPhysicalDeviceMultiviewPropertiesKHX;
+
+
+
+#define VK_IMG_format_pvrtc 1
+#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1
+#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc"
+
+
+#define VK_NV_external_memory_capabilities 1
+#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1
+#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities"
+
+
+typedef enum VkExternalMemoryHandleTypeFlagBitsNV {
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF
+} VkExternalMemoryHandleTypeFlagBitsNV;
+typedef VkFlags VkExternalMemoryHandleTypeFlagsNV;
+
+typedef enum VkExternalMemoryFeatureFlagBitsNV {
+ VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001,
+ VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002,
+ VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004,
+ VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF
+} VkExternalMemoryFeatureFlagBitsNV;
+typedef VkFlags VkExternalMemoryFeatureFlagsNV;
+
+typedef struct VkExternalImageFormatPropertiesNV {
+ VkImageFormatProperties imageFormatProperties;
+ VkExternalMemoryFeatureFlagsNV externalMemoryFeatures;
+ VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes;
+ VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes;
+} VkExternalImageFormatPropertiesNV;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkImageType type,
+ VkImageTiling tiling,
+ VkImageUsageFlags usage,
+ VkImageCreateFlags flags,
+ VkExternalMemoryHandleTypeFlagsNV externalHandleType,
+ VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties);
+#endif
+
+#define VK_NV_external_memory 1
+#define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1
+#define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory"
+
+typedef struct VkExternalMemoryImageCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagsNV handleTypes;
+} VkExternalMemoryImageCreateInfoNV;
+
+typedef struct VkExportMemoryAllocateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagsNV handleTypes;
+} VkExportMemoryAllocateInfoNV;
+
+
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_NV_external_memory_win32 1
+#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
+#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
+
+typedef struct VkImportMemoryWin32HandleInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkExternalMemoryHandleTypeFlagsNV handleType;
+ HANDLE handle;
+} VkImportMemoryWin32HandleInfoNV;
+
+typedef struct VkExportMemoryWin32HandleInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ const SECURITY_ATTRIBUTES* pAttributes;
+ DWORD dwAccess;
+} VkExportMemoryWin32HandleInfoNV;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
+ VkDevice device,
+ VkDeviceMemory memory,
+ VkExternalMemoryHandleTypeFlagsNV handleType,
+ HANDLE* pHandle);
+#endif
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_NV_win32_keyed_mutex 1
+#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1
+#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
+
+typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t acquireCount;
+ const VkDeviceMemory* pAcquireSyncs;
+ const uint64_t* pAcquireKeys;
+ const uint32_t* pAcquireTimeoutMilliseconds;
+ uint32_t releaseCount;
+ const VkDeviceMemory* pReleaseSyncs;
+ const uint64_t* pReleaseKeys;
+} VkWin32KeyedMutexAcquireReleaseInfoNV;
+
+
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_KHX_device_group 1
+#define VK_MAX_DEVICE_GROUP_SIZE_KHX 32
+#define VK_KHX_DEVICE_GROUP_SPEC_VERSION 1
+#define VK_KHX_DEVICE_GROUP_EXTENSION_NAME "VK_KHX_device_group"
+
+
+typedef enum VkPeerMemoryFeatureFlagBitsKHX {
+ VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHX = 0x00000001,
+ VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHX = 0x00000002,
+ VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHX = 0x00000004,
+ VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHX = 0x00000008,
+ VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF
+} VkPeerMemoryFeatureFlagBitsKHX;
+typedef VkFlags VkPeerMemoryFeatureFlagsKHX;
+
+typedef enum VkMemoryAllocateFlagBitsKHX {
+ VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHX = 0x00000001,
+ VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF
+} VkMemoryAllocateFlagBitsKHX;
+typedef VkFlags VkMemoryAllocateFlagsKHX;
+
+typedef enum VkDeviceGroupPresentModeFlagBitsKHX {
+ VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHX = 0x00000001,
+ VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHX = 0x00000002,
+ VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHX = 0x00000004,
+ VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHX = 0x00000008,
+ VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF
+} VkDeviceGroupPresentModeFlagBitsKHX;
+typedef VkFlags VkDeviceGroupPresentModeFlagsKHX;
+
+typedef struct VkMemoryAllocateFlagsInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkMemoryAllocateFlagsKHX flags;
+ uint32_t deviceMask;
+} VkMemoryAllocateFlagsInfoKHX;
+
+typedef struct VkBindBufferMemoryInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkBuffer buffer;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ uint32_t deviceIndexCount;
+ const uint32_t* pDeviceIndices;
+} VkBindBufferMemoryInfoKHX;
+
+typedef struct VkBindImageMemoryInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkImage image;
+ VkDeviceMemory memory;
+ VkDeviceSize memoryOffset;
+ uint32_t deviceIndexCount;
+ const uint32_t* pDeviceIndices;
+ uint32_t SFRRectCount;
+ const VkRect2D* pSFRRects;
+} VkBindImageMemoryInfoKHX;
+
+typedef struct VkDeviceGroupRenderPassBeginInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t deviceMask;
+ uint32_t deviceRenderAreaCount;
+ const VkRect2D* pDeviceRenderAreas;
+} VkDeviceGroupRenderPassBeginInfoKHX;
+
+typedef struct VkDeviceGroupCommandBufferBeginInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t deviceMask;
+} VkDeviceGroupCommandBufferBeginInfoKHX;
+
+typedef struct VkDeviceGroupSubmitInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t waitSemaphoreCount;
+ const uint32_t* pWaitSemaphoreDeviceIndices;
+ uint32_t commandBufferCount;
+ const uint32_t* pCommandBufferDeviceMasks;
+ uint32_t signalSemaphoreCount;
+ const uint32_t* pSignalSemaphoreDeviceIndices;
+} VkDeviceGroupSubmitInfoKHX;
+
+typedef struct VkDeviceGroupBindSparseInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t resourceDeviceIndex;
+ uint32_t memoryDeviceIndex;
+} VkDeviceGroupBindSparseInfoKHX;
+
+typedef struct VkDeviceGroupPresentCapabilitiesKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE_KHX];
+ VkDeviceGroupPresentModeFlagsKHX modes;
+} VkDeviceGroupPresentCapabilitiesKHX;
+
+typedef struct VkImageSwapchainCreateInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkSwapchainKHR swapchain;
+} VkImageSwapchainCreateInfoKHX;
+
+typedef struct VkBindImageMemorySwapchainInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkSwapchainKHR swapchain;
+ uint32_t imageIndex;
+} VkBindImageMemorySwapchainInfoKHX;
+
+typedef struct VkAcquireNextImageInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkSwapchainKHR swapchain;
+ uint64_t timeout;
+ VkSemaphore semaphore;
+ VkFence fence;
+ uint32_t deviceMask;
+} VkAcquireNextImageInfoKHX;
+
+typedef struct VkDeviceGroupPresentInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t swapchainCount;
+ const uint32_t* pDeviceMasks;
+ VkDeviceGroupPresentModeFlagBitsKHX mode;
+} VkDeviceGroupPresentInfoKHX;
+
+typedef struct VkDeviceGroupSwapchainCreateInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceGroupPresentModeFlagsKHX modes;
+} VkDeviceGroupSwapchainCreateInfoKHX;
+
+
+typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHX)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures);
+typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfoKHX* pBindInfos);
+typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfoKHX* pBindInfos);
+typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHX)(VkCommandBuffer commandBuffer, uint32_t deviceMask);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHX)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHX)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHX* pModes);
+typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHX)(VkDevice device, const VkAcquireNextImageInfoKHX* pAcquireInfo, uint32_t* pImageIndex);
+typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHX)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHX)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHX(
+ VkDevice device,
+ uint32_t heapIndex,
+ uint32_t localDeviceIndex,
+ uint32_t remoteDeviceIndex,
+ VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHX(
+ VkDevice device,
+ uint32_t bindInfoCount,
+ const VkBindBufferMemoryInfoKHX* pBindInfos);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHX(
+ VkDevice device,
+ uint32_t bindInfoCount,
+ const VkBindImageMemoryInfoKHX* pBindInfos);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHX(
+ VkCommandBuffer commandBuffer,
+ uint32_t deviceMask);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHX(
+ VkDevice device,
+ VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHX(
+ VkDevice device,
+ VkSurfaceKHR surface,
+ VkDeviceGroupPresentModeFlagsKHX* pModes);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHX(
+ VkDevice device,
+ const VkAcquireNextImageInfoKHX* pAcquireInfo,
+ uint32_t* pImageIndex);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHX(
+ VkCommandBuffer commandBuffer,
+ uint32_t baseGroupX,
+ uint32_t baseGroupY,
+ uint32_t baseGroupZ,
+ uint32_t groupCountX,
+ uint32_t groupCountY,
+ uint32_t groupCountZ);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHX(
+ VkPhysicalDevice physicalDevice,
+ VkSurfaceKHR surface,
+ uint32_t* pRectCount,
+ VkRect2D* pRects);
+#endif
+
+#define VK_EXT_validation_flags 1
+#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1
+#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags"
+
+
+typedef enum VkValidationCheckEXT {
+ VK_VALIDATION_CHECK_ALL_EXT = 0,
+ VK_VALIDATION_CHECK_SHADERS_EXT = 1,
+ VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT,
+ VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_SHADERS_EXT,
+ VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_SHADERS_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1),
+ VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkValidationCheckEXT;
+
+typedef struct VkValidationFlagsEXT {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t disabledValidationCheckCount;
+ VkValidationCheckEXT* pDisabledValidationChecks;
+} VkValidationFlagsEXT;
+
+
+
+#ifdef VK_USE_PLATFORM_VI_NN
+#define VK_NN_vi_surface 1
+#define VK_NN_VI_SURFACE_SPEC_VERSION 1
+#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface"
+
+typedef VkFlags VkViSurfaceCreateFlagsNN;
+
+typedef struct VkViSurfaceCreateInfoNN {
+ VkStructureType sType;
+ const void* pNext;
+ VkViSurfaceCreateFlagsNN flags;
+ void* window;
+} VkViSurfaceCreateInfoNN;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(
+ VkInstance instance,
+ const VkViSurfaceCreateInfoNN* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+#endif
+#endif /* VK_USE_PLATFORM_VI_NN */
+
+#define VK_EXT_shader_subgroup_ballot 1
+#define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1
+#define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot"
+
+
+#define VK_EXT_shader_subgroup_vote 1
+#define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1
+#define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote"
+
+
+#define VK_KHX_device_group_creation 1
+#define VK_KHX_DEVICE_GROUP_CREATION_SPEC_VERSION 1
+#define VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHX_device_group_creation"
+
+typedef struct VkPhysicalDeviceGroupPropertiesKHX {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t physicalDeviceCount;
+ VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE_KHX];
+ VkBool32 subsetAllocation;
+} VkPhysicalDeviceGroupPropertiesKHX;
+
+typedef struct VkDeviceGroupDeviceCreateInfoKHX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t physicalDeviceCount;
+ const VkPhysicalDevice* pPhysicalDevices;
+} VkDeviceGroupDeviceCreateInfoKHX;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroupsKHX)(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHX(
+ VkInstance instance,
+ uint32_t* pPhysicalDeviceGroupCount,
+ VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties);
+#endif
+
+#define VK_NVX_device_generated_commands 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkObjectTableNVX)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNVX)
+
+#define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3
+#define VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NVX_device_generated_commands"
+
+
+typedef enum VkIndirectCommandsTokenTypeNVX {
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = 0,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = 1,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = 2,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = 3,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = 4,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = 5,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = 6,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = 7,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX,
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = (VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX + 1),
+ VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkIndirectCommandsTokenTypeNVX;
+
+typedef enum VkObjectEntryTypeNVX {
+ VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = 0,
+ VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = 1,
+ VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = 2,
+ VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = 3,
+ VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = 4,
+ VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX,
+ VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX,
+ VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = (VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX - VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX + 1),
+ VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkObjectEntryTypeNVX;
+
+
+typedef enum VkIndirectCommandsLayoutUsageFlagBitsNVX {
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 0x00000001,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 0x00000002,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 0x00000004,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 0x00000008,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkIndirectCommandsLayoutUsageFlagBitsNVX;
+typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNVX;
+
+typedef enum VkObjectEntryUsageFlagBitsNVX {
+ VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 0x00000001,
+ VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 0x00000002,
+ VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF
+} VkObjectEntryUsageFlagBitsNVX;
+typedef VkFlags VkObjectEntryUsageFlagsNVX;
+
+typedef struct VkDeviceGeneratedCommandsFeaturesNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 computeBindingPointSupport;
+} VkDeviceGeneratedCommandsFeaturesNVX;
+
+typedef struct VkDeviceGeneratedCommandsLimitsNVX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t maxIndirectCommandsLayoutTokenCount;
+ uint32_t maxObjectEntryCounts;
+ uint32_t minSequenceCountBufferOffsetAlignment;
+ uint32_t minSequenceIndexBufferOffsetAlignment;
+ uint32_t minCommandsTokenBufferOffsetAlignment;
+} VkDeviceGeneratedCommandsLimitsNVX;
+
+typedef struct VkIndirectCommandsTokenNVX {
+ VkIndirectCommandsTokenTypeNVX tokenType;
+ VkBuffer buffer;
+ VkDeviceSize offset;
+} VkIndirectCommandsTokenNVX;
+
+typedef struct VkIndirectCommandsLayoutTokenNVX {
+ VkIndirectCommandsTokenTypeNVX tokenType;
+ uint32_t bindingUnit;
+ uint32_t dynamicCount;
+ uint32_t divisor;
+} VkIndirectCommandsLayoutTokenNVX;
+
+typedef struct VkIndirectCommandsLayoutCreateInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineBindPoint pipelineBindPoint;
+ VkIndirectCommandsLayoutUsageFlagsNVX flags;
+ uint32_t tokenCount;
+ const VkIndirectCommandsLayoutTokenNVX* pTokens;
+} VkIndirectCommandsLayoutCreateInfoNVX;
+
+typedef struct VkCmdProcessCommandsInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkObjectTableNVX objectTable;
+ VkIndirectCommandsLayoutNVX indirectCommandsLayout;
+ uint32_t indirectCommandsTokenCount;
+ const VkIndirectCommandsTokenNVX* pIndirectCommandsTokens;
+ uint32_t maxSequencesCount;
+ VkCommandBuffer targetCommandBuffer;
+ VkBuffer sequencesCountBuffer;
+ VkDeviceSize sequencesCountOffset;
+ VkBuffer sequencesIndexBuffer;
+ VkDeviceSize sequencesIndexOffset;
+} VkCmdProcessCommandsInfoNVX;
+
+typedef struct VkCmdReserveSpaceForCommandsInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ VkObjectTableNVX objectTable;
+ VkIndirectCommandsLayoutNVX indirectCommandsLayout;
+ uint32_t maxSequencesCount;
+} VkCmdReserveSpaceForCommandsInfoNVX;
+
+typedef struct VkObjectTableCreateInfoNVX {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t objectCount;
+ const VkObjectEntryTypeNVX* pObjectEntryTypes;
+ const uint32_t* pObjectEntryCounts;
+ const VkObjectEntryUsageFlagsNVX* pObjectEntryUsageFlags;
+ uint32_t maxUniformBuffersPerDescriptor;
+ uint32_t maxStorageBuffersPerDescriptor;
+ uint32_t maxStorageImagesPerDescriptor;
+ uint32_t maxSampledImagesPerDescriptor;
+ uint32_t maxPipelineLayouts;
+} VkObjectTableCreateInfoNVX;
+
+typedef struct VkObjectTableEntryNVX {
+ VkObjectEntryTypeNVX type;
+ VkObjectEntryUsageFlagsNVX flags;
+} VkObjectTableEntryNVX;
+
+typedef struct VkObjectTablePipelineEntryNVX {
+ VkObjectEntryTypeNVX type;
+ VkObjectEntryUsageFlagsNVX flags;
+ VkPipeline pipeline;
+} VkObjectTablePipelineEntryNVX;
+
+typedef struct VkObjectTableDescriptorSetEntryNVX {
+ VkObjectEntryTypeNVX type;
+ VkObjectEntryUsageFlagsNVX flags;
+ VkPipelineLayout pipelineLayout;
+ VkDescriptorSet descriptorSet;
+} VkObjectTableDescriptorSetEntryNVX;
+
+typedef struct VkObjectTableVertexBufferEntryNVX {
+ VkObjectEntryTypeNVX type;
+ VkObjectEntryUsageFlagsNVX flags;
+ VkBuffer buffer;
+} VkObjectTableVertexBufferEntryNVX;
+
+typedef struct VkObjectTableIndexBufferEntryNVX {
+ VkObjectEntryTypeNVX type;
+ VkObjectEntryUsageFlagsNVX flags;
+ VkBuffer buffer;
+ VkIndexType indexType;
+} VkObjectTableIndexBufferEntryNVX;
+
+typedef struct VkObjectTablePushConstantEntryNVX {
+ VkObjectEntryTypeNVX type;
+ VkObjectEntryUsageFlagsNVX flags;
+ VkPipelineLayout pipelineLayout;
+ VkShaderStageFlags stageFlags;
+} VkObjectTablePushConstantEntryNVX;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdProcessCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdReserveSpaceForCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateIndirectCommandsLayoutNVX)(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout);
+typedef void (VKAPI_PTR *PFN_vkDestroyIndirectCommandsLayoutNVX)(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateObjectTableNVX)(VkDevice device, const VkObjectTableCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkObjectTableNVX* pObjectTable);
+typedef void (VKAPI_PTR *PFN_vkDestroyObjectTableNVX)(VkDevice device, VkObjectTableNVX objectTable, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkRegisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectTableEntryNVX* const* ppObjectTableEntries, const uint32_t* pObjectIndices);
+typedef VkResult (VKAPI_PTR *PFN_vkUnregisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectEntryTypeNVX* pObjectEntryTypes, const uint32_t* pObjectIndices);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)(VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, VkDeviceGeneratedCommandsLimitsNVX* pLimits);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX(
+ VkCommandBuffer commandBuffer,
+ const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX(
+ VkCommandBuffer commandBuffer,
+ const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX(
+ VkDevice device,
+ const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX(
+ VkDevice device,
+ VkIndirectCommandsLayoutNVX indirectCommandsLayout,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX(
+ VkDevice device,
+ const VkObjectTableCreateInfoNVX* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkObjectTableNVX* pObjectTable);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyObjectTableNVX(
+ VkDevice device,
+ VkObjectTableNVX objectTable,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX(
+ VkDevice device,
+ VkObjectTableNVX objectTable,
+ uint32_t objectCount,
+ const VkObjectTableEntryNVX* const* ppObjectTableEntries,
+ const uint32_t* pObjectIndices);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX(
+ VkDevice device,
+ VkObjectTableNVX objectTable,
+ uint32_t objectCount,
+ const VkObjectEntryTypeNVX* pObjectEntryTypes,
+ const uint32_t* pObjectIndices);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(
+ VkPhysicalDevice physicalDevice,
+ VkDeviceGeneratedCommandsFeaturesNVX* pFeatures,
+ VkDeviceGeneratedCommandsLimitsNVX* pLimits);
+#endif
+
+#define VK_NV_clip_space_w_scaling 1
+#define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1
+#define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling"
+
+typedef struct VkViewportWScalingNV {
+ float xcoeff;
+ float ycoeff;
+} VkViewportWScalingNV;
+
+typedef struct VkPipelineViewportWScalingStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 viewportWScalingEnable;
+ uint32_t viewportCount;
+ const VkViewportWScalingNV* pViewportWScalings;
+} VkPipelineViewportWScalingStateCreateInfoNV;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstViewport,
+ uint32_t viewportCount,
+ const VkViewportWScalingNV* pViewportWScalings);
+#endif
+
+#define VK_EXT_direct_mode_display 1
+#define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1
+#define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display"
+
+typedef VkResult (VKAPI_PTR *PFN_vkReleaseDisplayEXT)(VkPhysicalDevice physicalDevice, VkDisplayKHR display);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayKHR display);
+#endif
+
+#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
+#define VK_EXT_acquire_xlib_display 1
+#include <X11/extensions/Xrandr.h>
+
+#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1
+#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display"
+
+typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display);
+typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(
+ VkPhysicalDevice physicalDevice,
+ Display* dpy,
+ VkDisplayKHR display);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(
+ VkPhysicalDevice physicalDevice,
+ Display* dpy,
+ RROutput rrOutput,
+ VkDisplayKHR* pDisplay);
+#endif
+#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
+
+#define VK_EXT_display_surface_counter 1
+#define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1
+#define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter"
+#define VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT
+
+
+typedef enum VkSurfaceCounterFlagBitsEXT {
+ VK_SURFACE_COUNTER_VBLANK_EXT = 0x00000001,
+ VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkSurfaceCounterFlagBitsEXT;
+typedef VkFlags VkSurfaceCounterFlagsEXT;
+
+typedef struct VkSurfaceCapabilities2EXT {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t minImageCount;
+ uint32_t maxImageCount;
+ VkExtent2D currentExtent;
+ VkExtent2D minImageExtent;
+ VkExtent2D maxImageExtent;
+ uint32_t maxImageArrayLayers;
+ VkSurfaceTransformFlagsKHR supportedTransforms;
+ VkSurfaceTransformFlagBitsKHR currentTransform;
+ VkCompositeAlphaFlagsKHR supportedCompositeAlpha;
+ VkImageUsageFlags supportedUsageFlags;
+ VkSurfaceCounterFlagsEXT supportedSurfaceCounters;
+} VkSurfaceCapabilities2EXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT* pSurfaceCapabilities);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT(
+ VkPhysicalDevice physicalDevice,
+ VkSurfaceKHR surface,
+ VkSurfaceCapabilities2EXT* pSurfaceCapabilities);
+#endif
+
+#define VK_EXT_display_control 1
+#define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1
+#define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control"
+
+
+typedef enum VkDisplayPowerStateEXT {
+ VK_DISPLAY_POWER_STATE_OFF_EXT = 0,
+ VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1,
+ VK_DISPLAY_POWER_STATE_ON_EXT = 2,
+ VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT = VK_DISPLAY_POWER_STATE_OFF_EXT,
+ VK_DISPLAY_POWER_STATE_END_RANGE_EXT = VK_DISPLAY_POWER_STATE_ON_EXT,
+ VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT = (VK_DISPLAY_POWER_STATE_ON_EXT - VK_DISPLAY_POWER_STATE_OFF_EXT + 1),
+ VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkDisplayPowerStateEXT;
+
+typedef enum VkDeviceEventTypeEXT {
+ VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0,
+ VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT,
+ VK_DEVICE_EVENT_TYPE_END_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT,
+ VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT - VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT + 1),
+ VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkDeviceEventTypeEXT;
+
+typedef enum VkDisplayEventTypeEXT {
+ VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0,
+ VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT,
+ VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT,
+ VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT - VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT + 1),
+ VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkDisplayEventTypeEXT;
+
+typedef struct VkDisplayPowerInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplayPowerStateEXT powerState;
+} VkDisplayPowerInfoEXT;
+
+typedef struct VkDeviceEventInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDeviceEventTypeEXT deviceEvent;
+} VkDeviceEventInfoEXT;
+
+typedef struct VkDisplayEventInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplayEventTypeEXT displayEvent;
+} VkDisplayEventInfoEXT;
+
+typedef struct VkSwapchainCounterCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkSurfaceCounterFlagsEXT surfaceCounters;
+} VkSwapchainCounterCreateInfoEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkDisplayPowerControlEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT* pDisplayPowerInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkRegisterDeviceEventEXT)(VkDevice device, const VkDeviceEventInfoEXT* pDeviceEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
+typedef VkResult (VKAPI_PTR *PFN_vkRegisterDisplayEventEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT* pDisplayEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
+typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainCounterEXT)(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t* pCounterValue);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkDisplayPowerControlEXT(
+ VkDevice device,
+ VkDisplayKHR display,
+ const VkDisplayPowerInfoEXT* pDisplayPowerInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDeviceEventEXT(
+ VkDevice device,
+ const VkDeviceEventInfoEXT* pDeviceEventInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkFence* pFence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDisplayEventEXT(
+ VkDevice device,
+ VkDisplayKHR display,
+ const VkDisplayEventInfoEXT* pDisplayEventInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkFence* pFence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ VkSurfaceCounterFlagBitsEXT counter,
+ uint64_t* pCounterValue);
+#endif
+
+#define VK_GOOGLE_display_timing 1
+#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1
+#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing"
+
+typedef struct VkRefreshCycleDurationGOOGLE {
+ uint64_t refreshDuration;
+} VkRefreshCycleDurationGOOGLE;
+
+typedef struct VkPastPresentationTimingGOOGLE {
+ uint32_t presentID;
+ uint64_t desiredPresentTime;
+ uint64_t actualPresentTime;
+ uint64_t earliestPresentTime;
+ uint64_t presentMargin;
+} VkPastPresentationTimingGOOGLE;
+
+typedef struct VkPresentTimeGOOGLE {
+ uint32_t presentID;
+ uint64_t desiredPresentTime;
+} VkPresentTimeGOOGLE;
+
+typedef struct VkPresentTimesInfoGOOGLE {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t swapchainCount;
+ const VkPresentTimeGOOGLE* pTimes;
+} VkPresentTimesInfoGOOGLE;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint32_t* pPresentationTimingCount,
+ VkPastPresentationTimingGOOGLE* pPresentationTimings);
+#endif
+
+#define VK_NV_sample_mask_override_coverage 1
+#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1
+#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage"
+
+
+#define VK_NV_geometry_shader_passthrough 1
+#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1
+#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough"
+
+
+#define VK_NV_viewport_array2 1
+#define VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION 1
+#define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME "VK_NV_viewport_array2"
+
+
+#define VK_NVX_multiview_per_view_attributes 1
+#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1
+#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes"
+
+typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 perViewPositionAllComponents;
+} VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX;
+
+
+
+#define VK_NV_viewport_swizzle 1
+#define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1
+#define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle"
+
+
+typedef enum VkViewportCoordinateSwizzleNV {
+ VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV,
+ VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV = (VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV + 1),
+ VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = 0x7FFFFFFF
+} VkViewportCoordinateSwizzleNV;
+
+typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV;
+
+typedef struct VkViewportSwizzleNV {
+ VkViewportCoordinateSwizzleNV x;
+ VkViewportCoordinateSwizzleNV y;
+ VkViewportCoordinateSwizzleNV z;
+ VkViewportCoordinateSwizzleNV w;
+} VkViewportSwizzleNV;
+
+typedef struct VkPipelineViewportSwizzleStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineViewportSwizzleStateCreateFlagsNV flags;
+ uint32_t viewportCount;
+ const VkViewportSwizzleNV* pViewportSwizzles;
+} VkPipelineViewportSwizzleStateCreateInfoNV;
+
+
+
+#define VK_EXT_discard_rectangles 1
+#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1
+#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles"
+
+
+typedef enum VkDiscardRectangleModeEXT {
+ VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0,
+ VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1,
+ VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT,
+ VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT,
+ VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = (VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT + 1),
+ VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkDiscardRectangleModeEXT;
+
+typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT;
+
+typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t maxDiscardRectangles;
+} VkPhysicalDeviceDiscardRectanglePropertiesEXT;
+
+typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineDiscardRectangleStateCreateFlagsEXT flags;
+ VkDiscardRectangleModeEXT discardRectangleMode;
+ uint32_t discardRectangleCount;
+ const VkRect2D* pDiscardRectangles;
+} VkPipelineDiscardRectangleStateCreateInfoEXT;
+
+
+typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT(
+ VkCommandBuffer commandBuffer,
+ uint32_t firstDiscardRectangle,
+ uint32_t discardRectangleCount,
+ const VkRect2D* pDiscardRectangles);
+#endif
+
+#define VK_EXT_swapchain_colorspace 1
+#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3
+#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace"
+
+
+#define VK_EXT_hdr_metadata 1
+#define VK_EXT_HDR_METADATA_SPEC_VERSION 1
+#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata"
+
+typedef struct VkXYColorEXT {
+ float x;
+ float y;
+} VkXYColorEXT;
+
+typedef struct VkHdrMetadataEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkXYColorEXT displayPrimaryRed;
+ VkXYColorEXT displayPrimaryGreen;
+ VkXYColorEXT displayPrimaryBlue;
+ VkXYColorEXT whitePoint;
+ float maxLuminance;
+ float minLuminance;
+ float maxContentLightLevel;
+ float maxFrameAverageLightLevel;
+} VkHdrMetadataEXT;
+
+
+typedef void (VKAPI_PTR *PFN_vkSetHdrMetadataEXT)(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT(
+ VkDevice device,
+ uint32_t swapchainCount,
+ const VkSwapchainKHR* pSwapchains,
+ const VkHdrMetadataEXT* pMetadata);
+#endif
+
+#ifdef VK_USE_PLATFORM_IOS_MVK
+#define VK_MVK_ios_surface 1
+#define VK_MVK_IOS_SURFACE_SPEC_VERSION 2
+#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
+
+typedef VkFlags VkIOSSurfaceCreateFlagsMVK;
+
+typedef struct VkIOSSurfaceCreateInfoMVK {
+ VkStructureType sType;
+ const void* pNext;
+ VkIOSSurfaceCreateFlagsMVK flags;
+ const void* pView;
+} VkIOSSurfaceCreateInfoMVK;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(
+ VkInstance instance,
+ const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+#endif
+#endif /* VK_USE_PLATFORM_IOS_MVK */
+
+#ifdef VK_USE_PLATFORM_MACOS_MVK
+#define VK_MVK_macos_surface 1
+#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2
+#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
+
+typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
+
+typedef struct VkMacOSSurfaceCreateInfoMVK {
+ VkStructureType sType;
+ const void* pNext;
+ VkMacOSSurfaceCreateFlagsMVK flags;
+ const void* pView;
+} VkMacOSSurfaceCreateInfoMVK;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
+ VkInstance instance,
+ const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkSurfaceKHR* pSurface);
+#endif
+#endif /* VK_USE_PLATFORM_MACOS_MVK */
+
+#define VK_EXT_sampler_filter_minmax 1
+#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1
+#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax"
+
+
+typedef enum VkSamplerReductionModeEXT {
+ VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = 0,
+ VK_SAMPLER_REDUCTION_MODE_MIN_EXT = 1,
+ VK_SAMPLER_REDUCTION_MODE_MAX_EXT = 2,
+ VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT,
+ VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_MAX_EXT,
+ VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = (VK_SAMPLER_REDUCTION_MODE_MAX_EXT - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT + 1),
+ VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkSamplerReductionModeEXT;
+
+typedef struct VkSamplerReductionModeCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkSamplerReductionModeEXT reductionMode;
+} VkSamplerReductionModeCreateInfoEXT;
+
+typedef struct VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 filterMinmaxSingleComponentFormats;
+ VkBool32 filterMinmaxImageComponentMapping;
+} VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT;
+
+
+
+#define VK_AMD_gpu_shader_int16 1
+#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 1
+#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16"
+
+
+#define VK_AMD_mixed_attachment_samples 1
+#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1
+#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples"
+
+
+#define VK_EXT_shader_stencil_export 1
+#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1
+#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export"
+
+
+#define VK_EXT_blend_operation_advanced 1
+#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2
+#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced"
+
+
+typedef enum VkBlendOverlapEXT {
+ VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0,
+ VK_BLEND_OVERLAP_DISJOINT_EXT = 1,
+ VK_BLEND_OVERLAP_CONJOINT_EXT = 2,
+ VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = VK_BLEND_OVERLAP_UNCORRELATED_EXT,
+ VK_BLEND_OVERLAP_END_RANGE_EXT = VK_BLEND_OVERLAP_CONJOINT_EXT,
+ VK_BLEND_OVERLAP_RANGE_SIZE_EXT = (VK_BLEND_OVERLAP_CONJOINT_EXT - VK_BLEND_OVERLAP_UNCORRELATED_EXT + 1),
+ VK_BLEND_OVERLAP_MAX_ENUM_EXT = 0x7FFFFFFF
+} VkBlendOverlapEXT;
+
+typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT {
+ VkStructureType sType;
+ void* pNext;
+ VkBool32 advancedBlendCoherentOperations;
+} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT;
+
+typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT {
+ VkStructureType sType;
+ void* pNext;
+ uint32_t advancedBlendMaxColorAttachments;
+ VkBool32 advancedBlendIndependentBlend;
+ VkBool32 advancedBlendNonPremultipliedSrcColor;
+ VkBool32 advancedBlendNonPremultipliedDstColor;
+ VkBool32 advancedBlendCorrelatedOverlap;
+ VkBool32 advancedBlendAllOperations;
+} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT;
+
+typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkBool32 srcPremultiplied;
+ VkBool32 dstPremultiplied;
+ VkBlendOverlapEXT blendOverlap;
+} VkPipelineColorBlendAdvancedStateCreateInfoEXT;
+
+
+
+#define VK_NV_fragment_coverage_to_color 1
+#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1
+#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color"
+
+typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV;
+
+typedef struct VkPipelineCoverageToColorStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCoverageToColorStateCreateFlagsNV flags;
+ VkBool32 coverageToColorEnable;
+ uint32_t coverageToColorLocation;
+} VkPipelineCoverageToColorStateCreateInfoNV;
+
+
+
+#define VK_NV_framebuffer_mixed_samples 1
+#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1
+#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples"
+
+
+typedef enum VkCoverageModulationModeNV {
+ VK_COVERAGE_MODULATION_MODE_NONE_NV = 0,
+ VK_COVERAGE_MODULATION_MODE_RGB_NV = 1,
+ VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2,
+ VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3,
+ VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = VK_COVERAGE_MODULATION_MODE_NONE_NV,
+ VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = VK_COVERAGE_MODULATION_MODE_RGBA_NV,
+ VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = (VK_COVERAGE_MODULATION_MODE_RGBA_NV - VK_COVERAGE_MODULATION_MODE_NONE_NV + 1),
+ VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 0x7FFFFFFF
+} VkCoverageModulationModeNV;
+
+typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV;
+
+typedef struct VkPipelineCoverageModulationStateCreateInfoNV {
+ VkStructureType sType;
+ const void* pNext;
+ VkPipelineCoverageModulationStateCreateFlagsNV flags;
+ VkCoverageModulationModeNV coverageModulationMode;
+ VkBool32 coverageModulationTableEnable;
+ uint32_t coverageModulationTableCount;
+ const float* pCoverageModulationTable;
+} VkPipelineCoverageModulationStateCreateInfoNV;
+
+
+
+#define VK_NV_fill_rectangle 1
+#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1
+#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle"
+
+
+#define VK_EXT_post_depth_coverage 1
+#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1
+#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage"
+
+
+#define VK_EXT_shader_viewport_index_layer 1
+#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1
+#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c
new file mode 100644
index 0000000..c79f372
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c
@@ -0,0 +1,171 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_KMSDRM
+
+#define DEBUG_DYNAMIC_KMSDRM 0
+
+#include "SDL_kmsdrmdyn.h"
+
+#if DEBUG_DYNAMIC_KMSDRM
+#include "SDL_log.h"
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+ void *lib;
+ const char *libname;
+} kmsdrmdynlib;
+
+#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
+#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM NULL
+#endif
+
+static kmsdrmdynlib kmsdrmlibs[] = {
+ {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC},
+ {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM}
+};
+
+static void *
+KMSDRM_GetSym(const char *fnname, int *pHasModule)
+{
+ int i;
+ void *fn = NULL;
+ for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) {
+ if (kmsdrmlibs[i].lib != NULL) {
+ fn = SDL_LoadFunction(kmsdrmlibs[i].lib, fnname);
+ if (fn != NULL)
+ break;
+ }
+ }
+
+#if DEBUG_DYNAMIC_KMSDRM
+ if (fn != NULL)
+ SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn);
+ else
+ SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+ if (fn == NULL)
+ *pHasModule = 0; /* kill this module. */
+
+ return fn;
+}
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */
+
+/* Define all the function pointers and wrappers... */
+#define SDL_KMSDRM_MODULE(modname) int SDL_KMSDRM_HAVE_##modname = 0;
+#define SDL_KMSDRM_SYM(rc,fn,params) SDL_DYNKMSDRMFN_##fn KMSDRM_##fn = NULL;
+#define SDL_KMSDRM_SYM_CONST(type,name) SDL_DYNKMSDRMCONST_##name KMSDRM_##name = NULL;
+#include "SDL_kmsdrmsym.h"
+
+static int kmsdrm_load_refcount = 0;
+
+void
+SDL_KMSDRM_UnloadSymbols(void)
+{
+ /* Don't actually unload if more than one module is using the libs... */
+ if (kmsdrm_load_refcount > 0) {
+ if (--kmsdrm_load_refcount == 0) {
+#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+ int i;
+#endif
+
+ /* set all the function pointers to NULL. */
+#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 0;
+#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = NULL;
+#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = NULL;
+#include "SDL_kmsdrmsym.h"
+
+
+#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+ for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) {
+ if (kmsdrmlibs[i].lib != NULL) {
+ SDL_UnloadObject(kmsdrmlibs[i].lib);
+ kmsdrmlibs[i].lib = NULL;
+ }
+ }
+#endif
+ }
+ }
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_KMSDRM_LoadSymbols(void)
+{
+ int rc = 1; /* always succeed if not using Dynamic KMSDRM stuff. */
+
+ /* deal with multiple modules needing these symbols... */
+ if (kmsdrm_load_refcount++ == 0) {
+#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+ int i;
+ int *thismod = NULL;
+ for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) {
+ if (kmsdrmlibs[i].libname != NULL) {
+ kmsdrmlibs[i].lib = SDL_LoadObject(kmsdrmlibs[i].libname);
+ }
+ }
+
+#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */
+#include "SDL_kmsdrmsym.h"
+
+#define SDL_KMSDRM_MODULE(modname) thismod = &SDL_KMSDRM_HAVE_##modname;
+#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = (SDL_DYNKMSDRMFN_##fn) KMSDRM_GetSym(#fn,thismod);
+#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = *(SDL_DYNKMSDRMCONST_##name*) KMSDRM_GetSym(#name,thismod);
+#include "SDL_kmsdrmsym.h"
+
+ if ((SDL_KMSDRM_HAVE_LIBDRM) && (SDL_KMSDRM_HAVE_GBM)) {
+ /* all required symbols loaded. */
+ SDL_ClearError();
+ } else {
+ /* in case something got loaded... */
+ SDL_KMSDRM_UnloadSymbols();
+ rc = 0;
+ }
+
+#else /* no dynamic KMSDRM */
+
+#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */
+#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = fn;
+#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = name;
+#include "SDL_kmsdrmsym.h"
+
+#endif
+ }
+
+ return rc;
+}
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h
new file mode 100644
index 0000000..578b088
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h
@@ -0,0 +1,53 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_kmsdrmdyn_h_
+#define SDL_kmsdrmdyn_h_
+
+#include "../../SDL_internal.h"
+
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#include <gbm.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int SDL_KMSDRM_LoadSymbols(void);
+void SDL_KMSDRM_UnloadSymbols(void);
+
+/* Declare all the function pointers and wrappers... */
+#define SDL_KMSDRM_SYM(rc,fn,params) \
+ typedef rc (*SDL_DYNKMSDRMFN_##fn) params; \
+ extern SDL_DYNKMSDRMFN_##fn KMSDRM_##fn;
+#define SDL_KMSDRM_SYM_CONST(type, name) \
+ typedef type SDL_DYNKMSDRMCONST_##name; \
+ extern SDL_DYNKMSDRMCONST_##name KMSDRM_##name;
+#include "SDL_kmsdrmsym.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_kmsdrmdyn_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c
new file mode 100644
index 0000000..5a611f6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c
@@ -0,0 +1,42 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_KMSDRM
+
+#include "SDL_kmsdrmvideo.h"
+#include "SDL_kmsdrmevents.h"
+
+#ifdef SDL_INPUT_LINUXEV
+#include "../../core/linux/SDL_evdev.h"
+#endif
+
+void KMSDRM_PumpEvents(_THIS)
+{
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Poll();
+#endif
+
+}
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM */
+
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h
new file mode 100644
index 0000000..3b88c28
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_kmsdrmevents_h_
+#define SDL_kmsdrmevents_h_
+
+extern void KMSDRM_PumpEvents(_THIS);
+extern void KMSDRM_EventInit(_THIS);
+extern void KMSDRM_EventQuit(_THIS);
+
+#endif /* SDL_kmsdrmevents_h_ */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c
new file mode 100644
index 0000000..e23dd13
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c
@@ -0,0 +1,501 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_KMSDRM
+
+#include "SDL_kmsdrmvideo.h"
+#include "SDL_kmsdrmmouse.h"
+#include "SDL_kmsdrmdyn.h"
+
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/default_cursor.h"
+
+static SDL_Cursor *KMSDRM_CreateDefaultCursor(void);
+static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y);
+static int KMSDRM_ShowCursor(SDL_Cursor * cursor);
+static void KMSDRM_MoveCursor(SDL_Cursor * cursor);
+static void KMSDRM_FreeCursor(SDL_Cursor * cursor);
+static void KMSDRM_WarpMouse(SDL_Window * window, int x, int y);
+static int KMSDRM_WarpMouseGlobal(int x, int y);
+
+static SDL_Cursor *
+KMSDRM_CreateDefaultCursor(void)
+{
+ return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY);
+}
+
+/* Evaluate if a given cursor size is supported or not. Notably, current Intel gfx only support 64x64 and up. */
+static SDL_bool
+KMSDRM_IsCursorSizeSupported (int w, int h, uint32_t bo_format) {
+
+ SDL_VideoDevice *dev = SDL_GetVideoDevice();
+ SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata);
+ int ret;
+ uint32_t bo_handle;
+ struct gbm_bo *bo = KMSDRM_gbm_bo_create(vdata->gbm, w, h, bo_format,
+ GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
+
+ if (bo == NULL) {
+ SDL_SetError("Could not create GBM cursor BO width size %dx%d for size testing", w, h);
+ goto cleanup;
+ }
+
+ bo_handle = KMSDRM_gbm_bo_get_handle(bo).u32;
+ ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, vdata->crtc_id, bo_handle, w, h);
+
+ if (ret) {
+ goto cleanup;
+ }
+ else {
+ KMSDRM_gbm_bo_destroy(bo);
+ return SDL_TRUE;
+ }
+
+cleanup:
+ if (bo != NULL) {
+ KMSDRM_gbm_bo_destroy(bo);
+ }
+ return SDL_FALSE;
+}
+
+/* Create a cursor from a surface */
+static SDL_Cursor *
+KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ SDL_VideoDevice *dev = SDL_GetVideoDevice();
+ SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata);
+ SDL_PixelFormat *pixlfmt = surface->format;
+ KMSDRM_CursorData *curdata;
+ SDL_Cursor *cursor;
+ SDL_bool cursor_supported = SDL_FALSE;
+ int i, ret, usable_cursor_w, usable_cursor_h;
+ uint32_t bo_format, bo_stride;
+ char *buffer = NULL;
+ size_t bufsize;
+
+ switch(pixlfmt->format) {
+ case SDL_PIXELFORMAT_RGB332:
+ bo_format = GBM_FORMAT_RGB332;
+ break;
+ case SDL_PIXELFORMAT_ARGB4444:
+ bo_format = GBM_FORMAT_ARGB4444;
+ break;
+ case SDL_PIXELFORMAT_RGBA4444:
+ bo_format = GBM_FORMAT_RGBA4444;
+ break;
+ case SDL_PIXELFORMAT_ABGR4444:
+ bo_format = GBM_FORMAT_ABGR4444;
+ break;
+ case SDL_PIXELFORMAT_BGRA4444:
+ bo_format = GBM_FORMAT_BGRA4444;
+ break;
+ case SDL_PIXELFORMAT_ARGB1555:
+ bo_format = GBM_FORMAT_ARGB1555;
+ break;
+ case SDL_PIXELFORMAT_RGBA5551:
+ bo_format = GBM_FORMAT_RGBA5551;
+ break;
+ case SDL_PIXELFORMAT_ABGR1555:
+ bo_format = GBM_FORMAT_ABGR1555;
+ break;
+ case SDL_PIXELFORMAT_BGRA5551:
+ bo_format = GBM_FORMAT_BGRA5551;
+ break;
+ case SDL_PIXELFORMAT_RGB565:
+ bo_format = GBM_FORMAT_RGB565;
+ break;
+ case SDL_PIXELFORMAT_BGR565:
+ bo_format = GBM_FORMAT_BGR565;
+ break;
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_RGB24:
+ bo_format = GBM_FORMAT_RGB888;
+ break;
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_BGR24:
+ bo_format = GBM_FORMAT_BGR888;
+ break;
+ case SDL_PIXELFORMAT_RGBX8888:
+ bo_format = GBM_FORMAT_RGBX8888;
+ break;
+ case SDL_PIXELFORMAT_BGRX8888:
+ bo_format = GBM_FORMAT_BGRX8888;
+ break;
+ case SDL_PIXELFORMAT_ARGB8888:
+ bo_format = GBM_FORMAT_ARGB8888;
+ break;
+ case SDL_PIXELFORMAT_RGBA8888:
+ bo_format = GBM_FORMAT_RGBA8888;
+ break;
+ case SDL_PIXELFORMAT_ABGR8888:
+ bo_format = GBM_FORMAT_ABGR8888;
+ break;
+ case SDL_PIXELFORMAT_BGRA8888:
+ bo_format = GBM_FORMAT_BGRA8888;
+ break;
+ case SDL_PIXELFORMAT_ARGB2101010:
+ bo_format = GBM_FORMAT_ARGB2101010;
+ break;
+ default:
+ SDL_SetError("Unsupported pixel format for cursor");
+ return NULL;
+ }
+
+ if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, bo_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) {
+ SDL_SetError("Unsupported pixel format for cursor");
+ return NULL;
+ }
+
+ cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
+ if (cursor == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ curdata = (KMSDRM_CursorData *) SDL_calloc(1, sizeof(*curdata));
+ if (curdata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(cursor);
+ return NULL;
+ }
+
+ /* We have to know beforehand if a cursor with the same size as the surface is supported.
+ * If it's not, we have to find an usable cursor size and use an intermediate and clean buffer.
+ * If we can't find a cursor size supported by the hardware, we won't go on trying to
+ * call SDL_SetCursor() later. */
+
+ usable_cursor_w = surface->w;
+ usable_cursor_h = surface->h;
+
+ while (usable_cursor_w <= MAX_CURSOR_W && usable_cursor_h <= MAX_CURSOR_H) {
+ if (KMSDRM_IsCursorSizeSupported(usable_cursor_w, usable_cursor_h, bo_format)) {
+ cursor_supported = SDL_TRUE;
+ break;
+ }
+ usable_cursor_w += usable_cursor_w;
+ usable_cursor_h += usable_cursor_h;
+ }
+
+ if (!cursor_supported) {
+ SDL_SetError("Could not find a cursor size supported by the kernel driver");
+ goto cleanup;
+ }
+
+ curdata->hot_x = hot_x;
+ curdata->hot_y = hot_y;
+ curdata->w = usable_cursor_w;
+ curdata->h = usable_cursor_h;
+
+ curdata->bo = KMSDRM_gbm_bo_create(vdata->gbm, usable_cursor_w, usable_cursor_h, bo_format,
+ GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
+
+ if (curdata->bo == NULL) {
+ SDL_SetError("Could not create GBM cursor BO");
+ goto cleanup;
+ }
+
+ bo_stride = KMSDRM_gbm_bo_get_stride(curdata->bo);
+ bufsize = bo_stride * curdata->h;
+
+ if (surface->pitch != bo_stride) {
+ /* pitch doesn't match stride, must be copied to temp buffer */
+ buffer = SDL_malloc(bufsize);
+ if (buffer == NULL) {
+ SDL_OutOfMemory();
+ goto cleanup;
+ }
+
+ if (SDL_MUSTLOCK(surface)) {
+ if (SDL_LockSurface(surface) < 0) {
+ /* Could not lock surface */
+ goto cleanup;
+ }
+ }
+
+ /* Clean the whole temporary buffer */
+ SDL_memset(buffer, 0x00, bo_stride * curdata->h);
+
+ /* Copy to temporary buffer */
+ for (i = 0; i < surface->h; i++) {
+ SDL_memcpy(buffer + (i * bo_stride),
+ ((char *)surface->pixels) + (i * surface->pitch),
+ surface->w * pixlfmt->BytesPerPixel);
+ }
+
+ if (SDL_MUSTLOCK(surface)) {
+ SDL_UnlockSurface(surface);
+ }
+
+ if (KMSDRM_gbm_bo_write(curdata->bo, buffer, bufsize)) {
+ SDL_SetError("Could not write to GBM cursor BO");
+ goto cleanup;
+ }
+
+ /* Free temporary buffer */
+ SDL_free(buffer);
+ buffer = NULL;
+ } else {
+ /* surface matches BO format */
+ if (SDL_MUSTLOCK(surface)) {
+ if (SDL_LockSurface(surface) < 0) {
+ /* Could not lock surface */
+ goto cleanup;
+ }
+ }
+
+ ret = KMSDRM_gbm_bo_write(curdata->bo, surface->pixels, bufsize);
+
+ if (SDL_MUSTLOCK(surface)) {
+ SDL_UnlockSurface(surface);
+ }
+
+ if (ret) {
+ SDL_SetError("Could not write to GBM cursor BO");
+ goto cleanup;
+ }
+ }
+
+ cursor->driverdata = curdata;
+
+ return cursor;
+
+cleanup:
+ if (buffer != NULL) {
+ SDL_free(buffer);
+ }
+ if (cursor != NULL) {
+ SDL_free(cursor);
+ }
+ if (curdata != NULL) {
+ if (curdata->bo != NULL) {
+ KMSDRM_gbm_bo_destroy(curdata->bo);
+ }
+ SDL_free(curdata);
+ }
+ return NULL;
+}
+
+/* Show the specified cursor, or hide if cursor is NULL */
+static int
+KMSDRM_ShowCursor(SDL_Cursor * cursor)
+{
+ SDL_VideoDevice *dev = SDL_GetVideoDevice();
+ SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata);
+ SDL_Mouse *mouse;
+ KMSDRM_CursorData *curdata;
+ SDL_VideoDisplay *display = NULL;
+ SDL_DisplayData *ddata = NULL;
+ int ret;
+ uint32_t bo_handle;
+
+ mouse = SDL_GetMouse();
+ if (mouse == NULL) {
+ return SDL_SetError("No mouse.");
+ }
+
+ if (mouse->focus != NULL) {
+ display = SDL_GetDisplayForWindow(mouse->focus);
+ if (display != NULL) {
+ ddata = (SDL_DisplayData*) display->driverdata;
+ }
+ }
+
+ if (cursor == NULL) {
+ /* Hide current cursor */
+ if ( mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
+ curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
+
+ if (curdata->crtc_id != 0) {
+ ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, curdata->crtc_id, 0, 0, 0);
+ if (ret) {
+ SDL_SetError("Could not hide current cursor with drmModeSetCursor().");
+ return ret;
+ }
+ /* Mark previous cursor as not-displayed */
+ curdata->crtc_id = 0;
+
+ return 0;
+ }
+ }
+ /* otherwise if possible, hide global cursor */
+ if (ddata != NULL && ddata->crtc_id != 0) {
+ ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, 0, 0, 0);
+ if (ret) {
+ SDL_SetError("Could not hide display's cursor with drmModeSetCursor().");
+ return ret;
+ }
+ return 0;
+ }
+
+ return SDL_SetError("Couldn't find cursor to hide.");
+ }
+ /* If cursor != NULL, show new cursor on display */
+ if (display == NULL) {
+ return SDL_SetError("Could not get display for mouse.");
+ }
+ if (ddata == NULL) {
+ return SDL_SetError("Could not get display driverdata.");
+ }
+
+ curdata = (KMSDRM_CursorData *) cursor->driverdata;
+ if (curdata == NULL || curdata->bo == NULL) {
+ return SDL_SetError("Cursor not initialized properly.");
+ }
+
+ bo_handle = KMSDRM_gbm_bo_get_handle(curdata->bo).u32;
+ if (curdata->hot_x == 0 && curdata->hot_y == 0) {
+ ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, bo_handle,
+ curdata->w, curdata->h);
+ } else {
+ ret = KMSDRM_drmModeSetCursor2(vdata->drm_fd, ddata->crtc_id, bo_handle,
+ curdata->w, curdata->h,
+ curdata->hot_x, curdata->hot_y);
+ }
+ if (ret) {
+ SDL_SetError("drmModeSetCursor failed.");
+ return ret;
+ }
+
+ curdata->crtc_id = ddata->crtc_id;
+
+ return 0;
+}
+
+/* Free a window manager cursor */
+static void
+KMSDRM_FreeCursor(SDL_Cursor * cursor)
+{
+ KMSDRM_CursorData *curdata;
+ int drm_fd;
+
+ if (cursor != NULL) {
+ curdata = (KMSDRM_CursorData *) cursor->driverdata;
+
+ if (curdata != NULL) {
+ if (curdata->bo != NULL) {
+ if (curdata->crtc_id != 0) {
+ drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+ /* Hide the cursor if previously shown on a CRTC */
+ KMSDRM_drmModeSetCursor(drm_fd, curdata->crtc_id, 0, 0, 0);
+ curdata->crtc_id = 0;
+ }
+ KMSDRM_gbm_bo_destroy(curdata->bo);
+ curdata->bo = NULL;
+ }
+ SDL_free(cursor->driverdata);
+ }
+ SDL_free(cursor);
+ }
+}
+
+/* Warp the mouse to (x,y) */
+static void
+KMSDRM_WarpMouse(SDL_Window * window, int x, int y)
+{
+ /* Only one global/fullscreen window is supported */
+ KMSDRM_WarpMouseGlobal(x, y);
+}
+
+/* Warp the mouse to (x,y) */
+static int
+KMSDRM_WarpMouseGlobal(int x, int y)
+{
+ KMSDRM_CursorData *curdata;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
+ /* Update internal mouse position. */
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
+
+ /* And now update the cursor graphic position on screen. */
+ curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
+ if (curdata->bo != NULL) {
+
+ if (curdata->crtc_id != 0) {
+ int ret, drm_fd;
+ drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+ ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, x, y);
+
+ if (ret) {
+ SDL_SetError("drmModeMoveCursor() failed.");
+ }
+
+ return ret;
+ } else {
+ return SDL_SetError("Cursor is not currently shown.");
+ }
+ } else {
+ return SDL_SetError("Cursor not initialized properly.");
+ }
+ } else {
+ return SDL_SetError("No mouse or current cursor.");
+ }
+}
+
+void
+KMSDRM_InitMouse(_THIS)
+{
+ /* FIXME: Using UDEV it should be possible to scan all mice
+ * but there's no point in doing so as there's no multimice support...yet!
+ */
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = KMSDRM_CreateCursor;
+ mouse->ShowCursor = KMSDRM_ShowCursor;
+ mouse->MoveCursor = KMSDRM_MoveCursor;
+ mouse->FreeCursor = KMSDRM_FreeCursor;
+ mouse->WarpMouse = KMSDRM_WarpMouse;
+ mouse->WarpMouseGlobal = KMSDRM_WarpMouseGlobal;
+
+ SDL_SetDefaultCursor(KMSDRM_CreateDefaultCursor());
+}
+
+void
+KMSDRM_QuitMouse(_THIS)
+{
+ /* TODO: ? */
+}
+
+/* This is called when a mouse motion event occurs */
+static void
+KMSDRM_MoveCursor(SDL_Cursor * cursor)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ KMSDRM_CursorData *curdata;
+ int drm_fd, ret;
+
+ /* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
+ That's why we move the cursor graphic ONLY. */
+ if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
+ curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
+ drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+ ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y);
+
+ if (ret) {
+ SDL_SetError("drmModeMoveCursor() failed.");
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h
new file mode 100644
index 0000000..754417d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h
@@ -0,0 +1,45 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_KMSDRM_mouse_h_
+#define SDL_KMSDRM_mouse_h_
+
+#include <gbm.h>
+
+#define MAX_CURSOR_W 512
+#define MAX_CURSOR_H 512
+
+typedef struct _KMSDRM_CursorData
+{
+ struct gbm_bo *bo;
+ uint32_t crtc_id;
+ int hot_x, hot_y;
+ int w, h;
+} KMSDRM_CursorData;
+
+extern void KMSDRM_InitMouse(_THIS);
+extern void KMSDRM_QuitMouse(_THIS);
+
+#endif /* SDL_KMSDRM_mouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c
new file mode 100644
index 0000000..7a0b079
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -0,0 +1,189 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_log.h"
+
+#include "SDL_kmsdrmvideo.h"
+#include "SDL_kmsdrmopengles.h"
+#include "SDL_kmsdrmdyn.h"
+
+#ifndef EGL_PLATFORM_GBM_MESA
+#define EGL_PLATFORM_GBM_MESA 0x31D7
+#endif
+
+/* EGL implementation of SDL OpenGL support */
+
+int
+KMSDRM_GLES_LoadLibrary(_THIS, const char *path) {
+ return SDL_EGL_LoadLibrary(_this, path, ((SDL_VideoData *)_this->driverdata)->gbm, EGL_PLATFORM_GBM_MESA);
+}
+
+SDL_EGL_CreateContext_impl(KMSDRM)
+
+SDL_bool
+KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) {
+ SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata);
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+ KMSDRM_FBInfo *fb_info;
+
+ if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup");
+ return SDL_FALSE;
+ }
+
+ wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
+ if (wdata->next_bo == NULL) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
+ return SDL_FALSE;
+ }
+
+ fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo);
+ if (fb_info == NULL) {
+ return SDL_FALSE;
+ }
+
+ if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id,
+ 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) {
+ SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer");
+ return SDL_FALSE;
+
+ }
+
+ wdata->crtc_ready = SDL_TRUE;
+ return SDL_TRUE;
+}
+
+int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) {
+ if (!_this->egl_data) {
+ return SDL_SetError("EGL not initialized");
+ }
+
+ if (interval == 0 || interval == 1) {
+ _this->egl_data->egl_swapinterval = interval;
+ } else {
+ return SDL_SetError("Only swap intervals of 0 or 1 are supported");
+ }
+
+ return 0;
+}
+
+int
+KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
+ SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata);
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+ KMSDRM_FBInfo *fb_info;
+ int ret;
+
+ /* Do we still need to wait for a flip? */
+ int timeout = 0;
+ if (_this->egl_data->egl_swapinterval == 1) {
+ timeout = -1;
+ }
+ if (!KMSDRM_WaitPageFlip(_this, wdata, timeout)) {
+ return 0;
+ }
+
+ /* Release previously displayed buffer (which is now the backbuffer) and lock a new one */
+ if (wdata->next_bo != NULL) {
+ KMSDRM_gbm_surface_release_buffer(wdata->gs, wdata->current_bo);
+ /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Released GBM surface %p", (void *)wdata->next_bo); */
+
+ wdata->current_bo = wdata->next_bo;
+ wdata->next_bo = NULL;
+ }
+
+ if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed.");
+ return 0;
+ }
+
+ if (wdata->current_bo == NULL) {
+ wdata->current_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
+ if (wdata->current_bo == NULL) {
+ return 0;
+ }
+ }
+
+ wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
+ if (wdata->next_bo == NULL) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer");
+ return 0;
+ /* } else {
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Locked GBM surface %p", (void *)wdata->next_bo); */
+ }
+
+ fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo);
+ if (fb_info == NULL) {
+ return 0;
+ }
+ if (_this->egl_data->egl_swapinterval == 0) {
+ /* Swap buffers instantly, possible tearing */
+ /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModeSetCrtc(%d, %u, %u, 0, 0, &%u, 1, &%ux%u@%u)",
+ vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, vdata->saved_conn_id,
+ displaydata->cur_mode.hdisplay, displaydata->cur_mode.vdisplay, displaydata->cur_mode.vrefresh); */
+ ret = KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id,
+ 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode);
+ if(ret != 0) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not pageflip with drmModeSetCrtc: %d", ret);
+ }
+ } else {
+ /* Queue page flip at vsync */
+
+ /* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not,
+ or FlipPage won't work in some cases. */
+ if (!wdata->crtc_ready) {
+ if(!KMSDRM_GLES_SetupCrtc(_this, window)) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips");
+ return 0;
+ }
+ }
+
+ /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)",
+ vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */
+ ret = KMSDRM_drmModePageFlip(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip);
+ if (ret == 0) {
+ wdata->waiting_for_flip = SDL_TRUE;
+ } else {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not queue pageflip: %d", ret);
+ }
+
+ /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios.
+ Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 <program_name>" to enable this. */
+ if (wdata->double_buffer) {
+ KMSDRM_WaitPageFlip(_this, wdata, -1);
+ }
+ }
+
+ return 0;
+}
+
+SDL_EGL_MakeCurrent_impl(KMSDRM)
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h
new file mode 100644
index 0000000..d0a7bfa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_kmsdrmopengles_h_
+#define SDL_kmsdrmopengles_h_
+
+#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define KMSDRM_GLES_GetAttribute SDL_EGL_GetAttribute
+#define KMSDRM_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define KMSDRM_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define KMSDRM_GLES_DeleteContext SDL_EGL_DeleteContext
+#define KMSDRM_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+
+extern int KMSDRM_GLES_SetSwapInterval(_THIS, int interval);
+extern int KMSDRM_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_kmsdrmopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h
new file mode 100644
index 0000000..3ab2318
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h
@@ -0,0 +1,99 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* *INDENT-OFF* */
+
+#ifndef SDL_KMSDRM_MODULE
+#define SDL_KMSDRM_MODULE(modname)
+#endif
+
+#ifndef SDL_KMSDRM_SYM
+#define SDL_KMSDRM_SYM(rc,fn,params)
+#endif
+
+#ifndef SDL_KMSDRM_SYM_CONST
+#define SDL_KMSDRM_SYM_CONST(type, name)
+#endif
+
+
+SDL_KMSDRM_MODULE(LIBDRM)
+SDL_KMSDRM_SYM(void,drmModeFreeResources,(drmModeResPtr ptr))
+SDL_KMSDRM_SYM(void,drmModeFreeFB,(drmModeFBPtr ptr))
+SDL_KMSDRM_SYM(void,drmModeFreeCrtc,(drmModeCrtcPtr ptr))
+SDL_KMSDRM_SYM(void,drmModeFreeConnector,(drmModeConnectorPtr ptr))
+SDL_KMSDRM_SYM(void,drmModeFreeEncoder,(drmModeEncoderPtr ptr))
+SDL_KMSDRM_SYM(drmModeResPtr,drmModeGetResources,(int fd))
+SDL_KMSDRM_SYM(int,drmModeAddFB,(int fd, uint32_t width, uint32_t height, uint8_t depth,
+ uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
+ uint32_t *buf_id))
+SDL_KMSDRM_SYM(int,drmModeRmFB,(int fd, uint32_t bufferId))
+SDL_KMSDRM_SYM(drmModeFBPtr,drmModeGetFB,(int fd, uint32_t buf))
+SDL_KMSDRM_SYM(drmModeCrtcPtr,drmModeGetCrtc,(int fd, uint32_t crtcId))
+SDL_KMSDRM_SYM(int,drmModeSetCrtc,(int fd, uint32_t crtcId, uint32_t bufferId,
+ uint32_t x, uint32_t y, uint32_t *connectors, int count,
+ drmModeModeInfoPtr mode))
+SDL_KMSDRM_SYM(int,drmModeSetCursor,(int fd, uint32_t crtcId, uint32_t bo_handle,
+ uint32_t width, uint32_t height))
+SDL_KMSDRM_SYM(int,drmModeSetCursor2,(int fd, uint32_t crtcId, uint32_t bo_handle,
+ uint32_t width, uint32_t height,
+ int32_t hot_x, int32_t hot_y))
+SDL_KMSDRM_SYM(int,drmModeMoveCursor,(int fd, uint32_t crtcId, int x, int y))
+SDL_KMSDRM_SYM(drmModeEncoderPtr,drmModeGetEncoder,(int fd, uint32_t encoder_id))
+SDL_KMSDRM_SYM(drmModeConnectorPtr,drmModeGetConnector,(int fd, uint32_t connector_id))
+SDL_KMSDRM_SYM(int,drmHandleEvent,(int fd,drmEventContextPtr evctx))
+SDL_KMSDRM_SYM(int,drmModePageFlip,(int fd, uint32_t crtc_id, uint32_t fb_id,
+ uint32_t flags, void *user_data))
+
+
+SDL_KMSDRM_MODULE(GBM)
+SDL_KMSDRM_SYM(int,gbm_device_get_fd,(struct gbm_device *gbm))
+SDL_KMSDRM_SYM(int,gbm_device_is_format_supported,(struct gbm_device *gbm,
+ uint32_t format, uint32_t usage))
+SDL_KMSDRM_SYM(void,gbm_device_destroy,(struct gbm_device *gbm))
+SDL_KMSDRM_SYM(struct gbm_device *,gbm_create_device,(int fd))
+SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_width,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_height,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(union gbm_bo_handle,gbm_bo_get_handle,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(int,gbm_bo_write,(struct gbm_bo *bo, const void *buf, size_t count))
+SDL_KMSDRM_SYM(struct gbm_device *,gbm_bo_get_device,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(void,gbm_bo_set_user_data,(struct gbm_bo *bo, void *data,
+ void (*destroy_user_data)(struct gbm_bo *, void *)))
+SDL_KMSDRM_SYM(void *,gbm_bo_get_user_data,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(void,gbm_bo_destroy,(struct gbm_bo *bo))
+SDL_KMSDRM_SYM(struct gbm_bo *,gbm_bo_create,(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t usage))
+SDL_KMSDRM_SYM(struct gbm_surface *,gbm_surface_create,(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t flags))
+SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf))
+SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf))
+SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo))
+
+
+#undef SDL_KMSDRM_MODULE
+#undef SDL_KMSDRM_SYM
+#undef SDL_KMSDRM_SYM_CONST
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c
new file mode 100644
index 0000000..7855eed
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -0,0 +1,664 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_KMSDRM
+
+/* SDL internals */
+#include "../SDL_sysvideo.h"
+#include "SDL_syswm.h"
+#include "SDL_log.h"
+#include "SDL_hints.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+
+#ifdef SDL_INPUT_LINUXEV
+#include "../../core/linux/SDL_evdev.h"
+#endif
+
+/* KMS/DRM declarations */
+#include "SDL_kmsdrmvideo.h"
+#include "SDL_kmsdrmevents.h"
+#include "SDL_kmsdrmopengles.h"
+#include "SDL_kmsdrmmouse.h"
+#include "SDL_kmsdrmdyn.h"
+
+#define KMSDRM_DRI_CARD_0 "/dev/dri/card0"
+
+static int
+KMSDRM_Available(void)
+{
+ int available = 0;
+
+ int drm_fd = open(KMSDRM_DRI_CARD_0, O_RDWR | O_CLOEXEC);
+ if (drm_fd >= 0) {
+ if (SDL_KMSDRM_LoadSymbols()) {
+ drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd);
+ if (resources != NULL) {
+ available = 1;
+ KMSDRM_drmModeFreeResources(resources);
+ }
+ SDL_KMSDRM_UnloadSymbols();
+ }
+ close(drm_fd);
+ }
+
+ return available;
+}
+
+static void
+KMSDRM_Destroy(SDL_VideoDevice * device)
+{
+ if (device->driverdata != NULL) {
+ SDL_free(device->driverdata);
+ device->driverdata = NULL;
+ }
+
+ SDL_free(device);
+ SDL_KMSDRM_UnloadSymbols();
+}
+
+static SDL_VideoDevice *
+KMSDRM_Create(int devindex)
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *vdata;
+
+ if (devindex < 0 || devindex > 99) {
+ SDL_SetError("devindex (%d) must be between 0 and 99.\n", devindex);
+ return NULL;
+ }
+
+ if (!SDL_KMSDRM_LoadSymbols()) {
+ return NULL;
+ }
+
+ /* Initialize SDL_VideoDevice structure */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize internal data */
+ vdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (vdata == NULL) {
+ SDL_OutOfMemory();
+ goto cleanup;
+ }
+ vdata->devindex = devindex;
+ vdata->drm_fd = -1;
+
+ device->driverdata = vdata;
+
+ /* Setup amount of available displays and current display */
+ device->num_displays = 0;
+
+ /* Set device free function */
+ device->free = KMSDRM_Destroy;
+
+ /* Setup all functions which we can handle */
+ device->VideoInit = KMSDRM_VideoInit;
+ device->VideoQuit = KMSDRM_VideoQuit;
+ device->GetDisplayModes = KMSDRM_GetDisplayModes;
+ device->SetDisplayMode = KMSDRM_SetDisplayMode;
+ device->CreateSDLWindow = KMSDRM_CreateWindow;
+ device->CreateSDLWindowFrom = KMSDRM_CreateWindowFrom;
+ device->SetWindowTitle = KMSDRM_SetWindowTitle;
+ device->SetWindowIcon = KMSDRM_SetWindowIcon;
+ device->SetWindowPosition = KMSDRM_SetWindowPosition;
+ device->SetWindowSize = KMSDRM_SetWindowSize;
+ device->ShowWindow = KMSDRM_ShowWindow;
+ device->HideWindow = KMSDRM_HideWindow;
+ device->RaiseWindow = KMSDRM_RaiseWindow;
+ device->MaximizeWindow = KMSDRM_MaximizeWindow;
+ device->MinimizeWindow = KMSDRM_MinimizeWindow;
+ device->RestoreWindow = KMSDRM_RestoreWindow;
+ device->SetWindowGrab = KMSDRM_SetWindowGrab;
+ device->DestroyWindow = KMSDRM_DestroyWindow;
+ device->GetWindowWMInfo = KMSDRM_GetWindowWMInfo;
+#if SDL_VIDEO_OPENGL_EGL
+ device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary;
+ device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = KMSDRM_GLES_UnloadLibrary;
+ device->GL_CreateContext = KMSDRM_GLES_CreateContext;
+ device->GL_MakeCurrent = KMSDRM_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = KMSDRM_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = KMSDRM_GLES_GetSwapInterval;
+ device->GL_SwapWindow = KMSDRM_GLES_SwapWindow;
+ device->GL_DeleteContext = KMSDRM_GLES_DeleteContext;
+#endif
+
+ device->PumpEvents = KMSDRM_PumpEvents;
+
+ return device;
+
+cleanup:
+ if (device != NULL)
+ SDL_free(device);
+ if (vdata != NULL)
+ SDL_free(vdata);
+ return NULL;
+}
+
+VideoBootStrap KMSDRM_bootstrap = {
+ "KMSDRM",
+ "KMS/DRM Video Driver",
+ KMSDRM_Available,
+ KMSDRM_Create
+};
+
+
+static void
+KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data)
+{
+ KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data;
+
+ if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) {
+ KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id);
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id);
+ }
+
+ free(fb_info);
+}
+
+KMSDRM_FBInfo *
+KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
+{
+ uint32_t w, h, stride, handle;
+ int ret;
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+ KMSDRM_FBInfo *fb_info;
+
+ fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo);
+ if (fb_info != NULL) {
+ /* Have a previously used framebuffer, return it */
+ return fb_info;
+ }
+
+ /* Here a new DRM FB must be created */
+ fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo));
+ if (fb_info == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ fb_info->drm_fd = vdata->drm_fd;
+
+ w = KMSDRM_gbm_bo_get_width(bo);
+ h = KMSDRM_gbm_bo_get_height(bo);
+ stride = KMSDRM_gbm_bo_get_stride(bo);
+ handle = KMSDRM_gbm_bo_get_handle(bo).u32;
+
+ ret = KMSDRM_drmModeAddFB(vdata->drm_fd, w, h, 24, 32, stride, handle, &fb_info->fb_id);
+ if (ret < 0) {
+ free(fb_info);
+ return NULL;
+ }
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, stride %u from BO %p", fb_info->fb_id, w, h, stride, (void *)bo);
+
+ /* Associate our DRM framebuffer with this buffer object */
+ KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback);
+ return fb_info;
+}
+
+SDL_bool
+KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout) {
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+
+ while (wdata->waiting_for_flip) {
+ vdata->drm_pollfd.revents = 0;
+ if (poll(&vdata->drm_pollfd, 1, timeout) < 0) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll error");
+ return SDL_FALSE;
+ }
+
+ if (vdata->drm_pollfd.revents & (POLLHUP | POLLERR)) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll hup or error");
+ return SDL_FALSE;
+ }
+
+ if (vdata->drm_pollfd.revents & POLLIN) {
+ /* Page flip? If so, drmHandleEvent will unset wdata->waiting_for_flip */
+ KMSDRM_drmHandleEvent(vdata->drm_fd, &vdata->drm_evctx);
+ } else {
+ /* Timed out and page flip didn't happen */
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Dropping frame while waiting_for_flip");
+ return SDL_FALSE;
+ }
+ }
+ return SDL_TRUE;
+}
+
+static void
+KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data)
+{
+ *((SDL_bool *) data) = SDL_FALSE;
+}
+
+
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions */
+/* _this is a SDL_VideoDevice * */
+/*****************************************************************************/
+int
+KMSDRM_VideoInit(_THIS)
+{
+ int i;
+ int ret = 0;
+ char *devname;
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+ drmModeRes *resources = NULL;
+ drmModeConnector *connector = NULL;
+ drmModeEncoder *encoder = NULL;
+ SDL_DisplayMode current_mode;
+ SDL_VideoDisplay display;
+
+ /* Allocate display internal data */
+ SDL_DisplayData *data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
+ if (data == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()");
+
+ /* Open /dev/dri/cardNN */
+ devname = (char *) SDL_calloc(1, 16);
+ if (devname == NULL) {
+ ret = SDL_OutOfMemory();
+ goto cleanup;
+ }
+ SDL_snprintf(devname, 16, "/dev/dri/card%d", vdata->devindex);
+ vdata->drm_fd = open(devname, O_RDWR | O_CLOEXEC);
+ SDL_free(devname);
+
+ if (vdata->drm_fd < 0) {
+ ret = SDL_SetError("Could not open /dev/dri/card%d.", vdata->devindex);
+ goto cleanup;
+ }
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opened DRM FD (%d)", vdata->drm_fd);
+
+ vdata->gbm = KMSDRM_gbm_create_device(vdata->drm_fd);
+ if (vdata->gbm == NULL) {
+ ret = SDL_SetError("Couldn't create gbm device.");
+ goto cleanup;
+ }
+
+ /* Find the first available connector with modes */
+ resources = KMSDRM_drmModeGetResources(vdata->drm_fd);
+ if (!resources) {
+ ret = SDL_SetError("drmModeGetResources(%d) failed", vdata->drm_fd);
+ goto cleanup;
+ }
+
+ for (i = 0; i < resources->count_connectors; i++) {
+ connector = KMSDRM_drmModeGetConnector(vdata->drm_fd, resources->connectors[i]);
+ if (connector == NULL)
+ continue;
+
+ if (connector->connection == DRM_MODE_CONNECTED &&
+ connector->count_modes > 0) {
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found connector %d with %d modes.",
+ connector->connector_id, connector->count_modes);
+ vdata->saved_conn_id = connector->connector_id;
+ break;
+ }
+
+ KMSDRM_drmModeFreeConnector(connector);
+ connector = NULL;
+ }
+
+ if (i == resources->count_connectors) {
+ ret = SDL_SetError("No currently active connector found.");
+ goto cleanup;
+ }
+
+ for (i = 0; i < resources->count_encoders; i++) {
+ encoder = KMSDRM_drmModeGetEncoder(vdata->drm_fd, resources->encoders[i]);
+
+ if (encoder == NULL)
+ continue;
+
+ if (encoder->encoder_id == connector->encoder_id) {
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found encoder %d.", encoder->encoder_id);
+ data->encoder_id = encoder->encoder_id;
+ break;
+ }
+
+ KMSDRM_drmModeFreeEncoder(encoder);
+ encoder = NULL;
+ }
+
+ if (i == resources->count_encoders) {
+ ret = SDL_SetError("No connected encoder found.");
+ goto cleanup;
+ }
+
+ vdata->saved_crtc = KMSDRM_drmModeGetCrtc(vdata->drm_fd, encoder->crtc_id);
+ if (vdata->saved_crtc == NULL) {
+ ret = SDL_SetError("No CRTC found.");
+ goto cleanup;
+ }
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Saved crtc_id %u, fb_id %u, (%u,%u), %ux%u",
+ vdata->saved_crtc->crtc_id, vdata->saved_crtc->buffer_id, vdata->saved_crtc->x,
+ vdata->saved_crtc->y, vdata->saved_crtc->width, vdata->saved_crtc->height);
+ data->crtc_id = encoder->crtc_id;
+ data->cur_mode = vdata->saved_crtc->mode;
+ vdata->crtc_id = encoder->crtc_id;
+
+ SDL_zero(current_mode);
+
+ current_mode.w = vdata->saved_crtc->mode.hdisplay;
+ current_mode.h = vdata->saved_crtc->mode.vdisplay;
+ current_mode.refresh_rate = vdata->saved_crtc->mode.vrefresh;
+
+ /* FIXME ?
+ drmModeFB *fb = drmModeGetFB(vdata->drm_fd, vdata->saved_crtc->buffer_id);
+ current_mode.format = drmToSDLPixelFormat(fb->bpp, fb->depth);
+ drmModeFreeFB(fb);
+ */
+ current_mode.format = SDL_PIXELFORMAT_ARGB8888;
+
+ current_mode.driverdata = NULL;
+
+ SDL_zero(display);
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+
+ display.driverdata = data;
+ /* SDL_VideoQuit will later SDL_free(display.driverdata) */
+ SDL_AddVideoDisplay(&display);
+
+ /* Setup page flip handler */
+ vdata->drm_pollfd.fd = vdata->drm_fd;
+ vdata->drm_pollfd.events = POLLIN;
+ vdata->drm_evctx.version = DRM_EVENT_CONTEXT_VERSION;
+ vdata->drm_evctx.page_flip_handler = KMSDRM_FlipHandler;
+
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Init();
+#endif
+
+ KMSDRM_InitMouse(_this);
+
+cleanup:
+ if (encoder != NULL)
+ KMSDRM_drmModeFreeEncoder(encoder);
+ if (connector != NULL)
+ KMSDRM_drmModeFreeConnector(connector);
+ if (resources != NULL)
+ KMSDRM_drmModeFreeResources(resources);
+
+ if (ret != 0) {
+ /* Error (complete) cleanup */
+ SDL_free(data);
+ if(vdata->saved_crtc != NULL) {
+ KMSDRM_drmModeFreeCrtc(vdata->saved_crtc);
+ vdata->saved_crtc = NULL;
+ }
+ if (vdata->gbm != NULL) {
+ KMSDRM_gbm_device_destroy(vdata->gbm);
+ vdata->gbm = NULL;
+ }
+ if (vdata->drm_fd >= 0) {
+ close(vdata->drm_fd);
+ vdata->drm_fd = -1;
+ }
+ }
+ return ret;
+}
+
+void
+KMSDRM_VideoQuit(_THIS)
+{
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoQuit()");
+
+ if (_this->gl_config.driver_loaded) {
+ SDL_GL_UnloadLibrary();
+ }
+
+ if(vdata->saved_crtc != NULL) {
+ if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) {
+ /* Restore saved CRTC settings */
+ drmModeCrtc *crtc = vdata->saved_crtc;
+ if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id,
+ crtc->x, crtc->y, &vdata->saved_conn_id, 1,
+ &crtc->mode) != 0) {
+ SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not restore original CRTC mode");
+ }
+ }
+ KMSDRM_drmModeFreeCrtc(vdata->saved_crtc);
+ vdata->saved_crtc = NULL;
+ }
+ if (vdata->gbm != NULL) {
+ KMSDRM_gbm_device_destroy(vdata->gbm);
+ vdata->gbm = NULL;
+ }
+ if (vdata->drm_fd >= 0) {
+ close(vdata->drm_fd);
+ SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Closed DRM FD %d", vdata->drm_fd);
+ vdata->drm_fd = -1;
+ }
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Quit();
+#endif
+}
+
+void
+KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ /* Only one display mode available, the current one */
+ SDL_AddDisplayMode(display, &display->current_mode);
+}
+
+int
+KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+int
+KMSDRM_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wdata;
+ SDL_VideoDisplay *display;
+ SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata);
+ Uint32 surface_fmt, surface_flags;
+
+ /* Allocate window internal data */
+ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (wdata == NULL) {
+ SDL_OutOfMemory();
+ goto error;
+ }
+
+ wdata->waiting_for_flip = SDL_FALSE;
+ display = SDL_GetDisplayForWindow(window);
+
+ /* Windows have one size for now */
+ window->w = display->desktop_mode.w;
+ window->h = display->desktop_mode.h;
+
+ /* Maybe you didn't ask for a fullscreen OpenGL window, but that's what you get */
+ window->flags |= (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL);
+
+ surface_fmt = GBM_FORMAT_XRGB8888;
+ surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
+
+ if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, surface_fmt, surface_flags)) {
+ SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway.");
+ }
+ wdata->gs = KMSDRM_gbm_surface_create(vdata->gbm, window->w, window->h, surface_fmt, surface_flags);
+
+#if SDL_VIDEO_OPENGL_EGL
+ if (!_this->egl_data) {
+ if (SDL_GL_LoadLibrary(NULL) < 0) {
+ goto error;
+ }
+ }
+ wdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wdata->gs);
+
+ if (wdata->egl_surface == EGL_NO_SURFACE) {
+ SDL_SetError("Could not create EGL window surface");
+ goto error;
+ }
+#endif /* SDL_VIDEO_OPENGL_EGL */
+
+ /* In case we want low-latency, double-buffer video, we take note here */
+ wdata->double_buffer = SDL_FALSE;
+ if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) {
+ wdata->double_buffer = SDL_TRUE;
+ }
+
+ /* Window is created, but we have yet to set up CRTC to one of the GBM buffers if we want
+ drmModePageFlip to work, and we can't do it until EGL is completely setup, because we
+ need to do eglSwapBuffers so we can get a valid GBM buffer object to call
+ drmModeSetCrtc on it. */
+ wdata->crtc_ready = SDL_FALSE;
+
+ /* Setup driver data for this window */
+ window->driverdata = wdata;
+
+ /* One window, it always has focus */
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+
+ /* Window has been successfully created */
+ return 0;
+
+error:
+ if (wdata != NULL) {
+#if SDL_VIDEO_OPENGL_EGL
+ if (wdata->egl_surface != EGL_NO_SURFACE)
+ SDL_EGL_DestroySurface(_this, wdata->egl_surface);
+#endif /* SDL_VIDEO_OPENGL_EGL */
+ if (wdata->gs != NULL)
+ KMSDRM_gbm_surface_destroy(wdata->gs);
+ SDL_free(wdata);
+ }
+ return -1;
+}
+
+void
+KMSDRM_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ if(data) {
+ /* Wait for any pending page flips and unlock buffer */
+ KMSDRM_WaitPageFlip(_this, data, -1);
+ if (data->next_bo != NULL) {
+ KMSDRM_gbm_surface_release_buffer(data->gs, data->next_bo);
+ data->next_bo = NULL;
+ }
+ if (data->current_bo != NULL) {
+ KMSDRM_gbm_surface_release_buffer(data->gs, data->current_bo);
+ data->current_bo = NULL;
+ }
+#if SDL_VIDEO_OPENGL_EGL
+ SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ }
+#endif /* SDL_VIDEO_OPENGL_EGL */
+ if (data->gs != NULL) {
+ KMSDRM_gbm_surface_destroy(data->gs);
+ data->gs = NULL;
+ }
+ SDL_free(data);
+ window->driverdata = NULL;
+ }
+}
+
+int
+KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ return -1;
+}
+
+void
+KMSDRM_SetWindowTitle(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+}
+void
+KMSDRM_SetWindowPosition(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_SetWindowSize(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_ShowWindow(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_HideWindow(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_RaiseWindow(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_MaximizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_MinimizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_RestoreWindow(_THIS, SDL_Window * window)
+{
+}
+void
+KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function */
+/*****************************************************************************/
+SDL_bool
+KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("application not compiled with SDL %d.%d\n",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+
+ /* Failed to get window manager information */
+ return SDL_FALSE;
+}
+
+#endif /* SDL_VIDEO_DRIVER_KMSDRM */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h
new file mode 100644
index 0000000..5f00f0e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h
@@ -0,0 +1,124 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef __SDL_KMSDRMVIDEO_H__
+#define __SDL_KMSDRMVIDEO_H__
+
+#include "../SDL_sysvideo.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <poll.h>
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#include <gbm.h>
+#if SDL_VIDEO_OPENGL_EGL
+#include <EGL/egl.h>
+#endif
+
+typedef struct SDL_VideoData
+{
+ int devindex; /* device index that was passed on creation */
+ int drm_fd; /* DRM file desc */
+ struct gbm_device *gbm;
+ drmEventContext drm_evctx; /* DRM event context */
+ struct pollfd drm_pollfd; /* pollfd containing DRM file desc */
+ drmModeCrtc *saved_crtc; /* Saved CRTC to restore on quit */
+ uint32_t saved_conn_id; /* Saved DRM connector ID */
+ uint32_t crtc_id; /* CRTC in use */
+} SDL_VideoData;
+
+
+typedef struct SDL_DisplayData
+{
+ uint32_t encoder_id;
+ uint32_t crtc_id;
+ drmModeModeInfo cur_mode;
+} SDL_DisplayData;
+
+
+typedef struct SDL_WindowData
+{
+ struct gbm_surface *gs;
+ struct gbm_bo *current_bo;
+ struct gbm_bo *next_bo;
+ SDL_bool waiting_for_flip;
+ SDL_bool crtc_ready;
+ SDL_bool double_buffer;
+#if SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+} SDL_WindowData;
+
+typedef struct KMSDRM_FBInfo
+{
+ int drm_fd; /* DRM file desc */
+ uint32_t fb_id; /* DRM framebuffer ID */
+} KMSDRM_FBInfo;
+
+/* Helper functions */
+KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo);
+SDL_bool KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout);
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration */
+/****************************************************************************/
+
+/* Display and window functions */
+int KMSDRM_VideoInit(_THIS);
+void KMSDRM_VideoQuit(_THIS);
+void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+int KMSDRM_CreateWindow(_THIS, SDL_Window * window);
+int KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+void KMSDRM_SetWindowTitle(_THIS, SDL_Window * window);
+void KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+void KMSDRM_SetWindowPosition(_THIS, SDL_Window * window);
+void KMSDRM_SetWindowSize(_THIS, SDL_Window * window);
+void KMSDRM_ShowWindow(_THIS, SDL_Window * window);
+void KMSDRM_HideWindow(_THIS, SDL_Window * window);
+void KMSDRM_RaiseWindow(_THIS, SDL_Window * window);
+void KMSDRM_MaximizeWindow(_THIS, SDL_Window * window);
+void KMSDRM_MinimizeWindow(_THIS, SDL_Window * window);
+void KMSDRM_RestoreWindow(_THIS, SDL_Window * window);
+void KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+void KMSDRM_DestroyWindow(_THIS, SDL_Window * window);
+
+/* Window manager function */
+SDL_bool KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+/* OpenGL/OpenGL ES functions */
+int KMSDRM_GLES_LoadLibrary(_THIS, const char *path);
+void *KMSDRM_GLES_GetProcAddress(_THIS, const char *proc);
+void KMSDRM_GLES_UnloadLibrary(_THIS);
+SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window);
+int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+int KMSDRM_GLES_SetSwapInterval(_THIS, int interval);
+int KMSDRM_GLES_GetSwapInterval(_THIS);
+int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window);
+void KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context);
+
+#endif /* __SDL_KMSDRMVIDEO_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.c
new file mode 100644
index 0000000..71dc73c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.c
@@ -0,0 +1,170 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#define DEBUG_DYNAMIC_MIR 0
+
+#include "SDL_mirdyn.h"
+
+#if DEBUG_DYNAMIC_MIR
+#include "SDL_log.h"
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+ void *lib;
+ const char *libname;
+} mirdynlib;
+
+#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC
+#define SDL_VIDEO_DRIVER_MIR_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
+#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON NULL
+#endif
+
+static mirdynlib mirlibs[] = {
+ {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC},
+ {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON}
+};
+
+static void *
+MIR_GetSym(const char *fnname, int *pHasModule)
+{
+ int i;
+ void *fn = NULL;
+ for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
+ if (mirlibs[i].lib != NULL) {
+ fn = SDL_LoadFunction(mirlibs[i].lib, fnname);
+ if (fn != NULL)
+ break;
+ }
+ }
+
+#if DEBUG_DYNAMIC_MIR
+ if (fn != NULL)
+ SDL_Log("MIR: Found '%s' in %s (%p)\n", fnname, mirlibs[i].libname, fn);
+ else
+ SDL_Log("MIR: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+ if (fn == NULL)
+ *pHasModule = 0; /* kill this module. */
+
+ return fn;
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR_DYNAMIC */
+
+/* Define all the function pointers and wrappers... */
+#define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0;
+#define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL;
+#define SDL_MIR_SYM_CONST(type,name) SDL_DYMMIRCONST_##name MIR_##name = NULL;
+#include "SDL_mirsym.h"
+
+static int mir_load_refcount = 0;
+
+void
+SDL_MIR_UnloadSymbols(void)
+{
+ /* Don't actually unload if more than one module is using the libs... */
+ if (mir_load_refcount > 0) {
+ if (--mir_load_refcount == 0) {
+#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
+ int i;
+#endif
+
+ /* set all the function pointers to NULL. */
+#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
+#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
+#define SDL_MIR_SYM_CONST(type,name) MIR_##name = NULL;
+#include "SDL_mirsym.h"
+
+
+#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
+ for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
+ if (mirlibs[i].lib != NULL) {
+ SDL_UnloadObject(mirlibs[i].lib);
+ mirlibs[i].lib = NULL;
+ }
+ }
+#endif
+ }
+ }
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_MIR_LoadSymbols(void)
+{
+ int rc = 1; /* always succeed if not using Dynamic MIR stuff. */
+
+ /* deal with multiple modules (dga, wayland, mir, etc) needing these symbols... */
+ if (mir_load_refcount++ == 0) {
+#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
+ int i;
+ int *thismod = NULL;
+ for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
+ if (mirlibs[i].libname != NULL) {
+ mirlibs[i].lib = SDL_LoadObject(mirlibs[i].libname);
+ }
+ }
+
+#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
+#include "SDL_mirsym.h"
+
+#define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
+#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
+#define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod);
+#include "SDL_mirsym.h"
+
+ if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) {
+ /* all required symbols loaded. */
+ SDL_ClearError();
+ } else {
+ /* in case something got loaded... */
+ SDL_MIR_UnloadSymbols();
+ rc = 0;
+ }
+
+#else /* no dynamic MIR */
+
+#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
+#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn;
+#define SDL_MIR_SYM_CONST(type,name) MIR_##name = name;
+#include "SDL_mirsym.h"
+
+#endif
+ }
+
+ return rc;
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.h
new file mode 100644
index 0000000..32364aa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirdyn.h
@@ -0,0 +1,53 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_mirdyn_h_
+#define SDL_mirdyn_h_
+
+#include "../../SDL_internal.h"
+
+#include <EGL/egl.h>
+#include <mir_toolkit/mir_client_library.h>
+#include <xkbcommon/xkbcommon.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int SDL_MIR_LoadSymbols(void);
+void SDL_MIR_UnloadSymbols(void);
+
+/* Declare all the function pointers and wrappers... */
+#define SDL_MIR_SYM(rc,fn,params) \
+ typedef rc (*SDL_DYNMIRFN_##fn) params; \
+ extern SDL_DYNMIRFN_##fn MIR_##fn;
+#define SDL_MIR_SYM_CONST(type, name) \
+ typedef type SDL_DYMMIRCONST_##name; \
+ extern SDL_DYMMIRCONST_##name MIR_##name;
+#include "SDL_mirsym.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !defined SDL_mirdyn_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirevents.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirevents.c
new file mode 100644
index 0000000..df92799
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirevents.c
@@ -0,0 +1,321 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_touch_c.h"
+#include "../../events/scancodes_xfree86.h"
+
+#include "SDL_mirevents.h"
+#include "SDL_mirwindow.h"
+
+#include <xkbcommon/xkbcommon.h>
+
+#include "SDL_mirdyn.h"
+
+static void
+HandleKeyText(int32_t key_code)
+{
+ char text[8];
+ int size = 0;
+
+ size = MIR_xkb_keysym_to_utf8(key_code, text, sizeof text);
+
+ if (size > 0) {
+ text[size] = '\0';
+ SDL_SendKeyboardText(text);
+ }
+}
+
+/* FIXME
+ Mir still needs to implement its IM API, for now we assume
+ a single key press produces a character.
+*/
+static void
+HandleKeyEvent(MirKeyboardEvent const* key_event, SDL_Window* window)
+{
+ xkb_keysym_t key_code;
+ Uint8 key_state;
+ int event_scancode;
+ uint32_t sdl_scancode = SDL_SCANCODE_UNKNOWN;
+
+ MirKeyboardAction action = MIR_mir_keyboard_event_action(key_event);
+
+ key_state = SDL_PRESSED;
+ key_code = MIR_mir_keyboard_event_key_code(key_event);
+ event_scancode = MIR_mir_keyboard_event_scan_code(key_event);
+
+ if (action == mir_keyboard_action_up)
+ key_state = SDL_RELEASED;
+
+ if (event_scancode < SDL_arraysize(xfree86_scancode_table2))
+ sdl_scancode = xfree86_scancode_table2[event_scancode];
+
+ if (sdl_scancode != SDL_SCANCODE_UNKNOWN)
+ SDL_SendKeyboardKey(key_state, sdl_scancode);
+
+ if (key_state == SDL_PRESSED)
+ HandleKeyText(key_code);
+}
+
+static void
+HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirPointerEvent const* pointer)
+{
+ uint32_t sdl_button = SDL_BUTTON_LEFT;
+ MirPointerButton button_state = mir_pointer_button_primary;
+
+ static uint32_t old_button_states = 0;
+ uint32_t new_button_states = MIR_mir_pointer_event_buttons(pointer);
+
+ // XOR on our old button states vs our new states to get the newley pressed/released button
+ button_state = new_button_states ^ old_button_states;
+
+ switch (button_state) {
+ case mir_pointer_button_primary:
+ sdl_button = SDL_BUTTON_LEFT;
+ break;
+ case mir_pointer_button_secondary:
+ sdl_button = SDL_BUTTON_RIGHT;
+ break;
+ case mir_pointer_button_tertiary:
+ sdl_button = SDL_BUTTON_MIDDLE;
+ break;
+ case mir_pointer_button_forward:
+ sdl_button = SDL_BUTTON_X1;
+ break;
+ case mir_pointer_button_back:
+ sdl_button = SDL_BUTTON_X2;
+ break;
+ default:
+ break;
+ }
+
+ old_button_states = new_button_states;
+
+ SDL_SendMouseButton(sdl_window, 0, state, sdl_button);
+}
+
+static void
+HandleMouseMotion(SDL_Window* sdl_window, int x, int y)
+{
+ SDL_Mouse* mouse = SDL_GetMouse();
+ SDL_SendMouseMotion(sdl_window, 0, mouse->relative_mode, x, y);
+}
+
+static void
+HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure)
+{
+ SDL_SendTouch(device_id, source_id, down, x, y, pressure);
+}
+
+static void
+HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure)
+{
+ SDL_SendTouchMotion(device_id, source_id, x, y, pressure);
+}
+
+static void
+HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll)
+{
+ SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL);
+}
+
+static void
+AddTouchDevice(int device_id)
+{
+ if (SDL_AddTouch(device_id, "") < 0)
+ SDL_SetError("Error: can't add touch %s, %d", __FILE__, __LINE__);
+}
+
+static void
+HandleTouchEvent(MirTouchEvent const* touch, int device_id, SDL_Window* sdl_window)
+{
+ int i, point_count;
+ point_count = MIR_mir_touch_event_point_count(touch);
+
+ AddTouchDevice(device_id);
+
+ for (i = 0; i < point_count; i++) {
+ int id = MIR_mir_touch_event_id(touch, i);
+
+ int width = sdl_window->w;
+ int height = sdl_window->h;
+
+ float x = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_x);
+ float y = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_y);
+
+ float n_x = x / width;
+ float n_y = y / height;
+
+ float pressure = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_pressure);
+
+ switch (MIR_mir_touch_event_action(touch, i)) {
+ case mir_touch_action_up:
+ HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure);
+ break;
+ case mir_touch_action_down:
+ HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure);
+ break;
+ case mir_touch_action_change:
+ HandleTouchMotion(device_id, id, n_x, n_y, pressure);
+ break;
+ case mir_touch_actions:
+ break;
+ }
+ }
+}
+
+static void
+HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window)
+{
+ SDL_SetMouseFocus(sdl_window);
+
+ switch (MIR_mir_pointer_event_action(pointer)) {
+ case mir_pointer_action_button_down:
+ HandleMouseButton(sdl_window, SDL_PRESSED, pointer);
+ break;
+ case mir_pointer_action_button_up:
+ HandleMouseButton(sdl_window, SDL_RELEASED, pointer);
+ break;
+ case mir_pointer_action_motion: {
+ int x, y;
+ float hscroll, vscroll;
+ SDL_Mouse* mouse = SDL_GetMouse();
+ x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
+ y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
+
+ if (mouse) {
+ if (mouse->relative_mode) {
+ int relative_x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_x);
+ int relative_y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_y);
+ HandleMouseMotion(sdl_window, relative_x, relative_y);
+ }
+ else if (mouse->x != x || mouse->y != y) {
+ HandleMouseMotion(sdl_window, x, y);
+ }
+ }
+
+ hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll);
+ vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll);
+ if (vscroll != 0 || hscroll != 0)
+ HandleMouseScroll(sdl_window, hscroll, vscroll);
+ }
+ break;
+ case mir_pointer_action_leave:
+ SDL_SetMouseFocus(NULL);
+ break;
+ case mir_pointer_action_enter:
+ default:
+ break;
+ }
+}
+
+static void
+HandleInput(MirInputEvent const* input_event, SDL_Window* window)
+{
+ switch (MIR_mir_input_event_get_type(input_event)) {
+ case (mir_input_event_type_key):
+ HandleKeyEvent(MIR_mir_input_event_get_keyboard_event(input_event), window);
+ break;
+ case (mir_input_event_type_pointer):
+ HandleMouseEvent(MIR_mir_input_event_get_pointer_event(input_event), window);
+ break;
+ case (mir_input_event_type_touch):
+ HandleTouchEvent(MIR_mir_input_event_get_touch_event(input_event),
+ MIR_mir_input_event_get_device_id(input_event),
+ window);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+HandleResize(MirResizeEvent const* resize_event, SDL_Window* window)
+{
+ int new_w = MIR_mir_resize_event_get_width (resize_event);
+ int new_h = MIR_mir_resize_event_get_height(resize_event);
+
+ int old_w = window->w;
+ int old_h = window->h;
+
+ if (new_w != old_w || new_h != old_h)
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h);
+}
+
+static void
+HandleWindow(MirWindowEvent const* event, SDL_Window* window)
+{
+ MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event);
+ int value = MIR_mir_window_event_get_attribute_value(event);
+
+ if (attrib == mir_window_attrib_focus) {
+ if (value == mir_window_focus_state_focused) {
+ SDL_SetKeyboardFocus(window);
+ }
+ else if (value == mir_window_focus_state_unfocused) {
+ SDL_SetKeyboardFocus(NULL);
+ }
+ }
+}
+
+static void
+MIR_HandleClose(SDL_Window* window) {
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0);
+}
+
+void
+MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context)
+{
+ MirEventType event_type = MIR_mir_event_get_type(ev);
+ SDL_Window* window = (SDL_Window*)context;
+
+ if (window) {
+ switch (event_type) {
+ case (mir_event_type_input):
+ HandleInput(MIR_mir_event_get_input_event(ev), window);
+ break;
+ case (mir_event_type_resize):
+ HandleResize(MIR_mir_event_get_resize_event(ev), window);
+ break;
+ case (mir_event_type_window):
+ HandleWindow(MIR_mir_event_get_window_event(ev), window);
+ break;
+ case (mir_event_type_close_window):
+ MIR_HandleClose(window);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirevents.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirevents.h
new file mode 100644
index 0000000..4b0f209
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirevents.h
@@ -0,0 +1,37 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#ifndef SDL_mirevents_h_
+#define SDL_mirevents_h_
+
+#include <mir_toolkit/mir_client_library.h>
+
+extern void
+MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context);
+
+#endif /* SDL_mirevents_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.c
new file mode 100644
index 0000000..d678fff
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.c
@@ -0,0 +1,134 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#include "SDL_mirevents.h"
+#include "SDL_mirframebuffer.h"
+#include "SDL_mirwindow.h"
+
+#include "SDL_mirdyn.h"
+
+int
+MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format,
+ void** pixels, int* pitch)
+{
+ MIR_Data* mir_data = _this->driverdata;
+
+ mir_data->software = SDL_TRUE;
+
+ if (MIR_CreateWindow(_this, window) < 0)
+ return SDL_SetError("Failed to create a mir window.");
+
+ *format = MIR_GetSDLPixelFormat(mir_data->pixel_format);
+ if (*format == SDL_PIXELFORMAT_UNKNOWN)
+ return SDL_SetError("Unknown pixel format");
+
+ *pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
+
+ *pixels = SDL_malloc(window->h*(*pitch));
+ if (*pixels == NULL)
+ return SDL_OutOfMemory();
+
+ return 0;
+}
+
+int
+MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window,
+ const SDL_Rect* rects, int numrects)
+{
+ MIR_Window* mir_window = window->driverdata;
+
+ MirGraphicsRegion region;
+ MirBufferStream* bs;
+ int i, j, x, y, w, h, start;
+ int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
+ char* s_dest;
+ char* pixels;
+
+ bs = MIR_mir_window_get_buffer_stream(mir_window->window);
+ MIR_mir_buffer_stream_get_graphics_region(bs, &region);
+
+ s_dest = region.vaddr;
+ pixels = (char*)window->surface->pixels;
+
+ s_stride = window->surface->pitch;
+ d_stride = region.stride;
+ bytes_per_pixel = window->surface->format->BytesPerPixel;
+
+ for (i = 0; i < numrects; i++) {
+ s_dest = region.vaddr;
+ pixels = (char*)window->surface->pixels;
+
+ x = rects[i].x;
+ y = rects[i].y;
+ w = rects[i].w;
+ h = rects[i].h;
+
+ if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0)
+ continue;
+
+ if (x < 0) {
+ x += w;
+ w += rects[i].x;
+ }
+
+ if (y < 0) {
+ y += h;
+ h += rects[i].y;
+ }
+
+ if (x + w > window->w)
+ w = window->w - x;
+ if (y + h > window->h)
+ h = window->h - y;
+
+ start = y * s_stride + x;
+ pixels += start;
+ s_dest += start;
+
+ bytes_per_row = bytes_per_pixel * w;
+ for (j = 0; j < h; j++) {
+ SDL_memcpy(s_dest, pixels, bytes_per_row);
+ pixels += s_stride;
+ s_dest += d_stride;
+ }
+ }
+
+ MIR_mir_buffer_stream_swap_buffers_sync(bs);
+
+ return 0;
+}
+
+void
+MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* window)
+{
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.h
new file mode 100644
index 0000000..502337c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirframebuffer.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#ifndef SDL_mirframebuffer_h_
+#define SDL_mirframebuffer_h_
+
+#include "../SDL_sysvideo.h"
+
+#include "SDL_mirvideo.h"
+
+extern int
+MIR_CreateWindowFramebuffer(_THIS, SDL_Window* sdl_window, Uint32* format,
+ void** pixels, int* pitch);
+
+extern int
+MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* sdl_window,
+ const SDL_Rect* rects, int numrects);
+
+extern void
+MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* sdl_window);
+
+#endif /* SDL_mirframebuffer_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.c
new file mode 100644
index 0000000..5f6e38c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.c
@@ -0,0 +1,292 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#include "../../events/SDL_mouse_c.h"
+#include "../SDL_sysvideo.h"
+#include "SDL_assert.h"
+
+#include "SDL_mirdyn.h"
+
+#include "SDL_mirvideo.h"
+#include "SDL_mirmouse.h"
+#include "SDL_mirwindow.h"
+
+typedef struct
+{
+ MirCursorConfiguration* conf;
+ MirBufferStream* stream;
+ char const* name;
+} MIR_Cursor;
+
+static SDL_Cursor*
+MIR_CreateDefaultCursor()
+{
+ SDL_Cursor* cursor;
+
+ cursor = SDL_calloc(1, sizeof(SDL_Cursor));
+ if (cursor) {
+
+ MIR_Cursor* mir_cursor = SDL_calloc(1, sizeof(MIR_Cursor));
+ if (mir_cursor) {
+ mir_cursor->conf = NULL;
+ mir_cursor->stream = NULL;
+ mir_cursor->name = NULL;
+ cursor->driverdata = mir_cursor;
+ }
+ else {
+ SDL_OutOfMemory();
+ SDL_free(cursor);
+ cursor = NULL;
+ }
+ }
+ else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static void
+CopySurfacePixelsToMirStream(SDL_Surface* surface, MirBufferStream* stream)
+{
+ char* dest, *pixels;
+ int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row;
+
+ MirGraphicsRegion region;
+ MIR_mir_buffer_stream_get_graphics_region(stream, &region);
+
+ s_w = surface->w;
+ s_h = surface->h;
+
+ bytes_per_pixel = surface->format->BytesPerPixel;
+ bytes_per_row = bytes_per_pixel * s_w;
+
+ dest = region.vaddr;
+ pixels = (char*)surface->pixels;
+
+ r_stride = region.stride;
+ p_stride = surface->pitch;
+
+ for (i = 0; i < s_h; i++)
+ {
+ SDL_memcpy(dest, pixels, bytes_per_row);
+ dest += r_stride;
+ pixels += p_stride;
+ }
+}
+
+static SDL_Cursor*
+MIR_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
+{
+ MirCursorConfiguration* conf;
+ MirBufferStream* stream;
+
+ int s_w = surface->w;
+ int s_h = surface->h;
+
+ MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
+ SDL_Cursor* cursor = MIR_CreateDefaultCursor();
+ MIR_Cursor* mir_cursor;
+
+ if (!cursor) {
+ return NULL;
+ }
+
+ mir_cursor = (MIR_Cursor*)cursor->driverdata;
+
+ stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection,
+ s_w, s_h, mir_data->pixel_format,
+ mir_buffer_usage_software);
+
+ conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y);
+
+ CopySurfacePixelsToMirStream(surface, stream);
+ MIR_mir_buffer_stream_swap_buffers_sync(stream);
+
+ mir_cursor->conf = conf;
+ mir_cursor->stream = stream;
+
+ return cursor;
+}
+
+static SDL_Cursor*
+MIR_CreateSystemCursor(SDL_SystemCursor id)
+{
+ char const* cursor_name = NULL;
+ SDL_Cursor* cursor;
+ MIR_Cursor* mir_cursor;
+
+ switch(id) {
+ case SDL_SYSTEM_CURSOR_ARROW:
+ cursor_name = MIR_mir_arrow_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_IBEAM:
+ cursor_name = MIR_mir_caret_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_WAIT:
+ cursor_name = MIR_mir_busy_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR:
+ /* Unsupported */
+ cursor_name = MIR_mir_arrow_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_WAITARROW:
+ cursor_name = MIR_mir_busy_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE:
+ cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENESW:
+ cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEWE:
+ cursor_name = MIR_mir_horizontal_resize_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENS:
+ cursor_name = MIR_mir_vertical_resize_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEALL:
+ cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_NO:
+ /* Unsupported */
+ cursor_name = MIR_mir_closed_hand_cursor_name;
+ break;
+ case SDL_SYSTEM_CURSOR_HAND:
+ cursor_name = MIR_mir_open_hand_cursor_name;
+ break;
+ default:
+ SDL_assert(0);
+ return NULL;
+ }
+
+ cursor = MIR_CreateDefaultCursor();
+ if (!cursor) {
+ return NULL;
+ }
+
+ mir_cursor = (MIR_Cursor*)cursor->driverdata;
+ mir_cursor->name = cursor_name;
+
+ return cursor;
+}
+
+static void
+MIR_FreeCursor(SDL_Cursor* cursor)
+{
+ if (cursor) {
+
+ if (cursor->driverdata) {
+ MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
+
+ if (mir_cursor->conf)
+ MIR_mir_cursor_configuration_destroy(mir_cursor->conf);
+ if (mir_cursor->stream)
+ MIR_mir_buffer_stream_release_sync(mir_cursor->stream);
+
+ SDL_free(mir_cursor);
+ }
+
+ SDL_free(cursor);
+ }
+}
+
+static int
+MIR_ShowCursor(SDL_Cursor* cursor)
+{
+ MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
+ MIR_Window* mir_window = mir_data->current_window;
+
+ if (cursor && cursor->driverdata) {
+ if (mir_window && MIR_mir_window_is_valid(mir_window->window)) {
+ MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
+
+ if (mir_cursor->name != NULL) {
+ MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name);
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ MIR_mir_window_spec_release(spec);
+ }
+
+ if (mir_cursor->conf) {
+ MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf);
+ }
+ }
+ }
+ else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) {
+ MIR_mir_window_configure_cursor(mir_window->window, NULL);
+ }
+
+ return 0;
+}
+
+static void
+MIR_WarpMouse(SDL_Window* window, int x, int y)
+{
+ SDL_Unsupported();
+}
+
+static int
+MIR_WarpMouseGlobal(int x, int y)
+{
+ return SDL_Unsupported();
+}
+
+static int
+MIR_SetRelativeMouseMode(SDL_bool enabled)
+{
+ return 0;
+}
+
+/* TODO Actually implement the cursor, need to wait for mir support */
+void
+MIR_InitMouse()
+{
+ SDL_Mouse* mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = MIR_CreateCursor;
+ mouse->ShowCursor = MIR_ShowCursor;
+ mouse->FreeCursor = MIR_FreeCursor;
+ mouse->WarpMouse = MIR_WarpMouse;
+ mouse->WarpMouseGlobal = MIR_WarpMouseGlobal;
+ mouse->CreateSystemCursor = MIR_CreateSystemCursor;
+ mouse->SetRelativeMouseMode = MIR_SetRelativeMouseMode;
+
+ SDL_SetDefaultCursor(MIR_CreateDefaultCursor());
+}
+
+void
+MIR_FiniMouse()
+{
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.h
new file mode 100644
index 0000000..de32610
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirmouse.h
@@ -0,0 +1,37 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#ifndef SDL_mirmouse_h_
+#define SDL_mirmouse_h_
+
+extern void
+MIR_InitMouse();
+
+extern void
+MIR_FiniMouse();
+
+#endif /* SDL_mirmouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_miropengl.c b/src/3rdparty/SDL2/src/video/mir/SDL_miropengl.c
new file mode 100644
index 0000000..7795f97
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_miropengl.c
@@ -0,0 +1,78 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#include "SDL_miropengl.h"
+
+#include "SDL_mirdyn.h"
+
+int
+MIR_GL_SwapWindow(_THIS, SDL_Window* window)
+{
+ MIR_Window* mir_wind = window->driverdata;
+
+ return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface);
+}
+
+int
+MIR_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context)
+{
+ if (window) {
+ EGLSurface egl_surface = ((MIR_Window*)window->driverdata)->egl_surface;
+ return SDL_EGL_MakeCurrent(_this, egl_surface, context);
+ }
+
+ return SDL_EGL_MakeCurrent(_this, NULL, NULL);
+}
+
+SDL_GLContext
+MIR_GL_CreateContext(_THIS, SDL_Window* window)
+{
+ MIR_Window* mir_window = window->driverdata;
+
+ SDL_GLContext context;
+ context = SDL_EGL_CreateContext(_this, mir_window->egl_surface);
+
+ return context;
+}
+
+int
+MIR_GL_LoadLibrary(_THIS, const char* path)
+{
+ MIR_Data* mir_data = _this->driverdata;
+
+ SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection), 0);
+
+ SDL_EGL_ChooseConfig(_this);
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_miropengl.h b/src/3rdparty/SDL2/src/video/mir/SDL_miropengl.h
new file mode 100644
index 0000000..2168f96
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_miropengl.h
@@ -0,0 +1,53 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#ifndef SDL_miropengl_h_
+#define SDL_miropengl_h_
+
+#include "SDL_mirwindow.h"
+
+#include "../SDL_egl_c.h"
+
+#define MIR_GL_DeleteContext SDL_EGL_DeleteContext
+#define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval
+#define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval
+#define MIR_GL_UnloadLibrary SDL_EGL_UnloadLibrary
+#define MIR_GL_GetProcAddress SDL_EGL_GetProcAddress
+
+extern int
+MIR_GL_SwapWindow(_THIS, SDL_Window* window);
+
+extern int
+MIR_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context);
+
+extern SDL_GLContext
+MIR_GL_CreateContext(_THIS, SDL_Window* window);
+
+extern int
+MIR_GL_LoadLibrary(_THIS, const char* path);
+
+#endif /* SDL_miropengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirsym.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirsym.h
new file mode 100644
index 0000000..6e18b53
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirsym.h
@@ -0,0 +1,143 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* *INDENT-OFF* */
+
+#ifndef SDL_MIR_MODULE
+#define SDL_MIR_MODULE(modname)
+#endif
+
+#ifndef SDL_MIR_SYM
+#define SDL_MIR_SYM(rc,fn,params)
+#endif
+
+#ifndef SDL_MIR_SYM_CONST
+#define SDL_MIR_SYM_CONST(type, name)
+#endif
+
+SDL_MIR_MODULE(MIR_CLIENT)
+SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec))
+SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface))
+SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region))
+SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream))
+SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context))
+SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height))
+SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection))
+SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage))
+SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name))
+SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec))
+SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width))
+SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height))
+SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width))
+SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height))
+SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width))
+SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height))
+SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type))
+SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state))
+SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state))
+SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format))
+SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name))
+SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec))
+SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params))
+SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window))
+SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y))
+SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage))
+SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event))
+SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event))
+SDL_MIR_SYM(int,mir_keyboard_event_scan_code,(MirKeyboardEvent const *event))
+SDL_MIR_SYM(bool,mir_pointer_event_button_state,(MirPointerEvent const *event, MirPointerButton button))
+SDL_MIR_SYM(MirPointerButtons,mir_pointer_event_buttons,(MirPointerEvent const *event))
+SDL_MIR_SYM(MirInputDeviceId,mir_input_event_get_device_id,(MirInputEvent const* ev))
+SDL_MIR_SYM(MirTouchId,mir_touch_event_id,(MirTouchEvent const *event, size_t touch_index))
+SDL_MIR_SYM(float,mir_touch_event_axis_value,(MirTouchEvent const *event, size_t touch_index, MirTouchAxis axis))
+SDL_MIR_SYM(MirTouchAction,mir_touch_event_action,(MirTouchEvent const *event, size_t touch_index))
+SDL_MIR_SYM(MirPointerAction,mir_pointer_event_action,(MirPointerEvent const *event))
+SDL_MIR_SYM(float,mir_pointer_event_axis_value,(MirPointerEvent const *event, MirPointerAxis))
+SDL_MIR_SYM(MirEventType,mir_event_get_type,(MirEvent const *event))
+SDL_MIR_SYM(MirInputEventType,mir_input_event_get_type,(MirInputEvent const *event))
+SDL_MIR_SYM(MirInputEvent const*,mir_event_get_input_event,(MirEvent const *event))
+SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *event))
+SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event))
+SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event))
+SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event))
+SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event))
+SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event))
+SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats))
+SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection))
+SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection))
+SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection))
+SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig))
+SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name))
+SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window))
+SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window))
+SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window))
+SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream))
+SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf))
+SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf))
+SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event))
+SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event))
+SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection))
+SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event))
+SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event))
+SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection))
+SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config))
+SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config))
+SDL_MIR_SYM(MirOutput*,mir_display_config_get_mutable_output,(MirDisplayConfig* config, size_t index))
+SDL_MIR_SYM(int,mir_output_get_num_modes,(MirOutput const* output))
+SDL_MIR_SYM(MirOutputMode const*,mir_output_get_current_mode,(MirOutput const* output))
+SDL_MIR_SYM(MirPixelFormat,mir_output_get_current_pixel_format,(MirOutput const* output))
+SDL_MIR_SYM(int,mir_output_get_position_x,(MirOutput const* output))
+SDL_MIR_SYM(int,mir_output_get_position_y,(MirOutput const* output))
+SDL_MIR_SYM(bool,mir_output_is_enabled,(MirOutput const* output))
+SDL_MIR_SYM(MirOutputConnectionState,mir_output_get_connection_state,(MirOutput const* output))
+SDL_MIR_SYM(size_t,mir_output_get_preferred_mode_index,(MirOutput const* output))
+SDL_MIR_SYM(MirOutputType,mir_output_get_type,(MirOutput const* output))
+SDL_MIR_SYM(char const*,mir_output_type_name,(MirOutputType type))
+SDL_MIR_SYM(void,mir_output_set_current_mode,(MirOutput* output, MirOutputMode const* mode))
+SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, size_t index))
+SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode))
+SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode))
+SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode))
+SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output))
+SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output))
+SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size))
+SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size))
+
+SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_arrow_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_caret_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_vertical_resize_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_horizontal_resize_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_open_hand_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_closed_hand_cursor_name)
+SDL_MIR_SYM_CONST(char const*,mir_disabled_cursor_name)
+
+SDL_MIR_MODULE(XKBCOMMON)
+SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size))
+
+#undef SDL_MIR_MODULE
+#undef SDL_MIR_SYM
+#undef SDL_MIR_SYM_CONST
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.c
new file mode 100644
index 0000000..8f3a368
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.c
@@ -0,0 +1,423 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#include "SDL_assert.h"
+#include "SDL_log.h"
+
+#include "SDL_mirwindow.h"
+#include "SDL_video.h"
+
+#include "SDL_mirframebuffer.h"
+#include "SDL_mirmouse.h"
+#include "SDL_miropengl.h"
+#include "SDL_mirvideo.h"
+#include "SDL_mirvulkan.h"
+
+#include "SDL_mirdyn.h"
+
+#define MIR_DRIVER_NAME "mir"
+
+static const Uint32 mir_pixel_format_to_sdl_format[] = {
+ SDL_PIXELFORMAT_UNKNOWN, /* mir_pixel_format_invalid */
+ SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */
+ SDL_PIXELFORMAT_BGR888, /* mir_pixel_format_xbgr_8888 */
+ SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */
+ SDL_PIXELFORMAT_RGB888, /* mir_pixel_format_xrgb_8888 */
+ SDL_PIXELFORMAT_BGR24, /* mir_pixel_format_bgr_888 */
+ SDL_PIXELFORMAT_RGB24, /* mir_pixel_format_rgb_888 */
+ SDL_PIXELFORMAT_RGB565, /* mir_pixel_format_rgb_565 */
+ SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */
+ SDL_PIXELFORMAT_RGBA4444 /* mir_pixel_format_rgba_4444 */
+};
+
+Uint32
+MIR_GetSDLPixelFormat(MirPixelFormat format)
+{
+ return mir_pixel_format_to_sdl_format[format];
+}
+
+static int
+MIR_VideoInit(_THIS);
+
+static void
+MIR_VideoQuit(_THIS);
+
+static int
+MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect);
+
+static void
+MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* sdl_display);
+
+static int
+MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* sdl_display, SDL_DisplayMode* mode);
+
+static SDL_WindowShaper*
+MIR_CreateShaper(SDL_Window* window)
+{
+ /* FIXME Im not sure if mir support this atm, will have to come back to this */
+ return NULL;
+}
+
+static int
+MIR_SetWindowShape(SDL_WindowShaper* shaper, SDL_Surface* shape, SDL_WindowShapeMode* shape_mode)
+{
+ return SDL_Unsupported();
+}
+
+static int
+MIR_ResizeWindowShape(SDL_Window* window)
+{
+ return SDL_Unsupported();
+}
+
+static int
+MIR_Available()
+{
+ int available = 0;
+
+ if (SDL_MIR_LoadSymbols()) {
+
+ /* Lets ensure we can connect to the mir server */
+ MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
+
+ if (!MIR_mir_connection_is_valid(connection)) {
+ SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s",
+ MIR_mir_connection_get_error_message(connection));
+
+ return available;
+ }
+
+ MIR_mir_connection_release(connection);
+
+ available = 1;
+ SDL_MIR_UnloadSymbols();
+ }
+
+ return available;
+}
+
+static void
+MIR_DeleteDevice(SDL_VideoDevice* device)
+{
+ SDL_free(device);
+ SDL_MIR_UnloadSymbols();
+}
+
+static void
+MIR_PumpEvents(_THIS)
+{
+}
+
+static SDL_VideoDevice*
+MIR_CreateDevice(int device_index)
+{
+ MIR_Data* mir_data;
+ SDL_VideoDevice* device = NULL;
+
+ if (!SDL_MIR_LoadSymbols()) {
+ return NULL;
+ }
+
+ device = SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_MIR_UnloadSymbols();
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ mir_data = SDL_calloc(1, sizeof(MIR_Data));
+ if (!mir_data) {
+ SDL_free(device);
+ SDL_MIR_UnloadSymbols();
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ device->driverdata = mir_data;
+
+ /* mirvideo */
+ device->VideoInit = MIR_VideoInit;
+ device->VideoQuit = MIR_VideoQuit;
+ device->GetDisplayBounds = MIR_GetDisplayBounds;
+ device->GetDisplayModes = MIR_GetDisplayModes;
+ device->SetDisplayMode = MIR_SetDisplayMode;
+ device->free = MIR_DeleteDevice;
+
+ /* miropengles */
+ device->GL_SwapWindow = MIR_GL_SwapWindow;
+ device->GL_MakeCurrent = MIR_GL_MakeCurrent;
+ device->GL_CreateContext = MIR_GL_CreateContext;
+ device->GL_DeleteContext = MIR_GL_DeleteContext;
+ device->GL_LoadLibrary = MIR_GL_LoadLibrary;
+ device->GL_UnloadLibrary = MIR_GL_UnloadLibrary;
+ device->GL_GetSwapInterval = MIR_GL_GetSwapInterval;
+ device->GL_SetSwapInterval = MIR_GL_SetSwapInterval;
+ device->GL_GetProcAddress = MIR_GL_GetProcAddress;
+
+ /* mirwindow */
+ device->CreateSDLWindow = MIR_CreateWindow;
+ device->DestroyWindow = MIR_DestroyWindow;
+ device->GetWindowWMInfo = MIR_GetWindowWMInfo;
+ device->SetWindowFullscreen = MIR_SetWindowFullscreen;
+ device->MaximizeWindow = MIR_MaximizeWindow;
+ device->MinimizeWindow = MIR_MinimizeWindow;
+ device->RestoreWindow = MIR_RestoreWindow;
+ device->ShowWindow = MIR_RestoreWindow;
+ device->HideWindow = MIR_HideWindow;
+ device->SetWindowSize = MIR_SetWindowSize;
+ device->SetWindowMinimumSize = MIR_SetWindowMinimumSize;
+ device->SetWindowMaximumSize = MIR_SetWindowMaximumSize;
+ device->SetWindowTitle = MIR_SetWindowTitle;
+ device->SetWindowGrab = MIR_SetWindowGrab;
+ device->SetWindowGammaRamp = MIR_SetWindowGammaRamp;
+ device->GetWindowGammaRamp = MIR_GetWindowGammaRamp;
+
+ device->CreateSDLWindowFrom = NULL;
+ device->SetWindowIcon = NULL;
+ device->RaiseWindow = NULL;
+ device->SetWindowBordered = NULL;
+ device->SetWindowResizable = NULL;
+ device->OnWindowEnter = NULL;
+ device->SetWindowPosition = NULL;
+
+ /* mirframebuffer */
+ device->CreateWindowFramebuffer = MIR_CreateWindowFramebuffer;
+ device->UpdateWindowFramebuffer = MIR_UpdateWindowFramebuffer;
+ device->DestroyWindowFramebuffer = MIR_DestroyWindowFramebuffer;
+
+ device->shape_driver.CreateShaper = MIR_CreateShaper;
+ device->shape_driver.SetWindowShape = MIR_SetWindowShape;
+ device->shape_driver.ResizeWindowShape = MIR_ResizeWindowShape;
+
+ device->PumpEvents = MIR_PumpEvents;
+
+ device->SuspendScreenSaver = NULL;
+
+ device->StartTextInput = NULL;
+ device->StopTextInput = NULL;
+ device->SetTextInputRect = NULL;
+
+ device->HasScreenKeyboardSupport = NULL;
+ device->ShowScreenKeyboard = NULL;
+ device->HideScreenKeyboard = NULL;
+ device->IsScreenKeyboardShown = NULL;
+
+ device->SetClipboardText = NULL;
+ device->GetClipboardText = NULL;
+ device->HasClipboardText = NULL;
+
+ device->ShowMessageBox = NULL;
+
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface;
+#endif
+
+ return device;
+}
+
+VideoBootStrap MIR_bootstrap = {
+ MIR_DRIVER_NAME, "SDL Mir video driver",
+ MIR_Available, MIR_CreateDevice
+};
+
+static SDL_DisplayMode
+MIR_ConvertModeToSDLMode(MirOutputMode const* mode, MirPixelFormat format)
+{
+ SDL_DisplayMode sdl_mode = {
+ .format = MIR_GetSDLPixelFormat(format),
+ .w = MIR_mir_output_mode_get_width(mode),
+ .h = MIR_mir_output_mode_get_height(mode),
+ .refresh_rate = MIR_mir_output_mode_get_refresh_rate(mode),
+ .driverdata = NULL
+ };
+
+ return sdl_mode;
+}
+
+static void
+MIR_AddModeToDisplay(SDL_VideoDisplay* display, MirOutputMode const* mode, MirPixelFormat format)
+{
+ SDL_DisplayMode sdl_mode = MIR_ConvertModeToSDLMode(mode, format);
+ SDL_AddDisplayMode(display, &sdl_mode);
+}
+
+static void
+MIR_InitDisplayFromOutput(_THIS, MirOutput* output)
+{
+ SDL_VideoDisplay display;
+ int m;
+
+ MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output);
+ int num_modes = MIR_mir_output_get_num_modes(output);
+ SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format);
+
+ SDL_zero(display);
+
+ // Unfortunate cast, but SDL_AddVideoDisplay will strdup this pointer so its read-only in this case.
+ display.name = (char*)MIR_mir_output_type_name(MIR_mir_output_get_type(output));
+
+ for (m = 0; m < num_modes; m++) {
+ MirOutputMode const* mode = MIR_mir_output_get_mode(output, m);
+ MIR_AddModeToDisplay(&display, mode, format);
+ }
+
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+
+ display.driverdata = output;
+ SDL_AddVideoDisplay(&display);
+}
+
+static void
+MIR_InitDisplays(_THIS)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ int num_outputs = MIR_mir_display_config_get_num_outputs(mir_data->display_config);
+ int d;
+
+ for (d = 0; d < num_outputs; d++) {
+ MirOutput* output = MIR_mir_display_config_get_mutable_output(mir_data->display_config, d);
+ SDL_bool enabled = MIR_mir_output_is_enabled(output);
+ MirOutputConnectionState state = MIR_mir_output_get_connection_state(output);
+
+ if (enabled && state == mir_output_connection_state_connected) {
+ MIR_InitDisplayFromOutput(_this, output);
+ }
+ }
+}
+
+static int
+MIR_VideoInit(_THIS)
+{
+ MIR_Data* mir_data = _this->driverdata;
+
+ mir_data->connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
+ mir_data->current_window = NULL;
+ mir_data->software = SDL_FALSE;
+ mir_data->pixel_format = mir_pixel_format_invalid;
+
+ if (!MIR_mir_connection_is_valid(mir_data->connection)) {
+ return SDL_SetError("Failed to connect to the mir server: %s",
+ MIR_mir_connection_get_error_message(mir_data->connection));
+ }
+
+ mir_data->display_config = MIR_mir_connection_create_display_configuration(mir_data->connection);
+
+ MIR_InitDisplays(_this);
+ MIR_InitMouse();
+
+ return 0;
+}
+
+static void
+MIR_CleanUpDisplayConfig(_THIS)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ int i;
+
+ // SDL_VideoQuit frees the display driverdata, we own it not them
+ for (i = 0; i < _this->num_displays; ++i) {
+ _this->displays[i].driverdata = NULL;
+ }
+
+ MIR_mir_display_config_release(mir_data->display_config);
+}
+
+static void
+MIR_VideoQuit(_THIS)
+{
+ MIR_Data* mir_data = _this->driverdata;
+
+ MIR_CleanUpDisplayConfig(_this);
+
+ MIR_FiniMouse();
+
+ MIR_GL_DeleteContext(_this, NULL);
+ MIR_GL_UnloadLibrary(_this);
+
+ MIR_mir_connection_release(mir_data->connection);
+
+ SDL_free(mir_data);
+ _this->driverdata = NULL;
+}
+
+static int
+MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect)
+{
+ MirOutput const* output = display->driverdata;
+
+ rect->x = MIR_mir_output_get_position_x(output);
+ rect->y = MIR_mir_output_get_position_y(output);
+ rect->w = display->current_mode.w;
+ rect->h = display->current_mode.h;
+
+ return 0;
+}
+
+static void
+MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* display)
+{
+}
+
+static int
+MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* display, SDL_DisplayMode* mode)
+{
+ int m;
+ MirOutput* output = display->driverdata;
+ int num_modes = MIR_mir_output_get_num_modes(output);
+ Uint32 sdl_format = MIR_GetSDLPixelFormat(
+ MIR_mir_output_get_current_pixel_format(output));
+
+ for (m = 0; m < num_modes; m++) {
+ MirOutputMode const* mir_mode = MIR_mir_output_get_mode(output, m);
+ int width = MIR_mir_output_mode_get_width(mir_mode);
+ int height = MIR_mir_output_mode_get_height(mir_mode);
+ double refresh_rate = MIR_mir_output_mode_get_refresh_rate(mir_mode);
+
+ if (mode->format == sdl_format &&
+ mode->w == width &&
+ mode->h == height &&
+ mode->refresh_rate == refresh_rate) {
+
+ // FIXME Currently wont actually *set* anything. Need to wait for applying display changes
+ MIR_mir_output_set_current_mode(output, mir_mode);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.h
new file mode 100644
index 0000000..6850bac
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirvideo.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#ifndef SDL_mirvideo_h__
+#define SDL_mirvideo_h__
+
+#include <EGL/egl.h>
+#include <mir_toolkit/mir_client_library.h>
+#include "SDL_stdinc.h"
+
+typedef struct MIR_Window MIR_Window;
+
+typedef struct
+{
+ MirConnection* connection;
+ MirDisplayConfig* display_config;
+ MIR_Window* current_window;
+ SDL_bool software;
+ MirPixelFormat pixel_format;
+} MIR_Data;
+
+extern Uint32
+MIR_GetSDLPixelFormat(MirPixelFormat format);
+
+#endif /* SDL_mirvideo_h__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.c
new file mode 100644
index 0000000..6ba3fa3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.c
@@ -0,0 +1,176 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.c.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR
+
+#include "SDL_mirvideo.h"
+#include "SDL_mirwindow.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_mirvulkan.h"
+#include "SDL_syswm.h"
+
+int MIR_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ VkExtensionProperties *extensions = NULL;
+ Uint32 extensionCount = 0;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasMIRSurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+ if(_this->vulkan_config.loader_handle)
+ return SDL_SetError("Vulkan already loaded");
+
+ /* Load the Vulkan loader library */
+ if(!path)
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ if(!path)
+ path = "libvulkan.so.1";
+ _this->vulkan_config.loader_handle = SDL_LoadObject(path);
+ if(!_this->vulkan_config.loader_handle)
+ return -1;
+ SDL_strlcpy(_this->vulkan_config.loader_path, path,
+ SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ if(!vkGetInstanceProcAddr)
+ goto fail;
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ goto fail;
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+ if(!extensions)
+ goto fail;
+ for(Uint32 i = 0; i < extensionCount; i++)
+ {
+ if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasSurfaceExtension = SDL_TRUE;
+ else if(SDL_strcmp(VK_KHR_MIR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasMIRSurfaceExtension = SDL_TRUE;
+ }
+ SDL_free(extensions);
+ if(!hasSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ }
+ else if(!hasMIRSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_MIR_SURFACE_EXTENSION_NAME "extension");
+ goto fail;
+ }
+ return 0;
+
+fail:
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void MIR_Vulkan_UnloadLibrary(_THIS)
+{
+ if(_this->vulkan_config.loader_handle)
+ {
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ static const char *const extensionsForMir[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME
+ };
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForMir),
+ extensionsForMir);
+}
+
+SDL_bool MIR_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ MIR_Window *windowData = (MIR_Window *)window->driverdata;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR =
+ (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr(
+ (VkInstance)instance,
+ "vkCreateMirSurfaceKHR");
+ VkMirSurfaceCreateInfoKHR createInfo;
+ VkResult result;
+
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ if(!vkCreateMirSurfaceKHR)
+ {
+ SDL_SetError(VK_KHR_MIR_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ SDL_zero(createInfo);
+ createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.connection = windowData->mir_data->connection;
+ createInfo.mirSurface = windowData->window;
+ result = vkCreateMirSurfaceKHR(instance, &createInfo,
+ NULL, surface);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError("vkCreateMirSurfaceKHR failed: %s",
+ SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+#endif
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.h
new file mode 100644
index 0000000..6f40d5b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirvulkan.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.h.
+ */
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_mirvulkan_h_
+#define SDL_mirvulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR
+
+int MIR_Vulkan_LoadLibrary(_THIS, const char *path);
+void MIR_Vulkan_UnloadLibrary(_THIS);
+SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool MIR_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+#endif
+
+#endif /* SDL_mirvulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.c b/src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.c
new file mode 100644
index 0000000..80877ee
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.c
@@ -0,0 +1,374 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_MIR
+
+#include "../SDL_egl_c.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_keyboard_c.h"
+
+#include "SDL_mirevents.h"
+#include "SDL_mirwindow.h"
+
+#include "SDL_mirdyn.h"
+
+static int
+IsMirWindowValid(MIR_Window* mir_window)
+{
+ if (!MIR_mir_window_is_valid(mir_window->window)) {
+ const char* error = MIR_mir_window_get_error_message(mir_window->window);
+ return SDL_SetError("Failed to create a mir surface: %s", error);
+ }
+
+ return 1;
+}
+
+static MirPixelFormat
+FindValidPixelFormat(MIR_Data* mir_data)
+{
+ unsigned int pf_size = 32;
+ unsigned int valid_formats;
+ unsigned int f;
+
+ MirPixelFormat formats[pf_size];
+ MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats,
+ pf_size, &valid_formats);
+
+ for (f = 0; f < valid_formats; f++) {
+ MirPixelFormat cur_pf = formats[f];
+
+ if (cur_pf == mir_pixel_format_abgr_8888 ||
+ cur_pf == mir_pixel_format_xbgr_8888 ||
+ cur_pf == mir_pixel_format_argb_8888 ||
+ cur_pf == mir_pixel_format_xrgb_8888) {
+
+ return cur_pf;
+ }
+ }
+
+ return mir_pixel_format_invalid;
+}
+
+int
+MIR_CreateWindow(_THIS, SDL_Window* window)
+{
+ MIR_Window* mir_window;
+ MIR_Data* mir_data;
+ MirPixelFormat pixel_format;
+ MirBufferUsage buffer_usage;
+
+ MirWindowSpec* spec;
+
+ mir_window = SDL_calloc(1, sizeof(MIR_Window));
+ if (!mir_window)
+ return SDL_OutOfMemory();
+
+ mir_data = _this->driverdata;
+ window->driverdata = mir_window;
+
+ if (window->x == SDL_WINDOWPOS_UNDEFINED)
+ window->x = 0;
+
+ if (window->y == SDL_WINDOWPOS_UNDEFINED)
+ window->y = 0;
+
+ mir_window->mir_data = mir_data;
+ mir_window->sdl_window = window;
+
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection,
+ _this->egl_data->egl_display,
+ _this->egl_data->egl_config);
+ }
+ else {
+ pixel_format = FindValidPixelFormat(mir_data);
+ }
+
+ mir_data->pixel_format = pixel_format;
+ if (pixel_format == mir_pixel_format_invalid) {
+ return SDL_SetError("Failed to find a valid pixel format.");
+ }
+
+ buffer_usage = mir_buffer_usage_hardware;
+ if (mir_data->software)
+ buffer_usage = mir_buffer_usage_software;
+
+ spec = MIR_mir_create_normal_window_spec(mir_data->connection,
+ window->w,
+ window->h);
+
+ MIR_mir_window_spec_set_buffer_usage(spec, buffer_usage);
+ MIR_mir_window_spec_set_name(spec, "Mir surface");
+ MIR_mir_window_spec_set_pixel_format(spec, pixel_format);
+
+ if (window->flags & SDL_WINDOW_INPUT_FOCUS)
+ SDL_SetKeyboardFocus(window);
+
+ mir_window->window = MIR_mir_create_window_sync(spec);
+ MIR_mir_window_set_event_handler(mir_window->window, MIR_HandleEvent, window);
+
+ MIR_mir_window_spec_release(spec);
+
+ if (!MIR_mir_window_is_valid(mir_window->window)) {
+ return SDL_SetError("Failed to create a mir surface: %s",
+ MIR_mir_window_get_error_message(mir_window->window));
+ }
+
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ EGLNativeWindowType egl_native_window =
+ (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window(
+ MIR_mir_window_get_buffer_stream(mir_window->window));
+
+ mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window);
+
+ if (mir_window->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("Failed to create a window surface %p",
+ _this->egl_data->egl_display);
+ }
+ }
+ else {
+ mir_window->egl_surface = EGL_NO_SURFACE;
+ }
+
+ mir_data->current_window = mir_window;
+
+ return 0;
+}
+
+void
+MIR_DestroyWindow(_THIS, SDL_Window* window)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ MIR_Window* mir_window = window->driverdata;
+
+ if (mir_data) {
+ SDL_EGL_DestroySurface(_this, mir_window->egl_surface);
+ MIR_mir_window_release_sync(mir_window->window);
+
+ mir_data->current_window = NULL;
+
+ SDL_free(mir_window);
+ }
+ window->driverdata = NULL;
+}
+
+SDL_bool
+MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info)
+{
+ if (info->version.major == SDL_MAJOR_VERSION &&
+ info->version.minor == SDL_MINOR_VERSION) {
+ MIR_Window* mir_window = window->driverdata;
+
+ info->subsystem = SDL_SYSWM_MIR;
+ info->info.mir.connection = mir_window->mir_data->connection;
+ // Cannot change this to window due to it being in the public API
+ info->info.mir.surface = mir_window->window;
+
+ return SDL_TRUE;
+ }
+
+ return SDL_FALSE;
+}
+
+static void
+UpdateMirWindowState(MIR_Data* mir_data, MIR_Window* mir_window, MirWindowState window_state)
+{
+ if (IsMirWindowValid(mir_window)) {
+ MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_state(spec, window_state);
+
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ MIR_mir_window_spec_release(spec);
+ }
+}
+
+void
+MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
+ SDL_VideoDisplay* display,
+ SDL_bool fullscreen)
+{
+ if (IsMirWindowValid(window->driverdata)) {
+ MirWindowState state;
+
+ if (fullscreen) {
+ state = mir_window_state_fullscreen;
+ }
+ else {
+ state = mir_window_state_restored;
+ }
+
+ UpdateMirWindowState(_this->driverdata, window->driverdata, state);
+ }
+}
+
+void
+MIR_MaximizeWindow(_THIS, SDL_Window* window)
+{
+ UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_maximized);
+}
+
+void
+MIR_MinimizeWindow(_THIS, SDL_Window* window)
+{
+ UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_minimized);
+}
+
+void
+MIR_RestoreWindow(_THIS, SDL_Window * window)
+{
+ UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_restored);
+}
+
+void
+MIR_HideWindow(_THIS, SDL_Window* window)
+{
+ UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden);
+}
+
+void
+MIR_SetWindowSize(_THIS, SDL_Window* window)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ MIR_Window* mir_window = window->driverdata;
+
+ if (IsMirWindowValid(mir_window)) {
+ MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_width (spec, window->w);
+ MIR_mir_window_spec_set_height(spec, window->h);
+
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ }
+}
+
+void
+MIR_SetWindowMinimumSize(_THIS, SDL_Window* window)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ MIR_Window* mir_window = window->driverdata;
+
+ if (IsMirWindowValid(mir_window)) {
+ MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_min_width (spec, window->min_w);
+ MIR_mir_window_spec_set_min_height(spec, window->min_h);
+
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ }
+}
+
+void
+MIR_SetWindowMaximumSize(_THIS, SDL_Window* window)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ MIR_Window* mir_window = window->driverdata;
+
+ if (IsMirWindowValid(mir_window)) {
+ MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_max_width (spec, window->max_w);
+ MIR_mir_window_spec_set_max_height(spec, window->max_h);
+
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ }
+}
+
+void
+MIR_SetWindowTitle(_THIS, SDL_Window* window)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ MIR_Window* mir_window = window->driverdata;
+ char const* title = window->title ? window->title : "";
+ MirWindowSpec* spec;
+
+ if (IsMirWindowValid(mir_window) < 0)
+ return;
+
+ spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_name(spec, title);
+
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ MIR_mir_window_spec_release(spec);
+}
+
+void
+MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed)
+{
+ MIR_Data* mir_data = _this->driverdata;
+ MIR_Window* mir_window = window->driverdata;
+ MirPointerConfinementState confined = mir_pointer_unconfined;
+ MirWindowSpec* spec;
+
+ if (grabbed)
+ confined = mir_pointer_confined_to_window;
+
+ spec = MIR_mir_create_window_spec(mir_data->connection);
+ MIR_mir_window_spec_set_pointer_confinement(spec, confined);
+
+ MIR_mir_window_apply_spec(mir_window->window, spec);
+ MIR_mir_window_spec_release(spec);
+}
+
+int
+MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp)
+{
+ MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
+ Uint32 ramp_size = 256;
+
+ // FIXME Need to apply the changes to the output, once that public API function is around
+ if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
+ MIR_mir_output_set_gamma(output,
+ ramp + ramp_size * 0,
+ ramp + ramp_size * 1,
+ ramp + ramp_size * 2,
+ ramp_size);
+ return 0;
+ }
+
+ return -1;
+}
+
+int
+MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp)
+{
+ MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
+ Uint32 ramp_size = 256;
+
+ if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
+ if (MIR_mir_output_get_gamma_size(output) == ramp_size) {
+ MIR_mir_output_get_gamma(output,
+ ramp + ramp_size * 0,
+ ramp + ramp_size * 1,
+ ramp + ramp_size * 2,
+ ramp_size);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+#endif /* SDL_VIDEO_DRIVER_MIR */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.h b/src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.h
new file mode 100644
index 0000000..af618f5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/mir/SDL_mirwindow.h
@@ -0,0 +1,93 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
+*/
+
+#ifndef SDL_mirwindow_h_
+#define SDL_mirwindow_h_
+
+#include "../SDL_sysvideo.h"
+#include "SDL_syswm.h"
+
+#include "SDL_mirvideo.h"
+
+struct MIR_Window {
+ SDL_Window* sdl_window;
+ MIR_Data* mir_data;
+
+ MirWindow* window;
+ EGLSurface egl_surface;
+};
+
+
+extern int
+MIR_CreateWindow(_THIS, SDL_Window* window);
+
+extern void
+MIR_DestroyWindow(_THIS, SDL_Window* window);
+
+extern void
+MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
+ SDL_VideoDisplay* display,
+ SDL_bool fullscreen);
+
+extern void
+MIR_MaximizeWindow(_THIS, SDL_Window* window);
+
+extern void
+MIR_MinimizeWindow(_THIS, SDL_Window* window);
+
+extern void
+MIR_RestoreWindow(_THIS, SDL_Window* window);
+
+extern void
+MIR_HideWindow(_THIS, SDL_Window* window);
+
+extern SDL_bool
+MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info);
+
+extern void
+MIR_SetWindowSize(_THIS, SDL_Window* window);
+
+extern void
+MIR_SetWindowMinimumSize(_THIS, SDL_Window* window);
+
+extern void
+MIR_SetWindowMaximumSize(_THIS, SDL_Window* window);
+
+extern void
+MIR_SetWindowTitle(_THIS, SDL_Window* window);
+
+extern void
+MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed);
+
+extern int
+MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp);
+
+extern int
+MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp);
+
+#endif /* SDL_mirwindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclevents.c b/src/3rdparty/SDL2/src/video/nacl/SDL_naclevents.c
new file mode 100644
index 0000000..812df2b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclevents.c
@@ -0,0 +1,438 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_NACL
+
+#include "SDL.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "SDL_naclevents_c.h"
+#include "SDL_naclvideo.h"
+#include "ppapi_simple/ps_event.h"
+
+/* Ref: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent */
+
+static SDL_Scancode NACL_Keycodes[] = {
+ SDL_SCANCODE_UNKNOWN, /* 0 */
+ SDL_SCANCODE_UNKNOWN, /* 1 */
+ SDL_SCANCODE_UNKNOWN, /* 2 */
+ SDL_SCANCODE_CANCEL, /* DOM_VK_CANCEL 3 */
+ SDL_SCANCODE_UNKNOWN, /* 4 */
+ SDL_SCANCODE_UNKNOWN, /* 5 */
+ SDL_SCANCODE_HELP, /* DOM_VK_HELP 6 */
+ SDL_SCANCODE_UNKNOWN, /* 7 */
+ SDL_SCANCODE_BACKSPACE, /* DOM_VK_BACK_SPACE 8 */
+ SDL_SCANCODE_TAB, /* DOM_VK_TAB 9 */
+ SDL_SCANCODE_UNKNOWN, /* 10 */
+ SDL_SCANCODE_UNKNOWN, /* 11 */
+ SDL_SCANCODE_CLEAR, /* DOM_VK_CLEAR 12 */
+ SDL_SCANCODE_RETURN, /* DOM_VK_RETURN 13 */
+ SDL_SCANCODE_RETURN, /* DOM_VK_ENTER 14 */
+ SDL_SCANCODE_UNKNOWN, /* 15 */
+ SDL_SCANCODE_LSHIFT, /* DOM_VK_SHIFT 16 */
+ SDL_SCANCODE_LCTRL, /* DOM_VK_CONTROL 17 */
+ SDL_SCANCODE_LALT, /* DOM_VK_ALT 18 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_PAUSE 19 */
+ SDL_SCANCODE_CAPSLOCK, /* DOM_VK_CAPS_LOCK 20 */
+ SDL_SCANCODE_LANG1, /* DOM_VK_KANA DOM_VK_HANGUL 21 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_EISU 22 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_JUNJA 23 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_FINAL 24 */
+ SDL_SCANCODE_LANG2, /* DOM_VK_HANJA DOM_VK_KANJI 25 */
+ SDL_SCANCODE_UNKNOWN, /* 26 */
+ SDL_SCANCODE_ESCAPE, /* DOM_VK_ESCAPE 27 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_CONVERT 28 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_NONCONVERT 29 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_ACCEPT 30 */
+ SDL_SCANCODE_MODE, /* DOM_VK_MODECHANGE 31 */
+ SDL_SCANCODE_SPACE, /* DOM_VK_SPACE 32 */
+ SDL_SCANCODE_PAGEUP, /* DOM_VK_PAGE_UP 33 */
+ SDL_SCANCODE_PAGEDOWN, /* DOM_VK_PAGE_DOWN 34 */
+ SDL_SCANCODE_END, /* DOM_VK_END 35 */
+ SDL_SCANCODE_HOME, /* DOM_VK_HOME 36 */
+ SDL_SCANCODE_LEFT, /* DOM_VK_LEFT 37 */
+ SDL_SCANCODE_UP, /* DOM_VK_UP 38 */
+ SDL_SCANCODE_RIGHT, /* DOM_VK_RIGHT 39 */
+ SDL_SCANCODE_DOWN, /* DOM_VK_DOWN 40 */
+ SDL_SCANCODE_SELECT, /* DOM_VK_SELECT 41 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_PRINT 42 */
+ SDL_SCANCODE_EXECUTE, /* DOM_VK_EXECUTE 43 */
+ SDL_SCANCODE_PRINTSCREEN, /* DOM_VK_PRINTSCREEN 44 */
+ SDL_SCANCODE_INSERT, /* DOM_VK_INSERT 45 */
+ SDL_SCANCODE_DELETE, /* DOM_VK_DELETE 46 */
+ SDL_SCANCODE_UNKNOWN, /* 47 */
+ SDL_SCANCODE_0, /* DOM_VK_0 48 */
+ SDL_SCANCODE_1, /* DOM_VK_1 49 */
+ SDL_SCANCODE_2, /* DOM_VK_2 50 */
+ SDL_SCANCODE_3, /* DOM_VK_3 51 */
+ SDL_SCANCODE_4, /* DOM_VK_4 52 */
+ SDL_SCANCODE_5, /* DOM_VK_5 53 */
+ SDL_SCANCODE_6, /* DOM_VK_6 54 */
+ SDL_SCANCODE_7, /* DOM_VK_7 55 */
+ SDL_SCANCODE_8, /* DOM_VK_8 56 */
+ SDL_SCANCODE_9, /* DOM_VK_9 57 */
+ SDL_SCANCODE_KP_COLON, /* DOM_VK_COLON 58 */
+ SDL_SCANCODE_SEMICOLON, /* DOM_VK_SEMICOLON 59 */
+ SDL_SCANCODE_KP_LESS, /* DOM_VK_LESS_THAN 60 */
+ SDL_SCANCODE_EQUALS, /* DOM_VK_EQUALS 61 */
+ SDL_SCANCODE_KP_GREATER, /* DOM_VK_GREATER_THAN 62 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_QUESTION_MARK 63 */
+ SDL_SCANCODE_KP_AT, /* DOM_VK_AT 64 */
+ SDL_SCANCODE_A, /* DOM_VK_A 65 */
+ SDL_SCANCODE_B, /* DOM_VK_B 66 */
+ SDL_SCANCODE_C, /* DOM_VK_C 67 */
+ SDL_SCANCODE_D, /* DOM_VK_D 68 */
+ SDL_SCANCODE_E, /* DOM_VK_E 69 */
+ SDL_SCANCODE_F, /* DOM_VK_F 70 */
+ SDL_SCANCODE_G, /* DOM_VK_G 71 */
+ SDL_SCANCODE_H, /* DOM_VK_H 72 */
+ SDL_SCANCODE_I, /* DOM_VK_I 73 */
+ SDL_SCANCODE_J, /* DOM_VK_J 74 */
+ SDL_SCANCODE_K, /* DOM_VK_K 75 */
+ SDL_SCANCODE_L, /* DOM_VK_L 76 */
+ SDL_SCANCODE_M, /* DOM_VK_M 77 */
+ SDL_SCANCODE_N, /* DOM_VK_N 78 */
+ SDL_SCANCODE_O, /* DOM_VK_O 79 */
+ SDL_SCANCODE_P, /* DOM_VK_P 80 */
+ SDL_SCANCODE_Q, /* DOM_VK_Q 81 */
+ SDL_SCANCODE_R, /* DOM_VK_R 82 */
+ SDL_SCANCODE_S, /* DOM_VK_S 83 */
+ SDL_SCANCODE_T, /* DOM_VK_T 84 */
+ SDL_SCANCODE_U, /* DOM_VK_U 85 */
+ SDL_SCANCODE_V, /* DOM_VK_V 86 */
+ SDL_SCANCODE_W, /* DOM_VK_W 87 */
+ SDL_SCANCODE_X, /* DOM_VK_X 88 */
+ SDL_SCANCODE_Y, /* DOM_VK_Y 89 */
+ SDL_SCANCODE_Z, /* DOM_VK_Z 90 */
+ SDL_SCANCODE_LGUI, /* DOM_VK_WIN 91 */
+ SDL_SCANCODE_UNKNOWN, /* 92 */
+ SDL_SCANCODE_APPLICATION, /* DOM_VK_CONTEXT_MENU 93 */
+ SDL_SCANCODE_UNKNOWN, /* 94 */
+ SDL_SCANCODE_SLEEP, /* DOM_VK_SLEEP 95 */
+ SDL_SCANCODE_KP_0, /* DOM_VK_NUMPAD0 96 */
+ SDL_SCANCODE_KP_1, /* DOM_VK_NUMPAD1 97 */
+ SDL_SCANCODE_KP_2, /* DOM_VK_NUMPAD2 98 */
+ SDL_SCANCODE_KP_3, /* DOM_VK_NUMPAD3 99 */
+ SDL_SCANCODE_KP_4, /* DOM_VK_NUMPAD4 100 */
+ SDL_SCANCODE_KP_5, /* DOM_VK_NUMPAD5 101 */
+ SDL_SCANCODE_KP_6, /* DOM_VK_NUMPAD6 102 */
+ SDL_SCANCODE_KP_7, /* DOM_VK_NUMPAD7 103 */
+ SDL_SCANCODE_KP_8, /* DOM_VK_NUMPAD8 104 */
+ SDL_SCANCODE_KP_9, /* DOM_VK_NUMPAD9 105 */
+ SDL_SCANCODE_KP_MULTIPLY, /* DOM_VK_MULTIPLY 106 */
+ SDL_SCANCODE_KP_PLUS, /* DOM_VK_ADD 107 */
+ SDL_SCANCODE_KP_COMMA, /* DOM_VK_SEPARATOR 108 */
+ SDL_SCANCODE_KP_MINUS, /* DOM_VK_SUBTRACT 109 */
+ SDL_SCANCODE_KP_PERIOD, /* DOM_VK_DECIMAL 110 */
+ SDL_SCANCODE_KP_DIVIDE, /* DOM_VK_DIVIDE 111 */
+ SDL_SCANCODE_F1, /* DOM_VK_F1 112 */
+ SDL_SCANCODE_F2, /* DOM_VK_F2 113 */
+ SDL_SCANCODE_F3, /* DOM_VK_F3 114 */
+ SDL_SCANCODE_F4, /* DOM_VK_F4 115 */
+ SDL_SCANCODE_F5, /* DOM_VK_F5 116 */
+ SDL_SCANCODE_F6, /* DOM_VK_F6 117 */
+ SDL_SCANCODE_F7, /* DOM_VK_F7 118 */
+ SDL_SCANCODE_F8, /* DOM_VK_F8 119 */
+ SDL_SCANCODE_F9, /* DOM_VK_F9 120 */
+ SDL_SCANCODE_F10, /* DOM_VK_F10 121 */
+ SDL_SCANCODE_F11, /* DOM_VK_F11 122 */
+ SDL_SCANCODE_F12, /* DOM_VK_F12 123 */
+ SDL_SCANCODE_F13, /* DOM_VK_F13 124 */
+ SDL_SCANCODE_F14, /* DOM_VK_F14 125 */
+ SDL_SCANCODE_F15, /* DOM_VK_F15 126 */
+ SDL_SCANCODE_F16, /* DOM_VK_F16 127 */
+ SDL_SCANCODE_F17, /* DOM_VK_F17 128 */
+ SDL_SCANCODE_F18, /* DOM_VK_F18 129 */
+ SDL_SCANCODE_F19, /* DOM_VK_F19 130 */
+ SDL_SCANCODE_F20, /* DOM_VK_F20 131 */
+ SDL_SCANCODE_F21, /* DOM_VK_F21 132 */
+ SDL_SCANCODE_F22, /* DOM_VK_F22 133 */
+ SDL_SCANCODE_F23, /* DOM_VK_F23 134 */
+ SDL_SCANCODE_F24, /* DOM_VK_F24 135 */
+ SDL_SCANCODE_UNKNOWN, /* 136 */
+ SDL_SCANCODE_UNKNOWN, /* 137 */
+ SDL_SCANCODE_UNKNOWN, /* 138 */
+ SDL_SCANCODE_UNKNOWN, /* 139 */
+ SDL_SCANCODE_UNKNOWN, /* 140 */
+ SDL_SCANCODE_UNKNOWN, /* 141 */
+ SDL_SCANCODE_UNKNOWN, /* 142 */
+ SDL_SCANCODE_UNKNOWN, /* 143 */
+ SDL_SCANCODE_NUMLOCKCLEAR, /* DOM_VK_NUM_LOCK 144 */
+ SDL_SCANCODE_SCROLLLOCK, /* DOM_VK_SCROLL_LOCK 145 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_FJ_JISHO 146 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_FJ_MASSHOU 147 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_FJ_TOUROKU 148 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_FJ_LOYA 149 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_FJ_ROYA 150 */
+ SDL_SCANCODE_UNKNOWN, /* 151 */
+ SDL_SCANCODE_UNKNOWN, /* 152 */
+ SDL_SCANCODE_UNKNOWN, /* 153 */
+ SDL_SCANCODE_UNKNOWN, /* 154 */
+ SDL_SCANCODE_UNKNOWN, /* 155 */
+ SDL_SCANCODE_UNKNOWN, /* 156 */
+ SDL_SCANCODE_UNKNOWN, /* 157 */
+ SDL_SCANCODE_UNKNOWN, /* 158 */
+ SDL_SCANCODE_UNKNOWN, /* 159 */
+ SDL_SCANCODE_GRAVE, /* DOM_VK_CIRCUMFLEX 160 */
+ SDL_SCANCODE_KP_EXCLAM, /* DOM_VK_EXCLAMATION 161 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_DOUBLE_QUOTE 162 */
+ SDL_SCANCODE_KP_HASH, /* DOM_VK_HASH 163 */
+ SDL_SCANCODE_CURRENCYUNIT, /* DOM_VK_DOLLAR 164 */
+ SDL_SCANCODE_KP_PERCENT, /* DOM_VK_PERCENT 165 */
+ SDL_SCANCODE_KP_AMPERSAND, /* DOM_VK_AMPERSAND 166 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_UNDERSCORE 167 */
+ SDL_SCANCODE_KP_LEFTPAREN, /* DOM_VK_OPEN_PAREN 168 */
+ SDL_SCANCODE_KP_RIGHTPAREN, /* DOM_VK_CLOSE_PAREN 169 */
+ SDL_SCANCODE_KP_MULTIPLY, /* DOM_VK_ASTERISK 170 */
+ SDL_SCANCODE_KP_PLUS, /* DOM_VK_PLUS 171 */
+ SDL_SCANCODE_KP_PLUS, /* DOM_VK_PIPE 172 */
+ SDL_SCANCODE_MINUS, /* DOM_VK_HYPHEN_MINUS 173 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_OPEN_CURLY_BRACKET 174 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_CLOSE_CURLY_BRACKET 175 */
+ SDL_SCANCODE_NONUSBACKSLASH, /* DOM_VK_TILDE 176 */
+ SDL_SCANCODE_UNKNOWN, /* 177 */
+ SDL_SCANCODE_UNKNOWN, /* 178 */
+ SDL_SCANCODE_UNKNOWN, /* 179 */
+ SDL_SCANCODE_UNKNOWN, /* 180 */
+ SDL_SCANCODE_MUTE, /* DOM_VK_VOLUME_MUTE 181 */
+ SDL_SCANCODE_VOLUMEDOWN, /* DOM_VK_VOLUME_DOWN 182 */
+ SDL_SCANCODE_VOLUMEUP, /* DOM_VK_VOLUME_UP 183 */
+ SDL_SCANCODE_UNKNOWN, /* 184 */
+ SDL_SCANCODE_UNKNOWN, /* 185 */
+ SDL_SCANCODE_UNKNOWN, /* 186 */
+ SDL_SCANCODE_UNKNOWN, /* 187 */
+ SDL_SCANCODE_COMMA, /* DOM_VK_COMMA 188 */
+ SDL_SCANCODE_UNKNOWN, /* 189 */
+ SDL_SCANCODE_PERIOD, /* DOM_VK_PERIOD 190 */
+ SDL_SCANCODE_SLASH, /* DOM_VK_SLASH 191 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_BACK_QUOTE 192 */
+ SDL_SCANCODE_UNKNOWN, /* 193 */
+ SDL_SCANCODE_UNKNOWN, /* 194 */
+ SDL_SCANCODE_UNKNOWN, /* 195 */
+ SDL_SCANCODE_UNKNOWN, /* 196 */
+ SDL_SCANCODE_UNKNOWN, /* 197 */
+ SDL_SCANCODE_UNKNOWN, /* 198 */
+ SDL_SCANCODE_UNKNOWN, /* 199 */
+ SDL_SCANCODE_UNKNOWN, /* 200 */
+ SDL_SCANCODE_UNKNOWN, /* 201 */
+ SDL_SCANCODE_UNKNOWN, /* 202 */
+ SDL_SCANCODE_UNKNOWN, /* 203 */
+ SDL_SCANCODE_UNKNOWN, /* 204 */
+ SDL_SCANCODE_UNKNOWN, /* 205 */
+ SDL_SCANCODE_UNKNOWN, /* 206 */
+ SDL_SCANCODE_UNKNOWN, /* 207 */
+ SDL_SCANCODE_UNKNOWN, /* 208 */
+ SDL_SCANCODE_UNKNOWN, /* 209 */
+ SDL_SCANCODE_UNKNOWN, /* 210 */
+ SDL_SCANCODE_UNKNOWN, /* 211 */
+ SDL_SCANCODE_UNKNOWN, /* 212 */
+ SDL_SCANCODE_UNKNOWN, /* 213 */
+ SDL_SCANCODE_UNKNOWN, /* 214 */
+ SDL_SCANCODE_UNKNOWN, /* 215 */
+ SDL_SCANCODE_UNKNOWN, /* 216 */
+ SDL_SCANCODE_UNKNOWN, /* 217 */
+ SDL_SCANCODE_UNKNOWN, /* 218 */
+ SDL_SCANCODE_LEFTBRACKET, /* DOM_VK_OPEN_BRACKET 219 */
+ SDL_SCANCODE_BACKSLASH, /* DOM_VK_BACK_SLASH 220 */
+ SDL_SCANCODE_RIGHTBRACKET, /* DOM_VK_CLOSE_BRACKET 221 */
+ SDL_SCANCODE_APOSTROPHE, /* DOM_VK_QUOTE 222 */
+ SDL_SCANCODE_UNKNOWN, /* 223 */
+ SDL_SCANCODE_RGUI, /* DOM_VK_META 224 */
+ SDL_SCANCODE_RALT, /* DOM_VK_ALTGR 225 */
+ SDL_SCANCODE_UNKNOWN, /* 226 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_ICO_HELP 227 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_ICO_00 228 */
+ SDL_SCANCODE_UNKNOWN, /* 229 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_ICO_CLEAR 230 */
+ SDL_SCANCODE_UNKNOWN, /* 231 */
+ SDL_SCANCODE_UNKNOWN, /* 232 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_RESET 233 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_JUMP 234 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_PA1 235 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_PA2 236 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_PA3 237 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_WSCTRL 238 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_CUSEL 239 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_ATTN 240 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_FINISH 241 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_COPY 242 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_AUTO 243 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_ENLW 244 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_BACKTAB 245 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_ATTN 246 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_CRSEL 247 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_EXSEL 248 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_EREOF 249 */
+ SDL_SCANCODE_AUDIOPLAY, /* DOM_VK_PLAY 250 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_ZOOM 251 */
+ SDL_SCANCODE_UNKNOWN, /* 252 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_PA1 253 */
+ SDL_SCANCODE_UNKNOWN, /* DOM_VK_WIN_OEM_CLEAR 254 */
+ SDL_SCANCODE_UNKNOWN, /* 255 */
+};
+
+static Uint8 SDL_NACL_translate_mouse_button(int32_t button) {
+ switch (button) {
+ case PP_INPUTEVENT_MOUSEBUTTON_LEFT:
+ return SDL_BUTTON_LEFT;
+ case PP_INPUTEVENT_MOUSEBUTTON_MIDDLE:
+ return SDL_BUTTON_MIDDLE;
+ case PP_INPUTEVENT_MOUSEBUTTON_RIGHT:
+ return SDL_BUTTON_RIGHT;
+
+ case PP_INPUTEVENT_MOUSEBUTTON_NONE:
+ default:
+ return 0;
+ }
+}
+
+static SDL_Scancode
+SDL_NACL_translate_keycode(int keycode)
+{
+ SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
+
+ if (keycode < SDL_arraysize(NACL_Keycodes)) {
+ scancode = NACL_Keycodes[keycode];
+ }
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> NACL KeyCode %d", keycode);
+ }
+ return scancode;
+}
+
+void NACL_PumpEvents(_THIS) {
+ PSEvent* ps_event;
+ PP_Resource event;
+ PP_InputEvent_Type type;
+ PP_InputEvent_Modifier modifiers;
+ struct PP_Rect rect;
+ struct PP_FloatPoint fp;
+ struct PP_Point location;
+ struct PP_Var var;
+ const char *str;
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+ Uint32 str_len;
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (driverdata->window) {
+ while ((ps_event = PSEventTryAcquire()) != NULL) {
+ event = ps_event->as_resource;
+ switch(ps_event->type) {
+ /* From DidChangeView, contains a view resource */
+ case PSE_INSTANCE_DIDCHANGEVIEW:
+ driverdata->ppb_view->GetRect(event, &rect);
+ NACL_SetScreenResolution(rect.size.width, rect.size.height, SDL_PIXELFORMAT_UNKNOWN);
+ // FIXME: Rebuild context? See life.c UpdateContext
+ break;
+
+ /* From HandleInputEvent, contains an input resource. */
+ case PSE_INSTANCE_HANDLEINPUT:
+ type = driverdata->ppb_input_event->GetType(event);
+ modifiers = driverdata->ppb_input_event->GetModifiers(event);
+ switch(type) {
+ case PP_INPUTEVENT_TYPE_MOUSEDOWN:
+ SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, SDL_NACL_translate_mouse_button(driverdata->ppb_mouse_input_event->GetButton(event)));
+ break;
+ case PP_INPUTEVENT_TYPE_MOUSEUP:
+ SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, SDL_NACL_translate_mouse_button(driverdata->ppb_mouse_input_event->GetButton(event)));
+ break;
+ case PP_INPUTEVENT_TYPE_WHEEL:
+ /* FIXME: GetTicks provides high resolution scroll events */
+ fp = driverdata->ppb_wheel_input_event->GetDelta(event);
+ SDL_SendMouseWheel(mouse->focus, mouse->mouseID, fp.x, fp.y, SDL_MOUSEWHEEL_NORMAL);
+ break;
+
+ case PP_INPUTEVENT_TYPE_MOUSEENTER:
+ case PP_INPUTEVENT_TYPE_MOUSELEAVE:
+ /* FIXME: Mouse Focus */
+ break;
+
+
+ case PP_INPUTEVENT_TYPE_MOUSEMOVE:
+ location = driverdata->ppb_mouse_input_event->GetPosition(event);
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, location.x, location.y);
+ break;
+
+ case PP_INPUTEVENT_TYPE_TOUCHSTART:
+ case PP_INPUTEVENT_TYPE_TOUCHMOVE:
+ case PP_INPUTEVENT_TYPE_TOUCHEND:
+ case PP_INPUTEVENT_TYPE_TOUCHCANCEL:
+ /* FIXME: Touch events */
+ break;
+
+ case PP_INPUTEVENT_TYPE_KEYDOWN:
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event)));
+ break;
+
+ case PP_INPUTEVENT_TYPE_KEYUP:
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event)));
+ break;
+
+ case PP_INPUTEVENT_TYPE_CHAR:
+ var = driverdata->ppb_keyboard_input_event->GetCharacterText(event);
+ str = driverdata->ppb_var->VarToUtf8(var, &str_len);
+ /* str is not null terminated! */
+ if ( str_len >= SDL_arraysize(text) ) {
+ str_len = SDL_arraysize(text) - 1;
+ }
+ SDL_strlcpy(text, str, str_len );
+ text[str_len] = '\0';
+
+ SDL_SendKeyboardText(text);
+ /* FIXME: Do we have to handle ref counting? driverdata->ppb_var->Release(var);*/
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+
+ /* From HandleMessage, contains a PP_Var. */
+ case PSE_INSTANCE_HANDLEMESSAGE:
+ break;
+
+ /* From DidChangeFocus, contains a PP_Bool with the current focus state. */
+ case PSE_INSTANCE_DIDCHANGEFOCUS:
+ break;
+
+ /* When the 3D context is lost, no resource. */
+ case PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST:
+ break;
+
+ /* When the mouse lock is lost. */
+ case PSE_MOUSELOCK_MOUSELOCKLOST:
+ break;
+
+ default:
+ break;
+ }
+
+ PSEventRelease(ps_event);
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_NACL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclevents_c.h b/src/3rdparty/SDL2/src/video/nacl/SDL_naclevents_c.h
new file mode 100644
index 0000000..8059ea5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclevents_c.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_naclevents_c_h_
+#define SDL_naclevents_c_h_
+
+#include "SDL_naclvideo.h"
+
+extern void NACL_PumpEvents(_THIS);
+
+#endif /* SDL_naclevents_c_h_ */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclglue.c b/src/3rdparty/SDL2/src/video/nacl/SDL_naclglue.c
new file mode 100644
index 0000000..544cc6f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclglue.c
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_NACL
+#endif /* SDL_VIDEO_DRIVER_NACL */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.c b/src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.c
new file mode 100644
index 0000000..98b9ad3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.c
@@ -0,0 +1,174 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_NACL
+
+/* NaCl SDL video GLES 2 driver implementation */
+
+#include "SDL_video.h"
+#include "SDL_naclvideo.h"
+
+#if SDL_LOADSO_DLOPEN
+#include "dlfcn.h"
+#endif
+
+#include "ppapi/gles2/gl2ext_ppapi.h"
+#include "ppapi_simple/ps.h"
+
+/* GL functions */
+int
+NACL_GLES_LoadLibrary(_THIS, const char *path)
+{
+ /* FIXME: Support dynamic linking when PNACL supports it */
+ return glInitializePPAPI(PSGetInterface) == 0;
+}
+
+void *
+NACL_GLES_GetProcAddress(_THIS, const char *proc)
+{
+#if SDL_LOADSO_DLOPEN
+ return dlsym( 0 /* RTLD_DEFAULT */, proc);
+#else
+ return NULL;
+#endif
+}
+
+void
+NACL_GLES_UnloadLibrary(_THIS)
+{
+ /* FIXME: Support dynamic linking when PNACL supports it */
+ glTerminatePPAPI();
+}
+
+int
+NACL_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext sdl_context)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ /* FIXME: Check threading issues...otherwise use a hardcoded _this->context across all threads */
+ driverdata->ppb_instance->BindGraphics(driverdata->instance, (PP_Resource) sdl_context);
+ glSetCurrentContextPPAPI((PP_Resource) sdl_context);
+ return 0;
+}
+
+SDL_GLContext
+NACL_GLES_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ PP_Resource context, share_context = 0;
+ /* 64 seems nice. */
+ Sint32 attribs[64];
+ int i = 0;
+
+ if (_this->gl_config.share_with_current_context) {
+ share_context = (PP_Resource) SDL_GL_GetCurrentContext();
+ }
+
+ /* FIXME: Some ATTRIBS from PP_Graphics3DAttrib are not set here */
+
+ attribs[i++] = PP_GRAPHICS3DATTRIB_WIDTH;
+ attribs[i++] = window->w;
+ attribs[i++] = PP_GRAPHICS3DATTRIB_HEIGHT;
+ attribs[i++] = window->h;
+ attribs[i++] = PP_GRAPHICS3DATTRIB_RED_SIZE;
+ attribs[i++] = _this->gl_config.red_size;
+ attribs[i++] = PP_GRAPHICS3DATTRIB_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.green_size;
+ attribs[i++] = PP_GRAPHICS3DATTRIB_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.blue_size;
+
+ if (_this->gl_config.alpha_size) {
+ attribs[i++] = PP_GRAPHICS3DATTRIB_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.alpha_size;
+ }
+
+ /*if (_this->gl_config.buffer_size) {
+ attribs[i++] = EGL_BUFFER_SIZE;
+ attribs[i++] = _this->gl_config.buffer_size;
+ }*/
+
+ attribs[i++] = PP_GRAPHICS3DATTRIB_DEPTH_SIZE;
+ attribs[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.stencil_size) {
+ attribs[i++] = PP_GRAPHICS3DATTRIB_STENCIL_SIZE;
+ attribs[i++] = _this->gl_config.stencil_size;
+ }
+
+ if (_this->gl_config.multisamplebuffers) {
+ attribs[i++] = PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS;
+ attribs[i++] = _this->gl_config.multisamplebuffers;
+ }
+
+ if (_this->gl_config.multisamplesamples) {
+ attribs[i++] = PP_GRAPHICS3DATTRIB_SAMPLES;
+ attribs[i++] = _this->gl_config.multisamplesamples;
+ }
+
+ attribs[i++] = PP_GRAPHICS3DATTRIB_NONE;
+
+ context = driverdata->ppb_graphics->Create(driverdata->instance, share_context, attribs);
+
+ if (context) {
+ /* We need to make the context current, otherwise nothing works */
+ SDL_GL_MakeCurrent(window, (SDL_GLContext) context);
+ }
+
+ return (SDL_GLContext) context;
+}
+
+
+
+int
+NACL_GLES_SetSwapInterval(_THIS, int interval)
+{
+ /* STUB */
+ return SDL_Unsupported();
+}
+
+int
+NACL_GLES_GetSwapInterval(_THIS)
+{
+ /* STUB */
+ return 0;
+}
+
+int
+NACL_GLES_SwapWindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ struct PP_CompletionCallback callback = { NULL, 0, PP_COMPLETIONCALLBACK_FLAG_NONE };
+ if (driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ) != 0) {
+ return SDL_SetError("SwapBuffers failed");
+ }
+ return 0;
+}
+
+void
+NACL_GLES_DeleteContext(_THIS, SDL_GLContext context)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ driverdata->ppb_core->ReleaseResource((PP_Resource) context);
+}
+
+#endif /* SDL_VIDEO_DRIVER_NACL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.h b/src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.h
new file mode 100644
index 0000000..744c0e5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclopengles.h
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_naclopengles_h_
+#define SDL_naclopengles_h_
+
+extern int NACL_GLES_LoadLibrary(_THIS, const char *path);
+extern void *NACL_GLES_GetProcAddress(_THIS, const char *proc);
+extern void NACL_GLES_UnloadLibrary(_THIS);
+extern SDL_GLContext NACL_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int NACL_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern int NACL_GLES_SetSwapInterval(_THIS, int interval);
+extern int NACL_GLES_GetSwapInterval(_THIS);
+extern int NACL_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern void NACL_GLES_DeleteContext(_THIS, SDL_GLContext context);
+
+#endif /* SDL_naclopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.c b/src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.c
new file mode 100644
index 0000000..24dda2c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.c
@@ -0,0 +1,183 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_NACL
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi_simple/ps.h"
+#include "ppapi_simple/ps_interface.h"
+#include "ppapi_simple/ps_event.h"
+#include "nacl_io/nacl_io.h"
+
+#include "SDL_naclvideo.h"
+#include "SDL_naclwindow.h"
+#include "SDL_naclevents_c.h"
+#include "SDL_naclopengles.h"
+#include "SDL_video.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
+
+#define NACLVID_DRIVER_NAME "nacl"
+
+/* Static init required because NACL_SetScreenResolution
+ * may appear even before SDL starts and we want to remember
+ * the window width and height
+ */
+static SDL_VideoData nacl = {0};
+
+void
+NACL_SetScreenResolution(int width, int height, Uint32 format)
+{
+ PP_Resource context;
+
+ nacl.w = width;
+ nacl.h = height;
+ nacl.format = format;
+
+ if (nacl.window) {
+ nacl.window->w = width;
+ nacl.window->h = height;
+ SDL_SendWindowEvent(nacl.window, SDL_WINDOWEVENT_RESIZED, width, height);
+ }
+
+ /* FIXME: Check threading issues...otherwise use a hardcoded _this->context across all threads */
+ context = (PP_Resource) SDL_GL_GetCurrentContext();
+ if (context) {
+ PSInterfaceGraphics3D()->ResizeBuffers(context, width, height);
+ }
+
+}
+
+
+
+/* Initialization/Query functions */
+static int NACL_VideoInit(_THIS);
+static void NACL_VideoQuit(_THIS);
+
+static int NACL_Available(void) {
+ return PSGetInstanceId() != 0;
+}
+
+static void NACL_DeleteDevice(SDL_VideoDevice *device) {
+ SDL_VideoData *driverdata = (SDL_VideoData*) device->driverdata;
+ driverdata->ppb_core->ReleaseResource((PP_Resource) driverdata->ppb_message_loop);
+ /* device->driverdata is not freed because it points to static memory */
+ SDL_free(device);
+}
+
+static int
+NACL_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+static SDL_VideoDevice *NACL_CreateDevice(int devindex) {
+ SDL_VideoDevice *device;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ device->driverdata = &nacl;
+
+ /* Set the function pointers */
+ device->VideoInit = NACL_VideoInit;
+ device->VideoQuit = NACL_VideoQuit;
+ device->PumpEvents = NACL_PumpEvents;
+
+ device->CreateSDLWindow = NACL_CreateWindow;
+ device->SetWindowTitle = NACL_SetWindowTitle;
+ device->DestroyWindow = NACL_DestroyWindow;
+
+ device->SetDisplayMode = NACL_SetDisplayMode;
+
+ device->free = NACL_DeleteDevice;
+
+ /* GL pointers */
+ device->GL_LoadLibrary = NACL_GLES_LoadLibrary;
+ device->GL_GetProcAddress = NACL_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = NACL_GLES_UnloadLibrary;
+ device->GL_CreateContext = NACL_GLES_CreateContext;
+ device->GL_MakeCurrent = NACL_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = NACL_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = NACL_GLES_GetSwapInterval;
+ device->GL_SwapWindow = NACL_GLES_SwapWindow;
+ device->GL_DeleteContext = NACL_GLES_DeleteContext;
+
+
+ return device;
+}
+
+VideoBootStrap NACL_bootstrap = {
+ NACLVID_DRIVER_NAME, "SDL Native Client Video Driver",
+ NACL_Available, NACL_CreateDevice
+};
+
+int NACL_VideoInit(_THIS) {
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ SDL_DisplayMode mode;
+
+ SDL_zero(mode);
+ mode.format = driverdata->format;
+ mode.w = driverdata->w;
+ mode.h = driverdata->h;
+ mode.refresh_rate = 0;
+ mode.driverdata = NULL;
+ if (SDL_AddBasicVideoDisplay(&mode) < 0) {
+ return -1;
+ }
+
+ SDL_AddDisplayMode(&_this->displays[0], &mode);
+
+ PSInterfaceInit();
+ driverdata->instance = PSGetInstanceId();
+ driverdata->ppb_graphics = PSInterfaceGraphics3D();
+ driverdata->ppb_message_loop = PSInterfaceMessageLoop();
+ driverdata->ppb_core = PSInterfaceCore();
+ driverdata->ppb_fullscreen = PSInterfaceFullscreen();
+ driverdata->ppb_instance = PSInterfaceInstance();
+ driverdata->ppb_image_data = PSInterfaceImageData();
+ driverdata->ppb_view = PSInterfaceView();
+ driverdata->ppb_var = PSInterfaceVar();
+ driverdata->ppb_input_event = (PPB_InputEvent*) PSGetInterface(PPB_INPUT_EVENT_INTERFACE);
+ driverdata->ppb_keyboard_input_event = (PPB_KeyboardInputEvent*) PSGetInterface(PPB_KEYBOARD_INPUT_EVENT_INTERFACE);
+ driverdata->ppb_mouse_input_event = (PPB_MouseInputEvent*) PSGetInterface(PPB_MOUSE_INPUT_EVENT_INTERFACE);
+ driverdata->ppb_wheel_input_event = (PPB_WheelInputEvent*) PSGetInterface(PPB_WHEEL_INPUT_EVENT_INTERFACE);
+ driverdata->ppb_touch_input_event = (PPB_TouchInputEvent*) PSGetInterface(PPB_TOUCH_INPUT_EVENT_INTERFACE);
+
+
+ driverdata->message_loop = driverdata->ppb_message_loop->Create(driverdata->instance);
+
+ PSEventSetFilter(PSE_ALL);
+
+ /* We're done! */
+ return 0;
+}
+
+void NACL_VideoQuit(_THIS) {
+}
+
+#endif /* SDL_VIDEO_DRIVER_NACL */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.h b/src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.h
new file mode 100644
index 0000000..6986aa8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclvideo.h
@@ -0,0 +1,67 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_naclvideo_h_
+#define SDL_naclvideo_h_
+
+#include "../SDL_sysvideo.h"
+#include "ppapi_simple/ps_interface.h"
+#include "ppapi/c/pp_input_event.h"
+
+
+/* Hidden "this" pointer for the video functions */
+#define _THIS SDL_VideoDevice *_this
+
+
+/* Private display data */
+
+typedef struct SDL_VideoData {
+ Uint32 format;
+ int w, h;
+ SDL_Window *window;
+
+ const PPB_Graphics3D *ppb_graphics;
+ const PPB_MessageLoop *ppb_message_loop;
+ const PPB_Core *ppb_core;
+ const PPB_Fullscreen *ppb_fullscreen;
+ const PPB_Instance *ppb_instance;
+ const PPB_ImageData *ppb_image_data;
+ const PPB_View *ppb_view;
+ const PPB_Var *ppb_var;
+ const PPB_InputEvent *ppb_input_event;
+ const PPB_KeyboardInputEvent *ppb_keyboard_input_event;
+ const PPB_MouseInputEvent *ppb_mouse_input_event;
+ const PPB_WheelInputEvent *ppb_wheel_input_event;
+ const PPB_TouchInputEvent *ppb_touch_input_event;
+
+ PP_Resource message_loop;
+ PP_Instance instance;
+
+ /* FIXME: Check threading issues...otherwise use a hardcoded _this->context across all threads */
+ /* PP_Resource context; */
+
+} SDL_VideoData;
+
+extern void NACL_SetScreenResolution(int width, int height, Uint32 format);
+
+
+#endif /* SDL_naclvideo_h_ */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.c b/src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.c
new file mode 100644
index 0000000..7193331
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.c
@@ -0,0 +1,79 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_NACL
+
+#include "../SDL_sysvideo.h"
+
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_naclvideo.h"
+#include "SDL_naclwindow.h"
+
+int
+NACL_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+
+ if (driverdata->window) {
+ SDL_SetError("NaCl only supports one window");
+ return -1;
+ }
+ driverdata->window = window;
+
+ /* Adjust the window data to match the screen */
+ window->x = 0;
+ window->y = 0;
+ window->w = driverdata->w;
+ window->h = driverdata->h;
+
+ window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */
+ window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */
+ window->flags &= ~SDL_WINDOW_HIDDEN;
+ window->flags |= SDL_WINDOW_SHOWN; /* only one window on NaCl */
+ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */
+ window->flags |= SDL_WINDOW_OPENGL;
+
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+
+ return 0;
+}
+
+void
+NACL_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ /* TODO */
+}
+
+void
+NACL_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+ if (window == driverdata->window) {
+ driverdata->window = NULL;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_NACL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.h b/src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.h
new file mode 100644
index 0000000..412b15f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/nacl/SDL_naclwindow.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_naclwindow_h_
+#define SDL_naclwindow_h_
+
+extern int NACL_CreateWindow(_THIS, SDL_Window * window);
+extern void NACL_SetWindowTitle(_THIS, SDL_Window * window);
+extern void NACL_DestroyWindow(_THIS, SDL_Window * window);
+
+#endif /* SDL_naclwindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/pandora/SDL_pandora.c b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora.c
new file mode 100644
index 0000000..b319b16
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora.c
@@ -0,0 +1,838 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_PANDORA
+
+/* SDL internals */
+#include "../SDL_sysvideo.h"
+#include "SDL_version.h"
+#include "SDL_syswm.h"
+#include "SDL_loadso.h"
+#include "SDL_events.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+
+/* PND declarations */
+#include "SDL_pandora.h"
+#include "SDL_pandora_events.h"
+
+/* WIZ declarations */
+#include "GLES/gl.h"
+#ifdef WIZ_GLES_LITE
+static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */
+#endif
+
+static int
+PND_available(void)
+{
+ return 1;
+}
+
+static void
+PND_destroy(SDL_VideoDevice * device)
+{
+ if (device->driverdata != NULL) {
+ SDL_free(device->driverdata);
+ device->driverdata = NULL;
+ }
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+PND_create()
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *phdata;
+ int status;
+
+ /* Check if pandora could be initialized */
+ status = PND_available();
+ if (status == 0) {
+ /* PND could not be used */
+ return NULL;
+ }
+
+ /* Initialize SDL_VideoDevice structure */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize internal Pandora specific data */
+ phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (phdata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+
+ device->driverdata = phdata;
+
+ phdata->egl_initialized = SDL_TRUE;
+
+
+ /* Setup amount of available displays */
+ device->num_displays = 0;
+
+ /* Set device free function */
+ device->free = PND_destroy;
+
+ /* Setup all functions which we can handle */
+ device->VideoInit = PND_videoinit;
+ device->VideoQuit = PND_videoquit;
+ device->GetDisplayModes = PND_getdisplaymodes;
+ device->SetDisplayMode = PND_setdisplaymode;
+ device->CreateSDLWindow = PND_createwindow;
+ device->CreateSDLWindowFrom = PND_createwindowfrom;
+ device->SetWindowTitle = PND_setwindowtitle;
+ device->SetWindowIcon = PND_setwindowicon;
+ device->SetWindowPosition = PND_setwindowposition;
+ device->SetWindowSize = PND_setwindowsize;
+ device->ShowWindow = PND_showwindow;
+ device->HideWindow = PND_hidewindow;
+ device->RaiseWindow = PND_raisewindow;
+ device->MaximizeWindow = PND_maximizewindow;
+ device->MinimizeWindow = PND_minimizewindow;
+ device->RestoreWindow = PND_restorewindow;
+ device->SetWindowGrab = PND_setwindowgrab;
+ device->DestroyWindow = PND_destroywindow;
+#if 0
+ device->GetWindowWMInfo = PND_getwindowwminfo;
+#endif
+ device->GL_LoadLibrary = PND_gl_loadlibrary;
+ device->GL_GetProcAddress = PND_gl_getprocaddres;
+ device->GL_UnloadLibrary = PND_gl_unloadlibrary;
+ device->GL_CreateContext = PND_gl_createcontext;
+ device->GL_MakeCurrent = PND_gl_makecurrent;
+ device->GL_SetSwapInterval = PND_gl_setswapinterval;
+ device->GL_GetSwapInterval = PND_gl_getswapinterval;
+ device->GL_SwapWindow = PND_gl_swapwindow;
+ device->GL_DeleteContext = PND_gl_deletecontext;
+ device->PumpEvents = PND_PumpEvents;
+
+ /* !!! FIXME: implement SetWindowBordered */
+
+ return device;
+}
+
+VideoBootStrap PND_bootstrap = {
+#ifdef WIZ_GLES_LITE
+ "wiz",
+ "SDL Wiz Video Driver",
+#else
+ "pandora",
+ "SDL Pandora Video Driver",
+#endif
+ PND_available,
+ PND_create
+};
+
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions */
+/*****************************************************************************/
+int
+PND_videoinit(_THIS)
+{
+ SDL_VideoDisplay display;
+ SDL_DisplayMode current_mode;
+
+ SDL_zero(current_mode);
+#ifdef WIZ_GLES_LITE
+ current_mode.w = 320;
+ current_mode.h = 240;
+#else
+ current_mode.w = 800;
+ current_mode.h = 480;
+#endif
+ current_mode.refresh_rate = 60;
+ current_mode.format = SDL_PIXELFORMAT_RGB565;
+ current_mode.driverdata = NULL;
+
+ SDL_zero(display);
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+ display.driverdata = NULL;
+
+ SDL_AddVideoDisplay(&display);
+
+ return 1;
+}
+
+void
+PND_videoquit(_THIS)
+{
+
+}
+
+void
+PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display)
+{
+
+}
+
+int
+PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+int
+PND_createwindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+
+ SDL_WindowData *wdata;
+
+ /* Allocate window internal data */
+ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (wdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Setup driver data for this window */
+ window->driverdata = wdata;
+
+ /* Check if window must support OpenGL ES rendering */
+ if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) {
+
+ EGLBoolean initstatus;
+
+ /* Mark this window as OpenGL ES compatible */
+ wdata->uses_gles = SDL_TRUE;
+
+ /* Create connection to OpenGL ES */
+ if (phdata->egl_display == EGL_NO_DISPLAY) {
+ phdata->egl_display = eglGetDisplay((NativeDisplayType) 0);
+ if (phdata->egl_display == EGL_NO_DISPLAY) {
+ return SDL_SetError("PND: Can't get connection to OpenGL ES");
+ }
+
+ initstatus = eglInitialize(phdata->egl_display, NULL, NULL);
+ if (initstatus != EGL_TRUE) {
+ return SDL_SetError("PND: Can't init OpenGL ES library");
+ }
+ }
+
+ phdata->egl_refcount++;
+ }
+
+ /* Window has been successfully created */
+ return 0;
+}
+
+int
+PND_createwindowfrom(_THIS, SDL_Window * window, const void *data)
+{
+ return -1;
+}
+
+void
+PND_setwindowtitle(_THIS, SDL_Window * window)
+{
+}
+void
+PND_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+}
+void
+PND_setwindowposition(_THIS, SDL_Window * window)
+{
+}
+void
+PND_setwindowsize(_THIS, SDL_Window * window)
+{
+}
+void
+PND_showwindow(_THIS, SDL_Window * window)
+{
+}
+void
+PND_hidewindow(_THIS, SDL_Window * window)
+{
+}
+void
+PND_raisewindow(_THIS, SDL_Window * window)
+{
+}
+void
+PND_maximizewindow(_THIS, SDL_Window * window)
+{
+}
+void
+PND_minimizewindow(_THIS, SDL_Window * window)
+{
+}
+void
+PND_restorewindow(_THIS, SDL_Window * window)
+{
+}
+void
+PND_setwindowgrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+}
+void
+PND_destroywindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ eglTerminate(phdata->egl_display);
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function */
+/*****************************************************************************/
+#if 0
+SDL_bool
+PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+
+ /* Failed to get window manager information */
+ return SDL_FALSE;
+}
+#endif
+
+/*****************************************************************************/
+/* SDL OpenGL/OpenGL ES functions */
+/*****************************************************************************/
+int
+PND_gl_loadlibrary(_THIS, const char *path)
+{
+ /* Check if OpenGL ES library is specified for GF driver */
+ if (path == NULL) {
+ path = SDL_getenv("SDL_OPENGL_LIBRARY");
+ if (path == NULL) {
+ path = SDL_getenv("SDL_OPENGLES_LIBRARY");
+ }
+ }
+
+ /* Check if default library loading requested */
+ if (path == NULL) {
+ /* Already linked with GF library which provides egl* subset of */
+ /* functions, use Common profile of OpenGL ES library by default */
+#ifdef WIZ_GLES_LITE
+ path = "/lib/libopengles_lite.so";
+#else
+ path = "/usr/lib/libGLES_CM.so";
+#endif
+ }
+
+ /* Load dynamic library */
+ _this->gl_config.dll_handle = SDL_LoadObject(path);
+ if (!_this->gl_config.dll_handle) {
+ /* Failed to load new GL ES library */
+ return SDL_SetError("PND: Failed to locate OpenGL ES library");
+ }
+
+ /* Store OpenGL ES library path and name */
+ SDL_strlcpy(_this->gl_config.driver_path, path,
+ SDL_arraysize(_this->gl_config.driver_path));
+
+ /* New OpenGL ES library is loaded */
+ return 0;
+}
+
+void *
+PND_gl_getprocaddres(_THIS, const char *proc)
+{
+ void *function_address;
+
+ /* Try to get function address through the egl interface */
+ function_address = eglGetProcAddress(proc);
+ if (function_address != NULL) {
+ return function_address;
+ }
+
+ /* Then try to get function in the OpenGL ES library */
+ if (_this->gl_config.dll_handle) {
+ function_address =
+ SDL_LoadFunction(_this->gl_config.dll_handle, proc);
+ if (function_address != NULL) {
+ return function_address;
+ }
+ }
+
+ /* Failed to get GL ES function address pointer */
+ SDL_SetError("PND: Cannot locate OpenGL ES function name");
+ return NULL;
+}
+
+void
+PND_gl_unloadlibrary(_THIS)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+
+ if (phdata->egl_initialized == SDL_TRUE) {
+ /* Unload OpenGL ES library */
+ if (_this->gl_config.dll_handle) {
+ SDL_UnloadObject(_this->gl_config.dll_handle);
+ _this->gl_config.dll_handle = NULL;
+ }
+ } else {
+ SDL_SetError("PND: GF initialization failed, no OpenGL ES support");
+ }
+}
+
+SDL_GLContext
+PND_gl_createcontext(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
+ EGLBoolean status;
+ EGLint configs;
+ uint32_t attr_pos;
+ EGLint attr_value;
+ EGLint cit;
+
+ /* Check if EGL was initialized */
+ if (phdata->egl_initialized != SDL_TRUE) {
+ SDL_SetError("PND: EGL initialization failed, no OpenGL ES support");
+ return NULL;
+ }
+
+ /* Prepare attributes list to pass them to OpenGL ES */
+ attr_pos = 0;
+ wdata->gles_attributes[attr_pos++] = EGL_SURFACE_TYPE;
+ wdata->gles_attributes[attr_pos++] = EGL_WINDOW_BIT;
+ wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE;
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.red_size;
+ wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE;
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.green_size;
+ wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE;
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.blue_size;
+ wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE;
+
+ /* Setup alpha size in bits */
+ if (_this->gl_config.alpha_size) {
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.alpha_size;
+ } else {
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ }
+
+ /* Setup color buffer size */
+ if (_this->gl_config.buffer_size) {
+ wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size;
+ } else {
+ wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ }
+
+ /* Setup depth buffer bits */
+ wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.depth_size;
+
+ /* Setup stencil bits */
+ if (_this->gl_config.stencil_size) {
+ wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
+ wdata->gles_attributes[attr_pos++] = _this->gl_config.buffer_size;
+ } else {
+ wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ }
+
+ /* Set number of samples in multisampling */
+ if (_this->gl_config.multisamplesamples) {
+ wdata->gles_attributes[attr_pos++] = EGL_SAMPLES;
+ wdata->gles_attributes[attr_pos++] =
+ _this->gl_config.multisamplesamples;
+ }
+
+ /* Multisample buffers, OpenGL ES 1.0 spec defines 0 or 1 buffer */
+ if (_this->gl_config.multisamplebuffers) {
+ wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS;
+ wdata->gles_attributes[attr_pos++] =
+ _this->gl_config.multisamplebuffers;
+ }
+
+ /* Finish attributes list */
+ wdata->gles_attributes[attr_pos] = EGL_NONE;
+
+ /* Request first suitable framebuffer configuration */
+ status = eglChooseConfig(phdata->egl_display, wdata->gles_attributes,
+ wdata->gles_configs, 1, &configs);
+ if (status != EGL_TRUE) {
+ SDL_SetError("PND: Can't find closest configuration for OpenGL ES");
+ return NULL;
+ }
+
+ /* Check if nothing has been found, try "don't care" settings */
+ if (configs == 0) {
+ int32_t it;
+ int32_t jt;
+ GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE };
+
+ for (it = 0; it < 4; it++) {
+ for (jt = 16; jt >= 0; jt--) {
+ /* Don't care about color buffer bits, use what exist */
+ /* Replace previous set data with EGL_DONT_CARE */
+ attr_pos = 0;
+ wdata->gles_attributes[attr_pos++] = EGL_SURFACE_TYPE;
+ wdata->gles_attributes[attr_pos++] = EGL_WINDOW_BIT;
+ wdata->gles_attributes[attr_pos++] = EGL_RED_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ wdata->gles_attributes[attr_pos++] = EGL_GREEN_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ wdata->gles_attributes[attr_pos++] = EGL_BLUE_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ wdata->gles_attributes[attr_pos++] = EGL_ALPHA_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ wdata->gles_attributes[attr_pos++] = EGL_BUFFER_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+
+ /* Try to find requested or smallest depth */
+ if (_this->gl_config.depth_size) {
+ wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
+ wdata->gles_attributes[attr_pos++] = depthbits[it];
+ } else {
+ wdata->gles_attributes[attr_pos++] = EGL_DEPTH_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ }
+
+ if (_this->gl_config.stencil_size) {
+ wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
+ wdata->gles_attributes[attr_pos++] = jt;
+ } else {
+ wdata->gles_attributes[attr_pos++] = EGL_STENCIL_SIZE;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ }
+
+ wdata->gles_attributes[attr_pos++] = EGL_SAMPLES;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ wdata->gles_attributes[attr_pos++] = EGL_SAMPLE_BUFFERS;
+ wdata->gles_attributes[attr_pos++] = EGL_DONT_CARE;
+ wdata->gles_attributes[attr_pos] = EGL_NONE;
+
+ /* Request first suitable framebuffer configuration */
+ status =
+ eglChooseConfig(phdata->egl_display,
+ wdata->gles_attributes,
+ wdata->gles_configs, 1, &configs);
+
+ if (status != EGL_TRUE) {
+ SDL_SetError
+ ("PND: Can't find closest configuration for OpenGL ES");
+ return NULL;
+ }
+ if (configs != 0) {
+ break;
+ }
+ }
+ if (configs != 0) {
+ break;
+ }
+ }
+
+ /* No available configs */
+ if (configs == 0) {
+ SDL_SetError("PND: Can't find any configuration for OpenGL ES");
+ return NULL;
+ }
+ }
+
+ /* Initialize config index */
+ wdata->gles_config = 0;
+
+ /* Now check each configuration to find out the best */
+ for (cit = 0; cit < configs; cit++) {
+ uint32_t stencil_found;
+ uint32_t depth_found;
+
+ stencil_found = 0;
+ depth_found = 0;
+
+ if (_this->gl_config.stencil_size) {
+ status =
+ eglGetConfigAttrib(phdata->egl_display,
+ wdata->gles_configs[cit], EGL_STENCIL_SIZE,
+ &attr_value);
+ if (status == EGL_TRUE) {
+ if (attr_value != 0) {
+ stencil_found = 1;
+ }
+ }
+ } else {
+ stencil_found = 1;
+ }
+
+ if (_this->gl_config.depth_size) {
+ status =
+ eglGetConfigAttrib(phdata->egl_display,
+ wdata->gles_configs[cit], EGL_DEPTH_SIZE,
+ &attr_value);
+ if (status == EGL_TRUE) {
+ if (attr_value != 0) {
+ depth_found = 1;
+ }
+ }
+ } else {
+ depth_found = 1;
+ }
+
+ /* Exit from loop if found appropriate configuration */
+ if ((depth_found != 0) && (stencil_found != 0)) {
+ break;
+ }
+ }
+
+ /* If best could not be found, use first */
+ if (cit == configs) {
+ cit = 0;
+ }
+ wdata->gles_config = cit;
+
+ /* Create OpenGL ES context */
+ wdata->gles_context =
+ eglCreateContext(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config], NULL, NULL);
+ if (wdata->gles_context == EGL_NO_CONTEXT) {
+ SDL_SetError("PND: OpenGL ES context creation has been failed");
+ return NULL;
+ }
+
+#ifdef WIZ_GLES_LITE
+ if( !hNativeWnd ) {
+ hNativeWnd = (NativeWindowType)malloc(16*1024);
+
+ if(!hNativeWnd)
+ printf( "Error: Wiz framebuffer allocatation failed\n" );
+ else
+ printf( "SDL: Wiz framebuffer allocated: %X\n", hNativeWnd );
+ }
+ else {
+ printf( "SDL: Wiz framebuffer already allocated: %X\n", hNativeWnd );
+ }
+
+ wdata->gles_surface =
+ eglCreateWindowSurface(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ hNativeWnd, NULL );
+#else
+ wdata->gles_surface =
+ eglCreateWindowSurface(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ (NativeWindowType) 0, NULL);
+#endif
+
+
+ if (wdata->gles_surface == 0) {
+ SDL_SetError("Error : eglCreateWindowSurface failed;");
+ return NULL;
+ }
+
+ /* Make just created context current */
+ status =
+ eglMakeCurrent(phdata->egl_display, wdata->gles_surface,
+ wdata->gles_surface, wdata->gles_context);
+ if (status != EGL_TRUE) {
+ /* Destroy OpenGL ES surface */
+ eglDestroySurface(phdata->egl_display, wdata->gles_surface);
+ eglDestroyContext(phdata->egl_display, wdata->gles_context);
+ wdata->gles_context = EGL_NO_CONTEXT;
+ SDL_SetError("PND: Can't set OpenGL ES context on creation");
+ return NULL;
+ }
+
+ _this->gl_config.accelerated = 1;
+
+ /* Always clear stereo enable, since OpenGL ES do not supports stereo */
+ _this->gl_config.stereo = 0;
+
+ /* Get back samples and samplebuffers configurations. Rest framebuffer */
+ /* parameters could be obtained through the OpenGL ES API */
+ status =
+ eglGetConfigAttrib(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ EGL_SAMPLES, &attr_value);
+ if (status == EGL_TRUE) {
+ _this->gl_config.multisamplesamples = attr_value;
+ }
+ status =
+ eglGetConfigAttrib(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ EGL_SAMPLE_BUFFERS, &attr_value);
+ if (status == EGL_TRUE) {
+ _this->gl_config.multisamplebuffers = attr_value;
+ }
+
+ /* Get back stencil and depth buffer sizes */
+ status =
+ eglGetConfigAttrib(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ EGL_DEPTH_SIZE, &attr_value);
+ if (status == EGL_TRUE) {
+ _this->gl_config.depth_size = attr_value;
+ }
+ status =
+ eglGetConfigAttrib(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ EGL_STENCIL_SIZE, &attr_value);
+ if (status == EGL_TRUE) {
+ _this->gl_config.stencil_size = attr_value;
+ }
+
+ /* Under PND OpenGL ES output can't be double buffered */
+ _this->gl_config.double_buffer = 0;
+
+ /* GL ES context was successfully created */
+ return wdata->gles_context;
+}
+
+int
+PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *wdata;
+ EGLBoolean status;
+
+ if (phdata->egl_initialized != SDL_TRUE) {
+ return SDL_SetError("PND: GF initialization failed, no OpenGL ES support");
+ }
+
+ if ((window == NULL) && (context == NULL)) {
+ status =
+ eglMakeCurrent(phdata->egl_display, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ if (status != EGL_TRUE) {
+ /* Failed to set current GL ES context */
+ return SDL_SetError("PND: Can't set OpenGL ES context");
+ }
+ } else {
+ wdata = (SDL_WindowData *) window->driverdata;
+ if (wdata->gles_surface == EGL_NO_SURFACE) {
+ return SDL_SetError
+ ("PND: OpenGL ES surface is not initialized for this window");
+ }
+ if (wdata->gles_context == EGL_NO_CONTEXT) {
+ return SDL_SetError
+ ("PND: OpenGL ES context is not initialized for this window");
+ }
+ if (wdata->gles_context != context) {
+ return SDL_SetError
+ ("PND: OpenGL ES context is not belong to this window");
+ }
+ status =
+ eglMakeCurrent(phdata->egl_display, wdata->gles_surface,
+ wdata->gles_surface, wdata->gles_context);
+ if (status != EGL_TRUE) {
+ /* Failed to set current GL ES context */
+ return SDL_SetError("PND: Can't set OpenGL ES context");
+ }
+ }
+ return 0;
+}
+
+int
+PND_gl_setswapinterval(_THIS, int interval)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ EGLBoolean status;
+
+ if (phdata->egl_initialized != SDL_TRUE) {
+ return SDL_SetError("PND: EGL initialization failed, no OpenGL ES support");
+ }
+
+ /* Check if OpenGL ES connection has been initialized */
+ if (phdata->egl_display != EGL_NO_DISPLAY) {
+ /* Set swap OpenGL ES interval */
+ status = eglSwapInterval(phdata->egl_display, interval);
+ if (status == EGL_TRUE) {
+ /* Return success to upper level */
+ phdata->swapinterval = interval;
+ return 0;
+ }
+ }
+
+ /* Failed to set swap interval */
+ return SDL_SetError("PND: Cannot set swap interval");
+}
+
+int
+PND_gl_getswapinterval(_THIS)
+{
+ return ((SDL_VideoData *) _this->driverdata)->swapinterval;
+}
+
+int
+PND_gl_swapwindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
+
+ if (phdata->egl_initialized != SDL_TRUE) {
+ return SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
+ }
+
+ /* Many applications do not uses glFinish(), so we call it for them */
+ glFinish();
+
+ /* Wait until OpenGL ES rendering is completed */
+ eglWaitGL();
+
+ eglSwapBuffers(phdata->egl_display, wdata->gles_surface);
+ return 0;
+}
+
+void
+PND_gl_deletecontext(_THIS, SDL_GLContext context)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ EGLBoolean status;
+
+ if (phdata->egl_initialized != SDL_TRUE) {
+ SDL_SetError("PND: GLES initialization failed, no OpenGL ES support");
+ return;
+ }
+
+ /* Check if OpenGL ES connection has been initialized */
+ if (phdata->egl_display != EGL_NO_DISPLAY) {
+ if (context != EGL_NO_CONTEXT) {
+ status = eglDestroyContext(phdata->egl_display, context);
+ if (status != EGL_TRUE) {
+ /* Error during OpenGL ES context destroying */
+ SDL_SetError("PND: OpenGL ES context destroy error");
+ return;
+ }
+ }
+ }
+
+#ifdef WIZ_GLES_LITE
+ if( hNativeWnd != 0 )
+ {
+ free(hNativeWnd);
+ hNativeWnd = 0;
+ printf( "SDL: Wiz framebuffer released\n" );
+ }
+#endif
+
+ return;
+}
+
+#endif /* SDL_VIDEO_DRIVER_PANDORA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/pandora/SDL_pandora.h b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora.h
new file mode 100644
index 0000000..9e460e7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora.h
@@ -0,0 +1,101 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef __SDL_PANDORA_H__
+#define __SDL_PANDORA_H__
+
+#include <GLES/egl.h>
+
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+
+typedef struct SDL_VideoData
+{
+ SDL_bool egl_initialized; /* OpenGL ES device initialization status */
+ EGLDisplay egl_display; /* OpenGL ES display connection */
+ uint32_t egl_refcount; /* OpenGL ES reference count */
+ uint32_t swapinterval; /* OpenGL ES default swap interval */
+
+} SDL_VideoData;
+
+
+typedef struct SDL_DisplayData
+{
+
+} SDL_DisplayData;
+
+
+typedef struct SDL_WindowData
+{
+ SDL_bool uses_gles; /* if true window must support OpenGL ES */
+
+ EGLConfig gles_configs[32];
+ EGLint gles_config; /* OpenGL ES configuration index */
+ EGLContext gles_context; /* OpenGL ES context */
+ EGLint gles_attributes[256]; /* OpenGL ES attributes for context */
+ EGLSurface gles_surface; /* OpenGL ES target rendering surface */
+
+} SDL_WindowData;
+
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration */
+/****************************************************************************/
+
+/* Display and window functions */
+int PND_videoinit(_THIS);
+void PND_videoquit(_THIS);
+void PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display);
+int PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+int PND_createwindow(_THIS, SDL_Window * window);
+int PND_createwindowfrom(_THIS, SDL_Window * window, const void *data);
+void PND_setwindowtitle(_THIS, SDL_Window * window);
+void PND_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon);
+void PND_setwindowposition(_THIS, SDL_Window * window);
+void PND_setwindowsize(_THIS, SDL_Window * window);
+void PND_showwindow(_THIS, SDL_Window * window);
+void PND_hidewindow(_THIS, SDL_Window * window);
+void PND_raisewindow(_THIS, SDL_Window * window);
+void PND_maximizewindow(_THIS, SDL_Window * window);
+void PND_minimizewindow(_THIS, SDL_Window * window);
+void PND_restorewindow(_THIS, SDL_Window * window);
+void PND_setwindowgrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+void PND_destroywindow(_THIS, SDL_Window * window);
+
+/* Window manager function */
+SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+/* OpenGL/OpenGL ES functions */
+int PND_gl_loadlibrary(_THIS, const char *path);
+void *PND_gl_getprocaddres(_THIS, const char *proc);
+void PND_gl_unloadlibrary(_THIS);
+SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window);
+int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+int PND_gl_setswapinterval(_THIS, int interval);
+int PND_gl_getswapinterval(_THIS);
+int PND_gl_swapwindow(_THIS, SDL_Window * window);
+void PND_gl_deletecontext(_THIS, SDL_GLContext context);
+
+
+#endif /* __SDL_PANDORA_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.c b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.c
new file mode 100644
index 0000000..bff7a36
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.c
@@ -0,0 +1,38 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_PANDORA
+
+/* Being a null driver, there's no event stream. We just define stubs for
+ most of the API. */
+
+#include "../../events/SDL_events_c.h"
+
+void
+PND_PumpEvents(_THIS)
+{
+ /* Not implemented. */
+}
+
+#endif /* SDL_VIDEO_DRIVER_PANDORA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.h b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.h
new file mode 100644
index 0000000..f714384
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/pandora/SDL_pandora_events.h
@@ -0,0 +1,25 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+extern void PND_PumpEvents(_THIS);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspevents.c b/src/3rdparty/SDL2/src/video/psp/SDL_pspevents.c
new file mode 100644
index 0000000..14277b3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspevents.c
@@ -0,0 +1,290 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+/* Being a null driver, there's no event stream. We just define stubs for
+ most of the API. */
+
+#include "SDL.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_pspvideo.h"
+#include "SDL_pspevents_c.h"
+#include "SDL_keyboard.h"
+#include "../../thread/SDL_systhread.h"
+#include <psphprm.h>
+
+#ifdef PSPIRKEYB
+#include <pspirkeyb.h>
+#include <pspirkeyb_rawkeys.h>
+
+#define IRKBD_CONFIG_FILE NULL /* this will take ms0:/seplugins/pspirkeyb.ini */
+
+static int irkbd_ready = 0;
+static SDL_Keycode keymap[256];
+#endif
+
+static enum PspHprmKeys hprm = 0;
+static SDL_sem *event_sem = NULL;
+static SDL_Thread *thread = NULL;
+static int running = 0;
+static struct {
+ enum PspHprmKeys id;
+ SDL_Keycode sym;
+} keymap_psp[] = {
+ { PSP_HPRM_PLAYPAUSE, SDLK_F10 },
+ { PSP_HPRM_FORWARD, SDLK_F11 },
+ { PSP_HPRM_BACK, SDLK_F12 },
+ { PSP_HPRM_VOL_UP, SDLK_F13 },
+ { PSP_HPRM_VOL_DOWN, SDLK_F14 },
+ { PSP_HPRM_HOLD, SDLK_F15 }
+};
+
+int EventUpdate(void *data)
+{
+ while (running) {
+ SDL_SemWait(event_sem);
+ sceHprmPeekCurrentKey(&hprm);
+ SDL_SemPost(event_sem);
+ /* Delay 1/60th of a second */
+ sceKernelDelayThread(1000000 / 60);
+ }
+ return 0;
+}
+
+void PSP_PumpEvents(_THIS)
+{
+ int i;
+ enum PspHprmKeys keys;
+ enum PspHprmKeys changed;
+ static enum PspHprmKeys old_keys = 0;
+ SDL_Keysym sym;
+
+ SDL_SemWait(event_sem);
+ keys = hprm;
+ SDL_SemPost(event_sem);
+
+ /* HPRM Keyboard */
+ changed = old_keys ^ keys;
+ old_keys = keys;
+ if(changed) {
+ for(i=0; i<sizeof(keymap_psp)/sizeof(keymap_psp[0]); i++) {
+ if(changed & keymap_psp[i].id) {
+ sym.scancode = keymap_psp[i].id;
+ sym.sym = keymap_psp[i].sym;
+
+ /* out of date
+ SDL_PrivateKeyboard((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED,
+ &sym);
+ */
+ SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap_psp[i].sym));
+ }
+ }
+ }
+
+#ifdef PSPIRKEYB
+ if (irkbd_ready) {
+ unsigned char buffer[255];
+ int i, length, count;
+ SIrKeybScanCodeData *scanData;
+
+ if(pspIrKeybReadinput(buffer, &length) >= 0) {
+ if((length % sizeof(SIrKeybScanCodeData)) == 0){
+ count = length / sizeof(SIrKeybScanCodeData);
+ for( i=0; i < count; i++ ) {
+ unsigned char raw, pressed;
+ scanData=(SIrKeybScanCodeData*) buffer+i;
+ raw = scanData->raw;
+ pressed = scanData->pressed;
+ sym.scancode = raw;
+ sym.sym = keymap[raw];
+ /* not tested */
+ /* SDL_PrivateKeyboard(pressed?SDL_PRESSED:SDL_RELEASED, &sym); */
+ SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw]));
+
+ }
+ }
+ }
+ }
+#endif
+ sceKernelDelayThread(0);
+
+ return;
+}
+
+void PSP_InitOSKeymap(_THIS)
+{
+#ifdef PSPIRKEYB
+ int i;
+ for (i=0; i<SDL_TABLESIZE(keymap); ++i)
+ keymap[i] = SDLK_UNKNOWN;
+
+ keymap[KEY_ESC] = SDLK_ESCAPE;
+
+ keymap[KEY_F1] = SDLK_F1;
+ keymap[KEY_F2] = SDLK_F2;
+ keymap[KEY_F3] = SDLK_F3;
+ keymap[KEY_F4] = SDLK_F4;
+ keymap[KEY_F5] = SDLK_F5;
+ keymap[KEY_F6] = SDLK_F6;
+ keymap[KEY_F7] = SDLK_F7;
+ keymap[KEY_F8] = SDLK_F8;
+ keymap[KEY_F9] = SDLK_F9;
+ keymap[KEY_F10] = SDLK_F10;
+ keymap[KEY_F11] = SDLK_F11;
+ keymap[KEY_F12] = SDLK_F12;
+ keymap[KEY_F13] = SDLK_PRINT;
+ keymap[KEY_F14] = SDLK_PAUSE;
+
+ keymap[KEY_GRAVE] = SDLK_BACKQUOTE;
+ keymap[KEY_1] = SDLK_1;
+ keymap[KEY_2] = SDLK_2;
+ keymap[KEY_3] = SDLK_3;
+ keymap[KEY_4] = SDLK_4;
+ keymap[KEY_5] = SDLK_5;
+ keymap[KEY_6] = SDLK_6;
+ keymap[KEY_7] = SDLK_7;
+ keymap[KEY_8] = SDLK_8;
+ keymap[KEY_9] = SDLK_9;
+ keymap[KEY_0] = SDLK_0;
+ keymap[KEY_MINUS] = SDLK_MINUS;
+ keymap[KEY_EQUAL] = SDLK_EQUALS;
+ keymap[KEY_BACKSPACE] = SDLK_BACKSPACE;
+
+ keymap[KEY_TAB] = SDLK_TAB;
+ keymap[KEY_Q] = SDLK_q;
+ keymap[KEY_W] = SDLK_w;
+ keymap[KEY_E] = SDLK_e;
+ keymap[KEY_R] = SDLK_r;
+ keymap[KEY_T] = SDLK_t;
+ keymap[KEY_Y] = SDLK_y;
+ keymap[KEY_U] = SDLK_u;
+ keymap[KEY_I] = SDLK_i;
+ keymap[KEY_O] = SDLK_o;
+ keymap[KEY_P] = SDLK_p;
+ keymap[KEY_LEFTBRACE] = SDLK_LEFTBRACKET;
+ keymap[KEY_RIGHTBRACE] = SDLK_RIGHTBRACKET;
+ keymap[KEY_ENTER] = SDLK_RETURN;
+
+ keymap[KEY_CAPSLOCK] = SDLK_CAPSLOCK;
+ keymap[KEY_A] = SDLK_a;
+ keymap[KEY_S] = SDLK_s;
+ keymap[KEY_D] = SDLK_d;
+ keymap[KEY_F] = SDLK_f;
+ keymap[KEY_G] = SDLK_g;
+ keymap[KEY_H] = SDLK_h;
+ keymap[KEY_J] = SDLK_j;
+ keymap[KEY_K] = SDLK_k;
+ keymap[KEY_L] = SDLK_l;
+ keymap[KEY_SEMICOLON] = SDLK_SEMICOLON;
+ keymap[KEY_APOSTROPHE] = SDLK_QUOTE;
+ keymap[KEY_BACKSLASH] = SDLK_BACKSLASH;
+
+ keymap[KEY_Z] = SDLK_z;
+ keymap[KEY_X] = SDLK_x;
+ keymap[KEY_C] = SDLK_c;
+ keymap[KEY_V] = SDLK_v;
+ keymap[KEY_B] = SDLK_b;
+ keymap[KEY_N] = SDLK_n;
+ keymap[KEY_M] = SDLK_m;
+ keymap[KEY_COMMA] = SDLK_COMMA;
+ keymap[KEY_DOT] = SDLK_PERIOD;
+ keymap[KEY_SLASH] = SDLK_SLASH;
+
+ keymap[KEY_SPACE] = SDLK_SPACE;
+
+ keymap[KEY_UP] = SDLK_UP;
+ keymap[KEY_DOWN] = SDLK_DOWN;
+ keymap[KEY_LEFT] = SDLK_LEFT;
+ keymap[KEY_RIGHT] = SDLK_RIGHT;
+
+ keymap[KEY_HOME] = SDLK_HOME;
+ keymap[KEY_END] = SDLK_END;
+ keymap[KEY_INSERT] = SDLK_INSERT;
+ keymap[KEY_DELETE] = SDLK_DELETE;
+
+ keymap[KEY_NUMLOCK] = SDLK_NUMLOCK;
+ keymap[KEY_LEFTMETA] = SDLK_LSUPER;
+
+ keymap[KEY_KPSLASH] = SDLK_KP_DIVIDE;
+ keymap[KEY_KPASTERISK] = SDLK_KP_MULTIPLY;
+ keymap[KEY_KPMINUS] = SDLK_KP_MINUS;
+ keymap[KEY_KPPLUS] = SDLK_KP_PLUS;
+ keymap[KEY_KPDOT] = SDLK_KP_PERIOD;
+ keymap[KEY_KPEQUAL] = SDLK_KP_EQUALS;
+
+ keymap[KEY_LEFTCTRL] = SDLK_LCTRL;
+ keymap[KEY_RIGHTCTRL] = SDLK_RCTRL;
+ keymap[KEY_LEFTALT] = SDLK_LALT;
+ keymap[KEY_RIGHTALT] = SDLK_RALT;
+ keymap[KEY_LEFTSHIFT] = SDLK_LSHIFT;
+ keymap[KEY_RIGHTSHIFT] = SDLK_RSHIFT;
+#endif
+}
+
+void PSP_EventInit(_THIS)
+{
+#ifdef PSPIRKEYB
+ int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
+ int ret = pspIrKeybInit(IRKBD_CONFIG_FILE, 0);
+ if (ret == PSP_IRKBD_RESULT_OK) {
+ pspIrKeybOutputMode(outputmode);
+ irkbd_ready = 1;
+ } else {
+ irkbd_ready = 0;
+ }
+#endif
+ /* Start thread to read data */
+ if((event_sem = SDL_CreateSemaphore(1)) == NULL) {
+ SDL_SetError("Can't create input semaphore");
+ return;
+ }
+ running = 1;
+ if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
+ SDL_SetError("Can't create input thread");
+ return;
+ }
+}
+
+void PSP_EventQuit(_THIS)
+{
+ running = 0;
+ SDL_WaitThread(thread, NULL);
+ SDL_DestroySemaphore(event_sem);
+#ifdef PSPIRKEYB
+ if (irkbd_ready) {
+ pspIrKeybFinish();
+ irkbd_ready = 0;
+ }
+#endif
+}
+
+/* end of SDL_pspevents.c ... */
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspevents_c.h b/src/3rdparty/SDL2/src/video/psp/SDL_pspevents_c.h
new file mode 100644
index 0000000..e98beb4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspevents_c.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "SDL_pspvideo.h"
+
+/* Variables and functions exported by SDL_sysevents.c to other parts
+ of the native video subsystem (SDL_sysvideo.c)
+*/
+extern void PSP_InitOSKeymap(_THIS);
+extern void PSP_PumpEvents(_THIS);
+
+/* end of SDL_pspevents_c.h ... */
+
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspgl.c b/src/3rdparty/SDL2/src/video/psp/SDL_pspgl.c
new file mode 100644
index 0000000..644fb34
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspgl.c
@@ -0,0 +1,210 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "SDL_error.h"
+#include "SDL_pspvideo.h"
+#include "SDL_pspgl_c.h"
+
+/*****************************************************************************/
+/* SDL OpenGL/OpenGL ES functions */
+/*****************************************************************************/
+#define EGLCHK(stmt) \
+ do { \
+ EGLint err; \
+ \
+ stmt; \
+ err = eglGetError(); \
+ if (err != EGL_SUCCESS) { \
+ SDL_SetError("EGL error %d", err); \
+ return 0; \
+ } \
+ } while (0)
+
+int
+PSP_GL_LoadLibrary(_THIS, const char *path)
+{
+ return 0;
+}
+
+/* pspgl doesn't provide this call, so stub it out since SDL requires it.
+#define GLSTUB(func,params) void func params {}
+
+GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
+ GLdouble zNear, GLdouble zFar))
+*/
+void *
+PSP_GL_GetProcAddress(_THIS, const char *proc)
+{
+ return eglGetProcAddress(proc);
+}
+
+void
+PSP_GL_UnloadLibrary(_THIS)
+{
+ eglTerminate(_this->gl_data->display);
+}
+
+static EGLint width = 480;
+static EGLint height = 272;
+
+SDL_GLContext
+PSP_GL_CreateContext(_THIS, SDL_Window * window)
+{
+
+ SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
+
+ EGLint attribs[32];
+ EGLDisplay display;
+ EGLContext context;
+ EGLSurface surface;
+ EGLConfig config;
+ EGLint num_configs;
+ int i;
+
+
+ /* EGL init taken from glutCreateWindow() in PSPGL's glut.c. */
+ EGLCHK(display = eglGetDisplay(0));
+ EGLCHK(eglInitialize(display, NULL, NULL));
+ wdata->uses_gles = SDL_TRUE;
+ window->flags |= SDL_WINDOW_FULLSCREEN;
+
+ /* Setup the config based on SDL's current values. */
+ i = 0;
+ attribs[i++] = EGL_RED_SIZE;
+ attribs[i++] = _this->gl_config.red_size;
+ attribs[i++] = EGL_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.green_size;
+ attribs[i++] = EGL_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.blue_size;
+ attribs[i++] = EGL_DEPTH_SIZE;
+ attribs[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.alpha_size)
+ {
+ attribs[i++] = EGL_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.alpha_size;
+ }
+ if (_this->gl_config.stencil_size)
+ {
+ attribs[i++] = EGL_STENCIL_SIZE;
+ attribs[i++] = _this->gl_config.stencil_size;
+ }
+
+ attribs[i++] = EGL_NONE;
+
+ EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
+
+ if (num_configs == 0)
+ {
+ SDL_SetError("No valid EGL configs for requested mode");
+ return 0;
+ }
+
+ EGLCHK(eglGetConfigAttrib(display, config, EGL_WIDTH, &width));
+ EGLCHK(eglGetConfigAttrib(display, config, EGL_HEIGHT, &height));
+
+ EGLCHK(context = eglCreateContext(display, config, NULL, NULL));
+ EGLCHK(surface = eglCreateWindowSurface(display, config, 0, NULL));
+ EGLCHK(eglMakeCurrent(display, surface, surface, context));
+
+ _this->gl_data->display = display;
+ _this->gl_data->context = context;
+ _this->gl_data->surface = surface;
+
+
+ return context;
+}
+
+int
+PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface,
+ _this->gl_data->surface, _this->gl_data->context))
+ {
+ return SDL_SetError("Unable to make EGL context current");
+ }
+ return 0;
+}
+
+int
+PSP_GL_SetSwapInterval(_THIS, int interval)
+{
+ EGLBoolean status;
+ status = eglSwapInterval(_this->gl_data->display, interval);
+ if (status == EGL_TRUE) {
+ /* Return success to upper level */
+ _this->gl_data->swapinterval = interval;
+ return 0;
+ }
+ /* Failed to set swap interval */
+ return SDL_SetError("Unable to set the EGL swap interval");
+}
+
+int
+PSP_GL_GetSwapInterval(_THIS)
+{
+ return _this->gl_data->swapinterval;
+}
+
+int
+PSP_GL_SwapWindow(_THIS, SDL_Window * window)
+{
+ if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) {
+ return SDL_SetError("eglSwapBuffers() failed");
+ }
+ return 0;
+}
+
+void
+PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ EGLBoolean status;
+
+ if (phdata->egl_initialized != SDL_TRUE) {
+ SDL_SetError("PSP: GLES initialization failed, no OpenGL ES support");
+ return;
+ }
+
+ /* Check if OpenGL ES connection has been initialized */
+ if (_this->gl_data->display != EGL_NO_DISPLAY) {
+ if (context != EGL_NO_CONTEXT) {
+ status = eglDestroyContext(_this->gl_data->display, context);
+ if (status != EGL_TRUE) {
+ /* Error during OpenGL ES context destroying */
+ SDL_SetError("PSP: OpenGL ES context destroy error");
+ return;
+ }
+ }
+ }
+
+ return;
+}
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspgl_c.h b/src/3rdparty/SDL2/src/video/psp/SDL_pspgl_c.h
new file mode 100644
index 0000000..49300fb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspgl_c.h
@@ -0,0 +1,54 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_pspgl_c_h_
+#define SDL_pspgl_c_h_
+
+
+#include <GLES/egl.h>
+#include <GLES/gl.h>
+
+#include "SDL_pspvideo.h"
+
+
+typedef struct SDL_GLDriverData {
+ EGLDisplay display;
+ EGLContext context;
+ EGLSurface surface;
+ uint32_t swapinterval;
+}SDL_GLDriverData;
+
+extern void * PSP_GL_GetProcAddress(_THIS, const char *proc);
+extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context);
+extern void PSP_GL_SwapBuffers(_THIS);
+
+extern int PSP_GL_SwapWindow(_THIS, SDL_Window * window);
+extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window);
+
+extern int PSP_GL_LoadLibrary(_THIS, const char *path);
+extern void PSP_GL_UnloadLibrary(_THIS);
+extern int PSP_GL_SetSwapInterval(_THIS, int interval);
+extern int PSP_GL_GetSwapInterval(_THIS);
+
+
+#endif /* SDL_pspgl_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspmouse.c b/src/3rdparty/SDL2/src/video/psp/SDL_pspmouse.c
new file mode 100644
index 0000000..bd34dfa
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspmouse.c
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+#include <stdio.h>
+
+#include "SDL_error.h"
+#include "SDL_mouse.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_pspmouse_c.h"
+
+
+/* The implementation dependent data for the window manager cursor */
+struct WMcursor {
+ int unused;
+};
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspmouse_c.h b/src/3rdparty/SDL2/src/video/psp/SDL_pspmouse_c.h
new file mode 100644
index 0000000..2d2640e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspmouse_c.h
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "SDL_pspvideo.h"
+
+/* Functions to be exported */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.c b/src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.c
new file mode 100644
index 0000000..8231779
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.c
@@ -0,0 +1,333 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+/* SDL internals */
+#include "../SDL_sysvideo.h"
+#include "SDL_version.h"
+#include "SDL_syswm.h"
+#include "SDL_loadso.h"
+#include "SDL_events.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+
+
+
+/* PSP declarations */
+#include "SDL_pspvideo.h"
+#include "SDL_pspevents_c.h"
+#include "SDL_pspgl_c.h"
+
+/* unused
+static SDL_bool PSP_initialized = SDL_FALSE;
+*/
+static int
+PSP_Available(void)
+{
+ return 1;
+}
+
+static void
+PSP_Destroy(SDL_VideoDevice * device)
+{
+/* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */
+
+ if (device->driverdata != NULL) {
+ device->driverdata = NULL;
+ }
+}
+
+static SDL_VideoDevice *
+PSP_Create()
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *phdata;
+ SDL_GLDriverData *gldata;
+ int status;
+
+ /* Check if PSP could be initialized */
+ status = PSP_Available();
+ if (status == 0) {
+ /* PSP could not be used */
+ return NULL;
+ }
+
+ /* Initialize SDL_VideoDevice structure */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize internal PSP specific data */
+ phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (phdata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+
+ gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
+ if (gldata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ SDL_free(phdata);
+ return NULL;
+ }
+ device->gl_data = gldata;
+
+ device->driverdata = phdata;
+
+ phdata->egl_initialized = SDL_TRUE;
+
+
+ /* Setup amount of available displays */
+ device->num_displays = 0;
+
+ /* Set device free function */
+ device->free = PSP_Destroy;
+
+ /* Setup all functions which we can handle */
+ device->VideoInit = PSP_VideoInit;
+ device->VideoQuit = PSP_VideoQuit;
+ device->GetDisplayModes = PSP_GetDisplayModes;
+ device->SetDisplayMode = PSP_SetDisplayMode;
+ device->CreateSDLWindow = PSP_CreateWindow;
+ device->CreateSDLWindowFrom = PSP_CreateWindowFrom;
+ device->SetWindowTitle = PSP_SetWindowTitle;
+ device->SetWindowIcon = PSP_SetWindowIcon;
+ device->SetWindowPosition = PSP_SetWindowPosition;
+ device->SetWindowSize = PSP_SetWindowSize;
+ device->ShowWindow = PSP_ShowWindow;
+ device->HideWindow = PSP_HideWindow;
+ device->RaiseWindow = PSP_RaiseWindow;
+ device->MaximizeWindow = PSP_MaximizeWindow;
+ device->MinimizeWindow = PSP_MinimizeWindow;
+ device->RestoreWindow = PSP_RestoreWindow;
+ device->SetWindowGrab = PSP_SetWindowGrab;
+ device->DestroyWindow = PSP_DestroyWindow;
+#if 0
+ device->GetWindowWMInfo = PSP_GetWindowWMInfo;
+#endif
+ device->GL_LoadLibrary = PSP_GL_LoadLibrary;
+ device->GL_GetProcAddress = PSP_GL_GetProcAddress;
+ device->GL_UnloadLibrary = PSP_GL_UnloadLibrary;
+ device->GL_CreateContext = PSP_GL_CreateContext;
+ device->GL_MakeCurrent = PSP_GL_MakeCurrent;
+ device->GL_SetSwapInterval = PSP_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
+ device->GL_SwapWindow = PSP_GL_SwapWindow;
+ device->GL_DeleteContext = PSP_GL_DeleteContext;
+ device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
+ device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
+ device->HideScreenKeyboard = PSP_HideScreenKeyboard;
+ device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
+
+ device->PumpEvents = PSP_PumpEvents;
+
+ return device;
+}
+
+VideoBootStrap PSP_bootstrap = {
+ "PSP",
+ "PSP Video Driver",
+ PSP_Available,
+ PSP_Create
+};
+
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions */
+/*****************************************************************************/
+int
+PSP_VideoInit(_THIS)
+{
+ SDL_VideoDisplay display;
+ SDL_DisplayMode current_mode;
+
+ SDL_zero(current_mode);
+
+ current_mode.w = 480;
+ current_mode.h = 272;
+
+ current_mode.refresh_rate = 60;
+ /* 32 bpp for default */
+ current_mode.format = SDL_PIXELFORMAT_ABGR8888;
+
+ current_mode.driverdata = NULL;
+
+ SDL_zero(display);
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+ display.driverdata = NULL;
+
+ SDL_AddVideoDisplay(&display);
+
+ return 1;
+}
+
+void
+PSP_VideoQuit(_THIS)
+{
+
+}
+
+void
+PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+
+}
+
+int
+PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+#define EGLCHK(stmt) \
+ do { \
+ EGLint err; \
+ \
+ stmt; \
+ err = eglGetError(); \
+ if (err != EGL_SUCCESS) { \
+ SDL_SetError("EGL error %d", err); \
+ return 0; \
+ } \
+ } while (0)
+
+int
+PSP_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wdata;
+
+ /* Allocate window internal data */
+ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (wdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Setup driver data for this window */
+ window->driverdata = wdata;
+
+
+ /* Window has been successfully created */
+ return 0;
+}
+
+int
+PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ return SDL_Unsupported();
+}
+
+void
+PSP_SetWindowTitle(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+}
+void
+PSP_SetWindowPosition(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_SetWindowSize(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_ShowWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_HideWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_RaiseWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_MaximizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_MinimizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_RestoreWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+
+}
+void
+PSP_DestroyWindow(_THIS, SDL_Window * window)
+{
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function */
+/*****************************************************************************/
+#if 0
+SDL_bool
+PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+
+ /* Failed to get window manager information */
+ return SDL_FALSE;
+}
+#endif
+
+
+/* TO Write Me */
+SDL_bool PSP_HasScreenKeyboardSupport(_THIS)
+{
+ return SDL_FALSE;
+}
+void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window)
+{
+}
+void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
+{
+}
+SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
+{
+ return SDL_FALSE;
+}
+
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.h b/src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.h
new file mode 100644
index 0000000..741bad1
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/psp/SDL_pspvideo.h
@@ -0,0 +1,102 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_pspvideo_h_
+#define SDL_pspvideo_h_
+
+#include <GLES/egl.h>
+
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+
+typedef struct SDL_VideoData
+{
+ SDL_bool egl_initialized; /* OpenGL ES device initialization status */
+ uint32_t egl_refcount; /* OpenGL ES reference count */
+
+
+
+} SDL_VideoData;
+
+
+typedef struct SDL_DisplayData
+{
+
+} SDL_DisplayData;
+
+
+typedef struct SDL_WindowData
+{
+ SDL_bool uses_gles; /* if true window must support OpenGL ES */
+
+} SDL_WindowData;
+
+
+
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration */
+/****************************************************************************/
+
+/* Display and window functions */
+int PSP_VideoInit(_THIS);
+void PSP_VideoQuit(_THIS);
+void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+int PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+int PSP_CreateWindow(_THIS, SDL_Window * window);
+int PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+void PSP_SetWindowTitle(_THIS, SDL_Window * window);
+void PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+void PSP_SetWindowPosition(_THIS, SDL_Window * window);
+void PSP_SetWindowSize(_THIS, SDL_Window * window);
+void PSP_ShowWindow(_THIS, SDL_Window * window);
+void PSP_HideWindow(_THIS, SDL_Window * window);
+void PSP_RaiseWindow(_THIS, SDL_Window * window);
+void PSP_MaximizeWindow(_THIS, SDL_Window * window);
+void PSP_MinimizeWindow(_THIS, SDL_Window * window);
+void PSP_RestoreWindow(_THIS, SDL_Window * window);
+void PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+void PSP_DestroyWindow(_THIS, SDL_Window * window);
+
+/* Window manager function */
+SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+/* OpenGL/OpenGL ES functions */
+int PSP_GL_LoadLibrary(_THIS, const char *path);
+void *PSP_GL_GetProcAddress(_THIS, const char *proc);
+void PSP_GL_UnloadLibrary(_THIS);
+SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window);
+int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+int PSP_GL_SetSwapInterval(_THIS, int interval);
+int PSP_GL_GetSwapInterval(_THIS);
+int PSP_GL_SwapWindow(_THIS, SDL_Window * window);
+void PSP_GL_DeleteContext(_THIS, SDL_GLContext context);
+
+/* PSP on screen keyboard */
+SDL_bool PSP_HasScreenKeyboardSupport(_THIS);
+void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window);
+void PSP_HideScreenKeyboard(_THIS, SDL_Window *window);
+SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window);
+
+#endif /* SDL_pspvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/qnx/gl.c b/src/3rdparty/SDL2/src/video/qnx/gl.c
new file mode 100644
index 0000000..19e1bd4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/qnx/gl.c
@@ -0,0 +1,285 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017 BlackBerry Limited
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#include "sdl_qnx.h"
+
+static EGLDisplay egl_disp;
+
+/**
+ * Detertmines the pixel format to use based on the current display and EGL
+ * configuration.
+ * @param egl_conf EGL configuration to use
+ * @return A SCREEN_FORMAT* constant for the pixel format to use
+ */
+static int
+chooseFormat(EGLConfig egl_conf)
+{
+ EGLint buffer_bit_depth;
+ EGLint alpha_bit_depth;
+
+ eglGetConfigAttrib(egl_disp, egl_conf, EGL_BUFFER_SIZE, &buffer_bit_depth);
+ eglGetConfigAttrib(egl_disp, egl_conf, EGL_ALPHA_SIZE, &alpha_bit_depth);
+
+ switch (buffer_bit_depth) {
+ case 32:
+ return SCREEN_FORMAT_RGBX8888;
+ case 24:
+ return SCREEN_FORMAT_RGB888;
+ case 16:
+ switch (alpha_bit_depth) {
+ case 4:
+ return SCREEN_FORMAT_RGBX4444;
+ case 1:
+ return SCREEN_FORMAT_RGBA5551;
+ default:
+ return SCREEN_FORMAT_RGB565;
+ }
+ default:
+ return 0;
+ }
+}
+
+/**
+ * Enumerates the supported EGL configurations and chooses a suitable one.
+ * @param[out] pconf The chosen configuration
+ * @param[out] pformat The chosen pixel format
+ * @return 0 if successful, -1 on error
+ */
+int
+glGetConfig(EGLConfig *pconf, int *pformat)
+{
+ EGLConfig egl_conf = (EGLConfig)0;
+ EGLConfig *egl_configs;
+ EGLint egl_num_configs;
+ EGLint val;
+ EGLBoolean rc;
+ EGLint i;
+
+ // Determine the numbfer of configurations.
+ rc = eglGetConfigs(egl_disp, NULL, 0, &egl_num_configs);
+ if (rc != EGL_TRUE) {
+ return -1;
+ }
+
+ if (egl_num_configs == 0) {
+ return -1;
+ }
+
+ // Allocate enough memory for all configurations.
+ egl_configs = malloc(egl_num_configs * sizeof(*egl_configs));
+ if (egl_configs == NULL) {
+ return -1;
+ }
+
+ // Get the list of configurations.
+ rc = eglGetConfigs(egl_disp, egl_configs, egl_num_configs,
+ &egl_num_configs);
+ if (rc != EGL_TRUE) {
+ free(egl_configs);
+ return -1;
+ }
+
+ // Find a good configuration.
+ for (i = 0; i < egl_num_configs; i++) {
+ eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_SURFACE_TYPE, &val);
+ if (!(val & EGL_WINDOW_BIT)) {
+ continue;
+ }
+
+ eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_RENDERABLE_TYPE, &val);
+ if (!(val & EGL_OPENGL_ES2_BIT)) {
+ continue;
+ }
+
+ eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_DEPTH_SIZE, &val);
+ if (val == 0) {
+ continue;
+ }
+
+ egl_conf = egl_configs[i];
+ break;
+ }
+
+ free(egl_configs);
+ *pconf = egl_conf;
+ *pformat = chooseFormat(egl_conf);
+
+ return 0;
+}
+
+/**
+ * Initializes the EGL library.
+ * @param _THIS
+ * @param name unused
+ * @return 0 if successful, -1 on error
+ */
+int
+glLoadLibrary(_THIS, const char *name)
+{
+ EGLNativeDisplayType disp_id = EGL_DEFAULT_DISPLAY;
+
+ egl_disp = eglGetDisplay(disp_id);
+ if (egl_disp == EGL_NO_DISPLAY) {
+ return -1;
+ }
+
+ if (eglInitialize(egl_disp, NULL, NULL) == EGL_FALSE) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Finds the address of an EGL extension function.
+ * @param proc Function name
+ * @return Function address
+ */
+void *
+glGetProcAddress(_THIS, const char *proc)
+{
+ return eglGetProcAddress(proc);
+}
+
+/**
+ * Associates the given window with the necessary EGL structures for drawing and
+ * displaying content.
+ * @param _THIS
+ * @param window The SDL window to create the context for
+ * @return A pointer to the created context, if successful, NULL on error
+ */
+SDL_GLContext
+glCreateContext(_THIS, SDL_Window *window)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ EGLContext context;
+ EGLSurface surface;
+
+ struct {
+ EGLint client_version[2];
+ EGLint none;
+ } egl_ctx_attr = {
+ .client_version = { EGL_CONTEXT_CLIENT_VERSION, 2 },
+ .none = EGL_NONE
+ };
+
+ struct {
+ EGLint render_buffer[2];
+ EGLint none;
+ } egl_surf_attr = {
+ .render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER },
+ .none = EGL_NONE
+ };
+
+ context = eglCreateContext(egl_disp, impl->conf, EGL_NO_CONTEXT,
+ (EGLint *)&egl_ctx_attr);
+ if (context == EGL_NO_CONTEXT) {
+ return NULL;
+ }
+
+ surface = eglCreateWindowSurface(egl_disp, impl->conf, impl->window,
+ (EGLint *)&egl_surf_attr);
+ if (surface == EGL_NO_SURFACE) {
+ return NULL;
+ }
+
+ eglMakeCurrent(egl_disp, surface, surface, context);
+
+ impl->surface = surface;
+ return context;
+}
+
+/**
+ * Sets a new value for the number of frames to display before swapping buffers.
+ * @param _THIS
+ * @param interval New interval value
+ * @return 0 if successful, -1 on error
+ */
+int
+glSetSwapInterval(_THIS, int interval)
+{
+ if (eglSwapInterval(egl_disp, interval) != EGL_TRUE) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Swaps the EGL buffers associated with the given window
+ * @param _THIS
+ * @param window Window to swap buffers for
+ * @return 0 if successful, -1 on error
+ */
+int
+glSwapWindow(_THIS, SDL_Window *window)
+{
+ /* !!! FIXME: should we migrate this all over to use SDL_egl.c? */
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1;
+}
+
+/**
+ * Makes the given context the current one for drawing operations.
+ * @param _THIS
+ * @param window SDL window associated with the context (maybe NULL)
+ * @param context The context to activate
+ * @return 0 if successful, -1 on error
+ */
+int
+glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+{
+ window_impl_t *impl;
+ EGLSurface surface = NULL;
+
+ if (window) {
+ impl = (window_impl_t *)window->driverdata;
+ surface = impl->surface;
+ }
+
+ if (eglMakeCurrent(egl_disp, surface, surface, context) != EGL_TRUE) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Destroys a context.
+ * @param _THIS
+ * @param context The context to destroy
+ */
+void
+glDeleteContext(_THIS, SDL_GLContext context)
+{
+ eglDestroyContext(egl_disp, context);
+}
+
+/**
+ * Terminates access to the EGL library.
+ * @param _THIS
+ */
+void
+glUnloadLibrary(_THIS)
+{
+ eglTerminate(egl_disp);
+}
diff --git a/src/3rdparty/SDL2/src/video/qnx/keyboard.c b/src/3rdparty/SDL2/src/video/qnx/keyboard.c
new file mode 100644
index 0000000..86c6395
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/qnx/keyboard.c
@@ -0,0 +1,133 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017 BlackBerry Limited
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_scancode.h"
+#include "SDL_events.h"
+#include "sdl_qnx.h"
+#include <sys/keycodes.h>
+
+/**
+ * A map thta translates Screen key names to SDL scan codes.
+ * This map is incomplete, but should include most major keys.
+ */
+static int key_to_sdl[] = {
+ [KEYCODE_SPACE] = SDL_SCANCODE_SPACE,
+ [KEYCODE_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE,
+ [KEYCODE_COMMA] = SDL_SCANCODE_COMMA,
+ [KEYCODE_MINUS] = SDL_SCANCODE_MINUS,
+ [KEYCODE_PERIOD] = SDL_SCANCODE_PERIOD,
+ [KEYCODE_SLASH] = SDL_SCANCODE_SLASH,
+ [KEYCODE_ZERO] = SDL_SCANCODE_0,
+ [KEYCODE_ONE] = SDL_SCANCODE_1,
+ [KEYCODE_TWO] = SDL_SCANCODE_2,
+ [KEYCODE_THREE] = SDL_SCANCODE_3,
+ [KEYCODE_FOUR] = SDL_SCANCODE_4,
+ [KEYCODE_FIVE] = SDL_SCANCODE_5,
+ [KEYCODE_SIX] = SDL_SCANCODE_6,
+ [KEYCODE_SEVEN] = SDL_SCANCODE_7,
+ [KEYCODE_EIGHT] = SDL_SCANCODE_8,
+ [KEYCODE_NINE] = SDL_SCANCODE_9,
+ [KEYCODE_SEMICOLON] = SDL_SCANCODE_SEMICOLON,
+ [KEYCODE_EQUAL] = SDL_SCANCODE_EQUALS,
+ [KEYCODE_LEFT_BRACKET] = SDL_SCANCODE_LEFTBRACKET,
+ [KEYCODE_BACK_SLASH] = SDL_SCANCODE_BACKSLASH,
+ [KEYCODE_RIGHT_BRACKET] = SDL_SCANCODE_RIGHTBRACKET,
+ [KEYCODE_GRAVE] = SDL_SCANCODE_GRAVE,
+ [KEYCODE_A] = SDL_SCANCODE_A,
+ [KEYCODE_B] = SDL_SCANCODE_B,
+ [KEYCODE_C] = SDL_SCANCODE_C,
+ [KEYCODE_D] = SDL_SCANCODE_D,
+ [KEYCODE_E] = SDL_SCANCODE_E,
+ [KEYCODE_F] = SDL_SCANCODE_F,
+ [KEYCODE_G] = SDL_SCANCODE_G,
+ [KEYCODE_H] = SDL_SCANCODE_H,
+ [KEYCODE_I] = SDL_SCANCODE_I,
+ [KEYCODE_J] = SDL_SCANCODE_J,
+ [KEYCODE_K] = SDL_SCANCODE_K,
+ [KEYCODE_L] = SDL_SCANCODE_L,
+ [KEYCODE_M] = SDL_SCANCODE_M,
+ [KEYCODE_N] = SDL_SCANCODE_N,
+ [KEYCODE_O] = SDL_SCANCODE_O,
+ [KEYCODE_P] = SDL_SCANCODE_P,
+ [KEYCODE_Q] = SDL_SCANCODE_Q,
+ [KEYCODE_R] = SDL_SCANCODE_R,
+ [KEYCODE_S] = SDL_SCANCODE_S,
+ [KEYCODE_T] = SDL_SCANCODE_T,
+ [KEYCODE_U] = SDL_SCANCODE_U,
+ [KEYCODE_V] = SDL_SCANCODE_V,
+ [KEYCODE_W] = SDL_SCANCODE_W,
+ [KEYCODE_X] = SDL_SCANCODE_X,
+ [KEYCODE_Y] = SDL_SCANCODE_Y,
+ [KEYCODE_Z] = SDL_SCANCODE_Z,
+ [KEYCODE_UP] = SDL_SCANCODE_UP,
+ [KEYCODE_DOWN] = SDL_SCANCODE_DOWN,
+ [KEYCODE_LEFT] = SDL_SCANCODE_LEFT,
+ [KEYCODE_PG_UP] = SDL_SCANCODE_PAGEUP,
+ [KEYCODE_PG_DOWN] = SDL_SCANCODE_PAGEDOWN,
+ [KEYCODE_RIGHT] = SDL_SCANCODE_RIGHT,
+ [KEYCODE_RETURN] = SDL_SCANCODE_RETURN,
+ [KEYCODE_TAB] = SDL_SCANCODE_TAB,
+ [KEYCODE_ESCAPE] = SDL_SCANCODE_ESCAPE,
+};
+
+/**
+ * Called from the event dispatcher when a keyboard event is encountered.
+ * Translates the event such that it can be handled by SDL.
+ * @param event Screen keyboard event
+ */
+void
+handleKeyboardEvent(screen_event_t event)
+{
+ int val;
+ SDL_Scancode scancode;
+
+ // Get the key value.
+ if (screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &val) < 0) {
+ return;
+ }
+
+ // Skip unrecognized keys.
+ if ((val < 0) || (val >= SDL_TABLESIZE(key_to_sdl))) {
+ return;
+ }
+
+ // Translate to an SDL scan code.
+ scancode = key_to_sdl[val];
+ if (scancode == 0) {
+ return;
+ }
+
+ // Get event flags (key state).
+ if (screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &val) < 0) {
+ return;
+ }
+
+ // Propagate the event to SDL.
+ // FIXME:
+ // Need to handle more key states (such as key combinations).
+ if (val & KEY_DOWN) {
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+ } else {
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+}
diff --git a/src/3rdparty/SDL2/src/video/qnx/sdl_qnx.h b/src/3rdparty/SDL2/src/video/qnx/sdl_qnx.h
new file mode 100644
index 0000000..65e0798
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/qnx/sdl_qnx.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017 BlackBerry Limited
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef __SDL_QNX_H__
+#define __SDL_QNX_H__
+
+#include "../SDL_sysvideo.h"
+#include <screen/screen.h>
+#include <EGL/egl.h>
+
+typedef struct
+{
+ screen_window_t window;
+ EGLSurface surface;
+ EGLConfig conf;
+} window_impl_t;
+
+extern void handleKeyboardEvent(screen_event_t event);
+
+extern int glGetConfig(EGLConfig *pconf, int *pformat);
+extern int glLoadLibrary(_THIS, const char *name);
+void *glGetProcAddress(_THIS, const char *proc);
+extern SDL_GLContext glCreateContext(_THIS, SDL_Window *window);
+extern int glSetSwapInterval(_THIS, int interval);
+extern int glSwapWindow(_THIS, SDL_Window *window);
+extern int glMakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern void glDeleteContext(_THIS, SDL_GLContext context);
+extern void glUnloadLibrary(_THIS);
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/qnx/video.c b/src/3rdparty/SDL2/src/video/qnx/video.c
new file mode 100644
index 0000000..ff8223c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/qnx/video.c
@@ -0,0 +1,364 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017 BlackBerry Limited
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+#include "sdl_qnx.h"
+
+static screen_context_t context;
+static screen_event_t event;
+
+/**
+ * Initializes the QNX video plugin.
+ * Creates the Screen context and event handles used for all window operations
+ * by the plugin.
+ * @param _THIS
+ * @return 0 if successful, -1 on error
+ */
+static int
+videoInit(_THIS)
+{
+ SDL_VideoDisplay display;
+
+ if (screen_create_context(&context, 0) < 0) {
+ return -1;
+ }
+
+ if (screen_create_event(&event) < 0) {
+ return -1;
+ }
+
+ SDL_zero(display);
+
+ if (SDL_AddVideoDisplay(&display) < 0) {
+ return -1;
+ }
+
+ _this->num_displays = 1;
+ return 0;
+}
+
+static void
+videoQuit(_THIS)
+{
+}
+
+/**
+ * Creates a new native Screen window and associates it with the given SDL
+ * window.
+ * @param _THIS
+ * @param window SDL window to initialize
+ * @return 0 if successful, -1 on error
+ */
+static int
+createWindow(_THIS, SDL_Window *window)
+{
+ window_impl_t *impl;
+ int size[2];
+ int numbufs;
+ int format;
+ int usage;
+
+ impl = SDL_calloc(1, sizeof(*impl));
+ if (impl == NULL) {
+ return -1;
+ }
+
+ // Create a native window.
+ if (screen_create_window(&impl->window, context) < 0) {
+ goto fail;
+ }
+
+ // Set the native window's size to match the SDL window.
+ size[0] = window->w;
+ size[1] = window->h;
+
+ if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE,
+ size) < 0) {
+ goto fail;
+ }
+
+ if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE,
+ size) < 0) {
+ goto fail;
+ }
+
+ // Create window buffer(s).
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ if (glGetConfig(&impl->conf, &format) < 0) {
+ goto fail;
+ }
+ numbufs = 2;
+
+ usage = SCREEN_USAGE_OPENGL_ES2;
+ if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_USAGE,
+ &usage) < 0) {
+ return -1;
+ }
+ } else {
+ format = SCREEN_FORMAT_RGBX8888;
+ numbufs = 1;
+ }
+
+ // Set pixel format.
+ if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_FORMAT,
+ &format) < 0) {
+ goto fail;
+ }
+
+ // Create buffer(s).
+ if (screen_create_window_buffers(impl->window, numbufs) < 0) {
+ goto fail;
+ }
+
+ window->driverdata = impl;
+ return 0;
+
+fail:
+ if (impl->window) {
+ screen_destroy_window(impl->window);
+ }
+
+ SDL_free(impl);
+ return -1;
+}
+
+/**
+ * Gets a pointer to the Screen buffer associated with the given window. Note
+ * that the buffer is actually created in createWindow().
+ * @param _THIS
+ * @param window SDL window to get the buffer for
+ * @param[out] pixles Holds a pointer to the window's buffer
+ * @param[out] format Holds the pixel format for the buffer
+ * @param[out] pitch Holds the number of bytes per line
+ * @return 0 if successful, -1 on error
+ */
+static int
+createWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
+ void ** pixels, int *pitch)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ screen_buffer_t buffer;
+
+ // Get a pointer to the buffer's memory.
+ if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS,
+ (void **)&buffer) < 0) {
+ return -1;
+ }
+
+ if (screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER,
+ pixels) < 0) {
+ return -1;
+ }
+
+ // Set format and pitch.
+ if (screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE,
+ pitch) < 0) {
+ return -1;
+ }
+
+ *format = SDL_PIXELFORMAT_RGB888;
+ return 0;
+}
+
+/**
+ * Informs the window manager that the window needs to be updated.
+ * @param _THIS
+ * @param window The window to update
+ * @param rects An array of reectangular areas to update
+ * @param numrects Rect array length
+ * @return 0 if successful, -1 on error
+ */
+static int
+updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects,
+ int numrects)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ screen_buffer_t buffer;
+
+ if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS,
+ (void **)&buffer) < 0) {
+ return -1;
+ }
+
+ screen_post_window(impl->window, buffer, numrects, (int *)rects, 0);
+ screen_flush_context(context, 0);
+ return 0;
+}
+
+/**
+ * Runs the main event loop.
+ * @param _THIS
+ */
+static void
+pumpEvents(_THIS)
+{
+ int type;
+
+ for (;;) {
+ if (screen_get_event(context, event, 0) < 0) {
+ break;
+ }
+
+ if (screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type)
+ < 0) {
+ break;
+ }
+
+ if (type == SCREEN_EVENT_NONE) {
+ break;
+ }
+
+ switch (type) {
+ case SCREEN_EVENT_KEYBOARD:
+ handleKeyboardEvent(event);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/**
+ * Updates the size of the native window using the geometry of the SDL window.
+ * @param _THIS
+ * @param window SDL window to update
+ */
+static void
+setWindowSize(_THIS, SDL_Window *window)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ int size[2];
+
+ size[0] = window->w;
+ size[1] = window->h;
+
+ screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, size);
+ screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE,
+ size);
+}
+
+/**
+ * Makes the native window associated with the given SDL window visible.
+ * @param _THIS
+ * @param window SDL window to update
+ */
+static void
+showWindow(_THIS, SDL_Window *window)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ const int visible = 1;
+
+ screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
+ &visible);
+}
+
+/**
+ * Makes the native window associated with the given SDL window invisible.
+ * @param _THIS
+ * @param window SDL window to update
+ */
+static void
+hideWindow(_THIS, SDL_Window *window)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+ const int visible = 0;
+
+ screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
+ &visible);
+}
+
+/**
+ * Destroys the native window associated with the given SDL window.
+ * @param _THIS
+ * @param window SDL window that is being destroyed
+ */
+static void
+destroyWindow(_THIS, SDL_Window *window)
+{
+ window_impl_t *impl = (window_impl_t *)window->driverdata;
+
+ if (impl) {
+ screen_destroy_window(impl->window);
+ window->driverdata = NULL;
+ }
+}
+
+/**
+ * Frees the plugin object created by createDevice().
+ * @param device Plugin object to free
+ */
+static void
+deleteDevice(SDL_VideoDevice *device)
+{
+ SDL_free(device);
+}
+
+/**
+ * Creates the QNX video plugin used by SDL.
+ * @param devindex Unused
+ * @return Initialized device if successful, NULL otherwise
+ */
+static SDL_VideoDevice *
+createDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ return NULL;
+ }
+
+ device->driverdata = NULL;
+ device->VideoInit = videoInit;
+ device->VideoQuit = videoQuit;
+ device->CreateSDLWindow = createWindow;
+ device->CreateWindowFramebuffer = createWindowFramebuffer;
+ device->UpdateWindowFramebuffer = updateWindowFramebuffer;
+ device->SetWindowSize = setWindowSize;
+ device->ShowWindow = showWindow;
+ device->HideWindow = hideWindow;
+ device->PumpEvents = pumpEvents;
+ device->DestroyWindow = destroyWindow;
+
+ device->GL_LoadLibrary = glLoadLibrary;
+ device->GL_GetProcAddress = glGetProcAddress;
+ device->GL_CreateContext = glCreateContext;
+ device->GL_SetSwapInterval = glSetSwapInterval;
+ device->GL_SwapWindow = glSwapWindow;
+ device->GL_MakeCurrent = glMakeCurrent;
+ device->GL_DeleteContext = glDeleteContext;
+ device->GL_UnloadLibrary = glUnloadLibrary;
+
+ device->free = deleteDevice;
+ return device;
+}
+
+static int
+available()
+{
+ return 1;
+}
+
+VideoBootStrap QNX_bootstrap = {
+ "qnx", "QNX Screen",
+ available, createDevice
+};
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents.c b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents.c
new file mode 100644
index 0000000..4064355
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents.c
@@ -0,0 +1,45 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_RPI
+
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_rpivideo.h"
+#include "SDL_rpievents_c.h"
+
+#ifdef SDL_INPUT_LINUXEV
+#include "../../core/linux/SDL_evdev.h"
+#endif
+
+void RPI_PumpEvents(_THIS)
+{
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Poll();
+#endif
+
+}
+
+#endif /* SDL_VIDEO_DRIVER_RPI */
+
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents_c.h b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents_c.h
new file mode 100644
index 0000000..8b1737f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpievents_c.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_rpievents_c_h_
+#define SDL_rpievents_c_h_
+
+#include "SDL_rpivideo.h"
+
+void RPI_PumpEvents(_THIS);
+void RPI_EventInit(_THIS);
+void RPI_EventQuit(_THIS);
+
+#endif /* SDL_rpievents_c_h_ */
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.c b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.c
new file mode 100644
index 0000000..4ea976b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.c
@@ -0,0 +1,386 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_RPI
+
+#include "SDL_assert.h"
+#include "SDL_surface.h"
+#include "SDL_hints.h"
+
+#include "SDL_rpivideo.h"
+#include "SDL_rpimouse.h"
+
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/default_cursor.h"
+
+/* Copied from vc_vchi_dispmanx.h which is bugged and tries to include a non existing file */
+/* Attributes changes flag mask */
+#define ELEMENT_CHANGE_LAYER (1<<0)
+#define ELEMENT_CHANGE_OPACITY (1<<1)
+#define ELEMENT_CHANGE_DEST_RECT (1<<2)
+#define ELEMENT_CHANGE_SRC_RECT (1<<3)
+#define ELEMENT_CHANGE_MASK_RESOURCE (1<<4)
+#define ELEMENT_CHANGE_TRANSFORM (1<<5)
+/* End copied from vc_vchi_dispmanx.h */
+
+static SDL_Cursor *RPI_CreateDefaultCursor(void);
+static SDL_Cursor *RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y);
+static int RPI_ShowCursor(SDL_Cursor * cursor);
+static void RPI_MoveCursor(SDL_Cursor * cursor);
+static void RPI_FreeCursor(SDL_Cursor * cursor);
+static void RPI_WarpMouse(SDL_Window * window, int x, int y);
+static int RPI_WarpMouseGlobal(int x, int y);
+
+static SDL_Cursor *
+RPI_CreateDefaultCursor(void)
+{
+ return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY);
+}
+
+/* Create a cursor from a surface */
+static SDL_Cursor *
+RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ RPI_CursorData *curdata;
+ SDL_Cursor *cursor;
+ int ret;
+ VC_RECT_T dst_rect;
+ Uint32 dummy;
+
+ SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+ SDL_assert(surface->pitch == surface->w * 4);
+
+ cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
+ if (cursor == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ curdata = (RPI_CursorData *) SDL_calloc(1, sizeof(*curdata));
+ if (curdata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(cursor);
+ return NULL;
+ }
+
+ curdata->hot_x = hot_x;
+ curdata->hot_y = hot_y;
+ curdata->w = surface->w;
+ curdata->h = surface->h;
+
+ /* This usage is inspired by Wayland/Weston RPI code, how they figured this out is anyone's guess */
+ curdata->resource = vc_dispmanx_resource_create(VC_IMAGE_ARGB8888, surface->w | (surface->pitch << 16), surface->h | (surface->h << 16), &dummy);
+ SDL_assert(curdata->resource);
+ vc_dispmanx_rect_set(&dst_rect, 0, 0, curdata->w, curdata->h);
+ /* A note from Weston:
+ * vc_dispmanx_resource_write_data() ignores ifmt,
+ * rect.x, rect.width, and uses stride only for computing
+ * the size of the transfer as rect.height * stride.
+ * Therefore we can only write rows starting at x=0.
+ */
+ ret = vc_dispmanx_resource_write_data(curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect);
+ SDL_assert (ret == DISPMANX_SUCCESS);
+
+ cursor->driverdata = curdata;
+
+ return cursor;
+
+}
+
+/* Show the specified cursor, or hide if cursor is NULL */
+static int
+RPI_ShowCursor(SDL_Cursor * cursor)
+{
+ int ret;
+ DISPMANX_UPDATE_HANDLE_T update;
+ RPI_CursorData *curdata;
+ VC_RECT_T src_rect, dst_rect;
+ SDL_Mouse *mouse;
+ SDL_VideoDisplay *display;
+ SDL_DisplayData *data;
+ VC_DISPMANX_ALPHA_T alpha = { DISPMANX_FLAGS_ALPHA_FROM_SOURCE /* flags */ , 255 /*opacity 0->255*/, 0 /* mask */ };
+ uint32_t layer = SDL_RPI_MOUSELAYER;
+ const char *env;
+
+ mouse = SDL_GetMouse();
+ if (mouse == NULL) {
+ return -1;
+ }
+
+ if (cursor == NULL) {
+ /* FIXME: We hide the current mouse's cursor, what we actually need is *_HideCursor */
+
+ if (mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
+ curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
+ if (curdata->element > DISPMANX_NO_HANDLE) {
+ update = vc_dispmanx_update_start(10);
+ SDL_assert(update);
+ ret = vc_dispmanx_element_remove(update, curdata->element);
+ SDL_assert(ret == DISPMANX_SUCCESS);
+ ret = vc_dispmanx_update_submit_sync(update);
+ SDL_assert(ret == DISPMANX_SUCCESS);
+ curdata->element = DISPMANX_NO_HANDLE;
+ }
+ }
+ return 0;
+ }
+
+ curdata = (RPI_CursorData *) cursor->driverdata;
+ if (curdata == NULL) {
+ return -1;
+ }
+
+ if (mouse->focus == NULL) {
+ return -1;
+ }
+
+ display = SDL_GetDisplayForWindow(mouse->focus);
+ if (display == NULL) {
+ return -1;
+ }
+
+ data = (SDL_DisplayData*) display->driverdata;
+ if (data == NULL) {
+ return -1;
+ }
+
+ if (curdata->element == DISPMANX_NO_HANDLE) {
+ vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
+ vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);
+
+ update = vc_dispmanx_update_start(10);
+ SDL_assert(update);
+
+ env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
+ if (env) {
+ layer = SDL_atoi(env) + 1;
+ }
+
+ curdata->element = vc_dispmanx_element_add(update,
+ data->dispman_display,
+ layer,
+ &dst_rect,
+ curdata->resource,
+ &src_rect,
+ DISPMANX_PROTECTION_NONE,
+ &alpha,
+ DISPMANX_NO_HANDLE, // clamp
+ VC_IMAGE_ROT0);
+ SDL_assert(curdata->element > DISPMANX_NO_HANDLE);
+ ret = vc_dispmanx_update_submit_sync(update);
+ SDL_assert(ret == DISPMANX_SUCCESS);
+ }
+
+ return 0;
+}
+
+/* Free a window manager cursor */
+static void
+RPI_FreeCursor(SDL_Cursor * cursor)
+{
+ int ret;
+ DISPMANX_UPDATE_HANDLE_T update;
+ RPI_CursorData *curdata;
+
+ if (cursor != NULL) {
+ curdata = (RPI_CursorData *) cursor->driverdata;
+
+ if (curdata != NULL) {
+ if (curdata->element != DISPMANX_NO_HANDLE) {
+ update = vc_dispmanx_update_start(10);
+ SDL_assert(update);
+ ret = vc_dispmanx_element_remove(update, curdata->element);
+ SDL_assert(ret == DISPMANX_SUCCESS);
+ ret = vc_dispmanx_update_submit_sync(update);
+ SDL_assert(ret == DISPMANX_SUCCESS);
+ }
+
+ if (curdata->resource != DISPMANX_NO_HANDLE) {
+ ret = vc_dispmanx_resource_delete(curdata->resource);
+ SDL_assert(ret == DISPMANX_SUCCESS);
+ }
+
+ SDL_free(cursor->driverdata);
+ }
+ SDL_free(cursor);
+ }
+}
+
+/* Warp the mouse to (x,y) */
+static void
+RPI_WarpMouse(SDL_Window * window, int x, int y)
+{
+ RPI_WarpMouseGlobal(x, y);
+}
+
+/* Warp the mouse to (x,y) */
+static int
+RPI_WarpMouseGlobal(int x, int y)
+{
+ RPI_CursorData *curdata;
+ DISPMANX_UPDATE_HANDLE_T update;
+ int ret;
+ VC_RECT_T dst_rect;
+ VC_RECT_T src_rect;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
+ return 0;
+ }
+
+ /* Update internal mouse position. */
+ SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
+
+ curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
+ if (curdata->element == DISPMANX_NO_HANDLE) {
+ return 0;
+ }
+
+ update = vc_dispmanx_update_start(10);
+ if (!update) {
+ return 0;
+ }
+
+ src_rect.x = 0;
+ src_rect.y = 0;
+ src_rect.width = curdata->w << 16;
+ src_rect.height = curdata->h << 16;
+ dst_rect.x = x;
+ dst_rect.y = y;
+ dst_rect.width = curdata->w;
+ dst_rect.height = curdata->h;
+
+ ret = vc_dispmanx_element_change_attributes(
+ update,
+ curdata->element,
+ 0,
+ 0,
+ 0,
+ &dst_rect,
+ &src_rect,
+ DISPMANX_NO_HANDLE,
+ DISPMANX_NO_ROTATE);
+ if (ret != DISPMANX_SUCCESS) {
+ return SDL_SetError("vc_dispmanx_element_change_attributes() failed");
+ }
+
+ /* Submit asynchronously, otherwise the peformance suffers a lot */
+ ret = vc_dispmanx_update_submit(update, 0, NULL);
+ if (ret != DISPMANX_SUCCESS) {
+ return SDL_SetError("vc_dispmanx_update_submit() failed");
+ }
+ return 0;
+}
+
+/* Warp the mouse to (x,y) */
+static int
+RPI_WarpMouseGlobalGraphicOnly(int x, int y)
+{
+ RPI_CursorData *curdata;
+ DISPMANX_UPDATE_HANDLE_T update;
+ int ret;
+ VC_RECT_T dst_rect;
+ VC_RECT_T src_rect;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
+ return 0;
+ }
+
+ curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
+ if (curdata->element == DISPMANX_NO_HANDLE) {
+ return 0;
+ }
+
+ update = vc_dispmanx_update_start(10);
+ if (!update) {
+ return 0;
+ }
+
+ src_rect.x = 0;
+ src_rect.y = 0;
+ src_rect.width = curdata->w << 16;
+ src_rect.height = curdata->h << 16;
+ dst_rect.x = x;
+ dst_rect.y = y;
+ dst_rect.width = curdata->w;
+ dst_rect.height = curdata->h;
+
+ ret = vc_dispmanx_element_change_attributes(
+ update,
+ curdata->element,
+ 0,
+ 0,
+ 0,
+ &dst_rect,
+ &src_rect,
+ DISPMANX_NO_HANDLE,
+ DISPMANX_NO_ROTATE);
+ if (ret != DISPMANX_SUCCESS) {
+ return SDL_SetError("vc_dispmanx_element_change_attributes() failed");
+ }
+
+ /* Submit asynchronously, otherwise the peformance suffers a lot */
+ ret = vc_dispmanx_update_submit(update, 0, NULL);
+ if (ret != DISPMANX_SUCCESS) {
+ return SDL_SetError("vc_dispmanx_update_submit() failed");
+ }
+ return 0;
+}
+
+void
+RPI_InitMouse(_THIS)
+{
+ /* FIXME: Using UDEV it should be possible to scan all mice
+ * but there's no point in doing so as there's no multimice support...yet!
+ */
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = RPI_CreateCursor;
+ mouse->ShowCursor = RPI_ShowCursor;
+ mouse->MoveCursor = RPI_MoveCursor;
+ mouse->FreeCursor = RPI_FreeCursor;
+ mouse->WarpMouse = RPI_WarpMouse;
+ mouse->WarpMouseGlobal = RPI_WarpMouseGlobal;
+
+ SDL_SetDefaultCursor(RPI_CreateDefaultCursor());
+}
+
+void
+RPI_QuitMouse(_THIS)
+{
+
+}
+
+/* This is called when a mouse motion event occurs */
+static void
+RPI_MoveCursor(SDL_Cursor * cursor)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ /* We must NOT call SDL_SendMouseMotion() on the next call or we will enter recursivity,
+ * so we create a version of WarpMouseGlobal without it. */
+ RPI_WarpMouseGlobalGraphicOnly(mouse->x, mouse->y);
+}
+
+#endif /* SDL_VIDEO_DRIVER_RPI */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.h b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.h
new file mode 100644
index 0000000..919f811
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpimouse.h
@@ -0,0 +1,43 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_RPI_mouse_h_
+#define SDL_RPI_mouse_h_
+
+#include "../SDL_sysvideo.h"
+
+typedef struct _RPI_CursorData RPI_CursorData;
+struct _RPI_CursorData
+{
+ DISPMANX_RESOURCE_HANDLE_T resource;
+ DISPMANX_ELEMENT_HANDLE_T element;
+ int hot_x, hot_y;
+ int w, h;
+};
+
+#define SDL_RPI_CURSORDATA(curs) RPI_CursorData *curdata = (RPI_CursorData *) ((curs) ? (curs)->driverdata : NULL)
+
+extern void RPI_InitMouse(_THIS);
+extern void RPI_QuitMouse(_THIS);
+
+#endif /* SDL_RPI_mouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.c b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.c
new file mode 100644
index 0000000..b763007
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.c
@@ -0,0 +1,71 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+#include "SDL_hints.h"
+#include "SDL_log.h"
+
+#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_rpivideo.h"
+#include "SDL_rpiopengles.h"
+
+/* EGL implementation of SDL OpenGL support */
+
+void
+RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor)
+{
+ *mask = SDL_GL_CONTEXT_PROFILE_ES;
+ *major = 2;
+ *minor = 0;
+}
+
+int
+RPI_GLES_LoadLibrary(_THIS, const char *path) {
+ return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0);
+}
+
+int
+RPI_GLES_SwapWindow(_THIS, SDL_Window * window) {
+ SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata);
+
+ if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed.");
+ return 0;
+ }
+
+ /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios.
+ * Run your SDL2 program with "SDL_RPI_DOUBLE_BUFFER=1 <program_name>" to enable this. */
+ if (wdata->double_buffer) {
+ SDL_LockMutex(wdata->vsync_cond_mutex);
+ SDL_CondWait(wdata->vsync_cond, wdata->vsync_cond_mutex);
+ SDL_UnlockMutex(wdata->vsync_cond_mutex);
+ }
+
+ return 0;
+}
+
+SDL_EGL_CreateContext_impl(RPI)
+SDL_EGL_MakeCurrent_impl(RPI)
+
+#endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.h b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.h
new file mode 100644
index 0000000..9724a5f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpiopengles.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_rpiopengles_h_
+#define SDL_rpiopengles_h_
+
+#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define RPI_GLES_GetAttribute SDL_EGL_GetAttribute
+#define RPI_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define RPI_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define RPI_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define RPI_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define RPI_GLES_DeleteContext SDL_EGL_DeleteContext
+
+extern int RPI_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int RPI_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern void RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor);
+
+#endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_rpiopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.c b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.c
new file mode 100644
index 0000000..e386380
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.c
@@ -0,0 +1,442 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_RPI
+
+/* References
+ * http://elinux.org/RPi_VideoCore_APIs
+ * https://github.com/raspberrypi/firmware/blob/master/opt/vc/src/hello_pi/hello_triangle/triangle.c
+ * http://cgit.freedesktop.org/wayland/weston/tree/src/rpi-renderer.c
+ * http://cgit.freedesktop.org/wayland/weston/tree/src/compositor-rpi.c
+ */
+
+/* SDL internals */
+#include "../SDL_sysvideo.h"
+#include "SDL_version.h"
+#include "SDL_syswm.h"
+#include "SDL_loadso.h"
+#include "SDL_events.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_hints.h"
+
+#ifdef SDL_INPUT_LINUXEV
+#include "../../core/linux/SDL_evdev.h"
+#endif
+
+/* RPI declarations */
+#include "SDL_rpivideo.h"
+#include "SDL_rpievents_c.h"
+#include "SDL_rpiopengles.h"
+#include "SDL_rpimouse.h"
+
+static int
+RPI_Available(void)
+{
+ return 1;
+}
+
+static void
+RPI_Destroy(SDL_VideoDevice * device)
+{
+ SDL_free(device->driverdata);
+ SDL_free(device);
+}
+
+static int
+RPI_GetRefreshRate()
+{
+ TV_DISPLAY_STATE_T tvstate;
+ if (vc_tv_get_display_state( &tvstate ) == 0) {
+ //The width/height parameters are in the same position in the union
+ //for HDMI and SDTV
+ HDMI_PROPERTY_PARAM_T property;
+ property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE;
+ vc_tv_hdmi_get_property(&property);
+ return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ?
+ tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) :
+ tvstate.display.hdmi.frame_rate;
+ }
+ return 60; /* Failed to get display state, default to 60 */
+}
+
+static SDL_VideoDevice *
+RPI_Create()
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *phdata;
+
+ /* Initialize SDL_VideoDevice structure */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize internal data */
+ phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (phdata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+
+ device->driverdata = phdata;
+
+ /* Setup amount of available displays */
+ device->num_displays = 0;
+
+ /* Set device free function */
+ device->free = RPI_Destroy;
+
+ /* Setup all functions which we can handle */
+ device->VideoInit = RPI_VideoInit;
+ device->VideoQuit = RPI_VideoQuit;
+ device->GetDisplayModes = RPI_GetDisplayModes;
+ device->SetDisplayMode = RPI_SetDisplayMode;
+ device->CreateSDLWindow = RPI_CreateWindow;
+ device->CreateSDLWindowFrom = RPI_CreateWindowFrom;
+ device->SetWindowTitle = RPI_SetWindowTitle;
+ device->SetWindowIcon = RPI_SetWindowIcon;
+ device->SetWindowPosition = RPI_SetWindowPosition;
+ device->SetWindowSize = RPI_SetWindowSize;
+ device->ShowWindow = RPI_ShowWindow;
+ device->HideWindow = RPI_HideWindow;
+ device->RaiseWindow = RPI_RaiseWindow;
+ device->MaximizeWindow = RPI_MaximizeWindow;
+ device->MinimizeWindow = RPI_MinimizeWindow;
+ device->RestoreWindow = RPI_RestoreWindow;
+ device->SetWindowGrab = RPI_SetWindowGrab;
+ device->DestroyWindow = RPI_DestroyWindow;
+#if 0
+ device->GetWindowWMInfo = RPI_GetWindowWMInfo;
+#endif
+ device->GL_LoadLibrary = RPI_GLES_LoadLibrary;
+ device->GL_GetProcAddress = RPI_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = RPI_GLES_UnloadLibrary;
+ device->GL_CreateContext = RPI_GLES_CreateContext;
+ device->GL_MakeCurrent = RPI_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = RPI_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = RPI_GLES_GetSwapInterval;
+ device->GL_SwapWindow = RPI_GLES_SwapWindow;
+ device->GL_DeleteContext = RPI_GLES_DeleteContext;
+ device->GL_DefaultProfileConfig = RPI_GLES_DefaultProfileConfig;
+
+ device->PumpEvents = RPI_PumpEvents;
+
+ return device;
+}
+
+VideoBootStrap RPI_bootstrap = {
+ "RPI",
+ "RPI Video Driver",
+ RPI_Available,
+ RPI_Create
+};
+
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions */
+/*****************************************************************************/
+int
+RPI_VideoInit(_THIS)
+{
+ SDL_VideoDisplay display;
+ SDL_DisplayMode current_mode;
+ SDL_DisplayData *data;
+ uint32_t w,h;
+
+ /* Initialize BCM Host */
+ bcm_host_init();
+
+ SDL_zero(current_mode);
+
+ if (graphics_get_display_size( 0, &w, &h) < 0) {
+ return -1;
+ }
+
+ current_mode.w = w;
+ current_mode.h = h;
+ current_mode.refresh_rate = RPI_GetRefreshRate();
+ /* 32 bpp for default */
+ current_mode.format = SDL_PIXELFORMAT_ABGR8888;
+
+ current_mode.driverdata = NULL;
+
+ SDL_zero(display);
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+
+ /* Allocate display internal data */
+ data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
+ if (data == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ data->dispman_display = vc_dispmanx_display_open( 0 /* LCD */);
+
+ display.driverdata = data;
+
+ SDL_AddVideoDisplay(&display);
+
+#ifdef SDL_INPUT_LINUXEV
+ if (SDL_EVDEV_Init() < 0) {
+ return -1;
+ }
+#endif
+
+ RPI_InitMouse(_this);
+
+ return 1;
+}
+
+void
+RPI_VideoQuit(_THIS)
+{
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Quit();
+#endif
+}
+
+void
+RPI_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ /* Only one display mode available, the current one */
+ SDL_AddDisplayMode(display, &display->current_mode);
+}
+
+int
+RPI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+static void
+RPI_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data)
+{
+ SDL_WindowData *wdata = ((SDL_WindowData *) data);
+
+ SDL_LockMutex(wdata->vsync_cond_mutex);
+ SDL_CondSignal(wdata->vsync_cond);
+ SDL_UnlockMutex(wdata->vsync_cond_mutex);
+}
+
+int
+RPI_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wdata;
+ SDL_VideoDisplay *display;
+ SDL_DisplayData *displaydata;
+ VC_RECT_T dst_rect;
+ VC_RECT_T src_rect;
+ VC_DISPMANX_ALPHA_T dispman_alpha;
+ DISPMANX_UPDATE_HANDLE_T dispman_update;
+ uint32_t layer = SDL_RPI_VIDEOLAYER;
+ const char *env;
+
+ /* Disable alpha, otherwise the app looks composed with whatever dispman is showing (X11, console,etc) */
+ dispman_alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
+ dispman_alpha.opacity = 0xFF;
+ dispman_alpha.mask = 0;
+
+ /* Allocate window internal data */
+ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (wdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+ display = SDL_GetDisplayForWindow(window);
+ displaydata = (SDL_DisplayData *) display->driverdata;
+
+ /* Windows have one size for now */
+ window->w = display->desktop_mode.w;
+ window->h = display->desktop_mode.h;
+
+ /* OpenGL ES is the law here, buddy */
+ window->flags |= SDL_WINDOW_OPENGL;
+
+ /* Create a dispman element and associate a window to it */
+ dst_rect.x = 0;
+ dst_rect.y = 0;
+ dst_rect.width = window->w;
+ dst_rect.height = window->h;
+
+ src_rect.x = 0;
+ src_rect.y = 0;
+ src_rect.width = window->w << 16;
+ src_rect.height = window->h << 16;
+
+ env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
+ if (env) {
+ layer = SDL_atoi(env);
+ }
+
+ dispman_update = vc_dispmanx_update_start( 0 );
+ wdata->dispman_window.element = vc_dispmanx_element_add (dispman_update,
+ displaydata->dispman_display,
+ layer /* layer */,
+ &dst_rect,
+ 0 /*src*/,
+ &src_rect,
+ DISPMANX_PROTECTION_NONE,
+ &dispman_alpha /*alpha*/,
+ 0 /*clamp*/,
+ 0 /*transform*/);
+ wdata->dispman_window.width = window->w;
+ wdata->dispman_window.height = window->h;
+ vc_dispmanx_update_submit_sync(dispman_update);
+
+ if (!_this->egl_data) {
+ if (SDL_GL_LoadLibrary(NULL) < 0) {
+ return -1;
+ }
+ }
+ wdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) &wdata->dispman_window);
+
+ if (wdata->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("Could not create GLES window surface");
+ }
+
+ /* Start generating vsync callbacks if necesary */
+ wdata->double_buffer = SDL_FALSE;
+ if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) {
+ wdata->vsync_cond = SDL_CreateCond();
+ wdata->vsync_cond_mutex = SDL_CreateMutex();
+ wdata->double_buffer = SDL_TRUE;
+ vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata);
+ }
+
+ /* Setup driver data for this window */
+ window->driverdata = wdata;
+
+ /* One window, it always has focus */
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+
+ /* Window has been successfully created */
+ return 0;
+}
+
+void
+RPI_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
+
+ if(data) {
+ if (data->double_buffer) {
+ /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
+ SDL_LockMutex(data->vsync_cond_mutex);
+ SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
+ SDL_UnlockMutex(data->vsync_cond_mutex);
+
+ vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
+
+ SDL_DestroyCond(data->vsync_cond);
+ SDL_DestroyMutex(data->vsync_cond_mutex);
+ }
+
+#if SDL_VIDEO_OPENGL_EGL
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ }
+#endif
+ SDL_free(data);
+ window->driverdata = NULL;
+ }
+}
+
+int
+RPI_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ return -1;
+}
+
+void
+RPI_SetWindowTitle(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+}
+void
+RPI_SetWindowPosition(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_SetWindowSize(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_ShowWindow(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_HideWindow(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_RaiseWindow(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_MaximizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_MinimizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_RestoreWindow(_THIS, SDL_Window * window)
+{
+}
+void
+RPI_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function */
+/*****************************************************************************/
+#if 0
+SDL_bool
+RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+
+ /* Failed to get window manager information */
+ return SDL_FALSE;
+}
+#endif
+
+#endif /* SDL_VIDEO_DRIVER_RPI */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.h b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.h
new file mode 100644
index 0000000..b2eb670
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/raspberry/SDL_rpivideo.h
@@ -0,0 +1,104 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef __SDL_RPIVIDEO_H__
+#define __SDL_RPIVIDEO_H__
+
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+
+#include <bcm_host.h>
+#include "GLES/gl.h"
+#include "EGL/egl.h"
+#include "EGL/eglext.h"
+
+typedef struct SDL_VideoData
+{
+ uint32_t egl_refcount; /* OpenGL ES reference count */
+} SDL_VideoData;
+
+
+typedef struct SDL_DisplayData
+{
+ DISPMANX_DISPLAY_HANDLE_T dispman_display;
+} SDL_DisplayData;
+
+
+typedef struct SDL_WindowData
+{
+ EGL_DISPMANX_WINDOW_T dispman_window;
+#if SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+
+ /* Vsync callback cond and mutex */
+ SDL_cond *vsync_cond;
+ SDL_mutex *vsync_cond_mutex;
+ SDL_bool double_buffer;
+
+} SDL_WindowData;
+
+#define SDL_RPI_VIDEOLAYER 10000 /* High enough so to occlude everything */
+#define SDL_RPI_MOUSELAYER SDL_RPI_VIDEOLAYER + 1
+
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration */
+/****************************************************************************/
+
+/* Display and window functions */
+int RPI_VideoInit(_THIS);
+void RPI_VideoQuit(_THIS);
+void RPI_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+int RPI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+int RPI_CreateWindow(_THIS, SDL_Window * window);
+int RPI_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+void RPI_SetWindowTitle(_THIS, SDL_Window * window);
+void RPI_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+void RPI_SetWindowPosition(_THIS, SDL_Window * window);
+void RPI_SetWindowSize(_THIS, SDL_Window * window);
+void RPI_ShowWindow(_THIS, SDL_Window * window);
+void RPI_HideWindow(_THIS, SDL_Window * window);
+void RPI_RaiseWindow(_THIS, SDL_Window * window);
+void RPI_MaximizeWindow(_THIS, SDL_Window * window);
+void RPI_MinimizeWindow(_THIS, SDL_Window * window);
+void RPI_RestoreWindow(_THIS, SDL_Window * window);
+void RPI_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+void RPI_DestroyWindow(_THIS, SDL_Window * window);
+
+/* Window manager function */
+SDL_bool RPI_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+/* OpenGL/OpenGL ES functions */
+int RPI_GLES_LoadLibrary(_THIS, const char *path);
+void *RPI_GLES_GetProcAddress(_THIS, const char *proc);
+void RPI_GLES_UnloadLibrary(_THIS);
+SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window);
+int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+int RPI_GLES_SetSwapInterval(_THIS, int interval);
+int RPI_GLES_GetSwapInterval(_THIS);
+int RPI_GLES_SwapWindow(_THIS, SDL_Window * window);
+void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context);
+
+#endif /* __SDL_RPIVIDEO_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/sdlgenblit.pl b/src/3rdparty/SDL2/src/video/sdlgenblit.pl
new file mode 100644
index 0000000..d89ae2a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/sdlgenblit.pl
@@ -0,0 +1,535 @@
+#!/usr/bin/perl -w
+#
+# A script to generate optimized C blitters for Simple DirectMedia Layer
+# http://www.libsdl.org/
+
+use warnings;
+use strict;
+
+my %file;
+
+# The formats potentially supported by this script:
+# SDL_PIXELFORMAT_RGB332
+# SDL_PIXELFORMAT_RGB444
+# SDL_PIXELFORMAT_RGB555
+# SDL_PIXELFORMAT_ARGB4444
+# SDL_PIXELFORMAT_ARGB1555
+# SDL_PIXELFORMAT_RGB565
+# SDL_PIXELFORMAT_RGB24
+# SDL_PIXELFORMAT_BGR24
+# SDL_PIXELFORMAT_RGB888
+# SDL_PIXELFORMAT_BGR888
+# SDL_PIXELFORMAT_ARGB8888
+# SDL_PIXELFORMAT_RGBA8888
+# SDL_PIXELFORMAT_ABGR8888
+# SDL_PIXELFORMAT_BGRA8888
+# SDL_PIXELFORMAT_ARGB2101010
+
+# The formats we're actually creating blitters for:
+my @src_formats = (
+ "RGB888",
+ "BGR888",
+ "ARGB8888",
+ "RGBA8888",
+ "ABGR8888",
+ "BGRA8888",
+);
+my @dst_formats = (
+ "RGB888",
+ "BGR888",
+ "ARGB8888",
+);
+
+my %format_size = (
+ "RGB888" => 4,
+ "BGR888" => 4,
+ "ARGB8888" => 4,
+ "RGBA8888" => 4,
+ "ABGR8888" => 4,
+ "BGRA8888" => 4,
+);
+
+my %format_type = (
+ "RGB888" => "Uint32",
+ "BGR888" => "Uint32",
+ "ARGB8888" => "Uint32",
+ "RGBA8888" => "Uint32",
+ "ABGR8888" => "Uint32",
+ "BGRA8888" => "Uint32",
+);
+
+my %get_rgba_string_ignore_alpha = (
+ "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
+ "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;",
+ "ARGB8888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
+ "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8);",
+ "ABGR8888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;",
+ "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8);",
+);
+
+my %get_rgba_string = (
+ "RGB888" => $get_rgba_string_ignore_alpha{"RGB888"} . " _A = 0xFF;",
+ "BGR888" => $get_rgba_string_ignore_alpha{"BGR888"} . " _A = 0xFF;",
+ "ARGB8888" => $get_rgba_string_ignore_alpha{"ARGB8888"} . " _A = (Uint8)(_pixel >> 24);",
+ "RGBA8888" => $get_rgba_string_ignore_alpha{"RGBA8888"} . " _A = (Uint8)_pixel;",
+ "ABGR8888" => $get_rgba_string_ignore_alpha{"ABGR8888"} . " _A = (Uint8)(_pixel >> 24);",
+ "BGRA8888" => $get_rgba_string_ignore_alpha{"BGRA8888"} . " _A = (Uint8)_pixel;",
+);
+
+my %set_rgba_string = (
+ "RGB888" => "_pixel = ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;",
+ "BGR888" => "_pixel = ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;",
+ "ARGB8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;",
+ "RGBA8888" => "_pixel = ((Uint32)_R << 24) | ((Uint32)_G << 16) | ((Uint32)_B << 8) | _A;",
+ "ABGR8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;",
+ "BGRA8888" => "_pixel = ((Uint32)_B << 24) | ((Uint32)_G << 16) | ((Uint32)_R << 8) | _A;",
+);
+
+sub open_file {
+ my $name = shift;
+ open(FILE, ">$name.new") || die "Cant' open $name.new: $!";
+ print FILE <<__EOF__;
+/* DO NOT EDIT! This file is generated by sdlgenblit.pl */
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken\@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* *INDENT-OFF* */
+
+__EOF__
+}
+
+sub close_file {
+ my $name = shift;
+ print FILE <<__EOF__;
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
+__EOF__
+ close FILE;
+ if ( ! -f $name || system("cmp -s $name $name.new") != 0 ) {
+ rename("$name.new", "$name");
+ } else {
+ unlink("$name.new");
+ }
+}
+
+sub output_copydefs
+{
+ print FILE <<__EOF__;
+extern SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[];
+__EOF__
+}
+
+sub output_copyfuncname
+{
+ my $prefix = shift;
+ my $src = shift;
+ my $dst = shift;
+ my $modulate = shift;
+ my $blend = shift;
+ my $scale = shift;
+ my $args = shift;
+ my $suffix = shift;
+
+ print FILE "$prefix SDL_Blit_${src}_${dst}";
+ if ( $modulate ) {
+ print FILE "_Modulate";
+ }
+ if ( $blend ) {
+ print FILE "_Blend";
+ }
+ if ( $scale ) {
+ print FILE "_Scale";
+ }
+ if ( $args ) {
+ print FILE "(SDL_BlitInfo *info)";
+ }
+ print FILE "$suffix";
+}
+
+sub get_rgba
+{
+ my $prefix = shift;
+ my $format = shift;
+ my $ignore_alpha = shift;
+
+ my $string;
+ if ($ignore_alpha) {
+ $string = $get_rgba_string_ignore_alpha{$format};
+ } else {
+ $string = $get_rgba_string{$format};
+ }
+
+ $string =~ s/_/$prefix/g;
+ if ( $prefix ne "" ) {
+ print FILE <<__EOF__;
+ ${prefix}pixel = *$prefix;
+__EOF__
+ } else {
+ print FILE <<__EOF__;
+ pixel = *src;
+__EOF__
+ }
+ print FILE <<__EOF__;
+ $string
+__EOF__
+}
+
+sub set_rgba
+{
+ my $prefix = shift;
+ my $format = shift;
+ my $string = $set_rgba_string{$format};
+ $string =~ s/_/$prefix/g;
+ print FILE <<__EOF__;
+ $string
+ *dst = ${prefix}pixel;
+__EOF__
+}
+
+sub output_copycore
+{
+ my $src = shift;
+ my $dst = shift;
+ my $modulate = shift;
+ my $blend = shift;
+ my $s = "";
+ my $d = "";
+
+ # Nice and easy...
+ if ( $src eq $dst && !$modulate && !$blend ) {
+ print FILE <<__EOF__;
+ *dst = *src;
+__EOF__
+ return;
+ }
+
+ my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0;
+ my $ignore_dst_alpha = !$dst_has_alpha && !$blend;
+
+ if ( $blend ) {
+ get_rgba("src", $src, $ignore_dst_alpha);
+ get_rgba("dst", $dst, !$dst_has_alpha);
+ $s = "src";
+ $d = "dst";
+ } else {
+ get_rgba("", $src, $ignore_dst_alpha);
+ }
+
+ if ( $modulate ) {
+ print FILE <<__EOF__;
+ if (flags & SDL_COPY_MODULATE_COLOR) {
+ ${s}R = (${s}R * modulateR) / 255;
+ ${s}G = (${s}G * modulateG) / 255;
+ ${s}B = (${s}B * modulateB) / 255;
+ }
+__EOF__
+ if (not $ignore_dst_alpha) {
+ print FILE <<__EOF__;
+ if (flags & SDL_COPY_MODULATE_ALPHA) {
+ ${s}A = (${s}A * modulateA) / 255;
+ }
+__EOF__
+ }
+ }
+ if ( $blend ) {
+ print FILE <<__EOF__;
+ if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
+ /* This goes away if we ever use premultiplied alpha */
+ if (${s}A < 255) {
+ ${s}R = (${s}R * ${s}A) / 255;
+ ${s}G = (${s}G * ${s}A) / 255;
+ ${s}B = (${s}B * ${s}A) / 255;
+ }
+ }
+ switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
+ case SDL_COPY_BLEND:
+ ${d}R = ${s}R + ((255 - ${s}A) * ${d}R) / 255;
+ ${d}G = ${s}G + ((255 - ${s}A) * ${d}G) / 255;
+ ${d}B = ${s}B + ((255 - ${s}A) * ${d}B) / 255;
+__EOF__
+
+ if ( $dst_has_alpha ) {
+ print FILE <<__EOF__;
+ ${d}A = ${s}A + ((255 - ${s}A) * ${d}A) / 255;
+__EOF__
+ }
+
+ print FILE <<__EOF__;
+ break;
+ case SDL_COPY_ADD:
+ ${d}R = ${s}R + ${d}R; if (${d}R > 255) ${d}R = 255;
+ ${d}G = ${s}G + ${d}G; if (${d}G > 255) ${d}G = 255;
+ ${d}B = ${s}B + ${d}B; if (${d}B > 255) ${d}B = 255;
+ break;
+ case SDL_COPY_MOD:
+ ${d}R = (${s}R * ${d}R) / 255;
+ ${d}G = (${s}G * ${d}G) / 255;
+ ${d}B = (${s}B * ${d}B) / 255;
+ break;
+ }
+__EOF__
+ }
+ if ( $blend ) {
+ set_rgba("dst", $dst);
+ } else {
+ set_rgba("", $dst);
+ }
+}
+
+sub output_copyfunc
+{
+ my $src = shift;
+ my $dst = shift;
+ my $modulate = shift;
+ my $blend = shift;
+ my $scale = shift;
+
+ my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0;
+ my $ignore_dst_alpha = !$dst_has_alpha && !$blend;
+
+ output_copyfuncname("static void", $src, $dst, $modulate, $blend, $scale, 1, "\n");
+ print FILE <<__EOF__;
+{
+__EOF__
+ if ( $modulate || $blend ) {
+ print FILE <<__EOF__;
+ const int flags = info->flags;
+__EOF__
+ }
+ if ( $modulate ) {
+ print FILE <<__EOF__;
+ const Uint32 modulateR = info->r;
+ const Uint32 modulateG = info->g;
+ const Uint32 modulateB = info->b;
+__EOF__
+ if (!$ignore_dst_alpha) {
+ print FILE <<__EOF__;
+ const Uint32 modulateA = info->a;
+__EOF__
+ }
+ }
+ if ( $blend ) {
+ print FILE <<__EOF__;
+ Uint32 srcpixel;
+ Uint32 srcR, srcG, srcB, srcA;
+ Uint32 dstpixel;
+__EOF__
+ if ($dst_has_alpha) {
+ print FILE <<__EOF__;
+ Uint32 dstR, dstG, dstB, dstA;
+__EOF__
+ } else {
+ print FILE <<__EOF__;
+ Uint32 dstR, dstG, dstB;
+__EOF__
+ }
+ } elsif ( $modulate || $src ne $dst ) {
+ print FILE <<__EOF__;
+ Uint32 pixel;
+__EOF__
+ if (!$ignore_dst_alpha) {
+ print FILE <<__EOF__;
+ Uint32 R, G, B, A;
+__EOF__
+ } else {
+ print FILE <<__EOF__;
+ Uint32 R, G, B;
+__EOF__
+ }
+ }
+ if ( $scale ) {
+ print FILE <<__EOF__;
+ int srcy, srcx;
+ int posy, posx;
+ int incy, incx;
+__EOF__
+
+ print FILE <<__EOF__;
+
+ srcy = 0;
+ posy = 0;
+ incy = (info->src_h << 16) / info->dst_h;
+ incx = (info->src_w << 16) / info->dst_w;
+
+ while (info->dst_h--) {
+ $format_type{$src} *src = 0;
+ $format_type{$dst} *dst = ($format_type{$dst} *)info->dst;
+ int n = info->dst_w;
+ srcx = -1;
+ posx = 0x10000L;
+ while (posy >= 0x10000L) {
+ ++srcy;
+ posy -= 0x10000L;
+ }
+ while (n--) {
+ if (posx >= 0x10000L) {
+ while (posx >= 0x10000L) {
+ ++srcx;
+ posx -= 0x10000L;
+ }
+ src = ($format_type{$src} *)(info->src + (srcy * info->src_pitch) + (srcx * $format_size{$src}));
+__EOF__
+ print FILE <<__EOF__;
+ }
+__EOF__
+ output_copycore($src, $dst, $modulate, $blend);
+ print FILE <<__EOF__;
+ posx += incx;
+ ++dst;
+ }
+ posy += incy;
+ info->dst += info->dst_pitch;
+ }
+__EOF__
+ } else {
+ print FILE <<__EOF__;
+
+ while (info->dst_h--) {
+ $format_type{$src} *src = ($format_type{$src} *)info->src;
+ $format_type{$dst} *dst = ($format_type{$dst} *)info->dst;
+ int n = info->dst_w;
+ while (n--) {
+__EOF__
+ output_copycore($src, $dst, $modulate, $blend);
+ print FILE <<__EOF__;
+ ++src;
+ ++dst;
+ }
+ info->src += info->src_pitch;
+ info->dst += info->dst_pitch;
+ }
+__EOF__
+ }
+ print FILE <<__EOF__;
+}
+
+__EOF__
+}
+
+sub output_copyfunc_h
+{
+}
+
+sub output_copyinc
+{
+ print FILE <<__EOF__;
+#include "SDL_video.h"
+#include "SDL_blit.h"
+#include "SDL_blit_auto.h"
+
+__EOF__
+}
+
+sub output_copyfunctable
+{
+ print FILE <<__EOF__;
+SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
+__EOF__
+ for (my $i = 0; $i <= $#src_formats; ++$i) {
+ my $src = $src_formats[$i];
+ for (my $j = 0; $j <= $#dst_formats; ++$j) {
+ my $dst = $dst_formats[$j];
+ for (my $modulate = 0; $modulate <= 1; ++$modulate) {
+ for (my $blend = 0; $blend <= 1; ++$blend) {
+ for (my $scale = 0; $scale <= 1; ++$scale) {
+ if ( $modulate || $blend || $scale ) {
+ print FILE " { SDL_PIXELFORMAT_$src, SDL_PIXELFORMAT_$dst, ";
+ my $flags = "";
+ my $flag = "";
+ if ( $modulate ) {
+ $flag = "SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA";
+ if ( $flags eq "" ) {
+ $flags = $flag;
+ } else {
+ $flags = "$flags | $flag";
+ }
+ }
+ if ( $blend ) {
+ $flag = "SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD";
+ if ( $flags eq "" ) {
+ $flags = $flag;
+ } else {
+ $flags = "$flags | $flag";
+ }
+ }
+ if ( $scale ) {
+ $flag = "SDL_COPY_NEAREST";
+ if ( $flags eq "" ) {
+ $flags = $flag;
+ } else {
+ $flags = "$flags | $flag";
+ }
+ }
+ if ( $flags eq "" ) {
+ $flags = "0";
+ }
+ print FILE "($flags), SDL_CPU_ANY,";
+ output_copyfuncname("", $src_formats[$i], $dst_formats[$j], $modulate, $blend, $scale, 0, " },\n");
+ }
+ }
+ }
+ }
+ }
+ }
+ print FILE <<__EOF__;
+ { 0, 0, 0, 0, NULL }
+};
+
+__EOF__
+}
+
+sub output_copyfunc_c
+{
+ my $src = shift;
+ my $dst = shift;
+
+ for (my $modulate = 0; $modulate <= 1; ++$modulate) {
+ for (my $blend = 0; $blend <= 1; ++$blend) {
+ for (my $scale = 0; $scale <= 1; ++$scale) {
+ if ( $modulate || $blend || $scale ) {
+ output_copyfunc($src, $dst, $modulate, $blend, $scale);
+ }
+ }
+ }
+ }
+}
+
+open_file("SDL_blit_auto.h");
+output_copydefs();
+for (my $i = 0; $i <= $#src_formats; ++$i) {
+ for (my $j = 0; $j <= $#dst_formats; ++$j) {
+ output_copyfunc_h($src_formats[$i], $dst_formats[$j]);
+ }
+}
+print FILE "\n";
+close_file("SDL_blit_auto.h");
+
+open_file("SDL_blit_auto.c");
+output_copyinc();
+for (my $i = 0; $i <= $#src_formats; ++$i) {
+ for (my $j = 0; $j <= $#dst_formats; ++$j) {
+ output_copyfunc_c($src_formats[$i], $dst_formats[$j]);
+ }
+}
+output_copyfunctable();
+close_file("SDL_blit_auto.c");
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.h
new file mode 100644
index 0000000..34b0138
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#import <UIKit/UIKit.h>
+
+@interface SDLLaunchScreenController : UIViewController
+
+- (instancetype)init;
+- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
+- (void)loadView;
+
+@end
+
+@interface SDLUIKitDelegate : NSObject<UIApplicationDelegate>
+
++ (id)sharedAppDelegate;
++ (NSString *)getAppDelegateClassName;
+
+- (void)hideLaunchScreen;
+
+/* This property is marked as optional, and is only intended to be used when
+ * the app's UI is storyboard-based. SDL is not storyboard-based, however
+ * several major third-party ad APIs (e.g. Google admob) incorrectly assume this
+ * property always exists, and will crash if it doesn't. */
+@property (nonatomic) UIWindow *window;
+
+@end
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.m
new file mode 100644
index 0000000..a942dfd
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitappdelegate.m
@@ -0,0 +1,539 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "../SDL_sysvideo.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "SDL_system.h"
+#include "SDL_main.h"
+
+#import "SDL_uikitappdelegate.h"
+#import "SDL_uikitmodes.h"
+#import "SDL_uikitwindow.h"
+
+#include "../../events/SDL_events_c.h"
+
+#ifdef main
+#undef main
+#endif
+
+static int forward_argc;
+static char **forward_argv;
+static int exit_status;
+
+int main(int argc, char **argv)
+{
+ int i;
+
+ /* store arguments */
+ forward_argc = argc;
+ forward_argv = (char **)malloc((argc+1) * sizeof(char *));
+ for (i = 0; i < argc; i++) {
+ forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
+ strcpy(forward_argv[i], argv[i]);
+ }
+ forward_argv[i] = NULL;
+
+ /* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
+ @autoreleasepool {
+ UIApplicationMain(argc, argv, nil, [SDLUIKitDelegate getAppDelegateClassName]);
+ }
+
+ /* free the memory we used to hold copies of argc and argv */
+ for (i = 0; i < forward_argc; i++) {
+ free(forward_argv[i]);
+ }
+ free(forward_argv);
+
+ return exit_status;
+}
+
+static void SDLCALL
+SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ BOOL disable = (hint && *hint != '0');
+ [UIApplication sharedApplication].idleTimerDisabled = disable;
+}
+
+#if !TARGET_OS_TV
+/* Load a launch image using the old UILaunchImageFile-era naming rules. */
+static UIImage *
+SDL_LoadLaunchImageNamed(NSString *name, int screenh)
+{
+ UIInterfaceOrientation curorient = [UIApplication sharedApplication].statusBarOrientation;
+ UIUserInterfaceIdiom idiom = [UIDevice currentDevice].userInterfaceIdiom;
+ UIImage *image = nil;
+
+ if (idiom == UIUserInterfaceIdiomPhone && screenh == 568) {
+ /* The image name for the iPhone 5 uses its height as a suffix. */
+ image = [UIImage imageNamed:[NSString stringWithFormat:@"%@-568h", name]];
+ } else if (idiom == UIUserInterfaceIdiomPad) {
+ /* iPad apps can launch in any orientation. */
+ if (UIInterfaceOrientationIsLandscape(curorient)) {
+ if (curorient == UIInterfaceOrientationLandscapeLeft) {
+ image = [UIImage imageNamed:[NSString stringWithFormat:@"%@-LandscapeLeft", name]];
+ } else {
+ image = [UIImage imageNamed:[NSString stringWithFormat:@"%@-LandscapeRight", name]];
+ }
+ if (!image) {
+ image = [UIImage imageNamed:[NSString stringWithFormat:@"%@-Landscape", name]];
+ }
+ } else {
+ if (curorient == UIInterfaceOrientationPortraitUpsideDown) {
+ image = [UIImage imageNamed:[NSString stringWithFormat:@"%@-PortraitUpsideDown", name]];
+ }
+ if (!image) {
+ image = [UIImage imageNamed:[NSString stringWithFormat:@"%@-Portrait", name]];
+ }
+ }
+ }
+
+ if (!image) {
+ image = [UIImage imageNamed:name];
+ }
+
+ return image;
+}
+#endif /* !TARGET_OS_TV */
+
+@interface SDLLaunchScreenController ()
+
+#if !TARGET_OS_TV
+- (NSUInteger)supportedInterfaceOrientations;
+#endif
+
+@end
+
+@implementation SDLLaunchScreenController
+
+- (instancetype)init
+{
+ return [self initWithNibName:nil bundle:[NSBundle mainBundle]];
+}
+
+- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ if (!(self = [super initWithNibName:nil bundle:nil])) {
+ return nil;
+ }
+
+ NSString *screenname = nibNameOrNil;
+ NSBundle *bundle = nibBundleOrNil;
+ BOOL atleastiOS8 = UIKit_IsSystemVersionAtLeast(8.0);
+
+ /* Launch screens were added in iOS 8. Otherwise we use launch images. */
+ if (screenname && atleastiOS8) {
+ @try {
+ self.view = [bundle loadNibNamed:screenname owner:self options:nil][0];
+ }
+ @catch (NSException *exception) {
+ /* If a launch screen name is specified but it fails to load, iOS
+ * displays a blank screen rather than falling back to an image. */
+ return nil;
+ }
+ }
+
+ if (!self.view) {
+ NSArray *launchimages = [bundle objectForInfoDictionaryKey:@"UILaunchImages"];
+ NSString *imagename = nil;
+ UIImage *image = nil;
+
+ int screenw = (int)([UIScreen mainScreen].bounds.size.width + 0.5);
+ int screenh = (int)([UIScreen mainScreen].bounds.size.height + 0.5);
+
+#if !TARGET_OS_TV
+ UIInterfaceOrientation curorient = [UIApplication sharedApplication].statusBarOrientation;
+
+ /* We always want portrait-oriented size, to match UILaunchImageSize. */
+ if (screenw > screenh) {
+ int width = screenw;
+ screenw = screenh;
+ screenh = width;
+ }
+#endif
+
+ /* Xcode 5 introduced a dictionary of launch images in Info.plist. */
+ if (launchimages) {
+ for (NSDictionary *dict in launchimages) {
+ NSString *minversion = dict[@"UILaunchImageMinimumOSVersion"];
+ NSString *sizestring = dict[@"UILaunchImageSize"];
+
+ /* Ignore this image if the current version is too low. */
+ if (minversion && !UIKit_IsSystemVersionAtLeast(minversion.doubleValue)) {
+ continue;
+ }
+
+ /* Ignore this image if the size doesn't match. */
+ if (sizestring) {
+ CGSize size = CGSizeFromString(sizestring);
+ if ((int)(size.width + 0.5) != screenw || (int)(size.height + 0.5) != screenh) {
+ continue;
+ }
+ }
+
+#if !TARGET_OS_TV
+ UIInterfaceOrientationMask orientmask = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
+ NSString *orientstring = dict[@"UILaunchImageOrientation"];
+
+ if (orientstring) {
+ if ([orientstring isEqualToString:@"PortraitUpsideDown"]) {
+ orientmask = UIInterfaceOrientationMaskPortraitUpsideDown;
+ } else if ([orientstring isEqualToString:@"Landscape"]) {
+ orientmask = UIInterfaceOrientationMaskLandscape;
+ } else if ([orientstring isEqualToString:@"LandscapeLeft"]) {
+ orientmask = UIInterfaceOrientationMaskLandscapeLeft;
+ } else if ([orientstring isEqualToString:@"LandscapeRight"]) {
+ orientmask = UIInterfaceOrientationMaskLandscapeRight;
+ }
+ }
+
+ /* Ignore this image if the orientation doesn't match. */
+ if ((orientmask & (1 << curorient)) == 0) {
+ continue;
+ }
+#endif
+
+ imagename = dict[@"UILaunchImageName"];
+ }
+
+ if (imagename) {
+ image = [UIImage imageNamed:imagename];
+ }
+ }
+#if !TARGET_OS_TV
+ else {
+ imagename = [bundle objectForInfoDictionaryKey:@"UILaunchImageFile"];
+
+ if (imagename) {
+ image = SDL_LoadLaunchImageNamed(imagename, screenh);
+ }
+
+ if (!image) {
+ image = SDL_LoadLaunchImageNamed(@"Default", screenh);
+ }
+ }
+#endif
+
+ if (image) {
+ UIImageView *view = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
+ UIImageOrientation imageorient = UIImageOrientationUp;
+
+#if !TARGET_OS_TV
+ /* Bugs observed / workaround tested in iOS 8.3, 7.1, and 6.1. */
+ if (UIInterfaceOrientationIsLandscape(curorient)) {
+ if (atleastiOS8 && image.size.width < image.size.height) {
+ /* On iOS 8, portrait launch images displayed in forced-
+ * landscape mode (e.g. a standard Default.png on an iPhone
+ * when Info.plist only supports landscape orientations) need
+ * to be rotated to display in the expected orientation. */
+ if (curorient == UIInterfaceOrientationLandscapeLeft) {
+ imageorient = UIImageOrientationRight;
+ } else if (curorient == UIInterfaceOrientationLandscapeRight) {
+ imageorient = UIImageOrientationLeft;
+ }
+ } else if (!atleastiOS8 && image.size.width > image.size.height) {
+ /* On iOS 7 and below, landscape launch images displayed in
+ * landscape mode (e.g. landscape iPad launch images) need
+ * to be rotated to display in the expected orientation. */
+ if (curorient == UIInterfaceOrientationLandscapeLeft) {
+ imageorient = UIImageOrientationLeft;
+ } else if (curorient == UIInterfaceOrientationLandscapeRight) {
+ imageorient = UIImageOrientationRight;
+ }
+ }
+ }
+#endif
+
+ /* Create the properly oriented image. */
+ view.image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:imageorient];
+
+ self.view = view;
+ }
+ }
+
+ return self;
+}
+
+- (void)loadView
+{
+ /* Do nothing. */
+}
+
+#if !TARGET_OS_TV
+- (BOOL)shouldAutorotate
+{
+ /* If YES, the launch image will be incorrectly rotated in some cases. */
+ return NO;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+ /* We keep the supported orientations unrestricted to avoid the case where
+ * there are no common orientations between the ones set in Info.plist and
+ * the ones set here (it will cause an exception in that case.) */
+ return UIInterfaceOrientationMaskAll;
+}
+#endif /* !TARGET_OS_TV */
+
+@end
+
+@implementation SDLUIKitDelegate {
+ UIWindow *launchWindow;
+}
+
+/* convenience method */
++ (id)sharedAppDelegate
+{
+ /* the delegate is set in UIApplicationMain(), which is guaranteed to be
+ * called before this method */
+ return [UIApplication sharedApplication].delegate;
+}
+
++ (NSString *)getAppDelegateClassName
+{
+ /* subclassing notice: when you subclass this appdelegate, make sure to add
+ * a category to override this method and return the actual name of the
+ * delegate */
+ return @"SDLUIKitDelegate";
+}
+
+- (void)hideLaunchScreen
+{
+ UIWindow *window = launchWindow;
+
+ if (!window || window.hidden) {
+ return;
+ }
+
+ launchWindow = nil;
+
+ /* Do a nice animated fade-out (roughly matches the real launch behavior.) */
+ [UIView animateWithDuration:0.2 animations:^{
+ window.alpha = 0.0;
+ } completion:^(BOOL finished) {
+ window.hidden = YES;
+ }];
+}
+
+- (void)postFinishLaunch
+{
+ /* Hide the launch screen the next time the run loop is run. SDL apps will
+ * have a chance to load resources while the launch screen is still up. */
+ [self performSelector:@selector(hideLaunchScreen) withObject:nil afterDelay:0.0];
+
+ /* run the user's application, passing argc and argv */
+ SDL_iPhoneSetEventPump(SDL_TRUE);
+ exit_status = SDL_main(forward_argc, forward_argv);
+ SDL_iPhoneSetEventPump(SDL_FALSE);
+
+ if (launchWindow) {
+ launchWindow.hidden = YES;
+ launchWindow = nil;
+ }
+
+ /* exit, passing the return status from the user's application */
+ /* We don't actually exit to support applications that do setup in their
+ * main function and then allow the Cocoa event loop to run. */
+ /* exit(exit_status); */
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ NSBundle *bundle = [NSBundle mainBundle];
+
+#if SDL_IPHONE_LAUNCHSCREEN
+ /* The normal launch screen is displayed until didFinishLaunching returns,
+ * but SDL_main is called after that happens and there may be a noticeable
+ * delay between the start of SDL_main and when the first real frame is
+ * displayed (e.g. if resources are loaded before SDL_GL_SwapWindow is
+ * called), so we show the launch screen programmatically until the first
+ * time events are pumped. */
+ UIViewController *vc = nil;
+ NSString *screenname = nil;
+
+ /* tvOS only uses a plain launch image. */
+#if !TARGET_OS_TV
+ screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
+
+ if (screenname && UIKit_IsSystemVersionAtLeast(8.0)) {
+ @try {
+ /* The launch storyboard is actually a nib in some older versions of
+ * Xcode. We'll try to load it as a storyboard first, as it's more
+ * modern. */
+ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:screenname bundle:bundle];
+ vc = [storyboard instantiateInitialViewController];
+ }
+ @catch (NSException *exception) {
+ /* Do nothing (there's more code to execute below). */
+ }
+ }
+#endif
+
+ if (vc == nil) {
+ vc = [[SDLLaunchScreenController alloc] initWithNibName:screenname bundle:bundle];
+ }
+
+ if (vc.view) {
+ launchWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
+
+ /* We don't want the launch window immediately hidden when a real SDL
+ * window is shown - we fade it out ourselves when we're ready. */
+ launchWindow.windowLevel = UIWindowLevelNormal + 1.0;
+
+ /* Show the window but don't make it key. Events should always go to
+ * other windows when possible. */
+ launchWindow.hidden = NO;
+
+ launchWindow.rootViewController = vc;
+ }
+#endif
+
+ /* Set working directory to resource path */
+ [[NSFileManager defaultManager] changeCurrentDirectoryPath:[bundle resourcePath]];
+
+ /* register a callback for the idletimer hint */
+ SDL_AddHintCallback(SDL_HINT_IDLE_TIMER_DISABLED,
+ SDL_IdleTimerDisabledChanged, NULL);
+
+ SDL_SetMainReady();
+ [self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];
+
+ return YES;
+}
+
+- (UIWindow *)window
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ if (_this) {
+ SDL_Window *window = NULL;
+ for (window = _this->windows; window != NULL; window = window->next) {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ if (data != nil) {
+ return data.uiwindow;
+ }
+ }
+ }
+ return nil;
+}
+
+- (void)setWindow:(UIWindow *)window
+{
+ /* Do nothing. */
+}
+
+#if !TARGET_OS_TV
+- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation
+{
+ BOOL isLandscape = UIInterfaceOrientationIsLandscape(application.statusBarOrientation);
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ if (_this && _this->num_displays > 0) {
+ SDL_DisplayMode *desktopmode = &_this->displays[0].desktop_mode;
+ SDL_DisplayMode *currentmode = &_this->displays[0].current_mode;
+
+ /* The desktop display mode should be kept in sync with the screen
+ * orientation so that updating a window's fullscreen state to
+ * SDL_WINDOW_FULLSCREEN_DESKTOP keeps the window dimensions in the
+ * correct orientation. */
+ if (isLandscape != (desktopmode->w > desktopmode->h)) {
+ int height = desktopmode->w;
+ desktopmode->w = desktopmode->h;
+ desktopmode->h = height;
+ }
+
+ /* Same deal with the current mode + SDL_GetCurrentDisplayMode. */
+ if (isLandscape != (currentmode->w > currentmode->h)) {
+ int height = currentmode->w;
+ currentmode->w = currentmode->h;
+ currentmode->h = height;
+ }
+ }
+}
+#endif
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ SDL_OnApplicationWillTerminate();
+}
+
+- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
+{
+ SDL_OnApplicationDidReceiveMemoryWarning();
+}
+
+- (void)applicationWillResignActive:(UIApplication*)application
+{
+ SDL_OnApplicationWillResignActive();
+}
+
+- (void)applicationDidEnterBackground:(UIApplication*)application
+{
+ SDL_OnApplicationDidEnterBackground();
+}
+
+- (void)applicationWillEnterForeground:(UIApplication*)application
+{
+ SDL_OnApplicationWillEnterForeground();
+}
+
+- (void)applicationDidBecomeActive:(UIApplication*)application
+{
+ SDL_OnApplicationDidBecomeActive();
+}
+
+- (void)sendDropFileForURL:(NSURL *)url
+{
+ NSURL *fileURL = url.filePathURL;
+ if (fileURL != nil) {
+ SDL_SendDropFile(NULL, fileURL.path.UTF8String);
+ } else {
+ SDL_SendDropFile(NULL, url.absoluteString.UTF8String);
+ }
+ SDL_SendDropComplete(NULL);
+}
+
+#if TARGET_OS_TV || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0)
+
+- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
+{
+ /* TODO: Handle options */
+ [self sendDropFileForURL:url];
+ return YES;
+}
+
+#else
+
+- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
+{
+ [self sendDropFileForURL:url];
+ return YES;
+}
+
+#endif
+
+@end
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.h
new file mode 100644
index 0000000..c4b689d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.h
@@ -0,0 +1,35 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_uikitclipboard_h_
+#define SDL_uikitclipboard_h_
+
+#include "../SDL_sysvideo.h"
+
+extern int UIKit_SetClipboardText(_THIS, const char *text);
+extern char *UIKit_GetClipboardText(_THIS);
+extern SDL_bool UIKit_HasClipboardText(_THIS);
+
+extern void UIKit_InitClipboard(_THIS);
+extern void UIKit_QuitClipboard(_THIS);
+
+#endif /* SDL_uikitclipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.m
new file mode 100644
index 0000000..b1d4f6d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitclipboard.m
@@ -0,0 +1,111 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_uikitvideo.h"
+#include "../../events/SDL_clipboardevents_c.h"
+
+#import <UIKit/UIPasteboard.h>
+
+int
+UIKit_SetClipboardText(_THIS, const char *text)
+{
+#if TARGET_OS_TV
+ return SDL_SetError("The clipboard is not available on tvOS");
+#else
+ @autoreleasepool {
+ [UIPasteboard generalPasteboard].string = @(text);
+ return 0;
+ }
+#endif
+}
+
+char *
+UIKit_GetClipboardText(_THIS)
+{
+#if TARGET_OS_TV
+ return SDL_strdup(""); // Unsupported.
+#else
+ @autoreleasepool {
+ UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
+ NSString *string = pasteboard.string;
+
+ if (string != nil) {
+ return SDL_strdup(string.UTF8String);
+ } else {
+ return SDL_strdup("");
+ }
+ }
+#endif
+}
+
+SDL_bool
+UIKit_HasClipboardText(_THIS)
+{
+ @autoreleasepool {
+#if !TARGET_OS_TV
+ if ([UIPasteboard generalPasteboard].string != nil) {
+ return SDL_TRUE;
+ }
+#endif
+ return SDL_FALSE;
+ }
+}
+
+void
+UIKit_InitClipboard(_THIS)
+{
+#if !TARGET_OS_TV
+ @autoreleasepool {
+ SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata;
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+
+ id observer = [center addObserverForName:UIPasteboardChangedNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification *note) {
+ SDL_SendClipboardUpdate();
+ }];
+
+ data.pasteboardObserver = observer;
+ }
+#endif
+}
+
+void
+UIKit_QuitClipboard(_THIS)
+{
+ @autoreleasepool {
+ SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata;
+
+ if (data.pasteboardObserver != nil) {
+ [[NSNotificationCenter defaultCenter] removeObserver:data.pasteboardObserver];
+ }
+
+ data.pasteboardObserver = nil;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.h
new file mode 100644
index 0000000..0c48829
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.h
@@ -0,0 +1,30 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_uikitevents_h_
+#define SDL_uikitevents_h_
+
+#include "../SDL_sysvideo.h"
+
+extern void UIKit_PumpEvents(_THIS);
+
+#endif /* SDL_uikitevents_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.m
new file mode 100644
index 0000000..d64e330
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitevents.m
@@ -0,0 +1,73 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_uikitvideo.h"
+#include "SDL_uikitevents.h"
+#include "SDL_uikitopengles.h"
+
+#import <Foundation/Foundation.h>
+
+static BOOL UIKit_EventPumpEnabled = YES;
+
+void
+SDL_iPhoneSetEventPump(SDL_bool enabled)
+{
+ UIKit_EventPumpEnabled = enabled;
+}
+
+void
+UIKit_PumpEvents(_THIS)
+{
+ if (!UIKit_EventPumpEnabled) {
+ return;
+ }
+
+ /* Let the run loop run for a short amount of time: long enough for
+ touch events to get processed (which is important to get certain
+ elements of Game Center's GKLeaderboardViewController to respond
+ to touch input), but not long enough to introduce a significant
+ delay in the rest of the app.
+ */
+ const CFTimeInterval seconds = 0.000002;
+
+ /* Pump most event types. */
+ SInt32 result;
+ do {
+ result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, seconds, TRUE);
+ } while (result == kCFRunLoopRunHandledSource);
+
+ /* Make sure UIScrollView objects scroll properly. */
+ do {
+ result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE);
+ } while(result == kCFRunLoopRunHandledSource);
+
+ /* See the comment in the function definition. */
+ UIKit_GL_RestoreCurrentContext();
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.h
new file mode 100644
index 0000000..a766b57
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+extern SDL_bool UIKit_ShowingMessageBox(void);
+
+extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.m
new file mode 100644
index 0000000..7950c8e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmessagebox.m
@@ -0,0 +1,206 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL.h"
+#include "SDL_uikitvideo.h"
+#include "SDL_uikitwindow.h"
+
+/* Display a UIKit message box */
+
+static SDL_bool s_showingMessageBox = SDL_FALSE;
+
+SDL_bool
+UIKit_ShowingMessageBox(void)
+{
+ return s_showingMessageBox;
+}
+
+static void
+UIKit_WaitUntilMessageBoxClosed(const SDL_MessageBoxData *messageboxdata, int *clickedindex)
+{
+ *clickedindex = messageboxdata->numbuttons;
+
+ @autoreleasepool {
+ /* Run the main event loop until the alert has finished */
+ /* Note that this needs to be done on the main thread */
+ s_showingMessageBox = SDL_TRUE;
+ while ((*clickedindex) == messageboxdata->numbuttons) {
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
+ }
+ s_showingMessageBox = SDL_FALSE;
+ }
+}
+
+static BOOL
+UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+#ifdef __IPHONE_8_0
+ int i;
+ int __block clickedindex = messageboxdata->numbuttons;
+ const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
+ UIWindow *window = nil;
+ UIWindow *alertwindow = nil;
+
+ if (![UIAlertController class]) {
+ return NO;
+ }
+
+ UIAlertController *alert;
+ alert = [UIAlertController alertControllerWithTitle:@(messageboxdata->title)
+ message:@(messageboxdata->message)
+ preferredStyle:UIAlertControllerStyleAlert];
+
+ for (i = 0; i < messageboxdata->numbuttons; i++) {
+ UIAlertAction *action;
+ UIAlertActionStyle style = UIAlertActionStyleDefault;
+
+ if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
+ style = UIAlertActionStyleCancel;
+ }
+
+ action = [UIAlertAction actionWithTitle:@(buttons[i].text)
+ style:style
+ handler:^(UIAlertAction *action) {
+ clickedindex = i;
+ }];
+ [alert addAction:action];
+ }
+
+ if (messageboxdata->window) {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) messageboxdata->window->driverdata;
+ window = data.uiwindow;
+ }
+
+ if (window == nil || window.rootViewController == nil) {
+ alertwindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
+ alertwindow.rootViewController = [UIViewController new];
+ alertwindow.windowLevel = UIWindowLevelAlert;
+
+ window = alertwindow;
+
+ [alertwindow makeKeyAndVisible];
+ }
+
+ [window.rootViewController presentViewController:alert animated:YES completion:nil];
+ UIKit_WaitUntilMessageBoxClosed(messageboxdata, &clickedindex);
+
+ if (alertwindow) {
+ alertwindow.hidden = YES;
+ }
+
+ /* Force the main SDL window to re-evaluate home indicator state */
+ SDL_Window *focus = SDL_GetFocusWindow();
+ if (focus) {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) focus->driverdata;
+ if (data != nil) {
+ if (@available(iOS 11.0, *)) {
+ [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO];
+ [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO];
+ }
+ }
+ }
+
+ *buttonid = messageboxdata->buttons[clickedindex].buttonid;
+ return YES;
+#else
+ return NO;
+#endif /* __IPHONE_8_0 */
+}
+
+/* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
+@interface SDLAlertViewDelegate : NSObject <UIAlertViewDelegate>
+
+@property (nonatomic, assign) int *clickedIndex;
+
+@end
+
+@implementation SDLAlertViewDelegate
+
+- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
+{
+ if (_clickedIndex != NULL) {
+ *_clickedIndex = (int) buttonIndex;
+ }
+}
+
+@end
+#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */
+
+static BOOL
+UIKit_ShowMessageBoxAlertView(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ /* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
+ int i;
+ int clickedindex = messageboxdata->numbuttons;
+ const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
+ UIAlertView *alert = [[UIAlertView alloc] init];
+ SDLAlertViewDelegate *delegate = [[SDLAlertViewDelegate alloc] init];
+
+ alert.delegate = delegate;
+ alert.title = @(messageboxdata->title);
+ alert.message = @(messageboxdata->message);
+
+ for (i = 0; i < messageboxdata->numbuttons; i++) {
+ [alert addButtonWithTitle:@(buttons[i].text)];
+ }
+
+ delegate.clickedIndex = &clickedindex;
+
+ [alert show];
+
+ UIKit_WaitUntilMessageBoxClosed(messageboxdata, &clickedindex);
+
+ alert.delegate = nil;
+
+ *buttonid = messageboxdata->buttons[clickedindex].buttonid;
+ return YES;
+#else
+ return NO;
+#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */
+}
+
+int
+UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ BOOL success = NO;
+
+ @autoreleasepool {
+ success = UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid);
+ if (!success) {
+ success = UIKit_ShowMessageBoxAlertView(messageboxdata, buttonid);
+ }
+ }
+
+ if (!success) {
+ return SDL_SetError("Could not show message box.");
+ }
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.h
new file mode 100644
index 0000000..bc97778
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.h
@@ -0,0 +1,58 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+ */
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com.
+ *
+ * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing
+ * how to add a CAMetalLayer backed view.
+ */
+
+#ifndef SDL_uikitmetalview_h_
+#define SDL_uikitmetalview_h_
+
+#import "../SDL_sysvideo.h"
+#import "SDL_uikitwindow.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN)
+
+#import <UIKit/UIKit.h>
+#import <Metal/Metal.h>
+#import <QuartzCore/CAMetalLayer.h>
+
+#define METALVIEW_TAG 255
+
+@interface SDL_uikitmetalview : SDL_uikitview
+
+- (instancetype)initWithFrame:(CGRect)frame
+ scale:(CGFloat)scale;
+
+@end
+
+SDL_uikitmetalview* UIKit_Mtl_AddMetalView(SDL_Window* window);
+
+void UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h);
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */
+
+#endif /* SDL_uikitmetalview_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.m
new file mode 100644
index 0000000..104189d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmetalview.m
@@ -0,0 +1,124 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+ */
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com.
+ *
+ * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing
+ * how to add a CAMetalLayer backed view.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN)
+
+#import "../SDL_sysvideo.h"
+#import "SDL_uikitwindow.h"
+#import "SDL_uikitmetalview.h"
+
+#include "SDL_assert.h"
+
+@implementation SDL_uikitmetalview
+
+/* Returns a Metal-compatible layer. */
++ (Class)layerClass
+{
+ return [CAMetalLayer class];
+}
+
+- (instancetype)initWithFrame:(CGRect)frame
+ scale:(CGFloat)scale
+{
+ if ((self = [super initWithFrame:frame])) {
+ self.tag = METALVIEW_TAG;
+ /* Set the desired scale. The default drawableSize of a CAMetalLayer
+ * is its bounds x its scale so nothing further needs to be done. */
+ self.layer.contentsScale = scale;
+ }
+
+ return self;
+}
+
+/* Set the size of the metal drawables when the view is resized. */
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+}
+
+@end
+
+SDL_uikitmetalview*
+UIKit_Mtl_AddMetalView(SDL_Window* window)
+{
+ SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+ SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view;
+ CGFloat scale = 1.0;
+
+ if ([view isKindOfClass:[SDL_uikitmetalview class]]) {
+ return (SDL_uikitmetalview *)view;
+ }
+
+ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ /* Set the scale to the natural scale factor of the screen - then
+ * the backing dimensions of the Metal view will match the pixel
+ * dimensions of the screen rather than the dimensions in points
+ * yielding high resolution on retine displays.
+ */
+#ifdef __IPHONE_8_0
+ if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) {
+ scale = data.uiwindow.screen.nativeScale;
+ } else
+#endif
+ {
+ scale = data.uiwindow.screen.scale;
+ }
+ }
+ SDL_uikitmetalview *metalview
+ = [[SDL_uikitmetalview alloc] initWithFrame:view.frame
+ scale:scale];
+ [metalview setSDLWindow:window];
+
+ return metalview;
+}
+
+void
+UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h)
+{
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+ SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view;
+ SDL_uikitmetalview* metalview = [view viewWithTag:METALVIEW_TAG];
+ if (metalview) {
+ CAMetalLayer *layer = (CAMetalLayer*)metalview.layer;
+ assert(layer != NULL);
+ if (w) {
+ *w = layer.drawableSize.width;
+ }
+ if (h) {
+ *h = layer.drawableSize.height;
+ }
+ } else {
+ SDL_GetWindowSize(window, w, h);
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.h
new file mode 100644
index 0000000..a1df0d4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.h
@@ -0,0 +1,50 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_uikitmodes_h_
+#define SDL_uikitmodes_h_
+
+#include "SDL_uikitvideo.h"
+
+@interface SDL_DisplayData : NSObject
+
+@property (nonatomic, strong) UIScreen *uiscreen;
+
+@end
+
+@interface SDL_DisplayModeData : NSObject
+
+@property (nonatomic, strong) UIScreenMode *uiscreenmode;
+
+@end
+
+extern SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen);
+
+extern int UIKit_InitModes(_THIS);
+extern void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+extern void UIKit_QuitModes(_THIS);
+extern int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+
+#endif /* SDL_uikitmodes_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.m
new file mode 100644
index 0000000..75e256b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitmodes.m
@@ -0,0 +1,324 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_assert.h"
+#include "SDL_uikitmodes.h"
+
+@implementation SDL_DisplayData
+
+@synthesize uiscreen;
+
+@end
+
+@implementation SDL_DisplayModeData
+
+@synthesize uiscreenmode;
+
+@end
+
+
+static int
+UIKit_AllocateDisplayModeData(SDL_DisplayMode * mode,
+ UIScreenMode * uiscreenmode)
+{
+ SDL_DisplayModeData *data = nil;
+
+ if (uiscreenmode != nil) {
+ /* Allocate the display mode data */
+ data = [[SDL_DisplayModeData alloc] init];
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+
+ data.uiscreenmode = uiscreenmode;
+ }
+
+ mode->driverdata = (void *) CFBridgingRetain(data);
+
+ return 0;
+}
+
+static void
+UIKit_FreeDisplayModeData(SDL_DisplayMode * mode)
+{
+ if (mode->driverdata != NULL) {
+ CFRelease(mode->driverdata);
+ mode->driverdata = NULL;
+ }
+}
+
+static NSUInteger
+UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen)
+{
+#ifdef __IPHONE_10_3
+ if ([uiscreen respondsToSelector:@selector(maximumFramesPerSecond)]) {
+ return uiscreen.maximumFramesPerSecond;
+ }
+#endif
+ return 0;
+}
+
+static int
+UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h,
+ UIScreen * uiscreen, UIScreenMode * uiscreenmode)
+{
+ SDL_DisplayMode mode;
+ SDL_zero(mode);
+
+ if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
+ return -1;
+ }
+
+ mode.format = SDL_PIXELFORMAT_ABGR8888;
+ mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen);
+ mode.w = w;
+ mode.h = h;
+
+ if (SDL_AddDisplayMode(display, &mode)) {
+ return 0;
+ } else {
+ UIKit_FreeDisplayModeData(&mode);
+ return -1;
+ }
+}
+
+static int
+UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, UIScreen * uiscreen,
+ UIScreenMode * uiscreenmode, SDL_bool addRotation)
+{
+ if (UIKit_AddSingleDisplayMode(display, w, h, uiscreen, uiscreenmode) < 0) {
+ return -1;
+ }
+
+ if (addRotation) {
+ /* Add the rotated version */
+ if (UIKit_AddSingleDisplayMode(display, h, w, uiscreen, uiscreenmode) < 0) {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int
+UIKit_AddDisplay(UIScreen *uiscreen)
+{
+ UIScreenMode *uiscreenmode = uiscreen.currentMode;
+ CGSize size = uiscreen.bounds.size;
+ SDL_VideoDisplay display;
+ SDL_DisplayMode mode;
+ SDL_zero(mode);
+
+ /* Make sure the width/height are oriented correctly */
+ if (UIKit_IsDisplayLandscape(uiscreen) != (size.width > size.height)) {
+ CGFloat height = size.width;
+ size.width = size.height;
+ size.height = height;
+ }
+
+ mode.format = SDL_PIXELFORMAT_ABGR8888;
+ mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen);
+ mode.w = (int) size.width;
+ mode.h = (int) size.height;
+
+ if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
+ return -1;
+ }
+
+ SDL_zero(display);
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+
+ /* Allocate the display data */
+ SDL_DisplayData *data = [[SDL_DisplayData alloc] init];
+ if (!data) {
+ UIKit_FreeDisplayModeData(&display.desktop_mode);
+ return SDL_OutOfMemory();
+ }
+
+ data.uiscreen = uiscreen;
+
+ display.driverdata = (void *) CFBridgingRetain(data);
+ SDL_AddVideoDisplay(&display);
+
+ return 0;
+}
+
+SDL_bool
+UIKit_IsDisplayLandscape(UIScreen *uiscreen)
+{
+#if !TARGET_OS_TV
+ if (uiscreen == [UIScreen mainScreen]) {
+ return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
+ } else
+#endif /* !TARGET_OS_TV */
+ {
+ CGSize size = uiscreen.bounds.size;
+ return (size.width > size.height);
+ }
+}
+
+int
+UIKit_InitModes(_THIS)
+{
+ @autoreleasepool {
+ for (UIScreen *uiscreen in [UIScreen screens]) {
+ if (UIKit_AddDisplay(uiscreen) < 0) {
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+void
+UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ @autoreleasepool {
+ SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
+
+ SDL_bool isLandscape = UIKit_IsDisplayLandscape(data.uiscreen);
+ SDL_bool addRotation = (data.uiscreen == [UIScreen mainScreen]);
+ CGFloat scale = data.uiscreen.scale;
+ NSArray *availableModes = nil;
+
+#if TARGET_OS_TV
+ addRotation = SDL_FALSE;
+ availableModes = @[data.uiscreen.currentMode];
+#else
+ availableModes = data.uiscreen.availableModes;
+#endif
+
+#ifdef __IPHONE_8_0
+ /* The UIScreenMode of an iPhone 6 Plus should be 1080x1920 rather than
+ * 1242x2208 (414x736@3x), so we should use the native scale. */
+ if ([data.uiscreen respondsToSelector:@selector(nativeScale)]) {
+ scale = data.uiscreen.nativeScale;
+ }
+#endif
+
+ for (UIScreenMode *uimode in availableModes) {
+ /* The size of a UIScreenMode is in pixels, but we deal exclusively
+ * in points (except in SDL_GL_GetDrawableSize.) */
+ int w = (int)(uimode.size.width / scale);
+ int h = (int)(uimode.size.height / scale);
+
+ /* Make sure the width/height are oriented correctly */
+ if (isLandscape != (w > h)) {
+ int tmp = w;
+ w = h;
+ h = tmp;
+ }
+
+ UIKit_AddDisplayMode(display, w, h, data.uiscreen, uimode, addRotation);
+ }
+ }
+}
+
+int
+UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ @autoreleasepool {
+ SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
+
+#if !TARGET_OS_TV
+ SDL_DisplayModeData *modedata = (__bridge SDL_DisplayModeData *)mode->driverdata;
+ [data.uiscreen setCurrentMode:modedata.uiscreenmode];
+#endif
+
+ if (data.uiscreen == [UIScreen mainScreen]) {
+ /* [UIApplication setStatusBarOrientation:] no longer works reliably
+ * in recent iOS versions, so we can't rotate the screen when setting
+ * the display mode. */
+ if (mode->w > mode->h) {
+ if (!UIKit_IsDisplayLandscape(data.uiscreen)) {
+ return SDL_SetError("Screen orientation does not match display mode size");
+ }
+ } else if (mode->w < mode->h) {
+ if (UIKit_IsDisplayLandscape(data.uiscreen)) {
+ return SDL_SetError("Screen orientation does not match display mode size");
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+int
+UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
+{
+ @autoreleasepool {
+ int displayIndex = (int) (display - _this->displays);
+ SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
+ CGRect frame = data.uiscreen.bounds;
+
+ /* the default function iterates displays to make a fake offset,
+ as if all the displays were side-by-side, which is fine for iOS. */
+ if (SDL_GetDisplayBounds(displayIndex, rect) < 0) {
+ return -1;
+ }
+
+#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
+ if (!UIKit_IsSystemVersionAtLeast(7.0)) {
+ frame = [data.uiscreen applicationFrame];
+ }
+#endif
+
+ rect->x += frame.origin.x;
+ rect->y += frame.origin.y;
+ rect->w = frame.size.width;
+ rect->h = frame.size.height;
+ }
+
+ return 0;
+}
+
+void
+UIKit_QuitModes(_THIS)
+{
+ /* Release Objective-C objects, so higher level doesn't free() them. */
+ int i, j;
+ @autoreleasepool {
+ for (i = 0; i < _this->num_displays; i++) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+
+ UIKit_FreeDisplayModeData(&display->desktop_mode);
+ for (j = 0; j < display->num_display_modes; j++) {
+ SDL_DisplayMode *mode = &display->display_modes[j];
+ UIKit_FreeDisplayModeData(mode);
+ }
+
+ if (display->driverdata != NULL) {
+ CFRelease(display->driverdata);
+ display->driverdata = NULL;
+ }
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.h
new file mode 100644
index 0000000..6b57289
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_uikitopengles_
+#define SDL_uikitopengles_
+
+#include "../SDL_sysvideo.h"
+
+extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window,
+ SDL_GLContext context);
+extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window,
+ int * w, int * h);
+extern int UIKit_GL_SwapWindow(_THIS, SDL_Window * window);
+extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window);
+extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc);
+extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
+
+extern void UIKit_GL_RestoreCurrentContext(void);
+
+#endif /* SDL_uikitopengles_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.m
new file mode 100644
index 0000000..2f6dec4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopengles.m
@@ -0,0 +1,250 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_uikitopengles.h"
+#import "SDL_uikitopenglview.h"
+#include "SDL_uikitmodes.h"
+#include "SDL_uikitwindow.h"
+#include "SDL_uikitevents.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../power/uikit/SDL_syspower.h"
+#include "SDL_loadso.h"
+#include <dlfcn.h>
+
+@interface SDLEAGLContext : EAGLContext
+
+/* The OpenGL ES context owns a view / drawable. */
+@property (nonatomic, strong) SDL_uikitopenglview *sdlView;
+
+@end
+
+@implementation SDLEAGLContext
+
+- (void)dealloc
+{
+ /* When the context is deallocated, its view should be removed from any
+ * SDL window that it's attached to. */
+ [self.sdlView setSDLWindow:NULL];
+}
+
+@end
+
+void *
+UIKit_GL_GetProcAddress(_THIS, const char *proc)
+{
+ /* Look through all SO's for the proc symbol. Here's why:
+ * -Looking for the path to the OpenGL Library seems not to work in the iOS Simulator.
+ * -We don't know that the path won't change in the future. */
+ return dlsym(RTLD_DEFAULT, proc);
+}
+
+/*
+ note that SDL_GL_DeleteContext makes it current without passing the window
+*/
+int
+UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ @autoreleasepool {
+ SDLEAGLContext *eaglcontext = (__bridge SDLEAGLContext *) context;
+
+ if (![EAGLContext setCurrentContext:eaglcontext]) {
+ return SDL_SetError("Could not make EAGL context current");
+ }
+
+ if (eaglcontext) {
+ [eaglcontext.sdlView setSDLWindow:window];
+ }
+ }
+
+ return 0;
+}
+
+void
+UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
+{
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+ UIView *view = data.viewcontroller.view;
+ if ([view isKindOfClass:[SDL_uikitopenglview class]]) {
+ SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
+ if (w) {
+ *w = glview.backingWidth;
+ }
+ if (h) {
+ *h = glview.backingHeight;
+ }
+ }
+ }
+}
+
+int
+UIKit_GL_LoadLibrary(_THIS, const char *path)
+{
+ /* We shouldn't pass a path to this function, since we've already loaded the
+ * library. */
+ if (path != NULL) {
+ return SDL_SetError("iOS GL Load Library just here for compatibility");
+ }
+ return 0;
+}
+
+int UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
+{
+ @autoreleasepool {
+ SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext();
+
+#if SDL_POWER_UIKIT
+ /* Check once a frame to see if we should turn off the battery monitor. */
+ SDL_UIKit_UpdateBatteryMonitoring();
+#endif
+
+ [context.sdlView swapBuffers];
+
+ /* You need to pump events in order for the OS to make changes visible.
+ * We don't pump events here because we don't want iOS application events
+ * (low memory, terminate, etc.) to happen inside low level rendering. */
+ }
+ return 0;
+}
+
+SDL_GLContext
+UIKit_GL_CreateContext(_THIS, SDL_Window * window)
+{
+ @autoreleasepool {
+ SDLEAGLContext *context = nil;
+ SDL_uikitopenglview *view;
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ CGRect frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen);
+ EAGLSharegroup *sharegroup = nil;
+ CGFloat scale = 1.0;
+ int samples = 0;
+ int major = _this->gl_config.major_version;
+ int minor = _this->gl_config.minor_version;
+
+ /* The EAGLRenderingAPI enum values currently map 1:1 to major GLES
+ * versions. */
+ EAGLRenderingAPI api = major;
+
+ /* iOS currently doesn't support GLES >3.0. iOS 6 also only supports up
+ * to GLES 2.0. */
+ if (major > 3 || (major == 3 && (minor > 0 || !UIKit_IsSystemVersionAtLeast(7.0)))) {
+ SDL_SetError("OpenGL ES %d.%d context could not be created", major, minor);
+ return NULL;
+ }
+
+ if (_this->gl_config.multisamplebuffers > 0) {
+ samples = _this->gl_config.multisamplesamples;
+ }
+
+ if (_this->gl_config.share_with_current_context) {
+ EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext();
+ sharegroup = context.sharegroup;
+ }
+
+ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+ /* Set the scale to the natural scale factor of the screen - the
+ * backing dimensions of the OpenGL view will match the pixel
+ * dimensions of the screen rather than the dimensions in points. */
+#ifdef __IPHONE_8_0
+ if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) {
+ scale = data.uiwindow.screen.nativeScale;
+ } else
+#endif
+ {
+ scale = data.uiwindow.screen.scale;
+ }
+ }
+
+ context = [[SDLEAGLContext alloc] initWithAPI:api sharegroup:sharegroup];
+ if (!context) {
+ SDL_SetError("OpenGL ES %d context could not be created", _this->gl_config.major_version);
+ return NULL;
+ }
+
+ /* construct our view, passing in SDL's OpenGL configuration data */
+ view = [[SDL_uikitopenglview alloc] initWithFrame:frame
+ scale:scale
+ retainBacking:_this->gl_config.retained_backing
+ rBits:_this->gl_config.red_size
+ gBits:_this->gl_config.green_size
+ bBits:_this->gl_config.blue_size
+ aBits:_this->gl_config.alpha_size
+ depthBits:_this->gl_config.depth_size
+ stencilBits:_this->gl_config.stencil_size
+ sRGB:_this->gl_config.framebuffer_srgb_capable
+ multisamples:samples
+ context:context];
+
+ if (!view) {
+ return NULL;
+ }
+
+ /* The context owns the view / drawable. */
+ context.sdlView = view;
+
+ if (UIKit_GL_MakeCurrent(_this, window, (__bridge SDL_GLContext) context) < 0) {
+ UIKit_GL_DeleteContext(_this, (SDL_GLContext) CFBridgingRetain(context));
+ return NULL;
+ }
+
+ /* We return a +1'd context. The window's driverdata owns the view (via
+ * MakeCurrent.) */
+ return (SDL_GLContext) CFBridgingRetain(context);
+ }
+}
+
+void
+UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ @autoreleasepool {
+ /* The context was retained in SDL_GL_CreateContext, so we release it
+ * here. The context's view will be detached from its window when the
+ * context is deallocated. */
+ CFRelease(context);
+ }
+}
+
+void
+UIKit_GL_RestoreCurrentContext(void)
+{
+ @autoreleasepool {
+ /* Some iOS system functionality (such as Dictation on the on-screen
+ keyboard) uses its own OpenGL ES context but doesn't restore the
+ previous one when it's done. This is a workaround to make sure the
+ expected SDL-created OpenGL ES context is active after the OS is
+ finished running its own code for the frame. If this isn't done, the
+ app may crash or have other nasty symptoms when Dictation is used.
+ */
+ EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext();
+ if (context != NULL && [EAGLContext currentContext] != context) {
+ [EAGLContext setCurrentContext:context];
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.h
new file mode 100644
index 0000000..8d12c9f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.h
@@ -0,0 +1,60 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#import <UIKit/UIKit.h>
+#import <OpenGLES/EAGL.h>
+#import <OpenGLES/ES3/gl.h>
+
+#import "SDL_uikitview.h"
+#include "SDL_uikitvideo.h"
+
+@interface SDL_uikitopenglview : SDL_uikitview
+
+- (instancetype)initWithFrame:(CGRect)frame
+ scale:(CGFloat)scale
+ retainBacking:(BOOL)retained
+ rBits:(int)rBits
+ gBits:(int)gBits
+ bBits:(int)bBits
+ aBits:(int)aBits
+ depthBits:(int)depthBits
+ stencilBits:(int)stencilBits
+ sRGB:(BOOL)sRGB
+ multisamples:(int)multisamples
+ context:(EAGLContext *)glcontext;
+
+@property (nonatomic, readonly, weak) EAGLContext *context;
+
+/* The width and height of the drawable in pixels (as opposed to points.) */
+@property (nonatomic, readonly) int backingWidth;
+@property (nonatomic, readonly) int backingHeight;
+
+@property (nonatomic, readonly) GLuint drawableRenderbuffer;
+@property (nonatomic, readonly) GLuint drawableFramebuffer;
+@property (nonatomic, readonly) GLuint msaaResolveFramebuffer;
+
+- (void)swapBuffers;
+
+- (void)updateFrame;
+
+@end
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.m
new file mode 100644
index 0000000..b0628bf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitopenglview.m
@@ -0,0 +1,384 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include <OpenGLES/EAGLDrawable.h>
+#include <OpenGLES/ES2/glext.h>
+#import "SDL_uikitopenglview.h"
+#include "SDL_uikitwindow.h"
+
+@implementation SDL_uikitopenglview {
+ /* The renderbuffer and framebuffer used to render to this layer. */
+ GLuint viewRenderbuffer, viewFramebuffer;
+
+ /* The depth buffer that is attached to viewFramebuffer, if it exists. */
+ GLuint depthRenderbuffer;
+
+ GLenum colorBufferFormat;
+
+ /* format of depthRenderbuffer */
+ GLenum depthBufferFormat;
+
+ /* The framebuffer and renderbuffer used for rendering with MSAA. */
+ GLuint msaaFramebuffer, msaaRenderbuffer;
+
+ /* The number of MSAA samples. */
+ int samples;
+
+ BOOL retainedBacking;
+}
+
+@synthesize context;
+@synthesize backingWidth;
+@synthesize backingHeight;
+
++ (Class)layerClass
+{
+ return [CAEAGLLayer class];
+}
+
+- (instancetype)initWithFrame:(CGRect)frame
+ scale:(CGFloat)scale
+ retainBacking:(BOOL)retained
+ rBits:(int)rBits
+ gBits:(int)gBits
+ bBits:(int)bBits
+ aBits:(int)aBits
+ depthBits:(int)depthBits
+ stencilBits:(int)stencilBits
+ sRGB:(BOOL)sRGB
+ multisamples:(int)multisamples
+ context:(EAGLContext *)glcontext
+{
+ if ((self = [super initWithFrame:frame])) {
+ const BOOL useStencilBuffer = (stencilBits != 0);
+ const BOOL useDepthBuffer = (depthBits != 0);
+ NSString *colorFormat = nil;
+
+ context = glcontext;
+ samples = multisamples;
+ retainedBacking = retained;
+
+ if (!context || ![EAGLContext setCurrentContext:context]) {
+ SDL_SetError("Could not create OpenGL ES drawable (could not make context current)");
+ return nil;
+ }
+
+ if (samples > 0) {
+ GLint maxsamples = 0;
+ glGetIntegerv(GL_MAX_SAMPLES, &maxsamples);
+
+ /* Clamp the samples to the max supported count. */
+ samples = MIN(samples, maxsamples);
+ }
+
+ if (sRGB) {
+ /* sRGB EAGL drawable support was added in iOS 7. */
+ if (UIKit_IsSystemVersionAtLeast(7.0)) {
+ colorFormat = kEAGLColorFormatSRGBA8;
+ colorBufferFormat = GL_SRGB8_ALPHA8;
+ } else {
+ SDL_SetError("sRGB drawables are not supported.");
+ return nil;
+ }
+ } else if (rBits >= 8 || gBits >= 8 || bBits >= 8) {
+ /* if user specifically requests rbg888 or some color format higher than 16bpp */
+ colorFormat = kEAGLColorFormatRGBA8;
+ colorBufferFormat = GL_RGBA8;
+ } else {
+ /* default case (potentially faster) */
+ colorFormat = kEAGLColorFormatRGB565;
+ colorBufferFormat = GL_RGB565;
+ }
+
+ CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
+
+ eaglLayer.opaque = YES;
+ eaglLayer.drawableProperties = @{
+ kEAGLDrawablePropertyRetainedBacking:@(retained),
+ kEAGLDrawablePropertyColorFormat:colorFormat
+ };
+
+ /* Set the appropriate scale (for retina display support) */
+ self.contentScaleFactor = scale;
+
+ /* Create the color Renderbuffer Object */
+ glGenRenderbuffers(1, &viewRenderbuffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
+
+ if (![context renderbufferStorage:GL_RENDERBUFFER fromDrawable:eaglLayer]) {
+ SDL_SetError("Failed to create OpenGL ES drawable");
+ return nil;
+ }
+
+ /* Create the Framebuffer Object */
+ glGenFramebuffers(1, &viewFramebuffer);
+ glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer);
+
+ /* attach the color renderbuffer to the FBO */
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, viewRenderbuffer);
+
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &backingWidth);
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &backingHeight);
+
+ if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+ SDL_SetError("Failed creating OpenGL ES framebuffer");
+ return nil;
+ }
+
+ /* When MSAA is used we'll use a separate framebuffer for rendering to,
+ * since we'll need to do an explicit MSAA resolve before presenting. */
+ if (samples > 0) {
+ glGenFramebuffers(1, &msaaFramebuffer);
+ glBindFramebuffer(GL_FRAMEBUFFER, msaaFramebuffer);
+
+ glGenRenderbuffers(1, &msaaRenderbuffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, msaaRenderbuffer);
+
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, colorBufferFormat, backingWidth, backingHeight);
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, msaaRenderbuffer);
+ }
+
+ if (useDepthBuffer || useStencilBuffer) {
+ if (useStencilBuffer) {
+ /* Apparently you need to pack stencil and depth into one buffer. */
+ depthBufferFormat = GL_DEPTH24_STENCIL8_OES;
+ } else if (useDepthBuffer) {
+ /* iOS only uses 32-bit float (exposed as fixed point 24-bit)
+ * depth buffers. */
+ depthBufferFormat = GL_DEPTH_COMPONENT24_OES;
+ }
+
+ glGenRenderbuffers(1, &depthRenderbuffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
+
+ if (samples > 0) {
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, depthBufferFormat, backingWidth, backingHeight);
+ } else {
+ glRenderbufferStorage(GL_RENDERBUFFER, depthBufferFormat, backingWidth, backingHeight);
+ }
+
+ if (useDepthBuffer) {
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);
+ }
+ if (useStencilBuffer) {
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);
+ }
+ }
+
+ if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+ SDL_SetError("Failed creating OpenGL ES framebuffer");
+ return nil;
+ }
+
+ glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
+
+ [self setDebugLabels];
+ }
+
+ return self;
+}
+
+- (GLuint)drawableRenderbuffer
+{
+ return viewRenderbuffer;
+}
+
+- (GLuint)drawableFramebuffer
+{
+ /* When MSAA is used, the MSAA draw framebuffer is used for drawing. */
+ if (msaaFramebuffer) {
+ return msaaFramebuffer;
+ } else {
+ return viewFramebuffer;
+ }
+}
+
+- (GLuint)msaaResolveFramebuffer
+{
+ /* When MSAA is used, the MSAA draw framebuffer is used for drawing and the
+ * view framebuffer is used as a MSAA resolve framebuffer. */
+ if (msaaFramebuffer) {
+ return viewFramebuffer;
+ } else {
+ return 0;
+ }
+}
+
+- (void)updateFrame
+{
+ GLint prevRenderbuffer = 0;
+ glGetIntegerv(GL_RENDERBUFFER_BINDING, &prevRenderbuffer);
+
+ glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer);
+ [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer *)self.layer];
+
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &backingWidth);
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &backingHeight);
+
+ if (msaaRenderbuffer != 0) {
+ glBindRenderbuffer(GL_RENDERBUFFER, msaaRenderbuffer);
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, colorBufferFormat, backingWidth, backingHeight);
+ }
+
+ if (depthRenderbuffer != 0) {
+ glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
+
+ if (samples > 0) {
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, depthBufferFormat, backingWidth, backingHeight);
+ } else {
+ glRenderbufferStorage(GL_RENDERBUFFER, depthBufferFormat, backingWidth, backingHeight);
+ }
+ }
+
+ glBindRenderbuffer(GL_RENDERBUFFER, prevRenderbuffer);
+}
+
+- (void)setDebugLabels
+{
+ if (viewFramebuffer != 0) {
+ glLabelObjectEXT(GL_FRAMEBUFFER, viewFramebuffer, 0, "context FBO");
+ }
+
+ if (viewRenderbuffer != 0) {
+ glLabelObjectEXT(GL_RENDERBUFFER, viewRenderbuffer, 0, "context color buffer");
+ }
+
+ if (depthRenderbuffer != 0) {
+ if (depthBufferFormat == GL_DEPTH24_STENCIL8_OES) {
+ glLabelObjectEXT(GL_RENDERBUFFER, depthRenderbuffer, 0, "context depth-stencil buffer");
+ } else {
+ glLabelObjectEXT(GL_RENDERBUFFER, depthRenderbuffer, 0, "context depth buffer");
+ }
+ }
+
+ if (msaaFramebuffer != 0) {
+ glLabelObjectEXT(GL_FRAMEBUFFER, msaaFramebuffer, 0, "context MSAA FBO");
+ }
+
+ if (msaaRenderbuffer != 0) {
+ glLabelObjectEXT(GL_RENDERBUFFER, msaaRenderbuffer, 0, "context MSAA renderbuffer");
+ }
+}
+
+- (void)swapBuffers
+{
+ if (msaaFramebuffer) {
+ const GLenum attachments[] = {GL_COLOR_ATTACHMENT0};
+
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, viewFramebuffer);
+
+ /* OpenGL ES 3+ provides explicit MSAA resolves via glBlitFramebuffer.
+ * In OpenGL ES 1 and 2, MSAA resolves must be done via an extension. */
+ if (context.API >= kEAGLRenderingAPIOpenGLES3) {
+ int w = backingWidth;
+ int h = backingHeight;
+ glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+
+ if (!retainedBacking) {
+ /* Discard the contents of the MSAA drawable color buffer. */
+ glInvalidateFramebuffer(GL_READ_FRAMEBUFFER, 1, attachments);
+ }
+ } else {
+ glResolveMultisampleFramebufferAPPLE();
+
+ if (!retainedBacking) {
+ glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER, 1, attachments);
+ }
+ }
+
+ /* We assume the "drawable framebuffer" (MSAA draw framebuffer) was
+ * previously bound... */
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, msaaFramebuffer);
+ }
+
+ /* viewRenderbuffer should always be bound here. Code that binds something
+ * else is responsible for rebinding viewRenderbuffer, to reduce duplicate
+ * state changes. */
+ [context presentRenderbuffer:GL_RENDERBUFFER];
+}
+
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+
+ int width = (int) (self.bounds.size.width * self.contentScaleFactor);
+ int height = (int) (self.bounds.size.height * self.contentScaleFactor);
+
+ /* Update the color and depth buffer storage if the layer size has changed. */
+ if (width != backingWidth || height != backingHeight) {
+ EAGLContext *prevContext = [EAGLContext currentContext];
+ if (prevContext != context) {
+ [EAGLContext setCurrentContext:context];
+ }
+
+ [self updateFrame];
+
+ if (prevContext != context) {
+ [EAGLContext setCurrentContext:prevContext];
+ }
+ }
+}
+
+- (void)destroyFramebuffer
+{
+ if (viewFramebuffer != 0) {
+ glDeleteFramebuffers(1, &viewFramebuffer);
+ viewFramebuffer = 0;
+ }
+
+ if (viewRenderbuffer != 0) {
+ glDeleteRenderbuffers(1, &viewRenderbuffer);
+ viewRenderbuffer = 0;
+ }
+
+ if (depthRenderbuffer != 0) {
+ glDeleteRenderbuffers(1, &depthRenderbuffer);
+ depthRenderbuffer = 0;
+ }
+
+ if (msaaFramebuffer != 0) {
+ glDeleteFramebuffers(1, &msaaFramebuffer);
+ msaaFramebuffer = 0;
+ }
+
+ if (msaaRenderbuffer != 0) {
+ glDeleteRenderbuffers(1, &msaaRenderbuffer);
+ msaaRenderbuffer = 0;
+ }
+}
+
+- (void)dealloc
+{
+ if (context && context == [EAGLContext currentContext]) {
+ [self destroyFramebuffer];
+ [EAGLContext setCurrentContext:nil];
+ }
+}
+
+@end
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.h
new file mode 100644
index 0000000..e24183a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.h
@@ -0,0 +1,46 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_uikitvideo_h_
+#define SDL_uikitvideo_h_
+
+#include "../SDL_sysvideo.h"
+
+#ifdef __OBJC__
+
+#include <UIKit/UIKit.h>
+
+@interface SDL_VideoData : NSObject
+
+@property (nonatomic, assign) id pasteboardObserver;
+
+@end
+
+CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen);
+
+#endif /* __OBJC__ */
+
+void UIKit_SuspendScreenSaver(_THIS);
+
+SDL_bool UIKit_IsSystemVersionAtLeast(double version);
+
+#endif /* SDL_uikitvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.m
new file mode 100644
index 0000000..e74339f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvideo.m
@@ -0,0 +1,238 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#import <UIKit/UIKit.h>
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_hints.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_uikitvideo.h"
+#include "SDL_uikitevents.h"
+#include "SDL_uikitmodes.h"
+#include "SDL_uikitwindow.h"
+#include "SDL_uikitopengles.h"
+#include "SDL_uikitclipboard.h"
+#include "SDL_uikitvulkan.h"
+
+#define UIKITVID_DRIVER_NAME "uikit"
+
+@implementation SDL_VideoData
+
+@end
+
+/* Initialization/Query functions */
+static int UIKit_VideoInit(_THIS);
+static void UIKit_VideoQuit(_THIS);
+
+/* DUMMY driver bootstrap functions */
+
+static int
+UIKit_Available(void)
+{
+ return 1;
+}
+
+static void UIKit_DeleteDevice(SDL_VideoDevice * device)
+{
+ @autoreleasepool {
+ CFRelease(device->driverdata);
+ SDL_free(device);
+ }
+}
+
+static SDL_VideoDevice *
+UIKit_CreateDevice(int devindex)
+{
+ @autoreleasepool {
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device) {
+ data = [SDL_VideoData new];
+ } else {
+ SDL_free(device);
+ SDL_OutOfMemory();
+ return (0);
+ }
+
+ device->driverdata = (void *) CFBridgingRetain(data);
+
+ /* Set the function pointers */
+ device->VideoInit = UIKit_VideoInit;
+ device->VideoQuit = UIKit_VideoQuit;
+ device->GetDisplayModes = UIKit_GetDisplayModes;
+ device->SetDisplayMode = UIKit_SetDisplayMode;
+ device->PumpEvents = UIKit_PumpEvents;
+ device->SuspendScreenSaver = UIKit_SuspendScreenSaver;
+ device->CreateSDLWindow = UIKit_CreateWindow;
+ device->SetWindowTitle = UIKit_SetWindowTitle;
+ device->ShowWindow = UIKit_ShowWindow;
+ device->HideWindow = UIKit_HideWindow;
+ device->RaiseWindow = UIKit_RaiseWindow;
+ device->SetWindowBordered = UIKit_SetWindowBordered;
+ device->SetWindowFullscreen = UIKit_SetWindowFullscreen;
+ device->DestroyWindow = UIKit_DestroyWindow;
+ device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
+ device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds;
+
+#if SDL_IPHONE_KEYBOARD
+ device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport;
+ device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard;
+ device->HideScreenKeyboard = UIKit_HideScreenKeyboard;
+ device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown;
+ device->SetTextInputRect = UIKit_SetTextInputRect;
+#endif
+
+ device->SetClipboardText = UIKit_SetClipboardText;
+ device->GetClipboardText = UIKit_GetClipboardText;
+ device->HasClipboardText = UIKit_HasClipboardText;
+
+ /* OpenGL (ES) functions */
+ device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
+ device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize;
+ device->GL_SwapWindow = UIKit_GL_SwapWindow;
+ device->GL_CreateContext = UIKit_GL_CreateContext;
+ device->GL_DeleteContext = UIKit_GL_DeleteContext;
+ device->GL_GetProcAddress = UIKit_GL_GetProcAddress;
+ device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
+ device->free = UIKit_DeleteDevice;
+
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions
+ = UIKit_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface;
+ device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize;
+#endif
+
+ device->gl_config.accelerated = 1;
+
+ return device;
+ }
+}
+
+VideoBootStrap UIKIT_bootstrap = {
+ UIKITVID_DRIVER_NAME, "SDL UIKit video driver",
+ UIKit_Available, UIKit_CreateDevice
+};
+
+
+int
+UIKit_VideoInit(_THIS)
+{
+ _this->gl_config.driver_loaded = 1;
+
+ if (UIKit_InitModes(_this) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+void
+UIKit_VideoQuit(_THIS)
+{
+ UIKit_QuitModes(_this);
+}
+
+void
+UIKit_SuspendScreenSaver(_THIS)
+{
+ @autoreleasepool {
+ /* Ignore ScreenSaver API calls if the idle timer hint has been set. */
+ /* FIXME: The idle timer hint should be deprecated for SDL 2.1. */
+ if (!SDL_GetHintBoolean(SDL_HINT_IDLE_TIMER_DISABLED, SDL_FALSE)) {
+ UIApplication *app = [UIApplication sharedApplication];
+
+ /* Prevent the display from dimming and going to sleep. */
+ app.idleTimerDisabled = (_this->suspend_screensaver != SDL_FALSE);
+ }
+ }
+}
+
+SDL_bool
+UIKit_IsSystemVersionAtLeast(double version)
+{
+ return [[UIDevice currentDevice].systemVersion doubleValue] >= version;
+}
+
+CGRect
+UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen)
+{
+ CGRect frame = screen.bounds;
+
+#if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)
+ BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0);
+
+ /* The view should always show behind the status bar in iOS 7+. */
+ if (!hasiOS7 && !(window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) {
+ frame = screen.applicationFrame;
+ }
+#endif
+
+#if !TARGET_OS_TV
+ /* iOS 10 seems to have a bug where, in certain conditions, putting the
+ * device to sleep with the a landscape-only app open, re-orienting the
+ * device to portrait, and turning it back on will result in the screen
+ * bounds returning portrait orientation despite the app being in landscape.
+ * This is a workaround until a better solution can be found.
+ * https://bugzilla.libsdl.org/show_bug.cgi?id=3505
+ * https://bugzilla.libsdl.org/show_bug.cgi?id=3465
+ * https://forums.developer.apple.com/thread/65337 */
+ if (UIKit_IsSystemVersionAtLeast(8.0)) {
+ UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;
+ BOOL isLandscape = UIInterfaceOrientationIsLandscape(orient);
+
+ if (isLandscape != (frame.size.width > frame.size.height)) {
+ float height = frame.size.width;
+ frame.size.width = frame.size.height;
+ frame.size.height = height;
+ }
+ }
+#endif
+
+ return frame;
+}
+
+/*
+ * iOS log support.
+ *
+ * This doesn't really have aything to do with the interfaces of the SDL video
+ * subsystem, but we need to stuff this into an Objective-C source code file.
+ */
+
+void SDL_NSLog(const char *text)
+{
+ NSLog(@"%s", text);
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.h
new file mode 100644
index 0000000..4457f6c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.h
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#import <UIKit/UIKit.h>
+
+#include "../SDL_sysvideo.h"
+
+#include "SDL_touch.h"
+
+@interface SDL_uikitview : UIView
+
+- (instancetype)initWithFrame:(CGRect)frame;
+
+- (void)setSDLWindow:(SDL_Window *)window;
+
+- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize;
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
+
+@end
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.m
new file mode 100644
index 0000000..bd60c55
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitview.m
@@ -0,0 +1,328 @@
+ /*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_uikitview.h"
+
+#include "SDL_hints.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+#include "../../events/SDL_events_c.h"
+
+#import "SDL_uikitappdelegate.h"
+#import "SDL_uikitmodes.h"
+#import "SDL_uikitwindow.h"
+
+/* This is defined in SDL_sysjoystick.m */
+extern int SDL_AppleTVRemoteOpenedAsJoystick;
+
+@implementation SDL_uikitview {
+ SDL_Window *sdlwindow;
+
+ SDL_TouchID touchId;
+ UITouch * __weak firstFingerDown;
+}
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+ if ((self = [super initWithFrame:frame])) {
+#if TARGET_OS_TV
+ /* Apple TV Remote touchpad swipe gestures. */
+ UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
+ swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
+ [self addGestureRecognizer:swipeUp];
+
+ UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
+ swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
+ [self addGestureRecognizer:swipeDown];
+
+ UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
+ swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
+ [self addGestureRecognizer:swipeLeft];
+
+ UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
+ swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
+ [self addGestureRecognizer:swipeRight];
+#endif
+
+ self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ self.autoresizesSubviews = YES;
+
+#if !TARGET_OS_TV
+ self.multipleTouchEnabled = YES;
+#endif
+
+ touchId = 1;
+ SDL_AddTouch(touchId, "");
+ }
+
+ return self;
+}
+
+- (void)setSDLWindow:(SDL_Window *)window
+{
+ SDL_WindowData *data = nil;
+
+ if (window == sdlwindow) {
+ return;
+ }
+
+ /* Remove ourself from the old window. */
+ if (sdlwindow) {
+ SDL_uikitview *view = nil;
+ data = (__bridge SDL_WindowData *) sdlwindow->driverdata;
+
+ [data.views removeObject:self];
+
+ [self removeFromSuperview];
+
+ /* Restore the next-oldest view in the old window. */
+ view = data.views.lastObject;
+
+ data.viewcontroller.view = view;
+
+ data.uiwindow.rootViewController = nil;
+ data.uiwindow.rootViewController = data.viewcontroller;
+
+ [data.uiwindow layoutIfNeeded];
+ }
+
+ /* Add ourself to the new window. */
+ if (window) {
+ data = (__bridge SDL_WindowData *) window->driverdata;
+
+ /* Make sure the SDL window has a strong reference to this view. */
+ [data.views addObject:self];
+
+ /* Replace the view controller's old view with this one. */
+ [data.viewcontroller.view removeFromSuperview];
+ data.viewcontroller.view = self;
+
+ /* The root view controller handles rotation and the status bar.
+ * Assigning it also adds the controller's view to the window. We
+ * explicitly re-set it to make sure the view is properly attached to
+ * the window. Just adding the sub-view if the root view controller is
+ * already correct causes orientation issues on iOS 7 and below. */
+ data.uiwindow.rootViewController = nil;
+ data.uiwindow.rootViewController = data.viewcontroller;
+
+ /* The view's bounds may not be correct until the next event cycle. That
+ * might happen after the current dimensions are queried, so we force a
+ * layout now to immediately update the bounds. */
+ [data.uiwindow layoutIfNeeded];
+ }
+
+ sdlwindow = window;
+}
+
+- (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
+{
+ CGPoint point = [touch locationInView:self];
+
+ if (normalize) {
+ CGRect bounds = self.bounds;
+ point.x /= bounds.size.width;
+ point.y /= bounds.size.height;
+ }
+
+ return point;
+}
+
+- (float)pressureForTouch:(UITouch *)touch
+{
+#ifdef __IPHONE_9_0
+ if ([touch respondsToSelector:@selector(force)]) {
+ return (float) touch.force;
+ }
+#endif
+
+ return 1.0f;
+}
+
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ for (UITouch *touch in touches) {
+ float pressure = [self pressureForTouch:touch];
+
+ if (!firstFingerDown) {
+ CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
+ int clicks = (int) touch.tapCount;
+
+ /* send mouse moved event */
+ SDL_SendMouseMotion(sdlwindow, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
+
+ /* send mouse down event */
+ SDL_SendMouseButtonClicks(sdlwindow, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT, clicks);
+
+ firstFingerDown = touch;
+ }
+
+ CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
+ SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
+ SDL_TRUE, locationInView.x, locationInView.y, pressure);
+ }
+}
+
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ for (UITouch *touch in touches) {
+ float pressure = [self pressureForTouch:touch];
+
+ if (touch == firstFingerDown) {
+ /* send mouse up */
+ int clicks = (int) touch.tapCount;
+ SDL_SendMouseButtonClicks(sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT, clicks);
+ firstFingerDown = nil;
+ }
+
+ CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
+ SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
+ SDL_FALSE, locationInView.x, locationInView.y, pressure);
+ }
+}
+
+- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ [self touchesEnded:touches withEvent:event];
+}
+
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ for (UITouch *touch in touches) {
+ float pressure = [self pressureForTouch:touch];
+
+ if (touch == firstFingerDown) {
+ CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
+
+ /* send moved event */
+ SDL_SendMouseMotion(sdlwindow, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
+ }
+
+ CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
+ SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch),
+ locationInView.x, locationInView.y, pressure);
+ }
+}
+
+#if TARGET_OS_TV || defined(__IPHONE_9_1)
+- (SDL_Scancode)scancodeFromPressType:(UIPressType)presstype
+{
+ switch (presstype) {
+ case UIPressTypeUpArrow:
+ return SDL_SCANCODE_UP;
+ case UIPressTypeDownArrow:
+ return SDL_SCANCODE_DOWN;
+ case UIPressTypeLeftArrow:
+ return SDL_SCANCODE_LEFT;
+ case UIPressTypeRightArrow:
+ return SDL_SCANCODE_RIGHT;
+ case UIPressTypeSelect:
+ /* HIG says: "primary button behavior" */
+ return SDL_SCANCODE_RETURN;
+ case UIPressTypeMenu:
+ /* HIG says: "returns to previous screen" */
+ return SDL_SCANCODE_ESCAPE;
+ case UIPressTypePlayPause:
+ /* HIG says: "secondary button behavior" */
+ return SDL_SCANCODE_PAUSE;
+ default:
+ return SDL_SCANCODE_UNKNOWN;
+ }
+}
+
+- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+ for (UIPress *press in presses) {
+ SDL_Scancode scancode = [self scancodeFromPressType:press.type];
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+ }
+ }
+ [super pressesBegan:presses withEvent:event];
+}
+
+- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+ for (UIPress *press in presses) {
+ SDL_Scancode scancode = [self scancodeFromPressType:press.type];
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+ }
+ [super pressesEnded:presses withEvent:event];
+}
+
+- (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+ for (UIPress *press in presses) {
+ SDL_Scancode scancode = [self scancodeFromPressType:press.type];
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+ }
+ [super pressesCancelled:presses withEvent:event];
+}
+
+- (void)pressesChanged:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ /* This is only called when the force of a press changes. */
+ [super pressesChanged:presses withEvent:event];
+}
+#endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */
+
+#if TARGET_OS_TV
+-(void)swipeGesture:(UISwipeGestureRecognizer *)gesture
+{
+ /* Swipe gestures don't trigger begin states. */
+ if (gesture.state == UIGestureRecognizerStateEnded) {
+ if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+ /* Send arrow key presses for now, as we don't have an external API
+ * which better maps to swipe gestures. */
+ switch (gesture.direction) {
+ case UISwipeGestureRecognizerDirectionUp:
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_UP);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_UP);
+ break;
+ case UISwipeGestureRecognizerDirectionDown:
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DOWN);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DOWN);
+ break;
+ case UISwipeGestureRecognizerDirectionLeft:
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LEFT);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LEFT);
+ break;
+ case UISwipeGestureRecognizerDirectionRight:
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RIGHT);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RIGHT);
+ break;
+ }
+ }
+ }
+}
+#endif /* TARGET_OS_TV */
+
+@end
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.h
new file mode 100644
index 0000000..fffb142
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.h
@@ -0,0 +1,91 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#import <UIKit/UIKit.h>
+
+#include "../SDL_sysvideo.h"
+
+#include "SDL_touch.h"
+
+#if TARGET_OS_TV
+#import <GameController/GameController.h>
+#define SDLRootViewController GCEventViewController
+#else
+#define SDLRootViewController UIViewController
+#endif
+
+#if SDL_IPHONE_KEYBOARD
+@interface SDL_uikitviewcontroller : SDLRootViewController <UITextFieldDelegate>
+#else
+@interface SDL_uikitviewcontroller : SDLRootViewController
+#endif
+
+@property (nonatomic, assign) SDL_Window *window;
+
+- (instancetype)initWithSDLWindow:(SDL_Window *)_window;
+
+- (void)setAnimationCallback:(int)interval
+ callback:(void (*)(void*))callback
+ callbackParam:(void*)callbackParam;
+
+- (void)startAnimation;
+- (void)stopAnimation;
+
+- (void)doLoop:(CADisplayLink*)sender;
+
+- (void)loadView;
+- (void)viewDidLayoutSubviews;
+
+#if !TARGET_OS_TV
+- (NSUInteger)supportedInterfaceOrientations;
+- (BOOL)prefersStatusBarHidden;
+- (BOOL)prefersHomeIndicatorAutoHidden;
+- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures;
+
+@property (nonatomic, assign) int homeIndicatorHidden;
+#endif
+
+#if SDL_IPHONE_KEYBOARD
+- (void)showKeyboard;
+- (void)hideKeyboard;
+- (void)initKeyboard;
+- (void)deinitKeyboard;
+
+- (void)keyboardWillShow:(NSNotification *)notification;
+- (void)keyboardWillHide:(NSNotification *)notification;
+
+- (void)updateKeyboard;
+
+@property (nonatomic, assign, getter=isKeyboardVisible) BOOL keyboardVisible;
+@property (nonatomic, assign) SDL_Rect textInputRect;
+@property (nonatomic, assign) int keyboardHeight;
+#endif
+
+@end
+
+#if SDL_IPHONE_KEYBOARD
+SDL_bool UIKit_HasScreenKeyboardSupport(_THIS);
+void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window);
+void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window);
+SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window);
+void UIKit_SetTextInputRect(_THIS, SDL_Rect *rect);
+#endif
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.m
new file mode 100644
index 0000000..2962742
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitviewcontroller.m
@@ -0,0 +1,532 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_video.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
+
+#import "SDL_uikitviewcontroller.h"
+#import "SDL_uikitmessagebox.h"
+#include "SDL_uikitvideo.h"
+#include "SDL_uikitmodes.h"
+#include "SDL_uikitwindow.h"
+#include "SDL_uikitopengles.h"
+
+#if SDL_IPHONE_KEYBOARD
+#include "keyinfotable.h"
+#endif
+
+#if TARGET_OS_TV
+static void SDLCALL
+SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ @autoreleasepool {
+ SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata;
+ viewcontroller.controllerUserInteractionEnabled = hint && (*hint != '0');
+ }
+}
+#endif
+
+#if !TARGET_OS_TV
+static void SDLCALL
+SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
+{
+ @autoreleasepool {
+ SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata;
+ viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1;
+ if (@available(iOS 11.0, *)) {
+ [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden];
+ [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
+ }
+ }
+}
+#endif
+
+@implementation SDL_uikitviewcontroller {
+ CADisplayLink *displayLink;
+ int animationInterval;
+ void (*animationCallback)(void*);
+ void *animationCallbackParam;
+
+#if SDL_IPHONE_KEYBOARD
+ UITextField *textField;
+ BOOL rotatingOrientation;
+#endif
+}
+
+@synthesize window;
+
+- (instancetype)initWithSDLWindow:(SDL_Window *)_window
+{
+ if (self = [super initWithNibName:nil bundle:nil]) {
+ self.window = _window;
+
+#if SDL_IPHONE_KEYBOARD
+ [self initKeyboard];
+ rotatingOrientation = FALSE;
+#endif
+
+#if TARGET_OS_TV
+ SDL_AddHintCallback(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS,
+ SDL_AppleTVControllerUIHintChanged,
+ (__bridge void *) self);
+#endif
+
+#if !TARGET_OS_TV
+ SDL_AddHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR,
+ SDL_HideHomeIndicatorHintChanged,
+ (__bridge void *) self);
+#endif
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+#if SDL_IPHONE_KEYBOARD
+ [self deinitKeyboard];
+#endif
+
+#if TARGET_OS_TV
+ SDL_DelHintCallback(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS,
+ SDL_AppleTVControllerUIHintChanged,
+ (__bridge void *) self);
+#endif
+
+#if !TARGET_OS_TV
+ SDL_DelHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR,
+ SDL_HideHomeIndicatorHintChanged,
+ (__bridge void *) self);
+#endif
+}
+
+- (void)setAnimationCallback:(int)interval
+ callback:(void (*)(void*))callback
+ callbackParam:(void*)callbackParam
+{
+ [self stopAnimation];
+
+ animationInterval = interval;
+ animationCallback = callback;
+ animationCallbackParam = callbackParam;
+
+ if (animationCallback) {
+ [self startAnimation];
+ }
+}
+
+- (void)startAnimation
+{
+ displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)];
+
+#ifdef __IPHONE_10_3
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+
+ if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)]
+ && data != nil && data.uiwindow != nil
+ && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) {
+ displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval;
+ } else
+#endif
+ {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300
+ [displayLink setFrameInterval:animationInterval];
+#endif
+ }
+
+ [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+}
+
+- (void)stopAnimation
+{
+ [displayLink invalidate];
+ displayLink = nil;
+}
+
+- (void)doLoop:(CADisplayLink*)sender
+{
+ /* Don't run the game loop while a messagebox is up */
+ if (!UIKit_ShowingMessageBox()) {
+ /* See the comment in the function definition. */
+ UIKit_GL_RestoreCurrentContext();
+
+ animationCallback(animationCallbackParam);
+ }
+}
+
+- (void)loadView
+{
+ /* Do nothing. */
+}
+
+- (void)viewDidLayoutSubviews
+{
+ const CGSize size = self.view.bounds.size;
+ int w = (int) size.width;
+ int h = (int) size.height;
+
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
+}
+
+#if !TARGET_OS_TV
+- (NSUInteger)supportedInterfaceOrientations
+{
+ return UIKit_GetSupportedOrientations(window);
+}
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient
+{
+ return ([self supportedInterfaceOrientations] & (1 << orient)) != 0;
+}
+#endif
+
+- (BOOL)prefersStatusBarHidden
+{
+ BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0;
+ return hidden;
+}
+
+- (BOOL)prefersHomeIndicatorAutoHidden
+{
+ BOOL hidden = NO;
+ if (self.homeIndicatorHidden == 1) {
+ hidden = YES;
+ }
+ return hidden;
+}
+
+- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
+{
+ if (self.homeIndicatorHidden >= 0) {
+ if (self.homeIndicatorHidden == 2) {
+ return UIRectEdgeAll;
+ } else {
+ return UIRectEdgeNone;
+ }
+ }
+
+ /* By default, fullscreen and borderless windows get all screen gestures */
+ if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0) {
+ return UIRectEdgeAll;
+ } else {
+ return UIRectEdgeNone;
+ }
+}
+#endif
+
+/*
+ ---- Keyboard related functionality below this line ----
+ */
+#if SDL_IPHONE_KEYBOARD
+
+@synthesize textInputRect;
+@synthesize keyboardHeight;
+@synthesize keyboardVisible;
+
+/* Set ourselves up as a UITextFieldDelegate */
+- (void)initKeyboard
+{
+ textField = [[UITextField alloc] initWithFrame:CGRectZero];
+ textField.delegate = self;
+ /* placeholder so there is something to delete! */
+ textField.text = @" ";
+
+ /* set UITextInputTrait properties, mostly to defaults */
+ textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
+ textField.autocorrectionType = UITextAutocorrectionTypeNo;
+ textField.enablesReturnKeyAutomatically = NO;
+ textField.keyboardAppearance = UIKeyboardAppearanceDefault;
+ textField.keyboardType = UIKeyboardTypeDefault;
+ textField.returnKeyType = UIReturnKeyDefault;
+ textField.secureTextEntry = NO;
+
+ textField.hidden = YES;
+ keyboardVisible = NO;
+
+#if !TARGET_OS_TV
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
+ [center addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
+#endif
+}
+
+- (void)setView:(UIView *)view
+{
+ [super setView:view];
+
+ [view addSubview:textField];
+
+ if (keyboardVisible) {
+ [self showKeyboard];
+ }
+}
+
+/* willRotateToInterfaceOrientation and didRotateFromInterfaceOrientation are deprecated in iOS 8+ in favor of viewWillTransitionToSize */
+#if TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
+{
+ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+ rotatingOrientation = TRUE;
+ [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {}
+ completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
+ rotatingOrientation = FALSE;
+ }];
+}
+#else
+- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+ [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
+ rotatingOrientation = TRUE;
+}
+
+- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
+ [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
+ rotatingOrientation = FALSE;
+}
+#endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */
+
+- (void)deinitKeyboard
+{
+#if !TARGET_OS_TV
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center removeObserver:self name:UIKeyboardWillShowNotification object:nil];
+ [center removeObserver:self name:UIKeyboardWillHideNotification object:nil];
+#endif
+}
+
+/* reveal onscreen virtual keyboard */
+- (void)showKeyboard
+{
+ keyboardVisible = YES;
+ if (textField.window) {
+ [textField becomeFirstResponder];
+ }
+}
+
+/* hide onscreen virtual keyboard */
+- (void)hideKeyboard
+{
+ keyboardVisible = NO;
+ [textField resignFirstResponder];
+}
+
+- (void)keyboardWillShow:(NSNotification *)notification
+{
+#if !TARGET_OS_TV
+ CGRect kbrect = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue];
+
+ /* The keyboard rect is in the coordinate space of the screen/window, but we
+ * want its height in the coordinate space of the view. */
+ kbrect = [self.view convertRect:kbrect fromView:nil];
+
+ [self setKeyboardHeight:(int)kbrect.size.height];
+#endif
+}
+
+- (void)keyboardWillHide:(NSNotification *)notification
+{
+ if (!rotatingOrientation) {
+ SDL_StopTextInput();
+ }
+ [self setKeyboardHeight:0];
+}
+
+- (void)updateKeyboard
+{
+ CGAffineTransform t = self.view.transform;
+ CGPoint offset = CGPointMake(0.0, 0.0);
+ CGRect frame = UIKit_ComputeViewFrame(window, self.view.window.screen);
+
+ if (self.keyboardHeight) {
+ int rectbottom = self.textInputRect.y + self.textInputRect.h;
+ int keybottom = self.view.bounds.size.height - self.keyboardHeight;
+ if (keybottom < rectbottom) {
+ offset.y = keybottom - rectbottom;
+ }
+ }
+
+ /* Apply this view's transform (except any translation) to the offset, in
+ * order to orient it correctly relative to the frame's coordinate space. */
+ t.tx = 0.0;
+ t.ty = 0.0;
+ offset = CGPointApplyAffineTransform(offset, t);
+
+ /* Apply the updated offset to the view's frame. */
+ frame.origin.x += offset.x;
+ frame.origin.y += offset.y;
+
+ self.view.frame = frame;
+}
+
+- (void)setKeyboardHeight:(int)height
+{
+ keyboardVisible = height > 0;
+ keyboardHeight = height;
+ [self updateKeyboard];
+}
+
+/* UITextFieldDelegate method. Invoked when user types something. */
+- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
+{
+ NSUInteger len = string.length;
+
+ if (len == 0) {
+ /* it wants to replace text with nothing, ie a delete */
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_BACKSPACE);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_BACKSPACE);
+ } else {
+ /* go through all the characters in the string we've been sent and
+ * convert them to key presses */
+ int i;
+ for (i = 0; i < len; i++) {
+ unichar c = [string characterAtIndex:i];
+ Uint16 mod = 0;
+ SDL_Scancode code;
+
+ if (c < 127) {
+ /* figure out the SDL_Scancode and SDL_keymod for this unichar */
+ code = unicharToUIKeyInfoTable[c].code;
+ mod = unicharToUIKeyInfoTable[c].mod;
+ } else {
+ /* we only deal with ASCII right now */
+ code = SDL_SCANCODE_UNKNOWN;
+ mod = 0;
+ }
+
+ if (mod & KMOD_SHIFT) {
+ /* If character uses shift, press shift down */
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
+ }
+
+ /* send a keydown and keyup even for the character */
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+ SDL_SendKeyboardKey(SDL_RELEASED, code);
+
+ if (mod & KMOD_SHIFT) {
+ /* If character uses shift, press shift back up */
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
+ }
+ }
+
+ SDL_SendKeyboardText([string UTF8String]);
+ }
+
+ return NO; /* don't allow the edit! (keep placeholder text there) */
+}
+
+/* Terminates the editing session */
+- (BOOL)textFieldShouldReturn:(UITextField*)_textField
+{
+ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN);
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN);
+ if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) {
+ SDL_StopTextInput();
+ }
+ return YES;
+}
+
+#endif
+
+@end
+
+/* iPhone keyboard addition functions */
+#if SDL_IPHONE_KEYBOARD
+
+static SDL_uikitviewcontroller *
+GetWindowViewController(SDL_Window * window)
+{
+ if (!window || !window->driverdata) {
+ SDL_SetError("Invalid window");
+ return nil;
+ }
+
+ SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+
+ return data.viewcontroller;
+}
+
+SDL_bool
+UIKit_HasScreenKeyboardSupport(_THIS)
+{
+ return SDL_TRUE;
+}
+
+void
+UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window)
+{
+ @autoreleasepool {
+ SDL_uikitviewcontroller *vc = GetWindowViewController(window);
+ [vc showKeyboard];
+ }
+}
+
+void
+UIKit_HideScreenKeyboard(_THIS, SDL_Window *window)
+{
+ @autoreleasepool {
+ SDL_uikitviewcontroller *vc = GetWindowViewController(window);
+ [vc hideKeyboard];
+ }
+}
+
+SDL_bool
+UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window)
+{
+ @autoreleasepool {
+ SDL_uikitviewcontroller *vc = GetWindowViewController(window);
+ if (vc != nil) {
+ return vc.isKeyboardVisible;
+ }
+ return SDL_FALSE;
+ }
+}
+
+void
+UIKit_SetTextInputRect(_THIS, SDL_Rect *rect)
+{
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return;
+ }
+
+ @autoreleasepool {
+ SDL_uikitviewcontroller *vc = GetWindowViewController(SDL_GetFocusWindow());
+ if (vc != nil) {
+ vc.textInputRect = *rect;
+
+ if (vc.keyboardVisible) {
+ [vc updateKeyboard];
+ }
+ }
+ }
+}
+
+
+#endif /* SDL_IPHONE_KEYBOARD */
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.h
new file mode 100644
index 0000000..e3ec350
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.h
@@ -0,0 +1,54 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.h.
+ */
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_uikitvulkan_h_
+#define SDL_uikitvulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT
+
+int UIKit_Vulkan_LoadLibrary(_THIS, const char *path);
+void UIKit_Vulkan_UnloadLibrary(_THIS);
+SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool UIKit_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
+
+#endif
+
+#endif /* SDL_uikitvulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.m
new file mode 100644
index 0000000..771c7a4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitvulkan.m
@@ -0,0 +1,222 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.c.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_uikitvideo.h"
+#include "SDL_uikitwindow.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_uikitvulkan.h"
+#include "SDL_uikitmetalview.h"
+#include "SDL_syswm.h"
+
+#include <dlfcn.h>
+
+#define DEFAULT_MOLTENVK "libMoltenVK.dylib"
+/* Since libSDL is static, could use RTLD_SELF. Using RTLD_DEFAULT is future
+ * proofing. */
+#define DEFAULT_HANDLE RTLD_DEFAULT
+
+int UIKit_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ VkExtensionProperties *extensions = NULL;
+ Uint32 extensionCount = 0;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasIOSSurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+
+ if (_this->vulkan_config.loader_handle) {
+ return SDL_SetError("MoltenVK/Vulkan already loaded");
+ }
+
+ /* Load the Vulkan loader library */
+ if (!path) {
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ }
+
+ if (!path) {
+ /* MoltenVK framework, currently, v0.17.0, has a static library and is
+ * the recommended way to use the package. There is likely no object to
+ * load. */
+ vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE,
+ "vkGetInstanceProcAddr");
+ }
+
+ if (vkGetInstanceProcAddr) {
+ _this->vulkan_config.loader_handle = DEFAULT_HANDLE;
+ } else {
+ if (!path) {
+ /* Look for the .dylib packaged with the application instead. */
+ path = DEFAULT_MOLTENVK;
+ }
+
+ _this->vulkan_config.loader_handle = SDL_LoadObject(path);
+ if (!_this->vulkan_config.loader_handle) {
+ return -1;
+ }
+ SDL_strlcpy(_this->vulkan_config.loader_path, path,
+ SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle,
+ "vkGetInstanceProcAddr");
+ }
+
+ if (!vkGetInstanceProcAddr) {
+ SDL_SetError("Failed to find %s in either executable or %s: %s",
+ "vkGetInstanceProcAddr",
+ DEFAULT_MOLTENVK,
+ (const char *) dlerror());
+ goto fail;
+ }
+
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+
+ if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
+ SDL_SetError("No vkEnumerateInstanceExtensionProperties found.");
+ goto fail;
+ }
+
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+
+ if (!extensions) {
+ goto fail;
+ }
+
+ for (Uint32 i = 0; i < extensionCount; i++) {
+ if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
+ hasSurfaceExtension = SDL_TRUE;
+ } else if (SDL_strcmp(VK_MVK_IOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) {
+ hasIOSSurfaceExtension = SDL_TRUE;
+ }
+ }
+
+ SDL_free(extensions);
+
+ if (!hasSurfaceExtension) {
+ SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ } else if (!hasIOSSurfaceExtension) {
+ SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the "
+ VK_MVK_IOS_SURFACE_EXTENSION_NAME "extension");
+ goto fail;
+ }
+
+ return 0;
+
+fail:
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void UIKit_Vulkan_UnloadLibrary(_THIS)
+{
+ if (_this->vulkan_config.loader_handle) {
+ if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) {
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ }
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ static const char *const extensionsForUIKit[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_IOS_SURFACE_EXTENSION_NAME
+ };
+ if (!_this->vulkan_config.loader_handle) {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForUIKit),
+ extensionsForUIKit);
+}
+
+SDL_bool UIKit_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK =
+ (PFN_vkCreateIOSSurfaceMVK)vkGetInstanceProcAddr(
+ (VkInstance)instance,
+ "vkCreateIOSSurfaceMVK");
+ VkIOSSurfaceCreateInfoMVK createInfo = {};
+ VkResult result;
+
+ if (!_this->vulkan_config.loader_handle) {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ if (!vkCreateIOSSurfaceMVK) {
+ SDL_SetError(VK_MVK_IOS_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+
+ createInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.pView = (__bridge void *)UIKit_Mtl_AddMetalView(window);
+ result = vkCreateIOSSurfaceMVK(instance, &createInfo,
+ NULL, surface);
+ if (result != VK_SUCCESS) {
+ SDL_SetError("vkCreateIOSSurfaceMVK failed: %s",
+ SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+
+ return SDL_TRUE;
+}
+
+void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
+{
+ UIKit_Mtl_GetDrawableSize(window, w, h);
+}
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.h b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.h
new file mode 100644
index 0000000..46073ee
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.h
@@ -0,0 +1,56 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_uikitwindow_h_
+#define SDL_uikitwindow_h_
+
+#include "../SDL_sysvideo.h"
+#import "SDL_uikitvideo.h"
+#import "SDL_uikitview.h"
+#import "SDL_uikitviewcontroller.h"
+
+extern int UIKit_CreateWindow(_THIS, SDL_Window * window);
+extern void UIKit_SetWindowTitle(_THIS, SDL_Window * window);
+extern void UIKit_ShowWindow(_THIS, SDL_Window * window);
+extern void UIKit_HideWindow(_THIS, SDL_Window * window);
+extern void UIKit_RaiseWindow(_THIS, SDL_Window * window);
+extern void UIKit_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
+extern void UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+extern void UIKit_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo * info);
+
+extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window);
+
+@class UIWindow;
+
+@interface SDL_WindowData : NSObject
+
+@property (nonatomic, strong) UIWindow *uiwindow;
+@property (nonatomic, strong) SDL_uikitviewcontroller *viewcontroller;
+
+/* Array of SDL_uikitviews owned by this window. */
+@property (nonatomic, copy) NSMutableArray *views;
+
+@end
+
+#endif /* SDL_uikitwindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.m b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.m
new file mode 100644
index 0000000..d01cff3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/SDL_uikitwindow.m
@@ -0,0 +1,465 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_UIKIT
+
+#include "SDL_syswm.h"
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_uikitvideo.h"
+#include "SDL_uikitevents.h"
+#include "SDL_uikitmodes.h"
+#include "SDL_uikitwindow.h"
+#import "SDL_uikitappdelegate.h"
+
+#import "SDL_uikitview.h"
+#import "SDL_uikitopenglview.h"
+
+#include <Foundation/Foundation.h>
+
+@implementation SDL_WindowData
+
+@synthesize uiwindow;
+@synthesize viewcontroller;
+@synthesize views;
+
+- (instancetype)init
+{
+ if ((self = [super init])) {
+ views = [NSMutableArray new];
+ }
+
+ return self;
+}
+
+@end
+
+@interface SDL_uikitwindow : UIWindow
+
+- (void)layoutSubviews;
+
+@end
+
+@implementation SDL_uikitwindow
+
+- (void)layoutSubviews
+{
+ /* Workaround to fix window orientation issues in iOS 8+. */
+ self.frame = self.screen.bounds;
+ [super layoutSubviews];
+}
+
+@end
+
+
+static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata;
+ SDL_uikitview *view;
+
+ CGRect frame = UIKit_ComputeViewFrame(window, displaydata.uiscreen);
+ int width = (int) frame.size.width;
+ int height = (int) frame.size.height;
+
+ SDL_WindowData *data = [[SDL_WindowData alloc] init];
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+
+ window->driverdata = (void *) CFBridgingRetain(data);
+
+ data.uiwindow = uiwindow;
+
+ /* only one window on iOS, always shown */
+ window->flags &= ~SDL_WINDOW_HIDDEN;
+
+ if (displaydata.uiscreen != [UIScreen mainScreen]) {
+ window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizable */
+ window->flags &= ~SDL_WINDOW_INPUT_FOCUS; /* never has input focus */
+ window->flags |= SDL_WINDOW_BORDERLESS; /* never has a status bar. */
+ }
+
+#if !TARGET_OS_TV
+ if (displaydata.uiscreen == [UIScreen mainScreen]) {
+ /* SDL_CreateWindow sets the window w&h to the display's bounds if the
+ * fullscreen flag is set. But the display bounds orientation might not
+ * match what we want, and GetSupportedOrientations call below uses the
+ * window w&h. They're overridden below anyway, so we'll just set them
+ * to the requested size for the purposes of determining orientation. */
+ window->w = window->windowed.w;
+ window->h = window->windowed.h;
+
+ NSUInteger orients = UIKit_GetSupportedOrientations(window);
+ BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0;
+ BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0;
+
+ /* Make sure the width/height are oriented correctly */
+ if ((width > height && !supportsLandscape) || (height > width && !supportsPortrait)) {
+ int temp = width;
+ width = height;
+ height = temp;
+ }
+ }
+#endif /* !TARGET_OS_TV */
+
+ window->x = 0;
+ window->y = 0;
+ window->w = width;
+ window->h = height;
+
+ /* The View Controller will handle rotating the view when the device
+ * orientation changes. This will trigger resize events, if appropriate. */
+ data.viewcontroller = [[SDL_uikitviewcontroller alloc] initWithSDLWindow:window];
+
+ /* The window will initially contain a generic view so resizes, touch events,
+ * etc. can be handled without an active OpenGL view/context. */
+ view = [[SDL_uikitview alloc] initWithFrame:frame];
+
+ /* Sets this view as the controller's view, and adds the view to the window
+ * heirarchy. */
+ [view setSDLWindow:window];
+
+ /* Make this window the current mouse focus for touch input */
+ if (displaydata.uiscreen == [UIScreen mainScreen]) {
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+ }
+
+ return 0;
+}
+
+int
+UIKit_CreateWindow(_THIS, SDL_Window *window)
+{
+ @autoreleasepool {
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata;
+
+ /* SDL currently puts this window at the start of display's linked list. We rely on this. */
+ SDL_assert(_this->windows == window);
+
+ /* We currently only handle a single window per display on iOS */
+ if (window->next != NULL) {
+ return SDL_SetError("Only one window allowed per display.");
+ }
+
+ /* If monitor has a resolution of 0x0 (hasn't been explicitly set by the
+ * user, so it's in standby), try to force the display to a resolution
+ * that most closely matches the desired window size. */
+#if !TARGET_OS_TV
+ const CGSize origsize = data.uiscreen.currentMode.size;
+ if ((origsize.width == 0.0f) && (origsize.height == 0.0f)) {
+ if (display->num_display_modes == 0) {
+ _this->GetDisplayModes(_this, display);
+ }
+
+ int i;
+ const SDL_DisplayMode *bestmode = NULL;
+ for (i = display->num_display_modes; i >= 0; i--) {
+ const SDL_DisplayMode *mode = &display->display_modes[i];
+ if ((mode->w >= window->w) && (mode->h >= window->h)) {
+ bestmode = mode;
+ }
+ }
+
+ if (bestmode) {
+ SDL_DisplayModeData *modedata = (__bridge SDL_DisplayModeData *)bestmode->driverdata;
+ [data.uiscreen setCurrentMode:modedata.uiscreenmode];
+
+ /* desktop_mode doesn't change here (the higher level will
+ * use it to set all the screens back to their defaults
+ * upon window destruction, SDL_Quit(), etc. */
+ display->current_mode = *bestmode;
+ }
+ }
+
+ if (data.uiscreen == [UIScreen mainScreen]) {
+ if (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) {
+ [UIApplication sharedApplication].statusBarHidden = YES;
+ } else {
+ [UIApplication sharedApplication].statusBarHidden = NO;
+ }
+ }
+#endif /* !TARGET_OS_TV */
+
+ /* ignore the size user requested, and make a fullscreen window */
+ /* !!! FIXME: can we have a smaller view? */
+ UIWindow *uiwindow = [[SDL_uikitwindow alloc] initWithFrame:data.uiscreen.bounds];
+
+ /* put the window on an external display if appropriate. */
+ if (data.uiscreen != [UIScreen mainScreen]) {
+ [uiwindow setScreen:data.uiscreen];
+ }
+
+ if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
+ return -1;
+ }
+ }
+
+ return 1;
+}
+
+void
+UIKit_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ data.viewcontroller.title = @(window->title);
+ }
+}
+
+void
+UIKit_ShowWindow(_THIS, SDL_Window * window)
+{
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ [data.uiwindow makeKeyAndVisible];
+ }
+}
+
+void
+UIKit_HideWindow(_THIS, SDL_Window * window)
+{
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ data.uiwindow.hidden = YES;
+ }
+}
+
+void
+UIKit_RaiseWindow(_THIS, SDL_Window * window)
+{
+ /* We don't currently offer a concept of "raising" the SDL window, since
+ * we only allow one per display, in the iOS fashion.
+ * However, we use this entry point to rebind the context to the view
+ * during OnWindowRestored processing. */
+ _this->GL_MakeCurrent(_this, _this->current_glwin, _this->current_glctx);
+}
+
+static void
+UIKit_UpdateWindowBorder(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ SDL_uikitviewcontroller *viewcontroller = data.viewcontroller;
+
+#if !TARGET_OS_TV
+ if (data.uiwindow.screen == [UIScreen mainScreen]) {
+ if (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) {
+ [UIApplication sharedApplication].statusBarHidden = YES;
+ } else {
+ [UIApplication sharedApplication].statusBarHidden = NO;
+ }
+
+ /* iOS 7+ won't update the status bar until we tell it to. */
+ if ([viewcontroller respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
+ [viewcontroller setNeedsStatusBarAppearanceUpdate];
+ }
+ }
+
+ /* Update the view's frame to account for the status bar change. */
+ viewcontroller.view.frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen);
+#endif /* !TARGET_OS_TV */
+
+#ifdef SDL_IPHONE_KEYBOARD
+ /* Make sure the view is offset correctly when the keyboard is visible. */
+ [viewcontroller updateKeyboard];
+#endif
+
+ [viewcontroller.view setNeedsLayout];
+ [viewcontroller.view layoutIfNeeded];
+}
+
+void
+UIKit_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
+{
+ @autoreleasepool {
+ UIKit_UpdateWindowBorder(_this, window);
+ }
+}
+
+void
+UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{
+ @autoreleasepool {
+ UIKit_UpdateWindowBorder(_this, window);
+ }
+}
+
+void
+UIKit_DestroyWindow(_THIS, SDL_Window * window)
+{
+ @autoreleasepool {
+ if (window->driverdata != NULL) {
+ SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata);
+ NSArray *views = nil;
+
+ [data.viewcontroller stopAnimation];
+
+ /* Detach all views from this window. We use a copy of the array
+ * because setSDLWindow will remove the object from the original
+ * array, which would be undesirable if we were iterating over it. */
+ views = [data.views copy];
+ for (SDL_uikitview *view in views) {
+ [view setSDLWindow:NULL];
+ }
+
+ /* iOS may still hold a reference to the window after we release it.
+ * We want to make sure the SDL view controller isn't accessed in
+ * that case, because it would contain an invalid pointer to the old
+ * SDL window. */
+ data.uiwindow.rootViewController = nil;
+ data.uiwindow.hidden = YES;
+ }
+ }
+ window->driverdata = NULL;
+}
+
+SDL_bool
+UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
+
+ info->subsystem = SDL_SYSWM_UIKIT;
+ info->info.uikit.window = data.uiwindow;
+
+ /* These struct members were added in SDL 2.0.4. */
+ if (versionnum >= SDL_VERSIONNUM(2,0,4)) {
+ if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
+ SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
+ info->info.uikit.framebuffer = glview.drawableFramebuffer;
+ info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
+ info->info.uikit.resolveFramebuffer = glview.msaaResolveFramebuffer;
+ } else {
+ info->info.uikit.framebuffer = 0;
+ info->info.uikit.colorbuffer = 0;
+ info->info.uikit.resolveFramebuffer = 0;
+ }
+ }
+
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+ }
+}
+
+#if !TARGET_OS_TV
+NSUInteger
+UIKit_GetSupportedOrientations(SDL_Window * window)
+{
+ const char *hint = SDL_GetHint(SDL_HINT_ORIENTATIONS);
+ NSUInteger validOrientations = UIInterfaceOrientationMaskAll;
+ NSUInteger orientationMask = 0;
+
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
+ UIApplication *app = [UIApplication sharedApplication];
+
+ /* Get all possible valid orientations. If the app delegate doesn't tell
+ * us, we get the orientations from Info.plist via UIApplication. */
+ if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) {
+ validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow];
+ } else if ([app respondsToSelector:@selector(supportedInterfaceOrientationsForWindow:)]) {
+ validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow];
+ }
+
+ if (hint != NULL) {
+ NSArray *orientations = [@(hint) componentsSeparatedByString:@" "];
+
+ if ([orientations containsObject:@"LandscapeLeft"]) {
+ orientationMask |= UIInterfaceOrientationMaskLandscapeLeft;
+ }
+ if ([orientations containsObject:@"LandscapeRight"]) {
+ orientationMask |= UIInterfaceOrientationMaskLandscapeRight;
+ }
+ if ([orientations containsObject:@"Portrait"]) {
+ orientationMask |= UIInterfaceOrientationMaskPortrait;
+ }
+ if ([orientations containsObject:@"PortraitUpsideDown"]) {
+ orientationMask |= UIInterfaceOrientationMaskPortraitUpsideDown;
+ }
+ }
+
+ if (orientationMask == 0 && (window->flags & SDL_WINDOW_RESIZABLE)) {
+ /* any orientation is okay. */
+ orientationMask = UIInterfaceOrientationMaskAll;
+ }
+
+ if (orientationMask == 0) {
+ if (window->w >= window->h) {
+ orientationMask |= UIInterfaceOrientationMaskLandscape;
+ }
+ if (window->h >= window->w) {
+ orientationMask |= (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
+ }
+ }
+
+ /* Don't allow upside-down orientation on phones, so answering calls is in the natural orientation */
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
+ orientationMask &= ~UIInterfaceOrientationMaskPortraitUpsideDown;
+ }
+
+ /* If none of the specified orientations are actually supported by the
+ * app, we'll revert to what the app supports. An exception would be
+ * thrown by the system otherwise. */
+ if ((validOrientations & orientationMask) == 0) {
+ orientationMask = validOrientations;
+ }
+ }
+
+ return orientationMask;
+}
+#endif /* !TARGET_OS_TV */
+
+int
+SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam)
+{
+ if (!window || !window->driverdata) {
+ return SDL_SetError("Invalid window");
+ }
+
+ @autoreleasepool {
+ SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+ [data.viewcontroller setAnimationCallback:interval
+ callback:callback
+ callbackParam:callbackParam];
+ }
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_UIKIT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/uikit/keyinfotable.h b/src/3rdparty/SDL2/src/video/uikit/keyinfotable.h
new file mode 100644
index 0000000..3b23837
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/uikit/keyinfotable.h
@@ -0,0 +1,174 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef _UIKIT_KeyInfo
+#define _UIKIT_KeyInfo
+
+#include "SDL_scancode.h"
+
+/*
+ This file is used by the keyboard code in SDL_uikitview.m to convert between characters
+ passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods.
+ For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
+ case a.
+*/
+
+typedef struct
+{
+ SDL_Scancode code;
+ Uint16 mod;
+} UIKitKeyInfo;
+
+/* So far only ASCII characters here */
+static UIKitKeyInfo unicharToUIKeyInfoTable[] = {
+/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 13 */ { SDL_SCANCODE_RETURN, 0 },
+/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 },
+/* 32 */ { SDL_SCANCODE_SPACE, 0 },
+/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */
+/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */
+/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */
+/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */
+/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */
+/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */
+/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */
+/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */
+/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */
+/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */
+/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */
+/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */
+/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */
+/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */
+/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */
+/* 48 */ { SDL_SCANCODE_0, 0 },
+/* 49 */ { SDL_SCANCODE_1, 0 },
+/* 50 */ { SDL_SCANCODE_2, 0 },
+/* 51 */ { SDL_SCANCODE_3, 0 },
+/* 52 */ { SDL_SCANCODE_4, 0 },
+/* 53 */ { SDL_SCANCODE_5, 0 },
+/* 54 */ { SDL_SCANCODE_6, 0 },
+/* 55 */ { SDL_SCANCODE_7, 0 },
+/* 56 */ { SDL_SCANCODE_8, 0 },
+/* 57 */ { SDL_SCANCODE_9, 0 },
+/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */
+/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 },
+/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */
+/* 61 */ { SDL_SCANCODE_EQUALS, 0 },
+/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */
+/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */
+/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */
+/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */
+/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT },
+/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT },
+/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT },
+/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT },
+/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT },
+/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT },
+/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT },
+/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT },
+/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT },
+/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT },
+/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT },
+/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT },
+/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT },
+/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT },
+/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT },
+/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT },
+/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT },
+/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT },
+/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT },
+/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT },
+/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT },
+/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT },
+/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT },
+/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT },
+/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT },
+/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 },
+/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 },
+/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 },
+/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */
+/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */
+/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */
+/* 97 */ { SDL_SCANCODE_A, 0 },
+/* 98 */ { SDL_SCANCODE_B, 0 },
+/* 99 */ { SDL_SCANCODE_C, 0 },
+/* 100 */{ SDL_SCANCODE_D, 0 },
+/* 101 */{ SDL_SCANCODE_E, 0 },
+/* 102 */{ SDL_SCANCODE_F, 0 },
+/* 103 */{ SDL_SCANCODE_G, 0 },
+/* 104 */{ SDL_SCANCODE_H, 0 },
+/* 105 */{ SDL_SCANCODE_I, 0 },
+/* 106 */{ SDL_SCANCODE_J, 0 },
+/* 107 */{ SDL_SCANCODE_K, 0 },
+/* 108 */{ SDL_SCANCODE_L, 0 },
+/* 109 */{ SDL_SCANCODE_M, 0 },
+/* 110 */{ SDL_SCANCODE_N, 0 },
+/* 111 */{ SDL_SCANCODE_O, 0 },
+/* 112 */{ SDL_SCANCODE_P, 0 },
+/* 113 */{ SDL_SCANCODE_Q, 0 },
+/* 114 */{ SDL_SCANCODE_R, 0 },
+/* 115 */{ SDL_SCANCODE_S, 0 },
+/* 116 */{ SDL_SCANCODE_T, 0 },
+/* 117 */{ SDL_SCANCODE_U, 0 },
+/* 118 */{ SDL_SCANCODE_V, 0 },
+/* 119 */{ SDL_SCANCODE_W, 0 },
+/* 120 */{ SDL_SCANCODE_X, 0 },
+/* 121 */{ SDL_SCANCODE_Y, 0 },
+/* 122 */{ SDL_SCANCODE_Z, 0 },
+/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */
+/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */
+/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */
+/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */
+/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
+};
+
+#endif /* _UIKIT_KeyInfo */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.c b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.c
new file mode 100644
index 0000000..135e838
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.c
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_vivanteopengles.h"
+#include "SDL_vivantevideo.h"
+
+/* EGL implementation of SDL OpenGL support */
+
+int
+VIVANTE_GLES_LoadLibrary(_THIS, const char *path)
+{
+ SDL_DisplayData *displaydata;
+
+ displaydata = SDL_GetDisplayDriverData(0);
+
+ return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display, 0);
+}
+
+SDL_EGL_CreateContext_impl(VIVANTE)
+SDL_EGL_SwapWindow_impl(VIVANTE)
+SDL_EGL_MakeCurrent_impl(VIVANTE)
+
+#endif /* SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.h b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.h
new file mode 100644
index 0000000..162d61a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteopengles.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_vivanteopengles_h_
+#define SDL_vivanteopengles_h_
+
+#if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define VIVANTE_GLES_GetAttribute SDL_EGL_GetAttribute
+#define VIVANTE_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define VIVANTE_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define VIVANTE_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define VIVANTE_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define VIVANTE_GLES_DeleteContext SDL_EGL_DeleteContext
+
+extern int VIVANTE_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext VIVANTE_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int VIVANTE_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+
+#endif /* SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_vivanteopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.c b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.c
new file mode 100644
index 0000000..67ea633
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.c
@@ -0,0 +1,54 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_VIVANTE
+
+#include "SDL_vivanteplatform.h"
+
+#ifdef VIVANTE_PLATFORM_GENERIC
+
+int
+VIVANTE_SetupPlatform(_THIS)
+{
+ return 0;
+}
+
+char *VIVANTE_GetDisplayName(_THIS)
+{
+ return NULL;
+}
+
+void
+VIVANTE_UpdateDisplayScale(_THIS)
+{
+}
+
+void
+VIVANTE_CleanupPlatform(_THIS)
+{
+}
+
+#endif /* VIVANTE_PLATFORM_GENERIC */
+
+#endif /* SDL_VIDEO_DRIVER_VIVANTE */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.h b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.h
new file mode 100644
index 0000000..59fbf60
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/vivante/SDL_vivanteplatform.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_vivanteplatform_h_
+#define SDL_vivanteplatform_h_
+
+#if SDL_VIDEO_DRIVER_VIVANTE
+
+#include "SDL_vivantevideo.h"
+
+#if defined(CAVIUM)
+#define VIVANTE_PLATFORM_CAVIUM
+#elif defined(MARVELL)
+#define VIVANTE_PLATFORM_MARVELL
+#else
+#define VIVANTE_PLATFORM_GENERIC
+#endif
+
+extern int VIVANTE_SetupPlatform(_THIS);
+extern char *VIVANTE_GetDisplayName(_THIS);
+extern void VIVANTE_UpdateDisplayScale(_THIS);
+extern void VIVANTE_CleanupPlatform(_THIS);
+
+#endif /* SDL_VIDEO_DRIVER_VIVANTE */
+
+#endif /* SDL_vivanteplatform_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.c b/src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.c
new file mode 100644
index 0000000..656ab55
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.c
@@ -0,0 +1,409 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_VIVANTE
+
+/* SDL internals */
+#include "../SDL_sysvideo.h"
+#include "SDL_version.h"
+#include "SDL_syswm.h"
+#include "SDL_loadso.h"
+#include "SDL_events.h"
+#include "../../events/SDL_events_c.h"
+
+#ifdef SDL_INPUT_LINUXEV
+#include "../../core/linux/SDL_evdev.h"
+#endif
+
+#include "SDL_vivantevideo.h"
+#include "SDL_vivanteplatform.h"
+#include "SDL_vivanteopengles.h"
+
+
+static int
+VIVANTE_Available(void)
+{
+ return 1;
+}
+
+static void
+VIVANTE_Destroy(SDL_VideoDevice * device)
+{
+ if (device->driverdata != NULL) {
+ SDL_free(device->driverdata);
+ device->driverdata = NULL;
+ }
+}
+
+static SDL_VideoDevice *
+VIVANTE_Create()
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+
+ /* Initialize SDL_VideoDevice structure */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize internal data */
+ data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (data == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+
+ device->driverdata = data;
+
+ /* Setup amount of available displays */
+ device->num_displays = 0;
+
+ /* Set device free function */
+ device->free = VIVANTE_Destroy;
+
+ /* Setup all functions which we can handle */
+ device->VideoInit = VIVANTE_VideoInit;
+ device->VideoQuit = VIVANTE_VideoQuit;
+ device->GetDisplayModes = VIVANTE_GetDisplayModes;
+ device->SetDisplayMode = VIVANTE_SetDisplayMode;
+ device->CreateSDLWindow = VIVANTE_CreateWindow;
+ device->SetWindowTitle = VIVANTE_SetWindowTitle;
+ device->SetWindowPosition = VIVANTE_SetWindowPosition;
+ device->SetWindowSize = VIVANTE_SetWindowSize;
+ device->ShowWindow = VIVANTE_ShowWindow;
+ device->HideWindow = VIVANTE_HideWindow;
+ device->DestroyWindow = VIVANTE_DestroyWindow;
+ device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo;
+
+#if SDL_VIDEO_OPENGL_EGL
+ device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary;
+ device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary;
+ device->GL_CreateContext = VIVANTE_GLES_CreateContext;
+ device->GL_MakeCurrent = VIVANTE_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = VIVANTE_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = VIVANTE_GLES_GetSwapInterval;
+ device->GL_SwapWindow = VIVANTE_GLES_SwapWindow;
+ device->GL_DeleteContext = VIVANTE_GLES_DeleteContext;
+#endif
+
+ device->PumpEvents = VIVANTE_PumpEvents;
+
+ return device;
+}
+
+VideoBootStrap VIVANTE_bootstrap = {
+ "vivante",
+ "Vivante EGL Video Driver",
+ VIVANTE_Available,
+ VIVANTE_Create
+};
+
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions */
+/*****************************************************************************/
+
+static int
+VIVANTE_AddVideoDisplays(_THIS)
+{
+ SDL_VideoData *videodata = _this->driverdata;
+ SDL_VideoDisplay display;
+ SDL_DisplayMode current_mode;
+ SDL_DisplayData *data;
+ int pitch = 0, bpp = 0;
+ unsigned long pixels = 0;
+
+ data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
+ if (data == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_zero(current_mode);
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ data->native_display = vdkGetDisplay(videodata->vdk_private);
+
+ vdkGetDisplayInfo(data->native_display, &current_mode.w, &current_mode.h, &pixels, &pitch, &bpp);
+#else
+ data->native_display = videodata->fbGetDisplayByIndex(0);
+
+ videodata->fbGetDisplayInfo(data->native_display, &current_mode.w, &current_mode.h, &pixels, &pitch, &bpp);
+#endif /* SDL_VIDEO_DRIVER_VIVANTE_VDK */
+
+ switch (bpp)
+ {
+ default: /* Is another format used? */
+ case 32:
+ current_mode.format = SDL_PIXELFORMAT_ARGB8888;
+ break;
+ case 16:
+ current_mode.format = SDL_PIXELFORMAT_RGB565;
+ break;
+ }
+ /* FIXME: How do we query refresh rate? */
+ current_mode.refresh_rate = 60;
+
+ SDL_zero(display);
+ display.name = VIVANTE_GetDisplayName(_this);
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+ display.driverdata = data;
+ SDL_AddVideoDisplay(&display);
+ return 0;
+}
+
+int
+VIVANTE_VideoInit(_THIS)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ videodata->vdk_private = vdkInitialize();
+ if (!videodata->vdk_private) {
+ return SDL_SetError("vdkInitialize() failed");
+ }
+#else
+ videodata->egl_handle = SDL_LoadObject("libEGL.so.1");
+ if (!videodata->egl_handle) {
+ videodata->egl_handle = SDL_LoadObject("libEGL.so");
+ if (!videodata->egl_handle) {
+ return -1;
+ }
+ }
+#define LOAD_FUNC(NAME) \
+ videodata->NAME = SDL_LoadFunction(videodata->egl_handle, #NAME); \
+ if (!videodata->NAME) return -1;
+
+ LOAD_FUNC(fbGetDisplay);
+ LOAD_FUNC(fbGetDisplayByIndex);
+ LOAD_FUNC(fbGetDisplayGeometry);
+ LOAD_FUNC(fbGetDisplayInfo);
+ LOAD_FUNC(fbDestroyDisplay);
+ LOAD_FUNC(fbCreateWindow);
+ LOAD_FUNC(fbGetWindowGeometry);
+ LOAD_FUNC(fbGetWindowInfo);
+ LOAD_FUNC(fbDestroyWindow);
+#endif
+
+ if (VIVANTE_SetupPlatform(_this) < 0) {
+ return -1;
+ }
+
+ if (VIVANTE_AddVideoDisplays(_this) < 0) {
+ return -1;
+ }
+
+ VIVANTE_UpdateDisplayScale(_this);
+
+#ifdef SDL_INPUT_LINUXEV
+ if (SDL_EVDEV_Init() < 0) {
+ return -1;
+ }
+#endif
+
+ return 0;
+}
+
+void
+VIVANTE_VideoQuit(_THIS)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Quit();
+#endif
+
+ VIVANTE_CleanupPlatform(_this);
+
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ if (videodata->vdk_private) {
+ vdkExit(videodata->vdk_private);
+ videodata->vdk_private = NULL;
+ }
+#else
+ if (videodata->egl_handle) {
+ SDL_UnloadObject(videodata->egl_handle);
+ videodata->egl_handle = NULL;
+ }
+#endif
+}
+
+void
+VIVANTE_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ /* Only one display mode available, the current one */
+ SDL_AddDisplayMode(display, &display->current_mode);
+}
+
+int
+VIVANTE_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+int
+VIVANTE_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ SDL_DisplayData *displaydata;
+ SDL_WindowData *data;
+
+ displaydata = SDL_GetDisplayDriverData(0);
+
+ /* Allocate window internal data */
+ data = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (data == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Setup driver data for this window */
+ window->driverdata = data;
+
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
+#else
+ data->native_window = videodata->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
+#endif
+ if (!data->native_window) {
+ return SDL_SetError("VIVANTE: Can't create native window");
+ }
+
+#if SDL_VIDEO_OPENGL_EGL
+ if (window->flags & SDL_WINDOW_OPENGL) {
+ data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window);
+ if (data->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("VIVANTE: Can't create EGL surface");
+ }
+ } else {
+ data->egl_surface = EGL_NO_SURFACE;
+ }
+#endif
+
+ /* Window has been successfully created */
+ return 0;
+}
+
+void
+VIVANTE_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ SDL_WindowData *data;
+
+ data = window->driverdata;
+ if (data) {
+#if SDL_VIDEO_OPENGL_EGL
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ }
+#endif
+
+ if (data->native_window) {
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ vdkDestroyWindow(data->native_window);
+#else
+ videodata->fbDestroyWindow(data->native_window);
+#endif
+ }
+
+ SDL_free(data);
+ }
+ window->driverdata = NULL;
+}
+
+void
+VIVANTE_SetWindowTitle(_THIS, SDL_Window * window)
+{
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ SDL_WindowData *data = window->driverdata;
+ vdkSetWindowTitle(data->native_window, window->title);
+#endif
+}
+
+void
+VIVANTE_SetWindowPosition(_THIS, SDL_Window * window)
+{
+ /* FIXME */
+}
+
+void
+VIVANTE_SetWindowSize(_THIS, SDL_Window * window)
+{
+ /* FIXME */
+}
+
+void
+VIVANTE_ShowWindow(_THIS, SDL_Window * window)
+{
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ SDL_WindowData *data = window->driverdata;
+ vdkShowWindow(data->native_window);
+#endif
+ SDL_SetMouseFocus(window);
+ SDL_SetKeyboardFocus(window);
+}
+
+void
+VIVANTE_HideWindow(_THIS, SDL_Window * window)
+{
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ SDL_WindowData *data = window->driverdata;
+ vdkHideWindow(data->native_window);
+#endif
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function */
+/*****************************************************************************/
+SDL_bool
+VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(0);
+
+ if (info->version.major == SDL_MAJOR_VERSION &&
+ info->version.minor == SDL_MINOR_VERSION) {
+ info->subsystem = SDL_SYSWM_VIVANTE;
+ info->info.vivante.display = displaydata->native_display;
+ info->info.vivante.window = data->native_window;
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+}
+
+/*****************************************************************************/
+/* SDL event functions */
+/*****************************************************************************/
+void VIVANTE_PumpEvents(_THIS)
+{
+#ifdef SDL_INPUT_LINUXEV
+ SDL_EVDEV_Poll();
+#endif
+}
+
+#endif /* SDL_VIDEO_DRIVER_VIVANTE */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.h b/src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.h
new file mode 100644
index 0000000..d335564
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/vivante/SDL_vivantevideo.h
@@ -0,0 +1,91 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_vivantevideo_h_
+#define SDL_vivantevideo_h_
+
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+
+#include "SDL_egl.h"
+
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+#include <gc_vdk.h>
+#else
+#include <EGL/egl.h>
+#endif
+
+typedef struct SDL_VideoData
+{
+#if SDL_VIDEO_DRIVER_VIVANTE_VDK
+ vdkPrivate vdk_private;
+#else
+ void *egl_handle; /* EGL shared library handle */
+ EGLNativeDisplayType (EGLAPIENTRY *fbGetDisplay)(void *context);
+ EGLNativeDisplayType (EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex);
+ void (EGLAPIENTRY *fbGetDisplayGeometry)(EGLNativeDisplayType Display, int *Width, int *Height);
+ void (EGLAPIENTRY *fbGetDisplayInfo)(EGLNativeDisplayType Display, int *Width, int *Height, unsigned long *Physical, int *Stride, int *BitsPerPixel);
+ void (EGLAPIENTRY *fbDestroyDisplay)(EGLNativeDisplayType Display);
+ EGLNativeWindowType (EGLAPIENTRY *fbCreateWindow)(EGLNativeDisplayType Display, int X, int Y, int Width, int Height);
+ void (EGLAPIENTRY *fbGetWindowGeometry)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height);
+ void (EGLAPIENTRY *fbGetWindowInfo)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height, int *BitsPerPixel, unsigned int *Offset);
+ void (EGLAPIENTRY *fbDestroyWindow)(EGLNativeWindowType Window);
+#endif
+} SDL_VideoData;
+
+typedef struct SDL_DisplayData
+{
+ EGLNativeDisplayType native_display;
+} SDL_DisplayData;
+
+typedef struct SDL_WindowData
+{
+ EGLNativeWindowType native_window;
+ EGLSurface egl_surface;
+} SDL_WindowData;
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration */
+/****************************************************************************/
+
+/* Display and window functions */
+int VIVANTE_VideoInit(_THIS);
+void VIVANTE_VideoQuit(_THIS);
+void VIVANTE_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+int VIVANTE_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+int VIVANTE_CreateWindow(_THIS, SDL_Window * window);
+void VIVANTE_SetWindowTitle(_THIS, SDL_Window * window);
+void VIVANTE_SetWindowPosition(_THIS, SDL_Window * window);
+void VIVANTE_SetWindowSize(_THIS, SDL_Window * window);
+void VIVANTE_ShowWindow(_THIS, SDL_Window * window);
+void VIVANTE_HideWindow(_THIS, SDL_Window * window);
+void VIVANTE_DestroyWindow(_THIS, SDL_Window * window);
+
+/* Window manager function */
+SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+/* Event functions */
+void VIVANTE_PumpEvents(_THIS);
+
+#endif /* SDL_vivantevideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.c
new file mode 100644
index 0000000..5fd826b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.c
@@ -0,0 +1,123 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#include "SDL_waylanddatamanager.h"
+#include "SDL_waylandevents_c.h"
+
+int
+Wayland_SetClipboardText(_THIS, const char *text)
+{
+ SDL_VideoData *video_data = NULL;
+ SDL_WaylandDataDevice *data_device = NULL;
+
+ int status = 0;
+
+ if (_this == NULL || _this->driverdata == NULL) {
+ status = SDL_SetError("Video driver uninitialized");
+ } else {
+ video_data = _this->driverdata;
+ /* TODO: Support more than one seat */
+ data_device = Wayland_get_data_device(video_data->input);
+ if (text[0] != '\0') {
+ SDL_WaylandDataSource* source = Wayland_data_source_create(_this);
+ Wayland_data_source_add_data(source, TEXT_MIME, text,
+ strlen(text) + 1);
+
+ status = Wayland_data_device_set_selection(data_device, source);
+ if (status != 0) {
+ Wayland_data_source_destroy(source);
+ }
+ } else {
+ status = Wayland_data_device_clear_selection(data_device);
+ }
+ }
+
+ return status;
+}
+
+char *
+Wayland_GetClipboardText(_THIS)
+{
+ SDL_VideoData *video_data = NULL;
+ SDL_WaylandDataDevice *data_device = NULL;
+
+ char *text = NULL;
+
+ void *buffer = NULL;
+ size_t length = 0;
+
+ if (_this == NULL || _this->driverdata == NULL) {
+ SDL_SetError("Video driver uninitialized");
+ } else {
+ video_data = _this->driverdata;
+ /* TODO: Support more than one seat */
+ data_device = Wayland_get_data_device(video_data->input);
+ if (data_device->selection_offer != NULL) {
+ buffer = Wayland_data_offer_receive(data_device->selection_offer,
+ &length, TEXT_MIME, SDL_TRUE);
+ if (length > 0) {
+ text = (char*) buffer;
+ }
+ } else if (data_device->selection_source != NULL) {
+ buffer = Wayland_data_source_get_data(data_device->selection_source,
+ &length, TEXT_MIME, SDL_TRUE);
+ if (length > 0) {
+ text = (char*) buffer;
+ }
+ }
+ }
+
+ if (text == NULL) {
+ text = SDL_strdup("");
+ }
+
+ return text;
+}
+
+SDL_bool
+Wayland_HasClipboardText(_THIS)
+{
+ SDL_VideoData *video_data = NULL;
+ SDL_WaylandDataDevice *data_device = NULL;
+
+ SDL_bool result = SDL_FALSE;
+ if (_this == NULL || _this->driverdata == NULL) {
+ SDL_SetError("Video driver uninitialized");
+ } else {
+ video_data = _this->driverdata;
+ data_device = Wayland_get_data_device(video_data->input);
+ if (data_device != NULL && Wayland_data_offer_has_mime(
+ data_device->selection_offer, TEXT_MIME)) {
+ result = SDL_TRUE;
+ } else if(data_device != NULL && Wayland_data_source_has_mime(
+ data_device->selection_source, TEXT_MIME)) {
+ result = SDL_TRUE;
+ }
+ }
+ return result;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.h
new file mode 100644
index 0000000..467e1c7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandclipboard.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylandclipboard_h_
+#define SDL_waylandclipboard_h_
+
+extern int Wayland_SetClipboardText(_THIS, const char *text);
+extern char *Wayland_GetClipboardText(_THIS);
+extern SDL_bool Wayland_HasClipboardText(_THIS);
+
+#endif /* SDL_waylandclipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.c
new file mode 100644
index 0000000..f1b9742
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.c
@@ -0,0 +1,468 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <limits.h>
+#include <signal.h>
+
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+#include "../../core/unix/SDL_poll.h"
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylanddatamanager.h"
+
+#include "SDL_waylanddyn.h"
+
+static ssize_t
+write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos)
+{
+ int ready = 0;
+ ssize_t bytes_written = 0;
+ ssize_t length = total_length - *pos;
+
+ sigset_t sig_set;
+ sigset_t old_sig_set;
+ struct timespec zerotime = {0};
+
+ ready = SDL_IOReady(fd, SDL_TRUE, 1 * 1000);
+
+ sigemptyset(&sig_set);
+ sigaddset(&sig_set, SIGPIPE);
+
+ pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set);
+
+ if (ready == 0) {
+ bytes_written = SDL_SetError("Pipe timeout");
+ } else if (ready < 0) {
+ bytes_written = SDL_SetError("Pipe select error");
+ } else {
+ if (length > 0) {
+ bytes_written = write(fd, (Uint8*)buffer + *pos, SDL_min(length, PIPE_BUF));
+ }
+
+ if (bytes_written > 0) {
+ *pos += bytes_written;
+ }
+ }
+
+ sigtimedwait(&sig_set, 0, &zerotime);
+ pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL);
+
+ return bytes_written;
+}
+
+static ssize_t
+read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate)
+{
+ int ready = 0;
+ void* output_buffer = NULL;
+ char temp[PIPE_BUF];
+ size_t new_buffer_length = 0;
+ ssize_t bytes_read = 0;
+ size_t pos = 0;
+
+ ready = SDL_IOReady(fd, SDL_FALSE, 1 * 1000);
+
+ if (ready == 0) {
+ bytes_read = SDL_SetError("Pipe timeout");
+ } else if (ready < 0) {
+ bytes_read = SDL_SetError("Pipe select error");
+ } else {
+ bytes_read = read(fd, temp, sizeof(temp));
+ }
+
+ if (bytes_read > 0) {
+ pos = *total_length;
+ *total_length += bytes_read;
+
+ if (null_terminate == SDL_TRUE) {
+ new_buffer_length = *total_length + 1;
+ } else {
+ new_buffer_length = *total_length;
+ }
+
+ if (*buffer == NULL) {
+ output_buffer = SDL_malloc(new_buffer_length);
+ } else {
+ output_buffer = SDL_realloc(*buffer, new_buffer_length);
+ }
+
+ if (output_buffer == NULL) {
+ bytes_read = SDL_OutOfMemory();
+ } else {
+ SDL_memcpy((Uint8*)output_buffer + pos, temp, bytes_read);
+
+ if (null_terminate == SDL_TRUE) {
+ SDL_memset((Uint8*)output_buffer + (new_buffer_length - 1), 0, 1);
+ }
+
+ *buffer = output_buffer;
+ }
+ }
+
+ return bytes_read;
+}
+
+#define MIME_LIST_SIZE 4
+
+static const char* mime_conversion_list[MIME_LIST_SIZE][2] = {
+ {"text/plain", TEXT_MIME},
+ {"TEXT", TEXT_MIME},
+ {"UTF8_STRING", TEXT_MIME},
+ {"STRING", TEXT_MIME}
+};
+
+const char*
+Wayland_convert_mime_type(const char *mime_type)
+{
+ const char *found = mime_type;
+
+ size_t index = 0;
+
+ for (index = 0; index < MIME_LIST_SIZE; ++index) {
+ if (strcmp(mime_conversion_list[index][0], mime_type) == 0) {
+ found = mime_conversion_list[index][1];
+ break;
+ }
+ }
+
+ return found;
+}
+
+static SDL_MimeDataList*
+mime_data_list_find(struct wl_list* list,
+ const char* mime_type)
+{
+ SDL_MimeDataList *found = NULL;
+
+ SDL_MimeDataList *mime_list = NULL;
+ wl_list_for_each(mime_list, list, link) {
+ if (strcmp(mime_list->mime_type, mime_type) == 0) {
+ found = mime_list;
+ break;
+ }
+ }
+ return found;
+}
+
+static int
+mime_data_list_add(struct wl_list* list,
+ const char* mime_type,
+ void* buffer, size_t length)
+{
+ int status = 0;
+ size_t mime_type_length = 0;
+
+ SDL_MimeDataList *mime_data = NULL;
+
+ mime_data = mime_data_list_find(list, mime_type);
+
+ if (mime_data == NULL) {
+ mime_data = SDL_calloc(1, sizeof(*mime_data));
+ if (mime_data == NULL) {
+ status = SDL_OutOfMemory();
+ } else {
+ WAYLAND_wl_list_insert(list, &(mime_data->link));
+
+ mime_type_length = strlen(mime_type) + 1;
+ mime_data->mime_type = SDL_malloc(mime_type_length);
+ if (mime_data->mime_type == NULL) {
+ status = SDL_OutOfMemory();
+ } else {
+ SDL_memcpy(mime_data->mime_type, mime_type, mime_type_length);
+ }
+ }
+ }
+
+ if (mime_data != NULL && buffer != NULL && length > 0) {
+ if (mime_data->data != NULL) {
+ SDL_free(mime_data->data);
+ }
+ mime_data->data = buffer;
+ mime_data->length = length;
+ }
+
+ return status;
+}
+
+static void
+mime_data_list_free(struct wl_list *list)
+{
+ SDL_MimeDataList *mime_data = NULL;
+ SDL_MimeDataList *next = NULL;
+
+ wl_list_for_each_safe(mime_data, next, list, link) {
+ if (mime_data->data != NULL) {
+ SDL_free(mime_data->data);
+ }
+ if (mime_data->mime_type != NULL) {
+ SDL_free(mime_data->mime_type);
+ }
+ SDL_free(mime_data);
+ }
+}
+
+ssize_t
+Wayland_data_source_send(SDL_WaylandDataSource *source,
+ const char *mime_type, int fd)
+{
+ size_t written_bytes = 0;
+ ssize_t status = 0;
+ SDL_MimeDataList *mime_data = NULL;
+
+ mime_type = Wayland_convert_mime_type(mime_type);
+ mime_data = mime_data_list_find(&source->mimes,
+ mime_type);
+
+ if (mime_data == NULL || mime_data->data == NULL) {
+ status = SDL_SetError("Invalid mime type");
+ close(fd);
+ } else {
+ while (write_pipe(fd, mime_data->data, mime_data->length,
+ &written_bytes) > 0);
+ close(fd);
+ status = written_bytes;
+ }
+ return status;
+}
+
+int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
+ const char *mime_type,
+ const void *buffer,
+ size_t length)
+{
+ int status = 0;
+ if (length > 0) {
+ void *internal_buffer = SDL_malloc(length);
+ if (internal_buffer == NULL) {
+ status = SDL_OutOfMemory();
+ } else {
+ SDL_memcpy(internal_buffer, buffer, length);
+ status = mime_data_list_add(&source->mimes, mime_type,
+ internal_buffer, length);
+ }
+ }
+ return status;
+}
+
+SDL_bool
+Wayland_data_source_has_mime(SDL_WaylandDataSource *source,
+ const char *mime_type)
+{
+ SDL_bool found = SDL_FALSE;
+
+ if (source != NULL) {
+ found = mime_data_list_find(&source->mimes, mime_type) != NULL;
+ }
+ return found;
+}
+
+void*
+Wayland_data_source_get_data(SDL_WaylandDataSource *source,
+ size_t *length, const char* mime_type,
+ SDL_bool null_terminate)
+{
+ SDL_MimeDataList *mime_data = NULL;
+ void *buffer = NULL;
+ *length = 0;
+
+ if (source == NULL) {
+ SDL_SetError("Invalid data source");
+ } else {
+ mime_data = mime_data_list_find(&source->mimes, mime_type);
+ if (mime_data != NULL && mime_data->length > 0) {
+ buffer = SDL_malloc(mime_data->length);
+ if (buffer == NULL) {
+ *length = SDL_OutOfMemory();
+ } else {
+ *length = mime_data->length;
+ SDL_memcpy(buffer, mime_data->data, mime_data->length);
+ }
+ }
+ }
+
+ return buffer;
+}
+
+void
+Wayland_data_source_destroy(SDL_WaylandDataSource *source)
+{
+ if (source != NULL) {
+ wl_data_source_destroy(source->source);
+ mime_data_list_free(&source->mimes);
+ SDL_free(source);
+ }
+}
+
+void*
+Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
+ size_t *length, const char* mime_type,
+ SDL_bool null_terminate)
+{
+ SDL_WaylandDataDevice *data_device = NULL;
+
+ int pipefd[2];
+ void *buffer = NULL;
+ *length = 0;
+
+ if (offer == NULL) {
+ SDL_SetError("Invalid data offer");
+ } else if ((data_device = offer->data_device) == NULL) {
+ SDL_SetError("Data device not initialized");
+ } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) {
+ SDL_SetError("Could not read pipe");
+ } else {
+ wl_data_offer_receive(offer->offer, mime_type, pipefd[1]);
+
+ /* TODO: Needs pump and flush? */
+ WAYLAND_wl_display_flush(data_device->video_data->display);
+
+ close(pipefd[1]);
+
+ while (read_pipe(pipefd[0], &buffer, length, null_terminate) > 0);
+ close(pipefd[0]);
+ }
+ return buffer;
+}
+
+int
+Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer,
+ const char* mime_type)
+{
+ return mime_data_list_add(&offer->mimes, mime_type, NULL, 0);
+}
+
+
+SDL_bool
+Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer,
+ const char *mime_type)
+{
+ SDL_bool found = SDL_FALSE;
+
+ if (offer != NULL) {
+ found = mime_data_list_find(&offer->mimes, mime_type) != NULL;
+ }
+ return found;
+}
+
+void
+Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer)
+{
+ if (offer != NULL) {
+ wl_data_offer_destroy(offer->offer);
+ mime_data_list_free(&offer->mimes);
+ SDL_free(offer);
+ }
+}
+
+int
+Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device)
+{
+ int status = 0;
+
+ if (data_device == NULL || data_device->data_device == NULL) {
+ status = SDL_SetError("Invalid Data Device");
+ } else if (data_device->selection_source != 0) {
+ wl_data_device_set_selection(data_device->data_device, NULL, 0);
+ data_device->selection_source = NULL;
+ }
+ return status;
+}
+
+int
+Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device,
+ SDL_WaylandDataSource *source)
+{
+ int status = 0;
+ size_t num_offers = 0;
+ size_t index = 0;
+
+ if (data_device == NULL) {
+ status = SDL_SetError("Invalid Data Device");
+ } else if (source == NULL) {
+ status = SDL_SetError("Invalid source");
+ } else {
+ SDL_MimeDataList *mime_data = NULL;
+
+ wl_list_for_each(mime_data, &(source->mimes), link) {
+ wl_data_source_offer(source->source,
+ mime_data->mime_type);
+
+ /* TODO - Improve system for multiple mime types to same data */
+ for (index = 0; index < MIME_LIST_SIZE; ++index) {
+ if (strcmp(mime_conversion_list[index][1], mime_data->mime_type) == 0) {
+ wl_data_source_offer(source->source,
+ mime_conversion_list[index][0]);
+ }
+ }
+ /* */
+
+ ++num_offers;
+ }
+
+ if (num_offers == 0) {
+ Wayland_data_device_clear_selection(data_device);
+ status = SDL_SetError("No mime data");
+ } else {
+ /* Only set if there is a valid serial if not set it later */
+ if (data_device->selection_serial != 0) {
+ wl_data_device_set_selection(data_device->data_device,
+ source->source,
+ data_device->selection_serial);
+ }
+ data_device->selection_source = source;
+ }
+ }
+
+ return status;
+}
+
+int
+Wayland_data_device_set_serial(SDL_WaylandDataDevice *data_device,
+ uint32_t serial)
+{
+ int status = -1;
+ if (data_device != NULL) {
+ status = 0;
+
+ /* If there was no serial and there is a pending selection set it now. */
+ if (data_device->selection_serial == 0
+ && data_device->selection_source != NULL) {
+ wl_data_device_set_selection(data_device->data_device,
+ data_device->selection_source->source,
+ serial);
+ }
+
+ data_device->selection_serial = serial;
+ }
+
+ return status;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.h
new file mode 100644
index 0000000..9b13e64
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddatamanager.h
@@ -0,0 +1,103 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylanddatamanager_h_
+#define SDL_waylanddatamanager_h_
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandwindow.h"
+
+#define TEXT_MIME "text/plain;charset=utf-8"
+#define FILE_MIME "text/uri-list"
+
+typedef struct {
+ char *mime_type;
+ void *data;
+ size_t length;
+ struct wl_list link;
+} SDL_MimeDataList;
+
+typedef struct {
+ struct wl_data_source *source;
+ struct wl_list mimes;
+} SDL_WaylandDataSource;
+
+typedef struct {
+ struct wl_data_offer *offer;
+ struct wl_list mimes;
+ void *data_device;
+} SDL_WaylandDataOffer;
+
+typedef struct {
+ struct wl_data_device *data_device;
+ SDL_VideoData *video_data;
+
+ /* Drag and Drop */
+ uint32_t drag_serial;
+ SDL_WaylandDataOffer *drag_offer;
+ SDL_WaylandDataOffer *selection_offer;
+
+ /* Clipboard */
+ uint32_t selection_serial;
+ SDL_WaylandDataSource *selection_source;
+} SDL_WaylandDataDevice;
+
+extern const char* Wayland_convert_mime_type(const char *mime_type);
+
+/* Wayland Data Source - (Sending) */
+extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS);
+extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source,
+ const char *mime_type, int fd);
+extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
+ const char *mime_type,
+ const void *buffer,
+ size_t length);
+extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source,
+ const char *mime_type);
+extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source,
+ size_t *length,
+ const char *mime_type,
+ SDL_bool null_terminate);
+extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source);
+
+/* Wayland Data Offer - (Receiving) */
+extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
+ size_t *length,
+ const char *mime_type,
+ SDL_bool null_terminate);
+extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer,
+ const char *mime_type);
+extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer,
+ const char *mime_type);
+extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer);
+
+/* Clipboard */
+extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device);
+extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device,
+ SDL_WaylandDataSource *source);
+extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device,
+ uint32_t serial);
+#endif /* SDL_waylanddatamanager_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.c
new file mode 100644
index 0000000..98cc518
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.c
@@ -0,0 +1,178 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#define DEBUG_DYNAMIC_WAYLAND 0
+
+#include "SDL_waylanddyn.h"
+
+#if DEBUG_DYNAMIC_WAYLAND
+#include "SDL_log.h"
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+ void *lib;
+ const char *libname;
+} waylanddynlib;
+
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON NULL
+#endif
+
+static waylanddynlib waylandlibs[] = {
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC},
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL},
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR},
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON}
+};
+
+static void *
+WAYLAND_GetSym(const char *fnname, int *pHasModule)
+{
+ int i;
+ void *fn = NULL;
+ for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+ if (waylandlibs[i].lib != NULL) {
+ fn = SDL_LoadFunction(waylandlibs[i].lib, fnname);
+ if (fn != NULL)
+ break;
+ }
+ }
+
+#if DEBUG_DYNAMIC_WAYLAND
+ if (fn != NULL)
+ SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, waylandlibs[i].libname, fn);
+ else
+ SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+ if (fn == NULL)
+ *pHasModule = 0; /* kill this module. */
+
+ return fn;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+/* Define all the function pointers and wrappers... */
+#define SDL_WAYLAND_MODULE(modname) int SDL_WAYLAND_HAVE_##modname = 0;
+#define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL;
+#define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL;
+#include "SDL_waylandsym.h"
+
+static int wayland_load_refcount = 0;
+
+void
+SDL_WAYLAND_UnloadSymbols(void)
+{
+ /* Don't actually unload if more than one module is using the libs... */
+ if (wayland_load_refcount > 0) {
+ if (--wayland_load_refcount == 0) {
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ int i;
+#endif
+
+ /* set all the function pointers to NULL. */
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 0;
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
+#include "SDL_waylandsym.h"
+
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+ if (waylandlibs[i].lib != NULL) {
+ SDL_UnloadObject(waylandlibs[i].lib);
+ waylandlibs[i].lib = NULL;
+ }
+ }
+#endif
+ }
+ }
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_WAYLAND_LoadSymbols(void)
+{
+ int rc = 1; /* always succeed if not using Dynamic WAYLAND stuff. */
+
+ /* deal with multiple modules (dga, wayland, etc) needing these symbols... */
+ if (wayland_load_refcount++ == 0) {
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ int i;
+ int *thismod = NULL;
+ for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+ if (waylandlibs[i].libname != NULL) {
+ waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname);
+ }
+ }
+
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
+#include "SDL_waylandsym.h"
+
+#define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
+#include "SDL_waylandsym.h"
+
+ if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) {
+ /* all required symbols loaded. */
+ SDL_ClearError();
+ } else {
+ /* in case something got loaded... */
+ SDL_WAYLAND_UnloadSymbols();
+ rc = 0;
+ }
+
+#else /* no dynamic WAYLAND */
+
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface;
+#include "SDL_waylandsym.h"
+
+#endif
+ }
+
+ return rc;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.h
new file mode 100644
index 0000000..720427e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylanddyn.h
@@ -0,0 +1,107 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_waylanddyn_h_
+#define SDL_waylanddyn_h_
+
+#include "../../SDL_internal.h"
+
+/* We can't include wayland-client.h here
+ * but we need some structs from it
+ */
+struct wl_interface;
+struct wl_proxy;
+struct wl_event_queue;
+struct wl_display;
+struct wl_surface;
+struct wl_shm;
+
+#include <stdint.h>
+#include "wayland-cursor.h"
+#include "wayland-util.h"
+#include "xkbcommon/xkbcommon.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+int SDL_WAYLAND_LoadSymbols(void);
+void SDL_WAYLAND_UnloadSymbols(void);
+
+#define SDL_WAYLAND_MODULE(modname) extern int SDL_WAYLAND_HAVE_##modname;
+#define SDL_WAYLAND_SYM(rc,fn,params) \
+ typedef rc (*SDL_DYNWAYLANDFN_##fn) params; \
+ extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn;
+#define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
+#include "SDL_waylandsym.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+
+#ifdef _WAYLAND_CLIENT_H
+#error Do not include wayland-client ahead of SDL_waylanddyn.h in dynamic loading mode
+#endif
+
+/* wayland-client-protocol.h included from wayland-client.h
+ * has inline functions that require these to be defined in dynamic loading mode
+ */
+
+#define wl_proxy_create (*WAYLAND_wl_proxy_create)
+#define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy)
+#define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal)
+#define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data)
+#define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
+#define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener)
+#define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor)
+#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned)
+
+#define wl_seat_interface (*WAYLAND_wl_seat_interface)
+#define wl_surface_interface (*WAYLAND_wl_surface_interface)
+#define wl_shm_pool_interface (*WAYLAND_wl_shm_pool_interface)
+#define wl_buffer_interface (*WAYLAND_wl_buffer_interface)
+#define wl_registry_interface (*WAYLAND_wl_registry_interface)
+#define wl_shell_surface_interface (*WAYLAND_wl_shell_surface_interface)
+#define wl_region_interface (*WAYLAND_wl_region_interface)
+#define wl_pointer_interface (*WAYLAND_wl_pointer_interface)
+#define wl_keyboard_interface (*WAYLAND_wl_keyboard_interface)
+#define wl_compositor_interface (*WAYLAND_wl_compositor_interface)
+#define wl_output_interface (*WAYLAND_wl_output_interface)
+#define wl_shell_interface (*WAYLAND_wl_shell_interface)
+#define wl_shm_interface (*WAYLAND_wl_shm_interface)
+#define wl_data_device_interface (*WAYLAND_wl_data_device_interface)
+#define wl_data_offer_interface (*WAYLAND_wl_data_offer_interface)
+#define wl_data_source_interface (*WAYLAND_wl_data_source_interface)
+#define wl_data_device_manager_interface (*WAYLAND_wl_data_device_manager_interface)
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+#include "wayland-client-core.h"
+#include "wayland-client-protocol.h"
+#include "wayland-egl.h"
+
+#endif /* SDL_waylanddyn_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents.c
new file mode 100644
index 0000000..53453a2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents.c
@@ -0,0 +1,1129 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+#include "SDL_log.h"
+
+#include "../../core/unix/SDL_poll.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/scancodes_xfree86.h"
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandevents_c.h"
+#include "SDL_waylandwindow.h"
+
+#include "SDL_waylanddyn.h"
+
+#include "pointer-constraints-unstable-v1-client-protocol.h"
+#include "relative-pointer-unstable-v1-client-protocol.h"
+#include "xdg-shell-unstable-v6-client-protocol.h"
+
+#include <linux/input.h>
+#include <sys/select.h>
+#include <sys/mman.h>
+#include <poll.h>
+#include <unistd.h>
+#include <xkbcommon/xkbcommon.h>
+
+struct SDL_WaylandInput {
+ SDL_VideoData *display;
+ struct wl_seat *seat;
+ struct wl_pointer *pointer;
+ struct wl_touch *touch;
+ struct wl_keyboard *keyboard;
+ SDL_WaylandDataDevice *data_device;
+ struct zwp_relative_pointer_v1 *relative_pointer;
+ SDL_WindowData *pointer_focus;
+ SDL_WindowData *keyboard_focus;
+
+ /* Last motion location */
+ wl_fixed_t sx_w;
+ wl_fixed_t sy_w;
+
+ double dx_frac;
+ double dy_frac;
+
+ struct {
+ struct xkb_keymap *keymap;
+ struct xkb_state *state;
+ } xkb;
+};
+
+struct SDL_WaylandTouchPoint {
+ SDL_TouchID id;
+ float x;
+ float y;
+ struct wl_surface* surface;
+
+ struct SDL_WaylandTouchPoint* prev;
+ struct SDL_WaylandTouchPoint* next;
+};
+
+struct SDL_WaylandTouchPointList {
+ struct SDL_WaylandTouchPoint* head;
+ struct SDL_WaylandTouchPoint* tail;
+};
+
+static struct SDL_WaylandTouchPointList touch_points = {NULL, NULL};
+
+static void
+touch_add(SDL_TouchID id, float x, float y, struct wl_surface *surface)
+{
+ struct SDL_WaylandTouchPoint* tp = SDL_malloc(sizeof(struct SDL_WaylandTouchPoint));
+
+ tp->id = id;
+ tp->x = x;
+ tp->y = y;
+ tp->surface = surface;
+
+ if (touch_points.tail) {
+ touch_points.tail->next = tp;
+ tp->prev = touch_points.tail;
+ } else {
+ touch_points.head = tp;
+ tp->prev = NULL;
+ }
+
+ touch_points.tail = tp;
+ tp->next = NULL;
+}
+
+static void
+touch_update(SDL_TouchID id, float x, float y)
+{
+ struct SDL_WaylandTouchPoint* tp = touch_points.head;
+
+ while (tp) {
+ if (tp->id == id) {
+ tp->x = x;
+ tp->y = y;
+ }
+
+ tp = tp->next;
+ }
+}
+
+static void
+touch_del(SDL_TouchID id, float* x, float* y)
+{
+ struct SDL_WaylandTouchPoint* tp = touch_points.head;
+
+ while (tp) {
+ if (tp->id == id) {
+ *x = tp->x;
+ *y = tp->y;
+
+ if (tp->prev) {
+ tp->prev->next = tp->next;
+ } else {
+ touch_points.head = tp->next;
+ }
+
+ if (tp->next) {
+ tp->next->prev = tp->prev;
+ } else {
+ touch_points.tail = tp->prev;
+ }
+
+ SDL_free(tp);
+ }
+
+ tp = tp->next;
+ }
+}
+
+static struct wl_surface*
+touch_surface(SDL_TouchID id)
+{
+ struct SDL_WaylandTouchPoint* tp = touch_points.head;
+
+ while (tp) {
+ if (tp->id == id) {
+ return tp->surface;
+ }
+
+ tp = tp->next;
+ }
+
+ return NULL;
+}
+
+void
+Wayland_PumpEvents(_THIS)
+{
+ SDL_VideoData *d = _this->driverdata;
+
+ if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, 0)) {
+ WAYLAND_wl_display_dispatch(d->display);
+ }
+ else
+ {
+ WAYLAND_wl_display_dispatch_pending(d->display);
+ }
+}
+
+static void
+pointer_handle_enter(void *data, struct wl_pointer *pointer,
+ uint32_t serial, struct wl_surface *surface,
+ wl_fixed_t sx_w, wl_fixed_t sy_w)
+{
+ struct SDL_WaylandInput *input = data;
+ SDL_WindowData *window;
+
+ if (!surface) {
+ /* enter event for a window we've just destroyed */
+ return;
+ }
+
+ /* This handler will be called twice in Wayland 1.4
+ * Once for the window surface which has valid user data
+ * and again for the mouse cursor surface which does not have valid user data
+ * We ignore the later
+ */
+
+ window = (SDL_WindowData *)wl_surface_get_user_data(surface);
+
+ if (window) {
+ input->pointer_focus = window;
+ SDL_SetMouseFocus(window->sdlwindow);
+ }
+}
+
+static void
+pointer_handle_leave(void *data, struct wl_pointer *pointer,
+ uint32_t serial, struct wl_surface *surface)
+{
+ struct SDL_WaylandInput *input = data;
+
+ if (input->pointer_focus) {
+ SDL_SetMouseFocus(NULL);
+ input->pointer_focus = NULL;
+ }
+}
+
+static void
+pointer_handle_motion(void *data, struct wl_pointer *pointer,
+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
+{
+ struct SDL_WaylandInput *input = data;
+ SDL_WindowData *window = input->pointer_focus;
+ input->sx_w = sx_w;
+ input->sy_w = sy_w;
+ if (input->pointer_focus) {
+ const int sx = wl_fixed_to_int(sx_w);
+ const int sy = wl_fixed_to_int(sy_w);
+ SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy);
+ }
+}
+
+static SDL_bool
+ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial)
+{
+ SDL_WindowData *window_data = input->pointer_focus;
+ SDL_Window *window = window_data->sdlwindow;
+
+ if (window->hit_test) {
+ const SDL_Point point = { wl_fixed_to_int(input->sx_w), wl_fixed_to_int(input->sy_w) };
+ const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
+
+ static const uint32_t directions_wl[] = {
+ WL_SHELL_SURFACE_RESIZE_TOP_LEFT, WL_SHELL_SURFACE_RESIZE_TOP,
+ WL_SHELL_SURFACE_RESIZE_TOP_RIGHT, WL_SHELL_SURFACE_RESIZE_RIGHT,
+ WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM,
+ WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT, WL_SHELL_SURFACE_RESIZE_LEFT
+ };
+
+ /* the names are different (ZXDG_TOPLEVEL_V6_RESIZE_EDGE_* vs
+ WL_SHELL_SURFACE_RESIZE_*), but the values are the same. */
+ const uint32_t *directions_zxdg = directions_wl;
+
+ switch (rc) {
+ case SDL_HITTEST_DRAGGABLE:
+ if (input->display->shell.zxdg) {
+ zxdg_toplevel_v6_move(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial);
+ } else {
+ wl_shell_surface_move(window_data->shell_surface.wl, input->seat, serial);
+ }
+ return SDL_TRUE;
+
+ case SDL_HITTEST_RESIZE_TOPLEFT:
+ case SDL_HITTEST_RESIZE_TOP:
+ case SDL_HITTEST_RESIZE_TOPRIGHT:
+ case SDL_HITTEST_RESIZE_RIGHT:
+ case SDL_HITTEST_RESIZE_BOTTOMRIGHT:
+ case SDL_HITTEST_RESIZE_BOTTOM:
+ case SDL_HITTEST_RESIZE_BOTTOMLEFT:
+ case SDL_HITTEST_RESIZE_LEFT:
+ if (input->display->shell.zxdg) {
+ zxdg_toplevel_v6_resize(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
+ } else {
+ wl_shell_surface_resize(window_data->shell_surface.wl, input->seat, serial, directions_wl[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
+ }
+ return SDL_TRUE;
+
+ default: return SDL_FALSE;
+ }
+ }
+
+ return SDL_FALSE;
+}
+
+static void
+pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial,
+ uint32_t time, uint32_t button, uint32_t state_w)
+{
+ SDL_WindowData *window = input->pointer_focus;
+ enum wl_pointer_button_state state = state_w;
+ uint32_t sdl_button;
+
+ if (input->pointer_focus) {
+ switch (button) {
+ case BTN_LEFT:
+ sdl_button = SDL_BUTTON_LEFT;
+ if (ProcessHitTest(input, serial)) {
+ return; /* don't pass this event on to app. */
+ }
+ break;
+ case BTN_MIDDLE:
+ sdl_button = SDL_BUTTON_MIDDLE;
+ break;
+ case BTN_RIGHT:
+ sdl_button = SDL_BUTTON_RIGHT;
+ break;
+ case BTN_SIDE:
+ sdl_button = SDL_BUTTON_X1;
+ break;
+ case BTN_EXTRA:
+ sdl_button = SDL_BUTTON_X2;
+ break;
+ default:
+ return;
+ }
+
+ Wayland_data_device_set_serial(input->data_device, serial);
+
+ SDL_SendMouseButton(window->sdlwindow, 0,
+ state ? SDL_PRESSED : SDL_RELEASED, sdl_button);
+ }
+}
+
+static void
+pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
+ uint32_t time, uint32_t button, uint32_t state_w)
+{
+ struct SDL_WaylandInput *input = data;
+
+ pointer_handle_button_common(input, serial, time, button, state_w);
+}
+
+static void
+pointer_handle_axis_common(struct SDL_WaylandInput *input,
+ uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+ SDL_WindowData *window = input->pointer_focus;
+ enum wl_pointer_axis a = axis;
+ float x, y;
+
+ if (input->pointer_focus) {
+ switch (a) {
+ case WL_POINTER_AXIS_VERTICAL_SCROLL:
+ x = 0;
+ y = 0 - (float)wl_fixed_to_double(value);
+ break;
+ case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
+ x = 0 - (float)wl_fixed_to_double(value);
+ y = 0;
+ break;
+ default:
+ return;
+ }
+
+ SDL_SendMouseWheel(window->sdlwindow, 0, x, y, SDL_MOUSEWHEEL_NORMAL);
+ }
+}
+
+static void
+pointer_handle_axis(void *data, struct wl_pointer *pointer,
+ uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+ struct SDL_WaylandInput *input = data;
+
+ pointer_handle_axis_common(input, time, axis, value);
+}
+
+static const struct wl_pointer_listener pointer_listener = {
+ pointer_handle_enter,
+ pointer_handle_leave,
+ pointer_handle_motion,
+ pointer_handle_button,
+ pointer_handle_axis,
+ NULL, /* frame */
+ NULL, /* axis_source */
+ NULL, /* axis_stop */
+ NULL, /* axis_discrete */
+};
+
+static void
+touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial,
+ unsigned int timestamp, struct wl_surface *surface,
+ int id, wl_fixed_t fx, wl_fixed_t fy)
+{
+ float x, y;
+ SDL_WindowData* window;
+
+ window = (SDL_WindowData *)wl_surface_get_user_data(surface);
+
+ x = wl_fixed_to_double(fx) / window->sdlwindow->w;
+ y = wl_fixed_to_double(fy) / window->sdlwindow->h;
+
+ touch_add(id, x, y, surface);
+ SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f);
+}
+
+static void
+touch_handler_up(void *data, struct wl_touch *touch, unsigned int serial,
+ unsigned int timestamp, int id)
+{
+ float x = 0, y = 0;
+
+ touch_del(id, &x, &y);
+ SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f);
+}
+
+static void
+touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp,
+ int id, wl_fixed_t fx, wl_fixed_t fy)
+{
+ float x, y;
+ SDL_WindowData* window;
+
+ window = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id));
+
+ x = wl_fixed_to_double(fx) / window->sdlwindow->w;
+ y = wl_fixed_to_double(fy) / window->sdlwindow->h;
+
+ touch_update(id, x, y);
+ SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f);
+}
+
+static void
+touch_handler_frame(void *data, struct wl_touch *touch)
+{
+
+}
+
+static void
+touch_handler_cancel(void *data, struct wl_touch *touch)
+{
+
+}
+
+static const struct wl_touch_listener touch_listener = {
+ touch_handler_down,
+ touch_handler_up,
+ touch_handler_motion,
+ touch_handler_frame,
+ touch_handler_cancel,
+ NULL, /* shape */
+ NULL, /* orientation */
+};
+
+static void
+keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
+ uint32_t format, int fd, uint32_t size)
+{
+ struct SDL_WaylandInput *input = data;
+ char *map_str;
+
+ if (!data) {
+ close(fd);
+ return;
+ }
+
+ if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
+ close(fd);
+ return;
+ }
+
+ map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
+ if (map_str == MAP_FAILED) {
+ close(fd);
+ return;
+ }
+
+ input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context,
+ map_str,
+ XKB_KEYMAP_FORMAT_TEXT_V1,
+ 0);
+ munmap(map_str, size);
+ close(fd);
+
+ if (!input->xkb.keymap) {
+ fprintf(stderr, "failed to compile keymap\n");
+ return;
+ }
+
+ input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap);
+ if (!input->xkb.state) {
+ fprintf(stderr, "failed to create XKB state\n");
+ WAYLAND_xkb_keymap_unref(input->xkb.keymap);
+ input->xkb.keymap = NULL;
+ return;
+ }
+}
+
+static void
+keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, struct wl_surface *surface,
+ struct wl_array *keys)
+{
+ struct SDL_WaylandInput *input = data;
+ SDL_WindowData *window;
+
+ if (!surface) {
+ /* enter event for a window we've just destroyed */
+ return;
+ }
+
+ window = wl_surface_get_user_data(surface);
+
+ if (window) {
+ input->keyboard_focus = window;
+ window->keyboard_device = input;
+ SDL_SetKeyboardFocus(window->sdlwindow);
+ }
+}
+
+static void
+keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, struct wl_surface *surface)
+{
+ SDL_SetKeyboardFocus(NULL);
+}
+
+static void
+keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, uint32_t time, uint32_t key,
+ uint32_t state_w)
+{
+ struct SDL_WaylandInput *input = data;
+ SDL_WindowData *window = input->keyboard_focus;
+ enum wl_keyboard_key_state state = state_w;
+ const xkb_keysym_t *syms;
+ uint32_t scancode;
+ char text[8];
+ int size;
+
+ if (key < SDL_arraysize(xfree86_scancode_table2)) {
+ scancode = xfree86_scancode_table2[key];
+
+ // TODO when do we get WL_KEYBOARD_KEY_STATE_REPEAT?
+ if (scancode != SDL_SCANCODE_UNKNOWN)
+ SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ?
+ SDL_PRESSED : SDL_RELEASED, scancode);
+ }
+
+ if (!window || window->keyboard_device != input || !input->xkb.state)
+ return;
+
+ // TODO can this happen?
+ if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
+ return;
+
+ if (state) {
+ size = WAYLAND_xkb_keysym_to_utf8(syms[0], text, sizeof text);
+
+ if (size > 0) {
+ text[size] = 0;
+
+ Wayland_data_device_set_serial(input->data_device, serial);
+
+ SDL_SendKeyboardText(text);
+ }
+ }
+}
+
+static void
+keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, uint32_t mods_depressed,
+ uint32_t mods_latched, uint32_t mods_locked,
+ uint32_t group)
+{
+ struct SDL_WaylandInput *input = data;
+
+ WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
+ mods_locked, 0, 0, group);
+}
+
+static const struct wl_keyboard_listener keyboard_listener = {
+ keyboard_handle_keymap,
+ keyboard_handle_enter,
+ keyboard_handle_leave,
+ keyboard_handle_key,
+ keyboard_handle_modifiers,
+ NULL, /* repeat_info */
+};
+
+static void
+seat_handle_capabilities(void *data, struct wl_seat *seat,
+ enum wl_seat_capability caps)
+{
+ struct SDL_WaylandInput *input = data;
+
+ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
+ input->pointer = wl_seat_get_pointer(seat);
+ input->display->pointer = input->pointer;
+ wl_pointer_set_user_data(input->pointer, input);
+ wl_pointer_add_listener(input->pointer, &pointer_listener,
+ input);
+ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
+ wl_pointer_destroy(input->pointer);
+ input->pointer = NULL;
+ input->display->pointer = NULL;
+ }
+
+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
+ SDL_AddTouch(1, "wayland_touch");
+ input->touch = wl_seat_get_touch(seat);
+ wl_touch_set_user_data(input->touch, input);
+ wl_touch_add_listener(input->touch, &touch_listener,
+ input);
+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
+ SDL_DelTouch(1);
+ wl_touch_destroy(input->touch);
+ input->touch = NULL;
+ }
+
+ if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {
+ input->keyboard = wl_seat_get_keyboard(seat);
+ wl_keyboard_set_user_data(input->keyboard, input);
+ wl_keyboard_add_listener(input->keyboard, &keyboard_listener,
+ input);
+ } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
+ wl_keyboard_destroy(input->keyboard);
+ input->keyboard = NULL;
+ }
+}
+
+static const struct wl_seat_listener seat_listener = {
+ seat_handle_capabilities,
+ NULL, /* name */
+};
+
+static void
+data_source_handle_target(void *data, struct wl_data_source *wl_data_source,
+ const char *mime_type)
+{
+}
+
+static void
+data_source_handle_send(void *data, struct wl_data_source *wl_data_source,
+ const char *mime_type, int32_t fd)
+{
+ Wayland_data_source_send((SDL_WaylandDataSource *)data, mime_type, fd);
+}
+
+static void
+data_source_handle_cancelled(void *data, struct wl_data_source *wl_data_source)
+{
+ Wayland_data_source_destroy(data);
+}
+
+static void
+data_source_handle_dnd_drop_performed(void *data, struct wl_data_source *wl_data_source)
+{
+}
+
+static void
+data_source_handle_dnd_finished(void *data, struct wl_data_source *wl_data_source)
+{
+}
+
+static void
+data_source_handle_action(void *data, struct wl_data_source *wl_data_source,
+ uint32_t dnd_action)
+{
+}
+
+static const struct wl_data_source_listener data_source_listener = {
+ data_source_handle_target,
+ data_source_handle_send,
+ data_source_handle_cancelled,
+ data_source_handle_dnd_drop_performed, // Version 3
+ data_source_handle_dnd_finished, // Version 3
+ data_source_handle_action, // Version 3
+};
+
+SDL_WaylandDataSource*
+Wayland_data_source_create(_THIS)
+{
+ SDL_WaylandDataSource *data_source = NULL;
+ SDL_VideoData *driver_data = NULL;
+ struct wl_data_source *id = NULL;
+
+ if (_this == NULL || _this->driverdata == NULL) {
+ SDL_SetError("Video driver uninitialized");
+ } else {
+ driver_data = _this->driverdata;
+
+ if (driver_data->data_device_manager != NULL) {
+ id = wl_data_device_manager_create_data_source(
+ driver_data->data_device_manager);
+ }
+
+ if (id == NULL) {
+ SDL_SetError("Wayland unable to create data source");
+ } else {
+ data_source = SDL_calloc(1, sizeof *data_source);
+ if (data_source == NULL) {
+ SDL_OutOfMemory();
+ wl_data_source_destroy(id);
+ } else {
+ WAYLAND_wl_list_init(&(data_source->mimes));
+ data_source->source = id;
+ wl_data_source_set_user_data(id, data_source);
+ wl_data_source_add_listener(id, &data_source_listener,
+ data_source);
+ }
+ }
+ }
+ return data_source;
+}
+
+static void
+data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_offer,
+ const char *mime_type)
+{
+ SDL_WaylandDataOffer *offer = data;
+ Wayland_data_offer_add_mime(offer, mime_type);
+}
+
+static void
+data_offer_handle_source_actions(void *data, struct wl_data_offer *wl_data_offer,
+ uint32_t source_actions)
+{
+}
+
+static void
+data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_offer,
+ uint32_t dnd_action)
+{
+}
+
+static const struct wl_data_offer_listener data_offer_listener = {
+ data_offer_handle_offer,
+ data_offer_handle_source_actions, // Version 3
+ data_offer_handle_actions, // Version 3
+};
+
+static void
+data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device,
+ struct wl_data_offer *id)
+{
+ SDL_WaylandDataOffer *data_offer = NULL;
+
+ data_offer = SDL_calloc(1, sizeof *data_offer);
+ if (data_offer == NULL) {
+ SDL_OutOfMemory();
+ } else {
+ data_offer->offer = id;
+ data_offer->data_device = data;
+ WAYLAND_wl_list_init(&(data_offer->mimes));
+ wl_data_offer_set_user_data(id, data_offer);
+ wl_data_offer_add_listener(id, &data_offer_listener, data_offer);
+ }
+}
+
+static void
+data_device_handle_enter(void *data, struct wl_data_device *wl_data_device,
+ uint32_t serial, struct wl_surface *surface,
+ wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id)
+{
+ SDL_WaylandDataDevice *data_device = data;
+ SDL_bool has_mime = SDL_FALSE;
+ uint32_t dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
+
+ data_device->drag_serial = serial;
+
+ if (id != NULL) {
+ data_device->drag_offer = wl_data_offer_get_user_data(id);
+
+ /* TODO: SDL Support more mime types */
+ has_mime = Wayland_data_offer_has_mime(
+ data_device->drag_offer, FILE_MIME);
+
+ /* If drag_mime is NULL this will decline the offer */
+ wl_data_offer_accept(id, serial,
+ (has_mime == SDL_TRUE) ? FILE_MIME : NULL);
+
+ /* SDL only supports "copy" style drag and drop */
+ if (has_mime == SDL_TRUE) {
+ dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
+ }
+ wl_data_offer_set_actions(data_device->drag_offer->offer,
+ dnd_action, dnd_action);
+ }
+}
+
+static void
+data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
+{
+ SDL_WaylandDataDevice *data_device = data;
+ SDL_WaylandDataOffer *offer = NULL;
+
+ if (data_device->selection_offer != NULL) {
+ data_device->selection_offer = NULL;
+ Wayland_data_offer_destroy(offer);
+ }
+}
+
+static void
+data_device_handle_motion(void *data, struct wl_data_device *wl_data_device,
+ uint32_t time, wl_fixed_t x, wl_fixed_t y)
+{
+}
+
+static void
+data_device_handle_drop(void *data, struct wl_data_device *wl_data_device)
+{
+ SDL_WaylandDataDevice *data_device = data;
+ void *buffer = NULL;
+ size_t length = 0;
+
+ const char *current_uri = NULL;
+ const char *last_char = NULL;
+ char *current_char = NULL;
+
+ if (data_device->drag_offer != NULL) {
+ /* TODO: SDL Support more mime types */
+ buffer = Wayland_data_offer_receive(data_device->drag_offer,
+ &length, FILE_MIME, SDL_FALSE);
+
+ /* uri-list */
+ current_uri = (const char *)buffer;
+ last_char = (const char *)buffer + length;
+ for (current_char = buffer; current_char < last_char; ++current_char) {
+ if (*current_char == '\n' || *current_char == 0) {
+ if (*current_uri != 0 && *current_uri != '#') {
+ *current_char = 0;
+ SDL_SendDropFile(NULL, current_uri);
+ }
+ current_uri = (const char *)current_char + 1;
+ }
+ }
+
+ SDL_free(buffer);
+ }
+}
+
+static void
+data_device_handle_selection(void *data, struct wl_data_device *wl_data_device,
+ struct wl_data_offer *id)
+{
+ SDL_WaylandDataDevice *data_device = data;
+ SDL_WaylandDataOffer *offer = NULL;
+
+ if (id != NULL) {
+ offer = wl_data_offer_get_user_data(id);
+ }
+
+ if (data_device->selection_offer != offer) {
+ Wayland_data_offer_destroy(data_device->selection_offer);
+ data_device->selection_offer = offer;
+ }
+
+ SDL_SendClipboardUpdate();
+}
+
+static const struct wl_data_device_listener data_device_listener = {
+ data_device_handle_data_offer,
+ data_device_handle_enter,
+ data_device_handle_leave,
+ data_device_handle_motion,
+ data_device_handle_drop,
+ data_device_handle_selection
+};
+
+void
+Wayland_display_add_input(SDL_VideoData *d, uint32_t id)
+{
+ struct SDL_WaylandInput *input;
+ SDL_WaylandDataDevice *data_device = NULL;
+
+ input = SDL_calloc(1, sizeof *input);
+ if (input == NULL)
+ return;
+
+ input->display = d;
+ input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 1);
+ input->sx_w = wl_fixed_from_int(0);
+ input->sy_w = wl_fixed_from_int(0);
+ d->input = input;
+
+ if (d->data_device_manager != NULL) {
+ data_device = SDL_calloc(1, sizeof *data_device);
+ if (data_device == NULL) {
+ return;
+ }
+
+ data_device->data_device = wl_data_device_manager_get_data_device(
+ d->data_device_manager, input->seat
+ );
+ data_device->video_data = d;
+
+ if (data_device->data_device == NULL) {
+ SDL_free(data_device);
+ } else {
+ wl_data_device_set_user_data(data_device->data_device, data_device);
+ wl_data_device_add_listener(data_device->data_device,
+ &data_device_listener, data_device);
+ input->data_device = data_device;
+ }
+ }
+
+ wl_seat_add_listener(input->seat, &seat_listener, input);
+ wl_seat_set_user_data(input->seat, input);
+
+ WAYLAND_wl_display_flush(d->display);
+}
+
+void Wayland_display_destroy_input(SDL_VideoData *d)
+{
+ struct SDL_WaylandInput *input = d->input;
+
+ if (!input)
+ return;
+
+ if (input->data_device != NULL) {
+ Wayland_data_device_clear_selection(input->data_device);
+ if (input->data_device->selection_offer != NULL) {
+ Wayland_data_offer_destroy(input->data_device->selection_offer);
+ }
+ if (input->data_device->drag_offer != NULL) {
+ Wayland_data_offer_destroy(input->data_device->drag_offer);
+ }
+ if (input->data_device->data_device != NULL) {
+ wl_data_device_release(input->data_device->data_device);
+ }
+ SDL_free(input->data_device);
+ }
+
+ if (input->keyboard)
+ wl_keyboard_destroy(input->keyboard);
+
+ if (input->pointer)
+ wl_pointer_destroy(input->pointer);
+
+ if (input->touch) {
+ SDL_DelTouch(1);
+ wl_touch_destroy(input->touch);
+ }
+
+ if (input->seat)
+ wl_seat_destroy(input->seat);
+
+ if (input->xkb.state)
+ WAYLAND_xkb_state_unref(input->xkb.state);
+
+ if (input->xkb.keymap)
+ WAYLAND_xkb_keymap_unref(input->xkb.keymap);
+
+ SDL_free(input);
+ d->input = NULL;
+}
+
+SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input)
+{
+ if (input == NULL) {
+ return NULL;
+ }
+
+ return input->data_device;
+}
+
+/* !!! FIXME: just merge these into display_handle_global(). */
+void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id)
+{
+ d->relative_pointer_manager =
+ wl_registry_bind(d->registry, id,
+ &zwp_relative_pointer_manager_v1_interface, 1);
+}
+
+void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d)
+{
+ if (d->relative_pointer_manager)
+ zwp_relative_pointer_manager_v1_destroy(d->relative_pointer_manager);
+}
+
+void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id)
+{
+ d->pointer_constraints =
+ wl_registry_bind(d->registry, id,
+ &zwp_pointer_constraints_v1_interface, 1);
+}
+
+void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d)
+{
+ if (d->pointer_constraints)
+ zwp_pointer_constraints_v1_destroy(d->pointer_constraints);
+}
+
+static void
+relative_pointer_handle_relative_motion(void *data,
+ struct zwp_relative_pointer_v1 *pointer,
+ uint32_t time_hi,
+ uint32_t time_lo,
+ wl_fixed_t dx_w,
+ wl_fixed_t dy_w,
+ wl_fixed_t dx_unaccel_w,
+ wl_fixed_t dy_unaccel_w)
+{
+ struct SDL_WaylandInput *input = data;
+ SDL_VideoData *d = input->display;
+ SDL_WindowData *window = input->pointer_focus;
+ double dx_unaccel;
+ double dy_unaccel;
+ double dx;
+ double dy;
+
+ dx_unaccel = wl_fixed_to_double(dx_unaccel_w);
+ dy_unaccel = wl_fixed_to_double(dy_unaccel_w);
+
+ /* Add left over fraction from last event. */
+ dx_unaccel += input->dx_frac;
+ dy_unaccel += input->dy_frac;
+
+ input->dx_frac = modf(dx_unaccel, &dx);
+ input->dy_frac = modf(dy_unaccel, &dy);
+
+ if (input->pointer_focus && d->relative_mouse_mode) {
+ SDL_SendMouseMotion(window->sdlwindow, 0, 1, (int)dx, (int)dy);
+ }
+}
+
+static const struct zwp_relative_pointer_v1_listener relative_pointer_listener = {
+ relative_pointer_handle_relative_motion,
+};
+
+static void
+locked_pointer_locked(void *data,
+ struct zwp_locked_pointer_v1 *locked_pointer)
+{
+}
+
+static void
+locked_pointer_unlocked(void *data,
+ struct zwp_locked_pointer_v1 *locked_pointer)
+{
+}
+
+static const struct zwp_locked_pointer_v1_listener locked_pointer_listener = {
+ locked_pointer_locked,
+ locked_pointer_unlocked,
+};
+
+static void
+lock_pointer_to_window(SDL_Window *window,
+ struct SDL_WaylandInput *input)
+{
+ SDL_WindowData *w = window->driverdata;
+ SDL_VideoData *d = input->display;
+ struct zwp_locked_pointer_v1 *locked_pointer;
+
+ if (w->locked_pointer)
+ return;
+
+ locked_pointer =
+ zwp_pointer_constraints_v1_lock_pointer(d->pointer_constraints,
+ w->surface,
+ input->pointer,
+ NULL,
+ ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
+ zwp_locked_pointer_v1_add_listener(locked_pointer,
+ &locked_pointer_listener,
+ window);
+
+ w->locked_pointer = locked_pointer;
+}
+
+int Wayland_input_lock_pointer(struct SDL_WaylandInput *input)
+{
+ SDL_VideoDevice *vd = SDL_GetVideoDevice();
+ SDL_VideoData *d = input->display;
+ SDL_Window *window;
+ struct zwp_relative_pointer_v1 *relative_pointer;
+
+ if (!d->relative_pointer_manager)
+ return -1;
+
+ if (!d->pointer_constraints)
+ return -1;
+
+ if (!input->relative_pointer) {
+ relative_pointer =
+ zwp_relative_pointer_manager_v1_get_relative_pointer(
+ d->relative_pointer_manager,
+ input->pointer);
+ zwp_relative_pointer_v1_add_listener(relative_pointer,
+ &relative_pointer_listener,
+ input);
+ input->relative_pointer = relative_pointer;
+ }
+
+ for (window = vd->windows; window; window = window->next)
+ lock_pointer_to_window(window, input);
+
+ d->relative_mouse_mode = 1;
+
+ return 0;
+}
+
+int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input)
+{
+ SDL_VideoDevice *vd = SDL_GetVideoDevice();
+ SDL_VideoData *d = input->display;
+ SDL_Window *window;
+ SDL_WindowData *w;
+
+ for (window = vd->windows; window; window = window->next) {
+ w = window->driverdata;
+ if (w->locked_pointer)
+ zwp_locked_pointer_v1_destroy(w->locked_pointer);
+ w->locked_pointer = NULL;
+ }
+
+ zwp_relative_pointer_v1_destroy(input->relative_pointer);
+ input->relative_pointer = NULL;
+
+ d->relative_mouse_mode = 0;
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents_c.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents_c.h
new file mode 100644
index 0000000..1c5ffe5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandevents_c.h
@@ -0,0 +1,51 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylandevents_h_
+#define SDL_waylandevents_h_
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandwindow.h"
+#include "SDL_waylanddatamanager.h"
+
+struct SDL_WaylandInput;
+
+extern void Wayland_PumpEvents(_THIS);
+
+extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id);
+extern void Wayland_display_destroy_input(SDL_VideoData *d);
+
+extern SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input);
+
+extern void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id);
+extern void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d);
+
+extern int Wayland_input_lock_pointer(struct SDL_WaylandInput *input);
+extern int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input);
+
+extern void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id);
+extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d);
+
+#endif /* SDL_waylandevents_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.c
new file mode 100644
index 0000000..c77b53e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.c
@@ -0,0 +1,396 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "../SDL_sysvideo.h"
+
+#include "SDL_mouse.h"
+#include "../../events/SDL_mouse_c.h"
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandevents_c.h"
+
+#include "SDL_waylanddyn.h"
+#include "wayland-cursor.h"
+
+#include "SDL_assert.h"
+
+
+typedef struct {
+ struct wl_buffer *buffer;
+ struct wl_surface *surface;
+
+ int hot_x, hot_y;
+ int w, h;
+
+ /* Either a preloaded cursor, or one we created ourselves */
+ struct wl_cursor *cursor;
+ void *shm_data;
+} Wayland_CursorData;
+
+static int
+wayland_create_tmp_file(off_t size)
+{
+ static const char template[] = "/sdl-shared-XXXXXX";
+ char *xdg_path;
+ char tmp_path[PATH_MAX];
+ int fd;
+
+ xdg_path = SDL_getenv("XDG_RUNTIME_DIR");
+ if (!xdg_path) {
+ return -1;
+ }
+
+ SDL_strlcpy(tmp_path, xdg_path, PATH_MAX);
+ SDL_strlcat(tmp_path, template, PATH_MAX);
+
+ fd = mkostemp(tmp_path, O_CLOEXEC);
+ if (fd < 0)
+ return -1;
+
+ if (ftruncate(fd, size) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ return fd;
+}
+
+static void
+mouse_buffer_release(void *data, struct wl_buffer *buffer)
+{
+}
+
+static const struct wl_buffer_listener mouse_buffer_listener = {
+ mouse_buffer_release
+};
+
+static int
+create_buffer_from_shm(Wayland_CursorData *d,
+ int width,
+ int height,
+ uint32_t format)
+{
+ SDL_VideoDevice *vd = SDL_GetVideoDevice();
+ SDL_VideoData *data = (SDL_VideoData *) vd->driverdata;
+ struct wl_shm_pool *shm_pool;
+
+ int stride = width * 4;
+ int size = stride * height;
+
+ int shm_fd;
+
+ shm_fd = wayland_create_tmp_file(size);
+ if (shm_fd < 0)
+ {
+ return SDL_SetError("Creating mouse cursor buffer failed.");
+ }
+
+ d->shm_data = mmap(NULL,
+ size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ shm_fd,
+ 0);
+ if (d->shm_data == MAP_FAILED) {
+ d->shm_data = NULL;
+ close (shm_fd);
+ return SDL_SetError("mmap() failed.");
+ }
+
+ shm_pool = wl_shm_create_pool(data->shm, shm_fd, size);
+ d->buffer = wl_shm_pool_create_buffer(shm_pool,
+ 0,
+ width,
+ height,
+ stride,
+ format);
+ wl_buffer_add_listener(d->buffer,
+ &mouse_buffer_listener,
+ d);
+
+ wl_shm_pool_destroy (shm_pool);
+ close (shm_fd);
+
+ return 0;
+}
+
+static SDL_Cursor *
+Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
+{
+ SDL_Cursor *cursor;
+
+ cursor = calloc(1, sizeof (*cursor));
+ if (cursor) {
+ SDL_VideoDevice *vd = SDL_GetVideoDevice ();
+ SDL_VideoData *wd = (SDL_VideoData *) vd->driverdata;
+ Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData));
+ if (!data) {
+ SDL_OutOfMemory();
+ free(cursor);
+ return NULL;
+ }
+ cursor->driverdata = (void *) data;
+
+ /* Assume ARGB8888 */
+ SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+ SDL_assert(surface->pitch == surface->w * 4);
+
+ /* Allocate shared memory buffer for this cursor */
+ if (create_buffer_from_shm (data,
+ surface->w,
+ surface->h,
+ WL_SHM_FORMAT_ARGB8888) < 0)
+ {
+ free (cursor->driverdata);
+ free (cursor);
+ return NULL;
+ }
+
+ SDL_memcpy(data->shm_data,
+ surface->pixels,
+ surface->h * surface->pitch);
+
+ data->surface = wl_compositor_create_surface(wd->compositor);
+ wl_surface_set_user_data(data->surface, NULL);
+
+ data->hot_x = hot_x;
+ data->hot_y = hot_y;
+ data->w = surface->w;
+ data->h = surface->h;
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor)
+{
+ SDL_Cursor *cursor;
+
+ cursor = calloc(1, sizeof (*cursor));
+ if (cursor) {
+ Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData));
+ if (!data) {
+ SDL_OutOfMemory();
+ free(cursor);
+ return NULL;
+ }
+ cursor->driverdata = (void *) data;
+
+ data->buffer = WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]);
+ data->surface = wl_compositor_create_surface(d->compositor);
+ wl_surface_set_user_data(data->surface, NULL);
+ data->hot_x = wlcursor->images[0]->hotspot_x;
+ data->hot_y = wlcursor->images[0]->hotspot_y;
+ data->w = wlcursor->images[0]->width;
+ data->h = wlcursor->images[0]->height;
+ data->cursor= wlcursor;
+ } else {
+ SDL_OutOfMemory ();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+Wayland_CreateDefaultCursor()
+{
+ SDL_VideoDevice *device = SDL_GetVideoDevice();
+ SDL_VideoData *data = device->driverdata;
+
+ return CreateCursorFromWlCursor (data,
+ WAYLAND_wl_cursor_theme_get_cursor(data->cursor_theme,
+ "left_ptr"));
+}
+
+static SDL_Cursor *
+Wayland_CreateSystemCursor(SDL_SystemCursor id)
+{
+ SDL_VideoDevice *vd = SDL_GetVideoDevice();
+ SDL_VideoData *d = vd->driverdata;
+
+ struct wl_cursor *cursor = NULL;
+
+ switch(id)
+ {
+ default:
+ SDL_assert(0);
+ return NULL;
+ case SDL_SYSTEM_CURSOR_ARROW:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
+ break;
+ case SDL_SYSTEM_CURSOR_IBEAM:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
+ break;
+ case SDL_SYSTEM_CURSOR_WAIT:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "watch");
+ break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_WAITARROW:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "watch");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENESW:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEWE:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENS:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEALL:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_NO:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
+ break;
+ case SDL_SYSTEM_CURSOR_HAND:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ break;
+ }
+
+ return CreateCursorFromWlCursor(d, cursor);
+}
+
+static void
+Wayland_FreeCursor(SDL_Cursor *cursor)
+{
+ Wayland_CursorData *d;
+
+ if (!cursor)
+ return;
+
+ d = cursor->driverdata;
+
+ /* Probably not a cursor we own */
+ if (!d)
+ return;
+
+ if (d->buffer && !d->cursor)
+ wl_buffer_destroy(d->buffer);
+
+ if (d->surface)
+ wl_surface_destroy(d->surface);
+
+ /* Not sure what's meant to happen to shm_data */
+ free (cursor->driverdata);
+ SDL_free(cursor);
+}
+
+static int
+Wayland_ShowCursor(SDL_Cursor *cursor)
+{
+ SDL_VideoDevice *vd = SDL_GetVideoDevice();
+ SDL_VideoData *d = vd->driverdata;
+
+ struct wl_pointer *pointer = d->pointer;
+
+ if (!pointer)
+ return -1;
+
+ if (cursor)
+ {
+ Wayland_CursorData *data = cursor->driverdata;
+
+ wl_pointer_set_cursor (pointer, 0,
+ data->surface,
+ data->hot_x,
+ data->hot_y);
+ wl_surface_attach(data->surface, data->buffer, 0, 0);
+ wl_surface_damage(data->surface, 0, 0, data->w, data->h);
+ wl_surface_commit(data->surface);
+ }
+ else
+ {
+ wl_pointer_set_cursor (pointer, 0,
+ NULL,
+ 0,
+ 0);
+ }
+
+ return 0;
+}
+
+static void
+Wayland_WarpMouse(SDL_Window *window, int x, int y)
+{
+ SDL_Unsupported();
+}
+
+static int
+Wayland_WarpMouseGlobal(int x, int y)
+{
+ return SDL_Unsupported();
+}
+
+static int
+Wayland_SetRelativeMouseMode(SDL_bool enabled)
+{
+ SDL_VideoDevice *vd = SDL_GetVideoDevice();
+ SDL_VideoData *data = (SDL_VideoData *) vd->driverdata;
+
+ if (enabled)
+ return Wayland_input_lock_pointer(data->input);
+ else
+ return Wayland_input_unlock_pointer(data->input);
+}
+
+void
+Wayland_InitMouse(void)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = Wayland_CreateCursor;
+ mouse->CreateSystemCursor = Wayland_CreateSystemCursor;
+ mouse->ShowCursor = Wayland_ShowCursor;
+ mouse->FreeCursor = Wayland_FreeCursor;
+ mouse->WarpMouse = Wayland_WarpMouse;
+ mouse->WarpMouseGlobal = Wayland_WarpMouseGlobal;
+ mouse->SetRelativeMouseMode = Wayland_SetRelativeMouseMode;
+
+ SDL_SetDefaultCursor(Wayland_CreateDefaultCursor());
+}
+
+void
+Wayland_FiniMouse(void)
+{
+ /* This effectively assumes that nobody else
+ * touches SDL_Mouse which is effectively
+ * a singleton */
+}
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.h
new file mode 100644
index 0000000..2c50e5f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandmouse.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#include "SDL_mouse.h"
+#include "SDL_waylandvideo.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+extern void Wayland_InitMouse(void);
+extern void Wayland_FiniMouse(void);
+
+#endif
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.c
new file mode 100644
index 0000000..9c0b845
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.c
@@ -0,0 +1,93 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandopengles.h"
+#include "SDL_waylandwindow.h"
+#include "SDL_waylandevents_c.h"
+#include "SDL_waylanddyn.h"
+
+/* EGL implementation of SDL OpenGL ES support */
+
+int
+Wayland_GLES_LoadLibrary(_THIS, const char *path) {
+ int ret;
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0);
+
+ Wayland_PumpEvents(_this);
+ WAYLAND_wl_display_flush(data->display);
+
+ return ret;
+}
+
+
+SDL_GLContext
+Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_GLContext context;
+ context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+
+ return context;
+}
+
+int
+Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
+{
+ if (SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface) < 0) {
+ return -1;
+ }
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+ return 0;
+}
+
+int
+Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ int ret;
+
+ if (window && context) {
+ ret = SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context);
+ }
+ else {
+ ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
+ }
+
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+
+ return ret;
+}
+
+void
+Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
+{
+ SDL_EGL_DeleteContext(_this, context);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.h
new file mode 100644
index 0000000..58d7f9b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandopengles.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylandopengles_h_
+#define SDL_waylandopengles_h_
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+typedef struct SDL_PrivateGLESData
+{
+ int dummy;
+} SDL_PrivateGLESData;
+
+/* OpenGLES functions */
+#define Wayland_GLES_GetAttribute SDL_EGL_GetAttribute
+#define Wayland_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define Wayland_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define Wayland_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define Wayland_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+
+extern int Wayland_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
+
+#endif /* SDL_waylandopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandsym.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandsym.h
new file mode 100644
index 0000000..77783df
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandsym.h
@@ -0,0 +1,127 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* *INDENT-OFF* */
+
+#ifndef SDL_WAYLAND_MODULE
+#define SDL_WAYLAND_MODULE(modname)
+#endif
+
+#ifndef SDL_WAYLAND_SYM
+#define SDL_WAYLAND_SYM(rc,fn,params)
+#endif
+
+#ifndef SDL_WAYLAND_INTERFACE
+#define SDL_WAYLAND_INTERFACE(iface)
+#endif
+
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
+SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
+SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *))
+SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *))
+SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *))
+SDL_WAYLAND_SYM(void *, wl_proxy_get_user_data, (struct wl_proxy *))
+SDL_WAYLAND_SYM(uint32_t, wl_proxy_get_id, (struct wl_proxy *))
+SDL_WAYLAND_SYM(const char *, wl_proxy_get_class, (struct wl_proxy *))
+SDL_WAYLAND_SYM(void, wl_proxy_set_queue, (struct wl_proxy *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect, (const char *))
+SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect_to_fd, (int))
+SDL_WAYLAND_SYM(void, wl_display_disconnect, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_get_fd, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_queue, (struct wl_display *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_queue_pending, (struct wl_display *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_pending, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_get_error, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_flush, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_roundtrip, (struct wl_display *))
+SDL_WAYLAND_SYM(struct wl_event_queue *, wl_display_create_queue, (struct wl_display *))
+SDL_WAYLAND_SYM(void, wl_log_set_handler_client, (wl_log_func_t))
+SDL_WAYLAND_SYM(void, wl_list_init, (struct wl_list *))
+SDL_WAYLAND_SYM(void, wl_list_insert, (struct wl_list *, struct wl_list *) )
+SDL_WAYLAND_SYM(void, wl_list_remove, (struct wl_list *))
+SDL_WAYLAND_SYM(int, wl_list_length, (const struct wl_list *))
+SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *))
+SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *))
+
+/* These functions are available in Wayland >= 1.4 */
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4)
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...))
+
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10)
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...))
+
+SDL_WAYLAND_INTERFACE(wl_seat_interface)
+SDL_WAYLAND_INTERFACE(wl_surface_interface)
+SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)
+SDL_WAYLAND_INTERFACE(wl_buffer_interface)
+SDL_WAYLAND_INTERFACE(wl_registry_interface)
+SDL_WAYLAND_INTERFACE(wl_shell_surface_interface)
+SDL_WAYLAND_INTERFACE(wl_region_interface)
+SDL_WAYLAND_INTERFACE(wl_pointer_interface)
+SDL_WAYLAND_INTERFACE(wl_keyboard_interface)
+SDL_WAYLAND_INTERFACE(wl_compositor_interface)
+SDL_WAYLAND_INTERFACE(wl_output_interface)
+SDL_WAYLAND_INTERFACE(wl_shell_interface)
+SDL_WAYLAND_INTERFACE(wl_shm_interface)
+SDL_WAYLAND_INTERFACE(wl_data_device_interface)
+SDL_WAYLAND_INTERFACE(wl_data_source_interface)
+SDL_WAYLAND_INTERFACE(wl_data_offer_interface)
+SDL_WAYLAND_INTERFACE(wl_data_device_manager_interface)
+
+SDL_WAYLAND_MODULE(WAYLAND_EGL)
+SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int))
+SDL_WAYLAND_SYM(void, wl_egl_window_destroy, (struct wl_egl_window *))
+SDL_WAYLAND_SYM(void, wl_egl_window_resize, (struct wl_egl_window *, int, int, int, int))
+SDL_WAYLAND_SYM(void, wl_egl_window_get_attached_size, (struct wl_egl_window *, int *, int *))
+
+SDL_WAYLAND_MODULE(WAYLAND_CURSOR)
+SDL_WAYLAND_SYM(struct wl_cursor_theme *, wl_cursor_theme_load, (const char *, int , struct wl_shm *))
+SDL_WAYLAND_SYM(void, wl_cursor_theme_destroy, (struct wl_cursor_theme *))
+SDL_WAYLAND_SYM(struct wl_cursor *, wl_cursor_theme_get_cursor, (struct wl_cursor_theme *, const char *))
+SDL_WAYLAND_SYM(struct wl_buffer *, wl_cursor_image_get_buffer, (struct wl_cursor_image *))
+SDL_WAYLAND_SYM(int, wl_cursor_frame, (struct wl_cursor *, uint32_t))
+
+SDL_WAYLAND_MODULE(WAYLAND_XKB)
+SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, const xkb_keysym_t **))
+SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) )
+SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags))
+SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) )
+SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) )
+SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) )
+SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) )
+SDL_WAYLAND_SYM(struct xkb_context *, xkb_context_new, (enum xkb_context_flags flags) )
+SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_state *state,\
+ xkb_mod_mask_t depressed_mods,\
+ xkb_mod_mask_t latched_mods,\
+ xkb_mod_mask_t locked_mods,\
+ xkb_layout_index_t depressed_layout,\
+ xkb_layout_index_t latched_layout,\
+ xkb_layout_index_t locked_layout) )
+
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.c
new file mode 100644
index 0000000..005b47f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.c
@@ -0,0 +1,265 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* Contributed by Thomas Perl <thomas.perl@jollamobile.com> */
+
+#include "../../SDL_internal.h"
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+
+#include "SDL_log.h"
+#include "SDL_waylandtouch.h"
+#include "../../events/SDL_touch_c.h"
+
+struct SDL_WaylandTouch {
+ struct qt_touch_extension *touch_extension;
+};
+
+
+/**
+ * Qt TouchPointState
+ * adapted from qtbase/src/corelib/global/qnamespace.h
+ **/
+enum QtWaylandTouchPointState {
+ QtWaylandTouchPointPressed = 0x01,
+ QtWaylandTouchPointMoved = 0x02,
+ /*
+ Never sent by the server:
+ QtWaylandTouchPointStationary = 0x04,
+ */
+ QtWaylandTouchPointReleased = 0x08,
+};
+
+static void
+touch_handle_touch(void *data,
+ struct qt_touch_extension *qt_touch_extension,
+ uint32_t time,
+ uint32_t id,
+ uint32_t state,
+ int32_t x,
+ int32_t y,
+ int32_t normalized_x,
+ int32_t normalized_y,
+ int32_t width,
+ int32_t height,
+ uint32_t pressure,
+ int32_t velocity_x,
+ int32_t velocity_y,
+ uint32_t flags,
+ struct wl_array *rawdata)
+{
+ /**
+ * Event is assembled in QtWayland in TouchExtensionGlobal::postTouchEvent
+ * (src/compositor/wayland_wrapper/qwltouch.cpp)
+ **/
+
+ float FIXED_TO_FLOAT = 1. / 10000.;
+ float xf = FIXED_TO_FLOAT * x;
+ float yf = FIXED_TO_FLOAT * y;
+
+ float PRESSURE_TO_FLOAT = 1. / 255.;
+ float pressuref = PRESSURE_TO_FLOAT * pressure;
+
+ uint32_t touchState = state & 0xFFFF;
+ /*
+ Other fields that are sent by the server (qwltouch.cpp),
+ but not used at the moment can be decoded in this way:
+
+ uint32_t sentPointCount = state >> 16;
+ uint32_t touchFlags = flags & 0xFFFF;
+ uint32_t capabilities = flags >> 16;
+ */
+
+ SDL_TouchID deviceId = 1;
+ if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) {
+ SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
+ }
+
+ switch (touchState) {
+ case QtWaylandTouchPointPressed:
+ case QtWaylandTouchPointReleased:
+ SDL_SendTouch(deviceId, (SDL_FingerID)id,
+ (touchState == QtWaylandTouchPointPressed) ? SDL_TRUE : SDL_FALSE,
+ xf, yf, pressuref);
+ break;
+ case QtWaylandTouchPointMoved:
+ SDL_SendTouchMotion(deviceId, (SDL_FingerID)id, xf, yf, pressuref);
+ break;
+ default:
+ /* Should not happen */
+ break;
+ }
+}
+
+static void
+touch_handle_configure(void *data,
+ struct qt_touch_extension *qt_touch_extension,
+ uint32_t flags)
+{
+}
+
+
+/* wayland-qt-touch-extension.c BEGINS */
+
+static const struct qt_touch_extension_listener touch_listener = {
+ touch_handle_touch,
+ touch_handle_configure,
+};
+
+static const struct wl_interface *qt_touch_extension_types[] = {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
+
+static const struct wl_message qt_touch_extension_requests[] = {
+ { "dummy", "", qt_touch_extension_types + 0 },
+};
+
+static const struct wl_message qt_touch_extension_events[] = {
+ { "touch", "uuuiiiiiiuiiua", qt_touch_extension_types + 0 },
+ { "configure", "u", qt_touch_extension_types + 0 },
+};
+
+WL_EXPORT const struct wl_interface qt_touch_extension_interface = {
+ "qt_touch_extension", 1,
+ 1, qt_touch_extension_requests,
+ 2, qt_touch_extension_events,
+};
+
+/* wayland-qt-touch-extension.c ENDS */
+
+/* wayland-qt-windowmanager.c BEGINS */
+static const struct wl_interface *qt_windowmanager_types[] = {
+ NULL,
+ NULL,
+};
+
+static const struct wl_message qt_windowmanager_requests[] = {
+ { "open_url", "us", qt_windowmanager_types + 0 },
+};
+
+static const struct wl_message qt_windowmanager_events[] = {
+ { "hints", "i", qt_windowmanager_types + 0 },
+ { "quit", "", qt_windowmanager_types + 0 },
+};
+
+WL_EXPORT const struct wl_interface qt_windowmanager_interface = {
+ "qt_windowmanager", 1,
+ 1, qt_windowmanager_requests,
+ 2, qt_windowmanager_events,
+};
+/* wayland-qt-windowmanager.c ENDS */
+
+/* wayland-qt-surface-extension.c BEGINS */
+extern const struct wl_interface qt_extended_surface_interface;
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+extern const struct wl_interface wl_surface_interface;
+#endif
+
+static const struct wl_interface *qt_surface_extension_types[] = {
+ NULL,
+ NULL,
+ &qt_extended_surface_interface,
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ /* FIXME: Set this dynamically to (*WAYLAND_wl_surface_interface) ?
+ * The value comes from auto generated code and does
+ * not appear to actually be used anywhere
+ */
+ NULL,
+#else
+ &wl_surface_interface,
+#endif
+};
+
+static const struct wl_message qt_surface_extension_requests[] = {
+ { "get_extended_surface", "no", qt_surface_extension_types + 2 },
+};
+
+WL_EXPORT const struct wl_interface qt_surface_extension_interface = {
+ "qt_surface_extension", 1,
+ 1, qt_surface_extension_requests,
+ 0, NULL,
+};
+
+static const struct wl_message qt_extended_surface_requests[] = {
+ { "update_generic_property", "sa", qt_surface_extension_types + 0 },
+ { "set_content_orientation", "i", qt_surface_extension_types + 0 },
+ { "set_window_flags", "i", qt_surface_extension_types + 0 },
+};
+
+static const struct wl_message qt_extended_surface_events[] = {
+ { "onscreen_visibility", "i", qt_surface_extension_types + 0 },
+ { "set_generic_property", "sa", qt_surface_extension_types + 0 },
+ { "close", "", qt_surface_extension_types + 0 },
+};
+
+WL_EXPORT const struct wl_interface qt_extended_surface_interface = {
+ "qt_extended_surface", 1,
+ 3, qt_extended_surface_requests,
+ 3, qt_extended_surface_events,
+};
+
+/* wayland-qt-surface-extension.c ENDS */
+
+void
+Wayland_touch_create(SDL_VideoData *data, uint32_t id)
+{
+ struct SDL_WaylandTouch *touch;
+
+ if (data->touch) {
+ Wayland_touch_destroy(data);
+ }
+
+ /* !!! FIXME: check for failure, call SDL_OutOfMemory() */
+ data->touch = SDL_malloc(sizeof(struct SDL_WaylandTouch));
+
+ touch = data->touch;
+ touch->touch_extension = wl_registry_bind(data->registry, id, &qt_touch_extension_interface, 1);
+ qt_touch_extension_add_listener(touch->touch_extension, &touch_listener, data);
+}
+
+void
+Wayland_touch_destroy(SDL_VideoData *data)
+{
+ if (data->touch) {
+ struct SDL_WaylandTouch *touch = data->touch;
+ if (touch->touch_extension) {
+ qt_touch_extension_destroy(touch->touch_extension);
+ }
+
+ SDL_free(data->touch);
+ data->touch = NULL;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.h
new file mode 100644
index 0000000..9efc5a5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandtouch.h
@@ -0,0 +1,352 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+
+#ifndef SDL_waylandtouch_h_
+#define SDL_waylandtouch_h_
+
+#include "SDL_waylandvideo.h"
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-util.h"
+#include "SDL_waylanddyn.h"
+
+
+void Wayland_touch_create(SDL_VideoData *data, uint32_t id);
+void Wayland_touch_destroy(SDL_VideoData *data);
+
+struct qt_touch_extension;
+
+/* Autogenerated QT headers */
+
+/*
+ Support for Wayland with QmlCompositor as Server
+================================================
+
+The Wayland video driver has support for some additional features when
+using QtWayland's "qmlcompositor" as Wayland server. This is needed for touch
+input when running SDL applications under a qmlcompositor Wayland server.
+
+The files following headers have been
+generated from the Wayland XML Protocol Definition in QtWayland as follows:
+
+Clone QtWayland from Git:
+ http://qt.gitorious.org/qt/qtwayland/
+
+Generate headers and glue code:
+ for extension in touch-extension surface-extension windowmanager; do
+ wayland-scanner client-header < src/extensions/$extension.xml > wayland-qt-$extension.h
+ wayland-scanner code < src/extensions/$extension.xml > wayland-qt-$extension.c
+ done
+
+*/
+
+/* wayland-qt-surface-extension.h */
+
+struct wl_client;
+struct wl_resource;
+
+struct qt_surface_extension;
+struct qt_extended_surface;
+
+extern const struct wl_interface qt_surface_extension_interface;
+extern const struct wl_interface qt_extended_surface_interface;
+
+#define QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE 0
+
+static inline void
+qt_surface_extension_set_user_data(struct qt_surface_extension *qt_surface_extension, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) qt_surface_extension, user_data);
+}
+
+static inline void *
+qt_surface_extension_get_user_data(struct qt_surface_extension *qt_surface_extension)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) qt_surface_extension);
+}
+
+static inline void
+qt_surface_extension_destroy(struct qt_surface_extension *qt_surface_extension)
+{
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
+}
+
+static inline struct qt_extended_surface *
+qt_surface_extension_get_extended_surface(struct qt_surface_extension *qt_surface_extension, struct wl_surface *surface)
+{
+ struct wl_proxy *id;
+
+ id = wl_proxy_create((struct wl_proxy *) qt_surface_extension,
+ &qt_extended_surface_interface);
+ if (!id)
+ return NULL;
+
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
+ QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE, id, surface);
+
+ return (struct qt_extended_surface *) id;
+}
+
+#ifndef QT_EXTENDED_SURFACE_ORIENTATION_ENUM
+#define QT_EXTENDED_SURFACE_ORIENTATION_ENUM
+enum qt_extended_surface_orientation {
+ QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION = 0,
+ QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION = 1,
+ QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION = 2,
+ QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION = 4,
+ QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION = 8,
+};
+#endif /* QT_EXTENDED_SURFACE_ORIENTATION_ENUM */
+
+#ifndef QT_EXTENDED_SURFACE_WINDOWFLAG_ENUM
+#define QT_EXTENDED_SURFACE_WINDOWFLAG_ENUM
+enum qt_extended_surface_windowflag {
+ QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES = 1,
+ QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP = 2,
+};
+#endif /* QT_EXTENDED_SURFACE_WINDOWFLAG_ENUM */
+
+struct qt_extended_surface_listener {
+ /**
+ * onscreen_visibility - (none)
+ * @visible: (none)
+ */
+ void (*onscreen_visibility)(void *data,
+ struct qt_extended_surface *qt_extended_surface,
+ int32_t visible);
+ /**
+ * set_generic_property - (none)
+ * @name: (none)
+ * @value: (none)
+ */
+ void (*set_generic_property)(void *data,
+ struct qt_extended_surface *qt_extended_surface,
+ const char *name,
+ struct wl_array *value);
+ /**
+ * close - (none)
+ */
+ void (*close)(void *data,
+ struct qt_extended_surface *qt_extended_surface);
+};
+
+static inline int
+qt_extended_surface_add_listener(struct qt_extended_surface *qt_extended_surface,
+ const struct qt_extended_surface_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) qt_extended_surface,
+ (void (**)(void)) listener, data);
+}
+
+#define QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY 0
+#define QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION 1
+#define QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS 2
+
+static inline void
+qt_extended_surface_set_user_data(struct qt_extended_surface *qt_extended_surface, void *user_data)
+{
+ WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
+}
+
+static inline void *
+qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
+{
+ return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
+}
+
+static inline void
+qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
+{
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
+}
+
+static inline void
+qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
+{
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+ QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY, name, value);
+}
+
+static inline void
+qt_extended_surface_set_content_orientation(struct qt_extended_surface *qt_extended_surface, int32_t orientation)
+{
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+ QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION, orientation);
+}
+
+static inline void
+qt_extended_surface_set_window_flags(struct qt_extended_surface *qt_extended_surface, int32_t flags)
+{
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+ QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS, flags);
+}
+
+/* wayland-qt-touch-extension.h */
+
+extern const struct wl_interface qt_touch_extension_interface;
+
+#ifndef QT_TOUCH_EXTENSION_FLAGS_ENUM
+#define QT_TOUCH_EXTENSION_FLAGS_ENUM
+enum qt_touch_extension_flags {
+ QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH = 0x1,
+};
+#endif /* QT_TOUCH_EXTENSION_FLAGS_ENUM */
+
+struct qt_touch_extension_listener {
+ /**
+ * touch - (none)
+ * @time: (none)
+ * @id: (none)
+ * @state: (none)
+ * @x: (none)
+ * @y: (none)
+ * @normalized_x: (none)
+ * @normalized_y: (none)
+ * @width: (none)
+ * @height: (none)
+ * @pressure: (none)
+ * @velocity_x: (none)
+ * @velocity_y: (none)
+ * @flags: (none)
+ * @rawdata: (none)
+ */
+ void (*touch)(void *data,
+ struct qt_touch_extension *qt_touch_extension,
+ uint32_t time,
+ uint32_t id,
+ uint32_t state,
+ int32_t x,
+ int32_t y,
+ int32_t normalized_x,
+ int32_t normalized_y,
+ int32_t width,
+ int32_t height,
+ uint32_t pressure,
+ int32_t velocity_x,
+ int32_t velocity_y,
+ uint32_t flags,
+ struct wl_array *rawdata);
+ /**
+ * configure - (none)
+ * @flags: (none)
+ */
+ void (*configure)(void *data,
+ struct qt_touch_extension *qt_touch_extension,
+ uint32_t flags);
+};
+
+static inline int
+qt_touch_extension_add_listener(struct qt_touch_extension *qt_touch_extension,
+ const struct qt_touch_extension_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) qt_touch_extension,
+ (void (**)(void)) listener, data);
+}
+
+#define QT_TOUCH_EXTENSION_DUMMY 0
+
+static inline void
+qt_touch_extension_set_user_data(struct qt_touch_extension *qt_touch_extension, void *user_data)
+{
+ WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
+}
+
+static inline void *
+qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
+{
+ return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
+}
+
+static inline void
+qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
+{
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
+}
+
+static inline void
+qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
+{
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
+ QT_TOUCH_EXTENSION_DUMMY);
+}
+
+
+/* wayland-qt-windowmanager.h */
+
+extern const struct wl_interface qt_windowmanager_interface;
+
+struct qt_windowmanager_listener {
+ /**
+ * hints - (none)
+ * @show_is_fullscreen: (none)
+ */
+ void (*hints)(void *data,
+ struct qt_windowmanager *qt_windowmanager,
+ int32_t show_is_fullscreen);
+ /**
+ * quit - (none)
+ */
+ void (*quit)(void *data,
+ struct qt_windowmanager *qt_windowmanager);
+};
+
+static inline int
+qt_windowmanager_add_listener(struct qt_windowmanager *qt_windowmanager,
+ const struct qt_windowmanager_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) qt_windowmanager,
+ (void (**)(void)) listener, data);
+}
+
+#define QT_WINDOWMANAGER_OPEN_URL 0
+
+static inline void
+qt_windowmanager_set_user_data(struct qt_windowmanager *qt_windowmanager, void *user_data)
+{
+ WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
+}
+
+static inline void *
+qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
+{
+ return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
+}
+
+static inline void
+qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
+{
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
+}
+
+static inline void
+qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
+{
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
+ QT_WINDOWMANAGER_OPEN_URL, remaining, url);
+}
+
+#endif /* SDL_waylandtouch_h_ */
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.c
new file mode 100644
index 0000000..8401a08
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.c
@@ -0,0 +1,499 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_stdinc.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandevents_c.h"
+#include "SDL_waylandwindow.h"
+#include "SDL_waylandopengles.h"
+#include "SDL_waylandmouse.h"
+#include "SDL_waylandtouch.h"
+#include "SDL_waylandclipboard.h"
+#include "SDL_waylandvulkan.h"
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <xkbcommon/xkbcommon.h>
+
+#include "SDL_waylanddyn.h"
+#include <wayland-util.h>
+
+#include "xdg-shell-unstable-v6-client-protocol.h"
+
+#define WAYLANDVID_DRIVER_NAME "wayland"
+
+/* Initialization/Query functions */
+static int
+Wayland_VideoInit(_THIS);
+
+static void
+Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display);
+static int
+Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+
+static void
+Wayland_VideoQuit(_THIS);
+
+/* Find out what class name we should use
+ * Based on src/video/x11/SDL_x11video.c */
+static char *
+get_classname()
+{
+/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
+ "The surface class identifies the general class of applications
+ to which the surface belongs. A common convention is to use the
+ file name (or the full path if it is a non-standard location) of
+ the application's .desktop file as the class." */
+
+ char *spot;
+#if defined(__LINUX__) || defined(__FREEBSD__)
+ char procfile[1024];
+ char linkfile[1024];
+ int linksize;
+#endif
+
+ /* First allow environment variable override */
+ spot = SDL_getenv("SDL_VIDEO_WAYLAND_WMCLASS");
+ if (spot) {
+ return SDL_strdup(spot);
+ } else {
+ /* Fallback to the "old" envvar */
+ spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
+ if (spot) {
+ return SDL_strdup(spot);
+ }
+ }
+
+ /* Next look at the application's executable name */
+#if defined(__LINUX__) || defined(__FREEBSD__)
+#if defined(__LINUX__)
+ SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
+#elif defined(__FREEBSD__)
+ SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
+ getpid());
+#else
+#error Where can we find the executable name?
+#endif
+ linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
+ if (linksize > 0) {
+ linkfile[linksize] = '\0';
+ spot = SDL_strrchr(linkfile, '/');
+ if (spot) {
+ return SDL_strdup(spot + 1);
+ } else {
+ return SDL_strdup(linkfile);
+ }
+ }
+#endif /* __LINUX__ || __FREEBSD__ */
+
+ /* Finally use the default we've used forever */
+ return SDL_strdup("SDL_App");
+}
+
+/* Wayland driver bootstrap functions */
+static int
+Wayland_Available(void)
+{
+ struct wl_display *display = NULL;
+ if (SDL_WAYLAND_LoadSymbols()) {
+ display = WAYLAND_wl_display_connect(NULL);
+ if (display != NULL) {
+ WAYLAND_wl_display_disconnect(display);
+ }
+ SDL_WAYLAND_UnloadSymbols();
+ }
+
+ return (display != NULL);
+}
+
+static void
+Wayland_DeleteDevice(SDL_VideoDevice *device)
+{
+ SDL_free(device);
+ SDL_WAYLAND_UnloadSymbols();
+}
+
+static SDL_VideoDevice *
+Wayland_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ if (!SDL_WAYLAND_LoadSymbols()) {
+ return NULL;
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+ device = SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_WAYLAND_UnloadSymbols();
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Set the function pointers */
+ device->VideoInit = Wayland_VideoInit;
+ device->VideoQuit = Wayland_VideoQuit;
+ device->SetDisplayMode = Wayland_SetDisplayMode;
+ device->GetDisplayModes = Wayland_GetDisplayModes;
+ device->GetWindowWMInfo = Wayland_GetWindowWMInfo;
+
+ device->PumpEvents = Wayland_PumpEvents;
+
+ device->GL_SwapWindow = Wayland_GLES_SwapWindow;
+ device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval;
+ device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval;
+ device->GL_MakeCurrent = Wayland_GLES_MakeCurrent;
+ device->GL_CreateContext = Wayland_GLES_CreateContext;
+ device->GL_LoadLibrary = Wayland_GLES_LoadLibrary;
+ device->GL_UnloadLibrary = Wayland_GLES_UnloadLibrary;
+ device->GL_GetProcAddress = Wayland_GLES_GetProcAddress;
+ device->GL_DeleteContext = Wayland_GLES_DeleteContext;
+
+ device->CreateSDLWindow = Wayland_CreateWindow;
+ device->ShowWindow = Wayland_ShowWindow;
+ device->SetWindowFullscreen = Wayland_SetWindowFullscreen;
+ device->MaximizeWindow = Wayland_MaximizeWindow;
+ device->RestoreWindow = Wayland_RestoreWindow;
+ device->SetWindowSize = Wayland_SetWindowSize;
+ device->SetWindowTitle = Wayland_SetWindowTitle;
+ device->DestroyWindow = Wayland_DestroyWindow;
+ device->SetWindowHitTest = Wayland_SetWindowHitTest;
+
+ device->SetClipboardText = Wayland_SetClipboardText;
+ device->GetClipboardText = Wayland_GetClipboardText;
+ device->HasClipboardText = Wayland_HasClipboardText;
+
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface;
+#endif
+
+ device->free = Wayland_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap Wayland_bootstrap = {
+ WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver",
+ Wayland_Available, Wayland_CreateDevice
+};
+
+static void
+display_handle_geometry(void *data,
+ struct wl_output *output,
+ int x, int y,
+ int physical_width,
+ int physical_height,
+ int subpixel,
+ const char *make,
+ const char *model,
+ int transform)
+
+{
+ SDL_VideoDisplay *display = data;
+
+ display->name = SDL_strdup(model);
+ display->driverdata = output;
+}
+
+static void
+display_handle_mode(void *data,
+ struct wl_output *output,
+ uint32_t flags,
+ int width,
+ int height,
+ int refresh)
+{
+ SDL_VideoDisplay *display = data;
+ SDL_DisplayMode mode;
+
+ SDL_zero(mode);
+ mode.format = SDL_PIXELFORMAT_RGB888;
+ mode.w = width;
+ mode.h = height;
+ mode.refresh_rate = refresh / 1000; // mHz to Hz
+ mode.driverdata = display->driverdata;
+ SDL_AddDisplayMode(display, &mode);
+
+ if (flags & WL_OUTPUT_MODE_CURRENT) {
+ display->current_mode = mode;
+ display->desktop_mode = mode;
+ }
+}
+
+static void
+display_handle_done(void *data,
+ struct wl_output *output)
+{
+ SDL_VideoDisplay *display = data;
+ SDL_AddVideoDisplay(display);
+ SDL_free(display->name);
+ SDL_free(display);
+}
+
+static void
+display_handle_scale(void *data,
+ struct wl_output *output,
+ int32_t factor)
+{
+ // TODO: do HiDPI stuff.
+}
+
+static const struct wl_output_listener output_listener = {
+ display_handle_geometry,
+ display_handle_mode,
+ display_handle_done,
+ display_handle_scale
+};
+
+static void
+Wayland_add_display(SDL_VideoData *d, uint32_t id)
+{
+ struct wl_output *output;
+ SDL_VideoDisplay *display = SDL_malloc(sizeof *display);
+ if (!display) {
+ SDL_OutOfMemory();
+ return;
+ }
+ SDL_zero(*display);
+
+ output = wl_registry_bind(d->registry, id, &wl_output_interface, 2);
+ if (!output) {
+ SDL_SetError("Failed to retrieve output.");
+ SDL_free(display);
+ return;
+ }
+
+ wl_output_add_listener(output, &output_listener, display);
+}
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+static void
+windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager,
+ int32_t show_is_fullscreen)
+{
+}
+
+static void
+windowmanager_quit(void *data, struct qt_windowmanager *qt_windowmanager)
+{
+ SDL_SendQuit();
+}
+
+static const struct qt_windowmanager_listener windowmanager_listener = {
+ windowmanager_hints,
+ windowmanager_quit,
+};
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+
+static void
+handle_ping_zxdg_shell(void *data, struct zxdg_shell_v6 *zxdg, uint32_t serial)
+{
+ zxdg_shell_v6_pong(zxdg, serial);
+}
+
+static const struct zxdg_shell_v6_listener shell_listener_zxdg = {
+ handle_ping_zxdg_shell
+};
+
+
+static void
+display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
+ const char *interface, uint32_t version)
+{
+ SDL_VideoData *d = data;
+
+ if (strcmp(interface, "wl_compositor") == 0) {
+ d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, 1);
+ } else if (strcmp(interface, "wl_output") == 0) {
+ Wayland_add_display(d, id);
+ } else if (strcmp(interface, "wl_seat") == 0) {
+ Wayland_display_add_input(d, id);
+ } else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ d->shell.zxdg = wl_registry_bind(d->registry, id, &zxdg_shell_v6_interface, 1);
+ zxdg_shell_v6_add_listener(d->shell.zxdg, &shell_listener_zxdg, NULL);
+ } else if (strcmp(interface, "wl_shell") == 0) {
+ d->shell.wl = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
+ } else if (strcmp(interface, "wl_shm") == 0) {
+ d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
+ d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
+ } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
+ Wayland_display_add_relative_pointer_manager(d, id);
+ } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
+ Wayland_display_add_pointer_constraints(d, id);
+ } else if (strcmp(interface, "wl_data_device_manager") == 0) {
+ d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, 3);
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ } else if (strcmp(interface, "qt_touch_extension") == 0) {
+ Wayland_touch_create(d, id);
+ } else if (strcmp(interface, "qt_surface_extension") == 0) {
+ d->surface_extension = wl_registry_bind(registry, id,
+ &qt_surface_extension_interface, 1);
+ } else if (strcmp(interface, "qt_windowmanager") == 0) {
+ d->windowmanager = wl_registry_bind(registry, id,
+ &qt_windowmanager_interface, 1);
+ qt_windowmanager_add_listener(d->windowmanager, &windowmanager_listener, d);
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+ }
+}
+
+static const struct wl_registry_listener registry_listener = {
+ display_handle_global,
+ NULL, /* global_remove */
+};
+
+int
+Wayland_VideoInit(_THIS)
+{
+ SDL_VideoData *data = SDL_malloc(sizeof *data);
+ if (data == NULL)
+ return SDL_OutOfMemory();
+ memset(data, 0, sizeof *data);
+
+ _this->driverdata = data;
+
+ data->xkb_context = WAYLAND_xkb_context_new(0);
+ if (!data->xkb_context) {
+ return SDL_SetError("Failed to create XKB context");
+ }
+
+ data->display = WAYLAND_wl_display_connect(NULL);
+ if (data->display == NULL) {
+ return SDL_SetError("Failed to connect to a Wayland display");
+ }
+
+ data->registry = wl_display_get_registry(data->display);
+ if (data->registry == NULL) {
+ return SDL_SetError("Failed to get the Wayland registry");
+ }
+
+ wl_registry_add_listener(data->registry, &registry_listener, data);
+
+ // First roundtrip to receive all registry objects.
+ WAYLAND_wl_display_roundtrip(data->display);
+
+ // Second roundtrip to receive all output events.
+ WAYLAND_wl_display_roundtrip(data->display);
+
+ Wayland_InitMouse();
+
+ /* Get the surface class name, usually the name of the application */
+ data->classname = get_classname();
+
+ WAYLAND_wl_display_flush(data->display);
+
+ return 0;
+}
+
+static void
+Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
+{
+ // Nothing to do here, everything was already done in the wl_output
+ // callbacks.
+}
+
+static int
+Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+{
+ return SDL_Unsupported();
+}
+
+void
+Wayland_VideoQuit(_THIS)
+{
+ SDL_VideoData *data = _this->driverdata;
+ int i, j;
+
+ Wayland_FiniMouse ();
+
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ wl_output_destroy(display->driverdata);
+ display->driverdata = NULL;
+
+ for (j = display->num_display_modes; j--;) {
+ display->display_modes[j].driverdata = NULL;
+ }
+ display->desktop_mode.driverdata = NULL;
+ }
+
+ Wayland_display_destroy_input(data);
+ Wayland_display_destroy_pointer_constraints(data);
+ Wayland_display_destroy_relative_pointer_manager(data);
+
+ if (data->xkb_context) {
+ WAYLAND_xkb_context_unref(data->xkb_context);
+ data->xkb_context = NULL;
+ }
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ if (data->windowmanager)
+ qt_windowmanager_destroy(data->windowmanager);
+
+ if (data->surface_extension)
+ qt_surface_extension_destroy(data->surface_extension);
+
+ Wayland_touch_destroy(data);
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+ if (data->shm)
+ wl_shm_destroy(data->shm);
+
+ if (data->cursor_theme)
+ WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
+
+ if (data->shell.wl)
+ wl_shell_destroy(data->shell.wl);
+
+ if (data->shell.zxdg)
+ zxdg_shell_v6_destroy(data->shell.zxdg);
+
+ if (data->compositor)
+ wl_compositor_destroy(data->compositor);
+
+ if (data->registry)
+ wl_registry_destroy(data->registry);
+
+ if (data->display) {
+ WAYLAND_wl_display_flush(data->display);
+ WAYLAND_wl_display_disconnect(data->display);
+ }
+
+ SDL_free(data->classname);
+ SDL_free(data);
+ _this->driverdata = NULL;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.h
new file mode 100644
index 0000000..6ad68de
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvideo.h
@@ -0,0 +1,75 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylandvideo_h_
+#define SDL_waylandvideo_h_
+
+#include <EGL/egl.h>
+#include "wayland-util.h"
+
+struct xkb_context;
+struct SDL_WaylandInput;
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+struct SDL_WaylandTouch;
+struct qt_surface_extension;
+struct qt_windowmanager;
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+typedef struct {
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_compositor *compositor;
+ struct wl_shm *shm;
+ struct wl_cursor_theme *cursor_theme;
+ struct wl_pointer *pointer;
+ struct {
+ /* !!! FIXME: add stable xdg_shell from 1.12 */
+ struct zxdg_shell_v6 *zxdg;
+ struct wl_shell *wl;
+ } shell;
+ struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
+ struct zwp_pointer_constraints_v1 *pointer_constraints;
+ struct wl_data_device_manager *data_device_manager;
+
+ EGLDisplay edpy;
+ EGLContext context;
+ EGLConfig econf;
+
+ struct xkb_context *xkb_context;
+ struct SDL_WaylandInput *input;
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ struct SDL_WaylandTouch *touch;
+ struct qt_surface_extension *surface_extension;
+ struct qt_windowmanager *windowmanager;
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+ char *classname;
+
+ int relative_mouse_mode;
+} SDL_VideoData;
+
+#endif /* SDL_waylandvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.c
new file mode 100644
index 0000000..d67472c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.c
@@ -0,0 +1,176 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.c.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND
+
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandwindow.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_waylandvulkan.h"
+#include "SDL_syswm.h"
+
+int Wayland_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ VkExtensionProperties *extensions = NULL;
+ Uint32 i, extensionCount = 0;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasWaylandSurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+ if(_this->vulkan_config.loader_handle)
+ return SDL_SetError("Vulkan already loaded");
+
+ /* Load the Vulkan loader library */
+ if(!path)
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ if(!path)
+ path = "libvulkan.so.1";
+ _this->vulkan_config.loader_handle = SDL_LoadObject(path);
+ if(!_this->vulkan_config.loader_handle)
+ return -1;
+ SDL_strlcpy(_this->vulkan_config.loader_path, path,
+ SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ if(!vkGetInstanceProcAddr)
+ goto fail;
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ goto fail;
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+ if(!extensions)
+ goto fail;
+ for(i = 0; i < extensionCount; i++)
+ {
+ if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasSurfaceExtension = SDL_TRUE;
+ else if(SDL_strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasWaylandSurfaceExtension = SDL_TRUE;
+ }
+ SDL_free(extensions);
+ if(!hasSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ }
+ else if(!hasWaylandSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "extension");
+ goto fail;
+ }
+ return 0;
+
+fail:
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void Wayland_Vulkan_UnloadLibrary(_THIS)
+{
+ if(_this->vulkan_config.loader_handle)
+ {
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ static const char *const extensionsForWayland[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
+ };
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForWayland),
+ extensionsForWayland);
+}
+
+SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
+ (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
+ (VkInstance)instance,
+ "vkCreateWaylandSurfaceKHR");
+ VkWaylandSurfaceCreateInfoKHR createInfo;
+ VkResult result;
+
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ if(!vkCreateWaylandSurfaceKHR)
+ {
+ SDL_SetError(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ SDL_zero(createInfo);
+ createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.display = windowData->waylandData->display;
+ createInfo.surface = windowData->surface;
+ result = vkCreateWaylandSurfaceKHR(instance, &createInfo,
+ NULL, surface);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError("vkCreateWaylandSurfaceKHR failed: %s",
+ SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+#endif
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.h
new file mode 100644
index 0000000..5ad3a46
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandvulkan.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.h.
+ */
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylandvulkan_h_
+#define SDL_waylandvulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND
+
+int Wayland_Vulkan_LoadLibrary(_THIS, const char *path);
+void Wayland_Vulkan_UnloadLibrary(_THIS);
+SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+#endif
+
+#endif /* SDL_waylandvulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.c b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.c
new file mode 100644
index 0000000..684022a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.c
@@ -0,0 +1,552 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_windowevents_c.h"
+#include "../SDL_egl_c.h"
+#include "SDL_waylandevents_c.h"
+#include "SDL_waylandwindow.h"
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandtouch.h"
+#include "SDL_waylanddyn.h"
+#include "SDL_hints.h"
+
+#include "xdg-shell-unstable-v6-client-protocol.h"
+
+/* On modern desktops, we probably will use the xdg-shell protocol instead
+ of wl_shell, but wl_shell might be useful on older Wayland installs that
+ don't have the newer protocol, or embedded things that don't have a full
+ window manager. */
+
+static void
+handle_ping_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface,
+ uint32_t serial)
+{
+ wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+handle_configure_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface,
+ uint32_t edges, int32_t width, int32_t height)
+{
+ SDL_WindowData *wind = (SDL_WindowData *)data;
+ SDL_Window *window = wind->sdlwindow;
+ struct wl_region *region;
+
+ /* wl_shell_surface spec states that this is a suggestion.
+ Ignore if less than or greater than max/min size. */
+
+ if (width == 0 || height == 0) {
+ return;
+ }
+
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ if ((window->flags & SDL_WINDOW_RESIZABLE)) {
+ if (window->max_w > 0) {
+ width = SDL_min(width, window->max_w);
+ }
+ width = SDL_max(width, window->min_w);
+
+ if (window->max_h > 0) {
+ height = SDL_min(height, window->max_h);
+ }
+ height = SDL_max(height, window->min_h);
+ } else {
+ return;
+ }
+ }
+
+ if (width == window->w && height == window->h) {
+ return;
+ }
+
+ window->w = width;
+ window->h = height;
+ WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+
+ region = wl_compositor_create_region(wind->waylandData->compositor);
+ wl_region_add(region, 0, 0, window->w, window->h);
+ wl_surface_set_opaque_region(wind->surface, region);
+ wl_region_destroy(region);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, window->w, window->h);
+}
+
+static void
+handle_popup_done_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener_wl = {
+ handle_ping_wl_shell_surface,
+ handle_configure_wl_shell_surface,
+ handle_popup_done_wl_shell_surface
+};
+
+
+
+
+static void
+handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, uint32_t serial)
+{
+ SDL_WindowData *wind = (SDL_WindowData *)data;
+ SDL_Window *window = wind->sdlwindow;
+ struct wl_region *region;
+ WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+
+ region = wl_compositor_create_region(wind->waylandData->compositor);
+ wl_region_add(region, 0, 0, window->w, window->h);
+ wl_surface_set_opaque_region(wind->surface, region);
+ wl_region_destroy(region);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, window->w, window->h);
+ zxdg_surface_v6_ack_configure(zxdg, serial);
+}
+
+static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = {
+ handle_configure_zxdg_shell_surface
+};
+
+
+static void
+handle_configure_zxdg_toplevel(void *data,
+ struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
+ int32_t width,
+ int32_t height,
+ struct wl_array *states)
+{
+ SDL_WindowData *wind = (SDL_WindowData *)data;
+ SDL_Window *window = wind->sdlwindow;
+
+ /* wl_shell_surface spec states that this is a suggestion.
+ Ignore if less than or greater than max/min size. */
+
+ if (width == 0 || height == 0) {
+ return;
+ }
+
+ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+ if ((window->flags & SDL_WINDOW_RESIZABLE)) {
+ if (window->max_w > 0) {
+ width = SDL_min(width, window->max_w);
+ }
+ width = SDL_max(width, window->min_w);
+
+ if (window->max_h > 0) {
+ height = SDL_min(height, window->max_h);
+ }
+ height = SDL_max(height, window->min_h);
+ } else {
+ return;
+ }
+ }
+
+ if (width == window->w && height == window->h) {
+ return;
+ }
+
+ window->w = width;
+ window->h = height;
+}
+
+static void
+handle_close_zxdg_toplevel(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
+{
+ SDL_WindowData *window = (SDL_WindowData *)data;
+ SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
+}
+
+static const struct zxdg_toplevel_v6_listener toplevel_listener_zxdg = {
+ handle_configure_zxdg_toplevel,
+ handle_close_zxdg_toplevel
+};
+
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+static void
+handle_onscreen_visibility(void *data,
+ struct qt_extended_surface *qt_extended_surface, int32_t visible)
+{
+}
+
+static void
+handle_set_generic_property(void *data,
+ struct qt_extended_surface *qt_extended_surface, const char *name,
+ struct wl_array *value)
+{
+}
+
+static void
+handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
+{
+ SDL_WindowData *window = (SDL_WindowData *)data;
+ SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0);
+}
+
+static const struct qt_extended_surface_listener extended_surface_listener = {
+ handle_onscreen_visibility,
+ handle_set_generic_property,
+ handle_close,
+};
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+SDL_bool
+Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ const Uint32 version = ((((Uint32) info->version.major) * 1000000) +
+ (((Uint32) info->version.minor) * 10000) +
+ (((Uint32) info->version.patch)));
+
+ /* Before 2.0.6, it was possible to build an SDL with Wayland support
+ (SDL_SysWMinfo will be large enough to hold Wayland info), but build
+ your app against SDL headers that didn't have Wayland support
+ (SDL_SysWMinfo could be smaller than Wayland needs. This would lead
+ to an app properly using SDL_GetWindowWMInfo() but we'd accidentally
+ overflow memory on the stack or heap. To protect against this, we've
+ padded out the struct unconditionally in the headers and Wayland will
+ just return an error for older apps using this function. Those apps
+ will need to be recompiled against newer headers or not use Wayland,
+ maybe by forcing SDL_VIDEODRIVER=x11. */
+ if (version < 2000006) {
+ info->subsystem = SDL_SYSWM_UNKNOWN;
+ SDL_SetError("Version must be 2.0.6 or newer");
+ return SDL_FALSE;
+ }
+
+ info->info.wl.display = data->waylandData->display;
+ info->info.wl.surface = data->surface;
+ info->info.wl.shell_surface = data->shell_surface.wl;
+ info->subsystem = SDL_SYSWM_WAYLAND;
+
+ return SDL_TRUE;
+}
+
+int
+Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
+{
+ return 0; /* just succeed, the real work is done elsewhere. */
+}
+
+static void
+SetFullscreen(_THIS, SDL_Window * window, struct wl_output *output)
+{
+ const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *wind = window->driverdata;
+
+ if (viddata->shell.zxdg) {
+ if (output) {
+ zxdg_toplevel_v6_set_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel, output);
+ } else {
+ zxdg_toplevel_v6_unset_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel);
+ }
+ } else {
+ if (output) {
+ wl_shell_surface_set_fullscreen(wind->shell_surface.wl,
+ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
+ 0, output);
+ } else {
+ wl_shell_surface_set_toplevel(wind->shell_surface.wl);
+ }
+ }
+
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+}
+
+void Wayland_ShowWindow(_THIS, SDL_Window *window)
+{
+ struct wl_output *output = (struct wl_output *) window->fullscreen_mode.driverdata;
+ SetFullscreen(_this, window, (window->flags & SDL_WINDOW_FULLSCREEN) ? output : NULL);
+}
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+static void SDLCALL
+QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
+ const char *oldValue, const char *newValue)
+{
+ struct qt_extended_surface *qt_extended_surface = userdata;
+
+ if (name == NULL) {
+ return;
+ }
+
+ if (strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) {
+ int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
+
+ if (newValue != NULL) {
+ if (strcmp(newValue, "portrait") == 0) {
+ orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
+ } else if (strcmp(newValue, "landscape") == 0) {
+ orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
+ } else if (strcmp(newValue, "inverted-portrait") == 0) {
+ orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
+ } else if (strcmp(newValue, "inverted-landscape") == 0) {
+ orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
+ }
+ }
+
+ qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
+ } else if (strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) {
+ uint32_t flags = 0;
+
+ if (newValue != NULL) {
+ char *tmp = strdup(newValue);
+ char *saveptr = NULL;
+
+ char *flag = strtok_r(tmp, " ", &saveptr);
+ while (flag) {
+ if (strcmp(flag, "OverridesSystemGestures") == 0) {
+ flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
+ } else if (strcmp(flag, "StaysOnTop") == 0) {
+ flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
+ } else if (strcmp(flag, "BypassWindowManager") == 0) {
+ // See https://github.com/qtproject/qtwayland/commit/fb4267103d
+ flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */;
+ }
+
+ flag = strtok_r(NULL, " ", &saveptr);
+ }
+
+ free(tmp);
+ }
+
+ qt_extended_surface_set_window_flags(qt_extended_surface, flags);
+ }
+}
+
+static void QtExtendedSurface_Subscribe(struct qt_extended_surface *surface, const char *name)
+{
+ SDL_AddHintCallback(name, QtExtendedSurface_OnHintChanged, surface);
+}
+
+static void QtExtendedSurface_Unsubscribe(struct qt_extended_surface *surface, const char *name)
+{
+ SDL_DelHintCallback(name, QtExtendedSurface_OnHintChanged, surface);
+}
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+void
+Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
+ SDL_VideoDisplay * _display, SDL_bool fullscreen)
+{
+ struct wl_output *output = (struct wl_output *) _display->driverdata;
+ SetFullscreen(_this, window, fullscreen ? output : NULL);
+}
+
+void
+Wayland_RestoreWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wind = window->driverdata;
+ const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
+
+ if (viddata->shell.zxdg) {
+ } else {
+ wl_shell_surface_set_toplevel(wind->shell_surface.wl);
+ }
+
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+}
+
+void
+Wayland_MaximizeWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wind = window->driverdata;
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+
+ if (viddata->shell.zxdg) {
+ zxdg_toplevel_v6_set_maximized(wind->shell_surface.zxdg.roleobj.toplevel);
+ } else {
+ wl_shell_surface_set_maximized(wind->shell_surface.wl, NULL);
+ }
+
+ WAYLAND_wl_display_flush( viddata->display );
+}
+
+int Wayland_CreateWindow(_THIS, SDL_Window *window)
+{
+ SDL_WindowData *data;
+ SDL_VideoData *c;
+ struct wl_region *region;
+
+ data = calloc(1, sizeof *data);
+ if (data == NULL)
+ return SDL_OutOfMemory();
+
+ c = _this->driverdata;
+ window->driverdata = data;
+
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ SDL_GL_LoadLibrary(NULL);
+ window->flags |= SDL_WINDOW_OPENGL;
+ }
+
+ if (window->x == SDL_WINDOWPOS_UNDEFINED) {
+ window->x = 0;
+ }
+ if (window->y == SDL_WINDOWPOS_UNDEFINED) {
+ window->y = 0;
+ }
+
+ data->waylandData = c;
+ data->sdlwindow = window;
+
+ data->surface =
+ wl_compositor_create_surface(c->compositor);
+ wl_surface_set_user_data(data->surface, data);
+
+ if (c->shell.zxdg) {
+ data->shell_surface.zxdg.surface = zxdg_shell_v6_get_xdg_surface(c->shell.zxdg, data->surface);
+ /* !!! FIXME: add popup role */
+ data->shell_surface.zxdg.roleobj.toplevel = zxdg_surface_v6_get_toplevel(data->shell_surface.zxdg.surface);
+ zxdg_toplevel_v6_add_listener(data->shell_surface.zxdg.roleobj.toplevel, &toplevel_listener_zxdg, data);
+ zxdg_toplevel_v6_set_app_id(data->shell_surface.zxdg.roleobj.toplevel, c->classname);
+ } else {
+ data->shell_surface.wl = wl_shell_get_shell_surface(c->shell.wl, data->surface);
+ wl_shell_surface_set_class(data->shell_surface.wl, c->classname);
+ }
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ if (c->surface_extension) {
+ data->extended_surface = qt_surface_extension_get_extended_surface(
+ c->surface_extension, data->surface);
+
+ QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
+ QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
+ }
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+ data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
+ window->w, window->h);
+
+ /* Create the GLES window surface */
+ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window);
+
+ if (data->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("failed to create a window surface");
+ }
+
+ if (c->shell.zxdg) {
+ if (data->shell_surface.zxdg.surface) {
+ zxdg_surface_v6_set_user_data(data->shell_surface.zxdg.surface, data);
+ zxdg_surface_v6_add_listener(data->shell_surface.zxdg.surface, &shell_surface_listener_zxdg, data);
+ }
+ } else {
+ if (data->shell_surface.wl) {
+ wl_shell_surface_set_user_data(data->shell_surface.wl, data);
+ wl_shell_surface_add_listener(data->shell_surface.wl, &shell_surface_listener_wl, data);
+ }
+ }
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ if (data->extended_surface) {
+ qt_extended_surface_set_user_data(data->extended_surface, data);
+ qt_extended_surface_add_listener(data->extended_surface,
+ &extended_surface_listener, data);
+ }
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+ region = wl_compositor_create_region(c->compositor);
+ wl_region_add(region, 0, 0, window->w, window->h);
+ wl_surface_set_opaque_region(data->surface, region);
+ wl_region_destroy(region);
+
+ if (c->relative_mouse_mode) {
+ Wayland_input_lock_pointer(c->input);
+ }
+
+ wl_surface_commit(data->surface);
+ WAYLAND_wl_display_flush(c->display);
+
+ return 0;
+}
+
+void Wayland_SetWindowSize(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *data = _this->driverdata;
+ SDL_WindowData *wind = window->driverdata;
+ struct wl_region *region;
+
+ WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+
+ region =wl_compositor_create_region(data->compositor);
+ wl_region_add(region, 0, 0, window->w, window->h);
+ wl_surface_set_opaque_region(wind->surface, region);
+ wl_region_destroy(region);
+}
+
+void Wayland_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wind = window->driverdata;
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+
+ if (window->title != NULL) {
+ if (viddata->shell.zxdg) {
+ zxdg_toplevel_v6_set_title(wind->shell_surface.zxdg.roleobj.toplevel, window->title);
+ } else {
+ wl_shell_surface_set_title(wind->shell_surface.wl, window->title);
+ }
+ }
+
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
+}
+
+void Wayland_DestroyWindow(_THIS, SDL_Window *window)
+{
+ SDL_VideoData *data = _this->driverdata;
+ SDL_WindowData *wind = window->driverdata;
+
+ if (data) {
+ SDL_EGL_DestroySurface(_this, wind->egl_surface);
+ WAYLAND_wl_egl_window_destroy(wind->egl_window);
+
+ if (data->shell.zxdg) {
+ if (wind->shell_surface.zxdg.roleobj.toplevel) {
+ zxdg_toplevel_v6_destroy(wind->shell_surface.zxdg.roleobj.toplevel);
+ }
+ if (wind->shell_surface.zxdg.surface) {
+ zxdg_surface_v6_destroy(wind->shell_surface.zxdg.surface);
+ }
+ } else {
+ if (wind->shell_surface.wl) {
+ wl_shell_surface_destroy(wind->shell_surface.wl);
+ }
+ }
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ if (wind->extended_surface) {
+ QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
+ QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
+ qt_extended_surface_destroy(wind->extended_surface);
+ }
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+ wl_surface_destroy(wind->surface);
+
+ SDL_free(wind);
+ WAYLAND_wl_display_flush(data->display);
+ }
+ window->driverdata = NULL;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.h b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.h
new file mode 100644
index 0000000..80d4f31
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/wayland/SDL_waylandwindow.h
@@ -0,0 +1,78 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_waylandwindow_h_
+#define SDL_waylandwindow_h_
+
+#include "../SDL_sysvideo.h"
+#include "SDL_syswm.h"
+
+#include "SDL_waylandvideo.h"
+
+struct SDL_WaylandInput;
+
+typedef struct {
+ struct zxdg_surface_v6 *surface;
+ union {
+ struct zxdg_toplevel_v6 *toplevel;
+ struct zxdg_popup_v6 *popup;
+ } roleobj;
+} SDL_zxdg_shell_surface;
+
+typedef struct {
+ SDL_Window *sdlwindow;
+ SDL_VideoData *waylandData;
+ struct wl_surface *surface;
+ union {
+ /* !!! FIXME: add stable xdg_shell from 1.12 */
+ SDL_zxdg_shell_surface zxdg;
+ struct wl_shell_surface *wl;
+ } shell_surface;
+ struct wl_egl_window *egl_window;
+ struct SDL_WaylandInput *keyboard_device;
+ EGLSurface egl_surface;
+ struct zwp_locked_pointer_v1 *locked_pointer;
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+ struct qt_extended_surface *extended_surface;
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+} SDL_WindowData;
+
+extern void Wayland_ShowWindow(_THIS, SDL_Window *window);
+extern void Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
+ SDL_VideoDisplay * _display,
+ SDL_bool fullscreen);
+extern void Wayland_MaximizeWindow(_THIS, SDL_Window * window);
+extern void Wayland_RestoreWindow(_THIS, SDL_Window * window);
+extern int Wayland_CreateWindow(_THIS, SDL_Window *window);
+extern void Wayland_SetWindowSize(_THIS, SDL_Window * window);
+extern void Wayland_SetWindowTitle(_THIS, SDL_Window * window);
+extern void Wayland_DestroyWindow(_THIS, SDL_Window *window);
+
+extern SDL_bool
+Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
+extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
+
+#endif /* SDL_waylandwindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_msctf.h b/src/3rdparty/SDL2/src/video/windows/SDL_msctf.h
new file mode 100644
index 0000000..53cec3d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_msctf.h
@@ -0,0 +1,242 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_msctf_h_
+#define SDL_msctf_h_
+
+#include <unknwn.h>
+
+#define TF_INVALID_COOKIE (0xffffffff)
+#define TF_IPSINK_FLAG_ACTIVE 0x0001
+#define TF_TMAE_UIELEMENTENABLEDONLY 0x00000004
+
+typedef struct ITfThreadMgr ITfThreadMgr;
+typedef struct ITfDocumentMgr ITfDocumentMgr;
+typedef struct ITfClientId ITfClientId;
+
+typedef struct IEnumTfDocumentMgrs IEnumTfDocumentMgrs;
+typedef struct IEnumTfFunctionProviders IEnumTfFunctionProviders;
+typedef struct ITfFunctionProvider ITfFunctionProvider;
+typedef struct ITfCompartmentMgr ITfCompartmentMgr;
+typedef struct ITfContext ITfContext;
+typedef struct IEnumTfContexts IEnumTfContexts;
+typedef struct ITfUIElementSink ITfUIElementSink;
+typedef struct ITfUIElement ITfUIElement;
+typedef struct ITfUIElementMgr ITfUIElementMgr;
+typedef struct IEnumTfUIElements IEnumTfUIElements;
+typedef struct ITfThreadMgrEx ITfThreadMgrEx;
+typedef struct ITfCandidateListUIElement ITfCandidateListUIElement;
+typedef struct ITfReadingInformationUIElement ITfReadingInformationUIElement;
+typedef struct ITfInputProcessorProfileActivationSink ITfInputProcessorProfileActivationSink;
+typedef struct ITfSource ITfSource;
+
+typedef DWORD TfClientId;
+typedef DWORD TfEditCookie;
+
+typedef struct ITfThreadMgrVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfThreadMgr *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfThreadMgr *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfThreadMgr *);
+ HRESULT (STDMETHODCALLTYPE *Activate)(ITfThreadMgr *, TfClientId *);
+ HRESULT (STDMETHODCALLTYPE *Deactivate)(ITfThreadMgr *);
+ HRESULT (STDMETHODCALLTYPE *CreateDocumentMgr)(ITfThreadMgr *);
+ HRESULT (STDMETHODCALLTYPE *EnumDocumentMgrs)(ITfThreadMgr *, IEnumTfDocumentMgrs **);
+ HRESULT (STDMETHODCALLTYPE *GetFocus)(ITfThreadMgr *, ITfDocumentMgr **);
+ HRESULT (STDMETHODCALLTYPE *SetFocus)(ITfThreadMgr *, ITfDocumentMgr *);
+ HRESULT (STDMETHODCALLTYPE *AssociateFocus)(ITfThreadMgr *, HWND, ITfDocumentMgr *, ITfDocumentMgr **);
+ HRESULT (STDMETHODCALLTYPE *IsThreadFocus)(ITfThreadMgr *, BOOL *);
+ HRESULT (STDMETHODCALLTYPE *GetFunctionProvider)(ITfThreadMgr *, REFCLSID, ITfFunctionProvider **);
+ HRESULT (STDMETHODCALLTYPE *EnumFunctionProviders)(ITfThreadMgr *, IEnumTfFunctionProviders **);
+ HRESULT (STDMETHODCALLTYPE *GetGlobalCompartment)(ITfThreadMgr *, ITfCompartmentMgr **);
+} ITfThreadMgrVtbl;
+
+struct ITfThreadMgr
+{
+ const struct ITfThreadMgrVtbl *lpVtbl;
+};
+
+typedef struct ITfThreadMgrExVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfThreadMgrEx *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfThreadMgrEx *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfThreadMgrEx *);
+ HRESULT (STDMETHODCALLTYPE *Activate)(ITfThreadMgrEx *, TfClientId *);
+ HRESULT (STDMETHODCALLTYPE *Deactivate)(ITfThreadMgrEx *);
+ HRESULT (STDMETHODCALLTYPE *CreateDocumentMgr)(ITfThreadMgrEx *, ITfDocumentMgr **);
+ HRESULT (STDMETHODCALLTYPE *EnumDocumentMgrs)(ITfThreadMgrEx *, IEnumTfDocumentMgrs **);
+ HRESULT (STDMETHODCALLTYPE *GetFocus)(ITfThreadMgrEx *, ITfDocumentMgr **);
+ HRESULT (STDMETHODCALLTYPE *SetFocus)(ITfThreadMgrEx *, ITfDocumentMgr *);
+ HRESULT (STDMETHODCALLTYPE *AssociateFocus)(ITfThreadMgrEx *, ITfDocumentMgr *, ITfDocumentMgr **);
+ HRESULT (STDMETHODCALLTYPE *IsThreadFocus)(ITfThreadMgrEx *, BOOL *);
+ HRESULT (STDMETHODCALLTYPE *GetFunctionProvider)(ITfThreadMgrEx *, REFCLSID, ITfFunctionProvider **);
+ HRESULT (STDMETHODCALLTYPE *EnumFunctionProviders)(ITfThreadMgrEx *, IEnumTfFunctionProviders **);
+ HRESULT (STDMETHODCALLTYPE *GetGlobalCompartment)(ITfThreadMgrEx *, ITfCompartmentMgr **);
+ HRESULT (STDMETHODCALLTYPE *ActivateEx)(ITfThreadMgrEx *, TfClientId *, DWORD);
+ HRESULT (STDMETHODCALLTYPE *GetActiveFlags)(ITfThreadMgrEx *, DWORD *);
+} ITfThreadMgrExVtbl;
+
+struct ITfThreadMgrEx
+{
+ const struct ITfThreadMgrExVtbl *lpVtbl;
+};
+
+typedef struct ITfDocumentMgrVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfDocumentMgr *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfDocumentMgr *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfDocumentMgr *);
+ HRESULT (STDMETHODCALLTYPE *CreateContext)(ITfDocumentMgr *, TfClientId, DWORD, IUnknown *, ITfContext **, TfEditCookie *);
+ HRESULT (STDMETHODCALLTYPE *Push)(ITfDocumentMgr *, ITfContext *);
+ HRESULT (STDMETHODCALLTYPE *Pop)(ITfDocumentMgr *);
+ HRESULT (STDMETHODCALLTYPE *GetTop)(ITfDocumentMgr *, ITfContext **);
+ HRESULT (STDMETHODCALLTYPE *GetBase)(ITfDocumentMgr *, ITfContext **);
+ HRESULT (STDMETHODCALLTYPE *EnumContexts)(ITfDocumentMgr *, IEnumTfContexts **);
+} ITfDocumentMgrVtbl;
+
+struct ITfDocumentMgr
+{
+ const struct ITfDocumentMgrVtbl *lpVtbl;
+};
+
+typedef struct ITfUIElementSinkVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElementSink *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElementSink *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfUIElementSink *);
+ HRESULT (STDMETHODCALLTYPE *BeginUIElement)(ITfUIElementSink *, DWORD, BOOL *);
+ HRESULT (STDMETHODCALLTYPE *UpdateUIElement)(ITfUIElementSink *, DWORD);
+ HRESULT (STDMETHODCALLTYPE *EndUIElement)(ITfUIElementSink *, DWORD);
+} ITfUIElementSinkVtbl;
+
+struct ITfUIElementSink
+{
+ const struct ITfUIElementSinkVtbl *lpVtbl;
+};
+
+typedef struct ITfUIElementMgrVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElementMgr *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElementMgr *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfUIElementMgr *);
+ HRESULT (STDMETHODCALLTYPE *BeginUIElement)(ITfUIElementMgr *, ITfUIElement *, BOOL *, DWORD *);
+ HRESULT (STDMETHODCALLTYPE *UpdateUIElement)(ITfUIElementMgr *, DWORD);
+ HRESULT (STDMETHODCALLTYPE *EndUIElement)(ITfUIElementMgr *, DWORD);
+ HRESULT (STDMETHODCALLTYPE *GetUIElement)(ITfUIElementMgr *, DWORD, ITfUIElement **);
+ HRESULT (STDMETHODCALLTYPE *EnumUIElements)(ITfUIElementMgr *, IEnumTfUIElements **);
+} ITfUIElementMgrVtbl;
+
+struct ITfUIElementMgr
+{
+ const struct ITfUIElementMgrVtbl *lpVtbl;
+};
+
+typedef struct ITfCandidateListUIElementVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfCandidateListUIElement *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfCandidateListUIElement *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfCandidateListUIElement *);
+ HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfCandidateListUIElement *, BSTR *);
+ HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfCandidateListUIElement *, GUID *);
+ HRESULT (STDMETHODCALLTYPE *Show)(ITfCandidateListUIElement *, BOOL);
+ HRESULT (STDMETHODCALLTYPE *IsShown)(ITfCandidateListUIElement *, BOOL *);
+ HRESULT (STDMETHODCALLTYPE *GetUpdatedFlags)(ITfCandidateListUIElement *, DWORD *);
+ HRESULT (STDMETHODCALLTYPE *GetDocumentMgr)(ITfCandidateListUIElement *, ITfDocumentMgr **);
+ HRESULT (STDMETHODCALLTYPE *GetCount)(ITfCandidateListUIElement *, UINT *);
+ HRESULT (STDMETHODCALLTYPE *GetSelection)(ITfCandidateListUIElement *, UINT *);
+ HRESULT (STDMETHODCALLTYPE *GetString)(ITfCandidateListUIElement *, UINT, BSTR *);
+ HRESULT (STDMETHODCALLTYPE *GetPageIndex)(ITfCandidateListUIElement *, UINT *, UINT, UINT *);
+ HRESULT (STDMETHODCALLTYPE *SetPageIndex)(ITfCandidateListUIElement *, UINT *, UINT);
+ HRESULT (STDMETHODCALLTYPE *GetCurrentPage)(ITfCandidateListUIElement *, UINT *);
+} ITfCandidateListUIElementVtbl;
+
+struct ITfCandidateListUIElement
+{
+ const struct ITfCandidateListUIElementVtbl *lpVtbl;
+};
+
+typedef struct ITfReadingInformationUIElementVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfReadingInformationUIElement *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfReadingInformationUIElement *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfReadingInformationUIElement *);
+ HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfReadingInformationUIElement *, BSTR *);
+ HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfReadingInformationUIElement *, GUID *);
+ HRESULT (STDMETHODCALLTYPE *Show)(ITfReadingInformationUIElement *, BOOL);
+ HRESULT (STDMETHODCALLTYPE *IsShown)(ITfReadingInformationUIElement *, BOOL *);
+ HRESULT (STDMETHODCALLTYPE *GetUpdatedFlags)(ITfReadingInformationUIElement *, DWORD *);
+ HRESULT (STDMETHODCALLTYPE *GetContext)(ITfReadingInformationUIElement *, ITfContext **);
+ HRESULT (STDMETHODCALLTYPE *GetString)(ITfReadingInformationUIElement *, BSTR *);
+ HRESULT (STDMETHODCALLTYPE *GetMaxReadingStringLength)(ITfReadingInformationUIElement *, UINT *);
+ HRESULT (STDMETHODCALLTYPE *GetErrorIndex)(ITfReadingInformationUIElement *, UINT *);
+ HRESULT (STDMETHODCALLTYPE *IsVerticalOrderPreferred)(ITfReadingInformationUIElement *, BOOL *);
+} ITfReadingInformationUIElementVtbl;
+
+struct ITfReadingInformationUIElement
+{
+ const struct ITfReadingInformationUIElementVtbl *lpVtbl;
+};
+
+typedef struct ITfUIElementVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfUIElement *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfUIElement *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfUIElement *);
+ HRESULT (STDMETHODCALLTYPE *GetDescription)(ITfUIElement *, BSTR *);
+ HRESULT (STDMETHODCALLTYPE *GetGUID)(ITfUIElement *, GUID *);
+ HRESULT (STDMETHODCALLTYPE *Show)(ITfUIElement *, BOOL);
+ HRESULT (STDMETHODCALLTYPE *IsShown)(ITfUIElement *, BOOL *);
+} ITfUIElementVtbl;
+
+struct ITfUIElement
+{
+ const struct ITfUIElementVtbl *lpVtbl;
+};
+
+typedef struct ITfInputProcessorProfileActivationSinkVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfInputProcessorProfileActivationSink *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfInputProcessorProfileActivationSink *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfInputProcessorProfileActivationSink *);
+ HRESULT (STDMETHODCALLTYPE *OnActivated)(ITfInputProcessorProfileActivationSink *, DWORD, LANGID, REFCLSID, REFGUID, REFGUID, HKL, DWORD);
+
+} ITfInputProcessorProfileActivationSinkVtbl;
+
+struct ITfInputProcessorProfileActivationSink
+{
+ const struct ITfInputProcessorProfileActivationSinkVtbl *lpVtbl;
+};
+
+typedef struct ITfSourceVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(ITfSource *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(ITfSource *);
+ ULONG (STDMETHODCALLTYPE *Release)(ITfSource *);
+ HRESULT (STDMETHODCALLTYPE *AdviseSink)(ITfSource *, REFIID, IUnknown *, DWORD *);
+ HRESULT (STDMETHODCALLTYPE *UnadviseSink)(ITfSource *, DWORD);
+} ITfSourceVtbl;
+
+struct ITfSource
+{
+ const struct ITfSourceVtbl *lpVtbl;
+};
+
+#endif /* SDL_msctf_h_ */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_vkeys.h b/src/3rdparty/SDL2/src/video/windows/SDL_vkeys.h
new file mode 100644
index 0000000..a38e3a2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_vkeys.h
@@ -0,0 +1,76 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef VK_0
+#define VK_0 '0'
+#define VK_1 '1'
+#define VK_2 '2'
+#define VK_3 '3'
+#define VK_4 '4'
+#define VK_5 '5'
+#define VK_6 '6'
+#define VK_7 '7'
+#define VK_8 '8'
+#define VK_9 '9'
+#define VK_A 'A'
+#define VK_B 'B'
+#define VK_C 'C'
+#define VK_D 'D'
+#define VK_E 'E'
+#define VK_F 'F'
+#define VK_G 'G'
+#define VK_H 'H'
+#define VK_I 'I'
+#define VK_J 'J'
+#define VK_K 'K'
+#define VK_L 'L'
+#define VK_M 'M'
+#define VK_N 'N'
+#define VK_O 'O'
+#define VK_P 'P'
+#define VK_Q 'Q'
+#define VK_R 'R'
+#define VK_S 'S'
+#define VK_T 'T'
+#define VK_U 'U'
+#define VK_V 'V'
+#define VK_W 'W'
+#define VK_X 'X'
+#define VK_Y 'Y'
+#define VK_Z 'Z'
+#endif /* VK_0 */
+
+/* These keys haven't been defined, but were experimentally determined */
+#define VK_SEMICOLON 0xBA
+#define VK_EQUALS 0xBB
+#define VK_COMMA 0xBC
+#define VK_MINUS 0xBD
+#define VK_PERIOD 0xBE
+#define VK_SLASH 0xBF
+#define VK_GRAVE 0xC0
+#define VK_LBRACKET 0xDB
+#define VK_BACKSLASH 0xDC
+#define VK_RBRACKET 0xDD
+#define VK_APOSTROPHE 0xDE
+#define VK_BACKTICK 0xDF
+#define VK_OEM_102 0xE2
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.c
new file mode 100644
index 0000000..4e61d7a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.c
@@ -0,0 +1,160 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_windowsvideo.h"
+#include "SDL_windowswindow.h"
+#include "../../events/SDL_clipboardevents_c.h"
+
+
+#ifdef UNICODE
+#define TEXT_FORMAT CF_UNICODETEXT
+#else
+#define TEXT_FORMAT CF_TEXT
+#endif
+
+
+/* Get any application owned window handle for clipboard association */
+static HWND
+GetWindowHandle(_THIS)
+{
+ SDL_Window *window;
+
+ window = _this->windows;
+ if (window) {
+ return ((SDL_WindowData *) window->driverdata)->hwnd;
+ }
+ return NULL;
+}
+
+int
+WIN_SetClipboardText(_THIS, const char *text)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ int result = 0;
+
+ if (OpenClipboard(GetWindowHandle(_this))) {
+ HANDLE hMem;
+ LPTSTR tstr;
+ SIZE_T i, size;
+
+ /* Convert the text from UTF-8 to Windows Unicode */
+ tstr = WIN_UTF8ToString(text);
+ if (!tstr) {
+ return -1;
+ }
+
+ /* Find out the size of the data */
+ for (size = 0, i = 0; tstr[i]; ++i, ++size) {
+ if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
+ /* We're going to insert a carriage return */
+ ++size;
+ }
+ }
+ size = (size+1)*sizeof(*tstr);
+
+ /* Save the data to the clipboard */
+ hMem = GlobalAlloc(GMEM_MOVEABLE, size);
+ if (hMem) {
+ LPTSTR dst = (LPTSTR)GlobalLock(hMem);
+ if (dst) {
+ /* Copy the text over, adding carriage returns as necessary */
+ for (i = 0; tstr[i]; ++i) {
+ if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
+ *dst++ = '\r';
+ }
+ *dst++ = tstr[i];
+ }
+ *dst = 0;
+ GlobalUnlock(hMem);
+ }
+
+ EmptyClipboard();
+ if (!SetClipboardData(TEXT_FORMAT, hMem)) {
+ result = WIN_SetError("Couldn't set clipboard data");
+ }
+ data->clipboard_count = GetClipboardSequenceNumber();
+ }
+ SDL_free(tstr);
+
+ CloseClipboard();
+ } else {
+ result = WIN_SetError("Couldn't open clipboard");
+ }
+ return result;
+}
+
+char *
+WIN_GetClipboardText(_THIS)
+{
+ char *text;
+
+ text = NULL;
+ if (IsClipboardFormatAvailable(TEXT_FORMAT) &&
+ OpenClipboard(GetWindowHandle(_this))) {
+ HANDLE hMem;
+ LPTSTR tstr;
+
+ hMem = GetClipboardData(TEXT_FORMAT);
+ if (hMem) {
+ tstr = (LPTSTR)GlobalLock(hMem);
+ text = WIN_StringToUTF8(tstr);
+ GlobalUnlock(hMem);
+ } else {
+ WIN_SetError("Couldn't get clipboard data");
+ }
+ CloseClipboard();
+ }
+ if (!text) {
+ text = SDL_strdup("");
+ }
+ return text;
+}
+
+SDL_bool
+WIN_HasClipboardText(_THIS)
+{
+ SDL_bool result = SDL_FALSE;
+ char *text = WIN_GetClipboardText(_this);
+ if (text) {
+ result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
+ SDL_free(text);
+ }
+ return result;
+}
+
+void
+WIN_CheckClipboardUpdate(struct SDL_VideoData * data)
+{
+ const DWORD count = GetClipboardSequenceNumber();
+ if (count != data->clipboard_count) {
+ if (data->clipboard_count) {
+ SDL_SendClipboardUpdate();
+ }
+ data->clipboard_count = count;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.h
new file mode 100644
index 0000000..937b7d0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsclipboard.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsclipboard_h_
+#define SDL_windowsclipboard_h_
+
+/* Forward declaration */
+struct SDL_VideoData;
+
+extern int WIN_SetClipboardText(_THIS, const char *text);
+extern char *WIN_GetClipboardText(_THIS);
+extern SDL_bool WIN_HasClipboardText(_THIS);
+extern void WIN_CheckClipboardUpdate(struct SDL_VideoData * data);
+
+#endif /* SDL_windowsclipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.c
new file mode 100644
index 0000000..a5fd006
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.c
@@ -0,0 +1,1204 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_windowsvideo.h"
+#include "SDL_windowsshape.h"
+#include "SDL_system.h"
+#include "SDL_syswm.h"
+#include "SDL_timer.h"
+#include "SDL_vkeys.h"
+#include "SDL_hints.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_touch_c.h"
+#include "../../events/scancodes_windows.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+
+/* Dropfile support */
+#include <shellapi.h>
+
+/* For GET_X_LPARAM, GET_Y_LPARAM. */
+#include <windowsx.h>
+
+/* #define WMMSG_DEBUG */
+#ifdef WMMSG_DEBUG
+#include <stdio.h>
+#include "wmmsg.h"
+#endif
+
+/* For processing mouse WM_*BUTTON* and WM_MOUSEMOVE message-data from GetMessageExtraInfo() */
+#define MOUSEEVENTF_FROMTOUCH 0xFF515700
+
+/* Masks for processing the windows KEYDOWN and KEYUP messages */
+#define REPEATED_KEYMASK (1<<30)
+#define EXTENDED_KEYMASK (1<<24)
+
+#define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */
+#ifndef VK_OEM_NEC_EQUAL
+#define VK_OEM_NEC_EQUAL 0x92
+#endif
+
+/* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */
+#ifndef WM_XBUTTONDOWN
+#define WM_XBUTTONDOWN 0x020B
+#endif
+#ifndef WM_XBUTTONUP
+#define WM_XBUTTONUP 0x020C
+#endif
+#ifndef GET_XBUTTON_WPARAM
+#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
+#endif
+#ifndef WM_INPUT
+#define WM_INPUT 0x00ff
+#endif
+#ifndef WM_TOUCH
+#define WM_TOUCH 0x0240
+#endif
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020E
+#endif
+#ifndef WM_UNICHAR
+#define WM_UNICHAR 0x0109
+#endif
+
+static SDL_Scancode
+VKeytoScancode(WPARAM vkey)
+{
+ switch (vkey) {
+ case VK_CLEAR: return SDL_SCANCODE_CLEAR;
+ case VK_MODECHANGE: return SDL_SCANCODE_MODE;
+ case VK_SELECT: return SDL_SCANCODE_SELECT;
+ case VK_EXECUTE: return SDL_SCANCODE_EXECUTE;
+ case VK_HELP: return SDL_SCANCODE_HELP;
+ case VK_PAUSE: return SDL_SCANCODE_PAUSE;
+ case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR;
+
+ case VK_F13: return SDL_SCANCODE_F13;
+ case VK_F14: return SDL_SCANCODE_F14;
+ case VK_F15: return SDL_SCANCODE_F15;
+ case VK_F16: return SDL_SCANCODE_F16;
+ case VK_F17: return SDL_SCANCODE_F17;
+ case VK_F18: return SDL_SCANCODE_F18;
+ case VK_F19: return SDL_SCANCODE_F19;
+ case VK_F20: return SDL_SCANCODE_F20;
+ case VK_F21: return SDL_SCANCODE_F21;
+ case VK_F22: return SDL_SCANCODE_F22;
+ case VK_F23: return SDL_SCANCODE_F23;
+ case VK_F24: return SDL_SCANCODE_F24;
+
+ case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS;
+ case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK;
+ case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD;
+ case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH;
+ case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP;
+ case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH;
+ case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS;
+ case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME;
+ case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE;
+ case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN;
+ case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP;
+
+ case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT;
+ case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV;
+ case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP;
+ case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY;
+ case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL;
+ case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT;
+
+ case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH;
+
+ case VK_ATTN: return SDL_SCANCODE_SYSREQ;
+ case VK_CRSEL: return SDL_SCANCODE_CRSEL;
+ case VK_EXSEL: return SDL_SCANCODE_EXSEL;
+ case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR;
+
+ case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1;
+ case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2;
+
+ default: return SDL_SCANCODE_UNKNOWN;
+ }
+}
+
+static SDL_Scancode
+WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam)
+{
+ SDL_Scancode code;
+ int nScanCode = (lParam >> 16) & 0xFF;
+ SDL_bool bIsExtended = (lParam & (1 << 24)) != 0;
+
+ code = VKeytoScancode(wParam);
+
+ if (code == SDL_SCANCODE_UNKNOWN && nScanCode <= 127) {
+ code = windows_scancode_table[nScanCode];
+
+ if (bIsExtended) {
+ switch (code) {
+ case SDL_SCANCODE_RETURN:
+ code = SDL_SCANCODE_KP_ENTER;
+ break;
+ case SDL_SCANCODE_LALT:
+ code = SDL_SCANCODE_RALT;
+ break;
+ case SDL_SCANCODE_LCTRL:
+ code = SDL_SCANCODE_RCTRL;
+ break;
+ case SDL_SCANCODE_SLASH:
+ code = SDL_SCANCODE_KP_DIVIDE;
+ break;
+ case SDL_SCANCODE_CAPSLOCK:
+ code = SDL_SCANCODE_KP_PLUS;
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (code) {
+ case SDL_SCANCODE_HOME:
+ code = SDL_SCANCODE_KP_7;
+ break;
+ case SDL_SCANCODE_UP:
+ code = SDL_SCANCODE_KP_8;
+ break;
+ case SDL_SCANCODE_PAGEUP:
+ code = SDL_SCANCODE_KP_9;
+ break;
+ case SDL_SCANCODE_LEFT:
+ code = SDL_SCANCODE_KP_4;
+ break;
+ case SDL_SCANCODE_RIGHT:
+ code = SDL_SCANCODE_KP_6;
+ break;
+ case SDL_SCANCODE_END:
+ code = SDL_SCANCODE_KP_1;
+ break;
+ case SDL_SCANCODE_DOWN:
+ code = SDL_SCANCODE_KP_2;
+ break;
+ case SDL_SCANCODE_PAGEDOWN:
+ code = SDL_SCANCODE_KP_3;
+ break;
+ case SDL_SCANCODE_INSERT:
+ code = SDL_SCANCODE_KP_0;
+ break;
+ case SDL_SCANCODE_DELETE:
+ code = SDL_SCANCODE_KP_PERIOD;
+ break;
+ case SDL_SCANCODE_PRINTSCREEN:
+ code = SDL_SCANCODE_KP_MULTIPLY;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ return code;
+}
+
+static SDL_bool
+WIN_ShouldIgnoreFocusClick()
+{
+ return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE);
+}
+
+static void
+WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button, SDL_MouseID mouseID)
+{
+ if (data->focus_click_pending & SDL_BUTTON(button)) {
+ /* Ignore the button click for activation */
+ if (!bwParamMousePressed) {
+ data->focus_click_pending &= ~SDL_BUTTON(button);
+ if (!data->focus_click_pending) {
+ WIN_UpdateClipCursor(data->window);
+ }
+ }
+ if (WIN_ShouldIgnoreFocusClick()) {
+ return;
+ }
+ }
+
+ if (bwParamMousePressed && !bSDLMousePressed) {
+ SDL_SendMouseButton(data->window, mouseID, SDL_PRESSED, button);
+ } else if (!bwParamMousePressed && bSDLMousePressed) {
+ SDL_SendMouseButton(data->window, mouseID, SDL_RELEASED, button);
+ }
+}
+
+/*
+* Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also
+* so this funciton reconciles our view of the world with the current buttons reported by windows
+*/
+static void
+WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mouseID)
+{
+ if (wParam != data->mouse_button_flags) {
+ Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL);
+ WIN_CheckWParamMouseButton((wParam & MK_LBUTTON), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, mouseID);
+ WIN_CheckWParamMouseButton((wParam & MK_MBUTTON), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, mouseID);
+ WIN_CheckWParamMouseButton((wParam & MK_RBUTTON), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, mouseID);
+ WIN_CheckWParamMouseButton((wParam & MK_XBUTTON1), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, mouseID);
+ WIN_CheckWParamMouseButton((wParam & MK_XBUTTON2), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, mouseID);
+ data->mouse_button_flags = wParam;
+ }
+}
+
+
+static void
+WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data)
+{
+ if (rawButtons != data->mouse_button_flags) {
+ Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL);
+ if ((rawButtons & RI_MOUSE_BUTTON_1_DOWN))
+ WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_1_DOWN), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_1_UP))
+ WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_1_UP), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_2_DOWN))
+ WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_2_DOWN), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_2_UP))
+ WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_2_UP), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_3_DOWN))
+ WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_3_DOWN), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_3_UP))
+ WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_3_UP), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_4_DOWN))
+ WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_4_DOWN), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_4_UP))
+ WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_4_UP), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_5_DOWN))
+ WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_5_DOWN), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, 0);
+ if ((rawButtons & RI_MOUSE_BUTTON_5_UP))
+ WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_5_UP), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, 0);
+ data->mouse_button_flags = rawButtons;
+ }
+}
+
+static void
+WIN_CheckAsyncMouseRelease(SDL_WindowData *data)
+{
+ Uint32 mouseFlags;
+ SHORT keyState;
+
+ /* mouse buttons may have changed state here, we need to resync them,
+ but we will get a WM_MOUSEMOVE right away which will fix things up if in non raw mode also
+ */
+ mouseFlags = SDL_GetMouseState(NULL, NULL);
+
+ keyState = GetAsyncKeyState(VK_LBUTTON);
+ if (!(keyState & 0x8000)) {
+ WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT, 0);
+ }
+ keyState = GetAsyncKeyState(VK_RBUTTON);
+ if (!(keyState & 0x8000)) {
+ WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT, 0);
+ }
+ keyState = GetAsyncKeyState(VK_MBUTTON);
+ if (!(keyState & 0x8000)) {
+ WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE, 0);
+ }
+ keyState = GetAsyncKeyState(VK_XBUTTON1);
+ if (!(keyState & 0x8000)) {
+ WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1, 0);
+ }
+ keyState = GetAsyncKeyState(VK_XBUTTON2);
+ if (!(keyState & 0x8000)) {
+ WIN_CheckWParamMouseButton(SDL_FALSE, (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2, 0);
+ }
+ data->mouse_button_flags = 0;
+}
+
+static BOOL
+WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text)
+{
+ if (codepoint <= 0x7F) {
+ text[0] = (char) codepoint;
+ text[1] = '\0';
+ } else if (codepoint <= 0x7FF) {
+ text[0] = 0xC0 | (char) ((codepoint >> 6) & 0x1F);
+ text[1] = 0x80 | (char) (codepoint & 0x3F);
+ text[2] = '\0';
+ } else if (codepoint <= 0xFFFF) {
+ text[0] = 0xE0 | (char) ((codepoint >> 12) & 0x0F);
+ text[1] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
+ text[2] = 0x80 | (char) (codepoint & 0x3F);
+ text[3] = '\0';
+ } else if (codepoint <= 0x10FFFF) {
+ text[0] = 0xF0 | (char) ((codepoint >> 18) & 0x0F);
+ text[1] = 0x80 | (char) ((codepoint >> 12) & 0x3F);
+ text[2] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
+ text[3] = 0x80 | (char) (codepoint & 0x3F);
+ text[4] = '\0';
+ } else {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+static SDL_bool
+ShouldGenerateWindowCloseOnAltF4(void)
+{
+ return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE);
+}
+
+/* Win10 "Fall Creators Update" introduced the bug that SetCursorPos() (as used by SDL_WarpMouseInWindow())
+ doesn't reliably generate WM_MOUSEMOVE events anymore (see #3931) which breaks relative mouse mode via warping.
+ This is used to implement a workaround.. */
+static SDL_bool isWin10FCUorNewer = SDL_FALSE;
+
+LRESULT CALLBACK
+WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ SDL_WindowData *data;
+ LRESULT returnCode = -1;
+
+ /* Send a SDL_SYSWMEVENT if the application wants them */
+ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
+ SDL_SysWMmsg wmmsg;
+
+ SDL_VERSION(&wmmsg.version);
+ wmmsg.subsystem = SDL_SYSWM_WINDOWS;
+ wmmsg.msg.win.hwnd = hwnd;
+ wmmsg.msg.win.msg = msg;
+ wmmsg.msg.win.wParam = wParam;
+ wmmsg.msg.win.lParam = lParam;
+ SDL_SendSysWMEvent(&wmmsg);
+ }
+
+ /* Get the window data for the window */
+ data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
+ if (!data) {
+ return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
+ }
+
+#ifdef WMMSG_DEBUG
+ {
+ char message[1024];
+ if (msg > MAX_WMMSG) {
+ SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
+ } else {
+ SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
+ }
+ OutputDebugStringA(message);
+ }
+#endif /* WMMSG_DEBUG */
+
+ if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
+ return 0;
+
+ switch (msg) {
+
+ case WM_SHOWWINDOW:
+ {
+ if (wParam) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ } else {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+ }
+ }
+ break;
+
+ case WM_ACTIVATE:
+ {
+ POINT cursorPos;
+ BOOL minimized;
+
+ minimized = HIWORD(wParam);
+ if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
+ if (LOWORD(wParam) == WA_CLICKACTIVE) {
+ if (GetAsyncKeyState(VK_LBUTTON)) {
+ data->focus_click_pending |= SDL_BUTTON_LMASK;
+ }
+ if (GetAsyncKeyState(VK_RBUTTON)) {
+ data->focus_click_pending |= SDL_BUTTON_RMASK;
+ }
+ if (GetAsyncKeyState(VK_MBUTTON)) {
+ data->focus_click_pending |= SDL_BUTTON_MMASK;
+ }
+ if (GetAsyncKeyState(VK_XBUTTON1)) {
+ data->focus_click_pending |= SDL_BUTTON_X1MASK;
+ }
+ if (GetAsyncKeyState(VK_XBUTTON2)) {
+ data->focus_click_pending |= SDL_BUTTON_X2MASK;
+ }
+ }
+
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ if (SDL_GetKeyboardFocus() != data->window) {
+ SDL_SetKeyboardFocus(data->window);
+ }
+
+ GetCursorPos(&cursorPos);
+ ScreenToClient(hwnd, &cursorPos);
+ SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
+
+ WIN_CheckAsyncMouseRelease(data);
+
+ /*
+ * FIXME: Update keyboard state
+ */
+ WIN_CheckClipboardUpdate(data->videodata);
+
+ SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
+ SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
+ } else {
+ data->in_window_deactivation = SDL_TRUE;
+
+ if (SDL_GetKeyboardFocus() == data->window) {
+ SDL_SetKeyboardFocus(NULL);
+ WIN_ResetDeadKeys();
+ }
+
+ ClipCursor(NULL);
+
+ data->in_window_deactivation = SDL_FALSE;
+ }
+ }
+ returnCode = 0;
+ break;
+
+ case WM_MOUSEMOVE:
+ {
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (!mouse->relative_mode || mouse->relative_mode_warp) {
+ SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0);
+ SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+ if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) {
+ /* To work around #3931, Win10 bug introduced in Fall Creators Update, where
+ SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore,
+ after each windows mouse event generate a fake event for the middle of the window
+ if relative_mode_warp is used */
+ int center_x = 0, center_y = 0;
+ SDL_GetWindowSize(data->window, &center_x, &center_y);
+ center_x /= 2;
+ center_y /= 2;
+ SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y);
+ }
+ }
+ }
+ /* don't break here, fall through to check the wParam like the button presses */
+ case WM_LBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_XBUTTONUP:
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ case WM_XBUTTONDBLCLK:
+ {
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if (!mouse->relative_mode || mouse->relative_mode_warp) {
+ SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0);
+ WIN_CheckWParamMouseButtons(wParam, data, mouseID);
+ }
+ }
+ break;
+
+ case WM_INPUT:
+ {
+ SDL_Mouse *mouse = SDL_GetMouse();
+ HRAWINPUT hRawInput = (HRAWINPUT)lParam;
+ RAWINPUT inp;
+ UINT size = sizeof(inp);
+ const SDL_bool isRelative = mouse->relative_mode || mouse->relative_mode_warp;
+ const SDL_bool isCapture = ((data->window->flags & SDL_WINDOW_MOUSE_CAPTURE) != 0);
+
+ if (!isRelative || mouse->focus != data->window) {
+ if (!isCapture) {
+ break;
+ }
+ }
+
+ GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER));
+
+ /* Mouse data */
+ if (inp.header.dwType == RIM_TYPEMOUSE) {
+ if (isRelative) {
+ RAWMOUSE* rawmouse = &inp.data.mouse;
+
+ if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
+ SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
+ } else {
+ /* synthesize relative moves from the abs position */
+ static SDL_Point initialMousePoint;
+ if (initialMousePoint.x == 0 && initialMousePoint.y == 0) {
+ initialMousePoint.x = rawmouse->lLastX;
+ initialMousePoint.y = rawmouse->lLastY;
+ }
+
+ SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y));
+
+ initialMousePoint.x = rawmouse->lLastX;
+ initialMousePoint.y = rawmouse->lLastY;
+ }
+ WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data);
+ } else if (isCapture) {
+ /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */
+ POINT pt;
+ RECT hwndRect;
+ HWND currentHnd;
+
+ GetCursorPos(&pt);
+ currentHnd = WindowFromPoint(pt);
+ ScreenToClient(hwnd, &pt);
+ GetClientRect(hwnd, &hwndRect);
+
+ /* if in the window, WM_MOUSEMOVE, etc, will cover it. */
+ if(currentHnd != hwnd || pt.x < 0 || pt.y < 0 || pt.x > hwndRect.right || pt.y > hwndRect.right) {
+ SDL_SendMouseMotion(data->window, 0, 0, (int)pt.x, (int)pt.y);
+ SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT);
+ SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT);
+ SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE);
+ SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_XBUTTON1) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_X1);
+ SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_XBUTTON2) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_X2);
+ }
+ } else {
+ SDL_assert(0 && "Shouldn't happen");
+ }
+ }
+ }
+ break;
+
+ case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
+ {
+ short amount = GET_WHEEL_DELTA_WPARAM(wParam);
+ float fAmount = (float) amount / WHEEL_DELTA;
+ if (msg == WM_MOUSEWHEEL)
+ SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL);
+ else
+ SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL);
+ }
+ break;
+
+#ifdef WM_MOUSELEAVE
+ case WM_MOUSELEAVE:
+ if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode && !(data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
+ if (!IsIconic(hwnd)) {
+ POINT cursorPos;
+ GetCursorPos(&cursorPos);
+ ScreenToClient(hwnd, &cursorPos);
+ SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
+ }
+ SDL_SetMouseFocus(NULL);
+ }
+ returnCode = 0;
+ break;
+#endif /* WM_MOUSELEAVE */
+
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ {
+ SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
+ const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
+
+ /* Detect relevant keyboard shortcuts */
+ if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
+ /* ALT+F4: Close window */
+ if (code == SDL_SCANCODE_F4 && ShouldGenerateWindowCloseOnAltF4()) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
+ }
+ }
+
+ if (code != SDL_SCANCODE_UNKNOWN) {
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+ }
+ }
+
+ returnCode = 0;
+ break;
+
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
+ {
+ SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
+ const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
+
+ if (code != SDL_SCANCODE_UNKNOWN) {
+ if (code == SDL_SCANCODE_PRINTSCREEN &&
+ keyboardState[code] == SDL_RELEASED) {
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+ }
+ SDL_SendKeyboardKey(SDL_RELEASED, code);
+ }
+ }
+ returnCode = 0;
+ break;
+
+ case WM_UNICHAR:
+ if ( wParam == UNICODE_NOCHAR ) {
+ returnCode = 1;
+ break;
+ }
+ /* otherwise fall through to below */
+ case WM_CHAR:
+ {
+ char text[5];
+ if ( WIN_ConvertUTF32toUTF8( (UINT32)wParam, text ) ) {
+ SDL_SendKeyboardText( text );
+ }
+ }
+ returnCode = 0;
+ break;
+
+#ifdef WM_INPUTLANGCHANGE
+ case WM_INPUTLANGCHANGE:
+ {
+ WIN_UpdateKeymap();
+ SDL_SendKeymapChangedEvent();
+ }
+ returnCode = 1;
+ break;
+#endif /* WM_INPUTLANGCHANGE */
+
+ case WM_NCLBUTTONDOWN:
+ {
+ data->in_title_click = SDL_TRUE;
+ }
+ break;
+
+ case WM_CAPTURECHANGED:
+ {
+ data->in_title_click = SDL_FALSE;
+
+ /* The mouse may have been released during a modal loop */
+ WIN_CheckAsyncMouseRelease(data);
+ }
+ break;
+
+#ifdef WM_GETMINMAXINFO
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO *info;
+ RECT size;
+ int x, y;
+ int w, h;
+ int min_w, min_h;
+ int max_w, max_h;
+ BOOL constrain_max_size;
+
+ if (SDL_IsShapedWindow(data->window))
+ Win32_ResizeWindowShape(data->window);
+
+ /* If this is an expected size change, allow it */
+ if (data->expected_resize) {
+ break;
+ }
+
+ /* Get the current position of our window */
+ GetWindowRect(hwnd, &size);
+ x = size.left;
+ y = size.top;
+
+ /* Calculate current size of our window */
+ SDL_GetWindowSize(data->window, &w, &h);
+ SDL_GetWindowMinimumSize(data->window, &min_w, &min_h);
+ SDL_GetWindowMaximumSize(data->window, &max_w, &max_h);
+
+ /* Store in min_w and min_h difference between current size and minimal
+ size so we don't need to call AdjustWindowRectEx twice */
+ min_w -= w;
+ min_h -= h;
+ if (max_w && max_h) {
+ max_w -= w;
+ max_h -= h;
+ constrain_max_size = TRUE;
+ } else {
+ constrain_max_size = FALSE;
+ }
+
+ if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS)) {
+ LONG style = GetWindowLong(hwnd, GWL_STYLE);
+ /* DJM - according to the docs for GetMenu(), the
+ return value is undefined if hwnd is a child window.
+ Apparently it's too difficult for MS to check
+ inside their function, so I have to do it here.
+ */
+ BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
+ size.top = 0;
+ size.left = 0;
+ size.bottom = h;
+ size.right = w;
+
+ AdjustWindowRectEx(&size, style, menu, 0);
+ w = size.right - size.left;
+ h = size.bottom - size.top;
+ }
+
+ /* Fix our size to the current size */
+ info = (MINMAXINFO *) lParam;
+ if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) {
+ info->ptMinTrackSize.x = w + min_w;
+ info->ptMinTrackSize.y = h + min_h;
+ if (constrain_max_size) {
+ info->ptMaxTrackSize.x = w + max_w;
+ info->ptMaxTrackSize.y = h + max_h;
+ }
+ } else {
+ info->ptMaxSize.x = w;
+ info->ptMaxSize.y = h;
+ info->ptMaxPosition.x = x;
+ info->ptMaxPosition.y = y;
+ info->ptMinTrackSize.x = w;
+ info->ptMinTrackSize.y = h;
+ info->ptMaxTrackSize.x = w;
+ info->ptMaxTrackSize.y = h;
+ }
+ }
+ returnCode = 0;
+ break;
+#endif /* WM_GETMINMAXINFO */
+
+ case WM_WINDOWPOSCHANGING:
+
+ if (data->expected_resize) {
+ returnCode = 0;
+ }
+ break;
+
+ case WM_WINDOWPOSCHANGED:
+ {
+ RECT rect;
+ int x, y;
+ int w, h;
+
+ if (data->initializing || data->in_border_change) {
+ break;
+ }
+
+ if (!GetClientRect(hwnd, &rect) || IsRectEmpty(&rect)) {
+ break;
+ }
+ ClientToScreen(hwnd, (LPPOINT) & rect);
+ ClientToScreen(hwnd, (LPPOINT) & rect + 1);
+
+ WIN_UpdateClipCursor(data->window);
+
+ x = rect.left;
+ y = rect.top;
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
+
+ w = rect.right - rect.left;
+ h = rect.bottom - rect.top;
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w,
+ h);
+
+ /* Forces a WM_PAINT event */
+ InvalidateRect(hwnd, NULL, FALSE);
+ }
+ break;
+
+ case WM_SIZE:
+ {
+ switch (wParam) {
+ case SIZE_MAXIMIZED:
+ SDL_SendWindowEvent(data->window,
+ SDL_WINDOWEVENT_RESTORED, 0, 0);
+ SDL_SendWindowEvent(data->window,
+ SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+ break;
+ case SIZE_MINIMIZED:
+ SDL_SendWindowEvent(data->window,
+ SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+ break;
+ default:
+ SDL_SendWindowEvent(data->window,
+ SDL_WINDOWEVENT_RESTORED, 0, 0);
+ break;
+ }
+ }
+ break;
+
+ case WM_SETCURSOR:
+ {
+ Uint16 hittest;
+
+ hittest = LOWORD(lParam);
+ if (hittest == HTCLIENT) {
+ SetCursor(SDL_cursor);
+ returnCode = TRUE;
+ } else if (!g_WindowFrameUsableWhileCursorHidden && !SDL_cursor) {
+ SetCursor(NULL);
+ returnCode = TRUE;
+ }
+ }
+ break;
+
+ /* We were occluded, refresh our display */
+ case WM_PAINT:
+ {
+ RECT rect;
+ if (GetUpdateRect(hwnd, &rect, FALSE)) {
+ ValidateRect(hwnd, NULL);
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED,
+ 0, 0);
+ }
+ }
+ returnCode = 0;
+ break;
+
+ /* We'll do our own drawing, prevent flicker */
+ case WM_ERASEBKGND:
+ {
+ }
+ return (1);
+
+ case WM_SYSCOMMAND:
+ {
+ if ((wParam & 0xFFF0) == SC_KEYMENU) {
+ return (0);
+ }
+
+#if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
+ /* Don't start the screensaver or blank the monitor in fullscreen apps */
+ if ((wParam & 0xFFF0) == SC_SCREENSAVE ||
+ (wParam & 0xFFF0) == SC_MONITORPOWER) {
+ if (SDL_GetVideoDevice()->suspend_screensaver) {
+ return (0);
+ }
+ }
+#endif /* System has screensaver support */
+ }
+ break;
+
+ case WM_CLOSE:
+ {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
+ }
+ returnCode = 0;
+ break;
+
+ case WM_TOUCH:
+ if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) {
+ UINT i, num_inputs = LOWORD(wParam);
+ PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs);
+ if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {
+ RECT rect;
+ float x, y;
+
+ if (!GetClientRect(hwnd, &rect) ||
+ (rect.right == rect.left && rect.bottom == rect.top)) {
+ if (inputs) {
+ SDL_stack_free(inputs);
+ }
+ break;
+ }
+ ClientToScreen(hwnd, (LPPOINT) & rect);
+ ClientToScreen(hwnd, (LPPOINT) & rect + 1);
+ rect.top *= 100;
+ rect.left *= 100;
+ rect.bottom *= 100;
+ rect.right *= 100;
+
+ for (i = 0; i < num_inputs; ++i) {
+ PTOUCHINPUT input = &inputs[i];
+
+ const SDL_TouchID touchId = (SDL_TouchID)((size_t)input->hSource);
+ if (SDL_AddTouch(touchId, "") < 0) {
+ continue;
+ }
+
+ /* Get the normalized coordinates for the window */
+ x = (float)(input->x - rect.left)/(rect.right - rect.left);
+ y = (float)(input->y - rect.top)/(rect.bottom - rect.top);
+
+ if (input->dwFlags & TOUCHEVENTF_DOWN) {
+ SDL_SendTouch(touchId, input->dwID, SDL_TRUE, x, y, 1.0f);
+ }
+ if (input->dwFlags & TOUCHEVENTF_MOVE) {
+ SDL_SendTouchMotion(touchId, input->dwID, x, y, 1.0f);
+ }
+ if (input->dwFlags & TOUCHEVENTF_UP) {
+ SDL_SendTouch(touchId, input->dwID, SDL_FALSE, x, y, 1.0f);
+ }
+ }
+ }
+ SDL_stack_free(inputs);
+
+ data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam);
+ return 0;
+ }
+ break;
+
+ case WM_DROPFILES:
+ {
+ UINT i;
+ HDROP drop = (HDROP) wParam;
+ UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0);
+ for (i = 0; i < count; ++i) {
+ UINT size = DragQueryFile(drop, i, NULL, 0) + 1;
+ LPTSTR buffer = SDL_stack_alloc(TCHAR, size);
+ if (buffer) {
+ if (DragQueryFile(drop, i, buffer, size)) {
+ char *file = WIN_StringToUTF8(buffer);
+ SDL_SendDropFile(data->window, file);
+ SDL_free(file);
+ }
+ SDL_stack_free(buffer);
+ }
+ }
+ SDL_SendDropComplete(data->window);
+ DragFinish(drop);
+ return 0;
+ }
+ break;
+
+ case WM_NCCALCSIZE:
+ {
+ Uint32 window_flags = SDL_GetWindowFlags(data->window);
+ if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) {
+ /* When borderless, need to tell windows that the size of the non-client area is 0 */
+ if (!(window_flags & SDL_WINDOW_RESIZABLE)) {
+ int w, h;
+ NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
+ w = data->window->windowed.w;
+ h = data->window->windowed.h;
+ params->rgrc[0].right = params->rgrc[0].left + w;
+ params->rgrc[0].bottom = params->rgrc[0].top + h;
+ }
+ return 0;
+ }
+ }
+ break;
+
+ case WM_NCHITTEST:
+ {
+ SDL_Window *window = data->window;
+ if (window->hit_test) {
+ POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ if (ScreenToClient(hwnd, &winpoint)) {
+ const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
+ const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
+ switch (rc) {
+ #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; }
+ case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION);
+ case SDL_HITTEST_RESIZE_TOPLEFT: POST_HIT_TEST(HTTOPLEFT);
+ case SDL_HITTEST_RESIZE_TOP: POST_HIT_TEST(HTTOP);
+ case SDL_HITTEST_RESIZE_TOPRIGHT: POST_HIT_TEST(HTTOPRIGHT);
+ case SDL_HITTEST_RESIZE_RIGHT: POST_HIT_TEST(HTRIGHT);
+ case SDL_HITTEST_RESIZE_BOTTOMRIGHT: POST_HIT_TEST(HTBOTTOMRIGHT);
+ case SDL_HITTEST_RESIZE_BOTTOM: POST_HIT_TEST(HTBOTTOM);
+ case SDL_HITTEST_RESIZE_BOTTOMLEFT: POST_HIT_TEST(HTBOTTOMLEFT);
+ case SDL_HITTEST_RESIZE_LEFT: POST_HIT_TEST(HTLEFT);
+ #undef POST_HIT_TEST
+ case SDL_HITTEST_NORMAL: return HTCLIENT;
+ }
+ }
+ /* If we didn't return, this will call DefWindowProc below. */
+ }
+ }
+ break;
+ }
+
+ /* If there's a window proc, assume it's going to handle messages */
+ if (data->wndproc) {
+ return CallWindowProc(data->wndproc, hwnd, msg, wParam, lParam);
+ } else if (returnCode >= 0) {
+ return returnCode;
+ } else {
+ return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
+ }
+}
+
+/* A message hook called before TranslateMessage() */
+static SDL_WindowsMessageHook g_WindowsMessageHook = NULL;
+static void *g_WindowsMessageHookData = NULL;
+
+void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
+{
+ g_WindowsMessageHook = callback;
+ g_WindowsMessageHookData = userdata;
+}
+
+void
+WIN_PumpEvents(_THIS)
+{
+ const Uint8 *keystate;
+ MSG msg;
+ DWORD start_ticks = GetTickCount();
+
+ if (g_WindowsEnableMessageLoop) {
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (g_WindowsMessageHook) {
+ g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ }
+
+ /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+
+ /* Make sure we don't busy loop here forever if there are lots of events coming in */
+ if (SDL_TICKS_PASSED(msg.time, start_ticks)) {
+ break;
+ }
+ }
+ }
+
+ /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
+ You won't get a KEYUP until both are released, and that keyup will only be for the second
+ key you released. Take heroic measures and check the keystate as of the last handled event,
+ and if we think a key is pressed when Windows doesn't, unstick it in SDL's state. */
+ keystate = SDL_GetKeyboardState(NULL);
+ if ((keystate[SDL_SCANCODE_LSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
+ }
+ if ((keystate[SDL_SCANCODE_RSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
+ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
+ }
+}
+
+/* to work around #3931, a bug introduced in Win10 Fall Creators Update (build nr. 16299)
+ we need to detect the windows version. this struct and the function below does that.
+ usually this struct and the corresponding function (RtlGetVersion) are in <Ntddk.h>
+ but here we just load it dynamically */
+struct SDL_WIN_OSVERSIONINFOW {
+ ULONG dwOSVersionInfoSize;
+ ULONG dwMajorVersion;
+ ULONG dwMinorVersion;
+ ULONG dwBuildNumber;
+ ULONG dwPlatformId;
+ WCHAR szCSDVersion[128];
+};
+
+static SDL_bool
+IsWin10FCUorNewer(void)
+{
+ HMODULE handle = GetModuleHandleW(L"ntdll.dll");
+ if (handle) {
+ typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*);
+ RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion");
+ if (getVersionPtr != NULL) {
+ struct SDL_WIN_OSVERSIONINFOW info;
+ SDL_zero(info);
+ info.dwOSVersionInfoSize = sizeof(info);
+ if (getVersionPtr(&info) == 0) { /* STATUS_SUCCESS == 0 */
+ if ( (info.dwMajorVersion == 10 && info.dwMinorVersion == 0 && info.dwBuildNumber >= 16299)
+ || (info.dwMajorVersion == 10 && info.dwMinorVersion > 0)
+ || (info.dwMajorVersion > 10) )
+ {
+ return SDL_TRUE;
+ }
+ }
+ }
+ }
+ return SDL_FALSE;
+}
+
+static int app_registered = 0;
+LPTSTR SDL_Appname = NULL;
+Uint32 SDL_Appstyle = 0;
+HINSTANCE SDL_Instance = NULL;
+
+/* Register the class for this application */
+int
+SDL_RegisterApp(char *name, Uint32 style, void *hInst)
+{
+ const char *hint;
+ WNDCLASSEX wcex;
+ TCHAR path[MAX_PATH];
+
+ /* Only do this once... */
+ if (app_registered) {
+ ++app_registered;
+ return (0);
+ }
+ if (!name && !SDL_Appname) {
+ name = "SDL_app";
+#if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC)
+ SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC);
+#endif
+ SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
+ }
+
+ if (name) {
+ SDL_Appname = WIN_UTF8ToString(name);
+ SDL_Appstyle = style;
+ SDL_Instance = hInst ? hInst : GetModuleHandle(NULL);
+ }
+
+ /* Register the application class */
+ wcex.cbSize = sizeof(WNDCLASSEX);
+ wcex.hCursor = NULL;
+ wcex.hIcon = NULL;
+ wcex.hIconSm = NULL;
+ wcex.lpszMenuName = NULL;
+ wcex.lpszClassName = SDL_Appname;
+ wcex.style = SDL_Appstyle;
+ wcex.hbrBackground = NULL;
+ wcex.lpfnWndProc = WIN_WindowProc;
+ wcex.hInstance = SDL_Instance;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+
+ hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);
+ if (hint && *hint) {
+ wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
+
+ hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL);
+ if (hint && *hint) {
+ wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
+ }
+ } else {
+ /* Use the first icon as a default icon, like in the Explorer */
+ GetModuleFileName(SDL_Instance, path, MAX_PATH);
+ ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1);
+ }
+
+ if (!RegisterClassEx(&wcex)) {
+ return SDL_SetError("Couldn't register application class");
+ }
+
+ isWin10FCUorNewer = IsWin10FCUorNewer();
+
+ app_registered = 1;
+ return 0;
+}
+
+/* Unregisters the windowclass registered in SDL_RegisterApp above. */
+void
+SDL_UnregisterApp()
+{
+ WNDCLASSEX wcex;
+
+ /* SDL_RegisterApp might not have been called before */
+ if (!app_registered) {
+ return;
+ }
+ --app_registered;
+ if (app_registered == 0) {
+ /* Check for any registered window classes. */
+ if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) {
+ UnregisterClass(SDL_Appname, SDL_Instance);
+ if (wcex.hIcon) DestroyIcon(wcex.hIcon);
+ if (wcex.hIconSm) DestroyIcon(wcex.hIconSm);
+ }
+ SDL_free(SDL_Appname);
+ SDL_Appname = NULL;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.h
new file mode 100644
index 0000000..1ce2fb4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsevents.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsevents_h_
+#define SDL_windowsevents_h_
+
+extern LPTSTR SDL_Appname;
+extern Uint32 SDL_Appstyle;
+extern HINSTANCE SDL_Instance;
+
+extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam,
+ LPARAM lParam);
+extern void WIN_PumpEvents(_THIS);
+
+#endif /* SDL_windowsevents_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.c
new file mode 100644
index 0000000..e07d9c4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.c
@@ -0,0 +1,127 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_windowsvideo.h"
+
+int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ size_t size;
+ LPBITMAPINFO info;
+ HBITMAP hbm;
+
+ /* Free the old framebuffer surface */
+ if (data->mdc) {
+ DeleteDC(data->mdc);
+ }
+ if (data->hbm) {
+ DeleteObject(data->hbm);
+ }
+
+ /* Find out the format of the screen */
+ size = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD);
+ info = (LPBITMAPINFO)SDL_stack_alloc(Uint8, size);
+ if (!info) {
+ return SDL_OutOfMemory();
+ }
+
+ SDL_memset(info, 0, size);
+ info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+
+ /* The second call to GetDIBits() fills in the bitfields */
+ hbm = CreateCompatibleBitmap(data->hdc, 1, 1);
+ GetDIBits(data->hdc, hbm, 0, 0, NULL, info, DIB_RGB_COLORS);
+ GetDIBits(data->hdc, hbm, 0, 0, NULL, info, DIB_RGB_COLORS);
+ DeleteObject(hbm);
+
+ *format = SDL_PIXELFORMAT_UNKNOWN;
+ if (info->bmiHeader.biCompression == BI_BITFIELDS) {
+ int bpp;
+ Uint32 *masks;
+
+ bpp = info->bmiHeader.biPlanes * info->bmiHeader.biBitCount;
+ masks = (Uint32*)((Uint8*)info + info->bmiHeader.biSize);
+ *format = SDL_MasksToPixelFormatEnum(bpp, masks[0], masks[1], masks[2], 0);
+ }
+ if (*format == SDL_PIXELFORMAT_UNKNOWN)
+ {
+ /* We'll use RGB format for now */
+ *format = SDL_PIXELFORMAT_RGB888;
+
+ /* Create a new one */
+ SDL_memset(info, 0, size);
+ info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ info->bmiHeader.biPlanes = 1;
+ info->bmiHeader.biBitCount = 32;
+ info->bmiHeader.biCompression = BI_RGB;
+ }
+
+ /* Fill in the size information */
+ *pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
+ info->bmiHeader.biWidth = window->w;
+ info->bmiHeader.biHeight = -window->h; /* negative for topdown bitmap */
+ info->bmiHeader.biSizeImage = window->h * (*pitch);
+
+ data->mdc = CreateCompatibleDC(data->hdc);
+ data->hbm = CreateDIBSection(data->hdc, info, DIB_RGB_COLORS, pixels, NULL, 0);
+ SDL_stack_free(info);
+
+ if (!data->hbm) {
+ return WIN_SetError("Unable to create DIB");
+ }
+ SelectObject(data->mdc, data->hbm);
+
+ return 0;
+}
+
+int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ BitBlt(data->hdc, 0, 0, window->w, window->h, data->mdc, 0, 0, SRCCOPY);
+ return 0;
+}
+
+void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (!data) {
+ /* The window wasn't fully initialized */
+ return;
+ }
+
+ if (data->mdc) {
+ DeleteDC(data->mdc);
+ data->mdc = NULL;
+ }
+ if (data->hbm) {
+ DeleteObject(data->hbm);
+ data->hbm = NULL;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.h
new file mode 100644
index 0000000..a83cca5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsframebuffer.h
@@ -0,0 +1,27 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+extern int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch);
+extern int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects);
+extern void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.c
new file mode 100644
index 0000000..c7f357b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.c
@@ -0,0 +1,1579 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_windowsvideo.h"
+
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/scancodes_windows.h"
+
+#include <imm.h>
+#include <oleauto.h>
+
+#ifndef SDL_DISABLE_WINDOWS_IME
+static void IME_Init(SDL_VideoData *videodata, HWND hwnd);
+static void IME_Enable(SDL_VideoData *videodata, HWND hwnd);
+static void IME_Disable(SDL_VideoData *videodata, HWND hwnd);
+static void IME_Quit(SDL_VideoData *videodata);
+#endif /* !SDL_DISABLE_WINDOWS_IME */
+
+#ifndef MAPVK_VK_TO_VSC
+#define MAPVK_VK_TO_VSC 0
+#endif
+#ifndef MAPVK_VSC_TO_VK
+#define MAPVK_VSC_TO_VK 1
+#endif
+#ifndef MAPVK_VK_TO_CHAR
+#define MAPVK_VK_TO_CHAR 2
+#endif
+
+/* Alphabetic scancodes for PC keyboards */
+void
+WIN_InitKeyboard(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ data->ime_com_initialized = SDL_FALSE;
+ data->ime_threadmgr = 0;
+ data->ime_initialized = SDL_FALSE;
+ data->ime_enabled = SDL_FALSE;
+ data->ime_available = SDL_FALSE;
+ data->ime_hwnd_main = 0;
+ data->ime_hwnd_current = 0;
+ data->ime_himc = 0;
+ data->ime_composition[0] = 0;
+ data->ime_readingstring[0] = 0;
+ data->ime_cursor = 0;
+
+ data->ime_candlist = SDL_FALSE;
+ SDL_memset(data->ime_candidates, 0, sizeof(data->ime_candidates));
+ data->ime_candcount = 0;
+ data->ime_candref = 0;
+ data->ime_candsel = 0;
+ data->ime_candpgsize = 0;
+ data->ime_candlistindexbase = 0;
+ data->ime_candvertical = SDL_TRUE;
+
+ data->ime_dirty = SDL_FALSE;
+ SDL_memset(&data->ime_rect, 0, sizeof(data->ime_rect));
+ SDL_memset(&data->ime_candlistrect, 0, sizeof(data->ime_candlistrect));
+ data->ime_winwidth = 0;
+ data->ime_winheight = 0;
+
+ data->ime_hkl = 0;
+ data->ime_himm32 = 0;
+ data->GetReadingString = 0;
+ data->ShowReadingWindow = 0;
+ data->ImmLockIMC = 0;
+ data->ImmUnlockIMC = 0;
+ data->ImmLockIMCC = 0;
+ data->ImmUnlockIMCC = 0;
+ data->ime_uiless = SDL_FALSE;
+ data->ime_threadmgrex = 0;
+ data->ime_uielemsinkcookie = TF_INVALID_COOKIE;
+ data->ime_alpnsinkcookie = TF_INVALID_COOKIE;
+ data->ime_openmodesinkcookie = TF_INVALID_COOKIE;
+ data->ime_convmodesinkcookie = TF_INVALID_COOKIE;
+ data->ime_uielemsink = 0;
+ data->ime_ippasink = 0;
+
+ WIN_UpdateKeymap();
+
+ SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
+ SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows");
+ SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows");
+
+ /* Are system caps/num/scroll lock active? Set our state to match. */
+ SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
+ SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
+}
+
+void
+WIN_UpdateKeymap()
+{
+ int i;
+ SDL_Scancode scancode;
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+
+ SDL_GetDefaultKeymap(keymap);
+
+ for (i = 0; i < SDL_arraysize(windows_scancode_table); i++) {
+ int vk;
+ /* Make sure this scancode is a valid character scancode */
+ scancode = windows_scancode_table[i];
+ if (scancode == SDL_SCANCODE_UNKNOWN ) {
+ continue;
+ }
+
+ /* If this key is one of the non-mappable keys, ignore it */
+ /* Not mapping numbers fixes the French layout, giving numeric keycodes for the number keys, which is the expected behavior */
+ if ((keymap[scancode] & SDLK_SCANCODE_MASK) ||
+ /* scancode == SDL_SCANCODE_GRAVE || */ /* Uncomment this line to re-enable the behavior of not mapping the "`"(grave) key to the users actual keyboard layout */
+ (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0) ) {
+ continue;
+ }
+
+ vk = MapVirtualKey(i, MAPVK_VSC_TO_VK);
+ if ( vk ) {
+ int ch = (MapVirtualKey( vk, MAPVK_VK_TO_CHAR ) & 0x7FFF);
+ if ( ch ) {
+ if ( ch >= 'A' && ch <= 'Z' ) {
+ keymap[scancode] = SDLK_a + ( ch - 'A' );
+ } else {
+ keymap[scancode] = ch;
+ }
+ }
+ }
+ }
+
+ SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+}
+
+void
+WIN_QuitKeyboard(_THIS)
+{
+#ifndef SDL_DISABLE_WINDOWS_IME
+ IME_Quit((SDL_VideoData *)_this->driverdata);
+#endif
+}
+
+void
+WIN_ResetDeadKeys()
+{
+ /*
+ if a deadkey has been typed, but not the next character (which the deadkey might modify),
+ this tries to undo the effect pressing the deadkey.
+ see: http://archives.miloush.net/michkap/archive/2006/09/10/748775.html
+ */
+ BYTE keyboardState[256];
+ WCHAR buffer[16];
+ int keycode, scancode, result, i;
+
+ GetKeyboardState(keyboardState);
+
+ keycode = VK_SPACE;
+ scancode = MapVirtualKey(keycode, MAPVK_VK_TO_VSC);
+ if (scancode == 0) {
+ /* the keyboard doesn't have this key */
+ return;
+ }
+
+ for (i = 0; i < 5; i++) {
+ result = ToUnicode(keycode, scancode, keyboardState, (LPWSTR)buffer, 16, 0);
+ if (result > 0) {
+ /* success */
+ return;
+ }
+ }
+}
+
+void
+WIN_StartTextInput(_THIS)
+{
+#ifndef SDL_DISABLE_WINDOWS_IME
+ SDL_Window *window;
+#endif
+
+ WIN_ResetDeadKeys();
+
+#ifndef SDL_DISABLE_WINDOWS_IME
+ window = SDL_GetKeyboardFocus();
+ if (window) {
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ SDL_GetWindowSize(window, &videodata->ime_winwidth, &videodata->ime_winheight);
+ IME_Init(videodata, hwnd);
+ IME_Enable(videodata, hwnd);
+ }
+#endif /* !SDL_DISABLE_WINDOWS_IME */
+}
+
+void
+WIN_StopTextInput(_THIS)
+{
+#ifndef SDL_DISABLE_WINDOWS_IME
+ SDL_Window *window;
+#endif
+
+ WIN_ResetDeadKeys();
+
+#ifndef SDL_DISABLE_WINDOWS_IME
+ window = SDL_GetKeyboardFocus();
+ if (window) {
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ IME_Init(videodata, hwnd);
+ IME_Disable(videodata, hwnd);
+ }
+#endif /* !SDL_DISABLE_WINDOWS_IME */
+}
+
+void
+WIN_SetTextInputRect(_THIS, SDL_Rect *rect)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
+ HIMC himc = 0;
+
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return;
+ }
+
+ videodata->ime_rect = *rect;
+
+ himc = ImmGetContext(videodata->ime_hwnd_current);
+ if (himc)
+ {
+ COMPOSITIONFORM cf;
+ cf.ptCurrentPos.x = videodata->ime_rect.x;
+ cf.ptCurrentPos.y = videodata->ime_rect.y;
+ cf.dwStyle = CFS_FORCE_POSITION;
+ ImmSetCompositionWindow(himc, &cf);
+ ImmReleaseContext(videodata->ime_hwnd_current, himc);
+ }
+}
+
+#ifdef SDL_DISABLE_WINDOWS_IME
+
+
+SDL_bool
+IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata)
+{
+ return SDL_FALSE;
+}
+
+void IME_Present(SDL_VideoData *videodata)
+{
+}
+
+#else
+
+#ifdef SDL_msctf_h_
+#define USE_INIT_GUID
+#elif defined(__GNUC__)
+#define USE_INIT_GUID
+#endif
+#ifdef USE_INIT_GUID
+#undef DEFINE_GUID
+#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+DEFINE_GUID(IID_ITfInputProcessorProfileActivationSink, 0x71C6E74E,0x0F28,0x11D8,0xA8,0x2A,0x00,0x06,0x5B,0x84,0x43,0x5C);
+DEFINE_GUID(IID_ITfUIElementSink, 0xEA1EA136,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C);
+DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63,0xB2F0,0x4784,0x8B,0x67,0x5E,0x12,0xC8,0x70,0x1A,0x31);
+DEFINE_GUID(IID_ITfSource, 0x4EA48A35,0x60AE,0x446F,0x8F,0xD6,0xE6,0xA8,0xD8,0x24,0x59,0xF7);
+DEFINE_GUID(IID_ITfUIElementMgr, 0xEA1EA135,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C);
+DEFINE_GUID(IID_ITfCandidateListUIElement, 0xEA1EA138,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C);
+DEFINE_GUID(IID_ITfReadingInformationUIElement, 0xEA1EA139,0x19DF,0x11D7,0xA6,0xD2,0x00,0x06,0x5B,0x84,0x43,0x5C);
+DEFINE_GUID(IID_ITfThreadMgr, 0xAA80E801,0x2021,0x11D2,0x93,0xE0,0x00,0x60,0xB0,0x67,0xB8,0x6E);
+DEFINE_GUID(CLSID_TF_ThreadMgr, 0x529A9E6B,0x6587,0x4F23,0xAB,0x9E,0x9C,0x7D,0x68,0x3E,0x3C,0x50);
+DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594,0x4CB0,0xBB,0x58,0x69,0x62,0x8F,0x5F,0x45,0x8C);
+#endif
+
+#define LANG_CHT MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL)
+#define LANG_CHS MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED)
+
+#define MAKEIMEVERSION(major,minor) ((DWORD) (((BYTE)(major) << 24) | ((BYTE)(minor) << 16) ))
+#define IMEID_VER(id) ((id) & 0xffff0000)
+#define IMEID_LANG(id) ((id) & 0x0000ffff)
+
+#define CHT_HKL_DAYI ((HKL)(UINT_PTR)0xE0060404)
+#define CHT_HKL_NEW_PHONETIC ((HKL)(UINT_PTR)0xE0080404)
+#define CHT_HKL_NEW_CHANG_JIE ((HKL)(UINT_PTR)0xE0090404)
+#define CHT_HKL_NEW_QUICK ((HKL)(UINT_PTR)0xE00A0404)
+#define CHT_HKL_HK_CANTONESE ((HKL)(UINT_PTR)0xE00B0404)
+#define CHT_IMEFILENAME1 "TINTLGNT.IME"
+#define CHT_IMEFILENAME2 "CINTLGNT.IME"
+#define CHT_IMEFILENAME3 "MSTCIPHA.IME"
+#define IMEID_CHT_VER42 (LANG_CHT | MAKEIMEVERSION(4, 2))
+#define IMEID_CHT_VER43 (LANG_CHT | MAKEIMEVERSION(4, 3))
+#define IMEID_CHT_VER44 (LANG_CHT | MAKEIMEVERSION(4, 4))
+#define IMEID_CHT_VER50 (LANG_CHT | MAKEIMEVERSION(5, 0))
+#define IMEID_CHT_VER51 (LANG_CHT | MAKEIMEVERSION(5, 1))
+#define IMEID_CHT_VER52 (LANG_CHT | MAKEIMEVERSION(5, 2))
+#define IMEID_CHT_VER60 (LANG_CHT | MAKEIMEVERSION(6, 0))
+#define IMEID_CHT_VER_VISTA (LANG_CHT | MAKEIMEVERSION(7, 0))
+
+#define CHS_HKL ((HKL)(UINT_PTR)0xE00E0804)
+#define CHS_IMEFILENAME1 "PINTLGNT.IME"
+#define CHS_IMEFILENAME2 "MSSCIPYA.IME"
+#define IMEID_CHS_VER41 (LANG_CHS | MAKEIMEVERSION(4, 1))
+#define IMEID_CHS_VER42 (LANG_CHS | MAKEIMEVERSION(4, 2))
+#define IMEID_CHS_VER53 (LANG_CHS | MAKEIMEVERSION(5, 3))
+
+#define LANG() LOWORD((videodata->ime_hkl))
+#define PRIMLANG() ((WORD)PRIMARYLANGID(LANG()))
+#define SUBLANG() SUBLANGID(LANG())
+
+static void IME_UpdateInputLocale(SDL_VideoData *videodata);
+static void IME_ClearComposition(SDL_VideoData *videodata);
+static void IME_SetWindow(SDL_VideoData* videodata, HWND hwnd);
+static void IME_SetupAPI(SDL_VideoData *videodata);
+static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex);
+static void IME_SendEditingEvent(SDL_VideoData *videodata);
+static void IME_DestroyTextures(SDL_VideoData *videodata);
+
+static SDL_bool UILess_SetupSinks(SDL_VideoData *videodata);
+static void UILess_ReleaseSinks(SDL_VideoData *videodata);
+static void UILess_EnableUIUpdates(SDL_VideoData *videodata);
+static void UILess_DisableUIUpdates(SDL_VideoData *videodata);
+
+static void
+IME_Init(SDL_VideoData *videodata, HWND hwnd)
+{
+ if (videodata->ime_initialized)
+ return;
+
+ videodata->ime_hwnd_main = hwnd;
+ if (SUCCEEDED(WIN_CoInitialize())) {
+ videodata->ime_com_initialized = SDL_TRUE;
+ CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr);
+ }
+ videodata->ime_initialized = SDL_TRUE;
+ videodata->ime_himm32 = SDL_LoadObject("imm32.dll");
+ if (!videodata->ime_himm32) {
+ videodata->ime_available = SDL_FALSE;
+ SDL_ClearError();
+ return;
+ }
+ videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
+ videodata->ImmUnlockIMC = (BOOL (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMC");
+ videodata->ImmLockIMCC = (LPVOID (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMCC");
+ videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMCC");
+
+ IME_SetWindow(videodata, hwnd);
+ videodata->ime_himc = ImmGetContext(hwnd);
+ ImmReleaseContext(hwnd, videodata->ime_himc);
+ if (!videodata->ime_himc) {
+ videodata->ime_available = SDL_FALSE;
+ IME_Disable(videodata, hwnd);
+ return;
+ }
+ videodata->ime_available = SDL_TRUE;
+ IME_UpdateInputLocale(videodata);
+ IME_SetupAPI(videodata);
+ videodata->ime_uiless = UILess_SetupSinks(videodata);
+ IME_UpdateInputLocale(videodata);
+ IME_Disable(videodata, hwnd);
+}
+
+static void
+IME_Enable(SDL_VideoData *videodata, HWND hwnd)
+{
+ if (!videodata->ime_initialized || !videodata->ime_hwnd_current)
+ return;
+
+ if (!videodata->ime_available) {
+ IME_Disable(videodata, hwnd);
+ return;
+ }
+ if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
+ ImmAssociateContext(videodata->ime_hwnd_current, videodata->ime_himc);
+
+ videodata->ime_enabled = SDL_TRUE;
+ IME_UpdateInputLocale(videodata);
+ UILess_EnableUIUpdates(videodata);
+}
+
+static void
+IME_Disable(SDL_VideoData *videodata, HWND hwnd)
+{
+ if (!videodata->ime_initialized || !videodata->ime_hwnd_current)
+ return;
+
+ IME_ClearComposition(videodata);
+ if (videodata->ime_hwnd_current == videodata->ime_hwnd_main)
+ ImmAssociateContext(videodata->ime_hwnd_current, (HIMC)0);
+
+ videodata->ime_enabled = SDL_FALSE;
+ UILess_DisableUIUpdates(videodata);
+}
+
+static void
+IME_Quit(SDL_VideoData *videodata)
+{
+ if (!videodata->ime_initialized)
+ return;
+
+ UILess_ReleaseSinks(videodata);
+ if (videodata->ime_hwnd_main)
+ ImmAssociateContext(videodata->ime_hwnd_main, videodata->ime_himc);
+
+ videodata->ime_hwnd_main = 0;
+ videodata->ime_himc = 0;
+ if (videodata->ime_himm32) {
+ SDL_UnloadObject(videodata->ime_himm32);
+ videodata->ime_himm32 = 0;
+ }
+ if (videodata->ime_threadmgr) {
+ videodata->ime_threadmgr->lpVtbl->Release(videodata->ime_threadmgr);
+ videodata->ime_threadmgr = 0;
+ }
+ if (videodata->ime_com_initialized) {
+ WIN_CoUninitialize();
+ videodata->ime_com_initialized = SDL_FALSE;
+ }
+ IME_DestroyTextures(videodata);
+ videodata->ime_initialized = SDL_FALSE;
+}
+
+static void
+IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
+{
+ DWORD id = 0;
+ HIMC himc = 0;
+ WCHAR buffer[16];
+ WCHAR *s = buffer;
+ DWORD len = 0;
+ INT err = 0;
+ BOOL vertical = FALSE;
+ UINT maxuilen = 0;
+
+ if (videodata->ime_uiless)
+ return;
+
+ videodata->ime_readingstring[0] = 0;
+
+ id = IME_GetId(videodata, 0);
+ if (!id)
+ return;
+
+ himc = ImmGetContext(hwnd);
+ if (!himc)
+ return;
+
+ if (videodata->GetReadingString) {
+ len = videodata->GetReadingString(himc, 0, 0, &err, &vertical, &maxuilen);
+ if (len) {
+ if (len > SDL_arraysize(buffer))
+ len = SDL_arraysize(buffer);
+
+ len = videodata->GetReadingString(himc, len, s, &err, &vertical, &maxuilen);
+ }
+ SDL_wcslcpy(videodata->ime_readingstring, s, len);
+ }
+ else {
+ LPINPUTCONTEXT2 lpimc = videodata->ImmLockIMC(himc);
+ LPBYTE p = 0;
+ s = 0;
+ switch (id)
+ {
+ case IMEID_CHT_VER42:
+ case IMEID_CHT_VER43:
+ case IMEID_CHT_VER44:
+ p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 24);
+ if (!p)
+ break;
+
+ len = *(DWORD *)(p + 7*4 + 32*4);
+ s = (WCHAR *)(p + 56);
+ break;
+ case IMEID_CHT_VER51:
+ case IMEID_CHT_VER52:
+ case IMEID_CHS_VER53:
+ p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 4);
+ if (!p)
+ break;
+
+ p = *(LPBYTE *)((LPBYTE)p + 1*4 + 5*4);
+ if (!p)
+ break;
+
+ len = *(DWORD *)(p + 1*4 + (16*2+2*4) + 5*4 + 16*2);
+ s = (WCHAR *)(p + 1*4 + (16*2+2*4) + 5*4);
+ break;
+ case IMEID_CHS_VER41:
+ {
+ int offset = (IME_GetId(videodata, 1) >= 0x00000002) ? 8 : 7;
+ p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + offset * 4);
+ if (!p)
+ break;
+
+ len = *(DWORD *)(p + 7*4 + 16*2*4);
+ s = (WCHAR *)(p + 6*4 + 16*2*1);
+ }
+ break;
+ case IMEID_CHS_VER42:
+ p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 1*4 + 1*4 + 6*4);
+ if (!p)
+ break;
+
+ len = *(DWORD *)(p + 1*4 + (16*2+2*4) + 5*4 + 16*2);
+ s = (WCHAR *)(p + 1*4 + (16*2+2*4) + 5*4);
+ break;
+ }
+ if (s) {
+ size_t size = SDL_min((size_t)(len + 1), SDL_arraysize(videodata->ime_readingstring));
+ SDL_wcslcpy(videodata->ime_readingstring, s, size);
+ }
+
+ videodata->ImmUnlockIMCC(lpimc->hPrivate);
+ videodata->ImmUnlockIMC(himc);
+ }
+ ImmReleaseContext(hwnd, himc);
+ IME_SendEditingEvent(videodata);
+}
+
+static void
+IME_InputLangChanged(SDL_VideoData *videodata)
+{
+ UINT lang = PRIMLANG();
+ IME_UpdateInputLocale(videodata);
+ if (!videodata->ime_uiless)
+ videodata->ime_candlistindexbase = (videodata->ime_hkl == CHT_HKL_DAYI) ? 0 : 1;
+
+ IME_SetupAPI(videodata);
+ if (lang != PRIMLANG()) {
+ IME_ClearComposition(videodata);
+ }
+}
+
+static DWORD
+IME_GetId(SDL_VideoData *videodata, UINT uIndex)
+{
+ static HKL hklprev = 0;
+ static DWORD dwRet[2] = {0};
+ DWORD dwVerSize = 0;
+ DWORD dwVerHandle = 0;
+ LPVOID lpVerBuffer = 0;
+ LPVOID lpVerData = 0;
+ UINT cbVerData = 0;
+ char szTemp[256];
+ HKL hkl = 0;
+ DWORD dwLang = 0;
+ if (uIndex >= sizeof(dwRet) / sizeof(dwRet[0]))
+ return 0;
+
+ hkl = videodata->ime_hkl;
+ if (hklprev == hkl)
+ return dwRet[uIndex];
+
+ hklprev = hkl;
+ dwLang = ((DWORD_PTR)hkl & 0xffff);
+ if (videodata->ime_uiless && LANG() == LANG_CHT) {
+ dwRet[0] = IMEID_CHT_VER_VISTA;
+ dwRet[1] = 0;
+ return dwRet[0];
+ }
+ if (hkl != CHT_HKL_NEW_PHONETIC
+ && hkl != CHT_HKL_NEW_CHANG_JIE
+ && hkl != CHT_HKL_NEW_QUICK
+ && hkl != CHT_HKL_HK_CANTONESE
+ && hkl != CHS_HKL) {
+ dwRet[0] = dwRet[1] = 0;
+ return dwRet[uIndex];
+ }
+ if (ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1) <= 0) {
+ dwRet[0] = dwRet[1] = 0;
+ return dwRet[uIndex];
+ }
+ if (!videodata->GetReadingString) {
+ #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
+ if (CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME1, -1) != 2
+ && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME2, -1) != 2
+ && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHT_IMEFILENAME3, -1) != 2
+ && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME1, -1) != 2
+ && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME2, -1) != 2) {
+ dwRet[0] = dwRet[1] = 0;
+ return dwRet[uIndex];
+ }
+ #undef LCID_INVARIANT
+ dwVerSize = GetFileVersionInfoSizeA(szTemp, &dwVerHandle);
+ if (dwVerSize) {
+ lpVerBuffer = SDL_malloc(dwVerSize);
+ if (lpVerBuffer) {
+ if (GetFileVersionInfoA(szTemp, dwVerHandle, dwVerSize, lpVerBuffer)) {
+ if (VerQueryValueA(lpVerBuffer, "\\", &lpVerData, &cbVerData)) {
+ #define pVerFixedInfo ((VS_FIXEDFILEINFO FAR*)lpVerData)
+ DWORD dwVer = pVerFixedInfo->dwFileVersionMS;
+ dwVer = (dwVer & 0x00ff0000) << 8 | (dwVer & 0x000000ff) << 16;
+ if ((videodata->GetReadingString) ||
+ ((dwLang == LANG_CHT) && (
+ dwVer == MAKEIMEVERSION(4, 2) ||
+ dwVer == MAKEIMEVERSION(4, 3) ||
+ dwVer == MAKEIMEVERSION(4, 4) ||
+ dwVer == MAKEIMEVERSION(5, 0) ||
+ dwVer == MAKEIMEVERSION(5, 1) ||
+ dwVer == MAKEIMEVERSION(5, 2) ||
+ dwVer == MAKEIMEVERSION(6, 0)))
+ ||
+ ((dwLang == LANG_CHS) && (
+ dwVer == MAKEIMEVERSION(4, 1) ||
+ dwVer == MAKEIMEVERSION(4, 2) ||
+ dwVer == MAKEIMEVERSION(5, 3)))) {
+ dwRet[0] = dwVer | dwLang;
+ dwRet[1] = pVerFixedInfo->dwFileVersionLS;
+ SDL_free(lpVerBuffer);
+ return dwRet[0];
+ }
+ #undef pVerFixedInfo
+ }
+ }
+ }
+ SDL_free(lpVerBuffer);
+ }
+ }
+ dwRet[0] = dwRet[1] = 0;
+ return dwRet[uIndex];
+}
+
+static void
+IME_SetupAPI(SDL_VideoData *videodata)
+{
+ char ime_file[MAX_PATH + 1];
+ void* hime = 0;
+ HKL hkl = 0;
+ videodata->GetReadingString = 0;
+ videodata->ShowReadingWindow = 0;
+ if (videodata->ime_uiless)
+ return;
+
+ hkl = videodata->ime_hkl;
+ if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0)
+ return;
+
+ hime = SDL_LoadObject(ime_file);
+ if (!hime)
+ return;
+
+ videodata->GetReadingString = (UINT (WINAPI *)(HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT))
+ SDL_LoadFunction(hime, "GetReadingString");
+ videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL))
+ SDL_LoadFunction(hime, "ShowReadingWindow");
+
+ if (videodata->ShowReadingWindow) {
+ HIMC himc = ImmGetContext(videodata->ime_hwnd_current);
+ if (himc) {
+ videodata->ShowReadingWindow(himc, FALSE);
+ ImmReleaseContext(videodata->ime_hwnd_current, himc);
+ }
+ }
+}
+
+static void
+IME_SetWindow(SDL_VideoData* videodata, HWND hwnd)
+{
+ videodata->ime_hwnd_current = hwnd;
+ if (videodata->ime_threadmgr) {
+ struct ITfDocumentMgr *document_mgr = 0;
+ if (SUCCEEDED(videodata->ime_threadmgr->lpVtbl->AssociateFocus(videodata->ime_threadmgr, hwnd, NULL, &document_mgr))) {
+ if (document_mgr)
+ document_mgr->lpVtbl->Release(document_mgr);
+ }
+ }
+}
+
+static void
+IME_UpdateInputLocale(SDL_VideoData *videodata)
+{
+ static HKL hklprev = 0;
+ videodata->ime_hkl = GetKeyboardLayout(0);
+ if (hklprev == videodata->ime_hkl)
+ return;
+
+ hklprev = videodata->ime_hkl;
+ switch (PRIMLANG()) {
+ case LANG_CHINESE:
+ videodata->ime_candvertical = SDL_TRUE;
+ if (SUBLANG() == SUBLANG_CHINESE_SIMPLIFIED)
+ videodata->ime_candvertical = SDL_FALSE;
+
+ break;
+ case LANG_JAPANESE:
+ videodata->ime_candvertical = SDL_TRUE;
+ break;
+ case LANG_KOREAN:
+ videodata->ime_candvertical = SDL_FALSE;
+ break;
+ }
+}
+
+static void
+IME_ClearComposition(SDL_VideoData *videodata)
+{
+ HIMC himc = 0;
+ if (!videodata->ime_initialized)
+ return;
+
+ himc = ImmGetContext(videodata->ime_hwnd_current);
+ if (!himc)
+ return;
+
+ ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+ if (videodata->ime_uiless)
+ ImmSetCompositionString(himc, SCS_SETSTR, TEXT(""), sizeof(TCHAR), TEXT(""), sizeof(TCHAR));
+
+ ImmNotifyIME(himc, NI_CLOSECANDIDATE, 0, 0);
+ ImmReleaseContext(videodata->ime_hwnd_current, himc);
+ SDL_SendEditingText("", 0, 0);
+}
+
+static void
+IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string)
+{
+ LONG length = ImmGetCompositionStringW(himc, string, videodata->ime_composition, sizeof(videodata->ime_composition) - sizeof(videodata->ime_composition[0]));
+ if (length < 0)
+ length = 0;
+
+ length /= sizeof(videodata->ime_composition[0]);
+ videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0));
+ if (videodata->ime_cursor < SDL_arraysize(videodata->ime_composition) && videodata->ime_composition[videodata->ime_cursor] == 0x3000) {
+ int i;
+ for (i = videodata->ime_cursor + 1; i < length; ++i)
+ videodata->ime_composition[i - 1] = videodata->ime_composition[i];
+
+ --length;
+ }
+ videodata->ime_composition[length] = 0;
+}
+
+static void
+IME_SendInputEvent(SDL_VideoData *videodata)
+{
+ char *s = 0;
+ s = WIN_StringToUTF8(videodata->ime_composition);
+ SDL_SendKeyboardText(s);
+ SDL_free(s);
+
+ videodata->ime_composition[0] = 0;
+ videodata->ime_readingstring[0] = 0;
+ videodata->ime_cursor = 0;
+}
+
+static void
+IME_SendEditingEvent(SDL_VideoData *videodata)
+{
+ char *s = 0;
+ WCHAR buffer[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
+ const size_t size = SDL_arraysize(buffer);
+ buffer[0] = 0;
+ if (videodata->ime_readingstring[0]) {
+ size_t len = SDL_min(SDL_wcslen(videodata->ime_composition), (size_t)videodata->ime_cursor);
+ SDL_wcslcpy(buffer, videodata->ime_composition, len + 1);
+ SDL_wcslcat(buffer, videodata->ime_readingstring, size);
+ SDL_wcslcat(buffer, &videodata->ime_composition[len], size);
+ }
+ else {
+ SDL_wcslcpy(buffer, videodata->ime_composition, size);
+ }
+ s = WIN_StringToUTF8(buffer);
+ SDL_SendEditingText(s, videodata->ime_cursor + (int)SDL_wcslen(videodata->ime_readingstring), 0);
+ SDL_free(s);
+}
+
+static void
+IME_AddCandidate(SDL_VideoData *videodata, UINT i, LPCWSTR candidate)
+{
+ LPWSTR dst = videodata->ime_candidates[i];
+ *dst++ = (WCHAR)(TEXT('0') + ((i + videodata->ime_candlistindexbase) % 10));
+ if (videodata->ime_candvertical)
+ *dst++ = TEXT(' ');
+
+ while (*candidate && (SDL_arraysize(videodata->ime_candidates[i]) > (dst - videodata->ime_candidates[i])))
+ *dst++ = *candidate++;
+
+ *dst = (WCHAR)'\0';
+}
+
+static void
+IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata)
+{
+ LPCANDIDATELIST cand_list = 0;
+ DWORD size = ImmGetCandidateListW(himc, 0, 0, 0);
+ if (size) {
+ cand_list = (LPCANDIDATELIST)SDL_malloc(size);
+ if (cand_list) {
+ size = ImmGetCandidateListW(himc, 0, cand_list, size);
+ if (size) {
+ UINT i, j;
+ UINT page_start = 0;
+ videodata->ime_candsel = cand_list->dwSelection;
+ videodata->ime_candcount = cand_list->dwCount;
+
+ if (LANG() == LANG_CHS && IME_GetId(videodata, 0)) {
+ const UINT maxcandchar = 18;
+ size_t cchars = 0;
+
+ for (i = 0; i < videodata->ime_candcount; ++i) {
+ size_t len = SDL_wcslen((LPWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i])) + 1;
+ if (len + cchars > maxcandchar) {
+ if (i > cand_list->dwSelection)
+ break;
+
+ page_start = i;
+ cchars = len;
+ }
+ else {
+ cchars += len;
+ }
+ }
+ videodata->ime_candpgsize = i - page_start;
+ } else {
+ videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST);
+ if (videodata->ime_candpgsize > 0) {
+ page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize;
+ } else {
+ page_start = 0;
+ }
+ }
+ SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates));
+ for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) {
+ LPCWSTR candidate = (LPCWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i]);
+ IME_AddCandidate(videodata, j, candidate);
+ }
+ if (PRIMLANG() == LANG_KOREAN || (PRIMLANG() == LANG_CHT && !IME_GetId(videodata, 0)))
+ videodata->ime_candsel = -1;
+
+ }
+ SDL_free(cand_list);
+ }
+ }
+}
+
+static void
+IME_ShowCandidateList(SDL_VideoData *videodata)
+{
+ videodata->ime_dirty = SDL_TRUE;
+ videodata->ime_candlist = SDL_TRUE;
+ IME_DestroyTextures(videodata);
+ IME_SendEditingEvent(videodata);
+}
+
+static void
+IME_HideCandidateList(SDL_VideoData *videodata)
+{
+ videodata->ime_dirty = SDL_FALSE;
+ videodata->ime_candlist = SDL_FALSE;
+ IME_DestroyTextures(videodata);
+ IME_SendEditingEvent(videodata);
+}
+
+SDL_bool
+IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata)
+{
+ SDL_bool trap = SDL_FALSE;
+ HIMC himc = 0;
+ if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled)
+ return SDL_FALSE;
+
+ switch (msg) {
+ case WM_INPUTLANGCHANGE:
+ IME_InputLangChanged(videodata);
+ break;
+ case WM_IME_SETCONTEXT:
+ *lParam = 0;
+ break;
+ case WM_IME_STARTCOMPOSITION:
+ trap = SDL_TRUE;
+ break;
+ case WM_IME_COMPOSITION:
+ trap = SDL_TRUE;
+ himc = ImmGetContext(hwnd);
+ if (*lParam & GCS_RESULTSTR) {
+ IME_GetCompositionString(videodata, himc, GCS_RESULTSTR);
+ IME_SendInputEvent(videodata);
+ }
+ if (*lParam & GCS_COMPSTR) {
+ if (!videodata->ime_uiless)
+ videodata->ime_readingstring[0] = 0;
+
+ IME_GetCompositionString(videodata, himc, GCS_COMPSTR);
+ IME_SendEditingEvent(videodata);
+ }
+ ImmReleaseContext(hwnd, himc);
+ break;
+ case WM_IME_ENDCOMPOSITION:
+ videodata->ime_composition[0] = 0;
+ videodata->ime_readingstring[0] = 0;
+ videodata->ime_cursor = 0;
+ SDL_SendEditingText("", 0, 0);
+ break;
+ case WM_IME_NOTIFY:
+ switch (wParam) {
+ case IMN_SETCONVERSIONMODE:
+ case IMN_SETOPENSTATUS:
+ IME_UpdateInputLocale(videodata);
+ break;
+ case IMN_OPENCANDIDATE:
+ case IMN_CHANGECANDIDATE:
+ if (videodata->ime_uiless)
+ break;
+
+ trap = SDL_TRUE;
+ IME_ShowCandidateList(videodata);
+ himc = ImmGetContext(hwnd);
+ if (!himc)
+ break;
+
+ IME_GetCandidateList(himc, videodata);
+ ImmReleaseContext(hwnd, himc);
+ break;
+ case IMN_CLOSECANDIDATE:
+ trap = SDL_TRUE;
+ IME_HideCandidateList(videodata);
+ break;
+ case IMN_PRIVATE:
+ {
+ DWORD dwId = IME_GetId(videodata, 0);
+ IME_GetReadingString(videodata, hwnd);
+ switch (dwId)
+ {
+ case IMEID_CHT_VER42:
+ case IMEID_CHT_VER43:
+ case IMEID_CHT_VER44:
+ case IMEID_CHS_VER41:
+ case IMEID_CHS_VER42:
+ if (*lParam == 1 || *lParam == 2)
+ trap = SDL_TRUE;
+
+ break;
+ case IMEID_CHT_VER50:
+ case IMEID_CHT_VER51:
+ case IMEID_CHT_VER52:
+ case IMEID_CHT_VER60:
+ case IMEID_CHS_VER53:
+ if (*lParam == 16
+ || *lParam == 17
+ || *lParam == 26
+ || *lParam == 27
+ || *lParam == 28)
+ trap = SDL_TRUE;
+ break;
+ }
+ }
+ break;
+ default:
+ trap = SDL_TRUE;
+ break;
+ }
+ break;
+ }
+ return trap;
+}
+
+static void
+IME_CloseCandidateList(SDL_VideoData *videodata)
+{
+ IME_HideCandidateList(videodata);
+ videodata->ime_candcount = 0;
+ SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates));
+}
+
+static void
+UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pcandlist)
+{
+ UINT selection = 0;
+ UINT count = 0;
+ UINT page = 0;
+ UINT pgcount = 0;
+ DWORD pgstart = 0;
+ DWORD pgsize = 0;
+ UINT i, j;
+ pcandlist->lpVtbl->GetSelection(pcandlist, &selection);
+ pcandlist->lpVtbl->GetCount(pcandlist, &count);
+ pcandlist->lpVtbl->GetCurrentPage(pcandlist, &page);
+
+ videodata->ime_candsel = selection;
+ videodata->ime_candcount = count;
+ IME_ShowCandidateList(videodata);
+
+ pcandlist->lpVtbl->GetPageIndex(pcandlist, 0, 0, &pgcount);
+ if (pgcount > 0) {
+ UINT *idxlist = SDL_malloc(sizeof(UINT) * pgcount);
+ if (idxlist) {
+ pcandlist->lpVtbl->GetPageIndex(pcandlist, idxlist, pgcount, &pgcount);
+ pgstart = idxlist[page];
+ if (page < pgcount - 1)
+ pgsize = SDL_min(count, idxlist[page + 1]) - pgstart;
+ else
+ pgsize = count - pgstart;
+
+ SDL_free(idxlist);
+ }
+ }
+ videodata->ime_candpgsize = SDL_min(pgsize, MAX_CANDLIST);
+ videodata->ime_candsel = videodata->ime_candsel - pgstart;
+
+ SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates));
+ for (i = pgstart, j = 0; (DWORD)i < count && j < videodata->ime_candpgsize; i++, j++) {
+ BSTR bstr;
+ if (SUCCEEDED(pcandlist->lpVtbl->GetString(pcandlist, i, &bstr))) {
+ if (bstr) {
+ IME_AddCandidate(videodata, j, bstr);
+ SysFreeString(bstr);
+ }
+ }
+ }
+ if (PRIMLANG() == LANG_KOREAN)
+ videodata->ime_candsel = -1;
+}
+
+STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink)
+{
+ return ++sink->refcount;
+}
+
+STDMETHODIMP_(ULONG) TSFSink_Release(TSFSink *sink)
+{
+ --sink->refcount;
+ if (sink->refcount == 0) {
+ SDL_free(sink);
+ return 0;
+ }
+ return sink->refcount;
+}
+
+STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
+{
+ if (!ppv)
+ return E_INVALIDARG;
+
+ *ppv = 0;
+ if (WIN_IsEqualIID(riid, &IID_IUnknown))
+ *ppv = (IUnknown *)sink;
+ else if (WIN_IsEqualIID(riid, &IID_ITfUIElementSink))
+ *ppv = (ITfUIElementSink *)sink;
+
+ if (*ppv) {
+ TSFSink_AddRef(sink);
+ return S_OK;
+ }
+ return E_NOINTERFACE;
+}
+
+ITfUIElement *UILess_GetUIElement(SDL_VideoData *videodata, DWORD dwUIElementId)
+{
+ ITfUIElementMgr *puiem = 0;
+ ITfUIElement *pelem = 0;
+ ITfThreadMgrEx *threadmgrex = videodata->ime_threadmgrex;
+
+ if (SUCCEEDED(threadmgrex->lpVtbl->QueryInterface(threadmgrex, &IID_ITfUIElementMgr, (LPVOID *)&puiem))) {
+ puiem->lpVtbl->GetUIElement(puiem, dwUIElementId, &pelem);
+ puiem->lpVtbl->Release(puiem);
+ }
+ return pelem;
+}
+
+STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BOOL *pbShow)
+{
+ ITfUIElement *element = UILess_GetUIElement((SDL_VideoData *)sink->data, dwUIElementId);
+ ITfReadingInformationUIElement *preading = 0;
+ ITfCandidateListUIElement *pcandlist = 0;
+ SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
+ if (!element)
+ return E_INVALIDARG;
+
+ *pbShow = FALSE;
+ if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
+ BSTR bstr;
+ if (SUCCEEDED(preading->lpVtbl->GetString(preading, &bstr)) && bstr) {
+ SysFreeString(bstr);
+ }
+ preading->lpVtbl->Release(preading);
+ }
+ else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ videodata->ime_candref++;
+ UILess_GetCandidateList(videodata, pcandlist);
+ pcandlist->lpVtbl->Release(pcandlist);
+ }
+ return S_OK;
+}
+
+STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId)
+{
+ ITfUIElement *element = UILess_GetUIElement((SDL_VideoData *)sink->data, dwUIElementId);
+ ITfReadingInformationUIElement *preading = 0;
+ ITfCandidateListUIElement *pcandlist = 0;
+ SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
+ if (!element)
+ return E_INVALIDARG;
+
+ if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
+ BSTR bstr;
+ if (SUCCEEDED(preading->lpVtbl->GetString(preading, &bstr)) && bstr) {
+ WCHAR *s = (WCHAR *)bstr;
+ SDL_wcslcpy(videodata->ime_readingstring, s, SDL_arraysize(videodata->ime_readingstring));
+ IME_SendEditingEvent(videodata);
+ SysFreeString(bstr);
+ }
+ preading->lpVtbl->Release(preading);
+ }
+ else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ UILess_GetCandidateList(videodata, pcandlist);
+ pcandlist->lpVtbl->Release(pcandlist);
+ }
+ return S_OK;
+}
+
+STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId)
+{
+ ITfUIElement *element = UILess_GetUIElement((SDL_VideoData *)sink->data, dwUIElementId);
+ ITfReadingInformationUIElement *preading = 0;
+ ITfCandidateListUIElement *pcandlist = 0;
+ SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
+ if (!element)
+ return E_INVALIDARG;
+
+ if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfReadingInformationUIElement, (LPVOID *)&preading))) {
+ videodata->ime_readingstring[0] = 0;
+ IME_SendEditingEvent(videodata);
+ preading->lpVtbl->Release(preading);
+ }
+ if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ videodata->ime_candref--;
+ if (videodata->ime_candref == 0)
+ IME_CloseCandidateList(videodata);
+
+ pcandlist->lpVtbl->Release(pcandlist);
+ }
+ return S_OK;
+}
+
+STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
+{
+ if (!ppv)
+ return E_INVALIDARG;
+
+ *ppv = 0;
+ if (WIN_IsEqualIID(riid, &IID_IUnknown))
+ *ppv = (IUnknown *)sink;
+ else if (WIN_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink))
+ *ppv = (ITfInputProcessorProfileActivationSink *)sink;
+
+ if (*ppv) {
+ TSFSink_AddRef(sink);
+ return S_OK;
+ }
+ return E_NOINTERFACE;
+}
+
+STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
+{
+ static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
+ SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
+ videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
+ if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE))
+ IME_InputLangChanged((SDL_VideoData *)sink->data);
+
+ IME_HideCandidateList(videodata);
+ return S_OK;
+}
+
+static void *vtUIElementSink[] = {
+ (void *)(UIElementSink_QueryInterface),
+ (void *)(TSFSink_AddRef),
+ (void *)(TSFSink_Release),
+ (void *)(UIElementSink_BeginUIElement),
+ (void *)(UIElementSink_UpdateUIElement),
+ (void *)(UIElementSink_EndUIElement)
+};
+
+static void *vtIPPASink[] = {
+ (void *)(IPPASink_QueryInterface),
+ (void *)(TSFSink_AddRef),
+ (void *)(TSFSink_Release),
+ (void *)(IPPASink_OnActivated)
+};
+
+static void
+UILess_EnableUIUpdates(SDL_VideoData *videodata)
+{
+ ITfSource *source = 0;
+ if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie != TF_INVALID_COOKIE)
+ return;
+
+ if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) {
+ source->lpVtbl->AdviseSink(source, &IID_ITfUIElementSink, (IUnknown *)videodata->ime_uielemsink, &videodata->ime_uielemsinkcookie);
+ source->lpVtbl->Release(source);
+ }
+}
+
+static void
+UILess_DisableUIUpdates(SDL_VideoData *videodata)
+{
+ ITfSource *source = 0;
+ if (!videodata->ime_threadmgrex || videodata->ime_uielemsinkcookie == TF_INVALID_COOKIE)
+ return;
+
+ if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) {
+ source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie);
+ videodata->ime_uielemsinkcookie = TF_INVALID_COOKIE;
+ source->lpVtbl->Release(source);
+ }
+}
+
+static SDL_bool
+UILess_SetupSinks(SDL_VideoData *videodata)
+{
+ TfClientId clientid = 0;
+ SDL_bool result = SDL_FALSE;
+ ITfSource *source = 0;
+ if (FAILED(CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, (LPVOID *)&videodata->ime_threadmgrex)))
+ return SDL_FALSE;
+
+ if (FAILED(videodata->ime_threadmgrex->lpVtbl->ActivateEx(videodata->ime_threadmgrex, &clientid, TF_TMAE_UIELEMENTENABLEDONLY)))
+ return SDL_FALSE;
+
+ videodata->ime_uielemsink = SDL_malloc(sizeof(TSFSink));
+ videodata->ime_ippasink = SDL_malloc(sizeof(TSFSink));
+
+ videodata->ime_uielemsink->lpVtbl = vtUIElementSink;
+ videodata->ime_uielemsink->refcount = 1;
+ videodata->ime_uielemsink->data = videodata;
+
+ videodata->ime_ippasink->lpVtbl = vtIPPASink;
+ videodata->ime_ippasink->refcount = 1;
+ videodata->ime_ippasink->data = videodata;
+
+ if (SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) {
+ if (SUCCEEDED(source->lpVtbl->AdviseSink(source, &IID_ITfUIElementSink, (IUnknown *)videodata->ime_uielemsink, &videodata->ime_uielemsinkcookie))) {
+ if (SUCCEEDED(source->lpVtbl->AdviseSink(source, &IID_ITfInputProcessorProfileActivationSink, (IUnknown *)videodata->ime_ippasink, &videodata->ime_alpnsinkcookie))) {
+ result = SDL_TRUE;
+ }
+ }
+ source->lpVtbl->Release(source);
+ }
+ return result;
+}
+
+#define SAFE_RELEASE(p) \
+{ \
+ if (p) { \
+ (p)->lpVtbl->Release((p)); \
+ (p) = 0; \
+ } \
+}
+
+static void
+UILess_ReleaseSinks(SDL_VideoData *videodata)
+{
+ ITfSource *source = 0;
+ if (videodata->ime_threadmgrex && SUCCEEDED(videodata->ime_threadmgrex->lpVtbl->QueryInterface(videodata->ime_threadmgrex, &IID_ITfSource, (LPVOID *)&source))) {
+ source->lpVtbl->UnadviseSink(source, videodata->ime_uielemsinkcookie);
+ source->lpVtbl->UnadviseSink(source, videodata->ime_alpnsinkcookie);
+ SAFE_RELEASE(source);
+ videodata->ime_threadmgrex->lpVtbl->Deactivate(videodata->ime_threadmgrex);
+ SAFE_RELEASE(videodata->ime_threadmgrex);
+ TSFSink_Release(videodata->ime_uielemsink);
+ videodata->ime_uielemsink = 0;
+ TSFSink_Release(videodata->ime_ippasink);
+ videodata->ime_ippasink = 0;
+ }
+}
+
+static void *
+StartDrawToBitmap(HDC hdc, HBITMAP *hhbm, int width, int height)
+{
+ BITMAPINFO info;
+ BITMAPINFOHEADER *infoHeader = &info.bmiHeader;
+ BYTE *bits = NULL;
+ if (hhbm) {
+ SDL_zero(info);
+ infoHeader->biSize = sizeof(BITMAPINFOHEADER);
+ infoHeader->biWidth = width;
+ infoHeader->biHeight = -1 * SDL_abs(height);
+ infoHeader->biPlanes = 1;
+ infoHeader->biBitCount = 32;
+ infoHeader->biCompression = BI_RGB;
+ *hhbm = CreateDIBSection(hdc, &info, DIB_RGB_COLORS, (void **)&bits, 0, 0);
+ if (*hhbm)
+ SelectObject(hdc, *hhbm);
+ }
+ return bits;
+}
+
+static void
+StopDrawToBitmap(HDC hdc, HBITMAP *hhbm)
+{
+ if (hhbm && *hhbm) {
+ DeleteObject(*hhbm);
+ *hhbm = NULL;
+ }
+}
+
+/* This draws only within the specified area and fills the entire region. */
+static void
+DrawRect(HDC hdc, int left, int top, int right, int bottom, int pensize)
+{
+ /* The case of no pen (PenSize = 0) is automatically taken care of. */
+ const int penadjust = (int)SDL_floor(pensize / 2.0f - 0.5f);
+ left += pensize / 2;
+ top += pensize / 2;
+ right -= penadjust;
+ bottom -= penadjust;
+ Rectangle(hdc, left, top, right, bottom);
+}
+
+static void
+IME_DestroyTextures(SDL_VideoData *videodata)
+{
+}
+
+#define SDL_swap(a,b) { \
+ int c = (a); \
+ (a) = (b); \
+ (b) = c; \
+ }
+
+static void
+IME_PositionCandidateList(SDL_VideoData *videodata, SIZE size)
+{
+ int left, top, right, bottom;
+ SDL_bool ok = SDL_FALSE;
+ int winw = videodata->ime_winwidth;
+ int winh = videodata->ime_winheight;
+
+ /* Bottom */
+ left = videodata->ime_rect.x;
+ top = videodata->ime_rect.y + videodata->ime_rect.h;
+ right = left + size.cx;
+ bottom = top + size.cy;
+ if (right >= winw) {
+ left -= right - winw;
+ right = winw;
+ }
+ if (bottom < winh)
+ ok = SDL_TRUE;
+
+ /* Top */
+ if (!ok) {
+ left = videodata->ime_rect.x;
+ top = videodata->ime_rect.y - size.cy;
+ right = left + size.cx;
+ bottom = videodata->ime_rect.y;
+ if (right >= winw) {
+ left -= right - winw;
+ right = winw;
+ }
+ if (top >= 0)
+ ok = SDL_TRUE;
+ }
+
+ /* Right */
+ if (!ok) {
+ left = videodata->ime_rect.x + size.cx;
+ top = 0;
+ right = left + size.cx;
+ bottom = size.cy;
+ if (right < winw)
+ ok = SDL_TRUE;
+ }
+
+ /* Left */
+ if (!ok) {
+ left = videodata->ime_rect.x - size.cx;
+ top = 0;
+ right = videodata->ime_rect.x;
+ bottom = size.cy;
+ if (right >= 0)
+ ok = SDL_TRUE;
+ }
+
+ /* Window too small, show at (0,0) */
+ if (!ok) {
+ left = 0;
+ top = 0;
+ right = size.cx;
+ bottom = size.cy;
+ }
+
+ videodata->ime_candlistrect.x = left;
+ videodata->ime_candlistrect.y = top;
+ videodata->ime_candlistrect.w = right - left;
+ videodata->ime_candlistrect.h = bottom - top;
+}
+
+static void
+IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
+{
+ int i, j;
+ SIZE size = {0};
+ SIZE candsizes[MAX_CANDLIST];
+ SIZE maxcandsize = {0};
+ HBITMAP hbm = NULL;
+ const int candcount = SDL_min(SDL_min(MAX_CANDLIST, videodata->ime_candcount), videodata->ime_candpgsize);
+ SDL_bool vertical = videodata->ime_candvertical;
+
+ const int listborder = 1;
+ const int listpadding = 0;
+ const int listbordercolor = RGB(0xB4, 0xC7, 0xAA);
+ const int listfillcolor = RGB(255, 255, 255);
+
+ const int candborder = 1;
+ const int candpadding = 0;
+ const int candmargin = 1;
+ const COLORREF candbordercolor = RGB(255, 255, 255);
+ const COLORREF candfillcolor = RGB(255, 255, 255);
+ const COLORREF candtextcolor = RGB(0, 0, 0);
+ const COLORREF selbordercolor = RGB(0x84, 0xAC, 0xDD);
+ const COLORREF selfillcolor = RGB(0xD2, 0xE6, 0xFF);
+ const COLORREF seltextcolor = RGB(0, 0, 0);
+ const int horzcandspacing = 5;
+
+ HPEN listpen = listborder != 0 ? CreatePen(PS_SOLID, listborder, listbordercolor) : (HPEN)GetStockObject(NULL_PEN);
+ HBRUSH listbrush = CreateSolidBrush(listfillcolor);
+ HPEN candpen = candborder != 0 ? CreatePen(PS_SOLID, candborder, candbordercolor) : (HPEN)GetStockObject(NULL_PEN);
+ HBRUSH candbrush = CreateSolidBrush(candfillcolor);
+ HPEN selpen = candborder != 0 ? CreatePen(PS_DOT, candborder, selbordercolor) : (HPEN)GetStockObject(NULL_PEN);
+ HBRUSH selbrush = CreateSolidBrush(selfillcolor);
+ HFONT font = CreateFont((int)(1 + videodata->ime_rect.h * 0.75f), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH | FF_SWISS, TEXT("Microsoft Sans Serif"));
+
+ SetBkMode(hdc, TRANSPARENT);
+ SelectObject(hdc, font);
+
+ for (i = 0; i < candcount; ++i) {
+ const WCHAR *s = videodata->ime_candidates[i];
+ if (!*s)
+ break;
+
+ GetTextExtentPoint32W(hdc, s, (int)SDL_wcslen(s), &candsizes[i]);
+ maxcandsize.cx = SDL_max(maxcandsize.cx, candsizes[i].cx);
+ maxcandsize.cy = SDL_max(maxcandsize.cy, candsizes[i].cy);
+
+ }
+ if (vertical) {
+ size.cx =
+ (listborder * 2) +
+ (listpadding * 2) +
+ (candmargin * 2) +
+ (candborder * 2) +
+ (candpadding * 2) +
+ (maxcandsize.cx)
+ ;
+ size.cy =
+ (listborder * 2) +
+ (listpadding * 2) +
+ ((candcount + 1) * candmargin) +
+ (candcount * candborder * 2) +
+ (candcount * candpadding * 2) +
+ (candcount * maxcandsize.cy)
+ ;
+ }
+ else {
+ size.cx =
+ (listborder * 2) +
+ (listpadding * 2) +
+ ((candcount + 1) * candmargin) +
+ (candcount * candborder * 2) +
+ (candcount * candpadding * 2) +
+ ((candcount - 1) * horzcandspacing);
+ ;
+
+ for (i = 0; i < candcount; ++i)
+ size.cx += candsizes[i].cx;
+
+ size.cy =
+ (listborder * 2) +
+ (listpadding * 2) +
+ (candmargin * 2) +
+ (candborder * 2) +
+ (candpadding * 2) +
+ (maxcandsize.cy)
+ ;
+ }
+
+ StartDrawToBitmap(hdc, &hbm, size.cx, size.cy);
+
+ SelectObject(hdc, listpen);
+ SelectObject(hdc, listbrush);
+ DrawRect(hdc, 0, 0, size.cx, size.cy, listborder);
+
+ SelectObject(hdc, candpen);
+ SelectObject(hdc, candbrush);
+ SetTextColor(hdc, candtextcolor);
+ SetBkMode(hdc, TRANSPARENT);
+
+ for (i = 0; i < candcount; ++i) {
+ const WCHAR *s = videodata->ime_candidates[i];
+ int left, top, right, bottom;
+ if (!*s)
+ break;
+
+ if (vertical) {
+ left = listborder + listpadding + candmargin;
+ top = listborder + listpadding + (i * candborder * 2) + (i * candpadding * 2) + ((i + 1) * candmargin) + (i * maxcandsize.cy);
+ right = size.cx - listborder - listpadding - candmargin;
+ bottom = top + maxcandsize.cy + (candpadding * 2) + (candborder * 2);
+ }
+ else {
+ left = listborder + listpadding + (i * candborder * 2) + (i * candpadding * 2) + ((i + 1) * candmargin) + (i * horzcandspacing);
+
+ for (j = 0; j < i; ++j)
+ left += candsizes[j].cx;
+
+ top = listborder + listpadding + candmargin;
+ right = left + candsizes[i].cx + (candpadding * 2) + (candborder * 2);
+ bottom = size.cy - listborder - listpadding - candmargin;
+ }
+
+ if (i == videodata->ime_candsel) {
+ SelectObject(hdc, selpen);
+ SelectObject(hdc, selbrush);
+ SetTextColor(hdc, seltextcolor);
+ }
+ else {
+ SelectObject(hdc, candpen);
+ SelectObject(hdc, candbrush);
+ SetTextColor(hdc, candtextcolor);
+ }
+
+ DrawRect(hdc, left, top, right, bottom, candborder);
+ ExtTextOutW(hdc, left + candborder + candpadding, top + candborder + candpadding, 0, NULL, s, (int)SDL_wcslen(s), NULL);
+ }
+ StopDrawToBitmap(hdc, &hbm);
+
+ DeleteObject(listpen);
+ DeleteObject(listbrush);
+ DeleteObject(candpen);
+ DeleteObject(candbrush);
+ DeleteObject(selpen);
+ DeleteObject(selbrush);
+ DeleteObject(font);
+
+ IME_PositionCandidateList(videodata, size);
+}
+
+static void
+IME_Render(SDL_VideoData *videodata)
+{
+ HDC hdc = CreateCompatibleDC(NULL);
+
+ if (videodata->ime_candlist)
+ IME_RenderCandidateList(videodata, hdc);
+
+ DeleteDC(hdc);
+
+ videodata->ime_dirty = SDL_FALSE;
+}
+
+void IME_Present(SDL_VideoData *videodata)
+{
+ if (videodata->ime_dirty)
+ IME_Render(videodata);
+
+ /* FIXME: Need to show the IME bitmap */
+}
+
+#endif /* SDL_DISABLE_WINDOWS_IME */
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.h
new file mode 100644
index 0000000..49a1b87
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowskeyboard.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowskeyboard_h_
+#define SDL_windowskeyboard_h_
+
+extern void WIN_InitKeyboard(_THIS);
+extern void WIN_UpdateKeymap(void);
+extern void WIN_QuitKeyboard(_THIS);
+
+extern void WIN_ResetDeadKeys(void);
+
+extern void WIN_StartTextInput(_THIS);
+extern void WIN_StopTextInput(_THIS);
+extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect);
+
+extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata);
+
+#endif /* SDL_windowskeyboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.c
new file mode 100644
index 0000000..924b412
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.c
@@ -0,0 +1,496 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_assert.h"
+#include "SDL_windowsvideo.h"
+
+
+#ifndef SS_EDITCONTROL
+#define SS_EDITCONTROL 0x2000
+#endif
+
+/* Display a Windows message box */
+
+#pragma pack(push, 1)
+
+typedef struct
+{
+ WORD dlgVer;
+ WORD signature;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ WORD cDlgItems;
+ short x;
+ short y;
+ short cx;
+ short cy;
+} DLGTEMPLATEEX;
+
+typedef struct
+{
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ short x;
+ short y;
+ short cx;
+ short cy;
+ DWORD id;
+} DLGITEMTEMPLATEEX;
+
+#pragma pack(pop)
+
+typedef struct
+{
+ DLGTEMPLATEEX* lpDialog;
+ Uint8 *data;
+ size_t size;
+ size_t used;
+} WIN_DialogData;
+
+
+static INT_PTR MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)
+{
+ switch ( iMessage ) {
+ case WM_COMMAND:
+ /* Return the ID of the button that was pushed */
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space)
+{
+ size_t size = dialog->size;
+
+ if (size == 0) {
+ size = space;
+ } else {
+ while ((dialog->used + space) > size) {
+ size *= 2;
+ }
+ }
+ if (size > dialog->size) {
+ void *data = SDL_realloc(dialog->data, size);
+ if (!data) {
+ SDL_OutOfMemory();
+ return SDL_FALSE;
+ }
+ dialog->data = data;
+ dialog->size = size;
+ dialog->lpDialog = (DLGTEMPLATEEX*)dialog->data;
+ }
+ return SDL_TRUE;
+}
+
+static SDL_bool AlignDialogData(WIN_DialogData *dialog, size_t size)
+{
+ size_t padding = (dialog->used % size);
+
+ if (!ExpandDialogSpace(dialog, padding)) {
+ return SDL_FALSE;
+ }
+
+ dialog->used += padding;
+
+ return SDL_TRUE;
+}
+
+static SDL_bool AddDialogData(WIN_DialogData *dialog, const void *data, size_t size)
+{
+ if (!ExpandDialogSpace(dialog, size)) {
+ return SDL_FALSE;
+ }
+
+ SDL_memcpy(dialog->data+dialog->used, data, size);
+ dialog->used += size;
+
+ return SDL_TRUE;
+}
+
+static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string)
+{
+ WCHAR *wstring;
+ WCHAR *p;
+ size_t count;
+ SDL_bool status;
+
+ if (!string) {
+ string = "";
+ }
+
+ wstring = WIN_UTF8ToString(string);
+ if (!wstring) {
+ return SDL_FALSE;
+ }
+
+ /* Find out how many characters we have, including null terminator */
+ count = 0;
+ for (p = wstring; *p; ++p) {
+ ++count;
+ }
+ ++count;
+
+ status = AddDialogData(dialog, wstring, count*sizeof(WCHAR));
+ SDL_free(wstring);
+ return status;
+}
+
+static int s_BaseUnitsX;
+static int s_BaseUnitsY;
+static void Vec2ToDLU(short *x, short *y)
+{
+ SDL_assert(s_BaseUnitsX != 0); /* we init in WIN_ShowMessageBox(), which is the only public function... */
+
+ *x = MulDiv(*x, 4, s_BaseUnitsX);
+ *y = MulDiv(*y, 8, s_BaseUnitsY);
+}
+
+
+static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, DWORD exStyle, int x, int y, int w, int h, int id, const char *caption)
+{
+ DLGITEMTEMPLATEEX item;
+ WORD marker = 0xFFFF;
+ WORD extraData = 0;
+
+ SDL_zero(item);
+ item.style = style;
+ item.exStyle = exStyle;
+ item.x = x;
+ item.y = y;
+ item.cx = w;
+ item.cy = h;
+ item.id = id;
+
+ Vec2ToDLU(&item.x, &item.y);
+ Vec2ToDLU(&item.cx, &item.cy);
+
+ if (!AlignDialogData(dialog, sizeof(DWORD))) {
+ return SDL_FALSE;
+ }
+ if (!AddDialogData(dialog, &item, sizeof(item))) {
+ return SDL_FALSE;
+ }
+ if (!AddDialogData(dialog, &marker, sizeof(marker))) {
+ return SDL_FALSE;
+ }
+ if (!AddDialogData(dialog, &type, sizeof(type))) {
+ return SDL_FALSE;
+ }
+ if (!AddDialogString(dialog, caption)) {
+ return SDL_FALSE;
+ }
+ if (!AddDialogData(dialog, &extraData, sizeof(extraData))) {
+ return SDL_FALSE;
+ }
+ ++dialog->lpDialog->cDlgItems;
+
+ return SDL_TRUE;
+}
+
+static SDL_bool AddDialogStatic(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text)
+{
+ DWORD style = WS_VISIBLE | WS_CHILD | SS_LEFT | SS_NOPREFIX | SS_EDITCONTROL;
+ return AddDialogControl(dialog, 0x0082, style, 0, x, y, w, h, -1, text);
+}
+
+static SDL_bool AddDialogButton(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text, int id, SDL_bool isDefault)
+{
+ DWORD style = WS_VISIBLE | WS_CHILD;
+ if (isDefault) {
+ style |= BS_DEFPUSHBUTTON;
+ } else {
+ style |= BS_PUSHBUTTON;
+ }
+ return AddDialogControl(dialog, 0x0080, style, 0, x, y, w, h, id, text);
+}
+
+static void FreeDialogData(WIN_DialogData *dialog)
+{
+ SDL_free(dialog->data);
+ SDL_free(dialog);
+}
+
+static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
+{
+ WIN_DialogData *dialog;
+ DLGTEMPLATEEX dialogTemplate;
+ WORD WordToPass;
+
+ SDL_zero(dialogTemplate);
+ dialogTemplate.dlgVer = 1;
+ dialogTemplate.signature = 0xffff;
+ dialogTemplate.style = (WS_CAPTION | DS_CENTER | DS_SHELLFONT);
+ dialogTemplate.x = 0;
+ dialogTemplate.y = 0;
+ dialogTemplate.cx = w;
+ dialogTemplate.cy = h;
+ Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy);
+
+ dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog));
+ if (!dialog) {
+ return NULL;
+ }
+
+ if (!AddDialogData(dialog, &dialogTemplate, sizeof(dialogTemplate))) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* No menu */
+ WordToPass = 0;
+ if (!AddDialogData(dialog, &WordToPass, 2)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* No custom class */
+ if (!AddDialogData(dialog, &WordToPass, 2)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* title */
+ if (!AddDialogString(dialog, caption)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* Font stuff */
+ {
+ /*
+ * We want to use the system messagebox font.
+ */
+ BYTE ToPass;
+
+ NONCLIENTMETRICSA NCM;
+ NCM.cbSize = sizeof(NCM);
+ SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0);
+
+ /* Font size - convert to logical font size for dialog parameter. */
+ {
+ HDC ScreenDC = GetDC(NULL);
+ int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY);
+ if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */
+ LogicalPixelsY = 72;
+ WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY);
+ ReleaseDC(NULL, ScreenDC);
+ }
+
+ if (!AddDialogData(dialog, &WordToPass, 2)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* Font weight */
+ WordToPass = (WORD)NCM.lfMessageFont.lfWeight;
+ if (!AddDialogData(dialog, &WordToPass, 2)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* italic? */
+ ToPass = NCM.lfMessageFont.lfItalic;
+ if (!AddDialogData(dialog, &ToPass, 1)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* charset? */
+ ToPass = NCM.lfMessageFont.lfCharSet;
+ if (!AddDialogData(dialog, &ToPass, 1)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+
+ /* font typeface. */
+ if (!AddDialogString(dialog, NCM.lfMessageFont.lfFaceName)) {
+ FreeDialogData(dialog);
+ return NULL;
+ }
+ }
+
+ return dialog;
+}
+
+int
+WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ WIN_DialogData *dialog;
+ int i, x, y;
+ const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
+ HFONT DialogFont;
+ SIZE Size;
+ RECT TextSize;
+ wchar_t* wmessage;
+ TEXTMETRIC TM;
+
+ HWND ParentWindow = NULL;
+
+ const int ButtonWidth = 88;
+ const int ButtonHeight = 26;
+ const int TextMargin = 16;
+ const int ButtonMargin = 12;
+
+
+ /* Jan 25th, 2013 - dant@fleetsa.com
+ *
+ *
+ * I've tried to make this more reasonable, but I've run in to a lot
+ * of nonsense.
+ *
+ * The original issue is the code was written in pixels and not
+ * dialog units (DLUs). All DialogBox functions use DLUs, which
+ * vary based on the selected font (yay).
+ *
+ * According to MSDN, the most reliable way to convert is via
+ * MapDialogUnits, which requires an HWND, which we don't have
+ * at time of template creation.
+ *
+ * We do however have:
+ * The system font (DLU width 8 for me)
+ * The font we select for the dialog (DLU width 6 for me)
+ *
+ * Based on experimentation, *neither* of these return the value
+ * actually used. Stepping in to MapDialogUnits(), the conversion
+ * is fairly clear, and uses 7 for me.
+ *
+ * As a result, some of this is hacky to ensure the sizing is
+ * somewhat correct.
+ *
+ * Honestly, a long term solution is to use CreateWindow, not CreateDialog.
+ *
+
+ *
+ * In order to get text dimensions we need to have a DC with the desired font.
+ * I'm assuming a dialog box in SDL is rare enough we can to the create.
+ */
+ HDC FontDC = CreateCompatibleDC(0);
+
+ {
+ /* Create a duplicate of the font used in system message boxes. */
+ LOGFONT lf;
+ NONCLIENTMETRICS NCM;
+ NCM.cbSize = sizeof(NCM);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0);
+ lf = NCM.lfMessageFont;
+ DialogFont = CreateFontIndirect(&lf);
+ }
+
+ /* Select the font in to our DC */
+ SelectObject(FontDC, DialogFont);
+
+ {
+ /* Get the metrics to try and figure our DLU conversion. */
+ GetTextMetrics(FontDC, &TM);
+
+ /* Calculation from the following documentation:
+ * https://support.microsoft.com/en-gb/help/125681/how-to-calculate-dialog-base-units-with-non-system-based-font
+ * This fixes bug 2137, dialog box calculation with a fixed-width system font
+ */
+ {
+ SIZE extent;
+ GetTextExtentPoint32A(FontDC, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &extent);
+ s_BaseUnitsX = (extent.cx / 26 + 1) / 2;
+ }
+ /*s_BaseUnitsX = TM.tmAveCharWidth + 1;*/
+ s_BaseUnitsY = TM.tmHeight;
+ }
+
+ /* Measure the *pixel* size of the string. */
+ wmessage = WIN_UTF8ToString(messageboxdata->message);
+ SDL_zero(TextSize);
+ DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT);
+
+ /* Add some padding for hangs, etc. */
+ TextSize.right += 2;
+ TextSize.bottom += 2;
+
+ /* Done with the DC, and the string */
+ DeleteDC(FontDC);
+ SDL_free(wmessage);
+
+ /* Increase the size of the dialog by some border spacing around the text. */
+ Size.cx = TextSize.right - TextSize.left;
+ Size.cy = TextSize.bottom - TextSize.top;
+ Size.cx += TextMargin * 2;
+ Size.cy += TextMargin * 2;
+
+ /* Ensure the size is wide enough for all of the buttons. */
+ if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin)
+ Size.cx = messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin;
+
+ /* Add vertical space for the buttons and border. */
+ Size.cy += ButtonHeight + TextMargin;
+
+ dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title);
+ if (!dialog) {
+ return -1;
+ }
+
+ if (!AddDialogStatic(dialog, TextMargin, TextMargin, TextSize.right - TextSize.left, TextSize.bottom - TextSize.top, messageboxdata->message)) {
+ FreeDialogData(dialog);
+ return -1;
+ }
+
+ /* Align the buttons to the right/bottom. */
+ x = Size.cx - (ButtonWidth + ButtonMargin) * messageboxdata->numbuttons;
+ y = Size.cy - ButtonHeight - ButtonMargin;
+ for (i = messageboxdata->numbuttons - 1; i >= 0; --i) {
+ SDL_bool isDefault;
+
+ if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
+ isDefault = SDL_TRUE;
+ } else {
+ isDefault = SDL_FALSE;
+ }
+ if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, buttons[i].buttonid, isDefault)) {
+ FreeDialogData(dialog);
+ return -1;
+ }
+ x += ButtonWidth + ButtonMargin;
+ }
+
+ /* If we have a parent window, get the Instance and HWND for them
+ * so that our little dialog gets exclusive focus at all times. */
+ if (messageboxdata->window) {
+ ParentWindow = ((SDL_WindowData*)messageboxdata->window->driverdata)->hwnd;
+ }
+
+ *buttonid = (int)DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, ParentWindow, (DLGPROC)MessageBoxDialogProc);
+
+ FreeDialogData(dialog);
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.h
new file mode 100644
index 0000000..2cb29be
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmessagebox.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+extern int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.c
new file mode 100644
index 0000000..7425d9a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.c
@@ -0,0 +1,407 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_windowsvideo.h"
+#include "../../../include/SDL_assert.h"
+#include "../../../include/SDL_log.h"
+
+/* Windows CE compatibility */
+#ifndef CDS_FULLSCREEN
+#define CDS_FULLSCREEN 0
+#endif
+
+/* #define DEBUG_MODES */
+
+static void
+WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
+{
+ SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
+ HDC hdc;
+
+ data->DeviceMode.dmFields =
+ (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
+ DM_DISPLAYFLAGS);
+
+ if (index == ENUM_CURRENT_SETTINGS
+ && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
+ char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
+ LPBITMAPINFO bmi;
+ HBITMAP hbm;
+ int logical_width = GetDeviceCaps( hdc, HORZRES );
+ int logical_height = GetDeviceCaps( hdc, VERTRES );
+
+ mode->w = logical_width;
+ mode->h = logical_height;
+
+ SDL_zero(bmi_data);
+ bmi = (LPBITMAPINFO) bmi_data;
+ bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+
+ hbm = CreateCompatibleBitmap(hdc, 1, 1);
+ GetDIBits(hdc, hbm, 0, 1, NULL, bmi, DIB_RGB_COLORS);
+ GetDIBits(hdc, hbm, 0, 1, NULL, bmi, DIB_RGB_COLORS);
+ DeleteObject(hbm);
+ DeleteDC(hdc);
+ if (bmi->bmiHeader.biCompression == BI_BITFIELDS) {
+ switch (*(Uint32 *) bmi->bmiColors) {
+ case 0x00FF0000:
+ mode->format = SDL_PIXELFORMAT_RGB888;
+ break;
+ case 0x000000FF:
+ mode->format = SDL_PIXELFORMAT_BGR888;
+ break;
+ case 0xF800:
+ mode->format = SDL_PIXELFORMAT_RGB565;
+ break;
+ case 0x7C00:
+ mode->format = SDL_PIXELFORMAT_RGB555;
+ break;
+ }
+ } else if (bmi->bmiHeader.biBitCount == 8) {
+ mode->format = SDL_PIXELFORMAT_INDEX8;
+ } else if (bmi->bmiHeader.biBitCount == 4) {
+ mode->format = SDL_PIXELFORMAT_INDEX4LSB;
+ }
+ } else if (mode->format == SDL_PIXELFORMAT_UNKNOWN) {
+ /* FIXME: Can we tell what this will be? */
+ if ((data->DeviceMode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) {
+ switch (data->DeviceMode.dmBitsPerPel) {
+ case 32:
+ mode->format = SDL_PIXELFORMAT_RGB888;
+ break;
+ case 24:
+ mode->format = SDL_PIXELFORMAT_RGB24;
+ break;
+ case 16:
+ mode->format = SDL_PIXELFORMAT_RGB565;
+ break;
+ case 15:
+ mode->format = SDL_PIXELFORMAT_RGB555;
+ break;
+ case 8:
+ mode->format = SDL_PIXELFORMAT_INDEX8;
+ break;
+ case 4:
+ mode->format = SDL_PIXELFORMAT_INDEX4LSB;
+ break;
+ }
+ }
+ }
+}
+
+static SDL_bool
+WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
+{
+ SDL_DisplayModeData *data;
+ DEVMODE devmode;
+
+ devmode.dmSize = sizeof(devmode);
+ devmode.dmDriverExtra = 0;
+ if (!EnumDisplaySettings(deviceName, index, &devmode)) {
+ return SDL_FALSE;
+ }
+
+ data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
+ if (!data) {
+ return SDL_FALSE;
+ }
+
+ mode->driverdata = data;
+ data->DeviceMode = devmode;
+
+ mode->format = SDL_PIXELFORMAT_UNKNOWN;
+ mode->w = data->DeviceMode.dmPelsWidth;
+ mode->h = data->DeviceMode.dmPelsHeight;
+ mode->refresh_rate = data->DeviceMode.dmDisplayFrequency;
+
+ /* Fill in the mode information */
+ WIN_UpdateDisplayMode(_this, deviceName, index, mode);
+ return SDL_TRUE;
+}
+
+static SDL_bool
+WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEX *info)
+{
+ SDL_VideoDisplay display;
+ SDL_DisplayData *displaydata;
+ SDL_DisplayMode mode;
+ DISPLAY_DEVICE device;
+
+#ifdef DEBUG_MODES
+ SDL_Log("Display: %s\n", WIN_StringToUTF8(info->szDevice));
+#endif
+
+ if (!WIN_GetDisplayMode(_this, info->szDevice, ENUM_CURRENT_SETTINGS, &mode)) {
+ return SDL_FALSE;
+ }
+
+ displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
+ if (!displaydata) {
+ return SDL_FALSE;
+ }
+ SDL_memcpy(displaydata->DeviceName, info->szDevice,
+ sizeof(displaydata->DeviceName));
+ displaydata->MonitorHandle = hMonitor;
+
+ SDL_zero(display);
+ device.cb = sizeof(device);
+ if (EnumDisplayDevices(info->szDevice, 0, &device, 0)) {
+ display.name = WIN_StringToUTF8(device.DeviceString);
+ }
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ display.driverdata = displaydata;
+ SDL_AddVideoDisplay(&display);
+ SDL_free(display.name);
+ return SDL_TRUE;
+}
+
+typedef struct _WIN_AddDisplaysData {
+ SDL_VideoDevice *video_device;
+ SDL_bool want_primary;
+} WIN_AddDisplaysData;
+
+static BOOL CALLBACK
+WIN_AddDisplaysCallback(HMONITOR hMonitor,
+ HDC hdcMonitor,
+ LPRECT lprcMonitor,
+ LPARAM dwData)
+{
+ WIN_AddDisplaysData *data = (WIN_AddDisplaysData*)dwData;
+ MONITORINFOEX info;
+
+ SDL_zero(info);
+ info.cbSize = sizeof(info);
+
+ if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&info) != 0) {
+ const SDL_bool is_primary = ((info.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY);
+
+ if (is_primary == data->want_primary) {
+ WIN_AddDisplay(data->video_device, hMonitor, &info);
+ }
+ }
+
+ // continue enumeration
+ return TRUE;
+}
+
+static void
+WIN_AddDisplays(_THIS)
+{
+ WIN_AddDisplaysData callback_data;
+ callback_data.video_device = _this;
+
+ callback_data.want_primary = SDL_TRUE;
+ EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data);
+
+ callback_data.want_primary = SDL_FALSE;
+ EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data);
+}
+
+int
+WIN_InitModes(_THIS)
+{
+ WIN_AddDisplays(_this);
+
+ if (_this->num_displays == 0) {
+ return SDL_SetError("No displays available");
+ }
+ return 0;
+}
+
+int
+WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
+{
+ const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata;
+ MONITORINFO minfo;
+ BOOL rc;
+
+ SDL_zero(minfo);
+ minfo.cbSize = sizeof(MONITORINFO);
+ rc = GetMonitorInfo(data->MonitorHandle, &minfo);
+
+ if (!rc) {
+ return SDL_SetError("Couldn't find monitor data");
+ }
+
+ rect->x = minfo.rcMonitor.left;
+ rect->y = minfo.rcMonitor.top;
+ rect->w = minfo.rcMonitor.right - minfo.rcMonitor.left;
+ rect->h = minfo.rcMonitor.bottom - minfo.rcMonitor.top;
+
+ return 0;
+}
+
+int
+WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out)
+{
+ const SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
+ const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata;
+ float hdpi = 0, vdpi = 0, ddpi = 0;
+
+ if (videodata->GetDpiForMonitor) {
+ UINT hdpi_uint, vdpi_uint;
+ // Windows 8.1+ codepath
+ if (videodata->GetDpiForMonitor(displaydata->MonitorHandle, MDT_EFFECTIVE_DPI, &hdpi_uint, &vdpi_uint) == S_OK) {
+ // GetDpiForMonitor docs promise to return the same hdpi/vdpi
+ hdpi = (float)hdpi_uint;
+ vdpi = (float)hdpi_uint;
+ ddpi = (float)hdpi_uint;
+ } else {
+ return SDL_SetError("GetDpiForMonitor failed");
+ }
+ } else {
+ // Window 8.0 and below: same DPI for all monitors.
+ HDC hdc;
+ int hdpi_int, vdpi_int, hpoints, vpoints, hpix, vpix;
+ float hinches, vinches;
+
+ hdc = GetDC(NULL);
+ if (hdc == NULL) {
+ return SDL_SetError("GetDC failed");
+ }
+ hdpi_int = GetDeviceCaps(hdc, LOGPIXELSX);
+ vdpi_int = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+
+ hpoints = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ vpoints = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+
+ hpix = MulDiv(hpoints, hdpi_int, 96);
+ vpix = MulDiv(vpoints, vdpi_int, 96);
+
+ hinches = (float)hpoints / 96.0f;
+ vinches = (float)vpoints / 96.0f;
+
+ hdpi = (float)hdpi_int;
+ vdpi = (float)vdpi_int;
+ ddpi = SDL_ComputeDiagonalDPI(hpix, vpix, hinches, vinches);
+ }
+
+ if (ddpi_out) {
+ *ddpi_out = ddpi;
+ }
+ if (hdpi_out) {
+ *hdpi_out = hdpi;
+ }
+ if (vdpi_out) {
+ *vdpi_out = vdpi;
+ }
+
+ return ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI");
+}
+
+int
+WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
+{
+ const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata;
+ MONITORINFO minfo;
+ BOOL rc;
+
+ SDL_zero(minfo);
+ minfo.cbSize = sizeof(MONITORINFO);
+ rc = GetMonitorInfo(data->MonitorHandle, &minfo);
+
+ if (!rc) {
+ return SDL_SetError("Couldn't find monitor data");
+ }
+
+ rect->x = minfo.rcWork.left;
+ rect->y = minfo.rcWork.top;
+ rect->w = minfo.rcWork.right - minfo.rcWork.left;
+ rect->h = minfo.rcWork.bottom - minfo.rcWork.top;
+
+ return 0;
+}
+
+void
+WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+ SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
+ DWORD i;
+ SDL_DisplayMode mode;
+
+ for (i = 0;; ++i) {
+ if (!WIN_GetDisplayMode(_this, data->DeviceName, i, &mode)) {
+ break;
+ }
+ if (SDL_ISPIXELFORMAT_INDEXED(mode.format)) {
+ /* We don't support palettized modes now */
+ SDL_free(mode.driverdata);
+ continue;
+ }
+ if (mode.format != SDL_PIXELFORMAT_UNKNOWN) {
+ if (!SDL_AddDisplayMode(display, &mode)) {
+ SDL_free(mode.driverdata);
+ }
+ } else {
+ SDL_free(mode.driverdata);
+ }
+ }
+}
+
+int
+WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
+ SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
+ LONG status;
+
+ if (mode->driverdata == display->desktop_mode.driverdata) {
+ status = ChangeDisplaySettingsEx(displaydata->DeviceName, NULL, NULL, CDS_FULLSCREEN, NULL);
+ } else {
+ status = ChangeDisplaySettingsEx(displaydata->DeviceName, &data->DeviceMode, NULL, CDS_FULLSCREEN, NULL);
+ }
+ if (status != DISP_CHANGE_SUCCESSFUL) {
+ const char *reason = "Unknown reason";
+ switch (status) {
+ case DISP_CHANGE_BADFLAGS:
+ reason = "DISP_CHANGE_BADFLAGS";
+ break;
+ case DISP_CHANGE_BADMODE:
+ reason = "DISP_CHANGE_BADMODE";
+ break;
+ case DISP_CHANGE_BADPARAM:
+ reason = "DISP_CHANGE_BADPARAM";
+ break;
+ case DISP_CHANGE_FAILED:
+ reason = "DISP_CHANGE_FAILED";
+ break;
+ }
+ return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason);
+ }
+ EnumDisplaySettings(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode);
+ WIN_UpdateDisplayMode(_this, displaydata->DeviceName, ENUM_CURRENT_SETTINGS, mode);
+ return 0;
+}
+
+void
+WIN_QuitModes(_THIS)
+{
+ /* All fullscreen windows should have restored modes by now */
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.h
new file mode 100644
index 0000000..a5c19b7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmodes.h
@@ -0,0 +1,47 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsmodes_h_
+#define SDL_windowsmodes_h_
+
+typedef struct
+{
+ TCHAR DeviceName[32];
+ HMONITOR MonitorHandle;
+} SDL_DisplayData;
+
+typedef struct
+{
+ DEVMODE DeviceMode;
+} SDL_DisplayModeData;
+
+extern int WIN_InitModes(_THIS);
+extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+extern int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
+extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi);
+extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+extern void WIN_QuitModes(_THIS);
+
+#endif /* SDL_windowsmodes_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.c
new file mode 100644
index 0000000..1ddeae2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.c
@@ -0,0 +1,322 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_assert.h"
+#include "SDL_windowsvideo.h"
+
+#include "../../events/SDL_mouse_c.h"
+
+
+HCURSOR SDL_cursor = NULL;
+
+static int rawInputEnableCount = 0;
+
+static int
+ToggleRawInput(SDL_bool enabled)
+{
+ RAWINPUTDEVICE rawMouse = { 0x01, 0x02, 0, NULL }; /* Mouse: UsagePage = 1, Usage = 2 */
+
+ if (enabled) {
+ rawInputEnableCount++;
+ if (rawInputEnableCount > 1) {
+ return 0; /* already done. */
+ }
+ } else {
+ if (rawInputEnableCount == 0) {
+ return 0; /* already done. */
+ }
+ rawInputEnableCount--;
+ if (rawInputEnableCount > 0) {
+ return 0; /* not time to disable yet */
+ }
+ }
+
+ if (!enabled) {
+ rawMouse.dwFlags |= RIDEV_REMOVE;
+ }
+
+ /* (Un)register raw input for mice */
+ if (RegisterRawInputDevices(&rawMouse, 1, sizeof(RAWINPUTDEVICE)) == FALSE) {
+
+ /* Only return an error when registering. If we unregister and fail,
+ then it's probably that we unregistered twice. That's OK. */
+ if (enabled) {
+ return SDL_Unsupported();
+ }
+ }
+ return 0;
+}
+
+
+static SDL_Cursor *
+WIN_CreateDefaultCursor()
+{
+ SDL_Cursor *cursor;
+
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ cursor->driverdata = LoadCursor(NULL, IDC_ARROW);
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ /* msdn says cursor mask has to be padded out to word alignment. Not sure
+ if that means machine word or WORD, but this handles either case. */
+ const size_t pad = (sizeof (size_t) * 8); /* 32 or 64, or whatever. */
+ SDL_Cursor *cursor;
+ HICON hicon;
+ HDC hdc;
+ BITMAPV4HEADER bmh;
+ LPVOID pixels;
+ LPVOID maskbits;
+ size_t maskbitslen;
+ ICONINFO ii;
+
+ SDL_zero(bmh);
+ bmh.bV4Size = sizeof(bmh);
+ bmh.bV4Width = surface->w;
+ bmh.bV4Height = -surface->h; /* Invert the image */
+ bmh.bV4Planes = 1;
+ bmh.bV4BitCount = 32;
+ bmh.bV4V4Compression = BI_BITFIELDS;
+ bmh.bV4AlphaMask = 0xFF000000;
+ bmh.bV4RedMask = 0x00FF0000;
+ bmh.bV4GreenMask = 0x0000FF00;
+ bmh.bV4BlueMask = 0x000000FF;
+
+ maskbitslen = ((surface->w + (pad - (surface->w % pad))) / 8) * surface->h;
+ maskbits = SDL_stack_alloc(Uint8,maskbitslen);
+ if (maskbits == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* AND the cursor against full bits: no change. We already have alpha. */
+ SDL_memset(maskbits, 0xFF, maskbitslen);
+
+ hdc = GetDC(NULL);
+ SDL_zero(ii);
+ ii.fIcon = FALSE;
+ ii.xHotspot = (DWORD)hot_x;
+ ii.yHotspot = (DWORD)hot_y;
+ ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO*)&bmh, DIB_RGB_COLORS, &pixels, NULL, 0);
+ ii.hbmMask = CreateBitmap(surface->w, surface->h, 1, 1, maskbits);
+ ReleaseDC(NULL, hdc);
+ SDL_stack_free(maskbits);
+
+ SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+ SDL_assert(surface->pitch == surface->w * 4);
+ SDL_memcpy(pixels, surface->pixels, surface->h * surface->pitch);
+
+ hicon = CreateIconIndirect(&ii);
+
+ DeleteObject(ii.hbmColor);
+ DeleteObject(ii.hbmMask);
+
+ if (!hicon) {
+ WIN_SetError("CreateIconIndirect()");
+ return NULL;
+ }
+
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ cursor->driverdata = hicon;
+ } else {
+ DestroyIcon(hicon);
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+WIN_CreateSystemCursor(SDL_SystemCursor id)
+{
+ SDL_Cursor *cursor;
+ LPCTSTR name;
+
+ switch(id)
+ {
+ default:
+ SDL_assert(0);
+ return NULL;
+ case SDL_SYSTEM_CURSOR_ARROW: name = IDC_ARROW; break;
+ case SDL_SYSTEM_CURSOR_IBEAM: name = IDC_IBEAM; break;
+ case SDL_SYSTEM_CURSOR_WAIT: name = IDC_WAIT; break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR: name = IDC_CROSS; break;
+ case SDL_SYSTEM_CURSOR_WAITARROW: name = IDC_WAIT; break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE: name = IDC_SIZENWSE; break;
+ case SDL_SYSTEM_CURSOR_SIZENESW: name = IDC_SIZENESW; break;
+ case SDL_SYSTEM_CURSOR_SIZEWE: name = IDC_SIZEWE; break;
+ case SDL_SYSTEM_CURSOR_SIZENS: name = IDC_SIZENS; break;
+ case SDL_SYSTEM_CURSOR_SIZEALL: name = IDC_SIZEALL; break;
+ case SDL_SYSTEM_CURSOR_NO: name = IDC_NO; break;
+ case SDL_SYSTEM_CURSOR_HAND: name = IDC_HAND; break;
+ }
+
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ HICON hicon;
+
+ hicon = LoadCursor(NULL, name);
+
+ cursor->driverdata = hicon;
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static void
+WIN_FreeCursor(SDL_Cursor * cursor)
+{
+ HICON hicon = (HICON)cursor->driverdata;
+
+ DestroyIcon(hicon);
+ SDL_free(cursor);
+}
+
+static int
+WIN_ShowCursor(SDL_Cursor * cursor)
+{
+ if (cursor) {
+ SDL_cursor = (HCURSOR)cursor->driverdata;
+ } else {
+ SDL_cursor = NULL;
+ }
+ if (SDL_GetMouseFocus() != NULL) {
+ SetCursor(SDL_cursor);
+ }
+ return 0;
+}
+
+static void
+WIN_WarpMouse(SDL_Window * window, int x, int y)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ POINT pt;
+
+ /* Don't warp the mouse while we're doing a modal interaction */
+ if (data->in_title_click || data->focus_click_pending) {
+ return;
+ }
+
+ pt.x = x;
+ pt.y = y;
+ ClientToScreen(hwnd, &pt);
+ SetCursorPos(pt.x, pt.y);
+}
+
+static int
+WIN_WarpMouseGlobal(int x, int y)
+{
+ POINT pt;
+
+ pt.x = x;
+ pt.y = y;
+ SetCursorPos(pt.x, pt.y);
+ return 0;
+}
+
+static int
+WIN_SetRelativeMouseMode(SDL_bool enabled)
+{
+ return ToggleRawInput(enabled);
+}
+
+static int
+WIN_CaptureMouse(SDL_Window *window)
+{
+ if (!window) {
+ SDL_Window *focusWin = SDL_GetKeyboardFocus();
+ if (focusWin) {
+ WIN_OnWindowEnter(SDL_GetVideoDevice(), focusWin); /* make sure WM_MOUSELEAVE messages are (re)enabled. */
+ }
+ }
+
+ /* While we were thinking of SetCapture() when designing this API in SDL,
+ we didn't count on the fact that SetCapture() only tracks while the
+ left mouse button is held down! Instead, we listen for raw mouse input
+ and manually query the mouse when it leaves the window. :/ */
+ return ToggleRawInput(window != NULL);
+}
+
+static Uint32
+WIN_GetGlobalMouseState(int *x, int *y)
+{
+ Uint32 retval = 0;
+ POINT pt = { 0, 0 };
+ GetCursorPos(&pt);
+ *x = (int) pt.x;
+ *y = (int) pt.y;
+
+ retval |= GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_BUTTON_LMASK : 0;
+ retval |= GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_BUTTON_RMASK : 0;
+ retval |= GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_BUTTON_MMASK : 0;
+ retval |= GetAsyncKeyState(VK_XBUTTON1) & 0x8000 ? SDL_BUTTON_X1MASK : 0;
+ retval |= GetAsyncKeyState(VK_XBUTTON2) & 0x8000 ? SDL_BUTTON_X2MASK : 0;
+
+ return retval;
+}
+
+void
+WIN_InitMouse(_THIS)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = WIN_CreateCursor;
+ mouse->CreateSystemCursor = WIN_CreateSystemCursor;
+ mouse->ShowCursor = WIN_ShowCursor;
+ mouse->FreeCursor = WIN_FreeCursor;
+ mouse->WarpMouse = WIN_WarpMouse;
+ mouse->WarpMouseGlobal = WIN_WarpMouseGlobal;
+ mouse->SetRelativeMouseMode = WIN_SetRelativeMouseMode;
+ mouse->CaptureMouse = WIN_CaptureMouse;
+ mouse->GetGlobalMouseState = WIN_GetGlobalMouseState;
+
+ SDL_SetDefaultCursor(WIN_CreateDefaultCursor());
+
+ SDL_SetDoubleClickTime(GetDoubleClickTime());
+}
+
+void
+WIN_QuitMouse(_THIS)
+{
+ if (rawInputEnableCount) { /* force RAWINPUT off here. */
+ rawInputEnableCount = 1;
+ ToggleRawInput(SDL_FALSE);
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.h
new file mode 100644
index 0000000..775c32c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsmouse.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsmouse_h_
+#define SDL_windowsmouse_h_
+
+extern HCURSOR SDL_cursor;
+
+extern void WIN_InitMouse(_THIS);
+extern void WIN_QuitMouse(_THIS);
+
+#endif /* SDL_windowsmouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.c
new file mode 100644
index 0000000..c3ba56c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.c
@@ -0,0 +1,895 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_assert.h"
+#include "SDL_loadso.h"
+#include "SDL_windowsvideo.h"
+#include "SDL_windowsopengles.h"
+#include "SDL_hints.h"
+
+/* WGL implementation of SDL OpenGL support */
+
+#if SDL_VIDEO_OPENGL_WGL
+#include "SDL_opengl.h"
+
+#define DEFAULT_OPENGL "OPENGL32.DLL"
+
+#ifndef WGL_ARB_create_context
+#define WGL_ARB_create_context
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+
+#ifndef WGL_ARB_create_context_profile
+#define WGL_ARB_create_context_profile
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#endif
+
+#ifndef WGL_ARB_create_context_robustness
+#define WGL_ARB_create_context_robustness
+#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
+#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#endif
+#endif
+
+#ifndef WGL_EXT_create_context_es2_profile
+#define WGL_EXT_create_context_es2_profile
+#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#endif
+
+#ifndef WGL_EXT_create_context_es_profile
+#define WGL_EXT_create_context_es_profile
+#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
+#endif
+
+#ifndef WGL_ARB_framebuffer_sRGB
+#define WGL_ARB_framebuffer_sRGB
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
+#endif
+
+#ifndef WGL_ARB_context_flush_control
+#define WGL_ARB_context_flush_control
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+#endif
+
+#ifndef WGL_ARB_create_context_no_error
+#define WGL_ARB_create_context_no_error
+#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
+#endif
+
+typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC,
+ HGLRC
+ hShareContext,
+ const int
+ *attribList);
+
+int
+WIN_GL_LoadLibrary(_THIS, const char *path)
+{
+ void *handle;
+
+ if (path == NULL) {
+ path = SDL_getenv("SDL_OPENGL_LIBRARY");
+ }
+ if (path == NULL) {
+ path = DEFAULT_OPENGL;
+ }
+ _this->gl_config.dll_handle = SDL_LoadObject(path);
+ if (!_this->gl_config.dll_handle) {
+ return -1;
+ }
+ SDL_strlcpy(_this->gl_config.driver_path, path,
+ SDL_arraysize(_this->gl_config.driver_path));
+
+ /* Allocate OpenGL memory */
+ _this->gl_data = (struct SDL_GLDriverData *) SDL_calloc(1, sizeof(struct SDL_GLDriverData));
+ if (!_this->gl_data) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Load function pointers */
+ handle = _this->gl_config.dll_handle;
+ _this->gl_data->wglGetProcAddress = (void *(WINAPI *) (const char *))
+ SDL_LoadFunction(handle, "wglGetProcAddress");
+ _this->gl_data->wglCreateContext = (HGLRC(WINAPI *) (HDC))
+ SDL_LoadFunction(handle, "wglCreateContext");
+ _this->gl_data->wglDeleteContext = (BOOL(WINAPI *) (HGLRC))
+ SDL_LoadFunction(handle, "wglDeleteContext");
+ _this->gl_data->wglMakeCurrent = (BOOL(WINAPI *) (HDC, HGLRC))
+ SDL_LoadFunction(handle, "wglMakeCurrent");
+ _this->gl_data->wglShareLists = (BOOL(WINAPI *) (HGLRC, HGLRC))
+ SDL_LoadFunction(handle, "wglShareLists");
+
+ if (!_this->gl_data->wglGetProcAddress ||
+ !_this->gl_data->wglCreateContext ||
+ !_this->gl_data->wglDeleteContext ||
+ !_this->gl_data->wglMakeCurrent) {
+ return SDL_SetError("Could not retrieve OpenGL functions");
+ }
+
+ /* XXX Too sleazy? WIN_GL_InitExtensions looks for certain OpenGL
+ extensions via SDL_GL_DeduceMaxSupportedESProfile. This uses
+ SDL_GL_ExtensionSupported which in turn calls SDL_GL_GetProcAddress.
+ However SDL_GL_GetProcAddress will fail if the library is not
+ loaded; it checks for gl_config.driver_loaded > 0. To avoid this
+ test failing, increment driver_loaded around the call to
+ WIN_GLInitExtensions.
+
+ Successful loading of the library is normally indicated by
+ SDL_GL_LoadLibrary incrementing driver_loaded immediately after
+ this function returns 0 to it.
+
+ Alternatives to this are:
+ - moving SDL_GL_DeduceMaxSupportedESProfile to both the WIN and
+ X11 platforms while adding a function equivalent to
+ SDL_GL_ExtensionSupported but which directly calls
+ glGetProcAddress(). Having 3 copies of the
+ SDL_GL_ExtensionSupported makes this alternative unattractive.
+ - moving SDL_GL_DeduceMaxSupportedESProfile to a new file shared
+ by the WIN and X11 platforms while adding a function equivalent
+ to SDL_GL_ExtensionSupported. This is unattractive due to the
+ number of project files that will need updating, plus there
+ will be 2 copies of the SDL_GL_ExtensionSupported code.
+ - Add a private equivalent of SDL_GL_ExtensionSupported to
+ SDL_video.c.
+ - Move the call to WIN_GL_InitExtensions back to WIN_CreateWindow
+ and add a flag to gl_data to avoid multiple calls to this
+ expensive function. This is probably the least objectionable
+ alternative if this increment/decrement trick is unacceptable.
+
+ Note that the driver_loaded > 0 check needs to remain in
+ SDL_GL_ExtensionSupported and SDL_GL_GetProcAddress as they are
+ public API functions.
+ */
+ ++_this->gl_config.driver_loaded;
+ WIN_GL_InitExtensions(_this);
+ --_this->gl_config.driver_loaded;
+
+ return 0;
+}
+
+void *
+WIN_GL_GetProcAddress(_THIS, const char *proc)
+{
+ void *func;
+
+ /* This is to pick up extensions */
+ func = _this->gl_data->wglGetProcAddress(proc);
+ if (!func) {
+ /* This is probably a normal GL function */
+ func = GetProcAddress(_this->gl_config.dll_handle, proc);
+ }
+ return func;
+}
+
+void
+WIN_GL_UnloadLibrary(_THIS)
+{
+ SDL_UnloadObject(_this->gl_config.dll_handle);
+ _this->gl_config.dll_handle = NULL;
+
+ /* Free OpenGL memory */
+ SDL_free(_this->gl_data);
+ _this->gl_data = NULL;
+}
+
+static void
+WIN_GL_SetupPixelFormat(_THIS, PIXELFORMATDESCRIPTOR * pfd)
+{
+ SDL_zerop(pfd);
+ pfd->nSize = sizeof(*pfd);
+ pfd->nVersion = 1;
+ pfd->dwFlags = (PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL);
+ if (_this->gl_config.double_buffer) {
+ pfd->dwFlags |= PFD_DOUBLEBUFFER;
+ }
+ if (_this->gl_config.stereo) {
+ pfd->dwFlags |= PFD_STEREO;
+ }
+ pfd->iLayerType = PFD_MAIN_PLANE;
+ pfd->iPixelType = PFD_TYPE_RGBA;
+ pfd->cRedBits = _this->gl_config.red_size;
+ pfd->cGreenBits = _this->gl_config.green_size;
+ pfd->cBlueBits = _this->gl_config.blue_size;
+ pfd->cAlphaBits = _this->gl_config.alpha_size;
+ if (_this->gl_config.buffer_size) {
+ pfd->cColorBits =
+ _this->gl_config.buffer_size - _this->gl_config.alpha_size;
+ } else {
+ pfd->cColorBits = (pfd->cRedBits + pfd->cGreenBits + pfd->cBlueBits);
+ }
+ pfd->cAccumRedBits = _this->gl_config.accum_red_size;
+ pfd->cAccumGreenBits = _this->gl_config.accum_green_size;
+ pfd->cAccumBlueBits = _this->gl_config.accum_blue_size;
+ pfd->cAccumAlphaBits = _this->gl_config.accum_alpha_size;
+ pfd->cAccumBits =
+ (pfd->cAccumRedBits + pfd->cAccumGreenBits + pfd->cAccumBlueBits +
+ pfd->cAccumAlphaBits);
+ pfd->cDepthBits = _this->gl_config.depth_size;
+ pfd->cStencilBits = _this->gl_config.stencil_size;
+}
+
+/* Choose the closest pixel format that meets or exceeds the target.
+ FIXME: Should we weight any particular attribute over any other?
+*/
+static int
+WIN_GL_ChoosePixelFormat(HDC hdc, PIXELFORMATDESCRIPTOR * target)
+{
+ PIXELFORMATDESCRIPTOR pfd;
+ int count, index, best = 0;
+ unsigned int dist, best_dist = ~0U;
+
+ count = DescribePixelFormat(hdc, 1, sizeof(pfd), NULL);
+
+ for (index = 1; index <= count; index++) {
+
+ if (!DescribePixelFormat(hdc, index, sizeof(pfd), &pfd)) {
+ continue;
+ }
+
+ if ((pfd.dwFlags & target->dwFlags) != target->dwFlags) {
+ continue;
+ }
+
+ if (pfd.iLayerType != target->iLayerType) {
+ continue;
+ }
+ if (pfd.iPixelType != target->iPixelType) {
+ continue;
+ }
+
+ dist = 0;
+
+ if (pfd.cColorBits < target->cColorBits) {
+ continue;
+ } else {
+ dist += (pfd.cColorBits - target->cColorBits);
+ }
+ if (pfd.cRedBits < target->cRedBits) {
+ continue;
+ } else {
+ dist += (pfd.cRedBits - target->cRedBits);
+ }
+ if (pfd.cGreenBits < target->cGreenBits) {
+ continue;
+ } else {
+ dist += (pfd.cGreenBits - target->cGreenBits);
+ }
+ if (pfd.cBlueBits < target->cBlueBits) {
+ continue;
+ } else {
+ dist += (pfd.cBlueBits - target->cBlueBits);
+ }
+ if (pfd.cAlphaBits < target->cAlphaBits) {
+ continue;
+ } else {
+ dist += (pfd.cAlphaBits - target->cAlphaBits);
+ }
+ if (pfd.cAccumBits < target->cAccumBits) {
+ continue;
+ } else {
+ dist += (pfd.cAccumBits - target->cAccumBits);
+ }
+ if (pfd.cAccumRedBits < target->cAccumRedBits) {
+ continue;
+ } else {
+ dist += (pfd.cAccumRedBits - target->cAccumRedBits);
+ }
+ if (pfd.cAccumGreenBits < target->cAccumGreenBits) {
+ continue;
+ } else {
+ dist += (pfd.cAccumGreenBits - target->cAccumGreenBits);
+ }
+ if (pfd.cAccumBlueBits < target->cAccumBlueBits) {
+ continue;
+ } else {
+ dist += (pfd.cAccumBlueBits - target->cAccumBlueBits);
+ }
+ if (pfd.cAccumAlphaBits < target->cAccumAlphaBits) {
+ continue;
+ } else {
+ dist += (pfd.cAccumAlphaBits - target->cAccumAlphaBits);
+ }
+ if (pfd.cDepthBits < target->cDepthBits) {
+ continue;
+ } else {
+ dist += (pfd.cDepthBits - target->cDepthBits);
+ }
+ if (pfd.cStencilBits < target->cStencilBits) {
+ continue;
+ } else {
+ dist += (pfd.cStencilBits - target->cStencilBits);
+ }
+
+ if (dist < best_dist) {
+ best = index;
+ best_dist = dist;
+ }
+ }
+
+ return best;
+}
+
+static SDL_bool
+HasExtension(const char *extension, const char *extensions)
+{
+ const char *start;
+ const char *where, *terminator;
+
+ /* Extension names should not have spaces. */
+ where = SDL_strchr(extension, ' ');
+ if (where || *extension == '\0')
+ return SDL_FALSE;
+
+ if (!extensions)
+ return SDL_FALSE;
+
+ /* It takes a bit of care to be fool-proof about parsing the
+ * OpenGL extensions string. Don't be fooled by sub-strings,
+ * etc. */
+
+ start = extensions;
+
+ for (;;) {
+ where = SDL_strstr(start, extension);
+ if (!where)
+ break;
+
+ terminator = where + SDL_strlen(extension);
+ if (where == start || *(where - 1) == ' ')
+ if (*terminator == ' ' || *terminator == '\0')
+ return SDL_TRUE;
+
+ start = terminator;
+ }
+ return SDL_FALSE;
+}
+
+void
+WIN_GL_InitExtensions(_THIS)
+{
+ const char *(WINAPI * wglGetExtensionsStringARB) (HDC) = 0;
+ const char *extensions;
+ HWND hwnd;
+ HDC hdc;
+ HGLRC hglrc;
+ PIXELFORMATDESCRIPTOR pfd;
+
+ if (!_this->gl_data) {
+ return;
+ }
+
+ hwnd =
+ CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0,
+ 10, 10, NULL, NULL, SDL_Instance, NULL);
+ if (!hwnd) {
+ return;
+ }
+ WIN_PumpEvents(_this);
+
+ hdc = GetDC(hwnd);
+
+ WIN_GL_SetupPixelFormat(_this, &pfd);
+
+ SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd);
+
+ hglrc = _this->gl_data->wglCreateContext(hdc);
+ if (!hglrc) {
+ return;
+ }
+ _this->gl_data->wglMakeCurrent(hdc, hglrc);
+
+ wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC))
+ _this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB");
+ if (wglGetExtensionsStringARB) {
+ extensions = wglGetExtensionsStringARB(hdc);
+ } else {
+ extensions = NULL;
+ }
+
+ /* Check for WGL_ARB_pixel_format */
+ _this->gl_data->HAS_WGL_ARB_pixel_format = SDL_FALSE;
+ if (HasExtension("WGL_ARB_pixel_format", extensions)) {
+ _this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *)
+ (HDC, const int *,
+ const FLOAT *, UINT,
+ int *, UINT *))
+ WIN_GL_GetProcAddress(_this, "wglChoosePixelFormatARB");
+ _this->gl_data->wglGetPixelFormatAttribivARB =
+ (BOOL(WINAPI *) (HDC, int, int, UINT, const int *, int *))
+ WIN_GL_GetProcAddress(_this, "wglGetPixelFormatAttribivARB");
+
+ if ((_this->gl_data->wglChoosePixelFormatARB != NULL) &&
+ (_this->gl_data->wglGetPixelFormatAttribivARB != NULL)) {
+ _this->gl_data->HAS_WGL_ARB_pixel_format = SDL_TRUE;
+ }
+ }
+
+ /* Check for WGL_EXT_swap_control */
+ _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE;
+ if (HasExtension("WGL_EXT_swap_control", extensions)) {
+ _this->gl_data->wglSwapIntervalEXT =
+ WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT");
+ _this->gl_data->wglGetSwapIntervalEXT =
+ WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT");
+ if (HasExtension("WGL_EXT_swap_control_tear", extensions)) {
+ _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE;
+ }
+ } else {
+ _this->gl_data->wglSwapIntervalEXT = NULL;
+ _this->gl_data->wglGetSwapIntervalEXT = NULL;
+ }
+
+ /* Check for WGL_EXT_create_context_es2_profile */
+ if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) {
+ SDL_GL_DeduceMaxSupportedESProfile(
+ &_this->gl_data->es_profile_max_supported_version.major,
+ &_this->gl_data->es_profile_max_supported_version.minor
+ );
+ }
+
+ /* Check for WGL_ARB_context_flush_control */
+ if (HasExtension("WGL_ARB_context_flush_control", extensions)) {
+ _this->gl_data->HAS_WGL_ARB_context_flush_control = SDL_TRUE;
+ }
+
+ /* Check for WGL_ARB_create_context_robustness */
+ if (HasExtension("WGL_ARB_create_context_robustness", extensions)) {
+ _this->gl_data->HAS_WGL_ARB_create_context_robustness = SDL_TRUE;
+ }
+
+ /* Check for WGL_ARB_create_context_no_error */
+ if (HasExtension("WGL_ARB_create_context_no_error", extensions)) {
+ _this->gl_data->HAS_WGL_ARB_create_context_no_error = SDL_TRUE;
+ }
+
+ _this->gl_data->wglMakeCurrent(hdc, NULL);
+ _this->gl_data->wglDeleteContext(hglrc);
+ ReleaseDC(hwnd, hdc);
+ DestroyWindow(hwnd);
+ WIN_PumpEvents(_this);
+}
+
+static int
+WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
+{
+ HWND hwnd;
+ HDC hdc;
+ PIXELFORMATDESCRIPTOR pfd;
+ HGLRC hglrc;
+ int pixel_format = 0;
+ unsigned int matching;
+
+ hwnd =
+ CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0,
+ 10, 10, NULL, NULL, SDL_Instance, NULL);
+ WIN_PumpEvents(_this);
+
+ hdc = GetDC(hwnd);
+
+ WIN_GL_SetupPixelFormat(_this, &pfd);
+
+ SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd);
+
+ hglrc = _this->gl_data->wglCreateContext(hdc);
+ if (hglrc) {
+ _this->gl_data->wglMakeCurrent(hdc, hglrc);
+
+ if (_this->gl_data->HAS_WGL_ARB_pixel_format) {
+ _this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs,
+ 1, &pixel_format,
+ &matching);
+ }
+
+ _this->gl_data->wglMakeCurrent(hdc, NULL);
+ _this->gl_data->wglDeleteContext(hglrc);
+ }
+ ReleaseDC(hwnd, hdc);
+ DestroyWindow(hwnd);
+ WIN_PumpEvents(_this);
+
+ return pixel_format;
+}
+
+/* actual work of WIN_GL_SetupWindow() happens here. */
+static int
+WIN_GL_SetupWindowInternal(_THIS, SDL_Window * window)
+{
+ HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
+ PIXELFORMATDESCRIPTOR pfd;
+ int pixel_format = 0;
+ int iAttribs[64];
+ int *iAttr;
+ int *iAccelAttr;
+ float fAttribs[1] = { 0 };
+
+ WIN_GL_SetupPixelFormat(_this, &pfd);
+
+ /* setup WGL_ARB_pixel_format attribs */
+ iAttr = &iAttribs[0];
+
+ *iAttr++ = WGL_DRAW_TO_WINDOW_ARB;
+ *iAttr++ = GL_TRUE;
+ *iAttr++ = WGL_RED_BITS_ARB;
+ *iAttr++ = _this->gl_config.red_size;
+ *iAttr++ = WGL_GREEN_BITS_ARB;
+ *iAttr++ = _this->gl_config.green_size;
+ *iAttr++ = WGL_BLUE_BITS_ARB;
+ *iAttr++ = _this->gl_config.blue_size;
+
+ if (_this->gl_config.alpha_size) {
+ *iAttr++ = WGL_ALPHA_BITS_ARB;
+ *iAttr++ = _this->gl_config.alpha_size;
+ }
+
+ *iAttr++ = WGL_DOUBLE_BUFFER_ARB;
+ *iAttr++ = _this->gl_config.double_buffer;
+
+ *iAttr++ = WGL_DEPTH_BITS_ARB;
+ *iAttr++ = _this->gl_config.depth_size;
+
+ if (_this->gl_config.stencil_size) {
+ *iAttr++ = WGL_STENCIL_BITS_ARB;
+ *iAttr++ = _this->gl_config.stencil_size;
+ }
+
+ if (_this->gl_config.accum_red_size) {
+ *iAttr++ = WGL_ACCUM_RED_BITS_ARB;
+ *iAttr++ = _this->gl_config.accum_red_size;
+ }
+
+ if (_this->gl_config.accum_green_size) {
+ *iAttr++ = WGL_ACCUM_GREEN_BITS_ARB;
+ *iAttr++ = _this->gl_config.accum_green_size;
+ }
+
+ if (_this->gl_config.accum_blue_size) {
+ *iAttr++ = WGL_ACCUM_BLUE_BITS_ARB;
+ *iAttr++ = _this->gl_config.accum_blue_size;
+ }
+
+ if (_this->gl_config.accum_alpha_size) {
+ *iAttr++ = WGL_ACCUM_ALPHA_BITS_ARB;
+ *iAttr++ = _this->gl_config.accum_alpha_size;
+ }
+
+ if (_this->gl_config.stereo) {
+ *iAttr++ = WGL_STEREO_ARB;
+ *iAttr++ = GL_TRUE;
+ }
+
+ if (_this->gl_config.multisamplebuffers) {
+ *iAttr++ = WGL_SAMPLE_BUFFERS_ARB;
+ *iAttr++ = _this->gl_config.multisamplebuffers;
+ }
+
+ if (_this->gl_config.multisamplesamples) {
+ *iAttr++ = WGL_SAMPLES_ARB;
+ *iAttr++ = _this->gl_config.multisamplesamples;
+ }
+
+ if (_this->gl_config.framebuffer_srgb_capable) {
+ *iAttr++ = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB;
+ *iAttr++ = _this->gl_config.framebuffer_srgb_capable;
+ }
+
+ /* We always choose either FULL or NO accel on Windows, because of flaky
+ drivers. If the app didn't specify, we use FULL, because that's
+ probably what they wanted (and if you didn't care and got FULL, that's
+ a perfectly valid result in any case). */
+ *iAttr++ = WGL_ACCELERATION_ARB;
+ iAccelAttr = iAttr;
+ if (_this->gl_config.accelerated) {
+ *iAttr++ = WGL_FULL_ACCELERATION_ARB;
+ } else {
+ *iAttr++ = WGL_NO_ACCELERATION_ARB;
+ }
+
+ *iAttr = 0;
+
+ /* Choose and set the closest available pixel format */
+ pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
+
+ /* App said "don't care about accel" and FULL accel failed. Try NO. */
+ if ( ( !pixel_format ) && ( _this->gl_config.accelerated < 0 ) ) {
+ *iAccelAttr = WGL_NO_ACCELERATION_ARB;
+ pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
+ *iAccelAttr = WGL_FULL_ACCELERATION_ARB; /* if we try again. */
+ }
+ if (!pixel_format) {
+ pixel_format = WIN_GL_ChoosePixelFormat(hdc, &pfd);
+ }
+ if (!pixel_format) {
+ return SDL_SetError("No matching GL pixel format available");
+ }
+ if (!SetPixelFormat(hdc, pixel_format, &pfd)) {
+ return WIN_SetError("SetPixelFormat()");
+ }
+ return 0;
+}
+
+int
+WIN_GL_SetupWindow(_THIS, SDL_Window * window)
+{
+ /* The current context is lost in here; save it and reset it. */
+ SDL_Window *current_win = SDL_GL_GetCurrentWindow();
+ SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
+ const int retval = WIN_GL_SetupWindowInternal(_this, window);
+ WIN_GL_MakeCurrent(_this, current_win, current_ctx);
+ return retval;
+}
+
+SDL_bool
+WIN_GL_UseEGL(_THIS)
+{
+ SDL_assert(_this->gl_data != NULL);
+ SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
+
+ return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE)
+ || _this->gl_config.major_version == 1 /* No WGL extension for OpenGL ES 1.x profiles. */
+ || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major
+ || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major
+ && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor));
+}
+
+SDL_GLContext
+WIN_GL_CreateContext(_THIS, SDL_Window * window)
+{
+ HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
+ HGLRC context, share_context;
+
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && WIN_GL_UseEGL(_this)) {
+#if SDL_VIDEO_OPENGL_EGL
+ /* Switch to EGL based functions */
+ WIN_GL_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = WIN_GLES_LoadLibrary;
+ _this->GL_GetProcAddress = WIN_GLES_GetProcAddress;
+ _this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
+ _this->GL_CreateContext = WIN_GLES_CreateContext;
+ _this->GL_MakeCurrent = WIN_GLES_MakeCurrent;
+ _this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
+ _this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
+ _this->GL_SwapWindow = WIN_GLES_SwapWindow;
+ _this->GL_DeleteContext = WIN_GLES_DeleteContext;
+
+ if (WIN_GLES_LoadLibrary(_this, NULL) != 0) {
+ return NULL;
+ }
+
+ return WIN_GLES_CreateContext(_this, window);
+#else
+ SDL_SetError("SDL not configured with EGL support");
+ return NULL;
+#endif
+ }
+
+ if (_this->gl_config.share_with_current_context) {
+ share_context = (HGLRC)SDL_GL_GetCurrentContext();
+ } else {
+ share_context = 0;
+ }
+
+ if (_this->gl_config.major_version < 3 &&
+ _this->gl_config.profile_mask == 0 &&
+ _this->gl_config.flags == 0) {
+ /* Create legacy context */
+ context = _this->gl_data->wglCreateContext(hdc);
+ if( share_context != 0 ) {
+ _this->gl_data->wglShareLists(share_context, context);
+ }
+ } else {
+ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
+ HGLRC temp_context = _this->gl_data->wglCreateContext(hdc);
+ if (!temp_context) {
+ SDL_SetError("Could not create GL context");
+ return NULL;
+ }
+
+ /* Make the context current */
+ if (WIN_GL_MakeCurrent(_this, window, temp_context) < 0) {
+ WIN_GL_DeleteContext(_this, temp_context);
+ return NULL;
+ }
+
+ wglCreateContextAttribsARB =
+ (PFNWGLCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
+ wglGetProcAddress("wglCreateContextAttribsARB");
+ if (!wglCreateContextAttribsARB) {
+ SDL_SetError("GL 3.x is not supported");
+ context = temp_context;
+ } else {
+ int attribs[15]; /* max 14 attributes plus terminator */
+ int iattr = 0;
+
+ attribs[iattr++] = WGL_CONTEXT_MAJOR_VERSION_ARB;
+ attribs[iattr++] = _this->gl_config.major_version;
+ attribs[iattr++] = WGL_CONTEXT_MINOR_VERSION_ARB;
+ attribs[iattr++] = _this->gl_config.minor_version;
+
+ /* SDL profile bits match WGL profile bits */
+ if (_this->gl_config.profile_mask != 0) {
+ attribs[iattr++] = WGL_CONTEXT_PROFILE_MASK_ARB;
+ attribs[iattr++] = _this->gl_config.profile_mask;
+ }
+
+ /* SDL flags match WGL flags */
+ if (_this->gl_config.flags != 0) {
+ attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB;
+ attribs[iattr++] = _this->gl_config.flags;
+ }
+
+ /* only set if wgl extension is available */
+ if (_this->gl_data->HAS_WGL_ARB_context_flush_control) {
+ attribs[iattr++] = WGL_CONTEXT_RELEASE_BEHAVIOR_ARB;
+ attribs[iattr++] = _this->gl_config.release_behavior ?
+ WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB :
+ WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
+ }
+
+ /* only set if wgl extension is available */
+ if (_this->gl_data->HAS_WGL_ARB_create_context_robustness) {
+ attribs[iattr++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB;
+ attribs[iattr++] = _this->gl_config.reset_notification ?
+ WGL_LOSE_CONTEXT_ON_RESET_ARB :
+ WGL_NO_RESET_NOTIFICATION_ARB;
+ }
+
+ /* only set if wgl extension is available */
+ if (_this->gl_data->HAS_WGL_ARB_create_context_no_error) {
+ attribs[iattr++] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB;
+ attribs[iattr++] = _this->gl_config.no_error;
+ }
+
+ attribs[iattr++] = 0;
+
+ /* Create the GL 3.x context */
+ context = wglCreateContextAttribsARB(hdc, share_context, attribs);
+ /* Delete the GL 2.x context */
+ _this->gl_data->wglDeleteContext(temp_context);
+ }
+ }
+
+ if (!context) {
+ WIN_SetError("Could not create GL context");
+ return NULL;
+ }
+
+ if (WIN_GL_MakeCurrent(_this, window, context) < 0) {
+ WIN_GL_DeleteContext(_this, context);
+ return NULL;
+ }
+
+ return context;
+}
+
+int
+WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ HDC hdc;
+
+ if (!_this->gl_data) {
+ return SDL_SetError("OpenGL not initialized");
+ }
+
+ /* sanity check that higher level handled this. */
+ SDL_assert(window || (!window && !context));
+
+ /* Some Windows drivers freak out if hdc is NULL, even when context is
+ NULL, against spec. Since hdc is _supposed_ to be ignored if context
+ is NULL, we either use the current GL window, or do nothing if we
+ already have no current context. */
+ if (!window) {
+ window = SDL_GL_GetCurrentWindow();
+ if (!window) {
+ SDL_assert(SDL_GL_GetCurrentContext() == NULL);
+ return 0; /* already done. */
+ }
+ }
+
+ hdc = ((SDL_WindowData *) window->driverdata)->hdc;
+ if (!_this->gl_data->wglMakeCurrent(hdc, (HGLRC) context)) {
+ return WIN_SetError("wglMakeCurrent()");
+ }
+ return 0;
+}
+
+int
+WIN_GL_SetSwapInterval(_THIS, int interval)
+{
+ if ((interval < 0) && (!_this->gl_data->HAS_WGL_EXT_swap_control_tear)) {
+ return SDL_SetError("Negative swap interval unsupported in this GL");
+ } else if (_this->gl_data->wglSwapIntervalEXT) {
+ if (_this->gl_data->wglSwapIntervalEXT(interval) != TRUE) {
+ return WIN_SetError("wglSwapIntervalEXT()");
+ }
+ } else {
+ return SDL_Unsupported();
+ }
+ return 0;
+}
+
+int
+WIN_GL_GetSwapInterval(_THIS)
+{
+ int retval = 0;
+ if (_this->gl_data->wglGetSwapIntervalEXT) {
+ retval = _this->gl_data->wglGetSwapIntervalEXT();
+ }
+ return retval;
+}
+
+int
+WIN_GL_SwapWindow(_THIS, SDL_Window * window)
+{
+ HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
+
+ if (!SwapBuffers(hdc)) {
+ return WIN_SetError("SwapBuffers()");
+ }
+ return 0;
+}
+
+void
+WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ if (!_this->gl_data) {
+ return;
+ }
+ _this->gl_data->wglDeleteContext((HGLRC) context);
+}
+
+
+SDL_bool
+WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Window * toWindow)
+{
+ HDC hfromdc = ((SDL_WindowData *) fromWindow->driverdata)->hdc;
+ HDC htodc = ((SDL_WindowData *) toWindow->driverdata)->hdc;
+ BOOL result;
+
+ /* get the pixel format of the fromWindow */
+ int pixel_format = GetPixelFormat(hfromdc);
+ PIXELFORMATDESCRIPTOR pfd;
+ SDL_memset(&pfd, 0, sizeof(pfd));
+ DescribePixelFormat(hfromdc, pixel_format, sizeof(pfd), &pfd);
+
+ /* set the pixel format of the toWindow */
+ result = SetPixelFormat(htodc, pixel_format, &pfd);
+
+ return result ? SDL_TRUE : SDL_FALSE;
+}
+
+#endif /* SDL_VIDEO_OPENGL_WGL */
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.h
new file mode 100644
index 0000000..75b4898
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengl.h
@@ -0,0 +1,142 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsopengl_h_
+#define SDL_windowsopengl_h_
+
+#if SDL_VIDEO_OPENGL_WGL
+
+struct SDL_GLDriverData
+{
+ SDL_bool HAS_WGL_ARB_pixel_format;
+ SDL_bool HAS_WGL_EXT_swap_control_tear;
+ SDL_bool HAS_WGL_ARB_context_flush_control;
+ SDL_bool HAS_WGL_ARB_create_context_robustness;
+ SDL_bool HAS_WGL_ARB_create_context_no_error;
+
+ /* Max version of OpenGL ES context that can be created if the
+ implementation supports WGL_EXT_create_context_es2_profile.
+ major = minor = 0 when unsupported.
+ */
+ struct {
+ int major;
+ int minor;
+ } es_profile_max_supported_version;
+
+ void *(WINAPI * wglGetProcAddress) (const char *proc);
+ HGLRC(WINAPI * wglCreateContext) (HDC hdc);
+ BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
+ BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
+ BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
+ BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
+ const int *piAttribIList,
+ const FLOAT * pfAttribFList,
+ UINT nMaxFormats,
+ int *piFormats,
+ UINT * nNumFormats);
+ BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ int *piValues);
+ BOOL (WINAPI * wglSwapIntervalEXT) (int interval);
+ int (WINAPI * wglGetSwapIntervalEXT) (void);
+};
+
+/* OpenGL functions */
+extern int WIN_GL_LoadLibrary(_THIS, const char *path);
+extern void *WIN_GL_GetProcAddress(_THIS, const char *proc);
+extern void WIN_GL_UnloadLibrary(_THIS);
+extern SDL_bool WIN_GL_UseEGL(_THIS);
+extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window);
+extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window);
+extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window,
+ SDL_GLContext context);
+extern int WIN_GL_SetSwapInterval(_THIS, int interval);
+extern int WIN_GL_GetSwapInterval(_THIS);
+extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window);
+extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern void WIN_GL_InitExtensions(_THIS);
+extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Window * toWindow);
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB 0x2002
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NEED_PALETTE_ARB 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
+#define WGL_SWAP_METHOD_ARB 0x2007
+#define WGL_NUMBER_OVERLAYS_ARB 0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
+#define WGL_TRANSPARENT_ARB 0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB 0x200C
+#define WGL_SHARE_STENCIL_ARB 0x200D
+#define WGL_SHARE_ACCUM_ARB 0x200E
+#define WGL_SUPPORT_GDI_ARB 0x200F
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_STEREO_ARB 0x2012
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_COLOR_BITS_ARB 0x2014
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201A
+#define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_ALPHA_SHIFT_ARB 0x201C
+#define WGL_ACCUM_BITS_ARB 0x201D
+#define WGL_ACCUM_RED_BITS_ARB 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_GENERIC_ACCELERATION_ARB 0x2026
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+#define WGL_SWAP_EXCHANGE_ARB 0x2028
+#define WGL_SWAP_COPY_ARB 0x2029
+#define WGL_SWAP_UNDEFINED_ARB 0x202A
+#define WGL_TYPE_RGBA_ARB 0x202B
+#define WGL_TYPE_COLORINDEX_ARB 0x202C
+#endif
+
+#ifndef WGL_ARB_multisample
+#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLES_ARB 0x2042
+#endif
+
+#endif /* SDL_VIDEO_OPENGL_WGL */
+
+#endif /* SDL_windowsopengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.c
new file mode 100644
index 0000000..0ff61c3
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.c
@@ -0,0 +1,131 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_windowsvideo.h"
+#include "SDL_windowsopengles.h"
+#include "SDL_windowsopengl.h"
+#include "SDL_log.h"
+
+/* EGL implementation of SDL OpenGL support */
+
+int
+WIN_GLES_LoadLibrary(_THIS, const char *path) {
+
+ /* If the profile requested is not GL ES, switch over to WIN_GL functions */
+ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
+#if SDL_VIDEO_OPENGL_WGL
+ WIN_GLES_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = WIN_GL_LoadLibrary;
+ _this->GL_GetProcAddress = WIN_GL_GetProcAddress;
+ _this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
+ _this->GL_CreateContext = WIN_GL_CreateContext;
+ _this->GL_MakeCurrent = WIN_GL_MakeCurrent;
+ _this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
+ _this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
+ _this->GL_SwapWindow = WIN_GL_SwapWindow;
+ _this->GL_DeleteContext = WIN_GL_DeleteContext;
+ return WIN_GL_LoadLibrary(_this, path);
+#else
+ return SDL_SetError("SDL not configured with OpenGL/WGL support");
+#endif
+ }
+
+ if (_this->egl_data == NULL) {
+ return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0);
+ }
+
+ return 0;
+}
+
+SDL_GLContext
+WIN_GLES_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_GLContext context;
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+
+#if SDL_VIDEO_OPENGL_WGL
+ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
+ /* Switch to WGL based functions */
+ WIN_GLES_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = WIN_GL_LoadLibrary;
+ _this->GL_GetProcAddress = WIN_GL_GetProcAddress;
+ _this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
+ _this->GL_CreateContext = WIN_GL_CreateContext;
+ _this->GL_MakeCurrent = WIN_GL_MakeCurrent;
+ _this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
+ _this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
+ _this->GL_SwapWindow = WIN_GL_SwapWindow;
+ _this->GL_DeleteContext = WIN_GL_DeleteContext;
+
+ if (WIN_GL_LoadLibrary(_this, NULL) != 0) {
+ return NULL;
+ }
+
+ return WIN_GL_CreateContext(_this, window);
+ }
+#endif
+
+ context = SDL_EGL_CreateContext(_this, data->egl_surface);
+ return context;
+}
+
+void
+WIN_GLES_DeleteContext(_THIS, SDL_GLContext context)
+{
+ SDL_EGL_DeleteContext(_this, context);
+ WIN_GLES_UnloadLibrary(_this);
+}
+
+SDL_EGL_SwapWindow_impl(WIN)
+SDL_EGL_MakeCurrent_impl(WIN)
+
+int
+WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
+{
+ /* The current context is lost in here; save it and reset it. */
+ SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
+ SDL_Window *current_win = SDL_GL_GetCurrentWindow();
+ SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
+
+
+ if (_this->egl_data == NULL) {
+ if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) {
+ SDL_EGL_UnloadLibrary(_this);
+ return -1;
+ }
+ }
+
+ /* Create the GLES window surface */
+ windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)windowdata->hwnd);
+
+ if (windowdata->egl_surface == EGL_NO_SURFACE) {
+ return SDL_SetError("Could not create GLES window surface");
+ }
+
+ return WIN_GLES_MakeCurrent(_this, current_win, current_ctx);
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.h
new file mode 100644
index 0000000..8684429
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsopengles.h
@@ -0,0 +1,49 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_winopengles_h_
+#define SDL_winopengles_h_
+
+#if SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define WIN_GLES_GetAttribute SDL_EGL_GetAttribute
+#define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+
+extern int WIN_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window);
+
+#endif /* SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_winopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.c
new file mode 100644
index 0000000..bed4588
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.c
@@ -0,0 +1,110 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_assert.h"
+#include "SDL_windowsshape.h"
+#include "SDL_windowsvideo.h"
+
+SDL_WindowShaper*
+Win32_CreateShaper(SDL_Window * window) {
+ int resized_properly;
+ SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper));
+ result->window = window;
+ result->mode.mode = ShapeModeDefault;
+ result->mode.parameters.binarizationCutoff = 1;
+ result->userx = result->usery = 0;
+ result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData));
+ ((SDL_ShapeData*)result->driverdata)->mask_tree = NULL;
+ /* Put some driver-data here. */
+ window->shaper = result;
+ resized_properly = Win32_ResizeWindowShape(window);
+ if (resized_properly != 0)
+ return NULL;
+
+ return result;
+}
+
+static void
+CombineRectRegions(SDL_ShapeTree* node,void* closure) {
+ HRGN mask_region = *((HRGN*)closure),temp_region = NULL;
+ if(node->kind == OpaqueShape) {
+ /* Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline. */
+ temp_region = CreateRectRgn(node->data.shape.x,node->data.shape.y,node->data.shape.x + node->data.shape.w + 1,node->data.shape.y + node->data.shape.h + 1);
+ if(mask_region != NULL) {
+ CombineRgn(mask_region,mask_region,temp_region,RGN_OR);
+ DeleteObject(temp_region);
+ }
+ else
+ *((HRGN*)closure) = temp_region;
+ }
+}
+
+int
+Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
+ SDL_ShapeData *data;
+ HRGN mask_region = NULL;
+
+ if( (shaper == NULL) ||
+ (shape == NULL) ||
+ ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) ||
+ (shape->w != shaper->window->w) ||
+ (shape->h != shaper->window->h) ) {
+ return SDL_INVALID_SHAPE_ARGUMENT;
+ }
+
+ data = (SDL_ShapeData*)shaper->driverdata;
+ if(data->mask_tree != NULL)
+ SDL_FreeShapeTree(&data->mask_tree);
+ data->mask_tree = SDL_CalculateShapeTree(*shape_mode,shape);
+
+ SDL_TraverseShapeTree(data->mask_tree,&CombineRectRegions,&mask_region);
+ SDL_assert(mask_region != NULL);
+
+ SetWindowRgn(((SDL_WindowData *)(shaper->window->driverdata))->hwnd, mask_region, TRUE);
+
+ return 0;
+}
+
+int
+Win32_ResizeWindowShape(SDL_Window *window) {
+ SDL_ShapeData* data;
+
+ if (window == NULL)
+ return -1;
+ data = (SDL_ShapeData *)window->shaper->driverdata;
+ if (data == NULL)
+ return -1;
+
+ if(data->mask_tree != NULL)
+ SDL_FreeShapeTree(&data->mask_tree);
+ if(window->shaper->hasshape == SDL_TRUE) {
+ window->shaper->userx = window->x;
+ window->shaper->usery = window->y;
+ SDL_SetWindowPosition(window,-1000,-1000);
+ }
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.h
new file mode 100644
index 0000000..eb1a887
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsshape.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsshape_h_
+#define SDL_windowsshape_h_
+
+#include "SDL_video.h"
+#include "SDL_shape.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_shape_internals.h"
+
+typedef struct {
+ SDL_ShapeTree *mask_tree;
+} SDL_ShapeData;
+
+extern SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window);
+extern int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
+extern int Win32_ResizeWindowShape(SDL_Window *window);
+
+#endif /* SDL_windowsshape_h_ */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.c
new file mode 100644
index 0000000..8d45b72
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.c
@@ -0,0 +1,441 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_main.h"
+#include "SDL_video.h"
+#include "SDL_hints.h"
+#include "SDL_mouse.h"
+#include "SDL_system.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+
+#include "SDL_windowsvideo.h"
+#include "SDL_windowsframebuffer.h"
+#include "SDL_windowsshape.h"
+#include "SDL_windowsvulkan.h"
+
+/* Initialization/Query functions */
+static int WIN_VideoInit(_THIS);
+static void WIN_VideoQuit(_THIS);
+
+/* Hints */
+SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE;
+SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
+
+static void SDLCALL
+UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
+{
+ if (newValue && *newValue == '0') {
+ g_WindowsEnableMessageLoop = SDL_FALSE;
+ } else {
+ g_WindowsEnableMessageLoop = SDL_TRUE;
+ }
+}
+
+static void SDLCALL
+UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
+{
+ if (newValue && *newValue == '0') {
+ g_WindowFrameUsableWhileCursorHidden = SDL_FALSE;
+ } else {
+ g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
+ }
+}
+
+
+/* Windows driver bootstrap functions */
+
+static int
+WIN_Available(void)
+{
+ return (1);
+}
+
+static void
+WIN_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
+
+ SDL_UnregisterApp();
+ if (data->userDLL) {
+ SDL_UnloadObject(data->userDLL);
+ }
+ if (data->shcoreDLL) {
+ SDL_UnloadObject(data->shcoreDLL);
+ }
+
+ SDL_free(device->driverdata);
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+WIN_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+
+ SDL_RegisterApp(NULL, 0, NULL);
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device) {
+ data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ } else {
+ data = NULL;
+ }
+ if (!data) {
+ SDL_free(device);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ device->driverdata = data;
+
+ data->userDLL = SDL_LoadObject("USER32.DLL");
+ if (data->userDLL) {
+ data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
+ data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
+ data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
+ } else {
+ SDL_ClearError();
+ }
+
+ data->shcoreDLL = SDL_LoadObject("SHCORE.DLL");
+ if (data->shcoreDLL) {
+ data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
+ } else {
+ SDL_ClearError();
+ }
+
+ /* Set the function pointers */
+ device->VideoInit = WIN_VideoInit;
+ device->VideoQuit = WIN_VideoQuit;
+ device->GetDisplayBounds = WIN_GetDisplayBounds;
+ device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds;
+ device->GetDisplayDPI = WIN_GetDisplayDPI;
+ device->GetDisplayModes = WIN_GetDisplayModes;
+ device->SetDisplayMode = WIN_SetDisplayMode;
+ device->PumpEvents = WIN_PumpEvents;
+
+ device->CreateSDLWindow = WIN_CreateWindow;
+ device->CreateSDLWindowFrom = WIN_CreateWindowFrom;
+ device->SetWindowTitle = WIN_SetWindowTitle;
+ device->SetWindowIcon = WIN_SetWindowIcon;
+ device->SetWindowPosition = WIN_SetWindowPosition;
+ device->SetWindowSize = WIN_SetWindowSize;
+ device->GetWindowBordersSize = WIN_GetWindowBordersSize;
+ device->SetWindowOpacity = WIN_SetWindowOpacity;
+ device->ShowWindow = WIN_ShowWindow;
+ device->HideWindow = WIN_HideWindow;
+ device->RaiseWindow = WIN_RaiseWindow;
+ device->MaximizeWindow = WIN_MaximizeWindow;
+ device->MinimizeWindow = WIN_MinimizeWindow;
+ device->RestoreWindow = WIN_RestoreWindow;
+ device->SetWindowBordered = WIN_SetWindowBordered;
+ device->SetWindowResizable = WIN_SetWindowResizable;
+ device->SetWindowFullscreen = WIN_SetWindowFullscreen;
+ device->SetWindowGammaRamp = WIN_SetWindowGammaRamp;
+ device->GetWindowGammaRamp = WIN_GetWindowGammaRamp;
+ device->SetWindowGrab = WIN_SetWindowGrab;
+ device->DestroyWindow = WIN_DestroyWindow;
+ device->GetWindowWMInfo = WIN_GetWindowWMInfo;
+ device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer;
+ device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
+ device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer;
+ device->OnWindowEnter = WIN_OnWindowEnter;
+ device->SetWindowHitTest = WIN_SetWindowHitTest;
+
+ device->shape_driver.CreateShaper = Win32_CreateShaper;
+ device->shape_driver.SetWindowShape = Win32_SetWindowShape;
+ device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
+
+#if SDL_VIDEO_OPENGL_WGL
+ device->GL_LoadLibrary = WIN_GL_LoadLibrary;
+ device->GL_GetProcAddress = WIN_GL_GetProcAddress;
+ device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
+ device->GL_CreateContext = WIN_GL_CreateContext;
+ device->GL_MakeCurrent = WIN_GL_MakeCurrent;
+ device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
+ device->GL_SwapWindow = WIN_GL_SwapWindow;
+ device->GL_DeleteContext = WIN_GL_DeleteContext;
+#elif SDL_VIDEO_OPENGL_EGL
+ /* Use EGL based functions */
+ device->GL_LoadLibrary = WIN_GLES_LoadLibrary;
+ device->GL_GetProcAddress = WIN_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
+ device->GL_CreateContext = WIN_GLES_CreateContext;
+ device->GL_MakeCurrent = WIN_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
+ device->GL_SwapWindow = WIN_GLES_SwapWindow;
+ device->GL_DeleteContext = WIN_GLES_DeleteContext;
+#endif
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface;
+#endif
+
+ device->StartTextInput = WIN_StartTextInput;
+ device->StopTextInput = WIN_StopTextInput;
+ device->SetTextInputRect = WIN_SetTextInputRect;
+
+ device->SetClipboardText = WIN_SetClipboardText;
+ device->GetClipboardText = WIN_GetClipboardText;
+ device->HasClipboardText = WIN_HasClipboardText;
+
+ device->free = WIN_DeleteDevice;
+
+ return device;
+}
+
+
+VideoBootStrap WINDOWS_bootstrap = {
+ "windows", "SDL Windows video driver", WIN_Available, WIN_CreateDevice
+};
+
+int
+WIN_VideoInit(_THIS)
+{
+ if (WIN_InitModes(_this) < 0) {
+ return -1;
+ }
+
+ WIN_InitKeyboard(_this);
+ WIN_InitMouse(_this);
+
+ SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL);
+ SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL);
+
+ return 0;
+}
+
+void
+WIN_VideoQuit(_THIS)
+{
+ WIN_QuitModes(_this);
+ WIN_QuitKeyboard(_this);
+ WIN_QuitMouse(_this);
+}
+
+
+#define D3D_DEBUG_INFO
+#include <d3d9.h>
+
+SDL_bool
+D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface)
+{
+ *pD3DDLL = SDL_LoadObject("D3D9.DLL");
+ if (*pD3DDLL) {
+ typedef IDirect3D9 *(WINAPI *Direct3DCreate9_t) (UINT SDKVersion);
+ Direct3DCreate9_t Direct3DCreate9Func;
+
+#ifdef USE_D3D9EX
+ typedef HRESULT (WINAPI *Direct3DCreate9Ex_t)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
+ Direct3DCreate9Ex_t Direct3DCreate9ExFunc;
+
+ Direct3DCreate9ExFunc = (Direct3DCreate9Ex_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
+ if (Direct3DCreate9ExFunc) {
+ IDirect3D9Ex *pDirect3D9ExInterface;
+ HRESULT hr = Direct3DCreate9ExFunc(D3D_SDK_VERSION, &pDirect3D9ExInterface);
+ if (SUCCEEDED(hr)) {
+ const GUID IDirect3D9_GUID = { 0x81bdcbca, 0x64d4, 0x426d, { 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c } };
+ hr = IDirect3D9Ex_QueryInterface(pDirect3D9ExInterface, &IDirect3D9_GUID, (void**)pDirect3D9Interface);
+ IDirect3D9Ex_Release(pDirect3D9ExInterface);
+ if (SUCCEEDED(hr)) {
+ return SDL_TRUE;
+ }
+ }
+ }
+#endif /* USE_D3D9EX */
+
+ Direct3DCreate9Func = (Direct3DCreate9_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
+ if (Direct3DCreate9Func) {
+ *pDirect3D9Interface = Direct3DCreate9Func(D3D_SDK_VERSION);
+ if (*pDirect3D9Interface) {
+ return SDL_TRUE;
+ }
+ }
+
+ SDL_UnloadObject(*pD3DDLL);
+ *pD3DDLL = NULL;
+ }
+ *pDirect3D9Interface = NULL;
+ return SDL_FALSE;
+}
+
+
+int
+SDL_Direct3D9GetAdapterIndex(int displayIndex)
+{
+ void *pD3DDLL;
+ IDirect3D9 *pD3D;
+ if (!D3D_LoadDLL(&pD3DDLL, &pD3D)) {
+ SDL_SetError("Unable to create Direct3D interface");
+ return D3DADAPTER_DEFAULT;
+ } else {
+ SDL_DisplayData *pData = (SDL_DisplayData *)SDL_GetDisplayDriverData(displayIndex);
+ int adapterIndex = D3DADAPTER_DEFAULT;
+
+ if (!pData) {
+ SDL_SetError("Invalid display index");
+ adapterIndex = -1; /* make sure we return something invalid */
+ } else {
+ char *displayName = WIN_StringToUTF8(pData->DeviceName);
+ unsigned int count = IDirect3D9_GetAdapterCount(pD3D);
+ unsigned int i;
+ for (i=0; i<count; i++) {
+ D3DADAPTER_IDENTIFIER9 id;
+ IDirect3D9_GetAdapterIdentifier(pD3D, i, 0, &id);
+
+ if (SDL_strcmp(id.DeviceName, displayName) == 0) {
+ adapterIndex = i;
+ break;
+ }
+ }
+ SDL_free(displayName);
+ }
+
+ /* free up the D3D stuff we inited */
+ IDirect3D9_Release(pD3D);
+ SDL_UnloadObject(pD3DDLL);
+
+ return adapterIndex;
+ }
+}
+
+#if HAVE_DXGI_H
+#define CINTERFACE
+#define COBJMACROS
+#include <dxgi.h>
+
+static SDL_bool
+DXGI_LoadDLL(void **pDXGIDLL, IDXGIFactory **pDXGIFactory)
+{
+ *pDXGIDLL = SDL_LoadObject("DXGI.DLL");
+ if (*pDXGIDLL) {
+ HRESULT (WINAPI *CreateDXGI)(REFIID riid, void **ppFactory);
+
+ CreateDXGI =
+ (HRESULT (WINAPI *) (REFIID, void**)) SDL_LoadFunction(*pDXGIDLL,
+ "CreateDXGIFactory");
+ if (CreateDXGI) {
+ GUID dxgiGUID = {0x7b7166ec,0x21c7,0x44ae,{0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69}};
+ if (!SUCCEEDED(CreateDXGI(&dxgiGUID, (void**)pDXGIFactory))) {
+ *pDXGIFactory = NULL;
+ }
+ }
+ if (!*pDXGIFactory) {
+ SDL_UnloadObject(*pDXGIDLL);
+ *pDXGIDLL = NULL;
+ return SDL_FALSE;
+ }
+
+ return SDL_TRUE;
+ } else {
+ *pDXGIFactory = NULL;
+ return SDL_FALSE;
+ }
+}
+#endif
+
+
+SDL_bool
+SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
+{
+#if !HAVE_DXGI_H
+ if (adapterIndex) *adapterIndex = -1;
+ if (outputIndex) *outputIndex = -1;
+ SDL_SetError("SDL was compiled without DXGI support due to missing dxgi.h header");
+ return SDL_FALSE;
+#else
+ SDL_DisplayData *pData = (SDL_DisplayData *)SDL_GetDisplayDriverData(displayIndex);
+ void *pDXGIDLL;
+ char *displayName;
+ int nAdapter, nOutput;
+ IDXGIFactory *pDXGIFactory;
+ IDXGIAdapter *pDXGIAdapter;
+ IDXGIOutput* pDXGIOutput;
+
+ if (!adapterIndex) {
+ SDL_InvalidParamError("adapterIndex");
+ return SDL_FALSE;
+ }
+
+ if (!outputIndex) {
+ SDL_InvalidParamError("outputIndex");
+ return SDL_FALSE;
+ }
+
+ *adapterIndex = -1;
+ *outputIndex = -1;
+
+ if (!pData) {
+ SDL_SetError("Invalid display index");
+ return SDL_FALSE;
+ }
+
+ if (!DXGI_LoadDLL(&pDXGIDLL, &pDXGIFactory)) {
+ SDL_SetError("Unable to create DXGI interface");
+ return SDL_FALSE;
+ }
+
+ displayName = WIN_StringToUTF8(pData->DeviceName);
+ nAdapter = 0;
+ while (*adapterIndex == -1 && SUCCEEDED(IDXGIFactory_EnumAdapters(pDXGIFactory, nAdapter, &pDXGIAdapter))) {
+ nOutput = 0;
+ while (*adapterIndex == -1 && SUCCEEDED(IDXGIAdapter_EnumOutputs(pDXGIAdapter, nOutput, &pDXGIOutput))) {
+ DXGI_OUTPUT_DESC outputDesc;
+ if (SUCCEEDED(IDXGIOutput_GetDesc(pDXGIOutput, &outputDesc))) {
+ char *outputName = WIN_StringToUTF8(outputDesc.DeviceName);
+ if (SDL_strcmp(outputName, displayName) == 0) {
+ *adapterIndex = nAdapter;
+ *outputIndex = nOutput;
+ }
+ SDL_free(outputName);
+ }
+ IDXGIOutput_Release(pDXGIOutput);
+ nOutput++;
+ }
+ IDXGIAdapter_Release(pDXGIAdapter);
+ nAdapter++;
+ }
+ SDL_free(displayName);
+
+ /* free up the DXGI factory */
+ IDXGIFactory_Release(pDXGIFactory);
+ SDL_UnloadObject(pDXGIDLL);
+
+ if (*adapterIndex == -1) {
+ return SDL_FALSE;
+ } else {
+ return SDL_TRUE;
+ }
+#endif
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.h
new file mode 100644
index 0000000..1303754
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvideo.h
@@ -0,0 +1,199 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsvideo_h_
+#define SDL_windowsvideo_h_
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "../SDL_sysvideo.h"
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1500)
+#include <msctf.h>
+#else
+#include "SDL_msctf.h"
+#endif
+
+#include <imm.h>
+
+#define MAX_CANDLIST 10
+#define MAX_CANDLENGTH 256
+
+#include "SDL_windowsclipboard.h"
+#include "SDL_windowsevents.h"
+#include "SDL_windowskeyboard.h"
+#include "SDL_windowsmodes.h"
+#include "SDL_windowsmouse.h"
+#include "SDL_windowsopengl.h"
+#include "SDL_windowsopengles.h"
+#include "SDL_windowswindow.h"
+#include "SDL_events.h"
+#include "SDL_loadso.h"
+
+
+#if WINVER < 0x0601
+/* Touch input definitions */
+#define TWF_FINETOUCH 1
+#define TWF_WANTPALM 2
+
+#define TOUCHEVENTF_MOVE 0x0001
+#define TOUCHEVENTF_DOWN 0x0002
+#define TOUCHEVENTF_UP 0x0004
+
+DECLARE_HANDLE(HTOUCHINPUT);
+
+typedef struct _TOUCHINPUT {
+ LONG x;
+ LONG y;
+ HANDLE hSource;
+ DWORD dwID;
+ DWORD dwFlags;
+ DWORD dwMask;
+ DWORD dwTime;
+ ULONG_PTR dwExtraInfo;
+ DWORD cxContact;
+ DWORD cyContact;
+} TOUCHINPUT, *PTOUCHINPUT;
+
+#endif /* WINVER < 0x0601 */
+
+#if WINVER < 0x0603
+
+typedef enum MONITOR_DPI_TYPE {
+ MDT_EFFECTIVE_DPI = 0,
+ MDT_ANGULAR_DPI = 1,
+ MDT_RAW_DPI = 2,
+ MDT_DEFAULT = MDT_EFFECTIVE_DPI
+} MONITOR_DPI_TYPE;
+
+#endif /* WINVER < 0x0603 */
+
+typedef BOOL (*PFNSHFullScreen)(HWND, DWORD);
+typedef void (*PFCoordTransform)(SDL_Window*, POINT*);
+
+typedef struct
+{
+ void **lpVtbl;
+ int refcount;
+ void *data;
+} TSFSink;
+
+/* Definition from Win98DDK version of IMM.H */
+typedef struct tagINPUTCONTEXT2 {
+ HWND hWnd;
+ BOOL fOpen;
+ POINT ptStatusWndPos;
+ POINT ptSoftKbdPos;
+ DWORD fdwConversion;
+ DWORD fdwSentence;
+ union {
+ LOGFONTA A;
+ LOGFONTW W;
+ } lfFont;
+ COMPOSITIONFORM cfCompForm;
+ CANDIDATEFORM cfCandForm[4];
+ HIMCC hCompStr;
+ HIMCC hCandInfo;
+ HIMCC hGuideLine;
+ HIMCC hPrivate;
+ DWORD dwNumMsgBuf;
+ HIMCC hMsgBuf;
+ DWORD fdwInit;
+ DWORD dwReserve[3];
+} INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
+
+/* Private display data */
+
+typedef struct SDL_VideoData
+{
+ int render;
+
+ DWORD clipboard_count;
+
+ /* Touch input functions */
+ void* userDLL;
+ BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
+ BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
+ BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
+
+ void* shcoreDLL;
+ HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor,
+ MONITOR_DPI_TYPE dpiType,
+ UINT *dpiX,
+ UINT *dpiY );
+
+ SDL_bool ime_com_initialized;
+ struct ITfThreadMgr *ime_threadmgr;
+ SDL_bool ime_initialized;
+ SDL_bool ime_enabled;
+ SDL_bool ime_available;
+ HWND ime_hwnd_main;
+ HWND ime_hwnd_current;
+ HIMC ime_himc;
+
+ WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
+ WCHAR ime_readingstring[16];
+ int ime_cursor;
+
+ SDL_bool ime_candlist;
+ WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH];
+ DWORD ime_candcount;
+ DWORD ime_candref;
+ DWORD ime_candsel;
+ UINT ime_candpgsize;
+ int ime_candlistindexbase;
+ SDL_bool ime_candvertical;
+
+ SDL_bool ime_dirty;
+ SDL_Rect ime_rect;
+ SDL_Rect ime_candlistrect;
+ int ime_winwidth;
+ int ime_winheight;
+
+ HKL ime_hkl;
+ void* ime_himm32;
+ UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
+ BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
+ LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
+ BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
+ LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
+ BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
+
+ SDL_bool ime_uiless;
+ struct ITfThreadMgrEx *ime_threadmgrex;
+ DWORD ime_uielemsinkcookie;
+ DWORD ime_alpnsinkcookie;
+ DWORD ime_openmodesinkcookie;
+ DWORD ime_convmodesinkcookie;
+ TSFSink *ime_uielemsink;
+ TSFSink *ime_ippasink;
+} SDL_VideoData;
+
+extern SDL_bool g_WindowsEnableMessageLoop;
+extern SDL_bool g_WindowFrameUsableWhileCursorHidden;
+
+typedef struct IDirect3D9 IDirect3D9;
+extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface );
+
+#endif /* SDL_windowsvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.c
new file mode 100644
index 0000000..c4b34f0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.c
@@ -0,0 +1,176 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.c.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS
+
+#include "SDL_windowsvideo.h"
+#include "SDL_windowswindow.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_windowsvulkan.h"
+#include "SDL_syswm.h"
+
+int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ VkExtensionProperties *extensions = NULL;
+ Uint32 extensionCount = 0;
+ Uint32 i;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasWin32SurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+ if(_this->vulkan_config.loader_handle)
+ return SDL_SetError("Vulkan already loaded");
+
+ /* Load the Vulkan loader library */
+ if(!path)
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ if(!path)
+ path = "vulkan-1.dll";
+ _this->vulkan_config.loader_handle = SDL_LoadObject(path);
+ if(!_this->vulkan_config.loader_handle)
+ return -1;
+ SDL_strlcpy(_this->vulkan_config.loader_path, path,
+ SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ if(!vkGetInstanceProcAddr)
+ goto fail;
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ goto fail;
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+ if(!extensions)
+ goto fail;
+ for(i = 0; i < extensionCount; i++)
+ {
+ if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasSurfaceExtension = SDL_TRUE;
+ else if(SDL_strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasWin32SurfaceExtension = SDL_TRUE;
+ }
+ SDL_free(extensions);
+ if(!hasSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ }
+ else if(!hasWin32SurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_WIN32_SURFACE_EXTENSION_NAME "extension");
+ goto fail;
+ }
+ return 0;
+
+fail:
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void WIN_Vulkan_UnloadLibrary(_THIS)
+{
+ if(_this->vulkan_config.loader_handle)
+ {
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ static const char *const extensionsForWin32[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME
+ };
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForWin32),
+ extensionsForWin32);
+}
+
+SDL_bool WIN_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
+ (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR =
+ (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr(
+ (VkInstance)instance,
+ "vkCreateWin32SurfaceKHR");
+ VkWin32SurfaceCreateInfoKHR createInfo;
+ VkResult result;
+
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+
+ if(!vkCreateWin32SurfaceKHR)
+ {
+ SDL_SetError(VK_KHR_WIN32_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
+ createInfo.pNext = NULL;
+ createInfo.flags = 0;
+ createInfo.hinstance = windowData->hinstance;
+ createInfo.hwnd = windowData->hwnd;
+ result = vkCreateWin32SurfaceKHR(instance, &createInfo,
+ NULL, surface);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError("vkCreateWin32SurfaceKHR failed: %s",
+ SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
+#endif
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.h
new file mode 100644
index 0000000..0acc0a9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowsvulkan.h
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+ * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
+ * SDL_x11vulkan.h.
+ */
+
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowsvulkan_h_
+#define SDL_windowsvulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+#include "../SDL_sysvideo.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS
+
+int WIN_Vulkan_LoadLibrary(_THIS, const char *path);
+void WIN_Vulkan_UnloadLibrary(_THIS);
+SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool WIN_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+#endif
+
+#endif /* SDL_windowsvulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.c b/src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.c
new file mode 100644
index 0000000..b082443
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.c
@@ -0,0 +1,970 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINDOWS
+
+#include "../../core/windows/SDL_windows.h"
+
+#include "SDL_assert.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_mouse_c.h"
+
+#include "SDL_windowsvideo.h"
+#include "SDL_windowswindow.h"
+#include "SDL_hints.h"
+
+/* Dropfile support */
+#include <shellapi.h>
+
+/* This is included after SDL_windowsvideo.h, which includes windows.h */
+#include "SDL_syswm.h"
+
+/* Windows CE compatibility */
+#ifndef SWP_NOCOPYBITS
+#define SWP_NOCOPYBITS 0
+#endif
+
+/* Fake window to help with DirectInput events. */
+HWND SDL_HelperWindow = NULL;
+static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
+static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
+static ATOM SDL_HelperWindowClass = 0;
+
+/* For borderless Windows, still want the following flags:
+ - WS_CAPTION: this seems to enable the Windows minimize animation
+ - WS_SYSMENU: enables system context menu on task bar
+ - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc.
+ This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen
+ */
+
+#define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
+#define STYLE_FULLSCREEN (WS_POPUP)
+#define STYLE_BORDERLESS (WS_POPUP)
+#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
+#define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
+#define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX)
+#define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE)
+
+static DWORD
+GetWindowStyle(SDL_Window * window)
+{
+ DWORD style = 0;
+
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ style |= STYLE_FULLSCREEN;
+ } else {
+ if (window->flags & SDL_WINDOW_BORDERLESS) {
+ /* SDL 2.1:
+ This behavior more closely matches other platform where the window is borderless
+ but still interacts with the window manager (e.g. task bar shows above it, it can
+ be resized to fit within usable desktop area, etc.) so this should be the behavior
+ for a future SDL release.
+
+ If you want a borderless window the size of the desktop that looks like a fullscreen
+ window, then you should use the SDL_WINDOW_FULLSCREEN_DESKTOP flag.
+ */
+ if (SDL_GetHintBoolean("SDL_BORDERLESS_WINDOWED_STYLE", SDL_FALSE)) {
+ style |= STYLE_BORDERLESS_WINDOWED;
+ } else {
+ style |= STYLE_BORDERLESS;
+ }
+ } else {
+ style |= STYLE_NORMAL;
+ }
+
+ /* You can have a borderless resizable window */
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ style |= STYLE_RESIZABLE;
+ }
+ }
+ return style;
+}
+
+static void
+WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current)
+{
+ RECT rect;
+
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = (use_current ? window->w : window->windowed.w);
+ rect.bottom = (use_current ? window->h : window->windowed.h);
+
+ /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message
+ expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
+ */
+ if (!(window->flags & SDL_WINDOW_BORDERLESS))
+ AdjustWindowRectEx(&rect, style, menu, 0);
+
+ *x = (use_current ? window->x : window->windowed.x) + rect.left;
+ *y = (use_current ? window->y : window->windowed.y) + rect.top;
+ *width = (rect.right - rect.left);
+ *height = (rect.bottom - rect.top);
+}
+
+static void
+WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height, SDL_bool use_current)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ DWORD style;
+ BOOL menu;
+
+ style = GetWindowLong(hwnd, GWL_STYLE);
+ menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
+ WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current);
+}
+
+static void
+WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ HWND top;
+ int x, y;
+ int w, h;
+
+ /* Figure out what the window area will be */
+ if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || (window->flags & SDL_WINDOW_ALWAYS_ON_TOP))) {
+ top = HWND_TOPMOST;
+ } else {
+ top = HWND_NOTOPMOST;
+ }
+
+ WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE);
+
+ data->expected_resize = SDL_TRUE;
+ SetWindowPos(hwnd, top, x, y, w, h, flags);
+ data->expected_resize = SDL_FALSE;
+}
+
+static int
+SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *data;
+
+ /* Allocate the window data */
+ data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+ data->window = window;
+ data->hwnd = hwnd;
+ data->parent = parent;
+ data->hdc = GetDC(hwnd);
+ data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
+ data->created = created;
+ data->mouse_button_flags = 0;
+ data->videodata = videodata;
+ data->initializing = SDL_TRUE;
+
+ window->driverdata = data;
+
+ /* Associate the data with the window */
+ if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
+ ReleaseDC(hwnd, data->hdc);
+ SDL_free(data);
+ return WIN_SetError("SetProp() failed");
+ }
+
+ /* Set up the window proc function */
+#ifdef GWLP_WNDPROC
+ data->wndproc = (WNDPROC) GetWindowLongPtr(hwnd, GWLP_WNDPROC);
+ if (data->wndproc == WIN_WindowProc) {
+ data->wndproc = NULL;
+ } else {
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) WIN_WindowProc);
+ }
+#else
+ data->wndproc = (WNDPROC) GetWindowLong(hwnd, GWL_WNDPROC);
+ if (data->wndproc == WIN_WindowProc) {
+ data->wndproc = NULL;
+ } else {
+ SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR) WIN_WindowProc);
+ }
+#endif
+
+ /* Fill in the SDL window with the window data */
+ {
+ RECT rect;
+ if (GetClientRect(hwnd, &rect)) {
+ int w = rect.right;
+ int h = rect.bottom;
+ if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) {
+ /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */
+ int x, y;
+ int w, h;
+
+ /* Figure out what the window area will be */
+ WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE);
+ SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
+ } else {
+ window->w = w;
+ window->h = h;
+ }
+ }
+ }
+ {
+ POINT point;
+ point.x = 0;
+ point.y = 0;
+ if (ClientToScreen(hwnd, &point)) {
+ window->x = point.x;
+ window->y = point.y;
+ }
+ }
+ {
+ DWORD style = GetWindowLong(hwnd, GWL_STYLE);
+ if (style & WS_VISIBLE) {
+ window->flags |= SDL_WINDOW_SHOWN;
+ } else {
+ window->flags &= ~SDL_WINDOW_SHOWN;
+ }
+ if (style & WS_POPUP) {
+ window->flags |= SDL_WINDOW_BORDERLESS;
+ } else {
+ window->flags &= ~SDL_WINDOW_BORDERLESS;
+ }
+ if (style & WS_THICKFRAME) {
+ window->flags |= SDL_WINDOW_RESIZABLE;
+ } else {
+ window->flags &= ~SDL_WINDOW_RESIZABLE;
+ }
+#ifdef WS_MAXIMIZE
+ if (style & WS_MAXIMIZE) {
+ window->flags |= SDL_WINDOW_MAXIMIZED;
+ } else
+#endif
+ {
+ window->flags &= ~SDL_WINDOW_MAXIMIZED;
+ }
+#ifdef WS_MINIMIZE
+ if (style & WS_MINIMIZE) {
+ window->flags |= SDL_WINDOW_MINIMIZED;
+ } else
+#endif
+ {
+ window->flags &= ~SDL_WINDOW_MINIMIZED;
+ }
+ }
+ if (GetFocus() == hwnd) {
+ window->flags |= SDL_WINDOW_INPUT_FOCUS;
+ SDL_SetKeyboardFocus(data->window);
+
+ if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
+ RECT rect;
+ GetClientRect(hwnd, &rect);
+ ClientToScreen(hwnd, (LPPOINT) & rect);
+ ClientToScreen(hwnd, (LPPOINT) & rect + 1);
+ ClipCursor(&rect);
+ }
+ }
+
+ /* Enable multi-touch */
+ if (videodata->RegisterTouchWindow) {
+ videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM));
+ }
+
+ /* Enable dropping files */
+ DragAcceptFiles(hwnd, TRUE);
+
+ data->initializing = SDL_FALSE;
+
+ /* All done! */
+ return 0;
+}
+
+
+
+int
+WIN_CreateWindow(_THIS, SDL_Window * window)
+{
+ HWND hwnd, parent = NULL;
+ DWORD style = STYLE_BASIC;
+ int x, y;
+ int w, h;
+
+ if (window->flags & SDL_WINDOW_SKIP_TASKBAR) {
+ parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL);
+ }
+
+ style |= GetWindowStyle(window);
+
+ /* Figure out what the window area will be */
+ WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE);
+
+ hwnd =
+ CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL,
+ SDL_Instance, NULL);
+ if (!hwnd) {
+ return WIN_SetError("Couldn't create window");
+ }
+
+ WIN_PumpEvents(_this);
+
+ if (SetupWindowData(_this, window, hwnd, parent, SDL_TRUE) < 0) {
+ DestroyWindow(hwnd);
+ if (parent) {
+ DestroyWindow(parent);
+ }
+ return -1;
+ }
+
+ /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */
+ SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
+
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ return 0;
+ }
+
+ /* The rest of this macro mess is for OpenGL or OpenGL ES windows */
+#if SDL_VIDEO_OPENGL_ES2
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES
+#if SDL_VIDEO_OPENGL_WGL
+ && (!_this->gl_data || WIN_GL_UseEGL(_this))
+#endif /* SDL_VIDEO_OPENGL_WGL */
+ ) {
+#if SDL_VIDEO_OPENGL_EGL
+ if (WIN_GLES_SetupWindow(_this, window) < 0) {
+ WIN_DestroyWindow(_this, window);
+ return -1;
+ }
+ return 0;
+#else
+ return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
+#endif /* SDL_VIDEO_OPENGL_EGL */
+ }
+#endif /* SDL_VIDEO_OPENGL_ES2 */
+
+#if SDL_VIDEO_OPENGL_WGL
+ if (WIN_GL_SetupWindow(_this, window) < 0) {
+ WIN_DestroyWindow(_this, window);
+ return -1;
+ }
+#else
+ return SDL_SetError("Could not create GL window (WGL support not configured)");
+#endif
+
+ return 0;
+}
+
+int
+WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ HWND hwnd = (HWND) data;
+ LPTSTR title;
+ int titleLen;
+
+ /* Query the title from the existing window */
+ titleLen = GetWindowTextLength(hwnd);
+ title = SDL_stack_alloc(TCHAR, titleLen + 1);
+ if (title) {
+ titleLen = GetWindowText(hwnd, title, titleLen);
+ } else {
+ titleLen = 0;
+ }
+ if (titleLen > 0) {
+ window->title = WIN_StringToUTF8(title);
+ }
+ if (title) {
+ SDL_stack_free(title);
+ }
+
+ if (SetupWindowData(_this, window, hwnd, GetParent(hwnd), SDL_FALSE) < 0) {
+ return -1;
+ }
+
+#if SDL_VIDEO_OPENGL_WGL
+ {
+ const char *hint = SDL_GetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT);
+ if (hint) {
+ /* This hint is a pointer (in string form) of the address of
+ the window to share a pixel format with
+ */
+ SDL_Window *otherWindow = NULL;
+ SDL_sscanf(hint, "%p", (void**)&otherWindow);
+
+ /* Do some error checking on the pointer */
+ if (otherWindow != NULL && otherWindow->magic == &_this->window_magic)
+ {
+ /* If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well */
+ if (otherWindow->flags & SDL_WINDOW_OPENGL)
+ {
+ window->flags |= SDL_WINDOW_OPENGL;
+ if(!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) {
+ return -1;
+ }
+ }
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
+void
+WIN_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ LPTSTR title = WIN_UTF8ToString(window->title);
+ SetWindowText(hwnd, title);
+ SDL_free(title);
+}
+
+void
+WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ HICON hicon = NULL;
+ BYTE *icon_bmp;
+ int icon_len, mask_len, y;
+ SDL_RWops *dst;
+
+ /* Create temporary buffer for ICONIMAGE structure */
+ mask_len = (icon->h * (icon->w + 7)/8);
+ icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len;
+ icon_bmp = SDL_stack_alloc(BYTE, icon_len);
+ dst = SDL_RWFromMem(icon_bmp, icon_len);
+ if (!dst) {
+ SDL_stack_free(icon_bmp);
+ return;
+ }
+
+ /* Write the BITMAPINFO header */
+ SDL_WriteLE32(dst, 40);
+ SDL_WriteLE32(dst, icon->w);
+ SDL_WriteLE32(dst, icon->h * 2);
+ SDL_WriteLE16(dst, 1);
+ SDL_WriteLE16(dst, 32);
+ SDL_WriteLE32(dst, BI_RGB);
+ SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32));
+ SDL_WriteLE32(dst, 0);
+ SDL_WriteLE32(dst, 0);
+ SDL_WriteLE32(dst, 0);
+ SDL_WriteLE32(dst, 0);
+
+ /* Write the pixels upside down into the bitmap buffer */
+ SDL_assert(icon->format->format == SDL_PIXELFORMAT_ARGB8888);
+ y = icon->h;
+ while (y--) {
+ Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch;
+ SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1);
+ }
+
+ /* Write the mask */
+ SDL_memset(icon_bmp + icon_len - mask_len, 0xFF, mask_len);
+
+ hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
+
+ SDL_RWclose(dst);
+ SDL_stack_free(icon_bmp);
+
+ /* Set the icon for the window */
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
+
+ /* Set the icon in the task manager (should we do this?) */
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
+}
+
+void
+WIN_SetWindowPosition(_THIS, SDL_Window * window)
+{
+ WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
+}
+
+void
+WIN_SetWindowSize(_THIS, SDL_Window * window)
+{
+ WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE);
+}
+
+int
+WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ RECT rcClient, rcWindow;
+ POINT ptDiff;
+
+ /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left
+ * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */
+ GetClientRect(hwnd, &rcClient);
+ GetWindowRect(hwnd, &rcWindow);
+
+ /* convert the top/left values to make them relative to
+ * the window; they will end up being slightly negative */
+ ptDiff.y = rcWindow.top;
+ ptDiff.x = rcWindow.left;
+
+ ScreenToClient(hwnd, &ptDiff);
+
+ rcWindow.top = ptDiff.y;
+ rcWindow.left = ptDiff.x;
+
+ /* convert the bottom/right values to make them relative to the window,
+ * these will be slightly bigger than the inner width/height */
+ ptDiff.y = rcWindow.bottom;
+ ptDiff.x = rcWindow.right;
+
+ ScreenToClient(hwnd, &ptDiff);
+
+ rcWindow.bottom = ptDiff.y;
+ rcWindow.right = ptDiff.x;
+
+ /* Now that both the inner and outer rects use the same coordinate system we can substract them to get the border size.
+ * Keep in mind that the top/left coordinates of rcWindow are negative because the border lies slightly before {0,0},
+ * so switch them around because SDL2 wants them in positive. */
+ *top = rcClient.top - rcWindow.top;
+ *left = rcClient.left - rcWindow.left;
+ *bottom = rcWindow.bottom - rcClient.bottom;
+ *right = rcWindow.right - rcClient.right;
+
+ return 0;
+}
+
+void
+WIN_ShowWindow(_THIS, SDL_Window * window)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ ShowWindow(hwnd, SW_SHOW);
+}
+
+void
+WIN_HideWindow(_THIS, SDL_Window * window)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ ShowWindow(hwnd, SW_HIDE);
+}
+
+void
+WIN_RaiseWindow(_THIS, SDL_Window * window)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ SetForegroundWindow(hwnd);
+}
+
+void
+WIN_MaximizeWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ data->expected_resize = SDL_TRUE;
+ ShowWindow(hwnd, SW_MAXIMIZE);
+ data->expected_resize = SDL_FALSE;
+}
+
+void
+WIN_MinimizeWindow(_THIS, SDL_Window * window)
+{
+ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+ ShowWindow(hwnd, SW_MINIMIZE);
+}
+
+void
+WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ DWORD style;
+
+ style = GetWindowLong(hwnd, GWL_STYLE);
+ style &= ~STYLE_MASK;
+ style |= GetWindowStyle(window);
+
+ data->in_border_change = SDL_TRUE;
+ SetWindowLong(hwnd, GWL_STYLE, style);
+ WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE);
+ data->in_border_change = SDL_FALSE;
+}
+
+void
+WIN_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ DWORD style;
+
+ style = GetWindowLong(hwnd, GWL_STYLE);
+ style &= ~STYLE_MASK;
+ style |= GetWindowStyle(window);
+
+ SetWindowLong(hwnd, GWL_STYLE, style);
+}
+
+void
+WIN_RestoreWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+ HWND hwnd = data->hwnd;
+ data->expected_resize = SDL_TRUE;
+ ShowWindow(hwnd, SW_RESTORE);
+ data->expected_resize = SDL_FALSE;
+}
+
+void
+WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ HWND hwnd = data->hwnd;
+ SDL_Rect bounds;
+ DWORD style;
+ HWND top;
+ int x, y;
+ int w, h;
+
+ if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) {
+ top = HWND_TOPMOST;
+ } else {
+ top = HWND_NOTOPMOST;
+ }
+
+ style = GetWindowLong(hwnd, GWL_STYLE);
+ style &= ~STYLE_MASK;
+ style |= GetWindowStyle(window);
+
+ WIN_GetDisplayBounds(_this, display, &bounds);
+
+ if (fullscreen) {
+ x = bounds.x;
+ y = bounds.y;
+ w = bounds.w;
+ h = bounds.h;
+
+ /* Unset the maximized flag. This fixes
+ https://bugzilla.libsdl.org/show_bug.cgi?id=3215
+ */
+ if (style & WS_MAXIMIZE) {
+ data->windowed_mode_was_maximized = SDL_TRUE;
+ style &= ~WS_MAXIMIZE;
+ }
+ } else {
+ BOOL menu;
+
+ /* Restore window-maximization state, as applicable.
+ Special care is taken to *not* do this if and when we're
+ alt-tab'ing away (to some other window; as indicated by
+ in_window_deactivation), otherwise
+ https://bugzilla.libsdl.org/show_bug.cgi?id=3215 can reproduce!
+ */
+ if (data->windowed_mode_was_maximized && !data->in_window_deactivation) {
+ style |= WS_MAXIMIZE;
+ data->windowed_mode_was_maximized = SDL_FALSE;
+ }
+
+ menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
+ WIN_AdjustWindowRectWithStyle(window, style, menu, &x, &y, &w, &h, SDL_FALSE);
+ }
+ SetWindowLong(hwnd, GWL_STYLE, style);
+ data->expected_resize = SDL_TRUE;
+ SetWindowPos(hwnd, top, x, y, w, h, SWP_NOCOPYBITS | SWP_NOACTIVATE);
+ data->expected_resize = SDL_FALSE;
+}
+
+int
+WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
+ HDC hdc;
+ BOOL succeeded = FALSE;
+
+ hdc = CreateDC(data->DeviceName, NULL, NULL, NULL);
+ if (hdc) {
+ succeeded = SetDeviceGammaRamp(hdc, (LPVOID)ramp);
+ if (!succeeded) {
+ WIN_SetError("SetDeviceGammaRamp()");
+ }
+ DeleteDC(hdc);
+ }
+ return succeeded ? 0 : -1;
+}
+
+int
+WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
+{
+ SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+ SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
+ HDC hdc;
+ BOOL succeeded = FALSE;
+
+ hdc = CreateDC(data->DeviceName, NULL, NULL, NULL);
+ if (hdc) {
+ succeeded = GetDeviceGammaRamp(hdc, (LPVOID)ramp);
+ if (!succeeded) {
+ WIN_SetError("GetDeviceGammaRamp()");
+ }
+ DeleteDC(hdc);
+ }
+ return succeeded ? 0 : -1;
+}
+
+void
+WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+ WIN_UpdateClipCursor(window);
+
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE;
+
+ if (!(window->flags & SDL_WINDOW_SHOWN)) {
+ flags |= SWP_NOACTIVATE;
+ }
+ WIN_SetWindowPositionInternal(_this, window, flags);
+ }
+}
+
+void
+WIN_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (data) {
+ ReleaseDC(data->hwnd, data->hdc);
+ RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
+ if (data->created) {
+ DestroyWindow(data->hwnd);
+ if (data->parent) {
+ DestroyWindow(data->parent);
+ }
+ } else {
+ /* Restore any original event handler... */
+ if (data->wndproc != NULL) {
+#ifdef GWLP_WNDPROC
+ SetWindowLongPtr(data->hwnd, GWLP_WNDPROC,
+ (LONG_PTR) data->wndproc);
+#else
+ SetWindowLong(data->hwnd, GWL_WNDPROC,
+ (LONG_PTR) data->wndproc);
+#endif
+ }
+ }
+ SDL_free(data);
+ }
+ window->driverdata = NULL;
+}
+
+SDL_bool
+WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata;
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
+
+ info->subsystem = SDL_SYSWM_WINDOWS;
+ info->info.win.window = data->hwnd;
+
+ if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) {
+ info->info.win.hdc = data->hdc;
+ }
+
+ if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) {
+ info->info.win.hinstance = data->hinstance;
+ }
+
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+}
+
+
+/*
+ * Creates a HelperWindow used for DirectInput events.
+ */
+int
+SDL_HelperWindowCreate(void)
+{
+ HINSTANCE hInstance = GetModuleHandle(NULL);
+ WNDCLASS wce;
+
+ /* Make sure window isn't created twice. */
+ if (SDL_HelperWindow != NULL) {
+ return 0;
+ }
+
+ /* Create the class. */
+ SDL_zero(wce);
+ wce.lpfnWndProc = DefWindowProc;
+ wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
+ wce.hInstance = hInstance;
+
+ /* Register the class. */
+ SDL_HelperWindowClass = RegisterClass(&wce);
+ if (SDL_HelperWindowClass == 0 && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) {
+ return WIN_SetError("Unable to create Helper Window Class");
+ }
+
+ /* Create the window. */
+ SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName,
+ SDL_HelperWindowName,
+ WS_OVERLAPPED, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, HWND_MESSAGE, NULL,
+ hInstance, NULL);
+ if (SDL_HelperWindow == NULL) {
+ UnregisterClass(SDL_HelperWindowClassName, hInstance);
+ return WIN_SetError("Unable to create Helper Window");
+ }
+
+ return 0;
+}
+
+
+/*
+ * Destroys the HelperWindow previously created with SDL_HelperWindowCreate.
+ */
+void
+SDL_HelperWindowDestroy(void)
+{
+ HINSTANCE hInstance = GetModuleHandle(NULL);
+
+ /* Destroy the window. */
+ if (SDL_HelperWindow != NULL) {
+ if (DestroyWindow(SDL_HelperWindow) == 0) {
+ WIN_SetError("Unable to destroy Helper Window");
+ return;
+ }
+ SDL_HelperWindow = NULL;
+ }
+
+ /* Unregister the class. */
+ if (SDL_HelperWindowClass != 0) {
+ if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) {
+ WIN_SetError("Unable to destroy Helper Window Class");
+ return;
+ }
+ SDL_HelperWindowClass = 0;
+ }
+}
+
+void WIN_OnWindowEnter(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (!data || !data->hwnd) {
+ /* The window wasn't fully initialized */
+ return;
+ }
+
+ if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) {
+ WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
+
+#ifdef WM_MOUSELEAVE
+ {
+ TRACKMOUSEEVENT trackMouseEvent;
+
+ trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
+ trackMouseEvent.dwFlags = TME_LEAVE;
+ trackMouseEvent.hwndTrack = data->hwnd;
+
+ TrackMouseEvent(&trackMouseEvent);
+ }
+#endif /* WM_MOUSELEAVE */
+}
+
+void
+WIN_UpdateClipCursor(SDL_Window *window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ if (data->focus_click_pending) {
+ return;
+ }
+
+ if ((mouse->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
+ (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
+ if (mouse->relative_mode && !mouse->relative_mode_warp) {
+ LONG cx, cy;
+ RECT rect;
+ GetWindowRect(data->hwnd, &rect);
+
+ cx = (rect.left + rect.right) / 2;
+ cy = (rect.top + rect.bottom) / 2;
+
+ /* Make an absurdly small clip rect */
+ rect.left = cx - 1;
+ rect.right = cx + 1;
+ rect.top = cy - 1;
+ rect.bottom = cy + 1;
+
+ ClipCursor(&rect);
+ } else {
+ RECT rect;
+ if (GetClientRect(data->hwnd, &rect) && !IsRectEmpty(&rect)) {
+ ClientToScreen(data->hwnd, (LPPOINT) & rect);
+ ClientToScreen(data->hwnd, (LPPOINT) & rect + 1);
+ ClipCursor(&rect);
+ }
+ }
+ } else {
+ ClipCursor(NULL);
+ }
+}
+
+int
+WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
+{
+ return 0; /* just succeed, the real work is done elsewhere. */
+}
+
+int
+WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
+{
+ const SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ const HWND hwnd = data->hwnd;
+ const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
+
+ SDL_assert(style != 0);
+
+ if (opacity == 1.0f) {
+ /* want it fully opaque, just mark it unlayered if necessary. */
+ if (style & WS_EX_LAYERED) {
+ if (SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_LAYERED) == 0) {
+ return WIN_SetError("SetWindowLong()");
+ }
+ }
+ } else {
+ const BYTE alpha = (BYTE) ((int) (opacity * 255.0f));
+ /* want it transparent, mark it layered if necessary. */
+ if ((style & WS_EX_LAYERED) == 0) {
+ if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) {
+ return WIN_SetError("SetWindowLong()");
+ }
+ }
+
+ if (SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA) == 0) {
+ return WIN_SetError("SetLayeredWindowAttributes()");
+ }
+ }
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINDOWS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.h b/src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.h
new file mode 100644
index 0000000..0325abb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/SDL_windowswindow.h
@@ -0,0 +1,84 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_windowswindow_h_
+#define SDL_windowswindow_h_
+
+#if SDL_VIDEO_OPENGL_EGL
+#include "../SDL_egl_c.h"
+#endif
+
+typedef struct
+{
+ SDL_Window *window;
+ HWND hwnd;
+ HWND parent;
+ HDC hdc;
+ HDC mdc;
+ HINSTANCE hinstance;
+ HBITMAP hbm;
+ WNDPROC wndproc;
+ SDL_bool created;
+ WPARAM mouse_button_flags;
+ SDL_bool initializing;
+ SDL_bool expected_resize;
+ SDL_bool in_border_change;
+ SDL_bool in_title_click;
+ Uint8 focus_click_pending;
+ SDL_bool windowed_mode_was_maximized;
+ SDL_bool in_window_deactivation;
+ struct SDL_VideoData *videodata;
+#if SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+} SDL_WindowData;
+
+extern int WIN_CreateWindow(_THIS, SDL_Window * window);
+extern int WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+extern void WIN_SetWindowTitle(_THIS, SDL_Window * window);
+extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+extern void WIN_SetWindowPosition(_THIS, SDL_Window * window);
+extern void WIN_SetWindowSize(_THIS, SDL_Window * window);
+extern int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
+extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
+extern void WIN_ShowWindow(_THIS, SDL_Window * window);
+extern void WIN_HideWindow(_THIS, SDL_Window * window);
+extern void WIN_RaiseWindow(_THIS, SDL_Window * window);
+extern void WIN_MaximizeWindow(_THIS, SDL_Window * window);
+extern void WIN_MinimizeWindow(_THIS, SDL_Window * window);
+extern void WIN_RestoreWindow(_THIS, SDL_Window * window);
+extern void WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
+extern void WIN_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable);
+extern void WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+extern int WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
+extern int WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
+extern void WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+extern void WIN_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+extern void WIN_OnWindowEnter(_THIS, SDL_Window * window);
+extern void WIN_UpdateClipCursor(SDL_Window *window);
+extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
+
+#endif /* SDL_windowswindow_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/windows/wmmsg.h b/src/3rdparty/SDL2/src/video/windows/wmmsg.h
new file mode 100644
index 0000000..19c1bf4
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/windows/wmmsg.h
@@ -0,0 +1,1052 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#define MAX_WMMSG (sizeof(wmtab)/sizeof(wmtab[0]))
+
+char *wmtab[] = {
+ "WM_NULL",
+ "WM_CREATE",
+ "WM_DESTROY",
+ "WM_MOVE",
+ "UNKNOWN (4)",
+ "WM_SIZE",
+ "WM_ACTIVATE",
+ "WM_SETFOCUS",
+ "WM_KILLFOCUS",
+ "UNKNOWN (9)",
+ "WM_ENABLE",
+ "WM_SETREDRAW",
+ "WM_SETTEXT",
+ "WM_GETTEXT",
+ "WM_GETTEXTLENGTH",
+ "WM_PAINT",
+ "WM_CLOSE",
+ "WM_QUERYENDSESSION",
+ "WM_QUIT",
+ "WM_QUERYOPEN",
+ "WM_ERASEBKGND",
+ "WM_SYSCOLORCHANGE",
+ "WM_ENDSESSION",
+ "UNKNOWN (23)",
+ "WM_SHOWWINDOW",
+ "UNKNOWN (25)",
+ "WM_SETTINGCHANGE",
+ "WM_DEVMODECHANGE",
+ "WM_ACTIVATEAPP",
+ "WM_FONTCHANGE",
+ "WM_TIMECHANGE",
+ "WM_CANCELMODE",
+ "WM_SETCURSOR",
+ "WM_MOUSEACTIVATE",
+ "WM_CHILDACTIVATE",
+ "WM_QUEUESYNC",
+ "WM_GETMINMAXINFO",
+ "UNKNOWN (37)",
+ "WM_PAINTICON",
+ "WM_ICONERASEBKGND",
+ "WM_NEXTDLGCTL",
+ "UNKNOWN (41)",
+ "WM_SPOOLERSTATUS",
+ "WM_DRAWITEM",
+ "WM_MEASUREITEM",
+ "WM_DELETEITEM",
+ "WM_VKEYTOITEM",
+ "WM_CHARTOITEM",
+ "WM_SETFONT",
+ "WM_GETFONT",
+ "WM_SETHOTKEY",
+ "WM_GETHOTKEY",
+ "UNKNOWN (52)",
+ "UNKNOWN (53)",
+ "UNKNOWN (54)",
+ "WM_QUERYDRAGICON",
+ "UNKNOWN (56)",
+ "WM_COMPAREITEM",
+ "UNKNOWN (58)",
+ "UNKNOWN (59)",
+ "UNKNOWN (60)",
+ "WM_GETOBJECT",
+ "UNKNOWN (62)",
+ "UNKNOWN (63)",
+ "UNKNOWN (64)",
+ "WM_COMPACTING",
+ "UNKNOWN (66)",
+ "UNKNOWN (67)",
+ "WM_COMMNOTIFY",
+ "UNKNOWN (69)",
+ "WM_WINDOWPOSCHANGING",
+ "WM_WINDOWPOSCHANGED",
+ "WM_POWER",
+ "UNKNOWN (73)",
+ "WM_COPYDATA",
+ "WM_CANCELJOURNAL",
+ "UNKNOWN (76)",
+ "UNKNOWN (77)",
+ "WM_NOTIFY",
+ "UNKNOWN (79)",
+ "WM_INPUTLANGCHANGEREQUEST",
+ "WM_INPUTLANGCHANGE",
+ "WM_TCARD",
+ "WM_HELP",
+ "WM_USERCHANGED",
+ "WM_NOTIFYFORMAT",
+ "UNKNOWN (86)",
+ "UNKNOWN (87)",
+ "UNKNOWN (88)",
+ "UNKNOWN (89)",
+ "UNKNOWN (90)",
+ "UNKNOWN (91)",
+ "UNKNOWN (92)",
+ "UNKNOWN (93)",
+ "UNKNOWN (94)",
+ "UNKNOWN (95)",
+ "UNKNOWN (96)",
+ "UNKNOWN (97)",
+ "UNKNOWN (98)",
+ "UNKNOWN (99)",
+ "UNKNOWN (100)",
+ "UNKNOWN (101)",
+ "UNKNOWN (102)",
+ "UNKNOWN (103)",
+ "UNKNOWN (104)",
+ "UNKNOWN (105)",
+ "UNKNOWN (106)",
+ "UNKNOWN (107)",
+ "UNKNOWN (108)",
+ "UNKNOWN (109)",
+ "UNKNOWN (110)",
+ "UNKNOWN (111)",
+ "UNKNOWN (112)",
+ "UNKNOWN (113)",
+ "UNKNOWN (114)",
+ "UNKNOWN (115)",
+ "UNKNOWN (116)",
+ "UNKNOWN (117)",
+ "UNKNOWN (118)",
+ "UNKNOWN (119)",
+ "UNKNOWN (120)",
+ "UNKNOWN (121)",
+ "UNKNOWN (122)",
+ "WM_CONTEXTMENU",
+ "WM_STYLECHANGING",
+ "WM_STYLECHANGED",
+ "WM_DISPLAYCHANGE",
+ "WM_GETICON",
+ "WM_SETICON",
+ "WM_NCCREATE",
+ "WM_NCDESTROY",
+ "WM_NCCALCSIZE",
+ "WM_NCHITTEST",
+ "WM_NCPAINT",
+ "WM_NCACTIVATE",
+ "WM_GETDLGCODE",
+ "WM_SYNCPAINT",
+ "UNKNOWN (137)",
+ "UNKNOWN (138)",
+ "UNKNOWN (139)",
+ "UNKNOWN (140)",
+ "UNKNOWN (141)",
+ "UNKNOWN (142)",
+ "UNKNOWN (143)",
+ "UNKNOWN (144)",
+ "UNKNOWN (145)",
+ "UNKNOWN (146)",
+ "UNKNOWN (147)",
+ "UNKNOWN (148)",
+ "UNKNOWN (149)",
+ "UNKNOWN (150)",
+ "UNKNOWN (151)",
+ "UNKNOWN (152)",
+ "UNKNOWN (153)",
+ "UNKNOWN (154)",
+ "UNKNOWN (155)",
+ "UNKNOWN (156)",
+ "UNKNOWN (157)",
+ "UNKNOWN (158)",
+ "UNKNOWN (159)",
+ "WM_NCMOUSEMOVE",
+ "WM_NCLBUTTONDOWN",
+ "WM_NCLBUTTONUP",
+ "WM_NCLBUTTONDBLCLK",
+ "WM_NCRBUTTONDOWN",
+ "WM_NCRBUTTONUP",
+ "WM_NCRBUTTONDBLCLK",
+ "WM_NCMBUTTONDOWN",
+ "WM_NCMBUTTONUP",
+ "WM_NCMBUTTONDBLCLK",
+ "UNKNOWN (170)",
+ "WM_NCXBUTTONDOWN",
+ "WM_NCXBUTTONUP",
+ "WM_NCXBUTTONDBLCLK",
+ "WM_NCUAHDRAWCAPTION",
+ "WM_NCUAHDRAWFRAME",
+ "UNKNOWN (176)",
+ "UNKNOWN (177)",
+ "UNKNOWN (178)",
+ "UNKNOWN (179)",
+ "UNKNOWN (180)",
+ "UNKNOWN (181)",
+ "UNKNOWN (182)",
+ "UNKNOWN (183)",
+ "UNKNOWN (184)",
+ "UNKNOWN (185)",
+ "UNKNOWN (186)",
+ "UNKNOWN (187)",
+ "UNKNOWN (188)",
+ "UNKNOWN (189)",
+ "UNKNOWN (190)",
+ "UNKNOWN (191)",
+ "UNKNOWN (192)",
+ "UNKNOWN (193)",
+ "UNKNOWN (194)",
+ "UNKNOWN (195)",
+ "UNKNOWN (196)",
+ "UNKNOWN (197)",
+ "UNKNOWN (198)",
+ "UNKNOWN (199)",
+ "UNKNOWN (200)",
+ "UNKNOWN (201)",
+ "UNKNOWN (202)",
+ "UNKNOWN (203)",
+ "UNKNOWN (204)",
+ "UNKNOWN (205)",
+ "UNKNOWN (206)",
+ "UNKNOWN (207)",
+ "UNKNOWN (208)",
+ "UNKNOWN (209)",
+ "UNKNOWN (210)",
+ "UNKNOWN (211)",
+ "UNKNOWN (212)",
+ "UNKNOWN (213)",
+ "UNKNOWN (214)",
+ "UNKNOWN (215)",
+ "UNKNOWN (216)",
+ "UNKNOWN (217)",
+ "UNKNOWN (218)",
+ "UNKNOWN (219)",
+ "UNKNOWN (220)",
+ "UNKNOWN (221)",
+ "UNKNOWN (222)",
+ "UNKNOWN (223)",
+ "UNKNOWN (224)",
+ "UNKNOWN (225)",
+ "UNKNOWN (226)",
+ "UNKNOWN (227)",
+ "UNKNOWN (228)",
+ "UNKNOWN (229)",
+ "UNKNOWN (230)",
+ "UNKNOWN (231)",
+ "UNKNOWN (232)",
+ "UNKNOWN (233)",
+ "UNKNOWN (234)",
+ "UNKNOWN (235)",
+ "UNKNOWN (236)",
+ "UNKNOWN (237)",
+ "UNKNOWN (238)",
+ "UNKNOWN (239)",
+ "UNKNOWN (240)",
+ "UNKNOWN (241)",
+ "UNKNOWN (242)",
+ "UNKNOWN (243)",
+ "UNKNOWN (244)",
+ "UNKNOWN (245)",
+ "UNKNOWN (246)",
+ "UNKNOWN (247)",
+ "UNKNOWN (248)",
+ "UNKNOWN (249)",
+ "UNKNOWN (250)",
+ "UNKNOWN (251)",
+ "UNKNOWN (252)",
+ "UNKNOWN (253)",
+ "UNKNOWN (254)",
+ "WM_INPUT",
+ "WM_KEYDOWN",
+ "WM_KEYUP",
+ "WM_CHAR",
+ "WM_DEADCHAR",
+ "WM_SYSKEYDOWN",
+ "WM_SYSKEYUP",
+ "WM_SYSCHAR",
+ "WM_SYSDEADCHAR",
+ "WM_KEYLAST",
+ "UNKNOWN (265)",
+ "UNKNOWN (266)",
+ "UNKNOWN (267)",
+ "UNKNOWN (268)",
+ "UNKNOWN (269)",
+ "UNKNOWN (270)",
+ "UNKNOWN (271)",
+ "WM_INITDIALOG",
+ "WM_COMMAND",
+ "WM_SYSCOMMAND",
+ "WM_TIMER",
+ "WM_HSCROLL",
+ "WM_VSCROLL",
+ "WM_INITMENU",
+ "WM_INITMENUPOPUP",
+ "UNKNOWN (280)",
+ "WM_GESTURE",
+ "UNKNOWN (282)",
+ "UNKNOWN (283)",
+ "UNKNOWN (284)",
+ "UNKNOWN (285)",
+ "UNKNOWN (286)",
+ "WM_MENUSELECT",
+ "WM_MENUCHAR",
+ "WM_ENTERIDLE",
+ "WM_MENURBUTTONUP",
+ "WM_MENUDRAG",
+ "WM_MENUGETOBJECT",
+ "WM_UNINITMENUPOPUP",
+ "WM_MENUCOMMAND",
+ "UNKNOWN (295)",
+ "UNKNOWN (296)",
+ "UNKNOWN (297)",
+ "UNKNOWN (298)",
+ "UNKNOWN (299)",
+ "UNKNOWN (300)",
+ "UNKNOWN (301)",
+ "UNKNOWN (302)",
+ "UNKNOWN (303)",
+ "UNKNOWN (304)",
+ "UNKNOWN (305)",
+ "WM_CTLCOLORMSGBOX",
+ "WM_CTLCOLOREDIT",
+ "WM_CTLCOLORLISTBOX",
+ "WM_CTLCOLORBTN",
+ "WM_CTLCOLORDLG",
+ "WM_CTLCOLORSCROLLBAR",
+ "WM_CTLCOLORSTATIC",
+ "UNKNOWN (313)",
+ "UNKNOWN (314)",
+ "UNKNOWN (315)",
+ "UNKNOWN (316)",
+ "UNKNOWN (317)",
+ "UNKNOWN (318)",
+ "UNKNOWN (319)",
+ "UNKNOWN (320)",
+ "UNKNOWN (321)",
+ "UNKNOWN (322)",
+ "UNKNOWN (323)",
+ "UNKNOWN (324)",
+ "UNKNOWN (325)",
+ "UNKNOWN (326)",
+ "UNKNOWN (327)",
+ "UNKNOWN (328)",
+ "UNKNOWN (329)",
+ "UNKNOWN (330)",
+ "UNKNOWN (331)",
+ "UNKNOWN (332)",
+ "UNKNOWN (333)",
+ "UNKNOWN (334)",
+ "UNKNOWN (335)",
+ "UNKNOWN (336)",
+ "UNKNOWN (337)",
+ "UNKNOWN (338)",
+ "UNKNOWN (339)",
+ "UNKNOWN (340)",
+ "UNKNOWN (341)",
+ "UNKNOWN (342)",
+ "UNKNOWN (343)",
+ "UNKNOWN (344)",
+ "UNKNOWN (345)",
+ "UNKNOWN (346)",
+ "UNKNOWN (347)",
+ "UNKNOWN (348)",
+ "UNKNOWN (349)",
+ "UNKNOWN (350)",
+ "UNKNOWN (351)",
+ "UNKNOWN (352)",
+ "UNKNOWN (353)",
+ "UNKNOWN (354)",
+ "UNKNOWN (355)",
+ "UNKNOWN (356)",
+ "UNKNOWN (357)",
+ "UNKNOWN (358)",
+ "UNKNOWN (359)",
+ "UNKNOWN (360)",
+ "UNKNOWN (361)",
+ "UNKNOWN (362)",
+ "UNKNOWN (363)",
+ "UNKNOWN (364)",
+ "UNKNOWN (365)",
+ "UNKNOWN (366)",
+ "UNKNOWN (367)",
+ "UNKNOWN (368)",
+ "UNKNOWN (369)",
+ "UNKNOWN (370)",
+ "UNKNOWN (371)",
+ "UNKNOWN (372)",
+ "UNKNOWN (373)",
+ "UNKNOWN (374)",
+ "UNKNOWN (375)",
+ "UNKNOWN (376)",
+ "UNKNOWN (377)",
+ "UNKNOWN (378)",
+ "UNKNOWN (379)",
+ "UNKNOWN (380)",
+ "UNKNOWN (381)",
+ "UNKNOWN (382)",
+ "UNKNOWN (383)",
+ "UNKNOWN (384)",
+ "UNKNOWN (385)",
+ "UNKNOWN (386)",
+ "UNKNOWN (387)",
+ "UNKNOWN (388)",
+ "UNKNOWN (389)",
+ "UNKNOWN (390)",
+ "UNKNOWN (391)",
+ "UNKNOWN (392)",
+ "UNKNOWN (393)",
+ "UNKNOWN (394)",
+ "UNKNOWN (395)",
+ "UNKNOWN (396)",
+ "UNKNOWN (397)",
+ "UNKNOWN (398)",
+ "UNKNOWN (399)",
+ "UNKNOWN (400)",
+ "UNKNOWN (401)",
+ "UNKNOWN (402)",
+ "UNKNOWN (403)",
+ "UNKNOWN (404)",
+ "UNKNOWN (405)",
+ "UNKNOWN (406)",
+ "UNKNOWN (407)",
+ "UNKNOWN (408)",
+ "UNKNOWN (409)",
+ "UNKNOWN (410)",
+ "UNKNOWN (411)",
+ "UNKNOWN (412)",
+ "UNKNOWN (413)",
+ "UNKNOWN (414)",
+ "UNKNOWN (415)",
+ "UNKNOWN (416)",
+ "UNKNOWN (417)",
+ "UNKNOWN (418)",
+ "UNKNOWN (419)",
+ "UNKNOWN (420)",
+ "UNKNOWN (421)",
+ "UNKNOWN (422)",
+ "UNKNOWN (423)",
+ "UNKNOWN (424)",
+ "UNKNOWN (425)",
+ "UNKNOWN (426)",
+ "UNKNOWN (427)",
+ "UNKNOWN (428)",
+ "UNKNOWN (429)",
+ "UNKNOWN (430)",
+ "UNKNOWN (431)",
+ "UNKNOWN (432)",
+ "UNKNOWN (433)",
+ "UNKNOWN (434)",
+ "UNKNOWN (435)",
+ "UNKNOWN (436)",
+ "UNKNOWN (437)",
+ "UNKNOWN (438)",
+ "UNKNOWN (439)",
+ "UNKNOWN (440)",
+ "UNKNOWN (441)",
+ "UNKNOWN (442)",
+ "UNKNOWN (443)",
+ "UNKNOWN (444)",
+ "UNKNOWN (445)",
+ "UNKNOWN (446)",
+ "UNKNOWN (447)",
+ "UNKNOWN (448)",
+ "UNKNOWN (449)",
+ "UNKNOWN (450)",
+ "UNKNOWN (451)",
+ "UNKNOWN (452)",
+ "UNKNOWN (453)",
+ "UNKNOWN (454)",
+ "UNKNOWN (455)",
+ "UNKNOWN (456)",
+ "UNKNOWN (457)",
+ "UNKNOWN (458)",
+ "UNKNOWN (459)",
+ "UNKNOWN (460)",
+ "UNKNOWN (461)",
+ "UNKNOWN (462)",
+ "UNKNOWN (463)",
+ "UNKNOWN (464)",
+ "UNKNOWN (465)",
+ "UNKNOWN (466)",
+ "UNKNOWN (467)",
+ "UNKNOWN (468)",
+ "UNKNOWN (469)",
+ "UNKNOWN (470)",
+ "UNKNOWN (471)",
+ "UNKNOWN (472)",
+ "UNKNOWN (473)",
+ "UNKNOWN (474)",
+ "UNKNOWN (475)",
+ "UNKNOWN (476)",
+ "UNKNOWN (477)",
+ "UNKNOWN (478)",
+ "UNKNOWN (479)",
+ "UNKNOWN (480)",
+ "UNKNOWN (481)",
+ "UNKNOWN (482)",
+ "UNKNOWN (483)",
+ "UNKNOWN (484)",
+ "UNKNOWN (485)",
+ "UNKNOWN (486)",
+ "UNKNOWN (487)",
+ "UNKNOWN (488)",
+ "UNKNOWN (489)",
+ "UNKNOWN (490)",
+ "UNKNOWN (491)",
+ "UNKNOWN (492)",
+ "UNKNOWN (493)",
+ "UNKNOWN (494)",
+ "UNKNOWN (495)",
+ "UNKNOWN (496)",
+ "UNKNOWN (497)",
+ "UNKNOWN (498)",
+ "UNKNOWN (499)",
+ "UNKNOWN (500)",
+ "UNKNOWN (501)",
+ "UNKNOWN (502)",
+ "UNKNOWN (503)",
+ "UNKNOWN (504)",
+ "UNKNOWN (505)",
+ "UNKNOWN (506)",
+ "UNKNOWN (507)",
+ "UNKNOWN (508)",
+ "UNKNOWN (509)",
+ "UNKNOWN (510)",
+ "UNKNOWN (511)",
+ "WM_MOUSEMOVE",
+ "WM_LBUTTONDOWN",
+ "WM_LBUTTONUP",
+ "WM_LBUTTONDBLCLK",
+ "WM_RBUTTONDOWN",
+ "WM_RBUTTONUP",
+ "WM_RBUTTONDBLCLK",
+ "WM_MBUTTONDOWN",
+ "WM_MBUTTONUP",
+ "WM_MOUSELAST",
+ "WM_MOUSEWHEEL",
+ "WM_XBUTTONDOWN",
+ "WM_XBUTTONUP",
+ "UNKNOWN (525)",
+ "UNKNOWN (526)",
+ "UNKNOWN (527)",
+ "WM_PARENTNOTIFY",
+ "WM_ENTERMENULOOP",
+ "WM_EXITMENULOOP",
+ "WM_NEXTMENU",
+ "WM_SIZING",
+ "WM_CAPTURECHANGED",
+ "WM_MOVING",
+ "UNKNOWN (535)",
+ "WM_POWERBROADCAST",
+ "WM_DEVICECHANGE",
+ "UNKNOWN (538)",
+ "UNKNOWN (539)",
+ "UNKNOWN (540)",
+ "UNKNOWN (541)",
+ "UNKNOWN (542)",
+ "UNKNOWN (543)",
+ "WM_MDICREATE",
+ "WM_MDIDESTROY",
+ "WM_MDIACTIVATE",
+ "WM_MDIRESTORE",
+ "WM_MDINEXT",
+ "WM_MDIMAXIMIZE",
+ "WM_MDITILE",
+ "WM_MDICASCADE",
+ "WM_MDIICONARRANGE",
+ "WM_MDIGETACTIVE",
+ "UNKNOWN (554)",
+ "UNKNOWN (555)",
+ "UNKNOWN (556)",
+ "UNKNOWN (557)",
+ "UNKNOWN (558)",
+ "UNKNOWN (559)",
+ "WM_MDISETMENU",
+ "WM_ENTERSIZEMOVE",
+ "WM_EXITSIZEMOVE",
+ "WM_DROPFILES",
+ "WM_MDIREFRESHMENU",
+ "UNKNOWN (565)",
+ "UNKNOWN (566)",
+ "UNKNOWN (567)",
+ "WM_POINTERDEVICECHANGE",
+ "WM_POINTERDEVICEINRANGE",
+ "WM_POINTERDEVICEOUTOFRANGE",
+ "UNKNOWN (571)",
+ "UNKNOWN (572)",
+ "UNKNOWN (573)",
+ "UNKNOWN (574)",
+ "UNKNOWN (575)",
+ "WM_TOUCH",
+ "WM_NCPOINTERUPDATE",
+ "WM_NCPOINTERDOWN",
+ "WM_NCPOINTERUP",
+ "UNKNOWN (580)",
+ "WM_POINTERUPDATE",
+ "WM_POINTERDOWN",
+ "WM_POINTERUP",
+ "WM_POINTERENTER",
+ "WM_POINTERLEAVE",
+ "WM_POINTERACTIVATE",
+ "WM_POINTERCAPTURECHANGED",
+ "WM_TOUCHHITTESTING",
+ "WM_POINTERWHEEL",
+ "WM_POINTERHWHEEL",
+ "DM_POINTERHITTEST",
+ "UNKNOWN (592)",
+ "UNKNOWN (593)",
+ "UNKNOWN (594)",
+ "UNKNOWN (595)",
+ "UNKNOWN (596)",
+ "UNKNOWN (597)",
+ "UNKNOWN (598)",
+ "UNKNOWN (599)",
+ "UNKNOWN (600)",
+ "UNKNOWN (601)",
+ "UNKNOWN (602)",
+ "UNKNOWN (603)",
+ "UNKNOWN (604)",
+ "UNKNOWN (605)",
+ "UNKNOWN (606)",
+ "UNKNOWN (607)",
+ "UNKNOWN (608)",
+ "UNKNOWN (609)",
+ "UNKNOWN (610)",
+ "UNKNOWN (611)",
+ "UNKNOWN (612)",
+ "UNKNOWN (613)",
+ "UNKNOWN (614)",
+ "UNKNOWN (615)",
+ "UNKNOWN (616)",
+ "UNKNOWN (617)",
+ "UNKNOWN (618)",
+ "UNKNOWN (619)",
+ "UNKNOWN (620)",
+ "UNKNOWN (621)",
+ "UNKNOWN (622)",
+ "UNKNOWN (623)",
+ "UNKNOWN (624)",
+ "UNKNOWN (625)",
+ "UNKNOWN (626)",
+ "UNKNOWN (627)",
+ "UNKNOWN (628)",
+ "UNKNOWN (629)",
+ "UNKNOWN (630)",
+ "UNKNOWN (631)",
+ "UNKNOWN (632)",
+ "UNKNOWN (633)",
+ "UNKNOWN (634)",
+ "UNKNOWN (635)",
+ "UNKNOWN (636)",
+ "UNKNOWN (637)",
+ "UNKNOWN (638)",
+ "UNKNOWN (639)",
+ "UNKNOWN (640)",
+ "WM_IME_SETCONTEXT",
+ "WM_IME_NOTIFY",
+ "WM_IME_CONTROL",
+ "WM_IME_COMPOSITIONFULL",
+ "WM_IME_SELECT",
+ "WM_IME_CHAR",
+ "UNKNOWN (647)",
+ "WM_IME_REQUEST",
+ "UNKNOWN (649)",
+ "UNKNOWN (650)",
+ "UNKNOWN (651)",
+ "UNKNOWN (652)",
+ "UNKNOWN (653)",
+ "UNKNOWN (654)",
+ "UNKNOWN (655)",
+ "WM_IME_KEYDOWN",
+ "WM_IME_KEYUP",
+ "UNKNOWN (658)",
+ "UNKNOWN (659)",
+ "UNKNOWN (660)",
+ "UNKNOWN (661)",
+ "UNKNOWN (662)",
+ "UNKNOWN (663)",
+ "UNKNOWN (664)",
+ "UNKNOWN (665)",
+ "UNKNOWN (666)",
+ "UNKNOWN (667)",
+ "UNKNOWN (668)",
+ "UNKNOWN (669)",
+ "UNKNOWN (670)",
+ "UNKNOWN (671)",
+ "WM_NCMOUSEHOVER",
+ "WM_MOUSEHOVER",
+ "WM_NCMOUSELEAVE",
+ "WM_MOUSELEAVE",
+ "UNKNOWN (676)",
+ "UNKNOWN (677)",
+ "UNKNOWN (678)",
+ "UNKNOWN (679)",
+ "UNKNOWN (680)",
+ "UNKNOWN (681)",
+ "UNKNOWN (682)",
+ "UNKNOWN (683)",
+ "UNKNOWN (684)",
+ "UNKNOWN (685)",
+ "UNKNOWN (686)",
+ "UNKNOWN (687)",
+ "UNKNOWN (688)",
+ "WM_WTSSESSION_CHANGE",
+ "UNKNOWN (690)",
+ "UNKNOWN (691)",
+ "UNKNOWN (692)",
+ "UNKNOWN (693)",
+ "UNKNOWN (694)",
+ "UNKNOWN (695)",
+ "UNKNOWN (696)",
+ "UNKNOWN (697)",
+ "UNKNOWN (698)",
+ "UNKNOWN (699)",
+ "UNKNOWN (700)",
+ "UNKNOWN (701)",
+ "UNKNOWN (702)",
+ "UNKNOWN (703)",
+ "UNKNOWN (704)",
+ "UNKNOWN (705)",
+ "UNKNOWN (706)",
+ "UNKNOWN (707)",
+ "UNKNOWN (708)",
+ "UNKNOWN (709)",
+ "UNKNOWN (710)",
+ "UNKNOWN (711)",
+ "UNKNOWN (712)",
+ "UNKNOWN (713)",
+ "UNKNOWN (714)",
+ "UNKNOWN (715)",
+ "UNKNOWN (716)",
+ "UNKNOWN (717)",
+ "UNKNOWN (718)",
+ "UNKNOWN (719)",
+ "UNKNOWN (720)",
+ "UNKNOWN (721)",
+ "UNKNOWN (722)",
+ "UNKNOWN (723)",
+ "UNKNOWN (724)",
+ "UNKNOWN (725)",
+ "UNKNOWN (726)",
+ "UNKNOWN (727)",
+ "UNKNOWN (728)",
+ "UNKNOWN (729)",
+ "UNKNOWN (730)",
+ "UNKNOWN (731)",
+ "UNKNOWN (732)",
+ "UNKNOWN (733)",
+ "UNKNOWN (734)",
+ "UNKNOWN (735)",
+ "WM_DPICHANGED",
+ "UNKNOWN (737)",
+ "UNKNOWN (738)",
+ "UNKNOWN (739)",
+ "UNKNOWN (740)",
+ "UNKNOWN (741)",
+ "UNKNOWN (742)",
+ "UNKNOWN (743)",
+ "UNKNOWN (744)",
+ "UNKNOWN (745)",
+ "UNKNOWN (746)",
+ "UNKNOWN (747)",
+ "UNKNOWN (748)",
+ "UNKNOWN (749)",
+ "UNKNOWN (750)",
+ "UNKNOWN (751)",
+ "UNKNOWN (752)",
+ "UNKNOWN (753)",
+ "UNKNOWN (754)",
+ "UNKNOWN (755)",
+ "UNKNOWN (756)",
+ "UNKNOWN (757)",
+ "UNKNOWN (758)",
+ "UNKNOWN (759)",
+ "UNKNOWN (760)",
+ "UNKNOWN (761)",
+ "UNKNOWN (762)",
+ "UNKNOWN (763)",
+ "UNKNOWN (764)",
+ "UNKNOWN (765)",
+ "UNKNOWN (766)",
+ "UNKNOWN (767)",
+ "WM_CUT",
+ "WM_COPY",
+ "WM_PASTE",
+ "WM_CLEAR",
+ "WM_UNDO",
+ "WM_RENDERFORMAT",
+ "WM_RENDERALLFORMATS",
+ "WM_DESTROYCLIPBOARD",
+ "WM_DRAWCLIPBOARD",
+ "WM_PAINTCLIPBOARD",
+ "WM_VSCROLLCLIPBOARD",
+ "WM_SIZECLIPBOARD",
+ "WM_ASKCBFORMATNAME",
+ "WM_CHANGECBCHAIN",
+ "WM_HSCROLLCLIPBOARD",
+ "WM_QUERYNEWPALETTE",
+ "WM_PALETTEISCHANGING",
+ "WM_PALETTECHANGED",
+ "WM_HOTKEY",
+ "UNKNOWN (787)",
+ "UNKNOWN (788)",
+ "UNKNOWN (789)",
+ "UNKNOWN (790)",
+ "WM_PRINT",
+ "WM_PRINTCLIENT",
+ "WM_APPCOMMAND",
+ "WM_THEMECHANGED",
+ "UNKNOWN (795)",
+ "UNKNOWN (796)",
+ "WM_CLIPBOARDUPDATE",
+ "WM_DWMCOMPOSITIONCHANGED",
+ "WM_DWMNCRENDERINGCHANGED",
+ "WM_DWMCOLORIZATIONCOLORCHANGED",
+ "WM_DWMWINDOWMAXIMIZEDCHANGE",
+ "UNKNOWN (802)",
+ "WM_DWMSENDICONICTHUMBNAIL",
+ "UNKNOWN (804)",
+ "UNKNOWN (805)",
+ "WM_DWMSENDICONICLIVEPREVIEWBITMAP",
+ "UNKNOWN (807)",
+ "UNKNOWN (808)",
+ "UNKNOWN (809)",
+ "UNKNOWN (810)",
+ "UNKNOWN (811)",
+ "UNKNOWN (812)",
+ "UNKNOWN (813)",
+ "UNKNOWN (814)",
+ "UNKNOWN (815)",
+ "UNKNOWN (816)",
+ "UNKNOWN (817)",
+ "UNKNOWN (818)",
+ "UNKNOWN (819)",
+ "UNKNOWN (820)",
+ "UNKNOWN (821)",
+ "UNKNOWN (822)",
+ "UNKNOWN (823)",
+ "UNKNOWN (824)",
+ "UNKNOWN (825)",
+ "UNKNOWN (826)",
+ "UNKNOWN (827)",
+ "UNKNOWN (828)",
+ "UNKNOWN (829)",
+ "UNKNOWN (830)",
+ "WM_GETTITLEBARINFOEX",
+ "UNKNOWN (832)",
+ "UNKNOWN (833)",
+ "UNKNOWN (834)",
+ "UNKNOWN (835)",
+ "UNKNOWN (836)",
+ "UNKNOWN (837)",
+ "UNKNOWN (838)",
+ "UNKNOWN (839)",
+ "UNKNOWN (840)",
+ "UNKNOWN (841)",
+ "UNKNOWN (842)",
+ "UNKNOWN (843)",
+ "UNKNOWN (844)",
+ "UNKNOWN (845)",
+ "UNKNOWN (846)",
+ "UNKNOWN (847)",
+ "UNKNOWN (848)",
+ "UNKNOWN (849)",
+ "UNKNOWN (850)",
+ "UNKNOWN (851)",
+ "UNKNOWN (852)",
+ "UNKNOWN (853)",
+ "UNKNOWN (854)",
+ "UNKNOWN (855)",
+ "WM_HANDHELDFIRST",
+ "UNKNOWN (857)",
+ "UNKNOWN (858)",
+ "UNKNOWN (859)",
+ "UNKNOWN (860)",
+ "UNKNOWN (861)",
+ "UNKNOWN (862)",
+ "WM_HANDHELDLAST",
+ "WM_AFXFIRST",
+ "UNKNOWN (865)",
+ "UNKNOWN (866)",
+ "UNKNOWN (867)",
+ "UNKNOWN (868)",
+ "UNKNOWN (869)",
+ "UNKNOWN (870)",
+ "UNKNOWN (871)",
+ "UNKNOWN (872)",
+ "UNKNOWN (873)",
+ "UNKNOWN (874)",
+ "UNKNOWN (875)",
+ "UNKNOWN (876)",
+ "UNKNOWN (877)",
+ "UNKNOWN (878)",
+ "UNKNOWN (879)",
+ "UNKNOWN (880)",
+ "UNKNOWN (881)",
+ "UNKNOWN (882)",
+ "UNKNOWN (883)",
+ "UNKNOWN (884)",
+ "UNKNOWN (885)",
+ "UNKNOWN (886)",
+ "UNKNOWN (887)",
+ "UNKNOWN (888)",
+ "UNKNOWN (889)",
+ "UNKNOWN (890)",
+ "UNKNOWN (891)",
+ "UNKNOWN (892)",
+ "UNKNOWN (893)",
+ "UNKNOWN (894)",
+ "WM_AFXLAST",
+ "WM_PENWINFIRST",
+ "UNKNOWN (897)",
+ "UNKNOWN (898)",
+ "UNKNOWN (899)",
+ "UNKNOWN (900)",
+ "UNKNOWN (901)",
+ "UNKNOWN (902)",
+ "UNKNOWN (903)",
+ "UNKNOWN (904)",
+ "UNKNOWN (905)",
+ "UNKNOWN (906)",
+ "UNKNOWN (907)",
+ "UNKNOWN (908)",
+ "UNKNOWN (909)",
+ "UNKNOWN (910)",
+ "WM_PENWINLAST",
+ "UNKNOWN (912)",
+ "UNKNOWN (913)",
+ "UNKNOWN (914)",
+ "UNKNOWN (915)",
+ "UNKNOWN (916)",
+ "UNKNOWN (917)",
+ "UNKNOWN (918)",
+ "UNKNOWN (919)",
+ "UNKNOWN (920)",
+ "UNKNOWN (921)",
+ "UNKNOWN (922)",
+ "UNKNOWN (923)",
+ "UNKNOWN (924)",
+ "UNKNOWN (925)",
+ "UNKNOWN (926)",
+ "UNKNOWN (927)",
+ "UNKNOWN (928)",
+ "UNKNOWN (929)",
+ "UNKNOWN (930)",
+ "UNKNOWN (931)",
+ "UNKNOWN (932)",
+ "UNKNOWN (933)",
+ "UNKNOWN (934)",
+ "UNKNOWN (935)",
+ "UNKNOWN (936)",
+ "UNKNOWN (937)",
+ "UNKNOWN (938)",
+ "UNKNOWN (939)",
+ "UNKNOWN (940)",
+ "UNKNOWN (941)",
+ "UNKNOWN (942)",
+ "UNKNOWN (943)",
+ "UNKNOWN (944)",
+ "UNKNOWN (945)",
+ "UNKNOWN (946)",
+ "UNKNOWN (947)",
+ "UNKNOWN (948)",
+ "UNKNOWN (949)",
+ "UNKNOWN (950)",
+ "UNKNOWN (951)",
+ "UNKNOWN (952)",
+ "UNKNOWN (953)",
+ "UNKNOWN (954)",
+ "UNKNOWN (955)",
+ "UNKNOWN (956)",
+ "UNKNOWN (957)",
+ "UNKNOWN (958)",
+ "UNKNOWN (959)",
+ "UNKNOWN (960)",
+ "UNKNOWN (961)",
+ "UNKNOWN (962)",
+ "UNKNOWN (963)",
+ "UNKNOWN (964)",
+ "UNKNOWN (965)",
+ "UNKNOWN (966)",
+ "UNKNOWN (967)",
+ "UNKNOWN (968)",
+ "UNKNOWN (969)",
+ "UNKNOWN (970)",
+ "UNKNOWN (971)",
+ "UNKNOWN (972)",
+ "UNKNOWN (973)",
+ "UNKNOWN (974)",
+ "UNKNOWN (975)",
+ "UNKNOWN (976)",
+ "UNKNOWN (977)",
+ "UNKNOWN (978)",
+ "UNKNOWN (979)",
+ "UNKNOWN (980)",
+ "UNKNOWN (981)",
+ "UNKNOWN (982)",
+ "UNKNOWN (983)",
+ "UNKNOWN (984)",
+ "UNKNOWN (985)",
+ "UNKNOWN (986)",
+ "UNKNOWN (987)",
+ "UNKNOWN (988)",
+ "UNKNOWN (989)",
+ "UNKNOWN (990)",
+ "UNKNOWN (991)",
+ "UNKNOWN (992)",
+ "UNKNOWN (993)",
+ "UNKNOWN (994)",
+ "UNKNOWN (995)",
+ "UNKNOWN (996)",
+ "UNKNOWN (997)",
+ "UNKNOWN (998)",
+ "UNKNOWN (999)",
+ "UNKNOWN (1000)",
+ "UNKNOWN (1001)",
+ "UNKNOWN (1002)",
+ "UNKNOWN (1003)",
+ "UNKNOWN (1004)",
+ "UNKNOWN (1005)",
+ "UNKNOWN (1006)",
+ "UNKNOWN (1007)",
+ "UNKNOWN (1008)",
+ "UNKNOWN (1009)",
+ "UNKNOWN (1010)",
+ "UNKNOWN (1011)",
+ "UNKNOWN (1012)",
+ "UNKNOWN (1013)",
+ "UNKNOWN (1014)",
+ "UNKNOWN (1015)",
+ "UNKNOWN (1016)",
+ "UNKNOWN (1017)",
+ "UNKNOWN (1018)",
+ "UNKNOWN (1019)",
+ "UNKNOWN (1020)",
+ "UNKNOWN (1021)",
+ "UNKNOWN (1022)",
+ "UNKNOWN (1023)",
+ "WM_USER"
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents.cpp
new file mode 100644
index 0000000..370e8c5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents.cpp
@@ -0,0 +1,154 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+/*
+ * Windows includes:
+ */
+#include <Windows.h>
+using namespace Windows::UI::Core;
+using Windows::UI::Core::CoreCursor;
+
+/*
+ * SDL includes:
+ */
+#include "SDL_winrtevents_c.h"
+#include "../../core/winrt/SDL_winrtapp_common.h"
+#include "../../core/winrt/SDL_winrtapp_direct3d.h"
+#include "../../core/winrt/SDL_winrtapp_xaml.h"
+#include "SDL_assert.h"
+#include "SDL_system.h"
+
+extern "C" {
+#include "../../thread/SDL_systhread.h"
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
+}
+
+
+/* Forward declarations */
+static void WINRT_YieldXAMLThread();
+
+
+/* Global event management */
+
+void
+WINRT_PumpEvents(_THIS)
+{
+ if (SDL_WinRTGlobalApp) {
+ SDL_WinRTGlobalApp->PumpEvents();
+ } else if (WINRT_XAMLWasEnabled) {
+ WINRT_YieldXAMLThread();
+ }
+}
+
+
+/* XAML Thread management */
+
+enum SDL_XAMLAppThreadState
+{
+ ThreadState_NotLaunched = 0,
+ ThreadState_Running,
+ ThreadState_Yielding
+};
+
+static SDL_XAMLAppThreadState _threadState = ThreadState_NotLaunched;
+static SDL_Thread * _XAMLThread = nullptr;
+static SDL_mutex * _mutex = nullptr;
+static SDL_cond * _cond = nullptr;
+
+static void
+WINRT_YieldXAMLThread()
+{
+ SDL_LockMutex(_mutex);
+ SDL_assert(_threadState == ThreadState_Running);
+ _threadState = ThreadState_Yielding;
+ SDL_UnlockMutex(_mutex);
+
+ SDL_CondSignal(_cond);
+
+ SDL_LockMutex(_mutex);
+ while (_threadState != ThreadState_Running) {
+ SDL_CondWait(_cond, _mutex);
+ }
+ SDL_UnlockMutex(_mutex);
+}
+
+static int
+WINRT_XAMLThreadMain(void * userdata)
+{
+ // TODO, WinRT: pass the C-style main() a reasonably realistic
+ // representation of command line arguments.
+ int argc = 0;
+ char **argv = NULL;
+ return WINRT_SDLAppEntryPoint(argc, argv);
+}
+
+void
+WINRT_CycleXAMLThread(void)
+{
+ switch (_threadState) {
+ case ThreadState_NotLaunched:
+ {
+ _cond = SDL_CreateCond();
+
+ _mutex = SDL_CreateMutex();
+ _threadState = ThreadState_Running;
+ _XAMLThread = SDL_CreateThreadInternal(WINRT_XAMLThreadMain, "SDL/XAML App Thread", 0, nullptr);
+
+ SDL_LockMutex(_mutex);
+ while (_threadState != ThreadState_Yielding) {
+ SDL_CondWait(_cond, _mutex);
+ }
+ SDL_UnlockMutex(_mutex);
+
+ break;
+ }
+
+ case ThreadState_Running:
+ {
+ SDL_assert(false);
+ break;
+ }
+
+ case ThreadState_Yielding:
+ {
+ SDL_LockMutex(_mutex);
+ SDL_assert(_threadState == ThreadState_Yielding);
+ _threadState = ThreadState_Running;
+ SDL_UnlockMutex(_mutex);
+
+ SDL_CondSignal(_cond);
+
+ SDL_LockMutex(_mutex);
+ while (_threadState != ThreadState_Yielding) {
+ SDL_CondWait(_cond, _mutex);
+ }
+ SDL_UnlockMutex(_mutex);
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINRT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents_c.h b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents_c.h
new file mode 100644
index 0000000..8b346ec
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtevents_c.h
@@ -0,0 +1,82 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+extern "C" {
+#include "../SDL_sysvideo.h"
+}
+
+/*
+ * Internal-use, C-style functions:
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void WINRT_InitTouch(_THIS);
+extern void WINRT_PumpEvents(_THIS);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*
+ * Internal-use, C++/CX functions:
+ */
+#ifdef __cplusplus_winrt
+
+/* Pointers (Mice, Touch, etc.) */
+typedef enum {
+ NormalizeZeroToOne,
+ TransformToSDLWindowSize
+} WINRT_CursorNormalizationType;
+extern Windows::Foundation::Point WINRT_TransformCursorPosition(SDL_Window * window,
+ Windows::Foundation::Point rawPosition,
+ WINRT_CursorNormalizationType normalization);
+extern Uint8 WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^pt);
+extern void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerEnteredEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerExitedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::MouseEventArgs ^args);
+
+/* Keyboard */
+extern void WINRT_ProcessKeyDownEvent(Windows::UI::Core::KeyEventArgs ^args);
+extern void WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args);
+extern void WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArgs ^args);
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+extern SDL_bool WINRT_HasScreenKeyboardSupport(_THIS);
+extern void WINRT_ShowScreenKeyboard(_THIS, SDL_Window *window);
+extern void WINRT_HideScreenKeyboard(_THIS, SDL_Window *window);
+extern SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window);
+#endif // NTDDI_VERSION >= ...
+
+/* XAML Thread Management */
+extern void WINRT_CycleXAMLThread(void);
+
+#endif // ifdef __cplusplus_winrt
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar.cpp
new file mode 100644
index 0000000..9617111
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar.cpp
@@ -0,0 +1,196 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+/* Windows includes */
+#include <roapi.h>
+#include <windows.foundation.h>
+#include <EventToken.h>
+
+
+/* SDL includes */
+extern "C" {
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+}
+#include "SDL_winrtvideo_cpp.h"
+
+
+/* Game Bar events can come in off the main thread. Use the following
+ WinRT CoreDispatcher to deal with them on SDL's thread.
+*/
+static Platform::WeakReference WINRT_MainThreadDispatcher;
+
+
+/* Win10's initial SDK (the 10.0.10240.0 release) does not include references
+ to Game Bar APIs, as the Game Bar was released via Win10 10.0.10586.0.
+
+ Declare its WinRT/COM interface here, to allow compilation with earlier
+ Windows SDKs.
+*/
+MIDL_INTERFACE("1DB9A292-CC78-4173-BE45-B61E67283EA7")
+IGameBarStatics_ : public IInspectable
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE add_VisibilityChanged(
+ __FIEventHandler_1_IInspectable *handler,
+ Windows::Foundation::EventRegistrationToken *token) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE remove_VisibilityChanged(
+ Windows::Foundation::EventRegistrationToken token) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE add_IsInputRedirectedChanged(
+ __FIEventHandler_1_IInspectable *handler,
+ Windows::Foundation::EventRegistrationToken *token) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE remove_IsInputRedirectedChanged(
+ Windows::Foundation::EventRegistrationToken token) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE get_Visible(
+ boolean *value) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE get_IsInputRedirected(
+ boolean *value) = 0;
+};
+
+/* Declare the game bar's COM GUID */
+static GUID IID_IGameBarStatics_ = { MAKELONG(0xA292, 0x1DB9), 0xCC78, 0x4173, { 0xBE, 0x45, 0xB6, 0x1E, 0x67, 0x28, 0x3E, 0xA7 } };
+
+/* Retrieves a pointer to the game bar, or NULL if it is not available.
+ If a pointer is returned, it's ->Release() method must be called
+ after the caller has finished using it.
+*/
+static IGameBarStatics_ *
+WINRT_GetGameBar()
+{
+ wchar_t *wClassName = L"Windows.Gaming.UI.GameBar";
+ HSTRING hClassName;
+ IActivationFactory *pActivationFactory = NULL;
+ IGameBarStatics_ *pGameBar = NULL;
+ HRESULT hr;
+
+ hr = ::WindowsCreateString(wClassName, (UINT32)wcslen(wClassName), &hClassName);
+ if (FAILED(hr)) {
+ goto done;
+ }
+
+ hr = Windows::Foundation::GetActivationFactory(hClassName, &pActivationFactory);
+ if (FAILED(hr)) {
+ goto done;
+ }
+
+ pActivationFactory->QueryInterface(IID_IGameBarStatics_, (void **) &pGameBar);
+
+done:
+ if (pActivationFactory) {
+ pActivationFactory->Release();
+ }
+ if (hClassName) {
+ ::WindowsDeleteString(hClassName);
+ }
+ return pGameBar;
+}
+
+static void
+WINRT_HandleGameBarIsInputRedirected_MainThread()
+{
+ IGameBarStatics_ *gameBar;
+ boolean isInputRedirected = 0;
+ if (!WINRT_MainThreadDispatcher) {
+ /* The game bar event handler has been deregistered! */
+ return;
+ }
+ gameBar = WINRT_GetGameBar();
+ if (!gameBar) {
+ /* Shouldn't happen, but just in case... */
+ return;
+ }
+ if (SUCCEEDED(gameBar->get_IsInputRedirected(&isInputRedirected))) {
+ if ( ! isInputRedirected) {
+ /* Input-control is now back to the SDL app. Restore the cursor,
+ in case Windows does not (it does not in either Win10
+ 10.0.10240.0 or 10.0.10586.0, maybe later version(s) too.
+ */
+ SDL_Cursor *cursor = SDL_GetCursor();
+ SDL_SetCursor(cursor);
+ }
+ }
+ gameBar->Release();
+}
+
+static void
+WINRT_HandleGameBarIsInputRedirected_NonMainThread(Platform::Object ^ o1, Platform::Object ^o2)
+{
+ Windows::UI::Core::CoreDispatcher ^dispatcher = WINRT_MainThreadDispatcher.Resolve<Windows::UI::Core::CoreDispatcher>();
+ if (dispatcher) {
+ dispatcher->RunAsync(
+ Windows::UI::Core::CoreDispatcherPriority::Normal,
+ ref new Windows::UI::Core::DispatchedHandler(&WINRT_HandleGameBarIsInputRedirected_MainThread));
+ }
+}
+
+void
+WINRT_InitGameBar(_THIS)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *)_this->driverdata;
+ IGameBarStatics_ *gameBar = WINRT_GetGameBar();
+ if (gameBar) {
+ /* GameBar.IsInputRedirected events can come in via something other than
+ the main/SDL thread.
+
+ Get a WinRT 'CoreDispatcher' that can be used to call back into the
+ SDL thread.
+ */
+ WINRT_MainThreadDispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher;
+ Windows::Foundation::EventHandler<Platform::Object ^> ^handler = \
+ ref new Windows::Foundation::EventHandler<Platform::Object ^>(&WINRT_HandleGameBarIsInputRedirected_NonMainThread);
+ __FIEventHandler_1_IInspectable * pHandler = reinterpret_cast<__FIEventHandler_1_IInspectable *>(handler);
+ gameBar->add_IsInputRedirectedChanged(pHandler, &driverdata->gameBarIsInputRedirectedToken);
+ gameBar->Release();
+ }
+}
+
+void
+WINRT_QuitGameBar(_THIS)
+{
+ SDL_VideoData *driverdata;
+ IGameBarStatics_ *gameBar;
+ if (!_this || !_this->driverdata) {
+ return;
+ }
+ gameBar = WINRT_GetGameBar();
+ if (!gameBar) {
+ return;
+ }
+ driverdata = (SDL_VideoData *)_this->driverdata;
+ if (driverdata->gameBarIsInputRedirectedToken.Value) {
+ gameBar->remove_IsInputRedirectedChanged(driverdata->gameBarIsInputRedirectedToken);
+ driverdata->gameBarIsInputRedirectedToken.Value = 0;
+ }
+ WINRT_MainThreadDispatcher = nullptr;
+ gameBar->Release();
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINRT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h
new file mode 100644
index 0000000..a3e4777
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h
@@ -0,0 +1,35 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#ifndef SDL_winrtgamebar_h_
+#define SDL_winrtgamebar_h_
+
+#ifdef __cplusplus
+/* These are exported as C++ functions, rather than C, to fix a compilation
+ bug with MSVC 2013, for Windows 8.x builds. */
+extern void WINRT_InitGameBar(_THIS);
+extern void WINRT_QuitGameBar(_THIS);
+#endif
+
+#endif /* SDL_winrtgamebar_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp
new file mode 100644
index 0000000..34f2421
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp
@@ -0,0 +1,430 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+/* Windows-specific includes */
+#include <Windows.h>
+#include <agile.h>
+
+
+/* SDL-specific includes */
+#include "SDL.h"
+#include "SDL_winrtevents_c.h"
+
+extern "C" {
+#include "../../events/scancodes_windows.h"
+#include "../../events/SDL_keyboard_c.h"
+}
+
+
+static SDL_Scancode WinRT_Official_Keycodes[] = {
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.None -- 0 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.LeftButton -- 1 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.RightButton -- 2 */
+ SDL_SCANCODE_CANCEL, /* VirtualKey.Cancel -- 3 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.MiddleButton -- 4 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.XButton1 -- 5 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.XButton2 -- 6 */
+ SDL_SCANCODE_UNKNOWN, /* -- 7 */
+ SDL_SCANCODE_BACKSPACE, /* VirtualKey.Back -- 8 */
+ SDL_SCANCODE_TAB, /* VirtualKey.Tab -- 9 */
+ SDL_SCANCODE_UNKNOWN, /* -- 10 */
+ SDL_SCANCODE_UNKNOWN, /* -- 11 */
+ SDL_SCANCODE_CLEAR, /* VirtualKey.Clear -- 12 */
+ SDL_SCANCODE_RETURN, /* VirtualKey.Enter -- 13 */
+ SDL_SCANCODE_UNKNOWN, /* -- 14 */
+ SDL_SCANCODE_UNKNOWN, /* -- 15 */
+ SDL_SCANCODE_LSHIFT, /* VirtualKey.Shift -- 16 */
+ SDL_SCANCODE_LCTRL, /* VirtualKey.Control -- 17 */
+ SDL_SCANCODE_MENU, /* VirtualKey.Menu -- 18 */
+ SDL_SCANCODE_PAUSE, /* VirtualKey.Pause -- 19 */
+ SDL_SCANCODE_CAPSLOCK, /* VirtualKey.CapitalLock -- 20 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Kana or VirtualKey.Hangul -- 21 */
+ SDL_SCANCODE_UNKNOWN, /* -- 22 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Junja -- 23 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Final -- 24 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Hanja or VirtualKey.Kanji -- 25 */
+ SDL_SCANCODE_UNKNOWN, /* -- 26 */
+ SDL_SCANCODE_ESCAPE, /* VirtualKey.Escape -- 27 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Convert -- 28 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.NonConvert -- 29 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Accept -- 30 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.ModeChange -- 31 (maybe SDL_SCANCODE_MODE ?) */
+ SDL_SCANCODE_SPACE, /* VirtualKey.Space -- 32 */
+ SDL_SCANCODE_PAGEUP, /* VirtualKey.PageUp -- 33 */
+ SDL_SCANCODE_PAGEDOWN, /* VirtualKey.PageDown -- 34 */
+ SDL_SCANCODE_END, /* VirtualKey.End -- 35 */
+ SDL_SCANCODE_HOME, /* VirtualKey.Home -- 36 */
+ SDL_SCANCODE_LEFT, /* VirtualKey.Left -- 37 */
+ SDL_SCANCODE_UP, /* VirtualKey.Up -- 38 */
+ SDL_SCANCODE_RIGHT, /* VirtualKey.Right -- 39 */
+ SDL_SCANCODE_DOWN, /* VirtualKey.Down -- 40 */
+ SDL_SCANCODE_SELECT, /* VirtualKey.Select -- 41 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Print -- 42 (maybe SDL_SCANCODE_PRINTSCREEN ?) */
+ SDL_SCANCODE_EXECUTE, /* VirtualKey.Execute -- 43 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Snapshot -- 44 */
+ SDL_SCANCODE_INSERT, /* VirtualKey.Insert -- 45 */
+ SDL_SCANCODE_DELETE, /* VirtualKey.Delete -- 46 */
+ SDL_SCANCODE_HELP, /* VirtualKey.Help -- 47 */
+ SDL_SCANCODE_0, /* VirtualKey.Number0 -- 48 */
+ SDL_SCANCODE_1, /* VirtualKey.Number1 -- 49 */
+ SDL_SCANCODE_2, /* VirtualKey.Number2 -- 50 */
+ SDL_SCANCODE_3, /* VirtualKey.Number3 -- 51 */
+ SDL_SCANCODE_4, /* VirtualKey.Number4 -- 52 */
+ SDL_SCANCODE_5, /* VirtualKey.Number5 -- 53 */
+ SDL_SCANCODE_6, /* VirtualKey.Number6 -- 54 */
+ SDL_SCANCODE_7, /* VirtualKey.Number7 -- 55 */
+ SDL_SCANCODE_8, /* VirtualKey.Number8 -- 56 */
+ SDL_SCANCODE_9, /* VirtualKey.Number9 -- 57 */
+ SDL_SCANCODE_UNKNOWN, /* -- 58 */
+ SDL_SCANCODE_UNKNOWN, /* -- 59 */
+ SDL_SCANCODE_UNKNOWN, /* -- 60 */
+ SDL_SCANCODE_UNKNOWN, /* -- 61 */
+ SDL_SCANCODE_UNKNOWN, /* -- 62 */
+ SDL_SCANCODE_UNKNOWN, /* -- 63 */
+ SDL_SCANCODE_UNKNOWN, /* -- 64 */
+ SDL_SCANCODE_A, /* VirtualKey.A -- 65 */
+ SDL_SCANCODE_B, /* VirtualKey.B -- 66 */
+ SDL_SCANCODE_C, /* VirtualKey.C -- 67 */
+ SDL_SCANCODE_D, /* VirtualKey.D -- 68 */
+ SDL_SCANCODE_E, /* VirtualKey.E -- 69 */
+ SDL_SCANCODE_F, /* VirtualKey.F -- 70 */
+ SDL_SCANCODE_G, /* VirtualKey.G -- 71 */
+ SDL_SCANCODE_H, /* VirtualKey.H -- 72 */
+ SDL_SCANCODE_I, /* VirtualKey.I -- 73 */
+ SDL_SCANCODE_J, /* VirtualKey.J -- 74 */
+ SDL_SCANCODE_K, /* VirtualKey.K -- 75 */
+ SDL_SCANCODE_L, /* VirtualKey.L -- 76 */
+ SDL_SCANCODE_M, /* VirtualKey.M -- 77 */
+ SDL_SCANCODE_N, /* VirtualKey.N -- 78 */
+ SDL_SCANCODE_O, /* VirtualKey.O -- 79 */
+ SDL_SCANCODE_P, /* VirtualKey.P -- 80 */
+ SDL_SCANCODE_Q, /* VirtualKey.Q -- 81 */
+ SDL_SCANCODE_R, /* VirtualKey.R -- 82 */
+ SDL_SCANCODE_S, /* VirtualKey.S -- 83 */
+ SDL_SCANCODE_T, /* VirtualKey.T -- 84 */
+ SDL_SCANCODE_U, /* VirtualKey.U -- 85 */
+ SDL_SCANCODE_V, /* VirtualKey.V -- 86 */
+ SDL_SCANCODE_W, /* VirtualKey.W -- 87 */
+ SDL_SCANCODE_X, /* VirtualKey.X -- 88 */
+ SDL_SCANCODE_Y, /* VirtualKey.Y -- 89 */
+ SDL_SCANCODE_Z, /* VirtualKey.Z -- 90 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.LeftWindows -- 91 (maybe SDL_SCANCODE_APPLICATION or SDL_SCANCODE_LGUI ?) */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.RightWindows -- 92 (maybe SDL_SCANCODE_APPLICATION or SDL_SCANCODE_RGUI ?) */
+ SDL_SCANCODE_APPLICATION, /* VirtualKey.Application -- 93 */
+ SDL_SCANCODE_UNKNOWN, /* -- 94 */
+ SDL_SCANCODE_SLEEP, /* VirtualKey.Sleep -- 95 */
+ SDL_SCANCODE_KP_0, /* VirtualKey.NumberPad0 -- 96 */
+ SDL_SCANCODE_KP_1, /* VirtualKey.NumberPad1 -- 97 */
+ SDL_SCANCODE_KP_2, /* VirtualKey.NumberPad2 -- 98 */
+ SDL_SCANCODE_KP_3, /* VirtualKey.NumberPad3 -- 99 */
+ SDL_SCANCODE_KP_4, /* VirtualKey.NumberPad4 -- 100 */
+ SDL_SCANCODE_KP_5, /* VirtualKey.NumberPad5 -- 101 */
+ SDL_SCANCODE_KP_6, /* VirtualKey.NumberPad6 -- 102 */
+ SDL_SCANCODE_KP_7, /* VirtualKey.NumberPad7 -- 103 */
+ SDL_SCANCODE_KP_8, /* VirtualKey.NumberPad8 -- 104 */
+ SDL_SCANCODE_KP_9, /* VirtualKey.NumberPad9 -- 105 */
+ SDL_SCANCODE_KP_MULTIPLY, /* VirtualKey.Multiply -- 106 */
+ SDL_SCANCODE_KP_PLUS, /* VirtualKey.Add -- 107 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Separator -- 108 */
+ SDL_SCANCODE_KP_MINUS, /* VirtualKey.Subtract -- 109 */
+ SDL_SCANCODE_UNKNOWN, /* VirtualKey.Decimal -- 110 (maybe SDL_SCANCODE_DECIMALSEPARATOR, SDL_SCANCODE_KP_DECIMAL, or SDL_SCANCODE_KP_PERIOD ?) */
+ SDL_SCANCODE_KP_DIVIDE, /* VirtualKey.Divide -- 111 */
+ SDL_SCANCODE_F1, /* VirtualKey.F1 -- 112 */
+ SDL_SCANCODE_F2, /* VirtualKey.F2 -- 113 */
+ SDL_SCANCODE_F3, /* VirtualKey.F3 -- 114 */
+ SDL_SCANCODE_F4, /* VirtualKey.F4 -- 115 */
+ SDL_SCANCODE_F5, /* VirtualKey.F5 -- 116 */
+ SDL_SCANCODE_F6, /* VirtualKey.F6 -- 117 */
+ SDL_SCANCODE_F7, /* VirtualKey.F7 -- 118 */
+ SDL_SCANCODE_F8, /* VirtualKey.F8 -- 119 */
+ SDL_SCANCODE_F9, /* VirtualKey.F9 -- 120 */
+ SDL_SCANCODE_F10, /* VirtualKey.F10 -- 121 */
+ SDL_SCANCODE_F11, /* VirtualKey.F11 -- 122 */
+ SDL_SCANCODE_F12, /* VirtualKey.F12 -- 123 */
+ SDL_SCANCODE_F13, /* VirtualKey.F13 -- 124 */
+ SDL_SCANCODE_F14, /* VirtualKey.F14 -- 125 */
+ SDL_SCANCODE_F15, /* VirtualKey.F15 -- 126 */
+ SDL_SCANCODE_F16, /* VirtualKey.F16 -- 127 */
+ SDL_SCANCODE_F17, /* VirtualKey.F17 -- 128 */
+ SDL_SCANCODE_F18, /* VirtualKey.F18 -- 129 */
+ SDL_SCANCODE_F19, /* VirtualKey.F19 -- 130 */
+ SDL_SCANCODE_F20, /* VirtualKey.F20 -- 131 */
+ SDL_SCANCODE_F21, /* VirtualKey.F21 -- 132 */
+ SDL_SCANCODE_F22, /* VirtualKey.F22 -- 133 */
+ SDL_SCANCODE_F23, /* VirtualKey.F23 -- 134 */
+ SDL_SCANCODE_F24, /* VirtualKey.F24 -- 135 */
+ SDL_SCANCODE_UNKNOWN, /* -- 136 */
+ SDL_SCANCODE_UNKNOWN, /* -- 137 */
+ SDL_SCANCODE_UNKNOWN, /* -- 138 */
+ SDL_SCANCODE_UNKNOWN, /* -- 139 */
+ SDL_SCANCODE_UNKNOWN, /* -- 140 */
+ SDL_SCANCODE_UNKNOWN, /* -- 141 */
+ SDL_SCANCODE_UNKNOWN, /* -- 142 */
+ SDL_SCANCODE_UNKNOWN, /* -- 143 */
+ SDL_SCANCODE_NUMLOCKCLEAR, /* VirtualKey.NumberKeyLock -- 144 */
+ SDL_SCANCODE_SCROLLLOCK, /* VirtualKey.Scroll -- 145 */
+ SDL_SCANCODE_UNKNOWN, /* -- 146 */
+ SDL_SCANCODE_UNKNOWN, /* -- 147 */
+ SDL_SCANCODE_UNKNOWN, /* -- 148 */
+ SDL_SCANCODE_UNKNOWN, /* -- 149 */
+ SDL_SCANCODE_UNKNOWN, /* -- 150 */
+ SDL_SCANCODE_UNKNOWN, /* -- 151 */
+ SDL_SCANCODE_UNKNOWN, /* -- 152 */
+ SDL_SCANCODE_UNKNOWN, /* -- 153 */
+ SDL_SCANCODE_UNKNOWN, /* -- 154 */
+ SDL_SCANCODE_UNKNOWN, /* -- 155 */
+ SDL_SCANCODE_UNKNOWN, /* -- 156 */
+ SDL_SCANCODE_UNKNOWN, /* -- 157 */
+ SDL_SCANCODE_UNKNOWN, /* -- 158 */
+ SDL_SCANCODE_UNKNOWN, /* -- 159 */
+ SDL_SCANCODE_LSHIFT, /* VirtualKey.LeftShift -- 160 */
+ SDL_SCANCODE_RSHIFT, /* VirtualKey.RightShift -- 161 */
+ SDL_SCANCODE_LCTRL, /* VirtualKey.LeftControl -- 162 */
+ SDL_SCANCODE_RCTRL, /* VirtualKey.RightControl -- 163 */
+ SDL_SCANCODE_MENU, /* VirtualKey.LeftMenu -- 164 */
+ SDL_SCANCODE_MENU, /* VirtualKey.RightMenu -- 165 */
+ SDL_SCANCODE_AC_BACK, /* VirtualKey.GoBack -- 166 : The go back key. */
+ SDL_SCANCODE_AC_FORWARD, /* VirtualKey.GoForward -- 167 : The go forward key. */
+ SDL_SCANCODE_AC_REFRESH, /* VirtualKey.Refresh -- 168 : The refresh key. */
+ SDL_SCANCODE_AC_STOP, /* VirtualKey.Stop -- 169 : The stop key. */
+ SDL_SCANCODE_AC_SEARCH, /* VirtualKey.Search -- 170 : The search key. */
+ SDL_SCANCODE_AC_BOOKMARKS, /* VirtualKey.Favorites -- 171 : The favorites key. */
+ SDL_SCANCODE_AC_HOME /* VirtualKey.GoHome -- 172 : The go home key. */
+};
+
+/* Attempt to translate a keycode that isn't listed in WinRT's VirtualKey enum.
+ */
+static SDL_Scancode
+WINRT_TranslateUnofficialKeycode(int keycode)
+{
+ switch (keycode) {
+ case 173: return SDL_SCANCODE_MUTE; /* VK_VOLUME_MUTE */
+ case 174: return SDL_SCANCODE_VOLUMEDOWN; /* VK_VOLUME_DOWN */
+ case 175: return SDL_SCANCODE_VOLUMEUP; /* VK_VOLUME_UP */
+ case 176: return SDL_SCANCODE_AUDIONEXT; /* VK_MEDIA_NEXT_TRACK */
+ case 177: return SDL_SCANCODE_AUDIOPREV; /* VK_MEDIA_PREV_TRACK */
+ // case 178: return ; /* VK_MEDIA_STOP */
+ case 179: return SDL_SCANCODE_AUDIOPLAY; /* VK_MEDIA_PLAY_PAUSE */
+ case 180: return SDL_SCANCODE_MAIL; /* VK_LAUNCH_MAIL */
+ case 181: return SDL_SCANCODE_MEDIASELECT; /* VK_LAUNCH_MEDIA_SELECT */
+ // case 182: return ; /* VK_LAUNCH_APP1 */
+ case 183: return SDL_SCANCODE_CALCULATOR; /* VK_LAUNCH_APP2 */
+ // case 184: return ; /* ... reserved ... */
+ // case 185: return ; /* ... reserved ... */
+ case 186: return SDL_SCANCODE_SEMICOLON; /* VK_OEM_1, ';:' key on US standard keyboards */
+ case 187: return SDL_SCANCODE_EQUALS; /* VK_OEM_PLUS */
+ case 188: return SDL_SCANCODE_COMMA; /* VK_OEM_COMMA */
+ case 189: return SDL_SCANCODE_MINUS; /* VK_OEM_MINUS */
+ case 190: return SDL_SCANCODE_PERIOD; /* VK_OEM_PERIOD */
+ case 191: return SDL_SCANCODE_SLASH; /* VK_OEM_2, '/?' key on US standard keyboards */
+ case 192: return SDL_SCANCODE_GRAVE; /* VK_OEM_3, '`~' key on US standard keyboards */
+ // ?
+ // ... reserved or unassigned ...
+ // ?
+ case 219: return SDL_SCANCODE_LEFTBRACKET; /* VK_OEM_4, '[{' key on US standard keyboards */
+ case 220: return SDL_SCANCODE_BACKSLASH; /* VK_OEM_5, '\|' key on US standard keyboards */
+ case 221: return SDL_SCANCODE_RIGHTBRACKET; /* VK_OEM_6, ']}' key on US standard keyboards */
+ case 222: return SDL_SCANCODE_APOSTROPHE; /* VK_OEM_7, 'single/double quote' on US standard keyboards */
+ default: break;
+ }
+ return SDL_SCANCODE_UNKNOWN;
+}
+
+static SDL_Scancode
+WINRT_TranslateKeycode(int keycode, unsigned int nativeScancode)
+{
+ // TODO, WinRT: try filling out the WinRT keycode table as much as possible, using the Win32 table for interpretation hints
+
+ SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
+
+ /* HACK ALERT: At least one VirtualKey constant (Shift) with a left/right
+ * designation might not get reported with its correct handedness, however
+ * its hardware scan code can fill in the gaps. If this is detected,
+ * use the hardware scan code to try telling if the left, or the right
+ * side's key was used.
+ *
+ * If Microsoft ever allows MapVirtualKey or MapVirtualKeyEx to be used
+ * in WinRT apps, or something similar to these (it doesn't appear to be,
+ * at least not for Windows [Phone] 8/8.1, as of Oct 24, 2014), then this
+ * hack might become deprecated, or obsolete.
+ */
+ if (nativeScancode < SDL_arraysize(windows_scancode_table)) {
+ switch (keycode) {
+ case 16: // VirtualKey.Shift
+ switch (windows_scancode_table[nativeScancode]) {
+ case SDL_SCANCODE_LSHIFT:
+ case SDL_SCANCODE_RSHIFT:
+ return windows_scancode_table[nativeScancode];
+ }
+ break;
+
+ // Add others, as necessary.
+ //
+ // Unfortunately, this hack doesn't seem to work in determining
+ // handedness with Control keys.
+
+ default:
+ break;
+ }
+ }
+
+ /* Try to get a documented, WinRT, 'VirtualKey' next (as documented at
+ http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.virtualkey.aspx ).
+ If that fails, fall back to a Win32 virtual key.
+ If that fails, attempt to fall back to a scancode-derived key.
+ */
+ if (keycode < SDL_arraysize(WinRT_Official_Keycodes)) {
+ scancode = WinRT_Official_Keycodes[keycode];
+ }
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ scancode = WINRT_TranslateUnofficialKeycode(keycode);
+ }
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ if (nativeScancode < SDL_arraysize(windows_scancode_table)) {
+ scancode = windows_scancode_table[nativeScancode];
+ }
+ }
+ /*
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ SDL_Log("WinRT TranslateKeycode, unknown keycode=%d\n", (int)keycode);
+ }
+ */
+ return scancode;
+}
+
+void
+WINRT_ProcessKeyDownEvent(Windows::UI::Core::KeyEventArgs ^args)
+{
+ SDL_Scancode sdlScancode = WINRT_TranslateKeycode((int)args->VirtualKey, args->KeyStatus.ScanCode);
+#if 0
+ SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
+ SDL_Log("key down, handled=%s, ext?=%s, released?=%s, menu key down?=%s, "
+ "repeat count=%d, native scan code=0x%x, was down?=%s, vkey=%d, "
+ "sdl scan code=%d (%s), sdl key code=%d (%s)\n",
+ (args->Handled ? "1" : "0"),
+ (args->KeyStatus.IsExtendedKey ? "1" : "0"),
+ (args->KeyStatus.IsKeyReleased ? "1" : "0"),
+ (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
+ args->KeyStatus.RepeatCount,
+ args->KeyStatus.ScanCode,
+ (args->KeyStatus.WasKeyDown ? "1" : "0"),
+ args->VirtualKey,
+ sdlScancode,
+ SDL_GetScancodeName(sdlScancode),
+ keycode,
+ SDL_GetKeyName(keycode));
+ //args->Handled = true;
+#endif
+ SDL_SendKeyboardKey(SDL_PRESSED, sdlScancode);
+}
+
+void
+WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args)
+{
+ SDL_Scancode sdlScancode = WINRT_TranslateKeycode((int)args->VirtualKey, args->KeyStatus.ScanCode);
+#if 0
+ SDL_Keycode keycode = SDL_GetKeyFromScancode(sdlScancode);
+ SDL_Log("key up, handled=%s, ext?=%s, released?=%s, menu key down?=%s, "
+ "repeat count=%d, native scan code=0x%x, was down?=%s, vkey=%d, "
+ "sdl scan code=%d (%s), sdl key code=%d (%s)\n",
+ (args->Handled ? "1" : "0"),
+ (args->KeyStatus.IsExtendedKey ? "1" : "0"),
+ (args->KeyStatus.IsKeyReleased ? "1" : "0"),
+ (args->KeyStatus.IsMenuKeyDown ? "1" : "0"),
+ args->KeyStatus.RepeatCount,
+ args->KeyStatus.ScanCode,
+ (args->KeyStatus.WasKeyDown ? "1" : "0"),
+ args->VirtualKey,
+ sdlScancode,
+ SDL_GetScancodeName(sdlScancode),
+ keycode,
+ SDL_GetKeyName(keycode));
+ //args->Handled = true;
+#endif
+ SDL_SendKeyboardKey(SDL_RELEASED, sdlScancode);
+}
+
+void
+WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArgs ^args)
+{
+ wchar_t src_ucs2[2];
+ char dest_utf8[16];
+ int result;
+
+ /* Setup src */
+ src_ucs2[0] = args->KeyCode;
+ src_ucs2[1] = L'\0';
+
+ /* Convert the text, then send an SDL_TEXTINPUT event. */
+ result = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)&src_ucs2, -1, (LPSTR)dest_utf8, sizeof(dest_utf8), NULL, NULL);
+ if (result > 0) {
+ SDL_SendKeyboardText(dest_utf8);
+ }
+}
+
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+
+SDL_bool WINRT_HasScreenKeyboardSupport(_THIS)
+{
+ return SDL_TRUE;
+}
+
+void WINRT_ShowScreenKeyboard(_THIS, SDL_Window *window)
+{
+ using namespace Windows::UI::ViewManagement;
+ InputPane ^ inputPane = InputPane::GetForCurrentView();
+ if (inputPane) {
+ inputPane->TryShow();
+ }
+}
+
+void WINRT_HideScreenKeyboard(_THIS, SDL_Window *window)
+{
+ using namespace Windows::UI::ViewManagement;
+ InputPane ^ inputPane = InputPane::GetForCurrentView();
+ if (inputPane) {
+ inputPane->TryHide();
+ }
+}
+
+SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window)
+{
+ using namespace Windows::UI::ViewManagement;
+ InputPane ^ inputPane = InputPane::GetForCurrentView();
+ if (inputPane) {
+ // dludwig@pobox.com: checking inputPane->Visible doesn't seem to detect visibility,
+ // at least not on the Windows Phone 10.0.10240.0 emulator. Checking
+ // the size of inputPane->OccludedRect, however, does seem to work.
+ Windows::Foundation::Rect rect = inputPane->OccludedRect;
+ if (rect.Width > 0 && rect.Height > 0) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+#endif // NTDDI_VERSION >= ...
+
+#endif // SDL_VIDEO_DRIVER_WINRT
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp
new file mode 100644
index 0000000..3576a3f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp
@@ -0,0 +1,112 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+extern "C" {
+#include "SDL_messagebox.h"
+#include "../../core/windows/SDL_windows.h"
+}
+
+#include "SDL_winrtevents_c.h"
+
+#include <windows.ui.popups.h>
+using namespace Platform;
+using namespace Windows::Foundation;
+using namespace Windows::UI::Popups;
+
+static String ^
+WINRT_UTF8ToPlatformString(const char * str)
+{
+ wchar_t * wstr = WIN_UTF8ToString(str);
+ String ^ rtstr = ref new String(wstr);
+ SDL_free(wstr);
+ return rtstr;
+}
+
+extern "C" int
+WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
+ /* Sadly, Windows Phone 8 doesn't include the MessageDialog class that
+ * Windows 8.x/RT does, even though MSDN's reference documentation for
+ * Windows Phone 8 mentions it.
+ *
+ * The .NET runtime on Windows Phone 8 does, however, include a
+ * MessageBox class. Perhaps this could be called, somehow?
+ */
+ return SDL_SetError("SDL_messagebox support is not available for Windows Phone 8.0");
+#else
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ const int maxbuttons = 2;
+ const char * platform = "Windows Phone 8.1+";
+#else
+ const int maxbuttons = 3;
+ const char * platform = "Windows 8.x";
+#endif
+
+ if (messageboxdata->numbuttons > maxbuttons) {
+ return SDL_SetError("WinRT's MessageDialog only supports %d buttons, at most, on %s. %d were requested.",
+ maxbuttons, platform, messageboxdata->numbuttons);
+ }
+
+ /* Build a MessageDialog object and its buttons */
+ MessageDialog ^ dialog = ref new MessageDialog(WINRT_UTF8ToPlatformString(messageboxdata->message));
+ dialog->Title = WINRT_UTF8ToPlatformString(messageboxdata->title);
+ for (int i = 0; i < messageboxdata->numbuttons; ++i) {
+ UICommand ^ button = ref new UICommand(WINRT_UTF8ToPlatformString(messageboxdata->buttons[i].text));
+ button->Id = safe_cast<IntPtr>(i);
+ dialog->Commands->Append(button);
+ if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
+ dialog->CancelCommandIndex = i;
+ }
+ if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
+ dialog->DefaultCommandIndex = i;
+ }
+ }
+
+ /* Display the MessageDialog, then wait for it to be closed */
+ /* TODO, WinRT: Find a way to redraw MessageDialog instances if a GPU device-reset occurs during the following event-loop */
+ auto operation = dialog->ShowAsync();
+ while (operation->Status == Windows::Foundation::AsyncStatus::Started) {
+ WINRT_PumpEvents(_this);
+ }
+
+ /* Retrieve results from the MessageDialog and process them accordingly */
+ if (operation->Status != Windows::Foundation::AsyncStatus::Completed) {
+ return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog");
+ }
+ if (buttonid) {
+ IntPtr results = safe_cast<IntPtr>(operation->GetResults()->Id);
+ int clicked_index = results.ToInt32();
+ *buttonid = messageboxdata->buttons[clicked_index].buttonid;
+ }
+ return 0;
+#endif /* if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else */
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINRT */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.h b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.h
new file mode 100644
index 0000000..204cf4a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmessagebox.h
@@ -0,0 +1,29 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+extern int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+#endif /* SDL_VIDEO_DRIVER_WINRT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse.cpp
new file mode 100644
index 0000000..093a1b9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse.cpp
@@ -0,0 +1,224 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+/*
+ * Windows includes:
+ */
+#include <Windows.h>
+#include <windows.ui.core.h>
+using namespace Windows::UI::Core;
+using Windows::UI::Core::CoreCursor;
+
+/*
+ * SDL includes:
+ */
+extern "C" {
+#include "SDL_assert.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+#include "../SDL_sysvideo.h"
+#include "SDL_events.h"
+#include "SDL_log.h"
+}
+
+#include "../../core/winrt/SDL_winrtapp_direct3d.h"
+#include "SDL_winrtvideo_cpp.h"
+#include "SDL_winrtmouse_c.h"
+
+
+extern "C" SDL_bool WINRT_UsingRelativeMouseMode = SDL_FALSE;
+
+
+static SDL_Cursor *
+WINRT_CreateSystemCursor(SDL_SystemCursor id)
+{
+ SDL_Cursor *cursor;
+ CoreCursorType cursorType = CoreCursorType::Arrow;
+
+ switch(id)
+ {
+ default:
+ SDL_assert(0);
+ return NULL;
+ case SDL_SYSTEM_CURSOR_ARROW: cursorType = CoreCursorType::Arrow; break;
+ case SDL_SYSTEM_CURSOR_IBEAM: cursorType = CoreCursorType::IBeam; break;
+ case SDL_SYSTEM_CURSOR_WAIT: cursorType = CoreCursorType::Wait; break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR: cursorType = CoreCursorType::Cross; break;
+ case SDL_SYSTEM_CURSOR_WAITARROW: cursorType = CoreCursorType::Wait; break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE: cursorType = CoreCursorType::SizeNorthwestSoutheast; break;
+ case SDL_SYSTEM_CURSOR_SIZENESW: cursorType = CoreCursorType::SizeNortheastSouthwest; break;
+ case SDL_SYSTEM_CURSOR_SIZEWE: cursorType = CoreCursorType::SizeWestEast; break;
+ case SDL_SYSTEM_CURSOR_SIZENS: cursorType = CoreCursorType::SizeNorthSouth; break;
+ case SDL_SYSTEM_CURSOR_SIZEALL: cursorType = CoreCursorType::SizeAll; break;
+ case SDL_SYSTEM_CURSOR_NO: cursorType = CoreCursorType::UniversalNo; break;
+ case SDL_SYSTEM_CURSOR_HAND: cursorType = CoreCursorType::Hand; break;
+ }
+
+ cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ /* Create a pointer to a COM reference to a cursor. The extra
+ pointer is used (on top of the COM reference) to allow the cursor
+ to be referenced by the SDL_cursor's driverdata field, which is
+ a void pointer.
+ */
+ CoreCursor ^* theCursor = new CoreCursor^(nullptr);
+ *theCursor = ref new CoreCursor(cursorType, 0);
+ cursor->driverdata = (void *) theCursor;
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+WINRT_CreateDefaultCursor()
+{
+ return WINRT_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
+}
+
+static void
+WINRT_FreeCursor(SDL_Cursor * cursor)
+{
+ if (cursor->driverdata) {
+ CoreCursor ^* theCursor = (CoreCursor ^*) cursor->driverdata;
+ *theCursor = nullptr; // Release the COM reference to the CoreCursor
+ delete theCursor; // Delete the pointer to the COM reference
+ }
+ SDL_free(cursor);
+}
+
+static int
+WINRT_ShowCursor(SDL_Cursor * cursor)
+{
+ // TODO, WinRT, XAML: make WINRT_ShowCursor work when XAML support is enabled.
+ if ( ! CoreWindow::GetForCurrentThread()) {
+ return 0;
+ }
+
+ CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread();
+ if (cursor) {
+ CoreCursor ^* theCursor = (CoreCursor ^*) cursor->driverdata;
+ coreWindow->PointerCursor = *theCursor;
+ } else {
+ // HACK ALERT: TL;DR - Hiding the cursor in WinRT/UWP apps is weird, and
+ // a Win32-style cursor resource file must be directly included in apps,
+ // otherwise hiding the cursor will cause mouse-motion data to never be
+ // received.
+ //
+ // Here's the lengthy explanation:
+ //
+ // There are two ways to hide a cursor in WinRT/UWP apps.
+ // Both involve setting the WinRT CoreWindow's (which is somewhat analogous
+ // to a Win32 HWND) 'PointerCursor' property.
+ //
+ // The first way to hide a cursor sets PointerCursor to nullptr. This
+ // is, arguably, the easiest to implement for an app. It does have an
+ // unfortunate side-effect: it'll prevent mouse-motion events from being
+ // sent to the app (via CoreWindow).
+ //
+ // The second way to hide a cursor sets PointerCursor to a transparent
+ // cursor. This allows mouse-motion events to be sent to the app, but is
+ // more difficult to set up, as:
+ // 1. WinRT/UWP, while providing a few stock cursors, does not provide
+ // a completely transparent cursor.
+ // 2. WinRT/UWP allows apps to provide custom-built cursors, but *ONLY*
+ // if they are linked directly inside the app, via Win32-style
+ // cursor resource files. APIs to create cursors at runtime are
+ // not provided to apps, and attempting to link-to or use Win32
+ // cursor-creation APIs could cause an app to fail Windows Store
+ // certification.
+ //
+ // SDL can use either means of hiding the cursor. It provides a Win32-style
+ // set of cursor resource files in its source distribution, inside
+ // src/main/winrt/. If those files are linked to an SDL-for-WinRT/UWP app
+ // (by including them in a MSVC project, for example), SDL will attempt to
+ // use those, if and when the cursor is hidden via SDL APIs. If those
+ // files are not linked in, SDL will attempt to hide the cursor via the
+ // 'set PointerCursor to nullptr' means (which, if you recall, causes
+ // mouse-motion data to NOT be sent to the app!).
+ //
+ // Tech notes:
+ // - SDL's blank cursor resource uses a resource ID of 5000.
+ // - SDL's cursor resources consist of the following two files:
+ // - src/main/winrt/SDL2-WinRTResource_BlankCursor.cur -- cursor pixel data
+ // - src/main/winrt/SDL2-WinRTResources.rc -- declares the cursor resource, and its ID (of 5000)
+ //
+
+ const unsigned int win32CursorResourceID = 5000;
+ CoreCursor ^ blankCursor = ref new CoreCursor(CoreCursorType::Custom, win32CursorResourceID);
+
+ // Set 'PointerCursor' to 'blankCursor' in a way that shouldn't throw
+ // an exception if the app hasn't loaded that resource.
+ ABI::Windows::UI::Core::ICoreCursor * iblankCursor = reinterpret_cast<ABI::Windows::UI::Core::ICoreCursor *>(blankCursor);
+ ABI::Windows::UI::Core::ICoreWindow * icoreWindow = reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow *>(coreWindow);
+ HRESULT hr = icoreWindow->put_PointerCursor(iblankCursor);
+ if (FAILED(hr)) {
+ // The app doesn't contain the cursor resource, or some other error
+ // occurred. Just use the other, but mouse-motion-preventing, means of
+ // hiding the cursor.
+ coreWindow->PointerCursor = nullptr;
+ }
+ }
+ return 0;
+}
+
+static int
+WINRT_SetRelativeMouseMode(SDL_bool enabled)
+{
+ WINRT_UsingRelativeMouseMode = enabled;
+ return 0;
+}
+
+void
+WINRT_InitMouse(_THIS)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ /* DLudwig, Dec 3, 2012: WinRT does not currently provide APIs for
+ the following features, AFAIK:
+ - custom cursors (multiple system cursors are, however, available)
+ - programmatically moveable cursors
+ */
+
+#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
+ //mouse->CreateCursor = WINRT_CreateCursor;
+ mouse->CreateSystemCursor = WINRT_CreateSystemCursor;
+ mouse->ShowCursor = WINRT_ShowCursor;
+ mouse->FreeCursor = WINRT_FreeCursor;
+ //mouse->WarpMouse = WINRT_WarpMouse;
+ mouse->SetRelativeMouseMode = WINRT_SetRelativeMouseMode;
+
+ SDL_SetDefaultCursor(WINRT_CreateDefaultCursor());
+#endif
+}
+
+void
+WINRT_QuitMouse(_THIS)
+{
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINRT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse_c.h b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse_c.h
new file mode 100644
index 0000000..22a80fc
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtmouse_c.h
@@ -0,0 +1,40 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#ifndef SDL_winrtmouse_h_
+#define SDL_winrtmouse_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void WINRT_InitMouse(_THIS);
+extern void WINRT_QuitMouse(_THIS);
+extern SDL_bool WINRT_UsingRelativeMouseMode;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SDL_winrtmouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.cpp
new file mode 100644
index 0000000..7874501
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.cpp
@@ -0,0 +1,203 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL
+
+/* EGL implementation of SDL OpenGL support */
+
+#include "SDL_winrtvideo_cpp.h"
+extern "C" {
+#include "SDL_winrtopengles.h"
+#include "SDL_loadso.h"
+#include "../SDL_egl_c.h"
+}
+
+/* Windows includes */
+#include <wrl/client.h>
+using namespace Windows::UI::Core;
+
+/* ANGLE/WinRT constants */
+static const int ANGLE_D3D_FEATURE_LEVEL_ANY = 0;
+#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
+#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
+#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
+#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
+#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B
+#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
+
+#define EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER 0x320B
+
+
+/*
+ * SDL/EGL top-level implementation
+ */
+
+extern "C" int
+WINRT_GLES_LoadLibrary(_THIS, const char *path)
+{
+ SDL_VideoData *video_data = (SDL_VideoData *)_this->driverdata;
+
+ if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0) != 0) {
+ return -1;
+ }
+
+ /* Load ANGLE/WinRT-specific functions */
+ CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow");
+ if (CreateWinrtEglWindow) {
+ /* 'CreateWinrtEglWindow' was found, which means that an an older
+ * version of ANGLE/WinRT is being used. Continue setting up EGL,
+ * as appropriate to this version of ANGLE.
+ */
+
+ /* Create an ANGLE/WinRT EGL-window */
+ /* TODO, WinRT: check for XAML usage before accessing the CoreWindow, as not doing so could lead to a crash */
+ CoreWindow ^ native_win = CoreWindow::GetForCurrentThread();
+ Microsoft::WRL::ComPtr<IUnknown> cpp_win = reinterpret_cast<IUnknown *>(native_win);
+ HRESULT result = CreateWinrtEglWindow(cpp_win, ANGLE_D3D_FEATURE_LEVEL_ANY, &(video_data->winrtEglWindow));
+ if (FAILED(result)) {
+ return -1;
+ }
+
+ /* Call eglGetDisplay and eglInitialize as appropriate. On other
+ * platforms, this would probably get done by SDL_EGL_LoadLibrary,
+ * however ANGLE/WinRT's current implementation (as of Mar 22, 2014) of
+ * eglGetDisplay requires that a C++ object be passed into it, so the
+ * call will be made in this file, a C++ file, instead.
+ */
+ Microsoft::WRL::ComPtr<IUnknown> cpp_display = video_data->winrtEglWindow;
+ _this->egl_data->egl_display = ((eglGetDisplay_Old_Function)_this->egl_data->eglGetDisplay)(cpp_display);
+ if (!_this->egl_data->egl_display) {
+ return SDL_EGL_SetError("Could not get Windows 8.0 EGL display", "eglGetDisplay");
+ }
+
+ if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
+ return SDL_EGL_SetError("Could not initialize Windows 8.0 EGL", "eglInitialize");
+ }
+ } else {
+ /* Declare some ANGLE/EGL initialization property-sets, as suggested by
+ * MSOpenTech's ANGLE-for-WinRT template apps:
+ */
+ const EGLint defaultDisplayAttributes[] =
+ {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
+
+ const EGLint fl9_3DisplayAttributes[] =
+ {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
+ EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3,
+ EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
+
+ const EGLint warpDisplayAttributes[] =
+ {
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE,
+ EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
+
+ /* 'CreateWinrtEglWindow' was NOT found, which either means that a
+ * newer version of ANGLE/WinRT is being used, or that we don't have
+ * a valid copy of ANGLE.
+ *
+ * Try loading ANGLE as if it were the newer version.
+ */
+ eglGetPlatformDisplayEXT_Function eglGetPlatformDisplayEXT = (eglGetPlatformDisplayEXT_Function)_this->egl_data->eglGetProcAddress("eglGetPlatformDisplayEXT");
+ if (!eglGetPlatformDisplayEXT) {
+ return SDL_EGL_SetError("Could not retrieve ANGLE/WinRT display function(s)", "eglGetProcAddress");
+ }
+
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+ /* Try initializing EGL at D3D11 Feature Level 10_0+ (which is not
+ * supported on WinPhone 8.x.
+ */
+ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes);
+ if (!_this->egl_data->egl_display) {
+ return SDL_EGL_SetError("Could not get EGL display for Direct3D 10_0+", "eglGetPlatformDisplayEXT");
+ }
+
+ if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE)
+#endif
+ {
+ /* Try initializing EGL at D3D11 Feature Level 9_3, in case the
+ * 10_0 init fails, or we're on Windows Phone (which only supports
+ * 9_3).
+ */
+ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes);
+ if (!_this->egl_data->egl_display) {
+ return SDL_EGL_SetError("Could not get EGL display for Direct3D 9_3", "eglGetPlatformDisplayEXT");
+ }
+
+ if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
+ /* Try initializing EGL at D3D11 Feature Level 11_0 on WARP
+ * (a Windows-provided, software rasterizer) if all else fails.
+ */
+ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes);
+ if (!_this->egl_data->egl_display) {
+ return SDL_EGL_SetError("Could not get EGL display for Direct3D WARP", "eglGetPlatformDisplayEXT");
+ }
+
+ if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
+ return SDL_EGL_SetError("Could not initialize WinRT 8.x+ EGL", "eglInitialize");
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+extern "C" void
+WINRT_GLES_UnloadLibrary(_THIS)
+{
+ SDL_VideoData *video_data = (SDL_VideoData *)_this->driverdata;
+
+ /* Release SDL's own COM reference to the ANGLE/WinRT IWinrtEglWindow */
+ if (video_data->winrtEglWindow) {
+ video_data->winrtEglWindow->Release();
+ video_data->winrtEglWindow = nullptr;
+ }
+
+ /* Perform the bulk of the unloading */
+ SDL_EGL_UnloadLibrary(_this);
+}
+
+extern "C" {
+SDL_EGL_CreateContext_impl(WINRT)
+SDL_EGL_SwapWindow_impl(WINRT)
+SDL_EGL_MakeCurrent_impl(WINRT)
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
+
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.h b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.h
new file mode 100644
index 0000000..a222c2b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtopengles.h
@@ -0,0 +1,70 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "SDL_config.h"
+
+#ifndef SDL_winrtopengles_h_
+#define SDL_winrtopengles_h_
+
+#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+/* OpenGLES functions */
+#define WINRT_GLES_GetAttribute SDL_EGL_GetAttribute
+#define WINRT_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define WINRT_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define WINRT_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define WINRT_GLES_DeleteContext SDL_EGL_DeleteContext
+
+extern int WINRT_GLES_LoadLibrary(_THIS, const char *path);
+extern void WINRT_GLES_UnloadLibrary(_THIS);
+extern SDL_GLContext WINRT_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int WINRT_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int WINRT_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+
+
+#ifdef __cplusplus
+
+/* Typedefs for ANGLE/WinRT's C++-based native-display and native-window types,
+ * which are used when calling eglGetDisplay and eglCreateWindowSurface.
+ */
+typedef Microsoft::WRL::ComPtr<IUnknown> WINRT_EGLNativeWindowType_Old;
+
+/* Function pointer typedefs for 'old' ANGLE/WinRT's functions, which may
+ * require that C++ objects be passed in:
+ */
+typedef EGLDisplay (EGLAPIENTRY *eglGetDisplay_Old_Function)(WINRT_EGLNativeWindowType_Old);
+typedef EGLSurface (EGLAPIENTRY *eglCreateWindowSurface_Old_Function)(EGLDisplay, EGLConfig, WINRT_EGLNativeWindowType_Old, const EGLint *);
+typedef HRESULT (EGLAPIENTRY *CreateWinrtEglWindow_Old_Function)(Microsoft::WRL::ComPtr<IUnknown>, int, IUnknown ** result);
+
+#endif /* __cplusplus */
+
+/* Function pointer typedefs for 'new' ANGLE/WinRT functions, which, unlike
+ * the old functions, do not require C++ support and work with plain C.
+ */
+typedef EGLDisplay (EGLAPIENTRY *eglGetPlatformDisplayEXT_Function)(EGLenum, void *, const EGLint *);
+
+#endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_winrtopengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp
new file mode 100644
index 0000000..bc438f2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp
@@ -0,0 +1,415 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+/* SDL includes */
+#include "SDL_winrtevents_c.h"
+#include "SDL_winrtmouse_c.h"
+#include "SDL_winrtvideo_cpp.h"
+#include "SDL_assert.h"
+#include "SDL_system.h"
+
+extern "C" {
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+}
+
+/* File-specific globals: */
+static SDL_TouchID WINRT_TouchID = 1;
+static unsigned int WINRT_LeftFingerDown = 0;
+
+
+void
+WINRT_InitTouch(_THIS)
+{
+ SDL_AddTouch(WINRT_TouchID, "");
+}
+
+
+//
+// Applies necessary geometric transformations to raw cursor positions:
+//
+Windows::Foundation::Point
+WINRT_TransformCursorPosition(SDL_Window * window,
+ Windows::Foundation::Point rawPosition,
+ WINRT_CursorNormalizationType normalization)
+{
+ using namespace Windows::UI::Core;
+ using namespace Windows::Graphics::Display;
+
+ if (!window) {
+ return rawPosition;
+ }
+
+ SDL_WindowData * windowData = (SDL_WindowData *) window->driverdata;
+ if (windowData->coreWindow == nullptr) {
+ // For some reason, the window isn't associated with a CoreWindow.
+ // This might end up being the case as XAML support is extended.
+ // For now, if there's no CoreWindow attached to the SDL_Window,
+ // don't do any transforms.
+
+ // TODO, WinRT: make sure touch input coordinate ranges are correct when using XAML support
+ return rawPosition;
+ }
+
+ // The CoreWindow can only be accessed on certain thread(s).
+ SDL_assert(CoreWindow::GetForCurrentThread() != nullptr);
+
+ CoreWindow ^ nativeWindow = windowData->coreWindow.Get();
+ Windows::Foundation::Point outputPosition;
+
+ // Compute coordinates normalized from 0..1.
+ // If the coordinates need to be sized to the SDL window,
+ // we'll do that after.
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
+ outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
+ outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height;
+#else
+ switch (WINRT_DISPLAY_PROPERTY(CurrentOrientation))
+ {
+ case DisplayOrientations::Portrait:
+ outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
+ outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height;
+ break;
+ case DisplayOrientations::PortraitFlipped:
+ outputPosition.X = 1.0f - (rawPosition.X / nativeWindow->Bounds.Width);
+ outputPosition.Y = 1.0f - (rawPosition.Y / nativeWindow->Bounds.Height);
+ break;
+ case DisplayOrientations::Landscape:
+ outputPosition.X = rawPosition.Y / nativeWindow->Bounds.Height;
+ outputPosition.Y = 1.0f - (rawPosition.X / nativeWindow->Bounds.Width);
+ break;
+ case DisplayOrientations::LandscapeFlipped:
+ outputPosition.X = 1.0f - (rawPosition.Y / nativeWindow->Bounds.Height);
+ outputPosition.Y = rawPosition.X / nativeWindow->Bounds.Width;
+ break;
+ default:
+ break;
+ }
+#endif
+
+ if (normalization == TransformToSDLWindowSize) {
+ outputPosition.X *= ((float32) window->w);
+ outputPosition.Y *= ((float32) window->h);
+ }
+
+ return outputPosition;
+}
+
+static inline int
+_lround(float arg)
+{
+ if (arg >= 0.0f) {
+ return (int)floor(arg + 0.5f);
+ } else {
+ return (int)ceil(arg - 0.5f);
+ }
+}
+
+Uint8
+WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^pt)
+{
+ using namespace Windows::UI::Input;
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ return SDL_BUTTON_LEFT;
+#else
+ switch (pt->Properties->PointerUpdateKind)
+ {
+ case PointerUpdateKind::LeftButtonPressed:
+ case PointerUpdateKind::LeftButtonReleased:
+ return SDL_BUTTON_LEFT;
+
+ case PointerUpdateKind::RightButtonPressed:
+ case PointerUpdateKind::RightButtonReleased:
+ return SDL_BUTTON_RIGHT;
+
+ case PointerUpdateKind::MiddleButtonPressed:
+ case PointerUpdateKind::MiddleButtonReleased:
+ return SDL_BUTTON_MIDDLE;
+
+ case PointerUpdateKind::XButton1Pressed:
+ case PointerUpdateKind::XButton1Released:
+ return SDL_BUTTON_X1;
+
+ case PointerUpdateKind::XButton2Pressed:
+ case PointerUpdateKind::XButton2Released:
+ return SDL_BUTTON_X2;
+
+ default:
+ break;
+ }
+#endif
+
+ return 0;
+}
+
+//const char *
+//WINRT_ConvertPointerUpdateKindToString(Windows::UI::Input::PointerUpdateKind kind)
+//{
+// using namespace Windows::UI::Input;
+//
+// switch (kind)
+// {
+// case PointerUpdateKind::Other:
+// return "Other";
+// case PointerUpdateKind::LeftButtonPressed:
+// return "LeftButtonPressed";
+// case PointerUpdateKind::LeftButtonReleased:
+// return "LeftButtonReleased";
+// case PointerUpdateKind::RightButtonPressed:
+// return "RightButtonPressed";
+// case PointerUpdateKind::RightButtonReleased:
+// return "RightButtonReleased";
+// case PointerUpdateKind::MiddleButtonPressed:
+// return "MiddleButtonPressed";
+// case PointerUpdateKind::MiddleButtonReleased:
+// return "MiddleButtonReleased";
+// case PointerUpdateKind::XButton1Pressed:
+// return "XButton1Pressed";
+// case PointerUpdateKind::XButton1Released:
+// return "XButton1Released";
+// case PointerUpdateKind::XButton2Pressed:
+// return "XButton2Pressed";
+// case PointerUpdateKind::XButton2Released:
+// return "XButton2Released";
+// }
+//
+// return "";
+//}
+
+static bool
+WINRT_IsTouchEvent(Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ return true;
+#else
+ using namespace Windows::Devices::Input;
+ switch (pointerPoint->PointerDevice->PointerDeviceType) {
+ case PointerDeviceType::Touch:
+ case PointerDeviceType::Pen:
+ return true;
+ default:
+ return false;
+ }
+#endif
+}
+
+void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+ if (!window) {
+ return;
+ }
+
+ Uint8 button = WINRT_GetSDLButtonForPointerPoint(pointerPoint);
+
+ if ( ! WINRT_IsTouchEvent(pointerPoint)) {
+ SDL_SendMouseButton(window, 0, SDL_PRESSED, button);
+ } else {
+ Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne);
+ Windows::Foundation::Point windowPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, TransformToSDLWindowSize);
+
+ if (!WINRT_LeftFingerDown) {
+ if (button) {
+ SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, (int)windowPoint.X, (int)windowPoint.Y);
+ SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, button);
+ }
+
+ WINRT_LeftFingerDown = pointerPoint->PointerId;
+ }
+
+ SDL_SendTouch(
+ WINRT_TouchID,
+ (SDL_FingerID) pointerPoint->PointerId,
+ SDL_TRUE,
+ normalizedPoint.X,
+ normalizedPoint.Y,
+ pointerPoint->Properties->Pressure);
+ }
+}
+
+void
+WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+ if (!window || WINRT_UsingRelativeMouseMode) {
+ return;
+ }
+
+ Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne);
+ Windows::Foundation::Point windowPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, TransformToSDLWindowSize);
+
+ if ( ! WINRT_IsTouchEvent(pointerPoint)) {
+ SDL_SendMouseMotion(window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
+ } else {
+ if (pointerPoint->PointerId == WINRT_LeftFingerDown) {
+ SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, (int)windowPoint.X, (int)windowPoint.Y);
+ }
+
+ SDL_SendTouchMotion(
+ WINRT_TouchID,
+ (SDL_FingerID) pointerPoint->PointerId,
+ normalizedPoint.X,
+ normalizedPoint.Y,
+ pointerPoint->Properties->Pressure);
+ }
+}
+
+void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+ if (!window) {
+ return;
+ }
+
+ Uint8 button = WINRT_GetSDLButtonForPointerPoint(pointerPoint);
+
+ if (!WINRT_IsTouchEvent(pointerPoint)) {
+ SDL_SendMouseButton(window, 0, SDL_RELEASED, button);
+ } else {
+ Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne);
+
+ if (WINRT_LeftFingerDown == pointerPoint->PointerId) {
+ if (button) {
+ SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, button);
+ }
+ WINRT_LeftFingerDown = 0;
+ }
+
+ SDL_SendTouch(
+ WINRT_TouchID,
+ (SDL_FingerID) pointerPoint->PointerId,
+ SDL_FALSE,
+ normalizedPoint.X,
+ normalizedPoint.Y,
+ pointerPoint->Properties->Pressure);
+ }
+}
+
+void WINRT_ProcessPointerEnteredEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+ if (!window) {
+ return;
+ }
+
+ if (!WINRT_IsTouchEvent(pointerPoint)) {
+ SDL_SetMouseFocus(window);
+ }
+}
+
+void WINRT_ProcessPointerExitedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+ if (!window) {
+ return;
+ }
+
+ if (!WINRT_IsTouchEvent(pointerPoint)) {
+ SDL_SetMouseFocus(NULL);
+ }
+}
+
+void
+WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+ if (!window) {
+ return;
+ }
+
+ float motion = (float) pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA;
+ SDL_SendMouseWheel(window, 0, 0, (float) motion, SDL_MOUSEWHEEL_NORMAL);
+}
+
+void
+WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::MouseEventArgs ^args)
+{
+ if (!window || !WINRT_UsingRelativeMouseMode) {
+ return;
+ }
+
+ // DLudwig, 2012-12-28: On some systems, namely Visual Studio's Windows
+ // Simulator, as well as Windows 8 in a Parallels 8 VM, MouseEventArgs'
+ // MouseDelta field often reports very large values. More information
+ // on this can be found at the following pages on MSDN:
+ // - http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/a3c789fa-f1c5-49c4-9c0a-7db88d0f90f8
+ // - https://connect.microsoft.com/VisualStudio/Feedback/details/756515
+ //
+ // The values do not appear to be as large when running on some systems,
+ // most notably a Surface RT. Furthermore, the values returned by
+ // CoreWindow's PointerMoved event, and sent to this class' OnPointerMoved
+ // method, do not ever appear to be large, even when MouseEventArgs'
+ // MouseDelta is reporting to the contrary.
+ //
+ // On systems with the large-values behavior, it appears that the values
+ // get reported as if the screen's size is 65536 units in both the X and Y
+ // dimensions. This can be viewed by using Windows' now-private, "Raw Input"
+ // APIs. (GetRawInputData, RegisterRawInputDevices, WM_INPUT, etc.)
+ //
+ // MSDN's documentation on MouseEventArgs' MouseDelta field (at
+ // http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.mouseeventargs.mousedelta ),
+ // does not seem to indicate (to me) that its values should be so large. It
+ // says that its values should be a "change in screen location". I could
+ // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see:
+ // http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/09a9868e-95bb-4858-ba1a-cb4d2c298d62 ),
+ // indicates that these values are in DIPs, which is the same unit used
+ // by CoreWindow's PointerMoved events (via the Position field in its CurrentPoint
+ // property. See http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.input.pointerpoint.position.aspx
+ // for details.)
+ //
+ // To note, PointerMoved events are sent a 'RawPosition' value (via the
+ // CurrentPoint property in MouseEventArgs), however these do not seem
+ // to exhibit the same large-value behavior.
+ //
+ // The values passed via PointerMoved events can't always be used for relative
+ // mouse motion, unfortunately. Its values are bound to the cursor's position,
+ // which stops when it hits one of the screen's edges. This can be a problem in
+ // first person shooters, whereby it is normal for mouse motion to travel far
+ // along any one axis for a period of time. MouseMoved events do not have the
+ // screen-bounding limitation, and can be used regardless of where the system's
+ // cursor is.
+ //
+ // One possible workaround would be to programmatically set the cursor's
+ // position to the screen's center (when SDL's relative mouse mode is enabled),
+ // however WinRT does not yet seem to have the ability to set the cursor's
+ // position via a public API. Win32 did this via an API call, SetCursorPos,
+ // however WinRT makes this function be private. Apps that use it won't get
+ // approved for distribution in the Windows Store. I've yet to be able to find
+ // a suitable, store-friendly counterpart for WinRT.
+ //
+ // There may be some room for a workaround whereby OnPointerMoved's values
+ // are compared to the values from OnMouseMoved in order to detect
+ // when this bug is active. A suitable transformation could then be made to
+ // OnMouseMoved's values. For now, however, the system-reported values are sent
+ // to SDL with minimal transformation: from native screen coordinates (in DIPs)
+ // to SDL window coordinates.
+ //
+ const Windows::Foundation::Point mouseDeltaInDIPs((float)args->MouseDelta.X, (float)args->MouseDelta.Y);
+ const Windows::Foundation::Point mouseDeltaInSDLWindowCoords = WINRT_TransformCursorPosition(window, mouseDeltaInDIPs, TransformToSDLWindowSize);
+ SDL_SendMouseMotion(
+ window,
+ 0,
+ 1,
+ _lround(mouseDeltaInSDLWindowCoords.X),
+ _lround(mouseDeltaInSDLWindowCoords.Y));
+}
+
+#endif // SDL_VIDEO_DRIVER_WINRT
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo.cpp b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo.cpp
new file mode 100644
index 0000000..99bfd07
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo.cpp
@@ -0,0 +1,842 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WINRT
+
+/* WinRT SDL video driver implementation
+
+ Initial work on this was done by David Ludwig (dludwig@pobox.com), and
+ was based off of SDL's "dummy" video driver.
+ */
+
+/* Windows includes */
+#include <agile.h>
+#include <windows.graphics.display.h>
+#include <windows.system.display.h>
+#include <dxgi.h>
+#include <dxgi1_2.h>
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::Foundation;
+using namespace Windows::Graphics::Display;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::ViewManagement;
+
+
+/* [re]declare Windows GUIDs locally, to limit the amount of external lib(s) SDL has to link to */
+static const GUID IID_IDisplayRequest = { 0xe5732044, 0xf49f, 0x4b60, { 0x8d, 0xd4, 0x5e, 0x7e, 0x3a, 0x63, 0x2a, 0xc0 } };
+static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
+
+
+/* SDL includes */
+extern "C" {
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+#include "../../render/SDL_sysrender.h"
+#include "SDL_syswm.h"
+#include "SDL_winrtopengles.h"
+#include "../../core/windows/SDL_windows.h"
+}
+
+#include "../../core/winrt/SDL_winrtapp_direct3d.h"
+#include "../../core/winrt/SDL_winrtapp_xaml.h"
+#include "SDL_winrtvideo_cpp.h"
+#include "SDL_winrtevents_c.h"
+#include "SDL_winrtgamebar_cpp.h"
+#include "SDL_winrtmouse_c.h"
+#include "SDL_main.h"
+#include "SDL_system.h"
+//#include "SDL_log.h"
+
+
+/* Initialization/Query functions */
+static int WINRT_VideoInit(_THIS);
+static int WINRT_InitModes(_THIS);
+static int WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+static void WINRT_VideoQuit(_THIS);
+
+
+/* Window functions */
+static int WINRT_CreateWindow(_THIS, SDL_Window * window);
+static void WINRT_SetWindowSize(_THIS, SDL_Window * window);
+static void WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+static void WINRT_DestroyWindow(_THIS, SDL_Window * window);
+static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
+
+
+/* Misc functions */
+static ABI::Windows::System::Display::IDisplayRequest * WINRT_CreateDisplayRequest(_THIS);
+extern void WINRT_SuspendScreenSaver(_THIS);
+
+
+/* SDL-internal globals: */
+SDL_Window * WINRT_GlobalSDLWindow = NULL;
+
+
+/* WinRT driver bootstrap functions */
+
+static int
+WINRT_Available(void)
+{
+ return (1);
+}
+
+static void
+WINRT_DeleteDevice(SDL_VideoDevice * device)
+{
+ if (device->driverdata) {
+ SDL_VideoData * video_data = (SDL_VideoData *)device->driverdata;
+ if (video_data->winrtEglWindow) {
+ video_data->winrtEglWindow->Release();
+ }
+ SDL_free(video_data);
+ }
+
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *
+WINRT_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_OutOfMemory();
+ return (0);
+ }
+
+ data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (!data) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return (0);
+ }
+ device->driverdata = data;
+
+ /* Set the function pointers */
+ device->VideoInit = WINRT_VideoInit;
+ device->VideoQuit = WINRT_VideoQuit;
+ device->CreateSDLWindow = WINRT_CreateWindow;
+ device->SetWindowSize = WINRT_SetWindowSize;
+ device->SetWindowFullscreen = WINRT_SetWindowFullscreen;
+ device->DestroyWindow = WINRT_DestroyWindow;
+ device->SetDisplayMode = WINRT_SetDisplayMode;
+ device->PumpEvents = WINRT_PumpEvents;
+ device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
+ device->SuspendScreenSaver = WINRT_SuspendScreenSaver;
+
+#if NTDDI_VERSION >= NTDDI_WIN10
+ device->HasScreenKeyboardSupport = WINRT_HasScreenKeyboardSupport;
+ device->ShowScreenKeyboard = WINRT_ShowScreenKeyboard;
+ device->HideScreenKeyboard = WINRT_HideScreenKeyboard;
+ device->IsScreenKeyboardShown = WINRT_IsScreenKeyboardShown;
+#endif
+
+#ifdef SDL_VIDEO_OPENGL_EGL
+ device->GL_LoadLibrary = WINRT_GLES_LoadLibrary;
+ device->GL_GetProcAddress = WINRT_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = WINRT_GLES_UnloadLibrary;
+ device->GL_CreateContext = WINRT_GLES_CreateContext;
+ device->GL_MakeCurrent = WINRT_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = WINRT_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = WINRT_GLES_GetSwapInterval;
+ device->GL_SwapWindow = WINRT_GLES_SwapWindow;
+ device->GL_DeleteContext = WINRT_GLES_DeleteContext;
+#endif
+ device->free = WINRT_DeleteDevice;
+
+ return device;
+}
+
+#define WINRTVID_DRIVER_NAME "winrt"
+VideoBootStrap WINRT_bootstrap = {
+ WINRTVID_DRIVER_NAME, "SDL WinRT video driver",
+ WINRT_Available, WINRT_CreateDevice
+};
+
+int
+WINRT_VideoInit(_THIS)
+{
+ SDL_VideoData * driverdata = (SDL_VideoData *) _this->driverdata;
+ if (WINRT_InitModes(_this) < 0) {
+ return -1;
+ }
+ WINRT_InitMouse(_this);
+ WINRT_InitTouch(_this);
+ WINRT_InitGameBar(_this);
+ if (driverdata) {
+ /* Initialize screensaver-disabling support */
+ driverdata->displayRequest = WINRT_CreateDisplayRequest(_this);
+ }
+ return 0;
+}
+
+extern "C"
+Uint32 D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat);
+
+static void
+WINRT_DXGIModeToSDLDisplayMode(const DXGI_MODE_DESC * dxgiMode, SDL_DisplayMode * sdlMode)
+{
+ SDL_zerop(sdlMode);
+ sdlMode->w = dxgiMode->Width;
+ sdlMode->h = dxgiMode->Height;
+ sdlMode->refresh_rate = dxgiMode->RefreshRate.Numerator / dxgiMode->RefreshRate.Denominator;
+ sdlMode->format = D3D11_DXGIFormatToSDLPixelFormat(dxgiMode->Format);
+}
+
+static int
+WINRT_AddDisplaysForOutput (_THIS, IDXGIAdapter1 * dxgiAdapter1, int outputIndex)
+{
+ HRESULT hr;
+ IDXGIOutput * dxgiOutput = NULL;
+ DXGI_OUTPUT_DESC dxgiOutputDesc;
+ SDL_VideoDisplay display;
+ char * displayName = NULL;
+ UINT numModes;
+ DXGI_MODE_DESC * dxgiModes = NULL;
+ int functionResult = -1; /* -1 for failure, 0 for success */
+ DXGI_MODE_DESC modeToMatch, closestMatch;
+
+ SDL_zero(display);
+
+ hr = dxgiAdapter1->EnumOutputs(outputIndex, &dxgiOutput);
+ if (FAILED(hr)) {
+ if (hr != DXGI_ERROR_NOT_FOUND) {
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIAdapter1::EnumOutputs failed", hr);
+ }
+ goto done;
+ }
+
+ hr = dxgiOutput->GetDesc(&dxgiOutputDesc);
+ if (FAILED(hr)) {
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDesc failed", hr);
+ goto done;
+ }
+
+ SDL_zero(modeToMatch);
+ modeToMatch.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
+ modeToMatch.Width = (dxgiOutputDesc.DesktopCoordinates.right - dxgiOutputDesc.DesktopCoordinates.left);
+ modeToMatch.Height = (dxgiOutputDesc.DesktopCoordinates.bottom - dxgiOutputDesc.DesktopCoordinates.top);
+ hr = dxgiOutput->FindClosestMatchingMode(&modeToMatch, &closestMatch, NULL);
+ if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) {
+ /* DXGI_ERROR_NOT_CURRENTLY_AVAILABLE gets returned by IDXGIOutput::FindClosestMatchingMode
+ when running under the Windows Simulator, which uses Remote Desktop (formerly known as Terminal
+ Services) under the hood. According to the MSDN docs for the similar function,
+ IDXGIOutput::GetDisplayModeList, DXGI_ERROR_NOT_CURRENTLY_AVAILABLE is returned if and
+ when an app is run under a Terminal Services session, hence the assumption.
+
+ In this case, just add an SDL display mode, with approximated values.
+ */
+ SDL_DisplayMode mode;
+ SDL_zero(mode);
+ display.name = "Windows Simulator / Terminal Services Display";
+ mode.w = (dxgiOutputDesc.DesktopCoordinates.right - dxgiOutputDesc.DesktopCoordinates.left);
+ mode.h = (dxgiOutputDesc.DesktopCoordinates.bottom - dxgiOutputDesc.DesktopCoordinates.top);
+ mode.format = DXGI_FORMAT_B8G8R8A8_UNORM;
+ mode.refresh_rate = 0; /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ if ( ! SDL_AddDisplayMode(&display, &mode)) {
+ goto done;
+ }
+ } else if (FAILED(hr)) {
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::FindClosestMatchingMode failed", hr);
+ goto done;
+ } else {
+ displayName = WIN_StringToUTF8(dxgiOutputDesc.DeviceName);
+ display.name = displayName;
+ WINRT_DXGIModeToSDLDisplayMode(&closestMatch, &display.desktop_mode);
+ display.current_mode = display.desktop_mode;
+
+ hr = dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, NULL);
+ if (FAILED(hr)) {
+ if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) {
+ // TODO, WinRT: make sure display mode(s) are added when using Terminal Services / Windows Simulator
+ }
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDisplayModeList [get mode list size] failed", hr);
+ goto done;
+ }
+
+ dxgiModes = (DXGI_MODE_DESC *)SDL_calloc(numModes, sizeof(DXGI_MODE_DESC));
+ if ( ! dxgiModes) {
+ SDL_OutOfMemory();
+ goto done;
+ }
+
+ hr = dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, dxgiModes);
+ if (FAILED(hr)) {
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDisplayModeList [get mode contents] failed", hr);
+ goto done;
+ }
+
+ for (UINT i = 0; i < numModes; ++i) {
+ SDL_DisplayMode sdlMode;
+ WINRT_DXGIModeToSDLDisplayMode(&dxgiModes[i], &sdlMode);
+ SDL_AddDisplayMode(&display, &sdlMode);
+ }
+ }
+
+ if (SDL_AddVideoDisplay(&display) < 0) {
+ goto done;
+ }
+
+ functionResult = 0; /* 0 for Success! */
+done:
+ if (dxgiModes) {
+ SDL_free(dxgiModes);
+ }
+ if (dxgiOutput) {
+ dxgiOutput->Release();
+ }
+ if (displayName) {
+ SDL_free(displayName);
+ }
+ return functionResult;
+}
+
+static int
+WINRT_AddDisplaysForAdapter (_THIS, IDXGIFactory2 * dxgiFactory2, int adapterIndex)
+{
+ HRESULT hr;
+ IDXGIAdapter1 * dxgiAdapter1;
+
+ hr = dxgiFactory2->EnumAdapters1(adapterIndex, &dxgiAdapter1);
+ if (FAILED(hr)) {
+ if (hr != DXGI_ERROR_NOT_FOUND) {
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory1::EnumAdapters1() failed", hr);
+ }
+ return -1;
+ }
+
+ for (int outputIndex = 0; ; ++outputIndex) {
+ if (WINRT_AddDisplaysForOutput(_this, dxgiAdapter1, outputIndex) < 0) {
+ /* HACK: The Windows App Certification Kit 10.0 can fail, when
+ running the Store Apps' test, "Direct3D Feature Test". The
+ certification kit's error is:
+
+ "Application App was not running at the end of the test. It likely crashed or was terminated for having become unresponsive."
+
+ This was caused by SDL/WinRT's DXGI failing to report any
+ outputs. Attempts to get the 1st display-output from the
+ 1st display-adapter can fail, with IDXGIAdapter::EnumOutputs
+ returning DXGI_ERROR_NOT_FOUND. This could be a bug in Windows,
+ the Windows App Certification Kit, or possibly in SDL/WinRT's
+ display detection code. Either way, try to detect when this
+ happens, and use a hackish means to create a reasonable-as-possible
+ 'display mode'. -- DavidL
+ */
+ if (adapterIndex == 0 && outputIndex == 0) {
+ SDL_VideoDisplay display;
+ SDL_DisplayMode mode;
+#if SDL_WINRT_USE_APPLICATIONVIEW
+ ApplicationView ^ appView = ApplicationView::GetForCurrentView();
+#endif
+ CoreWindow ^ coreWin = CoreWindow::GetForCurrentThread();
+ SDL_zero(display);
+ SDL_zero(mode);
+ display.name = "DXGI Display-detection Workaround";
+
+ /* HACK: ApplicationView's VisibleBounds property, appeared, via testing, to
+ give a better approximation of display-size, than did CoreWindow's
+ Bounds property, insofar that ApplicationView::VisibleBounds seems like
+ it will, at least some of the time, give the full display size (during the
+ failing test), whereas CoreWindow might not. -- DavidL
+ */
+
+#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+ mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width);
+ mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height);
+#else
+ /* On platform(s) that do not support VisibleBounds, such as Windows 8.1,
+ fall back to CoreWindow's Bounds property.
+ */
+ mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Width);
+ mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Height);
+#endif
+
+ mode.format = DXGI_FORMAT_B8G8R8A8_UNORM;
+ mode.refresh_rate = 0; /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ if ((SDL_AddDisplayMode(&display, &mode) < 0) ||
+ (SDL_AddVideoDisplay(&display) < 0))
+ {
+ return SDL_SetError("Failed to apply DXGI Display-detection workaround");
+ }
+ }
+
+ break;
+ }
+ }
+
+ dxgiAdapter1->Release();
+ return 0;
+}
+
+int
+WINRT_InitModes(_THIS)
+{
+ /* HACK: Initialize a single display, for whatever screen the app's
+ CoreApplicationView is on.
+ TODO, WinRT: Try initializing multiple displays, one for each monitor.
+ Appropriate WinRT APIs for this seem elusive, though. -- DavidL
+ */
+
+ HRESULT hr;
+ IDXGIFactory2 * dxgiFactory2 = NULL;
+
+ hr = CreateDXGIFactory1(IID_IDXGIFactory2, (void **)&dxgiFactory2);
+ if (FAILED(hr)) {
+ WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr);
+ return -1;
+ }
+
+ for (int adapterIndex = 0; ; ++adapterIndex) {
+ if (WINRT_AddDisplaysForAdapter(_this, dxgiFactory2, adapterIndex) < 0) {
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static int
+WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+
+void
+WINRT_VideoQuit(_THIS)
+{
+ SDL_VideoData * driverdata = (SDL_VideoData *) _this->driverdata;
+ if (driverdata && driverdata->displayRequest) {
+ driverdata->displayRequest->Release();
+ driverdata->displayRequest = NULL;
+ }
+ WINRT_QuitGameBar(_this);
+ WINRT_QuitMouse(_this);
+}
+
+static const Uint32 WINRT_DetectableFlags =
+ SDL_WINDOW_MAXIMIZED |
+ SDL_WINDOW_FULLSCREEN_DESKTOP |
+ SDL_WINDOW_SHOWN |
+ SDL_WINDOW_HIDDEN |
+ SDL_WINDOW_MOUSE_FOCUS;
+
+extern "C" Uint32
+WINRT_DetectWindowFlags(SDL_Window * window)
+{
+ Uint32 latestFlags = 0;
+ SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
+ bool is_fullscreen = false;
+
+#if SDL_WINRT_USE_APPLICATIONVIEW
+ if (data->appView) {
+ is_fullscreen = data->appView->IsFullScreen;
+ }
+#elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION == NTDDI_WIN8)
+ is_fullscreen = true;
+#endif
+
+ if (data->coreWindow.Get()) {
+ if (is_fullscreen) {
+ SDL_VideoDisplay * display = SDL_GetDisplayForWindow(window);
+ int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+ int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
+ // On all WinRT platforms, except for WinPhone 8.0, rotate the
+ // window size. This is needed to properly calculate
+ // fullscreen vs. maximized.
+ const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
+ switch (currentOrientation) {
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+ case DisplayOrientations::Landscape:
+ case DisplayOrientations::LandscapeFlipped:
+#else
+ case DisplayOrientations::Portrait:
+ case DisplayOrientations::PortraitFlipped:
+#endif
+ {
+ int tmp = w;
+ w = h;
+ h = tmp;
+ } break;
+ }
+#endif
+
+ if (display->desktop_mode.w != w || display->desktop_mode.h != h) {
+ latestFlags |= SDL_WINDOW_MAXIMIZED;
+ } else {
+ latestFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+ }
+ }
+
+ if (data->coreWindow->Visible) {
+ latestFlags |= SDL_WINDOW_SHOWN;
+ } else {
+ latestFlags |= SDL_WINDOW_HIDDEN;
+ }
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION < NTDDI_WINBLUE)
+ // data->coreWindow->PointerPosition is not supported on WinPhone 8.0
+ latestFlags |= SDL_WINDOW_MOUSE_FOCUS;
+#else
+ if (data->coreWindow->Visible && data->coreWindow->Bounds.Contains(data->coreWindow->PointerPosition)) {
+ latestFlags |= SDL_WINDOW_MOUSE_FOCUS;
+ }
+#endif
+ }
+
+ return latestFlags;
+}
+
+// TODO, WinRT: consider removing WINRT_UpdateWindowFlags, and just calling WINRT_DetectWindowFlags as-appropriate (with appropriate calls to SDL_SendWindowEvent)
+void
+WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask)
+{
+ mask &= WINRT_DetectableFlags;
+ if (window) {
+ Uint32 apply = WINRT_DetectWindowFlags(window);
+ if ((apply & mask) & SDL_WINDOW_FULLSCREEN) {
+ window->last_fullscreen_flags = window->flags; // seems necessary to programmatically un-fullscreen, via SDL APIs
+ }
+ window->flags = (window->flags & ~mask) | (apply & mask);
+ }
+}
+
+static bool
+WINRT_IsCoreWindowActive(CoreWindow ^ coreWindow)
+{
+ /* WinRT does not appear to offer API(s) to determine window-activation state,
+ at least not that I am aware of in Win8 - Win10. As such, SDL tracks this
+ itself, via window-activation events.
+
+ If there *is* an API to track this, it should probably get used instead
+ of the following hack (that uses "SDLHelperWindowActivationState").
+ -- DavidL.
+ */
+ if (coreWindow->CustomProperties->HasKey("SDLHelperWindowActivationState")) {
+ CoreWindowActivationState activationState = \
+ safe_cast<CoreWindowActivationState>(coreWindow->CustomProperties->Lookup("SDLHelperWindowActivationState"));
+ return (activationState != CoreWindowActivationState::Deactivated);
+ }
+
+ /* Assume that non-SDL tracked windows are active, although this should
+ probably be avoided, if possible.
+
+ This might not even be possible, in normal SDL use, at least as of
+ this writing (Dec 22, 2015; via latest hg.libsdl.org/SDL clone) -- DavidL
+ */
+ return true;
+}
+
+int
+WINRT_CreateWindow(_THIS, SDL_Window * window)
+{
+ // Make sure that only one window gets created, at least until multimonitor
+ // support is added.
+ if (WINRT_GlobalSDLWindow != NULL) {
+ SDL_SetError("WinRT only supports one window");
+ return -1;
+ }
+
+ SDL_WindowData *data = new SDL_WindowData; /* use 'new' here as SDL_WindowData may use WinRT/C++ types */
+ if (!data) {
+ SDL_OutOfMemory();
+ return -1;
+ }
+ window->driverdata = data;
+ data->sdlWindow = window;
+
+ /* To note, when XAML support is enabled, access to the CoreWindow will not
+ be possible, at least not via the SDL/XAML thread. Attempts to access it
+ from there will throw exceptions. As such, the SDL_WindowData's
+ 'coreWindow' field will only be set (to a non-null value) if XAML isn't
+ enabled.
+ */
+ if (!WINRT_XAMLWasEnabled) {
+ data->coreWindow = CoreWindow::GetForCurrentThread();
+#if SDL_WINRT_USE_APPLICATIONVIEW
+ data->appView = ApplicationView::GetForCurrentView();
+#endif
+ }
+
+ /* Make note of the requested window flags, before they start getting changed. */
+ const Uint32 requestedFlags = window->flags;
+
+#if SDL_VIDEO_OPENGL_EGL
+ /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ /* OpenGL ES 2 wasn't requested. Don't set up an EGL surface. */
+ data->egl_surface = EGL_NO_SURFACE;
+ } else {
+ /* OpenGL ES 2 was reuqested. Set up an EGL surface. */
+ SDL_VideoData * video_data = (SDL_VideoData *)_this->driverdata;
+
+ /* Call SDL_EGL_ChooseConfig and eglCreateWindowSurface directly,
+ * rather than via SDL_EGL_CreateSurface, as older versions of
+ * ANGLE/WinRT may require that a C++ object, ComPtr<IUnknown>,
+ * be passed into eglCreateWindowSurface.
+ */
+ if (SDL_EGL_ChooseConfig(_this) != 0) {
+ char buf[512];
+ SDL_snprintf(buf, sizeof(buf), "SDL_EGL_ChooseConfig failed: %s", SDL_GetError());
+ return SDL_SetError("%s", buf);
+ }
+
+ if (video_data->winrtEglWindow) { /* ... is the 'old' version of ANGLE/WinRT being used? */
+ /* Attempt to create a window surface using older versions of
+ * ANGLE/WinRT:
+ */
+ Microsoft::WRL::ComPtr<IUnknown> cpp_winrtEglWindow = video_data->winrtEglWindow;
+ data->egl_surface = ((eglCreateWindowSurface_Old_Function)_this->egl_data->eglCreateWindowSurface)(
+ _this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ cpp_winrtEglWindow, NULL);
+ if (data->egl_surface == NULL) {
+ return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface");
+ }
+ } else if (data->coreWindow.Get() != nullptr) {
+ /* Attempt to create a window surface using newer versions of
+ * ANGLE/WinRT:
+ */
+ IInspectable * coreWindowAsIInspectable = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
+ data->egl_surface = _this->egl_data->eglCreateWindowSurface(
+ _this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ coreWindowAsIInspectable,
+ NULL);
+ if (data->egl_surface == NULL) {
+ return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface");
+ }
+ } else {
+ return SDL_SetError("No supported means to create an EGL window surface are available");
+ }
+ }
+#endif
+
+ /* Determine as many flags dynamically, as possible. */
+ window->flags =
+ SDL_WINDOW_BORDERLESS |
+ SDL_WINDOW_RESIZABLE;
+
+#if SDL_VIDEO_OPENGL_EGL
+ if (data->egl_surface) {
+ window->flags |= SDL_WINDOW_OPENGL;
+ }
+#endif
+
+ if (WINRT_XAMLWasEnabled) {
+ /* TODO, WinRT: set SDL_Window size, maybe position too, from XAML control */
+ window->x = 0;
+ window->y = 0;
+ window->flags |= SDL_WINDOW_SHOWN;
+ SDL_SetMouseFocus(NULL); // TODO: detect this
+ SDL_SetKeyboardFocus(NULL); // TODO: detect this
+ } else {
+ /* WinRT 8.x apps seem to live in an environment where the OS controls the
+ app's window size, with some apps being fullscreen, depending on
+ user choice of various things. For now, just adapt the SDL_Window to
+ whatever Windows set-up as the native-window's geometry.
+ */
+ window->x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left);
+ window->y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top);
+#if NTDDI_VERSION < NTDDI_WIN10
+ /* On WinRT 8.x / pre-Win10, just use the size we were given. */
+ window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+ window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+#else
+ /* On Windows 10, we occasionally get control over window size. For windowed
+ mode apps, try this.
+ */
+ bool didSetSize = false;
+ if (!(requestedFlags & SDL_WINDOW_FULLSCREEN)) {
+ const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w),
+ WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h));
+ didSetSize = data->appView->TryResizeView(size);
+ }
+ if (!didSetSize) {
+ /* We either weren't able to set the window size, or a request for
+ fullscreen was made. Get window-size info from the OS.
+ */
+ window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+ window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+ }
+#endif
+
+ WINRT_UpdateWindowFlags(
+ window,
+ 0xffffffff /* Update any window flag(s) that WINRT_UpdateWindow can handle */
+ );
+
+ /* Try detecting if the window is active */
+ bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get());
+ if (isWindowActive) {
+ SDL_SetKeyboardFocus(window);
+ }
+ }
+
+ /* Make sure the WinRT app's IFramworkView can post events on
+ behalf of SDL:
+ */
+ WINRT_GlobalSDLWindow = window;
+
+ /* All done! */
+ return 0;
+}
+
+void
+WINRT_SetWindowSize(_THIS, SDL_Window * window)
+{
+#if NTDDI_VERSION >= NTDDI_WIN10
+ SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
+ const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w),
+ WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h));
+ data->appView->TryResizeView(size); // TODO, WinRT: return failure (to caller?) from TryResizeView()
+#endif
+}
+
+void
+WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{
+#if NTDDI_VERSION >= NTDDI_WIN10
+ SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
+ bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get());
+ if (isWindowActive) {
+ if (fullscreen) {
+ if (!data->appView->IsFullScreenMode) {
+ data->appView->TryEnterFullScreenMode(); // TODO, WinRT: return failure (to caller?) from TryEnterFullScreenMode()
+ }
+ } else {
+ if (data->appView->IsFullScreenMode) {
+ data->appView->ExitFullScreenMode();
+ }
+ }
+ }
+#endif
+}
+
+
+void
+WINRT_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
+
+ if (WINRT_GlobalSDLWindow == window) {
+ WINRT_GlobalSDLWindow = NULL;
+ }
+
+ if (data) {
+ // Delete the internal window data:
+ delete data;
+ data = NULL;
+ window->driverdata = NULL;
+ }
+}
+
+SDL_bool
+WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
+
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ info->subsystem = SDL_SYSWM_WINRT;
+ info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+ return SDL_FALSE;
+}
+
+static ABI::Windows::System::Display::IDisplayRequest *
+WINRT_CreateDisplayRequest(_THIS)
+{
+ /* Setup a WinRT DisplayRequest object, usable for enabling/disabling screensaver requests */
+ wchar_t *wClassName = L"Windows.System.Display.DisplayRequest";
+ HSTRING hClassName;
+ IActivationFactory *pActivationFactory = NULL;
+ IInspectable * pDisplayRequestRaw = nullptr;
+ ABI::Windows::System::Display::IDisplayRequest * pDisplayRequest = nullptr;
+ HRESULT hr;
+
+ hr = ::WindowsCreateString(wClassName, (UINT32)wcslen(wClassName), &hClassName);
+ if (FAILED(hr)) {
+ goto done;
+ }
+
+ hr = Windows::Foundation::GetActivationFactory(hClassName, &pActivationFactory);
+ if (FAILED(hr)) {
+ goto done;
+ }
+
+ hr = pActivationFactory->ActivateInstance(&pDisplayRequestRaw);
+ if (FAILED(hr)) {
+ goto done;
+ }
+
+ hr = pDisplayRequestRaw->QueryInterface(IID_IDisplayRequest, (void **) &pDisplayRequest);
+ if (FAILED(hr)) {
+ goto done;
+ }
+
+done:
+ if (pDisplayRequestRaw) {
+ pDisplayRequestRaw->Release();
+ }
+ if (pActivationFactory) {
+ pActivationFactory->Release();
+ }
+ if (hClassName) {
+ ::WindowsDeleteString(hClassName);
+ }
+
+ return pDisplayRequest;
+}
+
+void
+WINRT_SuspendScreenSaver(_THIS)
+{
+ SDL_VideoData *driverdata = (SDL_VideoData *)_this->driverdata;
+ if (driverdata && driverdata->displayRequest) {
+ ABI::Windows::System::Display::IDisplayRequest * displayRequest = (ABI::Windows::System::Display::IDisplayRequest *) driverdata->displayRequest;
+ if (_this->suspend_screensaver) {
+ displayRequest->RequestActive();
+ } else {
+ displayRequest->RequestRelease();
+ }
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_WINRT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h
new file mode 100644
index 0000000..91e967e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h
@@ -0,0 +1,106 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* Windows includes: */
+#include <windows.h>
+#ifdef __cplusplus_winrt
+#include <agile.h>
+#endif
+
+/* SDL includes: */
+#include "SDL_video.h"
+#include "SDL_events.h"
+
+#if NTDDI_VERSION >= NTDDI_WINBLUE /* ApplicationView's functionality only becomes
+ useful for SDL in Win[Phone] 8.1 and up.
+ Plus, it is not available at all in WinPhone 8.0. */
+#define SDL_WINRT_USE_APPLICATIONVIEW 1
+#endif
+
+extern "C" {
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+}
+
+/* Private display data */
+typedef struct SDL_VideoData {
+ /* An object created by ANGLE/WinRT (OpenGL ES 2 for WinRT) that gets
+ * passed to eglGetDisplay and eglCreateWindowSurface:
+ */
+ IUnknown *winrtEglWindow;
+
+ /* Event token(s), for unregistering WinRT event handler(s).
+ These are just a struct with a 64-bit integer inside them
+ */
+ Windows::Foundation::EventRegistrationToken gameBarIsInputRedirectedToken;
+
+ /* A WinRT DisplayRequest, used for implementing SDL_*ScreenSaver() functions.
+ * This is really a pointer to a 'ABI::Windows::System::Display::IDisplayRequest *',
+ * It's casted to 'IUnknown *', to help with building SDL.
+ */
+ IUnknown *displayRequest;
+} SDL_VideoData;
+
+/* The global, WinRT, SDL Window.
+ For now, SDL/WinRT only supports one window (due to platform limitations of
+ WinRT.
+*/
+extern SDL_Window * WINRT_GlobalSDLWindow;
+
+/* Updates one or more SDL_Window flags, by querying the OS' native windowing APIs.
+ SDL_Window flags that can be updated should be specified in 'mask'.
+*/
+extern void WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask);
+extern "C" Uint32 WINRT_DetectWindowFlags(SDL_Window * window); /* detects flags w/o applying them */
+
+/* Display mode internals */
+//typedef struct
+//{
+// Windows::Graphics::Display::DisplayOrientations currentOrientation;
+//} SDL_DisplayModeData;
+
+#ifdef __cplusplus_winrt
+
+/* A convenience macro to get a WinRT display property */
+#if NTDDI_VERSION > NTDDI_WIN8
+#define WINRT_DISPLAY_PROPERTY(NAME) (Windows::Graphics::Display::DisplayInformation::GetForCurrentView()->NAME)
+#else
+#define WINRT_DISPLAY_PROPERTY(NAME) (Windows::Graphics::Display::DisplayProperties::NAME)
+#endif
+
+/* Converts DIPS to/from physical pixels */
+#define WINRT_DIPS_TO_PHYSICAL_PIXELS(DIPS) ((int)(0.5f + (((float)(DIPS) * (float)WINRT_DISPLAY_PROPERTY(LogicalDpi)) / 96.f)))
+#define WINRT_PHYSICAL_PIXELS_TO_DIPS(PHYSPIX) (((float)(PHYSPIX) * 96.f)/WINRT_DISPLAY_PROPERTY(LogicalDpi))
+
+/* Internal window data */
+struct SDL_WindowData
+{
+ SDL_Window *sdlWindow;
+ Platform::Agile<Windows::UI::Core::CoreWindow> coreWindow;
+#ifdef SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+#if SDL_WINRT_USE_APPLICATIONVIEW
+ Windows::UI::ViewManagement::ApplicationView ^ appView;
+#endif
+};
+
+#endif // ifdef __cplusplus_winrt
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.c
new file mode 100644
index 0000000..fad8c9c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.c
@@ -0,0 +1,199 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include <limits.h> /* For INT_MAX */
+
+#include "SDL_events.h"
+#include "SDL_x11video.h"
+#include "SDL_timer.h"
+
+
+/* If you don't support UTF-8, you might use XA_STRING here */
+#ifdef X_HAVE_UTF8_STRING
+#define TEXT_FORMAT X11_XInternAtom(display, "UTF8_STRING", False)
+#else
+#define TEXT_FORMAT XA_STRING
+#endif
+
+/* Get any application owned window handle for clipboard association */
+static Window
+GetWindow(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ /* We create an unmapped window that exists just to manage the clipboard,
+ since X11 selection data is tied to a specific window and dies with it.
+ We create the window on demand, so apps that don't use the clipboard
+ don't have to keep an unnecessary resource around. */
+ if (data->clipboard_window == None) {
+ Display *dpy = data->display;
+ Window parent = RootWindow(dpy, DefaultScreen(dpy));
+ XSetWindowAttributes xattr;
+ data->clipboard_window = X11_XCreateWindow(dpy, parent, -10, -10, 1, 1, 0,
+ CopyFromParent, InputOnly,
+ CopyFromParent, 0, &xattr);
+ X11_XFlush(data->display);
+ }
+
+ return data->clipboard_window;
+}
+
+/* We use our own cut-buffer for intermediate storage instead of
+ XA_CUT_BUFFER0 because their use isn't really defined for holding UTF8. */
+Atom
+X11_GetSDLCutBufferClipboardType(Display *display)
+{
+ return X11_XInternAtom(display, "SDL_CUTBUFFER", False);
+}
+
+int
+X11_SetClipboardText(_THIS, const char *text)
+{
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ Atom format;
+ Window window;
+ Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0);
+
+ /* Get the SDL window that will own the selection */
+ window = GetWindow(_this);
+ if (window == None) {
+ return SDL_SetError("Couldn't find a window to own the selection");
+ }
+
+ /* Save the selection on the root window */
+ format = TEXT_FORMAT;
+ X11_XChangeProperty(display, DefaultRootWindow(display),
+ X11_GetSDLCutBufferClipboardType(display), format, 8, PropModeReplace,
+ (const unsigned char *)text, SDL_strlen(text));
+
+ if (XA_CLIPBOARD != None &&
+ X11_XGetSelectionOwner(display, XA_CLIPBOARD) != window) {
+ X11_XSetSelectionOwner(display, XA_CLIPBOARD, window, CurrentTime);
+ }
+
+ if (X11_XGetSelectionOwner(display, XA_PRIMARY) != window) {
+ X11_XSetSelectionOwner(display, XA_PRIMARY, window, CurrentTime);
+ }
+ return 0;
+}
+
+char *
+X11_GetClipboardText(_THIS)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ Display *display = videodata->display;
+ Atom format;
+ Window window;
+ Window owner;
+ Atom selection;
+ Atom seln_type;
+ int seln_format;
+ unsigned long nbytes;
+ unsigned long overflow;
+ unsigned char *src;
+ char *text;
+ Uint32 waitStart;
+ Uint32 waitElapsed;
+ Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0);
+ if (XA_CLIPBOARD == None) {
+ SDL_SetError("Couldn't access X clipboard");
+ return SDL_strdup("");
+ }
+
+ text = NULL;
+
+ /* Get the window that holds the selection */
+ window = GetWindow(_this);
+ format = TEXT_FORMAT;
+ owner = X11_XGetSelectionOwner(display, XA_CLIPBOARD);
+ if (owner == None) {
+ /* Fall back to ancient X10 cut-buffers which do not support UTF8 strings*/
+ owner = DefaultRootWindow(display);
+ selection = XA_CUT_BUFFER0;
+ format = XA_STRING;
+ } else if (owner == window) {
+ owner = DefaultRootWindow(display);
+ selection = X11_GetSDLCutBufferClipboardType(display);
+ } else {
+ /* Request that the selection owner copy the data to our window */
+ owner = window;
+ selection = X11_XInternAtom(display, "SDL_SELECTION", False);
+ X11_XConvertSelection(display, XA_CLIPBOARD, format, selection, owner,
+ CurrentTime);
+
+ /* When using synergy on Linux and when data has been put in the clipboard
+ on the remote (Windows anyway) machine then selection_waiting may never
+ be set to False. Time out after a while. */
+ waitStart = SDL_GetTicks();
+ videodata->selection_waiting = SDL_TRUE;
+ while (videodata->selection_waiting) {
+ SDL_PumpEvents();
+ waitElapsed = SDL_GetTicks() - waitStart;
+ /* Wait one second for a clipboard response. */
+ if (waitElapsed > 1000) {
+ videodata->selection_waiting = SDL_FALSE;
+ SDL_SetError("Clipboard timeout");
+ /* We need to set the clipboard text so that next time we won't
+ timeout, otherwise we will hang on every call to this function. */
+ X11_SetClipboardText(_this, "");
+ return SDL_strdup("");
+ }
+ }
+ }
+
+ if (X11_XGetWindowProperty(display, owner, selection, 0, INT_MAX/4, False,
+ format, &seln_type, &seln_format, &nbytes, &overflow, &src)
+ == Success) {
+ if (seln_type == format) {
+ text = (char *)SDL_malloc(nbytes+1);
+ if (text) {
+ SDL_memcpy(text, src, nbytes);
+ text[nbytes] = '\0';
+ }
+ }
+ X11_XFree(src);
+ }
+
+ if (!text) {
+ text = SDL_strdup("");
+ }
+
+ return text;
+}
+
+SDL_bool
+X11_HasClipboardText(_THIS)
+{
+ SDL_bool result = SDL_FALSE;
+ char *text = X11_GetClipboardText(_this);
+ if (text) {
+ result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
+ SDL_free(text);
+ }
+ return result;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.h
new file mode 100644
index 0000000..97aff1b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11clipboard.h
@@ -0,0 +1,33 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11clipboard_h_
+#define SDL_x11clipboard_h_
+
+extern int X11_SetClipboardText(_THIS, const char *text);
+extern char *X11_GetClipboardText(_THIS);
+extern SDL_bool X11_HasClipboardText(_THIS);
+extern Atom X11_GetSDLCutBufferClipboardType(Display *display);
+
+#endif /* SDL_x11clipboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.c
new file mode 100644
index 0000000..89f736a
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.c
@@ -0,0 +1,212 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#define DEBUG_DYNAMIC_X11 0
+
+#include "SDL_x11dyn.h"
+
+#if DEBUG_DYNAMIC_X11
+#include <stdio.h>
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+ void *lib;
+ const char *libname;
+} x11dynlib;
+
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE NULL
+#endif
+
+static x11dynlib x11libs[] = {
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS},
+ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE}
+};
+
+static void *
+X11_GetSym(const char *fnname, int *pHasModule)
+{
+ int i;
+ void *fn = NULL;
+ for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
+ if (x11libs[i].lib != NULL) {
+ fn = SDL_LoadFunction(x11libs[i].lib, fnname);
+ if (fn != NULL)
+ break;
+ }
+ }
+
+#if DEBUG_DYNAMIC_X11
+ if (fn != NULL)
+ printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn);
+ else
+ printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+ if (fn == NULL)
+ *pHasModule = 0; /* kill this module. */
+
+ return fn;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
+
+/* Define all the function pointers and wrappers... */
+#define SDL_X11_SYM(rc,fn,params,args,ret) SDL_DYNX11FN_##fn X11_##fn = NULL;
+#include "SDL_x11sym.h"
+
+/* Annoying varargs entry point... */
+#ifdef X_HAVE_UTF8_STRING
+SDL_DYNX11FN_XCreateIC X11_XCreateIC = NULL;
+SDL_DYNX11FN_XGetICValues X11_XGetICValues = NULL;
+#endif
+
+/* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
+#define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 0;
+#include "SDL_x11sym.h"
+
+static int x11_load_refcount = 0;
+
+void
+SDL_X11_UnloadSymbols(void)
+{
+ /* Don't actually unload if more than one module is using the libs... */
+ if (x11_load_refcount > 0) {
+ if (--x11_load_refcount == 0) {
+ int i;
+
+ /* set all the function pointers to NULL. */
+#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0;
+#define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL;
+#include "SDL_x11sym.h"
+
+#ifdef X_HAVE_UTF8_STRING
+ X11_XCreateIC = NULL;
+ X11_XGetICValues = NULL;
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+ for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
+ if (x11libs[i].lib != NULL) {
+ SDL_UnloadObject(x11libs[i].lib);
+ x11libs[i].lib = NULL;
+ }
+ }
+#endif
+ }
+ }
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_X11_LoadSymbols(void)
+{
+ int rc = 1; /* always succeed if not using Dynamic X11 stuff. */
+
+ /* deal with multiple modules (dga, x11, etc) needing these symbols... */
+ if (x11_load_refcount++ == 0) {
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+ int i;
+ int *thismod = NULL;
+ for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
+ if (x11libs[i].libname != NULL) {
+ x11libs[i].lib = SDL_LoadObject(x11libs[i].libname);
+ }
+ }
+
+#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
+#include "SDL_x11sym.h"
+
+#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
+#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod);
+#include "SDL_x11sym.h"
+
+#ifdef X_HAVE_UTF8_STRING
+ X11_XCreateIC = (SDL_DYNX11FN_XCreateIC)
+ X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8);
+ X11_XGetICValues = (SDL_DYNX11FN_XGetICValues)
+ X11_GetSym("XGetICValues", &SDL_X11_HAVE_UTF8);
+#endif
+
+ if (SDL_X11_HAVE_BASEXLIB) {
+ /* all required symbols loaded. */
+ SDL_ClearError();
+ } else {
+ /* in case something got loaded... */
+ SDL_X11_UnloadSymbols();
+ rc = 0;
+ }
+
+#else /* no dynamic X11 */
+
+#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
+#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn;
+#include "SDL_x11sym.h"
+
+#ifdef X_HAVE_UTF8_STRING
+ X11_XCreateIC = XCreateIC;
+ X11_XGetICValues = XGetICValues;
+#endif
+#endif
+ }
+
+ return rc;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.h
new file mode 100644
index 0000000..d3866e7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11dyn.h
@@ -0,0 +1,111 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11dyn_h_
+#define SDL_x11dyn_h_
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+#include <X11/XKBlib.h>
+#endif
+
+/* Apparently some X11 systems can't include this multiple times... */
+#ifndef SDL_INCLUDED_XLIBINT_H
+#define SDL_INCLUDED_XLIBINT_H 1
+#include <X11/Xlibint.h>
+#endif
+
+#include <X11/Xproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+#ifndef NO_SHARED_MEMORY
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <X11/extensions/XShm.h>
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XCURSOR
+#include <X11/Xcursor/Xcursor.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XDBE
+#include <X11/extensions/Xdbe.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+#include <X11/extensions/XInput2.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
+#include <X11/extensions/scrnsaver.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XSHAPE
+#include <X11/extensions/shape.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+#include <X11/extensions/xf86vmode.h>
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* evil function signatures... */
+typedef Bool(*SDL_X11_XESetWireToEventRetType) (Display *, XEvent *, xEvent *);
+typedef int (*SDL_X11_XSynchronizeRetType) (Display *);
+typedef Status(*SDL_X11_XESetEventToWireRetType) (Display *, XEvent *, xEvent *);
+
+int SDL_X11_LoadSymbols(void);
+void SDL_X11_UnloadSymbols(void);
+
+/* Declare all the function pointers and wrappers... */
+#define SDL_X11_SYM(rc,fn,params,args,ret) \
+ typedef rc (*SDL_DYNX11FN_##fn) params; \
+ extern SDL_DYNX11FN_##fn X11_##fn;
+#include "SDL_x11sym.h"
+
+/* Annoying varargs entry point... */
+#ifdef X_HAVE_UTF8_STRING
+typedef XIC(*SDL_DYNX11FN_XCreateIC) (XIM,...);
+typedef char *(*SDL_DYNX11FN_XGetICValues) (XIC, ...);
+extern SDL_DYNX11FN_XCreateIC X11_XCreateIC;
+extern SDL_DYNX11FN_XGetICValues X11_XGetICValues;
+#endif
+
+/* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
+#define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
+#include "SDL_x11sym.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !defined SDL_x11dyn_h_ */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11events.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11events.c
new file mode 100644
index 0000000..d293a5e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11events.c
@@ -0,0 +1,1500 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <unistd.h>
+#include <limits.h> /* For INT_MAX */
+
+#include "SDL_x11video.h"
+#include "SDL_x11touch.h"
+#include "SDL_x11xinput2.h"
+#include "../../core/unix/SDL_poll.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+
+#include "SDL_hints.h"
+#include "SDL_timer.h"
+#include "SDL_syswm.h"
+#include "SDL_assert.h"
+
+#include <stdio.h>
+
+/*#define DEBUG_XEVENTS*/
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_TOPLEFT
+#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_TOP
+#define _NET_WM_MOVERESIZE_SIZE_TOP 1
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_TOPRIGHT
+#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_RIGHT
+#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT
+#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_BOTTOM
+#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT
+#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_SIZE_LEFT
+#define _NET_WM_MOVERESIZE_SIZE_LEFT 7
+#endif
+
+#ifndef _NET_WM_MOVERESIZE_MOVE
+#define _NET_WM_MOVERESIZE_MOVE 8
+#endif
+
+typedef struct {
+ unsigned char *data;
+ int format, count;
+ Atom type;
+} SDL_x11Prop;
+
+/* Reads property
+ Must call X11_XFree on results
+ */
+static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
+{
+ unsigned char *ret=NULL;
+ Atom type;
+ int fmt;
+ unsigned long count;
+ unsigned long bytes_left;
+ int bytes_fetch = 0;
+
+ do {
+ if (ret != 0) X11_XFree(ret);
+ X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
+ bytes_fetch += bytes_left;
+ } while (bytes_left != 0);
+
+ p->data=ret;
+ p->format=fmt;
+ p->count=count;
+ p->type=type;
+}
+
+/* Find text-uri-list in a list of targets and return it's atom
+ if available, else return None */
+static Atom X11_PickTarget(Display *disp, Atom list[], int list_count)
+{
+ Atom request = None;
+ char *name;
+ int i;
+ for (i=0; i < list_count && request == None; i++) {
+ name = X11_XGetAtomName(disp, list[i]);
+ if ((SDL_strcmp("text/uri-list", name) == 0) || (SDL_strcmp("text/plain", name) == 0)) {
+ request = list[i];
+ }
+ X11_XFree(name);
+ }
+ return request;
+}
+
+/* Wrapper for X11_PickTarget for a maximum of three targets, a special
+ case in the Xdnd protocol */
+static Atom X11_PickTargetFromAtoms(Display *disp, Atom a0, Atom a1, Atom a2)
+{
+ int count=0;
+ Atom atom[3];
+ if (a0 != None) atom[count++] = a0;
+ if (a1 != None) atom[count++] = a1;
+ if (a2 != None) atom[count++] = a2;
+ return X11_PickTarget(disp, atom, count);
+}
+
+struct KeyRepeatCheckData
+{
+ XEvent *event;
+ SDL_bool found;
+};
+
+static Bool X11_KeyRepeatCheckIfEvent(Display *display, XEvent *chkev,
+ XPointer arg)
+{
+ struct KeyRepeatCheckData *d = (struct KeyRepeatCheckData *) arg;
+ if (chkev->type == KeyPress &&
+ chkev->xkey.keycode == d->event->xkey.keycode &&
+ chkev->xkey.time - d->event->xkey.time < 2)
+ d->found = SDL_TRUE;
+ return False;
+}
+
+/* Check to see if this is a repeated key.
+ (idea shamelessly lifted from GII -- thanks guys! :)
+ */
+static SDL_bool X11_KeyRepeat(Display *display, XEvent *event)
+{
+ XEvent dummyev;
+ struct KeyRepeatCheckData d;
+ d.event = event;
+ d.found = SDL_FALSE;
+ if (X11_XPending(display))
+ X11_XCheckIfEvent(display, &dummyev, X11_KeyRepeatCheckIfEvent,
+ (XPointer) &d);
+ return d.found;
+}
+
+static SDL_bool
+X11_IsWheelEvent(Display * display,XEvent * event,int * xticks,int * yticks)
+{
+ /* according to the xlib docs, no specific mouse wheel events exist.
+ However, the defacto standard is that the vertical wheel is X buttons
+ 4 (up) and 5 (down) and a horizontal wheel is 6 (left) and 7 (right). */
+
+ /* Xlib defines "Button1" through 5, so we just use literals here. */
+ switch (event->xbutton.button) {
+ case 4: *yticks = 1; return SDL_TRUE;
+ case 5: *yticks = -1; return SDL_TRUE;
+ case 6: *xticks = 1; return SDL_TRUE;
+ case 7: *xticks = -1; return SDL_TRUE;
+ default: break;
+ }
+ return SDL_FALSE;
+}
+
+/* Decodes URI escape sequences in string buf of len bytes
+ (excluding the terminating NULL byte) in-place. Since
+ URI-encoded characters take three times the space of
+ normal characters, this should not be an issue.
+
+ Returns the number of decoded bytes that wound up in
+ the buffer, excluding the terminating NULL byte.
+
+ The buffer is guaranteed to be NULL-terminated but
+ may contain embedded NULL bytes.
+
+ On error, -1 is returned.
+ */
+static int X11_URIDecode(char *buf, int len) {
+ int ri, wi, di;
+ char decode = '\0';
+ if (buf == NULL || len < 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (len == 0) {
+ len = SDL_strlen(buf);
+ }
+ for (ri = 0, wi = 0, di = 0; ri < len && wi < len; ri += 1) {
+ if (di == 0) {
+ /* start decoding */
+ if (buf[ri] == '%') {
+ decode = '\0';
+ di += 1;
+ continue;
+ }
+ /* normal write */
+ buf[wi] = buf[ri];
+ wi += 1;
+ continue;
+ } else if (di == 1 || di == 2) {
+ char off = '\0';
+ char isa = buf[ri] >= 'a' && buf[ri] <= 'f';
+ char isA = buf[ri] >= 'A' && buf[ri] <= 'F';
+ char isn = buf[ri] >= '0' && buf[ri] <= '9';
+ if (!(isa || isA || isn)) {
+ /* not a hexadecimal */
+ int sri;
+ for (sri = ri - di; sri <= ri; sri += 1) {
+ buf[wi] = buf[sri];
+ wi += 1;
+ }
+ di = 0;
+ continue;
+ }
+ /* itsy bitsy magicsy */
+ if (isn) {
+ off = 0 - '0';
+ } else if (isa) {
+ off = 10 - 'a';
+ } else if (isA) {
+ off = 10 - 'A';
+ }
+ decode |= (buf[ri] + off) << (2 - di) * 4;
+ if (di == 2) {
+ buf[wi] = decode;
+ wi += 1;
+ di = 0;
+ } else {
+ di += 1;
+ }
+ continue;
+ }
+ }
+ buf[wi] = '\0';
+ return wi;
+}
+
+/* Convert URI to local filename
+ return filename if possible, else NULL
+*/
+static char* X11_URIToLocal(char* uri) {
+ char *file = NULL;
+ SDL_bool local;
+
+ if (memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
+ else if (strstr(uri,":/") != NULL) return file; /* wrong scheme */
+
+ local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/');
+
+ /* got a hostname? */
+ if (!local && uri[0] == '/' && uri[2] != '/') {
+ char* hostname_end = strchr(uri+1, '/');
+ if (hostname_end != NULL) {
+ char hostname[ 257 ];
+ if (gethostname(hostname, 255) == 0) {
+ hostname[ 256 ] = '\0';
+ if (memcmp(uri+1, hostname, hostname_end - (uri+1)) == 0) {
+ uri = hostname_end + 1;
+ local = SDL_TRUE;
+ }
+ }
+ }
+ }
+ if (local) {
+ file = uri;
+ /* Convert URI escape sequences to real characters */
+ X11_URIDecode(file, 0);
+ if (uri[1] == '/') {
+ file++;
+ } else {
+ file--;
+ }
+ }
+ return file;
+}
+
+#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
+static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
+{
+ /* event is a union, so cookie == &event, but this is type safe. */
+ XGenericEventCookie *cookie = &xev->xcookie;
+ if (X11_XGetEventData(videodata->display, cookie)) {
+ X11_HandleXinput2Event(videodata, cookie);
+ X11_XFreeEventData(videodata->display, cookie);
+ }
+}
+#endif /* SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */
+
+static unsigned
+X11_GetNumLockModifierMask(_THIS)
+{
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+ Display *display = viddata->display;
+ unsigned num_mask = 0;
+ int i, j;
+ XModifierKeymap *xmods;
+ unsigned n;
+
+ xmods = X11_XGetModifierMapping(display);
+ n = xmods->max_keypermod;
+ for(i = 3; i < 8; i++) {
+ for(j = 0; j < n; j++) {
+ KeyCode kc = xmods->modifiermap[i * n + j];
+ if (viddata->key_layout[kc] == SDL_SCANCODE_NUMLOCKCLEAR) {
+ num_mask = 1 << i;
+ break;
+ }
+ }
+ }
+ X11_XFreeModifiermap(xmods);
+
+ return num_mask;
+}
+
+static void
+X11_ReconcileKeyboardState(_THIS)
+{
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+ Display *display = viddata->display;
+ char keys[32];
+ int keycode;
+ Window junk_window;
+ int x, y;
+ unsigned int mask;
+ const Uint8 *keyboardState;
+
+ X11_XQueryKeymap(display, keys);
+
+ /* Sync up the keyboard modifier state */
+ if (X11_XQueryPointer(display, DefaultRootWindow(display), &junk_window, &junk_window, &x, &y, &x, &y, &mask)) {
+ SDL_ToggleModState(KMOD_CAPS, (mask & LockMask) != 0);
+ SDL_ToggleModState(KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0);
+ }
+
+ keyboardState = SDL_GetKeyboardState(0);
+ for (keycode = 0; keycode < 256; ++keycode) {
+ SDL_Scancode scancode = viddata->key_layout[keycode];
+ SDL_bool x11KeyPressed = (keys[keycode / 8] & (1 << (keycode % 8))) != 0;
+ SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED;
+
+ if (x11KeyPressed && !sdlKeyPressed) {
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+ } else if (!x11KeyPressed && sdlKeyPressed) {
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+ }
+}
+
+
+static void
+X11_DispatchFocusIn(_THIS, SDL_WindowData *data)
+{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: Dispatching FocusIn\n", data);
+#endif
+ SDL_SetKeyboardFocus(data->window);
+ X11_ReconcileKeyboardState(_this);
+#ifdef X_HAVE_UTF8_STRING
+ if (data->ic) {
+ X11_XSetICFocus(data->ic);
+ }
+#endif
+#ifdef SDL_USE_IME
+ SDL_IME_SetFocus(SDL_TRUE);
+#endif
+}
+
+static void
+X11_DispatchFocusOut(_THIS, SDL_WindowData *data)
+{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: Dispatching FocusOut\n", data);
+#endif
+ /* If another window has already processed a focus in, then don't try to
+ * remove focus here. Doing so will incorrectly remove focus from that
+ * window, and the focus lost event for this window will have already
+ * been dispatched anyway. */
+ if (data->window == SDL_GetKeyboardFocus()) {
+ SDL_SetKeyboardFocus(NULL);
+ }
+#ifdef X_HAVE_UTF8_STRING
+ if (data->ic) {
+ X11_XUnsetICFocus(data->ic);
+ }
+#endif
+#ifdef SDL_USE_IME
+ SDL_IME_SetFocus(SDL_FALSE);
+#endif
+}
+
+static void
+X11_DispatchMapNotify(SDL_WindowData *data)
+{
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+}
+
+static void
+X11_DispatchUnmapNotify(SDL_WindowData *data)
+{
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+}
+
+static void
+InitiateWindowMove(_THIS, const SDL_WindowData *data, const SDL_Point *point)
+{
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+ SDL_Window* window = data->window;
+ Display *display = viddata->display;
+ XEvent evt;
+
+ /* !!! FIXME: we need to regrab this if necessary when the drag is done. */
+ X11_XUngrabPointer(display, 0L);
+ X11_XFlush(display);
+
+ evt.xclient.type = ClientMessage;
+ evt.xclient.window = data->xwindow;
+ evt.xclient.message_type = X11_XInternAtom(display, "_NET_WM_MOVERESIZE", True);
+ evt.xclient.format = 32;
+ evt.xclient.data.l[0] = window->x + point->x;
+ evt.xclient.data.l[1] = window->y + point->y;
+ evt.xclient.data.l[2] = _NET_WM_MOVERESIZE_MOVE;
+ evt.xclient.data.l[3] = Button1;
+ evt.xclient.data.l[4] = 0;
+ X11_XSendEvent(display, DefaultRootWindow(display), False, SubstructureRedirectMask | SubstructureNotifyMask, &evt);
+
+ X11_XSync(display, 0);
+}
+
+static void
+InitiateWindowResize(_THIS, const SDL_WindowData *data, const SDL_Point *point, int direction)
+{
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+ SDL_Window* window = data->window;
+ Display *display = viddata->display;
+ XEvent evt;
+
+ if (direction < _NET_WM_MOVERESIZE_SIZE_TOPLEFT || direction > _NET_WM_MOVERESIZE_SIZE_LEFT)
+ return;
+
+ /* !!! FIXME: we need to regrab this if necessary when the drag is done. */
+ X11_XUngrabPointer(display, 0L);
+ X11_XFlush(display);
+
+ evt.xclient.type = ClientMessage;
+ evt.xclient.window = data->xwindow;
+ evt.xclient.message_type = X11_XInternAtom(display, "_NET_WM_MOVERESIZE", True);
+ evt.xclient.format = 32;
+ evt.xclient.data.l[0] = window->x + point->x;
+ evt.xclient.data.l[1] = window->y + point->y;
+ evt.xclient.data.l[2] = direction;
+ evt.xclient.data.l[3] = Button1;
+ evt.xclient.data.l[4] = 0;
+ X11_XSendEvent(display, DefaultRootWindow(display), False, SubstructureRedirectMask | SubstructureNotifyMask, &evt);
+
+ X11_XSync(display, 0);
+}
+
+static SDL_bool
+ProcessHitTest(_THIS, const SDL_WindowData *data, const XEvent *xev)
+{
+ SDL_Window *window = data->window;
+
+ if (window->hit_test) {
+ const SDL_Point point = { xev->xbutton.x, xev->xbutton.y };
+ const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
+ static const int directions[] = {
+ _NET_WM_MOVERESIZE_SIZE_TOPLEFT, _NET_WM_MOVERESIZE_SIZE_TOP,
+ _NET_WM_MOVERESIZE_SIZE_TOPRIGHT, _NET_WM_MOVERESIZE_SIZE_RIGHT,
+ _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT, _NET_WM_MOVERESIZE_SIZE_BOTTOM,
+ _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT, _NET_WM_MOVERESIZE_SIZE_LEFT
+ };
+
+ switch (rc) {
+ case SDL_HITTEST_DRAGGABLE:
+ InitiateWindowMove(_this, data, &point);
+ return SDL_TRUE;
+
+ case SDL_HITTEST_RESIZE_TOPLEFT:
+ case SDL_HITTEST_RESIZE_TOP:
+ case SDL_HITTEST_RESIZE_TOPRIGHT:
+ case SDL_HITTEST_RESIZE_RIGHT:
+ case SDL_HITTEST_RESIZE_BOTTOMRIGHT:
+ case SDL_HITTEST_RESIZE_BOTTOM:
+ case SDL_HITTEST_RESIZE_BOTTOMLEFT:
+ case SDL_HITTEST_RESIZE_LEFT:
+ InitiateWindowResize(_this, data, &point, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
+ return SDL_TRUE;
+
+ default: return SDL_FALSE;
+ }
+ }
+
+ return SDL_FALSE;
+}
+
+static void
+X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest)
+{
+ if (latest && (latest != data->user_time)) {
+ SDL_VideoData *videodata = data->videodata;
+ Display *display = videodata->display;
+ X11_XChangeProperty(display, data->xwindow, videodata->_NET_WM_USER_TIME,
+ XA_CARDINAL, 32, PropModeReplace,
+ (const unsigned char *) &latest, 1);
+#ifdef DEBUG_XEVENTS
+ printf("window %p: updating _NET_WM_USER_TIME to %lu\n", data, latest);
+#endif
+ data->user_time = latest;
+ }
+}
+
+static void
+X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ Display *display = videodata->display;
+
+ SDL_assert(videodata->clipboard_window != None);
+ SDL_assert(xevent->xany.window == videodata->clipboard_window);
+
+ switch (xevent->type) {
+ /* Copy the selection from our own CUTBUFFER to the requested property */
+ case SelectionRequest: {
+ const XSelectionRequestEvent *req = &xevent->xselectionrequest;
+ XEvent sevent;
+ int seln_format;
+ unsigned long nbytes;
+ unsigned long overflow;
+ unsigned char *seln_data;
+
+#ifdef DEBUG_XEVENTS
+ printf("window CLIPBOARD: SelectionRequest (requestor = %ld, target = %ld)\n",
+ req->requestor, req->target);
+#endif
+
+ SDL_zero(sevent);
+ sevent.xany.type = SelectionNotify;
+ sevent.xselection.selection = req->selection;
+ sevent.xselection.target = None;
+ sevent.xselection.property = None; /* tell them no by default */
+ sevent.xselection.requestor = req->requestor;
+ sevent.xselection.time = req->time;
+
+ /* !!! FIXME: We were probably storing this on the root window
+ because an SDL window might go away...? but we don't have to do
+ this now (or ever, really). */
+ if (X11_XGetWindowProperty(display, DefaultRootWindow(display),
+ X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target,
+ &sevent.xselection.target, &seln_format, &nbytes,
+ &overflow, &seln_data) == Success) {
+ /* !!! FIXME: cache atoms */
+ Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0);
+ if (sevent.xselection.target == req->target) {
+ X11_XChangeProperty(display, req->requestor, req->property,
+ sevent.xselection.target, seln_format, PropModeReplace,
+ seln_data, nbytes);
+ sevent.xselection.property = req->property;
+ } else if (XA_TARGETS == req->target) {
+ Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target };
+ X11_XChangeProperty(display, req->requestor, req->property,
+ XA_ATOM, 32, PropModeReplace,
+ (unsigned char*)SupportedFormats,
+ SDL_arraysize(SupportedFormats));
+ sevent.xselection.property = req->property;
+ sevent.xselection.target = XA_TARGETS;
+ }
+ X11_XFree(seln_data);
+ }
+ X11_XSendEvent(display, req->requestor, False, 0, &sevent);
+ X11_XSync(display, False);
+ }
+ break;
+
+ case SelectionNotify: {
+#ifdef DEBUG_XEVENTS
+ printf("window CLIPBOARD: SelectionNotify (requestor = %ld, target = %ld)\n",
+ xevent->xselection.requestor, xevent->xselection.target);
+#endif
+ videodata->selection_waiting = SDL_FALSE;
+ }
+ break;
+
+ case SelectionClear: {
+ /* !!! FIXME: cache atoms */
+ Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0);
+
+#ifdef DEBUG_XEVENTS
+ printf("window CLIPBOARD: SelectionClear (requestor = %ld, target = %ld)\n",
+ xevent->xselection.requestor, xevent->xselection.target);
+#endif
+
+ if (xevent->xselectionclear.selection == XA_PRIMARY ||
+ (XA_CLIPBOARD != None && xevent->xselectionclear.selection == XA_CLIPBOARD)) {
+ SDL_SendClipboardUpdate();
+ }
+ }
+ break;
+ }
+}
+
+
+static void
+X11_DispatchEvent(_THIS)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ Display *display;
+ SDL_WindowData *data;
+ XEvent xevent;
+ int orig_event_type;
+ KeyCode orig_keycode;
+ XClientMessageEvent m;
+ int i;
+
+ if (!videodata) {
+ return;
+ }
+ display = videodata->display;
+
+ SDL_zero(xevent); /* valgrind fix. --ryan. */
+ X11_XNextEvent(display, &xevent);
+
+ /* Save the original keycode for dead keys, which are filtered out by
+ the XFilterEvent() call below.
+ */
+ orig_event_type = xevent.type;
+ if (orig_event_type == KeyPress || orig_event_type == KeyRelease) {
+ orig_keycode = xevent.xkey.keycode;
+ } else {
+ orig_keycode = 0;
+ }
+
+ /* filter events catchs XIM events and sends them to the correct handler */
+ if (X11_XFilterEvent(&xevent, None) == True) {
+#if 0
+ printf("Filtered event type = %d display = %d window = %d\n",
+ xevent.type, xevent.xany.display, xevent.xany.window);
+#endif
+ /* Make sure dead key press/release events are sent */
+ /* But only if we're using one of the DBus IMEs, otherwise
+ some XIM IMEs will generate duplicate events */
+ if (orig_keycode) {
+#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
+ SDL_Scancode scancode = videodata->key_layout[orig_keycode];
+ videodata->filter_code = orig_keycode;
+ videodata->filter_time = xevent.xkey.time;
+
+ if (orig_event_type == KeyPress) {
+ SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+ } else {
+ SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+ }
+#endif
+ }
+ return;
+ }
+
+ /* Send a SDL_SYSWMEVENT if the application wants them */
+ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
+ SDL_SysWMmsg wmmsg;
+
+ SDL_VERSION(&wmmsg.version);
+ wmmsg.subsystem = SDL_SYSWM_X11;
+ wmmsg.msg.x11.event = xevent;
+ SDL_SendSysWMEvent(&wmmsg);
+ }
+
+#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
+ if(xevent.type == GenericEvent) {
+ X11_HandleGenericEvent(videodata, &xevent);
+ return;
+ }
+#endif
+
+#if 0
+ printf("type = %d display = %d window = %d\n",
+ xevent.type, xevent.xany.display, xevent.xany.window);
+#endif
+
+ if ((videodata->clipboard_window != None) &&
+ (videodata->clipboard_window == xevent.xany.window)) {
+ X11_HandleClipboardEvent(_this, &xevent);
+ return;
+ }
+
+ data = NULL;
+ if (videodata && videodata->windowlist) {
+ for (i = 0; i < videodata->numwindows; ++i) {
+ if ((videodata->windowlist[i] != NULL) &&
+ (videodata->windowlist[i]->xwindow == xevent.xany.window)) {
+ data = videodata->windowlist[i];
+ break;
+ }
+ }
+ }
+ if (!data) {
+ /* The window for KeymapNotify, etc events is 0 */
+ if (xevent.type == KeymapNotify) {
+ if (SDL_GetKeyboardFocus() != NULL) {
+ X11_ReconcileKeyboardState(_this);
+ }
+ } else if (xevent.type == MappingNotify) {
+ /* Has the keyboard layout changed? */
+ const int request = xevent.xmapping.request;
+
+#ifdef DEBUG_XEVENTS
+ printf("window %p: MappingNotify!\n", data);
+#endif
+ if ((request == MappingKeyboard) || (request == MappingModifier)) {
+ X11_XRefreshKeyboardMapping(&xevent.xmapping);
+ }
+
+ X11_UpdateKeymap(_this);
+ SDL_SendKeymapChangedEvent();
+ }
+ return;
+ }
+
+ switch (xevent.type) {
+
+ /* Gaining mouse coverage? */
+ case EnterNotify:{
+ SDL_Mouse *mouse = SDL_GetMouse();
+#ifdef DEBUG_XEVENTS
+ printf("window %p: EnterNotify! (%d,%d,%d)\n", data,
+ xevent.xcrossing.x,
+ xevent.xcrossing.y,
+ xevent.xcrossing.mode);
+ if (xevent.xcrossing.mode == NotifyGrab)
+ printf("Mode: NotifyGrab\n");
+ if (xevent.xcrossing.mode == NotifyUngrab)
+ printf("Mode: NotifyUngrab\n");
+#endif
+ SDL_SetMouseFocus(data->window);
+
+ mouse->last_x = xevent.xcrossing.x;
+ mouse->last_y = xevent.xcrossing.y;
+
+ if (!mouse->relative_mode) {
+ SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y);
+ }
+ }
+ break;
+ /* Losing mouse coverage? */
+ case LeaveNotify:{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: LeaveNotify! (%d,%d,%d)\n", data,
+ xevent.xcrossing.x,
+ xevent.xcrossing.y,
+ xevent.xcrossing.mode);
+ if (xevent.xcrossing.mode == NotifyGrab)
+ printf("Mode: NotifyGrab\n");
+ if (xevent.xcrossing.mode == NotifyUngrab)
+ printf("Mode: NotifyUngrab\n");
+#endif
+ if (!SDL_GetMouse()->relative_mode) {
+ SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y);
+ }
+
+ if (xevent.xcrossing.mode != NotifyGrab &&
+ xevent.xcrossing.mode != NotifyUngrab &&
+ xevent.xcrossing.detail != NotifyInferior) {
+ SDL_SetMouseFocus(NULL);
+ }
+ }
+ break;
+
+ /* Gaining input focus? */
+ case FocusIn:{
+ if (xevent.xfocus.mode == NotifyGrab || xevent.xfocus.mode == NotifyUngrab) {
+ /* Someone is handling a global hotkey, ignore it */
+#ifdef DEBUG_XEVENTS
+ printf("window %p: FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n", data);
+#endif
+ break;
+ }
+
+ if (xevent.xfocus.detail == NotifyInferior) {
+#ifdef DEBUG_XEVENTS
+ printf("window %p: FocusIn (NotifierInferior, ignoring)\n", data);
+#endif
+ break;
+ }
+#ifdef DEBUG_XEVENTS
+ printf("window %p: FocusIn!\n", data);
+#endif
+ if (!videodata->last_mode_change_deadline) /* no recent mode changes */
+ {
+ data->pending_focus = PENDING_FOCUS_NONE;
+ data->pending_focus_time = 0;
+ X11_DispatchFocusIn(_this, data);
+ }
+ else
+ {
+ data->pending_focus = PENDING_FOCUS_IN;
+ data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME;
+ }
+ data->last_focus_event_time = SDL_GetTicks();
+ }
+ break;
+
+ /* Losing input focus? */
+ case FocusOut:{
+ if (xevent.xfocus.mode == NotifyGrab || xevent.xfocus.mode == NotifyUngrab) {
+ /* Someone is handling a global hotkey, ignore it */
+#ifdef DEBUG_XEVENTS
+ printf("window %p: FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n", data);
+#endif
+ break;
+ }
+ if (xevent.xfocus.detail == NotifyInferior) {
+ /* We still have focus if a child gets focus */
+#ifdef DEBUG_XEVENTS
+ printf("window %p: FocusOut (NotifierInferior, ignoring)\n", data);
+#endif
+ break;
+ }
+#ifdef DEBUG_XEVENTS
+ printf("window %p: FocusOut!\n", data);
+#endif
+ if (!videodata->last_mode_change_deadline) /* no recent mode changes */
+ {
+ data->pending_focus = PENDING_FOCUS_NONE;
+ data->pending_focus_time = 0;
+ X11_DispatchFocusOut(_this, data);
+ }
+ else
+ {
+ data->pending_focus = PENDING_FOCUS_OUT;
+ data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME;
+ }
+ }
+ break;
+
+ /* Key press? */
+ case KeyPress:{
+ KeyCode keycode = xevent.xkey.keycode;
+ KeySym keysym = NoSymbol;
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
+ Status status = 0;
+ SDL_bool handled_by_ime = SDL_FALSE;
+
+#ifdef DEBUG_XEVENTS
+ printf("window %p: KeyPress (X11 keycode = 0x%X)\n", data, xevent.xkey.keycode);
+#endif
+#if 1
+ if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) {
+ int min_keycode, max_keycode;
+ X11_XDisplayKeycodes(display, &min_keycode, &max_keycode);
+ keysym = X11_KeyCodeToSym(_this, keycode, xevent.xkey.state >> 13);
+ fprintf(stderr,
+ "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n",
+ keycode, keycode - min_keycode, keysym,
+ X11_XKeysymToString(keysym));
+ }
+#endif
+ /* */
+ SDL_zero(text);
+#ifdef X_HAVE_UTF8_STRING
+ if (data->ic) {
+ X11_Xutf8LookupString(data->ic, &xevent.xkey, text, sizeof(text),
+ &keysym, &status);
+ } else {
+ X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
+ }
+#else
+ X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
+#endif
+
+#ifdef SDL_USE_IME
+ if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode);
+ }
+#endif
+ if (!handled_by_ime) {
+ /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */
+ if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) {
+ SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
+ }
+ if(*text) {
+ SDL_SendKeyboardText(text);
+ }
+ }
+
+ X11_UpdateUserTime(data, xevent.xkey.time);
+ }
+ break;
+
+ /* Key release? */
+ case KeyRelease:{
+ KeyCode keycode = xevent.xkey.keycode;
+
+#ifdef DEBUG_XEVENTS
+ printf("window %p: KeyRelease (X11 keycode = 0x%X)\n", data, xevent.xkey.keycode);
+#endif
+ if (X11_KeyRepeat(display, &xevent)) {
+ /* We're about to get a repeated key down, ignore the key up */
+ break;
+ }
+ SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]);
+ }
+ break;
+
+ /* Have we been iconified? */
+ case UnmapNotify:{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: UnmapNotify!\n", data);
+#endif
+ X11_DispatchUnmapNotify(data);
+ }
+ break;
+
+ /* Have we been restored? */
+ case MapNotify:{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: MapNotify!\n", data);
+#endif
+ X11_DispatchMapNotify(data);
+ }
+ break;
+
+ /* Have we been resized or moved? */
+ case ConfigureNotify:{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", data,
+ xevent.xconfigure.x, xevent.xconfigure.y,
+ xevent.xconfigure.width, xevent.xconfigure.height);
+#endif
+ /* Real configure notify events are relative to the parent, synthetic events are absolute. */
+ if (!xevent.xconfigure.send_event) {
+ unsigned int NumChildren;
+ Window ChildReturn, Root, Parent;
+ Window * Children;
+ /* Translate these coodinates back to relative to root */
+ X11_XQueryTree(data->videodata->display, xevent.xconfigure.window, &Root, &Parent, &Children, &NumChildren);
+ X11_XTranslateCoordinates(xevent.xconfigure.display,
+ Parent, DefaultRootWindow(xevent.xconfigure.display),
+ xevent.xconfigure.x, xevent.xconfigure.y,
+ &xevent.xconfigure.x, &xevent.xconfigure.y,
+ &ChildReturn);
+ }
+
+ if (xevent.xconfigure.x != data->last_xconfigure.x ||
+ xevent.xconfigure.y != data->last_xconfigure.y) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
+ xevent.xconfigure.x, xevent.xconfigure.y);
+#ifdef SDL_USE_IME
+ if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ /* Update IME candidate list position */
+ SDL_IME_UpdateTextRect(NULL);
+ }
+#endif
+ }
+ if (xevent.xconfigure.width != data->last_xconfigure.width ||
+ xevent.xconfigure.height != data->last_xconfigure.height) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED,
+ xevent.xconfigure.width,
+ xevent.xconfigure.height);
+ }
+ data->last_xconfigure = xevent.xconfigure;
+ }
+ break;
+
+ /* Have we been requested to quit (or another client message?) */
+ case ClientMessage:{
+
+ static int xdnd_version=0;
+
+ if (xevent.xclient.message_type == videodata->XdndEnter) {
+
+ SDL_bool use_list = xevent.xclient.data.l[1] & 1;
+ data->xdnd_source = xevent.xclient.data.l[0];
+ xdnd_version = (xevent.xclient.data.l[1] >> 24);
+#ifdef DEBUG_XEVENTS
+ printf("XID of source window : %ld\n", data->xdnd_source);
+ printf("Protocol version to use : %d\n", xdnd_version);
+ printf("More then 3 data types : %d\n", (int) use_list);
+#endif
+
+ if (use_list) {
+ /* fetch conversion targets */
+ SDL_x11Prop p;
+ X11_ReadProperty(&p, display, data->xdnd_source, videodata->XdndTypeList);
+ /* pick one */
+ data->xdnd_req = X11_PickTarget(display, (Atom*)p.data, p.count);
+ X11_XFree(p.data);
+ } else {
+ /* pick from list of three */
+ data->xdnd_req = X11_PickTargetFromAtoms(display, xevent.xclient.data.l[2], xevent.xclient.data.l[3], xevent.xclient.data.l[4]);
+ }
+ }
+ else if (xevent.xclient.message_type == videodata->XdndPosition) {
+
+#ifdef DEBUG_XEVENTS
+ Atom act= videodata->XdndActionCopy;
+ if(xdnd_version >= 2) {
+ act = xevent.xclient.data.l[4];
+ }
+ printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act));
+#endif
+
+
+ /* reply with status */
+ memset(&m, 0, sizeof(XClientMessageEvent));
+ m.type = ClientMessage;
+ m.display = xevent.xclient.display;
+ m.window = xevent.xclient.data.l[0];
+ m.message_type = videodata->XdndStatus;
+ m.format=32;
+ m.data.l[0] = data->xwindow;
+ m.data.l[1] = (data->xdnd_req != None);
+ m.data.l[2] = 0; /* specify an empty rectangle */
+ m.data.l[3] = 0;
+ m.data.l[4] = videodata->XdndActionCopy; /* we only accept copying anyway */
+
+ X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
+ X11_XFlush(display);
+ }
+ else if(xevent.xclient.message_type == videodata->XdndDrop) {
+ if (data->xdnd_req == None) {
+ /* say again - not interested! */
+ memset(&m, 0, sizeof(XClientMessageEvent));
+ m.type = ClientMessage;
+ m.display = xevent.xclient.display;
+ m.window = xevent.xclient.data.l[0];
+ m.message_type = videodata->XdndFinished;
+ m.format=32;
+ m.data.l[0] = data->xwindow;
+ m.data.l[1] = 0;
+ m.data.l[2] = None; /* fail! */
+ X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
+ } else {
+ /* convert */
+ if(xdnd_version >= 1) {
+ X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, xevent.xclient.data.l[2]);
+ } else {
+ X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, CurrentTime);
+ }
+ }
+ }
+ else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
+ (xevent.xclient.format == 32) &&
+ (xevent.xclient.data.l[0] == videodata->_NET_WM_PING)) {
+ Window root = DefaultRootWindow(display);
+
+#ifdef DEBUG_XEVENTS
+ printf("window %p: _NET_WM_PING\n", data);
+#endif
+ xevent.xclient.window = root;
+ X11_XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
+ break;
+ }
+
+ else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
+ (xevent.xclient.format == 32) &&
+ (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) {
+
+#ifdef DEBUG_XEVENTS
+ printf("window %p: WM_DELETE_WINDOW\n", data);
+#endif
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
+ break;
+ }
+ else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
+ (xevent.xclient.format == 32) &&
+ (xevent.xclient.data.l[0] == videodata->WM_TAKE_FOCUS)) {
+
+#ifdef DEBUG_XEVENTS
+ printf("window %p: WM_TAKE_FOCUS\n", data);
+#endif
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_TAKE_FOCUS, 0, 0);
+ break;
+ }
+ }
+ break;
+
+ /* Do we need to refresh ourselves? */
+ case Expose:{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: Expose (count = %d)\n", data, xevent.xexpose.count);
+#endif
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
+ }
+ break;
+
+ case MotionNotify:{
+ SDL_Mouse *mouse = SDL_GetMouse();
+ if(!mouse->relative_mode || mouse->relative_mode_warp) {
+#ifdef DEBUG_MOTION
+ printf("window %p: X11 motion: %d,%d\n", data, xevent.xmotion.x, xevent.xmotion.y);
+#endif
+
+ SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y);
+ }
+ }
+ break;
+
+ case ButtonPress:{
+ int xticks = 0, yticks = 0;
+#ifdef DEBUG_XEVENTS
+ printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button);
+#endif
+ if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) {
+ SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL);
+ } else {
+ SDL_bool ignore_click = SDL_FALSE;
+ int button = xevent.xbutton.button;
+ if(button == Button1) {
+ if (ProcessHitTest(_this, data, &xevent)) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
+ break; /* don't pass this event on to app. */
+ }
+ }
+ else if(button > 7) {
+ /* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ...
+ => subtract (8-SDL_BUTTON_X1) to get value SDL expects */
+ button -= (8-SDL_BUTTON_X1);
+ }
+ if (data->last_focus_event_time) {
+ const int X11_FOCUS_CLICK_TIMEOUT = 10;
+ if (!SDL_TICKS_PASSED(SDL_GetTicks(), data->last_focus_event_time + X11_FOCUS_CLICK_TIMEOUT)) {
+ ignore_click = !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE);
+ }
+ data->last_focus_event_time = 0;
+ }
+ if (!ignore_click) {
+ SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button);
+ }
+ }
+ X11_UpdateUserTime(data, xevent.xbutton.time);
+ }
+ break;
+
+ case ButtonRelease:{
+ int button = xevent.xbutton.button;
+ /* The X server sends a Release event for each Press for wheels. Ignore them. */
+ int xticks = 0, yticks = 0;
+#ifdef DEBUG_XEVENTS
+ printf("window %p: ButtonRelease (X11 button = %d)\n", data, xevent.xbutton.button);
+#endif
+ if (!X11_IsWheelEvent(display, &xevent, &xticks, &yticks)) {
+ if (button > 7) {
+ /* see explanation at case ButtonPress */
+ button -= (8-SDL_BUTTON_X1);
+ }
+ SDL_SendMouseButton(data->window, 0, SDL_RELEASED, button);
+ }
+ }
+ break;
+
+ case PropertyNotify:{
+#ifdef DEBUG_XEVENTS
+ unsigned char *propdata;
+ int status, real_format;
+ Atom real_type;
+ unsigned long items_read, items_left;
+
+ char *name = X11_XGetAtomName(display, xevent.xproperty.atom);
+ if (name) {
+ printf("window %p: PropertyNotify: %s %s time=%lu\n", data, name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent.xproperty.time);
+ X11_XFree(name);
+ }
+
+ status = X11_XGetWindowProperty(display, data->xwindow, xevent.xproperty.atom, 0L, 8192L, False, AnyPropertyType, &real_type, &real_format, &items_read, &items_left, &propdata);
+ if (status == Success && items_read > 0) {
+ if (real_type == XA_INTEGER) {
+ int *values = (int *)propdata;
+
+ printf("{");
+ for (i = 0; i < items_read; i++) {
+ printf(" %d", values[i]);
+ }
+ printf(" }\n");
+ } else if (real_type == XA_CARDINAL) {
+ if (real_format == 32) {
+ Uint32 *values = (Uint32 *)propdata;
+
+ printf("{");
+ for (i = 0; i < items_read; i++) {
+ printf(" %d", values[i]);
+ }
+ printf(" }\n");
+ } else if (real_format == 16) {
+ Uint16 *values = (Uint16 *)propdata;
+
+ printf("{");
+ for (i = 0; i < items_read; i++) {
+ printf(" %d", values[i]);
+ }
+ printf(" }\n");
+ } else if (real_format == 8) {
+ Uint8 *values = (Uint8 *)propdata;
+
+ printf("{");
+ for (i = 0; i < items_read; i++) {
+ printf(" %d", values[i]);
+ }
+ printf(" }\n");
+ }
+ } else if (real_type == XA_STRING ||
+ real_type == videodata->UTF8_STRING) {
+ printf("{ \"%s\" }\n", propdata);
+ } else if (real_type == XA_ATOM) {
+ Atom *atoms = (Atom *)propdata;
+
+ printf("{");
+ for (i = 0; i < items_read; i++) {
+ char *atomname = X11_XGetAtomName(display, atoms[i]);
+ if (atomname) {
+ printf(" %s", atomname);
+ X11_XFree(atomname);
+ }
+ }
+ printf(" }\n");
+ } else {
+ char *atomname = X11_XGetAtomName(display, real_type);
+ printf("Unknown type: %ld (%s)\n", real_type, atomname ? atomname : "UNKNOWN");
+ if (atomname) {
+ X11_XFree(atomname);
+ }
+ }
+ }
+ if (status == Success) {
+ X11_XFree(propdata);
+ }
+#endif /* DEBUG_XEVENTS */
+
+ /* Take advantage of this moment to make sure user_time has a
+ valid timestamp from the X server, so if we later try to
+ raise/restore this window, _NET_ACTIVE_WINDOW can have a
+ non-zero timestamp, even if there's never been a mouse or
+ key press to this window so far. Note that we don't try to
+ set _NET_WM_USER_TIME here, though. That's only for legit
+ user interaction with the window. */
+ if (!data->user_time) {
+ data->user_time = xevent.xproperty.time;
+ }
+
+ if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) {
+ /* Get the new state from the window manager.
+ Compositing window managers can alter visibility of windows
+ without ever mapping / unmapping them, so we handle that here,
+ because they use the NETWM protocol to notify us of changes.
+ */
+ const Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
+ const Uint32 changed = flags ^ data->window->flags;
+
+ if ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN)) {
+ if (flags & SDL_WINDOW_HIDDEN) {
+ X11_DispatchUnmapNotify(data);
+ } else {
+ X11_DispatchMapNotify(data);
+ }
+ }
+
+ if (changed & SDL_WINDOW_MAXIMIZED) {
+ if (flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+ } else {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ }
+ }
+ } else if (xevent.xproperty.atom == videodata->XKLAVIER_STATE) {
+ /* Hack for Ubuntu 12.04 (etc) that doesn't send MappingNotify
+ events when the keyboard layout changes (for example,
+ changing from English to French on the menubar's keyboard
+ icon). Since it changes the XKLAVIER_STATE property, we
+ notice and reinit our keymap here. This might not be the
+ right approach, but it seems to work. */
+ X11_UpdateKeymap(_this);
+ SDL_SendKeymapChangedEvent();
+ } else if (xevent.xproperty.atom == videodata->_NET_FRAME_EXTENTS) {
+ Atom type;
+ int format;
+ unsigned long nitems, bytes_after;
+ unsigned char *property;
+ if (X11_XGetWindowProperty(display, data->xwindow, videodata->_NET_FRAME_EXTENTS, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property) == Success) {
+ if (type != None && nitems == 4) {
+ data->border_left = (int) ((long*)property)[0];
+ data->border_right = (int) ((long*)property)[1];
+ data->border_top = (int) ((long*)property)[2];
+ data->border_bottom = (int) ((long*)property)[3];
+ }
+ X11_XFree(property);
+
+ #ifdef DEBUG_XEVENTS
+ printf("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom);
+ #endif
+ }
+ }
+ }
+ break;
+
+ case SelectionNotify: {
+ Atom target = xevent.xselection.target;
+#ifdef DEBUG_XEVENTS
+ printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data,
+ xevent.xselection.requestor, xevent.xselection.target);
+#endif
+ if (target == data->xdnd_req) {
+ /* read data */
+ SDL_x11Prop p;
+ X11_ReadProperty(&p, display, data->xwindow, videodata->PRIMARY);
+
+ if (p.format == 8) {
+ /* !!! FIXME: don't use strtok here. It's not reentrant and not in SDL_stdinc. */
+ char* name = X11_XGetAtomName(display, target);
+ char *token = strtok((char *) p.data, "\r\n");
+ while (token != NULL) {
+ if (SDL_strcmp("text/plain", name)==0) {
+ SDL_SendDropText(data->window, token);
+ } else if (SDL_strcmp("text/uri-list", name)==0) {
+ char *fn = X11_URIToLocal(token);
+ if (fn) {
+ SDL_SendDropFile(data->window, fn);
+ }
+ }
+ token = strtok(NULL, "\r\n");
+ }
+ SDL_SendDropComplete(data->window);
+ }
+ X11_XFree(p.data);
+
+ /* send reply */
+ SDL_memset(&m, 0, sizeof(XClientMessageEvent));
+ m.type = ClientMessage;
+ m.display = display;
+ m.window = data->xdnd_source;
+ m.message_type = videodata->XdndFinished;
+ m.format = 32;
+ m.data.l[0] = data->xwindow;
+ m.data.l[1] = 1;
+ m.data.l[2] = videodata->XdndActionCopy;
+ X11_XSendEvent(display, data->xdnd_source, False, NoEventMask, (XEvent*)&m);
+
+ X11_XSync(display, False);
+ }
+ }
+ break;
+
+ default:{
+#ifdef DEBUG_XEVENTS
+ printf("window %p: Unhandled event %d\n", data, xevent.type);
+#endif
+ }
+ break;
+ }
+}
+
+static void
+X11_HandleFocusChanges(_THIS)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ int i;
+
+ if (videodata && videodata->windowlist) {
+ for (i = 0; i < videodata->numwindows; ++i) {
+ SDL_WindowData *data = videodata->windowlist[i];
+ if (data && data->pending_focus != PENDING_FOCUS_NONE) {
+ Uint32 now = SDL_GetTicks();
+ if (SDL_TICKS_PASSED(now, data->pending_focus_time)) {
+ if (data->pending_focus == PENDING_FOCUS_IN) {
+ X11_DispatchFocusIn(_this, data);
+ } else {
+ X11_DispatchFocusOut(_this, data);
+ }
+ data->pending_focus = PENDING_FOCUS_NONE;
+ }
+ }
+ }
+ }
+}
+/* Ack! X11_XPending() actually performs a blocking read if no events available */
+static int
+X11_Pending(Display * display)
+{
+ /* Flush the display connection and look to see if events are queued */
+ X11_XFlush(display);
+ if (X11_XEventsQueued(display, QueuedAlready)) {
+ return (1);
+ }
+
+ /* More drastic measures are required -- see if X is ready to talk */
+ if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, 0)) {
+ return (X11_XPending(display));
+ }
+
+ /* Oh well, nothing is ready .. */
+ return (0);
+}
+
+void
+X11_PumpEvents(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ if (data->last_mode_change_deadline) {
+ if (SDL_TICKS_PASSED(SDL_GetTicks(), data->last_mode_change_deadline)) {
+ data->last_mode_change_deadline = 0; /* assume we're done. */
+ }
+ }
+
+ /* Update activity every 30 seconds to prevent screensaver */
+ if (_this->suspend_screensaver) {
+ const Uint32 now = SDL_GetTicks();
+ if (!data->screensaver_activity ||
+ SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) {
+ X11_XResetScreenSaver(data->display);
+
+#if SDL_USE_LIBDBUS
+ SDL_DBus_ScreensaverTickle();
+#endif
+
+ data->screensaver_activity = now;
+ }
+ }
+
+ /* Keep processing pending events */
+ while (X11_Pending(data->display)) {
+ X11_DispatchEvent(_this);
+ }
+
+#ifdef SDL_USE_IME
+ if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
+ SDL_IME_PumpEvents();
+ }
+#endif
+
+ /* FIXME: Only need to do this when there are pending focus changes */
+ X11_HandleFocusChanges(_this);
+}
+
+
+void
+X11_SuspendScreenSaver(_THIS)
+{
+#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ int dummy;
+ int major_version, minor_version;
+#endif /* SDL_VIDEO_DRIVER_X11_XSCRNSAVER */
+
+#if SDL_USE_LIBDBUS
+ if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) {
+ return;
+ }
+
+ if (_this->suspend_screensaver) {
+ SDL_DBus_ScreensaverTickle();
+ }
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
+ if (SDL_X11_HAVE_XSS) {
+ /* X11_XScreenSaverSuspend was introduced in MIT-SCREEN-SAVER 1.1 */
+ if (!X11_XScreenSaverQueryExtension(data->display, &dummy, &dummy) ||
+ !X11_XScreenSaverQueryVersion(data->display,
+ &major_version, &minor_version) ||
+ major_version < 1 || (major_version == 1 && minor_version < 1)) {
+ return;
+ }
+
+ X11_XScreenSaverSuspend(data->display, _this->suspend_screensaver);
+ X11_XResetScreenSaver(data->display);
+ }
+#endif
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11events.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11events.h
new file mode 100644
index 0000000..53c69a5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11events.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11events_h_
+#define SDL_x11events_h_
+
+extern void X11_PumpEvents(_THIS);
+extern void X11_SuspendScreenSaver(_THIS);
+
+#endif /* SDL_x11events_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.c
new file mode 100644
index 0000000..ad58170
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.c
@@ -0,0 +1,257 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_x11video.h"
+#include "SDL_x11framebuffer.h"
+
+
+#ifndef NO_SHARED_MEMORY
+
+/* Shared memory error handler routine */
+static int shm_error;
+static int (*X_handler)(Display *, XErrorEvent *) = NULL;
+static int shm_errhandler(Display *d, XErrorEvent *e)
+{
+ if ( e->error_code == BadAccess ) {
+ shm_error = True;
+ return(0);
+ } else
+ return(X_handler(d,e));
+}
+
+static SDL_bool have_mitshm(void)
+{
+ /* Only use shared memory on local X servers */
+ if ( (SDL_strncmp(X11_XDisplayName(NULL), ":", 1) == 0) ||
+ (SDL_strncmp(X11_XDisplayName(NULL), "unix:", 5) == 0) ) {
+ return SDL_X11_HAVE_SHM;
+ }
+ return SDL_FALSE;
+}
+
+#endif /* !NO_SHARED_MEMORY */
+
+int
+X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
+ void ** pixels, int *pitch)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ XGCValues gcv;
+ XVisualInfo vinfo;
+
+ /* Free the old framebuffer surface */
+ X11_DestroyWindowFramebuffer(_this, window);
+
+ /* Create the graphics context for drawing */
+ gcv.graphics_exposures = False;
+ data->gc = X11_XCreateGC(display, data->xwindow, GCGraphicsExposures, &gcv);
+ if (!data->gc) {
+ return SDL_SetError("Couldn't create graphics context");
+ }
+
+ /* Find out the pixel format and depth */
+ if (X11_GetVisualInfoFromVisual(display, data->visual, &vinfo) < 0) {
+ return SDL_SetError("Couldn't get window visual information");
+ }
+
+ *format = X11_GetPixelFormatFromVisualInfo(display, &vinfo);
+ if (*format == SDL_PIXELFORMAT_UNKNOWN) {
+ return SDL_SetError("Unknown window pixel format");
+ }
+
+ /* Calculate pitch */
+ *pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
+
+ /* Create the actual image */
+#ifndef NO_SHARED_MEMORY
+ if (have_mitshm()) {
+ XShmSegmentInfo *shminfo = &data->shminfo;
+
+ shminfo->shmid = shmget(IPC_PRIVATE, window->h*(*pitch), IPC_CREAT | 0777);
+ if ( shminfo->shmid >= 0 ) {
+ shminfo->shmaddr = (char *)shmat(shminfo->shmid, 0, 0);
+ shminfo->readOnly = False;
+ if ( shminfo->shmaddr != (char *)-1 ) {
+ shm_error = False;
+ X_handler = X11_XSetErrorHandler(shm_errhandler);
+ X11_XShmAttach(display, shminfo);
+ X11_XSync(display, False);
+ X11_XSetErrorHandler(X_handler);
+ if ( shm_error )
+ shmdt(shminfo->shmaddr);
+ } else {
+ shm_error = True;
+ }
+ shmctl(shminfo->shmid, IPC_RMID, NULL);
+ } else {
+ shm_error = True;
+ }
+ if (!shm_error) {
+ data->ximage = X11_XShmCreateImage(display, data->visual,
+ vinfo.depth, ZPixmap,
+ shminfo->shmaddr, shminfo,
+ window->w, window->h);
+ if (!data->ximage) {
+ X11_XShmDetach(display, shminfo);
+ X11_XSync(display, False);
+ shmdt(shminfo->shmaddr);
+ } else {
+ /* Done! */
+ data->use_mitshm = SDL_TRUE;
+ *pixels = shminfo->shmaddr;
+ return 0;
+ }
+ }
+ }
+#endif /* not NO_SHARED_MEMORY */
+
+ *pixels = SDL_malloc(window->h*(*pitch));
+ if (*pixels == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ data->ximage = X11_XCreateImage(display, data->visual,
+ vinfo.depth, ZPixmap, 0, (char *)(*pixels),
+ window->w, window->h, 32, 0);
+ if (!data->ximage) {
+ SDL_free(*pixels);
+ return SDL_SetError("Couldn't create XImage");
+ }
+ return 0;
+}
+
+int
+X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects,
+ int numrects)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ int i;
+ int x, y, w ,h;
+#ifndef NO_SHARED_MEMORY
+ if (data->use_mitshm) {
+ for (i = 0; i < numrects; ++i) {
+ x = rects[i].x;
+ y = rects[i].y;
+ w = rects[i].w;
+ h = rects[i].h;
+
+ if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0) {
+ /* Clipped? */
+ continue;
+ }
+ if (x < 0)
+ {
+ x += w;
+ w += rects[i].x;
+ }
+ if (y < 0)
+ {
+ y += h;
+ h += rects[i].y;
+ }
+ if (x + w > window->w)
+ w = window->w - x;
+ if (y + h > window->h)
+ h = window->h - y;
+
+ X11_XShmPutImage(display, data->xwindow, data->gc, data->ximage,
+ x, y, x, y, w, h, False);
+ }
+ }
+ else
+#endif /* !NO_SHARED_MEMORY */
+ {
+ for (i = 0; i < numrects; ++i) {
+ x = rects[i].x;
+ y = rects[i].y;
+ w = rects[i].w;
+ h = rects[i].h;
+
+ if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0) {
+ /* Clipped? */
+ continue;
+ }
+ if (x < 0)
+ {
+ x += w;
+ w += rects[i].x;
+ }
+ if (y < 0)
+ {
+ y += h;
+ h += rects[i].y;
+ }
+ if (x + w > window->w)
+ w = window->w - x;
+ if (y + h > window->h)
+ h = window->h - y;
+
+ X11_XPutImage(display, data->xwindow, data->gc, data->ximage,
+ x, y, x, y, w, h);
+ }
+ }
+
+ X11_XSync(display, False);
+
+ return 0;
+}
+
+void
+X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display;
+
+ if (!data) {
+ /* The window wasn't fully initialized */
+ return;
+ }
+
+ display = data->videodata->display;
+
+ if (data->ximage) {
+ XDestroyImage(data->ximage);
+
+#ifndef NO_SHARED_MEMORY
+ if (data->use_mitshm) {
+ X11_XShmDetach(display, &data->shminfo);
+ X11_XSync(display, False);
+ shmdt(data->shminfo.shmaddr);
+ data->use_mitshm = SDL_FALSE;
+ }
+#endif /* !NO_SHARED_MEMORY */
+
+ data->ximage = NULL;
+ }
+ if (data->gc) {
+ X11_XFreeGC(display, data->gc);
+ data->gc = NULL;
+ }
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.h
new file mode 100644
index 0000000..61bb0c5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11framebuffer.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+
+extern int X11_CreateWindowFramebuffer(_THIS, SDL_Window * window,
+ Uint32 * format,
+ void ** pixels, int *pitch);
+extern int X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
+ const SDL_Rect * rects, int numrects);
+extern void X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.c
new file mode 100644
index 0000000..d667c7b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.c
@@ -0,0 +1,549 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_x11video.h"
+
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/scancodes_darwin.h"
+#include "../../events/scancodes_xfree86.h"
+
+#include <X11/keysym.h>
+#include <X11/XKBlib.h>
+
+#include "imKStoUCS.h"
+
+#ifdef X_HAVE_UTF8_STRING
+#include <locale.h>
+#endif
+
+/* *INDENT-OFF* */
+static const struct {
+ KeySym keysym;
+ SDL_Scancode scancode;
+} KeySymToSDLScancode[] = {
+ { XK_Return, SDL_SCANCODE_RETURN },
+ { XK_Escape, SDL_SCANCODE_ESCAPE },
+ { XK_BackSpace, SDL_SCANCODE_BACKSPACE },
+ { XK_Tab, SDL_SCANCODE_TAB },
+ { XK_Caps_Lock, SDL_SCANCODE_CAPSLOCK },
+ { XK_F1, SDL_SCANCODE_F1 },
+ { XK_F2, SDL_SCANCODE_F2 },
+ { XK_F3, SDL_SCANCODE_F3 },
+ { XK_F4, SDL_SCANCODE_F4 },
+ { XK_F5, SDL_SCANCODE_F5 },
+ { XK_F6, SDL_SCANCODE_F6 },
+ { XK_F7, SDL_SCANCODE_F7 },
+ { XK_F8, SDL_SCANCODE_F8 },
+ { XK_F9, SDL_SCANCODE_F9 },
+ { XK_F10, SDL_SCANCODE_F10 },
+ { XK_F11, SDL_SCANCODE_F11 },
+ { XK_F12, SDL_SCANCODE_F12 },
+ { XK_Print, SDL_SCANCODE_PRINTSCREEN },
+ { XK_Scroll_Lock, SDL_SCANCODE_SCROLLLOCK },
+ { XK_Pause, SDL_SCANCODE_PAUSE },
+ { XK_Insert, SDL_SCANCODE_INSERT },
+ { XK_Home, SDL_SCANCODE_HOME },
+ { XK_Prior, SDL_SCANCODE_PAGEUP },
+ { XK_Delete, SDL_SCANCODE_DELETE },
+ { XK_End, SDL_SCANCODE_END },
+ { XK_Next, SDL_SCANCODE_PAGEDOWN },
+ { XK_Right, SDL_SCANCODE_RIGHT },
+ { XK_Left, SDL_SCANCODE_LEFT },
+ { XK_Down, SDL_SCANCODE_DOWN },
+ { XK_Up, SDL_SCANCODE_UP },
+ { XK_Num_Lock, SDL_SCANCODE_NUMLOCKCLEAR },
+ { XK_KP_Divide, SDL_SCANCODE_KP_DIVIDE },
+ { XK_KP_Multiply, SDL_SCANCODE_KP_MULTIPLY },
+ { XK_KP_Subtract, SDL_SCANCODE_KP_MINUS },
+ { XK_KP_Add, SDL_SCANCODE_KP_PLUS },
+ { XK_KP_Enter, SDL_SCANCODE_KP_ENTER },
+ { XK_KP_Delete, SDL_SCANCODE_KP_PERIOD },
+ { XK_KP_End, SDL_SCANCODE_KP_1 },
+ { XK_KP_Down, SDL_SCANCODE_KP_2 },
+ { XK_KP_Next, SDL_SCANCODE_KP_3 },
+ { XK_KP_Left, SDL_SCANCODE_KP_4 },
+ { XK_KP_Begin, SDL_SCANCODE_KP_5 },
+ { XK_KP_Right, SDL_SCANCODE_KP_6 },
+ { XK_KP_Home, SDL_SCANCODE_KP_7 },
+ { XK_KP_Up, SDL_SCANCODE_KP_8 },
+ { XK_KP_Prior, SDL_SCANCODE_KP_9 },
+ { XK_KP_Insert, SDL_SCANCODE_KP_0 },
+ { XK_KP_Decimal, SDL_SCANCODE_KP_PERIOD },
+ { XK_KP_1, SDL_SCANCODE_KP_1 },
+ { XK_KP_2, SDL_SCANCODE_KP_2 },
+ { XK_KP_3, SDL_SCANCODE_KP_3 },
+ { XK_KP_4, SDL_SCANCODE_KP_4 },
+ { XK_KP_5, SDL_SCANCODE_KP_5 },
+ { XK_KP_6, SDL_SCANCODE_KP_6 },
+ { XK_KP_7, SDL_SCANCODE_KP_7 },
+ { XK_KP_8, SDL_SCANCODE_KP_8 },
+ { XK_KP_9, SDL_SCANCODE_KP_9 },
+ { XK_KP_0, SDL_SCANCODE_KP_0 },
+ { XK_KP_Decimal, SDL_SCANCODE_KP_PERIOD },
+ { XK_Hyper_R, SDL_SCANCODE_APPLICATION },
+ { XK_KP_Equal, SDL_SCANCODE_KP_EQUALS },
+ { XK_F13, SDL_SCANCODE_F13 },
+ { XK_F14, SDL_SCANCODE_F14 },
+ { XK_F15, SDL_SCANCODE_F15 },
+ { XK_F16, SDL_SCANCODE_F16 },
+ { XK_F17, SDL_SCANCODE_F17 },
+ { XK_F18, SDL_SCANCODE_F18 },
+ { XK_F19, SDL_SCANCODE_F19 },
+ { XK_F20, SDL_SCANCODE_F20 },
+ { XK_F21, SDL_SCANCODE_F21 },
+ { XK_F22, SDL_SCANCODE_F22 },
+ { XK_F23, SDL_SCANCODE_F23 },
+ { XK_F24, SDL_SCANCODE_F24 },
+ { XK_Execute, SDL_SCANCODE_EXECUTE },
+ { XK_Help, SDL_SCANCODE_HELP },
+ { XK_Menu, SDL_SCANCODE_MENU },
+ { XK_Select, SDL_SCANCODE_SELECT },
+ { XK_Cancel, SDL_SCANCODE_STOP },
+ { XK_Redo, SDL_SCANCODE_AGAIN },
+ { XK_Undo, SDL_SCANCODE_UNDO },
+ { XK_Find, SDL_SCANCODE_FIND },
+ { XK_KP_Separator, SDL_SCANCODE_KP_COMMA },
+ { XK_Sys_Req, SDL_SCANCODE_SYSREQ },
+ { XK_Control_L, SDL_SCANCODE_LCTRL },
+ { XK_Shift_L, SDL_SCANCODE_LSHIFT },
+ { XK_Alt_L, SDL_SCANCODE_LALT },
+ { XK_Meta_L, SDL_SCANCODE_LGUI },
+ { XK_Super_L, SDL_SCANCODE_LGUI },
+ { XK_Control_R, SDL_SCANCODE_RCTRL },
+ { XK_Shift_R, SDL_SCANCODE_RSHIFT },
+ { XK_Alt_R, SDL_SCANCODE_RALT },
+ { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT },
+ { XK_Meta_R, SDL_SCANCODE_RGUI },
+ { XK_Super_R, SDL_SCANCODE_RGUI },
+ { XK_Mode_switch, SDL_SCANCODE_MODE },
+ { XK_period, SDL_SCANCODE_PERIOD },
+ { XK_comma, SDL_SCANCODE_COMMA },
+ { XK_slash, SDL_SCANCODE_SLASH },
+ { XK_backslash, SDL_SCANCODE_BACKSLASH },
+ { XK_minus, SDL_SCANCODE_MINUS },
+ { XK_equal, SDL_SCANCODE_EQUALS },
+ { XK_space, SDL_SCANCODE_SPACE },
+ { XK_grave, SDL_SCANCODE_GRAVE },
+ { XK_apostrophe, SDL_SCANCODE_APOSTROPHE },
+ { XK_bracketleft, SDL_SCANCODE_LEFTBRACKET },
+ { XK_bracketright, SDL_SCANCODE_RIGHTBRACKET },
+};
+
+static const struct
+{
+ SDL_Scancode const *table;
+ int table_size;
+} scancode_set[] = {
+ { darwin_scancode_table, SDL_arraysize(darwin_scancode_table) },
+ { xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table) },
+ { xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) },
+ { xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) },
+};
+/* *INDENT-OFF* */
+
+/* This function only works for keyboards in US QWERTY layout */
+static SDL_Scancode
+X11_KeyCodeToSDLScancode(_THIS, KeyCode keycode)
+{
+ KeySym keysym;
+ int i;
+
+ keysym = X11_KeyCodeToSym(_this, keycode, 0);
+ if (keysym == NoSymbol) {
+ return SDL_SCANCODE_UNKNOWN;
+ }
+
+ if (keysym >= XK_a && keysym <= XK_z) {
+ return SDL_SCANCODE_A + (keysym - XK_a);
+ }
+ if (keysym >= XK_A && keysym <= XK_Z) {
+ return SDL_SCANCODE_A + (keysym - XK_A);
+ }
+
+ if (keysym == XK_0) {
+ return SDL_SCANCODE_0;
+ }
+ if (keysym >= XK_1 && keysym <= XK_9) {
+ return SDL_SCANCODE_1 + (keysym - XK_1);
+ }
+
+ for (i = 0; i < SDL_arraysize(KeySymToSDLScancode); ++i) {
+ if (keysym == KeySymToSDLScancode[i].keysym) {
+ return KeySymToSDLScancode[i].scancode;
+ }
+ }
+ return SDL_SCANCODE_UNKNOWN;
+}
+
+static Uint32
+X11_KeyCodeToUcs4(_THIS, KeyCode keycode, unsigned char group)
+{
+ KeySym keysym = X11_KeyCodeToSym(_this, keycode, group);
+
+ if (keysym == NoSymbol) {
+ return 0;
+ }
+
+ return X11_KeySymToUcs4(keysym);
+}
+
+KeySym
+X11_KeyCodeToSym(_THIS, KeyCode keycode, unsigned char group)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ KeySym keysym;
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+ if (data->xkb) {
+ int num_groups = XkbKeyNumGroups(data->xkb, keycode);
+ unsigned char info = XkbKeyGroupInfo(data->xkb, keycode);
+
+ if (num_groups && group >= num_groups) {
+
+ int action = XkbOutOfRangeGroupAction(info);
+
+ if (action == XkbRedirectIntoRange) {
+ if ((group = XkbOutOfRangeGroupNumber(info)) >= num_groups) {
+ group = 0;
+ }
+ } else if (action == XkbClampIntoRange) {
+ group = num_groups - 1;
+ } else {
+ group %= num_groups;
+ }
+ }
+ keysym = X11_XkbKeycodeToKeysym(data->display, keycode, group, 0);
+ } else {
+ keysym = X11_XKeycodeToKeysym(data->display, keycode, 0);
+ }
+#else
+ keysym = X11_XKeycodeToKeysym(data->display, keycode, 0);
+#endif
+
+ return keysym;
+}
+
+int
+X11_InitKeyboard(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ int i = 0;
+ int j = 0;
+ int min_keycode, max_keycode;
+ struct {
+ SDL_Scancode scancode;
+ KeySym keysym;
+ int value;
+ } fingerprint[] = {
+ { SDL_SCANCODE_HOME, XK_Home, 0 },
+ { SDL_SCANCODE_PAGEUP, XK_Prior, 0 },
+ { SDL_SCANCODE_UP, XK_Up, 0 },
+ { SDL_SCANCODE_LEFT, XK_Left, 0 },
+ { SDL_SCANCODE_DELETE, XK_Delete, 0 },
+ { SDL_SCANCODE_KP_ENTER, XK_KP_Enter, 0 },
+ };
+ int best_distance;
+ int best_index;
+ int distance;
+ BOOL xkb_repeat = 0;
+
+ X11_XAutoRepeatOn(data->display);
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+ {
+ int xkb_major = XkbMajorVersion;
+ int xkb_minor = XkbMinorVersion;
+
+ if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
+ data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
+ }
+
+ /* This will remove KeyRelease events for held keys */
+ X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat);
+ }
+#endif
+
+ /* Open a connection to the X input manager */
+#ifdef X_HAVE_UTF8_STRING
+ if (SDL_X11_HAVE_UTF8) {
+ /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that
+ Compose keys will work correctly. */
+ char *prev_locale = setlocale(LC_ALL, NULL);
+ char *prev_xmods = X11_XSetLocaleModifiers(NULL);
+ const char *new_xmods = "";
+#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
+ const char *env_xmods = SDL_getenv("XMODIFIERS");
+#endif
+ SDL_bool has_dbus_ime_support = SDL_FALSE;
+
+ if (prev_locale) {
+ prev_locale = SDL_strdup(prev_locale);
+ }
+
+ if (prev_xmods) {
+ prev_xmods = SDL_strdup(prev_xmods);
+ }
+
+ /* IBus resends some key events that were filtered by XFilterEvents
+ when it is used via XIM which causes issues. Prevent this by forcing
+ @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
+ the DBus implementation, which also has support for pre-editing. */
+#ifdef HAVE_IBUS_IBUS_H
+ if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
+ has_dbus_ime_support = SDL_TRUE;
+ }
+#endif
+#ifdef HAVE_FCITX_FRONTEND_H
+ if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
+ has_dbus_ime_support = SDL_TRUE;
+ }
+#endif
+ if (has_dbus_ime_support || !xkb_repeat) {
+ new_xmods = "@im=none";
+ }
+
+ setlocale(LC_ALL, "");
+ X11_XSetLocaleModifiers(new_xmods);
+
+ data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
+
+ /* Reset the locale + X locale modifiers back to how they were,
+ locale first because the X locale modifiers depend on it. */
+ setlocale(LC_ALL, prev_locale);
+ X11_XSetLocaleModifiers(prev_xmods);
+
+ if (prev_locale) {
+ SDL_free(prev_locale);
+ }
+
+ if (prev_xmods) {
+ SDL_free(prev_xmods);
+ }
+ }
+#endif
+ /* Try to determine which scancodes are being used based on fingerprint */
+ best_distance = SDL_arraysize(fingerprint) + 1;
+ best_index = -1;
+ X11_XDisplayKeycodes(data->display, &min_keycode, &max_keycode);
+ for (i = 0; i < SDL_arraysize(fingerprint); ++i) {
+ fingerprint[i].value =
+ X11_XKeysymToKeycode(data->display, fingerprint[i].keysym) -
+ min_keycode;
+ }
+ for (i = 0; i < SDL_arraysize(scancode_set); ++i) {
+ /* Make sure the scancode set isn't too big */
+ if ((max_keycode - min_keycode + 1) <= scancode_set[i].table_size) {
+ continue;
+ }
+ distance = 0;
+ for (j = 0; j < SDL_arraysize(fingerprint); ++j) {
+ if (fingerprint[j].value < 0
+ || fingerprint[j].value >= scancode_set[i].table_size) {
+ distance += 1;
+ } else if (scancode_set[i].table[fingerprint[j].value] != fingerprint[j].scancode) {
+ distance += 1;
+ }
+ }
+ if (distance < best_distance) {
+ best_distance = distance;
+ best_index = i;
+ }
+ }
+ if (best_index >= 0 && best_distance <= 2) {
+#ifdef DEBUG_KEYBOARD
+ printf("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", best_index, min_keycode, max_keycode, scancode_set[best_index].table_size);
+#endif
+ SDL_memcpy(&data->key_layout[min_keycode], scancode_set[best_index].table,
+ sizeof(SDL_Scancode) * scancode_set[best_index].table_size);
+ } else {
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+
+ printf
+ ("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n");
+
+ /* Determine key_layout - only works on US QWERTY layout */
+ SDL_GetDefaultKeymap(keymap);
+ for (i = min_keycode; i <= max_keycode; ++i) {
+ KeySym sym;
+ sym = X11_KeyCodeToSym(_this, (KeyCode) i, 0);
+ if (sym != NoSymbol) {
+ SDL_Scancode scancode;
+ printf("code = %d, sym = 0x%X (%s) ", i - min_keycode,
+ (unsigned int) sym, X11_XKeysymToString(sym));
+ scancode = X11_KeyCodeToSDLScancode(_this, i);
+ data->key_layout[i] = scancode;
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ printf("scancode not found\n");
+ } else {
+ printf("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode));
+ }
+ }
+ }
+ }
+
+ X11_UpdateKeymap(_this);
+
+ SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
+
+#ifdef SDL_USE_IME
+ SDL_IME_Init();
+#endif
+
+ return 0;
+}
+
+void
+X11_UpdateKeymap(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ int i;
+ SDL_Scancode scancode;
+ SDL_Keycode keymap[SDL_NUM_SCANCODES];
+ unsigned char group = 0;
+
+ SDL_GetDefaultKeymap(keymap);
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+ if (data->xkb) {
+ XkbStateRec state;
+ X11_XkbGetUpdatedMap(data->display, XkbAllClientInfoMask, data->xkb);
+
+ if (X11_XkbGetState(data->display, XkbUseCoreKbd, &state) == Success) {
+ group = state.group;
+ }
+ }
+#endif
+
+
+ for (i = 0; i < SDL_arraysize(data->key_layout); i++) {
+ Uint32 key;
+
+ /* Make sure this is a valid scancode */
+ scancode = data->key_layout[i];
+ if (scancode == SDL_SCANCODE_UNKNOWN) {
+ continue;
+ }
+
+ /* See if there is a UCS keycode for this scancode */
+ key = X11_KeyCodeToUcs4(_this, (KeyCode)i, group);
+ if (key) {
+ keymap[scancode] = key;
+ } else {
+ SDL_Scancode keyScancode = X11_KeyCodeToSDLScancode(_this, (KeyCode)i);
+
+ switch (keyScancode) {
+ case SDL_SCANCODE_RETURN:
+ keymap[scancode] = SDLK_RETURN;
+ break;
+ case SDL_SCANCODE_ESCAPE:
+ keymap[scancode] = SDLK_ESCAPE;
+ break;
+ case SDL_SCANCODE_BACKSPACE:
+ keymap[scancode] = SDLK_BACKSPACE;
+ break;
+ case SDL_SCANCODE_TAB:
+ keymap[scancode] = SDLK_TAB;
+ break;
+ case SDL_SCANCODE_DELETE:
+ keymap[scancode] = SDLK_DELETE;
+ break;
+ default:
+ keymap[scancode] = SDL_SCANCODE_TO_KEYCODE(keyScancode);
+ break;
+ }
+ }
+ }
+ SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+}
+
+void
+X11_QuitKeyboard(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+ if (data->xkb) {
+ X11_XkbFreeKeyboard(data->xkb, 0, True);
+ data->xkb = NULL;
+ }
+#endif
+
+#ifdef SDL_USE_IME
+ SDL_IME_Quit();
+#endif
+}
+
+static void
+X11_ResetXIM(_THIS)
+{
+#ifdef X_HAVE_UTF8_STRING
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ int i;
+
+ if (videodata && videodata->windowlist) {
+ for (i = 0; i < videodata->numwindows; ++i) {
+ SDL_WindowData *data = videodata->windowlist[i];
+ if (data && data->ic) {
+ /* Clear any partially entered dead keys */
+ char *contents = X11_Xutf8ResetIC(data->ic);
+ if (contents) {
+ X11_XFree(contents);
+ }
+ }
+ }
+ }
+#endif
+}
+
+void
+X11_StartTextInput(_THIS)
+{
+ X11_ResetXIM(_this);
+}
+
+void
+X11_StopTextInput(_THIS)
+{
+ X11_ResetXIM(_this);
+#ifdef SDL_USE_IME
+ SDL_IME_Reset();
+#endif
+}
+
+void
+X11_SetTextInputRect(_THIS, SDL_Rect *rect)
+{
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return;
+ }
+
+#ifdef SDL_USE_IME
+ SDL_IME_UpdateTextRect(rect);
+#endif
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.h
new file mode 100644
index 0000000..c1cc69c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11keyboard.h
@@ -0,0 +1,36 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11keyboard_h_
+#define SDL_x11keyboard_h_
+
+extern int X11_InitKeyboard(_THIS);
+extern void X11_UpdateKeymap(_THIS);
+extern void X11_QuitKeyboard(_THIS);
+extern void X11_StartTextInput(_THIS);
+extern void X11_StopTextInput(_THIS);
+extern void X11_SetTextInputRect(_THIS, SDL_Rect *rect);
+extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group);
+
+#endif /* SDL_x11keyboard_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.c
new file mode 100644
index 0000000..fe6ab19
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.c
@@ -0,0 +1,853 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL.h"
+#include "SDL_x11video.h"
+#include "SDL_x11dyn.h"
+#include "SDL_assert.h"
+#include "SDL_x11messagebox.h"
+
+#include <X11/keysym.h>
+#include <locale.h>
+
+
+#define SDL_FORK_MESSAGEBOX 1
+#define SDL_SET_LOCALE 1
+
+#if SDL_FORK_MESSAGEBOX
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <errno.h>
+#endif
+
+#define MAX_BUTTONS 8 /* Maximum number of buttons supported */
+#define MAX_TEXT_LINES 32 /* Maximum number of text lines supported */
+#define MIN_BUTTON_WIDTH 64 /* Minimum button width */
+#define MIN_DIALOG_WIDTH 200 /* Minimum dialog width */
+#define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */
+
+static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1";
+static const char g_MessageBoxFont[] = "-*-*-medium-r-normal--*-120-*-*-*-*-*-*";
+
+static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = {
+ { 56, 54, 53 }, /* SDL_MESSAGEBOX_COLOR_BACKGROUND, */
+ { 209, 207, 205 }, /* SDL_MESSAGEBOX_COLOR_TEXT, */
+ { 140, 135, 129 }, /* SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, */
+ { 105, 102, 99 }, /* SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, */
+ { 205, 202, 53 }, /* SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, */
+};
+
+#define SDL_MAKE_RGB( _r, _g, _b ) ( ( ( Uint32 )( _r ) << 16 ) | \
+ ( ( Uint32 )( _g ) << 8 ) | \
+ ( ( Uint32 )( _b ) ) )
+
+typedef struct SDL_MessageBoxButtonDataX11 {
+ int x, y; /* Text position */
+ int length; /* Text length */
+ int text_width; /* Text width */
+
+ SDL_Rect rect; /* Rectangle for entire button */
+
+ const SDL_MessageBoxButtonData *buttondata; /* Button data from caller */
+} SDL_MessageBoxButtonDataX11;
+
+typedef struct TextLineData {
+ int width; /* Width of this text line */
+ int length; /* String length of this text line */
+ const char *text; /* Text for this line */
+} TextLineData;
+
+typedef struct SDL_MessageBoxDataX11
+{
+ Display *display;
+ int screen;
+ Window window;
+#if SDL_VIDEO_DRIVER_X11_XDBE
+ XdbeBackBuffer buf;
+ SDL_bool xdbe; /* Whether Xdbe is present or not */
+#endif
+ long event_mask;
+ Atom wm_protocols;
+ Atom wm_delete_message;
+
+ int dialog_width; /* Dialog box width. */
+ int dialog_height; /* Dialog box height. */
+
+ XFontSet font_set; /* for UTF-8 systems */
+ XFontStruct *font_struct; /* Latin1 (ASCII) fallback. */
+ int xtext, ytext; /* Text position to start drawing at. */
+ int numlines; /* Count of Text lines. */
+ int text_height; /* Height for text lines. */
+ TextLineData linedata[ MAX_TEXT_LINES ];
+
+ int *pbuttonid; /* Pointer to user return buttonid value. */
+
+ int button_press_index; /* Index into buttondata/buttonpos for button which is pressed (or -1). */
+ int mouse_over_index; /* Index into buttondata/buttonpos for button mouse is over (or -1). */
+
+ int numbuttons; /* Count of buttons. */
+ const SDL_MessageBoxButtonData *buttondata;
+ SDL_MessageBoxButtonDataX11 buttonpos[ MAX_BUTTONS ];
+
+ Uint32 color[ SDL_MESSAGEBOX_COLOR_MAX ];
+
+ const SDL_MessageBoxData *messageboxdata;
+} SDL_MessageBoxDataX11;
+
+/* Maximum helper for ints. */
+static SDL_INLINE int
+IntMax( int a, int b )
+{
+ return ( a > b ) ? a : b;
+}
+
+/* Return width and height for a string. */
+static void
+GetTextWidthHeight( SDL_MessageBoxDataX11 *data, const char *str, int nbytes, int *pwidth, int *pheight )
+{
+ if (SDL_X11_HAVE_UTF8) {
+ XRectangle overall_ink, overall_logical;
+ X11_Xutf8TextExtents(data->font_set, str, nbytes, &overall_ink, &overall_logical);
+ *pwidth = overall_logical.width;
+ *pheight = overall_logical.height;
+ } else {
+ XCharStruct text_structure;
+ int font_direction, font_ascent, font_descent;
+ X11_XTextExtents( data->font_struct, str, nbytes,
+ &font_direction, &font_ascent, &font_descent,
+ &text_structure );
+ *pwidth = text_structure.width;
+ *pheight = text_structure.ascent + text_structure.descent;
+ }
+}
+
+/* Return index of button if position x,y is contained therein. */
+static int
+GetHitButtonIndex( SDL_MessageBoxDataX11 *data, int x, int y )
+{
+ int i;
+ int numbuttons = data->numbuttons;
+ SDL_MessageBoxButtonDataX11 *buttonpos = data->buttonpos;
+
+ for ( i = 0; i < numbuttons; i++ ) {
+ SDL_Rect *rect = &buttonpos[ i ].rect;
+
+ if ( ( x >= rect->x ) &&
+ ( x <= ( rect->x + rect->w ) ) &&
+ ( y >= rect->y ) &&
+ ( y <= ( rect->y + rect->h ) ) ) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+/* Initialize SDL_MessageBoxData structure and Display, etc. */
+static int
+X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * messageboxdata, int * pbuttonid )
+{
+ int i;
+ int numbuttons = messageboxdata->numbuttons;
+ const SDL_MessageBoxButtonData *buttondata = messageboxdata->buttons;
+ const SDL_MessageBoxColor *colorhints;
+
+ if ( numbuttons > MAX_BUTTONS ) {
+ return SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS);
+ }
+
+ data->dialog_width = MIN_DIALOG_WIDTH;
+ data->dialog_height = MIN_DIALOG_HEIGHT;
+ data->messageboxdata = messageboxdata;
+ data->buttondata = buttondata;
+ data->numbuttons = numbuttons;
+ data->pbuttonid = pbuttonid;
+
+ data->display = X11_XOpenDisplay( NULL );
+ if ( !data->display ) {
+ return SDL_SetError("Couldn't open X11 display");
+ }
+
+ if (SDL_X11_HAVE_UTF8) {
+ char **missing = NULL;
+ int num_missing = 0;
+ data->font_set = X11_XCreateFontSet(data->display, g_MessageBoxFont,
+ &missing, &num_missing, NULL);
+ if ( missing != NULL ) {
+ X11_XFreeStringList(missing);
+ }
+ if ( data->font_set == NULL ) {
+ return SDL_SetError("Couldn't load font %s", g_MessageBoxFont);
+ }
+ } else {
+ data->font_struct = X11_XLoadQueryFont( data->display, g_MessageBoxFontLatin1 );
+ if ( data->font_struct == NULL ) {
+ return SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1);
+ }
+ }
+
+ if ( messageboxdata->colorScheme ) {
+ colorhints = messageboxdata->colorScheme->colors;
+ } else {
+ colorhints = g_default_colors;
+ }
+
+ /* Convert our SDL_MessageBoxColor r,g,b values to packed RGB format. */
+ for ( i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; i++ ) {
+ data->color[ i ] = SDL_MAKE_RGB( colorhints[ i ].r, colorhints[ i ].g, colorhints[ i ].b );
+ }
+
+ return 0;
+}
+
+/* Calculate and initialize text and button locations. */
+static int
+X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data )
+{
+ int i;
+ int ybuttons;
+ int text_width_max = 0;
+ int button_text_height = 0;
+ int button_width = MIN_BUTTON_WIDTH;
+ const SDL_MessageBoxData *messageboxdata = data->messageboxdata;
+
+ /* Go over text and break linefeeds into separate lines. */
+ if ( messageboxdata->message && messageboxdata->message[ 0 ] ) {
+ const char *text = messageboxdata->message;
+ TextLineData *plinedata = data->linedata;
+
+ for ( i = 0; i < MAX_TEXT_LINES; i++, plinedata++ ) {
+ int height;
+ char *lf = SDL_strchr( ( char * )text, '\n' );
+
+ data->numlines++;
+
+ /* Only grab length up to lf if it exists and isn't the last line. */
+ plinedata->length = ( lf && ( i < MAX_TEXT_LINES - 1 ) ) ? ( lf - text ) : SDL_strlen( text );
+ plinedata->text = text;
+
+ GetTextWidthHeight( data, text, plinedata->length, &plinedata->width, &height );
+
+ /* Text and widths are the largest we've ever seen. */
+ data->text_height = IntMax( data->text_height, height );
+ text_width_max = IntMax( text_width_max, plinedata->width );
+
+ if (lf && (lf > text) && (lf[-1] == '\r')) {
+ plinedata->length--;
+ }
+
+ text += plinedata->length + 1;
+
+ /* Break if there are no more linefeeds. */
+ if ( !lf )
+ break;
+ }
+
+ /* Bump up the text height slightly. */
+ data->text_height += 2;
+ }
+
+ /* Loop through all buttons and calculate the button widths and height. */
+ for ( i = 0; i < data->numbuttons; i++ ) {
+ int height;
+
+ data->buttonpos[ i ].buttondata = &data->buttondata[ i ];
+ data->buttonpos[ i ].length = SDL_strlen( data->buttondata[ i ].text );
+
+ GetTextWidthHeight( data, data->buttondata[ i ].text, SDL_strlen( data->buttondata[ i ].text ),
+ &data->buttonpos[ i ].text_width, &height );
+
+ button_width = IntMax( button_width, data->buttonpos[ i ].text_width );
+ button_text_height = IntMax( button_text_height, height );
+ }
+
+ if ( data->numlines ) {
+ /* x,y for this line of text. */
+ data->xtext = data->text_height;
+ data->ytext = data->text_height + data->text_height;
+
+ /* Bump button y down to bottom of text. */
+ ybuttons = 3 * data->ytext / 2 + ( data->numlines - 1 ) * data->text_height;
+
+ /* Bump the dialog box width and height up if needed. */
+ data->dialog_width = IntMax( data->dialog_width, 2 * data->xtext + text_width_max );
+ data->dialog_height = IntMax( data->dialog_height, ybuttons );
+ } else {
+ /* Button y starts at height of button text. */
+ ybuttons = button_text_height;
+ }
+
+ if ( data->numbuttons ) {
+ int x, y;
+ int width_of_buttons;
+ int button_spacing = button_text_height;
+ int button_height = 2 * button_text_height;
+
+ /* Bump button width up a bit. */
+ button_width += button_text_height;
+
+ /* Get width of all buttons lined up. */
+ width_of_buttons = data->numbuttons * button_width + ( data->numbuttons - 1 ) * button_spacing;
+
+ /* Bump up dialog width and height if buttons are wider than text. */
+ data->dialog_width = IntMax( data->dialog_width, width_of_buttons + 2 * button_spacing );
+ data->dialog_height = IntMax( data->dialog_height, ybuttons + 2 * button_height );
+
+ /* Location for first button. */
+ x = ( data->dialog_width - width_of_buttons ) / 2;
+ y = ybuttons + ( data->dialog_height - ybuttons - button_height ) / 2;
+
+ for ( i = 0; i < data->numbuttons; i++ ) {
+ /* Button coordinates. */
+ data->buttonpos[ i ].rect.x = x;
+ data->buttonpos[ i ].rect.y = y;
+ data->buttonpos[ i ].rect.w = button_width;
+ data->buttonpos[ i ].rect.h = button_height;
+
+ /* Button text coordinates. */
+ data->buttonpos[ i ].x = x + ( button_width - data->buttonpos[ i ].text_width ) / 2;
+ data->buttonpos[ i ].y = y + ( button_height - button_text_height - 1 ) / 2 + button_text_height;
+
+ /* Scoot over for next button. */
+ x += button_width + button_spacing;
+ }
+ }
+
+ return 0;
+}
+
+/* Free SDL_MessageBoxData data. */
+static void
+X11_MessageBoxShutdown( SDL_MessageBoxDataX11 *data )
+{
+ if ( data->font_set != NULL ) {
+ X11_XFreeFontSet( data->display, data->font_set );
+ data->font_set = NULL;
+ }
+
+ if ( data->font_struct != NULL ) {
+ X11_XFreeFont( data->display, data->font_struct );
+ data->font_struct = NULL;
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XDBE
+ if ( SDL_X11_HAVE_XDBE && data->xdbe ) {
+ X11_XdbeDeallocateBackBufferName(data->display, data->buf);
+ }
+#endif
+
+ if ( data->display ) {
+ if ( data->window != None ) {
+ X11_XWithdrawWindow( data->display, data->window, data->screen );
+ X11_XDestroyWindow( data->display, data->window );
+ data->window = None;
+ }
+
+ X11_XCloseDisplay( data->display );
+ data->display = NULL;
+ }
+}
+
+/* Create and set up our X11 dialog box indow. */
+static int
+X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data )
+{
+ int x, y;
+ XSizeHints *sizehints;
+ XSetWindowAttributes wnd_attr;
+ Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME;
+ Display *display = data->display;
+ SDL_WindowData *windowdata = NULL;
+ const SDL_MessageBoxData *messageboxdata = data->messageboxdata;
+ char *title_locale = NULL;
+
+ if ( messageboxdata->window ) {
+ SDL_DisplayData *displaydata =
+ (SDL_DisplayData *) SDL_GetDisplayForWindow(messageboxdata->window)->driverdata;
+ windowdata = (SDL_WindowData *)messageboxdata->window->driverdata;
+ data->screen = displaydata->screen;
+ } else {
+ data->screen = DefaultScreen( display );
+ }
+
+ data->event_mask = ExposureMask |
+ ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask |
+ StructureNotifyMask | FocusChangeMask | PointerMotionMask;
+ wnd_attr.event_mask = data->event_mask;
+
+ data->window = X11_XCreateWindow(
+ display, RootWindow(display, data->screen),
+ 0, 0,
+ data->dialog_width, data->dialog_height,
+ 0, CopyFromParent, InputOutput, CopyFromParent,
+ CWEventMask, &wnd_attr );
+ if ( data->window == None ) {
+ return SDL_SetError("Couldn't create X window");
+ }
+
+ if ( windowdata ) {
+ /* http://tronche.com/gui/x/icccm/sec-4.html#WM_TRANSIENT_FOR */
+ X11_XSetTransientForHint( display, data->window, windowdata->xwindow );
+ }
+
+ X11_XStoreName( display, data->window, messageboxdata->title );
+ _NET_WM_NAME = X11_XInternAtom(display, "_NET_WM_NAME", False);
+
+ title_locale = SDL_iconv_utf8_locale(messageboxdata->title);
+ if (title_locale) {
+ XTextProperty titleprop;
+ Status status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
+ SDL_free(title_locale);
+ if (status) {
+ X11_XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME);
+ X11_XFree(titleprop.value);
+ }
+ }
+
+#ifdef X_HAVE_UTF8_STRING
+ if (SDL_X11_HAVE_UTF8) {
+ XTextProperty titleprop;
+ Status status = X11_Xutf8TextListToTextProperty(display, (char **) &messageboxdata->title, 1,
+ XUTF8StringStyle, &titleprop);
+ if (status == Success) {
+ X11_XSetTextProperty(display, data->window, &titleprop,
+ _NET_WM_NAME);
+ X11_XFree(titleprop.value);
+ }
+ }
+#endif
+
+ /* Let the window manager know this is a dialog box */
+ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
+ _NET_WM_WINDOW_TYPE_DIALOG = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE_DIALOG", False);
+ X11_XChangeProperty(display, data->window, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
+ PropModeReplace,
+ (unsigned char *)&_NET_WM_WINDOW_TYPE_DIALOG, 1);
+
+ /* Allow the window to be deleted by the window manager */
+ data->wm_protocols = X11_XInternAtom( display, "WM_PROTOCOLS", False );
+ data->wm_delete_message = X11_XInternAtom( display, "WM_DELETE_WINDOW", False );
+ X11_XSetWMProtocols( display, data->window, &data->wm_delete_message, 1 );
+
+ if ( windowdata ) {
+ XWindowAttributes attrib;
+ Window dummy;
+
+ X11_XGetWindowAttributes(display, windowdata->xwindow, &attrib);
+ x = attrib.x + ( attrib.width - data->dialog_width ) / 2;
+ y = attrib.y + ( attrib.height - data->dialog_height ) / 3 ;
+ X11_XTranslateCoordinates(display, windowdata->xwindow, RootWindow(display, data->screen), x, y, &x, &y, &dummy);
+ } else {
+ const SDL_VideoDevice *dev = SDL_GetVideoDevice();
+ if ((dev) && (dev->displays) && (dev->num_displays > 0)) {
+ const SDL_VideoDisplay *dpy = &dev->displays[0];
+ const SDL_DisplayData *dpydata = (SDL_DisplayData *) dpy->driverdata;
+ x = dpydata->x + (( dpy->current_mode.w - data->dialog_width ) / 2);
+ y = dpydata->y + (( dpy->current_mode.h - data->dialog_height ) / 3);
+ } else { /* oh well. This will misposition on a multi-head setup. Init first next time. */
+ x = ( DisplayWidth( display, data->screen ) - data->dialog_width ) / 2;
+ y = ( DisplayHeight( display, data->screen ) - data->dialog_height ) / 3 ;
+ }
+ }
+ X11_XMoveWindow( display, data->window, x, y );
+
+ sizehints = X11_XAllocSizeHints();
+ if ( sizehints ) {
+ sizehints->flags = USPosition | USSize | PMaxSize | PMinSize;
+ sizehints->x = x;
+ sizehints->y = y;
+ sizehints->width = data->dialog_width;
+ sizehints->height = data->dialog_height;
+
+ sizehints->min_width = sizehints->max_width = data->dialog_width;
+ sizehints->min_height = sizehints->max_height = data->dialog_height;
+
+ X11_XSetWMNormalHints( display, data->window, sizehints );
+
+ X11_XFree( sizehints );
+ }
+
+ X11_XMapRaised( display, data->window );
+
+#if SDL_VIDEO_DRIVER_X11_XDBE
+ /* Initialise a back buffer for double buffering */
+ if (SDL_X11_HAVE_XDBE) {
+ int xdbe_major, xdbe_minor;
+ if (X11_XdbeQueryExtension(display, &xdbe_major, &xdbe_minor) != 0) {
+ data->xdbe = SDL_TRUE;
+ data->buf = X11_XdbeAllocateBackBufferName(display, data->window, XdbeUndefined);
+ } else {
+ data->xdbe = SDL_FALSE;
+ }
+ }
+#endif
+
+ return 0;
+}
+
+/* Draw our message box. */
+static void
+X11_MessageBoxDraw( SDL_MessageBoxDataX11 *data, GC ctx )
+{
+ int i;
+ Drawable window = data->window;
+ Display *display = data->display;
+
+#if SDL_VIDEO_DRIVER_X11_XDBE
+ if (SDL_X11_HAVE_XDBE && data->xdbe) {
+ window = data->buf;
+ X11_XdbeBeginIdiom(data->display);
+ }
+#endif
+
+ X11_XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ] );
+ X11_XFillRectangle( display, window, ctx, 0, 0, data->dialog_width, data->dialog_height );
+
+ X11_XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_TEXT ] );
+ for ( i = 0; i < data->numlines; i++ ) {
+ TextLineData *plinedata = &data->linedata[ i ];
+
+ if (SDL_X11_HAVE_UTF8) {
+ X11_Xutf8DrawString( display, window, data->font_set, ctx,
+ data->xtext, data->ytext + i * data->text_height,
+ plinedata->text, plinedata->length );
+ } else {
+ X11_XDrawString( display, window, ctx,
+ data->xtext, data->ytext + i * data->text_height,
+ plinedata->text, plinedata->length );
+ }
+ }
+
+ for ( i = 0; i < data->numbuttons; i++ ) {
+ SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[ i ];
+ const SDL_MessageBoxButtonData *buttondata = buttondatax11->buttondata;
+ int border = ( buttondata->flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT ) ? 2 : 0;
+ int offset = ( ( data->mouse_over_index == i ) && ( data->button_press_index == data->mouse_over_index ) ) ? 1 : 0;
+
+ X11_XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND ] );
+ X11_XFillRectangle( display, window, ctx,
+ buttondatax11->rect.x - border, buttondatax11->rect.y - border,
+ buttondatax11->rect.w + 2 * border, buttondatax11->rect.h + 2 * border );
+
+ X11_XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BUTTON_BORDER ] );
+ X11_XDrawRectangle( display, window, ctx,
+ buttondatax11->rect.x, buttondatax11->rect.y,
+ buttondatax11->rect.w, buttondatax11->rect.h );
+
+ X11_XSetForeground( display, ctx, ( data->mouse_over_index == i ) ?
+ data->color[ SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED ] :
+ data->color[ SDL_MESSAGEBOX_COLOR_TEXT ] );
+
+ if (SDL_X11_HAVE_UTF8) {
+ X11_Xutf8DrawString( display, window, data->font_set, ctx,
+ buttondatax11->x + offset,
+ buttondatax11->y + offset,
+ buttondata->text, buttondatax11->length );
+ } else {
+ X11_XDrawString( display, window, ctx,
+ buttondatax11->x + offset, buttondatax11->y + offset,
+ buttondata->text, buttondatax11->length );
+ }
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XDBE
+ if (SDL_X11_HAVE_XDBE && data->xdbe) {
+ XdbeSwapInfo swap_info;
+ swap_info.swap_window = data->window;
+ swap_info.swap_action = XdbeUndefined;
+ X11_XdbeSwapBuffers(data->display, &swap_info, 1);
+ X11_XdbeEndIdiom(data->display);
+ }
+#endif
+}
+
+static Bool
+X11_MessageBoxEventTest(Display *display, XEvent *event, XPointer arg)
+{
+ const SDL_MessageBoxDataX11 *data = (const SDL_MessageBoxDataX11 *) arg;
+ return ((event->xany.display == data->display) && (event->xany.window == data->window)) ? True : False;
+}
+
+/* Loop and handle message box event messages until something kills it. */
+static int
+X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data )
+{
+ GC ctx;
+ XGCValues ctx_vals;
+ SDL_bool close_dialog = SDL_FALSE;
+ SDL_bool has_focus = SDL_TRUE;
+ KeySym last_key_pressed = XK_VoidSymbol;
+ unsigned long gcflags = GCForeground | GCBackground;
+
+ SDL_zero(ctx_vals);
+ ctx_vals.foreground = data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ];
+ ctx_vals.background = data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ];
+
+ if (!SDL_X11_HAVE_UTF8) {
+ gcflags |= GCFont;
+ ctx_vals.font = data->font_struct->fid;
+ }
+
+ ctx = X11_XCreateGC( data->display, data->window, gcflags, &ctx_vals );
+ if ( ctx == None ) {
+ return SDL_SetError("Couldn't create graphics context");
+ }
+
+ data->button_press_index = -1; /* Reset what button is currently depressed. */
+ data->mouse_over_index = -1; /* Reset what button the mouse is over. */
+
+ while( !close_dialog ) {
+ XEvent e;
+ SDL_bool draw = SDL_TRUE;
+
+ /* can't use XWindowEvent() because it can't handle ClientMessage events. */
+ /* can't use XNextEvent() because we only want events for this window. */
+ X11_XIfEvent( data->display, &e, X11_MessageBoxEventTest, (XPointer) data );
+
+ /* If X11_XFilterEvent returns True, then some input method has filtered the
+ event, and the client should discard the event. */
+ if ( ( e.type != Expose ) && X11_XFilterEvent( &e, None ) )
+ continue;
+
+ switch( e.type ) {
+ case Expose:
+ if ( e.xexpose.count > 0 ) {
+ draw = SDL_FALSE;
+ }
+ break;
+
+ case FocusIn:
+ /* Got focus. */
+ has_focus = SDL_TRUE;
+ break;
+
+ case FocusOut:
+ /* lost focus. Reset button and mouse info. */
+ has_focus = SDL_FALSE;
+ data->button_press_index = -1;
+ data->mouse_over_index = -1;
+ break;
+
+ case MotionNotify:
+ if ( has_focus ) {
+ /* Mouse moved... */
+ const int previndex = data->mouse_over_index;
+ data->mouse_over_index = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y );
+ if (data->mouse_over_index == previndex) {
+ draw = SDL_FALSE;
+ }
+ }
+ break;
+
+ case ClientMessage:
+ if ( e.xclient.message_type == data->wm_protocols &&
+ e.xclient.format == 32 &&
+ e.xclient.data.l[ 0 ] == data->wm_delete_message ) {
+ close_dialog = SDL_TRUE;
+ }
+ break;
+
+ case KeyPress:
+ /* Store key press - we make sure in key release that we got both. */
+ last_key_pressed = X11_XLookupKeysym( &e.xkey, 0 );
+ break;
+
+ case KeyRelease: {
+ Uint32 mask = 0;
+ KeySym key = X11_XLookupKeysym( &e.xkey, 0 );
+
+ /* If this is a key release for something we didn't get the key down for, then bail. */
+ if ( key != last_key_pressed )
+ break;
+
+ if ( key == XK_Escape )
+ mask = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
+ else if ( ( key == XK_Return ) || ( key == XK_KP_Enter ) )
+ mask = SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
+
+ if ( mask ) {
+ int i;
+
+ /* Look for first button with this mask set, and return it if found. */
+ for ( i = 0; i < data->numbuttons; i++ ) {
+ SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[ i ];
+
+ if ( buttondatax11->buttondata->flags & mask ) {
+ *data->pbuttonid = buttondatax11->buttondata->buttonid;
+ close_dialog = SDL_TRUE;
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ case ButtonPress:
+ data->button_press_index = -1;
+ if ( e.xbutton.button == Button1 ) {
+ /* Find index of button they clicked on. */
+ data->button_press_index = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y );
+ }
+ break;
+
+ case ButtonRelease:
+ /* If button is released over the same button that was clicked down on, then return it. */
+ if ( ( e.xbutton.button == Button1 ) && ( data->button_press_index >= 0 ) ) {
+ int button = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y );
+
+ if ( data->button_press_index == button ) {
+ SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[ button ];
+
+ *data->pbuttonid = buttondatax11->buttondata->buttonid;
+ close_dialog = SDL_TRUE;
+ }
+ }
+ data->button_press_index = -1;
+ break;
+ }
+
+ if ( draw ) {
+ /* Draw our dialog box. */
+ X11_MessageBoxDraw( data, ctx );
+ }
+ }
+
+ X11_XFreeGC( data->display, ctx );
+ return 0;
+}
+
+static int
+X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+ int ret;
+ SDL_MessageBoxDataX11 data;
+#if SDL_SET_LOCALE
+ char *origlocale;
+#endif
+
+ SDL_zero(data);
+
+ if ( !SDL_X11_LoadSymbols() )
+ return -1;
+
+#if SDL_SET_LOCALE
+ origlocale = setlocale(LC_ALL, NULL);
+ if (origlocale != NULL) {
+ origlocale = SDL_strdup(origlocale);
+ if (origlocale == NULL) {
+ return SDL_OutOfMemory();
+ }
+ setlocale(LC_ALL, "");
+ }
+#endif
+
+ /* This code could get called from multiple threads maybe? */
+ X11_XInitThreads();
+
+ /* Initialize the return buttonid value to -1 (for error or dialogbox closed). */
+ *buttonid = -1;
+
+ /* Init and display the message box. */
+ ret = X11_MessageBoxInit( &data, messageboxdata, buttonid );
+ if ( ret != -1 ) {
+ ret = X11_MessageBoxInitPositions( &data );
+ if ( ret != -1 ) {
+ ret = X11_MessageBoxCreateWindow( &data );
+ if ( ret != -1 ) {
+ ret = X11_MessageBoxLoop( &data );
+ }
+ }
+ }
+
+ X11_MessageBoxShutdown( &data );
+
+#if SDL_SET_LOCALE
+ if (origlocale) {
+ setlocale(LC_ALL, origlocale);
+ SDL_free(origlocale);
+ }
+#endif
+
+ return ret;
+}
+
+/* Display an x11 message box. */
+int
+X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+#if SDL_FORK_MESSAGEBOX
+ /* Use a child process to protect against setlocale(). Annoying. */
+ pid_t pid;
+ int fds[2];
+ int status = 0;
+
+ if (pipe(fds) == -1) {
+ return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
+ }
+
+ pid = fork();
+ if (pid == -1) { /* failed */
+ close(fds[0]);
+ close(fds[1]);
+ return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
+ } else if (pid == 0) { /* we're the child */
+ int exitcode = 0;
+ close(fds[0]);
+ status = X11_ShowMessageBoxImpl(messageboxdata, buttonid);
+ if (write(fds[1], &status, sizeof (int)) != sizeof (int))
+ exitcode = 1;
+ else if (write(fds[1], buttonid, sizeof (int)) != sizeof (int))
+ exitcode = 1;
+ close(fds[1]);
+ _exit(exitcode); /* don't run atexit() stuff, static destructors, etc. */
+ } else { /* we're the parent */
+ pid_t rc;
+ close(fds[1]);
+ do {
+ rc = waitpid(pid, &status, 0);
+ } while ((rc == -1) && (errno == EINTR));
+
+ SDL_assert(rc == pid); /* not sure what to do if this fails. */
+
+ if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) {
+ return SDL_SetError("msgbox child process failed");
+ }
+
+ if (read(fds[0], &status, sizeof (int)) != sizeof (int))
+ status = -1;
+ else if (read(fds[0], buttonid, sizeof (int)) != sizeof (int))
+ status = -1;
+ close(fds[0]);
+
+ return status;
+ }
+#else
+ return X11_ShowMessageBoxImpl(messageboxdata, buttonid);
+#endif
+}
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.h
new file mode 100644
index 0000000..cab407b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11messagebox.h
@@ -0,0 +1,28 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if SDL_VIDEO_DRIVER_X11
+
+extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11modes.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11modes.c
new file mode 100644
index 0000000..5eafe73
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11modes.c
@@ -0,0 +1,1112 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_hints.h"
+#include "SDL_x11video.h"
+#include "SDL_timer.h"
+#include "edid.h"
+
+/* #define X11MODES_DEBUG */
+
+/* I'm becoming more and more convinced that the application should never
+ * use XRandR, and it's the window manager's responsibility to track and
+ * manage display modes for fullscreen windows. Right now XRandR is completely
+ * broken with respect to window manager behavior on every window manager that
+ * I can find. For example, on Unity 3D if you show a fullscreen window while
+ * the resolution is changing (within ~250 ms) your window will retain the
+ * fullscreen state hint but be decorated and windowed.
+ *
+ * However, many people swear by it, so let them swear at it. :)
+*/
+/* #define XRANDR_DISABLED_BY_DEFAULT */
+
+
+static int
+get_visualinfo(Display * display, int screen, XVisualInfo * vinfo)
+{
+ const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID");
+ int depth;
+
+ /* Look for an exact visual, if requested */
+ if (visual_id) {
+ XVisualInfo *vi, template;
+ int nvis;
+
+ SDL_zero(template);
+ template.visualid = SDL_strtol(visual_id, NULL, 0);
+ vi = X11_XGetVisualInfo(display, VisualIDMask, &template, &nvis);
+ if (vi) {
+ *vinfo = *vi;
+ X11_XFree(vi);
+ return 0;
+ }
+ }
+
+ depth = DefaultDepth(display, screen);
+ if ((X11_UseDirectColorVisuals() &&
+ X11_XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) ||
+ X11_XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) ||
+ X11_XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) ||
+ X11_XMatchVisualInfo(display, screen, depth, StaticColor, vinfo)) {
+ return 0;
+ }
+ return -1;
+}
+
+int
+X11_GetVisualInfoFromVisual(Display * display, Visual * visual, XVisualInfo * vinfo)
+{
+ XVisualInfo *vi;
+ int nvis;
+
+ vinfo->visualid = X11_XVisualIDFromVisual(visual);
+ vi = X11_XGetVisualInfo(display, VisualIDMask, vinfo, &nvis);
+ if (vi) {
+ *vinfo = *vi;
+ X11_XFree(vi);
+ return 0;
+ }
+ return -1;
+}
+
+Uint32
+X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo)
+{
+ if (vinfo->class == DirectColor || vinfo->class == TrueColor) {
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ Rmask = vinfo->visual->red_mask;
+ Gmask = vinfo->visual->green_mask;
+ Bmask = vinfo->visual->blue_mask;
+ if (vinfo->depth == 32) {
+ Amask = (0xFFFFFFFF & ~(Rmask | Gmask | Bmask));
+ } else {
+ Amask = 0;
+ }
+
+ bpp = vinfo->depth;
+ if (bpp == 24) {
+ int i, n;
+ XPixmapFormatValues *p = X11_XListPixmapFormats(display, &n);
+ if (p) {
+ for (i = 0; i < n; ++i) {
+ if (p[i].depth == 24) {
+ bpp = p[i].bits_per_pixel;
+ break;
+ }
+ }
+ X11_XFree(p);
+ }
+ }
+
+ return SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
+ }
+
+ if (vinfo->class == PseudoColor || vinfo->class == StaticColor) {
+ switch (vinfo->depth) {
+ case 8:
+ return SDL_PIXELTYPE_INDEX8;
+ case 4:
+ if (BitmapBitOrder(display) == LSBFirst) {
+ return SDL_PIXELFORMAT_INDEX4LSB;
+ } else {
+ return SDL_PIXELFORMAT_INDEX4MSB;
+ }
+ /* break; -Wunreachable-code-break */
+ case 1:
+ if (BitmapBitOrder(display) == LSBFirst) {
+ return SDL_PIXELFORMAT_INDEX1LSB;
+ } else {
+ return SDL_PIXELFORMAT_INDEX1MSB;
+ }
+ /* break; -Wunreachable-code-break */
+ }
+ }
+
+ return SDL_PIXELFORMAT_UNKNOWN;
+}
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+static SDL_bool
+CheckXinerama(Display * display, int *major, int *minor)
+{
+ int event_base = 0;
+ int error_base = 0;
+
+ /* Default the extension not available */
+ *major = *minor = 0;
+
+ /* Allow environment override */
+ if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XINERAMA, SDL_TRUE)) {
+#ifdef X11MODES_DEBUG
+ printf("Xinerama disabled due to hint\n");
+#endif
+ return SDL_FALSE;
+ }
+
+ if (!SDL_X11_HAVE_XINERAMA) {
+#ifdef X11MODES_DEBUG
+ printf("Xinerama support not available\n");
+#endif
+ return SDL_FALSE;
+ }
+
+ /* Query the extension version */
+ if (!X11_XineramaQueryExtension(display, &event_base, &error_base) ||
+ !X11_XineramaQueryVersion(display, major, minor) ||
+ !X11_XineramaIsActive(display)) {
+#ifdef X11MODES_DEBUG
+ printf("Xinerama not active on the display\n");
+#endif
+ return SDL_FALSE;
+ }
+#ifdef X11MODES_DEBUG
+ printf("Xinerama available at version %d.%d!\n", *major, *minor);
+#endif
+ return SDL_TRUE;
+}
+
+/* !!! FIXME: remove this later. */
+/* we have a weird bug where XineramaQueryScreens() throws an X error, so this
+ is here to help track it down (and not crash, too!). */
+static SDL_bool xinerama_triggered_error = SDL_FALSE;
+static int
+X11_XineramaFailed(Display * d, XErrorEvent * e)
+{
+ xinerama_triggered_error = SDL_TRUE;
+ fprintf(stderr, "XINERAMA X ERROR: type=%d serial=%lu err=%u req=%u minor=%u\n",
+ e->type, e->serial, (unsigned int) e->error_code,
+ (unsigned int) e->request_code, (unsigned int) e->minor_code);
+ fflush(stderr);
+ return 0;
+}
+#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
+
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+static SDL_bool
+CheckXRandR(Display * display, int *major, int *minor)
+{
+ /* Default the extension not available */
+ *major = *minor = 0;
+
+ /* Allow environment override */
+#ifdef XRANDR_DISABLED_BY_DEFAULT
+ if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XRANDR, SDL_FALSE)) {
+#ifdef X11MODES_DEBUG
+ printf("XRandR disabled by default due to window manager issues\n");
+#endif
+ return SDL_FALSE;
+ }
+#else
+ if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XRANDR, SDL_TRUE)) {
+#ifdef X11MODES_DEBUG
+ printf("XRandR disabled due to hint\n");
+#endif
+ return SDL_FALSE;
+ }
+#endif /* XRANDR_ENABLED_BY_DEFAULT */
+
+ if (!SDL_X11_HAVE_XRANDR) {
+#ifdef X11MODES_DEBUG
+ printf("XRandR support not available\n");
+#endif
+ return SDL_FALSE;
+ }
+
+ /* Query the extension version */
+ *major = 1; *minor = 3; /* we want 1.3 */
+ if (!X11_XRRQueryVersion(display, major, minor)) {
+#ifdef X11MODES_DEBUG
+ printf("XRandR not active on the display\n");
+#endif
+ *major = *minor = 0;
+ return SDL_FALSE;
+ }
+#ifdef X11MODES_DEBUG
+ printf("XRandR available at version %d.%d!\n", *major, *minor);
+#endif
+ return SDL_TRUE;
+}
+
+#define XRANDR_ROTATION_LEFT (1 << 1)
+#define XRANDR_ROTATION_RIGHT (1 << 3)
+
+static int
+CalculateXRandRRefreshRate(const XRRModeInfo *info)
+{
+ return (info->hTotal && info->vTotal) ?
+ round(((double)info->dotClock / (double)(info->hTotal * info->vTotal))) : 0;
+}
+
+static SDL_bool
+SetXRandRModeInfo(Display *display, XRRScreenResources *res, RRCrtc crtc,
+ RRMode modeID, SDL_DisplayMode *mode)
+{
+ int i;
+ for (i = 0; i < res->nmode; ++i) {
+ const XRRModeInfo *info = &res->modes[i];
+ if (info->id == modeID) {
+ XRRCrtcInfo *crtcinfo;
+ Rotation rotation = 0;
+
+ crtcinfo = X11_XRRGetCrtcInfo(display, res, crtc);
+ if (crtcinfo) {
+ rotation = crtcinfo->rotation;
+ X11_XRRFreeCrtcInfo(crtcinfo);
+ }
+
+ if (rotation & (XRANDR_ROTATION_LEFT|XRANDR_ROTATION_RIGHT)) {
+ mode->w = info->height;
+ mode->h = info->width;
+ } else {
+ mode->w = info->width;
+ mode->h = info->height;
+ }
+ mode->refresh_rate = CalculateXRandRRefreshRate(info);
+ ((SDL_DisplayModeData*)mode->driverdata)->xrandr_mode = modeID;
+#ifdef X11MODES_DEBUG
+ printf("XRandR mode %d: %dx%d@%dHz\n", (int) modeID, mode->w, mode->h, mode->refresh_rate);
+#endif
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static void
+SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, RROutput output, const unsigned long widthmm, const unsigned long heightmm)
+{
+ /* See if we can get the EDID data for the real monitor name */
+ int inches;
+ int nprop;
+ Atom *props = X11_XRRListOutputProperties(dpy, output, &nprop);
+ int i;
+
+ for (i = 0; i < nprop; ++i) {
+ unsigned char *prop;
+ int actual_format;
+ unsigned long nitems, bytes_after;
+ Atom actual_type;
+
+ if (props[i] == EDID) {
+ if (X11_XRRGetOutputProperty(dpy, output, props[i], 0, 100, False,
+ False, AnyPropertyType, &actual_type,
+ &actual_format, &nitems, &bytes_after,
+ &prop) == Success) {
+ MonitorInfo *info = decode_edid(prop);
+ if (info) {
+#ifdef X11MODES_DEBUG
+ printf("Found EDID data for %s\n", name);
+ dump_monitor_info(info);
+#endif
+ SDL_strlcpy(name, info->dsc_product_name, namelen);
+ free(info);
+ }
+ X11_XFree(prop);
+ }
+ break;
+ }
+ }
+
+ if (props) {
+ X11_XFree(props);
+ }
+
+ inches = (int)((SDL_sqrtf(widthmm * widthmm + heightmm * heightmm) / 25.4f) + 0.5f);
+ if (*name && inches) {
+ const size_t len = SDL_strlen(name);
+ SDL_snprintf(&name[len], namelen-len, " %d\"", inches);
+ }
+
+#ifdef X11MODES_DEBUG
+ printf("Display name: %s\n", name);
+#endif
+}
+
+
+static int
+X11_InitModes_XRandR(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ Display *dpy = data->display;
+ const int screencount = ScreenCount(dpy);
+ const int default_screen = DefaultScreen(dpy);
+ RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen));
+ Atom EDID = X11_XInternAtom(dpy, "EDID", False);
+ XRRScreenResources *res = NULL;
+ Uint32 pixelformat;
+ XVisualInfo vinfo;
+ XPixmapFormatValues *pixmapformats;
+ int looking_for_primary;
+ int scanline_pad;
+ int output;
+ int screen, i, n;
+
+ for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) {
+ for (screen = 0; screen < screencount; screen++) {
+
+ /* we want the primary output first, and then skipped later. */
+ if (looking_for_primary && (screen != default_screen)) {
+ continue;
+ }
+
+ if (get_visualinfo(dpy, screen, &vinfo) < 0) {
+ continue; /* uh, skip this screen? */
+ }
+
+ pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo);
+ if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) {
+ continue; /* Palettized video modes are no longer supported */
+ }
+
+ scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8;
+ pixmapformats = X11_XListPixmapFormats(dpy, &n);
+ if (pixmapformats) {
+ for (i = 0; i < n; ++i) {
+ if (pixmapformats[i].depth == vinfo.depth) {
+ scanline_pad = pixmapformats[i].scanline_pad;
+ break;
+ }
+ }
+ X11_XFree(pixmapformats);
+ }
+
+ res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen));
+ if (!res || res->noutput == 0) {
+ if (res) {
+ X11_XRRFreeScreenResources(res);
+ }
+
+ res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen));
+ if (!res) {
+ continue;
+ }
+ }
+
+ for (output = 0; output < res->noutput; output++) {
+ XRROutputInfo *output_info;
+ int display_x, display_y;
+ unsigned long display_mm_width, display_mm_height;
+ SDL_DisplayData *displaydata;
+ char display_name[128];
+ SDL_DisplayMode mode;
+ SDL_DisplayModeData *modedata;
+ SDL_VideoDisplay display;
+ RRMode modeID;
+ RRCrtc output_crtc;
+ XRRCrtcInfo *crtc;
+
+ /* The primary output _should_ always be sorted first, but just in case... */
+ if ((looking_for_primary && (res->outputs[output] != primary)) ||
+ (!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) {
+ continue;
+ }
+
+ output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]);
+ if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) {
+ X11_XRRFreeOutputInfo(output_info);
+ continue;
+ }
+
+ SDL_strlcpy(display_name, output_info->name, sizeof(display_name));
+ display_mm_width = output_info->mm_width;
+ display_mm_height = output_info->mm_height;
+ output_crtc = output_info->crtc;
+ X11_XRRFreeOutputInfo(output_info);
+
+ crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc);
+ if (!crtc) {
+ continue;
+ }
+
+ SDL_zero(mode);
+ modeID = crtc->mode;
+ mode.w = crtc->width;
+ mode.h = crtc->height;
+ mode.format = pixelformat;
+
+ display_x = crtc->x;
+ display_y = crtc->y;
+
+ X11_XRRFreeCrtcInfo(crtc);
+
+ displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
+ if (!displaydata) {
+ return SDL_OutOfMemory();
+ }
+
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (!modedata) {
+ SDL_free(displaydata);
+ return SDL_OutOfMemory();
+ }
+ modedata->xrandr_mode = modeID;
+ mode.driverdata = modedata;
+
+ displaydata->screen = screen;
+ displaydata->visual = vinfo.visual;
+ displaydata->depth = vinfo.depth;
+ displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f;
+ displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f;
+ displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f);
+ displaydata->scanline_pad = scanline_pad;
+ displaydata->x = display_x;
+ displaydata->y = display_y;
+ displaydata->use_xrandr = 1;
+ displaydata->xrandr_output = res->outputs[output];
+
+ SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode);
+ SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height);
+
+ SDL_zero(display);
+ if (*display_name) {
+ display.name = display_name;
+ }
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ display.driverdata = displaydata;
+ SDL_AddVideoDisplay(&display);
+ }
+
+ X11_XRRFreeScreenResources(res);
+ }
+ }
+
+ if (_this->num_displays == 0) {
+ return SDL_SetError("No available displays");
+ }
+
+ return 0;
+}
+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+static SDL_bool
+CheckVidMode(Display * display, int *major, int *minor)
+{
+ int vm_event, vm_error = -1;
+ /* Default the extension not available */
+ *major = *minor = 0;
+
+ /* Allow environment override */
+ if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XVIDMODE, SDL_TRUE)) {
+#ifdef X11MODES_DEBUG
+ printf("XVidMode disabled due to hint\n");
+#endif
+ return SDL_FALSE;
+ }
+
+ if (!SDL_X11_HAVE_XVIDMODE) {
+#ifdef X11MODES_DEBUG
+ printf("XVidMode support not available\n");
+#endif
+ return SDL_FALSE;
+ }
+
+ /* Query the extension version */
+ if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error)
+ || !X11_XF86VidModeQueryVersion(display, major, minor)) {
+#ifdef X11MODES_DEBUG
+ printf("XVidMode not active on the display\n");
+#endif
+ return SDL_FALSE;
+ }
+#ifdef X11MODES_DEBUG
+ printf("XVidMode available at version %d.%d!\n", *major, *minor);
+#endif
+ return SDL_TRUE;
+}
+
+static
+Bool XF86VidModeGetModeInfo(Display * dpy, int scr,
+ XF86VidModeModeInfo* info)
+{
+ Bool retval;
+ int dotclock;
+ XF86VidModeModeLine l;
+ SDL_zerop(info);
+ SDL_zero(l);
+ retval = X11_XF86VidModeGetModeLine(dpy, scr, &dotclock, &l);
+ info->dotclock = dotclock;
+ info->hdisplay = l.hdisplay;
+ info->hsyncstart = l.hsyncstart;
+ info->hsyncend = l.hsyncend;
+ info->htotal = l.htotal;
+ info->hskew = l.hskew;
+ info->vdisplay = l.vdisplay;
+ info->vsyncstart = l.vsyncstart;
+ info->vsyncend = l.vsyncend;
+ info->vtotal = l.vtotal;
+ info->flags = l.flags;
+ info->privsize = l.privsize;
+ info->private = l.private;
+ return retval;
+}
+
+static int
+CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info)
+{
+ return (info->htotal
+ && info->vtotal) ? (1000 * info->dotclock / (info->htotal *
+ info->vtotal)) : 0;
+}
+
+static SDL_bool
+SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode)
+{
+ mode->w = info->hdisplay;
+ mode->h = info->vdisplay;
+ mode->refresh_rate = CalculateXVidModeRefreshRate(info);
+ ((SDL_DisplayModeData*)mode->driverdata)->vm_mode = *info;
+ return SDL_TRUE;
+}
+#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
+
+int
+X11_InitModes(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ int snum, screen, screencount = 0;
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ int xinerama_major, xinerama_minor;
+ int use_xinerama = 0;
+ XineramaScreenInfo *xinerama = NULL;
+#endif
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+ int xrandr_major, xrandr_minor;
+#endif
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ int vm_major, vm_minor;
+ int use_vidmode = 0;
+#endif
+
+/* XRandR is the One True Modern Way to do this on X11. If it's enabled and
+ available, don't even look at other ways of doing things. */
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+ /* require at least XRandR v1.3 */
+ if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) &&
+ (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) {
+ if (X11_InitModes_XRandR(_this) == 0)
+ return 0;
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
+
+/* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */
+
+ /* This is a workaround for some apps (UnrealEngine4, for example) until
+ we sort out the ramifications of removing XVidMode support outright.
+ This block should be removed with the XVidMode support. */
+ {
+ if (SDL_GetHintBoolean("SDL_VIDEO_X11_REQUIRE_XRANDR", SDL_FALSE)) {
+ #if SDL_VIDEO_DRIVER_X11_XRANDR
+ return SDL_SetError("XRandR support is required but not available");
+ #else
+ return SDL_SetError("XRandR support is required but not built into SDL!");
+ #endif
+ }
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ /* Query Xinerama extention
+ * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012)
+ * or newer of the Nvidia binary drivers
+ */
+ if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) {
+ int (*handler) (Display *, XErrorEvent *);
+ X11_XSync(data->display, False);
+ handler = X11_XSetErrorHandler(X11_XineramaFailed);
+ xinerama = X11_XineramaQueryScreens(data->display, &screencount);
+ X11_XSync(data->display, False);
+ X11_XSetErrorHandler(handler);
+ if (xinerama_triggered_error) {
+ xinerama = 0;
+ }
+ if (xinerama) {
+ use_xinerama = xinerama_major * 100 + xinerama_minor;
+ }
+ }
+ if (!xinerama) {
+ screencount = ScreenCount(data->display);
+ }
+#else
+ screencount = ScreenCount(data->display);
+#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ if (CheckVidMode(data->display, &vm_major, &vm_minor)) {
+ use_vidmode = vm_major * 100 + vm_minor;
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
+
+ for (snum = 0; snum < screencount; ++snum) {
+ XVisualInfo vinfo;
+ SDL_VideoDisplay display;
+ SDL_DisplayData *displaydata;
+ SDL_DisplayMode mode;
+ SDL_DisplayModeData *modedata;
+ XPixmapFormatValues *pixmapFormats;
+ char display_name[128];
+ int i, n;
+
+ /* Re-order screens to always put default screen first */
+ if (snum == 0) {
+ screen = DefaultScreen(data->display);
+ } else if (snum == DefaultScreen(data->display)) {
+ screen = 0;
+ } else {
+ screen = snum;
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ if (xinerama) {
+ if (get_visualinfo(data->display, 0, &vinfo) < 0) {
+ continue;
+ }
+ } else {
+ if (get_visualinfo(data->display, screen, &vinfo) < 0) {
+ continue;
+ }
+ }
+#else
+ if (get_visualinfo(data->display, screen, &vinfo) < 0) {
+ continue;
+ }
+#endif
+
+ displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
+ if (!displaydata) {
+ continue;
+ }
+ display_name[0] = '\0';
+
+ mode.format = X11_GetPixelFormatFromVisualInfo(data->display, &vinfo);
+ if (SDL_ISPIXELFORMAT_INDEXED(mode.format)) {
+ /* We don't support palettized modes now */
+ SDL_free(displaydata);
+ continue;
+ }
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ if (xinerama) {
+ mode.w = xinerama[screen].width;
+ mode.h = xinerama[screen].height;
+ } else {
+ mode.w = DisplayWidth(data->display, screen);
+ mode.h = DisplayHeight(data->display, screen);
+ }
+#else
+ mode.w = DisplayWidth(data->display, screen);
+ mode.h = DisplayHeight(data->display, screen);
+#endif
+ mode.refresh_rate = 0;
+
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (!modedata) {
+ SDL_free(displaydata);
+ continue;
+ }
+ mode.driverdata = modedata;
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ /* Most of SDL's calls to X11 are unwaware of Xinerama, and to X11 standard calls, when Xinerama is active,
+ * there's only one screen available. So we force the screen number to zero and
+ * let Xinerama specific code handle specific functionality using displaydata->xinerama_info
+ */
+ if (use_xinerama) {
+ displaydata->screen = 0;
+ displaydata->use_xinerama = use_xinerama;
+ displaydata->xinerama_info = xinerama[screen];
+ displaydata->xinerama_screen = screen;
+ }
+ else displaydata->screen = screen;
+#else
+ displaydata->screen = screen;
+#endif
+ displaydata->visual = vinfo.visual;
+ displaydata->depth = vinfo.depth;
+
+ /* We use the displaydata screen index here so that this works
+ for both the Xinerama case, where we get the overall DPI,
+ and the regular X11 screen info case. */
+ displaydata->hdpi = (float)DisplayWidth(data->display, displaydata->screen) * 25.4f /
+ DisplayWidthMM(data->display, displaydata->screen);
+ displaydata->vdpi = (float)DisplayHeight(data->display, displaydata->screen) * 25.4f /
+ DisplayHeightMM(data->display, displaydata->screen);
+ displaydata->ddpi = SDL_ComputeDiagonalDPI(DisplayWidth(data->display, displaydata->screen),
+ DisplayHeight(data->display, displaydata->screen),
+ (float)DisplayWidthMM(data->display, displaydata->screen) / 25.4f,
+ (float)DisplayHeightMM(data->display, displaydata->screen) / 25.4f);
+
+ displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format) * 8;
+ pixmapFormats = X11_XListPixmapFormats(data->display, &n);
+ if (pixmapFormats) {
+ for (i = 0; i < n; ++i) {
+ if (pixmapFormats[i].depth == displaydata->depth) {
+ displaydata->scanline_pad = pixmapFormats[i].scanline_pad;
+ break;
+ }
+ }
+ X11_XFree(pixmapFormats);
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ if (use_xinerama) {
+ displaydata->x = xinerama[screen].x_org;
+ displaydata->y = xinerama[screen].y_org;
+ }
+ else
+#endif
+ {
+ displaydata->x = 0;
+ displaydata->y = 0;
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ if (!displaydata->use_xrandr &&
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ /* XVidMode only works on the screen at the origin */
+ (!displaydata->use_xinerama ||
+ (displaydata->x == 0 && displaydata->y == 0)) &&
+#endif
+ use_vidmode) {
+ displaydata->use_vidmode = use_vidmode;
+ if (displaydata->use_xinerama) {
+ displaydata->vidmode_screen = 0;
+ } else {
+ displaydata->vidmode_screen = screen;
+ }
+ XF86VidModeGetModeInfo(data->display, displaydata->vidmode_screen, &modedata->vm_mode);
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
+
+ SDL_zero(display);
+ if (*display_name) {
+ display.name = display_name;
+ }
+ display.desktop_mode = mode;
+ display.current_mode = mode;
+ display.driverdata = displaydata;
+ SDL_AddVideoDisplay(&display);
+ }
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ if (xinerama) X11_XFree(xinerama);
+#endif
+
+ if (_this->num_displays == 0) {
+ return SDL_SetError("No available displays");
+ }
+ return 0;
+}
+
+void
+X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
+{
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ int nmodes;
+ XF86VidModeModeInfo ** modes;
+#endif
+ SDL_DisplayMode mode;
+
+ /* Unfortunately X11 requires the window to be created with the correct
+ * visual and depth ahead of time, but the SDL API allows you to create
+ * a window before setting the fullscreen display mode. This means that
+ * we have to use the same format for all windows and all display modes.
+ * (or support recreating the window with a new visual behind the scenes)
+ */
+ mode.format = sdl_display->current_mode.format;
+ mode.driverdata = NULL;
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ if (data->use_xinerama) {
+ int screen_w;
+ int screen_h;
+
+ screen_w = DisplayWidth(display, data->screen);
+ screen_h = DisplayHeight(display, data->screen);
+
+ if (data->use_vidmode && !data->xinerama_info.x_org && !data->xinerama_info.y_org &&
+ (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) {
+ SDL_DisplayModeData *modedata;
+ /* Add the full (both screens combined) xinerama mode only on the display that starts at 0,0
+ * if we're using vidmode.
+ */
+ mode.w = screen_w;
+ mode.h = screen_h;
+ mode.refresh_rate = 0;
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (modedata) {
+ *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
+ }
+ mode.driverdata = modedata;
+ if (!SDL_AddDisplayMode(sdl_display, &mode)) {
+ SDL_free(modedata);
+ }
+ }
+ else if (!data->use_xrandr)
+ {
+ SDL_DisplayModeData *modedata;
+ /* Add the current mode of each monitor otherwise if we can't get them from xrandr */
+ mode.w = data->xinerama_info.width;
+ mode.h = data->xinerama_info.height;
+ mode.refresh_rate = 0;
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (modedata) {
+ *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
+ }
+ mode.driverdata = modedata;
+ if (!SDL_AddDisplayMode(sdl_display, &mode)) {
+ SDL_free(modedata);
+ }
+ }
+
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
+
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+ if (data->use_xrandr) {
+ XRRScreenResources *res;
+
+ res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen));
+ if (res) {
+ SDL_DisplayModeData *modedata;
+ XRROutputInfo *output_info;
+ int i;
+
+ output_info = X11_XRRGetOutputInfo(display, res, data->xrandr_output);
+ if (output_info && output_info->connection != RR_Disconnected) {
+ for (i = 0; i < output_info->nmode; ++i) {
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (!modedata) {
+ continue;
+ }
+ mode.driverdata = modedata;
+
+ if (!SetXRandRModeInfo(display, res, output_info->crtc, output_info->modes[i], &mode) ||
+ !SDL_AddDisplayMode(sdl_display, &mode)) {
+ SDL_free(modedata);
+ }
+ }
+ }
+ X11_XRRFreeOutputInfo(output_info);
+ X11_XRRFreeScreenResources(res);
+ }
+ return;
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ if (data->use_vidmode &&
+ X11_XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) {
+ int i;
+ SDL_DisplayModeData *modedata;
+
+#ifdef X11MODES_DEBUG
+ printf("VidMode modes: (unsorted)\n");
+ for (i = 0; i < nmodes; ++i) {
+ printf("Mode %d: %d x %d @ %d, flags: 0x%x\n", i,
+ modes[i]->hdisplay, modes[i]->vdisplay,
+ CalculateXVidModeRefreshRate(modes[i]), modes[i]->flags);
+ }
+#endif
+ for (i = 0; i < nmodes; ++i) {
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (!modedata) {
+ continue;
+ }
+ mode.driverdata = modedata;
+
+ if (!SetXVidModeModeInfo(modes[i], &mode) || !SDL_AddDisplayMode(sdl_display, &mode)) {
+ SDL_free(modedata);
+ }
+ }
+ X11_XFree(modes);
+ return;
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
+
+ if (!data->use_xrandr && !data->use_vidmode) {
+ SDL_DisplayModeData *modedata;
+ /* Add the desktop mode */
+ mode = sdl_display->desktop_mode;
+ modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ if (modedata) {
+ *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
+ }
+ mode.driverdata = modedata;
+ if (!SDL_AddDisplayMode(sdl_display, &mode)) {
+ SDL_free(modedata);
+ }
+ }
+}
+
+int
+X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode)
+{
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
+ Display *display = viddata->display;
+ SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
+ SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
+
+ viddata->last_mode_change_deadline = SDL_GetTicks() + (PENDING_FOCUS_TIME * 2);
+
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+ if (data->use_xrandr) {
+ XRRScreenResources *res;
+ XRROutputInfo *output_info;
+ XRRCrtcInfo *crtc;
+ Status status;
+
+ res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen));
+ if (!res) {
+ return SDL_SetError("Couldn't get XRandR screen resources");
+ }
+
+ output_info = X11_XRRGetOutputInfo(display, res, data->xrandr_output);
+ if (!output_info || output_info->connection == RR_Disconnected) {
+ X11_XRRFreeScreenResources(res);
+ return SDL_SetError("Couldn't get XRandR output info");
+ }
+
+ crtc = X11_XRRGetCrtcInfo(display, res, output_info->crtc);
+ if (!crtc) {
+ X11_XRRFreeOutputInfo(output_info);
+ X11_XRRFreeScreenResources(res);
+ return SDL_SetError("Couldn't get XRandR crtc info");
+ }
+
+ status = X11_XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime,
+ crtc->x, crtc->y, modedata->xrandr_mode, crtc->rotation,
+ &data->xrandr_output, 1);
+
+ X11_XRRFreeCrtcInfo(crtc);
+ X11_XRRFreeOutputInfo(output_info);
+ X11_XRRFreeScreenResources(res);
+
+ if (status != Success) {
+ return SDL_SetError("X11_XRRSetCrtcConfig failed");
+ }
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ if (data->use_vidmode) {
+ X11_XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode);
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */
+
+ return 0;
+}
+
+void
+X11_QuitModes(_THIS)
+{
+}
+
+int
+X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect)
+{
+ SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
+
+ rect->x = data->x;
+ rect->y = data->y;
+ rect->w = sdl_display->current_mode.w;
+ rect->h = sdl_display->current_mode.h;
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ /* Get the real current bounds of the display */
+ if (data->use_xinerama) {
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ int screencount;
+ XineramaScreenInfo *xinerama = X11_XineramaQueryScreens(display, &screencount);
+ if (xinerama) {
+ rect->x = xinerama[data->xinerama_screen].x_org;
+ rect->y = xinerama[data->xinerama_screen].y_org;
+ X11_XFree(xinerama);
+ }
+ }
+#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
+ return 0;
+}
+
+int
+X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi)
+{
+ SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
+
+ if (ddpi) {
+ *ddpi = data->ddpi;
+ }
+ if (hdpi) {
+ *hdpi = data->hdpi;
+ }
+ if (vdpi) {
+ *vdpi = data->vdpi;
+ }
+
+ return data->ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI");
+}
+
+int
+X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ Display *display = data->display;
+ Atom _NET_WORKAREA;
+ int status, real_format;
+ int retval = -1;
+ Atom real_type;
+ unsigned long items_read = 0, items_left = 0;
+ unsigned char *propdata = NULL;
+
+ if (X11_GetDisplayBounds(_this, sdl_display, rect) < 0) {
+ return -1;
+ }
+
+ _NET_WORKAREA = X11_XInternAtom(display, "_NET_WORKAREA", False);
+ status = X11_XGetWindowProperty(display, DefaultRootWindow(display),
+ _NET_WORKAREA, 0L, 4L, False, XA_CARDINAL,
+ &real_type, &real_format, &items_read,
+ &items_left, &propdata);
+ if ((status == Success) && (items_read >= 4)) {
+ const long *p = (long*) propdata;
+ const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] };
+ retval = 0;
+ if (!SDL_IntersectRect(rect, &usable, rect)) {
+ SDL_zerop(rect);
+ }
+ }
+
+ if (propdata) {
+ X11_XFree(propdata);
+ }
+
+ return retval;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11modes.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11modes.h
new file mode 100644
index 0000000..7d3ff3e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11modes.h
@@ -0,0 +1,85 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11modes_h_
+#define SDL_x11modes_h_
+
+typedef struct
+{
+ int screen;
+ Visual *visual;
+ int depth;
+ int scanline_pad;
+ int x;
+ int y;
+ float ddpi;
+ float hdpi;
+ float vdpi;
+
+ int use_xinerama;
+ int use_xrandr;
+ int use_vidmode;
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+ XineramaScreenInfo xinerama_info;
+ int xinerama_screen;
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+ RROutput xrandr_output;
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ int vidmode_screen;
+#endif
+
+} SDL_DisplayData;
+
+typedef struct
+{
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+ RRMode xrandr_mode;
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ XF86VidModeModeInfo vm_mode;
+#endif
+
+} SDL_DisplayModeData;
+
+extern int X11_InitModes(_THIS);
+extern void X11_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+extern int X11_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+extern void X11_QuitModes(_THIS);
+
+/* Some utility functions for working with visuals */
+extern int X11_GetVisualInfoFromVisual(Display * display, Visual * visual,
+ XVisualInfo * vinfo);
+extern Uint32 X11_GetPixelFormatFromVisualInfo(Display * display,
+ XVisualInfo * vinfo);
+extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect);
+extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect);
+extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi);
+
+#endif /* SDL_x11modes_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.c
new file mode 100644
index 0000000..3b98726
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.c
@@ -0,0 +1,448 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include <X11/cursorfont.h>
+#include "SDL_assert.h"
+#include "SDL_x11video.h"
+#include "SDL_x11mouse.h"
+#include "SDL_x11xinput2.h"
+#include "../../events/SDL_mouse_c.h"
+
+
+/* FIXME: Find a better place to put this... */
+static Cursor x11_empty_cursor = None;
+
+static Display *
+GetDisplay(void)
+{
+ return ((SDL_VideoData *)SDL_GetVideoDevice()->driverdata)->display;
+}
+
+static Cursor
+X11_CreateEmptyCursor()
+{
+ if (x11_empty_cursor == None) {
+ Display *display = GetDisplay();
+ char data[1];
+ XColor color;
+ Pixmap pixmap;
+
+ SDL_zero(data);
+ color.red = color.green = color.blue = 0;
+ pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display),
+ data, 1, 1);
+ if (pixmap) {
+ x11_empty_cursor = X11_XCreatePixmapCursor(display, pixmap, pixmap,
+ &color, &color, 0, 0);
+ X11_XFreePixmap(display, pixmap);
+ }
+ }
+ return x11_empty_cursor;
+}
+
+static void
+X11_DestroyEmptyCursor(void)
+{
+ if (x11_empty_cursor != None) {
+ X11_XFreeCursor(GetDisplay(), x11_empty_cursor);
+ x11_empty_cursor = None;
+ }
+}
+
+static SDL_Cursor *
+X11_CreateDefaultCursor()
+{
+ SDL_Cursor *cursor;
+
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ /* None is used to indicate the default cursor */
+ cursor->driverdata = (void*)None;
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+#if SDL_VIDEO_DRIVER_X11_XCURSOR
+static Cursor
+X11_CreateXCursorCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ Display *display = GetDisplay();
+ Cursor cursor = None;
+ XcursorImage *image;
+
+ image = X11_XcursorImageCreate(surface->w, surface->h);
+ if (!image) {
+ SDL_OutOfMemory();
+ return None;
+ }
+ image->xhot = hot_x;
+ image->yhot = hot_y;
+ image->delay = 0;
+
+ SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+ SDL_assert(surface->pitch == surface->w * 4);
+ SDL_memcpy(image->pixels, surface->pixels, surface->h * surface->pitch);
+
+ cursor = X11_XcursorImageLoadCursor(display, image);
+
+ X11_XcursorImageDestroy(image);
+
+ return cursor;
+}
+#endif /* SDL_VIDEO_DRIVER_X11_XCURSOR */
+
+static Cursor
+X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ Display *display = GetDisplay();
+ XColor fg, bg;
+ Cursor cursor = None;
+ Uint32 *ptr;
+ Uint8 *data_bits, *mask_bits;
+ Pixmap data_pixmap, mask_pixmap;
+ int x, y;
+ unsigned int rfg, gfg, bfg, rbg, gbg, bbg, fgBits, bgBits;
+ unsigned int width_bytes = ((surface->w + 7) & ~7) / 8;
+
+ data_bits = SDL_calloc(1, surface->h * width_bytes);
+ if (!data_bits) {
+ SDL_OutOfMemory();
+ return None;
+ }
+
+ mask_bits = SDL_calloc(1, surface->h * width_bytes);
+ if (!mask_bits) {
+ SDL_free(data_bits);
+ SDL_OutOfMemory();
+ return None;
+ }
+
+ /* Code below assumes ARGB pixel format */
+ SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+
+ rfg = gfg = bfg = rbg = gbg = bbg = fgBits = bgBits = 0;
+ for (y = 0; y < surface->h; ++y) {
+ ptr = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
+ for (x = 0; x < surface->w; ++x) {
+ int alpha = (*ptr >> 24) & 0xff;
+ int red = (*ptr >> 16) & 0xff;
+ int green = (*ptr >> 8) & 0xff;
+ int blue = (*ptr >> 0) & 0xff;
+ if (alpha > 25) {
+ mask_bits[y * width_bytes + x / 8] |= (0x01 << (x % 8));
+
+ if ((red + green + blue) > 0x40) {
+ fgBits++;
+ rfg += red;
+ gfg += green;
+ bfg += blue;
+ data_bits[y * width_bytes + x / 8] |= (0x01 << (x % 8));
+ } else {
+ bgBits++;
+ rbg += red;
+ gbg += green;
+ bbg += blue;
+ }
+ }
+ ++ptr;
+ }
+ }
+
+ if (fgBits) {
+ fg.red = rfg * 257 / fgBits;
+ fg.green = gfg * 257 / fgBits;
+ fg.blue = bfg * 257 / fgBits;
+ }
+ else fg.red = fg.green = fg.blue = 0;
+
+ if (bgBits) {
+ bg.red = rbg * 257 / bgBits;
+ bg.green = gbg * 257 / bgBits;
+ bg.blue = bbg * 257 / bgBits;
+ }
+ else bg.red = bg.green = bg.blue = 0;
+
+ data_pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display),
+ (char*)data_bits,
+ surface->w, surface->h);
+ mask_pixmap = X11_XCreateBitmapFromData(display, DefaultRootWindow(display),
+ (char*)mask_bits,
+ surface->w, surface->h);
+ cursor = X11_XCreatePixmapCursor(display, data_pixmap, mask_pixmap,
+ &fg, &bg, hot_x, hot_y);
+ X11_XFreePixmap(display, data_pixmap);
+ X11_XFreePixmap(display, mask_pixmap);
+
+ return cursor;
+}
+
+static SDL_Cursor *
+X11_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
+{
+ SDL_Cursor *cursor;
+
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ Cursor x11_cursor = None;
+
+#if SDL_VIDEO_DRIVER_X11_XCURSOR
+ if (SDL_X11_HAVE_XCURSOR) {
+ x11_cursor = X11_CreateXCursorCursor(surface, hot_x, hot_y);
+ }
+#endif
+ if (x11_cursor == None) {
+ x11_cursor = X11_CreatePixmapCursor(surface, hot_x, hot_y);
+ }
+ cursor->driverdata = (void*)x11_cursor;
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static SDL_Cursor *
+X11_CreateSystemCursor(SDL_SystemCursor id)
+{
+ SDL_Cursor *cursor;
+ unsigned int shape;
+
+ switch(id)
+ {
+ default:
+ SDL_assert(0);
+ return NULL;
+ /* X Font Cursors reference: */
+ /* http://tronche.com/gui/x/xlib/appendix/b/ */
+ case SDL_SYSTEM_CURSOR_ARROW: shape = XC_left_ptr; break;
+ case SDL_SYSTEM_CURSOR_IBEAM: shape = XC_xterm; break;
+ case SDL_SYSTEM_CURSOR_WAIT: shape = XC_watch; break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR: shape = XC_tcross; break;
+ case SDL_SYSTEM_CURSOR_WAITARROW: shape = XC_watch; break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE: shape = XC_fleur; break;
+ case SDL_SYSTEM_CURSOR_SIZENESW: shape = XC_fleur; break;
+ case SDL_SYSTEM_CURSOR_SIZEWE: shape = XC_sb_h_double_arrow; break;
+ case SDL_SYSTEM_CURSOR_SIZENS: shape = XC_sb_v_double_arrow; break;
+ case SDL_SYSTEM_CURSOR_SIZEALL: shape = XC_fleur; break;
+ case SDL_SYSTEM_CURSOR_NO: shape = XC_pirate; break;
+ case SDL_SYSTEM_CURSOR_HAND: shape = XC_hand2; break;
+ }
+
+ cursor = SDL_calloc(1, sizeof(*cursor));
+ if (cursor) {
+ Cursor x11_cursor;
+
+ x11_cursor = X11_XCreateFontCursor(GetDisplay(), shape);
+
+ cursor->driverdata = (void*)x11_cursor;
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return cursor;
+}
+
+static void
+X11_FreeCursor(SDL_Cursor * cursor)
+{
+ Cursor x11_cursor = (Cursor)cursor->driverdata;
+
+ if (x11_cursor != None) {
+ X11_XFreeCursor(GetDisplay(), x11_cursor);
+ }
+ SDL_free(cursor);
+}
+
+static int
+X11_ShowCursor(SDL_Cursor * cursor)
+{
+ Cursor x11_cursor = 0;
+
+ if (cursor) {
+ x11_cursor = (Cursor)cursor->driverdata;
+ } else {
+ x11_cursor = X11_CreateEmptyCursor();
+ }
+
+ /* FIXME: Is there a better way than this? */
+ {
+ SDL_VideoDevice *video = SDL_GetVideoDevice();
+ Display *display = GetDisplay();
+ SDL_Window *window;
+ SDL_WindowData *data;
+
+ for (window = video->windows; window; window = window->next) {
+ data = (SDL_WindowData *)window->driverdata;
+ if (x11_cursor != None) {
+ X11_XDefineCursor(display, data->xwindow, x11_cursor);
+ } else {
+ X11_XUndefineCursor(display, data->xwindow);
+ }
+ }
+ X11_XFlush(display);
+ }
+ return 0;
+}
+
+static void
+WarpMouseInternal(Window xwindow, const int x, const int y)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
+ Display *display = videodata->display;
+ X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y);
+ X11_XSync(display, False);
+ videodata->global_mouse_changed = SDL_TRUE;
+}
+
+static void
+X11_WarpMouse(SDL_Window * window, int x, int y)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ WarpMouseInternal(data->xwindow, x, y);
+}
+
+static int
+X11_WarpMouseGlobal(int x, int y)
+{
+ WarpMouseInternal(DefaultRootWindow(GetDisplay()), x, y);
+ return 0;
+}
+
+static int
+X11_SetRelativeMouseMode(SDL_bool enabled)
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+ if(X11_Xinput2IsInitialized())
+ return 0;
+#else
+ SDL_Unsupported();
+#endif
+ return -1;
+}
+
+static int
+X11_CaptureMouse(SDL_Window *window)
+{
+ Display *display = GetDisplay();
+
+ if (window) {
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask;
+ const int rc = X11_XGrabPointer(display, data->xwindow, False,
+ mask, GrabModeAsync, GrabModeAsync,
+ None, None, CurrentTime);
+ if (rc != GrabSuccess) {
+ return SDL_SetError("X server refused mouse capture");
+ }
+ } else {
+ X11_XUngrabPointer(display, CurrentTime);
+ }
+
+ X11_XSync(display, False);
+
+ return 0;
+}
+
+static Uint32
+X11_GetGlobalMouseState(int *x, int *y)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
+ Display *display = GetDisplay();
+ const int num_screens = SDL_GetNumVideoDisplays();
+ int i;
+
+ /* !!! FIXME: should we XSync() here first? */
+
+#if !SDL_VIDEO_DRIVER_X11_XINPUT2
+ videodata->global_mouse_changed = SDL_TRUE;
+#endif
+
+ /* check if we have this cached since XInput last saw the mouse move. */
+ /* !!! FIXME: can we just calculate this from XInput's events? */
+ if (videodata->global_mouse_changed) {
+ for (i = 0; i < num_screens; i++) {
+ SDL_DisplayData *data = (SDL_DisplayData *) SDL_GetDisplayDriverData(i);
+ if (data != NULL) {
+ Window root, child;
+ int rootx, rooty, winx, winy;
+ unsigned int mask;
+ if (X11_XQueryPointer(display, RootWindow(display, data->screen), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) {
+ XWindowAttributes root_attrs;
+ Uint32 buttons = 0;
+ buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0;
+ buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0;
+ buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0;
+ /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing
+ * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right).
+ *
+ * Adding root position to root-relative coordinates seems to be a better way to get absolute position. */
+ X11_XGetWindowAttributes(display, root, &root_attrs);
+ videodata->global_mouse_position.x = root_attrs.x + rootx;
+ videodata->global_mouse_position.y = root_attrs.y + rooty;
+ videodata->global_mouse_buttons = buttons;
+ videodata->global_mouse_changed = SDL_FALSE;
+ break;
+ }
+ }
+ }
+ }
+
+ SDL_assert(!videodata->global_mouse_changed); /* The pointer wasn't on any X11 screen?! */
+
+ *x = videodata->global_mouse_position.x;
+ *y = videodata->global_mouse_position.y;
+ return videodata->global_mouse_buttons;
+}
+
+
+void
+X11_InitMouse(_THIS)
+{
+ SDL_Mouse *mouse = SDL_GetMouse();
+
+ mouse->CreateCursor = X11_CreateCursor;
+ mouse->CreateSystemCursor = X11_CreateSystemCursor;
+ mouse->ShowCursor = X11_ShowCursor;
+ mouse->FreeCursor = X11_FreeCursor;
+ mouse->WarpMouse = X11_WarpMouse;
+ mouse->WarpMouseGlobal = X11_WarpMouseGlobal;
+ mouse->SetRelativeMouseMode = X11_SetRelativeMouseMode;
+ mouse->CaptureMouse = X11_CaptureMouse;
+ mouse->GetGlobalMouseState = X11_GetGlobalMouseState;
+
+ SDL_SetDefaultCursor(X11_CreateDefaultCursor());
+}
+
+void
+X11_QuitMouse(_THIS)
+{
+ X11_DestroyEmptyCursor();
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.h
new file mode 100644
index 0000000..1041858
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11mouse.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11mouse_h_
+#define SDL_x11mouse_h_
+
+extern void X11_InitMouse(_THIS);
+extern void X11_QuitMouse(_THIS);
+
+#endif /* SDL_x11mouse_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.c
new file mode 100644
index 0000000..7c3cb33
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.c
@@ -0,0 +1,946 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_x11video.h"
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+
+/* GLX implementation of SDL OpenGL support */
+
+#if SDL_VIDEO_OPENGL_GLX
+#include "SDL_loadso.h"
+#include "SDL_x11opengles.h"
+
+#if defined(__IRIX__)
+/* IRIX doesn't have a GL library versioning system */
+#define DEFAULT_OPENGL "libGL.so"
+#elif defined(__MACOSX__)
+#define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib"
+#elif defined(__QNXNTO__)
+#define DEFAULT_OPENGL "libGL.so.3"
+#else
+#define DEFAULT_OPENGL "libGL.so.1"
+#endif
+
+#ifndef GLX_NONE_EXT
+#define GLX_NONE_EXT 0x8000
+#endif
+
+#ifndef GLX_ARB_multisample
+#define GLX_ARB_multisample
+#define GLX_SAMPLE_BUFFERS_ARB 100000
+#define GLX_SAMPLES_ARB 100001
+#endif
+
+#ifndef GLX_EXT_visual_rating
+#define GLX_EXT_visual_rating
+#define GLX_VISUAL_CAVEAT_EXT 0x20
+#define GLX_NONE_EXT 0x8000
+#define GLX_SLOW_VISUAL_EXT 0x8001
+#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
+#endif
+
+#ifndef GLX_EXT_visual_info
+#define GLX_EXT_visual_info
+#define GLX_X_VISUAL_TYPE_EXT 0x22
+#define GLX_DIRECT_COLOR_EXT 0x8003
+#endif
+
+#ifndef GLX_ARB_create_context
+#define GLX_ARB_create_context
+#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define GLX_CONTEXT_FLAGS_ARB 0x2094
+#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001
+#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+
+/* Typedef for the GL 3.0 context creation function */
+typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy,
+ GLXFBConfig config,
+ GLXContext
+ share_context,
+ Bool direct,
+ const int
+ *attrib_list);
+#endif
+
+#ifndef GLX_ARB_create_context_profile
+#define GLX_ARB_create_context_profile
+#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#endif
+
+#ifndef GLX_ARB_create_context_robustness
+#define GLX_ARB_create_context_robustness
+#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
+#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#endif
+
+#ifndef GLX_EXT_create_context_es2_profile
+#define GLX_EXT_create_context_es2_profile
+#ifndef GLX_CONTEXT_ES2_PROFILE_BIT_EXT
+#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000002
+#endif
+#endif
+
+#ifndef GLX_ARB_framebuffer_sRGB
+#define GLX_ARB_framebuffer_sRGB
+#ifndef GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB
+#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
+#endif
+#endif
+
+#ifndef GLX_ARB_create_context_no_error
+#define GLX_ARB_create_context_no_error
+#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB
+#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
+#endif
+#endif
+
+#ifndef GLX_EXT_swap_control
+#define GLX_SWAP_INTERVAL_EXT 0x20F1
+#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
+#endif
+
+#ifndef GLX_EXT_swap_control_tear
+#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
+#endif
+
+#ifndef GLX_ARB_context_flush_control
+#define GLX_ARB_context_flush_control
+#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000
+#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+#endif
+
+#define OPENGL_REQUIRES_DLOPEN
+#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
+#include <dlfcn.h>
+#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
+#define GL_LoadFunction dlsym
+#define GL_UnloadObject dlclose
+#else
+#define GL_LoadObject SDL_LoadObject
+#define GL_LoadFunction SDL_LoadFunction
+#define GL_UnloadObject SDL_UnloadObject
+#endif
+
+static void X11_GL_InitExtensions(_THIS);
+
+int
+X11_GL_LoadLibrary(_THIS, const char *path)
+{
+ Display *display;
+ void *handle;
+
+ if (_this->gl_data) {
+ return SDL_SetError("OpenGL context already created");
+ }
+
+ /* Load the OpenGL library */
+ if (path == NULL) {
+ path = SDL_getenv("SDL_OPENGL_LIBRARY");
+ }
+ if (path == NULL) {
+ path = DEFAULT_OPENGL;
+ }
+ _this->gl_config.dll_handle = GL_LoadObject(path);
+ if (!_this->gl_config.dll_handle) {
+#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
+ SDL_SetError("Failed loading %s: %s", path, dlerror());
+#endif
+ return -1;
+ }
+ SDL_strlcpy(_this->gl_config.driver_path, path,
+ SDL_arraysize(_this->gl_config.driver_path));
+
+ /* Allocate OpenGL memory */
+ _this->gl_data =
+ (struct SDL_GLDriverData *) SDL_calloc(1,
+ sizeof(struct
+ SDL_GLDriverData));
+ if (!_this->gl_data) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Load function pointers */
+ handle = _this->gl_config.dll_handle;
+ _this->gl_data->glXQueryExtension =
+ (Bool (*)(Display *, int *, int *))
+ GL_LoadFunction(handle, "glXQueryExtension");
+ _this->gl_data->glXGetProcAddress =
+ (void *(*)(const GLubyte *))
+ GL_LoadFunction(handle, "glXGetProcAddressARB");
+ _this->gl_data->glXChooseVisual =
+ (XVisualInfo * (*)(Display *, int, int *))
+ X11_GL_GetProcAddress(_this, "glXChooseVisual");
+ _this->gl_data->glXCreateContext =
+ (GLXContext(*)(Display *, XVisualInfo *, GLXContext, int))
+ X11_GL_GetProcAddress(_this, "glXCreateContext");
+ _this->gl_data->glXDestroyContext =
+ (void (*)(Display *, GLXContext))
+ X11_GL_GetProcAddress(_this, "glXDestroyContext");
+ _this->gl_data->glXMakeCurrent =
+ (int (*)(Display *, GLXDrawable, GLXContext))
+ X11_GL_GetProcAddress(_this, "glXMakeCurrent");
+ _this->gl_data->glXSwapBuffers =
+ (void (*)(Display *, GLXDrawable))
+ X11_GL_GetProcAddress(_this, "glXSwapBuffers");
+ _this->gl_data->glXQueryDrawable =
+ (void (*)(Display*,GLXDrawable,int,unsigned int*))
+ X11_GL_GetProcAddress(_this, "glXQueryDrawable");
+
+ if (!_this->gl_data->glXQueryExtension ||
+ !_this->gl_data->glXChooseVisual ||
+ !_this->gl_data->glXCreateContext ||
+ !_this->gl_data->glXDestroyContext ||
+ !_this->gl_data->glXMakeCurrent ||
+ !_this->gl_data->glXSwapBuffers) {
+ return SDL_SetError("Could not retrieve OpenGL functions");
+ }
+
+ display = ((SDL_VideoData *) _this->driverdata)->display;
+ if (!_this->gl_data->glXQueryExtension(display, &_this->gl_data->errorBase, &_this->gl_data->eventBase)) {
+ return SDL_SetError("GLX is not supported");
+ }
+
+ /* Initialize extensions */
+ /* See lengthy comment about the inc/dec in
+ ../windows/SDL_windowsopengl.c. */
+ ++_this->gl_config.driver_loaded;
+ X11_GL_InitExtensions(_this);
+ --_this->gl_config.driver_loaded;
+
+ /* If we need a GL ES context and there's no
+ * GLX_EXT_create_context_es2_profile extension, switch over to X11_GLES functions
+ */
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES &&
+ X11_GL_UseEGL(_this) ) {
+#if SDL_VIDEO_OPENGL_EGL
+ X11_GL_UnloadLibrary(_this);
+ /* Better avoid conflicts! */
+ if (_this->gl_config.dll_handle != NULL ) {
+ GL_UnloadObject(_this->gl_config.dll_handle);
+ _this->gl_config.dll_handle = NULL;
+ }
+ _this->GL_LoadLibrary = X11_GLES_LoadLibrary;
+ _this->GL_GetProcAddress = X11_GLES_GetProcAddress;
+ _this->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
+ _this->GL_CreateContext = X11_GLES_CreateContext;
+ _this->GL_MakeCurrent = X11_GLES_MakeCurrent;
+ _this->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
+ _this->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
+ _this->GL_SwapWindow = X11_GLES_SwapWindow;
+ _this->GL_DeleteContext = X11_GLES_DeleteContext;
+ return X11_GLES_LoadLibrary(_this, NULL);
+#else
+ return SDL_SetError("SDL not configured with EGL support");
+#endif
+ }
+
+ return 0;
+}
+
+void *
+X11_GL_GetProcAddress(_THIS, const char *proc)
+{
+ if (_this->gl_data->glXGetProcAddress) {
+ return _this->gl_data->glXGetProcAddress((const GLubyte *) proc);
+ }
+ return GL_LoadFunction(_this->gl_config.dll_handle, proc);
+}
+
+void
+X11_GL_UnloadLibrary(_THIS)
+{
+ /* Don't actually unload the library, since it may have registered
+ * X11 shutdown hooks, per the notes at:
+ * http://dri.sourceforge.net/doc/DRIuserguide.html
+ */
+#if 0
+ GL_UnloadObject(_this->gl_config.dll_handle);
+ _this->gl_config.dll_handle = NULL;
+#endif
+
+ /* Free OpenGL memory */
+ SDL_free(_this->gl_data);
+ _this->gl_data = NULL;
+}
+
+static SDL_bool
+HasExtension(const char *extension, const char *extensions)
+{
+ const char *start;
+ const char *where, *terminator;
+
+ if (!extensions)
+ return SDL_FALSE;
+
+ /* Extension names should not have spaces. */
+ where = SDL_strchr(extension, ' ');
+ if (where || *extension == '\0')
+ return SDL_FALSE;
+
+ /* It takes a bit of care to be fool-proof about parsing the
+ * OpenGL extensions string. Don't be fooled by sub-strings,
+ * etc. */
+
+ start = extensions;
+
+ for (;;) {
+ where = SDL_strstr(start, extension);
+ if (!where)
+ break;
+
+ terminator = where + SDL_strlen(extension);
+ if (where == start || *(where - 1) == ' ')
+ if (*terminator == ' ' || *terminator == '\0')
+ return SDL_TRUE;
+
+ start = terminator;
+ }
+ return SDL_FALSE;
+}
+
+static void
+X11_GL_InitExtensions(_THIS)
+{
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ const int screen = DefaultScreen(display);
+ XVisualInfo *vinfo = NULL;
+ Window w = 0;
+ GLXContext prev_ctx = 0;
+ GLXDrawable prev_drawable = 0;
+ GLXContext context = 0;
+ const char *(*glXQueryExtensionsStringFunc) (Display *, int);
+ const char *extensions;
+
+ vinfo = X11_GL_GetVisual(_this, display, screen);
+ if (vinfo) {
+ GLXContext (*glXGetCurrentContextFunc) (void) =
+ (GLXContext(*)(void))
+ X11_GL_GetProcAddress(_this, "glXGetCurrentContext");
+
+ GLXDrawable (*glXGetCurrentDrawableFunc) (void) =
+ (GLXDrawable(*)(void))
+ X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable");
+
+ if (glXGetCurrentContextFunc && glXGetCurrentDrawableFunc) {
+ XSetWindowAttributes xattr;
+ prev_ctx = glXGetCurrentContextFunc();
+ prev_drawable = glXGetCurrentDrawableFunc();
+
+ xattr.background_pixel = 0;
+ xattr.border_pixel = 0;
+ xattr.colormap =
+ X11_XCreateColormap(display, RootWindow(display, screen),
+ vinfo->visual, AllocNone);
+ w = X11_XCreateWindow(display, RootWindow(display, screen), 0, 0,
+ 32, 32, 0, vinfo->depth, InputOutput, vinfo->visual,
+ (CWBackPixel | CWBorderPixel | CWColormap), &xattr);
+
+ context = _this->gl_data->glXCreateContext(display, vinfo,
+ NULL, True);
+ if (context) {
+ _this->gl_data->glXMakeCurrent(display, w, context);
+ }
+ }
+
+ X11_XFree(vinfo);
+ }
+
+ glXQueryExtensionsStringFunc =
+ (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this,
+ "glXQueryExtensionsString");
+ if (glXQueryExtensionsStringFunc) {
+ extensions = glXQueryExtensionsStringFunc(display, screen);
+ } else {
+ extensions = NULL;
+ }
+
+ /* Check for GLX_EXT_swap_control(_tear) */
+ _this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_FALSE;
+ if (HasExtension("GLX_EXT_swap_control", extensions)) {
+ _this->gl_data->glXSwapIntervalEXT =
+ (void (*)(Display*,GLXDrawable,int))
+ X11_GL_GetProcAddress(_this, "glXSwapIntervalEXT");
+ if (HasExtension("GLX_EXT_swap_control_tear", extensions)) {
+ _this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_TRUE;
+ }
+ }
+
+ /* Check for GLX_MESA_swap_control */
+ if (HasExtension("GLX_MESA_swap_control", extensions)) {
+ _this->gl_data->glXSwapIntervalMESA =
+ (int(*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalMESA");
+ _this->gl_data->glXGetSwapIntervalMESA =
+ (int(*)(void)) X11_GL_GetProcAddress(_this,
+ "glXGetSwapIntervalMESA");
+ }
+
+ /* Check for GLX_SGI_swap_control */
+ if (HasExtension("GLX_SGI_swap_control", extensions)) {
+ _this->gl_data->glXSwapIntervalSGI =
+ (int (*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
+ }
+
+ /* Check for GLX_ARB_create_context */
+ if (HasExtension("GLX_ARB_create_context", extensions)) {
+ _this->gl_data->glXCreateContextAttribsARB =
+ (GLXContext (*)(Display*,GLXFBConfig,GLXContext,Bool,const int *))
+ X11_GL_GetProcAddress(_this, "glXCreateContextAttribsARB");
+ _this->gl_data->glXChooseFBConfig =
+ (GLXFBConfig *(*)(Display *, int, const int *, int *))
+ X11_GL_GetProcAddress(_this, "glXChooseFBConfig");
+ }
+
+ /* Check for GLX_EXT_visual_rating */
+ if (HasExtension("GLX_EXT_visual_rating", extensions)) {
+ _this->gl_data->HAS_GLX_EXT_visual_rating = SDL_TRUE;
+ }
+
+ /* Check for GLX_EXT_visual_info */
+ if (HasExtension("GLX_EXT_visual_info", extensions)) {
+ _this->gl_data->HAS_GLX_EXT_visual_info = SDL_TRUE;
+ }
+
+ /* Check for GLX_EXT_create_context_es2_profile */
+ if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) {
+ /* this wants to call glGetString(), so it needs a context. */
+ /* !!! FIXME: it would be nice not to make a context here though! */
+ if (context) {
+ SDL_GL_DeduceMaxSupportedESProfile(
+ &_this->gl_data->es_profile_max_supported_version.major,
+ &_this->gl_data->es_profile_max_supported_version.minor
+ );
+ }
+ }
+
+ /* Check for GLX_ARB_context_flush_control */
+ if (HasExtension("GLX_ARB_context_flush_control", extensions)) {
+ _this->gl_data->HAS_GLX_ARB_context_flush_control = SDL_TRUE;
+ }
+
+ /* Check for GLX_ARB_create_context_robustness */
+ if (HasExtension("GLX_ARB_create_context_robustness", extensions)) {
+ _this->gl_data->HAS_GLX_ARB_create_context_robustness = SDL_TRUE;
+ }
+
+ /* Check for GLX_ARB_create_context_no_error */
+ if (HasExtension("GLX_ARB_create_context_no_error", extensions)) {
+ _this->gl_data->HAS_GLX_ARB_create_context_no_error = SDL_TRUE;
+ }
+
+ if (context) {
+ _this->gl_data->glXMakeCurrent(display, None, NULL);
+ _this->gl_data->glXDestroyContext(display, context);
+ if (prev_ctx && prev_drawable) {
+ _this->gl_data->glXMakeCurrent(display, prev_drawable, prev_ctx);
+ }
+ }
+
+ if (w) {
+ X11_XDestroyWindow(display, w);
+ }
+ X11_PumpEvents(_this);
+}
+
+/* glXChooseVisual and glXChooseFBConfig have some small differences in
+ * the attribute encoding, it can be chosen with the for_FBConfig parameter.
+ * Some targets fail if you use GLX_X_VISUAL_TYPE_EXT/GLX_DIRECT_COLOR_EXT,
+ * so it gets specified last if used and is pointed to by *_pvistypeattr.
+ * In case of failure, if that pointer is not NULL, set that pointer to None
+ * and try again.
+ */
+static int
+X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig, int **_pvistypeattr)
+{
+ int i = 0;
+ const int MAX_ATTRIBUTES = 64;
+ int *pvistypeattr = NULL;
+
+ /* assert buffer is large enough to hold all SDL attributes. */
+ SDL_assert(size >= MAX_ATTRIBUTES);
+
+ /* Setup our GLX attributes according to the gl_config. */
+ if( for_FBConfig ) {
+ attribs[i++] = GLX_RENDER_TYPE;
+ attribs[i++] = GLX_RGBA_BIT;
+ } else {
+ attribs[i++] = GLX_RGBA;
+ }
+ attribs[i++] = GLX_RED_SIZE;
+ attribs[i++] = _this->gl_config.red_size;
+ attribs[i++] = GLX_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.green_size;
+ attribs[i++] = GLX_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.blue_size;
+
+ if (_this->gl_config.alpha_size) {
+ attribs[i++] = GLX_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.alpha_size;
+ }
+
+ if (_this->gl_config.double_buffer) {
+ attribs[i++] = GLX_DOUBLEBUFFER;
+ if( for_FBConfig ) {
+ attribs[i++] = True;
+ }
+ }
+
+ attribs[i++] = GLX_DEPTH_SIZE;
+ attribs[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.stencil_size) {
+ attribs[i++] = GLX_STENCIL_SIZE;
+ attribs[i++] = _this->gl_config.stencil_size;
+ }
+
+ if (_this->gl_config.accum_red_size) {
+ attribs[i++] = GLX_ACCUM_RED_SIZE;
+ attribs[i++] = _this->gl_config.accum_red_size;
+ }
+
+ if (_this->gl_config.accum_green_size) {
+ attribs[i++] = GLX_ACCUM_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.accum_green_size;
+ }
+
+ if (_this->gl_config.accum_blue_size) {
+ attribs[i++] = GLX_ACCUM_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.accum_blue_size;
+ }
+
+ if (_this->gl_config.accum_alpha_size) {
+ attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.accum_alpha_size;
+ }
+
+ if (_this->gl_config.stereo) {
+ attribs[i++] = GLX_STEREO;
+ if( for_FBConfig ) {
+ attribs[i++] = True;
+ }
+ }
+
+ if (_this->gl_config.multisamplebuffers) {
+ attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
+ attribs[i++] = _this->gl_config.multisamplebuffers;
+ }
+
+ if (_this->gl_config.multisamplesamples) {
+ attribs[i++] = GLX_SAMPLES_ARB;
+ attribs[i++] = _this->gl_config.multisamplesamples;
+ }
+
+ if (_this->gl_config.framebuffer_srgb_capable) {
+ attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB;
+ attribs[i++] = True; /* always needed, for_FBConfig or not! */
+ }
+
+ if (_this->gl_config.accelerated >= 0 &&
+ _this->gl_data->HAS_GLX_EXT_visual_rating) {
+ attribs[i++] = GLX_VISUAL_CAVEAT_EXT;
+ attribs[i++] = _this->gl_config.accelerated ? GLX_NONE_EXT :
+ GLX_SLOW_VISUAL_EXT;
+ }
+
+ /* If we're supposed to use DirectColor visuals, and we've got the
+ EXT_visual_info extension, then add GLX_X_VISUAL_TYPE_EXT. */
+ if (X11_UseDirectColorVisuals() &&
+ _this->gl_data->HAS_GLX_EXT_visual_info) {
+ pvistypeattr = &attribs[i];
+ attribs[i++] = GLX_X_VISUAL_TYPE_EXT;
+ attribs[i++] = GLX_DIRECT_COLOR_EXT;
+ }
+
+ attribs[i++] = None;
+
+ SDL_assert(i <= MAX_ATTRIBUTES);
+
+ if (_pvistypeattr) {
+ *_pvistypeattr = pvistypeattr;
+ }
+
+ return i;
+}
+
+XVisualInfo *
+X11_GL_GetVisual(_THIS, Display * display, int screen)
+{
+ /* 64 seems nice. */
+ int attribs[64];
+ XVisualInfo *vinfo;
+ int *pvistypeattr = NULL;
+
+ if (!_this->gl_data) {
+ /* The OpenGL library wasn't loaded, SDL_GetError() should have info */
+ return NULL;
+ }
+
+ X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE, &pvistypeattr);
+ vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
+
+ if (!vinfo && (pvistypeattr != NULL)) {
+ *pvistypeattr = None;
+ vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
+ }
+
+ if (!vinfo) {
+ SDL_SetError("Couldn't find matching GLX visual");
+ }
+ return vinfo;
+}
+
+static int (*handler) (Display *, XErrorEvent *) = NULL;
+static const char *errorHandlerOperation = NULL;
+static int errorBase = 0;
+static int errorCode = 0;
+static int
+X11_GL_ErrorHandler(Display * d, XErrorEvent * e)
+{
+ char *x11_error = NULL;
+ char x11_error_locale[256];
+
+ errorCode = e->error_code;
+ if (X11_XGetErrorText(d, errorCode, x11_error_locale, sizeof(x11_error_locale)) == Success)
+ {
+ x11_error = SDL_iconv_string("UTF-8", "", x11_error_locale, SDL_strlen(x11_error_locale)+1);
+ }
+
+ if (x11_error)
+ {
+ SDL_SetError("Could not %s: %s", errorHandlerOperation, x11_error);
+ SDL_free(x11_error);
+ }
+ else
+ {
+ SDL_SetError("Could not %s: %i (Base %i)", errorHandlerOperation, errorCode, errorBase);
+ }
+
+ return (0);
+}
+
+SDL_bool
+X11_GL_UseEGL(_THIS)
+{
+ SDL_assert(_this->gl_data != NULL);
+ SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
+
+ return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE)
+ || _this->gl_config.major_version == 1 /* No GLX extension for OpenGL ES 1.x profiles. */
+ || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major
+ || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major
+ && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor));
+}
+
+SDL_GLContext
+X11_GL_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ int screen =
+ ((SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata)->screen;
+ XWindowAttributes xattr;
+ XVisualInfo v, *vinfo;
+ int n;
+ GLXContext context = NULL, share_context;
+
+ if (_this->gl_config.share_with_current_context) {
+ share_context = (GLXContext)SDL_GL_GetCurrentContext();
+ } else {
+ share_context = NULL;
+ }
+
+ /* We do this to create a clean separation between X and GLX errors. */
+ X11_XSync(display, False);
+ errorHandlerOperation = "create GL context";
+ errorBase = _this->gl_data->errorBase;
+ errorCode = Success;
+ handler = X11_XSetErrorHandler(X11_GL_ErrorHandler);
+ X11_XGetWindowAttributes(display, data->xwindow, &xattr);
+ v.screen = screen;
+ v.visualid = X11_XVisualIDFromVisual(xattr.visual);
+ vinfo = X11_XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n);
+ if (vinfo) {
+ if (_this->gl_config.major_version < 3 &&
+ _this->gl_config.profile_mask == 0 &&
+ _this->gl_config.flags == 0) {
+ /* Create legacy context */
+ context =
+ _this->gl_data->glXCreateContext(display, vinfo, share_context, True);
+ } else {
+ /* max 14 attributes plus terminator */
+ int attribs[15] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB,
+ _this->gl_config.major_version,
+ GLX_CONTEXT_MINOR_VERSION_ARB,
+ _this->gl_config.minor_version,
+ 0
+ };
+ int iattr = 4;
+
+ /* SDL profile bits match GLX profile bits */
+ if( _this->gl_config.profile_mask != 0 ) {
+ attribs[iattr++] = GLX_CONTEXT_PROFILE_MASK_ARB;
+ attribs[iattr++] = _this->gl_config.profile_mask;
+ }
+
+ /* SDL flags match GLX flags */
+ if( _this->gl_config.flags != 0 ) {
+ attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB;
+ attribs[iattr++] = _this->gl_config.flags;
+ }
+
+ /* only set if glx extension is available */
+ if( _this->gl_data->HAS_GLX_ARB_context_flush_control ) {
+ attribs[iattr++] = GLX_CONTEXT_RELEASE_BEHAVIOR_ARB;
+ attribs[iattr++] =
+ _this->gl_config.release_behavior ?
+ GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB :
+ GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
+ }
+
+ /* only set if glx extension is available */
+ if( _this->gl_data->HAS_GLX_ARB_create_context_robustness ) {
+ attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB;
+ attribs[iattr++] =
+ _this->gl_config.reset_notification ?
+ GLX_LOSE_CONTEXT_ON_RESET_ARB :
+ GLX_NO_RESET_NOTIFICATION_ARB;
+ }
+
+ /* only set if glx extension is available */
+ if( _this->gl_data->HAS_GLX_ARB_create_context_no_error ) {
+ attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB;
+ attribs[iattr++] = _this->gl_config.no_error;
+ }
+
+ attribs[iattr++] = 0;
+
+ /* Get a pointer to the context creation function for GL 3.0 */
+ if (!_this->gl_data->glXCreateContextAttribsARB) {
+ SDL_SetError("OpenGL 3.0 and later are not supported by this system");
+ } else {
+ int glxAttribs[64];
+
+ /* Create a GL 3.x context */
+ GLXFBConfig *framebuffer_config = NULL;
+ int fbcount = 0;
+ int *pvistypeattr = NULL;
+
+ X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE,&pvistypeattr);
+
+ if (_this->gl_data->glXChooseFBConfig) {
+ framebuffer_config = _this->gl_data->glXChooseFBConfig(display,
+ DefaultScreen(display), glxAttribs,
+ &fbcount);
+
+ if (!framebuffer_config && (pvistypeattr != NULL)) {
+ *pvistypeattr = None;
+ framebuffer_config = _this->gl_data->glXChooseFBConfig(display,
+ DefaultScreen(display), glxAttribs,
+ &fbcount);
+ }
+
+ if (framebuffer_config) {
+ context = _this->gl_data->glXCreateContextAttribsARB(display,
+ framebuffer_config[0],
+ share_context, True, attribs);
+ X11_XFree(framebuffer_config);
+ }
+ }
+ }
+ }
+ X11_XFree(vinfo);
+ }
+ X11_XSync(display, False);
+ X11_XSetErrorHandler(handler);
+
+ if (!context) {
+ if (errorCode == Success) {
+ SDL_SetError("Could not create GL context");
+ }
+ return NULL;
+ }
+
+ if (X11_GL_MakeCurrent(_this, window, context) < 0) {
+ X11_GL_DeleteContext(_this, context);
+ return NULL;
+ }
+
+ return context;
+}
+
+int
+X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ Window drawable =
+ (context ? ((SDL_WindowData *) window->driverdata)->xwindow : None);
+ GLXContext glx_context = (GLXContext) context;
+ int rc;
+
+ if (!_this->gl_data) {
+ return SDL_SetError("OpenGL not initialized");
+ }
+
+ /* We do this to create a clean separation between X and GLX errors. */
+ X11_XSync(display, False);
+ errorHandlerOperation = "make GL context current";
+ errorBase = _this->gl_data->errorBase;
+ errorCode = Success;
+ handler = X11_XSetErrorHandler(X11_GL_ErrorHandler);
+ rc = _this->gl_data->glXMakeCurrent(display, drawable, glx_context);
+ X11_XSetErrorHandler(handler);
+
+ if (errorCode != Success) { /* uhoh, an X error was thrown! */
+ return -1; /* the error handler called SDL_SetError() already. */
+ } else if (!rc) { /* glXMakeCurrent() failed without throwing an X error */
+ return SDL_SetError("Unable to make GL context current");
+ }
+
+ return 0;
+}
+
+/*
+ 0 is a valid argument to glXSwapInterval(MESA|EXT) and setting it to 0
+ will undo the effect of a previous call with a value that is greater
+ than zero (or at least that is what the docs say). OTOH, 0 is an invalid
+ argument to glXSwapIntervalSGI and it returns an error if you call it
+ with 0 as an argument.
+*/
+
+static int swapinterval = 0;
+int
+X11_GL_SetSwapInterval(_THIS, int interval)
+{
+ int status = -1;
+
+ if ((interval < 0) && (!_this->gl_data->HAS_GLX_EXT_swap_control_tear)) {
+ SDL_SetError("Negative swap interval unsupported in this GL");
+ } else if (_this->gl_data->glXSwapIntervalEXT) {
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ const SDL_WindowData *windowdata = (SDL_WindowData *)
+ SDL_GL_GetCurrentWindow()->driverdata;
+
+ Window drawable = windowdata->xwindow;
+
+ /*
+ * This is a workaround for a bug in NVIDIA drivers. Bug has been reported
+ * and will be fixed in a future release (probably 319.xx).
+ *
+ * There's a bug where glXSetSwapIntervalEXT ignores updates because
+ * it has the wrong value cached. To work around it, we just run a no-op
+ * update to the current value.
+ */
+ int currentInterval = X11_GL_GetSwapInterval(_this);
+ _this->gl_data->glXSwapIntervalEXT(display, drawable, currentInterval);
+ _this->gl_data->glXSwapIntervalEXT(display, drawable, interval);
+
+ status = 0;
+ swapinterval = interval;
+ } else if (_this->gl_data->glXSwapIntervalMESA) {
+ status = _this->gl_data->glXSwapIntervalMESA(interval);
+ if (status != 0) {
+ SDL_SetError("glXSwapIntervalMESA failed");
+ } else {
+ swapinterval = interval;
+ }
+ } else if (_this->gl_data->glXSwapIntervalSGI) {
+ status = _this->gl_data->glXSwapIntervalSGI(interval);
+ if (status != 0) {
+ SDL_SetError("glXSwapIntervalSGI failed");
+ } else {
+ swapinterval = interval;
+ }
+ } else {
+ SDL_Unsupported();
+ }
+ return status;
+}
+
+int
+X11_GL_GetSwapInterval(_THIS)
+{
+ if (_this->gl_data->glXSwapIntervalEXT) {
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ const SDL_WindowData *windowdata = (SDL_WindowData *)
+ SDL_GL_GetCurrentWindow()->driverdata;
+ Window drawable = windowdata->xwindow;
+ unsigned int allow_late_swap_tearing = 0;
+ unsigned int interval = 0;
+
+ if (_this->gl_data->HAS_GLX_EXT_swap_control_tear) {
+ _this->gl_data->glXQueryDrawable(display, drawable,
+ GLX_LATE_SWAPS_TEAR_EXT,
+ &allow_late_swap_tearing);
+ }
+
+ _this->gl_data->glXQueryDrawable(display, drawable,
+ GLX_SWAP_INTERVAL_EXT, &interval);
+
+ if ((allow_late_swap_tearing) && (interval > 0)) {
+ return -((int) interval);
+ }
+
+ return (int) interval;
+ } else if (_this->gl_data->glXGetSwapIntervalMESA) {
+ return _this->gl_data->glXGetSwapIntervalMESA();
+ } else {
+ return swapinterval;
+ }
+}
+
+int
+X11_GL_SwapWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ _this->gl_data->glXSwapBuffers(display, data->xwindow);
+ return 0;
+}
+
+void
+X11_GL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ Display *display = ((SDL_VideoData *) _this->driverdata)->display;
+ GLXContext glx_context = (GLXContext) context;
+
+ if (!_this->gl_data) {
+ return;
+ }
+ _this->gl_data->glXDestroyContext(display, glx_context);
+ X11_XSync(display, False);
+}
+
+#endif /* SDL_VIDEO_OPENGL_GLX */
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.h
new file mode 100644
index 0000000..1a26ea0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengl.h
@@ -0,0 +1,84 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11opengl_h_
+#define SDL_x11opengl_h_
+
+#if SDL_VIDEO_OPENGL_GLX
+#include "SDL_opengl.h"
+#include <GL/glx.h>
+
+struct SDL_GLDriverData
+{
+ int errorBase, eventBase;
+
+ SDL_bool HAS_GLX_EXT_visual_rating;
+ SDL_bool HAS_GLX_EXT_visual_info;
+ SDL_bool HAS_GLX_EXT_swap_control_tear;
+ SDL_bool HAS_GLX_ARB_context_flush_control;
+ SDL_bool HAS_GLX_ARB_create_context_robustness;
+ SDL_bool HAS_GLX_ARB_create_context_no_error;
+
+ /* Max version of OpenGL ES context that can be created if the
+ implementation supports GLX_EXT_create_context_es2_profile.
+ major = minor = 0 when unsupported.
+ */
+ struct {
+ int major;
+ int minor;
+ } es_profile_max_supported_version;
+
+ Bool (*glXQueryExtension) (Display*,int*,int*);
+ void *(*glXGetProcAddress) (const GLubyte*);
+ XVisualInfo *(*glXChooseVisual) (Display*,int,int*);
+ GLXContext (*glXCreateContext) (Display*,XVisualInfo*,GLXContext,Bool);
+ GLXContext (*glXCreateContextAttribsARB) (Display*,GLXFBConfig,GLXContext,Bool,const int *);
+ GLXFBConfig *(*glXChooseFBConfig) (Display*,int,const int *,int *);
+ void (*glXDestroyContext) (Display*, GLXContext);
+ Bool(*glXMakeCurrent) (Display*,GLXDrawable,GLXContext);
+ void (*glXSwapBuffers) (Display*, GLXDrawable);
+ void (*glXQueryDrawable) (Display*,GLXDrawable,int,unsigned int*);
+ void (*glXSwapIntervalEXT) (Display*,GLXDrawable,int);
+ int (*glXSwapIntervalSGI) (int);
+ int (*glXSwapIntervalMESA) (int);
+ int (*glXGetSwapIntervalMESA) (void);
+};
+
+/* OpenGL functions */
+extern int X11_GL_LoadLibrary(_THIS, const char *path);
+extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
+extern void X11_GL_UnloadLibrary(_THIS);
+extern SDL_bool X11_GL_UseEGL(_THIS);
+extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
+extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
+extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
+ SDL_GLContext context);
+extern int X11_GL_SetSwapInterval(_THIS, int interval);
+extern int X11_GL_GetSwapInterval(_THIS);
+extern int X11_GL_SwapWindow(_THIS, SDL_Window * window);
+extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
+
+#endif /* SDL_VIDEO_OPENGL_GLX */
+
+#endif /* SDL_x11opengl_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.c
new file mode 100644
index 0000000..76b6cd7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.c
@@ -0,0 +1,109 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_x11video.h"
+#include "SDL_x11opengles.h"
+#include "SDL_x11opengl.h"
+
+/* EGL implementation of SDL OpenGL support */
+
+int
+X11_GLES_LoadLibrary(_THIS, const char *path)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ /* If the profile requested is not GL ES, switch over to X11_GL functions */
+ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
+ #if SDL_VIDEO_OPENGL_GLX
+ X11_GLES_UnloadLibrary(_this);
+ _this->GL_LoadLibrary = X11_GL_LoadLibrary;
+ _this->GL_GetProcAddress = X11_GL_GetProcAddress;
+ _this->GL_UnloadLibrary = X11_GL_UnloadLibrary;
+ _this->GL_CreateContext = X11_GL_CreateContext;
+ _this->GL_MakeCurrent = X11_GL_MakeCurrent;
+ _this->GL_SetSwapInterval = X11_GL_SetSwapInterval;
+ _this->GL_GetSwapInterval = X11_GL_GetSwapInterval;
+ _this->GL_SwapWindow = X11_GL_SwapWindow;
+ _this->GL_DeleteContext = X11_GL_DeleteContext;
+ return X11_GL_LoadLibrary(_this, path);
+ #else
+ return SDL_SetError("SDL not configured with OpenGL/GLX support");
+ #endif
+ }
+
+ return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0);
+}
+
+XVisualInfo *
+X11_GLES_GetVisual(_THIS, Display * display, int screen)
+{
+
+ XVisualInfo *egl_visualinfo = NULL;
+ EGLint visual_id;
+ XVisualInfo vi_in;
+ int out_count;
+
+ if (!_this->egl_data) {
+ /* The EGL library wasn't loaded, SDL_GetError() should have info */
+ return NULL;
+ }
+
+ if (_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
+ _this->egl_data->egl_config,
+ EGL_NATIVE_VISUAL_ID,
+ &visual_id) == EGL_FALSE || !visual_id) {
+ /* Use the default visual when all else fails */
+ vi_in.screen = screen;
+ egl_visualinfo = X11_XGetVisualInfo(display,
+ VisualScreenMask,
+ &vi_in, &out_count);
+ } else {
+ vi_in.screen = screen;
+ vi_in.visualid = visual_id;
+ egl_visualinfo = X11_XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &vi_in, &out_count);
+ }
+
+ return egl_visualinfo;
+}
+
+SDL_GLContext
+X11_GLES_CreateContext(_THIS, SDL_Window * window)
+{
+ SDL_GLContext context;
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ X11_XSync(display, False);
+ context = SDL_EGL_CreateContext(_this, data->egl_surface);
+ X11_XSync(display, False);
+
+ return context;
+}
+
+SDL_EGL_SwapWindow_impl(X11)
+SDL_EGL_MakeCurrent_impl(X11)
+
+#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.h
new file mode 100644
index 0000000..b189b76
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11opengles.h
@@ -0,0 +1,56 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11opengles_h_
+#define SDL_x11opengles_h_
+
+#if SDL_VIDEO_OPENGL_EGL
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+typedef struct SDL_PrivateGLESData
+{
+ /* 1401 If the struct-declaration-list contains no named members, the behavior is undefined. */
+ /* warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat] */
+ int dummy;
+} SDL_PrivateGLESData;
+
+/* OpenGLES functions */
+#define X11_GLES_GetAttribute SDL_EGL_GetAttribute
+#define X11_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define X11_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define X11_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define X11_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+#define X11_GLES_DeleteContext SDL_EGL_DeleteContext
+
+extern int X11_GLES_LoadLibrary(_THIS, const char *path);
+extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
+extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
+extern int X11_GLES_SwapWindow(_THIS, SDL_Window * window);
+extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+
+#endif /* SDL_VIDEO_OPENGL_EGL */
+
+#endif /* SDL_x11opengles_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11shape.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11shape.c
new file mode 100644
index 0000000..4d68fe0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11shape.c
@@ -0,0 +1,115 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_assert.h"
+#include "SDL_x11video.h"
+#include "SDL_x11shape.h"
+#include "SDL_x11window.h"
+#include "../SDL_shape_internals.h"
+
+SDL_WindowShaper*
+X11_CreateShaper(SDL_Window* window) {
+ SDL_WindowShaper* result = NULL;
+ SDL_ShapeData* data = NULL;
+ int resized_properly;
+
+#if SDL_VIDEO_DRIVER_X11_XSHAPE
+ if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */
+ result = malloc(sizeof(SDL_WindowShaper));
+ result->window = window;
+ result->mode.mode = ShapeModeDefault;
+ result->mode.parameters.binarizationCutoff = 1;
+ result->userx = result->usery = 0;
+ data = SDL_malloc(sizeof(SDL_ShapeData));
+ result->driverdata = data;
+ data->bitmapsize = 0;
+ data->bitmap = NULL;
+ window->shaper = result;
+ resized_properly = X11_ResizeWindowShape(window);
+ SDL_assert(resized_properly == 0);
+ }
+#endif
+
+ return result;
+}
+
+int
+X11_ResizeWindowShape(SDL_Window* window) {
+ SDL_ShapeData* data = window->shaper->driverdata;
+ unsigned int bitmapsize = window->w / 8;
+ SDL_assert(data != NULL);
+
+ if(window->w % 8 > 0)
+ bitmapsize += 1;
+ bitmapsize *= window->h;
+ if(data->bitmapsize != bitmapsize || data->bitmap == NULL) {
+ data->bitmapsize = bitmapsize;
+ if(data->bitmap != NULL)
+ free(data->bitmap);
+ data->bitmap = malloc(data->bitmapsize);
+ if(data->bitmap == NULL) {
+ return SDL_SetError("Could not allocate memory for shaped-window bitmap.");
+ }
+ }
+ memset(data->bitmap,0,data->bitmapsize);
+
+ window->shaper->userx = window->x;
+ window->shaper->usery = window->y;
+ SDL_SetWindowPosition(window,-1000,-1000);
+
+ return 0;
+}
+
+int
+X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
+ SDL_ShapeData *data = NULL;
+ SDL_WindowData *windowdata = NULL;
+ Pixmap shapemask;
+
+ if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
+ return -1;
+
+#if SDL_VIDEO_DRIVER_X11_XSHAPE
+ if(shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode))
+ return -2;
+ if(shape->w != shaper->window->w || shape->h != shaper->window->h)
+ return -3;
+ data = shaper->driverdata;
+
+ /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
+ SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8);
+
+ windowdata = (SDL_WindowData*)(shaper->window->driverdata);
+ shapemask = X11_XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
+
+ X11_XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet);
+ X11_XSync(windowdata->videodata->display,False);
+
+ X11_XFreePixmap(windowdata->videodata->display,shapemask);
+#endif
+
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11shape.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11shape.h
new file mode 100644
index 0000000..a8c2e2c
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11shape.h
@@ -0,0 +1,39 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11shape_h_
+#define SDL_x11shape_h_
+
+#include "SDL_video.h"
+#include "SDL_shape.h"
+#include "../SDL_sysvideo.h"
+
+typedef struct {
+ void* bitmap;
+ Uint32 bitmapsize;
+} SDL_ShapeData;
+
+extern SDL_WindowShaper* X11_CreateShaper(SDL_Window* window);
+extern int X11_ResizeWindowShape(SDL_Window* window);
+extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
+
+#endif /* SDL_x11shape_h_ */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11sym.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11sym.h
new file mode 100644
index 0000000..a07a030
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11sym.h
@@ -0,0 +1,337 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* *INDENT-OFF* */
+
+#ifndef SDL_X11_MODULE
+#define SDL_X11_MODULE(modname)
+#endif
+
+#ifndef SDL_X11_SYM
+#define SDL_X11_SYM(rc,fn,params,args,ret)
+#endif
+
+SDL_X11_MODULE(BASEXLIB)
+SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
+SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
+SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return)
+SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return)
+SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return)
+SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return)
+SDL_X11_SYM(int,XChangeProperty,(Display* a,Window b,Atom c,Atom d,int e,int f,_Xconst unsigned char* g,int h),(a,b,c,d,e,f,g,h),return)
+SDL_X11_SYM(Bool,XCheckIfEvent,(Display* a,XEvent *b,Bool (*c)(Display*,XEvent*,XPointer),XPointer d),(a,b,c,d),return)
+SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return)
+SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return)
+SDL_X11_SYM(int,XConvertSelection,(Display* a,Atom b,Atom c,Atom d,Window e,Time f),(a,b,c,d,e,f),return)
+SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char *data,unsigned int width,unsigned int height),(dpy,d,data,width,height),return)
+SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
+SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return)
+SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return)
+SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return)
+SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
+SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
+SDL_X11_SYM(int,XDefineCursor,(Display* a,Window b,Cursor c),(a,b,c),return)
+SDL_X11_SYM(int,XDeleteProperty,(Display* a,Window b,Atom c),(a,b,c),return)
+SDL_X11_SYM(int,XDestroyWindow,(Display* a,Window b),(a,b),return)
+SDL_X11_SYM(int,XDisplayKeycodes,(Display* a,int* b,int* c),(a,b,c),return)
+SDL_X11_SYM(int,XDrawRectangle,(Display* a,Drawable b,GC c,int d,int e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(char*,XDisplayName,(_Xconst char* a),(a),return)
+SDL_X11_SYM(int,XDrawString,(Display* a,Drawable b,GC c,int d,int e,_Xconst char* f,int g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(int,XEventsQueued,(Display* a,int b),(a,b),return)
+SDL_X11_SYM(int,XFillRectangle,(Display* a,Drawable b,GC c,int d,int e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(Bool,XFilterEvent,(XEvent *event,Window w),(event,w),return)
+SDL_X11_SYM(int,XFlush,(Display* a),(a),return)
+SDL_X11_SYM(int,XFree,(void*a),(a),return)
+SDL_X11_SYM(int,XFreeCursor,(Display* a,Cursor b),(a,b),return)
+SDL_X11_SYM(void,XFreeFontSet,(Display* a, XFontSet b),(a,b),)
+SDL_X11_SYM(int,XFreeGC,(Display* a,GC b),(a,b),return)
+SDL_X11_SYM(int,XFreeFont,(Display* a, XFontStruct* b),(a,b),return)
+SDL_X11_SYM(int,XFreeModifiermap,(XModifierKeymap* a),(a),return)
+SDL_X11_SYM(int,XFreePixmap,(Display* a,Pixmap b),(a,b),return)
+SDL_X11_SYM(void,XFreeStringList,(char** a),(a),)
+SDL_X11_SYM(char*,XGetAtomName,(Display *a,Atom b),(a,b),return)
+SDL_X11_SYM(int,XGetInputFocus,(Display *a,Window *b,int *c),(a,b,c),return)
+SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return)
+SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return)
+SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return)
+SDL_X11_SYM(Window,XGetSelectionOwner,(Display* a,Atom b),(a,b),return)
+SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return)
+SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return)
+SDL_X11_SYM(int,XGetWindowProperty,(Display* a,Window b,Atom c,long d,long e,Bool f,Atom g,Atom* h,int* i,unsigned long* j,unsigned long *k,unsigned char **l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
+SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return)
+SDL_X11_SYM(Status,XGetWMNormalHints,(Display *a,Window b, XSizeHints *c, long *d),(a,b,c,d),return)
+SDL_X11_SYM(int,XIfEvent,(Display* a,XEvent *b,Bool (*c)(Display*,XEvent*,XPointer),XPointer d),(a,b,c,d),return)
+SDL_X11_SYM(int,XGrabKeyboard,(Display* a,Window b,Bool c,int d,int e,Time f),(a,b,c,d,e,f),return)
+SDL_X11_SYM(int,XGrabPointer,(Display* a,Window b,Bool c,unsigned int d,int e,int f,Window g,Cursor h,Time i),(a,b,c,d,e,f,g,h,i),return)
+SDL_X11_SYM(int,XGrabServer,(Display* a),(a),return)
+SDL_X11_SYM(Status,XIconifyWindow,(Display* a,Window b,int c),(a,b,c),return)
+SDL_X11_SYM(KeyCode,XKeysymToKeycode,(Display* a,KeySym b),(a,b),return)
+SDL_X11_SYM(char*,XKeysymToString,(KeySym a),(a),return)
+SDL_X11_SYM(int,XInstallColormap,(Display* a,Colormap b),(a,b),return)
+SDL_X11_SYM(Atom,XInternAtom,(Display* a,_Xconst char* b,Bool c),(a,b,c),return)
+SDL_X11_SYM(XPixmapFormatValues*,XListPixmapFormats,(Display* a,int* b),(a,b),return)
+SDL_X11_SYM(XFontStruct*,XLoadQueryFont,(Display* a,_Xconst char* b),(a,b),return)
+SDL_X11_SYM(KeySym,XLookupKeysym,(XKeyEvent* a,int b),(a,b),return)
+SDL_X11_SYM(int,XLookupString,(XKeyEvent* a,char* b,int c,KeySym* d,XComposeStatus* e),(a,b,c,d,e),return)
+SDL_X11_SYM(int,XMapRaised,(Display* a,Window b),(a,b),return)
+SDL_X11_SYM(Status,XMatchVisualInfo,(Display* a,int b,int c,int d,XVisualInfo* e),(a,b,c,d,e),return)
+SDL_X11_SYM(int,XMissingExtension,(Display* a,_Xconst char* b),(a,b),return)
+SDL_X11_SYM(int,XMoveWindow,(Display* a,Window b,int c,int d),(a,b,c,d),return)
+SDL_X11_SYM(int,XNextEvent,(Display* a,XEvent* b),(a,b),return)
+SDL_X11_SYM(Display*,XOpenDisplay,(_Xconst char* a),(a),return)
+SDL_X11_SYM(Status,XInitThreads,(void),(),return)
+SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b),(a,b),return)
+SDL_X11_SYM(int,XPending,(Display* a),(a),return)
+SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j),(a,b,c,d,e,f,g,h,i,j),return)
+SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
+SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i),(a,b,c,d,e,f,g,h,i),return)
+SDL_X11_SYM(int,XRaiseWindow,(Display* a,Window b),(a,b),return)
+SDL_X11_SYM(int,XReparentWindow,(Display* a,Window b,Window c,int d,int e),(a,b,c,d,e),return)
+SDL_X11_SYM(int,XResetScreenSaver,(Display* a),(a),return)
+SDL_X11_SYM(int,XResizeWindow,(Display* a,Window b,unsigned int c,unsigned int d),(a,b,c,d),return)
+SDL_X11_SYM(int,XSelectInput,(Display* a,Window b,long c),(a,b,c),return)
+SDL_X11_SYM(Status,XSendEvent,(Display* a,Window b,Bool c,long d,XEvent* e),(a,b,c,d,e),return)
+SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return)
+SDL_X11_SYM(int,XSetForeground,(Display* a,GC b,unsigned long c),(a,b,c),return)
+SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return)
+SDL_X11_SYM(int,XSetInputFocus,(Display *a,Window b,int c,Time d),(a,b,c,d),return)
+SDL_X11_SYM(int,XSetSelectionOwner,(Display* a,Atom b,Window c,Time d),(a,b,c,d),return)
+SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return)
+SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),)
+SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return)
+SDL_X11_SYM(void,XSetWMProperties,(Display* a,Window b,XTextProperty* c,XTextProperty* d,char** e,int f,XSizeHints* g,XWMHints* h,XClassHint* i),(a,b,c,d,e,f,g,h,i),)
+SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
+SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
+SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
+SDL_X11_SYM(int,XStoreName,(Display* a,Window b,_Xconst char* c),(a,b,c),return)
+SDL_X11_SYM(Status,XStringListToTextProperty,(char** a,int b,XTextProperty* c),(a,b,c),return)
+SDL_X11_SYM(int,XSync,(Display* a,Bool b),(a,b),return)
+SDL_X11_SYM(int,XTextExtents,(XFontStruct* a,_Xconst char* b,int c,int* d,int* e,int* f,XCharStruct* g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(Bool,XTranslateCoordinates,(Display *a,Window b,Window c,int d,int e,int* f,int* g,Window* h),(a,b,c,d,e,f,g,h),return)
+SDL_X11_SYM(int,XUndefineCursor,(Display* a,Window b),(a,b),return)
+SDL_X11_SYM(int,XUngrabKeyboard,(Display* a,Time b),(a,b),return)
+SDL_X11_SYM(int,XUngrabPointer,(Display* a,Time b),(a,b),return)
+SDL_X11_SYM(int,XUngrabServer,(Display* a),(a),return)
+SDL_X11_SYM(int,XUninstallColormap,(Display* a,Colormap b),(a,b),return)
+SDL_X11_SYM(int,XUnloadFont,(Display* a,Font b),(a,b),return)
+SDL_X11_SYM(int,XWarpPointer,(Display* a,Window b,Window c,int d,int e,unsigned int f,unsigned int g,int h,int i),(a,b,c,d,e,f,g,h,i),return)
+SDL_X11_SYM(int,XWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return)
+SDL_X11_SYM(Status,XWithdrawWindow,(Display* a,Window b,int c),(a,b,c),return)
+SDL_X11_SYM(VisualID,XVisualIDFromVisual,(Visual* a),(a),return)
+#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
+SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
+#else
+SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
+#endif
+SDL_X11_SYM(XExtensionInfo*,XextCreateExtension,(void),(),return)
+SDL_X11_SYM(void,XextDestroyExtension,(XExtensionInfo* a),(a),)
+SDL_X11_SYM(XExtDisplayInfo*,XextFindDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
+SDL_X11_SYM(int,XextRemoveDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
+SDL_X11_SYM(Bool,XQueryExtension,(Display* a,_Xconst char* b,int* c,int* d,int* e),(a,b,c,d,e),return)
+SDL_X11_SYM(char *,XDisplayString,(Display* a),(a),return)
+SDL_X11_SYM(int,XGetErrorText,(Display* a,int b,char* c,int d),(a,b,c,d),return)
+SDL_X11_SYM(void,_XEatData,(Display* a,unsigned long b),(a,b),)
+SDL_X11_SYM(void,_XFlush,(Display* a),(a),)
+SDL_X11_SYM(void,_XFlushGCCache,(Display* a,GC b),(a,b),)
+SDL_X11_SYM(int,_XRead,(Display* a,char* b,long c),(a,b,c),return)
+SDL_X11_SYM(void,_XReadPad,(Display* a,char* b,long c),(a,b,c),)
+SDL_X11_SYM(void,_XSend,(Display* a,_Xconst char* b,long c),(a,b,c),)
+SDL_X11_SYM(Status,_XReply,(Display* a,xReply* b,int c,Bool d),(a,b,c,d),return)
+SDL_X11_SYM(unsigned long,_XSetLastRequestRead,(Display* a,xGenericReply* b),(a,b),return)
+SDL_X11_SYM(SDL_X11_XSynchronizeRetType,XSynchronize,(Display* a,Bool b),(a,b),return)
+SDL_X11_SYM(SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display* a,int b,SDL_X11_XESetWireToEventRetType c),(a,b,c),return)
+SDL_X11_SYM(SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display* a,int b,SDL_X11_XESetEventToWireRetType c),(a,b,c),return)
+SDL_X11_SYM(void,XRefreshKeyboardMapping,(XMappingEvent *a),(a),)
+SDL_X11_SYM(int,XQueryTree,(Display* a,Window b,Window* c,Window* d,Window** e,unsigned int* f),(a,b,c,d,e,f),return)
+
+#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
+SDL_X11_SYM(Bool,XGetEventData,(Display* a,XGenericEventCookie* b),(a,b),return)
+SDL_X11_SYM(void,XFreeEventData,(Display* a,XGenericEventCookie* b),(a,b),)
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+SDL_X11_SYM(Bool,XkbQueryExtension,(Display* a,int * b,int * c,int * d,int * e, int *f),(a,b,c,d,e,f),return)
+#if NeedWidePrototypes
+SDL_X11_SYM(KeySym,XkbKeycodeToKeysym,(Display* a,unsigned int b,int c,int d),(a,b,c,d),return)
+#else
+SDL_X11_SYM(KeySym,XkbKeycodeToKeysym,(Display* a,KeyCode b,int c,int d),(a,b,c,d),return)
+#endif
+SDL_X11_SYM(Status,XkbGetState,(Display* a,unsigned int b,XkbStatePtr c),(a,b,c),return)
+SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return)
+SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return)
+SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
+SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
+SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return)
+#endif
+
+#if NeedWidePrototypes
+SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,unsigned int b,int c),(a,b,c),return)
+#else
+SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,KeyCode b,int c),(a,b,c),return)
+#endif
+
+#ifdef X_HAVE_UTF8_STRING
+SDL_X11_MODULE(UTF8)
+SDL_X11_SYM(int,Xutf8TextListToTextProperty,(Display* a,char** b,int c,XICCEncodingStyle d,XTextProperty* e),(a,b,c,d,e),return)
+SDL_X11_SYM(int,Xutf8LookupString,(XIC a,XKeyPressedEvent* b,char* c,int d,KeySym* e,Status* f),(a,b,c,d,e,f),return)
+/* SDL_X11_SYM(XIC,XCreateIC,(XIM, ...),return) !!! ARGH! */
+SDL_X11_SYM(void,XDestroyIC,(XIC a),(a),)
+/* SDL_X11_SYM(char*,XGetICValues,(XIC, ...),return) !!! ARGH! */
+SDL_X11_SYM(void,XSetICFocus,(XIC a),(a),)
+SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),)
+SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return)
+SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return)
+SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),)
+SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return)
+SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return)
+SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return)
+#endif
+
+#ifndef NO_SHARED_MEMORY
+SDL_X11_MODULE(SHM)
+SDL_X11_SYM(Status,XShmAttach,(Display* a,XShmSegmentInfo* b),(a,b),return)
+SDL_X11_SYM(Status,XShmDetach,(Display* a,XShmSegmentInfo* b),(a,b),return)
+SDL_X11_SYM(Status,XShmPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j,Bool k),(a,b,c,d,e,f,g,h,i,j,k),return)
+SDL_X11_SYM(XImage*,XShmCreateImage,(Display* a,Visual* b,unsigned int c,int d,char* e,XShmSegmentInfo* f,unsigned int g,unsigned int h),(a,b,c,d,e,f,g,h),return)
+SDL_X11_SYM(Pixmap,XShmCreatePixmap,(Display *a,Drawable b,char* c,XShmSegmentInfo* d, unsigned int e, unsigned int f, unsigned int g),(a,b,c,d,e,f,g),return)
+SDL_X11_SYM(Bool,XShmQueryExtension,(Display* a),(a),return)
+#endif
+
+/*
+ * Not required...these only exist in code in headers on some 64-bit platforms,
+ * and are removed via macros elsewhere, so it's safe for them to be missing.
+ */
+#ifdef LONG64
+SDL_X11_MODULE(IO_32BIT)
+SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
+SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
+#endif
+
+/*
+ * These only show up on some variants of Unix.
+ */
+#if defined(__osf__)
+SDL_X11_MODULE(OSF_ENTRY_POINTS)
+SDL_X11_SYM(void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr p),(dpy,p),)
+SDL_X11_SYM(void,_SmtIpError,(Display *dpy,register smtDisplayPtr p,int i),(dpy,p,i),)
+SDL_X11_SYM(int,ipAllocateData,(ChannelPtr a,IPCard b,IPDataPtr * c),(a,b,c),return)
+SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return)
+#endif
+
+/* XCursor support */
+#if SDL_VIDEO_DRIVER_X11_XCURSOR
+SDL_X11_MODULE(XCURSOR)
+SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return)
+SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),)
+SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return)
+#endif
+
+/* Xdbe support */
+#if SDL_VIDEO_DRIVER_X11_XDBE
+SDL_X11_MODULE(XDBE)
+SDL_X11_SYM(Status,XdbeQueryExtension,(Display *dpy,int *major_version_return,int *minor_version_return),(dpy,major_version_return,minor_version_return),return)
+SDL_X11_SYM(XdbeBackBuffer,XdbeAllocateBackBufferName,(Display *dpy,Window window,XdbeSwapAction swap_action),(dpy,window,swap_action),return)
+SDL_X11_SYM(Status,XdbeDeallocateBackBufferName,(Display *dpy,XdbeBackBuffer buffer),(dpy,buffer),return)
+SDL_X11_SYM(Status,XdbeSwapBuffers,(Display *dpy,XdbeSwapInfo *swap_info,int num_windows),(dpy,swap_info,num_windows),return)
+SDL_X11_SYM(Status,XdbeBeginIdiom,(Display *dpy),(dpy),return)
+SDL_X11_SYM(Status,XdbeEndIdiom,(Display *dpy),(dpy),return)
+SDL_X11_SYM(XdbeScreenVisualInfo*,XdbeGetVisualInfo,(Display *dpy,Drawable *screen_specifiers,int *num_screens),(dpy,screen_specifiers,num_screens),return)
+SDL_X11_SYM(void,XdbeFreeVisualInfo,(XdbeScreenVisualInfo *visual_info),(visual_info),)
+SDL_X11_SYM(XdbeBackBufferAttributes*,XdbeGetBackBufferAttributes,(Display *dpy,XdbeBackBuffer buffer),(dpy,buffer),return)
+#endif
+
+/* Xinerama support */
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+SDL_X11_MODULE(XINERAMA)
+SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return)
+SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(Status,XineramaQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return)
+#endif
+
+/* XInput2 support for multiple mice, tablets, etc. */
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+SDL_X11_MODULE(XINPUT2)
+SDL_X11_SYM(XIDeviceInfo*,XIQueryDevice,(Display *a,int b,int *c),(a,b,c),return)
+SDL_X11_SYM(void,XIFreeDeviceInfo,(XIDeviceInfo *a),(a),)
+SDL_X11_SYM(int,XISelectEvents,(Display *a,Window b,XIEventMask *c,int d),(a,b,c,d),return)
+SDL_X11_SYM(Status,XIQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(XIEventMask*,XIGetSelectedEvents,(Display *a,Window b,int *c),(a,b,c),return)
+#endif
+
+/* XRandR support */
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+SDL_X11_MODULE(XRANDR)
+SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
+SDL_X11_SYM(XRRScreenConfiguration *,XRRGetScreenInfo,(Display *dpy,Drawable draw),(dpy,draw),return)
+SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRScreenConfiguration *config,Rotation *rotation),(config,rotation),return)
+SDL_X11_SYM(short,XRRConfigCurrentRate,(XRRScreenConfiguration *config),(config),return)
+SDL_X11_SYM(short *,XRRConfigRates,(XRRScreenConfiguration *config,int sizeID,int *nrates),(config,sizeID,nrates),return)
+SDL_X11_SYM(XRRScreenSize *,XRRConfigSizes,(XRRScreenConfiguration *config,int *nsizes),(config,nsizes),return)
+SDL_X11_SYM(Status,XRRSetScreenConfigAndRate,(Display *dpy,XRRScreenConfiguration *config,Drawable draw,int size_index,Rotation rotation,short rate,Time timestamp),(dpy,config,draw,size_index,rotation,rate,timestamp),return)
+SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(config),)
+SDL_X11_SYM(void,XRRSetScreenSize,(Display *dpy, Window window,int width, int height,int mmWidth, int mmHeight),(dpy,window,width,height,mmWidth,mmHeight),)
+SDL_X11_SYM(Status,XRRGetScreenSizeRange,(Display *dpy, Window window,int *minWidth, int *minHeight, int *maxWidth, int *maxHeight),(dpy,window,minWidth,minHeight,maxWidth,maxHeight),return)
+SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResources,(Display *dpy, Window window),(dpy, window),return)
+SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResourcesCurrent,(Display *dpy, Window window),(dpy, window),return)
+SDL_X11_SYM(void,XRRFreeScreenResources,(XRRScreenResources *resources),(resources),)
+SDL_X11_SYM(XRROutputInfo *,XRRGetOutputInfo,(Display *dpy, XRRScreenResources *resources, RROutput output),(dpy,resources,output),return)
+SDL_X11_SYM(void,XRRFreeOutputInfo,(XRROutputInfo *outputInfo),(outputInfo),)
+SDL_X11_SYM(XRRCrtcInfo *,XRRGetCrtcInfo,(Display *dpy, XRRScreenResources *resources, RRCrtc crtc),(dpy,resources,crtc),return)
+SDL_X11_SYM(void,XRRFreeCrtcInfo,(XRRCrtcInfo *crtcInfo),(crtcInfo),)
+SDL_X11_SYM(Status,XRRSetCrtcConfig,(Display *dpy, XRRScreenResources *resources, RRCrtc crtc, Time timestamp, int x, int y, RRMode mode, Rotation rotation, RROutput *outputs, int noutputs),(dpy,resources,crtc,timestamp,x,y,mode,rotation,outputs,noutputs),return)
+SDL_X11_SYM(Atom*,XRRListOutputProperties,(Display *dpy, RROutput output, int *nprop),(dpy,output,nprop),return)
+SDL_X11_SYM(XRRPropertyInfo*,XRRQueryOutputProperty,(Display *dpy,RROutput output, Atom property),(dpy,output,property),return)
+SDL_X11_SYM(int,XRRGetOutputProperty,(Display *dpy,RROutput output, Atom property, long offset, long length, Bool _delete, Bool pending, Atom req_type, Atom *actual_type, int *actual_format, unsigned long *nitems, unsigned long *bytes_after, unsigned char **prop),(dpy,output,property,offset,length, _delete, pending, req_type, actual_type, actual_format, nitems, bytes_after, prop),return)
+SDL_X11_SYM(RROutput,XRRGetOutputPrimary,(Display *dpy,Window window),(dpy,window),return)
+#endif
+
+/* MIT-SCREEN-SAVER support */
+#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
+SDL_X11_MODULE(XSS)
+SDL_X11_SYM(Bool,XScreenSaverQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return)
+SDL_X11_SYM(Status,XScreenSaverQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
+SDL_X11_SYM(void,XScreenSaverSuspend,(Display *dpy,Bool suspend),(dpy,suspend),return)
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XSHAPE
+SDL_X11_MODULE(XSHAPE)
+SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),)
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+SDL_X11_MODULE(XVIDMODE)
+SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),return)
+SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),return)
+SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),return)
+SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return)
+SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return)
+#endif
+
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11touch.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11touch.c
new file mode 100644
index 0000000..2d0e73b
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11touch.c
@@ -0,0 +1,54 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_x11video.h"
+#include "SDL_x11touch.h"
+#include "SDL_x11xinput2.h"
+#include "../../events/SDL_touch_c.h"
+
+
+void
+X11_InitTouch(_THIS)
+{
+ if (X11_Xinput2IsMultitouchSupported()) {
+ X11_InitXinput2Multitouch(_this);
+ }
+}
+
+void
+X11_QuitTouch(_THIS)
+{
+ SDL_TouchQuit();
+}
+
+void
+X11_ResetTouch(_THIS)
+{
+ X11_QuitTouch(_this);
+ X11_InitTouch(_this);
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11touch.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11touch.h
new file mode 100644
index 0000000..5a59af0
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11touch.h
@@ -0,0 +1,32 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11touch_h_
+#define SDL_x11touch_h_
+
+extern void X11_InitTouch(_THIS);
+extern void X11_QuitTouch(_THIS);
+extern void X11_ResetTouch(_THIS);
+
+#endif /* SDL_x11touch_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11video.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11video.c
new file mode 100644
index 0000000..b8f8edf
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11video.c
@@ -0,0 +1,496 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include <unistd.h> /* For getpid() and readlink() */
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_timer.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+
+#include "SDL_x11video.h"
+#include "SDL_x11framebuffer.h"
+#include "SDL_x11shape.h"
+#include "SDL_x11touch.h"
+#include "SDL_x11xinput2.h"
+
+#if SDL_VIDEO_OPENGL_EGL
+#include "SDL_x11opengles.h"
+#endif
+
+#include "SDL_x11vulkan.h"
+
+/* Initialization/Query functions */
+static int X11_VideoInit(_THIS);
+static void X11_VideoQuit(_THIS);
+
+/* Find out what class name we should use */
+static char *
+get_classname()
+{
+ char *spot;
+#if defined(__LINUX__) || defined(__FREEBSD__)
+ char procfile[1024];
+ char linkfile[1024];
+ int linksize;
+#endif
+
+ /* First allow environment variable override */
+ spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
+ if (spot) {
+ return SDL_strdup(spot);
+ }
+
+ /* Next look at the application's executable name */
+#if defined(__LINUX__) || defined(__FREEBSD__)
+#if defined(__LINUX__)
+ SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
+#elif defined(__FREEBSD__)
+ SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
+ getpid());
+#else
+#error Where can we find the executable name?
+#endif
+ linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
+ if (linksize > 0) {
+ linkfile[linksize] = '\0';
+ spot = SDL_strrchr(linkfile, '/');
+ if (spot) {
+ return SDL_strdup(spot + 1);
+ } else {
+ return SDL_strdup(linkfile);
+ }
+ }
+#endif /* __LINUX__ || __FREEBSD__ */
+
+ /* Finally use the default we've used forever */
+ return SDL_strdup("SDL_App");
+}
+
+/* X11 driver bootstrap functions */
+
+static int
+X11_Available(void)
+{
+ Display *display = NULL;
+ if (SDL_X11_LoadSymbols()) {
+ display = X11_XOpenDisplay(NULL);
+ if (display != NULL) {
+ X11_XCloseDisplay(display);
+ }
+ SDL_X11_UnloadSymbols();
+ }
+ return (display != NULL);
+}
+
+static void
+X11_DeleteDevice(SDL_VideoDevice * device)
+{
+ SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
+ if (device->vulkan_config.loader_handle) {
+ device->Vulkan_UnloadLibrary(device);
+ }
+ if (data->display) {
+ X11_XCloseDisplay(data->display);
+ }
+ SDL_free(data->windowlist);
+ SDL_free(device->driverdata);
+ SDL_free(device);
+
+ SDL_X11_UnloadSymbols();
+}
+
+/* An error handler to reset the vidmode and then call the default handler. */
+static SDL_bool safety_net_triggered = SDL_FALSE;
+static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
+static int
+X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
+{
+ SDL_VideoDevice *device = NULL;
+ /* if we trigger an error in our error handler, don't try again. */
+ if (!safety_net_triggered) {
+ safety_net_triggered = SDL_TRUE;
+ device = SDL_GetVideoDevice();
+ if (device != NULL) {
+ int i;
+ for (i = 0; i < device->num_displays; i++) {
+ SDL_VideoDisplay *display = &device->displays[i];
+ if (SDL_memcmp(&display->current_mode, &display->desktop_mode,
+ sizeof (SDL_DisplayMode)) != 0) {
+ X11_SetDisplayMode(device, display, &display->desktop_mode);
+ }
+ }
+ }
+ }
+
+ if (orig_x11_errhandler != NULL) {
+ return orig_x11_errhandler(d, e); /* probably terminate. */
+ }
+
+ return 0;
+}
+
+static SDL_VideoDevice *
+X11_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *data;
+ const char *display = NULL; /* Use the DISPLAY environment variable */
+
+ if (!SDL_X11_LoadSymbols()) {
+ return NULL;
+ }
+
+ /* Need for threading gl calls. This is also required for the proprietary
+ nVidia driver to be threaded. */
+ X11_XInitThreads();
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (!device) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (!data) {
+ SDL_free(device);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ device->driverdata = data;
+
+ data->global_mouse_changed = SDL_TRUE;
+
+ /* FIXME: Do we need this?
+ if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) ||
+ (SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) {
+ local_X11 = 1;
+ } else {
+ local_X11 = 0;
+ }
+ */
+ data->display = X11_XOpenDisplay(display);
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+ /* On some systems if linking without -lX11, it fails and you get following message.
+ * Xlib: connection to ":0.0" refused by server
+ * Xlib: XDM authorization key matches an existing client!
+ *
+ * It succeeds if retrying 1 second later
+ * or if running xhost +localhost on shell.
+ */
+ if (data->display == NULL) {
+ SDL_Delay(1000);
+ data->display = X11_XOpenDisplay(display);
+ }
+#endif
+ if (data->display == NULL) {
+ SDL_free(device->driverdata);
+ SDL_free(device);
+ SDL_SetError("Couldn't open X11 display");
+ return NULL;
+ }
+#ifdef X11_DEBUG
+ X11_XSynchronize(data->display, True);
+#endif
+
+ /* Hook up an X11 error handler to recover the desktop resolution. */
+ safety_net_triggered = SDL_FALSE;
+ orig_x11_errhandler = X11_XSetErrorHandler(X11_SafetyNetErrHandler);
+
+ /* Set the function pointers */
+ device->VideoInit = X11_VideoInit;
+ device->VideoQuit = X11_VideoQuit;
+ device->ResetTouch = X11_ResetTouch;
+ device->GetDisplayModes = X11_GetDisplayModes;
+ device->GetDisplayBounds = X11_GetDisplayBounds;
+ device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds;
+ device->GetDisplayDPI = X11_GetDisplayDPI;
+ device->SetDisplayMode = X11_SetDisplayMode;
+ device->SuspendScreenSaver = X11_SuspendScreenSaver;
+ device->PumpEvents = X11_PumpEvents;
+
+ device->CreateSDLWindow = X11_CreateWindow;
+ device->CreateSDLWindowFrom = X11_CreateWindowFrom;
+ device->SetWindowTitle = X11_SetWindowTitle;
+ device->SetWindowIcon = X11_SetWindowIcon;
+ device->SetWindowPosition = X11_SetWindowPosition;
+ device->SetWindowSize = X11_SetWindowSize;
+ device->SetWindowMinimumSize = X11_SetWindowMinimumSize;
+ device->SetWindowMaximumSize = X11_SetWindowMaximumSize;
+ device->GetWindowBordersSize = X11_GetWindowBordersSize;
+ device->SetWindowOpacity = X11_SetWindowOpacity;
+ device->SetWindowModalFor = X11_SetWindowModalFor;
+ device->SetWindowInputFocus = X11_SetWindowInputFocus;
+ device->ShowWindow = X11_ShowWindow;
+ device->HideWindow = X11_HideWindow;
+ device->RaiseWindow = X11_RaiseWindow;
+ device->MaximizeWindow = X11_MaximizeWindow;
+ device->MinimizeWindow = X11_MinimizeWindow;
+ device->RestoreWindow = X11_RestoreWindow;
+ device->SetWindowBordered = X11_SetWindowBordered;
+ device->SetWindowResizable = X11_SetWindowResizable;
+ device->SetWindowFullscreen = X11_SetWindowFullscreen;
+ device->SetWindowGammaRamp = X11_SetWindowGammaRamp;
+ device->SetWindowGrab = X11_SetWindowGrab;
+ device->DestroyWindow = X11_DestroyWindow;
+ device->CreateWindowFramebuffer = X11_CreateWindowFramebuffer;
+ device->UpdateWindowFramebuffer = X11_UpdateWindowFramebuffer;
+ device->DestroyWindowFramebuffer = X11_DestroyWindowFramebuffer;
+ device->GetWindowWMInfo = X11_GetWindowWMInfo;
+ device->SetWindowHitTest = X11_SetWindowHitTest;
+
+ device->shape_driver.CreateShaper = X11_CreateShaper;
+ device->shape_driver.SetWindowShape = X11_SetWindowShape;
+ device->shape_driver.ResizeWindowShape = X11_ResizeWindowShape;
+
+#if SDL_VIDEO_OPENGL_GLX
+ device->GL_LoadLibrary = X11_GL_LoadLibrary;
+ device->GL_GetProcAddress = X11_GL_GetProcAddress;
+ device->GL_UnloadLibrary = X11_GL_UnloadLibrary;
+ device->GL_CreateContext = X11_GL_CreateContext;
+ device->GL_MakeCurrent = X11_GL_MakeCurrent;
+ device->GL_SetSwapInterval = X11_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
+ device->GL_SwapWindow = X11_GL_SwapWindow;
+ device->GL_DeleteContext = X11_GL_DeleteContext;
+#elif SDL_VIDEO_OPENGL_EGL
+ device->GL_LoadLibrary = X11_GLES_LoadLibrary;
+ device->GL_GetProcAddress = X11_GLES_GetProcAddress;
+ device->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
+ device->GL_CreateContext = X11_GLES_CreateContext;
+ device->GL_MakeCurrent = X11_GLES_MakeCurrent;
+ device->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
+ device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
+ device->GL_SwapWindow = X11_GLES_SwapWindow;
+ device->GL_DeleteContext = X11_GLES_DeleteContext;
+#endif
+
+ device->SetClipboardText = X11_SetClipboardText;
+ device->GetClipboardText = X11_GetClipboardText;
+ device->HasClipboardText = X11_HasClipboardText;
+ device->StartTextInput = X11_StartTextInput;
+ device->StopTextInput = X11_StopTextInput;
+ device->SetTextInputRect = X11_SetTextInputRect;
+
+ device->free = X11_DeleteDevice;
+
+#if SDL_VIDEO_VULKAN
+ device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary;
+ device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary;
+ device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions;
+ device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface;
+#endif
+
+ return device;
+}
+
+VideoBootStrap X11_bootstrap = {
+ "x11", "SDL X11 video driver",
+ X11_Available, X11_CreateDevice
+};
+
+static int (*handler) (Display *, XErrorEvent *) = NULL;
+static int
+X11_CheckWindowManagerErrorHandler(Display * d, XErrorEvent * e)
+{
+ if (e->error_code == BadWindow) {
+ return (0);
+ } else {
+ return (handler(d, e));
+ }
+}
+
+static void
+X11_CheckWindowManager(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ Display *display = data->display;
+ Atom _NET_SUPPORTING_WM_CHECK;
+ int status, real_format;
+ Atom real_type;
+ unsigned long items_read = 0, items_left = 0;
+ unsigned char *propdata = NULL;
+ Window wm_window = 0;
+#ifdef DEBUG_WINDOW_MANAGER
+ char *wm_name;
+#endif
+
+ /* Set up a handler to gracefully catch errors */
+ X11_XSync(display, False);
+ handler = X11_XSetErrorHandler(X11_CheckWindowManagerErrorHandler);
+
+ _NET_SUPPORTING_WM_CHECK = X11_XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
+ status = X11_XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
+ if (status == Success) {
+ if (items_read) {
+ wm_window = ((Window*)propdata)[0];
+ }
+ if (propdata) {
+ X11_XFree(propdata);
+ propdata = NULL;
+ }
+ }
+
+ if (wm_window) {
+ status = X11_XGetWindowProperty(display, wm_window, _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
+ if (status != Success || !items_read || wm_window != ((Window*)propdata)[0]) {
+ wm_window = None;
+ }
+ if (status == Success && propdata) {
+ X11_XFree(propdata);
+ propdata = NULL;
+ }
+ }
+
+ /* Reset the error handler, we're done checking */
+ X11_XSync(display, False);
+ X11_XSetErrorHandler(handler);
+
+ if (!wm_window) {
+#ifdef DEBUG_WINDOW_MANAGER
+ printf("Couldn't get _NET_SUPPORTING_WM_CHECK property\n");
+#endif
+ return;
+ }
+ data->net_wm = SDL_TRUE;
+
+#ifdef DEBUG_WINDOW_MANAGER
+ wm_name = X11_GetWindowTitle(_this, wm_window);
+ printf("Window manager: %s\n", wm_name);
+ SDL_free(wm_name);
+#endif
+}
+
+
+int
+X11_VideoInit(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ /* Get the window class name, usually the name of the application */
+ data->classname = get_classname();
+
+ /* Get the process PID to be associated to the window */
+ data->pid = getpid();
+
+ /* I have no idea how random this actually is, or has to be. */
+ data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
+
+ /* Look up some useful Atoms */
+#define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False)
+ GET_ATOM(WM_PROTOCOLS);
+ GET_ATOM(WM_DELETE_WINDOW);
+ GET_ATOM(WM_TAKE_FOCUS);
+ GET_ATOM(_NET_WM_STATE);
+ GET_ATOM(_NET_WM_STATE_HIDDEN);
+ GET_ATOM(_NET_WM_STATE_FOCUSED);
+ GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT);
+ GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ);
+ GET_ATOM(_NET_WM_STATE_FULLSCREEN);
+ GET_ATOM(_NET_WM_STATE_ABOVE);
+ GET_ATOM(_NET_WM_STATE_SKIP_TASKBAR);
+ GET_ATOM(_NET_WM_STATE_SKIP_PAGER);
+ GET_ATOM(_NET_WM_ALLOWED_ACTIONS);
+ GET_ATOM(_NET_WM_ACTION_FULLSCREEN);
+ GET_ATOM(_NET_WM_NAME);
+ GET_ATOM(_NET_WM_ICON_NAME);
+ GET_ATOM(_NET_WM_ICON);
+ GET_ATOM(_NET_WM_PING);
+ GET_ATOM(_NET_WM_WINDOW_OPACITY);
+ GET_ATOM(_NET_WM_USER_TIME);
+ GET_ATOM(_NET_ACTIVE_WINDOW);
+ GET_ATOM(_NET_FRAME_EXTENTS);
+ GET_ATOM(UTF8_STRING);
+ GET_ATOM(PRIMARY);
+ GET_ATOM(XdndEnter);
+ GET_ATOM(XdndPosition);
+ GET_ATOM(XdndStatus);
+ GET_ATOM(XdndTypeList);
+ GET_ATOM(XdndActionCopy);
+ GET_ATOM(XdndDrop);
+ GET_ATOM(XdndFinished);
+ GET_ATOM(XdndSelection);
+ GET_ATOM(XKLAVIER_STATE);
+
+ /* Detect the window manager */
+ X11_CheckWindowManager(_this);
+
+ if (X11_InitModes(_this) < 0) {
+ return -1;
+ }
+
+ X11_InitXinput2(_this);
+
+ if (X11_InitKeyboard(_this) != 0) {
+ return -1;
+ }
+ X11_InitMouse(_this);
+
+ X11_InitTouch(_this);
+
+#if SDL_USE_LIBDBUS
+ SDL_DBus_Init();
+#endif
+
+ return 0;
+}
+
+void
+X11_VideoQuit(_THIS)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ if (data->clipboard_window) {
+ X11_XDestroyWindow(data->display, data->clipboard_window);
+ }
+
+ SDL_free(data->classname);
+#ifdef X_HAVE_UTF8_STRING
+ if (data->im) {
+ X11_XCloseIM(data->im);
+ }
+#endif
+
+ X11_QuitModes(_this);
+ X11_QuitKeyboard(_this);
+ X11_QuitMouse(_this);
+ X11_QuitTouch(_this);
+
+/* !!! FIXME: other subsystems use D-Bus, so we shouldn't quit it here;
+ have SDL.c do this at a higher level, or add refcounting. */
+#if SDL_USE_LIBDBUS
+ SDL_DBus_Quit();
+#endif
+}
+
+SDL_bool
+X11_UseDirectColorVisuals(void)
+{
+ return SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ? SDL_FALSE : SDL_TRUE;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11video.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11video.h
new file mode 100644
index 0000000..c0dc08e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11video.h
@@ -0,0 +1,156 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11video_h_
+#define SDL_x11video_h_
+
+#include "SDL_keycode.h"
+
+#include "../SDL_sysvideo.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#if SDL_VIDEO_DRIVER_X11_XCURSOR
+#include <X11/Xcursor/Xcursor.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XDBE
+#include <X11/extensions/Xdbe.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+#include <X11/extensions/XInput2.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
+#include <X11/extensions/scrnsaver.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XSHAPE
+#include <X11/extensions/shape.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+#include <X11/extensions/xf86vmode.h>
+#endif
+
+#include "../../core/linux/SDL_dbus.h"
+#include "../../core/linux/SDL_ime.h"
+
+#include "SDL_x11dyn.h"
+
+#include "SDL_x11clipboard.h"
+#include "SDL_x11events.h"
+#include "SDL_x11keyboard.h"
+#include "SDL_x11modes.h"
+#include "SDL_x11mouse.h"
+#include "SDL_x11opengl.h"
+#include "SDL_x11window.h"
+#include "SDL_x11vulkan.h"
+
+/* Private display data */
+
+typedef struct SDL_VideoData
+{
+ Display *display;
+ char *classname;
+ pid_t pid;
+ XIM im;
+ Uint32 screensaver_activity;
+ int numwindows;
+ SDL_WindowData **windowlist;
+ int windowlistlength;
+ XID window_group;
+ Window clipboard_window;
+
+ /* This is true for ICCCM2.0-compliant window managers */
+ SDL_bool net_wm;
+
+ /* Useful atoms */
+ Atom WM_PROTOCOLS;
+ Atom WM_DELETE_WINDOW;
+ Atom WM_TAKE_FOCUS;
+ Atom _NET_WM_STATE;
+ Atom _NET_WM_STATE_HIDDEN;
+ Atom _NET_WM_STATE_FOCUSED;
+ Atom _NET_WM_STATE_MAXIMIZED_VERT;
+ Atom _NET_WM_STATE_MAXIMIZED_HORZ;
+ Atom _NET_WM_STATE_FULLSCREEN;
+ Atom _NET_WM_STATE_ABOVE;
+ Atom _NET_WM_STATE_SKIP_TASKBAR;
+ Atom _NET_WM_STATE_SKIP_PAGER;
+ Atom _NET_WM_ALLOWED_ACTIONS;
+ Atom _NET_WM_ACTION_FULLSCREEN;
+ Atom _NET_WM_NAME;
+ Atom _NET_WM_ICON_NAME;
+ Atom _NET_WM_ICON;
+ Atom _NET_WM_PING;
+ Atom _NET_WM_WINDOW_OPACITY;
+ Atom _NET_WM_USER_TIME;
+ Atom _NET_ACTIVE_WINDOW;
+ Atom _NET_FRAME_EXTENTS;
+ Atom UTF8_STRING;
+ Atom PRIMARY;
+ Atom XdndEnter;
+ Atom XdndPosition;
+ Atom XdndStatus;
+ Atom XdndTypeList;
+ Atom XdndActionCopy;
+ Atom XdndDrop;
+ Atom XdndFinished;
+ Atom XdndSelection;
+ Atom XKLAVIER_STATE;
+
+ SDL_Scancode key_layout[256];
+ SDL_bool selection_waiting;
+
+ SDL_bool broken_pointer_grab; /* true if XGrabPointer seems unreliable. */
+
+ Uint32 last_mode_change_deadline;
+
+ SDL_bool global_mouse_changed;
+ SDL_Point global_mouse_position;
+ Uint32 global_mouse_buttons;
+
+#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
+ XkbDescPtr xkb;
+#endif
+
+ KeyCode filter_code;
+ Time filter_time;
+
+#if SDL_VIDEO_VULKAN
+ /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */
+ void *vulkan_xlib_xcb_library;
+ PFN_XGetXCBConnection vulkan_XGetXCBConnection;
+#endif
+
+} SDL_VideoData;
+
+extern SDL_bool X11_UseDirectColorVisuals(void);
+
+#endif /* SDL_x11video_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.c
new file mode 100644
index 0000000..ec43aef
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.c
@@ -0,0 +1,243 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11
+
+#include "SDL_x11video.h"
+#include "SDL_assert.h"
+
+#include "SDL_loadso.h"
+#include "SDL_x11vulkan.h"
+
+#include <X11/Xlib.h>
+/*#include <xcb/xcb.h>*/
+/*
+typedef uint32_t xcb_window_t;
+typedef uint32_t xcb_visualid_t;
+*/
+
+int X11_Vulkan_LoadLibrary(_THIS, const char *path)
+{
+ SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
+ VkExtensionProperties *extensions = NULL;
+ Uint32 extensionCount = 0;
+ SDL_bool hasSurfaceExtension = SDL_FALSE;
+ SDL_bool hasXlibSurfaceExtension = SDL_FALSE;
+ SDL_bool hasXCBSurfaceExtension = SDL_FALSE;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
+ Uint32 i;
+ if(_this->vulkan_config.loader_handle)
+ return SDL_SetError("Vulkan already loaded");
+
+ /* Load the Vulkan loader library */
+ if(!path)
+ path = SDL_getenv("SDL_VULKAN_LIBRARY");
+ if(!path)
+ path = "libvulkan.so.1";
+ _this->vulkan_config.loader_handle = SDL_LoadObject(path);
+ if(!_this->vulkan_config.loader_handle)
+ return -1;
+ SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path));
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ if(!vkGetInstanceProcAddr)
+ goto fail;
+ _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
+ (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
+ goto fail;
+ extensions = SDL_Vulkan_CreateInstanceExtensionsList(
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
+ &extensionCount);
+ if(!extensions)
+ goto fail;
+ for(i = 0; i < extensionCount; i++)
+ {
+ if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasSurfaceExtension = SDL_TRUE;
+ else if(SDL_strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasXCBSurfaceExtension = SDL_TRUE;
+ else if(SDL_strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
+ hasXlibSurfaceExtension = SDL_TRUE;
+ }
+ SDL_free(extensions);
+ if(!hasSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement the "
+ VK_KHR_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ }
+ if(hasXlibSurfaceExtension)
+ {
+ videoData->vulkan_xlib_xcb_library = NULL;
+ }
+ else if(!hasXCBSurfaceExtension)
+ {
+ SDL_SetError("Installed Vulkan doesn't implement either the "
+ VK_KHR_XCB_SURFACE_EXTENSION_NAME "extension or the "
+ VK_KHR_XLIB_SURFACE_EXTENSION_NAME " extension");
+ goto fail;
+ }
+ else
+ {
+ const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY");
+ if(!libX11XCBLibraryName)
+ libX11XCBLibraryName = "libX11-xcb.so";
+ videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName);
+ if(!videoData->vulkan_xlib_xcb_library)
+ goto fail;
+ videoData->vulkan_XGetXCBConnection =
+ SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection");
+ if(!videoData->vulkan_XGetXCBConnection)
+ {
+ SDL_UnloadObject(videoData->vulkan_xlib_xcb_library);
+ goto fail;
+ }
+ }
+ return 0;
+
+fail:
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ return -1;
+}
+
+void X11_Vulkan_UnloadLibrary(_THIS)
+{
+ SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
+ if(_this->vulkan_config.loader_handle)
+ {
+ if(videoData->vulkan_xlib_xcb_library)
+ SDL_UnloadObject(videoData->vulkan_xlib_xcb_library);
+ SDL_UnloadObject(_this->vulkan_config.loader_handle);
+ _this->vulkan_config.loader_handle = NULL;
+ }
+}
+
+SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names)
+{
+ SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ if(videoData->vulkan_xlib_xcb_library)
+ {
+ static const char *const extensionsForXCB[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME,
+ };
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB);
+ }
+ else
+ {
+ static const char *const extensionsForXlib[] = {
+ VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
+ };
+ return SDL_Vulkan_GetInstanceExtensions_Helper(
+ count, names, SDL_arraysize(extensionsForXlib), extensionsForXlib);
+ }
+}
+
+SDL_bool X11_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface)
+{
+ SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata;
+ SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
+ if(!_this->vulkan_config.loader_handle)
+ {
+ SDL_SetError("Vulkan is not loaded");
+ return SDL_FALSE;
+ }
+ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
+ if(videoData->vulkan_xlib_xcb_library)
+ {
+ PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
+ (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
+ "vkCreateXcbSurfaceKHR");
+ VkXcbSurfaceCreateInfoKHR createInfo;
+ VkResult result;
+ if(!vkCreateXcbSurfaceKHR)
+ {
+ SDL_SetError(VK_KHR_XCB_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ SDL_zero(createInfo);
+ createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
+ createInfo.connection = videoData->vulkan_XGetXCBConnection(videoData->display);
+ if(!createInfo.connection)
+ {
+ SDL_SetError("XGetXCBConnection failed");
+ return SDL_FALSE;
+ }
+ createInfo.window = (xcb_window_t)windowData->xwindow;
+ result = vkCreateXcbSurfaceKHR(instance, &createInfo,
+ NULL, surface);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError("vkCreateXcbSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+ }
+ else
+ {
+ PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
+ (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
+ "vkCreateXlibSurfaceKHR");
+ VkXlibSurfaceCreateInfoKHR createInfo;
+ VkResult result;
+ if(!vkCreateXlibSurfaceKHR)
+ {
+ SDL_SetError(VK_KHR_XLIB_SURFACE_EXTENSION_NAME
+ " extension is not enabled in the Vulkan instance.");
+ return SDL_FALSE;
+ }
+ SDL_zero(createInfo);
+ createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
+ createInfo.dpy = videoData->display;
+ createInfo.window = (xcb_window_t)windowData->xwindow;
+ result = vkCreateXlibSurfaceKHR(instance, &createInfo,
+ NULL, surface);
+ if(result != VK_SUCCESS)
+ {
+ SDL_SetError("vkCreateXlibSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result));
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+ }
+}
+
+#endif
+
+/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.h
new file mode 100644
index 0000000..152d9d7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11vulkan.h
@@ -0,0 +1,48 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11vulkan_h_
+#define SDL_x11vulkan_h_
+
+#include "../SDL_vulkan_internal.h"
+
+#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11
+
+/*typedef struct xcb_connection_t xcb_connection_t;*/
+typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy);
+
+int X11_Vulkan_LoadLibrary(_THIS, const char *path);
+void X11_Vulkan_UnloadLibrary(_THIS);
+SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS,
+ SDL_Window *window,
+ unsigned *count,
+ const char **names);
+SDL_bool X11_Vulkan_CreateSurface(_THIS,
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR *surface);
+
+#endif
+
+#endif /* SDL_x11vulkan_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11window.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11window.c
new file mode 100644
index 0000000..be03aa6
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11window.c
@@ -0,0 +1,1609 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_assert.h"
+#include "SDL_hints.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "../../events/SDL_mouse_c.h"
+
+#include "SDL_x11video.h"
+#include "SDL_x11mouse.h"
+#include "SDL_x11shape.h"
+#include "SDL_x11xinput2.h"
+
+#if SDL_VIDEO_OPENGL_EGL
+#include "SDL_x11opengles.h"
+#endif
+
+#include "SDL_timer.h"
+#include "SDL_syswm.h"
+#include "SDL_log.h"
+
+#define _NET_WM_STATE_REMOVE 0l
+#define _NET_WM_STATE_ADD 1l
+
+static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win)
+{
+ return ev->type == MapNotify && ev->xmap.window == *((Window*)win);
+}
+static Bool isUnmapNotify(Display *dpy, XEvent *ev, XPointer win)
+{
+ return ev->type == UnmapNotify && ev->xunmap.window == *((Window*)win);
+}
+
+/*
+static Bool isConfigureNotify(Display *dpy, XEvent *ev, XPointer win)
+{
+ return ev->type == ConfigureNotify && ev->xconfigure.window == *((Window*)win);
+}
+static Bool
+X11_XIfEventTimeout(Display *display, XEvent *event_return, Bool (*predicate)(), XPointer arg, int timeoutMS)
+{
+ Uint32 start = SDL_GetTicks();
+
+ while (!X11_XCheckIfEvent(display, event_return, predicate, arg)) {
+ if (SDL_TICKS_PASSED(SDL_GetTicks(), start + timeoutMS)) {
+ return False;
+ }
+ }
+ return True;
+}
+*/
+
+static SDL_bool
+X11_IsWindowLegacyFullscreen(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ return (data->fswindow != 0);
+}
+
+static SDL_bool
+X11_IsWindowMapped(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ XWindowAttributes attr;
+
+ X11_XGetWindowAttributes(videodata->display, data->xwindow, &attr);
+ if (attr.map_state != IsUnmapped) {
+ return SDL_TRUE;
+ } else {
+ return SDL_FALSE;
+ }
+}
+
+#if 0
+static SDL_bool
+X11_IsActionAllowed(SDL_Window *window, Atom action)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Atom _NET_WM_ALLOWED_ACTIONS = data->videodata->_NET_WM_ALLOWED_ACTIONS;
+ Atom type;
+ Display *display = data->videodata->display;
+ int form;
+ unsigned long remain;
+ unsigned long len, i;
+ Atom *list;
+ SDL_bool ret = SDL_FALSE;
+
+ if (X11_XGetWindowProperty(display, data->xwindow, _NET_WM_ALLOWED_ACTIONS, 0, 1024, False, XA_ATOM, &type, &form, &len, &remain, (unsigned char **)&list) == Success)
+ {
+ for (i=0; i<len; ++i)
+ {
+ if (list[i] == action) {
+ ret = SDL_TRUE;
+ break;
+ }
+ }
+ X11_XFree(list);
+ }
+ return ret;
+}
+#endif /* 0 */
+
+void
+X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ Display *display = videodata->display;
+ /* !!! FIXME: just dereference videodata below instead of copying to locals. */
+ Atom _NET_WM_STATE = videodata->_NET_WM_STATE;
+ /* Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN; */
+ Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED;
+ Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT;
+ Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
+ Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN;
+ Atom _NET_WM_STATE_ABOVE = videodata->_NET_WM_STATE_ABOVE;
+ Atom _NET_WM_STATE_SKIP_TASKBAR = videodata->_NET_WM_STATE_SKIP_TASKBAR;
+ Atom _NET_WM_STATE_SKIP_PAGER = videodata->_NET_WM_STATE_SKIP_PAGER;
+ Atom atoms[16];
+ int count = 0;
+
+ /* The window manager sets this property, we shouldn't set it.
+ If we did, this would indicate to the window manager that we don't
+ actually want to be mapped during X11_XMapRaised(), which would be bad.
+ *
+ if (flags & SDL_WINDOW_HIDDEN) {
+ atoms[count++] = _NET_WM_STATE_HIDDEN;
+ }
+ */
+
+ if (flags & SDL_WINDOW_ALWAYS_ON_TOP) {
+ atoms[count++] = _NET_WM_STATE_ABOVE;
+ }
+ if (flags & SDL_WINDOW_SKIP_TASKBAR) {
+ atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR;
+ atoms[count++] = _NET_WM_STATE_SKIP_PAGER;
+ }
+ if (flags & SDL_WINDOW_INPUT_FOCUS) {
+ atoms[count++] = _NET_WM_STATE_FOCUSED;
+ }
+ if (flags & SDL_WINDOW_MAXIMIZED) {
+ atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT;
+ atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
+ }
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ atoms[count++] = _NET_WM_STATE_FULLSCREEN;
+ }
+
+ SDL_assert(count <= SDL_arraysize(atoms));
+
+ if (count > 0) {
+ X11_XChangeProperty(display, xwindow, _NET_WM_STATE, XA_ATOM, 32,
+ PropModeReplace, (unsigned char *)atoms, count);
+ } else {
+ X11_XDeleteProperty(display, xwindow, _NET_WM_STATE);
+ }
+}
+
+Uint32
+X11_GetNetWMState(_THIS, Window xwindow)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ Display *display = videodata->display;
+ Atom _NET_WM_STATE = videodata->_NET_WM_STATE;
+ Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN;
+ Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED;
+ Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT;
+ Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
+ Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN;
+ Atom actualType;
+ int actualFormat;
+ unsigned long i, numItems, bytesAfter;
+ unsigned char *propertyValue = NULL;
+ long maxLength = 1024;
+ Uint32 flags = 0;
+
+ if (X11_XGetWindowProperty(display, xwindow, _NET_WM_STATE,
+ 0l, maxLength, False, XA_ATOM, &actualType,
+ &actualFormat, &numItems, &bytesAfter,
+ &propertyValue) == Success) {
+ Atom *atoms = (Atom *) propertyValue;
+ int maximized = 0;
+ int fullscreen = 0;
+
+ for (i = 0; i < numItems; ++i) {
+ if (atoms[i] == _NET_WM_STATE_HIDDEN) {
+ flags |= SDL_WINDOW_HIDDEN;
+ } else if (atoms[i] == _NET_WM_STATE_FOCUSED) {
+ flags |= SDL_WINDOW_INPUT_FOCUS;
+ } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
+ maximized |= 1;
+ } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
+ maximized |= 2;
+ } else if ( atoms[i] == _NET_WM_STATE_FULLSCREEN) {
+ fullscreen = 1;
+ }
+ }
+ if (maximized == 3) {
+ flags |= SDL_WINDOW_MAXIMIZED;
+ }
+
+ if (fullscreen == 1) {
+ flags |= SDL_WINDOW_FULLSCREEN;
+ }
+
+ /* If the window is unmapped, numItems will be zero and _NET_WM_STATE_HIDDEN
+ * will not be set. Do an additional check to see if the window is unmapped
+ * and mark it as SDL_WINDOW_HIDDEN if it is.
+ */
+ {
+ XWindowAttributes attr;
+ SDL_memset(&attr,0,sizeof(attr));
+ X11_XGetWindowAttributes(videodata->display, xwindow, &attr);
+ if (attr.map_state == IsUnmapped) {
+ flags |= SDL_WINDOW_HIDDEN;
+ }
+ }
+ X11_XFree(propertyValue);
+ }
+
+ /* FIXME, check the size hints for resizable */
+ /* flags |= SDL_WINDOW_RESIZABLE; */
+
+ return flags;
+}
+
+static int
+SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
+{
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ SDL_WindowData *data;
+ int numwindows = videodata->numwindows;
+ int windowlistlength = videodata->windowlistlength;
+ SDL_WindowData **windowlist = videodata->windowlist;
+
+ /* Allocate the window data */
+ data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
+ if (!data) {
+ return SDL_OutOfMemory();
+ }
+ data->window = window;
+ data->xwindow = w;
+#ifdef X_HAVE_UTF8_STRING
+ if (SDL_X11_HAVE_UTF8 && videodata->im) {
+ data->ic =
+ X11_XCreateIC(videodata->im, XNClientWindow, w, XNFocusWindow, w,
+ XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
+ NULL);
+ }
+#endif
+ data->created = created;
+ data->videodata = videodata;
+
+ /* Associate the data with the window */
+
+ if (numwindows < windowlistlength) {
+ windowlist[numwindows] = data;
+ videodata->numwindows++;
+ } else {
+ windowlist =
+ (SDL_WindowData **) SDL_realloc(windowlist,
+ (numwindows +
+ 1) * sizeof(*windowlist));
+ if (!windowlist) {
+ SDL_free(data);
+ return SDL_OutOfMemory();
+ }
+ windowlist[numwindows] = data;
+ videodata->numwindows++;
+ videodata->windowlistlength++;
+ videodata->windowlist = windowlist;
+ }
+
+ /* Fill in the SDL window with the window data */
+ {
+ XWindowAttributes attrib;
+
+ X11_XGetWindowAttributes(data->videodata->display, w, &attrib);
+ window->x = attrib.x;
+ window->y = attrib.y;
+ window->w = attrib.width;
+ window->h = attrib.height;
+ if (attrib.map_state != IsUnmapped) {
+ window->flags |= SDL_WINDOW_SHOWN;
+ } else {
+ window->flags &= ~SDL_WINDOW_SHOWN;
+ }
+ data->visual = attrib.visual;
+ data->colormap = attrib.colormap;
+ }
+
+ window->flags |= X11_GetNetWMState(_this, w);
+
+ {
+ Window FocalWindow;
+ int RevertTo=0;
+ X11_XGetInputFocus(data->videodata->display, &FocalWindow, &RevertTo);
+ if (FocalWindow==w)
+ {
+ window->flags |= SDL_WINDOW_INPUT_FOCUS;
+ }
+
+ if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
+ SDL_SetKeyboardFocus(data->window);
+ }
+
+ if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
+ /* Tell x11 to clip mouse */
+ }
+ }
+
+ /* All done! */
+ window->driverdata = data;
+ return 0;
+}
+
+static void
+SetWindowBordered(Display *display, int screen, Window window, SDL_bool border)
+{
+ /*
+ * this code used to check for KWM_WIN_DECORATION, but KDE hasn't
+ * supported it for years and years. It now respects _MOTIF_WM_HINTS.
+ * Gnome is similar: just use the Motif atom.
+ */
+
+ Atom WM_HINTS = X11_XInternAtom(display, "_MOTIF_WM_HINTS", True);
+ if (WM_HINTS != None) {
+ /* Hints used by Motif compliant window managers */
+ struct
+ {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long input_mode;
+ unsigned long status;
+ } MWMHints = {
+ (1L << 1), 0, border ? 1 : 0, 0, 0
+ };
+
+ X11_XChangeProperty(display, window, WM_HINTS, WM_HINTS, 32,
+ PropModeReplace, (unsigned char *) &MWMHints,
+ sizeof(MWMHints) / sizeof(long));
+ } else { /* set the transient hints instead, if necessary */
+ X11_XSetTransientForHint(display, window, RootWindow(display, screen));
+ }
+}
+
+int
+X11_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ SDL_DisplayData *displaydata =
+ (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ SDL_WindowData *windowdata;
+ Display *display = data->display;
+ int screen = displaydata->screen;
+ Visual *visual;
+ int depth;
+ XSetWindowAttributes xattr;
+ Window w;
+ XSizeHints *sizehints;
+ XWMHints *wmhints;
+ XClassHint *classhints;
+ Atom _NET_WM_BYPASS_COMPOSITOR;
+ Atom _NET_WM_WINDOW_TYPE;
+ Atom wintype;
+ const char *wintype_name = NULL;
+ long compositor = 1;
+ Atom _NET_WM_PID;
+ Atom XdndAware, xdnd_version = 5;
+ long fevent = 0;
+
+#if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL
+ if ((window->flags & SDL_WINDOW_OPENGL) &&
+ !SDL_getenv("SDL_VIDEO_X11_VISUALID")) {
+ XVisualInfo *vinfo = NULL;
+
+#if SDL_VIDEO_OPENGL_EGL
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES
+#if SDL_VIDEO_OPENGL_GLX
+ && ( !_this->gl_data || X11_GL_UseEGL(_this) )
+#endif
+ ) {
+ vinfo = X11_GLES_GetVisual(_this, display, screen);
+ } else
+#endif
+ {
+#if SDL_VIDEO_OPENGL_GLX
+ vinfo = X11_GL_GetVisual(_this, display, screen);
+#endif
+ }
+
+ if (!vinfo) {
+ return -1;
+ }
+ visual = vinfo->visual;
+ depth = vinfo->depth;
+ X11_XFree(vinfo);
+ } else
+#endif
+ {
+ visual = displaydata->visual;
+ depth = displaydata->depth;
+ }
+
+ xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False;
+ xattr.background_pixmap = None;
+ xattr.border_pixel = 0;
+
+ if (visual->class == DirectColor) {
+ XColor *colorcells;
+ int i;
+ int ncolors;
+ int rmax, gmax, bmax;
+ int rmask, gmask, bmask;
+ int rshift, gshift, bshift;
+
+ xattr.colormap =
+ X11_XCreateColormap(display, RootWindow(display, screen),
+ visual, AllocAll);
+
+ /* If we can't create a colormap, then we must die */
+ if (!xattr.colormap) {
+ return SDL_SetError("Could not create writable colormap");
+ }
+
+ /* OK, we got a colormap, now fill it in as best as we can */
+ colorcells = SDL_malloc(visual->map_entries * sizeof(XColor));
+ if (!colorcells) {
+ return SDL_OutOfMemory();
+ }
+ ncolors = visual->map_entries;
+ rmax = 0xffff;
+ gmax = 0xffff;
+ bmax = 0xffff;
+
+ rshift = 0;
+ rmask = visual->red_mask;
+ while (0 == (rmask & 1)) {
+ rshift++;
+ rmask >>= 1;
+ }
+
+ gshift = 0;
+ gmask = visual->green_mask;
+ while (0 == (gmask & 1)) {
+ gshift++;
+ gmask >>= 1;
+ }
+
+ bshift = 0;
+ bmask = visual->blue_mask;
+ while (0 == (bmask & 1)) {
+ bshift++;
+ bmask >>= 1;
+ }
+
+ /* build the color table pixel values */
+ for (i = 0; i < ncolors; i++) {
+ Uint32 red = (rmax * i) / (ncolors - 1);
+ Uint32 green = (gmax * i) / (ncolors - 1);
+ Uint32 blue = (bmax * i) / (ncolors - 1);
+
+ Uint32 rbits = (rmask * i) / (ncolors - 1);
+ Uint32 gbits = (gmask * i) / (ncolors - 1);
+ Uint32 bbits = (bmask * i) / (ncolors - 1);
+
+ Uint32 pix =
+ (rbits << rshift) | (gbits << gshift) | (bbits << bshift);
+
+ colorcells[i].pixel = pix;
+
+ colorcells[i].red = red;
+ colorcells[i].green = green;
+ colorcells[i].blue = blue;
+
+ colorcells[i].flags = DoRed | DoGreen | DoBlue;
+ }
+
+ X11_XStoreColors(display, xattr.colormap, colorcells, ncolors);
+
+ SDL_free(colorcells);
+ } else {
+ xattr.colormap =
+ X11_XCreateColormap(display, RootWindow(display, screen),
+ visual, AllocNone);
+ }
+
+ w = X11_XCreateWindow(display, RootWindow(display, screen),
+ window->x, window->y, window->w, window->h,
+ 0, depth, InputOutput, visual,
+ (CWOverrideRedirect | CWBackPixmap | CWBorderPixel |
+ CWColormap), &xattr);
+ if (!w) {
+ return SDL_SetError("Couldn't create window");
+ }
+
+ SetWindowBordered(display, screen, w,
+ (window->flags & SDL_WINDOW_BORDERLESS) == 0);
+
+ sizehints = X11_XAllocSizeHints();
+ /* Setup the normal size hints */
+ sizehints->flags = 0;
+ if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
+ sizehints->min_width = sizehints->max_width = window->w;
+ sizehints->min_height = sizehints->max_height = window->h;
+ sizehints->flags |= (PMaxSize | PMinSize);
+ }
+ sizehints->x = window->x;
+ sizehints->y = window->y;
+ sizehints->flags |= USPosition;
+
+ /* Setup the input hints so we get keyboard input */
+ wmhints = X11_XAllocWMHints();
+ wmhints->input = True;
+ wmhints->window_group = data->window_group;
+ wmhints->flags = InputHint | WindowGroupHint;
+
+ /* Setup the class hints so we can get an icon (AfterStep) */
+ classhints = X11_XAllocClassHint();
+ classhints->res_name = data->classname;
+ classhints->res_class = data->classname;
+
+ /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */
+ X11_XSetWMProperties(display, w, NULL, NULL, NULL, 0, sizehints, wmhints, classhints);
+
+ X11_XFree(sizehints);
+ X11_XFree(wmhints);
+ X11_XFree(classhints);
+ /* Set the PID related to the window for the given hostname, if possible */
+ if (data->pid > 0) {
+ long pid = (long) data->pid;
+ _NET_WM_PID = X11_XInternAtom(display, "_NET_WM_PID", False);
+ X11_XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &pid, 1);
+ }
+
+ /* Set the window manager state */
+ X11_SetNetWMState(_this, w, window->flags);
+
+ compositor = 2; /* don't disable compositing except for "normal" windows */
+
+ if (window->flags & SDL_WINDOW_UTILITY) {
+ wintype_name = "_NET_WM_WINDOW_TYPE_UTILITY";
+ } else if (window->flags & SDL_WINDOW_TOOLTIP) {
+ wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP";
+ } else if (window->flags & SDL_WINDOW_POPUP_MENU) {
+ wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU";
+ } else {
+ wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL";
+ compositor = 1; /* disable compositing for "normal" windows */
+ }
+
+ /* Let the window manager know what type of window we are. */
+ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
+ wintype = X11_XInternAtom(display, wintype_name, False);
+ X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
+ PropModeReplace, (unsigned char *)&wintype, 1);
+ if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, SDL_TRUE)) {
+ _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False);
+ X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
+ PropModeReplace,
+ (unsigned char *)&compositor, 1);
+ }
+
+ {
+ Atom protocols[3];
+ int proto_count = 0;
+
+ protocols[proto_count++] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */
+ protocols[proto_count++] = data->WM_TAKE_FOCUS; /* Since we will want to set input focus explicitly */
+
+ /* Default to using ping if there is no hint */
+ if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_PING, SDL_TRUE)) {
+ protocols[proto_count++] = data->_NET_WM_PING; /* Respond so WM knows we're alive */
+ }
+
+ SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0]));
+
+ X11_XSetWMProtocols(display, w, protocols, proto_count);
+ }
+
+ if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
+ X11_XDestroyWindow(display, w);
+ return -1;
+ }
+ windowdata = (SDL_WindowData *) window->driverdata;
+
+#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+ if ((window->flags & SDL_WINDOW_OPENGL) &&
+ _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES
+#if SDL_VIDEO_OPENGL_GLX
+ && ( !_this->gl_data || X11_GL_UseEGL(_this) )
+#endif
+ ) {
+#if SDL_VIDEO_OPENGL_EGL
+ if (!_this->egl_data) {
+ X11_XDestroyWindow(display, w);
+ return -1;
+ }
+
+ /* Create the GLES window surface */
+ windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) w);
+
+ if (windowdata->egl_surface == EGL_NO_SURFACE) {
+ X11_XDestroyWindow(display, w);
+ return SDL_SetError("Could not create GLES window surface");
+ }
+#else
+ return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
+#endif /* SDL_VIDEO_OPENGL_EGL */
+ }
+#endif
+
+
+#ifdef X_HAVE_UTF8_STRING
+ if (SDL_X11_HAVE_UTF8 && windowdata->ic) {
+ X11_XGetICValues(windowdata->ic, XNFilterEvents, &fevent, NULL);
+ }
+#endif
+
+ X11_Xinput2SelectTouch(_this, window);
+
+ X11_XSelectInput(display, w,
+ (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
+ ExposureMask | ButtonPressMask | ButtonReleaseMask |
+ PointerMotionMask | KeyPressMask | KeyReleaseMask |
+ PropertyChangeMask | StructureNotifyMask |
+ KeymapStateMask | fevent));
+
+ XdndAware = X11_XInternAtom(display, "XdndAware", False);
+ X11_XChangeProperty(display, w, XdndAware, XA_ATOM, 32,
+ PropModeReplace,
+ (unsigned char*)&xdnd_version, 1);
+
+ X11_XFlush(display);
+
+ return 0;
+}
+
+int
+X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ Window w = (Window) data;
+
+ window->title = X11_GetWindowTitle(_this, w);
+
+ if (SetupWindowData(_this, window, w, SDL_FALSE) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+char *
+X11_GetWindowTitle(_THIS, Window xwindow)
+{
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ Display *display = data->display;
+ int status, real_format;
+ Atom real_type;
+ unsigned long items_read, items_left;
+ unsigned char *propdata;
+ char *title = NULL;
+
+ status = X11_XGetWindowProperty(display, xwindow, data->_NET_WM_NAME,
+ 0L, 8192L, False, data->UTF8_STRING, &real_type, &real_format,
+ &items_read, &items_left, &propdata);
+ if (status == Success && propdata) {
+ title = SDL_strdup(SDL_static_cast(char*, propdata));
+ X11_XFree(propdata);
+ } else {
+ status = X11_XGetWindowProperty(display, xwindow, XA_WM_NAME,
+ 0L, 8192L, False, XA_STRING, &real_type, &real_format,
+ &items_read, &items_left, &propdata);
+ if (status == Success && propdata) {
+ title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*, propdata), items_read+1);
+ X11_XFree(propdata);
+ } else {
+ title = SDL_strdup("");
+ }
+ }
+ return title;
+}
+
+void
+X11_SetWindowTitle(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ XTextProperty titleprop;
+ Status status;
+ const char *title = window->title ? window->title : "";
+ char *title_locale = NULL;
+
+#ifdef X_HAVE_UTF8_STRING
+ Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME;
+#endif
+
+ title_locale = SDL_iconv_utf8_locale(title);
+ if (!title_locale) {
+ SDL_OutOfMemory();
+ return;
+ }
+
+ status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
+ SDL_free(title_locale);
+ if (status) {
+ X11_XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME);
+ X11_XFree(titleprop.value);
+ }
+#ifdef X_HAVE_UTF8_STRING
+ if (SDL_X11_HAVE_UTF8) {
+ status = X11_Xutf8TextListToTextProperty(display, (char **) &title, 1,
+ XUTF8StringStyle, &titleprop);
+ if (status == Success) {
+ X11_XSetTextProperty(display, data->xwindow, &titleprop,
+ _NET_WM_NAME);
+ X11_XFree(titleprop.value);
+ }
+ }
+#endif
+
+ X11_XFlush(display);
+}
+
+void
+X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ Atom _NET_WM_ICON = data->videodata->_NET_WM_ICON;
+
+ if (icon) {
+ int propsize;
+ long *propdata;
+
+ /* Set the _NET_WM_ICON property */
+ SDL_assert(icon->format->format == SDL_PIXELFORMAT_ARGB8888);
+ propsize = 2 + (icon->w * icon->h);
+ propdata = SDL_malloc(propsize * sizeof(long));
+ if (propdata) {
+ int x, y;
+ Uint32 *src;
+ long *dst;
+
+ propdata[0] = icon->w;
+ propdata[1] = icon->h;
+ dst = &propdata[2];
+ for (y = 0; y < icon->h; ++y) {
+ src = (Uint32*)((Uint8*)icon->pixels + y * icon->pitch);
+ for (x = 0; x < icon->w; ++x) {
+ *dst++ = *src++;
+ }
+ }
+ X11_XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL,
+ 32, PropModeReplace, (unsigned char *) propdata,
+ propsize);
+ }
+ SDL_free(propdata);
+ } else {
+ X11_XDeleteProperty(display, data->xwindow, _NET_WM_ICON);
+ }
+ X11_XFlush(display);
+}
+
+void
+X11_SetWindowPosition(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
+ X11_XFlush(display);
+}
+
+void
+X11_SetWindowMinimumSize(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ XSizeHints *sizehints = X11_XAllocSizeHints();
+ long userhints;
+
+ X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
+
+ sizehints->min_width = window->min_w;
+ sizehints->min_height = window->min_h;
+ sizehints->flags |= PMinSize;
+
+ X11_XSetWMNormalHints(display, data->xwindow, sizehints);
+
+ X11_XFree(sizehints);
+
+ /* See comment in X11_SetWindowSize. */
+ X11_XResizeWindow(display, data->xwindow, window->w, window->h);
+ X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
+ X11_XRaiseWindow(display, data->xwindow);
+ }
+
+ X11_XFlush(display);
+}
+
+void
+X11_SetWindowMaximumSize(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ XSizeHints *sizehints = X11_XAllocSizeHints();
+ long userhints;
+
+ X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
+
+ sizehints->max_width = window->max_w;
+ sizehints->max_height = window->max_h;
+ sizehints->flags |= PMaxSize;
+
+ X11_XSetWMNormalHints(display, data->xwindow, sizehints);
+
+ X11_XFree(sizehints);
+
+ /* See comment in X11_SetWindowSize. */
+ X11_XResizeWindow(display, data->xwindow, window->w, window->h);
+ X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
+ X11_XRaiseWindow(display, data->xwindow);
+ }
+
+ X11_XFlush(display);
+}
+
+void
+X11_SetWindowSize(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ if (SDL_IsShapedWindow(window)) {
+ X11_ResizeWindowShape(window);
+ }
+ if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
+ /* Apparently, if the X11 Window is set to a 'non-resizable' window, you cannot resize it using the X11_XResizeWindow, thus
+ we must set the size hints to adjust the window size. */
+ XSizeHints *sizehints = X11_XAllocSizeHints();
+ long userhints;
+
+ X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
+
+ sizehints->min_width = sizehints->max_width = window->w;
+ sizehints->min_height = sizehints->max_height = window->h;
+ sizehints->flags |= PMinSize | PMaxSize;
+
+ X11_XSetWMNormalHints(display, data->xwindow, sizehints);
+
+ X11_XFree(sizehints);
+
+ /* From Pierre-Loup:
+ WMs each have their little quirks with that. When you change the
+ size hints, they get a ConfigureNotify event with the
+ WM_NORMAL_SIZE_HINTS Atom. They all save the hints then, but they
+ don't all resize the window right away to enforce the new hints.
+
+ Some of them resize only after:
+ - A user-initiated move or resize
+ - A code-initiated move or resize
+ - Hiding & showing window (Unmap & map)
+
+ The following move & resize seems to help a lot of WMs that didn't
+ properly update after the hints were changed. We don't do a
+ hide/show, because there are supposedly subtle problems with doing so
+ and transitioning from windowed to fullscreen in Unity.
+ */
+ X11_XResizeWindow(display, data->xwindow, window->w, window->h);
+ X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
+ X11_XRaiseWindow(display, data->xwindow);
+ } else {
+ X11_XResizeWindow(display, data->xwindow, window->w, window->h);
+ }
+
+ X11_XFlush(display);
+}
+
+int
+X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right)
+{
+ SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+
+ *left = data->border_left;
+ *right = data->border_right;
+ *top = data->border_top;
+ *bottom = data->border_bottom;
+
+ return 0;
+}
+
+int
+X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ Atom _NET_WM_WINDOW_OPACITY = data->videodata->_NET_WM_WINDOW_OPACITY;
+
+ if (opacity == 1.0f) {
+ X11_XDeleteProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY);
+ } else {
+ const Uint32 FullyOpaque = 0xFFFFFFFF;
+ const long alpha = (long) ((double)opacity * (double)FullyOpaque);
+ X11_XChangeProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)&alpha, 1);
+ }
+
+ return 0;
+}
+
+int
+X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window) {
+ SDL_WindowData *data = (SDL_WindowData *) modal_window->driverdata;
+ SDL_WindowData *parent_data = (SDL_WindowData *) parent_window->driverdata;
+ Display *display = data->videodata->display;
+
+ X11_XSetTransientForHint(display, data->xwindow, parent_data->xwindow);
+ return 0;
+}
+
+int
+X11_SetWindowInputFocus(_THIS, SDL_Window * window)
+{
+ if (X11_IsWindowMapped(_this, window)) {
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
+ X11_XFlush(display);
+ return 0;
+ }
+ return -1;
+}
+
+void
+X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
+{
+ const SDL_bool focused = ((window->flags & SDL_WINDOW_INPUT_FOCUS) != 0);
+ const SDL_bool visible = ((window->flags & SDL_WINDOW_HIDDEN) == 0);
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata =
+ (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ Display *display = data->videodata->display;
+ XEvent event;
+
+ SetWindowBordered(display, displaydata->screen, data->xwindow, bordered);
+ X11_XFlush(display);
+
+ if (visible) {
+ XWindowAttributes attr;
+ do {
+ X11_XSync(display, False);
+ X11_XGetWindowAttributes(display, data->xwindow, &attr);
+ } while (attr.map_state != IsViewable);
+
+ if (focused) {
+ X11_XSetInputFocus(display, data->xwindow, RevertToParent, CurrentTime);
+ }
+ }
+
+ /* make sure these don't make it to the real event queue if they fired here. */
+ X11_XSync(display, False);
+ X11_XCheckIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
+ X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
+}
+
+void
+X11_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ XSizeHints *sizehints = X11_XAllocSizeHints();
+ long userhints;
+
+ X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints);
+
+ if (resizable) {
+ /* FIXME: Is there a better way to get max window size from X? -flibit */
+ const int maxsize = 0x7FFFFFFF;
+ sizehints->min_width = window->min_w;
+ sizehints->min_height = window->min_h;
+ sizehints->max_width = (window->max_w == 0) ? maxsize : window->max_w;
+ sizehints->max_height = (window->max_h == 0) ? maxsize : window->max_h;
+ } else {
+ sizehints->min_width = window->w;
+ sizehints->min_height = window->h;
+ sizehints->max_width = window->w;
+ sizehints->max_height = window->h;
+ }
+ sizehints->flags |= PMinSize | PMaxSize;
+
+ X11_XSetWMNormalHints(display, data->xwindow, sizehints);
+
+ X11_XFree(sizehints);
+
+ /* See comment in X11_SetWindowSize. */
+ X11_XResizeWindow(display, data->xwindow, window->w, window->h);
+ X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top);
+ X11_XRaiseWindow(display, data->xwindow);
+
+ X11_XFlush(display);
+}
+
+void
+X11_ShowWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ XEvent event;
+
+ if (!X11_IsWindowMapped(_this, window)) {
+ X11_XMapRaised(display, data->xwindow);
+ /* Blocking wait for "MapNotify" event.
+ * We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type,
+ * and XCheckTypedWindowEvent doesn't block */
+ if(!(window->flags & SDL_WINDOW_FOREIGN))
+ X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
+ X11_XFlush(display);
+ }
+
+ if (!data->videodata->net_wm) {
+ /* no WM means no FocusIn event, which confuses us. Force it. */
+ X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime);
+ X11_XFlush(display);
+ }
+}
+
+void
+X11_HideWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ Display *display = data->videodata->display;
+ XEvent event;
+
+ if (X11_IsWindowMapped(_this, window)) {
+ X11_XWithdrawWindow(display, data->xwindow, displaydata->screen);
+ /* Blocking wait for "UnmapNotify" event */
+ if(!(window->flags & SDL_WINDOW_FOREIGN))
+ X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
+ X11_XFlush(display);
+ }
+}
+
+static void
+SetWindowActive(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata =
+ (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ Display *display = data->videodata->display;
+ Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW;
+
+ if (X11_IsWindowMapped(_this, window)) {
+ XEvent e;
+
+ /*printf("SDL Window %p: sending _NET_ACTIVE_WINDOW with timestamp %lu\n", window, data->user_time);*/
+
+ SDL_zero(e);
+ e.xany.type = ClientMessage;
+ e.xclient.message_type = _NET_ACTIVE_WINDOW;
+ e.xclient.format = 32;
+ e.xclient.window = data->xwindow;
+ e.xclient.data.l[0] = 1; /* source indication. 1 = application */
+ e.xclient.data.l[1] = data->user_time;
+ e.xclient.data.l[2] = 0;
+
+ X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
+ SubstructureNotifyMask | SubstructureRedirectMask, &e);
+
+ X11_XFlush(display);
+ }
+}
+
+void
+X11_RaiseWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ X11_XRaiseWindow(display, data->xwindow);
+ SetWindowActive(_this, window);
+ X11_XFlush(display);
+}
+
+static void
+SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata =
+ (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ Display *display = data->videodata->display;
+ Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
+ Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
+ Atom _NET_WM_STATE_MAXIMIZED_HORZ = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
+
+ if (maximized) {
+ window->flags |= SDL_WINDOW_MAXIMIZED;
+ } else {
+ window->flags &= ~SDL_WINDOW_MAXIMIZED;
+ }
+
+ if (X11_IsWindowMapped(_this, window)) {
+ XEvent e;
+
+ SDL_zero(e);
+ e.xany.type = ClientMessage;
+ e.xclient.message_type = _NET_WM_STATE;
+ e.xclient.format = 32;
+ e.xclient.window = data->xwindow;
+ e.xclient.data.l[0] =
+ maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
+ e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT;
+ e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ;
+ e.xclient.data.l[3] = 0l;
+
+ X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
+ SubstructureNotifyMask | SubstructureRedirectMask, &e);
+ } else {
+ X11_SetNetWMState(_this, data->xwindow, window->flags);
+ }
+ X11_XFlush(display);
+}
+
+void
+X11_MaximizeWindow(_THIS, SDL_Window * window)
+{
+ SetWindowMaximized(_this, window, SDL_TRUE);
+}
+
+void
+X11_MinimizeWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata =
+ (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
+ Display *display = data->videodata->display;
+
+ X11_XIconifyWindow(display, data->xwindow, displaydata->screen);
+ X11_XFlush(display);
+}
+
+void
+X11_RestoreWindow(_THIS, SDL_Window * window)
+{
+ SetWindowMaximized(_this, window, SDL_FALSE);
+ X11_ShowWindow(_this, window);
+ SetWindowActive(_this, window);
+}
+
+/* This asks the Window Manager to handle fullscreen for us. This is the modern way. */
+static void
+X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
+ Display *display = data->videodata->display;
+ Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
+ Atom _NET_WM_STATE_FULLSCREEN = data->videodata->_NET_WM_STATE_FULLSCREEN;
+
+ if (X11_IsWindowMapped(_this, window)) {
+ XEvent e;
+
+ if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
+ /* Compiz refuses fullscreen toggle if we're not resizable, so update the hints so we
+ can be resized to the fullscreen resolution (or reset so we're not resizable again) */
+ XSizeHints *sizehints = X11_XAllocSizeHints();
+ long flags = 0;
+ X11_XGetWMNormalHints(display, data->xwindow, sizehints, &flags);
+ /* set the resize flags on */
+ if (fullscreen) {
+ /* we are going fullscreen so turn the flags off */
+ sizehints->flags &= ~(PMinSize | PMaxSize);
+ } else {
+ /* Reset the min/max width height to make the window non-resizable again */
+ sizehints->flags |= PMinSize | PMaxSize;
+ sizehints->min_width = sizehints->max_width = window->windowed.w;
+ sizehints->min_height = sizehints->max_height = window->windowed.h;
+ }
+ X11_XSetWMNormalHints(display, data->xwindow, sizehints);
+ X11_XFree(sizehints);
+ }
+
+ SDL_zero(e);
+ e.xany.type = ClientMessage;
+ e.xclient.message_type = _NET_WM_STATE;
+ e.xclient.format = 32;
+ e.xclient.window = data->xwindow;
+ e.xclient.data.l[0] =
+ fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
+ e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN;
+ e.xclient.data.l[3] = 0l;
+
+ X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
+ SubstructureNotifyMask | SubstructureRedirectMask, &e);
+
+ /* Fullscreen windows sometimes end up being marked maximized by
+ window managers. Force it back to how we expect it to be. */
+ if (!fullscreen && ((window->flags & SDL_WINDOW_MAXIMIZED) == 0)) {
+ SDL_zero(e);
+ e.xany.type = ClientMessage;
+ e.xclient.message_type = _NET_WM_STATE;
+ e.xclient.format = 32;
+ e.xclient.window = data->xwindow;
+ e.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
+ e.xclient.data.l[1] = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
+ e.xclient.data.l[2] = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
+ e.xclient.data.l[3] = 0l;
+ X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
+ SubstructureNotifyMask | SubstructureRedirectMask, &e);
+ }
+ } else {
+ Uint32 flags;
+
+ flags = window->flags;
+ if (fullscreen) {
+ flags |= SDL_WINDOW_FULLSCREEN;
+ } else {
+ flags &= ~SDL_WINDOW_FULLSCREEN;
+ }
+ X11_SetNetWMState(_this, data->xwindow, flags);
+ }
+
+ if (data->visual->class == DirectColor) {
+ if ( fullscreen ) {
+ X11_XInstallColormap(display, data->colormap);
+ } else {
+ X11_XUninstallColormap(display, data->colormap);
+ }
+ }
+
+ X11_XFlush(display);
+}
+
+/* This handles fullscreen itself, outside the Window Manager. */
+static void
+X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
+ Visual *visual = data->visual;
+ Display *display = data->videodata->display;
+ const int screen = displaydata->screen;
+ Window root = RootWindow(display, screen);
+ const int def_vis = (visual == DefaultVisual(display, screen));
+ unsigned long xattrmask = 0;
+ XSetWindowAttributes xattr;
+ XEvent ev;
+ SDL_Rect rect;
+
+ if ( data->fswindow ) {
+ return; /* already fullscreen, I hope. */
+ }
+
+ X11_GetDisplayBounds(_this, _display, &rect);
+
+ SDL_zero(xattr);
+ xattr.override_redirect = True;
+ xattrmask |= CWOverrideRedirect;
+ xattr.background_pixel = def_vis ? BlackPixel(display, screen) : 0;
+ xattrmask |= CWBackPixel;
+ xattr.border_pixel = 0;
+ xattrmask |= CWBorderPixel;
+ xattr.colormap = data->colormap;
+ xattrmask |= CWColormap;
+
+ data->fswindow = X11_XCreateWindow(display, root,
+ rect.x, rect.y, rect.w, rect.h, 0,
+ displaydata->depth, InputOutput,
+ visual, xattrmask, &xattr);
+
+ X11_XSelectInput(display, data->fswindow, StructureNotifyMask);
+ X11_XSetWindowBackground(display, data->fswindow, 0);
+ X11_XInstallColormap(display, data->colormap);
+ X11_XClearWindow(display, data->fswindow);
+ X11_XMapRaised(display, data->fswindow);
+
+ /* Make sure the fswindow is in view by warping mouse to the corner */
+ X11_XUngrabPointer(display, CurrentTime);
+ X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
+
+ /* Wait to be mapped, filter Unmap event out if it arrives. */
+ X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->fswindow);
+ X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->fswindow);
+
+#if SDL_VIDEO_DRIVER_X11_XVIDMODE
+ if ( displaydata->use_vidmode ) {
+ X11_XF86VidModeLockModeSwitch(display, screen, True);
+ }
+#endif
+
+ SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE);
+
+ /* Center actual window within our cover-the-screen window. */
+ X11_XReparentWindow(display, data->xwindow, data->fswindow,
+ (rect.w - window->w) / 2, (rect.h - window->h) / 2);
+
+ /* Move the mouse to the upper left to make sure it's on-screen */
+ X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
+
+ /* Center mouse in the fullscreen window. */
+ rect.x += (rect.w / 2);
+ rect.y += (rect.h / 2);
+ X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
+
+ /* Wait to be mapped, filter Unmap event out if it arrives. */
+ X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
+ X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow);
+
+ SDL_UpdateWindowGrab(window);
+}
+
+static void
+X11_EndWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
+ Display *display = data->videodata->display;
+ const int screen = displaydata->screen;
+ Window root = RootWindow(display, screen);
+ Window fswindow = data->fswindow;
+ XEvent ev;
+
+ if (!data->fswindow) {
+ return; /* already not fullscreen, I hope. */
+ }
+
+ data->fswindow = None;
+
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
+ if ( displaydata->use_vidmode ) {
+ X11_XF86VidModeLockModeSwitch(display, screen, False);
+ }
+#endif
+
+ SDL_UpdateWindowGrab(window);
+
+ X11_XReparentWindow(display, data->xwindow, root, window->x, window->y);
+
+ /* flush these events so they don't confuse normal event handling */
+ X11_XSync(display, False);
+ X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
+ X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow);
+
+ SetWindowBordered(display, screen, data->xwindow,
+ (window->flags & SDL_WINDOW_BORDERLESS) == 0);
+
+ X11_XWithdrawWindow(display, fswindow, screen);
+
+ /* Wait to be unmapped. */
+ X11_XIfEvent(display, &ev, &isUnmapNotify, (XPointer)&fswindow);
+ X11_XDestroyWindow(display, fswindow);
+}
+
+
+void
+X11_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen)
+{
+ /* !!! FIXME: SDL_Hint? */
+ SDL_bool legacy = SDL_FALSE;
+ const char *env = SDL_getenv("SDL_VIDEO_X11_LEGACY_FULLSCREEN");
+ if (env) {
+ legacy = SDL_atoi(env);
+ } else {
+ SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
+ SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata;
+ if ( displaydata->use_vidmode ) {
+ legacy = SDL_TRUE; /* the new stuff only works with XRandR. */
+ } else if ( !videodata->net_wm ) {
+ legacy = SDL_TRUE; /* The window manager doesn't support it */
+ } else {
+ /* !!! FIXME: look at the window manager name, and blacklist certain ones? */
+ /* http://stackoverflow.com/questions/758648/find-the-name-of-the-x-window-manager */
+ legacy = SDL_FALSE; /* try the new way. */
+ }
+ }
+
+ if (legacy) {
+ if (fullscreen) {
+ X11_BeginWindowFullscreenLegacy(_this, window, _display);
+ } else {
+ X11_EndWindowFullscreenLegacy(_this, window, _display);
+ }
+ } else {
+ X11_SetWindowFullscreenViaWM(_this, window, _display, fullscreen);
+ }
+}
+
+
+int
+X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ Visual *visual = data->visual;
+ Colormap colormap = data->colormap;
+ XColor *colorcells;
+ int ncolors;
+ int rmask, gmask, bmask;
+ int rshift, gshift, bshift;
+ int i;
+
+ if (visual->class != DirectColor) {
+ return SDL_SetError("Window doesn't have DirectColor visual");
+ }
+
+ ncolors = visual->map_entries;
+ colorcells = SDL_malloc(ncolors * sizeof(XColor));
+ if (!colorcells) {
+ return SDL_OutOfMemory();
+ }
+
+ rshift = 0;
+ rmask = visual->red_mask;
+ while (0 == (rmask & 1)) {
+ rshift++;
+ rmask >>= 1;
+ }
+
+ gshift = 0;
+ gmask = visual->green_mask;
+ while (0 == (gmask & 1)) {
+ gshift++;
+ gmask >>= 1;
+ }
+
+ bshift = 0;
+ bmask = visual->blue_mask;
+ while (0 == (bmask & 1)) {
+ bshift++;
+ bmask >>= 1;
+ }
+
+ /* build the color table pixel values */
+ for (i = 0; i < ncolors; i++) {
+ Uint32 rbits = (rmask * i) / (ncolors - 1);
+ Uint32 gbits = (gmask * i) / (ncolors - 1);
+ Uint32 bbits = (bmask * i) / (ncolors - 1);
+ Uint32 pix = (rbits << rshift) | (gbits << gshift) | (bbits << bshift);
+
+ colorcells[i].pixel = pix;
+
+ colorcells[i].red = ramp[(0 * 256) + i];
+ colorcells[i].green = ramp[(1 * 256) + i];
+ colorcells[i].blue = ramp[(2 * 256) + i];
+
+ colorcells[i].flags = DoRed | DoGreen | DoBlue;
+ }
+
+ X11_XStoreColors(display, colormap, colorcells, ncolors);
+ X11_XFlush(display);
+ SDL_free(colorcells);
+
+ return 0;
+}
+
+void
+X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+ SDL_bool oldstyle_fullscreen;
+ SDL_bool grab_keyboard;
+
+ /* ICCCM2.0-compliant window managers can handle fullscreen windows
+ If we're using XVidMode to change resolution we need to confine
+ the cursor so we don't pan around the virtual desktop.
+ */
+ oldstyle_fullscreen = X11_IsWindowLegacyFullscreen(_this, window);
+
+ if (oldstyle_fullscreen || grabbed) {
+ /* Try to grab the mouse */
+ if (!data->videodata->broken_pointer_grab) {
+ const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask;
+ int attempts;
+ int result;
+
+ /* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */
+ for (attempts = 0; attempts < 100; attempts++) {
+ result = X11_XGrabPointer(display, data->xwindow, True, mask, GrabModeAsync,
+ GrabModeAsync, data->xwindow, None, CurrentTime);
+ if (result == GrabSuccess) {
+ break;
+ }
+ SDL_Delay(50);
+ }
+
+ if (result != GrabSuccess) {
+ SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "The X server refused to let us grab the mouse. You might experience input bugs.");
+ data->videodata->broken_pointer_grab = SDL_TRUE; /* don't try again. */
+ }
+ }
+
+ /* Raise the window if we grab the mouse */
+ X11_XRaiseWindow(display, data->xwindow);
+
+ /* Now grab the keyboard */
+ if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE)) {
+ grab_keyboard = SDL_TRUE;
+ } else {
+ /* We need to do this with the old style override_redirect
+ fullscreen window otherwise we won't get keyboard focus.
+ */
+ grab_keyboard = oldstyle_fullscreen;
+ }
+ if (grab_keyboard) {
+ X11_XGrabKeyboard(display, data->xwindow, True, GrabModeAsync,
+ GrabModeAsync, CurrentTime);
+ }
+ } else {
+ X11_XUngrabPointer(display, CurrentTime);
+ X11_XUngrabKeyboard(display, CurrentTime);
+ }
+ X11_XSync(display, False);
+}
+
+void
+X11_DestroyWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (data) {
+ SDL_VideoData *videodata = (SDL_VideoData *) data->videodata;
+ Display *display = videodata->display;
+ int numwindows = videodata->numwindows;
+ SDL_WindowData **windowlist = videodata->windowlist;
+ int i;
+
+ if (windowlist) {
+ for (i = 0; i < numwindows; ++i) {
+ if (windowlist[i] && (windowlist[i]->window == window)) {
+ windowlist[i] = windowlist[numwindows - 1];
+ windowlist[numwindows - 1] = NULL;
+ videodata->numwindows--;
+ break;
+ }
+ }
+ }
+#ifdef X_HAVE_UTF8_STRING
+ if (data->ic) {
+ X11_XDestroyIC(data->ic);
+ }
+#endif
+ if (data->created) {
+ X11_XDestroyWindow(display, data->xwindow);
+ X11_XFlush(display);
+ }
+ SDL_free(data);
+ }
+ window->driverdata = NULL;
+}
+
+SDL_bool
+X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
+{
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ Display *display = data->videodata->display;
+
+ if (info->version.major == SDL_MAJOR_VERSION &&
+ info->version.minor == SDL_MINOR_VERSION) {
+ info->subsystem = SDL_SYSWM_X11;
+ info->info.x11.display = display;
+ info->info.x11.window = data->xwindow;
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+}
+
+int
+X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
+{
+ return 0; /* just succeed, the real work is done elsewhere. */
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11window.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11window.h
new file mode 100644
index 0000000..7c4c6c5
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11window.h
@@ -0,0 +1,110 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11window_h_
+#define SDL_x11window_h_
+
+/* We need to queue the focus in/out changes because they may occur during
+ video mode changes and we can respond to them by triggering more mode
+ changes.
+*/
+#define PENDING_FOCUS_TIME 200
+
+#if SDL_VIDEO_OPENGL_EGL
+#include <EGL/egl.h>
+#endif
+
+typedef enum
+{
+ PENDING_FOCUS_NONE,
+ PENDING_FOCUS_IN,
+ PENDING_FOCUS_OUT
+} PendingFocusEnum;
+
+typedef struct
+{
+ SDL_Window *window;
+ Window xwindow;
+ Window fswindow; /* used if we can't have the WM handle fullscreen. */
+ Visual *visual;
+ Colormap colormap;
+#ifndef NO_SHARED_MEMORY
+ /* MIT shared memory extension information */
+ SDL_bool use_mitshm;
+ XShmSegmentInfo shminfo;
+#endif
+ XImage *ximage;
+ GC gc;
+ XIC ic;
+ SDL_bool created;
+ int border_left;
+ int border_right;
+ int border_top;
+ int border_bottom;
+ Uint32 last_focus_event_time;
+ PendingFocusEnum pending_focus;
+ Uint32 pending_focus_time;
+ XConfigureEvent last_xconfigure;
+ struct SDL_VideoData *videodata;
+ unsigned long user_time;
+ Atom xdnd_req;
+ Window xdnd_source;
+#if SDL_VIDEO_OPENGL_EGL
+ EGLSurface egl_surface;
+#endif
+} SDL_WindowData;
+
+extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags);
+extern Uint32 X11_GetNetWMState(_THIS, Window xwindow);
+
+extern int X11_CreateWindow(_THIS, SDL_Window * window);
+extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+extern char *X11_GetWindowTitle(_THIS, Window xwindow);
+extern void X11_SetWindowTitle(_THIS, SDL_Window * window);
+extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+extern void X11_SetWindowPosition(_THIS, SDL_Window * window);
+extern void X11_SetWindowMinimumSize(_THIS, SDL_Window * window);
+extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window);
+extern int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
+extern int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
+extern int X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
+extern int X11_SetWindowInputFocus(_THIS, SDL_Window * window);
+extern void X11_SetWindowSize(_THIS, SDL_Window * window);
+extern void X11_ShowWindow(_THIS, SDL_Window * window);
+extern void X11_HideWindow(_THIS, SDL_Window * window);
+extern void X11_RaiseWindow(_THIS, SDL_Window * window);
+extern void X11_MaximizeWindow(_THIS, SDL_Window * window);
+extern void X11_MinimizeWindow(_THIS, SDL_Window * window);
+extern void X11_RestoreWindow(_THIS, SDL_Window * window);
+extern void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
+extern void X11_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable);
+extern void X11_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
+extern int X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
+extern void X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+extern void X11_DestroyWindow(_THIS, SDL_Window * window);
+extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
+
+#endif /* SDL_x11window_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.c b/src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.c
new file mode 100644
index 0000000..06a8937
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.c
@@ -0,0 +1,313 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+
+#include "SDL_x11video.h"
+#include "SDL_x11xinput2.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
+
+#define MAX_AXIS 16
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+static int xinput2_initialized = 0;
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+static int xinput2_multitouch_supported = 0;
+#endif
+
+/* Opcode returned X11_XQueryExtension
+ * It will be used in event processing
+ * to know that the event came from
+ * this extension */
+static int xinput2_opcode;
+
+static void parse_valuators(const double *input_values,unsigned char *mask,int mask_len,
+ double *output_values,int output_values_len) {
+ int i = 0,z = 0;
+ int top = mask_len * 8;
+ if (top > MAX_AXIS)
+ top = MAX_AXIS;
+
+ SDL_memset(output_values,0,output_values_len * sizeof(double));
+ for (; i < top && z < output_values_len; i++) {
+ if (XIMaskIsSet(mask, i)) {
+ const int value = (int) *input_values;
+ output_values[z] = value;
+ input_values++;
+ }
+ z++;
+ }
+}
+
+static int
+query_xinput2_version(Display *display, int major, int minor)
+{
+ /* We don't care if this fails, so long as it sets major/minor on it's way out the door. */
+ X11_XIQueryVersion(display, &major, &minor);
+ return ((major * 1000) + minor);
+}
+
+static SDL_bool
+xinput2_version_atleast(const int version, const int wantmajor, const int wantminor)
+{
+ return ( version >= ((wantmajor * 1000) + wantminor) );
+}
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+static void
+xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window,
+ double in_x, double in_y, float *out_x, float *out_y)
+{
+ int i;
+ for (i = 0; i < videodata->numwindows; i++) {
+ SDL_WindowData *d = videodata->windowlist[i];
+ if (d->xwindow == window) {
+ if (d->window->w == 1) {
+ *out_x = 0.5f;
+ } else {
+ *out_x = in_x / (d->window->w - 1);
+ }
+ if (d->window->h == 1) {
+ *out_y = 0.5f;
+ } else {
+ *out_y = in_y / (d->window->h - 1);
+ }
+ return;
+ }
+ }
+ // couldn't find the window...
+ *out_x = in_x;
+ *out_y = in_y;
+}
+#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */
+
+#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */
+
+void
+X11_InitXinput2(_THIS)
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+ int version = 0;
+ XIEventMask eventmask;
+ unsigned char mask[3] = { 0,0,0 };
+ int event, err;
+
+ /*
+ * Initialize XInput 2
+ * According to http://who-t.blogspot.com/2009/05/xi2-recipes-part-1.html its better
+ * to inform Xserver what version of Xinput we support.The server will store the version we support.
+ * "As XI2 progresses it becomes important that you use this call as the server may treat the client
+ * differently depending on the supported version".
+ *
+ * FIXME:event and err are not needed but if not passed X11_XQueryExtension returns SegmentationFault
+ */
+ if (!SDL_X11_HAVE_XINPUT2 ||
+ !X11_XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) {
+ return; /* X server does not have XInput at all */
+ }
+
+ /* We need at least 2.2 for Multitouch, 2.0 otherwise. */
+ version = query_xinput2_version(data->display, 2, 2);
+ if (!xinput2_version_atleast(version, 2, 0)) {
+ return; /* X server does not support the version we want at all. */
+ }
+
+ xinput2_initialized = 1;
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Multitouch needs XInput 2.2 */
+ xinput2_multitouch_supported = xinput2_version_atleast(version, 2, 2);
+#endif
+
+ /* Enable Raw motion events for this display */
+ eventmask.deviceid = XIAllMasterDevices;
+ eventmask.mask_len = sizeof(mask);
+ eventmask.mask = mask;
+
+ XISetMask(mask, XI_RawMotion);
+ XISetMask(mask, XI_RawButtonPress);
+ XISetMask(mask, XI_RawButtonRelease);
+
+ if (X11_XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) {
+ return;
+ }
+#endif
+}
+
+int
+X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie)
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+ if(cookie->extension != xinput2_opcode) {
+ return 0;
+ }
+ switch(cookie->evtype) {
+ case XI_RawMotion: {
+ const XIRawEvent *rawev = (const XIRawEvent*)cookie->data;
+ SDL_Mouse *mouse = SDL_GetMouse();
+ double relative_coords[2];
+ static Time prev_time = 0;
+ static double prev_rel_coords[2];
+
+ videodata->global_mouse_changed = SDL_TRUE;
+
+ if (!mouse->relative_mode || mouse->relative_mode_warp) {
+ return 0;
+ }
+
+ parse_valuators(rawev->raw_values,rawev->valuators.mask,
+ rawev->valuators.mask_len,relative_coords,2);
+
+ if ((rawev->time == prev_time) && (relative_coords[0] == prev_rel_coords[0]) && (relative_coords[1] == prev_rel_coords[1])) {
+ return 0; /* duplicate event, drop it. */
+ }
+
+ SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_coords[0],(int)relative_coords[1]);
+ prev_rel_coords[0] = relative_coords[0];
+ prev_rel_coords[1] = relative_coords[1];
+ prev_time = rawev->time;
+ return 1;
+ }
+ break;
+
+ case XI_RawButtonPress:
+ case XI_RawButtonRelease:
+ videodata->global_mouse_changed = SDL_TRUE;
+ break;
+
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+ case XI_TouchBegin: {
+ const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data;
+ float x, y;
+ xinput2_normalize_touch_coordinates(videodata, xev->event,
+ xev->event_x, xev->event_y, &x, &y);
+ SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, x, y, 1.0);
+ return 1;
+ }
+ break;
+ case XI_TouchEnd: {
+ const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data;
+ float x, y;
+ xinput2_normalize_touch_coordinates(videodata, xev->event,
+ xev->event_x, xev->event_y, &x, &y);
+ SDL_SendTouch(xev->sourceid,xev->detail, SDL_FALSE, x, y, 1.0);
+ return 1;
+ }
+ break;
+ case XI_TouchUpdate: {
+ const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data;
+ float x, y;
+ xinput2_normalize_touch_coordinates(videodata, xev->event,
+ xev->event_x, xev->event_y, &x, &y);
+ SDL_SendTouchMotion(xev->sourceid,xev->detail, x, y, 1.0);
+ return 1;
+ }
+ break;
+#endif
+ }
+#endif
+ return 0;
+}
+
+void
+X11_InitXinput2Multitouch(_THIS)
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+ XIDeviceInfo *info;
+ int ndevices,i,j;
+ info = X11_XIQueryDevice(data->display, XIAllDevices, &ndevices);
+
+ for (i = 0; i < ndevices; i++) {
+ XIDeviceInfo *dev = &info[i];
+ for (j = 0; j < dev->num_classes; j++) {
+ SDL_TouchID touchId;
+ XIAnyClassInfo *class = dev->classes[j];
+ XITouchClassInfo *t = (XITouchClassInfo*)class;
+
+ /* Only touch devices */
+ if (class->type != XITouchClass)
+ continue;
+
+ touchId = t->sourceid;
+ SDL_AddTouch(touchId, dev->name);
+ }
+ }
+ X11_XIFreeDeviceInfo(info);
+#endif
+}
+
+void
+X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+ SDL_VideoData *data = NULL;
+ XIEventMask eventmask;
+ unsigned char mask[3] = { 0,0,0 };
+ SDL_WindowData *window_data = NULL;
+
+ if (!X11_Xinput2IsMultitouchSupported()) {
+ return;
+ }
+
+ data = (SDL_VideoData *) _this->driverdata;
+ window_data = (SDL_WindowData*)window->driverdata;
+
+ eventmask.deviceid = XIAllMasterDevices;
+ eventmask.mask_len = sizeof(mask);
+ eventmask.mask = mask;
+
+ XISetMask(mask, XI_TouchBegin);
+ XISetMask(mask, XI_TouchUpdate);
+ XISetMask(mask, XI_TouchEnd);
+
+ X11_XISelectEvents(data->display,window_data->xwindow,&eventmask,1);
+#endif
+}
+
+
+int
+X11_Xinput2IsInitialized()
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2
+ return xinput2_initialized;
+#else
+ return 0;
+#endif
+}
+
+int
+X11_Xinput2IsMultitouchSupported()
+{
+#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+ return xinput2_initialized && xinput2_multitouch_supported;
+#else
+ return 0;
+#endif
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.h b/src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.h
new file mode 100644
index 0000000..4780fbb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/SDL_x11xinput2.h
@@ -0,0 +1,42 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef SDL_x11xinput2_h_
+#define SDL_x11xinput2_h_
+
+#ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
+/* Define XGenericEventCookie as forward declaration when
+ *xinput2 is not available in order to compile */
+struct XGenericEventCookie;
+typedef struct XGenericEventCookie XGenericEventCookie;
+#endif
+
+extern void X11_InitXinput2(_THIS);
+extern void X11_InitXinput2Multitouch(_THIS);
+extern int X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie);
+extern int X11_Xinput2IsInitialized(void);
+extern int X11_Xinput2IsMultitouchSupported(void);
+extern void X11_Xinput2SelectTouch(_THIS, SDL_Window *window);
+
+#endif /* SDL_x11xinput2_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/3rdparty/SDL2/src/video/x11/edid-parse.c b/src/3rdparty/SDL2/src/video/x11/edid-parse.c
new file mode 100644
index 0000000..e22324f
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/edid-parse.c
@@ -0,0 +1,754 @@
+/*
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* Author: Soren Sandmann <sandmann@redhat.com> */
+#include "../../SDL_internal.h"
+#include "SDL_stdinc.h"
+
+#include "edid.h"
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+
+#define TRUE 1
+#define FALSE 0
+
+static int
+get_bit (int in, int bit)
+{
+ return (in & (1 << bit)) >> bit;
+}
+
+static int
+get_bits (int in, int begin, int end)
+{
+ int mask = (1 << (end - begin + 1)) - 1;
+
+ return (in >> begin) & mask;
+}
+
+static int
+decode_header (const uchar *edid)
+{
+ if (memcmp (edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+static int
+decode_vendor_and_product_identification (const uchar *edid, MonitorInfo *info)
+{
+ int is_model_year;
+
+ /* Manufacturer Code */
+ info->manufacturer_code[0] = get_bits (edid[0x08], 2, 6);
+ info->manufacturer_code[1] = get_bits (edid[0x08], 0, 1) << 3;
+ info->manufacturer_code[1] |= get_bits (edid[0x09], 5, 7);
+ info->manufacturer_code[2] = get_bits (edid[0x09], 0, 4);
+ info->manufacturer_code[3] = '\0';
+
+ info->manufacturer_code[0] += 'A' - 1;
+ info->manufacturer_code[1] += 'A' - 1;
+ info->manufacturer_code[2] += 'A' - 1;
+
+ /* Product Code */
+ info->product_code = edid[0x0b] << 8 | edid[0x0a];
+
+ /* Serial Number */
+ info->serial_number =
+ edid[0x0c] | edid[0x0d] << 8 | edid[0x0e] << 16 | edid[0x0f] << 24;
+
+ /* Week and Year */
+ is_model_year = FALSE;
+ switch (edid[0x10])
+ {
+ case 0x00:
+ info->production_week = -1;
+ break;
+
+ case 0xff:
+ info->production_week = -1;
+ is_model_year = TRUE;
+ break;
+
+ default:
+ info->production_week = edid[0x10];
+ break;
+ }
+
+ if (is_model_year)
+ {
+ info->production_year = -1;
+ info->model_year = 1990 + edid[0x11];
+ }
+ else
+ {
+ info->production_year = 1990 + edid[0x11];
+ info->model_year = -1;
+ }
+
+ return TRUE;
+}
+
+static int
+decode_edid_version (const uchar *edid, MonitorInfo *info)
+{
+ info->major_version = edid[0x12];
+ info->minor_version = edid[0x13];
+
+ return TRUE;
+}
+
+static int
+decode_display_parameters (const uchar *edid, MonitorInfo *info)
+{
+ /* Digital vs Analog */
+ info->is_digital = get_bit (edid[0x14], 7);
+
+ if (info->is_digital)
+ {
+ int bits;
+
+ static const int bit_depth[8] =
+ {
+ -1, 6, 8, 10, 12, 14, 16, -1
+ };
+
+ static const Interface interfaces[6] =
+ {
+ UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT
+ };
+
+ bits = get_bits (edid[0x14], 4, 6);
+ info->ad.digital.bits_per_primary = bit_depth[bits];
+
+ bits = get_bits (edid[0x14], 0, 3);
+
+ if (bits <= 5)
+ info->ad.digital.interface = interfaces[bits];
+ else
+ info->ad.digital.interface = UNDEFINED;
+ }
+ else
+ {
+ int bits = get_bits (edid[0x14], 5, 6);
+
+ static const double levels[][3] =
+ {
+ { 0.7, 0.3, 1.0 },
+ { 0.714, 0.286, 1.0 },
+ { 1.0, 0.4, 1.4 },
+ { 0.7, 0.0, 0.7 },
+ };
+
+ info->ad.analog.video_signal_level = levels[bits][0];
+ info->ad.analog.sync_signal_level = levels[bits][1];
+ info->ad.analog.total_signal_level = levels[bits][2];
+
+ info->ad.analog.blank_to_black = get_bit (edid[0x14], 4);
+
+ info->ad.analog.separate_hv_sync = get_bit (edid[0x14], 3);
+ info->ad.analog.composite_sync_on_h = get_bit (edid[0x14], 2);
+ info->ad.analog.composite_sync_on_green = get_bit (edid[0x14], 1);
+
+ info->ad.analog.serration_on_vsync = get_bit (edid[0x14], 0);
+ }
+
+ /* Screen Size / Aspect Ratio */
+ if (edid[0x15] == 0 && edid[0x16] == 0)
+ {
+ info->width_mm = -1;
+ info->height_mm = -1;
+ info->aspect_ratio = -1.0;
+ }
+ else if (edid[0x16] == 0)
+ {
+ info->width_mm = -1;
+ info->height_mm = -1;
+ info->aspect_ratio = 100.0 / (edid[0x15] + 99);
+ }
+ else if (edid[0x15] == 0)
+ {
+ info->width_mm = -1;
+ info->height_mm = -1;
+ info->aspect_ratio = 100.0 / (edid[0x16] + 99);
+ info->aspect_ratio = 1/info->aspect_ratio; /* portrait */
+ }
+ else
+ {
+ info->width_mm = 10 * edid[0x15];
+ info->height_mm = 10 * edid[0x16];
+ }
+
+ /* Gamma */
+ if (edid[0x17] == 0xFF)
+ info->gamma = -1.0;
+ else
+ info->gamma = (edid[0x17] + 100.0) / 100.0;
+
+ /* Features */
+ info->standby = get_bit (edid[0x18], 7);
+ info->suspend = get_bit (edid[0x18], 6);
+ info->active_off = get_bit (edid[0x18], 5);
+
+ if (info->is_digital)
+ {
+ info->ad.digital.rgb444 = TRUE;
+ if (get_bit (edid[0x18], 3))
+ info->ad.digital.ycrcb444 = 1;
+ if (get_bit (edid[0x18], 4))
+ info->ad.digital.ycrcb422 = 1;
+ }
+ else
+ {
+ int bits = get_bits (edid[0x18], 3, 4);
+ ColorType color_type[4] =
+ {
+ MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR
+ };
+
+ info->ad.analog.color_type = color_type[bits];
+ }
+
+ info->srgb_is_standard = get_bit (edid[0x18], 2);
+
+ /* In 1.3 this is called "has preferred timing" */
+ info->preferred_timing_includes_native = get_bit (edid[0x18], 1);
+
+ /* FIXME: In 1.3 this indicates whether the monitor accepts GTF */
+ info->continuous_frequency = get_bit (edid[0x18], 0);
+ return TRUE;
+}
+
+static double
+decode_fraction (int high, int low)
+{
+ double result = 0.0;
+ int i;
+
+ high = (high << 2) | low;
+
+ for (i = 0; i < 10; ++i)
+ result += get_bit (high, i) * SDL_pow (2, i - 10);
+
+ return result;
+}
+
+static int
+decode_color_characteristics (const uchar *edid, MonitorInfo *info)
+{
+ info->red_x = decode_fraction (edid[0x1b], get_bits (edid[0x19], 6, 7));
+ info->red_y = decode_fraction (edid[0x1c], get_bits (edid[0x19], 5, 4));
+ info->green_x = decode_fraction (edid[0x1d], get_bits (edid[0x19], 2, 3));
+ info->green_y = decode_fraction (edid[0x1e], get_bits (edid[0x19], 0, 1));
+ info->blue_x = decode_fraction (edid[0x1f], get_bits (edid[0x1a], 6, 7));
+ info->blue_y = decode_fraction (edid[0x20], get_bits (edid[0x1a], 4, 5));
+ info->white_x = decode_fraction (edid[0x21], get_bits (edid[0x1a], 2, 3));
+ info->white_y = decode_fraction (edid[0x22], get_bits (edid[0x1a], 0, 1));
+
+ return TRUE;
+}
+
+static int
+decode_established_timings (const uchar *edid, MonitorInfo *info)
+{
+ static const Timing established[][8] =
+ {
+ {
+ { 800, 600, 60 },
+ { 800, 600, 56 },
+ { 640, 480, 75 },
+ { 640, 480, 72 },
+ { 640, 480, 67 },
+ { 640, 480, 60 },
+ { 720, 400, 88 },
+ { 720, 400, 70 }
+ },
+ {
+ { 1280, 1024, 75 },
+ { 1024, 768, 75 },
+ { 1024, 768, 70 },
+ { 1024, 768, 60 },
+ { 1024, 768, 87 },
+ { 832, 624, 75 },
+ { 800, 600, 75 },
+ { 800, 600, 72 }
+ },
+ {
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 1152, 870, 75 }
+ },
+ };
+
+ int i, j, idx;
+
+ idx = 0;
+ for (i = 0; i < 3; ++i)
+ {
+ for (j = 0; j < 8; ++j)
+ {
+ int byte = edid[0x23 + i];
+
+ if (get_bit (byte, j) && established[i][j].frequency != 0)
+ info->established[idx++] = established[i][j];
+ }
+ }
+ return TRUE;
+}
+
+static int
+decode_standard_timings (const uchar *edid, MonitorInfo *info)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ int first = edid[0x26 + 2 * i];
+ int second = edid[0x27 + 2 * i];
+
+ if (first != 0x01 && second != 0x01)
+ {
+ int w = 8 * (first + 31);
+ int h = 0;
+
+ switch (get_bits (second, 6, 7))
+ {
+ case 0x00: h = (w / 16) * 10; break;
+ case 0x01: h = (w / 4) * 3; break;
+ case 0x02: h = (w / 5) * 4; break;
+ case 0x03: h = (w / 16) * 9; break;
+ }
+
+ info->standard[i].width = w;
+ info->standard[i].height = h;
+ info->standard[i].frequency = get_bits (second, 0, 5) + 60;
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+decode_lf_string (const uchar *s, int n_chars, char *result)
+{
+ int i;
+ for (i = 0; i < n_chars; ++i)
+ {
+ if (s[i] == 0x0a)
+ {
+ *result++ = '\0';
+ break;
+ }
+ else if (s[i] == 0x00)
+ {
+ /* Convert embedded 0's to spaces */
+ *result++ = ' ';
+ }
+ else
+ {
+ *result++ = s[i];
+ }
+ }
+}
+
+static void
+decode_display_descriptor (const uchar *desc,
+ MonitorInfo *info)
+{
+ switch (desc[0x03])
+ {
+ case 0xFC:
+ decode_lf_string (desc + 5, 13, info->dsc_product_name);
+ break;
+ case 0xFF:
+ decode_lf_string (desc + 5, 13, info->dsc_serial_number);
+ break;
+ case 0xFE:
+ decode_lf_string (desc + 5, 13, info->dsc_string);
+ break;
+ case 0xFD:
+ /* Range Limits */
+ break;
+ case 0xFB:
+ /* Color Point */
+ break;
+ case 0xFA:
+ /* Timing Identifications */
+ break;
+ case 0xF9:
+ /* Color Management */
+ break;
+ case 0xF8:
+ /* Timing Codes */
+ break;
+ case 0xF7:
+ /* Established Timings */
+ break;
+ case 0x10:
+ break;
+ }
+}
+
+static void
+decode_detailed_timing (const uchar *timing,
+ DetailedTiming *detailed)
+{
+ int bits;
+ StereoType stereo[] =
+ {
+ NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT,
+ TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN,
+ FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE
+ };
+
+ detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000;
+ detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4);
+ detailed->h_blank = timing[0x03] | ((timing[0x04] & 0x0f) << 8);
+ detailed->v_addr = timing[0x05] | ((timing[0x07] & 0xf0) << 4);
+ detailed->v_blank = timing[0x06] | ((timing[0x07] & 0x0f) << 8);
+ detailed->h_front_porch = timing[0x08] | get_bits (timing[0x0b], 6, 7) << 8;
+ detailed->h_sync = timing[0x09] | get_bits (timing[0x0b], 4, 5) << 8;
+ detailed->v_front_porch =
+ get_bits (timing[0x0a], 4, 7) | get_bits (timing[0x0b], 2, 3) << 4;
+ detailed->v_sync =
+ get_bits (timing[0x0a], 0, 3) | get_bits (timing[0x0b], 0, 1) << 4;
+ detailed->width_mm = timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8;
+ detailed->height_mm = timing[0x0d] | get_bits (timing[0x0e], 0, 3) << 8;
+ detailed->right_border = timing[0x0f];
+ detailed->top_border = timing[0x10];
+
+ detailed->interlaced = get_bit (timing[0x11], 7);
+
+ /* Stereo */
+ bits = get_bits (timing[0x11], 5, 6) << 1 | get_bit (timing[0x11], 0);
+ detailed->stereo = stereo[bits];
+
+ /* Sync */
+ bits = timing[0x11];
+
+ detailed->digital_sync = get_bit (bits, 4);
+ if (detailed->digital_sync)
+ {
+ detailed->ad.digital.composite = !get_bit (bits, 3);
+
+ if (detailed->ad.digital.composite)
+ {
+ detailed->ad.digital.serrations = get_bit (bits, 2);
+ detailed->ad.digital.negative_vsync = FALSE;
+ }
+ else
+ {
+ detailed->ad.digital.serrations = FALSE;
+ detailed->ad.digital.negative_vsync = !get_bit (bits, 2);
+ }
+
+ detailed->ad.digital.negative_hsync = !get_bit (bits, 0);
+ }
+ else
+ {
+ detailed->ad.analog.bipolar = get_bit (bits, 3);
+ detailed->ad.analog.serrations = get_bit (bits, 2);
+ detailed->ad.analog.sync_on_green = !get_bit (bits, 1);
+ }
+}
+
+static int
+decode_descriptors (const uchar *edid, MonitorInfo *info)
+{
+ int i;
+ int timing_idx;
+
+ timing_idx = 0;
+
+ for (i = 0; i < 4; ++i)
+ {
+ int index = 0x36 + i * 18;
+
+ if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00)
+ {
+ decode_display_descriptor (edid + index, info);
+ }
+ else
+ {
+ decode_detailed_timing (
+ edid + index, &(info->detailed_timings[timing_idx++]));
+ }
+ }
+
+ info->n_detailed_timings = timing_idx;
+
+ return TRUE;
+}
+
+static void
+decode_check_sum (const uchar *edid,
+ MonitorInfo *info)
+{
+ int i;
+ uchar check = 0;
+
+ for (i = 0; i < 128; ++i)
+ check += edid[i];
+
+ info->checksum = check;
+}
+
+MonitorInfo *
+decode_edid (const uchar *edid)
+{
+ MonitorInfo *info = calloc (1, sizeof (MonitorInfo));
+
+ decode_check_sum (edid, info);
+
+ if (!decode_header (edid) ||
+ !decode_vendor_and_product_identification (edid, info) ||
+ !decode_edid_version (edid, info) ||
+ !decode_display_parameters (edid, info) ||
+ !decode_color_characteristics (edid, info) ||
+ !decode_established_timings (edid, info) ||
+ !decode_standard_timings (edid, info) ||
+ !decode_descriptors (edid, info)) {
+ free(info);
+ return NULL;
+ }
+
+ return info;
+}
+
+static const char *
+yesno (int v)
+{
+ return v? "yes" : "no";
+}
+
+void
+dump_monitor_info (MonitorInfo *info)
+{
+ int i;
+
+ printf ("Checksum: %d (%s)\n",
+ info->checksum, info->checksum? "incorrect" : "correct");
+ printf ("Manufacturer Code: %s\n", info->manufacturer_code);
+ printf ("Product Code: 0x%x\n", info->product_code);
+ printf ("Serial Number: %u\n", info->serial_number);
+
+ if (info->production_week != -1)
+ printf ("Production Week: %d\n", info->production_week);
+ else
+ printf ("Production Week: unspecified\n");
+
+ if (info->production_year != -1)
+ printf ("Production Year: %d\n", info->production_year);
+ else
+ printf ("Production Year: unspecified\n");
+
+ if (info->model_year != -1)
+ printf ("Model Year: %d\n", info->model_year);
+ else
+ printf ("Model Year: unspecified\n");
+
+ printf ("EDID revision: %d.%d\n", info->major_version, info->minor_version);
+
+ printf ("Display is %s\n", info->is_digital? "digital" : "analog");
+ if (info->is_digital)
+ {
+ const char *interface;
+ if (info->ad.digital.bits_per_primary != -1)
+ printf ("Bits Per Primary: %d\n", info->ad.digital.bits_per_primary);
+ else
+ printf ("Bits Per Primary: undefined\n");
+
+ switch (info->ad.digital.interface)
+ {
+ case DVI: interface = "DVI"; break;
+ case HDMI_A: interface = "HDMI-a"; break;
+ case HDMI_B: interface = "HDMI-b"; break;
+ case MDDI: interface = "MDDI"; break;
+ case DISPLAY_PORT: interface = "DisplayPort"; break;
+ case UNDEFINED: interface = "undefined"; break;
+ default: interface = "unknown"; break;
+ }
+ printf ("Interface: %s\n", interface);
+
+ printf ("RGB 4:4:4: %s\n", yesno (info->ad.digital.rgb444));
+ printf ("YCrCb 4:4:4: %s\n", yesno (info->ad.digital.ycrcb444));
+ printf ("YCrCb 4:2:2: %s\n", yesno (info->ad.digital.ycrcb422));
+ }
+ else
+ {
+ const char *s;
+ printf ("Video Signal Level: %f\n", info->ad.analog.video_signal_level);
+ printf ("Sync Signal Level: %f\n", info->ad.analog.sync_signal_level);
+ printf ("Total Signal Level: %f\n", info->ad.analog.total_signal_level);
+
+ printf ("Blank to Black: %s\n",
+ yesno (info->ad.analog.blank_to_black));
+ printf ("Separate HV Sync: %s\n",
+ yesno (info->ad.analog.separate_hv_sync));
+ printf ("Composite Sync on H: %s\n",
+ yesno (info->ad.analog.composite_sync_on_h));
+ printf ("Serration on VSync: %s\n",
+ yesno (info->ad.analog.serration_on_vsync));
+
+ switch (info->ad.analog.color_type)
+ {
+ case UNDEFINED_COLOR: s = "undefined"; break;
+ case MONOCHROME: s = "monochrome"; break;
+ case RGB: s = "rgb"; break;
+ case OTHER_COLOR: s = "other color"; break;
+ default: s = "unknown"; break;
+ };
+
+ printf ("Color: %s\n", s);
+ }
+
+ if (info->width_mm == -1)
+ printf ("Width: undefined\n");
+ else
+ printf ("Width: %d mm\n", info->width_mm);
+
+ if (info->height_mm == -1)
+ printf ("Height: undefined\n");
+ else
+ printf ("Height: %d mm\n", info->height_mm);
+
+ if (info->aspect_ratio > 0)
+ printf ("Aspect Ratio: %f\n", info->aspect_ratio);
+ else
+ printf ("Aspect Ratio: undefined\n");
+
+ if (info->gamma >= 0)
+ printf ("Gamma: %f\n", info->gamma);
+ else
+ printf ("Gamma: undefined\n");
+
+ printf ("Standby: %s\n", yesno (info->standby));
+ printf ("Suspend: %s\n", yesno (info->suspend));
+ printf ("Active Off: %s\n", yesno (info->active_off));
+
+ printf ("SRGB is Standard: %s\n", yesno (info->srgb_is_standard));
+ printf ("Preferred Timing Includes Native: %s\n",
+ yesno (info->preferred_timing_includes_native));
+ printf ("Continuous Frequency: %s\n", yesno (info->continuous_frequency));
+
+ printf ("Red X: %f\n", info->red_x);
+ printf ("Red Y: %f\n", info->red_y);
+ printf ("Green X: %f\n", info->green_x);
+ printf ("Green Y: %f\n", info->green_y);
+ printf ("Blue X: %f\n", info->blue_x);
+ printf ("Blue Y: %f\n", info->blue_y);
+ printf ("White X: %f\n", info->white_x);
+ printf ("White Y: %f\n", info->white_y);
+
+ printf ("Established Timings:\n");
+
+ for (i = 0; i < 24; ++i)
+ {
+ Timing *timing = &(info->established[i]);
+
+ if (timing->frequency == 0)
+ break;
+
+ printf (" %d x %d @ %d Hz\n",
+ timing->width, timing->height, timing->frequency);
+
+ }
+
+ printf ("Standard Timings:\n");
+ for (i = 0; i < 8; ++i)
+ {
+ Timing *timing = &(info->standard[i]);
+
+ if (timing->frequency == 0)
+ break;
+
+ printf (" %d x %d @ %d Hz\n",
+ timing->width, timing->height, timing->frequency);
+ }
+
+ for (i = 0; i < info->n_detailed_timings; ++i)
+ {
+ DetailedTiming *timing = &(info->detailed_timings[i]);
+ const char *s;
+
+ printf ("Timing%s: \n",
+ (i == 0 && info->preferred_timing_includes_native)?
+ " (Preferred)" : "");
+ printf (" Pixel Clock: %d\n", timing->pixel_clock);
+ printf (" H Addressable: %d\n", timing->h_addr);
+ printf (" H Blank: %d\n", timing->h_blank);
+ printf (" H Front Porch: %d\n", timing->h_front_porch);
+ printf (" H Sync: %d\n", timing->h_sync);
+ printf (" V Addressable: %d\n", timing->v_addr);
+ printf (" V Blank: %d\n", timing->v_blank);
+ printf (" V Front Porch: %d\n", timing->v_front_porch);
+ printf (" V Sync: %d\n", timing->v_sync);
+ printf (" Width: %d mm\n", timing->width_mm);
+ printf (" Height: %d mm\n", timing->height_mm);
+ printf (" Right Border: %d\n", timing->right_border);
+ printf (" Top Border: %d\n", timing->top_border);
+ switch (timing->stereo)
+ {
+ default:
+ case NO_STEREO: s = "No Stereo"; break;
+ case FIELD_RIGHT: s = "Field Sequential, Right on Sync"; break;
+ case FIELD_LEFT: s = "Field Sequential, Left on Sync"; break;
+ case TWO_WAY_RIGHT_ON_EVEN: s = "Two-way, Right on Even"; break;
+ case TWO_WAY_LEFT_ON_EVEN: s = "Two-way, Left on Even"; break;
+ case FOUR_WAY_INTERLEAVED: s = "Four-way Interleaved"; break;
+ case SIDE_BY_SIDE: s = "Side-by-Side"; break;
+ }
+ printf (" Stereo: %s\n", s);
+
+ if (timing->digital_sync)
+ {
+ printf (" Digital Sync:\n");
+ printf (" composite: %s\n", yesno (timing->ad.digital.composite));
+ printf (" serrations: %s\n", yesno (timing->ad.digital.serrations));
+ printf (" negative vsync: %s\n",
+ yesno (timing->ad.digital.negative_vsync));
+ printf (" negative hsync: %s\n",
+ yesno (timing->ad.digital.negative_hsync));
+ }
+ else
+ {
+ printf (" Analog Sync:\n");
+ printf (" bipolar: %s\n", yesno (timing->ad.analog.bipolar));
+ printf (" serrations: %s\n", yesno (timing->ad.analog.serrations));
+ printf (" sync on green: %s\n", yesno (
+ timing->ad.analog.sync_on_green));
+ }
+ }
+
+ printf ("Detailed Product information:\n");
+ printf (" Product Name: %s\n", info->dsc_product_name);
+ printf (" Serial Number: %s\n", info->dsc_serial_number);
+ printf (" Unspecified String: %s\n", info->dsc_string);
+}
+
diff --git a/src/3rdparty/SDL2/src/video/x11/edid.h b/src/3rdparty/SDL2/src/video/x11/edid.h
new file mode 100644
index 0000000..cb9f0e8
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/edid.h
@@ -0,0 +1,167 @@
+typedef unsigned char uchar;
+typedef struct MonitorInfo MonitorInfo;
+typedef struct Timing Timing;
+typedef struct DetailedTiming DetailedTiming;
+
+typedef enum
+{
+ UNDEFINED,
+ DVI,
+ HDMI_A,
+ HDMI_B,
+ MDDI,
+ DISPLAY_PORT
+} Interface;
+
+typedef enum
+{
+ UNDEFINED_COLOR,
+ MONOCHROME,
+ RGB,
+ OTHER_COLOR
+} ColorType;
+
+typedef enum
+{
+ NO_STEREO,
+ FIELD_RIGHT,
+ FIELD_LEFT,
+ TWO_WAY_RIGHT_ON_EVEN,
+ TWO_WAY_LEFT_ON_EVEN,
+ FOUR_WAY_INTERLEAVED,
+ SIDE_BY_SIDE
+} StereoType;
+
+struct Timing
+{
+ int width;
+ int height;
+ int frequency;
+};
+
+struct DetailedTiming
+{
+ int pixel_clock;
+ int h_addr;
+ int h_blank;
+ int h_sync;
+ int h_front_porch;
+ int v_addr;
+ int v_blank;
+ int v_sync;
+ int v_front_porch;
+ int width_mm;
+ int height_mm;
+ int right_border;
+ int top_border;
+ int interlaced;
+ StereoType stereo;
+
+ int digital_sync;
+ union
+ {
+ struct
+ {
+ int bipolar;
+ int serrations;
+ int sync_on_green;
+ } analog;
+
+ struct
+ {
+ int composite;
+ int serrations;
+ int negative_vsync;
+ int negative_hsync;
+ } digital;
+ } ad;
+};
+
+struct MonitorInfo
+{
+ int checksum;
+ char manufacturer_code[4];
+ int product_code;
+ unsigned int serial_number;
+
+ int production_week; /* -1 if not specified */
+ int production_year; /* -1 if not specified */
+ int model_year; /* -1 if not specified */
+
+ int major_version;
+ int minor_version;
+
+ int is_digital;
+
+ union
+ {
+ struct
+ {
+ int bits_per_primary;
+ Interface interface;
+ int rgb444;
+ int ycrcb444;
+ int ycrcb422;
+ } digital;
+
+ struct
+ {
+ double video_signal_level;
+ double sync_signal_level;
+ double total_signal_level;
+
+ int blank_to_black;
+
+ int separate_hv_sync;
+ int composite_sync_on_h;
+ int composite_sync_on_green;
+ int serration_on_vsync;
+ ColorType color_type;
+ } analog;
+ } ad;
+
+ int width_mm; /* -1 if not specified */
+ int height_mm; /* -1 if not specified */
+ double aspect_ratio; /* -1.0 if not specififed */
+
+ double gamma; /* -1.0 if not specified */
+
+ int standby;
+ int suspend;
+ int active_off;
+
+ int srgb_is_standard;
+ int preferred_timing_includes_native;
+ int continuous_frequency;
+
+ double red_x;
+ double red_y;
+ double green_x;
+ double green_y;
+ double blue_x;
+ double blue_y;
+ double white_x;
+ double white_y;
+
+ Timing established[24]; /* Terminated by 0x0x0 */
+ Timing standard[8];
+
+ int n_detailed_timings;
+ DetailedTiming detailed_timings[4]; /* If monitor has a preferred
+ * mode, it is the first one
+ * (whether it has, is
+ * determined by the
+ * preferred_timing_includes
+ * bit.
+ */
+
+ /* Optional product description */
+ char dsc_serial_number[14];
+ char dsc_product_name[14];
+ char dsc_string[14]; /* Unspecified ASCII data */
+};
+
+MonitorInfo *decode_edid (const uchar *data);
+void dump_monitor_info (MonitorInfo *info);
+char * make_display_name (const char *output_name,
+ const MonitorInfo *info);
diff --git a/src/3rdparty/SDL2/src/video/x11/imKStoUCS.c b/src/3rdparty/SDL2/src/video/x11/imKStoUCS.c
new file mode 100644
index 0000000..40e2242
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/imKStoUCS.c
@@ -0,0 +1,350 @@
+/*
+Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett
+Copyright © 2009 Red Hat, Inc.
+Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11
+#include <X11/X.h>
+#include "imKStoUCS.h"
+
+static unsigned short const keysym_to_unicode_1a1_1ff[] = {
+ 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */
+ 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */
+ 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */
+ 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */
+ 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */
+ 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */
+ 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */
+ 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */
+ 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */
+ 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */
+ 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */
+ 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */
+};
+
+static unsigned short const keysym_to_unicode_2a1_2fe[] = {
+ 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */
+ 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */
+ 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */
+ 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */
+ 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */
+ 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */
+};
+
+static unsigned short const keysym_to_unicode_3a2_3fe[] = {
+ 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */
+ 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */
+ 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */
+ 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */
+ 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */
+ 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */
+ 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */
+ 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */
+ 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */
+ 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */
+};
+
+static unsigned short const keysym_to_unicode_4a1_4df[] = {
+ 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */
+ 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */
+ 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */
+ 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */
+ 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */
+ 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */
+ 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */
+ 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */
+};
+
+static unsigned short const keysym_to_unicode_590_5fe[] = {
+ 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */
+ 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */
+
+ 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */
+ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */
+ 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */
+ 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */
+ 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */
+ 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */
+ 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */
+ 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */
+ 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */
+ 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */
+ 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */
+};
+
+static unsigned short keysym_to_unicode_680_6ff[] = {
+ 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */
+ 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */
+ 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */
+ 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */
+ 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */
+ 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */
+ 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */
+ 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */
+ 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */
+ 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */
+ 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */
+ 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */
+ 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */
+ 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */
+ 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */
+ 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */
+};
+
+static unsigned short const keysym_to_unicode_7a1_7f9[] = {
+ 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */
+ 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */
+ 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */
+ 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */
+ 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */
+ 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */
+ 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */
+ 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */
+ 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */
+ 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */
+ 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */
+ 0x03c8, 0x03c9 /* 0x07f8-0x07ff */
+};
+
+static unsigned short const keysym_to_unicode_8a4_8fe[] = {
+ 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */
+ 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */
+ 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */
+ 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x21d2, 0x0000, /* 0x08c8-0x08cf */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */
+ 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, /* 0x08e8-0x08ef */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */
+ 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */
+};
+
+static unsigned short const keysym_to_unicode_9df_9f8[] = {
+ 0x2422, /* 0x09d8-0x09df */
+ 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */
+ 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */
+ 0x2502 /* 0x09f8-0x09ff */
+};
+
+static unsigned short const keysym_to_unicode_aa1_afe[] = {
+ 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */
+ 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */
+ 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */
+ 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */
+ 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */
+ 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */
+ 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */
+ 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */
+ 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */
+ 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */
+ 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */
+ 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */
+};
+
+/* none of the APL keysyms match the Unicode characters */
+
+static unsigned short const keysym_to_unicode_cdf_cfa[] = {
+ 0x2017, /* 0x0cd8-0x0cdf */
+ 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */
+ 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */
+ 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */
+ 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */
+};
+
+static unsigned short const keysym_to_unicode_da1_df9[] = {
+ 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */
+ 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */
+ 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */
+ 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */
+ 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */
+ 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */
+ 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */
+ 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */
+ 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */
+ 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */
+ 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */
+ 0x0e58, 0x0e59 /* 0x0df8-0x0dff */
+};
+
+static unsigned short const keysym_to_unicode_ea0_eff[] = {
+ 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */
+ 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */
+ 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */
+ 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */
+ 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */
+ 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */
+ 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */
+ 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */
+ 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */
+ 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */
+ 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */
+ 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */
+};
+
+static unsigned short keysym_to_unicode_12a1_12fe[] = {
+ 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */
+ 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */
+ 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */
+ 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */
+ 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */
+ 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */
+};
+
+static unsigned short const keysym_to_unicode_13bc_13be[] = {
+ 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */
+};
+
+static unsigned short keysym_to_unicode_14a1_14ff[] = {
+ 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */
+ 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */
+ 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */
+ 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */
+ 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */
+ 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */
+ 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */
+ 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */
+ 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */
+ 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */
+ 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */
+ 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */
+};
+
+static unsigned short keysym_to_unicode_15d0_15f6[] = {
+ 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */
+ 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */
+ 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */
+ 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */
+ 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */
+};
+
+static unsigned short keysym_to_unicode_16a0_16f6[] = {
+ 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */
+ 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */
+ 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */
+ 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */
+ 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */
+ 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */
+};
+
+static unsigned short const keysym_to_unicode_1e9f_1eff[] = {
+ 0x0303,
+ 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */
+ 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */
+ 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */
+ 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */
+ 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */
+ 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */
+ 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */
+ 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */
+ 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */
+ 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */
+ 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */
+ 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */
+};
+
+static unsigned short const keysym_to_unicode_20a0_20ac[] = {
+ 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */
+ 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */
+};
+
+unsigned int
+X11_KeySymToUcs4(KeySym keysym)
+{
+ /* 'Unicode keysym' */
+ if ((keysym & 0xff000000) == 0x01000000)
+ return (keysym & 0x00ffffff);
+
+ if (keysym > 0 && keysym < 0x100)
+ return keysym;
+ else if (keysym > 0x1a0 && keysym < 0x200)
+ return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
+ else if (keysym > 0x2a0 && keysym < 0x2ff)
+ return keysym_to_unicode_2a1_2fe[keysym - 0x2a1];
+ else if (keysym > 0x3a1 && keysym < 0x3ff)
+ return keysym_to_unicode_3a2_3fe[keysym - 0x3a2];
+ else if (keysym > 0x4a0 && keysym < 0x4e0)
+ return keysym_to_unicode_4a1_4df[keysym - 0x4a1];
+ else if (keysym > 0x589 && keysym < 0x5ff)
+ return keysym_to_unicode_590_5fe[keysym - 0x590];
+ else if (keysym > 0x67f && keysym < 0x700)
+ return keysym_to_unicode_680_6ff[keysym - 0x680];
+ else if (keysym > 0x7a0 && keysym < 0x7fa)
+ return keysym_to_unicode_7a1_7f9[keysym - 0x7a1];
+ else if (keysym > 0x8a3 && keysym < 0x8ff)
+ return keysym_to_unicode_8a4_8fe[keysym - 0x8a4];
+ else if (keysym > 0x9de && keysym < 0x9f9)
+ return keysym_to_unicode_9df_9f8[keysym - 0x9df];
+ else if (keysym > 0xaa0 && keysym < 0xaff)
+ return keysym_to_unicode_aa1_afe[keysym - 0xaa1];
+ else if (keysym > 0xcde && keysym < 0xcfb)
+ return keysym_to_unicode_cdf_cfa[keysym - 0xcdf];
+ else if (keysym > 0xda0 && keysym < 0xdfa)
+ return keysym_to_unicode_da1_df9[keysym - 0xda1];
+ else if (keysym > 0xe9f && keysym < 0xf00)
+ return keysym_to_unicode_ea0_eff[keysym - 0xea0];
+ else if (keysym > 0x12a0 && keysym < 0x12ff)
+ return keysym_to_unicode_12a1_12fe[keysym - 0x12a1];
+ else if (keysym > 0x13bb && keysym < 0x13bf)
+ return keysym_to_unicode_13bc_13be[keysym - 0x13bc];
+ else if (keysym > 0x14a0 && keysym < 0x1500)
+ return keysym_to_unicode_14a1_14ff[keysym - 0x14a1];
+ else if (keysym > 0x15cf && keysym < 0x15f7)
+ return keysym_to_unicode_15d0_15f6[keysym - 0x15d0];
+ else if (keysym > 0x169f && keysym < 0x16f7)
+ return keysym_to_unicode_16a0_16f6[keysym - 0x16a0];
+ else if (keysym > 0x1e9e && keysym < 0x1f00)
+ return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
+ else if (keysym > 0x209f && keysym < 0x20ad)
+ return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
+ else
+ return 0;
+}
+
+#endif /* SDL_VIDEO_DRIVER_X11 */
+
diff --git a/src/3rdparty/SDL2/src/video/x11/imKStoUCS.h b/src/3rdparty/SDL2/src/video/x11/imKStoUCS.h
new file mode 100644
index 0000000..fe4381d
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/x11/imKStoUCS.h
@@ -0,0 +1,32 @@
+#ifndef _imKStoUCS_h
+#define _imKStoUCS_h
+
+/*
+Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett
+Copyright © 2009 Red Hat, Inc.
+Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+extern unsigned int X11_KeySymToUcs4(KeySym keysym);
+
+#endif /* _imKStoUCS_h */
diff --git a/src/3rdparty/SDL2/src/video/yuv2rgb/LICENSE b/src/3rdparty/SDL2/src/video/yuv2rgb/LICENSE
new file mode 100644
index 0000000..a76efd7
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/yuv2rgb/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2016, Adrien Descamps
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of yuv2rgb nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/SDL2/src/video/yuv2rgb/README.md b/src/3rdparty/SDL2/src/video/yuv2rgb/README.md
new file mode 100644
index 0000000..21191e9
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/yuv2rgb/README.md
@@ -0,0 +1,63 @@
+From: https://github.com/descampsa/yuv2rgb
+# yuv2rgb
+C library for fast image conversion between yuv420p and rgb24.
+
+This is a simple library for optimized image conversion between YUV420p and rgb24.
+It was done mainly as an exercise to learn to use sse intrinsics, so there may still be room for optimization.
+
+For each conversion, a standard c optimized function and two sse function (with aligned and unaligned memory) are implemented.
+The sse version requires only SSE2, which is available on any reasonably recent CPU.
+The library also supports the three different YUV (YCrCb to be correct) color spaces that exist (see comments in code), and others can be added simply.
+
+There is a simple test program, that convert a raw YUV file to rgb ppm format, and measure computation time.
+Optionally, it also compares the result and computation time with the ffmpeg implementation (that uses MMX), and with the IPP functions.
+
+To compile, simply do :
+
+ mkdir build
+ cd build
+ cmake -DCMAKE_BUILD_TYPE=Release ..
+ make
+
+The test program only support raw YUV files for the YUV420 format, and ppm for the RGB24 format.
+To generate a raw yuv file, you can use avconv:
+
+ avconv -i example.jpg -c:v rawvideo -pix_fmt yuv420p example.yuv
+
+To generate the rgb file, you can use the ImageMagick convert program:
+
+ convert example.jpg example.ppm
+
+Then, for YUV420 to RGB24 conversion, use the test program like that:
+
+ ./test_yuv_rgb yuv2rgb image.yuv 4096 2160 image
+
+The second and third parameters are image width and height (that are needed because not available in the raw YUV file), and fourth parameter is the output filename template (several output files will be generated, named for example output_sse.ppm, output_av.ppm, etc.)
+
+Similarly, for RGB24 to YUV420 conversion:
+
+ ./test_yuv_rgb yuv2rgb image.ppm image
+
+On my computer, the test program on a 4K image give the following for yuv2rgb:
+
+ Time will be measured in each configuration for 100 iterations...
+ Processing time (std) : 2.630193 sec
+ Processing time (sse2_unaligned) : 0.704394 sec
+ Processing time (ffmpeg_unaligned) : 1.221432 sec
+ Processing time (ipp_unaligned) : 0.636274 sec
+ Processing time (sse2_aligned) : 0.606648 sec
+ Processing time (ffmpeg_aligned) : 1.227100 sec
+ Processing time (ipp_aligned) : 0.636951 sec
+
+And for rgb2yuv:
+
+ Time will be measured in each configuration for 100 iterations...
+ Processing time (std) : 2.588675 sec
+ Processing time (sse2_unaligned) : 0.676625 sec
+ Processing time (ffmpeg_unaligned) : 3.385816 sec
+ Processing time (ipp_unaligned) : 0.593890 sec
+ Processing time (sse2_aligned) : 0.640630 sec
+ Processing time (ffmpeg_aligned) : 3.397952 sec
+ Processing time (ipp_aligned) : 0.579043 sec
+
+configuration : gcc 4.9.2, swscale 3.0.0, IPP 9.0.1, intel i7-5500U
diff --git a/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.c b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.c
new file mode 100644
index 0000000..891dae2
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.c
@@ -0,0 +1,687 @@
+// Copyright 2016 Adrien Descamps
+// Distributed under BSD 3-Clause License
+#include "../../SDL_internal.h"
+
+#include "yuv_rgb.h"
+
+#include "SDL_cpuinfo.h"
+/*#include <x86intrin.h>*/
+
+#define PRECISION 6
+#define PRECISION_FACTOR (1<<PRECISION)
+
+typedef struct
+{
+ uint8_t y_shift;
+ int16_t matrix[3][3];
+} RGB2YUVParam;
+// |Y| |y_shift| |matrix[0][0] matrix[0][1] matrix[0][2]| |R|
+// |U| = | 128 | + 1/PRECISION_FACTOR * |matrix[1][0] matrix[1][1] matrix[1][2]| * |G|
+// |V| | 128 | |matrix[2][0] matrix[2][1] matrix[2][2]| |B|
+
+typedef struct
+{
+ uint8_t y_shift;
+ int16_t y_factor;
+ int16_t v_r_factor;
+ int16_t u_g_factor;
+ int16_t v_g_factor;
+ int16_t u_b_factor;
+} YUV2RGBParam;
+// |R| |y_factor 0 v_r_factor| |Y-y_shift|
+// |G| = 1/PRECISION_FACTOR * |y_factor u_g_factor v_g_factor| * | U-128 |
+// |B| |y_factor u_b_factor 0 | | V-128 |
+
+#define V(value) (int16_t)((value*PRECISION_FACTOR)+0.5)
+
+// for ITU-T T.871, values can be found in section 7
+// for ITU-R BT.601-7 values are derived from equations in sections 2.5.1-2.5.3, assuming RGB is encoded using full range ([0-1]<->[0-255])
+// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255])
+// all values are rounded to the fourth decimal
+
+static const YUV2RGBParam YUV2RGB[3] = {
+ // ITU-T T.871 (JPEG)
+ {/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)},
+ // ITU-R BT.601-7
+ {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)},
+ // ITU-R BT.709-6
+ {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)}
+};
+
+static const RGB2YUVParam RGB2YUV[3] = {
+ // ITU-T T.871 (JPEG)
+ {/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}},
+ // ITU-R BT.601-7
+ {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}},
+ // ITU-R BT.709-6
+ {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}}
+};
+
+/* The various layouts of YUV data we support */
+#define YUV_FORMAT_420 1
+#define YUV_FORMAT_422 2
+#define YUV_FORMAT_NV12 3
+
+/* The various formats of RGB pixel that we support */
+#define RGB_FORMAT_RGB565 1
+#define RGB_FORMAT_RGB24 2
+#define RGB_FORMAT_RGBA 3
+#define RGB_FORMAT_BGRA 4
+#define RGB_FORMAT_ARGB 5
+#define RGB_FORMAT_ABGR 6
+
+// divide by PRECISION_FACTOR and clamp to [0:255] interval
+// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range
+static uint8_t clampU8(int32_t v)
+{
+ static const uint8_t lut[512] =
+ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
+ 47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
+ 91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
+ 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
+ 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
+ 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,
+ 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+ };
+ return lut[(v+128*PRECISION_FACTOR)>>PRECISION];
+}
+
+
+#define STD_FUNCTION_NAME yuv420_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv420_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv420_rgba_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv420_bgra_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv420_argb_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv420_abgr_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv422_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv422_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv422_rgba_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv422_bgra_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv422_argb_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuv422_abgr_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuvnv12_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuvnv12_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuvnv12_rgba_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuvnv12_bgra_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuvnv12_argb_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#include "yuv_rgb_std_func.h"
+
+#define STD_FUNCTION_NAME yuvnv12_abgr_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#include "yuv_rgb_std_func.h"
+
+void rgb24_yuv420_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *RGB, uint32_t RGB_stride,
+ uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
+ YCbCrType yuv_type)
+{
+ const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
+
+ uint32_t x, y;
+ for(y=0; y<(height-1); y+=2)
+ {
+ const uint8_t *rgb_ptr1=RGB+y*RGB_stride,
+ *rgb_ptr2=RGB+(y+1)*RGB_stride;
+
+ uint8_t *y_ptr1=Y+y*Y_stride,
+ *y_ptr2=Y+(y+1)*Y_stride,
+ *u_ptr=U+(y/2)*UV_stride,
+ *v_ptr=V+(y/2)*UV_stride;
+
+ for(x=0; x<(width-1); x+=2)
+ {
+ // compute yuv for the four pixels, u and v values are summed
+ int32_t y_tmp, u_tmp, v_tmp;
+
+ y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2];
+ u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2];
+ v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2];
+ y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
+
+ y_tmp = param->matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5];
+ u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5];
+ v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5];
+ y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
+
+ y_tmp = param->matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2];
+ u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2];
+ v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2];
+ y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
+
+ y_tmp = param->matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5];
+ u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5];
+ v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5];
+ y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
+
+ u_ptr[0] = clampU8(u_tmp/4+(128<<PRECISION));
+ v_ptr[0] = clampU8(v_tmp/4+(128<<PRECISION));
+
+ rgb_ptr1 += 6;
+ rgb_ptr2 += 6;
+ y_ptr1 += 2;
+ y_ptr2 += 2;
+ u_ptr += 1;
+ v_ptr += 1;
+ }
+ }
+}
+
+#ifdef __SSE2__
+
+#define SSE_FUNCTION_NAME yuv420_rgb565_sse
+#define STD_FUNCTION_NAME yuv420_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_rgb565_sseu
+#define STD_FUNCTION_NAME yuv420_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_rgb24_sse
+#define STD_FUNCTION_NAME yuv420_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_rgb24_sseu
+#define STD_FUNCTION_NAME yuv420_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_rgba_sse
+#define STD_FUNCTION_NAME yuv420_rgba_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_rgba_sseu
+#define STD_FUNCTION_NAME yuv420_rgba_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_bgra_sse
+#define STD_FUNCTION_NAME yuv420_bgra_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_bgra_sseu
+#define STD_FUNCTION_NAME yuv420_bgra_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_argb_sse
+#define STD_FUNCTION_NAME yuv420_argb_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_argb_sseu
+#define STD_FUNCTION_NAME yuv420_argb_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_abgr_sse
+#define STD_FUNCTION_NAME yuv420_abgr_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv420_abgr_sseu
+#define STD_FUNCTION_NAME yuv420_abgr_std
+#define YUV_FORMAT YUV_FORMAT_420
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_rgb565_sse
+#define STD_FUNCTION_NAME yuv422_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_rgb565_sseu
+#define STD_FUNCTION_NAME yuv422_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_rgb24_sse
+#define STD_FUNCTION_NAME yuv422_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_rgb24_sseu
+#define STD_FUNCTION_NAME yuv422_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_rgba_sse
+#define STD_FUNCTION_NAME yuv422_rgba_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_rgba_sseu
+#define STD_FUNCTION_NAME yuv422_rgba_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_bgra_sse
+#define STD_FUNCTION_NAME yuv422_bgra_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_bgra_sseu
+#define STD_FUNCTION_NAME yuv422_bgra_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_argb_sse
+#define STD_FUNCTION_NAME yuv422_argb_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_argb_sseu
+#define STD_FUNCTION_NAME yuv422_argb_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_abgr_sse
+#define STD_FUNCTION_NAME yuv422_abgr_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuv422_abgr_sseu
+#define STD_FUNCTION_NAME yuv422_abgr_std
+#define YUV_FORMAT YUV_FORMAT_422
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_rgb565_sse
+#define STD_FUNCTION_NAME yuvnv12_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_rgb565_sseu
+#define STD_FUNCTION_NAME yuvnv12_rgb565_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGB565
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_rgb24_sse
+#define STD_FUNCTION_NAME yuvnv12_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_rgb24_sseu
+#define STD_FUNCTION_NAME yuvnv12_rgb24_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGB24
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_rgba_sse
+#define STD_FUNCTION_NAME yuvnv12_rgba_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_rgba_sseu
+#define STD_FUNCTION_NAME yuvnv12_rgba_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_RGBA
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_bgra_sse
+#define STD_FUNCTION_NAME yuvnv12_bgra_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_bgra_sseu
+#define STD_FUNCTION_NAME yuvnv12_bgra_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_BGRA
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_argb_sse
+#define STD_FUNCTION_NAME yuvnv12_argb_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_argb_sseu
+#define STD_FUNCTION_NAME yuvnv12_argb_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_ARGB
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_abgr_sse
+#define STD_FUNCTION_NAME yuvnv12_abgr_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#define SSE_ALIGNED
+#include "yuv_rgb_sse_func.h"
+
+#define SSE_FUNCTION_NAME yuvnv12_abgr_sseu
+#define STD_FUNCTION_NAME yuvnv12_abgr_std
+#define YUV_FORMAT YUV_FORMAT_NV12
+#define RGB_FORMAT RGB_FORMAT_ABGR
+#include "yuv_rgb_sse_func.h"
+
+
+#define UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+R1 = _mm_unpacklo_epi8(RGB1, RGB4); \
+R2 = _mm_unpackhi_epi8(RGB1, RGB4); \
+G1 = _mm_unpacklo_epi8(RGB2, RGB5); \
+G2 = _mm_unpackhi_epi8(RGB2, RGB5); \
+B1 = _mm_unpacklo_epi8(RGB3, RGB6); \
+B2 = _mm_unpackhi_epi8(RGB3, RGB6);
+
+#define UNPACK_RGB24_32_STEP2(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+RGB1 = _mm_unpacklo_epi8(R1, G2); \
+RGB2 = _mm_unpackhi_epi8(R1, G2); \
+RGB3 = _mm_unpacklo_epi8(R2, B1); \
+RGB4 = _mm_unpackhi_epi8(R2, B1); \
+RGB5 = _mm_unpacklo_epi8(G1, B2); \
+RGB6 = _mm_unpackhi_epi8(G1, B2); \
+
+#define UNPACK_RGB24_32(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+UNPACK_RGB24_32_STEP2(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+UNPACK_RGB24_32_STEP2(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
+
+#define RGB2YUV_16(R, G, B, Y, U, V) \
+Y = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[0][0])), \
+ _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \
+Y = _mm_add_epi16(Y, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[0][2]))); \
+Y = _mm_add_epi16(Y, _mm_set1_epi16((param->y_shift)<<PRECISION)); \
+Y = _mm_srai_epi16(Y, PRECISION); \
+U = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[1][0])), \
+ _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \
+U = _mm_add_epi16(U, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[1][2]))); \
+U = _mm_add_epi16(U, _mm_set1_epi16(128<<PRECISION)); \
+U = _mm_srai_epi16(U, PRECISION); \
+V = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[2][0])), \
+ _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \
+V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \
+V = _mm_add_epi16(V, _mm_set1_epi16(128<<PRECISION)); \
+V = _mm_srai_epi16(V, PRECISION);
+
+#define RGB2YUV_32 \
+ __m128i r1, r2, b1, b2, g1, g2; \
+ __m128i r_16, g_16, b_16; \
+ __m128i y1_16, y2_16, u1_16, u2_16, v1_16, v2_16, y, u1, u2, v1, v2, u1_tmp, u2_tmp, v1_tmp, v2_tmp; \
+ __m128i rgb1 = LOAD_SI128((const __m128i*)(rgb_ptr1)), \
+ rgb2 = LOAD_SI128((const __m128i*)(rgb_ptr1+16)), \
+ rgb3 = LOAD_SI128((const __m128i*)(rgb_ptr1+32)), \
+ rgb4 = LOAD_SI128((const __m128i*)(rgb_ptr2)), \
+ rgb5 = LOAD_SI128((const __m128i*)(rgb_ptr2+16)), \
+ rgb6 = LOAD_SI128((const __m128i*)(rgb_ptr2+32)); \
+ /* unpack rgb24 data to r, g and b data in separate channels*/ \
+ UNPACK_RGB24_32(rgb1, rgb2, rgb3, rgb4, rgb5, rgb6, r1, r2, g1, g2, b1, b2) \
+ /* process pixels of first line */ \
+ r_16 = _mm_unpacklo_epi8(r1, _mm_setzero_si128()); \
+ g_16 = _mm_unpacklo_epi8(g1, _mm_setzero_si128()); \
+ b_16 = _mm_unpacklo_epi8(b1, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
+ r_16 = _mm_unpackhi_epi8(r1, _mm_setzero_si128()); \
+ g_16 = _mm_unpackhi_epi8(g1, _mm_setzero_si128()); \
+ b_16 = _mm_unpackhi_epi8(b1, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
+ y = _mm_packus_epi16(y1_16, y2_16); \
+ u1 = _mm_packus_epi16(u1_16, u2_16); \
+ v1 = _mm_packus_epi16(v1_16, v2_16); \
+ /* save Y values */ \
+ SAVE_SI128((__m128i*)(y_ptr1), y); \
+ /* process pixels of second line */ \
+ r_16 = _mm_unpacklo_epi8(r2, _mm_setzero_si128()); \
+ g_16 = _mm_unpacklo_epi8(g2, _mm_setzero_si128()); \
+ b_16 = _mm_unpacklo_epi8(b2, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
+ r_16 = _mm_unpackhi_epi8(r2, _mm_setzero_si128()); \
+ g_16 = _mm_unpackhi_epi8(g2, _mm_setzero_si128()); \
+ b_16 = _mm_unpackhi_epi8(b2, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
+ y = _mm_packus_epi16(y1_16, y2_16); \
+ u2 = _mm_packus_epi16(u1_16, u2_16); \
+ v2 = _mm_packus_epi16(v1_16, v2_16); \
+ /* save Y values */ \
+ SAVE_SI128((__m128i*)(y_ptr2), y); \
+ /* vertical subsampling of u/v values */ \
+ u1_tmp = _mm_avg_epu8(u1, u2); \
+ v1_tmp = _mm_avg_epu8(v1, v2); \
+ /* do the same again with next data */ \
+ rgb1 = LOAD_SI128((const __m128i*)(rgb_ptr1+48)); \
+ rgb2 = LOAD_SI128((const __m128i*)(rgb_ptr1+64)); \
+ rgb3 = LOAD_SI128((const __m128i*)(rgb_ptr1+80)); \
+ rgb4 = LOAD_SI128((const __m128i*)(rgb_ptr2+48)); \
+ rgb5 = LOAD_SI128((const __m128i*)(rgb_ptr2+64)); \
+ rgb6 = LOAD_SI128((const __m128i*)(rgb_ptr2+80)); \
+ /* unpack rgb24 data to r, g and b data in separate channels*/ \
+ UNPACK_RGB24_32(rgb1, rgb2, rgb3, rgb4, rgb5, rgb6, r1, r2, g1, g2, b1, b2) \
+ /* process pixels of first line */ \
+ r_16 = _mm_unpacklo_epi8(r1, _mm_setzero_si128()); \
+ g_16 = _mm_unpacklo_epi8(g1, _mm_setzero_si128()); \
+ b_16 = _mm_unpacklo_epi8(b1, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
+ r_16 = _mm_unpackhi_epi8(r1, _mm_setzero_si128()); \
+ g_16 = _mm_unpackhi_epi8(g1, _mm_setzero_si128()); \
+ b_16 = _mm_unpackhi_epi8(b1, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
+ y = _mm_packus_epi16(y1_16, y2_16); \
+ u1 = _mm_packus_epi16(u1_16, u2_16); \
+ v1 = _mm_packus_epi16(v1_16, v2_16); \
+ /* save Y values */ \
+ SAVE_SI128((__m128i*)(y_ptr1+16), y); \
+ /* process pixels of second line */ \
+ r_16 = _mm_unpacklo_epi8(r2, _mm_setzero_si128()); \
+ g_16 = _mm_unpacklo_epi8(g2, _mm_setzero_si128()); \
+ b_16 = _mm_unpacklo_epi8(b2, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
+ r_16 = _mm_unpackhi_epi8(r2, _mm_setzero_si128()); \
+ g_16 = _mm_unpackhi_epi8(g2, _mm_setzero_si128()); \
+ b_16 = _mm_unpackhi_epi8(b2, _mm_setzero_si128()); \
+ RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
+ y = _mm_packus_epi16(y1_16, y2_16); \
+ u2 = _mm_packus_epi16(u1_16, u2_16); \
+ v2 = _mm_packus_epi16(v1_16, v2_16); \
+ /* save Y values */ \
+ SAVE_SI128((__m128i*)(y_ptr2+16), y); \
+ /* vertical subsampling of u/v values */ \
+ u2_tmp = _mm_avg_epu8(u1, u2); \
+ v2_tmp = _mm_avg_epu8(v1, v2); \
+ /* horizontal subsampling of u/v values */ \
+ u1 = _mm_packus_epi16(_mm_srl_epi16(u1_tmp, _mm_cvtsi32_si128(8)), _mm_srl_epi16(u2_tmp, _mm_cvtsi32_si128(8))); \
+ v1 = _mm_packus_epi16(_mm_srl_epi16(v1_tmp, _mm_cvtsi32_si128(8)), _mm_srl_epi16(v2_tmp, _mm_cvtsi32_si128(8))); \
+ u2 = _mm_packus_epi16(_mm_and_si128(u1_tmp, _mm_set1_epi16(0xFF)), _mm_and_si128(u2_tmp, _mm_set1_epi16(0xFF))); \
+ v2 = _mm_packus_epi16(_mm_and_si128(v1_tmp, _mm_set1_epi16(0xFF)), _mm_and_si128(v2_tmp, _mm_set1_epi16(0xFF))); \
+ u1 = _mm_avg_epu8(u1, u2); \
+ v1 = _mm_avg_epu8(v1, v2); \
+ SAVE_SI128((__m128i*)(u_ptr), u1); \
+ SAVE_SI128((__m128i*)(v_ptr), v1);
+
+void rgb24_yuv420_sse(uint32_t width, uint32_t height,
+ const uint8_t *RGB, uint32_t RGB_stride,
+ uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
+ YCbCrType yuv_type)
+{
+ #define LOAD_SI128 _mm_load_si128
+ #define SAVE_SI128 _mm_stream_si128
+ const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
+
+ uint32_t xpos, ypos;
+ for(ypos=0; ypos<(height-1); ypos+=2)
+ {
+ const uint8_t *rgb_ptr1=RGB+ypos*RGB_stride,
+ *rgb_ptr2=RGB+(ypos+1)*RGB_stride;
+
+ uint8_t *y_ptr1=Y+ypos*Y_stride,
+ *y_ptr2=Y+(ypos+1)*Y_stride,
+ *u_ptr=U+(ypos/2)*UV_stride,
+ *v_ptr=V+(ypos/2)*UV_stride;
+
+ for(xpos=0; xpos<(width-31); xpos+=32)
+ {
+ RGB2YUV_32
+
+ rgb_ptr1+=96;
+ rgb_ptr2+=96;
+ y_ptr1+=32;
+ y_ptr2+=32;
+ u_ptr+=16;
+ v_ptr+=16;
+ }
+ }
+ #undef LOAD_SI128
+ #undef SAVE_SI128
+}
+
+void rgb24_yuv420_sseu(uint32_t width, uint32_t height,
+ const uint8_t *RGB, uint32_t RGB_stride,
+ uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
+ YCbCrType yuv_type)
+{
+ #define LOAD_SI128 _mm_loadu_si128
+ #define SAVE_SI128 _mm_storeu_si128
+ const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
+
+ uint32_t xpos, ypos;
+ for(ypos=0; ypos<(height-1); ypos+=2)
+ {
+ const uint8_t *rgb_ptr1=RGB+ypos*RGB_stride,
+ *rgb_ptr2=RGB+(ypos+1)*RGB_stride;
+
+ uint8_t *y_ptr1=Y+ypos*Y_stride,
+ *y_ptr2=Y+(ypos+1)*Y_stride,
+ *u_ptr=U+(ypos/2)*UV_stride,
+ *v_ptr=V+(ypos/2)*UV_stride;
+
+ for(xpos=0; xpos<(width-31); xpos+=32)
+ {
+ RGB2YUV_32
+
+ rgb_ptr1+=96;
+ rgb_ptr2+=96;
+ y_ptr1+=32;
+ y_ptr2+=32;
+ u_ptr+=16;
+ v_ptr+=16;
+ }
+ }
+ #undef LOAD_SI128
+ #undef SAVE_SI128
+}
+
+
+#endif //__SSE2__
+
diff --git a/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.h b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.h
new file mode 100644
index 0000000..81d97eb
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb.h
@@ -0,0 +1,381 @@
+// Copyright 2016 Adrien Descamps
+// Distributed under BSD 3-Clause License
+
+// Provide optimized functions to convert images from 8bits yuv420 to rgb24 format
+
+// There are a few slightly different variations of the YCbCr color space with different parameters that
+// change the conversion matrix.
+// The three most common YCbCr color space, defined by BT.601, BT.709 and JPEG standard are implemented here.
+// See the respective standards for details
+// The matrix values used are derived from http://www.equasys.de/colorconversion.html
+
+// YUV420 is stored as three separate channels, with U and V (Cb and Cr) subsampled by a 2 factor
+// For conversion from yuv to rgb, no interpolation is done, and the same UV value are used for 4 rgb pixels. This
+// is suboptimal for image quality, but by far the fastest method.
+
+// For all methods, width and height should be even, if not, the last row/column of the result image won't be affected.
+// For sse methods, if the width if not divisable by 32, the last (width%32) pixels of each line won't be affected.
+
+#include "SDL_stdinc.h"
+/*#include <stdint.h>*/
+
+typedef enum
+{
+ YCBCR_JPEG,
+ YCBCR_601,
+ YCBCR_709
+} YCbCrType;
+
+// yuv to rgb, standard c implementation
+void yuv420_rgb565_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_rgb24_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_rgba_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_bgra_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_argb_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_abgr_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgb565_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgb24_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgba_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_bgra_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_argb_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_abgr_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgb565_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgb24_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgba_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_bgra_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_argb_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_abgr_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+// yuv to rgb, sse implementation
+// pointers must be 16 byte aligned, and strides must be divisable by 16
+void yuv420_rgb565_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_rgb24_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_rgba_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_bgra_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_argb_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_abgr_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgb565_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgb24_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgba_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_bgra_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_argb_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_abgr_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgb565_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgb24_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgba_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_bgra_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_argb_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_abgr_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+// yuv to rgb, sse implementation
+// pointers do not need to be 16 byte aligned
+void yuv420_rgb565_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_rgb24_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_rgba_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_bgra_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_argb_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv420_abgr_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgb565_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgb24_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_rgba_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_bgra_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_argb_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuv422_abgr_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgb565_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgb24_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_rgba_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_bgra_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_argb_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+void yuvnv12_abgr_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ uint8_t *rgb, uint32_t rgb_stride,
+ YCbCrType yuv_type);
+
+
+// rgb to yuv, standard c implementation
+void rgb24_yuv420_std(
+ uint32_t width, uint32_t height,
+ const uint8_t *rgb, uint32_t rgb_stride,
+ uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ YCbCrType yuv_type);
+
+// rgb to yuv, sse implementation
+// pointers must be 16 byte aligned, and strides must be divisible by 16
+void rgb24_yuv420_sse(
+ uint32_t width, uint32_t height,
+ const uint8_t *rgb, uint32_t rgb_stride,
+ uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ YCbCrType yuv_type);
+
+// rgb to yuv, sse implementation
+// pointers do not need to be 16 byte aligned
+void rgb24_yuv420_sseu(
+ uint32_t width, uint32_t height,
+ const uint8_t *rgb, uint32_t rgb_stride,
+ uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
+ YCbCrType yuv_type);
+
diff --git a/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h
new file mode 100644
index 0000000..f81140e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h
@@ -0,0 +1,498 @@
+// Copyright 2016 Adrien Descamps
+// Distributed under BSD 3-Clause License
+
+/* You need to define the following macros before including this file:
+ SSE_FUNCTION_NAME
+ STD_FUNCTION_NAME
+ YUV_FORMAT
+ RGB_FORMAT
+*/
+/* You may define the following macro, which affects generated code:
+ SSE_ALIGNED
+*/
+
+#ifdef SSE_ALIGNED
+/* Unaligned instructions seem faster, even on aligned data? */
+/*
+#define LOAD_SI128 _mm_load_si128
+#define SAVE_SI128 _mm_stream_si128
+*/
+#define LOAD_SI128 _mm_loadu_si128
+#define SAVE_SI128 _mm_storeu_si128
+#else
+#define LOAD_SI128 _mm_loadu_si128
+#define SAVE_SI128 _mm_storeu_si128
+#endif
+
+#define UV2RGB_16(U,V,R1,G1,B1,R2,G2,B2) \
+ r_tmp = _mm_mullo_epi16(V, _mm_set1_epi16(param->v_r_factor)); \
+ g_tmp = _mm_add_epi16( \
+ _mm_mullo_epi16(U, _mm_set1_epi16(param->u_g_factor)), \
+ _mm_mullo_epi16(V, _mm_set1_epi16(param->v_g_factor))); \
+ b_tmp = _mm_mullo_epi16(U, _mm_set1_epi16(param->u_b_factor)); \
+ R1 = _mm_unpacklo_epi16(r_tmp, r_tmp); \
+ G1 = _mm_unpacklo_epi16(g_tmp, g_tmp); \
+ B1 = _mm_unpacklo_epi16(b_tmp, b_tmp); \
+ R2 = _mm_unpackhi_epi16(r_tmp, r_tmp); \
+ G2 = _mm_unpackhi_epi16(g_tmp, g_tmp); \
+ B2 = _mm_unpackhi_epi16(b_tmp, b_tmp); \
+
+#define ADD_Y2RGB_16(Y1,Y2,R1,G1,B1,R2,G2,B2) \
+ Y1 = _mm_mullo_epi16(_mm_sub_epi16(Y1, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \
+ Y2 = _mm_mullo_epi16(_mm_sub_epi16(Y2, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \
+ \
+ R1 = _mm_srai_epi16(_mm_add_epi16(R1, Y1), PRECISION); \
+ G1 = _mm_srai_epi16(_mm_add_epi16(G1, Y1), PRECISION); \
+ B1 = _mm_srai_epi16(_mm_add_epi16(B1, Y1), PRECISION); \
+ R2 = _mm_srai_epi16(_mm_add_epi16(R2, Y2), PRECISION); \
+ G2 = _mm_srai_epi16(_mm_add_epi16(G2, Y2), PRECISION); \
+ B2 = _mm_srai_epi16(_mm_add_epi16(B2, Y2), PRECISION); \
+
+#define PACK_RGB565_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4) \
+{ \
+ __m128i red_mask, tmp1, tmp2, tmp3, tmp4; \
+\
+ red_mask = _mm_set1_epi16((short)0xF800); \
+ RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \
+ RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \
+ RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \
+ RGB4 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R2), red_mask); \
+ tmp1 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G1, _mm_setzero_si128()), 2), 5); \
+ tmp2 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G1, _mm_setzero_si128()), 2), 5); \
+ tmp3 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G2, _mm_setzero_si128()), 2), 5); \
+ tmp4 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G2, _mm_setzero_si128()), 2), 5); \
+ RGB1 = _mm_or_si128(RGB1, tmp1); \
+ RGB2 = _mm_or_si128(RGB2, tmp2); \
+ RGB3 = _mm_or_si128(RGB3, tmp3); \
+ RGB4 = _mm_or_si128(RGB4, tmp4); \
+ tmp1 = _mm_srli_epi16(_mm_unpacklo_epi8(B1, _mm_setzero_si128()), 3); \
+ tmp2 = _mm_srli_epi16(_mm_unpackhi_epi8(B1, _mm_setzero_si128()), 3); \
+ tmp3 = _mm_srli_epi16(_mm_unpacklo_epi8(B2, _mm_setzero_si128()), 3); \
+ tmp4 = _mm_srli_epi16(_mm_unpackhi_epi8(B2, _mm_setzero_si128()), 3); \
+ RGB1 = _mm_or_si128(RGB1, tmp1); \
+ RGB2 = _mm_or_si128(RGB2, tmp2); \
+ RGB3 = _mm_or_si128(RGB3, tmp3); \
+ RGB4 = _mm_or_si128(RGB4, tmp4); \
+}
+
+#define PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+RGB1 = _mm_packus_epi16(_mm_and_si128(R1,_mm_set1_epi16(0xFF)), _mm_and_si128(R2,_mm_set1_epi16(0xFF))); \
+RGB2 = _mm_packus_epi16(_mm_and_si128(G1,_mm_set1_epi16(0xFF)), _mm_and_si128(G2,_mm_set1_epi16(0xFF))); \
+RGB3 = _mm_packus_epi16(_mm_and_si128(B1,_mm_set1_epi16(0xFF)), _mm_and_si128(B2,_mm_set1_epi16(0xFF))); \
+RGB4 = _mm_packus_epi16(_mm_srli_epi16(R1,8), _mm_srli_epi16(R2,8)); \
+RGB5 = _mm_packus_epi16(_mm_srli_epi16(G1,8), _mm_srli_epi16(G2,8)); \
+RGB6 = _mm_packus_epi16(_mm_srli_epi16(B1,8), _mm_srli_epi16(B2,8)); \
+
+#define PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+R1 = _mm_packus_epi16(_mm_and_si128(RGB1,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB2,_mm_set1_epi16(0xFF))); \
+R2 = _mm_packus_epi16(_mm_and_si128(RGB3,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB4,_mm_set1_epi16(0xFF))); \
+G1 = _mm_packus_epi16(_mm_and_si128(RGB5,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB6,_mm_set1_epi16(0xFF))); \
+G2 = _mm_packus_epi16(_mm_srli_epi16(RGB1,8), _mm_srli_epi16(RGB2,8)); \
+B1 = _mm_packus_epi16(_mm_srli_epi16(RGB3,8), _mm_srli_epi16(RGB4,8)); \
+B2 = _mm_packus_epi16(_mm_srli_epi16(RGB5,8), _mm_srli_epi16(RGB6,8)); \
+
+#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
+
+#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \
+{ \
+ __m128i lo_ab, hi_ab, lo_gr, hi_gr; \
+\
+ lo_ab = _mm_unpacklo_epi8( A1, B1 ); \
+ hi_ab = _mm_unpackhi_epi8( A1, B1 ); \
+ lo_gr = _mm_unpacklo_epi8( G1, R1 ); \
+ hi_gr = _mm_unpackhi_epi8( G1, R1 ); \
+ RGB1 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \
+ RGB2 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \
+ RGB3 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \
+ RGB4 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \
+\
+ lo_ab = _mm_unpacklo_epi8( A2, B2 ); \
+ hi_ab = _mm_unpackhi_epi8( A2, B2 ); \
+ lo_gr = _mm_unpacklo_epi8( G2, R2 ); \
+ hi_gr = _mm_unpackhi_epi8( G2, R2 ); \
+ RGB5 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \
+ RGB6 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \
+ RGB7 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \
+ RGB8 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \
+}
+
+#if RGB_FORMAT == RGB_FORMAT_RGB565
+
+#define PACK_PIXEL \
+ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
+ \
+ PACK_RGB565_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4) \
+ \
+ PACK_RGB565_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_5, rgb_6, rgb_7, rgb_8) \
+
+#elif RGB_FORMAT == RGB_FORMAT_RGB24
+
+#define PACK_PIXEL \
+ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \
+ __m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \
+ \
+ PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \
+ \
+ PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \
+
+#elif RGB_FORMAT == RGB_FORMAT_RGBA
+
+#define PACK_PIXEL \
+ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
+ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
+ \
+ PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
+ \
+ PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
+
+#elif RGB_FORMAT == RGB_FORMAT_BGRA
+
+#define PACK_PIXEL \
+ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
+ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
+ \
+ PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
+ \
+ PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
+
+#elif RGB_FORMAT == RGB_FORMAT_ARGB
+
+#define PACK_PIXEL \
+ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
+ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
+ \
+ PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
+ \
+ PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
+
+#elif RGB_FORMAT == RGB_FORMAT_ABGR
+
+#define PACK_PIXEL \
+ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
+ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
+ \
+ PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
+ \
+ PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
+
+#else
+#error PACK_PIXEL unimplemented
+#endif
+
+#if RGB_FORMAT == RGB_FORMAT_RGB565
+
+#define SAVE_LINE1 \
+ SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
+
+#define SAVE_LINE2 \
+ SAVE_SI128((__m128i*)(rgb_ptr2), rgb_5); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_6); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_7); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_8); \
+
+#elif RGB_FORMAT == RGB_FORMAT_RGB24
+
+#define SAVE_LINE1 \
+ SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \
+
+#define SAVE_LINE2 \
+ SAVE_SI128((__m128i*)(rgb_ptr2), rgb_7); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_8); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_9); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_10); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_11); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_12); \
+
+#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \
+ RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR
+
+#define SAVE_LINE1 \
+ SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+96), rgb_7); \
+ SAVE_SI128((__m128i*)(rgb_ptr1+112), rgb_8); \
+
+#define SAVE_LINE2 \
+ SAVE_SI128((__m128i*)(rgb_ptr2), rgb_9); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_10); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_11); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_12); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_13); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_14); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+96), rgb_15); \
+ SAVE_SI128((__m128i*)(rgb_ptr2+112), rgb_16); \
+
+#else
+#error SAVE_LINE unimplemented
+#endif
+
+#if YUV_FORMAT == YUV_FORMAT_420
+
+#define READ_Y(y_ptr) \
+ y = LOAD_SI128((const __m128i*)(y_ptr)); \
+
+#define READ_UV \
+ u = LOAD_SI128((const __m128i*)(u_ptr)); \
+ v = LOAD_SI128((const __m128i*)(v_ptr)); \
+
+#elif YUV_FORMAT == YUV_FORMAT_422
+
+#define READ_Y(y_ptr) \
+{ \
+ __m128i y1, y2; \
+ y1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr)), 8), 8); \
+ y2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr+16)), 8), 8); \
+ y = _mm_packus_epi16(y1, y2); \
+}
+
+#define READ_UV \
+{ \
+ __m128i u1, u2, u3, u4, v1, v2, v3, v4; \
+ u1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr)), 24), 24); \
+ u2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+16)), 24), 24); \
+ u3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+32)), 24), 24); \
+ u4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+48)), 24), 24); \
+ u = _mm_packus_epi16(_mm_packs_epi32(u1, u2), _mm_packs_epi32(u3, u4)); \
+ v1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr)), 24), 24); \
+ v2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+16)), 24), 24); \
+ v3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+32)), 24), 24); \
+ v4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+48)), 24), 24); \
+ v = _mm_packus_epi16(_mm_packs_epi32(v1, v2), _mm_packs_epi32(v3, v4)); \
+}
+
+#elif YUV_FORMAT == YUV_FORMAT_NV12
+
+#define READ_Y(y_ptr) \
+ y = LOAD_SI128((const __m128i*)(y_ptr)); \
+
+#define READ_UV \
+{ \
+ __m128i u1, u2, v1, v2; \
+ u1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr)), 8), 8); \
+ u2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr+16)), 8), 8); \
+ u = _mm_packus_epi16(u1, u2); \
+ v1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr)), 8), 8); \
+ v2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr+16)), 8), 8); \
+ v = _mm_packus_epi16(v1, v2); \
+}
+
+#else
+#error READ_UV unimplemented
+#endif
+
+#define YUV2RGB_32 \
+ __m128i r_tmp, g_tmp, b_tmp; \
+ __m128i r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2; \
+ __m128i r_uv_16_1, g_uv_16_1, b_uv_16_1, r_uv_16_2, g_uv_16_2, b_uv_16_2; \
+ __m128i y_16_1, y_16_2; \
+ __m128i y, u, v, u_16, v_16; \
+ __m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \
+ __m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \
+ \
+ READ_UV \
+ \
+ /* process first 16 pixels of first line */\
+ u_16 = _mm_unpacklo_epi8(u, _mm_setzero_si128()); \
+ v_16 = _mm_unpacklo_epi8(v, _mm_setzero_si128()); \
+ u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \
+ v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \
+ \
+ UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
+ r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \
+ r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \
+ \
+ READ_Y(y_ptr1) \
+ y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
+ y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
+ \
+ ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
+ \
+ r_8_11 = _mm_packus_epi16(r_16_1, r_16_2); \
+ g_8_11 = _mm_packus_epi16(g_16_1, g_16_2); \
+ b_8_11 = _mm_packus_epi16(b_16_1, b_16_2); \
+ \
+ /* process first 16 pixels of second line */\
+ r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \
+ r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \
+ \
+ READ_Y(y_ptr2) \
+ y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
+ y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
+ \
+ ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
+ \
+ r_8_21 = _mm_packus_epi16(r_16_1, r_16_2); \
+ g_8_21 = _mm_packus_epi16(g_16_1, g_16_2); \
+ b_8_21 = _mm_packus_epi16(b_16_1, b_16_2); \
+ \
+ /* process last 16 pixels of first line */\
+ u_16 = _mm_unpackhi_epi8(u, _mm_setzero_si128()); \
+ v_16 = _mm_unpackhi_epi8(v, _mm_setzero_si128()); \
+ u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \
+ v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \
+ \
+ UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
+ r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \
+ r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \
+ \
+ READ_Y(y_ptr1+16*y_pixel_stride) \
+ y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
+ y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
+ \
+ ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
+ \
+ r_8_12 = _mm_packus_epi16(r_16_1, r_16_2); \
+ g_8_12 = _mm_packus_epi16(g_16_1, g_16_2); \
+ b_8_12 = _mm_packus_epi16(b_16_1, b_16_2); \
+ \
+ /* process last 16 pixels of second line */\
+ r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \
+ r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \
+ \
+ READ_Y(y_ptr2+16*y_pixel_stride) \
+ y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
+ y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
+ \
+ ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
+ \
+ r_8_22 = _mm_packus_epi16(r_16_1, r_16_2); \
+ g_8_22 = _mm_packus_epi16(g_16_1, g_16_2); \
+ b_8_22 = _mm_packus_epi16(b_16_1, b_16_2); \
+ \
+
+
+void SSE_FUNCTION_NAME(uint32_t width, uint32_t height,
+ const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
+ uint8_t *RGB, uint32_t RGB_stride,
+ YCbCrType yuv_type)
+{
+ const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
+#if YUV_FORMAT == YUV_FORMAT_420
+ const int y_pixel_stride = 1;
+ const int uv_pixel_stride = 1;
+ const int uv_x_sample_interval = 2;
+ const int uv_y_sample_interval = 2;
+#elif YUV_FORMAT == YUV_FORMAT_422
+ const int y_pixel_stride = 2;
+ const int uv_pixel_stride = 4;
+ const int uv_x_sample_interval = 2;
+ const int uv_y_sample_interval = 1;
+#elif YUV_FORMAT == YUV_FORMAT_NV12
+ const int y_pixel_stride = 1;
+ const int uv_pixel_stride = 2;
+ const int uv_x_sample_interval = 2;
+ const int uv_y_sample_interval = 2;
+#endif
+#if RGB_FORMAT == RGB_FORMAT_RGB565
+ const int rgb_pixel_stride = 2;
+#elif RGB_FORMAT == RGB_FORMAT_RGB24
+ const int rgb_pixel_stride = 3;
+#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \
+ RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR
+ const int rgb_pixel_stride = 4;
+#else
+#error Unknown RGB pixel size
+#endif
+
+ if (width >= 32) {
+ uint32_t xpos, ypos;
+ for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval)
+ {
+ const uint8_t *y_ptr1=Y+ypos*Y_stride,
+ *y_ptr2=Y+(ypos+1)*Y_stride,
+ *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride,
+ *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride;
+
+ uint8_t *rgb_ptr1=RGB+ypos*RGB_stride,
+ *rgb_ptr2=RGB+(ypos+1)*RGB_stride;
+
+ for(xpos=0; xpos<(width-31); xpos+=32)
+ {
+ YUV2RGB_32
+ {
+ PACK_PIXEL
+ SAVE_LINE1
+ if (uv_y_sample_interval > 1)
+ {
+ SAVE_LINE2
+ }
+ }
+
+ y_ptr1+=32*y_pixel_stride;
+ y_ptr2+=32*y_pixel_stride;
+ u_ptr+=32*uv_pixel_stride/uv_x_sample_interval;
+ v_ptr+=32*uv_pixel_stride/uv_x_sample_interval;
+ rgb_ptr1+=32*rgb_pixel_stride;
+ rgb_ptr2+=32*rgb_pixel_stride;
+ }
+ }
+
+ /* Catch the last line, if needed */
+ if (uv_y_sample_interval == 2 && ypos == (height-1))
+ {
+ const uint8_t *y_ptr=Y+ypos*Y_stride,
+ *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride,
+ *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride;
+
+ uint8_t *rgb_ptr=RGB+ypos*RGB_stride;
+
+ STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type);
+ }
+ }
+
+ /* Catch the right column, if needed */
+ {
+ int converted = (width & ~31);
+ if (converted != width)
+ {
+ const uint8_t *y_ptr=Y+converted*y_pixel_stride,
+ *u_ptr=U+converted*uv_pixel_stride/uv_x_sample_interval,
+ *v_ptr=V+converted*uv_pixel_stride/uv_x_sample_interval;
+
+ uint8_t *rgb_ptr=RGB+converted*rgb_pixel_stride;
+
+ STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type);
+ }
+ }
+}
+
+#undef SSE_FUNCTION_NAME
+#undef STD_FUNCTION_NAME
+#undef YUV_FORMAT
+#undef RGB_FORMAT
+#undef SSE_ALIGNED
+#undef LOAD_SI128
+#undef SAVE_SI128
+#undef UV2RGB_16
+#undef ADD_Y2RGB_16
+#undef PACK_RGB24_32_STEP1
+#undef PACK_RGB24_32_STEP2
+#undef PACK_RGB24_32
+#undef PACK_RGBA_32
+#undef PACK_PIXEL
+#undef SAVE_LINE1
+#undef SAVE_LINE2
+#undef READ_Y
+#undef READ_UV
+#undef YUV2RGB_32
diff --git a/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h
new file mode 100644
index 0000000..bf4f48e
--- /dev/null
+++ b/src/3rdparty/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h
@@ -0,0 +1,220 @@
+// Copyright 2016 Adrien Descamps
+// Distributed under BSD 3-Clause License
+
+/* You need to define the following macros before including this file:
+ STD_FUNCTION_NAME
+ YUV_FORMAT
+ RGB_FORMAT
+*/
+
+#if RGB_FORMAT == RGB_FORMAT_RGB565
+
+#define PACK_PIXEL(rgb_ptr) \
+ *(Uint16 *)rgb_ptr = \
+ ((((Uint16)clampU8(y_tmp+r_tmp)) << 8 ) & 0xF800) | \
+ ((((Uint16)clampU8(y_tmp+g_tmp)) << 3) & 0x07E0) | \
+ (((Uint16)clampU8(y_tmp+b_tmp)) >> 3); \
+ rgb_ptr += 2; \
+
+#elif RGB_FORMAT == RGB_FORMAT_RGB24
+
+#define PACK_PIXEL(rgb_ptr) \
+ rgb_ptr[0] = clampU8(y_tmp+r_tmp); \
+ rgb_ptr[1] = clampU8(y_tmp+g_tmp); \
+ rgb_ptr[2] = clampU8(y_tmp+b_tmp); \
+ rgb_ptr += 3; \
+
+#elif RGB_FORMAT == RGB_FORMAT_RGBA
+
+#define PACK_PIXEL(rgb_ptr) \
+ *(Uint32 *)rgb_ptr = \
+ (((Uint32)clampU8(y_tmp+r_tmp)) << 24) | \
+ (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \
+ (((Uint32)clampU8(y_tmp+b_tmp)) << 8) | \
+ 0x000000FF; \
+ rgb_ptr += 4; \
+
+#elif RGB_FORMAT == RGB_FORMAT_BGRA
+
+#define PACK_PIXEL(rgb_ptr) \
+ *(Uint32 *)rgb_ptr = \
+ (((Uint32)clampU8(y_tmp+b_tmp)) << 24) | \
+ (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \
+ (((Uint32)clampU8(y_tmp+r_tmp)) << 8) | \
+ 0x000000FF; \
+ rgb_ptr += 4; \
+
+#elif RGB_FORMAT == RGB_FORMAT_ARGB
+
+#define PACK_PIXEL(rgb_ptr) \
+ *(Uint32 *)rgb_ptr = \
+ 0xFF000000 | \
+ (((Uint32)clampU8(y_tmp+r_tmp)) << 16) | \
+ (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \
+ (((Uint32)clampU8(y_tmp+b_tmp)) << 0); \
+ rgb_ptr += 4; \
+
+#elif RGB_FORMAT == RGB_FORMAT_ABGR
+
+#define PACK_PIXEL(rgb_ptr) \
+ *(Uint32 *)rgb_ptr = \
+ 0xFF000000 | \
+ (((Uint32)clampU8(y_tmp+b_tmp)) << 16) | \
+ (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \
+ (((Uint32)clampU8(y_tmp+r_tmp)) << 0); \
+ rgb_ptr += 4; \
+
+#else
+#error PACK_PIXEL unimplemented
+#endif
+
+
+void STD_FUNCTION_NAME(
+ uint32_t width, uint32_t height,
+ const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
+ uint8_t *RGB, uint32_t RGB_stride,
+ YCbCrType yuv_type)
+{
+ const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
+#if YUV_FORMAT == YUV_FORMAT_420
+ const int y_pixel_stride = 1;
+ const int uv_pixel_stride = 1;
+ const int uv_x_sample_interval = 2;
+ const int uv_y_sample_interval = 2;
+#elif YUV_FORMAT == YUV_FORMAT_422
+ const int y_pixel_stride = 2;
+ const int uv_pixel_stride = 4;
+ const int uv_x_sample_interval = 2;
+ const int uv_y_sample_interval = 1;
+#elif YUV_FORMAT == YUV_FORMAT_NV12
+ const int y_pixel_stride = 1;
+ const int uv_pixel_stride = 2;
+ const int uv_x_sample_interval = 2;
+ const int uv_y_sample_interval = 2;
+#endif
+
+ uint32_t x, y;
+ for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval)
+ {
+ const uint8_t *y_ptr1=Y+y*Y_stride,
+ *y_ptr2=Y+(y+1)*Y_stride,
+ *u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
+ *v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
+
+ uint8_t *rgb_ptr1=RGB+y*RGB_stride,
+ *rgb_ptr2=RGB+(y+1)*RGB_stride;
+
+ for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval)
+ {
+ // Compute U and V contributions, common to the four pixels
+
+ int32_t u_tmp = ((*u_ptr)-128);
+ int32_t v_tmp = ((*v_ptr)-128);
+
+ int32_t r_tmp = (v_tmp*param->v_r_factor);
+ int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
+ int32_t b_tmp = (u_tmp*param->u_b_factor);
+
+ // Compute the Y contribution for each pixel
+
+ int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr1);
+
+ y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr1);
+
+ if (uv_y_sample_interval > 1) {
+ y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr2);
+
+ y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr2);
+ }
+
+ y_ptr1+=2*y_pixel_stride;
+ y_ptr2+=2*y_pixel_stride;
+ u_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
+ v_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
+ }
+
+ /* Catch the last pixel, if needed */
+ if (uv_x_sample_interval == 2 && x == (width-1))
+ {
+ // Compute U and V contributions, common to the four pixels
+
+ int32_t u_tmp = ((*u_ptr)-128);
+ int32_t v_tmp = ((*v_ptr)-128);
+
+ int32_t r_tmp = (v_tmp*param->v_r_factor);
+ int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
+ int32_t b_tmp = (u_tmp*param->u_b_factor);
+
+ // Compute the Y contribution for each pixel
+
+ int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr1);
+
+ if (uv_y_sample_interval > 1) {
+ y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr2);
+ }
+ }
+ }
+
+ /* Catch the last line, if needed */
+ if (uv_y_sample_interval == 2 && y == (height-1))
+ {
+ const uint8_t *y_ptr1=Y+y*Y_stride,
+ *u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
+ *v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
+
+ uint8_t *rgb_ptr1=RGB+y*RGB_stride;
+
+ for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval)
+ {
+ // Compute U and V contributions, common to the four pixels
+
+ int32_t u_tmp = ((*u_ptr)-128);
+ int32_t v_tmp = ((*v_ptr)-128);
+
+ int32_t r_tmp = (v_tmp*param->v_r_factor);
+ int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
+ int32_t b_tmp = (u_tmp*param->u_b_factor);
+
+ // Compute the Y contribution for each pixel
+
+ int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr1);
+
+ y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr1);
+
+ y_ptr1+=2*y_pixel_stride;
+ u_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
+ v_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
+ }
+
+ /* Catch the last pixel, if needed */
+ if (uv_x_sample_interval == 2 && x == (width-1))
+ {
+ // Compute U and V contributions, common to the four pixels
+
+ int32_t u_tmp = ((*u_ptr)-128);
+ int32_t v_tmp = ((*v_ptr)-128);
+
+ int32_t r_tmp = (v_tmp*param->v_r_factor);
+ int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
+ int32_t b_tmp = (u_tmp*param->u_b_factor);
+
+ // Compute the Y contribution for each pixel
+
+ int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
+ PACK_PIXEL(rgb_ptr1);
+ }
+ }
+}
+
+#undef STD_FUNCTION_NAME
+#undef YUV_FORMAT
+#undef RGB_FORMAT
+#undef PACK_PIXEL
diff --git a/src/3rdparty/buildvm/buildvm-post.bat b/src/3rdparty/buildvm/buildvm-post.bat
new file mode 100644
index 0000000..f9127f2
--- /dev/null
+++ b/src/3rdparty/buildvm/buildvm-post.bat
@@ -0,0 +1,17 @@
+set buildvm=%1
+set outdir=%2
+
+if not exist %outdir% mkdir -p %outdir%
+
+set src=..\LuaJIT-2.0.5\src
+
+set sources=%src%\lib_base.c %src%\lib_math.c %src%\lib_bit.c %src%\lib_string.c %src%\lib_table.c %src%\lib_io.c %src%\lib_os.c %src%\lib_package.c %src%\lib_debug.c %src%\lib_jit.c %src%\lib_ffi.c
+
+%buildvm% -m peobj -o %outdir%\lj_vm.obj %sources%
+%buildvm% -m bcdef -o %outdir%\lj_bcdef.h %sources%
+%buildvm% -m ffdef -o %outdir%\lj_ffdef.h %sources%
+%buildvm% -m libdef -o %outdir%\lj_libdef.h %sources%
+%buildvm% -m recdef -o %outdir%\lj_recdef.h %sources%
+%buildvm% -m vmdef -o %outdir%\vmdef.lua %sources%
+%buildvm% -m folddef -o %outdir%\lj_folddef.h %src%\lj_opt_fold.c
+
diff --git a/src/3rdparty/buildvm/buildvm.exe b/src/3rdparty/buildvm/buildvm.exe
new file mode 100644
index 0000000..a41ba10
--- /dev/null
+++ b/src/3rdparty/buildvm/buildvm.exe
Binary files differ
diff --git a/src/3rdparty/minilua/minilua-post.bat b/src/3rdparty/minilua/minilua-post.bat
new file mode 100644
index 0000000..0e0406f
--- /dev/null
+++ b/src/3rdparty/minilua/minilua-post.bat
@@ -0,0 +1,6 @@
+set minilua=%1
+set outdir=%2
+set luajit=..\LuaJIT-2.0.5
+
+if not exist %outdir% mkdir -p %outdir%
+%minilua% %luajit%\dynasm\dynasm.lua -LN -D WIN -D JIT -D FFI -o %outdir%\buildvm_arch.h %luajit%\src\vm_x86.dasc
diff --git a/src/3rdparty/minilua/minilua.exe b/src/3rdparty/minilua/minilua.exe
new file mode 100644
index 0000000..5369029
--- /dev/null
+++ b/src/3rdparty/minilua/minilua.exe
Binary files differ
diff --git a/src/3rdparty/ogl/OpenGL.h b/src/3rdparty/ogl/OpenGL.h
new file mode 100644
index 0000000..3e416c7
--- /dev/null
+++ b/src/3rdparty/ogl/OpenGL.h
@@ -0,0 +1,184 @@
+#ifndef __OGL2D_H
+#define __OGL2D_H
+#include <vector>
+
+/* include gl.h before this file */
+namespace ogl2d
+{
+ /* 2d wrap of opengl 3.0 */
+ class OpenGL
+ {
+ public:
+ OpenGL();
+ ~OpenGL();
+
+ inline void enable(GLenum cap)
+ {
+ glEnable(cap);
+ }
+
+ inline void disable(GLenum cap)
+ {
+ glDisable(cap);
+ }
+
+ inline void setBlendFunc(GLenum sfactor, GLenum dfactor)
+ {
+ glBlendFunc(sfactor, dfactor);
+ }
+
+ inline void setClearColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
+ {
+ glClearColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
+ }
+
+ void pushColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a = 255);
+ void popColor();
+ void flushError();
+ GLuint genTexture();
+ void deleteTexture(GLuint texture);
+ void bindTexture(GLuint texture = 0);
+ inline GLuint curTexture()
+ {
+ return _texture;
+ }
+ void setTexParameter(GLenum pname, GLint param);
+ void texImage(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels = NULL);
+ void texSubImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+ void activeTexUnit(unsigned int unit = 0);
+
+ inline void drawArrays(GLenum mode, GLint first, GLsizei count)
+ {
+ glDrawArrays(mode, first, count);
+ }
+
+ inline void drawBuffer(GLenum mode)
+ {
+
+ }
+
+ inline void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
+ {
+
+ }
+
+ inline void enableClientState(GLenum arr)
+ {
+ glEnableClientState(arr);
+ }
+
+ inline void disableClientState(GLenum arr)
+ {
+ glDisableClientState(arr);
+ }
+
+ inline GLuint genFrameBuffer()
+ {
+ GLuint fbo;
+ glGenFramebuffers(1, &fbo);
+ return fbo;
+ }
+
+ inline void bindFrameBuffer(GLuint fbo)
+ {
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ }
+
+ // Ļһ
+ inline void ortho(int w, float radio)
+ {
+ glOrtho(0, w, w*radio, 0, -1, 1);
+ }
+
+ inline void orthox(int w, int h)
+ {
+ glOrtho(0, w, h, 0, -1, 1);
+ }
+
+ protected:
+ struct { GLubyte r, g, b, a; } _color; // current draw color
+ struct { GLubyte r, g, b, a; } _precolor; // previous draw color
+ GLuint _texture; // current binded texture
+
+ };
+
+ ///* OpenGL instance singleton */
+ extern OpenGL gl;
+
+#if defined(OGL2D_IMPLEMENT)
+
+ OpenGL gl;
+
+ OpenGL::OpenGL()
+ {
+ memset(&_color, 0xff, sizeof(_color));
+ memset(&_precolor, 0xff, sizeof(_precolor));
+ }
+
+ OpenGL::~OpenGL()
+ {
+ }
+
+ void OpenGL::pushColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
+ {
+ memcpy(&_precolor, &_color, sizeof(_precolor));
+ _color.r = r;
+ _color.g = g;
+ _color.b = b;
+ _color.a = a;
+ glColor4ub(r, g, b, a);
+ }
+
+ void OpenGL::popColor()
+ {
+ memcpy(&_color, &_precolor, sizeof(_precolor));
+ glColor4ub(_color.r, _color.g, _color.b, _color.a);
+ }
+
+ void OpenGL::flushError()
+ {
+ while (glGetError() != GL_NO_ERROR);
+ }
+
+ GLuint OpenGL::genTexture()
+ {
+ GLuint t;
+ glGenTextures(1, &t);
+ return t;
+ }
+
+ void OpenGL::bindTexture(GLuint texture)
+ {
+ glBindTexture(GL_TEXTURE_2D, texture);
+ }
+
+ void OpenGL::deleteTexture(GLuint texture)
+ {
+ glDeleteTextures(1, &texture);
+ }
+
+ void OpenGL::setTexParameter(GLenum pname, GLint param)
+ {
+ glTexParameteri(GL_TEXTURE_2D, pname, param);
+ }
+
+ void OpenGL::texImage(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+ {
+ glTexImage2D(GL_TEXTURE_2D, 0, internalformat, width, height, 0, format, type, pixels);
+ }
+
+ void OpenGL::texSubImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+ {
+ glTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset, width, height, format, type, pixels);
+ }
+
+ void OpenGL::activeTexUnit(unsigned int unit)
+ {
+ // glActiveTexture selects which texture unit subsequent texture state calls will affect.
+ glActiveTexture(GL_TEXTURE0 + unit);
+ }
+
+#endif // OGL2D_IMPLEMENT
+}
+
+#endif \ No newline at end of file
diff --git a/src/libjin/3rdparty/smount/dirent.h b/src/3rdparty/smount/dirent.h
index 832b164..832b164 100644
--- a/src/libjin/3rdparty/smount/dirent.h
+++ b/src/3rdparty/smount/dirent.h
diff --git a/src/libjin/3rdparty/smount/smount.c b/src/3rdparty/smount/smount.c
index 6214800..6214800 100644
--- a/src/libjin/3rdparty/smount/smount.c
+++ b/src/3rdparty/smount/smount.c
diff --git a/src/libjin/3rdparty/smount/smount.h b/src/3rdparty/smount/smount.h
index 0f8f774..0f8f774 100644
--- a/src/libjin/3rdparty/smount/smount.h
+++ b/src/3rdparty/smount/smount.h
diff --git a/src/libjin/3rdparty/stb/stb_image.h b/src/3rdparty/stb/stb_image.h
index 4df317a..4df317a 100644
--- a/src/libjin/3rdparty/stb/stb_image.h
+++ b/src/3rdparty/stb/stb_image.h
diff --git a/src/libjin/3rdparty/stb/stb_truetype.h b/src/3rdparty/stb/stb_truetype.h
index 927ee21..927ee21 100644
--- a/src/libjin/3rdparty/stb/stb_truetype.h
+++ b/src/3rdparty/stb/stb_truetype.h
diff --git a/src/libjin/3rdparty/stb/stb_vorbis.c b/src/3rdparty/stb/stb_vorbis.c
index a863042..a863042 100644
--- a/src/libjin/3rdparty/stb/stb_vorbis.c
+++ b/src/3rdparty/stb/stb_vorbis.c
diff --git a/src/libjin/3rdparty/tekcos/README b/src/3rdparty/tekcos/README
index fe5ede1..fe5ede1 100644
--- a/src/libjin/3rdparty/tekcos/README
+++ b/src/3rdparty/tekcos/README
diff --git a/src/libjin/3rdparty/tekcos/tekcos.c b/src/3rdparty/tekcos/tekcos.c
index e2b7e5c..e2b7e5c 100644
--- a/src/libjin/3rdparty/tekcos/tekcos.c
+++ b/src/3rdparty/tekcos/tekcos.c
diff --git a/src/libjin/3rdparty/tekcos/tekcos.h b/src/3rdparty/tekcos/tekcos.h
index cddc8f3..cddc8f3 100644
--- a/src/libjin/3rdparty/tekcos/tekcos.h
+++ b/src/3rdparty/tekcos/tekcos.h
diff --git a/src/libjin/3rdparty/wav/wav.c b/src/3rdparty/wav/wav.c
index 6f9b2ab..6f9b2ab 100644
--- a/src/libjin/3rdparty/wav/wav.c
+++ b/src/3rdparty/wav/wav.c
diff --git a/src/libjin/3rdparty/wav/wav.h b/src/3rdparty/wav/wav.h
index c12cd5d..c12cd5d 100644
--- a/src/libjin/3rdparty/wav/wav.h
+++ b/src/3rdparty/wav/wav.h
diff --git a/src/jin/main.cpp b/src/jin/main.cpp
new file mode 100644
index 0000000..8b91cf3
--- /dev/null
+++ b/src/jin/main.cpp
@@ -0,0 +1,107 @@
+#include "lua/luax.h"
+#include "lua/jin.h"
+#include "libjin/jin.h"
+
+#ifdef _WIN32
+ #include <Windows.h>
+ #include <direct.h>
+ #include <shlobj.h>
+ #include <wchar.h>
+#endif
+
+#define EXECUTABLE_DIR "./"
+#define DIALOG_TITLE L"Open existing game"
+
+using namespace std;
+using namespace JinEngine::Filesystem;
+using namespace JinEngine::Lua;
+
+// Load game under cwd.
+static void load(const char* cwd)
+{
+
+ // Global lua runtime.
+ lua_State* L = luax_newstate();
+
+ // Open lua standard module.
+ luax_openlibs(L);
+ // Open jin module.
+ luaopen_jin(L);
+ // Set current working directory.
+ luax_newtable(L);
+ luax_setfieldstring(L, "cwd", cwd);
+ luax_setfield(L, -2, "args");
+ // Clear lua stack.
+ luax_clearstack(L);
+
+ // Boot jin and run it.
+ boot(L);
+
+ // Close lua lib.
+ luax_close(L);
+
+}
+
+#ifdef _WIN32
+// WChar to string.
+std::string wstrtostr(const std::wstring &wstr)
+{
+ std::string strTo;
+ char *szTo = new char[wstr.length() + 1];
+ szTo[wstr.size()] = '\0';
+ WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, szTo, (int)wstr.length(), NULL, NULL);
+ strTo = szTo;
+ delete[] szTo;
+ return strTo;
+}
+#endif
+
+std::string BrowseFolder()
+{
+#ifdef _WIN32
+ string path = EXECUTABLE_DIR;
+ IFileDialog* pfd = NULL;
+ DWORD dwFlags;
+ IShellItem* pItem = NULL;
+ HRESULT hr = CoInitialize(NULL);
+ if (FAILED(hr)) goto End;
+ hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL,
+ IID_IFileOpenDialog, reinterpret_cast<void**>(&pfd));
+ if (FAILED(hr)) goto End;
+ pfd->SetTitle(DIALOG_TITLE);
+ hr = pfd->GetOptions(&dwFlags);
+ if (FAILED(hr)) goto End;
+ hr = pfd->SetOptions(dwFlags | FOS_PICKFOLDERS);
+ if (FAILED(hr)) goto End;
+ hr = pfd->Show(NULL);
+ if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
+ goto End;
+ hr = pfd->GetResult(&pItem);
+ if (FAILED(hr)) goto End;
+ LPWSTR filePath;
+ hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &filePath);
+ if (FAILED(hr)) goto End;
+ path = wstrtostr(filePath);
+ CoTaskMemFree(filePath);
+ pItem->Release();
+ pfd->Release();
+ CoUninitialize();
+End:
+ return path;
+#endif
+}
+
+int main(int argc, char* args[])
+{
+ string cwd = EXECUTABLE_DIR;
+#ifdef _WIN32
+ if (argc > 1)
+ cwd = args[1];
+#endif
+ else
+ cwd = BrowseFolder();
+ if (!cwd.empty())
+ load(cwd.c_str());
+
+ return 0;
+}// todo:main.luaĶȡ \ No newline at end of file
diff --git a/src/libjin/3rdparty/base64/base64.h b/src/libjin/3rdparty/base64/base64.h
deleted file mode 100644
index 2519797..0000000
--- a/src/libjin/3rdparty/base64/base64.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef BASE64_H
-#define BASE64_H
-
-#define BASE64_ENCODE_OUT_SIZE(s) ((unsigned int)((((s) + 2) / 3) * 4 + 1))
-#define BASE64_DECODE_OUT_SIZE(s) ((unsigned int)(((s) / 4) * 3))
-
-/*
-* out is null-terminated encode string.
-* return values is out length, exclusive terminating `\0'
-*/
-unsigned int
-base64_encode(const unsigned char *in, unsigned int inlen, char *out);
-
-/*
-* return values is out length
-*/
-unsigned int
-base64_decode(const char *in, unsigned int inlen, unsigned char *out);
-
-#endif /* BASE64_H */
-
-#ifdef BASE64_IMPLEMENT
-
-/* This is a public domain base64 implementation written by WEI Zhicheng. */
-
-#define BASE64_PAD '='
-
-/* BASE 64 encode table */
-static const char base64en[] = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
- 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
- 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
- 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
- 'w', 'x', 'y', 'z', '0', '1', '2', '3',
- '4', '5', '6', '7', '8', '9', '+', '/',
-};
-
-/* ASCII order for BASE 64 decode, 255 in unused character */
-static const unsigned char base64de[] = {
- /* nul, soh, stx, etx, eot, enq, ack, bel, */
- 255, 255, 255, 255, 255, 255, 255, 255,
-
- /* bs, ht, nl, vt, np, cr, so, si, */
- 255, 255, 255, 255, 255, 255, 255, 255,
-
- /* dle, dc1, dc2, dc3, dc4, nak, syn, etb, */
- 255, 255, 255, 255, 255, 255, 255, 255,
-
- /* can, em, sub, esc, fs, gs, rs, us, */
- 255, 255, 255, 255, 255, 255, 255, 255,
-
- /* sp, '!', '"', '#', '$', '%', '&', ''', */
- 255, 255, 255, 255, 255, 255, 255, 255,
-
- /* '(', ')', '*', '+', ',', '-', '.', '/', */
- 255, 255, 255, 62, 255, 255, 255, 63,
-
- /* '0', '1', '2', '3', '4', '5', '6', '7', */
- 52, 53, 54, 55, 56, 57, 58, 59,
-
- /* '8', '9', ':', ';', '<', '=', '>', '?', */
- 60, 61, 255, 255, 255, 255, 255, 255,
-
- /* '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', */
- 255, 0, 1, 2, 3, 4, 5, 6,
-
- /* 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', */
- 7, 8, 9, 10, 11, 12, 13, 14,
-
- /* 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', */
- 15, 16, 17, 18, 19, 20, 21, 22,
-
- /* 'X', 'Y', 'Z', '[', '\', ']', '^', '_', */
- 23, 24, 25, 255, 255, 255, 255, 255,
-
- /* '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', */
- 255, 26, 27, 28, 29, 30, 31, 32,
-
- /* 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', */
- 33, 34, 35, 36, 37, 38, 39, 40,
-
- /* 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', */
- 41, 42, 43, 44, 45, 46, 47, 48,
-
- /* 'x', 'y', 'z', '{', '|', '}', '~', del, */
- 49, 50, 51, 255, 255, 255, 255, 255
-};
-
-unsigned int
-base64_encode(const unsigned char *in, unsigned int inlen, char *out)
-{
- int s;
- unsigned int i;
- unsigned int j;
- unsigned char c;
- unsigned char l;
-
- s = 0;
- l = 0;
- for (i = j = 0; i < inlen; i++) {
- c = in[i];
-
- switch (s) {
- case 0:
- s = 1;
- out[j++] = base64en[(c >> 2) & 0x3F];
- break;
- case 1:
- s = 2;
- out[j++] = base64en[((l & 0x3) << 4) | ((c >> 4) & 0xF)];
- break;
- case 2:
- s = 0;
- out[j++] = base64en[((l & 0xF) << 2) | ((c >> 6) & 0x3)];
- out[j++] = base64en[c & 0x3F];
- break;
- }
- l = c;
- }
-
- switch (s) {
- case 1:
- out[j++] = base64en[(l & 0x3) << 4];
- out[j++] = BASE64_PAD;
- out[j++] = BASE64_PAD;
- break;
- case 2:
- out[j++] = base64en[(l & 0xF) << 2];
- out[j++] = BASE64_PAD;
- break;
- }
-
- out[j] = 0;
-
- return j;
-}
-
-unsigned int
-base64_decode(const char *in, unsigned int inlen, unsigned char *out)
-{
- unsigned int i;
- unsigned int j;
- unsigned char c;
-
- if (inlen & 0x3) {
- return 0;
- }
-
- for (i = j = 0; i < inlen; i++) {
- if (in[i] == BASE64_PAD) {
- break;
- }
- if (in[i] < 0) {
- return 0;
- }
-
- c = base64de[in[i]];
- if (c == 255) {
- return 0;
- }
-
- switch (i & 0x3) {
- case 0:
- out[j] = (c << 2) & 0xFF;
- break;
- case 1:
- out[j++] |= (c >> 4) & 0x3;
- out[j] = (c & 0xF) << 4;
- break;
- case 2:
- out[j++] |= (c >> 2) & 0xF;
- out[j] = (c & 0x3) << 6;
- break;
- case 3:
- out[j++] |= c;
- break;
- }
- }
- out[j] = '\0';
-
- return j;
-}
-
-#endif
diff --git a/src/libjin/3rdparty/ogl/OpenGL.h b/src/libjin/3rdparty/ogl/OpenGL.h
deleted file mode 100644
index 3984b49..0000000
--- a/src/libjin/3rdparty/ogl/OpenGL.h
+++ /dev/null
@@ -1,520 +0,0 @@
-#ifndef __OGL2D_H
-#define __OGL2D_H
-#include <vector>
-
-/* include gl.h before this file */
-namespace ogl2d
-{
- /* 2d wrap of opengl 3.0 */
- class OpenGL
- {
- public:
- OpenGL();
- ~OpenGL();
-
- inline void enable(GLenum cap)
- {
- glEnable(cap);
- }
-
- inline void disable(GLenum cap)
- {
- glDisable(cap);
- }
-
- inline void setBlendFunc(GLenum sfactor, GLenum dfactor)
- {
- glBlendFunc(sfactor, dfactor);
- }
-
- inline void setClearColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
- {
- glClearColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
- }
-
- void pushColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a = 255);
- void popColor();
- void flushError();
- GLuint genTexture();
- void bindTexture(GLuint texture = 0);
- inline GLuint curTexture()
- {
- return _texture;
- }
- void setTexParameter(GLenum pname, GLint param);
- void texImage(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels = NULL);
- void texSubImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void activeTexUnit(unsigned int unit = 0);
-
- inline void drawArrays(GLenum mode, GLint first, GLsizei count)
- {
- glDrawArrays(mode, first, count);
- }
-
- inline void drawBuffer(GLenum mode)
- {
-
- }
-
- inline void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
- {
-
- }
-
- inline void enableClientState(GLenum arr)
- {
- glEnableClientState(arr);
- }
-
- inline void disableClientState(GLenum arr)
- {
- glDisableClientState(arr);
- }
-
- inline GLuint genFrameBuffer()
- {
- GLuint fbo;
- glGenFramebuffers(1, &fbo);
- return fbo;
- }
-
- inline void bindFrameBuffer(GLuint fbo)
- {
- glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- }
-
- // Ļһ
- inline void ortho(int w, float radio)
- {
- glOrtho(0, w, w*radio, 0, -1, 1);
- }
-
- inline void orthox(int w, int h)
- {
- glOrtho(0, w, h, 0, -1, 1);
- }
-
- protected:
- struct { GLubyte r, g, b, a; } _color; // current draw color
- struct { GLubyte r, g, b, a; } _precolor; // previous draw color
- GLuint _texture; // current binded texture
-
- };
-
- ///* OpenGL instance singleton */
- extern OpenGL gl;
-
-#if defined(OGL2D_IMPLEMENT)
-
- OpenGL gl;
-
- OpenGL::OpenGL()
- {
- memset(&_color, 0xff, sizeof(_color));
- memset(&_precolor, 0xff, sizeof(_precolor));
- }
-
- OpenGL::~OpenGL()
- {
- }
-
- void OpenGL::pushColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
- {
- memcpy(&_precolor, &_color, sizeof(_precolor));
- _color.r = r;
- _color.g = g;
- _color.b = b;
- _color.a = a;
- glColor4ub(r, g, b, a);
- }
-
- void OpenGL::popColor()
- {
- memcpy(&_color, &_precolor, sizeof(_precolor));
- glColor4ub(_color.r, _color.g, _color.b, _color.a);
- }
-
- void OpenGL::flushError()
- {
- while (glGetError() != GL_NO_ERROR);
- }
-
- GLuint OpenGL::genTexture()
- {
- GLuint t;
- glGenTextures(1, &t);
- return t;
- }
-
- void OpenGL::bindTexture(GLuint texture)
- {
- glBindTexture(GL_TEXTURE_2D, texture);
- }
-
- void OpenGL::setTexParameter(GLenum pname, GLint param)
- {
- glTexParameteri(GL_TEXTURE_2D, pname, param);
- }
-
- void OpenGL::texImage(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
- {
- glTexImage2D(GL_TEXTURE_2D, 0, internalformat, width, height, 0, format, type, pixels);
- }
-
- void OpenGL::texSubImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
- {
- glTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset, width, height, format, type, pixels);
- }
-
- void OpenGL::activeTexUnit(unsigned int unit)
- {
- // glActiveTexture selects which texture unit subsequent texture state calls will affect.
- glActiveTexture(GL_TEXTURE0 + unit);
- }
-
-#endif // OGL2D_IMPLEMENT
-}
-
-#endif
-
-
-/* GL.h
-
-WINGDIAPI void APIENTRY glAccum(GLenum op, GLfloat value);
-WINGDIAPI void APIENTRY glAlphaFunc(GLenum func, GLclampf ref);
-WINGDIAPI GLboolean APIENTRY glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences);
-WINGDIAPI void APIENTRY glArrayElement(GLint i);
-WINGDIAPI void APIENTRY glBegin(GLenum mode);
-WINGDIAPI void APIENTRY glBindTexture(GLenum target, GLuint texture);
-WINGDIAPI void APIENTRY glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
-WINGDIAPI void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor);
-WINGDIAPI void APIENTRY glCallList(GLuint list);
-WINGDIAPI void APIENTRY glCallLists(GLsizei n, GLenum type, const GLvoid *lists);
-WINGDIAPI void APIENTRY glClear(GLbitfield mask);
-WINGDIAPI void APIENTRY glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-WINGDIAPI void APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-WINGDIAPI void APIENTRY glClearDepth(GLclampd depth);
-WINGDIAPI void APIENTRY glClearIndex(GLfloat c);
-WINGDIAPI void APIENTRY glClearStencil(GLint s);
-WINGDIAPI void APIENTRY glClipPlane(GLenum plane, const GLdouble *equation);
-WINGDIAPI void APIENTRY glColor3b(GLbyte red, GLbyte green, GLbyte blue);
-WINGDIAPI void APIENTRY glColor3bv(const GLbyte *v);
-WINGDIAPI void APIENTRY glColor3d(GLdouble red, GLdouble green, GLdouble blue);
-WINGDIAPI void APIENTRY glColor3dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue);
-WINGDIAPI void APIENTRY glColor3fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glColor3i(GLint red, GLint green, GLint blue);
-WINGDIAPI void APIENTRY glColor3iv(const GLint *v);
-WINGDIAPI void APIENTRY glColor3s(GLshort red, GLshort green, GLshort blue);
-WINGDIAPI void APIENTRY glColor3sv(const GLshort *v);
-WINGDIAPI void APIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue);
-WINGDIAPI void APIENTRY glColor3ubv(const GLubyte *v);
-WINGDIAPI void APIENTRY glColor3ui(GLuint red, GLuint green, GLuint blue);
-WINGDIAPI void APIENTRY glColor3uiv(const GLuint *v);
-WINGDIAPI void APIENTRY glColor3us(GLushort red, GLushort green, GLushort blue);
-WINGDIAPI void APIENTRY glColor3usv(const GLushort *v);
-WINGDIAPI void APIENTRY glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
-WINGDIAPI void APIENTRY glColor4bv(const GLbyte *v);
-WINGDIAPI void APIENTRY glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
-WINGDIAPI void APIENTRY glColor4dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-WINGDIAPI void APIENTRY glColor4fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glColor4i(GLint red, GLint green, GLint blue, GLint alpha);
-WINGDIAPI void APIENTRY glColor4iv(const GLint *v);
-WINGDIAPI void APIENTRY glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
-WINGDIAPI void APIENTRY glColor4sv(const GLshort *v);
-WINGDIAPI void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-WINGDIAPI void APIENTRY glColor4ubv(const GLubyte *v);
-WINGDIAPI void APIENTRY glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
-WINGDIAPI void APIENTRY glColor4uiv(const GLuint *v);
-WINGDIAPI void APIENTRY glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
-WINGDIAPI void APIENTRY glColor4usv(const GLushort *v);
-WINGDIAPI void APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-WINGDIAPI void APIENTRY glColorMaterial(GLenum face, GLenum mode);
-WINGDIAPI void APIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-WINGDIAPI void APIENTRY glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
-WINGDIAPI void APIENTRY glCopyTexImage1D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-WINGDIAPI void APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-WINGDIAPI void APIENTRY glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-WINGDIAPI void APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-WINGDIAPI void APIENTRY glCullFace(GLenum mode);
-WINGDIAPI void APIENTRY glDeleteLists(GLuint list, GLsizei range);
-WINGDIAPI void APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures);
-WINGDIAPI void APIENTRY glDepthFunc(GLenum func);
-WINGDIAPI void APIENTRY glDepthMask(GLboolean flag);
-WINGDIAPI void APIENTRY glDepthRange(GLclampd zNear, GLclampd zFar);
-WINGDIAPI void APIENTRY glDisable(GLenum cap);
-WINGDIAPI void APIENTRY glDisableClientState(GLenum array);
-WINGDIAPI void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count);
-WINGDIAPI void APIENTRY glDrawBuffer(GLenum mode);
-WINGDIAPI void APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-WINGDIAPI void APIENTRY glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-WINGDIAPI void APIENTRY glEdgeFlag(GLboolean flag);
-WINGDIAPI void APIENTRY glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer);
-WINGDIAPI void APIENTRY glEdgeFlagv(const GLboolean *flag);
-WINGDIAPI void APIENTRY glEnable(GLenum cap);
-WINGDIAPI void APIENTRY glEnableClientState(GLenum array);
-WINGDIAPI void APIENTRY glEnd(void);
-WINGDIAPI void APIENTRY glEndList(void);
-WINGDIAPI void APIENTRY glEvalCoord1d(GLdouble u);
-WINGDIAPI void APIENTRY glEvalCoord1dv(const GLdouble *u);
-WINGDIAPI void APIENTRY glEvalCoord1f(GLfloat u);
-WINGDIAPI void APIENTRY glEvalCoord1fv(const GLfloat *u);
-WINGDIAPI void APIENTRY glEvalCoord2d(GLdouble u, GLdouble v);
-WINGDIAPI void APIENTRY glEvalCoord2dv(const GLdouble *u);
-WINGDIAPI void APIENTRY glEvalCoord2f(GLfloat u, GLfloat v);
-WINGDIAPI void APIENTRY glEvalCoord2fv(const GLfloat *u);
-WINGDIAPI void APIENTRY glEvalMesh1(GLenum mode, GLint i1, GLint i2);
-WINGDIAPI void APIENTRY glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
-WINGDIAPI void APIENTRY glEvalPoint1(GLint i);
-WINGDIAPI void APIENTRY glEvalPoint2(GLint i, GLint j);
-WINGDIAPI void APIENTRY glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer);
-WINGDIAPI void APIENTRY glFinish(void);
-WINGDIAPI void APIENTRY glFlush(void);
-WINGDIAPI void APIENTRY glFogf(GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glFogfv(GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glFogi(GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glFogiv(GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glFrontFace(GLenum mode);
-WINGDIAPI void APIENTRY glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-WINGDIAPI GLuint APIENTRY glGenLists(GLsizei range);
-WINGDIAPI void APIENTRY glGenTextures(GLsizei n, GLuint *textures);
-WINGDIAPI void APIENTRY glGetBooleanv(GLenum pname, GLboolean *params);
-WINGDIAPI void APIENTRY glGetClipPlane(GLenum plane, GLdouble *equation);
-WINGDIAPI void APIENTRY glGetDoublev(GLenum pname, GLdouble *params);
-WINGDIAPI GLenum APIENTRY glGetError(void);
-WINGDIAPI void APIENTRY glGetFloatv(GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetIntegerv(GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetLightiv(GLenum light, GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glGetMapdv(GLenum target, GLenum query, GLdouble *v);
-WINGDIAPI void APIENTRY glGetMapfv(GLenum target, GLenum query, GLfloat *v);
-WINGDIAPI void APIENTRY glGetMapiv(GLenum target, GLenum query, GLint *v);
-WINGDIAPI void APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetMaterialiv(GLenum face, GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glGetPixelMapfv(GLenum map, GLfloat *values);
-WINGDIAPI void APIENTRY glGetPixelMapuiv(GLenum map, GLuint *values);
-WINGDIAPI void APIENTRY glGetPixelMapusv(GLenum map, GLushort *values);
-WINGDIAPI void APIENTRY glGetPointerv(GLenum pname, GLvoid* *params);
-WINGDIAPI void APIENTRY glGetPolygonStipple(GLubyte *mask);
-WINGDIAPI const GLubyte * APIENTRY glGetString(GLenum name);
-WINGDIAPI void APIENTRY glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params);
-WINGDIAPI void APIENTRY glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetTexGeniv(GLenum coord, GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
-WINGDIAPI void APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
-WINGDIAPI void APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
-WINGDIAPI void APIENTRY glHint(GLenum target, GLenum mode);
-WINGDIAPI void APIENTRY glIndexMask(GLuint mask);
-WINGDIAPI void APIENTRY glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
-WINGDIAPI void APIENTRY glIndexd(GLdouble c);
-WINGDIAPI void APIENTRY glIndexdv(const GLdouble *c);
-WINGDIAPI void APIENTRY glIndexf(GLfloat c);
-WINGDIAPI void APIENTRY glIndexfv(const GLfloat *c);
-WINGDIAPI void APIENTRY glIndexi(GLint c);
-WINGDIAPI void APIENTRY glIndexiv(const GLint *c);
-WINGDIAPI void APIENTRY glIndexs(GLshort c);
-WINGDIAPI void APIENTRY glIndexsv(const GLshort *c);
-WINGDIAPI void APIENTRY glIndexub(GLubyte c);
-WINGDIAPI void APIENTRY glIndexubv(const GLubyte *c);
-WINGDIAPI void APIENTRY glInitNames(void);
-WINGDIAPI void APIENTRY glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
-WINGDIAPI GLboolean APIENTRY glIsEnabled(GLenum cap);
-WINGDIAPI GLboolean APIENTRY glIsList(GLuint list);
-WINGDIAPI GLboolean APIENTRY glIsTexture(GLuint texture);
-WINGDIAPI void APIENTRY glLightModelf(GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glLightModelfv(GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glLightModeli(GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glLightModeliv(GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glLightf(GLenum light, GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glLighti(GLenum light, GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glLightiv(GLenum light, GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glLineStipple(GLint factor, GLushort pattern);
-WINGDIAPI void APIENTRY glLineWidth(GLfloat width);
-WINGDIAPI void APIENTRY glListBase(GLuint base);
-WINGDIAPI void APIENTRY glLoadIdentity(void);
-WINGDIAPI void APIENTRY glLoadMatrixd(const GLdouble *m);
-WINGDIAPI void APIENTRY glLoadMatrixf(const GLfloat *m);
-WINGDIAPI void APIENTRY glLoadName(GLuint name);
-WINGDIAPI void APIENTRY glLogicOp(GLenum opcode);
-WINGDIAPI void APIENTRY glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
-WINGDIAPI void APIENTRY glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
-WINGDIAPI void APIENTRY glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
-WINGDIAPI void APIENTRY glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
-WINGDIAPI void APIENTRY glMapGrid1d(GLint un, GLdouble u1, GLdouble u2);
-WINGDIAPI void APIENTRY glMapGrid1f(GLint un, GLfloat u1, GLfloat u2);
-WINGDIAPI void APIENTRY glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
-WINGDIAPI void APIENTRY glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
-WINGDIAPI void APIENTRY glMaterialf(GLenum face, GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glMateriali(GLenum face, GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glMaterialiv(GLenum face, GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glMatrixMode(GLenum mode);
-WINGDIAPI void APIENTRY glMultMatrixd(const GLdouble *m);
-WINGDIAPI void APIENTRY glMultMatrixf(const GLfloat *m);
-WINGDIAPI void APIENTRY glNewList(GLuint list, GLenum mode);
-WINGDIAPI void APIENTRY glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz);
-WINGDIAPI void APIENTRY glNormal3bv(const GLbyte *v);
-WINGDIAPI void APIENTRY glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz);
-WINGDIAPI void APIENTRY glNormal3dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
-WINGDIAPI void APIENTRY glNormal3fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glNormal3i(GLint nx, GLint ny, GLint nz);
-WINGDIAPI void APIENTRY glNormal3iv(const GLint *v);
-WINGDIAPI void APIENTRY glNormal3s(GLshort nx, GLshort ny, GLshort nz);
-WINGDIAPI void APIENTRY glNormal3sv(const GLshort *v);
-WINGDIAPI void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
-WINGDIAPI void APIENTRY glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-WINGDIAPI void APIENTRY glPassThrough(GLfloat token);
-WINGDIAPI void APIENTRY glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values);
-WINGDIAPI void APIENTRY glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values);
-WINGDIAPI void APIENTRY glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values);
-WINGDIAPI void APIENTRY glPixelStoref(GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glPixelStorei(GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glPixelTransferf(GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glPixelTransferi(GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glPixelZoom(GLfloat xfactor, GLfloat yfactor);
-WINGDIAPI void APIENTRY glPointSize(GLfloat size);
-WINGDIAPI void APIENTRY glPolygonMode(GLenum face, GLenum mode);
-WINGDIAPI void APIENTRY glPolygonOffset(GLfloat factor, GLfloat units);
-WINGDIAPI void APIENTRY glPolygonStipple(const GLubyte *mask);
-WINGDIAPI void APIENTRY glPopAttrib(void);
-WINGDIAPI void APIENTRY glPopClientAttrib(void);
-WINGDIAPI void APIENTRY glPopMatrix(void);
-WINGDIAPI void APIENTRY glPopName(void);
-WINGDIAPI void APIENTRY glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLclampf *priorities);
-WINGDIAPI void APIENTRY glPushAttrib(GLbitfield mask);
-WINGDIAPI void APIENTRY glPushClientAttrib(GLbitfield mask);
-WINGDIAPI void APIENTRY glPushMatrix(void);
-WINGDIAPI void APIENTRY glPushName(GLuint name);
-WINGDIAPI void APIENTRY glRasterPos2d(GLdouble x, GLdouble y);
-WINGDIAPI void APIENTRY glRasterPos2dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glRasterPos2f(GLfloat x, GLfloat y);
-WINGDIAPI void APIENTRY glRasterPos2fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glRasterPos2i(GLint x, GLint y);
-WINGDIAPI void APIENTRY glRasterPos2iv(const GLint *v);
-WINGDIAPI void APIENTRY glRasterPos2s(GLshort x, GLshort y);
-WINGDIAPI void APIENTRY glRasterPos2sv(const GLshort *v);
-WINGDIAPI void APIENTRY glRasterPos3d(GLdouble x, GLdouble y, GLdouble z);
-WINGDIAPI void APIENTRY glRasterPos3dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glRasterPos3f(GLfloat x, GLfloat y, GLfloat z);
-WINGDIAPI void APIENTRY glRasterPos3fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glRasterPos3i(GLint x, GLint y, GLint z);
-WINGDIAPI void APIENTRY glRasterPos3iv(const GLint *v);
-WINGDIAPI void APIENTRY glRasterPos3s(GLshort x, GLshort y, GLshort z);
-WINGDIAPI void APIENTRY glRasterPos3sv(const GLshort *v);
-WINGDIAPI void APIENTRY glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-WINGDIAPI void APIENTRY glRasterPos4dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-WINGDIAPI void APIENTRY glRasterPos4fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glRasterPos4i(GLint x, GLint y, GLint z, GLint w);
-WINGDIAPI void APIENTRY glRasterPos4iv(const GLint *v);
-WINGDIAPI void APIENTRY glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
-WINGDIAPI void APIENTRY glRasterPos4sv(const GLshort *v);
-WINGDIAPI void APIENTRY glReadBuffer(GLenum mode);
-WINGDIAPI void APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
-WINGDIAPI void APIENTRY glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
-WINGDIAPI void APIENTRY glRectdv(const GLdouble *v1, const GLdouble *v2);
-WINGDIAPI void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
-WINGDIAPI void APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2);
-WINGDIAPI void APIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2);
-WINGDIAPI void APIENTRY glRectiv(const GLint *v1, const GLint *v2);
-WINGDIAPI void APIENTRY glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
-WINGDIAPI void APIENTRY glRectsv(const GLshort *v1, const GLshort *v2);
-WINGDIAPI GLint APIENTRY glRenderMode(GLenum mode);
-WINGDIAPI void APIENTRY glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-WINGDIAPI void APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-WINGDIAPI void APIENTRY glScaled(GLdouble x, GLdouble y, GLdouble z);
-WINGDIAPI void APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z);
-WINGDIAPI void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
-WINGDIAPI void APIENTRY glSelectBuffer(GLsizei size, GLuint *buffer);
-WINGDIAPI void APIENTRY glShadeModel(GLenum mode);
-WINGDIAPI void APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask);
-WINGDIAPI void APIENTRY glStencilMask(GLuint mask);
-WINGDIAPI void APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
-WINGDIAPI void APIENTRY glTexCoord1d(GLdouble s);
-WINGDIAPI void APIENTRY glTexCoord1dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glTexCoord1f(GLfloat s);
-WINGDIAPI void APIENTRY glTexCoord1fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glTexCoord1i(GLint s);
-WINGDIAPI void APIENTRY glTexCoord1iv(const GLint *v);
-WINGDIAPI void APIENTRY glTexCoord1s(GLshort s);
-WINGDIAPI void APIENTRY glTexCoord1sv(const GLshort *v);
-WINGDIAPI void APIENTRY glTexCoord2d(GLdouble s, GLdouble t);
-WINGDIAPI void APIENTRY glTexCoord2dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glTexCoord2f(GLfloat s, GLfloat t);
-WINGDIAPI void APIENTRY glTexCoord2fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glTexCoord2i(GLint s, GLint t);
-WINGDIAPI void APIENTRY glTexCoord2iv(const GLint *v);
-WINGDIAPI void APIENTRY glTexCoord2s(GLshort s, GLshort t);
-WINGDIAPI void APIENTRY glTexCoord2sv(const GLshort *v);
-WINGDIAPI void APIENTRY glTexCoord3d(GLdouble s, GLdouble t, GLdouble r);
-WINGDIAPI void APIENTRY glTexCoord3dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glTexCoord3f(GLfloat s, GLfloat t, GLfloat r);
-WINGDIAPI void APIENTRY glTexCoord3fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glTexCoord3i(GLint s, GLint t, GLint r);
-WINGDIAPI void APIENTRY glTexCoord3iv(const GLint *v);
-WINGDIAPI void APIENTRY glTexCoord3s(GLshort s, GLshort t, GLshort r);
-WINGDIAPI void APIENTRY glTexCoord3sv(const GLshort *v);
-WINGDIAPI void APIENTRY glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-WINGDIAPI void APIENTRY glTexCoord4dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-WINGDIAPI void APIENTRY glTexCoord4fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glTexCoord4i(GLint s, GLint t, GLint r, GLint q);
-WINGDIAPI void APIENTRY glTexCoord4iv(const GLint *v);
-WINGDIAPI void APIENTRY glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
-WINGDIAPI void APIENTRY glTexCoord4sv(const GLshort *v);
-WINGDIAPI void APIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-WINGDIAPI void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glTexEnviv(GLenum target, GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glTexGend(GLenum coord, GLenum pname, GLdouble param);
-WINGDIAPI void APIENTRY glTexGendv(GLenum coord, GLenum pname, const GLdouble *params);
-WINGDIAPI void APIENTRY glTexGenf(GLenum coord, GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glTexGeni(GLenum coord, GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glTexGeniv(GLenum coord, GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-WINGDIAPI void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-WINGDIAPI void APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param);
-WINGDIAPI void APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
-WINGDIAPI void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param);
-WINGDIAPI void APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
-WINGDIAPI void APIENTRY glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
-WINGDIAPI void APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-WINGDIAPI void APIENTRY glTranslated(GLdouble x, GLdouble y, GLdouble z);
-WINGDIAPI void APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z);
-WINGDIAPI void APIENTRY glVertex2d(GLdouble x, GLdouble y);
-WINGDIAPI void APIENTRY glVertex2dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glVertex2f(GLfloat x, GLfloat y);
-WINGDIAPI void APIENTRY glVertex2fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glVertex2i(GLint x, GLint y);
-WINGDIAPI void APIENTRY glVertex2iv(const GLint *v);
-WINGDIAPI void APIENTRY glVertex2s(GLshort x, GLshort y);
-WINGDIAPI void APIENTRY glVertex2sv(const GLshort *v);
-WINGDIAPI void APIENTRY glVertex3d(GLdouble x, GLdouble y, GLdouble z);
-WINGDIAPI void APIENTRY glVertex3dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z);
-WINGDIAPI void APIENTRY glVertex3fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glVertex3i(GLint x, GLint y, GLint z);
-WINGDIAPI void APIENTRY glVertex3iv(const GLint *v);
-WINGDIAPI void APIENTRY glVertex3s(GLshort x, GLshort y, GLshort z);
-WINGDIAPI void APIENTRY glVertex3sv(const GLshort *v);
-WINGDIAPI void APIENTRY glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-WINGDIAPI void APIENTRY glVertex4dv(const GLdouble *v);
-WINGDIAPI void APIENTRY glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-WINGDIAPI void APIENTRY glVertex4fv(const GLfloat *v);
-WINGDIAPI void APIENTRY glVertex4i(GLint x, GLint y, GLint z, GLint w);
-WINGDIAPI void APIENTRY glVertex4iv(const GLint *v);
-WINGDIAPI void APIENTRY glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
-WINGDIAPI void APIENTRY glVertex4sv(const GLshort *v);
-WINGDIAPI void APIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-WINGDIAPI void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
-
-*/
diff --git a/src/libjin/Audio/SDL/je_sdl_audio.cpp b/src/libjin/Audio/SDL/je_sdl_audio.cpp
index 96df17f..c21d077 100644
--- a/src/libjin/Audio/SDL/je_sdl_audio.cpp
+++ b/src/libjin/Audio/SDL/je_sdl_audio.cpp
@@ -9,134 +9,137 @@
#include "je_sdl_audio.h"
#include "je_sdl_source.h"
+using namespace JinEngine::Math;
+
namespace JinEngine
{
namespace Audio
{
-
- using namespace JinEngine::Math;
-
- /* עcallbackƵ̵߳ */
- static void defaultCallback(void *userdata, Uint8 *stream, int size)
- {
- static SDLAudio* audio = static_cast<SDLAudio*>(userdata);
- if (!audio->goOnProcess())
- return;
- audio->lock();
- audio->processCommands();
- audio->processSources(stream, size);
- audio->processBuffer(stream, size);
- audio->unlock();
- }
-
- /*call only once*/ bool SDLAudio::initSystem(const SettingBase* s)
- {
- #if defined(jin_debug)
- Loghelper::log(Loglevel::LV_INFO, "Init AudioManager System");
- #endif
-
- if (SDL_Init(SDL_INIT_AUDIO) < 0)
- return false;
- SDL_AudioSpec spec;
- Setting* setting = (Setting*)s;
- if (setting == nullptr)
- return false;
-
- unsigned int samplerate = setting->samplerate;
- unsigned int samples = clamp<int>(setting->samples, 1, setting->samplerate);
-
- spec.freq = samplerate; // ÿsample,õ 11025, 22050, 44100 and 48000 Hz.
- spec.format = AUDIO_S16SYS; // signed 16-bit samples in native byte order
- spec.channels = SDLAUDIO_CHANNELS; //
- spec.samples = samples; // ÿβʱһã=setting->samplerateÿֻ1
- spec.userdata = this;
- spec.callback = defaultCallback;
-
- audioDevice = SDL_OpenAudioDevice(NULL, 0, &spec, NULL, 0);
- if (audioDevice == 0)
- return false;
- /* start audio */
- SDL_PauseAudioDevice(audioDevice, 0);
- return true;
- }
-
- /*call only once*/ void SDLAudio::quitSystem()
- {
- SDL_CloseAudio();
- }
-
- void SDLAudio::lock()
- {
- SDL_LockAudioDevice(audioDevice);
- }
-
- void SDLAudio::unlock()
- {
- SDL_UnlockAudioDevice(audioDevice);
- }
-
- bool SDLAudio::goOnProcess()
- {
- if (state == SDLAudio::State::STOP)
- {
- SDLSourceManager::get()->removeAllSource();
- pause();
- return false;
- }
- else if (state == SDLAudio::State::PAUSE)
- return false;
- else
- return true;
- }
-
- void SDLAudio::processCommands()
- {
- SDLSourceManager::get()->processCommands();
- }
-
- void SDLAudio::processSources(void* buffer, size_t len)
- {
- SDLSourceManager::get()->processSources(buffer, len);
- }
-
- void SDLAudio::processBuffer(void* buff, size_t len)
- {
- short* buffer = (short*)buff;
- int samples = (len / SDLAUDIO_BYTEDEPTH) >> 1; // ˫
- const char L = 0, R = 1;
- for (int i = 0; i < samples; ++i)
- {
- short* clip = buffer + (i << 1);
- clip[L] *= volume;
- clip[R] *= volume;
- }
- }
-
- void SDLAudio::play()
- {
- state = State::PLAY;
- }
-
- void SDLAudio::stop()
- {
- state = State::STOP;
- }
-
- void SDLAudio::pause()
- {
- state = State::PAUSE;
- }
-
- void SDLAudio::resume()
- {
- state = State::PLAY;
- }
-
- void SDLAudio::setVolume(float volume)
- {
- this->volume = clamp(volume, 0.0f, 1.0f);
- }
-
+ namespace SDL
+ {
+
+ /* עcallbackƵ̵߳ */
+ static void defaultCallback(void *userdata, Uint8 *stream, int size)
+ {
+ static SDLAudio* audio = static_cast<SDLAudio*>(userdata);
+ if (!audio->goOnProcess())
+ return;
+ audio->lock();
+ audio->processCommands();
+ audio->processSources(stream, size);
+ audio->processBuffer(stream, size);
+ audio->unlock();
+ }
+
+ /*call only once*/ bool SDLAudio::initSystem(const SettingBase* s)
+ {
+ jin_log_info("Initialize audio system.");
+
+ if (SDL_Init(SDL_INIT_AUDIO) < 0)
+ return false;
+
+ SDL_AudioSpec spec;
+ Setting* setting = (Setting*)s;
+ if (setting == nullptr)
+ return false;
+
+ unsigned int samplerate = setting->samplerate;
+ unsigned int samples = clamp<int>(setting->samples, 1, setting->samplerate);
+
+ spec.freq = samplerate; // ÿsample,õ 11025, 22050, 44100 and 48000 Hz.
+ spec.format = AUDIO_S16SYS; // signed 16-bit samples in native byte order
+ spec.channels = SDLAUDIO_CHANNELS; //
+ spec.samples = samples; // ÿβʱһã=setting->samplerateÿֻ1
+ spec.userdata = this;
+ spec.callback = defaultCallback;
+
+ audioDevice = SDL_OpenAudioDevice(NULL, 0, &spec, NULL, 0);
+ if (audioDevice == 0)
+ return false;
+ /* start audio */
+ SDL_PauseAudioDevice(audioDevice, 0);
+ return true;
+ }
+
+ /*call only once*/ void SDLAudio::quitSystem()
+ {
+ jin_log_info("Quit audio system.");
+ SDL_CloseAudio();
+ }
+
+ void SDLAudio::lock()
+ {
+ SDL_LockAudioDevice(audioDevice);
+ }
+
+ void SDLAudio::unlock()
+ {
+ SDL_UnlockAudioDevice(audioDevice);
+ }
+
+ bool SDLAudio::goOnProcess()
+ {
+ if (state == SDLAudio::State::STOP)
+ {
+ SDLSourceManager::get()->removeAllSource();
+ pause();
+ return false;
+ }
+ else if (state == SDLAudio::State::PAUSE)
+ return false;
+ else
+ return true;
+ }
+
+ void SDLAudio::processCommands()
+ {
+ SDLSourceManager::get()->processCommands();
+ }
+
+ void SDLAudio::processSources(void* buffer, size_t len)
+ {
+ SDLSourceManager::get()->processSources(buffer, len);
+ }
+
+ void SDLAudio::processBuffer(void* buff, size_t len)
+ {
+ short* buffer = (short*)buff;
+ int samples = (len / SDLAUDIO_BYTEDEPTH) >> 1; // ˫
+ const char L = 0, R = 1;
+ for (int i = 0; i < samples; ++i)
+ {
+ short* clip = buffer + (i << 1);
+ clip[L] *= volume;
+ clip[R] *= volume;
+ }
+ }
+
+ void SDLAudio::play()
+ {
+ state = State::PLAY;
+ }
+
+ void SDLAudio::stop()
+ {
+ state = State::STOP;
+ }
+
+ void SDLAudio::pause()
+ {
+ state = State::PAUSE;
+ }
+
+ void SDLAudio::resume()
+ {
+ state = State::PLAY;
+ }
+
+ void SDLAudio::setVolume(float volume)
+ {
+ this->volume = clamp(volume, 0.0f, 1.0f);
+ }
+
+ } // namespace SDL
} // namespace Audio
} // namespace JinEngine
diff --git a/src/libjin/Audio/SDL/je_sdl_audio.h b/src/libjin/Audio/SDL/je_sdl_audio.h
index 57fee5b..77162d4 100644
--- a/src/libjin/Audio/SDL/je_sdl_audio.h
+++ b/src/libjin/Audio/SDL/je_sdl_audio.h
@@ -1,5 +1,5 @@
-#ifndef __JE_AUDIO_SDL_H
-#define __JE_AUDIO_SDL_H
+#ifndef __JE_AUDIO_SDL_H__
+#define __JE_AUDIO_SDL_H__
#include "../../core/je_configuration.h"
#if defined(jin_audio) && (jin_audio == jin_audio_sdl)
@@ -13,123 +13,126 @@ namespace JinEngine
{
namespace Audio
{
-
- #define SDLAUDIO_BITDEPTH 16
- #define SDLAUDIO_BYTEDEPTH (SDLAUDIO_BITDEPTH >> 3)
- #define SDLAUDIO_CHANNELS 2
-
- ///
- /// Audio system SDL implementation.
- ///
- class SDLAudio : public AudioManager<SDLAudio>
- {
- public:
- ///
- /// SDL audio setting.
- ///
- struct Setting : SettingBase
- {
- public:
- int samplerate; // Ƶ
- int samples; // sample<=samplerate
- };
-
- ///
- /// Play all sources whose state is playing.
- ///
- void play() override;
-
- ///
- /// Stop and remove all sources from the queue.
- ///
- void stop() override;
-
- ///
- /// Pause audio.
- ///
- void pause() override;
-
- ///
- /// Resume audio.
- ///
- void resume() override;
-
- ///
- /// Set global audio volume.
- ///
- void setVolume(float volume) override;
-
- ///
- /// Process all commands in the queue.
- ///
- void processCommands();
-
- ///
- /// Process all sources.
- ///
- /// @param buffer Source buffer.
- /// @param len Source length.
- ///
- void processSources(void* buffer, size_t len);
-
- ///
- /// Process audio buffer.
- ///
- /// @param buffer Audio stream buffer.
- /// @param len Length of stream buffer.
- ///
- void processBuffer(void* buffer, size_t len);
-
- ///
- /// Goon process.
- ///
- /// @return True if sucessful, otherwise return false.
- ///
- bool goOnProcess();
-
- ///
- /// Lock audio device.
- ///
- void lock();
-
- ///
- /// Unlock audio device.
- ///
- void unlock();
-
- private:
- singleton(SDLAudio);
-
- ///
- /// SDL audio constructor.
- ///
- SDLAudio() {};
-
- ///
- /// SDL audio destructor.
- ///
- ~SDLAudio() {};
-
- ///
- /// Initialize audio system.
- ///
- /// @param setting Audio setting.
- ///
- bool initSystem(const SettingBase* setting) override;
-
- ///
- /// Quit audio system.
- ///
- void quitSystem() override;
-
- // Audio device id.
- unsigned int audioDevice;
-
- };
-
+ namespace SDL
+ {
+
+#define SDLAUDIO_BITDEPTH 16
+#define SDLAUDIO_BYTEDEPTH (SDLAUDIO_BITDEPTH >> 3)
+#define SDLAUDIO_CHANNELS 2
+
+ ///
+ /// Audio system SDL implementation.
+ ///
+ class SDLAudio : public AudioManager<SDLAudio>
+ {
+ public:
+ ///
+ /// SDL audio setting.
+ ///
+ struct Setting : SettingBase
+ {
+ public:
+ int samplerate; // Ƶ
+ int samples; // sample<=samplerate
+ };
+
+ ///
+ /// Play all sources whose state is playing.
+ ///
+ void play() override;
+
+ ///
+ /// Stop and remove all sources from the queue.
+ ///
+ void stop() override;
+
+ ///
+ /// Pause audio.
+ ///
+ void pause() override;
+
+ ///
+ /// Resume audio.
+ ///
+ void resume() override;
+
+ ///
+ /// Set global audio volume.
+ ///
+ void setVolume(float volume) override;
+
+ ///
+ /// Process all commands in the queue.
+ ///
+ void processCommands();
+
+ ///
+ /// Process all sources.
+ ///
+ /// @param buffer Source buffer.
+ /// @param len Source length.
+ ///
+ void processSources(void* buffer, size_t len);
+
+ ///
+ /// Process audio buffer.
+ ///
+ /// @param buffer Audio stream buffer.
+ /// @param len Length of stream buffer.
+ ///
+ void processBuffer(void* buffer, size_t len);
+
+ ///
+ /// Goon process.
+ ///
+ /// @return True if sucessful, otherwise return false.
+ ///
+ bool goOnProcess();
+
+ ///
+ /// Lock audio device.
+ ///
+ void lock();
+
+ ///
+ /// Unlock audio device.
+ ///
+ void unlock();
+
+ private:
+ singleton(SDLAudio);
+
+ ///
+ /// SDL audio constructor.
+ ///
+ SDLAudio() {};
+
+ ///
+ /// SDL audio destructor.
+ ///
+ ~SDLAudio() {};
+
+ ///
+ /// Initialize audio system.
+ ///
+ /// @param setting Audio setting.
+ ///
+ bool initSystem(const SettingBase* setting) override;
+
+ ///
+ /// Quit audio system.
+ ///
+ void quitSystem() override;
+
+ // Audio device id.
+ unsigned int audioDevice;
+
+ };
+
+ } // namespace SDL
} // namespace Audio
} // namespace JinEngine
#endif // (jin_audio) && (jin_audio == jin_audio_sdl)
-#endif // __JE_AUDIO_SDL_H \ No newline at end of file
+#endif // __JE_AUDIO_SDL_H__ \ No newline at end of file
diff --git a/src/libjin/Audio/SDL/je_sdl_source.cpp b/src/libjin/Audio/SDL/je_sdl_source.cpp
index 72607dd..207aa86 100644
--- a/src/libjin/Audio/SDL/je_sdl_source.cpp
+++ b/src/libjin/Audio/SDL/je_sdl_source.cpp
@@ -6,168 +6,172 @@
#include <climits>
#define STB_VORBIS_HEADER_ONLY
-#include "../../3rdparty/stb/stb_vorbis.c"
+#include "stb/stb_vorbis.c"
+#include "wav/wav.h"
+
#include "../../math/je_math.h"
#include "../../utils/je_macros.h"
-#include "../../3rdparty/wav/wav.h"
#include "je_sdl_audio.h"
#include "je_sdl_source.h"
+using namespace JinEngine::Math;
+
namespace JinEngine
{
namespace Audio
{
-
- using namespace JinEngine::Math;
-
- #define BITS 8
-
- typedef struct SDLSourceCommand
- {
- typedef enum Action
- {
- Nothing = 0,
- Play,
- Stop,
- Pause,
- Resume,
- Rewind,
- SetVolume,
- SetLoop,
- SetRate,
- };
- Action action;
- union {
- int _integer;
- float _float;
- bool _boolean;
- const char* _string;
- } parameter;
-
- SDLSource* source;
- };
-
- typedef enum CHANNEL
- {
- MONO = 1, //
- STEREO = 2, //
- };
-
- typedef /*mask*/ enum STATUS
- {
- PLAYING = 1,
- PAUSED = 2,
- STOPPED = 4
- };
-
- #define Command SDLSourceCommand
- #define Action Command::Action
- #define Manager SDLSourceManager
-
- ///*class member*/ std::queue<Command*> Manager::commands;
- ///*class member*/ std::stack<Command*> Manager::commandsPool;
- ///*class member*/ std::vector<SDLSource*> Manager::sources;
- /*class member*/ Manager* Manager::manager = nullptr;
-
- SDLSource* SDLSource::createSource(const char* file)
- {
- std::ifstream fs;
- fs.open(file, std::ios::binary);
- if (!fs.is_open())
- {
- fs.close();
- return nullptr;
- }
- fs.seekg(0,std::ios::end);
- int size = fs.tellg();
- fs.seekg(0, std::ios::beg);
- char* buffer = (char*)malloc(size);
- memset(buffer, 0, size);
- fs.read(buffer, size);
- fs.close();
- SDLSource* source = createSource(buffer, size);
- free(buffer);
- return source;
- }
-
- SDLSource* SDLSource::createSource(void* mem, size_t size)
- {
- if (mem == nullptr)
- return nullptr;
- SDLSource* source = new SDLSource();
- try
- {
- SourceType format = getType(mem, size);
- switch (format)
- {
- case OGG: source->decode_ogg(mem, size); break;
- case WAV: source->decode_wav(mem, size); break;
- }
- }
- catch (SourceException& exp)
- {
- delete source;
- return nullptr;
- };
- return source;
- }
-
- SDLSource::SDLSource()
- {
- memset(&status, 0, sizeof(status));
- memset(&raw, 0, sizeof(raw));
- status.volume = 1;
- }
-
- SDLSource::~SDLSource()
- {
- delete raw.data;
- raw.end = 0;
- raw.data = 0;
- }
-
- void SDLSource::decode_wav(void* mem, int size)
- {
- wav_t wav;
- if (wav_read(&wav, mem, size) == 0)
- {
- raw.data = wav.data;
- raw.length = wav.length * wav.channels * wav.bitdepth / 8;
- raw.channels = clamp<int>(wav.channels, CHANNEL::MONO, CHANNEL::STEREO);
- raw.end = (char*)raw.data + raw.length;
- raw.samplerate = wav.samplerate;
- raw.bitdepth = wav.bitdepth;
- raw.samples = wav.length;
- }
- else
- throw SourceException();
- }
-
- void SDLSource::decode_ogg(void* _mem, int size)
- {
- unsigned char* mem = (unsigned char*)_mem;
- int channels;
- int samplerate;
- short* data = (short*)raw.data;
- int samples = stb_vorbis_decode_memory(
- mem,
- size,
- &channels,
- &samplerate,
- &data
- );
- const int bitdepth = sizeof(short) * BITS;
- raw.channels = channels;
- raw.samplerate = samplerate;
- raw.data = data;
- raw.samples = samples; // һsample
- raw.length = samples * channels * sizeof(short); // һsample
- raw.bitdepth = bitdepth;
- raw.end = (char*)data + raw.length;
- }
-
- #define ActionNone(T)\
+ namespace SDL
+ {
+
+
+#define BITS 8
+
+ typedef struct SDLSourceCommand
+ {
+ typedef enum Action
+ {
+ Nothing = 0,
+ Play,
+ Stop,
+ Pause,
+ Resume,
+ Rewind,
+ SetVolume,
+ SetLoop,
+ SetRate,
+ };
+ Action action;
+ union {
+ int _integer;
+ float _float;
+ bool _boolean;
+ const char* _string;
+ } parameter;
+
+ SDLSource* source;
+ };
+
+ typedef enum CHANNEL
+ {
+ MONO = 1, //
+ STEREO = 2, //
+ };
+
+ typedef /*mask*/ enum STATUS
+ {
+ PLAYING = 1,
+ PAUSED = 2,
+ STOPPED = 4
+ };
+
+#define Command SDLSourceCommand
+#define Action Command::Action
+#define Manager SDLSourceManager
+
+ ///*class member*/ std::queue<Command*> Manager::commands;
+ ///*class member*/ std::stack<Command*> Manager::commandsPool;
+ ///*class member*/ std::vector<SDLSource*> Manager::sources;
+ /*class member*/ Manager* Manager::manager = nullptr;
+
+ SDLSource* SDLSource::createSource(const char* file)
+ {
+ std::ifstream fs;
+ fs.open(file, std::ios::binary);
+ if (!fs.is_open())
+ {
+ fs.close();
+ return nullptr;
+ }
+ fs.seekg(0, std::ios::end);
+ int size = fs.tellg();
+ fs.seekg(0, std::ios::beg);
+ char* buffer = (char*)malloc(size);
+ memset(buffer, 0, size);
+ fs.read(buffer, size);
+ fs.close();
+ SDLSource* source = createSource(buffer, size);
+ free(buffer);
+ return source;
+ }
+
+ SDLSource* SDLSource::createSource(void* mem, size_t size)
+ {
+ if (mem == nullptr)
+ return nullptr;
+ SDLSource* source = new SDLSource();
+ try
+ {
+ SourceType format = getType(mem, size);
+ switch (format)
+ {
+ case OGG: source->decode_ogg(mem, size); break;
+ case WAV: source->decode_wav(mem, size); break;
+ }
+ }
+ catch (SourceException& exp)
+ {
+ delete source;
+ return nullptr;
+ };
+ return source;
+ }
+
+ SDLSource::SDLSource()
+ {
+ memset(&status, 0, sizeof(status));
+ memset(&raw, 0, sizeof(raw));
+ status.volume = 1;
+ }
+
+ SDLSource::~SDLSource()
+ {
+ delete raw.data;
+ raw.end = 0;
+ raw.data = 0;
+ }
+
+ void SDLSource::decode_wav(void* mem, int size)
+ {
+ wav_t wav;
+ if (wav_read(&wav, mem, size) == 0)
+ {
+ raw.data = wav.data;
+ raw.length = wav.length * wav.channels * wav.bitdepth / 8;
+ raw.channels = clamp<int>(wav.channels, CHANNEL::MONO, CHANNEL::STEREO);
+ raw.end = (char*)raw.data + raw.length;
+ raw.samplerate = wav.samplerate;
+ raw.bitdepth = wav.bitdepth;
+ raw.samples = wav.length;
+ }
+ else
+ throw SourceException();
+ }
+
+ void SDLSource::decode_ogg(void* _mem, int size)
+ {
+ unsigned char* mem = (unsigned char*)_mem;
+ int channels;
+ int samplerate;
+ short* data = (short*)raw.data;
+ int samples = stb_vorbis_decode_memory(
+ mem,
+ size,
+ &channels,
+ &samplerate,
+ &data
+ );
+ const int bitdepth = sizeof(short) * BITS;
+ raw.channels = channels;
+ raw.samplerate = samplerate;
+ raw.data = data;
+ raw.samples = samples; // һsample
+ raw.length = samples * channels * sizeof(short); // һsample
+ raw.bitdepth = bitdepth;
+ raw.end = (char*)data + raw.length;
+ }
+
+#define ActionNone(T)\
do{\
Command* cmd = Manager::get()->getCommand();\
cmd->action = Action::T; \
@@ -175,7 +179,7 @@ namespace JinEngine
Manager::get()->pushCommand(cmd); \
} while (0)
- #define ActionArg(T, ARGT, ARG)\
+#define ActionArg(T, ARGT, ARG)\
do{\
Command* cmd = Manager::get()->getCommand();\
cmd->action = Action::T; \
@@ -184,217 +188,217 @@ namespace JinEngine
Manager::get()->pushCommand(cmd); \
}while(0)
- #define ActionInt(T, INT) ActionArg(T, _integer, INT)
- #define ActionFloat(T, FLT) ActionArg(T, _float, FLT)
- #define ActionString(T, STR) ActionArg(T, _string, STR)
- #define ActionBool(T, BOL) ActionArg(T, _boolean, BOL)
-
- void SDLSource::play()
- {
- ActionNone(Play);
- }
-
- void SDLSource::stop()
- {
- ActionNone(Stop);
- }
-
- void SDLSource::pause()
- {
- ActionNone(Pause);
- }
-
- void SDLSource::resume()
- {
- ActionNone(Resume);
- }
-
- void SDLSource::rewind()
- {
- ActionNone(Rewind);
- }
-
- inline bool SDLSource::isStopped() const
- {
- return is(STOPPED);
- }
-
- bool SDLSource::isPaused() const
- {
- return is(PAUSED);
- }
-
- void SDLSource::setPitch(float pitch)
- {
- }
-
- void SDLSource::setVolume(float volume)
- {
- ActionFloat(SetVolume, clamp(volume, 0.0f, 1.0f));
- }
-
- void SDLSource::setLoop(bool loop)
- {
- ActionBool(SetLoop, loop);
- }
-
- void SDLSource::setRate(float rate)
- {
- ActionFloat(SetRate, rate);
- }
-
- inline void SDLSource::handle(
- SDLSourceManager* manager,
- SDLSourceCommand* cmd
- )
- {
- switch (cmd->action)
- {
- case Command::Action::Play:
- manager->removeSource(this);
- manager->pushSource(this);
- status.state = PLAYING;
- status.pos = 0; // rewind
- break;
- case Command::Action::Stop:
- manager->removeSource(this);
- status.state = STOPPED;
- status.pos = 0; // rewind
- break;
- case Command::Action::Pause:
- manager->removeSource(this);
- status.state = PAUSED;
- break;
- case Command::Action::Resume:
- manager->removeSource(this);
- manager->pushSource(this);
- status.state = PLAYING;
- break;
- case Command::Action::Rewind:
- status.state = PLAYING;
- status.pos = 0;
- break;
- case Command::Action::SetVolume:
- status.volume = cmd->parameter._float;
- break;
- case Command::Action::SetLoop:
- status.loop = cmd->parameter._boolean;
- break;
- }
- }
-
- inline void SDLSource::process(void* buf, size_t size)
- {
- short* buffer = (short*)buf; // AUDIO_S16SYS
- int samples = (size / SDLAUDIO_BYTEDEPTH) >> 1; // ˫
- const char L = 0, R = 1;
- for (int i = 0; i < samples; ++i)
- {
- char* source = (char*)raw.data + status.pos * (raw.bitdepth / 8) * raw.channels;
- short l = 0;
- short r = 0;
- if (raw.bitdepth == 16)
- {
- l = ((short*)source)[L] * status.volume;
- r = ((short*)source)[L + raw.channels - 1] * status.volume;
- }
- else if (raw.bitdepth == 8)
- {
- l = source[L] << 8; // << 8 Ŵ16bits
- r = source[L + raw.channels - 1] << 8;
- }
- short* sample = buffer + (i << 1);
- sample[L] = clamp(sample[L] + l, SHRT_MIN, SHRT_MAX); //
- sample[R] = clamp(sample[R] + r, SHRT_MIN, SHRT_MAX); //
- ++status.pos;
- if (status.pos > raw.samples && status.loop)
- status.pos = 0; // rewind
- else if (status.pos > raw.samples && !status.loop)
- break;
- }
- }
-
- Manager* Manager::get()
- {
- return (manager == nullptr ? manager = new Manager() : manager);
- }
-
- void Manager::processCommands()
- {
- Command* cmd = nullptr;
- SDLSource* source = nullptr;
- while (!commands.empty())
- {
- cmd = commands.front();
- if (cmd != nullptr)
- {
- source = cmd->source;
- if (source != nullptr)
- source->handle(manager, cmd);
- }
- commands.pop();
- }
- }
-
- /* AUDIO_S16SYS[size>>1] buffer */
- void Manager::processSources(void* buf, size_t size)
- {
- /* clear render buffer */
- memset(buf, 0, size);
- SDLSource* src = nullptr;
- std::vector<SDLSource*>::iterator it = sources.begin();
- for (; it != sources.end();)
- {
- src = *it;
- if (src != nullptr)
- src->process(buf, size);
- ++it;
- }
- }
-
- void Manager::removeSource(SDLSource* source)
- {
- std::vector<SDLSource*>::iterator it = sources.begin();
- for (it = sources.begin(); it != sources.end(); )
- {
- if (*it == source)
- {
- it = sources.erase(it);
- return;
- }
- ++it;
- }
- }
-
- void Manager::removeAllSource()
- {
- sources.clear();
- }
-
- void Manager::pushSource(SDLSource* source)
- {
- if(source != nullptr)
- sources.push_back(source);
- }
-
- void Manager::pushCommand(SDLSourceCommand* cmd)
- {
- commands.push(cmd);
- }
-
- Command* Manager::getCommand()
- {
- if (!commandsPool.empty())
- {
- Command* cmd = commandsPool.top();
- commandsPool.pop();
- return cmd;
- }
- return new Command();
- }
-
-
+#define ActionInt(T, INT) ActionArg(T, _integer, INT)
+#define ActionFloat(T, FLT) ActionArg(T, _float, FLT)
+#define ActionString(T, STR) ActionArg(T, _string, STR)
+#define ActionBool(T, BOL) ActionArg(T, _boolean, BOL)
+
+ void SDLSource::play()
+ {
+ ActionNone(Play);
+ }
+
+ void SDLSource::stop()
+ {
+ ActionNone(Stop);
+ }
+
+ void SDLSource::pause()
+ {
+ ActionNone(Pause);
+ }
+
+ void SDLSource::resume()
+ {
+ ActionNone(Resume);
+ }
+
+ void SDLSource::rewind()
+ {
+ ActionNone(Rewind);
+ }
+
+ inline bool SDLSource::isStopped() const
+ {
+ return is(STOPPED);
+ }
+
+ bool SDLSource::isPaused() const
+ {
+ return is(PAUSED);
+ }
+
+ void SDLSource::setPitch(float pitch)
+ {
+ }
+
+ void SDLSource::setVolume(float volume)
+ {
+ ActionFloat(SetVolume, clamp(volume, 0.0f, 1.0f));
+ }
+
+ void SDLSource::setLoop(bool loop)
+ {
+ ActionBool(SetLoop, loop);
+ }
+
+ void SDLSource::setRate(float rate)
+ {
+ ActionFloat(SetRate, rate);
+ }
+
+ inline void SDLSource::handle(
+ SDLSourceManager* manager,
+ SDLSourceCommand* cmd
+ )
+ {
+ switch (cmd->action)
+ {
+ case Command::Action::Play:
+ manager->removeSource(this);
+ manager->pushSource(this);
+ status.state = PLAYING;
+ status.pos = 0; // rewind
+ break;
+ case Command::Action::Stop:
+ manager->removeSource(this);
+ status.state = STOPPED;
+ status.pos = 0; // rewind
+ break;
+ case Command::Action::Pause:
+ manager->removeSource(this);
+ status.state = PAUSED;
+ break;
+ case Command::Action::Resume:
+ manager->removeSource(this);
+ manager->pushSource(this);
+ status.state = PLAYING;
+ break;
+ case Command::Action::Rewind:
+ status.state = PLAYING;
+ status.pos = 0;
+ break;
+ case Command::Action::SetVolume:
+ status.volume = cmd->parameter._float;
+ break;
+ case Command::Action::SetLoop:
+ status.loop = cmd->parameter._boolean;
+ break;
+ }
+ }
+
+ inline void SDLSource::process(void* buf, size_t size)
+ {
+ short* buffer = (short*)buf; // AUDIO_S16SYS
+ int samples = (size / SDLAUDIO_BYTEDEPTH) >> 1; // ˫
+ const char L = 0, R = 1;
+ for (int i = 0; i < samples; ++i)
+ {
+ char* source = (char*)raw.data + status.pos * (raw.bitdepth / 8) * raw.channels;
+ short l = 0;
+ short r = 0;
+ if (raw.bitdepth == 16)
+ {
+ l = ((short*)source)[L] * status.volume;
+ r = ((short*)source)[L + raw.channels - 1] * status.volume;
+ }
+ else if (raw.bitdepth == 8)
+ {
+ l = source[L] << 8; // << 8 Ŵ16bits
+ r = source[L + raw.channels - 1] << 8;
+ }
+ short* sample = buffer + (i << 1);
+ sample[L] = clamp(sample[L] + l, SHRT_MIN, SHRT_MAX); //
+ sample[R] = clamp(sample[R] + r, SHRT_MIN, SHRT_MAX); //
+ ++status.pos;
+ if (status.pos > raw.samples && status.loop)
+ status.pos = 0; // rewind
+ else if (status.pos > raw.samples && !status.loop)
+ break;
+ }
+ }
+
+ Manager* Manager::get()
+ {
+ return (manager == nullptr ? manager = new Manager() : manager);
+ }
+
+ void Manager::processCommands()
+ {
+ Command* cmd = nullptr;
+ SDLSource* source = nullptr;
+ while (!commands.empty())
+ {
+ cmd = commands.front();
+ if (cmd != nullptr)
+ {
+ source = cmd->source;
+ if (source != nullptr)
+ source->handle(manager, cmd);
+ }
+ commands.pop();
+ }
+ }
+
+ /* AUDIO_S16SYS[size>>1] buffer */
+ void Manager::processSources(void* buf, size_t size)
+ {
+ /* clear render buffer */
+ memset(buf, 0, size);
+ SDLSource* src = nullptr;
+ std::vector<SDLSource*>::iterator it = sources.begin();
+ for (; it != sources.end();)
+ {
+ src = *it;
+ if (src != nullptr)
+ src->process(buf, size);
+ ++it;
+ }
+ }
+
+ void Manager::removeSource(SDLSource* source)
+ {
+ std::vector<SDLSource*>::iterator it = sources.begin();
+ for (it = sources.begin(); it != sources.end(); )
+ {
+ if (*it == source)
+ {
+ it = sources.erase(it);
+ return;
+ }
+ ++it;
+ }
+ }
+
+ void Manager::removeAllSource()
+ {
+ sources.clear();
+ }
+
+ void Manager::pushSource(SDLSource* source)
+ {
+ if (source != nullptr)
+ sources.push_back(source);
+ }
+
+ void Manager::pushCommand(SDLSourceCommand* cmd)
+ {
+ commands.push(cmd);
+ }
+
+ Command* Manager::getCommand()
+ {
+ if (!commandsPool.empty())
+ {
+ Command* cmd = commandsPool.top();
+ commandsPool.pop();
+ return cmd;
+ }
+ return new Command();
+ }
+
+ } // namespace SDL
} // namespace Audio
} // namespace JinEngine
-#endif // (jin_audio) && (jin_audio == jin_audio_sdl)
+#endif // (jin_audio) && (jin_audio == jin_audio_sdl) \ No newline at end of file
diff --git a/src/libjin/Audio/SDL/je_sdl_source.h b/src/libjin/Audio/SDL/je_sdl_source.h
index 78cae80..bbc8c7a 100644
--- a/src/libjin/Audio/SDL/je_sdl_source.h
+++ b/src/libjin/Audio/SDL/je_sdl_source.h
@@ -1,5 +1,5 @@
-#ifndef __JE_SOURCE_SDL_H
-#define __JE_SOURCE_SDL_H
+#ifndef __JE_SOURCE_SDL_H__
+#define __JE_SOURCE_SDL_H__
#include "../../core/je_configuration.h"
#if defined(jin_audio) && (jin_audio == jin_audio_sdl)
@@ -14,256 +14,259 @@ namespace JinEngine
{
namespace Audio
{
+ namespace SDL
+ {
- typedef struct SDLSourceCommand;
+ typedef struct SDLSourceCommand;
- class SDLSourceManager;
+ class SDLSourceManager;
- ///
- /// Audio source SDL implementation.
- ///
- class SDLSource : public Source
- {
- public:
///
- /// Create source from raw source data file.
+ /// Audio source SDL implementation.
///
- /// @param file Audio source file.
- /// @return Return source if create successful, otherwise return null.
- ///
- static SDLSource* createSource(const char* file);
-
- ///
- /// Create source from raw source data.
- ///
- /// @param mem Source data.
- /// @param size Source data size.
- /// @return Return source if create successful, otherwise return null.
- ///
- static SDLSource* createSource(void* mem, size_t size);
-
- ///
- /// Source destructor.
- ///
- ~SDLSource();
-
- ///
- /// Play source.
- ///
- void play() override;
-
- ///
- /// Stop source.
- ///
- void stop() override;
-
- ///
- /// Pause source.
- ///
- void pause() override;
-
- ///
- /// Resume source.
- ///
- void resume() override;
-
- ///
- /// Rewind source.
- ///
- void rewind() override;
-
- ///
- /// Return if the source is stopped.
- ///
- /// @return True if the source is stopped, otherwise return false.
- ///
- bool isStopped() const override;
-
- ///
- /// Return if the source is paused.
- ///
- /// @return True if the source is paused(, otherwise return false.
- ///
- bool isPaused() const override;
-
- ///
- /// Set pitch.
- ///
- /// @param pitch Pitch of source.
- ///
- void setPitch(float pitch) override;
-
- ///
- /// Set volume.
- ///
- /// @param volume Volume of source.
- ///
- void setVolume(float volume) override;
-
- ///
- /// Set source loop.
- ///
- /// @param loop Looping or not.
- ///
- void setLoop(bool loop) override;
-
- ///
- /// Set source rate.
- ///
- /// @param rate Rate of source.
- ///
- void setRate(float rate) override;
-
- ///
- /// Handle a specific command.
- ///
- /// @param manager Audio manager.
- /// @param cmd Source commad.
- ///
- inline void handle(SDLSourceManager* manager, SDLSourceCommand* cmd);
-
- ///
- /// Process decoded source data.
- ///
- /// @param buffer Source data.
- /// @param size Data size.
- ///
- inline void process(void* buffer, size_t size);
-
- protected:
- ///
- /// Source constructor.
- ///
- SDLSource();
-
- ///
- /// Decode wav file.
- ///
- /// @param mem Wav file data.
- /// @param size Wav data size.
- ///
- void decode_wav(void* mem, int size);
+ class SDLSource : public Source
+ {
+ public:
+ ///
+ /// Create source from raw source data file.
+ ///
+ /// @param file Audio source file.
+ /// @return Return source if create successful, otherwise return null.
+ ///
+ static SDLSource* createSource(const char* file);
+
+ ///
+ /// Create source from raw source data.
+ ///
+ /// @param mem Source data.
+ /// @param size Source data size.
+ /// @return Return source if create successful, otherwise return null.
+ ///
+ static SDLSource* createSource(void* mem, size_t size);
+
+ ///
+ /// Source destructor.
+ ///
+ ~SDLSource();
+
+ ///
+ /// Play source.
+ ///
+ void play() override;
+
+ ///
+ /// Stop source.
+ ///
+ void stop() override;
+
+ ///
+ /// Pause source.
+ ///
+ void pause() override;
+
+ ///
+ /// Resume source.
+ ///
+ void resume() override;
+
+ ///
+ /// Rewind source.
+ ///
+ void rewind() override;
+
+ ///
+ /// Return if the source is stopped.
+ ///
+ /// @return True if the source is stopped, otherwise return false.
+ ///
+ bool isStopped() const override;
+
+ ///
+ /// Return if the source is paused.
+ ///
+ /// @return True if the source is paused(, otherwise return false.
+ ///
+ bool isPaused() const override;
+
+ ///
+ /// Set pitch.
+ ///
+ /// @param pitch Pitch of source.
+ ///
+ void setPitch(float pitch) override;
+
+ ///
+ /// Set volume.
+ ///
+ /// @param volume Volume of source.
+ ///
+ void setVolume(float volume) override;
+
+ ///
+ /// Set source loop.
+ ///
+ /// @param loop Looping or not.
+ ///
+ void setLoop(bool loop) override;
+
+ ///
+ /// Set source rate.
+ ///
+ /// @param rate Rate of source.
+ ///
+ void setRate(float rate) override;
+
+ ///
+ /// Handle a specific command.
+ ///
+ /// @param manager Audio manager.
+ /// @param cmd Source commad.
+ ///
+ inline void handle(SDLSourceManager* manager, SDLSourceCommand* cmd);
+
+ ///
+ /// Process decoded source data.
+ ///
+ /// @param buffer Source data.
+ /// @param size Data size.
+ ///
+ inline void process(void* buffer, size_t size);
+
+ protected:
+ ///
+ /// Source constructor.
+ ///
+ SDLSource();
+
+ ///
+ /// Decode wav file.
+ ///
+ /// @param mem Wav file data.
+ /// @param size Wav data size.
+ ///
+ void decode_wav(void* mem, int size);
+
+ ///
+ /// Decode ogg file.
+ ///
+ /// @param mem ogg file data.
+ /// @param size ogg data size.
+ ///
+ void decode_ogg(void* mem, int size);
+
+ ///
+ /// Check source state.
+ ///
+ /// @param state State to be checked.
+ /// @return True if state is given state, otherwise return false.
+ ///
+ inline bool is(int state) const
+ {
+ return (status.state & state) == state;
+ }
+
+ // Source data.
+ struct {
+ const void* data; // Ƶ
+ int length; // dataֽڳ
+ const void* end; // dataβ = (unsigned char*)data + size
+ int samplerate; // Ƶ
+ unsigned char bitdepth; // ÿsampleıس
+ int samples; // sample = size / (bitdepth / 8)
+ unsigned char channels; // channel1(mono)2(stereo)
+ } raw;
+ // Procedure controller variable.
+ struct {
+ int pos; // ǰŵsample
+ int pitch; // pitch
+ int state; // ǰ״̬
+ bool loop; // loop or not
+ float volume; //
+ } status;
+
+ };
///
- /// Decode ogg file.
- ///
- /// @param mem ogg file data.
- /// @param size ogg data size.
+ /// Source manager.
///
- void decode_ogg(void* mem, int size);
-
- ///
- /// Check source state.
- ///
- /// @param state State to be checked.
- /// @return True if state is given state, otherwise return false.
- ///
- inline bool is(int state) const
- {
- return (status.state & state) == state;
- }
-
- // Source data.
- struct{
- const void* data; // Ƶ
- int length; // dataֽڳ
- const void* end; // dataβ = (unsigned char*)data + size
- int samplerate; // Ƶ
- unsigned char bitdepth; // ÿsampleıس
- int samples; // sample = size / (bitdepth / 8)
- unsigned char channels; // channel1(mono)2(stereo)
- } raw;
- // Procedure controller variable.
- struct{
- int pos; // ǰŵsample
- int pitch; // pitch
- int state; // ǰ״̬
- bool loop; // loop or not
- float volume; //
- } status;
-
- };
-
- ///
- /// Source manager.
- ///
- class SDLSourceManager
- {
- public:
- ///
- /// Get manager singleton.
- ///
- /// @return Singleton of SDL source manager.
- ///
- static SDLSourceManager* get();
-
- ///
- /// Process commands.
- ///
- void processCommands();
-
- ///
- /// Process sources.
- ///
- /// @param buffer Source data.
- /// @param size Size of source data.
- ///
- void processSources(void* buffer, size_t size);
-
- ///
- /// Clear source queue.
- ///
- /// This function will stop all sources.
- ///
- void removeAllSource();
-
- ///
- /// Remove specific source.
- ///
- /// @param source SDL audio source.
- ///
- void removeSource(SDLSource* source);
-
- ///
- /// Push specific source into queue.
- ///
- /// @param source SDL audio source.
- ///
- void pushSource(SDLSource* source);
-
- ///
- /// Get command from queue.
- ///
- /// @return Command at first place.
- ///
- SDLSourceCommand* getCommand();
-
- ///
- /// Push command.
- ///
- /// @param cmd Spcific command.
- ///
- void pushCommand(SDLSourceCommand* cmd);
-
- private:
- std::queue<SDLSourceCommand*> commands;
- std::stack<SDLSourceCommand*> commandsPool;
- std::vector<SDLSource*> sources; // processing sources
- static SDLSourceManager* manager;
-
- };
-
- class SourceException : public std::exception
- {
- const char* what() const throw ()
- {
- return "Load Source Exception";
- }
- };
-
+ class SDLSourceManager
+ {
+ public:
+ ///
+ /// Get manager singleton.
+ ///
+ /// @return Singleton of SDL source manager.
+ ///
+ static SDLSourceManager* get();
+
+ ///
+ /// Process commands.
+ ///
+ void processCommands();
+
+ ///
+ /// Process sources.
+ ///
+ /// @param buffer Source data.
+ /// @param size Size of source data.
+ ///
+ void processSources(void* buffer, size_t size);
+
+ ///
+ /// Clear source queue.
+ ///
+ /// This function will stop all sources.
+ ///
+ void removeAllSource();
+
+ ///
+ /// Remove specific source.
+ ///
+ /// @param source SDL audio source.
+ ///
+ void removeSource(SDLSource* source);
+
+ ///
+ /// Push specific source into queue.
+ ///
+ /// @param source SDL audio source.
+ ///
+ void pushSource(SDLSource* source);
+
+ ///
+ /// Get command from queue.
+ ///
+ /// @return Command at first place.
+ ///
+ SDLSourceCommand* getCommand();
+
+ ///
+ /// Push command.
+ ///
+ /// @param cmd Spcific command.
+ ///
+ void pushCommand(SDLSourceCommand* cmd);
+
+ private:
+ std::queue<SDLSourceCommand*> commands;
+ std::stack<SDLSourceCommand*> commandsPool;
+ std::vector<SDLSource*> sources; // processing sources
+ static SDLSourceManager* manager;
+
+ };
+
+ class SourceException : public std::exception
+ {
+ const char* what() const throw ()
+ {
+ return "Load Source Exception";
+ }
+ };
+
+ } // namespace SDL
} // namespace Audio
} // namespace JinEngine
#endif // (jin_audio) && (jin_audio == jin_audio_sdl)
-#endif // __JE_SOURCE_SDL_H \ No newline at end of file
+#endif // __JE_SOURCE_SDL_H__ \ No newline at end of file
diff --git a/src/libjin/Audio/je_audio_manager.h b/src/libjin/Audio/je_audio_manager.h
index 00b531a..120d38e 100644
--- a/src/libjin/Audio/je_audio_manager.h
+++ b/src/libjin/Audio/je_audio_manager.h
@@ -1,5 +1,5 @@
-#ifndef __JE_AUDIO_H
-#define __JE_AUDIO_H
+#ifndef __JE_AUDIO_H__
+#define __JE_AUDIO_H__
#include "../core/je_configuration.h"
#if defined(jin_audio)
@@ -84,4 +84,4 @@ namespace JinEngine
#endif // jin_audio
-#endif // __JE_AUDIO_H \ No newline at end of file
+#endif // __JE_AUDIO_H__ \ No newline at end of file
diff --git a/src/libjin/Audio/je_source.h b/src/libjin/Audio/je_source.h
index 519d39f..f60daf9 100644
--- a/src/libjin/Audio/je_source.h
+++ b/src/libjin/Audio/je_source.h
@@ -1,5 +1,5 @@
-#ifndef __JE_AUDIO_SOURCE_H
-#define __JE_AUDIO_SOURCE_H
+#ifndef __JE_AUDIO_SOURCE_H__
+#define __JE_AUDIO_SOURCE_H__
#include "../core/je_configuration.h"
#if defined(jin_audio)
@@ -113,4 +113,4 @@ namespace JinEngine
#endif // jin_audio
-#endif // __JE_AUDIO_SOURCE_H \ No newline at end of file
+#endif // __JE_AUDIO_SOURCE_H__ \ No newline at end of file
diff --git a/src/libjin/Common/je_array.hpp b/src/libjin/Common/je_array.hpp
index 361f1f0..8a5cbf1 100644
--- a/src/libjin/Common/je_array.hpp
+++ b/src/libjin/Common/je_array.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_COMMON_ARRAY_H
-#define __JE_COMMON_ARRAY_H
+#ifndef __JE_COMMON_ARRAY_H__
+#define __JE_COMMON_ARRAY_H__
namespace JinEngine
{
diff --git a/src/libjin/Common/je_common.h b/src/libjin/Common/je_common.h
index 0dfa79a..31b67c6 100644
--- a/src/libjin/Common/je_common.h
+++ b/src/libjin/Common/je_common.h
@@ -1,6 +1,7 @@
-#ifndef __JE_COMMON_H
-#define __JE_COMMON_H
+#ifndef __JE_COMMON_H__
+#define __JE_COMMON_H__
+#include "je_exception.h"
#include "je_array.hpp"
#endif \ No newline at end of file
diff --git a/src/libjin/Common/je_exception.cpp b/src/libjin/Common/je_exception.cpp
index e69de29..5489a42 100644
--- a/src/libjin/Common/je_exception.cpp
+++ b/src/libjin/Common/je_exception.cpp
@@ -0,0 +1,46 @@
+#include <stdarg.h>
+
+#include "je_exception.h"
+
+namespace JinEngine
+{
+
+ Exception::Exception(const char *fmt, ...)
+ {
+ va_list args;
+ int size_buffer = 256, size_out;
+ char *buffer;
+ while (true)
+ {
+ buffer = new char[size_buffer];
+ memset(buffer, 0, size_buffer);
+
+ va_start(args, fmt);
+ size_out = vsnprintf(buffer, size_buffer, fmt, args);
+ va_end(args);
+
+ // see http://perfec.to/vsnprintf/pasprintf.c
+ // if size_out ...
+ // == -1 --> output was truncated
+ // == size_buffer --> output was truncated
+ // == size_buffer-1 --> ambiguous, /may/ have been truncated
+ // > size_buffer --> output was truncated, and size_out
+ // bytes would have been written
+ if (size_out == size_buffer || size_out == -1 || size_out == size_buffer - 1)
+ size_buffer *= 2;
+ else if (size_out > size_buffer)
+ size_buffer = size_out + 2; // to avoid the ambiguous case
+ else
+ break;
+
+ delete[] buffer;
+ }
+ mMessage = std::string(buffer);
+ delete[] buffer;
+ }
+
+ Exception::~Exception() throw()
+ {
+ }
+
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Common/je_exception.h b/src/libjin/Common/je_exception.h
index 7c66af8..c319ebd 100644
--- a/src/libjin/Common/je_exception.h
+++ b/src/libjin/Common/je_exception.h
@@ -1,19 +1,42 @@
-#ifndef __JE_EXCEPTION_H
-#define __JE_EXCEPTION_H
+#ifndef __JE_EXCEPTION_H__
+#define __JE_EXCEPTION_H__
#include <exception>
+#include <string>
namespace JinEngine
{
///
- /// Built-in exception class.
+ /// Jin Exception.
///
- class JinException : public std::exception
+ class Exception : public std::exception
{
public:
- JinException();
- const char* what() const throw();
+
+ ///
+ /// Creates a new Exception according to printf-rules.
+ ///
+ /// @param fmt The format string (see printf).
+ ///
+ Exception(const char *fmt, ...);
+ virtual ~Exception() throw();
+
+ ///
+ /// Returns a string containing reason for the exception.
+ ///
+ /// @return A description of the exception.
+ ///
+ inline virtual const char *what() const throw()
+ {
+ return mMessage.c_str();
+ }
+
+ private:
+ ///
+ /// Exception message.
+ ///
+ std::string mMessage;
};
diff --git a/src/libjin/Common/je_noncopyable.h b/src/libjin/Common/je_noncopyable.h
index 89a3e68..eff7121 100644
--- a/src/libjin/Common/je_noncopyable.h
+++ b/src/libjin/Common/je_noncopyable.h
@@ -1,5 +1,5 @@
-#ifndef __JE_NONCOPYABLE_H
-#define __JE_NONCOPYABLE_H
+#ifndef __JE_NONCOPYABLE_H__
+#define __JE_NONCOPYABLE_H__
namespace JinEngine
{
diff --git a/src/libjin/Common/je_object.h b/src/libjin/Common/je_object.h
index c256879..1afbf67 100644
--- a/src/libjin/Common/je_object.h
+++ b/src/libjin/Common/je_object.h
@@ -1,5 +1,5 @@
-#ifndef __JE_OBJECT_H
-#define __JE_OBJECT_H
+#ifndef __JE_OBJECT_H__
+#define __JE_OBJECT_H__
namespace JinEngine
{
@@ -9,6 +9,8 @@ namespace JinEngine
///
class Object
{
+ public:
+
};
} // namespace JinEngine
diff --git a/src/libjin/Common/je_pool.hpp b/src/libjin/Common/je_pool.hpp
index 1107fd5..cb96c5b 100644
--- a/src/libjin/Common/je_pool.hpp
+++ b/src/libjin/Common/je_pool.hpp
@@ -1,11 +1,177 @@
-#ifndef __JE_POOL_H
-#define __JE_POOL_H
+///
+/// An O(1) Object Pool. Original from https://www.codeproject.com/Articles/746630/O-Object-Pool-in-Cplusplus
+///
+#ifndef __JE_POOL_H__
+#define __JE_POOL_H__
+
+#include <stdlib.h>
+#include <iostream>
+
+#include "je_types.h"
namespace JinEngine
{
+ class DefaultMemoryAllocator
+ {
+ public:
+ static inline void *Allocate(size_t size)
+ {
+ return ::operator new(size, ::std::nothrow);
+ }
+ static inline void Deallocate(void *pointer, size_t size)
+ {
+ ::operator delete(pointer);
+ }
+ };
+
+ template<typename T, class TMemoryAllocator = DefaultMemoryAllocator>
+ class Pool
+ {
+ private:
+ struct _Node
+ {
+ void *_memory;
+ size_t _capacity;
+ _Node *_nextNode;
+
+ _Node(size_t capacity)
+ {
+ if (capacity < 1)
+ throw std::invalid_argument("capacity must be at least 1.");
+
+ _memory = TMemoryAllocator::Allocate(_itemSize * capacity);
+ if (_memory == NULL)
+ throw std::bad_alloc();
+
+ _capacity = capacity;
+ _nextNode = NULL;
+ }
+ ~_Node()
+ {
+ TMemoryAllocator::Deallocate(_memory, _itemSize * _capacity);
+ }
+ };
+
+ void *_nodeMemory;
+ T *_firstDeleted;
+ size_t _countInNode;
+ size_t _nodeCapacity;
+ _Node _firstNode;
+ _Node *_lastNode;
+ size_t _maxBlockLength;
+
+ static const size_t _itemSize;
+
+ Pool(const Pool<T, TMemoryAllocator> &source);
+ void operator = (const Pool<T, TMemoryAllocator> &source);
+
+ void _AllocateNewNode()
+ {
+ size_t size = _countInNode;
+ if (size >= _maxBlockLength)
+ size = _maxBlockLength;
+ else
+ {
+ size *= 2;
+
+ if (size < _countInNode)
+ throw std::overflow_error("size became too big.");
+
+ if (size >= _maxBlockLength)
+ size = _maxBlockLength;
+ }
+
+ _Node *newNode = new _Node(size);
+ _lastNode->_nextNode = newNode;
+ _lastNode = newNode;
+ _nodeMemory = newNode->_memory;
+ _countInNode = 0;
+ _nodeCapacity = size;
+ }
+
+ public:
+ explicit Pool(size_t initialCapacity = 32, size_t maxBlockLength = 1000000)
+ : _firstDeleted(NULL)
+ , _countInNode(0)
+ , _nodeCapacity(initialCapacity)
+ , _firstNode(initialCapacity)
+ , _maxBlockLength(maxBlockLength)
+ {
+ if (maxBlockLength < 1)
+ throw std::invalid_argument("maxBlockLength must be at least 1.");
+
+ _nodeMemory = _firstNode._memory;
+ _lastNode = &_firstNode;
+ }
+ ~Pool()
+ {
+ _Node *node = _firstNode._nextNode;
+ while (node)
+ {
+ _Node *nextNode = node->_nextNode;
+ delete node;
+ node = nextNode;
+ }
+ }
+
+ T *New()
+ {
+ if (_firstDeleted)
+ {
+ T *result = _firstDeleted;
+ _firstDeleted = *((T **)_firstDeleted);
+ new(result) T();
+ return result;
+ }
+
+ if (_countInNode >= _nodeCapacity)
+ _AllocateNewNode();
+
+ char *address = (char *)_nodeMemory;
+ address += _countInNode * _itemSize;
+ T *result = new(address) T();
+ _countInNode++;
+ return result;
+ }
+
+ // This method is useful if you want to call a non-default constructor.
+ // It should be used like this:
+ // new (pool.GetNextWithoutInitializing()) ObjectType(... parameters ...);
+ T *GetNextWithoutInitializing()
+ {
+ if (_firstDeleted)
+ {
+ T *result = (T *)_firstDeleted;
+ _firstDeleted = *((T **)_firstDeleted);
+ return result;
+ }
+
+ if (_countInNode >= _nodeCapacity)
+ _AllocateNewNode();
+
+ char *address = (char *)_nodeMemory;
+ address += _countInNode * _itemSize;
+ _countInNode++;
+ return (T *)address;
+ }
+ void Delete(T *content)
+ {
+ content->~T();
+
+ *((T **)content) = _firstDeleted;
+ _firstDeleted = content;
+ }
+ void DeleteWithoutDestroying(T *content)
+ {
+ *((T **)content) = _firstDeleted;
+ _firstDeleted = content;
+ }
+ };
+ template<typename T, class TMemoryAllocator>
+ const size_t Pool<T, TMemoryAllocator>::_itemSize = ((sizeof(T) + sizeof(void *) - 1) / sizeof(void *)) * sizeof(void *);
-}
+} // namespace JinEngine
#endif \ No newline at end of file
diff --git a/src/libjin/Common/je_singleton.hpp b/src/libjin/Common/je_singleton.hpp
index e981e7a..d7f52c9 100644
--- a/src/libjin/Common/je_singleton.hpp
+++ b/src/libjin/Common/je_singleton.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_SINGLETON_H
-#define __JE_SINGLETON_H
+#ifndef __JE_SINGLETON_H__
+#define __JE_SINGLETON_H__
namespace JinEngine
{
@@ -77,4 +77,4 @@ namespace JinEngine
} // namespace JinEngine
-#endif // __JE_SINGLETON_H \ No newline at end of file
+#endif // __JE_SINGLETON_H__
diff --git a/src/libjin/Common/je_stringmap.hpp b/src/libjin/Common/je_stringmap.hpp
index 43e3e9b..7a3bd80 100644
--- a/src/libjin/Common/je_stringmap.hpp
+++ b/src/libjin/Common/je_stringmap.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_COMMON_SREINGMAP_H
-#define __JE_COMMON_SREINGMAP_H
+#ifndef __JE_COMMON_SREINGMAP_H__
+#define __JE_COMMON_SREINGMAP_H__
namespace JinEngine
{
diff --git a/src/libjin/Common/je_subsystem.hpp b/src/libjin/Common/je_subsystem.hpp
index d8e106d..c015bef 100644
--- a/src/libjin/Common/je_subsystem.hpp
+++ b/src/libjin/Common/je_subsystem.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_COMMON_SUBSYSTEM_H
-#define __JE_COMMON_SUBSYSTEM_H
+#ifndef __JE_COMMON_SUBSYSTEM_H__
+#define __JE_COMMON_SUBSYSTEM_H__
#include "../utils/je_macros.h"
diff --git a/src/libjin/Common/je_temporary.h b/src/libjin/Common/je_temporary.h
index 5af8704..647bfba 100644
--- a/src/libjin/Common/je_temporary.h
+++ b/src/libjin/Common/je_temporary.h
@@ -1,5 +1,5 @@
-#ifndef __JE_ON_STACK_H
-#define __JE_ON_STACK_H
+#ifndef __JE_TEMPORARY_H__
+#define __JE_TEMPORARY_H__
namespace JinEngine
{
diff --git a/src/libjin/Common/je_types.h b/src/libjin/Common/je_types.h
index 446c413..448d7ac 100644
--- a/src/libjin/Common/je_types.h
+++ b/src/libjin/Common/je_types.h
@@ -1,5 +1,5 @@
-#ifndef __JE_TYPES_H
-#define __JE_TYPES_H
+#ifndef __JE_TYPES_H__
+#define __JE_TYPES_H__
#include <stdint.h>
namespace JinEngine
diff --git a/src/libjin/Common/je_utf8.h b/src/libjin/Common/je_utf8.h
index a11850c..d840b75 100644
--- a/src/libjin/Common/je_utf8.h
+++ b/src/libjin/Common/je_utf8.h
@@ -1,5 +1,5 @@
-#ifndef __JE_COMMON_UTF8_H
-#define __JE_COMMON_UTF8_H
+#ifndef __JE_COMMON_UTF8_H__
+#define __JE_COMMON_UTF8_H__
#include "../core/je_configuration.h"
#if jin_os == jin_os_windows
@@ -31,4 +31,4 @@ namespace JinEngine
#endif // jin_os == jin_os_windows
-#endif // __JE_COMMON_UTF8_H \ No newline at end of file
+#endif // __JE_COMMON_UTF8_H__
diff --git a/src/libjin/Filesystem/je_asset_database.cpp b/src/libjin/Filesystem/je_asset_database.cpp
index ac547f0..a8524c5 100644
--- a/src/libjin/Filesystem/je_asset_database.cpp
+++ b/src/libjin/Filesystem/je_asset_database.cpp
@@ -5,6 +5,8 @@
#include <stdlib.h>
#include <stdio.h> /* defines FILENAME_MAX */
+#include "../common/je_exception.h"
+
#include "je_asset_database.h"
namespace JinEngine
@@ -34,14 +36,13 @@ namespace JinEngine
}
}
- bool AssetDatabase::read(const char* path, Buffer& buffer)
+ void AssetDatabase::read(const char* path, Buffer& buffer)
{
size_t size;
byte* data = (byte*)smtread(mSmt, path, &size);
- if (data == nullptr)
- return false;
+ if (data == nullptr)
+ throw Exception("Could not read file %s.", path);
buffer.bind(data, size);
- return true;
}
Buffer* read(const char* path)
@@ -73,12 +74,11 @@ namespace JinEngine
{
return smtexists(mSmt, path) == 0;
}
-
+/*
std::vector<std::string> AssetDatabase::getFiles(const char* path, bool recursive)
{
-
}
-
+*/
} // namespace Filesystem
} // namespace JinEngine
diff --git a/src/libjin/Filesystem/je_asset_database.h b/src/libjin/Filesystem/je_asset_database.h
index 8c30fc1..e8b1bd1 100644
--- a/src/libjin/Filesystem/je_asset_database.h
+++ b/src/libjin/Filesystem/je_asset_database.h
@@ -1,12 +1,12 @@
-#ifndef __JE_ASSET_DATABASE_H
-#define __JE_ASSET_DATABASE_H
+#ifndef __JE_ASSET_DATABASE_H__
+#define __JE_ASSET_DATABASE_H__
#include "../core/je_configuration.h"
#if defined(jin_filesystem)
#include <vector>
-#include "../3rdparty/smount/smount.h"
+#include "smount/smount.h"
#include "je_buffer.h"
@@ -70,7 +70,7 @@ namespace JinEngine
/// @param buffer Buffer to fill.
/// @return True if read sucessful, otherwise return false.
///
- bool read(const char* path, Buffer& buffer);
+ void read(const char* path, Buffer& buffer);
///
/// Read file and return data content.
@@ -88,7 +88,7 @@ namespace JinEngine
/// @param recursive Recursivily search folder.
/// @return File list under given directory.
///
- std::vector<std::string> getFiles(const char* path, bool recursive);
+ std::vector<std::string> getFiles(const char* directory, bool recursive = false);
///
/// Get full path of asset.
diff --git a/src/libjin/Filesystem/je_buffer.h b/src/libjin/Filesystem/je_buffer.h
index 0726e1d..1111e49 100644
--- a/src/libjin/Filesystem/je_buffer.h
+++ b/src/libjin/Filesystem/je_buffer.h
@@ -1,5 +1,5 @@
-#ifndef __JE_BUFFER_H
-#define __JE_BUFFER_H
+#ifndef __JE_BUFFER_H__
+#define __JE_BUFFER_H__
#include "../core/je_configuration.h"
#if defined(jin_filesystem)
diff --git a/src/libjin/Game/je_application.cpp b/src/libjin/Game/je_application.cpp
new file mode 100644
index 0000000..a5a8812
--- /dev/null
+++ b/src/libjin/Game/je_application.cpp
@@ -0,0 +1,79 @@
+#include "../core/je_configuration.h"
+#if defined(jin_game)
+
+#include <iostream>
+
+#include "../time/je_timer.h"
+#include "../input/je_event.h"
+#include "../graphics/je_window.h"
+#include "../math/je_math.h"
+
+#include "je_application.h"
+
+namespace JinEngine
+{
+ namespace Game
+ {
+
+ using namespace JinEngine::Graphics;
+ using namespace JinEngine::Input;
+ using namespace JinEngine::Time;
+ using namespace JinEngine::Math;
+
+ Application::Application() :_running(true) {};
+
+ /* default game loop */
+ void Application::run()
+ {
+ if (_onLoad != nullptr)
+ _onLoad();
+ Window* wnd = Window::get();
+ const int FPS = wnd ? wnd->getFPS() : 60;
+ const int MS_PER_UPDATE = 1000.0f / FPS;
+ _running = true;
+ Event e;
+ int current = getMilliSecond();
+ int previous = current;
+ int dt = 0;
+ while (_running)
+ {
+ while (JinEngine::Input::pollEvent(&e))
+ {
+ if (_onEvent != nullptr)
+ _onEvent(&e);
+ if (!_running)
+ goto quitloop;
+ }
+ previous = current;
+ current = getMilliSecond();
+ dt = current - previous;
+ if (_onUpdate != nullptr)
+ _onUpdate(dt);
+ if (_onDraw != nullptr)
+ _onDraw();
+ wnd->swapBuffers();
+ sleep(1);
+ }
+ quitloop:;
+ }
+
+ bool Application::initSystem(const SettingBase* setting)
+ {
+ if (setting == nullptr)
+ return false;
+ Application::Setting* s = (Application::Setting*) setting;
+ _onEvent = s->eventHandler;
+ _onUpdate = s->updater;
+ _onDraw = s->drawer;
+ _onLoad = s->loader;
+ return true;
+ }
+
+ void Application::quitSystem()
+ {
+ }
+
+ } // namespace Core
+} // namespace JinEngine
+
+#endif // jin_game \ No newline at end of file
diff --git a/src/libjin/Game/je_application.h b/src/libjin/Game/je_application.h
new file mode 100644
index 0000000..094de6a
--- /dev/null
+++ b/src/libjin/Game/je_application.h
@@ -0,0 +1,88 @@
+#ifndef __JE_CORE_GAME_H__
+#define __JE_CORE_GAME_H__
+
+#include "../core/je_configuration.h"
+#if defined(jin_game)
+
+#include "../common/je_subsystem.hpp"
+#include "../utils/je_macros.h"
+#include "../input/je_Event.h"
+
+#include "SDL2/SDL.h"
+
+namespace JinEngine
+{
+ namespace Game
+ {
+
+ ///
+ /// Game class.
+ ///
+ class Application : public Subsystem<Application>
+ {
+ public:
+
+ typedef void(*onLoad)();
+ typedef void(*onEvent)(JinEngine::Input::Event* e);
+ typedef void(*onUpdate)(int dt);
+ typedef void(*onDraw)();
+
+ ///
+ /// Game setting.
+ ///
+ struct Setting : SettingBase
+ {
+ onEvent eventHandler;
+ onUpdate updater;
+ onDraw drawer;
+ onLoad loader;
+ };
+
+ ///
+ /// Main game loop.
+ ///
+ void run();
+
+ ///
+ /// Stop game.
+ ///
+ inline void stop()
+ {
+ _running = false;
+ };
+
+ ///
+ /// Return if game is running.
+ ///
+ /// @return True if game is running, otherwise return false.
+ ///
+ inline bool running()
+ {
+ return _running;
+ };
+
+ private:
+
+ Application();
+ ~Application() {};
+
+ singleton(Application);
+
+ onEvent _onEvent;
+ onUpdate _onUpdate;
+ onDraw _onDraw;
+ onLoad _onLoad;
+
+ bool _running;
+
+ bool initSystem(const SettingBase* setting);
+ void quitSystem();
+
+ };
+
+ } // namespace Core
+} // namespace JinEngine
+
+#endif // jin_game
+
+#endif // __JE_CORE_GAME_H__ \ No newline at end of file
diff --git a/src/libjin/Game/je_entity.cpp b/src/libjin/Game/je_entity.cpp
index 1396518..e69de29 100644
--- a/src/libjin/Game/je_entity.cpp
+++ b/src/libjin/Game/je_entity.cpp
@@ -1,11 +0,0 @@
-#include "je_entity.h"
-
-namespace JinEngine
-{
- namespace Game
- {
-
-
-
- } // namespace Game
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Game/je_entity.h b/src/libjin/Game/je_entity.h
index 4a252da..39822b6 100644
--- a/src/libjin/Game/je_entity.h
+++ b/src/libjin/Game/je_entity.h
@@ -1,15 +1,7 @@
-#ifndef __JE_GAME_OBJECT_H
-#define __JE_GAME_OBJECT_H
+#ifndef __JE_ENTITY_H__
+#define __JE_ENTITY_H__
-#include "../core/je_configuration.h"
-#if defined(jin_game)
-
-#include <list>
-#include <map>
-#include <set>
-
-#include "../common/je_object.h"
-#include "../common/je_types.h"
+#include "je_gameobject.h"
namespace JinEngine
{
@@ -17,59 +9,19 @@ namespace JinEngine
{
///
- /// Game object base class.
+ ///
///
- class Entity : public Object
+ class Entity : public GameObject
{
public:
+ Entity();
- ///
- ///
- ///
- virtual ~Entity();
-
- ///
- ///
- ///
- void lifecycle();
-
- ///
- ///
- ///
- void setVisible(bool isVisible);
+ private:
- ///
- ///
- ///
- void setActive(bool isActive);
-
- protected:
- virtual void onAlive();
- virtual void onUpdate(float dt);
- virtual void onDraw();
- virtual void onDie();
-
- uint32 layer; // layer where entity belongs
- uint32 index; // render index in layer
- uint64 tag; // tag of entity, 64 now
- bool mIsVisible; // if the entity is visible or not
- bool mIsActive; // if the entity is joined into the logic
};
- ///
- /// Entity list. For quickly adding and removing entities.
- ///
- typedef std::list<Entity*> EntityList;
-
- ///
- /// Entity set. For searching and keeps entities unique and sorted.
- ///
- typedef std::set<Entity*> EntitySet;
-
} // namespace Game
-} // namespace JinEngine
-
-#endif // jin_game
+} // namespace JinEngine
#endif \ No newline at end of file
diff --git a/src/libjin/Game/je_game.cpp b/src/libjin/Game/je_game.cpp
deleted file mode 100644
index 6eb1d3f..0000000
--- a/src/libjin/Game/je_game.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "../core/je_configuration.h"
-#if defined(jin_game)
-
-#include <iostream>
-
-#include "../time/je_timer.h"
-#include "../input/je_event.h"
-#include "../graphics/je_window.h"
-#include "../math/je_math.h"
-
-#include "je_game.h"
-
-namespace JinEngine
-{
- namespace Core
- {
-
- using namespace JinEngine::Graphics;
- using namespace JinEngine::Input;
- using namespace JinEngine::Time;
- using namespace JinEngine::Math;
-
- Game::Game() :_running(true) {};
-
- /* default game loop */
- void Game::run()
- {
- if (_onLoad != nullptr)
- _onLoad();
- Window* wnd = Window::get();
- const int FPS = wnd ? wnd->getFPS() : 60;
- const int MS_PER_UPDATE = 1000.0f / FPS;
- _running = true;
- Event e;
- int current = getMilliSecond();
- int previous = current;
- int dt = 0;
- while (_running)
- {
- while (JinEngine::Input::pollEvent(&e))
- {
- if (_onEvent != nullptr)
- _onEvent(&e);
- if (!_running)
- goto quitloop;
- }
- previous = current;
- current = getMilliSecond();
- dt = current - previous;
- if (_onUpdate != nullptr)
- _onUpdate(dt);
- if (_onDraw != nullptr)
- _onDraw();
- wnd->swapBuffers();
- sleep(1);
- }
- quitloop:;
- }
-
- bool Game::initSystem(const SettingBase* setting)
- {
- if (setting == nullptr)
- return false;
- Game::Setting* s = (Game::Setting*) setting;
- _onEvent = s->eventHandler;
- _onUpdate = s->updater;
- _onDraw = s->drawer;
- _onLoad = s->loader;
- return true;
- }
-
- void Game::quitSystem()
- {
- }
-
- } // namespace Core
-} // namespace JinEngine
-
-#endif // jin_game \ No newline at end of file
diff --git a/src/libjin/Game/je_game.h b/src/libjin/Game/je_game.h
deleted file mode 100644
index 78c3385..0000000
--- a/src/libjin/Game/je_game.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __JE_CORE_GAME_H
-#define __JE_CORE_GAME_H
-
-#include "../core/je_configuration.h"
-#if defined(jin_game)
-
-#include "../common/je_subsystem.hpp"
-#include "../utils/je_macros.h"
-#include "../input/je_Event.h"
-
-#include "SDL2/SDL.h"
-
-namespace JinEngine
-{
- namespace Core
- {
-
- ///
- /// Game class.
- ///
- class Game : public Subsystem<Game>
- {
- public:
-
- typedef void(*onLoad)();
- typedef void(*onEvent)(JinEngine::Input::Event* e);
- typedef void(*onUpdate)(int dt);
- typedef void(*onDraw)();
-
- ///
- /// Game setting.
- ///
- struct Setting : SettingBase
- {
- onEvent eventHandler;
- onUpdate updater;
- onDraw drawer;
- onLoad loader;
- };
-
- ///
- /// Main game loop.
- ///
- void run();
-
- ///
- /// Stop game.
- ///
- inline void stop()
- {
- _running = false;
- };
-
- ///
- /// Return if game is running.
- ///
- /// @return True if game is running, otherwise return false.
- ///
- inline bool running()
- {
- return _running;
- };
-
- private:
-
- Game();
- ~Game() {};
-
- singleton(Game);
-
- onEvent _onEvent;
- onUpdate _onUpdate;
- onDraw _onDraw;
- onLoad _onLoad;
-
- bool _running;
-
- bool initSystem(const SettingBase* setting);
- void quitSystem();
-
- };
-
- } // namespace Core
-} // namespace JinEngine
-
-#endif // jin_game
-
-#endif // __JE_CORE_GAME_H \ No newline at end of file
diff --git a/src/libjin/Game/je_gameobject.cpp b/src/libjin/Game/je_gameobject.cpp
new file mode 100644
index 0000000..1396518
--- /dev/null
+++ b/src/libjin/Game/je_gameobject.cpp
@@ -0,0 +1,11 @@
+#include "je_entity.h"
+
+namespace JinEngine
+{
+ namespace Game
+ {
+
+
+
+ } // namespace Game
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Game/je_gameobject.h b/src/libjin/Game/je_gameobject.h
new file mode 100644
index 0000000..fefc6df
--- /dev/null
+++ b/src/libjin/Game/je_gameobject.h
@@ -0,0 +1,86 @@
+#ifndef __JE_GAME_OBJECT_H__
+#define __JE_GAME_OBJECT_H__
+
+#include "../core/je_configuration.h"
+#if defined(jin_game)
+
+#include <list>
+#include <map>
+#include <set>
+
+#include "../common/je_object.h"
+#include "../common/je_types.h"
+#include "../graphics/je_sprite.h"
+
+namespace JinEngine
+{
+ namespace Game
+ {
+
+ ///
+ /// Game object base class.
+ ///
+ class GameObject : public Object
+ {
+ public:
+
+ ///
+ ///
+ ///
+ virtual ~GameObject();
+
+ ///
+ ///
+ ///
+ void lifecycle();
+
+ ///
+ ///
+ ///
+ void setVisible(bool isVisible);
+
+ ///
+ ///
+ ///
+ void setActive(bool isActive);
+
+ ///
+ ///
+ ///
+ void setOrder(uint32 order);
+
+ protected:
+ virtual void onAlive();
+ virtual void onUpdate(float dt);
+ virtual void onDraw();
+ virtual void onDestroy();
+
+ uint32 mLayer; // layer where entity belongs
+ uint32 mOrder; // render index in layer
+ uint32 mTag; // tag of entity, support 32 tags now
+ bool mIsVisible; // if the entity is visible or not
+ bool mIsActive; // if the entity is joined into the logic
+
+ ///
+ /// Position of entity.
+ ///
+ Math::Vector2<float> mPosition;
+
+ };
+
+ ///
+ /// Entity list. For quickly adding and removing entities.
+ ///
+ typedef std::list<GameObject*> EntityList;
+
+ ///
+ /// Entity set. For searching and keeps entities unique and sorted.
+ ///
+ typedef std::set<GameObject*> EntitySet;
+
+ } // namespace Game
+} // namespace JinEngine
+
+#endif // jin_game
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Game/je_scene.h b/src/libjin/Game/je_scene.h
index f510a1f..811d1a8 100644
--- a/src/libjin/Game/je_scene.h
+++ b/src/libjin/Game/je_scene.h
@@ -1,5 +1,5 @@
-#ifndef __JE_GAME_SCENE_H
-#define __JE_GAME_SCENE_H
+#ifndef __JE_GAME_SCENE_H__
+#define __JE_GAME_SCENE_H__
#include "../core/je_configuration.h"
#if defined(jin_game)
@@ -28,7 +28,7 @@ namespace JinEngine
///
///
///
- EntityList& getEntitiesByTag(uint64 tag);
+ EntityList& getEntitiesByTag(uint32 tag);
///
///
@@ -38,7 +38,7 @@ namespace JinEngine
///
///
///
- void setEntitiesActiveByTag(uint64 tag);
+ void setEntitiesActiveByTag(uint32 tag);
///
///
@@ -53,7 +53,7 @@ namespace JinEngine
///
///
///
- void removeEntitiesByTag(uint64 tag);
+ void removeEntitiesByTag(uint32 tag);
protected:
// all entities
@@ -61,7 +61,7 @@ namespace JinEngine
// all entities grouped by layer, render order
std::map<uint32, EntityList> layers;
// all entities grouped by tag
- std::map<uint64, EntityList> tags;
+ std::map<uint32, EntityList> tags;
};
diff --git a/src/libjin/Graphics/Font/je_decoder.cpp b/src/libjin/Graphics/Font/je_decoder.cpp
deleted file mode 100644
index 01e1990..0000000
--- a/src/libjin/Graphics/Font/je_decoder.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include "je_decoder.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- /* utf8 byte string to unicode codepoint */
- static const char *utf8toCodepoint(const char *p, unsigned *res) {
- return nullptr;
-
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // decoders
- /////////////////////////////////////////////////////////////////////////////
-
- const void* Utf8::decode(const void* data, Codepoint* res) const
- {
- const char* p = (char*)data;
- unsigned x, mask, shift;
- switch (*p & 0xf0) {
- case 0xf0: mask = 0x07; shift = 18; break;
- case 0xe0: mask = 0x0f; shift = 12; break;
- case 0xc0:
- case 0xd0: mask = 0x1f; shift = 6; break;
- default:
- *res = *p;
- return p + 1;
- }
- x = (*p & mask) << shift;
- do {
- if (*(++p) == '\0') {
- *res = x;
- return p;
- }
- shift -= 6;
- x |= (*p & 0x3f) << shift;
- } while (shift);
- *res = x;
- return p + 1;
- }
-
- const void* Utf8::next(const void* data) const
- {
- const char* p = (char*)data;
- unsigned x, mask, shift;
- switch (*p & 0xf0) {
- case 0xf0: mask = 0x07; shift = 18; break;
- case 0xe0: mask = 0x0f; shift = 12; break;
- case 0xc0:
- case 0xd0: mask = 0x1f; shift = 6; break;
- default:
- return p + 1;
- }
- x = (*p & mask) << shift;
- do {
- if (*(++p) == '\0') {
- return p;
- }
- shift -= 6;
- x |= (*p & 0x3f) << shift;
- } while (shift);
- return p + 1;
- }
- /*
- const void* Utf16::decode(const void* data, Codepoint* res) const
- {
- return nullptr;
- }
-
- const void* Utf16::next(const void* data) const
- {
- return nullptr;
- }
- */
- const void* Ascii::decode(const void* data, Codepoint* res) const
- {
- const char* p = (char*)data;
- *res = *p;
- return p + 1;
- }
-
- const void* Ascii::next(const void* data) const
- {
- const char* p = (char*)data;
- return p + 1;
- }
-
- } // namespace Graphics
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_decoder.h b/src/libjin/Graphics/Font/je_decoder.h
deleted file mode 100644
index 36cbda7..0000000
--- a/src/libjin/Graphics/Font/je_decoder.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef __JE_UTF8_H
-#define __JE_UTF8_H
-
-#include <vector>
-
-#include "je_text.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- /// Text decoder.
- ///
- class Decoder
- {
- public:
-
- ///
- /// Decode a code unit.
- ///
- /// @param data Code units.
- /// @param codepoint Value of code point.
- /// @return Next code unit location.
- ///
- virtual const void* decode(const void* data, Codepoint* codepoint) const = 0 ;
-
- ///
- /// Get next code unit location.
- ///
- /// @param data Code units.
- /// @return Next code unit location.
- ///
- virtual const void* next(const void* data) const = 0;
-
- };
-
- ///
- /// Utf-8 decoder.
- ///
- class Utf8 : public Decoder
- {
- public:
-
- ///
- /// Decode a code unit.
- ///
- /// @param data Code units.
- /// @param codepoint Value of code point.
- /// @return Next code unit location.
- ///
- const void* decode(const void* data, Codepoint* codepoint) const override;
-
- ///
- /// Get next code unit location.
- ///
- /// @param data Code units.
- /// @return Next code unit location.
- ///
- const void* next(const void* data) const override;
-
- };
-
- ///
- /// Ascii decoder.
- ///
- class Ascii : public Decoder
- {
- public:
-
- ///
- /// Decode a code unit.
- ///
- /// @param data Code units.
- /// @param codepoint Value of code point.
- /// @return Next code unit location.
- ///
- const void* decode(const void* data, Codepoint* codepoint) const override;
-
- ///
- /// Get next code unit location.
- ///
- /// @param data Code units.
- /// @return Next code unit location.
- ///
- const void* next(const void* data) const override;
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_font.h b/src/libjin/Graphics/Font/je_font.h
deleted file mode 100644
index 4529902..0000000
--- a/src/libjin/Graphics/Font/je_font.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef __JE_FONT_H
-#define __JE_FONT_H
-
-#include <vector>
-#include "je_text.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- struct Page;
-
- ///
- /// Base Font class.
- ///
- class Font
- {
- public:
- ///
- /// Font constructor.
- ///
- Font(unsigned fontsize)
- : mFontSize(fontsize)
- {
- }
-
- ///
- /// Font destructor.
- ///
- virtual ~Font() {};
-
- ///
- /// Create page with given text.
- ///
- /// @param text Text to be typesetted.
- /// @param lineheight Line height of text.
- /// @param spacing Spacing between characters. 0 by default.
- /// @return Page if created successfully, otherwise return null.
- ///
- virtual Page* typeset(const Text& text, int lineheight, int spacing = 0) = 0;
-
- ///
- /// Create page with given unicode codepoints.
- ///
- /// @param content Unicode codepoints to be typesetted.
- /// @param lineheight Line height of text.
- /// @param spacing Spacing between characters. 0 by default.
- /// @return Page if created successfully, otherwise return null.
- ///
- virtual Page* typeset(const Content& content, int lineheight, int spacing = 0) = 0;
-
- ///
- /// Render page to given position.
- ///
- /// @param page Page to be rendered.
- /// @param x X value of the position.
- /// @param y Y value of the position.
- ///
- virtual void print(const Page* page, int x, int y) = 0;
-
- ///
- /// Render unicode codepoints to given position.
- ///
- /// @param content Unicode codepoints to be typesetted.
- /// @param x X value of the position.
- /// @param y Y value of the position.
- /// @param lineheight Line height of the content.
- /// @param spacing Spacing between characters.
- ///
- virtual void print(const Content& content, int x, int y, int lineheight, int spacing = 0) = 0;
-
- ///
- /// Render text to given position.
- ///
- /// @param text Text to be rendered.
- /// @param x X value of the position.
- /// @param y Y value of the position.
- /// @param lineheight Line height of the text.
- /// @param spacing Spacing between characters.
- ///
- virtual void print(const Text& text, int x, int y, int lineheight, int spacing = 0) = 0;
-
- ///
- /// Get font size.
- ///
- /// @return Font size.
- ///
- inline unsigned getFontSize() { return mFontSize; };
-
- protected:
-
- unsigned mFontSize;
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // __JE_FONT_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_page.h b/src/libjin/Graphics/Font/je_page.h
deleted file mode 100644
index fbc297e..0000000
--- a/src/libjin/Graphics/Font/je_page.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef __JE_PAGE_H
-#define __JE_PAGE_H
-
-#include "../../math/je_vector2.hpp"
-
-#include "je_font.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- class Font;
-
- ///
- /// Glyphs data to be rendered.
- ///
- struct GlyphVertex
- {
- int x, y; ///< screen coordinates
- float u, v; ///< normalized texture uv
- };
-
- ///
- /// Glyphs info for reducing draw call.
- ///
- struct GlyphArrayDrawInfo
- {
- GLuint texture; ///< atlas
- unsigned int start; ///< glyph vertex indecies
- unsigned int count; ///< glyph vertex count
- };
-
- ///
- /// Page to be rendered.
- ///
- /// A page is a pre-rendered text struct for reducing draw call. Each page
- /// keeps a font pointer which should not be changed.
- ///
- struct Page
- {
- Font* font;
- std::vector<GlyphArrayDrawInfo> glyphinfolist;
- std::vector<GlyphVertex> glyphvertices;
- Math::Vector2<int> size;
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // __JE_PAGE_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_text.cpp b/src/libjin/Graphics/Font/je_text.cpp
deleted file mode 100644
index 75dfc7b..0000000
--- a/src/libjin/Graphics/Font/je_text.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-#include <cstring>
-
-#include "je_text.h"
-#include "je_decoder.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- /////////////////////////////////////////////////////////////////////////////
- // iterator
- /////////////////////////////////////////////////////////////////////////////
-
- Text::Iterator::Iterator(const Iterator& itor)
- : data(itor.data)
- , p(itor.p)
- , encode(itor.encode)
- , length(itor.length)
- {
- switch (encode)
- {
- case Encode::UTF8: decoder = new Utf8(); break;
- case Encode::ASCII: decoder = new Ascii(); break;
- }
- }
-
- Text::Iterator::Iterator(const Encode& _encode, const void* _data, unsigned int _length)
- : data(_data)
- , p(_data)
- , encode(_encode)
- , length(_length)
- {
- switch (encode)
- {
- case Encode::UTF8: decoder = new Utf8(); break;
- case Encode::ASCII: decoder = new Ascii(); break;
- }
- }
-
- Text::Iterator::~Iterator()
- {
- delete decoder;
- }
-
- Codepoint Text::Iterator::get()
- {
- Codepoint codepoint;
- decoder->decode(p, &codepoint);
- return codepoint;
- }
-
- Codepoint Text::Iterator::operator*()
- {
- return get();
- }
- /*
- Text::Iterator Text::Iterator::begin()
- {
- Iterator itor(encode, data, length);
- itor.toBegin();
- return itor;
- }
-
- Text::Iterator Text::Iterator::end()
- {
- Iterator itor(encode, data, length);
- itor.toEnd();
- return itor;
- }
- */
- void Text::Iterator::toBegin()
- {
- p = (const unsigned char*)data;
- }
-
- void Text::Iterator::toEnd()
- {
- p = (const unsigned char*)data + length;
- }
-
- Text::Iterator& Text::Iterator::operator ++()
- {
- p = decoder->next(p);
- return *this;
- }
-
- Text::Iterator Text::Iterator::operator ++(int)
- {
- p = decoder->next(p);
- Iterator itor(encode, data, length);
- itor.p = p;
- return itor;
- }
-
- bool Text::Iterator::operator !=(const Iterator& itor)
- {
- return !(data == itor.data
- && p == itor.p
- && length == itor.length
- && encode == itor.encode);
- }
-
- bool Text::Iterator::operator ==(const Iterator& itor)
- {
- return data == itor.data
- && p == itor.p
- && length == itor.length
- && encode == itor.encode;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // text
- /////////////////////////////////////////////////////////////////////////////
-
- Text::Text(Encode encode, const void* data)
- {
- unsigned length = strlen((const char*)data);
- Iterator end = Iterator(encode, data, length);
- end.toEnd();
- Iterator it = Iterator(encode, data, length);
- for (; it != end; ++it)
- {
- content.push_back(*it);
- }
- }
-
- Text::Text(Encode encode, const void* data, unsigned length)
- {
- Iterator end = Iterator(encode, data, length);
- end.toEnd();
- Iterator it = Iterator(encode, data, length);
- for (; it != end; ++it)
- {
- content.push_back(*it);
- }
- }
-
- Text::~Text()
- {
- }
-
- const Content& Text::getContent() const
- {
- return content;
- }
-
- const Content& Text::operator*() const
- {
- return content;
- }
-
- } // namespace Graphics
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_text.h b/src/libjin/Graphics/Font/je_text.h
deleted file mode 100644
index 7436875..0000000
--- a/src/libjin/Graphics/Font/je_text.h
+++ /dev/null
@@ -1,169 +0,0 @@
-#ifndef __JE_TEXT_H
-#define __JE_TEXT_H
-
-#include <vector>
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- typedef unsigned int Codepoint;
-
- typedef std::vector<Codepoint> Content;
-
- class Text;
-
- class Decoder;
-
- ///
- /// Supported text encoding.
- ///
- enum Encode
- {
- UTF8, ///< utf-8
- ASCII, ///< ASCII
- };
-
- ///
- /// Decoded text. Saved as unicode codepoints.
- ///
- class Text
- {
- public:
- ///
- ///
- ///
- Text(Encode encode, const void* data);
-
- ///
- ///
- ///
- Text(Encode encode, const void* data, unsigned int length);
-
- ///
- ///
- ///
- ~Text();
-
- ///
- ///
- ///
- const Content& getContent() const;
-
- ///
- ///
- ///
- const Content& operator*() const;
-
- private:
- ///
- ///
- ///
- class Iterator
- {
- public:
-
- ///
- ///
- ///
- Iterator(const Iterator& itor);
-
- ///
- ///
- ///
- Iterator(const Encode& encode, const void* data, unsigned int length);
-
- ///
- ///
- ///
- ~Iterator();
-
- ///
- ///
- ///
- Codepoint get();
-
- //Iterator begin();
- //Iterator end();
-
- ///
- ///
- ///
- void toBegin();
-
- ///
- ///
- ///
- void toEnd();
-
- ///
- ///
- ///
- Codepoint operator *();
-
- ///
- ///
- ///
- Iterator& operator ++();
-
- ///
- ///
- ///
- Iterator operator ++(int);
-
- ///
- ///
- ///
- bool operator !=(const Iterator& itor);
-
- ///
- ///
- ///
- bool operator ==(const Iterator& itor);
-
- private:
-
- ///
- ///
- ///
- void operator = (const Iterator&);
-
- ///
- ///
- ///
- const Encode encode;
-
- ///
- ///
- ///
- const Decoder* decoder;
-
- ///
- ///
- ///
- const void* p;
-
- ///
- ///
- ///
- const void* const data;
-
- ///
- ///
- ///
- unsigned int length;
-
- };
-
- ///
- ///
- ///
- Content content;
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_texture_font.cpp b/src/libjin/Graphics/Font/je_texture_font.cpp
deleted file mode 100644
index 9651c1a..0000000
--- a/src/libjin/Graphics/Font/je_texture_font.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-#include <vector>
-
-#include "../../math/je_vector2.hpp"
-
-#include "../shader/je_shader.h"
-
-#include "je_texture_font.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- using namespace std;
- using namespace Math;
-
- TextureFont * TextureFont::createTextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh)
- {
- TextureFont* tf = new TextureFont(bitmap, codepoints, cellw, cellh);
- return tf;
- }
-
- TextureFont * TextureFont::createTextureFont(const Bitmap* bitmap, const Text& codepoints, int cellw, int cellh)
- {
- TextureFont* tf = new TextureFont(bitmap, *codepoints, cellw, cellh);
- return tf;
- }
-
- TextureFont* TextureFont::createTextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh)
- {
- TextureFont* tf = new TextureFont(bitmap, codepoints, mask, cellh);
- return tf;
- }
-
- TextureFont* TextureFont::createTextureFont(const Bitmap* bitmap, const Text& codepoints, Color mask, int cellh)
- {
- TextureFont* tf = new TextureFont(bitmap, *codepoints, mask, cellh);
- return tf;
- }
-
- TextureFont::~TextureFont()
- {
- }
-
- const TextureFont::TextureGlyph* TextureFont::findGlyph(Codepoint codepoint) const
- {
- auto it = glyphs.find(codepoint);
- if (it != glyphs.end())
- {
- return &it->second;
- }
- else
- return nullptr;
- }
-
- Page* TextureFont::typeset(const Content& text, int lineheight, int spacing)
- {
- Page* page = new Page();
- page->font = this;
- vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
- vector<GlyphVertex>& glyphvertices = page->glyphvertices;
- int texture = -1;
- const TextureGlyph* glyph = nullptr;
- GlyphVertex vertex;
- Vector2<int> p(0, 0);
- int i = 0;
-
- #define glyphvertices_push(_x, _y, _u, _v) \
- vertex.x = _x; vertex.y = _y;\
- vertex.u = _u; vertex.v = _v;\
- glyphvertices.push_back(vertex);\
-
- for (Codepoint c : text)
- {
- // return
- if (c == 0x0D) continue;
- // newline
- if (c == 0x0A)
- {
- p.y += lineheight;
- p.x = 0;
- continue;
- }
- if (c == 0x09)
- {
- // tab = 4*space
- unsigned cw = getCharWidth(0x20);
- p.x += cw * 4;
- continue;
- }
- glyph = findGlyph(c);
- if (glyph == nullptr) continue;
- if (texture != mTexture)
- {
- texture = mTexture;
- GlyphArrayDrawInfo info;
- info.start = i;
- info.count = 0;
- info.texture = texture;
- glyphinfolist.push_back(info);
- }
- glyphinfolist[glyphinfolist.size() - 1].count += 4;
- // normalized
- float w = getWidth(), h = getHeight();
- float nx = glyph->x / w, ny = glyph->y / h;
- float nw = glyph->w / w, nh = glyph->h / h;
- glyphvertices_push(p.x, p.y, nx, ny);
- glyphvertices_push(p.x, p.y + glyph->h, nx, ny + nh);
- glyphvertices_push(p.x + glyph->w, p.y + glyph->h, nx + nw, ny + nh);
- glyphvertices_push(p.x + glyph->w, p.y, nx + nw, ny);
- p.x += glyph->w + spacing;
- i += 4;
- }
- getTextBox(text, &page->size.w, &page->size.h, lineheight, spacing);
- return page;
- }
-
- int TextureFont::getCharWidth(int c)
- {
- auto it = glyphs.find(c);
- if (it != glyphs.end())
- {
- return it->second.w;
- }
- return 0;
- }
-
- int TextureFont::getCharHeight(int c)
- {
- auto it = glyphs.find(c);
- if (it != glyphs.end())
- {
- return it->second.h;
- }
- return 0;
- }
-
- int TextureFont::getTextWidth(const Content& t, int spacing)
- {
- int res = 0;
- int tmp = 0;
- for (Codepoint c : t)
- {
- if (c == 0x0D)
- continue;
- if (c == 0x0A)
- {
- tmp = 0;
- continue;
- }
- if (c == 0x09)
- {
- // tab = 4*space
- unsigned cw = getCharWidth(0x20);
- tmp += cw * 4;
- if (tmp > res) res = tmp;
- continue;
- }
- tmp += getCharWidth(c) + spacing;
- if (tmp > res) res = tmp;
- }
- return res;
- }
-
- int TextureFont::getTextHeight(const Content& t, int lineheight)
- {
- int res = 0;
- bool newline = true;
- for (Codepoint c : t)
- {
- if (c == 0x0A)
- newline = true;
- else if (c == 0x0D);
- else if (newline)
- {
- newline = false;
- res += lineheight;
- }
- }
- return res;
- }
-
- void TextureFont::getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing)
- {
- *w = 0;
- *h = 0;
- int tmp = 0;
- bool newline = true;
- for (Codepoint c : text)
- {
- if (c == 0x0D)
- continue;
- if (c == 0x0A)
- {
- tmp = 0;
- newline = true;
- continue;
- }
- else if (newline)
- {
- newline = false;
- *h += lineheight;
- }
- tmp += getCharWidth(c) + spacing;
- if (tmp > *w)
- *w = tmp;
- }
- }
-
- Page* TextureFont::typeset(const Text& text, int lineheight, int spacing)
- {
- return typeset(*text, lineheight, spacing);
- }
-
- void TextureFont::print(const Page* page, int x, int y)
- {
- Shader* shader = Shader::getCurrentShader();
- const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
- const vector<GlyphVertex>& glyphvertices = page->glyphvertices;
- gl.ModelMatrix.setTransformation(x, y, 0, 1, 1, 0, 0);
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
- shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
- for (int i = 0; i < glyphinfolist.size(); ++i)
- {
- const GlyphArrayDrawInfo& info = glyphinfolist[i];
- shader->bindVertexPointer(2, GL_INT, sizeof(GlyphVertex), &glyphvertices[info.start].x);
- shader->bindUVPointer(2, GL_FLOAT, sizeof(GlyphVertex), &glyphvertices[info.start].u);
- gl.bindTexture(info.texture);
- gl.drawArrays(GL_QUADS, 0, info.count);
- gl.bindTexture(0);
- }
- }
-
- void TextureFont::print(const Content& text, int x, int y, int lineheight, int spacing)
- {
- Page* page = typeset(text, lineheight, spacing);
- print(page, x, y);
- delete page;
- }
-
- void TextureFont::print(const Text& text, int x, int y, int lineheight, int spacing)
- {
- Page* page = typeset(text, lineheight, spacing);
- print(page, x, y);
- delete page;
- }
-
- TextureFont::TextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh)
- : Graphic(bitmap)
- , Font(cellh)
- {
- TextureGlyph glyph;
- Vector2<int> count(bitmap->getWidth() / cellw, bitmap->getHeight() / cellh);
- glyph.w = cellw;
- glyph.h = cellh;
- for (int y = 0; y < count.row; ++y)
- {
- glyph.y = y * cellh;
- for (int x = 0; x < count.colum; ++x)
- {
- glyph.x = x * cellw;
- if (x + y * count.colum >= codepoints.size())
- return;
- glyphs.insert(std::pair<Codepoint, TextureGlyph>(codepoints[x + y * count.colum], glyph));
- }
- }
- }
-
- TextureFont::TextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh)
- : Graphic(bitmap)
- , Font(cellh)
- {
- TextureGlyph glyph;
- glyph.h = cellh;
- int w = bitmap->getWidth();
- int h = bitmap->getHeight();
- int i = 0;
- for (int y = 0; y < h; y += cellh)
- {
- glyph.y = y;
- bool newc = false;
- for (int x = 0; x <= w; ++x)
- {
- if (x == w && newc)
- {
- glyph.w = x - glyph.x;
- if (i >= codepoints.size())
- return;
- glyphs.insert(std::pair<Codepoint, TextureGlyph>(codepoints[i], glyph));
- ++i;
- newc = false;
- break;
- }
- Color c = bitmap->getPixels()[x + y * w];
- if (!newc && c != mask)
- {
- glyph.x = x;
- newc = true;
- }
- else if (newc && c == mask)
- {
- glyph.w = x - glyph.x;
- if (i >= codepoints.size())
- return;
- glyphs.insert(std::pair<Codepoint, TextureGlyph>(codepoints[i], glyph));
- if (codepoints[i] == 't')
- {
- int a = 10;
- }
- ++i;
- newc = false;
- }
- }
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_texture_font.h b/src/libjin/Graphics/Font/je_texture_font.h
deleted file mode 100644
index 6276350..0000000
--- a/src/libjin/Graphics/Font/je_texture_font.h
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifndef __JE_TEXTURE_FONT_H
-#define __JE_TEXTURE_FONT_H
-
-#include <map>
-#include <vector>
-
-#include "../../math/je_vector4.hpp"
-
-#include "../je_graphic.h"
-#include "../je_bitmap.h"
-
-#include "je_page.h"
-#include "je_font.h"
-#include "je_text.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- ///
- ///
- class TextureFont : public Font
- , public Graphic
- {
- public:
-
- ///
- ///
- ///
- static TextureFont* createTextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh);
-
- ///
- ///
- ///
- static TextureFont* createTextureFont(const Bitmap* bitmap, const Text& text, int cellw, int cellh);
-
- ///
- ///
- ///
- static TextureFont* createTextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh);
-
- ///
- ///
- ///
- static TextureFont* createTextureFont(const Bitmap* bitmap, const Text& text, Color mask, int cellh);
-
- ///
- ///
- ///
- ~TextureFont();
-
- ///
- ///
- ///
- Page* typeset(const Text& text, int lineheight, int spacing = 0) override;
-
- ///
- ///
- ///
- Page* typeset(const Content& text, int lineheight, int spacing = 0) override ;
-
- ///
- ///
- ///
- void print(const Page* page, int x, int y) override;
-
- ///
- ///
- ///
- void print(const Content& text, int x, int y, int linehgiht, int spacing = 0) override;
-
- ///
- ///
- ///
- void print(const Text& text, int x, int y, int lineheight, int spacing = 0)override;
-
- private:
-
- ///
- ///
- ///
- struct TextureGlyph
- {
- float x, y, w, h;
- };
-
- ///
- ///
- ///
- TextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh);
-
- ///
- ///
- ///
- TextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh);
-
- ///
- ///
- ///
- int getCharWidth(int c);
-
- ///
- ///
- ///
- int getCharHeight(int c);
-
- ///
- ///
- ///
- int getTextWidth(const Content& text, int spacing = 0);
-
- ///
- ///
- ///
- int getTextHeight(const Content& text, int lineheight);
-
- ///
- ///
- ///
- void getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing = 0);
-
- ///
- ///
- ///
- const TextureGlyph* findGlyph(Codepoint codepoint) const;
-
-
- ///
- ///
- ///
- std::map<Codepoint, TextureGlyph> glyphs;
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_ttf.cpp b/src/libjin/Graphics/Font/je_ttf.cpp
deleted file mode 100644
index a11efb0..0000000
--- a/src/libjin/Graphics/Font/je_ttf.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-#include "../../core/je_configuration.h"
-#if defined(jin_graphics)
-
-#include <stdio.h>
-
-#include "../../common/je_array.hpp"
-
-#include "../je_gl.h"
-#include "../je_color.h"
-#include "../shader/je_shader.h"
-
-#include "je_ttf.h"
-#include "je_page.h"
-
-#define STB_TRUETYPE_IMPLEMENTATION
-#include "../../3rdparty/stb/stb_truetype.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- /////////////////////////////////////////////////////////////////////////////
- // TTFData
- /////////////////////////////////////////////////////////////////////////////
-
- TTFData* TTFData::createTTFData(const unsigned char* data, unsigned int size)
- {
- TTFData* ttf = nullptr;
- try
- {
- ttf = new TTFData(data, size);
- return ttf;
- }
- catch (...)
- {
- return nullptr;
- }
- }
-
- TTFData::TTFData(const unsigned char* d, unsigned int s)
- {
- raw.size = s;
- raw.data = (unsigned char*)malloc(s);
- memcpy(raw.data, d, s);
- if (!stbtt_InitFont(&info, (const unsigned char*)raw.data, 0))
- {
- delete raw.data;
- throw 0;
- }
- /* push default fontsize */
- pushTTFsize(FONT_SIZE);
- }
-
- TTFData::~TTFData()
- {
- free(raw.data);
- }
-
- TTF* TTFData::createTTF(unsigned fontSize)
- {
- TTF* ttf;
- try
- {
- ttf = new TTF(this, fontSize);
- }
- catch (...)
- {
- return nullptr;
- }
- return ttf;
- }
-
- /*
- * (0, 0)
- * +--------------+ ascent
- * | +--------+ |
- * | | | |
- * | | bitmap | |
- * +--|--------|--+ baseline
- * | +--------+ |
- * +--|-----------+ decent
- * | |
- * leftSideBearing |
- * advanceWidth
- */
- void TTFData::getVMetrics(int* baseline, int* descent)
- {
- float scale = scales.back();
- int ascent;
- stbtt_GetFontVMetrics(&info, &ascent, descent, 0);
- *baseline = (int)(ascent*scale) + 1; // slight adjustment
- *descent = *baseline - (int)(*descent*scale) + 1;
- }
-
- void TTFData::getHMetrics(unsigned int codepoint, int* advanceWidth, int* leftSideBearing)
- {
- float scale = scales.back();
- int adw, lsb;
- stbtt_GetCodepointHMetrics(&info, codepoint, &adw, &lsb);
- *advanceWidth = (int)(adw*scale);
- *leftSideBearing = (int)(lsb*scale);
- }
-
- void TTFData::pushTTFsize(unsigned int fs)
- {
- float sc = stbtt_ScaleForPixelHeight(&info, fs);
- scales.push_back(sc);
- }
-
- void TTFData::popTTFsize()
- {
- /* always keep default ttf size on the bottom of stack */
- if (scales.size() > 1)
- scales.pop_back();
- }
-
- Channel* TTFData::getCodepointBitmapAlpha(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const
- {
- float scale = scales.back();
- Channel* bitmap = stbtt_GetCodepointBitmap(&info, scale, scale, codepoint, width, height, xoff, yoff);
- return bitmap;
- }
-
- Color* TTFData::getCodepointBitmap(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const
- {
- float scale = scales.back();
- Channel* bitmap = stbtt_GetCodepointBitmap(&info, scale, scale, codepoint, width, height, xoff, yoff);
- int w = *width, h = *height;
- //int xo = *xoff, yo = *yoff;
- Color* bitmap32 = new Color[w*h];
- for (int y = 0; y < h; ++y)
- {
- for (int x = 0; x < w; ++x)
- {
- bitmap32[x + y * w].set(0xff, 0xff, 0xff, bitmap[x + y * w]);
- }
- }
- free(bitmap);
- return bitmap32;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // TTF
- /////////////////////////////////////////////////////////////////////////////
-
- #include "../shader/je_font.shader.h"
-
- using namespace std;
- using namespace JinEngine::Math;
-
- const int TTF::TEXTURE_WIDTHS[] = { 128, 256, 256, 512, 512, 1024, 1024 };
- const int TTF::TEXTURE_HEIGHTS[] = { 128, 128, 256, 256, 512, 512, 1024 };
-
- /* little endian unicode */
- static const char* unicodeLittleEndian(const char* p, unsigned* res)
- {
- }
-
- ///*static*/ TTF* TTF::createTTF(TTFData* fontData, unsigned int fontSzie)
- //{
- // TTF* ttf;
- // try
- // {
- // ttf = new TTF(fontData, fontSzie);
- // }
- // catch (...)
- // {
- // return nullptr;
- // }
- // return ttf;
- //}
-
- TTF::TTF(TTFData* f, unsigned int fontSize)
- : Font(fontSize)
- , cursor(0, 0)
- , ttf(f)
- {
- ttf->pushTTFsize(fontSize);
- ttf->getVMetrics(&baseline, &descent);
- estimateSize();
- ttf->popTTFsize();
- /* create a default texture */
- createAtlas();
- }
-
- /* estimate the size of atlas texture */
- void TTF::estimateSize()
- {
- for (int level = 0; level <= TEXTURE_SIZE_LEVEL_MAX; ++level)
- {
- if (descent * (descent*0.8) * 96 <= TEXTURE_WIDTHS[level] * TEXTURE_HEIGHTS[level])
- {
- textureWidth = TEXTURE_WIDTHS[level];
- textureHeight = TEXTURE_HEIGHTS[level];
- break;
- }
- }
- }
-
- TTF::~TTF()
- {
- }
-
- GLuint TTF::createAtlas()
- {
- GLuint t;
- gl.flushError();
- t = gl.genTexture();
- gl.bindTexture(t);
- gl.setTexParameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gl.setTexParameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gl.setTexParameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gl.setTexParameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- gl.texImage(GL_RGBA8, textureWidth, textureHeight, GL_RGBA, GL_UNSIGNED_BYTE);
- if (glGetError() != GL_NO_ERROR)
- {
- glDeleteTextures(1, &t);
- gl.bindTexture(0);
- return 0;
- }
- atlases.push_back(t);
- gl.bindTexture(0);
- return t;
- }
-
- void TTF::print(const Content& t, int x, int y, int lineheight, int spacing)
- {
- Page* page = typeset(t, lineheight, spacing);
- print(page, x, y);
- delete page;
- }
-
- Page* TTF::typeset(const Content& text, int lineheight, int spacing)
- {
- Page* page = new Page();
- page->font = this;
- vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
- vector<GlyphVertex>& glyphvertices = page->glyphvertices;
- int texture = -1;
- TTFGlyph* glyph = nullptr;
- GlyphVertex vertex;
- Vector2<int> p(0, 0);
- int i = 0;
-
- #define glyphvertices_push(_x, _y, _u, _v) \
- vertex.x = _x; vertex.y = _y;\
- vertex.u = _u; vertex.v = _v;\
- glyphvertices.push_back(vertex);
-
- #define glyphlize(c)\
- do{\
- glyph = &findGlyph(c); \
- if (texture != glyph->atlas) \
- { \
- GlyphArrayDrawInfo info; \
- info.start = i; \
- info.count = 0; \
- info.texture = glyph->atlas; \
- texture = glyph->atlas; \
- glyphinfolist.push_back(info); \
- } \
- glyphinfolist[glyphinfolist.size() - 1].count += 4; \
- TTFGlyph::Bbox& bbox = glyph->bbox; \
- glyphvertices_push(p.x, p.y, bbox.x, bbox.y); \
- glyphvertices_push(p.x, p.y + glyph->height, bbox.x, bbox.y + bbox.h); \
- glyphvertices_push(p.x + glyph->width, p.y + glyph->height, bbox.x + bbox.w, bbox.y + bbox.h); \
- glyphvertices_push(p.x + glyph->width, p.y, bbox.x + bbox.w, bbox.y); \
- }while(0)
-
- for (Codepoint c : text)
- {
- if (c == 0x0D)
- continue;
- if (c == 0x0A)
- {
- /* new line */
- p.y += lineheight;
- p.x = 0;
- continue;
- }
- if (c == 0x09)
- {
- // tab = 4*space
- unsigned cw = getCharWidth(0x20);
- p.x += cw * 4;
- continue;
- }
- glyphlize(c);
- p.x += glyph->width + spacing;
- i += 4;
- }
- getTextBox(text, &page->size.w, &page->size.h, lineheight, spacing);
- return page;
- }
-
- Page* TTF::typeset(const Text& text, int lineheight, int spacing)
- {
- return typeset(*text, lineheight, spacing);
- }
-
- void TTF::print(const Page* page, int x, int y)
- {
- Shader* shader = Shader::getCurrentShader();
- const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
- const vector<GlyphVertex>& glyphvertices = page->glyphvertices;
- gl.ModelMatrix.setTransformation(x, y, 0, 1, 1, 0, 0);
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
- shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
- for (int i = 0; i < glyphinfolist.size(); ++i)
- {
- const GlyphArrayDrawInfo& info = glyphinfolist[i];
- shader->bindVertexPointer(2, GL_INT, sizeof(GlyphVertex), &glyphvertices[info.start].x);
- shader->bindUVPointer(2, GL_FLOAT, sizeof(GlyphVertex), &glyphvertices[info.start].u);
- gl.bindTexture(info.texture);
- gl.drawArrays(GL_QUADS, 0, info.count);
- gl.bindTexture(0);
- }
- }
-
- void TTF::print(const Text& text, int x, int y, int lineheight, int spacing /* = 0 */)
- {
- print(*text, x, y, lineheight, spacing);
- }
-
- int TTF::getCharWidth(int c)
- {
- int adw, lsb;
- ttf->pushTTFsize(mFontSize);
- ttf->getHMetrics(c, &adw, &lsb);
- ttf->popTTFsize();
- return adw;
- }
-
- int TTF::getCharHeight(int c)
- {
- return descent;
- }
-
- int TTF::getTextWidth(const Content& t, int spacing)
- {
- ttf->pushTTFsize(mFontSize);
- int res = 0;
- int tmp = 0;
- for (Codepoint c : t)
- {
- if (c == 0x0D)
- continue;
- if (c == 0x0A)
- {
- tmp = 0;
- continue;
- }
- tmp += getCharWidth(c) + spacing;
- if (tmp > res)
- res = tmp;
- }
- ttf->popTTFsize();
- return res;
- }
-
- int TTF::getTextHeight(const Content& t, int lineheight)
- {
- ttf->pushTTFsize(mFontSize);
- int res = 0;
- bool newline = true;
- for (Codepoint c : t)
- {
- if (c == 0x0A)
- newline = true;
- else if (c == 0x0D);
- else if (newline)
- {
- newline = false;
- res += lineheight;
- }
- }
- ttf->popTTFsize();
- return res;
- }
-
- void TTF::getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing)
- {
- ttf->pushTTFsize(mFontSize);
- *w = 0;
- *h = 0;
- int tmp = 0;
- bool newline = true;
- for (Codepoint c : text)
- {
- if (c == 0x0D)
- continue;
- if (c == 0x0A)
- {
- tmp = 0;
- newline = true;
- continue;
- }
- else if (newline)
- {
- newline = false;
- *h += lineheight;
- }
- tmp += getCharWidth(c) + spacing;
- if (tmp > *w)
- *w = tmp;
- }
- ttf->popTTFsize();
- }
-
- TTF::TTFGlyph& TTF::bakeGlyph(unsigned int character)
- {
- int w, h, xoff, yoff;
- ttf->pushTTFsize(mFontSize);
- GLuint atlas = atlases.back();
- const Color* bitmap = ttf->getCodepointBitmap(character, &w, &h, &xoff, &yoff);
- int adw, lsb;
- {
- /* bake glyph */
- ttf->getHMetrics(character, &adw, &lsb);
- ttf->popTTFsize();
- if (cursor.x + adw > textureWidth )
- {
- cursor.x = 0;
- cursor.y += descent;
- if (cursor.y + descent * 2 > textureHeight)
- {
- /* create new atlas */
- atlas = createAtlas();
- cursor.y = 0;
- }
- }
- gl.bindTexture(atlas);
- gl.texSubImage(cursor.x + xoff, cursor.y + yoff + baseline, w, h, GL_RGBA, GL_UNSIGNED_BYTE, bitmap);
- gl.bindTexture();
- delete[] bitmap;
- }
- TTFGlyph glyph;
- glyph.atlas = atlas;
- glyph.bbox.x = cursor.x / (float)textureWidth;
- glyph.bbox.y = cursor.y / (float)textureHeight;
- glyph.bbox.w = adw / (float)textureWidth;
- glyph.bbox.h = descent / (float)textureHeight;
- glyph.width = adw;
- glyph.height = descent;
- glyphs.insert(std::pair<unsigned int, TTFGlyph>(character, glyph));
- cursor.x += adw;
- return glyphs[character];
- }
-
- TTF::TTFGlyph& TTF::findGlyph(unsigned int character)
- {
- map<unsigned int, TTFGlyph>::iterator it = glyphs.find(character);
- if (it != glyphs.end())
- return it->second;
- else
- return bakeGlyph(character);
- }
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // defined(jin_graphics) \ No newline at end of file
diff --git a/src/libjin/Graphics/Font/je_ttf.h b/src/libjin/Graphics/Font/je_ttf.h
deleted file mode 100644
index e3d63b2..0000000
--- a/src/libjin/Graphics/Font/je_ttf.h
+++ /dev/null
@@ -1,288 +0,0 @@
-#ifndef __JETTF_H
-#define __JE_TTF_H
-#include "../../core/je_configuration.h"
-#if defined(jin_graphics)
-
-#include <vector>
-#include <map>
-
-#include "../../3rdparty/stb/stb_truetype.h"
-#include "../../math/je_quad.h"
-
-#include "../je_color.h"
-#include "../je_graphic.h"
-
-#include "je_page.h"
-#include "je_font.h"
-#include "je_text.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- class TTF;
-
- //
- // TTFData
- // |- TTF(14px)
- // |- TTF(15px)
- // .
- // .
- // .
- //
- class TTFData
- {
- public:
-
- ///
- ///
- ///
- static TTFData* createTTFData(const unsigned char* data, unsigned int size);
-
- ///
- ///
- ///
- ~TTFData();
-
- ///
- ///
- ///
- TTF* createTTF(unsigned ttfsize);
-
- ///
- ///
- ///
- void pushTTFsize(unsigned ttfsize);
-
- ///
- ///
- ///
- void popTTFsize();
-
- ///
- ///
- ///
- Channel* getCodepointBitmapAlpha(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const;
-
- ///
- ///
- ///
- Color* getCodepointBitmap(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const;
-
- ///
- ///
- ///
- void getVMetrics(int* baseline, int* descent);
-
- ///
- ///
- ///
- void getHMetrics(unsigned int codepoint, int* advanceWidth, int* leftSideBearing);
-
- private:
-
- ///
- ///
- ///
- static const unsigned int FONT_SIZE = 12;
-
- ///
- ///
- ///
- TTFData(const unsigned char* data, unsigned int size);
-
- ///
- ///
- ///
- stbtt_fontinfo info;
-
- ///
- ///
- ///
- struct
- {
- unsigned char* data;
- unsigned int size;
- } raw;
-
- ///
- ///
- ///
- std::vector<float> scales;
-
- };
-
- class TTF : public Font
- {
- public:
- //static TTF* createTTF(TTFData* ttfData, unsigned ttfSzie);
-
- ///
- ///
- ///
- Page* typeset(const Text& text, int lineheight, int spacing = 0) override;
-
- ///
- ///
- ///
- Page* typeset(const Content& text, int lineheight, int spacing = 0) override;
-
- ///
- ///
- ///
- void print(const Text& text, int x, int y, int lineheight, int spacing = 0) override;
-
- ///
- ///
- ///
- void print(const Content& text, int x, int y, int lineheight, int spacing = 0) override;
-
- ///
- ///
- ///
- void print(const Page* page, int x, int y) override;
-
- ///
- ///
- ///
- ~TTF();
-
- private:
-
- friend class TTFData;
-
- ///
- ///
- ///
- struct TTFGlyph
- {
- GLuint atlas;
- // normalized coordinates
- struct Bbox
- {
- float x, y;
- float w, h;
- } bbox;
- // glyph size in pixel
- unsigned int width, height;
- };
-
- ///
- ///
- ///
- static const int TEXTURE_SIZE_LEVELS_COUNT = 7;
-
- ///
- ///
- ///
- static const int TEXTURE_SIZE_LEVEL_MAX = TEXTURE_SIZE_LEVELS_COUNT - 1;
-
- ///
- ///
- ///
- static const int TEXTURE_WIDTHS[TEXTURE_SIZE_LEVELS_COUNT];
-
- ///
- ///
- ///
- static const int TEXTURE_HEIGHTS[TEXTURE_SIZE_LEVELS_COUNT];
-
- ///
- ///
- ///
- TTF(TTFData* ttf, Codepoint ttfSize);
-
- ///
- ///
- ///
- void estimateSize();
-
- ///
- ///
- ///
- GLuint createAtlas();
-
- ///
- ///
- ///
- TTFGlyph& bakeGlyph(Codepoint character);
-
- ///
- ///
- ///
- TTFGlyph& findGlyph(Codepoint character);
-
- ///
- ///
- ///
- int getCharWidth(int c);
-
- ///
- ///
- ///
- int getCharHeight(int c);
-
- ///
- ///
- ///
- int getTextWidth(const Content& text, int spacing = 0);
-
- ///
- ///
- ///
- int getTextHeight(const Content& text, int lineheight);
-
- ///
- ///
- ///
- void getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing = 0);
-
- ///
- ///
- ///
- int textureWidth;
-
- ///
- ///
- ///
- int textureHeight;
-
- ///
- ///
- ///
- std::vector<GLuint> atlases;
-
- ///
- ///
- ///
- std::map<Codepoint, TTFGlyph> glyphs;
-
- ///
- ///
- ///
- TTFData* ttf;
-
- ///
- ///
- ///
- int baseline;
-
- ///
- ///
- ///
- int descent;
-
- ///
- ///
- ///
- Math::Vector2<float> cursor;
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // defined(jin_graphics)
-
-#endif // __JE_FONT_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/je_base.shader.h b/src/libjin/Graphics/Shader/je_base.shader.h
deleted file mode 100644
index d6f9d7b..0000000
--- a/src/libjin/Graphics/Shader/je_base.shader.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __JE_BASE_SHADER_H
-#define __JE_BASE_SHADER_H
-
-static const char* base_shared = R"(
-#define Number float
-#define Texture sampler2D
-#define Canvas sampler2D
-#define Color vec4
-#define Vec2 vec2
-#define Vec3 vec3
-#define Vec4 vec4
-
-#define texel texture2D
-
-struct Vertex
-{
- vec2 xy;
- vec2 uv;
-};
-
-)";
-
-static const int BASE_SHARED_SIZE = strlen(base_shared);
-
-static const char* base_vertex = R"(
-#version 130 core
-
-%s
-
-uniform mat4 jin_ProjectionMatrix;
-uniform mat4 jin_ModelMatrix;
-
-in vec2 jin_VertexCoords;
-in vec2 jin_TextureCoords;
-
-out vec4 jin_Color;
-out vec2 jin_XY;
-out vec2 jin_UV;
-
-%s
-
-void main()
-{
- vec4 v = jin_ModelMatrix * vec4(jin_VertexCoords, 0, 1.0);
- Vertex _v = vert(Vertex(v.xy, jin_TextureCoords));
- gl_Position = jin_ProjectionMatrix * vec4(_v.xy, 0, 1.0f);
- jin_Color = gl_Color;
- jin_XY = _v.xy;
- jin_UV = _v.uv;
-}
-)";
-
-static const int BASE_VERTEX_SHADER_SIZE = strlen(base_vertex) + BASE_SHARED_SIZE;
-
-#define formatVertexShader(buf, program) sprintf(buf,base_vertex, base_shared, program)
-
-static const char* base_fragment = R"(
-#version 130 core
-
-%s
-
-uniform Texture jin_MainTexture;
-
-in vec4 jin_Color;
-in vec2 jin_XY;
-in vec2 jin_UV;
-
-out vec4 jin_OutColor;
-
-%s
-
-void main()
-{
- jin_OutColor = frag(jin_Color, jin_MainTexture, Vertex(jin_XY, jin_UV));
-}
-)";
-
-static const int BASE_FRAGMENT_SHADER_SIZE = strlen(base_fragment) + BASE_SHARED_SIZE;
-
-#define formatFragmentShader(buf, program) sprintf(buf, base_fragment, base_shared, program)
-
-static const char* SHADER_PROJECTION_MATRIX = "jin_ProjectionMatrix";
-static const char* SHADER_MODEL_MATRIX = "jin_ModelMatrix";
-static const char* SHADER_MAIN_TEXTURE = "jin_MainTexture";
-static const char* SHADER_VERTEX_COORDS = "jin_VertexCoords";
-static const char* SHADER_TEXTURE_COORDS = "jin_TextureCoords";
-
-#endif // __JE_BASE_SHADER_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/je_jsl_compiler.cpp b/src/libjin/Graphics/Shader/je_jsl_compiler.cpp
deleted file mode 100644
index 81b14e8..0000000
--- a/src/libjin/Graphics/Shader/je_jsl_compiler.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "../../core/je_configuration.h"
-#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
-
-#include "../../Filesystem/je_buffer.h"
-
-#include "je_jsl_compiler.h"
-
-using namespace std;
-using namespace JinEngine::Filesystem;
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
-#include "je_base.shader.h"
-
- bool JSLCompiler::compile(const string& jsl, string* vertex_shader, string* fragment_shader)
- {
- // parse shader source, need some optimizations
- int loc_VERTEX_SHADER = jsl.find("#VERTEX_SHADER");
- int loc_END_VERTEX_SHADER = jsl.find("#END_VERTEX_SHADER");
- int loc_FRAGMENT_SHADER = jsl.find("#FRAGMENT_SHADER");
- int loc_END_FRAGMENT_SHADER = jsl.find("#END_FRAGMENT_SHADER");
- if (loc_VERTEX_SHADER == string::npos
- || loc_END_VERTEX_SHADER == string::npos
- || loc_FRAGMENT_SHADER == string::npos
- || loc_END_FRAGMENT_SHADER == string::npos
- )
- return false;
- // Load vertex and fragment shader source into buffers.
- {
- // Compile JSL vertex program.
- int start = loc_VERTEX_SHADER + strlen("#VERTEX_SHADER");
- *vertex_shader = jsl.substr(start, loc_END_VERTEX_SHADER - start);
- Buffer vbuffer = Buffer(vertex_shader->length() + BASE_VERTEX_SHADER_SIZE);
- formatVertexShader((char*)&vbuffer, vertex_shader->c_str());
- vertex_shader->assign((char*)&vbuffer);
- }
- {
- // Compile JSL fragment program.
- int start = loc_FRAGMENT_SHADER + strlen("#FRAGMENT_SHADER");
- *fragment_shader = jsl.substr(start, loc_END_FRAGMENT_SHADER - start);
- Buffer fbuffer = Buffer(fragment_shader->length() + BASE_FRAGMENT_SHADER_SIZE);
- formatFragmentShader((char*)&fbuffer, fragment_shader->c_str());
- fragment_shader->assign((char*)&fbuffer);
- }
- return true;
- }
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader) \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/je_jsl_compiler.h b/src/libjin/Graphics/Shader/je_jsl_compiler.h
deleted file mode 100644
index 29129e1..0000000
--- a/src/libjin/Graphics/Shader/je_jsl_compiler.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __JE_JSL_COMPILER_H
-#define __JE_JSL_COMPILER_H
-
-#include "../../core/je_configuration.h"
-#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
-
-#include <string>
-
-#include "../../common/je_singleton.hpp"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- /// Compile JSL into GLSL.
- ///
- class JSLCompiler : public Singleton<JSLCompiler>
- {
- public:
- ///
- /// Compile JSL shader source into GLSL.
- ///
- /// @param jsl JSL shader source.
- /// @param glsl_vertex Output of vertex glsl shader source.
- /// @param glsl_fragment Output of fragment glsl shader source.
- /// @return True if compile successful, otherwise return false.
- ///
- bool compile(const std::string& jsl, std::string* glsl_vertex, std::string* glsl_fragment);
-
- private:
- singleton(JSLCompiler);
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader)
-
-#endif // __JE_JSL_COMPILER_H \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/je_shader.cpp b/src/libjin/Graphics/Shader/je_shader.cpp
deleted file mode 100644
index b0e7506..0000000
--- a/src/libjin/Graphics/Shader/je_shader.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-#include "../../core/je_configuration.h"
-#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
-
-#include <iostream>
-
-#include "../../filesystem/je_buffer.h"
-#include "../../utils/je_macros.h"
-
-#include "je_jsl_compiler.h"
-#include "je_shader.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- using namespace std;
- using namespace JinEngine::Filesystem;
-
- //
- // default_texture
- // base_shader
- // SHADER_FORMAT_SIZE
- // formatShader
- //
- #include "je_default.shader.h"
-
- //
- // https://stackoverflow.com/questions/27941496/use-sampler-without-passing-through-value
- // The default value of a sampler variable is 0. From the GLSL 3.30 spec,
- // section "4.3.5 Uniforms":
- //
- // The link time initial value is either the value of the variable's
- // initializer, if present, or 0 if no initializer is present.Sampler
- // types cannot have initializers.
- //
- // Since a value of 0 means that it's sampling from texture unit 0, it will
- // work without ever setting the value as long as you bind your textures to
- // unit 0. This is well defined behavior.
- //
- // Since texture unit 0 is also the default until you call glActiveTexture()
- // with a value other than GL_TEXTURE0, it's very common to always use unit
- // 0 as long as shaders do not need more than one texture.Which means that
- // often times, setting the sampler uniforms is redundant for simple
- // applications.
- //
- // I would still prefer to always set the values.If nothing else, it makes
- // it clear to anybody reading your code that you really mean to sample from
- // texture unit 0, and did not just forget to set the value.
- //
- const int DEFAULT_TEXTURE_UNIT = 0;
-
- /*static*/ Shader* Shader::CurrentShader = nullptr;
-
- Shader* Shader::createShader(const string& program)
- {
- Shader* shader = nullptr;
- try
- {
- shader = new Shader(program);
- }
- catch(...)
- {
- return nullptr;
- }
- return shader;
- }
-
- Shader::Shader(const string& program)
- : mCurrentTextureUnit(DEFAULT_TEXTURE_UNIT)
- {
- if (!compile(program))
- throw 0;
- }
-
- Shader::~Shader()
- {
- if (CurrentShader == this)
- unuse();
- // delete shader program
- glDeleteShader(mPID);
- }
-
- bool Shader::compile(const string& program)
- {
- string vertex_shader, fragment_shader;
- // Compile JSL shader source into GLSL shader source.
- JSLCompiler* compiler = JSLCompiler::get();
- if (!compiler->compile(program, &vertex_shader, &fragment_shader))
- {
- return false;
- }
-#define glsl(SHADER_MODE, SHADER, SRC) \
-do{ \
-const GLchar* src = SRC.c_str(); \
-glShaderSource(SHADER, 1, &src, NULL); \
-glCompileShader(SHADER); \
-GLint success; \
-glGetShaderiv(SHADER, GL_COMPILE_STATUS, &success); \
-if (success == GL_FALSE) \
- return false; \
-}while(0)
- // Compile vertex shader.
- GLuint vid = glCreateShader(GL_VERTEX_SHADER);
- glsl(GL_VERTEX_SHADER, vid, vertex_shader);
- // Compile fragment shader.
- GLuint fid = glCreateShader(GL_FRAGMENT_SHADER);
- glsl(GL_FRAGMENT_SHADER, fid, fragment_shader);
-#undef glsl
- // Create OpenGL shader program.
- mPID = glCreateProgram();
- glAttachShader(mPID, vid);
- glAttachShader(mPID, fid);
- glLinkProgram(mPID);
- GLint success;
- glGetProgramiv(mPID, GL_LINK_STATUS, &success);
- if (success == GL_FALSE)
- return false;
- }
-
- static inline GLint getMaxTextureUnits()
- {
- GLint maxTextureUnits = 0;
- glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
- return maxTextureUnits;
- }
-
- void Shader::use()
- {
- glUseProgram(mPID);
- CurrentShader = this;
- sendInt(SHADER_MAIN_TEXTURE, DEFAULT_TEXTURE_UNIT);
- }
-
- /*static*/ void Shader::unuse()
- {
- glUseProgram(0);
- CurrentShader = nullptr;
- }
-
- GLint Shader::claimTextureUnit(const std::string& name)
- {
- std::map<std::string, GLint>::iterator unit = mTextureUnits.find(name);
- if (unit != mTextureUnits.end())
- return unit->second;
- static GLint MAX_TEXTURE_UNITS = getMaxTextureUnits();
- if (++mCurrentTextureUnit >= MAX_TEXTURE_UNITS)
- return 0;
- mTextureUnits[name] = mCurrentTextureUnit;
- return mCurrentTextureUnit;
- }
-
- #define checkJSL() \
- if (CurrentShader != this) \
- return
-
- void Shader::sendInt(const char* name, int value)
- {
- checkJSL();
- int loc = glGetUniformLocation(mPID, name);
- glUniform1i(loc, value);
- }
-
- void Shader::sendFloat(const char* variable, float number)
- {
- checkJSL();
- int loc = glGetUniformLocation(mPID, variable);
- glUniform1f(loc, number);
- }
-
- //
- // https://www.douban.com/note/627332677/
- // struct TextureUnit
- // {
- // GLuint targetTexture1D;
- // GLuint targetTexture2D;
- // GLuint targetTexture3D;
- // GLuint targetTextureCube;
- // ...
- // };
- //
- // TextureUnit mTextureUnits[GL_MAX_TEXTURE_IMAGE_UNITS]
- // GLuint mCurrentTextureUnit = 0;
- //
- void Shader::sendTexture(const char* variable, const Texture* tex)
- {
- checkJSL();
- GLint location = glGetUniformLocation(mPID, variable);
- if (location == -1)
- return;
- GLint unit = claimTextureUnit(variable);
- if (unit == 0)
- {
- // TODO: 쳣󶨵
- return;
- }
- gl.activeTexUnit(unit);
- glUniform1i(location, unit);
- gl.bindTexture(tex->getTexture());
- gl.activeTexUnit(0);
- }
-
- void Shader::sendCanvas(const char* variable, const Canvas* canvas)
- {
- checkJSL();
- GLint location = glGetUniformLocation(mPID, variable);
- if (location == -1)
- return;
- GLint unit = claimTextureUnit(variable);
- if (unit == 0)
- {
- // TODO: 쳣󶨵
- return;
- }
- glUniform1i(location, unit);
- glActiveTexture(GL_TEXTURE0 + unit);
- gl.bindTexture(canvas->getTexture());
-
- glActiveTexture(GL_TEXTURE0);
- }
-
- void Shader::sendVec2(const char* name, float x, float y)
- {
- checkJSL();
- int loc = glGetUniformLocation(mPID, name);
- glUniform2f(loc, x, y);
- }
-
- void Shader::sendVec3(const char* name, float x, float y, float z)
- {
- checkJSL();
- int loc = glGetUniformLocation(mPID, name);
- glUniform3f(loc, x, y, z);
- }
-
- void Shader::sendVec4(const char* name, float x, float y, float z, float w)
- {
- checkJSL();
- int loc = glGetUniformLocation(mPID, name);
- glUniform4f(loc, x, y, z, w);
- }
-
- void Shader::sendColor(const char* name, const Color* col)
- {
- checkJSL();
- int loc = glGetUniformLocation(mPID, name);
- glUniform4f(loc,
- col->r / 255.f,
- col->g / 255.f,
- col->b / 255.f,
- col->a / 255.f
- );
- }
-
- void Shader::sendMatrix4(const char* name, const Math::Matrix* mat4)
- {
- int loc = glGetUniformLocation(mPID, name);
- glUniformMatrix4fv(loc, 1, GL_FALSE, mat4->getElements());
- }
-
- void Shader::bindVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
- {
- GLint loc = glGetAttribLocation(mPID, SHADER_VERTEX_COORDS);
- glEnableVertexAttribArray(0);
- glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers);
- }
-
- void Shader::bindUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
- {
- GLint loc = glGetAttribLocation(mPID, SHADER_TEXTURE_COORDS);
- glEnableVertexAttribArray(1);
- glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers);
- }
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader) \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/je_shader.h b/src/libjin/Graphics/Shader/je_shader.h
deleted file mode 100644
index 928fb0a..0000000
--- a/src/libjin/Graphics/Shader/je_shader.h
+++ /dev/null
@@ -1,200 +0,0 @@
-#ifndef __JE_SHADER_H
-#define __JE_SHADER_H
-
-#include "../../core/je_configuration.h"
-#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
-
-#include <string>
-#include <map>
-
-#include "../../3rdparty/GLee/GLee.h"
-
-#include "../je_color.h"
-#include "../je_texture.h"
-#include "../je_canvas.h"
-
-#include "je_base.shader.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- /// Built in shader program.
- ///
- /// Built in shader program written with custom shading language called JSL (jin
- /// shading language). A JSL program is compiled into glsl, so most glsl built in
- /// functions and structs are available in JSL.
- ///
- class Shader
- {
- public:
- ///
- /// Create shader program from source code.
- ///
- /// @param source The shader source code.
- ///
- static Shader* createShader(const std::string& source);
-
- ///
- /// Get current shader.
- ///
- /// @return Current used shader program.
- ///
- static inline Shader* getCurrentShader() { return CurrentShader; }
-
- ///
- /// Unuse current shader.
- ///
- static void unuse();
-
- ///
- /// Destructor of shader.
- ///
- virtual ~Shader();
-
- ///
- /// Use specific shader.
- ///
- void use();
-
- ///
- /// Send float value to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param number Value of uniform variable to be sent.
- ///
- void sendFloat(const char* name, float number);
-
- ///
- /// Send texture to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param texture Texture to be sent.
- ///
- void sendTexture(const char* name, const Texture* texture);
-
- ///
- /// Send integer value to shader
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param value Value to be sent.
- ///
- void sendInt(const char* name, int value);
-
- ///
- /// Send 2D vector to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param x X value of the vector to be sent.
- /// @param y Y value of the vector to be sent.
- ///
- void sendVec2(const char* name, float x, float y);
-
- ///
- /// Send 3D vector to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param x X value of the vector to be sent.
- /// @param y Y value of the vector to be sent.
- /// @param z Z value of the vector to be sent.
- ///
- void sendVec3(const char* name, float x, float y, float z);
-
- ///
- /// Send 4D vector to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param x X value of the vector to be sent.
- /// @param y Y value of the vector to be sent.
- /// @param z Z value of the vector to be sent.
- /// @param w W value of the vector to be sent.
- ///
- void sendVec4(const char* name, float x, float y, float z, float w);
-
- ///
- /// Send canvas to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param canvas Canvas to be sent.
- ///
- void sendCanvas(const char* name, const Canvas* canvas);
-
- ///
- /// Send color to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param color Color to be sent.
- ///
- void sendColor(const char* name, const Color* color);
-
- ///
- /// Send 4 by 4 matrix to shader.
- ///
- /// @param name Name of the uniform variable to be assigned.
- /// @param mat4 Matrix to be sent.
- ///
- void sendMatrix4(const char* name, const Math::Matrix* mat4);
-
- ///
- /// Set vertices value.
- ///
- /// @param n Number of vertices.
- /// @param type Data type of each component in the array.
- /// @param stride Byte offset between consecutive generic vertex attributes.
- /// @param pointers Pointer to the first component of the first generic vertex
- /// attribute in the array.
- ///
- void bindVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
-
- ///
- /// Set texture UV coordinates.
- ///
- /// @param n Number of vertices.
- /// @param type Data type of each component in the array.
- /// @param stride Byte offset between consecutive generic vertex attributes.
- /// @param pointers Pointer to the first component of the first generic vertex
- /// attribute in the array.
- ///
- void bindUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
-
- protected:
- ///
- /// Reference of current used shader.
- ///
- static Shader* CurrentShader;
-
- ///
- /// Get texture unit of the uniform texture. If not, assign one.
- ///
- /// @param name Name of the texture uniform variable.
- /// @return Texture unit which texture variable be assigned.
- ///
- GLint claimTextureUnit(const std::string& name);
-
- ///
- /// Shader constructor.
- ///
- Shader(const std::string& program);
-
- ///
- /// Compile JSL program into GLSL source.
- ///
- /// @param program JSL source code.
- /// @return Return true if compile successed, otherwise return false.
- ///
- bool compile(const std::string& program);
-
- GLuint mPID;
- GLint mCurrentTextureUnit;
- std::map<std::string, GLint> mTextureUnits;
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader)
-
-#endif // __JE_SHADER_H \ No newline at end of file
diff --git a/src/libjin/Graphics/animation/je_animation.h b/src/libjin/Graphics/animation/je_animation.h
deleted file mode 100644
index f330a0c..0000000
--- a/src/libjin/Graphics/animation/je_animation.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __JE_ANIMATION_H
-#define __JE_ANIMATION_H
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- ///
- ///
- class Animation
- {
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/animation/je_clip.h b/src/libjin/Graphics/animation/je_clip.h
deleted file mode 100644
index d6709dc..0000000
--- a/src/libjin/Graphics/animation/je_clip.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __JE_CLIP_H
-#define __JE_CLIP_H
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- /// Animation clip with key.
- ///
- class Clip
- {
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/animations/je_animation.cpp b/src/libjin/Graphics/animations/je_animation.cpp
new file mode 100644
index 0000000..4fe673a
--- /dev/null
+++ b/src/libjin/Graphics/animations/je_animation.cpp
@@ -0,0 +1,14 @@
+#include "je_animation.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Animations
+ {
+
+
+
+ }
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/animations/je_animation.h b/src/libjin/Graphics/animations/je_animation.h
new file mode 100644
index 0000000..9926cf9
--- /dev/null
+++ b/src/libjin/Graphics/animations/je_animation.h
@@ -0,0 +1,64 @@
+#ifndef __JE_ANIMATION_H__
+#define __JE_ANIMATION_H__
+
+#include <vector>
+#include <string>
+
+#include "../je_sprite.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Animations
+ {
+
+ ///
+ /// Animation clip with key.
+ ///
+ class Animation
+ {
+ public:
+ void update(float dt);
+
+ void start();
+ void pause();
+ void stop();
+ void rewind();
+ void setSpeed(float speed);
+
+ ///
+ /// Get current frame index.
+ ///
+ uint getCurrentFrameIndex();
+
+ ///
+ ///
+ ///
+ Sprite* getCurrentFrame();
+
+ ///
+ /// Set current frame index.
+ ///
+ /// @param frame Current frame to play.
+ ///
+ void setCurrentFrame(uint frame);
+
+ private:
+ ///
+ /// Key frames.
+ ///
+ std::vector<Sprite*> mFrames;
+
+ ///
+ /// Animation playing speed.
+ ///
+ float mSpeed;
+
+ };
+
+ } // namespace Animations
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/animations/je_animator.cpp b/src/libjin/Graphics/animations/je_animator.cpp
new file mode 100644
index 0000000..360bd5d
--- /dev/null
+++ b/src/libjin/Graphics/animations/je_animator.cpp
@@ -0,0 +1,14 @@
+#include "je_animator.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Animations
+ {
+
+
+
+ }
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/animations/je_animator.h b/src/libjin/Graphics/animations/je_animator.h
new file mode 100644
index 0000000..6510a7d
--- /dev/null
+++ b/src/libjin/Graphics/animations/je_animator.h
@@ -0,0 +1,50 @@
+#ifndef __JE_ANIMATOR_H__
+#define __JE_ANIMATOR_H__
+
+#include <map>
+#include <vector>
+#include <string>
+
+#include "je_animation.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Animations
+ {
+
+ ///
+ ///
+ ///
+ class Animator
+ {
+ public:
+ void addAnimation(const std::string& key, Animation* clip);
+ bool hasKey(const std::string& key);
+
+ void play();
+ void switchAnimation(const std::string& key);
+
+ ///
+ /// Control clips.
+ ///
+ void stopAnimation();
+ void pauseAnimation();
+ void rewindAnimation();
+ void startAnimation();
+
+ private:
+ ///
+ /// Map a key to clips.
+ ///
+ std::map<std::string, Animation*> mAnimations;
+ Animation* mCurrentAnimation;
+
+ };
+
+ } // namespace Animations
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_decoder.cpp b/src/libjin/Graphics/fonts/je_decoder.cpp
new file mode 100644
index 0000000..02112a0
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_decoder.cpp
@@ -0,0 +1,96 @@
+#include <stdlib.h>
+#include <string.h>
+#include "je_decoder.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ /* utf8 byte string to unicode codepoint */
+ static const char *utf8toCodepoint(const char *p, unsigned *res) {
+ return nullptr;
+
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+ // decoders
+ /////////////////////////////////////////////////////////////////////////////
+
+ const void* Utf8::decode(const void* data, Codepoint* res) const
+ {
+ const char* p = (char*)data;
+ unsigned x, mask, shift;
+ switch (*p & 0xf0) {
+ case 0xf0: mask = 0x07; shift = 18; break;
+ case 0xe0: mask = 0x0f; shift = 12; break;
+ case 0xc0:
+ case 0xd0: mask = 0x1f; shift = 6; break;
+ default:
+ *res = *p;
+ return p + 1;
+ }
+ x = (*p & mask) << shift;
+ do {
+ if (*(++p) == '\0') {
+ *res = x;
+ return p;
+ }
+ shift -= 6;
+ x |= (*p & 0x3f) << shift;
+ } while (shift);
+ *res = x;
+ return p + 1;
+ }
+
+ const void* Utf8::next(const void* data) const
+ {
+ const char* p = (char*)data;
+ unsigned x, mask, shift;
+ switch (*p & 0xf0) {
+ case 0xf0: mask = 0x07; shift = 18; break;
+ case 0xe0: mask = 0x0f; shift = 12; break;
+ case 0xc0:
+ case 0xd0: mask = 0x1f; shift = 6; break;
+ default:
+ return p + 1;
+ }
+ x = (*p & mask) << shift;
+ do {
+ if (*(++p) == '\0') {
+ return p;
+ }
+ shift -= 6;
+ x |= (*p & 0x3f) << shift;
+ } while (shift);
+ return p + 1;
+ }
+ /*
+ const void* Utf16::decode(const void* data, Codepoint* res) const
+ {
+ return nullptr;
+ }
+
+ const void* Utf16::next(const void* data) const
+ {
+ return nullptr;
+ }
+ */
+ const void* Ascii::decode(const void* data, Codepoint* res) const
+ {
+ const char* p = (char*)data;
+ *res = *p;
+ return p + 1;
+ }
+
+ const void* Ascii::next(const void* data) const
+ {
+ const char* p = (char*)data;
+ return p + 1;
+ }
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_decoder.h b/src/libjin/Graphics/fonts/je_decoder.h
new file mode 100644
index 0000000..840cada
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_decoder.h
@@ -0,0 +1,97 @@
+#ifndef __JE_UTF8_H__
+#define __JE_UTF8_H__
+
+#include <vector>
+
+#include "je_text.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ ///
+ /// Text decoder.
+ ///
+ class Decoder
+ {
+ public:
+
+ ///
+ /// Decode a code unit.
+ ///
+ /// @param data Code units.
+ /// @param codepoint Value of code point.
+ /// @return Next code unit location.
+ ///
+ virtual const void* decode(const void* data, Codepoint* codepoint) const = 0;
+
+ ///
+ /// Get next code unit location.
+ ///
+ /// @param data Code units.
+ /// @return Next code unit location.
+ ///
+ virtual const void* next(const void* data) const = 0;
+
+ };
+
+ ///
+ /// Utf-8 decoder.
+ ///
+ class Utf8 : public Decoder
+ {
+ public:
+
+ ///
+ /// Decode a code unit.
+ ///
+ /// @param data Code units.
+ /// @param codepoint Value of code point.
+ /// @return Next code unit location.
+ ///
+ const void* decode(const void* data, Codepoint* codepoint) const override;
+
+ ///
+ /// Get next code unit location.
+ ///
+ /// @param data Code units.
+ /// @return Next code unit location.
+ ///
+ const void* next(const void* data) const override;
+
+ };
+
+ ///
+ /// Ascii decoder.
+ ///
+ class Ascii : public Decoder
+ {
+ public:
+
+ ///
+ /// Decode a code unit.
+ ///
+ /// @param data Code units.
+ /// @param codepoint Value of code point.
+ /// @return Next code unit location.
+ ///
+ const void* decode(const void* data, Codepoint* codepoint) const override;
+
+ ///
+ /// Get next code unit location.
+ ///
+ /// @param data Code units.
+ /// @return Next code unit location.
+ ///
+ const void* next(const void* data) const override;
+
+ };
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_font.h b/src/libjin/Graphics/fonts/je_font.h
new file mode 100644
index 0000000..9581b9f
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_font.h
@@ -0,0 +1,109 @@
+#ifndef __JE_FONT_H__
+#define __JE_FONT_H__
+
+#include <vector>
+#include "je_text.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ struct Page;
+
+ //
+ // Font
+ // |- TTF
+ // |- TextureFont
+ //
+
+ ///
+ /// Base Font class.
+ ///
+ class Font
+ {
+ public:
+ ///
+ /// Font constructor.
+ ///
+ Font(unsigned fontsize)
+ : mFontSize(fontsize)
+ {
+ }
+
+ ///
+ /// Font destructor.
+ ///
+ virtual ~Font() {};
+
+ ///
+ /// Create page with given text.
+ ///
+ /// @param text Text to be typesetted.
+ /// @param lineheight Line height of text.
+ /// @param spacing Spacing between characters. 0 by default.
+ /// @return Page if created successfully, otherwise return null.
+ ///
+ virtual Page* typeset(const Text& text, int lineheight, int spacing = 0) = 0;
+
+ ///
+ /// Create page with given unicode codepoints.
+ ///
+ /// @param content Unicode codepoints to be typesetted.
+ /// @param lineheight Line height of text.
+ /// @param spacing Spacing between characters. 0 by default.
+ /// @return Page if created successfully, otherwise return null.
+ ///
+ virtual Page* typeset(const Content& content, int lineheight, int spacing = 0) = 0;
+
+ ///
+ /// Render page to given position.
+ ///
+ /// @param page Page to be rendered.
+ /// @param x X value of the position.
+ /// @param y Y value of the position.
+ ///
+ virtual void render(const Page* page, int x, int y) = 0;
+
+ ///
+ /// Render unicode codepoints to given position.
+ ///
+ /// @param content Unicode codepoints to be typesetted.
+ /// @param x X value of the position.
+ /// @param y Y value of the position.
+ /// @param lineheight Line height of the content.
+ /// @param spacing Spacing between characters.
+ ///
+ virtual void render(const Content& content, int x, int y, int lineheight, int spacing = 0) = 0;
+
+ ///
+ /// Render text to given position.
+ ///
+ /// @param text Text to be rendered.
+ /// @param x X value of the position.
+ /// @param y Y value of the position.
+ /// @param lineheight Line height of the text.
+ /// @param spacing Spacing between characters.
+ ///
+ virtual void render(const Text& text, int x, int y, int lineheight, int spacing = 0) = 0;
+
+ ///
+ /// Get font size.
+ ///
+ /// @return Font size.
+ ///
+ inline unsigned getFontSize() { return mFontSize; };
+
+ protected:
+
+ unsigned mFontSize;
+
+ };
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // __JE_FONT_H__
diff --git a/src/libjin/Graphics/fonts/je_page.h b/src/libjin/Graphics/fonts/je_page.h
new file mode 100644
index 0000000..707f53a
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_page.h
@@ -0,0 +1,54 @@
+#ifndef __JE_PAGE_H__
+#define __JE_PAGE_H__
+
+#include "../../math/je_vector2.hpp"
+
+#include "je_font.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ class Font;
+
+ ///
+ /// Glyphs data to be rendered.
+ ///
+ struct GlyphVertex
+ {
+ int x, y; ///< screen coordinates
+ float u, v; ///< normalized texture uv
+ };
+
+ ///
+ /// Glyphs info for reducing draw call.
+ ///
+ struct GlyphArrayDrawInfo
+ {
+ GLuint texture; ///< atlas
+ unsigned int start; ///< glyph vertex indecies
+ unsigned int count; ///< glyph vertex count
+ };
+
+ ///
+ /// Page to be rendered.
+ ///
+ /// A page is a pre-rendered text struct for reducing draw call. Each page
+ /// keeps a font pointer which should not be changed.
+ ///
+ struct Page
+ {
+ Font* font;
+ std::vector<GlyphArrayDrawInfo> glyphinfolist;
+ std::vector<GlyphVertex> glyphvertices;
+ Math::Vector2<int> size;
+ };
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // __JE_PAGE_H__
diff --git a/src/libjin/Graphics/fonts/je_text.cpp b/src/libjin/Graphics/fonts/je_text.cpp
new file mode 100644
index 0000000..80aaa6a
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_text.cpp
@@ -0,0 +1,157 @@
+#include <cstring>
+
+#include "je_text.h"
+#include "je_decoder.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ /////////////////////////////////////////////////////////////////////////////
+ // iterator
+ /////////////////////////////////////////////////////////////////////////////
+
+ Text::Iterator::Iterator(const Iterator& itor)
+ : data(itor.data)
+ , p(itor.p)
+ , encode(itor.encode)
+ , length(itor.length)
+ {
+ switch (encode)
+ {
+ case Encode::UTF8: decoder = new Utf8(); break;
+ case Encode::ASCII: decoder = new Ascii(); break;
+ }
+ }
+
+ Text::Iterator::Iterator(const Encode& _encode, const void* _data, unsigned int _length)
+ : data(_data)
+ , p(_data)
+ , encode(_encode)
+ , length(_length)
+ {
+ switch (encode)
+ {
+ case Encode::UTF8: decoder = new Utf8(); break;
+ case Encode::ASCII: decoder = new Ascii(); break;
+ }
+ }
+
+ Text::Iterator::~Iterator()
+ {
+ delete decoder;
+ }
+
+ Codepoint Text::Iterator::get()
+ {
+ Codepoint codepoint;
+ decoder->decode(p, &codepoint);
+ return codepoint;
+ }
+
+ Codepoint Text::Iterator::operator*()
+ {
+ return get();
+ }
+ /*
+ Text::Iterator Text::Iterator::begin()
+ {
+ Iterator itor(encode, data, length);
+ itor.toBegin();
+ return itor;
+ }
+
+ Text::Iterator Text::Iterator::end()
+ {
+ Iterator itor(encode, data, length);
+ itor.toEnd();
+ return itor;
+ }
+ */
+ void Text::Iterator::toBegin()
+ {
+ p = (const unsigned char*)data;
+ }
+
+ void Text::Iterator::toEnd()
+ {
+ p = (const unsigned char*)data + length;
+ }
+
+ Text::Iterator& Text::Iterator::operator ++()
+ {
+ p = decoder->next(p);
+ return *this;
+ }
+
+ Text::Iterator Text::Iterator::operator ++(int)
+ {
+ p = decoder->next(p);
+ Iterator itor(encode, data, length);
+ itor.p = p;
+ return itor;
+ }
+
+ bool Text::Iterator::operator !=(const Iterator& itor)
+ {
+ return !(data == itor.data
+ && p == itor.p
+ && length == itor.length
+ && encode == itor.encode);
+ }
+
+ bool Text::Iterator::operator ==(const Iterator& itor)
+ {
+ return data == itor.data
+ && p == itor.p
+ && length == itor.length
+ && encode == itor.encode;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+ // text
+ /////////////////////////////////////////////////////////////////////////////
+
+ Text::Text(Encode encode, const void* data)
+ {
+ unsigned length = strlen((const char*)data);
+ Iterator end = Iterator(encode, data, length);
+ end.toEnd();
+ Iterator it = Iterator(encode, data, length);
+ for (; it != end; ++it)
+ {
+ content.push_back(*it);
+ }
+ }
+
+ Text::Text(Encode encode, const void* data, unsigned length)
+ {
+ Iterator end = Iterator(encode, data, length);
+ end.toEnd();
+ Iterator it = Iterator(encode, data, length);
+ for (; it != end; ++it)
+ {
+ content.push_back(*it);
+ }
+ }
+
+ Text::~Text()
+ {
+ }
+
+ const Content& Text::getContent() const
+ {
+ return content;
+ }
+
+ const Content& Text::operator*() const
+ {
+ return content;
+ }
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_text.h b/src/libjin/Graphics/fonts/je_text.h
new file mode 100644
index 0000000..6e6f8b0
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_text.h
@@ -0,0 +1,172 @@
+#ifndef __JE_TEXT_H__
+#define __JE_TEXT_H__
+
+#include <vector>
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ typedef unsigned int Codepoint;
+
+ typedef std::vector<Codepoint> Content;
+
+ class Text;
+
+ class Decoder;
+
+ ///
+ /// Supported text encoding.
+ ///
+ enum Encode
+ {
+ UTF8, ///< utf-8
+ ASCII, ///< ASCII
+ };
+
+ ///
+ /// Decoded text. Saved as unicode codepoints.
+ ///
+ class Text
+ {
+ public:
+ ///
+ ///
+ ///
+ Text(Encode encode, const void* data);
+
+ ///
+ ///
+ ///
+ Text(Encode encode, const void* data, unsigned int length);
+
+ ///
+ ///
+ ///
+ ~Text();
+
+ ///
+ ///
+ ///
+ const Content& getContent() const;
+
+ ///
+ ///
+ ///
+ const Content& operator*() const;
+
+ private:
+ ///
+ ///
+ ///
+ class Iterator
+ {
+ public:
+
+ ///
+ ///
+ ///
+ Iterator(const Iterator& itor);
+
+ ///
+ ///
+ ///
+ Iterator(const Encode& encode, const void* data, unsigned int length);
+
+ ///
+ ///
+ ///
+ ~Iterator();
+
+ ///
+ ///
+ ///
+ Codepoint get();
+
+ //Iterator begin();
+ //Iterator end();
+
+ ///
+ ///
+ ///
+ void toBegin();
+
+ ///
+ ///
+ ///
+ void toEnd();
+
+ ///
+ ///
+ ///
+ Codepoint operator *();
+
+ ///
+ ///
+ ///
+ Iterator& operator ++();
+
+ ///
+ ///
+ ///
+ Iterator operator ++(int);
+
+ ///
+ ///
+ ///
+ bool operator !=(const Iterator& itor);
+
+ ///
+ ///
+ ///
+ bool operator ==(const Iterator& itor);
+
+ private:
+
+ ///
+ ///
+ ///
+ void operator = (const Iterator&);
+
+ ///
+ ///
+ ///
+ const Encode encode;
+
+ ///
+ ///
+ ///
+ const Decoder* decoder;
+
+ ///
+ ///
+ ///
+ const void* p;
+
+ ///
+ ///
+ ///
+ const void* const data;
+
+ ///
+ ///
+ ///
+ unsigned int length;
+
+ };
+
+ ///
+ ///
+ ///
+ Content content;
+
+ };
+
+ }
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_texture_font.cpp b/src/libjin/Graphics/fonts/je_texture_font.cpp
new file mode 100644
index 0000000..0d9b882
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_texture_font.cpp
@@ -0,0 +1,322 @@
+#include <vector>
+
+#include "../../math/je_vector2.hpp"
+
+#include "../shaders/je_shader.h"
+
+#include "je_texture_font.h"
+
+using namespace std;
+using namespace JinEngine::Math;
+using namespace JinEngine::Graphics::Shaders;
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ TextureFont * TextureFont::createTextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh)
+ {
+ TextureFont* tf = new TextureFont(bitmap, codepoints, cellw, cellh);
+ return tf;
+ }
+
+ TextureFont * TextureFont::createTextureFont(const Bitmap* bitmap, const Text& codepoints, int cellw, int cellh)
+ {
+ TextureFont* tf = new TextureFont(bitmap, *codepoints, cellw, cellh);
+ return tf;
+ }
+
+ TextureFont* TextureFont::createTextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh)
+ {
+ TextureFont* tf = new TextureFont(bitmap, codepoints, mask, cellh);
+ return tf;
+ }
+
+ TextureFont* TextureFont::createTextureFont(const Bitmap* bitmap, const Text& codepoints, Color mask, int cellh)
+ {
+ TextureFont* tf = new TextureFont(bitmap, *codepoints, mask, cellh);
+ return tf;
+ }
+
+ TextureFont::~TextureFont()
+ {
+ }
+
+ const TextureFont::TextureGlyph* TextureFont::findGlyph(Codepoint codepoint) const
+ {
+ auto it = glyphs.find(codepoint);
+ if (it != glyphs.end())
+ {
+ return &it->second;
+ }
+ else
+ return nullptr;
+ }
+
+ Page* TextureFont::typeset(const Content& text, int lineheight, int spacing)
+ {
+ Page* page = new Page();
+ page->font = this;
+ vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
+ vector<GlyphVertex>& glyphvertices = page->glyphvertices;
+ int texture = -1;
+ const TextureGlyph* glyph = nullptr;
+ GlyphVertex vertex;
+ Vector2<int> p(0, 0);
+ int i = 0;
+
+#define glyphvertices_push(_x, _y, _u, _v) \
+ vertex.x = _x; vertex.y = _y;\
+ vertex.u = _u; vertex.v = _v;\
+ glyphvertices.push_back(vertex);\
+
+ for (Codepoint c : text)
+ {
+ // return
+ if (c == 0x0D) continue;
+ // newline
+ if (c == 0x0A)
+ {
+ p.y += lineheight;
+ p.x = 0;
+ continue;
+ }
+ if (c == 0x09)
+ {
+ // tab = 4*space
+ unsigned cw = getCharWidth(0x20);
+ p.x += cw * 4;
+ continue;
+ }
+ glyph = findGlyph(c);
+ if (glyph == nullptr) continue;
+ if (texture != getGLTexture())
+ {
+ texture = getGLTexture();
+ GlyphArrayDrawInfo info;
+ info.start = i;
+ info.count = 0;
+ info.texture = texture;
+ glyphinfolist.push_back(info);
+ }
+ glyphinfolist[glyphinfolist.size() - 1].count += 4;
+ // normalized
+ float w = getWidth(), h = getHeight();
+ float nx = glyph->x / w, ny = glyph->y / h;
+ float nw = glyph->w / w, nh = glyph->h / h;
+ glyphvertices_push(p.x, p.y, nx, ny);
+ glyphvertices_push(p.x, p.y + glyph->h, nx, ny + nh);
+ glyphvertices_push(p.x + glyph->w, p.y + glyph->h, nx + nw, ny + nh);
+ glyphvertices_push(p.x + glyph->w, p.y, nx + nw, ny);
+ p.x += glyph->w + spacing;
+ i += 4;
+ }
+ getTextBox(text, &page->size.w, &page->size.h, lineheight, spacing);
+ return page;
+ }
+
+ int TextureFont::getCharWidth(int c)
+ {
+ auto it = glyphs.find(c);
+ if (it != glyphs.end())
+ {
+ return it->second.w;
+ }
+ return 0;
+ }
+
+ int TextureFont::getCharHeight(int c)
+ {
+ auto it = glyphs.find(c);
+ if (it != glyphs.end())
+ {
+ return it->second.h;
+ }
+ return 0;
+ }
+
+ int TextureFont::getTextWidth(const Content& t, int spacing)
+ {
+ int res = 0;
+ int tmp = 0;
+ for (Codepoint c : t)
+ {
+ if (c == 0x0D)
+ continue;
+ if (c == 0x0A)
+ {
+ tmp = 0;
+ continue;
+ }
+ if (c == 0x09)
+ {
+ // tab = 4*space
+ unsigned cw = getCharWidth(0x20);
+ tmp += cw * 4;
+ if (tmp > res) res = tmp;
+ continue;
+ }
+ tmp += getCharWidth(c) + spacing;
+ if (tmp > res) res = tmp;
+ }
+ return res;
+ }
+
+ int TextureFont::getTextHeight(const Content& t, int lineheight)
+ {
+ int res = 0;
+ bool newline = true;
+ for (Codepoint c : t)
+ {
+ if (c == 0x0A)
+ newline = true;
+ else if (c == 0x0D);
+ else if (newline)
+ {
+ newline = false;
+ res += lineheight;
+ }
+ }
+ return res;
+ }
+
+ void TextureFont::getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing)
+ {
+ *w = 0;
+ *h = 0;
+ int tmp = 0;
+ bool newline = true;
+ for (Codepoint c : text)
+ {
+ if (c == 0x0D)
+ continue;
+ if (c == 0x0A)
+ {
+ tmp = 0;
+ newline = true;
+ continue;
+ }
+ else if (newline)
+ {
+ newline = false;
+ *h += lineheight;
+ }
+ tmp += getCharWidth(c) + spacing;
+ if (tmp > *w)
+ *w = tmp;
+ }
+ }
+
+ Page* TextureFont::typeset(const Text& text, int lineheight, int spacing)
+ {
+ return typeset(*text, lineheight, spacing);
+ }
+
+ void TextureFont::render(const Page* page, int x, int y)
+ {
+ Shader* shader = Shader::getCurrentShader();
+ const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
+ const vector<GlyphVertex>& glyphvertices = page->glyphvertices;
+ gl.ModelMatrix.setTransformation(x, y, 0, 1, 1, 0, 0);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
+ shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
+ for (int i = 0; i < glyphinfolist.size(); ++i)
+ {
+ const GlyphArrayDrawInfo& info = glyphinfolist[i];
+ shader->setVertexPointer(2, GL_INT, sizeof(GlyphVertex), &glyphvertices[info.start].x);
+ shader->setUVPointer(2, GL_FLOAT, sizeof(GlyphVertex), &glyphvertices[info.start].u);
+ gl.bindTexture(info.texture);
+ gl.drawArrays(GL_QUADS, 0, info.count);
+ gl.bindTexture(0);
+ }
+ }
+
+ void TextureFont::render(const Content& text, int x, int y, int lineheight, int spacing)
+ {
+ Page* page = typeset(text, lineheight, spacing);
+ render(page, x, y);
+ delete page;
+ }
+
+ void TextureFont::render(const Text& text, int x, int y, int lineheight, int spacing)
+ {
+ Page* page = typeset(text, lineheight, spacing);
+ render(page, x, y);
+ delete page;
+ }
+
+ TextureFont::TextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh)
+ : Graphic(bitmap)
+ , Font(cellh)
+ {
+ TextureGlyph glyph;
+ Vector2<int> count(bitmap->getWidth() / cellw, bitmap->getHeight() / cellh);
+ glyph.w = cellw;
+ glyph.h = cellh;
+ for (int y = 0; y < count.row; ++y)
+ {
+ glyph.y = y * cellh;
+ for (int x = 0; x < count.colum; ++x)
+ {
+ glyph.x = x * cellw;
+ if (x + y * count.colum >= codepoints.size())
+ return;
+ glyphs.insert(std::pair<Codepoint, TextureGlyph>(codepoints[x + y * count.colum], glyph));
+ }
+ }
+ }
+
+ TextureFont::TextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh)
+ : Graphic(bitmap)
+ , Font(cellh)
+ {
+ TextureGlyph glyph;
+ glyph.h = cellh;
+ int w = bitmap->getWidth();
+ int h = bitmap->getHeight();
+ int i = 0;
+ for (int y = 0; y < h; y += cellh)
+ {
+ glyph.y = y;
+ bool newc = false;
+ for (int x = 0; x <= w; ++x)
+ {
+ if (x == w && newc)
+ {
+ glyph.w = x - glyph.x;
+ if (i >= codepoints.size())
+ return;
+ glyphs.insert(std::pair<Codepoint, TextureGlyph>(codepoints[i], glyph));
+ ++i;
+ newc = false;
+ break;
+ }
+ Color c = bitmap->getPixels()[x + y * w];
+ if (!newc && c != mask)
+ {
+ glyph.x = x;
+ newc = true;
+ }
+ else if (newc && c == mask)
+ {
+ glyph.w = x - glyph.x;
+ if (i >= codepoints.size())
+ return;
+ glyphs.insert(std::pair<Codepoint, TextureGlyph>(codepoints[i], glyph));
+ if (codepoints[i] == 't')
+ {
+ int a = 10;
+ }
+ ++i;
+ newc = false;
+ }
+ }
+ }
+ }
+
+ }
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_texture_font.h b/src/libjin/Graphics/fonts/je_texture_font.h
new file mode 100644
index 0000000..8a50699
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_texture_font.h
@@ -0,0 +1,144 @@
+#ifndef __JE_TEXTURE_FONT_H__
+#define __JE_TEXTURE_FONT_H__
+
+#include <map>
+#include <vector>
+
+#include "../../math/je_vector4.hpp"
+
+#include "../je_graphic.h"
+#include "../je_bitmap.h"
+
+#include "je_page.h"
+#include "je_font.h"
+#include "je_text.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ ///
+ ///
+ ///
+ class TextureFont
+ : public Font
+ , public Graphic
+ {
+ public:
+
+ ///
+ ///
+ ///
+ static TextureFont* createTextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh);
+
+ ///
+ ///
+ ///
+ static TextureFont* createTextureFont(const Bitmap* bitmap, const Text& text, int cellw, int cellh);
+
+ ///
+ ///
+ ///
+ static TextureFont* createTextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh);
+
+ ///
+ ///
+ ///
+ static TextureFont* createTextureFont(const Bitmap* bitmap, const Text& text, Color mask, int cellh);
+
+ ///
+ ///
+ ///
+ ~TextureFont();
+
+ ///
+ ///
+ ///
+ Page* typeset(const Text& text, int lineheight, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ Page* typeset(const Content& text, int lineheight, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ void render(const Page* page, int x, int y) override;
+
+ ///
+ ///
+ ///
+ void render(const Content& text, int x, int y, int linehgiht, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ void render(const Text& text, int x, int y, int lineheight, int spacing = 0)override;
+
+ private:
+
+ ///
+ ///
+ ///
+ struct TextureGlyph
+ {
+ float x, y, w, h;
+ };
+
+ ///
+ ///
+ ///
+ TextureFont(const Bitmap* bitmap, const Content& codepoints, int cellw, int cellh);
+
+ ///
+ ///
+ ///
+ TextureFont(const Bitmap* bitmap, const Content& codepoints, Color mask, int cellh);
+
+ ///
+ ///
+ ///
+ int getCharWidth(int c);
+
+ ///
+ ///
+ ///
+ int getCharHeight(int c);
+
+ ///
+ ///
+ ///
+ int getTextWidth(const Content& text, int spacing = 0);
+
+ ///
+ ///
+ ///
+ int getTextHeight(const Content& text, int lineheight);
+
+ ///
+ ///
+ ///
+ void getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing = 0);
+
+ ///
+ ///
+ ///
+ const TextureGlyph* findGlyph(Codepoint codepoint) const;
+
+
+ ///
+ ///
+ ///
+ std::map<Codepoint, TextureGlyph> glyphs;
+
+ };
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_ttf.cpp b/src/libjin/Graphics/fonts/je_ttf.cpp
new file mode 100644
index 0000000..9994666
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_ttf.cpp
@@ -0,0 +1,468 @@
+#include "../../core/je_configuration.h"
+#if defined(jin_graphics)
+
+#include <stdio.h>
+
+#include "../../common/je_array.hpp"
+
+#include "../je_gl.h"
+#include "../je_color.h"
+#include "../shaders/je_shader.h"
+
+#include "je_ttf.h"
+#include "je_page.h"
+
+#define STB_TRUETYPE_IMPLEMENTATION
+#include "stb/stb_truetype.h"
+
+using namespace JinEngine::Graphics::Shaders;
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TTFData
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ TTFData* TTFData::createTTFData(const unsigned char* data, unsigned int size)
+ {
+ TTFData* ttf = nullptr;
+ try
+ {
+ ttf = new TTFData(data, size);
+ return ttf;
+ }
+ catch (...)
+ {
+ return nullptr;
+ }
+ }
+
+ TTFData::TTFData(const unsigned char* d, unsigned int s)
+ {
+ raw.size = s;
+ raw.data = (unsigned char*)malloc(s);
+ memcpy(raw.data, d, s);
+ if (!stbtt_InitFont(&info, (const unsigned char*)raw.data, 0))
+ {
+ delete raw.data;
+ throw 0;
+ }
+ /* push default fontsize */
+ pushTTFsize(FONT_SIZE);
+ }
+
+ TTFData::~TTFData()
+ {
+ free(raw.data);
+ }
+
+ TTF* TTFData::createTTF(unsigned fontSize)
+ {
+ TTF* ttf;
+ try
+ {
+ ttf = new TTF(this, fontSize);
+ }
+ catch (...)
+ {
+ return nullptr;
+ }
+ return ttf;
+ }
+
+ /*
+ * (0, 0)
+ * +--------------+ ascent
+ * | +--------+ |
+ * | | | |
+ * | | bitmap | |
+ * +--|--------|--+ baseline
+ * | +--------+ |
+ * +--|-----------+ decent
+ * | |
+ * leftSideBearing |
+ * advanceWidth
+ */
+ void TTFData::getVMetrics(int* baseline, int* descent)
+ {
+ float scale = scales.back();
+ int ascent;
+ stbtt_GetFontVMetrics(&info, &ascent, descent, 0);
+ *baseline = (int)(ascent*scale) + 1; // slight adjustment
+ *descent = *baseline - (int)(*descent*scale) + 1;
+ }
+
+ void TTFData::getHMetrics(unsigned int codepoint, int* advanceWidth, int* leftSideBearing)
+ {
+ float scale = scales.back();
+ int adw, lsb;
+ stbtt_GetCodepointHMetrics(&info, codepoint, &adw, &lsb);
+ *advanceWidth = (int)(adw*scale);
+ *leftSideBearing = (int)(lsb*scale);
+ }
+
+ void TTFData::pushTTFsize(unsigned int fs)
+ {
+ float sc = stbtt_ScaleForPixelHeight(&info, fs);
+ scales.push_back(sc);
+ }
+
+ void TTFData::popTTFsize()
+ {
+ /* always keep default ttf size on the bottom of stack */
+ if (scales.size() > 1)
+ scales.pop_back();
+ }
+
+ Channel* TTFData::getCodepointBitmapAlpha(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const
+ {
+ float scale = scales.back();
+ Channel* bitmap = stbtt_GetCodepointBitmap(&info, scale, scale, codepoint, width, height, xoff, yoff);
+ return bitmap;
+ }
+
+ Color* TTFData::getCodepointBitmap(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const
+ {
+ float scale = scales.back();
+ Channel* bitmap = stbtt_GetCodepointBitmap(&info, scale, scale, codepoint, width, height, xoff, yoff);
+ int w = *width, h = *height;
+ //int xo = *xoff, yo = *yoff;
+ Color* bitmap32 = new Color[w*h];
+ for (int y = 0; y < h; ++y)
+ {
+ for (int x = 0; x < w; ++x)
+ {
+ bitmap32[x + y * w].set(0xff, 0xff, 0xff, bitmap[x + y * w]);
+ }
+ }
+ free(bitmap);
+ return bitmap32;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TTF
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include "../shaders/built-in/je_font.shader.h"
+
+ using namespace std;
+ using namespace JinEngine::Math;
+
+ const int TTF::TEXTURE_WIDTHS[] = { 128, 256, 256, 512, 512, 1024, 1024 };
+ const int TTF::TEXTURE_HEIGHTS[] = { 128, 128, 256, 256, 512, 512, 1024 };
+
+ /* little endian unicode */
+ static const char* unicodeLittleEndian(const char* p, unsigned* res)
+ {
+ }
+
+ ///*static*/ TTF* TTF::createTTF(TTFData* fontData, unsigned int fontSzie)
+ //{
+ // TTF* ttf;
+ // try
+ // {
+ // ttf = new TTF(fontData, fontSzie);
+ // }
+ // catch (...)
+ // {
+ // return nullptr;
+ // }
+ // return ttf;
+ //}
+
+ TTF::TTF(TTFData* f, unsigned int fontSize)
+ : Font(fontSize)
+ , cursor(0, 0)
+ , ttf(f)
+ {
+ ttf->pushTTFsize(fontSize);
+ ttf->getVMetrics(&baseline, &descent);
+ estimateSize();
+ ttf->popTTFsize();
+ /* create a default texture */
+ createAtlas();
+ }
+
+ /* estimate the size of atlas texture */
+ void TTF::estimateSize()
+ {
+ for (int level = 0; level <= TEXTURE_SIZE_LEVEL_MAX; ++level)
+ {
+ if (descent * (descent*0.8) * 96 <= TEXTURE_WIDTHS[level] * TEXTURE_HEIGHTS[level])
+ {
+ textureWidth = TEXTURE_WIDTHS[level];
+ textureHeight = TEXTURE_HEIGHTS[level];
+ break;
+ }
+ }
+ }
+
+ TTF::~TTF()
+ {
+ }
+
+ GLuint TTF::createAtlas()
+ {
+ GLuint t;
+ gl.flushError();
+ t = gl.genTexture();
+ gl.bindTexture(t);
+ gl.setTexParameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ gl.setTexParameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gl.setTexParameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ gl.setTexParameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ gl.texImage(GL_RGBA8, textureWidth, textureHeight, GL_RGBA, GL_UNSIGNED_BYTE);
+ if (glGetError() != GL_NO_ERROR)
+ {
+ glDeleteTextures(1, &t);
+ gl.bindTexture(0);
+ return 0;
+ }
+ atlases.push_back(t);
+ gl.bindTexture(0);
+ return t;
+ }
+
+ void TTF::render(const Content& t, int x, int y, int lineheight, int spacing)
+ {
+ Page* page = typeset(t, lineheight, spacing);
+ render(page, x, y);
+ delete page;
+ }
+
+ Page* TTF::typeset(const Content& text, int lineheight, int spacing)
+ {
+ Page* page = new Page();
+ page->font = this;
+ vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
+ vector<GlyphVertex>& glyphvertices = page->glyphvertices;
+ int texture = -1;
+ TTFGlyph* glyph = nullptr;
+ GlyphVertex vertex;
+ Vector2<int> p(0, 0);
+ int i = 0;
+
+#define glyphvertices_push(_x, _y, _u, _v) \
+ vertex.x = _x; vertex.y = _y;\
+ vertex.u = _u; vertex.v = _v;\
+ glyphvertices.push_back(vertex);
+
+#define glyphlize(c)\
+ do{\
+ glyph = &findGlyph(c); \
+ if (texture != glyph->atlas) \
+ { \
+ GlyphArrayDrawInfo info; \
+ info.start = i; \
+ info.count = 0; \
+ info.texture = glyph->atlas; \
+ texture = glyph->atlas; \
+ glyphinfolist.push_back(info); \
+ } \
+ glyphinfolist[glyphinfolist.size() - 1].count += 4; \
+ TTFGlyph::Bbox& bbox = glyph->bbox; \
+ glyphvertices_push(p.x, p.y, bbox.x, bbox.y); \
+ glyphvertices_push(p.x, p.y + glyph->height, bbox.x, bbox.y + bbox.h); \
+ glyphvertices_push(p.x + glyph->width, p.y + glyph->height, bbox.x + bbox.w, bbox.y + bbox.h); \
+ glyphvertices_push(p.x + glyph->width, p.y, bbox.x + bbox.w, bbox.y); \
+ }while(0)
+
+ for (Codepoint c : text)
+ {
+ if (c == 0x0D)
+ continue;
+ if (c == 0x0A)
+ {
+ /* new line */
+ p.y += lineheight;
+ p.x = 0;
+ continue;
+ }
+ if (c == 0x09)
+ {
+ // tab = 4*space
+ unsigned cw = getCharWidth(0x20);
+ p.x += cw * 4;
+ continue;
+ }
+ glyphlize(c);
+ p.x += glyph->width + spacing;
+ i += 4;
+ }
+ getTextBox(text, &page->size.w, &page->size.h, lineheight, spacing);
+ return page;
+ }
+
+ Page* TTF::typeset(const Text& text, int lineheight, int spacing)
+ {
+ return typeset(*text, lineheight, spacing);
+ }
+
+ void TTF::render(const Page* page, int x, int y)
+ {
+ Shader* shader = Shader::getCurrentShader();
+ const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
+ const vector<GlyphVertex>& glyphvertices = page->glyphvertices;
+ gl.ModelMatrix.setTransformation(x, y, 0, 1, 1, 0, 0);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
+ shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
+ for (int i = 0; i < glyphinfolist.size(); ++i)
+ {
+ const GlyphArrayDrawInfo& info = glyphinfolist[i];
+ shader->setVertexPointer(2, GL_INT, sizeof(GlyphVertex), &glyphvertices[info.start].x);
+ shader->setUVPointer(2, GL_FLOAT, sizeof(GlyphVertex), &glyphvertices[info.start].u);
+ gl.bindTexture(info.texture);
+ gl.drawArrays(GL_QUADS, 0, info.count);
+ gl.bindTexture(0);
+ }
+ }
+
+ void TTF::render(const Text& text, int x, int y, int lineheight, int spacing /* = 0 */)
+ {
+ render(*text, x, y, lineheight, spacing);
+ }
+
+ int TTF::getCharWidth(int c)
+ {
+ int adw, lsb;
+ ttf->pushTTFsize(mFontSize);
+ ttf->getHMetrics(c, &adw, &lsb);
+ ttf->popTTFsize();
+ return adw;
+ }
+
+ int TTF::getCharHeight(int c)
+ {
+ return descent;
+ }
+
+ int TTF::getTextWidth(const Content& t, int spacing)
+ {
+ ttf->pushTTFsize(mFontSize);
+ int res = 0;
+ int tmp = 0;
+ for (Codepoint c : t)
+ {
+ if (c == 0x0D)
+ continue;
+ if (c == 0x0A)
+ {
+ tmp = 0;
+ continue;
+ }
+ tmp += getCharWidth(c) + spacing;
+ if (tmp > res)
+ res = tmp;
+ }
+ ttf->popTTFsize();
+ return res;
+ }
+
+ int TTF::getTextHeight(const Content& t, int lineheight)
+ {
+ ttf->pushTTFsize(mFontSize);
+ int res = 0;
+ bool newline = true;
+ for (Codepoint c : t)
+ {
+ if (c == 0x0A)
+ newline = true;
+ else if (c == 0x0D);
+ else if (newline)
+ {
+ newline = false;
+ res += lineheight;
+ }
+ }
+ ttf->popTTFsize();
+ return res;
+ }
+
+ void TTF::getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing)
+ {
+ ttf->pushTTFsize(mFontSize);
+ *w = 0;
+ *h = 0;
+ int tmp = 0;
+ bool newline = true;
+ for (Codepoint c : text)
+ {
+ if (c == 0x0D)
+ continue;
+ if (c == 0x0A)
+ {
+ tmp = 0;
+ newline = true;
+ continue;
+ }
+ else if (newline)
+ {
+ newline = false;
+ *h += lineheight;
+ }
+ tmp += getCharWidth(c) + spacing;
+ if (tmp > *w)
+ *w = tmp;
+ }
+ ttf->popTTFsize();
+ }
+
+ TTF::TTFGlyph& TTF::bakeGlyph(unsigned int character)
+ {
+ int w, h, xoff, yoff;
+ ttf->pushTTFsize(mFontSize);
+ GLuint atlas = atlases.back();
+ const Color* bitmap = ttf->getCodepointBitmap(character, &w, &h, &xoff, &yoff);
+ int adw, lsb;
+ {
+ /* bake glyph */
+ ttf->getHMetrics(character, &adw, &lsb);
+ ttf->popTTFsize();
+ if (cursor.x + adw > textureWidth)
+ {
+ cursor.x = 0;
+ cursor.y += descent;
+ if (cursor.y + descent * 2 > textureHeight)
+ {
+ /* create new atlas */
+ atlas = createAtlas();
+ cursor.y = 0;
+ }
+ }
+ gl.bindTexture(atlas);
+ gl.texSubImage(cursor.x + xoff, cursor.y + yoff + baseline, w, h, GL_RGBA, GL_UNSIGNED_BYTE, bitmap);
+ gl.bindTexture();
+ delete[] bitmap;
+ }
+ TTFGlyph glyph;
+ glyph.atlas = atlas;
+ glyph.bbox.x = cursor.x / (float)textureWidth;
+ glyph.bbox.y = cursor.y / (float)textureHeight;
+ glyph.bbox.w = adw / (float)textureWidth;
+ glyph.bbox.h = descent / (float)textureHeight;
+ glyph.width = adw;
+ glyph.height = descent;
+ glyphs.insert(std::pair<unsigned int, TTFGlyph>(character, glyph));
+ cursor.x += adw;
+ return glyphs[character];
+ }
+
+ TTF::TTFGlyph& TTF::findGlyph(unsigned int character)
+ {
+ map<unsigned int, TTFGlyph>::iterator it = glyphs.find(character);
+ if (it != glyphs.end())
+ return it->second;
+ else
+ return bakeGlyph(character);
+ }
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // defined(jin_graphics) \ No newline at end of file
diff --git a/src/libjin/Graphics/fonts/je_ttf.h b/src/libjin/Graphics/fonts/je_ttf.h
new file mode 100644
index 0000000..28260f6
--- /dev/null
+++ b/src/libjin/Graphics/fonts/je_ttf.h
@@ -0,0 +1,292 @@
+#ifndef __JE_TTF_H__
+#define __JE_TTF_H__
+#include "../../core/je_configuration.h"
+#if defined(jin_graphics)
+
+#include <vector>
+#include <map>
+
+#include "stb/stb_truetype.h"
+
+#include "../../math/je_quad.h"
+
+#include "../je_color.h"
+#include "../je_graphic.h"
+
+#include "je_page.h"
+#include "je_font.h"
+#include "je_text.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Fonts
+ {
+
+ class TTF;
+
+ //
+ // TTFData
+ // |- TTF(14px)
+ // |- TTF(15px)
+ // .
+ // .
+ // .
+ //
+ class TTFData
+ {
+ public:
+
+ ///
+ ///
+ ///
+ static TTFData* createTTFData(const unsigned char* data, unsigned int size);
+
+ ///
+ ///
+ ///
+ ~TTFData();
+
+ ///
+ ///
+ ///
+ TTF* createTTF(unsigned ttfsize);
+
+ ///
+ ///
+ ///
+ void pushTTFsize(unsigned ttfsize);
+
+ ///
+ ///
+ ///
+ void popTTFsize();
+
+ ///
+ ///
+ ///
+ Channel* getCodepointBitmapAlpha(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const;
+
+ ///
+ ///
+ ///
+ Color* getCodepointBitmap(unsigned int codepoint, int* width, int* height, int* xoff, int* yoff) const;
+
+ ///
+ ///
+ ///
+ void getVMetrics(int* baseline, int* descent);
+
+ ///
+ ///
+ ///
+ void getHMetrics(unsigned int codepoint, int* advanceWidth, int* leftSideBearing);
+
+ private:
+
+ ///
+ ///
+ ///
+ static const unsigned int FONT_SIZE = 12;
+
+ ///
+ ///
+ ///
+ TTFData(const unsigned char* data, unsigned int size);
+
+ ///
+ ///
+ ///
+ stbtt_fontinfo info;
+
+ ///
+ ///
+ ///
+ struct
+ {
+ unsigned char* data;
+ unsigned int size;
+ } raw;
+
+ ///
+ ///
+ ///
+ std::vector<float> scales;
+
+ };
+
+ class TTF : public Font
+ {
+ public:
+ //static TTF* createTTF(TTFData* ttfData, unsigned ttfSzie);
+
+ ///
+ ///
+ ///
+ Page* typeset(const Text& text, int lineheight, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ Page* typeset(const Content& text, int lineheight, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ void render(const Text& text, int x, int y, int lineheight, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ void render(const Content& text, int x, int y, int lineheight, int spacing = 0) override;
+
+ ///
+ ///
+ ///
+ void render(const Page* page, int x, int y) override;
+
+ ///
+ ///
+ ///
+ ~TTF();
+
+ private:
+
+ friend class TTFData;
+
+ ///
+ ///
+ ///
+ struct TTFGlyph
+ {
+ GLuint atlas;
+ // normalized coordinates
+ struct Bbox
+ {
+ float x, y;
+ float w, h;
+ } bbox;
+ // glyph size in pixel
+ unsigned int width, height;
+ };
+
+ ///
+ ///
+ ///
+ static const int TEXTURE_SIZE_LEVELS_COUNT = 7;
+
+ ///
+ ///
+ ///
+ static const int TEXTURE_SIZE_LEVEL_MAX = TEXTURE_SIZE_LEVELS_COUNT - 1;
+
+ ///
+ ///
+ ///
+ static const int TEXTURE_WIDTHS[TEXTURE_SIZE_LEVELS_COUNT];
+
+ ///
+ ///
+ ///
+ static const int TEXTURE_HEIGHTS[TEXTURE_SIZE_LEVELS_COUNT];
+
+ ///
+ ///
+ ///
+ TTF(TTFData* ttf, Codepoint ttfSize);
+
+ ///
+ ///
+ ///
+ void estimateSize();
+
+ ///
+ ///
+ ///
+ GLuint createAtlas();
+
+ ///
+ ///
+ ///
+ TTFGlyph& bakeGlyph(Codepoint character);
+
+ ///
+ ///
+ ///
+ TTFGlyph& findGlyph(Codepoint character);
+
+ ///
+ ///
+ ///
+ int getCharWidth(int c);
+
+ ///
+ ///
+ ///
+ int getCharHeight(int c);
+
+ ///
+ ///
+ ///
+ int getTextWidth(const Content& text, int spacing = 0);
+
+ ///
+ ///
+ ///
+ int getTextHeight(const Content& text, int lineheight);
+
+ ///
+ ///
+ ///
+ void getTextBox(const Content& text, int* w, int* h, int lineheight, int spacing = 0);
+
+ ///
+ ///
+ ///
+ int textureWidth;
+
+ ///
+ ///
+ ///
+ int textureHeight;
+
+ ///
+ ///
+ ///
+ std::vector<GLuint> atlases;
+
+ ///
+ ///
+ ///
+ std::map<Codepoint, TTFGlyph> glyphs;
+
+ ///
+ ///
+ ///
+ TTFData* ttf;
+
+ ///
+ ///
+ ///
+ int baseline;
+
+ ///
+ ///
+ ///
+ int descent;
+
+ ///
+ ///
+ ///
+ Math::Vector2<float> cursor;
+
+ };
+
+ } // namespace Fonts
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // defined(jin_graphics)
+
+#endif // __JE_FONT_H__
diff --git a/src/libjin/Graphics/je_bitmap.cpp b/src/libjin/Graphics/je_bitmap.cpp
index 0747f0b..cdab46d 100644
--- a/src/libjin/Graphics/je_bitmap.cpp
+++ b/src/libjin/Graphics/je_bitmap.cpp
@@ -1,6 +1,7 @@
#define STB_IMAGE_IMPLEMENTATION
-#include "../3rdparty/stb/stb_image.h"
+#include "stb/stb_image.h"
+#include "../common/je_exception.h"
#include "../filesystem/je_asset_database.h"
#include "../math/je_math.h"
@@ -22,7 +23,6 @@ namespace JinEngine
return createBitmap(&buffer, buffer.size());
}
- /* pixelbitmap */
Bitmap* Bitmap::createBitmap(const void* pixel, unsigned width, unsigned height)
{
Bitmap* bitmap = new Bitmap(width, height);
@@ -36,8 +36,11 @@ namespace JinEngine
return nullptr;
int w, h;
void* data = stbi_load_from_memory((unsigned char *)imgData, size, &w, &h, NULL, STBI_rgb_alpha);
- if (data == nullptr)
- return nullptr;
+ if (data == nullptr)
+ {
+ throw Exception("Could not create bitmap from image data.");
+ return nullptr;
+ }
Bitmap* bitmap = new Bitmap();
bitmap->pixels = (Color*)data;
bitmap->width = w;
@@ -53,6 +56,20 @@ namespace JinEngine
return bitmap;
}
+ /*static*/ Bitmap* Bitmap::createBitmap(int width, int height, std::function<Color(int, int, int, int)> drawer)
+ {
+ Bitmap* bitmap = new Bitmap(width, height);
+ for (int y = 0; y < height; ++y)
+ {
+ for (int x = 0; x < width; ++x)
+ {
+ Color c = drawer(width, height, x, y);
+ bitmap->setPixel(c, x, y);
+ }
+ }
+ return bitmap;
+ }
+
/*static */ Bitmap* Bitmap::clone(const Bitmap* bitmap)
{
Bitmap* b = new Bitmap();
@@ -74,6 +91,8 @@ namespace JinEngine
width = w;
height = h;
pixels = new Color[w*h];
+ if (pixels == nullptr)
+ throw Exception("No enough memory.");
}
Bitmap::~Bitmap()
@@ -95,6 +114,8 @@ namespace JinEngine
if (pixels != nullptr)
delete[] pixels;
pixels = new Color[w*h];
+ if (pixels == nullptr)
+ throw Exception("Not enough memory.");
size_t s = w * h * sizeof(Color);
memcpy(pixels, p, s);
width = w;
@@ -103,10 +124,12 @@ namespace JinEngine
void Bitmap::setPixel(const Color& c, int x, int y)
{
- if (pixels == nullptr)
- return;
+ if (pixels == nullptr)
+ throw Exception("Bitmap don't have pixel space.");
if (without<int>(x, 0, width - 1) || without<int>(y, 0, height - 1))
return;
+ if (x + y * width >= width * height)
+ throw Exception("Pixel <%d, %d> of bitmap is out of range.", x, y);
pixels[x + y * width] = c;
}
@@ -115,7 +138,8 @@ namespace JinEngine
if (pixels != nullptr)
delete[] pixels;
pixels = new Color[w*h];
- size_t s = w * h * sizeof(Color);
+ if (pixels == nullptr)
+ throw Exception("Not enough memory.");
width = w;
height = h;
for (int x = 0; x < w; ++x)
@@ -127,8 +151,10 @@ namespace JinEngine
}
}
- void Bitmap::setPixels(Color* p)
+ void Bitmap::setPixels(Color* p, int count)
{
+ if (count > width * height)
+ throw Exception("Pixels are out of range.");
size_t s = width * height * sizeof(Color);
memcpy(pixels, p, s);
}
diff --git a/src/libjin/Graphics/je_bitmap.h b/src/libjin/Graphics/je_bitmap.h
index ae97d0d..5ab11ca 100644
--- a/src/libjin/Graphics/je_bitmap.h
+++ b/src/libjin/Graphics/je_bitmap.h
@@ -1,9 +1,12 @@
-#ifndef __JE_BITMAP_H
-#define __JE_BITMAP_H
+#ifndef __JE_BITMAP_H__
+#define __JE_BITMAP_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
-#include "../3rdparty/GLee/GLee.h"
+#include <functional>
+
+#include "GLee/GLee.h"
+
#include "../common/je_types.h"
#include "../math/je_vector2.hpp"
@@ -17,7 +20,9 @@ namespace JinEngine
///
/// A RGBA32 bitmap.
///
- /// A bitmap keeps pixels and can't draw directly onto screen. To render bitmap, a texture is required.
+ /// A bitmap keeps pixels and can't draw directly onto screen. To render bitmap, a texture is required. A
+ /// texture is a renderable hard ware side structure which could be handled with GPU. For instance, opengl
+ /// create texture and store it in GPU memory for rendering them onto hdc.
///
class Bitmap
{
@@ -59,6 +64,11 @@ namespace JinEngine
///
static Bitmap* createBitmap(int width, int height, Color color = Color::BLACK);
+ ///
+ /// Create bitmap and set bitmap pixels with given drawer.
+ ///
+ static Bitmap* createBitmap(int width, int height, std::function<Color(int, int, int, int)> drawer);
+
///
/// Create bitmap with another one.
///
@@ -119,8 +129,9 @@ namespace JinEngine
/// Set pixels with given color data.
///
/// @param colors New pixels' colors.
+ /// @param count Number of pixels.
///
- void setPixels(Color* colors);
+ void setPixels(Color* colors, int count);
///
/// Get pixel in given position.
diff --git a/src/libjin/Graphics/je_canvas.cpp b/src/libjin/Graphics/je_canvas.cpp
index 7e0858b..7c8e849 100644
--- a/src/libjin/Graphics/je_canvas.cpp
+++ b/src/libjin/Graphics/je_canvas.cpp
@@ -18,10 +18,10 @@ namespace JinEngine
return new Canvas(w, h);
}
- Canvas::Canvas(GLuint n)
- : fbo(n)
- {
- }
+ Canvas::Canvas(GLuint n)
+ : fbo(n)
+ {
+ }
Canvas::Canvas(int w, int h)
: Graphic(w, h)
@@ -33,14 +33,13 @@ namespace JinEngine
fbo = gl.genFrameBuffer();
gl.bindFrameBuffer(fbo);
- // Generate texture save target
- mTexture = gl.genTexture();
- gl.bindTexture(mTexture);
+ GLuint texture = getGLTexture();
+ gl.bindTexture(texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl.texImage(GL_RGBA8, w, h, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
gl.bindTexture(0);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
diff --git a/src/libjin/Graphics/je_canvas.h b/src/libjin/Graphics/je_canvas.h
index f39b0de..3964517 100644
--- a/src/libjin/Graphics/je_canvas.h
+++ b/src/libjin/Graphics/je_canvas.h
@@ -1,5 +1,5 @@
-#ifndef __JE_CANVAS_H
-#define __JE_CANVAS_H
+#ifndef __JE_CANVAS_H__
+#define __JE_CANVAS_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
@@ -14,7 +14,8 @@ namespace JinEngine
///
/// A canvas is a rendering target.
///
- class Canvas: public Graphic
+ class Canvas
+ : public Graphic
{
public:
///
@@ -65,4 +66,4 @@ namespace JinEngine
#endif // defined(jin_graphics)
-#endif // __JE_CANVAS_H \ No newline at end of file
+#endif // __JE_CANVAS_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_color.cpp b/src/libjin/Graphics/je_color.cpp
index da48162..c939a1d 100644
--- a/src/libjin/Graphics/je_color.cpp
+++ b/src/libjin/Graphics/je_color.cpp
@@ -13,5 +13,10 @@ namespace JinEngine
const Color Color::MAGENTA = Color(255, 0, 255);
const Color Color::YELLOW = Color(255, 255, 0);
+ const uint32 Color::RMASK = 0x000000ff;
+ const uint32 Color::GMASK = 0x0000ff00;
+ const uint32 Color::BMASK = 0x00ff0000;
+ const uint32 Color::AMASK = 0xff000000;
+
}
} \ No newline at end of file
diff --git a/src/libjin/Graphics/je_color.h b/src/libjin/Graphics/je_color.h
index 8fe7691..06b8f61 100644
--- a/src/libjin/Graphics/je_color.h
+++ b/src/libjin/Graphics/je_color.h
@@ -1,11 +1,13 @@
/**
* Some color operating here.
*/
-#ifndef __JE_COLOR_H
-#define __JE_COLOR_H
+#ifndef __JE_COLOR_H__
+#define __JE_COLOR_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
+#include "../math/je_math.h"
+
#include "../common/je_types.h"
#include "../utils/je_endian.h"
@@ -28,6 +30,30 @@ namespace JinEngine
static const Color MAGENTA;
static const Color YELLOW;
+ static const uint32 RMASK;
+ static const uint32 GMASK;
+ static const uint32 BMASK;
+ static const uint32 AMASK;
+
+ ///
+ /// Get lerp color with given factor.
+ ///
+ /// @param start Start color.
+ /// @param end End color.
+ /// @param t Factor of interplation.
+ /// @return Color after interplation.
+ ///
+ static Color lerp(Color start, Color end, float t)
+ {
+ t = Math::clamp<float>(t, 0, 1);
+ Color c;
+ c.r = Math::lerp(start.r, end.r, t);
+ c.g = Math::lerp(start.g, end.g, t);
+ c.b = Math::lerp(start.b, end.b, t);
+ c.a = Math::lerp(start.a, end.a, t);
+ return c;
+ }
+
///
///
///
@@ -90,4 +116,4 @@ namespace JinEngine
#endif // jin_graphics
-#endif // __JE_COLOR_H \ No newline at end of file
+#endif // __JE_COLOR_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_gl.cpp b/src/libjin/Graphics/je_gl.cpp
index 9ef1460..3f19d36 100644
--- a/src/libjin/Graphics/je_gl.cpp
+++ b/src/libjin/Graphics/je_gl.cpp
@@ -1,5 +1,8 @@
#define OGL2D_IMPLEMENT
#include "je_gl.h"
+#include "je_color.h"
+
+using namespace JinEngine::Math;
namespace JinEngine
{
@@ -8,5 +11,82 @@ namespace JinEngine
OpenGL gl;
+ OpenGL::OpenGL()
+ : ogl2d::OpenGL()
+ {
+ mMatrices.push_back(Matrix());
+ calcMatrix();
+ }
+
+ void OpenGL::setColor(Channel r, Channel g, Channel b, Channel a)
+ {
+ setColor(Color(r, g, b, a));
+ }
+
+ void OpenGL::setColor(Color c)
+ {
+ mCurrentColor = c;
+ glColor4f(c.r / 255.f, c.g / 255.f, c.b / 255.f, c.a / 255.f);
+ }
+
+ Color OpenGL::getColor()
+ {
+ return mCurrentColor;
+ }
+
+ void OpenGL::clearMatrix()
+ {
+ mMatrices.clear();
+ mMatrices.push_back(Matrix());
+ mMatrix.setIdentity();
+ }
+
+ void OpenGL::push()
+ {
+ mMatrices.push_back(Matrix());
+ }
+
+ void OpenGL::pop()
+ {
+ if (mMatrices.size() == 1)
+ return;
+ mMatrices.pop_back();
+ calcMatrix();
+ }
+
+ void OpenGL::calcMatrix()
+ {
+ mMatrix.setIdentity();
+ for (Matrix& m : mMatrices)
+ mMatrix *= m;
+ }
+
+ void OpenGL::translate(float x, float y)
+ {
+ if (mMatrices.size() == 1)
+ return;
+ Matrix& m = mMatrices.back();
+ m.translate(x, y);
+ mMatrix.translate(x, y);
+ }
+
+ void OpenGL::scale(float sx, float sy)
+ {
+ if (mMatrices.size() == 1)
+ return;
+ Matrix& m = mMatrices.back();
+ m.scale(sx, sy);
+ mMatrix.scale(sx, sy);
+ }
+
+ void OpenGL::rotate(float r)
+ {
+ if (mMatrices.size() == 1)
+ return;
+ Matrix& m = mMatrices.back();
+ m.rotate(r);
+ mMatrix.rotate(r);
+ }
+
} // namespace Graphics
} // namespace JinEngine
diff --git a/src/libjin/Graphics/je_gl.h b/src/libjin/Graphics/je_gl.h
index cda8bf9..1dddab3 100644
--- a/src/libjin/Graphics/je_gl.h
+++ b/src/libjin/Graphics/je_gl.h
@@ -1,10 +1,14 @@
-#ifndef __JE_OPENGL_H
-#define __JE_OPENGL_H
+#ifndef __JE_OPENGL_H__
+#define __JE_OPENGL_H__
+
+#include <vector>
-#include "../3rdparty/GLee/GLee.h"
-#include "../3rdparty/ogl/OpenGL.h"
#include "../math/je_matrix.h"
+#include "je_color.h"
+#include "GLee/GLee.h"
+#include "ogl/OpenGL.h"
+
namespace JinEngine
{
namespace Graphics
@@ -26,9 +30,35 @@ namespace JinEngine
///
///
///
- OpenGL() : ogl2d::OpenGL()
- {
- }
+ OpenGL();
+
+ void setColor(Channel r, Channel g, Channel b, Channel a);
+
+ void setColor(Color c);
+
+ Color getColor();
+
+ void clearMatrix();
+
+ void push();
+
+ void pop();
+
+ void translate(float x, float y);
+
+ void scale(float sx, float sy);
+
+ void rotate(float r);
+
+ const Math::Matrix& getMatrix() { return mMatrix; };
+
+ private:
+
+ void calcMatrix();
+
+ Color mCurrentColor;
+ std::vector<Math::Matrix> mMatrices;
+ Math::Matrix mMatrix;
};
@@ -37,4 +67,4 @@ namespace JinEngine
} // namespace Graphics
} // namespace JinEngine
-#endif // __JE_OPENGL_H \ No newline at end of file
+#endif // __JE_OPENGL_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_graphic.cpp b/src/libjin/Graphics/je_graphic.cpp
index 831e409..6f3ff58 100644
--- a/src/libjin/Graphics/je_graphic.cpp
+++ b/src/libjin/Graphics/je_graphic.cpp
@@ -5,9 +5,11 @@
#include "../math/je_matrix.h"
-#include "shader/je_shader.h"
+#include "shaders/je_shader.h"
#include "je_graphic.h"
+using namespace JinEngine::Graphics::Shaders;
+
namespace JinEngine
{
namespace Graphics
@@ -17,32 +19,14 @@ namespace JinEngine
: mTexture(0)
, mSize(w, h)
{
- mVertexCoords[0] = 0; mVertexCoords[1] = 0;
- mVertexCoords[2] = 0; mVertexCoords[3] = h;
- mVertexCoords[4] = w; mVertexCoords[5] = h;
- mVertexCoords[6] = w; mVertexCoords[7] = 0;
-
- mTextureCoords[0] = 0; mTextureCoords[1] = 0;
- mTextureCoords[2] = 0; mTextureCoords[3] = 1;
- mTextureCoords[4] = 1; mTextureCoords[5] = 1;
- mTextureCoords[6] = 1; mTextureCoords[7] = 0;
+ mTexture = gl.genTexture();
}
Graphic::Graphic(const Bitmap* bitmap)
: mTexture(0)
{
- uint32 w = mSize.w = bitmap->getWidth();
- uint32 h = mSize.h = bitmap->getHeight();
-
- mVertexCoords[0] = 0; mVertexCoords[1] = 0;
- mVertexCoords[2] = 0; mVertexCoords[3] = h;
- mVertexCoords[4] = w; mVertexCoords[5] = h;
- mVertexCoords[6] = w; mVertexCoords[7] = 0;
-
- mTextureCoords[0] = 0; mTextureCoords[1] = 0;
- mTextureCoords[2] = 0; mTextureCoords[3] = 1;
- mTextureCoords[4] = 1; mTextureCoords[5] = 1;
- mTextureCoords[6] = 1; mTextureCoords[7] = 0;
+ mSize.w = bitmap->getWidth();
+ mSize.h = bitmap->getHeight();
const Color* pixels = bitmap->getPixels();
@@ -50,7 +34,7 @@ namespace JinEngine
gl.bindTexture(mTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- gl.texImage(GL_RGBA8, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ gl.texImage(GL_RGBA8, mSize.w, mSize.h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
gl.bindTexture(0);
}
@@ -59,49 +43,63 @@ namespace JinEngine
glDeleteTextures(1, &mTexture);
}
- void Graphic::draw(int x, int y, float sx, float sy, float r, float ox, float oy)
+ void Graphic::render(int x, int y, float sx, float sy, float r, float ox, float oy) const
{
gl.ModelMatrix.setTransformation(x, y, r, sx, sy, ox, oy);
+ int w = getWidth(), h = getHeight();
+ static float vertexCoords[8];
+ static float textureCoords[8];
+ // Set vertex coordinates.
+ vertexCoords[0] = 0; vertexCoords[1] = 0;
+ vertexCoords[2] = 0; vertexCoords[3] = h;
+ vertexCoords[4] = w; vertexCoords[5] = h;
+ vertexCoords[6] = w; vertexCoords[7] = 0;
+ // Set texture coordinates.
+ textureCoords[0] = 0; textureCoords[1] = 0;
+ textureCoords[2] = 0; textureCoords[3] = 1;
+ textureCoords[4] = 1; textureCoords[5] = 1;
+ textureCoords[6] = 1; textureCoords[7] = 0;
+ // Set shader.
+ Shader* shader = Shader::getCurrentShader();
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
+ shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
+ shader->setVertexPointer(2, GL_FLOAT, 0, vertexCoords);
+ shader->setUVPointer(2, GL_FLOAT, 0, textureCoords);
- Shader* shader = Shader::getCurrentShader();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
- shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
- shader->bindVertexPointer(2, GL_FLOAT, 0, mVertexCoords);
- shader->bindUVPointer(2, GL_FLOAT, 0, mTextureCoords);
-
- gl.bindTexture(mTexture);
+ gl.bindTexture(getGLTexture());
gl.drawArrays(GL_QUADS, 0, 4);
gl.bindTexture(0);
}
-
- void Graphic::draw(const Math::Quad& slice, int x, int y, float sx, float sy, float r, float ax, float ay)
+
+ void Graphic::render(const Math::Quad& slice, int x, int y, float sx, float sy, float r, float ax, float ay) const
{
- float vertCoords[8] = {
- 0, 0,
- 0, slice.h,
- slice.w, slice.h,
- slice.w, 0
- };
+ static float vertexCoords[8];
+ static float textureCoords[8];
+
+ // Set vertex coordinates.
+ vertexCoords[0] = 0; vertexCoords[1] = 0;
+ vertexCoords[2] = 0; vertexCoords[3] = slice.h;
+ vertexCoords[4] = slice.w; vertexCoords[5] = slice.h;
+ vertexCoords[6] = slice.w; vertexCoords[7] = 0;
+ // Set texture coordinates.
float slx = slice.x / mSize.w;
float sly = slice.y / mSize.h;
float slw = slice.w / mSize.w;
float slh = slice.h / mSize.h;
- float texCoords[8] = {
- slx, sly,
- slx, sly + slh,
- slx + slw, sly + slh,
- slx + slw, sly
- };
+ textureCoords[0] = slx; textureCoords[1] = sly;
+ textureCoords[2] = slx; textureCoords[3] = sly + slh;
+ textureCoords[4] = slx + slw; textureCoords[5] = sly + slh;
+ textureCoords[6] = slx + slw; textureCoords[7] = sly;
gl.ModelMatrix.setTransformation(x, y, r, sx, sy, ax, ay);
Shader* shader = Shader::getCurrentShader();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
- shader->bindVertexPointer(2, GL_FLOAT, 0, vertCoords);
- shader->bindUVPointer(2, GL_FLOAT, 0, texCoords);
+ shader->setVertexPointer(2, GL_FLOAT, 0, vertexCoords);
+ shader->setUVPointer(2, GL_FLOAT, 0, textureCoords);
- gl.bindTexture(mTexture);
+ gl.bindTexture(getGLTexture());
gl.drawArrays(GL_QUADS, 0, 4);
gl.bindTexture(0);
}
diff --git a/src/libjin/Graphics/je_graphic.h b/src/libjin/Graphics/je_graphic.h
index fb6b19e..91c8b44 100644
--- a/src/libjin/Graphics/je_graphic.h
+++ b/src/libjin/Graphics/je_graphic.h
@@ -1,5 +1,5 @@
-#ifndef __JE_GRAPHIC_H
-#define __JE_GRAPHIC_H
+#ifndef __JE_GRAPHIC_H__
+#define __JE_GRAPHIC_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
@@ -14,21 +14,14 @@ namespace JinEngine
namespace Graphics
{
- //
- // Graphic
- // |-Texture
- // |-Canvas
- //
-
///
- /// Class inherites Graphic doesn't keep any state such as origin, scale and other
- /// properties.
+ /// Class inherites Graphic doesn't keep any state such as origin, scale and other properties.
///
class Graphic
{
public:
///
- ///
+ ///
///
Graphic(int w = 0, int h = 0);
@@ -45,16 +38,6 @@ namespace JinEngine
///
///
///
- void draw(int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0);
-
- ///
- ///
- ///
- void draw(const Math::Quad& slice, int x, int y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0);
-
- ///
- ///
- ///
inline int getWidth() const { return mSize.w; }
///
@@ -63,24 +46,33 @@ namespace JinEngine
inline int getHeight() const { return mSize.h; }
///
- ///
+ /// Get opengl texture token.
+ ///
+ /// @return OpenGL texture token.
///
- inline GLuint getTexture() const { return mTexture; }
+ inline GLuint getGLTexture() const { return mTexture; }
///
///
///
void setFilter(GLint min, GLint max);
+ ///
+ /// Render graphic single with given coordinates.
+ ///
+ void render(int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0) const;
+
+ ///
+ /// Render part of graphic single with given coordinates.
+ ///
+ void render(const Math::Quad& slice, int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0) const;
+
protected:
- GLuint mTexture;
+ Math::Vector2<uint> mSize;
private:
- JinEngine::Math::Vector2<uint> mSize;
- // Screen coordinates and uv coordinates.
- float mVertexCoords[8];
- float mTextureCoords[8];
-
+ GLuint mTexture;
+
};
} // namespace Graphics
@@ -88,4 +80,4 @@ namespace JinEngine
#endif // defined(jin_graphics)
-#endif // __JE_GRAPHIC_H \ No newline at end of file
+#endif // __JE_GRAPHIC_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_graphics.h b/src/libjin/Graphics/je_graphics.h
index 2ba003d..979d8f4 100644
--- a/src/libjin/Graphics/je_graphics.h
+++ b/src/libjin/Graphics/je_graphics.h
@@ -1,5 +1,5 @@
-#ifndef __JE_GRAPHICS_H
-#define __JE_GRAPHICS_H
+#ifndef __JE_GRAPHICS_H__
+#define __JE_GRAPHICS_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
@@ -10,12 +10,28 @@
#include "je_window.h"
#include "je_bitmap.h"
#include "je_image.h"
+#include "je_sprite.h"
+#include "je_sprite_sheet.h"
-#include "shader/je_shader.h"
+#include "shaders/je_shader.h"
-#include "font/je_ttf.h"
-#include "font/je_text.h"
-#include "font/je_texture_font.h"
+#include "fonts/je_ttf.h"
+#include "fonts/je_text.h"
+#include "fonts/je_texture_font.h"
+
+#include "particles/je_particle_system.h"
+
+//struct Stats
+//{
+// int drawCalls;
+// int drawCallsBatched;
+// int canvasSwitches;
+// int shaderSwitches;
+// int canvases;
+// int images;
+// int fonts;
+// int64 textureMemory;
+//};
#endif // defined(jin_graphics)
-#endif // __JE_GRAPHICS_H \ No newline at end of file
+#endif // __JE_GRAPHICS_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_image.cpp b/src/libjin/Graphics/je_image.cpp
index f800423..6baf16d 100644
--- a/src/libjin/Graphics/je_image.cpp
+++ b/src/libjin/Graphics/je_image.cpp
@@ -1,6 +1,7 @@
-#include "../3rdparty/stb/stb_image.h"
#include "../filesystem/je_asset_database.h"
+#include "stb/stb_image.h"
+
#include "je_image.h"
namespace JinEngine
diff --git a/src/libjin/Graphics/je_image.h b/src/libjin/Graphics/je_image.h
index 04ee4d2..971ac18 100644
--- a/src/libjin/Graphics/je_image.h
+++ b/src/libjin/Graphics/je_image.h
@@ -1,5 +1,5 @@
-#ifndef __JE_IMAGE_H
-#define __JE_IMAGE_H
+#ifndef __JE_IMAGE_H__
+#define __JE_IMAGE_H__
#include "je_bitmap.h"
@@ -13,7 +13,8 @@ namespace JinEngine
///
/// Just like bitmap but only from image file. The pixels data is readonly.
///
- class Image : public Bitmap
+ class Image
+ : public Bitmap
{
public:
///
diff --git a/src/libjin/Graphics/je_mesh.h b/src/libjin/Graphics/je_mesh.h
index ed22d91..e0a38f8 100644
--- a/src/libjin/Graphics/je_mesh.h
+++ b/src/libjin/Graphics/je_mesh.h
@@ -1,5 +1,7 @@
-#ifndef __JE_MESH_H
-#define __JE_MESH_H
+#ifndef __JE_MESH_H__
+#define __JE_MESH_H__
+
+#include "je_graphic.h"
namespace JinEngine
{
@@ -7,14 +9,16 @@ namespace JinEngine
{
///
- ///
+ /// A 2D mesh.
///
class Mesh
{
public:
+ void setGraphic();
+
private:
-
+ const Graphic* mGraphic;
};
diff --git a/src/libjin/Graphics/je_shapes.cpp b/src/libjin/Graphics/je_shapes.cpp
index 3146f31..486c506 100644
--- a/src/libjin/Graphics/je_shapes.cpp
+++ b/src/libjin/Graphics/je_shapes.cpp
@@ -6,9 +6,11 @@
#include "../math/je_matrix.h"
#include "../math/je_constant.h"
-#include "shader/je_shader.h"
+#include "shaders/je_shader.h"
#include "je_shapes.h"
+using namespace JinEngine::Graphics::Shaders;
+
namespace JinEngine
{
namespace Graphics
@@ -21,9 +23,9 @@ namespace JinEngine
float verts[] = { x + 0.5f , y + 0.5f };
Shader* shader = Shader::getCurrentShader();
- shader->bindVertexPointer(2, GL_FLOAT, 0, verts);
+ shader->setVertexPointer(2, GL_FLOAT, 0, verts);
gl.ModelMatrix.setIdentity();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
glDrawArrays(GL_POINTS, 0, 1);
@@ -32,9 +34,9 @@ namespace JinEngine
void points(int n, GLshort* p)
{
Shader* shader = Shader::getCurrentShader();
- shader->bindVertexPointer(2, GL_SHORT, 0, p);
+ shader->setVertexPointer(2, GL_SHORT, 0, p);
gl.ModelMatrix.setIdentity();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
glDrawArrays(GL_POINTS, 0, n);
@@ -43,14 +45,14 @@ namespace JinEngine
void line(int x1, int y1, int x2, int y2)
{
float verts[] = {
- x1, y1,
- x2, y2
+ x1 + 0.5f, y1 + 0.5f,
+ x2 + 0.5f, y2 + 0.5f
};
Shader* shader = Shader::getCurrentShader();
- shader->bindVertexPointer(2, GL_FLOAT, 0, verts);
+ shader->setVertexPointer(2, GL_FLOAT, 0, verts);
gl.ModelMatrix.setIdentity();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
glDrawArrays(GL_LINES, 0, 2);
@@ -83,13 +85,13 @@ namespace JinEngine
void rect(RenderMode mode, int x, int y, int w, int h)
{
- float coords[] = { x, y, x + w, y, x + w, y + h, x, y + h };
+ float coords[] = { x + 0.5f, y + 0.5f, x + w + 0.5f, y + 0.5f, x + w + 0.5f, y + h + 0.5f, x + 0.5f, y + h + 0.5f };
polygon(mode, coords, 4);
}
void triangle(RenderMode mode, int x1, int y1, int x2, int y2, int x3, int y3)
{
- float coords[] = { x1, y1, x2, y2, x3, y3 };
+ float coords[] = { x1 + 0.5f, y1 + 0.5f, x2 + 0.5f, y2 + 0.5f, x3 + 0.5f, y3 + 0.5f };
polygon(mode, coords, 3);
}
@@ -97,9 +99,9 @@ namespace JinEngine
{
Shader* shader = Shader::getCurrentShader();
gl.ModelMatrix.setIdentity();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
- shader->bindVertexPointer(2, GL_FLOAT, 0, p);
+ shader->setVertexPointer(2, GL_FLOAT, 0, p);
glDrawArrays(GL_LINE_LOOP, 0, count);
}
@@ -114,9 +116,9 @@ namespace JinEngine
{
Shader* shader = Shader::getCurrentShader();
gl.ModelMatrix.setIdentity();
- shader->sendMatrix4(SHADER_MODEL_MATRIX, &gl.ModelMatrix);
+ shader->sendMatrix4(SHADER_MODEL_MATRIX, &(gl.getMatrix() * gl.ModelMatrix));
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.ProjectionMatrix);
- shader->bindVertexPointer(2, GL_FLOAT, 0, p);
+ shader->setVertexPointer(2, GL_FLOAT, 0, p);
glDrawArrays(GL_POLYGON, 0, count);
}
diff --git a/src/libjin/Graphics/je_shapes.h b/src/libjin/Graphics/je_shapes.h
index 2221526..d62592b 100644
--- a/src/libjin/Graphics/je_shapes.h
+++ b/src/libjin/Graphics/je_shapes.h
@@ -1,5 +1,5 @@
-#ifndef __JE_GEOMETRY_H
-#define __JE_GEOMETRY_H
+#ifndef __JE_GEOMETRY_H__
+#define __JE_GEOMETRY_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
@@ -12,11 +12,11 @@ namespace JinEngine
namespace Graphics
{
- typedef enum {
+ enum RenderMode {
NONE = 0,
FILL ,
LINE
- }RenderMode;
+ };
extern void line(int x1, int y1, int x2, int y2);
extern void rect(RenderMode mode, int x, int y, int w, int h);
@@ -31,4 +31,4 @@ namespace JinEngine
#endif // jin_graphics
-#endif // __JE_GEOMETRY_H \ No newline at end of file
+#endif // __JE_GEOMETRY_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_sprite.cpp b/src/libjin/Graphics/je_sprite.cpp
index 3ac976a..810cb0e 100644
--- a/src/libjin/Graphics/je_sprite.cpp
+++ b/src/libjin/Graphics/je_sprite.cpp
@@ -1,11 +1,156 @@
+#include "shaders/je_shader.h"
+
#include "je_sprite.h"
+using namespace JinEngine::Math;
+using namespace JinEngine::Graphics::Shaders;
+
namespace JinEngine
{
namespace Graphics
{
+ Sprite::Sprite()
+ : mShader(nullptr)
+ , mGraphic(nullptr)
+ , mScale(1, 1)
+ , mColor(255, 255, 255, 255)
+ , mIsOriginEnum(false)
+ {
+ }
+
+ Sprite::~Sprite()
+ {
+ }
+
+ void Sprite::setQuad(int x, int y, int w, int h)
+ {
+ mQuad.x = x;
+ mQuad.y = y;
+ mQuad.w = w;
+ mQuad.h = h;
+ if (mIsOriginEnum)
+ setOrigin(mOriginEnum);
+ }
+
+ void Sprite::setRotation(float r)
+ {
+ mRotation = r;
+ }
+
+ void Sprite::setOrigin(Origin origin)
+ {
+ mIsOriginEnum = true;
+ mOriginEnum = origin;
+ int l = 0, r = 0, t = 0, b = 0;
+ Vector2<int> size = getSize();
+ r = size.w;
+ b = size.h;
+ switch (origin)
+ {
+ case TopLeft:
+ mOrigin.x = l;
+ mOrigin.y = t;
+ break;
+ case TopCenter:
+ mOrigin.x = r/2.f;
+ mOrigin.y = t;
+ break;
+ case TopRight:
+ mOrigin.x = r;
+ mOrigin.y = t;
+ break;
+ case MiddleLeft:
+ mOrigin.x = l;
+ mOrigin.y = b/2.f;
+ break;
+ case MiddleCenter:
+ mOrigin.x = r/2.f;
+ mOrigin.y = b/2.f;
+ break;
+ case MiddleRight:
+ mOrigin.x = r;
+ mOrigin.y = b/2.f;
+ break;
+ case BottomLeft:
+ mOrigin.x = l;
+ mOrigin.y = b;
+ break;
+ case BottomCenter:
+ mOrigin.x = r/2.f;
+ mOrigin.y = b;
+ break;
+ case BottomRight:
+ mOrigin.x = r;
+ mOrigin.y = b;
+ break;
+ }
+ }
+
+ void Sprite::setOrigin(int x, int y)
+ {
+ mOrigin.set(x, y);
+ mIsOriginEnum = false;
+ }
+
+ void Sprite::setPosition(float x, float y)
+ {
+ mPosition.set(x, y);
+ }
+
+ void Sprite::setScale(float x, float y)
+ {
+ mScale.set(x, y);
+ }
+
+ void Sprite::setColor(Color color)
+ {
+ mColor = color;
+ }
+
+ void Sprite::setShader(Shader* shader)
+ {
+ mShader = shader;
+ }
+
+ void Sprite::setGraphic(const Graphic* graphic)
+ {
+ mGraphic = graphic;
+ int w = mGraphic->getWidth();
+ int h = mGraphic->getHeight();
+ setQuad(0, 0, w, h);
+ }
+
+
+ void Sprite::move(float x, float y)
+ {
+ mPosition.x += x;
+ mPosition.y += y;
+ }
+
+ void Sprite::rotate(float r)
+ {
+ mRotation += r;
+ }
+
+ void Sprite::scale(float sx, float sy)
+ {
+ mScale.x += sx;
+ mScale.y += sy;
+ }
+ void Sprite::render()
+ {
+ Shader* shader = Shader::getCurrentShader();
+ Color c = gl.getColor();
+ gl.setColor(mColor);
+ if(mShader != nullptr)
+ mShader->use();
+ if(mGraphic != nullptr)
+ mGraphic->render(mQuad, mPosition.x, mPosition.y, mScale.x, mScale.y, mRotation, mOrigin.x, mOrigin.y);
+ shader->use();
+ gl.setColor(c);
+ }
} // namespace Graphics
} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Graphics/je_sprite.h b/src/libjin/Graphics/je_sprite.h
index 3b96162..65e00eb 100644
--- a/src/libjin/Graphics/je_sprite.h
+++ b/src/libjin/Graphics/je_sprite.h
@@ -1,34 +1,85 @@
-#ifndef __JE_SPRITE_H
-#define __JE_SPRITE_H
+#ifndef __JE_SPRITE_H__
+#define __JE_SPRITE_H__
#include "../common/je_types.h"
#include "../math/je_vector2.hpp"
-#include "shader/je_shader.h"
+#include "shaders/je_shader.h"
#include "je_color.h"
namespace JinEngine
{
namespace Graphics
{
+
///
- /// A sprite is unit of rendering, logic and events.
+ /// A sprite is unit of rendering. Animation is based on sprite, but not texture or other graphic stuff.
///
class Sprite
{
public:
- void setOrigin(float x, float y);
- void setPosition(int x, int y);
- void setScale(float x, float y);
+ Sprite();
+ virtual ~Sprite();
+
+ enum Origin
+ {
+ TopLeft,
+ TopCenter,
+ TopRight,
+ MiddleLeft,
+ MiddleCenter,
+ MiddleRight,
+ BottomLeft,
+ BottomCenter,
+ BottomRight
+ };
+
+ void setQuad(int x, int y, int w, int h);
+ void setRotation(float r);
+ void setOrigin(Origin origin);
+ void setOrigin(int x, int y);
+ void setPosition(float x, float y);
+ void setScale(float sx, float sy);
void setColor(Color color);
- void setShader(const Shader* shader);
+ void setShader(Shaders::Shader* shader);
+ void setGraphic(const Graphic* graphic);
+
+ void move(float x, float y);
+ void rotate(float r);
+ void scale(float sx, float sy);
+
+ float getRotation() { return mRotation; }
+ Math::Vector2<int> getSize() { return Math::Vector2<int>(mQuad.w, mQuad.h); }
+ const Math::Quad& getQuad() { return mQuad; }
+ const Math::Vector2<float>& getPosition() { return mPosition; }
+ const Math::Vector2<int>& getOrigin() { return mOrigin; }
+ const Math::Vector2<float>& getScale() { return mScale; }
+ const Color& getColor() { return mColor; }
+ const Graphic* getGraphic() { return mGraphic; }
+ const Shaders::Shader* getShader() { return mShader; }
+
+ ///
+ /// Render callback.
+ ///
+ virtual void render();
private:
- Math::Vector2<int> mPosition;
- Math::Vector2<float> mOrigin;
+ ///
+ /// Origin must be 0~1 float value.
+ ///
+ Math::Vector2<float> mPosition;
+ Math::Vector2<int> mOrigin;
Math::Vector2<float> mScale;
+ float mRotation;
Color mColor;
- const Shader* mShader;
+
+ Math::Quad mQuad;
+
+ bool mIsOriginEnum;
+ Origin mOriginEnum;
+
+ Shaders::Shader* mShader;
+ const Graphic* mGraphic;
};
diff --git a/src/libjin/Graphics/je_sprite_batch.cpp b/src/libjin/Graphics/je_sprite_batch.cpp
index e69de29..f339715 100644
--- a/src/libjin/Graphics/je_sprite_batch.cpp
+++ b/src/libjin/Graphics/je_sprite_batch.cpp
@@ -0,0 +1,11 @@
+#include "je_sprite_batch.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+
+
+
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/je_sprite_batch.h b/src/libjin/Graphics/je_sprite_batch.h
index 85a7951..64f9805 100644
--- a/src/libjin/Graphics/je_sprite_batch.h
+++ b/src/libjin/Graphics/je_sprite_batch.h
@@ -1,5 +1,5 @@
-#ifndef __JE_SPRITE_BATCH_H
-#define __JE_SPRITE_BATCH_H
+#ifndef __JE_GRAPHICS_SPRITE_BATCH_H__
+#define __JE_GRAPHICS_SPRITE_BATCH_H__
namespace JinEngine
{
@@ -8,10 +8,13 @@ namespace JinEngine
class SpriteBatch
{
+ public:
+
+ private:
};
} // namespace Graphics
-} // namespace JinEngine
+} // namespace JinEngine
#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/je_sprite_sheet.cpp b/src/libjin/Graphics/je_sprite_sheet.cpp
new file mode 100644
index 0000000..3a08751
--- /dev/null
+++ b/src/libjin/Graphics/je_sprite_sheet.cpp
@@ -0,0 +1,22 @@
+#include "je_sprite_sheet.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+
+ SpriteSheet::SpriteSheet(const Graphic* graphic)
+ : mGraphic(graphic)
+ {
+ }
+
+ Sprite* SpriteSheet::createSprite(const Math::Quad& quad)
+ {
+ Sprite* spr = new Sprite();
+ spr->setGraphic(mGraphic);
+ spr->setQuad(quad.x, quad.y, quad.w, quad.h);
+ return spr;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/je_sprite_sheet.h b/src/libjin/Graphics/je_sprite_sheet.h
new file mode 100644
index 0000000..8c56c51
--- /dev/null
+++ b/src/libjin/Graphics/je_sprite_sheet.h
@@ -0,0 +1,33 @@
+#ifndef __JE_SPRITE_SHEET_H__
+#define __JE_SPRITE_SHEET_H__
+
+#include <vector>
+
+#include "../math/je_quad.h"
+
+#include "je_sprite.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+
+ class SpriteSheet
+ {
+ public:
+ ///
+ /// Create a new sprite in sheet.
+ ///
+ Sprite* createSprite(const Math::Quad& quad);
+
+ SpriteSheet(const Graphic* graphic);
+
+ private:
+ const Graphic* const mGraphic;
+
+ };
+
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/je_texture.h b/src/libjin/Graphics/je_texture.h
index ddc8cfc..566ba84 100644
--- a/src/libjin/Graphics/je_texture.h
+++ b/src/libjin/Graphics/je_texture.h
@@ -1,9 +1,9 @@
-#ifndef __JE_TEXTURE_H
-#define __JE_TEXTURE_H
+#ifndef __JE_TEXTURE_H__
+#define __JE_TEXTURE_H__
#include "../core/je_configuration.h"
#if defined(jin_graphics)
-#include "../3rdparty/GLee/GLee.h"
+#include "GLee/GLee.h"
#include "je_color.h"
#include "je_graphic.h"
@@ -17,7 +17,8 @@ namespace JinEngine
///
///
///
- class Texture: public Graphic
+ class Texture
+ : public Graphic
{
public:
///
@@ -53,4 +54,4 @@ namespace JinEngine
#endif // jin_graphics
-#endif // __JE_TEXTURE_H \ No newline at end of file
+#endif // __JE_TEXTURE_H__ \ No newline at end of file
diff --git a/src/libjin/Graphics/je_window.cpp b/src/libjin/Graphics/je_window.cpp
index f0b789e..c14d290 100644
--- a/src/libjin/Graphics/je_window.cpp
+++ b/src/libjin/Graphics/je_window.cpp
@@ -3,15 +3,18 @@
#include <iostream>
+#include "../common/je_exception.h"
#include "../utils/je_utils.h"
#include "../audio/sdl/je_sdl_audio.h"
#include "../utils/je_log.h"
-#include "shader/je_shader.h"
+#include "shaders/je_shader.h"
#include "je_window.h"
#include "je_gl.h"
#include "je_canvas.h"
+using namespace JinEngine::Graphics::Shaders;
+
namespace JinEngine
{
namespace Graphics
@@ -19,9 +22,7 @@ namespace JinEngine
bool Window::initSystem(const SettingBase* s)
{
- #if defined(jin_debug)
- Loghelper::log(Loglevel::LV_INFO, "Init window system");
- #endif
+ jin_log_info("Initialize window system.");
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return false;
@@ -30,8 +31,9 @@ namespace JinEngine
mSize.w = setting->width;
mSize.h = setting->height;
mFps = setting->fps;
- bool vsync = setting->vsync;
- const char* title = setting->title;
+ bool vsync = setting->vsync;
+ const char* title = setting->title;
+ const char* icon = setting->icon;
if (mWnd)
{
@@ -58,34 +60,51 @@ namespace JinEngine
int wx = SDL_WINDOWPOS_UNDEFINED,
wy = SDL_WINDOWPOS_UNDEFINED;
- int flag = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
+ int flag = SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL;
if (setting->fullscreen) flag |= SDL_WINDOW_FULLSCREEN;
if (setting->resizable) flag |= SDL_WINDOW_RESIZABLE;
mWnd = SDL_CreateWindow(title, wx, wy, mSize.w, mSize.h, flag);
if (mWnd == NULL)
return false;
+
+ // Set window icon
+ try
+ {
+ Bitmap* bitmap = Bitmap::createBitmap(icon);
+ SDL_Surface *surface;
+ Color* pixels = const_cast<Color*>(bitmap->getPixels());
+ uint w = bitmap->getWidth(), h = bitmap->getHeight();
+ surface = SDL_CreateRGBSurfaceFrom(
+ pixels, w, h, 32, w * 4, Color::RMASK, Color::GMASK, Color::BMASK, Color::AMASK);
+ SDL_SetWindowIcon(mWnd, surface);
+ SDL_FreeSurface(surface);
+ } catch (...) {}
+
ctx = SDL_GL_CreateContext(mWnd);
if (ctx == NULL)
return false;
SDL_GL_SetSwapInterval(vsync ? 1 : 0);
SDL_GL_MakeCurrent(mWnd, ctx);
- // default configuration
+ // Default configuration
gl.setClearColor(0, 0, 0, 0xff);
- gl.pushColor(0xff, 0xff, 0xff, 0xff);
+ glClear(GL_COLOR_BUFFER_BIT);
+ gl.pushColor(0xff, 0xff, 0xff, 0xff);
gl.enable(GL_BLEND);
gl.enable(GL_TEXTURE_2D);
gl.setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- // avoid white screen blink on windows
- swapBuffers();
- // bind to default canvas
+ // Bind to default canvas
Canvas::unbind();
Shader::unuse();
+ // Avoid white blinnk.
+ swapBuffers();
+
return true;
}
void Window::quitSystem()
{
+ jin_log_info("Quit window system.");
// disable opengl
gl.disable(GL_BLEND);
gl.disable(GL_TEXTURE_2D);
diff --git a/src/libjin/Graphics/je_window.h b/src/libjin/Graphics/je_window.h
index 7ca1e5e..831f3e6 100644
--- a/src/libjin/Graphics/je_window.h
+++ b/src/libjin/Graphics/je_window.h
@@ -16,7 +16,8 @@ namespace JinEngine
///
///
///
- class Window : public Subsystem<Window>
+ class Window
+ : public Subsystem<Window>
{
public:
///
@@ -26,6 +27,7 @@ namespace JinEngine
{
public:
const char* title; ///< window title
+ const char* icon; ///< window icon
bool fullscreen; ///< full screen
int width, height; ///< window size
bool vsync; ///< vsync
@@ -58,6 +60,16 @@ namespace JinEngine
///
void swapBuffers();
+ ///
+ ///
+ ///
+ inline void hide() { SDL_HideWindow(mWnd); };
+
+ ///
+ ///
+ ///
+ void show() { SDL_ShowWindow(mWnd); };
+
private:
// declare a singleton
diff --git a/src/libjin/Graphics/particle/je_particle.h b/src/libjin/Graphics/particle/je_particle.h
deleted file mode 100644
index 2a5c54f..0000000
--- a/src/libjin/Graphics/particle/je_particle.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __JE_PARTICLE_H
-#define __JE_PARTICLE_H
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- /// Single particle.
- ///
- class Particle
- {
-
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particle/je_particle_batch.h b/src/libjin/Graphics/particle/je_particle_batch.h
deleted file mode 100644
index 19f4ded..0000000
--- a/src/libjin/Graphics/particle/je_particle_batch.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __JE_PARTICLE_BATCH_H
-#define __JE_PARTICLE_BATCH_H
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- ///
- ///
- class ParticleBatch
- {
-
- };
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particle/je_particle_emitter.cpp b/src/libjin/Graphics/particle/je_particle_emitter.cpp
deleted file mode 100644
index d57d5ed..0000000
--- a/src/libjin/Graphics/particle/je_particle_emitter.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "je_particle_emitter.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
-
-
- }
-}
diff --git a/src/libjin/Graphics/particle/je_particle_emitter.h b/src/libjin/Graphics/particle/je_particle_emitter.h
deleted file mode 100644
index e191e36..0000000
--- a/src/libjin/Graphics/particle/je_particle_emitter.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __JE_PARTICLE_EMMITTER_H
-#define __JE_PARTICLE_EMMITTER_H
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- ///
- /// Particle emitter
- ///
- class ParticleEmitter
- {
- public:
-
- private:
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particles/je_particle.cpp b/src/libjin/Graphics/particles/je_particle.cpp
new file mode 100644
index 0000000..20bbd03
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle.cpp
@@ -0,0 +1,26 @@
+#include "je_particle.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Particles
+ {
+
+ void Particle::reset()
+ {
+ lifeTime = 0.0f;
+ life = 0.0f;
+ position.set(0, 0);
+ direction = 0.0f;
+ speed.set(0, 0);
+ linearAcceleration.set(0, 0);
+ radialAcceleration = 0.0f;
+ size = 1;
+ sizeBegin = 1;
+ alive = true;
+ }
+
+ }
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/particles/je_particle.h b/src/libjin/Graphics/particles/je_particle.h
new file mode 100644
index 0000000..2d112d1
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle.h
@@ -0,0 +1,178 @@
+#ifndef __JE_PARTICLE_H__
+#define __JE_PARTICLE_H__
+
+#include "../../math/je_vector2.hpp"
+#include "../je_color.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Particles
+ {
+
+ class ParticleEmitter;
+
+ ///
+ ///
+ ///
+ struct LifeTimeDef
+ {
+ bool enableRandom = false;
+ union
+ {
+ struct
+ {
+ float min, max;
+ } random;
+ float life;
+ } life;
+ };
+
+ ///
+ ///
+ ///
+ struct SpeedOverTimeDef
+ {
+ bool enable = false;
+ bool enableRandom = false;
+ union
+ {
+ struct
+ {
+ Math::Vector2<float> startFloor;
+ Math::Vector2<float> startCeil;
+ Math::Vector2<float> endFloor;
+ Math::Vector2<float> endCeil;
+ } random;
+ struct
+ {
+ Math::Vector2<float> start;
+ Math::Vector2<float> end;
+ } speed;
+ } speed;
+ };
+
+ struct SizeOverTimeDef
+ {
+ bool enable = false;
+ bool enableRandom = false;
+ union {
+ struct {
+ float startFloor = 1;
+ float startCeil = 1;
+ float endFloor = 1;
+ float endCeil = 1;
+ } random;
+ struct {
+ float start = 1;
+ float end = 1;
+ } size;
+ } size;
+ };
+
+ struct ColorOverTimeDef
+ {
+ bool enable = false;
+ Color colorStart = Color::WHITE;
+ Color colorEnd = Color::WHITE;
+ };
+
+ struct linearAccelarationDef
+ {
+ Math::Vector2<float> linearAccelaration;
+ };
+
+ struct RadialAccelarationDef
+ {
+ float radialAccelaration;
+ };
+
+ ///
+ ///
+ ///
+ struct ParticleDef
+ {
+ private:
+ friend class ParticleEmitter;
+
+ public:
+ // Basic definitions.
+ LifeTimeDef lifeTimeDef; ///<
+ linearAccelarationDef linearAccelarationDef; ///<
+ RadialAccelarationDef radialAccelarationDef; ///<
+ // Optional definitions.
+ SpeedOverTimeDef speedOverTimeDef; ///<
+ SizeOverTimeDef sizeOverTimeDef; ///<
+ ColorOverTimeDef colorOverTimeDef; ///<
+ };
+
+ ///
+ /// A single particle contains various properties of particle, such as position, accelaration, color and
+ /// other attributes changed over time.
+ ///
+ struct Particle
+ {
+ ///
+ /// Default constructor.
+ ///
+ Particle() {};
+
+ ///
+ /// Reset to default.
+ ///
+ void reset();
+
+ ///
+ /// Whole life time.
+ ///
+ float lifeTime = 0.0f;
+
+ ///
+ /// Current life time.
+ ///
+ float life = 0.0f;
+
+ ///
+ /// Current position.
+ ///
+ Math::Vector2<float> position;
+
+ ///
+ /// Emitte direction.
+ ///
+ float direction = 0;
+
+ Math::Vector2<float> speed;
+ Math::Vector2<float> linearAcceleration;
+ float radialAcceleration = 0;
+
+ ///
+ /// Size over lifetime.
+ ///
+ float size = 1;
+ float sizeBegin = 1;
+ float sizeEnd = 1;
+
+ float rotation = 0;
+ float angle = 0;
+
+ ///
+ /// Color over lifetime.
+ ///
+ Color color = Color::WHITE;
+ Color colorStart = Color::WHITE;
+ Color colorEnd = Color::WHITE;
+
+ ///
+ /// Is particle still alive? Alive is equivalent to NOT available in particle pool.
+ ///
+ bool alive = true;
+
+ };
+
+ } // namespace Particles
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particles/je_particle_emitter.cpp b/src/libjin/Graphics/particles/je_particle_emitter.cpp
new file mode 100644
index 0000000..edc4bee
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle_emitter.cpp
@@ -0,0 +1,42 @@
+#include <time.h>
+
+#include "../../math/je_random.h"
+
+#include "je_particle_emitter.h"
+
+using namespace JinEngine::Math;
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Particles
+ {
+
+ // Particle emitter
+ static RandomGenerator rnd(time(NULL));
+
+ ParticleEmitter::ParticleEmitter(ParticleSystem& ps)
+ : mParticleSystem(ps)
+ {
+ }
+
+ void ParticleEmitter::update(float dt)
+ {
+ mTime += dt;
+ if (mTime < 1)
+ return;
+
+
+ mTime -= 1;
+ }
+
+ void ParticleEmitter::emit()
+ {
+
+
+ }
+
+ }
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Graphics/particles/je_particle_emitter.h b/src/libjin/Graphics/particles/je_particle_emitter.h
new file mode 100644
index 0000000..9200532
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle_emitter.h
@@ -0,0 +1,112 @@
+#ifndef __JE_PARTICLE_EMITTER_H__
+#define __JE_PARTICLE_EMITTER_H__
+
+#include "../../common/je_temporary.h"
+#include "../../math/je_vector2.hpp"
+
+#include "je_particle.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Particles
+ {
+
+ struct PositionDef
+ {
+ bool enableRandom = false;
+ union
+ {
+ struct
+ {
+ Math::Vector2<float> min;
+ Math::Vector2<float> max;
+ } random;
+ Math::Vector2<float> position;
+ } position;
+ };
+
+ struct DirectionDef
+ {
+ bool enableRandom = false;
+ union
+ {
+ struct
+ {
+ float min = 0;
+ float max = 0;
+ } random;
+ float direction = 0;
+ } direction;
+ };
+
+ ///
+ /// How many particles emitted per second.
+ ///
+ struct EmitRateDef
+ {
+ bool enableRandom = false;
+ union
+ {
+ struct
+ {
+ float min = 1;
+ float max = 1;
+ } random;
+ float rate = 1;
+ } rate;
+ };
+
+ ///
+ /// Definition of particle emitter.
+ ///
+ struct ParticleEmitterDef : public Temporary
+ {
+ PositionDef positionDef; ///< Emit position(relativily to the particle system center).
+ DirectionDef directionDef; ///< Emit direction.
+ EmitRateDef emitRateDef; ///< Emit rate.
+ };
+
+ class ParticleSystem;
+
+ ///
+ /// Emit a single particle.
+ ///
+ class ParticleEmitter
+ {
+ public:
+ ///
+ ///
+ ///
+ ParticleEmitter(ParticleSystem& ps);
+
+ ///
+ ///
+ ///
+ void update(float dt);
+
+ private:
+ ///
+ ///
+ ///
+ ParticleSystem& mParticleSystem;
+
+ ///
+ /// Emit a particle according to emitter definition and particle definition, particle system should
+ /// assign particle value to the particle in particle pool, but not use this return particle.
+ ///
+ void emit();
+
+ ///
+ ///
+ ///
+ float mTime;
+
+ };
+
+ } // namespace Particles
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particles/je_particle_pool.h b/src/libjin/Graphics/particles/je_particle_pool.h
new file mode 100644
index 0000000..46cd73a
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle_pool.h
@@ -0,0 +1,24 @@
+#ifndef __JE_PARTICLE_BATCH_H__
+#define __JE_PARTICLE_BATCH_H__
+
+#include "../../common/je_pool.hpp"
+
+#include "je_particle.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Particles
+ {
+
+ ///
+ /// Particle pool for reducing memory fragmentation.
+ ///
+ typedef Pool<Particle> ParticlePool;
+
+ } // namespace Particles
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particles/je_particle_system.cpp b/src/libjin/Graphics/particles/je_particle_system.cpp
new file mode 100644
index 0000000..68f8f21
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle_system.cpp
@@ -0,0 +1,11 @@
+#include "je_particle_system.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+
+
+
+ }
+}
diff --git a/src/libjin/Graphics/particles/je_particle_system.h b/src/libjin/Graphics/particles/je_particle_system.h
new file mode 100644
index 0000000..afa96b2
--- /dev/null
+++ b/src/libjin/Graphics/particles/je_particle_system.h
@@ -0,0 +1,103 @@
+#ifndef __JE_PARTICLE_EMMITTER_H__
+#define __JE_PARTICLE_EMMITTER_H__
+
+#include <vector>
+
+#include "../../common/je_temporary.h"
+#include "../../game/je_gameobject.h"
+
+#include "../je_sprite.h"
+
+#include "je_particle_emitter.h"
+#include "je_particle_pool.h"
+#include "je_particle.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Particles
+ {
+
+ ///
+ /// Definition of particle system.
+ ///
+ struct ParticleSystemDef : public Temporary
+ {
+ uint maxParticleCount = 1; ///< Max count of particles in pool. 1 by default.
+
+ ParticleEmitterDef emitterDef; ///< Particle emitter definition.
+ ParticleDef particleDef; ///< Particle definition.
+ };
+
+ ///
+ /// Particle emitter, handle all particles it emitts.
+ ///
+ class ParticleSystem : public Game::GameObject
+ {
+ public:
+ ///
+ /// Particle system constructor
+ ///
+ /// @param def Definition of particle system.
+ ///
+ ParticleSystem(const ParticleSystemDef& def);
+
+ ///
+ /// Particle system destructor.
+ ///
+ ~ParticleSystem();
+
+ ///
+ /// Update particle system and all alive particles.
+ ///
+ void update(float sec);
+
+ ///
+ /// Render particle system.
+ ///
+ void render(int x, int y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0);
+
+ ///
+ /// Set sprite to render.
+ ///
+ /// @param sprite Sprite to render.
+ ///
+ void setSprite(Sprite* sprite);
+
+ private:
+ // Disable default constructor.
+ ParticleSystem();
+
+ ///
+ /// Particle system definition.
+ ///
+ ParticleSystemDef mDef;
+
+ ///
+ /// Sprite to be drawn.
+ ///
+ Sprite* mSprite;
+
+ ///
+ /// Particle emitter.
+ ///
+ ParticleEmitter mEmitter;
+
+ ///
+ /// Particle pool.
+ ///
+ ParticlePool mParticlePool;
+
+ ///
+ /// Alive particles, that means these particles could join to the life cycle loop.
+ ///
+ std::vector<Particle*> mAliveParticles;
+
+ };
+
+ } // namespace Particles
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/Shader/je_default.shader.h b/src/libjin/Graphics/shaders/built-in/je_default.shader.h
index 3f57c44..3f57c44 100644
--- a/src/libjin/Graphics/Shader/je_default.shader.h
+++ b/src/libjin/Graphics/shaders/built-in/je_default.shader.h
diff --git a/src/libjin/Graphics/Shader/je_font.shader.h b/src/libjin/Graphics/shaders/built-in/je_font.shader.h
index e04c225..e04c225 100644
--- a/src/libjin/Graphics/Shader/je_font.shader.h
+++ b/src/libjin/Graphics/shaders/built-in/je_font.shader.h
diff --git a/src/libjin/Graphics/Shader/je_texture.shader.h b/src/libjin/Graphics/shaders/built-in/je_texture.shader.h
index d1fc86f..d1fc86f 100644
--- a/src/libjin/Graphics/Shader/je_texture.shader.h
+++ b/src/libjin/Graphics/shaders/built-in/je_texture.shader.h
diff --git a/src/libjin/Graphics/shaders/je_base.shader.h b/src/libjin/Graphics/shaders/je_base.shader.h
new file mode 100644
index 0000000..88fa872
--- /dev/null
+++ b/src/libjin/Graphics/shaders/je_base.shader.h
@@ -0,0 +1,89 @@
+#ifndef __JE_BASE_SHADER_H__
+#define __JE_BASE_SHADER_H__
+
+static const char* base_shared = R"(
+#define Number float
+#define Texture sampler2D
+#define Canvas sampler2D
+#define Color vec4
+#define Vec2 vec2
+#define Vec3 vec3
+#define Vec4 vec4
+
+#define texel texture2D
+
+struct Vertex
+{
+ vec2 xy;
+ vec2 uv;
+};
+
+)";
+
+static const int BASE_SHARED_SIZE = strlen(base_shared);
+
+static const char* base_vertex = R"(
+#version 130 core
+
+%s
+// Projection matrix
+uniform mat4 jin_ProjectionMatrix;
+// Model view matrix
+uniform mat4 jin_ModelMatrix;
+
+in vec2 jin_VertexCoords;
+in vec2 jin_TextureCoords;
+
+out vec4 jin_Color;
+out vec2 jin_XY;
+out vec2 jin_UV;
+
+%s
+
+void main()
+{
+ vec4 v = jin_ModelMatrix * vec4(jin_VertexCoords, 0, 1.0);
+ Vertex _v = vert(Vertex(v.xy, jin_TextureCoords));
+ gl_Position = jin_ProjectionMatrix * vec4(_v.xy, 0, 1.0f);
+ jin_Color = gl_Color;
+ jin_XY = _v.xy;
+ jin_UV = _v.uv;
+}
+)";
+
+static const int BASE_VERTEX_SHADER_SIZE = strlen(base_vertex) + BASE_SHARED_SIZE;
+
+#define formatVertexShader(buf, program) sprintf(buf,base_vertex, base_shared, program)
+
+static const char* base_fragment = R"(
+#version 130 core
+
+%s
+
+uniform Texture jin_MainTexture;
+
+in vec4 jin_Color;
+in vec2 jin_XY;
+in vec2 jin_UV;
+
+out vec4 jin_OutColor;
+
+%s
+
+void main()
+{
+ jin_OutColor = frag(jin_Color, jin_MainTexture, Vertex(jin_XY, jin_UV));
+}
+)";
+
+static const int BASE_FRAGMENT_SHADER_SIZE = strlen(base_fragment) + BASE_SHARED_SIZE;
+
+#define formatFragmentShader(buf, program) sprintf(buf, base_fragment, base_shared, program)
+
+static const char* SHADER_PROJECTION_MATRIX = "jin_ProjectionMatrix";
+static const char* SHADER_MODEL_MATRIX = "jin_ModelMatrix";
+static const char* SHADER_MAIN_TEXTURE = "jin_MainTexture";
+static const char* SHADER_VERTEX_COORDS = "jin_VertexCoords";
+static const char* SHADER_TEXTURE_COORDS = "jin_TextureCoords";
+
+#endif // __JE_BASE_SHADER_H__
diff --git a/src/libjin/Graphics/shaders/je_jsl_compiler.cpp b/src/libjin/Graphics/shaders/je_jsl_compiler.cpp
new file mode 100644
index 0000000..feb88d4
--- /dev/null
+++ b/src/libjin/Graphics/shaders/je_jsl_compiler.cpp
@@ -0,0 +1,57 @@
+#include "../../core/je_configuration.h"
+#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
+
+#include "../../Filesystem/je_buffer.h"
+
+#include "je_jsl_compiler.h"
+
+using namespace std;
+using namespace JinEngine::Filesystem;
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Shaders
+ {
+
+ #include "je_base.shader.h"
+
+ bool JSLCompiler::compile(const string& jsl, string* vertex_shader, string* fragment_shader)
+ {
+ // parse shader source, need some optimizations
+ int loc_VERTEX_SHADER = jsl.find("#VERTEX_SHADER");
+ int loc_END_VERTEX_SHADER = jsl.find("#END_VERTEX_SHADER");
+ int loc_FRAGMENT_SHADER = jsl.find("#FRAGMENT_SHADER");
+ int loc_END_FRAGMENT_SHADER = jsl.find("#END_FRAGMENT_SHADER");
+ if (loc_VERTEX_SHADER == string::npos
+ || loc_END_VERTEX_SHADER == string::npos
+ || loc_FRAGMENT_SHADER == string::npos
+ || loc_END_FRAGMENT_SHADER == string::npos
+ )
+ return false;
+ // Load vertex and fragment shader source into buffers.
+ {
+ // Compile JSL vertex program.
+ int start = loc_VERTEX_SHADER + strlen("#VERTEX_SHADER");
+ *vertex_shader = jsl.substr(start, loc_END_VERTEX_SHADER - start);
+ Buffer vbuffer = Buffer(vertex_shader->length() + BASE_VERTEX_SHADER_SIZE);
+ formatVertexShader((char*)&vbuffer, vertex_shader->c_str());
+ vertex_shader->assign((char*)&vbuffer);
+ }
+ {
+ // Compile JSL fragment program.
+ int start = loc_FRAGMENT_SHADER + strlen("#FRAGMENT_SHADER");
+ *fragment_shader = jsl.substr(start, loc_END_FRAGMENT_SHADER - start);
+ Buffer fbuffer = Buffer(fragment_shader->length() + BASE_FRAGMENT_SHADER_SIZE);
+ formatFragmentShader((char*)&fbuffer, fragment_shader->c_str());
+ fragment_shader->assign((char*)&fbuffer);
+ }
+ return true;
+ }
+
+ } // namespace Shaders
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader) \ No newline at end of file
diff --git a/src/libjin/Graphics/shaders/je_jsl_compiler.h b/src/libjin/Graphics/shaders/je_jsl_compiler.h
new file mode 100644
index 0000000..df1e827
--- /dev/null
+++ b/src/libjin/Graphics/shaders/je_jsl_compiler.h
@@ -0,0 +1,45 @@
+#ifndef __JE_JSL_COMPILER_H__
+#define __JE_JSL_COMPILER_H__
+
+#include "../../core/je_configuration.h"
+#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
+
+#include <string>
+
+#include "../../common/je_singleton.hpp"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Shaders
+ {
+
+ ///
+ /// Compile JSL into GLSL.
+ ///
+ class JSLCompiler : public Singleton<JSLCompiler>
+ {
+ public:
+ ///
+ /// Compile JSL shader source into GLSL.
+ ///
+ /// @param jsl JSL shader source.
+ /// @param glsl_vertex Output of vertex glsl shader source.
+ /// @param glsl_fragment Output of fragment glsl shader source.
+ /// @return True if compile successful, otherwise return false.
+ ///
+ bool compile(const std::string& jsl, std::string* glsl_vertex, std::string* glsl_fragment);
+
+ private:
+ singleton(JSLCompiler);
+
+ };
+
+ } // namespace Shaders
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader)
+
+#endif // __JE_JSL_COMPILER_H__
diff --git a/src/libjin/Graphics/shaders/je_shader.cpp b/src/libjin/Graphics/shaders/je_shader.cpp
new file mode 100644
index 0000000..c1abbf0
--- /dev/null
+++ b/src/libjin/Graphics/shaders/je_shader.cpp
@@ -0,0 +1,281 @@
+#include "../../core/je_configuration.h"
+#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
+
+#include <iostream>
+
+#include "../../filesystem/je_buffer.h"
+#include "../../utils/je_macros.h"
+
+#include "je_jsl_compiler.h"
+#include "je_shader.h"
+
+using namespace std;
+using namespace JinEngine::Filesystem;
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Shaders
+ {
+
+ //
+ // default_texture
+ // base_shader
+ // SHADER_FORMAT_SIZE
+ // formatShader
+ //
+#include "built-in/je_default.shader.h"
+
+//
+// https://stackoverflow.com/questions/27941496/use-sampler-without-passing-through-value
+// The default value of a sampler variable is 0. From the GLSL 3.30 spec,
+// section "4.3.5 Uniforms":
+//
+// The link time initial value is either the value of the variable's
+// initializer, if present, or 0 if no initializer is present.Sampler
+// types cannot have initializers.
+//
+// Since a value of 0 means that it's sampling from texture unit 0, it will
+// work without ever setting the value as long as you bind your textures to
+// unit 0. This is well defined behavior.
+//
+// Since texture unit 0 is also the default until you call glActiveTexture()
+// with a value other than GL_TEXTURE0, it's very common to always use unit
+// 0 as long as shaders do not need more than one texture.Which means that
+// often times, setting the sampler uniforms is redundant for simple
+// applications.
+//
+// I would still prefer to always set the values.If nothing else, it makes
+// it clear to anybody reading your code that you really mean to sample from
+// texture unit 0, and did not just forget to set the value.
+//
+ const int DEFAULT_TEXTURE_UNIT = 0;
+
+ /*static*/ Shader* Shader::CurrentShader = nullptr;
+
+ Shader* Shader::createShader(const string& program)
+ {
+ Shader* shader = nullptr;
+ try
+ {
+ shader = new Shader(program);
+ }
+ catch (...)
+ {
+ return nullptr;
+ }
+ return shader;
+ }
+
+ Shader::Shader(const string& program)
+ : mCurrentTextureUnit(DEFAULT_TEXTURE_UNIT)
+ {
+ if (!compile(program))
+ throw 0;
+ }
+
+ Shader::~Shader()
+ {
+ if (CurrentShader == this)
+ unuse();
+ // delete shader program
+ glDeleteShader(mPID);
+ }
+
+ bool Shader::compile(const string& program)
+ {
+ string vertex_shader, fragment_shader;
+ // Compile JSL shader source into GLSL shader source.
+ JSLCompiler* compiler = JSLCompiler::get();
+ if (!compiler->compile(program, &vertex_shader, &fragment_shader))
+ {
+ return false;
+ }
+#define glsl(SHADER_MODE, SHADER, SRC) \
+do{ \
+const GLchar* src = SRC.c_str(); \
+glShaderSource(SHADER, 1, &src, NULL); \
+glCompileShader(SHADER); \
+GLint success; \
+glGetShaderiv(SHADER, GL_COMPILE_STATUS, &success); \
+if (success == GL_FALSE) \
+ return false; \
+}while(0)
+ // Compile vertex shader.
+ GLuint vid = glCreateShader(GL_VERTEX_SHADER);
+ glsl(GL_VERTEX_SHADER, vid, vertex_shader);
+ // Compile fragment shader.
+ GLuint fid = glCreateShader(GL_FRAGMENT_SHADER);
+ glsl(GL_FRAGMENT_SHADER, fid, fragment_shader);
+#undef glsl
+ // Create OpenGL shader program.
+ mPID = glCreateProgram();
+ glAttachShader(mPID, vid);
+ glAttachShader(mPID, fid);
+ glLinkProgram(mPID);
+ GLint success;
+ glGetProgramiv(mPID, GL_LINK_STATUS, &success);
+ if (success == GL_FALSE)
+ return false;
+ }
+
+ static inline GLint getMaxTextureUnits()
+ {
+ GLint maxTextureUnits = 0;
+ glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
+ return maxTextureUnits;
+ }
+
+ void Shader::use()
+ {
+ glUseProgram(mPID);
+ CurrentShader = this;
+ sendInt(SHADER_MAIN_TEXTURE, DEFAULT_TEXTURE_UNIT);
+ }
+
+ /*static*/ void Shader::unuse()
+ {
+ glUseProgram(0);
+ CurrentShader = nullptr;
+ }
+
+ GLint Shader::claimTextureUnit(const std::string& name)
+ {
+ std::map<std::string, GLint>::iterator unit = mTextureUnits.find(name);
+ if (unit != mTextureUnits.end())
+ return unit->second;
+ static GLint MAX_TEXTURE_UNITS = getMaxTextureUnits();
+ if (++mCurrentTextureUnit >= MAX_TEXTURE_UNITS)
+ return 0;
+ mTextureUnits[name] = mCurrentTextureUnit;
+ return mCurrentTextureUnit;
+ }
+
+#define checkJSL() \
+ if (CurrentShader != this) \
+ return
+
+ void Shader::sendInt(const char* name, int value)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(mPID, name);
+ glUniform1i(loc, value);
+ }
+
+ void Shader::sendFloat(const char* variable, float number)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(mPID, variable);
+ glUniform1f(loc, number);
+ }
+
+ //
+ // https://www.douban.com/note/627332677/
+ // struct TextureUnit
+ // {
+ // GLuint targetTexture1D;
+ // GLuint targetTexture2D;
+ // GLuint targetTexture3D;
+ // GLuint targetTextureCube;
+ // ...
+ // };
+ //
+ // TextureUnit mTextureUnits[GL_MAX_TEXTURE_IMAGE_UNITS]
+ // GLuint mCurrentTextureUnit = 0;
+ //
+ void Shader::sendTexture(const char* variable, const Texture* tex)
+ {
+ checkJSL();
+ GLint location = glGetUniformLocation(mPID, variable);
+ if (location == -1)
+ return;
+ GLint unit = claimTextureUnit(variable);
+ if (unit == 0)
+ {
+ // TODO: 쳣󶨵
+ return;
+ }
+ gl.activeTexUnit(unit);
+ glUniform1i(location, unit);
+ gl.bindTexture(tex->getGLTexture());
+ gl.activeTexUnit(0);
+ }
+
+ void Shader::sendCanvas(const char* variable, const Canvas* canvas)
+ {
+ checkJSL();
+ GLint location = glGetUniformLocation(mPID, variable);
+ if (location == -1)
+ return;
+ GLint unit = claimTextureUnit(variable);
+ if (unit == 0)
+ {
+ // TODO: 쳣󶨵
+ return;
+ }
+ glUniform1i(location, unit);
+ glActiveTexture(GL_TEXTURE0 + unit);
+ gl.bindTexture(canvas->getGLTexture());
+
+ glActiveTexture(GL_TEXTURE0);
+ }
+
+ void Shader::sendVec2(const char* name, float x, float y)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(mPID, name);
+ glUniform2f(loc, x, y);
+ }
+
+ void Shader::sendVec3(const char* name, float x, float y, float z)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(mPID, name);
+ glUniform3f(loc, x, y, z);
+ }
+
+ void Shader::sendVec4(const char* name, float x, float y, float z, float w)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(mPID, name);
+ glUniform4f(loc, x, y, z, w);
+ }
+
+ void Shader::sendColor(const char* name, const Color* col)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(mPID, name);
+ glUniform4f(loc,
+ col->r / 255.f,
+ col->g / 255.f,
+ col->b / 255.f,
+ col->a / 255.f
+ );
+ }
+
+ void Shader::sendMatrix4(const char* name, const Math::Matrix* mat4)
+ {
+ int loc = glGetUniformLocation(mPID, name);
+ glUniformMatrix4fv(loc, 1, GL_FALSE, mat4->getElements());
+ }
+
+ void Shader::setVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
+ {
+ GLint loc = glGetAttribLocation(mPID, SHADER_VERTEX_COORDS);
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers);
+ }
+
+ void Shader::setUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
+ {
+ GLint loc = glGetAttribLocation(mPID, SHADER_TEXTURE_COORDS);
+ glEnableVertexAttribArray(1);
+ glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers);
+ }
+
+ } // namespace Shaders
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader) \ No newline at end of file
diff --git a/src/libjin/Graphics/shaders/je_shader.h b/src/libjin/Graphics/shaders/je_shader.h
new file mode 100644
index 0000000..2009e79
--- /dev/null
+++ b/src/libjin/Graphics/shaders/je_shader.h
@@ -0,0 +1,201 @@
+#ifndef __JE_SHADER_H__
+#define __JE_SHADER_H__
+
+#include "../../core/je_configuration.h"
+#if defined(jin_graphics) && (jin_graphics & jin_graphics_shader)
+
+#include <string>
+#include <map>
+
+#include "GLee/GLee.h"
+
+#include "../je_color.h"
+#include "../je_texture.h"
+#include "../je_canvas.h"
+
+#include "je_base.shader.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+ namespace Shaders
+ {
+
+ ///
+ /// Built in shader program.
+ ///
+ /// Built in shader program written with custom shading language called JSL (jin shading language). A
+ /// JSL program is compiled into glsl, so most glsl built in functions and structs are available in
+ /// JSL.
+ ///
+ class Shader
+ {
+ public:
+ ///
+ /// Create shader program from source code.
+ ///
+ /// @param source The shader source code.
+ ///
+ static Shader* createShader(const std::string& source);
+
+ ///
+ /// Get current shader.
+ ///
+ /// @return Current used shader program.
+ ///
+ static inline Shader* getCurrentShader() { return CurrentShader; }
+
+ ///
+ /// Unuse current shader.
+ ///
+ static void unuse();
+
+ ///
+ /// Destructor of shader.
+ ///
+ virtual ~Shader();
+
+ ///
+ /// Use specific shader.
+ ///
+ void use();
+
+ ///
+ /// Send float value to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param number Value of uniform variable to be sent.
+ ///
+ void sendFloat(const char* name, float number);
+
+ ///
+ /// Send texture to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param texture Texture to be sent.
+ ///
+ void sendTexture(const char* name, const Texture* texture);
+
+ ///
+ /// Send integer value to shader
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param value Value to be sent.
+ ///
+ void sendInt(const char* name, int value);
+
+ ///
+ /// Send 2D vector to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param x X value of the vector to be sent.
+ /// @param y Y value of the vector to be sent.
+ ///
+ void sendVec2(const char* name, float x, float y);
+
+ ///
+ /// Send 3D vector to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param x X value of the vector to be sent.
+ /// @param y Y value of the vector to be sent.
+ /// @param z Z value of the vector to be sent.
+ ///
+ void sendVec3(const char* name, float x, float y, float z);
+
+ ///
+ /// Send 4D vector to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param x X value of the vector to be sent.
+ /// @param y Y value of the vector to be sent.
+ /// @param z Z value of the vector to be sent.
+ /// @param w W value of the vector to be sent.
+ ///
+ void sendVec4(const char* name, float x, float y, float z, float w);
+
+ ///
+ /// Send canvas to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param canvas Canvas to be sent.
+ ///
+ void sendCanvas(const char* name, const Canvas* canvas);
+
+ ///
+ /// Send color to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param color Color to be sent.
+ ///
+ void sendColor(const char* name, const Color* color);
+
+ ///
+ /// Send 4 by 4 matrix to shader.
+ ///
+ /// @param name Name of the uniform variable to be assigned.
+ /// @param mat4 Matrix to be sent.
+ ///
+ void sendMatrix4(const char* name, const Math::Matrix* mat4);
+
+ ///
+ /// Set vertices value.
+ ///
+ /// @param n Number of vertices.
+ /// @param type Data type of each component in the array.
+ /// @param stride Byte offset between consecutive generic vertex attributes.
+ /// @param pointers Pointer to the first component of the first generic vertex attribute in the array.
+ ///
+ void setVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
+
+ ///
+ /// Set texture UV coordinates.
+ ///
+ /// @param n Number of vertices.
+ /// @param type Data type of each component in the array.
+ /// @param stride Byte offset between consecutive generic vertex attributes.
+ /// @param pointers Pointer to the first component of the first generic vertex attribute in the array.
+ ///
+ void setUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
+
+ protected:
+ ///
+ /// Reference of current used shader.
+ ///
+ static Shader* CurrentShader;
+
+ ///
+ /// Get texture unit of the uniform texture. If not, assign one.
+ ///
+ /// @param name Name of the texture uniform variable.
+ /// @return Texture unit which texture variable be assigned.
+ ///
+ GLint claimTextureUnit(const std::string& name);
+
+ ///
+ /// Shader constructor.
+ ///
+ Shader(const std::string& program);
+
+ ///
+ /// Compile JSL program into GLSL source.
+ ///
+ /// @param program JSL source code.
+ /// @return Return true if compile successed, otherwise return false.
+ ///
+ bool compile(const std::string& program);
+
+ GLuint mPID;
+ GLint mCurrentTextureUnit;
+ std::map<std::string, GLint> mTextureUnits;
+
+ };
+
+ } // namespace Shaders
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // (jin_graphics) && (jin_graphics & jin_graphics_shader)
+
+#endif // __JE_SHADER_H__ \ No newline at end of file
diff --git a/src/libjin/Input/je_event.h b/src/libjin/Input/je_event.h
index 126d0f6..9fe34ff 100644
--- a/src/libjin/Input/je_event.h
+++ b/src/libjin/Input/je_event.h
@@ -1,5 +1,5 @@
-#ifndef __JE_EVENT_H
-#define __JE_EVENT_H
+#ifndef __JE_EVENT_H__
+#define __JE_EVENT_H__
#include "../core/je_configuration.h"
#if defined(jin_input)
@@ -118,4 +118,4 @@ namespace JinEngine
#endif // defined(jin_input)
-#endif // __JE_EVENT_H \ No newline at end of file
+#endif // __JE_EVENT_H__
diff --git a/src/libjin/Input/je_input.h b/src/libjin/Input/je_input.h
index 8c7faf7..2abee0a 100644
--- a/src/libjin/Input/je_input.h
+++ b/src/libjin/Input/je_input.h
@@ -1,5 +1,5 @@
-#ifndef __JE_INPUT_H
-#define __JE_INPUT_H
+#ifndef __JE_INPUT_H__
+#define __JE_INPUT_H__
#include "je_event.h"
#include "je_keyboard.h"
diff --git a/src/libjin/Input/je_joypad.h b/src/libjin/Input/je_joypad.h
index 74173af..fb5dc38 100644
--- a/src/libjin/Input/je_joypad.h
+++ b/src/libjin/Input/je_joypad.h
@@ -1,5 +1,5 @@
-#ifndef __JE_JOYPAD_H
-#define __JE_JOYPAD_H
+#ifndef __JE_JOYPAD_H__
+#define __JE_JOYPAD_H__
#include <SDL2/SDL.h>
@@ -53,4 +53,4 @@ namespace JinEngine
} // namespace Input
} // namespace JinEngine
-#endif // __JE_JOYPAD_H \ No newline at end of file
+#endif // __JE_JOYPAD_H__
diff --git a/src/libjin/Input/je_keyboard.h b/src/libjin/Input/je_keyboard.h
index 61da361..25cfd5d 100644
--- a/src/libjin/Input/je_keyboard.h
+++ b/src/libjin/Input/je_keyboard.h
@@ -1,5 +1,5 @@
-#ifndef __JE_KEYBOARD_H
-#define __JE_KEYBOARD_H
+#ifndef __JE_KEYBOARD_H__
+#define __JE_KEYBOARD_H__
namespace JinEngine
{
@@ -17,4 +17,4 @@ namespace JinEngine
} // namespace Input
} // namespace JinEngine
-#endif // __JE_KEYBOARD_H \ No newline at end of file
+#endif // __JE_KEYBOARD_H__
diff --git a/src/libjin/Input/je_mouse.h b/src/libjin/Input/je_mouse.h
index 29038ec..3c4ad9b 100644
--- a/src/libjin/Input/je_mouse.h
+++ b/src/libjin/Input/je_mouse.h
@@ -1,5 +1,5 @@
-#ifndef __JE_MOUSE_H
-#define __JE_MOUSE_H
+#ifndef __JE_MOUSE_H__
+#define __JE_MOUSE_H__
#include "../core/je_configuration.h"
#if defined(jin_input)
@@ -46,4 +46,4 @@ namespace JinEngine
#endif // defined(jin_input)
-#endif // __JE_MOUSE_H \ No newline at end of file
+#endif // __JE_MOUSE_H__
diff --git a/src/libjin/Graphics/animation/je_animation.cpp b/src/libjin/Math/je_bezier_curve.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Graphics/animation/je_animation.cpp
+++ b/src/libjin/Math/je_bezier_curve.cpp
diff --git a/src/libjin/Math/je_bezier_curve.h b/src/libjin/Math/je_bezier_curve.h
new file mode 100644
index 0000000..6925baf
--- /dev/null
+++ b/src/libjin/Math/je_bezier_curve.h
@@ -0,0 +1,17 @@
+#ifndef __JIN_BEZIER_CURVE_H__
+#define __JIN_BEZIER_CURVE_H__
+
+namespace JinEngine
+{
+ namespace Math
+ {
+
+ class BezierCurve
+ {
+
+ };
+
+ } // namespace Math
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Math/je_constant.h b/src/libjin/Math/je_constant.h
index 5ab126c..45577e7 100644
--- a/src/libjin/Math/je_constant.h
+++ b/src/libjin/Math/je_constant.h
@@ -1,5 +1,5 @@
-#ifndef __JE_MATH_CONSTANT_H
-#define __JE_MATH_CONSTANT_H
+#ifndef __JE_MATH_CONSTANT_H__
+#define __JE_MATH_CONSTANT_H__
#define PI 3.1415926f
diff --git a/src/libjin/Graphics/animation/je_clip.cpp b/src/libjin/Math/je_ellipse.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Graphics/animation/je_clip.cpp
+++ b/src/libjin/Math/je_ellipse.cpp
diff --git a/src/libjin/Graphics/particle/je_particle.cpp b/src/libjin/Math/je_ellipse.h
index e69de29..e69de29 100644
--- a/src/libjin/Graphics/particle/je_particle.cpp
+++ b/src/libjin/Math/je_ellipse.h
diff --git a/src/libjin/Math/je_math.h b/src/libjin/Math/je_math.h
index 1f8e0b3..de57e36 100644
--- a/src/libjin/Math/je_math.h
+++ b/src/libjin/Math/je_math.h
@@ -1,5 +1,5 @@
-#ifndef __JE_UTILS_MATH_H
-#define __JE_UTILS_MATH_H
+#ifndef __JE_UTILS_MATH_H__
+#define __JE_UTILS_MATH_H__
#include "je_constant.h"
#include "je_matrix.h"
@@ -71,7 +71,13 @@ namespace JinEngine
return a + t * (b - a);
}
+ inline float lerp(float a, float b, float f)
+ {
+ f = clamp<float>(f, 0, 1);
+ return a + f * (b - a);
+ }
+
} // namespace Math
} // namespace JinEngine
-#endif // __JE_UTILS_MATH_H \ No newline at end of file
+#endif // __JE_UTILS_MATH_H__
diff --git a/src/libjin/Math/je_matrix.h b/src/libjin/Math/je_matrix.h
index 3592d18..bbc831d 100644
--- a/src/libjin/Math/je_matrix.h
+++ b/src/libjin/Math/je_matrix.h
@@ -1,5 +1,5 @@
-#ifndef __JE_MATRIX_H
-#define __JE_MATRIX_H
+#ifndef __JE_MATRIX_H__
+#define __JE_MATRIX_H__
namespace JinEngine
{
@@ -156,4 +156,4 @@ namespace JinEngine
} // namespace Math
} // namespace JinEngine
-#endif // __JE_MATRIX_H \ No newline at end of file
+#endif // __JE_MATRIX_H__
diff --git a/src/libjin/Math/je_quad.h b/src/libjin/Math/je_quad.h
index 2a66fa1..8a7bd64 100644
--- a/src/libjin/Math/je_quad.h
+++ b/src/libjin/Math/je_quad.h
@@ -1,5 +1,5 @@
-#ifndef __JE_QUAD_H
-#define __JE_QUAD_H
+#ifndef __JE_QUAD_H__
+#define __JE_QUAD_H__
namespace JinEngine
{
@@ -20,4 +20,4 @@ namespace JinEngine
} // namespace Math
} // namespace JinEngine
-#endif // __JE_QUAD_H \ No newline at end of file
+#endif // __JE_QUAD_H__
diff --git a/src/libjin/Math/je_random.cpp b/src/libjin/Math/je_random.cpp
new file mode 100644
index 0000000..983fa36
--- /dev/null
+++ b/src/libjin/Math/je_random.cpp
@@ -0,0 +1,13 @@
+#include "je_random.h"
+
+namespace JinEngine
+{
+ namespace Math
+ {
+
+ RandomGenerator::RandomGenerator()
+ {
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/libjin/Math/je_random.h b/src/libjin/Math/je_random.h
index eb59341..0bcdec7 100644
--- a/src/libjin/Math/je_random.h
+++ b/src/libjin/Math/je_random.h
@@ -1,14 +1,28 @@
-#ifndef __JE_RANDOM_H
-#define __JE_RANDOM_H
+#ifndef __JE_RANDOM_H__
+#define __JE_RANDOM_H__
+
+#include "../common/je_types.h"
namespace JinEngine
{
namespace Math
{
+ ///
+ /// A random number generator.
+ ///
+ class RandomGenerator
+ {
+ public:
+ RandomGenerator();
+ explicit RandomGenerator(uint32 seed);
+
+ uint32 rand(uint32 min, uint32 max);
+ float rand(float min, float max);
+ };
- }
-}
+ } // namespace Math
+} // namespace JinEngine
#endif \ No newline at end of file
diff --git a/src/libjin/Math/je_vector2.hpp b/src/libjin/Math/je_vector2.hpp
index a2b3371..e9599e1 100644
--- a/src/libjin/Math/je_vector2.hpp
+++ b/src/libjin/Math/je_vector2.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_VECTOR_H
-#define __JE_VECTOR_H
+#ifndef __JE_VECTOR_H__
+#define __JE_VECTOR_H__
namespace JinEngine
{
@@ -25,6 +25,18 @@ namespace JinEngine
data[1] = v.data[1];
}
+ void operator = (const Vector2<T>& v)
+ {
+ data[0] = v.data[0];
+ data[1] = v.data[1];
+ }
+
+ void set(T _x, T _y)
+ {
+ data[0] = _x;
+ data[1] = _y;
+ }
+
T &x = data[0], &y = data[1]; // xy
T &w = data[0], &h = data[1]; // wh
T &colum = data[0], &row = data[1]; // colum row
diff --git a/src/libjin/Math/je_vector3.hpp b/src/libjin/Math/je_vector3.hpp
index 0f9448d..fdab2d0 100644
--- a/src/libjin/Math/je_vector3.hpp
+++ b/src/libjin/Math/je_vector3.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_VECTOR3_H
-#define __JE_VECTOR3_H
+#ifndef __JE_VECTOR3_H__
+#define __JE_VECTOR3_H__
namespace JinEngine
{
diff --git a/src/libjin/Math/je_vector4.hpp b/src/libjin/Math/je_vector4.hpp
index 20353eb..5cd5b35 100644
--- a/src/libjin/Math/je_vector4.hpp
+++ b/src/libjin/Math/je_vector4.hpp
@@ -1,5 +1,5 @@
-#ifndef __JE_VECTOR4_H
-#define __JE_VECTOR4_H
+#ifndef __JE_VECTOR4_H__
+#define __JE_VECTOR4_H__
namespace JinEngine
{
diff --git a/src/libjin/Net/je_net_manager.h b/src/libjin/Net/je_net_manager.h
index 8f72b73..62aa947 100644
--- a/src/libjin/Net/je_net_manager.h
+++ b/src/libjin/Net/je_net_manager.h
@@ -1,5 +1,5 @@
-#ifndef __JE_NET_H
-#define __JE_NET_H
+#ifndef __JE_NET_H__
+#define __JE_NET_H__
#include "../core/je_configuration.h"
#if defined(jin_net)
@@ -47,4 +47,4 @@ namespace JinEngine
#endif // defined(jin_net)
-#endif // __JE_NET_H \ No newline at end of file
+#endif // __JE_NET_H__
diff --git a/src/libjin/Net/je_socket.h b/src/libjin/Net/je_socket.h
index d496fcb..eb01719 100644
--- a/src/libjin/Net/je_socket.h
+++ b/src/libjin/Net/je_socket.h
@@ -1,9 +1,9 @@
-#ifndef __JE_NET_SOCKET_H
-#define __JE_NET_SOCKET_H
+#ifndef __JE_NET_SOCKET_H__
+#define __JE_NET_SOCKET_H__
#include "../core/je_configuration.h"
#if defined(jin_net)
-#include "../3rdparty/tekcos/tekcos.h"
+#include "tekcos/tekcos.h"
namespace JinEngine
{
@@ -141,4 +141,4 @@ namespace JinEngine
#endif // defined(jin_net)
-#endif // __JE_NET_SOCKET_H \ No newline at end of file
+#endif // __JE_NET_SOCKET_H__ \ No newline at end of file
diff --git a/src/libjin/README.md b/src/libjin/README.md
index e69de29..57d6fe2 100644
--- a/src/libjin/README.md
+++ b/src/libjin/README.md
@@ -0,0 +1,4 @@
+
+
+GUIDE LINE 114
+------------------------------------------------------------------------------------------------------------------ \ No newline at end of file
diff --git a/src/libjin/Time/je_timer.cpp b/src/libjin/Time/je_timer.cpp
index a2f2486..8dc5e86 100644
--- a/src/libjin/Time/je_timer.cpp
+++ b/src/libjin/Time/je_timer.cpp
@@ -9,52 +9,71 @@ namespace JinEngine
{
- Timers::Timers()
- : timers()
+ Timer::Timer()
+ : mHandlers()
{
}
- Timers::~Timers()
+ Timer::~Timer()
{
- for (int i = 0; i < timers.size(); ++i)
- delete timers[i];
+ for (int i = 0; i < mHandlers.size(); ++i)
+ delete mHandlers[i];
}
- void Timers::update(int ms)
+ void Timer::update(float dt)
{
- std::vector<Timer*>::iterator it = timers.begin();
- for (; it != timers.end(); )
- {
- if (!(*it)->process(ms))
- {
- Timer* t = *it;
- timers.erase(it);
- delete t;
- return;
- }
- ++it;
- }
+ // Process handler.
+ std::vector<Handler*>::iterator it = mHandlers.begin();
+ for (; it != mHandlers.end(); ++it)
+ (*it)->process(dt);
+ // Erase canceled handler.
+ for (it = mHandlers.begin(); it != mHandlers.end();)
+ {
+ if ((*it)->canceled)
+ {
+ Handler* h = *it;
+ it = mHandlers.erase(it);
+ delete h;
+ }
+ else
+ ++it;
+ }
}
- void Timers::every(int ms, timer_callback callback, void* p)
+ void Timer::cancel(Handler* handler)
+ {
+ if(handler != nullptr)
+ handler->canceled = true;
+ }
+
+ void Timer::cancelAll()
+ {
+ for (auto h : mHandlers)
+ cancel(h);
+ }
+
+ Timer::Handler* Timer::every(float dt, TimerCallback callback, void* p, FinishCallback finish)
{
- Timer* t = new Timer(Timer::EVERY, ms, 0, callback, p);
- timers.push_back(t);
+ Handler* t = new Handler(Handler::EVERY, dt, 0, callback, p, finish);
+ mHandlers.push_back(t);
+ return t;
}
- void Timers::after(int ms, timer_callback callback, void* p)
+ Timer::Handler* Timer::after(float dt, TimerCallback callback, void* p, FinishCallback finish)
{
- Timer* t = new Timer(Timer::AFTER, ms, 0, callback, p);
- timers.push_back(t);
+ Handler* t = new Handler(Handler::AFTER, dt, 0, callback, p, finish);
+ mHandlers.push_back(t);
+ return t;
}
- void Timers::repeat(int ms, int count, timer_callback callback, void* p)
+ Timer::Handler* Timer::repeat(float dt, int count, TimerCallback callback, void* p, FinishCallback finish)
{
- Timer* t = new Timer(Timer::REPEAT, ms, count, callback, p);
- timers.push_back(t);
+ Handler* t = new Handler(Handler::REPEAT, dt, count, callback, p, finish);
+ mHandlers.push_back(t);
+ return t;
}
- Timers::Timer::Timer(Type t, int d, int c, timer_callback f, void* p)
+ Timer::Handler::Handler(Type t, float d, int c, TimerCallback f, void* p, FinishCallback finishcallback)
: type(t)
, duration(d)
, count(c)
@@ -62,39 +81,42 @@ namespace JinEngine
, countdown(c)
, callback(f)
, paramters(p)
+ , canceled(false)
+ , finishCallback(finishcallback)
{
}
- Timers::Timer::~Timer()
+ Timer::Handler::~Handler()
{
+ if (finishCallback != nullptr)
+ finishCallback(paramters);
}
- bool Timers::Timer::process(int ms)
+ void Timer::Handler::process(float dt)
{
- tickdown -= ms;
+ tickdown -= dt;
if (tickdown <= 0)
{
- tickdown = duration;
- if (callback != nullptr)
+ tickdown += duration;
+ if (!canceled && callback != nullptr)
callback(paramters);
if (type == EVERY)
{
}
else if (type == AFTER)
{
- return false;
+ canceled = true;
}
else if (type == REPEAT)
{
--countdown;
- if (countdown <= 0)
- return false;
+ if (countdown <= 0)
+ canceled = true;
}
}
- return true;
}
} // namespace Time
} // namespace JinEngine
-#endif // defined(jin_time)
+#endif // defined(jin_time) \ No newline at end of file
diff --git a/src/libjin/Time/je_timer.h b/src/libjin/Time/je_timer.h
index b6b4b9e..31cd322 100644
--- a/src/libjin/Time/je_timer.h
+++ b/src/libjin/Time/je_timer.h
@@ -1,9 +1,11 @@
-#ifndef __JE_TIMER_H
-#define __JE_TIMER_H
+#ifndef __JE_TIMER_H__
+#define __JE_TIMER_H__
#include "../core/je_configuration.h"
#if defined(jin_time)
#include <vector>
+#include <functional>
+
#include "SDL2/SDL.h"
namespace JinEngine
@@ -14,68 +16,86 @@ namespace JinEngine
///
///
///
- class Timers
+ class Timer
{
public:
- typedef void(*timer_callback)(void* prameters);
+
+ typedef std::function<void(void*)> TimerCallback;
+
+ typedef std::function<void(void*)> FinishCallback;
///
///
///
- Timers();
+ class Handler
+ {
+ public:
+ friend class Timer;
+ enum Type
+ {
+ EVERY,
+ AFTER,
+ REPEAT,
+ };
+ Handler(Type type, float duration, int count = 0, TimerCallback callback = nullptr, void* paramters = nullptr, FinishCallback finishcallback = nullptr);
+ virtual ~Handler();
+ void process(float dt);
+
+ protected:
+ int count;
+ int countdown;
+ float duration;
+ float tickdown;
+ Type type;
+ TimerCallback callback;
+ FinishCallback finishCallback;
+ void* paramters;
+ bool canceled;
+ };
///
///
///
- ~Timers();
+ Timer();
///
///
///
- void update(int ms);
+ ~Timer();
///
///
///
- void every(int ms, timer_callback callback, void* paramters);
+ void update(float dt);
///
///
///
- void after(int ms, timer_callback callback, void* paramters);
+ Handler* every(float dt, TimerCallback callback, void* paramters, FinishCallback finish);
///
///
///
- void repeat(int ms, int count, timer_callback callback, void* paramters);
+ Handler* after(float dt, TimerCallback callback, void* paramters, FinishCallback finish);
- private:
+ ///
+ ///
+ ///
+ Handler* repeat(float dt, int count, TimerCallback callback, void* paramters, FinishCallback finish);
///
///
///
- class Timer
- {
- public:
- enum Type
- {
- EVERY,
- AFTER,
- REPEAT,
- };
- Timer(Type type, int duration, int count = 0, timer_callback callback = nullptr, void* paramters = nullptr);
- virtual ~Timer();
- bool process(int ms);
- private:
- int duration;
- int count;
- int tickdown;
- int countdown;
- Type type;
- timer_callback callback;
- void* paramters;
- };
- std::vector<Timer*> timers;
+ void cancel(Handler* handler);
+
+ ///
+ ///
+ ///
+ void cancelAll();
+
+ private:
+
+ std::vector<Handler*> mHandlers;
};
@@ -114,4 +134,4 @@ namespace JinEngine
#endif // defined(jin_time)
-#endif // __JE_TIMER_H \ No newline at end of file
+#endif // __JE_TIMER_H__ \ No newline at end of file
diff --git a/src/libjin/Utils/je_log.cpp b/src/libjin/Utils/je_log.cpp
index 2bcb25a..e369e14 100644
--- a/src/libjin/Utils/je_log.cpp
+++ b/src/libjin/Utils/je_log.cpp
@@ -1,2 +1,81 @@
#define LOGHELPER_IMPLEMENT
-#include "je_log.h" \ No newline at end of file
+#include "je_log.h"
+
+#define hasbit(flag, bit) ((flag & bit) == bit)
+
+unsigned int Loghelper::dir = Loghelper::Direction::DIR_CERR;
+unsigned int Loghelper::levels = Loghelper::Level::LV_ALL;
+std::ofstream Loghelper::fs;
+
+void Loghelper::log(Level _level, const char* _fmt, ...)
+{
+ if (!hasbit(levels, _level))
+ return;
+#define FORMAT_MSG_BUFFER_SIZE (204800)
+ const char* levelStr = nullptr;
+ switch (_level)
+ {
+ case LV_ERROR:
+ levelStr = "[Jin Error]: ";
+ break;
+ case LV_WARNING:
+ levelStr = "[Jin Warning]: ";
+ break;
+ case LV_INFO:
+ levelStr = "[Jin Info]: ";
+ break;
+ case LV_DEBUG:
+ levelStr = "[Jin Debug]: ";
+ break;
+ default:
+ levelStr = "[Jin Unknow]: ";
+ break;
+ }
+ char buffer[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
+ strcpy(buffer, levelStr);
+ va_list args;
+ va_start(args, _fmt);
+ vsnprintf(buffer + strlen(buffer), FORMAT_MSG_BUFFER_SIZE, _fmt, args);
+ va_end(args);
+ if (hasbit(dir, DIR_CERR))
+ {
+ std::cerr << buffer << std::endl;
+ }
+ if (hasbit(dir, DIR_FILE))
+ {
+ fs << buffer << std::endl;
+ }
+#undef FORMAT_MSG_BUFFER_SIZE
+}
+
+// ض
+void Loghelper::redirect(unsigned int _dir, char* _path)
+{
+ dir = _dir;
+ if (hasbit(dir, DIR_FILE))
+ {
+ try
+ {
+ fs.open(_path, std::ios_base::app);
+ }
+ catch (std::ios_base::failure& e) {
+ dir = DIR_CERR;
+ log(Level::LV_WARNING, "ضlog· %s ʧ", _path);
+ }
+ }
+}
+
+// ɸѡȼ
+void Loghelper::restrict(unsigned int _levels)
+{
+ levels = _levels;
+}
+
+void Loghelper::close()
+{
+ if (!fs.fail())
+ fs.close();
+ fs.clear();
+}
+
+#undef hasbit
diff --git a/src/libjin/Utils/je_log.h b/src/libjin/Utils/je_log.h
index 928a009..f81bbae 100644
--- a/src/libjin/Utils/je_log.h
+++ b/src/libjin/Utils/je_log.h
@@ -1,11 +1,13 @@
-#ifndef __LOG_HELPER_H
-#define __LOG_HELPER_H
+#ifndef __LOG_H__ELPER_H__
+#define __LOG_H__ELPER_H__
#include <string>
#include <iostream>
#include <fstream>
#include <stdarg.h>
+#include "../core/je_configuration.h"
+
class Loghelper
{
public:
@@ -21,7 +23,7 @@ public:
{
LV_NONE = 0, // none
LV_ERROR = 1 << 1, // error
- LV_WARN = 1 << 2, // warn
+ LV_WARNING = 1 << 2, // warn
LV_INFO = 1 << 3, // info
LV_DEBUG = 1 << 4, // debug
LV_ALL = 0xffffffff
@@ -43,89 +45,19 @@ private:
static std::ofstream fs; // ļ
};
-typedef Loghelper::Level Loglevel;
-
-#ifdef LOGHELPER_IMPLEMENT
-
-#define hasbit(flag, bit) ((flag & bit) == bit)
-
-unsigned int Loghelper::dir = Loghelper::Direction::DIR_CERR;
-unsigned int Loghelper::levels = Loghelper::Level::LV_ALL;
-std::ofstream Loghelper::fs;
-
-void Loghelper::log(Level _level, const char* _fmt, ...)
-{
- if (!hasbit(levels, _level))
- return;
-#define FORMAT_MSG_BUFFER_SIZE (204800)
- const char* levelStr = nullptr;
- switch (_level)
- {
- case LV_ERROR:
- levelStr = "[Jin Error]:";
- break;
- case LV_WARN:
- levelStr = "[Jin Warn]:";
- break;
- case LV_INFO:
- levelStr = "[Jin Info]:";
- break;
- case LV_DEBUG:
- levelStr = "[Jin Debug]:";
- break;
- default:
- levelStr = "[Jin Unknown]:";
- break;
- }
- char buffer[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
- strcpy(buffer, levelStr);
- va_list args;
- va_start(args, _fmt);
- vsnprintf(buffer + strlen(buffer), FORMAT_MSG_BUFFER_SIZE, _fmt, args);
- va_end(args);
- if (hasbit(dir, DIR_CERR))
- {
- std::cerr << buffer << std::endl;
- }
- if (hasbit(dir, DIR_FILE))
- {
- fs << buffer << std::endl;
- }
-#undef FORMAT_MSG_BUFFER_SIZE
-}
-// ض
-void Loghelper::redirect(unsigned int _dir, char* _path)
-{
- dir = _dir;
- if (hasbit(dir, DIR_FILE))
- {
- try
- {
- fs.open(_path, std::ios_base::app);
- }
- catch (std::ios_base::failure& e) {
- dir = DIR_CERR;
- log(Level::LV_WARN, "ضlog· %s ʧ", _path);
- }
- }
-}
-
-// ɸѡȼ
-void Loghelper::restrict(unsigned int _levels)
-{
- levels = _levels;
-}
-
-void Loghelper::close()
-{
- if (!fs.fail())
- fs.close();
- fs.clear();
-}
-
-#undef hasbit
-
-#endif
+typedef Loghelper::Level Loglevel;
-#endif \ No newline at end of file
+#if defined(jin_debug)
+ #define jin_log_error(f, ...) Loghelper::log(Loghelper::LV_ERROR, f, __VA_ARGS__)
+ #define jin_log_info(f, ...) Loghelper::log(Loghelper::LV_INFO, f, __VA_ARGS__)
+ #define jin_log_warning(f, ...) Loghelper::log(Loghelper::LV_WARNING, f, __VA_ARGS__)
+ #define jin_log_debug(f, ...) Loghelper::log(Loghelper::LV_DEBUG, f, __VA_ARGS__)
+#else
+ #define jin_log_error(f, ...)
+ #define jin_log_info(f, ...)
+ #define jin_log_warning(f, ...)
+ #define jin_log_debug(f, ...)
+#endif
+
+#endif // __LOG_H__ELPER_H__ \ No newline at end of file
diff --git a/src/libjin/Utils/je_macros.h b/src/libjin/Utils/je_macros.h
index 475a482..6e4e7a9 100644
--- a/src/libjin/Utils/je_macros.h
+++ b/src/libjin/Utils/je_macros.h
@@ -1,5 +1,5 @@
-#ifndef __JE_MACROS_H
-#define __JE_MACROS_H
+#ifndef __JE_MACROS_H__
+#define __JE_MACROS_H__
#include <cstring>
//#define implement // ʵֽӿ
diff --git a/src/libjin/Utils/je_utils.h b/src/libjin/Utils/je_utils.h
index 21c507d..a77c126 100644
--- a/src/libjin/Utils/je_utils.h
+++ b/src/libjin/Utils/je_utils.h
@@ -1,5 +1,5 @@
-#ifndef __JE_UTILS_H
-#define __JE_UTILS_H
+#ifndef __JE_UTILS_H__
+#define __JE_UTILS_H__
#include "je_macros.h"
#include "je_endian.h"
diff --git a/src/libjin/ai/je_ai.h b/src/libjin/ai/je_ai.h
new file mode 100644
index 0000000..57debce
--- /dev/null
+++ b/src/libjin/ai/je_ai.h
@@ -0,0 +1,10 @@
+#ifndef __JE_AI_H__
+#define __JE_AI_H__
+
+// Decision Making
+#include "je_state_machine.h"
+#include "je_behavior_tree.h"
+
+//
+
+#endif \ No newline at end of file
diff --git a/src/libjin/ai/je_behavior_tree.h b/src/libjin/ai/je_behavior_tree.h
index 6e276b6..173df80 100644
--- a/src/libjin/ai/je_behavior_tree.h
+++ b/src/libjin/ai/je_behavior_tree.h
@@ -1,24 +1,59 @@
-#ifndef __JE_BEHAVIOR_TREE_H
-#define __JE_BEHAVIOR_TREE_H
+#ifndef __JE_BEHAVIOR_TREE_H__
+#define __JE_BEHAVIOR_TREE_H__
#include "../core/je_configuration.h"
#if defined(jin_ai)
+#include <functional>
+
namespace JinEngine
{
namespace AI
{
-
+
///
///
///
class BehaviorTree
{
+ public:
+ BehaviorTree(void* userData) : mUserData(userData){}
+
+ class Node
+ {
+ public:
+ enum Type
+ {
+
+ };
+
+ enum Status
+ {
+ Running,
+ Success,
+ Failure
+ };
+
+ Status status;
+ };
+
+ typedef std::function<Node::Status(void*)> UpdateCallback;
+
+ Node makeNode(Node::Type type, UpdateCallback callback);
+
+ private:
+
+ ///
+ ///
+ ///
+ void* const mUserData;
};
- }
-}
+ typedef BehaviorTree::Node::Status BahaviorNodeStatus;
+
+ } // namespace AI
+} // namespace JinEngine
#endif // jin_ai
diff --git a/src/libjin/ai/je_state_machine.cpp b/src/libjin/ai/je_state_machine.cpp
index e69de29..6208265 100644
--- a/src/libjin/ai/je_state_machine.cpp
+++ b/src/libjin/ai/je_state_machine.cpp
@@ -0,0 +1,445 @@
+#include "je_state_machine.h"
+
+#include "../utils/je_log.h"
+
+using namespace std;
+
+namespace JinEngine
+{
+ namespace AI
+ {
+
+ StateMachine::StateMachine(Mode mode, void* userdata)
+ : mCurrentState(0)
+ , mUserData(userdata)
+ , mMode(mode)
+ {
+ addState(0);
+ }
+
+ StateMachine::~StateMachine()
+ {
+ }
+
+ void StateMachine::invokeCallback(int from, int to)
+ {
+ if (mExitCallback != nullptr)
+ mExitCallback(from, mUserData);
+ if (mTraslateCallback != nullptr)
+ mTraslateCallback(from, to, mUserData);
+ if (mEnterCallback != nullptr)
+ mEnterCallback(to, mUserData);
+ map<int, StateChangeCallback>::iterator it = mOnExitState.find(from);
+ if (it != mOnExitState.end())
+ it->second(mUserData);
+ map<pair<int, int>, StateTranslateCallback>::iterator transItr
+ = mOnStateTranslate.find(pair<int, int>(from, to));
+ if (transItr != mOnStateTranslate.end())
+ transItr->second(mUserData);
+ it = mOnEnterState.find(to);
+ if (it != mOnEnterState.end())
+ it->second(mUserData);
+ }
+
+ void StateMachine::stepwiseProcess()
+ {
+ map<int, State>::iterator it = mStates.find(mCurrentState);
+ if (it == mStates.end())
+ {
+ jin_log_error("The state [%d] is not exist.", mCurrentState);
+ return;
+ }
+ State& state = it->second;
+ for (int i = 0; i < state.transitions.size(); ++i)
+ {
+ Conditions conditions = state.transitions[i].conditions;
+ bool isActive = true;
+ for (int j = 0; j < conditions.conditions.size(); ++j)
+ {
+ isActive &= processCondition(conditions.conditions[j]);
+ if (!isActive)
+ break;
+ }
+ if (isActive)
+ {
+ // Traslate
+ mCurrentState = state.transitions[i].state;
+ invokeCallback(state.name, mCurrentState);
+ break;
+ }
+ }
+ // Call update
+ if (mUpdateCallback != nullptr)
+ mUpdateCallback(mCurrentState, mUserData);
+ map<int, StateUpdateCallback>::iterator uit = mOnUpdateState.find(mCurrentState);
+ if (uit != mOnUpdateState.end())
+ uit->second(mUserData);
+ }
+
+ void StateMachine::iterativeProcess()
+ {
+ map<int, State>::iterator it = mStates.find(mCurrentState);
+ if (it == mStates.end())
+ {
+ jin_log_error("The state [%d] is not exist.", mCurrentState);
+ return;
+ }
+ State& state = it->second;
+ bool isActive = true;
+ for (int i = 0; i < state.transitions.size(); ++i)
+ {
+ Conditions conditions = state.transitions[i].conditions;
+ isActive = true;
+ for (int j = 0; j < conditions.conditions.size(); ++j)
+ {
+ isActive &= processCondition(conditions.conditions[j]);
+ if (!isActive)
+ break;
+ }
+ if (isActive)
+ {
+ // Traslate
+ mCurrentState = state.transitions[i].state;
+ invokeCallback(state.name, mCurrentState);
+ break;
+ }
+ }
+ // Call update
+ if (mUpdateCallback != nullptr)
+ mUpdateCallback(mCurrentState, mUserData);
+ map<int, StateUpdateCallback>::iterator uit = mOnUpdateState.find(mCurrentState);
+ if (uit != mOnUpdateState.end())
+ uit->second(mUserData);
+ // Recursive.
+ if(isActive)
+ return iterativeProcess();
+ }
+
+ void StateMachine::setMode(Mode mode)
+ {
+ mMode = mode;
+ }
+
+ void StateMachine::update()
+ {
+ switch (mMode)
+ {
+ case Mode::Iterative: iterativeProcess(); break;
+ case Mode::Stepwise: stepwiseProcess(); break;
+ }
+ }
+
+ bool StateMachine::processCondition(const Condition& condition)
+ {
+ map<int, Parameter>::iterator it = mParameters.find(condition.parameter);
+ if (it == mParameters.end())
+ {
+ jin_log_error("The parameter <%d> is not exist", condition.parameter);
+ return false;
+ }
+ Parameter& p = it->second;
+ switch (p.type)
+ {
+ case ParameterType::Int:
+ {
+ int value = p.value._int;
+ int cvalue = condition.value._int;
+ bool is = false;
+ is |= ((condition.expression & ParameterExpression::INT_GREATER) ? value > cvalue : false);
+ is |= ((condition.expression & ParameterExpression::INT_EQUAL) ? value == cvalue : false);
+ is |= ((condition.expression & ParameterExpression::INT_LESS) ? value < cvalue : false);
+ return is;
+ }
+ case ParameterType::Float:
+ {
+ float value = p.value._float;
+ float cvalue = condition.value._float;
+ bool is = false;
+ is |= ((condition.expression & ParameterExpression::FLOAT_GREATER) ? value > cvalue : false);
+ is |= ((condition.expression & ParameterExpression::FLOAT_EQUAL) ? value == cvalue : false);
+ is |= ((condition.expression & ParameterExpression::FLOAT_LESS) ? value < cvalue : false);
+ return is;
+ }
+ case ParameterType::Bool:
+ {
+ bool value = p.value._bool;
+ bool cvalue = condition.value._bool;
+ bool is = false;
+ is |= ((condition.expression & ParameterExpression::BOOL_IS) ? value == cvalue : false);
+ is |= ((condition.expression & ParameterExpression::BOOL_NOT) ? value != cvalue : false);
+ return is;
+ }
+ case ParameterType::Trigger:
+ {
+ bool is = p.value._trigger;
+ // Close trigger.
+ p.value._trigger = false;
+ return is;
+ }
+ }
+ return false;
+ }
+
+ int StateMachine::getCurrentState()
+ {
+ return mCurrentState;
+ }
+
+ void StateMachine::addParameteri(int name)
+ {
+ if (mParameters.find(name) != mParameters.end())
+ {
+ jin_log_error("The parameter <%d> is already exist.", name);
+ return;
+ }
+ Parameter p;
+ p.type = ParameterType::Int;
+ p.value._int = 0;
+ mParameters.insert(pair<int, Parameter>(name, p));
+ }
+
+ void StateMachine::addParameterf(int name)
+ {
+ if (mParameters.find(name) != mParameters.end())
+ {
+ jin_log_error("The parameter <%d> is already exist.", name);
+ return;
+ }
+ Parameter p;
+ p.type = ParameterType::Float;
+ p.value._float = 0.0f;
+ mParameters.insert(pair<int, Parameter>(name, p));
+ }
+
+ void StateMachine::addParameterb(int name)
+ {
+ if (mParameters.find(name) != mParameters.end())
+ {
+ jin_log_error("The parameter <%d> is already exist.", name);
+ return;
+ }
+ Parameter p;
+ p.type = ParameterType::Bool;
+ p.value._bool = false;
+ mParameters.insert(pair<int, Parameter>(name, p));
+ }
+
+ void StateMachine::addParametert(int name)
+ {
+ if (mParameters.find(name) != mParameters.end())
+ {
+ jin_log_error("The parameter <%d> is already exist.", name);
+ return;
+ }
+ Parameter p;
+ p.type = ParameterType::Trigger;
+ p.value._trigger = false;
+ mParameters.insert(pair<int, Parameter>(name, p));
+ }
+
+ void StateMachine::addState(int name)
+ {
+ if (mStates.find(name) != mStates.end())
+ {
+ jin_log_error("The state [%d] is already exist.", name);
+ return;
+ }
+ State state;
+ state.name = name;
+ mStates.insert(pair<int, State>(name, state));
+ }
+
+ const char* StateMachine::parameterTypeString(ParameterType type)
+ {
+ switch (type)
+ {
+ case ParameterType::Int: return "int";
+ case ParameterType::Float: return "float";
+ case ParameterType::Bool: return "bool";
+ case ParameterType::Trigger: return "trigger";
+ }
+ }
+
+ void StateMachine::addTransition(int from, int to, const Conditions& conditions)
+ {
+ map<int, State>::iterator it;
+ it = mStates.find(from);
+ if (it == mStates.end())
+ {
+ jin_log_error("The state [%d] is not exist.", from);
+ return;
+ }
+ State& fromState = it->second;
+ it = mStates.find(to);
+ if (it == mStates.end())
+ {
+ jin_log_error("The state [%d] is not exist.", to);
+ return;
+ }
+ // Check condtion correctness.
+ for (int i = 0; i < conditions.conditions.size(); ++i)
+ {
+ const Condition& condition = conditions.conditions[i];
+ map<int, Parameter>::iterator itp;
+ itp = mParameters.find(condition.parameter);
+ if (itp == mParameters.end())
+ {
+ jin_log_error("The parameter <%d> is not exist.", condition.parameter);
+ return;
+ }
+ Parameter& p = itp->second;
+ if (p.type != condition.type)
+ {
+ jin_log_error("The type of parameter <%d> is a %s, but the transition gives a %s value."
+ , condition.parameter, parameterTypeString(p.type), parameterTypeString(condition.type));
+ return;
+ }
+ }
+ // Add transition.
+ Transition transition;
+ transition.conditions = conditions;
+ transition.state = to;
+ fromState.transitions.push_back(transition);
+ }
+
+ void StateMachine::setParameteri(int name, int value)
+ {
+ map<int, Parameter>::iterator it = mParameters.find(name);
+ if (it == mParameters.end())
+ {
+ jin_log_error("The state [%d] is not exist.", name);
+ return;
+ }
+ Parameter& p = it->second;
+ if (p.type != ParameterType::Int)
+ {
+ jin_log_error("The type of parameter <%d> is %s, but try to assign a int value to it", name, parameterTypeString(p.type));
+ return;
+ }
+ p.value._int = value;
+ }
+
+ void StateMachine::setParameterf(int name, float value)
+ {
+ map<int, Parameter>::iterator it = mParameters.find(name);
+ if (it == mParameters.end())
+ {
+ jin_log_error("The state [%d] is not exist.", name);
+ return;
+ }
+ Parameter& p = it->second;
+ if (p.type != ParameterType::Float)
+ {
+ jin_log_error("The type of parameter <%d> is %s, but try to assign a float value to it", name, parameterTypeString(p.type));
+ return;
+ }
+ p.value._float = value;
+ }
+
+ void StateMachine::setParameterb(int name, bool value)
+ {
+ map<int, Parameter>::iterator it = mParameters.find(name);
+ if (it == mParameters.end())
+ {
+ jin_log_error("The state %s is not exist.", name);
+ return;
+ }
+ Parameter& p = it->second;
+ if (p.type != ParameterType::Bool)
+ {
+ jin_log_error("The type of parameter <%d> is %s, but try to assign a bool value to it", name, parameterTypeString(p.type));
+ return;
+ }
+ p.value._bool = value;
+ }
+
+ void StateMachine::setParametert(int name)
+ {
+ map<int, Parameter>::iterator it = mParameters.find(name);
+ if (it == mParameters.end())
+ {
+ jin_log_error("The state %s is not exist.", name);
+ return;
+ }
+ Parameter& p = it->second;
+ if (p.type != ParameterType::Trigger)
+ {
+ jin_log_error("The type of parameter <%d> is %s, but try to assign a trigger value to it", name, parameterTypeString(p.type));
+ return;
+ }
+ p.value._trigger = true;
+ }
+
+ void StateMachine::forceToState(int name)
+ {
+ if (mStates.find(name) == mStates.end())
+ {
+ jin_log_error("The state [%d] is not exist.", name);
+ return;
+ }
+ mCurrentState = name;
+ }
+
+ void StateMachine::addEnterListener(int state, const StateChangeCallback& callback)
+ {
+ if (mOnEnterState.find(state) != mOnEnterState.end())
+ {
+ jin_log_error("The enter listener of [%d] is already exist.", state);
+ return;
+ }
+ mOnEnterState.insert(pair<int, StateChangeCallback>(state, callback));
+ }
+
+ void StateMachine::addUpdateListener(int state, const StateUpdateCallback& callback)
+ {
+ if (mOnUpdateState.find(state) != mOnUpdateState.end())
+ {
+ jin_log_error("The update listener of [%d] is already exist.", state);
+ return;
+ }
+ mOnUpdateState.insert(pair<int, StateUpdateCallback>(state, callback));
+ }
+
+ void StateMachine::addExitListener(int state, const StateChangeCallback& callback)
+ {
+ if (mOnExitState.find(state) != mOnExitState.end())
+ {
+ jin_log_error("The exit listener of [%d] is already exist.", state);
+ return;
+ }
+ mOnExitState.insert(pair<int, StateChangeCallback>(state, callback));
+ }
+
+ void StateMachine::addTranslateListener(int from, int to, const StateChangeCallback& callback)
+ {
+ if (mOnStateTranslate.find(pair<int, int>(from, to)) != mOnStateTranslate.end())
+ {
+ jin_log_error("The traslate listener of [%d] to [%d] is already exist.", from, to);
+ return;
+ }
+ pair<int, int> key(from, to);
+ mOnStateTranslate.insert(pair<pair<int, int>, StateTranslateCallback>(key, callback));
+ }
+
+ void StateMachine::setUpdateListener(const SingleStateCallback& callback)
+ {
+ mUpdateCallback = callback;
+ }
+
+ void StateMachine::setEnterListener(const SingleStateCallback& callback)
+ {
+ mEnterCallback = callback;
+ }
+
+ void StateMachine::setExitListener(const SingleStateCallback& callback)
+ {
+ mExitCallback = callback;
+ }
+
+ void StateMachine::setTranslateListener(const DoubleStateCallback& callback)
+ {
+ mTraslateCallback = callback;
+ }
+
+ } // namespace AI
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/ai/je_state_machine.h b/src/libjin/ai/je_state_machine.h
index 7869925..c928989 100644
--- a/src/libjin/ai/je_state_machine.h
+++ b/src/libjin/ai/je_state_machine.h
@@ -1,24 +1,413 @@
-#ifndef __JE_STATEMACHINE_TREE_H
-#define __JE_STATEMACHINE_TREE_H
+#ifndef __JE_STATE_MACHINE_H__
+#define __JE_STATE_MACHINE_H__
#include "../core/je_configuration.h"
#if defined(jin_ai)
+#include <map>
+#include <vector>
+#include <functional>
+
+#include "../common/je_temporary.h"
+#include "../common/je_types.h"
+#include "../common/je_object.h"
+
namespace JinEngine
{
namespace AI
{
///
+ /// A single layer statemachine.
///
- ///
- class StateMachine
+ class StateMachine : public Object
{
+ public:
+ ///
+ ///
+ ///
+ enum ParameterExpression
+ {
+ INT_GREATER = 0x02,
+ INT_LESS = 0x04,
+ INT_EQUAL = 0x08,
+
+ FLOAT_GREATER = 0x10,
+ FLOAT_LESS = 0x20,
+ FLOAT_EQUAL = 0x40,
+
+ BOOL_IS = 0x80,
+ BOOL_NOT = 0x100,
+ };
+
+ private:
+ ///
+ ///
+ ///
+ enum ParameterType
+ {
+ Int, ///< A integer value.
+ Float, ///< A float value.
+ Bool, ///< A bool value.
+ Trigger ///< A trigger will be reset to false after activated.
+ };
+
+ ///
+ ///
+ ///
+ union ParameterValue
+ {
+ int _int; ///< 0 by default.
+ float _float; ///< 0 by default.
+ bool _bool; ///< false by default.
+ bool _trigger; ///< false by default.
+ };
+
+ ///
+ /// Traslation's condition.
+ ///
+ struct Condition
+ {
+ int parameter;
+ ParameterExpression expression;
+ ParameterType type;
+ ParameterValue value;
+ };
+
+ public:
+ ///
+ ///
+ ///
+ enum Mode
+ {
+ Iterative, ///< Process until reach condition failed.(May cause endless loop)
+ Stepwise ///< Process one state each update.
+ };
+
+ struct Conditions : Temporary
+ {
+ Conditions()
+ {
+ }
+
+ Conditions(const Conditions& condition)
+ {
+ conditions = condition.conditions;
+ }
+
+ void operator = (const Conditions& condition)
+ {
+ conditions = condition.conditions;
+ }
+
+ inline Conditions& andi(int parameter, ParameterExpression expression, int value)
+ {
+ Condition condition;
+ condition.expression = expression;
+ condition.parameter = parameter;
+ condition.value._int = value;
+ condition.type = ParameterType::Int;
+ conditions.push_back(condition);
+ return *this;
+ }
+
+ inline Conditions& andf(int parameter, ParameterExpression expression , float value)
+ {
+ Condition condition;
+ condition.expression = expression;
+ condition.parameter = parameter;
+ condition.value._int = value;
+ condition.type = ParameterType::Float;
+ conditions.push_back(condition);
+ return *this;
+ }
+
+ inline Conditions& andb(int parameter, ParameterExpression expression, bool value)
+ {
+ Condition condition;
+ condition.expression = expression;
+ condition.parameter = parameter;
+ condition.value._int = value;
+ condition.type = ParameterType::Bool;
+ conditions.push_back(condition);
+ return *this;
+ }
+
+ inline Conditions& andt(int parameter)
+ {
+ Condition condition;
+ condition.parameter = parameter;
+ condition.type = ParameterType::Trigger;
+ conditions.push_back(condition);
+ return *this;
+ }
+
+ private:
+ friend class StateMachine;
+ std::vector<Condition> conditions;
+ };
+
+ ///
+ ///
+ ///
+ typedef std::function<void(void*)> StateChangeCallback;
+
+ ///
+ ///
+ ///
+ typedef std::function<void(void*)> StateUpdateCallback;
+
+ ///
+ ///
+ ///
+ typedef std::function<void(void*)> StateTranslateCallback;
+
+ ///
+ ///
+ ///
+ typedef std::function<void(int, void*)> SingleStateCallback;
+
+ ///
+ ///
+ ///
+ typedef std::function<void(int, const int, void*)> DoubleStateCallback;
+
+ ///
+ /// State machine constructor.
+ ///
+ StateMachine(Mode mode = Mode::Stepwise, void* userdata = nullptr);
+
+ ///
+ /// State machine destructor.
+ ///
+ ~StateMachine();
+
+ ///
+ ///
+ ///
+ void setMode(Mode mode);
+
+ ///
+ /// Process current state..
+ ///
+ void update();
+
+ ///
+ /// Get current state name.
+ ///
+ int getCurrentState();
+
+ ///
+ /// Add a integer parameter.
+ ///
+ void addParameteri(int name);
+
+ ///
+ ///
+ ///
+ void addParameterf(int name);
+
+ ///
+ ///
+ ///
+ void addParameterb(int name);
+
+ ///
+ ///
+ ///
+ void addParametert(int name);
+
+ ///
+ /// Add a state.
+ ///
+ void addState(int name);
+
+ ///
+ ///
+ ///
+ void addTransition(int from, int to, const Conditions& conditions);
+
+ ///
+ /// Set parameter value.
+ ///
+ void setParameteri(int name, int value);
+
+ ///
+ /// Set parameter value.
+ ///
+ void setParameterf(int name, float value);
+
+ ///
+ /// Set parameter value.
+ ///
+ void setParameterb(int name, bool value);
+
+ ///
+ /// Set parameter value.
+ ///
+ void setParametert(int name);
+
+ ///
+ /// Force change to state.
+ ///
+ void forceToState(int name);
+
+ ///
+ ///
+ ///
+ void addEnterListener(int state, const StateChangeCallback& callback);
+
+ ///
+ /// Call state update function.
+ ///
+ void addUpdateListener(int state, const StateUpdateCallback& callback);
+
+ ///
+ ///
+ ///
+ void addExitListener(int state, const StateChangeCallback& callback);
+
+ ///
+ ///
+ ///
+ void addTranslateListener(int from, int to, const StateChangeCallback& callback);
+
+ ///
+ ///
+ ///
+ void setEnterListener(const SingleStateCallback& callback);
+
+ ///
+ ///
+ ///
+ void setUpdateListener(const SingleStateCallback& callback);
+
+ ///
+ ///
+ ///
+ void setExitListener(const SingleStateCallback& callback);
+
+ ///
+ ///
+ ///
+ void setTranslateListener(const DoubleStateCallback& callback);
+
+ private:
+
+ ///
+ ///
+ ///
+ struct Parameter
+ {
+ ParameterType type;
+ ParameterValue value;
+ };
+
+ ///
+ /// Translate to another state.
+ ///
+ struct Transition
+ {
+ Conditions conditions; ///< Condition to active transition.
+ int state; ///< State to translate to.
+ };
+
+ ///
+ /// A single state.
+ ///
+ struct State
+ {
+ int name; ///< Name of state.
+ std::vector<Transition> transitions; ///< All transitions this state have.
+ };
+
+ const char* parameterTypeString(ParameterType type);
+
+ ///
+ /// Check if condition is full filled.
+ ///
+ /// @param condition Condition to check.
+ ///
+ bool processCondition(const Condition& condition);
+
+ ///
+ ///
+ ///
+ void stepwiseProcess();
+
+ ///
+ ///
+ ///
+ void iterativeProcess();
+
+ ///
+ ///
+ ///
+ void invokeCallback(int from, int to);
+
+ ///
+ /// All state this state machine keeps.
+ ///
+ std::map<int, State> mStates;
+
+ ///
+ ///
+ ///
+ std::map<int, StateChangeCallback> mOnEnterState;
+
+ ///
+ ///
+ ///
+ std::map<int, StateUpdateCallback> mOnUpdateState;
+
+ ///
+ ///
+ ///
+ std::map<int, StateChangeCallback> mOnExitState;
+
+ ///
+ /// From first to second.
+ ///
+ std::map<std::pair<int, int>, StateTranslateCallback> mOnStateTranslate;
+
+ ///
+ ///
+ ///
+ SingleStateCallback mEnterCallback;
+
+ ///
+ ///
+ ///
+ SingleStateCallback mUpdateCallback;
+
+ ///
+ ///
+ ///
+ SingleStateCallback mExitCallback;
+
+ ///
+ ///
+ ///
+ DoubleStateCallback mTraslateCallback;
+
+ ///
+ /// Current state.
+ ///
+ int mCurrentState;
+
+ ///
+ /// All parameters.
+ ///
+ std::map<int, Parameter> mParameters;
+
+ Mode mMode;
+
+ void* const mUserData;
};
- }
-}
+ } // namespace Graphics
+} // namespace JinEngine
#endif // jin_ai
diff --git a/src/libjin/core/je_configuration.h b/src/libjin/core/je_configuration.h
index 34c3a74..80e2748 100644
--- a/src/libjin/core/je_configuration.h
+++ b/src/libjin/core/je_configuration.h
@@ -1,8 +1,11 @@
-#ifndef __JE_COMMON_MODULES_H
-#define __JE_COMMON_MODULES_H
+#ifndef __JE_COMMON_MODULES_H__
+#define __JE_COMMON_MODULES_H__
#define jin_undefined 0x00
+///
+/// Debug output
+///
#define jin_debug
#define jin_os_windows 0x01
@@ -50,4 +53,6 @@
#define jin_ai
-#endif // __JE_COMMON_MODULES_H \ No newline at end of file
+#define JIN_EXPORT __declspec(dllexport)
+
+#endif // __JE_COMMON_MODULES_H__ \ No newline at end of file
diff --git a/src/libjin/core/je_version.h b/src/libjin/core/je_version.h
index 77302c6..b5fe379 100644
--- a/src/libjin/core/je_version.h
+++ b/src/libjin/core/je_version.h
@@ -1,5 +1,5 @@
-#ifndef __JE_CORE_VERSION_H
-#define __JE_CORE_VERSION_H
+#ifndef __JE_CORE_VERSION_H__
+#define __JE_CORE_VERSION_H__
namespace JinEngine
{
@@ -49,4 +49,4 @@ namespace JinEngine
} // namespace Core
} // namespace JinEngine
-#endif // __JE_CORE_VERSION_H \ No newline at end of file
+#endif // __JE_CORE_VERSION_H__
diff --git a/src/libjin/jin.h b/src/libjin/jin.h
index b47a56d..8164511 100644
--- a/src/libjin/jin.h
+++ b/src/libjin/jin.h
@@ -1,5 +1,5 @@
-#ifndef __JE_H
-#define __JE_H
+#ifndef __JE_H__
+#define __JE_H__
#include "core/je_configuration.h"
@@ -7,14 +7,15 @@
#if jin_audio == jin_audio_sdl
#include "audio/sdl/je_sdl_audio.h"
#endif
-#include "game/je_game.h"
+#include "game/je_application.h"
#include "filesystem/je_asset_database.h"
#include "filesystem/je_buffer.h"
#include "input/je_input.h"
#include "net/je_net_manager.h"
#include "graphics/je_graphics.h"
#include "time/je_timer.h"
-#include "multithread/je_thread.h"
+#include "threads/je_thread.h"
#include "common/je_common.h"
+#include "ai/je_ai.h"
-#endif // __JE_H \ No newline at end of file
+#endif // __JE_H__ \ No newline at end of file
diff --git a/src/libjin/multithread/je_thread.cpp b/src/libjin/multithread/je_thread.cpp
deleted file mode 100644
index 0c528bf..0000000
--- a/src/libjin/multithread/je_thread.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-#include "../core/je_configuration.h"
-#if defined(jin_thread)
-
-#include "je_thread.h"
-
-namespace JinEngine
-{
- namespace MultiThread
- {
-
- class Mutex
- {
- public:
- Mutex();
- ~Mutex();
-
- void lock();
- void unlock();
- private:
- #if jin_thread == jin_thread_sdl
- SDL_mutex* mutex;
- #endif
- friend class Conditional;
- };
-
- // ̼߳signal wait
- class Conditional
- {
- public:
- Conditional();
- ~Conditional();
- void signal();
- void broadcast();
- bool wait(Mutex* mutex, int timeout = -1);
- private:
- #if jin_thread == jin_thread_sdl
- SDL_cond* cond;
- #endif
- };
-
- class Lock
- {
- public:
- Lock(Mutex* m) : mutex(m) {
- mutex->lock();
- }
-
- Lock(Mutex& m) : mutex(&m) {
- mutex->lock();
- }
-
- ~Lock() {
- mutex->unlock();
- }
- private:
- Mutex* mutex;
-
- Lock(Lock&) {}
-
- };
-
- //////////////////////////////////////////////////////////////////////
-
- Mutex::Mutex()
- {
- #if jin_thread == jin_thread_sdl
- mutex = SDL_CreateMutex();
- #endif
- }
-
- Mutex::~Mutex()
- {
- #if jin_thread == jin_thread_sdl
- SDL_DestroyMutex(mutex);
- #endif
- }
-
- void Mutex::lock()
- {
- #if jin_thread == jin_thread_sdl
- SDL_LockMutex(mutex);
- #endif
- }
-
- void Mutex::unlock()
- {
- #if jin_thread == jin_thread_sdl
- SDL_UnlockMutex(mutex);
- #endif
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Conditional::Conditional()
- {
- #if jin_thread == jin_thread_sdl
- cond = SDL_CreateCond();
- #endif
- }
-
- Conditional::~Conditional()
- {
- #if jin_thread == jin_thread_sdl
- SDL_DestroyCond(cond);
- #endif
- }
-
- void Conditional::signal()
- {
- #if jin_thread == jin_thread_sdl
- SDL_CondSignal(cond);
- #endif
- }
-
- void Conditional::broadcast()
- {
- #if jin_thread == jin_thread_sdl
- SDL_CondBroadcast(cond);
- #endif
- }
-
- bool Conditional::wait(Mutex* mutex, int timeout)
- {
- #if jin_thread == jin_thread_sdl
- if (timeout < 0)
- return !SDL_CondWait(cond, mutex->mutex);
- else
- return (SDL_CondWaitTimeout(cond, mutex->mutex, timeout) == 0);
- #endif
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Thread::ThreadData::ThreadData(Mutex* m, Conditional* c)
- : mutex(m)
- , condition(c)
- , share()
- {
- }
-
- Thread::ThreadData::~ThreadData()
- {
- }
-
- void Thread::ThreadData::set(int slot, Variant value)
- {
- Lock l(mutex);
- share[slot] = value;
- }
-
- Thread::Variant Thread::ThreadData::get(int slot)
- {
- Lock l(mutex);
- return share[slot];
- }
-
- bool Thread::ThreadData::exist(int slot)
- {
- Lock l(mutex);
- return share.count(slot) == 1;
- }
-
- void Thread::ThreadData::remove(int slot)
- {
- Lock l(mutex);
- if (exist(slot))
- {
- share.erase(slot);
- }
- }
-
- //////////////////////////////////////////////////////////////////////
-
- Thread::Thread(const std::string tname, ThreadRunner runner)
- : name(tname)
- , running(false)
- , threadRunner(runner)
- {
- mutex = new Mutex();
- condition = new Conditional();
- common = new Thread::ThreadData(mutex, condition);
- }
-
- Thread::~Thread()
- {
- #if jin_thread == jin_thread_sdl
- #endif
- }
-
- const char* Thread::getName()
- {
- Lock l(mutex);
- return name.c_str();
- };
-
- bool Thread::isRunning()
- {
- Lock l(mutex);
- return running;
- };
-
- bool Thread::start(void* p)
- {
- Lock l(mutex);
- if (running)
- return false;
- if (handle)
- {
- #if jin_thread == jin_thread_sdl
- SDL_WaitThread(handle, nullptr);
- #endif
- }
- #if jin_thread == jin_thread_sdl
- handle = SDL_CreateThread(threadRunner, name.c_str(), p);
- #elif jin_thread == jin_thread_cpp
- handle = new std::thread();
- #endif
- return (running = (handle != nullptr));
- }
-
- void Thread::wait()
- {
- {
- Lock l(mutex);
- if (!handle)
- return;
- }
- #if jin_thread == jin_thread_sdl
- SDL_WaitThread(handle, nullptr);
- #endif
- Lock l(mutex);
- running = false;
- handle = nullptr;
- }
-
- void Thread::lock()
- {
- if (mutex != nullptr)
- mutex->lock();
- }
-
- void Thread::unlock()
- {
- if (mutex != nullptr)
- mutex->unlock();
- }
-
- void Thread::send(int slot, const Variant& value)
- {
- lock();
- common->set(slot, value);
- unlock();
- condition->broadcast();
- }
-
- bool Thread::receive(int slot)
- {
- return common->exist(slot);
- }
-
- Thread::Variant Thread::fetch(int slot)
- {
- Thread::Variant v = common->get(slot);
- return v;
- }
-
- Thread::Variant Thread::demand(int slot)
- {
- /**
- * pthread_mutex_lock(mtx);
- * while(pass == 0)
- * {
- * pthread_mutex_unlock(mtx);
- * pthread_cond_just_wait(cv);
- * pthread_mutex_lock(mtx);
- * }
- * pthread_mutex_unlock(mtx);
- */
- lock();
- while (!common->exist(slot))
- {
- if (common->exist(ThreadData::SLOT_ERROR))
- return 0;
- condition->wait(mutex);
- }
- Thread::Variant v = common->get(slot);
- unlock();
- return v;
- }
-
- void Thread::remove(int slot)
- {
- lock();
- common->remove(slot);
- unlock();
- }
-
- } // namespace MultiThread
-} // namespace JinEngine
-
-#endif // defined(jin_thread) \ No newline at end of file
diff --git a/src/libjin/multithread/je_thread.h b/src/libjin/multithread/je_thread.h
deleted file mode 100644
index 353690c..0000000
--- a/src/libjin/multithread/je_thread.h
+++ /dev/null
@@ -1,167 +0,0 @@
-#ifndef __JE_THREAD_H
-#define __JE_THREAD_H
-#include "../core/je_configuration.h"
-#if defined(jin_thread)
-
-#include <string>
-#include <map>
-#if jin_thread == jin_thread_sdl
- #include "SDL2/SDL_thread.h"
-#elif jin_thread == jin_thread_cpp
- #include <thread>
- #include <mutex>
- #include <condition_variable>
-#endif
-
-namespace JinEngine
-{
- namespace MultiThread
- {
- /**
- * ӢӢMutual exclusionд Mutexһڶ̱߳Уֹ߳ͬʱͬһԴ
- * ȫֱждĻơĿͨƬһһٽcritical sectionɡٽ
- * ָһԹԴзʵĴ룬һֻƻ㷨һ򡢽̡߳̿ӵжٽ򣬵Dz
- * һӦûҪ˻ƵԴУꡢСжϴڶеĴ
- * ݡͬ״̬ȵԴάЩԴͬһºǺѵģΪһ߳̿κһʱ̱ͣ
- * ߣ߻ָѣ
- */
- class Mutex;
- class Conditional;
-
- //
- // Thread::demand Receive a message from a thread. Wait for the message to exist before returning.
- // Thread::getName Get the name of a thread.
- // Thread::kill Forcefully terminate the thread.
- // Thread::peek Receive a message from a thread, but leave it in the message box.
- // Thread::receive Receive a message from a thread.
- // Thread::send Send a message.
- // Thread::set Set a value.
- // Thread::start Starts the thread.
- // Thread::wait Wait for a thread to finish.
- //
- class Thread
- {
- public:
- struct Variant
- {
- enum Type
- {
- NONE = 0,
- INTERGER,
- BOOLEAN,
- CHARACTER,
- CSTRING,
- POINTER,
- REAL,
- };
- Type type;
- union
- {
- int integer;
- bool boolean;
- char character;
- const char* cstring;
- void* pointer;
- float real;
- };
- Variant() :type(NONE) {};
- Variant(const Variant& v){ memcpy(this, &v, sizeof(v)); }
- Variant(int i) : integer(i), type(INTERGER) {};
- Variant(float f) : real(f), type(REAL) {};
- Variant(bool b) : boolean(b), type(BOOLEAN) {};
- Variant(char c) : character(c), type(CHARACTER) {};
- Variant(const char* s) : cstring(s), type(CSTRING) {};
- Variant(void* p) : pointer(p), type(POINTER) {};
- };
-
- private:
- class ThreadData
- {
- public:
- static const int SLOT_ERROR = -1;
- static const int SLOT_WARN = -2;
- static const int SLOT_INFO = -3;
- static const int SLOT_DEBUG = -4;
-
- ThreadData(Mutex*, Conditional*);
- ~ThreadData();
- bool exist(int slot);
- void set(int slot, Variant value);
- Variant get(int slot);
- void remove(int slot);
-
- Conditional* condition;
- Mutex* mutex;
-
- private:
- std::map<int, Variant> share; // threads shared value
-
- };
-
- public:
- typedef int(*ThreadRunner)(void* obj);
-
- Thread(const std::string name, ThreadRunner threadfuncs);
- ~Thread();
- bool start(void* p);
- void wait();
- void send(int slot, const Variant& value);
- bool receive(int slot);
- Variant fetch(int slot);
- Variant demand(int slot);
- void remove(int slot);
- const char* getName();
- bool isRunning();
- void lock();
- void unlock();
-
- protected:
- #if jin_thread == jin_thread_sdl
- SDL_Thread* handle; // SDL thread
- #elif jin_thread == jin_thread_cpp
- std::thread* handle; // cpp thread
- #endif
- Mutex* mutex; // mutex variable
- Conditional* condition; // condition variable
- ThreadRunner threadRunner; // thread function
- ThreadData* common; // threads common data
- const std::string name; // thread name, for debugging purposes
- /**
- * https://stackoverflow.com/questions/149932/naming-conventions-for-threads
- *
- * Use short names because they don't make the lines in a log file too long.
- *
- * Create names where the important part is at the beginning. Log viewers in a
- * graphical user interface tend to have tables with columns, and the thread
- * column is usually small or will be made small by you to read everything else.
- *
- * Do not use the word "thread" in the thread name because it is obvious.
- *
- * Make the thread names easily grep-able. Avoid similar sounding thread names
- *
- * If you have several threads of the same nature, enumerate them with IDs that
- * are unique to one execution of the application or one log file, whichever fits
- * your logging habits.
- *
- * Avoid generalizations like "WorkerThread" (how do you name the next 5 worker
- * threads?), "GUIThread" (which GUI? is it for one window? for everything?) or
- * "Calculation" (what does it calculate?).
- *
- * If you have a test group that uses thread names to grep your application's log
- * files, do not rename your threads after some time. Your testers will hate you for
- * doing so. Thread names in well-tested applications should be there to stay.
- *
- * When you have threads that service a network connection, try to include the target
- * network address in the thread name (e.g. channel_123.212.123.3). Don't forget about
- * enumeration though if there are multiple connections to the same host.
- */
- bool running; // running
-
- };
-
- } // namespace MultiThread
-} // namespace JinEngine
-
-#endif // defined(jin_thread)
-
-#endif // __JE_THREAD_H \ No newline at end of file
diff --git a/src/libjin/threads/je_thread.cpp b/src/libjin/threads/je_thread.cpp
new file mode 100644
index 0000000..0c34508
--- /dev/null
+++ b/src/libjin/threads/je_thread.cpp
@@ -0,0 +1,301 @@
+#include "../core/je_configuration.h"
+#if defined(jin_thread)
+
+#include "je_thread.h"
+
+namespace JinEngine
+{
+ namespace Threads
+ {
+
+ class Mutex
+ {
+ public:
+ Mutex();
+ ~Mutex();
+
+ void lock();
+ void unlock();
+ private:
+ #if jin_thread == jin_thread_sdl
+ SDL_mutex* mutex;
+ #endif
+ friend class Conditional;
+ };
+
+ // ̼߳signal wait
+ class Conditional
+ {
+ public:
+ Conditional();
+ ~Conditional();
+ void signal();
+ void broadcast();
+ bool wait(Mutex* mutex, int timeout = -1);
+ private:
+ #if jin_thread == jin_thread_sdl
+ SDL_cond* cond;
+ #endif
+ };
+
+ class Lock
+ {
+ public:
+ Lock(Mutex* m) : mutex(m) {
+ mutex->lock();
+ }
+
+ Lock(Mutex& m) : mutex(&m) {
+ mutex->lock();
+ }
+
+ ~Lock() {
+ mutex->unlock();
+ }
+ private:
+ Mutex* mutex;
+
+ Lock(Lock&) {}
+
+ };
+
+ //////////////////////////////////////////////////////////////////////
+
+ Mutex::Mutex()
+ {
+ #if jin_thread == jin_thread_sdl
+ mutex = SDL_CreateMutex();
+ #endif
+ }
+
+ Mutex::~Mutex()
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_DestroyMutex(mutex);
+ #endif
+ }
+
+ void Mutex::lock()
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_LockMutex(mutex);
+ #endif
+ }
+
+ void Mutex::unlock()
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_UnlockMutex(mutex);
+ #endif
+ }
+
+ //////////////////////////////////////////////////////////////////////
+
+ Conditional::Conditional()
+ {
+ #if jin_thread == jin_thread_sdl
+ cond = SDL_CreateCond();
+ #endif
+ }
+
+ Conditional::~Conditional()
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_DestroyCond(cond);
+ #endif
+ }
+
+ void Conditional::signal()
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_CondSignal(cond);
+ #endif
+ }
+
+ void Conditional::broadcast()
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_CondBroadcast(cond);
+ #endif
+ }
+
+ bool Conditional::wait(Mutex* mutex, int timeout)
+ {
+ #if jin_thread == jin_thread_sdl
+ if (timeout < 0)
+ return !SDL_CondWait(cond, mutex->mutex);
+ else
+ return (SDL_CondWaitTimeout(cond, mutex->mutex, timeout) == 0);
+ #endif
+ }
+
+ //////////////////////////////////////////////////////////////////////
+
+ Thread::ThreadData::ThreadData(Mutex* m, Conditional* c)
+ : mutex(m)
+ , condition(c)
+ , share()
+ {
+ }
+
+ Thread::ThreadData::~ThreadData()
+ {
+ }
+
+ void Thread::ThreadData::set(int slot, Variant value)
+ {
+ Lock l(mutex);
+ share[slot] = value;
+ }
+
+ Thread::Variant Thread::ThreadData::get(int slot)
+ {
+ Lock l(mutex);
+ return share[slot];
+ }
+
+ bool Thread::ThreadData::exist(int slot)
+ {
+ Lock l(mutex);
+ return share.count(slot) == 1;
+ }
+
+ void Thread::ThreadData::remove(int slot)
+ {
+ Lock l(mutex);
+ if (exist(slot))
+ {
+ share.erase(slot);
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////
+
+ Thread::Thread(const std::string tname, ThreadRunner runner)
+ : name(tname)
+ , running(false)
+ , threadRunner(runner)
+ {
+ mutex = new Mutex();
+ condition = new Conditional();
+ common = new Thread::ThreadData(mutex, condition);
+ }
+
+ Thread::~Thread()
+ {
+ #if jin_thread == jin_thread_sdl
+ #endif
+ }
+
+ const char* Thread::getName()
+ {
+ Lock l(mutex);
+ return name.c_str();
+ };
+
+ bool Thread::isRunning()
+ {
+ Lock l(mutex);
+ return running;
+ };
+
+ bool Thread::start(void* p)
+ {
+ Lock l(mutex);
+ if (running)
+ return false;
+ if (handle)
+ {
+ #if jin_thread == jin_thread_sdl
+ SDL_WaitThread(handle, nullptr);
+ #endif
+ }
+ #if jin_thread == jin_thread_sdl
+ handle = SDL_CreateThread(threadRunner, name.c_str(), p);
+ #elif jin_thread == jin_thread_cpp
+ handle = new std::thread();
+ #endif
+ return (running = (handle != nullptr));
+ }
+
+ void Thread::wait()
+ {
+ {
+ Lock l(mutex);
+ if (!handle)
+ return;
+ }
+ #if jin_thread == jin_thread_sdl
+ SDL_WaitThread(handle, nullptr);
+ #endif
+ Lock l(mutex);
+ running = false;
+ handle = nullptr;
+ }
+
+ void Thread::lock()
+ {
+ if (mutex != nullptr)
+ mutex->lock();
+ }
+
+ void Thread::unlock()
+ {
+ if (mutex != nullptr)
+ mutex->unlock();
+ }
+
+ void Thread::send(int slot, const Variant& value)
+ {
+ lock();
+ common->set(slot, value);
+ unlock();
+ condition->broadcast();
+ }
+
+ bool Thread::receive(int slot)
+ {
+ return common->exist(slot);
+ }
+
+ Thread::Variant Thread::fetch(int slot)
+ {
+ Thread::Variant v = common->get(slot);
+ return v;
+ }
+
+ Thread::Variant Thread::demand(int slot)
+ {
+ /**
+ * pthread_mutex_lock(mtx);
+ * while(pass == 0)
+ * {
+ * pthread_mutex_unlock(mtx);
+ * pthread_cond_just_wait(cv);
+ * pthread_mutex_lock(mtx);
+ * }
+ * pthread_mutex_unlock(mtx);
+ */
+ lock();
+ while (!common->exist(slot))
+ {
+ if (common->exist(ThreadData::SLOT_ERROR))
+ return 0;
+ condition->wait(mutex);
+ }
+ Thread::Variant v = common->get(slot);
+ unlock();
+ return v;
+ }
+
+ void Thread::remove(int slot)
+ {
+ lock();
+ common->remove(slot);
+ unlock();
+ }
+
+ } // namespace Threads
+} // namespace JinEngine
+
+#endif // defined(jin_thread) \ No newline at end of file
diff --git a/src/libjin/threads/je_thread.h b/src/libjin/threads/je_thread.h
new file mode 100644
index 0000000..77f147d
--- /dev/null
+++ b/src/libjin/threads/je_thread.h
@@ -0,0 +1,167 @@
+#ifndef __JE_THREAD_H__
+#define __JE_THREAD_H__
+#include "../core/je_configuration.h"
+#if defined(jin_thread)
+
+#include <string>
+#include <map>
+#if jin_thread == jin_thread_sdl
+ #include "SDL2/SDL_thread.h"
+#elif jin_thread == jin_thread_cpp
+ #include <thread>
+ #include <mutex>
+ #include <condition_variable>
+#endif
+
+namespace JinEngine
+{
+ namespace Threads
+ {
+ /**
+ * ӢӢMutual exclusionд Mutexһڶ̱߳Уֹ߳ͬʱͬһԴ
+ * ȫֱждĻơĿͨƬһһٽcritical sectionɡٽ
+ * ָһԹԴзʵĴ룬һֻƻ㷨һ򡢽̡߳̿ӵжٽ򣬵Dz
+ * һӦûҪ˻ƵԴУꡢСжϴڶеĴ
+ * ݡͬ״̬ȵԴάЩԴͬһºǺѵģΪһ߳̿κһʱ̱ͣ
+ * ߣ߻ָѣ
+ */
+ class Mutex;
+ class Conditional;
+
+ //
+ // Thread::demand Receive a message from a thread. Wait for the message to exist before returning.
+ // Thread::getName Get the name of a thread.
+ // Thread::kill Forcefully terminate the thread.
+ // Thread::peek Receive a message from a thread, but leave it in the message box.
+ // Thread::receive Receive a message from a thread.
+ // Thread::send Send a message.
+ // Thread::set Set a value.
+ // Thread::start Starts the thread.
+ // Thread::wait Wait for a thread to finish.
+ //
+ class Thread
+ {
+ public:
+ struct Variant
+ {
+ enum Type
+ {
+ NONE = 0,
+ INTERGER,
+ BOOLEAN,
+ CHARACTER,
+ CSTRING,
+ POINTER,
+ REAL,
+ };
+ Type type;
+ union
+ {
+ int integer;
+ bool boolean;
+ char character;
+ const char* cstring;
+ void* pointer;
+ float real;
+ };
+ Variant() :type(NONE) {};
+ Variant(const Variant& v){ memcpy(this, &v, sizeof(v)); }
+ Variant(int i) : integer(i), type(INTERGER) {};
+ Variant(float f) : real(f), type(REAL) {};
+ Variant(bool b) : boolean(b), type(BOOLEAN) {};
+ Variant(char c) : character(c), type(CHARACTER) {};
+ Variant(const char* s) : cstring(s), type(CSTRING) {};
+ Variant(void* p) : pointer(p), type(POINTER) {};
+ };
+
+ private:
+ class ThreadData
+ {
+ public:
+ static const int SLOT_ERROR = -1;
+ static const int SLOT_WARN = -2;
+ static const int SLOT_INFO = -3;
+ static const int SLOT_DEBUG = -4;
+
+ ThreadData(Mutex*, Conditional*);
+ ~ThreadData();
+ bool exist(int slot);
+ void set(int slot, Variant value);
+ Variant get(int slot);
+ void remove(int slot);
+
+ Conditional* condition;
+ Mutex* mutex;
+
+ private:
+ std::map<int, Variant> share; // threads shared value
+
+ };
+
+ public:
+ typedef int(*ThreadRunner)(void* obj);
+
+ Thread(const std::string name, ThreadRunner threadfuncs);
+ ~Thread();
+ bool start(void* p);
+ void wait();
+ void send(int slot, const Variant& value);
+ bool receive(int slot);
+ Variant fetch(int slot);
+ Variant demand(int slot);
+ void remove(int slot);
+ const char* getName();
+ bool isRunning();
+ void lock();
+ void unlock();
+
+ protected:
+ #if jin_thread == jin_thread_sdl
+ SDL_Thread* handle; // SDL thread
+ #elif jin_thread == jin_thread_cpp
+ std::thread* handle; // cpp thread
+ #endif
+ Mutex* mutex; // mutex variable
+ Conditional* condition; // condition variable
+ ThreadRunner threadRunner; // thread function
+ ThreadData* common; // threads common data
+ const std::string name; // thread name, for debugging purposes
+ /**
+ * https://stackoverflow.com/questions/149932/naming-conventions-for-threads
+ *
+ * Use short names because they don't make the lines in a log file too long.
+ *
+ * Create names where the important part is at the beginning. Log viewers in a
+ * graphical user interface tend to have tables with columns, and the thread
+ * column is usually small or will be made small by you to read everything else.
+ *
+ * Do not use the word "thread" in the thread name because it is obvious.
+ *
+ * Make the thread names easily grep-able. Avoid similar sounding thread names
+ *
+ * If you have several threads of the same nature, enumerate them with IDs that
+ * are unique to one execution of the application or one log file, whichever fits
+ * your logging habits.
+ *
+ * Avoid generalizations like "WorkerThread" (how do you name the next 5 worker
+ * threads?), "GUIThread" (which GUI? is it for one window? for everything?) or
+ * "Calculation" (what does it calculate?).
+ *
+ * If you have a test group that uses thread names to grep your application's log
+ * files, do not rename your threads after some time. Your testers will hate you for
+ * doing so. Thread names in well-tested applications should be there to stay.
+ *
+ * When you have threads that service a network connection, try to include the target
+ * network address in the thread name (e.g. channel_123.212.123.3). Don't forget about
+ * enumeration though if there are multiple connections to the same host.
+ */
+ bool running; // running
+
+ };
+
+ } // namespace Threads
+} // namespace JinEngine
+
+#endif // defined(jin_thread)
+
+#endif // __JE_THREAD_H__ \ No newline at end of file
diff --git a/src/lua/common/Proxy.h b/src/lua/common/Proxy.h
deleted file mode 100644
index 5ebb5b2..0000000
--- a/src/lua/common/Proxy.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef __JIN_COMMON_PROXY_H
-#define __JIN_COMMON_PROXY_H
-
-#include "Reference.hpp"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- class Proxy
- {
- public:
- void bind(RefBase* ref)
- {
- if (ref == nullptr)
- return;
- reference = ref;
- }
-
- void release()
- {
- if (reference != nullptr)
- {
- reference->release();
- reference = nullptr;
- }
- }
-
- void retain()
- {
- if (reference != nullptr)
- reference->retain();
- }
-
- void setUserdata(void* data)
- {
- if (reference != nullptr)
- reference->setUserdata(data);
- }
-
- template<class T>
- Ref<T>& getRef()
- {
- return *(Ref<T>*) reference;
- }
-
- template<class T>
- T* getObject()
- {
- Ref<T>& ref = getRef<T>();
- return ref.getObject();
- }
-
- const char* getObjectType()
- {
- return reference->type;
- }
-
- RefBase* reference;
-
- };
-
- } // namespace Lua
-} // namespace JinEngine
-
-#endif // __JIN_COMMON_PROXY_H \ No newline at end of file
diff --git a/src/lua/common/Reference.hpp b/src/lua/common/Reference.hpp
deleted file mode 100644
index ba918bb..0000000
--- a/src/lua/common/Reference.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __JIN_COMMON_REFERENCE_H
-#define __JIN_COMMON_REFERENCE_H
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- /*abstract*/class RefBase
- {
- public:
- void retain()
- {
- ++count;
- }
-
- void release()
- {
- if (--count <= 0)
- delete this;
- }
-
- // object type string
- const char* const type;
-
- void setUserdata(void* data)
- {
- userdata = data;
- }
-
- void* getUserdata()
- {
- return userdata;
- }
-
- protected:
- RefBase(void* obj, const char* t)
- : count(1)
- , object(obj)
- , type(t)
- {
- }
-
- RefBase(const RefBase&);
-
- virtual ~RefBase()
- {
- }
-
- void* object;
- int count;
- void* userdata;
- };
-
- template<class T>
- class Ref : public RefBase
- {
- public:
- Ref(T* obj, const char* type)
- : RefBase(obj, type)
- {
- }
-
- ~Ref()
- {
- T* obj = static_cast<T*>(object);
- delete obj;
- }
-
- T* operator->()
- {
- return (T*)object;
- }
-
- T* getObject()
- {
- return (T*)object;
- }
-
- private:
- Ref(const Ref<T>& ref);
-
- };
-
- }
-}
-
-#endif \ No newline at end of file
diff --git a/src/lua/common/common.h b/src/lua/common/common.h
deleted file mode 100644
index 0ee72cc..0000000
--- a/src/lua/common/common.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __JIN_M_TYPES_H
-#define __JIN_M_TYPES_H
-
-#include "Proxy.h"
-#include "Reference.hpp"
-#include "error.h"
-
-#endif \ No newline at end of file
diff --git a/src/lua/common/constant.h b/src/lua/common/constant.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/lua/common/constant.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/lua/common/error.h b/src/lua/common/error.h
deleted file mode 100644
index c254486..0000000
--- a/src/lua/common/error.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __JIN_ERROR_H
-#define __JIN_ERROR_H
-#include "../../luax.h"
-#include "../jin.h"
-#include <string.h>
-
-namespace JinEngine
-{
-namespace Lua
-{
-
- static const int FORMAT_MSG_BUFFER_SIZE = 2048;
-
- inline void error(lua_State* L, const char* fmt, ...)
- {
- char err[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
- va_list args;
- va_start(args, fmt);
- vsnprintf(err + strlen(err), FORMAT_MSG_BUFFER_SIZE, fmt, args);
- va_end(args);
- luax_getglobal(L, MODULE_NAME);
- luax_setfieldstring(L, "error", err);
- }
-
-}
-}
-
-#endif \ No newline at end of file
diff --git a/src/lua/common/je_lua_callback.cpp b/src/lua/common/je_lua_callback.cpp
new file mode 100644
index 0000000..392f919
--- /dev/null
+++ b/src/lua/common/je_lua_callback.cpp
@@ -0,0 +1,43 @@
+#include "je_lua_callback.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LuaCallback::LuaCallback(lua_State* L)
+ : mLuaFunc(nullptr)
+ , mParams(0)
+ , mL(L)
+ {
+ }
+
+ LuaCallback::~LuaCallback()
+ {
+ delete mLuaFunc;
+ for (auto p : mParams)
+ delete p;
+ }
+
+ void LuaCallback::setFunc(int i)
+ {
+ if (mLuaFunc != nullptr)
+ delete mLuaFunc;
+ mLuaFunc = new LuaRef(mL, i);
+ }
+
+ void LuaCallback::pushParam(int i)
+ {
+ mParams.push_back(new LuaRef(mL, i));
+ }
+
+ void LuaCallback::call()
+ {
+ mLuaFunc->push();
+ for (auto p : mParams)
+ p->push();
+ luax_call(mL, mParams.size(), 0);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/common/je_lua_callback.h b/src/lua/common/je_lua_callback.h
new file mode 100644
index 0000000..f3301fc
--- /dev/null
+++ b/src/lua/common/je_lua_callback.h
@@ -0,0 +1,67 @@
+#ifndef __JIN_COMMON_FUNCTION_H
+#define __JIN_COMMON_FUNCTION_H
+
+#include <vector>
+
+#include "libjin/jin.h"
+#include "../luax.h"
+#include "je_lua_reference.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ ///
+ ///
+ ///
+ class LuaCallback
+ {
+ public:
+ ///
+ ///
+ ///
+ LuaCallback(lua_State* L);
+
+ ///
+ ///
+ ///
+ ~LuaCallback();
+
+ ///
+ ///
+ ///
+ void setFunc(int i);
+
+ ///
+ ///
+ ///
+ void pushParam(int i);
+
+ ///
+ ///
+ ///
+ void call();
+
+ private:
+ ///
+ ///
+ ///
+ LuaRef* mLuaFunc;
+
+ ///
+ ///
+ ///
+ std::vector<LuaRef*> mParams;
+
+ ///
+ ///
+ ///
+ lua_State* const mL;
+
+ };
+
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif // __JIN_COMMON_REFERENCE_H \ No newline at end of file
diff --git a/src/lua/common/je_lua_common.h b/src/lua/common/je_lua_common.h
new file mode 100644
index 0000000..5b217a2
--- /dev/null
+++ b/src/lua/common/je_lua_common.h
@@ -0,0 +1,10 @@
+#ifndef __JIN_M_TYPES_H
+#define __JIN_M_TYPES_H
+
+#include "je_lua_port.h"
+#include "je_lua_proxy.h"
+#include "je_lua_shared.hpp"
+#include "je_lua_error.h"
+#include "je_lua_reference.h"
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particle/je_particle_system.cpp b/src/lua/common/je_lua_constant.h
index 6f70f09..6f70f09 100644
--- a/src/libjin/Graphics/particle/je_particle_system.cpp
+++ b/src/lua/common/je_lua_constant.h
diff --git a/src/lua/common/je_lua_error.h b/src/lua/common/je_lua_error.h
new file mode 100644
index 0000000..3f7e76f
--- /dev/null
+++ b/src/lua/common/je_lua_error.h
@@ -0,0 +1,28 @@
+#ifndef __JIN_ERROR_H
+#define __JIN_ERROR_H
+#include "../luax.h"
+#include <string.h>
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ static const int FORMAT_MSG_BUFFER_SIZE = 2048;
+
+ inline void error(lua_State* L, const char* fmt, ...)
+ {
+ char err[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
+ va_list args;
+ va_start(args, fmt);
+ vsnprintf(err + strlen(err), FORMAT_MSG_BUFFER_SIZE, fmt, args);
+ va_end(args);
+ //luax_getglobal(L, "jin");
+ //luax_setfieldstring(L, "error", err);
+ luax_error(L, err);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Graphics/particle/je_particle_batch.cpp b/src/lua/common/je_lua_function.cpp
index e69de29..e69de29 100644
--- a/src/libjin/Graphics/particle/je_particle_batch.cpp
+++ b/src/lua/common/je_lua_function.cpp
diff --git a/src/lua/common/je_lua_function.h b/src/lua/common/je_lua_function.h
new file mode 100644
index 0000000..49c1b31
--- /dev/null
+++ b/src/lua/common/je_lua_function.h
@@ -0,0 +1,6 @@
+#ifndef __JE_LUA_FUNCTION_H__
+#define __JE_LUA_FUNCTION_H__
+
+
+
+#endif \ No newline at end of file
diff --git a/src/lua/common/je_lua_port.h b/src/lua/common/je_lua_port.h
new file mode 100644
index 0000000..8e99ca4
--- /dev/null
+++ b/src/lua/common/je_lua_port.h
@@ -0,0 +1,8 @@
+#ifndef __JE_LUA_PORT_H
+#define __JE_LUA_PORT_H
+
+#define LUA_PORT extern
+#define LUA_IMPLEMENT static
+#define LUA_EXPORT
+
+#endif \ No newline at end of file
diff --git a/src/lua/common/je_lua_proxy.h b/src/lua/common/je_lua_proxy.h
new file mode 100644
index 0000000..ca4a56a
--- /dev/null
+++ b/src/lua/common/je_lua_proxy.h
@@ -0,0 +1,72 @@
+#ifndef __JIN_COMMON_PROXY_H
+#define __JIN_COMMON_PROXY_H
+
+#include "../luax.h"
+
+#include "je_lua_shared.hpp"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ class Proxy
+ {
+ public:
+ void bind(SharedBase* s)
+ {
+ if (s == nullptr)
+ return;
+ shared = s;
+ shared->retain();
+ }
+
+ void release()
+ {
+ if (shared != nullptr)
+ {
+ shared->release();
+ shared = nullptr;
+ }
+ }
+/*
+ void retain()
+ {
+ if (shared != nullptr)
+ shared->retain();
+ }
+*/
+ template<class T>
+ Shared<T>& getShared()
+ {
+ return *(Shared<T>*)shared;
+ }
+
+ ///
+ /// For convenience.
+ ///
+ template<class T>
+ T* getObject()
+ {
+ Shared<T>& shared = getShared<T>();
+ return shared.getObject();
+ }
+
+ const char* getObjectType()
+ {
+ return shared->type;
+ }
+
+ SharedBase* shared;
+
+ };
+
+ inline Proxy* luax_newinstance(lua_State* L, const char* type)
+ {
+ return static_cast<Proxy*>(luax_newinstance(L, type, sizeof(Proxy)));
+ }
+
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif // __JIN_COMMON_PROXY_H \ No newline at end of file
diff --git a/src/lua/common/je_lua_reference.cpp b/src/lua/common/je_lua_reference.cpp
new file mode 100644
index 0000000..90223de
--- /dev/null
+++ b/src/lua/common/je_lua_reference.cpp
@@ -0,0 +1,31 @@
+#include "je_lua_reference.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LuaRef::LuaRef(lua_State* L, int i)
+ : mL(L)
+ {
+ luax_pushvalue(mL, i);
+ mIndex = luax_ref(mL, LUA_REGISTRYINDEX);
+ }
+
+ LuaRef::~LuaRef()
+ {
+ unref();
+ }
+
+ void LuaRef::unref()
+ {
+ luax_unref(mL, LUA_REGISTRYINDEX, mIndex);
+ }
+
+ void LuaRef::push()
+ {
+ luax_rawgeti(mL, LUA_REGISTRYINDEX, mIndex);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/common/je_lua_reference.h b/src/lua/common/je_lua_reference.h
new file mode 100644
index 0000000..f338762
--- /dev/null
+++ b/src/lua/common/je_lua_reference.h
@@ -0,0 +1,54 @@
+#ifndef __JIN_COMMON_REFERENCE_H
+#define __JIN_COMMON_REFERENCE_H
+
+#include "../luax.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ ///
+ /// This class wraps the reference functionality built into Lua, which allows C++ code to refer to Lua
+ /// variables.
+ ///
+ class LuaRef
+ {
+ public:
+ ///
+ ///
+ ///
+ LuaRef(lua_State* L, int i);
+
+ ///
+ ///
+ ///
+ ~LuaRef();
+
+ ///
+ ///
+ ///
+ void unref();
+
+ ///
+ /// Push value onto the stack.
+ ///
+ void push();
+
+ private:
+ ///
+ ///
+ ///
+ lua_State* const mL;
+
+ ///
+ ///
+ ///
+ int mIndex;
+
+ };
+
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif // __JIN_COMMON_REFERENCE_H \ No newline at end of file
diff --git a/src/lua/common/je_lua_shared.hpp b/src/lua/common/je_lua_shared.hpp
new file mode 100644
index 0000000..91705d1
--- /dev/null
+++ b/src/lua/common/je_lua_shared.hpp
@@ -0,0 +1,151 @@
+#ifndef __JIN_COMMON_SHARED_H__
+#define __JIN_COMMON_SHARED_H__
+
+#include <map>
+#include <vector>
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ class SharedBase
+ {
+ public:
+ void retain()
+ {
+ ++mCount;
+ }
+
+ void release()
+ {
+ if (--mCount <= 0)
+ delete this;
+ }
+
+ // Object type.
+ const char* const type;
+
+ void setDependency(int key, SharedBase* shared)
+ {
+ removeDependency(key);
+ shared->retain();
+ mDependencies.insert(std::pair<int, SharedBase*>(key, shared));
+ }
+
+ void removeDependency(int key)
+ {
+ if (!isDependOn(key))
+ return;
+ DepMap::iterator it = mDependencies.find(key);
+ it->second->release();
+ mDependencies.erase(it);
+ }
+
+ void removeDependency(SharedBase* dep)
+ {
+ for (DepMap::iterator it = mDependencies.begin(); it != mDependencies.end();)
+ {
+ if (it->second == dep)
+ {
+ it->second->release();
+ mDependencies.erase(it);
+ }
+ else
+ ++it;
+ }
+ }
+
+ bool isDependOn(int key)
+ {
+ return mDependencies.find(key) != mDependencies.end();
+ }
+
+ bool isDependOn(SharedBase* shared)
+ {
+ for (std::pair<int, SharedBase*> dep : mDependencies)
+ {
+ if (dep.second == shared)
+ return true;
+ }
+ return false;
+ }
+
+ void clearDependencies()
+ {
+ for (std::pair<int, SharedBase*> dep : mDependencies)
+ dep.second->release();
+ mDependencies.clear();
+ }
+
+ SharedBase* getDependency(int key)
+ {
+ if (!isDependOn(key))
+ return nullptr;
+ return mDependencies.find(key)->second;
+ }
+
+ bool isType(const char* t)
+ {
+ return strcmp(type, t) == 0;
+ }
+
+ protected:
+
+ using DepMap = std::map<int, SharedBase*>;
+
+ SharedBase(void* obj, const char* t)
+ : mCount(0)
+ , mObject(obj)
+ , type(t)
+ {
+ }
+
+ SharedBase(const SharedBase&);
+
+ virtual ~SharedBase()
+ {
+ clearDependencies();
+ }
+
+ void* mObject;
+ int mCount;
+ DepMap mDependencies;
+ };
+
+ template<class T>
+ class Shared : public SharedBase
+ {
+ public:
+ Shared(T* obj, const char* type)
+ : SharedBase(obj, type)
+ {
+ }
+
+ T* operator->()
+ {
+ return static_cast<T*>(mObject);
+ }
+
+ T* getObject()
+ {
+ return static_cast<T*>(mObject);
+ }
+
+ private:
+ // Disable copy constructor.
+ Shared(const Shared<T>& shared);
+
+ // Make shared only be able created with new.
+ ~Shared()
+ {
+ T* obj = static_cast<T*>(mObject);
+ delete obj;
+ }
+
+ };
+
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h
deleted file mode 100644
index 99e657b..0000000
--- a/src/lua/embed/boot.lua.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* boot.lua */
-static const char* boot_lua = R"(
-jin.args[2] = jin.args[2] or '.'
-jin.filesystem.init()
-jin.filesystem.mount(jin.args[2])
-
--------------------------------------------------------------------------
--- Config game
--------------------------------------------------------------------------
-
-jin.config = {}
-if jin.filesystem.exist("config.lua") then
- jin.config = require "config"
-end
-jin.config.width = jin.config.width or 576
-jin.config.height = jin.config.height or 448
-jin.config.vsync = jin.config.vsync or true
-jin.config.title = jin.config.title or ("jin v" .. jin.version)
-jin.config.resizable = jin.config.resizable or false
-jin.config.fullscreen = jin.config.fullscreen or false
-jin.config.fps = jin.config.fps or 60
-
--------------------------------------------------------------------------
--- Initialize sub systems
--------------------------------------------------------------------------
-
-jin.graphics.init(jin.config)
-jin.audio.init()
--- TODO: ϵͳģ
-
--------------------------------------------------------------------------
--- Default game loop
--------------------------------------------------------------------------
-
-local function call(func, ...)
- if func then
- return func(...)
- end
-end
-
-function jin.core.run()
- call(jin.core.onLoad)
- jin.graphics.reset()
- local dt = 0
- local previous = jin.time.second()
- local current = previous
- while jin.core.running() do
- for _, e in pairs(jin.event.poll()) do
- if e.type == "KeyDown" then
- jin.keyboard.set(e.key, true)
- elseif e.type == "KeyUp" then
- jin.keyboard.set(e.key, false)
- end
- call(jin.core.onEvent, e)
- end
- previous = current
- current = jin.time.second()
- dt = current - previous
- call(jin.core.onUpdate, dt)
- jin.graphics.clear()
- call(jin.core.onDraw)
- jin.graphics.present()
- -- Sleep 1 ms
- jin.time.sleep(0.001)
- end
-end
-
--------------------------------------------------------------------------
--- No game handler
--------------------------------------------------------------------------
-
-jin.core.setHandler = function(handler)
- if handler == nil then
- return
- end
- jin.core.onLoad = handler.onLoad
- jin.core.onEvent = handler.onEvent
- jin.core.onUpdate = handler.onUpdate
- jin.core.onDraw = handler.onDraw
-end
-
--- TODO: Ĭͼbase64
-jin.nogame = {
- cs = 64,
- sw = jin.graphics.getWidth(),
- sh = jin.graphics.getHeight(),
- cw = 0,
- ch = 0,
- ww = 6,
- ww2 = 6*2,
- speed = 4,
- t = 0,
- onLoad = function()
- local nogame = jin.nogame
- nogame.cw = nogame.sw / nogame.cs
- nogame.ch = nogame.sh / nogame.cs
- nogame.t = nogame.ww - 1
- end,
- onEvent = function(e)
- if e.type == 'Quit' then
- jin.core.stop()
- end
- end,
- onUpdate = function(dt)
- print(dt)
- local nogame = jin.nogame
- nogame.t = nogame.t + dt * nogame.speed
- if nogame.t > nogame.ww2 then
- nogame.t = nogame.t - nogame.ww2
- end
- end,
- circle = function(x, y, r)
- local nogame = jin.nogame
- if r % nogame.ww2 > nogame.ww then
- return
- end
- r = math.sin((r/nogame.ww)*math.pi)*nogame.cs/2
- local fact = (x + y) / nogame.ch * nogame.cw
- jin.graphics.setColor(
- 155 + 100 * math.sin(fact),
- 155 + 100 * math.cos(fact),
- 155 + 100 * math.sin(fact * fact),
- 255
- )
- jin.graphics.circle("fill", x*nogame.cs + nogame.cs/2, y*nogame.cs + nogame.cs/2, r)
- end,
- onDraw = function()
- local nogame = jin.nogame
- for y = 0, nogame.ch - 1 do
- for x = 0, nogame.cw - 1 do
- nogame.circle(x, y, nogame.t+x+y)
- end
- end
- end
-}
-
--------------------------------------------------------------------------
--- Boot jin
--------------------------------------------------------------------------
-
-local function onError(msg)
- jin.graphics.reset()
- jin.graphics.setClearColor(100, 100, 100, 255)
- jin.graphics.clear()
- jin.graphics.print("Error:\n" .. msg .. "\n" .. debug.traceback(), 5, 5)
- jin.graphics.present()
- while jin.core.running() do
- for _, e in pairs(jin.event.poll()) do
- if e.type == "Quit" then
- jin.core.stop()
- end
- end
- jin.time.sleep(0.001)
- end
- jin.core.quit()
-end
-
-local function boot()
- if jin.filesystem.exist("main.lua") then
- -- Require main game script
- xpcall(function() require"main" end, onError)
- xpcall(function() jin.core.run() end, onError)
- else
- -- No game
- jin.core.setHandler(jin.nogame)
- jin.core.run()
- end
- jin.graphics.destroy()
- jin.audio.destroy()
- jin.core.quit()
-end
-
-xpcall(boot, onError)
-
-)"; \ No newline at end of file
diff --git a/src/lua/embed/embed.h b/src/lua/embed/embed.h
index 18373c8..054672c 100644
--- a/src/lua/embed/embed.h
+++ b/src/lua/embed/embed.h
@@ -4,30 +4,26 @@
namespace JinEngine
{
-namespace embed
-{
+ namespace Embed
+ {
-#define embed(L, script, name)\
- if(luax_loadbuffer(L, script, strlen(script), name) == 0)\
- lua_call(L, 0, 0);
+ #define embed(L, script, name)\
+ if(luax_loadbuffer(L, script, strlen(script), name) == 0)\
+ lua_call(L, 0, 0);
- /**
- * embed structure.
- */
- struct jin_Embed
- {
- const char* file, *source;
- };
+ // Embed structure.
+ struct jin_Embed
+ {
+ const char* file, *source;
+ };
- static void boot(lua_State* L)
- {
- // embed scripts
- #include "graphics.lua.h"
- #include "keyboard.lua.h"
- #include "mouse.lua.h"
- #include "boot.lua.h"
+ // Embed scripts.
+ #include "scripts/graphics.lua.h"
+ #include "scripts/keyboard.lua.h"
+ #include "scripts/mouse.lua.h"
+ #include "scripts/boot.lua.h"
- // in order
+ // In order.
const jin_Embed scripts[] = {
{ "graphics.lua", graphics_lua },
{ "keyboard.lua", keyboard_lua },
@@ -36,11 +32,13 @@ namespace embed
{ 0, 0 }
};
- for (int i = 0; scripts[i].file; ++i)
- embed(L, scripts[i].source, scripts[i].file);
- }
+ static void boot(lua_State* L)
+ {
+ for (int i = 0; scripts[i].file; ++i)
+ embed(L, scripts[i].source, scripts[i].file);
+ }
-} // embed
+ } // namespace Embed
} // namespace JinEngine
#endif \ No newline at end of file
diff --git a/src/lua/embed/graphics.lua.h b/src/lua/embed/graphics.lua.h
deleted file mode 100644
index 5fa5dad..0000000
--- a/src/lua/embed/graphics.lua.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* graphics.lua */
-static const char* graphics_lua = R"(
-jin.graphics = jin.graphics or {}
-
-local default_shader = nil
-local default_shader_source = [[
-#VERTEX_SHADER
-
-Vertex vert(Vertex v)
-{
- return v;
-}
-
-#END_VERTEX_SHADER
-
-#FRAGMENT_SHADER
-
-Color frag(Color col, Texture tex, Vertex v)
-{
- return col * texel(tex, v.uv);
-}
-
-#END_FRAGMENT_SHADER
-]]
-
-local _init = jin.graphics.init
-
-jin.graphics.init = function(setting)
- _init(setting);
- default_shader = jin.graphics.newShader(default_shader_source)
- jin.graphics.useShader(default_shader)
-end
-
-jin.graphics.unuseShader = function()
- jin.graphics.useShader(default_shader)
-end
-
--- Reset all attributes to default value.
-jin.graphics.reset = function()
- jin.graphics.setColor(255, 255, 255, 255)
- jin.graphics.setClearColor(0, 0, 0, 255)
- jin.graphics.clear()
- jin.graphics.unsetFont()
-end
-
-)";
diff --git a/src/lua/embed/keyboard.lua.h b/src/lua/embed/keyboard.lua.h
deleted file mode 100644
index ee8428f..0000000
--- a/src/lua/embed/keyboard.lua.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-static const char* keyboard_lua = R"(
-jin.keyboard = jin.keyboard or {}
-
-local keys = {}
-
-function jin.keyboard.isPressed(k)
- return keys[k]
-end
-
-function jin.keyboard.set(k, status)
- keys[k] = status
-end
-
-)";
diff --git a/src/lua/embed/mouse.lua.h b/src/lua/embed/mouse.lua.h
deleted file mode 100644
index 3c222f3..0000000
--- a/src/lua/embed/mouse.lua.h
+++ /dev/null
@@ -1,14 +0,0 @@
-static const char* mouse_lua = R"(
-jin.mouse = jin.mouse or {}
-
-local button = {}
-
-function jin.mouse.isDown(btn)
- return button[btn]
-end
-
-function jin.mouse.set(btn, status)
- button[btn] = status
-end
-
-)"; \ No newline at end of file
diff --git a/src/lua/embed/net.lua.h b/src/lua/embed/net.lua.h
deleted file mode 100644
index 4d89dc7..0000000
--- a/src/lua/embed/net.lua.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* net.lua */
-static const char* net_lua = R"(
-jin.net = jin.net or {}
-)"; \ No newline at end of file
diff --git a/src/lua/embed/path.lua.h b/src/lua/embed/path.lua.h
deleted file mode 100644
index 648adf8..0000000
--- a/src/lua/embed/path.lua.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* path.lua */
-static const char* path_lua = R"(
-jin.path = jin.path or {}
-
--- game root directory
-jin._root = nil
-
--- return full path of a given path
-function jin.path.full(path)
- local root = jin._dir .. '/' .. jin._argv[2]
- return root .. '/' .. path
-end
-
-)"; \ No newline at end of file
diff --git a/src/lua/embed/scripts/ai.lua.h b/src/lua/embed/scripts/ai.lua.h
new file mode 100644
index 0000000..a69da84
--- /dev/null
+++ b/src/lua/embed/scripts/ai.lua.h
@@ -0,0 +1,26 @@
+/* graphics.lua */
+static const char* ai_lua = R"(
+jin.ai = jin.ai or {}
+
+local ja = jin.ai
+
+ja.StateMachineType = {
+ STEPWISE = 1,
+ ITERATIVE = 2,
+}
+
+
+
+)";
+
+
+//local sp = jin.graphics.newSprite()
+//local sm = jin.ai.newStateMachine(jin.StateMachineMode.STEPWISE, sp)
+//sm:addState("run")
+//sm:addEnterCallback("run", function(spr)
+// spr:setRun()
+//end)
+//
+//function jin.core.onUpdate(dt)
+// sm:update()
+//end
diff --git a/src/lua/embed/scripts/boot.lua.h b/src/lua/embed/scripts/boot.lua.h
new file mode 100644
index 0000000..af81c16
--- /dev/null
+++ b/src/lua/embed/scripts/boot.lua.h
@@ -0,0 +1,139 @@
+/* boot.lua */
+static const char* boot_lua = R"(
+local cwd = jin.args['cwd'] or '.'
+jin.filesystem.init()
+jin.filesystem.mount(cwd)
+
+-------------------------------------------------------------------------
+-- Config game
+-------------------------------------------------------------------------
+
+jin.config = {}
+if jin.filesystem.exist("config.lua") then
+ xpcall(function()jin.config = require "config" end, function()end)
+end
+jin.config.width = jin.config.width or 580
+jin.config.height = jin.config.height or 450
+jin.config.vsync = jin.config.vsync or true
+jin.config.title = jin.config.title or ("jin v" .. jin.version)
+jin.config.resizable = jin.config.resizable or false
+jin.config.fullscreen = jin.config.fullscreen or false
+jin.config.fps = jin.config.fps or 60
+jin.config.icon = jin.config.icon or ""
+
+-------------------------------------------------------------------------
+-- Default game loop
+-------------------------------------------------------------------------
+
+local function call(func, ...)
+ if func then
+ return func(...)
+ end
+end
+
+local step = jin.time.step
+jin.time.step = nil
+
+function jin.core.run()
+ jin.graphics.reset()
+ call(jin.core.onLoad)
+ local dt = 0
+ while jin.core.running() do
+ for _, e in pairs(jin.event.poll()) do
+ if e.type == "KeyDown" then
+ jin.keyboard.set(e.key, true)
+ elseif e.type == "KeyUp" then
+ jin.keyboard.set(e.key, false)
+ end
+ call(jin.core.onEvent, e)
+ end
+ step()
+ dt = jin.time.getDelta()
+ call(jin.core.onUpdate)
+ jin.graphics.clear()
+ call(jin.core.onDraw)
+ jin.graphics.present()
+ jin.time.sleep(0.001)
+ end
+end
+
+-------------------------------------------------------------------------
+-- Boot game
+-------------------------------------------------------------------------
+
+-- Display error message.
+local function onError(msg)
+ jin.audio.destroy()
+ jin.graphics.showWindow()
+ local err = "Error:\n" .. msg .. "\n" .. debug.traceback()
+ jin.graphics.reset()
+ jin.graphics.setClearColor(100, 100, 100, 255)
+ jin.graphics.clear()
+ jin.graphics.print(err, 5, 5)
+ jin.graphics.present()
+ while jin.core.running() do
+ for _, e in pairs(jin.event.poll()) do
+ if e.type == "Quit" then
+ jin.core.stop()
+ end
+ end
+ jin.time.sleep(0.001)
+ end
+end
+
+-- No game screen.
+local function noGame()
+ jin.graphics.showWindow()
+ jin.graphics.reset()
+ jin.graphics.setClearColor(100, 100, 100, 255)
+ jin.graphics.clear()
+ jin.graphics.print("No Game", 5, 5)
+ jin.graphics.present()
+ while jin.core.running() do
+ for _, e in pairs(jin.event.poll()) do
+ if e.type == "Quit" then
+ jin.core.stop()
+ end
+ end
+ jin.time.sleep(0.001)
+ end
+end
+
+local function boot()
+ if jin.filesystem.exist("main.lua") then
+ call(function()
+ require"main"
+ jin.core.run()
+ end)
+ else
+ noGame()
+ end
+end
+
+-------------------------------------------------------------------------
+-- Initialize sub systems
+-------------------------------------------------------------------------
+
+jin.audio.init()
+jin.graphics.init(jin.config)
+
+-------------------------------------------------------------------------
+-- Boot game
+-------------------------------------------------------------------------
+
+xpcall(boot, onError)
+
+-------------------------------------------------------------------------
+-- Destroy sub-systems
+-------------------------------------------------------------------------
+
+jin.graphics.destroy()
+jin.audio.destroy()
+
+-------------------------------------------------------------------------
+-- Quit game
+-------------------------------------------------------------------------
+
+jin.core.quit()
+
+)"; \ No newline at end of file
diff --git a/src/lua/embed/scripts/graphics.lua.h b/src/lua/embed/scripts/graphics.lua.h
new file mode 100644
index 0000000..e1079b9
--- /dev/null
+++ b/src/lua/embed/scripts/graphics.lua.h
@@ -0,0 +1,73 @@
+/* graphics.lua */
+static const char* graphics_lua = R"(
+jin.graphics = jin.graphics or {}
+
+local jg = jin.graphics
+
+jg.RenderMode = {
+ FILL = 1,
+ LINE = 2,
+}
+
+jg.SpriteOrigin = {
+ TOPLEFT = 0,
+ TOPCENTER = 1,
+ TOPRIGHT = 2,
+ MIDDLELEFT = 3,
+ MIDDLECENTER = 4,
+ MIDDLERIGHT = 5,
+ BOTTOMLEFT = 6,
+ BOTTOMCENTER = 7,
+ BOTTOMRIGHT = 8
+}
+
+local default_shader = nil
+local default_shader_source = [[
+#VERTEX_SHADER
+
+Vertex vert(Vertex v)
+{
+ return v;
+}
+
+#END_VERTEX_SHADER
+
+#FRAGMENT_SHADER
+
+Color frag(Color col, Texture tex, Vertex v)
+{
+ return col * texel(tex, v.uv);
+}
+
+#END_FRAGMENT_SHADER
+]]
+
+local _init = jg.init
+local initialized = false
+
+jg.init = function(setting)
+ if initialized then
+ return initialized
+ end
+ initialized = _init(setting)
+ if initialized then
+ default_shader = jg.newShader(default_shader_source)
+ jg.useShader(default_shader)
+ end
+ return initialized
+end
+
+jg.unuseShader = function()
+ jg.useShader(default_shader)
+end
+
+-- Reset all attributes to default value.
+jg.reset = function()
+ jg.setColor(255, 255, 255, 255)
+ jg.setClearColor(0, 0, 0, 255)
+ jg.clear()
+ jg.unsetFont()
+ jg.unuseShader()
+end
+
+)"; \ No newline at end of file
diff --git a/src/lua/embed/scripts/keyboard.lua.h b/src/lua/embed/scripts/keyboard.lua.h
new file mode 100644
index 0000000..e989928
--- /dev/null
+++ b/src/lua/embed/scripts/keyboard.lua.h
@@ -0,0 +1,17 @@
+
+static const char* keyboard_lua = R"(
+jin.keyboard = jin.keyboard or {}
+
+local jk = jin.keyboard
+
+local keys = {}
+
+function jin.keyboard.isPressed(k)
+ return keys[k]
+end
+
+function jin.keyboard.set(k, status)
+ keys[k] = status
+end
+
+)";
diff --git a/src/lua/embed/scripts/mouse.lua.h b/src/lua/embed/scripts/mouse.lua.h
new file mode 100644
index 0000000..ca070a3
--- /dev/null
+++ b/src/lua/embed/scripts/mouse.lua.h
@@ -0,0 +1,16 @@
+static const char* mouse_lua = R"(
+jin.mouse = jin.mouse or {}
+
+local jm = jin.mouse
+
+local button = {}
+
+function jin.mouse.isDown(btn)
+ return button[btn]
+end
+
+function jin.mouse.set(btn, status)
+ button[btn] = status
+end
+
+)"; \ No newline at end of file
diff --git a/src/lua/embed/scripts/net.lua.h b/src/lua/embed/scripts/net.lua.h
new file mode 100644
index 0000000..a986ce6
--- /dev/null
+++ b/src/lua/embed/scripts/net.lua.h
@@ -0,0 +1,7 @@
+/* net.lua */
+static const char* net_lua = R"(
+jin.net = jin.net or {}
+
+local jn = jin.net
+
+)"; \ No newline at end of file
diff --git a/src/lua/embed/scripts/path.lua.h b/src/lua/embed/scripts/path.lua.h
new file mode 100644
index 0000000..f7e1ec3
--- /dev/null
+++ b/src/lua/embed/scripts/path.lua.h
@@ -0,0 +1,16 @@
+/* path.lua */
+static const char* path_lua = R"(
+jin.path = jin.path or {}
+
+local jp = jin.path
+
+-- game root directory
+jin._root = nil
+
+-- return full path of a given path
+function jin.path.full(path)
+ local root = jin._dir .. '/' .. jin._argv[2]
+ return root .. '/' .. path
+end
+
+)"; \ No newline at end of file
diff --git a/src/lua/jin.cpp b/src/lua/jin.cpp
index faae9b2..d9f685b 100644
--- a/src/lua/jin.cpp
+++ b/src/lua/jin.cpp
@@ -1,39 +1,40 @@
-#include "jin.h"
+#include "lua/common/je_lua_common.h"
#include "lua/modules/luax.h"
#include "embed/embed.h"
+#include "jin.h"
namespace JinEngine
{
namespace Lua
{
- extern int luaopen_core(lua_State* L);
- extern int luaopen_graphics(lua_State* L);
- extern int luaopen_audio(lua_State* L);
- extern int luaopen_net(lua_State* L);
- extern int luaopen_event(lua_State* L);
- extern int luaopen_time(lua_State* L);
- extern int luaopen_mouse(lua_State* L);
- extern int luaopen_keyboard(lua_State* L);
- extern int luaopen_filesystem(lua_State* L);
- extern int luaopen_joypad(lua_State* L);
- extern int luaopen_math(lua_State* L);
- extern int luaopen_thread(lua_State* L);
- extern int luaopen_bit(lua_State* L);
+ LUA_PORT int luaopen_core(lua_State* L);
+ LUA_PORT int luaopen_graphics(lua_State* L);
+ LUA_PORT int luaopen_audio(lua_State* L);
+ LUA_PORT int luaopen_net(lua_State* L);
+ LUA_PORT int luaopen_event(lua_State* L);
+ LUA_PORT int luaopen_time(lua_State* L);
+ LUA_PORT int luaopen_mouse(lua_State* L);
+ LUA_PORT int luaopen_keyboard(lua_State* L);
+ LUA_PORT int luaopen_filesystem(lua_State* L);
+ LUA_PORT int luaopen_joypad(lua_State* L);
+ LUA_PORT int luaopen_math(lua_State* L);
+ LUA_PORT int luaopen_thread(lua_State* L);
+ LUA_PORT int luaopen_bit(lua_State* L);
- static int l_getversion(lua_State* L)
+ LUA_IMPLEMENT int l_getversion(lua_State* L)
{
luax_pushstring(L, VERSION);
return 1;
}
- static int l_getAuthor(lua_State* L)
+ LUA_IMPLEMENT int l_getAuthor(lua_State* L)
{
luax_pushstring(L, AUTHOR);
return 1;
}
- static int l_getOS(lua_State* L)
+ LUA_IMPLEMENT int l_getOS(lua_State* L)
{
#ifdef _WIN32
luax_pushstring(L, "windows");
@@ -45,65 +46,64 @@ namespace JinEngine
return 1;
}
- static int l_revision(lua_State* L)
+ LUA_IMPLEMENT int l_revision(lua_State* L)
{
luax_pushnumber(L, REVISION);
return 1;
}
- static const luax_Str s[] = {
+ LUA_IMPLEMENT const luax_Str s[] = {
{ "version", VERSION },
{ "author", AUTHOR },
{ "codename", CODE_NAME },
{ 0, 0 }
};
- static const luax_Num n[] = {
+ LUA_IMPLEMENT const luax_Num n[] = {
{ "revision", REVISION },
{ 0, 0 }
};
- /* sub modules */
- static const luax_Ref mods[] = {
- { "core", luaopen_core },
- { "event", luaopen_event },
- { "graphics", luaopen_graphics },
- { "time", luaopen_time },
- { "mouse", luaopen_mouse },
- { "keyboard", luaopen_keyboard },
- { "filesystem", luaopen_filesystem },
- { "net", luaopen_net },
- { "audio", luaopen_audio },
- { "joypad", luaopen_joypad },
- { "math", luaopen_math },
- { "thread", luaopen_thread },
- { "bit", luaopen_bit },
- //{"ai", luaopen_ai },
- { 0, 0 }
- };
-
/* register jin module, keep it on the top of stack */
- int luaopen_jin(lua_State* L)
+ LUA_EXPORT int luaopen_jin(lua_State* L)
{
luax_globaltable(L, MODULE_NAME);
- /* register values */
+ // Register values.
luax_setfieldstrings(L, s);
luax_setfieldnumbers(L, n);
- /* register submodules */
- for (int i = 0; mods[i].name; ++i)
+ luax_Reg modules[] = {
+ { "core", luaopen_core },
+ { "event", luaopen_event },
+ { "graphics", luaopen_graphics },
+ { "time", luaopen_time },
+ { "mouse", luaopen_mouse },
+ { "keyboard", luaopen_keyboard },
+ { "filesystem", luaopen_filesystem },
+ { "net", luaopen_net },
+ { "audio", luaopen_audio },
+ { "joypad", luaopen_joypad },
+ { "math", luaopen_math },
+ { "thread", luaopen_thread },
+ { "bit", luaopen_bit },
+ //{"ai", luaopen_ai },
+ { 0, 0 }
+ };
+
+ // Register sub modules.
+ for (int i = 0; modules[i].name; ++i)
{
- mods[i].func(L);
- luax_setfield(L, -2, mods[i].name);
+ modules[i].func(L);
+ luax_setfield(L, -2, modules[i].name);
}
return 1;
}
- void boot(lua_State* L)
+ LUA_EXPORT void boot(lua_State* L)
{
- JinEngine::embed::boot(L);
+ JinEngine::Embed::boot(L);
}
} // namespace Lua
diff --git a/src/lua/jin.h b/src/lua/jin.h
index 71ad51b..a4dcd3e 100644
--- a/src/lua/jin.h
+++ b/src/lua/jin.h
@@ -4,6 +4,7 @@
#ifndef __JIN_M_JIN_H
#define __JIN_M_JIN_H
+#include "lua/common/je_lua_common.h"
#include "luax.h"
#define MODULE_NAME "jin"
@@ -21,12 +22,12 @@ namespace JinEngine
///
/// open jin module.
///
- int luaopen_jin(lua_State* L);
+ LUA_EXPORT int luaopen_jin(lua_State* L);
///
/// Boot jin.
///
- void boot(lua_State* L);
+ LUA_EXPORT void boot(lua_State* L);
} // namespace JinEngine
} // namespace Lua
diff --git a/src/lua/libraries/luax/luax.h b/src/lua/libraries/luax/luax.h
index fd10737..311bc95 100644
--- a/src/lua/libraries/luax/luax.h
+++ b/src/lua/libraries/luax/luax.h
@@ -40,13 +40,13 @@
#define luax_pcall lua_pcall
#define luax_setglobal lua_setglobal
#define luax_setglobali(L, i, name)\
-lua_pushvalue(L, i);\
-lua_setglobal(L, name);
+ lua_pushvalue(L, i);\
+ lua_setglobal(L, name);
#define luax_pop lua_pop
#define luax_newtable lua_newtable
#define luax_getglobal lua_getglobal
-#define luax_clear(L) lua_settop(L, 0)
+#define luax_clearstack(L) lua_settop(L, 0)
/**
*
*/
@@ -89,6 +89,14 @@ inline bool luax_checkbool(lua_State *L, int numArg)
*/
/* get value and leaves it on top of stack */
#define luax_rawgetnumber(L, i, k) (lua_rawgeti(L,i, k), lua_tonumber(L, -1))
+inline float luax_rawgetnumberthenpop(lua_State* L, int i, int k)
+{
+ float n = luax_rawgetnumber(L, i, k);
+ luax_pop(L, 1);
+ return n;
+}
+
+#define luax_rawgeti lua_rawgeti
/**
*
@@ -111,6 +119,7 @@ inline bool luax_checkbool(lua_State *L, int numArg)
#define luax_pushboolean lua_pushboolean
#define luax_pushlightuserdata lua_pushlightuserdata
#define luax_pushnil lua_pushnil
+#define luax_pushvalue lua_pushvalue
//inline void luax_pushuserdata(lua_State* L, void* p)
//{
@@ -168,6 +177,10 @@ inline char luax_getfieldbool(lua_State* L, int I, const char* N)
char bin = lua_toboolean(L, -1);
return bin;
}
+/**
+*
+*/
+#define luax_call lua_call
/**
* Set raw
@@ -270,6 +283,7 @@ inline int luax_istype(lua_State* L, int idx, const char* tname)
#define luax_istable(L, i) luax_is(table, L, i)
#define luax_isnil(L, i) luax_is(nil, L, i)
#define luax_isboolean(L, i) luax_is(boolean, L, i)
+#define luax_isfunction(L, i) luax_is(function, L, i)
#define luax_isuserdata lua_isuserdata
#define luax_islightuserdata lua_islightuserdata
inline int luax_isinteger(lua_State* L, int i)
@@ -417,7 +431,11 @@ inline void luax_setfieldnumbers(lua_State* L, const luax_Num* strs)
}
}
-typedef luaL_Reg luax_Ref;
+typedef luaL_Reg luax_Reg;
+
+#define luax_ref luaL_ref
+
+#define luax_unref luaL_unref
#endif // #if LUA_VERSION_NUM == 501
diff --git a/src/lua/main.cpp b/src/lua/main.cpp
deleted file mode 100644
index 95862ec..0000000
--- a/src/lua/main.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifdef _WIN32
- #include <SDL2/SDL_Main.h>
- #include <direct.h>
-#endif
-
-#include "luax.h"
-#include "jin.h"
-#include "libjin/jin.h"
-#include <Windows.h>
-
-using namespace JinEngine::Lua;
-using namespace JinEngine::Filesystem;
-
-int main(int argc, char* argv[])
-{
- lua_State* L = luax_newstate();
-
- /* open lua standard module */
- luax_openlibs(L);
- /* open jin module */
- luaopen_jin(L);
- /* add args to field */
- luax_newtable(L);
- for (int i = 0; i < argc; ++i)
- luax_setrawstring(L, -2, i + 1, argv[i]);
- luax_setfield(L, -2, "args");
- /* push current working directory */
- /* absolute directory */
- Buffer cwd = Buffer(1024);
-#ifdef _WIN32
- _getcwd((char*)&cwd, cwd.size());
-#elif defined __unix__
-#elif defined __APPLE__
-#endif
- luax_setfieldstring(L, "cwd", (char*)&cwd);
- luax_clear(L);
-
- /* boot jin and run it */
- boot(L);
-
- luax_close(L);
-
- return 0;
-} \ No newline at end of file
diff --git a/src/lua/modules/ai/je_lua_ai.cpp b/src/lua/modules/ai/je_lua_ai.cpp
new file mode 100644
index 0000000..4afd625
--- /dev/null
+++ b/src/lua/modules/ai/je_lua_ai.cpp
@@ -0,0 +1,13 @@
+#include "libjin/jin.h"
+
+using namespace JinEngine::AI;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/modules/ai/je_lua_ai.h b/src/lua/modules/ai/je_lua_ai.h
new file mode 100644
index 0000000..036bc3f
--- /dev/null
+++ b/src/lua/modules/ai/je_lua_ai.h
@@ -0,0 +1,7 @@
+#ifndef __JE_LUA_AI_H__
+#define __JE_LUA_AI_H__
+
+#include "je_lua_behavior_tree.h"
+#include "je_lua_state_machine.h"
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/ai/je_lua_behavior_tree.cpp b/src/lua/modules/ai/je_lua_behavior_tree.cpp
new file mode 100644
index 0000000..20e8e55
--- /dev/null
+++ b/src/lua/modules/ai/je_lua_behavior_tree.cpp
@@ -0,0 +1,11 @@
+#include "libjin/jin.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_BehaviorTree = "Texture";
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/modules/ai/je_lua_behavior_tree.h b/src/lua/modules/ai/je_lua_behavior_tree.h
new file mode 100644
index 0000000..083d12b
--- /dev/null
+++ b/src/lua/modules/ai/je_lua_behavior_tree.h
@@ -0,0 +1,14 @@
+#ifndef __JE_LUA_BEHAVIOR_TREE_H__
+#define __JE_LUA_BEHAVIOR_TREE_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_BehaviorTree;
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/ai/je_lua_state_machine.cpp b/src/lua/modules/ai/je_lua_state_machine.cpp
new file mode 100644
index 0000000..86ce7a5
--- /dev/null
+++ b/src/lua/modules/ai/je_lua_state_machine.cpp
@@ -0,0 +1,25 @@
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+using namespace JinEngine::AI;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_StateMachine = "StateMachine";
+
+ LUA_IMPLEMENT int l_addEnterCallback(lua_State* L)
+ {
+ //StateMachine* sm;
+ //sm->addEnterListener("", [](void* p) -> void{
+
+ //
+ //});
+
+ return 0;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/modules/ai/je_lua_state_machine.h b/src/lua/modules/ai/je_lua_state_machine.h
new file mode 100644
index 0000000..3c78f75
--- /dev/null
+++ b/src/lua/modules/ai/je_lua_state_machine.h
@@ -0,0 +1,14 @@
+#ifndef __JE_LUA_STATE_MACHINE_H__
+#define __JE_LUA_STATE_MACHINE_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_StateMachine;
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/audio/audio.cpp b/src/lua/modules/audio/audio.cpp
deleted file mode 100644
index 198323d..0000000
--- a/src/lua/modules/audio/audio.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Audio;
- using namespace JinEngine::Filesystem;
-
- typedef SDLAudio Audio;
- typedef SDLSource Source;
-
- static int l_init(lua_State* L)
- {
- Audio::Setting setting;
- setting.samplerate = 44100;
- setting.samples = 44100;
- if (!Audio::get()->init(&setting))
- {
- luax_error(L, "could not init audio");
- luax_pushboolean(L, false);
- return 1;
- }
- luax_pushboolean(L, true);
- return 1;
- }
-
- static int l_play(lua_State* L)
- {
- Audio::get()->play();
- return 0;
- }
-
- static int l_stop(lua_State* L)
- {
- Audio::get()->stop();
- return 0;
- }
-
- static int l_pause(lua_State* L)
- {
- Audio::get()->pause();
- return 0;
- }
-
- static int l_resume(lua_State* L)
- {
- Audio::get()->resume();
- return 0;
- }
-
- static int l_setVolume(lua_State* L)
- {
- float volume = luax_checknumber(L, 1);
- Audio::get()->setVolume(volume);
- return 0;
- }
-
- static int l_newSource(lua_State* L)
- {
- AssetDatabase* fs = AssetDatabase::get();
- const char* f = luax_checkstring(L, 1);
- Buffer b;
- if (!fs->exists(f))
- {
- error(L, "No such image %s", f);
- goto fail;
- }
- if (!fs->read(f, b))
- {
- error(L, "Failed to read source file %s", f);
- goto fail;
- }
- Source* src = Source::createSource((void*)&b, b.size());
- if (src == nullptr)
- {
- error(L, "Failed to decode source file %s", f);
- goto fail;
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_AUDIO_SOURCE, sizeof(Proxy));
- proxy->bind(new Ref<Source>(src, JIN_AUDIO_SOURCE));
- return 1;
- fail:
- luax_pushnil(L);
- return 1;
- }
-
- static int l_destroy(lua_State* L)
- {
- Audio* audio = Audio::get();
- audio->quit();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "init", l_init },
- { "play", l_play },
- { "stop", l_stop },
- { "pause", l_pause },
- { "resume", l_resume },
- { "setVolume", l_setVolume },
- { "newSource", l_newSource },
- { "destroy", l_destroy },
- { 0, 0 }
- };
-
- extern int luaopen_Source(lua_State* L);
-
- int luaopen_audio(lua_State* L)
- {
- luaopen_Source(L);
-
- luax_newlib(L, f);
-
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/audio/je_lua_audio.cpp b/src/lua/modules/audio/je_lua_audio.cpp
new file mode 100644
index 0000000..50c5268
--- /dev/null
+++ b/src/lua/modules/audio/je_lua_audio.cpp
@@ -0,0 +1,135 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+#include "je_lua_source.h"
+
+using namespace JinEngine::Audio;
+using namespace JinEngine::Audio::SDL;
+using namespace JinEngine::Filesystem;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ typedef SDLAudio Audio;
+ typedef SDLSource Source;
+
+ struct
+ {
+ bool initialized = false;
+ } context;
+
+ LUA_IMPLEMENT int l_init(lua_State* L)
+ {
+ if (context.initialized)
+ {
+ // Already initialized.
+ luax_pushboolean(L, true);
+ return 1;
+ }
+ Audio::Setting setting;
+ setting.samplerate = 44100;
+ setting.samples = 44100;
+ context.initialized = Audio::get()->init(&setting);
+ if (!context.initialized)
+ {
+ luax_error(L, "could not init audio");
+ luax_pushboolean(L, false);
+ return 1;
+ }
+ luax_pushboolean(L, true);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_play(lua_State* L)
+ {
+ Audio::get()->play();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_stop(lua_State* L)
+ {
+ Audio::get()->stop();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_pause(lua_State* L)
+ {
+ Audio::get()->pause();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_resume(lua_State* L)
+ {
+ Audio::get()->resume();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setVolume(lua_State* L)
+ {
+ float volume = luax_checknumber(L, 1);
+ Audio::get()->setVolume(volume);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_newSource(lua_State* L)
+ {
+ AssetDatabase* fs = AssetDatabase::get();
+ const char* f = luax_checkstring(L, 1);
+ Buffer b;
+ try
+ {
+ if (!fs->exists(f))
+ throw Exception("No such source file %s.", f);
+ fs->read(f, b);
+ }
+ catch (Exception& e)
+ {
+ error(L, "Failed to read source file %s", f);
+ luax_pushnil(L);
+ return 1;
+ }
+ Source* src = Source::createSource((void*)&b, b.size());
+ if (src == nullptr)
+ {
+ error(L, "Failed to decode source file %s", f);
+ luax_pushnil(L);
+ return 1;
+ }
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Source);
+ proxy->bind(new Shared<Source>(src, Jin_Lua_Source));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_destroy(lua_State* L)
+ {
+ Audio* audio = Audio::get();
+ audio->quit();
+ return 0;
+ }
+
+ LUA_EXPORT int luaopen_audio(lua_State* L)
+ {
+ luaopen_Source(L);
+
+ luaL_Reg f[] = {
+ { "init", l_init },
+ { "play", l_play },
+ { "stop", l_stop },
+ { "pause", l_pause },
+ { "resume", l_resume },
+ { "setVolume", l_setVolume },
+ { "newSource", l_newSource },
+ { "destroy", l_destroy },
+ { 0, 0 }
+ };
+
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/audio/je_lua_audio.h b/src/lua/modules/audio/je_lua_audio.h
new file mode 100644
index 0000000..fa66392
--- /dev/null
+++ b/src/lua/modules/audio/je_lua_audio.h
@@ -0,0 +1,6 @@
+#ifndef __JE_LUA_AUDIO_H__
+#define __JE_LUA_AUDIO_H__
+
+#include "je_lua_audio.h"
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/audio/je_lua_source.cpp b/src/lua/modules/audio/je_lua_source.cpp
new file mode 100644
index 0000000..e152847
--- /dev/null
+++ b/src/lua/modules/audio/je_lua_source.cpp
@@ -0,0 +1,117 @@
+#include "libjin/jin.h"
+#include "lua/modules/luax.h"
+#include "lua/common/je_lua_common.h"
+
+
+using namespace JinEngine::Audio;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Source = "Source";
+
+ typedef Shared<Source>& SharedSource;
+
+ LUA_IMPLEMENT inline SharedSource checkSource(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Source);
+ return proxy->getShared<Source>();
+ }
+
+ LUA_IMPLEMENT int l_play(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ shared->play();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_stop(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ shared->stop();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_pause(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ shared->pause();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_rewind(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ shared->rewind();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_resume(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ shared->resume();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_isStop(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ bool isStop = shared->isStopped();
+ luax_pushboolean(L, isStop);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_isPaused(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ bool isPaused = shared->isPaused();
+ luax_pushboolean(L, isPaused);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_setVolume(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ float volume = luax_checknumber(L, 2);
+ shared->setVolume(volume);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setLoop(lua_State* L)
+ {
+ SharedSource shared = checkSource(L);
+ bool loop = luax_checkbool(L, 2);
+ shared->setLoop(loop);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Source);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Source(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "play", l_play },
+ { "stop", l_stop },
+ { "pause", l_pause },
+ { "resume", l_resume },
+ { "rewind", l_rewind },
+ { "isStop", l_isStop },
+ { "isPaused", l_isPaused },
+ { "setVolume", l_setVolume },
+ { "setLoop", l_setLoop },
+ { 0, 0 }
+ };
+
+ luax_newtype(L, Jin_Lua_Source, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/audio/je_lua_source.h b/src/lua/modules/audio/je_lua_source.h
new file mode 100644
index 0000000..f7e6b48
--- /dev/null
+++ b/src/lua/modules/audio/je_lua_source.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_SOURCE_H__
+#define __JE_LUA_SOURCE_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Source;
+
+ void luaopen_Source(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/audio/source.cpp b/src/lua/modules/audio/source.cpp
deleted file mode 100644
index bf43ceb..0000000
--- a/src/lua/modules/audio/source.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-#include "libjin/jin.h"
-#include "lua/modules/luax.h"
-#include "lua/common/common.h"
-#include "lua/modules/types.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Audio;
-
- typedef Ref<Source>& SourceRef;
-
- static inline SourceRef checkSource(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_AUDIO_SOURCE);
- return proxy->getRef<Source>();
- }
-
- static int l_play(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- ref->play();
- return 0;
- }
-
- static int l_stop(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- ref->stop();
- return 0;
- }
-
- static int l_pause(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- ref->pause();
- return 0;
- }
-
- static int l_rewind(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- ref->rewind();
- return 0;
- }
-
- static int l_resume(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- ref->resume();
- return 0;
- }
-
- static int l_isStop(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- bool isStop = ref->isStopped();
- luax_pushboolean(L, isStop);
- return 1;
- }
-
- static int l_isPaused(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- bool isPaused = ref->isPaused();
- luax_pushboolean(L, isPaused);
- return 1;
- }
-
- static int l_setVolume(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- float volume = luax_checknumber(L, 2);
- ref->setVolume(volume);
- return 0;
- }
-
- static int l_setLoop(lua_State* L)
- {
- SourceRef ref = checkSource(L);
- bool loop = luax_checkbool(L, 2);
- ref->setLoop(loop);
- return 0;
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_AUDIO_SOURCE);
- proxy->release();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "play", l_play },
- { "stop", l_stop },
- { "pause", l_pause },
- { "resume", l_resume },
- { "rewind", l_rewind },
- { "isStop", l_isStop },
- { "isPaused", l_isPaused },
- { "setVolume", l_setVolume },
- { "setLoop", l_setLoop },
- { 0, 0 }
- };
-
- int luaopen_Source(lua_State* L)
- {
- luax_newtype(L, JIN_AUDIO_SOURCE, f);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/bit/bit.cpp b/src/lua/modules/bit/bit.cpp
deleted file mode 100644
index cedd60a..0000000
--- a/src/lua/modules/bit/bit.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "lua/modules/luax.h"
-#include "libjin/jin.h"
-#include <cstdlib>
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- static int l_and(lua_State* L)
- {
- int a = luax_checkinteger(L, 1);
- int b = luax_checkinteger(L, 2);
- luax_pushinteger(L, a & b);
- return 1;
- }
-
- static int l_or(lua_State* L)
- {
- int a = luax_checkinteger(L, 1);
- int b = luax_checkinteger(L, 2);
- luax_pushinteger(L, a | b);
- return 1;
- }
-
- static int l_xor(lua_State* L)
- {
- int a = luax_checkinteger(L, 1);
- int b = luax_checkinteger(L, 2);
- luax_pushinteger(L, a ^ b);
- return 1;
- }
-
- static int l_not(lua_State* L)
- {
- int n = luax_checkinteger(L, 1);
- luax_pushinteger(L, ~n);
- return 1;
- }
-
- static int l_lshift(lua_State* L)
- {
- int a = luax_checkinteger(L, 1);
- int b = luax_checkinteger(L, 2);
- luax_pushinteger(L, a << b);
- return 1;
- }
-
- static int l_rshift(lua_State* L)
- {
- int a = luax_checkinteger(L, 1);
- int b = luax_checkinteger(L, 2);
- luax_pushinteger(L, a >> b);
- return 1;
- }
-
- static int l_include(lua_State* L)
- {
- int a = luax_checkinteger(L, 1);
- int b = luax_checkinteger(L, 2);
- luax_pushboolean(L, (a & b) == b);
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "bAnd", l_and },
- { "bOr" , l_or },
- { "bXor", l_xor },
- { "bNot", l_not },
- { "bLs", l_lshift },
- { "bRs", l_rshift },
- { "bInc", l_include },
- { 0, 0 }
- };
-
- int luaopen_bit(lua_State* L)
- {
- luax_newlib(L, f);
-
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/bit/je_lua_bit.cpp b/src/lua/modules/bit/je_lua_bit.cpp
new file mode 100644
index 0000000..fdd0ae0
--- /dev/null
+++ b/src/lua/modules/bit/je_lua_bit.cpp
@@ -0,0 +1,87 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+
+#include <cstdlib>
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LUA_IMPLEMENT int l_and(lua_State* L)
+ {
+ int a = luax_checkinteger(L, 1);
+ int b = luax_checkinteger(L, 2);
+ luax_pushinteger(L, a & b);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_or(lua_State* L)
+ {
+ int a = luax_checkinteger(L, 1);
+ int b = luax_checkinteger(L, 2);
+ luax_pushinteger(L, a | b);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_xor(lua_State* L)
+ {
+ int a = luax_checkinteger(L, 1);
+ int b = luax_checkinteger(L, 2);
+ luax_pushinteger(L, a ^ b);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_not(lua_State* L)
+ {
+ int n = luax_checkinteger(L, 1);
+ luax_pushinteger(L, ~n);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_lshift(lua_State* L)
+ {
+ int a = luax_checkinteger(L, 1);
+ int b = luax_checkinteger(L, 2);
+ luax_pushinteger(L, a << b);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_rshift(lua_State* L)
+ {
+ int a = luax_checkinteger(L, 1);
+ int b = luax_checkinteger(L, 2);
+ luax_pushinteger(L, a >> b);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_include(lua_State* L)
+ {
+ int a = luax_checkinteger(L, 1);
+ int b = luax_checkinteger(L, 2);
+ luax_pushboolean(L, (a & b) == b);
+ return 1;
+ }
+
+
+ LUA_EXPORT int luaopen_bit(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "bAnd", l_and },
+ { "bOr" , l_or },
+ { "bXor", l_xor },
+ { "bNot", l_not },
+ { "bLs", l_lshift },
+ { "bRs", l_rshift },
+ { "bInc", l_include },
+ { 0, 0 }
+ };
+
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/libjin/Graphics/particle/je_particle_system.h b/src/lua/modules/bit/je_lua_bit.h
index e69de29..e69de29 100644
--- a/src/libjin/Graphics/particle/je_particle_system.h
+++ b/src/lua/modules/bit/je_lua_bit.h
diff --git a/src/lua/modules/core/core.cpp b/src/lua/modules/core/core.cpp
deleted file mode 100644
index a576bec..0000000
--- a/src/lua/modules/core/core.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "lua/modules/luax.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Core;
-
- static int l_running(lua_State* L)
- {
- static Game* game = Game::get();
- bool running = game->running();
- luax_pushboolean(L, running);
- return 1;
- }
-
- static int l_stop(lua_State* L)
- {
- Game::get()->stop();
- return 0;
- }
-
- static int l_quit(lua_State* L)
- {
- Game::get()->quit();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "running", l_running },
- { "stop", l_stop },
- { "quit", l_quit },
- { 0, 0 }
- };
-
- int luaopen_core(lua_State* L)
- {
- luax_newlib(L, f);
-
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/core/je_lua_core.cpp b/src/lua/modules/core/je_lua_core.cpp
new file mode 100644
index 0000000..f5b06c3
--- /dev/null
+++ b/src/lua/modules/core/je_lua_core.cpp
@@ -0,0 +1,46 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+
+using namespace JinEngine::Game;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LUA_IMPLEMENT int l_running(lua_State* L)
+ {
+ static Application* app = Application::get();
+ bool running = app->running();
+ luax_pushboolean(L, running);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_stop(lua_State* L)
+ {
+ Application::get()->stop();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_quit(lua_State* L)
+ {
+ Application::get()->quit();
+ return 0;
+ }
+
+ LUA_EXPORT int luaopen_core(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "running", l_running },
+ { "stop", l_stop },
+ { "quit", l_quit },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/core/je_lua_core.h b/src/lua/modules/core/je_lua_core.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/core/je_lua_core.h
diff --git a/src/lua/modules/event/event.cpp b/src/lua/modules/event/event.cpp
deleted file mode 100644
index 9f565d0..0000000
--- a/src/lua/modules/event/event.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
-* Event module
-*/
-#include "lua/modules/luax.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine;
- using namespace JinEngine::Input;
-
- /**
- * Load event poll, return a iterator(a table).
- */
- static int l_event_poll(lua_State *L)
- {
- /* table to store events */
- luax_newtable(L);
- static Event e;
- int i = 1;
- poll:
- while (pollEvent(&e))
- {
- /**
- * TODO: ڴСıʱҪtransform
- *
- */
- luax_newtable(L);
- switch (e.type)
- {
- case EventType::QUIT:
- luax_setfieldstring(L, "type", "Quit");
- break;
-
- case EventType::KEY_DOWN:
- case EventType::KEY_UP:
- luax_setfieldstring(L, "type", e.type == EventType::KEY_DOWN ? "KeyDown" : "KeyUp");
- luax_setfieldstring(L, "key", getKeyName(e.key.keysym.sym));
- break;
-
- case EventType::MOUSE_MOTION:
- luax_setfieldstring(L, "type", "MouseMotion");
- luax_setfieldnumber(L, "x", e.motion.x);
- luax_setfieldnumber(L, "y", e.motion.y);
- break;
-
- case EventType::MOUSE_BUTTON_DOWN:
- case EventType::MOUSE_BUTTON_UP:
- luax_setfieldstring(L, "type", e.type == EventType::MOUSE_BUTTON_DOWN ? "MouseButtonDown" : "MouseButtonUp");
- luax_setfieldstring(L, "button", getButtonName(e.button.button));
- luax_setfieldnumber(L, "x", e.button.x);
- luax_setfieldnumber(L, "y", e.button.y);
- break;
-
- case EventType::MOUSE_WHEEL:
- luax_setfieldstring(L, "type", "Wheel");
- if(e.wheel.x == -1)
- luax_setfieldstring(L, "x", "Left");
- else if(e.wheel.x == 1)
- luax_setfieldstring(L, "x", "Right");
- else
- luax_setfieldstring(L, "x", "None");
- if (e.wheel.y == -1)
- luax_setfieldstring(L, "y", "Near");
- else if (e.wheel.y == 1)
- luax_setfieldstring(L, "y", "Far");
- else
- luax_setfieldstring(L, "y", "None");
- break;
-
- case EventType::JOYBUTTONDOWN:
- case EventType::JOYBUTTONUP:
- luax_setfieldstring(L, "type", e.type == EventType::JOYBUTTONDOWN ? "JoyButtonDown" : "JoyButtonUp");
- luax_setfieldinteger(L, "which", e.jbutton.which);
- luax_setfieldstring(L, "button", Input::getJoyButtonName(e.jbutton.button));
- break;
-
- case EventType::JOYAXISMOTION:
- luax_setfieldstring(L, "type", "JoyAxisMotion");
- luax_setfieldinteger(L, "which", e.jaxis.which);
- luax_setfieldfstring(L, "axis", Input::getJoyAxisName(e.jaxis.axis));
- break;
-
- case EventType::JOYBALLMOTION:
- case EventType::JOYHATMOTION:
-
- case EventType::JOYDEVICEADDED:
- case EventType::JOYDEVICEREMOVED:
- luax_setfieldfstring(L, "type", e.type == EventType::JOYDEVICEADDED ? "JoyDeviceAdded" : "JoyDeviceRemoved");
- luax_setfieldinteger(L, "which", e.jdevice.which);
- break;
-
- //https://stackoverflow.com/questions/50022316/what-is-sdl-joystick-and-what-is-sdl-gamecontroller-what-are-the-relationships
- case EventType::CONTROLLERBUTTONDOWN:
- case EventType::CONTROLLERBUTTONUP:
-
-
- case EventType::CONTROLLERAXISMOTION:
-
-
- default:
- /* ignore other events */
- luax_pop(L, 1); // pop table out
- goto poll;
- break;
- }
- luax_rawseti(L, -2, i++);
- }
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "poll", l_event_poll },
- { 0, 0 }
- };
-
- /**
- * load event module
- */
- int luaopen_event(lua_State* L)
- {
- luax_newlib(L, f);
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/event/je_lua_event.cpp b/src/lua/modules/event/je_lua_event.cpp
new file mode 100644
index 0000000..82ba385
--- /dev/null
+++ b/src/lua/modules/event/je_lua_event.cpp
@@ -0,0 +1,130 @@
+/**
+* Event module
+*/
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+
+using namespace JinEngine;
+using namespace JinEngine::Input;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ /**
+ * Load event poll, return a iterator(a table).
+ */
+ LUA_IMPLEMENT int l_event_poll(lua_State *L)
+ {
+ /* table to store events */
+ luax_newtable(L);
+ static Event e;
+ int i = 1;
+ poll:
+ while (pollEvent(&e))
+ {
+ /**
+ * TODO: ڴСıʱҪtransform
+ *
+ */
+ luax_newtable(L);
+ switch (e.type)
+ {
+ case EventType::QUIT:
+ luax_setfieldstring(L, "type", "Quit");
+ break;
+
+ case EventType::KEY_DOWN:
+ case EventType::KEY_UP:
+ luax_setfieldstring(L, "type", e.type == EventType::KEY_DOWN ? "KeyDown" : "KeyUp");
+ luax_setfieldstring(L, "key", getKeyName(e.key.keysym.sym));
+ break;
+
+ case EventType::MOUSE_MOTION:
+ luax_setfieldstring(L, "type", "MouseMotion");
+ luax_setfieldnumber(L, "x", e.motion.x);
+ luax_setfieldnumber(L, "y", e.motion.y);
+ break;
+
+ case EventType::MOUSE_BUTTON_DOWN:
+ case EventType::MOUSE_BUTTON_UP:
+ luax_setfieldstring(L, "type", e.type == EventType::MOUSE_BUTTON_DOWN ? "MouseButtonDown" : "MouseButtonUp");
+ luax_setfieldstring(L, "button", getButtonName(e.button.button));
+ luax_setfieldnumber(L, "x", e.button.x);
+ luax_setfieldnumber(L, "y", e.button.y);
+ break;
+
+ case EventType::MOUSE_WHEEL:
+ luax_setfieldstring(L, "type", "Wheel");
+ if(e.wheel.x == -1)
+ luax_setfieldstring(L, "x", "Left");
+ else if(e.wheel.x == 1)
+ luax_setfieldstring(L, "x", "Right");
+ else
+ luax_setfieldstring(L, "x", "None");
+ if (e.wheel.y == -1)
+ luax_setfieldstring(L, "y", "Near");
+ else if (e.wheel.y == 1)
+ luax_setfieldstring(L, "y", "Far");
+ else
+ luax_setfieldstring(L, "y", "None");
+ break;
+
+ case EventType::JOYBUTTONDOWN:
+ case EventType::JOYBUTTONUP:
+ luax_setfieldstring(L, "type", e.type == EventType::JOYBUTTONDOWN ? "JoyButtonDown" : "JoyButtonUp");
+ luax_setfieldinteger(L, "which", e.jbutton.which);
+ luax_setfieldstring(L, "button", Input::getJoyButtonName(e.jbutton.button));
+ break;
+
+ case EventType::JOYAXISMOTION:
+ luax_setfieldstring(L, "type", "JoyAxisMotion");
+ luax_setfieldinteger(L, "which", e.jaxis.which);
+ luax_setfieldfstring(L, "axis", Input::getJoyAxisName(e.jaxis.axis));
+ break;
+
+ case EventType::JOYBALLMOTION:
+ case EventType::JOYHATMOTION:
+
+ case EventType::JOYDEVICEADDED:
+ case EventType::JOYDEVICEREMOVED:
+ luax_setfieldfstring(L, "type", e.type == EventType::JOYDEVICEADDED ? "JoyDeviceAdded" : "JoyDeviceRemoved");
+ luax_setfieldinteger(L, "which", e.jdevice.which);
+ break;
+
+ //https://stackoverflow.com/questions/50022316/what-is-sdl-joystick-and-what-is-sdl-gamecontroller-what-are-the-relationships
+ case EventType::CONTROLLERBUTTONDOWN:
+ case EventType::CONTROLLERBUTTONUP:
+
+
+ case EventType::CONTROLLERAXISMOTION:
+
+ default:
+ // Ignore oter events and pop up the event table.
+ luax_pop(L, 1);
+ goto poll;
+ break;
+ }
+ luax_rawseti(L, -2, i++);
+ }
+ return 1;
+ }
+
+ /**
+ * load event module
+ */
+ LUA_EXPORT int luaopen_event(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "poll", l_event_poll },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/event/je_lua_event.h b/src/lua/modules/event/je_lua_event.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/event/je_lua_event.h
diff --git a/src/lua/modules/filesystem/filesystem.cpp b/src/lua/modules/filesystem/filesystem.cpp
deleted file mode 100644
index 7466ce8..0000000
--- a/src/lua/modules/filesystem/filesystem.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-#include "lua/modules/luax.h"
-#include "libjin/jin.h"
-#include <string>
-
-using namespace JinEngine::Filesystem;
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- static struct
- {
- AssetDatabase* fs;
- } context;
-
- static int l_init(lua_State* L)
- {
- context.fs = AssetDatabase::get();
- return 0;
- }
-
- static int l_mount(lua_State* L)
- {
- const char* path = luax_checkstring(L, 1);
- context.fs->mount(path);
- return 0;
- }
-
- static int l_exist(lua_State * L)
- {
- const char* path = luax_checkstring(L, 1);
- int r = context.fs->exists(path);
- luax_pushboolean(L, r);
- return 1;
- }
-
- static int l_isDir(lua_State* L)
- {
- const char* path = luax_checkstring(L, 1);
- int r = context.fs->isDir(path);
- luax_pushboolean(L, r);
- return 1;
- }
-
- static int l_isFile(lua_State* L)
- {
- const char* path = luax_checkstring(L, 1);
- int r = context.fs->isFile(path);
- luax_pushboolean(L, r);
- return 1;
- }
-
- static int loadbuffer(lua_State* L)
- {
- const char* filename = lua_tostring(L, -1);
- Buffer bf;
- context.fs->read(filename, bf);
- luax_loadbuffer(L, (const char*)&bf, bf.size(), filename);
- return 1;
- }
-
- static int loader(lua_State* L)
- {
- const char * filename = lua_tostring(L, -1);
-
- std::string tmp(filename);
- tmp += ".lua";
-
- int size = tmp.size();
-
- for (int i = 0; i<size - 4; ++i)
- {
- if (tmp[i] == '.')
- {
- tmp[i] = '/';
- }
- }
-
- if (context.fs->exists(tmp.c_str()))
- {
- lua_pop(L, 1);
- lua_pushstring(L, tmp.c_str());
- return loadbuffer(L);
- }
-
- tmp = filename;
- size = tmp.size();
- for (int i = 0; i<size; ++i)
- {
- if (tmp[i] == '.')
- tmp[i] = '/';
- }
-
- if (context.fs->isDir(tmp.c_str()))
- {
- tmp += "/init.lua";
- if (context.fs->exists(tmp.c_str()))
- {
- lua_pop(L, 1);
- lua_pushstring(L, tmp.c_str());
- return loadbuffer(L);
- }
- }
-
- lua_pushfstring(L, "\n\tno file \"%s\" in jin game directories.\n", (tmp + ".lua").c_str());
- return 1;
- }
-
- static int l_read(lua_State* L)
- {
- AssetDatabase* fs = context.fs;
- const char* file = luax_checkstring(L, 1);
- unsigned int len;
- Buffer buffer;
- fs->read(file, buffer);
- luax_pushstring(L, (char*)&buffer);
- luax_pushinteger(L, buffer.size());
- return 2;
- }
-
- static const luaL_Reg f[] = {
- { "init", l_init },
- { "mount", l_mount },
- { "isDirectory", l_isDir },
- { "isFile", l_isFile },
- { "exist", l_exist },
- { "read", l_read },
- { 0, 0 }
- };
-
- int luaopen_filesystem(lua_State* L)
- {
- luax_newlib(L, f);
- luax_registersearcher(L, loader, 1);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/filesystem/je_lua_filesystem.cpp b/src/lua/modules/filesystem/je_lua_filesystem.cpp
new file mode 100644
index 0000000..6245ba8
--- /dev/null
+++ b/src/lua/modules/filesystem/je_lua_filesystem.cpp
@@ -0,0 +1,141 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+#include <string>
+
+using namespace JinEngine::Filesystem;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LUA_IMPLEMENT struct
+ {
+ AssetDatabase* fs;
+ } context;
+
+ LUA_IMPLEMENT int l_init(lua_State* L)
+ {
+ context.fs = AssetDatabase::get();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_mount(lua_State* L)
+ {
+ const char* path = luax_checkstring(L, 1);
+ context.fs->mount(path);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_exist(lua_State * L)
+ {
+ const char* path = luax_checkstring(L, 1);
+ int r = context.fs->exists(path);
+ luax_pushboolean(L, r);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_isDir(lua_State* L)
+ {
+ const char* path = luax_checkstring(L, 1);
+ int r = context.fs->isDir(path);
+ luax_pushboolean(L, r);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_isFile(lua_State* L)
+ {
+ const char* path = luax_checkstring(L, 1);
+ int r = context.fs->isFile(path);
+ luax_pushboolean(L, r);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int loadbuffer(lua_State* L)
+ {
+ const char* filename = lua_tostring(L, -1);
+ Buffer bf;
+ context.fs->read(filename, bf);
+ luax_loadbuffer(L, (const char*)&bf, bf.size(), filename);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int loader(lua_State* L)
+ {
+ const char * filename = lua_tostring(L, -1);
+
+ std::string tmp(filename);
+ tmp += ".lua";
+
+ int size = tmp.size();
+
+ for (int i = 0; i<size - 4; ++i)
+ {
+ if (tmp[i] == '.')
+ {
+ tmp[i] = '/';
+ }
+ }
+
+ if (context.fs->exists(tmp.c_str()))
+ {
+ lua_pop(L, 1);
+ lua_pushstring(L, tmp.c_str());
+ return loadbuffer(L);
+ }
+
+ tmp = filename;
+ size = tmp.size();
+ for (int i = 0; i<size; ++i)
+ {
+ if (tmp[i] == '.')
+ tmp[i] = '/';
+ }
+
+ if (context.fs->isDir(tmp.c_str()))
+ {
+ tmp += "/init.lua";
+ if (context.fs->exists(tmp.c_str()))
+ {
+ lua_pop(L, 1);
+ lua_pushstring(L, tmp.c_str());
+ return loadbuffer(L);
+ }
+ }
+
+ lua_pushfstring(L, "\n\tno file \"%s\" in jin game directories.\n", (tmp + ".lua").c_str());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_read(lua_State* L)
+ {
+ AssetDatabase* fs = context.fs;
+ const char* file = luax_checkstring(L, 1);
+ unsigned int len;
+ Buffer buffer;
+ fs->read(file, buffer);
+ luax_pushstring(L, (char*)&buffer);
+ luax_pushinteger(L, buffer.size());
+ return 2;
+ }
+
+ LUA_EXPORT int luaopen_filesystem(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "init", l_init },
+ { "mount", l_mount },
+ { "isDirectory", l_isDir },
+ { "isFile", l_isFile },
+ { "exist", l_exist },
+ { "read", l_read },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+ luax_registersearcher(L, loader, 1);
+
+ return 0;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/filesystem/je_lua_filesystem.h b/src/lua/modules/filesystem/je_lua_filesystem.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/filesystem/je_lua_filesystem.h
diff --git a/src/lua/modules/graphics/bitmap.cpp b/src/lua/modules/graphics/bitmap.cpp
deleted file mode 100644
index 13517f9..0000000
--- a/src/lua/modules/graphics/bitmap.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- typedef Ref<Bitmap>& BitmapRef;
-
- static inline BitmapRef checkBitmap(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_BITMAP);
- return proxy->getRef<Bitmap>();
- }
-
- static int l_gc(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- ref.release();
- return 0;
- }
-
- static int l_getWidth(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- int w = ref->getWidth();
- luax_pushinteger(L, w);
- return 1;
- }
-
- static int l_getHeight(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- int h = ref->getHeight();
- luax_pushinteger(L, h);
- return 1;
- }
-
- static int l_getSize(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- int w = ref->getWidth();
- int h = ref->getHeight();
- luax_pushinteger(L, w);
- luax_pushinteger(L, h);
- return 2;
- }
-
- static int l_getPixel(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- int x = luax_checkinteger(L, 2);
- int y = luax_checkinteger(L, 3);
- Color col = ref->getPixel(x, y);
- luax_pushinteger(L, col.r);
- luax_pushinteger(L, col.g);
- luax_pushinteger(L, col.b);
- luax_pushinteger(L, col.a);
- return 4;
- }
-
- static int l_setPixel(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- int x = luax_checkinteger(L, 2);
- int y = luax_checkinteger(L, 3);
- if (!luax_istable(L, 4))
- {
- luax_typerror(L, 4, "table");
- return 1;
- }
- unsigned int r = luax_rawgetnumber(L, 4, 1);
- unsigned int g = luax_rawgetnumber(L, 4, 2);
- unsigned int b = luax_rawgetnumber(L, 4, 3);
- unsigned int a = luax_rawgetnumber(L, 4, 4);
- ref->setPixel(Color(r, g, b, a), x, y);
- return 0;
- }
-
- static int l_clone(lua_State* L)
- {
- BitmapRef ref = checkBitmap(L);
- Bitmap* bitmap = ref.getObject();
- Bitmap* b = Bitmap::clone(bitmap);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_BITMAP, sizeof(Proxy));
- proxy->bind(new Ref<Bitmap>(b, JIN_GRAPHICS_BITMAP));
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { "getPixel", l_getPixel },
- { "setPixel", l_setPixel },
- { "clone", l_clone },
- { 0, 0 }
- };
-
- int luaopen_Bitmap(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_BITMAP, f);
- return 0;
- }
-
- } // graphics
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/canvas.cpp b/src/lua/modules/graphics/canvas.cpp
deleted file mode 100644
index e49e209..0000000
--- a/src/lua/modules/graphics/canvas.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- typedef Ref<Canvas>& CanvasRef;
-
- static inline CanvasRef checkCanvas(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- return proxy->getRef<Canvas>();
- }
-
- static int l_getWidth(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- luax_pushnumber(L, ref->getWidth());
- return 1;
- }
-
- static int l_getHeight(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- luax_pushnumber(L, ref->getHeight());
- return 1;
- }
-
- static int l_getSize(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- luax_pushnumber(L, ref->getWidth());
- luax_pushnumber(L, ref->getHeight());
- return 2;
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- proxy->release();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { 0, 0 }
- };
-
- int luaopen_Canvas(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_CANVAS, f);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp
deleted file mode 100644
index 8b2d7cd..0000000
--- a/src/lua/modules/graphics/graphics.cpp
+++ /dev/null
@@ -1,819 +0,0 @@
-#include <iostream>
-#include <fstream>
-
-#include "libjin/jin.h"
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-
-using namespace std;
-using namespace JinEngine;
-using namespace JinEngine::Graphics;
-using JinEngine::Filesystem::AssetDatabase;
-using JinEngine::Filesystem::Buffer;
-
-namespace JinEngine
-{
- namespace Lua
- {
-
-#include "../../resources/font.ttf.h"
-
- static struct
- {
- Color curRenderColor;
- Color curClearColor;
- Font* curFont = nullptr;
- Font* defaultFont = nullptr;
- } context;
-
- static int l_init(lua_State* L)
- {
- Window* wnd = Window::get();
- Window::Setting setting;
- setting.width = luax_getfieldinteger(L, 1, "width");
- setting.height = luax_getfieldinteger(L, 1, "height");
- setting.title = luax_getfieldstring(L, 1, "title");
- setting.vsync = luax_getfieldbool(L, 1, "vsync");
- setting.fullscreen = luax_getfieldbool(L, 1, "fullscreen");
- setting.resizable = luax_getfieldbool(L, 1, "resizable");
- if (!wnd->init(&setting))
- {
- luax_pushboolean(L, false);
- return 1;
- }
- {
- /* load default font */
- Bitmap* bitmap = Bitmap::createBitmap(default_font_bitmap, sizeof(default_font_bitmap));
- const Color* pixels = bitmap->getPixels();
- ofstream f = ofstream();
- f.open("font.pixels", ios_base::app);
- for (int y = 0; y < bitmap->getHeight(); ++y)
- {
- for (int x = 0; x < bitmap->getWidth(); ++x)
- {
- Color c = pixels[x + y * bitmap->getWidth()];
- f << (int)c.r << ",";
- f << (int)c.g << ",";
- f << (int)c.b << ",";
- f << (int)c.a << ",";
- }
- }
-
- TextureFont* tf = TextureFont::createTextureFont(bitmap, Text(Encode::UTF8, default_charset), default_font_split, bitmap->getHeight());
- context.defaultFont = tf;
- delete bitmap;
- }
- context.curFont = context.defaultFont;
-
- luax_pushboolean(L, true);
- return 1;
- }
-
- static int l_setTitle(lua_State* L)
- {
- Window* wnd = Window::get();
- const char* title = luax_checkstring(L, 1);
- wnd->setTitle(title);
- return 0;
- }
-
- static int l_destroy(lua_State* L)
- {
- Window* wnd = Window::get();
- wnd->quit();
- return 0;
- }
-
- static int l_getSize(lua_State* L)
- {
- Window* wnd = Window::get();
- luax_pushnumber(L, wnd->getW());
- luax_pushnumber(L, wnd->getH());
- return 2;
- }
-
- static int l_getWidth(lua_State* L)
- {
- Window* wnd = Window::get();
- luax_pushnumber(L, wnd->getW());
- return 1;
- }
-
- static int l_getHeight(lua_State* L)
- {
- Window* wnd = Window::get();
- luax_pushnumber(L, wnd->getH());
- return 1;
- }
-
- static int l_newBitmap(lua_State* L)
- {
- Bitmap* bitmap = nullptr;
- if (luax_gettop(L) == 2)
- {
- int w = luax_checkinteger(L, 1);
- int h = luax_checkinteger(L, 2);
- bitmap = Bitmap::createBitmap(w, h);
- }
- else if (luax_gettop(L) == 3)
- {
- int w = luax_checkinteger(L, 1);
- int h = luax_checkinteger(L, 2);
- if (!luax_istable(L, 3))
- {
- luax_typerror(L, 3, "table");
- return 1;
- }
- unsigned int r = luax_rawgetnumber(L, 3, 1);
- unsigned int g = luax_rawgetnumber(L, 3, 2);
- unsigned int b = luax_rawgetnumber(L, 3, 3);
- unsigned int a = luax_rawgetnumber(L, 3, 4);
- bitmap = Bitmap::createBitmap(w, h, Color(r, g, b, a));
- }
- else
- {
- const char* f = luax_checkstring(L, 1);
- AssetDatabase* fs = AssetDatabase::get();
- if (!fs->exists(f))
- {
- error(L, "No such image file %s", f);
- goto fail;
- }
- Buffer b;
- if (!fs->read(f, b))
- {
- error(L, "Failed to read image %s", f);
- goto fail;
- }
- bitmap = Bitmap::createBitmap(&b, b.size());
- if (bitmap == nullptr)
- {
- error(L, "Failed to decode image file %s", f);
- goto fail;
- }
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_BITMAP, sizeof(Proxy));
- proxy->bind(new Ref<Bitmap>(bitmap, JIN_GRAPHICS_BITMAP));
- return 1;
- fail:
- luax_pushnil(L);
- return 1;
- }
-
- /* jin.graphics.newTexture(bitmap) */
- static int l_newTexture(lua_State* L)
- {
- Texture* texture = nullptr;
- if (luax_istype(L, 1, JIN_GRAPHICS_BITMAP))
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_BITMAP);
- Ref<Bitmap>& refBitmap = p->getRef<Bitmap>();
- Bitmap* bitmap = refBitmap.getObject();
- texture = Texture::createTexture(bitmap);
- }
- else if (luax_isstring(L, 1))
- {
- const char* path = luax_checkstring(L, 1);
- texture = Texture::createTexture(path);
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_TEXTURE, sizeof(Proxy));
- proxy->bind(new Ref<Texture>(texture, JIN_GRAPHICS_TEXTURE));
- return 1;
- }
-
- static int l_newShader(lua_State* L)
- {
- const char* program = luax_checkstring(L, 1);
- Shader* jsl = Shader::createShader(program);
- if (jsl == nullptr)
- {
- error(L, "Failed to compile shader");
- luax_pushnil(L);
- return 1;
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_SHADER, sizeof(Proxy));
- proxy->bind(new Ref<Shader>(jsl, JIN_GRAPHICS_SHADER));
- return 1;
- }
-
- static int l_newShaderf(lua_State* L)
- {
- const char* path = luax_checkstring(L, 1);
- AssetDatabase* fs = AssetDatabase::get();
- if (!fs->exists(path))
- {
- error(L, "No such shader file %s\n", path);
- luax_pushnil(L);
- return 1;
- }
- Buffer b;
- fs->read(path, b);
- Shader* jsl = Shader::createShader((char*)&b);
- if (jsl == nullptr)
- {
- error(L, "Failed to compile shader");
- luax_pushnil(L);
- return 1;
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_SHADER, sizeof(Proxy));
- proxy->bind(new Ref<Shader>(jsl, JIN_GRAPHICS_SHADER));
- return 1;
- }
-
- static int l_newCanvas(lua_State* L)
- {
- int w = luax_checknumber(L, 1);
- int h = luax_checknumber(L, 2);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_CANVAS, sizeof(Proxy));
- Canvas* cvs = Canvas::createCanvas(w, h);
- proxy->bind(new Ref<Canvas>(cvs, JIN_GRAPHICS_CANVAS));
- return 1;
- }
-
- static int l_clear(lua_State* L)
- {
- glClear(GL_COLOR_BUFFER_BIT);
- return 0;
- }
-
- static int l_setClearColor(lua_State* L)
- {
- if (luax_gettop(L) == 0)
- {
- glClearColor(0, 0, 0, 1);
- return 0;
- }
-
- context.curClearColor.r = luax_checknumber(L, 1);
- context.curClearColor.g = luax_checknumber(L, 2);
- context.curClearColor.b = luax_checknumber(L, 3);
- context.curClearColor.a = luax_checknumber(L, 4);
-
- gl.setClearColor(context.curClearColor.r,
- context.curClearColor.g,
- context.curClearColor.b,
- context.curClearColor.a);
- return 0;
- }
-
- static int l_present(lua_State* L)
- {
- Window::get()->swapBuffers();
- return 0;
- }
-
- static void l_draw_texture(lua_State* L)
- {
- if (!luax_istype(L, 1, JIN_GRAPHICS_TEXTURE))
- return;
- int x = luax_optnumber(L, 2, 0);
- int y = luax_optnumber(L, 3, 0);
- float sx = luax_optnumber(L, 4, 1);
- float sy = luax_optnumber(L, 5, 1);
- float r = luax_optnumber(L, 6, 0);
- float ox = luax_optnumber(L, 7, 0);
- float oy = luax_optnumber(L, 8, 0);
- Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Ref<Texture>& tex = proxy->getRef<Texture>();
- tex->draw(x, y, sx, sy, r, ox, oy);
- }
-
- static void l_draw_canvas(lua_State* L)
- {
- if (!luax_istype(L, 1, JIN_GRAPHICS_CANVAS))
- return;
- int x = luax_optnumber(L, 2, 0);
- int y = luax_optnumber(L, 3, 0);
- float sx = luax_optnumber(L, 4, 1);
- float sy = luax_optnumber(L, 5, 1);
- float r = luax_optnumber(L, 6, 0);
- float ox = luax_optnumber(L, 7, 0);
- float oy = luax_optnumber(L, 8, 0);
- Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Ref<Canvas>& p = proxy->getRef<Canvas>();
- p->draw(x, y, sx, sy, r, ox, oy);
- }
-
- /* jin.graphics.draw(text, font, x, y) */
- static void l_draw_text(lua_State* L)
- {
- if (!luax_istype(L, 1, JIN_GRAPHICS_TEXT))
- return;
- Proxy* p = (Proxy*)luax_toudata(L, 1);
- Text* text = p->getObject<Text>();
- int x = luax_optnumber(L, 3, 0);
- int y = luax_optnumber(L, 4, 0);
- int spacing = luax_optnumber(L, 6, 0);
- Font* font = nullptr;
- Proxy* p2 = (Proxy*)luax_toudata(L, 2);
- if (luax_istype(L, 2, JIN_GRAPHICS_TEXTUREFONT))
- {
- TextureFont* tf = p2->getObject<TextureFont>();
- font = tf;
- }
- else if (luax_istype(L, 2, JIN_GRAPHICS_TTF))
- {
- TTF* ttf = p2->getObject<TTF>();
- font = ttf;
- }
- else
- {
- font = context.defaultFont;
- }
- int lineheight = luax_optnumber(L, 5, font->getFontSize());
- font->print(*text, x, y, lineheight, spacing);
- }
-
- /* jin.graphics.draw(page, x, y) */
- static void l_draw_page(lua_State* L)
- {
- if (!luax_istype(L, 1, JIN_GRAPHICS_PAGE))
- return;
- int x = luax_optnumber(L, 2, 0);
- int y = luax_optnumber(L, 3, 0);
- Proxy* p = (Proxy*)luax_toudata(L, 1);
- Page* page = p->getObject<Page>();
- Font* font = page->font;
- font->print(page, x, y);
- }
-
- static int l_draw(lua_State* L)
- {
- if (luax_istype(L, 1, JIN_GRAPHICS_TEXTURE))
- l_draw_texture(L);
- else if (luax_istype(L, 1, JIN_GRAPHICS_CANVAS))
- l_draw_canvas(L);
- else if (luax_istype(L, 1, JIN_GRAPHICS_TEXT))
- l_draw_text(L);
- else if (luax_istype(L, 1, JIN_GRAPHICS_PAGE))
- l_draw_page(L);
- else
- {
- luax_typerror(L, 1, "texture or canvas");
- return 1;
- }
- return 0;
- }
-
- // draw(tex, quad, x, y, sx, sy, r, ax, ay)
- static int l_drawq(lua_State* L)
- {
- if (!luax_istable(L, 2))
- {
- luax_typerror(L, 2, "table");
- return 1;
- }
- Math::Quad q;
- q.x = luax_rawgetnumber(L, 2, 1);
- q.y = luax_rawgetnumber(L, 2, 2);
- q.w = luax_rawgetnumber(L, 2, 3);
- q.h = luax_rawgetnumber(L, 2, 4);
- luax_pop(L, 4);
- int x = luax_optnumber(L, 3, 0);
- int y = luax_optnumber(L, 4, 0);
- float sx = luax_optnumber(L, 5, 1);
- float sy = luax_optnumber(L, 6, 1);
- float r = luax_optnumber(L, 7, 0);
- float ox = luax_optnumber(L, 8, 0);
- float oy = luax_optnumber(L, 9, 0);
-
- if (luax_istype(L, 1, JIN_GRAPHICS_TEXTURE))
- {
- Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Ref<Texture>& tex = proxy->getRef<Texture>();
- tex->draw(q, x, y, sx, sy, r, ox, oy);
- }
- else if (luax_istype(L, 1, JIN_GRAPHICS_CANVAS))
- {
- Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Ref<Canvas>& p = proxy->getRef<Canvas>();
- p->draw(q, x, y, sx, sy, r, ox, oy);
- }
- else
- {
- luax_typerror(L, 1, "texture or canvas");
- }
- }
-
- /* print(string, x, y, lineheight, spacing) */
- /* need set font */
- static int l_print(lua_State* L)
- {
- Font* font = context.curFont;
- if (font == nullptr)
- return 0;
- unsigned length;
- const char* str = luax_checklstring(L, 1, &length);
- Text text(Encode::UTF8, str, length);
- int x = luax_optnumber(L, 2, 0);
- int y = luax_optnumber(L, 3, 0);
- int lineheight = luax_optnumber(L, 4, font->getFontSize());
- int spacing = luax_optnumber(L, 5, 0);
- font->print(text, x, y, lineheight, spacing);
- return 0;
- }
-
- static int l_setColor(lua_State* L)
- {
- if (luax_gettop(L) == 0)
- {
- glColor4f(1, 1, 1, 1);
- return 0;
- }
-
- context.curRenderColor.r = luax_checknumber(L, 1);
- context.curRenderColor.g = luax_checknumber(L, 2);
- context.curRenderColor.b = luax_checknumber(L, 3);
- if (luax_gettop(L) == 4)
- context.curRenderColor.a = luax_checknumber(L, 4);
- else
- context.curRenderColor.a = 255;
- glColor4f(context.curRenderColor.r / 255.f,
- context.curRenderColor.g / 255.f,
- context.curRenderColor.b / 255.f,
- context.curRenderColor.a / 255.f);
- return 0;
- }
-
- static int l_getColor(lua_State * L)
- {
- luax_pushnumber(L, context.curRenderColor.r);
- luax_pushnumber(L, context.curRenderColor.g);
- luax_pushnumber(L, context.curRenderColor.b);
- luax_pushnumber(L, context.curRenderColor.a);
- return 4;
- }
-
- static int l_bindCanvas(lua_State* L)
- {
- if (luax_gettop(L) == 0)
- {
- // bind to default canvas
- Canvas::unbind();
- return 0;
- }
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- Ref<Canvas>& ref = proxy->getRef<Canvas>();
- Canvas::bind(ref.getObject());
- return 0;
- }
-
- static int l_unbindCanvas(lua_State* L)
- {
- Canvas::unbind();
- return 0;
- }
-
- static int l_useShader(lua_State* L)
- {
- if (luax_gettop(L) == 0)
- {
- Shader::unuse();
- return 0;
- }
- if (luax_istype(L, 1, JIN_GRAPHICS_SHADER))
- {
- Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Ref<Shader>& jsl = proxy->getRef<Shader>();
- jsl->use();
- }
- else
- {
- luax_typerror(L, 1, "JSL shader");
- }
- return 0;
- }
-
- static int l_setBlend(lua_State* L)
- {
-
- return 0;
- }
-
- static RenderMode strtomode(const char* str)
- {
- std::string s = std::string(str);
- if (s == "fill") return RenderMode::FILL;
- else if (s == "line") return RenderMode::LINE;
- else return RenderMode::NONE;
- }
-
- static int l_point(lua_State* L)
- {
- int x = luax_checknumber(L, 1);
- int y = luax_checknumber(L, 2);
- JinEngine::Graphics::point(x, y);
-
- return 0;
- }
-
- static int l_line(lua_State* L)
- {
- int x1 = luax_checknumber(L, 1);
- int y1 = luax_checknumber(L, 2);
- int x2 = luax_checknumber(L, 3);
- int y2 = luax_checknumber(L, 4);
- JinEngine::Graphics::line(x1, y1, x2, y2);
-
- return 0;
- }
-
- static int l_rect(lua_State* L)
- {
- const char* modestr = luax_checkstring(L, 1);
- RenderMode mode = strtomode(modestr);
- if (mode != RenderMode::NONE)
- {
- int x = luax_checknumber(L, 2);
- int y = luax_checknumber(L, 3);
- int w = luax_checknumber(L, 4);
- int h = luax_checknumber(L, 5);
- rect(mode, x, y, w, h);
- }
- else
- {
- luax_typerror(L, 1, "'fill' or 'line'");
- return 1;
- }
-
- return 0;
- }
-
- static int l_circle(lua_State* L)
- {
- const char* modestr = luax_checkstring(L, 1);
- RenderMode mode = strtomode(modestr);
- if (mode != RenderMode::NONE)
- {
- int x = luax_checknumber(L, 2);
- int y = luax_checknumber(L, 3);
- float r = luax_checknumber(L, 4);
- circle(mode, x, y, r);
- }
- else
- {
- luax_typerror(L, 1, "'fill' or 'line'");
- return 1;
- }
-
- return 0;
- }
-
- static int l_triangle(lua_State* L)
- {
- const char* modestr = luax_checkstring(L, 1);
- RenderMode mode = strtomode(modestr);
- if (mode != RenderMode::NONE)
- {
- int x = luax_checknumber(L, 2);
- int y = luax_checknumber(L, 3);
-
- int x2 = luax_checknumber(L, 3);
- int y2 = luax_checknumber(L, 4);
-
- int x3 = luax_checknumber(L, 5);
- int y3 = luax_checknumber(L, 6);
-
- triangle(mode, x, y, x2, y2, x3, y3);
- }
- else
- {
- luax_typerror(L, 1, "'fill' or 'line'");
- return 1;
- }
-
- return 0;
- }
-
- static int l_polygon(lua_State* L)
- {
- const char* modestr = luax_checkstring(L, 1);
- int n = luax_checknumber(L, 2);
- RenderMode mode = strtomode(modestr);
- if (mode != RenderMode::NONE)
- {
- if (!luax_istable(L, 3))
- {
- luax_typerror(L, 3, "table");
- return 1;
- }
- int tn = luax_tableidxlen(L, 3);
- if (tn != n * 2)
- {
- static char* emsg = \
- "number of polygon vertices doesn't match " \
- "provided n, expect %d numbers but get %d";
- luax_error(L, emsg, n * 2, tn);
- return 1;
- }
- float* p = (float*)alloca(2 * n * sizeof(float));
- for (int i = 1; i <= 2 * n; ++i)
- p[i - 1] = luax_rawgetnumber(L, 3, i);
- polygon(mode, p, n);
- }
- else
- {
- luax_typerror(L, 1, "'fill' or 'line'");
- return 1;
- }
-
- return 0;
- }
-
- static int l_newTTFData(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_TTFDATA, sizeof(Proxy));
- TTFData* fd = nullptr;
- {
- const char* path = luax_checkstring(L, 1);
- AssetDatabase* fs = AssetDatabase::get();
- if (!fs->exists(path))
- {
- error(L, "No such font %s\n", path);
- luax_pushnil(L);
- return 1;
- }
- Buffer b;
- fs->read(path, b);
- fd = TTFData::createTTFData(&b, b.size());
- }
- proxy->bind(new Ref<TTFData>(fd, JIN_GRAPHICS_TTFDATA));
- return 1;
- }
-
- /* newText(str[, encode]) */
- static int l_newText(lua_State* L)
- {
- Encode encode = Encode::UTF8;
- if (luax_gettop(L) == 2)
- {
- const char* e = luax_checkstring(L, 2);
- if (strcmp(e, "UTF8") == 0) encode = Encode::UTF8;
- //else if (strcmp(e, "UTF16") == 0) encode = Encode::UTF16;
- else if (strcmp(e, "ASCII") == 0) encode = Encode::ASCII;
- else
- {
- luax_error(L, "wrong text encode %s", e);
- return 0;
- }
- }
- unsigned length;
- const char* data = luax_checklstring(L, 1, &length);
- Text* text = new Text(encode, data, length);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_TEXT, sizeof(Proxy));
- proxy->bind(new Ref<Text>(text, JIN_GRAPHICS_TEXT));
- return 1;
- }
-
- /* newTextureFont(bitmap, text, color | cellw, cellh) */
- static int l_newTextureFont(lua_State* L)
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_BITMAP);
- Bitmap* bitmap = p->getObject<Bitmap>();
- Text* text;
- if (luax_istype(L, 2, JIN_GRAPHICS_TEXT))
- {
- Proxy* pt = (Proxy*)luax_checktype(L, 2, JIN_GRAPHICS_TEXT);
- text = pt->getObject<Text>();
- }
- else if (luax_isstring(L, 2))
- {
- unsigned len;
- const char* str = luax_checklstring(L, 2, &len);
- text = new Text(Encode::UTF8, str, len);
- }
- else
- {
- luax_typerror(L, 2, "Text or string");
- return 1;
- }
- float cellh = luax_checknumber(L, 4);
- TextureFont* textureFont = nullptr;
- if (luax_istable(L, 3))
- {
- unsigned int r = luax_rawgetnumber(L, 3, 1);
- unsigned int g = luax_rawgetnumber(L, 3, 2);
- unsigned int b = luax_rawgetnumber(L, 3, 3);
- unsigned int a = luax_rawgetnumber(L, 3, 4);
- textureFont = TextureFont::createTextureFont(bitmap, *text, Color(r, g, b, a), cellh);
- }
- else if (luax_isnumber(L, 3))
- {
- float cellw = luax_checknumber(L, 3);
- textureFont = TextureFont::createTextureFont(bitmap, *text, cellw, cellh);
- }
- else
- {
- luax_error(L, "bad arguments #3 to 'newTextureFont', need to be table or number");
- return 0;
- }
- if (luax_isstring(L, 2))
- {
- // Delete temporary text.
- delete text;
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_TEXTUREFONT, sizeof(Proxy));
- proxy->bind(new Ref<TextureFont>(textureFont, JIN_GRAPHICS_TEXTUREFONT));
- return 1;
- }
-
- /* setFont(font) */
- static int l_setFont(lua_State* L)
- {
- if (luax_istype(L, 1, JIN_GRAPHICS_TTF))
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTF);
- TTF* ttf = p->getObject<TTF>();
- context.curFont = ttf;
- }
- else if (luax_istype(L, 1, JIN_GRAPHICS_TEXTUREFONT))
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TEXTUREFONT);
- TextureFont* tf = p->getObject<TextureFont>();
- context.curFont = tf;
- }
- return 0;
- }
-
- static int l_unsetFont(lua_State* L)
- {
- context.curFont = context.defaultFont;
- return 0;
- }
-
- static const luaL_Reg f[] = {
- /* window */
- { "init", l_init },
- { "setTitle", l_setTitle },
- { "getSize", l_getSize },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "destroy", l_destroy },
- /* creators */
- { "newBitmap", l_newBitmap },
- { "newTexture", l_newTexture },
- { "newShader", l_newShader },
- { "newShaderf", l_newShaderf },
- { "newCanvas", l_newCanvas },
- { "newTTFData", l_newTTFData },
- { "newText", l_newText },
- { "newTextureFont", l_newTextureFont },
- /* render */
- { "setClearColor", l_setClearColor },
- { "clear", l_clear },
- { "draw", l_draw },
- { "print", l_print },
- { "drawq", l_drawq },
- { "setColor", l_setColor },
- { "getColor", l_getColor },
- { "present", l_present },
- /* canvas */
- { "bindCanvas", l_bindCanvas },
- { "unbindCanvas", l_unbindCanvas },
- /* shader */
- { "useShader", l_useShader },
- /* shapes */
- { "point", l_point },
- { "line", l_line },
- { "rect", l_rect },
- { "circle", l_circle },
- { "triangle", l_triangle },
- { "polygon", l_polygon },
- /* font */
- { "setFont", l_setFont },
- { "unsetFont", l_unsetFont },
- { 0, 0 }
- };
-
- extern int luaopen_Texture(lua_State* L);
- extern int luaopen_Text(lua_State* L);
- extern int luaopen_TTF(lua_State* L);
- extern int luaopen_TextureFont(lua_State* L);
- extern int luaopen_TTFData(lua_State* L);
- extern int luaopen_Page(lua_State* L);
- extern int luaopen_Canvas(lua_State* L);
- extern int luaopen_JSL(lua_State* L);
- extern int luaopen_Bitmap(lua_State* L);
-
- int luaopen_graphics(lua_State* L)
- {
- // register types
- luaopen_Bitmap(L);
- luaopen_Texture(L);
- luaopen_Canvas(L);
- luaopen_TTFData(L);
- luaopen_TTF(L);
- luaopen_Text(L);
- luaopen_TextureFont(L);
- luaopen_Page(L);
- luaopen_JSL(L);
-
- // load whole lib
- luax_newlib(L, f);
-
- return 1;
- }
-
- }// lua
-}// jin \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp
new file mode 100644
index 0000000..6b7655f
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_bitmap.cpp
@@ -0,0 +1,114 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+
+#include "libjin/jin.h"
+#include "je_lua_bitmap.h"
+
+using namespace JinEngine::Graphics;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Bitmap = "Bitmap";
+
+ typedef Shared<Bitmap>& SharedBitmap;
+
+ LUA_IMPLEMENT inline SharedBitmap checkBitmap(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Bitmap);
+ return proxy->getShared<Bitmap>();
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ shared.release();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getWidth(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ int w = shared->getWidth();
+ luax_pushinteger(L, w);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getHeight(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ int h = shared->getHeight();
+ luax_pushinteger(L, h);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getSize(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ int w = shared->getWidth();
+ int h = shared->getHeight();
+ luax_pushinteger(L, w);
+ luax_pushinteger(L, h);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_getPixel(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ int x = luax_checkinteger(L, 2);
+ int y = luax_checkinteger(L, 3);
+ Color col = shared->getPixel(x, y);
+ luax_pushinteger(L, col.r);
+ luax_pushinteger(L, col.g);
+ luax_pushinteger(L, col.b);
+ luax_pushinteger(L, col.a);
+ return 4;
+ }
+
+ LUA_IMPLEMENT int l_setPixel(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ int x = luax_checkinteger(L, 2);
+ int y = luax_checkinteger(L, 3);
+ if (!luax_istable(L, 4))
+ {
+ luax_typerror(L, 4, "table");
+ return 1;
+ }
+ unsigned int r = luax_rawgetnumber(L, 4, 1);
+ unsigned int g = luax_rawgetnumber(L, 4, 2);
+ unsigned int b = luax_rawgetnumber(L, 4, 3);
+ unsigned int a = luax_rawgetnumber(L, 4, 4);
+ shared->setPixel(Color(r, g, b, a), x, y);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_clone(lua_State* L)
+ {
+ SharedBitmap shared = checkBitmap(L);
+ Bitmap* bitmap = shared.getObject();
+ Bitmap* b = Bitmap::clone(bitmap);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Bitmap);
+ proxy->bind(new Shared<Bitmap>(b, Jin_Lua_Bitmap));
+ return 1;
+ }
+
+ LUA_EXPORT void luaopen_Bitmap(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { "getPixel", l_getPixel },
+ { "setPixel", l_setPixel },
+ { "clone", l_clone },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Bitmap, f);
+ }
+
+ } // namespace Graphics
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_bitmap.h b/src/lua/modules/graphics/je_lua_bitmap.h
new file mode 100644
index 0000000..b463d83
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_bitmap.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_BITMAP_H__
+#define __JE_LUA_BITMAP_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Bitmap;
+
+ void luaopen_Bitmap(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_canvas.cpp b/src/lua/modules/graphics/je_lua_canvas.cpp
new file mode 100644
index 0000000..f7bd650
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_canvas.cpp
@@ -0,0 +1,66 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+#include "je_lua_canvas.h"
+
+using namespace JinEngine::Graphics;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Canvas = "Canvas";
+
+ typedef Shared<Canvas>& SharedCanvas;
+
+ LUA_IMPLEMENT inline SharedCanvas checkCanvas(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Canvas);
+ return proxy->getShared<Canvas>();
+ }
+
+ LUA_IMPLEMENT int l_getWidth(lua_State* L)
+ {
+ SharedCanvas shared = checkCanvas(L);
+ luax_pushnumber(L, shared->getWidth());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getHeight(lua_State* L)
+ {
+ SharedCanvas shared = checkCanvas(L);
+ luax_pushnumber(L, shared->getHeight());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getSize(lua_State* L)
+ {
+ SharedCanvas shared = checkCanvas(L);
+ luax_pushnumber(L, shared->getWidth());
+ luax_pushnumber(L, shared->getHeight());
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Canvas);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Canvas(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Canvas, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_canvas.h b/src/lua/modules/graphics/je_lua_canvas.h
new file mode 100644
index 0000000..d1fa885
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_canvas.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_CANVAS_H__
+#define __JE_LUA_CANVAS_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Canvas;
+
+ void luaopen_Canvas(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
new file mode 100644
index 0000000..ce569d0
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -0,0 +1,922 @@
+#include <iostream>
+#include <fstream>
+
+#include "libjin/jin.h"
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+
+#include "je_lua_canvas.h"
+#include "je_lua_sprite.h"
+#include "je_lua_spritesheet.h"
+#include "je_lua_bitmap.h"
+#include "je_lua_ttf.h"
+#include "je_lua_ttf_data.h"
+#include "je_lua_texture.h"
+#include "je_lua_shader.h"
+#include "je_lua_text.h"
+#include "je_lua_texture_font.h"
+#include "je_lua_page.h"
+
+using namespace std;
+using namespace JinEngine;
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Fonts;
+using namespace JinEngine::Graphics::Shaders;
+using namespace JinEngine::Filesystem;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+#include "../../resources/font.ttf.h"
+
+ static struct
+ {
+ Color curRenderColor;
+ Color curClearColor;
+ Font* curFont = nullptr;
+ Font* defaultFont = nullptr;
+ bool initialized = false;
+ } context;
+
+ LUA_IMPLEMENT int l_init(lua_State* L)
+ {
+ if (context.initialized)
+ {
+ luax_pushboolean(L, true);
+ return 1;
+ }
+
+ Window* wnd = Window::get();
+ Window::Setting setting;
+ setting.width = luax_getfieldinteger(L, 1, "width");
+ setting.height = luax_getfieldinteger(L, 1, "height");
+ setting.title = luax_getfieldstring(L, 1, "title");
+ setting.icon = luax_getfieldstring(L, 1, "icon");
+ setting.vsync = luax_getfieldbool(L, 1, "vsync");
+ setting.fullscreen = luax_getfieldbool(L, 1, "fullscreen");
+ setting.resizable = luax_getfieldbool(L, 1, "resizable");
+ context.initialized = wnd->init(&setting);
+ if (!context.initialized)
+ {
+ luax_pushboolean(L, context.initialized);
+ return 1;
+ }
+
+ /* load default font */
+ Bitmap* bitmap = Bitmap::createBitmap(default_font_bitmap, sizeof(default_font_bitmap));
+ TextureFont* tf = TextureFont::createTextureFont(bitmap, Text(Encode::UTF8, default_charset), default_font_split, bitmap->getHeight());
+ delete bitmap;
+ context.defaultFont = tf;
+ context.curFont = tf;
+
+ luax_pushboolean(L, context.initialized);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_setTitle(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ const char* title = luax_checkstring(L, 1);
+ wnd->setTitle(title);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_destroy(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ wnd->quit();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_showWindow(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ wnd->show();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_hideWindow(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ wnd->hide();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getSize(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ luax_pushnumber(L, wnd->getW());
+ luax_pushnumber(L, wnd->getH());
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_getWidth(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ luax_pushnumber(L, wnd->getW());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getHeight(lua_State* L)
+ {
+ Window* wnd = Window::get();
+ luax_pushnumber(L, wnd->getH());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_newBitmap(lua_State* L)
+ {
+ Bitmap* bitmap = nullptr;
+ if (luax_gettop(L) == 2)
+ {
+ int w = luax_checkinteger(L, 1);
+ int h = luax_checkinteger(L, 2);
+ bitmap = Bitmap::createBitmap(w, h);
+ }
+ else if (luax_gettop(L) == 3)
+ {
+ int w = luax_checkinteger(L, 1);
+ int h = luax_checkinteger(L, 2);
+ if (luax_istable(L, 3))
+ {
+ unsigned int r = luax_rawgetnumber(L, 3, 1);
+ unsigned int g = luax_rawgetnumber(L, 3, 2);
+ unsigned int b = luax_rawgetnumber(L, 3, 3);
+ unsigned int a = luax_rawgetnumber(L, 3, 4);
+ bitmap = Bitmap::createBitmap(w, h, Color(r, g, b, a));
+ }
+ else if (luax_isfunction(L, 3))
+ {
+ std::function<Color(int, int, int, int)> drawer = [=](int w, int h, int x, int y)->Color{
+ luax_pushvalue(L, 3);
+ luax_pushnumber(L, w);
+ luax_pushnumber(L, h);
+ luax_pushnumber(L, x);
+ luax_pushnumber(L, y);
+ // Call drawer function.
+ luax_call(L, 4, 1);
+ // Get result color.
+ if (!luax_istable(L, -1))
+ luax_error(L, "Return value of bitmap drawer is wrong, should be a color table.");
+ Color c;
+ c.r = luax_rawgetnumberthenpop(L, -1, 1);
+ c.g = luax_rawgetnumberthenpop(L, -1, 2);
+ c.b = luax_rawgetnumberthenpop(L, -1, 3);
+ c.a = luax_rawgetnumberthenpop(L, -1, 4);
+ // Pop return value.
+ luax_pop(L, 1);
+ return c;
+ };
+ bitmap = Bitmap::createBitmap(w, h, drawer);
+ }
+ else
+ {
+ luax_typerror(L, 3, "color table or color setter");
+ return 1;
+ }
+ }
+ else
+ {
+ const char* f = luax_checkstring(L, 1);
+ AssetDatabase* fs = AssetDatabase::get();
+ Buffer b;
+ try
+ {
+ if (!fs->exists(f))
+ throw Exception("No such image file %s.", f);
+ fs->read(f, b);
+ }
+ catch (Exception& e)
+ {
+ error(L, "Failed to read image %s", f);
+ luax_pushnil(L);
+ return 1;
+ }
+ bitmap = Bitmap::createBitmap(&b, b.size());
+ if (bitmap == nullptr)
+ {
+ error(L, "Failed to decode image file %s", f);
+ luax_pushnil(L);
+ return 1;
+ }
+ }
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Bitmap);
+ proxy->bind(new Shared<Bitmap>(bitmap, Jin_Lua_Bitmap));
+ return 1;
+ }
+
+ /* jin.graphics.newTexture(bitmap) */
+ LUA_IMPLEMENT int l_newTexture(lua_State* L)
+ {
+ Texture* texture = nullptr;
+ if (luax_istype(L, 1, Jin_Lua_Bitmap))
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Bitmap);
+ Shared<Bitmap>& refBitmap = p->getShared<Bitmap>();
+ Bitmap* bitmap = refBitmap.getObject();
+ texture = Texture::createTexture(bitmap);
+ }
+ else if (luax_isstring(L, 1))
+ {
+ const char* path = luax_checkstring(L, 1);
+ texture = Texture::createTexture(path);
+ }
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Texture);
+ proxy->bind(new Shared<Texture>(texture, Jin_Lua_Texture));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_newShader(lua_State* L)
+ {
+ const char* program = luax_checkstring(L, 1);
+ Shader* jsl = Shader::createShader(program);
+ if (jsl == nullptr)
+ {
+ error(L, "Failed to compile shader");
+ luax_pushnil(L);
+ return 1;
+ }
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Shader);
+ proxy->bind(new Shared<Shader>(jsl, Jin_Lua_Shader));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_newShaderf(lua_State* L)
+ {
+ const char* path = luax_checkstring(L, 1);
+ AssetDatabase* fs = AssetDatabase::get();
+ if (!fs->exists(path))
+ {
+ error(L, "No such shader file \"%s\"", path);
+ luax_pushnil(L);
+ return 1;
+ }
+ Buffer b;
+ fs->read(path, b);
+ Shader* jsl = Shader::createShader((char*)&b);
+ if (jsl == nullptr)
+ {
+ error(L, "Failed to compile shader");
+ luax_pushnil(L);
+ return 1;
+ }
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Shader);
+ proxy->bind(new Shared<Shader>(jsl, Jin_Lua_Shader));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_newCanvas(lua_State* L)
+ {
+ int w = luax_checknumber(L, 1);
+ int h = luax_checknumber(L, 2);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Canvas);
+ Canvas* cvs = Canvas::createCanvas(w, h);
+ proxy->bind(new Shared<Canvas>(cvs, Jin_Lua_Canvas));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_clear(lua_State* L)
+ {
+ glClear(GL_COLOR_BUFFER_BIT);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setClearColor(lua_State* L)
+ {
+ if (luax_gettop(L) == 0)
+ {
+ glClearColor(0, 0, 0, 1);
+ return 0;
+ }
+
+ context.curClearColor.r = luax_checknumber(L, 1);
+ context.curClearColor.g = luax_checknumber(L, 2);
+ context.curClearColor.b = luax_checknumber(L, 3);
+ context.curClearColor.a = luax_checknumber(L, 4);
+
+ gl.setClearColor(context.curClearColor.r,
+ context.curClearColor.g,
+ context.curClearColor.b,
+ context.curClearColor.a);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_present(lua_State* L)
+ {
+ Window::get()->swapBuffers();
+ return 0;
+ }
+
+ LUA_IMPLEMENT void l_draw_texture(lua_State* L)
+ {
+ if (!luax_istype(L, 1, Jin_Lua_Texture))
+ return;
+ int x = luax_optnumber(L, 2, 0);
+ int y = luax_optnumber(L, 3, 0);
+ float sx = luax_optnumber(L, 4, 1);
+ float sy = luax_optnumber(L, 5, 1);
+ float r = luax_optnumber(L, 6, 0);
+ float ox = luax_optnumber(L, 7, 0);
+ float oy = luax_optnumber(L, 8, 0);
+ Proxy* proxy = (Proxy*)luax_toudata(L, 1);
+ Shared<Texture>& tex = proxy->getShared<Texture>();
+ tex->render(x, y, sx, sy, r, ox, oy);
+ }
+
+ LUA_IMPLEMENT void l_draw_canvas(lua_State* L)
+ {
+ if (!luax_istype(L, 1, Jin_Lua_Canvas))
+ return;
+ int x = luax_optnumber(L, 2, 0);
+ int y = luax_optnumber(L, 3, 0);
+ float sx = luax_optnumber(L, 4, 1);
+ float sy = luax_optnumber(L, 5, 1);
+ float r = luax_optnumber(L, 6, 0);
+ float ox = luax_optnumber(L, 7, 0);
+ float oy = luax_optnumber(L, 8, 0);
+ Proxy* proxy = (Proxy*)luax_toudata(L, 1);
+ Shared<Canvas>& p = proxy->getShared<Canvas>();
+ p->render(x, y, sx, sy, r, ox, oy);
+ }
+
+ /* jin.graphics.draw(text, font, x, y) */
+ LUA_IMPLEMENT void l_draw_text(lua_State* L)
+ {
+ if (!luax_istype(L, 1, Jin_Lua_Text))
+ return;
+ Proxy* p = (Proxy*)luax_toudata(L, 1);
+ Text* text = p->getObject<Text>();
+ int x = luax_optnumber(L, 3, 0);
+ int y = luax_optnumber(L, 4, 0);
+ int spacing = luax_optnumber(L, 6, 0);
+ Font* font = nullptr;
+ Proxy* p2 = (Proxy*)luax_toudata(L, 2);
+ if (luax_istype(L, 2, Jin_Lua_TextureFont))
+ {
+ TextureFont* tf = p2->getObject<TextureFont>();
+ font = tf;
+ }
+ else if (luax_istype(L, 2, Jin_Lua_TTF))
+ {
+ TTF* ttf = p2->getObject<TTF>();
+ font = ttf;
+ }
+ else
+ {
+ font = context.defaultFont;
+ }
+ int lineheight = luax_optnumber(L, 5, font->getFontSize());
+ font->render(*text, x, y, lineheight, spacing);
+ }
+
+ /* jin.graphics.draw(page, x, y) */
+ LUA_IMPLEMENT void l_draw_page(lua_State* L)
+ {
+ if (!luax_istype(L, 1, Jin_Lua_Page))
+ return;
+ int x = luax_optnumber(L, 2, 0);
+ int y = luax_optnumber(L, 3, 0);
+ Proxy* p = (Proxy*)luax_toudata(L, 1);
+ Page* page = p->getObject<Page>();
+ Font* font = page->font;
+ font->render(page, x, y);
+ }
+
+ LUA_IMPLEMENT int l_draw(lua_State* L)
+ {
+ if (luax_istype(L, 1, Jin_Lua_Texture))
+ l_draw_texture(L);
+ else if (luax_istype(L, 1, Jin_Lua_Canvas))
+ l_draw_canvas(L);
+ else if (luax_istype(L, 1, Jin_Lua_Text))
+ l_draw_text(L);
+ else if (luax_istype(L, 1, Jin_Lua_Page))
+ l_draw_page(L);
+ else
+ {
+ luax_typerror(L, 1, "texture or canvas");
+ return 1;
+ }
+ return 0;
+ }
+
+ // draw(tex, quad, x, y, sx, sy, r, ax, ay)
+ LUA_IMPLEMENT int l_drawq(lua_State* L)
+ {
+ if (!luax_istable(L, 2))
+ {
+ luax_typerror(L, 2, "table");
+ return 1;
+ }
+ Math::Quad q;
+ q.x = luax_rawgetnumber(L, 2, 1);
+ q.y = luax_rawgetnumber(L, 2, 2);
+ q.w = luax_rawgetnumber(L, 2, 3);
+ q.h = luax_rawgetnumber(L, 2, 4);
+ luax_pop(L, 4);
+ int x = luax_optnumber(L, 3, 0);
+ int y = luax_optnumber(L, 4, 0);
+ float sx = luax_optnumber(L, 5, 1);
+ float sy = luax_optnumber(L, 6, 1);
+ float r = luax_optnumber(L, 7, 0);
+ float ox = luax_optnumber(L, 8, 0);
+ float oy = luax_optnumber(L, 9, 0);
+
+ if (luax_istype(L, 1, Jin_Lua_Texture))
+ {
+ Proxy* proxy = (Proxy*)luax_toudata(L, 1);
+ Shared<Texture>& tex = proxy->getShared<Texture>();
+ tex->render(q, x, y, sx, sy, r, ox, oy);
+ }
+ else if (luax_istype(L, 1, Jin_Lua_Canvas))
+ {
+ Proxy* proxy = (Proxy*)luax_toudata(L, 1);
+ Shared<Canvas>& p = proxy->getShared<Canvas>();
+ p->render(q, x, y, sx, sy, r, ox, oy);
+ }
+ else
+ {
+ luax_typerror(L, 1, "texture or canvas");
+ }
+ }
+
+ /* print(string, x, y, lineheight, spacing) */
+ /* need set font */
+ LUA_IMPLEMENT int l_print(lua_State* L)
+ {
+ Font* font = context.curFont;
+ if (font == nullptr)
+ return 0;
+ unsigned length;
+ const char* str = luax_checklstring(L, 1, &length);
+ Text text(Encode::UTF8, str, length);
+ int x = luax_optnumber(L, 2, 0);
+ int y = luax_optnumber(L, 3, 0);
+ int lineheight = luax_optnumber(L, 4, font->getFontSize());
+ int spacing = luax_optnumber(L, 5, 0);
+ font->render(text, x, y, lineheight, spacing);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setColor(lua_State* L)
+ {
+ if (luax_gettop(L) == 0)
+ {
+ gl.setColor(Color(255, 255, 255, 255));
+ return 0;
+ }
+
+ context.curRenderColor.r = luax_checknumber(L, 1);
+ context.curRenderColor.g = luax_checknumber(L, 2);
+ context.curRenderColor.b = luax_checknumber(L, 3);
+ if (luax_gettop(L) == 4)
+ context.curRenderColor.a = luax_checknumber(L, 4);
+ else
+ context.curRenderColor.a = 255;
+ gl.setColor(context.curRenderColor);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getColor(lua_State * L)
+ {
+ luax_pushnumber(L, context.curRenderColor.r);
+ luax_pushnumber(L, context.curRenderColor.g);
+ luax_pushnumber(L, context.curRenderColor.b);
+ luax_pushnumber(L, context.curRenderColor.a);
+ return 4;
+ }
+
+ LUA_IMPLEMENT int l_bindCanvas(lua_State* L)
+ {
+ if (luax_gettop(L) == 0)
+ {
+ // bind to default canvas
+ Canvas::unbind();
+ return 0;
+ }
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Canvas);
+ Shared<Canvas>& shared = proxy->getShared<Canvas>();
+ Canvas::bind(shared.getObject());
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_unbindCanvas(lua_State* L)
+ {
+ Canvas::unbind();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_useShader(lua_State* L)
+ {
+ if (luax_gettop(L) == 0)
+ {
+ Shader::unuse();
+ return 0;
+ }
+ if (luax_istype(L, 1, Jin_Lua_Shader))
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Shader);
+ Shared<Shader>& jsl = proxy->getShared<Shader>();
+ jsl->use();
+ }
+ else
+ {
+ luax_typerror(L, 1, "JSL shader");
+ }
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setBlend(lua_State* L)
+ {
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_point(lua_State* L)
+ {
+ int x = luax_checknumber(L, 1);
+ int y = luax_checknumber(L, 2);
+ JinEngine::Graphics::point(x, y);
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_line(lua_State* L)
+ {
+ int x1 = luax_checknumber(L, 1);
+ int y1 = luax_checknumber(L, 2);
+ int x2 = luax_checknumber(L, 3);
+ int y2 = luax_checknumber(L, 4);
+ JinEngine::Graphics::line(x1, y1, x2, y2);
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_rect(lua_State* L)
+ {
+ RenderMode mode = static_cast<RenderMode>(luax_checkinteger(L, 1));
+ if (mode != RenderMode::NONE)
+ {
+ int x = luax_checknumber(L, 2);
+ int y = luax_checknumber(L, 3);
+ int w = luax_checknumber(L, 4);
+ int h = luax_checknumber(L, 5);
+ rect(mode, x, y, w, h);
+ }
+ else
+ {
+ luax_typerror(L, 1, "'fill' or 'line'");
+ return 1;
+ }
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_circle(lua_State* L)
+ {
+ RenderMode mode = static_cast<RenderMode>(luax_checkinteger(L, 1));
+ if (mode != RenderMode::NONE)
+ {
+ int x = luax_checknumber(L, 2);
+ int y = luax_checknumber(L, 3);
+ float r = luax_checknumber(L, 4);
+ circle(mode, x, y, r);
+ }
+ else
+ {
+ luax_typerror(L, 1, "'fill' or 'line'");
+ return 1;
+ }
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_triangle(lua_State* L)
+ {
+ RenderMode mode = static_cast<RenderMode>(luax_checkinteger(L, 1));
+ if (mode != RenderMode::NONE)
+ {
+ int x = luax_checknumber(L, 2);
+ int y = luax_checknumber(L, 3);
+
+ int x2 = luax_checknumber(L, 3);
+ int y2 = luax_checknumber(L, 4);
+
+ int x3 = luax_checknumber(L, 5);
+ int y3 = luax_checknumber(L, 6);
+
+ triangle(mode, x, y, x2, y2, x3, y3);
+ }
+ else
+ {
+ luax_typerror(L, 1, "'fill' or 'line'");
+ return 1;
+ }
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_polygon(lua_State* L)
+ {
+ RenderMode mode = static_cast<RenderMode>(luax_checkinteger(L, 1));
+ int n = luax_checknumber(L, 2);
+ if (mode != RenderMode::NONE)
+ {
+ if (!luax_istable(L, 3))
+ {
+ luax_typerror(L, 3, "table");
+ return 1;
+ }
+ int tn = luax_tableidxlen(L, 3);
+ if (tn != n * 2)
+ {
+ LUA_IMPLEMENT char* emsg = \
+ "number of polygon vertices doesn't match " \
+ "provided n, expect %d numbers but get %d";
+ luax_error(L, emsg, n * 2, tn);
+ return 1;
+ }
+ float* p = (float*)alloca(2 * n * sizeof(float));
+ for (int i = 1; i <= 2 * n; ++i)
+ p[i - 1] = luax_rawgetnumber(L, 3, i);
+ polygon(mode, p, n);
+ }
+ else
+ {
+ luax_typerror(L, 1, "'fill' or 'line'");
+ return 1;
+ }
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_newTTFData(lua_State* L)
+ {
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_TTFData);
+ TTFData* fd = nullptr;
+ {
+ const char* path = luax_checkstring(L, 1);
+ AssetDatabase* fs = AssetDatabase::get();
+ if (!fs->exists(path))
+ {
+ error(L, "No such font \"%s\"", path);
+ luax_pushnil(L);
+ return 1;
+ }
+ Buffer b;
+ fs->read(path, b);
+ fd = TTFData::createTTFData(&b, b.size());
+ }
+ proxy->bind(new Shared<TTFData>(fd, Jin_Lua_TTFData));
+ return 1;
+ }
+
+ /* newText(str[, encode]) */
+ LUA_IMPLEMENT int l_newText(lua_State* L)
+ {
+ Encode encode = Encode::UTF8;
+ if (luax_gettop(L) == 2)
+ {
+ const char* e = luax_checkstring(L, 2);
+ if (strcmp(e, "UTF8") == 0) encode = Encode::UTF8;
+ //else if (strcmp(e, "UTF16") == 0) encode = Encode::UTF16;
+ else if (strcmp(e, "ASCII") == 0) encode = Encode::ASCII;
+ else
+ {
+ luax_error(L, "wrong text encode %s", e);
+ return 0;
+ }
+ }
+ unsigned length;
+ const char* data = luax_checklstring(L, 1, &length);
+ Text* text = new Text(encode, data, length);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Text);
+ proxy->bind(new Shared<Text>(text, Jin_Lua_Text));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_newSprite(lua_State* L)
+ {
+ Proxy* p = luax_newinstance(L, Jin_Lua_Sprite);
+ p->bind(new Shared<Sprite>(new Sprite(), Jin_Lua_Sprite));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_newSpriteSheet(lua_State* L)
+ {
+ Proxy* pxyGraphic = nullptr;
+ if (luax_istype(L, 1, Jin_Lua_Texture))
+ pxyGraphic = (Proxy*)luax_checktype(L, 1, Jin_Lua_Texture);
+ else if(luax_istype(L, 1, Jin_Lua_Canvas))
+ pxyGraphic = (Proxy*)luax_checktype(L, 1, Jin_Lua_Canvas);
+ if (pxyGraphic != nullptr)
+ {
+ Proxy* pxySSheet = luax_newinstance(L, Jin_Lua_SpriteSheet);
+ Graphic* graphic = pxyGraphic->getObject<Graphic>();
+ Shared<SpriteSheet>* shrSSheet = new Shared<SpriteSheet>(new SpriteSheet(graphic), Jin_Lua_SpriteSheet);
+ Shared<Graphic>& shrGraphic = pxyGraphic->getShared<Graphic>();
+ shrSSheet->setDependency((int)SpriteSheetDependency::DEP_GRAPHIC, &shrGraphic);
+ pxySSheet->bind(shrSSheet);
+ return 1;
+ }
+ else
+ return 0;
+ }
+
+ /* newTextureFont(bitmap, text, color | cellw, cellh) */
+ LUA_IMPLEMENT int l_newTextureFont(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Bitmap);
+ Bitmap* bitmap = p->getObject<Bitmap>();
+ Text* text;
+ if (luax_istype(L, 2, Jin_Lua_Text))
+ {
+ Proxy* pt = (Proxy*)luax_checktype(L, 2, Jin_Lua_Text);
+ text = pt->getObject<Text>();
+ }
+ else if (luax_isstring(L, 2))
+ {
+ unsigned len;
+ const char* str = luax_checklstring(L, 2, &len);
+ text = new Text(Encode::UTF8, str, len);
+ }
+ else
+ {
+ luax_typerror(L, 2, "Text or string");
+ return 1;
+ }
+ float cellh = luax_checknumber(L, 4);
+ TextureFont* textureFont = nullptr;
+ if (luax_istable(L, 3))
+ {
+ unsigned int r = luax_rawgetnumber(L, 3, 1);
+ unsigned int g = luax_rawgetnumber(L, 3, 2);
+ unsigned int b = luax_rawgetnumber(L, 3, 3);
+ unsigned int a = luax_rawgetnumber(L, 3, 4);
+ textureFont = TextureFont::createTextureFont(bitmap, *text, Color(r, g, b, a), cellh);
+ }
+ else if (luax_isnumber(L, 3))
+ {
+ float cellw = luax_checknumber(L, 3);
+ textureFont = TextureFont::createTextureFont(bitmap, *text, cellw, cellh);
+ }
+ else
+ {
+ luax_error(L, "bad arguments #3 to 'newTextureFont', need to be table or number");
+ return 0;
+ }
+ if (luax_isstring(L, 2))
+ {
+ // Delete temporary text.
+ delete text;
+ }
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_TextureFont);
+ proxy->bind(new Shared<TextureFont>(textureFont, Jin_Lua_TextureFont));
+ return 1;
+ }
+
+ /* setFont(font) */
+ LUA_IMPLEMENT int l_setFont(lua_State* L)
+ {
+ if (luax_istype(L, 1, Jin_Lua_TTF))
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTF);
+ TTF* ttf = p->getObject<TTF>();
+ context.curFont = ttf;
+ }
+ else if (luax_istype(L, 1, Jin_Lua_TextureFont))
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_TextureFont);
+ TextureFont* tf = p->getObject<TextureFont>();
+ context.curFont = tf;
+ }
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_unsetFont(lua_State* L)
+ {
+ context.curFont = context.defaultFont;
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_clearMatrix(lua_State* L)
+ {
+ gl.clearMatrix();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_pushMatrix(lua_State* L)
+ {
+ gl.push();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_popMatrix(lua_State* L)
+ {
+ gl.pop();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_scale(lua_State* L)
+ {
+ float sx = luax_checknumber(L, 1);
+ float sy = luax_checknumber(L, 2);
+ gl.scale(sx, sy);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_translate(lua_State* L)
+ {
+ float x = luax_checknumber(L, 1);
+ float y = luax_checknumber(L, 2);
+ gl.translate(x, y);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_rotate(lua_State* L)
+ {
+ float r = luax_checknumber(L, 1);
+ gl.rotate(r);
+ return 0;
+ }
+
+ LUA_EXPORT int luaopen_graphics(lua_State* L)
+ {
+ luaopen_Bitmap(L);
+ luaopen_Texture(L);
+ luaopen_Canvas(L);
+ luaopen_TTFData(L);
+ luaopen_TTF(L);
+ luaopen_Text(L);
+ luaopen_TextureFont(L);
+ luaopen_Page(L);
+ luaopen_Shader(L);
+ luaopen_Sprite(L);
+ luaopen_SpriteSheet(L);
+
+ luaL_Reg f[] = {
+ /* window */
+ { "init", l_init },
+ { "setTitle", l_setTitle },
+ { "getSize", l_getSize },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "destroy", l_destroy },
+ { "hideWindow", l_hideWindow },
+ { "showWindow", l_showWindow },
+ /* creators */
+ { "newBitmap", l_newBitmap },
+ { "newTexture", l_newTexture },
+ { "newShader", l_newShader },
+ { "newShaderf", l_newShaderf },
+ { "newCanvas", l_newCanvas },
+ { "newTTFData", l_newTTFData },
+ { "newText", l_newText },
+ { "newTextureFont", l_newTextureFont },
+ { "newSprite", l_newSprite },
+ { "newSpriteSheet", l_newSpriteSheet },
+ /* render */
+ { "setClearColor", l_setClearColor },
+ { "clear", l_clear },
+ { "draw", l_draw },
+ { "print", l_print },
+ { "drawq", l_drawq },
+ { "setColor", l_setColor },
+ { "getColor", l_getColor },
+ { "present", l_present },
+ /* canvas */
+ { "bindCanvas", l_bindCanvas },
+ { "unbindCanvas", l_unbindCanvas },
+ /* shader */
+ { "useShader", l_useShader },
+ /* shapes */
+ { "point", l_point },
+ { "line", l_line },
+ { "rect", l_rect },
+ { "circle", l_circle },
+ { "triangle", l_triangle },
+ { "polygon", l_polygon },
+ /* font */
+ { "setFont", l_setFont },
+ { "unsetFont", l_unsetFont },
+ /* transform */
+ { "pushMatrix", l_pushMatrix },
+ { "clearMatrix", l_clearMatrix },
+ { "popMatrix", l_popMatrix },
+ { "translate", l_translate },
+ { "rotate", l_rotate },
+ { "scale", l_scale },
+ { 0, 0 }
+ };
+
+ // Load whole lib.
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_graphics.h b/src/lua/modules/graphics/je_lua_graphics.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_graphics.h
diff --git a/src/lua/modules/graphics/je_lua_page.cpp b/src/lua/modules/graphics/je_lua_page.cpp
new file mode 100644
index 0000000..20ec398
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_page.cpp
@@ -0,0 +1,69 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+#include <iostream>
+
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Fonts;
+using namespace JinEngine::Graphics::Shaders;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Page = "Page";
+
+ typedef Shared<Font>& SharedFont;
+
+ Page* getPage(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Page);
+ return proxy->getObject<Page>();
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Page);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getSize(lua_State* L)
+ {
+ Page* page = getPage(L);
+ luax_pushinteger(L, page->size.w);
+ luax_pushinteger(L, page->size.h);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_getWidth(lua_State* L)
+ {
+ Page* page = getPage(L);
+ luax_pushinteger(L, page->size.w);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getHeight(lua_State* L)
+ {
+ Page* page = getPage(L);
+ luax_pushinteger(L, page->size.h);
+ return 1;
+ }
+
+ LUA_EXPORT void luaopen_Page(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getSize", l_getSize },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Page, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_page.h b/src/lua/modules/graphics/je_lua_page.h
new file mode 100644
index 0000000..e4a21a3
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_page.h
@@ -0,0 +1,22 @@
+#ifndef __JE_LUA_PAGE_H__
+#define __JE_LUA_PAGE_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ enum class PageDependency
+ {
+ DEP_TTF = 1,
+ DEP_TEXTURE_FONT = 2,
+ };
+
+ extern const char* Jin_Lua_Page;
+
+ void luaopen_Page(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_particle_system.cpp b/src/lua/modules/graphics/je_lua_particle_system.cpp
new file mode 100644
index 0000000..7099a5c
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_particle_system.cpp
@@ -0,0 +1,11 @@
+#include "libjin/jin.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+
+
+ } // Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_particle_system.h b/src/lua/modules/graphics/je_lua_particle_system.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_particle_system.h
diff --git a/src/lua/modules/graphics/je_lua_shader.cpp b/src/lua/modules/graphics/je_lua_shader.cpp
new file mode 100644
index 0000000..1612a69
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_shader.cpp
@@ -0,0 +1,137 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+#include "je_lua_shader.h"
+#include "je_lua_canvas.h"
+#include "je_lua_texture.h"
+
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Shaders;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Shader = "Shader";
+
+ typedef Shared<Shader>& ShaderRef;
+
+ static inline ShaderRef checkShader(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Shader);
+ return proxy->getShared<Shader>();
+ }
+
+ /**
+ * jsl:sendNumber("variable", 0.1)
+ */
+ LUA_IMPLEMENT int l_sendNumber(lua_State* L)
+ {
+ ShaderRef shared = checkShader(L);
+ const char* variable = luax_checkstring(L, 2);
+ float number = luax_checknumber(L, 3);
+ shared->sendFloat(variable, number);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_sendTexture(lua_State* L)
+ {
+ ShaderRef shared = checkShader(L);
+ const char* variable = luax_checkstring(L, 2);
+ Proxy* proxy = (Proxy*)luax_checktype(L, 3, Jin_Lua_Texture);
+ Shared<Texture>& tex = proxy->getShared<Texture>();
+ shared->sendTexture(variable, tex.getObject());
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_sendCanvas(lua_State* L)
+ {
+ ShaderRef shared = checkShader(L);
+ const char* variable = luax_checkstring(L, 2);
+ Proxy* proxy = (Proxy*)luax_checktype(L, 3, Jin_Lua_Canvas);
+ Shared<Canvas>& canvas = proxy->getShared<Canvas>();
+ shared->sendCanvas(variable, canvas.getObject());
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_sendVec2(lua_State* L)
+ {
+ ShaderRef shared = checkShader(L);
+ const char* variable = luax_checkstring(L, 2);
+ if (!luax_istable(L, 3))
+ {
+ luax_typerror(L, 3, "table");
+ return 1;
+ }
+ float x = luax_rawgetnumber(L, 3, 1);
+ float y = luax_rawgetnumber(L, 3, 2);
+ shared->sendVec2(variable, x, y);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_sendVec3(lua_State* L)
+ {
+ ShaderRef shared = checkShader(L);
+ const char* variable = luax_checkstring(L, 2);
+ if (!luax_istable(L, 3))
+ {
+ luax_typerror(L, 3, "table");
+ return 1;
+ }
+ float x = luax_rawgetnumber(L, 3, 1);
+ float y = luax_rawgetnumber(L, 3, 2);
+ float z = luax_rawgetnumber(L, 3, 3);
+ shared->sendVec3(variable, x, y, z);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_sendVec4(lua_State* L)
+ {
+ ShaderRef shared = checkShader(L);
+ const char* variable = luax_checkstring(L, 2);
+ if (!luax_istable(L, 3))
+ {
+ luax_typerror(L, 3, "table");
+ return 1;
+ }
+ float x = luax_rawgetnumber(L, 3, 1);
+ float y = luax_rawgetnumber(L, 3, 2);
+ float z = luax_rawgetnumber(L, 3, 3);
+ float w = luax_rawgetnumber(L, 3, 4);
+ shared->sendVec4(variable, x, y, z, w);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_sendColor(lua_State* L)
+ {
+ return l_sendVec4(L);
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Shader);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Shader(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "sendNumber", l_sendNumber },
+ { "sendTexture", l_sendTexture },
+ { "sendCanvas", l_sendCanvas },
+ { "sendVec2", l_sendVec2 },
+ { "sendVec3", l_sendVec3 },
+ { "sendVec4", l_sendVec4 },
+ { "sendColor", l_sendColor },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Shader, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_shader.h b/src/lua/modules/graphics/je_lua_shader.h
new file mode 100644
index 0000000..5a84372
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_shader.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_SHDER_H__
+#define __JE_LUA_SHDER_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Shader;
+
+ void luaopen_Shader(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_sprite.cpp b/src/lua/modules/graphics/je_lua_sprite.cpp
new file mode 100644
index 0000000..97128a9
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_sprite.cpp
@@ -0,0 +1,262 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+#include "je_lua_sprite.h"
+#include "je_lua_canvas.h"
+#include "je_lua_texture.h"
+#include "je_lua_shader.h"
+
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Shaders;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+ const char* Jin_Lua_Sprite = "Sprite";
+
+ typedef Shared<Sprite>& SharedSprite;
+
+ LUA_IMPLEMENT inline SharedSprite checkSprite(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Sprite);
+ return proxy->getShared<Sprite>();
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Sprite);
+ p->release();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setRotation(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float r = luax_checknumber(L, 2);
+ sprite->setRotation(r);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setOrigin(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ switch (luax_gettop(L))
+ {
+ case 2:
+ {
+ int origin = luax_checkinteger(L, 2);
+ sprite->setOrigin(static_cast<Sprite::Origin>(origin));
+ }
+ break;
+ case 3:
+ {
+ int x = luax_checkinteger(L, 2);
+ int y = luax_checkinteger(L, 3);
+ sprite->setOrigin(x, y);
+ }
+ break;
+ }
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setPosition(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float x = luax_checknumber(L, 2);
+ float y = luax_checknumber(L, 3);
+ sprite->setPosition(x, y);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setScale(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float sx = luax_checknumber(L, 2);
+ float sy = luax_checknumber(L, 3);
+ sprite->setScale(sx, sy);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setColor(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ Channel r = luax_checkinteger(L, 2);
+ Channel g = luax_checkinteger(L, 3);
+ Channel b = luax_checkinteger(L, 4);
+ Channel a = luax_checkinteger(L, 5);
+ sprite->setColor(Color(r, g, b, a));
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setShader(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ Proxy* proxy = (Proxy*)luax_checktype(L, 2, Jin_Lua_Shader);
+ Shader* shader = proxy->getObject<Shader>();
+ sprite->setShader(shader);
+ sprite.setDependency((int)SpriteDependency::DEP_SHADER, &proxy->getShared<Shader>());
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_setGraphic(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ Graphic* graphic = nullptr;
+ Proxy* p = nullptr;
+ if (luax_istype(L, 2, Jin_Lua_Texture))
+ p = (Proxy*)luax_checktype(L, 2, Jin_Lua_Texture);
+ else if (luax_istype(L, 2, Jin_Lua_Canvas))
+ p = (Proxy*)luax_checktype(L, 2, Jin_Lua_Canvas);
+ if (p != nullptr)
+ {
+ sprite->setGraphic(p->getObject<Graphic>());
+ sprite.setDependency((int)SpriteDependency::DEP_GRAPHIC, &p->getShared<Graphic>());
+ }
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_move(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float x = luax_checknumber(L, 2);
+ float y = luax_checknumber(L, 3);
+ sprite->move(x, y);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_scale(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float sx = luax_checknumber(L, 2);
+ float sy = luax_checknumber(L, 3);
+ sprite->scale(sx, sy);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_rotate(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float r = luax_checknumber(L, 2);
+ sprite->rotate(r);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getRotation(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ float r = sprite->getRotation();
+ luax_pushnumber(L, r);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getPosition(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ const Math::Vector2<float>& pos = sprite->getPosition();
+ luax_pushnumber(L, pos.x);
+ luax_pushnumber(L, pos.y);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_getOrigin(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ const Math::Vector2<int>& origin = sprite->getOrigin();
+ luax_pushinteger(L, origin.x);
+ luax_pushinteger(L, origin.y);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_getScale(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ const Math::Vector2<float> scale = sprite->getScale();
+ luax_pushnumber(L, scale.x);
+ luax_pushnumber(L, scale.y);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_getColor(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ const Color& c = sprite->getColor();
+ luax_pushinteger(L, c.r);
+ luax_pushinteger(L, c.g);
+ luax_pushinteger(L, c.b);
+ luax_pushinteger(L, c.a);
+ return 4;
+ }
+
+ LUA_IMPLEMENT int l_render(lua_State* L)
+ {
+ SharedSprite sprite = checkSprite(L);
+ sprite->render();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getGraphic(lua_State* L)
+ {
+ Proxy* pxySprite = (Proxy*)luax_checktype(L, 1, Jin_Lua_Sprite);
+ Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>();
+ SharedBase* shrGraphic = shrSprite.getDependency((int)SpriteDependency::DEP_GRAPHIC);
+ if (shrGraphic->isType(Jin_Lua_Canvas))
+ {
+ Proxy* pxyCanvas = luax_newinstance(L, Jin_Lua_Canvas);
+ pxyCanvas->bind(shrGraphic);
+ return 1;
+ }
+ else if (shrGraphic->isType(Jin_Lua_Texture))
+ {
+ Proxy* pxyTexture = luax_newinstance(L, Jin_Lua_Texture);
+ pxyTexture->bind(shrGraphic);
+ return 1;
+ }
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getShader(lua_State* L)
+ {
+ Proxy* pxySprite = (Proxy*)luax_checktype(L, 1, Jin_Lua_Sprite);
+ Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>();
+ SharedBase* shrShader = shrSprite.getDependency((int)SpriteDependency::DEP_SHADER);
+ if (shrShader != nullptr && shrShader->isType(Jin_Lua_Shader))
+ {
+ Proxy* pxyShader = luax_newinstance(L, Jin_Lua_Shader);
+ pxyShader->bind(shrShader);
+ return 1;
+ }
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Sprite(lua_State* L)
+ {
+ luaL_Reg methods[] = {
+ { "__gc", l_gc },
+ { "render", l_render },
+ { "setRotation", l_setRotation },
+ { "setOrigin", l_setOrigin },
+ { "setPosition", l_setPosition },
+ { "setScale", l_setScale },
+ { "setColor", l_setColor },
+ { "setShader", l_setShader },
+ { "setGraphic", l_setGraphic },
+ { "move", l_move },
+ { "scale", l_scale },
+ { "rotate", l_rotate },
+ { "getRotation", l_getRotation },
+ { "getPosition", l_getPosition },
+ { "getOrigin", l_getOrigin },
+ { "getScale", l_getScale },
+ { "getColor", l_getColor },
+ { "getShader", l_getShader },
+ { "getGraphic", l_getGraphic },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Sprite, methods);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_sprite.h b/src/lua/modules/graphics/je_lua_sprite.h
new file mode 100644
index 0000000..02c44bf
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_sprite.h
@@ -0,0 +1,24 @@
+#ifndef __JE_LUA_SPRITE_H__
+#define __JE_LUA_SPRITE_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ // Sprite dependency slots.
+ enum class SpriteDependency
+ {
+ DEP_GRAPHIC = 1,
+ DEP_SHADER = 2,
+ DEP_SPRITESHEET = 3
+ };
+
+ extern const char* Jin_Lua_Sprite;
+
+ void luaopen_Sprite(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_spritesheet.cpp b/src/lua/modules/graphics/je_lua_spritesheet.cpp
new file mode 100644
index 0000000..15469e9
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_spritesheet.cpp
@@ -0,0 +1,54 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+#include "je_lua_sprite.h"
+#include "je_lua_spritesheet.h"
+
+using namespace JinEngine::Math;
+using namespace JinEngine::Graphics;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_SpriteSheet = "SpriteSheet";
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* pxySSheet = (Proxy*)luax_checktype(L, 1, Jin_Lua_SpriteSheet);
+ pxySSheet->release();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_newSprite(lua_State* L)
+ {
+ Proxy* pxySSheet = (Proxy*)luax_checktype(L, 1, Jin_Lua_SpriteSheet);
+ Shared<SpriteSheet>& shrSSheet = pxySSheet->getShared<SpriteSheet>();
+ SpriteSheet* sheet = pxySSheet->getObject<SpriteSheet>();
+ Quad quad;
+ quad.x = luax_checkinteger(L, 2);
+ quad.y = luax_checkinteger(L, 3);
+ quad.w = luax_checkinteger(L, 4);
+ quad.h = luax_checkinteger(L, 5);
+ Sprite* spr = sheet->createSprite(quad);
+ Proxy* pxySprite = luax_newinstance(L, Jin_Lua_Sprite);
+ Shared<Sprite>* shrSprite = new Shared<Sprite>(spr, Jin_Lua_Sprite);
+ shrSprite->setDependency((int)SpriteDependency::DEP_SPRITESHEET, &shrSSheet);
+ pxySprite->bind(shrSprite);
+ return 1;
+ }
+
+ LUA_EXPORT void luaopen_SpriteSheet(lua_State* L)
+ {
+ luaL_Reg methods[] = {
+ { "__gc", l_gc },
+ { "newSprite", l_newSprite },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_SpriteSheet, methods);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_spritesheet.h b/src/lua/modules/graphics/je_lua_spritesheet.h
new file mode 100644
index 0000000..bcae60b
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_spritesheet.h
@@ -0,0 +1,21 @@
+#ifndef __JE_LUA_SPRITE_SHEET_H__
+#define __JE_LUA_SPRITE_SHEET_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ enum class SpriteSheetDependency
+ {
+ DEP_GRAPHIC = 1
+ };
+
+ extern const char* Jin_Lua_SpriteSheet;
+
+ void luaopen_SpriteSheet(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_text.cpp b/src/lua/modules/graphics/je_lua_text.cpp
new file mode 100644
index 0000000..9377a0a
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_text.cpp
@@ -0,0 +1,32 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+using namespace JinEngine::Graphics;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Text = "Text";
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Text);
+ p->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Text(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Text, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_text.h b/src/lua/modules/graphics/je_lua_text.h
new file mode 100644
index 0000000..dfcc9cc
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_text.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_TEXT_H__
+#define __JE_LUA_TEXT_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Text;
+
+ void luaopen_Text(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_texture.cpp b/src/lua/modules/graphics/je_lua_texture.cpp
new file mode 100644
index 0000000..79ddc63
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_texture.cpp
@@ -0,0 +1,66 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+#include "je_lua_texture.h"
+
+using namespace JinEngine::Graphics;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Texture = "Texture";
+
+ typedef Shared<Texture>& SharedTexture;
+
+ LUA_IMPLEMENT inline SharedTexture checkTexture(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Texture);
+ return proxy->getShared<Texture>();
+ }
+
+ LUA_IMPLEMENT int l_getWidth(lua_State* L)
+ {
+ SharedTexture shared = checkTexture(L);
+ luax_pushnumber(L, shared->getWidth());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getHeight(lua_State *L)
+ {
+ SharedTexture shared = checkTexture(L);
+ luax_pushnumber(L, shared->getHeight());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getSize(lua_State* L)
+ {
+ SharedTexture shared = checkTexture(L);
+ luax_pushnumber(L, shared->getWidth());
+ luax_pushnumber(L, shared->getHeight());
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Texture);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Texture(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Texture, f);
+ }
+
+ }// namespace Lua
+}// namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_texture.h b/src/lua/modules/graphics/je_lua_texture.h
new file mode 100644
index 0000000..c8bb71c
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_texture.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_TEXTURE_H__
+#define __JE_LUA_TEXTURE_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Texture;
+
+ void luaopen_Texture(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_texture_font.cpp b/src/lua/modules/graphics/je_lua_texture_font.cpp
new file mode 100644
index 0000000..8ca3ce5
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_texture_font.cpp
@@ -0,0 +1,66 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+#include "je_lua_page.h"
+#include "je_lua_text.h"
+
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Fonts;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_TextureFont = "TextureFont";
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_TextureFont);
+ proxy->release();
+ return 0;
+ }
+
+ /* typeset(Text | string, lineheight, spacing) */
+ LUA_IMPLEMENT int l_typeset(lua_State* L)
+ {
+ Proxy* pxyTexFont = (Proxy*)luax_checktype(L, 1, Jin_Lua_TextureFont);
+ Shared<TextureFont>& shrTexFont = pxyTexFont->getShared<TextureFont>();
+ TextureFont* tf = pxyTexFont->getObject<TextureFont>();
+ int lineheight = luax_checkinteger(L, 3);
+ int spacing = luax_optnumber(L, 4, 0);
+ Page* page = nullptr;
+ if (luax_isstring(L, 2))
+ {
+ unsigned length;
+ const char* str = luax_checklstring(L, 2, &length);
+ Text text(Encode::UTF8, str, length);
+ page = tf->typeset(text, lineheight, spacing);
+ }
+ else if (luax_istype(L, 2, Jin_Lua_Text))
+ {
+ Proxy* p2 = (Proxy*)luax_checktype(L, 2, Jin_Lua_Text);
+ Text* text = p2->getObject<Text>();
+ page = tf->typeset(*text, lineheight, spacing);
+ }
+ Proxy* pxyPage = luax_newinstance(L, Jin_Lua_Page);
+ Shared<Page>* shrPage = new Shared<Page>(page, Jin_Lua_Page);
+ shrPage->setDependency((int)PageDependency::DEP_TEXTURE_FONT, &shrTexFont);
+ pxyPage->bind(shrPage);
+ return 1;
+ }
+
+ LUA_EXPORT void luaopen_TextureFont(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "typeset", l_typeset },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_TextureFont, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_texture_font.h b/src/lua/modules/graphics/je_lua_texture_font.h
new file mode 100644
index 0000000..d1fffe5
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_texture_font.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_TEXTURE_FONT_H__
+#define __JE_LUA_TEXTURE_FONT_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_TextureFont;
+
+ void luaopen_TextureFont(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_ttf.cpp b/src/lua/modules/graphics/je_lua_ttf.cpp
new file mode 100644
index 0000000..c5d922b
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_ttf.cpp
@@ -0,0 +1,66 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+#include "je_lua_page.h"
+#include "je_lua_text.h"
+
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Fonts;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_TTF = "TTF";
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTF);
+ proxy->release();
+ return 0;
+ }
+
+ /* typeset(Text | string, lineheight, spacing) */
+ LUA_IMPLEMENT int l_typeset(lua_State* L)
+ {
+ Proxy* pxyTTF = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTF);
+ Shared<TTF>& shrTTF = pxyTTF->getShared<TTF>();
+ TTF* ttf = pxyTTF->getObject<TTF>();
+ int lineheight = luax_optnumber(L, 3, ttf->getFontSize());
+ int spacing = luax_optnumber(L, 4, 0);
+ Page* page = nullptr;
+ if (luax_isstring(L, 2))
+ {
+ unsigned length;
+ const char* str = luax_checklstring(L, 2, &length);
+ Text text(Encode::UTF8, str, length);
+ page = ttf->typeset(text, lineheight, spacing);
+ }
+ else if (luax_istype(L, 2, Jin_Lua_Text))
+ {
+ Proxy* pxyText = (Proxy*)luax_checktype(L, 2, Jin_Lua_Text);
+ Text* text = pxyText->getObject<Text>();
+ page = ttf->typeset(*text, lineheight, spacing);
+ }
+ Proxy* pxyPage = luax_newinstance(L, Jin_Lua_Page);
+ Shared<Page>* refPage = new Shared<Page>(page, Jin_Lua_Page);
+ refPage->setDependency((int)PageDependency::DEP_TTF, &shrTTF);
+ pxyPage->bind(refPage);
+ return 1;
+ }
+
+ LUA_EXPORT void luaopen_TTF(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "typeset", l_typeset },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_TTF, f);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_ttf.h b/src/lua/modules/graphics/je_lua_ttf.h
new file mode 100644
index 0000000..bfe503d
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_ttf.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_TTF_H__
+#define __JE_LUA_TTF_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_TTF;
+
+ void luaopen_TTF(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_ttf_data.cpp b/src/lua/modules/graphics/je_lua_ttf_data.cpp
new file mode 100644
index 0000000..1277318
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_ttf_data.cpp
@@ -0,0 +1,52 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+#include "je_lua_ttf.h"
+#include "je_lua_ttf_data.h"
+
+using namespace JinEngine::Graphics;
+using namespace JinEngine::Graphics::Fonts;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_TTFData = "TTFData";
+
+ LUA_IMPLEMENT int l_newTTF(lua_State* L)
+ {
+ Proxy* pxyTTFData = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTFData);
+ int fontsize = luax_checkinteger(L, 2);
+ Shared<TTFData>& shrFontData = pxyTTFData->getShared<TTFData>();
+ TTFData* fontData = shrFontData.getObject();
+ Proxy* pxyTTF = luax_newinstance(L, Jin_Lua_TTF);
+ TTF* font = fontData->createTTF(fontsize);
+ Shared<TTF>* shrTTF = new Shared<TTF>(font, Jin_Lua_TTF);
+ shrTTF->setDependency((int)TTFDependency::DEP_TTFDATA, &shrFontData);
+ pxyTTF->bind(shrTTF);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTFData);
+ p->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_TTFData(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "newTTF", l_newTTF },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_TTFData, f);
+
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/je_lua_ttf_data.h b/src/lua/modules/graphics/je_lua_ttf_data.h
new file mode 100644
index 0000000..1fd832d
--- /dev/null
+++ b/src/lua/modules/graphics/je_lua_ttf_data.h
@@ -0,0 +1,21 @@
+#ifndef __JE_LUA_TTFDATA_H__
+#define __JE_LUA_TTFDATA_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ enum class TTFDependency
+ {
+ DEP_TTFDATA = 1,
+ };
+
+ extern const char* Jin_Lua_TTFData;
+
+ void luaopen_TTFData(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/graphics/page.cpp b/src/lua/modules/graphics/page.cpp
deleted file mode 100644
index 8c9e918..0000000
--- a/src/lua/modules/graphics/page.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-#include <iostream>
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- typedef Ref<Font>& FontRef;
-
- Page* getPage(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_PAGE);
- return proxy->getObject<Page>();
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_PAGE);
- {
- /* release font */
- Ref<Page>* page = &proxy->getRef<Page>();
- RefBase* font = (RefBase*)page->getUserdata();
- font->release();
- }
- proxy->release();
- return 0;
- }
-
- static int l_getSize(lua_State* L)
- {
- Page* page = getPage(L);
- luax_pushinteger(L, page->size.w);
- luax_pushinteger(L, page->size.h);
- return 2;
- }
-
- static int l_getWidth(lua_State* L)
- {
- Page* page = getPage(L);
- luax_pushinteger(L, page->size.w);
- return 1;
- }
-
- static int l_getHeight(lua_State* L)
- {
- Page* page = getPage(L);
- luax_pushinteger(L, page->size.h);
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getSize", l_getSize },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { 0, 0 }
- };
-
- int luaopen_Page(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_PAGE, f);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/shader.cpp b/src/lua/modules/graphics/shader.cpp
deleted file mode 100644
index d7733d4..0000000
--- a/src/lua/modules/graphics/shader.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- typedef Ref<Shader>& ShaderRef;
-
- static inline ShaderRef checkShader(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_SHADER);
- return proxy->getRef<Shader>();
- }
-
- /**
- * jsl:sendNumber("variable", 0.1)
- */
- static int l_sendNumber (lua_State* L)
- {
- ShaderRef ref = checkShader(L);
- const char* variable = luax_checkstring(L, 2);
- float number = luax_checknumber(L, 3);
- ref->sendFloat(variable, number);
- return 0;
- }
-
- static int l_sendTexture (lua_State* L)
- {
- ShaderRef ref = checkShader(L);
- const char* variable = luax_checkstring(L, 2);
- Proxy* proxy = (Proxy*)luax_checktype(L, 3, JIN_GRAPHICS_TEXTURE);
- Ref<Texture>& tex = proxy->getRef<Texture>();
- ref->sendTexture(variable, tex.getObject());
- return 0;
- }
-
- static int l_sendCanvas (lua_State* L)
- {
- ShaderRef ref = checkShader(L);
- const char* variable = luax_checkstring(L, 2);
- Proxy* proxy = (Proxy*)luax_checktype(L, 3, JIN_GRAPHICS_CANVAS);
- Ref<Canvas>& canvas = proxy->getRef<Canvas>();
- ref->sendCanvas(variable, canvas.getObject());
- return 0;
- }
-
- static int l_sendVec2 (lua_State* L)
- {
- ShaderRef ref = checkShader(L);
- const char* variable = luax_checkstring(L, 2);
- if (!luax_istable(L, 3))
- {
- luax_typerror(L, 3, "table");
- return 1;
- }
- float x = luax_rawgetnumber(L, 3, 1);
- float y = luax_rawgetnumber(L, 3, 2);
- ref->sendVec2(variable, x, y);
- return 0;
- }
-
- static int l_sendVec3 (lua_State* L)
- {
- ShaderRef ref = checkShader(L);
- const char* variable = luax_checkstring(L, 2);
- if (!luax_istable(L, 3))
- {
- luax_typerror(L, 3, "table");
- return 1;
- }
- float x = luax_rawgetnumber(L, 3, 1);
- float y = luax_rawgetnumber(L, 3, 2);
- float z = luax_rawgetnumber(L, 3, 3);
- ref->sendVec3(variable, x, y, z);
- return 0;
- }
-
- static int l_sendVec4 (lua_State* L)
- {
- ShaderRef ref = checkShader(L);
- const char* variable = luax_checkstring(L, 2);
- if (!luax_istable(L, 3))
- {
- luax_typerror(L, 3, "table");
- return 1;
- }
- float x = luax_rawgetnumber(L, 3, 1);
- float y = luax_rawgetnumber(L, 3, 2);
- float z = luax_rawgetnumber(L, 3, 3);
- float w = luax_rawgetnumber(L, 3, 4);
- ref->sendVec4(variable, x, y, z, w);
- return 0;
- }
-
- static int l_sendColor (lua_State* L)
- {
- return l_sendVec4(L);
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_SHADER);
- proxy->release();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "sendNumber", l_sendNumber },
- { "sendTexture", l_sendTexture },
- { "sendCanvas", l_sendCanvas },
- { "sendVec2", l_sendVec2 },
- { "sendVec3", l_sendVec3 },
- { "sendVec4", l_sendVec4 },
- { "sendColor", l_sendColor },
- { 0, 0 }
- };
-
- /**
- * JSL program
- */
- int luaopen_JSL(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_SHADER, f);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/text.cpp b/src/lua/modules/graphics/text.cpp
deleted file mode 100644
index cbc82f1..0000000
--- a/src/lua/modules/graphics/text.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- static int l_gc(lua_State* L)
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TEXT);
- p->release();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { 0, 0 }
- };
-
- int luaopen_Text(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_TEXT, f);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/texture.cpp b/src/lua/modules/graphics/texture.cpp
deleted file mode 100644
index 61bfaee..0000000
--- a/src/lua/modules/graphics/texture.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- typedef Ref<Texture>& TextureRef;
-
- static inline TextureRef checkTexture(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TEXTURE);
- return proxy->getRef<Texture>();
- }
-
- static int l_getWidth(lua_State* L)
- {
- TextureRef ref = checkTexture(L);
- luax_pushnumber(L, ref->getWidth());
- return 1;
- }
-
- static int l_getHeight(lua_State *L)
- {
- TextureRef ref = checkTexture(L);
- luax_pushnumber(L, ref->getHeight());
- return 1;
- }
-
- static int l_getSize(lua_State* L)
- {
- TextureRef ref = checkTexture(L);
- luax_pushnumber(L, ref->getWidth());
- luax_pushnumber(L, ref->getHeight());
- return 2;
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TEXTURE);
- proxy->release();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { 0, 0 }
- };
-
- int luaopen_Texture(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_TEXTURE, f);
- return 0;
- }
-
- }// lua
-}// jin \ No newline at end of file
diff --git a/src/lua/modules/graphics/texture_font.cpp b/src/lua/modules/graphics/texture_font.cpp
deleted file mode 100644
index a2e88ba..0000000
--- a/src/lua/modules/graphics/texture_font.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TEXTUREFONT);
- proxy->release();
- return 0;
- }
-
- /* typeset(Text | string, lineheight, spacing) */
- static int l_typeset(lua_State* L)
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TEXTUREFONT);
- TextureFont* tf = p->getObject<TextureFont>();
- int lineheight = luax_checkinteger(L, 3);
- int spacing = luax_optnumber(L, 4, 0);
- Page* page = nullptr;
- if (luax_isstring(L, 2))
- {
- unsigned length;
- const char* str = luax_checklstring(L, 2, &length);
- Text text(Encode::UTF8, str, length);
- page = tf->typeset(text, lineheight, spacing);
- }
- else if (luax_istype(L, 2, JIN_GRAPHICS_TEXT))
- {
- Proxy* p2 = (Proxy*)luax_checktype(L, 2, JIN_GRAPHICS_TEXT);
- Text* text = p2->getObject<Text>();
- page = tf->typeset(*text, lineheight, spacing);
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_PAGE, sizeof(Proxy));
- Ref<Page>* refPage = new Ref<Page>(page, JIN_GRAPHICS_PAGE);
- {
- /* retain related ttf */
- Ref<TextureFont>& refTF = p->getRef<TextureFont>();
- refTF.retain();
- refPage->setUserdata(&refTF);
- }
- proxy->bind(refPage);
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "typeset", l_typeset },
- { 0, 0 }
- };
-
- int luaopen_TextureFont(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_TEXTUREFONT, f);
-
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/ttf.cpp b/src/lua/modules/graphics/ttf.cpp
deleted file mode 100644
index 414c7eb..0000000
--- a/src/lua/modules/graphics/ttf.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTF);
- {
- /* release ttf data */
- Ref<TTF>* ttf = &proxy->getRef<TTF>();
- RefBase* data = (RefBase*)ttf->getUserdata();
- data->release();
- }
- proxy->release();
- return 0;
- }
-
- /* typeset(Text | string, lineheight, spacing) */
- static int l_typeset(lua_State* L)
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTF);
- TTF* ttf = p->getObject<TTF>();
- int lineheight = luax_optnumber(L, 3, ttf->getFontSize());
- int spacing = luax_optnumber(L, 4, 0);
- Page* page = nullptr;
- if (luax_isstring(L, 2))
- {
- unsigned length;
- const char* str = luax_checklstring(L, 2, &length);
- Text text(Encode::UTF8, str, length);
- page = ttf->typeset(text, lineheight, spacing);
- }
- else if (luax_istype(L, 2, JIN_GRAPHICS_TEXT))
- {
- Proxy* p2 = (Proxy*)luax_checktype(L, 2, JIN_GRAPHICS_TEXT);
- Text* text = p2->getObject<Text>();
- page = ttf->typeset(*text, lineheight, spacing);
- }
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_PAGE, sizeof(Proxy));
- Ref<Page>* refPage = new Ref<Page>(page, JIN_GRAPHICS_PAGE);
- {
- /* retain related ttf */
- Ref<TTF>& refTTF = p->getRef<TTF>();
- refTTF.retain();
- refPage->setUserdata(&refTTF);
- }
- proxy->bind(refPage);
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "typeset", l_typeset },
- { 0, 0 }
- };
-
- int luaopen_TTF(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_TTF, f);
-
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/graphics/ttfData.cpp b/src/lua/modules/graphics/ttfData.cpp
deleted file mode 100644
index 43c3613..0000000
--- a/src/lua/modules/graphics/ttfData.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Graphics;
-
- static int l_newTTF(lua_State* L)
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTFDATA);
- int fontsize = luax_checkinteger(L, 2);
- Ref<TTFData>& refFontData = p->getRef<TTFData>();
- TTFData* fontData = refFontData.getObject();
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_TTF, sizeof(Proxy));
- TTF* font = fontData->createTTF(fontsize);
- Ref<TTF>* refTTF = new Ref<TTF>(font, JIN_GRAPHICS_TTF);
- {
- Ref<TTFData>& refTTFData = p->getRef<TTFData>();
- refTTFData.retain();
- refTTF->setUserdata(&refTTFData);
- }
- proxy->bind(refTTF);
- return 1;
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTFDATA);
- p->release();
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "newTTF", l_newTTF },
- { 0, 0 }
- };
-
- int luaopen_TTFData(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_TTFDATA, f);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/joypad/je_lua_joypad.cpp b/src/lua/modules/joypad/je_lua_joypad.cpp
new file mode 100644
index 0000000..a57fc99
--- /dev/null
+++ b/src/lua/modules/joypad/je_lua_joypad.cpp
@@ -0,0 +1,21 @@
+#include "lua/modules/luax.h"
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LUA_EXPORT int luaopen_joypad(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+
+ return 1;
+ }
+ /*SDL_JoystickGetButton*/
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/joypad/je_lua_joypad.h b/src/lua/modules/joypad/je_lua_joypad.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/joypad/je_lua_joypad.h
diff --git a/src/lua/modules/joypad/joypad.cpp b/src/lua/modules/joypad/joypad.cpp
deleted file mode 100644
index d67a624..0000000
--- a/src/lua/modules/joypad/joypad.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "libjin/jin.h"
-#include "lua/modules/luax.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- static const luaL_Reg f[] = {
- { 0, 0 }
- };
-
- int luaopen_joypad(lua_State* L)
- {
- luax_newlib(L, f);
-
- return 1;
- }
- /*SDL_JoystickGetButton*/
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/keyboard/je_lua_keyboard.cpp b/src/lua/modules/keyboard/je_lua_keyboard.cpp
new file mode 100644
index 0000000..6b7f3cd
--- /dev/null
+++ b/src/lua/modules/keyboard/je_lua_keyboard.cpp
@@ -0,0 +1,17 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+ //https://wiki.libsdl.org/SDL_Keycode
+
+ LUA_EXPORT int luaopen_keyboard(lua_State* L)
+ {
+ luax_newlib(L, 0);
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/keyboard/je_lua_keyboard.h b/src/lua/modules/keyboard/je_lua_keyboard.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/keyboard/je_lua_keyboard.h
diff --git a/src/lua/modules/keyboard/keyboard.cpp b/src/lua/modules/keyboard/keyboard.cpp
deleted file mode 100644
index 727a51e..0000000
--- a/src/lua/modules/keyboard/keyboard.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "lua/modules/luax.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
- //https://wiki.libsdl.org/SDL_Keycode
-
- int luaopen_keyboard(lua_State* L)
- {
- luax_newlib(L, 0);
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/math/je_lua_math.cpp b/src/lua/modules/math/je_lua_math.cpp
new file mode 100644
index 0000000..2afeaf9
--- /dev/null
+++ b/src/lua/modules/math/je_lua_math.cpp
@@ -0,0 +1,30 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LUA_IMPLEMENT int l_mod(lua_State* L)
+ {
+ int n = luax_checkinteger(L, 1);
+ int m = luax_checkinteger(L, 2);
+ int mod = n % m;
+ luax_pushinteger(L, mod);
+ return 1;
+ }
+
+ LUA_EXPORT int luaopen_math(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "mod", l_mod },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/math/je_lua_math.h b/src/lua/modules/math/je_lua_math.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/math/je_lua_math.h
diff --git a/src/lua/modules/math/math.cpp b/src/lua/modules/math/math.cpp
deleted file mode 100644
index 4891762..0000000
--- a/src/lua/modules/math/math.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "lua/modules/luax.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- static int l_mod(lua_State* L)
- {
- int n = luax_checkinteger(L, 1);
- int m = luax_checkinteger(L, 2);
- int mod = n % m;
- luax_pushinteger(L, mod);
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "mod", l_mod },
- { 0, 0 }
- };
-
- int luaopen_math(lua_State* L)
- {
- luax_newlib(L, f);
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/mouse/je_lua_mouse.cpp b/src/lua/modules/mouse/je_lua_mouse.cpp
new file mode 100644
index 0000000..9e6824a
--- /dev/null
+++ b/src/lua/modules/mouse/je_lua_mouse.cpp
@@ -0,0 +1,42 @@
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+
+using namespace JinEngine::Input;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ LUA_IMPLEMENT int l_pos(lua_State* L)
+ {
+ static Mouse* mouse = Mouse::get();
+ int x, y;
+ mouse->getState(&x, &y);
+ luax_pushnumber(L, x);
+ luax_pushnumber(L, y);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_setVisible(lua_State* L)
+ {
+ bool visible = luax_checkbool(L, 1);
+ Mouse* mouse = Mouse::get();
+ mouse->setVisible(visible);
+ return 0;
+ }
+
+ LUA_EXPORT int luaopen_mouse(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "getPosition", l_pos },
+ { "setVisible", l_setVisible },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/mouse/je_lua_mouse.h b/src/lua/modules/mouse/je_lua_mouse.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/mouse/je_lua_mouse.h
diff --git a/src/lua/modules/mouse/mouse.cpp b/src/lua/modules/mouse/mouse.cpp
deleted file mode 100644
index 9d45178..0000000
--- a/src/lua/modules/mouse/mouse.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "lua/modules/luax.h"
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Input;
-
- static int l_pos(lua_State* L)
- {
- static Mouse* mouse = Mouse::get();
- int x, y;
- mouse->getState(&x, &y);
- luax_pushnumber(L, x);
- luax_pushnumber(L, y);
- return 2;
- }
-
- static int l_setVisible(lua_State* L)
- {
- bool visible = luax_checkbool(L, 1);
- Mouse* mouse = Mouse::get();
- mouse->setVisible(visible);
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "position", l_pos },
- { "setVisible", l_setVisible },
- { 0, 0 }
- };
-
- int luaopen_mouse(lua_State* L)
- {
- luax_newlib(L, f);
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/net/Buffer.cpp b/src/lua/modules/net/Buffer.cpp
deleted file mode 100644
index ddfbd6b..0000000
--- a/src/lua/modules/net/Buffer.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-#include "Buffer.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
- namespace Net
- {
-
- using namespace JinEngine;
-
- typedef Ref<Buffer>& BufferRef;
-
- static inline BufferRef checkNetBuffer(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_NETWORK_BUFFER);
- return proxy->getRef<Buffer>();
- }
-
- // net.Buffer:append(value) -> value_length
- static int l_append(lua_State* L)
- {
- BufferRef ref = checkNetBuffer(L);
- const int vp = 2;
- if (luax_isintegerstrict(L, vp))
- {
- int n = luax_checkinteger(L, vp);
- int size = sizeof(n);
- ref->append(&n, size);
- luax_pushinteger(L, size);
- return 1;
- }
- else if (luax_isfloatstrict(L, vp))
- {
- float n = luax_checknumber(L, vp);
- int size = sizeof(n);
- ref->append(&n, size);
- luax_pushinteger(L, size);
- return 1;
- }
- else if (luax_isbooleanstrict(L, vp))
- {
- bool n = luax_checkbool(L, vp);
- int size = sizeof(n);
- ref->append(&n, size);
- luax_pushinteger(L, size);
- return 1;
- }
- else if (luax_isstringstrict(L, vp))
- {
- const char* str = luax_checkstring(L, vp);
- int size = strlen(str) + 1;
- ref->append(str, size);
- luax_pushinteger(L, size);
- return 1;
- }
- else
- {
- luax_typerror(L, vp, "number, bool or string");
- return 0;
- }
- }
-
- // net.Buffer:grabString(offset) -> string, length
- static int l_grabString(lua_State* L)
- {
- BufferRef ref = checkNetBuffer(L);
- int offset = luax_checkinteger(L, 2);
- unsigned int len;
- char* data = ref->grabString(&len, offset);
- Array<char> str;
- str.bind(data, len);
- luax_pushstring(L, &str);
- luax_pushinteger(L, str.count());
- return 2;
- }
-
- // net.Buffer:grabInteger(offset) -> integer, length
- static int l_grabInteger(lua_State* L)
- {
- BufferRef ref = checkNetBuffer(L);
- int offset = luax_checkinteger(L, 2);
- int len;
- int integer = ref->grabInteger(&len, offset);
- luax_pushinteger(L, integer);
- luax_pushinteger(L, len);
- return 2;
- }
-
- static int l_grabFloat(lua_State* L)
- {
- BufferRef ref = checkNetBuffer(L);
- int offset = luax_checkinteger(L, 2);
- int len;
- float floatv = ref->grabFloat(&len, offset);
- luax_pushnumber(L, floatv);
- luax_pushinteger(L, len);
- return 2;
- }
-
- static int l_grabBoolean(lua_State* L)
- {
- BufferRef ref = checkNetBuffer(L);
- int offset = luax_checkinteger(L, 2);
- int len;
- bool boolean = ref->grabBoolean(&len, offset);
- luax_pushboolean(L, boolean);
- luax_pushinteger(L, len);
- return 2;
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_NETWORK_BUFFER);
- proxy->release();
- return 0;
- }
-
- static const luaL_Reg netbuffer_function[] = {
- { "__gc", l_gc },
- { "append", l_append },
- { "grabString", l_grabString },
- { "grabInteger", l_grabInteger },
- { "grabBoolean", l_grabBoolean },
- { "grabFloat", l_grabFloat },
- { 0, 0 }
- };
-
- } // namespace Net
-
- int luaopen_Buffer(lua_State* L)
- {
- luax_newtype(L, JIN_NETWORK_BUFFER, Net::netbuffer_function);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/net/Buffer.h b/src/lua/modules/net/Buffer.h
deleted file mode 100644
index 8733778..0000000
--- a/src/lua/modules/net/Buffer.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef __JIN_LUA_NET_NETBUFFER_H
-#define __JIN_LUA_NET_NETBUFFER_H
-
-#include <cstring>
-#include <cstdlib>
-#include "lua/common/common.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
- namespace Net
- {
-
- class Buffer
- {
- public:
- Buffer(size_t s = 0)
- : size(s)
- {
- buffer = new char[size];
- memset(buffer, 0, size);
- }
-
- Buffer(const char* data, size_t s)
- : size(s)
- {
- buffer = new char[size];
- memcpy(buffer, data, size);
- }
-
- ~Buffer()
- {
- if (buffer != nullptr)
- {
- delete[] buffer;
- buffer = nullptr;
- size = 0;
- }
- }
-
- void append(const void* data, size_t s)
- {
- if (data == nullptr)
- return;
- char* buf = buffer;
- buffer = new char[size + s];
- memcpy(buffer, buf, size);
- memcpy(buffer + size, data, s);
- delete[] buf;
- size += s;
- return;
- }
-
- /* grab and create a string */
- char* grabString(unsigned int* length, int offset = 0)
- {
- int l = offset;
- for (; l < size; ++l)
- {
- if (buffer[l] == 0)
- break;
- }
- *length = l - offset + 1;
- char* str = (char*)malloc(*length);
- memcpy(str, buffer + offset, *length);
- return str;
- }
-
- int grabInteger(int* length, int offset = 0)
- {
- *length = sizeof(int);
- return *((int*)(buffer + offset));
- }
-
- float grabFloat(int* length, int offset = 0)
- {
- *length = sizeof(float);
- return *((float*)(buffer + offset));
- }
-
- bool grabBoolean(int* length, int offset = 0)
- {
- *length = sizeof(bool);
- return *((bool*)(buffer + offset));
- }
-
- char* buffer;
- size_t size;
-
- };
-
- } // namespace Net
- } // namespace Lua
-} // namespace JinEngine
-
-#endif \ No newline at end of file
diff --git a/src/lua/modules/net/je_lua_buffer.cpp b/src/lua/modules/net/je_lua_buffer.cpp
new file mode 100644
index 0000000..0198095
--- /dev/null
+++ b/src/lua/modules/net/je_lua_buffer.cpp
@@ -0,0 +1,137 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+#include "je_lua_buffer.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Buffer = "Buffer";
+
+ typedef Shared<Net::Buffer>& SharedBuffer;
+
+ static inline SharedBuffer checkNetBuffer(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Buffer);
+ return proxy->getShared<Net::Buffer>();
+ }
+
+ // net.Buffer:append(value) -> value_length
+ LUA_IMPLEMENT int l_append(lua_State* L)
+ {
+ SharedBuffer shared = checkNetBuffer(L);
+ const int vp = 2;
+ if (luax_isintegerstrict(L, vp))
+ {
+ int n = luax_checkinteger(L, vp);
+ int size = sizeof(n);
+ shared->append(&n, size);
+ luax_pushinteger(L, size);
+ return 1;
+ }
+ else if (luax_isfloatstrict(L, vp))
+ {
+ float n = luax_checknumber(L, vp);
+ int size = sizeof(n);
+ shared->append(&n, size);
+ luax_pushinteger(L, size);
+ return 1;
+ }
+ else if (luax_isbooleanstrict(L, vp))
+ {
+ bool n = luax_checkbool(L, vp);
+ int size = sizeof(n);
+ shared->append(&n, size);
+ luax_pushinteger(L, size);
+ return 1;
+ }
+ else if (luax_isstringstrict(L, vp))
+ {
+ const char* str = luax_checkstring(L, vp);
+ int size = strlen(str) + 1;
+ shared->append(str, size);
+ luax_pushinteger(L, size);
+ return 1;
+ }
+ else
+ {
+ luax_typerror(L, vp, "number, bool or string");
+ return 0;
+ }
+ }
+
+ // net.Buffer:grabString(offset) -> string, length
+ LUA_IMPLEMENT int l_grabString(lua_State* L)
+ {
+ SharedBuffer shared = checkNetBuffer(L);
+ int offset = luax_checkinteger(L, 2);
+ unsigned int len;
+ char* data = shared->grabString(&len, offset);
+ Array<char> str;
+ str.bind(data, len);
+ luax_pushstring(L, &str);
+ luax_pushinteger(L, str.count());
+ return 2;
+ }
+
+ // net.Buffer:grabInteger(offset) -> integer, length
+ LUA_IMPLEMENT int l_grabInteger(lua_State* L)
+ {
+ SharedBuffer shared = checkNetBuffer(L);
+ int offset = luax_checkinteger(L, 2);
+ int len;
+ int integer = shared->grabInteger(&len, offset);
+ luax_pushinteger(L, integer);
+ luax_pushinteger(L, len);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_grabFloat(lua_State* L)
+ {
+ SharedBuffer shared = checkNetBuffer(L);
+ int offset = luax_checkinteger(L, 2);
+ int len;
+ float floatv = shared->grabFloat(&len, offset);
+ luax_pushnumber(L, floatv);
+ luax_pushinteger(L, len);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_grabBoolean(lua_State* L)
+ {
+ SharedBuffer shared = checkNetBuffer(L);
+ int offset = luax_checkinteger(L, 2);
+ int len;
+ bool boolean = shared->grabBoolean(&len, offset);
+ luax_pushboolean(L, boolean);
+ luax_pushinteger(L, len);
+ return 2;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Buffer);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Buffer(lua_State* L)
+ {
+ luaL_Reg netbuffer_function[] = {
+ { "__gc", l_gc },
+ { "append", l_append },
+ { "grabString", l_grabString },
+ { "grabInteger", l_grabInteger },
+ { "grabBoolean", l_grabBoolean },
+ { "grabFloat", l_grabFloat },
+ { 0, 0 }
+ };
+
+ luax_newtype(L, Jin_Lua_Buffer, netbuffer_function);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/net/je_lua_buffer.h b/src/lua/modules/net/je_lua_buffer.h
new file mode 100644
index 0000000..d226640
--- /dev/null
+++ b/src/lua/modules/net/je_lua_buffer.h
@@ -0,0 +1,102 @@
+#ifndef __JIN_LUA_NET_NETBUFFER_H
+#define __JIN_LUA_NET_NETBUFFER_H
+
+#include <cstring>
+#include <cstdlib>
+#include "lua/common/je_lua_common.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Buffer;
+
+ void luaopen_Buffer(lua_State* L);
+
+ namespace Net
+ {
+
+ class Buffer
+ {
+ public:
+ Buffer(size_t s = 0)
+ : size(s)
+ {
+ buffer = new char[size];
+ memset(buffer, 0, size);
+ }
+
+ Buffer(const char* data, size_t s)
+ : size(s)
+ {
+ buffer = new char[size];
+ memcpy(buffer, data, size);
+ }
+
+ ~Buffer()
+ {
+ if (buffer != nullptr)
+ {
+ delete[] buffer;
+ buffer = nullptr;
+ size = 0;
+ }
+ }
+
+ void append(const void* data, size_t s)
+ {
+ if (data == nullptr)
+ return;
+ char* buf = buffer;
+ buffer = new char[size + s];
+ memcpy(buffer, buf, size);
+ memcpy(buffer + size, data, s);
+ delete[] buf;
+ size += s;
+ return;
+ }
+
+ /* grab and create a string */
+ char* grabString(unsigned int* length, int offset = 0)
+ {
+ int l = offset;
+ for (; l < size; ++l)
+ {
+ if (buffer[l] == 0)
+ break;
+ }
+ *length = l - offset + 1;
+ char* str = (char*)malloc(*length);
+ memcpy(str, buffer + offset, *length);
+ return str;
+ }
+
+ int grabInteger(int* length, int offset = 0)
+ {
+ *length = sizeof(int);
+ return *((int*)(buffer + offset));
+ }
+
+ float grabFloat(int* length, int offset = 0)
+ {
+ *length = sizeof(float);
+ return *((float*)(buffer + offset));
+ }
+
+ bool grabBoolean(int* length, int offset = 0)
+ {
+ *length = sizeof(bool);
+ return *((bool*)(buffer + offset));
+ }
+
+ char* buffer;
+ size_t size;
+
+ };
+
+ } // namespace Net
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/net/je_lua_net.cpp b/src/lua/modules/net/je_lua_net.cpp
new file mode 100644
index 0000000..b081733
--- /dev/null
+++ b/src/lua/modules/net/je_lua_net.cpp
@@ -0,0 +1,84 @@
+#include "lua/modules/luax.h"
+
+#include "libjin/jin.h"
+#include "lua/common/je_lua_common.h"
+
+#include "je_lua_buffer.h"
+#include "je_lua_socket.h"
+
+namespace JinEngine
+{
+namespace Lua
+{
+
+ using namespace JinEngine::Lua::Net;
+ using namespace JinEngine::Net;
+
+ LUA_IMPLEMENT int l_initNetwork(lua_State* L)
+ {
+ JinEngine::Net::NetManager::get()->init();
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_Socket(lua_State* L)
+ {
+ SocketInformation info = { 0 };
+ {
+ const char* socketType = luax_checkstring(L, 1);
+ if (strcmp(socketType, "TCP") == 0)
+ info.type = SocketType::TCP;
+ else if (strcmp(socketType, "UDP") == 0)
+ info.type = SocketType::UDP;
+ else
+ {
+ luax_error(L, "jin.net.Socket() first paramter wrong, must be TCP or UDP");
+ return 0;
+ }
+ // type, port
+ if (luax_gettop(L) == 2)
+ {
+ info.port = luax_checkinteger(L, 2);
+ }
+ // type, address, port
+ else if (luax_gettop(L) == 3)
+ {
+ if (luax_isstringstrict(L, 2))
+ info.address = tk_strtohl(luax_checkstring(L, 2));
+ else if (luax_isintegerstrict(L, 2))
+ info.address = luax_checkinteger(L, 2);
+ info.port = luax_checkinteger(L, 3);
+ }
+ }
+ Socket* socket = new Socket(info);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Socket);
+ proxy->bind(new Shared<Socket>(socket, Jin_Lua_Socket));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_Buffer(lua_State* L)
+ {
+ int size = luax_checkinteger(L, 1);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer);
+ Net::Buffer* buffer = new Net::Buffer(size);
+ proxy->bind(new Shared<Buffer>(buffer, Jin_Lua_Buffer));
+ return 1;
+ }
+
+ LUA_EXPORT int luaopen_net(lua_State* L)
+ {
+ luaopen_Socket(L);
+ luaopen_Buffer(L);
+
+ luaL_Reg f[] = {
+ { "init", l_initNetwork },
+ { "newSocket", l_Socket },
+ { "newBuffer", l_Buffer },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+} // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/net/je_lua_net.h b/src/lua/modules/net/je_lua_net.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/net/je_lua_net.h
diff --git a/src/lua/modules/net/je_lua_socket.cpp b/src/lua/modules/net/je_lua_socket.cpp
new file mode 100644
index 0000000..db170e4
--- /dev/null
+++ b/src/lua/modules/net/je_lua_socket.cpp
@@ -0,0 +1,129 @@
+#include "lua/modules/luax.h"
+
+#include "lua/common/je_lua_common.h"
+#include "libjin/jin.h"
+#include "je_lua_buffer.h"
+
+using namespace JinEngine::Net;
+using namespace JinEngine::Lua::Net;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Socket = "Socket";
+
+ typedef Shared<Socket>& SharedSocket;
+
+ const int BUFFER_SIZE = 1024;
+
+ LUA_IMPLEMENT inline SharedSocket checkSocket(lua_State* L, int pos = 1)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, pos, Jin_Lua_Socket);
+ return proxy->getShared<Socket>();
+ }
+
+ LUA_IMPLEMENT inline Shared<Buffer>& checkNetBuffer(lua_State* L, int pos = 1)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, pos, Jin_Lua_Buffer);
+ return proxy->getShared<Buffer>();
+ }
+
+ // return net.Socket
+ LUA_IMPLEMENT int l_accept(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ Socket* client = socket->accept();
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Socket);
+ proxy->bind(new Shared<Socket>(client, Jin_Lua_Socket));
+ return 1;
+ }
+
+ // return net.Buffer
+ LUA_IMPLEMENT int l_receive(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ char buffer[BUFFER_SIZE] = {0};
+ int size = socket->receive(buffer, BUFFER_SIZE);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer);
+ Net::Buffer* netBuffer = new Net::Buffer(buffer, size);
+ proxy->bind(new Shared<Buffer>(netBuffer, Jin_Lua_Buffer));
+ return 1;
+ }
+
+ // Socket:receiveFrom(address, port)
+ LUA_IMPLEMENT int l_receiveFrom(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ int address = luax_checkinteger(L, 2);
+ int port = luax_checkinteger(L, 3);
+ char buffer[BUFFER_SIZE];
+ int size = socket->receiveFrom(buffer, BUFFER_SIZE, address, port);
+ Net::Buffer* netBuffer = new Net::Buffer(buffer, size);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer);
+ proxy->bind(new Shared<Buffer>(netBuffer, Jin_Lua_Buffer));
+ return 1;
+ }
+
+ // Socket:send(net.Buffer) -> data_length
+ LUA_IMPLEMENT int l_send(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ Shared<Buffer>& shared = checkNetBuffer(L, 2);
+ int len = socket->send(shared->buffer, shared->size);
+ luax_pushinteger(L, len);
+ return 1;
+ }
+
+ // Socket:sendTo(address, port, net.Buffer)
+ LUA_IMPLEMENT int l_sendTo(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ int address = luax_checkinteger(L, 2);
+ int port = luax_checkinteger(L, 3);
+ Shared<Buffer>& buffer = checkNetBuffer(L, 4);
+ socket->sendTo(buffer->buffer, buffer->size, address, port);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_close(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ socket->close();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_configBlocking(lua_State* L)
+ {
+ SharedSocket socket = checkSocket(L);
+ bool blocking = luax_checkbool(L, 2);
+ socket->configureBlocking(blocking);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Socket);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Socket(lua_State* L)
+ {
+ luaL_Reg socket_function[] = {
+ { "__gc", l_gc },
+ { "accept", l_accept },
+ { "receive", l_receive },
+ { "receiveFrom", l_receiveFrom },
+ { "send", l_send },
+ { "sendTo", l_sendTo },
+ { "close", l_close },
+ { "configBlocking", l_configBlocking },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Socket, socket_function);
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/net/je_lua_socket.h b/src/lua/modules/net/je_lua_socket.h
new file mode 100644
index 0000000..b33fac6
--- /dev/null
+++ b/src/lua/modules/net/je_lua_socket.h
@@ -0,0 +1,16 @@
+#ifndef __JE_LUA_SOCKET_H__
+#define __JE_LUA_SOCKET_H__
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Socket;
+
+ void luaopen_Socket(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/net/net.cpp b/src/lua/modules/net/net.cpp
deleted file mode 100644
index 4ef9ece..0000000
--- a/src/lua/modules/net/net.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "libjin/jin.h"
-#include "lua/common/common.h"
-#include "Buffer.h"
-
-namespace JinEngine
-{
-namespace Lua
-{
-
- using namespace JinEngine::Lua::Net;
- using namespace JinEngine::Net;
-
- static int l_initNetwork(lua_State* L)
- {
- JinEngine::Net::NetManager::get()->init();
- return 1;
- }
-
- static int l_Socket(lua_State* L)
- {
- SocketInformation info = { 0 };
- {
- const char* socketType = luax_checkstring(L, 1);
- if (strcmp(socketType, "TCP") == 0)
- info.type = SocketType::TCP;
- else if (strcmp(socketType, "UDP") == 0)
- info.type = SocketType::UDP;
- else
- {
- luax_error(L, "jin.net.Socket() first paramter wrong, must be TCP or UDP");
- return 0;
- }
- // type, port
- if (luax_gettop(L) == 2)
- {
- info.port = luax_checkinteger(L, 2);
- }
- // type, address, port
- else if (luax_gettop(L) == 3)
- {
- if (luax_isstringstrict(L, 2))
- info.address = tk_strtohl(luax_checkstring(L, 2));
- else if (luax_isintegerstrict(L, 2))
- info.address = luax_checkinteger(L, 2);
- info.port = luax_checkinteger(L, 3);
- }
- }
- Socket* socket = new Socket(info);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_SOCKET, sizeof(Proxy));
- proxy->bind(new Ref<Socket>(socket, JIN_NETWORK_SOCKET));
- return 1;
- }
-
- static int l_Buffer(lua_State* L)
- {
- int size = luax_checkinteger(L, 1);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_BUFFER, sizeof(Proxy));
- Net::Buffer* buffer = new Net::Buffer(size);
- proxy->bind(new Ref<Buffer>(buffer, JIN_NETWORK_BUFFER));
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "init", l_initNetwork },
- { "newSocket", l_Socket },
- { "newBuffer", l_Buffer },
- { 0, 0 }
- };
-
- extern int luaopen_Socket(lua_State* L);
- extern int luaopen_Buffer(lua_State* L);
-
- int luaopen_net(lua_State* L)
- {
- luaopen_Socket(L);
- luaopen_Buffer(L);
-
- luax_newlib(L, f);
-
- return 1;
- }
-
-} // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/net/socket.cpp b/src/lua/modules/net/socket.cpp
deleted file mode 100644
index d6de730..0000000
--- a/src/lua/modules/net/socket.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "lua/common/common.h"
-#include "libjin/jin.h"
-#include "Buffer.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Net;
- using namespace Lua::Net;
-
- typedef Ref<Socket>& SocketRef;
-
- const int BUFFER_SIZE = 1024;
-
- static inline SocketRef checkSocket(lua_State* L, int pos = 1)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, pos, JIN_NETWORK_SOCKET);
- return proxy->getRef<Socket>();
- }
-
- static inline Ref<Buffer>& checkNetBuffer(lua_State* L, int pos = 1)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, pos, JIN_NETWORK_BUFFER);
- return proxy->getRef<Buffer>();
- }
-
- // return net.Socket
- static int l_accept(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- Socket* client = socket->accept();
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_SOCKET, sizeof(Proxy));
- proxy->bind(new Ref<Socket>(client, JIN_NETWORK_SOCKET));
- return 1;
- }
-
- // return net.Buffer
- static int l_receive(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- char buffer[BUFFER_SIZE] = {0};
- int size = socket->receive(buffer, BUFFER_SIZE);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_BUFFER, sizeof(Proxy));
- Net::Buffer* netBuffer = new Net::Buffer(buffer, size);
- proxy->bind(new Ref<Buffer>(netBuffer, JIN_NETWORK_BUFFER));
- return 1;
- }
-
- // Socket:receiveFrom(address, port)
- static int l_receiveFrom(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- int address = luax_checkinteger(L, 2);
- int port = luax_checkinteger(L, 3);
- char buffer[BUFFER_SIZE];
- int size = socket->receiveFrom(buffer, BUFFER_SIZE, address, port);
- Net::Buffer* netBuffer = new Net::Buffer(buffer, size);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_BUFFER, sizeof(Proxy));
- proxy->bind(new Ref<Buffer>(netBuffer, JIN_NETWORK_BUFFER));
- return 1;
- }
-
- // Socket:send(net.Buffer) -> data_length
- static int l_send(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- Ref<Buffer>& ref = checkNetBuffer(L, 2);
- int len = socket->send(ref->buffer, ref->size);
- luax_pushinteger(L, len);
- return 1;
- }
-
- // Socket:sendTo(address, port, net.Buffer)
- static int l_sendTo(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- int address = luax_checkinteger(L, 2);
- int port = luax_checkinteger(L, 3);
- Ref<Buffer>& buffer = checkNetBuffer(L, 4);
- socket->sendTo(buffer->buffer, buffer->size, address, port);
- return 0;
- }
-
- static int l_close(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- socket->close();
- return 0;
- }
-
- static int l_configBlocking(lua_State* L)
- {
- SocketRef socket = checkSocket(L);
- bool blocking = luax_checkbool(L, 2);
- socket->configureBlocking(blocking);
- return 0;
- }
-
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_NETWORK_SOCKET);
- proxy->release();
- return 0;
- }
-
- static const luaL_Reg socket_function[] = {
- { "__gc", l_gc },
- { "accept", l_accept },
- { "receive", l_receive },
- { "receiveFrom", l_receiveFrom },
- { "send", l_send },
- { "sendTo", l_sendTo },
- { "close", l_close },
- { "configBlocking", l_configBlocking },
- { 0, 0 }
- };
-
- int luaopen_Socket(lua_State* L)
- {
- luax_newtype(L, JIN_NETWORK_SOCKET, socket_function);
- return 0;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/thread/Thread.cpp b/src/lua/modules/thread/Thread.cpp
deleted file mode 100644
index e1c5a92..0000000
--- a/src/lua/modules/thread/Thread.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-#include "lua/modules/luax.h"
-#include "lua/modules/types.h"
-#include "libjin/jin.h"
-#include "lua/jin.h"
-#include "lua/common/common.h"
-#include "thread.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using thread::Thread;
-
- typedef Ref<Thread>& ThreadRef;
-
- int luaopen_thread(lua_State* L);
-
- static inline ThreadRef checkThread(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_THREAD_THREAD);
- return proxy->getRef<Thread>();
- }
-
- static int threadRunner(void* t)
- {
- ThreadRef ref = *(Ref<Thread>*)t;
- lua_State* L = lua_open();
- luax_openlibs(L);
- luaopen_jin(L);
- luax_getglobal(L, MODULE_NAME);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_THREAD_THREAD, sizeof(Proxy));
- ref.retain();
- proxy->bind(&ref);
- luax_setfield(L, -2, "_curThread");
- luax_dostring(L, ref->code.c_str());
- luax_close(L);
- return 0;
- }
-
- static int l_thread_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_THREAD_THREAD);
- proxy->release();
- return 0;
- }
-
- static int l_start(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- bool result = ref->start(&ref);
- luax_pushboolean(L, result);
- return 1;
- }
-
- static int l_wait(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- ref->wait();
- return 0;
- }
-
- static int l_send(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- int slot = luax_checkinteger(L, 2);
- const int vp = 3;
- if (luax_isnumberstrict(L, vp))
- {
- float real = luax_checknumber(L, vp);
- ref->send(slot, real);
- }
- else if (luax_isbooleanstrict(L, vp))
- {
- bool bol = luax_checkbool(L, vp);
- ref->send(slot, bol);
- }
- else if (luax_isstringstrict(L, vp))
- {
- const char* str = luax_checkstring(L, vp);
- ref->send(slot, str);
- }
- else if (luax_isuserdata(L, vp))
- {
- void* p = luax_touserdata(L, vp);
- ref->send(slot, p);
- }
- else if (luax_islightuserdata(L, vp))
- {
- void* p = luax_tolightuserdata(L, vp);
- ref->send(slot, p);
- }
- return 0;
- }
-
- static int l_receive(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- int slot = luax_checkinteger(L, 2);
- bool result = ref->receive(slot);
- luax_pushboolean(L, result);
- return 1;
- }
-
- static int l_fetch(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- int slot = luax_checkinteger(L, 2);
- Thread::Variant v = ref->fetch(slot);
- switch (v.type)
- {
- case thread::Thread::Variant::INTERGER:
- luax_pushinteger(L, v.integer);
- break;
-
- case thread::Thread::Variant::BOOLEAN:
- luax_pushboolean(L, v.boolean);
- break;
-
- case thread::Thread::Variant::CSTRING:
- luax_pushstring(L, v.cstring);
- break;
-
- case thread::Thread::Variant::REAL:
- luax_pushnumber(L, v.real);
- break;
-
- case thread::Thread::Variant::POINTER:
- Proxy* p = (Proxy*)v.pointer;
- Proxy* proxy = (Proxy*)luax_newinstance(L, p->getObjectType(), sizeof(Proxy));
- p->reference->retain();
- proxy->bind(p->reference);
- break;
-
- }
- return 1;
- }
-
- static int l_demand(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- int slot = luax_checkinteger(L, 2);
- Thread::Variant v = ref->demand(slot);
- switch (v.type)
- {
- case thread::Thread::Variant::INTERGER:
- luax_pushinteger(L, v.integer);
- break;
-
- case thread::Thread::Variant::BOOLEAN:
- luax_pushboolean(L, v.boolean);
- break;
-
- case thread::Thread::Variant::CSTRING:
- luax_pushstring(L, v.cstring);
- break;
-
- case thread::Thread::Variant::REAL:
- luax_pushnumber(L, v.real);
- break;
-
- case thread::Thread::Variant::POINTER:
- Proxy* p = (Proxy*)v.pointer;
- const char* objType = p->getObjectType();
- Proxy* proxy = (Proxy*)luax_newinstance(L, objType, sizeof(Proxy));
- p->reference->retain();
- proxy->bind(p->reference);
- break;
-
- }
- return 1;
- }
-
- static int l_remove(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- int slot = luax_checkinteger(L, 2);
- ref->remove(slot);
- return 0;
- }
-
- static int l_getName(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- const char* name = ref->getName();
- luax_pushstring(L, name);
- return 1;
- }
-
- static int l_isRunning(lua_State* L)
- {
- ThreadRef ref = checkThread(L);
- bool running = ref->isRunning();
- luax_pushboolean(L, running);
- return 1;
- }
-
- static const luaL_Reg thread_function[] = {
- { "__gc", l_thread_gc },
- { "start", l_start },
- { "wait", l_wait },
- { "send", l_send },
- { "receive", l_receive },
- { "fetch", l_fetch },
- { "demand", l_demand },
- { "remove", l_remove },
- { "getName", l_getName },
- { "isRunning", l_isRunning },
- { 0, 0 }
- };
-
- static int luaopen_Thread(lua_State* L)
- {
- luax_newtype(L, JIN_THREAD_THREAD, thread_function);
-
- return 0;
- }
-
- static int l_newThread(lua_State* L)
- {
- const char* name = luax_checkstring(L, 1);
- const char* code = luax_checkstring(L, 2);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_THREAD_THREAD, sizeof(Proxy));
- Thread* thread = new Thread(name, code, threadRunner);
- proxy->bind(new Ref<Thread>(thread, JIN_THREAD_THREAD));
- return 1;
- }
-
- static int l_getThread(lua_State* L)
- {
- luax_getglobal(L, MODULE_NAME);
- luax_getfield(L, -1, "_curThread");
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "newThread", l_newThread },
- { "getThread", l_getThread },
- { 0, 0 }
- };
-
- int luaopen_thread(lua_State* L)
- {
- luaopen_Thread(L);
-
- luax_newlib(L, f);
-
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/thread/Thread.h b/src/lua/modules/thread/Thread.h
deleted file mode 100644
index 60d588a..0000000
--- a/src/lua/modules/thread/Thread.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "libjin/jin.h"
-#include "lua/common/common.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
- namespace thread
- {
-
- class Thread
- {
- public:
- typedef JinEngine::MultiThread::Thread::Variant Variant;
- typedef JinEngine::MultiThread::Thread::ThreadRunner ThreadRunner;
-
- Thread(std::string _name, std::string _code, ThreadRunner runner)
- : name(_name)
- , code(_code)
- {
- thread = new JinEngine::MultiThread::Thread(_name, runner);
- }
-
- ~Thread()
- {
- delete thread;
- }
-
- bool start(void* p)
- {
- return thread->start(p);
- }
-
- void wait()
- {
- thread->wait();
- }
-
- void send(int slot, const Variant& value)
- {
- thread->send(slot, value);
- }
-
- bool receive(int slot)
- {
- return thread->receive(slot);
- }
-
- Variant fetch(int slot)
- {
- return thread->fetch(slot);
- }
-
- Variant demand(int slot)
- {
- return thread->demand(slot);
- }
-
- void remove(int slot)
- {
- thread->remove(slot);
- }
-
- const char* getName()
- {
- return name.c_str();
- }
-
- bool isRunning()
- {
- return thread->isRunning();
- }
-
- void lock()
- {
- thread->lock();
- }
-
- void unlock()
- {
- thread->unlock();
- }
-
- const std::string name;
- const std::string code;
-
- private:
- JinEngine::MultiThread::Thread* thread;
-
- };
-
- } // thread
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/thread/je_lua_thread.cpp b/src/lua/modules/thread/je_lua_thread.cpp
new file mode 100644
index 0000000..d7b50ab
--- /dev/null
+++ b/src/lua/modules/thread/je_lua_thread.cpp
@@ -0,0 +1,248 @@
+#include "lua/modules/luax.h"
+
+#include "libjin/jin.h"
+#include "lua/jin.h"
+#include "lua/common/je_lua_common.h"
+#include "je_lua_thread.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Thread = "Thread";
+
+ typedef Shared<Thread>& SharedThread;
+
+ int luaopen_thread(lua_State* L);
+
+ static inline SharedThread checkThread(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Thread);
+ return proxy->getShared<Thread>();
+ }
+
+ LUA_IMPLEMENT int threadRunner(void* t)
+ {
+ SharedThread shared = *(Shared<Thread>*)t;
+ lua_State* L = lua_open();
+ luax_openlibs(L);
+ luaopen_jin(L);
+ luax_getglobal(L, MODULE_NAME);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread);
+ proxy->bind(&shared);
+ luax_setfield(L, -2, "_curThread");
+ luax_dostring(L, shared->code.c_str());
+ luax_close(L);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_thread_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Thread);
+ proxy->release();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_start(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ bool result = shared->start(&shared);
+ luax_pushboolean(L, result);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_wait(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ shared->wait();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_send(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ int slot = luax_checkinteger(L, 2);
+ const int vp = 3;
+ if (luax_isnumberstrict(L, vp))
+ {
+ float real = luax_checknumber(L, vp);
+ shared->send(slot, real);
+ }
+ else if (luax_isbooleanstrict(L, vp))
+ {
+ bool bol = luax_checkbool(L, vp);
+ shared->send(slot, bol);
+ }
+ else if (luax_isstringstrict(L, vp))
+ {
+ const char* str = luax_checkstring(L, vp);
+ shared->send(slot, str);
+ }
+ else if (luax_isuserdata(L, vp))
+ {
+ void* p = luax_touserdata(L, vp);
+ shared->send(slot, p);
+ }
+ else if (luax_islightuserdata(L, vp))
+ {
+ void* p = luax_tolightuserdata(L, vp);
+ shared->send(slot, p);
+ }
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_receive(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ int slot = luax_checkinteger(L, 2);
+ bool result = shared->receive(slot);
+ luax_pushboolean(L, result);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_fetch(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ int slot = luax_checkinteger(L, 2);
+ Thread::Variant v = shared->fetch(slot);
+ switch (v.type)
+ {
+ case Thread::Variant::INTERGER:
+ luax_pushinteger(L, v.integer);
+ break;
+
+ case Thread::Variant::BOOLEAN:
+ luax_pushboolean(L, v.boolean);
+ break;
+
+ case Thread::Variant::CSTRING:
+ luax_pushstring(L, v.cstring);
+ break;
+
+ case Thread::Variant::REAL:
+ luax_pushnumber(L, v.real);
+ break;
+
+ case Thread::Variant::POINTER:
+ Proxy* p = (Proxy*)v.pointer;
+ Proxy* proxy = luax_newinstance(L, p->getObjectType());
+ proxy->bind(p->shared);
+ break;
+
+ }
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_demand(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ int slot = luax_checkinteger(L, 2);
+ Thread::Variant v = shared->demand(slot);
+ switch (v.type)
+ {
+ case Thread::Variant::INTERGER:
+ luax_pushinteger(L, v.integer);
+ break;
+
+ case Thread::Variant::BOOLEAN:
+ luax_pushboolean(L, v.boolean);
+ break;
+
+ case Thread::Variant::CSTRING:
+ luax_pushstring(L, v.cstring);
+ break;
+
+ case Thread::Variant::REAL:
+ luax_pushnumber(L, v.real);
+ break;
+
+ case Thread::Variant::POINTER:
+ Proxy* p = (Proxy*)v.pointer;
+ const char* objType = p->getObjectType();
+ Proxy* proxy = luax_newinstance(L, objType);
+ proxy->bind(p->shared);
+ break;
+
+ }
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_remove(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ int slot = luax_checkinteger(L, 2);
+ shared->remove(slot);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_getName(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ const char* name = shared->getName();
+ luax_pushstring(L, name);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_isRunning(lua_State* L)
+ {
+ SharedThread shared = checkThread(L);
+ bool running = shared->isRunning();
+ luax_pushboolean(L, running);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int luaopen_Thread(lua_State* L)
+ {
+ luaL_Reg thread_function[] = {
+ { "__gc", l_thread_gc },
+ { "start", l_start },
+ { "wait", l_wait },
+ { "send", l_send },
+ { "receive", l_receive },
+ { "fetch", l_fetch },
+ { "demand", l_demand },
+ { "remove", l_remove },
+ { "getName", l_getName },
+ { "isRunning", l_isRunning },
+ { 0, 0 }
+ };
+
+ luax_newtype(L, Jin_Lua_Thread, thread_function);
+
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_newThread(lua_State* L)
+ {
+ const char* name = luax_checkstring(L, 1);
+ const char* code = luax_checkstring(L, 2);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread);
+ Thread* thread = new Thread(name, code, threadRunner);
+ proxy->bind(new Shared<Thread>(thread, Jin_Lua_Thread));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getThread(lua_State* L)
+ {
+ luax_getglobal(L, MODULE_NAME);
+ luax_getfield(L, -1, "_curThread");
+ return 1;
+ }
+
+ LUA_EXPORT int luaopen_thread(lua_State* L)
+ {
+ luaopen_Thread(L);
+
+ luaL_Reg f[] = {
+ { "newThread", l_newThread },
+ { "getThread", l_getThread },
+ { 0, 0 }
+ };
+ luax_newlib(L, f);
+
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/thread/je_lua_thread.h b/src/lua/modules/thread/je_lua_thread.h
new file mode 100644
index 0000000..a3e4e76
--- /dev/null
+++ b/src/lua/modules/thread/je_lua_thread.h
@@ -0,0 +1,93 @@
+#include "libjin/jin.h"
+#include "lua/common/je_lua_common.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Thread;
+
+ class Thread
+ {
+ public:
+ typedef JinEngine::Threads::Thread::Variant Variant;
+ typedef JinEngine::Threads::Thread::ThreadRunner ThreadRunner;
+
+ Thread(std::string _name, std::string _code, ThreadRunner runner)
+ : name(_name)
+ , code(_code)
+ {
+ thread = new JinEngine::Threads::Thread(_name, runner);
+ }
+
+ ~Thread()
+ {
+ delete thread;
+ }
+
+ bool start(void* p)
+ {
+ return thread->start(p);
+ }
+
+ void wait()
+ {
+ thread->wait();
+ }
+
+ void send(int slot, const Variant& value)
+ {
+ thread->send(slot, value);
+ }
+
+ bool receive(int slot)
+ {
+ return thread->receive(slot);
+ }
+
+ Variant fetch(int slot)
+ {
+ return thread->fetch(slot);
+ }
+
+ Variant demand(int slot)
+ {
+ return thread->demand(slot);
+ }
+
+ void remove(int slot)
+ {
+ thread->remove(slot);
+ }
+
+ const char* getName()
+ {
+ return name.c_str();
+ }
+
+ bool isRunning()
+ {
+ return thread->isRunning();
+ }
+
+ void lock()
+ {
+ thread->lock();
+ }
+
+ void unlock()
+ {
+ thread->unlock();
+ }
+
+ const std::string name;
+ const std::string code;
+
+ private:
+ JinEngine::Threads::Thread* thread;
+
+ };
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/time/je_lua_time.cpp b/src/lua/modules/time/je_lua_time.cpp
new file mode 100644
index 0000000..39ec899
--- /dev/null
+++ b/src/lua/modules/time/je_lua_time.cpp
@@ -0,0 +1,71 @@
+#include "SDL2/SDL.h"
+#include "lua/common/je_lua_common.h"
+#include "lua/modules/luax.h"
+#include "libjin/jin.h"
+
+
+#include "je_lua_timer.h"
+
+using namespace JinEngine::Time;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ static struct
+ {
+ float previous;
+ float current;
+ } context;
+
+ LUA_IMPLEMENT int l_sec(lua_State* L)
+ {
+ luax_pushnumber(L, getSecond());
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_sleep(lua_State* L)
+ {
+ double sec = luax_checknumber(L, 1);
+ sleep(sec * 1000.0f);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_newTimer(lua_State* L)
+ {
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Timer);
+ proxy->bind(new Shared<Timer>(new Timer(), Jin_Lua_Timer));
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_getDelta(lua_State* L)
+ {
+ luax_pushnumber(L, context.current - context.previous);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_step(lua_State* L)
+ {
+ context.previous = context.current;
+ context.current = getSecond();
+ return 0;
+ }
+
+ LUA_EXPORT int luaopen_time(lua_State* L)
+ {
+ luaopen_Timer(L);
+ luaL_Reg f[] = {
+ { "second", l_sec },
+ { "sleep", l_sleep },
+ { "newTimer", l_newTimer },
+ { "step", l_step },
+ { "getDelta", l_getDelta },
+ { 0, 0 },
+ };
+ luax_newlib(L, f);
+ return 1;
+ }
+
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/time/je_lua_time.h b/src/lua/modules/time/je_lua_time.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/lua/modules/time/je_lua_time.h
diff --git a/src/lua/modules/time/je_lua_timer.cpp b/src/lua/modules/time/je_lua_timer.cpp
new file mode 100644
index 0000000..540f205
--- /dev/null
+++ b/src/lua/modules/time/je_lua_timer.cpp
@@ -0,0 +1,146 @@
+
+#include "lua/common/je_lua_callback.h"
+#include "lua/common/je_lua_common.h"
+#include "je_lua_timer.h"
+
+using namespace JinEngine::Time;
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ const char* Jin_Lua_Timer = "Timer";
+
+ const char* Jin_Lua_Handler = "Handler";
+
+ typedef Shared<Timer>& SharedTimer;
+
+ static Timer::TimerCallback timerCallback = [](void* data)->void
+ {
+ LuaCallback* func = static_cast<LuaCallback*>(data);
+ func->call();
+ };
+
+ static Timer::FinishCallback finishCallback = [](void* data)->void
+ {
+ LuaCallback* func = static_cast<LuaCallback*>(data);
+ delete func;
+ };
+
+ LUA_IMPLEMENT inline SharedTimer checkTimer(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, Jin_Lua_Timer);
+ return proxy->getShared<Timer>();
+ }
+
+ // timer:every(time, callback, parameter)
+ LUA_IMPLEMENT int l_every(lua_State* L)
+ {
+ int n = luax_gettop(L);
+ SharedTimer shared = checkTimer(L);
+ Timer* timer = shared.getObject();
+ float s = luax_checknumber(L, 2);
+ LuaCallback* func = new LuaCallback(L);
+ func->setFunc(3);
+ for(int i = 4; i <= n; ++i)
+ func->pushParam(i);
+ Timer::Handler* handler = timer->every(s, timerCallback, func, finishCallback);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler);
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
+ shrHandler->retain();
+ proxy->bind(shrHandler);
+ return 1;
+ }
+
+ // timer:after(time, callback, parameter)
+ LUA_IMPLEMENT int l_after(lua_State* L)
+ {
+ int n = luax_gettop(L);
+ SharedTimer shared = checkTimer(L);
+ Timer* timer = shared.getObject();
+ float s = luax_checknumber(L, 2);
+ LuaCallback* func = new LuaCallback(L);
+ func->setFunc(3);
+ for (int i = 4; i <= n; ++i)
+ func->pushParam(i);
+ Timer::Handler* handler = timer->after(s, timerCallback, func, finishCallback);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler);
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
+ shrHandler->retain();
+ proxy->bind(shrHandler);
+ return 1;
+ }
+
+ // timer:repeat(time, callback, parameter)
+ LUA_IMPLEMENT int l_repeat(lua_State* L)
+ {
+ int n = luax_gettop(L);
+ SharedTimer shared = checkTimer(L);
+ Timer* timer = shared.getObject();
+ float s = luax_checknumber(L, 2);
+ int count = luax_checkinteger(L, 3);
+ LuaCallback* func = new LuaCallback(L);
+ func->setFunc(4);
+ for (int i = 5; i <= n; ++i)
+ func->pushParam(i);
+ Timer::Handler* handler = timer->repeat(s, count, timerCallback, func, finishCallback);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler);
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
+ shrHandler->retain();
+ proxy->bind(shrHandler);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int l_update(lua_State* L)
+ {
+ SharedTimer shared = checkTimer(L);
+ Timer* timer = shared.getObject();
+ float s = luax_checknumber(L, 2);
+ timer->update(s);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_cancel(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Timer);
+ Timer* timer = p->getObject<Timer>();
+ Proxy* ph = (Proxy*)luax_checktype(L, 2, Jin_Lua_Handler);
+ Timer::Handler* handler = ph->getObject<Timer::Handler>();
+ timer->cancel(handler);
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_cancelAll(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Timer);
+ Timer* timer = p->getObject<Timer>();
+ timer->cancelAll();
+ return 0;
+ }
+
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_Timer);
+ p->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Timer(lua_State* L)
+ {
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "every", l_every },
+ { "after", l_after },
+ { "duplicate", l_repeat },
+ { "update", l_update },
+ { "cancel", l_cancel },
+ { "cancelAll", l_cancelAll },
+ { 0, 0 }
+ };
+
+ luax_newtype(L, Jin_Lua_Timer, f);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/lua/modules/time/je_lua_timer.h b/src/lua/modules/time/je_lua_timer.h
new file mode 100644
index 0000000..35ec15d
--- /dev/null
+++ b/src/lua/modules/time/je_lua_timer.h
@@ -0,0 +1,20 @@
+#ifndef __JE_LUA_TIMER_H__
+#define __JE_LUA_TIMER_H__
+
+#include "libjin/jin.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ extern const char* Jin_Lua_Timer;
+
+ extern const char* Jin_Lua_Handler;
+
+ void luaopen_Timer(lua_State* L);
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/src/lua/modules/time/time.cpp b/src/lua/modules/time/time.cpp
deleted file mode 100644
index f6e6f26..0000000
--- a/src/lua/modules/time/time.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "lua/modules/luax.h"
-#include <SDL2/SDL.h>
-#include "libjin/jin.h"
-
-namespace JinEngine
-{
- namespace Lua
- {
-
- using namespace JinEngine::Time;
-
- static int l_sec(lua_State* L)
- {
- luax_pushnumber(L, getSecond());
- return 1;
- }
-
- static int l_sleep(lua_State* L)
- {
- double sec = luax_checknumber(L, 1);
- sleep(sec * 1000.0f);
- return 0;
- }
-
- static const luaL_Reg f[] = {
- { "second", l_sec },
- { "sleep", l_sleep },
- { 0, 0 },
- };
-
- int luaopen_time(lua_State* L)
- {
- luax_newlib(L, f);
- return 1;
- }
-
- } // namespace Lua
-} // namespace JinEngine \ No newline at end of file
diff --git a/src/lua/modules/types.h b/src/lua/modules/types.h
deleted file mode 100644
index 123604e..0000000
--- a/src/lua/modules/types.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef __JIN_MODULES_TYPES_H
-#define __JIN_MODULES_TYPES_H
-
-// graphics module
-#define JIN_GRAPHICS_TEXTURE "Texture"
-#define JIN_GRAPHICS_SHADER "Shader"
-#define JIN_GRAPHICS_CANVAS "Canvas"
-#define JIN_GRAPHICS_TEXT "Text"
-#define JIN_GRAPHICS_TTFDATA "TTFData"
-#define JIN_GRAPHICS_TTF "TTF"
-#define JIN_GRAPHICS_TEXTUREFONT "TextureFont"
-#define JIN_GRAPHICS_PAGE "Page"
-#define JIN_GRAPHICS_BITMAP "Bitmap"
-
-// audio module
-#define JIN_AUDIO_SOURCE "Source"
-
-// thread module
-#define JIN_THREAD_THREAD "Thread"
-
-// network module
-#define JIN_NETWORK_SOCKET "Socket"
-#define JIN_NETWORK_BUFFER "Buffer"
-
-#endif \ No newline at end of file
diff --git a/src/lua/resources/font.ttf b/src/lua/resources/font.ttf
deleted file mode 100644
index 153c608..0000000
--- a/src/lua/resources/font.ttf
+++ /dev/null
Binary files differ
diff --git a/src/lua/resources/font.ttf.h b/src/lua/resources/font.ttf.h
index bb0734f..b220738 100644
--- a/src/lua/resources/font.ttf.h
+++ b/src/lua/resources/font.ttf.h
@@ -2,361 +2,365 @@ static const char
default_font_bitmap[] =
{ 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,3,154,0,0,0,14,8,6,0,0,0,78,
234,99,67,0,0,0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,
-0,0,14,194,0,0,14,194,1,21,40,74,128,0,0,0,25,116,69,88,116,83,111,102,116,
-119,97,114,101,0,112,97,105,110,116,46,110,101,116,32,52,46,48,46,50,49,241,
-32,105,149,0,0,29,22,73,68,65,84,120,94,237,92,61,168,109,75,82,126,8,134,166,
-26,138,32,152,152,60,16,68,12,6,28,159,130,136,129,58,193,168,136,99,96,224,4,
-38,47,83,208,64,197,224,129,168,32,19,61,13,12,100,20,20,196,72,196,216,159,
-200,68,19,49,209,72,65,20,19,17,217,246,87,95,215,174,175,126,122,239,117,206,
-61,87,158,48,181,169,123,86,87,125,93,93,127,221,107,173,125,238,189,31,220,
-62,184,221,192,31,20,114,249,164,115,82,204,35,28,232,10,238,10,6,116,21,7,
-122,132,123,169,141,43,248,9,247,104,222,132,159,104,194,169,76,229,87,232,
-234,188,171,56,208,251,192,42,238,132,125,164,3,93,153,251,104,62,232,165,184,
-61,124,74,111,105,247,173,48,78,142,189,106,243,25,206,233,125,224,21,115,5,
-183,135,15,73,237,93,153,243,8,127,146,59,61,211,43,93,193,94,193,76,164,243,
-174,206,125,41,30,116,117,206,85,92,165,151,204,187,130,123,169,173,183,198,
-130,94,138,175,116,117,238,75,214,120,107,155,142,59,97,85,127,194,40,93,197,
-190,47,123,255,223,112,239,34,175,58,167,147,254,165,114,167,103,122,208,85,
-125,197,60,155,7,58,97,92,94,117,39,185,147,234,79,24,167,215,98,183,40,209,
-85,253,30,38,250,44,233,78,228,115,222,199,188,43,24,165,151,226,157,238,243,
-238,179,11,87,73,30,5,87,73,30,5,87,201,73,174,60,75,201,251,74,13,236,208,44,
-56,149,143,137,169,24,227,219,237,211,197,159,96,164,100,200,140,221,154,32,
-67,60,192,108,41,237,63,192,41,65,119,199,125,225,126,5,255,64,159,222,37,87,
-109,56,95,141,243,118,251,207,197,95,18,153,95,125,105,241,191,44,254,72,116,
-160,143,22,67,14,253,182,58,218,197,218,234,191,243,158,241,152,128,147,57,
-199,121,134,186,128,3,25,242,141,177,134,202,184,132,13,73,215,57,153,246,160,
-47,186,113,62,200,80,47,199,109,233,153,10,254,157,236,190,22,115,31,9,155,60,
-99,111,183,95,76,163,96,236,171,44,225,124,149,40,87,252,201,238,98,179,195,
-79,72,39,60,100,85,250,28,71,251,170,87,238,113,53,155,105,254,35,31,186,46,
-143,170,190,172,147,248,9,214,124,226,231,136,1,59,37,121,181,13,158,236,203,
-120,152,147,71,19,243,19,146,193,63,227,151,246,214,98,211,95,181,15,86,108,
-220,35,50,171,31,143,108,213,92,20,172,249,230,227,11,88,208,93,246,0,159,112,
-39,214,249,101,173,196,15,112,109,157,215,216,204,81,100,230,39,75,116,148,
-237,144,79,53,3,87,123,87,234,187,174,156,18,6,156,113,87,237,129,243,200,185,
-198,115,202,97,197,93,93,247,5,254,89,188,252,60,151,187,159,83,61,106,12,29,
-51,219,124,34,119,50,237,3,61,200,16,131,254,46,169,62,241,185,235,171,246,
-211,101,37,14,167,53,138,185,154,223,154,83,159,95,215,42,118,155,158,188,87,
-203,4,185,96,140,183,106,164,132,173,189,48,244,64,26,169,95,213,103,126,56,
-170,118,31,205,203,107,102,221,213,245,234,188,194,78,107,148,145,213,230,137,
-235,188,136,239,227,197,246,204,63,229,206,214,84,137,114,181,249,12,239,172,
-243,170,206,185,74,242,40,184,74,242,40,184,74,110,183,111,177,171,42,87,158,
-165,228,125,165,6,44,120,144,73,67,62,54,115,197,24,127,150,95,52,127,198,254,
-140,23,185,223,16,221,85,27,206,95,123,209,108,100,200,55,198,26,42,227,18,54,
-36,93,231,100,90,215,127,238,126,69,198,56,75,246,172,76,134,122,57,110,75,
-207,84,240,239,100,247,181,152,61,66,191,253,215,98,28,166,91,107,31,31,129,
-208,155,255,97,87,65,31,167,27,4,56,231,24,125,170,212,241,92,179,18,15,116,
-112,173,209,140,255,56,97,136,171,107,35,190,105,47,130,43,246,147,230,39,152,
-107,227,129,228,195,197,154,191,121,63,234,126,206,58,191,58,157,3,176,143,
-117,162,30,92,163,198,0,106,103,198,146,103,223,163,118,147,239,96,207,233,
-148,71,215,225,204,83,13,108,230,135,51,112,212,223,99,80,98,60,189,166,19,
-246,211,39,189,5,127,148,162,103,122,252,115,47,64,171,190,240,97,164,246,121,
-238,217,217,87,167,220,3,90,223,37,145,156,247,126,9,187,17,71,240,132,71,252,
-181,38,192,193,119,91,111,115,239,49,214,33,114,16,56,158,1,129,59,249,132,49,
-228,31,10,214,251,164,18,253,113,92,212,16,54,156,24,71,237,11,222,179,29,155,
-237,56,19,83,107,50,219,99,125,61,78,16,99,128,141,192,89,157,64,91,18,121,
-201,56,183,87,251,240,211,182,238,28,115,206,31,184,219,114,202,251,146,235,
-106,190,89,75,237,211,25,199,28,214,56,118,204,38,189,34,143,124,79,231,133,
-238,159,169,102,179,205,39,114,39,211,62,208,131,12,81,244,50,3,53,168,123,
-169,159,101,148,165,115,21,180,116,97,155,189,135,154,125,210,114,202,121,167,
-179,253,247,22,255,214,226,222,3,228,189,90,38,200,5,99,188,85,35,37,44,123,1,
-107,195,223,143,90,175,68,143,118,191,217,67,244,21,18,245,131,57,240,30,203,
-245,14,57,251,83,115,20,235,193,159,156,7,250,192,61,7,137,174,151,253,244,
-125,76,251,148,123,236,49,7,76,223,177,14,40,98,9,121,95,11,204,188,229,179,
-170,230,46,143,126,121,49,124,1,127,197,100,213,102,196,0,174,123,62,98,1,206,
-81,129,207,92,37,121,20,92,37,252,243,27,23,255,210,226,239,218,227,9,247,23,
-139,191,167,201,149,103,41,121,95,169,97,43,16,200,164,33,31,155,185,98,140,
-125,211,149,41,134,204,216,173,9,50,196,3,204,150,210,254,3,156,18,116,119,28,
-27,6,5,196,38,255,176,52,203,158,209,201,80,129,35,95,141,19,27,43,31,64,170,
-173,58,208,243,195,141,184,126,88,146,247,140,199,4,156,204,57,206,51,212,5,
-28,200,144,111,140,53,84,198,37,108,72,186,206,201,180,174,231,161,136,220,
-242,32,173,249,31,230,131,12,245,114,220,150,158,169,224,223,201,238,107,48,
-247,43,246,211,191,46,158,111,38,224,210,155,251,39,110,44,249,197,135,57,246,
-195,187,30,232,216,55,245,198,155,111,98,100,224,40,235,123,164,227,123,29,65,
-220,35,42,85,220,116,163,11,44,230,158,94,186,238,88,203,105,224,251,126,212,
-156,101,157,95,69,47,170,158,246,177,14,111,126,252,201,155,120,189,201,149,
-186,152,79,252,76,24,216,112,155,206,88,11,103,34,117,170,1,199,218,113,227,
-39,195,38,124,204,190,179,254,240,5,120,228,197,53,192,195,78,127,137,239,241,
-250,56,159,245,180,237,118,180,182,142,167,76,111,208,96,175,79,72,48,6,62,
-247,87,216,86,63,240,64,24,15,65,244,193,57,234,135,177,218,2,23,189,213,134,
-154,222,47,248,226,83,253,10,77,228,198,37,96,250,88,177,136,17,164,117,226,
-90,250,197,42,215,2,86,115,130,235,79,6,28,108,33,39,140,81,253,81,108,206,11,
-56,112,90,111,226,212,166,227,166,190,0,14,132,254,236,251,4,76,123,136,209,
-99,14,123,189,30,88,15,113,2,115,90,87,235,4,142,156,62,239,91,114,237,63,204,
-163,143,154,239,222,47,61,135,176,11,251,245,133,20,125,133,252,217,158,95,28,
-125,243,28,151,123,129,204,152,249,121,46,215,184,85,78,221,111,46,246,94,65,
-188,245,92,156,109,62,145,59,153,246,129,30,100,136,162,223,35,248,197,179,50,
-244,32,200,17,79,244,23,123,31,249,2,155,212,236,168,109,214,149,251,166,247,
-6,114,206,103,205,44,71,238,32,199,11,73,215,147,187,132,210,166,49,167,14,
-148,176,209,35,248,137,117,115,93,216,123,238,91,254,210,162,230,66,251,155,
-57,64,159,178,183,181,167,57,47,114,174,54,185,94,228,93,123,146,243,194,166,
-174,23,126,178,255,40,245,216,32,39,114,190,7,208,255,243,53,230,212,121,190,
-7,127,97,49,112,95,94,156,251,7,107,241,10,235,195,103,196,133,121,244,79,115,
-2,102,206,208,31,245,30,9,198,92,236,217,220,83,25,19,92,37,121,20,92,37,252,
-243,231,23,255,227,98,212,156,26,197,128,111,183,111,93,252,223,77,174,204,63,
-127,120,241,15,236,107,240,183,217,207,61,82,195,187,61,135,205,28,87,193,181,
-144,96,223,116,89,218,177,81,152,224,90,140,9,227,246,179,52,143,148,117,93,
-54,111,108,126,109,236,71,54,170,95,224,171,113,98,110,158,175,218,110,91,55,
-229,99,28,214,238,15,182,192,101,201,204,147,159,170,119,174,235,214,145,242,
-85,155,224,138,197,88,245,206,125,253,110,87,49,147,29,93,43,122,128,15,45,
-185,7,174,231,225,10,238,132,81,126,75,187,47,197,196,149,223,92,112,40,70,
-239,241,227,88,80,237,205,24,43,142,57,70,127,230,131,223,57,251,0,242,131,
-188,98,185,199,106,141,10,126,60,175,136,227,30,217,24,144,161,92,207,195,254,
-186,159,224,105,109,106,230,253,120,202,81,88,142,94,84,61,237,99,29,172,7,76,
-60,44,214,189,83,234,98,62,241,51,97,226,91,244,208,98,30,234,207,30,208,121,
-224,136,25,55,90,127,57,128,6,63,33,207,190,179,254,243,249,168,177,168,52,
-199,235,82,92,159,94,198,172,174,133,225,15,108,247,223,60,245,57,240,131,121,
-87,108,228,34,247,67,217,55,150,99,142,194,142,105,236,227,56,80,210,203,188,
-222,47,241,240,17,181,38,135,13,151,128,59,214,235,1,214,220,179,22,243,67,30,
-243,69,198,117,206,7,113,181,54,248,137,241,248,155,192,251,72,115,222,207,
-224,218,31,97,211,37,96,174,15,158,115,0,158,239,29,92,91,99,6,135,61,231,9,
-167,122,248,133,126,96,252,213,30,115,3,189,214,235,180,71,97,131,125,114,194,
-173,145,228,48,108,247,117,177,158,246,233,156,31,173,1,57,252,80,156,175,203,
-207,115,185,250,166,114,112,206,49,215,87,137,235,115,239,156,229,107,164,100,
-218,7,122,144,33,138,126,143,230,62,155,242,130,156,151,60,155,29,181,77,12,
-242,59,245,6,108,66,247,232,69,243,43,109,30,217,175,114,223,240,163,184,30,
-188,80,194,254,142,253,137,120,248,133,33,198,170,103,44,200,79,223,179,212,
-133,47,90,163,58,143,159,58,15,189,153,251,152,186,200,239,35,157,174,199,62,
-65,14,225,11,214,197,56,214,247,158,171,125,196,223,46,194,166,227,129,123,92,
-95,206,243,61,228,115,122,143,242,12,2,102,162,83,191,249,217,235,177,128,32,
-131,63,158,235,184,31,199,108,231,239,94,252,199,77,122,187,253,219,226,31,
-219,163,224,60,2,225,207,127,88,252,125,54,186,221,190,121,241,9,215,229,202,
-183,219,175,217,159,164,95,89,12,233,191,47,254,38,199,168,1,75,52,200,164,33,
-7,225,79,77,228,244,235,99,16,48,254,48,227,212,55,97,52,18,154,222,41,63,228,
-16,131,66,84,202,47,154,113,163,81,255,88,92,109,136,110,43,214,155,109,160,
-49,185,65,92,235,220,227,68,28,249,175,6,16,247,78,127,117,118,49,214,161,237,
-140,235,7,56,229,110,23,135,152,147,111,16,167,233,219,55,95,23,243,188,38,
-204,161,226,230,60,209,191,107,54,249,48,51,247,195,243,90,131,185,54,106,3,
-91,240,49,242,64,59,234,91,254,107,76,125,141,156,67,173,11,37,113,160,101,28,
-242,201,252,100,92,248,219,109,97,109,198,31,227,186,62,236,42,6,177,228,58,
-244,181,29,167,107,99,62,236,40,209,174,99,34,43,240,195,237,193,14,248,233,
-11,205,226,152,151,113,145,179,45,85,90,146,106,87,215,39,134,154,147,253,132,
-55,174,251,142,56,238,17,149,230,243,160,249,153,120,182,217,215,38,115,45,
-149,128,53,103,89,231,87,209,35,170,15,223,176,119,80,183,240,145,31,197,166,
-186,88,254,206,24,216,209,26,130,145,35,200,249,83,231,129,115,204,209,31,180,
-9,249,195,51,204,9,215,139,35,231,121,206,84,139,158,211,130,115,194,245,102,
-248,54,157,111,181,23,34,142,124,62,192,247,156,111,112,206,167,174,25,245,
-235,56,80,210,203,188,30,27,250,45,226,131,222,53,196,246,47,92,106,206,176,
-22,30,82,240,133,0,228,208,71,45,52,39,113,142,99,46,244,96,218,209,124,100,
-28,108,194,94,172,153,207,136,184,162,62,206,49,126,168,161,95,240,83,123,48,
-242,228,18,242,51,189,97,156,182,36,114,88,251,32,226,1,71,254,116,175,7,198,
-115,135,223,96,16,215,251,10,24,61,103,129,59,253,45,12,196,12,189,83,183,151,
-71,152,211,123,20,28,47,235,172,3,123,100,250,82,174,246,125,244,131,226,214,
-44,203,31,63,207,229,90,67,149,131,35,127,145,95,213,107,125,178,28,53,70,46,
-71,223,156,48,22,93,211,131,12,33,122,65,51,103,61,79,222,215,209,95,121,63,
-90,158,155,109,212,207,109,214,90,114,126,191,143,184,220,185,214,150,236,87,
-225,23,165,29,203,26,79,52,229,151,123,200,125,86,61,99,97,31,65,162,107,69,
-46,88,115,141,149,243,162,87,117,30,117,209,115,125,30,124,130,205,199,47,154,
-170,139,252,97,77,167,56,107,232,127,127,63,209,216,226,154,121,8,84,175,7,
-253,192,243,43,176,156,95,49,209,243,192,226,217,20,185,2,158,62,213,30,208,
-124,169,221,240,9,215,196,196,28,191,250,206,197,127,184,248,239,23,255,248,
-93,234,124,187,125,126,241,31,217,149,190,112,118,220,143,44,254,171,61,250,
-179,197,191,106,215,29,199,171,42,87,190,221,254,103,241,183,239,209,31,64,
-176,232,119,23,223,231,169,1,219,72,32,147,134,28,132,160,189,32,209,56,138,
-33,14,73,226,139,7,37,248,217,15,15,202,129,139,34,247,98,196,92,74,176,46,
-198,121,3,177,41,189,113,92,202,130,233,129,194,195,25,182,216,188,170,11,27,
-216,212,104,18,31,51,22,199,57,247,56,49,158,30,6,222,229,69,51,252,153,55,
-205,244,96,139,121,190,41,32,65,126,65,192,99,12,253,84,15,207,173,199,239,
-227,233,48,98,172,33,197,26,192,78,177,168,77,72,35,166,140,13,191,40,241,56,
-114,173,137,197,218,92,207,165,161,131,47,186,94,62,20,162,7,152,251,94,175,
-208,81,2,59,176,87,111,150,208,123,157,32,137,121,129,193,92,30,204,148,248,
-203,177,247,60,226,200,118,233,31,228,200,19,230,245,131,246,202,218,249,102,
-22,120,181,19,135,163,175,135,235,168,101,223,143,176,3,157,82,255,102,84,115,
-182,36,149,12,157,241,169,102,134,161,166,199,21,120,165,211,30,69,76,74,140,
-43,244,201,207,205,200,133,211,212,123,117,109,165,105,63,70,238,179,206,175,
-78,49,186,111,32,248,100,26,203,77,207,95,234,135,11,24,228,197,109,198,250,
-148,229,126,228,92,173,15,240,200,55,100,152,3,121,245,189,249,3,194,245,102,
-246,155,74,122,45,96,131,123,229,1,78,9,227,197,140,109,62,47,149,124,157,156,
-43,158,111,208,129,216,47,208,228,7,11,93,79,243,151,109,129,139,94,230,209,
-79,197,198,126,196,250,158,111,48,207,144,26,19,207,10,173,37,174,193,88,139,
-117,225,250,60,67,242,126,246,43,207,231,189,199,246,167,226,96,11,113,224,
-139,15,218,123,140,101,237,66,19,218,176,101,253,177,57,242,228,18,242,51,189,
-98,156,17,11,243,87,207,48,230,216,235,11,162,143,138,227,217,169,125,22,215,
-181,6,196,42,99,237,233,57,0,117,209,231,5,216,205,231,17,217,175,162,238,148,
-102,123,113,159,80,154,94,160,176,78,93,119,58,47,217,155,117,157,147,92,253,
-83,57,56,231,111,250,210,39,116,89,14,31,145,147,108,179,230,88,107,69,54,31,
-149,12,33,250,125,21,61,84,109,176,39,225,83,212,35,239,199,121,127,240,188,
-128,110,252,210,96,240,229,46,119,50,109,214,107,204,225,23,198,61,246,30,188,
-80,194,62,203,99,244,20,226,165,87,174,203,207,10,57,86,230,32,114,164,243,
-168,139,253,174,243,184,30,230,33,190,233,183,150,81,47,237,107,234,188,135,
-160,7,107,143,195,143,211,47,83,208,95,32,204,197,23,114,196,6,245,58,50,6,
-216,198,26,92,167,98,34,183,136,7,140,181,96,27,126,78,47,175,88,211,113,81,
-95,202,152,71,174,249,21,153,243,19,139,127,127,49,98,248,185,197,212,184,62,
-112,126,245,29,139,255,124,241,223,44,254,98,194,128,111,183,63,93,252,179,
-123,244,189,139,241,79,167,190,110,192,241,170,202,149,187,228,235,239,215,91,
-162,6,118,123,142,7,11,254,244,100,59,77,15,37,94,56,149,66,86,31,24,128,241,
-132,158,214,76,152,205,180,175,146,104,186,74,108,96,199,69,195,240,70,169,
-205,18,54,80,104,151,198,6,113,137,115,143,19,243,242,122,196,189,246,69,19,
-62,210,30,52,115,163,158,94,52,105,151,146,136,161,142,243,188,138,3,79,185,
-158,112,145,187,231,88,200,128,173,113,95,171,53,184,231,94,235,8,251,216,136,
-188,137,67,170,7,88,244,0,252,154,254,189,91,232,40,153,99,139,67,217,125,166,
-79,122,32,18,3,63,193,176,7,140,31,110,115,30,232,159,199,16,135,167,214,63,
-236,250,218,188,214,181,227,42,247,181,218,225,225,232,107,121,223,199,56,219,
-3,65,167,245,116,219,15,95,26,42,45,76,181,27,123,103,227,241,51,201,31,224,
-141,181,198,129,211,28,145,21,87,252,44,204,122,86,233,180,54,153,107,169,4,
-172,57,203,58,191,138,126,83,125,248,230,191,157,138,56,248,81,108,170,139,
-229,239,49,6,140,26,227,39,227,36,10,215,211,153,94,99,6,30,243,127,106,49,
-228,167,51,236,238,15,8,215,139,35,231,121,142,203,149,250,77,95,231,47,137,
-19,174,55,51,158,62,79,123,193,253,135,159,57,87,241,64,229,56,80,251,171,149,
-178,38,98,100,253,76,99,31,199,129,146,94,230,209,31,197,198,76,205,95,228,
-190,246,56,207,10,96,112,175,192,156,120,49,241,90,146,25,183,238,253,136,19,
-126,248,189,198,114,154,112,121,69,207,7,113,212,78,54,177,158,231,154,49,43,
-142,53,84,95,193,145,39,151,144,159,233,117,93,228,0,117,189,175,93,98,169,
-245,5,211,87,173,111,63,95,163,231,234,153,184,70,78,91,50,251,153,237,129,
-231,125,16,254,69,221,49,230,39,112,212,71,15,115,93,238,105,197,177,71,188,
-110,32,228,157,185,87,220,142,3,63,69,118,150,107,13,85,14,142,53,25,111,173,
-1,239,59,253,204,62,201,163,174,78,245,140,50,31,149,32,187,235,35,167,103,
-159,184,6,242,173,117,243,171,208,81,26,26,198,10,155,111,251,162,153,107,166,
-212,238,73,219,204,72,5,187,165,36,140,69,7,202,251,50,235,253,10,126,229,243,
-149,57,136,115,70,231,81,135,188,241,60,211,121,92,135,123,5,18,173,187,247,
-130,238,3,151,112,127,98,45,248,226,82,239,127,124,17,70,155,167,254,34,123,
-77,113,15,131,45,196,14,27,136,63,63,111,228,61,9,61,158,203,234,253,11,115,
-245,221,72,233,227,161,223,216,51,186,38,53,204,47,175,153,211,152,243,235,
-246,39,34,9,75,217,46,56,143,190,127,241,63,45,254,235,36,5,223,110,63,36,35,
-240,15,46,254,134,36,1,251,85,149,43,207,82,242,190,82,3,187,5,199,38,68,81,
-88,112,50,174,167,135,146,218,0,51,150,24,54,166,115,63,96,58,198,237,171,68,
-215,200,216,233,191,76,142,194,230,166,159,108,196,6,113,137,115,143,19,243,
-152,159,140,123,205,139,38,54,12,190,93,136,27,73,111,84,230,70,101,148,135,
-93,74,34,134,58,206,243,42,14,60,229,122,194,157,106,60,97,195,191,140,189,86,
-107,112,207,125,228,134,135,16,24,235,96,227,231,154,68,15,208,7,237,1,176,
-234,40,153,99,203,118,226,129,91,123,56,247,27,94,24,224,51,236,210,30,190,
-173,170,15,46,156,3,12,106,63,191,104,242,192,244,181,127,116,49,236,95,249,
-109,37,244,129,137,7,170,137,114,222,192,244,11,107,210,39,50,235,166,184,176,
-91,235,73,238,251,60,246,142,226,220,247,154,163,130,31,207,43,226,238,62,56,
-25,202,245,131,159,134,225,53,215,246,145,243,180,54,53,61,15,96,205,89,214,
-249,149,247,71,205,117,244,93,244,3,214,56,61,36,221,235,98,62,105,156,3,102,
-49,226,139,127,26,16,178,233,76,175,245,113,223,156,243,94,102,94,153,191,144,
-58,99,45,196,82,207,31,141,55,52,53,214,199,189,229,121,122,246,111,52,125,
-173,158,79,238,45,229,169,126,204,49,71,136,7,122,224,96,167,174,91,243,238,
-76,127,84,146,103,122,254,34,143,53,23,244,213,237,35,111,192,122,141,48,199,
-231,51,167,234,91,156,77,172,5,49,184,174,15,104,199,88,77,222,109,134,157,
-141,1,37,220,92,107,92,67,150,247,65,204,138,181,179,94,207,67,143,197,52,109,
-221,192,42,119,187,244,29,182,38,202,53,187,98,15,204,248,188,255,192,145,3,
-197,209,94,207,79,141,67,251,130,60,219,139,251,128,51,252,235,231,205,178,
-254,48,95,248,169,114,174,199,251,142,202,193,156,227,189,215,109,174,209,139,
-214,114,185,115,213,175,81,37,67,184,158,243,243,62,84,61,152,122,228,79,235,
-166,136,200,119,63,47,184,199,14,126,153,116,144,59,153,54,235,53,230,240,11,
-227,190,6,8,126,77,84,239,95,123,69,18,198,162,211,115,155,125,167,250,232,35,
-234,245,89,35,246,125,175,55,117,145,123,157,199,245,98,223,107,108,140,63,
-246,18,176,174,211,222,163,196,25,182,64,189,78,100,29,121,156,176,129,251,32,
-100,176,11,121,222,187,81,11,224,97,155,177,42,134,177,196,252,192,18,81,125,
-161,14,28,185,225,53,206,29,216,232,251,153,127,242,223,101,222,110,255,188,
-248,139,38,115,125,198,225,37,242,47,23,255,237,226,159,52,217,140,235,92,37,
-39,185,242,44,37,239,43,53,176,91,112,104,66,38,0,201,195,8,63,65,211,67,9,
-146,116,191,209,44,6,150,227,140,67,98,33,247,102,193,207,47,23,12,230,198,
-195,54,127,98,156,55,16,155,25,69,99,195,82,138,185,249,155,4,226,96,131,7,
-109,111,122,248,174,54,96,147,235,59,206,153,216,104,36,174,199,185,25,247,46,
-127,117,54,114,167,190,18,135,181,167,7,219,176,75,137,218,203,227,60,175,226,
-192,140,81,113,145,39,176,75,79,53,134,77,200,21,203,185,122,112,16,123,173,
-214,196,210,47,149,134,142,255,35,24,71,248,201,92,184,62,122,128,242,238,135,
-251,12,127,32,193,79,208,163,7,2,124,41,192,24,251,77,200,243,10,140,251,5,44,
-198,253,55,47,145,95,196,135,181,217,83,122,8,231,67,31,220,49,140,19,54,180,
-159,243,141,42,252,167,239,193,240,147,123,83,165,17,139,199,225,243,115,141,
-34,238,90,123,224,49,174,125,18,113,134,116,142,235,132,175,24,226,184,71,214,
-200,201,80,174,63,251,9,198,120,234,189,180,182,217,164,230,180,31,35,103,42,
-231,218,96,206,235,125,232,185,197,122,144,32,231,216,15,211,111,249,106,93,
-122,62,58,198,237,105,220,184,158,206,244,169,62,62,31,185,203,245,100,108,
-174,71,124,174,241,92,63,250,235,116,22,175,147,161,20,119,174,153,207,167,
-108,190,177,43,30,254,193,70,253,150,29,235,43,110,170,31,125,227,8,118,160,7,
-142,222,6,238,116,95,137,181,21,155,237,194,15,96,136,51,173,125,2,223,207,
-129,26,31,214,196,189,174,251,22,249,242,250,68,254,114,47,170,79,41,86,147,
-103,155,94,23,239,217,96,237,71,158,77,218,83,190,246,248,91,161,125,21,107,
-103,125,61,51,179,182,239,3,172,171,56,230,77,99,102,143,41,135,127,125,159,
-34,102,232,21,55,253,213,237,154,27,175,111,142,135,185,1,22,118,230,60,131,
-117,62,37,115,79,229,88,206,121,118,220,156,175,238,39,115,254,65,203,7,184,
-230,175,238,197,243,90,115,12,11,165,132,177,232,154,30,100,8,215,247,126,203,
-122,176,230,60,228,180,197,17,124,227,115,163,250,77,219,228,26,143,207,231,
-167,201,157,76,155,245,134,217,87,169,23,246,71,113,61,120,161,130,221,82,18,
-198,162,243,88,98,31,169,158,53,155,251,39,242,203,243,71,231,81,7,223,121,
-134,246,121,145,215,171,186,216,239,92,143,236,190,129,40,175,245,136,243,50,
-124,213,53,244,218,145,96,230,3,115,192,184,230,218,138,97,126,16,39,116,176,
-133,151,87,216,155,115,173,57,161,93,16,122,31,191,180,192,79,80,190,79,198,
-108,240,231,22,255,201,226,233,55,149,248,13,230,223,45,254,233,197,161,81,12,
-56,143,130,171,228,36,87,158,165,228,125,165,6,44,41,32,147,134,28,132,4,59,
-161,24,108,56,197,16,135,68,251,191,69,3,225,97,35,55,24,152,141,228,9,6,193,
-94,46,48,49,186,46,48,88,59,63,0,230,27,174,19,27,73,15,57,54,67,52,147,54,98,
-222,72,78,241,141,191,227,156,105,159,27,146,140,88,122,12,239,254,159,1,121,
-252,57,102,202,255,239,95,52,231,60,241,70,84,107,28,54,241,159,38,57,49,71,
-154,123,240,213,90,131,123,238,195,86,247,45,31,138,221,255,156,195,238,199,
-220,235,249,208,98,143,99,204,79,197,192,95,198,93,231,212,60,100,172,251,89,
-255,7,53,191,242,253,131,159,185,215,233,15,214,80,226,154,25,195,27,251,146,
-216,190,167,6,12,63,114,110,88,79,223,215,78,253,165,33,226,174,181,152,207,
-130,136,67,41,234,171,113,61,194,43,134,56,238,145,53,114,90,242,176,21,126,
-130,129,83,98,79,43,2,204,181,239,181,52,155,212,112,45,197,130,117,95,101,
-185,247,24,215,233,125,224,185,99,109,201,30,119,61,11,166,186,124,117,192,
-232,254,158,236,35,7,87,95,52,193,192,247,60,69,94,39,191,184,94,175,105,242,
-199,201,80,138,59,247,22,40,246,97,207,231,189,23,132,49,102,92,46,233,251,31,
-84,31,204,233,27,71,88,15,121,69,172,244,54,112,167,243,18,52,190,84,137,93,
-159,67,255,76,107,159,132,223,87,222,23,90,203,199,243,181,118,49,7,177,32,
-135,218,3,234,83,138,213,228,221,230,68,185,71,162,134,138,71,206,123,95,196,
-40,214,206,122,208,148,95,16,99,87,44,235,171,235,18,83,206,87,167,45,113,251,
-211,111,202,107,143,195,118,143,131,235,122,126,65,243,89,200,126,73,251,205,
-252,224,167,218,211,62,61,157,173,213,191,211,254,131,111,124,46,202,114,224,
-115,253,40,119,187,253,188,96,125,225,27,99,232,107,33,46,172,85,207,68,248,0,
-155,89,190,102,43,97,44,186,166,7,25,194,245,241,98,194,30,179,25,246,241,17,
-8,241,192,95,141,147,182,56,10,159,53,199,148,99,222,39,83,239,218,124,126,
-154,220,201,180,89,111,152,125,21,126,81,218,176,219,204,72,5,187,165,36,140,
-69,231,61,133,122,247,30,166,46,124,209,125,80,231,169,221,152,199,123,143,
-230,142,186,232,187,71,58,93,143,123,196,243,174,4,31,84,158,239,147,236,75,
-216,140,243,154,236,251,104,222,67,244,69,207,140,254,69,18,109,143,252,36,
-215,32,252,84,109,176,214,160,234,200,159,111,146,219,237,183,101,20,92,37,
-121,20,92,37,39,185,242,44,37,239,43,53,96,73,1,153,52,228,32,29,145,235,161,
-11,102,19,116,174,155,112,42,76,181,119,42,94,95,55,143,148,249,225,168,218,
-83,159,102,191,163,41,171,230,20,103,245,13,227,44,243,171,217,246,235,237,
-134,60,75,102,158,236,169,222,185,226,78,53,1,107,62,193,122,192,40,14,92,177,
-179,93,222,28,170,116,242,213,175,38,157,174,85,215,185,26,95,197,213,81,72,
-85,147,117,19,215,60,76,254,131,231,24,112,64,225,80,197,225,202,149,93,115,
-178,163,113,20,140,211,93,86,99,190,226,27,57,143,42,95,141,121,177,249,195,
-79,72,39,124,245,21,44,56,167,53,82,28,101,62,170,252,196,38,56,205,127,132,
-175,186,98,231,37,57,121,106,11,124,5,51,113,157,7,46,115,83,204,224,62,39,
-143,38,230,39,36,195,26,160,53,202,184,58,202,140,115,6,15,11,124,96,80,141,
-216,55,187,161,201,254,199,222,202,156,235,211,109,220,53,246,9,201,201,30,
-184,214,252,145,93,112,181,93,71,207,88,231,151,124,39,206,245,60,250,100,242,
-87,218,76,58,101,181,231,18,29,101,59,228,235,235,190,168,190,160,132,1,215,
-154,157,214,230,39,36,215,214,29,113,230,199,107,237,93,245,143,247,146,254,
-207,20,124,126,205,227,73,14,174,190,85,159,248,92,128,123,123,126,169,61,219,
-180,28,56,153,246,129,30,100,8,215,235,179,214,146,52,61,49,208,241,37,42,228,
-196,6,10,47,36,231,223,126,215,56,125,62,63,77,238,100,218,172,55,76,147,80,
-218,52,219,204,72,5,187,165,36,140,69,231,177,204,47,212,124,89,71,252,124,89,
-215,88,227,165,137,47,154,90,63,206,139,231,64,181,201,245,34,239,154,87,206,
-11,155,186,94,237,175,19,215,62,186,58,175,214,49,230,113,143,76,152,53,122,
-68,134,86,124,216,68,252,250,69,144,19,214,202,243,98,118,230,42,201,163,224,
-42,201,163,224,42,57,201,149,103,41,121,95,169,129,157,150,158,152,45,78,84,
-49,155,183,54,19,228,130,25,113,134,120,130,1,25,234,2,14,100,200,3,46,233,88,
-120,20,151,5,38,163,201,251,95,107,35,111,43,153,32,23,140,225,246,135,227,56,
-152,250,161,69,222,150,50,25,170,224,246,71,101,38,191,66,192,201,156,227,60,
-67,93,192,129,12,169,88,61,96,150,68,169,97,215,72,105,75,231,23,77,193,134,
-164,235,156,76,123,208,23,221,56,31,100,168,151,227,182,244,76,5,127,205,46,
-15,246,248,38,245,62,211,62,215,237,28,48,78,5,123,213,230,17,231,100,232,55,
-198,27,34,99,174,224,182,116,166,130,125,58,7,58,193,37,60,126,138,236,46,119,
-50,237,3,189,146,33,159,96,13,241,4,51,145,205,202,243,158,206,133,94,176,79,
-241,32,155,113,97,142,161,174,224,20,1,174,15,25,135,121,32,67,62,193,93,193,
-128,10,238,205,176,32,67,191,0,95,201,102,95,152,123,21,7,186,138,125,37,174,
-97,77,155,245,13,163,4,157,224,142,88,67,189,63,123,159,125,156,255,85,191,
-195,190,49,233,53,249,93,231,132,177,232,64,124,96,215,151,14,242,140,223,114,
-39,211,170,62,158,169,130,53,14,127,214,218,186,209,134,190,240,132,220,176,
-160,45,113,76,188,38,40,166,218,220,58,147,14,114,39,211,102,125,195,56,65,46,
-24,227,173,26,169,96,183,148,132,177,232,52,170,254,75,16,214,12,177,159,190,
-212,134,30,148,127,251,29,114,126,249,167,117,137,245,80,27,218,118,9,125,192,
-28,62,143,235,122,235,234,10,149,57,239,52,47,141,40,105,152,71,100,232,130,
-79,163,19,235,188,170,115,174,146,60,10,174,146,60,10,174,146,147,92,121,150,
-146,247,149,26,216,105,233,137,217,226,68,21,179,121,107,51,65,46,152,17,103,
-136,39,24,144,161,46,224,64,134,60,224,146,238,11,247,43,52,189,19,155,191,31,
-136,224,109,37,19,228,130,49,220,254,112,204,67,15,196,13,121,56,108,43,25,
-170,224,246,71,101,38,191,66,192,201,156,227,60,67,93,192,129,12,169,88,30,
-204,95,123,209,124,64,5,127,205,110,28,222,143,110,158,38,171,116,5,227,84,
-176,87,109,30,113,78,134,126,99,188,33,50,230,10,110,75,103,42,216,167,115,
-160,19,92,194,227,167,200,238,114,39,211,62,208,43,25,242,9,214,16,79,48,19,
-217,172,60,239,233,92,232,5,251,20,15,178,25,23,230,24,234,2,174,146,205,186,
-56,207,144,79,112,87,48,160,130,123,51,44,200,208,47,192,87,178,217,23,230,94,
-197,129,174,98,95,137,107,88,211,102,125,195,40,65,39,184,35,214,80,239,207,
-222,103,31,199,47,47,63,176,231,32,149,239,249,38,189,38,191,235,156,48,22,
-221,171,215,114,50,173,234,243,51,155,83,252,51,6,95,111,177,211,26,85,27,87,
-94,52,201,249,153,109,35,206,126,155,116,144,59,153,54,235,27,198,9,114,193,
-24,111,213,72,5,187,165,36,140,69,103,250,52,210,56,37,135,198,58,55,158,157,
-201,143,230,229,154,103,221,213,245,214,213,21,42,115,222,116,158,33,158,96,
-148,12,253,2,188,147,205,242,57,58,91,185,74,242,40,184,74,242,40,184,74,78,
-114,229,89,74,182,63,111,183,255,5,75,238,218,119,32,100,170,216,0,0,0,0,73,
-69,78,68,174,66,96,130 };
+0,0,14,189,0,0,14,189,1,71,251,144,173,0,0,0,24,116,69,88,116,83,111,102,116,
+119,97,114,101,0,112,97,105,110,116,46,110,101,116,32,52,46,49,46,49,99,42,
+156,75,0,0,29,72,73,68,65,84,120,94,237,93,61,200,181,73,82,29,4,67,83,13,69,
+16,76,76,6,4,17,131,5,215,81,16,49,80,55,88,21,113,13,12,92,208,100,50,5,13,
+84,12,6,68,5,153,104,52,48,144,85,80,16,35,17,99,127,34,19,77,196,68,35,5,81,
+76,68,228,218,167,78,215,173,83,63,125,239,115,191,239,27,118,132,173,203,121,
+223,167,171,78,87,87,87,87,247,243,60,247,157,111,247,189,219,123,183,27,240,
+94,17,215,79,54,23,229,60,226,65,174,240,174,112,32,202,123,196,125,198,121,
+102,119,81,222,43,220,173,186,235,118,51,201,196,159,100,226,89,107,208,95,
+145,171,253,148,247,105,113,183,106,20,229,157,184,143,108,144,43,125,31,245,
+135,188,202,219,205,167,242,46,253,190,43,142,139,115,175,250,188,194,133,188,
+194,133,92,225,43,231,42,111,171,142,162,220,183,229,159,244,46,207,236,42,87,
+184,87,56,147,104,191,171,125,63,205,62,87,121,85,94,233,115,133,119,213,223,
+85,30,68,185,175,242,183,234,37,249,52,198,121,215,62,159,241,212,254,136,231,
+242,105,242,30,113,175,112,32,159,53,222,219,232,171,205,229,100,127,85,239,
+242,204,14,185,106,175,156,103,253,32,39,142,235,171,237,164,119,81,251,137,
+227,242,166,220,173,74,114,213,190,155,73,62,75,182,147,120,159,79,163,223,21,
+142,202,171,124,151,123,191,123,239,130,170,201,173,64,213,228,86,160,106,78,
+122,197,172,37,246,149,58,216,83,179,201,169,126,76,76,229,24,110,183,79,22,
+62,66,75,197,152,153,187,45,33,198,120,192,217,90,250,207,188,49,62,72,226,
+125,225,126,133,248,32,159,168,125,119,105,178,108,53,46,200,181,121,222,110,
+255,181,240,37,209,249,213,151,22,254,117,225,3,177,65,62,88,128,30,246,237,
+117,244,251,115,11,136,33,235,87,235,138,88,175,11,253,140,149,121,47,229,105,
+155,154,24,51,115,183,37,139,177,50,47,113,67,211,109,46,102,61,216,139,109,
+236,15,49,214,235,188,173,61,75,225,191,149,223,55,229,220,91,2,211,103,238,
+237,246,75,169,21,192,190,42,218,147,95,67,229,159,252,46,92,142,3,186,170,
+189,192,123,41,78,160,248,76,253,31,197,208,109,185,85,237,101,156,132,39,92,
+139,137,159,35,7,112,73,250,234,27,152,252,75,123,236,147,91,29,53,62,32,183,
+136,87,107,107,193,236,213,255,48,255,59,148,27,247,136,140,26,135,218,20,53,
+23,143,114,247,36,111,46,119,221,3,223,137,119,130,246,47,113,37,212,113,196,
+214,198,121,7,62,19,248,201,26,109,85,63,142,174,33,170,191,139,235,107,19,93,
+146,56,192,80,143,165,69,116,94,110,57,234,124,78,57,172,188,139,243,184,204,
+91,45,155,47,63,207,245,30,231,180,30,117,14,157,51,251,124,162,119,49,235,3,
+59,196,24,131,253,174,169,49,241,185,235,43,246,219,117,101,30,46,171,21,125,
+53,191,53,167,222,191,142,85,252,54,59,177,71,203,2,189,112,12,219,52,74,226,
+214,90,24,106,32,181,52,174,26,51,63,108,85,191,143,250,229,49,179,237,234,
+120,181,95,129,203,106,101,102,245,121,66,237,23,243,251,112,193,158,249,167,
+220,217,152,170,81,84,159,207,248,14,237,87,109,142,170,201,173,64,213,228,86,
+160,106,110,183,111,177,171,170,87,204,90,98,95,169,3,155,60,196,180,161,31,
+139,185,114,12,159,229,23,205,159,177,159,241,34,247,155,171,45,246,221,165,
+137,177,132,103,248,218,139,102,19,99,190,57,119,91,178,24,43,243,18,55,52,
+221,230,98,86,183,127,238,126,69,160,157,53,187,87,22,99,189,206,219,218,179,
+20,254,91,249,125,83,206,110,161,222,254,123,1,135,233,182,218,199,91,16,212,
+230,127,218,85,200,135,233,6,17,92,191,242,47,117,92,58,159,99,86,225,129,14,
+212,53,154,249,31,38,14,121,117,108,204,79,247,34,196,175,42,247,163,195,188,
+48,54,30,72,222,95,208,252,161,127,250,226,106,243,99,63,103,155,95,157,206,1,
+248,199,56,177,30,28,99,154,67,59,51,150,190,230,204,215,110,138,29,240,156,
+78,121,116,27,207,155,0,124,230,135,51,7,127,250,28,84,56,159,190,239,32,149,
+251,201,147,218,66,60,42,81,51,125,254,115,45,192,170,177,240,97,164,214,249,
+84,179,53,86,151,92,3,186,190,75,35,57,63,213,11,252,198,60,2,157,207,249,215,
+53,1,15,177,219,120,27,189,198,184,14,145,131,224,241,12,112,13,185,83,76,104,
+67,255,190,240,188,78,170,48,30,237,29,62,92,56,143,90,23,188,103,59,183,251,
+113,244,90,155,253,113,125,125,158,16,206,1,227,8,207,22,106,201,214,68,94,10,
+207,192,177,84,62,105,227,162,205,43,157,115,206,31,208,125,185,228,53,225,60,
+52,223,92,203,90,167,157,199,28,246,121,112,190,252,60,215,71,190,167,243,66,
+247,207,180,102,179,207,39,122,23,179,62,176,67,140,81,236,210,3,107,80,247,
+82,63,203,168,75,231,42,100,217,194,55,235,19,107,246,81,203,41,251,157,206,
+246,223,95,248,237,133,94,3,196,30,45,11,244,194,49,108,211,40,137,203,90,192,
+216,136,247,131,86,43,81,163,61,110,214,16,99,133,70,227,96,14,188,198,242,
+122,135,158,245,169,57,138,241,16,79,206,3,99,224,158,131,70,199,203,113,250,
+62,166,127,234,125,238,209,7,96,236,24,7,18,115,9,125,31,11,96,222,242,89,85,
+115,151,91,191,178,128,88,128,143,77,87,125,198,28,128,186,231,99,46,224,57,
+43,248,25,85,147,91,129,170,225,207,111,92,248,229,133,239,218,237,137,247,
+151,11,223,211,244,138,89,75,236,43,117,108,11,4,49,109,232,199,98,174,28,131,
+111,186,210,197,152,153,187,45,33,198,120,192,217,90,250,207,188,49,62,72,226,
+177,96,176,128,216,228,239,215,98,217,93,154,24,75,120,134,171,243,196,198,
+202,7,144,90,171,13,242,252,112,35,239,107,47,154,75,66,211,109,46,102,117,59,
+15,69,228,150,7,105,205,255,208,31,98,172,215,121,91,123,150,194,127,43,191,
+111,194,185,95,177,150,255,109,97,190,153,0,165,54,247,111,220,88,234,75,20,
+196,15,239,122,160,163,102,235,141,55,223,196,8,240,168,235,123,164,243,251,
+58,66,248,64,161,218,238,11,63,99,172,176,160,239,233,165,235,206,181,156,6,
+255,211,124,209,196,111,222,196,235,77,174,172,139,197,196,207,196,129,15,247,
+233,192,88,56,19,105,83,11,16,99,199,141,159,128,79,196,152,99,7,24,11,248,
+118,70,110,128,15,63,167,151,120,157,175,207,191,157,245,75,220,143,174,173,
+243,169,211,27,52,251,212,90,64,27,252,92,95,225,91,227,192,3,97,125,33,240,
+171,88,63,180,123,125,37,187,173,13,45,167,122,137,184,66,235,115,171,47,128,
+136,177,114,49,71,136,174,19,199,210,47,86,113,77,174,230,4,215,31,213,47,96,
+151,192,23,114,194,57,106,60,202,197,220,163,23,16,188,94,179,234,211,121,189,
+46,200,131,160,62,251,62,9,30,230,232,115,14,127,125,61,48,30,230,9,206,113,
+92,89,39,32,114,250,188,110,137,90,127,232,199,24,53,223,189,94,122,14,225,23,
+254,107,253,161,174,144,63,219,243,11,81,55,207,121,185,22,8,214,38,63,207,
+245,145,187,233,188,248,173,5,175,21,204,183,214,249,236,243,137,222,197,172,
+15,236,16,99,20,251,110,33,46,158,149,97,135,64,143,249,68,125,113,143,32,95,
+128,105,205,143,250,230,186,114,223,244,218,69,206,249,172,153,245,200,29,244,
+120,33,233,118,162,107,168,109,22,11,234,32,137,27,53,130,223,24,55,175,11,
+107,207,99,203,95,90,212,92,104,125,51,7,168,83,214,182,214,52,251,69,206,213,
+39,199,139,188,107,77,178,95,248,212,241,34,78,214,31,181,62,55,232,201,156,
+239,1,140,255,124,141,62,181,159,239,193,95,92,0,239,203,11,185,126,48,22,175,
+48,62,98,198,188,208,143,241,105,78,0,230,12,245,81,239,145,0,250,98,207,230,
+154,202,156,64,213,228,86,160,106,248,243,23,22,254,105,1,107,78,139,114,128,
+219,237,91,23,254,167,233,21,252,249,195,11,63,176,175,129,111,179,223,187,
+165,142,119,121,14,155,57,174,2,117,33,1,223,116,89,219,185,177,48,129,186,24,
+19,199,253,87,109,110,5,180,197,226,141,205,175,133,13,196,85,70,141,11,184,
+58,79,244,205,253,213,218,125,235,166,124,204,155,95,52,193,139,214,25,83,156,
+106,119,212,113,129,220,10,84,159,64,110,5,42,119,94,235,121,252,26,171,114,
+38,63,58,86,212,0,31,90,106,13,92,205,195,21,222,137,163,120,151,126,95,229,
+196,149,223,92,112,40,70,237,241,227,92,72,173,205,104,43,143,92,236,141,124,
+240,59,114,12,16,63,200,43,151,123,172,239,211,196,31,207,43,242,16,131,237,
+17,23,99,117,206,181,56,129,105,108,90,56,150,114,129,115,142,252,42,106,81,
+237,244,143,113,48,30,56,241,176,88,247,78,89,23,139,137,159,137,19,223,162,
+135,21,253,176,254,172,1,237,7,196,156,113,163,245,151,3,88,240,27,250,233,69,
+115,62,31,117,46,213,18,243,117,13,174,79,47,99,60,251,50,16,15,124,247,191,
+60,245,62,136,131,121,87,110,228,34,215,67,241,39,235,30,126,208,230,231,206,
+91,146,236,210,239,84,47,145,159,208,134,143,199,92,95,15,64,115,207,181,152,
+31,242,152,47,2,215,253,203,183,92,139,208,224,55,218,245,75,32,157,31,16,57,
+239,53,91,235,35,124,42,143,113,2,115,14,28,93,195,177,117,206,64,248,115,204,
+188,184,66,92,168,7,206,191,242,0,218,117,189,78,123,20,62,88,39,39,222,106,
+73,14,145,119,250,238,241,97,60,173,211,57,63,186,6,68,196,161,60,31,151,159,
+231,122,141,77,245,64,206,49,199,87,141,219,115,237,156,245,171,165,98,214,7,
+118,136,49,138,125,183,230,58,155,242,130,156,151,60,155,31,245,77,14,242,59,
+125,153,2,159,176,61,122,209,252,120,172,169,208,228,186,225,71,121,125,242,
+34,137,251,187,246,19,243,225,23,134,104,171,157,115,65,126,250,158,165,45,98,
+209,53,170,253,248,169,253,80,155,185,142,105,139,252,62,178,233,120,172,19,
+228,16,177,96,92,180,99,124,175,185,90,71,252,235,34,124,58,31,188,199,235,
+203,126,190,135,188,79,175,81,228,138,156,73,78,245,230,103,175,207,5,2,29,
+226,241,92,199,253,56,122,59,190,123,225,79,154,246,118,251,247,133,31,219,
+173,64,110,65,240,243,31,23,190,207,90,183,219,55,47,156,120,93,175,184,221,
+126,221,126,82,126,117,1,218,255,88,248,38,231,168,3,75,52,196,180,161,135,
+224,167,38,242,244,159,53,129,227,15,51,46,125,19,70,33,161,232,93,242,67,14,
+57,88,136,42,167,23,77,141,111,90,220,234,171,126,67,140,159,234,3,133,201,13,
+162,60,114,235,60,49,143,252,159,6,144,247,86,255,233,236,2,198,161,239,204,
+155,95,52,195,47,14,49,23,223,32,46,211,183,111,62,46,250,249,154,244,28,146,
+139,159,154,39,198,55,215,67,245,201,135,153,185,30,174,174,53,198,198,218,
+192,23,98,140,27,25,253,104,108,249,63,99,234,99,228,155,160,174,11,53,113,
+160,101,30,242,201,252,100,94,196,219,125,97,108,206,63,218,117,124,248,85,14,
+230,146,215,161,143,237,60,29,27,253,225,71,133,126,157,19,89,65,28,238,15,
+126,128,167,47,52,11,209,79,121,228,66,15,187,105,84,150,166,250,213,241,201,
+161,101,246,95,248,134,186,239,200,67,158,56,23,71,223,159,41,206,132,217,103,
+31,155,224,88,170,1,52,103,217,230,87,81,35,106,167,127,140,131,189,131,117,
+139,24,249,81,110,90,23,203,223,153,3,63,186,134,0,114,4,61,127,107,63,32,207,
+57,234,131,62,161,175,15,173,144,20,15,4,215,11,62,175,105,28,234,67,115,202,
+233,157,231,130,235,13,196,54,157,111,181,22,98,30,249,124,192,156,114,190,
+129,146,79,25,51,214,111,224,45,73,118,233,119,154,155,231,7,118,215,146,219,
+191,112,137,92,82,131,177,240,144,130,47,4,160,135,221,215,61,159,207,124,48,
+2,208,23,118,128,126,250,190,119,30,124,250,154,79,220,184,162,61,206,49,126,
+194,202,56,181,6,35,79,202,139,94,39,187,193,18,187,100,107,34,135,181,14,98,
+222,64,228,175,159,11,248,233,185,195,95,48,200,171,254,200,213,115,22,188,
+211,127,133,129,57,195,238,50,249,211,22,250,244,26,5,248,133,41,108,92,7,214,
+200,244,165,92,173,251,168,7,229,173,94,150,63,126,158,235,153,59,174,161,234,
+129,200,113,228,87,237,186,62,89,143,53,70,46,199,216,92,208,22,91,179,67,140,
+33,118,97,51,103,61,79,94,215,81,95,88,67,157,195,210,54,223,88,63,247,89,215,
+146,253,251,125,196,245,142,186,182,132,95,69,92,212,118,46,215,120,146,41,
+191,220,67,30,179,218,57,23,214,17,52,58,86,228,130,107,174,115,101,191,168,
+85,237,71,91,212,92,239,135,152,224,243,241,139,166,218,34,127,24,211,37,206,
+26,198,63,125,121,20,115,139,107,230,33,88,211,249,135,56,240,252,10,46,251,
+87,78,212,60,184,120,54,69,174,192,103,76,181,6,52,95,234,55,98,194,53,57,209,
+199,175,190,115,225,143,22,254,97,225,199,239,90,199,237,246,249,133,63,182,
+43,125,225,236,188,31,89,248,235,221,250,243,133,95,179,235,206,227,85,213,43,
+110,183,255,93,248,246,221,250,67,40,150,252,222,194,189,159,58,176,141,4,49,
+109,232,33,152,180,47,72,20,142,114,200,67,146,248,226,65,13,126,247,195,131,
+122,240,98,145,251,98,68,95,106,48,46,218,211,203,135,23,142,107,184,96,202,
+225,225,12,95,44,222,249,80,198,166,70,145,64,131,54,231,162,60,114,235,60,
+209,158,30,6,222,230,69,51,226,233,155,230,209,139,166,111,10,104,144,95,136,
+231,6,246,105,61,60,183,62,127,111,79,15,132,156,107,104,48,6,184,211,3,167,
+250,132,38,230,148,121,17,23,53,62,143,105,173,49,54,199,115,109,216,16,139,
+142,151,15,133,168,1,230,190,175,87,216,168,129,31,248,171,55,75,93,39,104,
+162,95,112,208,151,7,51,53,254,114,236,53,143,121,100,191,140,15,122,228,9,
+253,250,65,123,101,236,124,51,11,190,250,137,195,209,199,195,117,172,101,223,
+143,240,3,155,74,255,102,148,92,230,108,181,170,24,59,115,211,154,25,135,150,
+62,175,224,171,156,246,40,230,164,194,121,101,206,61,206,13,228,194,101,170,
+189,58,182,202,244,226,16,185,207,54,191,58,205,209,235,14,130,152,204,98,185,
+233,249,75,245,112,129,131,188,184,207,24,159,186,105,191,235,250,128,143,124,
+67,135,62,208,231,216,217,39,197,3,193,245,6,235,77,53,64,94,11,248,230,94,
+121,192,83,65,123,129,115,155,31,50,84,124,156,156,43,244,163,13,194,122,129,
+165,60,88,200,120,154,191,236,11,40,246,22,167,114,1,254,196,248,158,239,56,
+67,234,156,120,86,232,90,226,26,136,117,225,248,60,67,242,126,246,43,175,179,
+123,141,237,143,183,32,248,9,95,152,7,190,248,160,191,206,245,43,112,185,118,
+97,81,30,228,94,31,27,145,39,229,69,175,147,157,200,45,204,133,249,171,103,24,
+207,60,95,95,8,99,236,103,157,231,5,246,184,174,107,64,174,182,48,246,244,28,
+128,117,209,231,5,248,237,231,81,244,138,117,167,54,251,139,251,132,202,244,2,
+133,113,234,184,211,121,201,218,172,227,156,244,26,159,234,1,222,123,60,103,
+211,151,62,97,203,122,196,136,156,100,159,244,23,168,107,181,90,85,140,33,246,
+125,21,53,212,215,59,246,140,235,226,254,136,156,205,251,131,231,5,108,227,
+151,6,67,44,119,189,139,89,179,93,231,172,123,121,154,123,159,188,72,226,62,
+203,99,212,20,230,203,168,220,150,159,21,242,92,153,131,200,145,246,163,205,
+207,142,124,134,113,60,244,195,252,166,191,90,198,122,105,93,211,230,53,4,59,
+160,53,142,56,78,127,76,65,125,65,208,23,95,200,145,27,210,215,145,115,128,
+111,140,193,113,42,39,114,139,249,0,24,11,190,17,231,244,242,138,49,157,23,
+235,75,29,243,200,49,63,150,62,63,177,240,7,11,152,195,207,47,208,226,246,224,
+249,213,119,44,252,197,194,223,46,124,49,113,128,219,237,207,22,126,118,183,
+190,119,1,255,116,234,235,6,30,175,170,94,209,53,95,127,191,222,26,117,176,
+203,115,60,88,240,211,147,237,114,122,9,65,18,85,11,93,125,80,7,199,19,122,26,
+51,113,54,232,95,53,0,23,171,202,87,18,39,10,134,55,202,94,136,240,129,133,
+118,77,108,16,229,1,125,158,232,135,254,245,5,234,77,95,52,17,35,253,193,210,
+11,245,217,95,52,189,112,99,14,181,157,251,85,30,112,202,117,229,249,166,159,
+234,161,114,49,14,184,117,222,175,172,117,205,125,228,128,254,177,17,121,19,
+135,86,15,176,168,1,196,53,253,123,183,176,81,51,207,45,14,101,143,153,49,233,
+129,72,14,226,4,224,15,28,63,220,230,60,48,62,159,67,28,158,186,254,225,215,
+199,230,181,142,29,87,17,63,218,234,135,135,163,143,229,117,31,237,236,15,2,
+155,174,167,251,126,248,210,80,101,217,171,223,216,59,155,143,223,73,255,128,
+111,208,53,14,158,230,136,168,60,137,179,128,235,89,181,211,216,4,199,82,13,
+160,57,203,54,191,138,122,83,123,228,214,255,58,21,243,224,71,185,105,93,44,
+127,143,57,0,214,24,191,57,79,178,112,61,237,225,58,103,240,209,255,167,22,
+160,207,177,179,79,138,7,130,235,5,159,215,52,14,244,42,167,7,123,246,95,45,
+23,92,111,112,62,125,95,107,45,120,252,200,73,206,85,60,80,57,15,210,94,92,
+101,76,204,145,235,135,182,250,2,138,93,250,49,30,229,2,252,169,107,21,185,
+175,181,203,179,2,28,220,43,208,39,94,76,124,45,9,206,91,247,126,204,19,113,
+248,189,198,114,154,120,64,92,121,62,200,3,248,97,43,124,98,60,207,53,231,172,
+60,32,199,10,68,158,148,23,189,78,118,130,63,145,3,172,235,125,236,54,151,136,
+209,193,88,31,215,75,212,108,61,19,23,108,130,75,182,102,142,51,251,3,230,125,
+16,241,197,186,163,205,79,240,104,143,26,230,184,220,211,202,99,141,248,186,
+65,144,119,230,94,121,203,187,205,161,142,115,210,51,174,201,143,142,201,249,
+214,53,224,125,167,159,197,39,125,172,171,75,61,59,44,70,21,232,238,246,200,
+233,57,38,142,129,124,235,186,249,85,216,168,13,11,231,10,159,239,246,69,51,
+175,153,74,187,39,109,55,163,20,238,214,82,208,22,27,36,214,212,216,246,185,
+247,221,87,136,43,159,175,204,65,156,51,218,143,54,228,141,231,153,246,227,56,
+220,43,208,232,186,123,45,232,62,112,13,159,127,48,22,98,113,173,215,63,190,8,
+163,207,83,125,17,190,166,184,135,193,23,230,14,31,152,127,126,222,200,123,18,
+118,60,151,229,26,100,95,125,55,82,249,112,168,55,214,140,142,73,11,243,203,
+107,230,52,250,252,134,253,196,76,194,83,246,11,228,214,247,47,252,243,194,
+223,36,45,112,187,253,144,180,128,31,92,248,134,164,1,252,170,234,21,179,150,
+216,87,234,96,151,224,88,132,88,20,46,56,129,235,233,97,161,22,192,204,37,135,
+133,233,232,7,76,231,184,127,213,0,62,70,214,102,127,44,250,88,88,45,122,160,
+251,136,13,162,60,160,207,19,253,152,159,204,123,147,23,77,108,24,124,187,16,
+55,146,94,168,255,95,95,52,35,190,204,123,101,173,107,238,35,7,60,132,0,140,
+131,141,159,215,36,106,128,49,244,26,8,27,53,243,220,178,159,120,224,214,26,
+206,245,134,23,6,196,12,191,244,135,111,171,234,131,11,251,128,131,181,159,95,
+52,121,96,250,216,63,186,0,255,87,254,90,9,123,112,152,43,216,38,201,121,3,24,
+23,198,100,76,4,215,77,121,128,235,179,150,232,251,60,246,142,242,60,246,154,
+163,194,31,207,43,242,238,49,184,24,235,192,1,140,195,107,142,237,45,199,52,
+54,45,167,60,68,206,178,205,175,188,62,106,174,163,238,162,30,48,198,233,33,
+233,190,46,22,83,159,103,93,59,204,47,254,105,64,232,166,61,92,215,199,99,115,
+244,135,127,207,95,214,2,24,11,115,153,206,84,159,111,104,235,92,129,178,102,
+2,207,211,179,127,163,233,241,247,124,114,111,41,198,245,147,117,199,124,96,7,
+143,89,23,222,146,154,119,7,227,81,13,16,87,158,191,200,99,205,5,99,117,255,
+200,27,184,190,70,232,227,253,153,83,141,45,206,38,174,5,57,184,110,15,104,
+167,185,154,190,251,12,63,155,3,73,60,160,175,53,174,161,203,251,32,122,197,
+216,217,78,228,185,152,118,28,183,175,239,236,151,190,38,121,180,102,192,201,
+31,230,231,245,7,196,254,86,30,227,11,155,91,234,60,180,46,136,217,95,220,7,
+28,136,175,159,55,203,251,195,124,149,154,88,130,241,120,223,81,61,192,62,94,
+123,221,231,106,189,52,150,235,29,213,190,90,85,140,225,118,246,207,251,80,
+237,0,237,200,159,174,155,50,34,223,253,188,224,30,59,196,101,218,65,239,98,
+214,108,215,57,71,92,104,247,49,32,136,107,146,122,255,218,35,82,208,22,155,
+190,192,177,238,212,30,117,68,187,62,107,196,190,239,235,77,91,228,94,251,113,
+188,216,247,58,55,206,63,246,146,62,3,104,237,81,227,128,47,72,95,39,66,91,62,
+79,248,192,125,16,58,248,133,62,239,221,88,11,240,225,155,115,85,14,231,18,
+253,131,75,70,141,133,54,32,114,195,107,156,59,240,209,247,51,127,242,223,101,
+222,110,255,178,240,69,211,185,61,243,240,18,249,87,11,127,183,240,147,166,
+155,121,29,85,115,210,43,102,45,177,175,212,193,46,193,161,8,153,0,36,15,45,
+252,134,76,15,37,72,210,253,70,179,0,46,219,153,135,196,66,239,197,130,223,95,
+46,28,244,141,135,109,254,70,123,122,0,196,162,177,96,169,65,223,28,31,139,30,
+62,120,208,106,209,3,140,93,125,192,39,199,87,94,112,163,144,56,30,251,102,
+222,219,252,167,179,145,187,30,235,87,243,69,19,122,142,77,204,107,12,80,175,
+92,246,157,95,30,174,174,53,227,82,109,216,248,191,8,198,22,126,51,23,110,143,
+26,160,190,199,129,60,32,102,196,3,13,126,67,30,61,16,224,75,1,206,177,223,
+132,60,175,224,120,92,224,162,221,255,242,194,3,203,231,135,177,89,83,122,8,
+231,67,31,232,28,206,179,238,137,124,163,138,248,25,123,0,113,114,111,170,54,
+230,226,243,240,254,211,26,121,30,213,55,248,104,215,154,143,121,134,118,158,
+215,137,95,57,228,97,254,54,190,139,177,50,103,138,19,64,123,154,87,26,219,
+124,210,194,177,148,11,104,206,84,143,120,121,197,126,189,14,61,183,24,15,26,
+228,28,251,161,127,115,222,215,165,231,163,115,220,159,206,27,215,211,153,62,
+173,143,247,71,238,166,125,239,118,204,207,181,158,235,94,247,128,204,215,197,
+88,157,55,173,153,231,139,186,249,198,174,124,196,7,31,245,91,118,140,175,188,
+113,253,44,54,182,224,7,118,240,122,188,177,159,53,127,49,182,114,23,196,47,
+226,0,135,60,232,170,239,126,14,212,249,97,76,220,235,122,108,145,47,95,159,
+200,95,169,197,211,92,77,159,125,250,186,120,205,6,30,239,97,31,123,252,171,
+208,190,138,177,179,157,224,220,181,214,136,121,92,229,49,111,125,255,105,43,
+226,171,60,128,118,229,77,127,33,173,185,241,245,205,243,65,63,114,225,103,
+206,51,160,253,169,153,107,42,206,25,224,156,103,231,205,249,234,113,178,174,
+223,27,243,145,199,236,123,241,60,214,60,135,197,82,65,91,108,205,14,49,134,
+219,153,83,204,3,115,231,90,169,29,208,156,135,158,190,216,66,108,124,110,212,
+184,233,155,168,243,241,254,252,52,189,139,89,179,221,56,251,42,213,194,254,
+40,175,79,94,164,112,183,150,130,182,216,124,46,177,143,212,206,53,155,235,39,
+242,203,243,71,251,209,134,216,121,134,246,126,145,215,171,54,214,30,247,45,
+53,128,199,6,161,190,174,71,156,151,17,171,142,161,215,206,4,152,15,244,1,112,
+205,177,149,195,252,96,158,176,193,23,94,94,225,111,206,181,230,132,126,33,
+168,125,252,209,2,191,33,249,62,25,189,129,207,45,252,233,194,244,151,74,252,
+5,243,239,23,126,122,33,44,202,1,114,43,80,53,39,189,98,214,18,251,74,29,88,
+82,32,166,13,61,4,9,118,193,98,176,224,148,67,30,18,237,255,22,13,130,135,141,
+92,96,0,11,201,19,12,129,191,188,192,228,232,184,224,96,236,233,1,16,63,49,
+182,11,11,73,57,44,134,40,166,90,136,44,16,47,86,72,124,227,175,60,114,225,
+159,27,146,192,92,250,28,222,254,127,12,200,231,159,231,252,213,125,209,172,
+121,226,141,168,174,49,185,240,137,255,209,36,23,230,168,230,254,181,181,174,
+185,15,95,61,182,124,40,178,6,148,147,15,140,30,199,92,235,249,208,98,141,163,
+205,79,229,32,94,206,187,246,233,53,168,92,143,179,254,47,168,249,149,239,31,
+252,206,55,116,198,131,49,84,56,102,230,240,198,190,52,182,239,105,1,16,71,
+206,13,107,196,247,181,203,233,165,1,63,235,90,204,103,65,204,67,37,214,183,
+62,168,156,248,202,33,15,62,48,15,155,27,100,233,171,47,191,2,79,133,53,173,
+92,128,99,223,215,210,124,210,194,177,148,11,156,247,155,215,24,199,57,159,69,
+92,91,194,231,93,207,130,105,93,242,63,27,208,56,168,153,252,35,7,87,95,52,1,
+240,79,121,194,207,41,46,142,87,215,148,125,238,241,184,24,171,243,240,179,
+214,22,36,246,97,207,231,189,22,4,104,115,94,174,233,251,31,210,30,204,45,54,
+182,48,30,242,138,185,246,120,251,121,227,50,189,84,169,95,239,195,248,160,
+171,190,163,229,117,161,107,249,184,191,174,93,244,193,92,144,195,84,3,167,
+185,154,190,251,156,164,215,8,127,42,31,57,159,234,194,175,98,236,108,39,122,
+126,33,156,187,242,184,190,58,46,57,165,94,108,114,75,182,198,115,121,250,255,
+209,212,26,135,239,62,15,142,235,249,133,204,103,33,235,37,237,55,139,131,159,
+234,79,235,244,116,182,214,61,56,239,63,198,198,231,162,172,7,127,90,63,247,
+219,207,11,248,102,108,156,67,31,11,243,194,88,245,76,68,12,240,153,245,171,
+183,10,218,98,107,118,136,49,220,30,47,38,172,49,235,97,31,111,65,48,31,196,
+171,243,164,47,182,34,102,205,49,245,232,247,209,84,187,214,159,159,166,119,
+49,107,182,27,103,95,69,92,212,54,238,118,51,74,225,110,45,5,109,177,121,77,
+97,189,123,13,211,22,177,232,62,168,253,212,111,244,227,189,71,115,71,91,212,
+221,35,155,142,199,61,226,121,87,65,12,170,207,247,73,214,37,124,198,121,77,
+248,62,154,247,16,99,209,51,163,127,145,68,223,35,158,228,26,130,223,106,13,
+232,26,84,27,241,249,166,185,221,126,71,90,129,170,201,173,64,213,156,244,138,
+89,75,236,43,117,96,73,129,152,54,244,16,109,17,211,161,203,34,232,168,155,
+112,90,152,234,239,180,120,211,184,185,21,208,86,245,87,99,82,27,17,69,89,45,
+167,121,214,216,208,206,58,191,154,125,191,234,23,173,170,143,214,25,147,63,
+181,59,42,15,200,173,64,205,39,224,7,76,214,94,171,7,191,57,84,237,20,171,95,
+77,54,29,171,142,83,231,55,199,49,229,33,183,66,171,150,108,155,80,243,48,197,
+15,204,115,192,1,133,67,21,135,43,71,118,203,201,143,206,163,112,92,238,186,
+58,231,43,177,57,114,43,227,234,156,23,44,30,126,66,59,241,107,172,128,240,92,
+86,43,241,76,119,111,21,60,241,9,164,254,143,248,213,86,252,188,146,147,167,
+190,128,43,156,9,181,31,80,250,166,57,3,83,159,220,234,224,39,107,165,229,178,
+90,15,121,5,56,103,240,176,192,7,6,181,200,28,204,111,88,114,252,177,183,50,
+202,250,52,31,142,26,239,201,31,80,215,124,225,232,23,168,190,91,239,39,208,
+254,101,77,19,202,122,158,98,50,253,27,250,148,171,12,245,231,26,109,85,63,
+142,174,33,42,255,133,245,133,36,14,48,172,89,105,17,252,132,230,226,184,19,
+207,226,120,83,127,167,53,169,254,120,47,233,255,76,193,251,215,60,158,244,64,
+141,173,198,196,135,124,220,219,243,75,237,217,167,229,192,197,172,15,236,16,
+99,184,93,159,181,150,166,217,201,137,151,168,208,147,27,44,188,144,228,191,
+126,123,204,64,157,167,247,231,167,233,93,204,154,237,198,105,26,106,155,101,
+187,25,165,112,183,150,130,182,216,124,46,243,11,53,95,214,49,127,190,172,235,
+92,227,165,137,47,154,186,126,236,55,191,104,114,188,200,187,230,149,253,194,
+167,142,87,235,235,132,90,71,87,251,213,117,140,126,220,35,19,103,181,30,137,
+177,149,31,62,49,127,253,34,200,5,99,229,126,209,59,163,106,114,43,80,53,185,
+21,168,154,147,94,49,107,137,125,165,14,118,90,122,98,182,58,73,229,108,108,
+107,22,232,133,51,242,140,241,132,3,49,86,230,205,196,37,133,183,181,20,180,
+197,6,193,226,114,129,9,20,121,255,207,106,136,237,37,11,244,194,49,222,254,
+176,29,7,83,63,180,136,237,41,139,177,10,207,62,188,74,250,43,98,189,46,244,
+51,86,230,29,7,48,102,225,46,185,191,104,170,24,51,115,183,133,178,181,243,
+139,166,112,67,211,109,46,102,61,216,139,109,236,15,49,214,235,188,173,61,75,
+225,95,243,203,131,61,190,73,189,247,180,207,117,63,7,142,75,225,94,245,105,
+216,166,81,140,157,249,219,50,139,177,159,240,141,145,57,151,120,91,61,74,229,
+110,108,107,23,216,132,151,248,248,45,186,187,222,197,172,15,236,42,198,124,
+194,53,198,19,206,36,214,43,247,123,218,23,118,225,26,182,233,40,214,227,66,
+31,99,93,225,37,198,66,125,200,88,173,147,24,243,9,175,112,142,206,42,15,173,
+147,24,51,115,207,228,37,198,206,252,109,185,38,214,251,66,223,194,123,37,166,
+173,237,82,120,71,98,229,161,165,98,214,108,55,108,115,147,101,171,252,109,
+201,98,44,225,109,117,147,202,3,182,41,137,177,50,111,91,178,24,235,179,192,
+243,255,212,239,176,111,76,123,77,127,183,185,160,45,54,8,31,216,245,165,131,
+152,249,91,239,98,86,181,199,51,85,64,231,225,207,90,219,54,250,208,23,158,
+208,27,23,178,53,206,209,87,150,205,56,199,109,218,65,239,98,214,108,111,28,
+23,232,133,99,216,166,81,10,119,107,41,104,139,77,103,213,255,8,194,53,195,
+220,79,95,106,195,14,201,127,253,14,61,191,252,211,117,137,241,176,54,244,237,
+26,198,128,62,124,30,215,241,214,213,21,41,125,222,170,95,106,81,211,56,143,
+196,216,133,159,90,39,104,191,106,115,84,77,110,5,170,38,183,2,85,115,210,43,
+102,45,177,175,212,193,78,75,79,204,86,39,169,156,141,109,205,2,189,112,70,
+158,49,158,112,32,198,202,188,153,184,164,240,182,150,130,182,216,32,248,137,
+162,119,97,241,247,3,17,216,94,178,64,47,28,227,237,15,219,60,244,32,220,144,
+135,195,182,138,177,10,207,62,188,74,250,43,98,189,46,244,51,86,230,29,7,48,
+102,225,46,249,218,139,230,3,41,252,107,126,227,240,126,116,243,52,93,149,43,
+28,151,194,189,234,211,176,77,163,24,59,243,183,101,22,99,63,225,27,35,115,46,
+241,182,122,148,202,221,216,214,46,176,9,47,241,241,91,116,119,189,139,89,31,
+216,85,140,249,132,107,140,39,156,73,172,87,238,247,180,47,236,194,53,108,211,
+81,172,199,133,62,198,186,192,171,98,189,114,191,109,233,98,204,39,188,194,57,
+58,171,60,180,78,98,204,204,125,56,55,99,103,254,182,92,19,235,125,161,111,
+225,189,18,211,214,118,41,188,35,177,242,208,82,49,107,182,27,182,185,201,178,
+85,254,182,100,49,150,240,182,186,73,229,1,219,148,196,88,153,183,45,89,140,
+245,89,224,241,203,203,247,110,95,88,80,253,238,111,218,107,250,187,205,5,109,
+177,189,241,88,46,102,85,123,126,102,115,137,127,198,224,227,45,184,172,86,
+245,113,229,69,147,200,207,108,155,113,142,219,180,131,222,197,172,217,222,56,
+46,208,11,199,176,77,163,20,238,214,82,208,22,155,217,83,75,231,41,57,52,104,
+95,172,163,218,30,245,203,107,158,109,87,199,91,87,87,164,244,121,167,253,140,
+241,132,163,98,236,23,248,46,214,203,251,104,111,69,213,228,86,160,106,114,43,
+80,53,39,189,98,214,18,246,243,118,251,63,227,27,138,9,123,111,123,255,0,0,0,
+0,73,69,78,68,174,66,96,130 };
+
static const char*
default_charset = R"( abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.!?;:-_/|\!'"+=*()[]{}&%$#@<>^`~)";